[U-Boot] [RESEND PATCH v3 4/6] arm: Add processor function library

Simon Glass sjg at chromium.org
Mon Jan 16 21:03:21 CET 2012


Add a library to hold ARM assembler code which is generic across all
ARM CPUs. At first it just holds some basic relocation code. The
plan is to move more start.S code here.

Signed-off-by: Simon Glass <sjg at chromium.org>
---
Changes in v2:
- Invalidate I-cache when we jump to relocated code

 arch/arm/lib/Makefile |    2 ++
 arch/arm/lib/proc.S   |   40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/lib/proc.S

diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index 300c8fa..213c76f 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -48,6 +48,8 @@ SOBJS-$(CONFIG_USE_ARCH_MEMSET) += memset.o
 SOBJS-$(CONFIG_USE_ARCH_MEMCPY) += memcpy.o
 endif
 
+SOBJS-y += proc.o
+
 SRCS	:= $(GLSOBJS:.o=.S) $(GLCOBJS:.o=.c) \
 	   $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
 OBJS	:= $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
diff --git a/arch/arm/lib/proc.S b/arch/arm/lib/proc.S
new file mode 100644
index 0000000..dba7c11
--- /dev/null
+++ b/arch/arm/lib/proc.S
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors.
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+
+/**
+ * Jump to board_init_r with a new stack pointer
+ *
+ * @param gd	Pointer to global data
+ * @param dest_addr	Destination address from global data
+ * @param func	Address of board_init_r function (relocated)
+ * @param sp	New stack pointer
+ */
+.globl proc_call_board_init_r
+proc_call_board_init_r:
+#ifndef CONFIG_SYS_ICACHE_OFF
+	mcr	p15, 0, r0, c7, c5, 0	@ invalidate icache
+	mcr     p15, 0, r0, c7, c10, 4	@ DSB
+	mcr     p15, 0, r0, c7, c5, 4	@ ISB
+#endif
+	mov	sp, r3
+	/* jump to it ... */
+	mov	pc, r2
-- 
1.7.7.3



More information about the U-Boot mailing list