blob: 97bb3b86f67902ea4b8e7355f914fe8c8f6eb565 [file] [log] [blame]
Julian Hallcfe2f5b2022-09-22 11:26:35 +01001/*
2 * Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Julian Hall93df76a2022-09-22 17:30:06 +01007#ifndef MEDIA_VOLUME_INDEX_H
8#define MEDIA_VOLUME_INDEX_H
Julian Hallcfe2f5b2022-09-22 11:26:35 +01009
10#include <stdint.h>
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16/**
Julian Hall93df76a2022-09-22 17:30:06 +010017 * For tf-a declaration of plat_get_image_source(). Included within C++ extern C
18 * guard to allow for calling from C++.
19 */
20#include <plat/common/platform.h>
21
22/**
Julian Hall94970102022-09-28 11:02:48 +010023 * @brief Some common volume identifiers
24 *
25 * Volume IDs only need to be unique within a deployment. For convenience,
26 * here are some common volume IDs that may be useful.
27 */
28#define VOLUME_ID_COMMON_BASE (0x10000)
29#define VOLUME_ID_SECURE_FLASH (VOLUME_ID_COMMON_BASE + 0)
30
31/**
Julian Hallcfe2f5b2022-09-22 11:26:35 +010032 * @brief Initialize the volume index
33 *
34 * The volume_index is a singleton that holds the mapping of volume IDs
35 * to concrete IO devices that can be used to access the volume. The
36 * mappings are setup during deployment configuration to meet the IO needs
37 * of the deployment. The volume_index realizes the tf-a function
38 * plat_get_image_source() to make the mappings available to tf-a components.
39 */
40void volume_index_init(void);
41
42/**
43 * @brief Clears the volume index
44 *
45 * Clears all mappings.
46 */
47void volume_index_clear(void);
48
49/**
50 * @brief Add an entry to the volume index
51 *
52 * @param[in] volume_id Volume identifier
53 * @param[in] dev_handle Device handle to use
54 * @param[in] volume_spec Additional information about the volume
55 *
56 * @return 0 if successful
57 */
58int volume_index_add(
59 unsigned int volume_id,
60 uintptr_t dev_handle,
61 uintptr_t volume_spec);
62
63#ifdef __cplusplus
64}
65#endif
66
Julian Hall93df76a2022-09-22 17:30:06 +010067#endif /* MEDIA_VOLUME_INDEX_H */