qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: minyard@acm.org
To: Igor Mammedov <imammedo@redhat.com>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org, minyard@acm.org
Cc: Corey Minyard <cminyard@mvista.com>
Subject: [Qemu-devel] [PATCH 3/7] pc: Add the SMBus device to the ACPI tables
Date: Wed, 11 May 2016 14:46:02 -0500	[thread overview]
Message-ID: <1462995966-1184-4-git-send-email-minyard@acm.org> (raw)
In-Reply-To: <1462995966-1184-1-git-send-email-minyard@acm.org>

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/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#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

-- 
2.7.4

  parent reply	other threads:[~2016-05-11 19:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-11 19:45 [Qemu-devel] [PATCH 0/7] Fix PM SMBus and add IPMI over SMBus minyard
2016-05-11 19:46 ` [Qemu-devel] [PATCH 1/7] i2c: Fix the PM SMBus driver so it actually works correctly minyard
2016-05-11 19:46 ` [Qemu-devel] [PATCH 2/7] pm_smbus: Add the ability to force block transfer enable minyard
2016-05-11 19:46 ` minyard [this message]
2016-05-11 19:46 ` [Qemu-devel] [PATCH 4/7] ipmi: Add an SMBus IPMI interface minyard
2016-05-11 19:46 ` [Qemu-devel] [PATCH 5/7] acpi: Add I2c serial bus CRS handling minyard
2016-05-12  7:30   ` Michael S. Tsirkin
2016-05-12 13:26     ` Corey Minyard
2016-05-12 13:33       ` Michael S. Tsirkin
2016-05-11 19:46 ` [Qemu-devel] [PATCH 6/7] ipmi: Fix SSIF ACPI handling to use the right CRS minyard
2016-05-12  7:33   ` Michael S. Tsirkin
2016-05-12 13:29     ` Corey Minyard
2016-05-12 13:39       ` Michael S. Tsirkin
2016-05-13 13:13         ` Corey Minyard
2016-05-11 19:46 ` [Qemu-devel] [PATCH 7/7] ipmi: Add ACPI to the SMBus IPMI device minyard
2016-05-12  7:36   ` Michael S. Tsirkin
2016-05-12 13:32     ` Corey Minyard
2016-05-12 13:35       ` Michael S. Tsirkin
2016-05-12 19:20         ` Corey Minyard
2016-05-12 19:34           ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1462995966-1184-4-git-send-email-minyard@acm.org \
    --to=minyard@acm.org \
    --cc=cminyard@mvista.com \
    --cc=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).