Source code of Windows XP (NT5)
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.

1017 lines
23 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. hubbusif.h
  5. Abstract:
  6. Services exported by the Port driver for use by the hub driver.
  7. All of these services are callable only at PASSIVE_LEVEL.
  8. Environment:
  9. Kernel mode
  10. Revision History:
  11. 6-20-99 : created
  12. --*/
  13. #ifndef __HUBBUSIF_H__
  14. #define __HUBBUSIF_H__
  15. typedef PVOID PUSB_DEVICE_HANDLE;
  16. typedef struct _ROOTHUB_PDO_EXTENSION {
  17. ULONG Signature;
  18. } ROOTHUB_PDO_EXTENSION, *PROOTHUB_PDO_EXTENSION;
  19. #ifndef USB_BUSIFFN
  20. #define USB_BUSIFFN __stdcall
  21. #endif
  22. /****************************************************************************
  23. Bus interfce for USB Hub
  24. *****************************************************************************/
  25. /*
  26. NTSTATUS
  27. USBPORT_CreateUsbDevice(
  28. IN PVOID BusContext,
  29. IN OUT PUSB_DEVICE_HANDLE *DeviceHandle,
  30. IN PUSB_DEVICE_HANDLE *HubDeviceHandle,
  31. IN USHORT PortStatus,
  32. IN USHORT PortNumber
  33. );
  34. Routine Description:
  35. Service exported for use by the hub driver
  36. Called for each new device on the USB bus, this function sets
  37. up the internal data structures we need to keep track of the
  38. device and assigns it an address.
  39. IRQL = PASSIVE_LEVEL
  40. Arguments:
  41. BusHandle - Handle to the bus we need to create the device on.
  42. This is returned to the hub driver when it requests
  43. the interface.
  44. DeviceHandle - ptr to return the handle to the new device structure
  45. created by this routine
  46. HubDeviceHandle - device handle for the hub creating the device
  47. PortStatus
  48. PortNumber
  49. */
  50. typedef NTSTATUS
  51. (USB_BUSIFFN *PUSB_BUSIFFN_CREATE_USB_DEVICE) (
  52. IN PVOID,
  53. IN OUT PUSB_DEVICE_HANDLE *,
  54. IN PUSB_DEVICE_HANDLE,
  55. IN USHORT,
  56. IN USHORT
  57. );
  58. /*
  59. NTSTATUS
  60. USBPORT_InitializeUsbDevice(
  61. IN PVOID BusContext,
  62. IN OUT PUSB_DEVICE_HANDLE DeviceHandle
  63. );
  64. Routine Description:
  65. Service exported for use by the hub driver
  66. Called for each new device on the USB bus. This function
  67. sets the device address.
  68. IRQL = PASSIVE_LEVEL
  69. Arguments:
  70. BusHandle - Handle to the bus we need to create the device on
  71. this is returned to the hub driver when it requests
  72. the interface.
  73. DeviceHandle - handle to the new device structure
  74. created by CreateUsbDevice
  75. */
  76. typedef NTSTATUS
  77. (USB_BUSIFFN *PUSB_BUSIFFN_INITIALIZE_USB_DEVICE) (
  78. IN PVOID,
  79. IN OUT PUSB_DEVICE_HANDLE
  80. );
  81. /*
  82. NTSTATUS
  83. USBPORT_RemoveUsbDevice(
  84. IN PVOID BusContext,
  85. IN OUT PUSB_DEVICE_HANDLE DeviceHandle,
  86. IN ULONG Flags
  87. );
  88. Routine Description:
  89. Service exported for use by the hub driver
  90. Called to 'remove' a USB device from the bus.
  91. IRQL = PASSIVE_LEVEL
  92. Arguments:
  93. BusHandle - Handle to the bus we need to create the device on
  94. this is returned to the hub driver when it requests
  95. the interface.
  96. DeviceHandle - handle to the device structure
  97. created by CreateUsbDevice
  98. */
  99. /*
  100. flags passed to remove device
  101. */
  102. #define USBD_KEEP_DEVICE_DATA 0x00000001
  103. #define USBD_MARK_DEVICE_BUSY 0x00000002
  104. typedef NTSTATUS
  105. (USB_BUSIFFN *PUSB_BUSIFFN_REMOVE_USB_DEVICE) (
  106. IN PVOID,
  107. IN OUT PUSB_DEVICE_HANDLE,
  108. IN ULONG
  109. );
  110. /*
  111. NTSTATUS
  112. USBPORT_GetUsbDescriptors(
  113. IN PVOID BusContext,
  114. IN OUT PUSB_DEVICE_HANDLE DeviceHandle,
  115. IN OUT PUCHAR DeviceDescriptorBuffer,
  116. IN OUT PULONG DeviceDescriptorBufferLength,
  117. IN OUT PUCHAR ConfigDescriptorBuffer,
  118. IN OUT PULONG ConfigDescriptorBufferLength,
  119. );
  120. Routine Description:
  121. Service exported for use by the hub driver
  122. Retrieves config and device descriptors from a
  123. usb device given the device handle
  124. IRQL = PASSIVE_LEVEL
  125. Arguments:
  126. BusHandle - Handle to the bus we need to create the device on
  127. this is returned to the hub driver when it requests
  128. the interface.
  129. DeviceHandle - handle to the new device structure
  130. created by CreateUsbDevice
  131. */
  132. typedef NTSTATUS
  133. (USB_BUSIFFN *PUSB_BUSIFFN_GET_USB_DESCRIPTORS) (
  134. IN PVOID,
  135. IN OUT PUSB_DEVICE_HANDLE,
  136. IN OUT PUCHAR,
  137. IN OUT PULONG,
  138. IN OUT PUCHAR,
  139. IN OUT PULONG
  140. );
  141. /*
  142. NTSTATUS
  143. USBPORT_RestoreDevice(
  144. IN PVOID BusContext,
  145. IN OUT PUSB_DEVICE_HANDLE OldDeviceHandle,
  146. IN OUT PUSB_DEVICE_HANDLE NewDeviceHandle
  147. );
  148. Routine Description:
  149. Service exported for use by the hub driver
  150. This service will re-create the device on the bus
  151. using the information supplied in the OldDeviceHandle
  152. IRQL = PASSIVE_LEVEL
  153. Arguments:
  154. BusHandle -
  155. OldDeviceHandle -
  156. NewDeviceHandle -
  157. */
  158. typedef NTSTATUS
  159. (USB_BUSIFFN *PUSB_BUSIFFN_RESTORE_DEVICE) (
  160. IN PVOID,
  161. IN OUT PUSB_DEVICE_HANDLE,
  162. IN OUT PUSB_DEVICE_HANDLE
  163. );
  164. /*
  165. NTSTATUS
  166. USBPORT_GetUsbDeviceHackFlags(
  167. IN PVOID BusContext,
  168. IN PUSB_DEVICE_HANDLE DeviceHandle,
  169. IN OUT PULONG HackFlags
  170. );
  171. Routine Description:
  172. Service exported for use by the hub driver
  173. Fetches device specific 'hack' flags from a global refistry key.
  174. These flags modify the behavior of the hub driver.
  175. IRQL = PASSIVE_LEVEL
  176. Arguments:
  177. BusHandle - Handle to the bus we need to create the device on
  178. this is returned to the hub driver when it requests
  179. the interface.
  180. DeviceHandle - handle to the new device structure
  181. created by CreateUsbDevice
  182. HackFlags - per device hack flags, modify the behavior of the
  183. hub driver.
  184. */
  185. typedef NTSTATUS
  186. (USB_BUSIFFN *PUSB_BUSIFFN_GET_DEVICEHACK_FLAGS) (
  187. IN PVOID,
  188. IN PUSB_DEVICE_HANDLE,
  189. IN OUT PULONG
  190. );
  191. /*
  192. NTSTATUS
  193. USBPORT_GetUsbPortHackFlags(
  194. IN PVOID BusContext,
  195. IN OUT PULONG HackFlags
  196. );
  197. Routine Description:
  198. Service exported for use by the hub driver
  199. Fetches global port 'hack' flags from a global refistry key.
  200. These flags modify the behavior of the hub driver.
  201. IRQL = PASSIVE_LEVEL
  202. Arguments:
  203. BusHandle - Handle to the bus we need to create the device on
  204. this is returned to the hub driver when it requests
  205. the interface.
  206. DeviceHandle - handle to the new device structure
  207. created by CreateUsbDevice
  208. HackFlags - global hack flags, modify the behavior of the
  209. hub driver.
  210. */
  211. typedef NTSTATUS
  212. (USB_BUSIFFN *PUSB_BUSIFFN_GET_POTRTHACK_FLAGS) (
  213. IN PVOID,
  214. IN OUT PULONG
  215. );
  216. #define USBD_DEVHACK_SLOW_ENUMERATION 0x00000001
  217. #define USBD_DEVHACK_DISABLE_SN 0x00000002
  218. #define USBD_DEVHACK_SET_DIAG_ID 0x00000004
  219. /*
  220. NTSTATUS
  221. USBPORT_GetDeviceInformation(
  222. IN PVOID BusContext,
  223. IN PUSB_DEVICE_HANDLE DeviceHandle,
  224. IN OUT PVOID DeviceInformationBuffer,
  225. IN ULONG DeviceInformationBufferLength,
  226. IN OUT PULONG LengthOfDataReturned,
  227. );
  228. Routine Description:
  229. Service exported for use by the hub driver. This api returns
  230. various information about the USB devices attached to the system
  231. IRQL = PASSIVE_LEVEL
  232. Arguments:
  233. BusHandle - Handle to the bus we need to create the device on
  234. this is returned to the hub driver when it requests
  235. the interface.
  236. DeviceHandle - handle to the new device structure
  237. created by CreateUsbDevice
  238. DeviceInformationBuffer - buffer for returned data
  239. DeviceInformationBufferLength - length of callers buffer
  240. LengthOfDataReturned - length of buffer used
  241. */
  242. typedef NTSTATUS
  243. (USB_BUSIFFN *PUSB_BUSIFFN_GET_DEVICE_INFORMATION) (
  244. IN PVOID,
  245. IN PUSB_DEVICE_HANDLE,
  246. IN OUT PVOID,
  247. IN ULONG,
  248. IN OUT PULONG
  249. );
  250. /*
  251. NTSTATUS
  252. USBPORT_GetControllerInformation(
  253. IN PVOID BusContext,
  254. IN OUT PVOID ControllerInformationBuffer,
  255. IN ULONG ControllerInformationBufferLength,
  256. IN OUT PULONG LengthOfDataReturned
  257. );
  258. Routine Description:
  259. Service exported for use by the hub driver. This api returns
  260. various information about the USB devices attached to the system
  261. IRQL = PASSIVE_LEVEL
  262. Arguments:
  263. BusHandle - Handle to the bus we need to create the device on
  264. this is returned to the hub driver when it requests
  265. the interface.
  266. ControllerInformationBuffer - buffer for returned data
  267. ControllerInformationBufferLength - length of client buffer
  268. LengthOfDataReturned - length of buffer used
  269. */
  270. typedef NTSTATUS
  271. (USB_BUSIFFN *PUSB_BUSIFFN_GET_CONTROLLER_INFORMATION) (
  272. IN PVOID,
  273. IN OUT PVOID,
  274. IN ULONG,
  275. IN OUT PULONG
  276. );
  277. /*
  278. NTSTATUS
  279. USBPORT_ControllerSelectiveSuspend(
  280. IN PVOID BusContext,
  281. IN BOOLEAN Enable
  282. );
  283. Routine Description:
  284. Service exported for use by the hub driver. This api enables or
  285. disables a selective suspend for the controller
  286. IRQL = PASSIVE_LEVEL
  287. Arguments:
  288. BusHandle - Handle to the bus we need to create the device on
  289. this is returned to the hub driver when it requests
  290. the interface.
  291. Enable - TRUE enables selective suspend, false disables it.
  292. */
  293. typedef NTSTATUS
  294. (USB_BUSIFFN *PUSB_BUSIFFN_CONTROLLER_SELECTIVE_SUSPEND) (
  295. IN PVOID,
  296. IN BOOLEAN
  297. );
  298. /*
  299. NTSTATUS
  300. USBPORT_GetExtendedHubInformation(
  301. IN PVOID BusContext,
  302. IN PDEVICE_OBJECT HubPhysicalDeviceObject,
  303. IN OUT PVOID HubInformationBuffer,
  304. IN ULONG HubInformationBufferLength,
  305. IN OUT PULONG LengthOfDataReturned
  306. );
  307. Routine Description:
  308. Service exported for use by the hub driver. This api returns
  309. extebded hub information stored in ACPI controller methods
  310. IRQL = PASSIVE_LEVEL
  311. Arguments:
  312. BusHandle - Handle to the bus we need to create the device on
  313. this is returned to the hub driver when it requests
  314. the interface.
  315. HubInformationBuffer - buffer for returned data
  316. HubPhysicalDeviceObject - Hubs To of PDO stack
  317. HubInformationBufferLength - length of client buffer
  318. LengthOfDataReturned - length of buffer used
  319. */
  320. typedef NTSTATUS
  321. (USB_BUSIFFN *PUSB_BUSIFFN_GET_EXTENDED_HUB_INFO) (
  322. IN PVOID,
  323. IN PDEVICE_OBJECT,
  324. IN OUT PVOID,
  325. IN ULONG,
  326. IN OUT PULONG
  327. );
  328. /*
  329. NTSTATUS
  330. USBPORT_GetRootHubSymName(
  331. IN PVOID BusContext,
  332. IN OUT PVOID HubInformationBuffer,
  333. IN ULONG HubInformationBufferLength,
  334. OUT PULONG HubNameActualLength
  335. );
  336. Routine Description:
  337. returns the symbolic name created for the root hub Pdo
  338. IRQL = PASSIVE_LEVEL
  339. Arguments:
  340. BusHandle - Handle to the bus we need to create the device on
  341. this is returned to the hub driver when it requests
  342. the interface.
  343. HubNameBuffer - buffer for returned data
  344. HubNameBufferLength - length of client buffer
  345. LengthOfDataReturned - length of buffer used
  346. returns STATUS_BUFFER_TOO_SMALL if too small
  347. */
  348. typedef NTSTATUS
  349. (USB_BUSIFFN *PUSB_BUSIFFN_GET_ROOTHUB_SYM_NAME) (
  350. IN PVOID,
  351. IN OUT PVOID,
  352. IN ULONG,
  353. IN OUT PULONG
  354. );
  355. /*
  356. PVOID
  357. USBPORT_GetDeviceBusContext(
  358. IN PVOID HubBusContext,
  359. IN PVOID DeviceHandle
  360. );
  361. Routine Description:
  362. returns the busContext relative to a given device
  363. IRQL = PASSIVE_LEVEL
  364. Arguments:
  365. */
  366. typedef PVOID
  367. (USB_BUSIFFN *PUSB_BUSIFFN_GET_DEVICE_BUSCONTEXT) (
  368. IN PVOID,
  369. IN PVOID
  370. );
  371. /*
  372. NTSTATUS
  373. USBPORT_Initialize20Hub(
  374. IN PVOID HubBusContext,
  375. IN PUSB_DEVICE_HANDLE HubDeviceHandle,
  376. IN ULONG TtCount
  377. );
  378. Routine Description:
  379. Initailize internal structures for a USB 2.0 hub,
  380. called suring the hub start device process
  381. IRQL = PASSIVE_LEVEL
  382. Arguments:
  383. HubBusContext - Bus Context
  384. HubDeviceHandle - DeviceHandle associated with this hub
  385. TtCount - count of TTs on the hub
  386. */
  387. typedef NTSTATUS
  388. (USB_BUSIFFN *PUSB_BUSIFFN_INITIALIZE_20HUB) (
  389. IN PVOID,
  390. IN PUSB_DEVICE_HANDLE,
  391. IN ULONG
  392. );
  393. /*
  394. NTSTATUS
  395. USBPORT_RootHubInitNotification(
  396. IN PVOID HubBusContext,
  397. IN PVOID CallbackContext,
  398. IN PRH_INIT_CALLBACK CallbackFunction
  399. );
  400. Routine Description:
  401. Notification request issued by root hub to be notified as to when
  402. it is OK to enumerate devices.
  403. Arguments:
  404. */
  405. typedef VOID
  406. (__stdcall *PRH_INIT_CALLBACK) (
  407. IN PVOID
  408. );
  409. typedef NTSTATUS
  410. (USB_BUSIFFN *PUSB_BUSIFFN_ROOTHUB_INIT_NOTIFY) (
  411. IN PVOID,
  412. IN PVOID,
  413. IN PRH_INIT_CALLBACK
  414. );
  415. /*
  416. VOID
  417. USBPORT_FlushTransfers(
  418. PVOID BusContext,
  419. PVOID DeviceHandle
  420. );
  421. Routine Description:
  422. IRQL = ANY
  423. Flushes outstanding tranfers on the bad request list
  424. Arguments:
  425. */
  426. typedef VOID
  427. (USB_BUSIFFN *PUSB_BUSIFFN_FLUSH_TRANSFERS) (
  428. IN PVOID,
  429. IN PVOID
  430. );
  431. /*
  432. VOID
  433. USBPORTBUSIF_SetDeviceHandleData(
  434. PVOID BusContext,
  435. PVOID DeviceHandle,
  436. PDEVICE_OBJECT UsbDevicePdo
  437. )
  438. Routine Description:
  439. Assocaites a particular PDO with a device handle for use
  440. in post mortem debugging situaltions
  441. This routine must be called at passive level.
  442. Arguments:
  443. Return Value:
  444. none
  445. */
  446. typedef VOID
  447. (USB_BUSIFFN *PUSB_BUSIFFN_SET_DEVHANDLE_DATA) (
  448. IN PVOID,
  449. IN PVOID,
  450. IN PDEVICE_OBJECT
  451. );
  452. #define USB_BUSIF_HUB_VERSION_0 0x0000
  453. #define USB_BUSIF_HUB_VERSION_1 0x0001
  454. #define USB_BUSIF_HUB_VERSION_2 0x0002
  455. #define USB_BUSIF_HUB_VERSION_3 0x0003
  456. #define USB_BUSIF_HUB_VERSION_4 0x0004
  457. #define USB_BUSIF_HUB_VERSION_5 0x0005
  458. /* {B2BB8C0A-5AB4-11d3-A8CD-00C04F68747A}*/
  459. DEFINE_GUID(USB_BUS_INTERFACE_HUB_GUID,
  460. 0xb2bb8c0a, 0x5ab4, 0x11d3, 0xa8, 0xcd, 0x0, 0xc0, 0x4f, 0x68, 0x74, 0x7a);
  461. typedef struct _USB_BUS_INTERFACE_HUB_V0 {
  462. USHORT Size;
  463. USHORT Version;
  464. // returns
  465. PVOID BusContext;
  466. PINTERFACE_REFERENCE InterfaceReference;
  467. PINTERFACE_DEREFERENCE InterfaceDereference;
  468. // interface specific entries go here
  469. } USB_BUS_INTERFACE_HUB_V0, *PUSB_BUS_INTERFACE_HUB_V0;
  470. typedef struct _USB_BUS_INTERFACE_HUB_V1 {
  471. USHORT Size;
  472. USHORT Version;
  473. // returns
  474. PVOID BusContext;
  475. PINTERFACE_REFERENCE InterfaceReference;
  476. PINTERFACE_DEREFERENCE InterfaceDereference;
  477. // interface specific entries go here
  478. //
  479. // fuctions for the hub driver
  480. //
  481. PUSB_BUSIFFN_CREATE_USB_DEVICE CreateUsbDevice;
  482. PUSB_BUSIFFN_INITIALIZE_USB_DEVICE InitializeUsbDevice;
  483. PUSB_BUSIFFN_GET_USB_DESCRIPTORS GetUsbDescriptors;
  484. PUSB_BUSIFFN_REMOVE_USB_DEVICE RemoveUsbDevice;
  485. PUSB_BUSIFFN_RESTORE_DEVICE RestoreUsbDevice;
  486. PUSB_BUSIFFN_GET_POTRTHACK_FLAGS GetPortHackFlags;
  487. PUSB_BUSIFFN_GET_DEVICE_INFORMATION QueryDeviceInformation;
  488. } USB_BUS_INTERFACE_HUB_V1, *PUSB_BUS_INTERFACE_HUB_V1;
  489. /*
  490. */
  491. typedef struct _USB_BUS_INTERFACE_HUB_V2 {
  492. USHORT Size;
  493. USHORT Version;
  494. // returns
  495. PVOID BusContext;
  496. PINTERFACE_REFERENCE InterfaceReference;
  497. PINTERFACE_DEREFERENCE InterfaceDereference;
  498. // interface specific entries go here
  499. //
  500. // fuctions for the hub driver
  501. //
  502. PUSB_BUSIFFN_CREATE_USB_DEVICE CreateUsbDevice;
  503. PUSB_BUSIFFN_INITIALIZE_USB_DEVICE InitializeUsbDevice;
  504. PUSB_BUSIFFN_GET_USB_DESCRIPTORS GetUsbDescriptors;
  505. PUSB_BUSIFFN_REMOVE_USB_DEVICE RemoveUsbDevice;
  506. PUSB_BUSIFFN_RESTORE_DEVICE RestoreUsbDevice;
  507. PUSB_BUSIFFN_GET_POTRTHACK_FLAGS GetPortHackFlags;
  508. PUSB_BUSIFFN_GET_DEVICE_INFORMATION QueryDeviceInformation;
  509. //
  510. // new functions for version 2
  511. //
  512. PUSB_BUSIFFN_GET_CONTROLLER_INFORMATION GetControllerInformation;
  513. PUSB_BUSIFFN_CONTROLLER_SELECTIVE_SUSPEND ControllerSelectiveSuspend;
  514. PUSB_BUSIFFN_GET_EXTENDED_HUB_INFO GetExtendedHubInformation;
  515. PUSB_BUSIFFN_GET_ROOTHUB_SYM_NAME GetRootHubSymbolicName;
  516. PUSB_BUSIFFN_GET_DEVICE_BUSCONTEXT GetDeviceBusContext;
  517. PUSB_BUSIFFN_INITIALIZE_20HUB Initialize20Hub;
  518. } USB_BUS_INTERFACE_HUB_V2, *PUSB_BUS_INTERFACE_HUB_V2;
  519. typedef struct _USB_BUS_INTERFACE_HUB_V3 {
  520. USHORT Size;
  521. USHORT Version;
  522. // returns
  523. PVOID BusContext;
  524. PINTERFACE_REFERENCE InterfaceReference;
  525. PINTERFACE_DEREFERENCE InterfaceDereference;
  526. // interface specific entries go here
  527. //
  528. // fuctions for the hub driver
  529. //
  530. PUSB_BUSIFFN_CREATE_USB_DEVICE CreateUsbDevice;
  531. PUSB_BUSIFFN_INITIALIZE_USB_DEVICE InitializeUsbDevice;
  532. PUSB_BUSIFFN_GET_USB_DESCRIPTORS GetUsbDescriptors;
  533. PUSB_BUSIFFN_REMOVE_USB_DEVICE RemoveUsbDevice;
  534. PUSB_BUSIFFN_RESTORE_DEVICE RestoreUsbDevice;
  535. PUSB_BUSIFFN_GET_POTRTHACK_FLAGS GetPortHackFlags;
  536. PUSB_BUSIFFN_GET_DEVICE_INFORMATION QueryDeviceInformation;
  537. //
  538. // new functions for version 2
  539. //
  540. PUSB_BUSIFFN_GET_CONTROLLER_INFORMATION GetControllerInformation;
  541. PUSB_BUSIFFN_CONTROLLER_SELECTIVE_SUSPEND ControllerSelectiveSuspend;
  542. PUSB_BUSIFFN_GET_EXTENDED_HUB_INFO GetExtendedHubInformation;
  543. PUSB_BUSIFFN_GET_ROOTHUB_SYM_NAME GetRootHubSymbolicName;
  544. PUSB_BUSIFFN_GET_DEVICE_BUSCONTEXT GetDeviceBusContext;
  545. PUSB_BUSIFFN_INITIALIZE_20HUB Initialize20Hub;
  546. //
  547. // new for version 3
  548. //
  549. PUSB_BUSIFFN_ROOTHUB_INIT_NOTIFY RootHubInitNotification;
  550. } USB_BUS_INTERFACE_HUB_V3, *PUSB_BUS_INTERFACE_HUB_V3;
  551. typedef struct _USB_BUS_INTERFACE_HUB_V4 {
  552. USHORT Size;
  553. USHORT Version;
  554. // returns
  555. PVOID BusContext;
  556. PINTERFACE_REFERENCE InterfaceReference;
  557. PINTERFACE_DEREFERENCE InterfaceDereference;
  558. // interface specific entries go here
  559. //
  560. // fuctions for the hub driver
  561. //
  562. PUSB_BUSIFFN_CREATE_USB_DEVICE CreateUsbDevice;
  563. PUSB_BUSIFFN_INITIALIZE_USB_DEVICE InitializeUsbDevice;
  564. PUSB_BUSIFFN_GET_USB_DESCRIPTORS GetUsbDescriptors;
  565. PUSB_BUSIFFN_REMOVE_USB_DEVICE RemoveUsbDevice;
  566. PUSB_BUSIFFN_RESTORE_DEVICE RestoreUsbDevice;
  567. PUSB_BUSIFFN_GET_POTRTHACK_FLAGS GetPortHackFlags;
  568. PUSB_BUSIFFN_GET_DEVICE_INFORMATION QueryDeviceInformation;
  569. //
  570. // new functions for version 2
  571. //
  572. PUSB_BUSIFFN_GET_CONTROLLER_INFORMATION GetControllerInformation;
  573. PUSB_BUSIFFN_CONTROLLER_SELECTIVE_SUSPEND ControllerSelectiveSuspend;
  574. PUSB_BUSIFFN_GET_EXTENDED_HUB_INFO GetExtendedHubInformation;
  575. PUSB_BUSIFFN_GET_ROOTHUB_SYM_NAME GetRootHubSymbolicName;
  576. PUSB_BUSIFFN_GET_DEVICE_BUSCONTEXT GetDeviceBusContext;
  577. PUSB_BUSIFFN_INITIALIZE_20HUB Initialize20Hub;
  578. //
  579. // new for version 3
  580. //
  581. PUSB_BUSIFFN_ROOTHUB_INIT_NOTIFY RootHubInitNotification;
  582. //
  583. // new for version 4
  584. //
  585. PUSB_BUSIFFN_FLUSH_TRANSFERS FlushTransfers;
  586. } USB_BUS_INTERFACE_HUB_V4, *PUSB_BUS_INTERFACE_HUB_V4;
  587. typedef struct _USB_BUS_INTERFACE_HUB_V5 {
  588. USHORT Size;
  589. USHORT Version;
  590. // returns
  591. PVOID BusContext;
  592. PINTERFACE_REFERENCE InterfaceReference;
  593. PINTERFACE_DEREFERENCE InterfaceDereference;
  594. // interface specific entries go here
  595. //
  596. // fuctions for the hub driver
  597. //
  598. PUSB_BUSIFFN_CREATE_USB_DEVICE CreateUsbDevice;
  599. PUSB_BUSIFFN_INITIALIZE_USB_DEVICE InitializeUsbDevice;
  600. PUSB_BUSIFFN_GET_USB_DESCRIPTORS GetUsbDescriptors;
  601. PUSB_BUSIFFN_REMOVE_USB_DEVICE RemoveUsbDevice;
  602. PUSB_BUSIFFN_RESTORE_DEVICE RestoreUsbDevice;
  603. PUSB_BUSIFFN_GET_POTRTHACK_FLAGS GetPortHackFlags;
  604. PUSB_BUSIFFN_GET_DEVICE_INFORMATION QueryDeviceInformation;
  605. //
  606. // version 2
  607. //
  608. PUSB_BUSIFFN_GET_CONTROLLER_INFORMATION GetControllerInformation;
  609. PUSB_BUSIFFN_CONTROLLER_SELECTIVE_SUSPEND ControllerSelectiveSuspend;
  610. PUSB_BUSIFFN_GET_EXTENDED_HUB_INFO GetExtendedHubInformation;
  611. PUSB_BUSIFFN_GET_ROOTHUB_SYM_NAME GetRootHubSymbolicName;
  612. PUSB_BUSIFFN_GET_DEVICE_BUSCONTEXT GetDeviceBusContext;
  613. PUSB_BUSIFFN_INITIALIZE_20HUB Initialize20Hub;
  614. //
  615. // version 3
  616. //
  617. PUSB_BUSIFFN_ROOTHUB_INIT_NOTIFY RootHubInitNotification;
  618. //
  619. // version 4
  620. //
  621. PUSB_BUSIFFN_FLUSH_TRANSFERS FlushTransfers;
  622. // new for version 5
  623. PUSB_BUSIFFN_SET_DEVHANDLE_DATA SetDeviceHandleData;
  624. } USB_BUS_INTERFACE_HUB_V5, *PUSB_BUS_INTERFACE_HUB_V5;
  625. /*
  626. The following structures are used by the GetDeviceInformation
  627. APIs
  628. */
  629. #include <pshpack1.h>
  630. typedef struct _USB_PIPE_INFORMATION_0 {
  631. /* pad descriptors to maintain DWORD alignment */
  632. USB_ENDPOINT_DESCRIPTOR EndpointDescriptor;
  633. UCHAR ED_Pad[1];
  634. ULONG ScheduleOffset;
  635. } USB_PIPE_INFORMATION_0, *PUSB_PIPE_INFORMATION_0;
  636. typedef struct _USB_LEVEL_INFORMATION {
  637. /* inputs: information level requested */
  638. ULONG InformationLevel;
  639. /* outputs: */
  640. ULONG ActualLength;
  641. } USB_LEVEL_INFORMATION, *PUSB_LEVEL_INFORMATION;
  642. typedef struct _USB_DEVICE_INFORMATION_0 {
  643. /* inputs: information level requested */
  644. ULONG InformationLevel;
  645. /* outputs: */
  646. ULONG ActualLength;
  647. /* begin level_0 information */
  648. ULONG PortNumber;
  649. /* pad descriptors to maintain DWORD alignment */
  650. USB_DEVICE_DESCRIPTOR DeviceDescriptor;
  651. UCHAR DD_pad[2];
  652. UCHAR CurrentConfigurationValue;
  653. UCHAR ReservedMBZ;
  654. USHORT DeviceAddress;
  655. ULONG HubAddress;
  656. USB_DEVICE_SPEED DeviceSpeed;
  657. USB_DEVICE_TYPE DeviceType;
  658. ULONG NumberOfOpenPipes;
  659. USB_PIPE_INFORMATION_0 PipeList[1];
  660. } USB_DEVICE_INFORMATION_0, *PUSB_DEVICE_INFORMATION_0;
  661. typedef struct _USB_CONTROLLER_INFORMATION_0 {
  662. /* inputs: information level requested */
  663. ULONG InformationLevel;
  664. /* outputs: */
  665. ULONG ActualLength;
  666. /* begin level_0 information */
  667. BOOLEAN SelectiveSuspendEnabled;
  668. BOOLEAN IsHighSpeedController;
  669. } USB_CONTROLLER_INFORMATION_0, *PUSB_CONTROLLER_INFORMATION_0;
  670. /*
  671. Structures that define extended hub port charateristics
  672. */
  673. typedef struct _USB_EXTPORT_INFORMATION_0 {
  674. /*
  675. physical port ie number passed in control
  676. commands 1, 2, 3..255
  677. */
  678. ULONG PhysicalPortNumber;
  679. /*
  680. label on port may not natch the physical
  681. number
  682. */
  683. ULONG PortLabelNumber;
  684. USHORT VidOverride;
  685. USHORT PidOverride;
  686. /*
  687. extended port attributes as defined in
  688. usb.h
  689. */
  690. ULONG PortAttributes;
  691. } USB_EXTPORT_INFORMATION_0, *PUSB_EXTPORT_INFORMATION;
  692. typedef struct _USB_EXTHUB_INFORMATION_0 {
  693. /* inputs: information level requested */
  694. ULONG InformationLevel;
  695. /* begin level_0 information */
  696. ULONG NumberOfPorts;
  697. /* hubs don't have > 255 ports */
  698. USB_EXTPORT_INFORMATION_0 Port[255];
  699. } USB_EXTHUB_INFORMATION_0, *PUSB_EXTHUB_INFORMATION_0;
  700. #include <poppack.h>
  701. #endif /* __HUBBUSIF_H */