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