From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Gabriel L. Somlo" <gsomlo@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] ACPI: Fix AppleSMC _STA size
Date: Tue, 14 Jan 2014 12:46:46 +0200 [thread overview]
Message-ID: <20140114104646.GA27722@redhat.com> (raw)
In-Reply-To: <20140113202712.GL1276@ERROL.INI.CMU.EDU>
On Mon, Jan 13, 2014 at 03:27:13PM -0500, Gabriel L. Somlo wrote:
> 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 <somlo@cmu.edu>
> ---
>
> This applies incrementally on top of "Add DSDT node for AppleSMC" v.3
> (accepted Dec. 25, 2013), and obsoletes everything I've sent out since :)
>
> After some experimentation I realized ASL is flexible about the size of
> its named variables, and happy to implicitly convert an 8bit value to
> 32 bits when needed. As such, I vote for the space saving option...
>
> Thanks, and sorry for all the noise,
> Gabriel
Applied, thanks.
> hw/i386/acpi-dsdt-isa.dsl | 4 ++--
> hw/i386/acpi-build.c | 11 +++++------
> 2 files changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/hw/i386/acpi-dsdt-isa.dsl b/hw/i386/acpi-dsdt-isa.dsl
> index 46942c1..3a6e100 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 }
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 30bfcd2..9e5733e 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
> --
> 1.8.1.4
prev parent reply other threads:[~2014-01-14 10:47 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-20 15:54 [Qemu-devel] [PATCH] Add DSDT node for AppleSMC Gabriel L. Somlo
2013-12-20 16:39 ` Alexander Graf
2013-12-20 20:52 ` [Qemu-devel] [PATCH v2] " Gabriel L. Somlo
2013-12-20 21:38 ` Igor Mammedov
2013-12-22 15:34 ` Gabriel L. Somlo
2013-12-22 11:07 ` Michael S. Tsirkin
2013-12-22 15:34 ` [Qemu-devel] [PATCH v3] " Gabriel L. Somlo
2013-12-22 15:58 ` Laszlo Ersek
2013-12-22 17:14 ` Gabriel L. Somlo
2013-12-22 22:21 ` Laszlo Ersek
2013-12-23 3:19 ` Gabriel L. Somlo
2013-12-25 19:11 ` Alexander Graf
2013-12-25 19:20 ` Michael S. Tsirkin
2013-12-25 21:33 ` Alexander Graf
2013-12-25 21:54 ` Michael S. Tsirkin
2013-12-25 14:12 ` Michael S. Tsirkin
2014-01-13 17:53 ` [Qemu-devel] [PATCH v4] " Gabriel L. Somlo
2014-01-13 19:17 ` [Qemu-devel] [PATCH] ACPI: AppleSMC _STA method should return 32bit value Gabriel L. Somlo
2014-01-13 20:27 ` [Qemu-devel] [PATCH v2] ACPI: Fix AppleSMC _STA size Gabriel L. Somlo
2014-01-14 10:46 ` Michael S. Tsirkin [this message]
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=20140114104646.GA27722@redhat.com \
--to=mst@redhat.com \
--cc=gsomlo@gmail.com \
--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 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).