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.

660 lines
23 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. Openhci.c
  5. Abstract:
  6. WinDbg Extension Api
  7. Author:
  8. Kenneth D. Ray (kenray) June 1997
  9. Environment:
  10. User Mode.
  11. Revision History:
  12. --*/
  13. #include "precomp.h"
  14. #define PRINT_FLAGS(value, flag) \
  15. if ((value) & (flag)) { \
  16. dprintf (#flag " "); \
  17. }
  18. #define PRINT_VALUE(value) \
  19. case (value): \
  20. dprintf(#value); \
  21. break;
  22. #define InitTypeReadCheck(Addr, Type) \
  23. if (GetShortField(Addr, "openhci!" #Type, 1)) { \
  24. dprintf("Cannot read %s at %p\n", Addr); \
  25. return; \
  26. }
  27. VOID
  28. DevExtOpenHCI(
  29. ULONG64 MemLocPtr
  30. )
  31. {
  32. ULONG64 MemLoc = MemLocPtr;
  33. ULONG result;
  34. ULONG i;
  35. ULONG64 TrueDeviceExtension;
  36. ULONG HcFlags, Sz;
  37. ULONG64 EDList;
  38. dprintf ("Dump OpenHCI Extension: %p\n", MemLoc);
  39. if (!ReadPointer (MemLoc, &TrueDeviceExtension)) {
  40. dprintf ("Could not read Usbd Extension\n");
  41. return;
  42. }
  43. if (0 != TrueDeviceExtension) {
  44. MemLoc = TrueDeviceExtension;
  45. }
  46. InitTypeReadCheck(MemLoc, HCD_DEVICE_DATA);
  47. // dprintf ("DebugLevel (& %x = %x) DeviceNameHandle %x \n",
  48. // MemLoc + FIELD_OFFSET (HCD_DEVICE_DATA, DebugLevel),
  49. dprintf ("DebugLevel (%x) DeviceNameHandle %x \n",
  50. (ULONG) ReadField(DebugLevel),
  51. (ULONG) ReadField(DeviceNameHandle));
  52. dprintf ("\n");
  53. dprintf ("HcFlags %x: ", HcFlags = (ULONG) ReadField(HcFlags));
  54. PRINT_FLAGS (HcFlags, HC_FLAG_REMOTE_WAKEUP_CONNECTED);
  55. PRINT_FLAGS (HcFlags, HC_FLAG_LEGACY_BIOS_DETECTED);
  56. PRINT_FLAGS (HcFlags, HC_FLAG_SLOW_BULK_ENABLE);
  57. PRINT_FLAGS (HcFlags, HC_FLAG_SHUTDOWN);
  58. PRINT_FLAGS (HcFlags, HC_FLAG_MAP_SX_TO_D3);
  59. PRINT_FLAGS (HcFlags, HC_FLAG_IDLE);
  60. PRINT_FLAGS (HcFlags, HC_FLAG_DISABLE_IDLE_CHECK);
  61. PRINT_FLAGS (HcFlags, HC_FLAG_DEVICE_STARTED);
  62. PRINT_FLAGS (HcFlags, HC_FLAG_LOST_POWER);
  63. PRINT_FLAGS (HcFlags, HC_FLAG_DISABLE_IDLE_MODE);
  64. PRINT_FLAGS (HcFlags, HC_FLAG_USE_HYDRA_HACK);
  65. PRINT_FLAGS (HcFlags, HC_FLAG_LIST_FIX_ENABLE);
  66. PRINT_FLAGS (HcFlags, HC_FLAG_HUNG_CHECK_ENABLE);
  67. dprintf ("\n");
  68. dprintf ("Adapter %8x MapRegisters %8x Interrupt %x\n"
  69. "HC %8x HCCA %8x HcDma %x\n"
  70. "Free Desc %8x PageList (& %x)\n",
  71. (ULONG) ReadField(AdapterObject),
  72. (ULONG) ReadField(NumberOfMapRegisters),
  73. (ULONG) ReadField(InterruptObject),
  74. (ULONG) ReadField(HC),
  75. (ULONG) ReadField(HCCA),
  76. (ULONG) ReadField(HcDma),
  77. (ULONG) ReadField(FreeDescriptorList),
  78. (ULONG) ReadField(PageList));
  79. dprintf ("\n");
  80. /*
  81. dprintf ("StalledEDReclamation & %x = (%x %x) \n",
  82. "RunningEDReclamation & %x = (%x %x) \n",
  83. "PausedEDRestart & %x = (%x %x) \n",
  84. "ActiveEndpointList & %x = (%x %x) \n",
  85. MemLoc + FIELD_OFFSET (HCD_DEVICE_DATA, StalledEDReclamation),
  86. (ULONG) ReadField(StalledEDReclamation.Flink),
  87. (ULONG) ReadField(StalledEDReclamation.Blink),
  88. MemLoc + FIELD_OFFSET (HCD_DEVICE_DATA, RunningEDReclamation),
  89. (ULONG) ReadField(RunningEDReclamation.Flink),
  90. (ULONG) ReadField(RunningEDReclamation.Blink),
  91. MemLoc + FIELD_OFFSET (HCD_DEVICE_DATA, PausedEDRestart),
  92. (ULONG) ReadField(PausedEDRestart.Flink),
  93. (ULONG) ReadField(PausedEDRestart.Blink),
  94. MemLoc + FIELD_OFFSET (HCD_DEVICE_DATA, ActiveEndpointList),
  95. (ULONG) ReadField(ActiveEndpointList.Flink),
  96. (ULONG) ReadField(ActiveEndpointList.Blink));*/
  97. dprintf ("StalledEDReclamation = (%p %p) \n",
  98. "RunningEDReclamation = (%p %p) \n",
  99. "PausedEDRestart = (%p %p) \n",
  100. "ActiveEndpointList = (%p %p) \n",
  101. ReadField(StalledEDReclamation.Flink),
  102. ReadField(StalledEDReclamation.Blink),
  103. ReadField(RunningEDReclamation.Flink),
  104. ReadField(RunningEDReclamation.Blink),
  105. ReadField(PausedEDRestart.Flink),
  106. ReadField(PausedEDRestart.Blink),
  107. ReadField(ActiveEndpointList.Flink),
  108. ReadField(ActiveEndpointList.Blink));
  109. dprintf ("EDList ");
  110. Sz = GetTypeSize("HCD_ED_LIST");
  111. EDList = ReadField(EDList[0]);
  112. for (i = 0; i < NO_ED_LISTS; i++) {
  113. ULONG64 tmp;
  114. ReadPointer(EDList + i*Sz, &tmp);
  115. dprintf ("%p ", tmp);
  116. if ((i & 3) == 3) {
  117. dprintf ("\n ");
  118. }
  119. }
  120. dprintf ("\n");
  121. dprintf ("CurrentHCControl %x, ListEnablesAtNextSOF %x\n\n"
  122. "OrigInt %8x FrameHigh %8x AvailBW %8x MaxBW %8x\n",
  123. (ULONG) ReadField(CurrentHcControl),
  124. (ULONG) ReadField(ListEnablesAtNextSOF),
  125. (ULONG) ReadField(OriginalInterval),
  126. (ULONG) ReadField(FrameHighPart),
  127. (ULONG) ReadField(AvailableBandwidth),
  128. (ULONG) ReadField(MaxBandwidthInUse));
  129. dprintf ("\n");
  130. dprintf ("LostDoneHeadCount %d ResurrectHCCount %d\n"
  131. "FrozenHcDoneHead %8x LastHccaDoneHead %8x\n"
  132. "Last Idle Time %8x IdleTime %8x \n"
  133. "InterruptShare %x\n",
  134. (ULONG) ReadField(LostDoneHeadCount),
  135. (ULONG) ReadField(ResurrectHCCount),
  136. (ULONG) ReadField(FrozenHcDoneHead),
  137. (ULONG) ReadField(LastHccaDoneHead),
  138. (ULONG) ReadField(LastIdleTime),
  139. (ULONG) ReadField(IdleTime),
  140. (ULONG) ReadField(InterruptShare));
  141. dprintf ("\n");
  142. dprintf ("RHCtrl %8x RHInt %8x RHAddr %8x \n"
  143. "RHPortsSusp %8x RHPortsEnabled %8x\n"
  144. "CurrentPowerState %8x RHConfig %8x\n"
  145. "NumPorts %8x ZLEndpointAddr %8x\n",
  146. (ULONG) ReadField(RootHubControl),
  147. (ULONG) ReadField(RootHubInterrupt),
  148. (ULONG) ReadField(RootHubAddress),
  149. (ULONG) ReadField(PortsSuspendedAtSuspend),
  150. (ULONG) ReadField(PortsEnabledAtSuspend),
  151. (ULONG) ReadField(CurrentDevicePowerState),
  152. (ULONG) ReadField(RootHubConfig),
  153. (ULONG) ReadField(NumberOfPorts),
  154. (ULONG) ReadField(ZeroLoadEndpoint_AddrHolder));
  155. dprintf ("VendorID %x DeviceID %x RevID %x\n",
  156. (ULONG) ReadField(VendorID),
  157. (ULONG) ReadField(DeviceID),
  158. (ULONG) ReadField(RevisionID));
  159. dprintf ("\n");
  160. }
  161. VOID
  162. OhciHcdTd (
  163. ULONG64 MemLoc
  164. )
  165. {
  166. InitTypeReadCheck(MemLoc, HCD_TRANSFER_DESCRIPTOR);
  167. dprintf ("OhciHcdTD %p: %x %x %x %x\n"
  168. "Packet & %x PhysAddr %x\n",
  169. MemLoc,
  170. (ULONG) ReadField(HcTD.Control),
  171. (ULONG) ReadField(HcTD.CBP),
  172. (ULONG) ReadField(HcTD.NextTD),
  173. (ULONG) ReadField(HcTD.BE),
  174. (ULONG) ReadField(HcTD.Packet),
  175. (ULONG) ReadField(PhysicalAddress));
  176. // dprintf ("ReqList & %x = (%x, %x)\n",
  177. // MemLoc + FIELD_OFFSET (HCD_TRANSFER_DESCRIPTOR, RequestList),
  178. dprintf ("ReqList = (%p, %p)\n",
  179. ReadField(RequestList.Flink),
  180. ReadField(RequestList.Blink));
  181. dprintf ("Next HcdTd %x UsbdReq %x Endpoint %x TransferCount %x\n"
  182. "BaseIsocOffset %x Cancelled %x Flags %x",
  183. (ULONG) ReadField(NextHcdTD),
  184. (ULONG) ReadField(UsbdRequest),
  185. (ULONG) ReadField(Endpoint),
  186. (ULONG) ReadField(TransferCount),
  187. (ULONG) ReadField(BaseIsocURBOffset),
  188. (ULONG) ReadField(Canceled),
  189. (ULONG) ReadField(Flags));
  190. }
  191. VOID
  192. OhciHcdEd (
  193. ULONG64 MemLoc
  194. )
  195. {
  196. InitTypeReadCheck(MemLoc, HCD_ENDPOINT_DESCRIPTOR);
  197. dprintf ("OhciHcED %p: %x %x %x %x\n"
  198. "PhysicalAddress %x Link = (%x %x)\n",
  199. MemLoc,
  200. (ULONG) ReadField(HcED.Control),
  201. (ULONG) ReadField(HcED.TailP),
  202. (ULONG) ReadField(HcED.HeadP),
  203. (ULONG) ReadField(HcED.NextED),
  204. (ULONG) ReadField(PhysicalAddress),
  205. // MemLoc + FIELD_OFFSET (HCD_ENDPOINT_DESCRIPTOR, Link),
  206. (ULONG) ReadField(Link.Flink),
  207. (ULONG) ReadField(Link.Blink));
  208. dprintf ("Endpoint %x RecFram %x ListIndex %x Paused %x Flags %x\n",
  209. (ULONG) ReadField(Endpoint),
  210. (ULONG) ReadField(ReclamationFrame),
  211. (ULONG) ReadField(ListIndex),
  212. (ULONG) ReadField(PauseFlag),
  213. (ULONG) ReadField(Flags));
  214. // dprintf ("PausedLink & %x = (%x %x)\n",
  215. // MemLoc + FIELD_OFFSET (HCD_ENDPOINT_DESCRIPTOR, PausedLink),
  216. dprintf ("PausedLink = (%p %p)\n",
  217. ReadField(PausedLink.Flink),
  218. ReadField(PausedLink.Blink));
  219. }
  220. VOID
  221. OhciEndpoint (
  222. ULONG64 MemLoc
  223. )
  224. {
  225. InitTypeReadCheck(MemLoc, HCD_ENDPOINT);
  226. dprintf ("Endpoint %p\n", MemLoc);
  227. dprintf ("Sig %x HcdED %x Head %x Tail %x EpFlags %x Rate %x\n",
  228. (ULONG) ReadField(Sig),
  229. (ULONG) ReadField(HcdED),
  230. (ULONG) ReadField(HcdHeadP),
  231. (ULONG) ReadField(HcdTailP),
  232. (ULONG) ReadField(EpFlags),
  233. (ULONG) ReadField(Rate));
  234. dprintf ("RequestQueue = (%p %p)\n"
  235. "EndpointListEntry = (%p %p)\n",
  236. // MemLoc + FIELD_OFFSET (HCD_ENDPOINT, RequestQueue),
  237. ReadField(RequestQueue.Flink),
  238. ReadField(RequestQueue.Blink),
  239. // MemLoc + FIELD_OFFSET (HCD_ENDPOINT, EndpointListEntry),
  240. ReadField(EndpointListEntry.Flink),
  241. ReadField(EndpointListEntry.Blink));
  242. dprintf ("EndStatus %x MaxReq %x Type %x ListInd %x BW %x\n"
  243. "DeviceData %x DescResv %x Close %x BootedBW %x NextIsoFree %x\n"
  244. "MaxTrans %x TrueTail %x AbortIrp %x\n",
  245. (ULONG) ReadField(EndpointStatus),
  246. (ULONG) ReadField(MaxRequest),
  247. (ULONG) ReadField(Type),
  248. (ULONG) ReadField(ListIndex),
  249. (ULONG) ReadField(Bandwidth),
  250. (ULONG) ReadField(DeviceData),
  251. (ULONG) ReadField(DescriptorsReserved),
  252. (ULONG) ReadField(Closing),
  253. (ULONG) ReadField(BootedForBandwidth),
  254. (ULONG) ReadField(NextIsoFreeFrame),
  255. (ULONG) ReadField(MaxTransfer),
  256. (ULONG) ReadField(TrueTail),
  257. (ULONG) ReadField(AbortIrp));
  258. }
  259. VOID
  260. OhciHCRegisters(
  261. ULONG64 MemLoc
  262. )
  263. {
  264. ULONG HcInterruptStatus, HcInterruptEnable,HcInterruptDisable, HcRhStatus;
  265. ULONG i, NumberDownstreamPorts, Stat[20];
  266. InitTypeReadCheck(MemLoc, HC_OPERATIONAL_REGISTER);
  267. dprintf("\n");
  268. dprintf("Revision %x\n", (ULONG) ReadField(HcRevision.Rev));
  269. dprintf("Control: CBSR %2x: ",
  270. (ULONG) ReadField(HcControl.ControlBulkServiceRatio));
  271. switch ((ULONG) ReadField(HcControl.ControlBulkServiceRatio))
  272. {
  273. PRINT_VALUE(HcCtrl_CBSR_1_to_1);
  274. PRINT_VALUE(HcCtrl_CBSR_2_to_1);
  275. PRINT_VALUE(HcCtrl_CBSR_3_to_1);
  276. PRINT_VALUE(HcCtrl_CBSR_4_to_1);
  277. }
  278. dprintf("\n");
  279. dprintf(" PLE: %1x IE: %1x CLE: %1x BLE: %1x\n"
  280. " HCFS %2x: ",
  281. (ULONG) ReadField(HcControl.PeriodicListEnable),
  282. (ULONG) ReadField(HcControl.IsochronousEnable),
  283. (ULONG) ReadField(HcControl.ControlListEnable),
  284. (ULONG) ReadField(HcControl.BulkListEnable),
  285. (ULONG) ReadField(HcControl.HostControllerFunctionalState));
  286. switch((ULONG) ReadField(HcControl.HostControllerFunctionalState))
  287. {
  288. PRINT_VALUE(HcHCFS_USBReset);
  289. PRINT_VALUE(HcHCFS_USBResume);
  290. PRINT_VALUE(HcHCFS_USBOperational);
  291. PRINT_VALUE(HcHCFS_USBSuspend);
  292. }
  293. dprintf("\n");
  294. dprintf(" IR: %1x RWC: %1x RWE: %1x\n",
  295. (ULONG) ReadField(HcControl.InterruptRouting),
  296. (ULONG) ReadField(HcControl.RemoteWakeupConnected),
  297. (ULONG) ReadField(HcControl.RemoteWakeupEnable));
  298. dprintf("\n");
  299. dprintf("Command Status: HCR: %x CLF: %x BLF: %x OCR: %x SOC: %2x\n",
  300. (ULONG) ReadField(HcCommandStatus.HostControllerReset),
  301. (ULONG) ReadField(HcCommandStatus.ControlListFilled),
  302. (ULONG) ReadField(HcCommandStatus.BulkListFilled),
  303. (ULONG) ReadField(HcCommandStatus.OwnershipChangeRequest),
  304. (ULONG) ReadField(HcCommandStatus.SchedulingOverrunCount));
  305. dprintf("\n");
  306. dprintf("Interrupt Status %08x: ",
  307. HcInterruptStatus = (ULONG) ReadField(HcInterruptStatus));
  308. PRINT_FLAGS(HcInterruptStatus, HcInt_SchedulingOverrun);
  309. PRINT_FLAGS(HcInterruptStatus, HcInt_WritebackDoneHead);
  310. PRINT_FLAGS(HcInterruptStatus, HcInt_StartOfFrame);
  311. PRINT_FLAGS(HcInterruptStatus, HcInt_ResumeDetected);
  312. PRINT_FLAGS(HcInterruptStatus, HcInt_UnrecoverableError);
  313. PRINT_FLAGS(HcInterruptStatus, HcInt_FrameNumberOverflow);
  314. PRINT_FLAGS(HcInterruptStatus, HcInt_RootHubStatusChange);
  315. PRINT_FLAGS(HcInterruptStatus, HcInt_OwnershipChange);
  316. PRINT_FLAGS(HcInterruptStatus, HcInt_MasterInterruptEnable);
  317. dprintf("\n");
  318. dprintf("Interrupt Enable %08x: ",
  319. HcInterruptEnable = (ULONG) ReadField(HcInterruptEnable));
  320. PRINT_FLAGS(HcInterruptEnable, HcInt_SchedulingOverrun);
  321. PRINT_FLAGS(HcInterruptEnable, HcInt_WritebackDoneHead);
  322. PRINT_FLAGS(HcInterruptEnable, HcInt_StartOfFrame);
  323. PRINT_FLAGS(HcInterruptEnable, HcInt_ResumeDetected);
  324. PRINT_FLAGS(HcInterruptEnable, HcInt_UnrecoverableError);
  325. PRINT_FLAGS(HcInterruptEnable, HcInt_FrameNumberOverflow);
  326. PRINT_FLAGS(HcInterruptEnable, HcInt_RootHubStatusChange);
  327. PRINT_FLAGS(HcInterruptEnable, HcInt_OwnershipChange);
  328. PRINT_FLAGS(HcInterruptEnable, HcInt_MasterInterruptEnable);
  329. dprintf("\n");
  330. dprintf("Interrupt Disable %08x: ",
  331. HcInterruptDisable = (ULONG) ReadField(HcInterruptDisable));
  332. PRINT_FLAGS(HcInterruptDisable, HcInt_SchedulingOverrun);
  333. PRINT_FLAGS(HcInterruptDisable, HcInt_WritebackDoneHead);
  334. PRINT_FLAGS(HcInterruptDisable, HcInt_StartOfFrame);
  335. PRINT_FLAGS(HcInterruptDisable, HcInt_ResumeDetected);
  336. PRINT_FLAGS(HcInterruptDisable, HcInt_UnrecoverableError);
  337. PRINT_FLAGS(HcInterruptDisable, HcInt_FrameNumberOverflow);
  338. PRINT_FLAGS(HcInterruptDisable, HcInt_RootHubStatusChange);
  339. PRINT_FLAGS(HcInterruptDisable, HcInt_OwnershipChange);
  340. PRINT_FLAGS(HcInterruptDisable, HcInt_MasterInterruptEnable);
  341. dprintf("\n");
  342. dprintf("HCCA: %08x PeriodCurrentED: %08x\n"
  343. "ControlHeadED: %08x ControlCurrentED: %08x\n"
  344. "BulkHeadED: %08x BulkCurrentED: %08x\n"
  345. "HcDoneHead: %08x\n",
  346. (ULONG) ReadField(HcHCCA),
  347. (ULONG) ReadField(HcPeriodCurrentED),
  348. (ULONG) ReadField(HcControlHeadED),
  349. (ULONG) ReadField(HcControlCurrentED),
  350. (ULONG) ReadField(HcBulkHeadED),
  351. (ULONG) ReadField(HcBulkCurrentED),
  352. (ULONG) ReadField(HcDoneHead));
  353. dprintf("\n");
  354. dprintf("Frame Interval: FI: %8x FSLDP: %8x FIT: %x\n"
  355. "Frame Remaining: FR: %8x FRT: %8x\n",
  356. (ULONG) ReadField(HcFmInterval.FrameInterval),
  357. (ULONG) ReadField(HcFmInterval.FSLargestDataPacket),
  358. (ULONG) ReadField(HcFmInterval.FrameIntervalToggle),
  359. (ULONG) ReadField(HcFmRemaining.FrameRemaining),
  360. (ULONG) ReadField(HcFmRemaining.FrameRemainingToggle));
  361. dprintf("\n");
  362. dprintf("HcFmNumber: %x HcPeriodicStart: %x HcLSThreshold: %x\n",
  363. (ULONG) ReadField(HcFmNumber),
  364. (ULONG) ReadField(HcPeriodicStart),
  365. (ULONG) ReadField(HcLSThreshold));
  366. dprintf("\n");
  367. dprintf("RH Desc A: NDS: %d PSM: %x NPS: %x OCPM: %x NOP: %x POTPGT: %d\n",
  368. (ULONG) ReadField(HcRhDescriptorA.NumberDownstreamPorts),
  369. (ULONG) ReadField(HcRhDescriptorA.PowerSwitchingMode),
  370. (ULONG) ReadField(HcRhDescriptorA.NoPowerSwitching),
  371. (ULONG) ReadField(HcRhDescriptorA.OverCurrentProtectionMode),
  372. (ULONG) ReadField(HcRhDescriptorA.NoOverCurrentProtection),
  373. (ULONG) ReadField(HcRhDescriptorA.PowerOnToPowerGoodTime));
  374. dprintf("RH Desc B: DeviceRemovableMask: %x PortPowerControlMask: %x\n",
  375. (ULONG) ReadField(HcRhDescriptorB.DeviceRemovableMask),
  376. (ULONG) ReadField(HcRhDescriptorB.PortPowerControlMask));
  377. dprintf("RH Status (%08x): ", HcRhStatus = (ULONG) ReadField(HcRhStatus));
  378. PRINT_FLAGS(HcRhStatus, HcRhS_LocalPowerStatus);
  379. PRINT_FLAGS(HcRhStatus, HcRhS_OverCurrentIndicator);
  380. PRINT_FLAGS(HcRhStatus, HcRhS_DeviceRemoteWakeupEnable);
  381. PRINT_FLAGS(HcRhStatus, HcRhS_LocalPowerStatusChange);
  382. PRINT_FLAGS(HcRhStatus, HcRhS_OverCurrentIndicatorChange);
  383. dprintf("\n");
  384. dprintf("RH PortStatus: \n");
  385. NumberDownstreamPorts = (ULONG) ReadField(HcRhDescriptorA.NumberDownstreamPorts);
  386. GetFieldValue(MemLoc, "openhci!HC_OPERATIONAL_REGISTER", "HcRhPortStatus", Stat);
  387. for (i = 0; i < NumberDownstreamPorts; i++)
  388. {
  389. dprintf("Port %2d (%08x): ", i, Stat[i]);
  390. PRINT_FLAGS(Stat[i], HcRhPS_CurrentConnectStatus);
  391. PRINT_FLAGS(Stat[i], HcRhPS_PortEnableStatus);
  392. PRINT_FLAGS(Stat[i], HcRhPS_PortSuspendStatus);
  393. PRINT_FLAGS(Stat[i], HcRhPS_PortOverCurrentIndicator);
  394. PRINT_FLAGS(Stat[i], HcRhPS_PortResetStatus);
  395. PRINT_FLAGS(Stat[i], HcRhPS_PortPowerStatus);
  396. PRINT_FLAGS(Stat[i], HcRhPS_LowSpeedDeviceAttached);
  397. PRINT_FLAGS(Stat[i], HcRhPS_ConnectStatusChange);
  398. PRINT_FLAGS(Stat[i], HcRhPS_PortEnableStatusChange);
  399. PRINT_FLAGS(Stat[i], HcRhPS_PortSuspendStatusChange);
  400. PRINT_FLAGS(Stat[i], HcRhPS_OverCurrentIndicatorChange);
  401. PRINT_FLAGS(Stat[i], HcRhPS_PortResetStatusChange);
  402. dprintf("\n");
  403. }
  404. return;
  405. }
  406. VOID
  407. OhciHCCA(
  408. ULONG64 MemLoc
  409. )
  410. {
  411. ULONG Table[32];
  412. ULONG i;
  413. InitTypeReadCheck(MemLoc, "HCCA_BLOCK");
  414. dprintf("\n");
  415. GetFieldValue(MemLoc, "openhci!HCCA_BLOCK", "HccaInterruptTable", Table);
  416. for (i = 0; i < 32; i += 2)
  417. {
  418. dprintf("HccaInterruptTable[%2d]: %x, HccaInterruptTable[%2d]: %x\n",
  419. i,
  420. Table[i],
  421. i+1,
  422. Table[i+1]);
  423. }
  424. dprintf("HccaFrameNumber: %08x HccaDoneHead: %08x\n",
  425. ReadField(HccaFrameNumber),
  426. ReadField(HccaDoneHead));
  427. return;
  428. }
  429. VOID
  430. OhciHcEd(
  431. ULONG64 MemLoc
  432. )
  433. {
  434. ULONG Direction;
  435. InitTypeReadCheck(MemLoc, HC_ENDPOINT_DESCRIPTOR);
  436. dprintf("\n");
  437. dprintf("Endpoint Control: FA: %3d EPNum: %3d Dir: %2x: ",
  438. (ULONG) ReadField(FunctionAddress),
  439. (ULONG) ReadField(EndpointNumber),
  440. Direction = (ULONG) ReadField(Direction));
  441. switch(Direction)
  442. {
  443. PRINT_VALUE(HcEDDirection_Defer);
  444. PRINT_VALUE(HcEDDirection_In);
  445. PRINT_VALUE(HcEDDirection_Out);
  446. default:
  447. dprintf("Unknown HcED direction");
  448. }
  449. dprintf("\n");
  450. dprintf(" LS: %3x sKip: %3x Iso: %2x\n"
  451. " MPS: 0x%x\n",
  452. (ULONG) ReadField(LowSpeed),
  453. (ULONG) ReadField(sKip),
  454. (ULONG) ReadField(Isochronous),
  455. (ULONG) ReadField(MaxPacket));
  456. dprintf("\n");
  457. dprintf("TailP: %08x HeadP: %08x NextED: %08x\n",
  458. (ULONG) ReadField(TailP),
  459. (ULONG) ReadField(HeadP),
  460. (ULONG) ReadField(NextED));
  461. return;
  462. }
  463. VOID
  464. OhciHcTd(
  465. ULONG64 MemLoc
  466. )
  467. {
  468. ULONG Packet[16];
  469. ULONG i;
  470. InitTypeReadCheck(MemLoc, HC_TRANSFER_DESCRIPTOR);
  471. dprintf("\n");
  472. if ((ULONG) ReadField(IsochFlag))
  473. {
  474. dprintf("Iso TD: StartFrame: %x FrameCount: %d\n",
  475. (ULONG) ReadField(StartingFrame),
  476. (ULONG) ReadField(FrameCount));
  477. }
  478. else
  479. {
  480. dprintf("Non-Iso TD: ShortXferOk: %x\n"
  481. " Dir: %2x: ",
  482. (ULONG) ReadField(ShortXferOk),
  483. (ULONG) ReadField(Direction));
  484. switch((ULONG) ReadField(Direction))
  485. {
  486. PRINT_VALUE(HcTDDirection_Setup);
  487. PRINT_VALUE(HcTDDirection_In);
  488. PRINT_VALUE(HcTDDirection_Out);
  489. default:
  490. dprintf("Unknown HcTD direction");
  491. }
  492. dprintf("\n");
  493. dprintf(" IntDelay %x: ",
  494. (ULONG) ReadField(IntDelay));
  495. switch ((ULONG) ReadField(IntDelay))
  496. {
  497. PRINT_VALUE(HcTDIntDelay_0ms);
  498. PRINT_VALUE(HcTDIntDelay_1ms);
  499. PRINT_VALUE(HcTDIntDelay_2ms);
  500. PRINT_VALUE(HcTDIntDelay_3ms);
  501. PRINT_VALUE(HcTDIntDelay_4ms);
  502. PRINT_VALUE(HcTDIntDelay_5ms);
  503. PRINT_VALUE(HcTDIntDelay_6ms);
  504. PRINT_VALUE(HcTDIntDelay_NoInterrupt);
  505. }
  506. dprintf("\n");
  507. dprintf(" Toggle: %x",
  508. (ULONG) ReadField(Toggle));
  509. switch ((ULONG) ReadField(Toggle))
  510. {
  511. PRINT_VALUE(HcTDToggle_FromEd);
  512. PRINT_VALUE(HcTDToggle_Data0);
  513. PRINT_VALUE(HcTDToggle_Data1);
  514. default:
  515. dprintf("Unknown HcTD value");
  516. }
  517. dprintf("\n");
  518. dprintf(" ErrorCount: %d",
  519. (ULONG) ReadField(ErrorCount));
  520. dprintf(" ConditionCode: %x",
  521. (ULONG) ReadField(ConditionCode));
  522. switch ((ULONG) ReadField(ConditionCode))
  523. {
  524. PRINT_VALUE(HcCC_NoError);
  525. PRINT_VALUE(HcCC_CRC);
  526. PRINT_VALUE(HcCC_BitStuffing);
  527. PRINT_VALUE(HcCC_DataToggleMismatch);
  528. PRINT_VALUE(HcCC_Stall);
  529. PRINT_VALUE(HcCC_DeviceNotResponding);
  530. PRINT_VALUE(HcCC_PIDCheckFailure);
  531. PRINT_VALUE(HcCC_UnexpectedPID);
  532. PRINT_VALUE(HcCC_DataOverrun);
  533. PRINT_VALUE(HcCC_DataUnderrun);
  534. PRINT_VALUE(HcCC_BufferOverrun);
  535. PRINT_VALUE(HcCC_BufferUnderrun);
  536. PRINT_VALUE(HcCC_NotAccessed);
  537. default:
  538. dprintf("Unknown HcCC value");
  539. }
  540. dprintf("\n");
  541. }
  542. dprintf("CBP: %8x NextTD: %8x BE: %8x\n",
  543. (ULONG) ReadField(CBP),
  544. (ULONG) ReadField(NextTD),
  545. (ULONG) ReadField(BE));
  546. GetFieldValue(MemLoc, "openhci!HC_TRANSFER_DESCRIPTOR", "Packet", Packet);
  547. for (i = 0; i < 8; i += 2)
  548. {
  549. dprintf("PSW %d: %4x PSW %d: %4x\n",
  550. i,
  551. Packet[i],
  552. i+1,
  553. Packet[i+1]);
  554. }
  555. return;
  556. }