Changeset 45b26dad in mainline for boot/arch/sparc64/loader


Ignore:
Timestamp:
2006-09-26T12:59:28Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b44939b
Parents:
6ff1f1e
Message:

sparc64 work:

  • Loader now starts all processors.
  • Kernel halts all but the bootstrup processor for now.
  • Read clock-frequency from the respective processor node in the device tree
Location:
boot/arch/sparc64/loader
Files:
6 edited

Legend:

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

    r6ff1f1e r45b26dad  
    101101        mov %o1, %o0
    102102        mov %o2, %o1
     103        mov %o3, %o2
    103104        jmp %l1                         ! jump to kernel
    104105        nop
  • boot/arch/sparc64/loader/asm.h

    r6ff1f1e r45b26dad  
    3636
    3737extern void halt(void);
    38 extern void jump_to_kernel(void *entry, void *bootinfo, unsigned int bootinfo_size) __attribute__((noreturn));
     38extern void jump_to_kernel(void *entry, int bsp, void *bootinfo, unsigned int bootinfo_size) __attribute__((noreturn));
    3939
    4040#endif
  • boot/arch/sparc64/loader/main.c

    r6ff1f1e r45b26dad  
    3737#include <align.h>
    3838
    39 #define KERNEL_VIRTUAL_ADDRESS 0x400000
    40 
    4139bootinfo_t bootinfo;
    4240
     
    5856        }
    5957       
    60         if (!ofw_cpu(&bootinfo.cpu))
    61                 printf("Error: unable to get cpu properties\n");
    62 
    63         printf("\nDevice info\n");
    64         printf(" cpu: %dMHz\n", bootinfo.cpu.clock_frequency/1000000);
     58        printf("\nSystem info\n");
    6559        printf(" memory: %dM\n", bootinfo.memmap.total>>20);
    6660
     
    9791        printf("done.\n");
    9892
     93        printf("\nChecking for secondary processors...");
     94        if (!ofw_cpu())
     95                printf("Error: unable to get cpu properties\n");
     96        printf("done.\n");
     97
    9998        printf("\nBooting the kernel...\n");
    100         jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS, &bootinfo, sizeof(bootinfo));
     99        jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS, 1, &bootinfo, sizeof(bootinfo));
    101100}
  • boot/arch/sparc64/loader/main.h

    r6ff1f1e r45b26dad  
    3535#include <types.h>
    3636
     37#define KERNEL_VIRTUAL_ADDRESS 0x400000
     38
    3739#define TASKMAP_MAX_RECORDS 32
    3840
     
    4850
    4951typedef struct {
    50         uint32_t clock_frequency;
    51 } cpu_t;
    52 
    53 typedef struct {
    5452        taskmap_t taskmap;
    5553        memmap_t memmap;
    56         cpu_t cpu;
    5754        ballocs_t ballocs;
    5855        ofw_tree_node_t *ofw_root;
  • boot/arch/sparc64/loader/ofwarch.c

    r6ff1f1e r45b26dad  
    5454}
    5555
    56 int ofw_cpu(cpu_t *cpu)
     56
     57#define ASI_UPA_CONFIG          0x4a
     58#define UPA_CONFIG_MID_SHIFT    17
     59#define UPA_CONFIG_MID_MASK     0x1f
     60
     61int ofw_cpu(void)
    5762{
    5863        char type_name[BUF_SIZE];
     
    6267        if (node == 0 || node == -1) {
    6368                printf("Could not find any child nodes of the root node.\n");
    64                 return;
     69                return 0;
    6570        }
     71       
     72        uint64_t current_mid;
     73       
     74        __asm__ volatile ("ldxa [%1] %2, %0\n" : "=r" (current_mid) : "r" (0), "i" (ASI_UPA_CONFIG));
     75        current_mid >>= UPA_CONFIG_MID_SHIFT;
     76        current_mid &= UPA_CONFIG_MID_MASK;
    6677       
    6778        for (; node != 0 && node != -1; node = ofw_get_peer_node(node)) {
    6879                if (ofw_get_property(node, "device_type", type_name, sizeof(type_name)) > 0) {
    6980                        if (strcmp(type_name, "cpu") == 0) {
    70                                 uint32_t mhz;
     81                                uint32_t mid;
    7182                               
    72                                 if (ofw_get_property(node, "clock-frequency", &mhz, sizeof(mhz)) <= 0)
     83                                if (ofw_get_property(node, "upa-portid", &mid, sizeof(mid)) <= 0)
    7384                                        continue;
    7485                                       
    75                                 cpu->clock_frequency = mhz;
    76                                 return 1;
     86                                if (current_mid != mid) {
     87                                        /*
     88                                         * Start secondary processor.
     89                                         */
     90                                        (void) ofw_call("SUNW,start-cpu", 3, 1, NULL, node, KERNEL_VIRTUAL_ADDRESS, 0);
     91                                }
    7792                        }
    7893                }
    79         };
     94        }
    8095
    81         return 0;
     96        return 1;
    8297}
  • boot/arch/sparc64/loader/ofwarch.h

    r6ff1f1e r45b26dad  
    3535#define OFW_SIZE_CELLS          2
    3636
    37 extern int bpp2align[];
    38 
    39 extern int ofw_cpu(cpu_t *cpu);
     37extern int ofw_cpu(void);
    4038
    4139#endif
Note: See TracChangeset for help on using the changeset viewer.