From patchwork Wed Sep 24 05:03:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Franz X-Patchwork-Id: 37787 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AADE220792 for ; Wed, 24 Sep 2014 05:05:37 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id hi2sf3173800wib.6 for ; Tue, 23 Sep 2014 22:05:36 -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=tQShsDXqeT6UeSbF3AnADF6Uuo4INy9p3Irmg1ZAkBA=; b=EIk9nHQdWa3KFYHslZuqpxDxQLKZnpSno1+t+nFXhDPo1xjG341vyKb+kKPI1RJ0vq PsXuUrdXUwTKm/guxi+g/De5yKamKHFAp+d70pGaLdyeNF8Pq2/gfi31H/oKd+VDXkYT XpH+ux9FKYIyJCR7RorpyTSD6K2cpdhW76p9/IFlBW86hkoNX7vgnE4e47xJlPPRN8Dh 5dzv6Ssm9uQEgvFs/svGQTXQv+bb1vFMkTgbsBwdkUxYvCQ1RcBNuXHJQeheLis3O5ci /PsLNL+dd4cQIQNDE8lmumzjFr4lF0UkGj7WZboafNlXW6h+o7YiEZ8K3WJTxF7IJIqe 0F5g== X-Gm-Message-State: ALoCoQnk2jdTBYi3fELjziphyk2mktbqG5ba17JgS57lTOHahrsbvDvXERysVjrjY2b1THe28Cdk X-Received: by 10.180.24.225 with SMTP id x1mr3678156wif.2.1411535136879; Tue, 23 Sep 2014 22:05:36 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.169 with SMTP id s9ls101637laa.47.gmail; Tue, 23 Sep 2014 22:05:36 -0700 (PDT) X-Received: by 10.112.198.131 with SMTP id jc3mr3639525lbc.42.1411535136634; Tue, 23 Sep 2014 22:05:36 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com [209.85.217.179]) by mx.google.com with ESMTPS id xg2si12757067lbb.49.2014.09.23.22.05.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 23 Sep 2014 22:05:36 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by mail-lb0-f179.google.com with SMTP id 10so9509549lbg.10 for ; Tue, 23 Sep 2014 22:05:36 -0700 (PDT) X-Received: by 10.152.7.8 with SMTP id f8mr3791117laa.27.1411535136551; Tue, 23 Sep 2014 22:05:36 -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 of9csp526250lbb; Tue, 23 Sep 2014 22:05:35 -0700 (PDT) X-Received: by 10.224.66.195 with SMTP id o3mr6423198qai.42.1411535135370; Tue, 23 Sep 2014 22:05:35 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id t45si14904334qgt.96.2014.09.23.22.05.34 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 23 Sep 2014 22:05:35 -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 1XWejo-0006Gu-MR; Wed, 24 Sep 2014 05:03:36 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XWejn-0006GM-AP for xen-devel@lists.xen.org; Wed, 24 Sep 2014 05:03:35 +0000 Received: from [85.158.143.35:56363] by server-1.bemta-4.messagelabs.com id 79/45-05872-6A052245; Wed, 24 Sep 2014 05:03:34 +0000 X-Env-Sender: roy.franz@linaro.org X-Msg-Ref: server-12.tower-21.messagelabs.com!1411535012!12793163!1 X-Originating-IP: [209.85.213.176] 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 14967 invoked from network); 24 Sep 2014 05:03:34 -0000 Received: from mail-ig0-f176.google.com (HELO mail-ig0-f176.google.com) (209.85.213.176) by server-12.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 24 Sep 2014 05:03:34 -0000 Received: by mail-ig0-f176.google.com with SMTP id hn15so5903667igb.9 for ; Tue, 23 Sep 2014 22:03:32 -0700 (PDT) X-Received: by 10.50.32.2 with SMTP id e2mr27860627igi.33.1411535012677; Tue, 23 Sep 2014 22:03:32 -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 ig9sm3477662igb.13.2014.09.23.22.03.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Sep 2014 22:03:32 -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, 23 Sep 2014 22:03:03 -0700 Message-Id: <1411534992-27443-6-git-send-email-roy.franz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1411534992-27443-1-git-send-email-roy.franz@linaro.org> References: <1411534992-27443-1-git-send-email-roy.franz@linaro.org> Cc: Roy Franz , fu.wei@linaro.org Subject: [Xen-devel] [PATCH for-4.5 V6 05/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.217.179 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 07b0509..049e5f3 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -251,3 +251,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 dea0954..0b096a6 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -54,6 +54,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; @@ -842,6 +848,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); @@ -859,17 +868,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 ) { @@ -908,6 +906,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;