1 /*
2  * Copyright (c) 2022, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef UEFI_FMP_H
9 #define UEFI_FMP_H
10 
11 
12 #include <stdint.h>
13 #include "fwu_agent.h"
14 #include "../fip_parser/external/uuid.h"
15 
16 /*
17  * Last Attempt Status Value
18  */
19 
20 #define LAST_ATTEMPT_STATUS_SUCCESS                                     0x00000000
21 #define LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL                          0x00000001
22 #define LAST_ATTEMPT_STATUS_ERROR_INSUFFICIENT_RESOURCES                0x00000002
23 #define LAST_ATTEMPT_STATUS_ERROR_INCORRECT_VERSION                     0x00000003
24 #define LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT                        0x00000004
25 #define LAST_ATTEMPT_STATUS_ERROR_AUTH_ERROR                            0x00000005
26 #define LAST_ATTEMPT_STATUS_ERROR_PWR_EVT_AC                            0x00000006
27 #define LAST_ATTEMPT_STATUS_ERROR_PWR_EVT_BATT                          0x00000007
28 #define LAST_ATTEMPT_STATUS_ERROR_UNSATISFIED_DEPENDENCIES              0x00000008
29 /* The LastAttemptStatus values of 0x1000 - 0x4000 are reserved for vendor usage. */
30 #define LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL_VENDOR_RANGE_MIN         0x00001000
31 #define LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL_VENDOR_RANGE_MAX         0x00004000
32 
33 
34 
35 /*
36  * Updates FMP information for the image matched by guid.
37  *
38  * guid : guid of the image
39  * current_version: current versions for the image
40  * attempt_version: attempted versions for the image
41  *
42  */
43 enum fwu_agent_error_t fmp_set_image_info(struct efi_guid *guid,
44                      uint32_t current_version, uint32_t attempt_version,
45                      uint32_t last_attempt_status);
46 
47 /*
48  * Return fmp image information for all the updable images.
49  *
50  * buffer : pointer to the out buffer
51  * size : size of the buffer
52  *
53  */
54 enum fwu_agent_error_t fmp_get_image_info(void *buffer, uint32_t size);
55 
56 #endif /* UEFI_FMP_H */
57