From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60555) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0a5P-0000Lk-Dq for qemu-devel@nongnu.org; Wed, 11 May 2016 15:46:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b0a5G-000842-HS for qemu-devel@nongnu.org; Wed, 11 May 2016 15:46:22 -0400 Received: from mail-pa0-x242.google.com ([2607:f8b0:400e:c03::242]:35778) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0a5G-00083i-93 for qemu-devel@nongnu.org; Wed, 11 May 2016 15:46:14 -0400 Received: by mail-pa0-x242.google.com with SMTP id zy2so5042457pac.2 for ; Wed, 11 May 2016 12:46:14 -0700 (PDT) Sender: Corey Minyard From: minyard@acm.org Date: Wed, 11 May 2016 14:46:02 -0500 Message-Id: <1462995966-1184-4-git-send-email-minyard@acm.org> In-Reply-To: <1462995966-1184-1-git-send-email-minyard@acm.org> References: <1462995966-1184-1-git-send-email-minyard@acm.org> Subject: [Qemu-devel] [PATCH 3/7] pc: Add the SMBus device to the ACPI tables List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov , "Michael S . Tsirkin" , Paolo Bonzini , qemu-devel@nongnu.org, minyard@acm.org Cc: Corey Minyard From: Corey Minyard Signed-off-by: Corey Minyard --- hw/i386/acpi-build.c | 15 +++++++++++++++ hw/i386/pc.c | 2 ++ hw/i386/pc_piix.c | 2 ++ hw/i386/pc_q35.c | 2 ++ include/hw/i386/pc.h | 4 ++++ tests/acpi-test-data/pc/DSDT | Bin 5587 -> 5626 bytes tests/acpi-test-data/pc/DSDT.bridge | Bin 7446 -> 7485 bytes tests/acpi-test-data/pc/DSDT.ipmikcs | Bin 5683 -> 5722 bytes tests/acpi-test-data/q35/DSDT | Bin 8357 -> 8396 bytes tests/acpi-test-data/q35/DSDT.bridge | Bin 8374 -> 8413 bytes tests/acpi-test-data/q35/DSDT.ipmibt | Bin 8456 -> 8495 bytes 11 files changed, 25 insertions(+) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 2294e7b..321b26f 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1980,6 +1980,19 @@ static Aml *build_q35_osc_method(void) return method; } +static void build_smb0(Aml *table, int devnr, int func) +{ + Aml *sb_scope = aml_scope("_SB"); + Aml *pci0_scope = aml_scope("PCI0"); + Aml *dev = aml_device("SMB0"); + + aml_append(dev, aml_name_decl("_HID", aml_eisaid("APP0005"))); + aml_append(dev, aml_name_decl("_ADR", aml_int(devnr << 16 | func))); + aml_append(pci0_scope, dev); + aml_append(sb_scope, pci0_scope); + aml_append(table, sb_scope); +} + static void build_dsdt(GArray *table_data, GArray *linker, AcpiPmInfo *pm, AcpiMiscInfo *misc, @@ -2044,6 +2057,8 @@ build_dsdt(GArray *table_data, GArray *linker, build_isa_devices_aml(dsdt); build_q35_pci0_int(dsdt); } + if (pcms->pci_smbus_devnr != -1) + build_smb0(dsdt, pcms->pci_smbus_devnr, pcms->pci_smbus_func); build_cpu_hotplug_aml(dsdt); build_memory_hotplug_aml(dsdt, nr_mem, pm->mem_hp_io_base, diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 5e78ef4..deb25db 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1889,6 +1889,8 @@ static void pc_machine_initfn(Object *obj) { PCMachineState *pcms = PC_MACHINE(obj); + pcms->pci_smbus_devnr = -1; + object_property_add(obj, PC_MACHINE_MEMHP_REGION_SIZE, "int", pc_machine_get_hotplug_memory_region_size, NULL, NULL, NULL, &error_abort); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 7f50116..cf4fe53 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -261,6 +261,8 @@ static void pc_init1(MachineState *machine, pc_machine_is_smm_enabled(pcms), &piix4_pm); smbus_eeprom_init(smbus, 8, NULL, 0); + pcms->pci_smbus_devnr = piix3_devfn >> 3; + pcms->pci_smbus_func = 3; object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP, TYPE_HOTPLUG_HANDLER, diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 04aae89..5bc77d7 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -244,6 +244,8 @@ static void pc_q35_init(MachineState *machine) PCI_DEVFN(ICH9_SMB_DEV, ICH9_SMB_FUNC), 0xb100), 8, NULL, 0); + pcms->pci_smbus_devnr = ICH9_SMB_DEV; + pcms->pci_smbus_func = ICH9_SMB_FUNC; pc_cmos_init(pcms, idebus[0], idebus[1], rtc_state); diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 96f0b66..e0d2779 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -72,6 +72,10 @@ struct PCMachineState { uint64_t numa_nodes; uint64_t *node_mem; uint64_t *node_cpu; + + /* SMBus information: */ + int pci_smbus_devnr; + int pci_smbus_func; }; #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device" diff --git a/tests/acpi-test-data/pc/DSDT b/tests/acpi-test-data/pc/DSDT index 9d1274d3c2e2b7a316d5133d013b0550024ee413..4cd234c972dea489c453e67f7b320d09438657b5 100644 GIT binary patch delta 63 zcmcbt{Y#t6CDSaCA*qhe6UlzfI@(?r$Ka+WU#N30Y|)trwb3800S#W SyrWAH4>JQJ!{#RTjeG#?{tjRO delta 24 gcmcbmvss7BCD-CD