- Timestamp:
- 2018-03-02T20:10:49Z (8 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)
- Location:
- boot/arch
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/arm32/src/asm.S
r3061bc1 ra35b458 67 67 #ifndef PROCESSOR_ARCH_armv7_a 68 68 mrc p15, 0, r4, c1, c0, 0 69 69 70 70 # Disable D-cache before the kernel is started. 71 71 bic r4, r4, #(1 << CP15_C1_DC) … … 76 76 bic r4, r4, #(1 << CP15_C1_BP) 77 77 #endif 78 78 79 79 mcr p15, 0, r4, c1, c0, 0 80 80 #endif 81 81 82 82 # Wait for the operations to complete 83 83 #ifdef PROCESSOR_ARCH_armv7_a … … 88 88 mcr p15, 0, r4, c7, c10, 4 89 89 #endif 90 90 91 91 # Clean ICache and BPredictors, r4 ignored (SBZ) 92 92 mov r4, #0 -
boot/arch/arm32/src/main.c
r3061bc1 ra35b458 89 89 mmu_start(); 90 90 version_print(); 91 91 92 92 printf("Boot data: %p -> %p\n", &bdata_start, &bdata_end); 93 93 printf("\nMemory statistics\n"); … … 97 97 printf(" %p|%p: kernel entry point\n", 98 98 (void *) PA2KA(BOOT_OFFSET), (void *) BOOT_OFFSET); 99 99 100 100 for (size_t i = 0; i < COMPONENTS; i++) { 101 101 printf(" %p|%p: %s image (%u/%u bytes)\n", components[i].addr, … … 103 103 components[i].size); 104 104 } 105 105 106 106 void *dest[COMPONENTS]; 107 107 size_t top = 0; … … 110 110 for (size_t i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) { 111 111 top = ALIGN_UP(top, PAGE_SIZE); 112 112 113 113 if (i > 0) { 114 114 bootinfo.tasks[bootinfo.cnt].addr = TOP2ADDR(top); 115 115 bootinfo.tasks[bootinfo.cnt].size = components[i].inflated; 116 116 117 117 str_cpy(bootinfo.tasks[bootinfo.cnt].name, 118 118 BOOTINFO_TASK_NAME_BUFLEN, components[i].name); 119 119 120 120 bootinfo.cnt++; 121 121 } 122 122 123 123 dest[i] = TOP2ADDR(top); 124 124 top += components[i].inflated; 125 125 cnt++; 126 126 } 127 127 128 128 printf("\nInflating components ... "); 129 129 130 130 for (size_t i = cnt; i > 0; i--) { 131 131 void *tail = components[i - 1].addr + components[i - 1].size; … … 135 135 halt(); 136 136 } 137 137 138 138 printf("%s ", components[i - 1].name); 139 139 140 140 int err = inflate(components[i - 1].addr, components[i - 1].size, 141 141 dest[i - 1], components[i - 1].inflated); … … 147 147 clean_dcache_poc(dest[i - 1], components[i - 1].inflated); 148 148 } 149 149 150 150 printf(".\n"); 151 151 152 152 /* Flush PT too. We need this if we disable caches later */ 153 153 clean_dcache_poc(boot_pt, PTL0_ENTRIES * PTL0_ENTRY_SIZE); 154 154 155 155 printf("Booting the kernel...\n"); 156 156 jump_to_kernel((void *) PA2KA(BOOT_OFFSET), &bootinfo); -
boot/arch/arm32/src/mm.c
r3061bc1 ra35b458 209 209 /* Current settings */ 210 210 "mrc p15, 0, r0, c1, c0, 0\n" 211 211 212 212 /* Enable ICache, DCache, BPredictors and MMU, 213 213 * we disable caches before jumping to kernel … … 221 221 "ldr r1, =0x00001805\n" 222 222 #endif 223 223 224 224 "orr r0, r0, r1\n" 225 225 … … 228 228 */ 229 229 "mcr p15, 0, r0, c8, c7, 0\n" 230 230 231 231 /* Store settings, enable the MMU */ 232 232 "mcr p15, 0, r0, c1, c0, 0\n" -
boot/arch/ia64/src/main.c
r3061bc1 ra35b458 67 67 memmap_item_t *memmap = bootinfo.memmap; 68 68 size_t items = 0; 69 69 70 70 if (!bootpar) { 71 71 /* Fake-up a memory map for simulators. */ … … 83 83 size_t mm_size = bootpar->efi_memmap_sz; 84 84 size_t md_size = bootpar->efi_memdesc_sz; 85 85 86 86 /* 87 87 * Walk the EFI memory map using the V1 memory descriptor … … 109 109 continue; 110 110 } 111 111 112 112 memmap[items].base = md->phys_start; 113 113 memmap[items].size = md->pages * EFI_PAGE_SIZE; … … 115 115 } 116 116 } 117 117 118 118 bootinfo.memmap_items = items; 119 119 } … … 134 134 efi_guid_t sal_guid = SAL_SYSTEM_TABLE_GUID; 135 135 sal_system_table_header_t *sal_st; 136 136 137 137 sal_st = efi_vendor_table_find( 138 138 (efi_system_table_t *) bootpar->efi_system_table, sal_guid); 139 139 140 140 sal_system_table_parse(sal_st); 141 141 142 142 bootinfo.sys_freq = sal_base_clock_frequency(); 143 143 } else { … … 150 150 { 151 151 version_print(); 152 152 153 153 printf(" %p|%p: boot info structure\n", &bootinfo, &bootinfo); 154 154 printf(" %p|%p: kernel entry point\n", … … 156 156 printf(" %p|%p: loader entry point\n", 157 157 (void *) LOADER_ADDRESS, (void *) LOADER_ADDRESS); 158 158 159 159 size_t i; 160 160 for (i = 0; i < COMPONENTS; i++) … … 162 162 components[i].addr, components[i].name, 163 163 components[i].inflated, components[i].size); 164 164 165 165 void *dest[COMPONENTS]; 166 166 size_t top = KERNEL_ADDRESS; … … 169 169 for (i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) { 170 170 top = ALIGN_UP(top, PAGE_SIZE); 171 171 172 172 if (i > 0) { 173 173 bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].addr = … … 175 175 bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].size = 176 176 components[i].inflated; 177 177 178 178 str_cpy(bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].name, 179 179 BOOTINFO_TASK_NAME_BUFLEN, components[i].name); 180 180 181 181 bootinfo.taskmap.cnt++; 182 182 } 183 183 184 184 dest[i] = (void *) top; 185 185 top += components[i].inflated; 186 186 cnt++; 187 187 } 188 188 189 189 printf("\nInflating components ... "); 190 190 191 191 /* 192 192 * We will use the next available address for a copy of each component to … … 197 197 for (i = cnt; i > 0; i--) { 198 198 printf("%s ", components[i - 1].name); 199 199 200 200 /* 201 201 * Copy the component to a location which is guaranteed not to … … 203 203 */ 204 204 memmove((void *) top, components[i - 1].addr, components[i - 1].size); 205 205 206 206 int err = inflate((void *) top, components[i - 1].size, 207 207 dest[i - 1], components[i - 1].inflated); 208 208 209 209 if (err != EOK) { 210 210 printf("\n%s: Inflating error %d, halting.\n", … … 213 213 } 214 214 } 215 215 216 216 printf(".\n"); 217 217 … … 219 219 read_sal_configuration(); 220 220 read_pal_configuration(); 221 221 222 222 printf("Booting the kernel ...\n"); 223 223 jump_to_kernel(&bootinfo); -
boot/arch/ia64/src/pal.c
r3061bc1 ra35b458 35 35 { 36 36 uint64_t proc_ratio; 37 37 38 38 pal_static_call_0_1(PAL_FREQ_RATIOS, &proc_ratio); 39 39 40 40 return proc_ratio; 41 41 } -
boot/arch/ia64/src/pal_asm.S
r3061bc1 ra35b458 38 38 srlz.i 39 39 srlz.d 40 40 41 41 mov loc2 = gp 42 42 mov loc3 = rp 43 43 44 44 addl loc4 = @gprel(pal_proc), gp 45 45 … … 48 48 mov r30 = in2 49 49 mov r31 = in3 ;; 50 50 51 51 ld8 loc4 = [loc4] 52 52 movl loc5 = 0f ;; … … 64 64 cmp.ne p8,p0 = 0, in5 65 65 cmp.ne p9,p0 = 0, in6 ;; 66 66 67 67 (p7) st8 [in4] = r9 68 68 (p8) st8 [in5] = r10 69 69 (p9) st8 [in6] = r11 70 70 71 71 mov gp = loc2 72 72 mov rp = loc3 ;; 73 73 74 74 mov ar.pfs = loc0 75 75 br.ret.sptk.many rp -
boot/arch/ia64/src/sal.c
r3061bc1 ra35b458 75 75 { 76 76 uint64_t freq; 77 77 78 78 sal_call_1_1(SAL_FREQ_BASE, 0, &freq); 79 79 80 80 return freq; 81 81 } -
boot/arch/ia64/src/sal_asm.S
r3061bc1 ra35b458 45 45 FUNCTION_BEGIN(sal_call) 46 46 alloc loc0 = ar.pfs, 8, 8, 8, 0 47 47 48 48 adds sp = -STACK_SCRATCH_AREA, sp 49 49 50 50 mov loc1 = gp 51 51 mov loc2 = rp 52 52 53 53 addl loc3 = @gprel(sal_proc), gp 54 54 addl loc4 = @gprel(sal_proc_gp), gp 55 55 56 56 mov out0 = in0 57 57 mov out1 = in1 … … 62 62 mov out6 = in6 63 63 mov out7 = in7 ;; 64 64 65 65 ld8 loc3 = [loc3] 66 66 ld8 gp = [loc4] … … 73 73 ld8 loc6 = [r15] 74 74 ld8 loc7 = [r16] 75 75 76 76 mov b6 = loc3 ;; 77 77 br.call.sptk.many rp = b6 78 78 79 79 cmp.ne p7,p0 = 0, loc5 80 80 cmp.ne p8,p0 = 0, loc6 81 81 cmp.ne p9,p0 = 0, loc7 ;; 82 82 83 83 (p7) st8 [loc5] = r9 84 84 (p8) st8 [loc6] = r10 85 85 (p9) st8 [loc7] = r11 86 86 87 87 mov gp = loc1 88 88 mov rp = loc2 89 89 90 90 adds sp = STACK_SCRATCH_AREA, sp ;; 91 91 92 92 mov ar.pfs = loc0 93 93 br.ret.sptk.many rp -
boot/arch/ia64/src/ski.c
r3061bc1 ra35b458 37 37 { 38 38 static bool initialized = false; 39 39 40 40 if (initialized) 41 41 return; … … 48 48 : "r15", "r8" 49 49 ); 50 50 51 51 initialized = true; 52 52 } -
boot/arch/mips32/src/asm.S
r3061bc1 ra35b458 55 55 sw $a3, 0($a0) 56 56 #endif 57 57 58 58 /* 59 59 * Setup CPU map (on msim this code … … 62 62 */ 63 63 la $a0, PA2KA(CPUMAP_OFFSET) 64 64 65 65 sw $zero, 0($a0) 66 66 sw $zero, 4($a0) 67 67 sw $zero, 8($a0) 68 68 sw $zero, 12($a0) 69 69 70 70 sw $zero, 16($a0) 71 71 sw $zero, 20($a0) 72 72 sw $zero, 24($a0) 73 73 sw $zero, 28($a0) 74 74 75 75 sw $zero, 32($a0) 76 76 sw $zero, 36($a0) 77 77 sw $zero, 40($a0) 78 78 sw $zero, 44($a0) 79 79 80 80 sw $zero, 48($a0) 81 81 sw $zero, 52($a0) 82 82 sw $zero, 56($a0) 83 83 sw $zero, 60($a0) 84 84 85 85 sw $zero, 64($a0) 86 86 sw $zero, 68($a0) 87 87 sw $zero, 72($a0) 88 88 sw $zero, 76($a0) 89 89 90 90 sw $zero, 80($a0) 91 91 sw $zero, 84($a0) 92 92 sw $zero, 88($a0) 93 93 sw $zero, 92($a0) 94 94 95 95 sw $zero, 96($a0) 96 96 sw $zero, 100($a0) 97 97 sw $zero, 104($a0) 98 98 sw $zero, 108($a0) 99 99 100 100 sw $zero, 112($a0) 101 101 sw $zero, 116($a0) 102 102 sw $zero, 120($a0) 103 103 sw $zero, 124($a0) 104 104 105 105 lui $a1, 1 106 106 107 107 #ifdef MACHINE_msim 108 108 109 109 /* Read dorder value */ 110 110 la $k0, MSIM_DORDER_ADDRESS 111 111 lw $k1, ($k0) 112 112 113 113 /* 114 114 * If we are not running on BSP … … 117 117 beq $k1, $zero, bsp 118 118 nop 119 119 120 120 /* Record CPU presence */ 121 121 sll $a2, $k1, 2 122 122 addu $a2, $a2, $a0 123 123 sw $a1, ($a2) 124 124 125 125 loop: 126 126 j loop 127 127 nop 128 128 129 129 #endif 130 130 131 131 bsp: 132 132 /* Record CPU presence */ 133 133 sw $a1, ($a0) 134 134 135 135 /* Setup initial stack */ 136 136 la $sp, PA2KA(STACK_OFFSET) 137 137 138 138 j bootstrap 139 139 nop -
boot/arch/mips32/src/boot.S
r3061bc1 ra35b458 38 38 .global start 39 39 start: 40 40 41 41 /* Setup CPU map (on msim this code 42 42 is executed in parallel on all CPUs, 43 43 but it not an issue) */ 44 44 la $a0, CPUMAP 45 45 46 46 sw $zero, 0($a0) 47 47 sw $zero, 4($a0) 48 48 sw $zero, 8($a0) 49 49 sw $zero, 12($a0) 50 50 51 51 sw $zero, 16($a0) 52 52 sw $zero, 20($a0) 53 53 sw $zero, 24($a0) 54 54 sw $zero, 28($a0) 55 55 56 56 sw $zero, 32($a0) 57 57 sw $zero, 36($a0) 58 58 sw $zero, 40($a0) 59 59 sw $zero, 44($a0) 60 60 61 61 sw $zero, 48($a0) 62 62 sw $zero, 52($a0) 63 63 sw $zero, 56($a0) 64 64 sw $zero, 60($a0) 65 65 66 66 sw $zero, 64($a0) 67 67 sw $zero, 68($a0) 68 68 sw $zero, 72($a0) 69 69 sw $zero, 76($a0) 70 70 71 71 sw $zero, 80($a0) 72 72 sw $zero, 84($a0) 73 73 sw $zero, 88($a0) 74 74 sw $zero, 92($a0) 75 75 76 76 sw $zero, 96($a0) 77 77 sw $zero, 100($a0) 78 78 sw $zero, 104($a0) 79 79 sw $zero, 108($a0) 80 80 81 81 sw $zero, 112($a0) 82 82 sw $zero, 116($a0) 83 83 sw $zero, 120($a0) 84 84 sw $zero, 124($a0) 85 85 86 86 lui $a1, 1 87 87 88 88 #ifdef MACHINE_msim 89 89 90 90 /* Read dorder value */ 91 91 la $k0, MSIM_DORDER_ADDRESS 92 92 lw $k1, ($k0) 93 93 94 94 /* If we are not running on BSP 95 95 then end in an infinite loop */ 96 96 beq $k1, $zero, bsp 97 97 nop 98 98 99 99 /* Record CPU presence */ 100 100 sll $a2, $k1, 2 101 101 addu $a2, $a2, $a0 102 102 sw $a1, ($a2) 103 103 104 104 loop: 105 105 j loop 106 106 nop 107 107 108 108 #endif 109 109 110 110 bsp: 111 111 /* Record CPU presence */ 112 112 sw $a1, ($a0) 113 113 114 114 /* Setup initial stack */ 115 115 la $sp, INITIAL_STACK 116 116 117 117 j bootstrap 118 118 nop -
boot/arch/mips32/src/main.c
r3061bc1 ra35b458 49 49 { 50 50 version_print(); 51 51 52 52 printf("\nMemory statistics\n"); 53 53 printf(" %p|%p: CPU map\n", (void *) PA2KA(CPUMAP_OFFSET), … … 61 61 printf(" %p|%p: bootloader entry point\n", 62 62 (void *) PA2KA(LOADER_OFFSET), (void *) LOADER_OFFSET); 63 63 64 64 size_t i; 65 65 for (i = 0; i < COMPONENTS; i++) … … 70 70 components[i].name, components[i].inflated, 71 71 components[i].size); 72 72 73 73 void *dest[COMPONENTS]; 74 74 size_t top = 0; … … 77 77 for (i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) { 78 78 top = ALIGN_UP(top, PAGE_SIZE); 79 79 80 80 if (i > 0) { 81 81 bootinfo->tasks[bootinfo->cnt].addr = TOP2ADDR(top); 82 82 bootinfo->tasks[bootinfo->cnt].size = components[i].inflated; 83 83 84 84 str_cpy(bootinfo->tasks[bootinfo->cnt].name, 85 85 BOOTINFO_TASK_NAME_BUFLEN, components[i].name); 86 86 87 87 bootinfo->cnt++; 88 88 } 89 89 90 90 dest[i] = TOP2ADDR(top); 91 91 top += components[i].inflated; 92 92 cnt++; 93 93 } 94 94 95 95 printf("\nInflating components ... "); 96 96 97 97 for (i = cnt; i > 0; i--) { 98 98 #ifdef MACHINE_msim … … 104 104 } 105 105 #endif 106 106 107 107 printf("%s ", components[i - 1].name); 108 108 109 109 int err = inflate(components[i - 1].addr, components[i - 1].size, 110 110 dest[i - 1], components[i - 1].inflated); 111 111 112 112 if (err != EOK) { 113 113 printf("\n%s: Inflating error %d, halting.\n", … … 116 116 } 117 117 } 118 118 119 119 printf(".\n"); 120 120 121 121 printf("Copying CPU map ... \n"); 122 122 123 123 bootinfo->cpumap = 0; 124 124 for (i = 0; i < CPUMAP_MAX_RECORDS; i++) { … … 126 126 bootinfo->cpumap |= (1 << i); 127 127 } 128 128 129 129 printf("Booting the kernel ... \n"); 130 130 jump_to_kernel((void *) PA2KA(BOOT_OFFSET), bootinfo); -
boot/arch/ppc32/src/asm.S
r3061bc1 ra35b458 48 48 li \reg, 0 49 49 sync 50 50 51 51 .rept 64 52 52 tlbie \reg 53 53 addi \reg, \reg, 0x1000 54 54 .endr 55 55 56 56 eieio 57 57 tlbsync … … 61 61 .macro BAT_COMPUTE base size mask lower upper 62 62 # less than 128 KB -> no BAT 63 63 64 64 lis \upper, 0x0002 65 65 cmpw \size, \upper 66 66 blt no_bat 67 67 68 68 # mask = total >> 18 69 69 70 70 li \upper, 18 71 71 srw \mask, \size, \upper 72 72 73 73 # create Block Length mask by replicating 74 74 # the leading logical one 14 times 75 75 76 76 li \upper, 14 77 77 mtctr \mask 78 78 li \upper, 1 79 79 80 80 0: 81 81 # mask = (mask >> 1) | mask 82 82 83 83 srw \lower, \mask, \upper 84 84 or \mask, \mask, \lower 85 85 86 86 bdnz 0b 87 87 88 88 # mask = mask & 0x07ff 89 89 # (BAT can map up to 256 MB) 90 90 91 91 andi. \mask, \mask, 0x07ff 92 92 93 93 # mask = (mask << 2) | 0x0002 94 94 # (priviledged access only) 95 95 96 96 li \upper, 2 97 97 slw \mask, \mask, \upper 98 98 ori \mask, \mask, 0x0002 99 99 100 100 lis \upper, (0x8000 + \base) 101 101 or \upper, \upper, \mask 102 102 103 103 lis \lower, \base 104 104 ori \lower, \lower, 0x0002 … … 111 111 addi r4, r4, ofw_cif@l 112 112 stw r5, 0(r4) 113 113 114 114 bl ofw_init 115 115 b bootstrap … … 127 127 # r5 = pages to translate 128 128 # r6 = real mode meeting point (physical address) 129 129 130 130 # disable interrupts 131 131 132 132 mfmsr r31 133 133 rlwinm r31, r31, 0, 17, 15 134 134 mtmsr r31 135 135 136 136 # set real mode meeting point physical address 137 137 138 138 mtspr srr0, r6 139 139 140 140 # jump to real_mode 141 141 142 142 mfmsr r31 143 143 lis r30, ~0@h … … 145 145 and r31, r31, r30 146 146 mtspr srr1, r31 147 147 148 148 sync 149 149 isync … … 155 155 .align PAGE_WIDTH 156 156 SYMBOL(real_mode) 157 157 158 158 # arguments: 159 159 # r3 = bootinfo (physical address) 160 160 # r4 = translate table (physical address) 161 161 # r5 = pages to translate 162 162 163 163 # move the images of components to the proper 164 164 # location using the translate table 165 165 166 166 li r31, PAGE_SIZE >> 2 167 167 li r30, 0 168 168 169 169 page_copy: 170 170 171 171 cmpwi r5, 0 172 172 beq copy_end 173 173 174 174 mtctr r31 175 175 lwz r29, 0(r4) 176 176 177 177 copy_loop: 178 178 179 179 lwz r28, 0(r29) 180 180 stw r28, 0(r30) 181 181 182 182 SMC_COHERENCY r30 183 183 184 184 addi r29, r29, 4 185 185 addi r30, r30, 4 186 186 187 187 bdnz copy_loop 188 188 189 189 addi r4, r4, 4 190 190 subi r5, r5, 1 191 191 b page_copy 192 192 193 193 copy_end: 194 194 195 195 # initially fill segment registers 196 196 197 197 li r31, 0 198 198 199 199 li r29, 8 200 200 mtctr r29 201 201 li r30, 0 # ASID 0 (VSIDs 0 .. 7) 202 202 203 203 seg_fill_uspace: 204 204 205 205 mtsrin r30, r31 206 206 addi r30, r30, 1 207 207 addis r31, r31, 0x1000 # move to next SR 208 208 209 209 bdnz seg_fill_uspace 210 210 211 211 li r29, 8 212 212 mtctr r29 213 213 lis r30, 0x4000 # priviledged access only 214 214 ori r30, r30, 8 # ASID 0 (VSIDs 8 .. 15) 215 215 216 216 seg_fill_kernel: 217 217 218 218 mtsrin r30, r31 219 219 addi r30, r30, 1 220 220 addis r31, r31, 0x1000 # move to next SR 221 221 222 222 bdnz seg_fill_kernel 223 223 224 224 # invalidate block address translation registers 225 225 226 226 li r30, 0 227 227 228 228 mtspr ibat0u, r30 229 229 mtspr ibat0l, r30 230 230 231 231 mtspr ibat1u, r30 232 232 mtspr ibat1l, r30 233 233 234 234 mtspr ibat2u, r30 235 235 mtspr ibat2l, r30 236 236 237 237 mtspr ibat3u, r30 238 238 mtspr ibat3l, r30 239 239 240 240 mtspr dbat0u, r30 241 241 mtspr dbat0l, r30 242 242 243 243 mtspr dbat1u, r30 244 244 mtspr dbat1l, r30 245 245 246 246 mtspr dbat2u, r30 247 247 mtspr dbat2l, r30 248 248 249 249 mtspr dbat3u, r30 250 250 mtspr dbat3l, r30 251 251 252 252 # create empty Page Hash Table 253 253 # on top of memory, size 64 KB 254 254 255 255 lwz r31, 4(r3) # r31 = memory size 256 256 257 257 lis r30, 65536@h 258 258 ori r30, r30, 65536@l # r30 = 65536 259 259 260 260 subi r29, r30, 1 # r29 = 65535 261 261 262 262 sub r31, r31, r30 263 263 andc r31, r31, r29 # pht = ALIGN_DOWN(memory_size - 65536, 65536) 264 264 265 265 mtsdr1 r31 266 266 267 267 li r29, 2 268 268 srw r30, r30, r29 # r30 = 16384 269 269 li r29, 0 270 270 271 271 pht_clear: 272 272 273 273 # write zeroes 274 274 275 275 stw r29, 0(r31) 276 276 FLUSH_DCACHE r31 277 277 278 278 addi r31, r31, 4 279 279 subi r30, r30, 4 280 280 281 281 cmpwi r30, 0 282 282 beq clear_end 283 283 284 284 bdnz pht_clear 285 285 286 286 clear_end: 287 287 288 288 # create BAT identity mapping 289 289 290 290 lwz r31, 4(r3) # r31 = memory size 291 291 292 292 lis r30, 268435456@h 293 293 ori r30, r30, 268435456@l # r30 = 256 MB 294 294 295 295 # BAT0 296 296 297 297 # r29 = min(r31, r30) 298 298 299 299 cmpw r31, r30 300 300 blt bat0_r31 301 301 302 302 mr r29, r30 303 303 b bat0_r30 304 304 305 305 bat0_r31: 306 306 307 307 mr r29, r31 308 308 309 309 bat0_r30: 310 310 311 311 BAT_COMPUTE 0x0000 r29 r28 r27 r26 312 312 mtspr ibat0u, r26 313 313 mtspr ibat0l, r27 314 314 315 315 mtspr dbat0u, r26 316 316 mtspr dbat0l, r27 317 317 318 318 # BAT1 319 319 320 320 sub r31, r31, r29 # r31 = r31 - r29 321 321 322 322 # r29 = min(r31, r30) 323 323 324 324 cmpw r31, r30 325 325 blt bat1_r31 326 326 327 327 mr r29, r30 328 328 b bat1_r30 329 329 330 330 bat1_r31: 331 331 332 332 mr r29, r31 333 333 334 334 bat1_r30: 335 335 336 336 BAT_COMPUTE 0x1000 r29 r28 r27 r26 337 337 mtspr ibat1u, r26 338 338 mtspr ibat1l, r27 339 339 340 340 mtspr dbat1u, r26 341 341 mtspr dbat1l, r27 342 342 343 343 # BAT2 344 344 345 345 sub r31, r31, r29 # r31 = r31 - r29 346 346 347 347 # r29 = min(r31, r30) 348 348 349 349 cmpw r31, r30 350 350 blt bat2_r31 351 351 352 352 mr r29, r30 353 353 b bat2_r30 354 354 355 355 bat2_r31: 356 356 357 357 mr r29, r31 358 358 359 359 bat2_r30: 360 360 361 361 BAT_COMPUTE 0x2000 r29 r28 r27 r26 362 362 mtspr ibat2u, r26 363 363 mtspr ibat2l, r27 364 364 365 365 mtspr dbat2u, r26 366 366 mtspr dbat2l, r27 367 367 368 368 # BAT3 369 369 370 370 sub r31, r31, r29 # r31 = r31 - r29 371 371 372 372 # r29 = min(r31, r30) 373 373 374 374 cmpw r31, r30 375 375 blt bat3_r31 376 376 377 377 mr r29, r30 378 378 b bat3_r30 379 379 380 380 bat3_r31: 381 381 382 382 mr r29, r31 383 383 384 384 bat3_r30: 385 385 386 386 BAT_COMPUTE 0x3000 r29 r28 r27 r26 387 387 mtspr ibat3u, r26 388 388 mtspr ibat3l, r27 389 389 390 390 mtspr dbat3u, r26 391 391 mtspr dbat3l, r27 392 392 393 393 no_bat: 394 394 395 395 # flush TLB 396 396 397 397 TLB_FLUSH r31 398 398 399 399 # start the kernel 400 400 # … … 404 404 # sprg3 = physical memory size 405 405 # sp = 0 (enforces the usage of sprg0 as exception stack) 406 406 407 407 lis r31, PA2KA(BOOT_OFFSET)@ha 408 408 addi r31, r31, PA2KA(BOOT_OFFSET)@l 409 409 mtspr srr0, r31 410 410 411 411 lis r31, BOOT_OFFSET@ha 412 412 addi r31, r31, BOOT_OFFSET@l 413 413 mtsprg0 r31 414 414 415 415 # bootinfo starts with a 64 bit integer containing 416 416 # the physical memory size, get the lower 4 bytes 417 417 418 418 lwz r31, 4(r3) 419 419 mtsprg3 r31 420 420 421 421 li sp, 0 422 422 423 423 mfmsr r31 424 424 ori r31, r31, (msr_ir | msr_dr)@l 425 425 mtspr srr1, r31 426 426 427 427 sync 428 428 isync -
boot/arch/ppc32/src/main.c
r3061bc1 ra35b458 60 60 version_print(); 61 61 ofw_memmap(&bootinfo.memmap); 62 62 63 63 void *bootinfo_pa = ofw_translate(&bootinfo); 64 64 void *real_mode_pa = ofw_translate(&real_mode); 65 65 void *loader_address_pa = ofw_translate((void *) LOADER_ADDRESS); 66 66 67 67 printf("\nMemory statistics (total %llu MB)\n", bootinfo.memmap.total >> 20); 68 68 printf(" %p|%p: real mode trampoline\n", &real_mode, real_mode_pa); … … 72 72 printf(" %p|%p: loader entry point\n", 73 73 (void *) LOADER_ADDRESS, loader_address_pa); 74 74 75 75 size_t i; 76 76 for (i = 0; i < COMPONENTS; i++) … … 78 78 ofw_translate(components[i].addr), components[i].name, 79 79 components[i].inflated, components[i].size); 80 80 81 81 size_t dest[COMPONENTS]; 82 82 size_t top = 0; … … 85 85 for (i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) { 86 86 top = ALIGN_UP(top, PAGE_SIZE); 87 87 88 88 if (i > 0) { 89 89 bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].addr = … … 91 91 bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].size = 92 92 components[i].inflated; 93 93 94 94 str_cpy(bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].name, 95 95 BOOTINFO_TASK_NAME_BUFLEN, components[i].name); 96 96 97 97 bootinfo.taskmap.cnt++; 98 98 } 99 99 100 100 dest[i] = top; 101 101 top += components[i].inflated; 102 102 cnt++; 103 103 } 104 104 105 105 if (top >= (size_t) loader_address_pa) { 106 106 printf("Inflated components overlap loader area.\n"); … … 108 108 halt(); 109 109 } 110 110 111 111 void *balloc_base; 112 112 void *balloc_base_pa; … … 114 114 BALLOC_MAX_SIZE, loader_address_pa); 115 115 printf(" %p|%p: boot allocator area\n", balloc_base, balloc_base_pa); 116 116 117 117 void *inflate_base; 118 118 void *inflate_base_pa; … … 120 120 loader_address_pa); 121 121 printf(" %p|%p: inflate area\n", inflate_base, inflate_base_pa); 122 122 123 123 uintptr_t balloc_start = ALIGN_UP(top, PAGE_SIZE); 124 124 size_t pages = (balloc_start + ALIGN_UP(BALLOC_MAX_SIZE, PAGE_SIZE)) … … 129 129 pages * sizeof(void *), loader_address_pa); 130 130 printf(" %p|%p: translate table\n", transtable, transtable_pa); 131 131 132 132 check_overlap("boot allocator area", balloc_base_pa, pages); 133 133 check_overlap("inflate area", inflate_base_pa, pages); 134 134 check_overlap("translate table", transtable_pa, pages); 135 135 136 136 printf("\nInflating components ... "); 137 137 138 138 for (i = cnt; i > 0; i--) { 139 139 printf("%s ", components[i - 1].name); 140 140 141 141 int err = inflate(components[i - 1].addr, components[i - 1].size, 142 142 inflate_base + dest[i - 1], components[i - 1].inflated); 143 143 144 144 if (err != EOK) { 145 145 printf("\n%s: Inflating error %d, halting.\n", … … 148 148 } 149 149 } 150 150 151 151 printf(".\n"); 152 152 153 153 printf("Setting up boot allocator ...\n"); 154 154 balloc_init(&bootinfo.ballocs, balloc_base, PA2KA(balloc_start), 155 155 BALLOC_MAX_SIZE); 156 156 157 157 printf("Setting up screens ...\n"); 158 158 ofw_setup_screens(); 159 159 160 160 printf("Canonizing OpenFirmware device tree ...\n"); 161 161 bootinfo.ofw_root = ofw_tree_build(); 162 162 163 163 printf("Setting up translate table ...\n"); 164 164 for (i = 0; i < pages; i++) { 165 165 uintptr_t off = i << PAGE_WIDTH; 166 166 void *phys; 167 167 168 168 if (off < balloc_start) 169 169 phys = ofw_translate(inflate_base + off); 170 170 else 171 171 phys = ofw_translate(balloc_base + off - balloc_start); 172 172 173 173 ((void **) transtable)[i] = phys; 174 174 } 175 175 176 176 printf("Booting the kernel...\n"); 177 177 jump_to_kernel(bootinfo_pa, transtable_pa, pages, real_mode_pa); -
boot/arch/ppc32/src/ofw.c
r3061bc1 ra35b458 43 43 if (ch == '\n') 44 44 ofw_putchar('\r'); 45 45 46 46 if (ascii_check(ch)) 47 47 ofw_putchar(ch); -
boot/arch/riscv64/src/asm.S
r3061bc1 ra35b458 85 85 li x30, 0 86 86 li x31, 0 87 87 88 88 /* Set up stack, create stack frame */ 89 89 la sp, boot_stack + BOOT_STACK_SIZE 90 90 addi sp, sp, -16 91 91 92 92 j bootstrap 93 93 … … 97 97 /* Enable performance counters access in supervisor mode */ 98 98 csrsi mcounteren, MCOUNTEREN_CY_MASK | MCOUNTEREN_TM_MASK | MCOUNTEREN_IR_MASK 99 99 100 100 /* Setup SV48 paging for supervisor mode */ 101 101 la t0, ptl_0 102 102 srli t0, t0, 12 103 103 104 104 li t1, SATP_PFN_MASK 105 105 and t0, t0, t1 106 106 107 107 li t1, SATP_MODE_SV48 108 108 or t0, t0, t1 109 109 110 110 csrw sptbr, t0 111 111 112 112 /* Jump to supervisor mode */ 113 113 csrr t0, mstatus 114 114 115 115 li t1, ~MSTATUS_MPP_MASK 116 116 and t0, t0, t1 117 117 118 118 /* 119 119 * TODO: Enable running with Supervisor User Mode … … 122 122 li t1, MSTATUS_MPP_SUPERVISOR | MSTATUS_SUM_MASK 123 123 or t0, t0, t1 124 124 125 125 csrw mstatus, t0 126 126 127 127 li ra, PA2KA(BOOT_OFFSET) 128 128 csrw mepc, ra 129 129 130 130 mret 131 131 FUNCTION_END(jump_to_kernel) -
boot/arch/riscv64/src/main.c
r3061bc1 ra35b458 48 48 { 49 49 version_print(); 50 50 51 51 bootinfo.htif_frame = ((uintptr_t) &htif_page) >> PAGE_WIDTH; 52 52 bootinfo.pt_frame = ((uintptr_t) &pt_page) >> PAGE_WIDTH; 53 53 54 54 bootinfo.ucbinfo.tohost = 55 55 (volatile uint64_t *) PA2KA((uintptr_t) &tohost); 56 56 bootinfo.ucbinfo.fromhost = 57 57 (volatile uint64_t *) PA2KA((uintptr_t) &fromhost); 58 58 59 59 // FIXME TODO: read from device tree 60 60 bootinfo.physmem_start = PHYSMEM_START; … … 63 63 bootinfo.memmap.zones[0].start = (void *) PHYSMEM_START; 64 64 bootinfo.memmap.zones[0].size = PHYSMEM_SIZE; 65 65 66 66 printf("\nMemory statistics (total %lu MB, starting at %p)\n\n", 67 67 bootinfo.memmap.total >> 20, (void *) bootinfo.physmem_start); 68 68 printf(" %p: boot info structure\n", &bootinfo); 69 69 70 70 uintptr_t top = BOOT_OFFSET; 71 71 72 72 for (size_t i = 0; i < COMPONENTS; i++) { 73 73 printf(" %p: %s image (%zu/%zu bytes)\n", components[i].addr, 74 74 components[i].name, components[i].inflated, 75 75 components[i].size); 76 76 77 77 uintptr_t tail = (uintptr_t) components[i].addr + 78 78 components[i].size; … … 83 83 } 84 84 } 85 85 86 86 printf(" %p: inflate area\n", (void *) top); 87 87 88 88 void *kernel_entry = NULL; 89 89 void *dest[COMPONENTS]; 90 90 size_t cnt = 0; 91 91 bootinfo.taskmap.cnt = 0; 92 92 93 93 for (size_t i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) { 94 94 top = ALIGN_UP(top, PAGE_SIZE); 95 95 96 96 if (i > 0) { 97 97 bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].addr = … … 99 99 bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].size = 100 100 components[i].inflated; 101 101 102 102 str_cpy(bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].name, 103 103 BOOTINFO_TASK_NAME_BUFLEN, components[i].name); 104 104 105 105 bootinfo.taskmap.cnt++; 106 106 } else 107 107 kernel_entry = (void *) PA2KA(top); 108 108 109 109 dest[i] = (void *) top; 110 110 top += components[i].inflated; 111 111 cnt++; 112 112 } 113 113 114 114 printf(" %p: kernel entry point\n", kernel_entry); 115 115 116 116 if (top >= bootinfo.physmem_start + bootinfo.memmap.total) { 117 117 printf("Not enough physical memory available.\n"); … … 119 119 halt(); 120 120 } 121 121 122 122 printf("\nInflating components ... "); 123 123 124 124 for (size_t i = cnt; i > 0; i--) { 125 125 printf("%s ", components[i - 1].name); 126 126 127 127 int err = inflate(components[i - 1].addr, components[i - 1].size, 128 128 dest[i - 1], components[i - 1].inflated); 129 129 130 130 if (err != EOK) { 131 131 printf("\n%s: Inflating error %d, halting.\n", … … 134 134 } 135 135 } 136 136 137 137 printf(".\n"); 138 138 139 139 printf("Booting the kernel...\n"); 140 140 jump_to_kernel(PA2KA(&bootinfo)); -
boot/arch/riscv64/src/ucb.c
r3061bc1 ra35b458 39 39 if (!val) 40 40 return; 41 41 42 42 fromhost = 0; 43 43 } … … 48 48 (((uint64_t) cmd) << 48) | 49 49 (payload & UINT64_C(0xffffffffffff)); 50 50 51 51 while (tohost) 52 52 poll_fromhost(); 53 53 54 54 tohost = val; 55 55 } -
boot/arch/sparc64/src/asm.S
r3061bc1 ra35b458 65 65 1: 66 66 ! Disable interrupts and disable address masking. 67 67 68 68 wrpr %g0, PSTATE_PRIV_BIT, %pstate 69 69 70 70 wrpr %g0, NWINDOWS - 2, %cansave ! Set maximum saveable windows 71 71 wrpr %g0, 0, %canrestore ! Get rid of windows we will never need again 72 72 wrpr %g0, 0, %otherwin ! Make sure the window state is consistent 73 73 wrpr %g0, NWINDOWS - 1, %cleanwin ! Prevent needless clean_window traps for kernel 74 74 75 75 set initial_stack, %sp 76 76 add %sp, -STACK_BIAS, %sp 77 77 78 78 set ofw_cif, %l0 79 79 80 80 ! Initialize OpenFirmware 81 81 82 82 call ofw_init 83 83 stx %o4, [%l0] 84 84 85 85 ba %xcc, bootstrap 86 86 nop … … 105 105 * 3. Flush instruction pipeline. 106 106 */ 107 107 108 108 /* 109 109 * US3 processors have a write-invalidate cache, so explicitly … … 115 115 be %xcc, 1f 116 116 nop 117 117 118 118 0: 119 119 call icache_flush 120 120 nop 121 121 122 122 1: 123 123 membar #StoreStore 124 124 125 125 /* 126 126 * Flush the instruction pipeline. 127 127 */ 128 128 flush %i7 129 129 130 130 ! Jump to kernel 131 131 jmp %o3 … … 138 138 set ((ICACHE_SIZE - ICACHE_LINE_SIZE) | ICACHE_SET_BIT), %g1 139 139 stxa %g0, [%g1] ASI_ICACHE_TAG 140 140 141 141 0: 142 142 membar #Sync 143 143 subcc %g1, ICACHE_LINE_SIZE, %g1 144 144 bnz,pt %xcc, 0b 145 145 146 146 stxa %g0, [%g1] ASI_ICACHE_TAG 147 147 membar #Sync 148 148 retl 149 149 150 150 ! SF Erratum #51 151 151 152 152 nop 153 153 #else … … 161 161 set ofw_cif, %l0 162 162 ldx [%l0], %l0 163 163 164 164 rdpr %pstate, %l1 165 165 and %l1, ~PSTATE_AM_BIT, %l2 166 166 wrpr %l2, 0, %pstate 167 167 168 168 jmpl %l0, %o7 169 169 mov %i0, %o0 170 170 171 171 wrpr %l1, 0, %pstate 172 172 173 173 ret 174 174 restore %o0, 0, %o0 -
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, -
boot/arch/sparc64/src/ofw.c
r3061bc1 ra35b458 47 47 if (ch == '\n') 48 48 ofw_putchar('\r'); 49 49 50 50 if (ascii_check(ch)) 51 51 ofw_putchar(ch); … … 72 72 { 73 73 size_t cpus; 74 74 75 75 for (cpus = 0; (child != 0) && (child != (phandle) -1); 76 76 child = ofw_get_peer_node(child), cpus++) { 77 77 char type_name[OFW_TREE_PROPERTY_MAX_VALUELEN]; 78 78 79 79 if (ofw_get_property(child, "device_type", type_name, 80 80 OFW_TREE_PROPERTY_MAX_VALUELEN) > 0) { 81 81 type_name[OFW_TREE_PROPERTY_MAX_VALUELEN - 1] = 0; 82 82 83 83 if (str_cmp(type_name, "cpu") == 0) { 84 84 uint32_t mid; 85 85 86 86 /* 87 87 * "upa-portid" for US, "portid" for US-III, … … 92 92 && (ofw_get_property(child, "cpuid", &mid, sizeof(mid)) <= 0)) 93 93 continue; 94 94 95 95 if (current_mid != mid) { 96 96 /* … … 104 104 } 105 105 } 106 106 107 107 return cpus; 108 108 } … … 115 115 /* Get the current CPU MID */ 116 116 uint64_t current_mid; 117 117 118 118 asm volatile ( 119 119 "ldxa [%[zero]] %[asi], %[current_mid]\n" … … 122 122 [asi] "i" (ASI_ICBUS_CONFIG) 123 123 ); 124 124 125 125 current_mid >>= ICBUS_CONFIG_MID_SHIFT; 126 126 current_mid &= mid_mask; 127 127 128 128 /* Wake up the CPUs */ 129 129 130 130 phandle cpus_parent = ofw_find_device("/ssm@0,0"); 131 131 if ((cpus_parent == 0) || (cpus_parent == (phandle) -1)) 132 132 cpus_parent = ofw_find_device("/"); 133 133 134 134 phandle node = ofw_get_child_node(cpus_parent); 135 135 size_t cpus = wake_cpus_in_node(node, current_mid, physmem_start); 136 136 137 137 while ((node != 0) && (node != (phandle) -1)) { 138 138 char name[OFW_TREE_PROPERTY_MAX_VALUELEN]; 139 139 140 140 if (ofw_get_property(node, "name", name, 141 141 OFW_TREE_PROPERTY_MAX_VALUELEN) > 0) { 142 142 name[OFW_TREE_PROPERTY_MAX_VALUELEN - 1] = 0; 143 143 144 144 if (str_cmp(name, "cmp") == 0) { 145 145 phandle subnode = ofw_get_child_node(node); … … 148 148 } 149 149 } 150 150 151 151 node = ofw_get_peer_node(node); 152 152 } 153 153 154 154 if (cpus == 0) 155 155 printf("Warning: Unable to get CPU properties.\n"); … … 169 169 halt(); 170 170 } 171 171 172 172 return ((((uintptr_t) memreg[0]) << 32) | memreg[1]); 173 173 }
Note:
See TracChangeset
for help on using the changeset viewer.