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.

167 lines
10 KiB

  1. #include <windows.h>
  2. #include <ntverp.h>
  3. #define VER_FILETYPE VFT_DRV
  4. #define VER_FILESUBTYPE VFT2_DRV_SYSTEM
  5. #define VER_FILEDESCRIPTION_STR "Cyclom-Y Port Driver"
  6. #define VER_INTERNALNAME_STR "cyyport.sys"
  7. #define VER_ORIGINALFILENAME_STR "cyyport.sys"
  8. #define VER_LEGALCOPYRIGHT_YEARS "1996-2001"
  9. #define VER_LEGALCOPYRIGHT_STR "Copyright (C) Cyclades Corp. " VER_LEGALCOPYRIGHT_YEARS
  10. #define VER_FILEVERSION 1,0,25,0
  11. #define VER_FILEVERSION_STR "1.0.25.0"
  12. #include "common.ver"
  13. #include "cyylog.rc"
  14. // History
  15. //
  16. // 1.0.25.0 12/12/01 Just to make sure, we are initializing 'value' with
  17. // 0xff in CyyCDCmd.
  18. // 1.0.24.0 10/22/01 Fix from Win2k SP2 applied: CyyPowerDispatch doesn't
  19. // call PoStartNextPowerIrp and CyyCompleteRequest when
  20. // CyyIRPPrologue returns STATUS_PENDING.
  21. // 1.0.23.0 09/13/01 CyyCDCmd was using uninitialized memory 'value'.
  22. // 1.0.22.0 07/05/01 Applying changes from DDK RC1: Do not complete Irp when
  23. // CyyIRPPrologue returns STATUS_PENDING. (CyyIRPPrologue
  24. // returns STATUS_PENDING when device is in Stopped state.)
  25. // Removal of DbgBreakPoint in CyyLogInit to prevent
  26. // breakpoints in low resource simulation with checked
  27. // builds.
  28. // Following changes in serial were not applied: use of
  29. // SetDeviceIsOpened instead of updating DeviceIsOpened
  30. // flag directly; no power down after Start up or when
  31. // closing port if EnablePowerManagement is set in the
  32. // Registry.
  33. // 1.0.21.0 07/02/01 No need to send Power Irp to power up the device during
  34. // IRP_MN_START_DEVICE.
  35. // 1.0.20.0 05/04/01 More fixes for Driver Verifier: IoMarkIrpPending required
  36. // when STATUS_PENDING returned. CyySystemPowerComplete
  37. // completing Irp when PoRequestPowerIrp fails.
  38. // IoMarkIrpPending called when Irp->PendingReturned set
  39. // in the IoCompletion routine of Device Power Irp.
  40. // 1.0.19.0 04/27/01 _WIN64 code removed. Set busNumber to 0xFFFFFFFF
  41. // when call to get DevicePropertyBusNumber fails;
  42. // device name will use static currentInstance whenever
  43. // busNumber is 0xFFFFFFFF.
  44. // 1.0.18.0 - None.
  45. // 1.0.17.0 04/25/01 Delete #defines for VER_COMPANYNAME_STR,
  46. // VER_PRODUCTNAME_STR, VER_PRODUCTVERSION and
  47. // VER_PRODUCTVERSION_STR to fix compilation
  48. // warnings.
  49. // 1.0.16.0 04/18/01 Device name for _WIN64 will use static currentInstance
  50. // number. This is because cyclom-y cannot retrieve
  51. // the PCI slot number in 64-bit system.
  52. // 1.0.15.0 04/17/01 Just version change.
  53. // 1.0.14.0 04/16/01 Fix for Driver Verifier: IoMarkIrpPending required
  54. // when STATUS_PENDING returned.
  55. // 1.0.13.0 04/02/01 Just version change.
  56. // 1.0.12.0 03/20/01 RtlAppendUnicodeToString was failing with
  57. // STATUS_BUFFER_TOO_SMALL when updating
  58. // SymbolicLinkName in CyyUndoExternalNaming.
  59. // CyyReadSymName is used now.
  60. // Device name changed from \Device\Cyyport?Pci? to
  61. // \Device\Pci?Cyyport?.
  62. // 1.0.11.0 03/14/01 Changes for serial from DDK 2416 (Whistler pre-Beta2)
  63. // to DDK 2446 (Whistler pre-Beta2) applied.
  64. // 1.0.10.0 03/12/01 Changes for serial from DDK 2195 (Windows 2000) to
  65. // DDK 2416 (Whistler pre-Beta2) applied.
  66. // 1.0.9.0 03/12/01 Just version change.
  67. // 1.0.8.0 03/02/01 cyypnp.c: Device name is no longer using static instance
  68. // number that is incremented every time the driver
  69. // is loaded; instead it is using a fixed name based
  70. // on the PCI slot and port number. This change fixed
  71. // the Rename-Disable-Enable problem.
  72. // 1.0.7.0 02/26/01 cyypower.c: Instead of requesting Device Power Irp
  73. // only if device is opened, Device Power Irp is always
  74. // requested during System Irp. Device Power Irp will
  75. // set the device IoCompletion routine if the device is
  76. // opened.
  77. // CyySystemPowerComplete doesn't complete Irp when
  78. // PoRequestPowerIrp returns failure. This Irp should have
  79. // been already completed by PDO.
  80. // Device IoCompletion routine doesn't complete Irp, it
  81. // should have been already completed by PDO. Device
  82. // IoCompletion returns STATUS_SUCCESS instead of
  83. // STATUS_MORE_PROCESSING_REQUIRED.
  84. // cyyioctl.c: Access to COR3 register in
  85. // IOCTL_SERIAL_INTERNAL_BASIC_SETTINGS and
  86. // IOCTL_SERIAL_INTERNAL_RESTORE_SETTINGS is protected
  87. // by KeSynchronizeExecution.
  88. // 1.0.6.0 02/16/01 cyypower.c: CyyRestoreDeviceState restores hw context
  89. // only if device is opened.
  90. // 1.0.5.0 02/15/01 cyypower.c: Disable interrupts in the CD1400 channel and
  91. // reset channel in CyySaveDeviceState. Send Device Power
  92. // Irp only if OpenCount is not zero.
  93. // cyyioctl.c: Do not log error if IRQL > DISPATCH_LEVEL
  94. // in CyyCDCmd.
  95. // 1.0.4.0 02/09/01 cyypower.c: CyySaveDeviceState and CyyRestoreDeviceState
  96. // are saving and restoring the CD1400 register values.
  97. // They are called using KeSynchronizeExecution.
  98. // CyySetPowerD3 is disabling PLX interrupts when the last
  99. // port is powered down. Device SET_POWER is no longer
  100. // waiting for kernel event during power up; it is setting
  101. // an IoCompletion routine. System SET_POWER changed to
  102. // return STATUS_PENDING, set an IoCompletion routine, and
  103. // request Device power Irp in the IoCompletion routine.
  104. // CyyRestoreDeviceState is setting HoldingEmpty to TRUE.
  105. // cyyintr.c: CyyTxStart is checking if power is D0.
  106. // 1.0.3.0 02/01/01 Clear pending interrupt in CyyDisableCd1400Channel.
  107. // 1.0.2.0 01/25/01 Driver built with Whistler DDK 2416.
  108. // Reset board and reset chip code moved to cyclom-y driver
  109. // to prevent IRP_MN_START_DEVICE resetting the chip while
  110. // IRP_MN_SET_POWER reset the board. Files changed:
  111. // cyyinit.c, cyypower.c, cyypnp.c.
  112. // Compilation error fixed in CyySetBaud: "if" condition that
  113. // was always TRUE. File changed: cyyioctl.c
  114. // 64-bit Compilation error fixed in cyyinit.c and cyypower.c
  115. // 1.0.1.0 12/06/00 Driver built with Whistler DDK (Beta1).
  116. // 1.0.0.30 10/11/00 Fix Rename-Disable-Enable problem: SymbolicLinkName
  117. // was being changed by the Property Page, but driver
  118. // was trying to delete the original name.
  119. // 1.0.0.29 09/22/00 Changes in cyyport.h and cyyportp.h to support 64bit.
  120. // 1.0.0.28 08/29/00 CyyKillPendingIrps had a path where IoReleaseCancelSpinLock
  121. // would not be called after IoAcquireCancelSpinLock.
  122. // cyylogc.c deleted.
  123. // Removal of IER, LCR and MCR from CYY_DEVICE_STATE; removal of
  124. // InterruptStatus from CYY_DEVICE_EXTENSION.
  125. // Tag 'XMOC' changed to 'PyyC' in log.c.
  126. // 1.0.0.23 06/23/00 Added more error logging to cover all errors in AddDevice.
  127. // 1.0.0.22 06/15/00 Added error logging.
  128. // 1.0.0.20 06/05/00 Buffers allocated with correct tag.
  129. // 1.0.0.16 05/19/00 Re-compiled just because of new .bat. No change in driver.
  130. // 1.0.0.15 04/07/00 Added CyyDump for CYYWMI.
  131. // 1.0.0.14 04/06/00 Added support to IOCTL_SERIAL_INTERNAL_BASIC_SETTINGS
  132. // and IOCTL_SERIAL_INTERNAL_RESTORE_SETTINGS.
  133. // TxFifoAmount variable used instead of hardcoding
  134. // tx fifo size to 12. This way we can change it using
  135. // IOCTL_SERIAL_INTERNAL_BASIC_SETTINGS. For now, we are not
  136. // using TxFIFO read from Registry.
  137. // Added support to IOCTL_SERIAL_SET_FIFO_CONTROL.
  138. // 1.0.0.13 03/31/00 Apply changes from Y NT 3.1.0 to cyyport:
  139. // * cd1400.h: Creation of RTS_AUT_OUTPUT and CTS_AUT_ENABLE;
  140. // creation of SRER_TXRDY and SRER_TXMPTY.
  141. // * cyyinit.c: Remove BREAK_IMPLEMENTATION code.
  142. // * cyyintr.c: Remove BREAK_IMPLEMENTATION code.
  143. // * cyymodem.c: Remove BREAK_IMPLEMENTATION code.
  144. // * cyyport.h: Creation of BreakCmd in CYY_DEVICE_EXTENSION.
  145. // * cyyportp.h: Deletion of CyyPurgeTxBuff prototype.
  146. // * cyypurge.c: Deletion of SERIAL_PURGE_TXCLEAR handling.
  147. // * sources: Deletion of BREAK_IMPLEMENTATION.
  148. // * cyypower.c: Deletion of BREAK_IMPLEMENTATION code.
  149. // 1.0.0.12 -------- None.
  150. // 1.0.0.11 -------- None.
  151. // 1.0.0.10 02/29/00 Fix IRP_MN_REMOVE_DEVICE to detach cyyport from stack
  152. // only after calling lower drivers. CyyRemoveDevObj() had
  153. // to be changed for this.
  154. // Do a cast to (UCHAR) in CD1400_WRITE to fix all warning
  155. // errors.
  156. // 1.0.0.8 12/30/99 Cosmetic changes in the src code.
  157. // 1.0.0.6 10/11/99 Eliminate resource conflicts between Cyclom-Y device
  158. // and Cyclom-Y child devices; cyyportp.h, cyypnp.c, cyyreg.c
  159. // 1.0.0.5 10/07/99 New child Hardware Id's, Instances and Descriptions;
  160. // cyyhw.h, cyypnp.c, cyyport.h, do.bat, precomp.h changed.
  161. // 1.0.0.4 09/20/99 Support to ISA boards.