Ignore:
File:
1 edited

Legend:

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

    r36df4109 r2277e03  
    3434
    3535#include <arch.h>
    36 #include <arch/arch.h>
    3736#include <typedefs.h>
    3837#include <errno.h>
     
    4241#include <memstr.h>
    4342#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/machine_func.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>
    4953
    5054/* Size of the code jumping to the exception handler code
     
    5761#define CACHE_EXC  ((char *) 0x80000100)
    5862
    59 static void mips32_pre_mm_init(void);
    60 static void mips32_post_mm_init(void);
    61 static void mips32_post_smp_init(void);
    62 
    63 arch_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 
    69 arch_ops_t *arch_ops = &mips32_ops;
    7063
    7164/* Why the linker moves the variable 64K away in assembler
     
    7871size_t cpu_count = 0;
    7972
    80 #if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
    81 size_t sdram_size = 0;
    82 #endif
    83 
    8473/** Performs mips32-specific initialization before main_bsp() is called. */
    85 void mips32_pre_main(void *entry __attribute__((unused)), bootinfo_t *bootinfo)
     74void arch_pre_main(void *entry __attribute__((unused)), bootinfo_t *bootinfo)
    8675{
    8776        init.cnt = min3(bootinfo->cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS);
     
    9988                        cpu_count++;
    10089        }
    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 
    110 void mips32_pre_mm_init(void)
     90}
     91
     92void arch_pre_mm_init(void)
    11193{
    11294        /* It is not assumed by default */
     
    139121}
    140122
    141 void mips32_post_mm_init(void)
     123void arch_post_mm_init(void)
    142124{
    143125        interrupt_init();
    144 
    145         machine_init();
    146         machine_output_init();
    147 }
    148 
    149 void mips32_post_smp_init(void)
    150 {
     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
     150void arch_post_cpu_init(void)
     151{
     152}
     153
     154void arch_pre_smp_init(void)
     155{
     156}
     157
     158void arch_post_smp_init(void)
     159{
     160        static const char *platform;
     161
    151162        /* Set platform name. */
    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();
     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
    157201}
    158202
     
    191235}
    192236
     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 */
     242sysarg_t sys_tls_set(uintptr_t addr)
     243{
     244        return EOK;
     245}
     246
    193247void arch_reboot(void)
    194248{
Note: See TracChangeset for help on using the changeset viewer.