4 /* $DHD: intelfb/intelfb.h,v 1.40 2003/06/27 15:06:25 dawes Exp $ */
6 #include <linux/agp_backend.h>
10 /*** Version/name ***/
11 #define INTELFB_VERSION "0.9.4"
12 #define INTELFB_MODULE_NAME "intelfb"
13 #define SUPPORTED_CHIPSETS "830M/845G/852GM/855GM/865G/915G/915GM/945G/945GM"
16 /*** Debug/feature defines ***/
30 #ifndef DETECT_VGA_CLASS_ONLY
31 #define DETECT_VGA_CLASS_ONLY 1
34 #ifndef ALLOCATE_FOR_PANNING
35 #define ALLOCATE_FOR_PANNING 1
38 #ifndef PREFERRED_MODE
39 #define PREFERRED_MODE "1024x768-32@70"
42 /*** hw-related values ***/
44 /* Resource Allocation */
45 #define INTELFB_FB_ACQUIRED 1
46 #define INTELFB_MMIO_ACQUIRED 2
48 /* PCI ids for supported devices */
49 #define PCI_DEVICE_ID_INTEL_830M 0x3577
50 #define PCI_DEVICE_ID_INTEL_845G 0x2562
51 #define PCI_DEVICE_ID_INTEL_85XGM 0x3582
52 #define PCI_DEVICE_ID_INTEL_865G 0x2572
53 #define PCI_DEVICE_ID_INTEL_915G 0x2582
54 #define PCI_DEVICE_ID_INTEL_915GM 0x2592
55 #define PCI_DEVICE_ID_INTEL_945G 0x2772
56 #define PCI_DEVICE_ID_INTEL_945GM 0x27A2
58 /* Size of MMIO region */
59 #define INTEL_REG_SIZE 0x80000
61 #define STRIDE_ALIGNMENT 16
62 #define STRIDE_ALIGNMENT_I9XX 64
64 #define PALETTE_8_ENTRIES 256
69 /* basic arithmetic */
70 #define KB(x) ((x) * 1024)
71 #define MB(x) ((x) * 1024 * 1024)
72 #define BtoKB(x) ((x) / 1024)
73 #define BtoMB(x) ((x) / 1024 / 1024)
75 #define GTT_PAGE_SIZE KB(4)
77 #define ROUND_UP_TO(x, y) (((x) + (y) - 1) / (y) * (y))
78 #define ROUND_DOWN_TO(x, y) ((x) / (y) * (y))
79 #define ROUND_UP_TO_PAGE(x) ROUND_UP_TO((x), GTT_PAGE_SIZE)
80 #define ROUND_DOWN_TO_PAGE(x) ROUND_DOWN_TO((x), GTT_PAGE_SIZE)
83 #define PFX INTELFB_MODULE_NAME ": "
85 #define ERR_MSG(fmt, args...) printk(KERN_ERR PFX fmt, ## args)
86 #define WRN_MSG(fmt, args...) printk(KERN_WARNING PFX fmt, ## args)
87 #define NOT_MSG(fmt, args...) printk(KERN_NOTICE PFX fmt, ## args)
88 #define INF_MSG(fmt, args...) printk(KERN_INFO PFX fmt, ## args)
90 #define DBG_MSG(fmt, args...) printk(KERN_DEBUG PFX fmt, ## args)
92 #define DBG_MSG(fmt, args...) while (0) printk(fmt, ## args)
95 /* get commonly used pointers */
96 #define GET_DINFO(info) (info)->par
100 ((d)->accel && !(d)->ring_lockup && \
101 ((i)->var.accel_flags & FB_ACCELF_TEXT))
103 /*#define NOACCEL_CHIPSET(d) \
104 ((d)->chipset != INTEL_865G)*/
105 #define NOACCEL_CHIPSET(d) \
108 #define FIXED_MODE(d) ((d)->fixed_mode)
110 /*** Driver paramters ***/
112 #define RINGBUFFER_SIZE KB(64)
113 #define HW_CURSOR_SIZE KB(4)
115 /* Intel agpgart driver */
116 #define AGP_PHYSICAL_MEMORY 2
120 /* supported chipsets */
136 struct intelfb_hwstate
{
146 u32 palette_a
[PALETTE_8_ENTRIES
];
147 u32 palette_b
[PALETTE_8_ENTRIES
];
175 u32 cursor_a_control
;
176 u32 cursor_b_control
;
184 u32 cursor_a_palette
[4];
185 u32 cursor_b_palette
[4];
200 struct intelfb_heap_data
{
203 u32 offset
; // in GATT pages
204 u32 size
; // in bytes
207 struct intelfb_info
{
208 struct fb_info
*info
;
209 struct fb_ops
*fbops
;
210 struct pci_dev
*pdev
;
212 struct intelfb_hwstate save_state
;
214 /* agpgart structs */
215 struct agp_memory
*gtt_fb_mem
; // use all stolen memory or vram
216 struct agp_memory
*gtt_ring_mem
; // ring buffer
217 struct agp_memory
*gtt_cursor_mem
; // hw cursor
219 /* use a gart reserved fb mem */
227 struct intelfb_heap_data aperture
;
228 struct intelfb_heap_data fb
;
229 struct intelfb_heap_data ring
;
230 struct intelfb_heap_data cursor
;
234 u8 __iomem
*mmio_base
;
236 /* fb start offset (in bytes) */
240 u8 __iomem
*ring_head
;
247 u32 pseudo_palette
[17];
258 int xres
, yres
, pitch
;
276 /* initial parameters */
278 struct fb_var_screeninfo initial_var
;
280 u32 initial_video_ram
;
283 /* driver registered */
286 /* index into plls */
290 #define IS_I9XX(dinfo) (((dinfo)->chipset == INTEL_915G)||(dinfo->chipset == INTEL_915GM)||((dinfo)->chipset == INTEL_945G)||(dinfo->chipset==INTEL_945GM))
292 /*** function prototypes ***/
294 extern int intelfb_var_to_depth(const struct fb_var_screeninfo
*var
);
296 #endif /* _INTELFB_H */