aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorThibaut Varene <varenet@parisc-linux.org>2006-05-04 11:29:32 -0400
committerKyle McMartin <kyle@hera.kernel.org>2006-06-27 19:28:37 -0400
commit9b0703fed7ca1af95d4454f45e2f25733f0afa76 (patch)
tree28a9dff1a9747e4f58fbe25dc99d85c9fa86c54d /arch
parent8ffaeaf42e91930888df09d696a8a6ebe056d0e0 (diff)
[PARISC] Work around machines which do not support chassis warnings
pdc_chassis v0.05: Some machines seems not to implement Chassis warn support. Work around these. Also cleanup a bit of the code. Signed-off-by: Thibaut VARENE <varenet@parisc-linux.org> Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/parisc/kernel/pdc_chassis.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/arch/parisc/kernel/pdc_chassis.c b/arch/parisc/kernel/pdc_chassis.c
index 51e86c0365c1..d47ba1aa8253 100644
--- a/arch/parisc/kernel/pdc_chassis.c
+++ b/arch/parisc/kernel/pdc_chassis.c
@@ -19,6 +19,7 @@
19 * 19 *
20 * TODO: poll chassis warns, trigger (configurable) machine shutdown when 20 * TODO: poll chassis warns, trigger (configurable) machine shutdown when
21 * needed. 21 * needed.
22 * Find out how to get Chassis warnings out of PAT boxes?
22 */ 23 */
23 24
24#undef PDC_CHASSIS_DEBUG 25#undef PDC_CHASSIS_DEBUG
@@ -40,6 +41,7 @@
40#include <asm/pdc.h> 41#include <asm/pdc.h>
41#include <asm/pdcpat.h> 42#include <asm/pdcpat.h>
42 43
44#define PDC_CHASSIS_VER "0.05"
43 45
44#ifdef CONFIG_PDC_CHASSIS 46#ifdef CONFIG_PDC_CHASSIS
45static unsigned int pdc_chassis_enabled __read_mostly = 1; 47static unsigned int pdc_chassis_enabled __read_mostly = 1;
@@ -133,29 +135,20 @@ static struct notifier_block pdc_chassis_reboot_block = {
133void __init parisc_pdc_chassis_init(void) 135void __init parisc_pdc_chassis_init(void)
134{ 136{
135#ifdef CONFIG_PDC_CHASSIS 137#ifdef CONFIG_PDC_CHASSIS
136 int handle = 0;
137 if (likely(pdc_chassis_enabled)) { 138 if (likely(pdc_chassis_enabled)) {
138 DPRINTK(KERN_DEBUG "%s: parisc_pdc_chassis_init()\n", __FILE__); 139 DPRINTK(KERN_DEBUG "%s: parisc_pdc_chassis_init()\n", __FILE__);
139 140
140 /* Let see if we have something to handle... */ 141 /* Let see if we have something to handle... */
141 /* Check for PDC_PAT */ 142 printk(KERN_INFO "Enabling %s chassis codes support v%s\n",
142 if (is_pdc_pat()) { 143 is_pdc_pat() ? "PDC_PAT" : "regular",
143 printk(KERN_INFO "Enabling PDC_PAT chassis codes support.\n"); 144 PDC_CHASSIS_VER);
144 handle = 1; 145
145 } 146 /* initialize panic notifier chain */
146 else { 147 atomic_notifier_chain_register(&panic_notifier_list,
147 printk(KERN_INFO "Enabling regular chassis codes support.\n"); 148 &pdc_chassis_panic_block);
148 handle = 1; 149
149 } 150 /* initialize reboot notifier chain */
150 151 register_reboot_notifier(&pdc_chassis_reboot_block);
151 if (handle) {
152 /* initialize panic notifier chain */
153 atomic_notifier_chain_register(&panic_notifier_list,
154 &pdc_chassis_panic_block);
155
156 /* initialize reboot notifier chain */
157 register_reboot_notifier(&pdc_chassis_reboot_block);
158 }
159 } 152 }
160#endif /* CONFIG_PDC_CHASSIS */ 153#endif /* CONFIG_PDC_CHASSIS */
161} 154}
@@ -285,7 +278,18 @@ static int pdc_chassis_warn_pread(char *page, char **start, off_t off,
285 278
286static int __init pdc_chassis_create_procfs(void) 279static int __init pdc_chassis_create_procfs(void)
287{ 280{
288 printk(KERN_INFO "Enabling PDC chassis warnings support.\n"); 281 unsigned long test;
282 int ret;
283
284 ret = pdc_chassis_warn(&test);
285 if ((ret == PDC_BAD_PROC) || (ret == PDC_BAD_OPTION)) {
286 /* seems that some boxes (eg L1000) do not implement this */
287 printk(KERN_INFO "Chassis warnings not supported.\n");
288 return 0;
289 }
290
291 printk(KERN_INFO "Enabling PDC chassis warnings support v%s\n",
292 PDC_CHASSIS_VER);
289 create_proc_read_entry("chassis", 0400, NULL, pdc_chassis_warn_pread, 293 create_proc_read_entry("chassis", 0400, NULL, pdc_chassis_warn_pread,
290 NULL); 294 NULL);
291 return 0; 295 return 0;