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.

156 lines
6.2 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. 7-17-00 : copied, jsenior
  17. --*/
  18. #include "pch.h"
  19. // global registration packet for this miniport
  20. USBPORT_REGISTRATION_PACKET RegistrationPacket;
  21. NTSTATUS
  22. DriverEntry(
  23. IN PDRIVER_OBJECT DriverObject,
  24. IN 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. RegistrationPacket.DeviceDataSize = sizeof(DEVICE_DATA);
  40. RegistrationPacket.EndpointDataSize = sizeof(ENDPOINT_DATA);
  41. RegistrationPacket.TransferContextSize = sizeof(TRANSFER_CONTEXT);
  42. // enough for 4k frame list plus 4k of scratch space
  43. // enough for 4k frame list and interrupt schdule (63 nodes)
  44. // + static bulk + static control + pixx4 hack queue heads
  45. // this ends up being about 3 pages
  46. RegistrationPacket.CommonBufferBytes = 4096 +
  47. ((NO_INTERRUPT_QH_LISTS + 3) * sizeof(HCD_QUEUEHEAD_DESCRIPTOR)) + \
  48. (SOF_TD_COUNT * sizeof(HCD_TRANSFER_DESCRIPTOR));
  49. RegistrationPacket.MINIPORT_StartController = UhciStartController;
  50. RegistrationPacket.MINIPORT_StopController = UhciStopController;
  51. RegistrationPacket.MINIPORT_EnableInterrupts = UhciEnableInterrupts;
  52. RegistrationPacket.MINIPORT_DisableInterrupts = UhciDisableInterrupts;
  53. RegistrationPacket.MINIPORT_InterruptService = UhciInterruptService;
  54. RegistrationPacket.MINIPORT_InterruptDpc = UhciInterruptDpc;
  55. RegistrationPacket.MINIPORT_SuspendController = UhciSuspendController;
  56. RegistrationPacket.MINIPORT_ResumeController = UhciResumeController;
  57. //
  58. // Root hub control entry points
  59. //
  60. RegistrationPacket.MINIPORT_RH_DisableIrq = UhciRHDisableIrq;
  61. RegistrationPacket.MINIPORT_RH_EnableIrq = UhciRHEnableIrq;
  62. RegistrationPacket.MINIPORT_RH_GetRootHubData = UhciRHGetRootHubData;
  63. RegistrationPacket.MINIPORT_RH_GetStatus = UhciRHGetStatus;
  64. RegistrationPacket.MINIPORT_RH_GetHubStatus = UhciRHGetHubStatus;
  65. RegistrationPacket.MINIPORT_RH_GetPortStatus = UhciRHGetPortStatus;
  66. //
  67. // Individual root hub port entry points
  68. //
  69. RegistrationPacket.MINIPORT_RH_SetFeaturePortReset = UhciRHSetFeaturePortReset;
  70. RegistrationPacket.MINIPORT_RH_SetFeaturePortEnable = UhciRHSetFeaturePortEnable;
  71. RegistrationPacket.MINIPORT_RH_SetFeaturePortPower = UhciRHSetFeaturePortPower;
  72. RegistrationPacket.MINIPORT_RH_SetFeaturePortSuspend = UhciRHSetFeaturePortSuspend;
  73. RegistrationPacket.MINIPORT_RH_ClearFeaturePortSuspend = UhciRHClearFeaturePortSuspend;
  74. RegistrationPacket.MINIPORT_RH_ClearFeaturePortEnable = UhciRHClearFeaturePortEnable;
  75. RegistrationPacket.MINIPORT_RH_ClearFeaturePortPower = UhciRHClearFeaturePortPower;
  76. // Change bits
  77. RegistrationPacket.MINIPORT_RH_ClearFeaturePortConnectChange = UhciRHClearFeaturePortConnectChange;
  78. RegistrationPacket.MINIPORT_RH_ClearFeaturePortResetChange = UhciRHClearFeaturePortResetChange;
  79. RegistrationPacket.MINIPORT_RH_ClearFeaturePortEnableChange = UhciRHClearFeaturePortEnableChange;
  80. RegistrationPacket.MINIPORT_RH_ClearFeaturePortSuspendChange = UhciRHClearFeaturePortSuspendChange;
  81. RegistrationPacket.MINIPORT_RH_ClearFeaturePortOvercurrentChange = UhciRHClearFeaturePortOvercurrentChange;
  82. RegistrationPacket.MINIPORT_SetEndpointStatus = UhciSetEndpointStatus;
  83. RegistrationPacket.MINIPORT_GetEndpointStatus = UhciGetEndpointStatus;
  84. RegistrationPacket.MINIPORT_SetEndpointDataToggle = UhciSetEndpointDataToggle;
  85. RegistrationPacket.MINIPORT_OpenEndpoint = UhciOpenEndpoint;
  86. RegistrationPacket.MINIPORT_PokeEndpoint = UhciPokeEndpoint;
  87. RegistrationPacket.MINIPORT_QueryEndpointRequirements = UhciQueryEndpointRequirements;
  88. RegistrationPacket.MINIPORT_CloseEndpoint = UhciCloseEndpoint;
  89. RegistrationPacket.MINIPORT_PollEndpoint = UhciPollEndpoint;
  90. RegistrationPacket.MINIPORT_SetEndpointState = UhciSetEndpointState;
  91. RegistrationPacket.MINIPORT_GetEndpointState = UhciGetEndpointState;
  92. RegistrationPacket.MINIPORT_Get32BitFrameNumber = UhciGet32BitFrameNumber;
  93. RegistrationPacket.MINIPORT_PollController = UhciPollController;
  94. RegistrationPacket.MINIPORT_CheckController = UhciCheckController;
  95. RegistrationPacket.MINIPORT_InterruptNextSOF = UhciInterruptNextSOF;
  96. RegistrationPacket.MINIPORT_SubmitTransfer = UhciSubmitTransfer;
  97. RegistrationPacket.MINIPORT_SubmitIsoTransfer = UhciIsochTransfer;
  98. RegistrationPacket.MINIPORT_AbortTransfer = UhciAbortTransfer;
  99. RegistrationPacket.MINIPORT_StartSendOnePacket = UhciStartSendOnePacket;
  100. RegistrationPacket.MINIPORT_EndSendOnePacket = UhciEndSendOnePacket;
  101. RegistrationPacket.MINIPORT_PassThru = UhciPassThru;
  102. RegistrationPacket.MINIPORT_FlushInterrupts = UhciFlushInterrupts;
  103. RegistrationPacket.OptionFlags = USB_MINIPORT_OPT_NEED_IRQ |
  104. USB_MINIPORT_OPT_NEED_IOPORT |
  105. USB_MINIPORT_OPT_NO_IRQ_SYNC |
  106. //USB_MINIPORT_OPT_POLL_IN_SUSPEND |
  107. USB_MINIPORT_OPT_POLL_CONTROLLER;
  108. //
  109. // UHCI controller
  110. //
  111. RegistrationPacket.HciType = USB_UHCI;
  112. RegistrationPacket.BusBandwidth = USB_11_BUS_BANDWIDTH;
  113. DriverObject->DriverUnload = NULL;
  114. return USBPORT_RegisterUSBPortDriver(
  115. DriverObject,
  116. USB_MINIPORT_HCI_VERSION,
  117. &RegistrationPacket);
  118. }