blob: d82cbc21314d5c53e30d8f3063d10e475d3481a8 [file] [log] [blame]
Julian Hall51a3fb32022-11-07 16:25:56 +00001/*
2 * Copyright (c) 2022, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#ifndef FWU_RAW_INSTALLER_H
9#define FWU_RAW_INSTALLER_H
10
11#include <stdbool.h>
12#include <stddef.h>
13#include <stdint.h>
14#include <common/uuid/uuid.h>
15#include <service/fwu/installer/installer.h>
16#include <media/volume/volume.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22/**
23 * \brief raw_installer structure definition
24 *
25 * A raw_installer is an installer that takes the raw input image and writes
26 * it directly to the target storage volume with no intermediate processing.
27 * The raw_installer can be used for say installing a complete firmware image
28 * into a single volume. Because the raw_installer has no knowledge of the
29 * format of images that it installs, the assigned location_uuid is used
30 * by the enumerate method to advertise a single updatable image that
31 * corresponds to the entire raw contents of the associated target
32 * volume. Other sub-volume installers may advertise additional updatable
33 * images that reside within the same target volume.
34 */
35struct raw_installer {
36 struct installer base_installer;
37 struct volume *target_volume;
38 unsigned int commit_count;
39 size_t bytes_written;
40 bool is_open;
41};
42
43/**
44 * \brief Initialize a raw_installer
45 *
46 * \param[in] subject The subject raw_installer
47 * \param[in] location_uuid The associated location UUID
48 * \param[in] location_id Identifies where to install qualifying images
49 */
50void raw_installer_init(struct raw_installer *subject,
51 const struct uuid_octets *location_uuid,
52 uint32_t location_id);
53
54/**
55 * \brief De-initialize a raw_installer
56 *
57 * \param[in] subject The subject raw_installer
58 */
59void raw_installer_deinit(struct raw_installer *subject);
60
61#ifdef __cplusplus
62}
63#endif
64
65#endif /* FWU_RAW_INSTALLER_H */