From patchwork Sun May 17 20:03:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parth Dixit X-Patchwork-Id: 48648 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4268B21411 for ; Sun, 17 May 2015 20:06:51 +0000 (UTC) Received: by wgyu3 with SMTP id u3sf23645211wgy.3 for ; Sun, 17 May 2015 13:06:50 -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:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=0OpLGSoLO0LgnKWx9EwiYHH90oq0JsLMsyD4AT0EeSI=; b=ai65h6OkFreLiVf0eh+9llXW3atPAM/sG16haHxzEft4/SVYwFH9FlXQMePRoAiT1w A3eTvUNa6bP1yXjOH9YyWCltwrw6iIemsI9q85duAjT5D+HcnvH9FWJHOqzpeoCL/yhB 2y6mC7VxjFSgIXlqOWaw5+lhurBK+uHcfpNSb6ngwDIwJ1yEvGoOGvTCoicwq8ztAK+2 6FBJUNWkNGScShKBSWyXTqUQNOK71aiXHYGQQ9JAwB01Icutu22BRe5OUN6yt+nLkSKM 7eErzXGPd3VoyvVDDxQ57LEZrJFsDA2uyZeJg53YD9uN7Dm1+QP9bfnWiEBKnIyNFjsw pf7A== X-Gm-Message-State: ALoCoQm1Mj5O+kbXjxENu5b6kKDwFxotFmY+g8PuRGrT62GCuyX4ZzxLqAkVuySxPqLNmajHnbeb X-Received: by 10.180.10.136 with SMTP id i8mr7258404wib.7.1431893210572; Sun, 17 May 2015 13:06:50 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.103 with SMTP id kx7ls705397lac.62.gmail; Sun, 17 May 2015 13:06:50 -0700 (PDT) X-Received: by 10.112.140.9 with SMTP id rc9mr15127724lbb.14.1431893210406; Sun, 17 May 2015 13:06:50 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id yo3si5315710lbb.167.2015.05.17.13.06.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 May 2015 13:06:50 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by laat2 with SMTP id t2so191063545laa.1 for ; Sun, 17 May 2015 13:06:50 -0700 (PDT) X-Received: by 10.112.219.70 with SMTP id pm6mr14523297lbc.41.1431893210316; Sun, 17 May 2015 13:06: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.108.230 with SMTP id hn6csp3508049lbb; Sun, 17 May 2015 13:06:49 -0700 (PDT) X-Received: by 10.140.38.19 with SMTP id s19mr25595343qgs.14.1431893199750; Sun, 17 May 2015 13:06:39 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id t4si8299275qge.10.2015.05.17.13.06.39 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 17 May 2015 13:06:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) 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 1Yu4oy-0002jC-QK; Sun, 17 May 2015 20:06:00 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Yu4ow-0002fs-IO for xen-devel@lists.xen.org; Sun, 17 May 2015 20:05:58 +0000 Received: from [193.109.254.147] by server-10.bemta-14.messagelabs.com id 84/16-02785-5A4F8555; Sun, 17 May 2015 20:05:57 +0000 X-Env-Sender: parth.dixit@linaro.org X-Msg-Ref: server-16.tower-27.messagelabs.com!1431893155!10643355!1 X-Originating-IP: [209.85.192.176] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.13.15; banners=-,-,- X-VirusChecked: Checked Received: (qmail 30769 invoked from network); 17 May 2015 20:05:56 -0000 Received: from mail-pd0-f176.google.com (HELO mail-pd0-f176.google.com) (209.85.192.176) by server-16.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 17 May 2015 20:05:56 -0000 Received: by pdbqa5 with SMTP id qa5so117377073pdb.0 for ; Sun, 17 May 2015 13:05:54 -0700 (PDT) X-Received: by 10.66.192.199 with SMTP id hi7mr38856988pac.15.1431893154739; Sun, 17 May 2015 13:05:54 -0700 (PDT) Received: from localhost.localdomain ([117.247.24.139]) by mx.google.com with ESMTPSA id j9sm7838401pdm.53.2015.05.17.13.05.51 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 17 May 2015 13:05:54 -0700 (PDT) From: Parth Dixit To: xen-devel@lists.xen.org Date: Mon, 18 May 2015 01:33:50 +0530 Message-Id: <1431893048-5214-24-git-send-email-parth.dixit@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1431893048-5214-1-git-send-email-parth.dixit@linaro.org> References: <1431893048-5214-1-git-send-email-parth.dixit@linaro.org> Cc: keir@xen.org, ian.campbell@citrix.com, andrew.cooper3@citrix.com, tim@xen.org, julien.grall@citrix.com, stefano.stabellini@citrix.com, jbeulich@suse.com, parth.dixit@linaro.org, christoffer.dall@linaro.org Subject: [Xen-devel] [PATCH v2 23/41] arm : acpi create chosen node for DOM0 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: parth.dixit@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.47 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: Create a chosen node for DOM0 with - bootargs - initrd Signed-off-by: Naresh Bhat Signed-off-by: Parth Dixit --- xen/arch/arm/domain_build.c | 46 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index c830702..e688a78 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1219,6 +1219,47 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo, return res; } #ifdef CONFIG_ACPI +static int make_chosen_node(struct domain *d, const struct kernel_info *kinfo) +{ + int res = 0; + const char *bootargs = NULL; + const struct bootmodule *mod = kinfo->kernel_bootmodule; + void *fdt = kinfo->fdt; + + DPRINT("Create bootargs chosen node\n"); + + if ( mod && mod->cmdline[0] ) + bootargs = &mod->cmdline[0]; + + res = fdt_begin_node(fdt, "chosen"); + if ( res ) + return res; + + res = fdt_property(fdt, "bootargs", bootargs, (strlen(bootargs)+1)); + if ( res ) + return res; + + /* + * If the bootloader provides an initrd, we must create a placeholder + * for the initrd properties. The values will be replaced later. + */ + if ( mod && mod->size ) + { + u64 a = 0; + res = fdt_property(kinfo->fdt, "linux,initrd-start", &a, sizeof(a)); + if ( res ) + return res; + + res = fdt_property(kinfo->fdt, "linux,initrd-end", &a, sizeof(a)); + if ( res ) + return res; + } + + res = fdt_end_node(fdt); + + return res; +} + /* * Prepare a minimal DTB for DOM0 which contains * bootargs, initrd, memory information, @@ -1259,6 +1300,11 @@ static int create_acpi_dtb(struct domain *d, struct kernel_info *kinfo, struct m if ( ret ) return ret; + /* Create a chosen node for DOM0 */ + ret = make_chosen_node(d, kinfo); + if ( ret ) + goto err; + ret = fdt_end_node(kinfo->fdt); if ( ret < 0 ) goto err;