Commit 8ffaeaf42e91930888df09d696a8a6ebe056d0e0

Authored by Thibaut Varene
Committed by Kyle McMartin
1 parent c95f2e5f2f

[PARISC] PDC_CHASSIS is implemented on all machines

This patch removes a limitation of the original code, so that CHASSIS
codes can be sent to all machines. On machines with a LCD panel, this
code displays "INI" during bootup, "RUN" when the system is booted and
running, "FLT" when a panic occurs, etc.

This part of the code can be enabled/disabled through CONFIG_PDC_CHASSIS

This patch also adds minimalistic support for Chassis warnings, through
a proc entry '/proc/chassis', which will reflect the warnings status (PSU
or fans failure when they happen, NVRAM battery level and temperature
thresholds overflows).

This part of the code can be enabled/disabled through CONFIG_PDC_CHASSIS_WARN

Signed-off-by: Thibaut VARENE <varenet@parisc-linux.org>
Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>

Showing 4 changed files with 107 additions and 22 deletions Side-by-side Diff

arch/parisc/kernel/firmware.c
... ... @@ -11,7 +11,7 @@
11 11 * Copyright 1999 The Puffin Group, (Alex deVries, David Kennedy)
12 12 * Copyright 2003 Grant Grundler <grundler parisc-linux org>
13 13 * Copyright 2003,2004 Ryan Bradetich <rbrad@parisc-linux.org>
14   - * Copyright 2004 Thibaut VARENE <varenet@parisc-linux.org>
  14 + * Copyright 2004,2006 Thibaut VARENE <varenet@parisc-linux.org>
15 15 *
16 16 * This program is free software; you can redistribute it and/or modify
17 17 * it under the terms of the GNU General Public License as published by
18 18  
... ... @@ -252,10 +252,8 @@
252 252 #endif
253 253  
254 254 /**
255   - * pdc_chassis_disp - Updates display
  255 + * pdc_chassis_disp - Updates chassis code
256 256 * @retval: -1 on error, 0 on success
257   - *
258   - * Works on old PDC only (E class, others?)
259 257 */
260 258 int pdc_chassis_disp(unsigned long disp)
261 259 {
... ... @@ -263,6 +261,22 @@
263 261  
264 262 spin_lock_irq(&pdc_lock);
265 263 retval = mem_pdc_call(PDC_CHASSIS, PDC_CHASSIS_DISP, disp);
  264 + spin_unlock_irq(&pdc_lock);
  265 +
  266 + return retval;
  267 +}
  268 +
  269 +/**
  270 + * pdc_chassis_warn - Fetches chassis warnings
  271 + * @retval: -1 on error, 0 on success
  272 + */
  273 +int pdc_chassis_warn(unsigned long *warn)
  274 +{
  275 + int retval = 0;
  276 +
  277 + spin_lock_irq(&pdc_lock);
  278 + retval = mem_pdc_call(PDC_CHASSIS, PDC_CHASSIS_WARN, __pa(pdc_result));
  279 + *warn = pdc_result[0];
266 280 spin_unlock_irq(&pdc_lock);
267 281  
268 282 return retval;
arch/parisc/kernel/pdc_chassis.c
1 1 /*
2   - * interfaces to log Chassis Codes via PDC (firmware)
  2 + * interfaces to Chassis Codes via PDC (firmware)
3 3 *
4 4 * Copyright (C) 2002 Laurent Canet <canetl@esiee.fr>
5   - * Copyright (C) 2002-2004 Thibaut VARENE <varenet@parisc-linux.org>
  5 + * Copyright (C) 2002-2006 Thibaut VARENE <varenet@parisc-linux.org>
6 6 *
7 7 * This program is free software; you can redistribute it and/or modify
8 8 * it under the terms of the GNU General Public License, version 2, as
... ... @@ -16,6 +16,9 @@
16 16 * You should have received a copy of the GNU General Public License
17 17 * along with this program; if not, write to the Free Software
18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19 + *
  20 + * TODO: poll chassis warns, trigger (configurable) machine shutdown when
  21 + * needed.
19 22 */
20 23  
21 24 #undef PDC_CHASSIS_DEBUG
... ... @@ -30,6 +33,7 @@
30 33 #include <linux/reboot.h>
31 34 #include <linux/notifier.h>
32 35 #include <linux/cache.h>
  36 +#include <linux/proc_fs.h>
33 37  
34 38 #include <asm/pdc_chassis.h>
35 39 #include <asm/processor.h>
... ... @@ -38,7 +42,6 @@
38 42  
39 43  
40 44 #ifdef CONFIG_PDC_CHASSIS
41   -static int pdc_chassis_old __read_mostly = 0;
42 45 static unsigned int pdc_chassis_enabled __read_mostly = 1;
43 46  
44 47  
... ... @@ -64,7 +67,7 @@
64 67 * Currently, only E class and A180 are known to work with this.
65 68 * Inspired by Christoph Plattner
66 69 */
67   -
  70 +#if 0
68 71 static void __init pdc_chassis_checkold(void)
69 72 {
70 73 switch(CPU_HVERSION) {
... ... @@ -73,7 +76,6 @@
73 76 case 0x482: /* E45 */
74 77 case 0x483: /* E55 */
75 78 case 0x516: /* A180 */
76   - pdc_chassis_old = 1;
77 79 break;
78 80  
79 81 default:
80 82  
... ... @@ -81,8 +83,8 @@
81 83 }
82 84 DPRINTK(KERN_DEBUG "%s: pdc_chassis_checkold(); pdc_chassis_old = %d\n", __FILE__, pdc_chassis_old);
83 85 }
  86 +#endif
84 87  
85   -
86 88 /**
87 89 * pdc_chassis_panic_event() - Called by the panic handler.
88 90 *
89 91  
... ... @@ -136,14 +138,13 @@
136 138 DPRINTK(KERN_DEBUG "%s: parisc_pdc_chassis_init()\n", __FILE__);
137 139  
138 140 /* Let see if we have something to handle... */
139   - /* Check for PDC_PAT or old LED Panel */
140   - pdc_chassis_checkold();
  141 + /* Check for PDC_PAT */
141 142 if (is_pdc_pat()) {
142 143 printk(KERN_INFO "Enabling PDC_PAT chassis codes support.\n");
143 144 handle = 1;
144 145 }
145   - else if (unlikely(pdc_chassis_old)) {
146   - printk(KERN_INFO "Enabling old style chassis LED panel support.\n");
  146 + else {
  147 + printk(KERN_INFO "Enabling regular chassis codes support.\n");
147 148 handle = 1;
148 149 }
149 150  
150 151  
... ... @@ -215,9 +216,12 @@
215 216 }
216 217 } else retval = -1;
217 218 #else
218   - if (unlikely(pdc_chassis_old)) {
  219 + if (1) {
219 220 switch (message) {
220 221 case PDC_CHASSIS_DIRECT_BSTART:
  222 + retval = pdc_chassis_disp(PDC_CHASSIS_DISP_DATA(OSTAT_INIT));
  223 + break;
  224 +
221 225 case PDC_CHASSIS_DIRECT_BCOMPLETE:
222 226 retval = pdc_chassis_disp(PDC_CHASSIS_DISP_DATA(OSTAT_RUN));
223 227 break;
... ... @@ -244,4 +248,51 @@
244 248 #endif /* CONFIG_PDC_CHASSIS */
245 249 return retval;
246 250 }
  251 +
  252 +#ifdef CONFIG_PDC_CHASSIS_WARN
  253 +#ifdef CONFIG_PROC_FS
  254 +static int pdc_chassis_warn_pread(char *page, char **start, off_t off,
  255 + int count, int *eof, void *data)
  256 +{
  257 + char *out = page;
  258 + int len, ret;
  259 + unsigned long warn;
  260 + u32 warnreg;
  261 +
  262 + ret = pdc_chassis_warn(&warn);
  263 + if (ret != PDC_OK)
  264 + return -EIO;
  265 +
  266 + warnreg = (warn & 0xFFFFFFFF);
  267 +
  268 + if ((warnreg >> 24) & 0xFF)
  269 + out += sprintf(out, "Chassis component failure! (eg fan or PSU): 0x%.2x\n", ((warnreg >> 24) & 0xFF));
  270 +
  271 + out += sprintf(out, "Battery: %s\n", (warnreg & 0x04) ? "Low!" : "OK");
  272 + out += sprintf(out, "Temp low: %s\n", (warnreg & 0x02) ? "Exceeded!" : "OK");
  273 + out += sprintf(out, "Temp mid: %s\n", (warnreg & 0x01) ? "Exceeded!" : "OK");
  274 +
  275 + len = out - page - off;
  276 + if (len < count) {
  277 + *eof = 1;
  278 + if (len <= 0) return 0;
  279 + } else {
  280 + len = count;
  281 + }
  282 + *start = page + off;
  283 + return len;
  284 +}
  285 +
  286 +static int __init pdc_chassis_create_procfs(void)
  287 +{
  288 + printk(KERN_INFO "Enabling PDC chassis warnings support.\n");
  289 + create_proc_read_entry("chassis", 0400, NULL, pdc_chassis_warn_pread,
  290 + NULL);
  291 + return 0;
  292 +}
  293 +
  294 +__initcall(pdc_chassis_create_procfs);
  295 +
  296 +#endif /* CONFIG_PROC_FS */
  297 +#endif /* CONFIG_PDC_CHASSIS_WARN */
drivers/parisc/Kconfig
... ... @@ -140,17 +140,36 @@
140 140 If unsure, say Y.
141 141  
142 142 config PDC_CHASSIS
143   - bool "PDC chassis State Panel support"
  143 + bool "PDC chassis state codes support"
144 144 default y
145 145 help
146   - Say Y here if you want to enable support for the LED State front
147   - panel as found on E class, and support for the GSP Virtual Front
148   - Panel (LED State and message logging) as found on high end
149   - servers such as A, L and N-class.
  146 + Say Y here if you want to enable support for Chassis codes.
  147 + That includes support for LED State front panel as found on E
  148 + class, and support for the GSP Virtual Front Panel (LED State and
  149 + message logging) as found on high end servers such as A, L and
  150 + N-class.
  151 + This driver will also display progress messages on LCD display,
  152 + such as "INI", "RUN" and "FLT", and might thus clobber messages
  153 + shown by the LED/LCD driver.
  154 + This driver updates the state panel (LED and/or LCD) upon system
  155 + state change (eg: boot, shutdown or panic).
150 156  
151   - This has nothing to do with Chassis LCD and LED support.
152   -
153 157 If unsure, say Y.
  158 +
  159 +
  160 +config PDC_CHASSIS_WARN
  161 + bool "PDC chassis warnings support"
  162 + depends on PROC_FS
  163 + default y
  164 + help
  165 + Say Y here if you want to enable support for Chassis warnings.
  166 + This will add a proc entry '/proc/chassis' giving some information
  167 + about the overall health state of the system.
  168 + This includes NVRAM battery level, overtemp or failures such as
  169 + fans or power units.
  170 +
  171 + If unsure, say Y.
  172 +
154 173  
155 174 config PDC_STABLE
156 175 tristate "PDC Stable Storage support"
include/asm-parisc/pdc.h
... ... @@ -719,6 +719,7 @@
719 719 int pdc_add_valid(unsigned long address);
720 720 int pdc_chassis_info(struct pdc_chassis_info *chassis_info, void *led_info, unsigned long len);
721 721 int pdc_chassis_disp(unsigned long disp);
  722 +int pdc_chassis_warn(unsigned long *warn);
722 723 int pdc_coproc_cfg(struct pdc_coproc_cfg *pdc_coproc_info);
723 724 int pdc_iodc_read(unsigned long *actcnt, unsigned long hpa, unsigned int index,
724 725 void *iodc_data, unsigned int iodc_data_size);