162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci * 362306a36Sopenharmony_ci * Copyright 2020-2022 HabanaLabs, Ltd. 462306a36Sopenharmony_ci * All Rights Reserved. 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci */ 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#ifndef CPUCP_IF_H 962306a36Sopenharmony_ci#define CPUCP_IF_H 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#include <linux/types.h> 1262306a36Sopenharmony_ci#include <linux/if_ether.h> 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci#include "hl_boot_if.h" 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci#define NUM_HBM_PSEUDO_CH 2 1762306a36Sopenharmony_ci#define NUM_HBM_CH_PER_DEV 8 1862306a36Sopenharmony_ci#define CPUCP_PKT_HBM_ECC_INFO_WR_PAR_SHIFT 0 1962306a36Sopenharmony_ci#define CPUCP_PKT_HBM_ECC_INFO_WR_PAR_MASK 0x00000001 2062306a36Sopenharmony_ci#define CPUCP_PKT_HBM_ECC_INFO_RD_PAR_SHIFT 1 2162306a36Sopenharmony_ci#define CPUCP_PKT_HBM_ECC_INFO_RD_PAR_MASK 0x00000002 2262306a36Sopenharmony_ci#define CPUCP_PKT_HBM_ECC_INFO_CA_PAR_SHIFT 2 2362306a36Sopenharmony_ci#define CPUCP_PKT_HBM_ECC_INFO_CA_PAR_MASK 0x00000004 2462306a36Sopenharmony_ci#define CPUCP_PKT_HBM_ECC_INFO_DERR_SHIFT 3 2562306a36Sopenharmony_ci#define CPUCP_PKT_HBM_ECC_INFO_DERR_MASK 0x00000008 2662306a36Sopenharmony_ci#define CPUCP_PKT_HBM_ECC_INFO_SERR_SHIFT 4 2762306a36Sopenharmony_ci#define CPUCP_PKT_HBM_ECC_INFO_SERR_MASK 0x00000010 2862306a36Sopenharmony_ci#define CPUCP_PKT_HBM_ECC_INFO_TYPE_SHIFT 5 2962306a36Sopenharmony_ci#define CPUCP_PKT_HBM_ECC_INFO_TYPE_MASK 0x00000020 3062306a36Sopenharmony_ci#define CPUCP_PKT_HBM_ECC_INFO_HBM_CH_SHIFT 6 3162306a36Sopenharmony_ci#define CPUCP_PKT_HBM_ECC_INFO_HBM_CH_MASK 0x000007C0 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci#define PLL_MAP_MAX_BITS 128 3462306a36Sopenharmony_ci#define PLL_MAP_LEN (PLL_MAP_MAX_BITS / 8) 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ci/* 3762306a36Sopenharmony_ci * info of the pkt queue pointers in the first async occurrence 3862306a36Sopenharmony_ci */ 3962306a36Sopenharmony_cistruct cpucp_pkt_sync_err { 4062306a36Sopenharmony_ci __le32 pi; 4162306a36Sopenharmony_ci __le32 ci; 4262306a36Sopenharmony_ci}; 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_cistruct hl_eq_hbm_ecc_data { 4562306a36Sopenharmony_ci /* SERR counter */ 4662306a36Sopenharmony_ci __le32 sec_cnt; 4762306a36Sopenharmony_ci /* DERR counter */ 4862306a36Sopenharmony_ci __le32 dec_cnt; 4962306a36Sopenharmony_ci /* Supplemental Information according to the mask bits */ 5062306a36Sopenharmony_ci __le32 hbm_ecc_info; 5162306a36Sopenharmony_ci /* Address in hbm where the ecc happened */ 5262306a36Sopenharmony_ci __le32 first_addr; 5362306a36Sopenharmony_ci /* SERR continuous address counter */ 5462306a36Sopenharmony_ci __le32 sec_cont_cnt; 5562306a36Sopenharmony_ci __le32 pad; 5662306a36Sopenharmony_ci}; 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_ci/* 5962306a36Sopenharmony_ci * EVENT QUEUE 6062306a36Sopenharmony_ci */ 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_cistruct hl_eq_header { 6362306a36Sopenharmony_ci __le32 reserved; 6462306a36Sopenharmony_ci __le32 ctl; 6562306a36Sopenharmony_ci}; 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_cistruct hl_eq_ecc_data { 6862306a36Sopenharmony_ci __le64 ecc_address; 6962306a36Sopenharmony_ci __le64 ecc_syndrom; 7062306a36Sopenharmony_ci __u8 memory_wrapper_idx; 7162306a36Sopenharmony_ci __u8 is_critical; 7262306a36Sopenharmony_ci __u8 pad[6]; 7362306a36Sopenharmony_ci}; 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_cienum hl_sm_sei_cause { 7662306a36Sopenharmony_ci SM_SEI_SO_OVERFLOW, 7762306a36Sopenharmony_ci SM_SEI_LBW_4B_UNALIGNED, 7862306a36Sopenharmony_ci SM_SEI_AXI_RESPONSE_ERR 7962306a36Sopenharmony_ci}; 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_cistruct hl_eq_sm_sei_data { 8262306a36Sopenharmony_ci __le32 sei_log; 8362306a36Sopenharmony_ci /* enum hl_sm_sei_cause */ 8462306a36Sopenharmony_ci __u8 sei_cause; 8562306a36Sopenharmony_ci __u8 pad[3]; 8662306a36Sopenharmony_ci}; 8762306a36Sopenharmony_ci 8862306a36Sopenharmony_cienum hl_fw_alive_severity { 8962306a36Sopenharmony_ci FW_ALIVE_SEVERITY_MINOR, 9062306a36Sopenharmony_ci FW_ALIVE_SEVERITY_CRITICAL 9162306a36Sopenharmony_ci}; 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_cistruct hl_eq_fw_alive { 9462306a36Sopenharmony_ci __le64 uptime_seconds; 9562306a36Sopenharmony_ci __le32 process_id; 9662306a36Sopenharmony_ci __le32 thread_id; 9762306a36Sopenharmony_ci /* enum hl_fw_alive_severity */ 9862306a36Sopenharmony_ci __u8 severity; 9962306a36Sopenharmony_ci __u8 pad[7]; 10062306a36Sopenharmony_ci}; 10162306a36Sopenharmony_ci 10262306a36Sopenharmony_cistruct hl_eq_intr_cause { 10362306a36Sopenharmony_ci __le64 intr_cause_data; 10462306a36Sopenharmony_ci}; 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_cistruct hl_eq_pcie_drain_ind_data { 10762306a36Sopenharmony_ci struct hl_eq_intr_cause intr_cause; 10862306a36Sopenharmony_ci __le64 drain_wr_addr_lbw; 10962306a36Sopenharmony_ci __le64 drain_rd_addr_lbw; 11062306a36Sopenharmony_ci __le64 drain_wr_addr_hbw; 11162306a36Sopenharmony_ci __le64 drain_rd_addr_hbw; 11262306a36Sopenharmony_ci}; 11362306a36Sopenharmony_ci 11462306a36Sopenharmony_cistruct hl_eq_razwi_lbw_info_regs { 11562306a36Sopenharmony_ci __le32 rr_aw_razwi_reg; 11662306a36Sopenharmony_ci __le32 rr_aw_razwi_id_reg; 11762306a36Sopenharmony_ci __le32 rr_ar_razwi_reg; 11862306a36Sopenharmony_ci __le32 rr_ar_razwi_id_reg; 11962306a36Sopenharmony_ci}; 12062306a36Sopenharmony_ci 12162306a36Sopenharmony_cistruct hl_eq_razwi_hbw_info_regs { 12262306a36Sopenharmony_ci __le32 rr_aw_razwi_hi_reg; 12362306a36Sopenharmony_ci __le32 rr_aw_razwi_lo_reg; 12462306a36Sopenharmony_ci __le32 rr_aw_razwi_id_reg; 12562306a36Sopenharmony_ci __le32 rr_ar_razwi_hi_reg; 12662306a36Sopenharmony_ci __le32 rr_ar_razwi_lo_reg; 12762306a36Sopenharmony_ci __le32 rr_ar_razwi_id_reg; 12862306a36Sopenharmony_ci}; 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_ci/* razwi_happened masks */ 13162306a36Sopenharmony_ci#define RAZWI_HAPPENED_HBW 0x1 13262306a36Sopenharmony_ci#define RAZWI_HAPPENED_LBW 0x2 13362306a36Sopenharmony_ci#define RAZWI_HAPPENED_AW 0x4 13462306a36Sopenharmony_ci#define RAZWI_HAPPENED_AR 0x8 13562306a36Sopenharmony_ci 13662306a36Sopenharmony_cistruct hl_eq_razwi_info { 13762306a36Sopenharmony_ci __le32 razwi_happened_mask; 13862306a36Sopenharmony_ci union { 13962306a36Sopenharmony_ci struct hl_eq_razwi_lbw_info_regs lbw; 14062306a36Sopenharmony_ci struct hl_eq_razwi_hbw_info_regs hbw; 14162306a36Sopenharmony_ci }; 14262306a36Sopenharmony_ci __le32 pad; 14362306a36Sopenharmony_ci}; 14462306a36Sopenharmony_ci 14562306a36Sopenharmony_cistruct hl_eq_razwi_with_intr_cause { 14662306a36Sopenharmony_ci struct hl_eq_razwi_info razwi_info; 14762306a36Sopenharmony_ci struct hl_eq_intr_cause intr_cause; 14862306a36Sopenharmony_ci}; 14962306a36Sopenharmony_ci 15062306a36Sopenharmony_ci#define HBM_CA_ERR_CMD_LIFO_LEN 8 15162306a36Sopenharmony_ci#define HBM_RD_ERR_DATA_LIFO_LEN 8 15262306a36Sopenharmony_ci#define HBM_WR_PAR_CMD_LIFO_LEN 11 15362306a36Sopenharmony_ci 15462306a36Sopenharmony_cienum hl_hbm_sei_cause { 15562306a36Sopenharmony_ci /* Command/address parity error event is split into 2 events due to 15662306a36Sopenharmony_ci * size limitation: ODD suffix for odd HBM CK_t cycles and EVEN suffix 15762306a36Sopenharmony_ci * for even HBM CK_t cycles 15862306a36Sopenharmony_ci */ 15962306a36Sopenharmony_ci HBM_SEI_CMD_PARITY_EVEN, 16062306a36Sopenharmony_ci HBM_SEI_CMD_PARITY_ODD, 16162306a36Sopenharmony_ci /* Read errors can be reflected as a combination of SERR/DERR/parity 16262306a36Sopenharmony_ci * errors. Therefore, we define one event for all read error types. 16362306a36Sopenharmony_ci * LKD will perform further proccessing. 16462306a36Sopenharmony_ci */ 16562306a36Sopenharmony_ci HBM_SEI_READ_ERR, 16662306a36Sopenharmony_ci HBM_SEI_WRITE_DATA_PARITY_ERR, 16762306a36Sopenharmony_ci HBM_SEI_CATTRIP, 16862306a36Sopenharmony_ci HBM_SEI_MEM_BIST_FAIL, 16962306a36Sopenharmony_ci HBM_SEI_DFI, 17062306a36Sopenharmony_ci HBM_SEI_INV_TEMP_READ_OUT, 17162306a36Sopenharmony_ci HBM_SEI_BIST_FAIL, 17262306a36Sopenharmony_ci}; 17362306a36Sopenharmony_ci 17462306a36Sopenharmony_ci/* Masks for parsing hl_hbm_sei_headr fields */ 17562306a36Sopenharmony_ci#define HBM_ECC_SERR_CNTR_MASK 0xFF 17662306a36Sopenharmony_ci#define HBM_ECC_DERR_CNTR_MASK 0xFF00 17762306a36Sopenharmony_ci#define HBM_RD_PARITY_CNTR_MASK 0xFF0000 17862306a36Sopenharmony_ci 17962306a36Sopenharmony_ci/* HBM index and MC index are known by the event_id */ 18062306a36Sopenharmony_cistruct hl_hbm_sei_header { 18162306a36Sopenharmony_ci union { 18262306a36Sopenharmony_ci /* relevant only in case of HBM read error */ 18362306a36Sopenharmony_ci struct { 18462306a36Sopenharmony_ci __u8 ecc_serr_cnt; 18562306a36Sopenharmony_ci __u8 ecc_derr_cnt; 18662306a36Sopenharmony_ci __u8 read_par_cnt; 18762306a36Sopenharmony_ci __u8 reserved; 18862306a36Sopenharmony_ci }; 18962306a36Sopenharmony_ci /* All other cases */ 19062306a36Sopenharmony_ci __le32 cnt; 19162306a36Sopenharmony_ci }; 19262306a36Sopenharmony_ci __u8 sei_cause; /* enum hl_hbm_sei_cause */ 19362306a36Sopenharmony_ci __u8 mc_channel; /* range: 0-3 */ 19462306a36Sopenharmony_ci __u8 mc_pseudo_channel; /* range: 0-7 */ 19562306a36Sopenharmony_ci __u8 is_critical; 19662306a36Sopenharmony_ci}; 19762306a36Sopenharmony_ci 19862306a36Sopenharmony_ci#define HBM_RD_ADDR_SID_SHIFT 0 19962306a36Sopenharmony_ci#define HBM_RD_ADDR_SID_MASK 0x1 20062306a36Sopenharmony_ci#define HBM_RD_ADDR_BG_SHIFT 1 20162306a36Sopenharmony_ci#define HBM_RD_ADDR_BG_MASK 0x6 20262306a36Sopenharmony_ci#define HBM_RD_ADDR_BA_SHIFT 3 20362306a36Sopenharmony_ci#define HBM_RD_ADDR_BA_MASK 0x18 20462306a36Sopenharmony_ci#define HBM_RD_ADDR_COL_SHIFT 5 20562306a36Sopenharmony_ci#define HBM_RD_ADDR_COL_MASK 0x7E0 20662306a36Sopenharmony_ci#define HBM_RD_ADDR_ROW_SHIFT 11 20762306a36Sopenharmony_ci#define HBM_RD_ADDR_ROW_MASK 0x3FFF800 20862306a36Sopenharmony_ci 20962306a36Sopenharmony_cistruct hbm_rd_addr { 21062306a36Sopenharmony_ci union { 21162306a36Sopenharmony_ci /* bit fields are only for FW use */ 21262306a36Sopenharmony_ci struct { 21362306a36Sopenharmony_ci u32 dbg_rd_err_addr_sid:1; 21462306a36Sopenharmony_ci u32 dbg_rd_err_addr_bg:2; 21562306a36Sopenharmony_ci u32 dbg_rd_err_addr_ba:2; 21662306a36Sopenharmony_ci u32 dbg_rd_err_addr_col:6; 21762306a36Sopenharmony_ci u32 dbg_rd_err_addr_row:15; 21862306a36Sopenharmony_ci u32 reserved:6; 21962306a36Sopenharmony_ci }; 22062306a36Sopenharmony_ci __le32 rd_addr_val; 22162306a36Sopenharmony_ci }; 22262306a36Sopenharmony_ci}; 22362306a36Sopenharmony_ci 22462306a36Sopenharmony_ci#define HBM_RD_ERR_BEAT_SHIFT 2 22562306a36Sopenharmony_ci/* dbg_rd_err_misc fields: */ 22662306a36Sopenharmony_ci/* Read parity is calculated per DW on every beat */ 22762306a36Sopenharmony_ci#define HBM_RD_ERR_PAR_ERR_BEAT0_SHIFT 0 22862306a36Sopenharmony_ci#define HBM_RD_ERR_PAR_ERR_BEAT0_MASK 0x3 22962306a36Sopenharmony_ci#define HBM_RD_ERR_PAR_DATA_BEAT0_SHIFT 8 23062306a36Sopenharmony_ci#define HBM_RD_ERR_PAR_DATA_BEAT0_MASK 0x300 23162306a36Sopenharmony_ci/* ECC is calculated per PC on every beat */ 23262306a36Sopenharmony_ci#define HBM_RD_ERR_SERR_BEAT0_SHIFT 16 23362306a36Sopenharmony_ci#define HBM_RD_ERR_SERR_BEAT0_MASK 0x10000 23462306a36Sopenharmony_ci#define HBM_RD_ERR_DERR_BEAT0_SHIFT 24 23562306a36Sopenharmony_ci#define HBM_RD_ERR_DERR_BEAT0_MASK 0x100000 23662306a36Sopenharmony_ci 23762306a36Sopenharmony_cistruct hl_eq_hbm_sei_read_err_intr_info { 23862306a36Sopenharmony_ci /* DFI_RD_ERR_REP_ADDR */ 23962306a36Sopenharmony_ci struct hbm_rd_addr dbg_rd_err_addr; 24062306a36Sopenharmony_ci /* DFI_RD_ERR_REP_ERR */ 24162306a36Sopenharmony_ci union { 24262306a36Sopenharmony_ci struct { 24362306a36Sopenharmony_ci /* bit fields are only for FW use */ 24462306a36Sopenharmony_ci u32 dbg_rd_err_par:8; 24562306a36Sopenharmony_ci u32 dbg_rd_err_par_data:8; 24662306a36Sopenharmony_ci u32 dbg_rd_err_serr:4; 24762306a36Sopenharmony_ci u32 dbg_rd_err_derr:4; 24862306a36Sopenharmony_ci u32 reserved:8; 24962306a36Sopenharmony_ci }; 25062306a36Sopenharmony_ci __le32 dbg_rd_err_misc; 25162306a36Sopenharmony_ci }; 25262306a36Sopenharmony_ci /* DFI_RD_ERR_REP_DM */ 25362306a36Sopenharmony_ci __le32 dbg_rd_err_dm; 25462306a36Sopenharmony_ci /* DFI_RD_ERR_REP_SYNDROME */ 25562306a36Sopenharmony_ci __le32 dbg_rd_err_syndrome; 25662306a36Sopenharmony_ci /* DFI_RD_ERR_REP_DATA */ 25762306a36Sopenharmony_ci __le32 dbg_rd_err_data[HBM_RD_ERR_DATA_LIFO_LEN]; 25862306a36Sopenharmony_ci}; 25962306a36Sopenharmony_ci 26062306a36Sopenharmony_cistruct hl_eq_hbm_sei_ca_par_intr_info { 26162306a36Sopenharmony_ci /* 14 LSBs */ 26262306a36Sopenharmony_ci __le16 dbg_row[HBM_CA_ERR_CMD_LIFO_LEN]; 26362306a36Sopenharmony_ci /* 18 LSBs */ 26462306a36Sopenharmony_ci __le32 dbg_col[HBM_CA_ERR_CMD_LIFO_LEN]; 26562306a36Sopenharmony_ci}; 26662306a36Sopenharmony_ci 26762306a36Sopenharmony_ci#define WR_PAR_LAST_CMD_COL_SHIFT 0 26862306a36Sopenharmony_ci#define WR_PAR_LAST_CMD_COL_MASK 0x3F 26962306a36Sopenharmony_ci#define WR_PAR_LAST_CMD_BG_SHIFT 6 27062306a36Sopenharmony_ci#define WR_PAR_LAST_CMD_BG_MASK 0xC0 27162306a36Sopenharmony_ci#define WR_PAR_LAST_CMD_BA_SHIFT 8 27262306a36Sopenharmony_ci#define WR_PAR_LAST_CMD_BA_MASK 0x300 27362306a36Sopenharmony_ci#define WR_PAR_LAST_CMD_SID_SHIFT 10 27462306a36Sopenharmony_ci#define WR_PAR_LAST_CMD_SID_MASK 0x400 27562306a36Sopenharmony_ci 27662306a36Sopenharmony_ci/* Row address isn't latched */ 27762306a36Sopenharmony_cistruct hbm_sei_wr_cmd_address { 27862306a36Sopenharmony_ci /* DFI_DERR_LAST_CMD */ 27962306a36Sopenharmony_ci union { 28062306a36Sopenharmony_ci struct { 28162306a36Sopenharmony_ci /* bit fields are only for FW use */ 28262306a36Sopenharmony_ci u32 col:6; 28362306a36Sopenharmony_ci u32 bg:2; 28462306a36Sopenharmony_ci u32 ba:2; 28562306a36Sopenharmony_ci u32 sid:1; 28662306a36Sopenharmony_ci u32 reserved:21; 28762306a36Sopenharmony_ci }; 28862306a36Sopenharmony_ci __le32 dbg_wr_cmd_addr; 28962306a36Sopenharmony_ci }; 29062306a36Sopenharmony_ci}; 29162306a36Sopenharmony_ci 29262306a36Sopenharmony_cistruct hl_eq_hbm_sei_wr_par_intr_info { 29362306a36Sopenharmony_ci /* entry 0: WR command address from the 1st cycle prior to the error 29462306a36Sopenharmony_ci * entry 1: WR command address from the 2nd cycle prior to the error 29562306a36Sopenharmony_ci * and so on... 29662306a36Sopenharmony_ci */ 29762306a36Sopenharmony_ci struct hbm_sei_wr_cmd_address dbg_last_wr_cmds[HBM_WR_PAR_CMD_LIFO_LEN]; 29862306a36Sopenharmony_ci /* derr[0:1] - 1st HBM cycle DERR output 29962306a36Sopenharmony_ci * derr[2:3] - 2nd HBM cycle DERR output 30062306a36Sopenharmony_ci */ 30162306a36Sopenharmony_ci __u8 dbg_derr; 30262306a36Sopenharmony_ci /* extend to reach 8B */ 30362306a36Sopenharmony_ci __u8 pad[3]; 30462306a36Sopenharmony_ci}; 30562306a36Sopenharmony_ci 30662306a36Sopenharmony_ci/* 30762306a36Sopenharmony_ci * this struct represents the following sei causes: 30862306a36Sopenharmony_ci * command parity, ECC double error, ECC single error, dfi error, cattrip, 30962306a36Sopenharmony_ci * temperature read-out, read parity error and write parity error. 31062306a36Sopenharmony_ci * some only use the header while some have extra data. 31162306a36Sopenharmony_ci */ 31262306a36Sopenharmony_cistruct hl_eq_hbm_sei_data { 31362306a36Sopenharmony_ci struct hl_hbm_sei_header hdr; 31462306a36Sopenharmony_ci union { 31562306a36Sopenharmony_ci struct hl_eq_hbm_sei_ca_par_intr_info ca_parity_even_info; 31662306a36Sopenharmony_ci struct hl_eq_hbm_sei_ca_par_intr_info ca_parity_odd_info; 31762306a36Sopenharmony_ci struct hl_eq_hbm_sei_read_err_intr_info read_err_info; 31862306a36Sopenharmony_ci struct hl_eq_hbm_sei_wr_par_intr_info wr_parity_info; 31962306a36Sopenharmony_ci }; 32062306a36Sopenharmony_ci}; 32162306a36Sopenharmony_ci 32262306a36Sopenharmony_ci/* Engine/farm arc interrupt type */ 32362306a36Sopenharmony_cienum hl_engine_arc_interrupt_type { 32462306a36Sopenharmony_ci /* Qman/farm ARC DCCM QUEUE FULL interrupt type */ 32562306a36Sopenharmony_ci ENGINE_ARC_DCCM_QUEUE_FULL_IRQ = 1 32662306a36Sopenharmony_ci}; 32762306a36Sopenharmony_ci 32862306a36Sopenharmony_ci/* Data structure specifies details of payload of DCCM QUEUE FULL interrupt */ 32962306a36Sopenharmony_cistruct hl_engine_arc_dccm_queue_full_irq { 33062306a36Sopenharmony_ci /* Queue index value which caused DCCM QUEUE FULL */ 33162306a36Sopenharmony_ci __le32 queue_index; 33262306a36Sopenharmony_ci __le32 pad; 33362306a36Sopenharmony_ci}; 33462306a36Sopenharmony_ci 33562306a36Sopenharmony_ci/* Data structure specifies details of QM/FARM ARC interrupt */ 33662306a36Sopenharmony_cistruct hl_eq_engine_arc_intr_data { 33762306a36Sopenharmony_ci /* ARC engine id e.g. DCORE0_TPC0_QM_ARC, DCORE0_TCP1_QM_ARC */ 33862306a36Sopenharmony_ci __le32 engine_id; 33962306a36Sopenharmony_ci __le32 intr_type; /* enum hl_engine_arc_interrupt_type */ 34062306a36Sopenharmony_ci /* More info related to the interrupt e.g. queue index 34162306a36Sopenharmony_ci * incase of DCCM_QUEUE_FULL interrupt. 34262306a36Sopenharmony_ci */ 34362306a36Sopenharmony_ci __le64 payload; 34462306a36Sopenharmony_ci __le64 pad[5]; 34562306a36Sopenharmony_ci}; 34662306a36Sopenharmony_ci 34762306a36Sopenharmony_ci#define ADDR_DEC_ADDRESS_COUNT_MAX 4 34862306a36Sopenharmony_ci 34962306a36Sopenharmony_ci/* Data structure specifies details of ADDR_DEC interrupt */ 35062306a36Sopenharmony_cistruct hl_eq_addr_dec_intr_data { 35162306a36Sopenharmony_ci struct hl_eq_intr_cause intr_cause; 35262306a36Sopenharmony_ci __le64 addr[ADDR_DEC_ADDRESS_COUNT_MAX]; 35362306a36Sopenharmony_ci __u8 addr_cnt; 35462306a36Sopenharmony_ci __u8 pad[7]; 35562306a36Sopenharmony_ci}; 35662306a36Sopenharmony_ci 35762306a36Sopenharmony_cistruct hl_eq_entry { 35862306a36Sopenharmony_ci struct hl_eq_header hdr; 35962306a36Sopenharmony_ci union { 36062306a36Sopenharmony_ci __le64 data_placeholder; 36162306a36Sopenharmony_ci struct hl_eq_ecc_data ecc_data; 36262306a36Sopenharmony_ci struct hl_eq_hbm_ecc_data hbm_ecc_data; /* Obsolete */ 36362306a36Sopenharmony_ci struct hl_eq_sm_sei_data sm_sei_data; 36462306a36Sopenharmony_ci struct cpucp_pkt_sync_err pkt_sync_err; 36562306a36Sopenharmony_ci struct hl_eq_fw_alive fw_alive; 36662306a36Sopenharmony_ci struct hl_eq_intr_cause intr_cause; 36762306a36Sopenharmony_ci struct hl_eq_pcie_drain_ind_data pcie_drain_ind_data; 36862306a36Sopenharmony_ci struct hl_eq_razwi_info razwi_info; 36962306a36Sopenharmony_ci struct hl_eq_razwi_with_intr_cause razwi_with_intr_cause; 37062306a36Sopenharmony_ci struct hl_eq_hbm_sei_data sei_data; /* Gaudi2 HBM */ 37162306a36Sopenharmony_ci struct hl_eq_engine_arc_intr_data arc_data; 37262306a36Sopenharmony_ci struct hl_eq_addr_dec_intr_data addr_dec; 37362306a36Sopenharmony_ci __le64 data[7]; 37462306a36Sopenharmony_ci }; 37562306a36Sopenharmony_ci}; 37662306a36Sopenharmony_ci 37762306a36Sopenharmony_ci#define HL_EQ_ENTRY_SIZE sizeof(struct hl_eq_entry) 37862306a36Sopenharmony_ci 37962306a36Sopenharmony_ci#define EQ_CTL_READY_SHIFT 31 38062306a36Sopenharmony_ci#define EQ_CTL_READY_MASK 0x80000000 38162306a36Sopenharmony_ci 38262306a36Sopenharmony_ci#define EQ_CTL_EVENT_TYPE_SHIFT 16 38362306a36Sopenharmony_ci#define EQ_CTL_EVENT_TYPE_MASK 0x0FFF0000 38462306a36Sopenharmony_ci 38562306a36Sopenharmony_ci#define EQ_CTL_INDEX_SHIFT 0 38662306a36Sopenharmony_ci#define EQ_CTL_INDEX_MASK 0x0000FFFF 38762306a36Sopenharmony_ci 38862306a36Sopenharmony_cienum pq_init_status { 38962306a36Sopenharmony_ci PQ_INIT_STATUS_NA = 0, 39062306a36Sopenharmony_ci PQ_INIT_STATUS_READY_FOR_CP, 39162306a36Sopenharmony_ci PQ_INIT_STATUS_READY_FOR_HOST, 39262306a36Sopenharmony_ci PQ_INIT_STATUS_READY_FOR_CP_SINGLE_MSI, 39362306a36Sopenharmony_ci PQ_INIT_STATUS_LEN_NOT_POWER_OF_TWO_ERR, 39462306a36Sopenharmony_ci PQ_INIT_STATUS_ILLEGAL_Q_ADDR_ERR 39562306a36Sopenharmony_ci}; 39662306a36Sopenharmony_ci 39762306a36Sopenharmony_ci/* 39862306a36Sopenharmony_ci * CpuCP Primary Queue Packets 39962306a36Sopenharmony_ci * 40062306a36Sopenharmony_ci * During normal operation, the host's kernel driver needs to send various 40162306a36Sopenharmony_ci * messages to CpuCP, usually either to SET some value into a H/W periphery or 40262306a36Sopenharmony_ci * to GET the current value of some H/W periphery. For example, SET the 40362306a36Sopenharmony_ci * frequency of MME/TPC and GET the value of the thermal sensor. 40462306a36Sopenharmony_ci * 40562306a36Sopenharmony_ci * These messages can be initiated either by the User application or by the 40662306a36Sopenharmony_ci * host's driver itself, e.g. power management code. In either case, the 40762306a36Sopenharmony_ci * communication from the host's driver to CpuCP will *always* be in 40862306a36Sopenharmony_ci * synchronous mode, meaning that the host will send a single message and poll 40962306a36Sopenharmony_ci * until the message was acknowledged and the results are ready (if results are 41062306a36Sopenharmony_ci * needed). 41162306a36Sopenharmony_ci * 41262306a36Sopenharmony_ci * This means that only a single message can be sent at a time and the host's 41362306a36Sopenharmony_ci * driver must wait for its result before sending the next message. Having said 41462306a36Sopenharmony_ci * that, because these are control messages which are sent in a relatively low 41562306a36Sopenharmony_ci * frequency, this limitation seems acceptable. It's important to note that 41662306a36Sopenharmony_ci * in case of multiple devices, messages to different devices *can* be sent 41762306a36Sopenharmony_ci * at the same time. 41862306a36Sopenharmony_ci * 41962306a36Sopenharmony_ci * The message, inputs/outputs (if relevant) and fence object will be located 42062306a36Sopenharmony_ci * on the device DDR at an address that will be determined by the host's driver. 42162306a36Sopenharmony_ci * During device initialization phase, the host will pass to CpuCP that address. 42262306a36Sopenharmony_ci * Most of the message types will contain inputs/outputs inside the message 42362306a36Sopenharmony_ci * itself. The common part of each message will contain the opcode of the 42462306a36Sopenharmony_ci * message (its type) and a field representing a fence object. 42562306a36Sopenharmony_ci * 42662306a36Sopenharmony_ci * When the host's driver wishes to send a message to CPU CP, it will write the 42762306a36Sopenharmony_ci * message contents to the device DDR, clear the fence object and then write to 42862306a36Sopenharmony_ci * the PSOC_ARC1_AUX_SW_INTR, to issue interrupt 121 to ARC Management CPU. 42962306a36Sopenharmony_ci * 43062306a36Sopenharmony_ci * Upon receiving the interrupt (#121), CpuCP will read the message from the 43162306a36Sopenharmony_ci * DDR. In case the message is a SET operation, CpuCP will first perform the 43262306a36Sopenharmony_ci * operation and then write to the fence object on the device DDR. In case the 43362306a36Sopenharmony_ci * message is a GET operation, CpuCP will first fill the results section on the 43462306a36Sopenharmony_ci * device DDR and then write to the fence object. If an error occurred, CpuCP 43562306a36Sopenharmony_ci * will fill the rc field with the right error code. 43662306a36Sopenharmony_ci * 43762306a36Sopenharmony_ci * In the meantime, the host's driver will poll on the fence object. Once the 43862306a36Sopenharmony_ci * host sees that the fence object is signaled, it will read the results from 43962306a36Sopenharmony_ci * the device DDR (if relevant) and resume the code execution in the host's 44062306a36Sopenharmony_ci * driver. 44162306a36Sopenharmony_ci * 44262306a36Sopenharmony_ci * To use QMAN packets, the opcode must be the QMAN opcode, shifted by 8 44362306a36Sopenharmony_ci * so the value being put by the host's driver matches the value read by CpuCP 44462306a36Sopenharmony_ci * 44562306a36Sopenharmony_ci * Non-QMAN packets should be limited to values 1 through (2^8 - 1) 44662306a36Sopenharmony_ci * 44762306a36Sopenharmony_ci * Detailed description: 44862306a36Sopenharmony_ci * 44962306a36Sopenharmony_ci * CPUCP_PACKET_DISABLE_PCI_ACCESS - 45062306a36Sopenharmony_ci * After receiving this packet the embedded CPU must NOT issue PCI 45162306a36Sopenharmony_ci * transactions (read/write) towards the Host CPU. This also include 45262306a36Sopenharmony_ci * sending MSI-X interrupts. 45362306a36Sopenharmony_ci * This packet is usually sent before the device is moved to D3Hot state. 45462306a36Sopenharmony_ci * 45562306a36Sopenharmony_ci * CPUCP_PACKET_ENABLE_PCI_ACCESS - 45662306a36Sopenharmony_ci * After receiving this packet the embedded CPU is allowed to issue PCI 45762306a36Sopenharmony_ci * transactions towards the Host CPU, including sending MSI-X interrupts. 45862306a36Sopenharmony_ci * This packet is usually send after the device is moved to D0 state. 45962306a36Sopenharmony_ci * 46062306a36Sopenharmony_ci * CPUCP_PACKET_TEMPERATURE_GET - 46162306a36Sopenharmony_ci * Fetch the current temperature / Max / Max Hyst / Critical / 46262306a36Sopenharmony_ci * Critical Hyst of a specified thermal sensor. The packet's 46362306a36Sopenharmony_ci * arguments specify the desired sensor and the field to get. 46462306a36Sopenharmony_ci * 46562306a36Sopenharmony_ci * CPUCP_PACKET_VOLTAGE_GET - 46662306a36Sopenharmony_ci * Fetch the voltage / Max / Min of a specified sensor. The packet's 46762306a36Sopenharmony_ci * arguments specify the sensor and type. 46862306a36Sopenharmony_ci * 46962306a36Sopenharmony_ci * CPUCP_PACKET_CURRENT_GET - 47062306a36Sopenharmony_ci * Fetch the current / Max / Min of a specified sensor. The packet's 47162306a36Sopenharmony_ci * arguments specify the sensor and type. 47262306a36Sopenharmony_ci * 47362306a36Sopenharmony_ci * CPUCP_PACKET_FAN_SPEED_GET - 47462306a36Sopenharmony_ci * Fetch the speed / Max / Min of a specified fan. The packet's 47562306a36Sopenharmony_ci * arguments specify the sensor and type. 47662306a36Sopenharmony_ci * 47762306a36Sopenharmony_ci * CPUCP_PACKET_PWM_GET - 47862306a36Sopenharmony_ci * Fetch the pwm value / mode of a specified pwm. The packet's 47962306a36Sopenharmony_ci * arguments specify the sensor and type. 48062306a36Sopenharmony_ci * 48162306a36Sopenharmony_ci * CPUCP_PACKET_PWM_SET - 48262306a36Sopenharmony_ci * Set the pwm value / mode of a specified pwm. The packet's 48362306a36Sopenharmony_ci * arguments specify the sensor, type and value. 48462306a36Sopenharmony_ci * 48562306a36Sopenharmony_ci * CPUCP_PACKET_FREQUENCY_SET - 48662306a36Sopenharmony_ci * Set the frequency of a specified PLL. The packet's arguments specify 48762306a36Sopenharmony_ci * the PLL and the desired frequency. The actual frequency in the device 48862306a36Sopenharmony_ci * might differ from the requested frequency. 48962306a36Sopenharmony_ci * 49062306a36Sopenharmony_ci * CPUCP_PACKET_FREQUENCY_GET - 49162306a36Sopenharmony_ci * Fetch the frequency of a specified PLL. The packet's arguments specify 49262306a36Sopenharmony_ci * the PLL. 49362306a36Sopenharmony_ci * 49462306a36Sopenharmony_ci * CPUCP_PACKET_LED_SET - 49562306a36Sopenharmony_ci * Set the state of a specified led. The packet's arguments 49662306a36Sopenharmony_ci * specify the led and the desired state. 49762306a36Sopenharmony_ci * 49862306a36Sopenharmony_ci * CPUCP_PACKET_I2C_WR - 49962306a36Sopenharmony_ci * Write 32-bit value to I2C device. The packet's arguments specify the 50062306a36Sopenharmony_ci * I2C bus, address and value. 50162306a36Sopenharmony_ci * 50262306a36Sopenharmony_ci * CPUCP_PACKET_I2C_RD - 50362306a36Sopenharmony_ci * Read 32-bit value from I2C device. The packet's arguments specify the 50462306a36Sopenharmony_ci * I2C bus and address. 50562306a36Sopenharmony_ci * 50662306a36Sopenharmony_ci * CPUCP_PACKET_INFO_GET - 50762306a36Sopenharmony_ci * Fetch information from the device as specified in the packet's 50862306a36Sopenharmony_ci * structure. The host's driver passes the max size it allows the CpuCP to 50962306a36Sopenharmony_ci * write to the structure, to prevent data corruption in case of 51062306a36Sopenharmony_ci * mismatched driver/FW versions. 51162306a36Sopenharmony_ci * 51262306a36Sopenharmony_ci * CPUCP_PACKET_FLASH_PROGRAM_REMOVED - this packet was removed 51362306a36Sopenharmony_ci * 51462306a36Sopenharmony_ci * CPUCP_PACKET_UNMASK_RAZWI_IRQ - 51562306a36Sopenharmony_ci * Unmask the given IRQ. The IRQ number is specified in the value field. 51662306a36Sopenharmony_ci * The packet is sent after receiving an interrupt and printing its 51762306a36Sopenharmony_ci * relevant information. 51862306a36Sopenharmony_ci * 51962306a36Sopenharmony_ci * CPUCP_PACKET_UNMASK_RAZWI_IRQ_ARRAY - 52062306a36Sopenharmony_ci * Unmask the given IRQs. The IRQs numbers are specified in an array right 52162306a36Sopenharmony_ci * after the cpucp_packet structure, where its first element is the array 52262306a36Sopenharmony_ci * length. The packet is sent after a soft reset was done in order to 52362306a36Sopenharmony_ci * handle any interrupts that were sent during the reset process. 52462306a36Sopenharmony_ci * 52562306a36Sopenharmony_ci * CPUCP_PACKET_TEST - 52662306a36Sopenharmony_ci * Test packet for CpuCP connectivity. The CPU will put the fence value 52762306a36Sopenharmony_ci * in the result field. 52862306a36Sopenharmony_ci * 52962306a36Sopenharmony_ci * CPUCP_PACKET_FREQUENCY_CURR_GET - 53062306a36Sopenharmony_ci * Fetch the current frequency of a specified PLL. The packet's arguments 53162306a36Sopenharmony_ci * specify the PLL. 53262306a36Sopenharmony_ci * 53362306a36Sopenharmony_ci * CPUCP_PACKET_MAX_POWER_GET - 53462306a36Sopenharmony_ci * Fetch the maximal power of the device. 53562306a36Sopenharmony_ci * 53662306a36Sopenharmony_ci * CPUCP_PACKET_MAX_POWER_SET - 53762306a36Sopenharmony_ci * Set the maximal power of the device. The packet's arguments specify 53862306a36Sopenharmony_ci * the power. 53962306a36Sopenharmony_ci * 54062306a36Sopenharmony_ci * CPUCP_PACKET_EEPROM_DATA_GET - 54162306a36Sopenharmony_ci * Get EEPROM data from the CpuCP kernel. The buffer is specified in the 54262306a36Sopenharmony_ci * addr field. The CPU will put the returned data size in the result 54362306a36Sopenharmony_ci * field. In addition, the host's driver passes the max size it allows the 54462306a36Sopenharmony_ci * CpuCP to write to the structure, to prevent data corruption in case of 54562306a36Sopenharmony_ci * mismatched driver/FW versions. 54662306a36Sopenharmony_ci * 54762306a36Sopenharmony_ci * CPUCP_PACKET_NIC_INFO_GET - 54862306a36Sopenharmony_ci * Fetch information from the device regarding the NIC. the host's driver 54962306a36Sopenharmony_ci * passes the max size it allows the CpuCP to write to the structure, to 55062306a36Sopenharmony_ci * prevent data corruption in case of mismatched driver/FW versions. 55162306a36Sopenharmony_ci * 55262306a36Sopenharmony_ci * CPUCP_PACKET_TEMPERATURE_SET - 55362306a36Sopenharmony_ci * Set the value of the offset property of a specified thermal sensor. 55462306a36Sopenharmony_ci * The packet's arguments specify the desired sensor and the field to 55562306a36Sopenharmony_ci * set. 55662306a36Sopenharmony_ci * 55762306a36Sopenharmony_ci * CPUCP_PACKET_VOLTAGE_SET - 55862306a36Sopenharmony_ci * Trigger the reset_history property of a specified voltage sensor. 55962306a36Sopenharmony_ci * The packet's arguments specify the desired sensor and the field to 56062306a36Sopenharmony_ci * set. 56162306a36Sopenharmony_ci * 56262306a36Sopenharmony_ci * CPUCP_PACKET_CURRENT_SET - 56362306a36Sopenharmony_ci * Trigger the reset_history property of a specified current sensor. 56462306a36Sopenharmony_ci * The packet's arguments specify the desired sensor and the field to 56562306a36Sopenharmony_ci * set. 56662306a36Sopenharmony_ci * 56762306a36Sopenharmony_ci * CPUCP_PACKET_PCIE_THROUGHPUT_GET - 56862306a36Sopenharmony_ci * Get throughput of PCIe. 56962306a36Sopenharmony_ci * The packet's arguments specify the transaction direction (TX/RX). 57062306a36Sopenharmony_ci * The window measurement is 10[msec], and the return value is in KB/sec. 57162306a36Sopenharmony_ci * 57262306a36Sopenharmony_ci * CPUCP_PACKET_PCIE_REPLAY_CNT_GET 57362306a36Sopenharmony_ci * Replay count measures number of "replay" events, which is basicly 57462306a36Sopenharmony_ci * number of retries done by PCIe. 57562306a36Sopenharmony_ci * 57662306a36Sopenharmony_ci * CPUCP_PACKET_TOTAL_ENERGY_GET - 57762306a36Sopenharmony_ci * Total Energy is measurement of energy from the time FW Linux 57862306a36Sopenharmony_ci * is loaded. It is calculated by multiplying the average power 57962306a36Sopenharmony_ci * by time (passed from armcp start). The units are in MilliJouls. 58062306a36Sopenharmony_ci * 58162306a36Sopenharmony_ci * CPUCP_PACKET_PLL_INFO_GET - 58262306a36Sopenharmony_ci * Fetch frequencies of PLL from the required PLL IP. 58362306a36Sopenharmony_ci * The packet's arguments specify the device PLL type 58462306a36Sopenharmony_ci * Pll type is the PLL from device pll_index enum. 58562306a36Sopenharmony_ci * The result is composed of 4 outputs, each is 16-bit 58662306a36Sopenharmony_ci * frequency in MHz. 58762306a36Sopenharmony_ci * 58862306a36Sopenharmony_ci * CPUCP_PACKET_POWER_GET - 58962306a36Sopenharmony_ci * Fetch the present power consumption of the device (Current * Voltage). 59062306a36Sopenharmony_ci * 59162306a36Sopenharmony_ci * CPUCP_PACKET_NIC_PFC_SET - 59262306a36Sopenharmony_ci * Enable/Disable the NIC PFC feature. The packet's arguments specify the 59362306a36Sopenharmony_ci * NIC port, relevant lanes to configure and one bit indication for 59462306a36Sopenharmony_ci * enable/disable. 59562306a36Sopenharmony_ci * 59662306a36Sopenharmony_ci * CPUCP_PACKET_NIC_FAULT_GET - 59762306a36Sopenharmony_ci * Fetch the current indication for local/remote faults from the NIC MAC. 59862306a36Sopenharmony_ci * The result is 32-bit value of the relevant register. 59962306a36Sopenharmony_ci * 60062306a36Sopenharmony_ci * CPUCP_PACKET_NIC_LPBK_SET - 60162306a36Sopenharmony_ci * Enable/Disable the MAC loopback feature. The packet's arguments specify 60262306a36Sopenharmony_ci * the NIC port, relevant lanes to configure and one bit indication for 60362306a36Sopenharmony_ci * enable/disable. 60462306a36Sopenharmony_ci * 60562306a36Sopenharmony_ci * CPUCP_PACKET_NIC_MAC_INIT - 60662306a36Sopenharmony_ci * Configure the NIC MAC channels. The packet's arguments specify the 60762306a36Sopenharmony_ci * NIC port and the speed. 60862306a36Sopenharmony_ci * 60962306a36Sopenharmony_ci * CPUCP_PACKET_MSI_INFO_SET - 61062306a36Sopenharmony_ci * set the index number for each supported msi type going from 61162306a36Sopenharmony_ci * host to device 61262306a36Sopenharmony_ci * 61362306a36Sopenharmony_ci * CPUCP_PACKET_NIC_XPCS91_REGS_GET - 61462306a36Sopenharmony_ci * Fetch the un/correctable counters values from the NIC MAC. 61562306a36Sopenharmony_ci * 61662306a36Sopenharmony_ci * CPUCP_PACKET_NIC_STAT_REGS_GET - 61762306a36Sopenharmony_ci * Fetch various NIC MAC counters from the NIC STAT. 61862306a36Sopenharmony_ci * 61962306a36Sopenharmony_ci * CPUCP_PACKET_NIC_STAT_REGS_CLR - 62062306a36Sopenharmony_ci * Clear the various NIC MAC counters in the NIC STAT. 62162306a36Sopenharmony_ci * 62262306a36Sopenharmony_ci * CPUCP_PACKET_NIC_STAT_REGS_ALL_GET - 62362306a36Sopenharmony_ci * Fetch all NIC MAC counters from the NIC STAT. 62462306a36Sopenharmony_ci * 62562306a36Sopenharmony_ci * CPUCP_PACKET_IS_IDLE_CHECK - 62662306a36Sopenharmony_ci * Check if the device is IDLE in regard to the DMA/compute engines 62762306a36Sopenharmony_ci * and QMANs. The f/w will return a bitmask where each bit represents 62862306a36Sopenharmony_ci * a different engine or QMAN according to enum cpucp_idle_mask. 62962306a36Sopenharmony_ci * The bit will be 1 if the engine is NOT idle. 63062306a36Sopenharmony_ci * 63162306a36Sopenharmony_ci * CPUCP_PACKET_HBM_REPLACED_ROWS_INFO_GET - 63262306a36Sopenharmony_ci * Fetch all HBM replaced-rows and prending to be replaced rows data. 63362306a36Sopenharmony_ci * 63462306a36Sopenharmony_ci * CPUCP_PACKET_HBM_PENDING_ROWS_STATUS - 63562306a36Sopenharmony_ci * Fetch status of HBM rows pending replacement and need a reboot to 63662306a36Sopenharmony_ci * be replaced. 63762306a36Sopenharmony_ci * 63862306a36Sopenharmony_ci * CPUCP_PACKET_POWER_SET - 63962306a36Sopenharmony_ci * Resets power history of device to 0 64062306a36Sopenharmony_ci * 64162306a36Sopenharmony_ci * CPUCP_PACKET_ENGINE_CORE_ASID_SET - 64262306a36Sopenharmony_ci * Packet to perform engine core ASID configuration 64362306a36Sopenharmony_ci * 64462306a36Sopenharmony_ci * CPUCP_PACKET_SEC_ATTEST_GET - 64562306a36Sopenharmony_ci * Get the attestaion data that is collected during various stages of the 64662306a36Sopenharmony_ci * boot sequence. the attestation data is also hashed with some unique 64762306a36Sopenharmony_ci * number (nonce) provided by the host to prevent replay attacks. 64862306a36Sopenharmony_ci * public key and certificate also provided as part of the FW response. 64962306a36Sopenharmony_ci * 65062306a36Sopenharmony_ci * CPUCP_PACKET_MONITOR_DUMP_GET - 65162306a36Sopenharmony_ci * Get monitors registers dump from the CpuCP kernel. 65262306a36Sopenharmony_ci * The CPU will put the registers dump in the a buffer allocated by the driver 65362306a36Sopenharmony_ci * which address is passed via the CpuCp packet. In addition, the host's driver 65462306a36Sopenharmony_ci * passes the max size it allows the CpuCP to write to the structure, to prevent 65562306a36Sopenharmony_ci * data corruption in case of mismatched driver/FW versions. 65662306a36Sopenharmony_ci * Obsolete. 65762306a36Sopenharmony_ci * 65862306a36Sopenharmony_ci * CPUCP_PACKET_GENERIC_PASSTHROUGH - 65962306a36Sopenharmony_ci * Generic opcode for all firmware info that is only passed to host 66062306a36Sopenharmony_ci * through the LKD, without getting parsed there. 66162306a36Sopenharmony_ci * 66262306a36Sopenharmony_ci * CPUCP_PACKET_ACTIVE_STATUS_SET - 66362306a36Sopenharmony_ci * LKD sends FW indication whether device is free or in use, this indication is reported 66462306a36Sopenharmony_ci * also to the BMC. 66562306a36Sopenharmony_ci * 66662306a36Sopenharmony_ci * CPUCP_PACKET_REGISTER_INTERRUPTS - 66762306a36Sopenharmony_ci * Packet to register interrupts indicating LKD is ready to receive events from FW. 66862306a36Sopenharmony_ci * 66962306a36Sopenharmony_ci * CPUCP_PACKET_SOFT_RESET - 67062306a36Sopenharmony_ci * Packet to perform soft-reset. 67162306a36Sopenharmony_ci */ 67262306a36Sopenharmony_ci 67362306a36Sopenharmony_cienum cpucp_packet_id { 67462306a36Sopenharmony_ci CPUCP_PACKET_DISABLE_PCI_ACCESS = 1, /* internal */ 67562306a36Sopenharmony_ci CPUCP_PACKET_ENABLE_PCI_ACCESS, /* internal */ 67662306a36Sopenharmony_ci CPUCP_PACKET_TEMPERATURE_GET, /* sysfs */ 67762306a36Sopenharmony_ci CPUCP_PACKET_VOLTAGE_GET, /* sysfs */ 67862306a36Sopenharmony_ci CPUCP_PACKET_CURRENT_GET, /* sysfs */ 67962306a36Sopenharmony_ci CPUCP_PACKET_FAN_SPEED_GET, /* sysfs */ 68062306a36Sopenharmony_ci CPUCP_PACKET_PWM_GET, /* sysfs */ 68162306a36Sopenharmony_ci CPUCP_PACKET_PWM_SET, /* sysfs */ 68262306a36Sopenharmony_ci CPUCP_PACKET_FREQUENCY_SET, /* sysfs */ 68362306a36Sopenharmony_ci CPUCP_PACKET_FREQUENCY_GET, /* sysfs */ 68462306a36Sopenharmony_ci CPUCP_PACKET_LED_SET, /* debugfs */ 68562306a36Sopenharmony_ci CPUCP_PACKET_I2C_WR, /* debugfs */ 68662306a36Sopenharmony_ci CPUCP_PACKET_I2C_RD, /* debugfs */ 68762306a36Sopenharmony_ci CPUCP_PACKET_INFO_GET, /* IOCTL */ 68862306a36Sopenharmony_ci CPUCP_PACKET_FLASH_PROGRAM_REMOVED, 68962306a36Sopenharmony_ci CPUCP_PACKET_UNMASK_RAZWI_IRQ, /* internal */ 69062306a36Sopenharmony_ci CPUCP_PACKET_UNMASK_RAZWI_IRQ_ARRAY, /* internal */ 69162306a36Sopenharmony_ci CPUCP_PACKET_TEST, /* internal */ 69262306a36Sopenharmony_ci CPUCP_PACKET_FREQUENCY_CURR_GET, /* sysfs */ 69362306a36Sopenharmony_ci CPUCP_PACKET_MAX_POWER_GET, /* sysfs */ 69462306a36Sopenharmony_ci CPUCP_PACKET_MAX_POWER_SET, /* sysfs */ 69562306a36Sopenharmony_ci CPUCP_PACKET_EEPROM_DATA_GET, /* sysfs */ 69662306a36Sopenharmony_ci CPUCP_PACKET_NIC_INFO_GET, /* internal */ 69762306a36Sopenharmony_ci CPUCP_PACKET_TEMPERATURE_SET, /* sysfs */ 69862306a36Sopenharmony_ci CPUCP_PACKET_VOLTAGE_SET, /* sysfs */ 69962306a36Sopenharmony_ci CPUCP_PACKET_CURRENT_SET, /* sysfs */ 70062306a36Sopenharmony_ci CPUCP_PACKET_PCIE_THROUGHPUT_GET, /* internal */ 70162306a36Sopenharmony_ci CPUCP_PACKET_PCIE_REPLAY_CNT_GET, /* internal */ 70262306a36Sopenharmony_ci CPUCP_PACKET_TOTAL_ENERGY_GET, /* internal */ 70362306a36Sopenharmony_ci CPUCP_PACKET_PLL_INFO_GET, /* internal */ 70462306a36Sopenharmony_ci CPUCP_PACKET_NIC_STATUS, /* internal */ 70562306a36Sopenharmony_ci CPUCP_PACKET_POWER_GET, /* internal */ 70662306a36Sopenharmony_ci CPUCP_PACKET_NIC_PFC_SET, /* internal */ 70762306a36Sopenharmony_ci CPUCP_PACKET_NIC_FAULT_GET, /* internal */ 70862306a36Sopenharmony_ci CPUCP_PACKET_NIC_LPBK_SET, /* internal */ 70962306a36Sopenharmony_ci CPUCP_PACKET_NIC_MAC_CFG, /* internal */ 71062306a36Sopenharmony_ci CPUCP_PACKET_MSI_INFO_SET, /* internal */ 71162306a36Sopenharmony_ci CPUCP_PACKET_NIC_XPCS91_REGS_GET, /* internal */ 71262306a36Sopenharmony_ci CPUCP_PACKET_NIC_STAT_REGS_GET, /* internal */ 71362306a36Sopenharmony_ci CPUCP_PACKET_NIC_STAT_REGS_CLR, /* internal */ 71462306a36Sopenharmony_ci CPUCP_PACKET_NIC_STAT_REGS_ALL_GET, /* internal */ 71562306a36Sopenharmony_ci CPUCP_PACKET_IS_IDLE_CHECK, /* internal */ 71662306a36Sopenharmony_ci CPUCP_PACKET_HBM_REPLACED_ROWS_INFO_GET,/* internal */ 71762306a36Sopenharmony_ci CPUCP_PACKET_HBM_PENDING_ROWS_STATUS, /* internal */ 71862306a36Sopenharmony_ci CPUCP_PACKET_POWER_SET, /* internal */ 71962306a36Sopenharmony_ci CPUCP_PACKET_RESERVED, /* not used */ 72062306a36Sopenharmony_ci CPUCP_PACKET_ENGINE_CORE_ASID_SET, /* internal */ 72162306a36Sopenharmony_ci CPUCP_PACKET_RESERVED2, /* not used */ 72262306a36Sopenharmony_ci CPUCP_PACKET_SEC_ATTEST_GET, /* internal */ 72362306a36Sopenharmony_ci CPUCP_PACKET_RESERVED3, /* not used */ 72462306a36Sopenharmony_ci CPUCP_PACKET_RESERVED4, /* not used */ 72562306a36Sopenharmony_ci CPUCP_PACKET_MONITOR_DUMP_GET, /* debugfs */ 72662306a36Sopenharmony_ci CPUCP_PACKET_RESERVED5, /* not used */ 72762306a36Sopenharmony_ci CPUCP_PACKET_RESERVED6, /* not used */ 72862306a36Sopenharmony_ci CPUCP_PACKET_RESERVED7, /* not used */ 72962306a36Sopenharmony_ci CPUCP_PACKET_GENERIC_PASSTHROUGH, /* IOCTL */ 73062306a36Sopenharmony_ci CPUCP_PACKET_RESERVED8, /* not used */ 73162306a36Sopenharmony_ci CPUCP_PACKET_ACTIVE_STATUS_SET, /* internal */ 73262306a36Sopenharmony_ci CPUCP_PACKET_RESERVED9, /* not used */ 73362306a36Sopenharmony_ci CPUCP_PACKET_RESERVED10, /* not used */ 73462306a36Sopenharmony_ci CPUCP_PACKET_RESERVED11, /* not used */ 73562306a36Sopenharmony_ci CPUCP_PACKET_RESERVED12, /* internal */ 73662306a36Sopenharmony_ci CPUCP_PACKET_REGISTER_INTERRUPTS, /* internal */ 73762306a36Sopenharmony_ci CPUCP_PACKET_SOFT_RESET, /* internal */ 73862306a36Sopenharmony_ci CPUCP_PACKET_ID_MAX /* must be last */ 73962306a36Sopenharmony_ci}; 74062306a36Sopenharmony_ci 74162306a36Sopenharmony_ci#define CPUCP_PACKET_FENCE_VAL 0xFE8CE7A5 74262306a36Sopenharmony_ci 74362306a36Sopenharmony_ci#define CPUCP_PKT_CTL_RC_SHIFT 12 74462306a36Sopenharmony_ci#define CPUCP_PKT_CTL_RC_MASK 0x0000F000 74562306a36Sopenharmony_ci 74662306a36Sopenharmony_ci#define CPUCP_PKT_CTL_OPCODE_SHIFT 16 74762306a36Sopenharmony_ci#define CPUCP_PKT_CTL_OPCODE_MASK 0x1FFF0000 74862306a36Sopenharmony_ci 74962306a36Sopenharmony_ci#define CPUCP_PKT_RES_PLL_OUT0_SHIFT 0 75062306a36Sopenharmony_ci#define CPUCP_PKT_RES_PLL_OUT0_MASK 0x000000000000FFFFull 75162306a36Sopenharmony_ci#define CPUCP_PKT_RES_PLL_OUT1_SHIFT 16 75262306a36Sopenharmony_ci#define CPUCP_PKT_RES_PLL_OUT1_MASK 0x00000000FFFF0000ull 75362306a36Sopenharmony_ci#define CPUCP_PKT_RES_PLL_OUT2_SHIFT 32 75462306a36Sopenharmony_ci#define CPUCP_PKT_RES_PLL_OUT2_MASK 0x0000FFFF00000000ull 75562306a36Sopenharmony_ci#define CPUCP_PKT_RES_PLL_OUT3_SHIFT 48 75662306a36Sopenharmony_ci#define CPUCP_PKT_RES_PLL_OUT3_MASK 0xFFFF000000000000ull 75762306a36Sopenharmony_ci 75862306a36Sopenharmony_ci#define CPUCP_PKT_RES_EEPROM_OUT0_SHIFT 0 75962306a36Sopenharmony_ci#define CPUCP_PKT_RES_EEPROM_OUT0_MASK 0x000000000000FFFFull 76062306a36Sopenharmony_ci#define CPUCP_PKT_RES_EEPROM_OUT1_SHIFT 16 76162306a36Sopenharmony_ci#define CPUCP_PKT_RES_EEPROM_OUT1_MASK 0x0000000000FF0000ull 76262306a36Sopenharmony_ci 76362306a36Sopenharmony_ci#define CPUCP_PKT_VAL_PFC_IN1_SHIFT 0 76462306a36Sopenharmony_ci#define CPUCP_PKT_VAL_PFC_IN1_MASK 0x0000000000000001ull 76562306a36Sopenharmony_ci#define CPUCP_PKT_VAL_PFC_IN2_SHIFT 1 76662306a36Sopenharmony_ci#define CPUCP_PKT_VAL_PFC_IN2_MASK 0x000000000000001Eull 76762306a36Sopenharmony_ci 76862306a36Sopenharmony_ci#define CPUCP_PKT_VAL_LPBK_IN1_SHIFT 0 76962306a36Sopenharmony_ci#define CPUCP_PKT_VAL_LPBK_IN1_MASK 0x0000000000000001ull 77062306a36Sopenharmony_ci#define CPUCP_PKT_VAL_LPBK_IN2_SHIFT 1 77162306a36Sopenharmony_ci#define CPUCP_PKT_VAL_LPBK_IN2_MASK 0x000000000000001Eull 77262306a36Sopenharmony_ci 77362306a36Sopenharmony_ci#define CPUCP_PKT_VAL_MAC_CNT_IN1_SHIFT 0 77462306a36Sopenharmony_ci#define CPUCP_PKT_VAL_MAC_CNT_IN1_MASK 0x0000000000000001ull 77562306a36Sopenharmony_ci#define CPUCP_PKT_VAL_MAC_CNT_IN2_SHIFT 1 77662306a36Sopenharmony_ci#define CPUCP_PKT_VAL_MAC_CNT_IN2_MASK 0x00000000FFFFFFFEull 77762306a36Sopenharmony_ci 77862306a36Sopenharmony_ci/* heartbeat status bits */ 77962306a36Sopenharmony_ci#define CPUCP_PKT_HB_STATUS_EQ_FAULT_SHIFT 0 78062306a36Sopenharmony_ci#define CPUCP_PKT_HB_STATUS_EQ_FAULT_MASK 0x00000001 78162306a36Sopenharmony_ci 78262306a36Sopenharmony_cistruct cpucp_packet { 78362306a36Sopenharmony_ci union { 78462306a36Sopenharmony_ci __le64 value; /* For SET packets */ 78562306a36Sopenharmony_ci __le64 result; /* For GET packets */ 78662306a36Sopenharmony_ci __le64 addr; /* For PQ */ 78762306a36Sopenharmony_ci }; 78862306a36Sopenharmony_ci 78962306a36Sopenharmony_ci __le32 ctl; 79062306a36Sopenharmony_ci 79162306a36Sopenharmony_ci __le32 fence; /* Signal to host that message is completed */ 79262306a36Sopenharmony_ci 79362306a36Sopenharmony_ci union { 79462306a36Sopenharmony_ci struct {/* For temperature/current/voltage/fan/pwm get/set */ 79562306a36Sopenharmony_ci __le16 sensor_index; 79662306a36Sopenharmony_ci __le16 type; 79762306a36Sopenharmony_ci }; 79862306a36Sopenharmony_ci 79962306a36Sopenharmony_ci struct { /* For I2C read/write */ 80062306a36Sopenharmony_ci __u8 i2c_bus; 80162306a36Sopenharmony_ci __u8 i2c_addr; 80262306a36Sopenharmony_ci __u8 i2c_reg; 80362306a36Sopenharmony_ci /* 80462306a36Sopenharmony_ci * In legacy implemetations, i2c_len was not present, 80562306a36Sopenharmony_ci * was unused and just added as pad. 80662306a36Sopenharmony_ci * So if i2c_len is 0, it is treated as legacy 80762306a36Sopenharmony_ci * and r/w 1 Byte, else if i2c_len is specified, 80862306a36Sopenharmony_ci * its treated as new multibyte r/w support. 80962306a36Sopenharmony_ci */ 81062306a36Sopenharmony_ci __u8 i2c_len; 81162306a36Sopenharmony_ci }; 81262306a36Sopenharmony_ci 81362306a36Sopenharmony_ci struct {/* For PLL info fetch */ 81462306a36Sopenharmony_ci __le16 pll_type; 81562306a36Sopenharmony_ci /* TODO pll_reg is kept temporary before removal */ 81662306a36Sopenharmony_ci __le16 pll_reg; 81762306a36Sopenharmony_ci }; 81862306a36Sopenharmony_ci 81962306a36Sopenharmony_ci /* For any general request */ 82062306a36Sopenharmony_ci __le32 index; 82162306a36Sopenharmony_ci 82262306a36Sopenharmony_ci /* For frequency get/set */ 82362306a36Sopenharmony_ci __le32 pll_index; 82462306a36Sopenharmony_ci 82562306a36Sopenharmony_ci /* For led set */ 82662306a36Sopenharmony_ci __le32 led_index; 82762306a36Sopenharmony_ci 82862306a36Sopenharmony_ci /* For get CpuCP info/EEPROM data/NIC info */ 82962306a36Sopenharmony_ci __le32 data_max_size; 83062306a36Sopenharmony_ci 83162306a36Sopenharmony_ci /* 83262306a36Sopenharmony_ci * For any general status bitmask. Shall be used whenever the 83362306a36Sopenharmony_ci * result cannot be used to hold general purpose data. 83462306a36Sopenharmony_ci */ 83562306a36Sopenharmony_ci __le32 status_mask; 83662306a36Sopenharmony_ci 83762306a36Sopenharmony_ci /* random, used once number, for security packets */ 83862306a36Sopenharmony_ci __le32 nonce; 83962306a36Sopenharmony_ci }; 84062306a36Sopenharmony_ci 84162306a36Sopenharmony_ci union { 84262306a36Sopenharmony_ci /* For NIC requests */ 84362306a36Sopenharmony_ci __le32 port_index; 84462306a36Sopenharmony_ci 84562306a36Sopenharmony_ci /* For Generic packet sub index */ 84662306a36Sopenharmony_ci __le32 pkt_subidx; 84762306a36Sopenharmony_ci }; 84862306a36Sopenharmony_ci}; 84962306a36Sopenharmony_ci 85062306a36Sopenharmony_cistruct cpucp_unmask_irq_arr_packet { 85162306a36Sopenharmony_ci struct cpucp_packet cpucp_pkt; 85262306a36Sopenharmony_ci __le32 length; 85362306a36Sopenharmony_ci __le32 irqs[]; 85462306a36Sopenharmony_ci}; 85562306a36Sopenharmony_ci 85662306a36Sopenharmony_cistruct cpucp_nic_status_packet { 85762306a36Sopenharmony_ci struct cpucp_packet cpucp_pkt; 85862306a36Sopenharmony_ci __le32 length; 85962306a36Sopenharmony_ci __le32 data[]; 86062306a36Sopenharmony_ci}; 86162306a36Sopenharmony_ci 86262306a36Sopenharmony_cistruct cpucp_array_data_packet { 86362306a36Sopenharmony_ci struct cpucp_packet cpucp_pkt; 86462306a36Sopenharmony_ci __le32 length; 86562306a36Sopenharmony_ci __le32 data[]; 86662306a36Sopenharmony_ci}; 86762306a36Sopenharmony_ci 86862306a36Sopenharmony_cienum cpucp_led_index { 86962306a36Sopenharmony_ci CPUCP_LED0_INDEX = 0, 87062306a36Sopenharmony_ci CPUCP_LED1_INDEX, 87162306a36Sopenharmony_ci CPUCP_LED2_INDEX, 87262306a36Sopenharmony_ci CPUCP_LED_MAX_INDEX = CPUCP_LED2_INDEX 87362306a36Sopenharmony_ci}; 87462306a36Sopenharmony_ci 87562306a36Sopenharmony_ci/* 87662306a36Sopenharmony_ci * enum cpucp_packet_rc - Error return code 87762306a36Sopenharmony_ci * @cpucp_packet_success -> in case of success. 87862306a36Sopenharmony_ci * @cpucp_packet_invalid -> this is to support first generation platforms. 87962306a36Sopenharmony_ci * @cpucp_packet_fault -> in case of processing error like failing to 88062306a36Sopenharmony_ci * get device binding or semaphore etc. 88162306a36Sopenharmony_ci * @cpucp_packet_invalid_pkt -> when cpucp packet is un-supported. 88262306a36Sopenharmony_ci * @cpucp_packet_invalid_params -> when checking parameter like length of buffer 88362306a36Sopenharmony_ci * or attribute value etc. 88462306a36Sopenharmony_ci * @cpucp_packet_rc_max -> It indicates size of enum so should be at last. 88562306a36Sopenharmony_ci */ 88662306a36Sopenharmony_cienum cpucp_packet_rc { 88762306a36Sopenharmony_ci cpucp_packet_success, 88862306a36Sopenharmony_ci cpucp_packet_invalid, 88962306a36Sopenharmony_ci cpucp_packet_fault, 89062306a36Sopenharmony_ci cpucp_packet_invalid_pkt, 89162306a36Sopenharmony_ci cpucp_packet_invalid_params, 89262306a36Sopenharmony_ci cpucp_packet_rc_max 89362306a36Sopenharmony_ci}; 89462306a36Sopenharmony_ci 89562306a36Sopenharmony_ci/* 89662306a36Sopenharmony_ci * cpucp_temp_type should adhere to hwmon_temp_attributes 89762306a36Sopenharmony_ci * defined in Linux kernel hwmon.h file 89862306a36Sopenharmony_ci */ 89962306a36Sopenharmony_cienum cpucp_temp_type { 90062306a36Sopenharmony_ci cpucp_temp_input, 90162306a36Sopenharmony_ci cpucp_temp_min = 4, 90262306a36Sopenharmony_ci cpucp_temp_min_hyst, 90362306a36Sopenharmony_ci cpucp_temp_max = 6, 90462306a36Sopenharmony_ci cpucp_temp_max_hyst, 90562306a36Sopenharmony_ci cpucp_temp_crit, 90662306a36Sopenharmony_ci cpucp_temp_crit_hyst, 90762306a36Sopenharmony_ci cpucp_temp_offset = 19, 90862306a36Sopenharmony_ci cpucp_temp_lowest = 21, 90962306a36Sopenharmony_ci cpucp_temp_highest = 22, 91062306a36Sopenharmony_ci cpucp_temp_reset_history = 23, 91162306a36Sopenharmony_ci cpucp_temp_warn = 24, 91262306a36Sopenharmony_ci cpucp_temp_max_crit = 25, 91362306a36Sopenharmony_ci cpucp_temp_max_warn = 26, 91462306a36Sopenharmony_ci}; 91562306a36Sopenharmony_ci 91662306a36Sopenharmony_cienum cpucp_in_attributes { 91762306a36Sopenharmony_ci cpucp_in_input, 91862306a36Sopenharmony_ci cpucp_in_min, 91962306a36Sopenharmony_ci cpucp_in_max, 92062306a36Sopenharmony_ci cpucp_in_lowest = 6, 92162306a36Sopenharmony_ci cpucp_in_highest = 7, 92262306a36Sopenharmony_ci cpucp_in_reset_history, 92362306a36Sopenharmony_ci cpucp_in_intr_alarm_a, 92462306a36Sopenharmony_ci cpucp_in_intr_alarm_b, 92562306a36Sopenharmony_ci}; 92662306a36Sopenharmony_ci 92762306a36Sopenharmony_cienum cpucp_curr_attributes { 92862306a36Sopenharmony_ci cpucp_curr_input, 92962306a36Sopenharmony_ci cpucp_curr_min, 93062306a36Sopenharmony_ci cpucp_curr_max, 93162306a36Sopenharmony_ci cpucp_curr_lowest = 6, 93262306a36Sopenharmony_ci cpucp_curr_highest = 7, 93362306a36Sopenharmony_ci cpucp_curr_reset_history 93462306a36Sopenharmony_ci}; 93562306a36Sopenharmony_ci 93662306a36Sopenharmony_cienum cpucp_fan_attributes { 93762306a36Sopenharmony_ci cpucp_fan_input, 93862306a36Sopenharmony_ci cpucp_fan_min = 2, 93962306a36Sopenharmony_ci cpucp_fan_max 94062306a36Sopenharmony_ci}; 94162306a36Sopenharmony_ci 94262306a36Sopenharmony_cienum cpucp_pwm_attributes { 94362306a36Sopenharmony_ci cpucp_pwm_input, 94462306a36Sopenharmony_ci cpucp_pwm_enable 94562306a36Sopenharmony_ci}; 94662306a36Sopenharmony_ci 94762306a36Sopenharmony_cienum cpucp_pcie_throughput_attributes { 94862306a36Sopenharmony_ci cpucp_pcie_throughput_tx, 94962306a36Sopenharmony_ci cpucp_pcie_throughput_rx 95062306a36Sopenharmony_ci}; 95162306a36Sopenharmony_ci 95262306a36Sopenharmony_ci/* TODO temporary kept before removal */ 95362306a36Sopenharmony_cienum cpucp_pll_reg_attributes { 95462306a36Sopenharmony_ci cpucp_pll_nr_reg, 95562306a36Sopenharmony_ci cpucp_pll_nf_reg, 95662306a36Sopenharmony_ci cpucp_pll_od_reg, 95762306a36Sopenharmony_ci cpucp_pll_div_factor_reg, 95862306a36Sopenharmony_ci cpucp_pll_div_sel_reg 95962306a36Sopenharmony_ci}; 96062306a36Sopenharmony_ci 96162306a36Sopenharmony_ci/* TODO temporary kept before removal */ 96262306a36Sopenharmony_cienum cpucp_pll_type_attributes { 96362306a36Sopenharmony_ci cpucp_pll_cpu, 96462306a36Sopenharmony_ci cpucp_pll_pci, 96562306a36Sopenharmony_ci}; 96662306a36Sopenharmony_ci 96762306a36Sopenharmony_ci/* 96862306a36Sopenharmony_ci * cpucp_power_type aligns with hwmon_power_attributes 96962306a36Sopenharmony_ci * defined in Linux kernel hwmon.h file 97062306a36Sopenharmony_ci */ 97162306a36Sopenharmony_cienum cpucp_power_type { 97262306a36Sopenharmony_ci CPUCP_POWER_INPUT = 8, 97362306a36Sopenharmony_ci CPUCP_POWER_INPUT_HIGHEST = 9, 97462306a36Sopenharmony_ci CPUCP_POWER_RESET_INPUT_HISTORY = 11 97562306a36Sopenharmony_ci}; 97662306a36Sopenharmony_ci 97762306a36Sopenharmony_ci/* 97862306a36Sopenharmony_ci * MSI type enumeration table for all ASICs and future SW versions. 97962306a36Sopenharmony_ci * For future ASIC-LKD compatibility, we can only add new enumerations. 98062306a36Sopenharmony_ci * at the end of the table (before CPUCP_NUM_OF_MSI_TYPES). 98162306a36Sopenharmony_ci * Changing the order of entries or removing entries is not allowed. 98262306a36Sopenharmony_ci */ 98362306a36Sopenharmony_cienum cpucp_msi_type { 98462306a36Sopenharmony_ci CPUCP_EVENT_QUEUE_MSI_TYPE, 98562306a36Sopenharmony_ci CPUCP_NIC_PORT1_MSI_TYPE, 98662306a36Sopenharmony_ci CPUCP_NIC_PORT3_MSI_TYPE, 98762306a36Sopenharmony_ci CPUCP_NIC_PORT5_MSI_TYPE, 98862306a36Sopenharmony_ci CPUCP_NIC_PORT7_MSI_TYPE, 98962306a36Sopenharmony_ci CPUCP_NIC_PORT9_MSI_TYPE, 99062306a36Sopenharmony_ci CPUCP_NUM_OF_MSI_TYPES 99162306a36Sopenharmony_ci}; 99262306a36Sopenharmony_ci 99362306a36Sopenharmony_ci/* 99462306a36Sopenharmony_ci * PLL enumeration table used for all ASICs and future SW versions. 99562306a36Sopenharmony_ci * For future ASIC-LKD compatibility, we can only add new enumerations. 99662306a36Sopenharmony_ci * at the end of the table. 99762306a36Sopenharmony_ci * Changing the order of entries or removing entries is not allowed. 99862306a36Sopenharmony_ci */ 99962306a36Sopenharmony_cienum pll_index { 100062306a36Sopenharmony_ci CPU_PLL = 0, 100162306a36Sopenharmony_ci PCI_PLL = 1, 100262306a36Sopenharmony_ci NIC_PLL = 2, 100362306a36Sopenharmony_ci DMA_PLL = 3, 100462306a36Sopenharmony_ci MESH_PLL = 4, 100562306a36Sopenharmony_ci MME_PLL = 5, 100662306a36Sopenharmony_ci TPC_PLL = 6, 100762306a36Sopenharmony_ci IF_PLL = 7, 100862306a36Sopenharmony_ci SRAM_PLL = 8, 100962306a36Sopenharmony_ci NS_PLL = 9, 101062306a36Sopenharmony_ci HBM_PLL = 10, 101162306a36Sopenharmony_ci MSS_PLL = 11, 101262306a36Sopenharmony_ci DDR_PLL = 12, 101362306a36Sopenharmony_ci VID_PLL = 13, 101462306a36Sopenharmony_ci BANK_PLL = 14, 101562306a36Sopenharmony_ci MMU_PLL = 15, 101662306a36Sopenharmony_ci IC_PLL = 16, 101762306a36Sopenharmony_ci MC_PLL = 17, 101862306a36Sopenharmony_ci EMMC_PLL = 18, 101962306a36Sopenharmony_ci D2D_PLL = 19, 102062306a36Sopenharmony_ci CS_PLL = 20, 102162306a36Sopenharmony_ci C2C_PLL = 21, 102262306a36Sopenharmony_ci NCH_PLL = 22, 102362306a36Sopenharmony_ci C2M_PLL = 23, 102462306a36Sopenharmony_ci PLL_MAX 102562306a36Sopenharmony_ci}; 102662306a36Sopenharmony_ci 102762306a36Sopenharmony_cienum rl_index { 102862306a36Sopenharmony_ci TPC_RL = 0, 102962306a36Sopenharmony_ci MME_RL, 103062306a36Sopenharmony_ci EDMA_RL, 103162306a36Sopenharmony_ci}; 103262306a36Sopenharmony_ci 103362306a36Sopenharmony_cienum pvt_index { 103462306a36Sopenharmony_ci PVT_SW, 103562306a36Sopenharmony_ci PVT_SE, 103662306a36Sopenharmony_ci PVT_NW, 103762306a36Sopenharmony_ci PVT_NE 103862306a36Sopenharmony_ci}; 103962306a36Sopenharmony_ci 104062306a36Sopenharmony_ci/* Event Queue Packets */ 104162306a36Sopenharmony_ci 104262306a36Sopenharmony_cistruct eq_generic_event { 104362306a36Sopenharmony_ci __le64 data[7]; 104462306a36Sopenharmony_ci}; 104562306a36Sopenharmony_ci 104662306a36Sopenharmony_ci/* 104762306a36Sopenharmony_ci * CpuCP info 104862306a36Sopenharmony_ci */ 104962306a36Sopenharmony_ci 105062306a36Sopenharmony_ci#define CARD_NAME_MAX_LEN 16 105162306a36Sopenharmony_ci#define CPUCP_MAX_SENSORS 128 105262306a36Sopenharmony_ci#define CPUCP_MAX_NICS 128 105362306a36Sopenharmony_ci#define CPUCP_LANES_PER_NIC 4 105462306a36Sopenharmony_ci#define CPUCP_NIC_QSFP_EEPROM_MAX_LEN 1024 105562306a36Sopenharmony_ci#define CPUCP_MAX_NIC_LANES (CPUCP_MAX_NICS * CPUCP_LANES_PER_NIC) 105662306a36Sopenharmony_ci#define CPUCP_NIC_MASK_ARR_LEN ((CPUCP_MAX_NICS + 63) / 64) 105762306a36Sopenharmony_ci#define CPUCP_NIC_POLARITY_ARR_LEN ((CPUCP_MAX_NIC_LANES + 63) / 64) 105862306a36Sopenharmony_ci#define CPUCP_HBM_ROW_REPLACE_MAX 32 105962306a36Sopenharmony_ci 106062306a36Sopenharmony_cistruct cpucp_sensor { 106162306a36Sopenharmony_ci __le32 type; 106262306a36Sopenharmony_ci __le32 flags; 106362306a36Sopenharmony_ci}; 106462306a36Sopenharmony_ci 106562306a36Sopenharmony_ci/** 106662306a36Sopenharmony_ci * struct cpucp_card_types - ASIC card type. 106762306a36Sopenharmony_ci * @cpucp_card_type_pci: PCI card. 106862306a36Sopenharmony_ci * @cpucp_card_type_pmc: PCI Mezzanine Card. 106962306a36Sopenharmony_ci */ 107062306a36Sopenharmony_cienum cpucp_card_types { 107162306a36Sopenharmony_ci cpucp_card_type_pci, 107262306a36Sopenharmony_ci cpucp_card_type_pmc 107362306a36Sopenharmony_ci}; 107462306a36Sopenharmony_ci 107562306a36Sopenharmony_ci#define CPUCP_SEC_CONF_ENABLED_SHIFT 0 107662306a36Sopenharmony_ci#define CPUCP_SEC_CONF_ENABLED_MASK 0x00000001 107762306a36Sopenharmony_ci 107862306a36Sopenharmony_ci#define CPUCP_SEC_CONF_FLASH_WP_SHIFT 1 107962306a36Sopenharmony_ci#define CPUCP_SEC_CONF_FLASH_WP_MASK 0x00000002 108062306a36Sopenharmony_ci 108162306a36Sopenharmony_ci#define CPUCP_SEC_CONF_EEPROM_WP_SHIFT 2 108262306a36Sopenharmony_ci#define CPUCP_SEC_CONF_EEPROM_WP_MASK 0x00000004 108362306a36Sopenharmony_ci 108462306a36Sopenharmony_ci/** 108562306a36Sopenharmony_ci * struct cpucp_security_info - Security information. 108662306a36Sopenharmony_ci * @config: configuration bit field 108762306a36Sopenharmony_ci * @keys_num: number of stored keys 108862306a36Sopenharmony_ci * @revoked_keys: revoked keys bit field 108962306a36Sopenharmony_ci * @min_svn: minimal security version 109062306a36Sopenharmony_ci */ 109162306a36Sopenharmony_cistruct cpucp_security_info { 109262306a36Sopenharmony_ci __u8 config; 109362306a36Sopenharmony_ci __u8 keys_num; 109462306a36Sopenharmony_ci __u8 revoked_keys; 109562306a36Sopenharmony_ci __u8 min_svn; 109662306a36Sopenharmony_ci}; 109762306a36Sopenharmony_ci 109862306a36Sopenharmony_ci/** 109962306a36Sopenharmony_ci * struct cpucp_info - Info from CpuCP that is necessary to the host's driver 110062306a36Sopenharmony_ci * @sensors: available sensors description. 110162306a36Sopenharmony_ci * @kernel_version: CpuCP linux kernel version. 110262306a36Sopenharmony_ci * @reserved: reserved field. 110362306a36Sopenharmony_ci * @card_type: card configuration type. 110462306a36Sopenharmony_ci * @card_location: in a server, each card has different connections topology 110562306a36Sopenharmony_ci * depending on its location (relevant for PMC card type) 110662306a36Sopenharmony_ci * @cpld_version: CPLD programmed F/W version. 110762306a36Sopenharmony_ci * @infineon_version: Infineon main DC-DC version. 110862306a36Sopenharmony_ci * @fuse_version: silicon production FUSE information. 110962306a36Sopenharmony_ci * @thermal_version: thermald S/W version. 111062306a36Sopenharmony_ci * @cpucp_version: CpuCP S/W version. 111162306a36Sopenharmony_ci * @infineon_second_stage_version: Infineon 2nd stage DC-DC version. 111262306a36Sopenharmony_ci * @dram_size: available DRAM size. 111362306a36Sopenharmony_ci * @card_name: card name that will be displayed in HWMON subsystem on the host 111462306a36Sopenharmony_ci * @tpc_binning_mask: TPC binning mask, 1 bit per TPC instance 111562306a36Sopenharmony_ci * (0 = functional, 1 = binned) 111662306a36Sopenharmony_ci * @decoder_binning_mask: Decoder binning mask, 1 bit per decoder instance 111762306a36Sopenharmony_ci * (0 = functional, 1 = binned), maximum 1 per dcore 111862306a36Sopenharmony_ci * @sram_binning: Categorize SRAM functionality 111962306a36Sopenharmony_ci * (0 = fully functional, 1 = lower-half is not functional, 112062306a36Sopenharmony_ci * 2 = upper-half is not functional) 112162306a36Sopenharmony_ci * @sec_info: security information 112262306a36Sopenharmony_ci * @pll_map: Bit map of supported PLLs for current ASIC version. 112362306a36Sopenharmony_ci * @mme_binning_mask: MME binning mask, 112462306a36Sopenharmony_ci * bits [0:6] <==> dcore0 mme fma 112562306a36Sopenharmony_ci * bits [7:13] <==> dcore1 mme fma 112662306a36Sopenharmony_ci * bits [14:20] <==> dcore0 mme ima 112762306a36Sopenharmony_ci * bits [21:27] <==> dcore1 mme ima 112862306a36Sopenharmony_ci * For each group, if the 6th bit is set then first 5 bits 112962306a36Sopenharmony_ci * represent the col's idx [0-31], otherwise these bits are 113062306a36Sopenharmony_ci * ignored, and col idx 32 is binned. 7th bit is don't care. 113162306a36Sopenharmony_ci * @dram_binning_mask: DRAM binning mask, 1 bit per dram instance 113262306a36Sopenharmony_ci * (0 = functional 1 = binned) 113362306a36Sopenharmony_ci * @memory_repair_flag: eFuse flag indicating memory repair 113462306a36Sopenharmony_ci * @edma_binning_mask: EDMA binning mask, 1 bit per EDMA instance 113562306a36Sopenharmony_ci * (0 = functional 1 = binned) 113662306a36Sopenharmony_ci * @xbar_binning_mask: Xbar binning mask, 1 bit per Xbar instance 113762306a36Sopenharmony_ci * (0 = functional 1 = binned) 113862306a36Sopenharmony_ci * @interposer_version: Interposer version programmed in eFuse 113962306a36Sopenharmony_ci * @substrate_version: Substrate version programmed in eFuse 114062306a36Sopenharmony_ci * @fw_hbm_region_size: Size in bytes of FW reserved region in HBM. 114162306a36Sopenharmony_ci * @fw_os_version: Firmware OS Version 114262306a36Sopenharmony_ci */ 114362306a36Sopenharmony_cistruct cpucp_info { 114462306a36Sopenharmony_ci struct cpucp_sensor sensors[CPUCP_MAX_SENSORS]; 114562306a36Sopenharmony_ci __u8 kernel_version[VERSION_MAX_LEN]; 114662306a36Sopenharmony_ci __le32 reserved; 114762306a36Sopenharmony_ci __le32 card_type; 114862306a36Sopenharmony_ci __le32 card_location; 114962306a36Sopenharmony_ci __le32 cpld_version; 115062306a36Sopenharmony_ci __le32 infineon_version; 115162306a36Sopenharmony_ci __u8 fuse_version[VERSION_MAX_LEN]; 115262306a36Sopenharmony_ci __u8 thermal_version[VERSION_MAX_LEN]; 115362306a36Sopenharmony_ci __u8 cpucp_version[VERSION_MAX_LEN]; 115462306a36Sopenharmony_ci __le32 infineon_second_stage_version; 115562306a36Sopenharmony_ci __le64 dram_size; 115662306a36Sopenharmony_ci char card_name[CARD_NAME_MAX_LEN]; 115762306a36Sopenharmony_ci __le64 tpc_binning_mask; 115862306a36Sopenharmony_ci __le64 decoder_binning_mask; 115962306a36Sopenharmony_ci __u8 sram_binning; 116062306a36Sopenharmony_ci __u8 dram_binning_mask; 116162306a36Sopenharmony_ci __u8 memory_repair_flag; 116262306a36Sopenharmony_ci __u8 edma_binning_mask; 116362306a36Sopenharmony_ci __u8 xbar_binning_mask; 116462306a36Sopenharmony_ci __u8 interposer_version; 116562306a36Sopenharmony_ci __u8 substrate_version; 116662306a36Sopenharmony_ci __u8 reserved2; 116762306a36Sopenharmony_ci struct cpucp_security_info sec_info; 116862306a36Sopenharmony_ci __le32 fw_hbm_region_size; 116962306a36Sopenharmony_ci __u8 pll_map[PLL_MAP_LEN]; 117062306a36Sopenharmony_ci __le64 mme_binning_mask; 117162306a36Sopenharmony_ci __u8 fw_os_version[VERSION_MAX_LEN]; 117262306a36Sopenharmony_ci}; 117362306a36Sopenharmony_ci 117462306a36Sopenharmony_cistruct cpucp_mac_addr { 117562306a36Sopenharmony_ci __u8 mac_addr[ETH_ALEN]; 117662306a36Sopenharmony_ci}; 117762306a36Sopenharmony_ci 117862306a36Sopenharmony_cienum cpucp_serdes_type { 117962306a36Sopenharmony_ci TYPE_1_SERDES_TYPE, 118062306a36Sopenharmony_ci TYPE_2_SERDES_TYPE, 118162306a36Sopenharmony_ci HLS1_SERDES_TYPE, 118262306a36Sopenharmony_ci HLS1H_SERDES_TYPE, 118362306a36Sopenharmony_ci HLS2_SERDES_TYPE, 118462306a36Sopenharmony_ci HLS2_TYPE_1_SERDES_TYPE, 118562306a36Sopenharmony_ci MAX_NUM_SERDES_TYPE, /* number of types */ 118662306a36Sopenharmony_ci UNKNOWN_SERDES_TYPE = 0xFFFF /* serdes_type is u16 */ 118762306a36Sopenharmony_ci}; 118862306a36Sopenharmony_ci 118962306a36Sopenharmony_cistruct cpucp_nic_info { 119062306a36Sopenharmony_ci struct cpucp_mac_addr mac_addrs[CPUCP_MAX_NICS]; 119162306a36Sopenharmony_ci __le64 link_mask[CPUCP_NIC_MASK_ARR_LEN]; 119262306a36Sopenharmony_ci __le64 pol_tx_mask[CPUCP_NIC_POLARITY_ARR_LEN]; 119362306a36Sopenharmony_ci __le64 pol_rx_mask[CPUCP_NIC_POLARITY_ARR_LEN]; 119462306a36Sopenharmony_ci __le64 link_ext_mask[CPUCP_NIC_MASK_ARR_LEN]; 119562306a36Sopenharmony_ci __u8 qsfp_eeprom[CPUCP_NIC_QSFP_EEPROM_MAX_LEN]; 119662306a36Sopenharmony_ci __le64 auto_neg_mask[CPUCP_NIC_MASK_ARR_LEN]; 119762306a36Sopenharmony_ci __le16 serdes_type; /* enum cpucp_serdes_type */ 119862306a36Sopenharmony_ci __le16 tx_swap_map[CPUCP_MAX_NICS]; 119962306a36Sopenharmony_ci __u8 reserved[6]; 120062306a36Sopenharmony_ci}; 120162306a36Sopenharmony_ci 120262306a36Sopenharmony_ci#define PAGE_DISCARD_MAX 64 120362306a36Sopenharmony_ci 120462306a36Sopenharmony_cistruct page_discard_info { 120562306a36Sopenharmony_ci __u8 num_entries; 120662306a36Sopenharmony_ci __u8 reserved[7]; 120762306a36Sopenharmony_ci __le32 mmu_page_idx[PAGE_DISCARD_MAX]; 120862306a36Sopenharmony_ci}; 120962306a36Sopenharmony_ci 121062306a36Sopenharmony_ci/* 121162306a36Sopenharmony_ci * struct frac_val - fracture value represented by "integer.frac". 121262306a36Sopenharmony_ci * @integer: the integer part of the fracture value; 121362306a36Sopenharmony_ci * @frac: the fracture part of the fracture value. 121462306a36Sopenharmony_ci */ 121562306a36Sopenharmony_cistruct frac_val { 121662306a36Sopenharmony_ci union { 121762306a36Sopenharmony_ci struct { 121862306a36Sopenharmony_ci __le16 integer; 121962306a36Sopenharmony_ci __le16 frac; 122062306a36Sopenharmony_ci }; 122162306a36Sopenharmony_ci __le32 val; 122262306a36Sopenharmony_ci }; 122362306a36Sopenharmony_ci}; 122462306a36Sopenharmony_ci 122562306a36Sopenharmony_ci/* 122662306a36Sopenharmony_ci * struct ser_val - the SER (symbol error rate) value is represented by "integer * 10 ^ -exp". 122762306a36Sopenharmony_ci * @integer: the integer part of the SER value; 122862306a36Sopenharmony_ci * @exp: the exponent part of the SER value. 122962306a36Sopenharmony_ci */ 123062306a36Sopenharmony_cistruct ser_val { 123162306a36Sopenharmony_ci __le16 integer; 123262306a36Sopenharmony_ci __le16 exp; 123362306a36Sopenharmony_ci}; 123462306a36Sopenharmony_ci 123562306a36Sopenharmony_ci/* 123662306a36Sopenharmony_ci * struct cpucp_nic_status - describes the status of a NIC port. 123762306a36Sopenharmony_ci * @port: NIC port index. 123862306a36Sopenharmony_ci * @bad_format_cnt: e.g. CRC. 123962306a36Sopenharmony_ci * @responder_out_of_sequence_psn_cnt: e.g NAK. 124062306a36Sopenharmony_ci * @high_ber_reinit_cnt: link reinit due to high BER. 124162306a36Sopenharmony_ci * @correctable_err_cnt: e.g. bit-flip. 124262306a36Sopenharmony_ci * @uncorrectable_err_cnt: e.g. MAC errors. 124362306a36Sopenharmony_ci * @retraining_cnt: re-training counter. 124462306a36Sopenharmony_ci * @up: is port up. 124562306a36Sopenharmony_ci * @pcs_link: has PCS link. 124662306a36Sopenharmony_ci * @phy_ready: is PHY ready. 124762306a36Sopenharmony_ci * @auto_neg: is Autoneg enabled. 124862306a36Sopenharmony_ci * @timeout_retransmission_cnt: timeout retransmission events. 124962306a36Sopenharmony_ci * @high_ber_cnt: high ber events. 125062306a36Sopenharmony_ci * @pre_fec_ser: pre FEC SER value. 125162306a36Sopenharmony_ci * @post_fec_ser: post FEC SER value. 125262306a36Sopenharmony_ci * @throughput: measured throughput. 125362306a36Sopenharmony_ci * @latency: measured latency. 125462306a36Sopenharmony_ci */ 125562306a36Sopenharmony_cistruct cpucp_nic_status { 125662306a36Sopenharmony_ci __le32 port; 125762306a36Sopenharmony_ci __le32 bad_format_cnt; 125862306a36Sopenharmony_ci __le32 responder_out_of_sequence_psn_cnt; 125962306a36Sopenharmony_ci __le32 high_ber_reinit; 126062306a36Sopenharmony_ci __le32 correctable_err_cnt; 126162306a36Sopenharmony_ci __le32 uncorrectable_err_cnt; 126262306a36Sopenharmony_ci __le32 retraining_cnt; 126362306a36Sopenharmony_ci __u8 up; 126462306a36Sopenharmony_ci __u8 pcs_link; 126562306a36Sopenharmony_ci __u8 phy_ready; 126662306a36Sopenharmony_ci __u8 auto_neg; 126762306a36Sopenharmony_ci __le32 timeout_retransmission_cnt; 126862306a36Sopenharmony_ci __le32 high_ber_cnt; 126962306a36Sopenharmony_ci struct ser_val pre_fec_ser; 127062306a36Sopenharmony_ci struct ser_val post_fec_ser; 127162306a36Sopenharmony_ci struct frac_val bandwidth; 127262306a36Sopenharmony_ci struct frac_val lat; 127362306a36Sopenharmony_ci}; 127462306a36Sopenharmony_ci 127562306a36Sopenharmony_cienum cpucp_hbm_row_replace_cause { 127662306a36Sopenharmony_ci REPLACE_CAUSE_DOUBLE_ECC_ERR, 127762306a36Sopenharmony_ci REPLACE_CAUSE_MULTI_SINGLE_ECC_ERR, 127862306a36Sopenharmony_ci}; 127962306a36Sopenharmony_ci 128062306a36Sopenharmony_cistruct cpucp_hbm_row_info { 128162306a36Sopenharmony_ci __u8 hbm_idx; 128262306a36Sopenharmony_ci __u8 pc; 128362306a36Sopenharmony_ci __u8 sid; 128462306a36Sopenharmony_ci __u8 bank_idx; 128562306a36Sopenharmony_ci __le16 row_addr; 128662306a36Sopenharmony_ci __u8 replaced_row_cause; /* enum cpucp_hbm_row_replace_cause */ 128762306a36Sopenharmony_ci __u8 pad; 128862306a36Sopenharmony_ci}; 128962306a36Sopenharmony_ci 129062306a36Sopenharmony_cistruct cpucp_hbm_row_replaced_rows_info { 129162306a36Sopenharmony_ci __le16 num_replaced_rows; 129262306a36Sopenharmony_ci __u8 pad[6]; 129362306a36Sopenharmony_ci struct cpucp_hbm_row_info replaced_rows[CPUCP_HBM_ROW_REPLACE_MAX]; 129462306a36Sopenharmony_ci}; 129562306a36Sopenharmony_ci 129662306a36Sopenharmony_cienum cpu_reset_status { 129762306a36Sopenharmony_ci CPU_RST_STATUS_NA = 0, 129862306a36Sopenharmony_ci CPU_RST_STATUS_SOFT_RST_DONE = 1, 129962306a36Sopenharmony_ci}; 130062306a36Sopenharmony_ci 130162306a36Sopenharmony_ci#define SEC_PCR_DATA_BUF_SZ 256 130262306a36Sopenharmony_ci#define SEC_PCR_QUOTE_BUF_SZ 510 /* (512 - 2) 2 bytes used for size */ 130362306a36Sopenharmony_ci#define SEC_SIGNATURE_BUF_SZ 255 /* (256 - 1) 1 byte used for size */ 130462306a36Sopenharmony_ci#define SEC_PUB_DATA_BUF_SZ 510 /* (512 - 2) 2 bytes used for size */ 130562306a36Sopenharmony_ci#define SEC_CERTIFICATE_BUF_SZ 2046 /* (2048 - 2) 2 bytes used for size */ 130662306a36Sopenharmony_ci 130762306a36Sopenharmony_ci/* 130862306a36Sopenharmony_ci * struct cpucp_sec_attest_info - attestation report of the boot 130962306a36Sopenharmony_ci * @pcr_data: raw values of the PCR registers 131062306a36Sopenharmony_ci * @pcr_num_reg: number of PCR registers in the pcr_data array 131162306a36Sopenharmony_ci * @pcr_reg_len: length of each PCR register in the pcr_data array (bytes) 131262306a36Sopenharmony_ci * @nonce: number only used once. random number provided by host. this also 131362306a36Sopenharmony_ci * passed to the quote command as a qualifying data. 131462306a36Sopenharmony_ci * @pcr_quote_len: length of the attestation quote data (bytes) 131562306a36Sopenharmony_ci * @pcr_quote: attestation report data structure 131662306a36Sopenharmony_ci * @quote_sig_len: length of the attestation report signature (bytes) 131762306a36Sopenharmony_ci * @quote_sig: signature structure of the attestation report 131862306a36Sopenharmony_ci * @pub_data_len: length of the public data (bytes) 131962306a36Sopenharmony_ci * @public_data: public key for the signed attestation 132062306a36Sopenharmony_ci * (outPublic + name + qualifiedName) 132162306a36Sopenharmony_ci * @certificate_len: length of the certificate (bytes) 132262306a36Sopenharmony_ci * @certificate: certificate for the attestation signing key 132362306a36Sopenharmony_ci */ 132462306a36Sopenharmony_cistruct cpucp_sec_attest_info { 132562306a36Sopenharmony_ci __u8 pcr_data[SEC_PCR_DATA_BUF_SZ]; 132662306a36Sopenharmony_ci __u8 pcr_num_reg; 132762306a36Sopenharmony_ci __u8 pcr_reg_len; 132862306a36Sopenharmony_ci __le16 pad0; 132962306a36Sopenharmony_ci __le32 nonce; 133062306a36Sopenharmony_ci __le16 pcr_quote_len; 133162306a36Sopenharmony_ci __u8 pcr_quote[SEC_PCR_QUOTE_BUF_SZ]; 133262306a36Sopenharmony_ci __u8 quote_sig_len; 133362306a36Sopenharmony_ci __u8 quote_sig[SEC_SIGNATURE_BUF_SZ]; 133462306a36Sopenharmony_ci __le16 pub_data_len; 133562306a36Sopenharmony_ci __u8 public_data[SEC_PUB_DATA_BUF_SZ]; 133662306a36Sopenharmony_ci __le16 certificate_len; 133762306a36Sopenharmony_ci __u8 certificate[SEC_CERTIFICATE_BUF_SZ]; 133862306a36Sopenharmony_ci}; 133962306a36Sopenharmony_ci 134062306a36Sopenharmony_ci/* 134162306a36Sopenharmony_ci * struct cpucp_dev_info_signed - device information signed by a secured device 134262306a36Sopenharmony_ci * @info: device information structure as defined above 134362306a36Sopenharmony_ci * @nonce: number only used once. random number provided by host. this number is 134462306a36Sopenharmony_ci * hashed and signed along with the device information. 134562306a36Sopenharmony_ci * @info_sig_len: length of the attestation signature (bytes) 134662306a36Sopenharmony_ci * @info_sig: signature of the info + nonce data. 134762306a36Sopenharmony_ci * @pub_data_len: length of the public data (bytes) 134862306a36Sopenharmony_ci * @public_data: public key info signed info data 134962306a36Sopenharmony_ci * (outPublic + name + qualifiedName) 135062306a36Sopenharmony_ci * @certificate_len: length of the certificate (bytes) 135162306a36Sopenharmony_ci * @certificate: certificate for the signing key 135262306a36Sopenharmony_ci */ 135362306a36Sopenharmony_cistruct cpucp_dev_info_signed { 135462306a36Sopenharmony_ci struct cpucp_info info; /* assumed to be 64bit aligned */ 135562306a36Sopenharmony_ci __le32 nonce; 135662306a36Sopenharmony_ci __le32 pad0; 135762306a36Sopenharmony_ci __u8 info_sig_len; 135862306a36Sopenharmony_ci __u8 info_sig[SEC_SIGNATURE_BUF_SZ]; 135962306a36Sopenharmony_ci __le16 pub_data_len; 136062306a36Sopenharmony_ci __u8 public_data[SEC_PUB_DATA_BUF_SZ]; 136162306a36Sopenharmony_ci __le16 certificate_len; 136262306a36Sopenharmony_ci __u8 certificate[SEC_CERTIFICATE_BUF_SZ]; 136362306a36Sopenharmony_ci}; 136462306a36Sopenharmony_ci 136562306a36Sopenharmony_ci#define DCORE_MON_REGS_SZ 512 136662306a36Sopenharmony_ci/* 136762306a36Sopenharmony_ci * struct dcore_monitor_regs_data - DCORE monitor regs data. 136862306a36Sopenharmony_ci * the structure follows sync manager block layout. Obsolete. 136962306a36Sopenharmony_ci * @mon_pay_addrl: array of payload address low bits. 137062306a36Sopenharmony_ci * @mon_pay_addrh: array of payload address high bits. 137162306a36Sopenharmony_ci * @mon_pay_data: array of payload data. 137262306a36Sopenharmony_ci * @mon_arm: array of monitor arm. 137362306a36Sopenharmony_ci * @mon_status: array of monitor status. 137462306a36Sopenharmony_ci */ 137562306a36Sopenharmony_cistruct dcore_monitor_regs_data { 137662306a36Sopenharmony_ci __le32 mon_pay_addrl[DCORE_MON_REGS_SZ]; 137762306a36Sopenharmony_ci __le32 mon_pay_addrh[DCORE_MON_REGS_SZ]; 137862306a36Sopenharmony_ci __le32 mon_pay_data[DCORE_MON_REGS_SZ]; 137962306a36Sopenharmony_ci __le32 mon_arm[DCORE_MON_REGS_SZ]; 138062306a36Sopenharmony_ci __le32 mon_status[DCORE_MON_REGS_SZ]; 138162306a36Sopenharmony_ci}; 138262306a36Sopenharmony_ci 138362306a36Sopenharmony_ci/* contains SM data for each SYNC_MNGR (Obsolete) */ 138462306a36Sopenharmony_cistruct cpucp_monitor_dump { 138562306a36Sopenharmony_ci struct dcore_monitor_regs_data sync_mngr_w_s; 138662306a36Sopenharmony_ci struct dcore_monitor_regs_data sync_mngr_e_s; 138762306a36Sopenharmony_ci struct dcore_monitor_regs_data sync_mngr_w_n; 138862306a36Sopenharmony_ci struct dcore_monitor_regs_data sync_mngr_e_n; 138962306a36Sopenharmony_ci}; 139062306a36Sopenharmony_ci 139162306a36Sopenharmony_ci/* 139262306a36Sopenharmony_ci * The Type of the generic request (and other input arguments) will be fetched from user by reading 139362306a36Sopenharmony_ci * from "pkt_subidx" field in struct cpucp_packet. 139462306a36Sopenharmony_ci * 139562306a36Sopenharmony_ci * HL_PASSTHROUGHT_VERSIONS - Fetch all firmware versions. 139662306a36Sopenharmony_ci */ 139762306a36Sopenharmony_cienum hl_passthrough_type { 139862306a36Sopenharmony_ci HL_PASSTHROUGH_VERSIONS, 139962306a36Sopenharmony_ci}; 140062306a36Sopenharmony_ci 140162306a36Sopenharmony_ci#endif /* CPUCP_IF_H */ 1402