Path: blob/main/sys/contrib/dev/iwlwifi/pcie/iwl-context-info.h
48372 views
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */1/*2* Copyright (C) 2017 Intel Deutschland GmbH3* Copyright (C) 2018-2020, 2022, 2024-2025 Intel Corporation4*/5#ifndef __iwl_context_info_file_h__6#define __iwl_context_info_file_h__78/* maximum number of DRAM map entries supported by FW */9#define IWL_MAX_DRAM_ENTRY 6410#define CSR_CTXT_INFO_BA 0x401112/**13* enum iwl_context_info_flags - Context information control flags14* @IWL_CTXT_INFO_AUTO_FUNC_INIT: If set, FW will not wait before interrupting15* the init done for driver command that configures several system modes16* @IWL_CTXT_INFO_EARLY_DEBUG: enable early debug17* @IWL_CTXT_INFO_ENABLE_CDMP: enable core dump18* @IWL_CTXT_INFO_RB_CB_SIZE: mask of the RBD Cyclic Buffer Size19* exponent, the actual size is 2**value, valid sizes are 8-2048.20* The value is four bits long. Maximum valid exponent is 1221* @IWL_CTXT_INFO_TFD_FORMAT_LONG: use long TFD Format (the22* default is short format - not supported by the driver)23* @IWL_CTXT_INFO_RB_SIZE: RB size mask24* (values are IWL_CTXT_INFO_RB_SIZE_*K)25* @IWL_CTXT_INFO_RB_SIZE_1K: Value for 1K RB size26* @IWL_CTXT_INFO_RB_SIZE_2K: Value for 2K RB size27* @IWL_CTXT_INFO_RB_SIZE_4K: Value for 4K RB size28* @IWL_CTXT_INFO_RB_SIZE_8K: Value for 8K RB size29* @IWL_CTXT_INFO_RB_SIZE_12K: Value for 12K RB size30* @IWL_CTXT_INFO_RB_SIZE_16K: Value for 16K RB size31* @IWL_CTXT_INFO_RB_SIZE_20K: Value for 20K RB size32* @IWL_CTXT_INFO_RB_SIZE_24K: Value for 24K RB size33* @IWL_CTXT_INFO_RB_SIZE_28K: Value for 28K RB size34* @IWL_CTXT_INFO_RB_SIZE_32K: Value for 32K RB size35*/36enum iwl_context_info_flags {37IWL_CTXT_INFO_AUTO_FUNC_INIT = 0x0001,38IWL_CTXT_INFO_EARLY_DEBUG = 0x0002,39IWL_CTXT_INFO_ENABLE_CDMP = 0x0004,40IWL_CTXT_INFO_RB_CB_SIZE = 0x00f0,41IWL_CTXT_INFO_TFD_FORMAT_LONG = 0x0100,42IWL_CTXT_INFO_RB_SIZE = 0x1e00,43IWL_CTXT_INFO_RB_SIZE_1K = 0x1,44IWL_CTXT_INFO_RB_SIZE_2K = 0x2,45IWL_CTXT_INFO_RB_SIZE_4K = 0x4,46IWL_CTXT_INFO_RB_SIZE_8K = 0x8,47IWL_CTXT_INFO_RB_SIZE_12K = 0x9,48IWL_CTXT_INFO_RB_SIZE_16K = 0xa,49IWL_CTXT_INFO_RB_SIZE_20K = 0xb,50IWL_CTXT_INFO_RB_SIZE_24K = 0xc,51IWL_CTXT_INFO_RB_SIZE_28K = 0xd,52IWL_CTXT_INFO_RB_SIZE_32K = 0xe,53};5455/**56* struct iwl_context_info_version - version structure57* @mac_id: SKU and revision id58* @version: context information version id59* @size: the size of the context information in DWs60* @reserved: (reserved)61*/62struct iwl_context_info_version {63__le16 mac_id;64__le16 version;65__le16 size;66__le16 reserved;67} __packed;6869/**70* struct iwl_context_info_control - version structure71* @control_flags: context information flags see &enum iwl_context_info_flags72* @reserved: (reserved)73*/74struct iwl_context_info_control {75__le32 control_flags;76__le32 reserved;77} __packed;7879/**80* struct iwl_context_info_dram_nonfseq - images DRAM map81* each entry in the map represents a DRAM chunk of up to 32 KB82* @umac_img: UMAC image DRAM map83* @lmac_img: LMAC image DRAM map84* @virtual_img: paged image DRAM map85*/86struct iwl_context_info_dram_nonfseq {87__le64 umac_img[IWL_MAX_DRAM_ENTRY];88__le64 lmac_img[IWL_MAX_DRAM_ENTRY];89__le64 virtual_img[IWL_MAX_DRAM_ENTRY];90} __packed;9192/**93* struct iwl_context_info_rbd_cfg - RBDs configuration94* @free_rbd_addr: default queue free RB CB base address95* @used_rbd_addr: default queue used RB CB base address96* @status_wr_ptr: default queue used RB status write pointer97*/98struct iwl_context_info_rbd_cfg {99__le64 free_rbd_addr;100__le64 used_rbd_addr;101__le64 status_wr_ptr;102} __packed;103104/**105* struct iwl_context_info_hcmd_cfg - command queue configuration106* @cmd_queue_addr: address of command queue107* @cmd_queue_size: number of entries108* @reserved: (reserved)109*/110struct iwl_context_info_hcmd_cfg {111__le64 cmd_queue_addr;112u8 cmd_queue_size;113u8 reserved[7];114} __packed;115116/**117* struct iwl_context_info_dump_cfg - Core Dump configuration118* @core_dump_addr: core dump (debug DRAM address) start address119* @core_dump_size: size, in DWs120* @reserved: (reserved)121*/122struct iwl_context_info_dump_cfg {123__le64 core_dump_addr;124__le32 core_dump_size;125__le32 reserved;126} __packed;127128/**129* struct iwl_context_info_pnvm_cfg - platform NVM data configuration130* @platform_nvm_addr: Platform NVM data start address131* @platform_nvm_size: size in DWs132* @reserved: (reserved)133*/134struct iwl_context_info_pnvm_cfg {135__le64 platform_nvm_addr;136__le32 platform_nvm_size;137__le32 reserved;138} __packed;139140/**141* struct iwl_context_info_early_dbg_cfg - early debug configuration for142* dumping DRAM addresses143* @early_debug_addr: early debug start address144* @early_debug_size: size in DWs145* @reserved: (reserved)146*/147struct iwl_context_info_early_dbg_cfg {148__le64 early_debug_addr;149__le32 early_debug_size;150__le32 reserved;151} __packed;152153/**154* struct iwl_context_info - device INIT configuration155* @version: version information of context info and HW156* @control: control flags of FH configurations157* @reserved0: (reserved)158* @rbd_cfg: default RX queue configuration159* @hcmd_cfg: command queue configuration160* @reserved1: (reserved)161* @dump_cfg: core dump data162* @edbg_cfg: early debug configuration163* @pnvm_cfg: platform nvm configuration164* @reserved2: (reserved)165* @dram: firmware image addresses in DRAM166* @reserved3: (reserved)167*/168struct iwl_context_info {169struct iwl_context_info_version version;170struct iwl_context_info_control control;171__le64 reserved0;172struct iwl_context_info_rbd_cfg rbd_cfg;173struct iwl_context_info_hcmd_cfg hcmd_cfg;174__le32 reserved1[4];175struct iwl_context_info_dump_cfg dump_cfg;176struct iwl_context_info_early_dbg_cfg edbg_cfg;177struct iwl_context_info_pnvm_cfg pnvm_cfg;178__le32 reserved2[16];179struct iwl_context_info_dram_nonfseq dram;180__le32 reserved3[16];181} __packed; /* BOOT_LOADER_CONTEXT_INFO_S */182183int iwl_pcie_ctxt_info_init(struct iwl_trans *trans, const struct fw_img *img);184void iwl_pcie_ctxt_info_free(struct iwl_trans *trans);185void iwl_pcie_ctxt_info_free_paging(struct iwl_trans *trans);186int iwl_pcie_init_fw_sec(struct iwl_trans *trans,187const struct fw_img *fw,188struct iwl_context_info_dram_nonfseq *ctxt_dram);189void *iwl_pcie_ctxt_info_dma_alloc_coherent(struct iwl_trans *trans,190size_t size,191dma_addr_t *phys);192int iwl_pcie_ctxt_info_alloc_dma(struct iwl_trans *trans,193const void *data, u32 len,194struct iwl_dram_data *dram);195196#endif /* __iwl_context_info_file_h__ */197198199