Changeset a35b458 in mainline for boot/arch/sparc64/src/main.c
- Timestamp:
- 2018-03-02T20:10:49Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f1380b7
- Parents:
- 3061bc1
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/sparc64/src/main.c
r3061bc1 ra35b458 86 86 phandle root = ofw_find_device("/"); 87 87 char compatible[OFW_TREE_PROPERTY_MAX_VALUELEN]; 88 88 89 89 if (ofw_get_property(root, "compatible", compatible, 90 90 OFW_TREE_PROPERTY_MAX_VALUELEN) <= 0) { … … 93 93 return; 94 94 } 95 95 96 96 if (str_cmp(compatible, "sun4v") != 0) { 97 97 /* … … 122 122 : [ver] "=r" (ver) 123 123 ); 124 124 125 125 ver = (ver << 16) >> 48; 126 126 127 127 if ((ver >= FIRST_US3_CPU) && (ver <= LAST_US3_CPU)) { 128 128 subarch = SUBARCH_US3; 129 129 130 130 if (ver == US_IIIi_CODE) 131 131 mid_mask = (1 << 5) - 1; 132 132 else 133 133 mid_mask = (1 << 10) - 1; 134 134 135 135 } else if (ver < FIRST_US3_CPU) { 136 136 subarch = SUBARCH_US; … … 193 193 { 194 194 version_print(); 195 195 196 196 arch_detect(); 197 197 if (arch == ARCH_SUN4U) … … 199 199 else 200 200 subarch = SUBARCH_UNKNOWN; 201 201 202 202 bootinfo.physmem_start = ofw_get_physmem_start(); 203 203 ofw_memmap(&bootinfo.memmap); … … 205 205 if (arch == ARCH_SUN4V) 206 206 sun4v_fixups(); 207 207 208 208 void *bootinfo_pa = ofw_translate(&bootinfo); 209 209 void *kernel_address_pa = ofw_translate((void *) KERNEL_ADDRESS); 210 210 void *loader_address_pa = ofw_translate((void *) LOADER_ADDRESS); 211 211 212 212 printf("\nMemory statistics (total %" PRIu64 " MB, starting at %p)\n", 213 213 bootinfo.memmap.total >> 20, (void *) bootinfo.physmem_start); … … 217 217 printf(" %p|%p: loader entry point\n", 218 218 (void *) LOADER_ADDRESS, (void *) loader_address_pa); 219 219 220 220 size_t i; 221 221 for (i = 0; i < COMPONENTS; i++) … … 223 223 ofw_translate(components[i].addr), components[i].name, 224 224 components[i].inflated, components[i].size); 225 225 226 226 void *dest[COMPONENTS]; 227 227 size_t top = KERNEL_ADDRESS; … … 230 230 for (i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) { 231 231 top = ALIGN_UP(top, PAGE_SIZE); 232 232 233 233 if (i > 0) { 234 234 bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].addr = … … 236 236 bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].size = 237 237 components[i].inflated; 238 238 239 239 str_cpy(bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].name, 240 240 BOOTINFO_TASK_NAME_BUFLEN, components[i].name); 241 241 242 242 bootinfo.taskmap.cnt++; 243 243 } 244 244 245 245 dest[i] = (void *) top; 246 246 top += components[i].inflated; 247 247 cnt++; 248 248 } 249 249 250 250 printf("\nInflating components ... "); 251 251 252 252 for (i = cnt; i > 0; i--) { 253 253 printf("%s ", components[i - 1].name); 254 254 255 255 /* 256 256 * At this point, we claim and map the physical memory that we … … 263 263 ofw_claim_phys(bootinfo.physmem_start + dest[i - 1], 264 264 ALIGN_UP(components[i - 1].inflated, PAGE_SIZE)); 265 265 266 266 ofw_map(bootinfo.physmem_start + dest[i - 1], dest[i - 1], 267 267 ALIGN_UP(components[i - 1].inflated, PAGE_SIZE), -1); 268 268 269 269 int err = inflate(components[i - 1].addr, components[i - 1].size, 270 270 dest[i - 1], components[i - 1].inflated); 271 271 272 272 if (err != EOK) { 273 273 printf("\n%s: Inflating error %d, halting.\n", … … 276 276 } 277 277 } 278 278 279 279 printf(".\n"); 280 280 281 281 /* 282 282 * Claim and map the physical memory for the boot allocator. … … 290 290 balloc_init(&bootinfo.ballocs, balloc_base, (uintptr_t) balloc_base, 291 291 BALLOC_MAX_SIZE); 292 292 293 293 printf("Setting up screens ...\n"); 294 294 ofw_setup_screens(); 295 295 296 296 printf("Canonizing OpenFirmware device tree ...\n"); 297 297 bootinfo.ofw_root = ofw_tree_build(); 298 298 299 299 if (arch == ARCH_SUN4U) 300 300 sun4u_smp(); 301 301 302 302 printf("Booting the kernel ...\n"); 303 303 jump_to_kernel(bootinfo.physmem_start | BSP_PROCESSOR, &bootinfo, subarch,
Note:
See TracChangeset
for help on using the changeset viewer.