Changeset 63a045c in mainline for boot/arch/arm32/src/main.c
- Timestamp:
- 2018-10-10T17:41:44Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9286475
- Parents:
- 63c1dd5
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-10-10 17:11:15)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-10-10 17:41:44)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/arm32/src/main.c
r63c1dd5 r63a045c 49 49 #include <inflate.h> 50 50 #include <arch/cp15.h> 51 #include "../../components.h"51 #include <payload.h> 52 52 53 #define TOP2ADDR(top) (((void *) PA2KA(BOOT_OFFSET)) + (top)) 54 55 extern void *bdata_start; 56 extern void *bdata_end; 57 58 static inline void clean_dcache_poc(void *address, size_t size) 53 static void clean_dcache_poc(void *address, size_t size) 59 54 { 60 55 const uintptr_t addr = (uintptr_t) address; … … 91 86 version_print(); 92 87 93 printf("Boot data: %p -> %p\n", &bdata_start, &bdata_end);88 printf("Boot loader: %p -> %p\n", loader_start, loader_end); 94 89 printf("\nMemory statistics\n"); 95 90 printf(" %p|%p: bootstrap stack\n", &boot_stack, &boot_stack); … … 99 94 (void *) PA2KA(BOOT_OFFSET), (void *) BOOT_OFFSET); 100 95 101 for (size_t i = 0; i < COMPONENTS; i++) { 102 printf(" %p|%p: %s image (%u/%u bytes)\n", components[i].addr, 103 components[i].addr, components[i].name, components[i].inflated, 104 components[i].size); 105 } 96 // FIXME: Use the correct value. 97 uint8_t *kernel_dest = (uint8_t *) BOOT_OFFSET; 98 uint8_t *ram_end = kernel_dest + (1 << 24); 106 99 107 void *dest[COMPONENTS]; 108 size_t top = 0; 109 size_t cnt = 0; 110 bootinfo.cnt = 0; 111 for (size_t i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) { 112 top = ALIGN_UP(top, PAGE_SIZE); 113 114 if (i > 0) { 115 bootinfo.tasks[bootinfo.cnt].addr = TOP2ADDR(top); 116 bootinfo.tasks[bootinfo.cnt].size = components[i].inflated; 117 118 str_cpy(bootinfo.tasks[bootinfo.cnt].name, 119 BOOTINFO_TASK_NAME_BUFLEN, components[i].name); 120 121 bootinfo.cnt++; 122 } 123 124 dest[i] = TOP2ADDR(top); 125 top += components[i].inflated; 126 cnt++; 127 } 128 129 printf("\nInflating components ... "); 130 131 for (size_t i = cnt; i > 0; i--) { 132 void *tail = components[i - 1].addr + components[i - 1].size; 133 if (tail >= dest[i - 1]) { 134 printf("\n%s: Image too large to fit (%p >= %p), halting.\n", 135 components[i].name, tail, dest[i - 1]); 136 halt(); 137 } 138 139 printf("%s ", components[i - 1].name); 140 141 int err = inflate(components[i - 1].addr, components[i - 1].size, 142 dest[i - 1], components[i - 1].inflated); 143 if (err != EOK) { 144 printf("\n%s: Inflating error %d\n", components[i - 1].name, err); 145 halt(); 146 } 147 /* Make sure data are in the memory, ICache will need them */ 148 clean_dcache_poc(dest[i - 1], components[i - 1].inflated); 149 } 150 151 printf(".\n"); 100 extract_payload(&bootinfo.taskmap, kernel_dest, ram_end, 101 PA2KA(kernel_dest), clean_dcache_poc); 152 102 153 103 /* Flush PT too. We need this if we disable caches later */
Note:
See TracChangeset
for help on using the changeset viewer.