From patchwork Mon Jan 20 14:09:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 312540 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 05DE52C00AB for ; Tue, 21 Jan 2014 01:07:39 +1100 (EST) Received: from localhost ([::1]:52144 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5FVo-0000AD-Lc for incoming@patchwork.ozlabs.org; Mon, 20 Jan 2014 09:07:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43541) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5FTG-0005G9-4w for qemu-devel@nongnu.org; Mon, 20 Jan 2014 09:05:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W5FT9-00010v-21 for qemu-devel@nongnu.org; Mon, 20 Jan 2014 09:04:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57365) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5FT8-00010j-P8 for qemu-devel@nongnu.org; Mon, 20 Jan 2014 09:04:50 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s0KE4kWQ006059 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 20 Jan 2014 09:04:46 -0500 Received: from redhat.com (vpn1-4-138.ams2.redhat.com [10.36.4.138]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id s0KE4iOP024938; Mon, 20 Jan 2014 09:04:45 -0500 Date: Mon, 20 Jan 2014 16:09:25 +0200 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1390226872-781-4-git-send-email-mst@redhat.com> References: <1390226872-781-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1390226872-781-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: "Gabriel L. Somlo" , Gabriel Somlo , Anthony Liguori Subject: [Qemu-devel] [PULL 03/29] ACPI: Fix AppleSMC _STA size X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: "Gabriel L. Somlo" Minimize the storage used for AppleSMC's _STA (8bit), relying on ASL to implicitly convert it to the officially specified 32bit value. Signed-off-by: Gabriel Somlo Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 11 +++++------ hw/i386/acpi-dsdt-isa.dsl | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 30bfcd2..1d62866 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -81,7 +81,7 @@ typedef struct AcpiMiscInfo { static void acpi_get_dsdt(AcpiMiscInfo *info) { - unsigned short applesmc_sta_val, *applesmc_sta_off; + uint16_t *applesmc_sta; Object *piix = piix4_pm_find(); Object *lpc = ich9_lpc_find(); assert(!!piix != !!lpc); @@ -89,18 +89,17 @@ static void acpi_get_dsdt(AcpiMiscInfo *info) if (piix) { info->dsdt_code = AcpiDsdtAmlCode; info->dsdt_size = sizeof AcpiDsdtAmlCode; - applesmc_sta_off = piix_dsdt_applesmc_sta; + applesmc_sta = piix_dsdt_applesmc_sta; } if (lpc) { info->dsdt_code = Q35AcpiDsdtAmlCode; info->dsdt_size = sizeof Q35AcpiDsdtAmlCode; - applesmc_sta_off = q35_dsdt_applesmc_sta; + applesmc_sta = q35_dsdt_applesmc_sta; } /* Patch in appropriate value for AppleSMC _STA */ - applesmc_sta_val = applesmc_find() ? 0x0b : 0x00; - *(uint16_t *)(info->dsdt_code + *applesmc_sta_off) = - cpu_to_le16(applesmc_sta_val); + *(uint8_t *)(info->dsdt_code + *applesmc_sta) = + applesmc_find() ? 0x0b : 0x00; } static diff --git a/hw/i386/acpi-dsdt-isa.dsl b/hw/i386/acpi-dsdt-isa.dsl index 46942c1..deb37de 100644 --- a/hw/i386/acpi-dsdt-isa.dsl +++ b/hw/i386/acpi-dsdt-isa.dsl @@ -19,8 +19,8 @@ Scope(\_SB.PCI0.ISA) { Device (SMC) { Name(_HID, EisaId("APP0001")) /* _STA will be patched to 0x0B if AppleSMC is present */ - ACPI_EXTRACT_NAME_WORD_CONST DSDT_APPLESMC_STA - Name(_STA, 0xFF00) + ACPI_EXTRACT_NAME_BYTE_CONST DSDT_APPLESMC_STA + Name(_STA, 0xF0) Name(_CRS, ResourceTemplate () { IO (Decode16, 0x0300, 0x0300, 0x01, 0x20) IRQNoFlags() { 6 }