From: Vasilis Liaskovitis Subject: [RFC PATCH v3 03/19][SeaBIOS] acpi-dsdt: Implement functions for memory hotplug Date: Fri, 21 Sep 2012 13:17:19 +0200 Message-ID: <1348226255-4226-4-git-send-email-vasilis.liaskovitis@profitbricks.com> References: <1348226255-4226-1-git-send-email-vasilis.liaskovitis@profitbricks.com> Cc: avi@redhat.com, anthony@codemonkey.ws, kevin@koconnor.net, wency@cn.fujitsu.com, kraxel@redhat.com, eblake@redhat.com, blauwirbel@gmail.com, gleb@redhat.com, imammedo@redhat.com, Vasilis Liaskovitis To: qemu-devel@nongnu.org, kvm@vger.kernel.org, seabios@seabios.org Return-path: Received: from mail-bk0-f46.google.com ([209.85.214.46]:64344 "EHLO mail-bk0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932373Ab2IULRp (ORCPT ); Fri, 21 Sep 2012 07:17:45 -0400 Received: by bkuw11 with SMTP id w11so743861bku.19 for ; Fri, 21 Sep 2012 04:17:44 -0700 (PDT) In-Reply-To: <1348226255-4226-1-git-send-email-vasilis.liaskovitis@profitbricks.com> Sender: kvm-owner@vger.kernel.org List-ID: Extend the DSDT to include methods for handling memory hot-add and hot-remove notifications and memory device status requests. These functions are called from the memory device SSDT methods. Signed-off-by: Vasilis Liaskovitis --- src/acpi-dsdt.dsl | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 68 insertions(+), 2 deletions(-) diff --git a/src/acpi-dsdt.dsl b/src/acpi-dsdt.dsl index 2060686..5d3e92b 100644 --- a/src/acpi-dsdt.dsl +++ b/src/acpi-dsdt.dsl @@ -737,6 +737,71 @@ DefinitionBlock ( } Return(One) } + /* Objects filled in by run-time generated SSDT */ + External(MTFY, MethodObj) + External(MEON, PkgObj) + + Method (CMST, 1, NotSerialized) { + // _STA method - return ON status of memdevice + // Local0 = MEON flag for this cpu + Store(DerefOf(Index(MEON, Arg0)), Local0) + If (Local0) { Return(0xF) } Else { Return(0x0) } + } + + /* Memory hotplug notify array */ + OperationRegion(MEST, SystemIO, 0xaf80, 32) + Field (MEST, ByteAcc, NoLock, Preserve) + { + MES, 256 + } + + /* Memory eject byte */ + OperationRegion(MEMJ, SystemIO, 0xafa0, 1) + Field (MEMJ, ByteAcc, NoLock, Preserve) + { + MPE, 8 + } + + Method(MESC, 0) { + // Local5 = active memdevice bitmap + Store (MES, Local5) + // Local2 = last read byte from bitmap + Store (Zero, Local2) + // Local0 = memory device iterator + Store (Zero, Local0) + While (LLess(Local0, SizeOf(MEON))) { + // Local1 = MEON flag for this memory device + Store(DerefOf(Index(MEON, Local0)), Local1) + If (And(Local0, 0x07)) { + // Shift down previously read bitmap byte + ShiftRight(Local2, 1, Local2) + } Else { + // Read next byte from memdevice bitmap + Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2) + } + // Local3 = active state for this memory device + Store(And(Local2, 1), Local3) + + If (LNotEqual(Local1, Local3)) { + // State change - update MEON with new state + Store(Local3, Index(MEON, Local0)) + // Do MEM notify + If (LEqual(Local3, 1)) { + MTFY(Local0, 1) + } Else { + MTFY(Local0, 3) + } + } + Increment(Local0) + } + Return(One) + } + + Method (MPEJ, 2, NotSerialized) { + // _EJ0 method - eject callback + Store(Arg0, MPE) + Sleep(200) + } } @@ -759,8 +824,9 @@ DefinitionBlock ( // CPU hotplug event Return(\_SB.PRSC()) } - Method(_L03) { - Return(0x01) + Method(_E03) { + // Memory hotplug event + Return(\_SB.MESC()) } Method(_L04) { Return(0x01) -- 1.7.9