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.

1141 lines
25 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. debug.c
  5. Abstract:
  6. This module contains the enumerated for the ACPI driver, NT version
  7. Author:
  8. Stephane Plante (splante)
  9. Environment:
  10. NT Kernel Model Driver only
  11. --*/
  12. #include "pch.h"
  13. #if DBG
  14. #ifdef ALLOC_PRAGMA
  15. #pragma alloc_text(PAGE, ACPIDebugResourceDescriptor)
  16. #pragma alloc_text(PAGE, ACPIDebugResourceList)
  17. #pragma alloc_text(PAGE, ACPIDebugResourceRequirementsList)
  18. #pragma alloc_text(PAGE, ACPIDebugCmResourceList)
  19. #endif
  20. #define ACPI_DEBUG_BUFFER_SIZE 256
  21. PCCHAR ACPIDispatchPnpTableNames[ACPIDispatchPnpTableSize] = {
  22. "IRP_MN_START_DEVICE",
  23. "IRP_MN_QUERY_REMOVE_DEVICE",
  24. "IRP_MN_REMOVE_DEVICE",
  25. "IRP_MN_CANCEL_REMOVE_DEVICE",
  26. "IRP_MN_STOP_DEVICE",
  27. "IRP_MN_QUERY_STOP_DEVICE",
  28. "IRP_MN_CANCEL_STOP_DEVICE",
  29. "IRP_MN_QUERY_DEVICE_RELATIONS",
  30. "IRP_MN_QUERY_INTERFACE",
  31. "IRP_MN_QUERY_CAPABILITIES",
  32. "IRP_MN_QUERY_RESOURCES",
  33. "IRP_MN_QUERY_RESOURCE_REQUIREMENTS",
  34. "IRP_MN_QUERY_DEVICE_TEXT",
  35. "IRP_MN_FILTER_RESOURCE_REQUIREMENTS",
  36. "INVALID MINOR IRP CODE",
  37. "IRP_MN_READ_CONFIG",
  38. "IRP_MN_WRITE_CONFIG",
  39. "IRP_MN_EJECT",
  40. "IRP_MN_SET_LOCK",
  41. "IRP_MN_QUERY_ID",
  42. "IRP_MN_QUERY_PNP_DEVICE_STATE",
  43. "IRP_MN_QUERY_BUS_INFORMATION",
  44. "IRP_MN_DEVICE_USAGE_NOTIFICATION",
  45. "IRP_MN_SURPRISE_REMOVAL",
  46. "UNKNOWN PNP MINOR CODE"
  47. };
  48. PCCHAR ACPIDispatchPowerTableNames[ACPIDispatchPowerTableSize] = {
  49. "IRP_MN_WAIT_WAKE",
  50. "IRP_MN_POWER_SEQUENCE",
  51. "IRP_MN_SET_POWER",
  52. "IRP_MN_QUERY_POWER",
  53. "UNKNOWN POWER MINOR CODE"
  54. };
  55. PCCHAR ACPIDispatchUnknownTableName[1] = {
  56. "IRP_MN_????"
  57. };
  58. #endif
  59. VOID
  60. _ACPIInternalError(
  61. IN ULONG Bugcode
  62. )
  63. {
  64. KeBugCheckEx (ACPI_DRIVER_INTERNAL, 0x1, Bugcode, 0, 0);
  65. }
  66. #if DBG
  67. VOID
  68. ACPIDebugPrint(
  69. ULONG DebugPrintLevel,
  70. PCCHAR DebugMessage,
  71. ...
  72. )
  73. /*++
  74. Routine Description:
  75. This is the debug print routine for the NT side of things. This is
  76. here because we don't want to use the 'shared' ACPIPrint() function
  77. since we can't control it.
  78. Arguments:
  79. DebugPrintLevel - The bit mask that when anded with the debuglevel, must
  80. equal itself
  81. DebugMessage - The string to feed through vsprintf
  82. Return Value:
  83. None
  84. --*/
  85. {
  86. va_list ap;
  87. //
  88. // Get the variable arguments
  89. //
  90. va_start( ap, DebugMessage );
  91. //
  92. // Call the kernel function to print the message
  93. //
  94. vDbgPrintEx( DPFLTR_ACPI_ID, DebugPrintLevel, DebugMessage, ap );
  95. //
  96. // We are done with the varargs
  97. //
  98. va_end( ap );
  99. }
  100. VOID
  101. ACPIDebugDevicePrint(
  102. ULONG DebugPrintLevel,
  103. PVOID DebugExtension,
  104. PCCHAR DebugMessage,
  105. ...
  106. )
  107. /*++
  108. Routine Description:
  109. This is the debug print routine for the NT side of things. This routine
  110. is here to handle the case where we are printing information that is
  111. associated with a device extension.
  112. Arguments:
  113. DebugPrintLevel - The big mask that when and'ed with the debug level, must
  114. equal itself
  115. DeviceExtension - The device associated with the message
  116. DebugMessage - The string to feed through vsprintf
  117. Return Value:
  118. NTSTATUS
  119. ---*/
  120. {
  121. PDEVICE_EXTENSION deviceExtension = (PDEVICE_EXTENSION) DebugExtension;
  122. va_list ap;
  123. //
  124. // Get the variable arguments
  125. //
  126. va_start( ap, DebugMessage );
  127. //
  128. // What kind of device extension are we looking at?
  129. //
  130. if (deviceExtension->Flags & DEV_PROP_HID) {
  131. //
  132. // Now that we have a _HID, do we also have a _UID?
  133. //
  134. if (deviceExtension->Flags & DEV_PROP_UID) {
  135. DbgPrintEx(
  136. DPFLTR_ACPI_ID,
  137. DebugPrintLevel,
  138. "%p %s-%s ",
  139. deviceExtension,
  140. deviceExtension->DeviceID,
  141. deviceExtension->InstanceID
  142. );
  143. } else {
  144. DbgPrintEx(
  145. DPFLTR_ACPI_ID,
  146. DebugPrintLevel,
  147. "%p %s ",
  148. deviceExtension,
  149. deviceExtension->DeviceID
  150. );
  151. }
  152. } else if (deviceExtension->Flags & DEV_PROP_ADDRESS) {
  153. DbgPrintEx(
  154. DPFLTR_ACPI_ID,
  155. DebugPrintLevel,
  156. "%p %x ",
  157. deviceExtension,
  158. deviceExtension->Address
  159. );
  160. } else {
  161. DbgPrintEx(
  162. DPFLTR_ACPI_ID,
  163. DebugPrintLevel,
  164. "%p ",
  165. deviceExtension
  166. );
  167. }
  168. //
  169. // Call the kernel function to print the message
  170. //
  171. vDbgPrintEx( DPFLTR_ACPI_ID, DebugPrintLevel, DebugMessage, ap );
  172. //
  173. // We are done with the varargs
  174. //
  175. va_end( ap );
  176. }
  177. PCCHAR
  178. ACPIDebugGetIrpText(
  179. UCHAR MajorFunction,
  180. UCHAR MinorFunction
  181. )
  182. /*++
  183. Routine Description:
  184. This function returns a const pointer to the text string appropriate for
  185. the passed in major and minor IRP.
  186. Arguments:
  187. MajorFunction
  188. MinorFunction
  189. Return Value:
  190. const pointer to descriptive IRP text.
  191. --*/
  192. {
  193. ULONG index ;
  194. PCCHAR *minorTable ;
  195. switch(MajorFunction) {
  196. case IRP_MJ_PNP:
  197. index = ACPIDispatchPnpTableSize - 1;
  198. minorTable = ACPIDispatchPnpTableNames ;
  199. break;
  200. case IRP_MJ_POWER:
  201. index = ACPIDispatchPowerTableSize - 1;
  202. minorTable = ACPIDispatchPowerTableNames ;
  203. break;
  204. default:
  205. index = 0 ;
  206. minorTable = ACPIDispatchUnknownTableName ;
  207. break;
  208. }
  209. if (MinorFunction < index) {
  210. index = MinorFunction;
  211. }
  212. return minorTable[index];
  213. }
  214. VOID
  215. ACPIDebugResourceDescriptor(
  216. IN PIO_RESOURCE_DESCRIPTOR Descriptor,
  217. IN ULONG ListCount,
  218. IN ULONG DescCount
  219. )
  220. /*++
  221. Routine Description:
  222. This function dumps the contents of a single resource descriptor.
  223. Arguments:
  224. Descriptor - What to dump
  225. ListCount - The number of the current list
  226. DescCount - The number of the current descriptor
  227. --*/
  228. {
  229. PAGED_CODE();
  230. ASSERT( Descriptor != NULL );
  231. //
  232. // Dump the appropriate info
  233. //
  234. switch (Descriptor->Type) {
  235. case CmResourceTypePort:
  236. ACPIPrint( (
  237. ACPI_PRINT_RESOURCES_1,
  238. "[%2d] [%2d] %-9s MininumAddress = %#08lx MaximumAddress = %#08lx\n"
  239. " Length = %#08lx Alignment = %#08lx\n",
  240. ListCount,
  241. DescCount,
  242. "Port",
  243. Descriptor->u.Port.MinimumAddress.LowPart,
  244. Descriptor->u.Port.MaximumAddress.LowPart,
  245. Descriptor->u.Port.Length,
  246. Descriptor->u.Port.Alignment
  247. ) );
  248. break;
  249. case CmResourceTypeMemory:
  250. ACPIPrint( (
  251. ACPI_PRINT_RESOURCES_1,
  252. "[%2d] [%2d] %-9s MinimumAddress = %#08lx MaximumAddress = %#08lx\n"
  253. " Length = %#08lx Alignment = %#08lx\n",
  254. ListCount,
  255. DescCount,
  256. "Memory",
  257. Descriptor->u.Memory.MinimumAddress.LowPart,
  258. Descriptor->u.Memory.MaximumAddress.LowPart,
  259. Descriptor->u.Memory.Length,
  260. Descriptor->u.Memory.Alignment
  261. ) );
  262. break;
  263. case CmResourceTypeInterrupt:
  264. ACPIPrint( (
  265. ACPI_PRINT_RESOURCES_1,
  266. "[%2d] [%2d] %-9s MinimumVector = %#08lx MaximumVector = %#08lx\n",
  267. ListCount,
  268. DescCount,
  269. "Interrupt",
  270. Descriptor->u.Interrupt.MinimumVector,
  271. Descriptor->u.Interrupt.MaximumVector
  272. ) );
  273. break;
  274. case CmResourceTypeDma:
  275. ACPIPrint( (
  276. ACPI_PRINT_RESOURCES_1,
  277. "[%2d] [%2d] %-9s MinimumChannel = %#08lx MaximumChannel = %#08lx\n",
  278. ListCount,
  279. DescCount,
  280. "Dma",
  281. Descriptor->u.Dma.MinimumChannel,
  282. Descriptor->u.Dma.MaximumChannel
  283. ) );
  284. break;
  285. default:
  286. ACPIPrint( (
  287. ACPI_PRINT_RESOURCES_1,
  288. "[%2d] [%2d] Type = (%d)\n",
  289. ListCount,
  290. DescCount,
  291. Descriptor->Type
  292. ) );
  293. } // switch
  294. //
  295. // Dump the common info
  296. //
  297. ACPIPrint( (
  298. ACPI_PRINT_RESOURCES_1,
  299. " Option,Share = %#04lx%#04lx Flags = %#08lx\n",
  300. ListCount,
  301. DescCount,
  302. Descriptor->Option,
  303. Descriptor->ShareDisposition
  304. ) );
  305. } // for
  306. VOID
  307. ACPIDebugResourceList(
  308. IN PIO_RESOURCE_LIST List,
  309. IN ULONG Count
  310. )
  311. /*++
  312. Routine Description:
  313. This functions displays the contents of a single resource list, so that it
  314. can be checked by a human
  315. Arguments:
  316. List - List to dump
  317. Count - The List number (for visual reference)
  318. Return Value:
  319. None
  320. --*/
  321. {
  322. ULONG i;
  323. PAGED_CODE();
  324. ASSERT( List != NULL );
  325. ACPIPrint( (
  326. ACPI_PRINT_RESOURCES_1,
  327. "[%2d] %#04x Version = %#08lx Revision = %#08lx\n",
  328. Count,
  329. List->Count,
  330. List->Version,
  331. List->Revision
  332. ) );
  333. for (i = 0; i < List->Count; i++ ) {
  334. //
  335. // Print the info on the current element
  336. //
  337. ACPIDebugResourceDescriptor( &(List->Descriptors[i]), Count, i );
  338. }
  339. }
  340. VOID
  341. ACPIDebugResourceRequirementsList(
  342. IN PIO_RESOURCE_REQUIREMENTS_LIST List,
  343. IN PDEVICE_EXTENSION DeviceExtension
  344. )
  345. /*++
  346. Routine Description:
  347. This function displays a resource list in a method that can be checked
  348. for accuracy when the driver is loading up
  349. Arguments:
  350. List - The list to dump
  351. Object - NameSpace object associated with this list
  352. Return Value:
  353. None
  354. --*/
  355. {
  356. PUCHAR buffer;
  357. PIO_RESOURCE_LIST list;
  358. ULONG i;
  359. ULONG size;
  360. PAGED_CODE();
  361. ACPIDevPrint( (
  362. ACPI_PRINT_RESOURCES_1,
  363. DeviceExtension,
  364. "IoResourceRequirementsList @ %x\n",
  365. List
  366. ) );
  367. if (List == NULL) {
  368. return;
  369. }
  370. ACPIPrint( (
  371. ACPI_PRINT_RESOURCES_1,
  372. "%x size: %xb alternatives: %x bus type: %x bus number %x\n",
  373. List,
  374. List->ListSize,
  375. List->AlternativeLists,
  376. List->InterfaceType,
  377. List->BusNumber
  378. ) );
  379. //
  380. // Point to the first list
  381. //
  382. list = &(List->List[0]);
  383. buffer = (PUCHAR) list;
  384. for (i = 0; i < List->AlternativeLists && buffer < ( (PUCHAR)List + List->ListSize ); i++) {
  385. //
  386. // Dump the current list
  387. //
  388. ACPIDebugResourceList( list, i );
  389. //
  390. // Determine the size of the list, and find the next one
  391. //
  392. size = sizeof(IO_RESOURCE_LIST) + (list->Count - 1) * sizeof(IO_RESOURCE_DESCRIPTOR);
  393. buffer += size;
  394. //
  395. // This should be pointing at a list
  396. //
  397. list = (PIO_RESOURCE_LIST) buffer;
  398. }
  399. }
  400. VOID
  401. ACPIDebugCmResourceList(
  402. IN PCM_RESOURCE_LIST List,
  403. IN PDEVICE_EXTENSION DeviceExtension
  404. )
  405. /*++
  406. Routine Description:
  407. This function displays a resource list in a method that can be checked
  408. for accuracy when the driver is loading up
  409. Arguments:
  410. List - The list to dump
  411. Device - The associated device extension
  412. Return Value:
  413. None
  414. --*/
  415. {
  416. PCM_FULL_RESOURCE_DESCRIPTOR fullDesc;
  417. PCM_PARTIAL_RESOURCE_DESCRIPTOR partDesc;
  418. PUCHAR buffer;
  419. ULONG i;
  420. ULONG j;
  421. ULONG size;
  422. PAGED_CODE();
  423. ACPIDevPrint( (
  424. ACPI_PRINT_RESOURCES_1,
  425. DeviceExtension,
  426. "CmResourceList @ %x\n",
  427. List
  428. ) );
  429. if (List == NULL) {
  430. return;
  431. }
  432. if (List->Count == 0) {
  433. ACPIDevPrint( (
  434. ACPI_PRINT_RESOURCES_1,
  435. DeviceExtension,
  436. "There are no full resource descriptors in the list\n"
  437. ) );
  438. return;
  439. }
  440. //
  441. // Start to walk this data structure
  442. //
  443. fullDesc = &(List->List[0]);
  444. buffer = (PUCHAR) fullDesc;
  445. for (i = 0; i < List->Count; i++) {
  446. //
  447. // How long is the current list
  448. //
  449. size = sizeof(CM_FULL_RESOURCE_DESCRIPTOR) +
  450. (fullDesc->PartialResourceList.Count - 1) *
  451. sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
  452. //
  453. // Point the buffer there
  454. //
  455. buffer += size;
  456. //
  457. // Dump the information about the current list
  458. //
  459. ACPIPrint( (
  460. ACPI_PRINT_RESOURCES_1,
  461. "[%2d] BusNumber = %#04x Interface = %#04x\n"
  462. "[%2d] Count = %#04x Version = %#04x Revision = %#04x\n",
  463. i,
  464. fullDesc->BusNumber,
  465. fullDesc->InterfaceType,
  466. i,
  467. fullDesc->PartialResourceList.Count,
  468. fullDesc->PartialResourceList.Version,
  469. fullDesc->PartialResourceList.Revision
  470. ) );
  471. //
  472. // Walk this list
  473. //
  474. for (j = 0; j < fullDesc->PartialResourceList.Count; j++) {
  475. //
  476. // Current item
  477. //
  478. partDesc = &(fullDesc->PartialResourceList.PartialDescriptors[j]);
  479. //
  480. // Dump Principal Information...
  481. //
  482. switch (partDesc->Type) {
  483. case CmResourceTypePort:
  484. ACPIPrint( (
  485. ACPI_PRINT_RESOURCES_1,
  486. "[%2d] [%2d] %12s Start: %#08lx Length: %#08lx\n",
  487. i,
  488. j,
  489. "Port",
  490. partDesc->u.Port.Start.LowPart,
  491. partDesc->u.Port.Length
  492. ) );
  493. break;
  494. case CmResourceTypeInterrupt:
  495. ACPIPrint( (
  496. ACPI_PRINT_RESOURCES_1,
  497. "[%2d] [%2d] %12s Level: %#02x Vector: %#02x Affinity: %#08lx\n",
  498. i,
  499. j,
  500. "Interrupt",
  501. partDesc->u.Interrupt.Level,
  502. partDesc->u.Interrupt.Vector,
  503. partDesc->u.Interrupt.Affinity
  504. ) );
  505. break;
  506. case CmResourceTypeMemory:
  507. ACPIPrint( (
  508. ACPI_PRINT_RESOURCES_1,
  509. "[%2d] [%2d] %12s Start: %#08lx Length: %#08lx\n",
  510. i,
  511. j,
  512. "Memory",
  513. partDesc->u.Memory.Start.LowPart,
  514. partDesc->u.Memory.Length
  515. ) );
  516. break;
  517. case CmResourceTypeDma:
  518. ACPIPrint( (
  519. ACPI_PRINT_RESOURCES_1,
  520. "[%2d] [%2d] %12s Channel: %#02x Port: %#02x Reserved: %#02x\n",
  521. i,
  522. j,
  523. "Dma",
  524. partDesc->u.Dma.Channel,
  525. partDesc->u.Dma.Port,
  526. partDesc->u.Dma.Reserved1
  527. ) );
  528. break;
  529. default:
  530. ACPIPrint( (
  531. ACPI_PRINT_RESOURCES_1,
  532. "[%2d] [%2d] Type: %2d 1: %#08lx 2: %#08lx 3: %#08lx\n",
  533. i,
  534. j,
  535. partDesc->Type,
  536. partDesc->u.DeviceSpecificData.DataSize,
  537. partDesc->u.DeviceSpecificData.Reserved1,
  538. partDesc->u.DeviceSpecificData.Reserved2
  539. ) );
  540. break;
  541. }
  542. //
  543. // Dump ancillary info
  544. //
  545. ACPIPrint( (
  546. ACPI_PRINT_RESOURCES_1,
  547. " Flags: %#08lx Share: %#08lx\n",
  548. partDesc->Flags,
  549. partDesc->ShareDisposition
  550. ) );
  551. }
  552. //
  553. // Grab new list
  554. //
  555. fullDesc = (PCM_FULL_RESOURCE_DESCRIPTOR) buffer;
  556. }
  557. }
  558. VOID
  559. ACPIDebugDeviceCapabilities(
  560. IN PDEVICE_EXTENSION DeviceExtension,
  561. IN PDEVICE_CAPABILITIES DeviceCapabilities,
  562. IN PUCHAR Message
  563. )
  564. /*++
  565. Routine Description:
  566. This will display the device capabilities in an interesting format
  567. Arguments:
  568. DeviceExtension The device whose' capabilities we are dumping
  569. DeviceCapabilites The capabilities that we are interested in
  570. Message Message to print
  571. Return Value:
  572. None
  573. --*/
  574. {
  575. SYSTEM_POWER_STATE index;
  576. ACPIDevPrint( (
  577. ACPI_PRINT_SXD,
  578. DeviceExtension,
  579. " - %s - Capabilities @ %08lx\n",
  580. Message,
  581. DeviceCapabilities
  582. ) );
  583. ACPIDevPrint( (
  584. ACPI_PRINT_SXD,
  585. DeviceExtension,
  586. " -"
  587. ) );
  588. for (index = PowerSystemWorking; index < PowerSystemMaximum; index++) {
  589. if (DeviceCapabilities->DeviceState[index] == PowerSystemUnspecified) {
  590. ACPIPrint( (
  591. ACPI_PRINT_SXD,
  592. " S%d -> None",
  593. (index - 1)
  594. ) );
  595. } else {
  596. ACPIPrint( (
  597. ACPI_PRINT_SXD,
  598. " S%d -> D%x",
  599. (index - 1),
  600. (DeviceCapabilities->DeviceState[index] - 1)
  601. ) );
  602. }
  603. }
  604. ACPIPrint( (
  605. ACPI_PRINT_SXD,
  606. "\n"
  607. ) );
  608. ACPIDevPrint( (
  609. ACPI_PRINT_SXD,
  610. DeviceExtension,
  611. " -"
  612. ) );
  613. if (DeviceCapabilities->SystemWake == PowerSystemUnspecified) {
  614. ACPIPrint( (
  615. ACPI_PRINT_SXD,
  616. " SystemWake = None"
  617. ) );
  618. } else {
  619. ACPIPrint( (
  620. ACPI_PRINT_SXD,
  621. " SystemWake = S%d",
  622. (DeviceCapabilities->SystemWake - 1)
  623. ) );
  624. }
  625. if (DeviceCapabilities->DeviceWake == PowerDeviceUnspecified) {
  626. ACPIPrint( (
  627. ACPI_PRINT_SXD,
  628. " DeviceWake = None"
  629. ) );
  630. } else {
  631. ACPIPrint( (
  632. ACPI_PRINT_SXD,
  633. " DeviceWake = D%d",
  634. (DeviceCapabilities->DeviceWake - 1)
  635. ) );
  636. }
  637. if (DeviceCapabilities->DeviceD1) {
  638. ACPIPrint( (
  639. ACPI_PRINT_SXD,
  640. " DeviceD1"
  641. ) );
  642. }
  643. if (DeviceCapabilities->DeviceD2) {
  644. ACPIPrint( (
  645. ACPI_PRINT_SXD,
  646. " DeviceD2"
  647. ) );
  648. }
  649. if (DeviceCapabilities->WakeFromD0) {
  650. ACPIPrint( (
  651. ACPI_PRINT_SXD,
  652. " WakeD0"
  653. ) );
  654. }
  655. if (DeviceCapabilities->WakeFromD1) {
  656. ACPIPrint( (
  657. ACPI_PRINT_SXD,
  658. " WakeD1"
  659. ) );
  660. }
  661. if (DeviceCapabilities->WakeFromD2) {
  662. ACPIPrint( (
  663. ACPI_PRINT_SXD,
  664. " WakeD2"
  665. ) );
  666. }
  667. if (DeviceCapabilities->WakeFromD3) {
  668. ACPIPrint( (
  669. ACPI_PRINT_SXD,
  670. " WakeD3"
  671. ) );
  672. }
  673. ACPIPrint( (
  674. ACPI_PRINT_SXD,
  675. "\n"
  676. ) );
  677. }
  678. VOID
  679. ACPIDebugPowerCapabilities(
  680. IN PDEVICE_EXTENSION DeviceExtension,
  681. IN PUCHAR Message
  682. )
  683. /*++
  684. Routine Description:
  685. This will display the device capabilities in an interesting format
  686. Arguments:
  687. DeviceExtension The device whose' capabilities we are dumping
  688. Message Identify where capabilities are fron
  689. Return Value:
  690. --*/
  691. {
  692. PACPI_POWER_INFO powerInfo = &(DeviceExtension->PowerInfo);
  693. SYSTEM_POWER_STATE index;
  694. ACPIDevPrint( (
  695. ACPI_PRINT_SXD,
  696. DeviceExtension,
  697. " - %s - Internal Capabilities\n",
  698. Message
  699. ) );
  700. ACPIDevPrint( (
  701. ACPI_PRINT_SXD,
  702. DeviceExtension,
  703. " -"
  704. ) );
  705. for (index = PowerSystemWorking; index < PowerSystemMaximum; index++) {
  706. if (powerInfo->DevicePowerMatrix[index] == PowerSystemUnspecified) {
  707. ACPIPrint( (
  708. ACPI_PRINT_SXD,
  709. " S%d -> None",
  710. (index - 1)
  711. ) );
  712. } else {
  713. ACPIPrint( (
  714. ACPI_PRINT_SXD,
  715. " S%d -> D%x",
  716. (index - 1),
  717. (powerInfo->DevicePowerMatrix[index] - 1)
  718. ) );
  719. }
  720. }
  721. ACPIPrint( (
  722. ACPI_PRINT_SXD,
  723. "\n"
  724. ) );
  725. ACPIDevPrint( (
  726. ACPI_PRINT_SXD,
  727. DeviceExtension,
  728. " -"
  729. ) );
  730. if (powerInfo->SystemWakeLevel == PowerSystemUnspecified) {
  731. ACPIPrint( (
  732. ACPI_PRINT_SXD,
  733. " SystemWake = None"
  734. ) );
  735. } else {
  736. ACPIPrint( (
  737. ACPI_PRINT_SXD,
  738. " SystemWake = S%d",
  739. (powerInfo->SystemWakeLevel - 1)
  740. ) );
  741. }
  742. if (powerInfo->DeviceWakeLevel == PowerDeviceUnspecified) {
  743. ACPIPrint( (
  744. ACPI_PRINT_SXD,
  745. " DeviceWake = None"
  746. ) );
  747. } else {
  748. ACPIPrint( (
  749. ACPI_PRINT_SXD,
  750. " DeviceWake = D%d",
  751. (powerInfo->DeviceWakeLevel - 1)
  752. ) );
  753. }
  754. if (powerInfo->SupportDeviceD1) {
  755. ACPIPrint( (
  756. ACPI_PRINT_SXD,
  757. " DeviceD1"
  758. ) );
  759. }
  760. if (powerInfo->SupportDeviceD2) {
  761. ACPIPrint( (
  762. ACPI_PRINT_SXD,
  763. " DeviceD2"
  764. ) );
  765. }
  766. if (powerInfo->SupportWakeFromD0) {
  767. ACPIPrint( (
  768. ACPI_PRINT_SXD,
  769. " WakeD0"
  770. ) );
  771. }
  772. if (powerInfo->SupportWakeFromD1) {
  773. ACPIPrint( (
  774. ACPI_PRINT_SXD,
  775. " WakeD1"
  776. ) );
  777. }
  778. if (powerInfo->SupportWakeFromD2) {
  779. ACPIPrint( (
  780. ACPI_PRINT_SXD,
  781. " WakeD2"
  782. ) );
  783. }
  784. if (powerInfo->SupportWakeFromD3) {
  785. ACPIPrint( (
  786. ACPI_PRINT_SXD,
  787. " WakeD3"
  788. ) );
  789. }
  790. ACPIPrint( (
  791. ACPI_PRINT_SXD,
  792. "\n"
  793. ) );
  794. }
  795. VOID
  796. ACPIDebugThermalPrint(
  797. ULONG DebugPrintLevel,
  798. PVOID DebugExtension,
  799. ULONGLONG DebugTime,
  800. PCCHAR DebugMessage,
  801. ...
  802. )
  803. /*++
  804. Routine Description:
  805. This is the debug print routine for the NT side of things. This routine
  806. is here to handle the case where we are printing information that is
  807. associated with a device extension.
  808. Arguments:
  809. DebugPrintLevel - The big mask that when and'ed with the debug level, must
  810. equal itself
  811. DeviceExtension - The device associated with the message
  812. DebugTime - The time that event occured
  813. DebugMessage - The string to feed through vsprintf
  814. Return Value:
  815. NTSTATUS
  816. ---*/
  817. {
  818. PDEVICE_EXTENSION deviceExtension = (PDEVICE_EXTENSION) DebugExtension;
  819. LARGE_INTEGER curTime;
  820. TIME_FIELDS exCurTime;
  821. va_list ap;
  822. va_start( ap, DebugMessage );
  823. //
  824. // What kind of device extension are we looking at?
  825. //
  826. if (deviceExtension->Flags & DEV_PROP_HID) {
  827. //
  828. // Now that we have a _HID, do we also have a _UID?
  829. //
  830. if (deviceExtension->Flags & DEV_PROP_UID) {
  831. DbgPrintEx(
  832. DPFLTR_ACPI_ID,
  833. DebugPrintLevel,
  834. "%p %s-%s ",
  835. deviceExtension,
  836. deviceExtension->DeviceID,
  837. deviceExtension->InstanceID
  838. );
  839. } else {
  840. DbgPrintEx(
  841. DPFLTR_ACPI_ID,
  842. DebugPrintLevel,
  843. "%p %s ",
  844. deviceExtension,
  845. deviceExtension->DeviceID
  846. );
  847. }
  848. } else if (deviceExtension->Flags & DEV_PROP_ADDRESS) {
  849. DbgPrintEx(
  850. DPFLTR_ACPI_ID,
  851. DebugPrintLevel,
  852. "%p %x ",
  853. deviceExtension,
  854. deviceExtension->Address
  855. );
  856. } else {
  857. DbgPrintEx(
  858. DPFLTR_ACPI_ID,
  859. DebugPrintLevel,
  860. "%p ",
  861. deviceExtension
  862. );
  863. }
  864. //
  865. // Print the time string
  866. //
  867. curTime.QuadPart = DebugTime;
  868. RtlTimeToTimeFields( &curTime, &exCurTime );
  869. DbgPrintEx(
  870. DPFLTR_ACPI_ID,
  871. DebugPrintLevel,
  872. "%d:%02d:%02d.%03d ",
  873. exCurTime.Hour,
  874. exCurTime.Minute,
  875. exCurTime.Second,
  876. exCurTime.Milliseconds
  877. );
  878. //
  879. // Call the kernel function to print the message
  880. //
  881. vDbgPrintEx( DPFLTR_ACPI_ID, DebugPrintLevel, DebugMessage, ap );
  882. //
  883. // We are done with the varargs
  884. //
  885. va_end( ap );
  886. }
  887. #endif