From b4b3864eb0bde04901e921f56a4c88a4884b882f Mon Sep 17 00:00:00 2001 From: nwhitehorn Date: Fri, 27 Sep 2013 13:12:47 +0000 Subject: Rework handling of ofw_quiesce(), making it the responsibility of the platform modules. Whether to call this function or not is highly machine dependent: on some systems, it is required, while on others it breaks everything. Platform modules are in a better position to figure this out. This is required for POWER hypervisor SCSI to work correctly. There are no functional changes on Powermac systems. Approved by: re (kib) --- sys/powerpc/powermac/platform_powermac.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'sys/powerpc/powermac') diff --git a/sys/powerpc/powermac/platform_powermac.c b/sys/powerpc/powermac/platform_powermac.c index e21a48c..1954ae9 100644 --- a/sys/powerpc/powermac/platform_powermac.c +++ b/sys/powerpc/powermac/platform_powermac.c @@ -56,6 +56,7 @@ extern void *ap_pcpu; #endif static int powermac_probe(platform_t); +static int powermac_attach(platform_t); void powermac_mem_regions(platform_t, struct mem_region **phys, int *physsz, struct mem_region **avail, int *availsz); static u_long powermac_timebase_freq(platform_t, struct cpuref *cpuref); @@ -67,6 +68,7 @@ static void powermac_reset(platform_t); static platform_method_t powermac_methods[] = { PLATFORMMETHOD(platform_probe, powermac_probe), + PLATFORMMETHOD(platform_attach, powermac_attach), PLATFORMMETHOD(platform_mem_regions, powermac_mem_regions), PLATFORMMETHOD(platform_timebase_freq, powermac_timebase_freq), @@ -118,6 +120,35 @@ powermac_mem_regions(platform_t plat, struct mem_region **phys, int *physsz, ofw_mem_regions(phys,physsz,avail,availsz); } +static int +powermac_attach(platform_t plat) +{ + phandle_t rootnode; + char model[32]; + + + /* + * Quiesce Open Firmware on PowerMac11,2 and 12,1. It is + * necessary there to shut down a background thread doing fan + * management, and is harmful on other machines (it will make OF + * shut off power to various system components it had turned on). + * + * Note: we don't need to worry about which OF module we are + * using since this is called only from very early boot, within + * OF's boot context. + */ + + rootnode = OF_finddevice("/"); + if (OF_getprop(rootnode, "model", model, sizeof(model)) > 0) { + if (strcmp(model, "PowerMac11,2") == 0 || + strcmp(model, "PowerMac12,1") == 0) { + ofw_quiesce(); + } + } + + return (0); +} + static u_long powermac_timebase_freq(platform_t plat, struct cpuref *cpuref) { -- cgit v1.1