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