8 * Copyright (c) 2016 ETH Zurich.
11 * This file is distributed under the terms in the attached LICENSE file.
12 * If you do not find this file, copies can be found by writing to:
13 * ETH Zurich D-INFK, Universitaetsstrasse 6, CH-8092 Zurich. Attn: Systems Group.
18 #include <arch/arm/platform.h>
20 #include <arch/arm/lpuart.h>
21 #include <arch/arm/gic.h>
23 #include <getopt/getopt.h>
25 #include <dev/armv8_dev.h>
26 #include <barrelfish_kpi/arm_core_data.h>
28 #include <arch/armv8/global.h>
30 /* RAM starts at 0, provided by the MMAP */
31 lpaddr_t phys_memory_start= 0;
34 * ----------------------------------------------------------------------------
36 * ----------------------------------------------------------------------------
39 lpaddr_t platform_gic_distributor_base = 0x51a00000;
40 lpaddr_t platform_gic_redistributor_base = 0x51b00000;
43 * ----------------------------------------------------------------------------
45 * ----------------------------------------------------------------------------
50 * ----------------------------------------------------------------------------
52 * ----------------------------------------------------------------------------
54 #define GLOBAL_TIMER_INTERRUPT 30
57 /* the maximum number of UARTS supported */
58 #define MAX_NUM_UARTS 1
60 /* the serial console port */
61 unsigned int serial_console_port = 0;
63 /* the debug console port */
64 unsigned int serial_debug_port = 0;
66 /* the number of physical ports */
67 unsigned serial_num_physical_ports = 1;
70 lpaddr_t platform_uart_base[MAX_NUM_UARTS] =
76 size_t platform_uart_size[MAX_NUM_UARTS] =
81 errval_t serial_init(unsigned port, bool initialize_hw)
83 lvaddr_t base = local_phys_to_mem(platform_uart_base[port]);
84 lpuart_init(port, base, initialize_hw);
89 * Do any extra initialisation for this particular CPU (e.g. A9/A15).
91 void platform_revision_init(void)
97 * Figure out how much RAM we have
99 size_t platform_get_ram_size(void)
105 * Boot secondary processors
107 errval_t platform_boot_core(hwid_t target, genpaddr_t gen_entry, genpaddr_t context)
109 printf("Invoking PSCI on: cpu=0x%lx, entry=0x%lx, context=0x%lx\n", target, gen_entry, context);
110 struct armv8_core_data *cd = (struct armv8_core_data *)local_phys_to_mem(context);
111 cd->page_table_root = armv8_TTBR1_EL1_rd(NULL);
112 cd->cpu_driver_globals_pointer = (uintptr_t)global;
113 __asm volatile("dsb sy\n"
116 return psci_cpu_on(target, gen_entry, context);
119 void platform_notify_bsp(lpaddr_t *mailbox)
126 * Return the core count
128 size_t platform_get_core_count(void)
134 * Print system identification. MMU is NOT yet enabled.
136 void platform_print_id(void)
142 * Fill out provided `struct platform_info`
144 void platform_get_info(struct platform_info *pi)
146 pi->arch = PI_ARCH_ARMV8A;
147 pi->platform = PI_PLATFORM_IMX8X;
150 uint32_t platform_get_timer_interrupt(void){
151 return GLOBAL_TIMER_INTERRUPT;
154 void armv8_get_info(struct arch_info_armv8 *ai)