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"
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
51 /* Size of MMIO region */
52 #define INTEL_REG_SIZE 0x80000
54 #define STRIDE_ALIGNMENT 16
56 #define PALETTE_8_ENTRIES 256
61 /* basic arithmetic */
62 #define KB(x) ((x) * 1024)
63 #define MB(x) ((x) * 1024 * 1024)
64 #define BtoKB(x) ((x) / 1024)
65 #define BtoMB(x) ((x) / 1024 / 1024)
67 #define GTT_PAGE_SIZE KB(4)
69 #define ROUND_UP_TO(x, y) (((x) + (y) - 1) / (y) * (y))
70 #define ROUND_DOWN_TO(x, y) ((x) / (y) * (y))
71 #define ROUND_UP_TO_PAGE(x) ROUND_UP_TO((x), GTT_PAGE_SIZE)
72 #define ROUND_DOWN_TO_PAGE(x) ROUND_DOWN_TO((x), GTT_PAGE_SIZE)
75 #define PFX INTELFB_MODULE_NAME ": "
77 #define ERR_MSG(fmt, args...) printk(KERN_ERR PFX fmt, ## args)
78 #define WRN_MSG(fmt, args...) printk(KERN_WARNING PFX fmt, ## args)
79 #define NOT_MSG(fmt, args...) printk(KERN_NOTICE PFX fmt, ## args)
80 #define INF_MSG(fmt, args...) printk(KERN_INFO PFX fmt, ## args)
82 #define DBG_MSG(fmt, args...) printk(KERN_DEBUG PFX fmt, ## args)
84 #define DBG_MSG(fmt, args...) while (0) printk(fmt, ## args)
87 /* get commonly used pointers */
88 #define GET_DINFO(info) (info)->par
92 ((d)->accel && !(d)->ring_lockup && \
93 ((i)->var.accel_flags & FB_ACCELF_TEXT))
95 /*#define NOACCEL_CHIPSET(d) \
96 ((d)->chipset != INTEL_865G)*/
97 #define NOACCEL_CHIPSET(d) \
100 #define FIXED_MODE(d) ((d)->fixed_mode)
102 /*** Driver paramters ***/
104 #define RINGBUFFER_SIZE KB(64)
105 #define HW_CURSOR_SIZE KB(4)
107 /* Intel agpgart driver */
108 #define AGP_PHYSICAL_MEMORY 2
112 /* supported chipsets */
125 struct intelfb_hwstate
{
135 u32 palette_a
[PALETTE_8_ENTRIES
];
136 u32 palette_b
[PALETTE_8_ENTRIES
];
164 u32 cursor_a_control
;
165 u32 cursor_b_control
;
173 u32 cursor_a_palette
[4];
174 u32 cursor_b_palette
[4];
189 struct intelfb_heap_data
{
192 u32 offset
; // in GATT pages
193 u32 size
; // in bytes
196 struct intelfb_info
{
197 struct fb_info
*info
;
198 struct fb_ops
*fbops
;
199 struct pci_dev
*pdev
;
201 struct intelfb_hwstate save_state
;
203 /* agpgart structs */
204 struct agp_memory
*gtt_fb_mem
; // use all stolen memory or vram
205 struct agp_memory
*gtt_ring_mem
; // ring buffer
206 struct agp_memory
*gtt_cursor_mem
; // hw cursor
208 /* use a gart reserved fb mem */
216 struct intelfb_heap_data aperture
;
217 struct intelfb_heap_data fb
;
218 struct intelfb_heap_data ring
;
219 struct intelfb_heap_data cursor
;
223 u8 __iomem
*mmio_base
;
225 /* fb start offset (in bytes) */
229 u8 __iomem
*ring_head
;
236 u32 pseudo_palette
[17];
237 struct { u8 red
, green
, blue
, pad
; } palette
[256];
248 int xres
, yres
, pitch
;
265 /* initial parameters */
267 struct fb_var_screeninfo initial_var
;
269 u32 initial_video_ram
;
272 /* driver registered */
276 /*** function prototypes ***/
278 extern int intelfb_var_to_depth(const struct fb_var_screeninfo
*var
);
280 #endif /* _INTELFB_H */