summaryrefslogtreecommitdiff
path: root/include/lib
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2019-05-28 21:03:58 -0700
committerJulius Werner <jwerner@chromium.org>2019-07-23 20:25:34 -0700
commit57bf6057721306d1ad1af1122a831789ded92885 (patch)
tree53dc0c59a20a684d7f9d0784cba78942e4ae56db /include/lib
parent9352be88033900f89aa50dfbb13a13d40d698a9e (diff)
Factor out cross-BL API into export headers suitable for 3rd party code
This patch adds a new include/export/ directory meant for inclusion in third-party code. This is useful for cases where third-party code needs to interact with TF-A interfaces and data structures (such as a custom BL2-implementation like coreboot handing off to BL31). Directly including headers from the TF-A repository avoids having to duplicate all these definitions (and risk them going stale), but with the current header structure this is not possible because handoff API definitions are too deeply intertwined with other TF code/headers and chain-include other headers that will not be available in the other environment. The new approach aims to solve this by separating only the parts that are really needed into these special headers that are self-contained and will not chain-include other (non-export) headers. TF-A code should never include them directly but should instead always include the respective wrapper header, which will include the required prerequisites (like <stdint.h>) before including the export header. Third-party code can include the export headers via its own wrappers that make sure the necessary definitions are available in whatever way that environment can provide them. Change-Id: Ifd769320ba51371439a8e5dd5b79c2516c3b43ab Signed-off-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'include/lib')
-rw-r--r--include/lib/bl_aux_params/bl_aux_params.h75
-rw-r--r--include/lib/utils_def.h27
2 files changed, 4 insertions, 98 deletions
diff --git a/include/lib/bl_aux_params/bl_aux_params.h b/include/lib/bl_aux_params/bl_aux_params.h
index cfea3956..f6ce8024 100644
--- a/include/lib/bl_aux_params/bl_aux_params.h
+++ b/include/lib/bl_aux_params/bl_aux_params.h
@@ -9,80 +9,7 @@
#include <stdbool.h>
#include <stdint.h>
-/*
- * This API implements a lightweight parameter passing mechanism that can be
- * used to pass SoC Firmware configuration data from BL2 to BL31 by platforms or
- * configurations that do not want to depend on libfdt. It is structured as a
- * singly-linked list of parameter structures that all share the same common
- * header but may have different (and differently-sized) structure bodies after
- * that. The header contains a type field to indicate the parameter type (which
- * is used to infer the structure length and how to interpret its contents) and
- * a next pointer which contains the absolute physical address of the next
- * parameter structure. The next pointer in the last structure block is set to
- * NULL. The picture below shows how the parameters are kept in memory.
- *
- * head of list ---> +----------------+ --+
- * | type | |
- * +----------------+ |--> struct bl_aux_param
- * +----| next | |
- * | +----------------+ --+
- * | | parameter data |
- * | +----------------+
- * |
- * +--> +----------------+ --+
- * | type | |
- * +----------------+ |--> struct bl_aux_param
- * NULL <---| next | |
- * +----------------+ --+
- * | parameter data |
- * +----------------+
- *
- * Note: The SCTLR_EL3.A bit (Alignment fault check enable) is set in TF-A, so
- * BL2 must ensure that each parameter struct starts on a 64-bit aligned address
- * to avoid alignment faults. Parameters may be allocated in any address range
- * accessible at the time of BL31 handoff (e.g. SRAM, DRAM, SoC-internal scratch
- * registers, etc.), in particular address ranges that may not be mapped in
- * BL31's page tables, so the parameter list must be parsed before the MMU is
- * enabled and any information that is required at a later point should be
- * deep-copied out into BL31-internal data structures.
- */
-
-enum bl_aux_param_type {
- BL_AUX_PARAM_NONE = 0,
- BL_AUX_PARAM_VENDOR_SPECIFIC_FIRST = 0x1,
- /* 0x1 - 0x7fffffff can be used by vendor-specific handlers. */
- BL_AUX_PARAM_VENDOR_SPECIFIC_LAST = 0x7fffffff,
- BL_AUX_PARAM_GENERIC_FIRST = 0x80000001,
- BL_AUX_PARAM_COREBOOT_TABLE = BL_AUX_PARAM_GENERIC_FIRST,
- /* 0x80000001 - 0xffffffff are reserved for the generic handler. */
- BL_AUX_PARAM_GENERIC_LAST = 0xffffffff,
- /* Top 32 bits of the type field are reserved for future use. */
-};
-
-/* common header for all BL aux parameters */
-struct bl_aux_param_header {
- uint64_t type;
- uint64_t next;
-};
-
-/* commonly useful parameter structures that can be shared by multiple types */
-struct bl_aux_param_uint64 {
- struct bl_aux_param_header h;
- uint64_t value;
-};
-
-struct bl_aux_gpio_info {
- uint8_t polarity;
- uint8_t direction;
- uint8_t pull_mode;
- uint8_t reserved;
- uint32_t index;
-};
-
-struct bl_aux_param_gpio {
- struct bl_aux_param_header h;
- struct bl_aux_gpio_info gpio;
-};
+#include <export/lib/bl_aux_params/bl_aux_params_exp.h>
/*
* Handler function that handles an individual aux parameter. Return true if
diff --git a/include/lib/utils_def.h b/include/lib/utils_def.h
index 2b489675..41f71e84 100644
--- a/include/lib/utils_def.h
+++ b/include/lib/utils_def.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2016-2019, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -7,6 +7,8 @@
#ifndef UTILS_DEF_H
#define UTILS_DEF_H
+#include <export/lib/utils_def_exp.h>
+
/* Compute the number of elements in the given array */
#define ARRAY_SIZE(a) \
(sizeof(a) / sizeof((a)[0]))
@@ -106,29 +108,6 @@
#define check_u32_overflow(_u32, _inc) \
((_u32) > (UINT32_MAX - (_inc)))
-/*
- * For those constants to be shared between C and other sources, apply a 'U',
- * 'UL', 'ULL', 'L' or 'LL' suffix to the argument only in C, to avoid
- * undefined or unintended behaviour.
- *
- * The GNU assembler and linker do not support these suffixes (it causes the
- * build process to fail) therefore the suffix is omitted when used in linker
- * scripts and assembler files.
-*/
-#if defined(__LINKER__) || defined(__ASSEMBLY__)
-# define U(_x) (_x)
-# define UL(_x) (_x)
-# define ULL(_x) (_x)
-# define L(_x) (_x)
-# define LL(_x) (_x)
-#else
-# define U(_x) (_x##U)
-# define UL(_x) (_x##UL)
-# define ULL(_x) (_x##ULL)
-# define L(_x) (_x##L)
-# define LL(_x) (_x##LL)
-#endif
-
/* Register size of the current architecture. */
#ifdef AARCH32
#define REGSZ U(4)