xref: /freebsd/sys/contrib/dev/iwlwifi/fw/api/phy-ctxt.h (revision a4128aad8503277614f2d214011ef60a19447b83)
1bfcc09ddSBjoern A. Zeeb /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2bfcc09ddSBjoern A. Zeeb /*
3*a4128aadSBjoern A. Zeeb  * Copyright (C) 2012-2014, 2018, 2020-2024 Intel Corporation
4bfcc09ddSBjoern A. Zeeb  * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
5bfcc09ddSBjoern A. Zeeb  * Copyright (C) 2016-2017 Intel Deutschland GmbH
6bfcc09ddSBjoern A. Zeeb  */
7bfcc09ddSBjoern A. Zeeb #ifndef __iwl_fw_api_phy_ctxt_h__
8bfcc09ddSBjoern A. Zeeb #define __iwl_fw_api_phy_ctxt_h__
9bfcc09ddSBjoern A. Zeeb 
10bfcc09ddSBjoern A. Zeeb /* Supported bands */
11bfcc09ddSBjoern A. Zeeb #define PHY_BAND_5  (0)
12bfcc09ddSBjoern A. Zeeb #define PHY_BAND_24 (1)
13bfcc09ddSBjoern A. Zeeb #define PHY_BAND_6 (2)
14bfcc09ddSBjoern A. Zeeb 
15bfcc09ddSBjoern A. Zeeb /* Supported channel width, vary if there is VHT support */
169af1bba4SBjoern A. Zeeb #define IWL_PHY_CHANNEL_MODE20	0x0
179af1bba4SBjoern A. Zeeb #define IWL_PHY_CHANNEL_MODE40	0x1
189af1bba4SBjoern A. Zeeb #define IWL_PHY_CHANNEL_MODE80	0x2
199af1bba4SBjoern A. Zeeb #define IWL_PHY_CHANNEL_MODE160	0x3
209af1bba4SBjoern A. Zeeb /* and 320 MHz for EHT */
219af1bba4SBjoern A. Zeeb #define IWL_PHY_CHANNEL_MODE320	0x4
22bfcc09ddSBjoern A. Zeeb 
23bfcc09ddSBjoern A. Zeeb /*
24bfcc09ddSBjoern A. Zeeb  * Control channel position:
25bfcc09ddSBjoern A. Zeeb  * For legacy set bit means upper channel, otherwise lower.
26bfcc09ddSBjoern A. Zeeb  * For VHT - bit-2 marks if the control is lower/upper relative to center-freq
27bfcc09ddSBjoern A. Zeeb  *   bits-1:0 mark the distance from the center freq. for 20Mhz, offset is 0.
289af1bba4SBjoern A. Zeeb  * For EHT - bit-3 is used for extended distance
29*a4128aadSBjoern A. Zeeb  *                                           center_freq
30bfcc09ddSBjoern A. Zeeb  *                                                |
319af1bba4SBjoern A. Zeeb  * 40Mhz                                     |____|____|
329af1bba4SBjoern A. Zeeb  * 80Mhz                                |____|____|____|____|
339af1bba4SBjoern A. Zeeb  * 160Mhz                     |____|____|____|____|____|____|____|____|
349af1bba4SBjoern A. Zeeb  * 320MHz |____|____|____|____|____|____|____|____|____|____|____|____|____|____|____|____|
359af1bba4SBjoern A. Zeeb  * code    1011 1010 1001 1000 0011 0010 0001 0000 0100 0101 0110 0111 1100 1101 1110 1111
36bfcc09ddSBjoern A. Zeeb  */
379af1bba4SBjoern A. Zeeb #define IWL_PHY_CTRL_POS_ABOVE		0x4
389af1bba4SBjoern A. Zeeb #define IWL_PHY_CTRL_POS_OFFS_EXT	0x8
399af1bba4SBjoern A. Zeeb #define IWL_PHY_CTRL_POS_OFFS_MSK	0x3
40bfcc09ddSBjoern A. Zeeb 
41bfcc09ddSBjoern A. Zeeb /*
42bfcc09ddSBjoern A. Zeeb  * struct iwl_fw_channel_info_v1 - channel information
43bfcc09ddSBjoern A. Zeeb  *
44bfcc09ddSBjoern A. Zeeb  * @band: PHY_BAND_*
45bfcc09ddSBjoern A. Zeeb  * @channel: channel number
46bfcc09ddSBjoern A. Zeeb  * @width: PHY_[VHT|LEGACY]_CHANNEL_*
47bfcc09ddSBjoern A. Zeeb  * @ctrl channel: PHY_[VHT|LEGACY]_CTRL_*
48bfcc09ddSBjoern A. Zeeb  */
49bfcc09ddSBjoern A. Zeeb struct iwl_fw_channel_info_v1 {
50bfcc09ddSBjoern A. Zeeb 	u8 band;
51bfcc09ddSBjoern A. Zeeb 	u8 channel;
52bfcc09ddSBjoern A. Zeeb 	u8 width;
53bfcc09ddSBjoern A. Zeeb 	u8 ctrl_pos;
54bfcc09ddSBjoern A. Zeeb } __packed; /* CHANNEL_CONFIG_API_S_VER_1 */
55bfcc09ddSBjoern A. Zeeb 
56bfcc09ddSBjoern A. Zeeb /*
57bfcc09ddSBjoern A. Zeeb  * struct iwl_fw_channel_info - channel information
58bfcc09ddSBjoern A. Zeeb  *
59bfcc09ddSBjoern A. Zeeb  * @channel: channel number
60bfcc09ddSBjoern A. Zeeb  * @band: PHY_BAND_*
61bfcc09ddSBjoern A. Zeeb  * @width: PHY_[VHT|LEGACY]_CHANNEL_*
62bfcc09ddSBjoern A. Zeeb  * @ctrl channel: PHY_[VHT|LEGACY]_CTRL_*
63bfcc09ddSBjoern A. Zeeb  * @reserved: for future use and alignment
64bfcc09ddSBjoern A. Zeeb  */
65bfcc09ddSBjoern A. Zeeb struct iwl_fw_channel_info {
66bfcc09ddSBjoern A. Zeeb 	__le32 channel;
67bfcc09ddSBjoern A. Zeeb 	u8 band;
68bfcc09ddSBjoern A. Zeeb 	u8 width;
69bfcc09ddSBjoern A. Zeeb 	u8 ctrl_pos;
70bfcc09ddSBjoern A. Zeeb 	u8 reserved;
71bfcc09ddSBjoern A. Zeeb } __packed; /*CHANNEL_CONFIG_API_S_VER_2 */
72bfcc09ddSBjoern A. Zeeb 
73bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_DRIVER_FORCE_POS	(0)
74bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_DRIVER_FORCE_MSK \
75bfcc09ddSBjoern A. Zeeb 	(0x1 << PHY_RX_CHAIN_DRIVER_FORCE_POS)
76bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_VALID_POS		(1)
77bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_VALID_MSK \
78bfcc09ddSBjoern A. Zeeb 	(0x7 << PHY_RX_CHAIN_VALID_POS)
79bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_FORCE_SEL_POS	(4)
80bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_FORCE_SEL_MSK \
81bfcc09ddSBjoern A. Zeeb 	(0x7 << PHY_RX_CHAIN_FORCE_SEL_POS)
82bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_FORCE_MIMO_SEL_POS	(7)
83bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_FORCE_MIMO_SEL_MSK \
84bfcc09ddSBjoern A. Zeeb 	(0x7 << PHY_RX_CHAIN_FORCE_MIMO_SEL_POS)
85bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_CNT_POS		(10)
86bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_CNT_MSK \
87bfcc09ddSBjoern A. Zeeb 	(0x3 << PHY_RX_CHAIN_CNT_POS)
88bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_MIMO_CNT_POS	(12)
89bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_MIMO_CNT_MSK \
90bfcc09ddSBjoern A. Zeeb 	(0x3 << PHY_RX_CHAIN_MIMO_CNT_POS)
91bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_MIMO_FORCE_POS	(14)
92bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_MIMO_FORCE_MSK \
93bfcc09ddSBjoern A. Zeeb 	(0x1 << PHY_RX_CHAIN_MIMO_FORCE_POS)
94bfcc09ddSBjoern A. Zeeb 
95bfcc09ddSBjoern A. Zeeb /* TODO: fix the value, make it depend on firmware at runtime? */
96bfcc09ddSBjoern A. Zeeb #define NUM_PHY_CTX	3
97bfcc09ddSBjoern A. Zeeb 
98bfcc09ddSBjoern A. Zeeb /* TODO: complete missing documentation */
99bfcc09ddSBjoern A. Zeeb /**
100bfcc09ddSBjoern A. Zeeb  * struct iwl_phy_context_cmd_tail - tail of iwl_phy_ctx_cmd for alignment with
101bfcc09ddSBjoern A. Zeeb  *	various channel structures.
102bfcc09ddSBjoern A. Zeeb  *
103bfcc09ddSBjoern A. Zeeb  * @txchain_info: ???
104bfcc09ddSBjoern A. Zeeb  * @rxchain_info: ???
105bfcc09ddSBjoern A. Zeeb  * @acquisition_data: ???
106bfcc09ddSBjoern A. Zeeb  * @dsp_cfg_flags: set to 0
107bfcc09ddSBjoern A. Zeeb  */
108bfcc09ddSBjoern A. Zeeb struct iwl_phy_context_cmd_tail {
109bfcc09ddSBjoern A. Zeeb 	__le32 txchain_info;
110bfcc09ddSBjoern A. Zeeb 	__le32 rxchain_info;
111bfcc09ddSBjoern A. Zeeb 	__le32 acquisition_data;
112bfcc09ddSBjoern A. Zeeb 	__le32 dsp_cfg_flags;
113bfcc09ddSBjoern A. Zeeb } __packed;
114bfcc09ddSBjoern A. Zeeb 
115bfcc09ddSBjoern A. Zeeb /**
116*a4128aadSBjoern A. Zeeb  * struct iwl_phy_context_cmd_v1 - config of the PHY context
117bfcc09ddSBjoern A. Zeeb  * ( PHY_CONTEXT_CMD = 0x8 )
118bfcc09ddSBjoern A. Zeeb  * @id_and_color: ID and color of the relevant Binding
1199af1bba4SBjoern A. Zeeb  * @action: action to perform, see &enum iwl_ctxt_action
120bfcc09ddSBjoern A. Zeeb  * @apply_time: 0 means immediate apply and context switch.
121bfcc09ddSBjoern A. Zeeb  *	other value means apply new params after X usecs
122bfcc09ddSBjoern A. Zeeb  * @tx_param_color: ???
123bfcc09ddSBjoern A. Zeeb  * @ci: channel info
124bfcc09ddSBjoern A. Zeeb  * @tail: command tail
125bfcc09ddSBjoern A. Zeeb  */
126bfcc09ddSBjoern A. Zeeb struct iwl_phy_context_cmd_v1 {
127bfcc09ddSBjoern A. Zeeb 	/* COMMON_INDEX_HDR_API_S_VER_1 */
128bfcc09ddSBjoern A. Zeeb 	__le32 id_and_color;
129bfcc09ddSBjoern A. Zeeb 	__le32 action;
130bfcc09ddSBjoern A. Zeeb 	/* PHY_CONTEXT_DATA_API_S_VER_3 */
131bfcc09ddSBjoern A. Zeeb 	__le32 apply_time;
132bfcc09ddSBjoern A. Zeeb 	__le32 tx_param_color;
133bfcc09ddSBjoern A. Zeeb 	struct iwl_fw_channel_info ci;
134bfcc09ddSBjoern A. Zeeb 	struct iwl_phy_context_cmd_tail tail;
135bfcc09ddSBjoern A. Zeeb } __packed; /* PHY_CONTEXT_CMD_API_VER_1 */
136bfcc09ddSBjoern A. Zeeb 
137bfcc09ddSBjoern A. Zeeb /**
138bfcc09ddSBjoern A. Zeeb  * struct iwl_phy_context_cmd - config of the PHY context
139bfcc09ddSBjoern A. Zeeb  * ( PHY_CONTEXT_CMD = 0x8 )
140bfcc09ddSBjoern A. Zeeb  * @id_and_color: ID and color of the relevant Binding
1419af1bba4SBjoern A. Zeeb  * @action: action to perform, see &enum iwl_ctxt_action
142bfcc09ddSBjoern A. Zeeb  * @lmac_id: the lmac id the phy context belongs to
143bfcc09ddSBjoern A. Zeeb  * @ci: channel info
144bfcc09ddSBjoern A. Zeeb  * @rxchain_info: ???
145*a4128aadSBjoern A. Zeeb  * @sbb_bandwidth: 0 disabled, 1 - 40Mhz ... 4 - 320MHz
146*a4128aadSBjoern A. Zeeb  * @sbb_ctrl_channel_loc: location of the control channel
147*a4128aadSBjoern A. Zeeb  * @puncture_mask: bitmap of punctured subchannels
148bfcc09ddSBjoern A. Zeeb  * @dsp_cfg_flags: set to 0
149bfcc09ddSBjoern A. Zeeb  * @reserved: reserved to align to 64 bit
150bfcc09ddSBjoern A. Zeeb  */
151bfcc09ddSBjoern A. Zeeb struct iwl_phy_context_cmd {
152bfcc09ddSBjoern A. Zeeb 	/* COMMON_INDEX_HDR_API_S_VER_1 */
153bfcc09ddSBjoern A. Zeeb 	__le32 id_and_color;
154bfcc09ddSBjoern A. Zeeb 	__le32 action;
155d9836fb4SBjoern A. Zeeb 	/* PHY_CONTEXT_DATA_API_S_VER_3, PHY_CONTEXT_DATA_API_S_VER_4 */
156bfcc09ddSBjoern A. Zeeb 	struct iwl_fw_channel_info ci;
157bfcc09ddSBjoern A. Zeeb 	__le32 lmac_id;
158*a4128aadSBjoern A. Zeeb 	union {
159d9836fb4SBjoern A. Zeeb 		__le32 rxchain_info; /* reserved in _VER_4 */
160*a4128aadSBjoern A. Zeeb 		struct {             /* used for _VER_5/_VER_6 */
161*a4128aadSBjoern A. Zeeb 			u8 sbb_bandwidth;
162*a4128aadSBjoern A. Zeeb 			u8 sbb_ctrl_channel_loc;
163*a4128aadSBjoern A. Zeeb 			__le16 puncture_mask; /* added in VER_6 */
164*a4128aadSBjoern A. Zeeb 		};
165*a4128aadSBjoern A. Zeeb 	};
166bfcc09ddSBjoern A. Zeeb 	__le32 dsp_cfg_flags;
167bfcc09ddSBjoern A. Zeeb 	__le32 reserved;
168*a4128aadSBjoern A. Zeeb } __packed; /* PHY_CONTEXT_CMD_API_VER_3,
169*a4128aadSBjoern A. Zeeb 	     * PHY_CONTEXT_CMD_API_VER_4,
170*a4128aadSBjoern A. Zeeb 	     * PHY_CONTEXT_CMD_API_VER_5,
171*a4128aadSBjoern A. Zeeb 	     * PHY_CONTEXT_CMD_API_VER_6
172*a4128aadSBjoern A. Zeeb 	     */
173d9836fb4SBjoern A. Zeeb 
174bfcc09ddSBjoern A. Zeeb #endif /* __iwl_fw_api_phy_ctxt_h__ */
175