diff options
author | Paul Mackerras <paulus@samba.org> | 2005-11-02 22:41:19 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2005-11-02 22:41:19 -0500 |
commit | f4fcbbe9a7fdf11305fea657202b954bdc2228ec (patch) | |
tree | d3f6a54b82b6d28f7e78cebd8043df2d9b596b5a | |
parent | 398382999bcff46ec1c7e7ab7574b10b087481c7 (diff) |
powerpc: Merge remaining RTAS code
This moves rtas-proc.c and rtas_flash.c into arch/powerpc/kernel, since
cell wants them as well as pseries (and chrp can use rtas-proc.c too,
at least in principle). rtas_fw.c is gone, with its bits moved into
rtas_flash.c and rtas.c.
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/Kconfig | 12 | ||||
-rw-r--r-- | arch/powerpc/kernel/Makefile | 3 | ||||
-rw-r--r-- | arch/powerpc/kernel/rtas-proc.c (renamed from arch/ppc64/kernel/rtas-proc.c) | 0 | ||||
-rw-r--r-- | arch/powerpc/kernel/rtas.c | 19 | ||||
-rw-r--r-- | arch/powerpc/kernel/rtas_flash.c (renamed from arch/ppc64/kernel/rtas_flash.c) | 113 | ||||
-rw-r--r-- | arch/powerpc/kernel/rtas_fw.c | 136 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/Kconfig | 9 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/Makefile | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/rtasd.c (renamed from arch/ppc64/kernel/rtasd.c) | 0 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/setup.c | 6 | ||||
-rw-r--r-- | arch/ppc64/kernel/Makefile | 4 | ||||
-rw-r--r-- | include/asm-powerpc/rtas.h | 28 |
12 files changed, 147 insertions, 185 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 1c44a1dac421..3cf03ab46113 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -278,7 +278,6 @@ config PPC_PSERIES | |||
278 | select PPC_I8259 | 278 | select PPC_I8259 |
279 | select PPC_RTAS | 279 | select PPC_RTAS |
280 | select RTAS_ERROR_LOGGING | 280 | select RTAS_ERROR_LOGGING |
281 | select RTAS_FW | ||
282 | default y | 281 | default y |
283 | 282 | ||
284 | config PPC_CHRP | 283 | config PPC_CHRP |
@@ -324,7 +323,6 @@ config PPC_CELL | |||
324 | bool " Cell Broadband Processor Architecture" | 323 | bool " Cell Broadband Processor Architecture" |
325 | depends on PPC_MULTIPLATFORM && PPC64 | 324 | depends on PPC_MULTIPLATFORM && PPC64 |
326 | select PPC_RTAS | 325 | select PPC_RTAS |
327 | select RTAS_FW | ||
328 | select MMIO_NVRAM | 326 | select MMIO_NVRAM |
329 | 327 | ||
330 | config PPC_OF | 328 | config PPC_OF |
@@ -356,10 +354,14 @@ config RTAS_ERROR_LOGGING | |||
356 | depends on PPC_RTAS | 354 | depends on PPC_RTAS |
357 | default n | 355 | default n |
358 | 356 | ||
359 | config RTAS_FW | 357 | config RTAS_PROC |
360 | bool | 358 | bool "Proc interface to RTAS" |
361 | depends on PPC_RTAS | 359 | depends on PPC_RTAS |
362 | default n | 360 | default y |
361 | |||
362 | config RTAS_FLASH | ||
363 | tristate "Firmware flash interface" | ||
364 | depends on PPC64 && RTAS_PROC | ||
363 | 365 | ||
364 | config MMIO_NVRAM | 366 | config MMIO_NVRAM |
365 | bool | 367 | bool |
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index abad3059a21a..601ddbf1c20b 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile | |||
@@ -18,7 +18,8 @@ obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o | |||
18 | obj-$(CONFIG_POWER4) += idle_power4.o | 18 | obj-$(CONFIG_POWER4) += idle_power4.o |
19 | obj-$(CONFIG_PPC_OF) += of_device.o | 19 | obj-$(CONFIG_PPC_OF) += of_device.o |
20 | obj-$(CONFIG_PPC_RTAS) += rtas.o | 20 | obj-$(CONFIG_PPC_RTAS) += rtas.o |
21 | obj-$(CONFIG_RTAS_FW) += rtas_fw.o | 21 | obj-$(CONFIG_RTAS_FLASH) += rtas_flash.o |
22 | obj-$(CONFIG_RTAS_PROC) += rtas-proc.o | ||
22 | obj-$(CONFIG_IBMVIO) += vio.o | 23 | obj-$(CONFIG_IBMVIO) += vio.o |
23 | 24 | ||
24 | ifeq ($(CONFIG_PPC_MERGE),y) | 25 | ifeq ($(CONFIG_PPC_MERGE),y) |
diff --git a/arch/ppc64/kernel/rtas-proc.c b/arch/powerpc/kernel/rtas-proc.c index 5bdd5b079d96..5bdd5b079d96 100644 --- a/arch/ppc64/kernel/rtas-proc.c +++ b/arch/powerpc/kernel/rtas-proc.c | |||
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 */ |
diff --git a/arch/ppc64/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c index 923e2e201a70..50500093c97f 100644 --- a/arch/ppc64/kernel/rtas_flash.c +++ b/arch/powerpc/kernel/rtas_flash.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <asm/delay.h> | 19 | #include <asm/delay.h> |
20 | #include <asm/uaccess.h> | 20 | #include <asm/uaccess.h> |
21 | #include <asm/rtas.h> | 21 | #include <asm/rtas.h> |
22 | #include <asm/abs_addr.h> | ||
22 | 23 | ||
23 | #define MODULE_VERS "1.0" | 24 | #define MODULE_VERS "1.0" |
24 | #define MODULE_NAME "rtas_flash" | 25 | #define MODULE_NAME "rtas_flash" |
@@ -71,10 +72,36 @@ | |||
71 | #define VALIDATE_BUF_SIZE 4096 | 72 | #define VALIDATE_BUF_SIZE 4096 |
72 | #define RTAS_MSG_MAXLEN 64 | 73 | #define RTAS_MSG_MAXLEN 64 |
73 | 74 | ||
75 | struct flash_block { | ||
76 | char *data; | ||
77 | unsigned long length; | ||
78 | }; | ||
79 | |||
80 | /* This struct is very similar but not identical to | ||
81 | * that needed by the rtas flash update. | ||
82 | * All we need to do for rtas is rewrite num_blocks | ||
83 | * into a version/length and translate the pointers | ||
84 | * to absolute. | ||
85 | */ | ||
86 | #define FLASH_BLOCKS_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct flash_block)) | ||
87 | struct flash_block_list { | ||
88 | unsigned long num_blocks; | ||
89 | struct flash_block_list *next; | ||
90 | struct flash_block blocks[FLASH_BLOCKS_PER_NODE]; | ||
91 | }; | ||
92 | struct flash_block_list_header { /* just the header of flash_block_list */ | ||
93 | unsigned long num_blocks; | ||
94 | struct flash_block_list *next; | ||
95 | }; | ||
96 | |||
97 | static struct flash_block_list_header rtas_firmware_flash_list = {0, NULL}; | ||
98 | |||
99 | #define FLASH_BLOCK_LIST_VERSION (1UL) | ||
100 | |||
74 | /* Local copy of the flash block list. | 101 | /* Local copy of the flash block list. |
75 | * We only allow one open of the flash proc file and create this | 102 | * We only allow one open of the flash proc file and create this |
76 | * list as we go. This list will be put in the kernel's | 103 | * list as we go. This list will be put in the |
77 | * rtas_firmware_flash_list global var once it is fully read. | 104 | * rtas_firmware_flash_list var once it is fully read. |
78 | * | 105 | * |
79 | * For convenience as we build the list we use virtual addrs, | 106 | * For convenience as we build the list we use virtual addrs, |
80 | * we do not fill in the version number, and the length field | 107 | * we do not fill in the version number, and the length field |
@@ -562,6 +589,86 @@ static int validate_flash_release(struct inode *inode, struct file *file) | |||
562 | return 0; | 589 | return 0; |
563 | } | 590 | } |
564 | 591 | ||
592 | static void rtas_flash_firmware(int reboot_type) | ||
593 | { | ||
594 | unsigned long image_size; | ||
595 | struct flash_block_list *f, *next, *flist; | ||
596 | unsigned long rtas_block_list; | ||
597 | int i, status, update_token; | ||
598 | |||
599 | if (rtas_firmware_flash_list.next == NULL) | ||
600 | return; /* nothing to do */ | ||
601 | |||
602 | if (reboot_type != SYS_RESTART) { | ||
603 | printk(KERN_ALERT "FLASH: firmware flash requires a reboot\n"); | ||
604 | printk(KERN_ALERT "FLASH: the firmware image will NOT be flashed\n"); | ||
605 | return; | ||
606 | } | ||
607 | |||
608 | update_token = rtas_token("ibm,update-flash-64-and-reboot"); | ||
609 | if (update_token == RTAS_UNKNOWN_SERVICE) { | ||
610 | printk(KERN_ALERT "FLASH: ibm,update-flash-64-and-reboot " | ||
611 | "is not available -- not a service partition?\n"); | ||
612 | printk(KERN_ALERT "FLASH: firmware will not be flashed\n"); | ||
613 | return; | ||
614 | } | ||
615 | |||
616 | /* NOTE: the "first" block list is a global var with no data | ||
617 | * blocks in the kernel data segment. We do this because | ||
618 | * we want to ensure this block_list addr is under 4GB. | ||
619 | */ | ||
620 | rtas_firmware_flash_list.num_blocks = 0; | ||
621 | flist = (struct flash_block_list *)&rtas_firmware_flash_list; | ||
622 | rtas_block_list = virt_to_abs(flist); | ||
623 | if (rtas_block_list >= 4UL*1024*1024*1024) { | ||
624 | printk(KERN_ALERT "FLASH: kernel bug...flash list header addr above 4GB\n"); | ||
625 | return; | ||
626 | } | ||
627 | |||
628 | printk(KERN_ALERT "FLASH: preparing saved firmware image for flash\n"); | ||
629 | /* Update the block_list in place. */ | ||
630 | image_size = 0; | ||
631 | for (f = flist; f; f = next) { | ||
632 | /* Translate data addrs to absolute */ | ||
633 | for (i = 0; i < f->num_blocks; i++) { | ||
634 | f->blocks[i].data = (char *)virt_to_abs(f->blocks[i].data); | ||
635 | image_size += f->blocks[i].length; | ||
636 | } | ||
637 | next = f->next; | ||
638 | /* Don't translate NULL pointer for last entry */ | ||
639 | if (f->next) | ||
640 | f->next = (struct flash_block_list *)virt_to_abs(f->next); | ||
641 | else | ||
642 | f->next = NULL; | ||
643 | /* make num_blocks into the version/length field */ | ||
644 | f->num_blocks = (FLASH_BLOCK_LIST_VERSION << 56) | ((f->num_blocks+1)*16); | ||
645 | } | ||
646 | |||
647 | printk(KERN_ALERT "FLASH: flash image is %ld bytes\n", image_size); | ||
648 | printk(KERN_ALERT "FLASH: performing flash and reboot\n"); | ||
649 | rtas_progress("Flashing \n", 0x0); | ||
650 | rtas_progress("Please Wait... ", 0x0); | ||
651 | printk(KERN_ALERT "FLASH: this will take several minutes. Do not power off!\n"); | ||
652 | status = rtas_call(update_token, 1, 1, NULL, rtas_block_list); | ||
653 | switch (status) { /* should only get "bad" status */ | ||
654 | case 0: | ||
655 | printk(KERN_ALERT "FLASH: success\n"); | ||
656 | break; | ||
657 | case -1: | ||
658 | printk(KERN_ALERT "FLASH: hardware error. Firmware may not be not flashed\n"); | ||
659 | break; | ||
660 | case -3: | ||
661 | printk(KERN_ALERT "FLASH: image is corrupt or not correct for this platform. Firmware not flashed\n"); | ||
662 | break; | ||
663 | case -4: | ||
664 | printk(KERN_ALERT "FLASH: flash failed when partially complete. System may not reboot\n"); | ||
665 | break; | ||
666 | default: | ||
667 | printk(KERN_ALERT "FLASH: unknown flash return code %d\n", status); | ||
668 | break; | ||
669 | } | ||
670 | } | ||
671 | |||
565 | static void remove_flash_pde(struct proc_dir_entry *dp) | 672 | static void remove_flash_pde(struct proc_dir_entry *dp) |
566 | { | 673 | { |
567 | if (dp) { | 674 | if (dp) { |
@@ -701,6 +808,7 @@ int __init rtas_flash_init(void) | |||
701 | if (rc != 0) | 808 | if (rc != 0) |
702 | goto cleanup; | 809 | goto cleanup; |
703 | 810 | ||
811 | rtas_flash_term_hook = rtas_flash_firmware; | ||
704 | return 0; | 812 | return 0; |
705 | 813 | ||
706 | cleanup: | 814 | cleanup: |
@@ -714,6 +822,7 @@ cleanup: | |||
714 | 822 | ||
715 | void __exit rtas_flash_cleanup(void) | 823 | void __exit rtas_flash_cleanup(void) |
716 | { | 824 | { |
825 | rtas_flash_term_hook = NULL; | ||
717 | remove_flash_pde(firmware_flash_pde); | 826 | remove_flash_pde(firmware_flash_pde); |
718 | remove_flash_pde(firmware_update_pde); | 827 | remove_flash_pde(firmware_update_pde); |
719 | remove_flash_pde(validate_pde); | 828 | remove_flash_pde(validate_pde); |
diff --git a/arch/powerpc/kernel/rtas_fw.c b/arch/powerpc/kernel/rtas_fw.c deleted file mode 100644 index 448922e8af1b..000000000000 --- a/arch/powerpc/kernel/rtas_fw.c +++ /dev/null | |||
@@ -1,136 +0,0 @@ | |||
1 | /* | ||
2 | * | ||
3 | * Procedures for firmware flash updates. | ||
4 | * | ||
5 | * Peter Bergner, IBM March 2001. | ||
6 | * Copyright (C) 2001 IBM. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * as published by the Free Software Foundation; either version | ||
11 | * 2 of the License, or (at your option) any later version. | ||
12 | */ | ||
13 | |||
14 | #include <stdarg.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/types.h> | ||
17 | #include <linux/spinlock.h> | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/init.h> | ||
20 | |||
21 | #include <asm/prom.h> | ||
22 | #include <asm/rtas.h> | ||
23 | #include <asm/semaphore.h> | ||
24 | #include <asm/machdep.h> | ||
25 | #include <asm/page.h> | ||
26 | #include <asm/param.h> | ||
27 | #include <asm/system.h> | ||
28 | #include <asm/abs_addr.h> | ||
29 | #include <asm/udbg.h> | ||
30 | #include <asm/delay.h> | ||
31 | #include <asm/uaccess.h> | ||
32 | #include <asm/systemcfg.h> | ||
33 | |||
34 | struct flash_block_list_header rtas_firmware_flash_list = {0, NULL}; | ||
35 | |||
36 | #define FLASH_BLOCK_LIST_VERSION (1UL) | ||
37 | |||
38 | static void rtas_flash_firmware(void) | ||
39 | { | ||
40 | unsigned long image_size; | ||
41 | struct flash_block_list *f, *next, *flist; | ||
42 | unsigned long rtas_block_list; | ||
43 | int i, status, update_token; | ||
44 | |||
45 | update_token = rtas_token("ibm,update-flash-64-and-reboot"); | ||
46 | if (update_token == RTAS_UNKNOWN_SERVICE) { | ||
47 | printk(KERN_ALERT "FLASH: ibm,update-flash-64-and-reboot is not available -- not a service partition?\n"); | ||
48 | printk(KERN_ALERT "FLASH: firmware will not be flashed\n"); | ||
49 | return; | ||
50 | } | ||
51 | |||
52 | /* NOTE: the "first" block list is a global var with no data | ||
53 | * blocks in the kernel data segment. We do this because | ||
54 | * we want to ensure this block_list addr is under 4GB. | ||
55 | */ | ||
56 | rtas_firmware_flash_list.num_blocks = 0; | ||
57 | flist = (struct flash_block_list *)&rtas_firmware_flash_list; | ||
58 | rtas_block_list = virt_to_abs(flist); | ||
59 | if (rtas_block_list >= 4UL*1024*1024*1024) { | ||
60 | printk(KERN_ALERT "FLASH: kernel bug...flash list header addr above 4GB\n"); | ||
61 | return; | ||
62 | } | ||
63 | |||
64 | printk(KERN_ALERT "FLASH: preparing saved firmware image for flash\n"); | ||
65 | /* Update the block_list in place. */ | ||
66 | image_size = 0; | ||
67 | for (f = flist; f; f = next) { | ||
68 | /* Translate data addrs to absolute */ | ||
69 | for (i = 0; i < f->num_blocks; i++) { | ||
70 | f->blocks[i].data = (char *)virt_to_abs(f->blocks[i].data); | ||
71 | image_size += f->blocks[i].length; | ||
72 | } | ||
73 | next = f->next; | ||
74 | /* Don't translate NULL pointer for last entry */ | ||
75 | if (f->next) | ||
76 | f->next = (struct flash_block_list *)virt_to_abs(f->next); | ||
77 | else | ||
78 | f->next = NULL; | ||
79 | /* make num_blocks into the version/length field */ | ||
80 | f->num_blocks = (FLASH_BLOCK_LIST_VERSION << 56) | ((f->num_blocks+1)*16); | ||
81 | } | ||
82 | |||
83 | printk(KERN_ALERT "FLASH: flash image is %ld bytes\n", image_size); | ||
84 | printk(KERN_ALERT "FLASH: performing flash and reboot\n"); | ||
85 | rtas_progress("Flashing \n", 0x0); | ||
86 | rtas_progress("Please Wait... ", 0x0); | ||
87 | printk(KERN_ALERT "FLASH: this will take several minutes. Do not power off!\n"); | ||
88 | status = rtas_call(update_token, 1, 1, NULL, rtas_block_list); | ||
89 | switch (status) { /* should only get "bad" status */ | ||
90 | case 0: | ||
91 | printk(KERN_ALERT "FLASH: success\n"); | ||
92 | break; | ||
93 | case -1: | ||
94 | printk(KERN_ALERT "FLASH: hardware error. Firmware may not be not flashed\n"); | ||
95 | break; | ||
96 | case -3: | ||
97 | printk(KERN_ALERT "FLASH: image is corrupt or not correct for this platform. Firmware not flashed\n"); | ||
98 | break; | ||
99 | case -4: | ||
100 | printk(KERN_ALERT "FLASH: flash failed when partially complete. System may not reboot\n"); | ||
101 | break; | ||
102 | default: | ||
103 | printk(KERN_ALERT "FLASH: unknown flash return code %d\n", status); | ||
104 | break; | ||
105 | } | ||
106 | } | ||
107 | |||
108 | void rtas_flash_bypass_warning(void) | ||
109 | { | ||
110 | printk(KERN_ALERT "FLASH: firmware flash requires a reboot\n"); | ||
111 | printk(KERN_ALERT "FLASH: the firmware image will NOT be flashed\n"); | ||
112 | } | ||
113 | |||
114 | |||
115 | void rtas_fw_restart(char *cmd) | ||
116 | { | ||
117 | if (rtas_firmware_flash_list.next) | ||
118 | rtas_flash_firmware(); | ||
119 | rtas_restart(cmd); | ||
120 | } | ||
121 | |||
122 | void rtas_fw_power_off(void) | ||
123 | { | ||
124 | if (rtas_firmware_flash_list.next) | ||
125 | rtas_flash_bypass_warning(); | ||
126 | rtas_power_off(); | ||
127 | } | ||
128 | |||
129 | void rtas_fw_halt(void) | ||
130 | { | ||
131 | if (rtas_firmware_flash_list.next) | ||
132 | rtas_flash_bypass_warning(); | ||
133 | rtas_halt(); | ||
134 | } | ||
135 | |||
136 | EXPORT_SYMBOL(rtas_firmware_flash_list); | ||
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig index 2d57f588151d..e3fc3407bb1f 100644 --- a/arch/powerpc/platforms/pseries/Kconfig +++ b/arch/powerpc/platforms/pseries/Kconfig | |||
@@ -21,15 +21,6 @@ config EEH | |||
21 | depends on PPC_PSERIES | 21 | depends on PPC_PSERIES |
22 | default y if !EMBEDDED | 22 | default y if !EMBEDDED |
23 | 23 | ||
24 | config RTAS_PROC | ||
25 | bool "Proc interface to RTAS" | ||
26 | depends on PPC_RTAS | ||
27 | default y | ||
28 | |||
29 | config RTAS_FLASH | ||
30 | tristate "Firmware flash interface" | ||
31 | depends on PPC64 && RTAS_PROC | ||
32 | |||
33 | config SCANLOG | 24 | config SCANLOG |
34 | tristate "Scanlog dump interface" | 25 | tristate "Scanlog dump interface" |
35 | depends on RTAS_PROC && PPC_PSERIES | 26 | depends on RTAS_PROC && PPC_PSERIES |
diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile index 91909a844736..b9938fece781 100644 --- a/arch/powerpc/platforms/pseries/Makefile +++ b/arch/powerpc/platforms/pseries/Makefile | |||
@@ -1,5 +1,5 @@ | |||
1 | obj-y := pci.o lpar.o hvCall.o nvram.o reconfig.o \ | 1 | obj-y := pci.o lpar.o hvCall.o nvram.o reconfig.o \ |
2 | setup.o iommu.o ras.o | 2 | setup.o iommu.o ras.o rtasd.o |
3 | obj-$(CONFIG_SMP) += smp.o | 3 | obj-$(CONFIG_SMP) += smp.o |
4 | obj-$(CONFIG_IBMVIO) += vio.o | 4 | obj-$(CONFIG_IBMVIO) += vio.o |
5 | obj-$(CONFIG_XICS) += xics.o | 5 | obj-$(CONFIG_XICS) += xics.o |
diff --git a/arch/ppc64/kernel/rtasd.c b/arch/powerpc/platforms/pseries/rtasd.c index e26b0420b6dd..e26b0420b6dd 100644 --- a/arch/ppc64/kernel/rtasd.c +++ b/arch/powerpc/platforms/pseries/rtasd.c | |||
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index c0a3d918148a..f73d69143d35 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c | |||
@@ -589,9 +589,9 @@ struct machdep_calls __initdata pSeries_md = { | |||
589 | .pcibios_fixup = pSeries_final_fixup, | 589 | .pcibios_fixup = pSeries_final_fixup, |
590 | .pci_probe_mode = pSeries_pci_probe_mode, | 590 | .pci_probe_mode = pSeries_pci_probe_mode, |
591 | .irq_bus_setup = pSeries_irq_bus_setup, | 591 | .irq_bus_setup = pSeries_irq_bus_setup, |
592 | .restart = rtas_fw_restart, | 592 | .restart = rtas_restart, |
593 | .power_off = rtas_fw_power_off, | 593 | .power_off = rtas_power_off, |
594 | .halt = rtas_fw_halt, | 594 | .halt = rtas_halt, |
595 | .panic = rtas_os_term, | 595 | .panic = rtas_os_term, |
596 | .cpu_die = pSeries_mach_cpu_die, | 596 | .cpu_die = pSeries_mach_cpu_die, |
597 | .get_boot_time = rtas_get_boot_time, | 597 | .get_boot_time = rtas_get_boot_time, |
diff --git a/arch/ppc64/kernel/Makefile b/arch/ppc64/kernel/Makefile index 990df0905c87..74892ad032ba 100644 --- a/arch/ppc64/kernel/Makefile +++ b/arch/ppc64/kernel/Makefile | |||
@@ -29,19 +29,17 @@ ifneq ($(CONFIG_PPC_MERGE),y) | |||
29 | obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o | 29 | obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o |
30 | endif | 30 | endif |
31 | 31 | ||
32 | obj-$(CONFIG_PPC_PSERIES) += rtasd.o udbg_16550.o | 32 | obj-$(CONFIG_PPC_PSERIES) += udbg_16550.o |
33 | 33 | ||
34 | obj-$(CONFIG_KEXEC) += machine_kexec.o | 34 | obj-$(CONFIG_KEXEC) += machine_kexec.o |
35 | obj-$(CONFIG_EEH) += eeh.o | 35 | obj-$(CONFIG_EEH) += eeh.o |
36 | obj-$(CONFIG_PROC_FS) += proc_ppc64.o | 36 | obj-$(CONFIG_PROC_FS) += proc_ppc64.o |
37 | obj-$(CONFIG_RTAS_FLASH) += rtas_flash.o | ||
38 | obj-$(CONFIG_SMP) += smp.o | 37 | obj-$(CONFIG_SMP) += smp.o |
39 | obj-$(CONFIG_MODULES) += module.o | 38 | obj-$(CONFIG_MODULES) += module.o |
40 | ifneq ($(CONFIG_PPC_MERGE),y) | 39 | ifneq ($(CONFIG_PPC_MERGE),y) |
41 | obj-$(CONFIG_MODULES) += ppc_ksyms.o | 40 | obj-$(CONFIG_MODULES) += ppc_ksyms.o |
42 | endif | 41 | endif |
43 | obj-$(CONFIG_PPC_RTAS) += rtas_pci.o | 42 | obj-$(CONFIG_PPC_RTAS) += rtas_pci.o |
44 | obj-$(CONFIG_RTAS_PROC) += rtas-proc.o | ||
45 | obj-$(CONFIG_SCANLOG) += scanlog.o | 43 | obj-$(CONFIG_SCANLOG) += scanlog.o |
46 | obj-$(CONFIG_LPARCFG) += lparcfg.o | 44 | obj-$(CONFIG_LPARCFG) += lparcfg.o |
47 | obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o | 45 | obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o |
diff --git a/include/asm-powerpc/rtas.h b/include/asm-powerpc/rtas.h index d9fd7866927f..d1bb611ea626 100644 --- a/include/asm-powerpc/rtas.h +++ b/include/asm-powerpc/rtas.h | |||
@@ -149,31 +149,11 @@ struct rtas_error_log { | |||
149 | unsigned char buffer[1]; | 149 | unsigned char buffer[1]; |
150 | }; | 150 | }; |
151 | 151 | ||
152 | struct flash_block { | 152 | /* |
153 | char *data; | 153 | * This can be set by the rtas_flash module so that it can get called |
154 | unsigned long length; | 154 | * as the absolutely last thing before the kernel terminates. |
155 | }; | ||
156 | |||
157 | /* This struct is very similar but not identical to | ||
158 | * that needed by the rtas flash update. | ||
159 | * All we need to do for rtas is rewrite num_blocks | ||
160 | * into a version/length and translate the pointers | ||
161 | * to absolute. | ||
162 | */ | 155 | */ |
163 | #define FLASH_BLOCKS_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct flash_block)) | 156 | extern void (*rtas_flash_term_hook)(int); |
164 | struct flash_block_list { | ||
165 | unsigned long num_blocks; | ||
166 | struct flash_block_list *next; | ||
167 | struct flash_block blocks[FLASH_BLOCKS_PER_NODE]; | ||
168 | }; | ||
169 | struct flash_block_list_header { /* just the header of flash_block_list */ | ||
170 | unsigned long num_blocks; | ||
171 | struct flash_block_list *next; | ||
172 | }; | ||
173 | extern struct flash_block_list_header rtas_firmware_flash_list; | ||
174 | void rtas_fw_restart(char *cmd); | ||
175 | void rtas_fw_power_off(void); | ||
176 | void rtas_fw_halt(void); | ||
177 | 157 | ||
178 | extern struct rtas_t rtas; | 158 | extern struct rtas_t rtas; |
179 | 159 | ||