From patchwork Fri Mar 25 13:48:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 8671631 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 00DA59F65E for ; Fri, 25 Mar 2016 13:51:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 05E1520382 for ; Fri, 25 Mar 2016 13:51:46 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E96D620351 for ; Fri, 25 Mar 2016 13:51:44 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ajS7n-0001V7-SR; Fri, 25 Mar 2016 13:50:03 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ajS7m-0001Tv-S1 for xen-devel@lists.xen.org; Fri, 25 Mar 2016 13:50:02 +0000 Received: from [85.158.137.68] by server-9.bemta-3.messagelabs.com id 9D/8C-03814-A0245F65; Fri, 25 Mar 2016 13:50:02 +0000 X-Env-Sender: shannon.zhao@linaro.org X-Msg-Ref: server-15.tower-31.messagelabs.com!1458913800!31053751!1 X-Originating-IP: [209.85.220.49] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 38030 invoked from network); 25 Mar 2016 13:50:01 -0000 Received: from mail-pa0-f49.google.com (HELO mail-pa0-f49.google.com) (209.85.220.49) by server-15.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 25 Mar 2016 13:50:01 -0000 Received: by mail-pa0-f49.google.com with SMTP id fl4so46874391pad.0 for ; Fri, 25 Mar 2016 06:50:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=aV8DzZJFwMPGLAX3zczaXM7rsXfhMlCFti8akLyQnU8=; b=fkwnjKshZtT83zUI2ZyTc8n5MS5DKbjsk3sxoN87YxtX030/b27U09ag0FkwRnh+S2 n4TRaIiMNZylP9o6r1FiYKzuRthX+NV/WxMYSeppcXRV0rtl/Hnyu/5gL/ltcbRpHuFg l6tRT3EFN1x1BEDGBv1BgRNOAqOEI+Lat4LKA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=aV8DzZJFwMPGLAX3zczaXM7rsXfhMlCFti8akLyQnU8=; b=OUzbq7KzkZF0wZool9YcqjwNEqzle9Ac7RFvG0i35fhAbCl+MbOeQdAQvs1FcyugSw rlz+ZH92mbUIs3kaeovGWBXylkXad7cVtDC6zFDKhKGKtEFBRMOColEjR1omJIvl30mX udaWH0ab6ldcsztEzecrDihd5ivCUzTheiclIp+R5yUo+qCzo/hQZcnTG8V55WwFSrWY L4j466hnH1gkOTYdzRiJI8Bxq5d5vOMPD+199br2w27dHy1nJsduXEqyQZK9pvPzQ7sU AN+Kta9Im1xEziLTcgq99wZ5UY3mFwCYpfDyMprsAGnIAS2mf2UM7E5fhf+5eakzRpkm 6zDw== X-Gm-Message-State: AD7BkJKTez2/T3UbB3KCat/Ba7at4GDGJ6gYl2yFawQjp0tufpTmOsxuLx33CGv986krSF1k X-Received: by 10.66.228.1 with SMTP id se1mr21176083pac.43.1458913799382; Fri, 25 Mar 2016 06:49:59 -0700 (PDT) Received: from localhost.localdomain ([45.56.152.2]) by smtp.gmail.com with ESMTPSA id w20sm16744178pfi.31.2016.03.25.06.49.55 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 25 Mar 2016 06:49:58 -0700 (PDT) From: Shannon Zhao To: xen-devel@lists.xen.org Date: Fri, 25 Mar 2016 21:48:44 +0800 Message-Id: <1458913735-2678-12-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1458913735-2678-1-git-send-email-shannon.zhao@linaro.org> References: <1458913735-2678-1-git-send-email-shannon.zhao@linaro.org> Cc: julien.grall@arm.com, shannon.zhao@linaro.org, stefano.stabellini@citrix.com, peter.huangpeng@huawei.com, zhaoshenglong@huawei.com Subject: [Xen-devel] [PATCH v7 11/22] arm/acpi: Prepare EFI system table for Dom0 X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Prepare EFI system table for Dom0 to describe the information of UEFI. Signed-off-by: Parth Dixit Signed-off-by: Shannon Zhao Reviewed-by: Stefano Stabellini Acked-by: Julien Grall --- v7: use domain as parameter --- xen/arch/arm/domain_build.c | 1 + xen/arch/arm/efi/efi-dom0.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ xen/include/asm-arm/setup.h | 3 +++ 3 files changed, 49 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 1bfb2fc..f14bc5b 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1720,6 +1720,7 @@ static int prepare_acpi(struct domain *d, struct kernel_info *kinfo) return rc; acpi_map_other_tables(d); + acpi_create_efi_system_table(d, tbl_add); return 0; } diff --git a/xen/arch/arm/efi/efi-dom0.c b/xen/arch/arm/efi/efi-dom0.c index 021aa02..f4f84b6 100644 --- a/xen/arch/arm/efi/efi-dom0.c +++ b/xen/arch/arm/efi/efi-dom0.c @@ -23,8 +23,12 @@ #include "efi.h" #include "efi-dom0.h" +#include #include #include +#include "../../../common/decompress.h" +#define XZ_EXTERN STATIC +#include "../../../common/xz/crc32.c" struct meminfo __initdata acpi_mem; /* Constant to indicate "Xen" in unicode u16 format */ @@ -49,6 +53,47 @@ size_t __init estimate_efi_size(int mem_nr_banks) return size; } +void __init acpi_create_efi_system_table(struct domain *d, + struct membank tbl_add[]) +{ + u64 table_addr, table_size, offset = 0; + u8 *base_ptr; + EFI_CONFIGURATION_TABLE *efi_conf_tbl; + EFI_SYSTEM_TABLE *efi_sys_tbl; + + table_addr = d->arch.efi_acpi_gpa + + acpi_get_table_offset(tbl_add, TBL_EFIT); + table_size = sizeof(EFI_SYSTEM_TABLE) + sizeof(EFI_CONFIGURATION_TABLE) + + sizeof(xen_efi_fw_vendor); + base_ptr = d->arch.efi_acpi_table + + acpi_get_table_offset(tbl_add, TBL_EFIT); + efi_sys_tbl = (EFI_SYSTEM_TABLE *)base_ptr; + + efi_sys_tbl->Hdr.Signature = EFI_SYSTEM_TABLE_SIGNATURE; + /* Specify the revision as 2.5 */ + efi_sys_tbl->Hdr.Revision = (2 << 16 | 50); + efi_sys_tbl->Hdr.HeaderSize = table_size; + + efi_sys_tbl->FirmwareRevision = 1; + efi_sys_tbl->NumberOfTableEntries = 1; + offset += sizeof(EFI_SYSTEM_TABLE); + memcpy(base_ptr + offset, xen_efi_fw_vendor, sizeof(xen_efi_fw_vendor)); + efi_sys_tbl->FirmwareVendor = (CHAR16 *)(table_addr + offset); + + offset += sizeof(xen_efi_fw_vendor); + efi_conf_tbl = (EFI_CONFIGURATION_TABLE *)(base_ptr + offset); + efi_conf_tbl->VendorGuid = (EFI_GUID)ACPI_20_TABLE_GUID; + efi_conf_tbl->VendorTable = (VOID *)tbl_add[TBL_RSDP].start; + efi_sys_tbl->ConfigurationTable = (EFI_CONFIGURATION_TABLE *)(table_addr + + offset); + xz_crc32_init(); + efi_sys_tbl->Hdr.CRC32 = xz_crc32((uint8_t *)efi_sys_tbl, + efi_sys_tbl->Hdr.HeaderSize, 0); + + tbl_add[TBL_EFIT].start = table_addr; + tbl_add[TBL_EFIT].size = table_size; +} + /* * Local variables: * mode: C diff --git a/xen/include/asm-arm/setup.h b/xen/include/asm-arm/setup.h index 7f233a1..fc9fd7c 100644 --- a/xen/include/asm-arm/setup.h +++ b/xen/include/asm-arm/setup.h @@ -53,6 +53,9 @@ void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len); size_t estimate_efi_size(int mem_nr_banks); +void acpi_create_efi_system_table(struct domain *d, + struct membank tbl_add[]); + int construct_dom0(struct domain *d); void discard_initial_modules(void);