Changeset dabaa83 in mainline


Ignore:
Timestamp:
2019-06-05T06:37:17Z (5 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f3f4149
Parents:
77918b0
Message:

Add boot arguments support for Malta

This commit makes it possible to pass console configuration via proper
boot arguemnts instead of having a hardcoded value in the kernel.

Files:
8 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/mips32/include/arch/main.h

    r77918b0 rdabaa83  
    3030#define BOOT_mips32_MAIN_H_
    3131
    32 extern void bootstrap(void);
     32extern void bootstrap(int, char **);
    3333
    3434#endif
  • boot/arch/mips32/include/arch/types.h

    r77918b0 rdabaa83  
    3535#define CPUMAP_MAX_RECORDS         32
    3636#define BOOTINFO_TASK_NAME_BUFLEN  32
     37#define BOOTINFO_BOOTARGS_BUFLEN   256
    3738
    3839typedef struct {
     
    5657        uint32_t cpumap;
    5758        taskmap_t taskmap;
     59        char bootargs[BOOTINFO_BOOTARGS_BUFLEN];
    5860} bootinfo_t;
    5961
  • boot/arch/mips32/src/asm.S

    r77918b0 rdabaa83  
    3636.section BOOTSTRAP
    3737
     38/*
     39 * Registers on entry:
     40 *
     41 *   a0: kernel argument count (kargc)
     42 *   a1: kernel argument vector (kargv) of kargc elements
     43 *   a2: unused here (kenvp on Malta)
     44 *   a3: RAM size on Malta
     45 *
     46 * This is the case on Malta.
     47 * msim clears these registers, so it is de facto correct as well.
     48 */
    3849SYMBOL(start)
    3950        /*
     
    4354         *  - Disable 64-bit user addressing mode
    4455         */
    45         mfc0 $a0, $status
    46         la $a1, 0xffffff1f
    47         and $a0, $a1, $a0
    48         mtc0 $a0, $status
     56        mfc0 $t0, $status
     57        la $t1, 0xffffff1f
     58        and $t0, $t1, $t0
     59        mtc0 $t0, $status
    4960
    5061#if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
     
    5263         * Remember the size of the SDRAM in bootinfo.
    5364         */
    54         la $a0, PA2KA(BOOTINFO_OFFSET)
    55         sw $a3, 0($a0)
     65        la $t0, PA2KA(BOOTINFO_OFFSET)
     66        sw $a3, 0($t0)
    5667#endif
    5768
     
    6172         * but it not an issue).
    6273         */
    63         la $a0, PA2KA(CPUMAP_OFFSET)
     74        la $t0, PA2KA(CPUMAP_OFFSET)
    6475
    65         sw $zero, 0($a0)
    66         sw $zero, 4($a0)
    67         sw $zero, 8($a0)
    68         sw $zero, 12($a0)
     76        sw $zero, 0($t0)
     77        sw $zero, 4($t0)
     78        sw $zero, 8($t0)
     79        sw $zero, 12($t0)
    6980
    70         sw $zero, 16($a0)
    71         sw $zero, 20($a0)
    72         sw $zero, 24($a0)
    73         sw $zero, 28($a0)
     81        sw $zero, 16($t0)
     82        sw $zero, 20($t0)
     83        sw $zero, 24($t0)
     84        sw $zero, 28($t0)
    7485
    75         sw $zero, 32($a0)
    76         sw $zero, 36($a0)
    77         sw $zero, 40($a0)
    78         sw $zero, 44($a0)
     86        sw $zero, 32($t0)
     87        sw $zero, 36($t0)
     88        sw $zero, 40($t0)
     89        sw $zero, 44($t0)
    7990
    80         sw $zero, 48($a0)
    81         sw $zero, 52($a0)
    82         sw $zero, 56($a0)
    83         sw $zero, 60($a0)
     91        sw $zero, 48($t0)
     92        sw $zero, 52($t0)
     93        sw $zero, 56($t0)
     94        sw $zero, 60($t0)
    8495
    85         sw $zero, 64($a0)
    86         sw $zero, 68($a0)
    87         sw $zero, 72($a0)
    88         sw $zero, 76($a0)
     96        sw $zero, 64($t0)
     97        sw $zero, 68($t0)
     98        sw $zero, 72($t0)
     99        sw $zero, 76($t0)
    89100
    90         sw $zero, 80($a0)
    91         sw $zero, 84($a0)
    92         sw $zero, 88($a0)
    93         sw $zero, 92($a0)
     101        sw $zero, 80($t0)
     102        sw $zero, 84($t0)
     103        sw $zero, 88($t0)
     104        sw $zero, 92($t0)
    94105
    95         sw $zero, 96($a0)
    96         sw $zero, 100($a0)
    97         sw $zero, 104($a0)
    98         sw $zero, 108($a0)
     106        sw $zero, 96($t0)
     107        sw $zero, 100($t0)
     108        sw $zero, 104($t0)
     109        sw $zero, 108($t0)
    99110
    100         sw $zero, 112($a0)
    101         sw $zero, 116($a0)
    102         sw $zero, 120($a0)
    103         sw $zero, 124($a0)
     111        sw $zero, 112($t0)
     112        sw $zero, 116($t0)
     113        sw $zero, 120($t0)
     114        sw $zero, 124($t0)
    104115
    105         lui $a1, 1
     116        lui $t1, 1
    106117
    107118#ifdef MACHINE_msim
     
    119130
    120131        /* Record CPU presence */
    121         sll $a2, $k1, 2
    122         addu $a2, $a2, $a0
    123         sw $a1, ($a2)
     132        sll $t2, $k1, 2
     133        addu $t2, $t2, $t0
     134        sw $t1, ($t2)
    124135
    125136        loop:
     
    131142        bsp:
    132143                /* Record CPU presence */
    133                 sw $a1, ($a0)
     144                sw $t1, ($t0)
    134145
    135146                /* Setup initial stack */
    136147                la $sp, PA2KA(STACK_OFFSET)
    137148
     149                /* a0=kargc, a1=kargv */
    138150                j bootstrap
    139151                nop
  • boot/arch/mips32/src/main.c

    r77918b0 rdabaa83  
    4545static uint32_t *cpumap = (uint32_t *) PA2KA(CPUMAP_OFFSET);
    4646
    47 void bootstrap(void)
     47void bootstrap(int kargc, char **kargv)
    4848{
    4949        version_print();
     
    7979        }
    8080
     81        str_cpy(bootinfo->bootargs, sizeof(bootinfo->bootargs),
     82            (kargc > 1) ? kargv[1] : "");
     83
    8184        uintptr_t entry = check_kernel(kernel_start);
    8285
  • kernel/arch/mips32/include/arch/arch.h

    r77918b0 rdabaa83  
    4242#define CPUMAP_MAX_RECORDS         32
    4343#define BOOTINFO_TASK_NAME_BUFLEN  32
     44#define BOOTINFO_BOOTARGS_BUFLEN   256
    4445
    4546extern size_t cpu_count;
     
    6667        uint32_t cpumap;
    6768        taskmap_t taskmap;
     69        char bootargs[BOOTINFO_BOOTARGS_BUFLEN];
    6870} bootinfo_t;
    6971
  • kernel/arch/mips32/src/mach/malta/malta.c

    r77918b0 rdabaa83  
    4646#include <sysinfo/sysinfo.h>
    4747#include <log.h>
    48 #include <str.h>
    4948
    5049static void malta_init(void);
     
    116115            NULL, NULL, tty_out_ptr);
    117116#endif
    118 
    119         const char *args = "console=devices/\\hw\\pci0\\00:0a.0\\com1\\a";
    120         str_ncpy(bargs, CONFIG_BOOT_ARGUMENTS_BUFLEN, args, str_length(args));
    121117}
    122118
  • kernel/arch/mips32/src/mips32.c

    r77918b0 rdabaa83  
    107107#endif
    108108
     109        str_cpy(bargs, CONFIG_BOOT_ARGUMENTS_BUFLEN, bootinfo->bootargs);
     110
    109111        /* Initialize machine_ops pointer. */
    110112        machine_ops_init();
  • tools/ew.py

    r77918b0 rdabaa83  
    8787
    8888def malta_options():
    89         return '-cpu 4Kc'
     89        return '-cpu 4Kc -append "console=devices/\\hw\\pci0\\00:0a.0\\com1\\a"'
    9090
    9191def find_firmware(name, environ_var, default_paths, extra_info=None):
Note: See TracChangeset for help on using the changeset viewer.