2015-10-10 19:06:53 +01:00
|
|
|
/*
|
2020-02-12 16:37:03 +00:00
|
|
|
* Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved.
|
2015-10-10 19:06:53 +01:00
|
|
|
*
|
2017-05-03 09:38:09 +01:00
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
2015-10-10 19:06:53 +01:00
|
|
|
*/
|
|
|
|
|
2018-11-08 10:20:19 +00:00
|
|
|
#ifndef BL1_H
|
|
|
|
#define BL1_H
|
2015-10-10 19:06:53 +01:00
|
|
|
|
2018-12-14 00:18:21 +00:00
|
|
|
#include <common/bl_common.h>
|
2015-10-10 19:06:53 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Defines for BL1 SMC function ids.
|
|
|
|
*/
|
|
|
|
#define BL1_SMC_CALL_COUNT 0x0
|
|
|
|
#define BL1_SMC_UID 0x1
|
|
|
|
/* SMC #0x2 reserved */
|
|
|
|
#define BL1_SMC_VERSION 0x3
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Corresponds to the function ID of the SMC that
|
|
|
|
* the BL1 exception handler service to execute BL31.
|
|
|
|
*/
|
|
|
|
#define BL1_SMC_RUN_IMAGE 0x4
|
|
|
|
|
|
|
|
/*
|
|
|
|
* BL1 SMC version
|
|
|
|
*/
|
2020-08-05 21:33:40 +01:00
|
|
|
#define BL1_SMC_MAJOR_VER UL(0x0)
|
|
|
|
#define BL1_SMC_MINOR_VER UL(0x1)
|
2015-10-10 19:06:53 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Defines for FWU SMC function ids.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define FWU_SMC_IMAGE_COPY 0x10
|
|
|
|
#define FWU_SMC_IMAGE_AUTH 0x11
|
|
|
|
#define FWU_SMC_IMAGE_EXECUTE 0x12
|
|
|
|
#define FWU_SMC_IMAGE_RESUME 0x13
|
|
|
|
#define FWU_SMC_SEC_IMAGE_DONE 0x14
|
|
|
|
#define FWU_SMC_UPDATE_DONE 0x15
|
2017-05-12 16:51:59 +01:00
|
|
|
#define FWU_SMC_IMAGE_RESET 0x16
|
2015-10-10 19:06:53 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Number of FWU calls (above) implemented
|
|
|
|
*/
|
2017-05-12 16:51:59 +01:00
|
|
|
#define FWU_NUM_SMC_CALLS 7
|
2015-10-10 19:06:53 +01:00
|
|
|
|
|
|
|
#if TRUSTED_BOARD_BOOT
|
|
|
|
# define BL1_NUM_SMC_CALLS (FWU_NUM_SMC_CALLS + 4)
|
|
|
|
#else
|
|
|
|
# define BL1_NUM_SMC_CALLS 4
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The macros below are used to identify FWU
|
|
|
|
* calls from the SMC function ID
|
|
|
|
*/
|
|
|
|
#define FWU_SMC_FID_START FWU_SMC_IMAGE_COPY
|
2017-05-12 16:51:59 +01:00
|
|
|
#define FWU_SMC_FID_END FWU_SMC_IMAGE_RESET
|
2015-10-10 19:06:53 +01:00
|
|
|
#define is_fwu_fid(_fid) \
|
|
|
|
((_fid >= FWU_SMC_FID_START) && (_fid <= FWU_SMC_FID_END))
|
|
|
|
|
2019-07-09 21:49:11 +01:00
|
|
|
#ifndef __ASSEMBLER__
|
2018-12-14 00:18:21 +00:00
|
|
|
|
|
|
|
#include <lib/cassert.h>
|
2015-10-10 19:06:53 +01:00
|
|
|
|
2018-02-12 12:36:17 +00:00
|
|
|
struct entry_point_info;
|
|
|
|
|
2020-02-12 16:37:03 +00:00
|
|
|
u_register_t bl1_smc_wrapper(uint32_t smc_fid,
|
2018-02-12 12:36:17 +00:00
|
|
|
void *cookie,
|
|
|
|
void *handle,
|
|
|
|
unsigned int flags);
|
|
|
|
|
2020-02-12 16:37:03 +00:00
|
|
|
u_register_t bl1_smc_handler(unsigned int smc_fid,
|
|
|
|
u_register_t x1,
|
|
|
|
u_register_t x2,
|
|
|
|
u_register_t x3,
|
|
|
|
u_register_t x4,
|
2018-02-12 12:36:17 +00:00
|
|
|
void *cookie,
|
|
|
|
void *handle,
|
|
|
|
unsigned int flags);
|
|
|
|
|
|
|
|
void bl1_print_next_bl_ep_info(const struct entry_point_info *bl_ep_info);
|
|
|
|
|
2019-01-30 20:29:50 +00:00
|
|
|
void bl1_setup(void);
|
2018-02-12 12:36:17 +00:00
|
|
|
void bl1_main(void);
|
2018-02-12 12:36:17 +00:00
|
|
|
void bl1_plat_prepare_exit(entry_point_info_t *ep_info);
|
2018-02-12 12:36:17 +00:00
|
|
|
|
2015-10-10 19:06:53 +01:00
|
|
|
/*
|
|
|
|
* Check if the total number of FWU SMC calls are as expected.
|
|
|
|
*/
|
|
|
|
CASSERT(FWU_NUM_SMC_CALLS == \
|
|
|
|
(FWU_SMC_FID_END - FWU_SMC_FID_START + 1),\
|
|
|
|
assert_FWU_NUM_SMC_CALLS_mismatch);
|
|
|
|
|
2018-01-10 12:51:34 +00:00
|
|
|
/* Utility functions */
|
|
|
|
void bl1_calc_bl2_mem_layout(const meminfo_t *bl1_mem_layout,
|
|
|
|
meminfo_t *bl2_mem_layout);
|
|
|
|
|
2019-07-09 21:49:11 +01:00
|
|
|
#endif /* __ASSEMBLER__ */
|
2018-11-08 10:20:19 +00:00
|
|
|
#endif /* BL1_H */
|