diff options
Diffstat (limited to 'arch/powerpc/kernel/rtas.c')
-rw-r--r-- | arch/powerpc/kernel/rtas.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c index 4d22eeeeb91d..b7fc2d884950 100644 --- a/arch/powerpc/kernel/rtas.c +++ b/arch/powerpc/kernel/rtas.c | |||
@@ -43,6 +43,13 @@ char rtas_data_buf[RTAS_DATA_BUF_SIZE] __cacheline_aligned; | |||
43 | unsigned long rtas_rmo_buf; | 43 | unsigned long rtas_rmo_buf; |
44 | 44 | ||
45 | /* | 45 | /* |
46 | * If non-NULL, this gets called when the kernel terminates. | ||
47 | * This is done like this so rtas_flash can be a module. | ||
48 | */ | ||
49 | void (*rtas_flash_term_hook)(int); | ||
50 | EXPORT_SYMBOL(rtas_flash_term_hook); | ||
51 | |||
52 | /* | ||
46 | * call_rtas_display_status and call_rtas_display_status_delay | 53 | * call_rtas_display_status and call_rtas_display_status_delay |
47 | * are designed only for very early low-level debugging, which | 54 | * are designed only for very early low-level debugging, which |
48 | * is why the token is hard-coded to 10. | 55 | * is why the token is hard-coded to 10. |
@@ -206,6 +213,7 @@ void rtas_progress(char *s, unsigned short hex) | |||
206 | 213 | ||
207 | spin_unlock(&progress_lock); | 214 | spin_unlock(&progress_lock); |
208 | } | 215 | } |
216 | EXPORT_SYMBOL(rtas_progress); /* needed by rtas_flash module */ | ||
209 | 217 | ||
210 | int rtas_token(const char *service) | 218 | int rtas_token(const char *service) |
211 | { | 219 | { |
@@ -492,6 +500,8 @@ int rtas_set_indicator(int indicator, int index, int new_value) | |||
492 | 500 | ||
493 | void rtas_restart(char *cmd) | 501 | void rtas_restart(char *cmd) |
494 | { | 502 | { |
503 | if (rtas_flash_term_hook) | ||
504 | rtas_flash_term_hook(SYS_RESTART); | ||
495 | printk("RTAS system-reboot returned %d\n", | 505 | printk("RTAS system-reboot returned %d\n", |
496 | rtas_call(rtas_token("system-reboot"), 0, 1, NULL)); | 506 | rtas_call(rtas_token("system-reboot"), 0, 1, NULL)); |
497 | for (;;); | 507 | for (;;); |
@@ -499,6 +509,8 @@ void rtas_restart(char *cmd) | |||
499 | 509 | ||
500 | void rtas_power_off(void) | 510 | void rtas_power_off(void) |
501 | { | 511 | { |
512 | if (rtas_flash_term_hook) | ||
513 | rtas_flash_term_hook(SYS_POWER_OFF); | ||
502 | /* allow power on only with power button press */ | 514 | /* allow power on only with power button press */ |
503 | printk("RTAS power-off returned %d\n", | 515 | printk("RTAS power-off returned %d\n", |
504 | rtas_call(rtas_token("power-off"), 2, 1, NULL, -1, -1)); | 516 | rtas_call(rtas_token("power-off"), 2, 1, NULL, -1, -1)); |
@@ -507,7 +519,12 @@ void rtas_power_off(void) | |||
507 | 519 | ||
508 | void rtas_halt(void) | 520 | void rtas_halt(void) |
509 | { | 521 | { |
510 | rtas_power_off(); | 522 | if (rtas_flash_term_hook) |
523 | rtas_flash_term_hook(SYS_HALT); | ||
524 | /* allow power on only with power button press */ | ||
525 | printk("RTAS power-off returned %d\n", | ||
526 | rtas_call(rtas_token("power-off"), 2, 1, NULL, -1, -1)); | ||
527 | for (;;); | ||
511 | } | 528 | } |
512 | 529 | ||
513 | /* Must be in the RMO region, so we place it here */ | 530 | /* Must be in the RMO region, so we place it here */ |