blob: 8e0baf5662420547c81072c50ac331c3b5bd7d24 [file] [log] [blame]
Julian Hall56387ba2022-11-18 11:47:44 +00001/*
2 * Copyright (c) 2022-2023, Arm Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef INSTALLER_INDEX_H
8#define INSTALLER_INDEX_H
9
10#include <stddef.h>
11#include <stdint.h>
Gyorgy Szing3c446242023-03-31 01:53:15 +020012
13#include "service/fwu/agent/install_type.h"
Julian Hall56387ba2022-11-18 11:47:44 +000014
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19/**
20 * Interface dependencies
21 */
22struct installer;
23
24/**
25 * @brief Initialize the installer index
26 *
27 * The installer_index is a singleton that holds the set of installers that are suitable
28 * for the deployment. The mix of installers will depend on factors such as the image
29 * container used by firmware or whether images are encrypted etc.
30 */
31void installer_index_init(void);
32
33/**
34 * @brief Clears the installer index
35 *
36 * Clears all mappings.
37 */
38void installer_index_clear(void);
39
40/**
41 * @brief Register an installer
42 *
43 * Registers an installer to handle image installation for a particular install_type
44 * and location.
45 *
46 * @param[in] installer The installer to use
47 */
Gyorgy Szing3c446242023-03-31 01:53:15 +020048void installer_index_register(struct installer *installer);
Julian Hall56387ba2022-11-18 11:47:44 +000049
50/**
51 * @brief Find an installer for the specified type and location
52 *
53 * @param[in] install_type The type of installer
54 * @param[in] location_id The location it serves
55 *
56 * @return Pointer to a concrete installer or NULL if none found
57 */
Gyorgy Szing3c446242023-03-31 01:53:15 +020058struct installer *installer_index_find(enum install_type install_type, uint32_t location_id);
Julian Hall56387ba2022-11-18 11:47:44 +000059
60/**
61 * @brief Find a registered installer associated with the specified location UUID
62 *
63 * @param[in] location_uuid The associated location UUID
64 *
65 * @return Pointer to a concrete installer or NULL if none found
66 */
Gyorgy Szing3c446242023-03-31 01:53:15 +020067struct installer *installer_index_find_by_location_uuid(const struct uuid_octets *location_uuid);
Julian Hall56387ba2022-11-18 11:47:44 +000068
69/**
70 * @brief Iterator function
71 *
72 * @param[in] index 0..n
73 *
74 * @return Pointer to a concrete installer or NULL if iterated beyond final entry
75 */
76struct installer *installer_index_get(unsigned int index);
77
78/**
79 * @brief Get an array of location_ids
80 *
81 * Updatable firmware may be distributed over multiple locations. Each location is
82 * assigned a location_id when the set of installers are registered for the platform.
83 * This function returns a variable length array of locations_ids for the platform.
84 * This is useful for checking if an incoming update has included components that
85 * update all locations or not.
86 *
87 * @param[out] num_ids 0..n
88 *
89 * @return Pointer to a static array of location ids
90 */
91const uint32_t *installer_index_get_location_ids(size_t *num_ids);
92
93#ifdef __cplusplus
94}
95#endif
96
97#endif /* INSTALLER_INDEX_H */