Changeset 4872160 in mainline for kernel


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
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/arm32/include/arch.h

    rbb252ca r4872160  
    4545
    4646typedef struct {
    47         uintptr_t addr;
    48         uint32_t size;
     47        void *addr;
     48        size_t size;
    4949        char name[BOOTINFO_TASK_NAME_BUFLEN];
    5050} utask_t;
    5151
    5252typedef struct {
    53         uint32_t cnt;
     53        size_t cnt;
    5454        utask_t tasks[TASKMAP_MAX_RECORDS];
    5555} bootinfo_t;
  • kernel/arch/arm32/include/mm/frame.h

    rbb252ca r4872160  
    4646
    4747#define BOOT_PAGE_TABLE_SIZE     0x4000
    48 #define BOOT_PAGE_TABLE_ADDRESS  0x4000
     48#define BOOT_PAGE_TABLE_ADDRESS  0x8000
    4949
    5050#define BOOT_PAGE_TABLE_START_FRAME     (BOOT_PAGE_TABLE_ADDRESS >> FRAME_WIDTH)
  • kernel/arch/arm32/src/arm32.c

    rbb252ca r4872160  
    6262void arch_pre_main(void *entry __attribute__((unused)), bootinfo_t *bootinfo)
    6363{
    64         unsigned int i;
     64        init.cnt = min3(bootinfo->cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS);
    6565       
    66         init.cnt = bootinfo->cnt;
    67        
    68         for (i = 0; i < min3(bootinfo->cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS); ++i) {
    69                 init.tasks[i].addr = bootinfo->tasks[i].addr;
     66        size_t i;
     67        for (i = 0; i < init.cnt; i++) {
     68                init.tasks[i].addr = (uintptr_t) bootinfo->tasks[i].addr;
    7069                init.tasks[i].size = bootinfo->tasks[i].size;
    7170                str_cpy(init.tasks[i].name, CONFIG_TASK_NAME_BUFLEN,
  • kernel/arch/ia64/include/bootinfo.h

    rbb252ca r4872160  
    3232#define BOOTINFO_ADDRESS 0x4401000
    3333
    34 #define CONFIG_INIT_TASKS       32
     34#define TASKMAP_MAX_RECORDS  32
    3535
    3636#define MEMMAP_ITEMS 128
     
    4444
    4545typedef struct {
    46         void *addr; 
    47         unsigned long size;
     46        void *addr;
     47        size_t size;
    4848        char name[BOOTINFO_TASK_NAME_BUFLEN];
    4949} binit_task_t;
    5050       
    5151typedef struct {
    52         unsigned long count;
    53         binit_task_t tasks[CONFIG_INIT_TASKS];
     52        size_t cnt;
     53        binit_task_t tasks[TASKMAP_MAX_RECORDS];
    5454} binit_t;
    5555
     
    5858        unsigned long base;
    5959        unsigned long size;
    60 }efi_memmap_item_t;
    61 
     60} efi_memmap_item_t;
    6261
    6362typedef struct {
    6463        binit_t taskmap;
    65 
     64       
    6665        efi_memmap_item_t memmap[MEMMAP_ITEMS];
    6766        unsigned int memmap_items;
    68 
     67       
    6968        unative_t *sapic;
    7069        unsigned long sys_freq;
  • kernel/arch/ia64/src/ia64.c

    rbb252ca r4872160  
    4747#include <mm/as.h>
    4848#include <config.h>
     49#include <macros.h>
    4950#include <userspace.h>
    5051#include <console/console.h>
     
    7879void arch_pre_main(void)
    7980{
    80         /* Setup usermode init tasks. */
    81 
    82         unsigned int i;
    83        
    84         init.cnt = bootinfo->taskmap.count;
    85        
     81        init.cnt = min3(bootinfo->taskmap.cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS);
     82        size_t i;
    8683        for (i = 0; i < init.cnt; i++) {
    8784                init.tasks[i].addr =
  • kernel/arch/mips32/include/arch.h

    rbb252ca r4872160  
    4545
    4646typedef struct {
    47         uintptr_t addr;
     47        void *addr;
    4848        size_t size;
    4949        char name[BOOTINFO_TASK_NAME_BUFLEN];
  • kernel/arch/mips32/src/mips32.c

    rbb252ca r4872160  
    8383void arch_pre_main(void *entry __attribute__((unused)), bootinfo_t *bootinfo)
    8484{
    85         /* Setup usermode */
    86         init.cnt = bootinfo->cnt;
     85        init.cnt = min3(bootinfo->cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS);
    8786       
    8887        size_t i;
    89         for (i = 0; i < min3(bootinfo->cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS); i++) {
    90                 init.tasks[i].addr = bootinfo->tasks[i].addr;
     88        for (i = 0; i < init.cnt; i++) {
     89                init.tasks[i].addr = (uintptr_t) bootinfo->tasks[i].addr;
    9190                init.tasks[i].size = bootinfo->tasks[i].size;
    9291                str_cpy(init.tasks[i].name, CONFIG_TASK_NAME_BUFLEN,
  • kernel/arch/ppc32/include/arch.h

    rbb252ca r4872160  
    3636#define KERN_ppc32_ARCH_H_
    3737
    38 extern void arch_pre_main(void);
     38#include <arch/boot/boot.h>
     39
     40extern void arch_pre_main(bootinfo_t *);
    3941
    4042#endif
  • kernel/arch/ppc32/include/boot/boot.h

    rbb252ca r4872160  
    5252
    5353typedef struct {
    54         uintptr_t addr;
    55         uint32_t size;
     54        void *addr;
     55        size_t size;
    5656        char name[BOOTINFO_TASK_NAME_BUFLEN];
    5757} utask_t;
    5858
    5959typedef struct {
    60         uint32_t count;
     60        size_t cnt;
    6161        utask_t tasks[TASKMAP_MAX_RECORDS];
    6262} taskmap_t;
    6363
    6464typedef struct {
    65         uintptr_t start;
    66         uint32_t size;
     65        void *start;
     66        size_t size;
    6767} memzone_t;
    6868
    6969typedef struct {
    70         uint32_t total;
    71         uint32_t count;
     70        uint64_t total;
     71        size_t cnt;
    7272        memzone_t zones[MEMMAP_MAX_RECORDS];
    7373} memmap_t;
     
    8080} bootinfo_t;
    8181
    82 extern bootinfo_t bootinfo;
     82extern memmap_t memmap;
    8383
    8484#endif
  • kernel/arch/ppc32/src/boot/boot.S

    rbb252ca r4872160  
    4747       
    4848        # r3 contains physical address of bootinfo_t
    49         # r4 contains size of bootinfo_t
    50        
    51         cmpwi r4, 0
    52         beq bootinfo_end
    5349       
    5450        addis r3, r3, 0x8000
    55        
    56         lis r31, bootinfo@ha
    57         addi r31, r31, bootinfo@l  # r31 = bootinfo
    58        
    59         bootinfo_loop:
    60                
    61                 lwz r30, 0(r3)
    62                 stw r30, 0(r31)
    63                
    64                 addi r3, r3, 4
    65                 addi r31, r31, 4
    66                 subi r4, r4, 4
    67                
    68                 cmpwi r4, 0
    69                 bgt bootinfo_loop
    70                
    71         bootinfo_end:
    72        
    7351        bl arch_pre_main
    7452        b main_bsp
  • kernel/arch/ppc32/src/mm/frame.c

    rbb252ca r4872160  
    2727 */
    2828
    29 /** @addtogroup ppc32mm 
     29/** @addtogroup ppc32mm
    3030 * @{
    3131 */
     
    4141
    4242uintptr_t last_frame = 0;
     43memmap_t memmap;
    4344
    4445void physmem_print(void)
     
    4950        printf("---------- ----------\n");
    5051               
    51         for (i = 0; i < bootinfo.memmap.count; i++) {
    52                 printf("%#10x %#10x\n", bootinfo.memmap.zones[i].start,
    53                         bootinfo.memmap.zones[i].size);
     52        for (i = 0; i < memmap.cnt; i++) {
     53                printf("%#10x %#10x\n", memmap.zones[i].start,
     54                        memmap.zones[i].size);
    5455        }
    5556}
     
    6263        size_t size;
    6364       
    64         for (i = 0; i < bootinfo.memmap.count; i++) {
    65                 start = ADDR2PFN(ALIGN_UP(bootinfo.memmap.zones[i].start, FRAME_SIZE));
    66                 size = SIZE2FRAMES(ALIGN_DOWN(bootinfo.memmap.zones[i].size, FRAME_SIZE));
     65        for (i = 0; i < memmap.cnt; i++) {
     66                start = ADDR2PFN(ALIGN_UP((uintptr_t) memmap.zones[i].start, FRAME_SIZE));
     67                size = SIZE2FRAMES(ALIGN_DOWN(memmap.zones[i].size, FRAME_SIZE));
    6768               
    6869                if ((minconf < start) || (minconf >= start + size))
     
    7273               
    7374                zone_create(start, size, conf, 0);
    74                 if (last_frame < ALIGN_UP(bootinfo.memmap.zones[i].start + bootinfo.memmap.zones[i].size, FRAME_SIZE))
    75                         last_frame = ALIGN_UP(bootinfo.memmap.zones[i].start + bootinfo.memmap.zones[i].size, FRAME_SIZE);
     75                if (last_frame < ALIGN_UP((uintptr_t) memmap.zones[i].start + memmap.zones[i].size, FRAME_SIZE))
     76                        last_frame = ALIGN_UP((uintptr_t) memmap.zones[i].start + memmap.zones[i].size, FRAME_SIZE);
    7677        }
    7778       
  • kernel/arch/ppc32/src/mm/page.c

    rbb252ca r4872160  
    4545}
    4646
    47 
    4847uintptr_t hw_map(uintptr_t physaddr, size_t size)
    4948{
  • kernel/arch/ppc32/src/ppc32.c

    rbb252ca r4872160  
    6565
    6666/** Performs ppc32-specific initialization before main_bsp() is called. */
    67 void arch_pre_main(void)
    68 {
    69         init.cnt = bootinfo.taskmap.count;
    70        
    71         uint32_t i;
    72        
    73         for (i = 0; i < min3(bootinfo.taskmap.count, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS); i++) {
    74                 init.tasks[i].addr = bootinfo.taskmap.tasks[i].addr;
    75                 init.tasks[i].size = bootinfo.taskmap.tasks[i].size;
     67void arch_pre_main(bootinfo_t *bootinfo)
     68{
     69        /* Copy tasks map. */
     70        init.cnt = min3(bootinfo->taskmap.cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS);
     71        size_t i;
     72        for (i = 0; i < init.cnt; i++) {
     73                init.tasks[i].addr = (uintptr_t) bootinfo->taskmap.tasks[i].addr;
     74                init.tasks[i].size = bootinfo->taskmap.tasks[i].size;
    7675                str_cpy(init.tasks[i].name, CONFIG_TASK_NAME_BUFLEN,
    77                     bootinfo.taskmap.tasks[i].name);
     76                    bootinfo->taskmap.tasks[i].name);
     77        }
     78       
     79        /* Copy physical memory map. */
     80        memmap.total = bootinfo->memmap.total;
     81        memmap.cnt = min(bootinfo->memmap.cnt, MEMMAP_MAX_RECORDS);
     82        for (i = 0; i < memmap.cnt; i++) {
     83                memmap.zones[i].start = bootinfo->memmap.zones[i].start;
     84                memmap.zones[i].size = bootinfo->memmap.zones[i].size;
    7885        }
    7986       
    8087        /* Copy boot allocations info. */
    81         ballocs.base = bootinfo.ballocs.base;
    82         ballocs.size = bootinfo.ballocs.size;
    83        
    84         ofw_tree_init(bootinfo.ofw_root);
     88        ballocs.base = bootinfo->ballocs.base;
     89        ballocs.size = bootinfo->ballocs.size;
     90       
     91        /* Copy OFW tree. */
     92        ofw_tree_init(bootinfo->ofw_root);
    8593}
    8694
  • kernel/arch/sparc64/include/arch.h

    rbb252ca r4872160  
    2727 */
    2828
    29 /** @addtogroup sparc64 
     29/** @addtogroup sparc64
    3030 * @{
    3131 */
    3232/**
    3333 * @file
    34  * @brief       Various sparc64-specific macros.
     34 * @brief Various sparc64-specific macros.
    3535 */
    3636
    3737#ifndef KERN_sparc64_ARCH_H_
    3838#define KERN_sparc64_ARCH_H_
     39
     40#include <arch/boot/boot.h>
    3941
    4042#if defined (SUN4U)
     
    4446#endif
    4547
    46 #define ASI_AIUP                0x10    /** Access to primary context with user privileges. */
    47 #define ASI_AIUS                0x11    /** Access to secondary context with user privileges. */
     48#define ASI_AIUP  0x10  /** Access to primary context with user privileges. */
     49#define ASI_AIUS  0x11  /** Access to secondary context with user privileges. */
    4850
    49 #define NWINDOWS                8       /** Number of register window sets. */
     51#define NWINDOWS  8  /** Number of register window sets. */
    5052
    5153#ifndef __ASM__
    5254
    53 extern void arch_pre_main(void);
     55extern void arch_pre_main(bootinfo_t *);
    5456
    5557#endif /* __ASM__ */
    56 
    5758
    5859#endif
  • kernel/arch/sparc64/include/boot/boot.h

    rbb252ca r4872160  
    2727 */
    2828
    29 /** @addtogroup sparc64 
     29/** @addtogroup sparc64
    3030 * @{
    3131 */
     
    3636#define KERN_sparc64_BOOT_H_
    3737
    38 #define VMA                     0x400000
    39 #define LMA                     VMA
     38#define VMA  0x400000
     39#define LMA  VMA
    4040
    4141#ifndef __ASM__
     
    4646#include <genarch/ofw/ofw_tree.h>
    4747
    48 #define TASKMAP_MAX_RECORDS     32
    49 #define MEMMAP_MAX_RECORDS      32
     48#define TASKMAP_MAX_RECORDS  32
     49#define MEMMAP_MAX_RECORDS   32
    5050
    51 #define BOOTINFO_TASK_NAME_BUFLEN 32
     51#define BOOTINFO_TASK_NAME_BUFLEN  32
    5252
    5353typedef struct {
    54         void * addr;
    55         uint32_t size;
     54        void *addr;
     55        size_t size;
    5656        char name[BOOTINFO_TASK_NAME_BUFLEN];
    5757} utask_t;
    5858
    5959typedef struct {
    60         uint32_t count;
     60        size_t cnt;
    6161        utask_t tasks[TASKMAP_MAX_RECORDS];
    6262} taskmap_t;
    6363
    6464typedef struct {
    65         uintptr_t start;
    66         uint32_t size;
     65        void *start;
     66        size_t size;
    6767} memzone_t;
    6868
    6969typedef struct {
    70         uint32_t total;
    71         uint32_t count;
     70        uint64_t total;
     71        size_t cnt;
    7272        memzone_t zones[MEMMAP_MAX_RECORDS];
    7373} memmap_t;
     
    7676 *
    7777 * Must be in sync with bootinfo structure used by the boot loader.
     78 *
    7879 */
    7980typedef struct {
     
    8586} bootinfo_t;
    8687
    87 extern bootinfo_t bootinfo;
     88extern memmap_t memmap;
     89extern uintptr_t physmem_start;
    8890
    8991#endif
  • 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
  • kernel/genarch/include/ofw/ofw_tree.h

    rbb252ca r4872160  
    3434#define OFW_TREE_PROPERTY_MAX_NAMELEN  32
    3535
     36typedef uint32_t phandle;
     37
    3638/** Memory representation of OpenFirmware device tree node property. */
    3739typedef struct {
     
    4749        struct ofw_tree_node *child;
    4850       
    49         uint32_t node_handle;           /**< Old OpenFirmware node handle. */
     51        phandle node_handle;            /**< Old OpenFirmware node handle. */
    5052       
    5153        char *da_name;                  /**< Disambigued name. */
    5254       
    53         unsigned int properties;        /**< Number of properties. */
     55        size_t properties;              /**< Number of properties. */
    5456        ofw_tree_property_t *property;
    5557       
     
    8385    const char *);
    8486extern ofw_tree_node_t *ofw_tree_find_node_by_handle(ofw_tree_node_t *,
    85     uint32_t);
     87    phandle);
    8688
    8789#endif
  • kernel/genarch/src/ofw/ofw_tree.c

    rbb252ca r4872160  
    6565    const char *name)
    6666{
    67         unsigned int i;
     67        size_t i;
    6868       
    6969        for (i = 0; i < node->properties; i++) {
     
    170170 */
    171171ofw_tree_node_t *ofw_tree_find_node_by_handle(ofw_tree_node_t *root,
    172     uint32_t handle)
     172    phandle handle)
    173173{
    174174        ofw_tree_node_t *cur;
Note: See TracChangeset for help on using the changeset viewer.