From patchwork Mon Sep 8 03:53:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Franz X-Patchwork-Id: 36942 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f198.google.com (mail-pd0-f198.google.com [209.85.192.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2935921271 for ; Mon, 8 Sep 2014 03:56:48 +0000 (UTC) Received: by mail-pd0-f198.google.com with SMTP id ft15sf5526591pdb.9 for ; Sun, 07 Sep 2014 20:56:47 -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=5tDEF+xIqCJbLtRtFJh49BzdUcqbyc3SQ6F5WL36xFI=; b=Rdv1Eh+ijmCjIzvtXaOt4hWatGWQfj74ezqhhqXfmP9n3nh6aqxJiDMG9inUmBxSYe XLyTgwFykMkNTCsd72CGEGPtXTaYIo4jNHdhEpQmxMjxSou8kGlWyO/1igcCcLkBR+PK SjSEIIrdvLsOvPdXn7rrPch4zFh55+FEWcQLceuLhNS64cvJ7UhjJSSrcqJynuKe+Z5j wXCad9IesqD665NgXDWSG2ELql+QgzQFsyk5b8isglSh82sWS7/Su8iXUFFWsvq7biwB xpscWMR/wS2ipHDdGE0ho6J4hwiWSXFowjtTs1MmujO5bvBqYlMoVl0+Qa65M0ynQ1vb KnPQ== X-Gm-Message-State: ALoCoQlguvYaJs+AUg4iKouLTZ3bewmdo1h803QRsmEu3Sjrsae7SGsu81CbUjIUOTWwoTzUn0vW X-Received: by 10.66.255.70 with SMTP id ao6mr16259097pad.5.1410148607436; Sun, 07 Sep 2014 20:56:47 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.102.197 with SMTP id w63ls456113qge.93.gmail; Sun, 07 Sep 2014 20:56:47 -0700 (PDT) X-Received: by 10.52.228.67 with SMTP id sg3mr19724496vdc.6.1410148607323; Sun, 07 Sep 2014 20:56:47 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id fv14si4118791vdb.41.2014.09.07.20.56.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 07 Sep 2014 20:56:47 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id id10so14649073vcb.2 for ; Sun, 07 Sep 2014 20:56:47 -0700 (PDT) X-Received: by 10.52.97.233 with SMTP id ed9mr19760999vdb.16.1410148607250; Sun, 07 Sep 2014 20:56:47 -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 uj3csp76489vcb; Sun, 7 Sep 2014 20:56:47 -0700 (PDT) X-Received: by 10.221.49.133 with SMTP id va5mr3899867vcb.37.1410148606159; Sun, 07 Sep 2014 20:56:46 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id p9si4097730vdv.59.2014.09.07.20.56.45 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 07 Sep 2014 20:56:46 -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 1XQq29-0006xK-1D; Mon, 08 Sep 2014 03:54:29 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XQq26-0006vt-7q for xen-devel@lists.xen.org; Mon, 08 Sep 2014 03:54:26 +0000 Received: from [85.158.139.211:62230] by server-4.bemta-5.messagelabs.com id 35/11-10551-1782D045; Mon, 08 Sep 2014 03:54:25 +0000 X-Env-Sender: roy.franz@linaro.org X-Msg-Ref: server-8.tower-206.messagelabs.com!1410148463!12958989!1 X-Originating-IP: [209.85.220.43] 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 10268 invoked from network); 8 Sep 2014 03:54:24 -0000 Received: from mail-pa0-f43.google.com (HELO mail-pa0-f43.google.com) (209.85.220.43) by server-8.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 8 Sep 2014 03:54:24 -0000 Received: by mail-pa0-f43.google.com with SMTP id fa1so1500947pad.2 for ; Sun, 07 Sep 2014 20:54:22 -0700 (PDT) X-Received: by 10.70.119.1 with SMTP id kq1mr43092130pdb.35.1410148462579; Sun, 07 Sep 2014 20:54:22 -0700 (PDT) Received: from rfranz-i7.local (c-24-10-97-91.hsd1.ca.comcast.net. [24.10.97.91]) by mx.google.com with ESMTPSA id qy1sm7524053pbc.27.2014.09.07.20.54.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 07 Sep 2014 20:54: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: Sun, 7 Sep 2014 20:53:51 -0700 Message-Id: <1410148441-18684-6-git-send-email-roy.franz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1410148441-18684-1-git-send-email-roy.franz@linaro.org> References: <1410148441-18684-1-git-send-email-roy.franz@linaro.org> Cc: Roy Franz , fu.wei@linaro.org, linaro-uefi@lists.linaro.org Subject: [Xen-devel] [PATCH V3 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.171 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 08ff9a5..42b087e 100644 --- a/xen/include/asm-x86/efi-boot.h +++ b/xen/include/asm-x86/efi-boot.h @@ -591,3 +591,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); + } +}