2 * ATI Frame Buffer Device Driver Core Definitions
5 #include <linux/config.h>
7 * Elements of the hardware specific atyfb_par structure
19 u32 dp_pix_width; /* acceleration */
20 u32 dp_chain_mask; /* acceleration */
43 u32 dsp_config; /* Mach64 GTB DSP */
44 u32 dsp_on_off; /* Mach64 GTB DSP */
45 u8 mclk_post_div_real;
46 u8 vclk_post_div_real;
51 struct pll_514 ibm514;
52 struct pll_18818 ics2595;
56 * The hardware parameters for each card
66 struct aty_cmap_regs *aty_cmap_regs;
67 const struct aty_dac_ops *dac_ops;
68 const struct aty_pll_ops *pll_ops;
69 struct aty_cursor *cursor;
70 unsigned long ati_regbase;
71 unsigned long clk_wr_offset;
81 u8 blitter_may_be_busy;
84 struct pci_mmap_map *mmap_map;
88 #ifdef CONFIG_PMAC_PBOOK
90 unsigned char *save_framebuffer;
91 unsigned long save_pll[64];
99 #define M64_HAS(feature) ((par)->features & (M64F_##feature))
101 #define M64F_RESET_3D 0x00000001
102 #define M64F_MAGIC_FIFO 0x00000002
103 #define M64F_GTB_DSP 0x00000004
104 #define M64F_FIFO_24 0x00000008
105 #define M64F_SDRAM_MAGIC_PLL 0x00000010
106 #define M64F_MAGIC_POSTDIV 0x00000020
107 #define M64F_INTEGRATED 0x00000040
108 #define M64F_CT_BUS 0x00000080
109 #define M64F_VT_BUS 0x00000100
110 #define M64F_MOBIL_BUS 0x00000200
111 #define M64F_GX 0x00000400
112 #define M64F_CT 0x00000800
113 #define M64F_VT 0x00001000
114 #define M64F_GT 0x00002000
115 #define M64F_MAGIC_VRAM_SIZE 0x00004000
116 #define M64F_G3_PB_1_1 0x00008000
117 #define M64F_G3_PB_1024x768 0x00010000
118 #define M64F_EXTRA_BRIGHT 0x00020000
119 #define M64F_LT_SLEEP 0x00040000
120 #define M64F_XL_DLL 0x00080000
127 static inline u32 aty_ld_le32(int regindex, const struct atyfb_par *par)
129 /* Hack for bloc 1, should be cleanly optimized by compiler */
130 if (regindex >= 0x400)
134 return in_le32((volatile u32 *)(par->ati_regbase + regindex));
136 return readl(par->ati_regbase + regindex);
140 static inline void aty_st_le32(int regindex, u32 val,
141 const struct atyfb_par *par)
143 /* Hack for bloc 1, should be cleanly optimized by compiler */
144 if (regindex >= 0x400)
148 out_le32((volatile u32 *)(par->ati_regbase + regindex), val);
150 writel(val, par->ati_regbase + regindex);
154 static inline u8 aty_ld_8(int regindex, const struct atyfb_par *par)
156 /* Hack for bloc 1, should be cleanly optimized by compiler */
157 if (regindex >= 0x400)
160 return in_8(par->ati_regbase + regindex);
162 return readb(par->ati_regbase + regindex);
166 static inline void aty_st_8(int regindex, u8 val,
167 const struct atyfb_par *par)
169 /* Hack for bloc 1, should be cleanly optimized by compiler */
170 if (regindex >= 0x400)
174 out_8(par->ati_regbase + regindex, val);
176 writeb(val, par->ati_regbase + regindex);
180 static inline u8 aty_ld_pll(int offset, const struct atyfb_par *par)
184 /* write addr byte */
185 aty_st_8(CLOCK_CNTL + 1, (offset << 2), par);
186 /* read the register value */
187 res = aty_ld_8(CLOCK_CNTL + 2, par);
197 int (*set_dac) (const struct fb_info * info,
198 const union aty_pll * pll, u32 bpp, u32 accel);
201 extern const struct aty_dac_ops aty_dac_ibm514; /* IBM RGB514 */
202 extern const struct aty_dac_ops aty_dac_ati68860b; /* ATI 68860-B */
203 extern const struct aty_dac_ops aty_dac_att21c498; /* AT&T 21C498 */
204 extern const struct aty_dac_ops aty_dac_unsupported; /* unsupported */
205 extern const struct aty_dac_ops aty_dac_ct; /* Integrated */
213 int (*var_to_pll) (const struct fb_info * info, u32 vclk_per,
214 u8 bpp, union aty_pll * pll);
215 u32(*pll_to_var) (const struct fb_info * info,
216 const union aty_pll * pll);
217 void (*set_pll) (const struct fb_info * info,
218 const union aty_pll * pll);
221 extern const struct aty_pll_ops aty_pll_ati18818_1; /* ATI 18818 */
222 extern const struct aty_pll_ops aty_pll_stg1703; /* STG 1703 */
223 extern const struct aty_pll_ops aty_pll_ch8398; /* Chrontel 8398 */
224 extern const struct aty_pll_ops aty_pll_att20c408; /* AT&T 20C408 */
225 extern const struct aty_pll_ops aty_pll_ibm514; /* IBM RGB514 */
226 extern const struct aty_pll_ops aty_pll_unsupported; /* unsupported */
227 extern const struct aty_pll_ops aty_pll_ct; /* Integrated */
230 extern void aty_set_pll_ct(const struct fb_info *info,
231 const union aty_pll *pll);
232 extern void aty_calc_pll_ct(const struct fb_info *info,
237 * Hardware cursor support
240 extern struct aty_cursor *aty_init_cursor(struct fb_info *info);
241 extern int atyfb_cursor(struct fb_info *info, struct fb_cursor *cursor);
242 extern void aty_set_cursor_color(struct fb_info *info);
243 extern void aty_set_cursor_shape(struct fb_info *info);
246 * Hardware acceleration
249 static inline void wait_for_fifo(u16 entries, const struct atyfb_par *par)
251 while ((aty_ld_le32(FIFO_STAT, par) & 0xffff) >
252 ((u32) (0x8000 >> entries)));
255 static inline void wait_for_idle(struct atyfb_par *par)
257 wait_for_fifo(16, par);
258 while ((aty_ld_le32(GUI_STAT, par) & 1) != 0);
259 par->blitter_may_be_busy = 0;
262 extern void aty_reset_engine(const struct atyfb_par *par);
263 extern void aty_init_engine(struct atyfb_par *par,
264 struct fb_info *info);