Module Name:    src
Committed By:   marty
Date:           Tue Nov 10 23:47:08 UTC 2015

Modified Files:
        src/sys/arch/evbarm/odroid: odroid_start.S

Log Message:
small cleanup of odroid_start.S

removed attempt to 'rescue bootargs' that was causing a hang and isn't needed
anyway.

changed calls to XPUTC to use text constants rather than ascii decimal
equivalents.

adopted some of the techniques used in awin_start.s for reducing code and
improving performance.

polluted the namespace with _XPUTC so that xputc can be used from C code
before early console is enabled.  (Due to tracking a bug in early console
initialization.)

replaced a hardwired constant with the proper mannifest in the definition
of TEMP_L1_TABLE

This still needs MP support added but it should continue to work for XU3
while starting to work for XU4


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbarm/odroid/odroid_start.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/odroid/odroid_start.S
diff -u src/sys/arch/evbarm/odroid/odroid_start.S:1.6 src/sys/arch/evbarm/odroid/odroid_start.S:1.7
--- src/sys/arch/evbarm/odroid/odroid_start.S:1.6	Thu Oct  2 12:12:55 2014
+++ src/sys/arch/evbarm/odroid/odroid_start.S	Tue Nov 10 23:47:08 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: odroid_start.S,v 1.6 2014/10/02 12:12:55 skrll Exp $	*/
+/*	$NetBSD: odroid_start.S,v 1.7 2015/11/10 23:47:08 marty Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -46,13 +46,16 @@
 
 #include <evbarm/odroid/platform.h>
 
-RCSID("$NetBSD: odroid_start.S,v 1.6 2014/10/02 12:12:55 skrll Exp $")
+RCSID("$NetBSD: odroid_start.S,v 1.7 2015/11/10 23:47:08 marty Exp $")
 
 
 #if defined(VERBOSE_INIT_ARM)
-
 #define	XPUTC(n)	mov r0, n; bl xputc
+#if KERNEL_BASE_VOFFSET == 0
+#define	XPUTC2(n)	mov r0, n; bl xputc
+#else
 #define	XPUTC2(n)	mov r0, n; blx r11
+#endif
 #ifdef __ARMEB__
 #define COM_BSWAP
 #endif
@@ -62,8 +65,7 @@ RCSID("$NetBSD: odroid_start.S,v 1.6 201
 #endif
 
 #define INIT_MEMSIZE	128
-
-#define	TEMP_L1_TABLE	(KERNEL_BASE - KERNEL_BASE_VOFFSET + INIT_MEMSIZE * 0x100000 - L1_TABLE_SIZE)
+#define	TEMP_L1_TABLE	(KERNEL_BASE - KERNEL_BASE_VOFFSET + INIT_MEMSIZE * L1_S_SIZE - L1_TABLE_SIZE)
 
 #define	MD_CPU_HATCH	_C_LABEL(exynos_cpu_hatch)
 
@@ -72,8 +74,12 @@ RCSID("$NetBSD: odroid_start.S,v 1.6 201
  * At this point, this code has been loaded into SDRAM
  * and the MMU is off
  */
+#ifdef KERNEL_BASES_EQUAL
+	.text
+#else
 	.section .start,"ax",%progbits
-
+#endif
+	
 	.global	_C_LABEL(odroid_start)
 _C_LABEL(odroid_start):
 #ifdef __ARMEB__
@@ -91,75 +97,16 @@ _C_LABEL(odroid_start):
 	 */
 	movw	r4, #:lower16:uboot_args
 	movt	r4, #:upper16:uboot_args
+#if KERNEL_BASE_VOFFSET != 0
 	sub	r4, r4, #KERNEL_BASE_VOFFSET
+#endif
 	stmia	r4, {r0-r3}			// Save the arguments
 
 	/*
-	 * Rescue passed "bootargs" env variable. This is not trivial
-	 * since we can be booted using either `go' or trough `bootm'.
-	 *
-	 * 'go' passes R0 = argc, R1 = argv
-	 * 'bootm' passes R0 = uboot_bootinfo, R3 = bootargs
-	 */
-
-	movw	r4, #:lower16:bootargs
-	movt	r4, #:upper16:bootargs
-	sub	r4, r4, #KERNEL_BASE_VOFFSET
-
-	cmp	r0, #0
-	beq	1f
-	cmp	r0, #MAX_BOOT_STRING
-	bge	1f
-
-	/* `go' method */
-	cmp	r0, #1					// extra argument?
-	beq	3f
-	ldr	r5, [r1, #4]				// load argv[1]
-2:
-	ldrb	r0, [r5], #1
-	strb	r0, [r4], #1
-	teq	r0, #0
-	bne	2b
-
-	b	3f
-1:
-	/* `bootm' method */
-	mov	r6, r0					// save binfo pointer
-
-	cmp	r3, #0
-	beq	1f
-2:
-	ldrb	r0, [r3], #1
-	strb	r0, [r4], #1
-	teq	r0, #0
-	bne	2b
-
-1:
-	cmp	r6, #0					// binfo passed?
-	beq	3f
-
-	add	r6, r6, #0x250				// to eth addr
-
-	movw	r4, #:lower16:uboot_enaddr
-	movt	r4, #:upper16:uboot_enaddr
-	mov	r2, #6
-2:
-	ldrb	r0, [r6], #1
-	strb	r0, [r4], #1
-	subs	r2, r2, #1
-	bne	2b
-	
-3:
-
-	/*
 	 * For easy and early SoC / PoP dependency, retrieve the IDs
 	 */
-#if 1
-	mov	r6, #EXYNOS_CORE_PBASE
-#else
 	movw	r6, #:lower16:EXYNOS_CORE_PBASE
 	movt	r6, #:upper16:EXYNOS_CORE_PBASE
-#endif
 
 	ldr	r0, [r6, #EXYNOS_PROD_ID_OFFSET]	// load soc_id
 
@@ -205,49 +152,53 @@ _C_LABEL(odroid_start):
 	 */
 	bl	cortex_init
 
-	XPUTC(#67)
+	XPUTC(#'C')
 
 	/*
 	 * Set up a preliminary mapping in the MMU to allow us to run
 	 * at KERNEL_BASE with caches on.
 	 */
-	adr	r1, .Lmmu_init_table
 	movw	r0, #:lower16:TEMP_L1_TABLE
 	movt	r0, #:upper16:TEMP_L1_TABLE
+	movw	r1, #:lower16:.Lmmu_init_table
+	movt	r1, #:upper16:.Lmmu_init_table
 	bl	arm_boot_l1pt_init
 
-	XPUTC(#68)
+	XPUTC(#'D')
 
 	/*
 	 * Turn on the MMU, Caches, etc.
 	 */
-#ifdef VERBOSE_INIT_ARM
-	adr	r11, xputc
+	movw	r0, #:lower16:TEMP_L1_TABLE
+	movt	r0, #:upper16:TEMP_L1_TABLE
+#if KERNEL_BASE_VOFFSET == 0
+	bl	arm_cpuinit
+#else
+#if defined(VERBOSE_INIT_ARM)
+	adr	r11, xputc		@ for XPUTC2
 #endif
 	movw	lr, #:lower16:1f
 	movt	lr, #:upper16:1f
-	movw	r0, #:lower16:TEMP_L1_TABLE
-	movt	r0, #:upper16:TEMP_L1_TABLE
 	b	arm_cpuinit
-
-	.pushsection .text, "ax", %progbits
-	.align	0
+	.pushsection .text,"ax",%progbits
 1:
-	XPUTC2(#90)
+#endif
+	XPUTC2(#'Z')
 
 #if defined(MULTIPROCESSOR)
 #endif /* MULTIPROCESSOR */
 
-	XPUTC2(#13)
-	XPUTC2(#10)
+	XPUTC2(#13)		/* CR */
+	XPUTC2(#10)		/* LF */
 
 	/*
 	 * Jump to start in locore.S, which in turn will call initarm and main.
 	 */
 	b	start
 
+#ifndef KERNEL_BASES_EQUAL
 	.popsection				// back to .start
-
+#endif
 	/* NOTREACHED */
 
 	.align 0
@@ -280,9 +231,11 @@ _C_LABEL(exynos_uarts):
 #if defined(VERBOSE_INIT_ARM)
 	.align 0
 	.global xputc
+	.global _xputc		// for C
 	.type	xputc,%function
 
-#define TIMO		0x25000
+	#define TIMO		0x25000
+_xputc:
 xputc:
 	mov	r2, #TIMO
 	mrc	p15, 0, r3, c13, c0, 3		// TPIDRURO get (uart address)

Reply via email to