[Skiboot] [PATCH 1/3] core: Add support for cec_power_down() on mambo
Michael Ellerman
mpe at ellerman.id.au
Fri Mar 27 15:53:10 AEDT 2015
Currently when running on mambo OPAL_CEC_POWER_DOWN doesn't work, the
simulator keeps running.
We can use the magic mambo support instruction with the right opcode to
ask mambo to stop the simulation.
Signed-off-by: Michael Ellerman <mpe at ellerman.id.au>
---
asm/misc.S | 5 +++++
core/platform.c | 14 ++++++++++++--
include/platform.h | 2 ++
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/asm/misc.S b/asm/misc.S
index bbabebc3a803..5e47c9828205 100644
--- a/asm/misc.S
+++ b/asm/misc.S
@@ -69,3 +69,8 @@ mambo_write:
.long 0x000eaeb0
blr
+.global mambo_sim_exit
+mambo_sim_exit:
+ li %r3, 31 /* aka. SimExitCode */
+ .long 0x000eaeb0
+ b .
diff --git a/core/platform.c b/core/platform.c
index f93b141860cb..541fc6c186af 100644
--- a/core/platform.c
+++ b/core/platform.c
@@ -21,6 +21,7 @@
#include <console.h>
#include <timebase.h>
#include <cpu.h>
+#include <chip.h>
struct platform platform;
@@ -59,9 +60,18 @@ static void generic_platform_init(void)
fake_rtc_init();
}
+static int64_t generic_cec_power_down(uint64_t request __unused)
+{
+ if (chip_quirk(QUIRK_MAMBO_CALLOUTS))
+ mambo_sim_exit();
+
+ return OPAL_UNSUPPORTED;
+}
+
static struct platform generic_platform = {
- .name = "generic",
- .init = generic_platform_init,
+ .name = "generic",
+ .init = generic_platform_init,
+ .cec_power_down = generic_cec_power_down,
};
void probe_platform(void)
diff --git a/include/platform.h b/include/platform.h
index be5999ba344f..80aa8babbe43 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -177,4 +177,6 @@ extern int resource_loaded(enum resource_id id, uint32_t idx);
extern int wait_for_resource_loaded(enum resource_id id, uint32_t idx);
+extern void mambo_sim_exit(void);
+
#endif /* __PLATFORM_H */
--
2.1.0
More information about the Skiboot
mailing list