From patchwork Fri Dec 30 15:21:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 9492297 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D4D3060417 for ; Fri, 30 Dec 2016 15:44:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C80051FEBD for ; Fri, 30 Dec 2016 15:44:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BCD6420564; Fri, 30 Dec 2016 15:44:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8E23B1FEBD for ; Fri, 30 Dec 2016 15:44:01 +0000 (UTC) Received: from localhost ([::1]:40411 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMzLc-0003Sz-GA for patchwork-qemu-devel@patchwork.kernel.org; Fri, 30 Dec 2016 10:44:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43424) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMz0Y-0002RQ-On for qemu-devel@nongnu.org; Fri, 30 Dec 2016 10:22:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cMz0X-0000JR-BU for qemu-devel@nongnu.org; Fri, 30 Dec 2016 10:22:14 -0500 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:33295) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cMz0X-0000JE-3T for qemu-devel@nongnu.org; Fri, 30 Dec 2016 10:22:13 -0500 Received: by mail-pg0-x244.google.com with SMTP id g1so22376845pgn.0 for ; Fri, 30 Dec 2016 07:22:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=WHHkU1C3Hf1JX7FtzpYoQq7YsCK4vERJ4Rvi9rxaGMo=; b=L8RqHedNy/a0+2iTUOp0eZRQyXJYw0u/hYm9nrghAvGLVSH1W053MactujBp4gFQyl stjiJklOhSBPrCkcRDtAYrhtYXmbebQ45efGgiqpuBss1BDMG6xoWYtIdCEhREIjWKJs LrxFqHL9ZdcatUZYUF4iyxdpovjwbzejGSKn0fMkbODkiuX0t1DWLeMBEe7sl3coHRNF aqoUm39LaJmdD8AaVJ/DeejN3jjJ9l7vAbH81KPA1b/IYV5O8EQ+EjO9eWskuYqx9GJv qGpFEeKv53NoKXKYE7s4NndH5j7j3jy7GCcVj6zCeCNQpOEWuVESQ70tLHbLKn2uKugl WFRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=WHHkU1C3Hf1JX7FtzpYoQq7YsCK4vERJ4Rvi9rxaGMo=; b=KCkRyLD7+ql1cqZQyvJzMAdxfEREirwvWLKsoGen6LkP+EDlch57+1MHSnIO0XVfPk CMslxAFUS9pN8I11eI5JUZngafdNusT1FhPADarm/Kdq1HKbIK0b+peDNvMsebHgmDv0 aJt9gyQukFeiX9MiFVvxeIkfBVIEx4p23JLmVEDzl9QS9ErnJ/de7RH0zON/llwK6tJd sAhFFxY7B1swuOJVOF5Pqq/aCXWYIK57syhuYQft+I0LuQPRWIi4MD/7WcanlnTjtjeI yxIlStwO5zyeakNFDS2XHF88lAZal1xe1lMydlTpC2rr1MvF4syIBOBuiu3sB2+c0VAo 9IuQ== X-Gm-Message-State: AIkVDXIkUHZ9gCb77G3FQMOkkOcABOiubdVZZb04g/a2wSWut1tMtqa+/A5AzKBfZ0Yvag== X-Received: by 10.84.225.148 with SMTP id u20mr86365945plj.93.1483111332221; Fri, 30 Dec 2016 07:22:12 -0800 (PST) Received: from serve.minyard.net (serve.minyard.net. [2001:470:b8f6:1b::1]) by smtp.gmail.com with ESMTPSA id c22sm114370826pgn.12.2016.12.30.07.22.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Dec 2016 07:22:08 -0800 (PST) Received: from t430.minyard.net (unknown [IPv6:2001:470:b8f6:1b:3850:e313:ed7:8ae4]) by serve.minyard.net (Postfix) with ESMTPA id 4EA0DA28A; Fri, 30 Dec 2016 09:21:58 -0600 (CST) Received: by t430.minyard.net (Postfix, from userid 1000) id A2F29300092; Fri, 30 Dec 2016 09:21:54 -0600 (CST) From: minyard@acm.org To: qemu-devel@nongnu.org Date: Fri, 30 Dec 2016 09:21:45 -0600 Message-Id: <1483111310-24808-15-git-send-email-minyard@acm.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483111310-24808-1-git-send-email-minyard@acm.org> References: <1483111310-24808-1-git-send-email-minyard@acm.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c05::244 Subject: [Qemu-devel] [PATCH 14/19] pc: Add an SMB0 ACPI device to q35 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Corey Minyard , minyard@acm.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Corey Minyard This is so I2C devices can be found in the ACPI namespace. Currently that's only IPMI, but devices can be easily added now. Adding the devices required some PCI information, and the bus itself to be added to the PCMachineState structure. Note that this only works on Q35, the ACPI for PIIX4 is not capable of handling an SMBus device. Signed-off-by: Corey Minyard --- hw/i386/acpi-build.c | 15 +++++++++++++++ hw/i386/pc_piix.c | 12 ++++++------ hw/i386/pc_q35.c | 9 +++++---- include/hw/i386/pc.h | 2 ++ tests/acpi-test-data/q35/DSDT | Bin 8770 -> 8808 bytes tests/acpi-test-data/q35/DSDT.bridge | Bin 8787 -> 8825 bytes tests/acpi-test-data/q35/DSDT.cphp | Bin 9233 -> 9271 bytes tests/acpi-test-data/q35/DSDT.ipmibt | Bin 8845 -> 8883 bytes 8 files changed, 28 insertions(+), 10 deletions(-) diff --git a/tests/acpi-test-data/q35/DSDT b/tests/acpi-test-data/q35/DSDT index 58fbb3d2e2dc8e8256984744bfb9411feb2e35fe..113fb3a860c9465edb4cae69318fe8c063ce3077 100644 GIT binary patch delta 62 zcmX@)^1_A7CD#|tCDhM#;?^B~New0Bqt2g8%>k diff --git a/tests/acpi-test-data/q35/DSDT.cphp b/tests/acpi-test-data/q35/DSDT.cphp index a0ce6b3264c69999c6e82a8ae7bab49338e4819b..f309211c279b562a5649458ccf0c078c4660d247 100644 GIT binary patch delta 62 zcmbQ}vE75qCDsmbus && !pcmc->do_not_add_smb_acpi) { + build_smb0(dsdt, pcms->smbus, ICH9_SMB_DEV, ICH9_SMB_FUNC); + } } if (pcmc->legacy_cpu_hotplug) { diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 3bfe464..4dfb5d5 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -274,15 +274,14 @@ static void pc_init1(MachineState *machine, if (pcmc->pci_enabled && acpi_enabled) { DeviceState *piix4_pm; - I2CBus *smbus; smi_irq = qemu_allocate_irq(pc_acpi_smi_interrupt, first_cpu, 0); /* TODO: Populate SPD eeprom data. */ - smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100, - pcms->gsi[9], smi_irq, - pc_machine_is_smm_enabled(pcms), - &piix4_pm); - smbus_eeprom_init(smbus, 8, NULL, 0); + pcms->smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100, + pcms->gsi[9], smi_irq, + pc_machine_is_smm_enabled(pcms), + &piix4_pm); + smbus_eeprom_init(pcms->smbus, 8, NULL, 0); object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP, TYPE_HOTPLUG_HANDLER, @@ -466,6 +465,7 @@ static void pc_i440fx_2_6_machine_options(MachineClass *m) PCMachineClass *pcmc = PC_MACHINE_CLASS(m); pc_i440fx_2_7_machine_options(m); pcmc->legacy_cpu_hotplug = true; + pcmc->do_not_add_smb_acpi = true; SET_MACHINE_COMPAT(m, PC_COMPAT_2_6); } diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 5f67c45..7976480 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -255,10 +255,10 @@ static void pc_q35_init(MachineState *machine) if (pcms->smbus_enabled) { /* TODO: Populate SPD eeprom data. */ - smbus_eeprom_init(ich9_smb_init(host_bus, - PCI_DEVFN(ICH9_SMB_DEV, ICH9_SMB_FUNC), - 0xb100), - 8, NULL, 0); + pcms->smbus = ich9_smb_init(host_bus, + PCI_DEVFN(ICH9_SMB_DEV, ICH9_SMB_FUNC), + 0xb100); + smbus_eeprom_init(pcms->smbus, 8, NULL, 0); } pc_cmos_init(pcms, idebus[0], idebus[1], rtc_state); @@ -326,6 +326,7 @@ static void pc_q35_2_6_machine_options(MachineClass *m) PCMachineClass *pcmc = PC_MACHINE_CLASS(m); pc_q35_2_7_machine_options(m); pcmc->legacy_cpu_hotplug = true; + pcmc->do_not_add_smb_acpi = true; SET_MACHINE_COMPAT(m, PC_COMPAT_2_6); } diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index f165f69..90ba3d8 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -52,6 +52,7 @@ struct PCMachineState { HotplugHandler *acpi_dev; ISADevice *rtc; PCIBus *bus; + I2CBus *smbus; FWCfgState *fw_cfg; qemu_irq *gsi; @@ -136,6 +137,7 @@ struct PCMachineClass { bool rsdp_in_ram; int legacy_acpi_table_size; unsigned acpi_data_size; + bool do_not_add_smb_acpi; /* SMBIOS compat: */ bool smbios_defaults;