From e87137e1337501e1858be85f3c4b9bdb8cdd9fa4 Mon Sep 17 00:00:00 2001 From: Marius Strobl Date: Sat, 16 Jun 2007 23:27:59 +0000 Subject: [PATCH] - 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) --- sys/dev/gem/if_gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/gem/if_gem.c b/sys/dev/gem/if_gem.c index 749762ff475..60b7a172015 100644 --- a/sys/dev/gem/if_gem.c +++ b/sys/dev/gem/if_gem.c @@ -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); }