]> git.proxmox.com Git - mirror_edk2.git/blob - SecurityPkg/Hash2DxeCrypto/Driver.h
OvmfPkg/Csm/LegacyBiosDxe: Update to make it build for OVMF
[mirror_edk2.git] / SecurityPkg / Hash2DxeCrypto / Driver.h
1 /** @file
2 This is definition for service binding for Hash driver.
3
4 Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #ifndef _HASH2_DRIVER_H_
10 #define _HASH2_DRIVER_H_
11
12 #include <Uefi.h>
13
14 #include <Protocol/ServiceBinding.h>
15 #include <Protocol/Hash2.h>
16
17 #include <Library/BaseLib.h>
18 #include <Library/BaseMemoryLib.h>
19 #include <Library/DebugLib.h>
20 #include <Library/MemoryAllocationLib.h>
21 #include <Library/UefiBootServicesTableLib.h>
22 #include <Library/UefiRuntimeServicesTableLib.h>
23 #include <Library/DevicePathLib.h>
24 #include <Library/UefiLib.h>
25
26 #define HASH2_SERVICE_DATA_SIGNATURE SIGNATURE_32 ('H', 'S', '2', 'S')
27
28 typedef struct {
29 UINT32 Signature;
30 EFI_HANDLE ServiceHandle;
31 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
32
33 LIST_ENTRY ChildrenList;
34 } HASH2_SERVICE_DATA;
35
36 #define HASH2_SERVICE_DATA_FROM_THIS(a) \
37 CR ( \
38 (a), \
39 HASH2_SERVICE_DATA, \
40 ServiceBinding, \
41 HASH2_SERVICE_DATA_SIGNATURE \
42 )
43
44 #define HASH2_INSTANCE_DATA_SIGNATURE SIGNATURE_32 ('H', 's', '2', 'I')
45
46 typedef struct {
47 UINT32 Signature;
48 HASH2_SERVICE_DATA *Hash2ServiceData;
49 EFI_HANDLE Handle;
50 LIST_ENTRY InstEntry;
51 EFI_HASH2_PROTOCOL Hash2Protocol;
52 VOID *HashContext;
53 VOID *HashInfoContext;
54 BOOLEAN Updated;
55 } HASH2_INSTANCE_DATA;
56
57 #define HASH2_INSTANCE_DATA_FROM_THIS(a) \
58 CR ( \
59 (a), \
60 HASH2_INSTANCE_DATA, \
61 Hash2Protocol, \
62 HASH2_INSTANCE_DATA_SIGNATURE \
63 )
64
65 #define HASH2_INSTANCE_DATA_FROM_LINK(a) \
66 CR ( \
67 (a), \
68 HASH2_INSTANCE_DATA, \
69 InstEntry, \
70 HASH2_INSTANCE_DATA_SIGNATURE \
71 )
72
73 /**
74 Creates a child handle with a set of I/O services.
75
76 @param[in] This Protocol instance pointer.
77 @param[in, out] ChildHandle Pointer to the handle of the child to create. If
78 it is NULL, then a new handle is created. If
79 it is not NULL, then the I/O services are added
80 to the existing child handle.
81
82 @retval EFI_SUCCES The protocol was added to ChildHandle.
83 @retval EFI_INVALID_PARAMETER ChildHandle is NULL.
84 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to
85 create the child.
86 @retval Others The child handle was not created.
87
88 **/
89 EFI_STATUS
90 EFIAPI
91 Hash2ServiceBindingCreateChild (
92 IN EFI_SERVICE_BINDING_PROTOCOL *This,
93 IN OUT EFI_HANDLE *ChildHandle
94 );
95
96 /**
97 Destroys a child handle with a set of I/O services.
98
99 The DestroyChild() function does the opposite of CreateChild(). It removes a
100 protocol that was installed by CreateChild() from ChildHandle. If the removed
101 protocol is the last protocol on ChildHandle, then ChildHandle is destroyed.
102
103 @param[in] This Pointer to the EFI_SERVICE_BINDING_PROTOCOL
104 instance.
105 @param[in] ChildHandle Handle of the child to destroy.
106
107 @retval EFI_SUCCES The protocol was removed from ChildHandle.
108 @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that
109 is being removed.
110 @retval EFI_INVALID_PARAMETER ChildHandle is NULL.
111 @retval EFI_ACCESS_DENIED The protocol could not be removed from the
112 ChildHandle because its services are being
113 used.
114 @retval Others The child handle was not destroyed.
115
116 **/
117 EFI_STATUS
118 EFIAPI
119 Hash2ServiceBindingDestroyChild (
120 IN EFI_SERVICE_BINDING_PROTOCOL *This,
121 IN EFI_HANDLE ChildHandle
122 );
123
124 extern EFI_HASH2_PROTOCOL mHash2Protocol;
125
126 #endif