diff options
Diffstat (limited to 'cactus/cactus_main.c')
-rw-r--r-- | cactus/cactus_main.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/cactus/cactus_main.c b/cactus/cactus_main.c new file mode 100644 index 0000000..a67d1fe --- /dev/null +++ b/cactus/cactus_main.c @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <console.h> +#include <debug.h> +#include <pl011.h> +#include <plat_arm.h> +#include <platform_def.h> +#include <secure_partition.h> +#include <std_svc.h> + +#include "cactus.h" +#include "cactus_tests.h" + +extern const char build_message[]; +extern const char version_string[]; + +static void cactus_print_memory_layout(secure_partition_boot_info_t *boot_info) +{ + NOTICE("Secure Partition memory layout:\n"); + NOTICE(" Secure Partition image : %p - %p\n", + (void *) boot_info->sp_image_base, + (void *)(boot_info->sp_image_base + boot_info->sp_image_size)); + NOTICE(" Text region : %p - %p\n", + (void *) CACTUS_TEXT_START, (void *) CACTUS_TEXT_END); + NOTICE(" Read-only data region : %p - %p\n", + (void *) CACTUS_RODATA_START, (void *) CACTUS_RODATA_END); + NOTICE(" Read-write data region : %p - %p\n", + (void *) CACTUS_RWDATA_START, (void *) CACTUS_RWDATA_END); + NOTICE(" BSS region : %p - %p\n", + (void *) CACTUS_BSS_START, (void *) CACTUS_BSS_END); + NOTICE(" Unused SP image space : %p - %p\n", + (void *) CACTUS_BSS_END, + (void *)(boot_info->sp_image_base + boot_info->sp_image_size)); + NOTICE(" EL3-EL0 shared buffer : %p - %p\n", + (void *) boot_info->sp_shared_buf_base, + (void *)(boot_info->sp_shared_buf_base + boot_info->sp_shared_buf_size)); + NOTICE(" S-NS shared buffer : %p - %p\n", + (void *) boot_info->sp_ns_comm_buf_base, + (void *)(boot_info->sp_ns_comm_buf_base + boot_info->sp_ns_comm_buf_size)); + NOTICE(" Stack region : %p - %p\n", + (void *) boot_info->sp_stack_base, + (void *)(boot_info->sp_stack_base + + (boot_info->sp_pcpu_stack_size * boot_info->num_cpus))); + NOTICE(" Heap region : %p - %p\n", + (void *) boot_info->sp_heap_base, + (void *)(boot_info->sp_heap_base + boot_info->sp_heap_size)); + NOTICE("Total memory : %p - %p\n", + (void *) boot_info->sp_mem_base, (void *) boot_info->sp_mem_limit); +} + +int cactus_main(void *el3_el0_buffer, size_t el3_el0_buffer_size) +{ + console_init(PLAT_ARM_UART_BASE, + PLAT_ARM_UART_CLK_IN_HZ, + PL011_BAUDRATE); + + NOTICE("Booting test Secure Partition Cactus\n"); + NOTICE("%s\n", build_message); + NOTICE("%s\n", version_string); + NOTICE("Running at S-EL0\n"); + + cactus_print_memory_layout(el3_el0_buffer); + + misc_tests(); + system_setup_tests(); + mem_attr_changes_tests((secure_partition_boot_info_t *)el3_el0_buffer); + + return 0; +} |