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.

484 lines
19 KiB

  1. /*************************************************************************
  2. ** **
  3. ** ATINT.H **
  4. ** **
  5. ** Copyright (c) 1992, ATI Technologies Inc. **
  6. *************************************************************************
  7. Contains information specific to Windows NT, and is common between
  8. the Install application ANTPANEL, and the Display and Miniport drivers.
  9. $Revision: 1.18 $
  10. $Date: 25 Apr 1996 14:21:40 $
  11. $Author: RWolff $
  12. $Log: S:/source/wnt/ms11/miniport/archive/atint.h_v $
  13. *
  14. * Rev 1.18 25 Apr 1996 14:21:40 RWolff
  15. * Forces build for NT 4.0, since all code drops to Microsoft will be
  16. * built under NT 4.0.
  17. *
  18. * Rev 1.17 23 Apr 1996 17:25:50 RWolff
  19. * Split reporting of "internal DAC cursor needs double buffering" from
  20. * "this is a CT", added flag to report 1M SDRAM cards.
  21. *
  22. * Rev 1.16 23 Jan 1996 11:41:36 RWolff
  23. * Now forces compile-time error if NTDDVDEO.H is not included before
  24. * this file rather than generating false values of TARGET_BUILD, added
  25. * DrvEscape() functions used by multiheaded display applet.
  26. *
  27. * Rev 1.15 22 Dec 1995 14:59:32 RWolff
  28. * Added support for Mach 64 GT internal DAC.
  29. *
  30. * Rev 1.14 21 Dec 1995 14:05:36 RWolff
  31. * Added TARGET_BUILD definition to identify which version of NT we are
  32. * building for, rather than using a different definition for each break
  33. * between versions.
  34. *
  35. * Rev 1.13 23 Nov 1995 11:25:10 RWolff
  36. * Added multihead support.
  37. *
  38. * Rev 1.12 24 Aug 1995 15:38:04 RWolff
  39. * Added definitions to report CT and VT ASICs to the display driver.
  40. *
  41. * Rev 1.11 27 Feb 1995 17:46:44 RWOLFF
  42. * Added flag for packed (relocatable) I/O to ENH_VERSION_NT.FeatureFlags
  43. * bitmask.
  44. *
  45. * Rev 1.10 24 Feb 1995 12:23:08 RWOLFF
  46. * Added flag for 24BPP text banding to ModeFlags field of mode
  47. * information structure.
  48. *
  49. * Rev 1.9 03 Feb 1995 15:14:16 RWOLFF
  50. * Added Feature Flag to show that dense space is available.
  51. *
  52. * Rev 1.8 30 Jan 1995 11:54:36 RWOLFF
  53. * Made detection of Daytona vs. older versions of NT automatic, miniport
  54. * and display driver now use the same version of this file.
  55. *
  56. * Rev 1.7 23 Dec 1994 10:48:34 ASHANMUG
  57. * ALPHA/Chrontel-DAC
  58. *
  59. * Rev 1.6 31 Aug 1994 16:18:38 RWOLFF
  60. * Added definiton to go in ENH_VERSION_NT.FeatureFlags to show that
  61. * TVP3026 cursor handling is needed.
  62. *
  63. * Rev 1.5 04 May 1994 19:24:04 RWOLFF
  64. * Moved block write flag back to IOCTL_VIDEO_ATI_GET_MODE_INFORMATION
  65. * because the test can only be run if we have already switched
  66. * into graphics mode.
  67. *
  68. * Rev 1.4 28 Apr 1994 10:58:52 RWOLFF
  69. * Moved mode-independent bug/feature flags to IOCTL_VIDEO_ATI_GET_VERSION
  70. * packet from IOCTL_VIDEO_ATI_GET_MODE_INFORMATION packet.
  71. *
  72. * Rev 1.3 27 Apr 1994 13:52:58 RWOLFF
  73. * Added definition for MIO bug in ModeFlags bitfield.
  74. *
  75. * Rev 1.2 31 Mar 1994 15:00:52 RWOLFF
  76. * Added key to be used in DrvEscape() and values to be returned.
  77. *
  78. * Rev 1.1 14 Mar 1994 16:29:08 RWOLFF
  79. * Added bit definition in ModeFlags for 2M boundary tearing, DPMS IOCTL
  80. * is now consistent with Daytona.
  81. *
  82. * Rev 1.0 31 Jan 1994 11:29:10 RWOLFF
  83. * Initial revision.
  84. *
  85. * Rev 1.3 24 Jan 1994 18:01:42 RWOLFF
  86. * Added definitions for new Mach 32 ASIC (68800LX), changed some Mach 64
  87. * definitions to accomodate changes in 94/01/19 BIOS document.
  88. *
  89. * Rev 1.2 14 Jan 1994 15:19:32 RWOLFF
  90. * Added definition for unknown non-Mach32 ASIC, flags to show if block
  91. * write and memory mapped registers are available, added fields for
  92. * bus type in ENH_VERSION_NT structure, preliminary structure and
  93. * definitions for DPMS packet.
  94. *
  95. * Rev 1.1 30 Nov 1993 18:12:12 RWOLFF
  96. * Renamed definitions for Mach 64 chip.
  97. *
  98. * Rev 1.0 03 Sep 1993 14:27:20 RWOLFF
  99. * Initial revision.
  100. Rev 1.5 22 Jan 1993 14:49:34 Chris_Brady
  101. add card capabilities to GET_INFO Ioctl.
  102. Rev 1.4 22 Jan 1993 14:46:40 Chris_Brady
  103. add ATIC_ defines for the card capabilities.
  104. Rev 1.3 20 Jan 1993 17:47:16 Robert_Wolff
  105. Added PVERSION_NT type definition, removed obsolete comment.
  106. Rev 1.2 19 Jan 1993 09:50:58 Chris_Brady
  107. add ANT_ drawing interface defines.
  108. Rev 1.1 18 Jan 1993 15:49:34 Chris_Brady
  109. new GetInof structure.
  110. Rev 1.0 15 Jan 1993 16:43:08 Chris_Brady
  111. Initial revision.
  112. ------------------------------------------------------------------------*/
  113. // is in the \ddk\public\sdk\inc directory
  114. #include <devioctl.h>
  115. // allow the miniport driver to Force seletion of a Programming Interface
  116. enum {
  117. ANT_DEFAULT=0,
  118. ANT_ENGINE_ONLY,
  119. ANT_APERTURE,
  120. ANT_VGA
  121. };
  122. // Private Display driver Functions. Communication from ANTPANEL to
  123. // the Display ATI*.DLL to the Miniport ATI*.SYS drivers.
  124. enum {
  125. ATI_GET_INFO=1,
  126. ATI_GET_nextone
  127. };
  128. // Define the possible ATI graphics card configurations so the Display
  129. // driver can decide the best drawing methods to use.
  130. // size is ULONG 32 bit field
  131. // assigned by miniport to VERSION_NT.capcard
  132. #define ATIC_FIELD_LONGEST 0x80000000 //just to illustrate size
  133. #define ATIC_APERTURE_LFB 0x0400
  134. #define ATIC_APERTURE_VGA 0x0200
  135. #define ATIC_APERTURE_NONE 0x0100 //neither VGA or LFB found
  136. #define ATIC_CARD_TYPE 0x00F0 //defines from 68801.h << 4
  137. #define ATIC_BUS_TYPE 0x000F //defines from 68801.H
  138. // used with IOCTL_VIDEO_ATI_GET_VERSION
  139. // In hex: BBBBVVMM where
  140. // BBBB is the build number (0-32767),
  141. // VV is the major version number (0-255)
  142. // MM is the minor version number (0-255)
  143. typedef struct {
  144. ULONG display; //Display Version number
  145. ULONG miniport; //Miniport Version number
  146. ULONG capcard; //card capabilities
  147. struct {
  148. short xres;
  149. short yres;
  150. short color; // maximum bits per pixel
  151. } resolution[6];
  152. } VERSION_NT, *PVERSION_NT;
  153. /*
  154. * Definitions used with the ENH_VERSION_NT structure
  155. */
  156. #define ENH_REVISION 1 // First revision of ENH_VERSION_NT structure
  157. #define BETA_MINIPORT 0x00000080 // Bit set in InterfaceVersion for unsupported miniport versions
  158. enum {
  159. CI_38800_1 = 0, // Mach 8 ASIC, only one revision in use
  160. CI_68800_3, // Mach 32 ASIC, first production revision
  161. CI_68800_6, // Mach 32 ASIC, second production revision
  162. CI_68800_AX, // Mach 32 AX ASIC
  163. CI_88800_GX, // Mach 64 GX ASIC
  164. CI_68800_LX, // Mach 32 LX ASIC
  165. CI_OTHER_UNKNOWN=30, // Unknown ASIC other than Mach 32
  166. CI_68800_UNKNOWN=31 // Mach 32 ASIC other than versions above
  167. };
  168. #define FL_CI_38800_1 0x00000001
  169. #define FL_CI_68800_3 0x00000002
  170. #define FL_CI_68800_6 0x00000004
  171. #define FL_CI_68800_AX 0x00000008
  172. #define FL_CI_88800_GX 0x00000010
  173. #define FL_CI_68800_LX 0x00000020
  174. #define FL_CI_OTHER_UNKNOWN 0x40000000
  175. #define FL_CI_68800_UNKNOWN 0x80000000
  176. enum {
  177. ENGINE_ONLY = 0, // No aperture available
  178. AP_LFB, // Linear framebuffer available
  179. AP_68800_VGA, // 64k VGA aperture available
  180. AP_CX_VGA // Two 32k VGA apertures available
  181. };
  182. #define FL_ENGINE_ONLY 0x00000001
  183. #define FL_AP_LFB 0x00000002
  184. #define FL_68800_VGA 0x00000004
  185. #define FL_CX_VGA 0x00000008
  186. #define FL_MM_REGS 0x80000000 /* Memory Mapped registers are available */
  187. /*
  188. * Values which can be placed in FeatureFlags field of ENH_VERSION_NT.
  189. *
  190. * Flags should be added to this field if they represent bugs/features
  191. * which affect all resolution/pixel depth combinations on a given card.
  192. */
  193. #define EVN_DPMS 0x00000001 // DPMS is supported
  194. #define EVN_SPLIT_TRANS 0x00000002 // This card has split transfer bug
  195. #define EVN_MIO_BUG 0x00000004 // Card has multiple in/out hardware bug
  196. #define EVN_TVP_DAC_CUR 0x00000008 // Cursor handled by TVP DAC, not the ASIC
  197. #define EVN_IBM514_DAC_CUR 0x00000010 // Cursor handled by IBM DAC, not the ASIC
  198. #define EVN_DENSE_CAPABLE 0x00000020 // Card is capable of using dense space
  199. #define EVN_PACKED_IO 0x00000040 // Card uses packed I/O space
  200. #define EVN_INT_DAC_CUR 0x00000080 /* Cards with internal DAC must use double buffer to avoid flickering cursor */
  201. #define EVN_VT_ASIC 0x00000100 /* VT has extended capabilities our other cards don't */
  202. #define EVN_GT_ASIC 0x00000200 /* GT has extended capabilities our other cards don't */
  203. #define EVN_CT_ASIC 0x00000400 /* Identify CT ASIC */
  204. /*
  205. * Cards with 1M of SDRAM need special handling (problem occurs on the
  206. * VTA4, may or may not happen with this configuration on future ASICs).
  207. */
  208. #define EVN_SDRAM_1M 0x00000800
  209. /*
  210. * Enhanced information structure for use with IOCTL_VIDEO_ATI_GET_VERSION.
  211. * This structure will be used if a non-null input buffer is passed when
  212. * making the call, and the older structure above will be used if a null
  213. * input buffer is passed.
  214. */
  215. typedef struct{
  216. ULONG StructureVersion; /* Revision of structure being passed in */
  217. ULONG InterfaceVersion; /* Revision of private interface being used */
  218. ULONG ChipIndex; /* Which accelerator chip is present */
  219. ULONG ChipFlag; /* Flag corresponding to chip being used */
  220. ULONG ApertureType; /* Best aperture type available */
  221. ULONG ApertureFlag; /* Flag corresponding to aperture type */
  222. ULONG BusType; /* Type of bus being used */
  223. ULONG BusFlag; /* Flag corresponding to bus type */
  224. ULONG FeatureFlags; /* Flags for features/bugs of this card */
  225. ULONG NumCards; /* Number of ATI cards in the system */
  226. } ENH_VERSION_NT, *PENH_VERSION_NT;
  227. /*
  228. * Values which can be placed in ModeFlags field of ATI_MODE_INFO.
  229. *
  230. * Flags should be added to this field if they represent bugs/features
  231. * which affect some but not all resolution/pixel depth combinations
  232. * on a given card.
  233. */
  234. #define AMI_ODD_EVEN 0x00000001 // Hardware cursor odd/even bug, undefined
  235. // for cards without hardware cursor
  236. #define AMI_MIN_MODE 0x00000002 // 8514/A compatible minimum mode
  237. #define AMI_2M_BNDRY 0x00000004 // Tearing occurs on 2M boundary
  238. #define AMI_BLOCK_WRITE 0x00000008 // Block write is supported. This is
  239. // mode-independent, but must be tested
  240. // after we have switched into graphics mode.
  241. #define AMI_TEXTBAND 0x00000010 // Text banding in 24BPP mode
  242. /*
  243. * Mode information structure for use with IOCTL_VIDEO_ATI_GET_MODE_INFORMATION.
  244. * This structure provides information specific to the video mode in use.
  245. */
  246. typedef struct{
  247. ULONG ModeFlags; /* Flags for features/bugs of this mode */
  248. LONG VisWidthPix; /* Visible screen width in pixels */
  249. LONG VisWidthByte; /* Visible screen width in bytes */
  250. LONG VisHeight; /* Visible screen height */
  251. LONG BitsPerPixel;
  252. /*
  253. * The next 2 fields hold the number of bytes of memory used per pixel
  254. * (integer and fractional parts). A 4BPP unpacked (1 pixel per byte,
  255. * ignore unused 4 bits) mode would yield 1 and 0, the same as for 8BPP
  256. * (1.0 bytes per pixel). A 4BPP packed (2 pixels per byte) mode would
  257. * yield 0 and 500 (0.500 bytes per pixel). The fractional field will
  258. * always hold a 3-digit number, since bytes per pixel will always be
  259. * a multiple of 0.125 (one bit is one-eighth of a byte).
  260. */
  261. LONG IntBytesPerPixel;
  262. LONG FracBytesPerPixel;
  263. LONG PitchPix; /* Screen pitch in pixels */
  264. LONG PitchByte; /* Screen pitch in bytes */
  265. /*
  266. * The following fields refer to the offscreen block to the right of
  267. * the visible screen. This block is only present when the screen pitch
  268. * differs from the visible screen width. Its height is always the
  269. * same as the visible screen height, and its vertical start offset
  270. * is assumed to be zero.
  271. *
  272. * NOTE: If RightWidthPix is zero, this block does not exist for the
  273. * current mode, and the other fields in this group are undefined.
  274. */
  275. LONG RightWidthPix; /* Width of block in pixels */
  276. LONG RightWidthByte; /* Width of block in bytes */
  277. LONG RightStartOffPix; /* Horizontal start offset of block in pixels */
  278. LONG RightStartOffByte; /* Horizontal start offset of block in bytes */
  279. LONG RightEndOffPix; /* Horizontal end offset of block in pixels */
  280. LONG RightEndOffByte; /* Horizontal end offset of block in bytes */
  281. /*
  282. * The following fields refer to the offscreen block below the visible
  283. * screen. Values listed as "Hard" refer to the maximum vertical offset
  284. * for which enough video memory exists to support a full line of pixels.
  285. * Values listed as "Soft" refer to the maximum vertical offset which
  286. * can be reached without writing to the GE_OFFSET register.
  287. *
  288. * The horizontal start offset is assumed to be zero.
  289. */
  290. LONG BottomWidthPix; /* Width of block in pixels */
  291. LONG BottomWidthByte; /* Width of block in bytes */
  292. LONG BottomStartOff; /* Vertical start offset of block */
  293. LONG BottomEndOffSoft; /* "Soft" vertical end offset of block */
  294. LONG BottomEndOffHard; /* "Hard" vertical end offset of block */
  295. LONG BottomHeightSoft; /* "Soft" height of block */
  296. LONG BottomHeightHard; /* "Hard" height of block */
  297. } ATI_MODE_INFO, *PATI_MODE_INFO;
  298. //------------------------------------------------------------------------
  299. /*
  300. * IOCTL codes to allow communication between the miniport driver
  301. * and higher-level modules. The Windows NT specification allocates
  302. * function codes 2048-4095 to external vendors.
  303. */
  304. #define IOCTL_VIDEO_MIN_EXTERNAL_VENDOR \
  305. CTL_CODE(FILE_DEVICE_VIDEO, 2048, METHOD_BUFFERED, FILE_ANY_ACCESS)
  306. #define IOCTL_VIDEO_MAX_EXTERNAL_VENDOR \
  307. CTL_CODE(FILE_DEVICE_VIDEO, 4095, METHOD_BUFFERED, FILE_ANY_ACCESS)
  308. #define IOCTL_VIDEO_ATI_GET_VERSION \
  309. CTL_CODE(FILE_DEVICE_VIDEO, 2048, METHOD_BUFFERED, FILE_ANY_ACCESS)
  310. #define IOCTL_VIDEO_ATI_EM_SYNC_TO_MINIPORT \
  311. CTL_CODE(FILE_DEVICE_VIDEO, 2049, METHOD_BUFFERED, FILE_ANY_ACCESS)
  312. #define IOCTL_VIDEO_ATI_EM_SYNC_FROM_MINIPORT \
  313. CTL_CODE(FILE_DEVICE_VIDEO, 2050, METHOD_BUFFERED, FILE_ANY_ACCESS)
  314. #define IOCTL_VIDEO_ATI_GET_MODE_INFORMATION \
  315. CTL_CODE(FILE_DEVICE_VIDEO, 2051, METHOD_BUFFERED, FILE_ANY_ACCESS)
  316. /*
  317. * The following definitions and IOCTLs are standard definitions from
  318. * the NTDDVDEO.H file in Daytona and later releases of Windows NT.
  319. * They are provided here to let earlier versions use the DPMS IOCTLs
  320. * without requiring source changes. Do not edit this section.
  321. *
  322. * Structures are made conditional on the absence of one of the
  323. * power management IOCTLs, rather than on the structure itself,
  324. * since "#if !defined(<symbol>)" doesn't trigger on symbols that
  325. * refer to structures, rather than numeric values.
  326. */
  327. //
  328. // IOCTL_VIDEO_SET_POWER_MANAGEMENT - Tells the device to change the power
  329. // consumption level of the device to the
  330. // new state.
  331. // IOCTL_VIDEO_GET_POWER_MANAGEMENT - Return the current power consumption
  332. // level of the device.
  333. //
  334. // NOTE:
  335. // This IOCTL is based on the VESA DPMS proposal.
  336. // Changes to the DPMS standard will be refelcted in this IOCTL.
  337. //
  338. #if !defined(IOCTL_VIDEO_SET_POWER_MANAGEMENT)
  339. typedef enum _VIDEO_POWER_STATE {
  340. VideoPowerOn = 1,
  341. VideoPowerStandBy,
  342. VideoPowerSuspend,
  343. VideoPowerOff
  344. } VIDEO_POWER_STATE, *PVIDEO_POWER_STATE;
  345. #endif
  346. #if !defined(IOCTL_VIDEO_SET_POWER_MANAGEMENT)
  347. typedef struct _VIDEO_POWER_MANAGEMENT {
  348. ULONG Length;
  349. ULONG DPMSVersion;
  350. ULONG PowerState;
  351. } VIDEO_POWER_MANAGEMENT, *PVIDEO_POWER_MANAGEMENT;
  352. #endif
  353. //
  354. //Length - Length of the structure in bytes. Also used to do verisioning.
  355. //
  356. //DPMSVersion - Version of the DPMS standard supported by the device.
  357. // Only used in the "GET" IOCTL.
  358. //
  359. //PowerState - One of the power states listed in VIDEO_POWER_STATE.
  360. //
  361. //
  362. // Note:
  363. // Once the power has been turned off to the device, all other IOCTLs made
  364. // to the miniport will be intercepted by the port driver and will return
  365. // failiure, until the power on the device has been turned back on.
  366. //
  367. /*
  368. * We use the presence or absence of various IOCTLs to determine
  369. * the build of Windows NT for which we are compiling the driver.
  370. * If this file is included, but the file which contains the IOCTLs
  371. * is not, in a source file, this will result in a false report of
  372. * the target build, which can cause numerous problems.
  373. *
  374. * This conditional block will force a compile error if the file
  375. * containing the IOCTLs (NTDDVDEO.H in NT 3.51 retail) was not
  376. * included prior to this file being included.
  377. */
  378. #if !defined(IOCTL_VIDEO_SET_CURRENT_MODE)
  379. NTDDVDEO.H must be included before ATINT.H
  380. #endif
  381. /*
  382. * End of DPMS support for pre-Daytona versions of Windows NT.
  383. */
  384. #define IOCTL_VIDEO_ATI_INIT_AUX_CARD \
  385. CTL_CODE(FILE_DEVICE_VIDEO, 2054, METHOD_BUFFERED, FILE_ANY_ACCESS)
  386. /*
  387. * Structures used in DCI support. They were added some time after the
  388. * initial release of Windows NT 3.5, so we must make them available only
  389. * if they're not already defined. These "placeholders" are solely to
  390. * allow the miniport to be compiled - the packets will only be called
  391. * in later versions of Windows NT 3.5.
  392. *
  393. * There are no "placeholders" for the IOCTLs themselves, since their
  394. * presence or absence is used to determine whether or not to compile
  395. * the DCI cases in ATIMPStartIO().
  396. */
  397. //
  398. // _WIN32_WINNT is available starting from NT 4.0.
  399. //
  400. #if (_WIN32_WINNT >= 0x500)
  401. #define TARGET_BUILD 500
  402. #else
  403. #if (_WIN32_WINNT >= 0x400)
  404. #define TARGET_BUILD 400
  405. #else
  406. #define TARGET_BUILD 351
  407. #endif
  408. #endif
  409. /*
  410. * Keys to be used in DrvEscape() call to handle DPMS and other private
  411. * ATI functions. These keys fit into a large "hole" between
  412. * GETSETSCREENPARAMS (3072) and BEGIN_PATH (4096)
  413. */
  414. #define ESC_SET_POWER_MANAGEMENT 4000
  415. #define ESC_GET_NUM_CARDS 4001
  416. #define ESC_GET_MODES 4002
  417. #define ESC_GET_VGA_ENABLED 4003
  418. #define ESC_SET_CURRENT_FULLSCREEN 4004
  419. /*
  420. * Values to show whether or not a given function is supported by
  421. * the DrvEscape entry point.
  422. */
  423. #define ESC_IS_SUPPORTED 0x00000001 /* Function is supported */
  424. #define ESC_NOT_SUPPORTED 0xFFFFFFFF /* Unsupported function called */
  425. #define ESC_NOT_IMPLEMENTED 0x00000000 /* QUERYESCSUPPORT called for unimplemented function */
  426. //********************* end of ATINT.H ****************************