1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
3 * Copyright (C) 2017 Intel Deutschland GmbH
4 * Copyright (C) 2019-2023 Intel Corporation
6 #include <linux/uuid.h>
10 #include "fw/runtime.h"
12 const guid_t iwl_guid = GUID_INIT(0xF21202BF, 0x8F78, 0x4DC6,
13 0xA5, 0xB3, 0x1F, 0x73,
14 0x8E, 0x28, 0x5A, 0xDE);
16 static const size_t acpi_dsm_size[DSM_FUNC_NUM_FUNCS] = {
17 [DSM_FUNC_QUERY] = sizeof(u32),
18 [DSM_FUNC_DISABLE_SRD] = sizeof(u8),
19 [DSM_FUNC_ENABLE_INDONESIA_5G2] = sizeof(u8),
20 [DSM_FUNC_ENABLE_6E] = sizeof(u32),
21 [DSM_FUNC_REGULATORY_CONFIG] = sizeof(u32),
22 /* Not supported in driver */
24 [DSM_FUNC_11AX_ENABLEMENT] = sizeof(u32),
25 [DSM_FUNC_ENABLE_UNII4_CHAN] = sizeof(u32),
26 [DSM_FUNC_ACTIVATE_CHANNEL] = sizeof(u32),
27 [DSM_FUNC_FORCE_DISABLE_CHANNELS] = sizeof(u32),
28 [DSM_FUNC_ENERGY_DETECTION_THRESHOLD] = sizeof(u32),
29 [DSM_FUNC_RFI_CONFIG] = sizeof(u32),
32 static int iwl_acpi_get_handle(struct device *dev, acpi_string method,
33 acpi_handle *ret_handle)
35 acpi_handle root_handle;
38 root_handle = ACPI_HANDLE(dev);
40 IWL_DEBUG_DEV_RADIO(dev,
41 "ACPI: Could not retrieve root port handle\n");
45 status = acpi_get_handle(root_handle, method, ret_handle);
46 if (ACPI_FAILURE(status)) {
47 IWL_DEBUG_DEV_RADIO(dev,
48 "ACPI: %s method not found\n", method);
54 static void *iwl_acpi_get_object(struct device *dev, acpi_string method)
56 struct acpi_buffer buf = {ACPI_ALLOCATE_BUFFER, NULL};
61 ret = iwl_acpi_get_handle(dev, method, &handle);
63 return ERR_PTR(-ENOENT);
65 /* Call the method with no arguments */
66 status = acpi_evaluate_object(handle, NULL, NULL, &buf);
67 if (ACPI_FAILURE(status)) {
68 IWL_DEBUG_DEV_RADIO(dev,
69 "ACPI: %s method invocation failed (status: 0x%x)\n",
71 return ERR_PTR(-ENOENT);
77 * Generic function for evaluating a method defined in the device specific
78 * method (DSM) interface. The returned acpi object must be freed by calling
81 static void *iwl_acpi_get_dsm_object(struct device *dev, int rev, int func,
82 union acpi_object *args,
85 union acpi_object *obj;
87 obj = acpi_evaluate_dsm(ACPI_HANDLE(dev), guid, rev, func,
90 IWL_DEBUG_DEV_RADIO(dev,
91 "ACPI: DSM method invocation failed (rev: %d, func:%d)\n",
93 return ERR_PTR(-ENOENT);
99 * Generic function to evaluate a DSM with no arguments
100 * and an integer return value,
101 * (as an integer object or inside a buffer object),
102 * verify and assign the value in the "value" parameter.
103 * return 0 in success and the appropriate errno otherwise.
105 static int iwl_acpi_get_dsm_integer(struct device *dev, int rev, int func,
106 const guid_t *guid, u64 *value,
107 size_t expected_size)
109 union acpi_object *obj;
112 obj = iwl_acpi_get_dsm_object(dev, rev, func, NULL, guid);
114 IWL_DEBUG_DEV_RADIO(dev,
115 "Failed to get DSM object. func= %d\n",
120 if (obj->type == ACPI_TYPE_INTEGER) {
121 *value = obj->integer.value;
122 } else if (obj->type == ACPI_TYPE_BUFFER) {
125 if (WARN_ON_ONCE(expected_size > sizeof(le_value)))
128 /* if the buffer size doesn't match the expected size */
129 if (obj->buffer.length != expected_size)
130 IWL_DEBUG_DEV_RADIO(dev,
131 "ACPI: DSM invalid buffer size, padding or truncating (%d)\n",
134 /* assuming LE from Intel BIOS spec */
135 memcpy(&le_value, obj->buffer.pointer,
136 min_t(size_t, expected_size, (size_t)obj->buffer.length));
137 *value = le64_to_cpu(le_value);
139 IWL_DEBUG_DEV_RADIO(dev,
140 "ACPI: DSM method did not return a valid object, type=%d\n",
146 IWL_DEBUG_DEV_RADIO(dev,
147 "ACPI: DSM method evaluated: func=%d, ret=%d\n",
155 * This function receives a DSM function number, calculates its expected size
156 * according to Intel BIOS spec, and fills in the value in a 32-bit field.
157 * In case the expected size is smaller than 32-bit, padding will be added.
159 int iwl_acpi_get_dsm(struct iwl_fw_runtime *fwrt,
160 enum iwl_dsm_funcs func, u32 *value)
162 size_t expected_size;
166 BUILD_BUG_ON(ARRAY_SIZE(acpi_dsm_size) != DSM_FUNC_NUM_FUNCS);
168 if (WARN_ON(func >= ARRAY_SIZE(acpi_dsm_size)))
171 expected_size = acpi_dsm_size[func];
173 /* Currently all ACPI DSMs are either 8-bit or 32-bit */
174 if (expected_size != sizeof(u8) && expected_size != sizeof(u32))
177 ret = iwl_acpi_get_dsm_integer(fwrt->dev, ACPI_DSM_REV, func,
178 &iwl_guid, &tmp, expected_size);
182 if ((expected_size == sizeof(u8) && tmp != (u8)tmp) ||
183 (expected_size == sizeof(u32) && tmp != (u32)tmp))
184 IWL_DEBUG_RADIO(fwrt,
185 "DSM value overflows the expected size, truncating\n");
191 static union acpi_object *
192 iwl_acpi_get_wifi_pkg_range(struct device *dev,
193 union acpi_object *data,
199 union acpi_object *wifi_pkg;
202 * We need at least one entry in the wifi package that
203 * describes the domain, and one more entry, otherwise there's
204 * no point in reading it.
206 if (WARN_ON_ONCE(min_data_size < 2 || min_data_size > max_data_size))
207 return ERR_PTR(-EINVAL);
210 * We need at least two packages, one for the revision and one
211 * for the data itself. Also check that the revision is valid
212 * (i.e. it is an integer (each caller has to check by itself
213 * if the returned revision is supported)).
215 if (data->type != ACPI_TYPE_PACKAGE ||
216 data->package.count < 2 ||
217 data->package.elements[0].type != ACPI_TYPE_INTEGER) {
218 IWL_DEBUG_DEV_RADIO(dev, "Invalid packages structure\n");
219 return ERR_PTR(-EINVAL);
222 *tbl_rev = data->package.elements[0].integer.value;
224 /* loop through all the packages to find the one for WiFi */
225 for (i = 1; i < data->package.count; i++) {
226 union acpi_object *domain;
228 wifi_pkg = &data->package.elements[i];
230 /* skip entries that are not a package with the right size */
231 if (wifi_pkg->type != ACPI_TYPE_PACKAGE ||
232 wifi_pkg->package.count < min_data_size ||
233 wifi_pkg->package.count > max_data_size)
236 domain = &wifi_pkg->package.elements[0];
237 if (domain->type == ACPI_TYPE_INTEGER &&
238 domain->integer.value == ACPI_WIFI_DOMAIN)
242 return ERR_PTR(-ENOENT);
248 static union acpi_object *
249 iwl_acpi_get_wifi_pkg(struct device *dev,
250 union acpi_object *data,
251 int data_size, int *tbl_rev)
253 return iwl_acpi_get_wifi_pkg_range(dev, data, data_size, data_size,
257 int iwl_acpi_get_tas_table(struct iwl_fw_runtime *fwrt,
258 struct iwl_tas_data *tas_data)
260 union acpi_object *wifi_pkg, *data;
261 int ret, tbl_rev, i, block_list_size, enabled;
263 data = iwl_acpi_get_object(fwrt->dev, ACPI_WTAS_METHOD);
265 return PTR_ERR(data);
267 /* try to read wtas table revision 1 or revision 0*/
268 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data,
269 ACPI_WTAS_WIFI_DATA_SIZE,
271 if (IS_ERR(wifi_pkg)) {
272 ret = PTR_ERR(wifi_pkg);
276 if (tbl_rev == 1 && wifi_pkg->package.elements[1].type ==
279 (u32)wifi_pkg->package.elements[1].integer.value;
281 enabled = iwl_parse_tas_selection(fwrt, tas_data,
284 } else if (tbl_rev == 0 &&
285 wifi_pkg->package.elements[1].type == ACPI_TYPE_INTEGER) {
286 enabled = !!wifi_pkg->package.elements[1].integer.value;
293 IWL_DEBUG_RADIO(fwrt, "TAS not enabled\n");
298 IWL_DEBUG_RADIO(fwrt, "Reading TAS table revision %d\n", tbl_rev);
299 if (wifi_pkg->package.elements[2].type != ACPI_TYPE_INTEGER ||
300 wifi_pkg->package.elements[2].integer.value >
301 IWL_WTAS_BLACK_LIST_MAX) {
302 IWL_DEBUG_RADIO(fwrt, "TAS invalid array size %llu\n",
303 wifi_pkg->package.elements[2].integer.value);
307 block_list_size = wifi_pkg->package.elements[2].integer.value;
308 tas_data->block_list_size = cpu_to_le32(block_list_size);
310 IWL_DEBUG_RADIO(fwrt, "TAS array size %u\n", block_list_size);
312 for (i = 0; i < block_list_size; i++) {
315 if (wifi_pkg->package.elements[3 + i].type !=
317 IWL_DEBUG_RADIO(fwrt,
318 "TAS invalid array elem %d\n", 3 + i);
323 country = wifi_pkg->package.elements[3 + i].integer.value;
324 tas_data->block_list_array[i] = cpu_to_le32(country);
325 IWL_DEBUG_RADIO(fwrt, "TAS block list country %d\n", country);
334 int iwl_acpi_get_mcc(struct iwl_fw_runtime *fwrt, char *mcc)
336 union acpi_object *wifi_pkg, *data;
340 data = iwl_acpi_get_object(fwrt->dev, ACPI_WRDD_METHOD);
342 return PTR_ERR(data);
344 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data,
345 ACPI_WRDD_WIFI_DATA_SIZE,
347 if (IS_ERR(wifi_pkg)) {
348 ret = PTR_ERR(wifi_pkg);
352 if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER ||
358 mcc_val = wifi_pkg->package.elements[1].integer.value;
360 mcc[0] = (mcc_val >> 8) & 0xff;
361 mcc[1] = mcc_val & 0xff;
370 int iwl_acpi_get_pwr_limit(struct iwl_fw_runtime *fwrt, u64 *dflt_pwr_limit)
372 union acpi_object *data, *wifi_pkg;
373 int tbl_rev, ret = -EINVAL;
376 data = iwl_acpi_get_object(fwrt->dev, ACPI_SPLC_METHOD);
380 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data,
381 ACPI_SPLC_WIFI_DATA_SIZE, &tbl_rev);
382 if (IS_ERR(wifi_pkg) || tbl_rev != 0 ||
383 wifi_pkg->package.elements[1].integer.value != ACPI_TYPE_INTEGER)
386 *dflt_pwr_limit = wifi_pkg->package.elements[1].integer.value;
394 int iwl_acpi_get_eckv(struct iwl_fw_runtime *fwrt, u32 *extl_clk)
396 union acpi_object *wifi_pkg, *data;
399 data = iwl_acpi_get_object(fwrt->dev, ACPI_ECKV_METHOD);
401 return PTR_ERR(data);
403 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data,
404 ACPI_ECKV_WIFI_DATA_SIZE,
406 if (IS_ERR(wifi_pkg)) {
407 ret = PTR_ERR(wifi_pkg);
411 if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER ||
417 *extl_clk = wifi_pkg->package.elements[1].integer.value;
426 static int iwl_acpi_sar_set_profile(union acpi_object *table,
427 struct iwl_sar_profile *profile,
428 bool enabled, u8 num_chains,
434 * The table from ACPI is flat, but we store it in a
437 for (i = 0; i < BIOS_SAR_MAX_CHAINS_PER_PROFILE; i++) {
438 for (j = 0; j < BIOS_SAR_MAX_SUB_BANDS_NUM; j++) {
439 /* if we don't have the values, use the default */
440 if (i >= num_chains || j >= num_sub_bands) {
441 profile->chains[i].subbands[j] = 0;
443 if (table[idx].type != ACPI_TYPE_INTEGER ||
444 table[idx].integer.value > U8_MAX)
447 profile->chains[i].subbands[j] =
448 table[idx].integer.value;
455 /* Only if all values were valid can the profile be enabled */
456 profile->enabled = enabled;
461 int iwl_acpi_get_wrds_table(struct iwl_fw_runtime *fwrt)
463 union acpi_object *wifi_pkg, *table, *data;
466 u8 num_chains, num_sub_bands;
468 data = iwl_acpi_get_object(fwrt->dev, ACPI_WRDS_METHOD);
470 return PTR_ERR(data);
472 /* start by trying to read revision 2 */
473 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data,
474 ACPI_WRDS_WIFI_DATA_SIZE_REV2,
476 if (!IS_ERR(wifi_pkg)) {
482 num_chains = ACPI_SAR_NUM_CHAINS_REV2;
483 num_sub_bands = ACPI_SAR_NUM_SUB_BANDS_REV2;
488 /* then try revision 1 */
489 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data,
490 ACPI_WRDS_WIFI_DATA_SIZE_REV1,
492 if (!IS_ERR(wifi_pkg)) {
498 num_chains = ACPI_SAR_NUM_CHAINS_REV1;
499 num_sub_bands = ACPI_SAR_NUM_SUB_BANDS_REV1;
504 /* then finally revision 0 */
505 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data,
506 ACPI_WRDS_WIFI_DATA_SIZE_REV0,
508 if (!IS_ERR(wifi_pkg)) {
514 num_chains = ACPI_SAR_NUM_CHAINS_REV0;
515 num_sub_bands = ACPI_SAR_NUM_SUB_BANDS_REV0;
520 ret = PTR_ERR(wifi_pkg);
524 if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) {
529 IWL_DEBUG_RADIO(fwrt, "Reading WRDS tbl_rev=%d\n", tbl_rev);
531 flags = wifi_pkg->package.elements[1].integer.value;
532 fwrt->reduced_power_flags = flags >> IWL_REDUCE_POWER_FLAGS_POS;
534 /* position of the actual table */
535 table = &wifi_pkg->package.elements[2];
537 /* The profile from WRDS is officially profile 1, but goes
538 * into sar_profiles[0] (because we don't have a profile 0).
540 ret = iwl_acpi_sar_set_profile(table, &fwrt->sar_profiles[0],
541 flags & IWL_SAR_ENABLE_MSK,
542 num_chains, num_sub_bands);
548 int iwl_acpi_get_ewrd_table(struct iwl_fw_runtime *fwrt)
550 union acpi_object *wifi_pkg, *data;
552 int i, n_profiles, tbl_rev, pos;
554 u8 num_chains, num_sub_bands;
556 data = iwl_acpi_get_object(fwrt->dev, ACPI_EWRD_METHOD);
558 return PTR_ERR(data);
560 /* start by trying to read revision 2 */
561 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data,
562 ACPI_EWRD_WIFI_DATA_SIZE_REV2,
564 if (!IS_ERR(wifi_pkg)) {
570 num_chains = ACPI_SAR_NUM_CHAINS_REV2;
571 num_sub_bands = ACPI_SAR_NUM_SUB_BANDS_REV2;
576 /* then try revision 1 */
577 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data,
578 ACPI_EWRD_WIFI_DATA_SIZE_REV1,
580 if (!IS_ERR(wifi_pkg)) {
586 num_chains = ACPI_SAR_NUM_CHAINS_REV1;
587 num_sub_bands = ACPI_SAR_NUM_SUB_BANDS_REV1;
592 /* then finally revision 0 */
593 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data,
594 ACPI_EWRD_WIFI_DATA_SIZE_REV0,
596 if (!IS_ERR(wifi_pkg)) {
602 num_chains = ACPI_SAR_NUM_CHAINS_REV0;
603 num_sub_bands = ACPI_SAR_NUM_SUB_BANDS_REV0;
608 ret = PTR_ERR(wifi_pkg);
612 if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER ||
613 wifi_pkg->package.elements[2].type != ACPI_TYPE_INTEGER) {
618 enabled = !!(wifi_pkg->package.elements[1].integer.value);
619 n_profiles = wifi_pkg->package.elements[2].integer.value;
622 * Check the validity of n_profiles. The EWRD profiles start
623 * from index 1, so the maximum value allowed here is
624 * ACPI_SAR_PROFILES_NUM - 1.
626 if (n_profiles >= BIOS_SAR_MAX_PROFILE_NUM) {
631 /* the tables start at element 3 */
634 for (i = 0; i < n_profiles; i++) {
635 union acpi_object *table = &wifi_pkg->package.elements[pos];
636 /* The EWRD profiles officially go from 2 to 4, but we
637 * save them in sar_profiles[1-3] (because we don't
638 * have profile 0). So in the array we start from 1.
640 ret = iwl_acpi_sar_set_profile(table,
641 &fwrt->sar_profiles[i + 1],
647 /* go to the next table */
648 pos += num_chains * num_sub_bands;
656 int iwl_acpi_get_wgds_table(struct iwl_fw_runtime *fwrt)
658 union acpi_object *wifi_pkg, *data;
659 int i, j, k, ret, tbl_rev;
660 u8 num_bands, num_profiles;
661 static const struct {
669 .bands = ACPI_GEO_NUM_BANDS_REV2,
670 .profiles = ACPI_NUM_GEO_PROFILES_REV3,
671 .min_profiles = BIOS_GEO_MIN_PROFILE_NUM,
675 .bands = ACPI_GEO_NUM_BANDS_REV2,
676 .profiles = ACPI_NUM_GEO_PROFILES,
679 .revisions = BIT(0) | BIT(1),
680 .bands = ACPI_GEO_NUM_BANDS_REV0,
681 .profiles = ACPI_NUM_GEO_PROFILES,
685 /* start from one to skip the domain */
688 BUILD_BUG_ON(ACPI_NUM_GEO_PROFILES_REV3 != IWL_NUM_GEO_PROFILES_V3);
689 BUILD_BUG_ON(ACPI_NUM_GEO_PROFILES != IWL_NUM_GEO_PROFILES);
691 data = iwl_acpi_get_object(fwrt->dev, ACPI_WGDS_METHOD);
693 return PTR_ERR(data);
695 /* read the highest revision we understand first */
696 for (idx = 0; idx < ARRAY_SIZE(rev_data); idx++) {
697 /* min_profiles != 0 requires num_profiles header */
698 u32 hdr_size = 1 + !!rev_data[idx].min_profiles;
699 u32 profile_size = ACPI_GEO_PER_CHAIN_SIZE *
701 u32 max_size = hdr_size + profile_size * rev_data[idx].profiles;
704 if (!rev_data[idx].min_profiles)
707 min_size = hdr_size +
708 profile_size * rev_data[idx].min_profiles;
710 wifi_pkg = iwl_acpi_get_wifi_pkg_range(fwrt->dev, data,
713 if (!IS_ERR(wifi_pkg)) {
714 if (!(BIT(tbl_rev) & rev_data[idx].revisions))
717 num_bands = rev_data[idx].bands;
718 num_profiles = rev_data[idx].profiles;
720 if (rev_data[idx].min_profiles) {
721 /* read header that says # of profiles */
722 union acpi_object *entry;
724 entry = &wifi_pkg->package.elements[entry_idx];
726 if (entry->type != ACPI_TYPE_INTEGER ||
727 entry->integer.value > num_profiles) {
731 num_profiles = entry->integer.value;
734 * this also validates >= min_profiles since we
735 * otherwise wouldn't have gotten the data when
738 if (wifi_pkg->package.count !=
739 hdr_size + profile_size * num_profiles) {
748 if (idx < ARRAY_SIZE(rev_data))
749 ret = PTR_ERR(wifi_pkg);
755 fwrt->geo_rev = tbl_rev;
756 for (i = 0; i < num_profiles; i++) {
757 for (j = 0; j < BIOS_GEO_MAX_NUM_BANDS; j++) {
758 union acpi_object *entry;
761 * num_bands is either 2 or 3, if it's only 2 then
762 * fill the third band (6 GHz) with the values from
763 * 5 GHz (second band)
765 if (j >= num_bands) {
766 fwrt->geo_profiles[i].bands[j].max =
767 fwrt->geo_profiles[i].bands[1].max;
769 entry = &wifi_pkg->package.elements[entry_idx];
771 if (entry->type != ACPI_TYPE_INTEGER ||
772 entry->integer.value > U8_MAX) {
777 fwrt->geo_profiles[i].bands[j].max =
778 entry->integer.value;
781 for (k = 0; k < BIOS_GEO_NUM_CHAINS; k++) {
782 /* same here as above */
783 if (j >= num_bands) {
784 fwrt->geo_profiles[i].bands[j].chains[k] =
785 fwrt->geo_profiles[i].bands[1].chains[k];
787 entry = &wifi_pkg->package.elements[entry_idx];
789 if (entry->type != ACPI_TYPE_INTEGER ||
790 entry->integer.value > U8_MAX) {
795 fwrt->geo_profiles[i].bands[j].chains[k] =
796 entry->integer.value;
802 fwrt->geo_num_profiles = num_profiles;
803 fwrt->geo_enabled = true;
810 int iwl_acpi_get_ppag_table(struct iwl_fw_runtime *fwrt)
812 union acpi_object *wifi_pkg, *data, *flags;
813 int i, j, ret, tbl_rev, num_sub_bands = 0;
816 data = iwl_acpi_get_object(fwrt->dev, ACPI_PPAG_METHOD);
818 return PTR_ERR(data);
820 /* try to read ppag table rev 3, 2 or 1 (all have the same data size) */
821 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data,
822 ACPI_PPAG_WIFI_DATA_SIZE_V2, &tbl_rev);
824 if (!IS_ERR(wifi_pkg)) {
825 if (tbl_rev >= 1 && tbl_rev <= 3) {
826 num_sub_bands = IWL_NUM_SUB_BANDS_V2;
827 IWL_DEBUG_RADIO(fwrt,
828 "Reading PPAG table (tbl_rev=%d)\n",
837 /* try to read ppag table revision 0 */
838 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data,
839 ACPI_PPAG_WIFI_DATA_SIZE_V1, &tbl_rev);
841 if (!IS_ERR(wifi_pkg)) {
846 num_sub_bands = IWL_NUM_SUB_BANDS_V1;
847 IWL_DEBUG_RADIO(fwrt, "Reading PPAG table v1 (tbl_rev=0)\n");
851 ret = PTR_ERR(wifi_pkg);
855 fwrt->ppag_ver = tbl_rev;
856 flags = &wifi_pkg->package.elements[1];
858 if (flags->type != ACPI_TYPE_INTEGER) {
863 fwrt->ppag_flags = iwl_bios_get_ppag_flags(flags->integer.value,
867 * read, verify gain values and save them into the PPAG table.
868 * first sub-band (j=0) corresponds to Low-Band (2.4GHz), and the
869 * following sub-bands to High-Band (5GHz).
871 for (i = 0; i < IWL_NUM_CHAIN_LIMITS; i++) {
872 for (j = 0; j < num_sub_bands; j++) {
873 union acpi_object *ent;
875 ent = &wifi_pkg->package.elements[idx++];
876 if (ent->type != ACPI_TYPE_INTEGER) {
881 fwrt->ppag_chains[i].subbands[j] = ent->integer.value;
892 void iwl_acpi_get_phy_filters(struct iwl_fw_runtime *fwrt,
893 struct iwl_phy_specific_cfg *filters)
895 struct iwl_phy_specific_cfg tmp = {};
896 union acpi_object *wifi_pkg, *data;
899 data = iwl_acpi_get_object(fwrt->dev, ACPI_WPFC_METHOD);
903 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data,
904 ACPI_WPFC_WIFI_DATA_SIZE,
906 if (IS_ERR(wifi_pkg))
912 BUILD_BUG_ON(ARRAY_SIZE(filters->filter_cfg_chains) !=
913 ACPI_WPFC_WIFI_DATA_SIZE - 1);
915 for (i = 0; i < ARRAY_SIZE(filters->filter_cfg_chains); i++) {
916 if (wifi_pkg->package.elements[i + 1].type != ACPI_TYPE_INTEGER)
918 tmp.filter_cfg_chains[i] =
919 cpu_to_le32(wifi_pkg->package.elements[i + 1].integer.value);
922 IWL_DEBUG_RADIO(fwrt, "Loaded WPFC filter config from ACPI\n");
927 IWL_EXPORT_SYMBOL(iwl_acpi_get_phy_filters);
929 void iwl_acpi_get_guid_lock_status(struct iwl_fw_runtime *fwrt)
931 union acpi_object *wifi_pkg, *data;
934 data = iwl_acpi_get_object(fwrt->dev, ACPI_GLAI_METHOD);
938 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data,
939 ACPI_GLAI_WIFI_DATA_SIZE,
941 if (IS_ERR(wifi_pkg))
945 IWL_DEBUG_RADIO(fwrt, "Invalid GLAI revision: %d\n", tbl_rev);
949 if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER ||
950 wifi_pkg->package.elements[1].integer.value > ACPI_GLAI_MAX_STATUS)
953 fwrt->uefi_tables_lock_status =
954 wifi_pkg->package.elements[1].integer.value;
956 IWL_DEBUG_RADIO(fwrt,
957 "Loaded UEFI WIFI GUID lock status: %d from ACPI\n",
958 fwrt->uefi_tables_lock_status);
962 IWL_EXPORT_SYMBOL(iwl_acpi_get_guid_lock_status);