From patchwork Thu Jun 9 17:21:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot for Dave Martin X-Patchwork-Id: 866172 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p59HMclD015683 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 9 Jun 2011 17:22:59 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QUiw7-0001cH-9K; Thu, 09 Jun 2011 17:22:27 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QUiw6-0003Pr-MQ; Thu, 09 Jun 2011 17:22:26 +0000 Received: from mail-wy0-f177.google.com ([74.125.82.177]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QUivn-0003M5-Ha for linux-arm-kernel@lists.infradead.org; Thu, 09 Jun 2011 17:22:09 +0000 Received: by wyb28 with SMTP id 28so1737496wyb.36 for ; Thu, 09 Jun 2011 10:22:04 -0700 (PDT) Received: by 10.227.199.80 with SMTP id er16mr1064654wbb.78.1307640123767; Thu, 09 Jun 2011 10:22:03 -0700 (PDT) Received: from e200948.peterhouse.linaro.org (fw-lnat.cambridge.arm.com [217.140.96.63]) by mx.google.com with ESMTPS id fw15sm1383187wbb.27.2011.06.09.10.22.02 (version=SSLv3 cipher=OTHER); Thu, 09 Jun 2011 10:22:03 -0700 (PDT) From: Dave Martin To: linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 1/2] ARM: Add a generic macro for declaring proc_info structs Date: Thu, 9 Jun 2011 18:21:51 +0100 Message-Id: <1307640112-5360-2-git-send-email-dave.martin@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1307640112-5360-1-git-send-email-dave.martin@linaro.org> References: <1307640112-5360-1-git-send-email-dave.martin@linaro.org> X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110609_132207_888687_9CA68BA1 X-CRM114-Status: GOOD ( 11.85 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.177 listed in list.dnswl.org] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 09 Jun 2011 17:22:59 +0000 (UTC) Using a macro allows the structure declarations to be more readable and shorter, as well as enabling build-time checking of the structure layout. Signed-off-by: Dave Martin --- arch/arm/mm/proc-macros.S | 141 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 141 insertions(+), 0 deletions(-) diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S index 34261f9..fe78f3b 100644 --- a/arch/arm/mm/proc-macros.S +++ b/arch/arm/mm/proc-macros.S @@ -254,3 +254,144 @@ mcr p15, 0, r0, c7, c10, 1 @ clean L1 D line mcr p15, 0, ip, c7, c10, 4 @ data write barrier .endm + +/* + * proc_info structure declaration macro + */ + .macro proc_info name:req + .macro _proc_check_align fieldname:req, align:req + .if . - \name != (\align ) + .error "Unexpected or misaligned proc_info field \fieldname" + .endif + .endm + + .macro cpu_val value:req + _proc_check_align cpu_val, 0 + .long \value + .endm + + .macro cpu_mask value:req + _proc_check_align cpu_mask, 4 + .long \value + .endm + + /* + * Normal memory MMU flags for CPUs with no SMP support. + * For CPUs with SMP support, use __cpu_mm_mmu_flags_smp and + * __cpu_mm_mmu_flags_up instead. + */ + .macro __cpu_mm_mmu_flags value:req + _proc_check_align __cpu_mm_mmu_flags, PROCINFO_MM_MMUFLAGS + .long \value + .endm + + .macro __cpu_mm_mmu_flags_smp value:req + _proc_check_align __cpu_mm_mmu_flags_smp, PROCINFO_MM_MMUFLAGS + ALT_SMP( .long \value ) + .endm + + /* + * __cpu_mm_mmu_flags_up must follow __cpu_mm_mmu_flags_smp, + * so the assembly-time offset is actually PROCINFO_IO_MMUFLAGS. + * This macro generates fixups, rather than direct output. + */ + .macro __cpu_mm_mmu_flags_up value:req + _proc_check_align __cpu_mm_mmu_flags_up, PROCINFO_IO_MMUFLAGS + ALT_UP( .long \value ) + .endm + + .macro __cpu_io_mmu_flags value:req + _proc_check_align __cpu_io_mmu_flags, PROCINFO_IO_MMUFLAGS + .long \value + .endm + + .macro __cpu_flush insn:vararg + _proc_check_align __cpu_flush, PROCINFO_INITFUNC + \insn + .endm + + .macro arch_name string:req + _proc_check_align arch_name, 0x14 + .pushsection .rodata.str, "aMS", 1 +\name\()_arch_name: .asciz "\string" + .size \name\()_arch_name, . - \name\()_arch_name + .type \name\()_arch_name, #object + .popsection + .long \name\()_arch_name + .endm + + .macro elf_name string:req + _proc_check_align elf_name, 0x18 + .pushsection .rodata.str, "aMS", 1 +\name\()_elf_name: .asciz "\string" + .size \name\()_elf_name, . - \name\()_elf_name + .type \name\()_elf_name, #object + .popsection + .long \name\()_elf_name + .endm + + .macro elf_hwcap value:req + _proc_check_align elf_hwcap, 0x1c + .long \value + .endm + + .macro cpu_name string:req + _proc_check_align cpu_name, 0x20 + .pushsection .rodata.str, "aMS", 1 +\name\()_cpu_name: .asciz "\string" + .size \name\()_cpu_name, . - \name\()_cpu_name + .type \name\()_cpu_name, #object + .popsection + .long \name\()_cpu_name + .endm + + .macro proc label:req + _proc_check_align proc, 0x24 + .long \label + .endm + + .macro tlb label:req + _proc_check_align tlb, 0x28 + .long \label + .endm + + .macro user label:req + _proc_check_align user, 0x2c + .long \label + .endm + + .macro cache label:req + _proc_check_align cache, 0x30 + .long \label + .endm + + .macro end_proc_info + .if . - \name != PROC_INFO_SZ + .error "incorrect number of fields in proc_info" + .endif + .size \name , . - \name + .type \name , #object + .popsection + .purgem end_proc_info + .purgem _proc_check_align + .purgem cpu_val + .purgem cpu_mask + .purgem __cpu_mm_mmu_flags + .purgem __cpu_mm_mmu_flags_smp + .purgem __cpu_mm_mmu_flags_up + .purgem __cpu_io_mmu_flags + .purgem __cpu_flush + .purgem arch_name + .purgem elf_name + .purgem elf_hwcap + .purgem cpu_name + .purgem proc + .purgem tlb + .purgem user + .purgem cache + .endm + + .pushsection .proc.info.init, #alloc, #execinstr + .align 2 +\name : + .endm