Lines Matching +full:entry +full:- +full:method
1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
4 * Copyright (C) 2019-2024 Intel Corporation
7 #include "iwl-drv.h"
8 #include "iwl-debug.h"
33 static int iwl_acpi_get_handle(struct device *dev, acpi_string method, in iwl_acpi_get_handle() argument
43 return -ENOENT; in iwl_acpi_get_handle()
46 status = acpi_get_handle(root_handle, method, ret_handle); in iwl_acpi_get_handle()
49 "ACPI: %s method not found\n", method); in iwl_acpi_get_handle()
50 return -ENOENT; in iwl_acpi_get_handle()
55 static void *iwl_acpi_get_object(struct device *dev, acpi_string method) in iwl_acpi_get_object() argument
62 ret = iwl_acpi_get_handle(dev, method, &handle); in iwl_acpi_get_object()
64 return ERR_PTR(-ENOENT); in iwl_acpi_get_object()
66 /* Call the method with no arguments */ in iwl_acpi_get_object()
70 "ACPI: %s method invocation failed (status: 0x%x)\n", in iwl_acpi_get_object()
71 method, status); in iwl_acpi_get_object()
72 return ERR_PTR(-ENOENT); in iwl_acpi_get_object()
78 * Generic function for evaluating a method defined in the device specific
79 * method (DSM) interface. The returned acpi object must be freed by calling
92 "ACPI: DSM method invocation failed (rev: %d, func:%d)\n", in iwl_acpi_get_dsm_object()
94 return ERR_PTR(-ENOENT); in iwl_acpi_get_dsm_object()
118 return -ENOENT; in iwl_acpi_get_dsm_integer()
121 if (obj->type == ACPI_TYPE_INTEGER) { in iwl_acpi_get_dsm_integer()
122 *value = obj->integer.value; in iwl_acpi_get_dsm_integer()
123 } else if (obj->type == ACPI_TYPE_BUFFER) { in iwl_acpi_get_dsm_integer()
127 return -EINVAL; in iwl_acpi_get_dsm_integer()
130 if (obj->buffer.length != expected_size) in iwl_acpi_get_dsm_integer()
133 obj->buffer.length); in iwl_acpi_get_dsm_integer()
136 memcpy(&le_value, obj->buffer.pointer, in iwl_acpi_get_dsm_integer()
137 min_t(size_t, expected_size, (size_t)obj->buffer.length)); in iwl_acpi_get_dsm_integer()
141 "ACPI: DSM method did not return a valid object, type=%d\n", in iwl_acpi_get_dsm_integer()
142 obj->type); in iwl_acpi_get_dsm_integer()
143 ret = -EINVAL; in iwl_acpi_get_dsm_integer()
148 "ACPI: DSM method evaluated: func=%d, ret=%d\n", in iwl_acpi_get_dsm_integer()
157 * according to Intel BIOS spec, and fills in the value in a 32-bit field.
158 * In case the expected size is smaller than 32-bit, padding will be added.
170 return -EINVAL; in iwl_acpi_get_dsm()
174 /* Currently all ACPI DSMs are either 8-bit or 32-bit */ in iwl_acpi_get_dsm()
176 return -EOPNOTSUPP; in iwl_acpi_get_dsm()
178 ret = iwl_acpi_get_dsm_integer(fwrt->dev, ACPI_DSM_REV, func, in iwl_acpi_get_dsm()
203 * We need at least one entry in the wifi package that in iwl_acpi_get_wifi_pkg_range()
204 * describes the domain, and one more entry, otherwise there's in iwl_acpi_get_wifi_pkg_range()
208 return ERR_PTR(-EINVAL); in iwl_acpi_get_wifi_pkg_range()
216 if (data->type != ACPI_TYPE_PACKAGE || in iwl_acpi_get_wifi_pkg_range()
217 data->package.count < 2 || in iwl_acpi_get_wifi_pkg_range()
218 data->package.elements[0].type != ACPI_TYPE_INTEGER) { in iwl_acpi_get_wifi_pkg_range()
220 return ERR_PTR(-EINVAL); in iwl_acpi_get_wifi_pkg_range()
223 *tbl_rev = data->package.elements[0].integer.value; in iwl_acpi_get_wifi_pkg_range()
226 for (i = 1; i < data->package.count; i++) { in iwl_acpi_get_wifi_pkg_range()
229 wifi_pkg = &data->package.elements[i]; in iwl_acpi_get_wifi_pkg_range()
232 if (wifi_pkg->type != ACPI_TYPE_PACKAGE || in iwl_acpi_get_wifi_pkg_range()
233 wifi_pkg->package.count < min_data_size || in iwl_acpi_get_wifi_pkg_range()
234 wifi_pkg->package.count > max_data_size) in iwl_acpi_get_wifi_pkg_range()
237 domain = &wifi_pkg->package.elements[0]; in iwl_acpi_get_wifi_pkg_range()
238 if (domain->type == ACPI_TYPE_INTEGER && in iwl_acpi_get_wifi_pkg_range()
239 domain->integer.value == ACPI_WIFI_DOMAIN) in iwl_acpi_get_wifi_pkg_range()
243 return ERR_PTR(-ENOENT); in iwl_acpi_get_wifi_pkg_range()
264 data = iwl_acpi_get_object(fwrt->dev, ACPI_WTAS_METHOD); in iwl_acpi_get_tas_table()
269 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data, in iwl_acpi_get_tas_table()
277 if (tbl_rev == 1 && wifi_pkg->package.elements[1].type == in iwl_acpi_get_tas_table()
280 (u32)wifi_pkg->package.elements[1].integer.value; in iwl_acpi_get_tas_table()
286 wifi_pkg->package.elements[1].type == ACPI_TYPE_INTEGER) { in iwl_acpi_get_tas_table()
287 enabled = !!wifi_pkg->package.elements[1].integer.value; in iwl_acpi_get_tas_table()
289 ret = -EINVAL; in iwl_acpi_get_tas_table()
300 if (wifi_pkg->package.elements[2].type != ACPI_TYPE_INTEGER || in iwl_acpi_get_tas_table()
301 wifi_pkg->package.elements[2].integer.value > in iwl_acpi_get_tas_table()
304 wifi_pkg->package.elements[2].integer.value); in iwl_acpi_get_tas_table()
305 ret = -EINVAL; in iwl_acpi_get_tas_table()
308 block_list_size = wifi_pkg->package.elements[2].integer.value; in iwl_acpi_get_tas_table()
309 tas_data->block_list_size = cpu_to_le32(block_list_size); in iwl_acpi_get_tas_table()
316 if (wifi_pkg->package.elements[3 + i].type != in iwl_acpi_get_tas_table()
320 ret = -EINVAL; in iwl_acpi_get_tas_table()
324 country = wifi_pkg->package.elements[3 + i].integer.value; in iwl_acpi_get_tas_table()
325 tas_data->block_list_array[i] = cpu_to_le32(country); in iwl_acpi_get_tas_table()
341 data = iwl_acpi_get_object(fwrt->dev, ACPI_WRDD_METHOD); in iwl_acpi_get_mcc()
345 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data, in iwl_acpi_get_mcc()
353 if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER || in iwl_acpi_get_mcc()
355 ret = -EINVAL; in iwl_acpi_get_mcc()
359 mcc_val = wifi_pkg->package.elements[1].integer.value; in iwl_acpi_get_mcc()
361 ret = -EINVAL; in iwl_acpi_get_mcc()
379 int tbl_rev, ret = -EINVAL; in iwl_acpi_get_pwr_limit()
382 data = iwl_acpi_get_object(fwrt->dev, ACPI_SPLC_METHOD); in iwl_acpi_get_pwr_limit()
386 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data, in iwl_acpi_get_pwr_limit()
389 wifi_pkg->package.elements[1].integer.value != ACPI_TYPE_INTEGER) in iwl_acpi_get_pwr_limit()
392 *dflt_pwr_limit = wifi_pkg->package.elements[1].integer.value; in iwl_acpi_get_pwr_limit()
405 data = iwl_acpi_get_object(fwrt->dev, ACPI_ECKV_METHOD); in iwl_acpi_get_eckv()
409 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data, in iwl_acpi_get_eckv()
417 if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER || in iwl_acpi_get_eckv()
419 ret = -EINVAL; in iwl_acpi_get_eckv()
423 *extl_clk = wifi_pkg->package.elements[1].integer.value; in iwl_acpi_get_eckv()
443 } else if (table->type != ACPI_TYPE_INTEGER || in iwl_acpi_parse_chains_table()
444 table->integer.value > U8_MAX) { in iwl_acpi_parse_chains_table()
445 return -EINVAL; in iwl_acpi_parse_chains_table()
448 table->integer.value; in iwl_acpi_parse_chains_table()
464 data = iwl_acpi_get_object(fwrt->dev, ACPI_WRDS_METHOD); in iwl_acpi_get_wrds_table()
469 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data, in iwl_acpi_get_wrds_table()
474 ret = -EINVAL; in iwl_acpi_get_wrds_table()
485 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data, in iwl_acpi_get_wrds_table()
490 ret = -EINVAL; in iwl_acpi_get_wrds_table()
501 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data, in iwl_acpi_get_wrds_table()
506 ret = -EINVAL; in iwl_acpi_get_wrds_table()
520 if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) { in iwl_acpi_get_wrds_table()
521 ret = -EINVAL; in iwl_acpi_get_wrds_table()
527 flags = wifi_pkg->package.elements[1].integer.value; in iwl_acpi_get_wrds_table()
528 fwrt->reduced_power_flags = flags >> IWL_REDUCE_POWER_FLAGS_POS; in iwl_acpi_get_wrds_table()
531 table = &wifi_pkg->package.elements[2]; in iwl_acpi_get_wrds_table()
536 ret = iwl_acpi_parse_chains_table(table, fwrt->sar_profiles[0].chains, in iwl_acpi_get_wrds_table()
539 fwrt->sar_profiles[0].enabled = true; in iwl_acpi_get_wrds_table()
554 data = iwl_acpi_get_object(fwrt->dev, ACPI_EWRD_METHOD); in iwl_acpi_get_ewrd_table()
559 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data, in iwl_acpi_get_ewrd_table()
564 ret = -EINVAL; in iwl_acpi_get_ewrd_table()
574 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data, in iwl_acpi_get_ewrd_table()
579 ret = -EINVAL; in iwl_acpi_get_ewrd_table()
589 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data, in iwl_acpi_get_ewrd_table()
594 ret = -EINVAL; in iwl_acpi_get_ewrd_table()
607 if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER || in iwl_acpi_get_ewrd_table()
608 wifi_pkg->package.elements[2].type != ACPI_TYPE_INTEGER) { in iwl_acpi_get_ewrd_table()
609 ret = -EINVAL; in iwl_acpi_get_ewrd_table()
613 enabled = !!(wifi_pkg->package.elements[1].integer.value); in iwl_acpi_get_ewrd_table()
614 n_profiles = wifi_pkg->package.elements[2].integer.value; in iwl_acpi_get_ewrd_table()
619 * ACPI_SAR_PROFILES_NUM - 1. in iwl_acpi_get_ewrd_table()
622 ret = -EINVAL; in iwl_acpi_get_ewrd_table()
632 /* parse non-cdb chains for all profiles */ in iwl_acpi_get_ewrd_table()
634 union acpi_object *table = &wifi_pkg->package.elements[pos]; in iwl_acpi_get_ewrd_table()
637 * save them in sar_profiles[1-3] (because we don't in iwl_acpi_get_ewrd_table()
641 fwrt->sar_profiles[i + 1].chains, in iwl_acpi_get_ewrd_table()
651 /* non-cdb table revisions */ in iwl_acpi_get_ewrd_table()
660 table = &wifi_pkg->package.elements[pos]; in iwl_acpi_get_ewrd_table()
661 chains = &fwrt->sar_profiles[i + 1].chains[ACPI_SAR_NUM_CHAINS_REV0]; in iwl_acpi_get_ewrd_table()
675 fwrt->sar_profiles[i + 1].enabled = enabled; in iwl_acpi_get_ewrd_table()
717 data = iwl_acpi_get_object(fwrt->dev, ACPI_WGDS_METHOD); in iwl_acpi_get_wgds_table()
736 wifi_pkg = iwl_acpi_get_wifi_pkg_range(fwrt->dev, data, in iwl_acpi_get_wgds_table()
748 union acpi_object *entry; in iwl_acpi_get_wgds_table() local
750 entry = &wifi_pkg->package.elements[entry_idx]; in iwl_acpi_get_wgds_table()
752 if (entry->type != ACPI_TYPE_INTEGER || in iwl_acpi_get_wgds_table()
753 entry->integer.value > num_profiles || in iwl_acpi_get_wgds_table()
754 entry->integer.value < in iwl_acpi_get_wgds_table()
756 ret = -EINVAL; in iwl_acpi_get_wgds_table()
764 if (wifi_pkg->package.count != in iwl_acpi_get_wgds_table()
766 ret = -EINVAL; in iwl_acpi_get_wgds_table()
771 num_profiles = entry->integer.value; in iwl_acpi_get_wgds_table()
780 ret = -ENOENT; in iwl_acpi_get_wgds_table()
784 fwrt->geo_rev = tbl_rev; in iwl_acpi_get_wgds_table()
787 union acpi_object *entry; in iwl_acpi_get_wgds_table() local
795 fwrt->geo_profiles[i].bands[j].max = in iwl_acpi_get_wgds_table()
796 fwrt->geo_profiles[i].bands[1].max; in iwl_acpi_get_wgds_table()
798 entry = &wifi_pkg->package.elements[entry_idx]; in iwl_acpi_get_wgds_table()
800 if (entry->type != ACPI_TYPE_INTEGER || in iwl_acpi_get_wgds_table()
801 entry->integer.value > U8_MAX) { in iwl_acpi_get_wgds_table()
802 ret = -EINVAL; in iwl_acpi_get_wgds_table()
806 fwrt->geo_profiles[i].bands[j].max = in iwl_acpi_get_wgds_table()
807 entry->integer.value; in iwl_acpi_get_wgds_table()
813 fwrt->geo_profiles[i].bands[j].chains[k] = in iwl_acpi_get_wgds_table()
814 fwrt->geo_profiles[i].bands[1].chains[k]; in iwl_acpi_get_wgds_table()
816 entry = &wifi_pkg->package.elements[entry_idx]; in iwl_acpi_get_wgds_table()
818 if (entry->type != ACPI_TYPE_INTEGER || in iwl_acpi_get_wgds_table()
819 entry->integer.value > U8_MAX) { in iwl_acpi_get_wgds_table()
820 ret = -EINVAL; in iwl_acpi_get_wgds_table()
824 fwrt->geo_profiles[i].bands[j].chains[k] = in iwl_acpi_get_wgds_table()
825 entry->integer.value; in iwl_acpi_get_wgds_table()
831 fwrt->geo_num_profiles = num_profiles; in iwl_acpi_get_wgds_table()
832 fwrt->geo_enabled = true; in iwl_acpi_get_wgds_table()
845 data = iwl_acpi_get_object(fwrt->dev, ACPI_PPAG_METHOD); in iwl_acpi_get_ppag_table()
850 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data, in iwl_acpi_get_ppag_table()
861 ret = -EINVAL; in iwl_acpi_get_ppag_table()
867 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data, in iwl_acpi_get_ppag_table()
872 ret = -EINVAL; in iwl_acpi_get_ppag_table()
884 fwrt->ppag_ver = tbl_rev; in iwl_acpi_get_ppag_table()
885 flags = &wifi_pkg->package.elements[1]; in iwl_acpi_get_ppag_table()
887 if (flags->type != ACPI_TYPE_INTEGER) { in iwl_acpi_get_ppag_table()
888 ret = -EINVAL; in iwl_acpi_get_ppag_table()
892 fwrt->ppag_flags = iwl_bios_get_ppag_flags(flags->integer.value, in iwl_acpi_get_ppag_table()
893 fwrt->ppag_ver); in iwl_acpi_get_ppag_table()
897 * first sub-band (j=0) corresponds to Low-Band (2.4GHz), and the in iwl_acpi_get_ppag_table()
898 * following sub-bands to High-Band (5GHz). in iwl_acpi_get_ppag_table()
904 ent = &wifi_pkg->package.elements[idx++]; in iwl_acpi_get_ppag_table()
905 if (ent->type != ACPI_TYPE_INTEGER) { in iwl_acpi_get_ppag_table()
906 ret = -EINVAL; in iwl_acpi_get_ppag_table()
910 fwrt->ppag_chains[i].subbands[j] = ent->integer.value; in iwl_acpi_get_ppag_table()
928 data = iwl_acpi_get_object(fwrt->dev, ACPI_WPFC_METHOD); in iwl_acpi_get_phy_filters()
932 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data, in iwl_acpi_get_phy_filters()
941 BUILD_BUG_ON(ARRAY_SIZE(filters->filter_cfg_chains) != in iwl_acpi_get_phy_filters()
942 ACPI_WPFC_WIFI_DATA_SIZE - 1); in iwl_acpi_get_phy_filters()
944 for (i = 0; i < ARRAY_SIZE(filters->filter_cfg_chains); i++) { in iwl_acpi_get_phy_filters()
945 if (wifi_pkg->package.elements[i + 1].type != ACPI_TYPE_INTEGER) in iwl_acpi_get_phy_filters()
948 cpu_to_le32(wifi_pkg->package.elements[i + 1].integer.value); in iwl_acpi_get_phy_filters()
963 data = iwl_acpi_get_object(fwrt->dev, ACPI_GLAI_METHOD); in iwl_acpi_get_guid_lock_status()
967 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data, in iwl_acpi_get_guid_lock_status()
978 if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER || in iwl_acpi_get_guid_lock_status()
979 wifi_pkg->package.elements[1].integer.value > ACPI_GLAI_MAX_STATUS) in iwl_acpi_get_guid_lock_status()
982 fwrt->uefi_tables_lock_status = in iwl_acpi_get_guid_lock_status()
983 wifi_pkg->package.elements[1].integer.value; in iwl_acpi_get_guid_lock_status()
987 fwrt->uefi_tables_lock_status); in iwl_acpi_get_guid_lock_status()
996 int ret = -ENOENT; in iwl_acpi_get_wbem()
999 data = iwl_acpi_get_object(fwrt->dev, ACPI_WBEM_METHOD); in iwl_acpi_get_wbem()
1003 wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data, in iwl_acpi_get_wbem()
1015 if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) in iwl_acpi_get_wbem()
1018 *value = wifi_pkg->package.elements[1].integer.value & in iwl_acpi_get_wbem()