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.

184 lines
6.2 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. debug.c
  5. Abstract: This module contains all the debug functions.
  6. Environment:
  7. Kernel mode
  8. Author:
  9. Michael Tsang (MikeTs) 20-Nov-2000
  10. Revision History:
  11. --*/
  12. #include "pch.h"
  13. #ifdef DEBUG
  14. NAMETABLE MajorFnNames[] =
  15. {
  16. IRP_MJ_CREATE, "Create",
  17. IRP_MJ_CREATE_NAMED_PIPE, "CreateNamedPipe",
  18. IRP_MJ_CLOSE, "Close",
  19. IRP_MJ_READ, "Read",
  20. IRP_MJ_WRITE, "Write",
  21. IRP_MJ_QUERY_INFORMATION, "QueryInfo",
  22. IRP_MJ_SET_INFORMATION, "SetInfo",
  23. IRP_MJ_QUERY_EA, "QueryEA",
  24. IRP_MJ_SET_EA, "SetEA",
  25. IRP_MJ_FLUSH_BUFFERS, "FlushBuffers",
  26. IRP_MJ_QUERY_VOLUME_INFORMATION, "QueryVolInfo",
  27. IRP_MJ_SET_VOLUME_INFORMATION, "SetVolInfo",
  28. IRP_MJ_DIRECTORY_CONTROL, "DirectoryControl",
  29. IRP_MJ_FILE_SYSTEM_CONTROL, "FileSystemControl",
  30. IRP_MJ_DEVICE_CONTROL, "DeviceControl",
  31. IRP_MJ_INTERNAL_DEVICE_CONTROL, "InternalDevControl",
  32. IRP_MJ_SHUTDOWN, "Shutdown",
  33. IRP_MJ_LOCK_CONTROL, "LockControl",
  34. IRP_MJ_CLEANUP, "CleanUp",
  35. IRP_MJ_CREATE_MAILSLOT, "CreateMailSlot",
  36. IRP_MJ_QUERY_SECURITY, "QuerySecurity",
  37. IRP_MJ_SET_SECURITY, "SetSecurity",
  38. IRP_MJ_POWER, "Power",
  39. IRP_MJ_SYSTEM_CONTROL, "SystemControl",
  40. IRP_MJ_DEVICE_CHANGE, "DeviceChange",
  41. IRP_MJ_QUERY_QUOTA, "QueryQuota",
  42. IRP_MJ_SET_QUOTA, "SetQuota",
  43. IRP_MJ_PNP, "PnP",
  44. 0x00, NULL
  45. };
  46. NAMETABLE PnPMinorFnNames[] =
  47. {
  48. IRP_MN_START_DEVICE, "StartDevice",
  49. IRP_MN_QUERY_REMOVE_DEVICE, "QueryRemoveDevice",
  50. IRP_MN_REMOVE_DEVICE, "RemoveDevice",
  51. IRP_MN_CANCEL_REMOVE_DEVICE, "CancelRemoveDevice",
  52. IRP_MN_STOP_DEVICE, "StopDevice",
  53. IRP_MN_QUERY_STOP_DEVICE, "QueryStopDevice",
  54. IRP_MN_CANCEL_STOP_DEVICE, "CancelStopDevice",
  55. IRP_MN_QUERY_DEVICE_RELATIONS, "QueryDeviceRelations",
  56. IRP_MN_QUERY_INTERFACE, "QueryInterface",
  57. IRP_MN_QUERY_CAPABILITIES, "QueryCapabilities",
  58. IRP_MN_QUERY_RESOURCES, "QueryResources",
  59. IRP_MN_QUERY_RESOURCE_REQUIREMENTS, "QueryResRequirements",
  60. IRP_MN_QUERY_DEVICE_TEXT, "QueryDeviceText",
  61. IRP_MN_FILTER_RESOURCE_REQUIREMENTS,"FilterResRequirements",
  62. IRP_MN_READ_CONFIG, "ReadConfig",
  63. IRP_MN_WRITE_CONFIG, "WriteConfig",
  64. IRP_MN_EJECT, "Eject",
  65. IRP_MN_SET_LOCK, "SetLock",
  66. IRP_MN_QUERY_ID, "QueryID",
  67. IRP_MN_QUERY_PNP_DEVICE_STATE, "QueryPNPDeviceState",
  68. IRP_MN_QUERY_BUS_INFORMATION, "QueryBusInfo",
  69. IRP_MN_DEVICE_USAGE_NOTIFICATION, "DeviceUsageNotify",
  70. IRP_MN_SURPRISE_REMOVAL, "SurpriseRemoval",
  71. 0x18, "QueryLegacyBusInfo",
  72. 0x00, NULL
  73. };
  74. NAMETABLE PowerMinorFnNames[] =
  75. {
  76. IRP_MN_WAIT_WAKE, "WaitWake",
  77. IRP_MN_POWER_SEQUENCE, "PowerSequence",
  78. IRP_MN_SET_POWER, "SetPower",
  79. IRP_MN_QUERY_POWER, "QueryPower",
  80. 0x00, NULL
  81. };
  82. NAMETABLE PowerStateNames[] =
  83. {
  84. PowerDeviceUnspecified, "Unspecified",
  85. PowerDeviceD0, "D0",
  86. PowerDeviceD1, "D1",
  87. PowerDeviceD2, "D2",
  88. PowerDeviceD3, "D3",
  89. PowerDeviceMaximum, "Maximum",
  90. 0x00, NULL
  91. };
  92. NAMETABLE QueryIDTypeNames[] =
  93. {
  94. BusQueryDeviceID, "DeviceID",
  95. BusQueryHardwareIDs, "HardwareIDs",
  96. BusQueryCompatibleIDs, "CompatibleIDs",
  97. BusQueryDeviceSerialNumber, "DeviceSerialNumber",
  98. 0x00, NULL
  99. };
  100. NAMETABLE IoctlNames[] =
  101. {
  102. IOCTL_SMBLITE_GETBRIGHTNESS, "GetBrightness",
  103. IOCTL_SMBLITE_SETBRIGHTNESS, "SetBrightness",
  104. #ifdef SYSACC
  105. IOCTL_SYSACC_MEM_REQUEST, "MemRequest",
  106. IOCTL_SYSACC_IO_REQUEST, "IORequest",
  107. IOCTL_SYSACC_PCICFG_REQUEST, "PCICfgRequest",
  108. IOCTL_SYSACC_SMBUS_REQUEST, "SMBusRequest",
  109. #endif
  110. 0x00, NULL
  111. };
  112. NAMETABLE ProtocolNames[] =
  113. {
  114. SMB_WRITE_QUICK, "QuickWrite",
  115. SMB_READ_QUICK, "QuickRead",
  116. SMB_SEND_BYTE, "SendByte",
  117. SMB_RECEIVE_BYTE, "ReceiveByte",
  118. SMB_WRITE_BYTE, "WriteByte",
  119. SMB_READ_BYTE, "ReadByte",
  120. SMB_WRITE_WORD, "WriteWord",
  121. SMB_READ_WORD, "ReadWord",
  122. SMB_WRITE_BLOCK, "WriteBlock",
  123. SMB_READ_BLOCK, "ReadBlock",
  124. SMB_PROCESS_CALL, "ProcessAll",
  125. 0x00, NULL
  126. };
  127. int giVerboseLevel = 0;
  128. /*++
  129. @doc INTERNAL
  130. @func PSZ | LookupName |
  131. Look up name string of a code in the given name table.
  132. @parm IN ULONG | Code | The given code to lookup.
  133. @parm IN PNAMETABLE | NameTable | The name table to look into.
  134. @rvalue SUCCESS - Returns pointer to the minor function name string.
  135. @rvalue FAILURE - Returns "unknown".
  136. --*/
  137. PSZ INTERNAL
  138. LookupName(
  139. IN ULONG Code,
  140. IN PNAMETABLE NameTable
  141. )
  142. {
  143. PROCNAME("LookupName")
  144. PSZ pszName = "unknown";
  145. ENTER(5, ("(Code=%x,pNameTable=%p)\n", Code, NameTable));
  146. ASSERT(NameTable != NULL);
  147. while (NameTable->pszName != NULL)
  148. {
  149. if (Code == NameTable->Code)
  150. {
  151. pszName = NameTable->pszName;
  152. break;
  153. }
  154. NameTable++;
  155. }
  156. EXIT(5, ("=%s\n", pszName));
  157. return pszName;
  158. } //LookupName
  159. #endif //ifdef DEBUG