Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/powernv: Update OPAL interfaces

This adds some more interfaces for OPAL v2

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

+137 -6
+127 -4
arch/powerpc/include/asm/opal.h
··· 109 109 #define OPAL_PCI_MAP_PE_DMA_WINDOW 44 110 110 #define OPAL_PCI_MAP_PE_DMA_WINDOW_REAL 45 111 111 #define OPAL_PCI_RESET 49 112 + #define OPAL_PCI_GET_HUB_DIAG_DATA 50 113 + #define OPAL_PCI_GET_PHB_DIAG_DATA 51 114 + #define OPAL_PCI_FENCE_PHB 52 115 + #define OPAL_PCI_REINIT 53 116 + #define OPAL_PCI_MASK_PE_ERROR 54 117 + #define OPAL_SET_SLOT_LED_STATUS 55 118 + #define OPAL_GET_EPOW_STATUS 56 119 + #define OPAL_SET_SYSTEM_ATTENTION_LED 57 112 120 113 121 #ifndef __ASSEMBLY__ 114 122 ··· 177 169 OPAL_EVENT_NVRAM = 0x2, 178 170 OPAL_EVENT_RTC = 0x4, 179 171 OPAL_EVENT_CONSOLE_OUTPUT = 0x8, 180 - OPAL_EVENT_CONSOLE_INPUT = 0x10 172 + OPAL_EVENT_CONSOLE_INPUT = 0x10, 173 + OPAL_EVENT_ERROR_LOG_AVAIL = 0x20, 174 + OPAL_EVENT_ERROR_LOG = 0x40, 175 + OPAL_EVENT_EPOW = 0x80, 176 + OPAL_EVENT_LED_STATUS = 0x100 181 177 }; 182 178 183 179 /* Machine check related definitions */ ··· 270 258 OPAL_MAP_PE = 1 271 259 }; 272 260 261 + enum OpalPeltvAction { 262 + OPAL_REMOVE_PE_FROM_DOMAIN = 0, 263 + OPAL_ADD_PE_TO_DOMAIN = 1 264 + }; 265 + 266 + enum OpalMveEnableAction { 267 + OPAL_DISABLE_MVE = 0, 268 + OPAL_ENABLE_MVE = 1 269 + }; 270 + 273 271 enum OpalPciResetAndReinitScope { 274 272 OPAL_PHB_COMPLETE = 1, OPAL_PCI_LINK = 2, OPAL_PHB_ERROR = 3, 275 273 OPAL_PCI_HOT_RESET = 4, OPAL_PCI_FUNDAMENTAL_RESET = 5, 276 - OPAL_PCI_IODA_RESET = 6, 274 + OPAL_PCI_IODA_TABLE_RESET = 6, 277 275 }; 278 276 279 - enum OpalPciResetState { OPAL_DEASSERT_RESET = 0, OPAL_ASSERT_RESET = 1 }; 277 + enum OpalPciResetState { 278 + OPAL_DEASSERT_RESET = 0, 279 + OPAL_ASSERT_RESET = 1 280 + }; 281 + 282 + enum OpalPciMaskAction { 283 + OPAL_UNMASK_ERROR_TYPE = 0, 284 + OPAL_MASK_ERROR_TYPE = 1 285 + }; 286 + 287 + enum OpalSlotLedType { 288 + OPAL_SLOT_LED_ID_TYPE = 0, 289 + OPAL_SLOT_LED_FAULT_TYPE = 1 290 + }; 291 + 292 + enum OpalLedAction { 293 + OPAL_TURN_OFF_LED = 0, 294 + OPAL_TURN_ON_LED = 1, 295 + OPAL_QUERY_LED_STATE_AFTER_BUSY = 2 296 + }; 297 + 298 + enum OpalEpowStatus { 299 + OPAL_EPOW_NONE = 0, 300 + OPAL_EPOW_UPS = 1, 301 + OPAL_EPOW_OVER_AMBIENT_TEMP = 2, 302 + OPAL_EPOW_OVER_INTERNAL_TEMP = 3 303 + }; 280 304 281 305 struct opal_machine_check_event { 282 306 enum OpalMCE_Version version:8; /* 0x00 */ ··· 362 314 } u; 363 315 }; 364 316 317 + /** 318 + * This structure defines the overlay which will be used to store PHB error 319 + * data upon request. 320 + */ 321 + enum { 322 + OPAL_P7IOC_NUM_PEST_REGS = 128, 323 + }; 324 + 325 + struct OpalIoP7IOCPhbErrorData { 326 + uint32_t brdgCtl; 327 + 328 + // P7IOC utl regs 329 + uint32_t portStatusReg; 330 + uint32_t rootCmplxStatus; 331 + uint32_t busAgentStatus; 332 + 333 + // P7IOC cfg regs 334 + uint32_t deviceStatus; 335 + uint32_t slotStatus; 336 + uint32_t linkStatus; 337 + uint32_t devCmdStatus; 338 + uint32_t devSecStatus; 339 + 340 + // cfg AER regs 341 + uint32_t rootErrorStatus; 342 + uint32_t uncorrErrorStatus; 343 + uint32_t corrErrorStatus; 344 + uint32_t tlpHdr1; 345 + uint32_t tlpHdr2; 346 + uint32_t tlpHdr3; 347 + uint32_t tlpHdr4; 348 + uint32_t sourceId; 349 + 350 + uint32_t rsv3; 351 + 352 + // Record data about the call to allocate a buffer. 353 + uint64_t errorClass; 354 + uint64_t correlator; 355 + 356 + //P7IOC MMIO Error Regs 357 + uint64_t p7iocPlssr; // n120 358 + uint64_t p7iocCsr; // n110 359 + uint64_t lemFir; // nC00 360 + uint64_t lemErrorMask; // nC18 361 + uint64_t lemWOF; // nC40 362 + uint64_t phbErrorStatus; // nC80 363 + uint64_t phbFirstErrorStatus; // nC88 364 + uint64_t phbErrorLog0; // nCC0 365 + uint64_t phbErrorLog1; // nCC8 366 + uint64_t mmioErrorStatus; // nD00 367 + uint64_t mmioFirstErrorStatus; // nD08 368 + uint64_t mmioErrorLog0; // nD40 369 + uint64_t mmioErrorLog1; // nD48 370 + uint64_t dma0ErrorStatus; // nD80 371 + uint64_t dma0FirstErrorStatus; // nD88 372 + uint64_t dma0ErrorLog0; // nDC0 373 + uint64_t dma0ErrorLog1; // nDC8 374 + uint64_t dma1ErrorStatus; // nE00 375 + uint64_t dma1FirstErrorStatus; // nE08 376 + uint64_t dma1ErrorLog0; // nE40 377 + uint64_t dma1ErrorLog1; // nE48 378 + uint64_t pestA[OPAL_P7IOC_NUM_PEST_REGS]; 379 + uint64_t pestB[OPAL_P7IOC_NUM_PEST_REGS]; 380 + }; 381 + 365 382 typedef struct oppanel_line { 366 - /* XXX */ 383 + const char * line; 384 + uint64_t line_len; 367 385 } oppanel_line_t; 368 386 369 387 /* API functions */ ··· 526 412 uint16_t dma_window_number, uint64_t pci_start_addr, 527 413 uint64_t pci_mem_size); 528 414 int64_t opal_pci_reset(uint64_t phb_id, uint8_t reset_scope, uint8_t assert_state); 415 + 416 + int64_t opal_pci_get_hub_diag_data(uint64_t hub_id, void *diag_buffer, uint64_t diag_buffer_len); 417 + int64_t opal_pci_get_phb_diag_data(uint64_t phb_id, void *diag_buffer, uint64_t diag_buffer_len); 418 + int64_t opal_pci_fence_phb(uint64_t phb_id); 419 + int64_t opal_pci_reinit(uint64_t phb_id, uint8_t reinit_scope); 420 + int64_t opal_pci_mask_pe_error(uint64_t phb_id, uint16_t pe_number, uint8_t error_type, uint8_t mask_action); 421 + int64_t opal_set_slot_led_status(uint64_t phb_id, uint64_t slot_id, uint8_t led_type, uint8_t led_action); 422 + int64_t opal_get_epow_status(uint64_t *status); 423 + int64_t opal_set_system_attention_led(uint8_t led_action); 529 424 530 425 /* Internal functions */ 531 426 extern int early_init_dt_scan_opal(unsigned long node, const char *uname, int depth, void *data);
+8
arch/powerpc/platforms/powernv/opal-wrappers.S
··· 99 99 OPAL_CALL(opal_pci_map_pe_dma_window, OPAL_PCI_MAP_PE_DMA_WINDOW); 100 100 OPAL_CALL(opal_pci_map_pe_dma_window_real, OPAL_PCI_MAP_PE_DMA_WINDOW_REAL); 101 101 OPAL_CALL(opal_pci_reset, OPAL_PCI_RESET); 102 + OPAL_CALL(opal_pci_get_hub_diag_data, OPAL_PCI_GET_HUB_DIAG_DATA); 103 + OPAL_CALL(opal_pci_get_phb_diag_data, OPAL_PCI_GET_PHB_DIAG_DATA); 104 + OPAL_CALL(opal_pci_fence_phb, OPAL_PCI_FENCE_PHB); 105 + OPAL_CALL(opal_pci_reinit, OPAL_PCI_REINIT); 106 + OPAL_CALL(opal_pci_mask_pe_error, OPAL_PCI_MASK_PE_ERROR); 107 + OPAL_CALL(opal_set_slot_led_status, OPAL_SET_SLOT_LED_STATUS); 108 + OPAL_CALL(opal_get_epow_status, OPAL_GET_EPOW_STATUS); 109 + OPAL_CALL(opal_set_system_attention_led, OPAL_SET_SYSTEM_ATTENTION_LED);
+2 -2
arch/powerpc/platforms/powernv/pci-ioda.c
··· 1294 1294 pci_add_flags(PCI_REASSIGN_ALL_RSRC); 1295 1295 1296 1296 /* Reset IODA tables to a clean state */ 1297 - rc = opal_pci_reset(phb_id, OPAL_PCI_IODA_RESET, OPAL_ASSERT_RESET); 1297 + rc = opal_pci_reset(phb_id, OPAL_PCI_IODA_TABLE_RESET, OPAL_ASSERT_RESET); 1298 1298 if (rc) 1299 - pr_warning(" OPAL Error %ld performing IODA reset !\n", rc); 1299 + pr_warning(" OPAL Error %ld performing IODA table reset !\n", rc); 1300 1300 opal_pci_set_pe(phb_id, 0, 0, 7, 1, 1 , OPAL_MAP_PE); 1301 1301 } 1302 1302