Ignore:
Timestamp:
Mar 6, 2019, 4:37:15 PM (5 years ago)
Author:
alain
Message:

Introduce three new types of vsegs (KCODE,KDATA,KDEV)
to map the kernel vsegs in the process VSL and GPT.
This now used by both the TSAR and the I86 architectures.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/boot/tsar_mips32/boot_entry.S

    r439 r623  
    2323
    2424/**********************************************************************************************
    25  * This file contains the entry point of the ALMOS-MK boot-loader for TSAR architecture.      *
    26  * It supports a generic multi-clusters / multi-processors architecture                       *
     25 * This file contains the entry point of the ALMOS-MK boot-loader for TSAR architecture,      *
     26 * that is a generic multi-clusters / multi-processors architecture.                          *
    2727 *                                                                                            *
    2828 * - The number of clusters is defined by the (X_SIZE, Y_SIZE) parameters in the              *
     
    3131 *   hard_config.h file (up to 4 processors per cluster).                                     *
    3232 *                                                                                            *
    33  * This assembly code is executed by all cores. It has 2 versions (in order to see if the     *
    34  * contention created by the ARCHINFO core descriptor table scanning loops is acceptable):    *
    35  * with or without the assumption that the core hardware identifier gid has a fixed format:   *
     33 * This assembly code is executed by all cores, but at the same time, because all cores       *
     34 * are not simultaneously activated. It makes the assuption that the CPO register containing  *
     35 * the core gid (global hardware identifier) has a fixed format:                              *
     36 *    gid == (((x << Y_WIDTH) + y) << P_WIDTH) + lid                                          *
    3637 *                                                                                            *
    37  * - Version with fixed format: gid == (((x << Y_WIDTH) + y) << PADDR_WIDTH) + lid            *
    38  *   It does 3 things:                                                                        *
    39  *      + It initializes the stack pointer depending on the lid extracted from the gid,       *
    40  *        using the BOOT_STACK_BASE and BOOT_STACK_SIZE parameters defined in the             *
    41  *        'boot_config.h' file,                                                               *
    42  *      + It changes the value of the address extension registers using the cxy extracted     *
    43  *        from the gid,                                                                       *
    44  *      + It jumps to the boot_loader() function defined in the 'boot.c' file and passes 2    *
    45  *        arguments which are the cxy and lid of each core to this function.                  *
    46  *                                                                                            *
    47  * - Version without fixed format                                                             *
    48  *   It has to perform an additional step in order to extract the (cxy,lid) values from the   *
    49  *   arch_info.bin structure that has been loaded in the cluster (0,0) memory by the bscpu.   *
    50  *      + Each core other than the bscpu scans the core descriptor table in the arch_info.bin *
    51  *        structure to make an associative search on the (gid), and get the (cxy,lid).        *
    52  *      + It initializes the stack pointer depending on the lid, using the BOOT_STACK_BASE    *
    53  *        and BOOT_STACK_SIZE parameters defined in the 'boot_config.h' file,                 *
    54  *      + It changes the value of the address extension registers using cxy obtained          *
    55  *        previously,                                                                         *
    56  *      + It jumps to the boot_loader() function defined in the 'boot.c' file and passes 2    *
    57  *        arguments which are the cxy and lid of each core to this function.                  *
     38 * It does 3 things:                                                                          *
     39 * - It initializes the stack pointer depending on the lid extracted from the gid,            *
     40 *   using the BOOT_STACK_BASE and BOOT_STACK_SIZE parameters defined in the                  *
     41 *   'boot_config.h' file,                                                                    *
     42 * - It changes the value of the DATA address extension register using the cxy extracted      *
     43 *   from the gid,                                                                            *
     44 * - It jumps to the boot_loader() function defined in the 'boot.c' file, passing the two     *
     45 *   arguments (cxy and lid).                                                                 *
    5846 *********************************************************************************************/
    5947
     
    7260boot_entry:
    7361
    74 #if USE_FIXED_FORMAT
    75 
    76 /*************
    77  * VERSION 1 *
    78  *************/
    79 
    80     /*
    81      * Get (cxy, lid) values from gid contained in coprocessor0 register.
    82      */
     62    /* Get (cxy, lid) values from gid contained in CP0 register  */
    8363
    8464    mfc0    k0,     CP0_PROCID         
     
    8767    srl     t2,     k0,     P_WIDTH                     /* t2 <= cxy                        */
    8868   
    89     /* Initialize stack pointer from previously retrieved lid value  */
     69    /* Initialize stack pointer from lid value  */
    9070   
    9171    la      t0,     BOOT_STACK_BASE                     /* t0 <= BOOT_STACK_BASE            */
     
    9373    multu   k1,     t1
    9474    mflo    k0                                          /* k0 <= BOOT_STACK_SIZE * lid      */
    95     subu    sp,     t0,     k0                          /* P[cxy,lid] stack top initialized */
     75    subu    sp,     t0,     k0                          /* P[cxy,lid] sp initialized        */
    9676
    97     /* Switch to local DSPACE by changing the value of the address extension registers  */
     77    /* Switch to local DSPACE by changing the value of the address extension register       */
    9878
    9979    mtc2    t2,     CP2_DATA_PADDR_EXT
    10080
    101     /* Jump to boot_loader() function after passing 2 arguments in the registers  */
     81    /* Jump to boot_loader() function after passing (cxy,lid) arguments in the registers    */
    10282
    10383    or      a0,     zero,   t1                          /* a0 <= lid                        */     
     
    10787    nop
    10888
    109 #else
    110 
    111 /*************
    112  * VERSION 2 *
    113  *************/
    114 
    115     /* Test if this is bscpu  */
    116 
    117     mfc0    k0,     CP0_PROCID         
    118     andi    k0,     k0,     0xFFF                       /* k0 <= gid                        */
    119 
    120     li      t1,     BOOT_CORE_GID                       /* t1 <= bscpu gid                  */
    121     or      t3,     zero,   zero                        /* t3 <= bscpu lid = 0              */
    122     beq     k0,     t1,     bscpu_exit                  /* if bscpu, skip scanning core tbl */
    123     li      t4,     BOOT_CORE_CXY                       /* t4 <= bscpu cxy                  */
    124 
    125     /* Get base address of the core descriptor table in 'arch_info.bin' file */
    126 
    127     la      t0,     ARCHINFO_BASE                       /* t0 <= ARCHINFO_BASE              */
    128     li      t1,     0x80                                /* t1 <= ARCHINFO_HEADER_SIZE       */
    129     addu    t2,     t0,     t1                          /* t2 <= ARCHINFO_CORE_BASE         */
    130 
    131     /* scan the core descriptor table if this is not bscpu. TODO If not found?  */
    132 
    133     li      t3,     0x8                                 /* t3 <= ARCHINFO_CORE_SIZE         */
    134    
    135 scanning_core_table:
    136     lw      t1,     0(t2)                               /* t1 <= archinfo_core.gid          */
    137     bne     t1,     k0,     scanning_core_table         /* if (t1 != k0) => loop            */
    138     addu    t2,     t2,     t3                          /* t2 <= @ next archinfo_core       */
    139 
    140     /* Get (cxy, lid) values from the found core descriptor  */
    141    
    142     lw      t3,     -8(t2)                              /* t3 <= lid                        */
    143     lw      t4,     -4(t2)                              /* t4 <= cxy                        */
    144 
    145     /* Initialize stack pointer from previously retrieved lid value  */
    146 
    147 bscpu_exit:   
    148     la      t0,     BOOT_STACK_BASE                     /* t0 <= BOOT_STACK_BASE            */
    149     li      k1,     BOOT_STACK_SIZE                     /* k1 <= BOOT_STACK_SIZE            */
    150     multu   k1,     t3
    151     mflo    k0                                          /* k0 <= BOOT_STACK_SIZE * lid      */
    152     subu    sp,     t0,     k0                          /* P[cxy,lid] stack top initialized */
    153 
    154     /* Switch to local DSPACE by changing the value of the address extension registers  */
    155 
    156     mtc2    t4,     CP2_DATA_PADDR_EXT
    157 
    158     /* Jumping to boot_loader() function after passing 2 arguments in registers */
    159 
    160     or      a0,     zero,   t3                          /* a0 <= lid                        */     
    161     or      a1,     zero,   t4                          /* a1 <= cxy                        */
    162     la      ra,     boot_loader
    163     jr      ra
    164     nop
    165 
    166 #endif
    167 
    16889    .end boot_entry
    16990
Note: See TracChangeset for help on using the changeset viewer.