Received: from eggs.gnu.org ([2001:4830:134:3::10]:36051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vul3X-0004qq-CN for qemu-devel@nongnu.org; Sun, 22 Dec 2013 10:35:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vul3O-0002oU-Uv for qemu-devel@nongnu.org; Sun, 22 Dec 2013 10:35:03 -0500 Received: from mail-qc0-x230.google.com ([2607:f8b0:400d:c01::230]:53463) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vul3O-0002oQ-QE for qemu-devel@nongnu.org; Sun, 22 Dec 2013 10:34:54 -0500 Received: by mail-qc0-f176.google.com with SMTP id i8so4028414qcq.7 for ; Sun, 22 Dec 2013 07:34:54 -0800 (PST) Date: Sun, 22 Dec 2013 10:34:07 -0500 From: "Gabriel L. Somlo" Message-ID: <20131222153406.GA15876@ERROL.INI.CMU.EDU> References: <20131220155410.GH14762@ERROL.INI.CMU.EDU> <93DBD566-6185-47F7-8DAB-DC03E1A7568E@suse.de> <20131220205223.GJ14762@ERROL.INI.CMU.EDU> <20131220223830.6d2965c8@thinkpad> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20131220223830.6d2965c8@thinkpad> Subject: Re: [Qemu-devel] [PATCH v2] Add DSDT node for AppleSMC List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: pbonzini@redhat.com, mst@redhat.com, qemu-devel@nongnu.org, agraf@suse.de On Fri, Dec 20, 2013 at 10:38:30PM +0100, Igor Mammedov wrote: > > + Device (SMC) { > > + Name(_HID, EisaId("APP0001")) > > + /* _STA will be patched to 0x0B if AppleSMC is present */ > > + ACPI_EXTRACT_NAME_WORD_CONST CONCAT_SYM(SMC_PFX, smc_sta) > typically dynamic variables are put in SSDT When I tried statically building the SMC node as part of the SSDT, it was not recognized by Mac OS X -- it only seems to work when it's part of the DSDT. > > + Name(_STA, 0xFF00) > > + Name(_CRS, ResourceTemplate () { > > + IO (Decode16, 0x0300, 0x0300, 0x01, 0x20) > > + IRQNoFlags() { 6 } > > + }) > > + } > Device looks pretty simplistic, Have you considered building it completely > dynamically? > See build_ssdt() for examples, you might need to add extra building block for > ResourceTemplate{} the rest could be done with existing build_* primitives. If we consider "pasting" the SMC into the DSDT or not, based on whether it was configured via -device applesmc or not, it comes down to compiling the following ASL: Device (SMC) { Name(_HID, EisaId("APP0001")) Name(_STA, 0x0B) Name(_CRS, ResourceTemplate () { IO (Decode16, 0x0300, 0x0300, 0x01, 0x20) IRQNoFlags() { 6 } }) } into AML, and somehow conditionally appending the resulting blob, unmodified, to the DSDT. I would explore this approach before I'd consider compiling the blob dynamically each time during QEMU startup, which would IMHO be harder to follow. However, I thought flipping one uint16_t from 0x0B to 0x00 (i.e., the return value of SMC._STA) is much less intrusive to the DSDT than pasting an entire blob dynamically during startup, which is why I thought my approach was a bit cleaner. Let me know what you think. Thanks, --Gabriel