xref: /freebsd/sys/contrib/dev/iwlwifi/fw/api/phy-ctxt.h (revision bfcc09ddd422c95a1a2e4e794b63ee54c4902398)
1*bfcc09ddSBjoern A. Zeeb /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2*bfcc09ddSBjoern A. Zeeb /*
3*bfcc09ddSBjoern A. Zeeb  * Copyright (C) 2012-2014, 2018, 2020 Intel Corporation
4*bfcc09ddSBjoern A. Zeeb  * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
5*bfcc09ddSBjoern A. Zeeb  * Copyright (C) 2016-2017 Intel Deutschland GmbH
6*bfcc09ddSBjoern A. Zeeb  */
7*bfcc09ddSBjoern A. Zeeb #ifndef __iwl_fw_api_phy_ctxt_h__
8*bfcc09ddSBjoern A. Zeeb #define __iwl_fw_api_phy_ctxt_h__
9*bfcc09ddSBjoern A. Zeeb 
10*bfcc09ddSBjoern A. Zeeb /* Supported bands */
11*bfcc09ddSBjoern A. Zeeb #define PHY_BAND_5  (0)
12*bfcc09ddSBjoern A. Zeeb #define PHY_BAND_24 (1)
13*bfcc09ddSBjoern A. Zeeb #define PHY_BAND_6 (2)
14*bfcc09ddSBjoern A. Zeeb 
15*bfcc09ddSBjoern A. Zeeb /* Supported channel width, vary if there is VHT support */
16*bfcc09ddSBjoern A. Zeeb #define PHY_VHT_CHANNEL_MODE20	(0x0)
17*bfcc09ddSBjoern A. Zeeb #define PHY_VHT_CHANNEL_MODE40	(0x1)
18*bfcc09ddSBjoern A. Zeeb #define PHY_VHT_CHANNEL_MODE80	(0x2)
19*bfcc09ddSBjoern A. Zeeb #define PHY_VHT_CHANNEL_MODE160	(0x3)
20*bfcc09ddSBjoern A. Zeeb 
21*bfcc09ddSBjoern A. Zeeb /*
22*bfcc09ddSBjoern A. Zeeb  * Control channel position:
23*bfcc09ddSBjoern A. Zeeb  * For legacy set bit means upper channel, otherwise lower.
24*bfcc09ddSBjoern A. Zeeb  * For VHT - bit-2 marks if the control is lower/upper relative to center-freq
25*bfcc09ddSBjoern A. Zeeb  *   bits-1:0 mark the distance from the center freq. for 20Mhz, offset is 0.
26*bfcc09ddSBjoern A. Zeeb  *                                   center_freq
27*bfcc09ddSBjoern A. Zeeb  *                                        |
28*bfcc09ddSBjoern A. Zeeb  * 40Mhz                          |_______|_______|
29*bfcc09ddSBjoern A. Zeeb  * 80Mhz                  |_______|_______|_______|_______|
30*bfcc09ddSBjoern A. Zeeb  * 160Mhz |_______|_______|_______|_______|_______|_______|_______|_______|
31*bfcc09ddSBjoern A. Zeeb  * code      011     010     001     000  |  100     101     110    111
32*bfcc09ddSBjoern A. Zeeb  */
33*bfcc09ddSBjoern A. Zeeb #define PHY_VHT_CTRL_POS_1_BELOW  (0x0)
34*bfcc09ddSBjoern A. Zeeb #define PHY_VHT_CTRL_POS_2_BELOW  (0x1)
35*bfcc09ddSBjoern A. Zeeb #define PHY_VHT_CTRL_POS_3_BELOW  (0x2)
36*bfcc09ddSBjoern A. Zeeb #define PHY_VHT_CTRL_POS_4_BELOW  (0x3)
37*bfcc09ddSBjoern A. Zeeb #define PHY_VHT_CTRL_POS_1_ABOVE  (0x4)
38*bfcc09ddSBjoern A. Zeeb #define PHY_VHT_CTRL_POS_2_ABOVE  (0x5)
39*bfcc09ddSBjoern A. Zeeb #define PHY_VHT_CTRL_POS_3_ABOVE  (0x6)
40*bfcc09ddSBjoern A. Zeeb #define PHY_VHT_CTRL_POS_4_ABOVE  (0x7)
41*bfcc09ddSBjoern A. Zeeb 
42*bfcc09ddSBjoern A. Zeeb /*
43*bfcc09ddSBjoern A. Zeeb  * struct iwl_fw_channel_info_v1 - channel information
44*bfcc09ddSBjoern A. Zeeb  *
45*bfcc09ddSBjoern A. Zeeb  * @band: PHY_BAND_*
46*bfcc09ddSBjoern A. Zeeb  * @channel: channel number
47*bfcc09ddSBjoern A. Zeeb  * @width: PHY_[VHT|LEGACY]_CHANNEL_*
48*bfcc09ddSBjoern A. Zeeb  * @ctrl channel: PHY_[VHT|LEGACY]_CTRL_*
49*bfcc09ddSBjoern A. Zeeb  */
50*bfcc09ddSBjoern A. Zeeb struct iwl_fw_channel_info_v1 {
51*bfcc09ddSBjoern A. Zeeb 	u8 band;
52*bfcc09ddSBjoern A. Zeeb 	u8 channel;
53*bfcc09ddSBjoern A. Zeeb 	u8 width;
54*bfcc09ddSBjoern A. Zeeb 	u8 ctrl_pos;
55*bfcc09ddSBjoern A. Zeeb } __packed; /* CHANNEL_CONFIG_API_S_VER_1 */
56*bfcc09ddSBjoern A. Zeeb 
57*bfcc09ddSBjoern A. Zeeb /*
58*bfcc09ddSBjoern A. Zeeb  * struct iwl_fw_channel_info - channel information
59*bfcc09ddSBjoern A. Zeeb  *
60*bfcc09ddSBjoern A. Zeeb  * @channel: channel number
61*bfcc09ddSBjoern A. Zeeb  * @band: PHY_BAND_*
62*bfcc09ddSBjoern A. Zeeb  * @width: PHY_[VHT|LEGACY]_CHANNEL_*
63*bfcc09ddSBjoern A. Zeeb  * @ctrl channel: PHY_[VHT|LEGACY]_CTRL_*
64*bfcc09ddSBjoern A. Zeeb  * @reserved: for future use and alignment
65*bfcc09ddSBjoern A. Zeeb  */
66*bfcc09ddSBjoern A. Zeeb struct iwl_fw_channel_info {
67*bfcc09ddSBjoern A. Zeeb 	__le32 channel;
68*bfcc09ddSBjoern A. Zeeb 	u8 band;
69*bfcc09ddSBjoern A. Zeeb 	u8 width;
70*bfcc09ddSBjoern A. Zeeb 	u8 ctrl_pos;
71*bfcc09ddSBjoern A. Zeeb 	u8 reserved;
72*bfcc09ddSBjoern A. Zeeb } __packed; /*CHANNEL_CONFIG_API_S_VER_2 */
73*bfcc09ddSBjoern A. Zeeb 
74*bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_DRIVER_FORCE_POS	(0)
75*bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_DRIVER_FORCE_MSK \
76*bfcc09ddSBjoern A. Zeeb 	(0x1 << PHY_RX_CHAIN_DRIVER_FORCE_POS)
77*bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_VALID_POS		(1)
78*bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_VALID_MSK \
79*bfcc09ddSBjoern A. Zeeb 	(0x7 << PHY_RX_CHAIN_VALID_POS)
80*bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_FORCE_SEL_POS	(4)
81*bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_FORCE_SEL_MSK \
82*bfcc09ddSBjoern A. Zeeb 	(0x7 << PHY_RX_CHAIN_FORCE_SEL_POS)
83*bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_FORCE_MIMO_SEL_POS	(7)
84*bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_FORCE_MIMO_SEL_MSK \
85*bfcc09ddSBjoern A. Zeeb 	(0x7 << PHY_RX_CHAIN_FORCE_MIMO_SEL_POS)
86*bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_CNT_POS		(10)
87*bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_CNT_MSK \
88*bfcc09ddSBjoern A. Zeeb 	(0x3 << PHY_RX_CHAIN_CNT_POS)
89*bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_MIMO_CNT_POS	(12)
90*bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_MIMO_CNT_MSK \
91*bfcc09ddSBjoern A. Zeeb 	(0x3 << PHY_RX_CHAIN_MIMO_CNT_POS)
92*bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_MIMO_FORCE_POS	(14)
93*bfcc09ddSBjoern A. Zeeb #define PHY_RX_CHAIN_MIMO_FORCE_MSK \
94*bfcc09ddSBjoern A. Zeeb 	(0x1 << PHY_RX_CHAIN_MIMO_FORCE_POS)
95*bfcc09ddSBjoern A. Zeeb 
96*bfcc09ddSBjoern A. Zeeb /* TODO: fix the value, make it depend on firmware at runtime? */
97*bfcc09ddSBjoern A. Zeeb #define NUM_PHY_CTX	3
98*bfcc09ddSBjoern A. Zeeb 
99*bfcc09ddSBjoern A. Zeeb /* TODO: complete missing documentation */
100*bfcc09ddSBjoern A. Zeeb /**
101*bfcc09ddSBjoern A. Zeeb  * struct iwl_phy_context_cmd_tail - tail of iwl_phy_ctx_cmd for alignment with
102*bfcc09ddSBjoern A. Zeeb  *	various channel structures.
103*bfcc09ddSBjoern A. Zeeb  *
104*bfcc09ddSBjoern A. Zeeb  * @txchain_info: ???
105*bfcc09ddSBjoern A. Zeeb  * @rxchain_info: ???
106*bfcc09ddSBjoern A. Zeeb  * @acquisition_data: ???
107*bfcc09ddSBjoern A. Zeeb  * @dsp_cfg_flags: set to 0
108*bfcc09ddSBjoern A. Zeeb  */
109*bfcc09ddSBjoern A. Zeeb struct iwl_phy_context_cmd_tail {
110*bfcc09ddSBjoern A. Zeeb 	__le32 txchain_info;
111*bfcc09ddSBjoern A. Zeeb 	__le32 rxchain_info;
112*bfcc09ddSBjoern A. Zeeb 	__le32 acquisition_data;
113*bfcc09ddSBjoern A. Zeeb 	__le32 dsp_cfg_flags;
114*bfcc09ddSBjoern A. Zeeb } __packed;
115*bfcc09ddSBjoern A. Zeeb 
116*bfcc09ddSBjoern A. Zeeb /**
117*bfcc09ddSBjoern A. Zeeb  * struct iwl_phy_context_cmd - config of the PHY context
118*bfcc09ddSBjoern A. Zeeb  * ( PHY_CONTEXT_CMD = 0x8 )
119*bfcc09ddSBjoern A. Zeeb  * @id_and_color: ID and color of the relevant Binding
120*bfcc09ddSBjoern A. Zeeb  * @action: action to perform, one of FW_CTXT_ACTION_*
121*bfcc09ddSBjoern A. Zeeb  * @apply_time: 0 means immediate apply and context switch.
122*bfcc09ddSBjoern A. Zeeb  *	other value means apply new params after X usecs
123*bfcc09ddSBjoern A. Zeeb  * @tx_param_color: ???
124*bfcc09ddSBjoern A. Zeeb  * @ci: channel info
125*bfcc09ddSBjoern A. Zeeb  * @tail: command tail
126*bfcc09ddSBjoern A. Zeeb  */
127*bfcc09ddSBjoern A. Zeeb struct iwl_phy_context_cmd_v1 {
128*bfcc09ddSBjoern A. Zeeb 	/* COMMON_INDEX_HDR_API_S_VER_1 */
129*bfcc09ddSBjoern A. Zeeb 	__le32 id_and_color;
130*bfcc09ddSBjoern A. Zeeb 	__le32 action;
131*bfcc09ddSBjoern A. Zeeb 	/* PHY_CONTEXT_DATA_API_S_VER_3 */
132*bfcc09ddSBjoern A. Zeeb 	__le32 apply_time;
133*bfcc09ddSBjoern A. Zeeb 	__le32 tx_param_color;
134*bfcc09ddSBjoern A. Zeeb 	struct iwl_fw_channel_info ci;
135*bfcc09ddSBjoern A. Zeeb 	struct iwl_phy_context_cmd_tail tail;
136*bfcc09ddSBjoern A. Zeeb } __packed; /* PHY_CONTEXT_CMD_API_VER_1 */
137*bfcc09ddSBjoern A. Zeeb 
138*bfcc09ddSBjoern A. Zeeb /**
139*bfcc09ddSBjoern A. Zeeb  * struct iwl_phy_context_cmd - config of the PHY context
140*bfcc09ddSBjoern A. Zeeb  * ( PHY_CONTEXT_CMD = 0x8 )
141*bfcc09ddSBjoern A. Zeeb  * @id_and_color: ID and color of the relevant Binding
142*bfcc09ddSBjoern A. Zeeb  * @action: action to perform, one of FW_CTXT_ACTION_*
143*bfcc09ddSBjoern A. Zeeb  * @lmac_id: the lmac id the phy context belongs to
144*bfcc09ddSBjoern A. Zeeb  * @ci: channel info
145*bfcc09ddSBjoern A. Zeeb  * @rxchain_info: ???
146*bfcc09ddSBjoern A. Zeeb  * @dsp_cfg_flags: set to 0
147*bfcc09ddSBjoern A. Zeeb  * @reserved: reserved to align to 64 bit
148*bfcc09ddSBjoern A. Zeeb  */
149*bfcc09ddSBjoern A. Zeeb struct iwl_phy_context_cmd {
150*bfcc09ddSBjoern A. Zeeb 	/* COMMON_INDEX_HDR_API_S_VER_1 */
151*bfcc09ddSBjoern A. Zeeb 	__le32 id_and_color;
152*bfcc09ddSBjoern A. Zeeb 	__le32 action;
153*bfcc09ddSBjoern A. Zeeb 	/* PHY_CONTEXT_DATA_API_S_VER_3 */
154*bfcc09ddSBjoern A. Zeeb 	struct iwl_fw_channel_info ci;
155*bfcc09ddSBjoern A. Zeeb 	__le32 lmac_id;
156*bfcc09ddSBjoern A. Zeeb 	__le32 rxchain_info;
157*bfcc09ddSBjoern A. Zeeb 	__le32 dsp_cfg_flags;
158*bfcc09ddSBjoern A. Zeeb 	__le32 reserved;
159*bfcc09ddSBjoern A. Zeeb } __packed; /* PHY_CONTEXT_CMD_API_VER_3 */
160*bfcc09ddSBjoern A. Zeeb #endif /* __iwl_fw_api_phy_ctxt_h__ */
161