From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Richard Henderson <rth@twiddle.net>,
Paolo Bonzini <pbonzini@redhat.com>,
Anthony Liguori <aliguori@amazon.com>,
Igor Mammedov <imammedo@redhat.com>
Subject: [Qemu-devel] [PULL v3 13/26] pc: export applesmc IO port/len
Date: Mon, 2 Mar 2015 11:59:23 +0100 [thread overview]
Message-ID: <1425293287-4426-14-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1425293287-4426-1-git-send-email-mst@redhat.com>
From: Igor Mammedov <imammedo@redhat.com>
IO port and length will be used in following patch
to correctly generate SMC ACPI device in SSDT.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/hw/isa/isa.h | 11 +++++++++--
hw/i386/acpi-build.c | 2 +-
hw/misc/applesmc.c | 5 ++---
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h
index cf7bd34..f21ceaa 100644
--- a/include/hw/isa/isa.h
+++ b/include/hw/isa/isa.h
@@ -21,10 +21,17 @@
#define ISA_BUS(obj) OBJECT_CHECK(ISABus, (obj), TYPE_ISA_BUS)
#define TYPE_APPLE_SMC "isa-applesmc"
+#define APPLESMC_MAX_DATA_LENGTH 32
+#define APPLESMC_PROP_IO_BASE "iobase"
-static inline bool applesmc_find(void)
+static inline uint16_t applesmc_port(void)
{
- return object_resolve_path_type("", TYPE_APPLE_SMC, NULL);
+ Object *obj = object_resolve_path_type("", TYPE_APPLE_SMC, NULL);
+
+ if (obj) {
+ return object_property_get_int(obj, APPLESMC_PROP_IO_BASE, NULL);
+ }
+ return 0;
}
typedef struct ISADeviceClass {
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 01d988c..badfa73 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -145,7 +145,7 @@ static void acpi_get_dsdt(AcpiMiscInfo *info)
/* Patch in appropriate value for AppleSMC _STA */
*(uint8_t *)(info->dsdt_code + *applesmc_sta) =
- applesmc_find() ? 0x0b : 0x00;
+ applesmc_port() ? 0x0b : 0x00;
}
static
diff --git a/hw/misc/applesmc.c b/hw/misc/applesmc.c
index 6a56b07..6bd61e7 100644
--- a/hw/misc/applesmc.c
+++ b/hw/misc/applesmc.c
@@ -43,7 +43,6 @@
/* command/status port used by Apple SMC */
#define APPLESMC_CMD_PORT 0x4
#define APPLESMC_NR_PORTS 32
-#define APPLESMC_MAX_DATA_LENGTH 32
#define APPLESMC_READ_CMD 0x10
#define APPLESMC_WRITE_CMD 0x11
@@ -249,8 +248,8 @@ static void applesmc_isa_realize(DeviceState *dev, Error **errp)
}
static Property applesmc_isa_properties[] = {
- DEFINE_PROP_UINT32("iobase", AppleSMCState, iobase,
- APPLESMC_DEFAULT_IOBASE),
+ DEFINE_PROP_UINT32(APPLESMC_PROP_IO_BASE, AppleSMCState, iobase,
+ APPLESMC_DEFAULT_IOBASE),
DEFINE_PROP_STRING("osk", AppleSMCState, osk),
DEFINE_PROP_END_OF_LIST(),
};
--
MST
next prev parent reply other threads:[~2015-03-02 10:59 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-02 10:58 [Qemu-devel] [PULL v3 00/26] pci, pc, virtio fixes and cleanups Michael S. Tsirkin
2015-03-02 10:58 ` [Qemu-devel] [PULL v3 01/26] balloon: call qdev_alias_all_properties for proxy dev in balloon class init Michael S. Tsirkin
2015-03-02 10:58 ` [Qemu-devel] [PULL v3 02/26] tpm: Extend sts register to 32 bit Michael S. Tsirkin
2015-03-02 10:58 ` [Qemu-devel] [PULL v3 03/26] tpm: Allow 32 & 16 bit accesses to the registers Michael S. Tsirkin
2015-03-02 10:58 ` [Qemu-devel] [PULL v3 04/26] tpm: Support for XFIFO register Michael S. Tsirkin
2015-03-02 10:58 ` [Qemu-devel] [PULL v3 05/26] tpm: Support for TIS selftest done flag Michael S. Tsirkin
2015-03-02 10:58 ` [Qemu-devel] [PULL v3 06/26] tpm: Support for capability flags of TIS 1.3 Michael S. Tsirkin
2015-03-02 10:58 ` [Qemu-devel] [PULL v3 07/26] pc: acpi-build: create PCI0._CRS dynamically Michael S. Tsirkin
2015-03-02 10:58 ` [Qemu-devel] [PULL v3 08/26] pc: acpi: drop manual hole punching for PCI hotplug resources Michael S. Tsirkin
2015-03-02 10:59 ` [Qemu-devel] [PULL v3 09/26] pc: acpi: drop manual hole punching for CPU " Michael S. Tsirkin
2015-03-02 10:59 ` [Qemu-devel] [PULL v3 10/26] pc: acpi: drop manual hole punching for GPE0 resources Michael S. Tsirkin
2015-03-02 10:59 ` [Qemu-devel] [PULL v3 11/26] pc: acpi-build: drop remaining ssdt_misc template Michael S. Tsirkin
2015-03-02 10:59 ` [Qemu-devel] [PULL v3 12/26] acpi: add acpi_irq_no_flags() term Michael S. Tsirkin
2015-03-02 10:59 ` Michael S. Tsirkin [this message]
2015-03-02 10:59 ` [Qemu-devel] [PULL v3 14/26] pc: acpi-build: drop template patching and create Device(SMC) dynamically Michael S. Tsirkin
2015-03-02 10:59 ` [Qemu-devel] [PULL v3 15/26] tests: ACPI test blobs update due to PCI0._CRS changes Michael S. Tsirkin
2015-03-02 10:59 ` [Qemu-devel] [PULL v3 16/26] tests: bios-tables-test: add support for testing bridges Michael S. Tsirkin
2015-03-02 10:59 ` [Qemu-devel] [PULL v3 17/26] tests: add ACPI blobs for qemu with bridge cases Michael S. Tsirkin
2015-03-02 10:59 ` [Qemu-devel] [PULL v3 18/26] pc: acpi-build: simplify PCI bus tree generation Michael S. Tsirkin
2015-03-02 10:59 ` [Qemu-devel] [PULL v3 19/26] tests: ACPI: update pc/SSDT.bridge due to new alg of PCI tree creation Michael S. Tsirkin
2015-03-02 10:59 ` [Qemu-devel] [PULL v3 20/26] pc: acpi-build: drop template patching and create PCI bus tree dynamically Michael S. Tsirkin
2015-03-02 11:00 ` [Qemu-devel] [PULL v3 21/26] pc: acpi: remove not used anymore ssdt-[misc|pcihp].hex.generated blobs Michael S. Tsirkin
2015-03-02 11:00 ` [Qemu-devel] [PULL v3 22/26] acpi: make build_*() routines static to aml-build.c Michael S. Tsirkin
2015-03-02 11:00 ` [Qemu-devel] [PULL v3 23/26] pci: Give a few helpers internal linkage Michael S. Tsirkin
2015-03-02 11:00 ` [Qemu-devel] [PULL v3 24/26] pci-hotplug-old: Has been dead for five major releases, bury Michael S. Tsirkin
2015-03-02 11:00 ` [Qemu-devel] [PULL v3 25/26] acpi, mem-hotplug: use PC_DIMM_SLOT_PROP in acpi_memory_plug_cb() Michael S. Tsirkin
2015-03-02 11:00 ` [Qemu-devel] [PULL v3 26/26] acpi-test-data: update after pci rewrite Michael S. Tsirkin
2015-03-02 14:32 ` [Qemu-devel] [PULL v3 00/26] pci, pc, virtio fixes and cleanups Michael S. Tsirkin
2015-03-02 19:03 ` 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=1425293287-4426-14-git-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=aliguori@amazon.com \
--cc=imammedo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).