From patchwork Fri Dec 7 15:31:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shiyan X-Patchwork-Id: 1851131 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 53B13400ED for ; Fri, 7 Dec 2012 15:34:33 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Tgzu4-0002Sc-CP; Fri, 07 Dec 2012 15:31:52 +0000 Received: from smtp34.i.mail.ru ([94.100.177.94]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Tgztz-0002Qg-P3 for linux-arm-kernel@lists.infradead.org; Fri, 07 Dec 2012 15:31:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail; h=Content-Transfer-Encoding:Content-Type:Mime-Version:Message-Id:Subject:Cc:To:From:Date; bh=Eg1fD9y7RrA+NOp6SL4Jm/Xee8O34iWC/ClvS+fcGXY=; b=GcXwSXikNT2+cAtsrbE5A+VG8/v/ExvPyw6dYCWnfMJm/QdYWe7h0NCzWd/7Q5Jb+Dk7Bsd95wO0wqAIAIlMSc7azyEd6/YlBgwxM7Z9FTQW0O+0a+w7U0x3tePgw/O8; Received: from [188.134.40.128] (port=52723 helo=localhost) by smtp34.i.mail.ru with esmtpa (envelope-from ) id 1Tgztw-0007ab-7c; Fri, 07 Dec 2012 19:31:44 +0400 Date: Fri, 7 Dec 2012 19:31:43 +0400 From: Alexander Shiyan To: linux-arm-kernel@lists.infradead.org Subject: Question: Multiple board support is broken Message-Id: <20121207193143.2d2029daf2041683bc7b2474@mail.ru> Organization: Mega-Milas X-Mailer: Sylpheed 3.2.0 (GTK+ 2.24.12; x86_64-pc-linux-gnu) Mime-Version: 1.0 X-Spam: Not detected X-Mras: Ok X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121207_103148_371791_A5853D9E X-CRM114-Status: GOOD ( 18.23 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (shc_work[at]mail.ru) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Russell King , Arnd Bergmann X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Hello. Today I was tested multiple boards (not multiplatform) in the kernel and found problems with booting. Exacly, if multiple boards defined in. config, we can proceed to boot only the last (determined by mach number). This problem is the result of a redefine "machine_arch_type" variable in the mach-types.h more than once for each machine. As a result, we can not use machine_is_xx () macros. The following is an attempt to make mach-types.h generator simple and solve this problem. Please comment and show me if I think is wrong. Thanks! From 7d4a967edb7bcb840d6d526b8de4a40d63a8ea82 Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Fri, 7 Dec 2012 19:01:26 +0400 Subject: [PATCH] Simplify mach-types.h Signed-off-by: Alexander Shiyan --- arch/arm/boot/compressed/misc.c | 5 ++--- arch/arm/kernel/devtree.c | 2 +- arch/arm/kernel/head-common.S | 2 +- arch/arm/kernel/setup.c | 4 ++-- arch/arm/mach-pxa/em-x270.c | 2 -- arch/arm/mach-pxa/trizeps4.c | 4 ++-- arch/arm/tools/gen-mach-types | 11 +---------- 7 files changed, 9 insertions(+), 21 deletions(-) diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c index df89983..86a2b0d 100644 --- a/arch/arm/boot/compressed/misc.c +++ b/arch/arm/boot/compressed/misc.c @@ -16,8 +16,6 @@ * This allows for a much quicker boot time. */ -unsigned int __machine_arch_type; - #include /* for inline */ #include #include @@ -112,6 +110,7 @@ unsigned char *output_data; unsigned long free_mem_ptr; unsigned long free_mem_end_ptr; +unsigned int machine_arch_type; #ifndef arch_error #define arch_error(x) @@ -146,7 +145,7 @@ decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p, output_data = (unsigned char *)output_start; free_mem_ptr = free_mem_ptr_p; free_mem_end_ptr = free_mem_ptr_end_p; - __machine_arch_type = arch_id; + machine_arch_type = arch_id; arch_decomp_setup(); diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c index 70f1bde..bbb9a02 100644 --- a/arch/arm/kernel/devtree.c +++ b/arch/arm/kernel/devtree.c @@ -232,7 +232,7 @@ struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys) of_scan_flat_dt(early_init_dt_scan_memory, NULL); /* Change machine number to match the mdesc we're using */ - __machine_arch_type = mdesc_best->nr; + machine_arch_type = mdesc_best->nr; return mdesc_best; } diff --git a/arch/arm/kernel/head-common.S b/arch/arm/kernel/head-common.S index 2f560c5..6e02251 100644 --- a/arch/arm/kernel/head-common.S +++ b/arch/arm/kernel/head-common.S @@ -112,7 +112,7 @@ __mmap_switched_data: .long __bss_start @ r6 .long _end @ r7 .long processor_id @ r4 - .long __machine_arch_type @ r5 + .long machine_arch_type @ r5 .long __atags_pointer @ r6 #ifdef CONFIG_CPU_CP15 .long cr_alignment @ r7 diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 86d1429..dc3c4b0 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -78,8 +78,8 @@ extern void setup_dma_zone(struct machine_desc *desc); unsigned int processor_id; EXPORT_SYMBOL(processor_id); -unsigned int __machine_arch_type __read_mostly; -EXPORT_SYMBOL(__machine_arch_type); +unsigned int machine_arch_type __read_mostly; +EXPORT_SYMBOL(machine_arch_type); unsigned int cacheid __read_mostly; EXPORT_SYMBOL(cacheid); diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c index 1b64114..939079a 100644 --- a/arch/arm/mach-pxa/em-x270.c +++ b/arch/arm/mach-pxa/em-x270.c @@ -1272,8 +1272,6 @@ static void __init em_x270_init(void) em_x270_module_init(); else if (machine_is_exeda()) em_x270_exeda_init(); - else - panic("Unsupported machine: %d\n", machine_arch_type); em_x270_init_da9030(); em_x270_init_dm9000(); diff --git a/arch/arm/mach-pxa/trizeps4.c b/arch/arm/mach-pxa/trizeps4.c index fbbcbed..7988e8b 100644 --- a/arch/arm/mach-pxa/trizeps4.c +++ b/arch/arm/mach-pxa/trizeps4.c @@ -544,11 +544,11 @@ static void __init trizeps4_map_io(void) if ((__raw_readl(MSC0) & 0x8) && (__raw_readl(BOOT_DEF) & 0x1)) { /* if flash is 16 bit wide its a Trizeps4 WL */ - __machine_arch_type = MACH_TYPE_TRIZEPS4WL; + machine_arch_type = MACH_TYPE_TRIZEPS4WL; trizeps4_flash_data[0].width = 2; } else { /* if flash is 32 bit wide its a Trizeps4 */ - __machine_arch_type = MACH_TYPE_TRIZEPS4; + machine_arch_type = MACH_TYPE_TRIZEPS4; trizeps4_flash_data[0].width = 4; } } diff --git a/arch/arm/tools/gen-mach-types b/arch/arm/tools/gen-mach-types index 04fef71..d36642d 100644 --- a/arch/arm/tools/gen-mach-types +++ b/arch/arm/tools/gen-mach-types @@ -30,7 +30,7 @@ END { printf("#define __ASM_ARM_MACH_TYPE_H\n\n"); printf("#ifndef __ASSEMBLY__\n"); printf("/* The type of machine we're running on */\n"); - printf("extern unsigned int __machine_arch_type;\n"); + printf("extern unsigned int machine_arch_type;\n"); printf("#endif\n\n"); printf("/* see arch/arm/kernel/arch.c for a description of these */\n"); @@ -43,12 +43,6 @@ END { for (i = 0; i < nr; i++) if (num[i] ~ /..*/) { printf("#ifdef %s\n", config[i]); - printf("# ifdef machine_arch_type\n"); - printf("# undef machine_arch_type\n"); - printf("# define machine_arch_type\t__machine_arch_type\n"); - printf("# else\n"); - printf("# define machine_arch_type\t%s\n", mach_type[i]); - printf("# endif\n"); printf("# define %s()\t(machine_arch_type == %s)\n", machine_is[i], mach_type[i]); printf("#else\n"); printf("# define %s()\t(0)\n", machine_is[i]); @@ -65,8 +59,5 @@ END { printf("#define %s()\t(0)\n", machine_is[i]); } - printf("\n#ifndef machine_arch_type\n"); - printf("#define machine_arch_type\t__machine_arch_type\n"); - printf("#endif\n\n"); printf("#endif\n"); }