Merge x86-64 update from Andi
[deliverable/linux.git] / drivers / video / intelfb / intelfb.h
1 #ifndef _INTELFB_H
2 #define _INTELFB_H
3
4 /* $DHD: intelfb/intelfb.h,v 1.40 2003/06/27 15:06:25 dawes Exp $ */
5
6 #include <linux/agp_backend.h>
7 #include <linux/fb.h>
8
9
10 /*** Version/name ***/
11 #define INTELFB_VERSION "0.9.2"
12 #define INTELFB_MODULE_NAME "intelfb"
13 #define SUPPORTED_CHIPSETS "830M/845G/852GM/855GM/865G/915G/915GM"
14
15
16 /*** Debug/feature defines ***/
17
18 #ifndef DEBUG
19 #define DEBUG 0
20 #endif
21
22 #ifndef VERBOSE
23 #define VERBOSE 0
24 #endif
25
26 #ifndef REGDUMP
27 #define REGDUMP 0
28 #endif
29
30 #ifndef DETECT_VGA_CLASS_ONLY
31 #define DETECT_VGA_CLASS_ONLY 1
32 #endif
33
34 #ifndef ALLOCATE_FOR_PANNING
35 #define ALLOCATE_FOR_PANNING 1
36 #endif
37
38 #ifndef PREFERRED_MODE
39 #define PREFERRED_MODE "1024x768-32@70"
40 #endif
41
42 /*** hw-related values ***/
43
44 /* PCI ids for supported devices */
45 #define PCI_DEVICE_ID_INTEL_830M 0x3577
46 #define PCI_DEVICE_ID_INTEL_845G 0x2562
47 #define PCI_DEVICE_ID_INTEL_85XGM 0x3582
48 #define PCI_DEVICE_ID_INTEL_865G 0x2572
49 #define PCI_DEVICE_ID_INTEL_915G 0x2582
50 #define PCI_DEVICE_ID_INTEL_915GM 0x2592
51
52 /* Size of MMIO region */
53 #define INTEL_REG_SIZE 0x80000
54
55 #define STRIDE_ALIGNMENT 16
56
57 #define PALETTE_8_ENTRIES 256
58
59
60 /*** Macros ***/
61
62 /* basic arithmetic */
63 #define KB(x) ((x) * 1024)
64 #define MB(x) ((x) * 1024 * 1024)
65 #define BtoKB(x) ((x) / 1024)
66 #define BtoMB(x) ((x) / 1024 / 1024)
67
68 #define GTT_PAGE_SIZE KB(4)
69
70 #define ROUND_UP_TO(x, y) (((x) + (y) - 1) / (y) * (y))
71 #define ROUND_DOWN_TO(x, y) ((x) / (y) * (y))
72 #define ROUND_UP_TO_PAGE(x) ROUND_UP_TO((x), GTT_PAGE_SIZE)
73 #define ROUND_DOWN_TO_PAGE(x) ROUND_DOWN_TO((x), GTT_PAGE_SIZE)
74
75 /* messages */
76 #define PFX INTELFB_MODULE_NAME ": "
77
78 #define ERR_MSG(fmt, args...) printk(KERN_ERR PFX fmt, ## args)
79 #define WRN_MSG(fmt, args...) printk(KERN_WARNING PFX fmt, ## args)
80 #define NOT_MSG(fmt, args...) printk(KERN_NOTICE PFX fmt, ## args)
81 #define INF_MSG(fmt, args...) printk(KERN_INFO PFX fmt, ## args)
82 #if DEBUG
83 #define DBG_MSG(fmt, args...) printk(KERN_DEBUG PFX fmt, ## args)
84 #else
85 #define DBG_MSG(fmt, args...) while (0) printk(fmt, ## args)
86 #endif
87
88 /* get commonly used pointers */
89 #define GET_DINFO(info) (info)->par
90
91 /* misc macros */
92 #define ACCEL(d, i) \
93 ((d)->accel && !(d)->ring_lockup && \
94 ((i)->var.accel_flags & FB_ACCELF_TEXT))
95
96 /*#define NOACCEL_CHIPSET(d) \
97 ((d)->chipset != INTEL_865G)*/
98 #define NOACCEL_CHIPSET(d) \
99 (0)
100
101 #define FIXED_MODE(d) ((d)->fixed_mode)
102
103 /*** Driver paramters ***/
104
105 #define RINGBUFFER_SIZE KB(64)
106 #define HW_CURSOR_SIZE KB(4)
107
108 /* Intel agpgart driver */
109 #define AGP_PHYSICAL_MEMORY 2
110
111 /*** Data Types ***/
112
113 /* supported chipsets */
114 enum intel_chips {
115 INTEL_830M,
116 INTEL_845G,
117 INTEL_85XGM,
118 INTEL_852GM,
119 INTEL_852GME,
120 INTEL_855GM,
121 INTEL_855GME,
122 INTEL_865G,
123 INTEL_915G,
124 INTEL_915GM
125 };
126
127 struct intelfb_hwstate {
128 u32 vga0_divisor;
129 u32 vga1_divisor;
130 u32 vga_pd;
131 u32 dpll_a;
132 u32 dpll_b;
133 u32 fpa0;
134 u32 fpa1;
135 u32 fpb0;
136 u32 fpb1;
137 u32 palette_a[PALETTE_8_ENTRIES];
138 u32 palette_b[PALETTE_8_ENTRIES];
139 u32 htotal_a;
140 u32 hblank_a;
141 u32 hsync_a;
142 u32 vtotal_a;
143 u32 vblank_a;
144 u32 vsync_a;
145 u32 src_size_a;
146 u32 bclrpat_a;
147 u32 htotal_b;
148 u32 hblank_b;
149 u32 hsync_b;
150 u32 vtotal_b;
151 u32 vblank_b;
152 u32 vsync_b;
153 u32 src_size_b;
154 u32 bclrpat_b;
155 u32 adpa;
156 u32 dvoa;
157 u32 dvob;
158 u32 dvoc;
159 u32 dvoa_srcdim;
160 u32 dvob_srcdim;
161 u32 dvoc_srcdim;
162 u32 lvds;
163 u32 pipe_a_conf;
164 u32 pipe_b_conf;
165 u32 disp_arb;
166 u32 cursor_a_control;
167 u32 cursor_b_control;
168 u32 cursor_a_base;
169 u32 cursor_b_base;
170 u32 cursor_size;
171 u32 disp_a_ctrl;
172 u32 disp_b_ctrl;
173 u32 disp_a_base;
174 u32 disp_b_base;
175 u32 cursor_a_palette[4];
176 u32 cursor_b_palette[4];
177 u32 disp_a_stride;
178 u32 disp_b_stride;
179 u32 vgacntrl;
180 u32 add_id;
181 u32 swf0x[7];
182 u32 swf1x[7];
183 u32 swf3x[3];
184 u32 fence[8];
185 u32 instpm;
186 u32 mem_mode;
187 u32 fw_blc_0;
188 u32 fw_blc_1;
189 };
190
191 struct intelfb_heap_data {
192 u32 physical;
193 u8 __iomem *virtual;
194 u32 offset; // in GATT pages
195 u32 size; // in bytes
196 };
197
198 struct intelfb_info {
199 struct fb_info *info;
200 struct fb_ops *fbops;
201 struct pci_dev *pdev;
202
203 struct intelfb_hwstate save_state;
204
205 /* agpgart structs */
206 struct agp_memory *gtt_fb_mem; // use all stolen memory or vram
207 struct agp_memory *gtt_ring_mem; // ring buffer
208 struct agp_memory *gtt_cursor_mem; // hw cursor
209
210 /* use a gart reserved fb mem */
211 u8 fbmem_gart;
212
213 /* mtrr support */
214 u32 mtrr_reg;
215 u32 has_mtrr;
216
217 /* heap data */
218 struct intelfb_heap_data aperture;
219 struct intelfb_heap_data fb;
220 struct intelfb_heap_data ring;
221 struct intelfb_heap_data cursor;
222
223 /* mmio regs */
224 u32 mmio_base_phys;
225 u8 __iomem *mmio_base;
226
227 /* fb start offset (in bytes) */
228 u32 fb_start;
229
230 /* ring buffer */
231 u8 __iomem *ring_head;
232 u32 ring_tail;
233 u32 ring_tail_mask;
234 u32 ring_space;
235 u32 ring_lockup;
236
237 /* palette */
238 u32 pseudo_palette[17];
239
240 /* chip info */
241 int pci_chipset;
242 int chipset;
243 const char *name;
244 int mobile;
245
246 /* current mode */
247 int bpp, depth;
248 u32 visual;
249 int xres, yres, pitch;
250 int pixclock;
251
252 /* current pipe */
253 int pipe;
254
255 /* some flags */
256 int accel;
257 int hwcursor;
258 int fixed_mode;
259 int ring_active;
260
261 /* hw cursor */
262 int cursor_on;
263 int cursor_blanked;
264 u8 cursor_src[64];
265
266 /* initial parameters */
267 int initial_vga;
268 struct fb_var_screeninfo initial_var;
269 u32 initial_fb_base;
270 u32 initial_video_ram;
271 u32 initial_pitch;
272
273 /* driver registered */
274 int registered;
275 };
276
277 /*** function prototypes ***/
278
279 extern int intelfb_var_to_depth(const struct fb_var_screeninfo *var);
280
281 #endif /* _INTELFB_H */
This page took 0.05857 seconds and 6 git commands to generate.