#define ARMV8_BOOTMAGIC_PSCI 0xb001b001
#define ARMV8_BOOTMAGIC_PARKING 0xb001b002
+struct armv8_coredata_memreg
+{
+ genpaddr_t base;
+ gensize_t length;
+};
+
/**
* \brief Data sent to a newly booted kernel
*
*/
struct armv8_core_data {
- uint64_t boot_magic;
- lpaddr_t kernel_stack;
- lpaddr_t kernel_l0_pagetable;
- lpaddr_t kernel_global;
- lpaddr_t multiboot2; ///< The physical multiboot2 location
- uint64_t multiboot2_size;
- lpaddr_t efi_mmap;
- lpaddr_t module_start; ///< The start of the cpu module
- lpaddr_t module_end; ///< The end of the cpu module
- lpaddr_t urpc_frame_base;
- size_t urpc_frame_size;
- lpaddr_t monitor_binary;
- size_t monitor_binary_size;
- lpaddr_t memory_base_start;
- size_t memory_size;
- coreid_t src_core_id;
- hwid_t src_arch_id;
- coreid_t dst_core_id;
- char kernel_cmdline[128];
+ /**
+ * ARMv8 Boot magic field. Contains the value ARMV8_BOOTMAGIC_*
+ */
+ uint64_t boot_magic;
- lpaddr_t initrd_start;
- lpaddr_t initrd_size;
+ /**
+ * Physical address of the kernel stack
+ */
+ genpaddr_t cpu_driver_stack;
+
+ /**
+ * Physical address of the global data structure shared by all
+ */
+ genpaddr_t cpu_driver_globals_pointer;
+
+ /**
+ * CPU Driver entry point
+ */
+ genvaddr_t cpu_driver_entry;
+
+ /**
+ * CPU driver command line arguments
+ */
+ char cpu_driver_cmdline[128];
+
+ /**
+ * Physical address of the L0 page table in memory
+ */
+ genpaddr_t page_table_root;
+
+ /**
+ * Memory region to be used for the new CPU driver's allocations
+ */
+ struct armv8_coredata_memreg memory;
+
+ /**
+ * Memory region to be used for the new CPU driver's allocations
+ */
+ struct armv8_coredata_memreg urpc_frame;
+
+ /**
+ * Memory region to be used for the new CPU driver's allocations
+ */
+ struct armv8_coredata_memreg monitor_binary;
+
+ /**
+ * memory region of the multiboot image
+ */
+ struct armv8_coredata_memreg multiboot_image;
+ lpaddr_t efi_mmap;
uint64_t start_kernel_ram; ///< The physical start of allocated kernel memory
uint64_t start_free_ram; ///< The physical start of free ram for the bsp allocator
genpaddr_t kcb; ///< The kernel control block
- struct armv8_coredata_elf elf;
-}; //__attribute__ ((packed));
+
+ coreid_t src_core_id;
+ coreid_t dst_core_id;
+ hwid_t src_arch_id;
+ hwid_t dst_arch_id;
+
+
+};
#define ARMV8_CORE_DATA_PAGES 700
armv8_disable_interrupts();
/* set the ttbr0/1 */
- armv8_set_ttbr0(current_el, cd->kernel_l0_pagetable);
+ armv8_set_ttbr0(current_el, cd->page_table_root);
/* set the TCR */
armv8_set_tcr(current_el);
/* enable interrupts */
armv8_enable_interrupts();
- boot_bsp_init(cd->boot_magic, state, cd->kernel_stack);
+ boot_bsp_init(cd->boot_magic, state, cd->cpu_driver_stack);
}
mmap_find_memory(mmap);
- armv8_glbl_core_data->multiboot2 = mem_to_local_phys((lvaddr_t) mb);
- armv8_glbl_core_data->multiboot2_size = size;
+ armv8_glbl_core_data->multiboot_image.base = mem_to_local_phys((lvaddr_t) mb);
+ armv8_glbl_core_data->multiboot_image.length = size;
armv8_glbl_core_data->efi_mmap = mem_to_local_phys((lvaddr_t) mmap);
kernel_stack = stack;
struct armv8_core_data *core_data = (struct armv8_core_data*)pointer;
armv8_glbl_core_data = core_data;
- global = (struct global *)core_data->kernel_global;
+ global = (struct global *)core_data->cpu_driver_globals_pointer;
kernel_stack = stack;
my_core_id = core_data->dst_core_id;
{
printf("Invoking PSCI on: cpu=%lx, entry=%lx, context=%lx\n", target, gen_entry, context);
struct armv8_core_data *cd = (struct armv8_core_data *)local_phys_to_mem(context);
- cd->kernel_l0_pagetable = armv8_TTBR1_EL1_rd(NULL);
- cd->kernel_global = (uintptr_t)global;
+ cd->page_table_root = armv8_TTBR1_EL1_rd(NULL);
+ cd->cpu_driver_globals_pointer = (uintptr_t)global;
__asm volatile("dsb sy\n"
"dmb sy\n"
"isb \n");
/* Load init ELF64 binary */
struct multiboot_header_tag *multiboot =
(struct multiboot_header_tag *) local_phys_to_mem(
- armv8_glbl_core_data->multiboot2);
+ armv8_glbl_core_data->multiboot_image.base);
struct multiboot_tag_module_64 *module = multiboot2_find_module_64(
- multiboot, armv8_glbl_core_data->multiboot2_size, name);
+ multiboot, armv8_glbl_core_data->multiboot_image.length, name);
if (module == NULL) {
panic("Could not find init module!");
}
/* Create caps for multiboot modules */
struct multiboot_header_tag *multiboot =
- (struct multiboot_header_tag *)local_phys_to_mem(armv8_glbl_core_data->multiboot2);
+ (struct multiboot_header_tag *)local_phys_to_mem(armv8_glbl_core_data->multiboot_image.base);
// Allocate strings area
lpaddr_t mmstrings_phys = bsp_alloc_phys(BASE_PAGE_SIZE);
/* Walk over multiboot modules, creating frame caps */
size_t position = 0;
- size_t size = armv8_glbl_core_data->multiboot2_size;
+ size_t size = armv8_glbl_core_data->multiboot_image.length;
/* add the ACPI regions */
struct multiboot_tag_old_acpi *acpi_old = (struct multiboot_tag_old_acpi *)
// XXX: Create as devframe so the memory is not zeroed out
err = caps_create_new(ObjType_DevFrame,
- core_data->urpc_frame_base,
- core_data->urpc_frame_size,
- core_data->urpc_frame_size,
+ core_data->urpc_frame.base,
+ core_data->urpc_frame.length,
+ core_data->urpc_frame.length,
my_core_id,
urpc_frame_cte);
assert(err_is_ok(err));
genvaddr_t entry_point, got_base=0;
MSG("loading elf '%s' @ %" PRIxLPADDR "\n", name,
- local_phys_to_mem(core_data->monitor_binary));
+ local_phys_to_mem(core_data->monitor_binary.base));
err = elf_load(EM_AARCH64, startup_alloc_init, &l3_info,
- local_phys_to_mem(core_data->monitor_binary),
- core_data->monitor_binary_size, &entry_point);
+ local_phys_to_mem(core_data->monitor_binary.base),
+ core_data->monitor_binary.length, &entry_point);
if (err_is_fail(err)) {
//err_print_calltrace(err);
panic("ELF load of init module failed!");
}
// TODO: Fix application linkage so that it's non-PIC.
- struct Elf64_Shdr* got_shdr =
- elf64_find_section_header_name(local_phys_to_mem(core_data->monitor_binary),
- core_data->monitor_binary_size, ".got");
+ struct Elf64_Shdr* got_shdr;
+ got_shdr = elf64_find_section_header_name(local_phys_to_mem(core_data->monitor_binary.base),
+ core_data->monitor_binary.length, ".got");
if (got_shdr)
{
got_base = got_shdr->sh_addr;
/* Initialize the allocator */
- app_alloc_phys_start = (core_data->memory_base_start);
- app_alloc_phys_end = (core_data->memory_size + app_alloc_phys_start);
+ app_alloc_phys_start = (core_data->memory.base);
+ app_alloc_phys_end = (core_data->memory.length + app_alloc_phys_start);
- MSG("Memory: %lx, size=%zu kB\n", app_alloc_phys_start, core_data->memory_size >> 10);
MSG("Memory: %lx, %lx, size=%zu kB\n", app_alloc_phys_start, app_alloc_phys_end,
(app_alloc_phys_end - app_alloc_phys_start + 1) >> 10);
DECL(DISP_DISABLED_AREA, struct dispatcher_shared_aarch64, disabled_save_area);
DECL(DISP_TRAP_AREA, struct dispatcher_shared_aarch64, trap_save_area);
DECL(DISP_GENERIC, struct dispatcher_aarch64, generic);
- DECL(COREDATA_KERNEL_STACK, struct armv8_core_data, kernel_stack)
+ DECL(COREDATA_KERNEL_STACK, struct armv8_core_data, cpu_driver_stack)
#endif // __aarch64__
DECL(LMP_ENDPOINT_DELIVERED, struct lmp_endpoint_kern, delivered);