Date: Fri, 24 May 2013 03:56:40 +0000 (UTC) From: Justin Hibbits <jhibbits@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r250955 - in projects/pmac_pmu/sys: dev/ofw dev/pci powerpc/aim powerpc/ofw powerpc/powermac Message-ID: <201305240356.r4O3uedn025836@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhibbits Date: Fri May 24 03:56:40 2013 New Revision: 250955 URL: http://svnweb.freebsd.org/changeset/base/250955 Log: Mark the AIM Nexus device, and various buses, as early drivers, so they're resumed early. Modified: projects/pmac_pmu/sys/dev/ofw/ofw_bus_subr.c projects/pmac_pmu/sys/dev/pci/hostb_pci.c projects/pmac_pmu/sys/dev/pci/pci.c projects/pmac_pmu/sys/powerpc/aim/nexus.c projects/pmac_pmu/sys/powerpc/ofw/ofw_pcib_pci.c projects/pmac_pmu/sys/powerpc/ofw/ofw_pcibus.c projects/pmac_pmu/sys/powerpc/powermac/uninorth.c projects/pmac_pmu/sys/powerpc/powermac/uninorthpci.c projects/pmac_pmu/sys/powerpc/powermac/uninorthvar.h Modified: projects/pmac_pmu/sys/dev/ofw/ofw_bus_subr.c ============================================================================== --- projects/pmac_pmu/sys/dev/ofw/ofw_bus_subr.c Fri May 24 03:52:54 2013 (r250954) +++ projects/pmac_pmu/sys/dev/ofw/ofw_bus_subr.c Fri May 24 03:56:40 2013 (r250955) @@ -247,6 +247,7 @@ ofw_bus_lookup_imap(phandle_t node, stru ("ofw_bus_lookup_imap: register size too small: %d < %d", regsz, ii->opi_addrc)); rv = OF_getprop(node, "reg", reg, regsz); + printf("rv: %d, %x\n", rv, node); if (rv < regsz) panic("ofw_bus_lookup_imap: could not get reg property"); return (ofw_bus_search_intrmap(pintr, pintrsz, reg, ii->opi_addrc, Modified: projects/pmac_pmu/sys/dev/pci/hostb_pci.c ============================================================================== --- projects/pmac_pmu/sys/dev/pci/hostb_pci.c Fri May 24 03:52:54 2013 (r250954) +++ projects/pmac_pmu/sys/dev/pci/hostb_pci.c Fri May 24 03:56:40 2013 (r250955) @@ -264,4 +264,4 @@ static driver_t pci_hostb_driver = { static devclass_t pci_hostb_devclass; -DRIVER_MODULE(hostb, pci, pci_hostb_driver, pci_hostb_devclass, 0, 0); +EARLY_DRIVER_MODULE(hostb, pci, pci_hostb_driver, pci_hostb_devclass, 0, 0, BUS_PASS_BUS); Modified: projects/pmac_pmu/sys/dev/pci/pci.c ============================================================================== --- projects/pmac_pmu/sys/dev/pci/pci.c Fri May 24 03:52:54 2013 (r250954) +++ projects/pmac_pmu/sys/dev/pci/pci.c Fri May 24 03:56:40 2013 (r250955) @@ -184,7 +184,7 @@ static device_method_t pci_methods[] = { DEFINE_CLASS_0(pci, pci_driver, pci_methods, sizeof(struct pci_softc)); static devclass_t pci_devclass; -DRIVER_MODULE(pci, pcib, pci_driver, pci_devclass, pci_modevent, 0); +EARLY_DRIVER_MODULE(pci, pcib, pci_driver, pci_devclass, pci_modevent, 0, BUS_PASS_BUS); MODULE_VERSION(pci, 1); static char *pci_vendordata; @@ -3397,7 +3397,7 @@ pci_resume(device_t dev) case PCIC_MEMORY: case PCIC_BRIDGE: case PCIC_BASEPERIPH: - DEVICE_RESUME(child); + error = DEVICE_RESUME(child); break; } } @@ -3410,11 +3410,11 @@ pci_resume(device_t dev) case PCIC_BASEPERIPH: break; default: - DEVICE_RESUME(child); + error = DEVICE_RESUME(child); } } free(devlist, M_TEMP); - return (0); + return (error); } static void Modified: projects/pmac_pmu/sys/powerpc/aim/nexus.c ============================================================================== --- projects/pmac_pmu/sys/powerpc/aim/nexus.c Fri May 24 03:52:54 2013 (r250954) +++ projects/pmac_pmu/sys/powerpc/aim/nexus.c Fri May 24 03:56:40 2013 (r250955) @@ -195,7 +195,7 @@ static driver_t nexus_driver = { static devclass_t nexus_devclass; -DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0); +EARLY_DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0, BUS_PASS_BUS); static int nexus_probe(device_t dev) @@ -523,4 +523,3 @@ nexus_ofw_get_compat(device_t bus, devic return (dinfo->ndi_compatible); } - Modified: projects/pmac_pmu/sys/powerpc/ofw/ofw_pcib_pci.c ============================================================================== --- projects/pmac_pmu/sys/powerpc/ofw/ofw_pcib_pci.c Fri May 24 03:52:54 2013 (r250954) +++ projects/pmac_pmu/sys/powerpc/ofw/ofw_pcib_pci.c Fri May 24 03:56:40 2013 (r250955) @@ -82,7 +82,7 @@ struct ofw_pcib_softc { DEFINE_CLASS_1(pcib, ofw_pcib_pci_driver, ofw_pcib_pci_methods, sizeof(struct ofw_pcib_softc), pcib_driver); -DRIVER_MODULE(ofw_pcib, pci, ofw_pcib_pci_driver, pcib_devclass, 0, 0); +EARLY_DRIVER_MODULE(ofw_pcib, pci, ofw_pcib_pci_driver, pcib_devclass, 0, 0, BUS_PASS_BUS); static int ofw_pcib_pci_probe(device_t dev) Modified: projects/pmac_pmu/sys/powerpc/ofw/ofw_pcibus.c ============================================================================== --- projects/pmac_pmu/sys/powerpc/ofw/ofw_pcibus.c Fri May 24 03:52:54 2013 (r250954) +++ projects/pmac_pmu/sys/powerpc/ofw/ofw_pcibus.c Fri May 24 03:56:40 2013 (r250955) @@ -97,7 +97,7 @@ static devclass_t pci_devclass; DEFINE_CLASS_1(pci, ofw_pcibus_driver, ofw_pcibus_methods, sizeof(struct pci_softc), pci_driver); -DRIVER_MODULE(ofw_pcibus, pcib, ofw_pcibus_driver, pci_devclass, 0, 0); +EARLY_DRIVER_MODULE(ofw_pcibus, pcib, ofw_pcibus_driver, pci_devclass, 0, 0, BUS_PASS_BUS); MODULE_VERSION(ofw_pcibus, 1); MODULE_DEPEND(ofw_pcibus, pci, 1, 1, 1); Modified: projects/pmac_pmu/sys/powerpc/powermac/uninorth.c ============================================================================== --- projects/pmac_pmu/sys/powerpc/powermac/uninorth.c Fri May 24 03:52:54 2013 (r250954) +++ projects/pmac_pmu/sys/powerpc/powermac/uninorth.c Fri May 24 03:56:40 2013 (r250955) @@ -66,6 +66,7 @@ static MALLOC_DEFINE(M_UNIN, "unin", "un static int unin_chip_probe(device_t); static int unin_chip_attach(device_t); static int unin_chip_suspend(device_t); +static int unin_chip_resume(device_t); /* * Bus interface. @@ -103,8 +104,8 @@ static device_method_t unin_chip_methods /* Device interface */ DEVMETHOD(device_probe, unin_chip_probe), DEVMETHOD(device_attach, unin_chip_attach), - DEVMETHOD(device_suspend, unin_chip_suspend), - DEVMETHOD(device_resume, unin_chip_resume), + DEVMETHOD(device_suspend, unin_chip_suspend), + DEVMETHOD(device_resume, unin_chip_resume), /* Bus interface */ DEVMETHOD(bus_print_child, unin_chip_print_child), @@ -146,7 +147,7 @@ static devclass_t unin_chip_devclass; */ static device_t unin_chip; -DRIVER_MODULE(unin, nexus, unin_chip_driver, unin_chip_devclass, 0, 0); +EARLY_DRIVER_MODULE(unin, nexus, unin_chip_driver, unin_chip_devclass, 0, 0, BUS_PASS_BUS); /* * Add an interrupt to the dev's resource list if present @@ -633,16 +634,38 @@ unin_chip_get_devinfo(device_t dev, devi return (&dinfo->udi_obdinfo); } -static int unin_chip_suspend(device_t dev) +static int +unin_chip_suspend(device_t dev) { int error; error = bus_generic_suspend(dev); - return 0; + + if (error) + return (error); + + if (bus_current_pass == BUS_PASS_BUS) + error = unin_chip_sleep(dev, 0); + else + error = EAGAIN; + + return (error); +} + +static int +unin_chip_resume(device_t dev) +{ + + if (bus_current_pass == BUS_PASS_BUS) + unin_chip_wake(dev); + + return (bus_generic_resume(dev)); } -int unin_chip_resume(device_t dev) +int +unin_chip_wake(device_t dev) { + if (dev == NULL) dev = unin_chip; unin_update_reg(dev, UNIN_PWR_MGMT, UNIN_PWR_NORMAL, UNIN_PWR_MASK); @@ -650,11 +673,11 @@ int unin_chip_resume(device_t dev) unin_update_reg(dev, UNIN_HWINIT_STATE, UNIN_RUNNING, 0); DELAY(100); - bus_generic_resume(dev); return (0); } -int unin_chip_sleep(device_t dev, int idle) +int +unin_chip_sleep(device_t dev, int idle) { if (dev == NULL) dev = unin_chip; @@ -666,5 +689,6 @@ int unin_chip_sleep(device_t dev, int id else unin_update_reg(dev, UNIN_PWR_MGMT, UNIN_PWR_SLEEP, UNIN_PWR_MASK); DELAY(10); + return (0); } Modified: projects/pmac_pmu/sys/powerpc/powermac/uninorthpci.c ============================================================================== --- projects/pmac_pmu/sys/powerpc/powermac/uninorthpci.c Fri May 24 03:52:54 2013 (r250954) +++ projects/pmac_pmu/sys/powerpc/powermac/uninorthpci.c Fri May 24 03:56:40 2013 (r250955) @@ -100,7 +100,7 @@ static devclass_t uninorth_devclass; DEFINE_CLASS_1(pcib, uninorth_driver, uninorth_methods, sizeof(struct uninorth_softc), ofw_pci_driver); -DRIVER_MODULE(uninorth, nexus, uninorth_driver, uninorth_devclass, 0, 0); +EARLY_DRIVER_MODULE(uninorth, nexus, uninorth_driver, uninorth_devclass, 0, 0, BUS_PASS_BUS); static int uninorth_probe(device_t dev) Modified: projects/pmac_pmu/sys/powerpc/powermac/uninorthvar.h ============================================================================== --- projects/pmac_pmu/sys/powerpc/powermac/uninorthvar.h Fri May 24 03:52:54 2013 (r250954) +++ projects/pmac_pmu/sys/powerpc/powermac/uninorthvar.h Fri May 24 03:56:40 2013 (r250955) @@ -28,6 +28,8 @@ #ifndef _POWERPC_POWERMAC_UNINORTHVAR_H_ #define _POWERPC_POWERMAC_UNINORTHVAR_H_ +#include <dev/ofw/ofw_bus_subr.h> +#include <dev/ofw/ofw_pci.h> #include <powerpc/ofw/ofw_pci.h> struct uninorth_softc { @@ -101,5 +103,5 @@ struct unin_chip_devinfo { #define UNIN_MPIC_OUTPUT_ENABLE 0x4 extern int unin_chip_sleep(device_t dev, int idle); -extern int unin_chip_resume(device_t dev); +extern int unin_chip_wake(device_t dev); #endif /* _POWERPC_POWERMAC_UNINORTHVAR_H_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201305240356.r4O3uedn025836>