Changeset 63a045c in mainline for boot/arch/ppc32/src/main.c
- Timestamp:
- 2018-10-10T17:41:44Z (5 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/ppc32/src/main.c
r63c1dd5 r63a045c 41 41 #include <str.h> 42 42 #include <errno.h> 43 #include <inflate.h> 44 #include "../../components.h" 43 #include <payload.h> 45 44 46 45 #define BALLOC_MAX_SIZE 131072 … … 74 73 (void *) LOADER_ADDRESS, loader_address_pa); 75 74 76 size_t i; 77 for (i = 0; i < COMPONENTS; i++) 78 printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i].addr, 79 ofw_translate(components[i].addr), components[i].name, 80 components[i].inflated, components[i].size); 75 size_t uncompressed_size = payload_uncompressed_size(); 76 printf("Payload uncompressed size: %d bytes\n", uncompressed_size); 81 77 82 size_t dest[COMPONENTS]; 83 size_t top = 0; 84 size_t cnt = 0; 85 bootinfo.taskmap.cnt = 0; 86 for (i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) { 87 top = ALIGN_UP(top, PAGE_SIZE); 88 89 if (i > 0) { 90 bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].addr = 91 (void *) PA2KA(top); 92 bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].size = 93 components[i].inflated; 94 95 str_cpy(bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].name, 96 BOOTINFO_TASK_NAME_BUFLEN, components[i].name); 97 98 bootinfo.taskmap.cnt++; 99 } 100 101 dest[i] = top; 102 top += components[i].inflated; 103 cnt++; 104 } 105 106 if (top >= (size_t) loader_address_pa) { 78 if (uncompressed_size >= (size_t) loader_address_pa) { 107 79 printf("Inflated components overlap loader area.\n"); 108 80 printf("The boot image is too large. Halting.\n"); … … 118 90 void *inflate_base; 119 91 void *inflate_base_pa; 120 ofw_alloc("inflate area", &inflate_base, &inflate_base_pa, top,121 loader_address_pa);92 ofw_alloc("inflate area", &inflate_base, &inflate_base_pa, 93 uncompressed_size, loader_address_pa); 122 94 printf(" %p|%p: inflate area\n", inflate_base, inflate_base_pa); 123 95 124 uintptr_t balloc_start = ALIGN_UP( top, PAGE_SIZE);96 uintptr_t balloc_start = ALIGN_UP(uncompressed_size, PAGE_SIZE); 125 97 size_t pages = (balloc_start + ALIGN_UP(BALLOC_MAX_SIZE, PAGE_SIZE)) >> 126 98 PAGE_WIDTH; … … 135 107 check_overlap("translate table", transtable_pa, pages); 136 108 137 printf("\nInflating components ... "); 138 139 for (i = cnt; i > 0; i--) { 140 printf("%s ", components[i - 1].name); 141 142 int err = inflate(components[i - 1].addr, components[i - 1].size, 143 inflate_base + dest[i - 1], components[i - 1].inflated); 144 145 if (err != EOK) { 146 printf("\n%s: Inflating error %d, halting.\n", 147 components[i - 1].name, err); 148 halt(); 149 } 150 } 151 152 printf(".\n"); 109 /* Inflate components. */ 110 extract_payload(&bootinfo.taskmap, inflate_base, 111 inflate_base + uncompressed_size, PA2KA(0), NULL); 153 112 154 113 printf("Setting up boot allocator ...\n"); … … 163 122 164 123 printf("Setting up translate table ...\n"); 165 for ( i = 0; i < pages; i++) {124 for (size_t i = 0; i < pages; i++) { 166 125 uintptr_t off = i << PAGE_WIDTH; 167 126 void *phys;
Note:
See TracChangeset
for help on using the changeset viewer.