diff options
author | Dimitris Papastamos <dimitris.papastamos@arm.com> | 2018-06-22 09:36:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-22 09:36:59 +0100 |
commit | 9dfd755303abcea6b58849793367639a8531b6fd (patch) | |
tree | 948d2ffcd6869e1e6a4246698571002ac34c1e9f /include | |
parent | 826469bc65c62bf1b096333158091dcae44153dd (diff) | |
parent | a7055c5828fecaba80054348cc469b7e5d025937 (diff) | |
download | platform_external_arm-trusted-firmware-9dfd755303abcea6b58849793367639a8531b6fd.tar.gz platform_external_arm-trusted-firmware-9dfd755303abcea6b58849793367639a8531b6fd.tar.bz2 platform_external_arm-trusted-firmware-9dfd755303abcea6b58849793367639a8531b6fd.zip |
Merge pull request #1437 from jeenu-arm/ras-remaining
SDEI dispatch changes to enable RAS use cases
Diffstat (limited to 'include')
-rw-r--r-- | include/lib/aarch64/setjmp.h | 59 | ||||
-rw-r--r-- | include/services/sdei.h | 11 |
2 files changed, 68 insertions, 2 deletions
diff --git a/include/lib/aarch64/setjmp.h b/include/lib/aarch64/setjmp.h new file mode 100644 index 000000000..c65810d82 --- /dev/null +++ b/include/lib/aarch64/setjmp.h @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef __JMP_H__ +#define __JMP_H__ + +#define JMP_CTX_X19 0x0 +#define JMP_CTX_X21 0x10 +#define JMP_CTX_X23 0x20 +#define JMP_CTX_X25 0x30 +#define JMP_CTX_X27 0x40 +#define JMP_CTX_X29 0x50 +#define JMP_CTX_SP 0x60 +#define JMP_CTX_END 0x70 + +#define JMP_SIZE (JMP_CTX_END >> 3) + +#ifndef __ASSEMBLY__ + +#include <stdint.h> + +/* Jump buffer hosting x18 - x30 and sp_el0 registers */ +struct jmpbuf { + uint64_t buf[JMP_SIZE]; +} __aligned(16); + + +/* + * Set a jump point, and populate the jump buffer with context information so + * that longjmp() can jump later. The caller must adhere to the following + * conditions: + * + * - After calling this function, the stack must not be shrunk. The contents of + * the stack must not be changed either. + * + * - If the caller were to 'return', the buffer must be considered invalid, and + * must not be used with longjmp(). + * + * The caller will observe this function returning at two distinct + * circumstances, each with different return values: + * + * - Zero, when the buffer is setup; + * + * - Non-zero, when a call to longjmp() is made (presumably by one of the + * callee functions) with the same jump buffer. + */ +int setjmp(struct jmpbuf *buf); + +/* + * Reset execution to a jump point, and restore context information according to + * the jump buffer populated by setjmp(). + */ +void longjmp(struct jmpbuf *buf); + +#endif /* __ASSEMBLY__ */ +#endif /* __JMP_H__ */ diff --git a/include/services/sdei.h b/include/services/sdei.h index ce9a008c5..79d1d065d 100644 --- a/include/services/sdei.h +++ b/include/services/sdei.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -52,6 +52,7 @@ #define _SDEI_MAPF_SIGNALABLE_SHIFT 3 #define _SDEI_MAPF_PRIVATE_SHIFT 4 #define _SDEI_MAPF_CRITICAL_SHIFT 5 +#define _SDEI_MAPF_EXPLICIT_SHIFT 6 /* SDEI event 0 */ #define SDEI_EVENT_0 0 @@ -81,9 +82,12 @@ */ #define SDEI_MAPF_DYNAMIC BIT(_SDEI_MAPF_DYNAMIC_SHIFT) #define SDEI_MAPF_BOUND BIT(_SDEI_MAPF_BOUND_SHIFT) +#define SDEI_MAPF_EXPLICIT BIT(_SDEI_MAPF_EXPLICIT_SHIFT) #define SDEI_MAPF_SIGNALABLE BIT(_SDEI_MAPF_SIGNALABLE_SHIFT) #define SDEI_MAPF_PRIVATE BIT(_SDEI_MAPF_PRIVATE_SHIFT) + +#define SDEI_MAPF_NORMAL 0 #define SDEI_MAPF_CRITICAL BIT(_SDEI_MAPF_CRITICAL_SHIFT) /* Indices of private and shared mappings */ @@ -114,6 +118,9 @@ #define SDEI_DEFINE_EVENT_0(_intr) \ SDEI_PRIVATE_EVENT(SDEI_EVENT_0, _intr, SDEI_MAPF_SIGNALABLE) +#define SDEI_EXPLICIT_EVENT(_event, _pri) \ + SDEI_EVENT_MAP(_event, 0, _pri | SDEI_MAPF_EXPLICIT | SDEI_MAPF_PRIVATE) + /* * Declare shared and private entries for each core. Also declare a global * structure containing private and share entries. @@ -176,6 +183,6 @@ uint64_t sdei_smc_handler(uint32_t smc_fid, void sdei_init(void); /* Public API to dispatch an event to Normal world */ -int sdei_dispatch_event(int ev_num, unsigned int preempted_sec_state); +int sdei_dispatch_event(int ev_num); #endif /* __SDEI_H__ */ |