Changeset 61e90dd in mainline
- Timestamp:
- 2006-09-19T22:42:57Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 16529d5
- Parents:
- 3abe07f5
- Files:
-
- 4 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/sparc64/loader/Makefile
r3abe07f5 r61e90dd 53 53 ../../../generic/printf.c \ 54 54 ../../../generic/string.c \ 55 ../../../genarch/balloc.c \ 55 56 ../../../genarch/ofw.c \ 56 57 ../../../genarch/ofw_tree.c \ -
boot/arch/sparc64/loader/main.c
r3abe07f5 r61e90dd 31 31 #include "asm.h" 32 32 #include "_components.h" 33 #include <balloc.h> 33 34 #include <ofw.h> 35 #include <ofw_tree.h> 34 36 #include "ofwarch.h" 35 37 #include <align.h> … … 84 86 printf(" %P: %s image (size %d bytes)\n", components[i].start, components[i].name, components[i].size); 85 87 88 void * base = (void *) KERNEL_VIRTUAL_ADDRESS; 89 unsigned int top = 0; 90 86 91 printf("\nCopying components\n"); 87 unsigned int top = 0;88 92 bootinfo.taskmap.count = 0; 89 93 for (i = 0; i < COMPONENTS; i++) { 90 void * base = (void *) KERNEL_VIRTUAL_ADDRESS;91 92 94 printf(" %s...", components[i].name); 93 95 top = ALIGN_UP(top, PAGE_SIZE); … … 102 104 } 103 105 106 balloc_init(&bootinfo.ballocs, ALIGN_UP(((uintptr_t) base) + top, PAGE_SIZE)); 107 108 printf("\nCanonizing OpenFirmware device tree..."); 109 bootinfo.ofw_root = ofw_tree_build(); 110 printf("done.\n"); 111 104 112 printf("\nBooting the kernel...\n"); 105 113 jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS, &bootinfo, sizeof(bootinfo)); -
boot/arch/sparc64/loader/main.h
r3abe07f5 r61e90dd 31 31 32 32 #include <ofw.h> 33 #include <ofw_tree.h> 34 #include <balloc.h> 33 35 #include <types.h> 34 36 … … 55 57 keyboard_t keyboard; 56 58 cpu_t cpu; 59 ballocs_t ballocs; 60 ofw_tree_node_t *ofw_root; 57 61 } bootinfo_t; 58 62 -
boot/genarch/ofw_tree.c
r3abe07f5 r61e90dd 31 31 #include <types.h> 32 32 #include <string.h> 33 #include <balloc.h> 33 34 34 35 static ofw_tree_node_t *ofw_tree_node_alloc(void) 35 36 { 36 return NULL;37 return balloc(sizeof(ofw_tree_node_t), sizeof(ofw_tree_node_t)); 37 38 } 38 39 39 40 static ofw_tree_property_t *ofw_tree_properties_alloc(unsigned count) 40 41 { 41 return NULL;42 return balloc(count * sizeof(ofw_tree_property_t), sizeof(ofw_tree_property_t)); 42 43 } 43 44 44 45 static void * ofw_tree_space_alloc(size_t size) 45 46 { 46 return NULL;47 return balloc(size, size); 47 48 } 48 49 -
boot/genarch/ofw_tree.h
r3abe07f5 r61e90dd 38 38 typedef struct ofw_tree_property ofw_tree_property_t; 39 39 40 /** Memory representation of OpenFirmware device tree node. */ 40 41 struct ofw_tree_node { 41 42 ofw_tree_node_t *parent; … … 43 44 ofw_tree_node_t *child; 44 45 45 unsigned properties; 46 unsigned properties; /**< Number of properties. */ 46 47 ofw_tree_property_t *property; 47 48 }; 48 49 50 /** Memory representation of OpenFirmware device tree node property. */ 49 51 struct ofw_tree_property { 50 52 char name[OFW_TREE_PROPERTY_MAX_NAMELEN]; -
kernel/arch/sparc64/include/boot/boot.h
r3abe07f5 r61e90dd 36 36 #define KERN_sparc64_BOOT_H_ 37 37 38 39 38 #define VMA 0x400000 40 39 #define LMA VMA … … 43 42 #ifndef __LINKER__ 44 43 44 #include <config.h> 45 45 #include <arch/types.h> 46 46 #include <typedefs.h> 47 #include <genarch/ofw/ofw_tree.h> 47 48 48 49 #define TASKMAP_MAX_RECORDS 32 … … 87 88 } processor_t; 88 89 90 /** Bootinfo structure. 91 * 92 * Must be in sync with bootinfo structure used by the boot loader. 93 */ 89 94 typedef struct { 90 95 taskmap_t taskmap; … … 93 98 keyboard_t keyboard; 94 99 processor_t processor; 100 ballocs_t ballocs; 101 ofw_tree_node_t *ofw_root; 95 102 } bootinfo_t; 96 103 -
kernel/arch/sparc64/src/sparc64.c
r3abe07f5 r61e90dd 52 52 void arch_pre_main(void) 53 53 { 54 /* Setup usermode*/54 /* Copy init task info. */ 55 55 init.cnt = bootinfo.taskmap.count; 56 56 … … 61 61 init.tasks[i].size = bootinfo.taskmap.tasks[i].size; 62 62 } 63 64 /* Copy boot allocations info. */ 65 ballocs.base = bootinfo.ballocs.base; 66 ballocs.size = bootinfo.ballocs.size; 63 67 } 64 68 -
kernel/genarch/Makefile.inc
r3abe07f5 r61e90dd 88 88 genarch/src/kbd/scanc_sun.c 89 89 endif 90 91 92 ## OpenFirmware Device Tree 93 ifeq ($(CONFIG_OFW_TREE), y) 94 GENARCH_SOURCES += \ 95 genarch/src/ofw/ofw_tree,c 96 endif -
kernel/generic/include/config.h
r3abe07f5 r61e90dd 56 56 } init_t; 57 57 58 /** Boot allocations. 59 * 60 * Allocatations made by the boot that are meant to be used by the kernel 61 * are all recorded in the ballocs_t type. 62 */ 63 typedef struct { 64 uintptr_t base; 65 size_t size; 66 } ballocs_t; 67 58 68 typedef struct { 59 69 count_t cpu_count; /**< Number of processors detected. */ … … 70 80 extern config_t config; 71 81 extern init_t init; 82 extern ballocs_t ballocs; 72 83 73 84 #endif -
kernel/generic/src/main/main.c
r3abe07f5 r61e90dd 95 95 }; 96 96 97 /** Boot allocations. */ 98 ballocs_t ballocs = { 99 .base = NULL, 100 .size = 0 101 }; 102 97 103 context_t ctx; 98 104 … … 106 112 size_t hardcoded_kdata_size = 0; /**< Size of the kernel data in bytes. */ 107 113 108 uintptr_t stack_safe = 0; /**< Lowest safe stack virtual address */114 uintptr_t stack_safe = 0; /**< Lowest safe stack virtual address */ 109 115 110 116 void main_bsp(void); … … 152 158 if (PA_overlaps(config.stack_base, config.stack_size, init.tasks[i].addr, init.tasks[i].size)) 153 159 config.stack_base = ALIGN_UP(init.tasks[i].addr + init.tasks[i].size, config.stack_size); 160 } 161 162 /* Avoid placing stack on top of boot allocations. */ 163 if (ballocs.size) { 164 if (PA_overlaps(config.stack_base, config.stack_size, ballocs.base, ballocs.size)) 165 config.stack_base = ALIGN_UP(ballocs.base + ballocs.size, PAGE_SIZE); 154 166 } 155 167 -
kernel/generic/src/mm/frame.c
r3abe07f5 r61e90dd 1078 1078 frame_mark_unavailable(ADDR2PFN(KA2PA(init.tasks[i].addr)), SIZE2FRAMES(init.tasks[i].size)); 1079 1079 1080 if (ballocs.size) 1081 frame_mark_unavailable(ADDR2PFN(KA2PA(ballocs.base)), SIZE2FRAMES(ballocs.size)); 1082 1080 1083 /* Black list first frame, as allocating NULL would 1081 1084 * fail in some places */
Note:
See TracChangeset
for help on using the changeset viewer.