]>
Commit | Line | Data |
---|---|---|
a93bf06b WX |
1 | /** @file\r |
2 | Fmp Capsule Dependency support functions for Firmware Management Protocol based\r | |
3 | firmware updates.\r | |
4 | \r | |
ef0460b8 | 5 | Copyright (c) Microsoft Corporation.<BR>\r |
a93bf06b WX |
6 | Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>\r |
7 | \r | |
8 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
9 | \r | |
10 | **/\r | |
11 | \r | |
12 | #ifndef __FMP_DEPENDENCY_LIB__\r | |
13 | #define __FMP_DEPENDENCY_LIB__\r | |
14 | \r | |
15 | #include <PiDxe.h>\r | |
16 | #include <Protocol/FirmwareManagement.h>\r | |
17 | \r | |
18 | //\r | |
19 | // Data struct to store FMP ImageType and version for dependency check.\r | |
20 | //\r | |
21 | typedef struct {\r | |
45ce0a67 MK |
22 | EFI_GUID ImageTypeId;\r |
23 | UINT32 Version;\r | |
a93bf06b WX |
24 | } FMP_DEPEX_CHECK_VERSION_DATA;\r |
25 | \r | |
26 | /**\r | |
27 | Validate the dependency expression and output its size.\r | |
28 | \r | |
207414cb MK |
29 | @param[in] Dependencies Pointer to the EFI_FIRMWARE_IMAGE_DEP.\r |
30 | @param[in] MaxDepexSize Max size of the dependency.\r | |
31 | @param[out] DepexSize Size of dependency.\r | |
32 | @param[out] LastAttemptStatus An optional pointer to a UINT32 that holds the\r | |
33 | last attempt status to report back to the caller.\r | |
34 | If a last attempt status error code is not returned,\r | |
35 | this function will not modify the LastAttemptStatus value.\r | |
a93bf06b | 36 | \r |
ef0460b8 MK |
37 | @retval TRUE The dependency expression is valid.\r |
38 | @retval FALSE The dependency expression is invalid.\r | |
a93bf06b WX |
39 | \r |
40 | **/\r | |
41 | BOOLEAN\r | |
42 | EFIAPI\r | |
43 | ValidateDependency (\r | |
44 | IN EFI_FIRMWARE_IMAGE_DEP *Dependencies,\r | |
45 | IN UINTN MaxDepexSize,\r | |
207414cb MK |
46 | OUT UINT32 *DepexSize,\r |
47 | OUT UINT32 *LastAttemptStatus OPTIONAL\r | |
a93bf06b WX |
48 | );\r |
49 | \r | |
50 | /**\r | |
51 | Get dependency from firmware image.\r | |
52 | \r | |
207414cb MK |
53 | @param[in] Image Points to the firmware image.\r |
54 | @param[in] ImageSize Size, in bytes, of the firmware image.\r | |
55 | @param[out] DepexSize Size, in bytes, of the dependency.\r | |
56 | @param[out] LastAttemptStatus An optional pointer to a UINT32 that holds the\r | |
57 | last attempt status to report back to the caller.\r | |
58 | If a last attempt status error code is not returned,\r | |
59 | this function will not modify the LastAttemptStatus value.\r | |
a93bf06b WX |
60 | @retval The pointer to dependency.\r |
61 | @retval Null\r | |
62 | \r | |
63 | **/\r | |
45ce0a67 | 64 | EFI_FIRMWARE_IMAGE_DEP *\r |
a93bf06b WX |
65 | EFIAPI\r |
66 | GetImageDependency (\r | |
45ce0a67 MK |
67 | IN EFI_FIRMWARE_IMAGE_AUTHENTICATION *Image,\r |
68 | IN UINTN ImageSize,\r | |
69 | OUT UINT32 *DepexSize,\r | |
70 | OUT UINT32 *LastAttemptStatus OPTIONAL\r | |
a93bf06b WX |
71 | );\r |
72 | \r | |
73 | /**\r | |
74 | Evaluate the dependencies. The caller must search all the Fmp instances and\r | |
75 | gather their versions into FmpVersions parameter. If there is PUSH_GUID opcode\r | |
76 | in dependency expression with no FmpVersions provided, the dependency will\r | |
77 | evaluate to FALSE.\r | |
78 | \r | |
79 | @param[in] Dependencies Dependency expressions.\r | |
80 | @param[in] DependenciesSize Size of Dependency expressions.\r | |
81 | @param[in] FmpVersions Array of Fmp ImageTypeId and version. This\r | |
82 | parameter is optional and can be set to NULL.\r | |
83 | @param[in] FmpVersionsCount Element count of the array. When FmpVersions\r | |
84 | is NULL, FmpVersionsCount must be 0.\r | |
207414cb MK |
85 | @param[out] LastAttemptStatus An optional pointer to a UINT32 that holds the\r |
86 | last attempt status to report back to the caller.\r | |
87 | This function will set the value to LAST_ATTEMPT_STATUS_SUCCESS\r | |
88 | if an error code is not set.\r | |
a93bf06b WX |
89 | \r |
90 | @retval TRUE Dependency expressions evaluate to TRUE.\r | |
91 | @retval FALSE Dependency expressions evaluate to FALSE.\r | |
92 | \r | |
93 | **/\r | |
94 | BOOLEAN\r | |
95 | EFIAPI\r | |
96 | EvaluateDependency (\r | |
207414cb MK |
97 | IN EFI_FIRMWARE_IMAGE_DEP *Dependencies,\r |
98 | IN UINTN DependenciesSize,\r | |
9c721071 | 99 | IN FMP_DEPEX_CHECK_VERSION_DATA *FmpVersions OPTIONAL,\r |
207414cb MK |
100 | IN UINTN FmpVersionsCount,\r |
101 | OUT UINT32 *LastAttemptStatus OPTIONAL\r | |
a93bf06b WX |
102 | );\r |
103 | \r | |
104 | #endif\r |