blob: 3f160c30335f137ecf6b64f2207000ea6ce1dc87 [file] [log] [blame]
Raef Coles15a37f82021-12-07 15:59:14 +00001/*
Raef Colesf8426362024-01-15 12:38:10 +00002 * Copyright (c) 2022-2024, Arm Limited. All rights reserved.
Raef Coles15a37f82021-12-07 15:59:14 +00003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#include "image.h"
9
10#include "Driver_Flash.h"
11#include "flash_layout.h"
12#include "region_defs.h"
13#include "fih.h"
14
15extern ARM_DRIVER_FLASH FLASH_DEV_NAME;
16
17fih_int bl1_read_bl1_2_image(uint8_t *image)
18{
Raef Coles15a37f82021-12-07 15:59:14 +000019 fih_int fih_rc;
20
Bence Balogh42484f72023-06-27 10:57:34 +020021 fih_rc = fih_int_encode_zero_equality(
22 fih_not_eq(BL1_2_CODE_SIZE,
23 (FLASH_DEV_NAME.ReadData(BL1_2_IMAGE_FLASH_OFFSET,
Raef Coles15a37f82021-12-07 15:59:14 +000024 image,
Bence Balogh42484f72023-06-27 10:57:34 +020025 BL1_2_CODE_SIZE))));
Raef Coles15a37f82021-12-07 15:59:14 +000026
27 FIH_RET(fih_rc);
28}