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 This program and the accompanying materials are licensed and made available under 6 the terms and conditions of the BSD License that accompanies this distribution. 7 The full text of the license may be found at 8 http://opensource.org/licenses/bsd-license.php. 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 13 **/ 14 15 #ifndef _HASH2_DRIVER_H_ 16 #define _HASH2_DRIVER_H_ 17 18 #include <Uefi.h> 19 20 #include <Protocol/ServiceBinding.h> 21 #include <Protocol/Hash2.h> 22 23 #include <Library/BaseLib.h> 24 #include <Library/BaseMemoryLib.h> 25 #include <Library/DebugLib.h> 26 #include <Library/MemoryAllocationLib.h> 27 #include <Library/UefiBootServicesTableLib.h> 28 #include <Library/UefiRuntimeServicesTableLib.h> 29 #include <Library/DevicePathLib.h> 30 #include <Library/UefiLib.h> 31 32 #define HASH2_SERVICE_DATA_SIGNATURE SIGNATURE_32 ('H', 'S', '2', 'S') 33 34 typedef struct { 35 UINT32 Signature; 36 EFI_HANDLE ServiceHandle; 37 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding; 38 39 LIST_ENTRY ChildrenList; 40 } HASH2_SERVICE_DATA; 41 42 #define HASH2_SERVICE_DATA_FROM_THIS(a) \ 43 CR ( \ 44 (a), \ 45 HASH2_SERVICE_DATA, \ 46 ServiceBinding, \ 47 HASH2_SERVICE_DATA_SIGNATURE \ 48 ) 49 50 #define HASH2_INSTANCE_DATA_SIGNATURE SIGNATURE_32 ('H', 's', '2', 'I') 51 52 typedef struct { 53 UINT32 Signature; 54 HASH2_SERVICE_DATA *Hash2ServiceData; 55 EFI_HANDLE Handle; 56 LIST_ENTRY InstEntry; 57 EFI_HASH2_PROTOCOL Hash2Protocol; 58 VOID *HashContext; 59 VOID *HashInfoContext; 60 BOOLEAN Updated; 61 } HASH2_INSTANCE_DATA; 62 63 #define HASH2_INSTANCE_DATA_FROM_THIS(a) \ 64 CR ( \ 65 (a), \ 66 HASH2_INSTANCE_DATA, \ 67 Hash2Protocol, \ 68 HASH2_INSTANCE_DATA_SIGNATURE \ 69 ) 70 71 #define HASH2_INSTANCE_DATA_FROM_LINK(a) \ 72 CR ( \ 73 (a), \ 74 HASH2_INSTANCE_DATA, \ 75 InstEntry, \ 76 HASH2_INSTANCE_DATA_SIGNATURE \ 77 ) 78 79 /** 80 Creates a child handle with a set of I/O services. 81 82 @param[in] This Protocol instance pointer. 83 @param[in, out] ChildHandle Pointer to the handle of the child to create. If 84 it is NULL, then a new handle is created. If 85 it is not NULL, then the I/O services are added 86 to the existing child handle. 87 88 @retval EFI_SUCCES The protocol was added to ChildHandle. 89 @retval EFI_INVALID_PARAMETER ChildHandle is NULL. 90 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to 91 create the child. 92 @retval Others The child handle was not created. 93 94 **/ 95 EFI_STATUS 96 EFIAPI 97 Hash2ServiceBindingCreateChild ( 98 IN EFI_SERVICE_BINDING_PROTOCOL *This, 99 IN OUT EFI_HANDLE *ChildHandle 100 ); 101 102 /** 103 Destroys a child handle with a set of I/O services. 104 105 The DestroyChild() function does the opposite of CreateChild(). It removes a 106 protocol that was installed by CreateChild() from ChildHandle. If the removed 107 protocol is the last protocol on ChildHandle, then ChildHandle is destroyed. 108 109 @param[in] This Pointer to the EFI_SERVICE_BINDING_PROTOCOL 110 instance. 111 @param[in] ChildHandle Handle of the child to destroy. 112 113 @retval EFI_SUCCES The protocol was removed from ChildHandle. 114 @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that 115 is being removed. 116 @retval EFI_INVALID_PARAMETER ChildHandle is NULL. 117 @retval EFI_ACCESS_DENIED The protocol could not be removed from the 118 ChildHandle because its services are being 119 used. 120 @retval Others The child handle was not destroyed. 121 122 **/ 123 EFI_STATUS 124 EFIAPI 125 Hash2ServiceBindingDestroyChild ( 126 IN EFI_SERVICE_BINDING_PROTOCOL *This, 127 IN EFI_HANDLE ChildHandle 128 ); 129 130 extern EFI_HASH2_PROTOCOL mHash2Protocol; 131 132 #endif 133