From patchwork Thu Sep 26 12:56:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 20601 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f200.google.com (mail-qc0-f200.google.com [209.85.216.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 805A323A4E for ; Thu, 26 Sep 2013 12:56:58 +0000 (UTC) Received: by mail-qc0-f200.google.com with SMTP id x20sf918015qcv.7 for ; Thu, 26 Sep 2013 05:56:58 -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=ZLFXyf5CAn5ix+gfCT11o21oZqd/TvuJKHUM9fQbvoQ=; b=FWqHU5ryOScdggKMgXit6uhMUlRjVJyhInvmJSF/74vi3J5SdhCpukh1qRDBbM8leT 8CeylnJhbhWuKr9Xe9JI7xm4wQtttKbuX7UVA57lDzmA/jau9Z6pLwzjaP9DRtoGsb2D ZoYkki3cTW+IljNOP0OfaJvGNgdEeSYFPZxxTiBo5VRZ+WZIXoeChUd1AY8ag/38QEBi de/chUY9xNvp8PrjAd2MRBfkXg08T64wz6apj8xQ/FLsu69IxRbB8nApOZwqOD9OMJd8 ttAiW5EAgNDZ14Sc0YyZY6UBDWwYtTJbRNRV/I78F1oJDZFeb+ucM0Qyk7wwbGJR50Pt S9Dw== X-Gm-Message-State: ALoCoQmEA5Ut6f2/4wW+quRFi/JgTqUWE5MN8LCXCft2hVoDyoGrg9W9eSFO9mMItM+/NNXq25kv X-Received: by 10.236.129.194 with SMTP id h42mr136711yhi.11.1380200218386; Thu, 26 Sep 2013 05:56:58 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.116.135 with SMTP id jw7ls878861qeb.58.gmail; Thu, 26 Sep 2013 05:56:58 -0700 (PDT) X-Received: by 10.58.134.16 with SMTP id pg16mr504376veb.21.1380200218258; Thu, 26 Sep 2013 05:56:58 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id ti4si355086vec.99.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Sep 2013 05:56:58 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.172 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id hu8so817940vcb.3 for ; Thu, 26 Sep 2013 05:56:28 -0700 (PDT) X-Received: by 10.58.75.131 with SMTP id c3mr549556vew.12.1380200188057; Thu, 26 Sep 2013 05:56:28 -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 u4csp364669vcz; Thu, 26 Sep 2013 05:56:27 -0700 (PDT) X-Received: by 10.180.90.197 with SMTP id by5mr27436932wib.43.1380200187045; Thu, 26 Sep 2013 05:56:27 -0700 (PDT) Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com [209.85.212.181]) by mx.google.com with ESMTPS id pi5si589775wjb.127.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Sep 2013 05:56:27 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.181 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=209.85.212.181; Received: by mail-wi0-f181.google.com with SMTP id ex4so1174859wid.2 for ; Thu, 26 Sep 2013 05:56:26 -0700 (PDT) X-Received: by 10.180.189.132 with SMTP id gi4mr27586313wic.19.1380200186605; Thu, 26 Sep 2013 05:56:26 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id e1sm27960510wij.6.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Sep 2013 05:56:25 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Cc: stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com, patches@linaro.org, andre.przywara@linaro.org, Julien Grall Subject: [PATCH v2 4/4] xen/dts: Support Linux initrd DT bindings Date: Thu, 26 Sep 2013 13:56:18 +0100 Message-Id: <1380200178-30776-5-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1380200178-30776-1-git-send-email-julien.grall@linaro.org> References: <1380200178-30776-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.220.172 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 32cbb1e..8154eaf 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; }