summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2000-12-18 23:49:56 +0000
committerjhb <jhb@FreeBSD.org>2000-12-18 23:49:56 +0000
commit4423d75eace68c7348f9a8630453cd39703a962c (patch)
tree3f6d3d8aeb5f334e73bd6bebe2bc87460101d57d /sys
parent4ad554b9bb57a25f053c6f0636a0c79f7e05b0f8 (diff)
downloadFreeBSD-src-4423d75eace68c7348f9a8630453cd39703a962c.zip
FreeBSD-src-4423d75eace68c7348f9a8630453cd39703a962c.tar.gz
Attempt to read and verify the card's status in wi_stop() before sending it
the disable command. On some systems, writing to the card after it has been ejected causes the machine to hang. Reviewed by: wpaul
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/wi/if_wi.c11
-rw-r--r--sys/i386/isa/if_wi.c11
2 files changed, 18 insertions, 4 deletions
diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c
index 0c99883..3b07877 100644
--- a/sys/dev/wi/if_wi.c
+++ b/sys/dev/wi/if_wi.c
@@ -1471,8 +1471,15 @@ static void wi_stop(sc)
ifp = &sc->arpcom.ac_if;
- CSR_WRITE_2(sc, WI_INT_EN, 0);
- wi_cmd(sc, WI_CMD_DISABLE|sc->wi_portnum, 0);
+ /*
+ * If the card is gone and the memory port isn't mapped, we will
+ * (hopefully) get 0xffff back from the status read, which is not
+ * a valid status value.
+ */
+ if (CSR_READ_2(sc, WI_STATUS) != 0xffff) {
+ CSR_WRITE_2(sc, WI_INT_EN, 0);
+ wi_cmd(sc, WI_CMD_DISABLE|sc->wi_portnum, 0);
+ }
untimeout(wi_inquire, sc, sc->wi_stat_ch);
diff --git a/sys/i386/isa/if_wi.c b/sys/i386/isa/if_wi.c
index 0c99883..3b07877 100644
--- a/sys/i386/isa/if_wi.c
+++ b/sys/i386/isa/if_wi.c
@@ -1471,8 +1471,15 @@ static void wi_stop(sc)
ifp = &sc->arpcom.ac_if;
- CSR_WRITE_2(sc, WI_INT_EN, 0);
- wi_cmd(sc, WI_CMD_DISABLE|sc->wi_portnum, 0);
+ /*
+ * If the card is gone and the memory port isn't mapped, we will
+ * (hopefully) get 0xffff back from the status read, which is not
+ * a valid status value.
+ */
+ if (CSR_READ_2(sc, WI_STATUS) != 0xffff) {
+ CSR_WRITE_2(sc, WI_INT_EN, 0);
+ wi_cmd(sc, WI_CMD_DISABLE|sc->wi_portnum, 0);
+ }
untimeout(wi_inquire, sc, sc->wi_stat_ch);
OpenPOWER on IntegriCloud