UefiBootServicesTableLibUnitTestProtocol.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /** @file
  2. An internal header file for the Unit Test instance of the UEFI Boot Services Table Library.
  3. This file includes common header files, defines internal structure and functions used by
  4. the library implementation.
  5. Copyright (c) Microsoft Corporation
  6. SPDX-License-Identifier: BSD-2-Clause-Patent
  7. **/
  8. #ifndef UEFI_BOOT_SERVICES_TABLE_LIB_UNIT_TEST_PROTOCOL_H_
  9. #define UEFI_BOOT_SERVICES_TABLE_LIB_UNIT_TEST_PROTOCOL_H_
  10. #include "UefiBootServicesTableLibUnitTest.h"
  11. #define EFI_HANDLE_SIGNATURE SIGNATURE_32('h','n','d','l')
  12. ///
  13. /// IHANDLE - contains a list of protocol handles
  14. ///
  15. typedef struct {
  16. UINTN Signature;
  17. /// All handles list of IHANDLE
  18. LIST_ENTRY AllHandles;
  19. /// List of PROTOCOL_INTERFACE's for this handle
  20. LIST_ENTRY Protocols;
  21. UINTN LocateRequest;
  22. /// The Handle Database Key value when this handle was last created or modified
  23. UINT64 Key;
  24. } IHANDLE;
  25. #define ASSERT_IS_HANDLE(a) ASSERT((a)->Signature == EFI_HANDLE_SIGNATURE)
  26. #define PROTOCOL_ENTRY_SIGNATURE SIGNATURE_32('p','r','t','e')
  27. ///
  28. /// PROTOCOL_ENTRY - each different protocol has 1 entry in the protocol
  29. /// database. Each handler that supports this protocol is listed, along
  30. /// with a list of registered notifies.
  31. ///
  32. typedef struct {
  33. UINTN Signature;
  34. /// Link Entry inserted to mProtocolDatabase
  35. LIST_ENTRY AllEntries;
  36. /// ID of the protocol
  37. EFI_GUID ProtocolID;
  38. /// All protocol interfaces
  39. LIST_ENTRY Protocols;
  40. /// Registered notification handlers
  41. LIST_ENTRY Notify;
  42. } PROTOCOL_ENTRY;
  43. #define PROTOCOL_INTERFACE_SIGNATURE SIGNATURE_32('p','i','f','c')
  44. ///
  45. /// PROTOCOL_INTERFACE - each protocol installed on a handle is tracked
  46. /// with a protocol interface structure
  47. ///
  48. typedef struct {
  49. UINTN Signature;
  50. /// Link on IHANDLE.Protocols
  51. LIST_ENTRY Link;
  52. /// Back pointer
  53. IHANDLE *Handle;
  54. /// Link on PROTOCOL_ENTRY.Protocols
  55. LIST_ENTRY ByProtocol;
  56. /// The protocol ID
  57. PROTOCOL_ENTRY *Protocol;
  58. /// The interface value
  59. VOID *Interface;
  60. /// OPEN_PROTOCOL_DATA list
  61. LIST_ENTRY OpenList;
  62. UINTN OpenListCount;
  63. } PROTOCOL_INTERFACE;
  64. #define OPEN_PROTOCOL_DATA_SIGNATURE SIGNATURE_32('p','o','d','l')
  65. typedef struct {
  66. UINTN Signature;
  67. /// Link on PROTOCOL_INTERFACE.OpenList
  68. LIST_ENTRY Link;
  69. EFI_HANDLE AgentHandle;
  70. EFI_HANDLE ControllerHandle;
  71. UINT32 Attributes;
  72. UINT32 OpenCount;
  73. } OPEN_PROTOCOL_DATA;
  74. #define PROTOCOL_NOTIFY_SIGNATURE SIGNATURE_32('p','r','t','n')
  75. ///
  76. /// PROTOCOL_NOTIFY - used for each register notification for a protocol
  77. ///
  78. typedef struct {
  79. UINTN Signature;
  80. PROTOCOL_ENTRY *Protocol;
  81. /// All notifications for this protocol
  82. LIST_ENTRY Link;
  83. /// Event to notify
  84. EFI_EVENT Event;
  85. /// Last position notified
  86. LIST_ENTRY *Position;
  87. } PROTOCOL_NOTIFY;
  88. typedef struct {
  89. EFI_GUID *Protocol;
  90. VOID *SearchKey;
  91. LIST_ENTRY *Position;
  92. PROTOCOL_ENTRY *ProtEntry;
  93. } LOCATE_POSITION;
  94. typedef
  95. IHANDLE *
  96. (*UNIT_TEST_GET_NEXT) (
  97. IN OUT LOCATE_POSITION *Position,
  98. OUT VOID **Interface
  99. );
  100. #endif