Move the suspsned and resume functions to the bus attachment. They
were accessing PCI config registers, which won't work for the ISA version.
This commit is contained in:
parent
47a66ea835
commit
53d673996b
@ -1562,61 +1562,6 @@ cbb_write_ivar(device_t brdev, device_t child, int which, uintptr_t value)
|
||||
return (ENOENT);
|
||||
}
|
||||
|
||||
int
|
||||
cbb_suspend(device_t brdev)
|
||||
{
|
||||
int error = 0;
|
||||
struct cbb_softc *sc = device_get_softc(brdev);
|
||||
|
||||
error = bus_generic_suspend(brdev);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
cbb_set(sc, CBB_SOCKET_MASK, 0); /* Quiet hardware */
|
||||
sc->cardok = 0; /* Card is bogus now */
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
cbb_resume(device_t brdev)
|
||||
{
|
||||
int error = 0;
|
||||
struct cbb_softc *sc = (struct cbb_softc *)device_get_softc(brdev);
|
||||
uint32_t tmp;
|
||||
|
||||
/*
|
||||
* In the APM and early ACPI era, BIOSes saved the PCI config
|
||||
* registers. As chips became more complicated, that functionality moved
|
||||
* into the ACPI code / tables. We must therefore, restore the settings
|
||||
* we made here to make sure the device come back. Transitions to Dx
|
||||
* from D0 and back to D0 cause the bridge to lose its config space, so
|
||||
* all the bus mappings and such are preserved.
|
||||
*
|
||||
* For most drivers, the PCI layer handles this saving. However, since
|
||||
* there's much black magic and arcane art hidden in these few lines of
|
||||
* code that would be difficult to transition into the PCI
|
||||
* layer. chipinit was several years of trial and error to write.
|
||||
*/
|
||||
pci_write_config(brdev, CBBR_SOCKBASE, rman_get_start(sc->base_res), 4);
|
||||
DEVPRINTF((brdev, "PCI Memory allocated: %08lx\n",
|
||||
rman_get_start(sc->base_res)));
|
||||
|
||||
sc->chipinit(sc);
|
||||
|
||||
/* reset interrupt -- Do we really need to do this? */
|
||||
tmp = cbb_get(sc, CBB_SOCKET_EVENT);
|
||||
cbb_set(sc, CBB_SOCKET_EVENT, tmp);
|
||||
|
||||
/* CSC Interrupt: Card detect interrupt on */
|
||||
cbb_setb(sc, CBB_SOCKET_MASK, CBB_SOCKET_MASK_CD);
|
||||
|
||||
/* Signal the thread to wakeup. */
|
||||
wakeup(&sc->intrhand);
|
||||
|
||||
error = bus_generic_resume(brdev);
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
cbb_child_present(device_t parent, device_t child)
|
||||
{
|
||||
|
@ -203,13 +203,25 @@ cbb_isa_attach(device_t dev)
|
||||
return (ENOMEM);
|
||||
}
|
||||
|
||||
static int
|
||||
cbb_isa_suspend(device_t dev)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
cbb_isa_resume(device_t dev)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
static device_method_t cbb_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, cbb_isa_probe),
|
||||
DEVMETHOD(device_attach, cbb_isa_attach),
|
||||
DEVMETHOD(device_detach, cbb_detach),
|
||||
DEVMETHOD(device_suspend, cbb_suspend),
|
||||
DEVMETHOD(device_resume, cbb_resume),
|
||||
DEVMETHOD(device_suspend, cbb_isa_suspend),
|
||||
DEVMETHOD(device_resume, cbb_isa_resume),
|
||||
|
||||
/* bus methods */
|
||||
DEVMETHOD(bus_read_ivar, cbb_read_ivar),
|
||||
|
@ -877,14 +877,69 @@ cbb_write_config(device_t brdev, u_int b, u_int s, u_int f, u_int reg, uint32_t
|
||||
b, s, f, reg, val, width);
|
||||
}
|
||||
|
||||
static int
|
||||
cbb_pci_suspend(device_t brdev)
|
||||
{
|
||||
int error = 0;
|
||||
struct cbb_softc *sc = device_get_softc(brdev);
|
||||
|
||||
error = bus_generic_suspend(brdev);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
cbb_set(sc, CBB_SOCKET_MASK, 0); /* Quiet hardware */
|
||||
sc->cardok = 0; /* Card is bogus now */
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
cbb_pci_resume(device_t brdev)
|
||||
{
|
||||
int error = 0;
|
||||
struct cbb_softc *sc = (struct cbb_softc *)device_get_softc(brdev);
|
||||
uint32_t tmp;
|
||||
|
||||
/*
|
||||
* In the APM and early ACPI era, BIOSes saved the PCI config
|
||||
* registers. As chips became more complicated, that functionality moved
|
||||
* into the ACPI code / tables. We must therefore, restore the settings
|
||||
* we made here to make sure the device come back. Transitions to Dx
|
||||
* from D0 and back to D0 cause the bridge to lose its config space, so
|
||||
* all the bus mappings and such are preserved.
|
||||
*
|
||||
* For most drivers, the PCI layer handles this saving. However, since
|
||||
* there's much black magic and arcane art hidden in these few lines of
|
||||
* code that would be difficult to transition into the PCI
|
||||
* layer. chipinit was several years of trial and error to write.
|
||||
*/
|
||||
pci_write_config(brdev, CBBR_SOCKBASE, rman_get_start(sc->base_res), 4);
|
||||
DEVPRINTF((brdev, "PCI Memory allocated: %08lx\n",
|
||||
rman_get_start(sc->base_res)));
|
||||
|
||||
sc->chipinit(sc);
|
||||
|
||||
/* reset interrupt -- Do we really need to do this? */
|
||||
tmp = cbb_get(sc, CBB_SOCKET_EVENT);
|
||||
cbb_set(sc, CBB_SOCKET_EVENT, tmp);
|
||||
|
||||
/* CSC Interrupt: Card detect interrupt on */
|
||||
cbb_setb(sc, CBB_SOCKET_MASK, CBB_SOCKET_MASK_CD);
|
||||
|
||||
/* Signal the thread to wakeup. */
|
||||
wakeup(&sc->intrhand);
|
||||
|
||||
error = bus_generic_resume(brdev);
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
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_pci_shutdown),
|
||||
DEVMETHOD(device_suspend, cbb_suspend),
|
||||
DEVMETHOD(device_resume, cbb_resume),
|
||||
DEVMETHOD(device_suspend, cbb_pci_suspend),
|
||||
DEVMETHOD(device_resume, cbb_pci_resume),
|
||||
|
||||
/* bus methods */
|
||||
DEVMETHOD(bus_read_ivar, cbb_read_ivar),
|
||||
|
@ -134,11 +134,9 @@ 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,
|
||||
int type, int rid, struct resource *r);
|
||||
int cbb_resume(device_t self);
|
||||
int cbb_setup_intr(device_t dev, device_t child, struct resource *irq,
|
||||
int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg,
|
||||
void **cookiep);
|
||||
int cbb_suspend(device_t self);
|
||||
int cbb_teardown_intr(device_t dev, device_t child, struct resource *irq,
|
||||
void *cookie);
|
||||
int cbb_write_ivar(device_t brdev, device_t child, int which,
|
||||
|
Loading…
Reference in New Issue
Block a user