public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] Microblaze fixes
@ 2010-12-21 12:09 Michal Simek
  2010-12-21 12:09 ` [U-Boot] [PATCH 1/2] microblaze: Disabling interrupt should return 1 if implemented Michal Simek
  0 siblings, 1 reply; 8+ messages in thread
From: Michal Simek @ 2010-12-21 12:09 UTC (permalink / raw)
  To: u-boot

Hi Wolfgang,

I am sending two patches for review. I don't expect that someone will
have any compains about that's why I have create fix branch in my custodian repo
and you can pull them. 

Both patches are fixes and if possible, I would like to add them 
to your branch. I have looked at schedule and if you don't want to merge
it, I will ask for merging in upcomming merge window.

Thanks,
Michal


The following changes since commit 71aab09b2c1edd1b6e00819abd1e31c04db04f36:
  Wolfgang Denk (1):
        Merge branch 'master' of /home/wd/git/u-boot/custodians

are available in the git repository at:

  git://www.denx.de/git/u-boot-microblaze.git fix

Michal Simek (2):
      microblaze: Disabling interrupt should return 1 if implemented
      microblaze: Fix bdiinfo pointer

 arch/microblaze/cpu/interrupts.c     |    2 +-
 arch/microblaze/lib/board.c          |    2 +-
 include/configs/microblaze-generic.h |    7 +++++--
 3 files changed, 7 insertions(+), 4 deletions(-)

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

* [U-Boot] [PATCH 1/2] microblaze: Disabling interrupt should return 1 if implemented
  2010-12-21 12:09 [U-Boot] Microblaze fixes Michal Simek
@ 2010-12-21 12:09 ` Michal Simek
  2010-12-21 12:09   ` [U-Boot] [PATCH 2/2] microblaze: Fix bdiinfo pointer Michal Simek
  2010-12-21 12:24   ` [U-Boot] [PATCH 1/2] microblaze: Disabling interrupt should return 1 if implemented Wolfgang Denk
  0 siblings, 2 replies; 8+ messages in thread
From: Michal Simek @ 2010-12-21 12:09 UTC (permalink / raw)
  To: u-boot

Microblaze implement enable/disable interrupts through MSR
that's why disable_interrupts function should return 1.

Signed-off-by: John Linn <john.linn@xilinx.com>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 arch/microblaze/cpu/interrupts.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/microblaze/cpu/interrupts.c b/arch/microblaze/cpu/interrupts.c
index e9d53c1..331746c 100644
--- a/arch/microblaze/cpu/interrupts.c
+++ b/arch/microblaze/cpu/interrupts.c
@@ -42,7 +42,7 @@ void enable_interrupts (void)
 int disable_interrupts (void)
 {
 	MSRCLR(0x2);
-	return 0;
+	return 1;
 }
 
 #ifdef CONFIG_SYS_INTC_0
-- 
1.5.5.6

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

* [U-Boot] [PATCH 2/2] microblaze: Fix bdiinfo pointer
  2010-12-21 12:09 ` [U-Boot] [PATCH 1/2] microblaze: Disabling interrupt should return 1 if implemented Michal Simek
@ 2010-12-21 12:09   ` Michal Simek
  2010-12-21 12:26     ` Wolfgang Denk
  2010-12-21 12:24   ` [U-Boot] [PATCH 1/2] microblaze: Disabling interrupt should return 1 if implemented Wolfgang Denk
  1 sibling, 1 reply; 8+ messages in thread
From: Michal Simek @ 2010-12-21 12:09 UTC (permalink / raw)
  To: u-boot

Patch "Replace CONFIG_SYS_GBL_DATA_SIZE by auto-generated value"
(sha1: 25ddd1fb0a2281b182529afbc8fda5de2dc16d96)
introduce GENERATED_GBL_DATA_SIZE which is sizeof aligned gd_t
(currently 0x40).
Microblaze configs used 0x40(128) because this place also contained
board info structure which lies on the top of ram.

This patch is fixing this scheme by extending CONFIG_SYS_GBL_DATA_OFFSET
value. Doubled GENERATED_GBL_DATA_SIZE size is enough to store
gd_t and bd_t structures.

U-Boot is placed to the top of the ram (for example 0xd7ffffff)
and bd structure was moved out of ram.

For example:
Current: gd 0xd7ffffc0, bd 0xd8000000
Fixed:   gd 0xd7ffff80, bd 0xd7ffffc0

Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 arch/microblaze/lib/board.c          |    2 +-
 include/configs/microblaze-generic.h |    7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c
index eeef579..e215684 100644
--- a/arch/microblaze/lib/board.c
+++ b/arch/microblaze/lib/board.c
@@ -96,7 +96,7 @@ void board_init (void)
 	ulong flash_size = 0;
 #endif
 	asm ("nop");	/* FIXME gd is not initialize - wait */
-	memset ((void *)gd, 0, GENERATED_GBL_DATA_SIZE);
+	memset ((void *)gd, 0, 2 * GENERATED_GBL_DATA_SIZE); /* gd/bd space */
 	gd->bd = (bd_t *) (gd + 1);	/* At end of global data */
 	gd->baudrate = CONFIG_BAUDRATE;
 	bd = gd->bd;
diff --git a/include/configs/microblaze-generic.h b/include/configs/microblaze-generic.h
index 75e4e07..ec152bf 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -135,14 +135,17 @@
 #define	CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_SDRAM_BASE + 0x1000)
 
 /* global pointer */
+/* Allocate 2 * GENERATED_GBL_DATA_SIZE (0x40) size for global data and
+ * board info structure(size 0x24). Would be better to use sizeof but
+ * this requires more changes to asm code */
 /* start of global data */
 #define	CONFIG_SYS_GBL_DATA_OFFSET \
 	(CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_SDRAM_SIZE \
-				- GENERATED_GBL_DATA_SIZE)
+				- 2 * GENERATED_GBL_DATA_SIZE)
 
 /* monitor code */
 #define	SIZE				0x40000
-#define	CONFIG_SYS_MONITOR_LEN		(SIZE - GENERATED_GBL_DATA_SIZE)
+#define	CONFIG_SYS_MONITOR_LEN		SIZE
 #define	CONFIG_SYS_MONITOR_BASE	\
 			(CONFIG_SYS_GBL_DATA_OFFSET - CONFIG_SYS_MONITOR_LEN)
 #define	CONFIG_SYS_MONITOR_END \
-- 
1.5.5.6

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

* [U-Boot] [PATCH 1/2] microblaze: Disabling interrupt should return 1 if implemented
  2010-12-21 12:09 ` [U-Boot] [PATCH 1/2] microblaze: Disabling interrupt should return 1 if implemented Michal Simek
  2010-12-21 12:09   ` [U-Boot] [PATCH 2/2] microblaze: Fix bdiinfo pointer Michal Simek
@ 2010-12-21 12:24   ` Wolfgang Denk
  1 sibling, 0 replies; 8+ messages in thread
From: Wolfgang Denk @ 2010-12-21 12:24 UTC (permalink / raw)
  To: u-boot

Dear Michal Simek,

In message <1292933384-3032-2-git-send-email-monstr@monstr.eu> you wrote:
> Microblaze implement enable/disable interrupts through MSR
> that's why disable_interrupts function should return 1.
> 
> Signed-off-by: John Linn <john.linn@xilinx.com>
> Signed-off-by: Michal Simek <monstr@monstr.eu>
> ---
>  arch/microblaze/cpu/interrupts.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/microblaze/cpu/interrupts.c b/arch/microblaze/cpu/interrupts.c
> index e9d53c1..331746c 100644
> --- a/arch/microblaze/cpu/interrupts.c
> +++ b/arch/microblaze/cpu/interrupts.c
> @@ -42,7 +42,7 @@ void enable_interrupts (void)
>  int disable_interrupts (void)
>  {
>  	MSRCLR(0x2);
> -	return 0;
> +	return 1;
>  }

I think this is wrong.  disable_interrupts() should return 1 only if
interrupts were enabled before, so code like this can make sure that
some parts are run with interrupts disabled, but then restore the
previous state, no matter if this had interrupts on or off:

	int flag = disable_interrupts();
	...
	do something
	...
	if (flag)
		enable_interrupts();

With your code, we would ALWAYS enable interrupts, even if these were
off before.

For reference, see for example arch/powerpc/lib/interrupts.c

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Quote from the Boss... "I didn't say it was your fault.  I said I was
going to blame it on you."

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

* [U-Boot] [PATCH 2/2] microblaze: Fix bdiinfo pointer
  2010-12-21 12:09   ` [U-Boot] [PATCH 2/2] microblaze: Fix bdiinfo pointer Michal Simek
@ 2010-12-21 12:26     ` Wolfgang Denk
  2010-12-21 12:58       ` Michal Simek
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Denk @ 2010-12-21 12:26 UTC (permalink / raw)
  To: u-boot

Dear Michal Simek,

In message <1292933384-3032-3-git-send-email-monstr@monstr.eu> you wrote:
> Patch "Replace CONFIG_SYS_GBL_DATA_SIZE by auto-generated value"
> (sha1: 25ddd1fb0a2281b182529afbc8fda5de2dc16d96)
> introduce GENERATED_GBL_DATA_SIZE which is sizeof aligned gd_t
> (currently 0x40).
> Microblaze configs used 0x40(128) because this place also contained
> board info structure which lies on the top of ram.
> 
> This patch is fixing this scheme by extending CONFIG_SYS_GBL_DATA_OFFSET
> value. Doubled GENERATED_GBL_DATA_SIZE size is enough to store
> gd_t and bd_t structures.

No, I will not accept this.

Please do not make assumptions abouth the size of bd_t compared to
GENERATED_GBL_DATA_SIZE.  Use the correct size instead, as you can
easily get using the sizeof() operator (plus some padding eventually
to guarantee alignment, if needed).

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I've got to get something inside me. Some coffee  or  something.  And
then the world will somehow be better.
                                     - Terry Pratchett, _Men at Arms_

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

* [U-Boot] [PATCH 2/2] microblaze: Fix bdiinfo pointer
  2010-12-21 12:26     ` Wolfgang Denk
@ 2010-12-21 12:58       ` Michal Simek
  2010-12-21 13:48         ` Wolfgang Denk
  0 siblings, 1 reply; 8+ messages in thread
From: Michal Simek @ 2010-12-21 12:58 UTC (permalink / raw)
  To: u-boot

Wolfgang Denk wrote:
> Dear Michal Simek,
> 
> In message <1292933384-3032-3-git-send-email-monstr@monstr.eu> you wrote:
>> Patch "Replace CONFIG_SYS_GBL_DATA_SIZE by auto-generated value"
>> (sha1: 25ddd1fb0a2281b182529afbc8fda5de2dc16d96)
>> introduce GENERATED_GBL_DATA_SIZE which is sizeof aligned gd_t
>> (currently 0x40).
>> Microblaze configs used 0x40(128) because this place also contained
>> board info structure which lies on the top of ram.
>>
>> This patch is fixing this scheme by extending CONFIG_SYS_GBL_DATA_OFFSET
>> value. Doubled GENERATED_GBL_DATA_SIZE size is enough to store
>> gd_t and bd_t structures.
> 
> No, I will not accept this.
> 
> Please do not make assumptions abouth the size of bd_t compared to
> GENERATED_GBL_DATA_SIZE.  Use the correct size instead, as you can
> easily get using the sizeof() operator (plus some padding eventually
> to guarantee alignment, if needed).

I would like to do it but it is not easy to use sizeof because there are 
some dependencies in macros in common.h(lines 193-201) because I am 
using CONFIG_SYS_GBL_DATA_OFFSET for monitor/malloc areas.

The best will be to be able to generate this value in lib/asm-offsets.c

Not sure if you are ok with it.

diff --git a/lib/asm-offsets.c b/lib/asm-offsets.c
index 2209561..36fc198 100644
--- a/lib/asm-offsets.c
+++ b/lib/asm-offsets.c
@@ -24,6 +24,8 @@ int main(void)
         /* Round up to make sure size gives nice stack alignment */
         DEFINE(GENERATED_GBL_DATA_SIZE,
                 (sizeof(struct global_data)+15) & ~15);
+       DEFINE(GENERATED_BD_INFO_SIZE,
+               (sizeof(struct bd_info)+15) & ~15);

         return 0;
  }


Michal

-- 
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian

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

* [U-Boot] [PATCH 2/2] microblaze: Fix bdiinfo pointer
  2010-12-21 12:58       ` Michal Simek
@ 2010-12-21 13:48         ` Wolfgang Denk
  2010-12-21 13:51           ` Michal Simek
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Denk @ 2010-12-21 13:48 UTC (permalink / raw)
  To: u-boot

Dear Michal Simek,

In message <4D10A473.2030202@monstr.eu> you wrote:
>
> I would like to do it but it is not easy to use sizeof because there are 
> some dependencies in macros in common.h(lines 193-201) because I am 
> using CONFIG_SYS_GBL_DATA_OFFSET for monitor/malloc areas.
> 
> The best will be to be able to generate this value in lib/asm-offsets.c
> 
> Not sure if you are ok with it.

Yes, this is OK.

> diff --git a/lib/asm-offsets.c b/lib/asm-offsets.c
> index 2209561..36fc198 100644
> --- a/lib/asm-offsets.c
> +++ b/lib/asm-offsets.c
> @@ -24,6 +24,8 @@ int main(void)
>          /* Round up to make sure size gives nice stack alignment */
>          DEFINE(GENERATED_GBL_DATA_SIZE,
>                  (sizeof(struct global_data)+15) & ~15);
> +       DEFINE(GENERATED_BD_INFO_SIZE,
> +               (sizeof(struct bd_info)+15) & ~15);
> 
>          return 0;
>   }

This patch is white-space corrupted, though.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Life. Don't talk to me about life.      - Marvin the Paranoid Android

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

* [U-Boot] [PATCH 2/2] microblaze: Fix bdiinfo pointer
  2010-12-21 13:48         ` Wolfgang Denk
@ 2010-12-21 13:51           ` Michal Simek
  0 siblings, 0 replies; 8+ messages in thread
From: Michal Simek @ 2010-12-21 13:51 UTC (permalink / raw)
  To: u-boot

Wolfgang Denk wrote:
> Dear Michal Simek,
> 
> In message <4D10A473.2030202@monstr.eu> you wrote:
>> I would like to do it but it is not easy to use sizeof because there are 
>> some dependencies in macros in common.h(lines 193-201) because I am 
>> using CONFIG_SYS_GBL_DATA_OFFSET for monitor/malloc areas.
>>
>> The best will be to be able to generate this value in lib/asm-offsets.c
>>
>> Not sure if you are ok with it.
> 
> Yes, this is OK.
> 
>> diff --git a/lib/asm-offsets.c b/lib/asm-offsets.c
>> index 2209561..36fc198 100644
>> --- a/lib/asm-offsets.c
>> +++ b/lib/asm-offsets.c
>> @@ -24,6 +24,8 @@ int main(void)
>>          /* Round up to make sure size gives nice stack alignment */
>>          DEFINE(GENERATED_GBL_DATA_SIZE,
>>                  (sizeof(struct global_data)+15) & ~15);
>> +       DEFINE(GENERATED_BD_INFO_SIZE,
>> +               (sizeof(struct bd_info)+15) & ~15);
>>
>>          return 0;
>>   }
> 
> This patch is white-space corrupted, though.

It wasn't intended as a patch just show if this approach will be acceptable.

I will generate patches based on this.

Thanks,
Michal


-- 
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian

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

end of thread, other threads:[~2010-12-21 13:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-21 12:09 [U-Boot] Microblaze fixes Michal Simek
2010-12-21 12:09 ` [U-Boot] [PATCH 1/2] microblaze: Disabling interrupt should return 1 if implemented Michal Simek
2010-12-21 12:09   ` [U-Boot] [PATCH 2/2] microblaze: Fix bdiinfo pointer Michal Simek
2010-12-21 12:26     ` Wolfgang Denk
2010-12-21 12:58       ` Michal Simek
2010-12-21 13:48         ` Wolfgang Denk
2010-12-21 13:51           ` Michal Simek
2010-12-21 12:24   ` [U-Boot] [PATCH 1/2] microblaze: Disabling interrupt should return 1 if implemented Wolfgang Denk

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