From patchwork Wed Jul 14 15:18:53 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew McClintock X-Patchwork-Id: 58911 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 57AEC1007F4 for ; Thu, 15 Jul 2010 01:19:06 +1000 (EST) Received: from VA3EHSOBE003.bigfish.com (va3ehsobe003.messaging.microsoft.com [216.32.180.13]) by ozlabs.org (Postfix) with ESMTP id C1322B6ED0 for ; Thu, 15 Jul 2010 01:18:57 +1000 (EST) Received: from mail149-va3-R.bigfish.com (10.7.14.247) by VA3EHSOBE003.bigfish.com (10.7.40.23) with Microsoft SMTP Server id 8.1.340.0; Wed, 14 Jul 2010 15:18:40 +0000 Received: from mail149-va3 (localhost.localdomain [127.0.0.1]) by mail149-va3-R.bigfish.com (Postfix) with ESMTP id 0BB76F003BA; Wed, 14 Jul 2010 15:18:40 +0000 (UTC) X-SpamScore: 3 X-BigFish: VS3(zzzz1202h1082kzzz2dh2a8h62h) X-Spam-TCS-SCL: 1:0 Received: from mail149-va3 (localhost.localdomain [127.0.0.1]) by mail149-va3 (MessageSwitch) id 1279120719682882_24094; Wed, 14 Jul 2010 15:18:39 +0000 (UTC) Received: from VA3EHSMHS015.bigfish.com (unknown [10.7.14.235]) by mail149-va3.bigfish.com (Postfix) with ESMTP id A41921AD0051; Wed, 14 Jul 2010 15:18:39 +0000 (UTC) Received: from az33egw02.freescale.net (192.88.158.103) by VA3EHSMHS015.bigfish.com (10.7.99.25) with Microsoft SMTP Server (TLS) id 14.0.482.44; Wed, 14 Jul 2010 15:18:37 +0000 Received: from az33smr01.freescale.net (az33smr01.freescale.net [10.64.34.199]) by az33egw02.freescale.net (8.14.3/8.14.3) with ESMTP id o6EFIZkn009294; Wed, 14 Jul 2010 08:18:35 -0700 (MST) Received: from localhost.localdomain (pandora.am.freescale.net [10.82.123.16]) by az33smr01.freescale.net (8.13.1/8.13.0) with ESMTP id o6EFTFCK000038; Wed, 14 Jul 2010 10:29:16 -0500 (CDT) From: Matthew McClintock To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH V4] powerpc/prom: Export device tree physical address via proc Date: Wed, 14 Jul 2010 10:18:53 -0500 Message-ID: <1279120733-13584-1-git-send-email-msm@freescale.com> X-Mailer: git-send-email 1.5.6.5 MIME-Version: 1.0 X-Reverse-DNS: az33egw02.freescale.net Cc: Matthew McClintock , Kumar Gala , Timur Tabi X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org To build a proper flat device tree for kexec we need to know which memreserve region was used for the device tree for the currently running kernel, so we can remove it and replace it with the new memreserve for the kexec'ed kernel Signed-off-by: Matthew McClintock --- V4: Fixed misspelling V3: Remove unneeded cast, and fixed indentation screw up V2: messed up changes arch/powerpc/kernel/prom.c | 45 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 45 insertions(+), 0 deletions(-) diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index fd9359a..ff3e240 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -911,3 +912,47 @@ static int __init export_flat_device_tree(void) } __initcall(export_flat_device_tree); #endif + +#ifdef CONFIG_KEXEC +static phys_addr_t flat_dt_start; +static phys_addr_t flat_dt_end; + +static struct property flat_dt_start_prop = { + .name = "linux,devicetree-start", + .length = sizeof(phys_addr_t), + .value = &flat_dt_start, +}; + +static struct property flat_dt_end_prop = { + .name = "linux,devicetree-end", + .length = sizeof(phys_addr_t), + .value = &flat_dt_end, +}; + +static int __init export_flat_device_tree_phys_addr(void) +{ + struct property *prop; + struct device_node *node; + + node = of_find_node_by_path("/chosen"); + if (!node) + return -ENOENT; + + prop = of_find_property(node, "linux,devicetree-start", NULL); + if (prop) + prom_remove_property(node, prop); + + prop = of_find_property(node, "linux,devicetree-end", NULL); + if (prop) + prom_remove_property(node, prop); + + flat_dt_start = virt_to_phys(initial_boot_params); + flat_dt_end = virt_to_phys(initial_boot_params) + + initial_boot_params->totalsize; + prom_add_property(node, &flat_dt_start_prop); + prom_add_property(node, &flat_dt_end_prop); + + return 0; +} +__initcall(export_flat_device_tree_phys_addr); +#endif