From patchwork Mon Jan 26 19:16:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 5712321 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D31329F302 for ; Mon, 26 Jan 2015 19:19:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 026622015A for ; Mon, 26 Jan 2015 19:19:06 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 29A3C2011D for ; Mon, 26 Jan 2015 19:19:05 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YFpA2-0001dK-Pa; Mon, 26 Jan 2015 19:17:22 +0000 Received: from mail-wi0-x22e.google.com ([2a00:1450:400c:c05::22e]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YFp9w-0001XO-1e for linux-arm-kernel@lists.infradead.org; Mon, 26 Jan 2015 19:17:16 +0000 Received: by mail-wi0-f174.google.com with SMTP id n3so53059wiv.1 for ; Mon, 26 Jan 2015 11:16:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:user-agent:cc:references:in-reply-to :mime-version:content-type:content-transfer-encoding:message-id; bh=VnoXBwYxzZHzfKuUB57D3YvlqZIZSlU8YDrqPHIHkI0=; b=0KqSn5fzfn9VJXeuRvf6CF7Zc2UVUMegbvEVsH4dt/1OXhdbpsnukG6s4PByPGcJ/3 do6iorInRx2Zu4d0aBqbJC18GL28GmYZFdlSNDwC+DnIl6aIRT0zqvo/uSkLu587OWyi GWC7gArt8hTdDgFxypdI8M35glCXL+d2NRB8Hd/hq6J7ZcbufBmd1Z+eBWRyoLSIOs0J r4FfM7PzA6oxkX1D409IabBAsmwk+1PCKBYNHFAu7PORqvOhWSTT57ISPsv0FkliDWAO SOCC48UHF4tI/aX5Heh9aWqXKwc1e5AyDs4Kbq7St2z8PpCwTkcTf4PcF9wAPzSqPlBD 7zOQ== X-Received: by 10.180.12.75 with SMTP id w11mr29698944wib.9.1422299813740; Mon, 26 Jan 2015 11:16:53 -0800 (PST) Received: from pali-latitude.localnet ([2001:718:1e03:a01::1ca]) by mx.google.com with ESMTPSA id v7sm15124433wib.5.2015.01.26.11.16.52 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 26 Jan 2015 11:16:52 -0800 (PST) From: Pali =?utf-8?q?Roh=C3=A1r?= To: Rob Herring Subject: [PATCH] ARM: /proc/atags: Export also for DT Date: Mon, 26 Jan 2015 20:16:52 +0100 User-Agent: KMail/1.13.7 (Linux/3.13.0-44-generic; KDE/4.14.2; x86_64; ; ) References: <1403110464-29646-1-git-send-email-pali.rohar@gmail.com> <201412041857.49341@pali> In-Reply-To: MIME-Version: 1.0 Message-Id: <201501262016.52079@pali> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150126_111716_231370_1CB77EB4 X-CRM114-Status: GOOD ( 14.20 ) X-Spam-Score: -0.8 (/) Cc: Ivaylo Dimitrov , Russell King , Tony Lindgren , Sebastian Reichel , Will Deacon , "linux-kernel@vger.kernel.org" , Pavel Machek , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch will cause that decompressor store full ATAG structure into DT tree ("/atags"): Some userspace applications needs access to ATAG structure where can be stored some information passed from bootloader to kernel. Example is Nokia N900 device and NOLO bootloader which provides information about bootreason (device was started by power button or by alarm or restarted...) and bootmode (normal mode or device update mode). diff --git a/arch/arm/boot/compressed/atags_to_fdt.c b/arch/arm/boot/compressed/atags_to_fdt.c index e7e1cc9..1975d7c 100644 --- a/arch/arm/boot/compressed/atags_to_fdt.c +++ b/arch/arm/boot/compressed/atags_to_fdt.c @@ -112,7 +112,7 @@ int atags_to_fdt(void *atag_list, void *fdt, int total_space) * address and size for each bank */ uint32_t mem_reg_property[2 * 2 * NR_BANKS]; int memcount = 0; - int ret, memsize; + int ret, memsize, atag_size; /* make sure we've got an aligned pointer */ if ((u32)atag_list & 0x3) @@ -184,6 +184,10 @@ int atags_to_fdt(void *atag_list, void *fdt, int total_space) } } + /* include the terminating ATAG_NONE */ + atag_size = (char *)atag - (char *)atag_list + sizeof(struct tag_header); + setprop(fdt, "/", "atags", atag_list, atag_size); + if (memcount) { setprop(fdt, "/memory", "reg", mem_reg_property, 4 * memcount * memsize); And this patch will export ATAG structure from DT tree ("/atags") into /proc/atags file: diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c index 9946c1b..0f249a3 100644 --- a/arch/arm/kernel/devtree.c +++ b/arch/arm/kernel/devtree.c @@ -29,6 +29,7 @@ #include #include +#include "atags.h" #ifdef CONFIG_SMP extern struct of_cpu_method __cpu_method_of_table[]; @@ -254,5 +255,10 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys) if (prop) system_rev = fdt32_to_cpu(*prop); + /* Save atags */ + prop = of_get_flat_dt_prop(dt_root, "atags", NULL); + if (prop) + save_atags((void *)prop); + return mdesc; }