From patchwork Fri Sep 21 11:17:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasilis Liaskovitis X-Patchwork-Id: 1491431 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 35B82E006E for ; Fri, 21 Sep 2012 11:18:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933098Ab2IULSz (ORCPT ); Fri, 21 Sep 2012 07:18:55 -0400 Received: from mail-bk0-f46.google.com ([209.85.214.46]:59300 "EHLO mail-bk0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757269Ab2IULRo (ORCPT ); Fri, 21 Sep 2012 07:17:44 -0400 Received: by bkuw11 with SMTP id w11so743848bku.19 for ; Fri, 21 Sep 2012 04:17:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=HXJ/zPC1Muwrg6zYaJ6jkfGGLSpHdaIDOGANBf5BG4Q=; b=NW0lXNcURdnvfL23fSDGXsCwZj+pGPo4zjFFZbYCzzbsW5O3RASlD3hq75SJXRGiV3 n2YP50s9Ix7BdoJNPP4NSdfQG4F4l3mgpczyATlRhXvSH/2QDUlPXcoCrkVqkmSenwZz r/foJ7yo48EwnZ4RVeIeJa/VRGorlGY2T/SCuisO75Kue67NgDxtPuqwaVm3Bp7zfHu7 HVviCaeIcpR6U5PVRpHiCv5cRia8p61sBGCXZuEtwXhzSSEGEtH6y72LFp3JsQo1Z8Gd gOrACg8d/qnre0Xwf+83QDnXHkRuA9bOYWfQHbItM9Ik3hHlh6TyHWnIdl4HSPDZMNci HUuA== Received: by 10.204.9.130 with SMTP id l2mr1961463bkl.56.1348226263017; Fri, 21 Sep 2012 04:17:43 -0700 (PDT) Received: from dhcp-192-168-178-175.ri.profitbricks.localdomain ([62.217.45.26]) by mx.google.com with ESMTPS id x13sm5271435bkv.16.2012.09.21.04.17.42 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 21 Sep 2012 04:17:42 -0700 (PDT) From: Vasilis Liaskovitis To: qemu-devel@nongnu.org, kvm@vger.kernel.org, seabios@seabios.org 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 Subject: [RFC PATCH v3 02/19][SeaBIOS] Add SSDT memory device support Date: Fri, 21 Sep 2012 13:17:18 +0200 Message-Id: <1348226255-4226-3-git-send-email-vasilis.liaskovitis@profitbricks.com> X-Mailer: git-send-email 1.7.9 In-Reply-To: <1348226255-4226-1-git-send-email-vasilis.liaskovitis@profitbricks.com> References: <1348226255-4226-1-git-send-email-vasilis.liaskovitis@profitbricks.com> X-Gm-Message-State: ALoCoQlfDLBN5B/PzjjELonOL9/V1prMt6lptKsf8wIeES0jw+PlrL2lnVLFvVSIshgprJGiPC/5 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Define SSDT hotplug-able memory devices in _SB namespace. The dynamically generated SSDT includes per memory device hotplug methods. These methods just call methods defined in the DSDT. Also dynamically generate a MTFY method and a MEON array of the online/available memory devices. ACPI extraction macros are used to place the AML code in variables later used by src/acpi. The design is taken from SSDT cpu generation. Signed-off-by: Vasilis Liaskovitis --- Makefile | 2 +- src/ssdt-mem.dsl | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletions(-) create mode 100644 src/ssdt-mem.dsl diff --git a/Makefile b/Makefile index 5486f88..e82cfc9 100644 --- a/Makefile +++ b/Makefile @@ -233,7 +233,7 @@ $(OUT)%.hex: src/%.dsl ./tools/acpi_extract_preprocess.py ./tools/acpi_extract.p $(Q)$(PYTHON) ./tools/acpi_extract.py $(OUT)$*.lst > $(OUT)$*.off $(Q)cat $(OUT)$*.off > $@ -$(OUT)ccode32flat.o: $(OUT)acpi-dsdt.hex $(OUT)ssdt-proc.hex $(OUT)ssdt-pcihp.hex $(OUT)ssdt-susp.hex +$(OUT)ccode32flat.o: $(OUT)acpi-dsdt.hex $(OUT)ssdt-proc.hex $(OUT)ssdt-pcihp.hex $(OUT)ssdt-susp.hex $(OUT)ssdt-mem.hex ################ Kconfig rules diff --git a/src/ssdt-mem.dsl b/src/ssdt-mem.dsl new file mode 100644 index 0000000..ee322f0 --- /dev/null +++ b/src/ssdt-mem.dsl @@ -0,0 +1,65 @@ +/* This file is the basis for the ssdt_mem[] variable in src/acpi.c. + * It is similar in design to the ssdt_proc variable. + * It defines the contents of the per-cpu Processor() object. At + * runtime, a dynamically generated SSDT will contain one copy of this + * AML snippet for every possible memory device in the system. The + * objects will * be placed in the \_SB_ namespace. + * + * In addition to the aml code generated from this file, the + * src/acpi.c file creates a MEMNTFY method with an entry for each memdevice: + * Method(MTFY, 2) { + * If (LEqual(Arg0, 0x00)) { Notify(MP00, Arg1) } + * If (LEqual(Arg0, 0x01)) { Notify(MP01, Arg1) } + * ... + * } + * and a MEON array with the list of active and inactive memory devices: + * Name(MEON, Package() { One, One, ..., Zero, Zero, ... }) + */ +ACPI_EXTRACT_ALL_CODE ssdm_mem_aml + +DefinitionBlock ("ssdt-mem.aml", "SSDT", 0x02, "BXPC", "CSSDT", 0x1) +/* v------------------ DO NOT EDIT ------------------v */ +{ + ACPI_EXTRACT_DEVICE_START ssdt_mem_start + ACPI_EXTRACT_DEVICE_END ssdt_mem_end + ACPI_EXTRACT_DEVICE_STRING ssdt_mem_name + Device(MPAA) { + ACPI_EXTRACT_NAME_BYTE_CONST ssdt_mem_id + Name(ID, 0xAA) +/* ^------------------ DO NOT EDIT ------------------^ + * + * The src/acpi.c code requires the above layout so that it can update + * MPAA and 0xAA with the appropriate MEMDEVICE id (see + * SD_OFFSET_MEMHEX/MEMID1/MEMID2). Don't change the above without + * also updating the C code. + */ + Name(_HID, EISAID("PNP0C80")) + Name(_PXM, 0xAA) + + External(CMST, MethodObj) + External(MPEJ, MethodObj) + + Name(_CRS, ResourceTemplate() { + QwordMemory( + ResourceConsumer, + , + MinFixed, + MaxFixed, + Cacheable, + ReadWrite, + 0x0, + 0xDEADBEEF, + 0xE6ADBEEE, + 0x00000000, + 0x08000000, + ) + }) + Method (_STA, 0) { + Return(CMST(ID)) + } + Method (_EJ0, 1, NotSerialized) { + MPEJ(ID, Arg0) + } + } +} +