From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51895) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKm0a-0005j5-Ga for qemu-devel@nongnu.org; Mon, 09 Feb 2015 05:56:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKm0U-0001K5-CO for qemu-devel@nongnu.org; Mon, 09 Feb 2015 05:56:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40474) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKm0U-0001Jv-49 for qemu-devel@nongnu.org; Mon, 09 Feb 2015 05:55:58 -0500 From: Igor Mammedov Date: Mon, 9 Feb 2015 10:54:11 +0000 Message-Id: <1423479254-15342-50-git-send-email-imammedo@redhat.com> In-Reply-To: <1423479254-15342-1-git-send-email-imammedo@redhat.com> References: <1423479254-15342-1-git-send-email-imammedo@redhat.com> Subject: [Qemu-devel] [PATCH v3 49/52] pc: export applesmc IO port/len List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: drjones@redhat.com, marcel.a@redhat.com, claudio.fontana@huawei.com, mst@redhat.com, zhaoshenglong@huawei.com IO port and length will be used in following patch to correctly generate SMC ACPI device in SSDT. Signed-off-by: Igor Mammedov --- hw/i386/acpi-build.c | 2 +- hw/misc/applesmc.c | 5 ++--- include/hw/isa/isa.h | 11 +++++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 14c1c7d..26076dd 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -144,7 +144,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(), }; diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h index e0c749f..1ee9fa0 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 { -- 1.8.3.1