Kyösti Mälkki | cf246d5 | 2021-01-21 08:17:00 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Kyösti Mälkki | fa5f9b5 | 2021-01-19 14:12:19 +0200 | [diff] [blame] | 2 | |
| 3 | #include <acpi/acpigen_extern.asl> |
Kyösti Mälkki | ae7ac8a | 2021-01-12 15:23:25 +0200 | [diff] [blame] | 4 | |
Kyösti Mälkki | 84d10cc | 2021-02-10 17:53:34 +0200 | [diff] [blame] | 5 | #if CONFIG(CHROMEOS_NVS) |
Jon Murphy | c4e9045 | 2022-06-28 10:36:23 -0600 | [diff] [blame] | 6 | /* ChromeOS specific */ |
Kyösti Mälkki | ade4f35 | 2021-01-20 23:02:16 +0200 | [diff] [blame] | 7 | #include <vendorcode/google/chromeos/acpi/chromeos.asl> |
Kyösti Mälkki | ae7ac8a | 2021-01-12 15:23:25 +0200 | [diff] [blame] | 8 | #endif |
Kyösti Mälkki | d6ccbb9 | 2021-01-15 13:46:11 +0200 | [diff] [blame] | 9 | |
Kyösti Mälkki | f6f1215 | 2020-12-29 09:04:30 +0200 | [diff] [blame] | 10 | /* Operating system enumeration. */ |
| 11 | Name (OSYS, 0) |
| 12 | |
Felix Singer | 9df60d3 | 2022-12-26 09:43:07 +0100 | [diff] [blame] | 13 | /* 0 => PIC mode, 1 => APIC Mode */ |
| 14 | Name (PICM, 0) |
Kyösti Mälkki | aa969e8 | 2021-01-25 17:05:35 +0200 | [diff] [blame] | 15 | |
Kyösti Mälkki | d6ccbb9 | 2021-01-15 13:46:11 +0200 | [diff] [blame] | 16 | /* Power state (AC = 1) */ |
Felix Singer | 7b8ac00 | 2022-12-26 08:45:56 +0100 | [diff] [blame] | 17 | Name (PWRS, 1) |
Kyösti Mälkki | d591a5a | 2021-01-25 17:05:35 +0200 | [diff] [blame] | 18 | |
| 19 | /* |
| 20 | * The _PIC method is called by the OS to choose between interrupt |
| 21 | * routing via the i8259 interrupt controller or the APIC. |
| 22 | * |
| 23 | * _PIC is called with a parameter of 0 for i8259 configuration and |
| 24 | * with a parameter of 1 for Local Apic/IOAPIC configuration. |
| 25 | */ |
| 26 | |
| 27 | Method (_PIC, 1) |
| 28 | { |
| 29 | /* Remember the OS' IRQ routing choice. */ |
| 30 | PICM = Arg0 |
| 31 | } |
Kyösti Mälkki | c92efa3 | 2021-02-14 00:06:39 +0200 | [diff] [blame] | 32 | |
Shelley Chen | 4e9bb33 | 2021-10-20 15:43:45 -0700 | [diff] [blame] | 33 | #if CONFIG(ECAM_MMCONF_SUPPORT) |
Kyösti Mälkki | c0733e1 | 2021-02-14 06:58:39 +0200 | [diff] [blame] | 34 | Scope(\_SB) { |
| 35 | /* Base address of PCIe config space */ |
Shelley Chen | 4e9bb33 | 2021-10-20 15:43:45 -0700 | [diff] [blame] | 36 | Name(PCBA, CONFIG_ECAM_MMCONF_BASE_ADDRESS) |
Kyösti Mälkki | c92efa3 | 2021-02-14 00:06:39 +0200 | [diff] [blame] | 37 | |
Kyösti Mälkki | c0733e1 | 2021-02-14 06:58:39 +0200 | [diff] [blame] | 38 | /* Length of PCIe config space, 1MB each bus */ |
Shelley Chen | 4e9bb33 | 2021-10-20 15:43:45 -0700 | [diff] [blame] | 39 | Name(PCLN, CONFIG_ECAM_MMCONF_LENGTH) |
Kyösti Mälkki | c0733e1 | 2021-02-14 06:58:39 +0200 | [diff] [blame] | 40 | |
| 41 | /* PCIe Configuration Space */ |
| 42 | OperationRegion(PCFG, SystemMemory, PCBA, PCLN) /* Each bus consumes 1MB */ |
Arthur Heymans | a9a92ac | 2023-06-08 15:22:27 +0200 | [diff] [blame] | 43 | |
| 44 | /* From the Linux documentation (Documentation/PCI/acpi-info.rst): |
| 45 | * [6] PCI Firmware 3.2, sec 4.1.2: |
| 46 | * If the operating system does not natively comprehend reserving the |
| 47 | * MMCFG region, the MMCFG region must be reserved by firmware. The |
| 48 | * address range reported in the MCFG table or by _CBA method (see Section |
| 49 | * 4.1.3) must be reserved by declaring a motherboard resource. For most |
| 50 | * systems, the motherboard resource would appear at the root of the ACPI |
| 51 | * namespace (under \_SB) in a node with a _HID of EISAID (PNP0C02), and |
| 52 | * the resources in this case should not be claimed in the root PCI bus's |
| 53 | * _CRS. The resources can optionally be returned in Int15 E820 or |
| 54 | * EFIGetMemoryMap as reserved memory but must always be reported through |
| 55 | * ACPI as a motherboard resource. |
| 56 | */ |
| 57 | Device (PERC) // PCI ECAM Resource Consumption |
| 58 | { |
| 59 | Name (_HID, EisaId("PNP0C02")) |
| 60 | Name (_CRS, ResourceTemplate() |
| 61 | { |
| 62 | Memory32Fixed (ReadWrite, CONFIG_ECAM_MMCONF_BASE_ADDRESS, |
| 63 | CONFIG_ECAM_MMCONF_LENGTH) |
| 64 | }) |
| 65 | } |
Kyösti Mälkki | c0733e1 | 2021-02-14 06:58:39 +0200 | [diff] [blame] | 66 | } |
Kyösti Mälkki | c92efa3 | 2021-02-14 00:06:39 +0200 | [diff] [blame] | 67 | #endif |