1 #ifndef __RIVAFB_H
2 #define __RIVAFB_H
3 
4 #include <linux/config.h>
5 #include <linux/fb.h>
6 #include <video/fbcon.h>
7 #include <video/fbcon-cfb4.h>
8 #include <video/fbcon-cfb8.h>
9 #include <video/fbcon-cfb16.h>
10 #include <video/fbcon-cfb32.h>
11 #include "riva_hw.h"
12 
13 /* GGI compatibility macros */
14 #define NUM_SEQ_REGS		0x05
15 #define NUM_CRT_REGS		0x41
16 #define NUM_GRC_REGS		0x09
17 #define NUM_ATC_REGS		0x15
18 
19 /* holds the state of the VGA core and extended Riva hw state from riva_hw.c.
20  * From KGI originally. */
21 struct riva_regs {
22 	u8 attr[NUM_ATC_REGS];
23 	u8 crtc[NUM_CRT_REGS];
24 	u8 gra[NUM_GRC_REGS];
25 	u8 seq[NUM_SEQ_REGS];
26 	u8 misc_output;
27 	RIVA_HW_STATE ext;
28 };
29 
30 typedef struct {
31 	unsigned char red, green, blue, transp;
32 } riva_cfb8_cmap_t;
33 
34 struct rivafb_info;
35 struct rivafb_info {
36 	struct fb_info info;	/* kernel framebuffer info */
37 
38 	RIVA_HW_INST riva;	/* interface to riva_hw.c */
39 
40 	const char *drvr_name;	/* Riva hardware board type */
41 
42 	unsigned long ctrl_base_phys;	/* physical control register base addr */
43 	unsigned long fb_base_phys;	/* physical framebuffer base addr */
44 
45 	caddr_t ctrl_base;	/* virtual control register base addr */
46 	caddr_t fb_base;	/* virtual framebuffer base addr */
47 
48 	unsigned ram_amount;	/* amount of RAM on card, in bytes */
49 	unsigned dclk_max;	/* max DCLK */
50 
51 	struct riva_regs initial_state;	/* initial startup video mode */
52 	struct riva_regs current_state;
53 
54 	unsigned char *EDID;
55 
56 	struct display disp;
57 	int currcon;
58 	struct display *currcon_display;
59 
60 	struct rivafb_info *next;
61 
62 	struct pci_dev *pd;	/* pointer to board's pci info */
63 	unsigned base0_region_size;	/* size of control register region */
64 	unsigned base1_region_size;	/* size of framebuffer region */
65 
66 	struct riva_cursor *cursor;
67 
68 	struct display_switch dispsw;
69 
70 	riva_cfb8_cmap_t palette[256];	/* VGA DAC palette cache */
71 
72 	int panel_xres, panel_yres;
73 	int clock;
74 	int hOver_plus, hSync_width, hblank;
75 	int vOver_plus, vSync_width, vblank;
76 	int hAct_high, vAct_high, interlaced;
77 	int synct, misc;
78 
79 	int use_default_var;
80 	int got_dfpinfo;
81 
82 #if defined(FBCON_HAS_CFB16) || defined(FBCON_HAS_CFB32)
83 	union {
84 #ifdef FBCON_HAS_CFB16
85 		u_int16_t cfb16[16];
86 #endif
87 #ifdef FBCON_HAS_CFB32
88 		u_int32_t cfb32[16];
89 #endif
90 	} con_cmap;
91 #endif				/* FBCON_HAS_CFB16 | FBCON_HAS_CFB32 */
92 #ifdef CONFIG_MTRR
93 	struct { int vram; int vram_valid; } mtrr;
94 #endif
95 };
96 
97 #endif /* __RIVAFB_H */
98