- In gem_bitwait() check that the bit clears/was set in the content

of the register rather than in the offset describing the register.
- In gem_reset_rx() let gem_bitwait() check for the Rx reset bit
  rather than the Tx reset bit to clear.

Obtained from:	OpenBSD (same/similar bugs being fixed)
This commit is contained in:
Marius Strobl 2007-06-16 23:27:59 +00:00
parent c6d76cdb21
commit e87137e133

View File

@ -632,7 +632,7 @@ gem_bitwait(sc, r, clr, set)
for (i = TRIES; i--; DELAY(100)) {
reg = bus_read_4(sc->sc_res[0], r);
if ((r & clr) == 0 && (r & set) == set)
if ((reg & clr) == 0 && (reg & set) == set)
return (1);
}
return (0);
@ -755,7 +755,7 @@ gem_reset_rx(sc)
/* Finally, reset the ERX */
bus_write_4(sc->sc_res[0], GEM_RESET, GEM_RESET_RX);
/* Wait till it finishes */
if (!gem_bitwait(sc, GEM_RESET, GEM_RESET_TX, 0)) {
if (!gem_bitwait(sc, GEM_RESET, GEM_RESET_RX, 0)) {
device_printf(sc->sc_dev, "cannot reset receiver\n");
return (1);
}