Esempio n. 1
0
/**
 * PE_init_platform
 *
 * Initialize the platform expert for ARM.
 */
void PE_init_platform(boolean_t vm_initialized, void * _args)
{
    boot_args *args = (boot_args *)_args;

    if (PE_state.initialized == FALSE) {
        PE_early_puts("PE_init_platform: My name is Macintosh.\n");
        PE_early_puts("PE_init_platform: Initializing for the first time.\n");

        PE_state.initialized            = TRUE;
        PE_state.bootArgs               = _args;
        PE_state.deviceTreeHead         = args->deviceTreeP;

        PE_state.video.v_baseAddr       = args->Video.v_baseAddr;
        PE_state.video.v_rowBytes       = args->Video.v_rowBytes;
        PE_state.video.v_width          = args->Video.v_width;
        PE_state.video.v_height         = args->Video.v_height;
        PE_state.video.v_depth          = args->Video.v_depth;
        PE_state.video.v_display        = args->Video.v_display;

        strcpy(PE_state.video.v_pixelFormat, "PPPPPPPP");
    }

    if (!vm_initialized)
    {
        /* Initialize the device tree crap. */
        PE_early_puts("PE_init_platform: Initializing device tree\n");
        DTInit(PE_state.deviceTreeHead);

        PE_early_puts("PE_init_platform: Calling pe_identify_machine\n");
        pe_identify_machine(NULL);
    }
    else
    {
        kprintf("PE_init_platform: It sure is great to get out of that bag.\n");

        PE_init_SocSupport();

        pe_arm_init_interrupts(NULL);
    }
}
Esempio n. 2
0
void PE_init_SocSupport_stub(void)
{
    PE_early_puts("PE_init_SocSupport: Initializing for ARM RealView PB-A8\n");
    PE_init_SocSupport_realview();
}
Esempio n. 3
0
void PE_init_SocSupport_stub(void)
{
    PE_early_puts("PE_init_SocSupport: Initializing for S5L8900X\n");
    PE_init_SocSupport_S5L8900X();
}
Esempio n. 4
0
void PE_init_SocSupport_stub(void)
{
    PE_early_puts("PE_init_SocSupport: Initializing for RASPBERRYPI\n");
    PE_init_SocSupport_raspberrypi();
}
Esempio n. 5
0
/**
 * arm_init
 *
 * Initialize the core ARM subsystems, this routine is called from the
 * boot loader. A basic identity mapping is created in __start, however,
 * arm_vm_init will create new mappings.
 */
void arm_init(boot_args* args) {
    cpu_data_t*     bootProcessorData;
    processor_t     bootProcessor;
    uint32_t        baMaxMem;
    uint64_t        maxMem;
    thread_t        thread;

    /*
     * Welcome to arm_init, may I take your order?
     */
    PE_early_puts("arm_init: starting up\n");
    
    /*
     * arm_init is only called on processor #0, the others will enter using arm_slave_init.
     */
    bootProcessor = cpu_processor_alloc(TRUE);
    if(!bootProcessor) {
        panic("Something really wacky happened here with cpu_processor_alloc\n");
    }
    
    /*
     * Pin the processor information to CPU #0.
     */
    PE_early_puts("arm_init: calling cpu_bootstrap\n");
    cpu_bootstrap();
    
    /*
     * Initialize core processor data.
     */
    bootProcessorData = current_cpu_datap();
    
    bootProcessorData->cpu_number = 0;
    bootProcessorData->cpu_active_stack = &irqstack;
    bootProcessorData->cpu_phys_number = 0;
    bootProcessorData->cpu_preemption_level = 1;
    bootProcessorData->cpu_interrupt_level = 0;
    bootProcessorData->cpu_running = 1;
    
    /*
     * Initialize the core thread subsystem (This sets up a template
     * which will then be used to initialize the rest of the thread
     * system later.)
     *
     * Additionally, this also sets the current kernel thread register
     * to our bootstrap thread.
     */
    PE_early_puts("arm_init: calling thread_bootstrap\n");
    thread_bootstrap();

    /*
     * CPU initialization.
     */
    PE_early_puts("arm_init: calling cpu_init\n");
    cpu_init();
    
    /*
     * Mach processor bootstrap.
     */
    PE_early_puts("arm_init: calling processor_bootstrap\n");
    processor_bootstrap();

    /*
     * Initialize the ARM platform expert.
     */
    PE_early_puts("arm_init: calling PE_init_platform\n");
    PE_init_platform(FALSE, (void*)args);
    
    /*
     * Initialize kprintf, but no VM is running yet.
     */
    PE_init_kprintf(FALSE);
    
    /*
     * Set maximum memory size based on boot-args.
     */
    if(!PE_parse_boot_argn("maxmem", &baMaxMem, sizeof(baMaxMem)))
        maxMem = 0;
    else
        maxMem = (uint64_t)baMaxMem * (1024 * 1024);
    
    /*
     * After this, we'll no longer be using physical mappings created by the bootloader.
     */
    arm_vm_init(maxMem, args);

    /*
     * Kernel early bootstrap.
     */
    kernel_early_bootstrap();
    
    /*
     * PE platform init.
     */
    PE_init_platform(TRUE, (void*)args);

    /*
     * Enable I+D cache.
     */
    char tempbuf[16];
    
    if(PE_parse_boot_argn("-no-cache", tempbuf, sizeof(tempbuf))) {
        kprintf("cache: No caching enabled (I+D).\n");
    } else {
        kprintf("cache: initializing i+dcache\n");
        cache_initialize();
        kprintf("cache: done\n");
    }

    /*
     * Start system timers.
     */
    thread = current_thread();
    thread->machine.preempt_count = 1;
    thread->machine.cpu_data = cpu_datap(cpu_number());
    thread->kernel_stack = irqstack;
    timer_start(&thread->system_timer, mach_absolute_time());
    
    /*
     * VFP/float initialization.
     */
    init_vfp();
    
    /*
     * Machine startup.
     */
    machine_startup();
    
    /*
     * If anything returns, bad things(tm) have happened.
     */
    PE_early_puts("arm_init: Still alive\n");
    panic("why are we still here, NOO");
    while(1);
}
Esempio n. 6
0
/**
 * PE_init_platform
 *
 * Initialize the platform expert for ARM.
 */
void PE_init_platform(boolean_t vm_initialized, void * _args)
{
    boot_args *args = (boot_args *)_args;
    
    if (PE_state.initialized == FALSE) {
        PE_early_puts("PE_init_platform: My name is Macintosh.\n");
        PE_early_puts("PE_init_platform: Initializing for the first time.\n");
        
        PE_state.initialized            = TRUE;
        PE_state.bootArgs               = _args;
        PE_state.deviceTreeHead         = args->deviceTreeP;

        PE_state.video.v_baseAddr       = args->Video.v_baseAddr;
        PE_state.video.v_rowBytes       = args->Video.v_rowBytes;
        PE_state.video.v_width          = args->Video.v_width;
        PE_state.video.v_height         = args->Video.v_height;
        PE_state.video.v_depth          = args->Video.v_depth;
        PE_state.video.v_display        = args->Video.v_display;
        
        strcpy(PE_state.video.v_pixelFormat, "PPPPPPPP");
    }
    
    if (!vm_initialized)
	{
        /* Initialize the device tree crap. */
        PE_early_puts("PE_init_platform: Initializing device tree\n");
        DTInit(PE_state.deviceTreeHead);
        
        PE_early_puts("PE_init_platform: Calling pe_identify_machine\n");
        pe_identify_machine(NULL);
	}
	else
	{
        DTEntry             entry;
        char*               fversion, map;
        unsigned int        size;

        pe_initialized = 1;

        kprintf("PE_init_platform: It sure is great to get out of that bag.\n");
        PE_init_SocSupport();

        /* Reset kputc. */
        PE_kputc = gPESocDispatch.uart_putc;

        /* XXX: Real iOS kernel does iBoot/debug-enabled init after the DTInit call. */
        if( kSuccess == DTLookupEntry(NULL, "/chosen", &entry)) {
            /* What's the iBoot version on this bad boy? */
            if( kSuccess == DTGetProperty(entry, "firmware-version", (void **) &fversion, &size)) {
                if(fversion && (strlen(fversion) <= 32)) {
                    ovbcopy((void*)fversion, (void*)firmware_version, strlen(fversion));
                }
            }
            /* Is the SoC debug-enabled? */
            if( kSuccess == DTGetProperty(entry, "debug-enabled", (void **) &map, &size)) {
                debug_enabled = 1;
            }            
        }

        pe_arm_init_interrupts(NULL);
	}
}
Esempio n. 7
0
/**
 * arm_init
 *
 * Initialize the core ARM subsystems, this routine is called from the
 * boot loader. A basic identity mapping is created in __start, however,
 * arm_vm_init will create new mappings.
 */
void arm_init(boot_args * args)
{
    cpu_data_t *bootProcessorData;
    processor_t bootProcessor;
    uint32_t baMaxMem;
    uint64_t maxMem;
    thread_t thread;

    /*
     * We are in. 
     */
    PE_early_puts("arm_init: starting up\n");

    /*
     * arm_init is only called on processor #0, the others will enter using arm_slave_init. 
     */
    bootProcessor = cpu_processor_alloc(TRUE);
    if (!bootProcessor) {
        panic("cpu_processor_alloc failed\n");
    }

    /*
     * Pin the processor information to CPU #0. 
     */
    PE_early_puts("arm_init: calling cpu_bootstrap\n");
    cpu_bootstrap();

    /*
     * Initialize core processor data. 
     */
    bootProcessorData = current_cpu_datap();

    bootProcessorData->cpu_number = 0;
    bootProcessorData->cpu_active_stack = (vm_offset_t)&irqstack;
    bootProcessorData->cpu_phys_number = 0;
    bootProcessorData->cpu_preemption_level = 1;
    bootProcessorData->cpu_interrupt_level = 0;
    bootProcessorData->cpu_running = 1;
    bootProcessorData->cpu_pending_ast = AST_NONE;

    /*
     * Initialize the core thread subsystem (This sets up a template
     * which will then be used to initialize the rest of the thread
     * system later.)
     *
     * Additionally, this also sets the current kernel thread register
     * to our bootstrap thread.
     */
    PE_early_puts("arm_init: calling thread_bootstrap\n");
    thread_bootstrap();

    /*
     * CPU initialization. 
     */
    PE_early_puts("arm_init: calling cpu_init\n");
    cpu_init();

    /*
     * Mach processor bootstrap. 
     */
    PE_early_puts("arm_init: calling processor_bootstrap\n");
    processor_bootstrap();

    /*
     * Initialize the ARM platform expert. 
     */
    PE_early_puts("arm_init: calling PE_init_platform\n");
    PE_init_platform(FALSE, (void *) args);

    /*
     * Initialize kprintf, but no VM is running yet. 
     */
    PE_init_kprintf(FALSE);

    /*
     * Set maximum memory size based on boot-args. 
     */
    if (!PE_parse_boot_argn("maxmem", &baMaxMem, sizeof(baMaxMem)))
        maxMem = 0;
    else
        maxMem = (uint64_t) baMaxMem *(1024 * 1024);

    /*
     * After this, we'll no longer be using physical mappings created by the bootloader. 
     */
    arm_vm_init(maxMem, args);

    /*
     * Kernel early bootstrap. 
     */
    kernel_early_bootstrap();

    /*
     * PE platform init. 
     */
    PE_init_platform(TRUE, (void *) args);

    /*
     * Enable I+D cache. 
     */
    char tempbuf[16];

    if (PE_parse_boot_argn("-no-cache", tempbuf, sizeof(tempbuf))) {
        kprintf("cache: No caching enabled (I+D).\n");
    } else {
        kprintf("cache: initializing i+dcache ... ");
        cache_initialize();
        kprintf("done\n");
    }

    /*
     * Specify serial mode. 
     */
    serialmode = 0;
    if (PE_parse_boot_argn("serial", &serialmode, sizeof(serialmode))) {
        /*
         * We want a serial keyboard and/or console 
         */
        kprintf("Serial mode specified: %08X\n", serialmode);
    }

    if (serialmode & 1) {
        (void) switch_to_serial_console();
        disableConsoleOutput = FALSE;   /* Allow printfs to happen */
    }

    /*
     * Start system timers. 
     */
    thread = current_thread();
    thread->machine.preempt_count = 1;
    thread->machine.cpu_data = cpu_datap(cpu_number());
    thread->kernel_stack = irqstack;
    timer_start(&thread->system_timer, mach_absolute_time());

    /*
     * Processor identification.
     */
    arm_processor_identify();

    /*
     * VFP/float initialization. 
     */
    init_vfp();

    /*
     * Machine startup. 
     */
    machine_startup();

    /*
     * If we return, something very bad is happening. 
     */
    panic("20:02:14 <DHowett> wwwwwwwat is HAAAAAAAPPENING\n");

    /*
     * Last chance. 
     */
    while (1) ;
}
Esempio n. 8
0
void PE_init_SocSupport(void)
{
    PE_early_puts("PE_init_SocSupport: initializing SoC dispatch\n");
    PE_init_SocSupport_stub();
    return;
}
Esempio n. 9
0
void PE_init_SocSupport_stub(void)
{
    PE_early_puts("PE_init_SocSupport: Initializing for SUN4I\n");
    PE_init_SocSupport_sun4i();
}