Commit | Line | Data |
---|---|---|
27f44888 BH |
1 | /* |
2 | * PowerNV OPAL definitions. | |
3 | * | |
4 | * Copyright 2011 IBM Corp. | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU General Public License | |
8 | * as published by the Free Software Foundation; either version | |
9 | * 2 of the License, or (at your option) any later version. | |
10 | */ | |
11 | ||
12 | #ifndef __OPAL_H | |
13 | #define __OPAL_H | |
14 | ||
15 | /****** Takeover interface ********/ | |
16 | ||
17 | /* PAPR H-Call used to querty the HAL existence and/or instanciate | |
18 | * it from within pHyp (tech preview only). | |
19 | * | |
20 | * This is exclusively used in prom_init.c | |
21 | */ | |
22 | ||
23 | #ifndef __ASSEMBLY__ | |
24 | ||
25 | struct opal_takeover_args { | |
26 | u64 k_image; /* r4 */ | |
27 | u64 k_size; /* r5 */ | |
28 | u64 k_entry; /* r6 */ | |
29 | u64 k_entry2; /* r7 */ | |
30 | u64 hal_addr; /* r8 */ | |
31 | u64 rd_image; /* r9 */ | |
32 | u64 rd_size; /* r10 */ | |
33 | u64 rd_loc; /* r11 */ | |
34 | }; | |
35 | ||
7e1ce5a4 VH |
36 | /* |
37 | * SG entry | |
38 | * | |
39 | * WARNING: The current implementation requires each entry | |
40 | * to represent a block that is 4k aligned *and* each block | |
41 | * size except the last one in the list to be as well. | |
42 | */ | |
43 | struct opal_sg_entry { | |
44 | void *data; | |
45 | long length; | |
46 | }; | |
47 | ||
48 | /* sg list */ | |
49 | struct opal_sg_list { | |
50 | unsigned long num_entries; | |
51 | struct opal_sg_list *next; | |
52 | struct opal_sg_entry entry[]; | |
53 | }; | |
54 | ||
55 | /* We calculate number of sg entries based on PAGE_SIZE */ | |
56 | #define SG_ENTRIES_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct opal_sg_entry)) | |
57 | ||
27f44888 BH |
58 | extern long opal_query_takeover(u64 *hal_size, u64 *hal_align); |
59 | ||
60 | extern long opal_do_takeover(struct opal_takeover_args *args); | |
61 | ||
14a43e69 | 62 | struct rtas_args; |
27f44888 BH |
63 | extern int opal_enter_rtas(struct rtas_args *args, |
64 | unsigned long data, | |
65 | unsigned long entry); | |
66 | ||
27f44888 BH |
67 | #endif /* __ASSEMBLY__ */ |
68 | ||
69 | /****** OPAL APIs ******/ | |
70 | ||
14a43e69 BH |
71 | /* Return codes */ |
72 | #define OPAL_SUCCESS 0 | |
73 | #define OPAL_PARAMETER -1 | |
74 | #define OPAL_BUSY -2 | |
75 | #define OPAL_PARTIAL -3 | |
76 | #define OPAL_CONSTRAINED -4 | |
77 | #define OPAL_CLOSED -5 | |
78 | #define OPAL_HARDWARE -6 | |
79 | #define OPAL_UNSUPPORTED -7 | |
80 | #define OPAL_PERMISSION -8 | |
81 | #define OPAL_NO_MEM -9 | |
82 | #define OPAL_RESOURCE -10 | |
83 | #define OPAL_INTERNAL_ERROR -11 | |
84 | #define OPAL_BUSY_EVENT -12 | |
85 | #define OPAL_HARDWARE_FROZEN -13 | |
8d724823 NG |
86 | #define OPAL_WRONG_STATE -14 |
87 | #define OPAL_ASYNC_COMPLETION -15 | |
14a43e69 BH |
88 | |
89 | /* API Tokens (in r0) */ | |
90 | #define OPAL_CONSOLE_WRITE 1 | |
91 | #define OPAL_CONSOLE_READ 2 | |
92 | #define OPAL_RTC_READ 3 | |
93 | #define OPAL_RTC_WRITE 4 | |
94 | #define OPAL_CEC_POWER_DOWN 5 | |
95 | #define OPAL_CEC_REBOOT 6 | |
96 | #define OPAL_READ_NVRAM 7 | |
97 | #define OPAL_WRITE_NVRAM 8 | |
98 | #define OPAL_HANDLE_INTERRUPT 9 | |
99 | #define OPAL_POLL_EVENTS 10 | |
100 | #define OPAL_PCI_SET_HUB_TCE_MEMORY 11 | |
101 | #define OPAL_PCI_SET_PHB_TCE_MEMORY 12 | |
102 | #define OPAL_PCI_CONFIG_READ_BYTE 13 | |
103 | #define OPAL_PCI_CONFIG_READ_HALF_WORD 14 | |
104 | #define OPAL_PCI_CONFIG_READ_WORD 15 | |
105 | #define OPAL_PCI_CONFIG_WRITE_BYTE 16 | |
106 | #define OPAL_PCI_CONFIG_WRITE_HALF_WORD 17 | |
107 | #define OPAL_PCI_CONFIG_WRITE_WORD 18 | |
108 | #define OPAL_SET_XIVE 19 | |
109 | #define OPAL_GET_XIVE 20 | |
110 | #define OPAL_GET_COMPLETION_TOKEN_STATUS 21 /* obsolete */ | |
111 | #define OPAL_REGISTER_OPAL_EXCEPTION_HANDLER 22 | |
112 | #define OPAL_PCI_EEH_FREEZE_STATUS 23 | |
113 | #define OPAL_PCI_SHPC 24 | |
114 | #define OPAL_CONSOLE_WRITE_BUFFER_SPACE 25 | |
115 | #define OPAL_PCI_EEH_FREEZE_CLEAR 26 | |
116 | #define OPAL_PCI_PHB_MMIO_ENABLE 27 | |
117 | #define OPAL_PCI_SET_PHB_MEM_WINDOW 28 | |
118 | #define OPAL_PCI_MAP_PE_MMIO_WINDOW 29 | |
119 | #define OPAL_PCI_SET_PHB_TABLE_MEMORY 30 | |
120 | #define OPAL_PCI_SET_PE 31 | |
121 | #define OPAL_PCI_SET_PELTV 32 | |
122 | #define OPAL_PCI_SET_MVE 33 | |
123 | #define OPAL_PCI_SET_MVE_ENABLE 34 | |
124 | #define OPAL_PCI_GET_XIVE_REISSUE 35 | |
125 | #define OPAL_PCI_SET_XIVE_REISSUE 36 | |
126 | #define OPAL_PCI_SET_XIVE_PE 37 | |
127 | #define OPAL_GET_XIVE_SOURCE 38 | |
128 | #define OPAL_GET_MSI_32 39 | |
129 | #define OPAL_GET_MSI_64 40 | |
130 | #define OPAL_START_CPU 41 | |
131 | #define OPAL_QUERY_CPU_STATUS 42 | |
132 | #define OPAL_WRITE_OPPANEL 43 | |
133 | #define OPAL_PCI_MAP_PE_DMA_WINDOW 44 | |
134 | #define OPAL_PCI_MAP_PE_DMA_WINDOW_REAL 45 | |
135 | #define OPAL_PCI_RESET 49 | |
f11fe552 BH |
136 | #define OPAL_PCI_GET_HUB_DIAG_DATA 50 |
137 | #define OPAL_PCI_GET_PHB_DIAG_DATA 51 | |
138 | #define OPAL_PCI_FENCE_PHB 52 | |
139 | #define OPAL_PCI_REINIT 53 | |
140 | #define OPAL_PCI_MASK_PE_ERROR 54 | |
141 | #define OPAL_SET_SLOT_LED_STATUS 55 | |
142 | #define OPAL_GET_EPOW_STATUS 56 | |
143 | #define OPAL_SET_SYSTEM_ATTENTION_LED 57 | |
23773230 GS |
144 | #define OPAL_RESERVED1 58 |
145 | #define OPAL_RESERVED2 59 | |
146 | #define OPAL_PCI_NEXT_ERROR 60 | |
147 | #define OPAL_PCI_EEH_FREEZE_STATUS2 61 | |
148 | #define OPAL_PCI_POLL 62 | |
137436c9 | 149 | #define OPAL_PCI_MSI_EOI 63 |
23773230 | 150 | #define OPAL_PCI_GET_PHB_DIAG_DATA2 64 |
cc0efb57 BH |
151 | #define OPAL_XSCOM_READ 65 |
152 | #define OPAL_XSCOM_WRITE 66 | |
153 | #define OPAL_LPC_READ 67 | |
154 | #define OPAL_LPC_WRITE 68 | |
13906db6 | 155 | #define OPAL_RETURN_CPU 69 |
774fea1a SS |
156 | #define OPAL_ELOG_READ 71 |
157 | #define OPAL_ELOG_WRITE 72 | |
158 | #define OPAL_ELOG_ACK 73 | |
159 | #define OPAL_ELOG_RESEND 74 | |
160 | #define OPAL_ELOG_SIZE 75 | |
50bd6153 VH |
161 | #define OPAL_FLASH_VALIDATE 76 |
162 | #define OPAL_FLASH_MANAGE 77 | |
163 | #define OPAL_FLASH_UPDATE 78 | |
c7e64b9c SS |
164 | #define OPAL_DUMP_INIT 81 |
165 | #define OPAL_DUMP_INFO 82 | |
166 | #define OPAL_DUMP_READ 83 | |
167 | #define OPAL_DUMP_ACK 84 | |
24366360 MS |
168 | #define OPAL_GET_MSG 85 |
169 | #define OPAL_CHECK_ASYNC_COMPLETION 86 | |
c7e64b9c | 170 | #define OPAL_DUMP_RESEND 91 |
f7d98d18 | 171 | #define OPAL_SYNC_HOST_REBOOT 87 |
c7e64b9c | 172 | #define OPAL_DUMP_INFO2 94 |
14a43e69 BH |
173 | |
174 | #ifndef __ASSEMBLY__ | |
175 | ||
176 | /* Other enums */ | |
177 | enum OpalVendorApiTokens { | |
178 | OPAL_START_VENDOR_API_RANGE = 1000, OPAL_END_VENDOR_API_RANGE = 1999 | |
179 | }; | |
23773230 | 180 | |
14a43e69 BH |
181 | enum OpalFreezeState { |
182 | OPAL_EEH_STOPPED_NOT_FROZEN = 0, | |
183 | OPAL_EEH_STOPPED_MMIO_FREEZE = 1, | |
184 | OPAL_EEH_STOPPED_DMA_FREEZE = 2, | |
185 | OPAL_EEH_STOPPED_MMIO_DMA_FREEZE = 3, | |
186 | OPAL_EEH_STOPPED_RESET = 4, | |
187 | OPAL_EEH_STOPPED_TEMP_UNAVAIL = 5, | |
188 | OPAL_EEH_STOPPED_PERM_UNAVAIL = 6 | |
189 | }; | |
23773230 | 190 | |
14a43e69 BH |
191 | enum OpalEehFreezeActionToken { |
192 | OPAL_EEH_ACTION_CLEAR_FREEZE_MMIO = 1, | |
193 | OPAL_EEH_ACTION_CLEAR_FREEZE_DMA = 2, | |
194 | OPAL_EEH_ACTION_CLEAR_FREEZE_ALL = 3 | |
195 | }; | |
23773230 | 196 | |
14a43e69 | 197 | enum OpalPciStatusToken { |
23773230 GS |
198 | OPAL_EEH_NO_ERROR = 0, |
199 | OPAL_EEH_IOC_ERROR = 1, | |
200 | OPAL_EEH_PHB_ERROR = 2, | |
201 | OPAL_EEH_PE_ERROR = 3, | |
202 | OPAL_EEH_PE_MMIO_ERROR = 4, | |
203 | OPAL_EEH_PE_DMA_ERROR = 5 | |
14a43e69 | 204 | }; |
23773230 GS |
205 | |
206 | enum OpalPciErrorSeverity { | |
207 | OPAL_EEH_SEV_NO_ERROR = 0, | |
208 | OPAL_EEH_SEV_IOC_DEAD = 1, | |
209 | OPAL_EEH_SEV_PHB_DEAD = 2, | |
210 | OPAL_EEH_SEV_PHB_FENCED = 3, | |
211 | OPAL_EEH_SEV_PE_ER = 4, | |
212 | OPAL_EEH_SEV_INF = 5 | |
213 | }; | |
214 | ||
14a43e69 BH |
215 | enum OpalShpcAction { |
216 | OPAL_SHPC_GET_LINK_STATE = 0, | |
217 | OPAL_SHPC_GET_SLOT_STATE = 1 | |
218 | }; | |
23773230 | 219 | |
14a43e69 BH |
220 | enum OpalShpcLinkState { |
221 | OPAL_SHPC_LINK_DOWN = 0, | |
222 | OPAL_SHPC_LINK_UP = 1 | |
223 | }; | |
23773230 | 224 | |
14a43e69 BH |
225 | enum OpalMmioWindowType { |
226 | OPAL_M32_WINDOW_TYPE = 1, | |
227 | OPAL_M64_WINDOW_TYPE = 2, | |
228 | OPAL_IO_WINDOW_TYPE = 3 | |
229 | }; | |
23773230 | 230 | |
14a43e69 BH |
231 | enum OpalShpcSlotState { |
232 | OPAL_SHPC_DEV_NOT_PRESENT = 0, | |
233 | OPAL_SHPC_DEV_PRESENT = 1 | |
234 | }; | |
23773230 | 235 | |
14a43e69 BH |
236 | enum OpalExceptionHandler { |
237 | OPAL_MACHINE_CHECK_HANDLER = 1, | |
238 | OPAL_HYPERVISOR_MAINTENANCE_HANDLER = 2, | |
239 | OPAL_SOFTPATCH_HANDLER = 3 | |
240 | }; | |
23773230 | 241 | |
14a43e69 | 242 | enum OpalPendingState { |
23773230 GS |
243 | OPAL_EVENT_OPAL_INTERNAL = 0x1, |
244 | OPAL_EVENT_NVRAM = 0x2, | |
245 | OPAL_EVENT_RTC = 0x4, | |
246 | OPAL_EVENT_CONSOLE_OUTPUT = 0x8, | |
247 | OPAL_EVENT_CONSOLE_INPUT = 0x10, | |
248 | OPAL_EVENT_ERROR_LOG_AVAIL = 0x20, | |
249 | OPAL_EVENT_ERROR_LOG = 0x40, | |
250 | OPAL_EVENT_EPOW = 0x80, | |
251 | OPAL_EVENT_LED_STATUS = 0x100, | |
24366360 | 252 | OPAL_EVENT_PCI_ERROR = 0x200, |
c7e64b9c | 253 | OPAL_EVENT_DUMP_AVAIL = 0x400, |
24366360 MS |
254 | OPAL_EVENT_MSG_PENDING = 0x800, |
255 | }; | |
256 | ||
257 | enum OpalMessageType { | |
8d724823 NG |
258 | OPAL_MSG_ASYNC_COMP = 0, /* params[0] = token, params[1] = rc, |
259 | * additional params function-specific | |
260 | */ | |
24366360 MS |
261 | OPAL_MSG_MEM_ERR, |
262 | OPAL_MSG_EPOW, | |
263 | OPAL_MSG_SHUTDOWN, | |
264 | OPAL_MSG_TYPE_MAX, | |
14a43e69 BH |
265 | }; |
266 | ||
267 | /* Machine check related definitions */ | |
268 | enum OpalMCE_Version { | |
269 | OpalMCE_V1 = 1, | |
270 | }; | |
271 | ||
272 | enum OpalMCE_Severity { | |
273 | OpalMCE_SEV_NO_ERROR = 0, | |
274 | OpalMCE_SEV_WARNING = 1, | |
275 | OpalMCE_SEV_ERROR_SYNC = 2, | |
276 | OpalMCE_SEV_FATAL = 3, | |
277 | }; | |
278 | ||
279 | enum OpalMCE_Disposition { | |
280 | OpalMCE_DISPOSITION_RECOVERED = 0, | |
281 | OpalMCE_DISPOSITION_NOT_RECOVERED = 1, | |
282 | }; | |
283 | ||
284 | enum OpalMCE_Initiator { | |
285 | OpalMCE_INITIATOR_UNKNOWN = 0, | |
286 | OpalMCE_INITIATOR_CPU = 1, | |
287 | }; | |
288 | ||
289 | enum OpalMCE_ErrorType { | |
290 | OpalMCE_ERROR_TYPE_UNKNOWN = 0, | |
291 | OpalMCE_ERROR_TYPE_UE = 1, | |
292 | OpalMCE_ERROR_TYPE_SLB = 2, | |
293 | OpalMCE_ERROR_TYPE_ERAT = 3, | |
294 | OpalMCE_ERROR_TYPE_TLB = 4, | |
295 | }; | |
296 | ||
297 | enum OpalMCE_UeErrorType { | |
298 | OpalMCE_UE_ERROR_INDETERMINATE = 0, | |
299 | OpalMCE_UE_ERROR_IFETCH = 1, | |
300 | OpalMCE_UE_ERROR_PAGE_TABLE_WALK_IFETCH = 2, | |
301 | OpalMCE_UE_ERROR_LOAD_STORE = 3, | |
302 | OpalMCE_UE_ERROR_PAGE_TABLE_WALK_LOAD_STORE = 4, | |
303 | }; | |
304 | ||
305 | enum OpalMCE_SlbErrorType { | |
306 | OpalMCE_SLB_ERROR_INDETERMINATE = 0, | |
307 | OpalMCE_SLB_ERROR_PARITY = 1, | |
308 | OpalMCE_SLB_ERROR_MULTIHIT = 2, | |
309 | }; | |
310 | ||
311 | enum OpalMCE_EratErrorType { | |
312 | OpalMCE_ERAT_ERROR_INDETERMINATE = 0, | |
313 | OpalMCE_ERAT_ERROR_PARITY = 1, | |
314 | OpalMCE_ERAT_ERROR_MULTIHIT = 2, | |
315 | }; | |
316 | ||
317 | enum OpalMCE_TlbErrorType { | |
318 | OpalMCE_TLB_ERROR_INDETERMINATE = 0, | |
319 | OpalMCE_TLB_ERROR_PARITY = 1, | |
320 | OpalMCE_TLB_ERROR_MULTIHIT = 2, | |
321 | }; | |
322 | ||
323 | enum OpalThreadStatus { | |
324 | OPAL_THREAD_INACTIVE = 0x0, | |
75b93da4 BH |
325 | OPAL_THREAD_STARTED = 0x1, |
326 | OPAL_THREAD_UNAVAILABLE = 0x2 /* opal-v3 */ | |
14a43e69 BH |
327 | }; |
328 | ||
329 | enum OpalPciBusCompare { | |
330 | OpalPciBusAny = 0, /* Any bus number match */ | |
331 | OpalPciBus3Bits = 2, /* Match top 3 bits of bus number */ | |
332 | OpalPciBus4Bits = 3, /* Match top 4 bits of bus number */ | |
333 | OpalPciBus5Bits = 4, /* Match top 5 bits of bus number */ | |
334 | OpalPciBus6Bits = 5, /* Match top 6 bits of bus number */ | |
335 | OpalPciBus7Bits = 6, /* Match top 7 bits of bus number */ | |
336 | OpalPciBusAll = 7, /* Match bus number exactly */ | |
337 | }; | |
338 | ||
339 | enum OpalDeviceCompare { | |
340 | OPAL_IGNORE_RID_DEVICE_NUMBER = 0, | |
341 | OPAL_COMPARE_RID_DEVICE_NUMBER = 1 | |
342 | }; | |
343 | ||
344 | enum OpalFuncCompare { | |
345 | OPAL_IGNORE_RID_FUNCTION_NUMBER = 0, | |
346 | OPAL_COMPARE_RID_FUNCTION_NUMBER = 1 | |
347 | }; | |
348 | ||
349 | enum OpalPeAction { | |
350 | OPAL_UNMAP_PE = 0, | |
351 | OPAL_MAP_PE = 1 | |
352 | }; | |
353 | ||
f11fe552 BH |
354 | enum OpalPeltvAction { |
355 | OPAL_REMOVE_PE_FROM_DOMAIN = 0, | |
356 | OPAL_ADD_PE_TO_DOMAIN = 1 | |
357 | }; | |
358 | ||
359 | enum OpalMveEnableAction { | |
360 | OPAL_DISABLE_MVE = 0, | |
361 | OPAL_ENABLE_MVE = 1 | |
362 | }; | |
363 | ||
9be3becc | 364 | enum OpalPciResetScope { |
14a43e69 BH |
365 | OPAL_PHB_COMPLETE = 1, OPAL_PCI_LINK = 2, OPAL_PHB_ERROR = 3, |
366 | OPAL_PCI_HOT_RESET = 4, OPAL_PCI_FUNDAMENTAL_RESET = 5, | |
f11fe552 BH |
367 | OPAL_PCI_IODA_TABLE_RESET = 6, |
368 | }; | |
369 | ||
9be3becc GS |
370 | enum OpalPciReinitScope { |
371 | OPAL_REINIT_PCI_DEV = 1000 | |
372 | }; | |
373 | ||
f11fe552 BH |
374 | enum OpalPciResetState { |
375 | OPAL_DEASSERT_RESET = 0, | |
376 | OPAL_ASSERT_RESET = 1 | |
14a43e69 BH |
377 | }; |
378 | ||
f11fe552 BH |
379 | enum OpalPciMaskAction { |
380 | OPAL_UNMASK_ERROR_TYPE = 0, | |
381 | OPAL_MASK_ERROR_TYPE = 1 | |
382 | }; | |
383 | ||
384 | enum OpalSlotLedType { | |
385 | OPAL_SLOT_LED_ID_TYPE = 0, | |
386 | OPAL_SLOT_LED_FAULT_TYPE = 1 | |
387 | }; | |
388 | ||
389 | enum OpalLedAction { | |
390 | OPAL_TURN_OFF_LED = 0, | |
391 | OPAL_TURN_ON_LED = 1, | |
392 | OPAL_QUERY_LED_STATE_AFTER_BUSY = 2 | |
393 | }; | |
394 | ||
395 | enum OpalEpowStatus { | |
396 | OPAL_EPOW_NONE = 0, | |
397 | OPAL_EPOW_UPS = 1, | |
398 | OPAL_EPOW_OVER_AMBIENT_TEMP = 2, | |
399 | OPAL_EPOW_OVER_INTERNAL_TEMP = 3 | |
400 | }; | |
14a43e69 | 401 | |
cc0efb57 BH |
402 | /* |
403 | * Address cycle types for LPC accesses. These also correspond | |
404 | * to the content of the first cell of the "reg" property for | |
405 | * device nodes on the LPC bus | |
406 | */ | |
407 | enum OpalLPCAddressType { | |
408 | OPAL_LPC_MEM = 0, | |
409 | OPAL_LPC_IO = 1, | |
410 | OPAL_LPC_FW = 2, | |
411 | }; | |
412 | ||
24366360 MS |
413 | struct opal_msg { |
414 | uint32_t msg_type; | |
415 | uint32_t reserved; | |
416 | uint64_t params[8]; | |
417 | }; | |
418 | ||
14a43e69 BH |
419 | struct opal_machine_check_event { |
420 | enum OpalMCE_Version version:8; /* 0x00 */ | |
421 | uint8_t in_use; /* 0x01 */ | |
422 | enum OpalMCE_Severity severity:8; /* 0x02 */ | |
423 | enum OpalMCE_Initiator initiator:8; /* 0x03 */ | |
424 | enum OpalMCE_ErrorType error_type:8; /* 0x04 */ | |
425 | enum OpalMCE_Disposition disposition:8; /* 0x05 */ | |
426 | uint8_t reserved_1[2]; /* 0x06 */ | |
427 | uint64_t gpr3; /* 0x08 */ | |
428 | uint64_t srr0; /* 0x10 */ | |
429 | uint64_t srr1; /* 0x18 */ | |
430 | union { /* 0x20 */ | |
431 | struct { | |
432 | enum OpalMCE_UeErrorType ue_error_type:8; | |
433 | uint8_t effective_address_provided; | |
434 | uint8_t physical_address_provided; | |
435 | uint8_t reserved_1[5]; | |
436 | uint64_t effective_address; | |
437 | uint64_t physical_address; | |
438 | uint8_t reserved_2[8]; | |
439 | } ue_error; | |
440 | ||
441 | struct { | |
442 | enum OpalMCE_SlbErrorType slb_error_type:8; | |
443 | uint8_t effective_address_provided; | |
444 | uint8_t reserved_1[6]; | |
445 | uint64_t effective_address; | |
446 | uint8_t reserved_2[16]; | |
447 | } slb_error; | |
448 | ||
449 | struct { | |
450 | enum OpalMCE_EratErrorType erat_error_type:8; | |
451 | uint8_t effective_address_provided; | |
452 | uint8_t reserved_1[6]; | |
453 | uint64_t effective_address; | |
454 | uint8_t reserved_2[16]; | |
455 | } erat_error; | |
456 | ||
457 | struct { | |
458 | enum OpalMCE_TlbErrorType tlb_error_type:8; | |
459 | uint8_t effective_address_provided; | |
460 | uint8_t reserved_1[6]; | |
461 | uint64_t effective_address; | |
462 | uint8_t reserved_2[16]; | |
463 | } tlb_error; | |
464 | } u; | |
465 | }; | |
466 | ||
75eb3d9b MS |
467 | /* FSP memory errors handling */ |
468 | enum OpalMemErr_Version { | |
469 | OpalMemErr_V1 = 1, | |
470 | }; | |
471 | ||
472 | enum OpalMemErrType { | |
473 | OPAL_MEM_ERR_TYPE_RESILIENCE = 0, | |
474 | OPAL_MEM_ERR_TYPE_DYN_DALLOC, | |
475 | OPAL_MEM_ERR_TYPE_SCRUB, | |
476 | }; | |
477 | ||
478 | /* Memory Reilience error type */ | |
479 | enum OpalMemErr_ResilErrType { | |
480 | OPAL_MEM_RESILIENCE_CE = 0, | |
481 | OPAL_MEM_RESILIENCE_UE, | |
482 | OPAL_MEM_RESILIENCE_UE_SCRUB, | |
483 | }; | |
484 | ||
485 | /* Dynamic Memory Deallocation type */ | |
486 | enum OpalMemErr_DynErrType { | |
487 | OPAL_MEM_DYNAMIC_DEALLOC = 0, | |
488 | }; | |
489 | ||
490 | /* OpalMemoryErrorData->flags */ | |
491 | #define OPAL_MEM_CORRECTED_ERROR 0x0001 | |
492 | #define OPAL_MEM_THRESHOLD_EXCEEDED 0x0002 | |
493 | #define OPAL_MEM_ACK_REQUIRED 0x8000 | |
494 | ||
495 | struct OpalMemoryErrorData { | |
496 | enum OpalMemErr_Version version:8; /* 0x00 */ | |
497 | enum OpalMemErrType type:8; /* 0x01 */ | |
498 | uint16_t flags; /* 0x02 */ | |
499 | uint8_t reserved_1[4]; /* 0x04 */ | |
500 | ||
501 | union { | |
502 | /* Memory Resilience corrected/uncorrected error info */ | |
503 | struct { | |
504 | enum OpalMemErr_ResilErrType resil_err_type:8; | |
505 | uint8_t reserved_1[7]; | |
506 | uint64_t physical_address_start; | |
507 | uint64_t physical_address_end; | |
508 | } resilience; | |
509 | /* Dynamic memory deallocation error info */ | |
510 | struct { | |
511 | enum OpalMemErr_DynErrType dyn_err_type:8; | |
512 | uint8_t reserved_1[7]; | |
513 | uint64_t physical_address_start; | |
514 | uint64_t physical_address_end; | |
515 | } dyn_dealloc; | |
516 | } u; | |
517 | }; | |
518 | ||
23773230 GS |
519 | enum { |
520 | OPAL_P7IOC_DIAG_TYPE_NONE = 0, | |
521 | OPAL_P7IOC_DIAG_TYPE_RGC = 1, | |
522 | OPAL_P7IOC_DIAG_TYPE_BI = 2, | |
523 | OPAL_P7IOC_DIAG_TYPE_CI = 3, | |
524 | OPAL_P7IOC_DIAG_TYPE_MISC = 4, | |
525 | OPAL_P7IOC_DIAG_TYPE_I2C = 5, | |
526 | OPAL_P7IOC_DIAG_TYPE_LAST = 6 | |
527 | }; | |
528 | ||
529 | struct OpalIoP7IOCErrorData { | |
530 | uint16_t type; | |
531 | ||
532 | /* GEM */ | |
533 | uint64_t gemXfir; | |
534 | uint64_t gemRfir; | |
535 | uint64_t gemRirqfir; | |
536 | uint64_t gemMask; | |
537 | uint64_t gemRwof; | |
538 | ||
539 | /* LEM */ | |
540 | uint64_t lemFir; | |
541 | uint64_t lemErrMask; | |
542 | uint64_t lemAction0; | |
543 | uint64_t lemAction1; | |
544 | uint64_t lemWof; | |
545 | ||
546 | union { | |
547 | struct OpalIoP7IOCRgcErrorData { | |
548 | uint64_t rgcStatus; /* 3E1C10 */ | |
549 | uint64_t rgcLdcp; /* 3E1C18 */ | |
550 | }rgc; | |
551 | struct OpalIoP7IOCBiErrorData { | |
552 | uint64_t biLdcp0; /* 3C0100, 3C0118 */ | |
553 | uint64_t biLdcp1; /* 3C0108, 3C0120 */ | |
554 | uint64_t biLdcp2; /* 3C0110, 3C0128 */ | |
555 | uint64_t biFenceStatus; /* 3C0130, 3C0130 */ | |
556 | ||
557 | uint8_t biDownbound; /* BI Downbound or Upbound */ | |
558 | }bi; | |
559 | struct OpalIoP7IOCCiErrorData { | |
560 | uint64_t ciPortStatus; /* 3Dn008 */ | |
561 | uint64_t ciPortLdcp; /* 3Dn010 */ | |
562 | ||
563 | uint8_t ciPort; /* Index of CI port: 0/1 */ | |
564 | }ci; | |
565 | }; | |
566 | }; | |
567 | ||
f11fe552 BH |
568 | /** |
569 | * This structure defines the overlay which will be used to store PHB error | |
570 | * data upon request. | |
571 | */ | |
23773230 GS |
572 | enum { |
573 | OPAL_PHB_ERROR_DATA_VERSION_1 = 1, | |
574 | }; | |
575 | ||
576 | enum { | |
577 | OPAL_PHB_ERROR_DATA_TYPE_P7IOC = 1, | |
8c6852e0 | 578 | OPAL_PHB_ERROR_DATA_TYPE_PHB3 = 2 |
23773230 GS |
579 | }; |
580 | ||
f11fe552 BH |
581 | enum { |
582 | OPAL_P7IOC_NUM_PEST_REGS = 128, | |
8c6852e0 | 583 | OPAL_PHB3_NUM_PEST_REGS = 256 |
f11fe552 BH |
584 | }; |
585 | ||
23773230 GS |
586 | struct OpalIoPhbErrorCommon { |
587 | uint32_t version; | |
588 | uint32_t ioType; | |
589 | uint32_t len; | |
590 | }; | |
591 | ||
f11fe552 | 592 | struct OpalIoP7IOCPhbErrorData { |
23773230 GS |
593 | struct OpalIoPhbErrorCommon common; |
594 | ||
f11fe552 BH |
595 | uint32_t brdgCtl; |
596 | ||
597 | // P7IOC utl regs | |
598 | uint32_t portStatusReg; | |
599 | uint32_t rootCmplxStatus; | |
600 | uint32_t busAgentStatus; | |
601 | ||
602 | // P7IOC cfg regs | |
603 | uint32_t deviceStatus; | |
604 | uint32_t slotStatus; | |
605 | uint32_t linkStatus; | |
606 | uint32_t devCmdStatus; | |
607 | uint32_t devSecStatus; | |
608 | ||
609 | // cfg AER regs | |
610 | uint32_t rootErrorStatus; | |
611 | uint32_t uncorrErrorStatus; | |
612 | uint32_t corrErrorStatus; | |
613 | uint32_t tlpHdr1; | |
614 | uint32_t tlpHdr2; | |
615 | uint32_t tlpHdr3; | |
616 | uint32_t tlpHdr4; | |
617 | uint32_t sourceId; | |
618 | ||
619 | uint32_t rsv3; | |
620 | ||
621 | // Record data about the call to allocate a buffer. | |
622 | uint64_t errorClass; | |
623 | uint64_t correlator; | |
624 | ||
625 | //P7IOC MMIO Error Regs | |
626 | uint64_t p7iocPlssr; // n120 | |
627 | uint64_t p7iocCsr; // n110 | |
628 | uint64_t lemFir; // nC00 | |
629 | uint64_t lemErrorMask; // nC18 | |
630 | uint64_t lemWOF; // nC40 | |
631 | uint64_t phbErrorStatus; // nC80 | |
632 | uint64_t phbFirstErrorStatus; // nC88 | |
633 | uint64_t phbErrorLog0; // nCC0 | |
634 | uint64_t phbErrorLog1; // nCC8 | |
635 | uint64_t mmioErrorStatus; // nD00 | |
636 | uint64_t mmioFirstErrorStatus; // nD08 | |
637 | uint64_t mmioErrorLog0; // nD40 | |
638 | uint64_t mmioErrorLog1; // nD48 | |
639 | uint64_t dma0ErrorStatus; // nD80 | |
640 | uint64_t dma0FirstErrorStatus; // nD88 | |
641 | uint64_t dma0ErrorLog0; // nDC0 | |
642 | uint64_t dma0ErrorLog1; // nDC8 | |
643 | uint64_t dma1ErrorStatus; // nE00 | |
644 | uint64_t dma1FirstErrorStatus; // nE08 | |
645 | uint64_t dma1ErrorLog0; // nE40 | |
646 | uint64_t dma1ErrorLog1; // nE48 | |
647 | uint64_t pestA[OPAL_P7IOC_NUM_PEST_REGS]; | |
648 | uint64_t pestB[OPAL_P7IOC_NUM_PEST_REGS]; | |
649 | }; | |
650 | ||
8c6852e0 GS |
651 | struct OpalIoPhb3ErrorData { |
652 | struct OpalIoPhbErrorCommon common; | |
653 | ||
654 | uint32_t brdgCtl; | |
655 | ||
656 | /* PHB3 UTL regs */ | |
657 | uint32_t portStatusReg; | |
658 | uint32_t rootCmplxStatus; | |
659 | uint32_t busAgentStatus; | |
660 | ||
661 | /* PHB3 cfg regs */ | |
662 | uint32_t deviceStatus; | |
663 | uint32_t slotStatus; | |
664 | uint32_t linkStatus; | |
665 | uint32_t devCmdStatus; | |
666 | uint32_t devSecStatus; | |
667 | ||
668 | /* cfg AER regs */ | |
669 | uint32_t rootErrorStatus; | |
670 | uint32_t uncorrErrorStatus; | |
671 | uint32_t corrErrorStatus; | |
672 | uint32_t tlpHdr1; | |
673 | uint32_t tlpHdr2; | |
674 | uint32_t tlpHdr3; | |
675 | uint32_t tlpHdr4; | |
676 | uint32_t sourceId; | |
677 | ||
678 | uint32_t rsv3; | |
679 | ||
680 | /* Record data about the call to allocate a buffer */ | |
681 | uint64_t errorClass; | |
682 | uint64_t correlator; | |
683 | ||
684 | uint64_t nFir; /* 000 */ | |
685 | uint64_t nFirMask; /* 003 */ | |
686 | uint64_t nFirWOF; /* 008 */ | |
687 | ||
688 | /* PHB3 MMIO Error Regs */ | |
689 | uint64_t phbPlssr; /* 120 */ | |
690 | uint64_t phbCsr; /* 110 */ | |
691 | uint64_t lemFir; /* C00 */ | |
692 | uint64_t lemErrorMask; /* C18 */ | |
693 | uint64_t lemWOF; /* C40 */ | |
694 | uint64_t phbErrorStatus; /* C80 */ | |
695 | uint64_t phbFirstErrorStatus; /* C88 */ | |
696 | uint64_t phbErrorLog0; /* CC0 */ | |
697 | uint64_t phbErrorLog1; /* CC8 */ | |
698 | uint64_t mmioErrorStatus; /* D00 */ | |
699 | uint64_t mmioFirstErrorStatus; /* D08 */ | |
700 | uint64_t mmioErrorLog0; /* D40 */ | |
701 | uint64_t mmioErrorLog1; /* D48 */ | |
702 | uint64_t dma0ErrorStatus; /* D80 */ | |
703 | uint64_t dma0FirstErrorStatus; /* D88 */ | |
704 | uint64_t dma0ErrorLog0; /* DC0 */ | |
705 | uint64_t dma0ErrorLog1; /* DC8 */ | |
706 | uint64_t dma1ErrorStatus; /* E00 */ | |
707 | uint64_t dma1FirstErrorStatus; /* E08 */ | |
708 | uint64_t dma1ErrorLog0; /* E40 */ | |
709 | uint64_t dma1ErrorLog1; /* E48 */ | |
710 | uint64_t pestA[OPAL_PHB3_NUM_PEST_REGS]; | |
711 | uint64_t pestB[OPAL_PHB3_NUM_PEST_REGS]; | |
712 | }; | |
713 | ||
14a43e69 | 714 | typedef struct oppanel_line { |
f11fe552 BH |
715 | const char * line; |
716 | uint64_t line_len; | |
14a43e69 BH |
717 | } oppanel_line_t; |
718 | ||
6f68b5e2 VH |
719 | /* /sys/firmware/opal */ |
720 | extern struct kobject *opal_kobj; | |
721 | ||
14a43e69 | 722 | /* API functions */ |
4f89363b | 723 | int64_t opal_console_write(int64_t term_number, __be64 *length, |
14a43e69 | 724 | const uint8_t *buffer); |
4f89363b | 725 | int64_t opal_console_read(int64_t term_number, __be64 *length, |
14a43e69 BH |
726 | uint8_t *buffer); |
727 | int64_t opal_console_write_buffer_space(int64_t term_number, | |
4f89363b | 728 | __be64 *length); |
6feff6d4 AB |
729 | int64_t opal_rtc_read(__be32 *year_month_day, |
730 | __be64 *hour_minute_second_millisecond); | |
14a43e69 BH |
731 | int64_t opal_rtc_write(uint32_t year_month_day, |
732 | uint64_t hour_minute_second_millisecond); | |
733 | int64_t opal_cec_power_down(uint64_t request); | |
734 | int64_t opal_cec_reboot(void); | |
735 | int64_t opal_read_nvram(uint64_t buffer, uint64_t size, uint64_t offset); | |
736 | int64_t opal_write_nvram(uint64_t buffer, uint64_t size, uint64_t offset); | |
5e4da530 | 737 | int64_t opal_handle_interrupt(uint64_t isn, __be64 *outstanding_event_mask); |
4f89363b | 738 | int64_t opal_poll_events(__be64 *outstanding_event_mask); |
14a43e69 BH |
739 | int64_t opal_pci_set_hub_tce_memory(uint64_t hub_id, uint64_t tce_mem_addr, |
740 | uint64_t tce_mem_size); | |
741 | int64_t opal_pci_set_phb_tce_memory(uint64_t phb_id, uint64_t tce_mem_addr, | |
742 | uint64_t tce_mem_size); | |
743 | int64_t opal_pci_config_read_byte(uint64_t phb_id, uint64_t bus_dev_func, | |
744 | uint64_t offset, uint8_t *data); | |
745 | int64_t opal_pci_config_read_half_word(uint64_t phb_id, uint64_t bus_dev_func, | |
5e4da530 | 746 | uint64_t offset, __be16 *data); |
14a43e69 | 747 | int64_t opal_pci_config_read_word(uint64_t phb_id, uint64_t bus_dev_func, |
5e4da530 | 748 | uint64_t offset, __be32 *data); |
14a43e69 BH |
749 | int64_t opal_pci_config_write_byte(uint64_t phb_id, uint64_t bus_dev_func, |
750 | uint64_t offset, uint8_t data); | |
751 | int64_t opal_pci_config_write_half_word(uint64_t phb_id, uint64_t bus_dev_func, | |
752 | uint64_t offset, uint16_t data); | |
753 | int64_t opal_pci_config_write_word(uint64_t phb_id, uint64_t bus_dev_func, | |
754 | uint64_t offset, uint32_t data); | |
755 | int64_t opal_set_xive(uint32_t isn, uint16_t server, uint8_t priority); | |
5e4da530 | 756 | int64_t opal_get_xive(uint32_t isn, __be16 *server, uint8_t *priority); |
14a43e69 BH |
757 | int64_t opal_register_exception_handler(uint64_t opal_exception, |
758 | uint64_t handler_address, | |
759 | uint64_t glue_cache_line); | |
760 | int64_t opal_pci_eeh_freeze_status(uint64_t phb_id, uint64_t pe_number, | |
761 | uint8_t *freeze_state, | |
5e4da530 AB |
762 | __be16 *pci_error_type, |
763 | __be64 *phb_status); | |
14a43e69 BH |
764 | int64_t opal_pci_eeh_freeze_clear(uint64_t phb_id, uint64_t pe_number, |
765 | uint64_t eeh_action_token); | |
766 | int64_t opal_pci_shpc(uint64_t phb_id, uint64_t shpc_action, uint8_t *state); | |
767 | ||
768 | ||
769 | ||
770 | int64_t opal_pci_phb_mmio_enable(uint64_t phb_id, uint16_t window_type, | |
771 | uint16_t window_num, uint16_t enable); | |
772 | int64_t opal_pci_set_phb_mem_window(uint64_t phb_id, uint16_t window_type, | |
773 | uint16_t window_num, | |
774 | uint64_t starting_real_address, | |
775 | uint64_t starting_pci_address, | |
776 | uint16_t segment_size); | |
777 | int64_t opal_pci_map_pe_mmio_window(uint64_t phb_id, uint16_t pe_number, | |
778 | uint16_t window_type, uint16_t window_num, | |
779 | uint16_t segment_num); | |
780 | int64_t opal_pci_set_phb_table_memory(uint64_t phb_id, uint64_t rtt_addr, | |
781 | uint64_t ivt_addr, uint64_t ivt_len, | |
782 | uint64_t reject_array_addr, | |
783 | uint64_t peltv_addr); | |
784 | int64_t opal_pci_set_pe(uint64_t phb_id, uint64_t pe_number, uint64_t bus_dev_func, | |
785 | uint8_t bus_compare, uint8_t dev_compare, uint8_t func_compare, | |
786 | uint8_t pe_action); | |
787 | int64_t opal_pci_set_peltv(uint64_t phb_id, uint32_t parent_pe, uint32_t child_pe, | |
788 | uint8_t state); | |
789 | int64_t opal_pci_set_mve(uint64_t phb_id, uint32_t mve_number, uint32_t pe_number); | |
790 | int64_t opal_pci_set_mve_enable(uint64_t phb_id, uint32_t mve_number, | |
791 | uint32_t state); | |
792 | int64_t opal_pci_get_xive_reissue(uint64_t phb_id, uint32_t xive_number, | |
793 | uint8_t *p_bit, uint8_t *q_bit); | |
794 | int64_t opal_pci_set_xive_reissue(uint64_t phb_id, uint32_t xive_number, | |
795 | uint8_t p_bit, uint8_t q_bit); | |
137436c9 | 796 | int64_t opal_pci_msi_eoi(uint64_t phb_id, uint32_t hw_irq); |
14a43e69 BH |
797 | int64_t opal_pci_set_xive_pe(uint64_t phb_id, uint32_t pe_number, |
798 | uint32_t xive_num); | |
799 | int64_t opal_get_xive_source(uint64_t phb_id, uint32_t xive_num, | |
5e4da530 | 800 | __be32 *interrupt_source_number); |
14a43e69 | 801 | int64_t opal_get_msi_32(uint64_t phb_id, uint32_t mve_number, uint32_t xive_num, |
5e4da530 AB |
802 | uint8_t msi_range, __be32 *msi_address, |
803 | __be32 *message_data); | |
14a43e69 BH |
804 | int64_t opal_get_msi_64(uint64_t phb_id, uint32_t mve_number, |
805 | uint32_t xive_num, uint8_t msi_range, | |
5e4da530 | 806 | __be64 *msi_address, __be32 *message_data); |
14a43e69 BH |
807 | int64_t opal_start_cpu(uint64_t thread_number, uint64_t start_address); |
808 | int64_t opal_query_cpu_status(uint64_t thread_number, uint8_t *thread_status); | |
809 | int64_t opal_write_oppanel(oppanel_line_t *lines, uint64_t num_lines); | |
810 | int64_t opal_pci_map_pe_dma_window(uint64_t phb_id, uint16_t pe_number, uint16_t window_id, | |
811 | uint16_t tce_levels, uint64_t tce_table_addr, | |
812 | uint64_t tce_table_size, uint64_t tce_page_size); | |
813 | int64_t opal_pci_map_pe_dma_window_real(uint64_t phb_id, uint16_t pe_number, | |
814 | uint16_t dma_window_number, uint64_t pci_start_addr, | |
815 | uint64_t pci_mem_size); | |
816 | int64_t opal_pci_reset(uint64_t phb_id, uint8_t reset_scope, uint8_t assert_state); | |
817 | ||
23773230 GS |
818 | int64_t opal_pci_get_hub_diag_data(uint64_t hub_id, void *diag_buffer, |
819 | uint64_t diag_buffer_len); | |
820 | int64_t opal_pci_get_phb_diag_data(uint64_t phb_id, void *diag_buffer, | |
821 | uint64_t diag_buffer_len); | |
822 | int64_t opal_pci_get_phb_diag_data2(uint64_t phb_id, void *diag_buffer, | |
823 | uint64_t diag_buffer_len); | |
f11fe552 | 824 | int64_t opal_pci_fence_phb(uint64_t phb_id); |
9be3becc | 825 | int64_t opal_pci_reinit(uint64_t phb_id, uint64_t reinit_scope, uint64_t data); |
f11fe552 BH |
826 | int64_t opal_pci_mask_pe_error(uint64_t phb_id, uint16_t pe_number, uint8_t error_type, uint8_t mask_action); |
827 | int64_t opal_set_slot_led_status(uint64_t phb_id, uint64_t slot_id, uint8_t led_type, uint8_t led_action); | |
5e4da530 | 828 | int64_t opal_get_epow_status(__be64 *status); |
f11fe552 | 829 | int64_t opal_set_system_attention_led(uint8_t led_action); |
23773230 GS |
830 | int64_t opal_pci_next_error(uint64_t phb_id, uint64_t *first_frozen_pe, |
831 | uint16_t *pci_error_type, uint16_t *severity); | |
832 | int64_t opal_pci_poll(uint64_t phb_id); | |
13906db6 | 833 | int64_t opal_return_cpu(void); |
f11fe552 | 834 | |
2f3f38e4 BH |
835 | int64_t opal_xscom_read(uint32_t gcid, uint64_t pcb_addr, __be64 *val); |
836 | int64_t opal_xscom_write(uint32_t gcid, uint64_t pcb_addr, uint64_t val); | |
cc0efb57 BH |
837 | |
838 | int64_t opal_lpc_write(uint32_t chip_id, enum OpalLPCAddressType addr_type, | |
839 | uint32_t addr, uint32_t data, uint32_t sz); | |
840 | int64_t opal_lpc_read(uint32_t chip_id, enum OpalLPCAddressType addr_type, | |
803c2d2f | 841 | uint32_t addr, __be32 *data, uint32_t sz); |
774fea1a SS |
842 | |
843 | int64_t opal_read_elog(uint64_t buffer, size_t size, uint64_t log_id); | |
844 | int64_t opal_get_elog_size(uint64_t *log_id, size_t *size, uint64_t *elog_type); | |
845 | int64_t opal_write_elog(uint64_t buffer, uint64_t size, uint64_t offset); | |
846 | int64_t opal_send_ack_elog(uint64_t log_id); | |
847 | void opal_resend_pending_logs(void); | |
848 | ||
50bd6153 VH |
849 | int64_t opal_validate_flash(uint64_t buffer, uint32_t *size, uint32_t *result); |
850 | int64_t opal_manage_flash(uint8_t op); | |
851 | int64_t opal_update_flash(uint64_t blk_list); | |
c7e64b9c SS |
852 | int64_t opal_dump_init(uint8_t dump_type); |
853 | int64_t opal_dump_info(uint32_t *dump_id, uint32_t *dump_size); | |
854 | int64_t opal_dump_info2(uint32_t *dump_id, uint32_t *dump_size, uint32_t *dump_type); | |
855 | int64_t opal_dump_read(uint32_t dump_id, uint64_t buffer); | |
856 | int64_t opal_dump_ack(uint32_t dump_id); | |
857 | int64_t opal_dump_resend_notification(void); | |
cc0efb57 | 858 | |
24366360 MS |
859 | int64_t opal_get_msg(uint64_t buffer, size_t size); |
860 | int64_t opal_check_completion(uint64_t buffer, size_t size, uint64_t token); | |
f7d98d18 | 861 | int64_t opal_sync_host_reboot(void); |
24366360 | 862 | |
14a43e69 BH |
863 | /* Internal functions */ |
864 | extern int early_init_dt_scan_opal(unsigned long node, const char *uname, int depth, void *data); | |
55672ecf MS |
865 | extern int early_init_dt_scan_recoverable_ranges(unsigned long node, |
866 | const char *uname, int depth, void *data); | |
14a43e69 BH |
867 | |
868 | extern int opal_get_chars(uint32_t vtermno, char *buf, int count); | |
869 | extern int opal_put_chars(uint32_t vtermno, const char *buf, int total_len); | |
870 | ||
871 | extern void hvc_opal_init_early(void); | |
872 | ||
873 | /* Internal functions */ | |
874 | extern int early_init_dt_scan_opal(unsigned long node, const char *uname, | |
875 | int depth, void *data); | |
876 | ||
1bc98de2 | 877 | extern int opal_notifier_register(struct notifier_block *nb); |
24366360 MS |
878 | extern int opal_message_notifier_register(enum OpalMessageType msg_type, |
879 | struct notifier_block *nb); | |
1bc98de2 GS |
880 | extern void opal_notifier_enable(void); |
881 | extern void opal_notifier_disable(void); | |
882 | extern void opal_notifier_update_evt(uint64_t evt_mask, uint64_t evt_val); | |
883 | ||
daea1175 BH |
884 | extern int opal_get_chars(uint32_t vtermno, char *buf, int count); |
885 | extern int opal_put_chars(uint32_t vtermno, const char *buf, int total_len); | |
886 | ||
8d724823 NG |
887 | extern int __opal_async_get_token(void); |
888 | extern int opal_async_get_token_interruptible(void); | |
889 | extern int __opal_async_release_token(int token); | |
890 | extern int opal_async_release_token(int token); | |
891 | extern int opal_async_wait_response(uint64_t token, struct opal_msg *msg); | |
892 | ||
daea1175 BH |
893 | extern void hvc_opal_init_early(void); |
894 | ||
628daa8d BH |
895 | struct rtc_time; |
896 | extern int opal_set_rtc_time(struct rtc_time *tm); | |
897 | extern void opal_get_rtc_time(struct rtc_time *tm); | |
898 | extern unsigned long opal_get_boot_time(void); | |
899 | extern void opal_nvram_init(void); | |
50bd6153 | 900 | extern void opal_flash_init(void); |
774fea1a | 901 | extern int opal_elog_init(void); |
c7e64b9c | 902 | extern void opal_platform_dump_init(void); |
628daa8d | 903 | |
ed79ba9e | 904 | extern int opal_machine_check(struct pt_regs *regs); |
55672ecf | 905 | extern bool opal_mce_check_early_recovery(struct pt_regs *regs); |
ed79ba9e | 906 | |
73ed148a BH |
907 | extern void opal_shutdown(void); |
908 | ||
3fafe9c2 BH |
909 | extern void opal_lpc_init(void); |
910 | ||
14a43e69 | 911 | #endif /* __ASSEMBLY__ */ |
27f44888 BH |
912 | |
913 | #endif /* __OPAL_H */ |