HelenOS sources
This source file includes following definitions.
- sparc64_pre_main
- sun4v_pre_mm_init
- sun4v_post_mm_init
- sun4v_post_smp_init
- calibrate_delay_loop
- asm_delay_loop
- arch_get_initial_sp
- userspace
- arch_reboot
- arch_construct_function
- irq_initialize_arch
#include <arch.h>
#include <arch/arch.h>
#include <debug.h>
#include <config.h>
#include <macros.h>
#include <arch/trap/trap.h>
#include <arch/console.h>
#include <arch/sun4v/md.h>
#include <console/console.h>
#include <arch/boot/boot.h>
#include <arch/arch.h>
#include <arch/asm.h>
#include <arch/mm/page.h>
#include <arch/stack.h>
#include <interrupt.h>
#include <genarch/ofw/ofw_tree.h>
#include <userspace.h>
#include <ddi/irq.h>
#include <stdbool.h>
#include <str.h>
#include <arch/drivers/niagara.h>
#include <sysinfo/sysinfo.h>
static void sun4v_pre_mm_init(void);
static void sun4v_post_mm_init(void);
static void sun4v_post_smp_init(void);
arch_ops_t sun4v_ops = {
.pre_mm_init = sun4v_pre_mm_init,
.post_mm_init = sun4v_post_mm_init,
.post_smp_init = sun4v_post_smp_init,
};
arch_ops_t *sparc64_ops = &sun4v_ops;
memmap_t memmap;
void sparc64_pre_main(bootinfo_t *bootinfo)
{
init.cnt = min3(bootinfo->taskmap.cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS);
size_t i;
for (i = 0; i < init.cnt; i++) {
init.tasks[i].paddr = KA2PA(bootinfo->taskmap.tasks[i].addr);
init.tasks[i].size = bootinfo->taskmap.tasks[i].size;
str_cpy(init.tasks[i].name, CONFIG_TASK_NAME_BUFLEN,
bootinfo->taskmap.tasks[i].name);
}
memmap.total = bootinfo->memmap.total;
memmap.cnt = min(bootinfo->memmap.cnt, MEMMAP_MAX_RECORDS);
for (i = 0; i < memmap.cnt; i++) {
memmap.zones[i].start = bootinfo->memmap.zones[i].start;
memmap.zones[i].size = bootinfo->memmap.zones[i].size;
}
md_init();
}
void sun4v_pre_mm_init(void)
{
if (config.cpu_active == 1) {
trap_init();
exc_arch_init();
}
}
void sun4v_post_mm_init(void)
{
if (config.cpu_active == 1) {
ofw_sysinfo_map();
irq_init(1 << 11, 128);
}
}
void sun4v_post_smp_init(void)
{
static const char *platform = "sun4v";
sysinfo_set_item_data("platform", NULL, (void *) platform,
str_size(platform));
niagarain_init();
}
void calibrate_delay_loop(void)
{
CPU->delay_loop_const = 1;
}
void asm_delay_loop(const uint32_t usec)
{
uint64_t stop = tick_read() + (uint64_t) usec * (uint64_t)
CPU->arch.clock_frequency / 1000000;
while (tick_read() < stop)
;
}
uintptr_t arch_get_initial_sp(uintptr_t stack_base, uintptr_t stack_size)
{
return ALIGN_DOWN(stack_base + stack_size - STACK_WINDOW_SAVE_AREA_SIZE - STACK_ARG_SAVE_AREA_SIZE, 16) - STACK_BIAS;
}
void userspace(uintptr_t pc, uintptr_t sp)
{
(void) interrupts_disable();
switch_to_userspace(pc, sp, 0);
while (true)
;
}
void arch_reboot(void)
{
while (true)
;
}
void *arch_construct_function(fncptr_t *fptr, void *addr, void *caller)
{
return addr;
}
void irq_initialize_arch(irq_t *irq)
{
(void) irq;
}
HelenOS homepage, sources at GitHub