Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/sys/contrib/dev/iwlwifi/fw/acpi.h
48285 views
1
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2
/*
3
* Copyright (C) 2017 Intel Deutschland GmbH
4
* Copyright (C) 2018-2023, 2025 Intel Corporation
5
*/
6
#ifndef __iwl_fw_acpi__
7
#define __iwl_fw_acpi__
8
9
#include <linux/acpi.h>
10
#include "fw/regulatory.h"
11
#include "fw/api/commands.h"
12
#include "fw/api/power.h"
13
#include "fw/api/phy.h"
14
#include "fw/api/nvm-reg.h"
15
#include "fw/api/config.h"
16
#include "fw/img.h"
17
#include "iwl-trans.h"
18
19
20
#define ACPI_WRDS_METHOD "WRDS"
21
#define ACPI_EWRD_METHOD "EWRD"
22
#define ACPI_WGDS_METHOD "WGDS"
23
#define ACPI_WRDD_METHOD "WRDD"
24
#define ACPI_SPLC_METHOD "SPLC"
25
#define ACPI_ECKV_METHOD "ECKV"
26
#define ACPI_PPAG_METHOD "PPAG"
27
#define ACPI_WTAS_METHOD "WTAS"
28
#define ACPI_WPFC_METHOD "WPFC"
29
#define ACPI_GLAI_METHOD "GLAI"
30
#define ACPI_WBEM_METHOD "WBEM"
31
#define ACPI_DSBR_METHOD "DSBR"
32
33
#define ACPI_WIFI_DOMAIN (0x07)
34
35
#define ACPI_SAR_PROFILE_NUM 4
36
37
#define ACPI_NUM_GEO_PROFILES 3
38
#define ACPI_NUM_GEO_PROFILES_REV3 8
39
#define ACPI_GEO_PER_CHAIN_SIZE 3
40
41
#define ACPI_SAR_NUM_CHAINS_REV0 2
42
#define ACPI_SAR_NUM_CHAINS_REV1 2
43
#define ACPI_SAR_NUM_CHAINS_REV2 4
44
#define ACPI_SAR_NUM_SUB_BANDS_REV0 5
45
#define ACPI_SAR_NUM_SUB_BANDS_REV1 11
46
#define ACPI_SAR_NUM_SUB_BANDS_REV2 11
47
48
#define ACPI_WRDS_WIFI_DATA_SIZE_REV0 (ACPI_SAR_NUM_CHAINS_REV0 * \
49
ACPI_SAR_NUM_SUB_BANDS_REV0 + 2)
50
#define ACPI_WRDS_WIFI_DATA_SIZE_REV1 (ACPI_SAR_NUM_CHAINS_REV1 * \
51
ACPI_SAR_NUM_SUB_BANDS_REV1 + 2)
52
#define ACPI_WRDS_WIFI_DATA_SIZE_REV2 (ACPI_SAR_NUM_CHAINS_REV2 * \
53
ACPI_SAR_NUM_SUB_BANDS_REV2 + 2)
54
#define ACPI_EWRD_WIFI_DATA_SIZE_REV0 ((ACPI_SAR_PROFILE_NUM - 1) * \
55
ACPI_SAR_NUM_CHAINS_REV0 * \
56
ACPI_SAR_NUM_SUB_BANDS_REV0 + 3)
57
#define ACPI_EWRD_WIFI_DATA_SIZE_REV1 ((ACPI_SAR_PROFILE_NUM - 1) * \
58
ACPI_SAR_NUM_CHAINS_REV1 * \
59
ACPI_SAR_NUM_SUB_BANDS_REV1 + 3)
60
#define ACPI_EWRD_WIFI_DATA_SIZE_REV2 ((ACPI_SAR_PROFILE_NUM - 1) * \
61
ACPI_SAR_NUM_CHAINS_REV2 * \
62
ACPI_SAR_NUM_SUB_BANDS_REV2 + 3)
63
#define ACPI_WPFC_WIFI_DATA_SIZE 5 /* domain and 4 filter config words */
64
65
/* revision 0 and 1 are identical, except for the semantics in the FW */
66
#define ACPI_GEO_NUM_BANDS_REV0 2
67
#define ACPI_GEO_NUM_BANDS_REV2 3
68
69
#define ACPI_WRDD_WIFI_DATA_SIZE 2
70
#define ACPI_SPLC_WIFI_DATA_SIZE 2
71
#define ACPI_ECKV_WIFI_DATA_SIZE 2
72
73
/*
74
* One element for domain type,
75
* and one for enablement of Wi-Fi 320MHz per MCC
76
*/
77
#define ACPI_WBEM_WIFI_DATA_SIZE 2
78
/*
79
* One element for domain type,
80
* and one for DSBR response data
81
*/
82
#define ACPI_DSBR_WIFI_DATA_SIZE 2
83
#define ACPI_DSBR_WIFI_DATA_REV 1
84
85
/*
86
* One element for domain type,
87
* and one for the status
88
*/
89
#define ACPI_GLAI_WIFI_DATA_SIZE 2
90
#define ACPI_GLAI_MAX_STATUS 2
91
/*
92
* TAS size: 1 elelment for type,
93
* 1 element for enabled field,
94
* 1 element for block list size,
95
* 16 elements for block list array
96
*/
97
#define ACPI_WTAS_WIFI_DATA_SIZE (3 + IWL_WTAS_BLACK_LIST_MAX)
98
99
#define ACPI_PPAG_WIFI_DATA_SIZE_V1 ((IWL_NUM_CHAIN_LIMITS * \
100
IWL_NUM_SUB_BANDS_V1) + 2)
101
#define ACPI_PPAG_WIFI_DATA_SIZE_V2 ((IWL_NUM_CHAIN_LIMITS * \
102
IWL_NUM_SUB_BANDS_V2) + 2)
103
104
#define IWL_SAR_ENABLE_MSK BIT(0)
105
#define IWL_REDUCE_POWER_FLAGS_POS 1
106
107
/* The Inidcator whether UEFI WIFI GUID tables are locked is read from ACPI */
108
#define UEFI_WIFI_GUID_UNLOCKED 0
109
110
#define ACPI_DSM_REV 0
111
112
#define DSM_INTERNAL_FUNC_GET_PLAT_INFO 1
113
/* TBD: VPRO is BIT(0) in the result, but what's the result? */
114
115
#define DSM_INTERNAL_FUNC_PRODUCT_RESET 2
116
117
/* DSM_INTERNAL_FUNC_PRODUCT_RESET - product reset (aka "PLDR") */
118
enum iwl_dsm_internal_product_reset_cmds {
119
DSM_INTERNAL_PLDR_CMD_GET_MODE = 1,
120
DSM_INTERNAL_PLDR_CMD_SET_MODE = 2,
121
DSM_INTERNAL_PLDR_CMD_GET_STATUS = 3,
122
};
123
124
enum iwl_dsm_internal_product_reset_mode {
125
DSM_INTERNAL_PLDR_MODE_EN_PROD_RESET = BIT(0),
126
DSM_INTERNAL_PLDR_MODE_EN_WIFI_FLR = BIT(1),
127
DSM_INTERNAL_PLDR_MODE_EN_BT_OFF_ON = BIT(2),
128
};
129
130
struct iwl_dsm_internal_product_reset_cmd {
131
/* cmd is from enum iwl_dsm_internal_product_reset_cmds */
132
u16 cmd;
133
u16 value;
134
} __packed;
135
136
#define IWL_ACPI_WBEM_REV0_MASK (BIT(0) | BIT(1))
137
#define IWL_ACPI_WBEM_REVISION 0
138
139
#ifdef CONFIG_ACPI
140
141
struct iwl_fw_runtime;
142
143
extern const guid_t iwl_guid;
144
145
union acpi_object *iwl_acpi_get_dsm_object(struct device *dev, int rev,
146
int func, union acpi_object *args,
147
const guid_t *guid);
148
149
/**
150
* iwl_acpi_get_mcc - read MCC from ACPI, if available
151
*
152
* @fwrt: the fw runtime struct
153
* @mcc: output buffer (3 bytes) that will get the MCC
154
*
155
* This function tries to read the current MCC from ACPI if available.
156
*/
157
int iwl_acpi_get_mcc(struct iwl_fw_runtime *fwrt, char *mcc);
158
159
int iwl_acpi_get_pwr_limit(struct iwl_fw_runtime *fwrt, u64 *dflt_pwr_limit);
160
161
/*
162
* iwl_acpi_get_eckv - read external clock validation from ACPI, if available
163
*
164
* @fwrt: the fw runtime struct
165
* @extl_clk: output var (2 bytes) that will get the clk indication.
166
*
167
* This function tries to read the external clock indication
168
* from ACPI if available.
169
*/
170
int iwl_acpi_get_eckv(struct iwl_fw_runtime *fwrt, u32 *extl_clk);
171
172
int iwl_acpi_get_wrds_table(struct iwl_fw_runtime *fwrt);
173
174
int iwl_acpi_get_ewrd_table(struct iwl_fw_runtime *fwrt);
175
176
int iwl_acpi_get_wgds_table(struct iwl_fw_runtime *fwrt);
177
178
int iwl_acpi_get_tas_table(struct iwl_fw_runtime *fwrt,
179
struct iwl_tas_data *data);
180
181
int iwl_acpi_get_ppag_table(struct iwl_fw_runtime *fwrt);
182
183
int iwl_acpi_get_phy_filters(struct iwl_fw_runtime *fwrt);
184
185
void iwl_acpi_get_guid_lock_status(struct iwl_fw_runtime *fwrt);
186
187
int iwl_acpi_get_dsm(struct iwl_fw_runtime *fwrt,
188
enum iwl_dsm_funcs func, u32 *value);
189
190
int iwl_acpi_get_wbem(struct iwl_fw_runtime *fwrt, u32 *value);
191
192
int iwl_acpi_get_dsbr(struct iwl_fw_runtime *fwrt, u32 *value);
193
194
#else /* CONFIG_ACPI */
195
196
static inline union acpi_object *
197
iwl_acpi_get_dsm_object(struct device *dev, int rev, int func,
198
union acpi_object *args, const guid_t *guid)
199
{
200
return ERR_PTR(-ENOENT);
201
}
202
203
static inline int iwl_acpi_get_mcc(struct iwl_fw_runtime *fwrt, char *mcc)
204
{
205
return -ENOENT;
206
}
207
208
static inline int iwl_acpi_get_pwr_limit(struct iwl_fw_runtime *fwrt,
209
u64 *dflt_pwr_limit)
210
{
211
*dflt_pwr_limit = 0;
212
return 0;
213
}
214
215
static inline int iwl_acpi_get_eckv(struct iwl_fw_runtime *fwrt, u32 *extl_clk)
216
{
217
return -ENOENT;
218
}
219
220
static inline int iwl_acpi_get_wrds_table(struct iwl_fw_runtime *fwrt)
221
{
222
return -ENOENT;
223
}
224
225
static inline int iwl_acpi_get_ewrd_table(struct iwl_fw_runtime *fwrt)
226
{
227
return -ENOENT;
228
}
229
230
static inline int iwl_acpi_get_wgds_table(struct iwl_fw_runtime *fwrt)
231
{
232
return 1;
233
}
234
235
static inline int iwl_acpi_get_tas_table(struct iwl_fw_runtime *fwrt,
236
struct iwl_tas_data *data)
237
{
238
return -ENOENT;
239
}
240
241
static inline int iwl_acpi_get_ppag_table(struct iwl_fw_runtime *fwrt)
242
{
243
return -ENOENT;
244
}
245
246
static inline int iwl_acpi_get_phy_filters(struct iwl_fw_runtime *fwrt)
247
{
248
return -ENOENT;
249
}
250
251
static inline void iwl_acpi_get_guid_lock_status(struct iwl_fw_runtime *fwrt)
252
{
253
}
254
255
static inline int iwl_acpi_get_dsm(struct iwl_fw_runtime *fwrt,
256
enum iwl_dsm_funcs func, u32 *value)
257
{
258
return -ENOENT;
259
}
260
261
static inline int iwl_acpi_get_wbem(struct iwl_fw_runtime *fwrt, u32 *value)
262
{
263
return -ENOENT;
264
}
265
266
static inline int iwl_acpi_get_dsbr(struct iwl_fw_runtime *fwrt, u32 *value)
267
{
268
return -ENOENT;
269
}
270
#endif /* CONFIG_ACPI */
271
272
#endif /* __iwl_fw_acpi__ */
273
274