Julian Hall | cfe2f5b | 2022-09-22 11:26:35 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2022, Arm Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
Julian Hall | 93df76a | 2022-09-22 17:30:06 +0100 | [diff] [blame] | 7 | #ifndef MEDIA_VOLUME_INDEX_H |
| 8 | #define MEDIA_VOLUME_INDEX_H |
Julian Hall | cfe2f5b | 2022-09-22 11:26:35 +0100 | [diff] [blame] | 9 | |
| 10 | #include <stdint.h> |
| 11 | |
| 12 | #ifdef __cplusplus |
| 13 | extern "C" { |
| 14 | #endif |
| 15 | |
| 16 | /** |
Julian Hall | 93df76a | 2022-09-22 17:30:06 +0100 | [diff] [blame] | 17 | * 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 Hall | 9497010 | 2022-09-28 11:02:48 +0100 | [diff] [blame] | 23 | * @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 Hall | cfe2f5b | 2022-09-22 11:26:35 +0100 | [diff] [blame] | 32 | * @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 | */ |
| 40 | void volume_index_init(void); |
| 41 | |
| 42 | /** |
| 43 | * @brief Clears the volume index |
| 44 | * |
| 45 | * Clears all mappings. |
| 46 | */ |
| 47 | void 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 | */ |
| 58 | int 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 Hall | 93df76a | 2022-09-22 17:30:06 +0100 | [diff] [blame] | 67 | #endif /* MEDIA_VOLUME_INDEX_H */ |