aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Nino Diaz <antonio.ninodiaz@arm.com>2018-06-26 10:30:10 +0100
committerAntonio Nino Diaz <antonio.ninodiaz@arm.com>2018-12-10 16:01:48 +0000
commit1486f3b57799e4148f09d8c00708c8c248690c70 (patch)
tree5970906ef2839619a5cf54d957752c4d1df9338e
parent54287c89b4d695e4e9c9ed558b14819cedf5789b (diff)
downloadtf-a-tests-1486f3b57799e4148f09d8c00708c8c248690c70.tar.gz
cactus: Remove boot info struct
This struct is now unused. Rather than keeping unused code in the repository, it's better to remove it. Change-Id: I2eb0f8c1a273df15c228ba72372b152e54f0fb27 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
-rw-r--r--spm/cactus/aarch64/cactus_entrypoint.S8
-rw-r--r--spm/cactus/cactus_main.c94
-rw-r--r--spm/cactus/cactus_tests.h16
-rw-r--r--spm/cactus/cactus_tests_memory_attributes.c13
4 files changed, 39 insertions, 92 deletions
diff --git a/spm/cactus/aarch64/cactus_entrypoint.S b/spm/cactus/aarch64/cactus_entrypoint.S
index 4323d0e99..214b4cfbd 100644
--- a/spm/cactus/aarch64/cactus_entrypoint.S
+++ b/spm/cactus/aarch64/cactus_entrypoint.S
@@ -17,17 +17,11 @@ stacks_end:
func cactus_entrypoint
- /* Save the base address and size of the buffer. */
- mov x20, x0
- mov x21, x1
-
/* Setup the stack pointer. */
adr x0, stacks_end
mov sp, x0
- /* And do the rest in C code */
- mov x0, x20
- mov x1, x21
+ /* And jump to the C entrypoint. */
b cactus_main
endfunc cactus_entrypoint
diff --git a/spm/cactus/cactus_main.c b/spm/cactus/cactus_main.c
index 4f0d1ae42..faf8cccd8 100644
--- a/spm/cactus/cactus_main.c
+++ b/spm/cactus/cactus_main.c
@@ -16,66 +16,43 @@
#include <std_svc.h>
#include "cactus.h"
+#include "cactus_def.h"
#include "cactus_tests.h"
-
/* Host machine information injected by the build system in the ELF file. */
extern const char build_message[];
extern const char version_string[];
-/*
- * The ARM Trusted Firmware passes a description of the memory resources
- * allocated to the secure partition through the x0 register. This maps to
- * a secure_partition_boot_info_t structure type.
- *
- * This functions prints the information stored in this structure.
- */
-static void cactus_print_memory_layout(const secure_partition_boot_info_t *boot_info)
+static void cactus_print_memory_layout(void)
{
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(" Image regions\n");
NOTICE(" Text region : %p - %p\n",
- (void *) CACTUS_TEXT_START, (void *) CACTUS_TEXT_END);
+ (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));
-
- assert(boot_info->sp_ns_comm_buf_base == ARM_SECURE_SERVICE_BUFFER_BASE);
- assert(boot_info->sp_ns_comm_buf_size == ARM_SECURE_SERVICE_BUFFER_SIZE);
-
- NOTICE(" Stacks region (%u CPUS) : %p - %p\n",
- boot_info->num_cpus,
- (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);
+ (void *)CACTUS_RODATA_START, (void *)CACTUS_RODATA_END);
+ NOTICE(" Data region : %p - %p\n",
+ (void *)CACTUS_DATA_START, (void *)CACTUS_DATA_END);
+ NOTICE(" BSS region : %p - %p\n",
+ (void *)CACTUS_BSS_START, (void *)CACTUS_BSS_END);
+ NOTICE(" Total image memory : %p - %p\n",
+ (void *)CACTUS_IMAGE_BASE,
+ (void *)(CACTUS_IMAGE_BASE + CACTUS_IMAGE_SIZE));
+ NOTICE(" SPM regions\n");
+ NOTICE(" SPM <-> SP buffer : %p - %p\n",
+ (void *)CACTUS_SPM_BUF_BASE,
+ (void *)(CACTUS_SPM_BUF_BASE + CACTUS_SPM_BUF_SIZE));
+ NOTICE(" NS <-> SP buffer : %p - %p\n",
+ (void *)CACTUS_NS_BUF_BASE,
+ (void *)(CACTUS_NS_BUF_BASE + CACTUS_NS_BUF_SIZE));
+ NOTICE(" Test regions\n");
+ NOTICE(" Test region : %p - %p\n",
+ (void *)CACTUS_TEST_MEM_BASE,
+ (void *)(CACTUS_TEST_MEM_BASE + CACTUS_TEST_MEM_SIZE));
}
-
-void __dead2 cactus_main(void *el3_el0_buffer, size_t el3_el0_buffer_size)
+void __dead2 cactus_main(void)
{
console_init(PL011_UART2_BASE,
PL011_UART2_CLK_IN_HZ,
@@ -86,26 +63,7 @@ void __dead2 cactus_main(void *el3_el0_buffer, size_t el3_el0_buffer_size)
NOTICE("%s\n", version_string);
NOTICE("Running at S-EL0\n");
- const secure_partition_boot_info_t *boot_info =
- (const secure_partition_boot_info_t *) el3_el0_buffer;
-
- if (el3_el0_buffer_size < sizeof(secure_partition_boot_info_t)) {
- ERROR("The memory buffer shared between EL3/S-EL0 is too small\n");
- ERROR("It is %lu bytes, it should be at least %lu bytes\n",
- el3_el0_buffer_size,
- sizeof(secure_partition_boot_info_t));
- panic();
- }
-
- if ((CACTUS_TEXT_START != boot_info->sp_image_base) ||
- (CACTUS_RWDATA_END > boot_info->sp_image_base
- + boot_info->sp_image_size)) {
- ERROR("Cactus does not fit in the buffer allocated for the secure partition\n");
- panic();
- }
-
- cactus_print_memory_layout(boot_info);
-
+ cactus_print_memory_layout();
/*
* Run some initial tests.
@@ -115,7 +73,7 @@ void __dead2 cactus_main(void *el3_el0_buffer, size_t el3_el0_buffer_size)
*/
misc_tests();
system_setup_tests();
- mem_attr_changes_tests(boot_info);
+ mem_attr_changes_tests();
/*
* Handle secure service requests.
diff --git a/spm/cactus/cactus_tests.h b/spm/cactus/cactus_tests.h
index d0e11dcba..f4bcb7e32 100644
--- a/spm/cactus/cactus_tests.h
+++ b/spm/cactus/cactus_tests.h
@@ -1,13 +1,11 @@
/*
- * Copyright (c) 2017, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#ifndef __CACTUS_TESTS_H__
-#define __CACTUS_TESTS_H__
-
-#include <secure_partition.h>
+#ifndef CACTUS_TESTS_H
+#define CACTUS_TESTS_H
/*
* Test functions
@@ -36,11 +34,7 @@ void system_setup_tests(void);
*
* These tests report their results on the UART. They do not recover from a
* failure : when an error is encountered they endlessly loop.
- *
- * The argument is a pointer to a secure_partition_boot_info_t struct that has
- * been filled by EL3 with the information about the memory map of this Secure
- * Partition.
*/
-void mem_attr_changes_tests(const secure_partition_boot_info_t *boot_info);
+void mem_attr_changes_tests(void);
-#endif /* __CACTUS_TESTS_H__ */
+#endif /* CACTUS_TESTS_H */
diff --git a/spm/cactus/cactus_tests_memory_attributes.c b/spm/cactus/cactus_tests_memory_attributes.c
index 9b1e84a50..ad8624019 100644
--- a/spm/cactus/cactus_tests_memory_attributes.c
+++ b/spm/cactus/cactus_tests_memory_attributes.c
@@ -16,6 +16,7 @@
#include <xlat_tables_defs.h>
#include "cactus.h"
+#include "cactus_def.h"
#include "cactus_tests.h"
/* This is filled at runtime. */
@@ -136,15 +137,15 @@ static void mem_attr_changes_unittest(uintptr_t addr, int pages_count)
* Exercise the ability of the Trusted Firmware to change the data access
* permissions and instruction execution permissions of some memory region.
*/
-void mem_attr_changes_tests(const secure_partition_boot_info_t *boot_info)
+void mem_attr_changes_tests(void)
{
uint32_t attributes;
int32_t ret;
uintptr_t addr;
- cactus_tests_start = CACTUS_BSS_END;
- cactus_tests_end = boot_info->sp_image_base + boot_info->sp_image_size;
- cactus_tests_size = cactus_tests_end - cactus_tests_start;
+ cactus_tests_start = CACTUS_TEST_MEM_BASE;
+ cactus_tests_size = CACTUS_TEST_MEM_SIZE;
+ cactus_tests_end = cactus_tests_start + cactus_tests_size;
const char *test_sect_desc = "memory attributes changes";
@@ -181,7 +182,7 @@ void mem_attr_changes_tests(const secure_partition_boot_info_t *boot_info)
const char *test_desc4 = "Unmapped memory region";
announce_test_start(test_desc4);
- addr = boot_info->sp_mem_limit + 2 * PAGE_SIZE;
+ addr = cactus_tests_end + 2 * PAGE_SIZE;
attributes = mem_access_perm(SP_MEMORY_ATTRIBUTES_NON_EXEC, SP_MEMORY_ATTRIBUTES_ACCESS_RW);
ret = request_mem_attr_changes(addr, 3, attributes);
expect(ret, SPM_INVALID_PARAMETER);
@@ -190,7 +191,7 @@ void mem_attr_changes_tests(const secure_partition_boot_info_t *boot_info)
const char *test_desc5 = "Partially unmapped memory region";
announce_test_start(test_desc5);
- addr = boot_info->sp_mem_base - 2 * PAGE_SIZE;
+ addr = cactus_tests_end - 2 * PAGE_SIZE;
attributes = mem_access_perm(SP_MEMORY_ATTRIBUTES_NON_EXEC, SP_MEMORY_ATTRIBUTES_ACCESS_RW);
ret = request_mem_attr_changes(addr, 6, attributes);
expect(ret, SPM_INVALID_PARAMETER);