Commit 0d71c716 authored by James Simmons's avatar James Simmons

Finally touchs to the New mac framebuffer driver. Started the port of the ATI...

Finally touchs to the New mac framebuffer driver. Started the port of the ATI 128 driver to the new api. A few small optimizations and a bug fix for SUN 12x22 fonts with the new accel code.
parent 73a324ba
...@@ -716,11 +716,6 @@ CONFIG_FBCON_IPLAN2P8 ...@@ -716,11 +716,6 @@ CONFIG_FBCON_IPLAN2P8
This is the low level frame buffer console driver for 8 interleaved This is the low level frame buffer console driver for 8 interleaved
bitplanes (256 colors) on Atari. bitplanes (256 colors) on Atari.
CONFIG_FBCON_MAC
This is the low level frame buffer console driver for 1/2/4/8/16/32
bits per pixel packed pixels on Mac. It supports variable font
widths for low resolution screens.
CONFIG_FBCON_HGA CONFIG_FBCON_HGA
This is the low level frame buffer console driver for Hercules mono This is the low level frame buffer console driver for Hercules mono
graphics cards. graphics cards.
......
...@@ -227,7 +227,6 @@ if [ "$CONFIG_FB" = "y" ]; then ...@@ -227,7 +227,6 @@ if [ "$CONFIG_FB" = "y" ]; then
tristate ' Atari interleaved bitplanes (4 planes) support' CONFIG_FBCON_IPLAN2P4 tristate ' Atari interleaved bitplanes (4 planes) support' CONFIG_FBCON_IPLAN2P4
tristate ' Atari interleaved bitplanes (8 planes) support' CONFIG_FBCON_IPLAN2P8 tristate ' Atari interleaved bitplanes (8 planes) support' CONFIG_FBCON_IPLAN2P8
# tristate ' Atari interleaved bitplanes (16 planes) support' CONFIG_FBCON_IPLAN2P16 # tristate ' Atari interleaved bitplanes (16 planes) support' CONFIG_FBCON_IPLAN2P16
tristate ' Mac variable bpp packed pixels support' CONFIG_FBCON_MAC
tristate ' VGA 16-color planar support' CONFIG_FBCON_VGA_PLANES tristate ' VGA 16-color planar support' CONFIG_FBCON_VGA_PLANES
tristate ' VGA characters/attributes support' CONFIG_FBCON_VGA tristate ' VGA characters/attributes support' CONFIG_FBCON_VGA
tristate ' HGA monochrome support (EXPERIMENTAL)' CONFIG_FBCON_HGA tristate ' HGA monochrome support (EXPERIMENTAL)' CONFIG_FBCON_HGA
...@@ -235,32 +234,28 @@ if [ "$CONFIG_FB" = "y" ]; then ...@@ -235,32 +234,28 @@ if [ "$CONFIG_FB" = "y" ]; then
# Guess what we need # Guess what we need
if [ "$CONFIG_FB_ACORN" = "y" -o "$CONFIG_FB_AMIGA" = "y" -o \ if [ "$CONFIG_FB_ACORN" = "y" -o "$CONFIG_FB_AMIGA" = "y" -o \
"$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_CYBER" = "y" -o \ "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_CYBER" = "y" -o \
"$CONFIG_FB_MAC" = "y" -o "$CONFIG_FB_RETINAZ3" = "y" -o \ "$CONFIG_FB_BWTWO" = "y" -o "$CONFIG_FB_RETINAZ3" = "y" -o \
"$CONFIG_FB_VIRGE" = "y" -o "$CONFIG_FB_CLGEN" = "y" -o \ "$CONFIG_FB_VIRGE" = "y" -o "$CONFIG_FB_CLGEN" = "y" ]; then
"$CONFIG_FB_BWTWO" = "y" ]; then
define_tristate CONFIG_FBCON_MFB y define_tristate CONFIG_FBCON_MFB y
else else
if [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_AMIGA" = "m" -o \ if [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_AMIGA" = "m" -o \
"$CONFIG_FB_ATARI" = "m" -o "$CONFIG_FB_CYBER" = "m" -o \ "$CONFIG_FB_ATARI" = "m" -o "$CONFIG_FB_CYBER" = "m" -o \
"$CONFIG_FB_MAC" = "m" -o "$CONFIG_FB_RETINAZ3" = "m" -o \ "$CONFIG_FB_BWTWO" = "m" -o "$CONFIG_FB_RETINAZ3" = "m" -o \
"$CONFIG_FB_VIRGE" = "m" -o "$CONFIG_FB_CLGEN" = "m" -o \ "$CONFIG_FB_VIRGE" = "m" -o "$CONFIG_FB_CLGEN" = "m" ]; then
"$CONFIG_FB_BWTWO" = "m" ]; then
define_tristate CONFIG_FBCON_MFB m define_tristate CONFIG_FBCON_MFB m
fi fi
fi fi
if [ "$CONFIG_FB_ACORN" = "y" -o "$CONFIG_FB_MAC" = "y" -o \ if [ "$CONFIG_FB_ACORN" = "y" -o "$CONFIG_FB_SA1100" = "y" ]; then
"$CONFIG_FB_SA1100" = "y" ]; then
define_tristate CONFIG_FBCON_CFB2 y define_tristate CONFIG_FBCON_CFB2 y
define_tristate CONFIG_FBCON_CFB4 y define_tristate CONFIG_FBCON_CFB4 y
else else
if [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_MAC" = "m" -o \ if [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_SA1100" = "m" ]; then
"$CONFIG_FB_SA1100" = "m" ]; then
define_tristate CONFIG_FBCON_CFB2 m define_tristate CONFIG_FBCON_CFB2 m
define_tristate CONFIG_FBCON_CFB4 m define_tristate CONFIG_FBCON_CFB4 m
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_MAC" = "y" -o \ "$CONFIG_FB_ATY" = "y" -o "$CONFIG_FB_CYBER2000" = "y" -o \
"$CONFIG_FB_OF" = "y" -o "$CONFIG_FB_TGA" = "y" -o \ "$CONFIG_FB_OF" = "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 \
...@@ -272,11 +267,11 @@ if [ "$CONFIG_FB" = "y" ]; then ...@@ -272,11 +267,11 @@ if [ "$CONFIG_FB" = "y" ]; then
"$CONFIG_FB_CT65550" = "y" -o "$CONFIG_FB_PM2" = "y" -o \ "$CONFIG_FB_CT65550" = "y" -o "$CONFIG_FB_PM2" = "y" -o \
"$CONFIG_FB_P9100" = "y" -o "$CONFIG_FB_ATY128" = "y" -o \ "$CONFIG_FB_P9100" = "y" -o "$CONFIG_FB_ATY128" = "y" -o \
"$CONFIG_FB_SA1100" = "y" -o "$CONFIG_FB_RADEON" = "y" -o \ "$CONFIG_FB_SA1100" = "y" -o "$CONFIG_FB_RADEON" = "y" -o \
"$CONFIG_FB_SGIVW" = "y" -o "$CONFIG_FB_CYBER2000" = "y" ]; then "$CONFIG_FB_SGIVW" = "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_MAC" = "m" -o \ "$CONFIG_FB_ATY" = "m" -o "$CONFIG_FB_CYBER2000" = "m" -o \
"$CONFIG_FB_OF" = "m" -o "$CONFIG_FB_TGA" = "m" -o \ "$CONFIG_FB_OF" = "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 \
...@@ -288,12 +283,12 @@ if [ "$CONFIG_FB" = "y" ]; then ...@@ -288,12 +283,12 @@ if [ "$CONFIG_FB" = "y" ]; then
"$CONFIG_FB_CT65550" = "m" -o "$CONFIG_FB_PM2" = "m" -o \ "$CONFIG_FB_CT65550" = "m" -o "$CONFIG_FB_PM2" = "m" -o \
"$CONFIG_FB_P9100" = "m" -o "$CONFIG_FB_ATY128" = "m" -o \ "$CONFIG_FB_P9100" = "m" -o "$CONFIG_FB_ATY128" = "m" -o \
"$CONFIG_FB_SA1100" = "m" -o "$CONFIG_FB_RADEON" = "m" -o \ "$CONFIG_FB_SA1100" = "m" -o "$CONFIG_FB_RADEON" = "m" -o \
"$CONFIG_FB_SGIVW" = "m" -o "$CONFIG_FB_CYBER2000" = "m" ]; then "$CONFIG_FB_SGIVW" = "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_ATY" = "y" -o \
"$CONFIG_FB_MAC" = "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 \
"$CONFIG_FB_CONTROL" = "y" -o "$CONFIG_FB_CLGEN" = "y" -o \ "$CONFIG_FB_CONTROL" = "y" -o "$CONFIG_FB_CLGEN" = "y" -o \
...@@ -302,12 +297,11 @@ if [ "$CONFIG_FB" = "y" ]; then ...@@ -302,12 +297,11 @@ if [ "$CONFIG_FB" = "y" ]; then
"$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_SGIVW" = "y" -o \ "$CONFIG_FB_PM2" = "y" -o "$CONFIG_FB_SGIVW" = "y" -o \
"$CONFIG_FB_SA1100" = "y" -o "$CONFIG_FB_ATY128" = "y" -o \ "$CONFIG_FB_SA1100" = "y" -o "$CONFIG_FB_ATY128" = "y" -o \
"$CONFIG_FB_CYBER2000" = "y" -o "$CONFIG_FB_PM3" = "y" -o \ "$CONFIG_FB_CYBER2000" = "y" -o "$CONFIG_FB_PM3" = "y" ]; then
"$CONFIG_FB_SIS" = "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_ATY" = "m" -o \
"$CONFIG_FB_MAC" = "m" -o "$CONFIG_FB_PVR2" = "m" -o \ "$CONFIG_FB_SIS" = "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 \
"$CONFIG_FB_CONTROL" = "m" -o "$CONFIG_FB_CLGEN" = "m" -o \ "$CONFIG_FB_CONTROL" = "m" -o "$CONFIG_FB_CLGEN" = "m" -o \
...@@ -316,8 +310,7 @@ if [ "$CONFIG_FB" = "y" ]; then ...@@ -316,8 +310,7 @@ if [ "$CONFIG_FB" = "y" ]; then
"$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_SGIVW" = "m" -o \ "$CONFIG_FB_PM2" = "m" -o "$CONFIG_FB_SGIVW" = "m" -o \
"$CONFIG_FB_SA1100" = "m" -o "$CONFIG_FB_ATY128" = "m" -o \ "$CONFIG_FB_SA1100" = "m" -o "$CONFIG_FB_ATY128" = "m" -o \
"$CONFIG_FB_CYBER2000" = "m" -o "$CONFIG_FB_SIS" = "m" -o \ "$CONFIG_FB_CYBER2000" = "m" -o "$CONFIG_FB_RADEON" = "m" ]; then
"$CONFIG_FB_RADEON" = "m" ]; then
define_tristate CONFIG_FBCON_CFB16 m define_tristate CONFIG_FBCON_CFB16 m
fi fi
fi fi
...@@ -399,13 +392,6 @@ if [ "$CONFIG_FB" = "y" ]; then ...@@ -399,13 +392,6 @@ if [ "$CONFIG_FB" = "y" ]; then
# define_tristate CONFIG_FBCON_IPLAN2P16 m # define_tristate CONFIG_FBCON_IPLAN2P16 m
fi fi
fi fi
if [ "$CONFIG_FB_MAC" = "y" ]; then
define_tristate CONFIG_FBCON_MAC y
else
if [ "$CONFIG_FB_MAC" = "m" ]; then
define_tristate CONFIG_FBCON_MAC m
fi
fi
if [ "$CONFIG_FB_VGA16" = "y" ]; then if [ "$CONFIG_FB_VGA16" = "y" ]; then
define_tristate CONFIG_FBCON_VGA_PLANES y define_tristate CONFIG_FBCON_VGA_PLANES y
else else
......
...@@ -58,7 +58,7 @@ obj-$(CONFIG_FB_CYBER) += cyberfb.o ...@@ -58,7 +58,7 @@ obj-$(CONFIG_FB_CYBER) += cyberfb.o
obj-$(CONFIG_FB_CYBER2000) += cyber2000fb.o obj-$(CONFIG_FB_CYBER2000) += cyber2000fb.o
obj-$(CONFIG_FB_SGIVW) += sgivwfb.o obj-$(CONFIG_FB_SGIVW) += sgivwfb.o
obj-$(CONFIG_FB_3DFX) += tdfxfb.o obj-$(CONFIG_FB_3DFX) += tdfxfb.o
obj-$(CONFIG_FB_MAC) += macfb.o macmodes.o obj-$(CONFIG_FB_MAC) += macfb.o macmodes.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_HP300) += hpfb.o cfbfillrect.o cfbimgblt.o obj-$(CONFIG_FB_HP300) += hpfb.o cfbfillrect.o cfbimgblt.o
obj-$(CONFIG_FB_OF) += offb.o obj-$(CONFIG_FB_OF) += offb.o
obj-$(CONFIG_FB_IMSTT) += imsttfb.o obj-$(CONFIG_FB_IMSTT) += imsttfb.o
...@@ -114,7 +114,6 @@ obj-$(CONFIG_FBCON_ILBM) += fbcon-ilbm.o ...@@ -114,7 +114,6 @@ obj-$(CONFIG_FBCON_ILBM) += fbcon-ilbm.o
obj-$(CONFIG_FBCON_IPLAN2P2) += fbcon-iplan2p2.o obj-$(CONFIG_FBCON_IPLAN2P2) += fbcon-iplan2p2.o
obj-$(CONFIG_FBCON_IPLAN2P4) += fbcon-iplan2p4.o obj-$(CONFIG_FBCON_IPLAN2P4) += fbcon-iplan2p4.o
obj-$(CONFIG_FBCON_IPLAN2P8) += fbcon-iplan2p8.o obj-$(CONFIG_FBCON_IPLAN2P8) += fbcon-iplan2p8.o
obj-$(CONFIG_FBCON_MAC) += fbcon-mac.o
obj-$(CONFIG_FBCON_MFB) += fbcon-mfb.o obj-$(CONFIG_FBCON_MFB) += fbcon-mfb.o
obj-$(CONFIG_FBCON_VGA) += fbcon-vga.o obj-$(CONFIG_FBCON_VGA) += fbcon-vga.o
obj-$(CONFIG_FBCON_HGA) += fbcon-hga.o obj-$(CONFIG_FBCON_HGA) += fbcon-hga.o
......
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
#include <asm/btext.h> #include <asm/btext.h>
#endif /* CONFIG_BOOTX_TEXT */ #endif /* CONFIG_BOOTX_TEXT */
#include <video/aty128.h>
#include <video/fbcon.h> #include <video/fbcon.h>
#include <video/fbcon-cfb8.h> #include <video/fbcon-cfb8.h>
#include <video/fbcon-cfb16.h> #include <video/fbcon-cfb16.h>
...@@ -81,8 +82,6 @@ ...@@ -81,8 +82,6 @@
#include <asm/mtrr.h> #include <asm/mtrr.h>
#endif #endif
#include "aty128.h"
/* Debug flag */ /* Debug flag */
#undef DEBUG #undef DEBUG
...@@ -131,6 +130,16 @@ static struct fb_videomode defaultmode __initdata = { ...@@ -131,6 +130,16 @@ static struct fb_videomode defaultmode __initdata = {
vmode: FB_VMODE_NONINTERLACED vmode: FB_VMODE_NONINTERLACED
}; };
static struct fb_fix_screeninfo aty128fb_fix __initdata = {
id: "ATY Rage128",
type: FB_TYPE_PACKED_PIXELS,
visual: FB_VISUAL_PSEUDOCOLOR,
xpanstep: 8,
ypanstep: 1,
mmio_len: 0x1fff,
accel: FB_ACCEL_ATI_RAGE128
};
/* struct to hold chip description information */ /* struct to hold chip description information */
struct aty128_chip_info { struct aty128_chip_info {
const char *name; const char *name;
...@@ -213,7 +222,6 @@ static const struct aty128_meminfo sdr_sgram = ...@@ -213,7 +222,6 @@ static const struct aty128_meminfo sdr_sgram =
static const struct aty128_meminfo ddr_sgram = static const struct aty128_meminfo ddr_sgram =
{ 4, 4, 3, 3, 2, 3, 1, 16, 31, 16, "64-bit DDR SGRAM" }; { 4, 4, 3, 3, 2, 3, 1, 16, 31, 16, "64-bit DDR SGRAM" };
static const char *aty128fb_name = "ATY Rage128";
static char fontname[40] __initdata = { 0 }; static char fontname[40] __initdata = { 0 };
static int noaccel __initdata = 0; static int noaccel __initdata = 0;
...@@ -276,39 +284,18 @@ struct aty128fb_par { ...@@ -276,39 +284,18 @@ struct aty128fb_par {
struct aty128_pll pll; struct aty128_pll pll;
struct aty128_ddafifo fifo_reg; struct aty128_ddafifo fifo_reg;
u32 accel_flags; u32 accel_flags;
#ifdef CONFIG_MTRR
struct { int vram; int vram_valid; } mtrr;
#endif
}; };
struct fb_info_aty128 { struct fb_info_aty128 {
struct fb_info fb_info; struct fb_info fb_info;
struct fb_info_aty128 *next; struct fb_info_aty128 *next;
struct aty128_constants constants; /* PLL and others */ struct aty128_constants constants; /* PLL and others */
unsigned long regbase_phys; /* physical mmio */
void *regbase; /* remapped mmio */ void *regbase; /* remapped mmio */
unsigned long frame_buffer_phys; /* physical fb memory */
void *frame_buffer; /* remaped framebuffer */
u32 vram_size; /* onboard video ram */
int chip_gen; int chip_gen;
const struct aty128_meminfo *mem; /* onboard mem info */ const struct aty128_meminfo *mem; /* onboard mem info */
struct aty128fb_par default_par, current_par;
struct display disp;
struct { u8 red, green, blue, pad; } palette[256];
union {
#ifdef FBCON_HAS_CFB16
u16 cfb16[16];
#endif
#ifdef FBCON_HAS_CFB24
u32 cfb24[16];
#endif
#ifdef FBCON_HAS_CFB32
u32 cfb32[16];
#endif
} fbcon_cmap;
#ifdef CONFIG_PCI
struct pci_dev *pdev;
#endif
#ifdef CONFIG_MTRR
struct { int vram; int vram_valid; } mtrr;
#endif
int blitter_may_be_busy; int blitter_may_be_busy;
int fifo_slots; /* free slots in FIFO (64 max) */ int fifo_slots; /* free slots in FIFO (64 max) */
}; };
...@@ -329,8 +316,6 @@ static int aty128fb_get_var(struct fb_var_screeninfo *var, int con, ...@@ -329,8 +316,6 @@ static int aty128fb_get_var(struct fb_var_screeninfo *var, int con,
struct fb_info *info); struct fb_info *info);
static int aty128fb_set_var(struct fb_var_screeninfo *var, int con, static int aty128fb_set_var(struct fb_var_screeninfo *var, int con,
struct fb_info *info); struct fb_info *info);
static int aty128fb_get_cmap(struct fb_cmap *cmap, int kspc, int con,
struct fb_info *info);
static int aty128fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, static int aty128fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
u_int transp, struct fb_info *info); u_int transp, struct fb_info *info);
static int aty128fb_pan_display(struct fb_var_screeninfo *var, int con, static int aty128fb_pan_display(struct fb_var_screeninfo *var, int con,
...@@ -354,8 +339,6 @@ static void aty128_encode_fix(struct fb_fix_screeninfo *fix, ...@@ -354,8 +339,6 @@ static void aty128_encode_fix(struct fb_fix_screeninfo *fix,
const struct fb_info_aty128 *info); const struct fb_info_aty128 *info);
static void aty128_set_dispsw(struct display *disp, static void aty128_set_dispsw(struct display *disp,
struct fb_info_aty128 *info, int bpp, int accel); struct fb_info_aty128 *info, int bpp, int accel);
static int aty128_getcolreg(u_int regno, u_int *red, u_int *green, u_int *blue,
u_int *transp, struct fb_info *info);
static int aty128_encode_var(struct fb_var_screeninfo *var, static int aty128_encode_var(struct fb_var_screeninfo *var,
const struct aty128fb_par *par, const struct aty128fb_par *par,
const struct fb_info_aty128 *info); const struct fb_info_aty128 *info);
...@@ -419,7 +402,7 @@ static struct fb_ops aty128fb_ops = { ...@@ -419,7 +402,7 @@ static struct fb_ops aty128fb_ops = {
fb_get_fix: aty128fb_get_fix, fb_get_fix: aty128fb_get_fix,
fb_get_var: aty128fb_get_var, fb_get_var: aty128fb_get_var,
fb_set_var: aty128fb_set_var, fb_set_var: aty128fb_set_var,
fb_get_cmap: aty128fb_get_cmap, fb_get_cmap: gen_get_cmap,
fb_set_cmap: gen_set_cmap, fb_set_cmap: gen_set_cmap,
fb_setcolreg: aty128fb_setcolreg, fb_setcolreg: aty128fb_setcolreg,
fb_pan_display: aty128fb_pan_display, fb_pan_display: aty128fb_pan_display,
...@@ -834,7 +817,7 @@ aty128_var_to_crtc(const struct fb_var_screeninfo *var, ...@@ -834,7 +817,7 @@ aty128_var_to_crtc(const struct fb_var_screeninfo *var,
bytpp = mode_bytpp[depth]; bytpp = mode_bytpp[depth];
/* make sure there is enough video ram for the mode */ /* make sure there is enough video ram for the mode */
if ((u32)(vxres * vyres * bytpp) > info->vram_size) { if ((u32)(vxres * vyres * bytpp) > info->fb_info.fix.smem_len) {
printk(KERN_ERR "aty128fb: Not enough memory for mode\n"); printk(KERN_ERR "aty128fb: Not enough memory for mode\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1185,10 +1168,10 @@ aty128_ddafifo(struct aty128_ddafifo *dsp, ...@@ -1185,10 +1168,10 @@ aty128_ddafifo(struct aty128_ddafifo *dsp,
static void static void
aty128_set_par(struct aty128fb_par *par, aty128_set_par(struct aty128fb_par *par,
struct fb_info_aty128 *info) struct fb_info_aty128 *info)
{ {
u32 config; u32 config;
info->current_par = *par; info->fb_info.par = par;
if (info->blitter_may_be_busy) if (info->blitter_may_be_busy)
wait_for_idle(info); wait_for_idle(info);
...@@ -1229,7 +1212,7 @@ aty128_set_par(struct aty128fb_par *par, ...@@ -1229,7 +1212,7 @@ aty128_set_par(struct aty128fb_par *par,
aty128_init_engine(par, info); aty128_init_engine(par, info);
#if defined(CONFIG_BOOTX_TEXT) #if defined(CONFIG_BOOTX_TEXT)
btext_update_display(info->frame_buffer_phys, btext_update_display(info->fb_info.fix.smem_start,
(((par->crtc.h_total>>16) & 0xff)+1)*8, (((par->crtc.h_total>>16) & 0xff)+1)*8,
((par->crtc.v_total>>16) & 0x7ff)+1, ((par->crtc.v_total>>16) & 0x7ff)+1,
par->crtc.bpp, par->crtc.bpp,
...@@ -1302,9 +1285,10 @@ static int ...@@ -1302,9 +1285,10 @@ static int
aty128fb_get_var(struct fb_var_screeninfo *var, int con, struct fb_info *fb) aty128fb_get_var(struct fb_var_screeninfo *var, int con, struct fb_info *fb)
{ {
const struct fb_info_aty128 *info = (struct fb_info_aty128 *)fb; const struct fb_info_aty128 *info = (struct fb_info_aty128 *)fb;
struct aty128fb_par *par = (struct aty128fb_par *) fb->par;
if (con == -1) if (con == -1)
aty128_encode_var(var, &info->default_par, info); aty128_encode_var(var, par, info);
else else
*var = fb_display[con].var; *var = fb_display[con].var;
return 0; return 0;
...@@ -1375,7 +1359,6 @@ aty128fb_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *fb) ...@@ -1375,7 +1359,6 @@ aty128fb_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *fb)
struct fb_fix_screeninfo fix; struct fb_fix_screeninfo fix;
aty128_encode_fix(&fix, &par, info); aty128_encode_fix(&fix, &par, info);
fb->screen_base = info->frame_buffer;
display->visual = fix.visual; display->visual = fix.visual;
display->type = fix.type; display->type = fix.type;
display->type_aux = fix.type_aux; display->type_aux = fix.type_aux;
...@@ -1424,19 +1407,19 @@ aty128_set_dispsw(struct display *disp, ...@@ -1424,19 +1407,19 @@ aty128_set_dispsw(struct display *disp,
case 15: case 15:
case 16: case 16:
disp->dispsw = accel ? &fbcon_aty128_16 : &fbcon_cfb16; disp->dispsw = accel ? &fbcon_aty128_16 : &fbcon_cfb16;
disp->dispsw_data = info->fbcon_cmap.cfb16; disp->dispsw_data = info->fb_info.pseudo_palette;
break; break;
#endif #endif
#ifdef FBCON_HAS_CFB24 #ifdef FBCON_HAS_CFB24
case 24: case 24:
disp->dispsw = accel ? &fbcon_aty128_24 : &fbcon_cfb24; disp->dispsw = accel ? &fbcon_aty128_24 : &fbcon_cfb24;
disp->dispsw_data = info->fbcon_cmap.cfb24; disp->dispsw_data = info->fb_info.pseudo_palette;
break; break;
#endif #endif
#ifdef FBCON_HAS_CFB32 #ifdef FBCON_HAS_CFB32
case 32: case 32:
disp->dispsw = accel ? &fbcon_aty128_32 : &fbcon_cfb32; disp->dispsw = accel ? &fbcon_aty128_32 : &fbcon_cfb32;
disp->dispsw_data = info->fbcon_cmap.cfb32; disp->dispsw_data = info->fb_info.pseudo_palette;
break; break;
#endif #endif
default: default:
...@@ -1452,25 +1435,24 @@ aty128_encode_fix(struct fb_fix_screeninfo *fix, ...@@ -1452,25 +1435,24 @@ aty128_encode_fix(struct fb_fix_screeninfo *fix,
{ {
memset(fix, 0, sizeof(struct fb_fix_screeninfo)); memset(fix, 0, sizeof(struct fb_fix_screeninfo));
strcpy(fix->id, aty128fb_name); strcpy(fix->id, info->fb_info.fix.id);
fix->smem_start = (unsigned long)info->frame_buffer_phys; fix->smem_start = info->fb_info.fix.smem_start;
fix->mmio_start = (unsigned long)info->regbase_phys; fix->mmio_start = info->fb_info.fix.mmio_start;
fix->smem_len = info->vram_size; fix->smem_len = info->fb_info.fix.smem_len;
fix->mmio_len = 0x1fff; fix->mmio_len = info->fb_info.fix.mmio_len;
fix->type = FB_TYPE_PACKED_PIXELS; fix->type = info->fb_info.fix.type;
fix->type_aux = 0; fix->type_aux = info->fb_info.fix.type_aux;
fix->line_length = (par->crtc.vxres * par->crtc.bpp) >> 3; fix->line_length = (par->crtc.vxres * par->crtc.bpp) >> 3;
fix->visual = par->crtc.bpp <= 8 ? FB_VISUAL_PSEUDOCOLOR fix->visual = par->crtc.bpp <= 8 ? FB_VISUAL_PSEUDOCOLOR
: FB_VISUAL_DIRECTCOLOR; : FB_VISUAL_DIRECTCOLOR;
fix->ywrapstep = 0; fix->ywrapstep = info->fb_info.fix.ywrapstep;
fix->xpanstep = 8; fix->xpanstep = info->fb_info.fix.xpanstep;
fix->ypanstep = 1; fix->ypanstep = info->fb_info.fix.ypanstep;
fix->accel = FB_ACCEL_ATI_RAGE128;
fix->accel = info->fb_info.fix.accel;
return; return;
} }
...@@ -1482,15 +1464,10 @@ static int ...@@ -1482,15 +1464,10 @@ static int
aty128fb_get_fix(struct fb_fix_screeninfo *fix, int con, struct fb_info *fb) aty128fb_get_fix(struct fb_fix_screeninfo *fix, int con, struct fb_info *fb)
{ {
const struct fb_info_aty128 *info = (struct fb_info_aty128 *)fb; const struct fb_info_aty128 *info = (struct fb_info_aty128 *)fb;
struct aty128fb_par par; struct aty128fb_par *par = (struct aty128fb_par *) fb->par;
if (con == -1)
par = info->default_par;
else
aty128_decode_var(&fb_display[con].var, &par, info);
aty128_encode_fix(fix, &par, info);
aty128_decode_var(&fb_display[con].var, par, info);
aty128_encode_fix(fix, par, info);
return 0; return 0;
} }
...@@ -1505,7 +1482,7 @@ aty128fb_pan_display(struct fb_var_screeninfo *var, int con, ...@@ -1505,7 +1482,7 @@ aty128fb_pan_display(struct fb_var_screeninfo *var, int con,
struct fb_info *fb) struct fb_info *fb)
{ {
struct fb_info_aty128 *info = (struct fb_info_aty128 *)fb; struct fb_info_aty128 *info = (struct fb_info_aty128 *)fb;
struct aty128fb_par *par = &info->current_par; struct aty128fb_par *par = (struct aty128fb_par *) fb->par;
u32 xoffset, yoffset; u32 xoffset, yoffset;
u32 offset; u32 offset;
u32 xres, yres; u32 xres, yres;
...@@ -1529,33 +1506,6 @@ aty128fb_pan_display(struct fb_var_screeninfo *var, int con, ...@@ -1529,33 +1506,6 @@ aty128fb_pan_display(struct fb_var_screeninfo *var, int con,
return 0; return 0;
} }
/*
* Get the Colormap
*/
static int
aty128fb_get_cmap(struct fb_cmap *cmap, int kspc, int con,
struct fb_info *info)
{
#if 1
fb_copy_cmap(&info->cmap, cmap, kspc ? 0 : 2);
#else
struct fb_info_aty128 fb = (struct fb_info_aty128 *)info;
if (con == info->currcon) /* current console? */
return fb_get_cmap(cmap, kspc, aty128_getcolreg, info);
else if (fb_display[con].cmap.len) /* non default colormap? */
fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
else {
int size = (fb_display[con].var.bits_per_pixel <= 8) ? 256 : 32;
fb_copy_cmap(fb_default_cmap(size), cmap, kspc ? 0 : 2);
}
#endif
return 0;
}
static int static int
aty128fb_rasterimg(struct fb_info *info, int start) aty128fb_rasterimg(struct fb_info *info, int start)
{ {
...@@ -1631,38 +1581,47 @@ aty128fb_setup(char *options) ...@@ -1631,38 +1581,47 @@ aty128fb_setup(char *options)
*/ */
static int __init static int __init
aty128_init(struct fb_info_aty128 *info, const char *name) aty128_init(struct fb_info_aty128 *info, struct aty128fb_par *par, struct pci_dev *pdev, const char *name)
{ {
struct fb_var_screeninfo var; struct fb_var_screeninfo var;
u32 dac; u32 dac;
int j, k, size; int size;
u8 chip_rev; u8 chip_rev;
const struct aty128_chip_info *aci = &aty128_pci_probe_list[0]; const struct aty128_chip_info *aci = &aty128_pci_probe_list[0];
char *video_card = "Rage128"; char *video_card = "Rage128";
if (!info->vram_size) /* may have already been probed */ if (!info->fb_info.fix.smem_len) /* may have already been probed */
info->vram_size = aty_ld_le32(CONFIG_MEMSIZE) & 0x03FFFFFF; info->fb_info.fix.smem_len = aty_ld_le32(CONFIG_MEMSIZE) & 0x03FFFFFF;
#ifdef CONFIG_MTRR
if (mtrr) {
par->mtrr.vram = mtrr_add(info->fb_info.fix.smem_start,
info->fb_info.fix.smem_len, MTRR_TYPE_WRCOMB, 1);
par->mtrr.vram_valid = 1;
/* let there be speed */
printk(KERN_INFO "aty128fb: Rage128 MTRR set to ON\n");
}
#endif /* CONFIG_MTRR */
/* Get the chip revision */ /* Get the chip revision */
chip_rev = (aty_ld_le32(CONFIG_CNTL) >> 16) & 0x1F; chip_rev = (aty_ld_le32(CONFIG_CNTL) >> 16) & 0x1F;
/* put a name with the face */ /* put a name with the face */
while (aci->name && info->pdev->device != aci->device) { aci++; } while (aci->name && pdev->device != aci->device) { aci++; }
video_card = (char *)aci->name; video_card = (char *)aci->name;
info->chip_gen = aci->chip_gen; info->chip_gen = aci->chip_gen;
printk(KERN_INFO "aty128fb: %s [chip rev 0x%x] ", video_card, chip_rev); printk(KERN_INFO "aty128fb: %s [chip rev 0x%x] ", video_card, chip_rev);
if (info->vram_size % (1024 * 1024) == 0) if (info->fb_info.fix.smem_len % (1024 * 1024) == 0)
printk("%dM %s\n", info->vram_size / (1024*1024), info->mem->name); printk("%dM %s\n", info->fb_info.fix.smem_len / (1024*1024), info->mem->name);
else else
printk("%dk %s\n", info->vram_size / 1024, info->mem->name); printk("%dk %s\n", info->fb_info.fix.smem_len / 1024, info->mem->name);
/* fill in info */ /* fill in info */
strcpy(info->fb_info.modename, aty128fb_name); strcpy(info->fb_info.modename, info->fb_info.fix.id);
info->fb_info.node = NODEV; info->fb_info.node = NODEV;
info->fb_info.fbops = &aty128fb_ops; info->fb_info.fbops = &aty128fb_ops;
info->fb_info.disp = &info->disp;
strcpy(info->fb_info.fontname, fontname); strcpy(info->fb_info.fontname, fontname);
info->fb_info.changevar = NULL; info->fb_info.changevar = NULL;
info->fb_info.switch_con = &aty128fbcon_switch; info->fb_info.switch_con = &aty128fbcon_switch;
...@@ -1721,19 +1680,11 @@ aty128_init(struct fb_info_aty128 *info, const char *name) ...@@ -1721,19 +1680,11 @@ aty128_init(struct fb_info_aty128 *info, const char *name)
else else
var.accel_flags |= FB_ACCELF_TEXT; var.accel_flags |= FB_ACCELF_TEXT;
if (aty128_decode_var(&var, &info->default_par, info)) { if (aty128_decode_var(&var, par, info)) {
printk(KERN_ERR "aty128fb: Cannot set default mode.\n"); printk(KERN_ERR "aty128fb: Cannot set default mode.\n");
return 0; return 0;
} }
/* load up the palette with default colors */
for (j = 0; j < 16; j++) {
k = color_table[j];
info->palette[j].red = default_red[k];
info->palette[j].green = default_grn[k];
info->palette[j].blue = default_blu[k];
}
/* setup the DAC the way we like it */ /* setup the DAC the way we like it */
dac = aty_ld_le32(DAC_CNTL); dac = aty_ld_le32(DAC_CNTL);
dac |= (DAC_8BIT_EN | DAC_RANGE_CNTL); dac |= (DAC_8BIT_EN | DAC_RANGE_CNTL);
...@@ -1744,12 +1695,12 @@ aty128_init(struct fb_info_aty128 *info, const char *name) ...@@ -1744,12 +1695,12 @@ aty128_init(struct fb_info_aty128 *info, const char *name)
aty_st_le32(BUS_CNTL, aty_ld_le32(BUS_CNTL) | BUS_MASTER_DIS); aty_st_le32(BUS_CNTL, aty_ld_le32(BUS_CNTL) | BUS_MASTER_DIS);
aty128fb_set_var(&var, -1, &info->fb_info); aty128fb_set_var(&var, -1, &info->fb_info);
aty128_init_engine(&info->default_par, info); aty128_init_engine(par, info);
board_list = aty128_board_list_add(board_list, info); board_list = aty128_board_list_add(board_list, info);
size = (var.bits_per_pixel <= 8) ? 256 : 32; size = (var.bits_per_pixel <= 8) ? 256 : 32;
fb_alloc_cmap(info->fb_info.cmap, size, 0); fb_alloc_cmap(&info->fb_info.cmap, size, 0);
if (register_framebuffer(&info->fb_info) < 0) if (register_framebuffer(&info->fb_info) < 0)
return 0; return 0;
...@@ -1761,7 +1712,7 @@ aty128_init(struct fb_info_aty128 *info, const char *name) ...@@ -1761,7 +1712,7 @@ aty128_init(struct fb_info_aty128 *info, const char *name)
#endif /* CONFIG_PMAC_BACKLIGHT */ #endif /* CONFIG_PMAC_BACKLIGHT */
printk(KERN_INFO "fb%d: %s frame buffer device on %s\n", printk(KERN_INFO "fb%d: %s frame buffer device on %s\n",
GET_FB_IDX(info->fb_info.node), aty128fb_name, name); GET_FB_IDX(info->fb_info.node), info->fb_info.fix.id, name);
return 1; /* success! */ return 1; /* success! */
} }
...@@ -1814,7 +1765,7 @@ aty128_pci_register(struct pci_dev *pdev, ...@@ -1814,7 +1765,7 @@ aty128_pci_register(struct pci_dev *pdev,
const struct aty128_chip_info *aci) const struct aty128_chip_info *aci)
{ {
struct fb_info_aty128 *info = NULL; struct fb_info_aty128 *info = NULL;
unsigned long fb_addr, reg_addr; struct aty128fb_par *par;
int err; int err;
#if !defined(CONFIG_PPC) && !defined(__sparc__) #if !defined(CONFIG_PPC) && !defined(__sparc__)
char *bios_seg = NULL; char *bios_seg = NULL;
...@@ -1827,48 +1778,54 @@ aty128_pci_register(struct pci_dev *pdev, ...@@ -1827,48 +1778,54 @@ aty128_pci_register(struct pci_dev *pdev,
goto err_out; goto err_out;
} }
fb_addr = pci_resource_start(pdev, 0); aty128fb_fix.smem_start = pci_resource_start(pdev, 0);
if (!request_mem_region(fb_addr, pci_resource_len(pdev, 0), if (!request_mem_region(aty128fb_fix.smem_start, pci_resource_len(pdev, 0),
"aty128fb FB")) { "aty128fb FB")) {
printk(KERN_ERR "aty128fb: cannot reserve frame " printk(KERN_ERR "aty128fb: cannot reserve frame "
"buffer memory\n"); "buffer memory\n");
goto err_free_fb; goto err_free_fb;
} }
reg_addr = pci_resource_start(pdev, 2); aty128fb_fix.mmio_start = pci_resource_start(pdev, 2);
if (!request_mem_region(reg_addr, pci_resource_len(pdev, 2), if (!request_mem_region(aty128fb_fix.mmio_start, pci_resource_len(pdev, 2),
"aty128fb MMIO")) { "aty128fb MMIO")) {
printk(KERN_ERR "aty128fb: cannot reserve MMIO region\n"); printk(KERN_ERR "aty128fb: cannot reserve MMIO region\n");
goto err_free_mmio; goto err_free_mmio;
} }
/* We have the resources. Now virtualize them */ /* We have the resources. Now virtualize them */
if (!(info = kmalloc(sizeof(struct fb_info_aty128), GFP_ATOMIC))) { if (!(info = kmalloc(sizeof(struct fb_info_aty128) + sizeof(struct display) + sizeof(u32) * 17, GFP_ATOMIC))) {
printk(KERN_ERR "aty128fb: can't alloc fb_info_aty128\n"); printk(KERN_ERR "aty128fb: can't alloc fb_info_aty128\n");
goto err_unmap_out; goto err_unmap_out;
} }
memset(info, 0, sizeof(struct fb_info_aty128));
/* Copy PCI device info into info->pdev */ if (!(par = kmalloc(sizeof(struct aty128fb_par), GFP_ATOMIC))) {
info->pdev = pdev; printk(KERN_ERR "aty128fb: can't alloc aty128fb_par\n");
goto err_unmap_out;
}
memset(info, 0, sizeof(struct fb_info_aty128));
memset(par, 0, sizeof(struct aty128fb_par));
info->fb_info.disp = (struct display *)(info + 1);
info->fb_info.pseudo_palette = (void *)(info->fb_info.disp + 1);
info->fb_info.par = par;
info->fb_info.currcon = -1; info->fb_info.currcon = -1;
info->fb_info.fix = aty128fb_fix;
/* Virtualize mmio region */ /* Virtualize mmio region */
info->regbase_phys = reg_addr; info->regbase = ioremap(aty128fb_fix.mmio_start, 0x1FFF);
info->regbase = ioremap(reg_addr, 0x1FFF);
if (!info->regbase) if (!info->regbase)
goto err_free_info; goto err_free_info;
/* Grab memory size from the card */ /* Grab memory size from the card */
info->vram_size = aty_ld_le32(CONFIG_MEMSIZE) & 0x03FFFFFF; info->fb_info.fix.smem_len = aty_ld_le32(CONFIG_MEMSIZE) & 0x03FFFFFF;
/* Virtualize the framebuffer */ /* Virtualize the framebuffer */
info->frame_buffer_phys = fb_addr; info->fb_info.screen_base = ioremap(aty128fb_fix.smem_start, info->fb_info.fix.smem_len);
info->frame_buffer = ioremap(fb_addr, info->vram_size);
if (!info->frame_buffer) { if (!info->fb_info.screen_base) {
iounmap((void *)info->regbase); iounmap((void *)info->regbase);
goto err_free_info; goto err_free_info;
} }
...@@ -1891,23 +1848,12 @@ aty128_pci_register(struct pci_dev *pdev, ...@@ -1891,23 +1848,12 @@ aty128_pci_register(struct pci_dev *pdev,
#endif #endif
aty128_timings(info); aty128_timings(info);
if (!aty128_init(info, "PCI")) if (!aty128_init(info, par, pdev, "PCI"))
goto err_out; goto err_out;
#ifdef CONFIG_MTRR
if (mtrr) {
info->mtrr.vram = mtrr_add(info->frame_buffer_phys,
info->vram_size, MTRR_TYPE_WRCOMB, 1);
info->mtrr.vram_valid = 1;
/* let there be speed */
printk(KERN_INFO "aty128fb: Rage128 MTRR set to ON\n");
}
#endif /* CONFIG_MTRR */
return 0; return 0;
err_out: err_out:
iounmap(info->frame_buffer); iounmap(info->fb_info.screen_base);
iounmap(info->regbase); iounmap(info->regbase);
err_free_info: err_free_info:
kfree(info); kfree(info);
...@@ -2093,12 +2039,14 @@ static int ...@@ -2093,12 +2039,14 @@ static int
aty128fbcon_switch(int con, struct fb_info *fb) aty128fbcon_switch(int con, struct fb_info *fb)
{ {
struct fb_info_aty128 *info = (struct fb_info_aty128 *)fb; struct fb_info_aty128 *info = (struct fb_info_aty128 *)fb;
struct display *disp;
struct aty128fb_par par; struct aty128fb_par par;
/* Do we have to save the colormap? */ if (info->fb_info.currcon >= 0) {
if (fb_display[fb->currcon].cmap.len) disp = fb_display + info->fb_info.currcon;
fb_get_cmap(&fb_display[fb->currcon].cmap, 1, if (disp->cmap.len)
aty128_getcolreg, fb); fb_copy_cmap(&info->fb_info.cmap, &disp->cmap, 0);
}
/* set the current console */ /* set the current console */
fb->currcon = con; fb->currcon = con;
...@@ -2145,27 +2093,6 @@ aty128fb_blank(int blank, struct fb_info *fb) ...@@ -2145,27 +2093,6 @@ aty128fb_blank(int blank, struct fb_info *fb)
return 0; return 0;
} }
/*
* Read a single color register and split it into
* colors/transparent. Return != 0 for invalid regno.
*/
static int
aty128_getcolreg(u_int regno, u_int *red, u_int *green, u_int *blue,
u_int *transp, struct fb_info *fb)
{
struct fb_info_aty128 *info = (struct fb_info_aty128 *) fb;
if (regno > 255)
return 1;
*red = (info->palette[regno].red<<8) | info->palette[regno].red;
*green = (info->palette[regno].green<<8) | info->palette[regno].green;
*blue = (info->palette[regno].blue<<8) | info->palette[regno].blue;
*transp = 0;
return 0;
}
/* /*
* Set a single color register. The values supplied are already * Set a single color register. The values supplied are already
* rounded down to the hardware's capabilities (according to the * rounded down to the hardware's capabilities (according to the
...@@ -2176,6 +2103,7 @@ aty128fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, ...@@ -2176,6 +2103,7 @@ aty128fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
u_int transp, struct fb_info *fb) u_int transp, struct fb_info *fb)
{ {
struct fb_info_aty128 *info = (struct fb_info_aty128 *)fb; struct fb_info_aty128 *info = (struct fb_info_aty128 *)fb;
struct aty128fb_par *par = (struct aty128fb_par *) fb->par;
u32 col; u32 col;
if (regno > 255) if (regno > 255)
...@@ -2184,16 +2112,13 @@ aty128fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, ...@@ -2184,16 +2112,13 @@ aty128fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
red >>= 8; red >>= 8;
green >>= 8; green >>= 8;
blue >>= 8; blue >>= 8;
info->palette[regno].red = red;
info->palette[regno].green = green;
info->palette[regno].blue = blue;
/* Note: For now, on M3, we set palette on both heads, which may /* Note: For now, on M3, we set palette on both heads, which may
* be useless. Can someone with a M3 check this ? */ * be useless. Can someone with a M3 check this ? */
/* initialize gamma ramp for hi-color+ */ /* initialize gamma ramp for hi-color+ */
if ((info->current_par.crtc.bpp > 8) && (regno == 0)) { if ((par->crtc.bpp > 8) && (regno == 0)) {
int i; int i;
if (info->chip_gen == rage_M3) if (info->chip_gen == rage_M3)
...@@ -2221,7 +2146,7 @@ aty128fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, ...@@ -2221,7 +2146,7 @@ aty128fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
if (info->chip_gen == rage_M3) if (info->chip_gen == rage_M3)
aty_st_le32(DAC_CNTL, aty_ld_le32(DAC_CNTL) & ~DAC_PALETTE_ACCESS_CNTL); aty_st_le32(DAC_CNTL, aty_ld_le32(DAC_CNTL) & ~DAC_PALETTE_ACCESS_CNTL);
if (info->current_par.crtc.bpp == 16) if (par->crtc.bpp == 16)
aty_st_8(PALETTE_INDEX, (regno << 3)); aty_st_8(PALETTE_INDEX, (regno << 3));
else else
aty_st_8(PALETTE_INDEX, regno); aty_st_8(PALETTE_INDEX, regno);
...@@ -2229,7 +2154,7 @@ aty128fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, ...@@ -2229,7 +2154,7 @@ aty128fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
aty_st_le32(PALETTE_DATA, col); aty_st_le32(PALETTE_DATA, col);
if (info->chip_gen == rage_M3) { if (info->chip_gen == rage_M3) {
aty_st_le32(DAC_CNTL, aty_ld_le32(DAC_CNTL) | DAC_PALETTE_ACCESS_CNTL); aty_st_le32(DAC_CNTL, aty_ld_le32(DAC_CNTL) | DAC_PALETTE_ACCESS_CNTL);
if (info->current_par.crtc.bpp == 16) if (par->crtc.bpp == 16)
aty_st_8(PALETTE_INDEX, (regno << 3)); aty_st_8(PALETTE_INDEX, (regno << 3));
else else
aty_st_8(PALETTE_INDEX, regno); aty_st_8(PALETTE_INDEX, regno);
...@@ -2237,17 +2162,15 @@ aty128fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, ...@@ -2237,17 +2162,15 @@ aty128fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
} }
if (regno < 16) if (regno < 16)
switch (info->current_par.crtc.bpp) { switch (par->crtc.bpp) {
#ifdef FBCON_HAS_CFB16 #ifdef FBCON_HAS_CFB16
case 9 ... 16: case 9 ... 16:
info->fbcon_cmap.cfb16[regno] = (regno << 10) | (regno << 5) | ((u32*) (info->fb_info.pseudo_palette))[regno] = (regno << 10) | (regno << 5) | regno;
regno;
break; break;
#endif #endif
#ifdef FBCON_HAS_CFB24 #ifdef FBCON_HAS_CFB24
case 17 ... 24: case 17 ... 24:
info->fbcon_cmap.cfb24[regno] = (regno << 16) | (regno << 8) | ((u32*) (info->fb_info.pseudo_palette))[regno] = (regno << 16) | (regno << 8) | regno;
regno;
break; break;
#endif #endif
#ifdef FBCON_HAS_CFB32 #ifdef FBCON_HAS_CFB32
...@@ -2255,7 +2178,7 @@ aty128fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, ...@@ -2255,7 +2178,7 @@ aty128fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
u32 i; u32 i;
i = (regno << 8) | regno; i = (regno << 8) | regno;
info->fbcon_cmap.cfb32[regno] = (i << 16) | i; ((u32*) (info->fb_info.pseudo_palette))[regno] = (i << 16) | i;
break; break;
} }
#endif #endif
...@@ -2304,12 +2227,13 @@ aty128_rectcopy(int srcx, int srcy, int dstx, int dsty, ...@@ -2304,12 +2227,13 @@ aty128_rectcopy(int srcx, int srcy, int dstx, int dsty,
u_int width, u_int height, u_int width, u_int height,
struct fb_info_aty128 *info) struct fb_info_aty128 *info)
{ {
struct aty128fb_par *par = (struct aty128fb_par *) info->fb_info.par;
u32 save_dp_datatype, save_dp_cntl, bppval; u32 save_dp_datatype, save_dp_cntl, bppval;
if (!width || !height) if (!width || !height)
return; return;
bppval = bpp_to_depth(info->current_par.crtc.bpp); bppval = bpp_to_depth(par->crtc.bpp);
if (bppval == DST_24BPP) { if (bppval == DST_24BPP) {
srcx *= 3; srcx *= 3;
dstx *= 3; dstx *= 3;
...@@ -2598,19 +2522,21 @@ void __exit ...@@ -2598,19 +2522,21 @@ void __exit
cleanup_module(void) cleanup_module(void)
{ {
struct fb_info_aty128 *info = board_list; struct fb_info_aty128 *info = board_list;
struct aty128fb_par *par;
while (board_list) { while (board_list) {
info = board_list; info = board_list;
board_list = board_list->next; board_list = board_list->next;
par = info->fb_info.par;
unregister_framebuffer(&info->fb_info); unregister_framebuffer(&info->fb_info);
#ifdef CONFIG_MTRR #ifdef CONFIG_MTRR
if (info->mtrr.vram_valid) if (par->mtrr.vram_valid)
mtrr_del(info->mtrr.vram, info->frame_buffer_phys, mtrr_del(par->mtrr.vram, info->fb_info.fix.smem_start,
info->vram_size); info->fb_info.fix.smem_len);
#endif /* CONFIG_MTRR */ #endif /* CONFIG_MTRR */
iounmap(info->regbase); iounmap(info->regbase);
iounmap(info->frame_buffer); iounmap(info->fb_info.screen_base);
release_mem_region(pci_resource_start(info->pdev, 0), release_mem_region(pci_resource_start(info->pdev, 0),
pci_resource_len(info->pdev, 0)); pci_resource_len(info->pdev, 0));
......
/*
* linux/drivers/video/fbcon-mac.c -- Low level frame buffer operations for
* x bpp packed pixels, font width != 8
*
* Created 26 Dec 1997 by Michael Schmitz
* Based on the old macfb.c 6x11 code by Randy Thelen
*
* This driver is significantly slower than the 8bit font drivers
* and would probably benefit from splitting into drivers for each depth.
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of this archive for
*/
#include <linux/module.h>
#include <linux/tty.h>
#include <linux/console.h>
#include <linux/string.h>
#include <linux/fb.h>
#include <linux/delay.h>
#include <video/fbcon.h>
#include <video/fbcon-mac.h>
/*
* variable bpp packed pixels
*/
static void plot_pixel_mac(struct display *p, int bw, int pixel_x,
int pixel_y);
static int get_pixel_mac(struct display *p, int pixel_x, int pixel_y);
void fbcon_mac_setup(struct display *p)
{
if (p->line_length)
p->next_line = p->line_length;
else
p->next_line = p->var.xres_virtual>>3;
p->next_plane = 0;
}
/*
* Macintosh
*/
#define PIXEL_BLACK_MAC 0
#define PIXEL_WHITE_MAC 1
#define PIXEL_INVERT_MAC 2
void fbcon_mac_bmove(struct display *p, int sy, int sx, int dy, int dx,
int height, int width)
{
int i, j;
u8 *dest, *src;
int l,r,t,b,w,lo,s;
int dl,dr,dt,db,dw,dlo;
int move_up;
src = (u8 *) (p->fb_info->screen_base + sy * fontheight(p) * p->next_line);
dest = (u8 *) (p->fb_info->screen_base + dy * fontheight(p) * p->next_line);
if( sx == 0 && width == p->conp->vc_cols) {
s = height * fontheight(p) * p->next_line;
fb_memmove(dest, src, s);
return;
}
l = sx * fontwidth(p);
r = l + width * fontwidth(p);
t = sy * fontheight(p);
b = t + height * fontheight(p);
dl = dx * fontwidth(p);
dr = dl + width * fontwidth(p);
dt = dy * fontheight(p);
db = dt + height * fontheight(p);
/* w is the # pixels between two long-aligned points, left and right */
w = (r&~31) - ((l+31)&~31);
dw = (dr&~31) - ((dl+31)&~31);
/* lo is the # pixels between the left edge and a long-aligned left pixel */
lo = ((l+31)&~31) - l;
dlo = ((dl+31)&~31) - dl;
/* if dx != sx then, logic has to align the left and right edges for fast moves */
if (lo != dlo) {
lo = ((l+7)&~7) - l;
dlo = ((dl+7)&~7) - dl;
w = (r&~7) - ((l+7)&~7);
dw = (dr&~7) - ((dl+7)&~7);
if (lo != dlo) {
unsigned char err_str[128];
unsigned short err_buf[256];
unsigned long cnt, len;
sprintf( err_str, "ERROR: Shift algorithm: sx=%d,sy=%d,dx=%d,dy=%d,w=%d,h=%d,bpp=%d",
sx,sy,dx,dy,width,height,p->var.bits_per_pixel);
len = strlen(err_str);
for (cnt = 0; cnt < len; cnt++)
err_buf[cnt] = 0x700 | err_str[cnt];
fbcon_mac_putcs(p->conp, p, err_buf, len, 0, 0);
/* pause for the user */
printk( "ERROR: shift algorithm...\n" );
mdelay(5000);
return;
}
}
s = 0;
switch (p->var.bits_per_pixel) {
case 1:
s = w >> 3;
src += lo >> 3;
dest += lo >> 3;
break;
case 2:
s = w >> 2;
src += lo >> 2;
dest += lo >> 2;
break;
case 4:
s = w >> 1;
src += lo >> 1;
dest += lo >> 1;
break;
case 8:
s = w;
src += lo;
dest += lo;
break;
case 16:
s = w << 1;
src += lo << 1;
dest += lo << 1;
break;
case 32:
s = w << 2;
src += lo << 2;
dest += lo << 2;
break;
}
if (sy <= sx) {
i = b;
move_up = 0;
src += height * fontheight(p);
dest += height * fontheight(p);
} else {
i = t;
move_up = 1;
}
while (1) {
for (i = t; i < b; i++) {
j = l;
for (; j & 31 && j < r; j++)
plot_pixel_mac(p, get_pixel_mac(p, j+(dx-sx), i+(dy-sy)), j, i);
if (j < r) {
fb_memmove(dest, src, s);
if (move_up) {
dest += p->next_line;
src += p->next_line;
} else {
dest -= p->next_line;
src -= p->next_line;
}
j += w;
}
for (; j < r; j++)
plot_pixel_mac(p, get_pixel_mac(p, j+(dx-sx), i+(dy-sy)), j, i);
}
if (move_up) {
i++;
if (i >= b)
break;
} else {
i--;
if (i < t)
break;
}
}
}
void fbcon_mac_clear(struct vc_data *conp, struct display *p, int sy, int sx,
int height, int width)
{
int pixel;
int i, j;
int inverse;
u8 *dest;
int l,r,t,b,w,lo,s;
inverse = conp ? attr_reverse(p,conp->vc_attr) : 0;
pixel = inverse ? PIXEL_WHITE_MAC : PIXEL_BLACK_MAC;
dest = (u8 *) (p->fb_info->screen_base + sy * fontheight(p) * p->next_line);
if( sx == 0 && width == p->conp->vc_cols) {
s = height * fontheight(p) * p->next_line;
if (inverse)
fb_memclear(dest, s);
else
fb_memset255(dest, s);
}
l = sx * fontwidth(p);
r = l + width * fontwidth(p);
t = sy * fontheight(p);
b = t + height * fontheight(p);
/* w is the # pixels between two long-aligned points, left and right */
w = (r&~31) - ((l+31)&~31);
/* lo is the # pixels between the left edge and a long-aligned left pixel */
lo = ((l+31)&~31) - l;
s = 0;
switch (p->var.bits_per_pixel) {
case 1:
s = w >> 3;
dest += lo >> 3;
break;
case 2:
s = w >> 2;
dest += lo >> 2;
break;
case 4:
s = w >> 1;
dest += lo >> 1;
break;
case 8:
s = w;
dest += lo;
break;
case 16:
s = w << 1;
dest += lo << 1;
break;
case 32:
s = w << 2;
dest += lo << 2;
break;
}
for (i = t; i < b; i++) {
j = l;
for (; j & 31 && j < r; j++)
plot_pixel_mac(p, pixel, j, i);
if (j < r) {
if (PIXEL_WHITE_MAC == pixel)
fb_memclear(dest, s);
else
fb_memset255(dest, s);
dest += p->next_line;
j += w;
}
for (; j < r; j++)
plot_pixel_mac(p, pixel, j, i);
}
}
void fbcon_mac_putc(struct vc_data *conp, struct display *p, int c, int yy,
int xx)
{
u8 *cdat;
u_int rows, bold, ch_reverse, ch_underline;
u8 d;
int j;
cdat = p->fontdata+(c&p->charmask)*fontheight(p);
bold = attr_bold(p,c);
ch_reverse = attr_reverse(p,c);
ch_underline = attr_underline(p,c);
for (rows = 0; rows < fontheight(p); rows++) {
d = *cdat++;
if (!conp->vc_can_do_color) {
if (ch_underline && rows == (fontheight(p)-2))
d = 0xff;
else if (bold)
d |= d>>1;
if (ch_reverse)
d = ~d;
}
for (j = 0; j < fontwidth(p); j++) {
plot_pixel_mac(p, (d & 0x80) >> 7, (xx*fontwidth(p)) + j, (yy*fontheight(p)) + rows);
d <<= 1;
}
}
}
void fbcon_mac_putcs(struct vc_data *conp, struct display *p,
const unsigned short *s, int count, int yy, int xx)
{
u16 c;
while (count--) {
c = scr_readw(s++);
fbcon_mac_putc(conp, p, c, yy, xx++);
}
}
void fbcon_mac_revc(struct display *p, int xx, int yy)
{
u_int rows, j;
for (rows = 0; rows < fontheight(p); rows++) {
for (j = 0; j < fontwidth(p); j++) {
plot_pixel_mac (p, PIXEL_INVERT_MAC, (xx*fontwidth(p))+j, (yy*fontheight(p))+rows);
}
}
}
static inline void plot_helper(u8 *dest, u8 bit, int bw)
{
switch (bw) {
case PIXEL_BLACK_MAC:
fb_writeb( fb_readb(dest) | bit, dest );
break;
case PIXEL_WHITE_MAC:
fb_writeb( fb_readb(dest) & (~bit), dest );
break;
case PIXEL_INVERT_MAC:
fb_writeb( fb_readb(dest) ^ bit, dest );
break;
default:
printk( "ERROR: Unknown pixel value in plot_pixel_mac\n");
}
}
/*
* plot_pixel_mac
*/
static void plot_pixel_mac(struct display *p, int bw, int pixel_x, int pixel_y)
{
u8 *dest, bit;
u16 *dest16, pix16;
u32 *dest32, pix32;
/* There *are* 68k Macs that support more than 832x624, you know :-) */
if (pixel_x < 0 || pixel_y < 0 || pixel_x >= p->var.xres || pixel_y >= p->var.yres) {
printk ("ERROR: pixel_x == %d, pixel_y == %d", pixel_x, pixel_y);
mdelay(1000);
return;
}
switch (p->var.bits_per_pixel) {
case 1:
dest = (u8 *) ((pixel_x >> 3) + p->fb_info->screen_base + pixel_y * p->next_line);
bit = 0x80 >> (pixel_x & 7);
plot_helper(dest, bit, bw);
break;
case 2:
dest = (u8 *) ((pixel_x >> 2) + p->fb_info->screen_base + pixel_y * p->next_line);
bit = 0xC0 >> ((pixel_x & 3) << 1);
plot_helper(dest, bit, bw);
break;
case 4:
dest = (u8 *) ((pixel_x >> 1) + p->fb_info->screen_base + pixel_y * p->next_line);
bit = 0xF0 >> ((pixel_x & 1) << 2);
plot_helper(dest, bit, bw);
break;
case 8:
dest = (u8 *) (pixel_x + p->fb_info->screen_base + pixel_y * p->next_line);
bit = 0xFF;
plot_helper(dest, bit, bw);
break;
/* FIXME: You can't access framebuffer directly like this! */
case 16:
dest16 = (u16 *) ((pixel_x *2) + p->fb_info->screen_base + pixel_y * p->next_line);
pix16 = 0xFFFF;
switch (bw) {
case PIXEL_BLACK_MAC: *dest16 = ~pix16; break;
case PIXEL_WHITE_MAC: *dest16 = pix16; break;
case PIXEL_INVERT_MAC: *dest16 ^= pix16; break;
default: printk( "ERROR: Unknown pixel value in plot_pixel_mac\n");
}
break;
case 32:
dest32 = (u32 *) ((pixel_x *4) + p->fb_info->screen_base + pixel_y * p->next_line);
pix32 = 0xFFFFFFFF;
switch (bw) {
case PIXEL_BLACK_MAC: *dest32 = ~pix32; break;
case PIXEL_WHITE_MAC: *dest32 = pix32; break;
case PIXEL_INVERT_MAC: *dest32 ^= pix32; break;
default: printk( "ERROR: Unknown pixel value in plot_pixel_mac\n");
}
break;
}
}
static int get_pixel_mac(struct display *p, int pixel_x, int pixel_y)
{
u8 *dest, bit;
u16 *dest16;
u32 *dest32;
u8 pixel=0;
switch (p->var.bits_per_pixel) {
case 1:
dest = (u8 *) ((pixel_x / 8) + p->fb_info->screen_base + pixel_y * p->next_line);
bit = 0x80 >> (pixel_x & 7);
pixel = *dest & bit;
break;
case 2:
dest = (u8 *) ((pixel_x / 4) + p->fb_info->screen_base + pixel_y * p->next_line);
bit = 0xC0 >> (pixel_x & 3);
pixel = *dest & bit;
break;
case 4:
dest = (u8 *) ((pixel_x / 2) + p->fb_info->screen_base + pixel_y * p->next_line);
bit = 0xF0 >> (pixel_x & 1);
pixel = *dest & bit;
break;
case 8:
dest = (u8 *) (pixel_x + p->fb_info->screen_base + pixel_y * p->next_line);
pixel = *dest;
break;
case 16:
dest16 = (u16 *) ((pixel_x *2) + p->fb_info->screen_base + pixel_y * p->next_line);
pixel = *dest16 ? 1 : 0;
break;
case 32:
dest32 = (u32 *) ((pixel_x *4) + p->fb_info->screen_base + pixel_y * p->next_line);
pixel = *dest32 ? 1 : 0;
break;
}
return pixel ? PIXEL_BLACK_MAC : PIXEL_WHITE_MAC;
}
/*
* `switch' for the low level operations
*/
struct display_switch fbcon_mac = {
setup: fbcon_mac_setup,
bmove: fbcon_redraw_bmove,
clear: fbcon_redraw_clear,
putc: fbcon_mac_putc,
putcs: fbcon_mac_putcs,
revc: fbcon_mac_revc,
fontwidthmask: FONTWIDTHRANGE(1,8)
};
#ifdef MODULE
MODULE_LICENSE("GPL");
int init_module(void)
{
return 0;
}
void cleanup_module(void)
{}
#endif /* MODULE */
/*
* Visible symbols for modules
*/
EXPORT_SYMBOL(fbcon_mac);
EXPORT_SYMBOL(fbcon_mac_setup);
EXPORT_SYMBOL(fbcon_mac_bmove);
EXPORT_SYMBOL(fbcon_mac_clear);
EXPORT_SYMBOL(fbcon_mac_putc);
EXPORT_SYMBOL(fbcon_mac_putcs);
EXPORT_SYMBOL(fbcon_mac_revc);
...@@ -33,7 +33,7 @@ static struct fbcon_font_desc *fbcon_fonts[] = { ...@@ -33,7 +33,7 @@ static struct fbcon_font_desc *fbcon_fonts[] = {
&font_vga_8x16, &font_vga_8x16,
#endif #endif
#ifdef CONFIG_FONT_6x11 #ifdef CONFIG_FONT_6x11
#if defined(CONFIG_FBCON_MAC) || defined(CONFIG_FB_SBUS) #if defined(CONFIG_FBCON_ACCEL) || defined(CONFIG_FB_SBUS)
#undef NO_FONTS #undef NO_FONTS
#endif #endif
&font_vga_6x11, &font_vga_6x11,
...@@ -43,7 +43,7 @@ static struct fbcon_font_desc *fbcon_fonts[] = { ...@@ -43,7 +43,7 @@ static struct fbcon_font_desc *fbcon_fonts[] = {
&font_sun_8x16, &font_sun_8x16,
#endif #endif
#ifdef CONFIG_FONT_SUN12x22 #ifdef CONFIG_FONT_SUN12x22
#if defined(CONFIG_FB_SBUS) || defined(CONFIG_FBCON_CFB8) || defined(CONFIG_FBCON_CFB16) || defined(CONFIG_FBCON_CFB24) || defined(CONFIG_FBCON_CFB32) #if defined(CONFIG_FB_SBUS) || defined(CONFIG_FBCON_CFB8) || defined(CONFIG_FBCON_CFB16) || defined(CONFIG_FBCON_CFB24) || defined(CONFIG_FBCON_CFB32) || defined(CONFIG_FBCON_ACCEL)
#undef NO_FONTS #undef NO_FONTS
#endif #endif
&font_sun_12x22, &font_sun_12x22,
......
...@@ -41,15 +41,6 @@ ...@@ -41,15 +41,6 @@
#include <asm/machw.h> #include <asm/machw.h>
#include <video/fbcon.h> #include <video/fbcon.h>
#include <video/fbcon-mfb.h>
#include <video/fbcon-cfb2.h>
#include <video/fbcon-cfb4.h>
#include <video/fbcon-cfb8.h>
#include <video/fbcon-cfb16.h>
#include <video/fbcon-cfb24.h>
#include <video/fbcon-cfb32.h>
#if defined(FBCON_HAS_CFB8) || defined(FBCON_HAS_CFB4) || defined(FBCON_HAS_CFB2)
/* Common DAC base address for the LC, RBV, Valkyrie, and IIvx */ /* Common DAC base address for the LC, RBV, Valkyrie, and IIvx */
#define DAC_BASE 0x50f24000 #define DAC_BASE 0x50f24000
...@@ -151,191 +142,35 @@ struct jet_cmap_regs { ...@@ -151,191 +142,35 @@ struct jet_cmap_regs {
unsigned char lut; unsigned char lut;
}; };
#endif
#define PIXEL_TO_MM(a) (((a)*10)/28) /* width in mm at 72 dpi */ #define PIXEL_TO_MM(a) (((a)*10)/28) /* width in mm at 72 dpi */
static char* video_base;
static int video_size;
static char* video_vbase; /* mapped */
/* mode */ /* mode */
static int video_bpp;
static int video_width;
static int video_height;
static int video_type = FB_TYPE_PACKED_PIXELS;
static int video_visual;
static int video_linelength;
static int video_cmap_len;
static int video_slot = 0; static int video_slot = 0;
static struct fb_var_screeninfo macfb_defined={ static struct fb_var_screeninfo macfb_defined = {
0,0,0,0, /* W,H, W, H (virtual) load xres,xres_virtual*/ bits_per_pixel: 8,
0,0, /* virtual -> visible no offset */ activae: FB_ACTIVATE_NOW,
8, /* depth -> load bits_per_pixel */ width: -1,
0, /* greyscale ? */ height: -1,
{0,0,0}, /* R */ right_margin: 32,
{0,0,0}, /* G */ upper_margin: 16,
{0,0,0}, /* B */ lower_margin: 4,
{0,0,0}, /* transparency */ vsync_len: 4,
0, /* standard pixel format */ vmode: FB_VMODE_NONINTERLACED,
FB_ACTIVATE_NOW, };
-1, -1,
FB_ACCEL_NONE, /* The only way to accelerate a mac is .. */ static struct fb_fix_screeninfo vesafb_fix = {
0L,0L,0L,0L,0L, id: "Macintosh ",
0L,0L,0, /* No sync info */ type: FB_TYPE_PACKED_PIXELS,
FB_VMODE_NONINTERLACED, accel: FB_ACCEL_NONE,
{0,0,0,0,0,0}
}; };
static struct display disp; static struct display disp;
static struct fb_info fb_info; static struct fb_info fb_info;
static struct { u_short blue, green, red, pad; } palette[256]; static u32 pseudo_palette[17];
static union {
#ifdef FBCON_HAS_CFB16
u16 cfb16[16];
#endif
#ifdef FBCON_HAS_CFB24
u32 cfb24[16];
#endif
#ifdef FBCON_HAS_CFB32
u32 cfb32[16];
#endif
} fbcon_cmap;
static int inverse = 0; static int inverse = 0;
static int vidtest = 0; static int vidtest = 0;
static int macfb_update_var(int con, struct fb_info *info)
{
return 0;
}
static int macfb_get_fix(struct fb_fix_screeninfo *fix, int con,
struct fb_info *info)
{
memset(fix, 0, sizeof(struct fb_fix_screeninfo));
strcpy(fix->id, "Mac Generic");
fix->smem_start = video_base;
fix->smem_len = video_size;
fix->type = video_type;
fix->visual = video_visual;
fix->xpanstep = 0;
fix->ypanstep = 0;
fix->line_length=video_linelength;
return 0;
}
static int macfb_get_var(struct fb_var_screeninfo *var, int con,
struct fb_info *info)
{
if(con==-1)
memcpy(var, &macfb_defined, sizeof(struct fb_var_screeninfo));
else
*var=fb_display[con].var;
return 0;
}
static void macfb_set_disp(int con)
{
struct fb_fix_screeninfo fix;
struct display *display;
if (con >= 0)
display = &fb_display[con];
else
display = &disp; /* used during initialization */
macfb_get_fix(&fix, con, &fb_info);
memset(display, 0, sizeof(struct display));
display->visual = fix.visual;
display->type = fix.type;
display->type_aux = fix.type_aux;
display->ypanstep = fix.ypanstep;
display->ywrapstep = fix.ywrapstep;
display->line_length = fix.line_length;
display->next_line = fix.line_length;
display->can_soft_blank = 0;
display->inverse = inverse;
display->scrollmode = SCROLL_YREDRAW;
macfb_get_var(&display->var, -1, &fb_info);
switch (video_bpp) {
#ifdef FBCON_HAS_MFB
case 1:
display->dispsw = &fbcon_mfb;
break;
#endif
#ifdef FBCON_HAS_CFB2
case 2:
display->dispsw = &fbcon_cfb2;
break;
#endif
#ifdef FBCON_HAS_CFB4
case 4:
display->dispsw = &fbcon_cfb4;
break;
#endif
#ifdef FBCON_HAS_CFB8
case 8:
display->dispsw = &fbcon_cfb8;
break;
#endif
#ifdef FBCON_HAS_CFB16
case 15:
case 16:
display->dispsw = &fbcon_cfb16;
display->dispsw_data = fbcon_cmap.cfb16;
break;
#endif
#ifdef FBCON_HAS_CFB24
case 24:
display->dispsw = &fbcon_cfb24;
display->dispsw_data = fbcon_cmap.cfb24;
break;
#endif
#ifdef FBCON_HAS_CFB32
case 32:
display->dispsw = &fbcon_cfb32;
display->dispsw_data = fbcon_cmap.cfb32;
break;
#endif
default:
display->dispsw = &fbcon_dummy;
return;
}
}
static int macfb_set_var(struct fb_var_screeninfo *var, int con,
struct fb_info *info)
{
static int first = 1;
if (var->xres != macfb_defined.xres ||
var->yres != macfb_defined.yres ||
var->xres_virtual != macfb_defined.xres_virtual ||
var->yres_virtual != macfb_defined.yres ||
var->xoffset ||
var->bits_per_pixel != macfb_defined.bits_per_pixel ||
var->nonstd) {
if (first) {
printk("macfb does not support changing the video mode\n");
first = 0;
}
return -EINVAL;
}
if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_TEST)
return 0;
if (var->yoffset)
return -EINVAL;
return 0;
}
#if defined(FBCON_HAS_CFB8) || defined(FBCON_HAS_CFB4) || defined(FBCON_HAS_CFB2)
static int valkyrie_setpalette (unsigned int regno, unsigned int red, static int valkyrie_setpalette (unsigned int regno, unsigned int red,
unsigned int green, unsigned int blue) unsigned int green, unsigned int blue)
{ {
...@@ -425,7 +260,7 @@ static int v8_brazil_setpalette (unsigned int regno, unsigned int red, ...@@ -425,7 +260,7 @@ static int v8_brazil_setpalette (unsigned int regno, unsigned int red,
unsigned char _regno; unsigned char _regno;
unsigned long flags; unsigned long flags;
if (video_bpp>8) return 1; /* failsafe */ if (info->var.bits_per_pixel > 8) return 1; /* failsafe */
save_flags(flags); save_flags(flags);
cli(); cli();
...@@ -438,7 +273,7 @@ static int v8_brazil_setpalette (unsigned int regno, unsigned int red, ...@@ -438,7 +273,7 @@ static int v8_brazil_setpalette (unsigned int regno, unsigned int red,
In 4bpp, the regnos are 0x0f, 0x1f, 0x2f, etc, etc In 4bpp, the regnos are 0x0f, 0x1f, 0x2f, etc, etc
In 2bpp, the regnos are 0x3f, 0x7f, 0xbf, 0xff */ In 2bpp, the regnos are 0x3f, 0x7f, 0xbf, 0xff */
_regno = (regno<<(8-video_bpp)) | (0xFF>>video_bpp); _regno = (regno<<(8 - info->var.bits_per_pixel)) | (0xFF >> info->var.vits_per_pixel);
writeb(_regno, &v8_brazil_cmap_regs->addr); nop(); writeb(_regno, &v8_brazil_cmap_regs->addr); nop();
/* send one color channel at a time */ /* send one color channel at a time */
...@@ -461,7 +296,7 @@ static int rbv_setpalette (unsigned int regno, unsigned int red, ...@@ -461,7 +296,7 @@ static int rbv_setpalette (unsigned int regno, unsigned int red,
unsigned char _regno; unsigned char _regno;
unsigned long flags; unsigned long flags;
if (video_bpp>8) return 1; /* failsafe */ if (info->var.bits_per_pixel > 8) return 1; /* failsafe */
save_flags(flags); save_flags(flags);
cli(); cli();
...@@ -470,7 +305,7 @@ static int rbv_setpalette (unsigned int regno, unsigned int red, ...@@ -470,7 +305,7 @@ static int rbv_setpalette (unsigned int regno, unsigned int red,
* regno #254 and #255 are the important ones for 1-bit color, * regno #254 and #255 are the important ones for 1-bit color,
* regno #252-255 are the important ones for 2-bit color, etc. * regno #252-255 are the important ones for 2-bit color, etc.
*/ */
_regno = regno + (256-(1<<video_bpp)); _regno = regno + (256-(1 << info->var.bits_per_pixel));
/* reset clut? (VideoToolbox sez "not necessary") */ /* reset clut? (VideoToolbox sez "not necessary") */
writeb(0xFF, &rbv_cmap_regs->cntl); nop(); writeb(0xFF, &rbv_cmap_regs->cntl); nop();
...@@ -524,7 +359,7 @@ static int toby_setpalette(unsigned int regno, unsigned int red, ...@@ -524,7 +359,7 @@ static int toby_setpalette(unsigned int regno, unsigned int red,
unsigned char _red =~(red>>8); unsigned char _red =~(red>>8);
unsigned char _green=~(green>>8); unsigned char _green=~(green>>8);
unsigned char _blue =~(blue>>8); unsigned char _blue =~(blue>>8);
unsigned char _regno = (regno<<(8-video_bpp)) | (0xFF>>video_bpp); unsigned char _regno = (regno << (8 - info->var.bits_per_pixel)) | (0xFF >> info->var.bits_per_pixel);
unsigned long flags; unsigned long flags;
save_flags(flags); save_flags(flags);
...@@ -581,7 +416,7 @@ static int civic_setpalette (unsigned int regno, unsigned int red, ...@@ -581,7 +416,7 @@ static int civic_setpalette (unsigned int regno, unsigned int red,
unsigned long flags; unsigned long flags;
int clut_status; int clut_status;
if (video_bpp > 8) return 1; /* failsafe */ if (info->var.bits_per_pixel > 8) return 1; /* failsafe */
red >>= 8; red >>= 8;
green >>= 8; green >>= 8;
...@@ -679,27 +514,6 @@ static int csc_setpalette (unsigned int regno, unsigned int red, ...@@ -679,27 +514,6 @@ static int csc_setpalette (unsigned int regno, unsigned int red,
return 0; return 0;
} }
#endif /* FBCON_HAS_CFB8 || FBCON_HAS_CFB4 || FBCON_HAS_CFB2 */
static int macfb_getcolreg(unsigned regno, unsigned *red, unsigned *green,
unsigned *blue, unsigned *transp,
struct fb_info *fb_info)
{
/*
* Read a single color register and split it into colors/transparent.
* Return != 0 for invalid regno.
*/
if (regno >= video_cmap_len)
return 1;
*red = palette[regno].red;
*green = palette[regno].green;
*blue = palette[regno].blue;
*transp = 0;
return 0;
}
static int macfb_setcolreg(unsigned regno, unsigned red, unsigned green, static int macfb_setcolreg(unsigned regno, unsigned red, unsigned green,
unsigned blue, unsigned transp, unsigned blue, unsigned transp,
struct fb_info *fb_info) struct fb_info *fb_info)
...@@ -711,103 +525,82 @@ static int macfb_setcolreg(unsigned regno, unsigned red, unsigned green, ...@@ -711,103 +525,82 @@ static int macfb_setcolreg(unsigned regno, unsigned red, unsigned green,
* != 0 for invalid regno. * != 0 for invalid regno.
*/ */
if (regno >= video_cmap_len) if (regno >= info->cmap.len)
return 1; return 1;
palette[regno].red = red; switch (info->var.bits_per_pixel) {
palette[regno].green = green;
palette[regno].blue = blue;
switch (video_bpp) {
#ifdef FBCON_HAS_MFB
case 1: case 1:
/* We shouldn't get here */ /* We shouldn't get here */
break; break;
#endif
#ifdef FBCON_HAS_CFB2
case 2: case 2:
if (macfb_setpalette) if (macfb_setpalette)
macfb_setpalette(regno, red, green, blue); macfb_setpalette(regno, red, green, blue);
else else
return 1; return 1;
break; break;
#endif
#ifdef FBCON_HAS_CFB4
case 4: case 4:
if (macfb_setpalette) if (macfb_setpalette)
macfb_setpalette(regno, red, green, blue); macfb_setpalette(regno, red, green, blue);
else else
return 1; return 1;
break; break;
#endif
#ifdef FBCON_HAS_CFB8
case 8: case 8:
if (macfb_setpalette) if (macfb_setpalette)
macfb_setpalette(regno, red, green, blue); macfb_setpalette(regno, red, green, blue);
else else
return 1; return 1;
break; break;
#endif
#ifdef FBCON_HAS_CFB16
case 15:
case 16: case 16:
/* 1:5:5:5 */ if (info->var.red.offset == 10) {
fbcon_cmap.cfb16[regno] = /* 1:5:5:5 */
((red & 0xf800) >> 1) | ((u32*) (info->pseudo_palette))[regno] =
((green & 0xf800) >> 6) | ((red & 0xf800) >> 1) |
((blue & 0xf800) >> 11) | ((green & 0xf800) >> 6) |
((transp != 0) << 15); ((blue & 0xf800) >> 11) |
break; ((transp != 0) << 15);
#endif } else {
/* 0:5:6:5 */
((u32*) (info->pseudo_palette))[regno] =
((red & 0xf800) ) |
((green & 0xfc00) >> 5) |
((blue & 0xf800) >> 11);
}
break;
/* I'm pretty sure that one or the other of these /* I'm pretty sure that one or the other of these
doesn't exist on 68k Macs */ doesn't exist on 68k Macs */
#ifdef FBCON_HAS_CFB24
case 24: case 24:
red >>= 8; red >>= 8;
green >>= 8; green >>= 8;
blue >>= 8; blue >>= 8;
fbcon_cmap.cfb24[regno] = ((u32 *)(info->pseudo_palette))[regno] =
(red << macfb_defined.red.offset) | (red << info->var.red.offset) |
(green << macfb_defined.green.offset) | (green << info->var.green.offset) |
(blue << macfb_defined.blue.offset); (blue << info->var.blue.offset);
break; break;
#endif
#ifdef FBCON_HAS_CFB32
case 32: case 32:
red >>= 8; red >>= 8;
green >>= 8; green >>= 8;
blue >>= 8; blue >>= 8;
fbcon_cmap.cfb32[regno] = ((u32 *)(info->pseudo_palette))[regno] =
(red << macfb_defined.red.offset) | (red << info->var.red.offset) |
(green << macfb_defined.green.offset) | (green << info->var.green.offset) |
(blue << macfb_defined.blue.offset); (blue << info->var.blue.offset);
break; break;
#endif
} }
return 0; return 0;
} }
static int macfb_get_cmap(struct fb_cmap *cmap, int kspc, int con,
struct fb_info *info)
{
if (con == info->currcon) /* current console? */
return fb_get_cmap(cmap, kspc, macfb_getcolreg, info);
else if (fb_display[con].cmap.len) /* non default colormap? */
fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
else
fb_copy_cmap(fb_default_cmap(video_cmap_len),
cmap, kspc ? 0 : 2);
return 0;
}
static struct fb_ops macfb_ops = { static struct fb_ops macfb_ops = {
owner: THIS_MODULE, owner: THIS_MODULE,
fb_get_fix: macfb_get_fix, fb_get_fix: gen_get_fix,
fb_get_var: macfb_get_var, fb_get_var: gen_get_var,
fb_set_var: macfb_set_var, fb_set_var: gen_set_var,
fb_get_cmap: macfb_get_cmap, fb_get_cmap: gen_get_cmap,
fb_set_cmap: gen_set_cmap, fb_set_cmap: gen_set_cmap,
fb_setcolreg: macfb_setcolreg, fb_setcolreg: macfb_setcolreg,
fb_fillrect: cfb_fillrect,
fb_copyarea: cfb_copyarea,
fb_imageblit: cfb_imageblit,
}; };
void __init macfb_setup(char *options, int *ints) void __init macfb_setup(char *options, int *ints)
...@@ -832,88 +625,67 @@ void __init macfb_setup(char *options, int *ints) ...@@ -832,88 +625,67 @@ void __init macfb_setup(char *options, int *ints)
} }
} }
static int macfb_switch(int con, struct fb_info *info)
{
/* Do we have to save the colormap? */
if (fb_display[info->currcon].cmap.len)
fb_get_cmap(&fb_display[info->currcon].cmap, 1, macfb_getcolreg,
info);
info->currcon = con;
/* Install new colormap */
do_install_cmap(con, info);
macfb_update_var(con, info);
return 1;
}
void __init macfb_init(void) void __init macfb_init(void)
{ {
int video_cmap_len, video_is_nubus = 0;
struct nubus_dev* ndev = NULL; struct nubus_dev* ndev = NULL;
int video_is_nubus = 0;
if (!MACH_IS_MAC) if (!MACH_IS_MAC)
return; return;
/* There can only be one internal video controller anyway so /* There can only be one internal video controller anyway so
we're not too worried about this */ we're not too worried about this */
video_width = mac_bi_data.dimensions & 0xFFFF; macfb_defined.xres = mac_bi_data.dimensions & 0xFFFF;
video_height = mac_bi_data.dimensions >> 16; macfb_defined.yres = mac_bi_data.dimensions >> 16;
video_bpp = mac_bi_data.videodepth; macfb_defined.bits_per_pixel = mac_bi_data.videodepth;
video_linelength = mac_bi_data.videorow; macfb_fix.line_length = mac_bi_data.videorow;
video_size = video_linelength * video_height; macfb_fix.smem_len = macfb_fix.line_length * macfb_defined.yres;
/* Note: physical address (since 2.1.127) */ /* Note: physical address (since 2.1.127) */
video_base = (void*) mac_bi_data.videoaddr; macfb_fix.smem_start = (void*) mac_bi_data.videoaddr;
/* This is actually redundant with the initial mappings. /* This is actually redundant with the initial mappings.
However, there are some non-obvious aspects to the way However, there are some non-obvious aspects to the way
those mappings are set up, so this is in fact the safest those mappings are set up, so this is in fact the safest
way to ensure that this driver will work on every possible way to ensure that this driver will work on every possible
Mac */ Mac */
video_vbase = ioremap(mac_bi_data.videoaddr, video_size); fb_info.screen_base = ioremap(mac_bi_data.videoaddr, macfb_fix.smem_len);
printk("macfb: framebuffer at 0x%p, mapped to 0x%p, size %dk\n", printk("macfb: framebuffer at 0x%p, mapped to 0x%p, size %dk\n",
video_base, video_vbase, video_size/1024); macfb_fix.smem_start, fb_info.screen_base, macfb_fix.smem_len/1024);
printk("macfb: mode is %dx%dx%d, linelength=%d\n", printk("macfb: mode is %dx%dx%d, linelength=%d\n",
video_width, video_height, video_bpp, video_linelength); macfb_defined.xres, macfb_defined.yres/, macfb_defined.bits_per_pixel, macfb_fix.line_length);
/* /*
* Fill in the available video resolution * Fill in the available video resolution
*/ */
macfb_defined.xres = video_width; macfb_defined.xres_virtual = macfb_defined.xres;
macfb_defined.yres = video_height; macfb_defined.yres_virtual = macfb_defined.yres;
macfb_defined.xres_virtual = video_width;
macfb_defined.yres_virtual = video_height;
macfb_defined.bits_per_pixel = video_bpp;
macfb_defined.height = PIXEL_TO_MM(macfb_defined.yres); macfb_defined.height = PIXEL_TO_MM(macfb_defined.yres);
macfb_defined.width = PIXEL_TO_MM(macfb_defined.xres); macfb_defined.width = PIXEL_TO_MM(macfb_defined.xres);
printk("macfb: scrolling: redraw\n"); printk("macfb: scrolling: redraw\n");
macfb_defined.yres_virtual = video_height; macfb_defined.yres_virtual = macfb_defined.yres;
/* some dummy values for timing to make fbset happy */ /* some dummy values for timing to make fbset happy */
macfb_defined.pixclock = 10000000 / video_width * 1000 / video_height; macfb_defined.pixclock = 10000000 / macfb_defined.xres * 1000 / macfb_defined.yres;
macfb_defined.left_margin = (video_width / 8) & 0xf8; macfb_defined.left_margin = (macfb_defined.xres / 8) & 0xf8;
macfb_defined.right_margin = 32; macfb_defined.hsync_len = (macfb_defined.xres / 8) & 0xf8;
macfb_defined.upper_margin = 16;
macfb_defined.lower_margin = 4; switch (macfb_defined.bits_per_pixel) {
macfb_defined.hsync_len = (video_width / 8) & 0xf8;
macfb_defined.vsync_len = 4;
switch (video_bpp) {
case 1: case 1:
/* XXX: I think this will catch any program that tries /* XXX: I think this will catch any program that tries
to do FBIO_PUTCMAP when the visual is monochrome */ to do FBIO_PUTCMAP when the visual is monochrome */
video_cmap_len = 0; video_cmap_len = 0;
video_visual = FB_VISUAL_MONO01; macfb_fix.visual = FB_VISUAL_MONO01;
break; break;
case 2: case 2:
case 4: case 4:
case 8: case 8:
macfb_defined.red.length = video_bpp; macfb_defined.red.length = macfb_defined.bits_per_pixel;
macfb_defined.green.length = video_bpp; macfb_defined.green.length = macfb_defined.bits_per_pixel;
macfb_defined.blue.length = video_bpp; macfb_defined.blue.length = macfb_defined.bits_per_pixel;
video_cmap_len = 1 << video_bpp; video_cmap_len = 1 << macfb_defined.bits_per_pixel;
video_visual = FB_VISUAL_PSEUDOCOLOR; macfb_fix.visual = FB_VISUAL_PSEUDOCOLOR;
break; break;
case 16: case 16:
macfb_defined.transp.offset = 15; macfb_defined.transp.offset = 15;
...@@ -929,7 +701,7 @@ void __init macfb_init(void) ...@@ -929,7 +701,7 @@ void __init macfb_init(void)
video_cmap_len = 16; video_cmap_len = 16;
/* Should actually be FB_VISUAL_DIRECTCOLOR, but this /* Should actually be FB_VISUAL_DIRECTCOLOR, but this
works too */ works too */
video_visual = FB_VISUAL_TRUECOLOR; macfb_fix.visual = FB_VISUAL_TRUECOLOR;
break; break;
case 24: case 24:
case 32: case 32:
...@@ -944,11 +716,11 @@ void __init macfb_init(void) ...@@ -944,11 +716,11 @@ void __init macfb_init(void)
printk("macfb: truecolor: " printk("macfb: truecolor: "
"size=0:8:8:8, shift=0:16:8:0\n"); "size=0:8:8:8, shift=0:16:8:0\n");
video_cmap_len = 16; video_cmap_len = 16;
video_visual = FB_VISUAL_TRUECOLOR; macfb_fix.visual = FB_VISUAL_TRUECOLOR;
default: default:
video_cmap_len = 0; video_cmap_len = 0;
video_visual = FB_VISUAL_MONO01; macfb_fix.visual = FB_VISUAL_MONO01;
printk("macfb: unknown or unsupported bit depth: %d\n", video_bpp); printk("macfb: unknown or unsupported bit depth: %d\n", macfb_defined.bits_per_pixel);
break; break;
} }
...@@ -974,22 +746,22 @@ void __init macfb_init(void) ...@@ -974,22 +746,22 @@ void __init macfb_init(void)
switch(ndev->dr_hw) { switch(ndev->dr_hw) {
case NUBUS_DRHW_APPLE_MDC: case NUBUS_DRHW_APPLE_MDC:
strcpy( fb_info.modename, "Macintosh Display Card" ); strcat( macfb_fix.id, "Display Card" );
macfb_setpalette = mdc_setpalette; macfb_setpalette = mdc_setpalette;
macfb_defined.activate = FB_ACTIVATE_NOW; macfb_defined.activate = FB_ACTIVATE_NOW;
break; break;
case NUBUS_DRHW_APPLE_TFB: case NUBUS_DRHW_APPLE_TFB:
strcpy( fb_info.modename, "Toby" ); strcat( macfb_fix.id, "Toby" );
macfb_setpalette = toby_setpalette; macfb_setpalette = toby_setpalette;
macfb_defined.activate = FB_ACTIVATE_NOW; macfb_defined.activate = FB_ACTIVATE_NOW;
break; break;
case NUBUS_DRHW_APPLE_JET: case NUBUS_DRHW_APPLE_JET:
strcpy(fb_info.modename, "Jet"); strcat( macfb_fix.id, "Jet");
macfb_setpalette = jet_setpalette; macfb_setpalette = jet_setpalette;
macfb_defined.activate = FB_ACTIVATE_NOW; macfb_defined.activate = FB_ACTIVATE_NOW;
break; break;
default: default:
strcpy( fb_info.modename, "Generic NuBus" ); strcat( macfb_fix.id, "Generic NuBus" );
break; break;
} }
} }
...@@ -1007,14 +779,14 @@ void __init macfb_init(void) ...@@ -1007,14 +779,14 @@ void __init macfb_init(void)
case MAC_MODEL_IIX: case MAC_MODEL_IIX:
case MAC_MODEL_IICX: case MAC_MODEL_IICX:
case MAC_MODEL_IIFX: case MAC_MODEL_IIFX:
strcpy( fb_info.modename, "Generic NuBus" ); strcat( macfb_fix.id, "Generic NuBus" );
break; break;
/* Valkyrie Quadras */ /* Valkyrie Quadras */
case MAC_MODEL_Q630: case MAC_MODEL_Q630:
/* I'm not sure about this one */ /* I'm not sure about this one */
case MAC_MODEL_P588: case MAC_MODEL_P588:
strcpy( fb_info.modename, "Valkyrie built-in" ); strcat( macfb_fix.id, "Valkyrie built-in" );
macfb_setpalette = valkyrie_setpalette; macfb_setpalette = valkyrie_setpalette;
macfb_defined.activate = FB_ACTIVATE_NOW; macfb_defined.activate = FB_ACTIVATE_NOW;
valkyrie_cmap_regs = ioremap(DAC_BASE, 0x1000); valkyrie_cmap_regs = ioremap(DAC_BASE, 0x1000);
...@@ -1037,7 +809,7 @@ void __init macfb_init(void) ...@@ -1037,7 +809,7 @@ void __init macfb_init(void)
case MAC_MODEL_Q700: case MAC_MODEL_Q700:
case MAC_MODEL_Q900: case MAC_MODEL_Q900:
case MAC_MODEL_Q950: case MAC_MODEL_Q950:
strcpy( fb_info.modename, "DAFB built-in" ); strcat( macfb_fix.id, "DAFB built-in" );
macfb_setpalette = dafb_setpalette; macfb_setpalette = dafb_setpalette;
macfb_defined.activate = FB_ACTIVATE_NOW; macfb_defined.activate = FB_ACTIVATE_NOW;
dafb_cmap_regs = ioremap(DAFB_BASE, 0x1000); dafb_cmap_regs = ioremap(DAFB_BASE, 0x1000);
...@@ -1045,7 +817,7 @@ void __init macfb_init(void) ...@@ -1045,7 +817,7 @@ void __init macfb_init(void)
/* LC II uses the V8 framebuffer */ /* LC II uses the V8 framebuffer */
case MAC_MODEL_LCII: case MAC_MODEL_LCII:
strcpy( fb_info.modename, "V8 built-in" ); strcat( macfb_fix.id, "V8 built-in" );
macfb_setpalette = v8_brazil_setpalette; macfb_setpalette = v8_brazil_setpalette;
macfb_defined.activate = FB_ACTIVATE_NOW; macfb_defined.activate = FB_ACTIVATE_NOW;
v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000); v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000);
...@@ -1057,7 +829,7 @@ void __init macfb_init(void) ...@@ -1057,7 +829,7 @@ void __init macfb_init(void)
case MAC_MODEL_IIVI: case MAC_MODEL_IIVI:
case MAC_MODEL_IIVX: case MAC_MODEL_IIVX:
case MAC_MODEL_P600: case MAC_MODEL_P600:
strcpy( fb_info.modename, "Brazil built-in" ); strcat( macfb_fix.id, "Brazil built-in" );
macfb_setpalette = v8_brazil_setpalette; macfb_setpalette = v8_brazil_setpalette;
macfb_defined.activate = FB_ACTIVATE_NOW; macfb_defined.activate = FB_ACTIVATE_NOW;
v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000); v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000);
...@@ -1074,7 +846,7 @@ void __init macfb_init(void) ...@@ -1074,7 +846,7 @@ void __init macfb_init(void)
case MAC_MODEL_P460: case MAC_MODEL_P460:
macfb_setpalette = v8_brazil_setpalette; macfb_setpalette = v8_brazil_setpalette;
macfb_defined.activate = FB_ACTIVATE_NOW; macfb_defined.activate = FB_ACTIVATE_NOW;
strcpy( fb_info.modename, "Sonora built-in" ); strcat( macfb_fix.id, "Sonora built-in" );
v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000); v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000);
break; break;
...@@ -1085,7 +857,7 @@ void __init macfb_init(void) ...@@ -1085,7 +857,7 @@ void __init macfb_init(void)
case MAC_MODEL_IISI: case MAC_MODEL_IISI:
macfb_setpalette = rbv_setpalette; macfb_setpalette = rbv_setpalette;
macfb_defined.activate = FB_ACTIVATE_NOW; macfb_defined.activate = FB_ACTIVATE_NOW;
strcpy( fb_info.modename, "RBV built-in" ); strcat( macfb_fix.id, "RBV built-in" );
rbv_cmap_regs = ioremap(DAC_BASE, 0x1000); rbv_cmap_regs = ioremap(DAC_BASE, 0x1000);
break; break;
...@@ -1094,7 +866,7 @@ void __init macfb_init(void) ...@@ -1094,7 +866,7 @@ void __init macfb_init(void)
case MAC_MODEL_C660: case MAC_MODEL_C660:
macfb_setpalette = civic_setpalette; macfb_setpalette = civic_setpalette;
macfb_defined.activate = FB_ACTIVATE_NOW; macfb_defined.activate = FB_ACTIVATE_NOW;
strcpy( fb_info.modename, "Civic built-in" ); strcat( macfb_fix.id, "Civic built-in" );
civic_cmap_regs = ioremap(CIVIC_BASE, 0x1000); civic_cmap_regs = ioremap(CIVIC_BASE, 0x1000);
break; break;
...@@ -1115,7 +887,7 @@ void __init macfb_init(void) ...@@ -1115,7 +887,7 @@ void __init macfb_init(void)
v8_brazil_cmap_regs = v8_brazil_cmap_regs =
ioremap(DAC_BASE, 0x1000); ioremap(DAC_BASE, 0x1000);
} }
strcpy( fb_info.modename, "LC built-in" ); strcat( macfb_fix.id, "LC built-in" );
break; break;
/* We think this may be like the LC II */ /* We think this may be like the LC II */
case MAC_MODEL_CCL: case MAC_MODEL_CCL:
...@@ -1125,18 +897,18 @@ void __init macfb_init(void) ...@@ -1125,18 +897,18 @@ void __init macfb_init(void)
v8_brazil_cmap_regs = v8_brazil_cmap_regs =
ioremap(DAC_BASE, 0x1000); ioremap(DAC_BASE, 0x1000);
} }
strcpy( fb_info.modename, "Color Classic built-in" ); strcat( macfb_fix.id, "Color Classic built-in" );
break; break;
/* And we *do* mean "weirdos" */ /* And we *do* mean "weirdos" */
case MAC_MODEL_TV: case MAC_MODEL_TV:
strcpy( fb_info.modename, "Mac TV built-in" ); strcat( macfb_fix.id, "Mac TV built-in" );
break; break;
/* These don't have colour, so no need to worry */ /* These don't have colour, so no need to worry */
case MAC_MODEL_SE30: case MAC_MODEL_SE30:
case MAC_MODEL_CLII: case MAC_MODEL_CLII:
strcpy( fb_info.modename, "Monochrome built-in" ); strcat( macfb_fix.id, "Monochrome built-in" );
break; break;
/* Powerbooks are particularly difficult. Many of /* Powerbooks are particularly difficult. Many of
...@@ -1149,7 +921,7 @@ void __init macfb_init(void) ...@@ -1149,7 +921,7 @@ void __init macfb_init(void)
case MAC_MODEL_PB140: case MAC_MODEL_PB140:
case MAC_MODEL_PB145: case MAC_MODEL_PB145:
case MAC_MODEL_PB170: case MAC_MODEL_PB170:
strcpy( fb_info.modename, "DDC built-in" ); strcat( macfb_fix.id, "DDC built-in" );
break; break;
/* Internal is GSC, External (if present) is ViSC */ /* Internal is GSC, External (if present) is ViSC */
...@@ -1159,13 +931,13 @@ void __init macfb_init(void) ...@@ -1159,13 +931,13 @@ void __init macfb_init(void)
case MAC_MODEL_PB180: case MAC_MODEL_PB180:
case MAC_MODEL_PB210: case MAC_MODEL_PB210:
case MAC_MODEL_PB230: case MAC_MODEL_PB230:
strcpy( fb_info.modename, "GSC built-in" ); strcat( macfb_fix.id, "GSC built-in" );
break; break;
/* Internal is TIM, External is ViSC */ /* Internal is TIM, External is ViSC */
case MAC_MODEL_PB165C: case MAC_MODEL_PB165C:
case MAC_MODEL_PB180C: case MAC_MODEL_PB180C:
strcpy( fb_info.modename, "TIM built-in" ); strcat( macfb_fix.id, "TIM built-in" );
break; break;
/* Internal is CSC, External is Keystone+Ariel. */ /* Internal is CSC, External is Keystone+Ariel. */
...@@ -1177,31 +949,36 @@ void __init macfb_init(void) ...@@ -1177,31 +949,36 @@ void __init macfb_init(void)
case MAC_MODEL_PB280C: case MAC_MODEL_PB280C:
macfb_setpalette = csc_setpalette; macfb_setpalette = csc_setpalette;
macfb_defined.activate = FB_ACTIVATE_NOW; macfb_defined.activate = FB_ACTIVATE_NOW;
strcpy( fb_info.modename, "CSC built-in" ); strcat( macfb_fix.id, "CSC built-in" );
csc_cmap_regs = ioremap(CSC_BASE, 0x1000); csc_cmap_regs = ioremap(CSC_BASE, 0x1000);
break; break;
default: default:
strcpy( fb_info.modename, "Unknown/Unsupported built-in" ); strcat( macfb_fix.id, "Unknown/Unsupported built-in" );
break; break;
} }
fb_info.changevar = NULL; strcpy(fb_info.modename, macfb_fix.id);
fb_info.node = NODEV; fb_info.changevar = NULL;
fb_info.fbops = &macfb_ops; fb_info.node = NODEV;
fb_info.screen_base = video_vbase; fb_info.fbops = &macfb_ops;
fb_info.disp = &disp; fb_info.var = macfb_defined;
fb_info.switch_con = &macfb_switch; fb_info.fix = macfb_fix;
fb_info.updatevar = &macfb_update_var; fb_info.currcon = -1;
fb_info.flags = FBINFO_FLAG_DEFAULT; fb_info.disp = &disp;
macfb_set_disp(-1); fb_info.switch_con = gen_switch;
do_install_cmap(0, &fb_info); fb_info.updatevar = gen_update_var;
fb_info.pseudo_palatte = pseudo_palette;
fb_info.flags = FBINFO_FLAG_DEFAULT;
fb_alloc_cmap(&fb_info.cmap, video_cmap_len, 0);
gen_set_disp(-1, info);
if (register_framebuffer(&fb_info) < 0) if (register_framebuffer(&fb_info) < 0)
return; return;
printk("fb%d: %s frame buffer device\n", printk("fb%d: %s frame buffer device\n",
GET_FB_IDX(fb_info.node), fb_info.modename); GET_FB_IDX(fb_info.node), fb_info.fix.id);
} }
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -36,6 +36,10 @@ static struct fb_var_screeninfo vesafb_defined = { ...@@ -36,6 +36,10 @@ static struct fb_var_screeninfo vesafb_defined = {
activate: FB_ACTIVATE_NOW, activate: FB_ACTIVATE_NOW,
height: -1, height: -1,
width: -1, width: -1,
right_margin: 32,
upper_margin: 16,
lower_margin: 4,
vsync_len: 4,
vmode: FB_VMODE_NONINTERLACED, vmode: FB_VMODE_NONINTERLACED,
}; };
...@@ -301,11 +305,7 @@ int __init vesafb_init(void) ...@@ -301,11 +305,7 @@ int __init vesafb_init(void)
/* some dummy values for timing to make fbset happy */ /* some dummy values for timing to make fbset happy */
vesafb_defined.pixclock = 10000000 / vesafb_defined.xres * 1000 / vesafb_defined.yres; vesafb_defined.pixclock = 10000000 / vesafb_defined.xres * 1000 / vesafb_defined.yres;
vesafb_defined.left_margin = (vesafb_defined.xres / 8) & 0xf8; vesafb_defined.left_margin = (vesafb_defined.xres / 8) & 0xf8;
vesafb_defined.right_margin = 32;
vesafb_defined.upper_margin = 16;
vesafb_defined.lower_margin = 4;
vesafb_defined.hsync_len = (vesafb_defined.xres / 8) & 0xf8; vesafb_defined.hsync_len = (vesafb_defined.xres / 8) & 0xf8;
vesafb_defined.vsync_len = 4;
if (vesafb_defined.bits_per_pixel > 8) { if (vesafb_defined.bits_per_pixel > 8) {
vesafb_defined.red.offset = screen_info.red_pos; vesafb_defined.red.offset = screen_info.red_pos;
......
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