public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] pxa: fix for UART reference in section text for a number of platforms.
@ 2010-03-08 11:15 Jonathan Cameron
  2010-03-08 11:48 ` Eric Miao
  0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Cameron @ 2010-03-08 11:15 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>

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

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

diff --git a/arch/arm/mach-pxa/include/mach/uncompress.h b/arch/arm/mach-pxa/include/mach/uncompress.h
index 237734b..b009299 100644
--- a/arch/arm/mach-pxa/include/mach/uncompress.h
+++ b/arch/arm/mach-pxa/include/mach/uncompress.h
@@ -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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH] pxa: fix for UART reference in section text for a number of platforms.
  2010-03-08 11:15 [PATCH] pxa: fix for UART reference in section text for a number of platforms Jonathan Cameron
@ 2010-03-08 11:48 ` Eric Miao
  2010-03-08 12:05   ` Jonathan Cameron
  2010-03-08 12:10   ` Eric Miao
  0 siblings, 2 replies; 7+ messages in thread
From: Eric Miao @ 2010-03-08 11:48 UTC (permalink / raw)
  To: linux-arm-kernel

What's the background?

2010/3/8 Jonathan Cameron <jic23@cam.ac.uk>:
> Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
>
> ---
> ?Fix exactly as proposed by Russell King. ?Thanks!
>
> ?arch/arm/mach-pxa/include/mach/uncompress.h | ? ?4 +++-
> ?1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-pxa/include/mach/uncompress.h b/arch/arm/mach-pxa/include/mach/uncompress.h
> index 237734b..b009299 100644
> --- a/arch/arm/mach-pxa/include/mach/uncompress.h
> +++ b/arch/arm/mach-pxa/include/mach/uncompress.h
> @@ -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
>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] pxa: fix for UART reference in section text for a number of platforms.
  2010-03-08 11:48 ` Eric Miao
@ 2010-03-08 12:05   ` Jonathan Cameron
  2010-03-08 12:10   ` Eric Miao
  1 sibling, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2010-03-08 12:05 UTC (permalink / raw)
  To: linux-arm-kernel


> 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.


> 2010/3/8 Jonathan Cameron <jic23@cam.ac.uk>:
>> Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
>>
>> ---
>>  Fix exactly as proposed by Russell King.  Thanks!
>>
>>  arch/arm/mach-pxa/include/mach/uncompress.h |    4 +++-
>>  1 files changed, 3 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/arm/mach-pxa/include/mach/uncompress.h b/arch/arm/mach-pxa/include/mach/uncompress.h
>> index 237734b..b009299 100644
>> --- a/arch/arm/mach-pxa/include/mach/uncompress.h
>> +++ b/arch/arm/mach-pxa/include/mach/uncompress.h
>> @@ -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
>>
>>
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] pxa: fix for UART reference in section text for a number of platforms.
  2010-03-08 11:48 ` Eric Miao
  2010-03-08 12:05   ` Jonathan Cameron
@ 2010-03-08 12:10   ` Eric Miao
  2010-03-08 17:44     ` Jonathan Cameron
  1 sibling, 1 reply; 7+ messages in thread
From: Eric Miao @ 2010-03-08 12:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Mar 8, 2010 at 7:48 PM, Eric Miao <eric.y.miao@gmail.com> wrote:
> 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

> 2010/3/8 Jonathan Cameron <jic23@cam.ac.uk>:
>> Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
>>
>> ---
>> ?Fix exactly as proposed by Russell King. ?Thanks!
>>
>> ?arch/arm/mach-pxa/include/mach/uncompress.h | ? ?4 +++-
>> ?1 files changed, 3 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/arm/mach-pxa/include/mach/uncompress.h b/arch/arm/mach-pxa/include/mach/uncompress.h
>> index 237734b..b009299 100644
>> --- a/arch/arm/mach-pxa/include/mach/uncompress.h
>> +++ b/arch/arm/mach-pxa/include/mach/uncompress.h
>> @@ -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
>>
>>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] pxa: fix for UART reference in section text for a number of platforms.
  2010-03-08 12:10   ` Eric Miao
@ 2010-03-08 17:44     ` Jonathan Cameron
  2010-03-15 12:43       ` Eric Miao
  0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Cameron @ 2010-03-08 17:44 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/08/10 12:10, Eric Miao wrote:
> On Mon, Mar 8, 2010 at 7:48 PM, Eric Miao <eric.y.miao@gmail.com> wrote:
>> 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.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
 arch/arm/mach-pxa/include/mach/uncompress.h |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-pxa/include/mach/uncompress.h b/arch/arm/mach-pxa/include/mach/uncompress.h
index 5ef91d9..03914e4 100644
--- a/arch/arm/mach-pxa/include/mach/uncompress.h
+++ b/arch/arm/mach-pxa/include/mach/uncompress.h
@@ -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;
 	}
 }
 
 /*
-- 
1.6.4.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH] pxa: fix for UART reference in section text for a number of platforms.
  2010-03-08 17:44     ` Jonathan Cameron
@ 2010-03-15 12:43       ` Eric Miao
  2010-03-15 13:04         ` Jonathan Cameron
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Miao @ 2010-03-15 12:43 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 9, 2010 at 1:44 AM, Jonathan Cameron
<arm@jic23.retrosnub.co.uk> wrote:
> On 03/08/10 12:10, Eric Miao wrote:
>> On Mon, Mar 8, 2010 at 7:48 PM, Eric Miao <eric.y.miao@gmail.com> wrote:
>>> 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.
>
> Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>

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

commit 11f4f3150254477bbe19a847c5aed747f3eeff2a
Author: Jonathan Cameron <arm@jic23.retrosnub.co.uk>
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.

    Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>

diff --git a/arch/arm/mach-pxa/include/mach/uncompress.h
b/arch/arm/mach-pxa/include/mach/uncompress.h
index 5ef91d9..759b851 100644
--- a/arch/arm/mach-pxa/include/mach/uncompress.h
+++ b/arch/arm/mach-pxa/include/mach/uncompress.h
@@ -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())

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH] pxa: fix for UART reference in section text for a number of platforms.
  2010-03-15 12:43       ` Eric Miao
@ 2010-03-15 13:04         ` Jonathan Cameron
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2010-03-15 13:04 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/15/10 12:43, Eric Miao wrote:
> On Tue, Mar 9, 2010 at 1:44 AM, Jonathan Cameron
> <arm@jic23.retrosnub.co.uk> wrote:
>> On 03/08/10 12:10, Eric Miao wrote:
>>> On Mon, Mar 8, 2010 at 7:48 PM, Eric Miao <eric.y.miao@gmail.com> wrote:
>>>> 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.
>>
>> Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
> 
> 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
> 
> commit 11f4f3150254477bbe19a847c5aed747f3eeff2a
> Author: Jonathan Cameron <arm@jic23.retrosnub.co.uk>
> 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.
> 
>     Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
> 
> diff --git a/arch/arm/mach-pxa/include/mach/uncompress.h
> b/arch/arm/mach-pxa/include/mach/uncompress.h
> index 5ef91d9..759b851 100644
> --- a/arch/arm/mach-pxa/include/mach/uncompress.h
> +++ b/arch/arm/mach-pxa/include/mach/uncompress.h
> @@ -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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-03-15 13:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-08 11:15 [PATCH] pxa: fix for UART reference in section text for a number of platforms Jonathan Cameron
2010-03-08 11:48 ` Eric Miao
2010-03-08 12:05   ` Jonathan Cameron
2010-03-08 12:10   ` Eric Miao
2010-03-08 17:44     ` Jonathan Cameron
2010-03-15 12:43       ` Eric Miao
2010-03-15 13:04         ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox