aboutsummaryrefslogtreecommitdiff
path: root/module/fip/include/mod_fip.h
blob: 0f9f4a9cd495e8c6fe6fa129ed51eab69bc0b4af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*
 * Arm SCP/MCP Software
 * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 *
 * Description:
 *     Header file for FIP module used to parse the firmware
 *     package.
 */

#ifndef MOD_FIP_H
#define MOD_FIP_H

#include <stddef.h>
#include <stdint.h>

/*!
 * \addtogroup GroupModules Modules
 * \{
 */

/*!
 * \defgroup GroupFIP Firmware Image Package
 *
 * \brief Provides an API to access firmware image partitions.
 *
 * \details This module provides a table of descriptors that each describe a
 *      block of firmware image entry in the underlying storage.
 *
 * \{
 */

/*!
 * \defgroup GroupModuleFIPEntries FIP entries' identifiers.
 * \{
 */

/*!
 * \brief FIP TOC entry types.
 */
enum mod_fip_toc_entry_type {
    /*! SCP Firmware BL2 */
    MOD_FIP_TOC_ENTRY_SCP_BL2,
    /*! MCP Firmware BL2 */
    MOD_FIP_TOC_ENTRY_MCP_BL2,
    /*! TF-A runtime firmware BL31 */
    MOD_FIP_TOC_ENTRY_TFA_BL31,
};
/*!
 * \}
 */

/*!
 * \brief A memory-mapped FIP entry data (desribes a firmware image).
 */
struct mod_fip_entry_data {
    /*! Start of entry data */
    void *base;
    /*! Size */
    size_t size;
    /*! Flags */
    uint64_t flags;
};

/*!
 * \brief APIs to access the FIP entry data.
 */
struct mod_fip_api {
    /*!
     * \brief Retrieve a FIP entry's data.
     *
     * \param type FIP ToC entry type.
     * \param[out] entry Updated if the type of entry requested is found.
     * \param base Base address where FIP ToC resides.
     * \param limit Maximum size of the media where FIP ToC resides.

     * \retval ::FWK_SUCCESS Entry found and \p entry updated.
     * \retval ::FWK_E_INIT Underlying storage could not be parsed (during
     *      init).
     * \retval ::FWK_E_RANGE No entry of type \p type could be located.
     * \retval ::FWK_E_DATA FIP ToC corrupted or otherwise not usable on this
     *         platform.
     */
    int (*get_entry)(
        enum mod_fip_toc_entry_type type,
        struct mod_fip_entry_data *entry,
        uintptr_t base,
        size_t limit);
};

/*!
 * \}
 */

/*!
 * \}
 */

#endif /* MOD_FIP_H */