summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2001-06-23 01:54:48 +0000
committermillert <millert@openbsd.org>2001-06-23 01:54:48 +0000
commit753f6cda5fa215cc99b8ab100644ff2e67d4e084 (patch)
tree23b3805f20ef07665fd9b42556a672f7be052785
parentChanges from Toby. Make error tests explicit (against -1), remove one big (diff)
downloadwireguard-openbsd-753f6cda5fa215cc99b8ab100644ff2e67d4e084.tar.xz
wireguard-openbsd-753f6cda5fa215cc99b8ab100644ff2e67d4e084.zip
Disable interupts on the card before mapping and establishing the
interupt. Fixes as race as noted by mickey@
-rw-r--r--sys/dev/pci/if_wi_pci.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/dev/pci/if_wi_pci.c b/sys/dev/pci/if_wi_pci.c
index 92ecbd9623e..12a9f23c260 100644
--- a/sys/dev/pci/if_wi_pci.c
+++ b/sys/dev/pci/if_wi_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wi_pci.c,v 1.4 2001/06/12 15:40:31 niklas Exp $ */
+/* $OpenBSD: if_wi_pci.c,v 1.5 2001/06/23 01:54:48 millert Exp $ */
/*
* Copyright (c) 2001 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -95,6 +95,8 @@
#include <netinet/if_ether.h>
#endif
+#include <net/if_ieee80211.h>
+
#include <machine/bus.h>
#include <dev/pci/pcireg.h>
@@ -182,6 +184,10 @@ wi_pci_attach(parent, self, aux)
pci_conf_write(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG,
csr | PCI_COMMAND_MASTER_ENABLE);
+ /* Make sure interrupts are disabled. */
+ CSR_WRITE_2(sc, WI_INT_EN, 0);
+ CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF);
+
/* Map and establish the interrupt. */
if (pci_intr_map(pc, pa->pa_intrtag, pa->pa_intrpin,
pa->pa_intrline, &ih)) {
@@ -200,10 +206,6 @@ wi_pci_attach(parent, self, aux)
}
printf(": %s", intrstr);
- /* Make sure interrupts are disabled. */
- CSR_WRITE_2(sc, WI_INT_EN, 0);
- CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF);
-
/*
* Setup the PLX chip for level interrupts and config index 1
* XXX - should really reset the PLX chip too.