Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

210 lines
7.0 KiB

  1. /*++
  2. Copyright (c) 1999, 2000 Microsoft Corporation
  3. Module Name:
  4. mpinit.c
  5. Abstract:
  6. miniport initialization
  7. Environment:
  8. kernel mode only
  9. Notes:
  10. THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  11. KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  12. IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  13. PURPOSE.
  14. Copyright (c) 1999, 2000 Microsoft Corporation. All Rights Reserved.
  15. Revision History:
  16. 2-19-99 : created, jdunn
  17. --*/
  18. #include "common.h"
  19. // global registration packet for this miniport
  20. USBPORT_REGISTRATION_PACKET RegistrationPacket;
  21. NTSTATUS
  22. DriverEntry(
  23. PDRIVER_OBJECT DriverObject,
  24. PUNICODE_STRING RegistryPath
  25. )
  26. /*++
  27. Routine Description:
  28. Installable driver initialization entry point.
  29. This entry point is called directly by the I/O system.
  30. Arguments:
  31. DriverObject - pointer to the driver object
  32. RegistryPath - pointer to a unicode string representing the path
  33. to driver-specific key in the registry
  34. Return Value:
  35. STATUS_SUCCESS if successful,
  36. STATUS_UNSUCCESSFUL otherwise
  37. --*/
  38. {
  39. ULONG mn;
  40. mn = USBPORT_GetHciMn();
  41. if (mn != USB_HCI_MN) {
  42. TEST_TRAP();
  43. return STATUS_UNSUCCESSFUL;
  44. }
  45. RegistrationPacket.DeviceDataSize =
  46. sizeof(DEVICE_DATA);
  47. RegistrationPacket.EndpointDataSize =
  48. sizeof(ENDPOINT_DATA);
  49. RegistrationPacket.TransferContextSize =
  50. sizeof(TRANSFER_CONTEXT);
  51. // enough for 4k frame list plus 4k of scratch space
  52. // plus static queue head table
  53. // plus 1024 'dummy' queue heads
  54. RegistrationPacket.CommonBufferBytes = 8192 +
  55. (sizeof(HCD_QUEUEHEAD_DESCRIPTOR) * 64) +
  56. (sizeof(HCD_QUEUEHEAD_DESCRIPTOR) *1024);
  57. RegistrationPacket.MINIPORT_StartController =
  58. EHCI_StartController;
  59. RegistrationPacket.MINIPORT_StopController =
  60. EHCI_StopController;
  61. RegistrationPacket.MINIPORT_SuspendController =
  62. EHCI_SuspendController;
  63. RegistrationPacket.MINIPORT_ResumeController =
  64. EHCI_ResumeController;
  65. RegistrationPacket.MINIPORT_EnableInterrupts =
  66. EHCI_EnableInterrupts;
  67. RegistrationPacket.MINIPORT_DisableInterrupts =
  68. EHCI_DisableInterrupts;
  69. RegistrationPacket.MINIPORT_InterruptService =
  70. EHCI_InterruptService;
  71. // root hub functions
  72. RegistrationPacket.MINIPORT_RH_DisableIrq =
  73. EHCI_RH_DisableIrq;
  74. RegistrationPacket.MINIPORT_RH_EnableIrq =
  75. EHCI_RH_EnableIrq;
  76. RegistrationPacket.MINIPORT_RH_GetRootHubData =
  77. EHCI_RH_GetRootHubData;
  78. RegistrationPacket.MINIPORT_RH_GetStatus =
  79. EHCI_RH_GetStatus;
  80. RegistrationPacket.MINIPORT_RH_GetHubStatus =
  81. EHCI_RH_GetHubStatus;
  82. RegistrationPacket.MINIPORT_RH_GetPortStatus =
  83. EHCI_RH_GetPortStatus;
  84. RegistrationPacket.MINIPORT_RH_SetFeaturePortReset =
  85. EHCI_RH_SetFeaturePortReset;
  86. RegistrationPacket.MINIPORT_RH_SetFeaturePortPower =
  87. EHCI_RH_SetFeaturePortPower;
  88. RegistrationPacket.MINIPORT_RH_SetFeaturePortEnable =
  89. EHCI_RH_SetFeaturePortEnable;
  90. RegistrationPacket.MINIPORT_RH_SetFeaturePortSuspend =
  91. EHCI_RH_SetFeaturePortSuspend;
  92. RegistrationPacket.MINIPORT_RH_ClearFeaturePortEnable =
  93. EHCI_RH_ClearFeaturePortEnable;
  94. RegistrationPacket.MINIPORT_RH_ClearFeaturePortPower =
  95. EHCI_RH_ClearFeaturePortPower;
  96. RegistrationPacket.MINIPORT_RH_ClearFeaturePortSuspend =
  97. EHCI_RH_ClearFeaturePortSuspend;
  98. RegistrationPacket.MINIPORT_RH_ClearFeaturePortEnableChange =
  99. EHCI_RH_ClearFeaturePortEnableChange;
  100. RegistrationPacket.MINIPORT_RH_ClearFeaturePortConnectChange =
  101. EHCI_RH_ClearFeaturePortConnectChange;
  102. RegistrationPacket.MINIPORT_RH_ClearFeaturePortResetChange =
  103. EHCI_RH_ClearFeaturePortResetChange;
  104. RegistrationPacket.MINIPORT_RH_ClearFeaturePortSuspendChange =
  105. EHCI_RH_ClearFeaturePortSuspendChange;
  106. RegistrationPacket.MINIPORT_RH_ClearFeaturePortOvercurrentChange =
  107. EHCI_RH_ClearFeaturePortOvercurrentChange;
  108. RegistrationPacket.MINIPORT_SetEndpointStatus =
  109. EHCI_SetEndpointStatus;
  110. RegistrationPacket.MINIPORT_GetEndpointStatus =
  111. EHCI_GetEndpointStatus;
  112. RegistrationPacket.MINIPORT_SetEndpointDataToggle =
  113. EHCI_SetEndpointDataToggle;
  114. RegistrationPacket.MINIPORT_OpenEndpoint =
  115. EHCI_OpenEndpoint;
  116. RegistrationPacket.MINIPORT_PokeEndpoint =
  117. EHCI_PokeEndpoint;
  118. RegistrationPacket.MINIPORT_QueryEndpointRequirements =
  119. EHCI_QueryEndpointRequirements;
  120. RegistrationPacket.MINIPORT_CloseEndpoint =
  121. EHCI_CloseEndpoint;
  122. RegistrationPacket.MINIPORT_PollEndpoint =
  123. EHCI_PollEndpoint;
  124. RegistrationPacket.MINIPORT_SetEndpointState =
  125. EHCI_SetEndpointState;
  126. RegistrationPacket.MINIPORT_GetEndpointState =
  127. EHCI_GetEndpointState;
  128. RegistrationPacket.MINIPORT_Get32BitFrameNumber =
  129. EHCI_Get32BitFrameNumber;
  130. RegistrationPacket.MINIPORT_PollController =
  131. EHCI_PollController;
  132. RegistrationPacket.MINIPORT_CheckController =
  133. EHCI_CheckController;
  134. RegistrationPacket.MINIPORT_InterruptNextSOF =
  135. EHCI_InterruptNextSOF;
  136. RegistrationPacket.MINIPORT_SubmitTransfer =
  137. EHCI_SubmitTransfer;
  138. RegistrationPacket.MINIPORT_InterruptDpc =
  139. EHCI_InterruptDpc;
  140. RegistrationPacket.MINIPORT_AbortTransfer =
  141. EHCI_AbortTransfer;
  142. RegistrationPacket.MINIPORT_StartSendOnePacket =
  143. EHCI_StartSendOnePacket;
  144. RegistrationPacket.MINIPORT_EndSendOnePacket =
  145. EHCI_EndSendOnePacket;
  146. RegistrationPacket.MINIPORT_PassThru =
  147. EHCI_PassThru;
  148. RegistrationPacket.MINIPORT_SubmitIsoTransfer =
  149. EHCI_SubmitIsoTransfer;
  150. RegistrationPacket.MINIPORT_RebalanceEndpoint =
  151. EHCI_RebalanceEndpoint;
  152. RegistrationPacket.MINIPORT_FlushInterrupts =
  153. EHCI_FlushInterrupts;
  154. RegistrationPacket.MINIPORT_Chirp_RH_Port =
  155. EHCI_RH_ChirpRootPort;
  156. RegistrationPacket.MINIPORT_TakePortControl =
  157. EHCI_TakePortControl;
  158. RegistrationPacket.OptionFlags = USB_MINIPORT_OPT_NEED_IRQ |
  159. USB_MINIPORT_OPT_NEED_MEMORY |
  160. USB_MINIPORT_OPT_USB20 |
  161. // disable ss sometimes for testing
  162. // USB_MINIPORT_OPT_NO_SS |
  163. USB_MINIPORT_OPT_POLL_CONTROLLER;
  164. RegistrationPacket.HciType = USB_EHCI;
  165. RegistrationPacket.BusBandwidth = USB_20_BUS_BANDWIDTH;
  166. DriverObject->DriverUnload = NULL;
  167. return USBPORT_RegisterUSBPortDriver(
  168. DriverObject,
  169. USB_MINIPORT_HCI_VERSION_2,
  170. &RegistrationPacket);
  171. }