[U-Boot] [PATCH] 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.
Signed-off-by: Ed Swarthout Ed.Swarthout@freescale.com --- 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(-)
diff --git a/cpu/mpc85xx/start.S b/cpu/mpc85xx/start.S index 8fa0ff7..7e11f35 100644 --- a/cpu/mpc85xx/start.S +++ b/cpu/mpc85xx/start.S @@ -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 */

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.
Signed-off-by: Ed Swarthout Ed.Swarthout@freescale.com
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(-)
diff --git a/cpu/mpc85xx/start.S b/cpu/mpc85xx/start.S index 8fa0ff7..7e11f35 100644 --- a/cpu/mpc85xx/start.S +++ b/cpu/mpc85xx/start.S @@ -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 */
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.
participants (2)
-
Ed Swarthout
-
Liu Dave