Commit 87520e1e authored by James Simmons's avatar James Simmons

Porting Mach 64 drive over to new api.

parent 4ec16d90
...@@ -254,7 +254,7 @@ if [ "$CONFIG_FB" = "y" ]; then ...@@ -254,7 +254,7 @@ if [ "$CONFIG_FB" = "y" ]; then
fi fi
fi fi
if [ "$CONFIG_FB_ACORN" = "y" -o "$CONFIG_FB_ATARI" = "y" -o \ if [ "$CONFIG_FB_ACORN" = "y" -o "$CONFIG_FB_ATARI" = "y" -o \
"$CONFIG_FB_ATY" = "y" -o "$CONFIG_FB_CYBER2000" = "y" -o \ "$CONFIG_FB_P9100" = "y" -o "$CONFIG_FB_CYBER2000" = "y" -o \
"$CONFIG_FB_RADEON" = "y" -o "$CONFIG_FB_TGA" = "y" -o \ "$CONFIG_FB_RADEON" = "y" -o "$CONFIG_FB_TGA" = "y" -o \
"$CONFIG_FB_SIS" = "y" -o "$CONFIG_FB_PM3" = "y" -o \ "$CONFIG_FB_SIS" = "y" -o "$CONFIG_FB_PM3" = "y" -o \
"$CONFIG_FB_TCX" = "y" -o "$CONFIG_FB_CGTHREE" = "y" -o \ "$CONFIG_FB_TCX" = "y" -o "$CONFIG_FB_CGTHREE" = "y" -o \
...@@ -264,11 +264,11 @@ if [ "$CONFIG_FB" = "y" ]; then ...@@ -264,11 +264,11 @@ if [ "$CONFIG_FB" = "y" ]; then
"$CONFIG_FB_VALKYRIE" = "y" -o "$CONFIG_FB_PLATINUM" = "y" -o \ "$CONFIG_FB_VALKYRIE" = "y" -o "$CONFIG_FB_PLATINUM" = "y" -o \
"$CONFIG_FB_IGA" = "y" -o "$CONFIG_FB_MATROX" = "y" -o \ "$CONFIG_FB_IGA" = "y" -o "$CONFIG_FB_MATROX" = "y" -o \
"$CONFIG_FB_CT65550" = "y" -o "$CONFIG_FB_PM2" = "y" -o \ "$CONFIG_FB_CT65550" = "y" -o "$CONFIG_FB_PM2" = "y" -o \
"$CONFIG_FB_P9100" = "y" ]; then "$CONFIG_FB_ATY" = "y" ]; then
define_tristate CONFIG_FBCON_CFB8 y define_tristate CONFIG_FBCON_CFB8 y
else else
if [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_ATARI" = "m" -o \ if [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_ATARI" = "m" -o \
"$CONFIG_FB_ATY" = "m" -o "$CONFIG_FB_CYBER2000" = "m" -o \ "$CONFIG_FB_P9100" = "m" -o "$CONFIG_FB_CYBER2000" = "m" -o \
"$CONFIG_FB_RADEON" = "m" -o "$CONFIG_FB_TGA" = "m" -o \ "$CONFIG_FB_RADEON" = "m" -o "$CONFIG_FB_TGA" = "m" -o \
"$CONFIG_FB_SIS" = "m" -o "$CONFIG_FB_PM3" = "m" -o \ "$CONFIG_FB_SIS" = "m" -o "$CONFIG_FB_PM3" = "m" -o \
"$CONFIG_FB_TCX" = "m" -o "$CONFIG_FB_CGTHREE" = "m" -o \ "$CONFIG_FB_TCX" = "m" -o "$CONFIG_FB_CGTHREE" = "m" -o \
...@@ -277,12 +277,11 @@ if [ "$CONFIG_FB" = "y" ]; then ...@@ -277,12 +277,11 @@ if [ "$CONFIG_FB" = "y" ]; then
"$CONFIG_FB_VIRGE" = "m" -o "$CONFIG_FB_CYBER" = "m" -o \ "$CONFIG_FB_VIRGE" = "m" -o "$CONFIG_FB_CYBER" = "m" -o \
"$CONFIG_FB_VALKYRIE" = "m" -o "$CONFIG_FB_PLATINUM" = "m" -o \ "$CONFIG_FB_VALKYRIE" = "m" -o "$CONFIG_FB_PLATINUM" = "m" -o \
"$CONFIG_FB_IGA" = "m" -o "$CONFIG_FB_MATROX" = "m" -o \ "$CONFIG_FB_IGA" = "m" -o "$CONFIG_FB_MATROX" = "m" -o \
"$CONFIG_FB_CT65550" = "m" -o "$CONFIG_FB_PM2" = "m" -o \ "$CONFIG_FB_CT65550" = "m" -o "$CONFIG_FB_PM2" = "m" ]; then
"$CONFIG_FB_P9100" = "m" ]; then
define_tristate CONFIG_FBCON_CFB8 m define_tristate CONFIG_FBCON_CFB8 m
fi fi
fi fi
if [ "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_ATY" = "y" -o \ if [ "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_PM3" = "y" -o \
"$CONFIG_FB_SIS" = "y" -o "$CONFIG_FB_PVR2" = "y" -o \ "$CONFIG_FB_SIS" = "y" -o "$CONFIG_FB_PVR2" = "y" -o \
"$CONFIG_FB_TRIDENT" = "y" -o "$CONFIG_FB_TBOX" = "y" -o \ "$CONFIG_FB_TRIDENT" = "y" -o "$CONFIG_FB_TBOX" = "y" -o \
"$CONFIG_FB_VOODOO1" = "y" -o "$CONFIG_FB_RADEON" = "y" -o \ "$CONFIG_FB_VOODOO1" = "y" -o "$CONFIG_FB_RADEON" = "y" -o \
...@@ -291,10 +290,10 @@ if [ "$CONFIG_FB" = "y" ]; then ...@@ -291,10 +290,10 @@ if [ "$CONFIG_FB" = "y" ]; then
"$CONFIG_FB_VALKYRIE" = "y" -o "$CONFIG_FB_PLATINUM" = "y" -o \ "$CONFIG_FB_VALKYRIE" = "y" -o "$CONFIG_FB_PLATINUM" = "y" -o \
"$CONFIG_FB_CT65550" = "y" -o "$CONFIG_FB_MATROX" = "y" -o \ "$CONFIG_FB_CT65550" = "y" -o "$CONFIG_FB_MATROX" = "y" -o \
"$CONFIG_FB_PM2" = "y" -o "$CONFIG_FB_CYBER2000" = "y" -o \ "$CONFIG_FB_PM2" = "y" -o "$CONFIG_FB_CYBER2000" = "y" -o \
"$CONFIG_FB_PM3" = "y" ]; then "$CONFIG_FB_ATY" = "y" ]; then
define_tristate CONFIG_FBCON_CFB16 y define_tristate CONFIG_FBCON_CFB16 y
else else
if [ "$CONFIG_FB_ATARI" = "m" -o "$CONFIG_FB_ATY" = "m" -o \ if [ "$CONFIG_FB_ATARI" = "m" -o "$CONFIG_FB_SIS" = "m" -o \
"$CONFIG_FB_RADEON" = "m" -o "$CONFIG_FB_PVR2" = "m" -o \ "$CONFIG_FB_RADEON" = "m" -o "$CONFIG_FB_PVR2" = "m" -o \
"$CONFIG_FB_TRIDENT" = "m" -o "$CONFIG_FB_TBOX" = "m" -o \ "$CONFIG_FB_TRIDENT" = "m" -o "$CONFIG_FB_TBOX" = "m" -o \
"$CONFIG_FB_VOODOO1" = "m" -o "$CONFIG_FB_PM3" = "m" -o \ "$CONFIG_FB_VOODOO1" = "m" -o "$CONFIG_FB_PM3" = "m" -o \
...@@ -302,8 +301,7 @@ if [ "$CONFIG_FB" = "y" ]; then ...@@ -302,8 +301,7 @@ if [ "$CONFIG_FB" = "y" ]; then
"$CONFIG_FB_VIRGE" = "m" -o "$CONFIG_FB_CYBER" = "m" -o \ "$CONFIG_FB_VIRGE" = "m" -o "$CONFIG_FB_CYBER" = "m" -o \
"$CONFIG_FB_VALKYRIE" = "m" -o "$CONFIG_FB_PLATINUM" = "m" -o \ "$CONFIG_FB_VALKYRIE" = "m" -o "$CONFIG_FB_PLATINUM" = "m" -o \
"$CONFIG_FB_CT65550" = "m" -o "$CONFIG_FB_MATROX" = "m" -o \ "$CONFIG_FB_CT65550" = "m" -o "$CONFIG_FB_MATROX" = "m" -o \
"$CONFIG_FB_PM2" = "m" -o "$CONFIG_FB_CYBER2000" = "m" -o \ "$CONFIG_FB_PM2" = "m" -o "$CONFIG_FB_CYBER2000" = "m" ]; then
"$CONFIG_FB_SIS" = "m" ]; then
define_tristate CONFIG_FBCON_CFB16 m define_tristate CONFIG_FBCON_CFB16 m
fi fi
fi fi
...@@ -324,22 +322,22 @@ if [ "$CONFIG_FB" = "y" ]; then ...@@ -324,22 +322,22 @@ if [ "$CONFIG_FB" = "y" ]; then
define_tristate CONFIG_FBCON_CFB24 m define_tristate CONFIG_FBCON_CFB24 m
fi fi
fi fi
if [ "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_ATY" = "y" -o \ if [ "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_RADEON" = "y" -o \
"$CONFIG_FB_VOODOO1" = "y" -o "$CONFIG_FB_TRIDENT" = "y" -o \ "$CONFIG_FB_VOODOO1" = "y" -o "$CONFIG_FB_TRIDENT" = "y" -o \
"$CONFIG_FB_CONTROL" = "y" -o "$CONFIG_FB_CLGEN" = "y" -o \ "$CONFIG_FB_CONTROL" = "y" -o "$CONFIG_FB_CLGEN" = "y" -o \
"$CONFIG_FB_TGA" = "y" -o "$CONFIG_FB_PLATINUM" = "y" -o \ "$CONFIG_FB_TGA" = "y" -o "$CONFIG_FB_PLATINUM" = "y" -o \
"$CONFIG_FB_MATROX" = "y" -o "$CONFIG_FB_PM2" = "y" -o \ "$CONFIG_FB_MATROX" = "y" -o "$CONFIG_FB_PM2" = "y" -o \
"$CONFIG_FB_PVR2" = "y" -o "$CONFIG_FB_PM3" = "y" -o \ "$CONFIG_FB_PVR2" = "y" -o "$CONFIG_FB_PM3" = "y" -o \
"$CONFIG_FB_SIS" = "y" -o "$CONFIG_FB_RADEON" = "y" ]; then "$CONFIG_FB_SIS" = "y" -o "$CONFIG_FB_ATY" = "y" ]; then
define_tristate CONFIG_FBCON_CFB32 y define_tristate CONFIG_FBCON_CFB32 y
else else
if [ "$CONFIG_FB_ATARI" = "m" -o "$CONFIG_FB_ATY" = "m" -o \ if [ "$CONFIG_FB_ATARI" = "m" -o "$CONFIG_FB_RADEON" = "m" -o \
"$CONFIG_FB_VOODOO1" = "m" -o "$CONFIG_FB_TRIDENT" = "m" -o \ "$CONFIG_FB_VOODOO1" = "m" -o "$CONFIG_FB_TRIDENT" = "m" -o \
"$CONFIG_FB_CONTROL" = "m" -o "$CONFIG_FB_CLGEN" = "m" -o \ "$CONFIG_FB_CONTROL" = "m" -o "$CONFIG_FB_CLGEN" = "m" -o \
"$CONFIG_FB_TGA" = "m" -o "$CONFIG_FB_PLATINUM" = "m" -o \ "$CONFIG_FB_TGA" = "m" -o "$CONFIG_FB_PLATINUM" = "m" -o \
"$CONFIG_FB_MATROX" = "m" -o "$CONFIG_FB_PM2" = "m" -o \ "$CONFIG_FB_MATROX" = "m" -o "$CONFIG_FB_PM2" = "m" -o \
"$CONFIG_FB_SIS" = "m" -o "$CONFIG_FB_PVR2" = "m" -o \ "$CONFIG_FB_SIS" = "m" -o "$CONFIG_FB_PVR2" = "m" -o \
"$CONFIG_FB_PM3" = "m" -o "$CONFIG_FB_RADEON" = "m" ]; then "$CONFIG_FB_PM3" = "m" ]; then
define_tristate CONFIG_FBCON_CFB32 m define_tristate CONFIG_FBCON_CFB32 m
fi fi
fi fi
...@@ -353,14 +351,15 @@ if [ "$CONFIG_FB" = "y" ]; then ...@@ -353,14 +351,15 @@ if [ "$CONFIG_FB" = "y" ]; then
"$CONFIG_FB_MAXINE" = "y" -o "$CONFIG_FB_APOLLO" = "y" -o \ "$CONFIG_FB_MAXINE" = "y" -o "$CONFIG_FB_APOLLO" = "y" -o \
"$CONFIG_FB_ATY128" = "y" -o "$CONFIG_FB_MAC" = "y" -o \ "$CONFIG_FB_ATY128" = "y" -o "$CONFIG_FB_MAC" = "y" -o \
"$CONFIG_FB_RIVA" = "y" -o "$CONFIG_FB_SA1100" = "y" -o \ "$CONFIG_FB_RIVA" = "y" -o "$CONFIG_FB_SA1100" = "y" -o \
"$CONFIG_FB_OF" = "y" -o "$CONFIG_FB_SGIVW" = "y" ]; then "$CONFIG_FB_OF" = "y" -o "$CONFIG_FB_SGIVW" = "y" -o \
"$CONFIG_FB_ATY" = "y" ]; then
define_tristate CONFIG_FBCON_ACCEL y define_tristate CONFIG_FBCON_ACCEL y
else else
if [ "$CONFIG_FB_NEOMAGIC" = "m" -o "$CONFIG_FB_HIT" = "m" -o \ if [ "$CONFIG_FB_NEOMAGIC" = "m" -o "$CONFIG_FB_HIT" = "m" -o \
"$CONFIG_FB_G364" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \ "$CONFIG_FB_G364" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \
"$CONFIG_FB_CLPS711X" = "m" -o "$CONFIG_FB_3DFX" = "m" -o \ "$CONFIG_FB_CLPS711X" = "m" -o "$CONFIG_FB_3DFX" = "m" -o \
"$CONFIG_FB_RIVA" = "m" -o "$CONFIG_FB_ATY128" = "m" -o \ "$CONFIG_FB_RIVA" = "m" -o "$CONFIG_FB_ATY128" = "m" -o \
"$CONFIG_FB_SGIVW" = "m" ]; then "$CONFIG_FB_SGIVW" = "m" -o "$CONFIG_FB_ATY" = "m" ]; then
define_tristate CONFIG_FBCON_ACCEL m define_tristate CONFIG_FBCON_ACCEL m
fi fi
fi fi
......
...@@ -44,7 +44,7 @@ obj-$(CONFIG_FB_PM3) += pm3fb.o ...@@ -44,7 +44,7 @@ obj-$(CONFIG_FB_PM3) += pm3fb.o
obj-$(CONFIG_FB_APOLLO) += dnfb.o cfbfillrect.o cfbimgblt.o obj-$(CONFIG_FB_APOLLO) += dnfb.o cfbfillrect.o cfbimgblt.o
obj-$(CONFIG_FB_Q40) += q40fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_Q40) += q40fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_ATARI) += atafb.o obj-$(CONFIG_FB_ATARI) += atafb.o
obj-$(CONFIG_FB_ATY128) += aty128fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_ATY128) += aty128fb.o
obj-$(CONFIG_FB_RADEON) += radeonfb.o obj-$(CONFIG_FB_RADEON) += radeonfb.o
obj-$(CONFIG_FB_NEOMAGIC) += neofb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_NEOMAGIC) += neofb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_IGA) += igafb.o obj-$(CONFIG_FB_IGA) += igafb.o
......
...@@ -3,7 +3,7 @@ export-objs := atyfb_base.o mach64_accel.o ...@@ -3,7 +3,7 @@ export-objs := atyfb_base.o mach64_accel.o
obj-$(CONFIG_FB_ATY) += atyfb.o obj-$(CONFIG_FB_ATY) += atyfb.o
atyfb-y := atyfb_base.o mach64_accel.o atyfb-y := atyfb_base.o mach64_accel.o ../cfbimgblt.o
atyfb-$(CONFIG_FB_ATY_GX) += mach64_gx.o atyfb-$(CONFIG_FB_ATY_GX) += mach64_gx.o
atyfb-$(CONFIG_FB_ATY_CT) += mach64_ct.o mach64_cursor.o atyfb-$(CONFIG_FB_ATY_CT) += mach64_ct.o mach64_cursor.o
atyfb-objs := $(atyfb-y) atyfb-objs := $(atyfb-y)
......
...@@ -30,8 +30,7 @@ struct pll_514 { ...@@ -30,8 +30,7 @@ struct pll_514 {
u8 n; u8 n;
}; };
struct pll_18818 struct pll_18818 {
{
u32 program_bits; u32 program_bits;
u32 locationAddr; u32 locationAddr;
u32 period_in_ps; u32 period_in_ps;
...@@ -58,17 +57,10 @@ union aty_pll { ...@@ -58,17 +57,10 @@ union aty_pll {
struct pll_18818 ics2595; struct pll_18818 ics2595;
}; };
/* /*
* The hardware parameters for each card * The hardware parameters for each card
*/ */
struct atyfb_par {
struct crtc crtc;
union aty_pll pll;
u32 accel_flags;
};
struct aty_cursor { struct aty_cursor {
int enable; int enable;
int on; int on;
...@@ -85,16 +77,15 @@ struct aty_cursor { ...@@ -85,16 +77,15 @@ struct aty_cursor {
struct timer_list *timer; struct timer_list *timer;
}; };
struct fb_info_aty { struct atyfb_par {
struct fb_info fb_info; struct aty_cmap_regs *aty_cmap_regs;
struct fb_info_aty *next; const struct aty_dac_ops *dac_ops;
const struct aty_pll_ops *pll_ops;
struct aty_cursor *cursor;
unsigned long ati_regbase; unsigned long ati_regbase;
unsigned long clk_wr_offset; unsigned long clk_wr_offset;
struct pci_mmap_map *mmap_map; struct crtc crtc;
struct aty_cursor *cursor; union aty_pll pll;
struct aty_cmap_regs *aty_cmap_regs;
struct atyfb_par default_par;
struct atyfb_par current_par;
u32 features; u32 features;
u32 ref_clk_per; u32 ref_clk_per;
u32 pll_per; u32 pll_per;
...@@ -102,15 +93,14 @@ struct fb_info_aty { ...@@ -102,15 +93,14 @@ struct fb_info_aty {
u8 bus_type; u8 bus_type;
u8 ram_type; u8 ram_type;
u8 mem_refresh_rate; u8 mem_refresh_rate;
const struct aty_dac_ops *dac_ops;
const struct aty_pll_ops *pll_ops;
struct display_switch dispsw;
u8 blitter_may_be_busy; u8 blitter_may_be_busy;
u32 accel_flags;
#ifdef __sparc__ #ifdef __sparc__
struct pci_mmap_map *mmap_map;
int consolecnt;
int vtconsole;
u8 mmaped; u8 mmaped;
int open; int open;
int vtconsole;
int consolecnt;
#endif #endif
#ifdef CONFIG_PMAC_PBOOK #ifdef CONFIG_PMAC_PBOOK
unsigned char *save_framebuffer; unsigned char *save_framebuffer;
...@@ -118,12 +108,11 @@ struct fb_info_aty { ...@@ -118,12 +108,11 @@ struct fb_info_aty {
#endif #endif
}; };
/* /*
* ATI Mach64 features * ATI Mach64 features
*/ */
#define M64_HAS(feature) ((info)->features & (M64F_##feature)) #define M64_HAS(feature) ((par)->features & (M64F_##feature))
#define M64F_RESET_3D 0x00000001 #define M64F_RESET_3D 0x00000001
#define M64F_MAGIC_FIFO 0x00000002 #define M64F_MAGIC_FIFO 0x00000002
...@@ -151,62 +140,62 @@ struct fb_info_aty { ...@@ -151,62 +140,62 @@ struct fb_info_aty {
* Register access * Register access
*/ */
static inline u32 aty_ld_le32(int regindex, static inline u32 aty_ld_le32(int regindex, const struct atyfb_par *par)
const struct fb_info_aty *info)
{ {
/* Hack for bloc 1, should be cleanly optimized by compiler */ /* Hack for bloc 1, should be cleanly optimized by compiler */
if (regindex >= 0x400) if (regindex >= 0x400)
regindex -= 0x800; regindex -= 0x800;
#if defined(__mc68000__) #if defined(__mc68000__)
return le32_to_cpu(*((volatile u32 *)(info->ati_regbase+regindex))); return
le32_to_cpu(*((volatile u32 *) (par->ati_regbase + regindex)));
#else #else
return readl (info->ati_regbase + regindex); return readl(par->ati_regbase + regindex);
#endif #endif
} }
static inline void aty_st_le32(int regindex, u32 val, static inline void aty_st_le32(int regindex, u32 val,
const struct fb_info_aty *info) const struct atyfb_par *par)
{ {
/* Hack for bloc 1, should be cleanly optimized by compiler */ /* Hack for bloc 1, should be cleanly optimized by compiler */
if (regindex >= 0x400) if (regindex >= 0x400)
regindex -= 0x800; regindex -= 0x800;
#if defined(__mc68000__) #if defined(__mc68000__)
*((volatile u32 *)(info->ati_regbase+regindex)) = cpu_to_le32(val); *((volatile u32 *) (par->ati_regbase + regindex)) =
cpu_to_le32(val);
#else #else
writel (val, info->ati_regbase + regindex); writel(val, par->ati_regbase + regindex);
#endif #endif
} }
static inline u8 aty_ld_8(int regindex, static inline u8 aty_ld_8(int regindex, const struct atyfb_par *par)
const struct fb_info_aty *info)
{ {
/* Hack for bloc 1, should be cleanly optimized by compiler */ /* Hack for bloc 1, should be cleanly optimized by compiler */
if (regindex >= 0x400) if (regindex >= 0x400)
regindex -= 0x800; regindex -= 0x800;
return readb (info->ati_regbase + regindex); return readb(par->ati_regbase + regindex);
} }
static inline void aty_st_8(int regindex, u8 val, static inline void aty_st_8(int regindex, u8 val,
const struct fb_info_aty *info) const struct atyfb_par *par)
{ {
/* Hack for bloc 1, should be cleanly optimized by compiler */ /* Hack for bloc 1, should be cleanly optimized by compiler */
if (regindex >= 0x400) if (regindex >= 0x400)
regindex -= 0x800; regindex -= 0x800;
writeb (val, info->ati_regbase + regindex); writeb(val, par->ati_regbase + regindex);
} }
static inline u8 aty_ld_pll(int offset, const struct fb_info_aty *info) static inline u8 aty_ld_pll(int offset, const struct atyfb_par *par)
{ {
u8 res; u8 res;
/* write addr byte */ /* write addr byte */
aty_st_8(CLOCK_CNTL + 1, (offset << 2), info); aty_st_8(CLOCK_CNTL + 1, (offset << 2), par);
/* read the register value */ /* read the register value */
res = aty_ld_8(CLOCK_CNTL + 2, info); res = aty_ld_8(CLOCK_CNTL + 2, par);
return res; return res;
} }
...@@ -216,8 +205,8 @@ static inline u8 aty_ld_pll(int offset, const struct fb_info_aty *info) ...@@ -216,8 +205,8 @@ static inline u8 aty_ld_pll(int offset, const struct fb_info_aty *info)
*/ */
struct aty_dac_ops { struct aty_dac_ops {
int (*set_dac)(const struct fb_info_aty *info, const union aty_pll *pll, int (*set_dac) (const struct fb_info * info,
u32 bpp, u32 accel); const union aty_pll * pll, u32 bpp, u32 accel);
}; };
extern const struct aty_dac_ops aty_dac_ibm514; /* IBM RGB514 */ extern const struct aty_dac_ops aty_dac_ibm514; /* IBM RGB514 */
...@@ -232,11 +221,12 @@ extern const struct aty_dac_ops aty_dac_ct; /* Integrated */ ...@@ -232,11 +221,12 @@ extern const struct aty_dac_ops aty_dac_ct; /* Integrated */
*/ */
struct aty_pll_ops { struct aty_pll_ops {
int (*var_to_pll)(const struct fb_info_aty *info, u32 vclk_per, u8 bpp, int (*var_to_pll) (const struct fb_info * info, u32 vclk_per,
union aty_pll *pll); u8 bpp, union aty_pll * pll);
u32 (*pll_to_var)(const struct fb_info_aty *info, u32(*pll_to_var) (const struct fb_info * info,
const union aty_pll *pll); const union aty_pll * pll);
void (*set_pll)(const struct fb_info_aty *info, const union aty_pll *pll); void (*set_pll) (const struct fb_info * info,
const union aty_pll * pll);
}; };
extern const struct aty_pll_ops aty_pll_ati18818_1; /* ATI 18818 */ extern const struct aty_pll_ops aty_pll_ati18818_1; /* ATI 18818 */
...@@ -248,9 +238,9 @@ extern const struct aty_pll_ops aty_pll_unsupported; /* unsupported */ ...@@ -248,9 +238,9 @@ extern const struct aty_pll_ops aty_pll_unsupported; /* unsupported */
extern const struct aty_pll_ops aty_pll_ct; /* Integrated */ extern const struct aty_pll_ops aty_pll_ct; /* Integrated */
extern void aty_set_pll_ct(const struct fb_info_aty *info, extern void aty_set_pll_ct(const struct fb_info *info,
const union aty_pll *pll); const union aty_pll *pll);
extern void aty_calc_pll_ct(const struct fb_info_aty *info, extern void aty_calc_pll_ct(const struct fb_info *info,
struct pll_ct *pll); struct pll_ct *pll);
...@@ -258,10 +248,10 @@ extern void aty_calc_pll_ct(const struct fb_info_aty *info, ...@@ -258,10 +248,10 @@ extern void aty_calc_pll_ct(const struct fb_info_aty *info,
* Hardware cursor support * Hardware cursor support
*/ */
extern struct aty_cursor *aty_init_cursor(struct fb_info_aty *fb); extern struct aty_cursor *aty_init_cursor(struct fb_info *info);
extern void atyfb_cursor(struct display *p, int mode, int x, int y); extern void atyfb_cursor(struct display *p, int mode, int x, int y);
extern void aty_set_cursor_color(struct fb_info_aty *fb); extern void aty_set_cursor_color(struct fb_info *info);
extern void aty_set_cursor_shape(struct fb_info_aty *fb); extern void aty_set_cursor_shape(struct fb_info *info);
extern int atyfb_set_font(struct display *d, int width, int height); extern int atyfb_set_font(struct display *d, int width, int height);
...@@ -269,25 +259,23 @@ extern int atyfb_set_font(struct display *d, int width, int height); ...@@ -269,25 +259,23 @@ extern int atyfb_set_font(struct display *d, int width, int height);
* Hardware acceleration * Hardware acceleration
*/ */
static inline void wait_for_fifo(u16 entries, const struct fb_info_aty *info) static inline void wait_for_fifo(u16 entries, const struct atyfb_par *par)
{ {
while ((aty_ld_le32(FIFO_STAT, info) & 0xffff) > while ((aty_ld_le32(FIFO_STAT, par) & 0xffff) >
((u32)(0x8000 >> entries))); ((u32) (0x8000 >> entries)));
} }
static inline void wait_for_idle(struct fb_info_aty *info) static inline void wait_for_idle(struct atyfb_par *par)
{ {
wait_for_fifo(16, info); wait_for_fifo(16, par);
while ((aty_ld_le32(GUI_STAT, info) & 1)!= 0); while ((aty_ld_le32(GUI_STAT, par) & 1) != 0);
info->blitter_may_be_busy = 0; par->blitter_may_be_busy = 0;
} }
extern void aty_reset_engine(const struct fb_info_aty *info); extern void aty_reset_engine(const struct atyfb_par *par);
extern void aty_init_engine(const struct atyfb_par *par, extern void aty_init_engine(struct atyfb_par *par,
struct fb_info_aty *info); struct fb_info *info);
extern void aty_rectfill(int dstx, int dsty, u_int width, u_int height, extern void atyfb_fillrect(struct fb_info *info, struct fb_fillrect *rect);
u_int color, struct fb_info_aty *info);
/* /*
* Text console acceleration * Text console acceleration
...@@ -297,4 +285,3 @@ extern const struct display_switch fbcon_aty8; ...@@ -297,4 +285,3 @@ extern const struct display_switch fbcon_aty8;
extern const struct display_switch fbcon_aty16; extern const struct display_switch fbcon_aty16;
extern const struct display_switch fbcon_aty24; extern const struct display_switch fbcon_aty24;
extern const struct display_switch fbcon_aty32; extern const struct display_switch fbcon_aty32;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -33,21 +33,20 @@ ...@@ -33,21 +33,20 @@
static const u8 cursor_pixel_map[2] = { 0, 15 }; static const u8 cursor_pixel_map[2] = { 0, 15 };
static const u8 cursor_color_map[2] = { 0, 0xff }; static const u8 cursor_color_map[2] = { 0, 0xff };
static const u8 cursor_bits_lookup[16] = static const u8 cursor_bits_lookup[16] = {
{
0x00, 0x40, 0x10, 0x50, 0x04, 0x44, 0x14, 0x54, 0x00, 0x40, 0x10, 0x50, 0x04, 0x44, 0x14, 0x54,
0x01, 0x41, 0x11, 0x51, 0x05, 0x45, 0x15, 0x55 0x01, 0x41, 0x11, 0x51, 0x05, 0x45, 0x15, 0x55
}; };
static const u8 cursor_mask_lookup[16] = static const u8 cursor_mask_lookup[16] = {
{
0xaa, 0x2a, 0x8a, 0x0a, 0xa2, 0x22, 0x82, 0x02, 0xaa, 0x2a, 0x8a, 0x0a, 0xa2, 0x22, 0x82, 0x02,
0xa8, 0x28, 0x88, 0x08, 0xa0, 0x20, 0x80, 0x00 0xa8, 0x28, 0x88, 0x08, 0xa0, 0x20, 0x80, 0x00
}; };
void aty_set_cursor_color(struct fb_info_aty *fb) void aty_set_cursor_color(struct fb_info *info)
{ {
struct aty_cursor *c = fb->cursor; struct atyfb_par *par = (struct atyfb_par *) info->par;
struct aty_cursor *c = par->cursor;
const u8 *pixel = cursor_pixel_map; /* ++Geert: Why?? */ const u8 *pixel = cursor_pixel_map; /* ++Geert: Why?? */
const u8 *red = cursor_color_map; const u8 *red = cursor_color_map;
const u8 *green = cursor_color_map; const u8 *green = cursor_color_map;
...@@ -58,26 +57,28 @@ void aty_set_cursor_color(struct fb_info_aty *fb) ...@@ -58,26 +57,28 @@ void aty_set_cursor_color(struct fb_info_aty *fb)
return; return;
#ifdef __sparc__ #ifdef __sparc__
if (fb->mmaped && (!fb->fb_info.display_fg if (par->mmaped && (!info->display_fg
|| fb->fb_info.display_fg->vc_num == fb->vtconsole)) || info->display_fg->vc_num ==
par->vtconsole))
return; return;
#endif #endif
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
c->color[i] = (u32)red[i] << 24; c->color[i] = (u32) red[i] << 24;
c->color[i] |= (u32)green[i] << 16; c->color[i] |= (u32) green[i] << 16;
c->color[i] |= (u32)blue[i] << 8; c->color[i] |= (u32) blue[i] << 8;
c->color[i] |= (u32)pixel[i]; c->color[i] |= (u32) pixel[i];
} }
wait_for_fifo(2, fb); wait_for_fifo(2, par);
aty_st_le32(CUR_CLR0, c->color[0], fb); aty_st_le32(CUR_CLR0, c->color[0], par);
aty_st_le32(CUR_CLR1, c->color[1], fb); aty_st_le32(CUR_CLR1, c->color[1], par);
} }
void aty_set_cursor_shape(struct fb_info_aty *fb) void aty_set_cursor_shape(struct fb_info *info)
{ {
struct aty_cursor *c = fb->cursor; struct atyfb_par *par = (struct atyfb_par *) info->par;
struct aty_cursor *c = par->cursor;
u8 *ram, m, b; u8 *ram, m, b;
int x, y; int x, y;
...@@ -85,8 +86,9 @@ void aty_set_cursor_shape(struct fb_info_aty *fb) ...@@ -85,8 +86,9 @@ void aty_set_cursor_shape(struct fb_info_aty *fb)
return; return;
#ifdef __sparc__ #ifdef __sparc__
if (fb->mmaped && (!fb->fb_info.display_fg if (par->mmaped && (!info->display_fg
|| fb->fb_info.display_fg->vc_num == fb->vtconsole)) || info->display_fg->vc_num ==
par->vtconsole))
return; return;
#endif #endif
...@@ -95,26 +97,24 @@ void aty_set_cursor_shape(struct fb_info_aty *fb) ...@@ -95,26 +97,24 @@ void aty_set_cursor_shape(struct fb_info_aty *fb)
for (x = 0; x < c->size.x >> 2; x++) { for (x = 0; x < c->size.x >> 2; x++) {
m = c->mask[x][y]; m = c->mask[x][y];
b = c->bits[x][y]; b = c->bits[x][y];
fb_writeb (cursor_mask_lookup[m >> 4] | fb_writeb(cursor_mask_lookup[m >> 4] |
cursor_bits_lookup[(b & m) >> 4], cursor_bits_lookup[(b & m) >> 4], ram++);
ram++); fb_writeb(cursor_mask_lookup[m & 0x0f] |
fb_writeb (cursor_mask_lookup[m & 0x0f] |
cursor_bits_lookup[(b & m) & 0x0f], cursor_bits_lookup[(b & m) & 0x0f],
ram++); ram++);
} }
for ( ; x < 8; x++) { for (; x < 8; x++) {
fb_writeb (0xaa, ram++); fb_writeb(0xaa, ram++);
fb_writeb (0xaa, ram++); fb_writeb(0xaa, ram++);
} }
} }
fb_memset (ram, 0xaa, (64 - c->size.y) * 16); fb_memset(ram, 0xaa, (64 - c->size.y) * 16);
} }
static void static void aty_set_cursor(struct fb_info *info, int on)
aty_set_cursor(struct fb_info_aty *fb, int on)
{ {
struct atyfb_par *par = &fb->current_par; struct atyfb_par *par = (struct atyfb_par *) info->par;
struct aty_cursor *c = fb->cursor; struct aty_cursor *c = par->cursor;
u16 xoff, yoff; u16 xoff, yoff;
int x, y; int x, y;
...@@ -122,8 +122,9 @@ aty_set_cursor(struct fb_info_aty *fb, int on) ...@@ -122,8 +122,9 @@ aty_set_cursor(struct fb_info_aty *fb, int on)
return; return;
#ifdef __sparc__ #ifdef __sparc__
if (fb->mmaped && (!fb->fb_info.display_fg if (par->mmaped && (!info->display_fg
|| fb->fb_info.display_fg->vc_num == fb->vtconsole)) || info->display_fg->vc_num ==
par->vtconsole))
return; return;
#endif #endif
...@@ -144,67 +145,72 @@ aty_set_cursor(struct fb_info_aty *fb, int on) ...@@ -144,67 +145,72 @@ aty_set_cursor(struct fb_info_aty *fb, int on)
yoff = 0; yoff = 0;
} }
wait_for_fifo(4, fb); wait_for_fifo(4, par);
aty_st_le32(CUR_OFFSET, (c->offset >> 3) + (yoff << 1), fb); aty_st_le32(CUR_OFFSET, (c->offset >> 3) + (yoff << 1),
par);
aty_st_le32(CUR_HORZ_VERT_OFF, aty_st_le32(CUR_HORZ_VERT_OFF,
((u32)(64 - c->size.y + yoff) << 16) | xoff, fb); ((u32) (64 - c->size.y + yoff) << 16) | xoff,
aty_st_le32(CUR_HORZ_VERT_POSN, ((u32)y << 16) | x, fb); par);
aty_st_le32(GEN_TEST_CNTL, aty_ld_le32(GEN_TEST_CNTL, fb) aty_st_le32(CUR_HORZ_VERT_POSN, ((u32) y << 16) | x, par);
| HWCURSOR_ENABLE, fb); aty_st_le32(GEN_TEST_CNTL, aty_ld_le32(GEN_TEST_CNTL, par)
| HWCURSOR_ENABLE, par);
} else { } else {
wait_for_fifo(1, fb); wait_for_fifo(1, par);
aty_st_le32(GEN_TEST_CNTL, aty_st_le32(GEN_TEST_CNTL,
aty_ld_le32(GEN_TEST_CNTL, fb) & ~HWCURSOR_ENABLE, aty_ld_le32(GEN_TEST_CNTL,
fb); par) & ~HWCURSOR_ENABLE, par);
} }
if (fb->blitter_may_be_busy) if (par->blitter_may_be_busy)
wait_for_idle(fb); wait_for_idle(par);
} }
static void static void aty_cursor_timer_handler(unsigned long dev_addr)
aty_cursor_timer_handler(unsigned long dev_addr)
{ {
struct fb_info_aty *fb = (struct fb_info_aty *)dev_addr; struct fb_info *info = (struct fb_info *) dev_addr;
struct atyfb_par *par = (struct atyfb_par *) info->par;
if (!fb->cursor) if (!par->cursor)
return; return;
if (!fb->cursor->enable) if (!par->cursor->enable)
goto out; goto out;
if (fb->cursor->vbl_cnt && --fb->cursor->vbl_cnt == 0) { if (par->cursor->vbl_cnt && --par->cursor->vbl_cnt == 0) {
fb->cursor->on ^= 1; par->cursor->on ^= 1;
aty_set_cursor(fb, fb->cursor->on); aty_set_cursor(info, par->cursor->on);
fb->cursor->vbl_cnt = fb->cursor->blink_rate; par->cursor->vbl_cnt = par->cursor->blink_rate;
} }
out: out:
fb->cursor->timer->expires = jiffies + (HZ / 50); par->cursor->timer->expires = jiffies + (HZ / 50);
add_timer(fb->cursor->timer); add_timer(par->cursor->timer);
} }
void atyfb_cursor(struct display *p, int mode, int x, int y) void atyfb_cursor(struct display *p, int mode, int x, int y)
{ {
struct fb_info_aty *fb = (struct fb_info_aty *)p->fb_info; struct fb_info *info = p->fb_info;
struct aty_cursor *c = fb->cursor; struct atyfb_par *par = (struct atyfb_par *) info->par;
struct aty_cursor *c = par->cursor;
if (!c) if (!c)
return; return;
#ifdef __sparc__ #ifdef __sparc__
if (fb->mmaped && (!fb->fb_info.display_fg if (par->mmaped && (!info->display_fg
|| fb->fb_info.display_fg->vc_num == fb->vtconsole)) || info->display_fg->vc_num ==
par->vtconsole))
return; return;
#endif #endif
x *= fontwidth(p); x *= fontwidth(p);
y *= fontheight(p); y *= fontheight(p);
if (c->pos.x == x && c->pos.y == y && (mode == CM_ERASE) == !c->enable) if (c->pos.x == x && c->pos.y == y
&& (mode == CM_ERASE) == !c->enable)
return; return;
c->enable = 0; c->enable = 0;
if (c->on) if (c->on)
aty_set_cursor(fb, 0); aty_set_cursor(info, 0);
c->pos.x = x; c->pos.x = x;
c->pos.y = y; c->pos.y = y;
...@@ -216,7 +222,7 @@ void atyfb_cursor(struct display *p, int mode, int x, int y) ...@@ -216,7 +222,7 @@ void atyfb_cursor(struct display *p, int mode, int x, int y)
case CM_DRAW: case CM_DRAW:
case CM_MOVE: case CM_MOVE:
if (c->on) if (c->on)
aty_set_cursor(fb, 1); aty_set_cursor(info, 1);
else else
c->vbl_cnt = CURSOR_DRAW_DELAY; c->vbl_cnt = CURSOR_DRAW_DELAY;
c->enable = 1; c->enable = 1;
...@@ -224,7 +230,7 @@ void atyfb_cursor(struct display *p, int mode, int x, int y) ...@@ -224,7 +230,7 @@ void atyfb_cursor(struct display *p, int mode, int x, int y)
} }
} }
struct aty_cursor * __init aty_init_cursor(struct fb_info_aty *fb) struct aty_cursor *__init aty_init_cursor(struct fb_info *info)
{ {
struct aty_cursor *cursor; struct aty_cursor *cursor;
unsigned long addr; unsigned long addr;
...@@ -242,19 +248,19 @@ struct aty_cursor * __init aty_init_cursor(struct fb_info_aty *fb) ...@@ -242,19 +248,19 @@ struct aty_cursor * __init aty_init_cursor(struct fb_info_aty *fb)
memset(cursor->timer, 0, sizeof(*cursor->timer)); memset(cursor->timer, 0, sizeof(*cursor->timer));
cursor->blink_rate = DEFAULT_CURSOR_BLINK_RATE; cursor->blink_rate = DEFAULT_CURSOR_BLINK_RATE;
fb->fb_info.fix.smem_len -= PAGE_SIZE; info->fix.smem_len -= PAGE_SIZE;
cursor->offset = fb->fb_info.fix.smem_len; cursor->offset = info->fix.smem_len;
#ifdef __sparc__ #ifdef __sparc__
addr = fb->fb_info.screen_base - 0x800000 + cursor->offset; addr = info->screen_base - 0x800000 + cursor->offset;
cursor->ram = (u8 *)addr; cursor->ram = (u8 *) addr;
#else #else
#ifdef __BIG_ENDIAN #ifdef __BIG_ENDIAN
addr = fb->fb_info.fix.smem_start - 0x800000 + cursor->offset; addr = info->fix.smem_start - 0x800000 + cursor->offset;
cursor->ram = (u8 *)ioremap(addr, 1024); cursor->ram = (u8 *) ioremap(addr, 1024);
#else #else
addr = (unsigned long) fb->fb_info.screen_base + cursor->offset; addr = (unsigned long) info->screen_base + cursor->offset;
cursor->ram = (u8 *)addr; cursor->ram = (u8 *) addr;
#endif #endif
#endif #endif
...@@ -265,17 +271,17 @@ struct aty_cursor * __init aty_init_cursor(struct fb_info_aty *fb) ...@@ -265,17 +271,17 @@ struct aty_cursor * __init aty_init_cursor(struct fb_info_aty *fb)
init_timer(cursor->timer); init_timer(cursor->timer);
cursor->timer->expires = jiffies + (HZ / 50); cursor->timer->expires = jiffies + (HZ / 50);
cursor->timer->data = (unsigned long)fb; cursor->timer->data = (unsigned long) info;
cursor->timer->function = aty_cursor_timer_handler; cursor->timer->function = aty_cursor_timer_handler;
add_timer(cursor->timer); add_timer(cursor->timer);
return cursor; return cursor;
} }
int atyfb_set_font(struct display *d, int width, int height) int atyfb_set_font(struct display *d, int width, int height)
{ {
struct fb_info_aty *fb = (struct fb_info_aty *)d->fb_info; struct fb_info *info = d->fb_info;
struct aty_cursor *c = fb->cursor; struct atyfb_par *par = (struct atyfb_par *) info->par;
struct aty_cursor *c = par->cursor;
int i, j; int i, j;
if (c) { if (c) {
...@@ -293,13 +299,14 @@ int atyfb_set_font(struct display *d, int width, int height) ...@@ -293,13 +299,14 @@ int atyfb_set_font(struct display *d, int width, int height)
memset(c->mask, 0, sizeof(c->mask)); memset(c->mask, 0, sizeof(c->mask));
for (i = 0, j = width; j >= 0; j -= 8, i++) { for (i = 0, j = width; j >= 0; j -= 8, i++) {
c->mask[i][height-2] = (j >= 8) ? 0xff : (0xff << (8 - j)); c->mask[i][height - 2] =
c->mask[i][height-1] = (j >= 8) ? 0xff : (0xff << (8 - j)); (j >= 8) ? 0xff : (0xff << (8 - j));
c->mask[i][height - 1] =
(j >= 8) ? 0xff : (0xff << (8 - j));
} }
aty_set_cursor_color(fb); aty_set_cursor_color(info);
aty_set_cursor_shape(fb); aty_set_cursor_shape(info);
} }
return 1; return 1;
} }
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment