6 #define FB_ACCEL_SMI 0xab
7 /* please use revision id to distinguish sm750le and sm750*/
10 //#define SPC_SM750LE 8
12 #define MB(x) ((x)<<20)
13 #define MHZ(x) ((x) * 1000000)
14 /* align should be 2,4,8,16 */
15 #define PADDING(align,data) (((data)+(align)-1)&(~((align) -1)))
16 extern int smi_indent;
20 /* base virtual address of DPR registers */
21 volatile unsigned char __iomem * dprBase;
22 /* base virtual address of de data port */
23 volatile unsigned char __iomem * dpPortBase;
25 /* function fointers */
26 void (*de_init)(struct lynx_accel *);
28 int (*de_wait)(void);/* see if hardware ready to work */
30 int (*de_fillrect)(struct lynx_accel *,u32,u32,u32,
31 u32,u32,u32,u32,u32,u32);
33 int (*de_copyarea)(struct lynx_accel *,u32,u32,u32,u32,
37 int (*de_imageblit)(struct lynx_accel *,const char *,u32,u32,u32,
38 u32,u32,u32,u32,u32,u32,u32,u32,u32);
42 /* lynx_share stands for a presentation of two frame buffer
43 that use one smi adaptor , it is similar to a basic class of C++
49 struct pci_dev * pdev;
50 struct fb_info * fbinfo[2];
51 struct lynx_accel accel;
61 /* all smi graphic adaptor got below attributes */
62 unsigned long vidmem_start;
63 unsigned long vidreg_start;
67 unsigned char __iomem * pvMem;
70 /* function pointers */
71 void (*suspend)(struct lynx_share*);
72 void (*resume)(struct lynx_share*);
76 /* cursor width ,height and size */
80 /* hardware limitation */
83 /* base virtual address and offset of cursor image */
84 char __iomem * vstart;
86 /* mmio addr of hw cursor */
87 volatile char __iomem * mmio;
88 /* the lynx_share of this adaptor */
89 struct lynx_share * share;
91 void (*enable)(struct lynx_cursor *);
92 void (*disable)(struct lynx_cursor *);
93 void (*setSize)(struct lynx_cursor *,int,int);
94 void (*setPos)(struct lynx_cursor *,int,int);
95 void (*setColor)(struct lynx_cursor *,u32,u32);
96 void (*setData)(struct lynx_cursor *,u16,const u8*,const u8*);
100 unsigned char __iomem * vCursor;//virtual address of cursor
101 unsigned char __iomem * vScreen;//virtual address of on_screen
102 int oCursor;//cursor address offset in vidmem
103 int oScreen;//onscreen address offset in vidmem
104 int channel;/* which channel this crtc stands for*/
105 resource_size_t vidmem_size;/* this view's video memory max size */
107 /* below attributes belong to info->fix, their value depends on specific adaptor*/
108 u16 line_pad;/* padding information:0,1,2,4,8,16,... */
115 int(*proc_setMode)(struct lynxfb_crtc*,
116 struct fb_var_screeninfo*,
117 struct fb_fix_screeninfo*);
119 int(*proc_checkMode)(struct lynxfb_crtc*,struct fb_var_screeninfo*);
120 int(*proc_setColReg)(struct lynxfb_crtc*,ushort,ushort,ushort,ushort);
121 void (*clear)(struct lynxfb_crtc*);
123 int (*proc_panDisplay)(struct lynxfb_crtc *,
124 const struct fb_var_screeninfo *,
125 const struct fb_info *);
126 /* cursor information */
127 struct lynx_cursor cursor;
130 struct lynxfb_output{
133 /* which paths(s) this output stands for,for sm750:
134 paths=1:means output for panel paths
135 paths=2:means output for crt paths
136 paths=3:means output for both panel and crt paths
140 /* which channel these outputs linked with,for sm750:
141 *channel=0 means primary channel
142 *channel=1 means secondary channel
143 output->channel ==> &crtc->channel
147 int(*proc_setMode)(struct lynxfb_output*,
148 struct fb_var_screeninfo*,
149 struct fb_fix_screeninfo*);
151 int(*proc_checkMode)(struct lynxfb_output*,struct fb_var_screeninfo*);
152 int(*proc_setBLANK)(struct lynxfb_output*,int);
153 void (*clear)(struct lynxfb_output*);
157 /* either 0 or 1 for dual head adaptor,0 is the older one registered */
159 unsigned int pseudo_palette[256];
160 struct lynxfb_crtc crtc;
161 struct lynxfb_output output;
162 struct fb_info * info;
163 struct lynx_share * share;
167 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
171 #define PS_TO_HZ(ps) \
173 unsigned long long hz = 1000*1000*1000*1000ULL; \
177 static inline unsigned long ps_to_hz(unsigned int psvalue)
179 unsigned long long numerator=1000*1000*1000*1000ULL;
180 /* 10^12 / picosecond period gives frequency in Hz */
181 do_div(numerator, psvalue);
182 return (unsigned long)numerator;