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 /* 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
56 /* Size of MMIO region */
57 #define INTEL_REG_SIZE 0x80000
59 #define STRIDE_ALIGNMENT 16
61 #define PALETTE_8_ENTRIES 256
66 /* basic arithmetic */
67 #define KB(x) ((x) * 1024)
68 #define MB(x) ((x) * 1024 * 1024)
69 #define BtoKB(x) ((x) / 1024)
70 #define BtoMB(x) ((x) / 1024 / 1024)
72 #define GTT_PAGE_SIZE KB(4)
74 #define ROUND_UP_TO(x, y) (((x) + (y) - 1) / (y) * (y))
75 #define ROUND_DOWN_TO(x, y) ((x) / (y) * (y))
76 #define ROUND_UP_TO_PAGE(x) ROUND_UP_TO((x), GTT_PAGE_SIZE)
77 #define ROUND_DOWN_TO_PAGE(x) ROUND_DOWN_TO((x), GTT_PAGE_SIZE)
80 #define PFX INTELFB_MODULE_NAME ": "
82 #define ERR_MSG(fmt, args...) printk(KERN_ERR PFX fmt, ## args)
83 #define WRN_MSG(fmt, args...) printk(KERN_WARNING PFX fmt, ## args)
84 #define NOT_MSG(fmt, args...) printk(KERN_NOTICE PFX fmt, ## args)
85 #define INF_MSG(fmt, args...) printk(KERN_INFO PFX fmt, ## args)
87 #define DBG_MSG(fmt, args...) printk(KERN_DEBUG PFX fmt, ## args)
89 #define DBG_MSG(fmt, args...) while (0) printk(fmt, ## args)
92 /* get commonly used pointers */
93 #define GET_DINFO(info) (info)->par
97 ((d)->accel && !(d)->ring_lockup && \
98 ((i)->var.accel_flags & FB_ACCELF_TEXT))
100 /*#define NOACCEL_CHIPSET(d) \
101 ((d)->chipset != INTEL_865G)*/
102 #define NOACCEL_CHIPSET(d) \
105 #define FIXED_MODE(d) ((d)->fixed_mode)
107 /*** Driver paramters ***/
109 #define RINGBUFFER_SIZE KB(64)
110 #define HW_CURSOR_SIZE KB(4)
112 /* Intel agpgart driver */
113 #define AGP_PHYSICAL_MEMORY 2
117 /* supported chipsets */
131 struct intelfb_hwstate
{
141 u32 palette_a
[PALETTE_8_ENTRIES
];
142 u32 palette_b
[PALETTE_8_ENTRIES
];
170 u32 cursor_a_control
;
171 u32 cursor_b_control
;
179 u32 cursor_a_palette
[4];
180 u32 cursor_b_palette
[4];
195 struct intelfb_heap_data
{
198 u32 offset
; // in GATT pages
199 u32 size
; // in bytes
202 struct intelfb_info
{
203 struct fb_info
*info
;
204 struct fb_ops
*fbops
;
205 struct pci_dev
*pdev
;
207 struct intelfb_hwstate save_state
;
209 /* agpgart structs */
210 struct agp_memory
*gtt_fb_mem
; // use all stolen memory or vram
211 struct agp_memory
*gtt_ring_mem
; // ring buffer
212 struct agp_memory
*gtt_cursor_mem
; // hw cursor
214 /* use a gart reserved fb mem */
222 struct intelfb_heap_data aperture
;
223 struct intelfb_heap_data fb
;
224 struct intelfb_heap_data ring
;
225 struct intelfb_heap_data cursor
;
229 u8 __iomem
*mmio_base
;
231 /* fb start offset (in bytes) */
235 u8 __iomem
*ring_head
;
242 u32 pseudo_palette
[17];
253 int xres
, yres
, pitch
;
271 /* initial parameters */
273 struct fb_var_screeninfo initial_var
;
275 u32 initial_video_ram
;
278 /* driver registered */
282 /*** function prototypes ***/
284 extern int intelfb_var_to_depth(const struct fb_var_screeninfo
*var
);
286 #endif /* _INTELFB_H */