Changeset 949 for trunk/softs
- Timestamp:
- Feb 18, 2015, 4:18:43 PM (10 years ago)
- Location:
- trunk/softs/tsar_boot
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/softs/tsar_boot/include/defs.h
r804 r949 13 13 # define RESET_HARD_CC 0 14 14 #endif 15 16 /** 17 * Supported OS 18 */ 19 #define OS_LINUX 0 15 20 16 21 /** -
trunk/softs/tsar_boot/preloader.ld.in
r930 r949 25 25 { 26 26 *(.reset) 27 *(.rodata) 28 *(.rodata.*) 27 *(.text) 29 28 . = ALIGN(0x4); 30 dtb_ addr= .;29 dtb_start = .; 31 30 #if USE_DT == 1 32 31 INCLUDE "build/platform.ld"; 33 32 #endif 33 dtb_end = .; 34 *(.rodata) 35 *(.rodata.*) 34 36 } 35 37 -
trunk/softs/tsar_boot/src/reset.S
r833 r949 36 36 .section .reset,"ax",@progbits 37 37 38 .extern dtb_addr39 38 .extern reset_putc 40 39 .extern reset_getc … … 47 46 .extern reset_ioc_init 48 47 .extern versionstr 48 .extern dtb_start 49 .extern dtb_addr 49 50 50 51 .globl reset /* Makes reset an external symbol */ … … 62 63 preloader_vector: 63 64 .word RESET_VERSION /* 0xbfc0008 */ 64 .word dtb_ addr/* 0xbfc000c */65 .word dtb_start /* 0xbfc000c */ 65 66 .word reset_putc /* 0xbfc0010 */ 66 67 .word reset_getc /* 0xbfc0014 */ … … 167 168 168 169 la a0, preloader_vector 169 move a1, zero170 lw a1, dtb_addr 170 171 move a2, zero 171 172 move a3, zero -
trunk/softs/tsar_boot/src/reset_elf_loader.c
r930 r949 17 17 18 18 extern int blk_buf_idx; 19 extern int dtb_start, dtb_end; 20 21 addr_t dtb_addr; 19 22 20 23 /////////////////////////////////////////////////////////////////////////////// … … 56 59 */ 57 60 int pseg; 58 for (pseg = 0; pseg < elf_header.e_phnum; pseg++) 59 { 61 for (pseg = 0; pseg < elf_header.e_phnum; pseg++) { 60 62 if(elf_pht[pseg].p_type != PT_LOAD) continue; 61 63 … … 91 93 } 92 94 95 if (pseg == 0) { 96 reset_puts("\n[RESET ERROR] No loadable segments"); 97 goto error; 98 } 99 100 /* By default, the used device tree is the one in the ROM */ 101 dtb_addr = (addr_t)&dtb_start; 102 103 #if OS_LINUX 104 /* When loading a Linux kernel, the device tree should be located in low 105 * memory addresses before the kernel itself. 106 * - When the ROM-contained DTB is located before the kernel no need to copy 107 * the DTB elsewhere. 108 * - When the ROM-contained DTB is located after the kernel the DTB is 109 * copied before the kernel. */ 110 const int copy_dtb = ((addr_t)&dtb_start > elf_pht[0].p_paddr); 111 if (copy_dtb) { 112 size_t dtb_size = (size_t)&dtb_end - (size_t)&dtb_start; 113 dtb_addr = SEG_RAM_BASE; 114 if ((dtb_addr + (addr_t)dtb_size) >= elf_pht[0].p_paddr) { 115 reset_puts("\n[RESET ERROR] Insufficient space to copy the DTB"); 116 goto error; 117 } 118 119 memcpy((void*)dtb_addr, (void*)&dtb_start, dtb_size); 120 reset_puts("\n[RESET] Device tree blob copied / address = "); 121 reset_putx(dtb_addr); 122 reset_puts(" / size = "); 123 reset_putx(dtb_size); 124 } 125 #endif 126 93 127 reset_puts("\n[RESET] Complete reset_elf_loader at cycle "); 94 reset_putd( proctime());128 reset_putd(proctime()); 95 129 reset_puts(" / boot entry = "); 96 reset_putx( (addr_t)(elf_header.e_entry));130 reset_putx((addr_t)elf_header.e_entry); 97 131 reset_puts("\n"); 98 132 99 return ((void *)elf_header.e_entry);133 return ((void*)elf_header.e_entry); 100 134 101 135 error:
Note: See TracChangeset
for help on using the changeset viewer.