diff mbox

[3/7] pc: Add the SMBus device to the ACPI tables

Message ID 1462995966-1184-4-git-send-email-minyard@acm.org (mailing list archive)
State New, archived
Headers show

Commit Message

Corey Minyard May 11, 2016, 7:46 p.m. UTC
From: Corey Minyard <cminyard@mvista.com>

Signed-off-by: Corey Minyard <cminyard@mvista.com>
---
 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/tests/acpi-test-data/pc/DSDT b/tests/acpi-test-data/pc/DSDT
index 9d1274d3c2e2b7a316d5133d013b0550024ee413..4cd234c972dea489c453e67f7b320d09438657b5 100644
GIT binary patch
delta 63
zcmcbt{Y#t6CD<k8mnZ`R<D`vTmF#M2@xe~<0tx}no(9oPlEJ=C1|0Doo-RCW0t~Di
S@s2J*Jj@J?44a$S1Ni_qst;)Z

delta 24
fcmeyReOa5!CD<k8vM2)sqxnXzO7_jG*aP?gXB-E5

diff --git a/tests/acpi-test-data/pc/DSDT.bridge b/tests/acpi-test-data/pc/DSDT.bridge
index cf48c62aa71a7dd7d816fd4ef8ad626e39d4965c..438cd31e3de1e981c2c734dfc72981dbeee7b157 100644
GIT binary patch
delta 63
zcmbPcwbzQvCD<jzR+fQ*@zzGJN_I81_+Y1a0fhi(PlM<t$zWe61CDqPPZu6G0R~o%
Sct@8Y9%cqchRsdvQ$zs?V-D&7

delta 24
fcmdmMHO-34CD<iIOqPLxv3?_0CHv-8?2|<SS9AvZ

diff --git a/tests/acpi-test-data/pc/DSDT.ipmikcs b/tests/acpi-test-data/pc/DSDT.ipmikcs
index 280aeb3059eb9220108b9a2b7f0ac07819023b06..abacdfa3bca8843eb4c2b26afa326ebae02206c8 100644
GIT binary patch
delta 63
zcmdn2b4!QICD<h-N{oSlk!>SaCA*qhe6UlzfI@(?r$Ka+WU#N30Y|)trwb3800S#W
SyrWAH4>JQJ!{#RTjeG#?{tjRO

delta 24
gcmcbmvss7BCD<jzSd4*zarH*7O7_jG*f;P209}3uaR2}S

diff --git a/tests/acpi-test-data/q35/DSDT b/tests/acpi-test-data/q35/DSDT
index 1c089c34b06c9f2ea9fe67abb45498021319303c..9c1964afe6180e3fce7c7f9f6e78d7565c54f60f 100644
GIT binary patch
delta 63
zcmZ4Lc*c>-CD<k8i~<7#W9~+-MoBfb_+Y1a0fhi(PlM<t$zWe61CDqPPZu6G0R~o%
Sct@8Y9%cr4hRt1)((C{ts}BYM

delta 24
fcmX@(xYUu$CD<iosR9E7qrpb5M#;^aB&FB^V95s;

diff --git a/tests/acpi-test-data/q35/DSDT.bridge b/tests/acpi-test-data/q35/DSDT.bridge
index b29fcda0bb1717ff708668c6e98f3ded3f34a96c..e294f27e73f99172ec9d5d236e6abbbf15898019 100644
GIT binary patch
delta 63
zcmdnyc-N83CD<k8t^xxCBkxA8MoBfb_+Y1a0fhi(PlM<t$zWe61CDqPPZu6G0R~o%
Sct@8Y9%cr4hRt1)I_v-(KMv{u

delta 24
gcmccXxXqEvCD<ion*sv^<Ase}jgp%;NounL0Bbl0`v3p{

diff --git a/tests/acpi-test-data/q35/DSDT.ipmibt b/tests/acpi-test-data/q35/DSDT.ipmibt
index 6704538dee7dcfade6a1dc74eda5b8b832d7c6a2..d81ed0c63a0d40d854e37bda68c2328e0e213ae3 100644
GIT binary patch
delta 63
zcmeBhTJOZ=66_M9ugJi_*uRmhQBqAUKG-Q<Kq0`{(;&J@GT7J2fFs_+(}jmkfPs}G
S-q9t9hnYd1VRM&c9XkN~X%4pl

delta 24
fcmZ4Q)ZxVC66_Mfp~%3%7_^bAQF8Mp$y#;*RI~=j
diff mbox

Patch

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"