summaryrefslogtreecommitdiffstats
path: root/src/kernel
diff options
context:
space:
mode:
authorMike Jones <mjjones@us.ibm.com>2011-07-18 13:01:59 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2011-07-19 13:43:56 -0500
commit103f2e58b35ac7218d9960ceb6568ff7ceb332d2 (patch)
treeef4c3bf1e3b8fe380e03d2fc256bdd46d10214fc /src/kernel
parentbe301c4ea87c944bd1c51ca2c73ac719cec6b495 (diff)
downloadtalos-hostboot-103f2e58b35ac7218d9960ceb6568ff7ceb332d2.tar.gz
talos-hostboot-103f2e58b35ac7218d9960ceb6568ff7ceb332d2.zip
Shutdown and post status on HostBoot completion
Change-Id: If2ab46af85065b29695a1186ed331fd835944eb4 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/204 Tested-by: Jenkins Server Reviewed-by: Mark W. Wenning <wenning@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/cpumgr.C16
-rw-r--r--src/kernel/syscall.C36
2 files changed, 51 insertions, 1 deletions
diff --git a/src/kernel/cpumgr.C b/src/kernel/cpumgr.C
index 27417ef0d..7be1cf2dc 100644
--- a/src/kernel/cpumgr.C
+++ b/src/kernel/cpumgr.C
@@ -11,6 +11,8 @@
#include <sys/sync.h>
cpu_t* CpuManager::cv_cpus[CpuManager::MAXCPUS] = { NULL };
+bool CpuManager::cv_shutdown_requested = false;
+uint64_t CpuManager::cv_shutdown_status = 0;
CpuManager::CpuManager()
{
@@ -34,6 +36,12 @@ void CpuManager::init_slave_smp(cpu_t* cpu)
Singleton<CpuManager>::instance().startSlaveCPU(cpu);
}
+void CpuManager::requestShutdown(uint64_t i_status)
+{
+ cv_shutdown_requested = true;
+ cv_shutdown_status = i_status;
+}
+
void CpuManager::startCPU(ssize_t i)
{
bool currentCPU = false;
@@ -55,6 +63,14 @@ void CpuManager::startCPU(ssize_t i)
// Initialize CPU.
cpu->cpu = i;
+ if (currentCPU)
+ {
+ cpu->master = true;
+ }
+ else
+ {
+ cpu->master = false;
+ }
cpu->scheduler = &Singleton<Scheduler>::instance();
cpu->scheduler_extra = NULL;
cpu->kernel_stack =
diff --git a/src/kernel/syscall.C b/src/kernel/syscall.C
index 85252a408..bccccac03 100644
--- a/src/kernel/syscall.C
+++ b/src/kernel/syscall.C
@@ -13,9 +13,29 @@
extern "C"
void kernel_execute_decrementer()
{
- Scheduler* s = CpuManager::getCurrentCPU()->scheduler;
+ cpu_t* c = CpuManager::getCurrentCPU();
+ Scheduler* s = c->scheduler;
TimeManager::checkReleaseTasks(s);
s->returnRunnable();
+
+ if (CpuManager::isShutdownRequested())
+ {
+ // Shutdown was requested
+ if (c->master)
+ {
+ // Write the shutdown status to Scratch SPR 0
+ uint64_t status = CpuManager::getShutdownStatus();
+ printk("Shutdown Requested. Status = 0x%lx\n", status);
+ setScratch0Spr(status);
+ }
+
+ // Make the thread doze
+ while(1)
+ {
+ doze();
+ }
+ }
+
s->setNextRunnable();
}
@@ -39,6 +59,7 @@ namespace Systemcalls
void TimeNanosleep(task_t*);
void FutexWait(task_t *t);
void FutexWake(task_t *t);
+ void Shutdown(task_t *t);
syscall syscalls[] =
{
@@ -63,6 +84,8 @@ namespace Systemcalls
&FutexWait,
&FutexWake,
+
+ &Shutdown,
};
};
@@ -322,4 +345,15 @@ namespace Systemcalls
TASK_SETRTN(t,started);
}
+ /**
+ * Shutdown all CPUs
+ * @param[in] t: The current task
+ */
+ void Shutdown(task_t * t)
+ {
+ uint64_t status = static_cast<uint64_t>(TASK_GETARG0(t));
+ CpuManager::requestShutdown(status);
+ TASK_SETRTN(t, 0);
+ }
+
};
OpenPOWER on IntegriCloud