6 #define FB_ACCEL_SMI 0xab
7 /* please use revision id to distinguish sm750le and sm750*/
10 #define MB(x) ((x)<<20)
11 #define MHZ(x) ((x) * 1000000)
12 /* align should be 2,4,8,16 */
13 #define PADDING(align, data) (((data)+(align)-1)&(~((align) - 1)))
14 extern int smi_indent
;
18 /* base virtual address of DPR registers */
19 volatile unsigned char __iomem
*dprBase
;
20 /* base virtual address of de data port */
21 volatile unsigned char __iomem
*dpPortBase
;
23 /* function fointers */
24 void (*de_init
)(struct lynx_accel
*);
26 int (*de_wait
)(void);/* see if hardware ready to work */
28 int (*de_fillrect
)(struct lynx_accel
*, u32
, u32
, u32
, u32
,
29 u32
, u32
, u32
, u32
, u32
);
31 int (*de_copyarea
)(struct lynx_accel
*, u32
, u32
, u32
, u32
,
35 int (*de_imageblit
)(struct lynx_accel
*, const char *, u32
, u32
, u32
, u32
,
41 /* lynx_share stands for a presentation of two frame buffer
42 that use one smi adaptor , it is similar to a basic class of C++
49 struct fb_info
*fbinfo
[2];
50 struct lynx_accel accel
;
57 /* all smi graphic adaptor got below attributes */
58 unsigned long vidmem_start
;
59 unsigned long vidreg_start
;
63 unsigned char __iomem
*pvMem
;
66 /* function pointers */
67 void (*suspend
)(struct lynx_share
*);
68 void (*resume
)(struct lynx_share
*);
72 /* cursor width ,height and size */
76 /* hardware limitation */
79 /* base virtual address and offset of cursor image */
82 /* mmio addr of hw cursor */
83 volatile char __iomem
*mmio
;
84 /* the lynx_share of this adaptor */
85 struct lynx_share
*share
;
87 void (*enable
)(struct lynx_cursor
*);
88 void (*disable
)(struct lynx_cursor
*);
89 void (*setSize
)(struct lynx_cursor
*, int, int);
90 void (*setPos
)(struct lynx_cursor
*, int, int);
91 void (*setColor
)(struct lynx_cursor
*, u32
, u32
);
92 void (*setData
)(struct lynx_cursor
*, u16
, const u8
*, const u8
*);
96 unsigned char __iomem
*vCursor
; /* virtual address of cursor */
97 unsigned char __iomem
*vScreen
; /* virtual address of on_screen */
98 int oCursor
; /* cursor address offset in vidmem */
99 int oScreen
; /* onscreen address offset in vidmem */
100 int channel
;/* which channel this crtc stands for*/
101 resource_size_t vidmem_size
;/* this view's video memory max size */
103 /* below attributes belong to info->fix, their value depends on specific adaptor*/
104 u16 line_pad
;/* padding information:0,1,2,4,8,16,... */
111 int (*proc_setMode
)(struct lynxfb_crtc
*,
112 struct fb_var_screeninfo
*,
113 struct fb_fix_screeninfo
*);
115 int (*proc_checkMode
)(struct lynxfb_crtc
*, struct fb_var_screeninfo
*);
116 int (*proc_setColReg
)(struct lynxfb_crtc
*, ushort
, ushort
, ushort
, ushort
);
117 void (*clear
)(struct lynxfb_crtc
*);
119 int (*proc_panDisplay
)(struct lynxfb_crtc
*,
120 const struct fb_var_screeninfo
*,
121 const struct fb_info
*);
122 /* cursor information */
123 struct lynx_cursor cursor
;
126 struct lynxfb_output
{
129 /* which paths(s) this output stands for,for sm750:
130 paths=1:means output for panel paths
131 paths=2:means output for crt paths
132 paths=3:means output for both panel and crt paths
136 /* which channel these outputs linked with,for sm750:
137 *channel=0 means primary channel
138 *channel=1 means secondary channel
139 output->channel ==> &crtc->channel
143 int (*proc_setMode
)(struct lynxfb_output
*,
144 struct fb_var_screeninfo
*,
145 struct fb_fix_screeninfo
*);
147 int (*proc_checkMode
)(struct lynxfb_output
*, struct fb_var_screeninfo
*);
148 int (*proc_setBLANK
)(struct lynxfb_output
*, int);
149 void (*clear
)(struct lynxfb_output
*);
153 /* either 0 or 1 for dual head adaptor,0 is the older one registered */
155 unsigned int pseudo_palette
[256];
156 struct lynxfb_crtc crtc
;
157 struct lynxfb_output output
;
158 struct fb_info
*info
;
159 struct lynx_share
*share
;
163 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
167 #define PS_TO_HZ(ps) \
169 unsigned long long hz = 1000*1000*1000*1000ULL; \
171 (unsigned long)hz; })
173 static inline unsigned long ps_to_hz(unsigned int psvalue
)
175 unsigned long long numerator
= 1000*1000*1000*1000ULL;
176 /* 10^12 / picosecond period gives frequency in Hz */
177 do_div(numerator
, psvalue
);
178 return (unsigned long)numerator
;