All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Aurelien Jarno <aurelien@aurel32.net>
Subject: [Qemu-devel] [PATCH v3 11/14] piix: APIs for pc guest info
Date: Wed, 24 Jul 2013 19:02:14 +0300	[thread overview]
Message-ID: <1374681580-17439-12-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1374681580-17439-1-git-send-email-mst@redhat.com>

This adds APIs that will be used to fill in guest info table,
implemented using QOM, to various piix components.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/acpi/piix4.c         | 29 +++++++++++++++++++++++++++--
 hw/mips/mips_malta.c    |  2 +-
 hw/pci-host/piix.c      |  8 ++++++++
 include/hw/i386/pc.h    |  1 +
 include/qemu/typedefs.h |  1 +
 5 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index c885690..2128f13 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -29,6 +29,7 @@
 #include "exec/ioport.h"
 #include "hw/nvram/fw_cfg.h"
 #include "exec/address-spaces.h"
+#include "hw/acpi/piix4.h"
 
 //#define DEBUG
 
@@ -63,7 +64,7 @@ typedef struct CPUStatus {
     uint8_t sts[PIIX4_PROC_LEN];
 } CPUStatus;
 
-typedef struct PIIX4PMState {
+struct PIIX4PMState {
     /*< private >*/
     PCIDevice parent_obj;
     /*< public >*/
@@ -96,7 +97,7 @@ typedef struct PIIX4PMState {
 
     CPUStatus gpe_cpu;
     Notifier cpu_added_notifier;
-} PIIX4PMState;
+};
 
 #define TYPE_PIIX4_PM "PIIX4_PM"
 
@@ -458,6 +459,30 @@ static int piix4_pm_initfn(PCIDevice *dev)
     return 0;
 }
 
+PIIX4PMState *piix4_pm_find(void)
+{
+    bool ambig;
+    Object *o = object_resolve_path_type("", "PIIX4_PM", &ambig);
+
+    if (ambig || !o) {
+        return NULL;
+    }
+    return OBJECT_CHECK(PIIX4PMState, o, "PIIX4_PM");
+}
+
+void piix4_pm_get_acpi_pm_info(PIIX4PMState *s, AcpiPmInfo *info)
+{
+        info->s3_disabled = s->disable_s3;
+        info->s4_disabled = s->disable_s4;
+        info->s4_val = s->s4_val;
+
+        info->acpi_enable_cmd = ACPI_ENABLE;
+        info->acpi_disable_cmd = ACPI_DISABLE;
+        info->gpe0_blk = GPE_BASE;
+        info->gpe0_blk_len = GPE_LEN;
+        info->sci_int = 9;
+}
+
 i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
                        qemu_irq sci_irq, qemu_irq smi_irq,
                        int kvm_enabled, FWCfgState *fw_cfg)
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index de87241..14573ab 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -965,7 +965,7 @@ void mips_malta_init(QEMUMachineInitArgs *args)
     pci_piix4_ide_init(pci_bus, hd, piix4_devfn + 1);
     pci_create_simple(pci_bus, piix4_devfn + 2, "piix4-usb-uhci");
     smbus = piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100,
-                          isa_get_irq(NULL, 9), NULL, 0, NULL);
+                          isa_get_irq(NULL, 9), NULL, 0, NULL, NULL);
     /* TODO: Populate SPD eeprom data.  */
     smbus_eeprom_init(smbus, 8, NULL, 0);
     pit = pit_init(isa_bus, 0x40, 0, NULL);
diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
index 3908860..daefdfb 100644
--- a/hw/pci-host/piix.c
+++ b/hw/pci-host/piix.c
@@ -349,6 +349,14 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn,
     return b;
 }
 
+PCIBus *find_i440fx(void)
+{
+    PCIHostState *s = OBJECT_CHECK(PCIHostState,
+                                   object_resolve_path("/machine/i440fx", NULL),
+                                   TYPE_PCI_HOST_BRIDGE);
+    return s ? s->bus : NULL;
+}
+
 /* PIIX3 PCI to ISA bridge */
 static void piix3_set_irq_pic(PIIX3State *piix3, int pic_irq)
 {
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 7c0bd50..76af5cd 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -186,6 +186,7 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn,
                     MemoryRegion *pci_memory,
                     MemoryRegion *ram_memory);
 
+PCIBus *find_i440fx(void);
 /* piix4.c */
 extern PCIDevice *piix4_dev;
 int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn);
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index cb66e19..7d42693 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -65,6 +65,7 @@ typedef struct QEMUSGList QEMUSGList;
 typedef struct SHPCDevice SHPCDevice;
 typedef struct FWCfgState FWCfgState;
 typedef struct PcGuestInfo PcGuestInfo;
+typedef struct PIIX4PMState PIIX4PMState;
 typedef struct AcpiPmInfo AcpiPmInfo;
 
 #endif /* QEMU_TYPEDEFS_H */
-- 
MST

  parent reply	other threads:[~2013-07-24 16:01 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-24 16:01 [Qemu-devel] [PATCH v3 00/14] qemu: generate acpi tables for the guest Michael S. Tsirkin
2013-07-24 16:01 ` [Qemu-devel] [PATCH v3 01/14] hw/i386/pc.c: move IO_APIC_DEFAULT_ADDRESS to include/hw/i386/apic.h Michael S. Tsirkin
2013-07-25 12:05   ` Gerd Hoffmann
2013-07-28  0:44   ` Andreas Färber
2013-07-24 16:01 ` [Qemu-devel] [PATCH v3 02/14] i386: add ACPI table files from seabios Michael S. Tsirkin
2013-07-24 16:01 ` [Qemu-devel] [PATCH v3 03/14] acpi: add rules to compile ASL source Michael S. Tsirkin
2013-07-25 12:09   ` Gerd Hoffmann
2013-07-24 16:01 ` [Qemu-devel] [PATCH v3 04/14] acpi: pre-compiled ASL files Michael S. Tsirkin
2013-07-24 16:01 ` [Qemu-devel] [PATCH v3 05/14] loader: use file path size from fw_cfg.h Michael S. Tsirkin
2013-07-24 23:42   ` Andreas Färber
2013-07-25 12:10   ` Gerd Hoffmann
2013-07-24 16:01 ` [Qemu-devel] [PATCH v3 06/14] i386: add bios linker/loader Michael S. Tsirkin
2013-07-25 12:11   ` Gerd Hoffmann
2013-07-26  9:42   ` Gerd Hoffmann
2013-07-28  8:08     ` Michael S. Tsirkin
2013-07-24 16:01 ` [Qemu-devel] [PATCH v3 07/14] loader: support for unmapped ROM blobs Michael S. Tsirkin
2013-07-25 12:14   ` Gerd Hoffmann
2013-07-25 12:28     ` Michael S. Tsirkin
2013-07-25 12:43       ` Gerd Hoffmann
2013-07-25 13:03         ` Michael S. Tsirkin
2013-07-25 19:57         ` Michael S. Tsirkin
2013-07-24 16:02 ` [Qemu-devel] [PATCH v3 08/14] loader: allow adding ROMs in done callbacks Michael S. Tsirkin
2013-07-25 12:15   ` Gerd Hoffmann
2013-07-24 16:02 ` [Qemu-devel] [PATCH v3 09/14] i386: define pc guest info Michael S. Tsirkin
2013-07-25 12:31   ` Gerd Hoffmann
2013-07-28  0:41   ` Andreas Färber
2013-07-28  7:36     ` Michael S. Tsirkin
2013-07-24 16:02 ` [Qemu-devel] [PATCH v3 10/14] ich9: APIs for " Michael S. Tsirkin
2013-07-25 12:33   ` Gerd Hoffmann
2013-07-28  0:37   ` Andreas Färber
2013-07-28  7:35     ` Michael S. Tsirkin
2013-07-24 16:02 ` Michael S. Tsirkin [this message]
2013-07-25  9:32   ` [Qemu-devel] [PATCH v3 11/14] piix: " Michael S. Tsirkin
2013-07-28  0:12     ` Andreas Färber
2013-07-28  7:30       ` Michael S. Tsirkin
2013-07-28  9:38         ` Andreas Färber
2013-07-28 10:14           ` Michael S. Tsirkin
2013-07-28 10:31             ` Andreas Färber
2013-07-28 11:08               ` Andreas Färber
2013-07-28 12:19                 ` Michael S. Tsirkin
2013-07-25 12:34   ` Gerd Hoffmann
2013-07-24 16:02 ` [Qemu-devel] [PATCH v3 12/14] pvpanic: add API to access io port Michael S. Tsirkin
2013-07-25 10:29   ` Gerd Hoffmann
2013-07-25 10:55     ` Michael S. Tsirkin
2013-07-25 10:58       ` Michael S. Tsirkin
2013-07-25 11:05       ` Gerd Hoffmann
2013-07-25 11:22         ` Michael S. Tsirkin
2013-07-25 12:03           ` Gerd Hoffmann
2013-07-25 12:23             ` Michael S. Tsirkin
2013-07-27 23:58               ` Andreas Färber
2013-07-24 16:02 ` [Qemu-devel] [PATCH v3 13/14] hpet: add API to find it Michael S. Tsirkin
2013-07-25 12:36   ` Gerd Hoffmann
2013-07-27 23:38   ` Andreas Färber
2013-07-24 16:02 ` [Qemu-devel] [PATCH v3 14/14] i386: ACPI table generation code from seabios Michael S. Tsirkin
2013-07-25 13:06   ` Gerd Hoffmann
2013-07-25 13:23     ` Michael S. Tsirkin
2013-07-25 14:58       ` Gerd Hoffmann
2013-07-25 15:14         ` Michael S. Tsirkin
2013-07-26  9:06           ` Gerd Hoffmann
2013-07-26 15:30             ` Gerd Hoffmann
2013-07-28  7:00               ` Michael S. Tsirkin
2013-07-25 15:50 ` [Qemu-devel] [PATCH v3 00/14] qemu: generate acpi tables for the guest Andreas Färber
2013-07-25 16:19   ` Michael S. Tsirkin
2013-07-26 12:19     ` Andreas Färber
2013-07-27 23:22       ` Andreas Färber
2013-09-11  9:57         ` Michael S. Tsirkin
2013-07-25 17:18   ` Michael S. Tsirkin
2013-07-26 12:25     ` Andreas Färber
2013-07-29 15:27 ` Anthony Liguori

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=1374681580-17439-12-git-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=aurelien@aurel32.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.