From patchwork Wed Sep 10 00:51:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Franz X-Patchwork-Id: 37166 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f200.google.com (mail-vc0-f200.google.com [209.85.220.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 70F6420566 for ; Wed, 10 Sep 2014 00:54:29 +0000 (UTC) Received: by mail-vc0-f200.google.com with SMTP id ij19sf3254424vcb.7 for ; Tue, 09 Sep 2014 17:54:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :list-archive:content-type:content-transfer-encoding; bh=HtJej2s4Rb4nM3yuWtoQXoGGoycSLH7HP4LZDH7ct8o=; b=Bq5WoLHiZlETZC5PoKJpo+fJ8Nf3VAoPafvoP6Vox1qnm4FuGvYfSfL9FRXR2nDf/y ymh+T+FZb+I0ky48WjVYFy8yjjMAGwdlr0E5ACOeBxzsZkf84Tp9Akb35gttS53MbtS9 7MgtOFtwOFF+wvk0IQKqJw+JMlWVv0lK5ZYT8CJkH7/yBjOmJEazAH8RkFS2ucl+fGGx Lls/rno/D1E7s0Sa4L8S/M/3CY/1p44wwcRKGQ1RiKQpptYyhuemMHZ7+X90k4OHt3Iv gdciWWhP8W0nkflEUziR0ckB07be4MT3XKadml6X4fopd3k+DA6Zk6w2bCSJut30PRBk BBDw== X-Gm-Message-State: ALoCoQmGkRmHKZqY7w+9AWCEVMX5GUqybAUU9LYa7ZM9Kh+uIw5Dpim/a2dKoZG46nwhR2pm0wAt X-Received: by 10.236.2.196 with SMTP id 44mr7782971yhf.51.1410310469166; Tue, 09 Sep 2014 17:54:29 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.16.232 with SMTP id 95ls2516508qgb.94.gmail; Tue, 09 Sep 2014 17:54:29 -0700 (PDT) X-Received: by 10.52.4.69 with SMTP id i5mr15045999vdi.35.1410310469090; Tue, 09 Sep 2014 17:54:29 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id u2si6458660vdx.36.2014.09.09.17.54.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 09 Sep 2014 17:54:29 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id ik5so1360344vcb.0 for ; Tue, 09 Sep 2014 17:54:29 -0700 (PDT) X-Received: by 10.52.61.99 with SMTP id o3mr8883717vdr.46.1410310469005; Tue, 09 Sep 2014 17:54:29 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp363879vcb; Tue, 9 Sep 2014 17:54:28 -0700 (PDT) X-Received: by 10.52.160.10 with SMTP id xg10mr28046843vdb.1.1410310468463; Tue, 09 Sep 2014 17:54:28 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id re1si5856874vcb.6.2014.09.09.17.54.28 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 09 Sep 2014 17:54:28 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XRW94-0006DT-Ls; Wed, 10 Sep 2014 00:52:26 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XRW92-0006CA-Sj for xen-devel@lists.xen.org; Wed, 10 Sep 2014 00:52:25 +0000 Received: from [85.158.139.211:8470] by server-2.bemta-5.messagelabs.com id 12/48-31832-8C0AF045; Wed, 10 Sep 2014 00:52:24 +0000 X-Env-Sender: roy.franz@linaro.org X-Msg-Ref: server-2.tower-206.messagelabs.com!1410310342!13493464!1 X-Originating-IP: [209.85.213.177] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 1060 invoked from network); 10 Sep 2014 00:52:23 -0000 Received: from mail-ig0-f177.google.com (HELO mail-ig0-f177.google.com) (209.85.213.177) by server-2.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 10 Sep 2014 00:52:23 -0000 Received: by mail-ig0-f177.google.com with SMTP id uq10so2180364igb.4 for ; Tue, 09 Sep 2014 17:52:22 -0700 (PDT) X-Received: by 10.50.122.99 with SMTP id lr3mr35827708igb.10.1410310342015; Tue, 09 Sep 2014 17:52:22 -0700 (PDT) Received: from rfranz-v430.caveonetworks.com (64.2.3.195.ptr.us.xo.net. [64.2.3.195]) by mx.google.com with ESMTPSA id dx10sm654825igb.4.2014.09.09.17.52.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Sep 2014 17:52:21 -0700 (PDT) From: Roy Franz To: xen-devel@lists.xen.org, ian.campbell@citrix.com, stefano.stabellini@citrix.com, tim@xen.org, jbeulich@suse.com, keir@xen.org Date: Tue, 9 Sep 2014 17:51:55 -0700 Message-Id: <1410310325-4509-6-git-send-email-roy.franz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1410310325-4509-1-git-send-email-roy.franz@linaro.org> References: <1410310325-4509-1-git-send-email-roy.franz@linaro.org> Cc: Roy Franz , fu.wei@linaro.org Subject: [Xen-devel] [PATCH V4 05/15] Add efi_arch_cfg_file() to handle arch specific cfg file fields X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: roy.franz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: Different architectures have some different configuration file fields that need to be handled. In particular, x86 has ucode and ARM has device tree files to be loaded. This arch specific function is used to allow each architecture to implement these features in arch specific code. Signed-off-by: Roy Franz --- xen/common/efi/boot.c | 30 ++++++++++++++---------------- xen/include/asm-x86/efi-boot.h | 15 +++++++++++++++ 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index ca86beb..a33a8f6 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -31,11 +31,6 @@ typedef struct { EFI_SHIM_LOCK_VERIFY Verify; } EFI_SHIM_LOCK_PROTOCOL; -static CHAR16 *__init FormatDec(UINT64 Val, CHAR16 *Buffer); -static CHAR16 *__init FormatHex(UINT64 Val, UINTN Width, CHAR16 *Buffer); -static void __init DisplayUint(UINT64 Val, INTN Width); -static CHAR16 *__init wstrcpy(CHAR16 *d, const CHAR16 *s); - union string { CHAR16 *w; char *s; @@ -50,6 +45,17 @@ struct file { }; }; +static CHAR16 *__init FormatDec(UINT64 Val, CHAR16 *Buffer); +static CHAR16 *__init FormatHex(UINT64 Val, UINTN Width, CHAR16 *Buffer); +static void __init DisplayUint(UINT64 Val, INTN Width); +static CHAR16 *__init wstrcpy(CHAR16 *d, const CHAR16 *s); +static char *__init get_value(const struct file *cfg, const char *section, + const char *item); +static void __init split_value(char *s); +static CHAR16 *__init s2w(union string *str); +static bool_t __init read_file(EFI_FILE_HANDLE dir_handle, CHAR16 *name, + struct file *file); + static EFI_BOOT_SERVICES *__initdata efi_bs; static EFI_HANDLE __initdata efi_ih; @@ -752,6 +758,9 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) } if ( !name.s ) blexit(L"No Dom0 kernel image specified."); + + efi_arch_cfg_file(dir_handle, section.s); + split_value(name.s); read_file(dir_handle, s2w(&name), &kernel); efi_bs->FreePool(name.w); @@ -769,17 +778,6 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) efi_bs->FreePool(name.w); } - name.s = get_value(&cfg, section.s, "ucode"); - if ( !name.s ) - name.s = get_value(&cfg, "global", "ucode"); - if ( name.s ) - { - microcode_set_module(mbi.mods_count); - split_value(name.s); - read_file(dir_handle, s2w(&name), &ucode); - efi_bs->FreePool(name.w); - } - name.s = get_value(&cfg, section.s, "xsm"); if ( name.s ) { diff --git a/xen/include/asm-x86/efi-boot.h b/xen/include/asm-x86/efi-boot.h index 518c319..3937955 100644 --- a/xen/include/asm-x86/efi-boot.h +++ b/xen/include/asm-x86/efi-boot.h @@ -592,3 +592,18 @@ static void __init efi_arch_post_exit_boot(void) "D" (&mbi) : "memory" ); } + +static void __init efi_arch_cfg_file(EFI_FILE_HANDLE dir_handle, char *section) +{ + union string name; + name.s = get_value(&cfg, section, "ucode"); + if ( !name.s ) + name.s = get_value(&cfg, "global", "ucode"); + if ( name.s ) + { + microcode_set_module(mbi.mods_count); + split_value(name.s); + read_file(dir_handle, s2w(&name), &ucode); + efi_bs->FreePool(name.w); + } +}