Linux 2.6.26-rc5
[linux-2.6/openmoko-kernel/knife-kernel.git] / include / asm-parisc / pdc_chassis.h
bloba609273dc6bf26c8538a79afd2e7b11292a02e2c
1 /*
2 * include/asm-parisc/pdc_chassis.h
4 * Copyright (C) 2002 Laurent Canet <canetl@esiee.fr>
5 * Copyright (C) 2002 Thibaut Varene <varenet@parisc-linux.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License, version 2, as
10 * published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * TODO: - handle processor number on SMP systems (Reporting Entity ID)
22 * - handle message ID
23 * - handle timestamps
27 #ifndef _PARISC_PDC_CHASSIS_H
28 #define _PARISC_PDC_CHASSIS_H
31 * ----------
32 * Prototypes
33 * ----------
36 int pdc_chassis_send_status(int message);
37 void parisc_pdc_chassis_init(void);
41 * -----------------
42 * Direct call names
43 * -----------------
44 * They setup everything for you, the Log message and the corresponding LED state
47 #define PDC_CHASSIS_DIRECT_BSTART 0
48 #define PDC_CHASSIS_DIRECT_BCOMPLETE 1
49 #define PDC_CHASSIS_DIRECT_SHUTDOWN 2
50 #define PDC_CHASSIS_DIRECT_PANIC 3
51 #define PDC_CHASSIS_DIRECT_HPMC 4
52 #define PDC_CHASSIS_DIRECT_LPMC 5
53 #define PDC_CHASSIS_DIRECT_DUMP 6 /* not yet implemented */
54 #define PDC_CHASSIS_DIRECT_OOPS 7 /* not yet implemented */
58 * ------------
59 * LEDs control
60 * ------------
61 * Set the three LEDs -- Run, Attn, and Fault.
64 /* Old PDC LED control */
65 #define PDC_CHASSIS_DISP_DATA(v) ((unsigned long)(v) << 17)
67 /*
68 * Available PDC PAT LED states
71 #define PDC_CHASSIS_LED_RUN_OFF (0ULL << 4)
72 #define PDC_CHASSIS_LED_RUN_FLASH (1ULL << 4)
73 #define PDC_CHASSIS_LED_RUN_ON (2ULL << 4)
74 #define PDC_CHASSIS_LED_RUN_NC (3ULL << 4)
75 #define PDC_CHASSIS_LED_ATTN_OFF (0ULL << 6)
76 #define PDC_CHASSIS_LED_ATTN_FLASH (1ULL << 6)
77 #define PDC_CHASSIS_LED_ATTN_NC (3ULL << 6) /* ATTN ON is invalid */
78 #define PDC_CHASSIS_LED_FAULT_OFF (0ULL << 8)
79 #define PDC_CHASSIS_LED_FAULT_FLASH (1ULL << 8)
80 #define PDC_CHASSIS_LED_FAULT_ON (2ULL << 8)
81 #define PDC_CHASSIS_LED_FAULT_NC (3ULL << 8)
82 #define PDC_CHASSIS_LED_VALID (1ULL << 10)
84 /*
85 * Valid PDC PAT LED states combinations
88 /* System running normally */
89 #define PDC_CHASSIS_LSTATE_RUN_NORMAL (PDC_CHASSIS_LED_RUN_ON | \
90 PDC_CHASSIS_LED_ATTN_OFF | \
91 PDC_CHASSIS_LED_FAULT_OFF | \
92 PDC_CHASSIS_LED_VALID )
93 /* System crashed and rebooted itself successfully */
94 #define PDC_CHASSIS_LSTATE_RUN_CRASHREC (PDC_CHASSIS_LED_RUN_ON | \
95 PDC_CHASSIS_LED_ATTN_OFF | \
96 PDC_CHASSIS_LED_FAULT_FLASH | \
97 PDC_CHASSIS_LED_VALID )
98 /* There was a system interruption that did not take the system down */
99 #define PDC_CHASSIS_LSTATE_RUN_SYSINT (PDC_CHASSIS_LED_RUN_ON | \
100 PDC_CHASSIS_LED_ATTN_FLASH | \
101 PDC_CHASSIS_LED_FAULT_OFF | \
102 PDC_CHASSIS_LED_VALID )
103 /* System running and unexpected reboot or non-critical error detected */
104 #define PDC_CHASSIS_LSTATE_RUN_NCRIT (PDC_CHASSIS_LED_RUN_ON | \
105 PDC_CHASSIS_LED_ATTN_FLASH | \
106 PDC_CHASSIS_LED_FAULT_FLASH | \
107 PDC_CHASSIS_LED_VALID )
108 /* Executing non-OS code */
109 #define PDC_CHASSIS_LSTATE_NONOS (PDC_CHASSIS_LED_RUN_FLASH | \
110 PDC_CHASSIS_LED_ATTN_OFF | \
111 PDC_CHASSIS_LED_FAULT_OFF | \
112 PDC_CHASSIS_LED_VALID )
113 /* Boot failed - Executing non-OS code */
114 #define PDC_CHASSIS_LSTATE_NONOS_BFAIL (PDC_CHASSIS_LED_RUN_FLASH | \
115 PDC_CHASSIS_LED_ATTN_OFF | \
116 PDC_CHASSIS_LED_FAULT_ON | \
117 PDC_CHASSIS_LED_VALID )
118 /* Unexpected reboot occurred - Executing non-OS code */
119 #define PDC_CHASSIS_LSTATE_NONOS_UNEXP (PDC_CHASSIS_LED_RUN_FLASH | \
120 PDC_CHASSIS_LED_ATTN_OFF | \
121 PDC_CHASSIS_LED_FAULT_FLASH | \
122 PDC_CHASSIS_LED_VALID )
123 /* Executing non-OS code - Non-critical error detected */
124 #define PDC_CHASSIS_LSTATE_NONOS_NCRIT (PDC_CHASSIS_LED_RUN_FLASH | \
125 PDC_CHASSIS_LED_ATTN_FLASH | \
126 PDC_CHASSIS_LED_FAULT_OFF | \
127 PDC_CHASSIS_LED_VALID )
128 /* Boot failed - Executing non-OS code - Non-critical error detected */
129 #define PDC_CHASSIS_LSTATE_BFAIL_NCRIT (PDC_CHASSIS_LED_RUN_FLASH | \
130 PDC_CHASSIS_LED_ATTN_FLASH | \
131 PDC_CHASSIS_LED_FAULT_ON | \
132 PDC_CHASSIS_LED_VALID )
133 /* Unexpected reboot/recovering - Executing non-OS code - Non-critical error detected */
134 #define PDC_CHASSIS_LSTATE_UNEXP_NCRIT (PDC_CHASSIS_LED_RUN_FLASH | \
135 PDC_CHASSIS_LED_ATTN_FLASH | \
136 PDC_CHASSIS_LED_FAULT_FLASH | \
137 PDC_CHASSIS_LED_VALID )
138 /* Cannot execute PDC */
139 #define PDC_CHASSIS_LSTATE_CANNOT_PDC (PDC_CHASSIS_LED_RUN_OFF | \
140 PDC_CHASSIS_LED_ATTN_OFF | \
141 PDC_CHASSIS_LED_FAULT_OFF | \
142 PDC_CHASSIS_LED_VALID )
143 /* Boot failed - OS not up - PDC has detected a failure that prevents boot */
144 #define PDC_CHASSIS_LSTATE_FATAL_BFAIL (PDC_CHASSIS_LED_RUN_OFF | \
145 PDC_CHASSIS_LED_ATTN_OFF | \
146 PDC_CHASSIS_LED_FAULT_ON | \
147 PDC_CHASSIS_LED_VALID )
148 /* No code running - Non-critical error detected (double fault situation) */
149 #define PDC_CHASSIS_LSTATE_NOCODE_NCRIT (PDC_CHASSIS_LED_RUN_OFF | \
150 PDC_CHASSIS_LED_ATTN_FLASH | \
151 PDC_CHASSIS_LED_FAULT_OFF | \
152 PDC_CHASSIS_LED_VALID )
153 /* Boot failed - OS not up - Fatal failure detected - Non-critical error detected */
154 #define PDC_CHASSIS_LSTATE_FATAL_NCRIT (PDC_CHASSIS_LED_RUN_OFF | \
155 PDC_CHASSIS_LED_ATTN_FLASH | \
156 PDC_CHASSIS_LED_FAULT_ON | \
157 PDC_CHASSIS_LED_VALID )
158 /* All other states are invalid */
162 * --------------
163 * PDC Log events
164 * --------------
165 * Here follows bits needed to fill up the log event sent to PDC_CHASSIS
166 * The log message contains: Alert level, Source, Source detail,
167 * Source ID, Problem detail, Caller activity, Activity status,
168 * Caller subactivity, Reporting entity type, Reporting entity ID,
169 * Data type, Unique message ID and EOM.
172 /* Alert level */
173 #define PDC_CHASSIS_ALERT_FORWARD (0ULL << 36) /* no failure detected */
174 #define PDC_CHASSIS_ALERT_SERPROC (1ULL << 36) /* service proc - no failure */
175 #define PDC_CHASSIS_ALERT_NURGENT (2ULL << 36) /* non-urgent operator attn */
176 #define PDC_CHASSIS_ALERT_BLOCKED (3ULL << 36) /* system blocked */
177 #define PDC_CHASSIS_ALERT_CONF_CHG (4ULL << 36) /* unexpected configuration change */
178 #define PDC_CHASSIS_ALERT_ENV_PB (5ULL << 36) /* boot possible, environmental pb */
179 #define PDC_CHASSIS_ALERT_PENDING (6ULL << 36) /* boot possible, pending failure */
180 #define PDC_CHASSIS_ALERT_PERF_IMP (8ULL << 36) /* boot possible, performance impaired */
181 #define PDC_CHASSIS_ALERT_FUNC_IMP (10ULL << 36) /* boot possible, functionality impaired */
182 #define PDC_CHASSIS_ALERT_SOFT_FAIL (12ULL << 36) /* software failure */
183 #define PDC_CHASSIS_ALERT_HANG (13ULL << 36) /* system hang */
184 #define PDC_CHASSIS_ALERT_ENV_FATAL (14ULL << 36) /* fatal power or environmental pb */
185 #define PDC_CHASSIS_ALERT_HW_FATAL (15ULL << 36) /* fatal hardware problem */
187 /* Source */
188 #define PDC_CHASSIS_SRC_NONE (0ULL << 28) /* unknown, no source stated */
189 #define PDC_CHASSIS_SRC_PROC (1ULL << 28) /* processor */
190 /* For later use ? */
191 #define PDC_CHASSIS_SRC_PROC_CACHE (2ULL << 28) /* processor cache*/
192 #define PDC_CHASSIS_SRC_PDH (3ULL << 28) /* processor dependent hardware */
193 #define PDC_CHASSIS_SRC_PWR (4ULL << 28) /* power */
194 #define PDC_CHASSIS_SRC_FAB (5ULL << 28) /* fabric connector */
195 #define PDC_CHASSIS_SRC_PLATi (6ULL << 28) /* platform */
196 #define PDC_CHASSIS_SRC_MEM (7ULL << 28) /* memory */
197 #define PDC_CHASSIS_SRC_IO (8ULL << 28) /* I/O */
198 #define PDC_CHASSIS_SRC_CELL (9ULL << 28) /* cell */
199 #define PDC_CHASSIS_SRC_PD (10ULL << 28) /* protected domain */
201 /* Source detail field */
202 #define PDC_CHASSIS_SRC_D_PROC (1ULL << 24) /* processor general */
204 /* Source ID - platform dependent */
205 #define PDC_CHASSIS_SRC_ID_UNSPEC (0ULL << 16)
207 /* Problem detail - problem source dependent */
208 #define PDC_CHASSIS_PB_D_PROC_NONE (0ULL << 32) /* no problem detail */
209 #define PDC_CHASSIS_PB_D_PROC_TIMEOUT (4ULL << 32) /* timeout */
211 /* Caller activity */
212 #define PDC_CHASSIS_CALL_ACT_HPUX_BL (7ULL << 12) /* Boot Loader */
213 #define PDC_CHASSIS_CALL_ACT_HPUX_PD (8ULL << 12) /* SAL_PD activities */
214 #define PDC_CHASSIS_CALL_ACT_HPUX_EVENT (9ULL << 12) /* SAL_EVENTS activities */
215 #define PDC_CHASSIS_CALL_ACT_HPUX_IO (10ULL << 12) /* SAL_IO activities */
216 #define PDC_CHASSIS_CALL_ACT_HPUX_PANIC (11ULL << 12) /* System panic */
217 #define PDC_CHASSIS_CALL_ACT_HPUX_INIT (12ULL << 12) /* System initialization */
218 #define PDC_CHASSIS_CALL_ACT_HPUX_SHUT (13ULL << 12) /* System shutdown */
219 #define PDC_CHASSIS_CALL_ACT_HPUX_WARN (14ULL << 12) /* System warning */
220 #define PDC_CHASSIS_CALL_ACT_HPUX_DU (15ULL << 12) /* Display_Activity() update */
222 /* Activity status - implementation dependent */
223 #define PDC_CHASSIS_ACT_STATUS_UNSPEC (0ULL << 0)
225 /* Caller subactivity - implementation dependent */
226 /* FIXME: other subactivities ? */
227 #define PDC_CHASSIS_CALL_SACT_UNSPEC (0ULL << 4) /* implementation dependent */
229 /* Reporting entity type */
230 #define PDC_CHASSIS_RET_GENERICOS (12ULL << 52) /* generic OSes */
231 #define PDC_CHASSIS_RET_IA64_NT (13ULL << 52) /* IA-64 NT */
232 #define PDC_CHASSIS_RET_HPUX (14ULL << 52) /* HP-UX */
233 #define PDC_CHASSIS_RET_DIAG (15ULL << 52) /* offline diagnostics & utilities */
235 /* Reporting entity ID */
236 #define PDC_CHASSIS_REID_UNSPEC (0ULL << 44)
238 /* Data type */
239 #define PDC_CHASSIS_DT_NONE (0ULL << 59) /* data field unused */
240 /* For later use ? Do we need these ? */
241 #define PDC_CHASSIS_DT_PHYS_ADDR (1ULL << 59) /* physical address */
242 #define PDC_CHASSIS_DT_DATA_EXPECT (2ULL << 59) /* expected data */
243 #define PDC_CHASSIS_DT_ACTUAL (3ULL << 59) /* actual data */
244 #define PDC_CHASSIS_DT_PHYS_LOC (4ULL << 59) /* physical location */
245 #define PDC_CHASSIS_DT_PHYS_LOC_EXT (5ULL << 59) /* physical location extension */
246 #define PDC_CHASSIS_DT_TAG (6ULL << 59) /* tag */
247 #define PDC_CHASSIS_DT_SYNDROME (7ULL << 59) /* syndrome */
248 #define PDC_CHASSIS_DT_CODE_ADDR (8ULL << 59) /* code address */
249 #define PDC_CHASSIS_DT_ASCII_MSG (9ULL << 59) /* ascii message */
250 #define PDC_CHASSIS_DT_POST (10ULL << 59) /* POST code */
251 #define PDC_CHASSIS_DT_TIMESTAMP (11ULL << 59) /* timestamp */
252 #define PDC_CHASSIS_DT_DEV_STAT (12ULL << 59) /* device status */
253 #define PDC_CHASSIS_DT_DEV_TYPE (13ULL << 59) /* device type */
254 #define PDC_CHASSIS_DT_PB_DET (14ULL << 59) /* problem detail */
255 #define PDC_CHASSIS_DT_ACT_LEV (15ULL << 59) /* activity level/timeout */
256 #define PDC_CHASSIS_DT_SER_NUM (16ULL << 59) /* serial number */
257 #define PDC_CHASSIS_DT_REV_NUM (17ULL << 59) /* revision number */
258 #define PDC_CHASSIS_DT_INTERRUPT (18ULL << 59) /* interruption information */
259 #define PDC_CHASSIS_DT_TEST_NUM (19ULL << 59) /* test number */
260 #define PDC_CHASSIS_DT_STATE_CHG (20ULL << 59) /* major changes in system state */
261 #define PDC_CHASSIS_DT_PROC_DEALLOC (21ULL << 59) /* processor deallocate */
262 #define PDC_CHASSIS_DT_RESET (30ULL << 59) /* reset type and cause */
263 #define PDC_CHASSIS_DT_PA_LEGACY (31ULL << 59) /* legacy PA hex chassis code */
265 /* System states - part of major changes in system state data field */
266 #define PDC_CHASSIS_SYSTATE_BSTART (0ULL << 0) /* boot start */
267 #define PDC_CHASSIS_SYSTATE_BCOMP (1ULL << 0) /* boot complete */
268 #define PDC_CHASSIS_SYSTATE_CHANGE (2ULL << 0) /* major change */
269 #define PDC_CHASSIS_SYSTATE_LED (3ULL << 0) /* LED change */
270 #define PDC_CHASSIS_SYSTATE_PANIC (9ULL << 0) /* OS Panic */
271 #define PDC_CHASSIS_SYSTATE_DUMP (10ULL << 0) /* memory dump */
272 #define PDC_CHASSIS_SYSTATE_HPMC (11ULL << 0) /* processing HPMC */
273 #define PDC_CHASSIS_SYSTATE_HALT (15ULL << 0) /* system halted */
275 /* Message ID */
276 #define PDC_CHASSIS_MSG_ID (0ULL << 40) /* we do not handle msg IDs atm */
278 /* EOM - separates log entries */
279 #define PDC_CHASSIS_EOM_CLEAR (0ULL << 43)
280 #define PDC_CHASSIS_EOM_SET (1ULL << 43)
283 * Preformated well known messages
286 /* Boot started */
287 #define PDC_CHASSIS_PMSG_BSTART (PDC_CHASSIS_ALERT_SERPROC | \
288 PDC_CHASSIS_SRC_PROC | \
289 PDC_CHASSIS_SRC_D_PROC | \
290 PDC_CHASSIS_SRC_ID_UNSPEC | \
291 PDC_CHASSIS_PB_D_PROC_NONE | \
292 PDC_CHASSIS_CALL_ACT_HPUX_INIT | \
293 PDC_CHASSIS_ACT_STATUS_UNSPEC | \
294 PDC_CHASSIS_CALL_SACT_UNSPEC | \
295 PDC_CHASSIS_RET_HPUX | \
296 PDC_CHASSIS_REID_UNSPEC | \
297 PDC_CHASSIS_DT_STATE_CHG | \
298 PDC_CHASSIS_SYSTATE_BSTART | \
299 PDC_CHASSIS_MSG_ID | \
300 PDC_CHASSIS_EOM_SET )
302 /* Boot complete */
303 #define PDC_CHASSIS_PMSG_BCOMPLETE (PDC_CHASSIS_ALERT_SERPROC | \
304 PDC_CHASSIS_SRC_PROC | \
305 PDC_CHASSIS_SRC_D_PROC | \
306 PDC_CHASSIS_SRC_ID_UNSPEC | \
307 PDC_CHASSIS_PB_D_PROC_NONE | \
308 PDC_CHASSIS_CALL_ACT_HPUX_INIT | \
309 PDC_CHASSIS_ACT_STATUS_UNSPEC | \
310 PDC_CHASSIS_CALL_SACT_UNSPEC | \
311 PDC_CHASSIS_RET_HPUX | \
312 PDC_CHASSIS_REID_UNSPEC | \
313 PDC_CHASSIS_DT_STATE_CHG | \
314 PDC_CHASSIS_SYSTATE_BCOMP | \
315 PDC_CHASSIS_MSG_ID | \
316 PDC_CHASSIS_EOM_SET )
318 /* Shutdown */
319 #define PDC_CHASSIS_PMSG_SHUTDOWN (PDC_CHASSIS_ALERT_SERPROC | \
320 PDC_CHASSIS_SRC_PROC | \
321 PDC_CHASSIS_SRC_D_PROC | \
322 PDC_CHASSIS_SRC_ID_UNSPEC | \
323 PDC_CHASSIS_PB_D_PROC_NONE | \
324 PDC_CHASSIS_CALL_ACT_HPUX_SHUT | \
325 PDC_CHASSIS_ACT_STATUS_UNSPEC | \
326 PDC_CHASSIS_CALL_SACT_UNSPEC | \
327 PDC_CHASSIS_RET_HPUX | \
328 PDC_CHASSIS_REID_UNSPEC | \
329 PDC_CHASSIS_DT_STATE_CHG | \
330 PDC_CHASSIS_SYSTATE_HALT | \
331 PDC_CHASSIS_MSG_ID | \
332 PDC_CHASSIS_EOM_SET )
334 /* Panic */
335 #define PDC_CHASSIS_PMSG_PANIC (PDC_CHASSIS_ALERT_SOFT_FAIL | \
336 PDC_CHASSIS_SRC_PROC | \
337 PDC_CHASSIS_SRC_D_PROC | \
338 PDC_CHASSIS_SRC_ID_UNSPEC | \
339 PDC_CHASSIS_PB_D_PROC_NONE | \
340 PDC_CHASSIS_CALL_ACT_HPUX_PANIC| \
341 PDC_CHASSIS_ACT_STATUS_UNSPEC | \
342 PDC_CHASSIS_CALL_SACT_UNSPEC | \
343 PDC_CHASSIS_RET_HPUX | \
344 PDC_CHASSIS_REID_UNSPEC | \
345 PDC_CHASSIS_DT_STATE_CHG | \
346 PDC_CHASSIS_SYSTATE_PANIC | \
347 PDC_CHASSIS_MSG_ID | \
348 PDC_CHASSIS_EOM_SET )
350 // FIXME: extrapolated data
351 /* HPMC */
352 #define PDC_CHASSIS_PMSG_HPMC (PDC_CHASSIS_ALERT_CONF_CHG /*?*/ | \
353 PDC_CHASSIS_SRC_PROC | \
354 PDC_CHASSIS_SRC_D_PROC | \
355 PDC_CHASSIS_SRC_ID_UNSPEC | \
356 PDC_CHASSIS_PB_D_PROC_NONE | \
357 PDC_CHASSIS_CALL_ACT_HPUX_WARN | \
358 PDC_CHASSIS_RET_HPUX | \
359 PDC_CHASSIS_DT_STATE_CHG | \
360 PDC_CHASSIS_SYSTATE_HPMC | \
361 PDC_CHASSIS_MSG_ID | \
362 PDC_CHASSIS_EOM_SET )
364 /* LPMC */
365 #define PDC_CHASSIS_PMSG_LPMC (PDC_CHASSIS_ALERT_BLOCKED /*?*/| \
366 PDC_CHASSIS_SRC_PROC | \
367 PDC_CHASSIS_SRC_D_PROC | \
368 PDC_CHASSIS_SRC_ID_UNSPEC | \
369 PDC_CHASSIS_PB_D_PROC_NONE | \
370 PDC_CHASSIS_CALL_ACT_HPUX_WARN | \
371 PDC_CHASSIS_ACT_STATUS_UNSPEC | \
372 PDC_CHASSIS_CALL_SACT_UNSPEC | \
373 PDC_CHASSIS_RET_HPUX | \
374 PDC_CHASSIS_REID_UNSPEC | \
375 PDC_CHASSIS_DT_STATE_CHG | \
376 PDC_CHASSIS_SYSTATE_CHANGE | \
377 PDC_CHASSIS_MSG_ID | \
378 PDC_CHASSIS_EOM_SET )
380 #endif /* _PARISC_PDC_CHASSIS_H */
381 /* vim: set ts=8 */