diff options
Diffstat (limited to 'arch/powerpc/include/asm/opal.h')
-rw-r--r-- | arch/powerpc/include/asm/opal.h | 109 |
1 files changed, 92 insertions, 17 deletions
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h index c5cd72833d6e..033c06be1d84 100644 --- a/arch/powerpc/include/asm/opal.h +++ b/arch/powerpc/include/asm/opal.h | |||
@@ -129,6 +129,9 @@ extern int opal_enter_rtas(struct rtas_args *args, | |||
129 | #define OPAL_LPC_READ 67 | 129 | #define OPAL_LPC_READ 67 |
130 | #define OPAL_LPC_WRITE 68 | 130 | #define OPAL_LPC_WRITE 68 |
131 | #define OPAL_RETURN_CPU 69 | 131 | #define OPAL_RETURN_CPU 69 |
132 | #define OPAL_FLASH_VALIDATE 76 | ||
133 | #define OPAL_FLASH_MANAGE 77 | ||
134 | #define OPAL_FLASH_UPDATE 78 | ||
132 | 135 | ||
133 | #ifndef __ASSEMBLY__ | 136 | #ifndef __ASSEMBLY__ |
134 | 137 | ||
@@ -460,10 +463,12 @@ enum { | |||
460 | 463 | ||
461 | enum { | 464 | enum { |
462 | OPAL_PHB_ERROR_DATA_TYPE_P7IOC = 1, | 465 | OPAL_PHB_ERROR_DATA_TYPE_P7IOC = 1, |
466 | OPAL_PHB_ERROR_DATA_TYPE_PHB3 = 2 | ||
463 | }; | 467 | }; |
464 | 468 | ||
465 | enum { | 469 | enum { |
466 | OPAL_P7IOC_NUM_PEST_REGS = 128, | 470 | OPAL_P7IOC_NUM_PEST_REGS = 128, |
471 | OPAL_PHB3_NUM_PEST_REGS = 256 | ||
467 | }; | 472 | }; |
468 | 473 | ||
469 | struct OpalIoPhbErrorCommon { | 474 | struct OpalIoPhbErrorCommon { |
@@ -531,28 +536,94 @@ struct OpalIoP7IOCPhbErrorData { | |||
531 | uint64_t pestB[OPAL_P7IOC_NUM_PEST_REGS]; | 536 | uint64_t pestB[OPAL_P7IOC_NUM_PEST_REGS]; |
532 | }; | 537 | }; |
533 | 538 | ||
539 | struct OpalIoPhb3ErrorData { | ||
540 | struct OpalIoPhbErrorCommon common; | ||
541 | |||
542 | uint32_t brdgCtl; | ||
543 | |||
544 | /* PHB3 UTL regs */ | ||
545 | uint32_t portStatusReg; | ||
546 | uint32_t rootCmplxStatus; | ||
547 | uint32_t busAgentStatus; | ||
548 | |||
549 | /* PHB3 cfg regs */ | ||
550 | uint32_t deviceStatus; | ||
551 | uint32_t slotStatus; | ||
552 | uint32_t linkStatus; | ||
553 | uint32_t devCmdStatus; | ||
554 | uint32_t devSecStatus; | ||
555 | |||
556 | /* cfg AER regs */ | ||
557 | uint32_t rootErrorStatus; | ||
558 | uint32_t uncorrErrorStatus; | ||
559 | uint32_t corrErrorStatus; | ||
560 | uint32_t tlpHdr1; | ||
561 | uint32_t tlpHdr2; | ||
562 | uint32_t tlpHdr3; | ||
563 | uint32_t tlpHdr4; | ||
564 | uint32_t sourceId; | ||
565 | |||
566 | uint32_t rsv3; | ||
567 | |||
568 | /* Record data about the call to allocate a buffer */ | ||
569 | uint64_t errorClass; | ||
570 | uint64_t correlator; | ||
571 | |||
572 | uint64_t nFir; /* 000 */ | ||
573 | uint64_t nFirMask; /* 003 */ | ||
574 | uint64_t nFirWOF; /* 008 */ | ||
575 | |||
576 | /* PHB3 MMIO Error Regs */ | ||
577 | uint64_t phbPlssr; /* 120 */ | ||
578 | uint64_t phbCsr; /* 110 */ | ||
579 | uint64_t lemFir; /* C00 */ | ||
580 | uint64_t lemErrorMask; /* C18 */ | ||
581 | uint64_t lemWOF; /* C40 */ | ||
582 | uint64_t phbErrorStatus; /* C80 */ | ||
583 | uint64_t phbFirstErrorStatus; /* C88 */ | ||
584 | uint64_t phbErrorLog0; /* CC0 */ | ||
585 | uint64_t phbErrorLog1; /* CC8 */ | ||
586 | uint64_t mmioErrorStatus; /* D00 */ | ||
587 | uint64_t mmioFirstErrorStatus; /* D08 */ | ||
588 | uint64_t mmioErrorLog0; /* D40 */ | ||
589 | uint64_t mmioErrorLog1; /* D48 */ | ||
590 | uint64_t dma0ErrorStatus; /* D80 */ | ||
591 | uint64_t dma0FirstErrorStatus; /* D88 */ | ||
592 | uint64_t dma0ErrorLog0; /* DC0 */ | ||
593 | uint64_t dma0ErrorLog1; /* DC8 */ | ||
594 | uint64_t dma1ErrorStatus; /* E00 */ | ||
595 | uint64_t dma1FirstErrorStatus; /* E08 */ | ||
596 | uint64_t dma1ErrorLog0; /* E40 */ | ||
597 | uint64_t dma1ErrorLog1; /* E48 */ | ||
598 | uint64_t pestA[OPAL_PHB3_NUM_PEST_REGS]; | ||
599 | uint64_t pestB[OPAL_PHB3_NUM_PEST_REGS]; | ||
600 | }; | ||
601 | |||
534 | typedef struct oppanel_line { | 602 | typedef struct oppanel_line { |
535 | const char * line; | 603 | const char * line; |
536 | uint64_t line_len; | 604 | uint64_t line_len; |
537 | } oppanel_line_t; | 605 | } oppanel_line_t; |
538 | 606 | ||
607 | /* /sys/firmware/opal */ | ||
608 | extern struct kobject *opal_kobj; | ||
609 | |||
539 | /* API functions */ | 610 | /* API functions */ |
540 | int64_t opal_console_write(int64_t term_number, int64_t *length, | 611 | int64_t opal_console_write(int64_t term_number, __be64 *length, |
541 | const uint8_t *buffer); | 612 | const uint8_t *buffer); |
542 | int64_t opal_console_read(int64_t term_number, int64_t *length, | 613 | int64_t opal_console_read(int64_t term_number, __be64 *length, |
543 | uint8_t *buffer); | 614 | uint8_t *buffer); |
544 | int64_t opal_console_write_buffer_space(int64_t term_number, | 615 | int64_t opal_console_write_buffer_space(int64_t term_number, |
545 | int64_t *length); | 616 | __be64 *length); |
546 | int64_t opal_rtc_read(uint32_t *year_month_day, | 617 | int64_t opal_rtc_read(__be32 *year_month_day, |
547 | uint64_t *hour_minute_second_millisecond); | 618 | __be64 *hour_minute_second_millisecond); |
548 | int64_t opal_rtc_write(uint32_t year_month_day, | 619 | int64_t opal_rtc_write(uint32_t year_month_day, |
549 | uint64_t hour_minute_second_millisecond); | 620 | uint64_t hour_minute_second_millisecond); |
550 | int64_t opal_cec_power_down(uint64_t request); | 621 | int64_t opal_cec_power_down(uint64_t request); |
551 | int64_t opal_cec_reboot(void); | 622 | int64_t opal_cec_reboot(void); |
552 | int64_t opal_read_nvram(uint64_t buffer, uint64_t size, uint64_t offset); | 623 | int64_t opal_read_nvram(uint64_t buffer, uint64_t size, uint64_t offset); |
553 | int64_t opal_write_nvram(uint64_t buffer, uint64_t size, uint64_t offset); | 624 | int64_t opal_write_nvram(uint64_t buffer, uint64_t size, uint64_t offset); |
554 | int64_t opal_handle_interrupt(uint64_t isn, uint64_t *outstanding_event_mask); | 625 | int64_t opal_handle_interrupt(uint64_t isn, __be64 *outstanding_event_mask); |
555 | int64_t opal_poll_events(uint64_t *outstanding_event_mask); | 626 | int64_t opal_poll_events(__be64 *outstanding_event_mask); |
556 | int64_t opal_pci_set_hub_tce_memory(uint64_t hub_id, uint64_t tce_mem_addr, | 627 | int64_t opal_pci_set_hub_tce_memory(uint64_t hub_id, uint64_t tce_mem_addr, |
557 | uint64_t tce_mem_size); | 628 | uint64_t tce_mem_size); |
558 | int64_t opal_pci_set_phb_tce_memory(uint64_t phb_id, uint64_t tce_mem_addr, | 629 | int64_t opal_pci_set_phb_tce_memory(uint64_t phb_id, uint64_t tce_mem_addr, |
@@ -560,9 +631,9 @@ int64_t opal_pci_set_phb_tce_memory(uint64_t phb_id, uint64_t tce_mem_addr, | |||
560 | int64_t opal_pci_config_read_byte(uint64_t phb_id, uint64_t bus_dev_func, | 631 | int64_t opal_pci_config_read_byte(uint64_t phb_id, uint64_t bus_dev_func, |
561 | uint64_t offset, uint8_t *data); | 632 | uint64_t offset, uint8_t *data); |
562 | int64_t opal_pci_config_read_half_word(uint64_t phb_id, uint64_t bus_dev_func, | 633 | int64_t opal_pci_config_read_half_word(uint64_t phb_id, uint64_t bus_dev_func, |
563 | uint64_t offset, uint16_t *data); | 634 | uint64_t offset, __be16 *data); |
564 | int64_t opal_pci_config_read_word(uint64_t phb_id, uint64_t bus_dev_func, | 635 | int64_t opal_pci_config_read_word(uint64_t phb_id, uint64_t bus_dev_func, |
565 | uint64_t offset, uint32_t *data); | 636 | uint64_t offset, __be32 *data); |
566 | int64_t opal_pci_config_write_byte(uint64_t phb_id, uint64_t bus_dev_func, | 637 | int64_t opal_pci_config_write_byte(uint64_t phb_id, uint64_t bus_dev_func, |
567 | uint64_t offset, uint8_t data); | 638 | uint64_t offset, uint8_t data); |
568 | int64_t opal_pci_config_write_half_word(uint64_t phb_id, uint64_t bus_dev_func, | 639 | int64_t opal_pci_config_write_half_word(uint64_t phb_id, uint64_t bus_dev_func, |
@@ -570,14 +641,14 @@ int64_t opal_pci_config_write_half_word(uint64_t phb_id, uint64_t bus_dev_func, | |||
570 | int64_t opal_pci_config_write_word(uint64_t phb_id, uint64_t bus_dev_func, | 641 | int64_t opal_pci_config_write_word(uint64_t phb_id, uint64_t bus_dev_func, |
571 | uint64_t offset, uint32_t data); | 642 | uint64_t offset, uint32_t data); |
572 | int64_t opal_set_xive(uint32_t isn, uint16_t server, uint8_t priority); | 643 | int64_t opal_set_xive(uint32_t isn, uint16_t server, uint8_t priority); |
573 | int64_t opal_get_xive(uint32_t isn, uint16_t *server, uint8_t *priority); | 644 | int64_t opal_get_xive(uint32_t isn, __be16 *server, uint8_t *priority); |
574 | int64_t opal_register_exception_handler(uint64_t opal_exception, | 645 | int64_t opal_register_exception_handler(uint64_t opal_exception, |
575 | uint64_t handler_address, | 646 | uint64_t handler_address, |
576 | uint64_t glue_cache_line); | 647 | uint64_t glue_cache_line); |
577 | int64_t opal_pci_eeh_freeze_status(uint64_t phb_id, uint64_t pe_number, | 648 | int64_t opal_pci_eeh_freeze_status(uint64_t phb_id, uint64_t pe_number, |
578 | uint8_t *freeze_state, | 649 | uint8_t *freeze_state, |
579 | uint16_t *pci_error_type, | 650 | __be16 *pci_error_type, |
580 | uint64_t *phb_status); | 651 | __be64 *phb_status); |
581 | int64_t opal_pci_eeh_freeze_clear(uint64_t phb_id, uint64_t pe_number, | 652 | int64_t opal_pci_eeh_freeze_clear(uint64_t phb_id, uint64_t pe_number, |
582 | uint64_t eeh_action_token); | 653 | uint64_t eeh_action_token); |
583 | int64_t opal_pci_shpc(uint64_t phb_id, uint64_t shpc_action, uint8_t *state); | 654 | int64_t opal_pci_shpc(uint64_t phb_id, uint64_t shpc_action, uint8_t *state); |
@@ -614,13 +685,13 @@ int64_t opal_pci_msi_eoi(uint64_t phb_id, uint32_t hw_irq); | |||
614 | int64_t opal_pci_set_xive_pe(uint64_t phb_id, uint32_t pe_number, | 685 | int64_t opal_pci_set_xive_pe(uint64_t phb_id, uint32_t pe_number, |
615 | uint32_t xive_num); | 686 | uint32_t xive_num); |
616 | int64_t opal_get_xive_source(uint64_t phb_id, uint32_t xive_num, | 687 | int64_t opal_get_xive_source(uint64_t phb_id, uint32_t xive_num, |
617 | int32_t *interrupt_source_number); | 688 | __be32 *interrupt_source_number); |
618 | int64_t opal_get_msi_32(uint64_t phb_id, uint32_t mve_number, uint32_t xive_num, | 689 | int64_t opal_get_msi_32(uint64_t phb_id, uint32_t mve_number, uint32_t xive_num, |
619 | uint8_t msi_range, uint32_t *msi_address, | 690 | uint8_t msi_range, __be32 *msi_address, |
620 | uint32_t *message_data); | 691 | __be32 *message_data); |
621 | int64_t opal_get_msi_64(uint64_t phb_id, uint32_t mve_number, | 692 | int64_t opal_get_msi_64(uint64_t phb_id, uint32_t mve_number, |
622 | uint32_t xive_num, uint8_t msi_range, | 693 | uint32_t xive_num, uint8_t msi_range, |
623 | uint64_t *msi_address, uint32_t *message_data); | 694 | __be64 *msi_address, __be32 *message_data); |
624 | int64_t opal_start_cpu(uint64_t thread_number, uint64_t start_address); | 695 | int64_t opal_start_cpu(uint64_t thread_number, uint64_t start_address); |
625 | int64_t opal_query_cpu_status(uint64_t thread_number, uint8_t *thread_status); | 696 | int64_t opal_query_cpu_status(uint64_t thread_number, uint8_t *thread_status); |
626 | int64_t opal_write_oppanel(oppanel_line_t *lines, uint64_t num_lines); | 697 | int64_t opal_write_oppanel(oppanel_line_t *lines, uint64_t num_lines); |
@@ -642,7 +713,7 @@ int64_t opal_pci_fence_phb(uint64_t phb_id); | |||
642 | int64_t opal_pci_reinit(uint64_t phb_id, uint8_t reinit_scope); | 713 | int64_t opal_pci_reinit(uint64_t phb_id, uint8_t reinit_scope); |
643 | int64_t opal_pci_mask_pe_error(uint64_t phb_id, uint16_t pe_number, uint8_t error_type, uint8_t mask_action); | 714 | int64_t opal_pci_mask_pe_error(uint64_t phb_id, uint16_t pe_number, uint8_t error_type, uint8_t mask_action); |
644 | int64_t opal_set_slot_led_status(uint64_t phb_id, uint64_t slot_id, uint8_t led_type, uint8_t led_action); | 715 | int64_t opal_set_slot_led_status(uint64_t phb_id, uint64_t slot_id, uint8_t led_type, uint8_t led_action); |
645 | int64_t opal_get_epow_status(uint64_t *status); | 716 | int64_t opal_get_epow_status(__be64 *status); |
646 | int64_t opal_set_system_attention_led(uint8_t led_action); | 717 | int64_t opal_set_system_attention_led(uint8_t led_action); |
647 | int64_t opal_pci_next_error(uint64_t phb_id, uint64_t *first_frozen_pe, | 718 | int64_t opal_pci_next_error(uint64_t phb_id, uint64_t *first_frozen_pe, |
648 | uint16_t *pci_error_type, uint16_t *severity); | 719 | uint16_t *pci_error_type, uint16_t *severity); |
@@ -656,6 +727,9 @@ int64_t opal_lpc_write(uint32_t chip_id, enum OpalLPCAddressType addr_type, | |||
656 | uint32_t addr, uint32_t data, uint32_t sz); | 727 | uint32_t addr, uint32_t data, uint32_t sz); |
657 | int64_t opal_lpc_read(uint32_t chip_id, enum OpalLPCAddressType addr_type, | 728 | int64_t opal_lpc_read(uint32_t chip_id, enum OpalLPCAddressType addr_type, |
658 | uint32_t addr, uint32_t *data, uint32_t sz); | 729 | uint32_t addr, uint32_t *data, uint32_t sz); |
730 | int64_t opal_validate_flash(uint64_t buffer, uint32_t *size, uint32_t *result); | ||
731 | int64_t opal_manage_flash(uint8_t op); | ||
732 | int64_t opal_update_flash(uint64_t blk_list); | ||
659 | 733 | ||
660 | /* Internal functions */ | 734 | /* Internal functions */ |
661 | extern int early_init_dt_scan_opal(unsigned long node, const char *uname, int depth, void *data); | 735 | extern int early_init_dt_scan_opal(unsigned long node, const char *uname, int depth, void *data); |
@@ -684,6 +758,7 @@ extern int opal_set_rtc_time(struct rtc_time *tm); | |||
684 | extern void opal_get_rtc_time(struct rtc_time *tm); | 758 | extern void opal_get_rtc_time(struct rtc_time *tm); |
685 | extern unsigned long opal_get_boot_time(void); | 759 | extern unsigned long opal_get_boot_time(void); |
686 | extern void opal_nvram_init(void); | 760 | extern void opal_nvram_init(void); |
761 | extern void opal_flash_init(void); | ||
687 | 762 | ||
688 | extern int opal_machine_check(struct pt_regs *regs); | 763 | extern int opal_machine_check(struct pt_regs *regs); |
689 | 764 | ||