[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v2 17/32] acpi/pci: Consolidate host bridge setup
From: |
Ben Widawsky |
Subject: |
[RFC PATCH v2 17/32] acpi/pci: Consolidate host bridge setup |
Date: |
Tue, 5 Jan 2021 08:53:08 -0800 |
This cleanup will make it easier to add support for CXL to the mix.
Signed-off-by: Ben Widawsky <ben.widawsky@intel.com>
---
hw/i386/acpi-build.c | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index f18b71dea9..3c214bba67 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1194,6 +1194,20 @@ static void build_smb0(Aml *table, I2CBus *smbus, int
devnr, int func)
aml_append(table, scope);
}
+enum { PCI, PCIE };
+static void init_pci_acpi(Aml *dev, int uid, int type)
+{
+ if (type == PCI) {
+ aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03")));
+ aml_append(dev, aml_name_decl("_UID", aml_int(uid)));
+ } else {
+ aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08")));
+ aml_append(dev, aml_name_decl("_CID", aml_eisaid("PNP0A03")));
+ aml_append(dev, aml_name_decl("_UID", aml_int(uid)));
+ aml_append(dev, build_q35_osc_method());
+ }
+}
+
static void
build_dsdt(GArray *table_data, BIOSLinker *linker,
AcpiPmInfo *pm, AcpiMiscInfo *misc,
@@ -1222,9 +1236,8 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
if (misc->is_piix4) {
sb_scope = aml_scope("_SB");
dev = aml_device("PCI0");
- aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03")));
+ init_pci_acpi(dev, 0, PCI);
aml_append(dev, aml_name_decl("_ADR", aml_int(0)));
- aml_append(dev, aml_name_decl("_UID", aml_int(0)));
aml_append(sb_scope, dev);
aml_append(dsdt, sb_scope);
@@ -1238,11 +1251,8 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
} else {
sb_scope = aml_scope("_SB");
dev = aml_device("PCI0");
- aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08")));
- aml_append(dev, aml_name_decl("_CID", aml_eisaid("PNP0A03")));
+ init_pci_acpi(dev, 0, PCIE);
aml_append(dev, aml_name_decl("_ADR", aml_int(0)));
- aml_append(dev, aml_name_decl("_UID", aml_int(0)));
- aml_append(dev, build_q35_osc_method());
aml_append(sb_scope, dev);
if (pm->smi_on_cpuhp) {
@@ -1345,15 +1355,8 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
scope = aml_scope("\\_SB");
dev = aml_device("PC%.02X", bus_num);
- aml_append(dev, aml_name_decl("_UID", aml_int(bus_num)));
aml_append(dev, aml_name_decl("_BBN", aml_int(bus_num)));
- if (pci_bus_is_express(bus)) {
- aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08")));
- aml_append(dev, aml_name_decl("_CID", aml_eisaid("PNP0A03")));
- aml_append(dev, build_q35_osc_method());
- } else {
- aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03")));
- }
+ init_pci_acpi(dev, bus_num, pci_bus_is_express(bus) ? PCIE : PCI);
if (numa_node != NUMA_NODE_UNASSIGNED) {
aml_append(dev, aml_name_decl("_PXM", aml_int(numa_node)));
--
2.30.0
- [RFC PATCH v2 13/32] hw/pxb: Use a type for realizing expanders, (continued)
- [RFC PATCH v2 13/32] hw/pxb: Use a type for realizing expanders, Ben Widawsky, 2021/01/05
- [RFC PATCH v2 12/32] hw/cxl/device: Add log commands (8.2.9.4) + CEL, Ben Widawsky, 2021/01/05
- [RFC PATCH v2 32/32] qtest/cxl: Add very basic sanity tests, Ben Widawsky, 2021/01/05
- [RFC PATCH v2 30/32] tests/acpi: Add new CEDT files, Ben Widawsky, 2021/01/05
- [RFC PATCH v2 29/32] Temp: acpi/cxl: Add ACPI0017 (CEDT awareness), Ben Widawsky, 2021/01/05
- [RFC PATCH v2 14/32] hw/pci/cxl: Create a CXL bus type, Ben Widawsky, 2021/01/05
- [RFC PATCH v2 15/32] hw/pxb: Allow creation of a CXL PXB (host bridge), Ben Widawsky, 2021/01/05
- [RFC PATCH v2 31/32] WIP: i386/cxl: Initialize a host bridge, Ben Widawsky, 2021/01/05
- [RFC PATCH v2 16/32] qtest: allow DSDT acpi table changes, Ben Widawsky, 2021/01/05
- [RFC PATCH v2 18/32] tests/acpi: remove stale allowed tables, Ben Widawsky, 2021/01/05
- [RFC PATCH v2 17/32] acpi/pci: Consolidate host bridge setup,
Ben Widawsky <=
- [RFC PATCH v2 19/32] hw/pci: Plumb _UID through host bridges, Ben Widawsky, 2021/01/05
- [RFC PATCH v2 20/32] hw/cxl/component: Implement host bridge MMIO (8.2.5, table 142), Ben Widawsky, 2021/01/05
- [RFC PATCH v2 21/32] acpi/pxb/cxl: Reserve host bridge MMIO, Ben Widawsky, 2021/01/05
- [RFC PATCH v2 22/32] hw/pxb/cxl: Add "windows" for host bridges, Ben Widawsky, 2021/01/05
- [RFC PATCH v2 25/32] hw/cxl/device: Implement MMIO HDM decoding (8.2.5.12), Ben Widawsky, 2021/01/05
- [RFC PATCH v2 24/32] hw/cxl/device: Add a memory device (8.2.8.5), Ben Widawsky, 2021/01/05