Skip to contentSkip to conversation

mpc85xx shrink boot block page to 1M

PATCH New Ed Swarthout 2 participants 3 messages Dec 17, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mpc85xx shrink boot block page to 1M

Use CONFIG_SYS_BOOT_BLOCK_{EPN,RPN,PAGESZ} in start.S for the boot block TLB for AS=1 mapping. Reduce the default size from 16M to 1M.

Change bne to blt in 85xx clear_bss to protect against the pointer never being equal to _end if _end is not word aligned.

---
This is an alternate patch to Dave Liu's:
2008-12-16 [PATCH 1/3] 85xx: Fix the boot window issue

It has the additional feature of allowing the board file to override the mapping values without additional code.

 cpu/mpc85xx/start.S |   28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)
cpu/mpc85xx/start.S +20 -8
index 8fa0ff7..7e11f35 100644
@@ -188,15 +188,27 @@ _start_e500:
 	lis     r6,FSL_BOOKE_MAS0(1, 15, 0)@h
 	ori     r6,r6,FSL_BOOKE_MAS0(1, 15, 0)@l
 
-	lis     r7,FSL_BOOKE_MAS1(1, 1, 0, 1, BOOKE_PAGESZ_16M)@h
-	ori     r7,r7,FSL_BOOKE_MAS1(1, 1, 0, 1, BOOKE_PAGESZ_16M)@l
+#ifndef CONFIG_SYS_BOOT_BLOCK_EPN
+#define CONFIG_SYS_BOOT_BLOCK_EPN (TEXT_BASE & 0xfff00000) /* Align to 1MB */
+#endif
+#ifndef CONFIG_SYS_BOOT_BLOCK_RPN
+#define CONFIG_SYS_BOOT_BLOCK_RPN 0xfff00000
+#endif
+#ifndef CONFIG_SYS_BOOT_BLOCK_PAGESZ
+#define CONFIG_SYS_BOOT_BLOCK_PAGESZ	BOOKE_PAGESZ_1M
+#endif
 
-	/* Align the mapping to 16MB */
-	lis     r8,FSL_BOOKE_MAS2(TEXT_BASE & 0xff000000, (MAS2_I|MAS2_G))@h
-	ori     r8,r8,FSL_BOOKE_MAS2(TEXT_BASE & 0xff000000, (MAS2_I|MAS2_G))@l
+	lis     r7,FSL_BOOKE_MAS1(1, 1, 0, 1, CONFIG_SYS_BOOT_BLOCK_PAGESZ)@h
+	ori     r7,r7,FSL_BOOKE_MAS1(1, 1, 0, 1, CONFIG_SYS_BOOT_BLOCK_PAGESZ)@l
 
-	lis     r9,FSL_BOOKE_MAS3(0xff000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR))@h
-	ori     r9,r9,FSL_BOOKE_MAS3(0xff000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR))@l
+	lis     r8,FSL_BOOKE_MAS2(CONFIG_SYS_BOOT_BLOCK_EPN, (MAS2_I|MAS2_G))@h
+	ori     r8,r8,FSL_BOOKE_MAS2(CONFIG_SYS_BOOT_BLOCK_EPN,
+				(MAS2_I|MAS2_G))@l
+
+	lis     r9,FSL_BOOKE_MAS3(CONFIG_SYS_BOOT_BLOCK_RPN, 0,
+				(MAS3_SX|MAS3_SW|MAS3_SR))@h
+	ori     r9,r9,FSL_BOOKE_MAS3(CONFIG_SYS_BOOT_BLOCK_RPN, 0,
+				(MAS3_SX|MAS3_SW|MAS3_SR))@l
 
 	mtspr   MAS0,r6
 	mtspr   MAS1,r7
@@ -917,7 +929,7 @@ clear_bss:
 	stw	r0,0(r3)
 	addi	r3,r3,4
 	cmplw	0,r3,r4
-	bne	5b
+	blt	5b
 6:
 
 	mr	r3,r9		/* Init Data pointer		*/
Signature · 1 line
1.5.6.5
#1 lore raw

PATCH 1/1 mpc85xx shrink boot block page to 1M

Quoted 76 lines

Use CONFIG_SYS_BOOT_BLOCK_{EPN,RPN,PAGESZ} in start.S for the boot block TLB for AS=1 mapping. Reduce the default size from 16M to 1M.

Change bne to blt in 85xx clear_bss to protect against the pointer never being equal to _end if _end is not word aligned.

---
This is an alternate patch to Dave Liu's:
2008-12-16 [PATCH 1/3] 85xx: Fix the boot window issue

It has the additional feature of allowing the board file to override the mapping values without additional code.

 cpu/mpc85xx/start.S |   28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)
cpu/mpc85xx/start.S +9 -4
index 8fa0ff7..7e11f35 100644
@@ -188,15 +188,27 @@ _start_e500:
 	lis     r6,FSL_BOOKE_MAS0(1, 15, 0)@h
 	ori     r6,r6,FSL_BOOKE_MAS0(1, 15, 0)@l
 
-	lis     r7,FSL_BOOKE_MAS1(1, 1, 0, 1, BOOKE_PAGESZ_16M)@h
-	ori     r7,r7,FSL_BOOKE_MAS1(1, 1, 0, 1, BOOKE_PAGESZ_16M)@l
+#ifndef CONFIG_SYS_BOOT_BLOCK_EPN
+#define CONFIG_SYS_BOOT_BLOCK_EPN (TEXT_BASE & 0xfff00000) 
 /* Align to 1MB */
+#endif
+#ifndef CONFIG_SYS_BOOT_BLOCK_RPN
+#define CONFIG_SYS_BOOT_BLOCK_RPN 0xfff00000
+#endif
+#ifndef CONFIG_SYS_BOOT_BLOCK_PAGESZ
+#define CONFIG_SYS_BOOT_BLOCK_PAGESZ	BOOKE_PAGESZ_1M
+#endif
 
-	/* Align the mapping to 16MB */
-	lis     r8,FSL_BOOKE_MAS2(TEXT_BASE & 0xff000000, 

(MAS2_I|MAS2_G))@h

cpu/mpc85xx/start.S +0 -1
-	ori     r8,r8,FSL_BOOKE_MAS2(TEXT_BASE & 0xff000000, 

(MAS2_I|MAS2_G))@l

cpu/mpc85xx/start.S +1 -0
+	lis     r7,FSL_BOOKE_MAS1(1, 1, 0, 1, 

CONFIG_SYS_BOOT_BLOCK_PAGESZ)@h

cpu/mpc85xx/start.S +1 -0
+	ori     r7,r7,FSL_BOOKE_MAS1(1, 1, 0, 1, 

CONFIG_SYS_BOOT_BLOCK_PAGESZ)@l

cpu/mpc85xx/start.S +0 -1
-	lis     r9,FSL_BOOKE_MAS3(0xff000000, 0, 

(MAS3_SX|MAS3_SW|MAS3_SR))@h

cpu/mpc85xx/start.S +0 -1
-	ori     r9,r9,FSL_BOOKE_MAS3(0xff000000, 0, 

(MAS3_SX|MAS3_SW|MAS3_SR))@l

cpu/mpc85xx/start.S +1 -0
+	lis     r8,FSL_BOOKE_MAS2(CONFIG_SYS_BOOT_BLOCK_EPN, 

(MAS2_I|MAS2_G))@h

cpu/mpc85xx/start.S +8 -1
+	ori     r8,r8,FSL_BOOKE_MAS2(CONFIG_SYS_BOOT_BLOCK_EPN,
+				(MAS2_I|MAS2_G))@l
+
+	lis     r9,FSL_BOOKE_MAS3(CONFIG_SYS_BOOT_BLOCK_RPN, 0,
+				(MAS3_SX|MAS3_SW|MAS3_SR))@h
+	ori     r9,r9,FSL_BOOKE_MAS3(CONFIG_SYS_BOOT_BLOCK_RPN, 0,
+				(MAS3_SX|MAS3_SW|MAS3_SR))@l
 
 	mtspr   MAS0,r6
 	mtspr   MAS1,r7
@@ -917,7 +929,7 @@ clear_bss:
 	stw	r0,0(r3)
 	addi	r3,r3,4
 	cmplw	0,r3,r4
-	bne	5b
+	blt	5b
 6:
 
 	mr	r3,r9		/* Init Data pointer		*/
Signature · 1 line
1.5.6.5

If we reduce to 1M, that means the u-boot image size must less than 1MB. I wish we reduce to 4M.

#2 lore raw

PATCH 1/1 mpc85xx shrink boot block page to 1M

In reply to Ed Swarthout
Quoted 2 lines

Change bne to blt in 85xx clear_bss to protect against the pointer never being equal to _end if _end is not word aligned.

<snip>

cpu/mpc85xx/start.S clear_bss: · line 933

Quoted 7 lines
cpu/mpc85xx/start.S +1 -1
@@ -917,7 +929,7 @@ clear_bss:
 	stw	r0,0(r3)
 	addi	r3,r3,4
 	cmplw	0,r3,r4
-	bne	5b
+	blt	5b
 6:

Should not they be placed at another patch?
Bss....