Date: Sun, 27 May 2007 17:30:11 GMT From: Matt Jacob <mjacob@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 120459 for review Message-ID: <200705271730.l4RHUBWu031848@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=120459 Change 120459 by mjacob@mjexp on 2007/05/27 17:29:58 Fix some DELAY stuff. Affected files ... .. //depot/projects/mjexp/sys/dev/bge/if_bge.c#14 edit Differences ... ==== //depot/projects/mjexp/sys/dev/bge/if_bge.c#14 (text+ko) ==== @@ -591,7 +591,7 @@ break; } - if (i == BGE_TIMEOUT) { + if (i == BGE_TIMEOUT * 10) { device_printf(sc->bge_dev, "EEPROM read timed out\n"); return (1); } @@ -655,6 +655,7 @@ BGE_MIPHY(phy) | BGE_MIREG(reg)); for (i = 0; i < BGE_TIMEOUT; i++) { + DELAY(10); val = CSR_READ_4(sc, BGE_MI_COMM); if (!(val & BGE_MICOMM_BUSY)) break; @@ -700,19 +701,21 @@ BGE_MIPHY(phy) | BGE_MIREG(reg) | val); for (i = 0; i < BGE_TIMEOUT; i++) { + DELAY(10); if (!(CSR_READ_4(sc, BGE_MI_COMM) & BGE_MICOMM_BUSY)) break; } + if (i == BGE_TIMEOUT) { + device_printf(sc->bge_dev, "PHY read timed out\n"); + return (0); + } + if (autopoll & BGE_MIMODE_AUTOPOLL) { BGE_SETBIT(sc, BGE_MI_MODE, BGE_MIMODE_AUTOPOLL); DELAY(40); } - if (i == BGE_TIMEOUT) { - device_printf(sc->bge_dev, "PHY read timed out\n"); - return (0); - } return (0); } @@ -1324,9 +1327,9 @@ /* Poll for buffer manager start indication */ for (i = 0; i < BGE_TIMEOUT; i++) { + DELAY(10); if (CSR_READ_4(sc, BGE_BMAN_MODE) & BGE_BMANMODE_ENABLE) break; - DELAY(10); } if (i == BGE_TIMEOUT) { @@ -1342,9 +1345,9 @@ /* Wait until queue initialization is complete */ for (i = 0; i < BGE_TIMEOUT; i++) { + DELAY(10); if (CSR_READ_4(sc, BGE_FTQ_RESET) == 0) break; - DELAY(10); } if (i == BGE_TIMEOUT) { @@ -1513,9 +1516,9 @@ /* Poll to make sure it's shut down. */ for (i = 0; i < BGE_TIMEOUT; i++) { + DELAY(10); if (!(CSR_READ_4(sc, BGE_HCC_MODE) & BGE_HCCMODE_ENABLE)) break; - DELAY(10); } if (i == BGE_TIMEOUT) { @@ -2794,10 +2797,10 @@ * We expect this to fail if no EEPROM is fitted though. */ for (i = 0; i < BGE_TIMEOUT; i++) { + DELAY(10); val = bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM); if (val == ~BGE_MAGIC_NUMBER) break; - DELAY(10); } if ((sc->bge_flags & BGE_FLAG_EEPROM) && i == BGE_TIMEOUT) @@ -2813,9 +2816,13 @@ * results. */ for (i = 0; i < BGE_TIMEOUT; i++) { + DELAY(10); if (pci_read_config(dev, BGE_PCI_PCISTATE, 4) == pcistate) break; - DELAY(10); + } + + if (i == BGE_TIMEOUT) { + device_printf(sc->bge_dev, "pci state didn't transition\n"); } if (sc->bge_flags & BGE_FLAG_PCIE) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705271730.l4RHUBWu031848>