From patchwork Thu Sep 18 22:49:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Franz X-Patchwork-Id: 37614 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f200.google.com (mail-we0-f200.google.com [74.125.82.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 931A02054E for ; Thu, 18 Sep 2014 22:52:21 +0000 (UTC) Received: by mail-we0-f200.google.com with SMTP id u57sf1034757wes.7 for ; Thu, 18 Sep 2014 15:52:20 -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=nhkHTARcm4AWV1fZrpryenpQc46We7ZF+XAWJMgfa5s=; b=Me/gyG1xu4VLtxN41EZvMt9KjkSp+VT0j/h0sWG+oaI9N6QszW3f/PPlPXKEFxuLu+ XgUJaXZ0435RhK06MbKuDZwKkBbFrZBYG4wi9Q2DF3dvacRaBXEeSRxnbwXGNplKcM73 M7mmdrF6+LMma7DODx0zVLhr8tczZ5Vg4HXi9fabYThmgiH+9We++OtuW9mlGVPttlHP oSHGsKlje+rPbWoDzIMvE8HzxzbIgaoyVV42C9wiMcNRNb1dwAdXlbCHOf9B5tJ36c5u NFoMmJaUm3CN7w9pjM1ajm2trAliNvXl4pE+f0Hog6vor4CoUlT/XoYnMW3lpzS/yubw M5KQ== X-Gm-Message-State: ALoCoQkdisDOsywLSx8QantwwcR7/A54c2fkZzz00D2IuaDKbTm+zkSEA0rYWCk5SQB+41cZt2Ht X-Received: by 10.194.57.237 with SMTP id l13mr12544wjq.7.1411080740724; Thu, 18 Sep 2014 15:52:20 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.88.8 with SMTP id bc8ls256505lab.86.gmail; Thu, 18 Sep 2014 15:52:20 -0700 (PDT) X-Received: by 10.152.20.132 with SMTP id n4mr2750770lae.86.1411080740407; Thu, 18 Sep 2014 15:52:20 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com [209.85.215.42]) by mx.google.com with ESMTPS id y9si210753lbr.1.2014.09.18.15.52.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Sep 2014 15:52:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by mail-la0-f42.google.com with SMTP id hz20so2103728lab.1 for ; Thu, 18 Sep 2014 15:52:20 -0700 (PDT) X-Received: by 10.152.204.231 with SMTP id lb7mr2807535lac.44.1411080740299; Thu, 18 Sep 2014 15:52:20 -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 of9csp843137lbb; Thu, 18 Sep 2014 15:52:19 -0700 (PDT) X-Received: by 10.224.69.195 with SMTP id a3mr13478687qaj.59.1411080738803; Thu, 18 Sep 2014 15:52:18 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id s39si211704qgd.19.2014.09.18.15.52.18 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 18 Sep 2014 15:52:18 -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 1XUkWw-0006Jx-J9; Thu, 18 Sep 2014 22:50:26 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XUkWu-0006J6-FR for xen-devel@lists.xen.org; Thu, 18 Sep 2014 22:50:24 +0000 Received: from [85.158.143.35:7095] by server-3.bemta-4.messagelabs.com id 30/9F-06192-FA16B145; Thu, 18 Sep 2014 22:50:23 +0000 X-Env-Sender: roy.franz@linaro.org X-Msg-Ref: server-6.tower-21.messagelabs.com!1411080621!13998734!1 X-Originating-IP: [209.85.192.175] 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 16960 invoked from network); 18 Sep 2014 22:50:23 -0000 Received: from mail-pd0-f175.google.com (HELO mail-pd0-f175.google.com) (209.85.192.175) by server-6.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 18 Sep 2014 22:50:23 -0000 Received: by mail-pd0-f175.google.com with SMTP id z10so2310407pdj.34 for ; Thu, 18 Sep 2014 15:50:21 -0700 (PDT) X-Received: by 10.70.87.134 with SMTP id ay6mr11446873pdb.68.1411080621251; Thu, 18 Sep 2014 15:50:21 -0700 (PDT) Received: from rfranz-t520.swisscom.com (70-35-38-154.static.wiline.com. [70.35.38.154]) by mx.google.com with ESMTPSA id ig4sm66332pbb.55.2014.09.18.15.50.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 18 Sep 2014 15:50:20 -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: Thu, 18 Sep 2014 15:49:56 -0700 Message-Id: <1411080607-32365-6-git-send-email-roy.franz@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1411080607-32365-1-git-send-email-roy.franz@linaro.org> References: <1411080607-32365-1-git-send-email-roy.franz@linaro.org> Cc: Roy Franz , fu.wei@linaro.org Subject: [Xen-devel] [PATCH V5 05/15] 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.42 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/common/efi/boot.c | 21 ++++++++++----------- xen/include/asm-x86/efi-boot.h | 20 ++++++++++++++++++++ 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index f4662b4..58e3cbc 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; @@ -843,6 +849,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); @@ -860,17 +869,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 ) { @@ -909,6 +907,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; diff --git a/xen/include/asm-x86/efi-boot.h b/xen/include/asm-x86/efi-boot.h index 7aba173..93498bb 100644 --- a/xen/include/asm-x86/efi-boot.h +++ b/xen/include/asm-x86/efi-boot.h @@ -259,3 +259,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); + } +}