Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/cardbus Simplify this a bit (and reduce differences ...



details:   https://anonhg.NetBSD.org/src/rev/15deb96083e2
branches:  trunk
changeset: 752726:15deb96083e2
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Fri Mar 05 00:54:01 2010 +0000

description:
Simplify this a bit (and reduce differences with if_rtw_pci.c): we
don't have to save the base address or write it to the BAR.

diffstat:

 sys/dev/cardbus/if_rtw_cardbus.c |  20 +++++++-------------
 1 files changed, 7 insertions(+), 13 deletions(-)

diffs (68 lines):

diff -r a38d7a533b45 -r 15deb96083e2 sys/dev/cardbus/if_rtw_cardbus.c
--- a/sys/dev/cardbus/if_rtw_cardbus.c  Fri Mar 05 00:36:06 2010 +0000
+++ b/sys/dev/cardbus/if_rtw_cardbus.c  Fri Mar 05 00:54:01 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_rtw_cardbus.c,v 1.39 2010/03/04 22:33:12 dyoung Exp $ */
+/* $NetBSD: if_rtw_cardbus.c,v 1.40 2010/03/05 00:54:01 dyoung Exp $ */
 
 /*-
  * Copyright (c) 2004, 2005 David Young.  All rights reserved.
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_rtw_cardbus.c,v 1.39 2010/03/04 22:33:12 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rtw_cardbus.c,v 1.40 2010/03/05 00:54:01 dyoung Exp $");
 
 #include "opt_inet.h"
 
@@ -120,8 +120,7 @@
                                                 * region
                                                 */
 
-       int                     sc_bar_reg;     /* which BAR to use */
-       pcireg_t                sc_bar_val;     /* value of the BAR */
+       int                     sc_bar; /* which BAR to use */
 
        cardbus_intr_line_t     sc_intrline;    /* interrupt line */
 };
@@ -241,16 +240,14 @@
                    ("%s: %s mapped %" PRIuMAX " bytes mem space\n",
                     device_xname(self), __func__, (uintmax_t)regs->r_sz));
                csc->sc_csr |= PCI_COMMAND_MEM_ENABLE;
-               csc->sc_bar_reg = RTW_PCI_MMBA;
-               csc->sc_bar_val = adr | PCI_MAPREG_TYPE_MEM;
+               csc->sc_bar = RTW_PCI_MMBA;
        } else if (Cardbus_mapreg_map(ct, RTW_PCI_IOBA, PCI_MAPREG_TYPE_IO,
            0, &regs->r_bt, &regs->r_bh, &adr, &regs->r_sz) == 0) {
                RTW_DPRINTF(RTW_DEBUG_ATTACH,
                    ("%s: %s mapped %" PRIuMAX " bytes I/O space\n",
                     device_xname(self), __func__, (uintmax_t)regs->r_sz));
                csc->sc_csr |= PCI_COMMAND_IO_ENABLE;
-               csc->sc_bar_reg = RTW_PCI_IOBA;
-               csc->sc_bar_val = adr | PCI_MAPREG_TYPE_IO;
+               csc->sc_bar = RTW_PCI_IOBA;
        } else {
                aprint_error_dev(self, "unable to map device registers\n");
                return;
@@ -312,8 +309,8 @@
        /*
         * Release bus space and close window.
         */
-       if (csc->sc_bar_reg != 0)
-               Cardbus_mapreg_unmap(ct, csc->sc_bar_reg,
+       if (csc->sc_bar != 0)
+               Cardbus_mapreg_unmap(ct, csc->sc_bar,
                    regs->r_bt, regs->r_bh, regs->r_sz);
 
        return 0;
@@ -386,9 +383,6 @@
                Cardbus_conf_write(ct, tag, PCI_BHLC_REG, bhlc);
        }
 
-       /* Program the BAR. */
-       Cardbus_conf_write(ct, tag, csc->sc_bar_reg, csc->sc_bar_val);
-
        /* Enable the appropriate bits in the PCI CSR. */
        csr = Cardbus_conf_read(ct, tag, PCI_COMMAND_STATUS_REG);
        csr &= ~(PCI_COMMAND_IO_ENABLE|PCI_COMMAND_MEM_ENABLE);



Home | Main Index | Thread Index | Old Index