Changeset e731b0d in mainline for boot/arch/sparc64


Ignore:
Timestamp:
2009-08-20T16:58:55Z (16 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b9c7425
Parents:
a11099f
Message:

make ppc32 OFW usage on par with sparc64, make appropriate modifications elsewhere

  • introduce ofw_tree_walk_by_device_type() to gather all OFW devices of a given type
  • ppc32 uses canonized OFW tree, mac-io and display devices are detected in kernel (not by the boot loader) by means of device type
  • various busses (PCI, EBUS, etc.) stay sparc64 specific for now
  • boot memcpy() is defined in a common way
  • BALLOC_MAX_SIZE is platform-dependent
  • ppc32 and sparc64 boot loaders cleanup (removal of obsolete stuff, data is not passed by global variables if not necessary, etc.)
  • balloc and OFW tree canonizer have now a provision to support different mapping of the data during boot time and kernel run-time
  • OFW tree canonizer uses balloc_rebase() to store pointers suitable for access during kernel run-time (with potentially different memory mapping than during boot time)
Location:
boot/arch/sparc64/loader
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/sparc64/loader/asm.S

    ra11099f re731b0d  
    3131#include <register.h>
    3232
    33 .register       %g2, #scratch
    34 .register       %g3, #scratch
     33.register %g2, #scratch
     34.register %g3, #scratch
    3535
    3636.text
     
    4343        ba %xcc, halt
    4444        nop
     45
     46memcpy:
     47        mov %o0, %o3      ! save dst
     48        add %o1, 7, %g1
     49        and %g1, -8, %g1
     50        cmp %o1, %g1
     51        be,pn %xcc, 3f
     52        add %o0, 7, %g1
     53        mov 0, %g3
    4554       
    46 memcpy:
    47         mov     %o0, %o3                ! save dst
    48         add     %o1, 7, %g1
    49         and     %g1, -8, %g1
    50         cmp     %o1, %g1
    51         be,pn   %xcc, 3f
    52         add     %o0, 7, %g1
    53         mov     0, %g3
    54 0:
    55         brz,pn  %o2, 2f
    56         mov     0, %g2
    57 1:
    58         ldub    [%g3 + %o1], %g1
    59         add     %g2, 1, %g2
    60         cmp     %o2, %g2
    61         stb     %g1, [%g3 + %o0]
    62         bne,pt  %xcc, 1b
    63         mov     %g2, %g3
    64 2:
    65         jmp     %o7 + 8                 ! exit point
    66         mov     %o3, %o0
    67 3:
    68         and     %g1, -8, %g1
    69         cmp     %o0, %g1
    70         bne,pt  %xcc, 0b
    71         mov     0, %g3
    72         srlx    %o2, 3, %g4
    73         brz,pn  %g4, 5f
    74         mov     0, %g5
    75 4:
    76         sllx    %g3, 3, %g2
    77         add     %g5, 1, %g3
    78         ldx     [%o1 + %g2], %g1
    79         mov     %g3, %g5
    80         cmp     %g4, %g3
    81         bne,pt  %xcc, 4b
    82         stx     %g1, [%o0 + %g2]
    83 5:
    84         and     %o2, 7, %o2
    85         brz,pn  %o2, 2b
    86         sllx    %g4, 3, %g1
    87         mov     0, %g2
    88         add     %g1, %o0, %o0
    89         add     %g1, %o1, %g4
    90         mov     0, %g3
    91 6:
    92         ldub    [%g2 + %g4], %g1
    93         stb     %g1, [%g2 + %o0]
    94         add     %g3, 1, %g2
    95         cmp     %o2, %g2
    96         bne,pt  %xcc, 6b
    97         mov     %g2, %g3
    98 
    99         jmp     %o7 + 8                 ! exit point
    100         mov     %o3, %o0
     55        0:
     56                brz,pn %o2, 2f
     57                mov 0, %g2
     58       
     59        1:
     60                ldub [%g3 + %o1], %g1
     61                add %g2, 1, %g2
     62                cmp %o2, %g2
     63                stb %g1, [%g3 + %o0]
     64                bne,pt %xcc, 1b
     65                mov %g2, %g3
     66       
     67        2:
     68                jmp %o7 + 8   ! exit point
     69                mov %o3, %o0
     70       
     71        3:
     72                and %g1, -8, %g1
     73                cmp %o0, %g1
     74                bne,pt %xcc, 0b
     75                mov 0, %g3
     76                srlx %o2, 3, %g4
     77                brz,pn %g4, 5f
     78                mov 0, %g5
     79       
     80        4:
     81                sllx %g3, 3, %g2
     82                add %g5, 1, %g3
     83                ldx [%o1 + %g2], %g1
     84                mov %g3, %g5
     85                cmp %g4, %g3
     86                bne,pt %xcc, 4b
     87                stx %g1, [%o0 + %g2]
     88       
     89        5:
     90                and %o2, 7, %o2
     91                brz,pn %o2, 2b
     92                sllx %g4, 3, %g1
     93                mov 0, %g2
     94                add %g1, %o0, %o0
     95                add %g1, %o1, %g4
     96                mov 0, %g3
     97       
     98        6:
     99                ldub [%g2 + %g4], %g1
     100                stb %g1, [%g2 + %o0]
     101                add %g3, 1, %g2
     102                cmp %o2, %g2
     103                bne,pt %xcc, 6b
     104                mov %g2, %g3
     105       
     106        jmp %o7 + 8   ! exit point
     107        mov %o3, %o0
    101108
    102109jump_to_kernel:
     
    107114         * 3. Flush instruction pipeline.
    108115         */
    109 
     116       
    110117        /*
    111118         * US3 processors have a write-invalidate cache, so explicitly
    112119         * invalidating it is not required. Whether to invalidate I-cache
    113          * or not is decided according to the value of the global
    114          * "subarchitecture" variable (set in the bootstrap).
     120         * or not is decided according to the value of the 5th argument
     121         * (subarchitecture).
    115122         */
    116         set subarchitecture, %g2
    117         ldub [%g2], %g2
    118         cmp %g2, 3
     123        cmp %i4, 3
    119124        be %xcc, 1f
    120125        nop
    121 0:
    122         call icache_flush
    123         nop
    124 1:
    125         membar #StoreStore
     126       
     127        0:
     128                call icache_flush
     129                nop
     130       
     131        1:
     132                membar #StoreStore
    126133       
    127134        /*
    128135         * Flush the instruction pipeline.
    129136         */
    130         flush   %i7
    131 
     137        flush %i7
     138       
    132139        mov %o0, %l1
    133140        mov %o1, %o0
    134141        mov %o2, %o1
    135142        mov %o3, %o2
    136         jmp %l1                         ! jump to kernel
     143        jmp %l1       ! jump to kernel
    137144        nop
    138145
    139 #define ICACHE_SIZE             8192
    140 #define ICACHE_LINE_SIZE        32
    141 #define ICACHE_SET_BIT          (1 << 13)
    142 #define ASI_ICACHE_TAG          0x67
     146#define ICACHE_SIZE       8192
     147#define ICACHE_LINE_SIZE  32
     148#define ICACHE_SET_BIT    (1 << 13)
     149#define ASI_ICACHE_TAG    0x67
    143150
    144151# Flush I-cache
    145152icache_flush:
    146         set     ((ICACHE_SIZE - ICACHE_LINE_SIZE) | ICACHE_SET_BIT), %g1
    147         stxa    %g0, [%g1] ASI_ICACHE_TAG
    148 0:      membar  #Sync
    149         subcc   %g1, ICACHE_LINE_SIZE, %g1
    150         bnz,pt  %xcc, 0b
    151         stxa    %g0, [%g1] ASI_ICACHE_TAG
    152         membar  #Sync
     153        set ((ICACHE_SIZE - ICACHE_LINE_SIZE) | ICACHE_SET_BIT), %g1
     154        stxa %g0, [%g1] ASI_ICACHE_TAG
     155       
     156        0:
     157                membar #Sync
     158                subcc %g1, ICACHE_LINE_SIZE, %g1
     159                bnz,pt %xcc, 0b
     160       
     161        stxa %g0, [%g1] ASI_ICACHE_TAG
     162        membar #Sync
    153163        retl
    154164        ! SF Erratum #51
    155165        nop
     166
    156167.global ofw
    157168ofw:
     
    159170        set ofw_cif, %l0
    160171        ldx [%l0], %l0
    161 
     172       
    162173        rdpr  %pstate, %l1
    163174        and  %l1, ~PSTATE_AM_BIT, %l2
    164175        wrpr  %l2, 0, %pstate
    165    
     176       
    166177        jmpl %l0, %o7
    167178        mov %i0, %o0
    168 
     179       
    169180        wrpr %l1, 0, %pstate
    170 
     181       
    171182        ret
    172183        restore %o0, 0, %o0
  • boot/arch/sparc64/loader/asm.h

    ra11099f re731b0d  
    3434#include "main.h"
    3535
    36 #define PAGE_WIDTH      14
    37 #define PAGE_SIZE       (1 << PAGE_WIDTH)
     36#define PAGE_WIDTH  14
     37#define PAGE_SIZE   (1 << PAGE_WIDTH)
    3838
    39 #define memcpy(dst, src, cnt)  __builtin_memcpy((dst), (src), (cnt))
     39#define BALLOC_MAX_SIZE  (128 * 1024)
    4040
    4141extern void halt(void);
    4242extern void jump_to_kernel(void *entry, uint64_t cfg, bootinfo_t *bootinfo,
    43         unsigned int bootinfo_size) __attribute__((noreturn));
     43    unsigned int bootinfo_size, uint8_t subarchitecture) __attribute__((noreturn));
    4444
    4545#endif
  • boot/arch/sparc64/loader/main.c

    ra11099f re731b0d  
    11/*
    22 * Copyright (c) 2005 Martin Decky
    3  * Copyright (c) 2006 Jakub Jermar 
     3 * Copyright (c) 2006 Jakub Jermar
    44 * All rights reserved.
    55 *
     
    2828 */
    2929
    30 #include "main.h" 
     30#include "main.h"
    3131#include <printf.h>
    3232#include "asm.h"
     
    3939#include <macros.h>
    4040#include <string.h>
    41 
    42 bootinfo_t bootinfo;
    43 
    44 component_t components[COMPONENTS];
    45 
    46 char *release = STRING(RELEASE);
     41#include <memstr.h>
     42
     43static bootinfo_t bootinfo;
     44static component_t components[COMPONENTS];
     45static char *release = STRING(RELEASE);
    4746
    4847#ifdef REVISION
    49         char *revision = ", revision " STRING(REVISION);
     48        static char *revision = ", revision " STRING(REVISION);
    5049#else
    51         char *revision = "";
     50        static char *revision = "";
    5251#endif
    5352
    5453#ifdef TIMESTAMP
    55         char *timestamp = "\nBuilt on " STRING(TIMESTAMP);
     54        static char *timestamp = "\nBuilt on " STRING(TIMESTAMP);
    5655#else
    57         char *timestamp = "";
     56        static char *timestamp = "";
    5857#endif
    5958
    6059/** UltraSPARC subarchitecture - 1 for US, 3 for US3 */
    61 uint8_t subarchitecture;
     60static uint8_t subarchitecture;
    6261
    6362/**
     
    6564 * MID_SHIFT bits to the right
    6665 */
    67 uint16_t mid_mask;
     66static uint16_t mid_mask;
    6867
    6968/** Print version information. */
     
    7675
    7776/* the lowest ID (read from the VER register) of some US3 CPU model */
    78 #define FIRST_US3_CPU   0x14
     77#define FIRST_US3_CPU  0x14
    7978
    8079/* the greatest ID (read from the VER register) of some US3 CPU model */
    81 #define LAST_US3_CPU    0x19
     80#define LAST_US3_CPU   0x19
    8281
    8382/* UltraSPARC IIIi processor implementation code */
    84 #define US_IIIi_CODE    0x15
     83#define US_IIIi_CODE   0x15
    8584
    8685/**
     
    9190{
    9291        uint64_t v;
    93         asm volatile ("rdpr %%ver, %0\n" : "=r" (v));
     92        asm volatile (
     93                "rdpr %%ver, %0\n"
     94                : "=r" (v)
     95        );
    9496       
    9597        v = (v << 16) >> 48;
     
    103105                subarchitecture = SUBARCH_US;
    104106                mid_mask = (1 << 5) - 1;
    105         } else {
     107        } else
    106108                printf("\nThis CPU is not supported by HelenOS.");
    107         }
    108109}
    109110
     
    113114        void *balloc_base;
    114115        unsigned int top = 0;
    115         int i, j;
    116 
     116        unsigned int i;
     117        unsigned int j;
     118       
    117119        version_print();
    118120       
    119121        detect_subarchitecture();
    120122        init_components(components);
    121 
     123       
    122124        if (!ofw_get_physmem_start(&bootinfo.physmem_start)) {
    123125                printf("Error: unable to get start of physical memory.\n");
    124126                halt();
    125127        }
    126 
     128       
    127129        if (!ofw_memmap(&bootinfo.memmap)) {
    128130                printf("Error: unable to get memory map, halting.\n");
    129131                halt();
    130132        }
    131 
     133       
    132134        if (bootinfo.memmap.total == 0) {
    133135                printf("Error: no memory detected, halting.\n");
    134136                halt();
    135137        }
    136 
     138       
    137139        /*
    138140         * SILO for some reason adds 0x400000 and subtracts
     
    143145                silo_ramdisk_image += bootinfo.physmem_start;
    144146                silo_ramdisk_image -= 0x400000;
    145                 /* Install 1:1 mapping for the ramdisk. */
    146                 if (ofw_map((void *)((uintptr_t) silo_ramdisk_image),
    147                     (void *)((uintptr_t) silo_ramdisk_image),
     147               
     148                /* Install 1:1 mapping for the RAM disk. */
     149                if (ofw_map((void *) ((uintptr_t) silo_ramdisk_image),
     150                    (void *) ((uintptr_t) silo_ramdisk_image),
    148151                    silo_ramdisk_size, -1) != 0) {
    149                         printf("Failed to map ramdisk.\n");
     152                        printf("Failed to map RAM disk.\n");
    150153                        halt();
    151154                }
    152155        }
    153156       
    154         printf("\nSystem info\n");
    155         printf(" memory: %dM starting at %P\n",
     157        printf("\nMemory statistics (total %d MB, starting at %P)\n",
    156158            bootinfo.memmap.total >> 20, bootinfo.physmem_start);
    157 
    158         printf("\nMemory statistics\n");
    159         printf(" kernel entry point at %P\n", KERNEL_VIRTUAL_ADDRESS);
     159        printf(" %P: kernel entry point\n", KERNEL_VIRTUAL_ADDRESS);
    160160        printf(" %P: boot info structure\n", &bootinfo);
    161161       
     
    176176                                break;
    177177                        }
     178                       
    178179                        bootinfo.taskmap.tasks[bootinfo.taskmap.count].addr =
    179180                            base + top;
     
    187188                top += components[i].size;
    188189        }
    189 
    190         j = bootinfo.taskmap.count - 1; /* do not consider ramdisk */
    191 
     190       
     191        /* Do not consider RAM disk */
     192        j = bootinfo.taskmap.count - 1;
     193       
    192194        if (silo_ramdisk_image) {
    193                 /* Treat the ramdisk as the last bootinfo task. */
     195                /* Treat the RAM disk as the last bootinfo task. */
    194196                if (bootinfo.taskmap.count == TASKMAP_MAX_RECORDS) {
    195                         printf("Skipping ramdisk.\n");
     197                        printf("Skipping RAM disk.\n");
    196198                        goto skip_ramdisk;
    197199                }
     200               
    198201                top = ALIGN_UP(top, PAGE_SIZE);
    199202                bootinfo.taskmap.tasks[bootinfo.taskmap.count].addr =
     
    202205                    silo_ramdisk_size;
    203206                bootinfo.taskmap.count++;
    204                 printf("\nCopying ramdisk...");
     207                printf("\nCopying RAM disk...");
     208               
    205209                /*
    206210                 * Claim and map the whole ramdisk as it may exceed the area
     
    210214                (void) ofw_map(bootinfo.physmem_start + base + top, base + top,
    211215                    silo_ramdisk_size, -1);
    212                 memmove(base + top, (void *)((uintptr_t)silo_ramdisk_image),
     216                memmove(base + top, (void *) ((uintptr_t) silo_ramdisk_image),
    213217                    silo_ramdisk_size);
     218               
    214219                printf("done.\n");
    215220                top += silo_ramdisk_size;
    216221        }
    217222skip_ramdisk:
    218 
     223       
    219224        /*
    220225         * Now we can proceed to copy the components. We do it in reverse order
     
    222227         * with base.
    223228         */
    224         printf("\nCopying bootinfo tasks\n");
     229        printf("\nCopying tasks...");
    225230        for (i = COMPONENTS - 1; i > 0; i--, j--) {
    226                 printf(" %s...", components[i].name);
    227 
     231                printf("%s ", components[i].name);
     232               
    228233                /*
    229234                 * At this point, we claim the physical memory that we are
     
    240245                    bootinfo.taskmap.tasks[j].addr,
    241246                    ALIGN_UP(components[i].size, PAGE_SIZE));
    242                    
    243                 memcpy((void *)bootinfo.taskmap.tasks[j].addr,
     247               
     248                memcpy((void *) bootinfo.taskmap.tasks[j].addr,
    244249                    components[i].start, components[i].size);
    245                 printf("done.\n");
    246         }
    247 
     250               
     251        }
     252        printf(".\n");
     253       
    248254        printf("\nCopying kernel...");
    249255        (void) ofw_claim_phys(bootinfo.physmem_start + base,
     
    251257        memcpy(base, components[0].start, components[0].size);
    252258        printf("done.\n");
    253 
     259       
    254260        /*
    255261         * Claim and map the physical memory for the boot allocator.
     
    261267        (void) ofw_map(bootinfo.physmem_start + balloc_base, balloc_base,
    262268            BALLOC_MAX_SIZE, -1);
    263         balloc_init(&bootinfo.ballocs, (uintptr_t)balloc_base);
    264 
     269        balloc_init(&bootinfo.ballocs, (uintptr_t) balloc_base,
     270            (uintptr_t) balloc_base);
     271       
    265272        printf("\nCanonizing OpenFirmware device tree...");
    266273        bootinfo.ofw_root = ofw_tree_build();
    267274        printf("done.\n");
    268 
     275       
    269276#ifdef CONFIG_AP
    270277        printf("\nChecking for secondary processors...");
    271         if (!ofw_cpu())
     278        if (!ofw_cpu(mid_mask, bootinfo.physmem_start))
    272279                printf("Error: unable to get CPU properties\n");
    273280        printf("done.\n");
    274281#endif
    275 
     282       
    276283        ofw_setup_palette();
    277 
     284       
    278285        printf("\nBooting the kernel...\n");
    279286        jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS,
    280287            bootinfo.physmem_start | BSP_PROCESSOR, &bootinfo,
    281             sizeof(bootinfo));
     288            sizeof(bootinfo), subarchitecture);
    282289}
  • boot/arch/sparc64/loader/main.h

    ra11099f re731b0d  
    3535#include <types.h>
    3636
    37 #define KERNEL_VIRTUAL_ADDRESS 0x400000
     37#define KERNEL_VIRTUAL_ADDRESS  0x400000
    3838
    39 #define TASKMAP_MAX_RECORDS 32
     39#define TASKMAP_MAX_RECORDS  32
    4040
    4141/** Size of buffer for storing task name in task_t. */
    42 #define BOOTINFO_TASK_NAME_BUFLEN 32
     42#define BOOTINFO_TASK_NAME_BUFLEN  32
    4343
    44 #define BSP_PROCESSOR   1
    45 #define AP_PROCESSOR    0
     44#define BSP_PROCESSOR  1
     45#define AP_PROCESSOR   0
    4646
    47 #define SUBARCH_US      1
    48 #define SUBARCH_US3     3
     47#define SUBARCH_US   1
     48#define SUBARCH_US3  3
    4949
    5050typedef struct {
     
    7070extern uint32_t silo_ramdisk_size;
    7171
    72 extern bootinfo_t bootinfo;
    73 
    7472extern void start(void);
    7573extern void bootstrap(void);
  • boot/arch/sparc64/loader/ofwarch.c

    ra11099f re731b0d  
    3030/**
    3131 * @file
    32  * @brief       Architecture dependent parts of OpenFirmware interface.
     32 * @brief Architecture dependent parts of OpenFirmware interface.
    3333 */
    3434
     
    4040#include "main.h"
    4141#include "asm.h"
    42 
    43 /* these tho variables will be set by the detect_subarchitecture function */
    44 extern uint8_t subarchitecture;
    45 extern uint16_t mid_mask;
    4642
    4743void write(const char *str, const int len)
     
    6561 * except for the current CPU.
    6662 *
    67  * @param child         The first child of the OFW tree node whose children
    68  *                      represent CPUs to be woken up.
    69  * @param current_mid   MID of the current CPU, the current CPU will
    70  *                      (of course) not be woken up.
    71  * @return              Number of CPUs which have the same parent node as
    72  *                      "child".
     63 * @param child         The first child of the OFW tree node whose children
     64 *                      represent CPUs to be woken up.
     65 * @param current_mid   MID of the current CPU, the current CPU will
     66 *                      (of course) not be woken up.
     67 * @param physmem_start Starting address of the physical memory.
     68 *
     69 * @return Number of CPUs which have the same parent node as
     70 *         "child".
     71 *
    7372 */
    74 static int wake_cpus_in_node(phandle child, uint64_t current_mid)
     73static int wake_cpus_in_node(phandle child, uint64_t current_mid,
     74    uintptr_t physmem_start)
    7575{
    7676        int cpus;
    77         char type_name[BUF_SIZE];
    7877       
    79         for (cpus = 0; child != 0 && child != -1;
     78        for (cpus = 0; (child != 0) && (child != -1);
    8079            child = ofw_get_peer_node(child), cpus++) {
     80                char type_name[BUF_SIZE];
     81               
    8182                if (ofw_get_property(child, "device_type", type_name,
    8283                    sizeof(type_name)) > 0) {
     
    8889                                 * "cpuid" for US-IV
    8990                                 */
    90                                 if (ofw_get_property(
    91                                     child, "upa-portid",
    92                                     &mid, sizeof(mid)) <= 0
    93                                     && ofw_get_property(child, "portid",
    94                                     &mid, sizeof(mid)) <= 0
    95                                     && ofw_get_property(child, "cpuid",
    96                                     &mid, sizeof(mid)) <= 0)
     91                                if ((ofw_get_property(child, "upa-portid", &mid, sizeof(mid)) <= 0)
     92                                    && (ofw_get_property(child, "portid", &mid, sizeof(mid)) <= 0)
     93                                    && (ofw_get_property(child, "cpuid", &mid, sizeof(mid)) <= 0))
    9794                                        continue;
    98                                        
     95                               
    9996                                if (current_mid != mid) {
    10097                                        /*
     
    103100                                        (void) ofw_call("SUNW,start-cpu", 3, 1,
    104101                                            NULL, child, KERNEL_VIRTUAL_ADDRESS,
    105                                             bootinfo.physmem_start |
    106                                             AP_PROCESSOR);
     102                                            physmem_start | AP_PROCESSOR);
    107103                                }
    108104                        }
    109105                }
    110106        }
    111 
     107       
    112108        return cpus;
    113109}
     
    116112 * Finds out the current CPU's MID and wakes up all AP processors.
    117113 */
    118 int ofw_cpu(void)
     114int ofw_cpu(uint16_t mid_mask, uintptr_t physmem_start)
    119115{
    120         int cpus;
    121         phandle node;
    122         phandle subnode;
    123         phandle cpus_parent;
    124         phandle cmp;
    125         char name[BUF_SIZE];
    126 
    127         /* get the current CPU MID */
     116        /* Get the current CPU MID */
    128117        uint64_t current_mid;
    129118       
    130         asm volatile ("ldxa [%1] %2, %0\n"
    131             : "=r" (current_mid)
    132             : "r" (0), "i" (ASI_ICBUS_CONFIG));
     119        asm volatile (
     120                "ldxa [%1] %2, %0\n"
     121                : "=r" (current_mid)
     122                : "r" (0), "i" (ASI_ICBUS_CONFIG)
     123        );
     124       
    133125        current_mid >>= ICBUS_CONFIG_MID_SHIFT;
    134 
    135126        current_mid &= mid_mask;
    136 
    137         /* wake up CPUs */
    138127       
    139         cpus_parent = ofw_find_device("/ssm@0,0");
    140         if (cpus_parent == 0 || cpus_parent == -1) {
     128        /* Wake up the CPUs */
     129       
     130        phandle cpus_parent = ofw_find_device("/ssm@0,0");
     131        if ((cpus_parent == 0) || (cpus_parent == -1))
    141132                cpus_parent = ofw_find_device("/");
    142         }
    143 
    144         node = ofw_get_child_node(cpus_parent);
    145         cpus = wake_cpus_in_node(node, current_mid);
    146         while (node != 0 && node != -1) {
     133       
     134        phandle node = ofw_get_child_node(cpus_parent);
     135        int cpus = wake_cpus_in_node(node, current_mid, physmem_start);
     136        while ((node != 0) && (node != -1)) {
     137                char name[BUF_SIZE];
     138               
    147139                if (ofw_get_property(node, "name", name,
    148                         sizeof(name)) > 0) {
     140                    sizeof(name)) > 0) {
    149141                        if (strcmp(name, "cmp") == 0) {
    150                                 subnode = ofw_get_child_node(node);
     142                                phandle subnode = ofw_get_child_node(node);
    151143                                cpus += wake_cpus_in_node(subnode,
    152                                         current_mid);
     144                                        current_mid, physmem_start);
    153145                        }
    154146                }
     
    157149       
    158150        return cpus;
    159        
    160151}
    161152
    162153/** Get physical memory starting address.
    163154 *
    164  * @param start         Pointer to variable where the physical memory starting
    165  *                      address will be stored.
     155 * @param start Pointer to variable where the physical memory starting
     156 *              address will be stored.
    166157 *
    167  * @return              Non-zero on succes, zero on failure.
     158 * @return Non-zero on succes, zero on failure.
     159 *
    168160 */
    169161int ofw_get_physmem_start(uintptr_t *start)
    170162{
    171163        uint32_t memreg[4];
    172 
    173164        if (ofw_get_property(ofw_memory, "reg", &memreg, sizeof(memreg)) <= 0)
    174165                return 0;
    175 
     166       
    176167        *start = (((uint64_t) memreg[0]) << 32) | memreg[1];
    177168        return 1;
    178169}
    179 
  • boot/arch/sparc64/loader/ofwarch.h

    ra11099f re731b0d  
    3333#include "types.h"
    3434
    35 #define OFW_ADDRESS_CELLS       2
    36 #define OFW_SIZE_CELLS          2
     35#define OFW_ADDRESS_CELLS  2
     36#define OFW_SIZE_CELLS     2
    3737
    38 extern int ofw_cpu(void);
    39 extern int ofw_get_physmem_start(uintptr_t *start); 
     38extern int ofw_cpu(uint16_t mid_mask, uintptr_t physmem_start);
     39extern int ofw_get_physmem_start(uintptr_t *start);
    4040
    4141#endif
Note: See TracChangeset for help on using the changeset viewer.