PageRenderTime 142ms CodeModel.GetById 32ms RepoModel.GetById 7ms app.codeStats 1ms

/src/vb_def.h

#
C Header | 1096 lines | 825 code | 106 blank | 165 comment | 0 complexity | d05c8487793c2a26528c892504a855f6 MD5 | raw file
Possible License(s): MIT
  1. /* Copyright (C) 2003-2006 by XGI Technology, Taiwan.
  2. *
  3. * All Rights Reserved.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining
  6. * a copy of this software and associated documentation files (the
  7. * "Software"), to deal in the Software without restriction, including
  8. * without limitation on the rights to use, copy, modify, merge,
  9. * publish, distribute, sublicense, and/or sell copies of the Software,
  10. * and to permit persons to whom the Software is furnished to do so,
  11. * subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice (including the
  14. * next paragraph) shall be included in all copies or substantial
  15. * portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  18. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  19. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  20. * NON-INFRINGEMENT. IN NO EVENT SHALL XGI AND/OR
  21. * ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  22. * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  23. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  24. * DEALINGS IN THE SOFTWARE.
  25. */
  26. #ifndef _INITDEF_
  27. #define _INITDEF_
  28. #ifndef NewScratch
  29. #define NewScratch
  30. #endif
  31. /* shampoo */
  32. #ifdef LINUX_KERNEL
  33. #define SEQ_ADDRESS_PORT 0x0014
  34. #define SEQ_DATA_PORT 0x0015
  35. #define MISC_OUTPUT_REG_READ_PORT 0x001C
  36. #define MISC_OUTPUT_REG_WRITE_PORT 0x0012
  37. #define GRAPH_DATA_PORT 0x1F
  38. #define GRAPH_ADDRESS_PORT 0x1E
  39. #define XGI_MASK_DUAL_CHIP 0x04 /* SR3A */
  40. #define CRTC_ADDRESS_PORT_COLOR 0x0024
  41. #define VIDEO_SUBSYSTEM_ENABLE_PORT 0x0013
  42. #define PCI_COMMAND 0x04
  43. #endif
  44. /* ~shampoo */
  45. #define VB_XGI301 0x0001 /*301b*/
  46. #define VB_XGI301B 0x0002
  47. #define VB_XGI302B 0x0004
  48. #define VB_XGI301LV 0x0008 /*301lv*/
  49. #define VB_XGI302LV 0x0010
  50. #define VB_XGI302ELV 0x0020
  51. #define VB_XGI301C 0x0040 /* for 301C */
  52. #define VB_NoLCD 0x8000
  53. #define VB_XGI301BLV302BLV (VB_XGI301B|VB_XGI301C|VB_XGI302B|VB_XGI301LV|VB_XGI302LV|VB_XGI302ELV)
  54. #define VB_XGI301LV302LV (VB_XGI301LV|VB_XGI302LV|VB_XGI302ELV)
  55. #define VB_XGIVB (VB_XGI301 | VB_XGI301BLV302BLV)
  56. /*end 301b*/
  57. #define VB_YPbPrInfo 0x07 /*301lv*/
  58. #define VB_YPbPr525i 0x00
  59. #define VB_YPbPr525p 0x01
  60. #define VB_YPbPr750p 0x02
  61. #define VB_YPbPr1080i 0x03
  62. /* #define CRT1Len 17 */
  63. #define LVDSCRT1Len 15
  64. #define CHTVRegDataLen 5
  65. /* #define ModeInfoFlag 0x07 */
  66. /* #define IsTextMode 0x07 */
  67. /* #define ModeText 0x00 */
  68. /* #define ModeCGA 0x01 */
  69. /* #define ModeEGA 0x02 */
  70. /* #define ModeVGA 0x03 */
  71. /* #define Mode15Bpp 0x04 */
  72. /* #define Mode16Bpp 0x05 */
  73. /* #define Mode24Bpp 0x06 */
  74. /* #define Mode32Bpp 0x07 */
  75. /* #define DACInfoFlag 0x18 */
  76. /* #define MemoryInfoFlag 0x1E0 */
  77. /* #define MemorySizeShift 0x05 */
  78. #define Charx8Dot 0x0200
  79. #define LineCompareOff 0x0400
  80. #define CRT2Mode 0x0800
  81. #define HalfDCLK 0x1000
  82. #define NoSupportSimuTV 0x2000
  83. #define DoubleScanMode 0x8000
  84. #define SupportAllCRT2 0x0078
  85. #define SupportTV 0x0008
  86. #define SupportHiVisionTV 0x0010
  87. #define SupportLCD 0x0020
  88. #define SupportRAMDAC2 0x0040 /* All (<= 100Mhz) */
  89. #define NoSupportTV 0x0070
  90. #define NoSupportHiVisionTV 0x0060
  91. #define NoSupportLCD 0x0058
  92. #define SupportCHTV 0x0800
  93. #define SupportCRT2in301C 0x0100 /* for 301C */
  94. #define SupportTV1024 0x0800 /*301b*/
  95. #define SupportYPbPr 0x1000 /*301lv*/
  96. #define InterlaceMode 0x0080
  97. #define SyncPP 0x0000
  98. #define SyncPN 0x4000
  99. #define SyncNP 0x8000
  100. /* #define SyncNN 0xc000 */
  101. #define ECLKindex0 0x0000
  102. #define ECLKindex1 0x0100
  103. #define ECLKindex2 0x0200
  104. #define ECLKindex3 0x0300
  105. #define ECLKindex4 0x0400
  106. /**
  107. * CR30
  108. */
  109. #define SetSimuScanMode 0x0001
  110. #define SwitchToCRT2 0x0002
  111. #define SetCRT2ToAVIDEO 0x0004
  112. #define SetCRT2ToSVIDEO 0x0008
  113. #define SetCRT2ToSCART 0x0010
  114. #define SetCRT2ToLCD 0x0020
  115. #define SetCRT2ToRAMDAC 0x0040
  116. #define SetCRT2ToHiVisionTV 0x0080
  117. #define SetCRT2ToCHYPbPr SetCRT2ToHiVisionTV /* for Chrontel */
  118. /**
  119. * CR31
  120. */
  121. #define SetNTSCTV 0x0000
  122. /* #define SetPALTV 0x0100 */
  123. #define SetCRT2ToLCDA 0x0100
  124. #define SetInSlaveMode 0x0200
  125. #define SetNotSimuMode 0x0400
  126. #define SetNotSimuTVMode SetNotSimuMode
  127. #define SetDispDevSwitch 0x0800
  128. #define SetCRT2ToYPbPr 0x0800
  129. #define LoadDACFlag 0x1000
  130. #define DisableCRT2Display 0x2000
  131. #define DriverMode 0x4000
  132. #define HotKeySwitch 0x8000
  133. #define SetCHTVOverScan 0x8000
  134. #define SetCRT2ToDualEdge 0x8000
  135. /* #define SetCRT2ToLCDA 0x8000 301b */
  136. #define PanelRGB18Bit 0x0100
  137. #define PanelRGB24Bit 0x0000
  138. /* v-- Needs change in xgi_vga.c if changed (GPIO) --v */
  139. #define SetCRT2ToTV1 (SetCRT2ToHiVisionTV | SetCRT2ToSCART | SetCRT2ToSVIDEO | SetCRT2ToAVIDEO)
  140. #define SetCRT2ToTV (SetCRT2ToYPbPr | SetCRT2ToTV1)
  141. #define TVOverScan 0x10
  142. #define TVOverScanShift 4
  143. #define ClearBufferFlag 0x20
  144. #define EnableDualEdge 0x01 /*301b*/
  145. #define SetToLCDA 0x02
  146. #define YPbPrModeInfo 0x38
  147. /* #define YPbPrMode525i 0x00 */
  148. /* #define YPbPrMode525p 0x08 */
  149. /* #define YPbPrMode750p 0x10 */
  150. /* #define YPbPrMode1080i 0x18 */
  151. #define SetSCARTOutput 0x01
  152. #define BoardTVType 0x02
  153. #define EnablePALMN 0x40 /* Romflag: 1 = Allow PALM/PALN */
  154. /* #define LCDVESATiming 0x0008 */
  155. /* #define EnableLVDSDDA 0x0010 */
  156. #define Panel320x480 0x07/*fstn*/
  157. /* [ycchen] 02/12/03 Modify for Multi-Sync. LCD Support */
  158. #define PanelResInfo 0x1F /* CR36 Panel Type/LCDResInfo */
  159. #define PanelRefInfo 0x60
  160. #define Panel800x600 0x01
  161. #define Panel1024x768 0x02
  162. #define Panel1024x768x75 0x22
  163. #define Panel1280x1024 0x03
  164. #define Panel1280x1024x75 0x23
  165. #define Panel640x480 0x04
  166. #define Panel1024x600 0x05
  167. #define Panel1152x864 0x06
  168. #define Panel1280x960 0x07
  169. #define Panel1152x768 0x08
  170. #define Panel1400x1050 0x09
  171. #define Panel1280x768 0x0A
  172. #define Panel1600x1200 0x0B
  173. #define Panel1600x1200_1 0x0E
  174. #define PanelRef60Hz 0x00
  175. #define PanelRef75Hz 0x20
  176. /* #define DDC2DelayTime 300 */
  177. #define CRT2DisplayFlag 0x2000
  178. /* #define LCDDataLen 8 */
  179. /* #define HiTVDataLen 12 */
  180. /* #define TVDataLen 16 */
  181. /* #define SetPALTV 0x0100 */
  182. #define HalfDCLK 0x1000
  183. #define NTSCHT 1716
  184. #define NTSC2HT 1920
  185. #define NTSCVT 525
  186. #define PALHT 1728
  187. #define PALVT 625
  188. #define StHiTVHT 892
  189. #define StHiTVVT 1126
  190. #define StHiTextTVHT 1000
  191. #define StHiTextTVVT 1126
  192. #define ExtHiTVHT 2100
  193. #define ExtHiTVVT 1125
  194. #define St750pTVHT 1716
  195. #define St750pTVVT 525
  196. #define Ext750pTVHT 1716
  197. #define Ext750pTVVT 525
  198. #define St525pTVHT 1716
  199. #define St525pTVVT 525
  200. #define Ext525pTVHT 1716
  201. #define Ext525pTVVT 525
  202. #define St525iTVHT 1716
  203. #define St525iTVVT 525
  204. #define Ext525iTVHT 1716
  205. #define Ext525iTVVT 525
  206. #define VCLKStartFreq 25
  207. #define SoftDramType 0x80
  208. #define VCLK40 0x04
  209. #define VCLK162 0x21
  210. #define YPbPr525iVCLK 0x03B
  211. #define YPbPr525iVCLK_2 0x03A
  212. /* #define LCDVESATiming 0x08 */
  213. #define SetSCARTOutput 0x01
  214. #define AVIDEOSense 0x01
  215. #define SVIDEOSense 0x02
  216. #define SCARTSense 0x04
  217. #define LCDSense 0x08
  218. #define Monitor1Sense 0x20
  219. #define Monitor2Sense 0x10
  220. #define HiTVSense 0x40
  221. #define BoardTVType 0x02
  222. #define HotPlugFunction 0x08
  223. #define StStructSize 0x06
  224. #define XGI_VIDEO_CAPTURE 0x00 - 0x30
  225. #define XGI_VIDEO_PLAYBACK 0x02 - 0x30
  226. #define XGI_CRT2_PORT_00 0x00 - 0x30
  227. #define XGI_CRT2_PORT_04 0x04 - 0x30
  228. #define XGI_CRT2_PORT_10 0x10 - 0x30
  229. #define XGI_CRT2_PORT_12 0x12 - 0x30
  230. #define XGI_CRT2_PORT_14 0x14 - 0x30
  231. #define ADR_CRT2PtrData 0x20E
  232. #define offset_Zurac 0x210 /* TW: Trumpion Zurac data pointer */
  233. #define ADR_LVDSDesPtrData 0x212
  234. #define ADR_LVDSCRT1DataPtr 0x214
  235. #define ADR_CHTVVCLKPtr 0x216
  236. #define ADR_CHTVRegDataPtr 0x218
  237. #define LVDSDataLen 6
  238. /* #define EnableLVDSDDA 0x10 */
  239. /* #define LVDSDesDataLen 3 */
  240. #define ActiveNonExpanding 0x40
  241. #define ActiveNonExpandingShift 6
  242. /* #define ActivePAL 0x20 */
  243. #define ActivePALShift 5
  244. /* #define ModeSwitchStatus 0x0F */
  245. #define SoftTVType 0x40
  246. #define SoftSettingAddr 0x52
  247. #define ModeSettingAddr 0x53
  248. /* #define SelectCRT1Rate 0x4 */
  249. #define _PanelType00 0x00
  250. #define _PanelType01 0x08
  251. #define _PanelType02 0x10
  252. #define _PanelType03 0x18
  253. #define _PanelType04 0x20
  254. #define _PanelType05 0x28
  255. #define _PanelType06 0x30
  256. #define _PanelType07 0x38
  257. #define _PanelType08 0x40
  258. #define _PanelType09 0x48
  259. #define _PanelType0A 0x50
  260. #define _PanelType0B 0x58
  261. #define _PanelType0C 0x60
  262. #define _PanelType0D 0x68
  263. #define _PanelType0E 0x70
  264. #define _PanelType0F 0x78
  265. #define PRIMARY_VGA 0 /* 1: XGI is primary vga 0:XGI is secondary vga */
  266. #define BIOSIDCodeAddr 0x235 /* Offsets to ptrs in BIOS image */
  267. #define OEMUtilIDCodeAddr 0x237
  268. #define VBModeIDTableAddr 0x239
  269. #define OEMTVPtrAddr 0x241
  270. #define PhaseTableAddr 0x243
  271. #define NTSCFilterTableAddr 0x245
  272. #define PALFilterTableAddr 0x247
  273. #define OEMLCDPtr_1Addr 0x249
  274. #define OEMLCDPtr_2Addr 0x24B
  275. #define LCDHPosTable_1Addr 0x24D
  276. #define LCDHPosTable_2Addr 0x24F
  277. #define LCDVPosTable_1Addr 0x251
  278. #define LCDVPosTable_2Addr 0x253
  279. #define OEMLCDPIDTableAddr 0x255
  280. #define VBModeStructSize 5
  281. #define PhaseTableSize 4
  282. #define FilterTableSize 4
  283. #define LCDHPosTableSize 7
  284. #define LCDVPosTableSize 5
  285. #define OEMLVDSPIDTableSize 4
  286. #define LVDSHPosTableSize 4
  287. #define LVDSVPosTableSize 6
  288. #define VB_ModeID 0
  289. #define VB_TVTableIndex 1
  290. #define VB_LCDTableIndex 2
  291. #define VB_LCDHIndex 3
  292. #define VB_LCDVIndex 4
  293. #define OEMLCDEnable 0x0001
  294. #define OEMLCDDelayEnable 0x0002
  295. #define OEMLCDPOSEnable 0x0004
  296. #define OEMTVEnable 0x0100
  297. #define OEMTVDelayEnable 0x0200
  298. #define OEMTVFlickerEnable 0x0400
  299. #define OEMTVPhaseEnable 0x0800
  300. #define OEMTVFilterEnable 0x1000
  301. #define OEMLCDPanelIDSupport 0x0080
  302. /* #define LCDVESATiming 0x0001 //LCD Info CR37 */
  303. /* #define EnableLVDSDDA 0x0002 */
  304. #define EnableScalingLCD 0x0008
  305. #define SetPWDEnable 0x0004
  306. #define SetLCDtoNonExpanding 0x0010
  307. /* #define SetLCDPolarity 0x00E0 */
  308. #define SetLCDDualLink 0x0100
  309. #define SetLCDLowResolution 0x0200
  310. #define SetLCDStdMode 0x0400
  311. #define SetTVStdMode 0x0200
  312. #define SetTVLowResolution 0x0400
  313. /* =============================================================
  314. for 310
  315. ============================================================== */
  316. #define SoftDRAMType 0x80
  317. #define SoftSetting_OFFSET 0x52
  318. #define SR07_OFFSET 0x7C
  319. #define SR15_OFFSET 0x7D
  320. #define SR16_OFFSET 0x81
  321. #define SR17_OFFSET 0x85
  322. #define SR19_OFFSET 0x8D
  323. #define SR1F_OFFSET 0x99
  324. #define SR21_OFFSET 0x9A
  325. #define SR22_OFFSET 0x9B
  326. #define SR23_OFFSET 0x9C
  327. #define SR24_OFFSET 0x9D
  328. #define SR25_OFFSET 0x9E
  329. #define SR31_OFFSET 0x9F
  330. #define SR32_OFFSET 0xA0
  331. #define SR33_OFFSET 0xA1
  332. #define CR40_OFFSET 0xA2
  333. #define SR25_1_OFFSET 0xF6
  334. #define CR49_OFFSET 0xF7
  335. #define VB310Data_1_2_Offset 0xB6
  336. #define VB310Data_4_D_Offset 0xB7
  337. #define VB310Data_4_E_Offset 0xB8
  338. #define VB310Data_4_10_Offset 0xBB
  339. #define RGBSenseDataOffset 0xBD
  340. #define YCSenseDataOffset 0xBF
  341. #define VideoSenseDataOffset 0xC1
  342. #define OutputSelectOffset 0xF3
  343. #define ECLK_MCLK_DISTANCE 0x14
  344. #define VBIOSTablePointerStart 0x200
  345. #define StandTablePtrOffset VBIOSTablePointerStart+0x02
  346. #define EModeIDTablePtrOffset VBIOSTablePointerStart+0x04
  347. #define CRT1TablePtrOffset VBIOSTablePointerStart+0x06
  348. #define ScreenOffsetPtrOffset VBIOSTablePointerStart+0x08
  349. #define VCLKDataPtrOffset VBIOSTablePointerStart+0x0A
  350. #define MCLKDataPtrOffset VBIOSTablePointerStart+0x0E
  351. #define CRT2PtrDataPtrOffset VBIOSTablePointerStart+0x10
  352. #define TVAntiFlickPtrOffset VBIOSTablePointerStart+0x12
  353. #define TVDelayPtr1Offset VBIOSTablePointerStart+0x14
  354. #define TVPhaseIncrPtr1Offset VBIOSTablePointerStart+0x16
  355. #define TVYFilterPtr1Offset VBIOSTablePointerStart+0x18
  356. #define LCDDelayPtr1Offset VBIOSTablePointerStart+0x20
  357. #define TVEdgePtr1Offset VBIOSTablePointerStart+0x24
  358. #define CRT2Delay1Offset VBIOSTablePointerStart+0x28
  359. #define LCDDataDesOffset VBIOSTablePointerStart-0x02
  360. #define LCDDataPtrOffset VBIOSTablePointerStart+0x2A
  361. #define LCDDesDataPtrOffset VBIOSTablePointerStart+0x2C
  362. #define LCDDataList VBIOSTablePointerStart+0x22 /* add for GetLCDPtr */
  363. #define TVDataList VBIOSTablePointerStart+0x36 /* add for GetTVPtr */
  364. /* */
  365. /* Modify from 310.inc */
  366. /* */
  367. /* */
  368. #define ShowMsgFlag 0x20 /* SoftSetting */
  369. #define ShowVESAFlag 0x10
  370. #define HotPlugFunction 0x08
  371. #define ModeSoftSetting 0x04
  372. #define TVSoftSetting 0x02
  373. #define LCDSoftSetting 0x01
  374. #define GatingCRTinLCDA 0x10
  375. #define SetHiTVOutput 0x08
  376. #define SetYPbPrOutput 0x04
  377. #define BoardTVType 0x02
  378. #define SetSCARTOutput 0x01
  379. #define ModeSettingYPbPr 0x02 /* TVModeSetting, Others as same as CR30 */
  380. /* TVModeSetting same as CR35 */
  381. /* LCDModeSetting same as CR37 */
  382. #define EnableNewTVFont 0x10 /* MiscCapability */
  383. #define EnableLCDOutput 0x80 /* LCDCfgSetting */
  384. #define SoftDRAMType 0x80 /* DRAMSetting */
  385. #define SoftDRAMConfig 0x40
  386. #define MosSelDRAMType 0x20
  387. #define SDRAM 000h
  388. #define SGRAM 0x01
  389. #define ESDRAM 0x02
  390. #define EnableAGPCfgSetting 0x01 /* AGPCfgSetting */
  391. /* ---------------- SetMode Stack */
  392. #define CRT1Len 15
  393. #define VCLKLen 4
  394. #define DefThreshold 0x0100
  395. #define ExtRegsSize (57+8+37+70+63+28+768+1)/64+1
  396. #define VB_XGI301 0x0001 /* VB Type Info */
  397. #define VB_XGI301B 0x0002 /* 301 series */
  398. #define VB_XGI302B 0x0004
  399. #define VB_NoLCD 0x8000
  400. #define VB_XGI301LV 0x0008
  401. #define VB_XGI302LV 0x0010
  402. #define VB_LVDS_NS 0x0001 /* 3rd party chip */
  403. /* Jong 10/04/2007; merge code */
  404. #define VB_CH7017 0x0002
  405. #define VB_CH7007 0x0080 /* [Billy] 07/05/03 */
  406. /* #define VB_LVDS_SI 0x0004 */
  407. #define ModeInfoFlag 0x0007
  408. #define IsTextMode 0x0007
  409. #define ModeText 0x0000
  410. #define ModeCGA 0x0001
  411. #define ModeEGA 0x0002 /* 16 colors mode */
  412. #define ModeVGA 0x0003 /* 256 colors mode */
  413. #define Mode15Bpp 0x0004 /* 15 Bpp Color Mode */
  414. #define Mode16Bpp 0x0005 /* 16 Bpp Color Mode */
  415. #define Mode24Bpp 0x0006 /* 24 Bpp Color Mode */
  416. #define Mode32Bpp 0x0007 /* 32 Bpp Color Mode */
  417. #define DACInfoFlag 0x0018
  418. #define MONODAC 0x0000
  419. #define CGADAC 0x0008
  420. #define EGADAC 0x0010
  421. #define VGADAC 0x0018
  422. #define MemoryInfoFlag 0x01e0
  423. #define MemorySizeShift 5
  424. #define Need1MSize 0x0000
  425. #define Need2MSize 0x0020
  426. #define Need4MSize 0x0060
  427. #define Need8MSize 0x00e0
  428. #define Need16MSize 0x01e0
  429. #define Charx8Dot 0x0200
  430. #define LineCompareOff 0x0400
  431. #define CRT2Mode 0x0800
  432. #define HalfDCLK 0x1000
  433. #define NoSupportSimuTV 0x2000
  434. #define DoubleScanMode 0x8000
  435. /* -------------- Ext_InfoFlag */
  436. #define SupportModeInfo 0x0007
  437. #define Support256 0x0003
  438. #define Support15Bpp 0x0004
  439. #define Support16Bpp 0x0005
  440. #define Support24Bpp 0x0006
  441. #define Support32Bpp 0x0007
  442. #define SupportAllCRT2 0x0078
  443. #define SupportTV 0x0008
  444. #define SupportHiVisionTV 0x0010
  445. #define SupportLCD 0x0020
  446. #define SupportRAMDAC2 0x0040
  447. #define NoSupportTV 0x0070
  448. #define NoSupportHiVisionTV 0x0060
  449. #define NoSupportLCD 0x0058
  450. #define SupportTV1024 0x0800 /* 301btest */
  451. #define SupportYPbPr 0x1000 /* 301lv */
  452. #define InterlaceMode 0x0080
  453. #define SyncPP 0x0000
  454. #define SyncPN 0x4000
  455. #define SyncNP 0x8000
  456. #define SyncNN 0xc000
  457. /**
  458. * Bits for SetFlag
  459. */
  460. #define ProgrammingCRT2 0x0001
  461. #define LowModeTests 0x0002
  462. #define EnableVCMode 0x0004
  463. #define SetHKEventMode 0x0008
  464. #define ReserveTVOption 0x0010
  465. #define DisableRelocateIO 0x0020
  466. #define Win9xDOSMode 0x0040
  467. #define GatingCRT 0x0800
  468. #define DisableChB 0x1000
  469. #define EnableChB 0x2000
  470. #define DisableChA 0x4000
  471. #define EnableChA 0x8000
  472. #define SetNTSCTV 0x0000 /* TV Info */
  473. #define SetPALTV 0x0001
  474. #define SetNTSCJ 0x0002
  475. #define SetPALMTV 0x0004
  476. #define SetPALNTV 0x0008
  477. #define SetCHTVUnderScan 0x0000
  478. /* #define SetCHTVOverScan 0x0010 */
  479. #define SetYPbPrMode525i 0x0020
  480. #define SetYPbPrMode525p 0x0040
  481. #define SetYPbPrMode750p 0x0080
  482. #define SetYPbPrMode1080i 0x0100
  483. #define SetTVStdMode 0x0200
  484. #define SetTVLowResolution 0x0400
  485. #define SetTVSimuMode 0x0800
  486. #define TVSimuMode 0x0800
  487. #define RPLLDIV2XO 0x1000
  488. #define NTSC1024x768 0x2000
  489. #define SetTVLockMode 0x4000
  490. #define LCDVESATiming 0x0001 /* LCD Info/CR37 */
  491. #define EnableLVDSDDA 0x0002
  492. #define EnableScalingLCD 0x0008
  493. #define SetPWDEnable 0x0004
  494. #define SetLCDtoNonExpanding 0x0010
  495. #define SetLCDPolarity 0x00e0
  496. #define SetLCDDualLink 0x0100
  497. #define SetLCDLowResolution 0x0200
  498. #define SetLCDStdMode 0x0400
  499. #define EnableReduceTiming 0x0800
  500. #define DefaultLCDCap 0x80ea /* LCD Capability shampoo */
  501. #define RLVDSDHL00 0x0000
  502. #define RLVDSDHL01 0x0001
  503. #define RLVDSDHL10 0x0002 /* default */
  504. #define RLVDSDHL11 0x0003
  505. #define EnableLCD24bpp 0x0004 /* default */
  506. #define DisableLCD24bpp 0x0000
  507. #define RLVDSClkSFT0 0x0000
  508. #define RLVDSClkSFT1 0x0008 /* default */
  509. #define EnableLVDSDCBal 0x0010
  510. #define DisableLVDSDCBal 0x0000 /* default */
  511. #define SinglePolarity 0x0020 /* default */
  512. #define MultiPolarity 0x0000
  513. #define LCDPolarity 0x00c0 /* default: SyncNN */
  514. #define LCDSingleLink 0x0000 /* default */
  515. #define LCDDualLink 0x0100
  516. #define EnableSpectrum 0x0200
  517. #define DisableSpectrum 0x0000 /* default */
  518. #define PWDEnable 0x0400
  519. #define PWDDisable 0x0000 /* default */
  520. #define PWMEnable 0x0800
  521. #define PWMDisable 0x0000 /* default */
  522. #define EnableVBCLKDRVLOW 0x4000
  523. #define EnableVBCLKDRVHigh 0x0000 /* default */
  524. #define EnablePLLSPLOW 0x8000
  525. #define EnablePLLSPHigh 0x0000 /* default */
  526. #define LCDBToA 0x20 /* LCD SetFlag */
  527. #define StLCDBToA 0x40
  528. #define LockLCDBToA 0x80
  529. #define LCDToFull 0x10
  530. #define AVIDEOSense 0x01 /* CR32 */
  531. #define SVIDEOSense 0x02
  532. #define SCARTSense 0x04
  533. #define LCDSense 0x08
  534. #define Monitor2Sense 0x10
  535. #define Monitor1Sense 0x20
  536. #define HiTVSense 0x40
  537. #ifdef NewScratch
  538. #define YPbPrSense 0x80 /* NEW SCRATCH */
  539. #endif
  540. #define TVSense 0xc7
  541. /**
  542. * CR35 (661 series only)
  543. *
  544. * [0] 1 = PAL, 0 = NTSC
  545. * [1] 1 = NTSC-J (if D0 = 0)
  546. * [2] 1 = PALM (if D0 = 1)
  547. * [3] 1 = PALN (if D0 = 1)
  548. * [4] 1 = Overscan (Chrontel only)
  549. * [7:5] (only if D2 in CR38 is set)
  550. * 000 525i
  551. * 001 525p
  552. * 010 750p
  553. * 011 1080i (or HiVision on 301, 301B)
  554. *
  555. * These bits are being translated to TVMode flag.
  556. */
  557. #define TVOverScan 0x10
  558. #define TVOverScanShift 4
  559. #ifdef NewScratch
  560. #define NTSCMode 0x00
  561. #define PALMode 0x00
  562. #define NTSCJMode 0x02
  563. #define PALMNMode 0x0c
  564. #define YPbPrMode 0xe0
  565. #define YPbPrMode525i 0x00
  566. #define YPbPrMode525p 0x20
  567. #define YPbPrMode750p 0x40
  568. #define YPbPrMode1080i 0x60
  569. #else /* Old Scratch */
  570. #define ClearBufferFlag 0x20
  571. #endif
  572. /**
  573. * CR37
  574. *
  575. * [0] Set 24/18 bit (0/1) RGB to LVDS/TMDS transmitter (set by BIOS)
  576. * [3:1] External chip
  577. * 660 series [2:1] only:
  578. * reserved (now in CR38)
  579. * All other combinations reserved
  580. * [3] 661 only: Pass 1:1 data
  581. * [4] LVDS: 0: Panel Link expands / 1: Panel Link does not expand
  582. * 30x: 0: Bridge scales / 1: Bridge does not scale = Panel scales (if possible)
  583. * [5] LCD polarity select
  584. * 0: VESA DMT Standard
  585. * 1: EDID 2.x defined
  586. * [6] LCD horizontal polarity select
  587. * 0: High active
  588. * 1: Low active
  589. * [7] LCD vertical polarity select
  590. * 0: High active
  591. * 1: Low active
  592. */
  593. #define ExtChipTrumpion 0x0006 /**< Is this actually CR38? */
  594. #define ExtChipMitacTV 0x000a /**< Is this actually CR38? */
  595. #define LCDRGB18Bit 0x0001
  596. #define ScalingLCD 0x0008
  597. #define LCDNonExpanding 0x0010
  598. #define LCDNonExpandingShift 4
  599. #define LCDSync 0x0020
  600. #define LCDSyncBit 0x00e0 /* H/V polarity & sync ID */
  601. #define LCDSyncShift 6
  602. #define LCDPass11 0x0100 /* 0: center screen, 1: Pass 1:1 data */
  603. #define DontExpandLCD LCDNonExpanding
  604. #define DontExpandLCDShift LCDNonExpandingShift
  605. /**
  606. * CR38 (661 and later)
  607. *
  608. * D[7:5] 000 No VB
  609. * 001 301 series VB
  610. * 010 LVDS
  611. * 011 Chrontel 7019
  612. * 100 Conexant
  613. * D2 Enable YPbPr output (see CR35)
  614. * D[1:0] LCDA (like before)
  615. */
  616. #define EnableDualEdge 0x01 /* CR38 */
  617. #define SetToLCDA 0x02
  618. #ifdef NewScratch
  619. #define SetYPbPr 0x04
  620. #define DisableChannelA 0x08
  621. #define DisableChannelB 0x10
  622. #define ExtChipType 0xe0
  623. #define ExtChip301 0x20
  624. #define ExtChipLVDS 0x40
  625. #define ExtChipCH7019 0x60
  626. #else /* Old Scratch */
  627. #define YPbPrSense 0x04
  628. #define SetYPbPr 0x08
  629. #define YPbPrMode 0x30
  630. #define YPbPrMode525i 0x00
  631. #define YPbPrMode525p 0x10
  632. #define YPbPrMode750p 0x20
  633. #define YPbPrMode1080i 0x30
  634. #define PALMNMode 0xc0
  635. #endif
  636. /**
  637. * CR39 (661 and later)
  638. *
  639. * D[1:0] YPbPr Aspect Ratio
  640. * 00 4:3 letterbox
  641. * 01 4:3
  642. * 10 16:9
  643. * 11 4:3
  644. */
  645. #define ReduceTiming 0x0001
  646. #define BacklightControlBit 0x01 /* CR3A */
  647. #define Win9xforJap 0x40
  648. #define Win9xforKorea 0x80
  649. #define ForceMDBits 0x07 /* CR3B */
  650. #define ForceMD_JDOS 0x00
  651. #define ForceMD_640x400T 0x01
  652. #define ForceMD_640x350T 0x02
  653. #define ForceMD_720x400T 0x03
  654. #define ForceMD_640x480E 0x04
  655. #define ForceMD_640x400E 0x05
  656. #define ForceP1Bit 0x10
  657. #define ForceP2Bit 0x20
  658. #define EnableForceMDinBIOS 0x40
  659. #define EnableForceMDinDrv 0x80
  660. #ifdef NewScratch /* New Scratch */
  661. /* ---------------------- VUMA Information */
  662. #define LCDSettingFromCMOS 0x04 /* CR3C */
  663. #define TVSettingFromCMOS 0x08
  664. #define DisplayDeviceFromCMOS 0x10
  665. #define HKSupportInSBIOS 0x20
  666. #define OSDSupportInSBIOS 0x40
  667. #define DisableLogo 0x80
  668. /* ---------------------- HK Evnet Definition */
  669. #define HKEvent 0x0f /* CR3D */
  670. #define HK_ModeSwitch 0x01
  671. #define HK_Expanding 0x02
  672. #define HK_OverScan 0x03
  673. #define HK_Brightness 0x04
  674. #define HK_Contrast 0x05
  675. #define HK_Mute 0x06
  676. #define HK_Volume 0x07
  677. #define ModeSwitchStatus 0xf0
  678. #define ActiveCRT1 0x10
  679. #define ActiveLCD 0x20
  680. #define ActiveTV 0x40
  681. #define ActiveCRT2 0x80
  682. #define TVSwitchStatus 0x1f /* CR3E */
  683. #define ActiveAVideo 0x01
  684. #define ActiveSVideo 0x02
  685. #define ActiveSCART 0x04
  686. #define ActiveHiTV 0x08
  687. #define ActiveYPbPr 0x10
  688. #define EnableHKEvent 0x01 /* CR3F */
  689. #define EnableOSDEvent 0x02
  690. #define StartOSDEvent 0x04
  691. #define IgnoreHKEvent 0x08
  692. #define IgnoreOSDEvent 0x10
  693. #else /* Old Scratch */
  694. #define OSD_SBIOS 0x02 /* SR17 */
  695. #define DisableLogo 0x04
  696. #define SelectKDOS 0x08
  697. #define KorWinMode 0x10
  698. #define KorMode3Bit 0x0020
  699. #define PSCCtrlBit 0x40
  700. #define NPSCCtrlBitShift 6
  701. #define BlueScreenBit 0x80
  702. #define HKEvent 0x0f /* CR79 */
  703. #define HK_ModeSwitch 0x01
  704. #define HK_Expanding 0x02
  705. #define HK_OverScan 0x03
  706. #define HK_Brightness 0x04
  707. #define HK_Contrast 0x05
  708. #define HK_Mute 0x06
  709. #define HK_Volume 0x07
  710. #define ActivePAL 0x20
  711. #define ActivePALShift 5
  712. #define ActiveNonExpanding 0x40
  713. #define ActiveNonExpandingShift 6
  714. #define ActiveOverScan 0x80
  715. #define ActiveOverScanShift 7
  716. #define ModeSwitchStatus 0x0b /* SR15 */
  717. #define ActiveCRT1 0x01
  718. #define ActiveLCD 0x02
  719. #define ActiveCRT2 0x08
  720. #define TVSwitchStatus 0xf0 /* SR16 */
  721. #define TVConfigShift 3
  722. #define ActiveTV 0x01
  723. #define ActiveYPbPr 0x04
  724. #define ActiveAVideo 0x10
  725. #define ActiveSVideo 0x0020
  726. #define ActiveSCART 0x40
  727. #define ActiveHiTV 0x80
  728. #define EnableHKEvent 0x01 /* CR7A */
  729. #define EnableOSDEvent 0x02
  730. #define StartOSDEvent 0x04
  731. #define CMOSSupport 0x08
  732. #define HotKeySupport 0x10
  733. #define IngoreHKOSDEvent 0x20
  734. #endif
  735. /* //------------- Misc. Definition */
  736. #define SelectCRT1Rate 00h
  737. /* #define SelectCRT2Rate 04h */
  738. #define DDC1DelayTime 1000
  739. #ifdef TRUMPION
  740. #define DDC2DelayTime 15
  741. #else
  742. #define DDC2DelayTime 150
  743. #endif
  744. #define R_FACTOR 04Dh
  745. #define G_FACTOR 097h
  746. #define B_FACTOR 01Ch
  747. /* --------------------------------------------------------- */
  748. /* translated from asm code 301def.h */
  749. /* */
  750. /* --------------------------------------------------------- */
  751. #define LCDDataLen 8
  752. #define HiTVDataLen 12
  753. #define TVDataLen 12
  754. #define LVDSCRT1Len_H 8
  755. #define LVDSCRT1Len_V 7
  756. #define LVDSDataLen 6
  757. #define LVDSDesDataLen 6
  758. #define LCDDesDataLen 6
  759. #define LVDSDesDataLen2 8
  760. #define LCDDesDataLen2 8
  761. #define CHTVRegLen 16
  762. #define CHLVRegLen 12
  763. #define StHiTVHT 892
  764. #define StHiTVVT 1126
  765. #define StHiTextTVHT 1000
  766. #define StHiTextTVVT 1126
  767. #define ExtHiTVHT 2100
  768. #define ExtHiTVVT 1125
  769. #define NTSCHT 1716
  770. #define NTSCVT 525
  771. #define NTSC1024x768HT 1908
  772. #define NTSC1024x768VT 525
  773. #define PALHT 1728
  774. #define PALVT 625
  775. #define YPbPrTV525iHT 1716 /* YPbPr */
  776. #define YPbPrTV525iVT 525
  777. #define YPbPrTV525pHT 1716
  778. #define YPbPrTV525pVT 525
  779. #define YPbPrTV750pHT 1650
  780. #define YPbPrTV750pVT 750
  781. #define CRT2VCLKSel 0xc0
  782. #define CRT2Delay1 0x04 /* XGI301 */
  783. #define CRT2Delay2 0x0A /* 301B,302 */
  784. #define VCLK25_175 0x00
  785. #define VCLK28_322 0x01
  786. #define VCLK31_5 0x02
  787. #define VCLK36 0x03
  788. #define VCLK40 0x04
  789. #define VCLK43_163 0x05
  790. #define VCLK44_9 0x06
  791. #define VCLK49_5 0x07
  792. #define VCLK50 0x08
  793. #define VCLK52_406 0x09
  794. #define VCLK56_25 0x0A
  795. #define VCLK65 0x0B
  796. #define VCLK67_765 0x0C
  797. #define VCLK68_179 0x0D
  798. #define VCLK72_852 0x0E
  799. #define VCLK75 0x0F
  800. #define VCLK75_8 0x10
  801. #define VCLK78_75 0x11
  802. #define VCLK79_411 0x12
  803. #define VCLK83_95 0x13
  804. #define VCLK84_8 0x14
  805. #define VCLK86_6 0x15
  806. #define VCLK94_5 0x16
  807. #define VCLK104_998 0x17
  808. #define VCLK105_882 0x18
  809. #define VCLK108_2 0x19
  810. #define VCLK109_175 0x1A
  811. #define VCLK113_309 0x1B
  812. #define VCLK116_406 0x1C
  813. #define VCLK132_258 0x1D
  814. #define VCLK135_5 0x1E
  815. #define VCLK139_054 0x1F
  816. #define VCLK157_5 0x20
  817. #define VCLK162 0x21
  818. #define VCLK175 0x22
  819. #define VCLK189 0x23
  820. #define VCLK194_4 0x24
  821. #define VCLK202_5 0x25
  822. #define VCLK229_5 0x26
  823. #define VCLK234 0x27
  824. #define VCLK252_699 0x28
  825. #define VCLK254_817 0x29
  826. #define VCLK265_728 0x2A
  827. #define VCLK266_952 0x2B
  828. #define VCLK269_655 0x2C
  829. #define VCLK272_042 0x2D
  830. #define VCLK277_015 0x2E
  831. #define VCLK286_359 0x2F
  832. #define VCLK291_132 0x30
  833. #define VCLK291_766 0x31
  834. #define VCLK309_789 0x32
  835. #define VCLK315_195 0x33
  836. #define VCLK323_586 0x34
  837. #define VCLK330_615 0x35
  838. #define VCLK332_177 0x36
  839. #define VCLK340_477 0x37
  840. #define VCLK375_847 0x38
  841. #define VCLK388_631 0x39
  842. #define VCLK125_999 0x51
  843. #define VCLK148_5 0x52
  844. #define VCLK178_992 0x54
  845. #define VCLK217_325 0x55
  846. #define VCLK299_505 0x56
  847. #define YPbPr750pVCLK 0x57
  848. #define TVVCLKDIV2 0x3A
  849. #define TVVCLK 0x3B
  850. #define HiTVVCLKDIV2 0x3C
  851. #define HiTVVCLK 0x3D
  852. #define HiTVSimuVCLK 0x3E
  853. #define HiTVTextVCLK 0x3F
  854. #define VCLK39_77 0x40
  855. /* #define YPbPr750pVCLK 0x0F */
  856. #define YPbPr525pVCLK 0x3A
  857. /* #define ;;YPbPr525iVCLK 0x3B */
  858. /* #define ;;YPbPr525iVCLK_2 0x3A */
  859. #define NTSC1024VCLK 0x41
  860. #define VCLK25_175_41 0x42 /* ; ScaleLCD */
  861. #define VCLK25_175_42 0x43
  862. #define VCLK28_322_43 0x44
  863. #define VCLK40_44 0x45
  864. #define VCLKQVGA_1 0x46 /* ; QVGA */
  865. #define VCLKQVGA_2 0x47
  866. #define VCLKQVGA_3 0x48
  867. #define VCLK35_2 0x49 /* ; 800x480 */
  868. #define VCLK122_61 0x4A
  869. #define VCLK80_350 0x4B
  870. #define VCLK107_385 0x4C
  871. #define CHTVVCLK30_2 0x50 /* ;;CHTV */
  872. #define CHTVVCLK28_1 0x51
  873. #define CHTVVCLK43_6 0x52
  874. #define CHTVVCLK26_4 0x53
  875. #define CHTVVCLK24_6 0x54
  876. #define CHTVVCLK47_8 0x55
  877. #define CHTVVCLK31_5 0x56
  878. #define CHTVVCLK26_2 0x57
  879. #define CHTVVCLK39 0x58
  880. #define CHTVVCLK36 0x59
  881. /* Jong 10/04/2007; merge code */
  882. #define CH7007TVVCLK30_2 0x00 /* [Billy] 2007/05/18 For CH7007 */
  883. #define CH7007TVVCLK28_1 0x01
  884. #define CH7007TVVCLK43_6 0x02
  885. #define CH7007TVVCLK26_4 0x03
  886. #define CH7007TVVCLK24_6 0x04
  887. #define CH7007TVVCLK47_8 0x05
  888. #define CH7007TVVCLK31_5 0x06
  889. #define CH7007TVVCLK26_2 0x07
  890. #define CH7007TVVCLK39 0x08
  891. #define CH7007TVVCLK36 0x09
  892. #define RES320x200 0x00
  893. #define RES320x240 0x01
  894. #define RES400x300 0x02
  895. #define RES512x384 0x03
  896. #define RES640x400 0x04
  897. #define RES640x480x60 0x05
  898. #define RES640x480x72 0x06
  899. #define RES640x480x75 0x07
  900. #define RES640x480x85 0x08
  901. #define RES640x480x100 0x09
  902. #define RES640x480x120 0x0A
  903. #define RES640x480x160 0x0B
  904. #define RES640x480x200 0x0C
  905. #define RES800x600x56 0x0D
  906. #define RES800x600x60 0x0E
  907. #define RES800x600x72 0x0F
  908. #define RES800x600x75 0x10
  909. #define RES800x600x85 0x11
  910. #define RES800x600x100 0x12
  911. #define RES800x600x120 0x13
  912. #define RES800x600x160 0x14
  913. #define RES1024x768x43 0x15
  914. #define RES1024x768x60 0x16
  915. #define RES1024x768x70 0x17
  916. #define RES1024x768x75 0x18
  917. #define RES1024x768x85 0x19
  918. #define RES1024x768x100 0x1A
  919. #define RES1024x768x120 0x1B
  920. #define RES1280x1024x43 0x1C
  921. #define RES1280x1024x60 0x1D
  922. #define RES1280x1024x75 0x1E
  923. #define RES1280x1024x85 0x1F
  924. #define RES1600x1200x60 0x20
  925. #define RES1600x1200x65 0x21
  926. #define RES1600x1200x70 0x22
  927. #define RES1600x1200x75 0x23
  928. #define RES1600x1200x85 0x24
  929. #define RES1600x1200x100 0x25
  930. #define RES1600x1200x120 0x26
  931. #define RES1920x1440x60 0x27
  932. #define RES1920x1440x65 0x28
  933. #define RES1920x1440x70 0x29
  934. #define RES1920x1440x75 0x2A
  935. #define RES1920x1440x85 0x2B
  936. #define RES1920x1440x100 0x2C
  937. #define RES2048x1536x60 0x2D
  938. #define RES2048x1536x65 0x2E
  939. #define RES2048x1536x70 0x2F
  940. #define RES2048x1536x75 0x30
  941. #define RES2048x1536x85 0x31
  942. #define RES800x480x60 0x32
  943. #define RES800x480x75 0x33
  944. #define RES800x480x85 0x34
  945. #define RES1024x576x60 0x35
  946. #define RES1024x576x75 0x36
  947. #define RES1024x576x85 0x37
  948. #define RES1280x720x60 0x38
  949. #define RES1280x720x75 0x39
  950. #define RES1280x720x85 0x3A
  951. #define RES1280x960x60 0x3B
  952. #define RES720x480x60 0x3C
  953. #define RES720x576x56 0x3D
  954. #define RES856x480x79I 0x3E
  955. #define RES856x480x60 0x3F
  956. #define RES1280x768x60 0x40
  957. #define RES1400x1050x60 0x41
  958. #define RES1152x864x60 0x42
  959. #define RES1152x864x75 0x43
  960. #define RES1024x768x160 0x44
  961. #define RES1280x960x75 0x45
  962. #define RES1280x960x85 0x46
  963. #define RES1280x960x120 0x47
  964. #define LFBDRAMTrap 0x30
  965. /**
  966. * SR1E - Module enable register
  967. */
  968. #define SR1E_ENABLE_3D_TRANSFORM_ENGINE (1<<7)
  969. #define SR1E_ENABLE_2D (1<<6)
  970. #define SR1E_ENABLE_CRT2 (1<<5)
  971. #define SR1E_ENABLE_3D_AGP_VERTEX_FETCH (1<<4)
  972. #define SR1E_ENABLE_3D_COMMAND_PARSER (1<<3)
  973. #define SR1E_ENABLE_VGA_BIOS_WRITE (1<<2)
  974. #define SR1E_ENABLE_3D (1<<1)
  975. #define SR1E_ENABLE_MPEG (1<<0)
  976. /**
  977. * MMIO 85CC - command queue read pointer
  978. */
  979. #define IDLE_ALL (1 << 31) /**< 3D & 2D idle, HQ & SQ empty */
  980. #define EMPTY_HQ (1 << 30) /**< HQ empty */
  981. #define IDLE_2D (1 << 29) /**< 2D idle */
  982. #define IDLE_3D (1 << 28) /**< 3D idle */
  983. #define EMPTY_HW_CQ (1 << 27) /**< Hardware command queue empty */
  984. #define EMPTY_2D (1 << 26) /**< 2D queue empty */
  985. #define EMPTY_3D (1 << 25) /**< 3D queue empty */
  986. #define EMPTY_SW_CQ (1 << 24) /**< Software command queue empty */
  987. #define COUNTER_3_MASK (0xff << 16)
  988. #define COUNTER_2_MASK (0xff << 8)
  989. #define COUNTER_1_MASK (0xff << 0)
  990. #endif