From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35425) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrVW1-0003bg-Q5 for qemu-devel@nongnu.org; Fri, 13 Dec 2013 11:23:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VrVVu-0000lX-Ng for qemu-devel@nongnu.org; Fri, 13 Dec 2013 11:23:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:15004) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrVVu-0000lF-FU for qemu-devel@nongnu.org; Fri, 13 Dec 2013 11:22:54 -0500 From: Igor Mammedov Date: Fri, 13 Dec 2013 17:22:14 +0100 Message-Id: <1386951736-929-10-git-send-email-imammedo@redhat.com> In-Reply-To: <1386951736-929-1-git-send-email-imammedo@redhat.com> References: <1386951736-929-1-git-send-email-imammedo@redhat.com> Subject: [Qemu-devel] [PATCH 09/11] ACPI: move PRST OperationRegion into SSDT List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, mst@redhat.com, hutao@cn.fujitsu.com, jjherne@us.ibm.com, brogers@suse.com, kraxel@redhat.com, aliguori@amazon.com, kaneshige.kenji@jp.fujitsu.com, chen.fan.fnst@cn.fujitsu.com, pbonzini@redhat.com, lersek@redhat.com .. and report range used by it to OSPM via _CRS. PRST is needed in SSDT since its base will depend on chipset and will be dynamically set by QEMU. Also move PRSC() method along with PRST since cross table reference to PRST doesn't work. Signed-off-by: Igor Mammedov --- hw/i386/acpi-dsdt-cpu-hotplug.dsl | 39 +---------------------- hw/i386/acpi-dsdt.dsl | 2 +- hw/i386/q35-acpi-dsdt.dsl | 2 +- hw/i386/ssdt-misc.dsl | 65 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 40 deletions(-) diff --git a/hw/i386/acpi-dsdt-cpu-hotplug.dsl b/hw/i386/acpi-dsdt-cpu-hotplug.dsl index 995b415..f26f81b 100644 --- a/hw/i386/acpi-dsdt-cpu-hotplug.dsl +++ b/hw/i386/acpi-dsdt-cpu-hotplug.dsl @@ -20,6 +20,7 @@ Scope(\_SB) { /* Objects filled in by run-time generated SSDT */ External(NTFY, MethodObj) + External(\_SB.CPHD.PRSC, MethodObj) External(CPON, PkgObj) /* Methods called by run-time generated SSDT Processor objects */ @@ -51,42 +52,4 @@ Scope(\_SB) { // _EJ0 method - eject callback Sleep(200) } - - OperationRegion(PRST, SystemIO, 0xaf00, 32) - Field(PRST, ByteAcc, NoLock, Preserve) { - PRS, 256 - } - Method(PRSC, 0) { - // Local5 = active cpu bitmap - Store(PRS, Local5) - // Local2 = last read byte from bitmap - Store(Zero, Local2) - // Local0 = Processor ID / APIC ID iterator - Store(Zero, Local0) - While (LLess(Local0, SizeOf(CPON))) { - // Local1 = CPON flag for this cpu - Store(DerefOf(Index(CPON, Local0)), Local1) - If (And(Local0, 0x07)) { - // Shift down previously read bitmap byte - ShiftRight(Local2, 1, Local2) - } Else { - // Read next byte from cpu bitmap - Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2) - } - // Local3 = active state for this cpu - Store(And(Local2, 1), Local3) - - If (LNotEqual(Local1, Local3)) { - // State change - update CPON with new state - Store(Local3, Index(CPON, Local0)) - // Do CPU notify - If (LEqual(Local3, 1)) { - NTFY(Local0, 1) - } Else { - NTFY(Local0, 3) - } - } - Increment(Local0) - } - } } diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl index 90efce0..fa9f2d4 100644 --- a/hw/i386/acpi-dsdt.dsl +++ b/hw/i386/acpi-dsdt.dsl @@ -311,7 +311,7 @@ DefinitionBlock ( } Method(_E02) { // CPU hotplug event - \_SB.PRSC() + \_SB.CPHD.PRSC() } Method(_L03) { } diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl index 22baa58..9ccc543 100644 --- a/hw/i386/q35-acpi-dsdt.dsl +++ b/hw/i386/q35-acpi-dsdt.dsl @@ -420,7 +420,7 @@ DefinitionBlock ( } Method(_E02) { // CPU hotplug event - \_SB.PRSC() + \_SB.CPHD.PRSC() } Method(_L03) { } diff --git a/hw/i386/ssdt-misc.dsl b/hw/i386/ssdt-misc.dsl index a4484b8..ec8893c 100644 --- a/hw/i386/ssdt-misc.dsl +++ b/hw/i386/ssdt-misc.dsl @@ -116,4 +116,69 @@ DefinitionBlock ("ssdt-misc.aml", "SSDT", 0x01, "BXPC", "BXSSDTSUSP", 0x1) } } } + Scope(\_SB) { + External(NTFY, MethodObj) + External(CPON, PkgObj) + + Device(CPHD) { + Name(_HID, EISAID("PNP0C08")) + Name(CPPL, 32) // cpu-gpe length + Name(CPHP, 0xaf00) + + OperationRegion(PRST, SystemIO, CPHP, CPPL) + Field(PRST, ByteAcc, NoLock, Preserve) { + PRS, 256 + } + + Method(PRSC, 0) { + // Local5 = active cpu bitmap + Store(PRS, Local5) + // Local2 = last read byte from bitmap + Store(Zero, Local2) + // Local0 = Processor ID / APIC ID iterator + Store(Zero, Local0) + While (LLess(Local0, SizeOf(CPON))) { + // Local1 = CPON flag for this cpu + Store(DerefOf(Index(CPON, Local0)), Local1) + If (And(Local0, 0x07)) { + // Shift down previously read bitmap byte + ShiftRight(Local2, 1, Local2) + } Else { + // Read next byte from cpu bitmap + Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2) + } + // Local3 = active state for this cpu + Store(And(Local2, 1), Local3) + + If (LNotEqual(Local1, Local3)) { + // State change - update CPON with new state + Store(Local3, Index(CPON, Local0)) + // Do CPU notify + If (LEqual(Local3, 1)) { + NTFY(Local0, 1) + } Else { + NTFY(Local0, 3) + } + } + Increment(Local0) + } + } + + /* Leave bit 0 cleared to avoid Windows BSOD */ + Name(_STA, 0xA) + + Method(_CRS, 0) { + Store(ResourceTemplate() { + IO(Decode16, 0x00, 0x00, 0x01, 0x15, IO) + }, Local0) + + CreateWordField(Local0, IO._MIN, IOMN) + CreateWordField(Local0, IO._MAX, IOMX) + + Store(CPHP, IOMN) + Subtract(Add(CPHP, CPPL), 1, IOMX) + Return(Local0) + } + } // Device(CPHD) + } // Scope(\_SB) } -- 1.8.3.1