XenBusDxe.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /** @file
  2. Function declaration and internal data for XenBusDxe.
  3. Copyright (C) 2014, Citrix Ltd.
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #ifndef __EFI_XENBUS_DXE_H__
  7. #define __EFI_XENBUS_DXE_H__
  8. #include <Uefi.h>
  9. //
  10. // Libraries
  11. //
  12. #include <Library/UefiBootServicesTableLib.h>
  13. #include <Library/MemoryAllocationLib.h>
  14. #include <Library/BaseMemoryLib.h>
  15. #include <Library/BaseLib.h>
  16. #include <Library/UefiLib.h>
  17. #include <Library/DevicePathLib.h>
  18. #include <Library/DebugLib.h>
  19. #include <Library/PcdLib.h>
  20. //
  21. // UEFI Driver Model Protocols
  22. //
  23. #include <Protocol/DriverBinding.h>
  24. //
  25. // Consumed Protocols
  26. //
  27. #include <Protocol/XenIo.h>
  28. //
  29. // Produced Protocols
  30. //
  31. #include <Protocol/XenBus.h>
  32. //
  33. // Driver Version
  34. //
  35. #define XENBUS_DXE_VERSION 0x00000010
  36. //
  37. // Protocol instances
  38. //
  39. extern EFI_DRIVER_BINDING_PROTOCOL gXenBusDxeDriverBinding;
  40. extern EFI_COMPONENT_NAME2_PROTOCOL gXenBusDxeComponentName2;
  41. extern EFI_COMPONENT_NAME_PROTOCOL gXenBusDxeComponentName;
  42. //
  43. // Include files with function prototypes
  44. //
  45. #include "DriverBinding.h"
  46. #include "ComponentName.h"
  47. //
  48. // Other stuff
  49. //
  50. #include <IndustryStandard/Xen/xen.h>
  51. typedef struct _XENBUS_DEVICE_PATH XENBUS_DEVICE_PATH;
  52. typedef struct _XENBUS_DEVICE XENBUS_DEVICE;
  53. // Have the state of the driver.
  54. #define XENBUS_DEVICE_SIGNATURE SIGNATURE_32 ('X','B','s','t')
  55. struct _XENBUS_DEVICE {
  56. UINT32 Signature;
  57. EFI_DRIVER_BINDING_PROTOCOL *This;
  58. EFI_HANDLE ControllerHandle;
  59. XENIO_PROTOCOL *XenIo;
  60. EFI_EVENT ExitBootEvent;
  61. EFI_DEVICE_PATH_PROTOCOL *DevicePath;
  62. LIST_ENTRY ChildList;
  63. shared_info_t *SharedInfo;
  64. };
  65. // There is one of this struct allocated for every child.
  66. #define XENBUS_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('X', 'B', 'p', 'd')
  67. typedef struct {
  68. UINTN Signature;
  69. LIST_ENTRY Link;
  70. EFI_HANDLE Handle;
  71. XENBUS_PROTOCOL XenBusIo;
  72. XENBUS_DEVICE *Dev;
  73. XENBUS_DEVICE_PATH *DevicePath;
  74. } XENBUS_PRIVATE_DATA;
  75. #define XENBUS_PRIVATE_DATA_FROM_THIS(a) \
  76. CR (a, XENBUS_PRIVATE_DATA, XenBusIo, XENBUS_PRIVATE_DATA_SIGNATURE)
  77. #define XENBUS_PRIVATE_DATA_FROM_LINK(a) \
  78. CR (a, XENBUS_PRIVATE_DATA, Link, XENBUS_PRIVATE_DATA_SIGNATURE)
  79. /*
  80. * Helpers
  81. */
  82. /**
  83. Atomically test and clear a bit.
  84. @param Bit Bit index to test in *Address
  85. @param Address The Address to the buffer that contain the bit to test.
  86. @return Value of the Bit before it was cleared.
  87. **/
  88. INT32
  89. EFIAPI
  90. TestAndClearBit (
  91. IN INT32 Bit,
  92. IN VOID *Address
  93. );
  94. CHAR8 *
  95. AsciiStrDup (
  96. IN CONST CHAR8 *Str
  97. );
  98. #endif