Changes in boot/arch/riscv64/src/main.c [ae8d7b0:c09ff7b] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/riscv64/src/main.c
rae8d7b0 rc09ff7b 30 30 #include <arch/arch.h> 31 31 #include <arch/asm.h> 32 #include <arch/ucb.h>33 #include <arch/mm.h>34 32 #include <version.h> 35 33 #include <stddef.h> … … 43 41 #include "../../components.h" 44 42 43 #define KA2PA(x) (((uintptr_t) (x)) - UINT64_C(0xffff800000000000)) 44 #define PA2KA(x) (((uintptr_t) (x)) + UINT64_C(0xffff800000000000)) 45 45 46 static bootinfo_t bootinfo; 46 47 … … 49 50 version_print(); 50 51 51 bootinfo.htif_frame = ((uintptr_t) &htif_page) >> PAGE_WIDTH; 52 bootinfo.pt_frame = ((uintptr_t) &pt_page) >> PAGE_WIDTH; 52 // FIXME TODO: read from device tree 53 bootinfo.memmap.total = 1024 * 1024 * 1024; 54 bootinfo.memmap.cnt = 0; 53 55 54 bootinfo.ucbinfo.tohost = 55 (volatile uint64_t *) PA2KA((uintptr_t) &tohost); 56 bootinfo.ucbinfo.fromhost = 57 (volatile uint64_t *) PA2KA((uintptr_t) &fromhost); 58 59 // FIXME TODO: read from device tree 60 bootinfo.physmem_start = PHYSMEM_START; 61 bootinfo.memmap.total = PHYSMEM_SIZE; 62 bootinfo.memmap.cnt = 1; 63 bootinfo.memmap.zones[0].start = (void *) PHYSMEM_START; 64 bootinfo.memmap.zones[0].size = PHYSMEM_SIZE; 65 66 printf("\nMemory statistics (total %lu MB, starting at %p)\n\n", 67 bootinfo.memmap.total >> 20, (void *) bootinfo.physmem_start); 56 printf("\nMemory statistics (total %lu MB)\n\n", bootinfo.memmap.total >> 20); 68 57 printf(" %p: boot info structure\n", &bootinfo); 69 58 70 uintptr_t top = BOOT_OFFSET;59 uintptr_t top = 0; 71 60 72 61 for (size_t i = 0; i < COMPONENTS; i++) { … … 77 66 uintptr_t tail = (uintptr_t) components[i].addr + 78 67 components[i].size; 79 if (tail > top) { 80 printf("\n%s: Image too large to fit (%p >= %p), halting.\n", 81 components[i].name, (void *) tail, (void *) top); 82 halt(); 83 } 68 if (tail > top) 69 top = tail; 84 70 } 85 71 72 top = ALIGN_UP(top, PAGE_SIZE); 86 73 printf(" %p: inflate area\n", (void *) top); 87 74 … … 105 92 bootinfo.taskmap.cnt++; 106 93 } else 107 kernel_entry = (void *) PA2KA(top);94 kernel_entry = (void *) top; 108 95 109 96 dest[i] = (void *) top; … … 114 101 printf(" %p: kernel entry point\n", kernel_entry); 115 102 116 if (top >= bootinfo. physmem_start + bootinfo.memmap.total) {103 if (top >= bootinfo.memmap.total) { 117 104 printf("Not enough physical memory available.\n"); 118 105 printf("The boot image is too large. Halting.\n"); … … 138 125 139 126 printf("Booting the kernel...\n"); 140 jump_to_kernel( PA2KA(&bootinfo));127 jump_to_kernel(kernel_entry, PA2KA(&bootinfo)); 141 128 }
Note:
See TracChangeset
for help on using the changeset viewer.