Driver.h 4.0 KB

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