xref: /linux/drivers/net/wireless/realtek/rtw89/acpi.h (revision f17c69649c698e4df3cfe0010b7bbf142dec3e40)
1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /* Copyright(c) 2021-2023  Realtek Corporation
3  */
4 
5 #ifndef __RTW89_ACPI_H__
6 #define __RTW89_ACPI_H__
7 
8 #include "core.h"
9 
10 enum rtw89_acpi_dsm_func {
11 	RTW89_ACPI_DSM_FUNC_IDN_BAND_SUP = 2,
12 	RTW89_ACPI_DSM_FUNC_6G_DIS = 3,
13 	RTW89_ACPI_DSM_FUNC_6G_BP = 4,
14 	RTW89_ACPI_DSM_FUNC_TAS_EN = 5,
15 	RTW89_ACPI_DSM_FUNC_59G_EN = 6,
16 };
17 
18 enum rtw89_acpi_policy_mode {
19 	RTW89_ACPI_POLICY_BLOCK = 0,
20 	RTW89_ACPI_POLICY_ALLOW = 1,
21 };
22 
23 struct rtw89_acpi_country_code {
24 	/* below are allowed:
25 	 * * ISO alpha2 country code
26 	 * * EU for countries in Europe
27 	 */
28 	char alpha2[2];
29 } __packed;
30 
31 struct rtw89_acpi_policy_6ghz {
32 	u8 signature[3];
33 	u8 rsvd;
34 	u8 policy_mode;
35 	u8 country_count;
36 	struct rtw89_acpi_country_code country_list[] __counted_by(country_count);
37 } __packed;
38 
39 struct rtw89_acpi_dsm_result {
40 	union {
41 		u8 value;
42 		/* caller needs to free it after using */
43 		struct rtw89_acpi_policy_6ghz *policy_6ghz;
44 	} u;
45 };
46 
47 int rtw89_acpi_evaluate_dsm(struct rtw89_dev *rtwdev,
48 			    enum rtw89_acpi_dsm_func func,
49 			    struct rtw89_acpi_dsm_result *res);
50 
51 #endif
52