sis.h 18 KB

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