Changeset 63a045c in mainline for boot/arch/sparc64/src/main.c
- Timestamp:
- 2018-10-10T17:41:44Z (6 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/sparc64/src/main.c
r63c1dd5 r63a045c 42 42 #include <str.h> 43 43 #include <errno.h> 44 #include <inflate.h> 45 #include "../../components.h" 44 #include <payload.h> 46 45 47 46 /* The lowest ID (read from the VER register) of some US3 CPU model */ … … 217 216 (void *) LOADER_ADDRESS, (void *) loader_address_pa); 218 217 219 size_t i; 220 for (i = 0; i < COMPONENTS; i++) 221 printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i].addr, 222 ofw_translate(components[i].addr), components[i].name, 223 components[i].inflated, components[i].size); 224 225 void *dest[COMPONENTS]; 226 size_t top = KERNEL_ADDRESS; 227 size_t cnt = 0; 228 bootinfo.taskmap.cnt = 0; 229 for (i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) { 230 top = ALIGN_UP(top, PAGE_SIZE); 231 232 if (i > 0) { 233 bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].addr = 234 (void *) top; 235 bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].size = 236 components[i].inflated; 237 238 str_cpy(bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].name, 239 BOOTINFO_TASK_NAME_BUFLEN, components[i].name); 240 241 bootinfo.taskmap.cnt++; 242 } 243 244 dest[i] = (void *) top; 245 top += components[i].inflated; 246 cnt++; 247 } 248 249 printf("\nInflating components ... "); 250 251 for (i = cnt; i > 0; i--) { 252 printf("%s ", components[i - 1].name); 253 254 /* 255 * At this point, we claim and map the physical memory that we 256 * are going to use. We should be safe in case of the virtual 257 * address space because the OpenFirmware, according to its 258 * SPARC binding, should restrict its use of virtual memory to 259 * addresses from [0xffd00000; 0xffefffff] and [0xfe000000; 260 * 0xfeffffff]. 261 */ 262 ofw_claim_phys(bootinfo.physmem_start + dest[i - 1], 263 ALIGN_UP(components[i - 1].inflated, PAGE_SIZE)); 264 265 ofw_map(bootinfo.physmem_start + dest[i - 1], dest[i - 1], 266 ALIGN_UP(components[i - 1].inflated, PAGE_SIZE), -1); 267 268 int err = inflate(components[i - 1].addr, components[i - 1].size, 269 dest[i - 1], components[i - 1].inflated); 270 271 if (err != EOK) { 272 printf("\n%s: Inflating error %d, halting.\n", 273 components[i - 1].name, err); 274 halt(); 275 } 276 } 277 278 printf(".\n"); 218 /* 219 * At this point, we claim and map the physical memory that we 220 * are going to use. We should be safe in case of the virtual 221 * address space because the OpenFirmware, according to its 222 * SPARC binding, should restrict its use of virtual memory to 223 * addresses from [0xffd00000; 0xffefffff] and [0xfe000000; 224 * 0xfeffffff]. 225 */ 226 227 size_t sz = ALIGN_UP(payload_uncompressed_size(), PAGE_SIZE); 228 ofw_claim_phys((void *) (bootinfo.physmem_start + KERNEL_ADDRESS), sz); 229 ofw_map((void *) (bootinfo.physmem_start + KERNEL_ADDRESS), 230 (void *) KERNEL_ADDRESS, sz, -1); 231 232 /* Extract components. */ 233 234 // TODO: Cache-coherence callback? 235 extract_payload(&bootinfo.taskmap, (void *) KERNEL_ADDRESS, 236 (void *) KERNEL_ADDRESS + sz, KERNEL_ADDRESS, NULL); 279 237 280 238 /* … … 283 241 */ 284 242 printf("Setting up boot allocator ...\n"); 285 void *balloc_base = (void *) ALIGN_UP(top, PAGE_SIZE);243 void *balloc_base = (void *) KERNEL_ADDRESS + sz; 286 244 ofw_claim_phys(bootinfo.physmem_start + balloc_base, BALLOC_MAX_SIZE); 287 245 ofw_map(bootinfo.physmem_start + balloc_base, balloc_base,
Note:
See TracChangeset
for help on using the changeset viewer.