Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'acpi-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI updates from Rafael Wysocki:
"These update the ACPICA code in the kernel to the most recent upstream
revision, address some issues related to the ACPI power resources
management, simplify the enumeration of PCI devices having ACPI
companions, add new quirks, fix assorted problems, update the
ACPI-related information in maintainers and clean up code in several
places.

Specifics:

- Update the ACPICA code in the kernel to upstream revision 20210930
including the following changes:

- Fix system-wide resume issue caused by evaluating control
methods too early in the resume path (Rafael Wysocki).

- Add support for Windows 2020 _OSI string (Mario Limonciello).

- Add Generic Port Affinity type for SRAT (Alison Schofield).

- Add disassembly support for the NHLT ACPI table (Bob Moore).

- Avoid flushing caches before entering C3 type of idle states on AMD
processors (Deepak Sharma).

- Avoid enumerating CPUs that are not present and not online-capable
according to the platform firmware (Mario Limonciello).

- Add DMI-based mechanism to quirk IRQ overrides and use it for two
platforms (Hui Wang).

- Change the configuration of unused ACPI device objects to reflect
the D3cold power state after enumerating devices (Rafael Wysocki).

- Update MAINTAINERS information regarding ACPI (Rafael Wysocki).

- Fix typo in ACPI Kconfig (Masanari Iid).

- Use sysfs_emit() instead of snprintf() in some places (Qing Wang).

- Make the association of ACPI device objects with PCI devices more
straightforward and simplify the code doing that for all devices in
general (Rafael Wysocki).

- Use acpi_device_adr() in acpi_find_child_device() instead of
evaluating _ADR (Rafael Wysocki).

- Drop duplicate device IDs from PNP device IDs list (Krzysztof
Kozlowski).

- Allow acpi_idle_play_dead() to use C3 on AMD processors (Richard
Gong).

- Use ACPI_COMPANION() to simplify code in some drivers (Rafael
Wysocki).

- Check the states of all ACPI power resources during initialization
to avoid dealing with power resources in unknown states (Rafael
Wysocki).

- Fix ACPI power resource issues related to sharing wakeup power
resources (Rafael Wysocki).

- Avoid registering redundant suspend_ops (Rafael Wysocki).

- Report battery charging state as "full" if it appears to be over
the design capacity (André Almeida).

- Quirk GK45 mini PC to skip reading _PSR in the AC driver (Stefan
Schaeckeler).

- Mark apei_hest_parse() static (Christoph Hellwig).

- Relax platform response timeout to 1 second after instructing it to
inject an error (Shuai Xue).

- Make the PRM code handle memory allocation and remapping failures
more gracefully and drop some unnecessary blank lines from that
code (Aubrey Li).

- Fix spelling mistake in the ACPI documentation (Colin Ian King)"

* tag 'acpi-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (36 commits)
ACPI: glue: Use acpi_device_adr() in acpi_find_child_device()
perf: qcom_l2_pmu: ACPI: Use ACPI_COMPANION() directly
ACPI: APEI: mark apei_hest_parse() static
ACPI: APEI: EINJ: Relax platform response timeout to 1 second
gpio-amdpt: ACPI: Use the ACPI_COMPANION() macro directly
nouveau: ACPI: Use the ACPI_COMPANION() macro directly
ACPI: resources: Add one more Medion model in IRQ override quirk
ACPI: AC: Quirk GK45 to skip reading _PSR
ACPI: PM: sleep: Do not set suspend_ops unnecessarily
ACPI: PRM: Handle memory allocation and memory remap failure
ACPI: PRM: Remove unnecessary blank lines
ACPI: PM: Turn off wakeup power resources on _DSW/_PSW errors
ACPI: PM: Fix sharing of wakeup power resources
ACPI: PM: Turn off unused wakeup power resources
ACPI: PM: Check states of power resources during initialization
ACPI: replace snprintf() in "show" functions with sysfs_emit()
ACPI: LPSS: Use ACPI_COMPANION() directly
ACPI: scan: Release PM resources blocked by unused objects
ACPI: battery: Accept charges over the design capacity as full
ACPICA: Update version to 20210930
...

+547 -194
+1 -1
Documentation/firmware-guide/acpi/osi.rst
··· 74 74 interpreter in the kernel would return to it a string identifying the OS: 75 75 76 76 Windows 98, SE: "Microsoft Windows" 77 - Windows ME: "Microsoft WindowsME:Millenium Edition" 77 + Windows ME: "Microsoft WindowsME:Millennium Edition" 78 78 Windows NT: "Microsoft Windows NT" 79 79 80 80 The idea was on a platform tasked with running multiple OS's,
+2 -18
MAINTAINERS
··· 334 334 335 335 ACPI 336 336 M: "Rafael J. Wysocki" <rafael@kernel.org> 337 - M: Len Brown <lenb@kernel.org> 337 + R: Len Brown <lenb@kernel.org> 338 338 L: linux-acpi@vger.kernel.org 339 339 S: Supported 340 340 W: https://01.org/linux-acpi ··· 355 355 356 356 ACPI APEI 357 357 M: "Rafael J. Wysocki" <rafael@kernel.org> 358 - M: Len Brown <lenb@kernel.org> 358 + R: Len Brown <lenb@kernel.org> 359 359 R: James Morse <james.morse@arm.com> 360 360 R: Tony Luck <tony.luck@intel.com> 361 361 R: Borislav Petkov <bp@alien8.de> ··· 377 377 F: drivers/acpi/acpica/ 378 378 F: include/acpi/ 379 379 F: tools/power/acpi/ 380 - 381 - ACPI FAN DRIVER 382 - M: Zhang Rui <rui.zhang@intel.com> 383 - L: linux-acpi@vger.kernel.org 384 - S: Supported 385 - W: https://01.org/linux-acpi 386 - B: https://bugzilla.kernel.org 387 - F: drivers/acpi/fan.c 388 380 389 381 ACPI FOR ARM64 (ACPI/arm64) 390 382 M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> ··· 419 427 W: https://01.org/linux-acpi 420 428 B: https://bugzilla.kernel.org 421 429 F: drivers/acpi/*thermal* 422 - 423 - ACPI VIDEO DRIVER 424 - M: Zhang Rui <rui.zhang@intel.com> 425 - L: linux-acpi@vger.kernel.org 426 - S: Supported 427 - W: https://01.org/linux-acpi 428 - B: https://bugzilla.kernel.org 429 - F: drivers/acpi/acpi_video.c 430 430 431 431 ACPI VIOT DRIVER 432 432 M: Jean-Philippe Brucker <jean-philippe@linaro.org>
+9
arch/x86/kernel/acpi/boot.c
··· 62 62 63 63 #ifdef CONFIG_X86_LOCAL_APIC 64 64 static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE; 65 + static bool acpi_support_online_capable; 65 66 #endif 66 67 67 68 #ifdef CONFIG_X86_IO_APIC ··· 139 138 140 139 pr_debug("Local APIC address 0x%08x\n", madt->address); 141 140 } 141 + if (madt->header.revision >= 5) 142 + acpi_support_online_capable = true; 142 143 143 144 default_acpi_madt_oem_check(madt->header.oem_id, 144 145 madt->header.oem_table_id); ··· 240 237 241 238 /* Ignore invalid ID */ 242 239 if (processor->id == 0xff) 240 + return 0; 241 + 242 + /* don't register processors that can not be onlined */ 243 + if (acpi_support_online_capable && 244 + !(processor->lapic_flags & ACPI_MADT_ENABLED) && 245 + !(processor->lapic_flags & ACPI_MADT_ONLINE_CAPABLE)) 243 246 return 0; 244 247 245 248 /*
+15
arch/x86/kernel/acpi/cstate.c
··· 79 79 */ 80 80 flags->bm_control = 0; 81 81 } 82 + if (c->x86_vendor == X86_VENDOR_AMD && c->x86 >= 0x17) { 83 + /* 84 + * For all AMD Zen or newer CPUs that support C3, caches 85 + * should not be flushed by software while entering C3 86 + * type state. Set bm->check to 1 so that kernel doesn't 87 + * need to execute cache flush operation. 88 + */ 89 + flags->bm_check = 1; 90 + /* 91 + * In current AMD C state implementation ARB_DIS is no longer 92 + * used. So set bm_control to zero to indicate ARB_DIS is not 93 + * required while entering C3 type state. 94 + */ 95 + flags->bm_control = 0; 96 + } 82 97 } 83 98 EXPORT_SYMBOL(acpi_processor_power_init_bm_check); 84 99
+1 -1
drivers/acpi/Kconfig
··· 71 71 if ACPI_DEBUGGER 72 72 73 73 config ACPI_DEBUGGER_USER 74 - tristate "Userspace debugger accessiblity" 74 + tristate "Userspace debugger accessibility" 75 75 depends on DEBUG_FS 76 76 help 77 77 Export /sys/kernel/debug/acpi/acpidbg for userspace utilities
+19
drivers/acpi/ac.c
··· 61 61 62 62 static int ac_sleep_before_get_state_ms; 63 63 static int ac_check_pmic = 1; 64 + static int ac_only; 64 65 65 66 static struct acpi_driver acpi_ac_driver = { 66 67 .name = "ac", ··· 93 92 94 93 if (!ac) 95 94 return -EINVAL; 95 + 96 + if (ac_only) { 97 + ac->state = 1; 98 + return 0; 99 + } 96 100 97 101 status = acpi_evaluate_integer(ac->device->handle, "_PSR", NULL, 98 102 &ac->state); ··· 206 200 return 0; 207 201 } 208 202 203 + static int __init ac_only_quirk(const struct dmi_system_id *d) 204 + { 205 + ac_only = 1; 206 + return 0; 207 + } 208 + 209 209 /* Please keep this list alphabetically sorted */ 210 210 static const struct dmi_system_id ac_dmi_table[] __initconst = { 211 211 { ··· 219 207 .callback = ac_do_not_check_pmic_quirk, 220 208 .matches = { 221 209 DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"), 210 + }, 211 + }, 212 + { 213 + /* Kodlix GK45 returning incorrect state */ 214 + .callback = ac_only_quirk, 215 + .matches = { 216 + DMI_MATCH(DMI_PRODUCT_NAME, "GK45"), 222 217 }, 223 218 }, 224 219 {
+7 -6
drivers/acpi/acpi_lpss.c
··· 712 712 713 713 static int lpss_reg_read(struct device *dev, unsigned int reg, u32 *val) 714 714 { 715 - struct acpi_device *adev; 715 + struct acpi_device *adev = ACPI_COMPANION(dev); 716 716 struct lpss_private_data *pdata; 717 717 unsigned long flags; 718 718 int ret; 719 719 720 - ret = acpi_bus_get_device(ACPI_HANDLE(dev), &adev); 721 - if (WARN_ON(ret)) 722 - return ret; 720 + if (WARN_ON(!adev)) 721 + return -ENODEV; 723 722 724 723 spin_lock_irqsave(&dev->power.lock, flags); 725 724 if (pm_runtime_suspended(dev)) { ··· 731 732 goto out; 732 733 } 733 734 *val = __lpss_reg_read(pdata, reg); 735 + ret = 0; 734 736 735 737 out: 736 738 spin_unlock_irqrestore(&dev->power.lock, flags); ··· 750 750 if (ret) 751 751 return ret; 752 752 753 - return snprintf(buf, PAGE_SIZE, "%08x\n", ltr_value); 753 + return sysfs_emit(buf, "%08x\n", ltr_value); 754 754 } 755 755 756 756 static ssize_t lpss_ltr_mode_show(struct device *dev, ··· 1266 1266 if (!id || !id->driver_data) 1267 1267 return 0; 1268 1268 1269 - if (acpi_bus_get_device(ACPI_HANDLE(&pdev->dev), &adev)) 1269 + adev = ACPI_COMPANION(&pdev->dev); 1270 + if (!adev) 1270 1271 return 0; 1271 1272 1272 1273 pdata = acpi_driver_data(adev);
-2
drivers/acpi/acpi_pnp.c
··· 156 156 {"BRI0A49"}, /* Boca Complete Ofc Communicator 14.4 Data-FAX */ 157 157 {"BRI1400"}, /* Boca Research 33,600 ACF Modem */ 158 158 {"BRI3400"}, /* Boca 33.6 Kbps Internal FD34FSVD */ 159 - {"BRI0A49"}, /* Boca 33.6 Kbps Internal FD34FSVD */ 160 - {"BDP3336"}, /* Best Data Products Inc. Smart One 336F PnP Modem */ 161 159 {"CPI4050"}, /* Computer Peripherals Inc. EuroViVa CommCenter-33.6 SP PnP */ 162 160 {"CTL3001"}, /* Creative Labs Phone Blaster 28.8 DSVD PnP Voice */ 163 161 {"CTL3011"}, /* Creative Labs Modem Blaster 28.8 DSVD PnP Voice */
+2
drivers/acpi/acpica/acglobal.h
··· 226 226 acpi_gbl_bit_register_info[ACPI_NUM_BITREG]; 227 227 ACPI_GLOBAL(u8, acpi_gbl_sleep_type_a); 228 228 ACPI_GLOBAL(u8, acpi_gbl_sleep_type_b); 229 + ACPI_GLOBAL(u8, acpi_gbl_sleep_type_a_s0); 230 + ACPI_GLOBAL(u8, acpi_gbl_sleep_type_b_s0); 229 231 230 232 /***************************************************************************** 231 233 *
+2 -6
drivers/acpi/acpica/hwesleep.c
··· 147 147 148 148 acpi_status acpi_hw_extended_wake_prep(u8 sleep_state) 149 149 { 150 - acpi_status status; 151 150 u8 sleep_type_value; 152 151 153 152 ACPI_FUNCTION_TRACE(hw_extended_wake_prep); 154 153 155 - status = acpi_get_sleep_type_data(ACPI_STATE_S0, 156 - &acpi_gbl_sleep_type_a, 157 - &acpi_gbl_sleep_type_b); 158 - if (ACPI_SUCCESS(status)) { 154 + if (acpi_gbl_sleep_type_a_s0 != ACPI_SLEEP_TYPE_INVALID) { 159 155 sleep_type_value = 160 - ((acpi_gbl_sleep_type_a << ACPI_X_SLEEP_TYPE_POSITION) & 156 + ((acpi_gbl_sleep_type_a_s0 << ACPI_X_SLEEP_TYPE_POSITION) & 161 157 ACPI_X_SLEEP_TYPE_MASK); 162 158 163 159 (void)acpi_write((u64)(sleep_type_value | ACPI_X_SLEEP_ENABLE),
+4 -7
drivers/acpi/acpica/hwsleep.c
··· 179 179 180 180 acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state) 181 181 { 182 - acpi_status status; 182 + acpi_status status = AE_OK; 183 183 struct acpi_bit_register_info *sleep_type_reg_info; 184 184 struct acpi_bit_register_info *sleep_enable_reg_info; 185 185 u32 pm1a_control; ··· 192 192 * This is unclear from the ACPI Spec, but it is required 193 193 * by some machines. 194 194 */ 195 - status = acpi_get_sleep_type_data(ACPI_STATE_S0, 196 - &acpi_gbl_sleep_type_a, 197 - &acpi_gbl_sleep_type_b); 198 - if (ACPI_SUCCESS(status)) { 195 + if (acpi_gbl_sleep_type_a_s0 != ACPI_SLEEP_TYPE_INVALID) { 199 196 sleep_type_reg_info = 200 197 acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_TYPE); 201 198 sleep_enable_reg_info = ··· 213 216 214 217 /* Insert the SLP_TYP bits */ 215 218 216 - pm1a_control |= (acpi_gbl_sleep_type_a << 219 + pm1a_control |= (acpi_gbl_sleep_type_a_s0 << 217 220 sleep_type_reg_info->bit_position); 218 - pm1b_control |= (acpi_gbl_sleep_type_b << 221 + pm1b_control |= (acpi_gbl_sleep_type_b_s0 << 219 222 sleep_type_reg_info->bit_position); 220 223 221 224 /* Write the control registers and ignore any errors */
+7
drivers/acpi/acpica/hwxfsleep.c
··· 217 217 return_ACPI_STATUS(status); 218 218 } 219 219 220 + status = acpi_get_sleep_type_data(ACPI_STATE_S0, 221 + &acpi_gbl_sleep_type_a_s0, 222 + &acpi_gbl_sleep_type_b_s0); 223 + if (ACPI_FAILURE(status)) { 224 + acpi_gbl_sleep_type_a_s0 = ACPI_SLEEP_TYPE_INVALID; 225 + } 226 + 220 227 /* Execute the _PTS method (Prepare To Sleep) */ 221 228 222 229 arg_list.count = 1;
+1
drivers/acpi/acpica/utosi.c
··· 73 73 {"Windows 2018", NULL, 0, ACPI_OSI_WIN_10_RS4}, /* Windows 10 version 1803 - Added 11/2018 */ 74 74 {"Windows 2018.2", NULL, 0, ACPI_OSI_WIN_10_RS5}, /* Windows 10 version 1809 - Added 11/2018 */ 75 75 {"Windows 2019", NULL, 0, ACPI_OSI_WIN_10_19H1}, /* Windows 10 version 1903 - Added 08/2019 */ 76 + {"Windows 2020", NULL, 0, ACPI_OSI_WIN_10_20H1}, /* Windows 10 version 2004 - Added 08/2021 */ 76 77 77 78 /* Feature Group Strings */ 78 79
+8 -7
drivers/acpi/apei/einj.c
··· 28 28 #undef pr_fmt 29 29 #define pr_fmt(fmt) "EINJ: " fmt 30 30 31 - #define SPIN_UNIT 100 /* 100ns */ 32 - /* Firmware should respond within 1 milliseconds */ 33 - #define FIRMWARE_TIMEOUT (1 * NSEC_PER_MSEC) 31 + #define SLEEP_UNIT_MIN 1000 /* 1ms */ 32 + #define SLEEP_UNIT_MAX 5000 /* 5ms */ 33 + /* Firmware should respond within 1 seconds */ 34 + #define FIRMWARE_TIMEOUT (1 * USEC_PER_SEC) 34 35 #define ACPI5_VENDOR_BIT BIT(31) 35 36 #define MEM_ERROR_MASK (ACPI_EINJ_MEMORY_CORRECTABLE | \ 36 37 ACPI_EINJ_MEMORY_UNCORRECTABLE | \ ··· 172 171 173 172 static int einj_timedout(u64 *t) 174 173 { 175 - if ((s64)*t < SPIN_UNIT) { 174 + if ((s64)*t < SLEEP_UNIT_MIN) { 176 175 pr_warn(FW_WARN "Firmware does not respond in time\n"); 177 176 return 1; 178 177 } 179 - *t -= SPIN_UNIT; 180 - ndelay(SPIN_UNIT); 181 - touch_nmi_watchdog(); 178 + *t -= SLEEP_UNIT_MIN; 179 + usleep_range(SLEEP_UNIT_MIN, SLEEP_UNIT_MAX); 180 + 182 181 return 0; 183 182 } 184 183
+3 -2
drivers/acpi/apei/hest.c
··· 86 86 return len; 87 87 }; 88 88 89 - int apei_hest_parse(apei_hest_func_t func, void *data) 89 + typedef int (*apei_hest_func_t)(struct acpi_hest_header *hest_hdr, void *data); 90 + 91 + static int apei_hest_parse(apei_hest_func_t func, void *data) 90 92 { 91 93 struct acpi_hest_header *hest_hdr; 92 94 int i, rc, len; ··· 123 121 124 122 return 0; 125 123 } 126 - EXPORT_SYMBOL_GPL(apei_hest_parse); 127 124 128 125 /* 129 126 * Check if firmware advertises firmware first mode. We need FF bit to be set
+1 -1
drivers/acpi/battery.c
··· 169 169 return 1; 170 170 171 171 /* fallback to using design values for broken batteries */ 172 - if (battery->design_capacity == battery->capacity_now) 172 + if (battery->design_capacity <= battery->capacity_now) 173 173 return 1; 174 174 175 175 /* we don't do any sort of metric based on percentages */
+4 -4
drivers/acpi/dock.c
··· 492 492 struct acpi_device *adev = NULL; 493 493 494 494 acpi_bus_get_device(dock_station->handle, &adev); 495 - return snprintf(buf, PAGE_SIZE, "%u\n", acpi_device_enumerated(adev)); 495 + return sysfs_emit(buf, "%u\n", acpi_device_enumerated(adev)); 496 496 } 497 497 static DEVICE_ATTR_RO(docked); 498 498 ··· 504 504 { 505 505 struct dock_station *dock_station = dev->platform_data; 506 506 507 - return snprintf(buf, PAGE_SIZE, "%d\n", dock_station->flags); 507 + return sysfs_emit(buf, "%d\n", dock_station->flags); 508 508 509 509 } 510 510 static DEVICE_ATTR_RO(flags); ··· 543 543 if (ACPI_FAILURE(status)) 544 544 return 0; 545 545 546 - return snprintf(buf, PAGE_SIZE, "%llx\n", lbuf); 546 + return sysfs_emit(buf, "%llx\n", lbuf); 547 547 } 548 548 static DEVICE_ATTR_RO(uid); 549 549 ··· 562 562 else 563 563 type = "unknown"; 564 564 565 - return snprintf(buf, PAGE_SIZE, "%s\n", type); 565 + return sysfs_emit(buf, "%s\n", type); 566 566 } 567 567 static DEVICE_ATTR_RO(type); 568 568
+49 -17
drivers/acpi/glue.c
··· 17 17 #include <linux/rwsem.h> 18 18 #include <linux/acpi.h> 19 19 #include <linux/dma-mapping.h> 20 + #include <linux/pci.h> 21 + #include <linux/pci-acpi.h> 20 22 #include <linux/platform_device.h> 21 23 22 24 #include "internal.h" ··· 113 111 return NULL; 114 112 115 113 list_for_each_entry(adev, &parent->children, node) { 116 - unsigned long long addr; 117 - acpi_status status; 114 + acpi_bus_address addr = acpi_device_adr(adev); 118 115 int score; 119 116 120 - status = acpi_evaluate_integer(adev->handle, METHOD_NAME__ADR, 121 - NULL, &addr); 122 - if (ACPI_FAILURE(status) || addr != address) 117 + if (!adev->pnp.type.bus_address || addr != address) 123 118 continue; 124 119 125 120 if (!ret) { ··· 286 287 287 288 void acpi_device_notify(struct device *dev) 288 289 { 289 - struct acpi_bus_type *type = acpi_get_bus_type(dev); 290 290 struct acpi_device *adev; 291 291 int ret; 292 292 293 293 ret = acpi_bind_one(dev, NULL); 294 294 if (ret) { 295 + struct acpi_bus_type *type = acpi_get_bus_type(dev); 296 + 295 297 if (!type) 296 298 goto err; 297 299 ··· 304 304 ret = acpi_bind_one(dev, adev); 305 305 if (ret) 306 306 goto err; 307 + 308 + if (type->setup) { 309 + type->setup(dev); 310 + goto done; 311 + } 312 + } else { 313 + adev = ACPI_COMPANION(dev); 314 + 315 + if (dev_is_pci(dev)) { 316 + pci_acpi_setup(dev, adev); 317 + goto done; 318 + } else if (dev_is_platform(dev)) { 319 + acpi_configure_pmsi_domain(dev); 320 + } 307 321 } 308 - adev = ACPI_COMPANION(dev); 309 322 310 - if (dev_is_platform(dev)) 311 - acpi_configure_pmsi_domain(dev); 312 - 313 - if (type && type->setup) 314 - type->setup(dev); 315 - else if (adev->handler && adev->handler->bind) 323 + if (adev->handler && adev->handler->bind) 316 324 adev->handler->bind(dev); 317 325 326 + done: 318 327 acpi_handle_debug(ACPI_HANDLE(dev), "Bound to device %s\n", 319 328 dev_name(dev)); 320 329 ··· 336 327 void acpi_device_notify_remove(struct device *dev) 337 328 { 338 329 struct acpi_device *adev = ACPI_COMPANION(dev); 339 - struct acpi_bus_type *type; 340 330 341 331 if (!adev) 342 332 return; 343 333 344 - type = acpi_get_bus_type(dev); 345 - if (type && type->cleanup) 346 - type->cleanup(dev); 334 + if (dev_is_pci(dev)) 335 + pci_acpi_cleanup(dev, adev); 347 336 else if (adev->handler && adev->handler->unbind) 348 337 adev->handler->unbind(dev); 349 338 350 339 acpi_unbind_one(dev); 340 + } 341 + 342 + int acpi_dev_turn_off_if_unused(struct device *dev, void *not_used) 343 + { 344 + struct acpi_device *adev = to_acpi_device(dev); 345 + 346 + /* 347 + * Skip device objects with device IDs, because they may be in use even 348 + * if they are not companions of any physical device objects. 349 + */ 350 + if (adev->pnp.type.hardware_id) 351 + return 0; 352 + 353 + mutex_lock(&adev->physical_node_lock); 354 + 355 + /* 356 + * Device objects without device IDs are not in use if they have no 357 + * corresponding physical device objects. 358 + */ 359 + if (list_empty(&adev->physical_node_list)) 360 + acpi_device_set_power(adev, ACPI_STATE_D3_COLD); 361 + 362 + mutex_unlock(&adev->physical_node_lock); 363 + 364 + return 0; 351 365 }
+1
drivers/acpi/internal.h
··· 117 117 bool acpi_device_is_first_physical_node(struct acpi_device *adev, 118 118 const struct device *dev); 119 119 int acpi_bus_register_early_device(int type); 120 + int acpi_dev_turn_off_if_unused(struct device *dev, void *not_used); 120 121 121 122 /* -------------------------------------------------------------------------- 122 123 Device Matching and Notification
+41 -56
drivers/acpi/power.c
··· 52 52 u32 order; 53 53 unsigned int ref_count; 54 54 u8 state; 55 - bool wakeup_enabled; 56 55 struct mutex resource_lock; 57 56 struct list_head dependents; 58 57 }; ··· 614 615 615 616 list_for_each_entry(entry, list, node) { 616 617 struct acpi_power_resource *resource = entry->resource; 617 - int result; 618 618 u8 state; 619 619 620 620 mutex_lock(&resource->resource_lock); 621 621 622 - result = acpi_power_get_state(resource, &state); 623 - if (result) { 624 - mutex_unlock(&resource->resource_lock); 625 - return result; 626 - } 627 - if (state == ACPI_POWER_RESOURCE_STATE_ON) { 628 - resource->ref_count++; 629 - resource->wakeup_enabled = true; 630 - } 622 + /* 623 + * Make sure that the power resource state and its reference 624 + * counter value are consistent with each other. 625 + */ 626 + if (!resource->ref_count && 627 + !acpi_power_get_state(resource, &state) && 628 + state == ACPI_POWER_RESOURCE_STATE_ON) 629 + __acpi_power_off(resource); 630 + 631 631 if (system_level > resource->system_level) 632 632 system_level = resource->system_level; 633 633 ··· 709 711 */ 710 712 int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state) 711 713 { 712 - struct acpi_power_resource_entry *entry; 713 714 int err = 0; 714 715 715 716 if (!dev || !dev->wakeup.flags.valid) ··· 719 722 if (dev->wakeup.prepare_count++) 720 723 goto out; 721 724 722 - list_for_each_entry(entry, &dev->wakeup.resources, node) { 723 - struct acpi_power_resource *resource = entry->resource; 724 - 725 - mutex_lock(&resource->resource_lock); 726 - 727 - if (!resource->wakeup_enabled) { 728 - err = acpi_power_on_unlocked(resource); 729 - if (!err) 730 - resource->wakeup_enabled = true; 731 - } 732 - 733 - mutex_unlock(&resource->resource_lock); 734 - 735 - if (err) { 736 - dev_err(&dev->dev, 737 - "Cannot turn wakeup power resources on\n"); 738 - dev->wakeup.flags.valid = 0; 739 - goto out; 740 - } 725 + err = acpi_power_on_list(&dev->wakeup.resources); 726 + if (err) { 727 + dev_err(&dev->dev, "Cannot turn on wakeup power resources\n"); 728 + dev->wakeup.flags.valid = 0; 729 + goto out; 741 730 } 731 + 742 732 /* 743 733 * Passing 3 as the third argument below means the device may be 744 734 * put into arbitrary power state afterward. 745 735 */ 746 736 err = acpi_device_sleep_wake(dev, 1, sleep_state, 3); 747 - if (err) 737 + if (err) { 738 + acpi_power_off_list(&dev->wakeup.resources); 748 739 dev->wakeup.prepare_count = 0; 740 + } 749 741 750 742 out: 751 743 mutex_unlock(&acpi_device_lock); ··· 757 771 758 772 mutex_lock(&acpi_device_lock); 759 773 760 - if (--dev->wakeup.prepare_count > 0) 774 + if (dev->wakeup.prepare_count > 1) { 775 + dev->wakeup.prepare_count--; 761 776 goto out; 777 + } 762 778 763 - /* 764 - * Executing the code below even if prepare_count is already zero when 765 - * the function is called may be useful, for example for initialisation. 766 - */ 767 - if (dev->wakeup.prepare_count < 0) 768 - dev->wakeup.prepare_count = 0; 779 + /* Do nothing if wakeup power has not been enabled for this device. */ 780 + if (!dev->wakeup.prepare_count) 781 + goto out; 769 782 770 783 err = acpi_device_sleep_wake(dev, 0, 0, 0); 771 784 if (err) 772 785 goto out; 773 786 787 + /* 788 + * All of the power resources in the list need to be turned off even if 789 + * there are errors. 790 + */ 774 791 list_for_each_entry(entry, &dev->wakeup.resources, node) { 775 - struct acpi_power_resource *resource = entry->resource; 792 + int ret; 776 793 777 - mutex_lock(&resource->resource_lock); 778 - 779 - if (resource->wakeup_enabled) { 780 - err = acpi_power_off_unlocked(resource); 781 - if (!err) 782 - resource->wakeup_enabled = false; 783 - } 784 - 785 - mutex_unlock(&resource->resource_lock); 786 - 787 - if (err) { 788 - dev_err(&dev->dev, 789 - "Cannot turn wakeup power resources off\n"); 790 - dev->wakeup.flags.valid = 0; 791 - break; 792 - } 794 + ret = acpi_power_off(entry->resource); 795 + if (ret && !err) 796 + err = ret; 797 + } 798 + if (err) { 799 + dev_err(&dev->dev, "Cannot turn off wakeup power resources\n"); 800 + dev->wakeup.flags.valid = 0; 793 801 } 794 802 795 803 out: ··· 923 943 union acpi_object acpi_object; 924 944 struct acpi_buffer buffer = { sizeof(acpi_object), &acpi_object }; 925 945 acpi_status status; 946 + u8 state_dummy; 926 947 int result; 927 948 928 949 acpi_bus_get_device(handle, &device); ··· 951 970 resource->system_level = acpi_object.power_resource.system_level; 952 971 resource->order = acpi_object.power_resource.resource_order; 953 972 resource->state = ACPI_POWER_RESOURCE_STATE_UNKNOWN; 973 + 974 + /* Get the initial state or just flip it on if that fails. */ 975 + if (acpi_power_get_state(resource, &state_dummy)) 976 + __acpi_power_on(resource); 954 977 955 978 pr_info("%s [%s]\n", acpi_device_name(device), acpi_device_bid(device)); 956 979
+26 -9
drivers/acpi/prmt.c
··· 49 49 }; 50 50 #pragma pack() 51 51 52 - 53 52 static LIST_HEAD(prm_module_list); 54 53 55 54 struct prm_handler_info { ··· 72 73 struct prm_handler_info handlers[]; 73 74 }; 74 75 75 - 76 76 static u64 efi_pa_va_lookup(u64 pa) 77 77 { 78 78 efi_memory_desc_t *md; ··· 86 88 return 0; 87 89 } 88 90 89 - 90 91 #define get_first_handler(a) ((struct acpi_prmt_handler_info *) ((char *) (a) + a->handler_info_offset)) 91 92 #define get_next_handler(a) ((struct acpi_prmt_handler_info *) (sizeof(struct acpi_prmt_handler_info) + (char *) a)) 92 93 ··· 96 99 struct acpi_prmt_handler_info *handler_info; 97 100 struct prm_handler_info *th; 98 101 struct prm_module_info *tm; 99 - u64 mmio_count = 0; 102 + u64 *mmio_count; 100 103 u64 cur_handler = 0; 101 104 u32 module_info_size = 0; 102 105 u64 mmio_range_size = 0; ··· 105 108 module_info = (struct acpi_prmt_module_info *) header; 106 109 module_info_size = struct_size(tm, handlers, module_info->handler_info_count); 107 110 tm = kmalloc(module_info_size, GFP_KERNEL); 111 + if (!tm) 112 + goto parse_prmt_out1; 108 113 109 114 guid_copy(&tm->guid, (guid_t *) module_info->module_guid); 110 115 tm->major_rev = module_info->major_rev; ··· 119 120 * Each module is associated with a list of addr 120 121 * ranges that it can use during the service 121 122 */ 122 - mmio_count = *(u64 *) memremap(module_info->mmio_list_pointer, 8, MEMREMAP_WB); 123 - mmio_range_size = struct_size(tm->mmio_info, addr_ranges, mmio_count); 123 + mmio_count = (u64 *) memremap(module_info->mmio_list_pointer, 8, MEMREMAP_WB); 124 + if (!mmio_count) 125 + goto parse_prmt_out2; 126 + 127 + mmio_range_size = struct_size(tm->mmio_info, addr_ranges, *mmio_count); 124 128 tm->mmio_info = kmalloc(mmio_range_size, GFP_KERNEL); 129 + if (!tm->mmio_info) 130 + goto parse_prmt_out3; 131 + 125 132 temp_mmio = memremap(module_info->mmio_list_pointer, mmio_range_size, MEMREMAP_WB); 133 + if (!temp_mmio) 134 + goto parse_prmt_out4; 126 135 memmove(tm->mmio_info, temp_mmio, mmio_range_size); 127 136 } else { 128 - mmio_range_size = struct_size(tm->mmio_info, addr_ranges, mmio_count); 129 - tm->mmio_info = kmalloc(mmio_range_size, GFP_KERNEL); 137 + tm->mmio_info = kmalloc(sizeof(*tm->mmio_info), GFP_KERNEL); 138 + if (!tm->mmio_info) 139 + goto parse_prmt_out2; 140 + 130 141 tm->mmio_info->mmio_count = 0; 131 142 } 132 143 ··· 154 145 } while (++cur_handler < tm->handler_count && (handler_info = get_next_handler(handler_info))); 155 146 156 147 return 0; 148 + 149 + parse_prmt_out4: 150 + kfree(tm->mmio_info); 151 + parse_prmt_out3: 152 + memunmap(mmio_count); 153 + parse_prmt_out2: 154 + kfree(tm); 155 + parse_prmt_out1: 156 + return -ENOMEM; 157 157 } 158 158 159 159 #define GET_MODULE 0 ··· 188 170 189 171 return NULL; 190 172 } 191 - 192 173 193 174 static struct prm_module_info *find_prm_module(const guid_t *guid) 194 175 {
+2 -1
drivers/acpi/processor_idle.c
··· 789 789 state->enter = acpi_idle_enter; 790 790 791 791 state->flags = 0; 792 - if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2) { 792 + if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2 || 793 + cx->type == ACPI_STATE_C3) { 793 794 state->enter_dead = acpi_idle_play_dead; 794 795 drv->safe_state_index = count; 795 796 }
+54 -2
drivers/acpi/resource.c
··· 16 16 #include <linux/ioport.h> 17 17 #include <linux/slab.h> 18 18 #include <linux/irq.h> 19 + #include <linux/dmi.h> 19 20 20 21 #ifdef CONFIG_X86 21 22 #define valid_IRQ(i) (((i) != 0) && ((i) != 2)) ··· 381 380 } 382 381 EXPORT_SYMBOL_GPL(acpi_dev_get_irq_type); 383 382 383 + static const struct dmi_system_id medion_laptop[] = { 384 + { 385 + .ident = "MEDION P15651", 386 + .matches = { 387 + DMI_MATCH(DMI_SYS_VENDOR, "MEDION"), 388 + DMI_MATCH(DMI_BOARD_NAME, "M15T"), 389 + }, 390 + }, 391 + { 392 + .ident = "MEDION S17405", 393 + .matches = { 394 + DMI_MATCH(DMI_SYS_VENDOR, "MEDION"), 395 + DMI_MATCH(DMI_BOARD_NAME, "M17T"), 396 + }, 397 + }, 398 + { } 399 + }; 400 + 401 + struct irq_override_cmp { 402 + const struct dmi_system_id *system; 403 + unsigned char irq; 404 + unsigned char triggering; 405 + unsigned char polarity; 406 + unsigned char shareable; 407 + }; 408 + 409 + static const struct irq_override_cmp skip_override_table[] = { 410 + { medion_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0 }, 411 + }; 412 + 413 + static bool acpi_dev_irq_override(u32 gsi, u8 triggering, u8 polarity, 414 + u8 shareable) 415 + { 416 + int i; 417 + 418 + for (i = 0; i < ARRAY_SIZE(skip_override_table); i++) { 419 + const struct irq_override_cmp *entry = &skip_override_table[i]; 420 + 421 + if (dmi_check_system(entry->system) && 422 + entry->irq == gsi && 423 + entry->triggering == triggering && 424 + entry->polarity == polarity && 425 + entry->shareable == shareable) 426 + return false; 427 + } 428 + 429 + return true; 430 + } 431 + 384 432 static void acpi_dev_get_irqresource(struct resource *res, u32 gsi, 385 433 u8 triggering, u8 polarity, u8 shareable, 386 - bool legacy) 434 + bool check_override) 387 435 { 388 436 int irq, p, t; 389 437 ··· 451 401 * using extended IRQ descriptors we take the IRQ configuration 452 402 * from _CRS directly. 453 403 */ 454 - if (legacy && !acpi_get_override_irq(gsi, &t, &p)) { 404 + if (check_override && 405 + acpi_dev_irq_override(gsi, triggering, polarity, shareable) && 406 + !acpi_get_override_irq(gsi, &t, &p)) { 455 407 u8 trig = t ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE; 456 408 u8 pol = p ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH; 457 409
+6
drivers/acpi/scan.c
··· 2560 2560 } 2561 2561 } 2562 2562 2563 + /* 2564 + * Make sure that power management resources are not blocked by ACPI 2565 + * device objects with no users. 2566 + */ 2567 + bus_for_each_dev(&acpi_bus_type, NULL, NULL, acpi_dev_turn_off_if_unused); 2568 + 2563 2569 acpi_turn_off_unused_power_resources(); 2564 2570 2565 2571 acpi_scan_initialized = true;
+7 -3
drivers/acpi/sleep.c
··· 815 815 816 816 static void acpi_sleep_suspend_setup(void) 817 817 { 818 + bool suspend_ops_needed = false; 818 819 int i; 819 820 820 821 for (i = ACPI_STATE_S1; i < ACPI_STATE_S4; i++) 821 - if (acpi_sleep_state_supported(i)) 822 + if (acpi_sleep_state_supported(i)) { 822 823 sleep_states[i] = 1; 824 + suspend_ops_needed = true; 825 + } 823 826 824 - suspend_set_ops(old_suspend_ordering ? 825 - &acpi_suspend_ops_old : &acpi_suspend_ops); 827 + if (suspend_ops_needed) 828 + suspend_set_ops(old_suspend_ordering ? 829 + &acpi_suspend_ops_old : &acpi_suspend_ops); 826 830 827 831 acpi_s2idle_setup(); 828 832 }
+1 -3
drivers/gpio/gpio-amdpt.c
··· 72 72 static int pt_gpio_probe(struct platform_device *pdev) 73 73 { 74 74 struct device *dev = &pdev->dev; 75 - struct acpi_device *acpi_dev; 76 - acpi_handle handle = ACPI_HANDLE(dev); 77 75 struct pt_gpio_chip *pt_gpio; 78 76 int ret = 0; 79 77 80 - if (acpi_bus_get_device(handle, &acpi_dev)) { 78 + if (!ACPI_COMPANION(dev)) { 81 79 dev_err(dev, "PT GPIO device node not found\n"); 82 80 return -ENODEV; 83 81 }
+2 -7
drivers/gpu/drm/nouveau/nouveau_acpi.c
··· 364 364 nouveau_acpi_edid(struct drm_device *dev, struct drm_connector *connector) 365 365 { 366 366 struct acpi_device *acpidev; 367 - acpi_handle handle; 368 367 int type, ret; 369 368 void *edid; 370 369 ··· 376 377 return NULL; 377 378 } 378 379 379 - handle = ACPI_HANDLE(dev->dev); 380 - if (!handle) 381 - return NULL; 382 - 383 - ret = acpi_bus_get_device(handle, &acpidev); 384 - if (ret) 380 + acpidev = ACPI_COMPANION(dev->dev); 381 + if (!acpidev) 385 382 return NULL; 386 383 387 384 ret = acpi_video_get_edid(acpidev, type, -1, &edid);
+3 -28
drivers/pci/pci-acpi.c
··· 1356 1356 dev->external_facing = 1; 1357 1357 } 1358 1358 1359 - static void pci_acpi_setup(struct device *dev) 1359 + void pci_acpi_setup(struct device *dev, struct acpi_device *adev) 1360 1360 { 1361 1361 struct pci_dev *pci_dev = to_pci_dev(dev); 1362 - struct acpi_device *adev = ACPI_COMPANION(dev); 1363 - 1364 - if (!adev) 1365 - return; 1366 1362 1367 1363 pci_acpi_optimize_delay(pci_dev, adev->handle); 1368 1364 pci_acpi_set_external_facing(pci_dev); ··· 1382 1386 acpi_device_power_add_dependent(adev, dev); 1383 1387 } 1384 1388 1385 - static void pci_acpi_cleanup(struct device *dev) 1389 + void pci_acpi_cleanup(struct device *dev, struct acpi_device *adev) 1386 1390 { 1387 - struct acpi_device *adev = ACPI_COMPANION(dev); 1388 1391 struct pci_dev *pci_dev = to_pci_dev(dev); 1389 - 1390 - if (!adev) 1391 - return; 1392 1392 1393 1393 pci_acpi_remove_edr_notifier(pci_dev); 1394 1394 pci_acpi_remove_pm_notifier(adev); ··· 1396 1404 device_set_wakeup_capable(dev, false); 1397 1405 } 1398 1406 } 1399 - 1400 - static bool pci_acpi_bus_match(struct device *dev) 1401 - { 1402 - return dev_is_pci(dev); 1403 - } 1404 - 1405 - static struct acpi_bus_type acpi_pci_bus = { 1406 - .name = "PCI", 1407 - .match = pci_acpi_bus_match, 1408 - .find_companion = acpi_pci_find_companion, 1409 - .setup = pci_acpi_setup, 1410 - .cleanup = pci_acpi_cleanup, 1411 - }; 1412 - 1413 1407 1414 1408 static struct fwnode_handle *(*pci_msi_get_fwnode_cb)(struct device *dev); 1415 1409 ··· 1438 1460 1439 1461 static int __init acpi_pci_init(void) 1440 1462 { 1441 - int ret; 1442 - 1443 1463 if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_MSI) { 1444 1464 pr_info("ACPI FADT declares the system doesn't support MSI, so disable it\n"); 1445 1465 pci_no_msi(); ··· 1448 1472 pcie_no_aspm(); 1449 1473 } 1450 1474 1451 - ret = register_acpi_bus_type(&acpi_pci_bus); 1452 - if (ret) 1475 + if (acpi_pci_disabled) 1453 1476 return 0; 1454 1477 1455 1478 pci_set_platform_pm(&acpi_pci_platform_pm);
+2 -5
drivers/perf/qcom_l2_pmu.c
··· 840 840 { 841 841 struct platform_device *pdev = to_platform_device(dev->parent); 842 842 struct platform_device *sdev = to_platform_device(dev); 843 + struct acpi_device *adev = ACPI_COMPANION(dev); 843 844 struct l2cache_pmu *l2cache_pmu = data; 844 845 struct cluster_pmu *cluster; 845 - struct acpi_device *device; 846 846 unsigned long fw_cluster_id; 847 847 int err; 848 848 int irq; 849 849 850 - if (acpi_bus_get_device(ACPI_HANDLE(dev), &device)) 851 - return -ENODEV; 852 - 853 - if (kstrtoul(device->pnp.unique_id, 10, &fw_cluster_id) < 0) { 850 + if (!adev || kstrtoul(adev->pnp.unique_id, 10, &fw_cluster_id) < 0) { 854 851 dev_err(&pdev->dev, "unable to read ACPI uid\n"); 855 852 return -ENODEV; 856 853 }
-1
include/acpi/acpi_bus.h
··· 570 570 bool (*match)(struct device *dev); 571 571 struct acpi_device * (*find_companion)(struct device *); 572 572 void (*setup)(struct device *); 573 - void (*cleanup)(struct device *); 574 573 }; 575 574 int register_acpi_bus_type(struct acpi_bus_type *); 576 575 int unregister_acpi_bus_type(struct acpi_bus_type *);
+1 -1
include/acpi/acpixf.h
··· 12 12 13 13 /* Current ACPICA subsystem version in YYYYMMDD format */ 14 14 15 - #define ACPI_CA_VERSION 0x20210730 15 + #define ACPI_CA_VERSION 0x20210930 16 16 17 17 #include <acpi/acconfig.h> 18 18 #include <acpi/actypes.h>
+250 -1
include/acpi/actbl2.h
··· 35 35 #define ACPI_SIG_MSCT "MSCT" /* Maximum System Characteristics Table */ 36 36 #define ACPI_SIG_MSDM "MSDM" /* Microsoft Data Management Table */ 37 37 #define ACPI_SIG_NFIT "NFIT" /* NVDIMM Firmware Interface Table */ 38 + #define ACPI_SIG_NHLT "NHLT" /* Non HD Audio Link Table */ 38 39 #define ACPI_SIG_PCCT "PCCT" /* Platform Communications Channel Table */ 39 40 #define ACPI_SIG_PDTT "PDTT" /* Platform Debug Trigger Table */ 40 41 #define ACPI_SIG_PHAT "PHAT" /* Platform Health Assessment Table */ ··· 47 46 #define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */ 48 47 #define ACPI_SIG_SDEI "SDEI" /* Software Delegated Exception Interface Table */ 49 48 #define ACPI_SIG_SDEV "SDEV" /* Secure Devices table */ 50 - #define ACPI_SIG_NHLT "NHLT" /* Non-HDAudio Link Table */ 51 49 #define ACPI_SIG_SVKL "SVKL" /* Storage Volume Key Location Table */ 52 50 53 51 /* ··· 978 978 /* MADT Local APIC flags */ 979 979 980 980 #define ACPI_MADT_ENABLED (1) /* 00: Processor is usable if set */ 981 + #define ACPI_MADT_ONLINE_CAPABLE (2) /* 01: System HW supports enabling processor at runtime */ 981 982 982 983 /* MADT MPS INTI flags (inti_flags) */ 983 984 ··· 1409 1408 1410 1409 #define ACPI_NFIT_GET_NODE_ID(handle) \ 1411 1410 (((handle) & ACPI_NFIT_NODE_ID_MASK) >> ACPI_NFIT_NODE_ID_OFFSET) 1411 + 1412 + /******************************************************************************* 1413 + * 1414 + * NHLT - Non HD Audio Link Table 1415 + * 1416 + * Conforms to: Intel Smart Sound Technology NHLT Specification 1417 + * Version 0.8.1, January 2020. 1418 + * 1419 + ******************************************************************************/ 1420 + 1421 + /* Main table */ 1422 + 1423 + struct acpi_table_nhlt { 1424 + struct acpi_table_header header; /* Common ACPI table header */ 1425 + u8 endpoint_count; 1426 + }; 1427 + 1428 + struct acpi_nhlt_endpoint { 1429 + u32 descriptor_length; 1430 + u8 link_type; 1431 + u8 instance_id; 1432 + u16 vendor_id; 1433 + u16 device_id; 1434 + u16 revision_id; 1435 + u32 subsystem_id; 1436 + u8 device_type; 1437 + u8 direction; 1438 + u8 virtual_bus_id; 1439 + }; 1440 + 1441 + /* Types for link_type field above */ 1442 + 1443 + #define ACPI_NHLT_RESERVED_HD_AUDIO 0 1444 + #define ACPI_NHLT_RESERVED_DSP 1 1445 + #define ACPI_NHLT_PDM 2 1446 + #define ACPI_NHLT_SSP 3 1447 + #define ACPI_NHLT_RESERVED_SLIMBUS 4 1448 + #define ACPI_NHLT_RESERVED_SOUNDWIRE 5 1449 + #define ACPI_NHLT_TYPE_RESERVED 6 /* 6 and above are reserved */ 1450 + 1451 + /* All other values above are reserved */ 1452 + 1453 + /* Values for device_id field above */ 1454 + 1455 + #define ACPI_NHLT_PDM_DMIC 0xAE20 1456 + #define ACPI_NHLT_BT_SIDEBAND 0xAE30 1457 + #define ACPI_NHLT_I2S_TDM_CODECS 0xAE23 1458 + 1459 + /* Values for device_type field above */ 1460 + 1461 + /* SSP Link */ 1462 + 1463 + #define ACPI_NHLT_LINK_BT_SIDEBAND 0 1464 + #define ACPI_NHLT_LINK_FM 1 1465 + #define ACPI_NHLT_LINK_MODEM 2 1466 + /* 3 is reserved */ 1467 + #define ACPI_NHLT_LINK_SSP_ANALOG_CODEC 4 1468 + 1469 + /* PDM Link */ 1470 + 1471 + #define ACPI_NHLT_PDM_ON_CAVS_1P8 0 1472 + #define ACPI_NHLT_PDM_ON_CAVS_1P5 1 1473 + 1474 + /* Values for Direction field above */ 1475 + 1476 + #define ACPI_NHLT_DIR_RENDER 0 1477 + #define ACPI_NHLT_DIR_CAPTURE 1 1478 + #define ACPI_NHLT_DIR_RENDER_LOOPBACK 2 1479 + #define ACPI_NHLT_DIR_RENDER_FEEDBACK 3 1480 + #define ACPI_NHLT_DIR_RESERVED 4 /* 4 and above are reserved */ 1481 + 1482 + struct acpi_nhlt_device_specific_config { 1483 + u32 capabilities_size; 1484 + u8 virtual_slot; 1485 + u8 config_type; 1486 + }; 1487 + 1488 + struct acpi_nhlt_device_specific_config_a { 1489 + u32 capabilities_size; 1490 + u8 virtual_slot; 1491 + u8 config_type; 1492 + u8 array_type; 1493 + }; 1494 + 1495 + /* Values for Config Type above */ 1496 + 1497 + #define ACPI_NHLT_TYPE_MIC_ARRAY 0x01 1498 + #define ACPI_NHLT_TYPE_GENERIC 0x00 1499 + 1500 + /* Mask for Extension field of array_type */ 1501 + 1502 + #define ACPI_NHLT_ARRAY_TYPE_MASK 0x10 1503 + 1504 + struct acpi_nhlt_device_specific_config_b { 1505 + u32 capabilities_size; 1506 + }; 1507 + 1508 + struct acpi_nhlt_device_specific_config_c { 1509 + u32 capabilities_size; 1510 + u8 virtual_slot; 1511 + }; 1512 + 1513 + struct acpi_nhlt_wave_extensible { 1514 + u16 format_tag; 1515 + u16 channel_count; 1516 + u32 samples_per_sec; 1517 + u32 avg_bytes_per_sec; 1518 + u16 block_align; 1519 + u16 bits_per_sample; 1520 + u16 extra_format_size; 1521 + u16 valid_bits_per_sample; 1522 + u32 channel_mask; 1523 + u8 sub_format_guid[16]; 1524 + }; 1525 + 1526 + /* Values for channel_mask above */ 1527 + 1528 + #define ACPI_NHLT_SPKR_FRONT_LEFT 0x1 1529 + #define ACPI_NHLT_SPKR_FRONT_RIGHT 0x2 1530 + #define ACPI_NHLT_SPKR_FRONT_CENTER 0x4 1531 + #define ACPI_NHLT_SPKR_LOW_FREQ 0x8 1532 + #define ACPI_NHLT_SPKR_BACK_LEFT 0x10 1533 + #define ACPI_NHLT_SPKR_BACK_RIGHT 0x20 1534 + #define ACPI_NHLT_SPKR_FRONT_LEFT_OF_CENTER 0x40 1535 + #define ACPI_NHLT_SPKR_FRONT_RIGHT_OF_CENTER 0x80 1536 + #define ACPI_NHLT_SPKR_BACK_CENTER 0x100 1537 + #define ACPI_NHLT_SPKR_SIDE_LEFT 0x200 1538 + #define ACPI_NHLT_SPKR_SIDE_RIGHT 0x400 1539 + #define ACPI_NHLT_SPKR_TOP_CENTER 0x800 1540 + #define ACPI_NHLT_SPKR_TOP_FRONT_LEFT 0x1000 1541 + #define ACPI_NHLT_SPKR_TOP_FRONT_CENTER 0x2000 1542 + #define ACPI_NHLT_SPKR_TOP_FRONT_RIGHT 0x4000 1543 + #define ACPI_NHLT_SPKR_TOP_BACK_LEFT 0x8000 1544 + #define ACPI_NHLT_SPKR_TOP_BACK_CENTER 0x10000 1545 + #define ACPI_NHLT_SPKR_TOP_BACK_RIGHT 0x20000 1546 + 1547 + struct acpi_nhlt_format_config { 1548 + struct acpi_nhlt_wave_extensible format; 1549 + u32 capability_size; 1550 + u8 capabilities[]; 1551 + }; 1552 + 1553 + struct acpi_nhlt_formats_config { 1554 + u8 formats_count; 1555 + }; 1556 + 1557 + struct acpi_nhlt_device_specific_hdr { 1558 + u8 virtual_slot; 1559 + u8 config_type; 1560 + }; 1561 + 1562 + /* Types for config_type above */ 1563 + 1564 + #define ACPI_NHLT_GENERIC 0 1565 + #define ACPI_NHLT_MIC 1 1566 + #define ACPI_NHLT_RENDER 3 1567 + 1568 + struct acpi_nhlt_mic_device_specific_config { 1569 + struct acpi_nhlt_device_specific_hdr device_config; 1570 + u8 array_type_ext; 1571 + }; 1572 + 1573 + /* Values for array_type_ext above */ 1574 + 1575 + #define SMALL_LINEAR_2ELEMENT 0x0A 1576 + #define BIG_LINEAR_2ELEMENT 0x0B 1577 + #define FIRST_GEOMETRY_LINEAR_4ELEMENT 0x0C 1578 + #define PLANAR_LSHAPED_4ELEMENT 0x0D 1579 + #define SECOND_GEOMETRY_LINEAR_4ELEMENT 0x0E 1580 + #define VENDOR_DEFINED 0x0F 1581 + #define ARRAY_TYPE_MASK 0x0F 1582 + #define ARRAY_TYPE_EXT_MASK 0x10 1583 + 1584 + #define NO_EXTENSION 0x0 1585 + #define MIC_SNR_SENSITIVITY_EXT 0x1 1586 + 1587 + struct acpi_nhlt_vendor_mic_config { 1588 + u8 type; 1589 + u8 panel; 1590 + u16 speaker_position_distance; // mm 1591 + u16 horizontal_offset; // mm 1592 + u16 vertical_offset; // mm 1593 + u8 frequency_low_band; // 5*hz 1594 + u8 frequency_high_band; // 500*hz 1595 + u16 direction_angle; // -180 - + 180 1596 + u16 elevation_angle; // -180 - + 180 1597 + u16 work_vertical_angle_begin; // -180 - + 180 with 2 deg step 1598 + u16 work_vertical_angle_end; // -180 - + 180 with 2 deg step 1599 + u16 work_horizontal_angle_begin; // -180 - + 180 with 2 deg step 1600 + u16 work_horizontal_angle_end; // -180 - + 180 with 2 deg step 1601 + }; 1602 + 1603 + /* Values for Type field above */ 1604 + 1605 + #define MIC_OMNIDIRECTIONAL 0 1606 + #define MIC_SUBCARDIOID 1 1607 + #define MIC_CARDIOID 2 1608 + #define MIC_SUPER_CARDIOID 3 1609 + #define MIC_HYPER_CARDIOID 4 1610 + #define MIC_8_SHAPED 5 1611 + #define MIC_VENDOR_DEFINED 7 1612 + 1613 + /* Values for Panel field above */ 1614 + 1615 + #define MIC_TOP 0 1616 + #define MIC_BOTTOM 1 1617 + #define MIC_LEFT 2 1618 + #define MIC_RIGHT 3 1619 + #define MIC_FRONT 4 1620 + #define MIC_REAR 5 1621 + 1622 + struct acpi_nhlt_vendor_mic_device_specific_config { 1623 + struct acpi_nhlt_mic_device_specific_config mic_array_device_config; 1624 + u8 number_of_microphones; 1625 + struct acpi_nhlt_vendor_mic_config mic_config[]; // indexed by number_of_microphones 1626 + }; 1627 + 1628 + /* Microphone SNR and Sensitivity extension */ 1629 + 1630 + struct acpi_nhlt_mic_snr_sensitivity_extension { 1631 + u32 SNR; 1632 + u32 sensitivity; 1633 + }; 1634 + 1635 + struct acpi_nhlt_render_feedback_device_specific_config { 1636 + struct acpi_nhlt_device_specific_config device_config; 1637 + u8 feedback_virtual_slot; // render slot in case of capture 1638 + u16 feedback_channels; // informative only 1639 + u16 feedback_valid_bits_per_sample; 1640 + }; 1641 + 1642 + /* Linux-specific structures */ 1643 + 1644 + struct acpi_nhlt_linux_specific_count { 1645 + u8 structure_count; 1646 + }; 1647 + 1648 + struct acpi_nhlt_linux_specific_data { 1649 + u8 device_id[16]; 1650 + u8 device_instance_id; 1651 + u8 device_port_id; 1652 + u8 filler[18]; 1653 + }; 1654 + 1655 + struct acpi_nhlt_table_terminator { 1656 + u32 terminator_value; 1657 + u32 terminator_signature; 1658 + }; 1412 1659 1413 1660 /******************************************************************************* 1414 1661 *
+7 -2
include/acpi/actbl3.h
··· 191 191 ACPI_SRAT_TYPE_GICC_AFFINITY = 3, 192 192 ACPI_SRAT_TYPE_GIC_ITS_AFFINITY = 4, /* ACPI 6.2 */ 193 193 ACPI_SRAT_TYPE_GENERIC_AFFINITY = 5, /* ACPI 6.3 */ 194 - ACPI_SRAT_TYPE_RESERVED = 6 /* 5 and greater are reserved */ 194 + ACPI_SRAT_TYPE_GENERIC_PORT_AFFINITY = 6, /* ACPI 6.4 */ 195 + ACPI_SRAT_TYPE_RESERVED = 7 /* 7 and greater are reserved */ 195 196 }; 196 197 197 198 /* ··· 273 272 u32 its_id; 274 273 }; 275 274 276 - /* 5: Generic Initiator Affinity Structure (ACPI 6.3) */ 275 + /* 276 + * Common structure for SRAT subtable types: 277 + * 5: ACPI_SRAT_TYPE_GENERIC_AFFINITY 278 + * 6: ACPI_SRAT_TYPE_GENERIC_PORT_AFFINITY 279 + */ 277 280 278 281 struct acpi_srat_generic_affinity { 279 282 struct acpi_subtable_header header;
+1
include/acpi/actypes.h
··· 1281 1281 #define ACPI_OSI_WIN_10_RS4 0x12 1282 1282 #define ACPI_OSI_WIN_10_RS5 0x13 1283 1283 #define ACPI_OSI_WIN_10_19H1 0x14 1284 + #define ACPI_OSI_WIN_10_20H1 0x15 1284 1285 1285 1286 /* Definitions of getopt */ 1286 1287
-3
include/acpi/apei.h
··· 37 37 static inline void acpi_hest_init(void) { return; } 38 38 #endif 39 39 40 - typedef int (*apei_hest_func_t)(struct acpi_hest_header *hest_hdr, void *data); 41 - int apei_hest_parse(apei_hest_func_t func, void *data); 42 - 43 40 int erst_write(const struct cper_record_header *record); 44 41 ssize_t erst_get_record_count(void); 45 42 int erst_get_record_id_begin(int *pos);
+8
include/linux/pci-acpi.h
··· 84 84 void acpi_pci_add_bus(struct pci_bus *bus); 85 85 void acpi_pci_remove_bus(struct pci_bus *bus); 86 86 87 + #ifdef CONFIG_PCI 88 + void pci_acpi_setup(struct device *dev, struct acpi_device *adev); 89 + void pci_acpi_cleanup(struct device *dev, struct acpi_device *adev); 90 + #else 91 + static inline void pci_acpi_setup(struct device *dev, struct acpi_device *adev) {} 92 + static inline void pci_acpi_cleanup(struct device *dev, struct acpi_device *adev) {} 93 + #endif 94 + 87 95 #ifdef CONFIG_ACPI_PCI_SLOT 88 96 void acpi_pci_slot_init(void); 89 97 void acpi_pci_slot_enumerate(struct pci_bus *bus);