diff options
author | Michael Ellerman <mpe@ellerman.id.au> | 2015-03-30 20:45:36 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-04-01 12:08:14 +1100 |
commit | efc1ddab688720063a882f0939e9c6eff91387b1 (patch) | |
tree | ab449d6f57893d11387c5dc49730e689fed0b921 | |
parent | 16f965ed2ce85eed76592a82f89964fb20bbe5c9 (diff) | |
download | skiboot-efc1ddab688720063a882f0939e9c6eff91387b1.zip skiboot-efc1ddab688720063a882f0939e9c6eff91387b1.tar.gz skiboot-efc1ddab688720063a882f0939e9c6eff91387b1.tar.bz2 |
core: Add support for cec_power_down() on mambo
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@ellerman.id.au>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | asm/misc.S | 5 | ||||
-rw-r--r-- | core/platform.c | 14 | ||||
-rw-r--r-- | include/platform.h | 2 |
3 files changed, 19 insertions, 2 deletions
@@ -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 f93b141..541fc6c 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 be5999b..80aa8ba 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 */ |