[Skiboot] [PATCH 16/34] Rename enter_rvwinkle to enter_pm_state
Benjamin Herrenschmidt
benh at kernel.crashing.org
Sun Jul 24 09:27:10 AEST 2016
And add an argument to specify whether to enter nap or rvwinkle
Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
asm/head.S | 41 +++++++++++++++++++++++++++++------------
hw/slw.c | 5 +----
include/skiboot.h | 2 ++
3 files changed, 32 insertions(+), 16 deletions(-)
diff --git a/asm/head.S b/asm/head.S
index 5b4977c..c3ed3d7 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 74b9cd5..9299430 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 72cda14..f475dd6 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 */
--
2.7.4
More information about the Skiboot
mailing list