Move shutdown, and pci specific methods into pccbb_pci.c. Many more
are needed still.
This commit is contained in:
parent
0ed782821f
commit
8b0790bd13
@ -346,37 +346,6 @@ cbb_detach(device_t brdev)
|
||||
return (0);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -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),
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user