Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ea12930 authored by Jeremy Kerr's avatar Jeremy Kerr Committed by Nicolas Pitre
Browse files

arm: return both physical and virtual addresses from addruart



Rather than checking the MMU status in every instance of addruart, do it
once in kernel/debug.S, and change the existing addruart macros to
return both physical and virtual addresses. The main debug code can then
select the appropriate address to use.

This will also allow us to retreive the address of a uart for the MMU
state that we're not current in.

Updated with fixes for OMAP from Jason Wang <jason77.wang@gmail.com>
and Tony Lindgren <tony@atomide.com>, and fix for versatile express from
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>.

Signed-off-by: default avatarJeremy Kerr <jeremy.kerr@canonical.com>
Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: default avatarJason Wang <jason77.wang@gmail.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
Tested-by: default avatarKevin Hilman <khilman@deeprootsystems.com>
parent 1ea64615
Loading
Loading
Loading
Loading
+19 −3
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@
#if defined(CONFIG_DEBUG_ICEDCC)
		@@ debug using ARM EmbeddedICE DCC channel

		.macro	addruart, rx, tmp
		.macro	addruart, rp, rv
		.endm

#if defined(CONFIG_CPU_V6)
@@ -121,6 +121,22 @@ wait: mrc p14, 0, pc, c0, c1, 0
#include <mach/debug-macro.S>
#endif	/* CONFIG_DEBUG_ICEDCC */

#ifdef CONFIG_MMU
		.macro	addruart_current, rx, tmp1, tmp2
		addruart	\tmp1, \tmp2
		mrc		p15, 0, \rx, c1, c0
		tst		\rx, #1
		moveq		\rx, \tmp1
		movne		\rx, \tmp2
		.endm

#else /* !CONFIG_MMU */
		.macro	addruart_current, rx, tmp1, tmp2
		addruart	\rx, \tmp1
		.endm

#endif /* CONFIG_MMU */

/*
 * Useful debugging routines
 */
@@ -155,7 +171,7 @@ ENDPROC(printhex2)
		.ltorg

ENTRY(printascii)
		addruart r3, r1
		addruart_current r3, r1, r2
		b	2f
1:		waituart r2, r3
		senduart r1, r3
@@ -171,7 +187,7 @@ ENTRY(printascii)
ENDPROC(printascii)

ENTRY(printch)
		addruart r3, r1
		addruart_current r3, r1, r2
		mov	r1, r0
		mov	r0, #0
		b	1b
+4 −6
Original line number Diff line number Diff line
@@ -10,12 +10,10 @@
 */

#include "hardware.h"
		.macro	addruart, rx, tmp
		mrc	p15, 0, \rx, c1, c0
		tst	\rx, #1			@ MMU enabled?
		moveq	\rx, #0x80000000		@ physical
		movne	\rx, #io_p2v(0x80000000)	@ virtual
		orr	\rx, \rx, #0x00000800
		.macro	addruart, rp, rv
		mov	\rp, 0x00000800
		orr	\rv, \rp, #io_p2v(0x80000000)	@ virtual
		orr	\rp, \rp, #0x80000000		@ physical
		.endm

		.macro	senduart,rd,rx
+3 −5
Original line number Diff line number Diff line
@@ -14,11 +14,9 @@
#include <mach/hardware.h>
#include <mach/at91_dbgu.h>

	.macro	addruart, rx, tmp
	mrc	p15, 0, \rx, c1, c0
	tst	\rx, #1						@ MMU enabled?
	ldreq	\rx, =(AT91_BASE_SYS + AT91_DBGU)		@ System peripherals (phys address)
	ldrne	\rx, =(AT91_VA_BASE_SYS	+ AT91_DBGU)		@ System peripherals (virt address)
	.macro	addruart, rp, rv
	ldr	\rp, =(AT91_BASE_SYS + AT91_DBGU)		@ System peripherals (phys address)
	ldr	\rv, =(AT91_VA_BASE_SYS	+ AT91_DBGU)		@ System peripherals (virt address)
	.endm

	.macro	senduart,rd,rx
+5 −7
Original line number Diff line number Diff line
@@ -14,16 +14,14 @@
#include <mach/hardware.h>
#include <asm/hardware/clps7111.h>

		.macro	addruart, rx, tmp
		mrc	p15, 0, \rx, c1, c0
		tst	\rx, #1			@ MMU enabled?
		moveq	\rx, #CLPS7111_PHYS_BASE
		movne	\rx, #CLPS7111_VIRT_BASE
		.macro	addruart, rp, rv
#ifndef CONFIG_DEBUG_CLPS711X_UART2
		add	\rx, \rx, #0x0000	@ UART1
		mov	\rp, #0x0000	@ UART1
#else
		add	\rx, \rx, #0x1000	@ UART2
		mov	\rp, #0x1000	@ UART2
#endif
		orr	\rv, \rp, #CLPS7111_VIRT_BASE
		orr	\rp, \rp, #CLPS7111_PHYS_BASE
		.endm

		.macro	senduart,rd,rx
+4 −6
Original line number Diff line number Diff line
@@ -10,12 +10,10 @@
 * published by the Free Software Foundation.
 */

		.macro	addruart,rx
		mrc	p15, 0, \rx, c1, c0
		tst	\rx, #1			@ MMU enabled?
		moveq	\rx,      #0x10000000
		movne	\rx,      #0xf0000000	@ virtual base
		orr	\rx, \rx, #0x00009000
		.macro	addruart,rp,rv
		mov	\rp, #0x00009000
		orr	\rv, \rp, #0xf0000000	@ virtual base
		orr	\rp, \rp, #0x10000000
		.endm

#include <asm/hardware/debug-pl01x.S>
Loading