From 6273201b14fc0761df952e8ca76b367ef4f8b741 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 31 May 2012 16:37:02 +0200 Subject: bsps/powerpc: Add load section for .nocache --- .../powerpc/mpc55xxevb/startup/linkcmds.gwlcfm | 1 + .../powerpc/mpc55xxevb/startup/linkcmds.mpc5566evb | 1 + .../mpc55xxevb/startup/linkcmds.mpc5674fevb | 1 + .../mpc55xxevb/startup/linkcmds.phycore_mpc5554 | 1 + .../powerpc/mpc55xxevb/startup/linkcmds.xkt564levb | 1 + .../powerpc/mpc55xxevb/startup/start-early.c | 24 +++++++++++++++++++++- .../lib/libbsp/powerpc/mpc55xxevb/startup/start.S | 22 +++++++------------- .../powerpc/qoriq/startup/linkcmds.qoriq_core_0 | 3 ++- .../powerpc/qoriq/startup/linkcmds.qoriq_core_1 | 3 ++- .../powerpc/qoriq/startup/linkcmds.qoriq_p1020rdb | 3 ++- .../libbsp/powerpc/shared/include/linker-symbols.h | 2 ++ .../libbsp/powerpc/shared/startup/linkcmds.base | 4 +++- .../powerpc/t32mppc/startup/linkcmds.t32mppc | 3 ++- 13 files changed, 48 insertions(+), 21 deletions(-) diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.gwlcfm b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.gwlcfm index 42e6bb2aca..3f1bd3d9e4 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.gwlcfm +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.gwlcfm @@ -22,5 +22,6 @@ REGION_ALIAS ("REGION_RWEXTRA", RAM_EXT); REGION_ALIAS ("REGION_WORK", RAM_EXT); REGION_ALIAS ("REGION_STACK", RAM); REGION_ALIAS ("REGION_NOCACHE", NOCACHE); +REGION_ALIAS ("REGION_NOCACHE_LOAD", NOCACHE); INCLUDE linkcmds.mpc55xx diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5566evb b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5566evb index c8bbb59d58..1989473d3d 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5566evb +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5566evb @@ -22,5 +22,6 @@ REGION_ALIAS ("REGION_RWEXTRA", RAM_EXT); REGION_ALIAS ("REGION_WORK", RAM_EXT); REGION_ALIAS ("REGION_STACK", RAM); REGION_ALIAS ("REGION_NOCACHE", NOCACHE); +REGION_ALIAS ("REGION_NOCACHE_LOAD", NOCACHE); INCLUDE linkcmds.mpc55xx diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674fevb b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674fevb index 49362b8979..cb7c1ed7b0 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674fevb +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674fevb @@ -22,5 +22,6 @@ REGION_ALIAS ("REGION_RWEXTRA", RAM_EXT); REGION_ALIAS ("REGION_WORK", RAM_EXT); REGION_ALIAS ("REGION_STACK", RAM); REGION_ALIAS ("REGION_NOCACHE", NOCACHE); +REGION_ALIAS ("REGION_NOCACHE_LOAD", ROM); INCLUDE linkcmds.mpc55xx diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.phycore_mpc5554 b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.phycore_mpc5554 index 450193b9bf..18a0e8f44d 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.phycore_mpc5554 +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.phycore_mpc5554 @@ -31,5 +31,6 @@ REGION_ALIAS ("REGION_RWEXTRA", RAM_EXT); REGION_ALIAS ("REGION_WORK", RAM_EXT); REGION_ALIAS ("REGION_STACK", RAM); REGION_ALIAS ("REGION_NOCACHE", NOCACHE); +REGION_ALIAS ("REGION_NOCACHE_LOAD", NOCACHE); INCLUDE linkcmds.mpc55xx diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.xkt564levb b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.xkt564levb index 72d3762da3..98cc0bc78a 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.xkt564levb +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.xkt564levb @@ -27,5 +27,6 @@ REGION_ALIAS ("REGION_RWEXTRA", RAM_0); REGION_ALIAS ("REGION_WORK", RAM_1); REGION_ALIAS ("REGION_STACK", RAM_1); REGION_ALIAS ("REGION_NOCACHE", NOCACHE); +REGION_ALIAS ("REGION_NOCACHE_LOAD", NOCACHE); INCLUDE linkcmds.mpc55xx diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-early.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-early.c index 62cf8f58d7..daffc22ac1 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-early.c +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-early.c @@ -7,7 +7,7 @@ */ /* - * Copyright (c) 2008-2011 embedded brains GmbH. All rights reserved. + * Copyright (c) 2008-2012 embedded brains GmbH. All rights reserved. * * embedded brains GmbH * Obere Lagerstr. 30 @@ -23,6 +23,14 @@ #include #include #include +#include + +/* This function is defined in start.S */ +BSP_START_TEXT_SECTION void mpc55xx_start_load_section( + void *dst, + const void *src, + size_t n +); static BSP_START_TEXT_SECTION void mpc55xx_start_mmu(void) { @@ -53,6 +61,19 @@ static BSP_START_TEXT_SECTION void mpc55xx_start_internal_ram(void) #endif } +static BSP_START_TEXT_SECTION void mpc55xx_start_load_nocache_section(void) +{ + mpc55xx_start_load_section( + bsp_section_nocache_begin, + bsp_section_nocache_load_begin, + (size_t) bsp_section_nocache_size + ); + rtems_cache_flush_multiple_data_lines( + bsp_section_nocache_begin, + (size_t) bsp_section_nocache_size + ); +} + static BSP_START_TEXT_SECTION void mpc55xx_start_mode_change(void) { #ifdef MPC55XX_HAS_MODE_CONTROL @@ -167,6 +188,7 @@ BSP_START_TEXT_SECTION void mpc55xx_start_early(void) mpc55xx_start_cache(); #endif mpc55xx_start_internal_ram(); + mpc55xx_start_load_nocache_section(); mpc55xx_start_mmu(); mpc55xx_start_mode_change(); mpc55xx_start_siu(); diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start.S b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start.S index f05e2c7f1c..0b54b75734 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start.S +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start.S @@ -7,7 +7,7 @@ */ /* - * Copyright (c) 2008-2011 embedded brains GmbH. All rights reserved. + * Copyright (c) 2008-2012 embedded brains GmbH. All rights reserved. * * embedded brains GmbH * Obere Lagerstr. 30 @@ -21,7 +21,7 @@ */ #include - +#include #include #if MPC55XX_CHIP_TYPE / 10 != 551 @@ -41,20 +41,12 @@ .extern __eabi .extern boot_card .extern bsp_ram_start - .extern bsp_section_data_begin - .extern bsp_section_data_load_begin - .extern bsp_section_data_size - .extern bsp_section_fast_data_begin - .extern bsp_section_fast_data_load_begin - .extern bsp_section_fast_data_size - .extern bsp_section_fast_text_begin - .extern bsp_section_fast_text_load_begin - .extern bsp_section_fast_text_size .extern mpc55xx_start_config_mmu_early .extern mpc55xx_start_config_mmu_early_count .extern mpc55xx_start_early .globl _start + .globl mpc55xx_start_load_section .globl mpc55xx_start_mmu_apply_config #ifdef MPC55XX_BOOTFLAGS @@ -225,15 +217,15 @@ zero_intermediate_stack_loop: LA r3, bsp_section_fast_text_begin LA r4, bsp_section_fast_text_load_begin LA r5, bsp_section_fast_text_size - bl load_section + bl mpc55xx_start_load_section LA r3, bsp_section_fast_data_begin LA r4, bsp_section_fast_data_load_begin LA r5, bsp_section_fast_data_size - bl load_section + bl mpc55xx_start_load_section LA r3, bsp_section_data_begin LA r4, bsp_section_data_load_begin LA r5, bsp_section_data_size - bl load_section + bl mpc55xx_start_load_section /* Set up EABI and SYSV environment */ bl __eabi @@ -270,7 +262,7 @@ mmu_init_loop: bdnz mmu_init_loop blr -load_section: +mpc55xx_start_load_section: cmpw cr7, r3, r4 beqlr cr7 b memcpy diff --git a/c/src/lib/libbsp/powerpc/qoriq/startup/linkcmds.qoriq_core_0 b/c/src/lib/libbsp/powerpc/qoriq/startup/linkcmds.qoriq_core_0 index 7940cd46f0..d30d1c8f92 100644 --- a/c/src/lib/libbsp/powerpc/qoriq/startup/linkcmds.qoriq_core_0 +++ b/c/src/lib/libbsp/powerpc/qoriq/startup/linkcmds.qoriq_core_0 @@ -25,7 +25,8 @@ REGION_ALIAS ("REGION_BSS", HIGH); REGION_ALIAS ("REGION_RWEXTRA", HIGH); REGION_ALIAS ("REGION_WORK", HIGH); REGION_ALIAS ("REGION_STACK", HIGH); -REGION_ALIAS ("REGION_NOCACHE", HIGH); +REGION_ALIAS ("REGION_NOCACHE", NIRVANA); +REGION_ALIAS ("REGION_NOCACHE_LOAD", NIRVANA); bsp_section_robarrier_align = 0x1000000; bsp_section_rwbarrier_align = 0x1000000; diff --git a/c/src/lib/libbsp/powerpc/qoriq/startup/linkcmds.qoriq_core_1 b/c/src/lib/libbsp/powerpc/qoriq/startup/linkcmds.qoriq_core_1 index b9001a7054..1bc021d2a5 100644 --- a/c/src/lib/libbsp/powerpc/qoriq/startup/linkcmds.qoriq_core_1 +++ b/c/src/lib/libbsp/powerpc/qoriq/startup/linkcmds.qoriq_core_1 @@ -24,7 +24,8 @@ REGION_ALIAS ("REGION_BSS", RAM); REGION_ALIAS ("REGION_RWEXTRA", RAM); REGION_ALIAS ("REGION_WORK", RAM); REGION_ALIAS ("REGION_STACK", RAM); -REGION_ALIAS ("REGION_NOCACHE", RAM); +REGION_ALIAS ("REGION_NOCACHE", NIRVANA); +REGION_ALIAS ("REGION_NOCACHE_LOAD", NIRVANA); bsp_section_robarrier_align = 0x1000000; bsp_section_rwbarrier_align = 0x1000000; diff --git a/c/src/lib/libbsp/powerpc/qoriq/startup/linkcmds.qoriq_p1020rdb b/c/src/lib/libbsp/powerpc/qoriq/startup/linkcmds.qoriq_p1020rdb index 6e73fec23b..3543414a79 100644 --- a/c/src/lib/libbsp/powerpc/qoriq/startup/linkcmds.qoriq_p1020rdb +++ b/c/src/lib/libbsp/powerpc/qoriq/startup/linkcmds.qoriq_p1020rdb @@ -25,7 +25,8 @@ REGION_ALIAS ("REGION_BSS", HIGH); REGION_ALIAS ("REGION_RWEXTRA", HIGH); REGION_ALIAS ("REGION_WORK", HIGH); REGION_ALIAS ("REGION_STACK", HIGH); -REGION_ALIAS ("REGION_NOCACHE", HIGH); +REGION_ALIAS ("REGION_NOCACHE", NIRVANA); +REGION_ALIAS ("REGION_NOCACHE_LOAD", NIRVANA); bsp_section_robarrier_align = 0x1000000; bsp_section_rwbarrier_align = 0x1000000; diff --git a/c/src/lib/libbsp/powerpc/shared/include/linker-symbols.h b/c/src/lib/libbsp/powerpc/shared/include/linker-symbols.h index 87c9532728..80f54bd4b9 100644 --- a/c/src/lib/libbsp/powerpc/shared/include/linker-symbols.h +++ b/c/src/lib/libbsp/powerpc/shared/include/linker-symbols.h @@ -96,6 +96,8 @@ LINKER_SYMBOL(bsp_section_stack_size) LINKER_SYMBOL(bsp_section_nocache_begin) LINKER_SYMBOL(bsp_section_nocache_end) LINKER_SYMBOL(bsp_section_nocache_size) +LINKER_SYMBOL(bsp_section_nocache_load_begin) +LINKER_SYMBOL(bsp_section_nocache_load_end) #define BSP_FAST_TEXT_SECTION __attribute__((section(".bsp_fast_text"))) diff --git a/c/src/lib/libbsp/powerpc/shared/startup/linkcmds.base b/c/src/lib/libbsp/powerpc/shared/startup/linkcmds.base index 24cee144f4..95453a9457 100644 --- a/c/src/lib/libbsp/powerpc/shared/startup/linkcmds.base +++ b/c/src/lib/libbsp/powerpc/shared/startup/linkcmds.base @@ -328,8 +328,10 @@ SECTIONS { bsp_section_nocache_begin = .; *(.bsp_nocache) bsp_section_nocache_end = .; - } > REGION_NOCACHE AT > REGION_NOCACHE + } > REGION_NOCACHE AT > REGION_NOCACHE_LOAD bsp_section_nocache_size = bsp_section_nocache_end - bsp_section_nocache_begin; + bsp_section_nocache_load_begin = LOADADDR (.nocache); + bsp_section_nocache_load_end = bsp_section_nocache_load_begin + bsp_section_nocache_size; /* FIXME */ RamBase = ORIGIN (REGION_WORK); diff --git a/c/src/lib/libbsp/powerpc/t32mppc/startup/linkcmds.t32mppc b/c/src/lib/libbsp/powerpc/t32mppc/startup/linkcmds.t32mppc index 88e3b4390a..b4f6e98997 100644 --- a/c/src/lib/libbsp/powerpc/t32mppc/startup/linkcmds.t32mppc +++ b/c/src/lib/libbsp/powerpc/t32mppc/startup/linkcmds.t32mppc @@ -18,6 +18,7 @@ REGION_ALIAS ("REGION_BSS", RAM); REGION_ALIAS ("REGION_RWEXTRA", RAM); REGION_ALIAS ("REGION_WORK", RAM); REGION_ALIAS ("REGION_STACK", RAM); -REGION_ALIAS ("REGION_NOCACHE", RAM); +REGION_ALIAS ("REGION_NOCACHE", NIRVANA); +REGION_ALIAS ("REGION_NOCACHE_LOAD", NIRVANA); INCLUDE linkcmds.base -- cgit v1.2.3