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.

1185 lines
47 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. USBD.c
  5. Abstract:
  6. WinDbg Extension Api
  7. Author:
  8. Chris Robinson (crobins) Feburary 1999
  9. Environment:
  10. User Mode.
  11. Revision History:
  12. --*/
  13. #include "precomp.h"
  14. //#include "usbd.h"
  15. typedef union _URB_FLAGS {
  16. struct {
  17. ULONG FullListing : 1;
  18. ULONG Reserved : 31;
  19. };
  20. ULONG Flags;
  21. } URB_FLAGS;
  22. #define PRINT_FLAGS(value, flag) \
  23. if ((value) & (flag)) { \
  24. dprintf (#flag " "); \
  25. }
  26. extern VOID
  27. DumpDeviceCapabilities(
  28. ULONG64 caps
  29. );
  30. VOID USBD_DumpURB (ULONG64 UrbLoc, URB_FLAGS);
  31. VOID USBD_DeviceDescriptor (PCHAR Comment, ULONG64 Desc);
  32. VOID USBD_InterfaceDescriptor (PCHAR Comment, ULONG64 Desc);
  33. VOID USBD_EndpointDescriptor (PCHAR Comment, ULONG64 Desc);
  34. VOID USBD_PowerDescriptor (PCHAR Comment, ULONG64 Desc);
  35. #define InitTypeReadCheck(Addr, Type) \
  36. if (InitTypeRead(Addr, Type)) { \
  37. dprintf("Cannot read %s at %p\n", Addr); \
  38. return; \
  39. }
  40. //
  41. // USBD function definitions
  42. //
  43. DECLARE_API( urb )
  44. /*++
  45. Routine Description:
  46. Dumps a URB block
  47. Arguments:
  48. args - Address flags
  49. Return Value:
  50. None
  51. --*/
  52. {
  53. ULONG64 memLoc=0;
  54. UCHAR buffer[256];
  55. URB_FLAGS flags;
  56. buffer[0] = '\0';
  57. flags.Flags = 0;
  58. if (!*args)
  59. {
  60. memLoc = EXPRLastDump;
  61. }
  62. else
  63. {
  64. if (GetExpressionEx(args, &memLoc, &args)) {
  65. strcpy(buffer, args);
  66. }
  67. }
  68. if ('\0' != buffer[0])
  69. {
  70. flags.Flags = (ULONG) GetExpression(buffer);
  71. }
  72. dprintf ("Dump URB %p %x \n", memLoc, flags.Flags);
  73. USBD_DumpURB (memLoc, flags);
  74. return S_OK;
  75. }
  76. VOID
  77. USBD_DeviceDescriptor (
  78. PCHAR Comment,
  79. ULONG64 Desc
  80. )
  81. {
  82. InitTypeReadCheck(Desc, usbd!USB_DEVICE_DESCRIPTOR);
  83. dprintf ("%s \n", Comment);
  84. dprintf ("bLength %x \t bDescriptor Type %x \t bcdUSB %x\n"
  85. "bDeviceClass %x \t bDeviceSubClass %x \t bDeviceProtocol %x\n"
  86. "bMaxPacketSize0 %x \t (Vid / Pid / rev) (%x / %x / %x)\n"
  87. "Manu %x Prod %x Serial %x #Configs %x\n",
  88. (ULONG) ReadField(bLength),
  89. (ULONG) ReadField(bDescriptorType),
  90. (ULONG) ReadField(bcdUSB),
  91. (ULONG) ReadField(bDeviceClass),
  92. (ULONG) ReadField(bDeviceSubClass),
  93. (ULONG) ReadField(bDeviceProtocol),
  94. (ULONG) ReadField(bMaxPacketSize0),
  95. (ULONG) ReadField(idVendor),
  96. (ULONG) ReadField(idProduct),
  97. (ULONG) ReadField(bcdDevice),
  98. (ULONG) ReadField(iManufacturer),
  99. (ULONG) ReadField(iProduct),
  100. (ULONG) ReadField(iSerialNumber),
  101. (ULONG) ReadField(bNumConfigurations));
  102. }
  103. VOID
  104. USBD_ConfigurationDescriptor (
  105. PCHAR Comment,
  106. ULONG64 Config
  107. )
  108. {
  109. InitTypeReadCheck(Config, usbd!USB_CONFIGURATION_DESCRIPTOR);
  110. dprintf ("%s \n", Comment);
  111. dprintf ("Length %x \t Desc Type %x \t TotalLength %d \n"
  112. "Num Ints %x \t Config Val %x \t \n"
  113. "Config Desc %x \t Attrib %x \t MaxPower %x\n",
  114. (ULONG) ReadField(bLength),
  115. (ULONG) ReadField(bDescriptorType),
  116. (ULONG) ReadField(wTotalLength),
  117. (ULONG) ReadField(bNumInterfaces),
  118. (ULONG) ReadField(bConfigurationValue),
  119. (ULONG) ReadField(iConfiguration),
  120. (ULONG) ReadField(bmAttributes),
  121. (ULONG) ReadField(MaxPower));
  122. return;
  123. }
  124. VOID
  125. USBD_InterfaceDescriptor (
  126. PCHAR Comment,
  127. ULONG64 Interface
  128. )
  129. {
  130. InitTypeReadCheck(Interface, usbd!USB_INTERFACE_DESCRIPTOR);
  131. dprintf ("%s \n", Comment);
  132. dprintf ("Length %x \t Desc Type %x \t Interface Number %x\n"
  133. "Alt Setting %x \t Num Ends %x \t \n"
  134. "Class %x \t SubClass %x \t Protocol %x \n"
  135. "Interface %x\n",
  136. (ULONG) ReadField(bLength),
  137. (ULONG) ReadField(bDescriptorType),
  138. (ULONG) ReadField(bInterfaceNumber),
  139. (ULONG) ReadField(bAlternateSetting),
  140. (ULONG) ReadField(bNumEndpoints),
  141. (ULONG) ReadField(bInterfaceClass),
  142. (ULONG) ReadField(bInterfaceSubClass),
  143. (ULONG) ReadField(bInterfaceProtocol),
  144. (ULONG) ReadField(iInterface));
  145. }
  146. VOID
  147. USBD_EndpointDescriptor (
  148. PCHAR Comment,
  149. ULONG64 Endpoint
  150. )
  151. {
  152. InitTypeReadCheck(Endpoint, usbd!USB_ENDPOINT_DESCRIPTOR);
  153. dprintf ("%s \n", Comment);
  154. dprintf ("Length %x \t Desc Type %x \t EndAddress %x\n"
  155. "Attribs %x \t MaxPacketSize %x \t Interval %x\n",
  156. (ULONG) ReadField(bLength),
  157. (ULONG) ReadField(bDescriptorType),
  158. (ULONG) ReadField(bEndpointAddress),
  159. (ULONG) ReadField(bmAttributes),
  160. (ULONG) ReadField(wMaxPacketSize),
  161. (ULONG) ReadField(bInterval));
  162. }
  163. VOID
  164. USBD_PowerDescriptor (
  165. PCHAR Comment,
  166. ULONG64 Power
  167. )
  168. {
  169. dprintf ("%s - not implemented\n", Comment);
  170. }
  171. VOID
  172. USBD_Pipe(
  173. PCHAR Comment,
  174. ULONG64 PipeHandle
  175. )
  176. {
  177. ULONG numEndpoints, Sig, Off;
  178. dprintf ("%s \n", Comment);
  179. if (0 == PipeHandle)
  180. {
  181. dprintf("Pipe Handle is NULL\n");
  182. return;
  183. }
  184. InitTypeReadCheck(PipeHandle, usbd!USBD_PIPE);
  185. Sig = (ULONG) ReadField(Sig);
  186. dprintf("Signature: %c%c%c%c\n"
  187. "HcdEndpoint: %08x \t MPS %x \t Sched Offset %x\n",
  188. ((PUCHAR) &Sig)[0],
  189. ((PUCHAR) &Sig)[1],
  190. ((PUCHAR) &Sig)[2],
  191. ((PUCHAR) &Sig)[3],
  192. (ULONG) ReadField(HcdEndpoint),
  193. (ULONG) ReadField(MaxTransferSize),
  194. (ULONG) ReadField(ScheduleOffset));
  195. dprintf("\n");
  196. dprintf("Endpoint Descriptor\n"
  197. "-------------------");
  198. GetFieldOffset("usbd!USBD_PIPE", "EndpointDescriptor", &Off);
  199. USBD_EndpointDescriptor("", (PipeHandle + Off));
  200. return;
  201. }
  202. VOID
  203. USBD_Interface(
  204. ULONG64 MemLoc
  205. )
  206. {
  207. ULONG i;
  208. ULONG numEndpoints;
  209. ULONG Off;
  210. ULONG Sig;
  211. ULONG PipeSize;
  212. InitTypeReadCheck(MemLoc, usbd!_USBD_INTERFACE);
  213. numEndpoints = (ULONG) ReadField(InterfaceDescriptor.bNumEndpoints);
  214. Sig = (ULONG) ReadField(Sig);
  215. dprintf("Signature: %c%c%c%c\n",
  216. ((PUCHAR) &Sig)[0],
  217. ((PUCHAR) &Sig)[1],
  218. ((PUCHAR) &Sig)[2],
  219. ((PUCHAR) &Sig)[3]);
  220. dprintf("Has Alt Settings: %x\n",
  221. (ULONG) ReadField(HasAlternateSettings));
  222. dprintf("Interface Info: %x\n",
  223. (ULONG) ReadField(InterfaceInformation));
  224. dprintf("\n");
  225. dprintf("Interface Descriptor\n"
  226. "--------------------");
  227. GetFieldOffset("usbd!_USBD_INTERFACE", "InterfaceDescriptor", &Off);
  228. USBD_InterfaceDescriptor("", MemLoc + Off);
  229. GetFieldOffset("usbd!_USBD_INTERFACE", "PipeHandle", &Off);
  230. PipeSize = GetTypeSize("usbd!USBD_PIPE");
  231. for (i = 0; i < numEndpoints; i++)
  232. {
  233. dprintf("\n");
  234. dprintf("Pipe Handle\n"
  235. "-----------");
  236. USBD_Pipe("", MemLoc + i*PipeSize);
  237. }
  238. return;
  239. }
  240. VOID
  241. USBD_ConfigHandle(
  242. ULONG64 MemLoc
  243. )
  244. {
  245. ULONG configDataSize;
  246. ULONG i;
  247. ULONG numInterfaces;
  248. ULONG Sz, Sig;
  249. ULONG64 ConfigurationDescriptor, InterfaceHandle;
  250. if (GetFieldValue(MemLoc, "usbd!_USBD_CONFIG",
  251. "ConfigurationDescriptor", ConfigurationDescriptor))
  252. {
  253. dprintf("Could not read configuration handle\n");
  254. return;
  255. }
  256. InitTypeReadCheck(ConfigurationDescriptor, usbd!USB_CONFIGURATION_DESCRIPTOR);
  257. numInterfaces = (ULONG) ReadField(bNumInterfaces);
  258. InitTypeRead(MemLoc, usbd!_USBD_CONFIG);
  259. Sig = (ULONG) ReadField(Sig);
  260. dprintf("Signature: %c%c%c%c\n",
  261. ((PUCHAR) &Sig)[0],
  262. ((PUCHAR) &Sig)[1],
  263. ((PUCHAR) &Sig)[2],
  264. ((PUCHAR) &Sig)[3]);
  265. dprintf("Config Descriptor: %08p\n", ConfigurationDescriptor);
  266. InterfaceHandle = ReadField(InterfaceHandle[0]);
  267. Sz= GetTypeSize("usbd!USBD_INTERFACE");
  268. USBD_ConfigurationDescriptor("", ConfigurationDescriptor);
  269. for (i = 0; 0 != InterfaceHandle && i < numInterfaces; i++)
  270. {
  271. InitTypeReadCheck(InterfaceHandle, usbd!_USBD_INTERFACE);
  272. dprintf("\n");
  273. dprintf("Interface Handle: %08x\n"
  274. "-----------------\n",
  275. InterfaceHandle);
  276. USBD_Interface(InterfaceHandle);
  277. InterfaceHandle += Sz;
  278. }
  279. return;
  280. }
  281. VOID
  282. URB_HCD_AREA(ULONG64 Hcd)
  283. {
  284. InitTypeRead(Hcd, usbd!_URB_HCD_AREA);
  285. dprintf ("HCD_Area: HcdEndpoint %x HcdIrp %x \n"
  286. " HcdList (%x, %x) HcdList2 (%x, %x) \n"
  287. " CurrentIoFlush %x HcdExt %x \n",
  288. (ULONG) ReadField(HcdEndpoint),
  289. (ULONG) ReadField(HcdIrp),
  290. (ULONG) ReadField(HcdListEntry.Flink),
  291. (ULONG) ReadField(HcdListEntry.Blink),
  292. (ULONG) ReadField(HcdListEntry2.Flink),
  293. (ULONG) ReadField(HcdListEntry2.Blink),
  294. (ULONG) ReadField(HcdCurrentIoFlushPointer),
  295. (ULONG) ReadField(HcdExtension));
  296. }
  297. VOID
  298. USBD_DumpURB (
  299. ULONG64 MemLoc,
  300. URB_FLAGS Flags
  301. )
  302. {
  303. ULONG64 urbLoc;
  304. ULONG result;
  305. ULONG i;
  306. // PURB urb;
  307. // PHCD_URB hcd;
  308. // URB urbBuffer;
  309. ULONG64 packetLoc;
  310. // PUSBD_ISO_PACKET_DESCRIPTOR packet;
  311. // USBD_ISO_PACKET_DESCRIPTOR packetBuffer;
  312. BOOLEAN again;
  313. UNREFERENCED_PARAMETER (Flags);
  314. urbLoc = MemLoc;
  315. InitTypeReadCheck(urbLoc, usbd!_URB_HEADER);
  316. #define URB_HEADER() \
  317. dprintf ("URB : Fn %x len %x stat %x DevH %x Flgs %x\n", \
  318. (ULONG) ReadField(UrbHeader.Function), \
  319. (ULONG) ReadField(UrbHeader.Length), \
  320. (ULONG) ReadField(UrbHeader.Status), \
  321. (ULONG) ReadField(UrbHeader.UsbdDeviceHandle), \
  322. (ULONG) ReadField(UrbHeader.UsbdFlags))
  323. again = TRUE;
  324. while (again && urbLoc) {
  325. dprintf (" ---- URB: %x ---- \n", urbLoc);
  326. again = FALSE;
  327. InitTypeReadCheck (urbLoc, usbd!_URB_HEADER);
  328. switch (ReadField(Function)) {
  329. case URB_FUNCTION_SELECT_INTERFACE:
  330. InitTypeReadCheck (urbLoc, usbd!_URB_SELECT_INTERFACE);
  331. dprintf ("Select Interface: ConfigHandle %x Interface %x\n",
  332. (ULONG) ReadField(UrbSelectInterface.ConfigurationHandle),
  333. (ULONG) ReadField(UrbSelectInterface.Interface));
  334. URB_HEADER();
  335. break;
  336. case URB_FUNCTION_SELECT_CONFIGURATION:
  337. InitTypeReadCheck (urbLoc, usbd!_URB_SELECT_CONFIGURATION);
  338. dprintf ("Select Config: Config Desc %x Hand %x Int %x\n",
  339. (ULONG) ReadField(UrbSelectConfiguration.ConfigurationDescriptor),
  340. (ULONG) ReadField(UrbSelectConfiguration.ConfigurationHandle),
  341. (ULONG) ReadField(UrbSelectConfiguration.Interface));
  342. URB_HEADER();
  343. break;
  344. case URB_FUNCTION_ABORT_PIPE:
  345. InitTypeReadCheck (urbLoc, usbd!_URB_PIPE_REQUEST);
  346. dprintf ("Abort Pipe: %x\n", (ULONG) ReadField(UrbPipeRequest.PipeHandle));
  347. URB_HEADER();
  348. break;
  349. case URB_FUNCTION_RESET_PIPE:
  350. InitTypeReadCheck (urbLoc, usbd!_URB_PIPE_REQUEST);
  351. dprintf ("Reset Pipe: %x\n", (ULONG) ReadField(UrbPipeRequest.PipeHandle));
  352. URB_HEADER();
  353. break;
  354. case URB_FUNCTION_TAKE_FRAME_LENGTH_CONTROL:
  355. InitTypeReadCheck (urbLoc, usbd!_URB_FRAME_LENGTH_CONTROL);
  356. dprintf ("Get Frame Length Control \n");
  357. URB_HEADER();
  358. break;
  359. case URB_FUNCTION_RELEASE_FRAME_LENGTH_CONTROL:
  360. InitTypeReadCheck (urbLoc, usbd!_URB_FRAME_LENGTH_CONTROL);
  361. dprintf ("Release Frame Length Control \n");
  362. URB_HEADER();
  363. break;
  364. case URB_FUNCTION_GET_FRAME_LENGTH:
  365. InitTypeReadCheck (urbLoc, usbd!_URB_GET_FRAME_LENGTH);
  366. dprintf ("Get Frame Length %x Num %x \n",
  367. (ULONG) ReadField(UrbGetFrameLength.FrameLength),
  368. (ULONG) ReadField(UrbGetFrameLength.FrameNumber));
  369. URB_HEADER();
  370. break;
  371. case URB_FUNCTION_SET_FRAME_LENGTH:
  372. InitTypeReadCheck (urbLoc, usbd!_URB_SET_FRAME_LENGTH);
  373. dprintf ("Set Frame Length Delta %x \n",
  374. (ULONG) ReadField(UrbSetFrameLength.FrameLengthDelta));
  375. URB_HEADER();
  376. break;
  377. case URB_FUNCTION_GET_CURRENT_FRAME_NUMBER:
  378. InitTypeReadCheck (urbLoc, usbd!_URB_GET_CURRENT_FRAME_NUMBER);
  379. dprintf ("Current Frame Number %x \n",
  380. (ULONG) ReadField(UrbGetCurrentFrameNumber.FrameNumber));
  381. URB_HEADER();
  382. break;
  383. case URB_FUNCTION_CONTROL_TRANSFER:
  384. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_TRANSFER);
  385. dprintf ("Control Xfer: Pipe %x Flags %x "
  386. "Len %x Buffer %x MDL %x HCA %x "
  387. "SetupPacket: %02.02x %02.02x %02.02x %02.02x "
  388. "%02.02x %02.02x %02.02x %02.02x\n",
  389. (ULONG) ReadField(UrbControlTransfer.PipeHandle),
  390. (ULONG) ReadField(UrbControlTransfer.TransferFlags),
  391. (ULONG) ReadField(UrbControlTransfer.TransferBufferLength),
  392. (ULONG) ReadField(UrbControlTransfer.TransferBuffer),
  393. (ULONG) ReadField(UrbControlTransfer.TransferBufferMDL),
  394. (ULONG) ReadField(UrbControlTransfer.hca),
  395. (ULONG) ReadField(UrbControlTransfer.SetupPacket[0]),
  396. (ULONG) ReadField(UrbControlTransfer.SetupPacket[1]),
  397. (ULONG) ReadField(UrbControlTransfer.SetupPacket[2]),
  398. (ULONG) ReadField(UrbControlTransfer.SetupPacket[3]),
  399. (ULONG) ReadField(UrbControlTransfer.SetupPacket[4]),
  400. (ULONG) ReadField(UrbControlTransfer.SetupPacket[5]),
  401. (ULONG) ReadField(UrbControlTransfer.SetupPacket[6]),
  402. (ULONG) ReadField(UrbControlTransfer.SetupPacket[7]));
  403. URB_HCD_AREA ( ReadField(UrbControlTransfer.hca));
  404. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_TRANSFER);
  405. URB_HEADER();
  406. urbLoc = ReadField(UrbControlTransfer.UrbLink);
  407. again = TRUE;
  408. break;
  409. case URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
  410. InitTypeReadCheck (urbLoc, usbd!_URB_BULK_OR_INTERRUPT_TRANSFER);
  411. dprintf ("Bulk | Interrupt Xfer: Pipe %x Flags %x "
  412. "Len %x Buffer %x MDL %x HCA %x\n",
  413. (ULONG) ReadField(UrbBulkOrInterruptTransfer.PipeHandle),
  414. (ULONG) ReadField(UrbBulkOrInterruptTransfer.TransferFlags),
  415. (ULONG) ReadField(UrbBulkOrInterruptTransfer.TransferBufferLength),
  416. (ULONG) ReadField(UrbBulkOrInterruptTransfer.TransferBuffer),
  417. (ULONG) ReadField(UrbBulkOrInterruptTransfer.TransferBufferMDL),
  418. (ULONG) ReadField(UrbControlTransfer.hca));
  419. URB_HCD_AREA (ReadField(UrbBulkOrInterruptTransfer.hca));
  420. InitTypeReadCheck (urbLoc, usbd!_URB_BULK_OR_INTERRUPT_TRANSFER);
  421. URB_HEADER();
  422. urbLoc = ReadField(UrbBulkOrInterruptTransfer.UrbLink);
  423. again = TRUE;
  424. break;
  425. case URB_FUNCTION_ISOCH_TRANSFER: {
  426. ULONG Off, Sz, NumberOfPackets;
  427. InitTypeReadCheck (urbLoc, usbd!_URB_ISOCH_TRANSFER);
  428. dprintf ("Isoch Xfer: Pipe %x Flags %x "
  429. "Len %x Buffer %x MDL %x HCA %p "
  430. "StartFrame %x NumPkts %x ErrorCount %x\n",
  431. (ULONG) ReadField(UrbIsochronousTransfer.PipeHandle),
  432. (ULONG) ReadField(UrbIsochronousTransfer.TransferFlags),
  433. (ULONG) ReadField(UrbIsochronousTransfer.TransferBufferLength),
  434. (ULONG) ReadField(UrbIsochronousTransfer.TransferBuffer),
  435. (ULONG) ReadField(UrbIsochronousTransfer.TransferBufferMDL),
  436. ReadField(UrbIsochronousTransfer.hca),
  437. (ULONG) ReadField(UrbIsochronousTransfer.StartFrame),
  438. (ULONG) ReadField(UrbIsochronousTransfer.NumberOfPackets),
  439. (ULONG) ReadField(UrbIsochronousTransfer.ErrorCount));
  440. URB_HCD_AREA (ReadField(UrbIsochronousTransfer.hca));
  441. InitTypeReadCheck (urbLoc, usbd!_URB_ISOCH_TRANSFER);
  442. URB_HEADER();
  443. NumberOfPackets = (ULONG) ReadField(UrbIsochronousTransfer.NumberOfPackets);
  444. GetFieldOffset("usbd!_URB_ISOCH_TRANSFER", "IsoPacket", &Off);
  445. Sz = GetTypeSize("usbd!USBD_ISO_PACKET_DESCRIPTOR");
  446. packetLoc = urbLoc + Off;
  447. for (i = 0; i < NumberOfPackets; i++) {
  448. InitTypeReadCheck (packetLoc, usbd!USBD_ISO_PACKET_DESCRIPTOR);
  449. dprintf ("[%2x]: Offset %6x, Length %4x, Status %8x\n",
  450. i,
  451. (ULONG) ReadField(Offset),
  452. (ULONG) ReadField(Length),
  453. (ULONG) ReadField(Status));
  454. packetLoc += Sz;
  455. }
  456. break;
  457. }
  458. case URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE:
  459. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_DESCRIPTOR_REQUEST);
  460. dprintf ("Device Desc: Length %x Buffer %x MDL %x "
  461. "Index %x Type %x Lang %x HCA %x\n",
  462. (ULONG) ReadField(UrbControlDescriptorRequest.TransferBufferLength),
  463. (ULONG) ReadField(UrbControlDescriptorRequest.TransferBuffer),
  464. (ULONG) ReadField(UrbControlDescriptorRequest.TransferBufferMDL),
  465. (ULONG) ReadField(UrbControlDescriptorRequest.Index),
  466. (ULONG) ReadField(UrbControlDescriptorRequest.DescriptorType),
  467. (ULONG) ReadField(UrbControlDescriptorRequest.LanguageId),
  468. (ULONG) ReadField(UrbControlDescriptorRequest.hca));
  469. URB_HEADER();
  470. urbLoc = ReadField(UrbControlDescriptorRequest.UrbLink);
  471. again = TRUE;
  472. break;
  473. case URB_FUNCTION_GET_DESCRIPTOR_FROM_ENDPOINT:
  474. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_DESCRIPTOR_REQUEST);
  475. dprintf ("Endpoint Desc: Length %x Buffer %x MDL %x "
  476. "Index %x Type %x Lang %x HCA %p\n",
  477. (ULONG) ReadField(UrbControlDescriptorRequest.TransferBufferLength),
  478. (ULONG) ReadField(UrbControlDescriptorRequest.TransferBuffer),
  479. (ULONG) ReadField(UrbControlDescriptorRequest.TransferBufferMDL),
  480. (ULONG) ReadField(UrbControlDescriptorRequest.Index),
  481. (ULONG) ReadField(UrbControlDescriptorRequest.DescriptorType),
  482. (ULONG) ReadField(UrbControlDescriptorRequest.LanguageId),
  483. (ULONG) ReadField(UrbControlDescriptorRequest.hca));
  484. URB_HEADER();
  485. urbLoc = ReadField(UrbControlDescriptorRequest.UrbLink);
  486. again = TRUE;
  487. break;
  488. case URB_FUNCTION_GET_DESCRIPTOR_FROM_INTERFACE:
  489. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_DESCRIPTOR_REQUEST);
  490. dprintf ("Interface Desc: Length %x Buffer %x MDL %x "
  491. "Index %x Type %x Lang %x HCA %p\n",
  492. (ULONG) ReadField(UrbControlDescriptorRequest.TransferBufferLength),
  493. (ULONG) ReadField(UrbControlDescriptorRequest.TransferBuffer),
  494. (ULONG) ReadField(UrbControlDescriptorRequest.TransferBufferMDL),
  495. (ULONG) ReadField(UrbControlDescriptorRequest.Index),
  496. (ULONG) ReadField(UrbControlDescriptorRequest.DescriptorType),
  497. (ULONG) ReadField(UrbControlDescriptorRequest.LanguageId),
  498. (ULONG) ReadField(UrbControlDescriptorRequest.hca));
  499. URB_HEADER();
  500. urbLoc = ReadField(UrbBulkOrInterruptTransfer.UrbLink);
  501. again = TRUE;
  502. break;
  503. case URB_FUNCTION_SET_DESCRIPTOR_TO_DEVICE:
  504. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_DESCRIPTOR_REQUEST);
  505. dprintf ("SET Device Desc: Length %x Buffer %x MDL %x "
  506. "Index %x Type %x Lang %x HCA %p\n",
  507. (ULONG) ReadField(UrbControlDescriptorRequest.TransferBufferLength),
  508. (ULONG) ReadField(UrbControlDescriptorRequest.TransferBuffer),
  509. (ULONG) ReadField(UrbControlDescriptorRequest.TransferBufferMDL),
  510. (ULONG) ReadField(UrbControlDescriptorRequest.Index),
  511. (ULONG) ReadField(UrbControlDescriptorRequest.DescriptorType),
  512. (ULONG) ReadField(UrbControlDescriptorRequest.LanguageId),
  513. ReadField(UrbControlDescriptorRequest.hca));
  514. URB_HEADER();
  515. urbLoc = (ULONG) (ULONG) ReadField(UrbControlDescriptorRequest.UrbLink);
  516. again = TRUE;
  517. break;
  518. case URB_FUNCTION_SET_DESCRIPTOR_TO_ENDPOINT:
  519. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_DESCRIPTOR_REQUEST);
  520. dprintf ("SET End Desc: Length %x Buffer %x MDL %x "
  521. "Index %x Type %x Lang %x HCA %p\n",
  522. (ULONG) ReadField(UrbControlDescriptorRequest.TransferBufferLength),
  523. (ULONG) ReadField(UrbControlDescriptorRequest.TransferBuffer),
  524. (ULONG) ReadField(UrbControlDescriptorRequest.TransferBufferMDL),
  525. (ULONG) ReadField(UrbControlDescriptorRequest.Index),
  526. (ULONG) ReadField(UrbControlDescriptorRequest.DescriptorType),
  527. (ULONG) ReadField(UrbControlDescriptorRequest.LanguageId),
  528. ReadField(UrbControlDescriptorRequest.hca));
  529. URB_HEADER();
  530. urbLoc = ReadField(UrbControlDescriptorRequest.UrbLink);
  531. again = TRUE;
  532. break;
  533. case URB_FUNCTION_SET_DESCRIPTOR_TO_INTERFACE:
  534. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_DESCRIPTOR_REQUEST);
  535. dprintf ("SET Intrfc Desc: Len %x Buffer %x MDL %x "
  536. "Index %x Type %x Lang %x HCA %p\n",
  537. (ULONG) ReadField(UrbControlDescriptorRequest.TransferBufferLength),
  538. (ULONG) ReadField(UrbControlDescriptorRequest.TransferBuffer),
  539. (ULONG) ReadField(UrbControlDescriptorRequest.TransferBufferMDL),
  540. (ULONG) ReadField(UrbControlDescriptorRequest.Index),
  541. (ULONG) ReadField(UrbControlDescriptorRequest.DescriptorType),
  542. (ULONG) ReadField(UrbControlDescriptorRequest.LanguageId),
  543. ReadField(UrbControlDescriptorRequest.hca));
  544. URB_HEADER();
  545. urbLoc = ReadField(UrbControlDescriptorRequest.UrbLink);
  546. again = TRUE;
  547. break;
  548. case URB_FUNCTION_SET_FEATURE_TO_DEVICE:
  549. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_FEATURE_REQUEST);
  550. dprintf ("Set Dev Feature: Selector %x Index %x\n",
  551. (ULONG) ReadField(UrbControlFeatureRequest.FeatureSelector),
  552. (ULONG) ReadField(UrbControlFeatureRequest.Index));
  553. URB_HEADER();
  554. urbLoc = ReadField(UrbControlFeatureRequest.UrbLink);
  555. again = TRUE;
  556. break;
  557. case URB_FUNCTION_SET_FEATURE_TO_INTERFACE:
  558. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_FEATURE_REQUEST);
  559. dprintf ("Set Interface Feature: Selector %x Index %x\n",
  560. (ULONG) ReadField(UrbControlFeatureRequest.FeatureSelector),
  561. (ULONG) ReadField(UrbControlFeatureRequest.Index));
  562. URB_HEADER();
  563. urbLoc = ReadField(UrbControlFeatureRequest.UrbLink);
  564. again = TRUE;
  565. break;
  566. case URB_FUNCTION_SET_FEATURE_TO_ENDPOINT:
  567. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_FEATURE_REQUEST);
  568. dprintf ("Set Endpoint Feature: Selector %x Index %x\n",
  569. (ULONG) ReadField(UrbControlFeatureRequest.FeatureSelector),
  570. (ULONG) ReadField(UrbControlFeatureRequest.Index));
  571. URB_HEADER();
  572. urbLoc = ReadField(UrbControlFeatureRequest.UrbLink);
  573. again = TRUE;
  574. break;
  575. case URB_FUNCTION_SET_FEATURE_TO_OTHER:
  576. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_FEATURE_REQUEST);
  577. dprintf ("Set Other Feature: Selector %x Index %x\n",
  578. (ULONG) ReadField(UrbControlFeatureRequest.FeatureSelector),
  579. (ULONG) ReadField(UrbControlFeatureRequest.Index));
  580. URB_HEADER();
  581. urbLoc = ReadField(UrbControlFeatureRequest.UrbLink);
  582. again = TRUE;
  583. break;
  584. case URB_FUNCTION_CLEAR_FEATURE_TO_DEVICE:
  585. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_FEATURE_REQUEST);
  586. dprintf ("Clear Device Feature: Selector %x Index %x\n",
  587. (ULONG) ReadField(UrbControlFeatureRequest.FeatureSelector),
  588. (ULONG) ReadField(UrbControlFeatureRequest.Index));
  589. URB_HEADER();
  590. urbLoc = ReadField(UrbControlFeatureRequest.UrbLink);
  591. again = TRUE;
  592. break;
  593. case URB_FUNCTION_CLEAR_FEATURE_TO_INTERFACE:
  594. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_FEATURE_REQUEST);
  595. dprintf ("Clear Interface Feature: Selector %x Index %x\n",
  596. (ULONG) ReadField(UrbControlFeatureRequest.FeatureSelector),
  597. (ULONG) ReadField(UrbControlFeatureRequest.Index));
  598. URB_HEADER();
  599. urbLoc = ReadField(UrbControlFeatureRequest.UrbLink);
  600. again = TRUE;
  601. break;
  602. case URB_FUNCTION_CLEAR_FEATURE_TO_ENDPOINT:
  603. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_FEATURE_REQUEST);
  604. dprintf ("Clear Endpoint Feature: Selector %x Index %x\n",
  605. (ULONG) ReadField(UrbControlFeatureRequest.FeatureSelector),
  606. (ULONG) ReadField(UrbControlFeatureRequest.Index));
  607. URB_HEADER();
  608. urbLoc = ReadField(UrbControlFeatureRequest.UrbLink);
  609. again = TRUE;
  610. break;
  611. case URB_FUNCTION_CLEAR_FEATURE_TO_OTHER:
  612. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_FEATURE_REQUEST);
  613. dprintf ("Clear Other Feature: Selector %x Index %x\n",
  614. (ULONG) ReadField(UrbControlFeatureRequest.FeatureSelector),
  615. (ULONG) ReadField(UrbControlFeatureRequest.Index));
  616. URB_HEADER();
  617. urbLoc = ReadField(UrbControlFeatureRequest.UrbLink);
  618. again = TRUE;
  619. break;
  620. case URB_FUNCTION_GET_STATUS_FROM_DEVICE:
  621. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_GET_STATUS_REQUEST);
  622. dprintf ("Get Device Status: len %x Buffer %x MDL %x "
  623. "Index %x\n",
  624. (ULONG) ReadField(UrbControlGetStatusRequest.TransferBufferLength),
  625. (ULONG) ReadField(UrbControlGetStatusRequest.TransferBuffer),
  626. (ULONG) ReadField(UrbControlGetStatusRequest.TransferBufferMDL),
  627. (ULONG) ReadField(UrbControlGetStatusRequest.Index));
  628. URB_HEADER();
  629. urbLoc = ReadField(UrbControlGetStatusRequest.UrbLink);
  630. again = TRUE;
  631. break;
  632. case URB_FUNCTION_GET_STATUS_FROM_INTERFACE:
  633. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_GET_STATUS_REQUEST);
  634. dprintf ("Get Interface Status: len %x Buffer %x MDL %x "
  635. "Index %x\n",
  636. (ULONG) ReadField(UrbControlGetStatusRequest.TransferBufferLength),
  637. (ULONG) ReadField(UrbControlGetStatusRequest.TransferBuffer),
  638. (ULONG) ReadField(UrbControlGetStatusRequest.TransferBufferMDL),
  639. (ULONG) ReadField(UrbControlGetStatusRequest.Index));
  640. URB_HEADER();
  641. urbLoc = ReadField(UrbControlGetStatusRequest.UrbLink);
  642. again = TRUE;
  643. break;
  644. case URB_FUNCTION_GET_STATUS_FROM_ENDPOINT:
  645. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_GET_STATUS_REQUEST);
  646. dprintf ("Get Endpoint Status: len %x Buffer %x MDL %x "
  647. "Index %x\n",
  648. (ULONG) ReadField(UrbControlGetStatusRequest.TransferBufferLength),
  649. (ULONG) ReadField(UrbControlGetStatusRequest.TransferBuffer),
  650. (ULONG) ReadField(UrbControlGetStatusRequest.TransferBufferMDL),
  651. (ULONG) ReadField(UrbControlGetStatusRequest.Index));
  652. URB_HEADER();
  653. urbLoc = ReadField(UrbControlGetStatusRequest.UrbLink);
  654. again = TRUE;
  655. break;
  656. case URB_FUNCTION_GET_STATUS_FROM_OTHER:
  657. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_GET_STATUS_REQUEST);
  658. dprintf ("Get Other Status: len %x Buffer %x MDL %x "
  659. "Index %x\n",
  660. (ULONG) ReadField(UrbControlGetStatusRequest.TransferBufferLength),
  661. (ULONG) ReadField(UrbControlGetStatusRequest.TransferBuffer),
  662. (ULONG) ReadField(UrbControlGetStatusRequest.TransferBufferMDL),
  663. (ULONG) ReadField(UrbControlGetStatusRequest.Index));
  664. URB_HEADER();
  665. urbLoc = ReadField(UrbControlGetStatusRequest.UrbLink);
  666. again = TRUE;
  667. break;
  668. case URB_FUNCTION_VENDOR_DEVICE:
  669. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_VENDOR_OR_CLASS_REQUEST);
  670. dprintf ("Vendor Device Req: len %x Buffer %x MDL %x "
  671. "Flags %x RequestTypeBits %x "
  672. "Request %x Value %x Index %x\n",
  673. (ULONG) ReadField(UrbControlVendorClassRequest.TransferBufferLength),
  674. (ULONG) ReadField(UrbControlVendorClassRequest.TransferBuffer),
  675. (ULONG) ReadField(UrbControlVendorClassRequest.TransferBufferMDL),
  676. (ULONG) ReadField(UrbControlVendorClassRequest.TransferFlags),
  677. (ULONG) ReadField(UrbControlVendorClassRequest.RequestTypeReservedBits),
  678. (ULONG) ReadField(UrbControlVendorClassRequest.Request),
  679. (ULONG) ReadField(UrbControlVendorClassRequest.Value),
  680. (ULONG) ReadField(UrbControlVendorClassRequest.Index));
  681. URB_HEADER();
  682. urbLoc = ReadField(UrbBulkOrInterruptTransfer.UrbLink);
  683. again = TRUE;
  684. break;
  685. case URB_FUNCTION_VENDOR_INTERFACE:
  686. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_VENDOR_OR_CLASS_REQUEST);
  687. dprintf ("Vendor Intfc Req: len %x Buffer %x MDL %x "
  688. "Flags %x RequestTypeBits %x "
  689. "Request %x Value %x Index %x\n",
  690. (ULONG) ReadField(UrbControlVendorClassRequest.TransferBufferLength),
  691. (ULONG) ReadField(UrbControlVendorClassRequest.TransferBuffer),
  692. (ULONG) ReadField(UrbControlVendorClassRequest.TransferBufferMDL),
  693. (ULONG) ReadField(UrbControlVendorClassRequest.TransferFlags),
  694. (ULONG) ReadField(UrbControlVendorClassRequest.RequestTypeReservedBits),
  695. (ULONG) ReadField(UrbControlVendorClassRequest.Request),
  696. (ULONG) ReadField(UrbControlVendorClassRequest.Value),
  697. (ULONG) ReadField(UrbControlVendorClassRequest.Index));
  698. URB_HEADER();
  699. urbLoc = ReadField(UrbBulkOrInterruptTransfer.UrbLink);
  700. again = TRUE;
  701. break;
  702. case URB_FUNCTION_VENDOR_ENDPOINT:
  703. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_VENDOR_OR_CLASS_REQUEST);
  704. dprintf ("Vendor Endpt Req: len %x Buffer %x MDL %x "
  705. "Flags %x RequestTypeBits %x "
  706. "Request %x Value %x Index %x\n",
  707. (ULONG) ReadField(UrbControlVendorClassRequest.TransferBufferLength),
  708. (ULONG) ReadField(UrbControlVendorClassRequest.TransferBuffer),
  709. (ULONG) ReadField(UrbControlVendorClassRequest.TransferBufferMDL),
  710. (ULONG) ReadField(UrbControlVendorClassRequest.TransferFlags),
  711. (ULONG) ReadField(UrbControlVendorClassRequest.RequestTypeReservedBits),
  712. (ULONG) ReadField(UrbControlVendorClassRequest.Request),
  713. (ULONG) ReadField(UrbControlVendorClassRequest.Value),
  714. (ULONG) ReadField(UrbControlVendorClassRequest.Index));
  715. URB_HEADER();
  716. urbLoc = ReadField(UrbBulkOrInterruptTransfer.UrbLink);
  717. again = TRUE;
  718. break;
  719. case URB_FUNCTION_VENDOR_OTHER:
  720. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_VENDOR_OR_CLASS_REQUEST);
  721. dprintf ("Vendor Other Req: len %x Buffer %x MDL %x "
  722. "Flags %x RequestTypeBits %x "
  723. "Request %x Value %x Index %x\n",
  724. (ULONG) ReadField(UrbControlVendorClassRequest.TransferBufferLength),
  725. (ULONG) ReadField(UrbControlVendorClassRequest.TransferBuffer),
  726. (ULONG) ReadField(UrbControlVendorClassRequest.TransferBufferMDL),
  727. (ULONG) ReadField(UrbControlVendorClassRequest.TransferFlags),
  728. (ULONG) ReadField(UrbControlVendorClassRequest.RequestTypeReservedBits),
  729. (ULONG) ReadField(UrbControlVendorClassRequest.Request),
  730. (ULONG) ReadField(UrbControlVendorClassRequest.Value),
  731. (ULONG) ReadField(UrbControlVendorClassRequest.Index));
  732. URB_HEADER();
  733. urbLoc = ReadField(UrbBulkOrInterruptTransfer.UrbLink);
  734. again = TRUE;
  735. break;
  736. case URB_FUNCTION_CLASS_DEVICE:
  737. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_VENDOR_OR_CLASS_REQUEST);
  738. dprintf ("Class Device Req: len %x Buffer %x MDL %x "
  739. "Flags %x RequestTypeBits %x "
  740. "Request %x Value %x Index %x\n",
  741. (ULONG) ReadField(UrbControlVendorClassRequest.TransferBufferLength),
  742. (ULONG) ReadField(UrbControlVendorClassRequest.TransferBuffer),
  743. (ULONG) ReadField(UrbControlVendorClassRequest.TransferBufferMDL),
  744. (ULONG) ReadField(UrbControlVendorClassRequest.TransferFlags),
  745. (ULONG) ReadField(UrbControlVendorClassRequest.RequestTypeReservedBits),
  746. (ULONG) ReadField(UrbControlVendorClassRequest.Request),
  747. (ULONG) ReadField(UrbControlVendorClassRequest.Value),
  748. (ULONG) ReadField(UrbControlVendorClassRequest.Index));
  749. URB_HEADER();
  750. urbLoc = ReadField(UrbBulkOrInterruptTransfer.UrbLink);
  751. again = TRUE;
  752. break;
  753. case URB_FUNCTION_CLASS_INTERFACE:
  754. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_VENDOR_OR_CLASS_REQUEST);
  755. dprintf ("Class Intface Req: len %x Buffer %x MDL %x "
  756. "Flags %x RequestTypeBits %x "
  757. "Request %x Value %x Index %x\n",
  758. (ULONG) ReadField(UrbControlVendorClassRequest.TransferBufferLength),
  759. (ULONG) ReadField(UrbControlVendorClassRequest.TransferBuffer),
  760. (ULONG) ReadField(UrbControlVendorClassRequest.TransferBufferMDL),
  761. (ULONG) ReadField(UrbControlVendorClassRequest.TransferFlags),
  762. (ULONG) ReadField(UrbControlVendorClassRequest.RequestTypeReservedBits),
  763. (ULONG) ReadField(UrbControlVendorClassRequest.Request),
  764. (ULONG) ReadField(UrbControlVendorClassRequest.Value),
  765. (ULONG) ReadField(UrbControlVendorClassRequest.Index));
  766. URB_HEADER();
  767. urbLoc = ReadField(UrbBulkOrInterruptTransfer.UrbLink);
  768. again = TRUE;
  769. break;
  770. case URB_FUNCTION_CLASS_ENDPOINT:
  771. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_VENDOR_OR_CLASS_REQUEST);
  772. dprintf ("Class Endpnt Req: len %x Buffer %x MDL %x "
  773. "Flags %x RequestTypeBits %x "
  774. "Request %x Value %x Index %x\n",
  775. (ULONG) ReadField(UrbControlVendorClassRequest.TransferBufferLength),
  776. (ULONG) ReadField(UrbControlVendorClassRequest.TransferBuffer),
  777. (ULONG) ReadField(UrbControlVendorClassRequest.TransferBufferMDL),
  778. (ULONG) ReadField(UrbControlVendorClassRequest.TransferFlags),
  779. (ULONG) ReadField(UrbControlVendorClassRequest.RequestTypeReservedBits),
  780. (ULONG) ReadField(UrbControlVendorClassRequest.Request),
  781. (ULONG) ReadField(UrbControlVendorClassRequest.Value),
  782. (ULONG) ReadField(UrbControlVendorClassRequest.Index));
  783. URB_HEADER();
  784. urbLoc = ReadField(UrbBulkOrInterruptTransfer.UrbLink);
  785. again = TRUE;
  786. break;
  787. case URB_FUNCTION_CLASS_OTHER:
  788. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_VENDOR_OR_CLASS_REQUEST);
  789. dprintf ("Class Other Req: len %x Buffer %x MDL %x "
  790. "Flags %x RequestTypeBits %x "
  791. "Request %x Value %x Index %x\n",
  792. (ULONG) ReadField(UrbControlVendorClassRequest.TransferBufferLength),
  793. (ULONG) ReadField(UrbControlVendorClassRequest.TransferBuffer),
  794. (ULONG) ReadField(UrbControlVendorClassRequest.TransferBufferMDL),
  795. (ULONG) ReadField(UrbControlVendorClassRequest.TransferFlags),
  796. (ULONG) ReadField(UrbControlVendorClassRequest.RequestTypeReservedBits),
  797. (ULONG) ReadField(UrbControlVendorClassRequest.Request),
  798. (ULONG) ReadField(UrbControlVendorClassRequest.Value),
  799. (ULONG) ReadField(UrbControlVendorClassRequest.Index));
  800. URB_HEADER();
  801. urbLoc = ReadField(UrbBulkOrInterruptTransfer.UrbLink);
  802. again = TRUE;
  803. break;
  804. case URB_FUNCTION_GET_CONFIGURATION:
  805. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_GET_CONFIGURATION_REQUEST);
  806. dprintf ("Get Configuration: len %x Buffer %x MDL %x "
  807. "\n",
  808. (ULONG) ReadField(UrbControlGetConfigurationRequest.TransferBufferLength),
  809. (ULONG) ReadField(UrbControlGetConfigurationRequest.TransferBuffer),
  810. (ULONG) ReadField(UrbControlGetConfigurationRequest.TransferBufferMDL));
  811. URB_HEADER();
  812. urbLoc = ReadField(UrbControlGetConfigurationRequest.UrbLink);
  813. again = TRUE;
  814. break;
  815. case URB_FUNCTION_GET_INTERFACE:
  816. InitTypeReadCheck (urbLoc, usbd!_URB_CONTROL_GET_INTERFACE_REQUEST);
  817. dprintf ("Get Interface: len %x Buffer %x MDL %x "
  818. "\n",
  819. (ULONG) ReadField(UrbControlGetInterfaceRequest.TransferBufferLength),
  820. (ULONG) ReadField(UrbControlGetInterfaceRequest.TransferBuffer),
  821. (ULONG) ReadField(UrbControlGetInterfaceRequest.TransferBufferMDL));
  822. URB_HEADER();
  823. urbLoc = ReadField(UrbControlGetConfigurationRequest.UrbLink);
  824. again = TRUE;
  825. break;
  826. case URB_FUNCTION_HCD_OPEN_ENDPOINT:
  827. InitTypeReadCheck (urbLoc, usbd!_HCD_URB);
  828. dprintf ("HCD: Open: DevAddr %x EndDesc %x "
  829. "Xfer %x HcdEndpoint %x ",
  830. (ULONG) ReadField(HcdUrbOpenEndpoint.DeviceAddress),
  831. (ULONG) ReadField(HcdUrbOpenEndpoint.EndpointDescriptor),
  832. (ULONG) ReadField(HcdUrbOpenEndpoint.MaxTransferSize),
  833. (ULONG) ReadField(HcdUrbOpenEndpoint.HcdEndpoint));
  834. //
  835. // JD is currently in the process of changing this interface...It has
  836. // already been changed for Win98 OSR but changes to hcdi.h have not
  837. // yet been checked in for Win2k. But we'll anticipate those changes and
  838. // make a conditional define here.
  839. //
  840. // #ifdef USBD_EP_FLAG_LOWSPEED
  841. // if ((ULONG) ReadField(HcdUrbOpenEndpoint.HcdEndpointFlags) & USBD_EP_FLAG_LOWSPEED) {
  842. // #else
  843. if (ReadField(HcdUrbOpenEndpoint.LowSpeed)) {
  844. // #endif
  845. dprintf ("LowSpeed ");
  846. }
  847. // #ifdef USBD_EP_FLAG_NEVERHALT
  848. // if ((ULONG) ReadField(HcdUrbOpenEndpoint.HcdEndpointFlags) & USBD_EP_FLAG_NEVERHALT) {
  849. // #else
  850. if (ReadField(HcdUrbOpenEndpoint.NeverHalt)) {
  851. // #endif
  852. dprintf ("NeverHalt");
  853. }
  854. dprintf ("\n");
  855. InitTypeReadCheck (urbLoc, uabd!_URB_HCD_OPEN_ENDPOINT);
  856. URB_HEADER();
  857. break;
  858. case URB_FUNCTION_HCD_CLOSE_ENDPOINT:
  859. InitTypeReadCheck (urbLoc, usbd!_HCD_URB);
  860. dprintf ("HCD: Close Endpoint: HcdEndpoint %x \n",
  861. (ULONG) ReadField(HcdUrbCloseEndpoint.HcdEndpoint));
  862. InitTypeReadCheck (urbLoc, _URB_HCD_CLOSE_ENDPOINT);
  863. URB_HEADER();
  864. break;
  865. case URB_FUNCTION_HCD_GET_ENDPOINT_STATE:
  866. InitTypeReadCheck (urbLoc, usbd!_HCD_URB);
  867. dprintf ("HCD: Get Endpoint State: HcdEndpoint %x state %x \n",
  868. (ULONG) ReadField(HcdUrbEndpointState.HcdEndpoint),
  869. (ULONG) ReadField(HcdUrbEndpointState.HcdEndpointState));
  870. InitTypeReadCheck (urbLoc, usbd!_URB_HCD_ENDPOINT_STATE);
  871. URB_HEADER();
  872. break;
  873. case URB_FUNCTION_HCD_SET_ENDPOINT_STATE:
  874. InitTypeReadCheck (urbLoc, usbd!_HCD_URB);
  875. dprintf ("HCD: Set Endpoint State: HcdEndpoint %x state %x \n",
  876. (ULONG) ReadField(HcdUrbEndpointState.HcdEndpoint),
  877. (ULONG) ReadField(HcdUrbEndpointState.HcdEndpointState));
  878. URB_HEADER();
  879. break;
  880. case URB_FUNCTION_HCD_ABORT_ENDPOINT:
  881. InitTypeReadCheck (urbLoc, usbd!_HCD_URB);
  882. dprintf ("HCD: Abort Endpoint: HcdEndpoint %x \n",
  883. (ULONG) ReadField(HcdUrbAbortEndpoint.HcdEndpoint));
  884. InitTypeReadCheck (urbLoc, usbd!_URB_HCD_ABORT_ENDPOINT);
  885. URB_HEADER();
  886. break;
  887. default:
  888. dprintf ("WARNING Unkown urb type %x\n", (ULONG) ReadField(Function));
  889. }
  890. }
  891. }
  892. VOID
  893. DevExtUsbd(
  894. ULONG64 MemLocPtr
  895. )
  896. /*++
  897. Routine Description:
  898. Dump a USBD Device extension.
  899. Arguments:
  900. Extension Address of the extension to be dumped.
  901. Return Value:
  902. None.
  903. --*/
  904. {
  905. ULONG result, Flags, HcWakeFlags, DeviceHackFlags;
  906. ULONG64 MemLoc = MemLocPtr, TrueDeviceExtension;
  907. // USBD_EXTENSION usbd;
  908. dprintf ("Dump USBD Extension: %p\n", MemLoc);
  909. if (!ReadPointer(MemLoc, &TrueDeviceExtension)) {
  910. dprintf ("Could not read Usbd Extension\n");
  911. return;
  912. }
  913. if (TrueDeviceExtension) {
  914. MemLoc = TrueDeviceExtension;
  915. }
  916. InitTypeReadCheck(MemLoc, usbd!_USBD_EXTENSION);
  917. dprintf ("True DevExt: %p, Flags %x ",
  918. ReadField(TrueDeviceExtension),
  919. (Flags = (ULONG) ReadField(Flags)));
  920. PRINT_FLAGS (Flags, USBDFLAG_PDO_REMOVED);
  921. PRINT_FLAGS (Flags, USBDFLAG_HCD_SHUTDOWN);
  922. dprintf ("\n");
  923. dprintf ("Hcd Calls: RhPo %x DefStart %x SetPo %x GetFrame %x\n",
  924. (ULONG) ReadField(RootHubPower),
  925. (ULONG) ReadField(HcdDeferredStartDevice),
  926. (ULONG) ReadField(HcdSetDevicePowerState),
  927. (ULONG) ReadField(HcdGetCurrentFrame));
  928. dprintf ("\n");
  929. dprintf ("HcCurrentPowerState %x, PendingWake %x, HcWake %x\n",
  930. (ULONG) ReadField(HcCurrentDevicePowerState),
  931. (ULONG) ReadField(PendingWakeIrp),
  932. (ULONG) ReadField(HcWakeIrp));
  933. DumpDeviceCapabilities ( ReadField(HcDeviceCapabilities));
  934. DumpDeviceCapabilities ( ReadField(RootHubDeviceCapabilities));
  935. dprintf ("Power Irp %p", ReadField(PowerIrp));
  936. dprintf ("Address List: %x %x %x %x\n",
  937. (ULONG) ReadField(AddressList[0]),
  938. (ULONG) ReadField(AddressList[1]),
  939. (ULONG) ReadField(AddressList[2]),
  940. (ULONG) ReadField(AddressList[3]));
  941. dprintf ("DeviceLinkUnicode String (%x %x) %p\n",
  942. (ULONG) ReadField(DeviceLinkUnicodeString.Length),
  943. (ULONG) ReadField(DeviceLinkUnicodeString.MaximumLength),
  944. ReadField(DeviceLinkUnicodeString.Buffer));
  945. // dprintf ("Diag Mode (& %x == %x) Flags (& %x == %x)\n",
  946. dprintf ("Diag Mode (%x) Flags (%x)\n",
  947. // MemLoc + FIELD_OFFSET (USBD_EXTENSION, DiagnosticMode),
  948. (ULONG) ReadField(DiagnosticMode),
  949. // MemLoc + FIELD_OFFSET (USBD_EXTENSION, DiagIgnoreHubs),
  950. (ULONG) ReadField(DiagIgnoreHubs));
  951. dprintf ("\n");
  952. dprintf ("HcWakeFlags %x ", HcWakeFlags = (ULONG) ReadField(HcWakeFlags));
  953. PRINT_FLAGS (HcWakeFlags, HC_ENABLED_FOR_WAKEUP);
  954. PRINT_FLAGS (HcWakeFlags, HC_WAKE_PENDING);
  955. dprintf ("\n");
  956. dprintf ("DeviceHackFlags %x ", DeviceHackFlags = (ULONG) ReadField(DeviceHackFlags));
  957. PRINT_FLAGS (DeviceHackFlags, USBD_DEVHACK_SLOW_ENUMERATION);
  958. PRINT_FLAGS (DeviceHackFlags, USBD_DEVHACK_DISABLE_SN);
  959. dprintf ("\n");
  960. dprintf ("RootHubDeviceData %x\n", (ULONG) ReadField(RootHubDeviceData));
  961. dprintf ("RootHubPowerState %x SuspendPowerState %x \n",
  962. (ULONG) ReadField(RootHubDeviceState),
  963. (ULONG) ReadField(SuspendPowerState));
  964. dprintf ("RootHubSymLink (%x %x) %p\n",
  965. (ULONG) ReadField(RootHubSymbolicLinkName.Length),
  966. (ULONG) ReadField(RootHubSymbolicLinkName.MaximumLength),
  967. ReadField(RootHubSymbolicLinkName.Buffer));
  968. }
  969. VOID
  970. USBD_DeviceHandle(
  971. ULONG64 MemLoc
  972. )
  973. {
  974. ULONG Sig;
  975. InitTypeReadCheck(MemLoc, usbd!_USBD_DEVICE_DATA);
  976. Sig = (ULONG) ReadField(Sig);
  977. dprintf("Signature: %c%c%c%c\n"
  978. "DeviceAddress: %d\n"
  979. "Config Handle: %08x\n"
  980. "LowSpeed: %d\n"
  981. "AcceptingRequests: %d\n",
  982. ((PUCHAR) &Sig)[0],
  983. ((PUCHAR) &Sig)[1],
  984. ((PUCHAR) &Sig)[2],
  985. ((PUCHAR) &Sig)[3],
  986. (ULONG) ReadField(DeviceAddress),
  987. (ULONG) ReadField(ConfigurationHandle),
  988. (ULONG) ReadField(LowSpeed),
  989. (ULONG) ReadField(AcceptingRequests));
  990. dprintf("\n");
  991. dprintf("Default Pipe\n"
  992. "------------");
  993. USBD_Pipe("", ReadField(DefaultPipe));
  994. dprintf("\n");
  995. dprintf("Device Descriptor\n"
  996. "-----------------");
  997. USBD_DeviceDescriptor("", ReadField(DeviceDescriptor));
  998. dprintf("\n");
  999. dprintf("Configuration Handle\n"
  1000. "--------------------\n");
  1001. USBD_ConfigHandle( ReadField(ConfigurationHandle));
  1002. return;
  1003. }