summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2011-08-01 11:58:16 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2011-08-10 13:59:31 -0500
commit35f739456cefd1540e0aa4a42722a73a56a6b661 (patch)
tree99a7272d36b8933b1d100d7edef62756f1aecedd /src
parent791725b105cb8e61c9f93af844a80af12d07aad8 (diff)
downloadtalos-hostboot-35f739456cefd1540e0aa4a42722a73a56a6b661.tar.gz
talos-hostboot-35f739456cefd1540e0aa4a42722a73a56a6b661.zip
Update scratch SPR #s for P8.
Change-Id: Ia063a66b705b3272b7578ece420c84ac9c4c3d26 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/224 Reviewed-by: Douglas R. Gilbert <dgilbert@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Tested-by: Jenkins Server
Diffstat (limited to 'src')
-rw-r--r--src/include/arch/ppc.H29
-rw-r--r--src/include/kernel/misc.H17
-rw-r--r--src/kernel/makefile2
-rw-r--r--src/kernel/misc.C43
-rw-r--r--src/kernel/syscall.C16
-rw-r--r--src/makefile2
6 files changed, 64 insertions, 45 deletions
diff --git a/src/include/arch/ppc.H b/src/include/arch/ppc.H
index 405a2c297..bed75b258 100644
--- a/src/include/arch/ppc.H
+++ b/src/include/arch/ppc.H
@@ -229,33 +229,4 @@ inline void doze()
asm volatile("doze");
}
-ALWAYS_INLINE
-inline void setScratch0Spr(uint64_t _data)
-{
- // Write to SPRC(276) to select the register
- // 0x20 selects SCRATCH 0 SPR
- // Write to SPRD(277) to write the data
- // TODO This is per P7 Pervasive Spec. Is this the same for Salerno/Venice?
- register uint64_t address = 0x20;
- register uint64_t data = _data;
- asm volatile("mtspr 276, %0\n"
- "isync\n"
- "mtspr 277, %1" :: "r" (address), "r" (data));
-}
-
-ALWAYS_INLINE
-inline uint64_t getScratch0Spr()
-{
- // Write to SPRC(276) to select the register
- // 0x20 selects SCRATCH 0 SPR
- // Read from SPRD(277) to get the data
- // TODO This is per P7 Pervasive Spec. Is this the same for Salerno/Venice?
- register uint64_t address = 0x20;
- register uint64_t data = 0;
- asm volatile("mtspr 276, %1\n"
- "isync\n"
- "mfspr %0, 277" : "=r" (data) : "r" (address));
- return data;
-}
-
#endif
diff --git a/src/include/kernel/misc.H b/src/include/kernel/misc.H
new file mode 100644
index 000000000..984acfe04
--- /dev/null
+++ b/src/include/kernel/misc.H
@@ -0,0 +1,17 @@
+/** @file misc.H
+ * @brief Misc. Kernel functions and utilities.
+ */
+
+#ifndef __KERNEL_MISC_H
+#define __KERNEL_MISC_H
+
+#include <stdint.h>
+
+namespace KernelMisc
+{
+ /** @fn shutdown
+ * @brief Sequence kernel to shutdown and switch to payload.
+ */
+ void shutdown();
+};
+#endif
diff --git a/src/kernel/makefile b/src/kernel/makefile
index d02141bb6..c3af165c9 100644
--- a/src/kernel/makefile
+++ b/src/kernel/makefile
@@ -3,7 +3,7 @@ ROOTPATH = ../..
OBJS = start.o kernel.o console.o pagemgr.o heapmgr.o taskmgr.o cpumgr.o
OBJS += syscall.o scheduler.o spinlock.o exception.o vmmmgr.o timemgr.o
OBJS += futexmgr.o ptmgr.o segmentmgr.o devicesegment.o basesegment.o
-OBJS += block.o cpuid.o
+OBJS += block.o cpuid.o misc.o
include ${ROOTPATH}/config.mk
diff --git a/src/kernel/misc.C b/src/kernel/misc.C
new file mode 100644
index 000000000..56f5f563c
--- /dev/null
+++ b/src/kernel/misc.C
@@ -0,0 +1,43 @@
+#include <kernel/misc.H>
+#include <kernel/cpumgr.H>
+#include <kernel/cpuid.H>
+#include <kernel/console.H>
+
+namespace KernelMisc
+{
+ void shutdown()
+ {
+ // Update scratch SPR for shutdown status.
+ cpu_t* c = CpuManager::getCurrentCPU();
+ if (c->master)
+ {
+ register uint64_t status = CpuManager::getShutdownStatus();
+ printk("Shutdown Requested. Status = 0x%lx\n", status);
+
+ register uint64_t scratch_address = 0; // Values from PervSpec
+ switch(CpuID::getCpuType())
+ {
+ case CORE_POWER8_SALERNO:
+ case CORE_POWER8_VENICE:
+ scratch_address = 0x40;
+ break;
+
+ case CORE_POWER7:
+ case CORE_POWER7_PLUS:
+ default:
+ scratch_address = 0x20;
+ break;
+ }
+
+ asm volatile("mtspr 276, %0\n"
+ "isync\n"
+ "mtspr 277, %1"
+ :: "r" (scratch_address), "r" (status));
+ }
+
+ while(1)
+ {
+ doze();
+ }
+ }
+};
diff --git a/src/kernel/syscall.C b/src/kernel/syscall.C
index 1001ef361..639845224 100644
--- a/src/kernel/syscall.C
+++ b/src/kernel/syscall.C
@@ -11,6 +11,7 @@
#include <kernel/timemgr.H>
#include <kernel/futexmgr.H>
#include <kernel/cpuid.H>
+#include <kernel/misc.H>
extern "C"
void kernel_execute_decrementer()
@@ -22,20 +23,7 @@ void kernel_execute_decrementer()
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();
- }
+ KernelMisc::shutdown();
}
s->setNextRunnable();
diff --git a/src/makefile b/src/makefile
index caa22a9d2..3a5489cb9 100644
--- a/src/makefile
+++ b/src/makefile
@@ -30,7 +30,7 @@ DIRECT_BOOT_OBJECTS = start.o kernel.o taskmgr.o cpumgr.o syscall.o \
syscall_msg.o syscall_mmio.o syscall_time.o \
init_main.o vfs_main.o sync.o futexmgr.o \
ptmgr.o segmentmgr.o basesegment.o devicesegment.o \
- block.o cxxtest_data.o cpuid.o
+ block.o cxxtest_data.o cpuid.o misc.o
## STUB_TESTCASE_OBJECT = cxxtest_stub.o
OpenPOWER on IntegriCloud