linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: dave.martin@linaro.org (Dave Martin)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH v2 1/5] ARM: mm: Add generic proc/arch struct definition macros
Date: Tue, 14 Jun 2011 11:58:21 +0100	[thread overview]
Message-ID: <1308049105-16080-2-git-send-email-dave.martin@linaro.org> (raw)
In-Reply-To: <1308049105-16080-1-git-send-email-dave.martin@linaro.org>

This patch adds some generic macros to reduce boilerplate when
declaring certain common structures in arch/arm/mm/*.S

Thanks to Russell King for outlining what the
define_processor_functions macro could look like.

Signed-off-by: Dave Martin <dave.martin@linaro.org>
---
 arch/arm/mm/proc-macros.S |   79 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 79 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
index 34261f9..3c5ffbb 100644
--- a/arch/arm/mm/proc-macros.S
+++ b/arch/arm/mm/proc-macros.S
@@ -4,6 +4,7 @@
  *  VMA_VM_FLAGS
  *  VM_EXEC
  */
+#include <linux/init.h>
 #include <asm/asm-offsets.h>
 #include <asm/thread_info.h>
 
@@ -254,3 +255,81 @@
 	mcr	p15, 0, r0, c7, c10, 1		@ clean L1 D line
 	mcr	p15, 0, ip, c7, c10, 4		@ data write barrier
 	.endm
+
+.macro define_processor_functions name:req, dabort:req, pabort:req, nommu=0, suspend=0
+	.pushsection .text
+
+	__INITDATA
+
+	.type	\name\()_processor_functions, #object
+
+ENTRY(\name\()_processor_functions)
+	.word	\dabort\()_abort
+	.word	\pabort\()_pabort
+	.word	cpu_\name\()_proc_init
+	.word	cpu_\name\()_proc_fin
+	.word	cpu_\name\()_reset
+	.word	cpu_\name\()_do_idle
+	.word	cpu_\name\()_dcache_clean_area
+	.word	cpu_\name\()_switch_mm
+
+	.if \nommu
+	.word	0
+	.else
+	.word	cpu_\name\()_set_pte_ext
+	.endif
+
+	.if \suspend
+	.word	cpu_\name\()_suspend_size
+	.word	cpu_\name\()_do_suspend
+	.word	cpu_\name\()_do_resume
+	.else
+	.word	0
+	.word	0
+	.word	0
+	.endif
+
+	.size	\name\()_processor_functions, . - \name\()_processor_functions
+
+	.popsection
+.endm
+
+.macro define_proc_names name:req, arch:req, elf:req, cpu:req
+	.pushsection .rodata.str, "aMS", 1
+
+	.type \name\()_arch_name, #object
+\name\()_arch_name: .asciz "\arch"
+	.size \name\()_arch_name, . - \name\()_arch_name
+
+	.type \name\()_elf_name, #object
+\name\()_elf_name: .asciz "\elf"
+	.size \name\()_elf_name, . - \name\()_elf_name
+
+	.type \name\()_cpu_name, #object
+\name\()_cpu_name: .asciz "\cpu"
+	.size \name\()_cpu_name, . - \name\()_cpu_name
+
+	.popsection
+.endm
+
+.macro define_cache_functions name:req
+	.pushsection .text
+
+	__INITDATA
+
+	.type	\name\()_cache_fns, #object
+ENTRY(\name\()_cache_fns)
+	.long	\name\()_flush_icache_all
+	.long	\name\()_flush_kern_cache_all
+	.long	\name\()_flush_user_cache_all
+	.long	\name\()_flush_user_cache_range
+	.long	\name\()_coherent_kern_range
+	.long	\name\()_coherent_user_range
+	.long	\name\()_flush_kern_dcache_area
+	.long	\name\()_dma_map_area
+	.long	\name\()_dma_unmap_area
+	.long	\name\()_dma_flush_range
+	.size	\name\()_cache_fns, . - \name\()_cache_fns
+
+	.popsection
+.endm
-- 
1.7.4.1

  reply	other threads:[~2011-06-14 10:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-14 10:58 [RFC PATCH v2 0/5] Add generic macros for declaring various CPU structs Dave Martin
2011-06-14 10:58 ` Dave Martin [this message]
2011-06-15 23:57   ` [RFC PATCH v2 1/5] ARM: mm: Add generic proc/arch struct definition macros Nicolas Pitre
2011-06-16 10:03     ` Dave Martin
2011-06-20  3:13       ` Nicolas Pitre
2011-06-20 10:56         ` Dave Martin
2011-06-14 10:58 ` [RFC PATCH v2 2/5] ARM: proc-v7: Use new generic " Dave Martin
2011-06-16 10:15   ` Will Deacon
2011-06-14 10:58 ` [RFC PATCH v2 3/5] ARM: cache-v7: " Dave Martin
2011-06-14 10:58 ` [RFC PATCH v2 4/5] ARM: proc-v6: " Dave Martin
2011-06-14 10:58 ` [RFC PATCH v2 5/5] ARM: cache-v6: " Dave Martin
2011-06-16 10:12 ` [RFC PATCH v2 0/5] Add generic macros for declaring various CPU structs Will Deacon
2011-06-16 10:15   ` Russell King - ARM Linux
2011-06-16 10:34     ` Dave Martin
2011-06-16 10:43   ` Dave Martin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1308049105-16080-2-git-send-email-dave.martin@linaro.org \
    --to=dave.martin@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).