ehcidbg.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. /*++
  2. Copyright (c) 2014 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. ehcidbg.h
  5. Abstract:
  6. This header contains definitions for supporting EHCI as a debug host
  7. controller.
  8. Author:
  9. Evan Green 17-Apr-2014
  10. --*/
  11. //
  12. // ------------------------------------------------------------------- Includes
  13. //
  14. //
  15. // ---------------------------------------------------------------- Definitions
  16. //
  17. #define EHCI_DEBUG_ALLOCATION_TAG 0x44636845 // 'DchE'
  18. //
  19. // Define the amount of uncached memory the EHCI debug device needs for
  20. // queue heads, transfer descriptors, and transfer data.
  21. //
  22. #define EHCI_MEMORY_ALLOCATION_SIZE 0x1000
  23. //
  24. // Define the amount of time to wait for a synchronous transfer to complete,
  25. // in milliseconds.
  26. //
  27. #define EHCI_SYNCHRONOUS_TIMEOUT (1024 * 5)
  28. //
  29. // Define the maximum number of simultaneous EHCI transfers.
  30. //
  31. #define EHCI_DEBUG_TRANSFER_COUNT 2
  32. //
  33. // Define the alignment for EHCI descriptors in debug mode that ensures
  34. // data structures will never cross 4K boundaries.
  35. //
  36. #define EHCI_DEBUG_LINK_ALIGNMENT 64
  37. //
  38. // ------------------------------------------------------ Data Type Definitions
  39. //
  40. /*++
  41. Structure Description:
  42. This structure stores the information required to hand off primary
  43. control of the debug device to the real EHCI driver.
  44. Members:
  45. ReclamationQueue - Stores a pointer to the reclamation queue head. The
  46. debugger places its transfer queue heads after this queue.
  47. ReclamationQueuePhysical - Stores the physical address of the reclamation
  48. queue head.
  49. EndQueue - Stores a pointer to an empty unused queue head. The debugger
  50. places all its queue heads before this queue head, so if EHCI gets
  51. interrupted anywhere in the queue head removal process the debugger
  52. won't point new queue heads at the queue head EHCI is trying to remove.
  53. EndQueuePhysical - Stores the physical address of the end queue head.
  54. --*/
  55. typedef struct _EHCI_DEBUG_HANDOFF_DATA {
  56. PEHCI_QUEUE_HEAD ReclamationQueue;
  57. PHYSICAL_ADDRESS ReclamationQueuePhysical;
  58. PEHCI_QUEUE_HEAD EndQueue;
  59. PHYSICAL_ADDRESS EndQueuePhysical;
  60. } EHCI_DEBUG_HANDOFF_DATA, *PEHCI_DEBUG_HANDOFF_DATA;
  61. /*++
  62. Structure Description:
  63. This structure stores the context for an EHCI debug transport.
  64. Members:
  65. Queue - Stores the transfer queue head.
  66. QueuePhysical - Stores the physical address of the transfer queue
  67. head.
  68. Buffer - Stores the buffer that gets chopped up into transfer descriptors
  69. and data.
  70. BufferPhysical - Stores the physical address of the transfer buffer.
  71. BufferSize - Stores the size of the transfer buffer in bytes.
  72. Allocated - Stores a boolean indicating if the transfer buffer is in use.
  73. CheckIndex - Stores the index of the next transfer to check.
  74. --*/
  75. typedef struct _EHCI_DEBUG_TRANSFER {
  76. PEHCI_QUEUE_HEAD Queue;
  77. PHYSICAL_ADDRESS QueuePhysical;
  78. PVOID Buffer;
  79. PHYSICAL_ADDRESS BufferPhysical;
  80. ULONG BufferSize;
  81. BOOL Allocated;
  82. ULONG CheckIndex;
  83. } EHCI_DEBUG_TRANSFER, *PEHCI_DEBUG_TRANSFER;
  84. /*++
  85. Structure Description:
  86. This structure stores the context for an EHCI debug transport.
  87. Members:
  88. RegisterBase - Stores the virtual address of the EHCI registers.
  89. OperationalBase - Stores the base of the operational registers.
  90. PortCount - Stores the number of ports in the controller.
  91. HandoffComplete - Stores a boolean indicating whether or not the handoff
  92. to the real driver has occurred.
  93. Data - Stores the handoff data.
  94. Transfers - Stores the array of transfers that can be allocated.
  95. --*/
  96. typedef struct _EHCI_DEBUG_DEVICE {
  97. PVOID RegisterBase;
  98. PVOID OperationalBase;
  99. ULONG PortCount;
  100. BOOL HandoffComplete;
  101. EHCI_DEBUG_HANDOFF_DATA Data;
  102. EHCI_DEBUG_TRANSFER Transfers[EHCI_DEBUG_TRANSFER_COUNT];
  103. } EHCI_DEBUG_DEVICE, *PEHCI_DEBUG_DEVICE;
  104. /*++
  105. Structure Description:
  106. This structure stores the context for an EHCI debug transport.
  107. Members:
  108. Descriptor - Stores the hardware defined transfer descriptor.
  109. TransferLength - Stores the length of this transfer descriptor.
  110. --*/
  111. typedef struct _EHCI_DEBUG_TRANSFER_DESCRIPTOR {
  112. EHCI_TRANSFER_DESCRIPTOR Descriptor;
  113. ULONG TransferLength;
  114. } EHCI_DEBUG_TRANSFER_DESCRIPTOR, *PEHCI_DEBUG_TRANSFER_DESCRIPTOR;
  115. //
  116. // -------------------------------------------------------------------- Globals
  117. //
  118. //
  119. // -------------------------------------------------------- Function Prototypes
  120. //