v0.9 PSA APIs test suite update
This release includes the following major enhancements:
1. Enhanced Crypto and IPC suites for new tests
2. Added TFM-MUSCA_B support
3. Bug fixes, feature enhancement and documentation update
diff --git a/api-tests/val/common/val.h b/api-tests/val/common/val.h
index b3dbcd5..2af2858 100644
--- a/api-tests/val/common/val.h
+++ b/api-tests/val/common/val.h
@@ -178,12 +178,18 @@
} test_isolation_level_t;
typedef enum {
- BOOT_UNKNOWN = 0x1,
- BOOT_NOT_EXPECTED = 0x2,
- BOOT_EXPECTED_NS = 0x3,
- BOOT_EXPECTED_S = 0x4,
- BOOT_EXPECTED_BUT_FAILED = 0x5,
- BOOT_EXPECTED_CRYPTO = 0x6,
+ /* VAL uses this boot flag to mark first time boot of the system */
+ BOOT_UNKNOWN = 0x1,
+ /* VAL/Test uses this boot flag to catch any unwanted system reboot - SIM ERROR Cases*/
+ BOOT_NOT_EXPECTED = 0x2,
+ /* Test performs panic check for non-secure test run and expect reboot */
+ BOOT_EXPECTED_NS = 0x3,
+ /* Test performs panic check for secure test run and expect reboot */
+ BOOT_EXPECTED_S = 0x4,
+ /* Test expected reboot but it didn't happen */
+ BOOT_EXPECTED_BUT_FAILED = 0x5,
+ /* Test expect reboot for secure/non-secure test run. If reboot happens, re-enter same test */
+ BOOT_EXPECTED_REENTER_TEST = 0x6,
} boot_state_t;
typedef enum {
@@ -224,6 +230,7 @@
VAL_STATUS_INIT_ALREADY_DONE = 0x29,
VAL_STATUS_HEAP_NOT_AVAILABLE = 0x2A,
VAL_STATUS_UNSUPPORTED = 0x2B,
+ VAL_STATUS_DRIVER_FN_FAILED = 0x2C,
VAL_STATUS_ERROR_MAX = INT_MAX,
} val_status_t;
@@ -237,13 +244,21 @@
PRINT_ALWAYS = 9
} print_verbosity_t;
-/* Interrupt test function id enums */
+/* Driver test function id enums */
typedef enum {
TEST_PSA_EOI_WITH_NON_INTR_SIGNAL = 1,
TEST_PSA_EOI_WITH_MULTIPLE_SIGNALS = 2,
TEST_PSA_EOI_WITH_UNASSERTED_SIGNAL = 3,
TEST_INTR_SERVICE = 4,
-} test_intr_fn_id_t;
+ TEST_ISOLATION_PSA_ROT_DATA_RD = 5,
+ TEST_ISOLATION_PSA_ROT_DATA_WR = 6,
+ TEST_ISOLATION_PSA_ROT_STACK_RD = 7,
+ TEST_ISOLATION_PSA_ROT_STACK_WR = 8,
+ TEST_ISOLATION_PSA_ROT_HEAP_RD = 9,
+ TEST_ISOLATION_PSA_ROT_HEAP_WR = 10,
+ TEST_ISOLATION_PSA_ROT_MMIO_RD = 11,
+ TEST_ISOLATION_PSA_ROT_MMIO_WR = 12,
+} driver_test_fn_id_t;
/* typedef's */
typedef struct {
diff --git a/api-tests/val/common/val_target.c b/api-tests/val/common/val_target.c
index ae3c2f4..3564c7d 100644
--- a/api-tests/val/common/val_target.c
+++ b/api-tests/val/common/val_target.c
@@ -18,7 +18,8 @@
#include "val_target.h"
#include "target_database.h"
-#ifdef USE_RAW_PRINT_FOR_DRIVER_PARTITION
+/* Use raw print for driver partition */
+#ifdef DRIVER_PARTITION_INCLUDE
#define val_print(x, y, z) \
do { \
if (x >= VERBOSE) \
@@ -26,7 +27,7 @@
} while(0)
#else
__UNUSED STATIC_DECLARE val_status_t val_print
- (print_verbosity_t verbosity, char *string, uint32_t data);
+ (print_verbosity_t verbosity, char *string, int32_t data);
#endif
/**
@@ -52,7 +53,7 @@
/* Sanity check signature and version here */
if ((hdr->version != 1) || (hdr->size == 0))
{
- val_print(PRINT_ERROR, "Target config database Error. \n", 0);
+ val_print(PRINT_ERROR, "\tTarget config database Error. \n", 0);
return VAL_STATUS_ERROR;
}
hdr++;
@@ -82,7 +83,7 @@
val_status_t status;
void *config_blob = NULL;
- val_print(PRINT_INFO, "Input id is %x \n", cfg_id);
+ val_print(PRINT_INFO, "\tInput id is %x \n", cfg_id);
do
{
@@ -138,7 +139,7 @@
if ((cfg_id < TARGET_MIN_CFG_ID) || (cfg_id > TARGET_MAX_CFG_ID))
{
- val_print(PRINT_ERROR, "Invalid Target data config ID = %x \n", cfg_id);
+ val_print(PRINT_ERROR, "\tInvalid Target data config ID = %x \n", cfg_id);
return VAL_STATUS_INSUFFICIENT_SIZE;
}
@@ -146,8 +147,8 @@
if (VAL_ERROR(status))
{
- val_print(PRINT_ERROR, "\n Get Config failed with status = %x", status);
- val_print(PRINT_ERROR, " for cfg_id = %x", cfg_id);
+ val_print(PRINT_ERROR, "\tGet Config failed with status = %x", status);
+ val_print(PRINT_ERROR, " for cfg_id = %x\n", cfg_id);
return status;
}
return VAL_STATUS_SUCCESS;
diff --git a/api-tests/val/common/val_target.h b/api-tests/val/common/val_target.h
index c32f0a5..c8b1466 100644
--- a/api-tests/val/common/val_target.h
+++ b/api-tests/val/common/val_target.h
@@ -64,7 +64,7 @@
typedef enum _MEMORY_CONFIG_ID_ {
MEMORY_NVMEM = 0x2,
MEMORY_NSPE_MMIO = 0x3,
- MEMORY_CLIENT_PARTITION_MMIO = 0x4,
+ MEMORY_SERVER_PARTITION_MMIO = 0x4,
MEMORY_DRIVER_PARTITION_MMIO = 0x5,
} memory_cfg_id_t;
@@ -82,7 +82,7 @@
WATCHDOG = GROUP_SOC_PERIPHERAL,
NVMEM = GROUP_MEMORY,
NSPE_MMIO = GROUP_MEMORY,
- CLIENT_PARTITION_MMIO = GROUP_MEMORY,
+ SERVER_PARTITION_MMIO = GROUP_MEMORY,
DRIVER_PARTITION_MMIO = GROUP_MEMORY,
BOOT = GROUP_MISCELLANEOUS,
DUT = GROUP_MISCELLANEOUS,
@@ -195,11 +195,15 @@
addr_t ns_start_addr_of_combine_test_binary;
is_available_t combine_test_binary_in_ram;
addr_t ns_test_addr;
+ is_available_t sp_heap_mem_supp;
} miscellaneous_desc_t;
/*val target config read apis */
+#ifdef VAL_NSPE_BUILD
STATIC_DECLARE val_status_t val_target_get_config(cfg_id_t cfg_id, uint8_t **data, uint32_t *size);
STATIC_DECLARE val_status_t val_target_cfg_get_next(void **blob);
-STATIC_DECLARE val_status_t val_target_get_cfg_blob(cfg_id_t cfg_id, uint8_t **data, uint32_t *size);
+STATIC_DECLARE val_status_t val_target_get_cfg_blob(cfg_id_t cfg_id, uint8_t **data,
+ uint32_t *size);
STATIC_DECLARE val_status_t val_target_get_config(cfg_id_t cfg_id, uint8_t **data, uint32_t *size);
#endif
+#endif
diff --git a/api-tests/val/nspe/pal_interfaces_ns.h b/api-tests/val/nspe/pal_interfaces_ns.h
index 186a5fc..0b50612 100644
--- a/api-tests/val/nspe/pal_interfaces_ns.h
+++ b/api-tests/val/nspe/pal_interfaces_ns.h
@@ -100,7 +100,7 @@
* @return - SUCCESS/FAILURE
**/
-int pal_print_ns(char *str, uint32_t data);
+int pal_print_ns(char *str, int32_t data);
/**
* @brief - Initializes an hardware watchdog timer
diff --git a/api-tests/val/nspe/val_attestation.h b/api-tests/val/nspe/val_attestation.h
index d860739..58ea59c 100644
--- a/api-tests/val/nspe/val_attestation.h
+++ b/api-tests/val/nspe/val_attestation.h
@@ -19,7 +19,6 @@
#define _VAL_INITIAL_ATTESTATION_H_
#include "val.h"
-
#define MAX_CHALLENGE_SIZE PSA_INITIAL_ATTEST_CHALLENGE_SIZE_64
enum attestation_function_code {
diff --git a/api-tests/val/nspe/val_crypto.c b/api-tests/val/nspe/val_crypto.c
index 764b44a..da1aced 100644
--- a/api-tests/val/nspe/val_crypto.c
+++ b/api-tests/val/nspe/val_crypto.c
@@ -30,7 +30,7 @@
int32_t val_crypto_function(int type, ...)
{
va_list valist;
- val_status_t status;
+ int32_t status;
va_start(valist, type);
status = pal_crypto_function(type, valist);
diff --git a/api-tests/val/nspe/val_crypto.h b/api-tests/val/nspe/val_crypto.h
index 6cb1b2f..6fc3f56 100644
--- a/api-tests/val/nspe/val_crypto.h
+++ b/api-tests/val/nspe/val_crypto.h
@@ -48,6 +48,7 @@
#define PSA_KEY_LIFETIME_INVALID 0xFFFFFFFF
#define PSA_KEY_USAGE_INVALID 0xFFFFFFFF
+#define PSA_HASH_ALG_INVALID 0x01FFFFFF
#define PSA_ALG_INVALID 0xFFFFFFFF
enum crypto_function_code {
@@ -98,6 +99,7 @@
VAL_CRYPTO_ASYMMTERIC_VERIFY = 0x31,
VAL_CRYPTO_KEY_AGREEMENT = 0x32,
VAL_CRYPTO_ALLOCATE_KEY = 0x33,
+ VAL_CRYPTO_COPY_KEY = 0x34,
VAL_CRYPTO_FREE = 0xFE,
};
diff --git a/api-tests/val/nspe/val_dispatcher.c b/api-tests/val/nspe/val_dispatcher.c
index 29c72dc..8675518 100644
--- a/api-tests/val/nspe/val_dispatcher.c
+++ b/api-tests/val/nspe/val_dispatcher.c
@@ -126,7 +126,7 @@
**/
val_status_t val_test_load(test_id_t *test_id, test_id_t test_id_prev)
{
-#ifndef TEST_COMBINE_ARCHIVE
+#if (TEST_COMBINE_ARCHIVE == 0)
test_header_t test_header;
addr_t flash_addr = combine_test_binary_addr;
@@ -260,7 +260,7 @@
**/
val_status_t val_get_test_entry_addr(addr_t *paddr)
{
-#ifndef TEST_COMBINE_ARCHIVE
+#if (TEST_COMBINE_ARCHIVE == 0)
*paddr = (addr_t)(((val_test_info_t *)g_test_info_addr)->entry_addr);
#else
*paddr = g_test_info_addr;
diff --git a/api-tests/val/nspe/val_entry.h b/api-tests/val/nspe/val_entry.h
index 2b885e0..2236016 100644
--- a/api-tests/val/nspe/val_entry.h
+++ b/api-tests/val/nspe/val_entry.h
@@ -21,7 +21,7 @@
#include "val_framework.h"
#define PSA_ACS_MAJOR_VER 0
-#define PSA_ACS_MINOR_VER 8
+#define PSA_ACS_MINOR_VER 9
/**
@brief - PSA Test Suite C main function, does VAL init and calls test dispatcher
diff --git a/api-tests/val/nspe/val_framework.c b/api-tests/val/nspe/val_framework.c
index 1bc3b12..4f6163c 100644
--- a/api-tests/val/nspe/val_framework.c
+++ b/api-tests/val/nspe/val_framework.c
@@ -111,11 +111,31 @@
return status;
}
- if (boot.state == BOOT_NOT_EXPECTED || boot.state == BOOT_EXPECTED_CRYPTO)
+ if (boot.state == BOOT_NOT_EXPECTED || boot.state == BOOT_EXPECTED_REENTER_TEST)
{
- val_print(PRINT_TEST,"[Info] Executing tests from non-secure\n", 0);
while (tests_list[i] != NULL)
{
+ /*
+ * Reboot have been expected by test in previous ns run,
+ * consider previous run pass and jump to second test function
+ * of the same test if available.
+ */
+ if ((boot.state == BOOT_EXPECTED_REENTER_TEST) && (i == 1))
+ {
+ val_print(PRINT_DEBUG, "[Check1] PASSED\n", 0);
+ i++;
+ continue;
+ }
+
+ status = val_set_boot_flag(BOOT_NOT_EXPECTED);
+ if (VAL_ERROR(status))
+ {
+ return status;
+ }
+
+ if (i == 1)
+ val_print(PRINT_TEST,"[Info] Executing tests from non-secure\n", 0);
+
if (server_hs == TRUE)
{
/* Handshake with server tests */
@@ -204,6 +224,17 @@
if (boot.state != BOOT_EXPECTED_S)
{
+ /*
+ * Reboot have been expected by test in previous s run,
+ * consider previous run pass and jump to second test function
+ * of the same test if available.
+ */
+ if (boot.state == BOOT_EXPECTED_REENTER_TEST)
+ {
+ test_info.block_num++;
+ val_print(PRINT_DEBUG, "[Check1] PASSED\n", 0);
+ }
+
status = val_set_boot_flag(BOOT_NOT_EXPECTED);
if (VAL_ERROR(status))
{
@@ -399,7 +430,7 @@
}
else
{
- status = val_get_status();
+ status = (val_get_status() & TEST_STATUS_MASK);
if (VAL_ERROR(status))
{
val_print(PRINT_ERROR, "\tCheckpoint %d : ", checkpoint);
@@ -451,15 +482,16 @@
GET_TEST_ISOLATION_LEVEL(test_bitfield))
{
val_set_status(RESULT_SKIP(VAL_STATUS_ISOLATION_LEVEL_NOT_SUPP));
- val_print(PRINT_ALWAYS, "Skipping test. Required isolation level is not supported\n", 0);
+ val_print(PRINT_ALWAYS, "\tSkipping test. Required isolation level is not supported\n", 0);
return;
}
+#if (WATCHDOG_AVAILABLE == 1)
/* Initialise watchdog */
status = val_wd_timer_init(GET_WD_TIMOUT_TYPE(test_bitfield));
if (VAL_ERROR(status))
{
- val_print(PRINT_ERROR, "val_wd_timer_init failed Error=0x%x\n", status);
+ val_print(PRINT_ERROR, "\tval_wd_timer_init failed Error=0x%x\n", status);
return;
}
@@ -467,9 +499,10 @@
status = val_wd_timer_enable();
if (VAL_ERROR(status))
{
- val_print(PRINT_ERROR, "val_wd_timer_enable failed Error=0x%x\n", status);
+ val_print(PRINT_ERROR, "\tval_wd_timer_enable failed Error=0x%x\n", status);
return;
}
+#endif
val_set_status(RESULT_START(VAL_STATUS_SUCCESS));
return;
@@ -483,10 +516,20 @@
void val_test_exit(void)
{
- val_status_t status;
+ val_status_t status = VAL_STATUS_SUCCESS;
- val_wd_timer_disable();
+#if (WATCHDOG_AVAILABLE == 1)
+ status = val_wd_timer_disable();
+ if (VAL_ERROR(status))
+ {
+ val_print(PRINT_ERROR, "\tval_wd_timer_disable failed Error=0x%x\n", status);
+ val_set_status(RESULT_FAIL(status));
+ return;
+ }
+#endif
+
status = val_get_status();
+
/* return if test skipped or failed */
if (IS_TEST_FAIL(status) || IS_TEST_SKIP(status))
{
@@ -509,9 +552,12 @@
test_count_t test_count;
boot_t boot;
int i = 0, intermediate_boot = 0;
- boot_state_t boot_state[] = {BOOT_NOT_EXPECTED, BOOT_EXPECTED_NS,
- BOOT_EXPECTED_S, BOOT_EXPECTED_BUT_FAILED,
- BOOT_EXPECTED_CRYPTO};
+ boot_state_t boot_state[] = {BOOT_NOT_EXPECTED,
+ BOOT_EXPECTED_NS,
+ BOOT_EXPECTED_S,
+ BOOT_EXPECTED_BUT_FAILED,
+ BOOT_EXPECTED_REENTER_TEST
+ };
status = val_get_boot_flag(&boot.state);
if (VAL_ERROR(status))
@@ -519,6 +565,8 @@
return status;
}
+ val_print(PRINT_INFO, "\n\tboot.state=0x%x", boot.state);
+
for (i = 0; i < (sizeof(boot_state)/sizeof(boot_state[0])); i++)
{
if (boot.state == boot_state[i])
@@ -585,7 +633,7 @@
status = val_nvmem_write(VAL_NVMEM_OFFSET(NV_BOOT), &boot, sizeof(boot_t));
if (VAL_ERROR(status))
{
- val_print(PRINT_ERROR, "val_nvmem_write failed. Error=0x%x\n", status);
+ val_print(PRINT_ERROR, "\tval_nvmem_write failed. Error=0x%x\n", status);
return status;
}
return status;
@@ -604,7 +652,7 @@
status = val_nvmem_read(VAL_NVMEM_OFFSET(NV_BOOT), &boot, sizeof(boot_t));
if (VAL_ERROR(status))
{
- val_print(PRINT_ERROR, "val_nvmem_read failed. Error=0x%x\n", status);
+ val_print(PRINT_ERROR, "\tval_nvmem_read failed. Error=0x%x\n", status);
return status;
}
*state = boot.state;
diff --git a/api-tests/val/nspe/val_interfaces.h b/api-tests/val/nspe/val_interfaces.h
index b41aab1..8e9c56b 100644
--- a/api-tests/val/nspe/val_interfaces.h
+++ b/api-tests/val/nspe/val_interfaces.h
@@ -25,7 +25,7 @@
/* typedef's */
typedef struct {
val_status_t (*print) (print_verbosity_t verbosity,
- char *string, uint32_t data);
+ char *string, int32_t data);
val_status_t (*set_status) (uint32_t status);
uint32_t (*get_status) (void);
void (*test_init) (uint32_t test_num, char8_t *desc,
diff --git a/api-tests/val/nspe/val_peripherals.c b/api-tests/val/nspe/val_peripherals.c
index 9f153e0..dccc4e4 100644
--- a/api-tests/val/nspe/val_peripherals.c
+++ b/api-tests/val/nspe/val_peripherals.c
@@ -56,7 +56,7 @@
- data : Value for format specifier
@return - val_status_t
**/
-val_status_t val_print(print_verbosity_t verbosity, char *string, uint32_t data)
+val_status_t val_print(print_verbosity_t verbosity, char *string, int32_t data)
{
if ((is_uart_init_done == 0) || (verbosity < VERBOSE))
{
diff --git a/api-tests/val/nspe/val_peripherals.h b/api-tests/val/nspe/val_peripherals.h
index dfea143..d1b7538 100644
--- a/api-tests/val/nspe/val_peripherals.h
+++ b/api-tests/val/nspe/val_peripherals.h
@@ -21,7 +21,7 @@
#include "val.h"
val_status_t val_uart_init(void);
-val_status_t val_print(print_verbosity_t verbosity, char *string, uint32_t data);
+val_status_t val_print(print_verbosity_t verbosity, char *string, int32_t data);
val_status_t val_spi_read(addr_t addr, uint8_t *data, uint32_t len);
val_status_t val_nvmem_read(uint32_t offset, void *buffer, int size);
val_status_t val_nvmem_write(uint32_t offset, void *buffer, int size);
diff --git a/api-tests/val/spe/pal_interfaces_s.h b/api-tests/val/spe/pal_interfaces_s.h
index a9edd70..2ca9e28 100644
--- a/api-tests/val/spe/pal_interfaces_s.h
+++ b/api-tests/val/spe/pal_interfaces_s.h
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * Copyright (c) 2018-2019, Arm Limited or its affiliates. All rights reserved.
* SPDX-License-Identifier : Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,7 +19,7 @@
#define _VAL_PAL_INTERFACE_APIS_H_
-#include "val/common/val.h"
+#include "val.h"
/* Peripherals APIs */
@@ -37,7 +37,7 @@
- data : Value for Format specifier
@return - void
*/
-void pal_print(char *str, uint32_t data);
+void pal_print(char *str, int32_t data);
/**
@brief - Initializes an hardware watchdog timer
@@ -90,4 +90,19 @@
@return - error status 0:SUCCESS, 1:FAIL
*/
int pal_nvmem_read(addr_t base, uint32_t offset, void *buffer, int size);
+
+/**
+ @brief - Trigger interrupt for irq signal assigned to driver partition
+ before return to caller.
+ @param - void
+ @return - void
+**/
+void pal_generate_interrupt(void);
+
+/**
+ @brief - Disable interrupt that was generated using pal_generate_interrupt API.
+ @param - void
+ @return - void
+**/
+void pal_disable_interrupt(void);
#endif
diff --git a/api-tests/val/spe/val_driver_service_apis.c b/api-tests/val/spe/val_driver_service_apis.c
index 46a3162..05b14fd 100644
--- a/api-tests/val/spe/val_driver_service_apis.c
+++ b/api-tests/val/spe/val_driver_service_apis.c
@@ -17,7 +17,7 @@
#include "val_driver_service_apis.h"
-#include "val/common/val_target.c"
+#include "val_target.c"
print_verbosity_t g_print_level = PRINT_INFO;
static int is_uart_init_done = 0;
@@ -39,10 +39,10 @@
@brief - This function parses the input string and writes byte by byte to
print the input string
@param - pointer : Input String
- - data : Value for Format specifier
+ - data : Value for Format specifier
@return - error status
*/
-val_status_t val_print_sf(char *string, uint32_t data)
+val_status_t val_print_sf(char *string, int32_t data)
{
if (is_uart_init_done == 1)
{
@@ -199,3 +199,47 @@
return VAL_STATUS_SUCCESS;
}
+
+/**
+ @brief - This function returns the driver reserved mmio region base
+ @param - base pointer
+ @return - val_status_t
+**/
+val_status_t val_get_driver_mmio_addr(addr_t *base_addr)
+{
+ val_status_t status;
+ memory_desc_t *memory_desc;
+
+ status = val_target_get_config(TARGET_CONFIG_CREATE_ID(GROUP_MEMORY,
+ MEMORY_DRIVER_PARTITION_MMIO, 0),
+ (uint8_t **)&memory_desc,
+ (uint32_t *)sizeof(memory_desc_t));
+ if (VAL_ERROR(status))
+ {
+ return status;
+ }
+
+ *base_addr = memory_desc->start;
+ return VAL_STATUS_SUCCESS;
+}
+
+/**
+ @brief - Trigger interrupt for irq signal assigned to driver partition
+ before return to caller.
+ @param - void
+ @return - void
+**/
+void val_generate_interrupt(void)
+{
+ pal_generate_interrupt();
+}
+
+/**
+ @brief - Disable interrupt that was generated using val_generate_interrupt API.
+ @param - void
+ @return - void
+**/
+void val_disable_interrupt(void)
+{
+ pal_disable_interrupt();
+}
diff --git a/api-tests/val/spe/val_driver_service_apis.h b/api-tests/val/spe/val_driver_service_apis.h
index 9614e35..251a065 100644
--- a/api-tests/val/spe/val_driver_service_apis.h
+++ b/api-tests/val/spe/val_driver_service_apis.h
@@ -20,20 +20,13 @@
#include "val.h"
#include "val_client_defs.h"
-#include "val_service_defs.h"
#include "pal_interfaces_s.h"
-/* "psa_manifest/<manifestfilename>.h" Manifest definitions. Only accessible to Secure Partition.
- * The file name is based on the name of the Secure Partitions manifest file.
- * The name must not collide with other header files.
- * Compliance tests expect the below manifest output files implementation from build tool.
- */
-#include "psa_manifest/driver_partition_psa.h"
-
-#define USE_RAW_PRINT_FOR_DRIVER_PARTITION 1
+#define DRIVER_PARTITION_INCLUDE
+#include "val_service_defs.h"
val_status_t val_uart_init_sf(addr_t uart_base_addr);
-val_status_t val_print_sf(char *string, uint32_t data);
+val_status_t val_print_sf(char *string, int32_t data);
val_status_t val_wd_timer_init_sf(addr_t base_addr, uint32_t time_us, uint32_t timer_tick_us);
val_status_t val_wd_timer_enable_sf(addr_t base_addr);
val_status_t val_wd_timer_disable_sf(addr_t base_addr);
@@ -42,4 +35,7 @@
val_status_t val_nvmem_write_sf(addr_t base, uint32_t offset, void *buffer, int size);
val_status_t val_driver_private_set_boot_flag_fn(boot_state_t state);
val_status_t val_init_driver_memory(void);
+val_status_t val_get_driver_mmio_addr(addr_t *base_addr);
+void val_generate_interrupt(void);
+void val_disable_interrupt(void);
#endif
diff --git a/api-tests/val/spe/val_partition_common.h b/api-tests/val/spe/val_partition_common.h
index df36402..76b5c8c 100644
--- a/api-tests/val/spe/val_partition_common.h
+++ b/api-tests/val/spe/val_partition_common.h
@@ -30,16 +30,8 @@
#include "val_target.c"
#include "val_service_defs.h"
-/* "psa_manifest/<manifestfilename>.h" Manifest definitions. Only accessible to Secure Partition.
- * The file name is based on the name of the Secure Partitions manifest file.
- * The name must not collide with other header files.
- * Compliance tests expect the below manifest output files implementation from build tool.
- */
-#include "psa_manifest/client_partition_psa.h"
-#include "psa_manifest/server_partition_psa.h"
-
__UNUSED STATIC_DECLARE val_status_t val_print
- (print_verbosity_t verbosity, char *string, uint32_t data);
+ (print_verbosity_t verbosity, char *string, int32_t data);
__UNUSED STATIC_DECLARE val_status_t val_ipc_connect
(uint32_t sid, uint32_t minor_version, psa_handle_t *handle );
__UNUSED STATIC_DECLARE val_status_t val_ipc_call
@@ -52,7 +44,7 @@
__UNUSED STATIC_DECLARE val_status_t val_process_disconnect_request
(psa_signal_t sig, psa_msg_t *msg);
__UNUSED STATIC_DECLARE val_status_t val_execute_secure_tests
- (uint32_t test_num, client_test_t *tests_list);
+ (test_info_t test_info, client_test_t *tests_list);
__UNUSED STATIC_DECLARE val_status_t val_execute_secure_test_func
(psa_handle_t *handle, test_info_t test_info, uint32_t sid);
__UNUSED STATIC_DECLARE val_status_t val_get_secure_test_result(psa_handle_t *handle);
@@ -70,6 +62,9 @@
.ipc_close = val_ipc_close,
.set_boot_flag = val_set_boot_flag,
.target_get_config = val_target_get_config,
+ .process_connect_request = val_process_connect_request,
+ .process_call_request = val_process_call_request,
+ .process_disconnect_request= val_process_disconnect_request,
};
__UNUSED static psa_api_t psa_api = {
@@ -78,6 +73,17 @@
.connect = psa_connect,
.call = psa_call,
.close = psa_close,
+ .wait = psa_wait,
+ .set_rhandle = psa_set_rhandle,
+ .get = psa_get,
+ .read = psa_read,
+ .skip = psa_skip,
+ .write = psa_write,
+ .reply = psa_reply,
+ .notify = psa_notify,
+ .clear = psa_clear,
+ .eoi = psa_eoi,
+ .rot_lifecycle_state = psa_rot_lifecycle_state,
};
/**
@@ -88,7 +94,7 @@
- data : Value for format specifier
@return - val_status_t
**/
-STATIC_DECLARE val_status_t val_print(print_verbosity_t verbosity, char *string, uint32_t data)
+STATIC_DECLARE val_status_t val_print(print_verbosity_t verbosity, char *string, int32_t data)
{
int string_len = 0;
char *p = string;
@@ -108,7 +114,7 @@
p++;
}
- psa_invec data1[3] = {{&uart_fn, sizeof(uart_fn)}, {string, string_len+1}, {&data, 4}};
+ psa_invec data1[3] = {{&uart_fn, sizeof(uart_fn)}, {string, string_len+1}, {&data, sizeof(data)}};
print_handle = psa_connect(DRIVER_UART_SID, 0);
if (print_handle < 0)
@@ -301,23 +307,21 @@
/**
@brief - This function executes given list of tests from secure sequentially
This covers secure to secure IPC API scenario
- @param - test_num : Test_num
+ @param - test_info_t : test_num and block_num
@param - tests_list : list of tests to be executed
@return - val_status_t
**/
-STATIC_DECLARE val_status_t val_execute_secure_tests(uint32_t test_num, client_test_t *tests_list)
+STATIC_DECLARE val_status_t val_execute_secure_tests(test_info_t test_info, client_test_t *tests_list)
{
val_status_t status = VAL_STATUS_SUCCESS;
val_status_t test_status = VAL_STATUS_SUCCESS;
psa_handle_t handle;
- int i = 1;
- test_info_t test_info;
-
- test_info.test_num = test_num;
- val_print(PRINT_TEST, "[Info] Executing tests from secure\n", 0);
+ int i = test_info.block_num;
while (tests_list[i] != NULL)
{
+ if (i == 1)
+ val_print(PRINT_TEST, "[Info] Executing tests from secure\n", 0);
/* Handshake with server tests */
test_info.block_num = i;
@@ -513,7 +517,7 @@
status = val_nvmem_write(VAL_NVMEM_OFFSET(NV_BOOT), &boot, sizeof(boot_t));
if (VAL_ERROR(status))
{
- val_print(PRINT_ERROR, "val_nvmem_write failed Error=0x%x\n", status);
+ val_print(PRINT_ERROR, "\tval_nvmem_write failed Error=0x%x\n", status);
return status;
}
return status;
diff --git a/api-tests/val/spe/val_service_defs.h b/api-tests/val/spe/val_service_defs.h
index 51b6d5c..b499b5d 100644
--- a/api-tests/val/spe/val_service_defs.h
+++ b/api-tests/val/spe/val_service_defs.h
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2018, Arm Limited or its affiliates. All rights reserved.
+ * Copyright (c) 2018-2019, Arm Limited or its affiliates. All rights reserved.
* SPDX-License-Identifier : Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,16 +20,25 @@
/***************** PSA Secure Function API *****************/
-/* Note - This header file containts the declaration of PSA defined secure partition service API
- elements. Ideally, These elements must be defined in a header file <psa_service.h> by SPM
- implemented library and provided to clients operation in NSPE and SPE as per the specification.
- If this is available in the platform, the elements declared as part of this
- file can be overwritten by passing --include <path_to_psa_service_h> to setup.sh script.
- */
-
/* psa/service.h: Secure Partition API elements. Only accessible to Secure Partition */
#include "psa/service.h"
+/* psa/lifecycle.h: Contains the PSA Lifecycle API elements */
+#include "psa/lifecycle.h"
+
+/* "psa_manifest/<manifestfilename>.h" Manifest definitions. Only accessible to Secure Partition.
+ * The file name is based on the name of the Secure Partitions manifest file.
+ * The name must not collide with other header files.
+ * Compliance tests expect the below manifest output files implementation from build tool.
+ */
+#include "psa_manifest/driver_partition_psa.h"
+#ifndef DRIVER_PARTITION_INCLUDE
+#include "psa_manifest/client_partition_psa.h"
+#include "psa_manifest/server_partition_psa.h"
+#endif
+
+#include "val_target.h"
+
/* struct of function pointers to uniqify nspe and spe client interface for test */
typedef struct {
uint32_t (*framework_version) (void);
@@ -42,21 +51,38 @@
size_t out_len
);
void (*close) (psa_handle_t handle);
+ psa_signal_t (*wait) (psa_signal_t signal_mask, uint32_t timeout);
+ void (*set_rhandle) (psa_handle_t msg_handle, void *rhandle);
+ psa_status_t (*get) (psa_signal_t signal, psa_msg_t *msg);
+ size_t (*read) (psa_handle_t msg_handle, uint32_t invec_idx,
+ void *buffer, size_t num_bytes);
+ size_t (*skip) (psa_handle_t msg_handle, uint32_t invec_idx,
+ size_t num_bytes);
+ void (*write) (psa_handle_t msg_handle, uint32_t outvec_idx,
+ const void *buffer, size_t num_bytes);
+ void (*reply) (psa_handle_t msg_handle, psa_status_t status);
+ void (*notify) (int32_t partition_id);
+ void (*clear) (void);
+ void (*eoi) (psa_signal_t irq_signal);
+ uint32_t (*rot_lifecycle_state) (void);
} psa_api_t;
typedef struct {
- val_status_t (*print) (print_verbosity_t verbosity,
- char *string, uint32_t data);
- val_status_t (*err_check_set) (uint32_t checkpoint, val_status_t status);
- val_status_t (*execute_secure_test_func) (psa_handle_t *handle, test_info_t test_info,
- uint32_t sid);
- val_status_t (*get_secure_test_result) (psa_handle_t *handle);
- val_status_t (*ipc_connect) (uint32_t sid, uint32_t minor_version,
- psa_handle_t *handle );
- val_status_t (*ipc_call) (psa_handle_t handle, psa_invec *in_vec,
- size_t in_len, psa_outvec *out_vec, size_t out_len);
- void (*ipc_close) (psa_handle_t handle);
- val_status_t (*set_boot_flag) (boot_state_t state);
- val_status_t (*target_get_config) (cfg_id_t cfg_id, uint8_t **data, uint32_t *size);
+ val_status_t (*print) (print_verbosity_t verbosity,
+ char *string, int32_t data);
+ val_status_t (*err_check_set) (uint32_t checkpoint, val_status_t status);
+ val_status_t (*execute_secure_test_func) (psa_handle_t *handle, test_info_t test_info,
+ uint32_t sid);
+ val_status_t (*get_secure_test_result) (psa_handle_t *handle);
+ val_status_t (*ipc_connect) (uint32_t sid, uint32_t minor_version,
+ psa_handle_t *handle );
+ val_status_t (*ipc_call) (psa_handle_t handle, psa_invec *in_vec,
+ size_t in_len, psa_outvec *out_vec, size_t out_len);
+ void (*ipc_close) (psa_handle_t handle);
+ val_status_t (*set_boot_flag) (boot_state_t state);
+ val_status_t (*target_get_config) (cfg_id_t cfg_id, uint8_t **data, uint32_t *size);
+ val_status_t (*process_connect_request) (psa_signal_t sig, psa_msg_t *msg);
+ val_status_t (*process_call_request) (psa_signal_t sig, psa_msg_t *msg);
+ val_status_t (*process_disconnect_request) (psa_signal_t sig, psa_msg_t *msg);
} val_api_t;
#endif