Changeset 96e0748d in mainline for boot/arch


Ignore:
Timestamp:
2009-02-17T22:47:27Z (16 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f89979b
Parents:
e662a5f
Message:

make arch_pre_main optional, don't force any specific prototype
simplify boot process
mips32: detect number of configured CPUs in msim

Location:
boot/arch
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/arm32/loader/asm.h

    re662a5f r96e0748d  
    3333/** @file
    3434 *  @brief Functions implemented in assembly.
    35  */ 
     35 */
    3636
    3737
     
    4141
    4242/** Copies cnt bytes from dst to src.
    43  * 
     43 *
    4444 * @param dst Destination address.
    4545 * @param src Source address.
    46  * @param cnt Count of bytes to be copied. 
     46 * @param cnt Count of bytes to be copied.
    4747 */
    4848#define memcpy(dst, src, cnt) __builtin_memcpy((dst), (src), (cnt))
     
    5959/** Jumps to the kernel entry point.
    6060 *
    61  * @param entry          Kernel entry point address.
    62  * @param bootinfo       Structure holding information about loaded tasks.
    63  * @param bootinfo_size  Size of the bootinfo structure.
     61 * @param entry    Kernel entry point address.
     62 * @param bootinfo Structure holding information about loaded tasks.
     63 *
    6464 */
    65 extern void jump_to_kernel(void *entry, void *bootinfo,
    66     unsigned int bootinfo_size) __attribute__((noreturn));
     65extern void jump_to_kernel(void *entry, void *bootinfo) __attribute__((noreturn));
    6766
    6867
  • boot/arch/arm32/loader/boot.S

    re662a5f r96e0748d  
    5454page_table:
    5555        .skip PTL0_ENTRIES * PTL0_ENTRY_SIZE
    56 
    57 
  • boot/arch/arm32/loader/main.c

    re662a5f r96e0748d  
    3333/** @file
    3434 *  @brief Bootstrap.
    35  */ 
     35 */
    3636
    3737
     
    4040#include "_components.h"
    4141#include <printf.h>
     42#include <align.h>
    4243#include <macros.h>
    4344
     
    110111       
    111112        printf("\nBooting the kernel...\n");
    112         jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS, &bootinfo, sizeof(bootinfo));
     113        jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS, &bootinfo);
    113114}
    114115
  • boot/arch/arm32/loader/main.h

    re662a5f r96e0748d  
    3333/** @file
    3434 *  @brief Boot related declarations.
    35  */ 
     35 */
    3636
    3737
     
    3939#define BOOT_arm32_MAIN_H
    4040
    41 
    42 /** Aligns to the nearest higher address.
    43  *
    44  * @param addr  Address or number to be aligned.
    45  * @param align Size of alignment, must be power of 2.
    46  */
    47 #define ALIGN_UP(addr, align) (((addr) + ((align) - 1)) & ~((align) - 1))
    4841
    4942/** Maximum number of tasks in the #bootinfo_t struct. */
     
    7568/** @}
    7669 */
    77 
  • boot/arch/mips32/loader/asm.h

    re662a5f r96e0748d  
    3030#define BOOT_mips32_ASM_H_
    3131
    32 #define PAGE_SIZE 16384
    33 #define PAGE_WIDTH 14
     32#define PAGE_SIZE   16384
     33#define PAGE_WIDTH  14
    3434
    35 #define memcpy(dst, src, cnt)   __builtin_memcpy((dst), (src), (cnt))
     35#define memcpy(dst, src, cnt)  __builtin_memcpy((dst), (src), (cnt))
    3636
    37 void jump_to_kernel(void *entry, void *bootinfo, unsigned int bootinfo_size) __attribute__((noreturn));
     37void jump_to_kernel(void *entry, void *bootinfo) __attribute__((noreturn));
    3838
    3939#endif
  • boot/arch/mips32/loader/boot.S

    re662a5f r96e0748d  
    2828
    2929#include "regname.h"
    30 
    31 #define INITIAL_STACK        0x80040000
    32 #define MSIM_DORDER_ADDRESS  0x90000004
     30#include "main.h"
    3331
    3432.set noat
     
    4139start:
    4240       
     41        /* Setup CPU map (on msim this code
     42           is executed in parallel on all CPUs,
     43           but it not an issue) */
     44        la $a0, CPUMAP
     45       
     46        sw $zero, 0($a0)
     47        sw $zero, 4($a0)
     48        sw $zero, 8($a0)
     49        sw $zero, 12($a0)
     50       
     51        sw $zero, 16($a0)
     52        sw $zero, 20($a0)
     53        sw $zero, 24($a0)
     54        sw $zero, 28($a0)
     55       
     56        sw $zero, 32($a0)
     57        sw $zero, 36($a0)
     58        sw $zero, 40($a0)
     59        sw $zero, 44($a0)
     60       
     61        sw $zero, 48($a0)
     62        sw $zero, 52($a0)
     63        sw $zero, 56($a0)
     64        sw $zero, 60($a0)
     65       
     66        sw $zero, 64($a0)
     67        sw $zero, 68($a0)
     68        sw $zero, 72($a0)
     69        sw $zero, 76($a0)
     70       
     71        sw $zero, 80($a0)
     72        sw $zero, 84($a0)
     73        sw $zero, 88($a0)
     74        sw $zero, 92($a0)
     75       
     76        sw $zero, 96($a0)
     77        sw $zero, 100($a0)
     78        sw $zero, 104($a0)
     79        sw $zero, 108($a0)
     80       
     81        sw $zero, 112($a0)
     82        sw $zero, 116($a0)
     83        sw $zero, 120($a0)
     84        sw $zero, 124($a0)
     85       
     86        lui $a1, 1
     87       
    4388#ifdef MACHINE_msim
     89       
    4490        /* Read dorder value */
    4591        la $k0, MSIM_DORDER_ADDRESS
    46         lw $k0, ($k0)
     92        lw $k1, ($k0)
    4793       
    4894        /* If we are not running on BSP
    49            end in an infinite loop  */
    50         beq $k0, $zero, bsp
     95           then end in an infinite loop  */
     96        beq $k1, $zero, bsp
    5197        nop
     98       
     99        /* Record CPU presence */
     100        sll $a2, $k1, 2
     101        addu $a2, $a2, $a0
     102        sw $a1, ($a2)
    52103       
    53104        loop:
     
    58109       
    59110        bsp:
     111                /* Record CPU presence */
     112                sw $a1, ($a0)
     113               
    60114                /* Setup initial stack */
    61                 lui $sp, INITIAL_STACK >> 16
    62                 ori $sp, $sp, INITIAL_STACK & 0xffff
     115                la $sp, INITIAL_STACK
    63116               
    64117                j bootstrap
  • boot/arch/mips32/loader/main.c

    re662a5f r96e0748d  
    2929#include "main.h"
    3030#include <printf.h>
     31#include <align.h>
    3132#include <macros.h>
    3233#include "msim.h"
     
    7475       
    7576        printf("\nCopying components\n");
     77       
    7678        unsigned int top = 0;
    7779        bootinfo.cnt = 0;
    78         for (i = 0; i < COMPONENTS; i++) {
     80        for (i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) {
    7981                printf(" %s...", components[i].name);
    8082                top = ALIGN_UP(top, PAGE_SIZE);
     
    8991        }
    9092       
     93        unsigned int *cpumap = (unsigned int *) CPUMAP;
     94        bootinfo.cpumap = 0;
     95        for (i = 0; i < CPUMAP_MAX_RECORDS; i++) {
     96                if (cpumap[i] != 0)
     97                        bootinfo.cpumap |= (1 << i);
     98        }
     99       
    91100        printf("\nBooting the kernel...\n");
    92         jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS, &bootinfo, sizeof(bootinfo));
     101        jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS, &bootinfo);
    93102}
  • boot/arch/mips32/loader/main.h

    re662a5f r96e0748d  
    3030#define BOOT_mips32_MAIN_H_
    3131
    32 /** Align to the nearest higher address.
    33  *
    34  * @param addr  Address or size to be aligned.
    35  * @param align Size of alignment, must be power of 2.
    36  */
    37 #define ALIGN_UP(addr, align) (((addr) + ((align) - 1)) & ~((align) - 1))
     32#define CPUMAP               0x80001000
     33#define INITIAL_STACK        0x80002000
     34#define MSIM_DORDER_ADDRESS  0xb0000004
    3835
    39 #define TASKMAP_MAX_RECORDS 32
     36#define TASKMAP_MAX_RECORDS  32
     37#define CPUMAP_MAX_RECORDS   32
     38
     39#ifndef __ASM__
    4040
    4141typedef struct {
     
    4545
    4646typedef struct {
     47        unsigned int cpumap;
    4748        unsigned int cnt;
    4849        task_t tasks[TASKMAP_MAX_RECORDS];
     
    5354
    5455#endif
     56
     57#endif
Note: See TracChangeset for help on using the changeset viewer.