Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Make fxp at cardbus detach during shutdown.
details: https://anonhg.NetBSD.org/src/rev/7923a46d7bdf
branches: trunk
changeset: 752440:7923a46d7bdf
user: dyoung <dyoung%NetBSD.org@localhost>
date: Thu Feb 25 23:40:39 2010 +0000
description:
Make fxp at cardbus detach during shutdown.
Stop calling (*cardbus_ctrl) to enable bus mastering, I/O and memory
spaces on the CardBus bridge. cbb(4) always enables that stuff,
anyway. In the process, avoid remembering what BAR we mapped by
writing CARDBUS_{IO,MEM}_ENABLE to sc_cben or sc_cbenable, and
record the BAR in use sc_bar, instead.
Replace more CARDBUS_ constants with PCI_ constants.
Compile-tested, only.
diffstat:
sys/dev/cardbus/adv_cardbus.c | 33 +++++++-----------------
sys/dev/cardbus/ahc_cardbus.c | 27 +++++++------------
sys/dev/cardbus/com_cardbus.c | 11 +------
sys/dev/cardbus/ehci_cardbus.c | 6 +--
sys/dev/cardbus/fwohci_cardbus.c | 6 +--
sys/dev/cardbus/if_ath_cardbus.c | 12 +++-----
sys/dev/cardbus/if_atw_cardbus.c | 41 +++++++++++------------------
sys/dev/cardbus/if_ex_cardbus.c | 7 +---
sys/dev/cardbus/if_fxp_cardbus.c | 54 ++++++++++++++++-----------------------
sys/dev/cardbus/if_ral_cardbus.c | 8 +----
sys/dev/cardbus/if_re_cardbus.c | 11 +------
sys/dev/cardbus/if_rtk_cardbus.c | 11 +------
sys/dev/cardbus/if_tlp_cardbus.c | 11 +------
sys/dev/cardbus/njata_cardbus.c | 9 +-----
sys/dev/cardbus/njs_cardbus.c | 9 +-----
sys/dev/cardbus/ohci_cardbus.c | 6 +--
sys/dev/cardbus/rbus_ppb.c | 8 +----
sys/dev/cardbus/uhci_cardbus.c | 6 +--
sys/dev/ic/i82557.c | 6 ++--
sys/dev/ic/i82557var.h | 5 ++-
20 files changed, 95 insertions(+), 192 deletions(-)
diffs (truncated from 996 to 300 lines):
diff -r aa6056a7608c -r 7923a46d7bdf sys/dev/cardbus/adv_cardbus.c
--- a/sys/dev/cardbus/adv_cardbus.c Thu Feb 25 23:37:39 2010 +0000
+++ b/sys/dev/cardbus/adv_cardbus.c Thu Feb 25 23:40:39 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: adv_cardbus.c,v 1.23 2010/02/24 19:52:51 dyoung Exp $ */
+/* $NetBSD: adv_cardbus.c,v 1.24 2010/02/25 23:40:39 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.23 2010/02/24 19:52:51 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adv_cardbus.c,v 1.24 2010/02/25 23:40:39 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -76,7 +76,7 @@
cardbus_devfunc_t sc_ct; /* our CardBus devfuncs */
pcitag_t sc_tag;
- int sc_cbenable; /* what CardBus access type to enable */
+ int sc_bar;
int sc_csr; /* CSR bits */
bus_size_t sc_size;
};
@@ -150,7 +150,6 @@
csc->sc_ct = ct;
csc->sc_tag = ca->ca_tag;
- csc->sc_cbenable = 0;
/*
* Map the device.
@@ -164,7 +163,7 @@
#ifdef ADV_CARDBUS_DEBUG
printf("%s: memio enabled\n", DEVNAME(sc));
#endif
- csc->sc_cbenable = CARDBUS_MEM_ENABLE;
+ csc->sc_bar = ADV_CARDBUS_MMBA;
csc->sc_csr |= PCI_COMMAND_MEM_ENABLE;
} else
#endif
@@ -173,17 +172,14 @@
#ifdef ADV_CARDBUS_DEBUG
printf("%s: io enabled\n", DEVNAME(sc));
#endif
- csc->sc_cbenable = CARDBUS_IO_ENABLE;
+ csc->sc_bar = ADV_CARDBUS_IOBA;
csc->sc_csr |= PCI_COMMAND_IO_ENABLE;
} else {
+ csc->sc_bar = 0;
aprint_error_dev(&sc->sc_dev, "unable to map device registers\n");
return;
}
- /* Make sure the right access type is on the CardBus bridge. */
- (*ct->ct_cf->cardbus_ctrl)(cc, csc->sc_cbenable);
- (*ct->ct_cf->cardbus_ctrl)(cc, CARDBUS_BM_ENABLE);
-
/* Enable the appropriate bits in the PCI CSR. */
reg = cardbus_conf_read(cc, cf, ca->ca_tag, PCI_COMMAND_STATUS_REG);
reg &= ~(PCI_COMMAND_IO_ENABLE|PCI_COMMAND_MEM_ENABLE);
@@ -254,19 +250,10 @@
sc->sc_ih = 0;
}
- if (csc->sc_cbenable) {
-#ifdef ADV_CARDBUS_ALLOW_MEMIO
- if (csc->sc_cbenable == CARDBUS_MEM_ENABLE) {
- Cardbus_mapreg_unmap(csc->sc_ct, ADV_CARDBUS_MMBA,
- sc->sc_iot, sc->sc_ioh, csc->sc_size);
- } else {
-#endif
- Cardbus_mapreg_unmap(csc->sc_ct, ADV_CARDBUS_IOBA,
- sc->sc_iot, sc->sc_ioh, csc->sc_size);
-#ifdef ADV_CARDBUS_ALLOW_MEMIO
- }
-#endif
- csc->sc_cbenable = 0;
+ if (csc->sc_bar != 0) {
+ Cardbus_mapreg_unmap(csc->sc_ct, csc->sc_bar,
+ sc->sc_iot, sc->sc_ioh, csc->sc_size);
+ csc->sc_bar = 0;
}
return 0;
diff -r aa6056a7608c -r 7923a46d7bdf sys/dev/cardbus/ahc_cardbus.c
--- a/sys/dev/cardbus/ahc_cardbus.c Thu Feb 25 23:37:39 2010 +0000
+++ b/sys/dev/cardbus/ahc_cardbus.c Thu Feb 25 23:40:39 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ahc_cardbus.c,v 1.30 2010/02/24 19:52:51 dyoung Exp $ */
+/* $NetBSD: ahc_cardbus.c,v 1.31 2010/02/25 23:40:39 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.30 2010/02/24 19:52:51 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahc_cardbus.c,v 1.31 2010/02/25 23:40:39 dyoung Exp $");
#include "opt_ahc_cardbus.h"
@@ -79,7 +79,7 @@
cardbus_devfunc_t sc_ct; /* our CardBus devfuncs */
pcitag_t sc_tag;
- int sc_cbenable; /* what CardBus access type to enable */
+ int sc_bar;
int sc_csr; /* CSR bits */
bus_size_t sc_size;
};
@@ -132,22 +132,19 @@
if (Cardbus_mapreg_map(csc->sc_ct, AHC_CARDBUS_MMBA,
PCI_MAPREG_TYPE_MEM|PCI_MAPREG_MEM_TYPE_32BIT, 0,
&bst, &bsh, NULL, &csc->sc_size) == 0) {
- csc->sc_cbenable = CARDBUS_MEM_ENABLE;
+ csc->sc_bar = AHC_CARDBUS_MMBA;
csc->sc_csr |= PCI_COMMAND_MEM_ENABLE;
} else if (Cardbus_mapreg_map(csc->sc_ct, AHC_CARDBUS_IOBA,
PCI_MAPREG_TYPE_IO, 0, &bst, &bsh, NULL, &csc->sc_size) == 0) {
- csc->sc_cbenable = CARDBUS_IO_ENABLE;
+ csc->sc_bar = AHC_CARDBUS_IOBA;
csc->sc_csr |= PCI_COMMAND_IO_ENABLE;
} else {
+ csc->sc_bar = 0;
printf("%s: unable to map device registers\n",
ahc_name(ahc));
return;
}
- /* Make sure the right access type is on the CardBus bridge. */
- (*ct->ct_cf->cardbus_ctrl)(cc, csc->sc_cbenable);
- (*ct->ct_cf->cardbus_ctrl)(cc, CARDBUS_BM_ENABLE);
-
/* Enable the appropriate bits in the PCI CSR. */
reg = cardbus_conf_read(cc, cf, ca->ca_tag, PCI_COMMAND_STATUS_REG);
reg &= ~(PCI_COMMAND_IO_ENABLE|PCI_COMMAND_MEM_ENABLE);
@@ -270,14 +267,10 @@
ahc->ih = 0;
}
- if (csc->sc_cbenable) {
- if (csc->sc_cbenable == CARDBUS_MEM_ENABLE)
- Cardbus_mapreg_unmap(csc->sc_ct, AHC_CARDBUS_MMBA,
- ahc->tag, ahc->bsh, csc->sc_size);
- else if (csc->sc_cbenable == CARDBUS_IO_ENABLE)
- Cardbus_mapreg_unmap(csc->sc_ct, AHC_CARDBUS_IOBA,
- ahc->tag, ahc->bsh, csc->sc_size);
- csc->sc_cbenable = 0;
+ if (csc->sc_bar != 0) {
+ Cardbus_mapreg_unmap(csc->sc_ct, csc->sc_bar,
+ ahc->tag, ahc->bsh, csc->sc_size);
+ csc->sc_bar = 0;
}
return (0);
diff -r aa6056a7608c -r 7923a46d7bdf sys/dev/cardbus/com_cardbus.c
--- a/sys/dev/cardbus/com_cardbus.c Thu Feb 25 23:37:39 2010 +0000
+++ b/sys/dev/cardbus/com_cardbus.c Thu Feb 25 23:40:39 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: com_cardbus.c,v 1.26 2010/02/25 22:31:51 dyoung Exp $ */
+/* $NetBSD: com_cardbus.c,v 1.27 2010/02/25 23:40:39 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.26 2010/02/25 22:31:51 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com_cardbus.c,v 1.27 2010/02/25 23:40:39 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -64,7 +64,6 @@
pcireg_t cc_base;
bus_size_t cc_size;
pcireg_t cc_csr;
- int cc_cben;
pcitag_t cc_tag;
pcireg_t cc_reg;
int cc_type;
@@ -238,10 +237,8 @@
if(csc->cc_type == CARDBUS_MAPREG_TYPE_IO) {
csc->cc_base |= CARDBUS_MAPREG_TYPE_IO;
csc->cc_csr |= CARDBUS_COMMAND_IO_ENABLE;
- csc->cc_cben = CARDBUS_IO_ENABLE;
} else {
csc->cc_csr |= CARDBUS_COMMAND_MEM_ENABLE;
- csc->cc_cben = CARDBUS_MEM_ENABLE;
}
sc->sc_frequency = COM_FREQ;
@@ -273,10 +270,6 @@
Cardbus_conf_write(ct, csc->cc_tag, csc->cc_reg, csc->cc_base);
- /* enable accesses on cardbus bridge */
- (*cf->cardbus_ctrl)(cc, csc->cc_cben);
- (*cf->cardbus_ctrl)(cc, CARDBUS_BM_ENABLE);
-
/* and the card itself */
reg = Cardbus_conf_read(ct, csc->cc_tag, CARDBUS_COMMAND_STATUS_REG);
reg &= ~(CARDBUS_COMMAND_IO_ENABLE | CARDBUS_COMMAND_MEM_ENABLE);
diff -r aa6056a7608c -r 7923a46d7bdf sys/dev/cardbus/ehci_cardbus.c
--- a/sys/dev/cardbus/ehci_cardbus.c Thu Feb 25 23:37:39 2010 +0000
+++ b/sys/dev/cardbus/ehci_cardbus.c Thu Feb 25 23:40:39 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ehci_cardbus.c,v 1.25 2010/02/24 19:52:51 dyoung Exp $ */
+/* $NetBSD: ehci_cardbus.c,v 1.26 2010/02/25 23:40:39 dyoung Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci_cardbus.c,v 1.25 2010/02/24 19:52:51 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci_cardbus.c,v 1.26 2010/02/25 23:40:39 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -162,8 +162,6 @@
#else
XXX (ct->ct_cf->cardbus_mem_open)(cc, 0, iob, iob + 0x40);
#endif
- (ct->ct_cf->cardbus_ctrl)(cc, CARDBUS_MEM_ENABLE);
- (ct->ct_cf->cardbus_ctrl)(cc, CARDBUS_BM_ENABLE);
/* Enable the device. */
csr = cardbus_conf_read(cc, cf, ca->ca_tag,
diff -r aa6056a7608c -r 7923a46d7bdf sys/dev/cardbus/fwohci_cardbus.c
--- a/sys/dev/cardbus/fwohci_cardbus.c Thu Feb 25 23:37:39 2010 +0000
+++ b/sys/dev/cardbus/fwohci_cardbus.c Thu Feb 25 23:40:39 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fwohci_cardbus.c,v 1.28 2010/02/24 19:52:51 dyoung Exp $ */
+/* $NetBSD: fwohci_cardbus.c,v 1.29 2010/02/25 23:40:39 dyoung Exp $ */
/*-
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fwohci_cardbus.c,v 1.28 2010/02/24 19:52:51 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fwohci_cardbus.c,v 1.29 2010/02/25 23:40:39 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -123,8 +123,6 @@
#else
XXX (ct->ct_cf->cardbus_mem_open)(cc, 0, iob, iob + 0x40);
#endif
- (ct->ct_cf->cardbus_ctrl)(cc, CARDBUS_MEM_ENABLE);
- (ct->ct_cf->cardbus_ctrl)(cc, CARDBUS_BM_ENABLE);
/* Disable interrupts, so we don't get any spurious ones. */
OHCI_CSR_WRITE(&sc->sc_sc, FWOHCI_INTMASKCLR, OHCI_INT_EN);
diff -r aa6056a7608c -r 7923a46d7bdf sys/dev/cardbus/if_ath_cardbus.c
--- a/sys/dev/cardbus/if_ath_cardbus.c Thu Feb 25 23:37:39 2010 +0000
+++ b/sys/dev/cardbus/if_ath_cardbus.c Thu Feb 25 23:40:39 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ath_cardbus.c,v 1.39 2010/02/24 19:52:51 dyoung Exp $ */
+/* $NetBSD: if_ath_cardbus.c,v 1.40 2010/02/25 23:40:39 dyoung Exp $ */
/*
* Copyright (c) 2003
* Ichiro FUKUHARA <ichiro%ichiro.org@localhost>.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ath_cardbus.c,v 1.39 2010/02/24 19:52:51 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ath_cardbus.c,v 1.40 2010/02/25 23:40:39 dyoung Exp $");
#include "opt_inet.h"
@@ -254,8 +254,6 @@
ath_cardbus_setup(struct ath_cardbus_softc *csc)
{
cardbus_devfunc_t ct = csc->sc_ct;
- cardbus_chipset_tag_t cc = ct->ct_cc;
- cardbus_function_tag_t cf = ct->ct_cf;
int rc;
pcireg_t reg;
@@ -263,11 +261,11 @@
aprint_debug("%s: cardbus_set_powerstate %d\n", __func__, rc);
/* Program the BAR. */
- cardbus_conf_write(cc, cf, csc->sc_tag, ATH_PCI_MMBA, csc->sc_bar_val);
+ Cardbus_conf_write(ct, csc->sc_tag, ATH_PCI_MMBA, csc->sc_bar_val);
/* Enable the appropriate bits in the PCI CSR. */
- reg = cardbus_conf_read(cc, cf, csc->sc_tag,
+ reg = Cardbus_conf_read(ct, csc->sc_tag,
PCI_COMMAND_STATUS_REG);
Home |
Main Index |
Thread Index |
Old Index