i810.h 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. /*-*- linux-c -*-
  2. * linux/drivers/video/i810.h -- Intel 810 General Definitions/Declarations
  3. *
  4. * Copyright (C) 2001 Antonino Daplas<adaplas@pol.net>
  5. * All Rights Reserved
  6. *
  7. *
  8. * This file is subject to the terms and conditions of the GNU General Public
  9. * License. See the file COPYING in the main directory of this archive for
  10. * more details.
  11. */
  12. #ifndef __I810_H__
  13. #define __I810_H__
  14. #include <linux/list.h>
  15. #include <linux/agp_backend.h>
  16. #include <linux/fb.h>
  17. #include <linux/i2c.h>
  18. #include <linux/i2c-id.h>
  19. #include <linux/i2c-algo-bit.h>
  20. #include <video/vga.h>
  21. /* Fence */
  22. #define TILEWALK_X (0 << 12)
  23. #define TILEWALK_Y (1 << 12)
  24. /* Raster ops */
  25. #define COLOR_COPY_ROP 0xF0
  26. #define PAT_COPY_ROP 0xCC
  27. #define CLEAR_ROP 0x00
  28. #define WHITE_ROP 0xFF
  29. #define INVERT_ROP 0x55
  30. #define XOR_ROP 0x5A
  31. /* 2D Engine definitions */
  32. #define SOLIDPATTERN 0x80000000
  33. #define NONSOLID 0x00000000
  34. #define BPP8 (0 << 24)
  35. #define BPP16 (1 << 24)
  36. #define BPP24 (2 << 24)
  37. #define PIXCONF8 (2 << 16)
  38. #define PIXCONF15 (4 << 16)
  39. #define PIXCONF16 (5 << 16)
  40. #define PIXCONF24 (6 << 16)
  41. #define PIXCONF32 (7 << 16)
  42. #define DYN_COLOR_EN (1 << 26)
  43. #define DYN_COLOR_DIS (0 << 26)
  44. #define INCREMENT 0x00000000
  45. #define DECREMENT (0x01 << 30)
  46. #define ARB_ON 0x00000001
  47. #define ARB_OFF 0x00000000
  48. #define SYNC_FLIP 0x00000000
  49. #define ASYNC_FLIP 0x00000040
  50. #define OPTYPE_MASK 0xE0000000
  51. #define PARSER_MASK 0x001F8000
  52. #define D2_MASK 0x001FC000 /* 2D mask */
  53. /* Instruction type */
  54. /* There are more but pertains to 3D */
  55. #define PARSER 0x00000000
  56. #define BLIT (0x02 << 29)
  57. #define RENDER (0x03 << 29)
  58. /* Parser */
  59. #define NOP 0x00 /* No operation, padding */
  60. #define BP_INT (0x01 << 23) /* Breakpoint interrupt */
  61. #define USR_INT (0x02 << 23) /* User interrupt */
  62. #define WAIT_FOR_EVNT (0x03 << 23) /* Wait for event */
  63. #define FLUSH (0x04 << 23)
  64. #define CONTEXT_SEL (0x05 << 23)
  65. #define REPORT_HEAD (0x07 << 23)
  66. #define ARB_ON_OFF (0x08 << 23)
  67. #define OVERLAY_FLIP (0x11 << 23)
  68. #define LOAD_SCAN_INC (0x12 << 23)
  69. #define LOAD_SCAN_EX (0x13 << 23)
  70. #define FRONT_BUFFER (0x14 << 23)
  71. #define DEST_BUFFER (0x15 << 23)
  72. #define Z_BUFFER (0x16 << 23)
  73. #define STORE_DWORD_IMM (0x20 << 23)
  74. #define STORE_DWORD_IDX (0x21 << 23)
  75. #define BATCH_BUFFER (0x30 << 23)
  76. /* Blit */
  77. #define SETUP_BLIT 0x00
  78. #define SETUP_MONO_PATTERN_SL_BLT (0x10 << 22)
  79. #define PIXEL_BLT (0x20 << 22)
  80. #define SCANLINE_BLT (0x21 << 22)
  81. #define TEXT_BLT (0x22 << 22)
  82. #define TEXT_IMM_BLT (0x30 << 22)
  83. #define COLOR_BLT (0x40 << 22)
  84. #define MONO_PAT_BLIT (0x42 << 22)
  85. #define SOURCE_COPY_BLIT (0x43 << 22)
  86. #define MONO_SOURCE_COPY_BLIT (0x44 << 22)
  87. #define SOURCE_COPY_IMMEDIATE (0x60 << 22)
  88. #define MONO_SOURCE_COPY_IMMEDIATE (0x61 << 22)
  89. #define VERSION_MAJOR 0
  90. #define VERSION_MINOR 9
  91. #define VERSION_TEENIE 0
  92. #define BRANCH_VERSION ""
  93. /* mvo: intel i815 */
  94. #ifndef PCI_DEVICE_ID_INTEL_82815_100
  95. #define PCI_DEVICE_ID_INTEL_82815_100 0x1102
  96. #endif
  97. #ifndef PCI_DEVICE_ID_INTEL_82815_NOAGP
  98. #define PCI_DEVICE_ID_INTEL_82815_NOAGP 0x1112
  99. #endif
  100. #ifndef PCI_DEVICE_ID_INTEL_82815_FULL_CTRL
  101. #define PCI_DEVICE_ID_INTEL_82815_FULL_CTRL 0x1130
  102. #endif
  103. /* General Defines */
  104. #define I810_PAGESIZE 4096
  105. #define MAX_DMA_SIZE (1024 * 4096)
  106. #define SAREA_SIZE 4096
  107. #define PCI_I810_MISCC 0x72
  108. #define MMIO_SIZE (512*1024)
  109. #define GTT_SIZE (16*1024)
  110. #define RINGBUFFER_SIZE (64*1024)
  111. #define CURSOR_SIZE 4096
  112. #define OFF 0
  113. #define ON 1
  114. #define MAX_KEY 256
  115. #define WAIT_COUNT 10000000
  116. #define IRING_PAD 8
  117. #define FONTDATAMAX 8192
  118. /* Masks (AND ops) and OR's */
  119. #define FB_START_MASK (0x3f << (32 - 6))
  120. #define MMIO_ADDR_MASK (0x1FFF << (32 - 13))
  121. #define FREQ_MASK 0x1EF
  122. #define SCR_OFF 0x20
  123. #define DRAM_ON 0x08
  124. #define DRAM_OFF 0xE7
  125. #define PG_ENABLE_MASK 0x01
  126. #define RING_SIZE_MASK (RINGBUFFER_SIZE - 1);
  127. /* defines for restoring registers partially */
  128. #define ADDR_MAP_MASK (0x07 << 5)
  129. #define DISP_CTRL ~0
  130. #define PIXCONF_0 (0x64 << 8)
  131. #define PIXCONF_2 (0xF3 << 24)
  132. #define PIXCONF_1 (0xF0 << 16)
  133. #define MN_MASK 0x3FF03FF
  134. #define P_OR (0x7 << 4)
  135. #define DAC_BIT (1 << 16)
  136. #define INTERLACE_BIT (1 << 7)
  137. #define IER_MASK (3 << 13)
  138. #define IMR_MASK (3 << 13)
  139. /* Power Management */
  140. #define DPMS_MASK 0xF0000
  141. #define POWERON 0x00000
  142. #define STANDBY 0x20000
  143. #define SUSPEND 0x80000
  144. #define POWERDOWN 0xA0000
  145. #define EMR_MASK ~0x3F
  146. #define FW_BLC_MASK ~(0x3F|(7 << 8)|(0x3F << 12)|(7 << 20))
  147. /* Ringbuffer */
  148. #define RBUFFER_START_MASK 0xFFFFF000
  149. #define RBUFFER_SIZE_MASK 0x001FF000
  150. #define RBUFFER_HEAD_MASK 0x001FFFFC
  151. #define RBUFFER_TAIL_MASK 0x001FFFF8
  152. /* Video Timings */
  153. #define REF_FREQ 24000000
  154. #define TARGET_N_MAX 30
  155. #define MAX_PIXELCLOCK 230000000
  156. #define MIN_PIXELCLOCK 15000000
  157. #define VFMAX 60
  158. #define VFMIN 60
  159. #define HFMAX 30000
  160. #define HFMIN 29000
  161. /* Cursor */
  162. #define CURSOR_ENABLE_MASK 0x1000
  163. #define CURSOR_MODE_64_TRANS 4
  164. #define CURSOR_MODE_64_XOR 5
  165. #define CURSOR_MODE_64_3C 6
  166. #define COORD_INACTIVE 0
  167. #define COORD_ACTIVE (1 << 4)
  168. #define EXTENDED_PALETTE 1
  169. /* AGP Memory Types*/
  170. #define AGP_NORMAL_MEMORY 0
  171. #define AGP_DCACHE_MEMORY 1
  172. #define AGP_PHYSICAL_MEMORY 2
  173. /* Allocated resource Flags */
  174. #define FRAMEBUFFER_REQ 1
  175. #define MMIO_REQ 2
  176. #define PCI_DEVICE_ENABLED 4
  177. #define HAS_FONTCACHE 8
  178. /* driver flags */
  179. #define HAS_MTRR 1
  180. #define HAS_ACCELERATION 2
  181. #define ALWAYS_SYNC 4
  182. #define LOCKUP 8
  183. struct gtt_data {
  184. struct agp_memory *i810_fb_memory;
  185. struct agp_memory *i810_cursor_memory;
  186. };
  187. struct mode_registers {
  188. u32 pixclock, M, N, P;
  189. u8 cr00, cr01, cr02, cr03;
  190. u8 cr04, cr05, cr06, cr07;
  191. u8 cr09, cr10, cr11, cr12;
  192. u8 cr13, cr15, cr16, cr30;
  193. u8 cr31, cr32, cr33, cr35, cr39;
  194. u32 bpp8_100, bpp16_100;
  195. u32 bpp24_100, bpp8_133;
  196. u32 bpp16_133, bpp24_133;
  197. u8 msr;
  198. };
  199. struct heap_data {
  200. unsigned long physical;
  201. __u8 __iomem *virtual;
  202. u32 offset;
  203. u32 size;
  204. };
  205. struct state_registers {
  206. u32 dclk_1d, dclk_2d, dclk_0ds;
  207. u32 pixconf, fw_blc, pgtbl_ctl;
  208. u32 fence0, hws_pga, dplystas;
  209. u16 bltcntl, hwstam, ier, iir, imr;
  210. u8 cr00, cr01, cr02, cr03, cr04;
  211. u8 cr05, cr06, cr07, cr08, cr09;
  212. u8 cr10, cr11, cr12, cr13, cr14;
  213. u8 cr15, cr16, cr17, cr80, gr10;
  214. u8 cr30, cr31, cr32, cr33, cr35;
  215. u8 cr39, cr41, cr70, sr01, msr;
  216. };
  217. struct i810fb_par;
  218. struct i810fb_i2c_chan {
  219. struct i810fb_par *par;
  220. struct i2c_adapter adapter;
  221. struct i2c_algo_bit_data algo;
  222. unsigned long ddc_base;
  223. };
  224. struct i810fb_par {
  225. struct mode_registers regs;
  226. struct state_registers hw_state;
  227. struct gtt_data i810_gtt;
  228. struct fb_ops i810fb_ops;
  229. struct pci_dev *dev;
  230. struct heap_data aperture;
  231. struct heap_data fb;
  232. struct heap_data iring;
  233. struct heap_data cursor_heap;
  234. struct vgastate state;
  235. struct i810fb_i2c_chan chan[3];
  236. struct mutex open_lock;
  237. unsigned int use_count;
  238. u32 pseudo_palette[17];
  239. unsigned long mmio_start_phys;
  240. u8 __iomem *mmio_start_virtual;
  241. u8 *edid;
  242. u32 pitch;
  243. u32 pixconf;
  244. u32 watermark;
  245. u32 mem_freq;
  246. u32 res_flags;
  247. u32 dev_flags;
  248. u32 cur_tail;
  249. u32 depth;
  250. u32 blit_bpp;
  251. u32 ovract;
  252. u32 cur_state;
  253. u32 ddc_num;
  254. int mtrr_reg;
  255. u16 bltcntl;
  256. u8 interlace;
  257. };
  258. /*
  259. * Register I/O
  260. */
  261. #define i810_readb(where, mmio) readb(mmio + where)
  262. #define i810_readw(where, mmio) readw(mmio + where)
  263. #define i810_readl(where, mmio) readl(mmio + where)
  264. #define i810_writeb(where, mmio, val) writeb(val, mmio + where)
  265. #define i810_writew(where, mmio, val) writew(val, mmio + where)
  266. #define i810_writel(where, mmio, val) writel(val, mmio + where)
  267. #endif /* __I810_H__ */