Changeset a35b458 in mainline for boot/arch


Ignore:
Timestamp:
2018-03-02T20:10:49Z (8 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
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)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

Location:
boot/arch
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/arm32/src/asm.S

    r3061bc1 ra35b458  
    6767#ifndef PROCESSOR_ARCH_armv7_a
    6868        mrc     p15, 0, r4, c1, c0, 0
    69        
     69
    7070        # Disable D-cache before the kernel is started.
    7171        bic     r4, r4, #(1 << CP15_C1_DC)
     
    7676        bic     r4, r4, #(1 << CP15_C1_BP)
    7777#endif
    78        
     78
    7979        mcr     p15, 0, r4, c1, c0, 0
    8080#endif
    81        
     81
    8282        # Wait for the operations to complete
    8383#ifdef PROCESSOR_ARCH_armv7_a
     
    8888        mcr p15, 0, r4, c7, c10, 4
    8989#endif
    90        
     90
    9191        # Clean ICache and BPredictors, r4 ignored (SBZ)
    9292        mov r4, #0
  • boot/arch/arm32/src/main.c

    r3061bc1 ra35b458  
    8989        mmu_start();
    9090        version_print();
    91        
     91
    9292        printf("Boot data: %p -> %p\n", &bdata_start, &bdata_end);
    9393        printf("\nMemory statistics\n");
     
    9797        printf(" %p|%p: kernel entry point\n",
    9898            (void *) PA2KA(BOOT_OFFSET), (void *) BOOT_OFFSET);
    99        
     99
    100100        for (size_t i = 0; i < COMPONENTS; i++) {
    101101                printf(" %p|%p: %s image (%u/%u bytes)\n", components[i].addr,
     
    103103                    components[i].size);
    104104        }
    105        
     105
    106106        void *dest[COMPONENTS];
    107107        size_t top = 0;
     
    110110        for (size_t i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) {
    111111                top = ALIGN_UP(top, PAGE_SIZE);
    112                
     112
    113113                if (i > 0) {
    114114                        bootinfo.tasks[bootinfo.cnt].addr = TOP2ADDR(top);
    115115                        bootinfo.tasks[bootinfo.cnt].size = components[i].inflated;
    116                        
     116
    117117                        str_cpy(bootinfo.tasks[bootinfo.cnt].name,
    118118                            BOOTINFO_TASK_NAME_BUFLEN, components[i].name);
    119                        
     119
    120120                        bootinfo.cnt++;
    121121                }
    122                
     122
    123123                dest[i] = TOP2ADDR(top);
    124124                top += components[i].inflated;
    125125                cnt++;
    126126        }
    127        
     127
    128128        printf("\nInflating components ... ");
    129        
     129
    130130        for (size_t i = cnt; i > 0; i--) {
    131131                void *tail = components[i - 1].addr + components[i - 1].size;
     
    135135                        halt();
    136136                }
    137                
     137
    138138                printf("%s ", components[i - 1].name);
    139                
     139
    140140                int err = inflate(components[i - 1].addr, components[i - 1].size,
    141141                    dest[i - 1], components[i - 1].inflated);
     
    147147                clean_dcache_poc(dest[i - 1], components[i - 1].inflated);
    148148        }
    149        
     149
    150150        printf(".\n");
    151151
    152152        /* Flush PT too. We need this if we disable caches later */
    153153        clean_dcache_poc(boot_pt, PTL0_ENTRIES * PTL0_ENTRY_SIZE);
    154        
     154
    155155        printf("Booting the kernel...\n");
    156156        jump_to_kernel((void *) PA2KA(BOOT_OFFSET), &bootinfo);
  • boot/arch/arm32/src/mm.c

    r3061bc1 ra35b458  
    209209                /* Current settings */
    210210                "mrc p15, 0, r0, c1, c0, 0\n"
    211                
     211
    212212                /* Enable ICache, DCache, BPredictors and MMU,
    213213                 * we disable caches before jumping to kernel
     
    221221                "ldr r1, =0x00001805\n"
    222222#endif
    223                
     223
    224224                "orr r0, r0, r1\n"
    225225
     
    228228                 */
    229229                "mcr p15, 0, r0, c8, c7, 0\n"
    230                
     230
    231231                /* Store settings, enable the MMU */
    232232                "mcr p15, 0, r0, c1, c0, 0\n"
  • boot/arch/ia64/src/main.c

    r3061bc1 ra35b458  
    6767        memmap_item_t *memmap = bootinfo.memmap;
    6868        size_t items = 0;
    69        
     69
    7070        if (!bootpar) {
    7171                /* Fake-up a memory map for simulators. */
     
    8383                size_t mm_size = bootpar->efi_memmap_sz;
    8484                size_t md_size = bootpar->efi_memdesc_sz;
    85                
     85
    8686                /*
    8787                 * Walk the EFI memory map using the V1 memory descriptor
     
    109109                                continue;
    110110                        }
    111                        
     111
    112112                        memmap[items].base = md->phys_start;
    113113                        memmap[items].size = md->pages * EFI_PAGE_SIZE;
     
    115115                }
    116116        }
    117        
     117
    118118        bootinfo.memmap_items = items;
    119119}
     
    134134                efi_guid_t sal_guid = SAL_SYSTEM_TABLE_GUID;
    135135                sal_system_table_header_t *sal_st;
    136                
     136
    137137                sal_st = efi_vendor_table_find(
    138138                    (efi_system_table_t *) bootpar->efi_system_table, sal_guid);
    139139
    140140                sal_system_table_parse(sal_st);
    141                
     141
    142142                bootinfo.sys_freq = sal_base_clock_frequency();
    143143        } else {
     
    150150{
    151151        version_print();
    152        
     152
    153153        printf(" %p|%p: boot info structure\n", &bootinfo, &bootinfo);
    154154        printf(" %p|%p: kernel entry point\n",
     
    156156        printf(" %p|%p: loader entry point\n",
    157157            (void *) LOADER_ADDRESS, (void *) LOADER_ADDRESS);
    158        
     158
    159159        size_t i;
    160160        for (i = 0; i < COMPONENTS; i++)
     
    162162                    components[i].addr, components[i].name,
    163163                    components[i].inflated, components[i].size);
    164        
     164
    165165        void *dest[COMPONENTS];
    166166        size_t top = KERNEL_ADDRESS;
     
    169169        for (i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) {
    170170                top = ALIGN_UP(top, PAGE_SIZE);
    171                
     171
    172172                if (i > 0) {
    173173                        bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].addr =
     
    175175                        bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].size =
    176176                            components[i].inflated;
    177                        
     177
    178178                        str_cpy(bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].name,
    179179                            BOOTINFO_TASK_NAME_BUFLEN, components[i].name);
    180                        
     180
    181181                        bootinfo.taskmap.cnt++;
    182182                }
    183                
     183
    184184                dest[i] = (void *) top;
    185185                top += components[i].inflated;
    186186                cnt++;
    187187        }
    188        
     188
    189189        printf("\nInflating components ... ");
    190        
     190
    191191        /*
    192192         * We will use the next available address for a copy of each component to
     
    197197        for (i = cnt; i > 0; i--) {
    198198                printf("%s ", components[i - 1].name);
    199                
     199
    200200                /*
    201201                 * Copy the component to a location which is guaranteed not to
     
    203203                 */
    204204                memmove((void *) top, components[i - 1].addr, components[i - 1].size);
    205                
     205
    206206                int err = inflate((void *) top, components[i - 1].size,
    207207                    dest[i - 1], components[i - 1].inflated);
    208                
     208
    209209                if (err != EOK) {
    210210                        printf("\n%s: Inflating error %d, halting.\n",
     
    213213                }
    214214        }
    215        
     215
    216216        printf(".\n");
    217217
     
    219219        read_sal_configuration();
    220220        read_pal_configuration();
    221        
     221
    222222        printf("Booting the kernel ...\n");
    223223        jump_to_kernel(&bootinfo);
  • boot/arch/ia64/src/pal.c

    r3061bc1 ra35b458  
    3535{
    3636        uint64_t proc_ratio;
    37        
     37
    3838        pal_static_call_0_1(PAL_FREQ_RATIOS, &proc_ratio);
    39        
     39
    4040        return proc_ratio;
    4141}
  • boot/arch/ia64/src/pal_asm.S

    r3061bc1 ra35b458  
    3838        srlz.i
    3939        srlz.d
    40        
     40
    4141        mov loc2 = gp
    4242        mov loc3 = rp
    43        
     43
    4444        addl loc4 = @gprel(pal_proc), gp
    4545
     
    4848        mov r30 = in2
    4949        mov r31 = in3 ;;
    50        
     50
    5151        ld8 loc4 = [loc4]
    5252        movl loc5 = 0f ;;
     
    6464        cmp.ne p8,p0 = 0, in5
    6565        cmp.ne p9,p0 = 0, in6 ;;
    66        
     66
    6767(p7)    st8 [in4] = r9
    6868(p8)    st8 [in5] = r10
    6969(p9)    st8 [in6] = r11
    70        
     70
    7171        mov gp = loc2
    7272        mov rp = loc3 ;;
    73        
     73
    7474        mov ar.pfs = loc0
    7575        br.ret.sptk.many rp
  • boot/arch/ia64/src/sal.c

    r3061bc1 ra35b458  
    7575{
    7676        uint64_t freq;
    77        
     77
    7878        sal_call_1_1(SAL_FREQ_BASE, 0, &freq);
    79        
     79
    8080        return freq;
    8181}
  • boot/arch/ia64/src/sal_asm.S

    r3061bc1 ra35b458  
    4545FUNCTION_BEGIN(sal_call)
    4646        alloc loc0 = ar.pfs, 8, 8, 8, 0
    47        
     47
    4848        adds sp = -STACK_SCRATCH_AREA, sp
    4949
    5050        mov loc1 = gp
    5151        mov loc2 = rp
    52        
     52
    5353        addl loc3 = @gprel(sal_proc), gp
    5454        addl loc4 = @gprel(sal_proc_gp), gp
    55        
     55
    5656        mov out0 = in0
    5757        mov out1 = in1
     
    6262        mov out6 = in6
    6363        mov out7 = in7 ;;
    64        
     64
    6565        ld8 loc3 = [loc3]
    6666        ld8 gp = [loc4]
     
    7373        ld8 loc6 = [r15]
    7474        ld8 loc7 = [r16]
    75        
     75
    7676        mov b6 = loc3 ;;
    7777        br.call.sptk.many rp = b6
    78        
     78
    7979        cmp.ne p7,p0 = 0, loc5
    8080        cmp.ne p8,p0 = 0, loc6
    8181        cmp.ne p9,p0 = 0, loc7 ;;
    82        
     82
    8383(p7)    st8 [loc5] = r9
    8484(p8)    st8 [loc6] = r10
    8585(p9)    st8 [loc7] = r11
    86        
     86
    8787        mov gp = loc1
    8888        mov rp = loc2
    8989
    9090        adds sp = STACK_SCRATCH_AREA, sp ;;
    91        
     91
    9292        mov ar.pfs = loc0
    9393        br.ret.sptk.many rp
  • boot/arch/ia64/src/ski.c

    r3061bc1 ra35b458  
    3737{
    3838        static bool initialized = false;
    39        
     39
    4040        if (initialized)
    4141                return;
     
    4848                : "r15", "r8"
    4949        );
    50        
     50
    5151        initialized = true;
    5252}
  • boot/arch/mips32/src/asm.S

    r3061bc1 ra35b458  
    5555        sw $a3, 0($a0)
    5656#endif
    57        
     57
    5858        /*
    5959         * Setup CPU map (on msim this code
     
    6262         */
    6363        la $a0, PA2KA(CPUMAP_OFFSET)
    64        
     64
    6565        sw $zero, 0($a0)
    6666        sw $zero, 4($a0)
    6767        sw $zero, 8($a0)
    6868        sw $zero, 12($a0)
    69        
     69
    7070        sw $zero, 16($a0)
    7171        sw $zero, 20($a0)
    7272        sw $zero, 24($a0)
    7373        sw $zero, 28($a0)
    74        
     74
    7575        sw $zero, 32($a0)
    7676        sw $zero, 36($a0)
    7777        sw $zero, 40($a0)
    7878        sw $zero, 44($a0)
    79        
     79
    8080        sw $zero, 48($a0)
    8181        sw $zero, 52($a0)
    8282        sw $zero, 56($a0)
    8383        sw $zero, 60($a0)
    84        
     84
    8585        sw $zero, 64($a0)
    8686        sw $zero, 68($a0)
    8787        sw $zero, 72($a0)
    8888        sw $zero, 76($a0)
    89        
     89
    9090        sw $zero, 80($a0)
    9191        sw $zero, 84($a0)
    9292        sw $zero, 88($a0)
    9393        sw $zero, 92($a0)
    94        
     94
    9595        sw $zero, 96($a0)
    9696        sw $zero, 100($a0)
    9797        sw $zero, 104($a0)
    9898        sw $zero, 108($a0)
    99        
     99
    100100        sw $zero, 112($a0)
    101101        sw $zero, 116($a0)
    102102        sw $zero, 120($a0)
    103103        sw $zero, 124($a0)
    104        
     104
    105105        lui $a1, 1
    106        
     106
    107107#ifdef MACHINE_msim
    108        
     108
    109109        /* Read dorder value */
    110110        la $k0, MSIM_DORDER_ADDRESS
    111111        lw $k1, ($k0)
    112        
     112
    113113        /*
    114114         * If we are not running on BSP
     
    117117        beq $k1, $zero, bsp
    118118        nop
    119        
     119
    120120        /* Record CPU presence */
    121121        sll $a2, $k1, 2
    122122        addu $a2, $a2, $a0
    123123        sw $a1, ($a2)
    124        
     124
    125125        loop:
    126126                j loop
    127127                nop
    128        
     128
    129129#endif
    130        
     130
    131131        bsp:
    132132                /* Record CPU presence */
    133133                sw $a1, ($a0)
    134                
     134
    135135                /* Setup initial stack */
    136136                la $sp, PA2KA(STACK_OFFSET)
    137                
     137
    138138                j bootstrap
    139139                nop
  • boot/arch/mips32/src/boot.S

    r3061bc1 ra35b458  
    3838.global start
    3939start:
    40        
     40
    4141        /* Setup CPU map (on msim this code
    4242           is executed in parallel on all CPUs,
    4343           but it not an issue) */
    4444        la $a0, CPUMAP
    45        
     45
    4646        sw $zero, 0($a0)
    4747        sw $zero, 4($a0)
    4848        sw $zero, 8($a0)
    4949        sw $zero, 12($a0)
    50        
     50
    5151        sw $zero, 16($a0)
    5252        sw $zero, 20($a0)
    5353        sw $zero, 24($a0)
    5454        sw $zero, 28($a0)
    55        
     55
    5656        sw $zero, 32($a0)
    5757        sw $zero, 36($a0)
    5858        sw $zero, 40($a0)
    5959        sw $zero, 44($a0)
    60        
     60
    6161        sw $zero, 48($a0)
    6262        sw $zero, 52($a0)
    6363        sw $zero, 56($a0)
    6464        sw $zero, 60($a0)
    65        
     65
    6666        sw $zero, 64($a0)
    6767        sw $zero, 68($a0)
    6868        sw $zero, 72($a0)
    6969        sw $zero, 76($a0)
    70        
     70
    7171        sw $zero, 80($a0)
    7272        sw $zero, 84($a0)
    7373        sw $zero, 88($a0)
    7474        sw $zero, 92($a0)
    75        
     75
    7676        sw $zero, 96($a0)
    7777        sw $zero, 100($a0)
    7878        sw $zero, 104($a0)
    7979        sw $zero, 108($a0)
    80        
     80
    8181        sw $zero, 112($a0)
    8282        sw $zero, 116($a0)
    8383        sw $zero, 120($a0)
    8484        sw $zero, 124($a0)
    85        
     85
    8686        lui $a1, 1
    87        
     87
    8888#ifdef MACHINE_msim
    89        
     89
    9090        /* Read dorder value */
    9191        la $k0, MSIM_DORDER_ADDRESS
    9292        lw $k1, ($k0)
    93        
     93
    9494        /* If we are not running on BSP
    9595           then end in an infinite loop  */
    9696        beq $k1, $zero, bsp
    9797        nop
    98        
     98
    9999        /* Record CPU presence */
    100100        sll $a2, $k1, 2
    101101        addu $a2, $a2, $a0
    102102        sw $a1, ($a2)
    103        
     103
    104104        loop:
    105105                j loop
    106106                nop
    107        
     107
    108108#endif
    109        
     109
    110110        bsp:
    111111                /* Record CPU presence */
    112112                sw $a1, ($a0)
    113                
     113
    114114                /* Setup initial stack */
    115115                la $sp, INITIAL_STACK
    116                
     116
    117117                j bootstrap
    118118                nop
  • boot/arch/mips32/src/main.c

    r3061bc1 ra35b458  
    4949{
    5050        version_print();
    51        
     51
    5252        printf("\nMemory statistics\n");
    5353        printf(" %p|%p: CPU map\n", (void *) PA2KA(CPUMAP_OFFSET),
     
    6161        printf(" %p|%p: bootloader entry point\n",
    6262            (void *) PA2KA(LOADER_OFFSET), (void *) LOADER_OFFSET);
    63        
     63
    6464        size_t i;
    6565        for (i = 0; i < COMPONENTS; i++)
     
    7070                    components[i].name, components[i].inflated,
    7171                    components[i].size);
    72        
     72
    7373        void *dest[COMPONENTS];
    7474        size_t top = 0;
     
    7777        for (i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) {
    7878                top = ALIGN_UP(top, PAGE_SIZE);
    79                
     79
    8080                if (i > 0) {
    8181                        bootinfo->tasks[bootinfo->cnt].addr = TOP2ADDR(top);
    8282                        bootinfo->tasks[bootinfo->cnt].size = components[i].inflated;
    83                        
     83
    8484                        str_cpy(bootinfo->tasks[bootinfo->cnt].name,
    8585                            BOOTINFO_TASK_NAME_BUFLEN, components[i].name);
    86                        
     86
    8787                        bootinfo->cnt++;
    8888                }
    89                
     89
    9090                dest[i] = TOP2ADDR(top);
    9191                top += components[i].inflated;
    9292                cnt++;
    9393        }
    94        
     94
    9595        printf("\nInflating components ... ");
    96        
     96
    9797        for (i = cnt; i > 0; i--) {
    9898#ifdef MACHINE_msim
     
    104104                }
    105105#endif
    106                
     106
    107107                printf("%s ", components[i - 1].name);
    108                
     108
    109109                int err = inflate(components[i - 1].addr, components[i - 1].size,
    110110                    dest[i - 1], components[i - 1].inflated);
    111                
     111
    112112                if (err != EOK) {
    113113                        printf("\n%s: Inflating error %d, halting.\n",
     
    116116                }
    117117        }
    118        
     118
    119119        printf(".\n");
    120        
     120
    121121        printf("Copying CPU map ... \n");
    122        
     122
    123123        bootinfo->cpumap = 0;
    124124        for (i = 0; i < CPUMAP_MAX_RECORDS; i++) {
     
    126126                        bootinfo->cpumap |= (1 << i);
    127127        }
    128        
     128
    129129        printf("Booting the kernel ... \n");
    130130        jump_to_kernel((void *) PA2KA(BOOT_OFFSET), bootinfo);
  • boot/arch/ppc32/src/asm.S

    r3061bc1 ra35b458  
    4848        li \reg, 0
    4949        sync
    50        
     50
    5151        .rept 64
    5252                tlbie \reg
    5353                addi \reg, \reg, 0x1000
    5454        .endr
    55        
     55
    5656        eieio
    5757        tlbsync
     
    6161.macro BAT_COMPUTE base size mask lower upper
    6262        # less than 128 KB -> no BAT
    63        
     63
    6464        lis \upper, 0x0002
    6565        cmpw \size, \upper
    6666        blt no_bat
    67        
     67
    6868        # mask = total >> 18
    69        
     69
    7070        li \upper, 18
    7171        srw \mask, \size, \upper
    72        
     72
    7373        # create Block Length mask by replicating
    7474        # the leading logical one 14 times
    75        
     75
    7676        li \upper, 14
    7777        mtctr \mask
    7878        li \upper, 1
    79        
     79
    8080        0:
    8181                # mask = (mask >> 1) | mask
    82                
     82
    8383                srw \lower, \mask, \upper
    8484                or \mask, \mask, \lower
    85                
     85
    8686                bdnz 0b
    87        
     87
    8888        # mask = mask & 0x07ff
    8989        # (BAT can map up to 256 MB)
    90        
     90
    9191        andi. \mask, \mask, 0x07ff
    92        
     92
    9393        # mask = (mask << 2) | 0x0002
    9494        # (priviledged access only)
    95        
     95
    9696        li \upper, 2
    9797        slw \mask, \mask, \upper
    9898        ori \mask, \mask, 0x0002
    99        
     99
    100100        lis \upper, (0x8000 + \base)
    101101        or \upper, \upper, \mask
    102        
     102
    103103        lis \lower, \base
    104104        ori \lower, \lower, 0x0002
     
    111111        addi r4, r4, ofw_cif@l
    112112        stw r5, 0(r4)
    113        
     113
    114114        bl ofw_init
    115115        b bootstrap
     
    127127        # r5 = pages to translate
    128128        # r6 = real mode meeting point (physical address)
    129        
     129
    130130        # disable interrupts
    131        
     131
    132132        mfmsr r31
    133133        rlwinm r31, r31, 0, 17, 15
    134134        mtmsr r31
    135        
     135
    136136        # set real mode meeting point physical address
    137        
     137
    138138        mtspr srr0, r6
    139        
     139
    140140        # jump to real_mode
    141        
     141
    142142        mfmsr r31
    143143        lis r30, ~0@h
     
    145145        and r31, r31, r30
    146146        mtspr srr1, r31
    147        
     147
    148148        sync
    149149        isync
     
    155155.align PAGE_WIDTH
    156156SYMBOL(real_mode)
    157        
     157
    158158        # arguments:
    159159        # r3 = bootinfo (physical address)
    160160        # r4 = translate table (physical address)
    161161        # r5 = pages to translate
    162        
     162
    163163        # move the images of components to the proper
    164164        # location using the translate table
    165        
     165
    166166        li r31, PAGE_SIZE >> 2
    167167        li r30, 0
    168        
     168
    169169        page_copy:
    170                
     170
    171171                cmpwi r5, 0
    172172                beq copy_end
    173                
     173
    174174                mtctr r31
    175175                lwz r29, 0(r4)
    176                
     176
    177177                copy_loop:
    178                        
     178
    179179                        lwz r28, 0(r29)
    180180                        stw r28, 0(r30)
    181                        
     181
    182182                        SMC_COHERENCY r30
    183                        
     183
    184184                        addi r29, r29, 4
    185185                        addi r30, r30, 4
    186                        
     186
    187187                        bdnz copy_loop
    188                
     188
    189189                addi r4, r4, 4
    190190                subi r5, r5, 1
    191191                b page_copy
    192        
     192
    193193        copy_end:
    194        
     194
    195195        # initially fill segment registers
    196        
     196
    197197        li r31, 0
    198        
     198
    199199        li r29, 8
    200200        mtctr r29
    201201        li r30, 0                     # ASID 0 (VSIDs 0 .. 7)
    202        
     202
    203203        seg_fill_uspace:
    204        
     204
    205205                mtsrin r30, r31
    206206                addi r30, r30, 1
    207207                addis r31, r31, 0x1000    # move to next SR
    208                
     208
    209209                bdnz seg_fill_uspace
    210        
     210
    211211        li r29, 8
    212212        mtctr r29
    213213        lis r30, 0x4000               # priviledged access only
    214214        ori r30, r30, 8               # ASID 0 (VSIDs 8 .. 15)
    215        
     215
    216216        seg_fill_kernel:
    217        
     217
    218218                mtsrin r30, r31
    219219                addi r30, r30, 1
    220220                addis r31, r31, 0x1000    # move to next SR
    221                
     221
    222222                bdnz seg_fill_kernel
    223        
     223
    224224        # invalidate block address translation registers
    225        
     225
    226226        li r30, 0
    227        
     227
    228228        mtspr ibat0u, r30
    229229        mtspr ibat0l, r30
    230        
     230
    231231        mtspr ibat1u, r30
    232232        mtspr ibat1l, r30
    233        
     233
    234234        mtspr ibat2u, r30
    235235        mtspr ibat2l, r30
    236        
     236
    237237        mtspr ibat3u, r30
    238238        mtspr ibat3l, r30
    239        
     239
    240240        mtspr dbat0u, r30
    241241        mtspr dbat0l, r30
    242        
     242
    243243        mtspr dbat1u, r30
    244244        mtspr dbat1l, r30
    245        
     245
    246246        mtspr dbat2u, r30
    247247        mtspr dbat2l, r30
    248        
     248
    249249        mtspr dbat3u, r30
    250250        mtspr dbat3l, r30
    251        
     251
    252252        # create empty Page Hash Table
    253253        # on top of memory, size 64 KB
    254        
     254
    255255        lwz r31, 4(r3)                # r31 = memory size
    256        
     256
    257257        lis r30, 65536@h
    258258        ori r30, r30, 65536@l         # r30 = 65536
    259        
     259
    260260        subi r29, r30, 1              # r29 = 65535
    261        
     261
    262262        sub r31, r31, r30
    263263        andc r31, r31, r29            # pht = ALIGN_DOWN(memory_size - 65536, 65536)
    264        
     264
    265265        mtsdr1 r31
    266        
     266
    267267        li r29, 2
    268268        srw r30, r30, r29             # r30 = 16384
    269269        li r29, 0
    270        
     270
    271271        pht_clear:
    272                
     272
    273273                # write zeroes
    274                
     274
    275275                stw r29, 0(r31)
    276276                FLUSH_DCACHE r31
    277                
     277
    278278                addi r31, r31, 4
    279279                subi r30, r30, 4
    280                
     280
    281281                cmpwi r30, 0
    282282                beq clear_end
    283                
     283
    284284                bdnz pht_clear
    285                
     285
    286286        clear_end:
    287        
     287
    288288        # create BAT identity mapping
    289        
     289
    290290        lwz r31, 4(r3)                # r31 = memory size
    291        
     291
    292292        lis r30, 268435456@h
    293293        ori r30, r30, 268435456@l     # r30 = 256 MB
    294        
     294
    295295        # BAT0
    296        
     296
    297297        # r29 = min(r31, r30)
    298        
     298
    299299        cmpw r31, r30
    300300        blt bat0_r31
    301        
     301
    302302                mr r29, r30
    303303                b bat0_r30
    304        
     304
    305305        bat0_r31:
    306        
     306
    307307                mr r29, r31
    308        
     308
    309309        bat0_r30:
    310        
     310
    311311        BAT_COMPUTE 0x0000 r29 r28 r27 r26
    312312        mtspr ibat0u, r26
    313313        mtspr ibat0l, r27
    314        
     314
    315315        mtspr dbat0u, r26
    316316        mtspr dbat0l, r27
    317        
     317
    318318        # BAT1
    319        
     319
    320320        sub r31, r31, r29             # r31 = r31 - r29
    321        
     321
    322322        # r29 = min(r31, r30)
    323        
     323
    324324        cmpw r31, r30
    325325        blt bat1_r31
    326        
     326
    327327                mr r29, r30
    328328                b bat1_r30
    329        
     329
    330330        bat1_r31:
    331        
     331
    332332                mr r29, r31
    333        
     333
    334334        bat1_r30:
    335        
     335
    336336        BAT_COMPUTE 0x1000 r29 r28 r27 r26
    337337        mtspr ibat1u, r26
    338338        mtspr ibat1l, r27
    339        
     339
    340340        mtspr dbat1u, r26
    341341        mtspr dbat1l, r27
    342        
     342
    343343        # BAT2
    344        
     344
    345345        sub r31, r31, r29             # r31 = r31 - r29
    346        
     346
    347347        # r29 = min(r31, r30)
    348        
     348
    349349        cmpw r31, r30
    350350        blt bat2_r31
    351        
     351
    352352                mr r29, r30
    353353                b bat2_r30
    354        
     354
    355355        bat2_r31:
    356        
     356
    357357                mr r29, r31
    358        
     358
    359359        bat2_r30:
    360        
     360
    361361        BAT_COMPUTE 0x2000 r29 r28 r27 r26
    362362        mtspr ibat2u, r26
    363363        mtspr ibat2l, r27
    364        
     364
    365365        mtspr dbat2u, r26
    366366        mtspr dbat2l, r27
    367        
     367
    368368        # BAT3
    369        
     369
    370370        sub r31, r31, r29             # r31 = r31 - r29
    371        
     371
    372372        # r29 = min(r31, r30)
    373        
     373
    374374        cmpw r31, r30
    375375        blt bat3_r31
    376        
     376
    377377                mr r29, r30
    378378                b bat3_r30
    379        
     379
    380380        bat3_r31:
    381        
     381
    382382                mr r29, r31
    383        
     383
    384384        bat3_r30:
    385        
     385
    386386        BAT_COMPUTE 0x3000 r29 r28 r27 r26
    387387        mtspr ibat3u, r26
    388388        mtspr ibat3l, r27
    389        
     389
    390390        mtspr dbat3u, r26
    391391        mtspr dbat3l, r27
    392        
     392
    393393        no_bat:
    394        
     394
    395395        # flush TLB
    396        
     396
    397397        TLB_FLUSH r31
    398        
     398
    399399        # start the kernel
    400400        #
     
    404404        # sprg3 = physical memory size
    405405        # sp = 0 (enforces the usage of sprg0 as exception stack)
    406        
     406
    407407        lis r31, PA2KA(BOOT_OFFSET)@ha
    408408        addi r31, r31, PA2KA(BOOT_OFFSET)@l
    409409        mtspr srr0, r31
    410        
     410
    411411        lis r31, BOOT_OFFSET@ha
    412412        addi r31, r31, BOOT_OFFSET@l
    413413        mtsprg0 r31
    414        
     414
    415415        # bootinfo starts with a 64 bit integer containing
    416416        # the physical memory size, get the lower 4 bytes
    417        
     417
    418418        lwz r31, 4(r3)
    419419        mtsprg3 r31
    420        
     420
    421421        li sp, 0
    422        
     422
    423423        mfmsr r31
    424424        ori r31, r31, (msr_ir | msr_dr)@l
    425425        mtspr srr1, r31
    426        
     426
    427427        sync
    428428        isync
  • boot/arch/ppc32/src/main.c

    r3061bc1 ra35b458  
    6060        version_print();
    6161        ofw_memmap(&bootinfo.memmap);
    62        
     62
    6363        void *bootinfo_pa = ofw_translate(&bootinfo);
    6464        void *real_mode_pa = ofw_translate(&real_mode);
    6565        void *loader_address_pa = ofw_translate((void *) LOADER_ADDRESS);
    66        
     66
    6767        printf("\nMemory statistics (total %llu MB)\n", bootinfo.memmap.total >> 20);
    6868        printf(" %p|%p: real mode trampoline\n", &real_mode, real_mode_pa);
     
    7272        printf(" %p|%p: loader entry point\n",
    7373            (void *) LOADER_ADDRESS, loader_address_pa);
    74        
     74
    7575        size_t i;
    7676        for (i = 0; i < COMPONENTS; i++)
     
    7878                    ofw_translate(components[i].addr), components[i].name,
    7979                    components[i].inflated, components[i].size);
    80        
     80
    8181        size_t dest[COMPONENTS];
    8282        size_t top = 0;
     
    8585        for (i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) {
    8686                top = ALIGN_UP(top, PAGE_SIZE);
    87                
     87
    8888                if (i > 0) {
    8989                        bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].addr =
     
    9191                        bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].size =
    9292                            components[i].inflated;
    93                        
     93
    9494                        str_cpy(bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].name,
    9595                            BOOTINFO_TASK_NAME_BUFLEN, components[i].name);
    96                        
     96
    9797                        bootinfo.taskmap.cnt++;
    9898                }
    99                
     99
    100100                dest[i] = top;
    101101                top += components[i].inflated;
    102102                cnt++;
    103103        }
    104        
     104
    105105        if (top >= (size_t) loader_address_pa) {
    106106                printf("Inflated components overlap loader area.\n");
     
    108108                halt();
    109109        }
    110        
     110
    111111        void *balloc_base;
    112112        void *balloc_base_pa;
     
    114114            BALLOC_MAX_SIZE, loader_address_pa);
    115115        printf(" %p|%p: boot allocator area\n", balloc_base, balloc_base_pa);
    116        
     116
    117117        void *inflate_base;
    118118        void *inflate_base_pa;
     
    120120            loader_address_pa);
    121121        printf(" %p|%p: inflate area\n", inflate_base, inflate_base_pa);
    122        
     122
    123123        uintptr_t balloc_start = ALIGN_UP(top, PAGE_SIZE);
    124124        size_t pages = (balloc_start + ALIGN_UP(BALLOC_MAX_SIZE, PAGE_SIZE))
     
    129129            pages * sizeof(void *), loader_address_pa);
    130130        printf(" %p|%p: translate table\n", transtable, transtable_pa);
    131        
     131
    132132        check_overlap("boot allocator area", balloc_base_pa, pages);
    133133        check_overlap("inflate area", inflate_base_pa, pages);
    134134        check_overlap("translate table", transtable_pa, pages);
    135        
     135
    136136        printf("\nInflating components ... ");
    137        
     137
    138138        for (i = cnt; i > 0; i--) {
    139139                printf("%s ", components[i - 1].name);
    140                
     140
    141141                int err = inflate(components[i - 1].addr, components[i - 1].size,
    142142                    inflate_base + dest[i - 1], components[i - 1].inflated);
    143                
     143
    144144                if (err != EOK) {
    145145                        printf("\n%s: Inflating error %d, halting.\n",
     
    148148                }
    149149        }
    150        
     150
    151151        printf(".\n");
    152        
     152
    153153        printf("Setting up boot allocator ...\n");
    154154        balloc_init(&bootinfo.ballocs, balloc_base, PA2KA(balloc_start),
    155155            BALLOC_MAX_SIZE);
    156        
     156
    157157        printf("Setting up screens ...\n");
    158158        ofw_setup_screens();
    159        
     159
    160160        printf("Canonizing OpenFirmware device tree ...\n");
    161161        bootinfo.ofw_root = ofw_tree_build();
    162        
     162
    163163        printf("Setting up translate table ...\n");
    164164        for (i = 0; i < pages; i++) {
    165165                uintptr_t off = i << PAGE_WIDTH;
    166166                void *phys;
    167                
     167
    168168                if (off < balloc_start)
    169169                        phys = ofw_translate(inflate_base + off);
    170170                else
    171171                        phys = ofw_translate(balloc_base + off - balloc_start);
    172                
     172
    173173                ((void **) transtable)[i] = phys;
    174174        }
    175        
     175
    176176        printf("Booting the kernel...\n");
    177177        jump_to_kernel(bootinfo_pa, transtable_pa, pages, real_mode_pa);
  • boot/arch/ppc32/src/ofw.c

    r3061bc1 ra35b458  
    4343        if (ch == '\n')
    4444                ofw_putchar('\r');
    45        
     45
    4646        if (ascii_check(ch))
    4747                ofw_putchar(ch);
  • boot/arch/riscv64/src/asm.S

    r3061bc1 ra35b458  
    8585        li x30, 0
    8686        li x31, 0
    87        
     87
    8888        /* Set up stack, create stack frame */
    8989        la sp, boot_stack + BOOT_STACK_SIZE
    9090        addi sp, sp, -16
    91        
     91
    9292        j bootstrap
    9393
     
    9797        /* Enable performance counters access in supervisor mode */
    9898        csrsi mcounteren, MCOUNTEREN_CY_MASK | MCOUNTEREN_TM_MASK | MCOUNTEREN_IR_MASK
    99        
     99
    100100        /* Setup SV48 paging for supervisor mode */
    101101        la t0, ptl_0
    102102        srli t0, t0, 12
    103        
     103
    104104        li t1, SATP_PFN_MASK
    105105        and t0, t0, t1
    106        
     106
    107107        li t1, SATP_MODE_SV48
    108108        or t0, t0, t1
    109        
     109
    110110        csrw sptbr, t0
    111        
     111
    112112        /* Jump to supervisor mode */
    113113        csrr t0, mstatus
    114        
     114
    115115        li t1, ~MSTATUS_MPP_MASK
    116116        and t0, t0, t1
    117        
     117
    118118        /*
    119119         * TODO: Enable running with Supervisor User Mode
     
    122122        li t1, MSTATUS_MPP_SUPERVISOR | MSTATUS_SUM_MASK
    123123        or t0, t0, t1
    124        
     124
    125125        csrw mstatus, t0
    126        
     126
    127127        li ra, PA2KA(BOOT_OFFSET)
    128128        csrw mepc, ra
    129        
     129
    130130        mret
    131131FUNCTION_END(jump_to_kernel)
  • boot/arch/riscv64/src/main.c

    r3061bc1 ra35b458  
    4848{
    4949        version_print();
    50        
     50
    5151        bootinfo.htif_frame = ((uintptr_t) &htif_page) >> PAGE_WIDTH;
    5252        bootinfo.pt_frame = ((uintptr_t) &pt_page) >> PAGE_WIDTH;
    53        
     53
    5454        bootinfo.ucbinfo.tohost =
    5555            (volatile uint64_t *) PA2KA((uintptr_t) &tohost);
    5656        bootinfo.ucbinfo.fromhost =
    5757            (volatile uint64_t *) PA2KA((uintptr_t) &fromhost);
    58        
     58
    5959        // FIXME TODO: read from device tree
    6060        bootinfo.physmem_start = PHYSMEM_START;
     
    6363        bootinfo.memmap.zones[0].start = (void *) PHYSMEM_START;
    6464        bootinfo.memmap.zones[0].size = PHYSMEM_SIZE;
    65        
     65
    6666        printf("\nMemory statistics (total %lu MB, starting at %p)\n\n",
    6767            bootinfo.memmap.total >> 20, (void *) bootinfo.physmem_start);
    6868        printf(" %p: boot info structure\n", &bootinfo);
    69        
     69
    7070        uintptr_t top = BOOT_OFFSET;
    71        
     71
    7272        for (size_t i = 0; i < COMPONENTS; i++) {
    7373                printf(" %p: %s image (%zu/%zu bytes)\n", components[i].addr,
    7474                    components[i].name, components[i].inflated,
    7575                    components[i].size);
    76                
     76
    7777                uintptr_t tail = (uintptr_t) components[i].addr +
    7878                    components[i].size;
     
    8383                }
    8484        }
    85        
     85
    8686        printf(" %p: inflate area\n", (void *) top);
    87        
     87
    8888        void *kernel_entry = NULL;
    8989        void *dest[COMPONENTS];
    9090        size_t cnt = 0;
    9191        bootinfo.taskmap.cnt = 0;
    92        
     92
    9393        for (size_t i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) {
    9494                top = ALIGN_UP(top, PAGE_SIZE);
    95                
     95
    9696                if (i > 0) {
    9797                        bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].addr =
     
    9999                        bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].size =
    100100                            components[i].inflated;
    101                        
     101
    102102                        str_cpy(bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].name,
    103103                            BOOTINFO_TASK_NAME_BUFLEN, components[i].name);
    104                        
     104
    105105                        bootinfo.taskmap.cnt++;
    106106                } else
    107107                        kernel_entry = (void *) PA2KA(top);
    108                
     108
    109109                dest[i] = (void *) top;
    110110                top += components[i].inflated;
    111111                cnt++;
    112112        }
    113        
     113
    114114        printf(" %p: kernel entry point\n", kernel_entry);
    115        
     115
    116116        if (top >= bootinfo.physmem_start + bootinfo.memmap.total) {
    117117                printf("Not enough physical memory available.\n");
     
    119119                halt();
    120120        }
    121        
     121
    122122        printf("\nInflating components ... ");
    123        
     123
    124124        for (size_t i = cnt; i > 0; i--) {
    125125                printf("%s ", components[i - 1].name);
    126                
     126
    127127                int err = inflate(components[i - 1].addr, components[i - 1].size,
    128128                    dest[i - 1], components[i - 1].inflated);
    129                
     129
    130130                if (err != EOK) {
    131131                        printf("\n%s: Inflating error %d, halting.\n",
     
    134134                }
    135135        }
    136        
     136
    137137        printf(".\n");
    138        
     138
    139139        printf("Booting the kernel...\n");
    140140        jump_to_kernel(PA2KA(&bootinfo));
  • boot/arch/riscv64/src/ucb.c

    r3061bc1 ra35b458  
    3939        if (!val)
    4040                return;
    41        
     41
    4242        fromhost = 0;
    4343}
     
    4848            (((uint64_t) cmd) << 48) |
    4949            (payload & UINT64_C(0xffffffffffff));
    50        
     50
    5151        while (tohost)
    5252                poll_fromhost();
    53        
     53
    5454        tohost = val;
    5555}
  • boot/arch/sparc64/src/asm.S

    r3061bc1 ra35b458  
    65651:
    6666        ! Disable interrupts and disable address masking.
    67        
     67
    6868        wrpr %g0, PSTATE_PRIV_BIT, %pstate
    69        
     69
    7070        wrpr %g0, NWINDOWS - 2, %cansave   ! Set maximum saveable windows
    7171        wrpr %g0, 0, %canrestore           ! Get rid of windows we will never need again
    7272        wrpr %g0, 0, %otherwin             ! Make sure the window state is consistent
    7373        wrpr %g0, NWINDOWS - 1, %cleanwin  ! Prevent needless clean_window traps for kernel
    74        
     74
    7575        set initial_stack, %sp
    7676        add %sp, -STACK_BIAS, %sp
    77        
     77
    7878        set ofw_cif, %l0
    79        
     79
    8080        ! Initialize OpenFirmware
    81        
     81
    8282        call ofw_init
    8383        stx %o4, [%l0]
    84        
     84
    8585        ba %xcc, bootstrap
    8686        nop
     
    105105         * 3. Flush instruction pipeline.
    106106         */
    107        
     107
    108108        /*
    109109         * US3 processors have a write-invalidate cache, so explicitly
     
    115115        be %xcc, 1f
    116116        nop
    117        
     117
    118118        0:
    119119                call icache_flush
    120120                nop
    121        
     121
    122122        1:
    123123                membar #StoreStore
    124        
     124
    125125        /*
    126126         * Flush the instruction pipeline.
    127127         */
    128128        flush %i7
    129        
     129
    130130        ! Jump to kernel
    131131        jmp %o3
     
    138138        set ((ICACHE_SIZE - ICACHE_LINE_SIZE) | ICACHE_SET_BIT), %g1
    139139        stxa %g0, [%g1] ASI_ICACHE_TAG
    140        
     140
    141141        0:
    142142                membar #Sync
    143143                subcc %g1, ICACHE_LINE_SIZE, %g1
    144144                bnz,pt %xcc, 0b
    145        
     145
    146146        stxa %g0, [%g1] ASI_ICACHE_TAG
    147147        membar #Sync
    148148        retl
    149        
     149
    150150        ! SF Erratum #51
    151        
     151
    152152        nop
    153153#else
     
    161161        set ofw_cif, %l0
    162162        ldx [%l0], %l0
    163        
     163
    164164        rdpr %pstate, %l1
    165165        and %l1, ~PSTATE_AM_BIT, %l2
    166166        wrpr %l2, 0, %pstate
    167        
     167
    168168        jmpl %l0, %o7
    169169        mov %i0, %o0
    170        
     170
    171171        wrpr %l1, 0, %pstate
    172        
     172
    173173        ret
    174174        restore %o0, 0, %o0
  • boot/arch/sparc64/src/main.c

    r3061bc1 ra35b458  
    8686        phandle root = ofw_find_device("/");
    8787        char compatible[OFW_TREE_PROPERTY_MAX_VALUELEN];
    88        
     88
    8989        if (ofw_get_property(root, "compatible", compatible,
    9090            OFW_TREE_PROPERTY_MAX_VALUELEN) <= 0) {
     
    9393                return;
    9494        }
    95        
     95
    9696        if (str_cmp(compatible, "sun4v") != 0) {
    9797                /*
     
    122122                : [ver] "=r" (ver)
    123123        );
    124        
     124
    125125        ver = (ver << 16) >> 48;
    126        
     126
    127127        if ((ver >= FIRST_US3_CPU) && (ver <= LAST_US3_CPU)) {
    128128                subarch = SUBARCH_US3;
    129                
     129
    130130                if (ver == US_IIIi_CODE)
    131131                        mid_mask = (1 << 5) - 1;
    132132                else
    133133                        mid_mask = (1 << 10) - 1;
    134                
     134
    135135        } else if (ver < FIRST_US3_CPU) {
    136136                subarch = SUBARCH_US;
     
    193193{
    194194        version_print();
    195        
     195
    196196        arch_detect();
    197197        if (arch == ARCH_SUN4U)
     
    199199        else
    200200                subarch = SUBARCH_UNKNOWN;
    201        
     201
    202202        bootinfo.physmem_start = ofw_get_physmem_start();
    203203        ofw_memmap(&bootinfo.memmap);
     
    205205        if (arch == ARCH_SUN4V)
    206206                sun4v_fixups();
    207        
     207
    208208        void *bootinfo_pa = ofw_translate(&bootinfo);
    209209        void *kernel_address_pa = ofw_translate((void *) KERNEL_ADDRESS);
    210210        void *loader_address_pa = ofw_translate((void *) LOADER_ADDRESS);
    211        
     211
    212212        printf("\nMemory statistics (total %" PRIu64 " MB, starting at %p)\n",
    213213            bootinfo.memmap.total >> 20, (void *) bootinfo.physmem_start);
     
    217217        printf(" %p|%p: loader entry point\n",
    218218            (void *) LOADER_ADDRESS, (void *) loader_address_pa);
    219        
     219
    220220        size_t i;
    221221        for (i = 0; i < COMPONENTS; i++)
     
    223223                    ofw_translate(components[i].addr), components[i].name,
    224224                    components[i].inflated, components[i].size);
    225        
     225
    226226        void *dest[COMPONENTS];
    227227        size_t top = KERNEL_ADDRESS;
     
    230230        for (i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) {
    231231                top = ALIGN_UP(top, PAGE_SIZE);
    232                
     232
    233233                if (i > 0) {
    234234                        bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].addr =
     
    236236                        bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].size =
    237237                            components[i].inflated;
    238                        
     238
    239239                        str_cpy(bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].name,
    240240                            BOOTINFO_TASK_NAME_BUFLEN, components[i].name);
    241                        
     241
    242242                        bootinfo.taskmap.cnt++;
    243243                }
    244                
     244
    245245                dest[i] = (void *) top;
    246246                top += components[i].inflated;
    247247                cnt++;
    248248        }
    249        
     249
    250250        printf("\nInflating components ... ");
    251        
     251
    252252        for (i = cnt; i > 0; i--) {
    253253                printf("%s ", components[i - 1].name);
    254                
     254
    255255                /*
    256256                 * At this point, we claim and map the physical memory that we
     
    263263                ofw_claim_phys(bootinfo.physmem_start + dest[i - 1],
    264264                    ALIGN_UP(components[i - 1].inflated, PAGE_SIZE));
    265                
     265
    266266                ofw_map(bootinfo.physmem_start + dest[i - 1], dest[i - 1],
    267267                    ALIGN_UP(components[i - 1].inflated, PAGE_SIZE), -1);
    268                
     268
    269269                int err = inflate(components[i - 1].addr, components[i - 1].size,
    270270                    dest[i - 1], components[i - 1].inflated);
    271                
     271
    272272                if (err != EOK) {
    273273                        printf("\n%s: Inflating error %d, halting.\n",
     
    276276                }
    277277        }
    278        
     278
    279279        printf(".\n");
    280        
     280
    281281        /*
    282282         * Claim and map the physical memory for the boot allocator.
     
    290290        balloc_init(&bootinfo.ballocs, balloc_base, (uintptr_t) balloc_base,
    291291            BALLOC_MAX_SIZE);
    292        
     292
    293293        printf("Setting up screens ...\n");
    294294        ofw_setup_screens();
    295        
     295
    296296        printf("Canonizing OpenFirmware device tree ...\n");
    297297        bootinfo.ofw_root = ofw_tree_build();
    298        
     298
    299299        if (arch == ARCH_SUN4U)
    300300                sun4u_smp();
    301        
     301
    302302        printf("Booting the kernel ...\n");
    303303        jump_to_kernel(bootinfo.physmem_start | BSP_PROCESSOR, &bootinfo, subarch,
  • boot/arch/sparc64/src/ofw.c

    r3061bc1 ra35b458  
    4747        if (ch == '\n')
    4848                ofw_putchar('\r');
    49        
     49
    5050        if (ascii_check(ch))
    5151                ofw_putchar(ch);
     
    7272{
    7373        size_t cpus;
    74        
     74
    7575        for (cpus = 0; (child != 0) && (child != (phandle) -1);
    7676            child = ofw_get_peer_node(child), cpus++) {
    7777                char type_name[OFW_TREE_PROPERTY_MAX_VALUELEN];
    78                
     78
    7979                if (ofw_get_property(child, "device_type", type_name,
    8080                    OFW_TREE_PROPERTY_MAX_VALUELEN) > 0) {
    8181                        type_name[OFW_TREE_PROPERTY_MAX_VALUELEN - 1] = 0;
    82                        
     82
    8383                        if (str_cmp(type_name, "cpu") == 0) {
    8484                                uint32_t mid;
    85                                
     85
    8686                                /*
    8787                                 * "upa-portid" for US, "portid" for US-III,
     
    9292                                    && (ofw_get_property(child, "cpuid", &mid, sizeof(mid)) <= 0))
    9393                                        continue;
    94                                
     94
    9595                                if (current_mid != mid) {
    9696                                        /*
     
    104104                }
    105105        }
    106        
     106
    107107        return cpus;
    108108}
     
    115115        /* Get the current CPU MID */
    116116        uint64_t current_mid;
    117        
     117
    118118        asm volatile (
    119119                "ldxa [%[zero]] %[asi], %[current_mid]\n"
     
    122122                  [asi] "i" (ASI_ICBUS_CONFIG)
    123123        );
    124        
     124
    125125        current_mid >>= ICBUS_CONFIG_MID_SHIFT;
    126126        current_mid &= mid_mask;
    127        
     127
    128128        /* Wake up the CPUs */
    129        
     129
    130130        phandle cpus_parent = ofw_find_device("/ssm@0,0");
    131131        if ((cpus_parent == 0) || (cpus_parent == (phandle) -1))
    132132                cpus_parent = ofw_find_device("/");
    133        
     133
    134134        phandle node = ofw_get_child_node(cpus_parent);
    135135        size_t cpus = wake_cpus_in_node(node, current_mid, physmem_start);
    136        
     136
    137137        while ((node != 0) && (node != (phandle) -1)) {
    138138                char name[OFW_TREE_PROPERTY_MAX_VALUELEN];
    139                
     139
    140140                if (ofw_get_property(node, "name", name,
    141141                    OFW_TREE_PROPERTY_MAX_VALUELEN) > 0) {
    142142                        name[OFW_TREE_PROPERTY_MAX_VALUELEN - 1] = 0;
    143                        
     143
    144144                        if (str_cmp(name, "cmp") == 0) {
    145145                                phandle subnode = ofw_get_child_node(node);
     
    148148                        }
    149149                }
    150                
     150
    151151                node = ofw_get_peer_node(node);
    152152        }
    153        
     153
    154154        if (cpus == 0)
    155155                printf("Warning: Unable to get CPU properties.\n");
     
    169169                halt();
    170170        }
    171        
     171
    172172        return ((((uintptr_t) memreg[0]) << 32) | memreg[1]);
    173173}
Note: See TracChangeset for help on using the changeset viewer.