From owner-svn-src-all@FreeBSD.ORG Sun May 23 02:18:40 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E44DC1065673; Sun, 23 May 2010 02:18:40 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B94E18FC17; Sun, 23 May 2010 02:18:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4N2IeAm038242; Sun, 23 May 2010 02:18:40 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4N2IepZ038240; Sun, 23 May 2010 02:18:40 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201005230218.o4N2IepZ038240@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 23 May 2010 02:18:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208427 - stable/8/sys/powerpc/aim X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2010 02:18:41 -0000 Author: nwhitehorn Date: Sun May 23 02:18:40 2010 New Revision: 208427 URL: http://svn.freebsd.org/changeset/base/208427 Log: MFC r208152,208172: On PowerMac11,2 and (presumably) PowerMac12,1, we need to quiesce the firmware in order to take over control of the SMU. Without doing this, the firmware background process doing fan control will run amok as we take over the system and crash the management chip. This is limited to these two machines because our kernel is heavily dependent on firmware accesses, and so quiescing firmware can cause nasty problems. Modified: stable/8/sys/powerpc/aim/ofw_machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/geom/sched/ (props changed) Modified: stable/8/sys/powerpc/aim/ofw_machdep.c ============================================================================== --- stable/8/sys/powerpc/aim/ofw_machdep.c Sun May 23 02:16:29 2010 (r208426) +++ stable/8/sys/powerpc/aim/ofw_machdep.c Sun May 23 02:18:40 2010 (r208427) @@ -75,6 +75,7 @@ static int (*ofwcall)(void *); static void *fdt; int ofw_real_mode; +static void ofw_quiesce(void); static int openfirmware(void *args); /* @@ -291,6 +292,12 @@ OF_bootstrap() return status; OF_init(openfirmware); + + /* + * On some machines, we need to quiesce OF to turn off + * background processes. + */ + ofw_quiesce(); } else { status = OF_install(OFW_FDT, 0); @@ -303,6 +310,39 @@ OF_bootstrap() return (status); } +static void +ofw_quiesce(void) +{ + phandle_t rootnode; + char model[32]; + struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + } args; + + /* + * Only 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. + * + * 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) { + args.name = (cell_t)(uintptr_t)"quiesce"; + args.nargs = 0; + args.nreturns = 0; + openfirmware(&args); + } + } +} + static int openfirmware(void *args) {