Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/mips32/src/mips32.c

    r2277e03 r36df4109  
    3434
    3535#include <arch.h>
     36#include <arch/arch.h>
    3637#include <typedefs.h>
    3738#include <errno.h>
     
    4142#include <memstr.h>
    4243#include <userspace.h>
    43 #include <console/console.h>
    4444#include <syscall/syscall.h>
    4545#include <sysinfo/sysinfo.h>
    4646#include <arch/debug.h>
    4747#include <arch/debugger.h>
    48 #include <arch/drivers/msim.h>
    49 #include <genarch/fb/fb.h>
    50 #include <genarch/drivers/dsrln/dsrlnin.h>
    51 #include <genarch/drivers/dsrln/dsrlnout.h>
    52 #include <genarch/srln/srln.h>
     48#include <arch/machine_func.h>
    5349
    5450/* Size of the code jumping to the exception handler code
     
    6157#define CACHE_EXC  ((char *) 0x80000100)
    6258
     59static void mips32_pre_mm_init(void);
     60static void mips32_post_mm_init(void);
     61static void mips32_post_smp_init(void);
     62
     63arch_ops_t mips32_ops = {
     64        .pre_mm_init = mips32_pre_mm_init,
     65        .post_mm_init = mips32_post_mm_init,
     66        .post_smp_init = mips32_post_smp_init,
     67};
     68
     69arch_ops_t *arch_ops = &mips32_ops;
    6370
    6471/* Why the linker moves the variable 64K away in assembler
     
    7178size_t cpu_count = 0;
    7279
     80#if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
     81size_t sdram_size = 0;
     82#endif
     83
    7384/** Performs mips32-specific initialization before main_bsp() is called. */
    74 void arch_pre_main(void *entry __attribute__((unused)), bootinfo_t *bootinfo)
     85void mips32_pre_main(void *entry __attribute__((unused)), bootinfo_t *bootinfo)
    7586{
    7687        init.cnt = min3(bootinfo->cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS);
     
    8899                        cpu_count++;
    89100        }
    90 }
    91 
    92 void arch_pre_mm_init(void)
     101
     102#if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
     103        sdram_size = bootinfo->sdram_size;
     104#endif
     105
     106        /* Initialize machine_ops pointer. */
     107        machine_ops_init();
     108}
     109
     110void mips32_pre_mm_init(void)
    93111{
    94112        /* It is not assumed by default */
     
    121139}
    122140
    123 void arch_post_mm_init(void)
     141void mips32_post_mm_init(void)
    124142{
    125143        interrupt_init();
    126        
    127 #ifdef CONFIG_FB
    128         /* GXemul framebuffer */
    129         fb_properties_t gxemul_prop = {
    130                 .addr = 0x12000000,
    131                 .offset = 0,
    132                 .x = 640,
    133                 .y = 480,
    134                 .scan = 1920,
    135                 .visual = VISUAL_RGB_8_8_8,
    136         };
    137        
    138         outdev_t *fbdev = fb_init(&gxemul_prop);
    139         if (fbdev)
    140                 stdout_wire(fbdev);
    141 #endif
    142 
    143 #ifdef CONFIG_MIPS_PRN
    144         outdev_t *dsrlndev = dsrlnout_init((ioport8_t *) MSIM_KBD_ADDRESS);
    145         if (dsrlndev)
    146                 stdout_wire(dsrlndev);
    147 #endif
    148 }
    149 
    150 void arch_post_cpu_init(void)
    151 {
    152 }
    153 
    154 void arch_pre_smp_init(void)
    155 {
    156 }
    157 
    158 void arch_post_smp_init(void)
    159 {
    160         static const char *platform;
    161 
     144
     145        machine_init();
     146        machine_output_init();
     147}
     148
     149void mips32_post_smp_init(void)
     150{
    162151        /* Set platform name. */
    163 #ifdef MACHINE_msim
    164         platform = "msim";
    165 #endif
    166 #ifdef MACHINE_bgxemul
    167         platform = "gxemul";
    168 #endif
    169 #ifdef MACHINE_lgxemul
    170         platform = "gxemul";
    171 #endif
    172         sysinfo_set_item_data("platform", NULL, (void *) platform,
    173             str_size(platform));
    174 
    175 #ifdef CONFIG_MIPS_KBD
    176         /*
    177          * Initialize the msim/GXemul keyboard port. Then initialize the serial line
    178          * module and connect it to the msim/GXemul keyboard. Enable keyboard interrupts.
    179          */
    180         dsrlnin_instance_t *dsrlnin_instance
    181             = dsrlnin_init((dsrlnin_t *) MSIM_KBD_ADDRESS, MSIM_KBD_IRQ);
    182         if (dsrlnin_instance) {
    183                 srln_instance_t *srln_instance = srln_init();
    184                 if (srln_instance) {
    185                         indev_t *sink = stdin_wire();
    186                         indev_t *srln = srln_wire(srln_instance, sink);
    187                         dsrlnin_wire(dsrlnin_instance, srln);
    188                         cp0_unmask_int(MSIM_KBD_IRQ);
    189                 }
    190         }
    191        
    192         /*
    193          * This is the necessary evil until the userspace driver is entirely
    194          * self-sufficient.
    195          */
    196         sysinfo_set_item_val("kbd", NULL, true);
    197         sysinfo_set_item_val("kbd.inr", NULL, MSIM_KBD_IRQ);
    198         sysinfo_set_item_val("kbd.address.physical", NULL,
    199             PA2KA(MSIM_KBD_ADDRESS));
    200 #endif
     152        sysinfo_set_item_data("platform", NULL,
     153            (void *) machine_get_platform_name(),
     154            str_size(machine_get_platform_name()));
     155
     156        machine_input_init();
    201157}
    202158
     
    235191}
    236192
    237 /** Set thread-local-storage pointer
    238  *
    239  * We have it currently in K1, it is
    240  * possible to have it separately in the future.
    241  */
    242 sysarg_t sys_tls_set(uintptr_t addr)
    243 {
    244         return EOK;
    245 }
    246 
    247193void arch_reboot(void)
    248194{
Note: See TracChangeset for help on using the changeset viewer.