aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/pccbb
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2006-06-03 19:16:45 +0000
committerWarner Losh <imp@FreeBSD.org>2006-06-03 19:16:45 +0000
commit7490082f087d5bd5226cb8a70da0e9a7d1f55e43 (patch)
tree5e2e28b221f948fb1877d77edfa37f86c1f9d26c /sys/dev/pccbb
parentfc7119a71ee6ce391d4bce311cfdf4d16df8acc0 (diff)
downloadsrc-7490082f087d5bd5226cb8a70da0e9a7d1f55e43.tar.gz
src-7490082f087d5bd5226cb8a70da0e9a7d1f55e43.zip
Move shutdown, and pci specific methods into pccbb_pci.c. Many more
are needed still.
Notes
Notes: svn path=/head/; revision=159197
Diffstat (limited to 'sys/dev/pccbb')
-rw-r--r--sys/dev/pccbb/pccbb.c67
-rw-r--r--sys/dev/pccbb/pccbb_pci.c67
-rw-r--r--sys/dev/pccbb/pccbbvar.h7
3 files changed, 67 insertions, 74 deletions
diff --git a/sys/dev/pccbb/pccbb.c b/sys/dev/pccbb/pccbb.c
index bc2a97931680..b1082ad23f85 100644
--- a/sys/dev/pccbb/pccbb.c
+++ b/sys/dev/pccbb/pccbb.c
@@ -347,37 +347,6 @@ cbb_detach(device_t brdev)
}
int
-cbb_shutdown(device_t brdev)
-{
- struct cbb_softc *sc = (struct cbb_softc *)device_get_softc(brdev);
-
- /*
- * Place the cards in reset, turn off the interrupts and power
- * down the socket.
- */
- PCI_MASK_CONFIG(brdev, CBBR_BRIDGECTRL, |CBBM_BRIDGECTRL_RESET, 2);
- exca_clrb(&sc->exca[0], EXCA_INTR, EXCA_INTR_RESET);
- cbb_set(sc, CBB_SOCKET_MASK, 0);
- cbb_set(sc, CBB_SOCKET_EVENT, 0xffffffff);
- cbb_power(brdev, CARD_OFF);
-
- /*
- * For paranoia, turn off all address decoding. Really not needed,
- * it seems, but it can't hurt
- */
- exca_putb(&sc->exca[0], EXCA_ADDRWIN_ENABLE, 0);
- pci_write_config(brdev, CBBR_MEMBASE0, 0, 4);
- pci_write_config(brdev, CBBR_MEMLIMIT0, 0, 4);
- pci_write_config(brdev, CBBR_MEMBASE1, 0, 4);
- pci_write_config(brdev, CBBR_MEMLIMIT1, 0, 4);
- pci_write_config(brdev, CBBR_IOBASE0, 0, 4);
- pci_write_config(brdev, CBBR_IOLIMIT0, 0, 4);
- pci_write_config(brdev, CBBR_IOBASE1, 0, 4);
- pci_write_config(brdev, CBBR_IOLIMIT1, 0, 4);
- return (0);
-}
-
-int
cbb_setup_intr(device_t dev, device_t child, struct resource *irq,
int flags, driver_intr_t *intr, void *arg, void **cookiep)
{
@@ -922,7 +891,7 @@ cbb_cardbus_reset(device_t brdev)
if (CBB_CARD_PRESENT(cbb_get(sc, CBB_SOCKET_STATE))) {
PCI_MASK_CONFIG(brdev, CBBR_BRIDGECTRL,
&~CBBM_BRIDGECTRL_RESET, 2);
- tsleep(sc, PZERO, "cbbP3", hz * delay / 1000);
+ tsleep(sc, PZERO, "cbbP4", hz * delay / 1000);
}
}
@@ -1463,40 +1432,6 @@ cbb_write_ivar(device_t brdev, device_t child, int which, uintptr_t value)
return (ENOENT);
}
-/************************************************************************/
-/* PCI compat methods */
-/************************************************************************/
-
-int
-cbb_maxslots(device_t brdev)
-{
- return (0);
-}
-
-uint32_t
-cbb_read_config(device_t brdev, int b, int s, int f, int reg, int width)
-{
- uint32_t rv;
-
- /*
- * Pass through to the next ppb up the chain (i.e. our grandparent).
- */
- rv = PCIB_READ_CONFIG(device_get_parent(device_get_parent(brdev)),
- b, s, f, reg, width);
- return (rv);
-}
-
-void
-cbb_write_config(device_t brdev, int b, int s, int f, int reg, uint32_t val,
- int width)
-{
- /*
- * Pass through to the next ppb up the chain (i.e. our grandparent).
- */
- PCIB_WRITE_CONFIG(device_get_parent(device_get_parent(brdev)),
- b, s, f, reg, val, width);
-}
-
int
cbb_suspend(device_t self)
{
diff --git a/sys/dev/pccbb/pccbb_pci.c b/sys/dev/pccbb/pccbb_pci.c
index 9bbf8b62527e..6a13bd795c7f 100644
--- a/sys/dev/pccbb/pccbb_pci.c
+++ b/sys/dev/pccbb/pccbb_pci.c
@@ -633,6 +633,37 @@ cbb_route_interrupt(device_t pcib, device_t dev, int pin)
return (rman_get_start(sc->irq_res));
}
+static int
+cbb_pci_shutdown(device_t brdev)
+{
+ struct cbb_softc *sc = (struct cbb_softc *)device_get_softc(brdev);
+
+ /*
+ * Place the cards in reset, turn off the interrupts and power
+ * down the socket.
+ */
+ PCI_MASK_CONFIG(brdev, CBBR_BRIDGECTRL, |CBBM_BRIDGECTRL_RESET, 2);
+ exca_clrb(&sc->exca[0], EXCA_INTR, EXCA_INTR_RESET);
+ cbb_set(sc, CBB_SOCKET_MASK, 0);
+ cbb_set(sc, CBB_SOCKET_EVENT, 0xffffffff);
+ cbb_power(brdev, CARD_OFF);
+
+ /*
+ * For paranoia, turn off all address decoding. Really not needed,
+ * it seems, but it can't hurt
+ */
+ exca_putb(&sc->exca[0], EXCA_ADDRWIN_ENABLE, 0);
+ pci_write_config(brdev, CBBR_MEMBASE0, 0, 4);
+ pci_write_config(brdev, CBBR_MEMLIMIT0, 0, 4);
+ pci_write_config(brdev, CBBR_MEMBASE1, 0, 4);
+ pci_write_config(brdev, CBBR_MEMLIMIT1, 0, 4);
+ pci_write_config(brdev, CBBR_IOBASE0, 0, 4);
+ pci_write_config(brdev, CBBR_IOLIMIT0, 0, 4);
+ pci_write_config(brdev, CBBR_IOBASE1, 0, 4);
+ pci_write_config(brdev, CBBR_IOLIMIT1, 0, 4);
+ return (0);
+}
+
static void
cbb_pci_intr(void *arg)
{
@@ -702,12 +733,46 @@ cbb_pci_intr(void *arg)
exca_getb(&sc->exca[0], EXCA_CSC);
}
+/************************************************************************/
+/* PCI compat methods */
+/************************************************************************/
+
+static int
+cbb_maxslots(device_t brdev)
+{
+ return (0);
+}
+
+static uint32_t
+cbb_read_config(device_t brdev, int b, int s, int f, int reg, int width)
+{
+ uint32_t rv;
+
+ /*
+ * Pass through to the next ppb up the chain (i.e. our grandparent).
+ */
+ rv = PCIB_READ_CONFIG(device_get_parent(device_get_parent(brdev)),
+ b, s, f, reg, width);
+ return (rv);
+}
+
+static void
+cbb_write_config(device_t brdev, int b, int s, int f, int reg, uint32_t val,
+ int width)
+{
+ /*
+ * Pass through to the next ppb up the chain (i.e. our grandparent).
+ */
+ PCIB_WRITE_CONFIG(device_get_parent(device_get_parent(brdev)),
+ b, s, f, reg, val, width);
+}
+
static device_method_t cbb_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, cbb_pci_probe),
DEVMETHOD(device_attach, cbb_pci_attach),
DEVMETHOD(device_detach, cbb_detach),
- DEVMETHOD(device_shutdown, cbb_shutdown),
+ DEVMETHOD(device_shutdown, cbb_pci_shutdown),
DEVMETHOD(device_suspend, cbb_suspend),
DEVMETHOD(device_resume, cbb_resume),
diff --git a/sys/dev/pccbb/pccbbvar.h b/sys/dev/pccbb/pccbbvar.h
index 8e98c7718259..32bd0fe78c68 100644
--- a/sys/dev/pccbb/pccbbvar.h
+++ b/sys/dev/pccbb/pccbbvar.h
@@ -123,8 +123,6 @@ int cbb_detach(device_t brdev);
void cbb_disable_func_intr(struct cbb_softc *sc);
void cbb_driver_added(device_t brdev, driver_t *driver);
void cbb_event_thread(void *arg);
-void cbb_intr(void *arg);
-int cbb_maxslots(device_t brdev);
int cbb_pcic_set_memory_offset(device_t brdev, device_t child, int rid,
uint32_t cardaddr, uint32_t *deltap);
int cbb_pcic_set_res_flags(device_t brdev, device_t child, int type,
@@ -132,8 +130,6 @@ int cbb_pcic_set_res_flags(device_t brdev, device_t child, int type,
int cbb_power(device_t brdev, int volts);
int cbb_power_enable_socket(device_t brdev, device_t child);
void cbb_power_disable_socket(device_t brdev, device_t child);
-uint32_t cbb_read_config(device_t brdev, int b, int s, int f,
- int reg, int width);
int cbb_read_ivar(device_t brdev, device_t child, int which,
uintptr_t *result);
int cbb_release_resource(device_t brdev, device_t child,
@@ -141,12 +137,9 @@ int cbb_release_resource(device_t brdev, device_t child,
int cbb_resume(device_t self);
int cbb_setup_intr(device_t dev, device_t child, struct resource *irq,
int flags, driver_intr_t *intr, void *arg, void **cookiep);
-int cbb_shutdown(device_t brdev);
int cbb_suspend(device_t self);
int cbb_teardown_intr(device_t dev, device_t child, struct resource *irq,
void *cookie);
-void cbb_write_config(device_t brdev, int b, int s, int f,
- int reg, uint32_t val, int width);
int cbb_write_ivar(device_t brdev, device_t child, int which,
uintptr_t value);