Changeset 4872160 in mainline for kernel/arch/sparc64/src


Ignore:
Timestamp:
2010-05-04T10:44:55Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
568db0f
Parents:
bb252ca
Message:

new boot infrastructure

  • more code and metadata unification
  • import of up-to-date implementations from the kernel
  • the boot loaders should behave more similarly on all platforms
  • support for deflate compressed (LZ77) boot components
    • this again allows feasible boot images to be created on mips32
  • IA64 is still not booting
    • the broken forked GNU EFI library has been removed, a replacement of the functionality is on its way
Location:
kernel/arch/sparc64/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/src/mm/sun4u/frame.c

    rbb252ca r4872160  
    4343uintptr_t last_frame = NULL;
    4444
    45 /** Create memory zones according to information stored in bootinfo.
     45/** Create memory zones according to information stored in memmap.
    4646 *
    47  * Walk the bootinfo memory map and create frame zones according to it.
     47 * Walk the memory map and create frame zones according to it.
    4848 */
    4949void frame_arch_init(void)
     
    5353
    5454        if (config.cpu_active == 1) {
    55                 for (i = 0; i < bootinfo.memmap.count; i++) {
    56                         uintptr_t start = bootinfo.memmap.zones[i].start;
    57                         size_t size = bootinfo.memmap.zones[i].size;
     55                for (i = 0; i < memmap.cnt; i++) {
     56                        uintptr_t start = (uintptr_t) memmap.zones[i].start;
     57                        size_t size = memmap.zones[i].size;
    5858
    5959                        /*
  • kernel/arch/sparc64/src/mm/sun4v/frame.c

    rbb252ca r4872160  
    4141#include <macros.h>
    4242
    43 /** Create memory zones according to information stored in bootinfo.
     43/** Create memory zones according to information stored in memmap.
    4444 *
    45  * Walk the bootinfo memory map and create frame zones according to it.
     45 * Walk the memory map and create frame zones according to it.
    4646 */
    4747void frame_arch_init(void)
     
    5151
    5252        if (config.cpu_active == 1) {
    53                 for (i = 0; i < bootinfo.memmap.count; i++) {
    54                         uintptr_t start = bootinfo.memmap.zones[i].start;
    55                         size_t size = bootinfo.memmap.zones[i].size;
     53                for (i = 0; i < memmap->count; i++) {
     54                        uintptr_t start = (uintptr_t) memmap.zones[i].start;
     55                        size_t size = memmap.zones[i].size;
    5656
    5757                        /*
  • kernel/arch/sparc64/src/smp/sun4v/smp.c

    rbb252ca r4872160  
    417417static bool wake_cpu(uint64_t cpuid)
    418418{
    419 
    420419#ifdef CONFIG_SIMICS_SMP_HACK
    421420        ipi_unicast_to((void (*)(void)) 1234, cpuid);
     
    424423        if (__hypercall_fast1(CPU_STOP, cpuid) != EOK)
    425424                return false;
    426 
     425       
    427426        /* wait for the CPU to stop */
    428427        uint64_t state;
    429         __hypercall_fast_ret1(cpuid, 0, 0, 0, 0,
    430                 CPU_STATE, &state);
    431         while (state == CPU_STATE_RUNNING) {
    432                 __hypercall_fast_ret1(cpuid, 0, 0, 0, 0,
    433                         CPU_STATE, &state);
    434         }
    435 
     428        __hypercall_fast_ret1(cpuid, 0, 0, 0, 0, CPU_STATE, &state);
     429        while (state == CPU_STATE_RUNNING)
     430                __hypercall_fast_ret1(cpuid, 0, 0, 0, 0, CPU_STATE, &state);
     431       
    436432        /* make the CPU run again and execute HelenOS code */
    437         if (__hypercall_fast4(
    438                 CPU_START, cpuid,
    439                 (uint64_t) KA2PA(kernel_image_start),
    440                 KA2PA(trap_table), bootinfo.physmem_start                       
    441                 ) != EOK)
    442                         return false;
     433        if (__hypercall_fast4(CPU_START, cpuid,
     434            (uint64_t) KA2PA(kernel_image_start), KA2PA(trap_table),
     435            physmem_start) != EOK)
     436                return false;
    443437#endif
    444 
     438       
    445439        if (waitq_sleep_timeout(&ap_completion_wq, 10000000, SYNCH_FLAGS_NONE) ==
    446                         ESYNCH_TIMEOUT)
    447                 printf("%s: waiting for processor (cpuid = %" PRIu32
    448                 ") timed out\n", __func__, cpuid);
    449 
     440            ESYNCH_TIMEOUT)
     441                printf("%s: waiting for processor (cpuid = %" PRIu32 ") timed out\n",
     442                    __func__, cpuid);
     443       
    450444        return true;
    451445}
  • kernel/arch/sparc64/src/sun4u/sparc64.c

    rbb252ca r4872160  
    3636#include <debug.h>
    3737#include <config.h>
     38#include <macros.h>
    3839#include <arch/trap/trap.h>
    3940#include <arch/console.h>
     
    5051#include <str.h>
    5152
    52 bootinfo_t bootinfo;
     53memmap_t memmap;
    5354
    5455/** Perform sparc64-specific initialization before main_bsp() is called. */
    55 void arch_pre_main(void)
     56void arch_pre_main(bootinfo_t *bootinfo)
    5657{
    5758        /* Copy init task info. */
    58         init.cnt = bootinfo.taskmap.count;
     59        init.cnt = min3(bootinfo->taskmap.cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS);
    5960       
    60         uint32_t i;
    61 
    62         for (i = 0; i < bootinfo.taskmap.count; i++) {
    63                 init.tasks[i].addr = (uintptr_t) bootinfo.taskmap.tasks[i].addr;
    64                 init.tasks[i].size = bootinfo.taskmap.tasks[i].size;
     61        size_t i;
     62        for (i = 0; i < init.cnt; i++) {
     63                init.tasks[i].addr = (uintptr_t) bootinfo->taskmap.tasks[i].addr;
     64                init.tasks[i].size = bootinfo->taskmap.tasks[i].size;
    6565                str_cpy(init.tasks[i].name, CONFIG_TASK_NAME_BUFLEN,
    66                     bootinfo.taskmap.tasks[i].name);
     66                    bootinfo->taskmap.tasks[i].name);
     67        }
     68       
     69        /* Copy physical memory map. */
     70        memmap.total = bootinfo->memmap.total;
     71        memmap.cnt = min(bootinfo->memmap.cnt, MEMMAP_MAX_RECORDS);
     72        for (i = 0; i < memmap.cnt; i++) {
     73                memmap.zones[i].start = bootinfo->memmap.zones[i].start;
     74                memmap.zones[i].size = bootinfo->memmap.zones[i].size;
    6775        }
    6876       
    6977        /* Copy boot allocations info. */
    70         ballocs.base = bootinfo.ballocs.base;
    71         ballocs.size = bootinfo.ballocs.size;
     78        ballocs.base = bootinfo->ballocs.base;
     79        ballocs.size = bootinfo->ballocs.size;
    7280       
    73         ofw_tree_init(bootinfo.ofw_root);
     81        ofw_tree_init(bootinfo->ofw_root);
    7482}
    7583
  • kernel/arch/sparc64/src/sun4u/start.S

    rbb252ca r4872160  
    6060/*
    6161 * Here is where the kernel is passed control from the boot loader.
    62  * 
     62 *
    6363 * The registers are expected to be in this state:
    64  * - %o0 starting address of physical memory + bootstrap processor flag
    65  *      bits 63...1:    physical memory starting address / 2
    66  *      bit 0:          non-zero on BSP processor, zero on AP processors
    67  * - %o1 bootinfo structure address (BSP only)
    68  * - %o2 bootinfo structure size (BSP only)
     64 *  - %o0 bootinfo structure address (BSP only)
     65 *  - %o1 starting address of physical memory
     66 *        + bootstrap processor flag
     67 *          bits 63...1: physical memory starting address / 2
     68 *          bit 0:       non-zero on BSP processor, zero on AP processors
    6969 *
    7070 * Moreover, we depend on boot having established the following environment:
    71  * - TLBs are on
    72  * - identity mapping for the kernel image
     71 *  - TLBs are on
     72 *  - identity mapping for the kernel image
     73 *
    7374 */
    7475
     
    7677kernel_image_start:
    7778        mov BSP_FLAG, %l0
    78         and %o0, %l0, %l7                       ! l7 <= bootstrap processor?
    79         andn %o0, %l0, %l6                      ! l6 <= start of physical memory
     79        and %o1, %l0, %l7                       ! l7 <= bootstrap processor?
     80        andn %o1, %l0, %l6                      ! l6 <= start of physical memory
    8081
    8182        ! Get bits (PHYSMEM_ADDR_SIZE - 1):13 of physmem_base.
     
    282283        sub %sp, STACK_BIAS, %sp
    283284
    284         sethi %hi(bootinfo), %o0
    285         call memcpy                             ! copy bootinfo
    286         or %o0, %lo(bootinfo), %o0
    287 
    288285        call arch_pre_main
    289286        nop
  • kernel/arch/sparc64/src/sun4v/sparc64.c

    rbb252ca r4872160  
    3636#include <debug.h>
    3737#include <config.h>
     38#include <macros.h>
    3839#include <arch/trap/trap.h>
    3940#include <arch/console.h>
     
    5253#include <arch/drivers/niagara.h>
    5354
    54 bootinfo_t bootinfo;
     55memmap_t memmap;
    5556
    5657/** Perform sparc64-specific initialization before main_bsp() is called. */
    57 void arch_pre_main(void)
     58void arch_pre_main(bootinfo_t *bootinfo)
    5859{
    5960        /* Copy init task info. */
    60         init.cnt = bootinfo.taskmap.count;
     61        init.cnt = min3(bootinfo->taskmap.cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS);
    6162       
    62         uint32_t i;
    63 
    64         for (i = 0; i < bootinfo.taskmap.count; i++) {
    65                 init.tasks[i].addr = (uintptr_t) bootinfo.taskmap.tasks[i].addr;
    66                 init.tasks[i].size = bootinfo.taskmap.tasks[i].size;
     63        size_t i;
     64        for (i = 0; i < init.cnt; i++) {
     65                init.tasks[i].addr = (uintptr_t) bootinfo->taskmap.tasks[i].addr;
     66                init.tasks[i].size = bootinfo->taskmap.tasks[i].size;
    6767                str_cpy(init.tasks[i].name, CONFIG_TASK_NAME_BUFLEN,
    68                     bootinfo.taskmap.tasks[i].name);
     68                    bootinfo->taskmap.tasks[i].name);
    6969        }
    70 
     70       
     71        /* Copy physical memory map. */
     72        memmap.total = bootinfo->memmap.total;
     73        memmap.cnt = min(bootinfo->memmap.cnt, MEMMAP_MAX_RECORDS);
     74        for (i = 0; i < memmap.cnt; i++) {
     75                memmap.zones[i].start = bootinfo->memmap.zones[i].start;
     76                memmap.zones[i].size = bootinfo->memmap.zones[i].size;
     77        }
     78       
    7179        md_init();
    7280}
  • kernel/arch/sparc64/src/sun4v/start.S

    rbb252ca r4872160  
    7575 *
    7676 * parameters:
    77  *      addr:                   virtual address to be mapped
    78  *      rphysmem_start:         register containing the starting address of the
    79  *                              physical memory
    80  *      rtmp1:                  a register to be used as temporary
    81  *      rtmp2:                  a register to be used as temporary
    82  *      rd:                     register where the result will be saved
     77 *  addr:           virtual address to be mapped
     78 *  rphysmem_start: register containing the starting address
     79 *                  of the physical memory
     80 *  rtmp1:          a register to be used as temporary
     81 *  rtmp2:          a register to be used as temporary
     82 *  rd:             register where the result will be saved
     83 *
    8384 */
    8485#define TTE_DATA(addr, rphysmem_start, rtmp1, rtmp2, rd) \
     
    9091/*
    9192 * Here is where the kernel is passed control from the boot loader.
    92  * 
     93 *
    9394 * The registers are expected to be in this state:
    94  * - %o0 starting address of physical memory + bootstrap processor flag
    95  *      bits 63...1:    physical memory starting address / 2
    96  *      bit 0:          non-zero on BSP processor, zero on AP processors
    97  * - %o1 bootinfo structure address (BSP only)
    98  * - %o2 bootinfo structure size (BSP only)
     95 *  - %o0 bootinfo structure address (BSP only)
     96 *  - %o1 starting address of physical memory
     97 *        + bootstrap processor flag
     98 *          bits 63...1: physical memory starting address / 2
     99 *          bit 0:       non-zero on BSP processor, zero on AP processors
    99100 *
    100101 * Moreover, we depend on boot having established the following environment:
    101  * - TLBs are on
    102  * - identity mapping for the kernel image
     102 *  - TLBs are on
     103 *  - identity mapping for the kernel image
     104 *
    103105 */
    104106.global kernel_image_start
    105107kernel_image_start:
    106108        mov BSP_FLAG, %l0
    107         and %o0, %l0, %l7                       ! l7 <= bootstrap processor?
    108         andn %o0, %l0, %l6                      ! l6 <= start of physical memory
    109         or %o1, %g0, %l1
    110         or %o2, %g0, %l2
     109        and %o1, %l0, %l7                       ! l7 <= bootstrap processor?
     110        andn %o1, %l0, %l6                      ! l6 <= start of physical memory
     111        or %o0, %g0, %l0
    111112
    112113        ! Get bits (PHYSMEM_ADDR_SIZE - 1):13 of physmem_base.
     
    245246        sub %sp, STACK_BIAS, %sp
    246247
    247         or %l1, %g0, %o1
    248         or %l2, %g0, %o2
    249         sethi %hi(bootinfo), %o0
    250         call memcpy                             ! copy bootinfo
    251         or %o0, %lo(bootinfo), %o0
    252 
     248        or %l0, %g0, %o0
    253249        call arch_pre_main
    254250        nop
Note: See TracChangeset for help on using the changeset viewer.