summaryrefslogtreecommitdiffstats
path: root/src/kernel/misc.C
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2012-04-18 16:18:22 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-04-24 09:52:42 -0500
commitf2dd13f86d803e241b835c5ca2a2a14d583ba01e (patch)
treeb46bd46aa359a19e460f2382bb2127b08d0ec3e6 /src/kernel/misc.C
parentf4e49418fd0743ab0d143f0ab3c505baefe58bfa (diff)
downloadblackbird-hostboot-f2dd13f86d803e241b835c5ca2a2a14d583ba01e.tar.gz
blackbird-hostboot-f2dd13f86d803e241b835c5ca2a2a14d583ba01e.zip
Allow kernel to shutdown-to-payload.
This code is currently unused, due to InitService not having the payload address and the start_host_os IPL step being unimplemented. For testing purposes the 'shutdown' call in initservice.C can be changed to pass a non-zero base address (such as 256MB). RTC: 40871 Change-Id: I0f4b6bae62ede1853aabbcb28082300005e31897 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/926 Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com> Tested-by: Jenkins Server Reviewed-by: Douglas R. Gilbert <dgilbert@us.ibm.com>
Diffstat (limited to 'src/kernel/misc.C')
-rw-r--r--src/kernel/misc.C40
1 files changed, 38 insertions, 2 deletions
diff --git a/src/kernel/misc.C b/src/kernel/misc.C
index 513844875..74be12de1 100644
--- a/src/kernel/misc.C
+++ b/src/kernel/misc.C
@@ -24,9 +24,17 @@
#include <kernel/cpumgr.H>
#include <kernel/cpuid.H>
#include <kernel/console.H>
+#include <kernel/barrier.H>
+
+extern "C" void kernel_shutdown(size_t, uint64_t, uint64_t) NO_RETURN;
+
namespace KernelMisc
{
+
+ uint64_t g_payload_base = 0;
+ uint64_t g_payload_entry = 0;
+
void shutdown()
{
// Update scratch SPR for shutdown status.
@@ -65,9 +73,37 @@ namespace KernelMisc
// for exactly how this is handled.
MAGIC_INSTRUCTION(MAGIC_SHUTDOWN);
- while(1)
+ // Check for a valid payload address.
+ if ((0 == g_payload_base) && (0 == g_payload_entry))
{
- doze();
+ // We really don't know what we're suppose to do now, so just
+ // sleep all the processors.
+
+ if (c->master)
+ {
+ printk("No payload... doze'ing all threads.\n");
+ }
+
+ while(1)
+ {
+ doze();
+ }
+ }
+ else
+ {
+ static Barrier* l_barrier = new Barrier(CpuManager::getCpuCount());
+
+ if (c->master)
+ {
+ printk("Preparing to enter payload...%lx:%lx\n",
+ g_payload_base, g_payload_entry);
+ }
+
+ l_barrier->wait();
+
+ kernel_shutdown(CpuManager::getCpuCount(),
+ g_payload_base,
+ g_payload_entry);
}
}
};
OpenPOWER on IntegriCloud