18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * PowerNV OPAL definitions. 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright 2011 IBM Corp. 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef _ASM_POWERPC_OPAL_H 98c2ecf20Sopenharmony_ci#define _ASM_POWERPC_OPAL_H 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include <asm/opal-api.h> 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__ 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#include <linux/notifier.h> 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci/* We calculate number of sg entries based on PAGE_SIZE */ 188c2ecf20Sopenharmony_ci#define SG_ENTRIES_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct opal_sg_entry)) 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci/* Default time to sleep or delay between OPAL_BUSY/OPAL_BUSY_EVENT loops */ 218c2ecf20Sopenharmony_ci#define OPAL_BUSY_DELAY_MS 10 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci/* /sys/firmware/opal */ 248c2ecf20Sopenharmony_ciextern struct kobject *opal_kobj; 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci/* /ibm,opal */ 278c2ecf20Sopenharmony_ciextern struct device_node *opal_node; 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci/* API functions */ 308c2ecf20Sopenharmony_ciint64_t opal_invalid_call(void); 318c2ecf20Sopenharmony_ciint64_t opal_npu_destroy_context(uint64_t phb_id, uint64_t pid, uint64_t bdf); 328c2ecf20Sopenharmony_ciint64_t opal_npu_init_context(uint64_t phb_id, int pasid, uint64_t msr, 338c2ecf20Sopenharmony_ci uint64_t bdf); 348c2ecf20Sopenharmony_ciint64_t opal_npu_map_lpar(uint64_t phb_id, uint64_t bdf, uint64_t lparid, 358c2ecf20Sopenharmony_ci uint64_t lpcr); 368c2ecf20Sopenharmony_ciint64_t opal_npu_spa_setup(uint64_t phb_id, uint32_t bdfn, 378c2ecf20Sopenharmony_ci uint64_t addr, uint64_t PE_mask); 388c2ecf20Sopenharmony_ciint64_t opal_npu_spa_clear_cache(uint64_t phb_id, uint32_t bdfn, 398c2ecf20Sopenharmony_ci uint64_t PE_handle); 408c2ecf20Sopenharmony_ciint64_t opal_npu_tl_set(uint64_t phb_id, uint32_t bdfn, long cap, 418c2ecf20Sopenharmony_ci uint64_t rate_phys, uint32_t size); 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ciint64_t opal_console_write(int64_t term_number, __be64 *length, 448c2ecf20Sopenharmony_ci const uint8_t *buffer); 458c2ecf20Sopenharmony_ciint64_t opal_console_read(int64_t term_number, __be64 *length, 468c2ecf20Sopenharmony_ci uint8_t *buffer); 478c2ecf20Sopenharmony_ciint64_t opal_console_write_buffer_space(int64_t term_number, 488c2ecf20Sopenharmony_ci __be64 *length); 498c2ecf20Sopenharmony_ciint64_t opal_console_flush(int64_t term_number); 508c2ecf20Sopenharmony_ciint64_t opal_rtc_read(__be32 *year_month_day, 518c2ecf20Sopenharmony_ci __be64 *hour_minute_second_millisecond); 528c2ecf20Sopenharmony_ciint64_t opal_rtc_write(uint32_t year_month_day, 538c2ecf20Sopenharmony_ci uint64_t hour_minute_second_millisecond); 548c2ecf20Sopenharmony_ciint64_t opal_tpo_read(uint64_t token, __be32 *year_mon_day, __be32 *hour_min); 558c2ecf20Sopenharmony_ciint64_t opal_tpo_write(uint64_t token, uint32_t year_mon_day, 568c2ecf20Sopenharmony_ci uint32_t hour_min); 578c2ecf20Sopenharmony_ciint64_t opal_cec_power_down(uint64_t request); 588c2ecf20Sopenharmony_ciint64_t opal_cec_reboot(void); 598c2ecf20Sopenharmony_ciint64_t opal_cec_reboot2(uint32_t reboot_type, const char *diag); 608c2ecf20Sopenharmony_ciint64_t opal_read_nvram(uint64_t buffer, uint64_t size, uint64_t offset); 618c2ecf20Sopenharmony_ciint64_t opal_write_nvram(uint64_t buffer, uint64_t size, uint64_t offset); 628c2ecf20Sopenharmony_ciint64_t opal_handle_interrupt(uint64_t isn, __be64 *outstanding_event_mask); 638c2ecf20Sopenharmony_ciint64_t opal_poll_events(__be64 *outstanding_event_mask); 648c2ecf20Sopenharmony_ciint64_t opal_pci_set_hub_tce_memory(uint64_t hub_id, uint64_t tce_mem_addr, 658c2ecf20Sopenharmony_ci uint64_t tce_mem_size); 668c2ecf20Sopenharmony_ciint64_t opal_pci_set_phb_tce_memory(uint64_t phb_id, uint64_t tce_mem_addr, 678c2ecf20Sopenharmony_ci uint64_t tce_mem_size); 688c2ecf20Sopenharmony_ciint64_t opal_pci_config_read_byte(uint64_t phb_id, uint64_t bus_dev_func, 698c2ecf20Sopenharmony_ci uint64_t offset, uint8_t *data); 708c2ecf20Sopenharmony_ciint64_t opal_pci_config_read_half_word(uint64_t phb_id, uint64_t bus_dev_func, 718c2ecf20Sopenharmony_ci uint64_t offset, __be16 *data); 728c2ecf20Sopenharmony_ciint64_t opal_pci_config_read_word(uint64_t phb_id, uint64_t bus_dev_func, 738c2ecf20Sopenharmony_ci uint64_t offset, __be32 *data); 748c2ecf20Sopenharmony_ciint64_t opal_pci_config_write_byte(uint64_t phb_id, uint64_t bus_dev_func, 758c2ecf20Sopenharmony_ci uint64_t offset, uint8_t data); 768c2ecf20Sopenharmony_ciint64_t opal_pci_config_write_half_word(uint64_t phb_id, uint64_t bus_dev_func, 778c2ecf20Sopenharmony_ci uint64_t offset, uint16_t data); 788c2ecf20Sopenharmony_ciint64_t opal_pci_config_write_word(uint64_t phb_id, uint64_t bus_dev_func, 798c2ecf20Sopenharmony_ci uint64_t offset, uint32_t data); 808c2ecf20Sopenharmony_ciint64_t opal_set_xive(uint32_t isn, uint16_t server, uint8_t priority); 818c2ecf20Sopenharmony_ciint64_t opal_get_xive(uint32_t isn, __be16 *server, uint8_t *priority); 828c2ecf20Sopenharmony_ciint64_t opal_register_exception_handler(uint64_t opal_exception, 838c2ecf20Sopenharmony_ci uint64_t handler_address, 848c2ecf20Sopenharmony_ci uint64_t glue_cache_line); 858c2ecf20Sopenharmony_ciint64_t opal_pci_eeh_freeze_status(uint64_t phb_id, uint64_t pe_number, 868c2ecf20Sopenharmony_ci uint8_t *freeze_state, 878c2ecf20Sopenharmony_ci __be16 *pci_error_type, 888c2ecf20Sopenharmony_ci __be64 *phb_status); 898c2ecf20Sopenharmony_ciint64_t opal_pci_eeh_freeze_clear(uint64_t phb_id, uint64_t pe_number, 908c2ecf20Sopenharmony_ci uint64_t eeh_action_token); 918c2ecf20Sopenharmony_ciint64_t opal_pci_eeh_freeze_set(uint64_t phb_id, uint64_t pe_number, 928c2ecf20Sopenharmony_ci uint64_t eeh_action_token); 938c2ecf20Sopenharmony_ciint64_t opal_pci_err_inject(uint64_t phb_id, uint32_t pe_no, uint32_t type, 948c2ecf20Sopenharmony_ci uint32_t func, uint64_t addr, uint64_t mask); 958c2ecf20Sopenharmony_ciint64_t opal_pci_shpc(uint64_t phb_id, uint64_t shpc_action, uint8_t *state); 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ciint64_t opal_pci_phb_mmio_enable(uint64_t phb_id, uint16_t window_type, 1008c2ecf20Sopenharmony_ci uint16_t window_num, uint16_t enable); 1018c2ecf20Sopenharmony_ciint64_t opal_pci_set_phb_mem_window(uint64_t phb_id, uint16_t window_type, 1028c2ecf20Sopenharmony_ci uint16_t window_num, 1038c2ecf20Sopenharmony_ci uint64_t starting_real_address, 1048c2ecf20Sopenharmony_ci uint64_t starting_pci_address, 1058c2ecf20Sopenharmony_ci uint64_t size); 1068c2ecf20Sopenharmony_ciint64_t opal_pci_map_pe_mmio_window(uint64_t phb_id, uint16_t pe_number, 1078c2ecf20Sopenharmony_ci uint16_t window_type, uint16_t window_num, 1088c2ecf20Sopenharmony_ci uint16_t segment_num); 1098c2ecf20Sopenharmony_ciint64_t opal_pci_set_phb_table_memory(uint64_t phb_id, uint64_t rtt_addr, 1108c2ecf20Sopenharmony_ci uint64_t ivt_addr, uint64_t ivt_len, 1118c2ecf20Sopenharmony_ci uint64_t reject_array_addr, 1128c2ecf20Sopenharmony_ci uint64_t peltv_addr); 1138c2ecf20Sopenharmony_ciint64_t opal_pci_set_pe(uint64_t phb_id, uint64_t pe_number, uint64_t bus_dev_func, 1148c2ecf20Sopenharmony_ci uint8_t bus_compare, uint8_t dev_compare, uint8_t func_compare, 1158c2ecf20Sopenharmony_ci uint8_t pe_action); 1168c2ecf20Sopenharmony_ciint64_t opal_pci_set_peltv(uint64_t phb_id, uint32_t parent_pe, uint32_t child_pe, 1178c2ecf20Sopenharmony_ci uint8_t state); 1188c2ecf20Sopenharmony_ciint64_t opal_pci_set_mve(uint64_t phb_id, uint32_t mve_number, uint32_t pe_number); 1198c2ecf20Sopenharmony_ciint64_t opal_pci_set_mve_enable(uint64_t phb_id, uint32_t mve_number, 1208c2ecf20Sopenharmony_ci uint32_t state); 1218c2ecf20Sopenharmony_ciint64_t opal_pci_get_xive_reissue(uint64_t phb_id, uint32_t xive_number, 1228c2ecf20Sopenharmony_ci uint8_t *p_bit, uint8_t *q_bit); 1238c2ecf20Sopenharmony_ciint64_t opal_pci_set_xive_reissue(uint64_t phb_id, uint32_t xive_number, 1248c2ecf20Sopenharmony_ci uint8_t p_bit, uint8_t q_bit); 1258c2ecf20Sopenharmony_ciint64_t opal_pci_msi_eoi(uint64_t phb_id, uint32_t hw_irq); 1268c2ecf20Sopenharmony_ciint64_t opal_pci_set_xive_pe(uint64_t phb_id, uint32_t pe_number, 1278c2ecf20Sopenharmony_ci uint32_t xive_num); 1288c2ecf20Sopenharmony_ciint64_t opal_get_xive_source(uint64_t phb_id, uint32_t xive_num, 1298c2ecf20Sopenharmony_ci __be32 *interrupt_source_number); 1308c2ecf20Sopenharmony_ciint64_t opal_get_msi_32(uint64_t phb_id, uint32_t mve_number, uint32_t xive_num, 1318c2ecf20Sopenharmony_ci uint8_t msi_range, __be32 *msi_address, 1328c2ecf20Sopenharmony_ci __be32 *message_data); 1338c2ecf20Sopenharmony_ciint64_t opal_get_msi_64(uint64_t phb_id, uint32_t mve_number, 1348c2ecf20Sopenharmony_ci uint32_t xive_num, uint8_t msi_range, 1358c2ecf20Sopenharmony_ci __be64 *msi_address, __be32 *message_data); 1368c2ecf20Sopenharmony_ciint64_t opal_start_cpu(uint64_t thread_number, uint64_t start_address); 1378c2ecf20Sopenharmony_ciint64_t opal_query_cpu_status(uint64_t thread_number, uint8_t *thread_status); 1388c2ecf20Sopenharmony_ciint64_t opal_write_oppanel(oppanel_line_t *lines, uint64_t num_lines); 1398c2ecf20Sopenharmony_ciint64_t opal_pci_map_pe_dma_window(uint64_t phb_id, uint16_t pe_number, uint16_t window_id, 1408c2ecf20Sopenharmony_ci uint16_t tce_levels, uint64_t tce_table_addr, 1418c2ecf20Sopenharmony_ci uint64_t tce_table_size, uint64_t tce_page_size); 1428c2ecf20Sopenharmony_ciint64_t opal_pci_map_pe_dma_window_real(uint64_t phb_id, uint16_t pe_number, 1438c2ecf20Sopenharmony_ci uint16_t dma_window_number, uint64_t pci_start_addr, 1448c2ecf20Sopenharmony_ci uint64_t pci_mem_size); 1458c2ecf20Sopenharmony_ciint64_t opal_pci_reset(uint64_t id, uint8_t reset_scope, uint8_t assert_state); 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ciint64_t opal_pci_get_hub_diag_data(uint64_t hub_id, void *diag_buffer, 1488c2ecf20Sopenharmony_ci uint64_t diag_buffer_len); 1498c2ecf20Sopenharmony_ciint64_t opal_pci_get_phb_diag_data(uint64_t phb_id, void *diag_buffer, 1508c2ecf20Sopenharmony_ci uint64_t diag_buffer_len); 1518c2ecf20Sopenharmony_ciint64_t opal_pci_get_phb_diag_data2(uint64_t phb_id, void *diag_buffer, 1528c2ecf20Sopenharmony_ci uint64_t diag_buffer_len); 1538c2ecf20Sopenharmony_ciint64_t opal_pci_fence_phb(uint64_t phb_id); 1548c2ecf20Sopenharmony_ciint64_t opal_pci_reinit(uint64_t phb_id, uint64_t reinit_scope, uint64_t data); 1558c2ecf20Sopenharmony_ciint64_t opal_pci_mask_pe_error(uint64_t phb_id, uint16_t pe_number, uint8_t error_type, uint8_t mask_action); 1568c2ecf20Sopenharmony_ciint64_t opal_set_slot_led_status(uint64_t phb_id, uint64_t slot_id, uint8_t led_type, uint8_t led_action); 1578c2ecf20Sopenharmony_ciint64_t opal_get_epow_status(__be16 *epow_status, __be16 *num_epow_classes); 1588c2ecf20Sopenharmony_ciint64_t opal_get_dpo_status(__be64 *dpo_timeout); 1598c2ecf20Sopenharmony_ciint64_t opal_set_system_attention_led(uint8_t led_action); 1608c2ecf20Sopenharmony_ciint64_t opal_pci_next_error(uint64_t phb_id, __be64 *first_frozen_pe, 1618c2ecf20Sopenharmony_ci __be16 *pci_error_type, __be16 *severity); 1628c2ecf20Sopenharmony_ciint64_t opal_pci_poll(uint64_t id); 1638c2ecf20Sopenharmony_ciint64_t opal_return_cpu(void); 1648c2ecf20Sopenharmony_ciint64_t opal_check_token(uint64_t token); 1658c2ecf20Sopenharmony_ciint64_t opal_reinit_cpus(uint64_t flags); 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_ciint64_t opal_xscom_read(uint32_t gcid, uint64_t pcb_addr, __be64 *val); 1688c2ecf20Sopenharmony_ciint64_t opal_xscom_write(uint32_t gcid, uint64_t pcb_addr, uint64_t val); 1698c2ecf20Sopenharmony_ci 1708c2ecf20Sopenharmony_ciint64_t opal_lpc_write(uint32_t chip_id, enum OpalLPCAddressType addr_type, 1718c2ecf20Sopenharmony_ci uint32_t addr, uint32_t data, uint32_t sz); 1728c2ecf20Sopenharmony_ciint64_t opal_lpc_read(uint32_t chip_id, enum OpalLPCAddressType addr_type, 1738c2ecf20Sopenharmony_ci uint32_t addr, __be32 *data, uint32_t sz); 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_ciint64_t opal_read_elog(uint64_t buffer, uint64_t size, uint64_t log_id); 1768c2ecf20Sopenharmony_ciint64_t opal_get_elog_size(__be64 *log_id, __be64 *size, __be64 *elog_type); 1778c2ecf20Sopenharmony_ciint64_t opal_write_elog(uint64_t buffer, uint64_t size, uint64_t offset); 1788c2ecf20Sopenharmony_ciint64_t opal_send_ack_elog(uint64_t log_id); 1798c2ecf20Sopenharmony_civoid opal_resend_pending_logs(void); 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_ciint64_t opal_validate_flash(uint64_t buffer, uint32_t *size, uint32_t *result); 1828c2ecf20Sopenharmony_ciint64_t opal_manage_flash(uint8_t op); 1838c2ecf20Sopenharmony_ciint64_t opal_update_flash(uint64_t blk_list); 1848c2ecf20Sopenharmony_ciint64_t opal_dump_init(uint8_t dump_type); 1858c2ecf20Sopenharmony_ciint64_t opal_dump_info(__be32 *dump_id, __be32 *dump_size); 1868c2ecf20Sopenharmony_ciint64_t opal_dump_info2(__be32 *dump_id, __be32 *dump_size, __be32 *dump_type); 1878c2ecf20Sopenharmony_ciint64_t opal_dump_read(uint32_t dump_id, uint64_t buffer); 1888c2ecf20Sopenharmony_ciint64_t opal_dump_ack(uint32_t dump_id); 1898c2ecf20Sopenharmony_ciint64_t opal_dump_resend_notification(void); 1908c2ecf20Sopenharmony_ci 1918c2ecf20Sopenharmony_ciint64_t opal_get_msg(uint64_t buffer, uint64_t size); 1928c2ecf20Sopenharmony_ciint64_t opal_write_oppanel_async(uint64_t token, oppanel_line_t *lines, 1938c2ecf20Sopenharmony_ci uint64_t num_lines); 1948c2ecf20Sopenharmony_ciint64_t opal_check_completion(uint64_t buffer, uint64_t size, uint64_t token); 1958c2ecf20Sopenharmony_ciint64_t opal_sync_host_reboot(void); 1968c2ecf20Sopenharmony_ciint64_t opal_get_param(uint64_t token, uint32_t param_id, uint64_t buffer, 1978c2ecf20Sopenharmony_ci uint64_t length); 1988c2ecf20Sopenharmony_ciint64_t opal_set_param(uint64_t token, uint32_t param_id, uint64_t buffer, 1998c2ecf20Sopenharmony_ci uint64_t length); 2008c2ecf20Sopenharmony_ciint64_t opal_sensor_read(uint32_t sensor_hndl, int token, __be32 *sensor_data); 2018c2ecf20Sopenharmony_ciint64_t opal_sensor_read_u64(u32 sensor_hndl, int token, __be64 *sensor_data); 2028c2ecf20Sopenharmony_ciint64_t opal_handle_hmi(void); 2038c2ecf20Sopenharmony_ciint64_t opal_handle_hmi2(__be64 *out_flags); 2048c2ecf20Sopenharmony_ciint64_t opal_register_dump_region(uint32_t id, uint64_t start, uint64_t end); 2058c2ecf20Sopenharmony_ciint64_t opal_unregister_dump_region(uint32_t id); 2068c2ecf20Sopenharmony_ciint64_t opal_slw_set_reg(uint64_t cpu_pir, uint64_t sprn, uint64_t val); 2078c2ecf20Sopenharmony_ciint64_t opal_config_cpu_idle_state(uint64_t state, uint64_t flag); 2088c2ecf20Sopenharmony_ciint64_t opal_pci_set_phb_cxl_mode(uint64_t phb_id, uint64_t mode, uint64_t pe_number); 2098c2ecf20Sopenharmony_ciint64_t opal_pci_get_pbcq_tunnel_bar(uint64_t phb_id, uint64_t *addr); 2108c2ecf20Sopenharmony_ciint64_t opal_pci_set_pbcq_tunnel_bar(uint64_t phb_id, uint64_t addr); 2118c2ecf20Sopenharmony_ciint64_t opal_ipmi_send(uint64_t interface, struct opal_ipmi_msg *msg, 2128c2ecf20Sopenharmony_ci uint64_t msg_len); 2138c2ecf20Sopenharmony_ciint64_t opal_ipmi_recv(uint64_t interface, struct opal_ipmi_msg *msg, 2148c2ecf20Sopenharmony_ci uint64_t *msg_len); 2158c2ecf20Sopenharmony_ciint64_t opal_i2c_request(uint64_t async_token, uint32_t bus_id, 2168c2ecf20Sopenharmony_ci struct opal_i2c_request *oreq); 2178c2ecf20Sopenharmony_ciint64_t opal_prd_msg(struct opal_prd_msg *msg); 2188c2ecf20Sopenharmony_ciint64_t opal_leds_get_ind(char *loc_code, __be64 *led_mask, 2198c2ecf20Sopenharmony_ci __be64 *led_value, __be64 *max_led_type); 2208c2ecf20Sopenharmony_ciint64_t opal_leds_set_ind(uint64_t token, char *loc_code, const u64 led_mask, 2218c2ecf20Sopenharmony_ci const u64 led_value, __be64 *max_led_type); 2228c2ecf20Sopenharmony_ci 2238c2ecf20Sopenharmony_ciint64_t opal_flash_read(uint64_t id, uint64_t offset, uint64_t buf, 2248c2ecf20Sopenharmony_ci uint64_t size, uint64_t token); 2258c2ecf20Sopenharmony_ciint64_t opal_flash_write(uint64_t id, uint64_t offset, uint64_t buf, 2268c2ecf20Sopenharmony_ci uint64_t size, uint64_t token); 2278c2ecf20Sopenharmony_ciint64_t opal_flash_erase(uint64_t id, uint64_t offset, uint64_t size, 2288c2ecf20Sopenharmony_ci uint64_t token); 2298c2ecf20Sopenharmony_ciint64_t opal_get_device_tree(uint32_t phandle, uint64_t buf, uint64_t len); 2308c2ecf20Sopenharmony_ciint64_t opal_pci_get_presence_state(uint64_t id, uint64_t data); 2318c2ecf20Sopenharmony_ciint64_t opal_pci_get_power_state(uint64_t id, uint64_t data); 2328c2ecf20Sopenharmony_ciint64_t opal_pci_set_power_state(uint64_t async_token, uint64_t id, 2338c2ecf20Sopenharmony_ci uint64_t data); 2348c2ecf20Sopenharmony_ciint64_t opal_pci_poll2(uint64_t id, uint64_t data); 2358c2ecf20Sopenharmony_ci 2368c2ecf20Sopenharmony_ciint64_t opal_int_get_xirr(uint32_t *out_xirr, bool just_poll); 2378c2ecf20Sopenharmony_ciint64_t opal_int_set_cppr(uint8_t cppr); 2388c2ecf20Sopenharmony_ciint64_t opal_int_eoi(uint32_t xirr); 2398c2ecf20Sopenharmony_ciint64_t opal_int_set_mfrr(uint32_t cpu, uint8_t mfrr); 2408c2ecf20Sopenharmony_ciint64_t opal_pci_tce_kill(uint64_t phb_id, uint32_t kill_type, 2418c2ecf20Sopenharmony_ci uint32_t pe_num, uint32_t tce_size, 2428c2ecf20Sopenharmony_ci uint64_t dma_addr, uint32_t npages); 2438c2ecf20Sopenharmony_ciint64_t opal_nmmu_set_ptcr(uint64_t chip_id, uint64_t ptcr); 2448c2ecf20Sopenharmony_ciint64_t opal_xive_reset(uint64_t version); 2458c2ecf20Sopenharmony_ciint64_t opal_xive_get_irq_info(uint32_t girq, 2468c2ecf20Sopenharmony_ci __be64 *out_flags, 2478c2ecf20Sopenharmony_ci __be64 *out_eoi_page, 2488c2ecf20Sopenharmony_ci __be64 *out_trig_page, 2498c2ecf20Sopenharmony_ci __be32 *out_esb_shift, 2508c2ecf20Sopenharmony_ci __be32 *out_src_chip); 2518c2ecf20Sopenharmony_ciint64_t opal_xive_get_irq_config(uint32_t girq, __be64 *out_vp, 2528c2ecf20Sopenharmony_ci uint8_t *out_prio, __be32 *out_lirq); 2538c2ecf20Sopenharmony_ciint64_t opal_xive_set_irq_config(uint32_t girq, uint64_t vp, uint8_t prio, 2548c2ecf20Sopenharmony_ci uint32_t lirq); 2558c2ecf20Sopenharmony_ciint64_t opal_xive_get_queue_info(uint64_t vp, uint32_t prio, 2568c2ecf20Sopenharmony_ci __be64 *out_qpage, 2578c2ecf20Sopenharmony_ci __be64 *out_qsize, 2588c2ecf20Sopenharmony_ci __be64 *out_qeoi_page, 2598c2ecf20Sopenharmony_ci __be32 *out_escalate_irq, 2608c2ecf20Sopenharmony_ci __be64 *out_qflags); 2618c2ecf20Sopenharmony_ciint64_t opal_xive_set_queue_info(uint64_t vp, uint32_t prio, 2628c2ecf20Sopenharmony_ci uint64_t qpage, 2638c2ecf20Sopenharmony_ci uint64_t qsize, 2648c2ecf20Sopenharmony_ci uint64_t qflags); 2658c2ecf20Sopenharmony_ciint64_t opal_xive_donate_page(uint32_t chip_id, uint64_t addr); 2668c2ecf20Sopenharmony_ciint64_t opal_xive_alloc_vp_block(uint32_t alloc_order); 2678c2ecf20Sopenharmony_ciint64_t opal_xive_free_vp_block(uint64_t vp); 2688c2ecf20Sopenharmony_ciint64_t opal_xive_get_vp_info(uint64_t vp, 2698c2ecf20Sopenharmony_ci __be64 *out_flags, 2708c2ecf20Sopenharmony_ci __be64 *out_cam_value, 2718c2ecf20Sopenharmony_ci __be64 *out_report_cl_pair, 2728c2ecf20Sopenharmony_ci __be32 *out_chip_id); 2738c2ecf20Sopenharmony_ciint64_t opal_xive_set_vp_info(uint64_t vp, 2748c2ecf20Sopenharmony_ci uint64_t flags, 2758c2ecf20Sopenharmony_ci uint64_t report_cl_pair); 2768c2ecf20Sopenharmony_ciint64_t opal_xive_allocate_irq_raw(uint32_t chip_id); 2778c2ecf20Sopenharmony_ciint64_t opal_xive_free_irq(uint32_t girq); 2788c2ecf20Sopenharmony_ciint64_t opal_xive_sync(uint32_t type, uint32_t id); 2798c2ecf20Sopenharmony_ciint64_t opal_xive_dump(uint32_t type, uint32_t id); 2808c2ecf20Sopenharmony_ciint64_t opal_xive_get_queue_state(uint64_t vp, uint32_t prio, 2818c2ecf20Sopenharmony_ci __be32 *out_qtoggle, 2828c2ecf20Sopenharmony_ci __be32 *out_qindex); 2838c2ecf20Sopenharmony_ciint64_t opal_xive_set_queue_state(uint64_t vp, uint32_t prio, 2848c2ecf20Sopenharmony_ci uint32_t qtoggle, 2858c2ecf20Sopenharmony_ci uint32_t qindex); 2868c2ecf20Sopenharmony_ciint64_t opal_xive_get_vp_state(uint64_t vp, __be64 *out_w01); 2878c2ecf20Sopenharmony_ci 2888c2ecf20Sopenharmony_ciint64_t opal_imc_counters_init(uint32_t type, uint64_t address, 2898c2ecf20Sopenharmony_ci uint64_t cpu_pir); 2908c2ecf20Sopenharmony_ciint64_t opal_imc_counters_start(uint32_t type, uint64_t cpu_pir); 2918c2ecf20Sopenharmony_ciint64_t opal_imc_counters_stop(uint32_t type, uint64_t cpu_pir); 2928c2ecf20Sopenharmony_ci 2938c2ecf20Sopenharmony_ciint opal_get_powercap(u32 handle, int token, u32 *pcap); 2948c2ecf20Sopenharmony_ciint opal_set_powercap(u32 handle, int token, u32 pcap); 2958c2ecf20Sopenharmony_ciint opal_get_power_shift_ratio(u32 handle, int token, u32 *psr); 2968c2ecf20Sopenharmony_ciint opal_set_power_shift_ratio(u32 handle, int token, u32 psr); 2978c2ecf20Sopenharmony_ciint opal_sensor_group_clear(u32 group_hndl, int token); 2988c2ecf20Sopenharmony_ciint opal_sensor_group_enable(u32 group_hndl, int token, bool enable); 2998c2ecf20Sopenharmony_ciint opal_nx_coproc_init(uint32_t chip_id, uint32_t ct); 3008c2ecf20Sopenharmony_ci 3018c2ecf20Sopenharmony_ciint opal_secvar_get(const char *key, uint64_t key_len, u8 *data, 3028c2ecf20Sopenharmony_ci uint64_t *data_size); 3038c2ecf20Sopenharmony_ciint opal_secvar_get_next(const char *key, uint64_t *key_len, 3048c2ecf20Sopenharmony_ci uint64_t key_buf_size); 3058c2ecf20Sopenharmony_ciint opal_secvar_enqueue_update(const char *key, uint64_t key_len, u8 *data, 3068c2ecf20Sopenharmony_ci uint64_t data_size); 3078c2ecf20Sopenharmony_ci 3088c2ecf20Sopenharmony_cis64 opal_mpipl_update(enum opal_mpipl_ops op, u64 src, u64 dest, u64 size); 3098c2ecf20Sopenharmony_cis64 opal_mpipl_register_tag(enum opal_mpipl_tags tag, u64 addr); 3108c2ecf20Sopenharmony_cis64 opal_mpipl_query_tag(enum opal_mpipl_tags tag, u64 *addr); 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_cis64 opal_signal_system_reset(s32 cpu); 3138c2ecf20Sopenharmony_cis64 opal_quiesce(u64 shutdown_type, s32 cpu); 3148c2ecf20Sopenharmony_ci 3158c2ecf20Sopenharmony_ci/* Internal functions */ 3168c2ecf20Sopenharmony_ciextern int early_init_dt_scan_opal(unsigned long node, const char *uname, 3178c2ecf20Sopenharmony_ci int depth, void *data); 3188c2ecf20Sopenharmony_ciextern int early_init_dt_scan_recoverable_ranges(unsigned long node, 3198c2ecf20Sopenharmony_ci const char *uname, int depth, void *data); 3208c2ecf20Sopenharmony_ciextern void opal_configure_cores(void); 3218c2ecf20Sopenharmony_ci 3228c2ecf20Sopenharmony_ciextern int opal_get_chars(uint32_t vtermno, char *buf, int count); 3238c2ecf20Sopenharmony_ciextern int opal_put_chars(uint32_t vtermno, const char *buf, int total_len); 3248c2ecf20Sopenharmony_ciextern int opal_put_chars_atomic(uint32_t vtermno, const char *buf, int total_len); 3258c2ecf20Sopenharmony_ciextern int opal_flush_chars(uint32_t vtermno, bool wait); 3268c2ecf20Sopenharmony_ciextern int opal_flush_console(uint32_t vtermno); 3278c2ecf20Sopenharmony_ci 3288c2ecf20Sopenharmony_ciextern void hvc_opal_init_early(void); 3298c2ecf20Sopenharmony_ci 3308c2ecf20Sopenharmony_ciextern int opal_notifier_register(struct notifier_block *nb); 3318c2ecf20Sopenharmony_ciextern int opal_notifier_unregister(struct notifier_block *nb); 3328c2ecf20Sopenharmony_ci 3338c2ecf20Sopenharmony_ciextern int opal_message_notifier_register(enum opal_msg_type msg_type, 3348c2ecf20Sopenharmony_ci struct notifier_block *nb); 3358c2ecf20Sopenharmony_ciextern int opal_message_notifier_unregister(enum opal_msg_type msg_type, 3368c2ecf20Sopenharmony_ci struct notifier_block *nb); 3378c2ecf20Sopenharmony_ciextern void opal_notifier_enable(void); 3388c2ecf20Sopenharmony_ciextern void opal_notifier_disable(void); 3398c2ecf20Sopenharmony_ciextern void opal_notifier_update_evt(uint64_t evt_mask, uint64_t evt_val); 3408c2ecf20Sopenharmony_ci 3418c2ecf20Sopenharmony_ciextern int opal_async_get_token_interruptible(void); 3428c2ecf20Sopenharmony_ciextern int opal_async_release_token(int token); 3438c2ecf20Sopenharmony_ciextern int opal_async_wait_response(uint64_t token, struct opal_msg *msg); 3448c2ecf20Sopenharmony_ciextern int opal_async_wait_response_interruptible(uint64_t token, 3458c2ecf20Sopenharmony_ci struct opal_msg *msg); 3468c2ecf20Sopenharmony_ciextern int opal_get_sensor_data(u32 sensor_hndl, u32 *sensor_data); 3478c2ecf20Sopenharmony_ciextern int opal_get_sensor_data_u64(u32 sensor_hndl, u64 *sensor_data); 3488c2ecf20Sopenharmony_ciextern int sensor_group_enable(u32 grp_hndl, bool enable); 3498c2ecf20Sopenharmony_ci 3508c2ecf20Sopenharmony_cistruct rtc_time; 3518c2ecf20Sopenharmony_ciextern time64_t opal_get_boot_time(void); 3528c2ecf20Sopenharmony_ciextern void opal_nvram_init(void); 3538c2ecf20Sopenharmony_ciextern void opal_flash_update_init(void); 3548c2ecf20Sopenharmony_ciextern void opal_flash_update_print_message(void); 3558c2ecf20Sopenharmony_ciextern int opal_elog_init(void); 3568c2ecf20Sopenharmony_ciextern void opal_platform_dump_init(void); 3578c2ecf20Sopenharmony_ciextern void opal_sys_param_init(void); 3588c2ecf20Sopenharmony_ciextern void opal_msglog_init(void); 3598c2ecf20Sopenharmony_ciextern void opal_msglog_sysfs_init(void); 3608c2ecf20Sopenharmony_ciextern int opal_async_comp_init(void); 3618c2ecf20Sopenharmony_ciextern int opal_sensor_init(void); 3628c2ecf20Sopenharmony_ciextern int opal_hmi_handler_init(void); 3638c2ecf20Sopenharmony_ciextern int opal_event_init(void); 3648c2ecf20Sopenharmony_ciint opal_power_control_init(void); 3658c2ecf20Sopenharmony_ci 3668c2ecf20Sopenharmony_ciextern int opal_machine_check(struct pt_regs *regs); 3678c2ecf20Sopenharmony_ciextern bool opal_mce_check_early_recovery(struct pt_regs *regs); 3688c2ecf20Sopenharmony_ciextern int opal_hmi_exception_early(struct pt_regs *regs); 3698c2ecf20Sopenharmony_ciextern int opal_hmi_exception_early2(struct pt_regs *regs); 3708c2ecf20Sopenharmony_ciextern int opal_handle_hmi_exception(struct pt_regs *regs); 3718c2ecf20Sopenharmony_ci 3728c2ecf20Sopenharmony_ciextern void opal_shutdown(void); 3738c2ecf20Sopenharmony_ciextern int opal_resync_timebase(void); 3748c2ecf20Sopenharmony_ci 3758c2ecf20Sopenharmony_ciextern void opal_lpc_init(void); 3768c2ecf20Sopenharmony_ci 3778c2ecf20Sopenharmony_ciextern void opal_kmsg_init(void); 3788c2ecf20Sopenharmony_ci 3798c2ecf20Sopenharmony_ciextern int opal_event_request(unsigned int opal_event_nr); 3808c2ecf20Sopenharmony_ci 3818c2ecf20Sopenharmony_cistruct opal_sg_list *opal_vmalloc_to_sg_list(void *vmalloc_addr, 3828c2ecf20Sopenharmony_ci unsigned long vmalloc_size); 3838c2ecf20Sopenharmony_civoid opal_free_sg_list(struct opal_sg_list *sg); 3848c2ecf20Sopenharmony_ci 3858c2ecf20Sopenharmony_ciextern int opal_error_code(int rc); 3868c2ecf20Sopenharmony_ci 3878c2ecf20Sopenharmony_cissize_t opal_msglog_copy(char *to, loff_t pos, size_t count); 3888c2ecf20Sopenharmony_ci 3898c2ecf20Sopenharmony_cistatic inline int opal_get_async_rc(struct opal_msg msg) 3908c2ecf20Sopenharmony_ci{ 3918c2ecf20Sopenharmony_ci if (msg.msg_type != OPAL_MSG_ASYNC_COMP) 3928c2ecf20Sopenharmony_ci return OPAL_PARAMETER; 3938c2ecf20Sopenharmony_ci else 3948c2ecf20Sopenharmony_ci return be64_to_cpu(msg.params[1]); 3958c2ecf20Sopenharmony_ci} 3968c2ecf20Sopenharmony_ci 3978c2ecf20Sopenharmony_civoid opal_wake_poller(void); 3988c2ecf20Sopenharmony_ci 3998c2ecf20Sopenharmony_civoid opal_powercap_init(void); 4008c2ecf20Sopenharmony_civoid opal_psr_init(void); 4018c2ecf20Sopenharmony_civoid opal_sensor_groups_init(void); 4028c2ecf20Sopenharmony_ci 4038c2ecf20Sopenharmony_ci#endif /* __ASSEMBLY__ */ 4048c2ecf20Sopenharmony_ci 4058c2ecf20Sopenharmony_ci#endif /* _ASM_POWERPC_OPAL_H */ 406