Changeset e29f1f5 in rtems
- Timestamp:
- 10/19/15 06:44:33 (8 years ago)
- Branches:
- 5, master
- Children:
- c07481c7
- Parents:
- c03c71b
- git-author:
- Sebastian Huber <sebastian.huber@…> (10/19/15 06:44:33)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (10/19/15 07:51:28)
- Location:
- c/src/lib/libbsp
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/lib/libbsp/powerpc/qoriq/Makefile.am
rc03c71b re29f1f5 23 23 ../../shared/include/irq-info.h \ 24 24 ../../shared/include/bootcard.h \ 25 ../../shared/include/fdt.h \ 25 26 ../../shared/include/u-boot.h \ 26 27 ../../shared/include/utility.h \ … … 64 65 ../../shared/bspclean.c \ 65 66 ../../shared/bspgetworkarea.c \ 67 ../../shared/src/bsp-fdt.c \ 66 68 ../../shared/src/bsp-uboot-board-info.c \ 67 69 ../shared/src/ppc-exc-handler-table.c \ -
c/src/lib/libbsp/powerpc/qoriq/README
rc03c71b re29f1f5 3 3 http://en.wikipedia.org/wiki/QorIQ 4 4 5 Development board P1020RDB. 5 Development boards P1020RDB, T2080RDB and T4240RDB. 6 7 For the T series boot via U-Boot is mandatory since the FDT is used. Use 8 9 mkimage -A ppc -O linux -T kernel -a 0x4000 -e 0x4000 -n RTEMS -d app.bin.gz app.img 10 11 to create a bootable image. You must use the "linux" image type. Boot it for 12 example via the 13 14 bootm 0xe9000000 - 0xe8800000 15 16 U-Boot command. -
c/src/lib/libbsp/powerpc/qoriq/configure.ac
rc03c71b re29f1f5 53 53 RTEMS_BSPOPTS_HELP([BSP_USE_UART_INTERRUPTS],[enable usage of interrupts for the UART modules]) 54 54 55 RTEMS_BSPOPTS_SET([U_BOOT_USE_FDT],[qoriq_t*],[1]) 56 RTEMS_BSPOPTS_SET([U_BOOT_USE_FDT],[*],[]) 57 RTEMS_BSPOPTS_HELP([U_BOOT_USE_FDT],[enables U-Boot support using FDT]) 58 59 RTEMS_BSPOPTS_SET([BSP_FDT_BLOB_SIZE_MAX],[qoriq_t*],[131072]) 60 RTEMS_BSPOPTS_SET([BSP_FDT_BLOB_SIZE_MAX],[*],[]) 61 RTEMS_BSPOPTS_HELP([BSP_FDT_BLOB_SIZE_MAX],[maximum size of the FDT blob in bytes]) 62 63 RTEMS_BSPOPTS_SET([BSP_FDT_BLOB_READ_ONLY],[qoriq_t*],[1]) 64 RTEMS_BSPOPTS_SET([BSP_FDT_BLOB_READ_ONLY],[*],[]) 65 RTEMS_BSPOPTS_HELP([BSP_FDT_BLOB_READ_ONLY],[place the FDT blob into the read-only data area]) 66 67 RTEMS_BSPOPTS_SET([HAS_UBOOT],[qoriq_t*],[]) 55 68 RTEMS_BSPOPTS_SET([HAS_UBOOT],[*],[1]) 56 RTEMS_BSPOPTS_HELP([HAS_UBOOT],[enables U-Boot support])69 RTEMS_BSPOPTS_HELP([HAS_UBOOT],[enables legacy U-Boot support without FDT]) 57 70 58 71 RTEMS_BSPOPTS_SET([U_BOOT_64_BIT_PHYS_SIZE],[qoriq_t*],[1]) 59 72 RTEMS_BSPOPTS_SET([U_BOOT_64_BIT_PHYS_SIZE],[*],[]) 60 RTEMS_BSPOPTS_HELP([U_BOOT_64_BIT_PHYS_SIZE],[if defined, then use uint64_t for phys_size_t ])73 RTEMS_BSPOPTS_HELP([U_BOOT_64_BIT_PHYS_SIZE],[if defined, then use uint64_t for phys_size_t (only used by legacy U-Boot support)]) 61 74 62 75 RTEMS_BSPOPTS_SET([U_BOOT_GENERIC_BOARD_INFO],[qoriq_t*],[1]) 63 76 RTEMS_BSPOPTS_SET([U_BOOT_GENERIC_BOARD_INFO],[*],[]) 64 RTEMS_BSPOPTS_HELP([U_BOOT_GENERIC_BOARD_INFO],[if defined, then use the generic bd_t structure ])77 RTEMS_BSPOPTS_HELP([U_BOOT_GENERIC_BOARD_INFO],[if defined, then use the generic bd_t structure (only used by legacy U-Boot support)]) 65 78 66 79 RTEMS_BSPOPTS_SET([U_BOOT_BOOT_PAGE_BEGIN],[qoriq_p2020*],[0x3fff0000]) 67 RTEMS_BSPOPTS_SET([U_BOOT_BOOT_PAGE_BEGIN],[qoriq_t2080*],[0x7fef4000]) 68 RTEMS_BSPOPTS_SET([U_BOOT_BOOT_PAGE_BEGIN],[qoriq_t4240*],[0x7ff33000]) 80 RTEMS_BSPOPTS_SET([U_BOOT_BOOT_PAGE_BEGIN],[qoriq_t*],[]) 69 81 RTEMS_BSPOPTS_SET([U_BOOT_BOOT_PAGE_BEGIN],[*],[0x1fff0000]) 70 RTEMS_BSPOPTS_HELP([U_BOOT_BOOT_PAGE_BEGIN],[the begin address of the boot page set up by U-Boot ])82 RTEMS_BSPOPTS_HELP([U_BOOT_BOOT_PAGE_BEGIN],[the begin address of the boot page set up by U-Boot (only used by legacy U-Boot support)]) 71 83 72 84 RTEMS_BSPOPTS_SET([U_BOOT_BOOT_PAGE_LAST],[qoriq_p2020*],[0x3fffffff]) 73 RTEMS_BSPOPTS_SET([U_BOOT_BOOT_PAGE_LAST],[qoriq_t2080*],[0x7fef4fff]) 74 RTEMS_BSPOPTS_SET([U_BOOT_BOOT_PAGE_LAST],[qoriq_t4240*],[0x7ff33fff]) 85 RTEMS_BSPOPTS_SET([U_BOOT_BOOT_PAGE_LAST],[qoriq_t*],[]) 75 86 RTEMS_BSPOPTS_SET([U_BOOT_BOOT_PAGE_LAST],[*],[0x1fffffff]) 76 RTEMS_BSPOPTS_HELP([U_BOOT_BOOT_PAGE_LAST],[the last address of the boot page set up by U-Boot ])87 RTEMS_BSPOPTS_HELP([U_BOOT_BOOT_PAGE_LAST],[the last address of the boot page set up by U-Boot (only used by legacy U-Boot support)]) 77 88 78 89 RTEMS_BSPOPTS_SET([U_BOOT_BOOT_PAGE_SPIN_OFFSET],[qoriq_p2020*],[0xf240]) 79 RTEMS_BSPOPTS_SET([U_BOOT_BOOT_PAGE_SPIN_OFFSET],[qoriq_t*],[ 0x0200])90 RTEMS_BSPOPTS_SET([U_BOOT_BOOT_PAGE_SPIN_OFFSET],[qoriq_t*],[]) 80 91 RTEMS_BSPOPTS_SET([U_BOOT_BOOT_PAGE_SPIN_OFFSET],[*],[0xf2a0]) 81 RTEMS_BSPOPTS_HELP([U_BOOT_BOOT_PAGE_SPIN_OFFSET],[the offset to the spin table in the boot page set up by U-Boot ])92 RTEMS_BSPOPTS_HELP([U_BOOT_BOOT_PAGE_SPIN_OFFSET],[the offset to the spin table in the boot page set up by U-Boot (only used by legacy U-Boot support)]) 82 93 83 RTEMS_BSPOPTS_SET([QORIQ_CPU_COUNT],[qoriq_t2080*],[8]) 84 RTEMS_BSPOPTS_SET([QORIQ_CPU_COUNT],[qoriq_t4240*],[24]) 94 RTEMS_BSPOPTS_SET([QORIQ_CPU_COUNT],[qoriq_t*],[24]) 85 95 RTEMS_BSPOPTS_SET([QORIQ_CPU_COUNT],[*],[2]) 86 RTEMS_BSPOPTS_HELP([QORIQ_CPU_COUNT],[ virtual processor count])96 RTEMS_BSPOPTS_HELP([QORIQ_CPU_COUNT],[maximum virtual processor count]) 87 97 88 98 RTEMS_BSPOPTS_SET([QORIQ_THREAD_COUNT],[qoriq_t*],[2]) -
c/src/lib/libbsp/powerpc/qoriq/preinstall.am
rc03c71b re29f1f5 69 69 $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/bootcard.h 70 70 PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/bootcard.h 71 72 $(PROJECT_INCLUDE)/bsp/fdt.h: ../../shared/include/fdt.h $(PROJECT_INCLUDE)/bsp/$(dirstamp) 73 $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/fdt.h 74 PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/fdt.h 71 75 72 76 $(PROJECT_INCLUDE)/bsp/u-boot.h: ../../shared/include/u-boot.h $(PROJECT_INCLUDE)/bsp/$(dirstamp) -
c/src/lib/libbsp/powerpc/qoriq/start/start.S
rc03c71b re29f1f5 56 56 bl bsp_uboot_copy_board_info 57 57 #endif /* HAS_UBOOT */ 58 59 #ifdef U_BOOT_USE_FDT 60 bl bsp_fdt_copy 61 #endif /* U_BOOT_USE_FDT */ 58 62 59 63 /* Get start stack */ -
c/src/lib/libbsp/powerpc/qoriq/startup/bspsmp.c
rc03c71b re29f1f5 15 15 #include <rtems/score/smpimpl.h> 16 16 17 #include <libfdt.h> 18 17 19 #include <libcpu/powerpc-utility.h> 18 20 19 21 #include <bsp.h> 22 #include <bsp/fdt.h> 20 23 #include <bsp/mmu.h> 21 24 #include <bsp/fatal.h> … … 42 45 #define TLB_COUNT (TLB_END - TLB_BEGIN) 43 46 44 /* 45 * These values can be obtained with the debugger or a look into the 46 * U-Boot sources (arch/powerpc/cpu/mpc85xx/release.S). 47 */ 48 #define BOOT_BEGIN U_BOOT_BOOT_PAGE_BEGIN 49 #define BOOT_LAST U_BOOT_BOOT_PAGE_LAST 50 #define SPIN_TABLE (BOOT_BEGIN + U_BOOT_BOOT_PAGE_SPIN_OFFSET) 47 #ifdef HAS_UBOOT 48 /* 49 * These values can be obtained with the debugger or a look into the U-Boot 50 * sources (arch/powerpc/cpu/mpc85xx/release.S). 51 */ 52 #define BOOT_BEGIN U_BOOT_BOOT_PAGE_BEGIN 53 #define BOOT_LAST U_BOOT_BOOT_PAGE_LAST 54 #define SPIN_TABLE (BOOT_BEGIN + U_BOOT_BOOT_PAGE_SPIN_OFFSET) 55 #endif 51 56 52 57 typedef struct { … … 139 144 } 140 145 146 #ifdef U_BOOT_USE_FDT 147 static uboot_spin_table *spin_table_addr[QORIQ_CPU_COUNT / QORIQ_THREAD_COUNT]; 148 #endif 149 150 static uint32_t discover_processors(uint32_t *boot_begin, uint32_t *boot_last) 151 { 152 #if defined(HAS_UBOOT) 153 *boot_begin = BOOT_BEGIN; 154 *boot_last = BOOT_LAST; 155 156 return QORIQ_CPU_COUNT; 157 #elif defined(U_BOOT_USE_FDT) 158 const void *fdt = bsp_fdt_get(); 159 int cpus = fdt_path_offset(fdt, "/cpus"); 160 int node = fdt_first_subnode(fdt, cpus); 161 uint32_t cpu = 0; 162 uintptr_t last = 0; 163 uintptr_t begin = last - 1; 164 165 while (node >= 0) { 166 int len; 167 fdt64_t *addr_fdt = (fdt64_t *) 168 fdt_getprop(fdt, node, "cpu-release-addr", &len); 169 170 if (addr_fdt != NULL && cpu < RTEMS_ARRAY_SIZE(spin_table_addr)) { 171 uintptr_t addr = (uintptr_t) fdt64_to_cpu(*addr_fdt); 172 173 if (addr < begin) { 174 begin = addr; 175 } 176 177 if (addr > last) { 178 last = addr; 179 } 180 181 spin_table_addr[cpu] = (uboot_spin_table *) addr; 182 ++cpu; 183 } 184 185 node = fdt_next_subnode(fdt, node); 186 } 187 188 *boot_begin = begin; 189 *boot_last = last; 190 191 return cpu * QORIQ_THREAD_COUNT; 192 #endif 193 } 194 141 195 uint32_t _CPU_SMP_Initialize(void) 142 196 { 197 uint32_t cpu_count = 1; 198 143 199 if (rtems_configuration_get_maximum_processors() > 0) { 144 200 qoriq_mmu_context mmu_context; 201 uint32_t boot_begin; 202 uint32_t boot_last; 203 204 cpu_count = discover_processors(&boot_begin, &boot_last); 145 205 146 206 qoriq_mmu_context_init(&mmu_context); 147 207 qoriq_mmu_add( 148 208 &mmu_context, 149 BOOT_BEGIN,150 BOOT_LAST,209 boot_begin, 210 boot_last, 151 211 0, 152 212 0, … … 160 220 start_thread_if_necessary(0); 161 221 162 return QORIQ_CPU_COUNT;222 return cpu_count; 163 223 } 164 224 … … 176 236 } 177 237 238 static uboot_spin_table *get_spin_table(uint32_t cpu_index) 239 { 240 #if defined(HAS_UBOOT) 241 #if QORIQ_THREAD_COUNT > 1 242 return &((uboot_spin_table *) SPIN_TABLE)[cpu_index / 2 - 1]; 243 #else 244 return (uboot_spin_table *) SPIN_TABLE; 245 #endif 246 #elif defined(U_BOOT_USE_FDT) 247 return spin_table_addr[cpu_index / 2]; 248 #endif 249 } 250 178 251 bool _CPU_SMP_Start_processor(uint32_t cpu_index) 179 252 { 180 253 #if QORIQ_THREAD_COUNT > 1 181 254 if (is_started_by_u_boot(cpu_index)) { 182 uboot_spin_table *spin_table = 183 &((uboot_spin_table *) SPIN_TABLE)[cpu_index / 2 - 1]; 255 uboot_spin_table *spin_table = get_spin_table(cpu_index); 184 256 185 257 release_processor(spin_table, cpu_index); … … 190 262 } 191 263 #else 192 uboot_spin_table *spin_table = (uboot_spin_table *) SPIN_TABLE;264 uboot_spin_table *spin_table = get_spin_table(cpu_index); 193 265 194 266 release_processor(spin_table, cpu_index); -
c/src/lib/libbsp/powerpc/qoriq/startup/bspstart.c
rc03c71b re29f1f5 8 8 9 9 /* 10 * Copyright (c) 2010-201 2embedded brains GmbH. All rights reserved.10 * Copyright (c) 2010-2015 embedded brains GmbH. All rights reserved. 11 11 * 12 12 * embedded brains GmbH 13 * Obere Lagerstr. 3013 * Dornierstr. 4 14 14 * 82178 Puchheim 15 15 * Germany … … 20 20 * http://www.rtems.org/license/LICENSE. 21 21 */ 22 23 #include <libfdt.h> 22 24 23 25 #include <rtems.h> … … 30 32 31 33 #include <bsp.h> 32 #include <bsp/vectors.h>33 34 #include <bsp/bootcard.h> 35 #include <bsp/console-termios.h> 36 #include <bsp/fatal.h> 37 #include <bsp/fdt.h> 34 38 #include <bsp/irq-generic.h> 35 #include <bsp/u-boot.h>36 39 #include <bsp/linker-symbols.h> 37 40 #include <bsp/mmu.h> 38 41 #include <bsp/qoriq.h> 39 #include <bsp/console-termios.h> 42 #include <bsp/u-boot.h> 43 #include <bsp/vectors.h> 40 44 41 45 LINKER_SYMBOL(bsp_exc_vector_base); … … 87 91 88 92 /* Initialize some device driver parameters */ 89 #if def HAS_UBOOT93 #if defined(HAS_UBOOT) 90 94 BSP_bus_frequency = bsp_uboot_board_info.bi_busfreq 91 95 / QORIQ_BUS_CLOCK_DIVIDER; … … 98 102 #endif 99 103 ); 100 #endif /* HAS_UBOOT */ 104 #elif defined(U_BOOT_USE_FDT) 105 { 106 const void *fdt = bsp_fdt_get(); 107 int node; 108 int len; 109 fdt32_t *val_fdt; 110 111 node = fdt_node_offset_by_prop_value(fdt, -1, "device_type", "cpu", 4); 112 113 val_fdt = (fdt32_t *) fdt_getprop(fdt, node, "bus-frequency", &len); 114 if (val_fdt == NULL || len != 4) { 115 bsp_fatal(QORIQ_FATAL_FDT_NO_BUS_FREQUENCY); 116 } 117 BSP_bus_frequency = fdt32_to_cpu(*val_fdt) / QORIQ_BUS_CLOCK_DIVIDER; 118 119 val_fdt = (fdt32_t *) fdt_getprop(fdt, node, "timebase-frequency", &len); 120 if (val_fdt == NULL || len != 4) { 121 bsp_fatal(QORIQ_FATAL_FDT_NO_BUS_FREQUENCY); 122 } 123 bsp_clicks_per_usec = fdt32_to_cpu(*val_fdt) / 1000000; 124 125 #ifdef __PPC_CPU_E6500__ 126 val_fdt = (fdt32_t *) fdt_getprop(fdt, node, "clock-frequency", &len); 127 if (val_fdt == NULL || len != 4) { 128 bsp_fatal(QORIQ_FATAL_FDT_NO_CLOCK_FREQUENCY); 129 } 130 #endif 131 rtems_counter_initialize_converter(fdt32_to_cpu(*val_fdt)); 132 } 133 #endif 101 134 102 135 /* Initialize some console parameters */ … … 115 148 ctx->clock = BSP_bus_frequency; 116 149 117 #ifdef HAS_UBOOT 118 #ifdef U_BOOT_GENERIC_BOARD_INFO 119 ctx->initial_baud = 115200; 120 #else 121 ctx->initial_baud = bsp_uboot_board_info.bi_baudrate; 122 #endif 150 #if defined(HAS_UBOOT) && !defined(U_BOOT_GENERIC_BOARD_INFO) 151 ctx->initial_baud = bsp_uboot_board_info.bi_baudrate; 152 #else 153 ctx->initial_baud = 115200; 123 154 #endif 124 155 } -
c/src/lib/libbsp/shared/include/fatal.h
rc03c71b re29f1f5 115 115 116 116 /* QorIQ fatal codes */ 117 QORIQ_FATAL_SMP_IPI_HANDLER_INSTALL = BSP_FATAL_CODE_BLOCK(10) 117 QORIQ_FATAL_SMP_IPI_HANDLER_INSTALL = BSP_FATAL_CODE_BLOCK(10), 118 QORIQ_FATAL_FDT_NO_BUS_FREQUENCY, 119 QORIQ_FATAL_FDT_NO_CLOCK_FREQUENCY, 120 QORIQ_FATAL_FDT_NO_TIMEBASE_FREQUENCY 118 121 } bsp_fatal_code; 119 122
Note: See TracChangeset
for help on using the changeset viewer.