]> git.proxmox.com Git - mirror_edk2.git/blob - FmpDevicePkg/Include/Library/FmpDependencyLib.h
FmpDevicePkg: Add FmpDependency library class and BASE instance
[mirror_edk2.git] / FmpDevicePkg / Include / Library / FmpDependencyLib.h
1 /** @file
2 Fmp Capsule Dependency support functions for Firmware Management Protocol based
3 firmware updates.
4
5 Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
6
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8
9 **/
10
11 #ifndef __FMP_DEPENDENCY_LIB__
12 #define __FMP_DEPENDENCY_LIB__
13
14 #include <PiDxe.h>
15 #include <Protocol/FirmwareManagement.h>
16
17 //
18 // Data struct to store FMP ImageType and version for dependency check.
19 //
20 typedef struct {
21 EFI_GUID ImageTypeId;
22 UINT32 Version;
23 } FMP_DEPEX_CHECK_VERSION_DATA;
24
25 /**
26 Validate the dependency expression and output its size.
27
28 @param[in] Dependencies Pointer to the EFI_FIRMWARE_IMAGE_DEP.
29 @param[in] MaxDepexSize Max size of the dependency.
30 @param[out] DepexSize Size of dependency.
31
32 @retval TRUE The capsule is valid.
33 @retval FALSE The capsule is invalid.
34
35 **/
36 BOOLEAN
37 EFIAPI
38 ValidateDependency (
39 IN EFI_FIRMWARE_IMAGE_DEP *Dependencies,
40 IN UINTN MaxDepexSize,
41 OUT UINT32 *DepexSize
42 );
43
44 /**
45 Get dependency from firmware image.
46
47 @param[in] Image Points to the firmware image.
48 @param[in] ImageSize Size, in bytes, of the firmware image.
49 @param[out] DepexSize Size, in bytes, of the dependency.
50
51 @retval The pointer to dependency.
52 @retval Null
53
54 **/
55 EFI_FIRMWARE_IMAGE_DEP*
56 EFIAPI
57 GetImageDependency (
58 IN EFI_FIRMWARE_IMAGE_AUTHENTICATION *Image,
59 IN UINTN ImageSize,
60 OUT UINT32 *DepexSize
61 );
62
63 /**
64 Evaluate the dependencies. The caller must search all the Fmp instances and
65 gather their versions into FmpVersions parameter. If there is PUSH_GUID opcode
66 in dependency expression with no FmpVersions provided, the dependency will
67 evaluate to FALSE.
68
69 @param[in] Dependencies Dependency expressions.
70 @param[in] DependenciesSize Size of Dependency expressions.
71 @param[in] FmpVersions Array of Fmp ImageTypeId and version. This
72 parameter is optional and can be set to NULL.
73 @param[in] FmpVersionsCount Element count of the array. When FmpVersions
74 is NULL, FmpVersionsCount must be 0.
75
76 @retval TRUE Dependency expressions evaluate to TRUE.
77 @retval FALSE Dependency expressions evaluate to FALSE.
78
79 **/
80 BOOLEAN
81 EFIAPI
82 EvaluateDependency (
83 IN EFI_FIRMWARE_IMAGE_DEP *Dependencies,
84 IN UINTN DependenciesSize,
85 IN FMP_DEPEX_CHECK_VERSION_DATA *FmpVersions OPTIONAL,
86 IN UINTN FmpVersionsCount
87 );
88
89 #endif