Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Mar 2013 00:22:43 +0000 (UTC)
From:      Pyun YongHyeon <yongari@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r248859 - stable/8/sys/dev/bge
Message-ID:  <201303290022.r2T0Mhhf062598@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: yongari
Date: Fri Mar 29 00:22:43 2013
New Revision: 248859
URL: http://svnweb.freebsd.org/changeset/base/248859

Log:
  MFC r248226:
    r241438 broke IPMI access on Sun Fire X2200 M2(BCM5715).
    Fix the IPMI regression by sending BGE_FW_DRV_STATE_UNLOAD to
    ASF/IPMI firmware in driver attach phase.  Sending heartheat to
    ASF/IPMI is enabled only after upping interface so
    setting driver state to BGE_FW_DRV_STATE_START in attach phase
    broke IPMI access.
    While I'm here, add NVRAM arbitration lock before performing
    controller reset. ASF/IPMI firmware may be able to access the NVRAM
    while controller reset is in progress.  Without the arbitration
    lock before resetting the controller, ASF/IPMI may not initialize
    properly.

Modified:
  stable/8/sys/dev/bge/if_bge.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/dev/   (props changed)
  stable/8/sys/dev/bge/   (props changed)

Modified: stable/8/sys/dev/bge/if_bge.c
==============================================================================
--- stable/8/sys/dev/bge/if_bge.c	Fri Mar 29 00:21:36 2013	(r248858)
+++ stable/8/sys/dev/bge/if_bge.c	Fri Mar 29 00:22:43 2013	(r248859)
@@ -3637,15 +3637,15 @@ bge_attach(device_t dev)
 	}
 
 	bge_stop_fw(sc);
-	bge_sig_pre_reset(sc, BGE_RESET_START);
+	bge_sig_pre_reset(sc, BGE_RESET_SHUTDOWN);
 	if (bge_reset(sc)) {
 		device_printf(sc->bge_dev, "chip reset failed\n");
 		error = ENXIO;
 		goto fail;
 	}
 
-	bge_sig_legacy(sc, BGE_RESET_START);
-	bge_sig_post_reset(sc, BGE_RESET_START);
+	bge_sig_legacy(sc, BGE_RESET_SHUTDOWN);
+	bge_sig_post_reset(sc, BGE_RESET_SHUTDOWN);
 
 	if (bge_chipinit(sc)) {
 		device_printf(sc->bge_dev, "chip initialization failed\n");
@@ -3998,6 +3998,20 @@ bge_reset(struct bge_softc *sc)
 	} else
 		write_op = bge_writereg_ind;
 
+	if (sc->bge_asicrev != BGE_ASICREV_BCM5700 &&
+	    sc->bge_asicrev != BGE_ASICREV_BCM5701) {
+		CSR_WRITE_4(sc, BGE_NVRAM_SWARB, BGE_NVRAMSWARB_SET1);
+		for (i = 0; i < 8000; i++) {
+			if (CSR_READ_4(sc, BGE_NVRAM_SWARB) &
+			    BGE_NVRAMSWARB_GNT1)
+				break;
+			DELAY(20);
+		}
+		if (i == 8000) {
+			if (bootverbose)
+				device_printf(dev, "NVRAM lock timedout!\n");
+		}
+	}
 	/* Take APE lock when performing reset. */
 	bge_ape_lock(sc, BGE_APE_LOCK_GRC);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303290022.r2T0Mhhf062598>