sis.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693
  1. /*
  2. * SiS 300/540/630[S]/730[S],
  3. * SiS 315[E|PRO]/550/[M]65x/[M]661[F|M]X/740/[M]741[GX]/330/[M]76x[GX],
  4. * XGI V3XT/V5/V8, Z7
  5. * frame buffer driver for Linux kernels >=2.4.14 and >=2.6.3
  6. *
  7. * Copyright (C) 2001-2005 Thomas Winischhofer, Vienna, Austria.
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the named License,
  12. * or any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
  22. */
  23. #ifndef _SIS_H_
  24. #define _SIS_H_
  25. #include <linux/config.h>
  26. #include <linux/version.h>
  27. #include "osdef.h"
  28. #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
  29. #include <video/sisfb.h>
  30. #else
  31. #include <linux/sisfb.h>
  32. #endif
  33. #include "vgatypes.h"
  34. #include "vstruct.h"
  35. #define VER_MAJOR 1
  36. #define VER_MINOR 8
  37. #define VER_LEVEL 9
  38. #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
  39. #include <linux/spinlock.h>
  40. #define SIS_PCI_GET_CLASS(a, b) pci_get_class(a, b)
  41. #define SIS_PCI_GET_DEVICE(a,b,c) pci_get_device(a,b,c)
  42. #define SIS_PCI_GET_SLOT(a,b) pci_get_slot(a,b)
  43. #define SIS_PCI_PUT_DEVICE(a) pci_dev_put(a)
  44. #ifdef CONFIG_COMPAT
  45. #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,10)
  46. #include <linux/ioctl32.h>
  47. #define SIS_OLD_CONFIG_COMPAT
  48. #else
  49. #include <linux/smp_lock.h>
  50. #define SIS_NEW_CONFIG_COMPAT
  51. #endif
  52. #endif /* CONFIG_COMPAT */
  53. #else /* 2.4 */
  54. #define SIS_PCI_GET_CLASS(a, b) pci_find_class(a, b)
  55. #define SIS_PCI_GET_DEVICE(a,b,c) pci_find_device(a,b,c)
  56. #define SIS_PCI_GET_SLOT(a,b) pci_find_slot(a,b)
  57. #define SIS_PCI_PUT_DEVICE(a)
  58. #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,19)
  59. #ifdef __x86_64__ /* Shouldn't we check for CONFIG_IA32_EMULATION here? */
  60. #include <asm/ioctl32.h>
  61. #define SIS_OLD_CONFIG_COMPAT
  62. #endif
  63. #endif
  64. #endif /* 2.4 */
  65. #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,8)
  66. #define SIS_IOTYPE1 void __iomem
  67. #define SIS_IOTYPE2 __iomem
  68. #define SISINITSTATIC static
  69. #else
  70. #define SIS_IOTYPE1 unsigned char
  71. #define SIS_IOTYPE2
  72. #define SISINITSTATIC
  73. #endif
  74. #undef SISFBDEBUG
  75. #ifdef SISFBDEBUG
  76. #define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
  77. #define TWDEBUG(x) printk(KERN_INFO x "\n");
  78. #else
  79. #define DPRINTK(fmt, args...)
  80. #define TWDEBUG(x)
  81. #endif
  82. #define SISFAIL(x) do { printk(x "\n"); return -EINVAL; } while(0)
  83. /* To be included in pci_ids.h */
  84. #ifndef PCI_DEVICE_ID_SI_650_VGA
  85. #define PCI_DEVICE_ID_SI_650_VGA 0x6325
  86. #endif
  87. #ifndef PCI_DEVICE_ID_SI_650
  88. #define PCI_DEVICE_ID_SI_650 0x0650
  89. #endif
  90. #ifndef PCI_DEVICE_ID_SI_651
  91. #define PCI_DEVICE_ID_SI_651 0x0651
  92. #endif
  93. #ifndef PCI_DEVICE_ID_SI_740
  94. #define PCI_DEVICE_ID_SI_740 0x0740
  95. #endif
  96. #ifndef PCI_DEVICE_ID_SI_330
  97. #define PCI_DEVICE_ID_SI_330 0x0330
  98. #endif
  99. #ifndef PCI_DEVICE_ID_SI_660_VGA
  100. #define PCI_DEVICE_ID_SI_660_VGA 0x6330
  101. #endif
  102. #ifndef PCI_DEVICE_ID_SI_661
  103. #define PCI_DEVICE_ID_SI_661 0x0661
  104. #endif
  105. #ifndef PCI_DEVICE_ID_SI_741
  106. #define PCI_DEVICE_ID_SI_741 0x0741
  107. #endif
  108. #ifndef PCI_DEVICE_ID_SI_660
  109. #define PCI_DEVICE_ID_SI_660 0x0660
  110. #endif
  111. #ifndef PCI_DEVICE_ID_SI_760
  112. #define PCI_DEVICE_ID_SI_760 0x0760
  113. #endif
  114. #ifndef PCI_DEVICE_ID_SI_761
  115. #define PCI_DEVICE_ID_SI_761 0x0761
  116. #endif
  117. #ifndef PCI_VENDOR_ID_XGI
  118. #define PCI_VENDOR_ID_XGI 0x18ca
  119. #endif
  120. #ifndef PCI_DEVICE_ID_XGI_20
  121. #define PCI_DEVICE_ID_XGI_20 0x0020
  122. #endif
  123. #ifndef PCI_DEVICE_ID_XGI_40
  124. #define PCI_DEVICE_ID_XGI_40 0x0040
  125. #endif
  126. /* To be included in fb.h */
  127. #ifndef FB_ACCEL_SIS_GLAMOUR_2
  128. #define FB_ACCEL_SIS_GLAMOUR_2 40 /* SiS 315, 65x, 740, 661, 741 */
  129. #endif
  130. #ifndef FB_ACCEL_SIS_XABRE
  131. #define FB_ACCEL_SIS_XABRE 41 /* SiS 330 ("Xabre"), 76x */
  132. #endif
  133. #ifndef FB_ACCEL_XGI_VOLARI_V
  134. #define FB_ACCEL_XGI_VOLARI_V 47 /* XGI Volari Vx (V3XT, V5, V8) */
  135. #endif
  136. #ifndef FB_ACCEL_XGI_VOLARI_Z
  137. #define FB_ACCEL_XGI_VOLARI_Z 48 /* XGI Volari Z7 */
  138. #endif
  139. /* ivideo->caps */
  140. #define HW_CURSOR_CAP 0x80
  141. #define TURBO_QUEUE_CAP 0x40
  142. #define AGP_CMD_QUEUE_CAP 0x20
  143. #define VM_CMD_QUEUE_CAP 0x10
  144. #define MMIO_CMD_QUEUE_CAP 0x08
  145. /* For 300 series */
  146. #define TURBO_QUEUE_AREA_SIZE (512 * 1024) /* 512K */
  147. #define HW_CURSOR_AREA_SIZE_300 4096 /* 4K */
  148. /* For 315/Xabre series */
  149. #define COMMAND_QUEUE_AREA_SIZE (512 * 1024) /* 512K */
  150. #define COMMAND_QUEUE_AREA_SIZE_Z7 (128 * 1024) /* 128k for XGI Z7 */
  151. #define HW_CURSOR_AREA_SIZE_315 16384 /* 16K */
  152. #define COMMAND_QUEUE_THRESHOLD 0x1F
  153. #define SIS_OH_ALLOC_SIZE 4000
  154. #define SENTINEL 0x7fffffff
  155. #define SEQ_ADR 0x14
  156. #define SEQ_DATA 0x15
  157. #define DAC_ADR 0x18
  158. #define DAC_DATA 0x19
  159. #define CRTC_ADR 0x24
  160. #define CRTC_DATA 0x25
  161. #define DAC2_ADR (0x16-0x30)
  162. #define DAC2_DATA (0x17-0x30)
  163. #define VB_PART1_ADR (0x04-0x30)
  164. #define VB_PART1_DATA (0x05-0x30)
  165. #define VB_PART2_ADR (0x10-0x30)
  166. #define VB_PART2_DATA (0x11-0x30)
  167. #define VB_PART3_ADR (0x12-0x30)
  168. #define VB_PART3_DATA (0x13-0x30)
  169. #define VB_PART4_ADR (0x14-0x30)
  170. #define VB_PART4_DATA (0x15-0x30)
  171. #define SISSR ivideo->SiS_Pr.SiS_P3c4
  172. #define SISCR ivideo->SiS_Pr.SiS_P3d4
  173. #define SISDACA ivideo->SiS_Pr.SiS_P3c8
  174. #define SISDACD ivideo->SiS_Pr.SiS_P3c9
  175. #define SISPART1 ivideo->SiS_Pr.SiS_Part1Port
  176. #define SISPART2 ivideo->SiS_Pr.SiS_Part2Port
  177. #define SISPART3 ivideo->SiS_Pr.SiS_Part3Port
  178. #define SISPART4 ivideo->SiS_Pr.SiS_Part4Port
  179. #define SISPART5 ivideo->SiS_Pr.SiS_Part5Port
  180. #define SISDAC2A SISPART5
  181. #define SISDAC2D (SISPART5 + 1)
  182. #define SISMISCR (ivideo->SiS_Pr.RelIO + 0x1c)
  183. #define SISMISCW ivideo->SiS_Pr.SiS_P3c2
  184. #define SISINPSTAT (ivideo->SiS_Pr.RelIO + 0x2a)
  185. #define SISPEL ivideo->SiS_Pr.SiS_P3c6
  186. #define SISVGAENABLE (ivideo->SiS_Pr.RelIO + 0x13)
  187. #define SISVID (ivideo->SiS_Pr.RelIO + 0x02 - 0x30)
  188. #define SISCAP (ivideo->SiS_Pr.RelIO + 0x00 - 0x30)
  189. #define IND_SIS_PASSWORD 0x05 /* SRs */
  190. #define IND_SIS_COLOR_MODE 0x06
  191. #define IND_SIS_RAMDAC_CONTROL 0x07
  192. #define IND_SIS_DRAM_SIZE 0x14
  193. #define IND_SIS_MODULE_ENABLE 0x1E
  194. #define IND_SIS_PCI_ADDRESS_SET 0x20
  195. #define IND_SIS_TURBOQUEUE_ADR 0x26
  196. #define IND_SIS_TURBOQUEUE_SET 0x27
  197. #define IND_SIS_POWER_ON_TRAP 0x38
  198. #define IND_SIS_POWER_ON_TRAP2 0x39
  199. #define IND_SIS_CMDQUEUE_SET 0x26
  200. #define IND_SIS_CMDQUEUE_THRESHOLD 0x27
  201. #define IND_SIS_AGP_IO_PAD 0x48
  202. #define SIS_CRT2_WENABLE_300 0x24 /* Part1 */
  203. #define SIS_CRT2_WENABLE_315 0x2F
  204. #define SIS_PASSWORD 0x86 /* SR05 */
  205. #define SIS_INTERLACED_MODE 0x20 /* SR06 */
  206. #define SIS_8BPP_COLOR_MODE 0x0
  207. #define SIS_15BPP_COLOR_MODE 0x1
  208. #define SIS_16BPP_COLOR_MODE 0x2
  209. #define SIS_32BPP_COLOR_MODE 0x4
  210. #define SIS_ENABLE_2D 0x40 /* SR1E */
  211. #define SIS_MEM_MAP_IO_ENABLE 0x01 /* SR20 */
  212. #define SIS_PCI_ADDR_ENABLE 0x80
  213. #define SIS_AGP_CMDQUEUE_ENABLE 0x80 /* 315/330/340 series SR26 */
  214. #define SIS_VRAM_CMDQUEUE_ENABLE 0x40
  215. #define SIS_MMIO_CMD_ENABLE 0x20
  216. #define SIS_CMD_QUEUE_SIZE_512k 0x00
  217. #define SIS_CMD_QUEUE_SIZE_1M 0x04
  218. #define SIS_CMD_QUEUE_SIZE_2M 0x08
  219. #define SIS_CMD_QUEUE_SIZE_4M 0x0C
  220. #define SIS_CMD_QUEUE_RESET 0x01
  221. #define SIS_CMD_AUTO_CORR 0x02
  222. #define SIS_CMD_QUEUE_SIZE_Z7_64k 0x00 /* XGI Z7 */
  223. #define SIS_CMD_QUEUE_SIZE_Z7_128k 0x04
  224. #define SIS_SIMULTANEOUS_VIEW_ENABLE 0x01 /* CR30 */
  225. #define SIS_MODE_SELECT_CRT2 0x02
  226. #define SIS_VB_OUTPUT_COMPOSITE 0x04
  227. #define SIS_VB_OUTPUT_SVIDEO 0x08
  228. #define SIS_VB_OUTPUT_SCART 0x10
  229. #define SIS_VB_OUTPUT_LCD 0x20
  230. #define SIS_VB_OUTPUT_CRT2 0x40
  231. #define SIS_VB_OUTPUT_HIVISION 0x80
  232. #define SIS_VB_OUTPUT_DISABLE 0x20 /* CR31 */
  233. #define SIS_DRIVER_MODE 0x40
  234. #define SIS_VB_COMPOSITE 0x01 /* CR32 */
  235. #define SIS_VB_SVIDEO 0x02
  236. #define SIS_VB_SCART 0x04
  237. #define SIS_VB_LCD 0x08
  238. #define SIS_VB_CRT2 0x10
  239. #define SIS_CRT1 0x20
  240. #define SIS_VB_HIVISION 0x40
  241. #define SIS_VB_YPBPR 0x80
  242. #define SIS_VB_TV (SIS_VB_COMPOSITE | SIS_VB_SVIDEO | \
  243. SIS_VB_SCART | SIS_VB_HIVISION | SIS_VB_YPBPR)
  244. #define SIS_EXTERNAL_CHIP_MASK 0x0E /* CR37 (< SiS 660) */
  245. #define SIS_EXTERNAL_CHIP_SIS301 0x01 /* in CR37 << 1 ! */
  246. #define SIS_EXTERNAL_CHIP_LVDS 0x02
  247. #define SIS_EXTERNAL_CHIP_TRUMPION 0x03
  248. #define SIS_EXTERNAL_CHIP_LVDS_CHRONTEL 0x04
  249. #define SIS_EXTERNAL_CHIP_CHRONTEL 0x05
  250. #define SIS310_EXTERNAL_CHIP_LVDS 0x02
  251. #define SIS310_EXTERNAL_CHIP_LVDS_CHRONTEL 0x03
  252. #define SIS_AGP_2X 0x20 /* CR48 */
  253. /* vbflags, private entries (others in sisfb.h) */
  254. #define VB_CONEXANT 0x00000800 /* 661 series only */
  255. #define VB_TRUMPION VB_CONEXANT /* 300 series only */
  256. #define VB_302ELV 0x00004000
  257. #define VB_301 0x00100000 /* Video bridge type */
  258. #define VB_301B 0x00200000
  259. #define VB_302B 0x00400000
  260. #define VB_30xBDH 0x00800000 /* 30xB DH version (w/o LCD support) */
  261. #define VB_LVDS 0x01000000
  262. #define VB_CHRONTEL 0x02000000
  263. #define VB_301LV 0x04000000
  264. #define VB_302LV 0x08000000
  265. #define VB_301C 0x10000000
  266. #define VB_SISBRIDGE (VB_301|VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV|VB_302ELV)
  267. #define VB_VIDEOBRIDGE (VB_SISBRIDGE | VB_LVDS | VB_CHRONTEL | VB_CONEXANT)
  268. /* vbflags2 (static stuff only!) */
  269. #define VB2_SISUMC 0x00000001
  270. #define VB2_301 0x00000002 /* Video bridge type */
  271. #define VB2_301B 0x00000004
  272. #define VB2_301C 0x00000008
  273. #define VB2_307T 0x00000010
  274. #define VB2_302B 0x00000800
  275. #define VB2_301LV 0x00001000
  276. #define VB2_302LV 0x00002000
  277. #define VB2_302ELV 0x00004000
  278. #define VB2_307LV 0x00008000
  279. #define VB2_30xBDH 0x08000000 /* 30xB DH version (w/o LCD support) */
  280. #define VB2_CONEXANT 0x10000000
  281. #define VB2_TRUMPION 0x20000000
  282. #define VB2_LVDS 0x40000000
  283. #define VB2_CHRONTEL 0x80000000
  284. #define VB2_SISLVDSBRIDGE (VB2_301LV | VB2_302LV | VB2_302ELV | VB2_307LV)
  285. #define VB2_SISTMDSBRIDGE (VB2_301 | VB2_301B | VB2_301C | VB2_302B | VB2_307T)
  286. #define VB2_SISBRIDGE (VB2_SISLVDSBRIDGE | VB2_SISTMDSBRIDGE)
  287. #define VB2_SISTMDSLCDABRIDGE (VB2_301C | VB2_307T)
  288. #define VB2_SISLCDABRIDGE (VB2_SISTMDSLCDABRIDGE | VB2_301LV | VB2_302LV | VB2_302ELV | VB2_307LV)
  289. #define VB2_SISHIVISIONBRIDGE (VB2_301 | VB2_301B | VB2_302B)
  290. #define VB2_SISYPBPRBRIDGE (VB2_301C | VB2_307T | VB2_SISLVDSBRIDGE)
  291. #define VB2_SISYPBPRARBRIDGE (VB2_301C | VB2_307T | VB2_307LV)
  292. #define VB2_SISTAP4SCALER (VB2_301C | VB2_307T | VB2_302ELV | VB2_307LV)
  293. #define VB2_SISTVBRIDGE (VB2_SISHIVISIONBRIDGE | VB2_SISYPBPRBRIDGE)
  294. #define VB2_SISVGA2BRIDGE (VB2_301 | VB2_301B | VB2_301C | VB2_302B | VB2_307T)
  295. #define VB2_VIDEOBRIDGE (VB2_SISBRIDGE | VB2_LVDS | VB2_CHRONTEL | VB2_CONEXANT)
  296. #define VB2_30xB (VB2_301B | VB2_301C | VB2_302B | VB2_307T)
  297. #define VB2_30xBLV (VB2_30xB | VB2_SISLVDSBRIDGE)
  298. #define VB2_30xC (VB2_301C | VB2_307T)
  299. #define VB2_30xCLV (VB2_301C | VB2_307T | VB2_302ELV| VB2_307LV)
  300. #define VB2_SISEMIBRIDGE (VB2_302LV | VB2_302ELV | VB2_307LV)
  301. #define VB2_LCD162MHZBRIDGE (VB2_301C | VB2_307T)
  302. #define VB2_LCDOVER1280BRIDGE (VB2_301C | VB2_307T | VB2_302LV | VB2_302ELV | VB2_307LV)
  303. #define VB2_LCDOVER1600BRIDGE (VB2_307T | VB2_307LV)
  304. #define VB2_RAMDAC202MHZBRIDGE (VB2_301C | VB2_307T)
  305. /* I/O port access macros */
  306. #define inSISREG(base) inb(base)
  307. #define outSISREG(base,val) outb(val,base)
  308. #define orSISREG(base,val) \
  309. do { \
  310. u8 __Temp = inSISREG(base); \
  311. outSISREG(base, __Temp | (val));\
  312. } while (0)
  313. #define andSISREG(base,val) \
  314. do { \
  315. u8 __Temp = inSISREG(base); \
  316. outSISREG(base, __Temp & (val));\
  317. } while (0)
  318. #define inSISIDXREG(base,idx,var) \
  319. do { \
  320. outSISREG(base, idx); \
  321. var = inSISREG((base)+1); \
  322. } while (0)
  323. #define outSISIDXREG(base,idx,val) \
  324. do { \
  325. outSISREG(base, idx); \
  326. outSISREG((base)+1, val); \
  327. } while (0)
  328. #define orSISIDXREG(base,idx,val) \
  329. do { \
  330. u8 __Temp; \
  331. outSISREG(base, idx); \
  332. __Temp = inSISREG((base)+1) | (val); \
  333. outSISREG((base)+1, __Temp); \
  334. } while (0)
  335. #define andSISIDXREG(base,idx,and) \
  336. do { \
  337. u8 __Temp; \
  338. outSISREG(base, idx); \
  339. __Temp = inSISREG((base)+1) & (and); \
  340. outSISREG((base)+1, __Temp); \
  341. } while (0)
  342. #define setSISIDXREG(base,idx,and,or) \
  343. do { \
  344. u8 __Temp; \
  345. outSISREG(base, idx); \
  346. __Temp = (inSISREG((base)+1) & (and)) | (or); \
  347. outSISREG((base)+1, __Temp); \
  348. } while (0)
  349. /* MMIO access macros */
  350. #define MMIO_IN8(base, offset) readb((base+offset))
  351. #define MMIO_IN16(base, offset) readw((base+offset))
  352. #define MMIO_IN32(base, offset) readl((base+offset))
  353. #define MMIO_OUT8(base, offset, val) writeb(((u8)(val)), (base+offset))
  354. #define MMIO_OUT16(base, offset, val) writew(((u16)(val)), (base+offset))
  355. #define MMIO_OUT32(base, offset, val) writel(((u32)(val)), (base+offset))
  356. /* Queue control MMIO registers */
  357. #define Q_BASE_ADDR 0x85C0 /* Base address of software queue */
  358. #define Q_WRITE_PTR 0x85C4 /* Current write pointer */
  359. #define Q_READ_PTR 0x85C8 /* Current read pointer */
  360. #define Q_STATUS 0x85CC /* queue status */
  361. #define MMIO_QUEUE_PHYBASE Q_BASE_ADDR
  362. #define MMIO_QUEUE_WRITEPORT Q_WRITE_PTR
  363. #define MMIO_QUEUE_READPORT Q_READ_PTR
  364. #ifndef FB_BLANK_UNBLANK
  365. #define FB_BLANK_UNBLANK 0
  366. #endif
  367. #ifndef FB_BLANK_NORMAL
  368. #define FB_BLANK_NORMAL 1
  369. #endif
  370. #ifndef FB_BLANK_VSYNC_SUSPEND
  371. #define FB_BLANK_VSYNC_SUSPEND 2
  372. #endif
  373. #ifndef FB_BLANK_HSYNC_SUSPEND
  374. #define FB_BLANK_HSYNC_SUSPEND 3
  375. #endif
  376. #ifndef FB_BLANK_POWERDOWN
  377. #define FB_BLANK_POWERDOWN 4
  378. #endif
  379. enum _SIS_LCD_TYPE {
  380. LCD_INVALID = 0,
  381. LCD_800x600,
  382. LCD_1024x768,
  383. LCD_1280x1024,
  384. LCD_1280x960,
  385. LCD_640x480,
  386. LCD_1600x1200,
  387. LCD_1920x1440,
  388. LCD_2048x1536,
  389. LCD_320x240, /* FSTN */
  390. LCD_1400x1050,
  391. LCD_1152x864,
  392. LCD_1152x768,
  393. LCD_1280x768,
  394. LCD_1024x600,
  395. LCD_320x240_2, /* DSTN */
  396. LCD_320x240_3, /* DSTN */
  397. LCD_848x480,
  398. LCD_1280x800,
  399. LCD_1680x1050,
  400. LCD_1280x720,
  401. LCD_1280x854,
  402. LCD_CUSTOM,
  403. LCD_UNKNOWN
  404. };
  405. enum _SIS_CMDTYPE {
  406. MMIO_CMD = 0,
  407. AGP_CMD_QUEUE,
  408. VM_CMD_QUEUE,
  409. };
  410. struct SIS_OH {
  411. struct SIS_OH *poh_next;
  412. struct SIS_OH *poh_prev;
  413. u32 offset;
  414. u32 size;
  415. };
  416. struct SIS_OHALLOC {
  417. struct SIS_OHALLOC *poha_next;
  418. struct SIS_OH aoh[1];
  419. };
  420. struct SIS_HEAP {
  421. struct SIS_OH oh_free;
  422. struct SIS_OH oh_used;
  423. struct SIS_OH *poh_freelist;
  424. struct SIS_OHALLOC *poha_chain;
  425. u32 max_freesize;
  426. struct sis_video_info *vinfo;
  427. };
  428. /* Our "par" */
  429. struct sis_video_info {
  430. int cardnumber;
  431. struct fb_info *memyselfandi;
  432. struct SiS_Private SiS_Pr;
  433. struct sisfb_info sisfbinfo; /* For ioctl SISFB_GET_INFO */
  434. struct fb_var_screeninfo default_var;
  435. #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
  436. struct fb_fix_screeninfo sisfb_fix;
  437. u32 pseudo_palette[17];
  438. #endif
  439. #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
  440. struct display sis_disp;
  441. struct display_switch sisfb_sw;
  442. struct {
  443. u16 red, green, blue, pad;
  444. } sis_palette[256];
  445. union {
  446. #ifdef FBCON_HAS_CFB16
  447. u16 cfb16[16];
  448. #endif
  449. #ifdef FBCON_HAS_CFB32
  450. u32 cfb32[16];
  451. #endif
  452. } sis_fbcon_cmap;
  453. #endif
  454. struct sisfb_monitor {
  455. u16 hmin;
  456. u16 hmax;
  457. u16 vmin;
  458. u16 vmax;
  459. u32 dclockmax;
  460. u8 feature;
  461. BOOLEAN datavalid;
  462. } sisfb_thismonitor;
  463. unsigned short chip_id; /* PCI ID of chip */
  464. unsigned short chip_vendor; /* PCI ID of vendor */
  465. char myid[40];
  466. struct pci_dev *nbridge;
  467. struct pci_dev *lpcdev;
  468. int mni; /* Mode number index */
  469. #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
  470. int currcon;
  471. #endif
  472. unsigned long video_size;
  473. unsigned long video_base;
  474. unsigned long mmio_size;
  475. unsigned long mmio_base;
  476. unsigned long vga_base;
  477. unsigned long video_offset;
  478. unsigned long UMAsize, LFBsize;
  479. SIS_IOTYPE1 *video_vbase;
  480. SIS_IOTYPE1 *mmio_vbase;
  481. unsigned char *bios_abase;
  482. int mtrr;
  483. u32 sisfb_mem;
  484. u32 sisfb_parm_mem;
  485. int sisfb_accel;
  486. int sisfb_ypan;
  487. int sisfb_max;
  488. int sisfb_userom;
  489. int sisfb_useoem;
  490. int sisfb_mode_idx;
  491. int sisfb_parm_rate;
  492. int sisfb_crt1off;
  493. int sisfb_forcecrt1;
  494. int sisfb_crt2type;
  495. int sisfb_crt2flags;
  496. int sisfb_dstn;
  497. int sisfb_fstn;
  498. int sisfb_tvplug;
  499. int sisfb_tvstd;
  500. int sisfb_nocrt2rate;
  501. #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
  502. int sisfb_inverse;
  503. #endif
  504. u32 heapstart; /* offset */
  505. SIS_IOTYPE1 *sisfb_heap_start; /* address */
  506. SIS_IOTYPE1 *sisfb_heap_end; /* address */
  507. u32 sisfb_heap_size;
  508. int havenoheap;
  509. struct SIS_HEAP sisfb_heap; /* This card's vram heap */
  510. int video_bpp;
  511. int video_cmap_len;
  512. int video_width;
  513. int video_height;
  514. unsigned int refresh_rate;
  515. unsigned int chip;
  516. u8 revision_id;
  517. int sisvga_enabled; /* PCI device was enabled */
  518. int video_linelength; /* real pitch */
  519. int scrnpitchCRT1; /* pitch regarding interlace */
  520. u16 DstColor; /* For 2d acceleration */
  521. u32 SiS310_AccelDepth;
  522. u32 CommandReg;
  523. int cmdqueuelength; /* Current (for accel) */
  524. u32 cmdQueueSize; /* Total size in KB */
  525. spinlock_t lockaccel; /* Do not use outside of kernel! */
  526. unsigned int pcibus;
  527. unsigned int pcislot;
  528. unsigned int pcifunc;
  529. int accel;
  530. int engineok;
  531. u16 subsysvendor;
  532. u16 subsysdevice;
  533. u32 vbflags; /* Replacing deprecated stuff from above */
  534. u32 currentvbflags;
  535. u32 vbflags2;
  536. int lcdxres, lcdyres;
  537. int lcddefmodeidx, tvdefmodeidx, defmodeidx;
  538. u32 CRT2LCDType; /* defined in "SIS_LCD_TYPE" */
  539. u32 curFSTN, curDSTN;
  540. int current_bpp;
  541. int current_width;
  542. int current_height;
  543. int current_htotal;
  544. int current_vtotal;
  545. int current_linelength;
  546. __u32 current_pixclock;
  547. int current_refresh_rate;
  548. unsigned int current_base;
  549. u8 mode_no;
  550. u8 rate_idx;
  551. int modechanged;
  552. unsigned char modeprechange;
  553. #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
  554. u8 sisfb_lastrates[128];
  555. #endif
  556. int newrom;
  557. int haveXGIROM;
  558. int registered;
  559. int warncount;
  560. #ifdef SIS_OLD_CONFIG_COMPAT
  561. int ioctl32registered;
  562. #endif
  563. int sisvga_engine;
  564. int hwcursor_size;
  565. int CRT2_write_enable;
  566. u8 caps;
  567. u8 detectedpdc;
  568. u8 detectedpdca;
  569. u8 detectedlcda;
  570. SIS_IOTYPE1 *hwcursor_vbase;
  571. int chronteltype;
  572. int tvxpos, tvypos;
  573. u8 p2_1f,p2_20,p2_2b,p2_42,p2_43,p2_01,p2_02;
  574. int tvx, tvy;
  575. u8 sisfblocked;
  576. struct sisfb_info sisfb_infoblock;
  577. struct sisfb_cmd sisfb_command;
  578. u32 sisfb_id;
  579. u8 sisfb_can_post;
  580. u8 sisfb_card_posted;
  581. u8 sisfb_was_boot_device;
  582. struct sis_video_info *next;
  583. };
  584. #endif