xref: /linux/drivers/net/wireless/intel/iwlwifi/fw/api/dhc.h (revision 1a9239bb4253f9076b5b4b2a1a4e8d7defd77a95)
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 	__le32 data[];
72 } __packed; /* DHC_CMD_API_S */
73 
74 /**
75  * struct iwl_dhc_payload_hdr - DHC payload header
76  * @version: a version of a payload
77  * @reserved: reserved for alignment
78  */
79 struct iwl_dhc_payload_hdr {
80 	u8 version;
81 	u8 reserved[3];
82 } __packed; /* DHC_PAYLOAD_HDR_API_S_VER_1 */
83 
84 /**
85  * struct iwl_dhc_tas_status_per_radio - TAS status per radio
86  * @band: &PHY_BAND_5 for high band, PHY_BAND_24 for low band and
87  *	&PHY_BAND_6 for ultra high band.
88  * @static_status: TAS statically enabled or disabled
89  * @static_disable_reason: TAS static disable reason, uses
90  *	&enum iwl_tas_statically_disabled_reason
91  * @near_disconnection: is TAS currently near disconnection per radio
92  * @dynamic_status_ant_a: Antenna A current TAS status.
93  *	uses &enum iwl_tas_dyna_status
94  * @dynamic_status_ant_b: Antenna B current TAS status.
95  *	uses &enum iwl_tas_dyna_status
96  * @max_reg_pwr_limit_ant_a: Antenna A regulatory power limits in dBm
97  * @max_reg_pwr_limit_ant_b: Antenna B regulatory power limits in dBm
98  * @sar_limit_ant_a: Antenna A SAR limit per radio in dBm
99  * @sar_limit_ant_b: Antenna B SAR limit per radio in dBm
100  * @reserved: reserved for alignment
101  */
102 struct iwl_dhc_tas_status_per_radio {
103 	u8 band;
104 	u8 static_status;
105 	u8 static_disable_reason;
106 	u8 near_disconnection;
107 	u8 dynamic_status_ant_a;
108 	u8 dynamic_status_ant_b;
109 	__le16 max_reg_pwr_limit_ant_a;
110 	__le16 max_reg_pwr_limit_ant_b;
111 	__le16 sar_limit_ant_a;
112 	__le16 sar_limit_ant_b;
113 	u8 reserved[2];
114 } __packed; /* DHC_TAS_STATUS_PER_RADIO_S_VER_1 */
115 
116 /**
117  * struct iwl_dhc_tas_status_resp - Response to DHC_TOOLS_UMAC_GET_TAS_STATUS
118  * @header: DHC payload header, uses &struct iwl_dhc_payload_hdr
119  * @tas_config_info: see @struct bios_value_u32
120  * @mcc_block_list: block listed country codes
121  * @tas_status_radio: TAS status, uses &struct iwl_dhc_tas_status_per_radio
122  * @curr_mcc: current mcc
123  * @valid_radio_mask: represent entry in tas_status_per_radio is valid.
124  * @reserved: reserved for alignment
125  */
126 struct iwl_dhc_tas_status_resp {
127 	struct iwl_dhc_payload_hdr header;
128 	struct bios_value_u32 tas_config_info;
129 	__le16 mcc_block_list[IWL_WTAS_BLACK_LIST_MAX];
130 	struct iwl_dhc_tas_status_per_radio tas_status_radio[2];
131 	__le16 curr_mcc;
132 	u8 valid_radio_mask;
133 	u8 reserved;
134 } __packed; /* DHC_TAS_STATUS_RSP_API_S_VER_1 */
135 
136 /**
137  * struct iwl_dhc_cmd_resp_v1 - debug host command response
138  * @status: status of the command
139  * @data: the response data
140  */
141 struct iwl_dhc_cmd_resp_v1 {
142 	__le32 status;
143 	__le32 data[];
144 } __packed; /* DHC_RESP_API_S_VER_1 */
145 
146 /**
147  * struct iwl_dhc_cmd_resp - debug host command response
148  * @status: status of the command
149  * @descriptor: command descriptor (index_and_mask) returned
150  * @data: the response data
151  */
152 struct iwl_dhc_cmd_resp {
153 	__le32 status;
154 	__le32 descriptor;
155 	__le32 data[];
156 } __packed; /* DHC_RESP_API_S_VER_2 and DHC_RESP_API_S_VER_3 */
157 
158 /**
159  * enum iwl_dhc_twt_operation_type - describes the TWT operation type
160  *
161  * @DHC_TWT_REQUEST: Send a Request TWT command
162  * @DHC_TWT_SUGGEST: Send a Suggest TWT command
163  * @DHC_TWT_DEMAND: Send a Demand TWT command
164  * @DHC_TWT_GROUPING: Send a Grouping TWT command
165  * @DHC_TWT_ACCEPT: Send a Accept TWT command
166  * @DHC_TWT_ALTERNATE: Send a Alternate TWT command
167  * @DHC_TWT_DICTATE: Send a Dictate TWT command
168  * @DHC_TWT_REJECT: Send a Reject TWT command
169  * @DHC_TWT_TEARDOWN: Send a TearDown TWT command
170  */
171 enum iwl_dhc_twt_operation_type {
172 	DHC_TWT_REQUEST,
173 	DHC_TWT_SUGGEST,
174 	DHC_TWT_DEMAND,
175 	DHC_TWT_GROUPING,
176 	DHC_TWT_ACCEPT,
177 	DHC_TWT_ALTERNATE,
178 	DHC_TWT_DICTATE,
179 	DHC_TWT_REJECT,
180 	DHC_TWT_TEARDOWN,
181 }; /* DHC_TWT_OPERATION_TYPE_E */
182 
183 /**
184  * struct iwl_dhc_twt_operation - trigger a TWT operation
185  *
186  * @mac_id: the mac Id on which to trigger TWT operation
187  * @twt_operation: see &enum iwl_dhc_twt_operation_type
188  * @target_wake_time: when should we be on channel
189  * @interval_exp: the exponent for the interval
190  * @interval_mantissa: the mantissa for the interval
191  * @min_wake_duration: the minimum duration for the wake period
192  * @trigger: is the TWT triggered or not
193  * @flow_type: is the TWT announced or not
194  * @flow_id: the TWT flow identifier from 0 to 7
195  * @protection: is the TWT protected
196  * @ndo_paging_indicator: is ndo_paging_indicator set
197  * @responder_pm_mode: is responder_pm_mode set
198  * @negotiation_type: if the responder wants to doze outside the TWT SP
199  * @twt_request: 1 for TWT request, 0 otherwise
200  * @implicit: is TWT implicit
201  * @twt_group_assignment: the TWT group assignment
202  * @twt_channel: the TWT channel
203  * @reserved: reserved
204  */
205 struct iwl_dhc_twt_operation {
206 	__le32 mac_id;
207 	__le32 twt_operation;
208 	__le64 target_wake_time;
209 	__le32 interval_exp;
210 	__le32 interval_mantissa;
211 	__le32 min_wake_duration;
212 	u8 trigger;
213 	u8 flow_type;
214 	u8 flow_id;
215 	u8 protection;
216 	u8 ndo_paging_indicator;
217 	u8 responder_pm_mode;
218 	u8 negotiation_type;
219 	u8 twt_request;
220 	u8 implicit;
221 	u8 twt_group_assignment;
222 	u8 twt_channel;
223 	u8 reserved;
224 }; /* DHC_TWT_OPERATION_API_S */
225 
226 #endif /* __iwl_fw_api_dhc_h__ */
227