aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/opal.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/include/asm/opal.h')
-rw-r--r--arch/powerpc/include/asm/opal.h140
1 files changed, 119 insertions, 21 deletions
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index cbb9305ab15a..029fe85722aa 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -117,7 +117,13 @@ extern int opal_enter_rtas(struct rtas_args *args,
117#define OPAL_SET_SLOT_LED_STATUS 55 117#define OPAL_SET_SLOT_LED_STATUS 55
118#define OPAL_GET_EPOW_STATUS 56 118#define OPAL_GET_EPOW_STATUS 56
119#define OPAL_SET_SYSTEM_ATTENTION_LED 57 119#define OPAL_SET_SYSTEM_ATTENTION_LED 57
120#define OPAL_RESERVED1 58
121#define OPAL_RESERVED2 59
122#define OPAL_PCI_NEXT_ERROR 60
123#define OPAL_PCI_EEH_FREEZE_STATUS2 61
124#define OPAL_PCI_POLL 62
120#define OPAL_PCI_MSI_EOI 63 125#define OPAL_PCI_MSI_EOI 63
126#define OPAL_PCI_GET_PHB_DIAG_DATA2 64
121 127
122#ifndef __ASSEMBLY__ 128#ifndef __ASSEMBLY__
123 129
@@ -125,6 +131,7 @@ extern int opal_enter_rtas(struct rtas_args *args,
125enum OpalVendorApiTokens { 131enum OpalVendorApiTokens {
126 OPAL_START_VENDOR_API_RANGE = 1000, OPAL_END_VENDOR_API_RANGE = 1999 132 OPAL_START_VENDOR_API_RANGE = 1000, OPAL_END_VENDOR_API_RANGE = 1999
127}; 133};
134
128enum OpalFreezeState { 135enum OpalFreezeState {
129 OPAL_EEH_STOPPED_NOT_FROZEN = 0, 136 OPAL_EEH_STOPPED_NOT_FROZEN = 0,
130 OPAL_EEH_STOPPED_MMIO_FREEZE = 1, 137 OPAL_EEH_STOPPED_MMIO_FREEZE = 1,
@@ -134,55 +141,69 @@ enum OpalFreezeState {
134 OPAL_EEH_STOPPED_TEMP_UNAVAIL = 5, 141 OPAL_EEH_STOPPED_TEMP_UNAVAIL = 5,
135 OPAL_EEH_STOPPED_PERM_UNAVAIL = 6 142 OPAL_EEH_STOPPED_PERM_UNAVAIL = 6
136}; 143};
144
137enum OpalEehFreezeActionToken { 145enum OpalEehFreezeActionToken {
138 OPAL_EEH_ACTION_CLEAR_FREEZE_MMIO = 1, 146 OPAL_EEH_ACTION_CLEAR_FREEZE_MMIO = 1,
139 OPAL_EEH_ACTION_CLEAR_FREEZE_DMA = 2, 147 OPAL_EEH_ACTION_CLEAR_FREEZE_DMA = 2,
140 OPAL_EEH_ACTION_CLEAR_FREEZE_ALL = 3 148 OPAL_EEH_ACTION_CLEAR_FREEZE_ALL = 3
141}; 149};
150
142enum OpalPciStatusToken { 151enum OpalPciStatusToken {
143 OPAL_EEH_PHB_NO_ERROR = 0, 152 OPAL_EEH_NO_ERROR = 0,
144 OPAL_EEH_PHB_FATAL = 1, 153 OPAL_EEH_IOC_ERROR = 1,
145 OPAL_EEH_PHB_RECOVERABLE = 2, 154 OPAL_EEH_PHB_ERROR = 2,
146 OPAL_EEH_PHB_BUS_ERROR = 3, 155 OPAL_EEH_PE_ERROR = 3,
147 OPAL_EEH_PCI_NO_DEVSEL = 4, 156 OPAL_EEH_PE_MMIO_ERROR = 4,
148 OPAL_EEH_PCI_TA = 5, 157 OPAL_EEH_PE_DMA_ERROR = 5
149 OPAL_EEH_PCIEX_UR = 6,
150 OPAL_EEH_PCIEX_CA = 7,
151 OPAL_EEH_PCI_MMIO_ERROR = 8,
152 OPAL_EEH_PCI_DMA_ERROR = 9
153}; 158};
159
160enum OpalPciErrorSeverity {
161 OPAL_EEH_SEV_NO_ERROR = 0,
162 OPAL_EEH_SEV_IOC_DEAD = 1,
163 OPAL_EEH_SEV_PHB_DEAD = 2,
164 OPAL_EEH_SEV_PHB_FENCED = 3,
165 OPAL_EEH_SEV_PE_ER = 4,
166 OPAL_EEH_SEV_INF = 5
167};
168
154enum OpalShpcAction { 169enum OpalShpcAction {
155 OPAL_SHPC_GET_LINK_STATE = 0, 170 OPAL_SHPC_GET_LINK_STATE = 0,
156 OPAL_SHPC_GET_SLOT_STATE = 1 171 OPAL_SHPC_GET_SLOT_STATE = 1
157}; 172};
173
158enum OpalShpcLinkState { 174enum OpalShpcLinkState {
159 OPAL_SHPC_LINK_DOWN = 0, 175 OPAL_SHPC_LINK_DOWN = 0,
160 OPAL_SHPC_LINK_UP = 1 176 OPAL_SHPC_LINK_UP = 1
161}; 177};
178
162enum OpalMmioWindowType { 179enum OpalMmioWindowType {
163 OPAL_M32_WINDOW_TYPE = 1, 180 OPAL_M32_WINDOW_TYPE = 1,
164 OPAL_M64_WINDOW_TYPE = 2, 181 OPAL_M64_WINDOW_TYPE = 2,
165 OPAL_IO_WINDOW_TYPE = 3 182 OPAL_IO_WINDOW_TYPE = 3
166}; 183};
184
167enum OpalShpcSlotState { 185enum OpalShpcSlotState {
168 OPAL_SHPC_DEV_NOT_PRESENT = 0, 186 OPAL_SHPC_DEV_NOT_PRESENT = 0,
169 OPAL_SHPC_DEV_PRESENT = 1 187 OPAL_SHPC_DEV_PRESENT = 1
170}; 188};
189
171enum OpalExceptionHandler { 190enum OpalExceptionHandler {
172 OPAL_MACHINE_CHECK_HANDLER = 1, 191 OPAL_MACHINE_CHECK_HANDLER = 1,
173 OPAL_HYPERVISOR_MAINTENANCE_HANDLER = 2, 192 OPAL_HYPERVISOR_MAINTENANCE_HANDLER = 2,
174 OPAL_SOFTPATCH_HANDLER = 3 193 OPAL_SOFTPATCH_HANDLER = 3
175}; 194};
195
176enum OpalPendingState { 196enum OpalPendingState {
177 OPAL_EVENT_OPAL_INTERNAL = 0x1, 197 OPAL_EVENT_OPAL_INTERNAL = 0x1,
178 OPAL_EVENT_NVRAM = 0x2, 198 OPAL_EVENT_NVRAM = 0x2,
179 OPAL_EVENT_RTC = 0x4, 199 OPAL_EVENT_RTC = 0x4,
180 OPAL_EVENT_CONSOLE_OUTPUT = 0x8, 200 OPAL_EVENT_CONSOLE_OUTPUT = 0x8,
181 OPAL_EVENT_CONSOLE_INPUT = 0x10, 201 OPAL_EVENT_CONSOLE_INPUT = 0x10,
182 OPAL_EVENT_ERROR_LOG_AVAIL = 0x20, 202 OPAL_EVENT_ERROR_LOG_AVAIL = 0x20,
183 OPAL_EVENT_ERROR_LOG = 0x40, 203 OPAL_EVENT_ERROR_LOG = 0x40,
184 OPAL_EVENT_EPOW = 0x80, 204 OPAL_EVENT_EPOW = 0x80,
185 OPAL_EVENT_LED_STATUS = 0x100 205 OPAL_EVENT_LED_STATUS = 0x100,
206 OPAL_EVENT_PCI_ERROR = 0x200
186}; 207};
187 208
188/* Machine check related definitions */ 209/* Machine check related definitions */
@@ -364,15 +385,80 @@ struct opal_machine_check_event {
364 } u; 385 } u;
365}; 386};
366 387
388enum {
389 OPAL_P7IOC_DIAG_TYPE_NONE = 0,
390 OPAL_P7IOC_DIAG_TYPE_RGC = 1,
391 OPAL_P7IOC_DIAG_TYPE_BI = 2,
392 OPAL_P7IOC_DIAG_TYPE_CI = 3,
393 OPAL_P7IOC_DIAG_TYPE_MISC = 4,
394 OPAL_P7IOC_DIAG_TYPE_I2C = 5,
395 OPAL_P7IOC_DIAG_TYPE_LAST = 6
396};
397
398struct OpalIoP7IOCErrorData {
399 uint16_t type;
400
401 /* GEM */
402 uint64_t gemXfir;
403 uint64_t gemRfir;
404 uint64_t gemRirqfir;
405 uint64_t gemMask;
406 uint64_t gemRwof;
407
408 /* LEM */
409 uint64_t lemFir;
410 uint64_t lemErrMask;
411 uint64_t lemAction0;
412 uint64_t lemAction1;
413 uint64_t lemWof;
414
415 union {
416 struct OpalIoP7IOCRgcErrorData {
417 uint64_t rgcStatus; /* 3E1C10 */
418 uint64_t rgcLdcp; /* 3E1C18 */
419 }rgc;
420 struct OpalIoP7IOCBiErrorData {
421 uint64_t biLdcp0; /* 3C0100, 3C0118 */
422 uint64_t biLdcp1; /* 3C0108, 3C0120 */
423 uint64_t biLdcp2; /* 3C0110, 3C0128 */
424 uint64_t biFenceStatus; /* 3C0130, 3C0130 */
425
426 uint8_t biDownbound; /* BI Downbound or Upbound */
427 }bi;
428 struct OpalIoP7IOCCiErrorData {
429 uint64_t ciPortStatus; /* 3Dn008 */
430 uint64_t ciPortLdcp; /* 3Dn010 */
431
432 uint8_t ciPort; /* Index of CI port: 0/1 */
433 }ci;
434 };
435};
436
367/** 437/**
368 * This structure defines the overlay which will be used to store PHB error 438 * This structure defines the overlay which will be used to store PHB error
369 * data upon request. 439 * data upon request.
370 */ 440 */
371enum { 441enum {
442 OPAL_PHB_ERROR_DATA_VERSION_1 = 1,
443};
444
445enum {
446 OPAL_PHB_ERROR_DATA_TYPE_P7IOC = 1,
447};
448
449enum {
372 OPAL_P7IOC_NUM_PEST_REGS = 128, 450 OPAL_P7IOC_NUM_PEST_REGS = 128,
373}; 451};
374 452
453struct OpalIoPhbErrorCommon {
454 uint32_t version;
455 uint32_t ioType;
456 uint32_t len;
457};
458
375struct OpalIoP7IOCPhbErrorData { 459struct OpalIoP7IOCPhbErrorData {
460 struct OpalIoPhbErrorCommon common;
461
376 uint32_t brdgCtl; 462 uint32_t brdgCtl;
377 463
378 // P7IOC utl regs 464 // P7IOC utl regs
@@ -530,14 +616,21 @@ int64_t opal_pci_map_pe_dma_window_real(uint64_t phb_id, uint16_t pe_number,
530 uint64_t pci_mem_size); 616 uint64_t pci_mem_size);
531int64_t opal_pci_reset(uint64_t phb_id, uint8_t reset_scope, uint8_t assert_state); 617int64_t opal_pci_reset(uint64_t phb_id, uint8_t reset_scope, uint8_t assert_state);
532 618
533int64_t opal_pci_get_hub_diag_data(uint64_t hub_id, void *diag_buffer, uint64_t diag_buffer_len); 619int64_t opal_pci_get_hub_diag_data(uint64_t hub_id, void *diag_buffer,
534int64_t opal_pci_get_phb_diag_data(uint64_t phb_id, void *diag_buffer, uint64_t diag_buffer_len); 620 uint64_t diag_buffer_len);
621int64_t opal_pci_get_phb_diag_data(uint64_t phb_id, void *diag_buffer,
622 uint64_t diag_buffer_len);
623int64_t opal_pci_get_phb_diag_data2(uint64_t phb_id, void *diag_buffer,
624 uint64_t diag_buffer_len);
535int64_t opal_pci_fence_phb(uint64_t phb_id); 625int64_t opal_pci_fence_phb(uint64_t phb_id);
536int64_t opal_pci_reinit(uint64_t phb_id, uint8_t reinit_scope); 626int64_t opal_pci_reinit(uint64_t phb_id, uint8_t reinit_scope);
537int64_t opal_pci_mask_pe_error(uint64_t phb_id, uint16_t pe_number, uint8_t error_type, uint8_t mask_action); 627int64_t opal_pci_mask_pe_error(uint64_t phb_id, uint16_t pe_number, uint8_t error_type, uint8_t mask_action);
538int64_t opal_set_slot_led_status(uint64_t phb_id, uint64_t slot_id, uint8_t led_type, uint8_t led_action); 628int64_t opal_set_slot_led_status(uint64_t phb_id, uint64_t slot_id, uint8_t led_type, uint8_t led_action);
539int64_t opal_get_epow_status(uint64_t *status); 629int64_t opal_get_epow_status(uint64_t *status);
540int64_t opal_set_system_attention_led(uint8_t led_action); 630int64_t opal_set_system_attention_led(uint8_t led_action);
631int64_t opal_pci_next_error(uint64_t phb_id, uint64_t *first_frozen_pe,
632 uint16_t *pci_error_type, uint16_t *severity);
633int64_t opal_pci_poll(uint64_t phb_id);
541 634
542/* Internal functions */ 635/* Internal functions */
543extern int early_init_dt_scan_opal(unsigned long node, const char *uname, int depth, void *data); 636extern int early_init_dt_scan_opal(unsigned long node, const char *uname, int depth, void *data);
@@ -551,6 +644,11 @@ extern void hvc_opal_init_early(void);
551extern int early_init_dt_scan_opal(unsigned long node, const char *uname, 644extern int early_init_dt_scan_opal(unsigned long node, const char *uname,
552 int depth, void *data); 645 int depth, void *data);
553 646
647extern int opal_notifier_register(struct notifier_block *nb);
648extern void opal_notifier_enable(void);
649extern void opal_notifier_disable(void);
650extern void opal_notifier_update_evt(uint64_t evt_mask, uint64_t evt_val);
651
554extern int opal_get_chars(uint32_t vtermno, char *buf, int count); 652extern int opal_get_chars(uint32_t vtermno, char *buf, int count);
555extern int opal_put_chars(uint32_t vtermno, const char *buf, int total_len); 653extern int opal_put_chars(uint32_t vtermno, const char *buf, int total_len);
556 654