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