summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2010-05-16 22:01:43 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2010-05-16 22:01:43 +0000
commitb7a63fb85cd07072afa8e91201882f5a9c432e55 (patch)
tree47e3717519df1d7ce47286e22f711907ca9d62fc
parenta68dd336d5b121f161468847e1c9ebb7eb8b3d4f (diff)
downloadFreeBSD-src-b7a63fb85cd07072afa8e91201882f5a9c432e55.zip
FreeBSD-src-b7a63fb85cd07072afa8e91201882f5a9c432e55.tar.gz
Pull OF_quiesce() out of the MI Open Firmware layer and entirely into
PPC ofw_machdep.c, in recognition of its state as a machine specific hack. Requested by: marius
-rw-r--r--sys/dev/ofw/ofw_if.m7
-rw-r--r--sys/dev/ofw/ofw_standard.c19
-rw-r--r--sys/dev/ofw/openfirm.c9
-rw-r--r--sys/dev/ofw/openfirm.h1
-rw-r--r--sys/powerpc/aim/ofw_machdep.c43
-rw-r--r--sys/powerpc/ofw/ofw_real.c23
6 files changed, 35 insertions, 67 deletions
diff --git a/sys/dev/ofw/ofw_if.m b/sys/dev/ofw/ofw_if.m
index d2d323b..902f071 100644
--- a/sys/dev/ofw/ofw_if.m
+++ b/sys/dev/ofw/ofw_if.m
@@ -340,13 +340,6 @@ METHOD void release {
# Commands for returning control to the firmware
/**
- * @brief Turn off firmware background activities
- */
-METHOD void quiesce {
- ofw_t _ofw;
-};
-
-/**
* @brief Temporarily return control to firmware.
*/
METHOD void enter {
diff --git a/sys/dev/ofw/ofw_standard.c b/sys/dev/ofw/ofw_standard.c
index 5eecf77..e521fa0 100644
--- a/sys/dev/ofw/ofw_standard.c
+++ b/sys/dev/ofw/ofw_standard.c
@@ -105,7 +105,6 @@ static ssize_t ofw_std_write(ofw_t ofw, ihandle_t instance, const void *addr,
static int ofw_std_seek(ofw_t ofw, ihandle_t instance, uint64_t pos);
static caddr_t ofw_std_claim(ofw_t ofw, void *virt, size_t size, u_int align);
static void ofw_std_release(ofw_t ofw, void *virt, size_t size);
-static void ofw_std_quiesce(ofw_t ofw);
static void ofw_std_enter(ofw_t ofw);
static void ofw_std_exit(ofw_t ofw);
@@ -134,7 +133,6 @@ static ofw_method_t ofw_std_methods[] = {
OFWMETHOD(ofw_seek, ofw_std_seek),
OFWMETHOD(ofw_claim, ofw_std_claim),
OFWMETHOD(ofw_release, ofw_std_release),
- OFWMETHOD(ofw_quiesce, ofw_std_quiesce),
OFWMETHOD(ofw_enter, ofw_std_enter),
OFWMETHOD(ofw_exit, ofw_std_exit),
@@ -732,23 +730,6 @@ ofw_std_release(ofw_t ofw, void *virt, size_t size)
* Control transfer functions
*/
-/* Turn off OF background tasks */
-static void
-ofw_std_quiesce(ofw_t ofw)
-{
- struct {
- cell_t name;
- cell_t nargs;
- cell_t nreturns;
- } args = {
- (cell_t)"quiesce",
- 0,
- 0,
- };
-
- openfirmware(&args);
-}
-
/* Suspend and drop back to the Open Firmware interface. */
static void
ofw_std_enter(ofw_t ofw)
diff --git a/sys/dev/ofw/openfirm.c b/sys/dev/ofw/openfirm.c
index a560e93..17cda68 100644
--- a/sys/dev/ofw/openfirm.c
+++ b/sys/dev/ofw/openfirm.c
@@ -409,15 +409,6 @@ OF_release(void *virt, size_t size)
* Control transfer functions
*/
-/* Turn off OF background tasks */
-void
-OF_quiesce()
-{
-
- OFW_QUIESCE(ofw_obj);
-}
-
-
/* Suspend and drop back to the Open Firmware interface. */
void
OF_enter()
diff --git a/sys/dev/ofw/openfirm.h b/sys/dev/ofw/openfirm.h
index 08cbaf3..10e8aad 100644
--- a/sys/dev/ofw/openfirm.h
+++ b/sys/dev/ofw/openfirm.h
@@ -133,7 +133,6 @@ void *OF_claim(void *virtrequest, size_t size, u_int align);
void OF_release(void *virt, size_t size);
/* Control transfer functions */
-void OF_quiesce(void);
void OF_enter(void);
void OF_exit(void) __attribute__((noreturn));
diff --git a/sys/powerpc/aim/ofw_machdep.c b/sys/powerpc/aim/ofw_machdep.c
index 6a869b4..d599b50 100644
--- a/sys/powerpc/aim/ofw_machdep.c
+++ b/sys/powerpc/aim/ofw_machdep.c
@@ -77,6 +77,7 @@ static int (*ofwcall)(void *);
static void *fdt;
int ofw_real_mode;
+static void ofw_quiesce(void);
static int openfirmware(void *args);
/*
@@ -281,8 +282,6 @@ OF_initial_setup(void *fdt_ptr, void *junk, int (*openfirm)(void *))
boolean_t
OF_bootstrap()
{
- char model[32];
- phandle_t rootnode;
boolean_t status = FALSE;
mtx_init(&ofw_mutex, "open firmware", NULL, MTX_DEF);
@@ -302,12 +301,7 @@ OF_bootstrap()
* On some machines, we need to quiesce OF to turn off
* background processes.
*/
- rootnode = OF_finddevice("/");
- if (OF_getprop(rootnode, "model", model, sizeof(model)) > 0) {
- if (strcmp(model, "PowerMac11,2") == 0 ||
- strcmp(model, "PowerMac12,1") == 0)
- OF_quiesce();
- }
+ ofw_quiesce();
} else {
status = OF_install(OFW_FDT, 0);
@@ -320,6 +314,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)
{
diff --git a/sys/powerpc/ofw/ofw_real.c b/sys/powerpc/ofw/ofw_real.c
index 1590eb6..4425ad1 100644
--- a/sys/powerpc/ofw/ofw_real.c
+++ b/sys/powerpc/ofw/ofw_real.c
@@ -106,7 +106,6 @@ static ssize_t ofw_real_write(ofw_t, ihandle_t instance, const void *addr,
static int ofw_real_seek(ofw_t, ihandle_t instance, u_int64_t pos);
static caddr_t ofw_real_claim(ofw_t, void *virt, size_t size, u_int align);
static void ofw_real_release(ofw_t, void *virt, size_t size);
-static void ofw_real_quiesce(ofw_t);
static void ofw_real_enter(ofw_t);
static void ofw_real_exit(ofw_t);
@@ -134,7 +133,6 @@ static ofw_method_t ofw_real_methods[] = {
OFWMETHOD(ofw_seek, ofw_real_seek),
OFWMETHOD(ofw_claim, ofw_real_claim),
OFWMETHOD(ofw_release, ofw_real_release),
- OFWMETHOD(ofw_quiesce, ofw_real_quiesce),
OFWMETHOD(ofw_enter, ofw_real_enter),
OFWMETHOD(ofw_exit, ofw_real_exit),
@@ -891,27 +889,6 @@ ofw_real_release(ofw_t ofw, void *virt, size_t size)
* Control transfer functions
*/
-/* Turn off OF background tasks */
-static void
-ofw_real_quiesce(ofw_t ofw)
-{
- vm_offset_t argsptr;
- struct {
- cell_t name;
- cell_t nargs;
- cell_t nreturns;
- } args;
-
- args.name = (cell_t)(uintptr_t)"quiesce";
- args.nargs = 0;
- args.nreturns = 0;
-
- ofw_real_start();
- argsptr = ofw_real_map(&args, sizeof(args));
- openfirmware((void *)argsptr);
- ofw_real_stop();
-}
-
/* Suspend and drop back to the Open Firmware interface. */
static void
ofw_real_enter(ofw_t ofw)
OpenPOWER on IntegriCloud