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, u32,
31 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, u32,
43 /* lynx_share stands for a presentation of two frame buffer
44 that use one smi adaptor , it is similar to a basic class of C++
50 struct pci_dev * pdev;
51 struct fb_info * fbinfo[2];
52 struct lynx_accel accel;
59 /* all smi graphic adaptor got below attributes */
60 unsigned long vidmem_start;
61 unsigned long vidreg_start;
65 unsigned char __iomem * pvMem;
68 /* function pointers */
69 void (*suspend)(struct lynx_share*);
70 void (*resume)(struct lynx_share*);
74 /* cursor width ,height and size */
78 /* hardware limitation */
81 /* base virtual address and offset of cursor image */
82 char __iomem * vstart;
84 /* mmio addr of hw cursor */
85 volatile char __iomem * mmio;
86 /* the lynx_share of this adaptor */
87 struct lynx_share * share;
89 void (*enable)(struct lynx_cursor *);
90 void (*disable)(struct lynx_cursor *);
91 void (*setSize)(struct lynx_cursor *, int, int);
92 void (*setPos)(struct lynx_cursor *, int, int);
93 void (*setColor)(struct lynx_cursor *, u32, u32);
94 void (*setData)(struct lynx_cursor *, u16, const u8*, const u8*);
98 unsigned char __iomem * vCursor;//virtual address of cursor
99 unsigned char __iomem * vScreen;//virtual address of on_screen
100 int oCursor;//cursor address offset in vidmem
101 int oScreen;//onscreen address offset in vidmem
102 int channel;/* which channel this crtc stands for*/
103 resource_size_t vidmem_size;/* this view's video memory max size */
105 /* below attributes belong to info->fix, their value depends on specific adaptor*/
106 u16 line_pad;/* padding information:0,1,2,4,8,16,... */
113 int(*proc_setMode)(struct lynxfb_crtc*,
114 struct fb_var_screeninfo*,
115 struct fb_fix_screeninfo*);
117 int(*proc_checkMode)(struct lynxfb_crtc*, struct fb_var_screeninfo*);
118 int(*proc_setColReg)(struct lynxfb_crtc*, ushort, ushort, ushort, ushort);
119 void (*clear)(struct lynxfb_crtc*);
121 int (*proc_panDisplay)(struct lynxfb_crtc *,
122 const struct fb_var_screeninfo *,
123 const struct fb_info *);
124 /* cursor information */
125 struct lynx_cursor cursor;
128 struct lynxfb_output{
131 /* which paths(s) this output stands for,for sm750:
132 paths=1:means output for panel paths
133 paths=2:means output for crt paths
134 paths=3:means output for both panel and crt paths
138 /* which channel these outputs linked with,for sm750:
139 *channel=0 means primary channel
140 *channel=1 means secondary channel
141 output->channel ==> &crtc->channel
145 int(*proc_setMode)(struct lynxfb_output*,
146 struct fb_var_screeninfo*,
147 struct fb_fix_screeninfo*);
149 int(*proc_checkMode)(struct lynxfb_output*, struct fb_var_screeninfo*);
150 int(*proc_setBLANK)(struct lynxfb_output*, int);
151 void (*clear)(struct lynxfb_output*);
155 /* either 0 or 1 for dual head adaptor,0 is the older one registered */
157 unsigned int pseudo_palette[256];
158 struct lynxfb_crtc crtc;
159 struct lynxfb_output output;
160 struct fb_info * info;
161 struct lynx_share * share;
165 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
169 #define PS_TO_HZ(ps) \
171 unsigned long long hz = 1000*1000*1000*1000ULL; \
175 static inline unsigned long ps_to_hz(unsigned int psvalue)
177 unsigned long long numerator=1000*1000*1000*1000ULL;
178 /* 10^12 / picosecond period gives frequency in Hz */
179 do_div(numerator, psvalue);
180 return (unsigned long)numerator;