From patchwork Fri Sep 27 16:56:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 20676 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f199.google.com (mail-ye0-f199.google.com [209.85.213.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B852E25E77 for ; Fri, 27 Sep 2013 16:57:29 +0000 (UTC) Received: by mail-ye0-f199.google.com with SMTP id l4sf2473198yen.2 for ; Fri, 27 Sep 2013 09:57:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=avwFGiXUSZwvvBg244UwSGpi7DfAe6Eve+GU7DwE7ng=; b=Ope3CgeTi6qJPivuZmikHrWtQZVqimd2tnxlKwVsCN11gg3rWj+A2bsNO4c3VrjnQl 33z0GLhVnh5raTi/nFgIpwxaJY6Y2w8f0ShEEUDSxHR1fDk4oGyjO3VTIQ2zlLpWEA/h YI0OqBWf4WfKCSZ3k0MVxJEdR2ruD24g6MZz7NzFf70OLBur/t/zLFU18/W3/jEHR6UJ gH6DItD0Gpbo/5RSIKK4YFJ70Gp7IKeOU5dS7xlQLiNL8ri0EH+SmQG07gu0Eecmwur7 /V6lUdTEtw5PiXiUfJZ4Lz/wCsRv/mn6rYN6Nc30fD1NtZrVx7dHeYOBd36O8I9s1xqu vjWA== X-Gm-Message-State: ALoCoQlFJYZ89dg7rfkyVlJqedSelUeBVAO7Pg/QHafJ/uW+W49weguEAAy1baYnl06MVumxjO7U X-Received: by 10.236.51.9 with SMTP id a9mr1436780yhc.41.1380301049526; Fri, 27 Sep 2013 09:57:29 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.76.100 with SMTP id j4ls1393143qew.29.gmail; Fri, 27 Sep 2013 09:57:29 -0700 (PDT) X-Received: by 10.220.74.69 with SMTP id t5mr7262259vcj.18.1380301049422; Fri, 27 Sep 2013 09:57:29 -0700 (PDT) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id st7si2050254vdc.81.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 27 Sep 2013 09:57:29 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.180; Received: by mail-ve0-f180.google.com with SMTP id jz11so2174281veb.39 for ; Fri, 27 Sep 2013 09:56:59 -0700 (PDT) X-Received: by 10.52.75.228 with SMTP id f4mr5872363vdw.6.1380301018953; Fri, 27 Sep 2013 09:56:58 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp439658vcz; Fri, 27 Sep 2013 09:56:58 -0700 (PDT) X-Received: by 10.194.94.137 with SMTP id dc9mr6892459wjb.38.1380301017874; Fri, 27 Sep 2013 09:56:57 -0700 (PDT) Received: from mail-we0-f180.google.com (mail-we0-f180.google.com [74.125.82.180]) by mx.google.com with ESMTPS id za4si3237618wjc.96.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 27 Sep 2013 09:56:57 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.180 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=74.125.82.180; Received: by mail-we0-f180.google.com with SMTP id u57so2990191wes.11 for ; Fri, 27 Sep 2013 09:56:57 -0700 (PDT) X-Received: by 10.180.103.103 with SMTP id fv7mr3428475wib.38.1380301017423; Fri, 27 Sep 2013 09:56:57 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id q5sm15639406wiz.3.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 27 Sep 2013 09:56:56 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Cc: stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com, patches@linaro.org, tim@xen.org, Julien Grall Subject: [PATCH v3 5/5] xen/dts: Support Linux initrd DT bindings Date: Fri, 27 Sep 2013 17:56:37 +0100 Message-Id: <1380300997-28099-6-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1380300997-28099-1-git-send-email-julien.grall@linaro.org> References: <1380300997-28099-1-git-send-email-julien.grall@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Linux uses the property linux,initrd-start and linux,initrd-end to know where the initrd lives in memory. Signed-off-by: Julien Grall Acked-by: Ian Campbell --- xen/common/device_tree.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c index ea8ed56..af0fb04 100644 --- a/xen/common/device_tree.c +++ b/xen/common/device_tree.c @@ -380,6 +380,29 @@ static void __init process_multiboot_node(const void *fdt, int node, early_info.modules.nr_mods = nr; } +static void __init process_chosen_node(const void *fdt, int node, + const char *name, + u32 address_cells, u32 size_cells) +{ + struct dt_mb_module *mod = &early_info.modules.module[MOD_INITRD]; + u32 start, end; + + dt_printk("Checking for initrd in /chosen\n"); + + start = device_tree_get_u32(fdt, node, "linux,initrd-start", 0); + end = device_tree_get_u32(fdt, node, "linux,initrd-end", 0); + + if ( !start || !end || (start >= end) ) + return; + + dt_printk("Initrd 0x%x-0x%x\n", start, end); + + mod->start = start; + mod->size = end - start; + + early_info.modules.nr_mods = MAX(MOD_INITRD, early_info.modules.nr_mods); +} + static int __init early_scan_node(const void *fdt, int node, const char *name, int depth, u32 address_cells, u32 size_cells, @@ -389,6 +412,8 @@ static int __init early_scan_node(const void *fdt, process_memory_node(fdt, node, name, address_cells, size_cells); else if ( device_tree_node_compatible(fdt, node, "xen,multiboot-module" ) ) process_multiboot_node(fdt, node, name, address_cells, size_cells); + else if ( depth == 1 && device_tree_node_matches(fdt, node, "chosen") ) + process_chosen_node(fdt, node, name, address_cells, size_cells); return 0; }