Merge tag 'usb-5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
[linux/fpc-iii.git] / arch / parisc / include / asm / pdc_chassis.h
blobae3e108d22ad649105fd7beb0c06e3d1dfb5603f
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * include/asm-parisc/pdc_chassis.h
5 * Copyright (C) 2002 Laurent Canet <canetl@esiee.fr>
6 * Copyright (C) 2002 Thibaut Varene <varenet@parisc-linux.org>
8 * TODO: - handle processor number on SMP systems (Reporting Entity ID)
9 * - handle message ID
10 * - handle timestamps
14 #ifndef _PARISC_PDC_CHASSIS_H
15 #define _PARISC_PDC_CHASSIS_H
18 * ----------
19 * Prototypes
20 * ----------
23 int pdc_chassis_send_status(int message);
24 void parisc_pdc_chassis_init(void);
28 * -----------------
29 * Direct call names
30 * -----------------
31 * They setup everything for you, the Log message and the corresponding LED state
34 #define PDC_CHASSIS_DIRECT_BSTART 0
35 #define PDC_CHASSIS_DIRECT_BCOMPLETE 1
36 #define PDC_CHASSIS_DIRECT_SHUTDOWN 2
37 #define PDC_CHASSIS_DIRECT_PANIC 3
38 #define PDC_CHASSIS_DIRECT_HPMC 4
39 #define PDC_CHASSIS_DIRECT_LPMC 5
40 #define PDC_CHASSIS_DIRECT_DUMP 6 /* not yet implemented */
41 #define PDC_CHASSIS_DIRECT_OOPS 7 /* not yet implemented */
45 * ------------
46 * LEDs control
47 * ------------
48 * Set the three LEDs -- Run, Attn, and Fault.
51 /* Old PDC LED control */
52 #define PDC_CHASSIS_DISP_DATA(v) ((unsigned long)(v) << 17)
54 /*
55 * Available PDC PAT LED states
58 #define PDC_CHASSIS_LED_RUN_OFF (0ULL << 4)
59 #define PDC_CHASSIS_LED_RUN_FLASH (1ULL << 4)
60 #define PDC_CHASSIS_LED_RUN_ON (2ULL << 4)
61 #define PDC_CHASSIS_LED_RUN_NC (3ULL << 4)
62 #define PDC_CHASSIS_LED_ATTN_OFF (0ULL << 6)
63 #define PDC_CHASSIS_LED_ATTN_FLASH (1ULL << 6)
64 #define PDC_CHASSIS_LED_ATTN_NC (3ULL << 6) /* ATTN ON is invalid */
65 #define PDC_CHASSIS_LED_FAULT_OFF (0ULL << 8)
66 #define PDC_CHASSIS_LED_FAULT_FLASH (1ULL << 8)
67 #define PDC_CHASSIS_LED_FAULT_ON (2ULL << 8)
68 #define PDC_CHASSIS_LED_FAULT_NC (3ULL << 8)
69 #define PDC_CHASSIS_LED_VALID (1ULL << 10)
71 /*
72 * Valid PDC PAT LED states combinations
75 /* System running normally */
76 #define PDC_CHASSIS_LSTATE_RUN_NORMAL (PDC_CHASSIS_LED_RUN_ON | \
77 PDC_CHASSIS_LED_ATTN_OFF | \
78 PDC_CHASSIS_LED_FAULT_OFF | \
79 PDC_CHASSIS_LED_VALID )
80 /* System crashed and rebooted itself successfully */
81 #define PDC_CHASSIS_LSTATE_RUN_CRASHREC (PDC_CHASSIS_LED_RUN_ON | \
82 PDC_CHASSIS_LED_ATTN_OFF | \
83 PDC_CHASSIS_LED_FAULT_FLASH | \
84 PDC_CHASSIS_LED_VALID )
85 /* There was a system interruption that did not take the system down */
86 #define PDC_CHASSIS_LSTATE_RUN_SYSINT (PDC_CHASSIS_LED_RUN_ON | \
87 PDC_CHASSIS_LED_ATTN_FLASH | \
88 PDC_CHASSIS_LED_FAULT_OFF | \
89 PDC_CHASSIS_LED_VALID )
90 /* System running and unexpected reboot or non-critical error detected */
91 #define PDC_CHASSIS_LSTATE_RUN_NCRIT (PDC_CHASSIS_LED_RUN_ON | \
92 PDC_CHASSIS_LED_ATTN_FLASH | \
93 PDC_CHASSIS_LED_FAULT_FLASH | \
94 PDC_CHASSIS_LED_VALID )
95 /* Executing non-OS code */
96 #define PDC_CHASSIS_LSTATE_NONOS (PDC_CHASSIS_LED_RUN_FLASH | \
97 PDC_CHASSIS_LED_ATTN_OFF | \
98 PDC_CHASSIS_LED_FAULT_OFF | \
99 PDC_CHASSIS_LED_VALID )
100 /* Boot failed - Executing non-OS code */
101 #define PDC_CHASSIS_LSTATE_NONOS_BFAIL (PDC_CHASSIS_LED_RUN_FLASH | \
102 PDC_CHASSIS_LED_ATTN_OFF | \
103 PDC_CHASSIS_LED_FAULT_ON | \
104 PDC_CHASSIS_LED_VALID )
105 /* Unexpected reboot occurred - Executing non-OS code */
106 #define PDC_CHASSIS_LSTATE_NONOS_UNEXP (PDC_CHASSIS_LED_RUN_FLASH | \
107 PDC_CHASSIS_LED_ATTN_OFF | \
108 PDC_CHASSIS_LED_FAULT_FLASH | \
109 PDC_CHASSIS_LED_VALID )
110 /* Executing non-OS code - Non-critical error detected */
111 #define PDC_CHASSIS_LSTATE_NONOS_NCRIT (PDC_CHASSIS_LED_RUN_FLASH | \
112 PDC_CHASSIS_LED_ATTN_FLASH | \
113 PDC_CHASSIS_LED_FAULT_OFF | \
114 PDC_CHASSIS_LED_VALID )
115 /* Boot failed - Executing non-OS code - Non-critical error detected */
116 #define PDC_CHASSIS_LSTATE_BFAIL_NCRIT (PDC_CHASSIS_LED_RUN_FLASH | \
117 PDC_CHASSIS_LED_ATTN_FLASH | \
118 PDC_CHASSIS_LED_FAULT_ON | \
119 PDC_CHASSIS_LED_VALID )
120 /* Unexpected reboot/recovering - Executing non-OS code - Non-critical error detected */
121 #define PDC_CHASSIS_LSTATE_UNEXP_NCRIT (PDC_CHASSIS_LED_RUN_FLASH | \
122 PDC_CHASSIS_LED_ATTN_FLASH | \
123 PDC_CHASSIS_LED_FAULT_FLASH | \
124 PDC_CHASSIS_LED_VALID )
125 /* Cannot execute PDC */
126 #define PDC_CHASSIS_LSTATE_CANNOT_PDC (PDC_CHASSIS_LED_RUN_OFF | \
127 PDC_CHASSIS_LED_ATTN_OFF | \
128 PDC_CHASSIS_LED_FAULT_OFF | \
129 PDC_CHASSIS_LED_VALID )
130 /* Boot failed - OS not up - PDC has detected a failure that prevents boot */
131 #define PDC_CHASSIS_LSTATE_FATAL_BFAIL (PDC_CHASSIS_LED_RUN_OFF | \
132 PDC_CHASSIS_LED_ATTN_OFF | \
133 PDC_CHASSIS_LED_FAULT_ON | \
134 PDC_CHASSIS_LED_VALID )
135 /* No code running - Non-critical error detected (double fault situation) */
136 #define PDC_CHASSIS_LSTATE_NOCODE_NCRIT (PDC_CHASSIS_LED_RUN_OFF | \
137 PDC_CHASSIS_LED_ATTN_FLASH | \
138 PDC_CHASSIS_LED_FAULT_OFF | \
139 PDC_CHASSIS_LED_VALID )
140 /* Boot failed - OS not up - Fatal failure detected - Non-critical error detected */
141 #define PDC_CHASSIS_LSTATE_FATAL_NCRIT (PDC_CHASSIS_LED_RUN_OFF | \
142 PDC_CHASSIS_LED_ATTN_FLASH | \
143 PDC_CHASSIS_LED_FAULT_ON | \
144 PDC_CHASSIS_LED_VALID )
145 /* All other states are invalid */
149 * --------------
150 * PDC Log events
151 * --------------
152 * Here follows bits needed to fill up the log event sent to PDC_CHASSIS
153 * The log message contains: Alert level, Source, Source detail,
154 * Source ID, Problem detail, Caller activity, Activity status,
155 * Caller subactivity, Reporting entity type, Reporting entity ID,
156 * Data type, Unique message ID and EOM.
159 /* Alert level */
160 #define PDC_CHASSIS_ALERT_FORWARD (0ULL << 36) /* no failure detected */
161 #define PDC_CHASSIS_ALERT_SERPROC (1ULL << 36) /* service proc - no failure */
162 #define PDC_CHASSIS_ALERT_NURGENT (2ULL << 36) /* non-urgent operator attn */
163 #define PDC_CHASSIS_ALERT_BLOCKED (3ULL << 36) /* system blocked */
164 #define PDC_CHASSIS_ALERT_CONF_CHG (4ULL << 36) /* unexpected configuration change */
165 #define PDC_CHASSIS_ALERT_ENV_PB (5ULL << 36) /* boot possible, environmental pb */
166 #define PDC_CHASSIS_ALERT_PENDING (6ULL << 36) /* boot possible, pending failure */
167 #define PDC_CHASSIS_ALERT_PERF_IMP (8ULL << 36) /* boot possible, performance impaired */
168 #define PDC_CHASSIS_ALERT_FUNC_IMP (10ULL << 36) /* boot possible, functionality impaired */
169 #define PDC_CHASSIS_ALERT_SOFT_FAIL (12ULL << 36) /* software failure */
170 #define PDC_CHASSIS_ALERT_HANG (13ULL << 36) /* system hang */
171 #define PDC_CHASSIS_ALERT_ENV_FATAL (14ULL << 36) /* fatal power or environmental pb */
172 #define PDC_CHASSIS_ALERT_HW_FATAL (15ULL << 36) /* fatal hardware problem */
174 /* Source */
175 #define PDC_CHASSIS_SRC_NONE (0ULL << 28) /* unknown, no source stated */
176 #define PDC_CHASSIS_SRC_PROC (1ULL << 28) /* processor */
177 /* For later use ? */
178 #define PDC_CHASSIS_SRC_PROC_CACHE (2ULL << 28) /* processor cache*/
179 #define PDC_CHASSIS_SRC_PDH (3ULL << 28) /* processor dependent hardware */
180 #define PDC_CHASSIS_SRC_PWR (4ULL << 28) /* power */
181 #define PDC_CHASSIS_SRC_FAB (5ULL << 28) /* fabric connector */
182 #define PDC_CHASSIS_SRC_PLATi (6ULL << 28) /* platform */
183 #define PDC_CHASSIS_SRC_MEM (7ULL << 28) /* memory */
184 #define PDC_CHASSIS_SRC_IO (8ULL << 28) /* I/O */
185 #define PDC_CHASSIS_SRC_CELL (9ULL << 28) /* cell */
186 #define PDC_CHASSIS_SRC_PD (10ULL << 28) /* protected domain */
188 /* Source detail field */
189 #define PDC_CHASSIS_SRC_D_PROC (1ULL << 24) /* processor general */
191 /* Source ID - platform dependent */
192 #define PDC_CHASSIS_SRC_ID_UNSPEC (0ULL << 16)
194 /* Problem detail - problem source dependent */
195 #define PDC_CHASSIS_PB_D_PROC_NONE (0ULL << 32) /* no problem detail */
196 #define PDC_CHASSIS_PB_D_PROC_TIMEOUT (4ULL << 32) /* timeout */
198 /* Caller activity */
199 #define PDC_CHASSIS_CALL_ACT_HPUX_BL (7ULL << 12) /* Boot Loader */
200 #define PDC_CHASSIS_CALL_ACT_HPUX_PD (8ULL << 12) /* SAL_PD activities */
201 #define PDC_CHASSIS_CALL_ACT_HPUX_EVENT (9ULL << 12) /* SAL_EVENTS activities */
202 #define PDC_CHASSIS_CALL_ACT_HPUX_IO (10ULL << 12) /* SAL_IO activities */
203 #define PDC_CHASSIS_CALL_ACT_HPUX_PANIC (11ULL << 12) /* System panic */
204 #define PDC_CHASSIS_CALL_ACT_HPUX_INIT (12ULL << 12) /* System initialization */
205 #define PDC_CHASSIS_CALL_ACT_HPUX_SHUT (13ULL << 12) /* System shutdown */
206 #define PDC_CHASSIS_CALL_ACT_HPUX_WARN (14ULL << 12) /* System warning */
207 #define PDC_CHASSIS_CALL_ACT_HPUX_DU (15ULL << 12) /* Display_Activity() update */
209 /* Activity status - implementation dependent */
210 #define PDC_CHASSIS_ACT_STATUS_UNSPEC (0ULL << 0)
212 /* Caller subactivity - implementation dependent */
213 /* FIXME: other subactivities ? */
214 #define PDC_CHASSIS_CALL_SACT_UNSPEC (0ULL << 4) /* implementation dependent */
216 /* Reporting entity type */
217 #define PDC_CHASSIS_RET_GENERICOS (12ULL << 52) /* generic OSes */
218 #define PDC_CHASSIS_RET_IA64_NT (13ULL << 52) /* IA-64 NT */
219 #define PDC_CHASSIS_RET_HPUX (14ULL << 52) /* HP-UX */
220 #define PDC_CHASSIS_RET_DIAG (15ULL << 52) /* offline diagnostics & utilities */
222 /* Reporting entity ID */
223 #define PDC_CHASSIS_REID_UNSPEC (0ULL << 44)
225 /* Data type */
226 #define PDC_CHASSIS_DT_NONE (0ULL << 59) /* data field unused */
227 /* For later use ? Do we need these ? */
228 #define PDC_CHASSIS_DT_PHYS_ADDR (1ULL << 59) /* physical address */
229 #define PDC_CHASSIS_DT_DATA_EXPECT (2ULL << 59) /* expected data */
230 #define PDC_CHASSIS_DT_ACTUAL (3ULL << 59) /* actual data */
231 #define PDC_CHASSIS_DT_PHYS_LOC (4ULL << 59) /* physical location */
232 #define PDC_CHASSIS_DT_PHYS_LOC_EXT (5ULL << 59) /* physical location extension */
233 #define PDC_CHASSIS_DT_TAG (6ULL << 59) /* tag */
234 #define PDC_CHASSIS_DT_SYNDROME (7ULL << 59) /* syndrome */
235 #define PDC_CHASSIS_DT_CODE_ADDR (8ULL << 59) /* code address */
236 #define PDC_CHASSIS_DT_ASCII_MSG (9ULL << 59) /* ascii message */
237 #define PDC_CHASSIS_DT_POST (10ULL << 59) /* POST code */
238 #define PDC_CHASSIS_DT_TIMESTAMP (11ULL << 59) /* timestamp */
239 #define PDC_CHASSIS_DT_DEV_STAT (12ULL << 59) /* device status */
240 #define PDC_CHASSIS_DT_DEV_TYPE (13ULL << 59) /* device type */
241 #define PDC_CHASSIS_DT_PB_DET (14ULL << 59) /* problem detail */
242 #define PDC_CHASSIS_DT_ACT_LEV (15ULL << 59) /* activity level/timeout */
243 #define PDC_CHASSIS_DT_SER_NUM (16ULL << 59) /* serial number */
244 #define PDC_CHASSIS_DT_REV_NUM (17ULL << 59) /* revision number */
245 #define PDC_CHASSIS_DT_INTERRUPT (18ULL << 59) /* interruption information */
246 #define PDC_CHASSIS_DT_TEST_NUM (19ULL << 59) /* test number */
247 #define PDC_CHASSIS_DT_STATE_CHG (20ULL << 59) /* major changes in system state */
248 #define PDC_CHASSIS_DT_PROC_DEALLOC (21ULL << 59) /* processor deallocate */
249 #define PDC_CHASSIS_DT_RESET (30ULL << 59) /* reset type and cause */
250 #define PDC_CHASSIS_DT_PA_LEGACY (31ULL << 59) /* legacy PA hex chassis code */
252 /* System states - part of major changes in system state data field */
253 #define PDC_CHASSIS_SYSTATE_BSTART (0ULL << 0) /* boot start */
254 #define PDC_CHASSIS_SYSTATE_BCOMP (1ULL << 0) /* boot complete */
255 #define PDC_CHASSIS_SYSTATE_CHANGE (2ULL << 0) /* major change */
256 #define PDC_CHASSIS_SYSTATE_LED (3ULL << 0) /* LED change */
257 #define PDC_CHASSIS_SYSTATE_PANIC (9ULL << 0) /* OS Panic */
258 #define PDC_CHASSIS_SYSTATE_DUMP (10ULL << 0) /* memory dump */
259 #define PDC_CHASSIS_SYSTATE_HPMC (11ULL << 0) /* processing HPMC */
260 #define PDC_CHASSIS_SYSTATE_HALT (15ULL << 0) /* system halted */
262 /* Message ID */
263 #define PDC_CHASSIS_MSG_ID (0ULL << 40) /* we do not handle msg IDs atm */
265 /* EOM - separates log entries */
266 #define PDC_CHASSIS_EOM_CLEAR (0ULL << 43)
267 #define PDC_CHASSIS_EOM_SET (1ULL << 43)
270 * Preformated well known messages
273 /* Boot started */
274 #define PDC_CHASSIS_PMSG_BSTART (PDC_CHASSIS_ALERT_SERPROC | \
275 PDC_CHASSIS_SRC_PROC | \
276 PDC_CHASSIS_SRC_D_PROC | \
277 PDC_CHASSIS_SRC_ID_UNSPEC | \
278 PDC_CHASSIS_PB_D_PROC_NONE | \
279 PDC_CHASSIS_CALL_ACT_HPUX_INIT | \
280 PDC_CHASSIS_ACT_STATUS_UNSPEC | \
281 PDC_CHASSIS_CALL_SACT_UNSPEC | \
282 PDC_CHASSIS_RET_HPUX | \
283 PDC_CHASSIS_REID_UNSPEC | \
284 PDC_CHASSIS_DT_STATE_CHG | \
285 PDC_CHASSIS_SYSTATE_BSTART | \
286 PDC_CHASSIS_MSG_ID | \
287 PDC_CHASSIS_EOM_SET )
289 /* Boot complete */
290 #define PDC_CHASSIS_PMSG_BCOMPLETE (PDC_CHASSIS_ALERT_SERPROC | \
291 PDC_CHASSIS_SRC_PROC | \
292 PDC_CHASSIS_SRC_D_PROC | \
293 PDC_CHASSIS_SRC_ID_UNSPEC | \
294 PDC_CHASSIS_PB_D_PROC_NONE | \
295 PDC_CHASSIS_CALL_ACT_HPUX_INIT | \
296 PDC_CHASSIS_ACT_STATUS_UNSPEC | \
297 PDC_CHASSIS_CALL_SACT_UNSPEC | \
298 PDC_CHASSIS_RET_HPUX | \
299 PDC_CHASSIS_REID_UNSPEC | \
300 PDC_CHASSIS_DT_STATE_CHG | \
301 PDC_CHASSIS_SYSTATE_BCOMP | \
302 PDC_CHASSIS_MSG_ID | \
303 PDC_CHASSIS_EOM_SET )
305 /* Shutdown */
306 #define PDC_CHASSIS_PMSG_SHUTDOWN (PDC_CHASSIS_ALERT_SERPROC | \
307 PDC_CHASSIS_SRC_PROC | \
308 PDC_CHASSIS_SRC_D_PROC | \
309 PDC_CHASSIS_SRC_ID_UNSPEC | \
310 PDC_CHASSIS_PB_D_PROC_NONE | \
311 PDC_CHASSIS_CALL_ACT_HPUX_SHUT | \
312 PDC_CHASSIS_ACT_STATUS_UNSPEC | \
313 PDC_CHASSIS_CALL_SACT_UNSPEC | \
314 PDC_CHASSIS_RET_HPUX | \
315 PDC_CHASSIS_REID_UNSPEC | \
316 PDC_CHASSIS_DT_STATE_CHG | \
317 PDC_CHASSIS_SYSTATE_HALT | \
318 PDC_CHASSIS_MSG_ID | \
319 PDC_CHASSIS_EOM_SET )
321 /* Panic */
322 #define PDC_CHASSIS_PMSG_PANIC (PDC_CHASSIS_ALERT_SOFT_FAIL | \
323 PDC_CHASSIS_SRC_PROC | \
324 PDC_CHASSIS_SRC_D_PROC | \
325 PDC_CHASSIS_SRC_ID_UNSPEC | \
326 PDC_CHASSIS_PB_D_PROC_NONE | \
327 PDC_CHASSIS_CALL_ACT_HPUX_PANIC| \
328 PDC_CHASSIS_ACT_STATUS_UNSPEC | \
329 PDC_CHASSIS_CALL_SACT_UNSPEC | \
330 PDC_CHASSIS_RET_HPUX | \
331 PDC_CHASSIS_REID_UNSPEC | \
332 PDC_CHASSIS_DT_STATE_CHG | \
333 PDC_CHASSIS_SYSTATE_PANIC | \
334 PDC_CHASSIS_MSG_ID | \
335 PDC_CHASSIS_EOM_SET )
337 // FIXME: extrapolated data
338 /* HPMC */
339 #define PDC_CHASSIS_PMSG_HPMC (PDC_CHASSIS_ALERT_CONF_CHG /*?*/ | \
340 PDC_CHASSIS_SRC_PROC | \
341 PDC_CHASSIS_SRC_D_PROC | \
342 PDC_CHASSIS_SRC_ID_UNSPEC | \
343 PDC_CHASSIS_PB_D_PROC_NONE | \
344 PDC_CHASSIS_CALL_ACT_HPUX_WARN | \
345 PDC_CHASSIS_RET_HPUX | \
346 PDC_CHASSIS_DT_STATE_CHG | \
347 PDC_CHASSIS_SYSTATE_HPMC | \
348 PDC_CHASSIS_MSG_ID | \
349 PDC_CHASSIS_EOM_SET )
351 /* LPMC */
352 #define PDC_CHASSIS_PMSG_LPMC (PDC_CHASSIS_ALERT_BLOCKED /*?*/| \
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_ACT_STATUS_UNSPEC | \
359 PDC_CHASSIS_CALL_SACT_UNSPEC | \
360 PDC_CHASSIS_RET_HPUX | \
361 PDC_CHASSIS_REID_UNSPEC | \
362 PDC_CHASSIS_DT_STATE_CHG | \
363 PDC_CHASSIS_SYSTATE_CHANGE | \
364 PDC_CHASSIS_MSG_ID | \
365 PDC_CHASSIS_EOM_SET )
367 #endif /* _PARISC_PDC_CHASSIS_H */
368 /* vim: set ts=8 */