Skip to contentSkip to conversation

pxa: fix for UART reference in section text for a number of platforms.

PATCH New Jonathan Cameron 3 participants 7 messages Mar 8, 2010 – Mar 15, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pxa: fix for UART reference in section text for a number of platforms.

---
Fix exactly as proposed by Russell King. Thanks!

 arch/arm/mach-pxa/include/mach/uncompress.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
arch/arm/mach-pxa/include/mach/uncompress.h +3 -1
index 237734b..b009299 100644
@@ -15,7 +15,7 @@
 
 #define __REG(x)       ((volatile unsigned long *)x)
 
-static volatile unsigned long *UART = FFUART;
+static volatile unsigned long *UART;
 
 static inline void putc(char c)
 {
@@ -39,6 +39,8 @@ static inline void arch_decomp_setup(void)
 	    || machine_is_csb726() || machine_is_stargate2()
 	    || machine_is_cm_x300() || machine_is_balloon3())
 		UART = STUART;
+	else
+		UART = FFUART;
 }
 
 /*
Signature · 1 line
1.6.4.4
#1 lore raw

PATCH 1/1 pxa: fix for UART reference in section text for a number of platforms.

What's the background?

2010/3/8 Jonathan Cameron <[email protected]>:

Quoted 34 lines

---
?Fix exactly as proposed by Russell King. ?Thanks!

?arch/arm/mach-pxa/include/mach/uncompress.h | ? ?4 +++- ?1 files changed, 3 insertions(+), 1 deletions(-)

arch/arm/mach-pxa/include/mach/uncompress.h +3 -1
index 237734b..b009299 100644
@@ -15,7 +15,7 @@
 
 ?#define __REG(x) ? ? ? ((volatile unsigned long *)x)
 
-static volatile unsigned long *UART = FFUART;
+static volatile unsigned long *UART;
 
 ?static inline void putc(char c)
 ?{
@@ -39,6 +39,8 @@ static inline void arch_decomp_setup(void)
 ? ? ? ? ? ?|| machine_is_csb726() || machine_is_stargate2()
 ? ? ? ? ? ?|| machine_is_cm_x300() || machine_is_balloon3())
 ? ? ? ? ? ? ? ?UART = STUART;
+ ? ? ? else
+ ? ? ? ? ? ? ? UART = FFUART;
 ?}
 

?/*
--
1.6.4.4

#2 lore raw

PATCH 1/1 pxa: fix for UART reference in section text for a number of platforms.

Quoted 2 lines

What's the background?

Directly, the following compile error in current mainline:

UART' referenced in section .text' of arch/arm/boot/compressed/misc.o: defined in discarded section .data' of arch/arm/boot/compressed/misc.o UART' referenced in section .text' of arch/arm/boot/compressed/misc.o: defined in discarded section .data' of arch/arm/boot/compressed/misc.o make[2]: *** [arch/arm/boot/compressed/vmlinux] Error 1

A result of (I think):

5de813b6cd06460b337f9da9afe316823cf3ef45

ARM: Eliminate decompressor -Dstatic= PIC hack

We used to build decompressors with -Dstatic= to avoid any local data being generated. The problem is that local data generates GOTOFF relocations, which means we can't relocate the data relative to the text segment.

Global data, on the other hand, goes through the GOT, and can be relocated anywhere.

Unfortunately, with the new decompressors, this presents a problem since they declare static data within functions, and this leads to stack overflow.

Fix this by separating out the decompressor code into a separate file, and removing 'static' from BSS data in misc.c.

Also, discard the .data section - this means that should we end up with read/write initialized data, the decompressor will fail to link and the problem will be obvious.

Quoted 36 lines

2010/3/8 Jonathan Cameron <[email protected]>:

Quoted 34 lines

---
Fix exactly as proposed by Russell King. Thanks!

 arch/arm/mach-pxa/include/mach/uncompress.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
arch/arm/mach-pxa/include/mach/uncompress.h +3 -2
index 237734b..b009299 100644
@@ -15,7 +15,7 @@
 
 #define __REG(x)       ((volatile unsigned long *)x)
 
-static volatile unsigned long *UART = FFUART;
+static volatile unsigned long *UART;
 
 static inline void putc(char c)
 {
@@ -39,6 +39,8 @@ static inline void arch_decomp_setup(void)
           || machine_is_csb726() || machine_is_stargate2()
           || machine_is_cm_x300() || machine_is_balloon3())
               UART = STUART;
+       else
+               UART = FFUART;
 }
 
 /*
--

1.6.4.4

#3 lore raw

PATCH 1/1 pxa: fix for UART reference in section text for a number of platforms.

In reply to Eric Miao
Quoted 2 lines · Eric Miao

What's the background?

OK, I saw the thread. So this is basically going to move the "UART" to bss, which doesn't get discarded. However, my 'devel' branch has been modified a bit to support off chip UART decompressing messages to be displayed, I'm afraid this needs to be updated a bit.

Thanks

Quoted 36 lines

2010/3/8 Jonathan Cameron <[email protected]>:

Quoted 34 lines

---
?Fix exactly as proposed by Russell King. ?Thanks!

?arch/arm/mach-pxa/include/mach/uncompress.h | ? ?4 +++- ?1 files changed, 3 insertions(+), 1 deletions(-)

arch/arm/mach-pxa/include/mach/uncompress.h +3 -1
index 237734b..b009299 100644
@@ -15,7 +15,7 @@
 
 ?#define __REG(x) ? ? ? ((volatile unsigned long *)x)
 
-static volatile unsigned long *UART = FFUART;
+static volatile unsigned long *UART;
 
 ?static inline void putc(char c)
 ?{
@@ -39,6 +39,8 @@ static inline void arch_decomp_setup(void)
 ? ? ? ? ? ?|| machine_is_csb726() || machine_is_stargate2()
 ? ? ? ? ? ?|| machine_is_cm_x300() || machine_is_balloon3())
 ? ? ? ? ? ? ? ?UART = STUART;
+ ? ? ? else
+ ? ? ? ? ? ? ? UART = FFUART;
 ?}
 

?/*
--
1.6.4.4

#4 lore raw

PATCH 1/1 pxa: fix for UART reference in section text for a number of platforms.

Quoted 8 lines · Eric Miao
Quoted 2 lines · Eric Miao

What's the background?

OK, I saw the thread. So this is basically going to move the "UART" to bss, which doesn't get discarded. However, my 'devel' branch has been modified a bit to support off chip UART decompressing messages to be displayed, I'm afraid this needs to be updated a bit.

The same problem will occur with the other two variables changed by this function, so how about the following (against your tree, but tested against mainline with a couple of patches lifted from your tree). Builds fine for imote2, startgate2 and arcom_zeus. Just testing a full build of all pxa platforms to see if anything similar is hiding elsewhere.

[PATCH] pxa: fix for uart_base and friends reference in section.

---
 arch/arm/mach-pxa/include/mach/uncompress.h |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)
arch/arm/mach-pxa/include/mach/uncompress.h +11 -6
index 5ef91d9..03914e4 100644
@@ -16,9 +16,9 @@
 #define BTUART_BASE	(0x40200000)
 #define STUART_BASE	(0x40700000)
 
-static unsigned long uart_base = FFUART_BASE;
-static unsigned int uart_shift = 2;
-static unsigned int uart_is_pxa = 1;
+static unsigned long uart_base;
+static unsigned int uart_shift;
+static unsigned int uart_is_pxa;
 
 static inline unsigned char uart_read(int offset)
 {
@@ -58,14 +58,20 @@ static inline void arch_decomp_setup(void)
 {
 	if (machine_is_littleton() || machine_is_intelmote2()
 	    || machine_is_csb726() || machine_is_stargate2()
-	    || machine_is_cm_x300() || machine_is_balloon3())
+	    || machine_is_cm_x300() || machine_is_balloon3()) {
 		uart_base = STUART_BASE;
-
-	if (machine_is_arcom_zeus()) {
+		uart_shift = 2;
+		uart_is_pxa = 1;
+	} else if (machine_is_arcom_zeus()) {
 		uart_base = 0x10000000;	/* nCS4 */
 		uart_shift = 1;
 		uart_is_pxa = 0;
+	} else {
+		uart_base = FFUART_BASE;
+		uart_shift = 2;
+		uart_is_pxa = 1;
 	}
 }
 
 /*
Signature · 1 line
1.6.4.4
#5 lore raw

PATCH 1/1 pxa: fix for UART reference in section text for a number of platforms.

Quoted 16 lines · Jonathan Cameron
Quoted 8 lines · Eric Miao
Quoted 2 lines · Eric Miao

What's the background?

OK, I saw the thread. So this is basically going to move the "UART" to bss, which doesn't get discarded. However, my 'devel' branch has been modified a bit to support off chip UART decompressing messages to be displayed, I'm afraid this needs to be updated a bit.

The same problem will occur with the other two variables changed by this function, so how about the following (against your tree, but tested against mainline with a couple of patches lifted from your tree). Builds fine for imote2, startgate2 and arcom_zeus. Just testing a full build of all pxa platforms to see if anything similar is hiding elsewhere.

Quoted 3 lines

[PATCH] pxa: fix for uart_base and friends reference in section.

Merged with some minor changes as below, let me know if you are OK with this.

commit 11f4f3150254477bbe19a847c5aed747f3eeff2a

Author: Jonathan Cameron <[email protected]>
Date:   Mon Mar 8 17:44:19 2010 +0000

[ARM] pxa: fix for variables in uncompress.h being discarded

Due to commit:

5de813b ARM: Eliminate decompressor -Dstatic= PIC hack

The data section will be discarded for the decompressor, thus move the static variables into BSS section by initializing them at run-time.

(quoted diff) +0 -0

b/arch/arm/mach-pxa/include/mach/uncompress.h
index 5ef91d9..759b851 100644

arch/arm/mach-pxa/include/mach/uncompress.h +8 -3
@@ -16,9 +16,9 @@
 #define BTUART_BASE	(0x40200000)
 #define STUART_BASE	(0x40700000)
 
-static unsigned long uart_base = FFUART_BASE;
-static unsigned int uart_shift = 2;
-static unsigned int uart_is_pxa = 1;
+static unsigned long uart_base;
+static unsigned int uart_shift;
+static unsigned int uart_is_pxa;
 
 static inline unsigned char uart_read(int offset)
 {
@@ -56,6 +56,11 @@ static inline void flush(void)
 
 static inline void arch_decomp_setup(void)
 {
+	/* initialize to default */
+	uart_base = FFUART_BASE;
+	uart_shift = 2;
+	uart_is_pxa = 1;
+
 	if (machine_is_littleton() || machine_is_intelmote2()
 	    || machine_is_csb726() || machine_is_stargate2()
 	    || machine_is_cm_x300() || machine_is_balloon3())
#6 lore raw

PATCH 1/1 pxa: fix for UART reference in section text for a number of platforms.

Quoted 18 lines · Eric Miao
Quoted 16 lines · Jonathan Cameron
Quoted 8 lines · Eric Miao
Quoted 2 lines · Eric Miao

What's the background?

OK, I saw the thread. So this is basically going to move the "UART" to bss, which doesn't get discarded. However, my 'devel' branch has been modified a bit to support off chip UART decompressing messages to be displayed, I'm afraid this needs to be updated a bit.

The same problem will occur with the other two variables changed by this function, so how about the following (against your tree, but tested against mainline with a couple of patches lifted from your tree). Builds fine for imote2, startgate2 and arcom_zeus. Just testing a full build of all pxa platforms to see if anything similar is hiding elsewhere.

Quoted 6 lines
Quoted 3 lines

[PATCH] pxa: fix for uart_base and friends reference in section.

Merged with some minor changes as below, let me know if you are OK with this.

Good point, that's a neater solution.
Thanks Eric!

Jonathan

Quoted 51 lines

commit 11f4f3150254477bbe19a847c5aed747f3eeff2a

Author: Jonathan Cameron <[email protected]>
Date:   Mon Mar 8 17:44:19 2010 +0000

[ARM] pxa: fix for variables in uncompress.h being discarded

Due to commit:

5de813b ARM: Eliminate decompressor -Dstatic= PIC hack

The data section will be discarded for the decompressor, thus move the static variables into BSS section by initializing them at run-time.

arch/arm/mach-pxa/include/mach/uncompress.h +8 -3
index 5ef91d9..759b851 100644
@@ -16,9 +16,9 @@
 #define BTUART_BASE	(0x40200000)
 #define STUART_BASE	(0x40700000)
 
-static unsigned long uart_base = FFUART_BASE;
-static unsigned int uart_shift = 2;
-static unsigned int uart_is_pxa = 1;
+static unsigned long uart_base;
+static unsigned int uart_shift;
+static unsigned int uart_is_pxa;
 
 static inline unsigned char uart_read(int offset)
 {
@@ -56,6 +56,11 @@ static inline void flush(void)
 
 static inline void arch_decomp_setup(void)
 {
+	/* initialize to default */
+	uart_base = FFUART_BASE;
+	uart_shift = 2;
+	uart_is_pxa = 1;
+
 	if (machine_is_littleton() || machine_is_intelmote2()
 	    || machine_is_csb726() || machine_is_stargate2()
 	    || machine_is_cm_x300() || machine_is_balloon3())

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel