Leaked source code of windows server 2003
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.

195 lines
8.2 KiB

  1. //////////////////////////////////////////////////////////////////////////////////////////
  2. // Card and Port device extension structures.
  3. //
  4. //////////////////////////////////////////////////////////////////////////////////////////
  5. #ifndef SPX_CARD_H
  6. #define SPX_CARD_H
  7. typedef struct _CARD_DEVICE_EXTENSION *PCARD_DEV_EXT;
  8. typedef struct _PORT_DEVICE_EXTENSION *PPORT_DEV_EXT;
  9. //////////////////////////////////////////////////////////////////////////////////////////
  10. // Common header for all the device extensions
  11. // Common to all the PDOs and FDOs (cards and ports).
  12. //////////////////////////////////////////////////////////////////////////////////////////
  13. typedef struct _COMMON_OBJECT_DATA
  14. {
  15. PDEVICE_OBJECT DeviceObject; // A backpointer to the device object that contains this device extension.
  16. PDRIVER_OBJECT DriverObject; // Pointer to Driver Object
  17. BOOLEAN IsFDO; // A boolean to distringuish between PDO and FDO.
  18. PDEVICE_OBJECT LowerDeviceObject; // This is a pointer to the next lower device in the IRP stack.
  19. ULONG DebugLevel;
  20. ULONG PnpPowerFlags; // Plug & Play / Power flags
  21. KSPIN_LOCK PnpPowerFlagsLock; // Lock for protecting the flags
  22. BOOLEAN PowerQueryLock; // Are we currently in a query power state?
  23. LIST_ENTRY StalledIrpQueue; // List of stalled IRPs
  24. KSPIN_LOCK StalledIrpLock; // Lock for protecting stalled IRPs
  25. BOOLEAN UnstallingFlag; // Flag set if we are unstalling IRPs currently queued.
  26. #ifndef BUILD_SPXMINIPORT
  27. SYSTEM_POWER_STATE SystemState; // Current System Power State
  28. DEVICE_POWER_STATE DeviceState; // Current Device Power State
  29. #endif
  30. #ifdef WMI_SUPPORT
  31. WMILIB_CONTEXT WmiLibInfo; // WMI Information
  32. #endif
  33. } COMMON_OBJECT_DATA, *PCOMMON_OBJECT_DATA;
  34. //////////////////////////////////////////////////////////////////////////////////////////
  35. // Common Card Configuration Data.
  36. // Information not specific to product.
  37. //////////////////////////////////////////////////////////////////////////////////////////
  38. typedef struct _CONFIG_DATA
  39. {
  40. PHYSICAL_ADDRESS RawPhysAddr; // Raw physical address of card
  41. PHYSICAL_ADDRESS PhysAddr; // Translated Physical address of card.
  42. PUCHAR Controller; // Virtual mapped sddress of card.
  43. ULONG SpanOfController; // Size of memory used by Cord.
  44. INTERFACE_TYPE InterfaceType; // Type of card (Isa or Pci)
  45. ULONG BusNumber; // Bus number card is using.
  46. ULONG SlotNumber; // Slot number on bus.
  47. ULONG AddressSpace; // Flag used by SX
  48. ULONG OriginalVector; // Original Vector (bus relative)
  49. ULONG OriginalIrql; // Original Irql (bus relative)
  50. ULONG TrVector; // Translated Vector (system relative).
  51. KIRQL TrIrql; // Translated Irql (system relative).
  52. KINTERRUPT_MODE InterruptMode; // Interrupt mode (LevelSensitive or Latched)
  53. BOOLEAN InterruptShareable; // Interrupt shareable flag.
  54. KAFFINITY ProcessorAffinity; // Processor affintity.
  55. PKSERVICE_ROUTINE OurIsr; // Points to interrupt service routine.
  56. PVOID OurIsrContext; // Points to card device extension.
  57. PKINTERRUPT Interrupt; // Points to the interrupt object used by the card.
  58. ULONG ClockRate; // ClockRate.
  59. } CONFIG_DATA,*PCONFIG_DATA;
  60. //////////////////////////////////////////////////////////////////////////////////////////
  61. // Common Card Device Extenstion.
  62. // Information not specific to product.
  63. //////////////////////////////////////////////////////////////////////////////////////////
  64. typedef struct _COMMON_CARD_DEVICE_EXTENSION
  65. {
  66. COMMON_OBJECT_DATA; // Common Object Data
  67. CONFIG_DATA; // Card Config Data
  68. PDEVICE_OBJECT PDO; // Pointer to Physical Device Object
  69. UNICODE_STRING DeviceName; // Device name.
  70. ULONG CardNumber;
  71. ULONG NumberOfPorts; // Number of ports attached to card.
  72. ULONG NumPDOs; // The PDOs currently enumerated.
  73. ULONG CardType; // Defines the type of host card.
  74. PDEVICE_OBJECT AttachedPDO[PRODUCT_MAX_PORTS]; // Array of pointers to PDOs for ports attached to card.
  75. } COMMON_CARD_DEVICE_EXTENSION, *PCOMMON_CARD_DEVICE_EXTENSION;
  76. typedef struct _PORT_PERFORMANCE_STATS
  77. {
  78. SERIALPERF_STATS;
  79. // IRPs with a Major Function of IRP_MJ_WRITE
  80. ULONG WriteIrpsSubmitted;
  81. ULONG WriteIrpsCompleted;
  82. ULONG WriteIrpsCancelled;
  83. ULONG WriteIrpsTimedOut;
  84. ULONG WriteIrpsQueued;
  85. // IRPs with a Major Function of IRP_MJ_READ
  86. ULONG ReadIrpsSubmitted;
  87. ULONG ReadIrpsCompleted;
  88. ULONG ReadIrpsCancelled;
  89. ULONG ReadIrpsTimedOut;
  90. ULONG ReadIrpsQueued;
  91. // IRPs with a Major Function of IRP_MJ_FLUSH_BUFFERS
  92. ULONG FlushIrpsSubmitted;
  93. ULONG FlushIrpsCompleted;
  94. ULONG FlushIrpsCancelled;
  95. ULONG FlushIrpsQueued;
  96. // IRPs with a Major Function of IRP_MJ_DEVICE_CONTROL
  97. ULONG IoctlIrpsSubmitted;
  98. ULONG IoctlIrpsCompleted;
  99. ULONG IoctlIrpsCancelled;
  100. // IRPs with a Major Function of IRP_MJ_INTERNAL_DEVICE_CONTROL
  101. ULONG InternalIoctlIrpsSubmitted;
  102. ULONG InternalIoctlIrpsCompleted;
  103. ULONG InternalIoctlIrpsCancelled;
  104. // IRPs with a Major Function of IRP_MJ_CREATE
  105. ULONG CreateIrpsSubmitted;
  106. ULONG CreateIrpsCompleted;
  107. ULONG CreateIrpsCancelled;
  108. // IRPs with a Major Function of IRP_MJ_CLOSE
  109. ULONG CloseIrpsSubmitted;
  110. ULONG CloseIrpsCompleted;
  111. ULONG CloseIrpsCancelled;
  112. // IRPs with a Major Function of IRP_MJ_CLEANUP
  113. ULONG CleanUpIrpsSubmitted;
  114. ULONG CleanUpIrpsCompleted;
  115. ULONG CleanUpIrpsCancelled;
  116. // IRPs with a Major Function of IRP_MJ_QUERY_INFORMATION and IRP_MJ_SET_INFORMATION
  117. ULONG InfoIrpsSubmitted;
  118. ULONG InfoIrpsCompleted;
  119. ULONG InfoIrpsCancelled;
  120. } PORT_PERFORMANCE_STATS, *PPORT_PERFORMANCE_STATS;
  121. //////////////////////////////////////////////////////////////////////////////////////////
  122. // Common Port Device Extenstion.
  123. // Information not specific to product.
  124. //////////////////////////////////////////////////////////////////////////////////////////
  125. typedef struct _COMMON_PORT_DEVICE_EXTENSION
  126. {
  127. COMMON_OBJECT_DATA; // Common Object Data
  128. PDEVICE_OBJECT ParentFDO; // A back pointer to the bus FDO (this will be the LowerDeviceObject)
  129. PCARD_DEV_EXT pParentCardExt; // Pointer to parent card device structure
  130. UNICODE_STRING DeviceName; // Device name eg. "\Device\PortName#".
  131. UNICODE_STRING DeviceClassSymbolicName; // Device Interface Name
  132. UNICODE_STRING SerialCommEntry; // Device name in SERIALCOMM Reg key eg. "PortName#".
  133. ULONG PortNumber; // Port number.
  134. UNICODE_STRING DeviceID; // Format: bus\device (must be most specific HardwareID)
  135. UNICODE_STRING InstanceID; // Instance ID
  136. BOOLEAN UniqueInstanceID; // TRUE if InstanceID is gloablly unique, FALSE otherwise.
  137. UNICODE_STRING HardwareIDs; // Format bus\device or *PNPXXXX - meaning root enumerated
  138. UNICODE_STRING CompatibleIDs; // Compatible IDs to the Hardware ID
  139. UNICODE_STRING DevDesc; // Text describing device
  140. UNICODE_STRING DevLocation; // Text describing device location
  141. UNICODE_STRING DosName; // Dos device name "COM#"
  142. UNICODE_STRING SymbolicLinkName; // External Device Name eg."\DosDevices\COM#".
  143. BOOLEAN CreatedSymbolicLink; // Flag to indicate that a symbolic link has been created.
  144. BOOLEAN CreatedSerialCommEntry; // Flag to indicate that a reg entry has been created in "SERIALCOMM"
  145. BOOLEAN DeviceIsOpen; // Flag to indicate when the port is open
  146. ULONG SavedModemControl; // DTR/RTS signal states saved during power down
  147. FAST_MUTEX OpenMutex; // Mutex on open status
  148. #ifdef WMI_SUPPORT
  149. SERIAL_WMI_COMM_DATA WmiCommData; // WMI Comm Data
  150. SERIAL_WMI_HW_DATA WmiHwData; // WMI HW Data
  151. SERIAL_WMI_PERF_DATA WmiPerfData; // WMI Performance Data
  152. #endif
  153. //
  154. // Holds performance statistics that applications can query.
  155. // Reset on each open. Only set at device level.
  156. //
  157. PORT_PERFORMANCE_STATS PerfStats;
  158. } COMMON_PORT_DEVICE_EXTENSION, *PCOMMON_PORT_DEVICE_EXTENSION;
  159. #endif // End of SPX_CARD.H