summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2016-07-24 09:27:10 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-08-22 15:26:51 +1000
commit3476b2ad3a5a53c92ec5e358dd9c28f5ef09c96d (patch)
tree3e738f9ba29612c8c4e3ae232a66e2dff1d7d411
parentf3ebe66f015e04a2e3a4414d24b3dba90ad3b893 (diff)
downloadblackbird-skiboot-3476b2ad3a5a53c92ec5e358dd9c28f5ef09c96d.tar.gz
blackbird-skiboot-3476b2ad3a5a53c92ec5e358dd9c28f5ef09c96d.zip
Rename enter_rvwinkle to enter_pm_state
And add an argument to specify whether to enter nap or rvwinkle Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--asm/head.S41
-rw-r--r--hw/slw.c5
-rw-r--r--include/skiboot.h2
3 files changed, 32 insertions, 16 deletions
diff --git a/asm/head.S b/asm/head.S
index f7ccee18..bde6ed2d 100644
--- a/asm/head.S
+++ b/asm/head.S
@@ -532,9 +532,9 @@ cleanup_tlb:
.long 0xa6037b7d; /* mtsrr1 r11 */ \
.long 0x2400004c /* rfid */
-.global enter_rvwinkle
-enter_rvwinkle:
- /* Before entering rvwinkle, we create a stack frame
+.global enter_pm_state
+enter_pm_state:
+ /* Before entering map or rvwinkle, we create a stack frame
* and save our non-volatile registers.
*
* We also save these SPRs:
@@ -544,6 +544,11 @@ enter_rvwinkle:
*
* - xxx TODO: HIDs
* - TODO: Mask MSR:ME during the process
+ *
+ * On entry, r3 indicates:
+ *
+ * 0 = nap
+ * 1 = rvwinkle
*/
mflr %r0
std %r0,16(%r1)
@@ -567,23 +572,35 @@ enter_rvwinkle:
SAVE_GPR(29,%r1)
SAVE_GPR(30,%r1)
SAVE_GPR(31,%r1)
- mfcr %r3
- mfxer %r4
- mfspr %r5,SPR_HSPRG0
- mfspr %r6,SPR_HSPRG1
- stw %r3,STACK_CR(%r1)
- stw %r4,STACK_XER(%r1)
- std %r5,STACK_GPR0(%r1)
- std %r6,STACK_GPR1(%r1)
+ mfcr %r4
+ mfxer %r5
+ mfspr %r6,SPR_HSPRG0
+ mfspr %r7,SPR_HSPRG1
+ stw %r4,STACK_CR(%r1)
+ stw %r5,STACK_XER(%r1)
+ std %r6,STACK_GPR0(%r1)
+ std %r7,STACK_GPR1(%r1)
/* Save stack pointer in struct cpu_thread */
std %r1,CPUTHREAD_SAVE_R1(%r13)
- /* rvwinkle sequence */
+ /* Winkle or nap ? */
+ cmpli %cr0,%r3,0
+ bne 1f
+
+ /* nap sequence */
ptesync
0: ld %r0,CPUTHREAD_SAVE_R1(%r13)
cmpd cr0,%r0,%r0
bne 0b
+ PPC_INST_NAP
+ b .
+
+ /* rvwinkle sequence */
+1: ptesync
+0: ld %r0,CPUTHREAD_SAVE_R1(%r13)
+ cmpd cr0,%r0,%r0
+ bne 0b
PPC_INST_RVWINKLE
b .
diff --git a/hw/slw.c b/hw/slw.c
index 74b9cd54..92994302 100644
--- a/hw/slw.c
+++ b/hw/slw.c
@@ -49,9 +49,6 @@ static uint32_t slw_timer_chip;
static uint64_t slw_last_gen;
static uint64_t slw_last_gen_stamp;
-/* Assembly in head.S */
-extern void enter_rvwinkle(void);
-
DEFINE_LOG_ENTRY(OPAL_RC_SLW_INIT, OPAL_PLATFORM_ERR_EVT, OPAL_SLW,
OPAL_PLATFORM_FIRMWARE, OPAL_PREDICTIVE_ERR_GENERAL,
OPAL_NA);
@@ -88,7 +85,7 @@ static void slw_do_rvwinkle(void *data)
/* Tell that we got it */
cpu->state = cpu_state_rvwinkle;
- enter_rvwinkle();
+ enter_pm_state(1);
/* Ok, it's ours again */
cpu->state = cpu_state_active;
diff --git a/include/skiboot.h b/include/skiboot.h
index 72cda14e..f475dd65 100644
--- a/include/skiboot.h
+++ b/include/skiboot.h
@@ -269,4 +269,6 @@ extern bool slw_timer_ok(void);
/* Fallback fake RTC */
extern void fake_rtc_init(void);
+/* Assembly in head.S */
+extern void enter_pm_state(bool winkle);
#endif /* __SKIBOOT_H */
OpenPOWER on IntegriCloud