bge(4) testsers needed

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

bge(4) testsers needed

Mark Kettenis
Below is a patch to make onboard bge(4)'s in Sun UltraSPARC III
machines work.  This is likely to make 4.0, but there is a small
chance that this breaks bge(4)'s in other machines, especially Sun
amd64 machines with onboard bge(4)'s.  Please test this if you have a
bge(4) (on any hardware).

I'd appreciate it if people would drop me a note if they tested on Sun
hardware with onboard bge(4)'s.

Mark


Index: if_bgereg.h
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_bgereg.h,v
retrieving revision 1.56
diff -u -p -r1.56 if_bgereg.h
--- if_bgereg.h 28 Aug 2006 03:06:47 -0000 1.56
+++ if_bgereg.h 28 Aug 2006 19:02:18 -0000
@@ -2348,6 +2348,7 @@ struct bge_softc {
  struct mii_data bge_mii;
  struct ifmedia bge_ifmedia; /* media info */
  u_int8_t bge_extram; /* has external SSRAM */
+ u_int8_t bge_eeprom;
  u_int8_t bge_tbi;
  u_int8_t bge_rx_alignment_bug;
  bus_dma_tag_t bge_dmatag;
Index: if_bge.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_bge.c,v
retrieving revision 1.173
diff -u -p -r1.173 if_bge.c
--- if_bge.c 28 Aug 2006 07:58:51 -0000 1.173
+++ if_bge.c 28 Aug 2006 19:02:19 -0000
@@ -1084,9 +1084,11 @@ bge_chipinit(struct bge_softc *sc)
 
  /*
  * Check the 'ROM failed' bit on the RX CPU to see if
- * self-tests passed.
+ * self-tests passed.  Skip this check when there's no SEEPROM
+ * fitted, since in that case it will always fail.
  */
- if (CSR_READ_4(sc, BGE_RXCPU_MODE) & BGE_RXCPUMODE_ROMFAIL) {
+ if (sc->bge_eeprom &&
+    CSR_READ_4(sc, BGE_RXCPU_MODE) & BGE_RXCPUMODE_ROMFAIL) {
  printf("%s: RX CPU self-diagnostics failed!\n",
     sc->bge_dev.dv_xname);
  return (ENODEV);
@@ -1757,6 +1759,14 @@ bge_attach(struct device *parent, struct
     BGE_PCISTATE_PCI_BUSMODE) == 0)
  sc->bge_pcix = 1;
 
+ /*
+ * SEEPROM check.
+ */
+ sc->bge_eeprom = 1;
+ if ((pci_conf_read(pa->pa_pc, pa->pa_tag, BGE_PCI_SUBSYS) & 0xffff) ==
+    PCI_VENDOR_SUN)
+ sc->bge_eeprom = 0;
+
  /* Try to reset the chip. */
  DPRINTFN(5, ("bge_reset\n"));
  bge_reset(sc);
@@ -1899,7 +1909,7 @@ bge_attach(struct device *parent, struct
  */
  if (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_SIG) == BGE_MAGIC_NUMBER)
  hwcfg = bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_NICCFG);
- else {
+ else if (sc->bge_eeprom) {
  if (bge_read_eeprom(sc, (caddr_t)&hwcfg, BGE_EE_HWCFG_OFFSET,
     sizeof(hwcfg))) {
  printf(": failed to read media type\n");
@@ -2059,7 +2069,8 @@ bge_reset(struct bge_softc *sc)
  * Poll the value location we just wrote until
  * we see the 1's complement of the magic number.
  * This indicates that the firmware initialization
- * is complete.
+ * is complete.  We expect this to fail if no SEEPROM
+ * is fitted.
  */
  for (i = 0; i < BGE_TIMEOUT; i++) {
  val = bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM);
@@ -2068,7 +2079,7 @@ bge_reset(struct bge_softc *sc)
  DELAY(10);
  }
 
- if (i >= BGE_TIMEOUT)
+ if (sc->bge_eeprom && i >= BGE_TIMEOUT)
  printf("%s: firmware handshake timed out\n",
     sc->bge_dev.dv_xname);