Make PCI power re-activation DTRT: pass pci_activate_null instead
of NULL to pci_activate() Call the variable where we store the PCI Command & Status Register 'csr' instead of 'pmreg'. In sipcom_intr(), get out if the device is inactive. Otherwise sip(4) may inadvertently try to handle a shared interrupt before the driver state is completely set up.
This commit is contained in:
parent
f05735da97
commit
5e40785deb
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_sip.c,v 1.133 2008/04/28 20:23:55 martin Exp $ */
|
||||
/* $NetBSD: if_sip.c,v 1.134 2008/05/05 20:19:09 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
|
||||
@ -73,7 +73,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.133 2008/04/28 20:23:55 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.134 2008/05/05 20:19:09 dyoung Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
#include "rnd.h"
|
||||
@ -991,7 +991,7 @@ sipcom_attach(device_t parent, device_t self, void *aux)
|
||||
int i, rseg, error;
|
||||
const struct sip_product *sip;
|
||||
u_int8_t enaddr[ETHER_ADDR_LEN];
|
||||
pcireg_t pmreg;
|
||||
pcireg_t csr;
|
||||
pcireg_t memtype;
|
||||
bus_size_t tx_dmamap_size;
|
||||
int ntxsegs_alloc;
|
||||
@ -1081,17 +1081,16 @@ sipcom_attach(device_t parent, device_t self, void *aux)
|
||||
* Make sure bus mastering is enabled. Also make sure
|
||||
* Write/Invalidate is enabled if we're allowed to use it.
|
||||
*/
|
||||
pmreg = pci_conf_read(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
|
||||
csr = pci_conf_read(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
|
||||
if (pa->pa_flags & PCI_FLAGS_MWI_OKAY)
|
||||
pmreg |= PCI_COMMAND_INVALIDATE_ENABLE;
|
||||
csr |= PCI_COMMAND_INVALIDATE_ENABLE;
|
||||
pci_conf_write(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG,
|
||||
pmreg | PCI_COMMAND_MASTER_ENABLE);
|
||||
csr | PCI_COMMAND_MASTER_ENABLE);
|
||||
|
||||
/* power up chip */
|
||||
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self, NULL)) &&
|
||||
error != EOPNOTSUPP) {
|
||||
aprint_error_dev(&sc->sc_dev, "cannot activate %d\n",
|
||||
error);
|
||||
error = pci_activate(pa->pa_pc, pa->pa_tag, self, pci_activate_null);
|
||||
if (error != 0 && error != EOPNOTSUPP) {
|
||||
aprint_error_dev(&sc->sc_dev, "cannot activate %d\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1832,6 +1831,9 @@ sipcom_intr(void *arg)
|
||||
u_int32_t isr;
|
||||
int handled = 0;
|
||||
|
||||
if (!device_is_active(&sc->sc_dev))
|
||||
return 0;
|
||||
|
||||
/* Disable interrupts. */
|
||||
bus_space_write_4(sc->sc_st, sc->sc_sh, SIP_IER, 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user