Path: blob/main/sys/contrib/dev/iwlwifi/pcie/iwl-context-info-v2.h
48372 views
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */1/*2* Copyright (C) 2018, 2020-2025 Intel Corporation3*/4#ifndef __iwl_context_info_file_v2_h__5#define __iwl_context_info_file_v2_h__67#include "iwl-context-info.h"89#define CSR_CTXT_INFO_BOOT_CTRL 0x010#define CSR_CTXT_INFO_ADDR 0x11811#define CSR_IML_DATA_ADDR 0x12012#define CSR_IML_SIZE_ADDR 0x12813#define CSR_IML_RESP_ADDR 0x12c1415#define UNFRAGMENTED_PNVM_PAYLOADS_NUMBER 21617/* Set bit for enabling automatic function boot */18#define CSR_AUTO_FUNC_BOOT_ENA BIT(1)19/* Set bit for initiating function boot */20#define CSR_AUTO_FUNC_INIT BIT(7)2122/**23* enum iwl_prph_scratch_mtr_format - tfd size configuration24* @IWL_PRPH_MTR_FORMAT_16B: 16 bit tfd25* @IWL_PRPH_MTR_FORMAT_32B: 32 bit tfd26* @IWL_PRPH_MTR_FORMAT_64B: 64 bit tfd27* @IWL_PRPH_MTR_FORMAT_256B: 256 bit tfd28*/29enum iwl_prph_scratch_mtr_format {30IWL_PRPH_MTR_FORMAT_16B = 0x0,31IWL_PRPH_MTR_FORMAT_32B = 0x40000,32IWL_PRPH_MTR_FORMAT_64B = 0x80000,33IWL_PRPH_MTR_FORMAT_256B = 0xC0000,34};3536/**37* enum iwl_prph_scratch_flags - PRPH scratch control flags38* @IWL_PRPH_SCRATCH_IMR_DEBUG_EN: IMR support for debug39* @IWL_PRPH_SCRATCH_EARLY_DEBUG_EN: enable early debug conf40* @IWL_PRPH_SCRATCH_EDBG_DEST_DRAM: use DRAM, with size allocated41* in hwm config.42* @IWL_PRPH_SCRATCH_EDBG_DEST_INTERNAL: use buffer on SRAM43* @IWL_PRPH_SCRATCH_EDBG_DEST_ST_ARBITER: use st arbiter, mainly for44* multicomm.45* @IWL_PRPH_SCRATCH_EDBG_DEST_TB22DTF: route debug data to SoC HW46* @IWL_PRPH_SCRATCH_RB_SIZE_4K: Use 4K RB size (the default is 2K)47* @IWL_PRPH_SCRATCH_MTR_MODE: format used for completion - 0: for48* completion descriptor, 1 for responses (legacy)49* @IWL_PRPH_SCRATCH_MTR_FORMAT: a mask for the size of the tfd.50* There are 4 optional values: 0: 16 bit, 1: 32 bit, 2: 64 bit,51* 3: 256 bit.52* @IWL_PRPH_SCRATCH_RB_SIZE_EXT_MASK: RB size full information, ignored53* by older firmware versions, so set IWL_PRPH_SCRATCH_RB_SIZE_4K54* appropriately; use the below values for this.55* @IWL_PRPH_SCRATCH_RB_SIZE_EXT_8K: 8kB RB size56* @IWL_PRPH_SCRATCH_RB_SIZE_EXT_12K: 12kB RB size57* @IWL_PRPH_SCRATCH_RB_SIZE_EXT_16K: 16kB RB size58* @IWL_PRPH_SCRATCH_SCU_FORCE_ACTIVE: Indicate fw to set SCU_FORCE_ACTIVE59* upon reset.60* @IWL_PRPH_SCRATCH_TOP_RESET: request TOP reset61*/62enum iwl_prph_scratch_flags {63IWL_PRPH_SCRATCH_IMR_DEBUG_EN = BIT(1),64IWL_PRPH_SCRATCH_EARLY_DEBUG_EN = BIT(4),65IWL_PRPH_SCRATCH_EDBG_DEST_DRAM = BIT(8),66IWL_PRPH_SCRATCH_EDBG_DEST_INTERNAL = BIT(9),67IWL_PRPH_SCRATCH_EDBG_DEST_ST_ARBITER = BIT(10),68IWL_PRPH_SCRATCH_EDBG_DEST_TB22DTF = BIT(11),69IWL_PRPH_SCRATCH_RB_SIZE_4K = BIT(16),70IWL_PRPH_SCRATCH_MTR_MODE = BIT(17),71IWL_PRPH_SCRATCH_MTR_FORMAT = BIT(18) | BIT(19),72IWL_PRPH_SCRATCH_RB_SIZE_EXT_MASK = 0xf << 20,73IWL_PRPH_SCRATCH_RB_SIZE_EXT_8K = 8 << 20,74IWL_PRPH_SCRATCH_RB_SIZE_EXT_12K = 9 << 20,75IWL_PRPH_SCRATCH_RB_SIZE_EXT_16K = 10 << 20,76IWL_PRPH_SCRATCH_SCU_FORCE_ACTIVE = BIT(29),77IWL_PRPH_SCRATCH_TOP_RESET = BIT(30),78};7980/**81* enum iwl_prph_scratch_ext_flags - PRPH scratch control ext flags82* @IWL_PRPH_SCRATCH_EXT_EXT_FSEQ: external FSEQ image provided83* @IWL_PRPH_SCRATCH_EXT_URM_FW: switch to URM mode based on fw setting84* @IWL_PRPH_SCRATCH_EXT_URM_PERM: switch to permanent URM mode85* @IWL_PRPH_SCRATCH_EXT_32KHZ_CLK_VALID: use external 32 KHz clock86*/87enum iwl_prph_scratch_ext_flags {88IWL_PRPH_SCRATCH_EXT_EXT_FSEQ = BIT(0),89IWL_PRPH_SCRATCH_EXT_URM_FW = BIT(4),90IWL_PRPH_SCRATCH_EXT_URM_PERM = BIT(5),91IWL_PRPH_SCRATCH_EXT_32KHZ_CLK_VALID = BIT(8),92};9394/**95* struct iwl_prph_scratch_version - version structure96* @mac_id: SKU and revision id97* @version: prph scratch information version id98* @size: the size of the context information in DWs99* @reserved: reserved100*/101struct iwl_prph_scratch_version {102__le16 mac_id;103__le16 version;104__le16 size;105__le16 reserved;106} __packed; /* PERIPH_SCRATCH_VERSION_S */107108/**109* struct iwl_prph_scratch_control - control structure110* @control_flags: context information flags see &enum iwl_prph_scratch_flags111* @control_flags_ext: context information for extended flags,112* see &enum iwl_prph_scratch_ext_flags113*/114struct iwl_prph_scratch_control {115__le32 control_flags;116__le32 control_flags_ext;117} __packed; /* PERIPH_SCRATCH_CONTROL_S */118119/**120* struct iwl_prph_scratch_pnvm_cfg - PNVM scratch121* @pnvm_base_addr: PNVM start address122* @pnvm_size: the size of the PNVM image in bytes123* @reserved: reserved124*/125struct iwl_prph_scratch_pnvm_cfg {126__le64 pnvm_base_addr;127__le32 pnvm_size;128__le32 reserved;129} __packed; /* PERIPH_SCRATCH_PNVM_CFG_S */130131/**132* struct iwl_prph_scratch_mem_desc_addr_array - DRAM133* @mem_descs: array of dram addresses.134* Each address is the beginning of a PNVM payload.135*/136struct iwl_prph_scratch_mem_desc_addr_array {137__le64 mem_descs[IPC_DRAM_MAP_ENTRY_NUM_MAX];138} __packed; /* PERIPH_SCRATCH_MEM_DESC_ADDR_ARRAY_S_VER_1 */139140/**141* struct iwl_prph_scratch_hwm_cfg - hwm config142* @hwm_base_addr: hwm start address143* @hwm_size: hwm size in DWs144* @debug_token_config: debug preset145*/146struct iwl_prph_scratch_hwm_cfg {147__le64 hwm_base_addr;148__le32 hwm_size;149__le32 debug_token_config;150} __packed; /* PERIPH_SCRATCH_HWM_CFG_S */151152/**153* struct iwl_prph_scratch_rbd_cfg - RBDs configuration154* @free_rbd_addr: default queue free RB CB base address155* @reserved: reserved156*/157struct iwl_prph_scratch_rbd_cfg {158__le64 free_rbd_addr;159__le32 reserved;160} __packed; /* PERIPH_SCRATCH_RBD_CFG_S */161162/**163* struct iwl_prph_scratch_uefi_cfg - prph scratch reduce power table164* @base_addr: reduce power table address165* @size: the size of the entire power table image166* @reserved: (reserved)167*/168struct iwl_prph_scratch_uefi_cfg {169__le64 base_addr;170__le32 size;171__le32 reserved;172} __packed; /* PERIPH_SCRATCH_UEFI_CFG_S */173174/**175* struct iwl_prph_scratch_step_cfg - prph scratch step configuration176* @mbx_addr_0: [0:7] revision,177* [8:15] cnvi_to_cnvr length,178* [16:23] cnvr_to_cnvi channel length,179* [24:31] radio1 reserved180* @mbx_addr_1: [0:7] radio2 reserved181*/182183struct iwl_prph_scratch_step_cfg {184__le32 mbx_addr_0;185__le32 mbx_addr_1;186} __packed;187188/**189* struct iwl_prph_scratch_ctrl_cfg - prph scratch ctrl and config190* @version: version information of context info and HW191* @control: control flags of FH configurations192* @pnvm_cfg: ror configuration193* @hwm_cfg: hwm configuration194* @rbd_cfg: default RX queue configuration195* @reduce_power_cfg: UEFI power reduction table196* @step_cfg: step configuration197*/198struct iwl_prph_scratch_ctrl_cfg {199struct iwl_prph_scratch_version version;200struct iwl_prph_scratch_control control;201struct iwl_prph_scratch_pnvm_cfg pnvm_cfg;202struct iwl_prph_scratch_hwm_cfg hwm_cfg;203struct iwl_prph_scratch_rbd_cfg rbd_cfg;204struct iwl_prph_scratch_uefi_cfg reduce_power_cfg;205struct iwl_prph_scratch_step_cfg step_cfg;206} __packed; /* PERIPH_SCRATCH_CTRL_CFG_S */207208#define IWL_NUM_DRAM_FSEQ_ENTRIES 8209210/**211* struct iwl_context_info_dram_fseq - images DRAM map (with fseq)212* each entry in the map represents a DRAM chunk of up to 32 KB213* @common: UMAC/LMAC/virtual images214* @fseq_img: FSEQ image DRAM map215*/216struct iwl_context_info_dram_fseq {217struct iwl_context_info_dram_nonfseq common;218__le64 fseq_img[IWL_NUM_DRAM_FSEQ_ENTRIES];219} __packed; /* PERIPH_SCRATCH_DRAM_MAP_S */220221/**222* struct iwl_prph_scratch - peripheral scratch mapping223* @ctrl_cfg: control and configuration of prph scratch224* @dram: firmware images addresses in DRAM225* @fseq_override: FSEQ override parameters226* @step_analog_params: STEP analog calibration values227* @reserved: reserved228*/229struct iwl_prph_scratch {230struct iwl_prph_scratch_ctrl_cfg ctrl_cfg;231__le32 fseq_override;232__le32 step_analog_params;233__le32 reserved[8];234struct iwl_context_info_dram_fseq dram;235} __packed; /* PERIPH_SCRATCH_S */236237/**238* struct iwl_prph_info - peripheral information239* @boot_stage_mirror: reflects the value in the Boot Stage CSR register240* @ipc_status_mirror: reflects the value in the IPC Status CSR register241* @sleep_notif: indicates the peripheral sleep status242* @reserved: reserved243*/244struct iwl_prph_info {245__le32 boot_stage_mirror;246__le32 ipc_status_mirror;247__le32 sleep_notif;248__le32 reserved;249} __packed; /* PERIPH_INFO_S */250251/**252* struct iwl_context_info_v2 - device INIT configuration253* @version: version of the context information254* @size: size of context information in DWs255* @config: context in which the peripheral would execute - a subset of256* capability csr register published by the peripheral257* @prph_info_base_addr: the peripheral information structure start address258* @cr_head_idx_arr_base_addr: the completion ring head index array259* start address260* @tr_tail_idx_arr_base_addr: the transfer ring tail index array261* start address262* @cr_tail_idx_arr_base_addr: the completion ring tail index array263* start address264* @tr_head_idx_arr_base_addr: the transfer ring head index array265* start address266* @cr_idx_arr_size: number of entries in the completion ring index array267* @tr_idx_arr_size: number of entries in the transfer ring index array268* @mtr_base_addr: the message transfer ring start address269* @mcr_base_addr: the message completion ring start address270* @mtr_size: number of entries which the message transfer ring can hold271* @mcr_size: number of entries which the message completion ring can hold272* @mtr_doorbell_vec: the doorbell vector associated with the message273* transfer ring274* @mcr_doorbell_vec: the doorbell vector associated with the message275* completion ring276* @mtr_msi_vec: the MSI which shall be generated by the peripheral after277* completing a transfer descriptor in the message transfer ring278* @mcr_msi_vec: the MSI which shall be generated by the peripheral after279* completing a completion descriptor in the message completion ring280* @mtr_opt_header_size: the size of the optional header in the transfer281* descriptor associated with the message transfer ring in DWs282* @mtr_opt_footer_size: the size of the optional footer in the transfer283* descriptor associated with the message transfer ring in DWs284* @mcr_opt_header_size: the size of the optional header in the completion285* descriptor associated with the message completion ring in DWs286* @mcr_opt_footer_size: the size of the optional footer in the completion287* descriptor associated with the message completion ring in DWs288* @msg_rings_ctrl_flags: message rings control flags289* @prph_info_msi_vec: the MSI which shall be generated by the peripheral290* after updating the Peripheral Information structure291* @prph_scratch_base_addr: the peripheral scratch structure start address292* @prph_scratch_size: the size of the peripheral scratch structure in DWs293* @reserved: reserved294*/295struct iwl_context_info_v2 {296__le16 version;297__le16 size;298__le32 config;299__le64 prph_info_base_addr;300__le64 cr_head_idx_arr_base_addr;301__le64 tr_tail_idx_arr_base_addr;302__le64 cr_tail_idx_arr_base_addr;303__le64 tr_head_idx_arr_base_addr;304__le16 cr_idx_arr_size;305__le16 tr_idx_arr_size;306__le64 mtr_base_addr;307__le64 mcr_base_addr;308__le16 mtr_size;309__le16 mcr_size;310__le16 mtr_doorbell_vec;311__le16 mcr_doorbell_vec;312__le16 mtr_msi_vec;313__le16 mcr_msi_vec;314u8 mtr_opt_header_size;315u8 mtr_opt_footer_size;316u8 mcr_opt_header_size;317u8 mcr_opt_footer_size;318__le16 msg_rings_ctrl_flags;319__le16 prph_info_msi_vec;320__le64 prph_scratch_base_addr;321__le32 prph_scratch_size;322__le32 reserved;323} __packed; /* IPC_CONTEXT_INFO_S */324325int iwl_pcie_ctxt_info_v2_alloc(struct iwl_trans *trans,326const struct iwl_fw *fw,327const struct fw_img *img);328void iwl_pcie_ctxt_info_v2_kick(struct iwl_trans *trans);329void iwl_pcie_ctxt_info_v2_free(struct iwl_trans *trans, bool alive);330331int iwl_trans_pcie_ctx_info_v2_load_pnvm(struct iwl_trans *trans,332const struct iwl_pnvm_image *pnvm_payloads,333const struct iwl_ucode_capabilities *capa);334void iwl_trans_pcie_ctx_info_v2_set_pnvm(struct iwl_trans *trans,335const struct iwl_ucode_capabilities *capa);336int337iwl_trans_pcie_ctx_info_v2_load_reduce_power(struct iwl_trans *trans,338const struct iwl_pnvm_image *payloads,339const struct iwl_ucode_capabilities *capa);340void341iwl_trans_pcie_ctx_info_v2_set_reduce_power(struct iwl_trans *trans,342const struct iwl_ucode_capabilities *capa);343#endif /* __iwl_context_info_file_v2_h__ */344345346