Changeset 572
- Timestamp:
- Oct 5, 2018, 12:20:34 AM (6 years ago)
- Location:
- trunk/boot/tsar_mips32
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/boot/tsar_mips32/Makefile
r557 r572 23 23 # Objects to be linked for boot.elf generation 24 24 BOOT_OBJS = build/boot.o \ 25 build/boot_fat32.o \ 26 build/boot_utils.o \ 27 build/boot_spi_utils.o \ 28 build/boot_entry.o \ 29 build/boot_tty_driver.o \ 30 build/boot_hba_driver.o \ 31 build/boot_bdv_driver.o \ 32 build/boot_spi_driver.o \ 33 build/boot_mmc_driver.o 25 build/boot_fat32.o \ 26 build/boot_utils.o \ 27 build/boot_entry.o \ 28 build/boot_tty_driver.o \ 29 build/boot_hba_driver.o \ 30 build/boot_bdv_driver.o \ 31 build/boot_mmc_driver.o 34 32 35 33 # List of directories to be searched for included files 36 34 # when compiling for boot.elf generation 37 BOOT_INCLUDE = -I. \38 -I../../tools/arch_info /\39 -I$(HAL_ARCH)/core \40 -I../.. \41 -I$(KERNEL) \35 BOOT_INCLUDE = -I. \ 36 -I../../tools/arch_info \ 37 -I$(HAL_ARCH)/core \ 38 -I../.. \ 39 -I$(KERNEL) \ 42 40 -I$(KERNEL)/kern 43 41 … … 58 56 ################################################ 59 57 # Rules to compile boot drivers used by boot.elf 60 build/boot_tty_driver.o: boot_tty_driver.c\61 boot_tty_driver.h\62 boot_utils.h\63 boot_config.h\64 $(HAL_ARCH)/core/hal_kernel_types.h\65 58 build/boot_tty_driver.o: boot_tty_driver.c \ 59 boot_tty_driver.h \ 60 boot_utils.h \ 61 boot_config.h \ 62 $(HAL_ARCH)/core/hal_kernel_types.h \ 63 ../../hard_config.h 66 64 $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< 67 65 $(DU) -D $@ > $@.txt -
trunk/boot/tsar_mips32/boot.c
r562 r572 2 2 * boot.c - TSAR bootloader implementation. 3 3 * 4 * Authors : Alain Greiner / Vu Son (2016) 4 * Authors : Vu Son (2016) 5 * Alain Greiner (2016, 2017,2018) 5 6 * 6 7 * Copyright (c) UPMC Sorbonne Universites … … 55 56 * - activate all other cores in the same cluster (CPi). * 56 57 * - wait local CPi completion reports on a local barrier. * 57 * - report completion to bscpu on the global barrier.*58 * - report completion on the global barrier. * 58 59 * * 59 60 * 3) The boot-loader third phase is executed in parallel by all cores. * 60 * After passing the global barrier the bscpu:*61 * - activates the CPi of cluster(0),*61 * In each cluster (i) the CP0 * 62 * - activates the other cores of cluster(i), * 62 63 * - blocks on the local barrier waiting for all local CPi to report * 63 64 * completion on the local barrier, * … … 65 66 * address 0x0, (erasing the preloader code). * 66 67 * * 67 * 4) All cores have finished the boot phase, they jump to the kern_init() * 68 * function (maybe not at the same time). * 68 * 4) All cores jump to kern_init() (maybe not at the same time). * 69 69 ****************************************************************************/ 70 70 … … 77 77 #include <arch_info.h> 78 78 #include <boot_info.h> 79 80 #include <cluster_info.h>81 79 82 80 #include <boot_utils.h> … … 84 82 #include <boot_bdv_driver.h> 85 83 #include <boot_hba_driver.h> 86 #include <boot_spi_driver.h>87 84 #include <boot_tty_driver.h> 88 85 … … 117 114 uint32_t kernel_entry; // kernel entry point 118 115 119 // address used by the WTI to activate remote CP0s 120 121 // Functions called by boot_entry.S must be externs. 116 // Functions called by boot_entry.S 117 122 118 extern void boot_entry( void ); // boot_loader entry point 123 119 extern void boot_loader( lid_t lid, cxy_t cxy ); 124 120 121 122 #if DEBUG_BOOT_INFO 125 123 /********************************************************************************* 126 * This function returns the printable string for each device type124 * This debug function returns the printable string for each device type. 127 125 ********************************************************************************/ 128 static const char * device_type_str( boot_device_types_t dev_type ) { 129 switch (dev_type) { 126 static char * device_type_str( enum device_types_e dev_type ) 127 { 128 switch ( dev_type ) 129 { 130 130 case DEV_TYPE_RAM_SCL: return "RAM_SCL"; 131 131 case DEV_TYPE_ROM_SCL: return "ROM_SCL"; … … 148 148 } 149 149 } 150 #endif 150 151 151 152 /************************************************************************************ … … 160 161 { 161 162 boot_printf("\n[BOOT ERROR]: boot_archinfo_load(): " 162 163 163 "<%s> file not found\n", 164 ARCHINFO_PATHNAME); 164 165 boot_exit(); 165 166 } … … 168 169 { 169 170 boot_printf("\n[BOOT_ERROR]: boot_archinfo_load(): " 170 171 171 "<%s> file signature should be %x\n", 172 ARCHINFO_PATHNAME, ARCHINFO_SIGNATURE); 172 173 boot_exit(); 173 174 } … … 175 176 #if DEBUG_BOOT_INFO 176 177 boot_printf("\n[BOOT INFO] in %s : file %s loaded at address = %x\n", 177 178 __FUNCTION__ , ARCHINFO_PATHNAME , ARCHINFO_BASE ); 178 179 #endif 179 180 … … 204 205 #if DEBUG_BOOT_ELF 205 206 boot_printf("\n[BOOT INFO] %s enters for file %s at cycle %d\n", 206 207 __FUNCTION__ , KERNEL_PATHNAME , boot_get_proctime() ); 207 208 #endif 208 209 … … 261 262 #if DEBUG_BOOT_ELF 262 263 boot_printf("\n[BOOT INFO] in %s for file %s : found loadable segment\n" 263 264 264 " base = %x / size = %x\n", 265 __FUNCTION__ , KERNEL_PATHNAME , seg_paddr , seg_memsz ); 265 266 #endif 266 267 … … 282 283 { 283 284 boot_printf("\n[BOOT_ERROR] in %s for file %s :\n" 284 285 285 " two kcode segments found\n", 286 __FUNCTION__ , KERNEL_PATHNAME ); 286 287 boot_exit(); 287 288 } … … 296 297 { 297 298 boot_printf("\n[BOOT_ERROR] in %s for file %s :\n" 298 299 299 " two kentry segments found\n", 300 __FUNCTION__ , KERNEL_PATHNAME ); 300 301 boot_exit(); 301 302 } … … 310 311 { 311 312 boot_printf("\n[BOOT_ERROR] in %s for file %s :\n" 312 " two loadablekdata segments found\n",313 313 " two kdata segments found\n", 314 __FUNCTION__ , KERNEL_PATHNAME ); 314 315 boot_exit(); 315 316 } … … 326 327 { 327 328 boot_printf("\n[BOOT_ERROR] in %s for file %s : seg_kcode not found\n", 328 329 __FUNCTION__ , KERNEL_PATHNAME ); 329 330 boot_exit(); 330 331 } … … 332 333 { 333 334 boot_printf("\n[BOOT_ERROR] in %s for file %s : seg_kentry not found\n", 334 335 __FUNCTION__ , KERNEL_PATHNAME ); 335 336 boot_exit(); 336 337 } … … 338 339 { 339 340 boot_printf("\n[BOOT_ERROR] in %s for file %s : seg_kdata not found\n", 340 341 __FUNCTION__ , KERNEL_PATHNAME ); 341 342 boot_exit(); 342 343 } … … 346 347 { 347 348 boot_printf("\n[BOOT_ERROR] in %s for file %s : seg_kentry too large\n", 348 349 __FUNCTION__ , KERNEL_PATHNAME ); 349 350 boot_exit(); 350 351 } … … 353 354 { 354 355 boot_printf("\n[BOOT_ERROR] in %s for file %s : seg_kcode + seg_kdata too large\n", 355 356 __FUNCTION__ , KERNEL_PATHNAME ); 356 357 } 357 358 … … 361 362 #if DEBUG_BOOT_ELF 362 363 boot_printf("\n[BOOT INFO] %s completed for file %s at cycle %d\n", 363 364 __FUNCTION__ , KERNEL_PATHNAME , boot_get_proctime() ); 364 365 #endif 365 366 … … 382 383 archinfo_cluster_t * cluster; 383 384 archinfo_cluster_t * my_cluster = NULL; // target cluster 384 archinfo_cluster_t * io_cluster = NULL; // cluster containing ext. peripherals385 archinfo_cluster_t * io_cluster = NULL; // external peripherals cluster 385 386 386 387 archinfo_core_t * core; … … 416 417 boot_info->kentry_size = seg_kentry_size; 417 418 418 /* Initialize all clusters as empty for now */ 419 int x, y; 420 for ( x = 0; x < CONFIG_MAX_CLUSTERS_X; x++) 421 { 422 for ( x = 0; x < CONFIG_MAX_CLUSTERS_X; x++) 423 { 424 boot_info->cluster_info[x][y] = 0x0; 425 } 426 } 427 428 // loop on arch_info clusters to get relevant pointers 419 // loop on arch_info clusters to build cluster_info[][] array 420 // and get io_cluster and my_cluster pointers 429 421 for (cluster = cluster_base; 430 422 cluster < &cluster_base[header->x_size * header->y_size]; … … 433 425 int x = cluster->cxy >> Y_WIDTH; 434 426 int y = cluster->cxy & ((1 << Y_WIDTH) - 1); 435 436 if( cluster->cxy == cxy ) my_cluster = cluster; 437 if( cluster->cxy == header->io_cxy ) { 438 io_cluster = cluster; 439 boot_info->cluster_info[x][y] |= CINFO_IS_IO; 440 } 441 if ( cluster->cores > 0 ) { 442 boot_info->cluster_info[x][y] |= CINFO_ACTIVE; 443 } 427 boot_info->cluster_info[x][y] = (uint8_t)cluster->cores; 428 429 if( cluster->cxy == cxy ) my_cluster = cluster; 430 if( cluster->cxy == header->io_cxy ) io_cluster = cluster; 444 431 } 445 432 … … 447 434 { 448 435 boot_printf("\n[ERROR] in %s : cannot found cluster %x in arch_info\n", 449 436 __FUNCTION__ , cxy ); 450 437 boot_exit(); 451 438 } … … 454 441 { 455 442 boot_printf("\n[ERROR] in %s : cannot found io_cluster %x in arch_info\n", 456 __FUNCTION__ , header->io_cxy );443 __FUNCTION__ , cxy ); 457 444 boot_exit(); 458 445 } … … 463 450 #if DEBUG_BOOT_INFO 464 451 boot_printf("\n[BOOT INFO] %s : external peripherals at cycle %d\n", 465 452 __FUNCTION__ , boot_get_proctime() ); 466 453 #endif 467 454 … … 474 461 { 475 462 boot_printf("\n[ERROR] in %s : too much external devices in arch_info\n", 476 463 __FUNCTION__ ); 477 464 boot_exit(); 478 465 } … … 501 488 #if DEBUG_BOOT_INFO 502 489 boot_printf(" - %s : base = %l / size = %l / channels = %d / irqs = %d\n", 503 device_type_str( device->type ) , device->base , device->size , 504 device->channels , device->irqs ); 490 device_type_str(device->type), device->base, device->size, device->channels, device->irqs ); 505 491 #endif 506 492 } … … 525 511 #if DEBUG_BOOT_INFO 526 512 boot_printf(" . irq_port = %d / source = %s / channel = %d / is_rx = %d\n", 527 513 irq->port , device_type_str( irq->dev_type ) , irq->channel , irq->is_rx ); 528 514 #endif 529 515 } … … 554 540 #if DEBUG_BOOT_INFO 555 541 boot_printf(" - core_gid = %x : cxy = %x / lid = %d\n", 556 542 core->gid , core->cxy , core->lid ); 557 543 #endif 558 544 core_id++; … … 566 552 567 553 #if DEBUG_BOOT_INFO 568 boot_printf("\n[BOOT INFO] %s : internal peripherals in cluster %x\n", __FUNCTION__ , cxy ); 554 boot_printf("\n[BOOT INFO] %s : internal peripherals in cluster %x\n", 555 __FUNCTION__ , cxy ); 569 556 #endif 570 557 … … 615 602 #if DEBUG_BOOT_INFO 616 603 boot_printf(" - %s : base = %l / size = %l / channels = %d / irqs = %d\n", 617 618 604 device_type_str( device->type ) , device->base , device->size , 605 device->channels , device->irqs ); 619 606 #endif 620 607 … … 637 624 #if DEBUG_BOOT_INFO 638 625 boot_printf(" . irq_port = %d / source = %s / channel = %d / is_rx = %d\n", 639 626 irq->port , device_type_str( irq->dev_type ) , irq->channel , irq->is_rx ); 640 627 #endif 641 628 … … 656 643 (end >> CONFIG_PPM_PAGE_SHIFT) : (end >> CONFIG_PPM_PAGE_SHIFT) + 1; 657 644 658 // no reserved sones for TSAR architecture645 // no reserved zones for TSAR architecture 659 646 boot_info->rsvd_nr = 0; 660 647 … … 738 725 #if DEBUG_BOOT_WAKUP 739 726 boot_printf("\n[BOOT] core[%x,0] activated at cycle %d\n", 740 727 cluster->cxy , boot_get_proctime ); 741 728 #endif 742 729 … … 767 754 #if DEBUG_BOOT_WAKUP 768 755 boot_printf("\n[BOOT] core[%x,%d] activated at cycle %d\n", 769 756 boot_info->cxy , core_id , boot_get_proctime() ); 770 757 #endif 771 758 // send an IPI … … 801 788 else if (USE_IOC_HBA) boot_hba_init(); 802 789 // else if (USE_IOC_SDC) boot_sdc_init(); 803 else if (USE_IOC_SPI) boot_spi_init();790 // else if (USE_IOC_SPI) boot_spi_init(); 804 791 else if (!USE_IOC_RDK) 805 792 { … … 816 803 817 804 boot_printf("\n[BOOT] core[%x,%d] loaded kernel at cycle %d\n", 818 805 cxy , lid , boot_get_proctime() ); 819 806 820 807 // Load the arch_info.bin file into memory. 821 808 boot_archinfo_load(); 809 810 boot_printf("\n[BOOT] core[%x,%d] loaded arch_info at cycle %d\n", 811 cxy , lid , boot_get_proctime() ); 822 812 823 813 // Get local boot_info_t structure base address. … … 827 817 // Initialize local boot_info_t structure. 828 818 boot_info_init( boot_info , cxy ); 819 820 boot_printf("\n[BOOT] core[%x,%d] initialised boot_info at cycle %d\n", 821 cxy , lid , boot_get_proctime() ); 829 822 830 823 // check boot_info signature … … 832 825 { 833 826 boot_printf("\n[BOOT ERROR] in %s reported by core[%x,%d]\n" 834 835 827 " illegal boot_info signature / should be %x\n", 828 __FUNCTION__ , cxy , lid , BOOT_INFO_SIGNATURE ); 836 829 boot_exit(); 837 830 } 838 839 boot_printf("\n[BOOT] core[%x,%d] loaded arch_info at cycle %d\n",840 cxy , lid , boot_get_proctime() );841 831 842 832 // Check core information. … … 881 871 // from now, it is safe to refer to the boot code global variables 882 872 boot_printf("\n[BOOT] core[%x,%d] replicated boot code at cycle %d\n", 883 873 cxy , lid , boot_get_proctime() ); 884 874 885 875 // switch to the INSTRUCTION local memory space, to avoid contention. … … 892 882 893 883 boot_printf("\n[BOOT] core[%x,%d] replicated arch_info at cycle %d\n", 894 884 cxy , lid , boot_get_proctime() ); 895 885 896 886 // Copy the kcode segment into local memory … … 910 900 911 901 boot_printf("\n[BOOT] core[%x,%d] replicated kernel code at cycle %d\n", 912 902 cxy , lid , boot_get_proctime() ); 913 903 914 904 // Get local boot_info_t structure base address. … … 917 907 // Initialize local boot_info_t structure. 918 908 boot_info_init( boot_info , cxy ); 909 910 boot_printf("\n[BOOT] core[%x,%d] initialised boot_info at cycle %d\n", 911 cxy , lid , boot_get_proctime() ); 919 912 920 913 // Check core information. -
trunk/boot/tsar_mips32/boot.ld
r544 r572 6 6 /* define the boot code base address */ 7 7 8 boot_code_base = 0x 900000;8 boot_code_base = 0x100000; 9 9 10 10 /* Set the entry point of the boot-loader (e_entry field in the "boot.elf" file header) */ -
trunk/boot/tsar_mips32/boot_config.h
r549 r572 21 21 // Preloader temporary segment 22 22 #define PRELOADER_BASE 0x00000000 // 'preloader' physical base address 23 #define PRELOADER_MAX_SIZE 0x00 804000 // 'preloader' max size23 #define PRELOADER_MAX_SIZE 0x00004000 // 'preloader' max size 24 24 25 25 // kentry segment 26 #define KENTRY_BASE 0x00 804000 // 'kentry' segment physical base address26 #define KENTRY_BASE 0x00004000 // 'kentry' segment physical base address 27 27 #define KENTRY_MAX_SIZE 0x00004000 // 'kentry' segment max size 28 28 29 29 // kcode segment 30 #define KCODE_BASE 0x00 808000 // 'kcode' segment physical base address30 #define KCODE_BASE 0x00008000 // 'kcode' segment physical base address 31 31 #define KCODE_MAX_SIZE 0x000F8000 // 'kcode' + 'kdata' segments max size 32 32 33 33 // boot.elf file temporary buffer 34 #define BOOT_BASE 0x00 900000 // 'boot.elf' file physical base address34 #define BOOT_BASE 0x00100000 // 'boot.elf' file physical base address 35 35 #define BOOT_MAX_SIZE 0x00010000 // 'boot.elf' file max size 36 36 37 37 // arch_info file temporary buffer 38 #define ARCHINFO_BASE 0x00 A00000 // 'arch_info.bin' file physical base address38 #define ARCHINFO_BASE 0x00200000 // 'arch_info.bin' file physical base address 39 39 #define ARCHINFO_MAX_SIZE 0x00010000 // 'arch_info.bin' file max size 40 40 41 41 // kernel.elf file temporary buffer 42 #define KERN_BASE 0x00 B00000 // 'kernel.elf' file base address42 #define KERN_BASE 0x00300000 // 'kernel.elf' file base address 43 43 #define KERN_MAX_SIZE 0x00200000 // 'kernel.elf' file max size 44 44 45 45 // Temporary stacks segments 46 #define BOOT_STACK_BASE 0x00 D04000 // Boot stack base address46 #define BOOT_STACK_BASE 0x00504000 // Boot stack base address 47 47 #define BOOT_STACK_SIZE 0x00004000 // Boot stack size (16Kb) 48 48 -
trunk/boot/tsar_mips32/boot_fat32.c
r547 r572 6 6 #include <boot_tty_driver.h> 7 7 #include <boot_bdv_driver.h> 8 #include <boot_spi_driver.h>9 8 #include <boot_hba_driver.h> 10 9 #include <boot_mmc_driver.h> 11 10 12 11 /* 12 #include <boot_spi_driver.h> 13 13 #include <boot_sdc_driver.h> 14 14 #include <boot_rdk_driver.h> … … 37 37 38 38 /**************************************************************************** 39 * Internal functions. * 40 ****************************************************************************/ 41 42 /**************************************************************************** 43 * This function returns the offset (in bytes) of the field defined by * 44 * 'offset' and 'size'. * 45 * @ offset : offset of the field from the beginning of the sector (in * 46 * bytes). * 47 * @ size : length of the field (in bytes). * 48 * * 49 * @ returns the field offset. * 50 ****************************************************************************/ 51 static inline 52 int get_offset( 53 int offset, 54 int size __attribute__ ((unused))) 55 { 56 return offset; 57 } // get_offset() 58 59 /**************************************************************************** 60 * This function returns the length (in bytes) of the field defined by * 61 * 'offset' and 'size'. * 62 * @ offset : offset of the field from the beginning of the sector (in * 63 * bytes). * 64 * @ size : length of the field (in bytes). * 65 * * 66 * @ returns the field length. * 67 ****************************************************************************/ 68 static inline 69 int get_size( 70 int offset __attribute__ ((unused)), 71 int size) 72 { 73 return size; 74 } // get_size() 39 * Internal functions & macros. * 40 ****************************************************************************/ 41 42 /**************************************************************************** 43 * These functions return the first or second argument from a couple * 44 * of arguments ( offset , size ) used to define a data field * 45 * in a buffer of bytes: offset is the first byte index in buffer, * 46 * size is the field length in bytes. * 47 ****************************************************************************/ 48 49 static inline int get_offset( int offset, int size __attribute__((unused)) ) { return offset; } 50 51 static inline int get_size( int offset __attribute__((unused)) , int size ) { return size; } 75 52 76 53 /**************************************************************************** -
trunk/boot/tsar_mips32/boot_tty_driver.c
r556 r572 43 43 #endif 44 44 45 #ifndef TXT_TGT_CLUSTER46 # error "The TXT_TGT_CLUSTER value should be defined in the 'hard_config.h' file"47 #endif48 49 45 ///////////////////////////////////////////////////////////////////////////// 50 46 // This function returns the value contained in a TTY0 register. … … 54 50 static uint32_t boot_tty_get_register( uint32_t reg ) 55 51 { 56 cxy_t cxy = TXT_TGT_CLUSTER;52 cxy_t cxy = (X_IO << Y_WIDTH) + Y_IO; 57 53 uint32_t * ptr = (uint32_t *)SEG_TXT_BASE + reg; 58 54 … … 69 65 uint32_t val ) 70 66 { 71 cxy_t cxy = TXT_TGT_CLUSTER;67 cxy_t cxy = (X_IO << Y_WIDTH) + Y_IO; 72 68 uint32_t * ptr = (uint32_t *)SEG_TXT_BASE + reg; 73 69 … … 76 72 } // boot_tty_set_register() 77 73 78 ////////////////////////////////// 74 ///////////////////////////////////// 79 75 int boot_tty_write( const char * buf, 80 76 uint32_t nbytes )
Note: See TracChangeset
for help on using the changeset viewer.