Skip to contentSkip to conversation

Microblaze fixes

U-Boot Superseded Michal Simek 2 participants 8 messages Dec 21, 2010

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Michal Simek

author maintainer
#0 lore raw

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(-)
author maintainer
#1 lore raw

PATCH 1/2 microblaze: Disabling interrupt should return 1 if implemented

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

---
 arch/microblaze/cpu/interrupts.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/microblaze/cpu/interrupts.c +1 -1
index e9d53c1..331746c 100644
@@ -42,7 +42,7 @@ void enable_interrupts (void)
 int disable_interrupts (void)
 {
 	MSRCLR(0x2);
-	return 0;
+	return 1;
 }
 
 #ifdef CONFIG_SYS_INTC_0
Signature · 1 line
1.5.5.6
author maintainer
#2 lore raw

PATCH 2/2 microblaze: Fix bdiinfo pointer

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
---
 arch/microblaze/lib/board.c          |    2 +-
 include/configs/microblaze-generic.h |    7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)
arch/microblaze/lib/board.c +1 -1
index eeef579..e215684 100644
@@ -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;
include/configs/microblaze-generic.h +5 -2
index 75e4e07..ec152bf 100644
@@ -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 \
Signature · 1 line
1.5.5.6
#3 lore raw

PATCH 2/2 microblaze: Fix bdiinfo pointer

Dear Michal Simek,

Quoted 10 lines · In message <[email protected]> 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

Signature · 6 lines
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_
author maintainer
#4 lore raw

PATCH 2/2 microblaze: Fix bdiinfo pointer

Quoted 14 lines · Wolfgang Denk

Dear Michal Simek,

Quoted 10 lines · In message <[email protected]> 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.

Quoted 6 lines

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.

lib/asm-offsets.c +2 -0
index 2209561..36fc198 100644
@@ -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

Signature · 4 lines
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
#5 lore raw

PATCH 2/2 microblaze: Fix bdiinfo pointer

Dear Michal Simek,

Quoted 8 lines · In message <[email protected]> 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.

lib/asm-offsets.c int main(void) · line 31

Quoted 13 lines
lib/asm-offsets.c +2 -0
index 2209561..36fc198 100644
@@ -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

Signature · 4 lines
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
author maintainer
#6 lore raw

PATCH 2/2 microblaze: Fix bdiinfo pointer

Quoted 24 lines · Wolfgang Denk

Dear Michal Simek,

Quoted 7 lines · In message <[email protected]> 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.

Quoted 11 lines
lib/asm-offsets.c +2 -0
index 2209561..36fc198 100644
@@ -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);
 
Quoted 4 lines

lib/asm-offsets.c int main(void) · line 31

Quoted 2 lines
lib/asm-offsets.c +0 -0
         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

Signature · 4 lines
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
#7 lore raw

PATCH 1/2 microblaze: Disabling interrupt should return 1 if implemented

In reply to Michal Simek

Dear Michal Simek,

Quoted 14 lines · In message <[email protected]> you wrote:

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

---
 arch/microblaze/cpu/interrupts.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/microblaze/cpu/interrupts.c +0 -0
index e9d53c1..331746c 100644

arch/microblaze/cpu/interrupts.c void enable_interrupts (void) · line 46

Quoted 6 lines
arch/microblaze/cpu/interrupts.c +1 -1
@@ -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

Signature · 5 lines
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."