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.2"
12 #define INTELFB_MODULE_NAME "intelfb"
13 #define SUPPORTED_CHIPSETS "830M/845G/852GM/855GM/865G/915G/915GM"
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 /* 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
52 /* Size of MMIO region */
53 #define INTEL_REG_SIZE 0x80000
55 #define STRIDE_ALIGNMENT 16
57 #define PALETTE_8_ENTRIES 256
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)
68 #define GTT_PAGE_SIZE KB(4)
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)
76 #define PFX INTELFB_MODULE_NAME ": "
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)
83 #define DBG_MSG(fmt, args...) printk(KERN_DEBUG PFX fmt, ## args)
85 #define DBG_MSG(fmt, args...) while (0) printk(fmt, ## args)
88 /* get commonly used pointers */
89 #define GET_DINFO(info) (info)->par
93 ((d)->accel && !(d)->ring_lockup && \
94 ((i)->var.accel_flags & FB_ACCELF_TEXT))
96 /*#define NOACCEL_CHIPSET(d) \
97 ((d)->chipset != INTEL_865G)*/
98 #define NOACCEL_CHIPSET(d) \
101 #define FIXED_MODE(d) ((d)->fixed_mode)
103 /*** Driver paramters ***/
105 #define RINGBUFFER_SIZE KB(64)
106 #define HW_CURSOR_SIZE KB(4)
108 /* Intel agpgart driver */
109 #define AGP_PHYSICAL_MEMORY 2
113 /* supported chipsets */
127 struct intelfb_hwstate
{
137 u32 palette_a
[PALETTE_8_ENTRIES
];
138 u32 palette_b
[PALETTE_8_ENTRIES
];
166 u32 cursor_a_control
;
167 u32 cursor_b_control
;
175 u32 cursor_a_palette
[4];
176 u32 cursor_b_palette
[4];
191 struct intelfb_heap_data
{
194 u32 offset
; // in GATT pages
195 u32 size
; // in bytes
198 struct intelfb_info
{
199 struct fb_info
*info
;
200 struct fb_ops
*fbops
;
201 struct pci_dev
*pdev
;
203 struct intelfb_hwstate save_state
;
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
210 /* use a gart reserved fb mem */
218 struct intelfb_heap_data aperture
;
219 struct intelfb_heap_data fb
;
220 struct intelfb_heap_data ring
;
221 struct intelfb_heap_data cursor
;
225 u8 __iomem
*mmio_base
;
227 /* fb start offset (in bytes) */
231 u8 __iomem
*ring_head
;
238 u32 pseudo_palette
[17];
249 int xres
, yres
, pitch
;
266 /* initial parameters */
268 struct fb_var_screeninfo initial_var
;
270 u32 initial_video_ram
;
273 /* driver registered */
277 /*** function prototypes ***/
279 extern int intelfb_var_to_depth(const struct fb_var_screeninfo
*var
);
281 #endif /* _INTELFB_H */