Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/cardbus This is *always* compiled with #define rbus ...



details:   https://anonhg.NetBSD.org/src/rev/a51a236d011f
branches:  trunk
changeset: 753154:a51a236d011f
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Thu Mar 18 20:54:56 2010 +0000

description:
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.

diffstat:

 sys/dev/cardbus/adv_cardbus.c     |  19 ++++++++-----------
 sys/dev/cardbus/ahc_cardbus.c     |  19 ++++++++-----------
 sys/dev/cardbus/com_cardbus.c     |  14 +++++---------
 sys/dev/cardbus/siisata_cardbus.c |   8 ++------
 sys/dev/cardbus/uhci_cardbus.c    |  15 +++++----------
 5 files changed, 28 insertions(+), 47 deletions(-)

diffs (295 lines):

diff -r 6e3c88b41a3d -r a51a236d011f sys/dev/cardbus/adv_cardbus.c
--- a/sys/dev/cardbus/adv_cardbus.c     Thu Mar 18 20:52:43 2010 +0000
+++ b/sys/dev/cardbus/adv_cardbus.c     Thu Mar 18 20:54:56 2010 +0000
@@ -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 @@
        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 @@
        }
 
        /* 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 @@
        /*
         * 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 @@
                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;
        }
 
diff -r 6e3c88b41a3d -r a51a236d011f sys/dev/cardbus/ahc_cardbus.c
--- a/sys/dev/cardbus/ahc_cardbus.c     Thu Mar 18 20:52:43 2010 +0000
+++ b/sys/dev/cardbus/ahc_cardbus.c     Thu Mar 18 20:54:56 2010 +0000
@@ -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 @@
        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 @@
        }
 
        /* 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 @@
        /*
         * 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 @@
                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;
        }
 
diff -r 6e3c88b41a3d -r a51a236d011f sys/dev/cardbus/com_cardbus.c
--- a/sys/dev/cardbus/com_cardbus.c     Thu Mar 18 20:52:43 2010 +0000
+++ b/sys/dev/cardbus/com_cardbus.c     Thu Mar 18 20:54:56 2010 +0000
@@ -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 @@
 {
        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 @@
 {
        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 @@
                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);
diff -r 6e3c88b41a3d -r a51a236d011f sys/dev/cardbus/siisata_cardbus.c
--- a/sys/dev/cardbus/siisata_cardbus.c Thu Mar 18 20:52:43 2010 +0000
+++ b/sys/dev/cardbus/siisata_cardbus.c Thu Mar 18 20:54:56 2010 +0000
@@ -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 @@
        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 @@
 
        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");
diff -r 6e3c88b41a3d -r a51a236d011f sys/dev/cardbus/uhci_cardbus.c
--- a/sys/dev/cardbus/uhci_cardbus.c    Thu Mar 18 20:52:43 2010 +0000
+++ b/sys/dev/cardbus/uhci_cardbus.c    Thu Mar 18 20:54:56 2010 +0000
@@ -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 @@
        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 @@
        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 @@
                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 @@
        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) {



Home | Main Index | Thread Index | Old Index