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

Merge tag 'acpi-5.11-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 upstream revision
20201113, fix and clean up some resources manipulation code, extend
the enumeration and gpio-line-names property documentation, clean up
the handling of _DEP during device enumeration, add a new backlight
DMI quirk, clean up transaction handling in the EC driver and make
some assorted janitorial changes.

Specifics:

- Update ACPICA code in the kernel to upstream revision 20201113 with
changes as follows:
* Add 5 new UUIDs to the known UUID table (Bob Moore)
* Remove extreaneous "the" in comments (Colin Ian King)
* Add function trace macros to improve debugging (Erik Kaneda)
* Fix interpreter memory leak (Erik Kaneda)
* Handle "orphan" _REG for GPIO OpRegions (Hans de Goede)

- Introduce resource_union() and resource_intersection() helpers and
clean up some resource-manipulation code with the help of them
(Andy Shevchenko)

- Revert problematic commit related to the handling of resources in
the ACPI core (Daniel Scally)

- Extend the ACPI device enumeration documentation and the
gpio-line-names _DSD property documentation, clean up the latter
(Flavio Suligoi)

- Clean up _DEP handling during device enumeration, modify the list
of _DEP exceptions and the handling of it and fix up terminology
related to _DEP (Hans de Goede, Rafael Wysocki)

- Eliminate in_interrupt() usage from the ACPI EC driver (Sebastian
Andrzej Siewior)

- Clean up the advance_transaction() routine and related code in the
ACPI EC driver (Rafael Wysocki)

- Add new backlight quirk for GIGABYTE GB-BXBT-2807 (Jasper St
Pierre)

- Make assorted janitorial changes in several ACPI-related pieces of
code (Hanjun Guo, Jason Yan, Punit Agrawal)"

* tag 'acpi-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (40 commits)
ACPI: scan: Fix up _DEP-related terminology with supplier/consumer
ACPI: scan: Drop INT3396 from acpi_ignore_dep_ids[]
ACPI: video: Add DMI quirk for GIGABYTE GB-BXBT-2807
Revert "ACPI / resources: Use AE_CTRL_TERMINATE to terminate resources walks"
ACPI: scan: Add PNP0D80 to the _DEP exceptions list
ACPI: scan: Call acpi_get_object_info() from acpi_add_single_object()
ACPI: scan: Add acpi_info_matches_hids() helper
ACPICA: Update version to 20201113
ACPICA: Interpreter: fix memory leak by using existing buffer
ACPICA: Add function trace macros to improve debugging
ACPICA: Also handle "orphan" _REG methods for GPIO OpRegions
ACPICA: Remove extreaneous "the" in comments
ACPICA: Add 5 new UUIDs to the known UUID table
resource: provide meaningful MODULE_LICENSE() in test suite
ASoC: Intel: catpt: Replace open coded variant of resource_intersection()
ACPI: processor: Drop duplicate setting of shared_cpu_map
ACPI: EC: Clean up status flags checks in advance_transaction()
ACPI: EC: Untangle error handling in advance_transaction()
ACPI: EC: Simplify error handling in advance_transaction()
ACPI: EC: Rename acpi_ec_is_gpe_raised()
...

+614 -253
+4 -4
Documentation/firmware-guide/acpi/dsd/leds.rst
··· 90 90 References 91 91 ========== 92 92 93 - [1] Device tree. <URL:https://www.devicetree.org>, referenced 2019-02-21. 93 + [1] Device tree. https://www.devicetree.org, referenced 2019-02-21. 94 94 95 95 [2] Advanced Configuration and Power Interface Specification. 96 - <URL:https://uefi.org/sites/default/files/resources/ACPI_6_3_final_Jan30.pdf>, 96 + https://uefi.org/sites/default/files/resources/ACPI_6_3_final_Jan30.pdf, 97 97 referenced 2019-02-21. 98 98 99 99 [3] Documentation/devicetree/bindings/leds/common.txt ··· 101 101 [4] Documentation/devicetree/bindings/media/video-interfaces.txt 102 102 103 103 [5] Device Properties UUID For _DSD. 104 - <URL:https://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf>, 104 + https://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf, 105 105 referenced 2019-02-21. 106 106 107 107 [6] Hierarchical Data Extension UUID For _DSD. 108 - <URL:https://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf>, 108 + https://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf, 109 109 referenced 2019-02-21. 110 110 111 111 [7] Documentation/firmware-guide/acpi/dsd/data-node-references.rst
+154
Documentation/firmware-guide/acpi/enumeration.rst
··· 461 461 property returned by it is meaningless. 462 462 463 463 Refer to :doc:`DSD-properties-rules` for more information. 464 + 465 + PCI hierarchy representation 466 + ============================ 467 + 468 + Sometimes could be useful to enumerate a PCI device, knowing its position on the 469 + PCI bus. 470 + 471 + For example, some systems use PCI devices soldered directly on the mother board, 472 + in a fixed position (ethernet, Wi-Fi, serial ports, etc.). In this conditions it 473 + is possible to refer to these PCI devices knowing their position on the PCI bus 474 + topology. 475 + 476 + To identify a PCI device, a complete hierarchical description is required, from 477 + the chipset root port to the final device, through all the intermediate 478 + bridges/switches of the board. 479 + 480 + For example, let us assume to have a system with a PCIe serial port, an 481 + Exar XR17V3521, soldered on the main board. This UART chip also includes 482 + 16 GPIOs and we want to add the property ``gpio-line-names`` [1] to these pins. 483 + In this case, the ``lspci`` output for this component is:: 484 + 485 + 07:00.0 Serial controller: Exar Corp. XR17V3521 Dual PCIe UART (rev 03) 486 + 487 + The complete ``lspci`` output (manually reduced in length) is:: 488 + 489 + 00:00.0 Host bridge: Intel Corp... Host Bridge (rev 0d) 490 + ... 491 + 00:13.0 PCI bridge: Intel Corp... PCI Express Port A #1 (rev fd) 492 + 00:13.1 PCI bridge: Intel Corp... PCI Express Port A #2 (rev fd) 493 + 00:13.2 PCI bridge: Intel Corp... PCI Express Port A #3 (rev fd) 494 + 00:14.0 PCI bridge: Intel Corp... PCI Express Port B #1 (rev fd) 495 + 00:14.1 PCI bridge: Intel Corp... PCI Express Port B #2 (rev fd) 496 + ... 497 + 05:00.0 PCI bridge: Pericom Semiconductor Device 2404 (rev 05) 498 + 06:01.0 PCI bridge: Pericom Semiconductor Device 2404 (rev 05) 499 + 06:02.0 PCI bridge: Pericom Semiconductor Device 2404 (rev 05) 500 + 06:03.0 PCI bridge: Pericom Semiconductor Device 2404 (rev 05) 501 + 07:00.0 Serial controller: Exar Corp. XR17V3521 Dual PCIe UART (rev 03) <-- Exar 502 + ... 503 + 504 + The bus topology is:: 505 + 506 + -[0000:00]-+-00.0 507 + ... 508 + +-13.0-[01]----00.0 509 + +-13.1-[02]----00.0 510 + +-13.2-[03]-- 511 + +-14.0-[04]----00.0 512 + +-14.1-[05-09]----00.0-[06-09]--+-01.0-[07]----00.0 <-- Exar 513 + | +-02.0-[08]----00.0 514 + | \-03.0-[09]-- 515 + ... 516 + \-1f.1 517 + 518 + To describe this Exar device on the PCI bus, we must start from the ACPI name 519 + of the chipset bridge (also called "root port") with address:: 520 + 521 + Bus: 0 - Device: 14 - Function: 1 522 + 523 + To find this information is necessary disassemble the BIOS ACPI tables, in 524 + particular the DSDT (see also [2]):: 525 + 526 + mkdir ~/tables/ 527 + cd ~/tables/ 528 + acpidump > acpidump 529 + acpixtract -a acpidump 530 + iasl -e ssdt?.* -d dsdt.dat 531 + 532 + Now, in the dsdt.dsl, we have to search the device whose address is related to 533 + 0x14 (device) and 0x01 (function). In this case we can find the following 534 + device:: 535 + 536 + Scope (_SB.PCI0) 537 + { 538 + ... other definitions follow ... 539 + Device (RP02) 540 + { 541 + Method (_ADR, 0, NotSerialized) // _ADR: Address 542 + { 543 + If ((RPA2 != Zero)) 544 + { 545 + Return (RPA2) /* \RPA2 */ 546 + } 547 + Else 548 + { 549 + Return (0x00140001) 550 + } 551 + } 552 + ... other definitions follow ... 553 + 554 + and the _ADR method [3] returns exactly the device/function couple that 555 + we are looking for. With this information and analyzing the above ``lspci`` 556 + output (both the devices list and the devices tree), we can write the following 557 + ACPI description for the Exar PCIe UART, also adding the list of its GPIO line 558 + names:: 559 + 560 + Scope (_SB.PCI0.RP02) 561 + { 562 + Device (BRG1) //Bridge 563 + { 564 + Name (_ADR, 0x0000) 565 + 566 + Device (BRG2) //Bridge 567 + { 568 + Name (_ADR, 0x00010000) 569 + 570 + Device (EXAR) 571 + { 572 + Name (_ADR, 0x0000) 573 + 574 + Name (_DSD, Package () 575 + { 576 + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 577 + Package () 578 + { 579 + Package () 580 + { 581 + "gpio-line-names", 582 + Package () 583 + { 584 + "mode_232", 585 + "mode_422", 586 + "mode_485", 587 + "misc_1", 588 + "misc_2", 589 + "misc_3", 590 + "", 591 + "", 592 + "aux_1", 593 + "aux_2", 594 + "aux_3", 595 + } 596 + } 597 + } 598 + }) 599 + } 600 + } 601 + } 602 + } 603 + 604 + The location "_SB.PCI0.RP02" is obtained by the above investigation in the 605 + dsdt.dsl table, whereas the device names "BRG1", "BRG2" and "EXAR" are 606 + created analyzing the position of the Exar UART in the PCI bus topology. 607 + 608 + References 609 + ========== 610 + 611 + [1] Documentation/firmware-guide/acpi/gpio-properties.rst 612 + 613 + [2] Documentation/admin-guide/acpi/initrd_table_override.rst 614 + 615 + [3] ACPI Specifications, Version 6.3 - Paragraph 6.1.1 _ADR Address) 616 + https://uefi.org/sites/default/files/resources/ACPI_6_3_May16.pdf, 617 + referenced 2020-11-18
+55 -1
Documentation/firmware-guide/acpi/gpio-properties.rst
··· 133 133 134 134 - gpio-line-names 135 135 136 - Example:: 136 + The ``gpio-line-names`` declaration is a list of strings ("names"), which 137 + describes each line/pin of a GPIO controller/expander. This list, contained in 138 + a package, must be inserted inside the GPIO controller declaration of an ACPI 139 + table (typically inside the DSDT). The ``gpio-line-names`` list must respect the 140 + following rules (see also the examples): 141 + 142 + - the first name in the list corresponds with the first line/pin of the GPIO 143 + controller/expander 144 + - the names inside the list must be consecutive (no "holes" are permitted) 145 + - the list can be incomplete and can end before the last GPIO line: in 146 + other words, it is not mandatory to fill all the GPIO lines 147 + - empty names are allowed (two quotation marks ``""`` correspond to an empty 148 + name) 149 + 150 + Example of a GPIO controller of 16 lines, with an incomplete list with two 151 + empty names:: 152 + 153 + Package () { 154 + "gpio-line-names", 155 + Package () { 156 + "pin_0", 157 + "pin_1", 158 + "", 159 + "", 160 + "pin_3", 161 + "pin_4_push_button", 162 + } 163 + } 164 + 165 + At runtime, the above declaration produces the following result (using the 166 + "libgpiod" tools):: 167 + 168 + root@debian:~# gpioinfo gpiochip4 169 + gpiochip4 - 16 lines: 170 + line 0: "pin_0" unused input active-high 171 + line 1: "pin_1" unused input active-high 172 + line 2: unnamed unused input active-high 173 + line 3: unnamed unused input active-high 174 + line 4: "pin_3" unused input active-high 175 + line 5: "pin_4_push_button" unused input active-high 176 + line 6: unnamed unused input active-high 177 + line 7 unnamed unused input active-high 178 + line 8: unnamed unused input active-high 179 + line 9: unnamed unused input active-high 180 + line 10: unnamed unused input active-high 181 + line 11: unnamed unused input active-high 182 + line 12: unnamed unused input active-high 183 + line 13: unnamed unused input active-high 184 + line 14: unnamed unused input active-high 185 + line 15: unnamed unused input active-high 186 + root@debian:~# gpiofind pin_4_push_button 187 + gpiochip4 5 188 + root@debian:~# 189 + 190 + Another example:: 137 191 138 192 Package () { 139 193 "gpio-line-names",
-7
drivers/acpi/acpi_dbg.c
··· 117 117 return false; 118 118 } 119 119 120 - static inline bool __acpi_aml_opened(void) 121 - { 122 - if (acpi_aml_io.flags & ACPI_AML_OPEN) 123 - return true; 124 - return false; 125 - } 126 - 127 120 static inline bool __acpi_aml_used(void) 128 121 { 129 122 return acpi_aml_io.usages ? true : false;
+1 -5
drivers/acpi/acpi_watchdog.c
··· 151 151 found = false; 152 152 resource_list_for_each_entry(rentry, &resource_list) { 153 153 if (rentry->res->flags == res.flags && 154 - resource_overlaps(rentry->res, &res)) { 155 - if (res.start < rentry->res->start) 156 - rentry->res->start = res.start; 157 - if (res.end > rentry->res->end) 158 - rentry->res->end = res.end; 154 + resource_union(rentry->res, &res, rentry->res)) { 159 155 found = true; 160 156 break; 161 157 }
+1 -1
drivers/acpi/acpica/accommon.h
··· 13 13 /* 14 14 * Common set of includes for all ACPICA source files. 15 15 * We put them here because we don't want to duplicate them 16 - * in the the source code again and again. 16 + * in the source code again and again. 17 17 * 18 18 * Note: The order of these include files is important. 19 19 */
+27 -27
drivers/acpi/acpica/evregion.c
··· 21 21 /* Local prototypes */ 22 22 23 23 static void 24 - acpi_ev_orphan_ec_reg_method(struct acpi_namespace_node *ec_device_node); 24 + acpi_ev_execute_orphan_reg_method(struct acpi_namespace_node *device_node, 25 + acpi_adr_space_type space_id); 25 26 26 27 static acpi_status 27 28 acpi_ev_reg_run(acpi_handle obj_handle, ··· 685 684 ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run, NULL, 686 685 &info, NULL); 687 686 688 - /* Special case for EC: handle "orphan" _REG methods with no region */ 689 - 690 - if (space_id == ACPI_ADR_SPACE_EC) { 691 - acpi_ev_orphan_ec_reg_method(node); 687 + /* 688 + * Special case for EC and GPIO: handle "orphan" _REG methods with 689 + * no region. 690 + */ 691 + if (space_id == ACPI_ADR_SPACE_EC || space_id == ACPI_ADR_SPACE_GPIO) { 692 + acpi_ev_execute_orphan_reg_method(node, space_id); 692 693 } 693 694 694 695 ACPI_DEBUG_PRINT_RAW((ACPI_DB_NAMES, ··· 763 760 764 761 /******************************************************************************* 765 762 * 766 - * FUNCTION: acpi_ev_orphan_ec_reg_method 763 + * FUNCTION: acpi_ev_execute_orphan_reg_method 767 764 * 768 - * PARAMETERS: ec_device_node - Namespace node for an EC device 765 + * PARAMETERS: device_node - Namespace node for an ACPI device 766 + * space_id - The address space ID 769 767 * 770 768 * RETURN: None 771 769 * 772 - * DESCRIPTION: Execute an "orphan" _REG method that appears under the EC 770 + * DESCRIPTION: Execute an "orphan" _REG method that appears under an ACPI 773 771 * device. This is a _REG method that has no corresponding region 774 - * within the EC device scope. The orphan _REG method appears to 775 - * have been enabled by the description of the ECDT in the ACPI 776 - * specification: "The availability of the region space can be 777 - * detected by providing a _REG method object underneath the 778 - * Embedded Controller device." 779 - * 780 - * To quickly access the EC device, we use the ec_device_node used 781 - * during EC handler installation. Otherwise, we would need to 782 - * perform a time consuming namespace walk, executing _HID 783 - * methods to find the EC device. 772 + * within the device's scope. ACPI tables depending on these 773 + * "orphan" _REG methods have been seen for both EC and GPIO 774 + * Operation Regions. Presumably the Windows ACPI implementation 775 + * always calls the _REG method independent of the presence of 776 + * an actual Operation Region with the correct address space ID. 784 777 * 785 778 * MUTEX: Assumes the namespace is locked 786 779 * 787 780 ******************************************************************************/ 788 781 789 782 static void 790 - acpi_ev_orphan_ec_reg_method(struct acpi_namespace_node *ec_device_node) 783 + acpi_ev_execute_orphan_reg_method(struct acpi_namespace_node *device_node, 784 + acpi_adr_space_type space_id) 791 785 { 792 786 acpi_handle reg_method; 793 787 struct acpi_namespace_node *next_node; ··· 792 792 struct acpi_object_list args; 793 793 union acpi_object objects[2]; 794 794 795 - ACPI_FUNCTION_TRACE(ev_orphan_ec_reg_method); 795 + ACPI_FUNCTION_TRACE(ev_execute_orphan_reg_method); 796 796 797 - if (!ec_device_node) { 797 + if (!device_node) { 798 798 return_VOID; 799 799 } 800 800 ··· 804 804 805 805 /* Get a handle to a _REG method immediately under the EC device */ 806 806 807 - status = acpi_get_handle(ec_device_node, METHOD_NAME__REG, &reg_method); 807 + status = acpi_get_handle(device_node, METHOD_NAME__REG, &reg_method); 808 808 if (ACPI_FAILURE(status)) { 809 809 goto exit; /* There is no _REG method present */ 810 810 } ··· 816 816 * with other space IDs to be present; but the code below will then 817 817 * execute the _REG method with the embedded_control space_ID argument. 818 818 */ 819 - next_node = acpi_ns_get_next_node(ec_device_node, NULL); 819 + next_node = acpi_ns_get_next_node(device_node, NULL); 820 820 while (next_node) { 821 821 if ((next_node->type == ACPI_TYPE_REGION) && 822 822 (next_node->object) && 823 - (next_node->object->region.space_id == ACPI_ADR_SPACE_EC)) { 823 + (next_node->object->region.space_id == space_id)) { 824 824 goto exit; /* Do not execute the _REG */ 825 825 } 826 826 827 - next_node = acpi_ns_get_next_node(ec_device_node, next_node); 827 + next_node = acpi_ns_get_next_node(device_node, next_node); 828 828 } 829 829 830 - /* Evaluate the _REG(embedded_control,Connect) method */ 830 + /* Evaluate the _REG(space_id,Connect) method */ 831 831 832 832 args.count = 2; 833 833 args.pointer = objects; 834 834 objects[0].type = ACPI_TYPE_INTEGER; 835 - objects[0].integer.value = ACPI_ADR_SPACE_EC; 835 + objects[0].integer.value = space_id; 836 836 objects[1].type = ACPI_TYPE_INTEGER; 837 837 objects[1].integer.value = ACPI_REG_CONNECT; 838 838
+6 -4
drivers/acpi/acpica/nspredef.c
··· 71 71 acpi_status status; 72 72 const union acpi_predefined_info *predefined; 73 73 74 + ACPI_FUNCTION_TRACE(ns_check_return_value); 75 + 74 76 /* If not a predefined name, we cannot validate the return object */ 75 77 76 78 predefined = info->predefined; 77 79 if (!predefined) { 78 - return (AE_OK); 80 + return_ACPI_STATUS(AE_OK); 79 81 } 80 82 81 83 /* ··· 85 83 * validate the return object 86 84 */ 87 85 if ((return_status != AE_OK) && (return_status != AE_CTRL_RETURN_VALUE)) { 88 - return (AE_OK); 86 + return_ACPI_STATUS(AE_OK); 89 87 } 90 88 91 89 /* ··· 104 102 if (acpi_gbl_disable_auto_repair || 105 103 (!predefined->info.expected_btypes) || 106 104 (predefined->info.expected_btypes == ACPI_RTYPE_ALL)) { 107 - return (AE_OK); 105 + return_ACPI_STATUS(AE_OK); 108 106 } 109 107 110 108 /* ··· 165 163 node->flags |= ANOBJ_EVALUATED; 166 164 } 167 165 168 - return (status); 166 + return_ACPI_STATUS(status); 169 167 } 170 168 171 169 /*******************************************************************************
+20 -18
drivers/acpi/acpica/nsprepkg.c
··· 59 59 u32 count; 60 60 u32 i; 61 61 62 - ACPI_FUNCTION_NAME(ns_check_package); 62 + ACPI_FUNCTION_TRACE(ns_check_package); 63 63 64 64 /* The package info for this name is in the next table entry */ 65 65 ··· 88 88 */ 89 89 if (!count) { 90 90 if (package->ret_info.type == ACPI_PTYPE1_VAR) { 91 - return (AE_OK); 91 + return_ACPI_STATUS(AE_OK); 92 92 } 93 93 94 94 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, 95 95 info->node_flags, 96 96 "Return Package has no elements (empty)")); 97 97 98 - return (AE_AML_OPERAND_VALUE); 98 + return_ACPI_STATUS(AE_AML_OPERAND_VALUE); 99 99 } 100 100 101 101 /* ··· 152 152 package->ret_info. 153 153 object_type1, i); 154 154 if (ACPI_FAILURE(status)) { 155 - return (status); 155 + return_ACPI_STATUS(status); 156 156 } 157 157 158 158 elements++; ··· 186 186 object_type[i], 187 187 i); 188 188 if (ACPI_FAILURE(status)) { 189 - return (status); 189 + return_ACPI_STATUS(status); 190 190 } 191 191 } else { 192 192 /* These are the optional package elements */ ··· 198 198 tail_object_type, 199 199 i); 200 200 if (ACPI_FAILURE(status)) { 201 - return (status); 201 + return_ACPI_STATUS(status); 202 202 } 203 203 } 204 204 ··· 214 214 acpi_ns_check_object_type(info, elements, 215 215 ACPI_RTYPE_INTEGER, 0); 216 216 if (ACPI_FAILURE(status)) { 217 - return (status); 217 + return_ACPI_STATUS(status); 218 218 } 219 219 220 220 elements++; ··· 234 234 acpi_ns_check_object_type(info, elements, 235 235 ACPI_RTYPE_INTEGER, 0); 236 236 if (ACPI_FAILURE(status)) { 237 - return (status); 237 + return_ACPI_STATUS(status); 238 238 } 239 239 240 240 /* ··· 279 279 acpi_ns_wrap_with_package(info, return_object, 280 280 return_object_ptr); 281 281 if (ACPI_FAILURE(status)) { 282 - return (status); 282 + return_ACPI_STATUS(status); 283 283 } 284 284 285 285 /* Update locals to point to the new package (of 1 element) */ ··· 316 316 package->ret_info. 317 317 object_type1, 0); 318 318 if (ACPI_FAILURE(status)) { 319 - return (status); 319 + return_ACPI_STATUS(status); 320 320 } 321 321 322 322 /* Validate length of the UUID buffer */ ··· 326 326 info->full_pathname, 327 327 info->node_flags, 328 328 "Invalid length for UUID Buffer")); 329 - return (AE_AML_OPERAND_VALUE); 329 + return_ACPI_STATUS(AE_AML_OPERAND_VALUE); 330 330 } 331 331 332 332 status = acpi_ns_check_object_type(info, elements + 1, 333 333 package->ret_info. 334 334 object_type2, 0); 335 335 if (ACPI_FAILURE(status)) { 336 - return (status); 336 + return_ACPI_STATUS(status); 337 337 } 338 338 339 339 elements += 2; ··· 350 350 "Invalid internal return type in table entry: %X", 351 351 package->ret_info.type)); 352 352 353 - return (AE_AML_INTERNAL); 353 + return_ACPI_STATUS(AE_AML_INTERNAL); 354 354 } 355 355 356 - return (status); 356 + return_ACPI_STATUS(status); 357 357 358 358 package_too_small: 359 359 ··· 363 363 "Return Package is too small - found %u elements, expected %u", 364 364 count, expected_count)); 365 365 366 - return (AE_AML_OPERAND_VALUE); 366 + return_ACPI_STATUS(AE_AML_OPERAND_VALUE); 367 367 } 368 368 369 369 /******************************************************************************* ··· 708 708 acpi_status status; 709 709 u32 i; 710 710 711 + ACPI_FUNCTION_TRACE(ns_check_package_elements); 712 + 711 713 /* 712 714 * Up to two groups of package elements are supported by the data 713 715 * structure. All elements in each group must be of the same type. ··· 719 717 status = acpi_ns_check_object_type(info, this_element, 720 718 type1, i + start_index); 721 719 if (ACPI_FAILURE(status)) { 722 - return (status); 720 + return_ACPI_STATUS(status); 723 721 } 724 722 725 723 this_element++; ··· 730 728 type2, 731 729 (i + count1 + start_index)); 732 730 if (ACPI_FAILURE(status)) { 733 - return (status); 731 + return_ACPI_STATUS(status); 734 732 } 735 733 736 734 this_element++; 737 735 } 738 736 739 - return (AE_OK); 737 + return_ACPI_STATUS(AE_OK); 740 738 }
+17 -22
drivers/acpi/acpica/nsrepair2.c
··· 155 155 const struct acpi_repair_info *predefined; 156 156 acpi_status status; 157 157 158 + ACPI_FUNCTION_TRACE(ns_complex_repairs); 159 + 158 160 /* Check if this name is in the list of repairable names */ 159 161 160 162 predefined = acpi_ns_match_complex_repair(node); 161 163 if (!predefined) { 162 - return (validate_status); 164 + return_ACPI_STATUS(validate_status); 163 165 } 164 166 165 167 status = predefined->repair_function(info, return_object_ptr); 166 - return (status); 168 + return_ACPI_STATUS(status); 167 169 } 168 170 169 171 /****************************************************************************** ··· 346 344 u16 original_ref_count; 347 345 u32 i; 348 346 347 + ACPI_FUNCTION_TRACE(ns_repair_CID); 348 + 349 349 /* Check for _CID as a simple string */ 350 350 351 351 if (return_object->common.type == ACPI_TYPE_STRING) { 352 352 status = acpi_ns_repair_HID(info, return_object_ptr); 353 - return (status); 353 + return_ACPI_STATUS(status); 354 354 } 355 355 356 356 /* Exit if not a Package */ 357 357 358 358 if (return_object->common.type != ACPI_TYPE_PACKAGE) { 359 - return (AE_OK); 359 + return_ACPI_STATUS(AE_OK); 360 360 } 361 361 362 362 /* Examine each element of the _CID package */ ··· 370 366 371 367 status = acpi_ns_repair_HID(info, element_ptr); 372 368 if (ACPI_FAILURE(status)) { 373 - return (status); 369 + return_ACPI_STATUS(status); 374 370 } 375 371 376 372 if (original_element != *element_ptr) { ··· 384 380 element_ptr++; 385 381 } 386 382 387 - return (AE_OK); 383 + return_ACPI_STATUS(AE_OK); 388 384 } 389 385 390 386 /****************************************************************************** ··· 495 491 union acpi_operand_object **return_object_ptr) 496 492 { 497 493 union acpi_operand_object *return_object = *return_object_ptr; 498 - union acpi_operand_object *new_string; 499 - char *source; 500 494 char *dest; 495 + char *source; 501 496 502 497 ACPI_FUNCTION_NAME(ns_repair_HID); 503 498 504 499 /* We only care about string _HID objects (not integers) */ 505 500 506 501 if (return_object->common.type != ACPI_TYPE_STRING) { 507 - return (AE_OK); 502 + return_ACPI_STATUS(AE_OK); 508 503 } 509 504 510 505 if (return_object->string.length == 0) { ··· 514 511 /* Return AE_OK anyway, let driver handle it */ 515 512 516 513 info->return_flags |= ACPI_OBJECT_REPAIRED; 517 - return (AE_OK); 518 - } 519 - 520 - /* It is simplest to always create a new string object */ 521 - 522 - new_string = acpi_ut_create_string_object(return_object->string.length); 523 - if (!new_string) { 524 - return (AE_NO_MEMORY); 514 + return_ACPI_STATUS(AE_OK); 525 515 } 526 516 527 517 /* ··· 526 530 source = return_object->string.pointer; 527 531 if (*source == '*') { 528 532 source++; 529 - new_string->string.length--; 533 + return_object->string.length--; 530 534 531 535 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, 532 536 "%s: Removed invalid leading asterisk\n", ··· 541 545 * "NNNN####" where N is an uppercase letter or decimal digit, and 542 546 * # is a hex digit. 543 547 */ 544 - for (dest = new_string->string.pointer; *source; dest++, source++) { 548 + for (dest = return_object->string.pointer; *source; dest++, source++) { 545 549 *dest = (char)toupper((int)*source); 546 550 } 551 + return_object->string.pointer[return_object->string.length] = 0; 547 552 548 - acpi_ut_remove_reference(return_object); 549 - *return_object_ptr = new_string; 550 - return (AE_OK); 553 + return_ACPI_STATUS(AE_OK); 551 554 } 552 555 553 556 /******************************************************************************
+1 -1
drivers/acpi/apei/apei-base.c
··· 287 287 }; 288 288 289 289 /* Collect all resources requested, to avoid conflict */ 290 - struct apei_resources apei_resources_all = { 290 + static struct apei_resources apei_resources_all = { 291 291 .iomem = LIST_HEAD_INIT(apei_resources_all.iomem), 292 292 .ioport = LIST_HEAD_INIT(apei_resources_all.ioport), 293 293 };
+53 -66
drivers/acpi/ec.c
··· 169 169 }; 170 170 171 171 static int acpi_ec_query(struct acpi_ec *ec, u8 *data); 172 - static void advance_transaction(struct acpi_ec *ec); 172 + static void advance_transaction(struct acpi_ec *ec, bool interrupt); 173 173 static void acpi_ec_event_handler(struct work_struct *work); 174 174 static void acpi_ec_event_processor(struct work_struct *work); 175 175 ··· 335 335 * GPE Registers 336 336 * -------------------------------------------------------------------------- */ 337 337 338 - static inline bool acpi_ec_is_gpe_raised(struct acpi_ec *ec) 338 + static inline bool acpi_ec_gpe_status_set(struct acpi_ec *ec) 339 339 { 340 340 acpi_event_status gpe_status = 0; 341 341 342 342 (void)acpi_get_gpe_status(NULL, ec->gpe, &gpe_status); 343 - return (gpe_status & ACPI_EVENT_FLAG_STATUS_SET) ? true : false; 343 + return !!(gpe_status & ACPI_EVENT_FLAG_STATUS_SET); 344 344 } 345 345 346 346 static inline void acpi_ec_enable_gpe(struct acpi_ec *ec, bool open) ··· 351 351 BUG_ON(ec->reference_count < 1); 352 352 acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_ENABLE); 353 353 } 354 - if (acpi_ec_is_gpe_raised(ec)) { 354 + if (acpi_ec_gpe_status_set(ec)) { 355 355 /* 356 356 * On some platforms, EN=1 writes cannot trigger GPE. So 357 357 * software need to manually trigger a pseudo GPE event on 358 358 * EN=1 writes. 359 359 */ 360 360 ec_dbg_raw("Polling quirk"); 361 - advance_transaction(ec); 361 + advance_transaction(ec, false); 362 362 } 363 363 } 364 364 ··· 370 370 BUG_ON(ec->reference_count < 1); 371 371 acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_DISABLE); 372 372 } 373 - } 374 - 375 - static inline void acpi_ec_clear_gpe(struct acpi_ec *ec) 376 - { 377 - /* 378 - * GPE STS is a W1C register, which means: 379 - * 1. Software can clear it without worrying about clearing other 380 - * GPEs' STS bits when the hardware sets them in parallel. 381 - * 2. As long as software can ensure only clearing it when it is 382 - * set, hardware won't set it in parallel. 383 - * So software can clear GPE in any contexts. 384 - * Warning: do not move the check into advance_transaction() as the 385 - * EC commands will be sent without GPE raised. 386 - */ 387 - if (!acpi_ec_is_gpe_raised(ec)) 388 - return; 389 - acpi_clear_gpe(NULL, ec->gpe); 390 373 } 391 374 392 375 /* -------------------------------------------------------------------------- ··· 471 488 * Unconditionally invoke this once after enabling the event 472 489 * handling mechanism to detect the pending events. 473 490 */ 474 - advance_transaction(ec); 491 + advance_transaction(ec, false); 475 492 } 476 493 477 494 static inline void __acpi_ec_disable_event(struct acpi_ec *ec) ··· 615 632 } 616 633 } 617 634 618 - static void advance_transaction(struct acpi_ec *ec) 635 + static void acpi_ec_spurious_interrupt(struct acpi_ec *ec, struct transaction *t) 619 636 { 620 - struct transaction *t; 621 - u8 status; 622 - bool wakeup = false; 637 + if (t->irq_count < ec_storm_threshold) 638 + ++t->irq_count; 623 639 624 - ec_dbg_stm("%s (%d)", in_interrupt() ? "IRQ" : "TASK", 625 - smp_processor_id()); 640 + /* Trigger if the threshold is 0 too. */ 641 + if (t->irq_count == ec_storm_threshold) 642 + acpi_ec_mask_events(ec); 643 + } 644 + 645 + static void advance_transaction(struct acpi_ec *ec, bool interrupt) 646 + { 647 + struct transaction *t = ec->curr; 648 + bool wakeup = false; 649 + u8 status; 650 + 651 + ec_dbg_stm("%s (%d)", interrupt ? "IRQ" : "TASK", smp_processor_id()); 652 + 626 653 /* 627 - * By always clearing STS before handling all indications, we can 628 - * ensure a hardware STS 0->1 change after this clearing can always 629 - * trigger a GPE interrupt. 654 + * Clear GPE_STS upfront to allow subsequent hardware GPE_STS 0->1 655 + * changes to always trigger a GPE interrupt. 656 + * 657 + * GPE STS is a W1C register, which means: 658 + * 659 + * 1. Software can clear it without worrying about clearing the other 660 + * GPEs' STS bits when the hardware sets them in parallel. 661 + * 662 + * 2. As long as software can ensure only clearing it when it is set, 663 + * hardware won't set it in parallel. 630 664 */ 631 - if (ec->gpe >= 0) 632 - acpi_ec_clear_gpe(ec); 665 + if (ec->gpe >= 0 && acpi_ec_gpe_status_set(ec)) 666 + acpi_clear_gpe(NULL, ec->gpe); 633 667 634 668 status = acpi_ec_read_status(ec); 635 - t = ec->curr; 669 + 636 670 /* 637 671 * Another IRQ or a guarded polling mode advancement is detected, 638 672 * the next QR_EC submission is then allowed. ··· 661 661 clear_bit(EC_FLAGS_QUERY_GUARDING, &ec->flags); 662 662 acpi_ec_complete_query(ec); 663 663 } 664 + if (!t) 665 + goto out; 664 666 } 665 - if (!t) 666 - goto err; 667 + 667 668 if (t->flags & ACPI_EC_COMMAND_POLL) { 668 669 if (t->wlen > t->wi) { 669 - if ((status & ACPI_EC_FLAG_IBF) == 0) 670 + if (!(status & ACPI_EC_FLAG_IBF)) 670 671 acpi_ec_write_data(ec, t->wdata[t->wi++]); 671 - else 672 - goto err; 672 + else if (interrupt && !(status & ACPI_EC_FLAG_SCI)) 673 + acpi_ec_spurious_interrupt(ec, t); 673 674 } else if (t->rlen > t->ri) { 674 - if ((status & ACPI_EC_FLAG_OBF) == 1) { 675 + if (status & ACPI_EC_FLAG_OBF) { 675 676 t->rdata[t->ri++] = acpi_ec_read_data(ec); 676 677 if (t->rlen == t->ri) { 677 678 ec_transaction_transition(ec, ACPI_EC_COMMAND_COMPLETE); 679 + wakeup = true; 678 680 if (t->command == ACPI_EC_COMMAND_QUERY) 679 681 ec_dbg_evt("Command(%s) completed by hardware", 680 682 acpi_ec_cmd_string(ACPI_EC_COMMAND_QUERY)); 681 - wakeup = true; 682 683 } 683 - } else 684 - goto err; 685 - } else if (t->wlen == t->wi && 686 - (status & ACPI_EC_FLAG_IBF) == 0) { 684 + } else if (interrupt && !(status & ACPI_EC_FLAG_SCI)) { 685 + acpi_ec_spurious_interrupt(ec, t); 686 + } 687 + } else if (t->wlen == t->wi && !(status & ACPI_EC_FLAG_IBF)) { 687 688 ec_transaction_transition(ec, ACPI_EC_COMMAND_COMPLETE); 688 689 wakeup = true; 689 690 } 690 - goto out; 691 691 } else if (!(status & ACPI_EC_FLAG_IBF)) { 692 692 acpi_ec_write_cmd(ec, t->command); 693 693 ec_transaction_transition(ec, ACPI_EC_COMMAND_POLL); 694 - goto out; 695 694 } 696 - err: 697 - /* 698 - * If SCI bit is set, then don't think it's a false IRQ 699 - * otherwise will take a not handled IRQ as a false one. 700 - */ 701 - if (!(status & ACPI_EC_FLAG_SCI)) { 702 - if (in_interrupt() && t) { 703 - if (t->irq_count < ec_storm_threshold) 704 - ++t->irq_count; 705 - /* Allow triggering on 0 threshold */ 706 - if (t->irq_count == ec_storm_threshold) 707 - acpi_ec_mask_events(ec); 708 - } 709 - } 695 + 710 696 out: 711 697 if (status & ACPI_EC_FLAG_SCI) 712 698 acpi_ec_submit_query(ec); 713 - if (wakeup && in_interrupt()) 699 + 700 + if (wakeup && interrupt) 714 701 wake_up(&ec->wait); 715 702 } 716 703 ··· 754 767 if (!ec_guard(ec)) 755 768 return 0; 756 769 spin_lock_irqsave(&ec->lock, flags); 757 - advance_transaction(ec); 770 + advance_transaction(ec, false); 758 771 spin_unlock_irqrestore(&ec->lock, flags); 759 772 } while (time_before(jiffies, delay)); 760 773 pr_debug("controller reset, restart transaction\n"); ··· 1203 1216 * taking care of it. 1204 1217 */ 1205 1218 if (!ec->curr) 1206 - advance_transaction(ec); 1219 + advance_transaction(ec, false); 1207 1220 spin_unlock_irqrestore(&ec->lock, flags); 1208 1221 } 1209 1222 } ··· 1246 1259 unsigned long flags; 1247 1260 1248 1261 spin_lock_irqsave(&ec->lock, flags); 1249 - advance_transaction(ec); 1262 + advance_transaction(ec, true); 1250 1263 spin_unlock_irqrestore(&ec->lock, flags); 1251 1264 } 1252 1265
+2 -1
drivers/acpi/internal.h
··· 105 105 int acpi_device_add(struct acpi_device *device, 106 106 void (*release)(struct device *)); 107 107 void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, 108 - int type, unsigned long long sta); 108 + int type, unsigned long long sta, 109 + struct acpi_device_info *info); 109 110 int acpi_device_setup_files(struct acpi_device *dev); 110 111 void acpi_device_remove_files(struct acpi_device *dev); 111 112 void acpi_device_add_finalize(struct acpi_device *device);
+1 -3
drivers/acpi/pci_root.c
··· 722 722 * our resources no longer match the ACPI _CRS, but 723 723 * the kernel resource tree doesn't allow overlaps. 724 724 */ 725 - if (resource_overlaps(res1, res2)) { 726 - res2->start = min(res1->start, res2->start); 727 - res2->end = max(res1->end, res2->end); 725 + if (resource_union(res1, res2, res2)) { 728 726 dev_info(dev, "host bridge window expanded to %pR; %pR ignored\n", 729 727 res2, res1); 730 728 free = true;
+1 -1
drivers/acpi/power.c
··· 939 939 940 940 device = &resource->device; 941 941 acpi_init_device_object(device, handle, ACPI_BUS_TYPE_POWER, 942 - ACPI_STA_DEFAULT); 942 + ACPI_STA_DEFAULT, NULL); 943 943 mutex_init(&resource->resource_lock); 944 944 INIT_LIST_HEAD(&resource->list_node); 945 945 INIT_LIST_HEAD(&resource->dependents);
-1
drivers/acpi/processor_idle.c
··· 31 31 #include <asm/apic.h> 32 32 #endif 33 33 34 - #define ACPI_PROCESSOR_CLASS "processor" 35 34 #define _COMPONENT ACPI_PROCESSOR_COMPONENT 36 35 ACPI_MODULE_NAME("processor_idle"); 37 36
-2
drivers/acpi/processor_perflib.c
··· 22 22 23 23 #define PREFIX "ACPI: " 24 24 25 - #define ACPI_PROCESSOR_CLASS "processor" 26 25 #define ACPI_PROCESSOR_FILE_PERFORMANCE "performance" 27 26 #define _COMPONENT ACPI_PROCESSOR_COMPONENT 28 27 ACPI_MODULE_NAME("processor_perflib"); ··· 615 616 continue; 616 617 617 618 pr->performance = per_cpu_ptr(performance, i); 618 - cpumask_set_cpu(i, pr->performance->shared_cpu_map); 619 619 pdomain = &(pr->performance->domain_info); 620 620 if (acpi_processor_get_psd(pr->handle, pdomain)) { 621 621 retval = -EINVAL;
-2
drivers/acpi/processor_thermal.c
··· 19 19 20 20 #define PREFIX "ACPI: " 21 21 22 - #define ACPI_PROCESSOR_CLASS "processor" 23 - 24 22 #ifdef CONFIG_CPU_FREQ 25 23 26 24 /* If a passive cooling situation is detected, primarily CPUfreq is used, as it
-1
drivers/acpi/processor_throttling.c
··· 22 22 23 23 #define PREFIX "ACPI: " 24 24 25 - #define ACPI_PROCESSOR_CLASS "processor" 26 25 #define _COMPONENT ACPI_PROCESSOR_COMPONENT 27 26 ACPI_MODULE_NAME("processor_throttling"); 28 27
+1 -1
drivers/acpi/resource.c
··· 534 534 ret = c->preproc(ares, c->preproc_data); 535 535 if (ret < 0) { 536 536 c->error = ret; 537 - return AE_CTRL_TERMINATE; 537 + return AE_ABORT_METHOD; 538 538 } else if (ret > 0) { 539 539 return AE_OK; 540 540 }
+1 -23
drivers/acpi/sbs.c
··· 711 711 }, 712 712 .drv.pm = &acpi_sbs_pm, 713 713 }; 714 - 715 - static int __init acpi_sbs_init(void) 716 - { 717 - int result = 0; 718 - 719 - if (acpi_disabled) 720 - return -ENODEV; 721 - 722 - result = acpi_bus_register_driver(&acpi_sbs_driver); 723 - if (result < 0) 724 - return -ENODEV; 725 - 726 - return 0; 727 - } 728 - 729 - static void __exit acpi_sbs_exit(void) 730 - { 731 - acpi_bus_unregister_driver(&acpi_sbs_driver); 732 - return; 733 - } 734 - 735 - module_init(acpi_sbs_init); 736 - module_exit(acpi_sbs_exit); 714 + module_acpi_driver(acpi_sbs_driver);
+55 -23
drivers/acpi/scan.c
··· 51 51 52 52 struct acpi_dep_data { 53 53 struct list_head node; 54 - acpi_handle master; 55 - acpi_handle slave; 54 + acpi_handle supplier; 55 + acpi_handle consumer; 56 56 }; 57 57 58 58 void acpi_scan_lock_acquire(void) ··· 719 719 /* -------------------------------------------------------------------------- 720 720 Device Enumeration 721 721 -------------------------------------------------------------------------- */ 722 + static bool acpi_info_matches_ids(struct acpi_device_info *info, 723 + const char * const ids[]) 724 + { 725 + struct acpi_pnp_device_id_list *cid_list = NULL; 726 + int i; 727 + 728 + if (!(info->valid & ACPI_VALID_HID)) 729 + return false; 730 + 731 + if (info->valid & ACPI_VALID_CID) 732 + cid_list = &info->compatible_id_list; 733 + 734 + for (i = 0; ids[i]; i++) { 735 + int j; 736 + 737 + if (!strcmp(info->hardware_id.string, ids[i])) 738 + return true; 739 + 740 + if (!cid_list) 741 + continue; 742 + 743 + for (j = 0; j < cid_list->count; j++) { 744 + if (!strcmp(cid_list->ids[j].string, ids[i])) 745 + return true; 746 + } 747 + } 748 + 749 + return false; 750 + } 751 + 752 + /* List of HIDs for which we ignore matching ACPI devices, when checking _DEP lists. */ 753 + static const char * const acpi_ignore_dep_ids[] = { 754 + "PNP0D80", /* Windows-compatible System Power Management Controller */ 755 + NULL 756 + }; 757 + 722 758 static struct acpi_device *acpi_bus_get_parent(acpi_handle handle) 723 759 { 724 760 struct acpi_device *device = NULL; ··· 1272 1236 } 1273 1237 1274 1238 static void acpi_set_pnp_ids(acpi_handle handle, struct acpi_device_pnp *pnp, 1275 - int device_type) 1239 + int device_type, struct acpi_device_info *info) 1276 1240 { 1277 - acpi_status status; 1278 - struct acpi_device_info *info; 1279 1241 struct acpi_pnp_device_id_list *cid_list; 1280 1242 int i; 1281 1243 ··· 1284 1250 break; 1285 1251 } 1286 1252 1287 - status = acpi_get_object_info(handle, &info); 1288 - if (ACPI_FAILURE(status)) { 1253 + if (!info) { 1289 1254 pr_err(PREFIX "%s: Error reading device info\n", 1290 1255 __func__); 1291 1256 return; ··· 1308 1275 GFP_KERNEL); 1309 1276 if (info->valid & ACPI_VALID_CLS) 1310 1277 acpi_add_id(pnp, info->class_code.string); 1311 - 1312 - kfree(info); 1313 1278 1314 1279 /* 1315 1280 * Some devices don't reliably have _HIDs & _CIDs, so add ··· 1614 1583 } 1615 1584 1616 1585 void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, 1617 - int type, unsigned long long sta) 1586 + int type, unsigned long long sta, 1587 + struct acpi_device_info *info) 1618 1588 { 1619 1589 INIT_LIST_HEAD(&device->pnp.ids); 1620 1590 device->device_type = type; ··· 1624 1592 fwnode_init(&device->fwnode, &acpi_device_fwnode_ops); 1625 1593 acpi_set_device_status(device, sta); 1626 1594 acpi_device_get_busid(device); 1627 - acpi_set_pnp_ids(handle, &device->pnp, type); 1595 + acpi_set_pnp_ids(handle, &device->pnp, type, info); 1628 1596 acpi_init_properties(device); 1629 1597 acpi_bus_get_flags(device); 1630 1598 device->flags.match_driver = false; ··· 1652 1620 int result; 1653 1621 struct acpi_device *device; 1654 1622 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 1623 + struct acpi_device_info *info = NULL; 1624 + 1625 + if (handle != ACPI_ROOT_OBJECT && type == ACPI_BUS_TYPE_DEVICE) 1626 + acpi_get_object_info(handle, &info); 1655 1627 1656 1628 device = kzalloc(sizeof(struct acpi_device), GFP_KERNEL); 1657 1629 if (!device) { 1658 1630 printk(KERN_ERR PREFIX "Memory allocation error\n"); 1631 + kfree(info); 1659 1632 return -ENOMEM; 1660 1633 } 1661 1634 1662 - acpi_init_device_object(device, handle, type, sta); 1635 + acpi_init_device_object(device, handle, type, sta, info); 1636 + kfree(info); 1663 1637 /* 1664 1638 * For ACPI_BUS_TYPE_DEVICE getting the status is delayed till here so 1665 1639 * that we can call acpi_bus_get_status() and use its quirk handling. ··· 1871 1833 continue; 1872 1834 } 1873 1835 1874 - /* 1875 - * Skip the dependency of Windows System Power 1876 - * Management Controller 1877 - */ 1878 - skip = info->valid & ACPI_VALID_HID && 1879 - !strcmp(info->hardware_id.string, "INT3396"); 1880 - 1836 + skip = acpi_info_matches_ids(info, acpi_ignore_dep_ids); 1881 1837 kfree(info); 1882 1838 1883 1839 if (skip) ··· 1881 1849 if (!dep) 1882 1850 return; 1883 1851 1884 - dep->master = dep_devices.handles[i]; 1885 - dep->slave = adev->handle; 1852 + dep->supplier = dep_devices.handles[i]; 1853 + dep->consumer = adev->handle; 1886 1854 adev->dep_unmet++; 1887 1855 1888 1856 mutex_lock(&acpi_dep_list_lock); ··· 2058 2026 2059 2027 mutex_lock(&acpi_dep_list_lock); 2060 2028 list_for_each_entry_safe(dep, tmp, &acpi_dep_list, node) { 2061 - if (dep->master == handle) { 2062 - acpi_bus_get_device(dep->slave, &adev); 2029 + if (dep->supplier == handle) { 2030 + acpi_bus_get_device(dep->consumer, &adev); 2063 2031 if (!adev) 2064 2032 continue; 2065 2033
+1 -3
drivers/acpi/tiny-power-button.c
··· 40 40 }, 41 41 }; 42 42 43 - module_driver(acpi_tiny_power_button_driver, 44 - acpi_bus_register_driver, 45 - acpi_bus_unregister_driver); 43 + module_acpi_driver(acpi_tiny_power_button_driver);
+7
drivers/acpi/video_detect.c
··· 140 140 }, 141 141 { 142 142 .callback = video_detect_force_vendor, 143 + .ident = "GIGABYTE GB-BXBT-2807", 144 + .matches = { 145 + DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"), 146 + DMI_MATCH(DMI_PRODUCT_NAME, "GB-BXBT-2807"), 147 + }, 148 + }, 149 + { 143 150 .ident = "Sony VPCEH3U1E", 144 151 .matches = { 145 152 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
+2 -10
include/acpi/acpi_drivers.h
··· 64 64 -------------------------------------------------------------------------- */ 65 65 66 66 67 - /* ACPI PCI Interrupt Link (pci_link.c) */ 67 + /* ACPI PCI Interrupt Link */ 68 68 69 69 int acpi_irq_penalty_init(void); 70 70 int acpi_pci_link_allocate_irq(acpi_handle handle, int index, int *triggering, 71 71 int *polarity, char **name); 72 72 int acpi_pci_link_free_irq(acpi_handle handle); 73 73 74 - /* ACPI PCI Device Binding (pci_bind.c) */ 74 + /* ACPI PCI Device Binding */ 75 75 76 76 struct pci_bus; 77 77 ··· 93 93 #else 94 94 static inline void pci_acpi_crs_quirks(void) { } 95 95 #endif 96 - 97 - /* -------------------------------------------------------------------------- 98 - Processor 99 - -------------------------------------------------------------------------- */ 100 - 101 - #define ACPI_PROCESSOR_LIMIT_NONE 0x00 102 - #define ACPI_PROCESSOR_LIMIT_INCREMENT 0x01 103 - #define ACPI_PROCESSOR_LIMIT_DECREMENT 0x02 104 96 105 97 /*-------------------------------------------------------------------------- 106 98 Dock Station
+1 -1
include/acpi/acpixf.h
··· 12 12 13 13 /* Current ACPICA subsystem version in YYYYMMDD format */ 14 14 15 - #define ACPI_CA_VERSION 0x20200925 15 + #define ACPI_CA_VERSION 0x20201113 16 16 17 17 #include <acpi/acconfig.h> 18 18 #include <acpi/actypes.h>
+5
include/acpi/acuuid.h
··· 39 39 40 40 /* NVDIMM - NFIT table */ 41 41 42 + #define UUID_NFIT_DIMM "4309ac30-0d11-11e4-9191-0800200c9a66" 42 43 #define UUID_VOLATILE_MEMORY "7305944f-fdda-44e3-b16c-3f22d252e5d0" 43 44 #define UUID_PERSISTENT_MEMORY "66f0d379-b4f3-4074-ac43-0d3318b78cdb" 44 45 #define UUID_CONTROL_REGION "92f701f6-13b4-405d-910b-299367e8234c" ··· 48 47 #define UUID_VOLATILE_VIRTUAL_CD "3d5abd30-4175-87ce-6d64-d2ade523c4bb" 49 48 #define UUID_PERSISTENT_VIRTUAL_DISK "5cea02c9-4d07-69d3-269f-4496fbe096f9" 50 49 #define UUID_PERSISTENT_VIRTUAL_CD "08018188-42cd-bb48-100f-5387d53ded3d" 50 + #define UUID_NFIT_DIMM_N_MSFT "1ee68b36-d4bd-4a1a-9a16-4f8e53d46e05" 51 + #define UUID_NFIT_DIMM_N_HPE1 "9002c334-acf3-4c0e-9642-a235f0d53bc6" 52 + #define UUID_NFIT_DIMM_N_HPE2 "5008664b-b758-41a0-a03c-27c2f2d04f7e" 53 + #define UUID_NFIT_DIMM_N_HYPERV "5746c5f2-a9a2-4264-ad0e-e4ddc9e09e80" 51 54 52 55 /* Processor Properties (ACPI 6.2) */ 53 56
+28 -8
include/linux/ioport.h
··· 10 10 #define _LINUX_IOPORT_H 11 11 12 12 #ifndef __ASSEMBLY__ 13 - #include <linux/compiler.h> 14 - #include <linux/types.h> 15 13 #include <linux/bits.h> 14 + #include <linux/compiler.h> 15 + #include <linux/minmax.h> 16 + #include <linux/types.h> 16 17 /* 17 18 * Resources are tree-like, allowing 18 19 * nesting etc.. ··· 230 229 return r1->start <= r2->start && r1->end >= r2->end; 231 230 } 232 231 232 + /* True if any part of r1 overlaps r2 */ 233 + static inline bool resource_overlaps(struct resource *r1, struct resource *r2) 234 + { 235 + return r1->start <= r2->end && r1->end >= r2->start; 236 + } 237 + 238 + static inline bool 239 + resource_intersection(struct resource *r1, struct resource *r2, struct resource *r) 240 + { 241 + if (!resource_overlaps(r1, r2)) 242 + return false; 243 + r->start = max(r1->start, r2->start); 244 + r->end = min(r1->end, r2->end); 245 + return true; 246 + } 247 + 248 + static inline bool 249 + resource_union(struct resource *r1, struct resource *r2, struct resource *r) 250 + { 251 + if (!resource_overlaps(r1, r2)) 252 + return false; 253 + r->start = min(r1->start, r2->start); 254 + r->end = max(r1->end, r2->end); 255 + return true; 256 + } 233 257 234 258 /* Convenience shorthand with allocation */ 235 259 #define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), 0) ··· 321 295 extern int 322 296 walk_iomem_res_desc(unsigned long desc, unsigned long flags, u64 start, u64 end, 323 297 void *arg, int (*func)(struct resource *, void *)); 324 - 325 - /* True if any part of r1 overlaps r2 */ 326 - static inline bool resource_overlaps(struct resource *r1, struct resource *r2) 327 - { 328 - return (r1->start <= r2->end && r1->end >= r2->start); 329 - } 330 298 331 299 struct resource *devm_request_free_mem_region(struct device *dev, 332 300 struct resource *base, unsigned long size);
+1
kernel/Makefile
··· 122 122 obj-$(CONFIG_RSEQ) += rseq.o 123 123 obj-$(CONFIG_WATCH_QUEUE) += watch_queue.o 124 124 125 + obj-$(CONFIG_RESOURCE_KUNIT_TEST) += resource_kunit.o 125 126 obj-$(CONFIG_SYSCTL_KUNIT_TEST) += sysctl-test.o 126 127 127 128 CFLAGS_stackleak.o += $(DISABLE_STACKLEAK_PLUGIN)
+5 -5
kernel/resource.c
··· 557 557 } 558 558 read_unlock(&resource_lock); 559 559 560 + if (type == 0) 561 + return REGION_DISJOINT; 562 + 560 563 if (other == 0) 561 - return type ? REGION_INTERSECTS : REGION_DISJOINT; 564 + return REGION_INTERSECTS; 562 565 563 - if (type) 564 - return REGION_MIXED; 565 - 566 - return REGION_DISJOINT; 566 + return REGION_MIXED; 567 567 } 568 568 EXPORT_SYMBOL_GPL(region_intersects); 569 569
+152
kernel/resource_kunit.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + /* 3 + * Test cases for API provided by resource.c and ioport.h 4 + */ 5 + 6 + #include <kunit/test.h> 7 + #include <linux/ioport.h> 8 + #include <linux/kernel.h> 9 + #include <linux/string.h> 10 + 11 + #define R0_START 0x0000 12 + #define R0_END 0xffff 13 + #define R1_START 0x1234 14 + #define R1_END 0x2345 15 + #define R2_START 0x4567 16 + #define R2_END 0x5678 17 + #define R3_START 0x6789 18 + #define R3_END 0x789a 19 + #define R4_START 0x2000 20 + #define R4_END 0x7000 21 + 22 + static struct resource r0 = { .start = R0_START, .end = R0_END }; 23 + static struct resource r1 = { .start = R1_START, .end = R1_END }; 24 + static struct resource r2 = { .start = R2_START, .end = R2_END }; 25 + static struct resource r3 = { .start = R3_START, .end = R3_END }; 26 + static struct resource r4 = { .start = R4_START, .end = R4_END }; 27 + 28 + struct result { 29 + struct resource *r1; 30 + struct resource *r2; 31 + struct resource r; 32 + bool ret; 33 + }; 34 + 35 + static struct result results_for_union[] = { 36 + { 37 + .r1 = &r1, .r2 = &r0, .r.start = R0_START, .r.end = R0_END, .ret = true, 38 + }, { 39 + .r1 = &r2, .r2 = &r0, .r.start = R0_START, .r.end = R0_END, .ret = true, 40 + }, { 41 + .r1 = &r3, .r2 = &r0, .r.start = R0_START, .r.end = R0_END, .ret = true, 42 + }, { 43 + .r1 = &r4, .r2 = &r0, .r.start = R0_START, .r.end = R0_END, .ret = true, 44 + }, { 45 + .r1 = &r2, .r2 = &r1, .ret = false, 46 + }, { 47 + .r1 = &r3, .r2 = &r1, .ret = false, 48 + }, { 49 + .r1 = &r4, .r2 = &r1, .r.start = R1_START, .r.end = R4_END, .ret = true, 50 + }, { 51 + .r1 = &r2, .r2 = &r3, .ret = false, 52 + }, { 53 + .r1 = &r2, .r2 = &r4, .r.start = R4_START, .r.end = R4_END, .ret = true, 54 + }, { 55 + .r1 = &r3, .r2 = &r4, .r.start = R4_START, .r.end = R3_END, .ret = true, 56 + }, 57 + }; 58 + 59 + static struct result results_for_intersection[] = { 60 + { 61 + .r1 = &r1, .r2 = &r0, .r.start = R1_START, .r.end = R1_END, .ret = true, 62 + }, { 63 + .r1 = &r2, .r2 = &r0, .r.start = R2_START, .r.end = R2_END, .ret = true, 64 + }, { 65 + .r1 = &r3, .r2 = &r0, .r.start = R3_START, .r.end = R3_END, .ret = true, 66 + }, { 67 + .r1 = &r4, .r2 = &r0, .r.start = R4_START, .r.end = R4_END, .ret = true, 68 + }, { 69 + .r1 = &r2, .r2 = &r1, .ret = false, 70 + }, { 71 + .r1 = &r3, .r2 = &r1, .ret = false, 72 + }, { 73 + .r1 = &r4, .r2 = &r1, .r.start = R4_START, .r.end = R1_END, .ret = true, 74 + }, { 75 + .r1 = &r2, .r2 = &r3, .ret = false, 76 + }, { 77 + .r1 = &r2, .r2 = &r4, .r.start = R2_START, .r.end = R2_END, .ret = true, 78 + }, { 79 + .r1 = &r3, .r2 = &r4, .r.start = R3_START, .r.end = R4_END, .ret = true, 80 + }, 81 + }; 82 + 83 + static void resource_do_test(struct kunit *test, bool ret, struct resource *r, 84 + bool exp_ret, struct resource *exp_r, 85 + struct resource *r1, struct resource *r2) 86 + { 87 + KUNIT_EXPECT_EQ_MSG(test, ret, exp_ret, "Resources %pR %pR", r1, r2); 88 + KUNIT_EXPECT_EQ_MSG(test, r->start, exp_r->start, "Start elements are not equal"); 89 + KUNIT_EXPECT_EQ_MSG(test, r->end, exp_r->end, "End elements are not equal"); 90 + } 91 + 92 + static void resource_do_union_test(struct kunit *test, struct result *r) 93 + { 94 + struct resource result; 95 + bool ret; 96 + 97 + memset(&result, 0, sizeof(result)); 98 + ret = resource_union(r->r1, r->r2, &result); 99 + resource_do_test(test, ret, &result, r->ret, &r->r, r->r1, r->r2); 100 + 101 + memset(&result, 0, sizeof(result)); 102 + ret = resource_union(r->r2, r->r1, &result); 103 + resource_do_test(test, ret, &result, r->ret, &r->r, r->r2, r->r1); 104 + } 105 + 106 + static void resource_test_union(struct kunit *test) 107 + { 108 + struct result *r = results_for_union; 109 + unsigned int i = 0; 110 + 111 + do { 112 + resource_do_union_test(test, &r[i]); 113 + } while (++i < ARRAY_SIZE(results_for_union)); 114 + } 115 + 116 + static void resource_do_intersection_test(struct kunit *test, struct result *r) 117 + { 118 + struct resource result; 119 + bool ret; 120 + 121 + memset(&result, 0, sizeof(result)); 122 + ret = resource_intersection(r->r1, r->r2, &result); 123 + resource_do_test(test, ret, &result, r->ret, &r->r, r->r1, r->r2); 124 + 125 + memset(&result, 0, sizeof(result)); 126 + ret = resource_intersection(r->r2, r->r1, &result); 127 + resource_do_test(test, ret, &result, r->ret, &r->r, r->r2, r->r1); 128 + } 129 + 130 + static void resource_test_intersection(struct kunit *test) 131 + { 132 + struct result *r = results_for_intersection; 133 + unsigned int i = 0; 134 + 135 + do { 136 + resource_do_intersection_test(test, &r[i]); 137 + } while (++i < ARRAY_SIZE(results_for_intersection)); 138 + } 139 + 140 + static struct kunit_case resource_test_cases[] = { 141 + KUNIT_CASE(resource_test_union), 142 + KUNIT_CASE(resource_test_intersection), 143 + {} 144 + }; 145 + 146 + static struct kunit_suite resource_test_suite = { 147 + .name = "resource", 148 + .test_cases = resource_test_cases, 149 + }; 150 + kunit_test_suite(resource_test_suite); 151 + 152 + MODULE_LICENSE("GPL");
+11
lib/Kconfig.debug
··· 2257 2257 2258 2258 If unsure, say N. 2259 2259 2260 + config RESOURCE_KUNIT_TEST 2261 + tristate "KUnit test for resource API" 2262 + depends on KUNIT 2263 + help 2264 + This builds the resource API unit test. 2265 + Tests the logic of API provided by resource.c and ioport.h. 2266 + For more information on KUnit and unit tests in general please refer 2267 + to the KUnit documentation in Documentation/dev-tools/kunit/. 2268 + 2269 + If unsure, say N. 2270 + 2260 2271 config SYSCTL_KUNIT_TEST 2261 2272 tristate "KUnit test for sysctl" if !KUNIT_ALL_TESTS 2262 2273 depends on KUNIT
-11
sound/soc/intel/catpt/core.h
··· 22 22 struct resource * 23 23 catpt_request_region(struct resource *root, resource_size_t size); 24 24 25 - static inline bool catpt_resource_overlapping(struct resource *r1, 26 - struct resource *r2, 27 - struct resource *ret) 28 - { 29 - if (!resource_overlaps(r1, r2)) 30 - return false; 31 - ret->start = max(r1->start, r2->start); 32 - ret->end = min(r1->end, r2->end); 33 - return true; 34 - } 35 - 36 25 struct catpt_ipc_msg { 37 26 union { 38 27 u32 header;
+1 -1
sound/soc/intel/catpt/loader.c
··· 267 267 r2.start = off; 268 268 r2.end = r2.start + info->size - 1; 269 269 270 - if (!catpt_resource_overlapping(&r2, &r1, &common)) 270 + if (!resource_intersection(&r2, &r1, &common)) 271 271 continue; 272 272 /* calculate start offset of common data area */ 273 273 off = common.start - r1.start;