xref: /freebsd/sys/contrib/dev/iwlwifi/fw/api/dhc.h (revision 6b627f88584ce13118e0a24951b503c0b1f2d5a7)
1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /*
3  * Copyright (C) 2025 Intel Corporation
4  */
5 #ifndef __iwl_fw_api_dhc_h__
6 #define __iwl_fw_api_dhc_h__
7 
8 #define DHC_TABLE_MASK_POS (28)
9 
10 /**
11  * enum iwl_dhc_table_id - DHC table operations index
12  */
13 enum iwl_dhc_table_id {
14 	/**
15 	 * @DHC_TABLE_INTEGRATION: select the integration table
16 	 */
17 	DHC_TABLE_INTEGRATION	= 2 << DHC_TABLE_MASK_POS,
18 	/**
19 	 * @DHC_TABLE_TOOLS: select the tools table
20 	 */
21 	DHC_TABLE_TOOLS		= 0,
22 };
23 
24 /**
25  * enum iwl_dhc_umac_tools_table - tools operations
26  * @DHC_TOOLS_UMAC_GET_TAS_STATUS: Get TAS status.
27  *	See @struct iwl_dhc_tas_status_resp
28  */
29 enum iwl_dhc_umac_tools_table {
30 	DHC_TOOLS_UMAC_GET_TAS_STATUS = 0,
31 };
32 
33 /**
34  * enum iwl_dhc_umac_integration_table - integration operations
35  */
36 enum iwl_dhc_umac_integration_table {
37 	/**
38 	 * @DHC_INT_UMAC_TWT_OPERATION: trigger a TWT operation
39 	 */
40 	DHC_INT_UMAC_TWT_OPERATION = 4,
41 	/**
42 	 * @DHC_INTEGRATION_TLC_DEBUG_CONFIG: TLC debug
43 	 */
44 	DHC_INTEGRATION_TLC_DEBUG_CONFIG = 1,
45 	/**
46 	 * @DHC_INTEGRATION_MAX: Maximum UMAC integration table entries
47 	 */
48 	DHC_INTEGRATION_MAX
49 };
50 
51 #define DHC_TARGET_UMAC BIT(27)
52 
53 /**
54  * struct iwl_dhc_cmd - debug host command
55  * @length: length in DWs of the data structure that is concatenated to the end
56  *	of this struct
57  * @index_and_mask: bit 31 is 1 for data set operation else it's 0
58  *	bits 28-30 is the index of the table of the operation -
59  *	&enum iwl_dhc_table_id *
60  *	bit 27 is 0 if the cmd targeted to LMAC and 1 if targeted to UMAC,
61  *	(LMAC is 0 for backward compatibility)
62  *	bit 26 is 0 if the cmd targeted to LMAC0 and 1 if targeted to LMAC1,
63  *	relevant only if bit 27 set to 0
64  *	bits 0-25 is a specific entry index in the table specified in bits 28-30
65  *
66  * @data: the concatenated data.
67  */
68 struct iwl_dhc_cmd {
69 	__le32 length;
70 	__le32 index_and_mask;
71 #if defined(__linux__)
72 	__le32 data[];
73 #elif defined(__FreeBSD__)
74 	__le32 data[0];
75 #endif
76 } __packed; /* DHC_CMD_API_S */
77 
78 /**
79  * struct iwl_dhc_payload_hdr - DHC payload header
80  * @version: a version of a payload
81  * @reserved: reserved for alignment
82  */
83 struct iwl_dhc_payload_hdr {
84 	u8 version;
85 	u8 reserved[3];
86 } __packed; /* DHC_PAYLOAD_HDR_API_S_VER_1 */
87 
88 /**
89  * struct iwl_dhc_tas_status_per_radio - TAS status per radio
90  * @band: &PHY_BAND_5 for high band, PHY_BAND_24 for low band and
91  *	&PHY_BAND_6 for ultra high band.
92  * @static_status: TAS statically enabled or disabled
93  * @static_disable_reason: TAS static disable reason, uses
94  *	&enum iwl_tas_statically_disabled_reason
95  * @near_disconnection: is TAS currently near disconnection per radio
96  * @dynamic_status_ant_a: Antenna A current TAS status.
97  *	uses &enum iwl_tas_dyna_status
98  * @dynamic_status_ant_b: Antenna B current TAS status.
99  *	uses &enum iwl_tas_dyna_status
100  * @max_reg_pwr_limit_ant_a: Antenna A regulatory power limits in dBm
101  * @max_reg_pwr_limit_ant_b: Antenna B regulatory power limits in dBm
102  * @sar_limit_ant_a: Antenna A SAR limit per radio in dBm
103  * @sar_limit_ant_b: Antenna B SAR limit per radio in dBm
104  * @reserved: reserved for alignment
105  */
106 struct iwl_dhc_tas_status_per_radio {
107 	u8 band;
108 	u8 static_status;
109 	u8 static_disable_reason;
110 	u8 near_disconnection;
111 	u8 dynamic_status_ant_a;
112 	u8 dynamic_status_ant_b;
113 	__le16 max_reg_pwr_limit_ant_a;
114 	__le16 max_reg_pwr_limit_ant_b;
115 	__le16 sar_limit_ant_a;
116 	__le16 sar_limit_ant_b;
117 	u8 reserved[2];
118 } __packed; /* DHC_TAS_STATUS_PER_RADIO_S_VER_1 */
119 
120 /**
121  * struct iwl_dhc_tas_status_resp - Response to DHC_TOOLS_UMAC_GET_TAS_STATUS
122  * @header: DHC payload header, uses &struct iwl_dhc_payload_hdr
123  * @tas_config_info: see @struct bios_value_u32
124  * @mcc_block_list: block listed country codes
125  * @tas_status_radio: TAS status, uses &struct iwl_dhc_tas_status_per_radio
126  * @curr_mcc: current mcc
127  * @valid_radio_mask: represent entry in tas_status_per_radio is valid.
128  * @reserved: reserved for alignment
129  */
130 struct iwl_dhc_tas_status_resp {
131 	struct iwl_dhc_payload_hdr header;
132 	struct bios_value_u32 tas_config_info;
133 	__le16 mcc_block_list[IWL_WTAS_BLACK_LIST_MAX];
134 	struct iwl_dhc_tas_status_per_radio tas_status_radio[2];
135 	__le16 curr_mcc;
136 	u8 valid_radio_mask;
137 	u8 reserved;
138 } __packed; /* DHC_TAS_STATUS_RSP_API_S_VER_1 */
139 
140 /**
141  * struct iwl_dhc_cmd_resp_v1 - debug host command response
142  * @status: status of the command
143  * @data: the response data
144  */
145 struct iwl_dhc_cmd_resp_v1 {
146 	__le32 status;
147 	__le32 data[];
148 } __packed; /* DHC_RESP_API_S_VER_1 */
149 
150 /**
151  * struct iwl_dhc_cmd_resp - debug host command response
152  * @status: status of the command
153  * @descriptor: command descriptor (index_and_mask) returned
154  * @data: the response data
155  */
156 struct iwl_dhc_cmd_resp {
157 	__le32 status;
158 	__le32 descriptor;
159 	__le32 data[];
160 } __packed; /* DHC_RESP_API_S_VER_2 and DHC_RESP_API_S_VER_3 */
161 
162 /**
163  * enum iwl_dhc_twt_operation_type - describes the TWT operation type
164  *
165  * @DHC_TWT_REQUEST: Send a Request TWT command
166  * @DHC_TWT_SUGGEST: Send a Suggest TWT command
167  * @DHC_TWT_DEMAND: Send a Demand TWT command
168  * @DHC_TWT_GROUPING: Send a Grouping TWT command
169  * @DHC_TWT_ACCEPT: Send a Accept TWT command
170  * @DHC_TWT_ALTERNATE: Send a Alternate TWT command
171  * @DHC_TWT_DICTATE: Send a Dictate TWT command
172  * @DHC_TWT_REJECT: Send a Reject TWT command
173  * @DHC_TWT_TEARDOWN: Send a TearDown TWT command
174  */
175 enum iwl_dhc_twt_operation_type {
176 	DHC_TWT_REQUEST,
177 	DHC_TWT_SUGGEST,
178 	DHC_TWT_DEMAND,
179 	DHC_TWT_GROUPING,
180 	DHC_TWT_ACCEPT,
181 	DHC_TWT_ALTERNATE,
182 	DHC_TWT_DICTATE,
183 	DHC_TWT_REJECT,
184 	DHC_TWT_TEARDOWN,
185 }; /* DHC_TWT_OPERATION_TYPE_E */
186 
187 /**
188  * struct iwl_dhc_twt_operation - trigger a TWT operation
189  *
190  * @mac_id: the mac Id on which to trigger TWT operation
191  * @twt_operation: see &enum iwl_dhc_twt_operation_type
192  * @target_wake_time: when should we be on channel
193  * @interval_exp: the exponent for the interval
194  * @interval_mantissa: the mantissa for the interval
195  * @min_wake_duration: the minimum duration for the wake period
196  * @trigger: is the TWT triggered or not
197  * @flow_type: is the TWT announced or not
198  * @flow_id: the TWT flow identifier from 0 to 7
199  * @protection: is the TWT protected
200  * @ndo_paging_indicator: is ndo_paging_indicator set
201  * @responder_pm_mode: is responder_pm_mode set
202  * @negotiation_type: if the responder wants to doze outside the TWT SP
203  * @twt_request: 1 for TWT request, 0 otherwise
204  * @implicit: is TWT implicit
205  * @twt_group_assignment: the TWT group assignment
206  * @twt_channel: the TWT channel
207  * @reserved: reserved
208  */
209 struct iwl_dhc_twt_operation {
210 	__le32 mac_id;
211 	__le32 twt_operation;
212 	__le64 target_wake_time;
213 	__le32 interval_exp;
214 	__le32 interval_mantissa;
215 	__le32 min_wake_duration;
216 	u8 trigger;
217 	u8 flow_type;
218 	u8 flow_id;
219 	u8 protection;
220 	u8 ndo_paging_indicator;
221 	u8 responder_pm_mode;
222 	u8 negotiation_type;
223 	u8 twt_request;
224 	u8 implicit;
225 	u8 twt_group_assignment;
226 	u8 twt_channel;
227 	u8 reserved;
228 }; /* DHC_TWT_OPERATION_API_S */
229 
230 #endif /* __iwl_fw_api_dhc_h__ */
231