From patchwork Thu Sep 25 01:42:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Franz X-Patchwork-Id: 37881 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f72.google.com (mail-ee0-f72.google.com [74.125.83.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EA7EA20063 for ; Thu, 25 Sep 2014 01:44:51 +0000 (UTC) Received: by mail-ee0-f72.google.com with SMTP id c13sf4472308eek.7 for ; Wed, 24 Sep 2014 18:44:51 -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=rHEn1Yoywe0cIC4V97wDbErjLlVL6JWULEWlpV4QS70=; b=V47d5eiFYFxowYP2IyOQx1BrKDHpIuNar4UaaAgqKgCqoidVkLiIHLRQgUrKiHQHUV mNh7S8S4q3YWego21rDMMHadzxiIuoH8jDT1yfA/qBM/rHOE7RX4QeiuUqM8yDWyG7xP u9kRq5Z1UmwhtPSO4OmJ2Bc+xINrZlH3nZQal6Sm9+hrbbW0vFG7ohJd8tBqfpHZ4Bdb Yu2Cm/Xq8e7pBWL7P35Zm56o1kIQ+/uinxM1OE7a3nlIystENGvfqRPS0kRIQOnFctr5 omzBUojFtZc+SS/wY94iKt1S48IgBD2rjFU7pctxTMynbJ0RoSCE3LWBXoFAh0zp++P5 Yx1w== X-Gm-Message-State: ALoCoQnow3LHAaN8A9frnkFL+igGSM5QuGOO/WwlkBYR1UlJXiKt5NZglSia3ZgQlHcLt1J10v08 X-Received: by 10.152.19.131 with SMTP id f3mr1581837lae.0.1411609491101; Wed, 24 Sep 2014 18:44:51 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.171 with SMTP id p11ls186216lal.68.gmail; Wed, 24 Sep 2014 18:44:50 -0700 (PDT) X-Received: by 10.152.36.134 with SMTP id q6mr9955283laj.35.1411609490818; Wed, 24 Sep 2014 18:44:50 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com [209.85.215.49]) by mx.google.com with ESMTPS id ck13si974149lbb.57.2014.09.24.18.44.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Sep 2014 18:44:50 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by mail-la0-f49.google.com with SMTP id pn19so11463899lab.8 for ; Wed, 24 Sep 2014 18:44:50 -0700 (PDT) X-Received: by 10.112.34.78 with SMTP id x14mr9603401lbi.38.1411609490750; Wed, 24 Sep 2014 18:44:50 -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.112.130.169 with SMTP id of9csp678229lbb; Wed, 24 Sep 2014 18:44:50 -0700 (PDT) X-Received: by 10.140.101.205 with SMTP id u71mr15374099qge.48.1411609489502; Wed, 24 Sep 2014 18:44:49 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id e78si1087546qgd.12.2014.09.24.18.44.49 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 24 Sep 2014 18:44:49 -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 1XWy58-00010I-UB; Thu, 25 Sep 2014 01:42:54 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XWy57-0000xb-EA for xen-devel@lists.xen.org; Thu, 25 Sep 2014 01:42:53 +0000 Received: from [193.109.254.147:26657] by server-4.bemta-14.messagelabs.com id CF/21-01677-C1373245; Thu, 25 Sep 2014 01:42:52 +0000 X-Env-Sender: roy.franz@linaro.org X-Msg-Ref: server-8.tower-27.messagelabs.com!1411609370!12864513!1 X-Originating-IP: [209.85.223.175] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.12.2; banners=-,-,- X-VirusChecked: Checked Received: (qmail 2298 invoked from network); 25 Sep 2014 01:42:52 -0000 Received: from mail-ie0-f175.google.com (HELO mail-ie0-f175.google.com) (209.85.223.175) by server-8.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 25 Sep 2014 01:42:52 -0000 Received: by mail-ie0-f175.google.com with SMTP id rl12so6540371iec.20 for ; Wed, 24 Sep 2014 18:42:50 -0700 (PDT) X-Received: by 10.50.43.233 with SMTP id z9mr559126igl.41.1411609370530; Wed, 24 Sep 2014 18:42:50 -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 x9sm5829238igl.10.2014.09.24.18.42.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Sep 2014 18:42:50 -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: Wed, 24 Sep 2014 18:42:24 -0700 Message-Id: <1411609352-24549-7-git-send-email-roy.franz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1411609352-24549-1-git-send-email-roy.franz@linaro.org> References: <1411609352-24549-1-git-send-email-roy.franz@linaro.org> Cc: Roy Franz , fu.wei@linaro.org Subject: [Xen-devel] [PATCH for-4.5 V7 06/14] Add efi_arch_cfg_file_early/late() 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.215.49 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. These arch specific functions is used to allow each architecture to implement these features in arch specific code. Early/late versions are provided, as ARM needs to process the DTB entry first, and x86 wants to process the ucode entry last as it is the smallest allocation. Signed-off-by: Roy Franz Acked-by: Jan Beulich --- xen/arch/x86/efi/efi-boot.h | 20 ++++++++++++++++++++ xen/common/efi/boot.c | 21 ++++++++++----------- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index 254783f..61e2198 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -248,3 +248,23 @@ static void __init noreturn efi_arch_post_exit_boot(void) : "memory" ); for( ; ; ); /* not reached */ } + +static void __init efi_arch_cfg_file_early(EFI_FILE_HANDLE dir_handle, char *section) +{ +} + +static void __init efi_arch_cfg_file_late(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); + } +} diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 0eee250..d129035 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -57,6 +57,12 @@ static void DisplayUint(UINT64 Val, INTN Width); static CHAR16 *wstrcpy(CHAR16 *d, const CHAR16 *s); static void noreturn blexit(const CHAR16 *str); static void PrintErrMesg(const CHAR16 *mesg, EFI_STATUS ErrCode); +static char *get_value(const struct file *cfg, const char *section, + const char *item); +static void split_value(char *s); +static CHAR16 *s2w(union string *str); +static bool_t 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; @@ -846,6 +852,9 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) } if ( !name.s ) blexit(L"No Dom0 kernel image specified."); + + efi_arch_cfg_file_early(dir_handle, section.s); + split_value(name.s); read_file(dir_handle, s2w(&name), &kernel); efi_bs->FreePool(name.w); @@ -863,17 +872,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 ) { @@ -912,6 +910,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) cols = rows = depth = 0; } } + efi_arch_cfg_file_late(dir_handle, section.s); efi_bs->FreePages(cfg.addr, PFN_UP(cfg.size)); cfg.addr = 0;