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.

1247 lines
29 KiB

  1. /*++
  2. Copyright (c) 1999, 2000 Microsoft Corporation
  3. Module Name:
  4. usbehci.h
  5. Abstract:
  6. Environment:
  7. Kernel & user mode
  8. Revision History:
  9. 1-1-00 : created
  10. --*/
  11. #ifndef __EHCI_H__
  12. #define __EHCI_H__
  13. #define NO_EXP_DATE
  14. #define MASK_CHANGE_BITS(p)\
  15. do {\
  16. (p).OvercurrentChange = 0;\
  17. (p).PortEnableChange = 0;\
  18. (p).PortConnectChange = 0;\
  19. } while (0);
  20. /*
  21. define some known busted hardware types
  22. */
  23. #define AGERE(dd) ((dd)->Vid == 0x11c1 && (dd)->Dev == 0x5805) ? TRUE : FALSE
  24. //#define LUCENT(dd) ((dd)->ControllerFlavor == EHCI_Lucent) ? TRUE : FALSE
  25. #define NEC(dd) ((dd)->ControllerFlavor == EHCI_NEC) ? TRUE : FALSE
  26. #define MU_960(dd) ((dd)->ControllerFlavor == EHCI_960MUlator) ? TRUE : FALSE
  27. /*
  28. define resource consumption for endpoints types
  29. */
  30. #define T_256K 0x00040000
  31. #define T_64K 0x00010000
  32. #define T_4K 0x00001000
  33. #define T_4MB 0x00400000
  34. // Control:
  35. // largest possible transfer for control is 64k
  36. // therefore we support up to 2 transfers of this
  37. // size in HW. Most control transfers are much
  38. // smaller than this.
  39. // NOTE: we MUST support at least one 64k transfer in
  40. // HW since a single control transfer cannot be
  41. // broken up.
  42. #define MAX_CONTROL_TRANSFER_SIZE T_64K
  43. // worst case 64k control transfer 4 + status and
  44. // setup + dummy =
  45. #define TDS_PER_CONTROL_ENDPOINT 7
  46. // Bulk:
  47. #define MAX_BULK_TRANSFER_SIZE T_4MB
  48. // enough for 4 MB
  49. #define TDS_PER_BULK_ENDPOINT 210
  50. // Interrupt:
  51. #define MAX_INTERRUPT_TRANSFER_SIZE T_4K
  52. // enough for up to 4 4k transfers + dummy
  53. #define TDS_PER_INTERRUPT_ENDPOINT 5
  54. // Isochronous:
  55. #define MAX_ISO_TRANSFER_SIZE T_256K
  56. // 2 256 packet transfers *3k packet size, we can actually
  57. // handle more
  58. #define MAX_HSISO_TRANSFER_SIZE 0x00180000
  59. #define TDS_PER_ISO_ENDPOINT 32
  60. // default size of frame list
  61. #define USBEHCI_MAX_FRAME 1024
  62. /*
  63. Registry Keys
  64. */
  65. // Software Branch PDO Keys
  66. #define EN_IDLE_ENDPOINT_SUPPORT L"EnIdleEndpointSupport"
  67. // Hardware Branch PDO Keys
  68. // debug signatures
  69. #define SIG_HCD_IQH 'qi02'
  70. #define SIG_HCD_AQH 'qa02'
  71. #define SIG_HCD_QH 'hq02'
  72. #define SIG_HCD_DQH 'qd02'
  73. #define SIG_HCD_TD 'dt02'
  74. #define SIG_HCD_SITD 'dtIS'
  75. #define SIG_HCD_ITD 'dtIH'
  76. #define SIG_EP_DATA 'pe02'
  77. #define SIG_EHCI_TRANSFER 'rt02'
  78. #define SIG_EHCI_DD 'iche'
  79. #define SIG_DUMMY_QH 'hqmd'
  80. #undef PDEVICE_DATA
  81. typedef struct _TRANSFER_CONTEXT {
  82. ULONG Sig;
  83. ULONG PendingTds;
  84. PTRANSFER_PARAMETERS TransferParameters;
  85. USBD_STATUS UsbdStatus;
  86. ULONG BytesTransferred;
  87. ULONG XactErrCounter;
  88. // struct _HCD_TRANSFER_DESCRIPTOR *NextTransferTd;
  89. struct _ENDPOINT_DATA *EndpointData;
  90. //for ISO
  91. ULONG FrameComplete;
  92. LIST_ENTRY TransferLink;
  93. PMINIPORT_ISO_TRANSFER IsoTransfer;
  94. ULONG PendingPackets;
  95. ULONG PostedFrame;
  96. } TRANSFER_CONTEXT, *PTRANSFER_CONTEXT;
  97. // HCD Endpoint Descriptor (contains the HW descriptor)
  98. // values for HCD_QUEUEHEAD_DESCRIPTOR.Flags
  99. #define EHCI_QH_FLAG_IN_SCHEDULE 0x00000001
  100. #define EHCI_QH_FLAG_QH_REMOVED 0x00000002
  101. #define EHCI_QH_FLAG_STATIC 0x00000004
  102. #define EHCI_QH_FLAG_HIGHSPEED 0x00000008
  103. #define EHCI_QH_FLAG_UPDATING 0x00000010
  104. typedef struct _HCD_QUEUEHEAD_DESCRIPTOR {
  105. HW_QUEUEHEAD_DESCRIPTOR HwQH; // 40 dwords
  106. HW_32BIT_PHYSICAL_ADDRESS PhysicalAddress;
  107. ULONG Sig;
  108. ULONG QhFlags;
  109. ULONG Ordinal;
  110. ULONG Period;
  111. ULONG Reserved;
  112. MP_HW_POINTER EndpointData;
  113. //MP_HW_POINTER HcdTail;
  114. MP_HW_POINTER NextQh;
  115. MP_HW_POINTER PrevQh;
  116. MP_HW_POINTER NextLink;
  117. #ifdef _WIN64
  118. ULONG PadTo256[6];
  119. #else
  120. ULONG PadTo256[6];
  121. #endif
  122. } HCD_QUEUEHEAD_DESCRIPTOR, *PHCD_QUEUEHEAD_DESCRIPTOR;
  123. C_ASSERT((sizeof(HCD_QUEUEHEAD_DESCRIPTOR) == 160));
  124. //
  125. // HCD Transfer Descriptor (contains the HW descriptor)
  126. //
  127. #define ENDPOINT_DATA_PTR(p) ((struct _ENDPOINT_DATA *) (p).Pointer)
  128. #define TRANSFER_CONTEXT_PTR(p) ((struct _TRANSFER_CONTEXT *) (p).Pointer)
  129. #define TRANSFER_DESCRIPTOR_PTR(p) ((struct _HCD_TRANSFER_DESCRIPTOR *) (p).Pointer)
  130. #define QH_DESCRIPTOR_PTR(p) ((struct _HCD_QUEUEHEAD_DESCRIPTOR *) (p).Pointer)
  131. #define HW_PTR(p) ((UCHAR * ) (p).Pointer)
  132. #define ISO_PACKET_PTR(p) ((struct _MINIPORT_ISO_PACKET *) (p).Pointer)
  133. #define ISO_TRANSFER_PTR(p) ((struct _TRANSFER_CONTEXT *) (p).Pointer)
  134. // values for HCD_TRANSFER_DESCRIPTOR.Flags
  135. #define TD_FLAG_BUSY 0x00000001
  136. #define TD_FLAG_XFER 0x00000002
  137. //#define TD_FLAG_CONTROL_STATUS 0x00000004
  138. #define TD_FLAG_DONE 0x00000008
  139. #define TD_FLAG_SKIP 0x00000010
  140. #define TD_FLAG_DUMMY 0x00000020
  141. typedef struct _HCD_TRANSFER_DESCRIPTOR {
  142. HW_QUEUE_ELEMENT_TD HwTD; //64 (16 dwords)
  143. ULONG Sig;
  144. ULONG Flags;
  145. ULONG TransferLength;
  146. HW_32BIT_PHYSICAL_ADDRESS PhysicalAddress;
  147. UCHAR Packet[8]; // space for setup packet data
  148. MP_HW_POINTER EndpointData;
  149. MP_HW_POINTER TransferContext;
  150. MP_HW_POINTER NextHcdTD;
  151. MP_HW_POINTER AltNextHcdTD;
  152. LIST_ENTRY DoneLink;
  153. #ifdef _WIN64
  154. ULONG PadToX[30];
  155. #else
  156. ULONG PadToX[32];
  157. #endif
  158. } HCD_TRANSFER_DESCRIPTOR, *PHCD_TRANSFER_DESCRIPTOR;
  159. C_ASSERT((sizeof(HCD_TRANSFER_DESCRIPTOR) == 256));
  160. typedef struct _HCD_TD_LIST {
  161. HCD_TRANSFER_DESCRIPTOR Td[1];
  162. } HCD_TD_LIST, *PHCD_TD_LIST;
  163. /*
  164. Structures used for iso see iso.c
  165. */
  166. typedef struct _HCD_SI_TRANSFER_DESCRIPTOR {
  167. HW_SPLIT_ISOCHRONOUS_TD HwTD; //64 (16dwords)
  168. ULONG Sig;
  169. HW_32BIT_PHYSICAL_ADDRESS PhysicalAddress;
  170. ULONG StartOffset;
  171. ULONG Reserved;
  172. MP_HW_POINTER Packet;
  173. MP_HW_POINTER Transfer;
  174. MP_HW_POINTER NextLink;
  175. #ifdef _WIN64
  176. ULONG PadToX[6];
  177. #else
  178. ULONG PadToX[6];
  179. #endif
  180. } HCD_SI_TRANSFER_DESCRIPTOR, *PHCD_SI_TRANSFER_DESCRIPTOR;
  181. C_ASSERT((sizeof(HCD_SI_TRANSFER_DESCRIPTOR) == 128));
  182. typedef struct _HCD_SITD_LIST {
  183. HCD_SI_TRANSFER_DESCRIPTOR Td[1];
  184. } HCD_SITD_LIST, *PHCD_SITD_LIST;
  185. typedef struct _HCD_HSISO_TRANSFER_DESCRIPTOR {
  186. HW_ISOCHRONOUS_TD HwTD; // 128 (32dwords)
  187. ULONG Sig;
  188. HW_32BIT_PHYSICAL_ADDRESS PhysicalAddress;
  189. ULONG HostFrame;
  190. ULONG Reserved;
  191. MP_HW_POINTER FirstPacket;
  192. MP_HW_POINTER Transfer;
  193. MP_HW_POINTER NextLink;
  194. #ifdef _WIN64
  195. ULONG PadTo256[22];
  196. #else
  197. ULONG PadTo256[22];
  198. #endif
  199. } HCD_HSISO_TRANSFER_DESCRIPTOR, *PHCD_HSISO_TRANSFER_DESCRIPTOR;
  200. C_ASSERT((sizeof(HCD_HSISO_TRANSFER_DESCRIPTOR) == 256));
  201. typedef struct _HCD_HSISOTD_LIST {
  202. HCD_HSISO_TRANSFER_DESCRIPTOR Td[1];
  203. } HCD_HSISOTD_LIST, *PHCD_HSISOTD_LIST;
  204. /*
  205. Used for data structure that describes the interrupt
  206. schedule (see periodic.c)
  207. */
  208. typedef struct _PERIOD_TABLE {
  209. UCHAR Period;
  210. UCHAR qhIdx;
  211. UCHAR InterruptScheduleMask;
  212. } PERIOD_TABLE, *PPERIOD_TABLE;
  213. #define EHCI_EDFLAG_HALTED 0x00000001
  214. //#define EHCI_EDFLAG_FLUSHED 0x00000002
  215. #define EHCI_EDFLAG_NOHALT 0x00000004
  216. typedef struct _ENDPOINT_DATA {
  217. ULONG Sig;
  218. ENDPOINT_PARAMETERS Parameters;
  219. PHCD_QUEUEHEAD_DESCRIPTOR QueueHead;
  220. ULONG Flags;
  221. ULONG PendingTransfers;
  222. ULONG MaxPendingTransfers;
  223. // PHCD_TRANSFER_DESCRIPTOR HcdTailP;
  224. PHCD_TRANSFER_DESCRIPTOR HcdHeadP;
  225. PHCD_QUEUEHEAD_DESCRIPTOR StaticQH;
  226. PPERIOD_TABLE PeriodTableEntry;
  227. PHCD_TD_LIST TdList;
  228. PHCD_SITD_LIST SiTdList;
  229. PHCD_HSISOTD_LIST HsIsoTdList;
  230. ULONG TdCount;
  231. ULONG FreeTds;
  232. ULONG LastFrame;
  233. ULONG QhChkPhys;
  234. PVOID QhChk;
  235. LIST_ENTRY TransferList;
  236. LIST_ENTRY DoneTdList;
  237. MP_ENDPOINT_STATE State;
  238. struct _ENDPOINT_DATA *PrevEndpoint;
  239. struct _ENDPOINT_DATA *NextEndpoint;
  240. PHCD_TRANSFER_DESCRIPTOR DummyTd;
  241. // ULONG MaxErrorCount;
  242. } ENDPOINT_DATA, *PENDPOINT_DATA;
  243. // values for Flags field in DeviceData
  244. //#define EHCI_DD_FLAG_NOCHIRP 0x000000001
  245. #define EHCI_DD_EN_IDLE_EP_SUPPORT 0x000000002
  246. typedef struct _DEVICE_DATA {
  247. ULONG Sig;
  248. ULONG Flags;
  249. PHC_OPERATIONAL_REGISTER OperationalRegisters;
  250. PHC_CAPABILITIES_REGISTER CapabilitiesRegisters;
  251. USBINTR EnabledInterrupts;
  252. PHCD_QUEUEHEAD_DESCRIPTOR AsyncQueueHead;
  253. USB_CONTROLLER_FLAVOR ControllerFlavor;
  254. ULONG LastFrame;
  255. ULONG FrameNumberHighPart;
  256. ULONG PortResetChange;
  257. ULONG PortSuspendChange;
  258. ULONG PortConnectChange;
  259. ULONG PortPMChirp;
  260. ULONG IrqStatus;
  261. USHORT NumberOfPorts;
  262. USHORT PortPowerControl;
  263. PHCD_QUEUEHEAD_DESCRIPTOR LockPrevQh;
  264. PHCD_QUEUEHEAD_DESCRIPTOR LockNextQh;
  265. PHCD_QUEUEHEAD_DESCRIPTOR LockQh;
  266. // both these are used for non-chirping devices
  267. // port state masks
  268. //ULONG PortConnectState;
  269. ULONG HighSpeedDeviceAttached;
  270. PHCD_QUEUEHEAD_DESCRIPTOR StaticInterruptQH[65];
  271. PHW_32BIT_PHYSICAL_ADDRESS FrameListBaseAddress;
  272. HW_32BIT_PHYSICAL_ADDRESS FrameListBasePhys;
  273. PENDPOINT_DATA IsoEndpointListHead;
  274. PVOID DummyQueueHeads;
  275. HW_32BIT_PHYSICAL_ADDRESS DummyQueueHeadsPhys;
  276. ULONG PeriodicListBaseSave;
  277. ULONG AsyncListAddrSave;
  278. ULONG SegmentSelectorSave;
  279. USBCMD CmdSave;
  280. USHORT Vid;
  281. USHORT Dev;
  282. CONFIGFLAG LastConfigFlag;
  283. ULONG PendingControlAndBulk;
  284. // we only need this for older revs of usbport
  285. // that will call checkController after start fails
  286. BOOLEAN DeviceStarted;
  287. UCHAR SavedFladj;
  288. } DEVICE_DATA, *PDEVICE_DATA;
  289. /*
  290. Callouts to port driver services
  291. */
  292. extern USBPORT_REGISTRATION_PACKET RegistrationPacket;
  293. #define USBPORT_DBGPRINT(dd, l, f, arg0, arg1, arg2, arg3, arg4, arg5) \
  294. RegistrationPacket.USBPORTSVC_DbgPrint((dd), (l), (f), (arg0), (arg1), \
  295. (arg2), (arg3), (arg4), (arg5))
  296. #define USBPORT_GET_REGISTRY_KEY_VALUE(dd, branch, keystring, keylen, data, datalen) \
  297. RegistrationPacket.USBPORTSVC_GetMiniportRegistryKeyValue((dd), (branch), \
  298. (keystring), (keylen), (data), (datalen))
  299. #define USBPORT_INVALIDATE_ROOTHUB(dd) \
  300. RegistrationPacket.USBPORTSVC_InvalidateRootHub((dd));
  301. #define USBPORT_COMPLETE_TRANSFER(dd, ep, tp, status, length) \
  302. RegistrationPacket.USBPORTSVC_CompleteTransfer((dd), (ep), (tp), \
  303. (status), (length));
  304. #define USBPORT_INVALIDATE_ENDPOINT(dd, ep) \
  305. RegistrationPacket.USBPORTSVC_InvalidateEndpoint((dd), (ep));
  306. #define USBPORT_PHYSICAL_TO_VIRTUAL(addr, dd, ep) \
  307. RegistrationPacket.USBPORTSVC_MapHwPhysicalToVirtual((addr), (dd), (ep));
  308. #define USBPORT_INVALIDATE_ROOTHUB(dd) \
  309. RegistrationPacket.USBPORTSVC_InvalidateRootHub((dd));
  310. #define USBPORT_REQUEST_ASYNC_CALLBACK(dd, t, c, cl, f) \
  311. RegistrationPacket.USBPORTSVC_RequestAsyncCallback((dd), (t), \
  312. (c), (cl), (f));
  313. #define USBPORT_WAIT(dd, t) \
  314. RegistrationPacket.USBPORTSVC_Wait((dd), (t));
  315. #define USBPORT_BUGCHECK(dd) \
  316. RegistrationPacket.USBPORTSVC_BugCheck(dd)
  317. #define USBPORT_COMPLETE_ISO_TRANSFER(dd, ep, t, iso) \
  318. RegistrationPacket.USBPORTSVC_CompleteIsoTransfer((dd), (ep), (t), \
  319. (iso));
  320. #define USBPORT_INVALIDATE_CONTROLLER(dd, s) \
  321. RegistrationPacket.USBPORTSVC_InvalidateController((dd), (s))
  322. #define USBPORT_READ_CONFIG_SPACE(dd, b, o, l) \
  323. RegistrationPacket.USBPORTSVC_ReadWriteConfigSpace((dd), TRUE, \
  324. (b), (o), (l))
  325. #define USBPORT_WRITE_CONFIG_SPACE(dd, b, o, l) \
  326. RegistrationPacket.USBPORTSVC_ReadWriteConfigSpace((dd), FALSE, \
  327. (b), (o), (l))
  328. #ifdef _WIN64
  329. #define DUMMY_TD_CONTEXT ((PVOID) 0xABADBABEABADBABE)
  330. #else
  331. #define DUMMY_TD_CONTEXT ((PVOID) 0xABADBABE)
  332. #endif
  333. // note: we must initialize the low 12 bits of the
  334. // buffer page ptr to zero to the last three nipples
  335. // are 0
  336. #define INITIALIZE_TD_FOR_TRANSFER(td, tc) \
  337. { ULONG i;\
  338. TRANSFER_CONTEXT_PTR((td)->TransferContext) = (tc);\
  339. (td)->Flags |= TD_FLAG_XFER; \
  340. for (i=0; i<5; i++) {\
  341. (td)->HwTD.BufferPage[i].ul = 0x0bad0000;\
  342. }\
  343. (td)->HwTD.Next_qTD.HwAddress = EHCI_TERMINATE_BIT;\
  344. (td)->HwTD.AltNext_qTD.HwAddress = EHCI_TERMINATE_BIT;\
  345. (td)->HwTD.Token.ul = 0;\
  346. (td)->HwTD.Token.ErrorCounter = 3;\
  347. TRANSFER_DESCRIPTOR_PTR((td)->NextHcdTD) = NULL;\
  348. }
  349. #define SET_NEXT_TD(dd, linkTd, nextTd) \
  350. EHCI_SetNextTd((dd), (linkTd), (nextTd), FALSE)
  351. #define SET_ALTNEXT_TD(dd, linkTd, nextTd) \
  352. EHCI_SetAltNextTd((dd), (linkTd), (nextTd))
  353. #define SET_NEXT_AND_ALTNEXT_TD(dd, linkTd, nextTd) \
  354. EHCI_SetNextTd((dd), (linkTd), (nextTd), TRUE)
  355. #define SET_NEXT_TD_NULL(linkTd) \
  356. TRANSFER_DESCRIPTOR_PTR((linkTd)->NextHcdTD) = NULL;\
  357. TRANSFER_DESCRIPTOR_PTR((linkTd)->AltNextHcdTD) = NULL;\
  358. (linkTd)->HwTD.Next_qTD.HwAddress = EHCI_TERMINATE_BIT; \
  359. (linkTd)->HwTD.AltNext_qTD.HwAddress = EHCI_TERMINATE_BIT;
  360. #ifdef _WIN64
  361. #define FREE_TD_CONTEXT ((PVOID) 0xDEADFACEDEADFACE)
  362. #else
  363. #define FREE_TD_CONTEXT ((PVOID) 0xDEADFACE)
  364. #endif
  365. #define EHCI_FREE_TD(dd, ep, td) \
  366. (td)->Flags = 0;\
  367. (td)->HwTD.Next_qTD.HwAddress = 0;\
  368. (td)->HwTD.AltNext_qTD.HwAddress = 0;\
  369. (ep)->FreeTds++;\
  370. LOGENTRY((dd), G, '_fTD', (td), 0, 0);\
  371. TRANSFER_CONTEXT_PTR((td)->TransferContext) = FREE_TD_CONTEXT;
  372. #define EHCI_ALLOC_TD(dd, ep) EHCI_AllocTd((dd), (ep));
  373. #define TEST_BIT(value, bitNumber) ((value) & (1<<(bitNumber))) ? TRUE : FALSE
  374. #define SET_BIT(value, bitNumber) ((value) |= (1<<(bitNumber)))
  375. #define CLEAR_BIT(value, bitNumber) ((value) &= ~(1<<(bitNumber)))
  376. // assuming only one bit is set this macro returns that bit
  377. //
  378. #define GET_BIT_SET(d, bit) \
  379. { \
  380. UCHAR tmp = (d);\
  381. (bit)=0; \
  382. while (!(tmp & 0x01)) {\
  383. (bit)++;\
  384. tmp >>= 1;\
  385. };\
  386. }
  387. //
  388. // USBEHCI.C Function Prototypes
  389. //
  390. USB_MINIPORT_STATUS
  391. USBMPFN
  392. EHCI_StartController(
  393. PDEVICE_DATA DeviceData,
  394. PHC_RESOURCES HcResources
  395. );
  396. VOID
  397. USBMPFN
  398. EHCI_StopController(
  399. PDEVICE_DATA DeviceData,
  400. BOOLEAN HwPresent
  401. );
  402. USB_MINIPORT_STATUS
  403. EHCI_ResumeController(
  404. PDEVICE_DATA DeviceData
  405. );
  406. VOID
  407. EHCI_SuspendController(
  408. PDEVICE_DATA DeviceData
  409. );
  410. USB_MINIPORT_STATUS
  411. EHCI_OpenEndpoint(
  412. PDEVICE_DATA DeviceData,
  413. PENDPOINT_PARAMETERS EndpointParameters,
  414. PENDPOINT_DATA EndpointData
  415. );
  416. VOID
  417. EHCI_CloseEndpoint(
  418. PDEVICE_DATA DeviceData,
  419. PENDPOINT_DATA EndpointData
  420. );
  421. USB_MINIPORT_STATUS
  422. EHCI_PokeEndpoint(
  423. PDEVICE_DATA DeviceData,
  424. PENDPOINT_PARAMETERS EndpointParameters,
  425. PENDPOINT_DATA EndpointData
  426. );
  427. USB_MINIPORT_STATUS
  428. EHCI_QueryEndpointRequirements(
  429. PDEVICE_DATA DeviceData,
  430. PENDPOINT_PARAMETERS EndpointParameters,
  431. PENDPOINT_REQUIREMENTS EndpointRequirements
  432. );
  433. VOID
  434. EHCI_PollEndpoint(
  435. PDEVICE_DATA DeviceData,
  436. PENDPOINT_DATA EndpointData
  437. );
  438. PHCD_TRANSFER_DESCRIPTOR
  439. EHCI_AllocTd(
  440. PDEVICE_DATA DeviceData,
  441. PENDPOINT_DATA EndpointData
  442. );
  443. VOID
  444. EHCI_SetEndpointStatus(
  445. PDEVICE_DATA DeviceData,
  446. PENDPOINT_DATA EndpointData,
  447. MP_ENDPOINT_STATUS Status
  448. );
  449. MP_ENDPOINT_STATUS
  450. EHCI_GetEndpointStatus(
  451. PDEVICE_DATA DeviceData,
  452. PENDPOINT_DATA EndpointData
  453. );
  454. VOID
  455. EHCI_SetEndpointState(
  456. PDEVICE_DATA DeviceData,
  457. PENDPOINT_DATA EndpointData,
  458. MP_ENDPOINT_STATE State
  459. );
  460. MP_ENDPOINT_STATE
  461. EHCI_GetEndpointState(
  462. PDEVICE_DATA DeviceData,
  463. PENDPOINT_DATA EndpointData
  464. );
  465. VOID
  466. EHCI_PollController(
  467. PDEVICE_DATA DeviceData
  468. );
  469. USB_MINIPORT_STATUS
  470. EHCI_SubmitTransfer(
  471. PDEVICE_DATA DeviceData,
  472. PENDPOINT_DATA EndpointData,
  473. PTRANSFER_PARAMETERS TransferUrb,
  474. PTRANSFER_CONTEXT TransferContext,
  475. PTRANSFER_SG_LIST TransferSGList
  476. );
  477. VOID
  478. EHCI_AbortTransfer(
  479. PDEVICE_DATA DeviceData,
  480. PENDPOINT_DATA EndpointData,
  481. PTRANSFER_CONTEXT TransferContext,
  482. PULONG BytesTransferred
  483. );
  484. USB_MINIPORT_STATUS
  485. EHCI_PassThru (
  486. PDEVICE_DATA DeviceData,
  487. GUID *FunctionGuid,
  488. ULONG ParameterLength,
  489. PVOID Parameters
  490. );
  491. USB_MINIPORT_STATUS
  492. EHCI_RH_UsbprivRootPortStatus(
  493. PDEVICE_DATA DeviceData,
  494. ULONG ParameterLength,
  495. PVOID Parameters
  496. );
  497. VOID
  498. EHCI_SetEndpointDataToggle(
  499. PDEVICE_DATA DeviceData,
  500. PENDPOINT_DATA EndpointData,
  501. ULONG Toggle
  502. );
  503. //
  504. // ASYNC.C Function Prototypes
  505. //
  506. VOID
  507. EHCI_EnableAsyncList(
  508. PDEVICE_DATA DeviceData
  509. );
  510. VOID
  511. EHCI_DisableAsyncList(
  512. PDEVICE_DATA DeviceData
  513. );
  514. VOID
  515. USBMPFN
  516. EHCI_FlushInterrupts(
  517. PDEVICE_DATA DeviceData
  518. );
  519. PHCD_QUEUEHEAD_DESCRIPTOR
  520. EHCI_InitializeQH(
  521. PDEVICE_DATA DeviceData,
  522. PENDPOINT_DATA EndpointData,
  523. PHCD_QUEUEHEAD_DESCRIPTOR Qh,
  524. HW_32BIT_PHYSICAL_ADDRESS HwPhysAddress
  525. );
  526. PHCD_TRANSFER_DESCRIPTOR
  527. EHCI_InitializeTD(
  528. PDEVICE_DATA DeviceData,
  529. PENDPOINT_DATA EndpointData,
  530. PHCD_TRANSFER_DESCRIPTOR Td,
  531. HW_32BIT_PHYSICAL_ADDRESS HwPhysAddress
  532. );
  533. USB_MINIPORT_STATUS
  534. EHCI_ControlTransfer(
  535. PDEVICE_DATA DeviceData,
  536. PENDPOINT_DATA EndpointData,
  537. PTRANSFER_PARAMETERS TransferUrb,
  538. PTRANSFER_CONTEXT TransferContext,
  539. PTRANSFER_SG_LIST TransferSGList
  540. );
  541. USB_MINIPORT_STATUS
  542. EHCI_BulkTransfer(
  543. PDEVICE_DATA DeviceData,
  544. PENDPOINT_DATA EndpointData,
  545. PTRANSFER_PARAMETERS TransferUrb,
  546. PTRANSFER_CONTEXT TransferContext,
  547. PTRANSFER_SG_LIST TransferSGList
  548. );
  549. USB_MINIPORT_STATUS
  550. EHCI_OpenBulkOrControlEndpoint(
  551. PDEVICE_DATA DeviceData,
  552. BOOLEAN Control,
  553. PENDPOINT_PARAMETERS EndpointParameters,
  554. PENDPOINT_DATA EndpointData
  555. );
  556. VOID
  557. EHCI_InsertQueueHeadInAsyncList(
  558. PDEVICE_DATA DeviceData,
  559. PHCD_QUEUEHEAD_DESCRIPTOR Qh
  560. );
  561. VOID
  562. EHCI_RemoveQueueHeadFromAsyncList(
  563. PDEVICE_DATA DeviceData,
  564. PHCD_QUEUEHEAD_DESCRIPTOR Qh
  565. );
  566. ULONG
  567. EHCI_MapAsyncTransferToTd(
  568. PDEVICE_DATA DeviceData,
  569. ULONG MaxPacketSize,
  570. ULONG LengthMapped,
  571. PULONG NextToggle,
  572. PTRANSFER_CONTEXT TransferContext,
  573. PHCD_TRANSFER_DESCRIPTOR Td,
  574. PTRANSFER_SG_LIST SgList
  575. );
  576. VOID
  577. EHCI_SetAsyncEndpointState(
  578. PDEVICE_DATA DeviceData,
  579. PENDPOINT_DATA EndpointData,
  580. MP_ENDPOINT_STATE State
  581. );
  582. VOID
  583. EHCI_ProcessDoneAsyncTd(
  584. PDEVICE_DATA DeviceData,
  585. PHCD_TRANSFER_DESCRIPTOR Td
  586. );
  587. USBD_STATUS
  588. EHCI_GetErrorFromTD(
  589. PDEVICE_DATA DeviceData,
  590. PENDPOINT_DATA EndpointData,
  591. PHCD_TRANSFER_DESCRIPTOR Td
  592. );
  593. VOID
  594. EHCI_AbortAsyncTransfer(
  595. PDEVICE_DATA DeviceData,
  596. PENDPOINT_DATA EndpointData,
  597. PTRANSFER_CONTEXT TransferContext
  598. );
  599. //
  600. // INT.C Function Prototypes
  601. //
  602. BOOLEAN
  603. EHCI_InterruptService (
  604. PDEVICE_DATA DeviceData
  605. );
  606. VOID
  607. EHCI_InterruptDpc (
  608. PDEVICE_DATA DeviceData,
  609. BOOLEAN EnableInterrupts
  610. );
  611. VOID
  612. USBMPFN
  613. EHCI_DisableInterrupts(
  614. PDEVICE_DATA DeviceData
  615. );
  616. VOID
  617. USBMPFN
  618. EHCI_EnableInterrupts(
  619. PDEVICE_DATA DeviceData
  620. );
  621. VOID
  622. EHCI_RH_DisableIrq(
  623. PDEVICE_DATA DeviceData
  624. );
  625. VOID
  626. EHCI_RH_EnableIrq(
  627. PDEVICE_DATA DeviceData
  628. );
  629. VOID
  630. EHCI_InterruptNextSOF(
  631. PDEVICE_DATA DeviceData
  632. );
  633. ULONG
  634. EHCI_Get32BitFrameNumber(
  635. PDEVICE_DATA DeviceData
  636. );
  637. //
  638. // PERIODIC.C Function Prototypes
  639. //
  640. USB_MINIPORT_STATUS
  641. EHCI_OpenInterruptEndpoint(
  642. PDEVICE_DATA DeviceData,
  643. PENDPOINT_PARAMETERS EndpointParameters,
  644. PENDPOINT_DATA EndpointData
  645. );
  646. VOID
  647. EHCI_InsertQueueHeadInPeriodicList(
  648. PDEVICE_DATA DeviceData,
  649. PENDPOINT_DATA EndpointData
  650. );
  651. VOID
  652. EHCI_RemoveQueueHeadFromPeriodicList(
  653. PDEVICE_DATA DeviceData,
  654. PENDPOINT_DATA EndpointData
  655. );
  656. USB_MINIPORT_STATUS
  657. EHCI_InterruptTransfer(
  658. PDEVICE_DATA DeviceData,
  659. PENDPOINT_DATA EndpointData,
  660. PTRANSFER_PARAMETERS TransferUrb,
  661. PTRANSFER_CONTEXT TransferContext,
  662. PTRANSFER_SG_LIST TransferSGList
  663. );
  664. PHCD_QUEUEHEAD_DESCRIPTOR
  665. EHCI_GetQueueHeadForFrame(
  666. PDEVICE_DATA DeviceData,
  667. ULONG Frame
  668. );
  669. VOID
  670. EHCI_InitailizeInterruptSchedule(
  671. PDEVICE_DATA DeviceData
  672. );
  673. VOID
  674. EHCI_ComputeClassicBudget(
  675. PDEVICE_DATA DeviceData,
  676. PENDPOINT_DATA EndpointData,
  677. PUCHAR sMask,
  678. PUCHAR cMask
  679. );
  680. //
  681. // ROOTHUB.C Function Prototypes
  682. //
  683. VOID
  684. EHCI_RH_GetRootHubData(
  685. PDEVICE_DATA DeviceData,
  686. PROOTHUB_DATA HubData
  687. );
  688. USB_MINIPORT_STATUS
  689. EHCI_RH_GetStatus(
  690. PDEVICE_DATA DeviceData,
  691. PUSHORT Status
  692. );
  693. USB_MINIPORT_STATUS
  694. EHCI_RH_GetPortStatus(
  695. PDEVICE_DATA DeviceData,
  696. USHORT PortNumber,
  697. PRH_PORT_STATUS portStatus
  698. );
  699. USB_MINIPORT_STATUS
  700. EHCI_RH_GetHubStatus(
  701. PDEVICE_DATA DeviceData,
  702. OUT PRH_HUB_STATUS HubStatus
  703. );
  704. USB_MINIPORT_STATUS
  705. EHCI_RH_SetFeaturePortReset(
  706. PDEVICE_DATA DeviceData,
  707. USHORT PortNumber
  708. );
  709. USB_MINIPORT_STATUS
  710. EHCI_RH_SetFeaturePortPower(
  711. PDEVICE_DATA DeviceData,
  712. USHORT PortNumber
  713. );
  714. USB_MINIPORT_STATUS
  715. EHCI_RH_SetFeaturePortEnable(
  716. PDEVICE_DATA DeviceData,
  717. USHORT PortNumber
  718. );
  719. VOID
  720. EHCI_RH_PortResetComplete(
  721. PDEVICE_DATA DeviceData,
  722. PVOID Context
  723. );
  724. USB_MINIPORT_STATUS
  725. EHCI_RH_SetFeaturePortSuspend(
  726. PDEVICE_DATA DeviceData,
  727. USHORT PortNumber
  728. );
  729. VOID
  730. EHCI_CheckController(
  731. PDEVICE_DATA DeviceData
  732. );
  733. USB_MINIPORT_STATUS
  734. EHCI_RH_ClearFeaturePortEnable(
  735. PDEVICE_DATA DeviceData,
  736. USHORT PortNumber
  737. );
  738. USB_MINIPORT_STATUS
  739. EHCI_RH_ClearFeaturePortPower(
  740. PDEVICE_DATA DeviceData,
  741. USHORT PortNumber
  742. );
  743. USB_MINIPORT_STATUS
  744. EHCI_RH_ClearFeaturePortSuspend (
  745. PDEVICE_DATA DeviceData,
  746. USHORT PortNumber
  747. );
  748. USB_MINIPORT_STATUS
  749. EHCI_RH_ClearFeaturePortEnableChange(
  750. PDEVICE_DATA DeviceData,
  751. USHORT PortNumber
  752. );
  753. USB_MINIPORT_STATUS
  754. EHCI_RH_ClearFeaturePortConnectChange(
  755. PDEVICE_DATA DeviceData,
  756. USHORT PortNumber
  757. );
  758. USB_MINIPORT_STATUS
  759. EHCI_RH_ClearFeaturePortResetChange(
  760. PDEVICE_DATA DeviceData,
  761. USHORT PortNumber
  762. );
  763. USB_MINIPORT_STATUS
  764. EHCI_RH_ClearFeaturePortSuspendChange (
  765. PDEVICE_DATA DeviceData,
  766. USHORT PortNumber
  767. );
  768. USB_MINIPORT_STATUS
  769. EHCI_RH_ClearFeaturePortOvercurrentChange (
  770. PDEVICE_DATA DeviceData,
  771. USHORT PortNumber
  772. );
  773. VOID
  774. EHCI_OptumtuseratePort(
  775. PDEVICE_DATA DeviceData,
  776. USHORT PortNumber
  777. );
  778. //
  779. // SSTOOL.C Function Prototypes
  780. //
  781. USB_MINIPORT_STATUS
  782. USBMPFN
  783. EHCI_StartSendOnePacket(
  784. PDEVICE_DATA DeviceData,
  785. PMP_PACKET_PARAMETERS PacketParameters,
  786. PUCHAR PacketData,
  787. PULONG PacketLength,
  788. PUCHAR WorkspaceVirtualAddress,
  789. HW_32BIT_PHYSICAL_ADDRESS WorkspacePhysicalAddress,
  790. ULONG WorkSpaceLength,
  791. USBD_STATUS *UsbdStatus
  792. );
  793. USB_MINIPORT_STATUS
  794. USBMPFN
  795. EHCI_EndSendOnePacket(
  796. PDEVICE_DATA DeviceData,
  797. PMP_PACKET_PARAMETERS PacketParameters,
  798. PUCHAR PacketData,
  799. PULONG PacketLength,
  800. PUCHAR WorkspaceVirtualAddress,
  801. HW_32BIT_PHYSICAL_ADDRESS WorkspacePhysicalAddress,
  802. ULONG WorkSpaceLength,
  803. USBD_STATUS *UsbdStatus
  804. );
  805. USB_MINIPORT_STATUS
  806. EHCI_OpenIsochronousEndpoint(
  807. PDEVICE_DATA DeviceData,
  808. PENDPOINT_PARAMETERS EndpointParameters,
  809. PENDPOINT_DATA EndpointData
  810. );
  811. VOID
  812. EHCI_SetIsoEndpointState(
  813. PDEVICE_DATA DeviceData,
  814. PENDPOINT_DATA EndpointData,
  815. MP_ENDPOINT_STATE State
  816. );
  817. VOID
  818. EHCI_RebalanceEndpoint(
  819. PDEVICE_DATA DeviceData,
  820. PENDPOINT_PARAMETERS EndpointParameters,
  821. PENDPOINT_DATA EndpointData
  822. );
  823. VOID
  824. EHCI_SetAsyncEndpointStatus(
  825. PDEVICE_DATA DeviceData,
  826. PENDPOINT_DATA EndpointData,
  827. MP_ENDPOINT_STATUS Status
  828. );
  829. MP_ENDPOINT_STATUS
  830. EHCI_GetAsyncEndpointStatus(
  831. PDEVICE_DATA DeviceData,
  832. PENDPOINT_DATA EndpointData
  833. );
  834. USB_MINIPORT_STATUS
  835. EHCI_SubmitIsoTransfer(
  836. PDEVICE_DATA DeviceData,
  837. PENDPOINT_DATA EndpointData,
  838. PTRANSFER_PARAMETERS TransferParameters,
  839. PTRANSFER_CONTEXT TransferContext,
  840. PMINIPORT_ISO_TRANSFER IsoTransfer
  841. );
  842. VOID
  843. EHCI_PollIsoEndpoint(
  844. PDEVICE_DATA DeviceData,
  845. PENDPOINT_DATA EndpointData
  846. );
  847. USB_MINIPORT_STATUS
  848. EHCI_AbortIsoTransfer(
  849. PDEVICE_DATA DeviceData,
  850. PENDPOINT_DATA EndpointData,
  851. PTRANSFER_CONTEXT TransferContext
  852. );
  853. VOID
  854. EHCI_InternalPollHsIsoEndpoint(
  855. PDEVICE_DATA DeviceData,
  856. PENDPOINT_DATA EndpointData,
  857. BOOLEAN Complete
  858. );
  859. VOID
  860. EHCI_InsertHsIsoTdsInSchedule(
  861. PDEVICE_DATA DeviceData,
  862. PENDPOINT_DATA EndpointData,
  863. PENDPOINT_DATA PrevEndpointData,
  864. PENDPOINT_DATA NextEndpointData
  865. );
  866. USB_MINIPORT_STATUS
  867. EHCI_OpenHsIsochronousEndpoint(
  868. PDEVICE_DATA DeviceData,
  869. PENDPOINT_PARAMETERS EndpointParameters,
  870. PENDPOINT_DATA EndpointData
  871. );
  872. VOID
  873. EHCI_EnablePeriodicList(
  874. PDEVICE_DATA DeviceData
  875. );
  876. VOID
  877. EHCI_RemoveHsIsoTdsFromSchedule(
  878. PDEVICE_DATA DeviceData,
  879. PENDPOINT_DATA EndpointData
  880. );
  881. VOID
  882. EHCI_RebalanceInterruptEndpoint(
  883. PDEVICE_DATA DeviceData,
  884. PENDPOINT_PARAMETERS EndpointParameters,
  885. PENDPOINT_DATA EndpointData
  886. );
  887. VOID
  888. EHCI_RebalanceIsoEndpoint(
  889. PDEVICE_DATA DeviceData,
  890. PENDPOINT_PARAMETERS EndpointParameters,
  891. PENDPOINT_DATA EndpointData
  892. );
  893. BOOLEAN
  894. EHCI_PastExpirationDate(
  895. PDEVICE_DATA DeviceData
  896. );
  897. USB_MINIPORT_STATUS
  898. EHCI_PokeAsyncEndpoint(
  899. PDEVICE_DATA DeviceData,
  900. PENDPOINT_PARAMETERS EndpointParameters,
  901. PENDPOINT_DATA EndpointData
  902. );
  903. USB_MINIPORT_STATUS
  904. EHCI_PokeIsoEndpoint(
  905. PDEVICE_DATA DeviceData,
  906. PENDPOINT_PARAMETERS EndpointParameters,
  907. PENDPOINT_DATA EndpointData
  908. );
  909. PHCD_QUEUEHEAD_DESCRIPTOR
  910. EHCI_GetDummyQueueHeadForFrame(
  911. PDEVICE_DATA DeviceData,
  912. ULONG Frame
  913. );
  914. VOID
  915. EHCI_AddDummyQueueHeads(
  916. PDEVICE_DATA DeviceData
  917. );
  918. BOOLEAN
  919. EHCI_HardwarePresent(
  920. PDEVICE_DATA DeviceData,
  921. BOOLEAN Notify
  922. );
  923. VOID
  924. EHCI_LockQueueHead(
  925. PDEVICE_DATA DeviceData,
  926. PHCD_QUEUEHEAD_DESCRIPTOR Qh,
  927. ENDPOINT_TRANSFER_TYPE EpType
  928. );
  929. VOID
  930. EHCI_UnlockQueueHead(
  931. PDEVICE_DATA DeviceData,
  932. PHCD_QUEUEHEAD_DESCRIPTOR Qh
  933. );
  934. VOID
  935. EHCI_PollHaltedEndpoint(
  936. PDEVICE_DATA DeviceData,
  937. PENDPOINT_DATA EndpointData
  938. );
  939. VOID
  940. EHCI_PollAsyncEndpoint(
  941. PDEVICE_DATA DeviceData,
  942. PENDPOINT_DATA EndpointData
  943. );
  944. VOID
  945. EHCI_PollActiveEndpoint(
  946. PDEVICE_DATA DeviceData,
  947. PENDPOINT_DATA EndpointData
  948. );
  949. VOID
  950. EHCI_AssertQhChk(
  951. PDEVICE_DATA DeviceData,
  952. PENDPOINT_DATA EndpointData
  953. );
  954. VOID
  955. EHCI_LinkTransferToQueue(
  956. PDEVICE_DATA DeviceData,
  957. PENDPOINT_DATA EndpointData,
  958. PHCD_TRANSFER_DESCRIPTOR FirstTd
  959. );
  960. USB_MINIPORT_STATUS
  961. EHCI_RH_ChirpRootPort(
  962. PDEVICE_DATA DeviceData,
  963. USHORT PortNumber
  964. );
  965. VOID
  966. USBMPFN
  967. EHCI_TakePortControl(
  968. PDEVICE_DATA DeviceData
  969. );
  970. VOID
  971. EHCI_AsyncCacheFlush(
  972. PDEVICE_DATA DeviceData
  973. );
  974. USB_MINIPORT_STATUS
  975. EHCI_StopBIOS(
  976. PDEVICE_DATA DeviceData
  977. );
  978. VOID
  979. EHCI_SetNextTd(
  980. PDEVICE_DATA DeviceData,
  981. PHCD_TRANSFER_DESCRIPTOR LinkTd,
  982. PHCD_TRANSFER_DESCRIPTOR NextTd,
  983. BOOLEAN SetAltNext
  984. );
  985. VOID
  986. EHCI_SetAltNextTd(
  987. PDEVICE_DATA DeviceData,
  988. PHCD_TRANSFER_DESCRIPTOR LinkTd,
  989. PHCD_TRANSFER_DESCRIPTOR NextTd
  990. );
  991. #endif /* __EHCI_H__ */