This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation. Simplify interrupt (dis)establishment by two source transformations: - cardbus_intr_disestablish(cc, cf, ih); + Cardbus_intr_disestablish(ct, ih); - ih = cardbus_intr_establish(cc, cf, ...); + ih = Cardbus_intr_establish(ct, ...); The identical change to a few other CardBus NICs has not caused any problems, as expected, so I'm going to commit this rather safe change and get on with the work. Testers have been enlisted. I will revisit this change if I get any negative responses.
This commit is contained in:
parent
8b504d80a5
commit
d75450ce8b
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: adv_cardbus.c,v 1.26 2010/02/26 00:57:01 dyoung Exp $ */
|
||||
/* $NetBSD: adv_cardbus.c,v 1.27 2010/03/18 20:54:56 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||
@ -36,7 +36,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: adv_cardbus.c,v 1.26 2010/02/26 00:57:01 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: adv_cardbus.c,v 1.27 2010/03/18 20:54:56 dyoung Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -109,8 +109,6 @@ adv_cardbus_attach(device_t parent, device_t self,
|
||||
struct adv_cardbus_softc *csc = device_private(self);
|
||||
struct asc_softc *sc = &csc->sc_adv;
|
||||
cardbus_devfunc_t ct = ca->ca_ct;
|
||||
cardbus_chipset_tag_t cc = ct->ct_cc;
|
||||
cardbus_function_tag_t cf = ct->ct_cf;
|
||||
bus_space_tag_t iot;
|
||||
bus_space_handle_t ioh;
|
||||
pcireg_t reg;
|
||||
@ -181,20 +179,20 @@ adv_cardbus_attach(device_t parent, device_t self,
|
||||
}
|
||||
|
||||
/* Enable the appropriate bits in the PCI CSR. */
|
||||
reg = cardbus_conf_read(cc, cf, ca->ca_tag, PCI_COMMAND_STATUS_REG);
|
||||
reg = Cardbus_conf_read(ct, ca->ca_tag, PCI_COMMAND_STATUS_REG);
|
||||
reg &= ~(PCI_COMMAND_IO_ENABLE|PCI_COMMAND_MEM_ENABLE);
|
||||
reg |= csc->sc_csr;
|
||||
cardbus_conf_write(cc, cf, ca->ca_tag, PCI_COMMAND_STATUS_REG, reg);
|
||||
Cardbus_conf_write(ct, ca->ca_tag, PCI_COMMAND_STATUS_REG, reg);
|
||||
|
||||
/*
|
||||
* Make sure the latency timer is set to some reasonable
|
||||
* value.
|
||||
*/
|
||||
reg = cardbus_conf_read(cc, cf, ca->ca_tag, PCI_BHLC_REG);
|
||||
reg = Cardbus_conf_read(ct, ca->ca_tag, PCI_BHLC_REG);
|
||||
if (PCI_LATTIMER(reg) < latency) {
|
||||
reg &= ~(PCI_LATTIMER_MASK << PCI_LATTIMER_SHIFT);
|
||||
reg |= (latency << PCI_LATTIMER_SHIFT);
|
||||
cardbus_conf_write(cc, cf, ca->ca_tag, PCI_BHLC_REG, reg);
|
||||
Cardbus_conf_write(ct, ca->ca_tag, PCI_BHLC_REG, reg);
|
||||
}
|
||||
|
||||
ASC_SET_CHIP_CONTROL(iot, ioh, ASC_CC_HALT);
|
||||
@ -218,7 +216,7 @@ adv_cardbus_attach(device_t parent, device_t self,
|
||||
/*
|
||||
* Establish the interrupt.
|
||||
*/
|
||||
sc->sc_ih = cardbus_intr_establish(cc, cf, ca->ca_intrline, IPL_BIO,
|
||||
sc->sc_ih = Cardbus_intr_establish(ct, ca->ca_intrline, IPL_BIO,
|
||||
adv_intr, sc);
|
||||
if (sc->sc_ih == NULL) {
|
||||
aprint_error_dev(&sc->sc_dev,
|
||||
@ -245,8 +243,7 @@ adv_cardbus_detach(device_t self, int flags)
|
||||
return rv;
|
||||
|
||||
if (sc->sc_ih) {
|
||||
cardbus_intr_disestablish(csc->sc_ct->ct_cc,
|
||||
csc->sc_ct->ct_cf, sc->sc_ih);
|
||||
Cardbus_intr_disestablish(csc->sc_ct, sc->sc_ih);
|
||||
sc->sc_ih = 0;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ahc_cardbus.c,v 1.33 2010/02/26 00:57:01 dyoung Exp $ */
|
||||
/* $NetBSD: ahc_cardbus.c,v 1.34 2010/03/18 20:54:56 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2005 The NetBSD Foundation, Inc.
|
||||
@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ahc_cardbus.c,v 1.33 2010/02/26 00:57:01 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ahc_cardbus.c,v 1.34 2010/03/18 20:54:56 dyoung Exp $");
|
||||
|
||||
#include "opt_ahc_cardbus.h"
|
||||
|
||||
@ -110,8 +110,6 @@ ahc_cardbus_attach(device_t parent, device_t self, void *aux)
|
||||
struct ahc_cardbus_softc *csc = device_private(self);
|
||||
struct ahc_softc *ahc = &csc->sc_ahc;
|
||||
cardbus_devfunc_t ct = ca->ca_ct;
|
||||
cardbus_chipset_tag_t cc = ct->ct_cc;
|
||||
cardbus_function_tag_t cf = ct->ct_cf;
|
||||
bus_space_tag_t bst;
|
||||
bus_space_handle_t bsh;
|
||||
pcireg_t reg;
|
||||
@ -146,20 +144,20 @@ ahc_cardbus_attach(device_t parent, device_t self, void *aux)
|
||||
}
|
||||
|
||||
/* Enable the appropriate bits in the PCI CSR. */
|
||||
reg = cardbus_conf_read(cc, cf, ca->ca_tag, PCI_COMMAND_STATUS_REG);
|
||||
reg = Cardbus_conf_read(ct, ca->ca_tag, PCI_COMMAND_STATUS_REG);
|
||||
reg &= ~(PCI_COMMAND_IO_ENABLE|PCI_COMMAND_MEM_ENABLE);
|
||||
reg |= csc->sc_csr;
|
||||
cardbus_conf_write(cc, cf, ca->ca_tag, PCI_COMMAND_STATUS_REG, reg);
|
||||
Cardbus_conf_write(ct, ca->ca_tag, PCI_COMMAND_STATUS_REG, reg);
|
||||
|
||||
/*
|
||||
* Make sure the latency timer is set to some reasonable
|
||||
* value.
|
||||
*/
|
||||
reg = cardbus_conf_read(cc, cf, ca->ca_tag, PCI_BHLC_REG);
|
||||
reg = Cardbus_conf_read(ct, ca->ca_tag, PCI_BHLC_REG);
|
||||
if (PCI_LATTIMER(reg) < 0x20) {
|
||||
reg &= ~(PCI_LATTIMER_MASK << PCI_LATTIMER_SHIFT);
|
||||
reg |= (0x20 << PCI_LATTIMER_SHIFT);
|
||||
cardbus_conf_write(cc, cf, ca->ca_tag, PCI_BHLC_REG, reg);
|
||||
Cardbus_conf_write(ct, ca->ca_tag, PCI_BHLC_REG, reg);
|
||||
}
|
||||
|
||||
ahc_set_name(ahc, device_xname(ahc->sc_dev));
|
||||
@ -194,7 +192,7 @@ ahc_cardbus_attach(device_t parent, device_t self, void *aux)
|
||||
/*
|
||||
* Establish the interrupt.
|
||||
*/
|
||||
ahc->ih = cardbus_intr_establish(cc, cf, ca->ca_intrline, IPL_BIO,
|
||||
ahc->ih = Cardbus_intr_establish(ct, ca->ca_intrline, IPL_BIO,
|
||||
ahc_intr, ahc);
|
||||
if (ahc->ih == NULL) {
|
||||
printf("%s: unable to establish interrupt\n",
|
||||
@ -262,8 +260,7 @@ ahc_cardbus_detach(device_t self, int flags)
|
||||
return rv;
|
||||
|
||||
if (ahc->ih) {
|
||||
cardbus_intr_disestablish(csc->sc_ct->ct_cc,
|
||||
csc->sc_ct->ct_cf, ahc->ih);
|
||||
Cardbus_intr_disestablish(csc->sc_ct, ahc->ih);
|
||||
ahc->ih = 0;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: com_cardbus.c,v 1.28 2010/02/26 00:57:01 dyoung Exp $ */
|
||||
/* $NetBSD: com_cardbus.c,v 1.29 2010/03/18 20:54:56 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 Johan Danielsson
|
||||
@ -40,7 +40,7 @@
|
||||
updated below. */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: com_cardbus.c,v 1.28 2010/02/26 00:57:01 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: com_cardbus.c,v 1.29 2010/03/18 20:54:56 dyoung Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -291,15 +291,13 @@ com_cardbus_enable(struct com_softc *sc)
|
||||
{
|
||||
struct com_cardbus_softc *csc = (struct com_cardbus_softc*)sc;
|
||||
cardbus_devfunc_t ct = csc->cc_ct;
|
||||
cardbus_chipset_tag_t cc = ct->ct_cc;
|
||||
cardbus_function_tag_t cf = ct->ct_cf;
|
||||
|
||||
Cardbus_function_enable(ct);
|
||||
|
||||
com_cardbus_setup(csc);
|
||||
|
||||
/* establish the interrupt. */
|
||||
csc->cc_ih = cardbus_intr_establish(cc, cf, csc->cc_intrline,
|
||||
csc->cc_ih = Cardbus_intr_establish(ct, csc->cc_intrline,
|
||||
IPL_SERIAL, comintr, sc);
|
||||
if (csc->cc_ih == NULL) {
|
||||
aprint_error_dev(DEVICET(csc),
|
||||
@ -315,10 +313,8 @@ com_cardbus_disable(struct com_softc *sc)
|
||||
{
|
||||
struct com_cardbus_softc *csc = (struct com_cardbus_softc*)sc;
|
||||
cardbus_devfunc_t ct = csc->cc_ct;
|
||||
cardbus_chipset_tag_t cc = ct->ct_cc;
|
||||
cardbus_function_tag_t cf = ct->ct_cf;
|
||||
|
||||
cardbus_intr_disestablish(cc, cf, csc->cc_ih);
|
||||
Cardbus_intr_disestablish(ct, csc->cc_ih);
|
||||
csc->cc_ih = NULL;
|
||||
|
||||
Cardbus_function_disable(ct);
|
||||
@ -336,7 +332,7 @@ com_cardbus_detach(device_t self, int flags)
|
||||
return error;
|
||||
|
||||
if (csc->cc_ih != NULL)
|
||||
cardbus_intr_disestablish(ct->ct_cc, ct->ct_cf, csc->cc_ih);
|
||||
Cardbus_intr_disestablish(ct, csc->cc_ih);
|
||||
|
||||
Cardbus_mapreg_unmap(csc->cc_ct, csc->cc_reg, sc->sc_regs.cr_iot,
|
||||
sc->sc_regs.cr_ioh, csc->cc_size);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: siisata_cardbus.c,v 1.11 2010/03/04 16:40:54 dyoung Exp $ */
|
||||
/* $NetBSD: siisata_cardbus.c,v 1.12 2010/03/18 20:54:56 dyoung Exp $ */
|
||||
/* Id: siisata_pci.c,v 1.11 2008/05/21 16:20:11 jakllsch Exp */
|
||||
|
||||
/*
|
||||
@ -52,7 +52,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: siisata_cardbus.c,v 1.11 2010/03/04 16:40:54 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: siisata_cardbus.c,v 1.12 2010/03/18 20:54:56 dyoung Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/malloc.h>
|
||||
@ -74,10 +74,8 @@ struct siisata_cardbus_softc {
|
||||
pcitag_t sc_tag;
|
||||
bus_space_tag_t sc_iot; /* CardBus I/O space tag */
|
||||
bus_space_tag_t sc_memt; /* CardBus MEM space tag */
|
||||
#if rbus
|
||||
rbus_tag_t sc_rbus_iot; /* CardBus i/o rbus tag */
|
||||
rbus_tag_t sc_rbus_memt; /* CardBus mem rbus tag */
|
||||
#endif
|
||||
|
||||
bus_size_t sc_grsize;
|
||||
bus_size_t sc_prsize;
|
||||
@ -161,10 +159,8 @@ siisata_cardbus_attach(device_t parent, device_t self, void *aux)
|
||||
|
||||
csc->sc_iot = ca->ca_iot;
|
||||
csc->sc_memt = ca->ca_memt;
|
||||
#if rbus
|
||||
csc->sc_rbus_iot = ca->ca_rbus_iot;
|
||||
csc->sc_rbus_memt = ca->ca_rbus_memt;
|
||||
#endif
|
||||
|
||||
pci_devinfo(ca->ca_id, ca->ca_class, 0, devinfo, sizeof(devinfo));
|
||||
aprint_naive(": SATA-II HBA\n");
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: uhci_cardbus.c,v 1.16 2010/02/26 00:57:02 dyoung Exp $ */
|
||||
/* $NetBSD: uhci_cardbus.c,v 1.17 2010/03/18 20:54:56 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998-2005 The NetBSD Foundation, Inc.
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uhci_cardbus.c,v 1.16 2010/02/26 00:57:02 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uhci_cardbus.c,v 1.17 2010/03/18 20:54:56 dyoung Exp $");
|
||||
|
||||
#include "ehci_cardbus.h"
|
||||
|
||||
@ -122,11 +122,6 @@ uhci_cardbus_attach(device_t parent, device_t self,
|
||||
sc->sc_tag = tag;
|
||||
sc->sc.sc_bus.dmatag = ca->ca_dmat;
|
||||
|
||||
#if rbus
|
||||
#else
|
||||
XXX (ct->ct_cf->cardbus_io_open)(cc, 0, iob, iob + 0x40);
|
||||
#endif
|
||||
|
||||
/* Enable the device. */
|
||||
csr = Cardbus_conf_read(ct, tag, PCI_COMMAND_STATUS_REG);
|
||||
Cardbus_conf_write(ct, tag, PCI_COMMAND_STATUS_REG,
|
||||
@ -136,7 +131,7 @@ XXX (ct->ct_cf->cardbus_io_open)(cc, 0, iob, iob + 0x40);
|
||||
bus_space_write_2(sc->sc.iot, sc->sc.ioh, UHCI_INTR, 0);
|
||||
|
||||
/* Map and establish the interrupt. */
|
||||
sc->sc_ih = cardbus_intr_establish(cc, cf, ca->ca_intrline,
|
||||
sc->sc_ih = Cardbus_intr_establish(ct, ca->ca_intrline,
|
||||
IPL_USB, uhci_intr, sc);
|
||||
if (sc->sc_ih == NULL) {
|
||||
printf("%s: couldn't establish interrupt\n", devname);
|
||||
@ -175,7 +170,7 @@ XXX (ct->ct_cf->cardbus_io_open)(cc, 0, iob, iob + 0x40);
|
||||
printf("%s: init failed, error=%d\n", devname, r);
|
||||
|
||||
/* Avoid spurious interrupts. */
|
||||
cardbus_intr_disestablish(sc->sc_cc, sc->sc_cf, sc->sc_ih);
|
||||
Cardbus_intr_disestablish(ct, sc->sc_ih);
|
||||
sc->sc_ih = NULL;
|
||||
|
||||
return;
|
||||
@ -200,7 +195,7 @@ uhci_cardbus_detach(device_t self, int flags)
|
||||
if (rv)
|
||||
return (rv);
|
||||
if (sc->sc_ih != NULL) {
|
||||
cardbus_intr_disestablish(sc->sc_cc, sc->sc_cf, sc->sc_ih);
|
||||
Cardbus_intr_disestablish(ct, sc->sc_ih);
|
||||
sc->sc_ih = NULL;
|
||||
}
|
||||
if (sc->sc.sc_size) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user