diff options
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/Kconfig | 46 | ||||
-rw-r--r-- | drivers/video/Makefile | 4 | ||||
-rw-r--r-- | drivers/video/cyberfb.c | 2295 | ||||
-rw-r--r-- | drivers/video/cyberfb.h | 415 | ||||
-rw-r--r-- | drivers/video/retz3fb.c | 1588 | ||||
-rw-r--r-- | drivers/video/retz3fb.h | 286 | ||||
-rw-r--r-- | drivers/video/sun3fb.c | 702 | ||||
-rw-r--r-- | drivers/video/virgefb.c | 2526 | ||||
-rw-r--r-- | drivers/video/virgefb.h | 288 |
9 files changed, 3 insertions, 8147 deletions
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 3ab06317264..3546484fa50 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -354,42 +354,6 @@ config FB_AMIGA_AGA and CD32. If you intend to run Linux on any of these systems, say Y; otherwise say N. -config FB_CYBER - tristate "Amiga CyberVision 64 support" - depends on FB && ZORRO && BROKEN - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT - help - This enables support for the Cybervision 64 graphics card from - Phase5. Please note that its use is not all that intuitive (i.e. if - you have any questions, be sure to ask!). Say N unless you have a - Cybervision 64 or plan to get one before you next recompile the - kernel. Please note that this driver DOES NOT support the - Cybervision 64/3D card, as they use incompatible video chips. - -config FB_VIRGE - bool "Amiga CyberVision 64/3D support " - depends on (FB = y) && ZORRO && BROKEN - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT - help - This enables support for the Cybervision 64/3D graphics card from - Phase5. Please note that its use is not all that intuitive (i.e. if - you have any questions, be sure to ask!). Say N unless you have a - Cybervision 64/3D or plan to get one before you next recompile the - kernel. Please note that this driver DOES NOT support the older - Cybervision 64 card, as they use incompatible video chips. - -config FB_RETINAZ3 - tristate "Amiga Retina Z3 support" - depends on (FB = y) && ZORRO && BROKEN - help - This enables support for the Retina Z3 graphics card. Say N unless - you have a Retina Z3 or plan to get one before you next recompile - the kernel. - config FB_FM2 bool "Amiga FrameMaster II/Rainbow II support" depends on (FB = y) && ZORRO @@ -625,10 +589,6 @@ config FB_GBE_MEM This is the amount of memory reserved for the framebuffer, which can be any value between 1MB and 8MB. -config FB_SUN3 - bool "Sun3 framebuffer support" - depends on (FB = y) && (SUN3 || SUN3X) && BROKEN - config FB_SBUS bool "SBUS and UPA framebuffers" depends on (FB = y) && SPARC @@ -637,7 +597,7 @@ config FB_SBUS config FB_BW2 bool "BWtwo support" - depends on (FB = y) && (SPARC && FB_SBUS || (SUN3 || SUN3X) && FB_SUN3) + depends on (FB = y) && (SPARC && FB_SBUS) select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT @@ -646,7 +606,7 @@ config FB_BW2 config FB_CG3 bool "CGthree support" - depends on (FB = y) && (SPARC && FB_SBUS || (SUN3 || SUN3X) && FB_SUN3) + depends on (FB = y) && (SPARC && FB_SBUS) select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT @@ -655,7 +615,7 @@ config FB_CG3 config FB_CG6 bool "CGsix (GX,TurboGX) support" - depends on (FB = y) && (SPARC && FB_SBUS || (SUN3 || SUN3X) && FB_SUN3) + depends on (FB = y) && (SPARC && FB_SBUS) select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT help diff --git a/drivers/video/Makefile b/drivers/video/Makefile index d4e2b152160..363b630abfb 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -22,11 +22,9 @@ obj-$(CONFIG_FB_MACMODES) += macmodes.o obj-$(CONFIG_FB_DDC) += fb_ddc.o # Hardware specific drivers go first -obj-$(CONFIG_FB_RETINAZ3) += retz3fb.o obj-$(CONFIG_FB_AMIGA) += amifb.o c2p.o obj-$(CONFIG_FB_ARC) += arcfb.o obj-$(CONFIG_FB_CLPS711X) += clps711xfb.o -obj-$(CONFIG_FB_CYBER) += cyberfb.o obj-$(CONFIG_FB_CYBER2000) += cyber2000fb.o obj-$(CONFIG_FB_PM2) += pm2fb.o obj-$(CONFIG_FB_PM3) += pm3fb.o @@ -44,7 +42,6 @@ obj-$(CONFIG_FB_GEODE) += geode/ obj-$(CONFIG_FB_MBX) += mbx/ obj-$(CONFIG_FB_I810) += vgastate.o obj-$(CONFIG_FB_NEOMAGIC) += neofb.o vgastate.o -obj-$(CONFIG_FB_VIRGE) += virgefb.o obj-$(CONFIG_FB_3DFX) += tdfxfb.o obj-$(CONFIG_FB_CONTROL) += controlfb.o obj-$(CONFIG_FB_PLATINUM) += platinumfb.o @@ -77,7 +74,6 @@ obj-$(CONFIG_FB_TGA) += tgafb.o obj-$(CONFIG_FB_HP300) += hpfb.o obj-$(CONFIG_FB_G364) += g364fb.o obj-$(CONFIG_FB_SA1100) += sa1100fb.o -obj-$(CONFIG_FB_SUN3) += sun3fb.o obj-$(CONFIG_FB_HIT) += hitfb.o obj-$(CONFIG_FB_EPSON1355) += epson1355fb.o obj-$(CONFIG_FB_PVR2) += pvr2fb.o diff --git a/drivers/video/cyberfb.c b/drivers/video/cyberfb.c deleted file mode 100644 index 0b8d5b12115..00000000000 --- a/drivers/video/cyberfb.c +++ /dev/null @@ -1,2295 +0,0 @@ -/* -* linux/drivers/video/cyberfb.c -- CyberVision64 frame buffer device -* $Id: cyberfb.c,v 1.6 1998/09/11 04:54:58 abair Exp $ -* -* Copyright (C) 1998 Alan Bair -* -* This file is based on two CyberVision64 frame buffer device drivers -* -* The second CyberVision64 frame buffer device (cvision.c cvision_core.c): -* -* Copyright (c) 1997 Antonio Santos -* -* Released as a patch to 2.1.35, but never included in the source tree. -* This is based on work from the NetBSD CyberVision64 frame buffer driver -* and support files (grf_cv.c, grf_cvreg.h, ite_cv.c): -* Permission to use the source of this driver was obtained from the -* author Michael Teske by Alan Bair. -* -* Copyright (c) 1995 Michael Teske -* -* The first CyberVision64 frame buffer device (cyberfb.c): -* -* Copyright (C) 1996 Martin Apel -* Geert Uytterhoeven -* -* Which is based on the Amiga frame buffer device (amifb.c): -* -* Copyright (C) 1995 Geert Uytterhoeven -* -* -* History: -* - 22 Dec 95: Original version by Martin Apel -* - 05 Jan 96: Geert: integration into the current source tree -* - 01 Aug 98: Alan: Merge in code from cvision.c and cvision_core.c -* $Log: cyberfb.c,v $ -* Revision 1.6 1998/09/11 04:54:58 abair -* Update for 2.1.120 change in include file location. -* Clean up for public release. -* -* Revision 1.5 1998/09/03 04:27:13 abair -* Move cv64_load_video_mode to cyber_set_video so a new video mode is install -* with each change of the 'var' data. -* -* Revision 1.4 1998/09/01 00:31:17 abair -* Put in a set of default 8,16,24 bpp modes and map cyber8,16 to them. -* Update operations with 'par' to handle a more complete set of parameter -* values for encode/decode process. -* -* Revision 1.3 1998/08/31 21:31:33 abair -* Swap 800x490 for 640x480 video mode and more cleanup. -* Abandon idea to resurrect "custom" mode setting via kernel opts, -* instead work on making use of fbset program to do this. -* -* Revision 1.2 1998/08/31 06:17:08 abair -* Make updates for changes in cyberfb.c released in 2.1.119 -* and do some cleanup of the code. -* -* Revision 1.1 1998/08/29 18:38:31 abair -* Initial revision -* -* Revision 1.3 1998/08/17 06:21:53 abair -* Remove more redundant code after merging in cvision_core.c -* Set blanking by colormap to pale red to detect this vs trying to -* use video blanking. More formating to Linux code style. -* -* Revision 1.2 1998/08/15 17:51:37 abair -* Added cvision_core.c code from 2.1.35 patches. -* Changed to compile correctly and switch to using initialization -* code. Added debugging and dropping of duplicate code. -* -* -* -* 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 more details. -*/ - - -#include <linux/module.h> -#include <linux/kernel.h> -#include <linux/errno.h> -#include <linux/string.h> -#include <linux/mm.h> -#include <linux/slab.h> -#include <linux/delay.h> -#include <linux/zorro.h> -#include <linux/fb.h> -#include <linux/init.h> -#include <asm/uaccess.h> -#include <asm/system.h> -#include <asm/irq.h> -#include <asm/pgtable.h> -#include <asm/amigahw.h> -#include <asm/io.h> - -#include "cyberfb.h" -#include <video/fbcon.h> -#include <video/fbcon-cfb8.h> -#include <video/fbcon-cfb16.h> - -/*#define CYBERFBDEBUG*/ -#ifdef CYBERFBDEBUG -#define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args) -static void cv64_dump(void); -#else -#define DPRINTK(fmt, args...) -#endif - -#define wb_64(regs,reg,dat) (*(((volatile unsigned char *)regs) + reg) = dat) -#define rb_64(regs, reg) (*(((volatile unsigned char *)regs) + reg)) - -struct cyberfb_par { - struct fb_var_screeninfo var; - __u32 type; - __u32 type_aux; - __u32 visual; - __u32 line_length; -}; - -static struct cyberfb_par current_par; - -static int current_par_valid = 0; - -static struct display disp; -static struct fb_info fb_info; - - -/* - * Frame Buffer Name - */ - -static char cyberfb_name[16] = "Cybervision"; - - -/* - * CyberVision Graphics Board - */ - -static unsigned char Cyber_colour_table [256][3]; -static unsigned long CyberSize; -static volatile unsigned char *CyberBase; -static volatile unsigned char *CyberMem; -static volatile unsigned char *CyberRegs; -static unsigned long CyberMem_phys; -static unsigned long CyberRegs_phys; - -/* - * Predefined Video Modes - */ - -static struct { - const char *name; - struct fb_var_screeninfo var; -} cyberfb_predefined[] __initdata = { - { "640x480-8", { /* Default 8 BPP mode (cyber8) */ - 640, 480, 640, 480, 0, 0, 8, 0, - {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0}, - 0, 0, -1, -1, FB_ACCELF_TEXT, 39722, 40, 24, 32, 11, 96, 2, - FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, - FB_VMODE_NONINTERLACED - }}, - { "640x480-16", { /* Default 16 BPP mode (cyber16) */ - 640, 480, 640, 480, 0, 0, 16, 0, - {11, 5, 0}, {5, 6, 0}, {0, 5, 0}, {0, 0, 0}, - 0, 0, -1, -1, FB_ACCELF_TEXT, 39722, 40, 24, 32, 11, 96, 2, - FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, - FB_VMODE_NONINTERLACED - }}, - { "640x480-24", { /* Default 24 BPP mode */ - 640, 480, 640, 480, 0, 0, 24, 0, - {16, 8, 0}, {8, 8, 0}, {0, 8, 0}, {0, 0, 0}, - 0, 0, -1, -1, FB_ACCELF_TEXT, 39722, 40, 24, 32, 11, 96, 2, - FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, - FB_VMODE_NONINTERLACED - }}, - { "800x490-8", { /* Cybervision 8 bpp */ - /* NO Acceleration */ - 800, 490, 800, 490, 0, 0, 8, 0, - {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0}, - 0, 0, -1, -1, FB_ACCEL_NONE, 33333, 80, 24, 23, 1, 56, 8, - FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, - FB_VMODE_NONINTERLACED - }}, -/* I can't test these with my monitor, but I suspect they will - * be OK, since Antonio Santos indicated he had tested them in - * his system. - */ - { "800x600-8", { /* Cybervision 8 bpp */ - 800, 600, 800, 600, 0, 0, 8, 0, - {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0}, - 0, 0, -1, -1, FB_ACCELF_TEXT, 27778, 64, 24, 22, 1, 72, 2, - FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, - FB_VMODE_NONINTERLACED - }}, - { "1024x768-8", { /* Cybervision 8 bpp */ - 1024, 768, 1024, 768, 0, 0, 8, 0, - {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0}, - 0, 0, -1, -1, FB_ACCELF_TEXT, 16667, 224, 72, 60, 12, 168, 4, - FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, - FB_VMODE_NONINTERLACED - }}, - { "1152x886-8", { /* Cybervision 8 bpp */ - 1152, 886, 1152, 886, 0, 0, 8, 0, - {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0}, - 0, 0, -1, -1, FB_ACCELF_TEXT, 15873, 184, 40, 24, 1, 56, 16, - FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, - FB_VMODE_NONINTERLACED - }}, - { "1280x1024-8", { /* Cybervision 8 bpp */ - 1280, 1024, 1280, 1024, 0, 0, 8, 0, - {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0}, - 0, 0, -1, -1, FB_ACCELF_TEXT, 16667, 256, 48, 50, 12, 72, 4, - FB_SYNC_COMP_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, - FB_VMODE_INTERLACED - }} -}; - -#define NUM_TOTAL_MODES ARRAY_SIZE(cyberfb_predefined) - -static int Cyberfb_inverse = 0; - -/* - * Some default modes - */ - -#define CYBER8_DEFMODE (0) -#define CYBER16_DEFMODE (1) - -static struct fb_var_screeninfo cyberfb_default; -static int cyberfb_usermode __initdata = 0; - -/* - * Interface used by the world - */ - -int cyberfb_setup(char *options); - -static int cyberfb_get_fix(struct fb_fix_screeninfo *fix, int con, - struct fb_info *info); -static int cyberfb_get_var(struct fb_var_screeninfo *var, int con, - struct fb_info *info); -static int cyberfb_set_var(struct fb_var_screeninfo *var, int con, - struct fb_info *info); -static int cyberfb_get_cmap(struct fb_cmap *cmap, int kspc, int con, - struct fb_info *info); -static int cyberfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, - u_int transp, struct fb_info *info); -static int cyberfb_blank(int blank, struct fb_info *info); - -/* - * Interface to the low level console driver - */ - -int cyberfb_init(void); -static int Cyberfb_switch(int con, struct fb_info *info); -static int Cyberfb_updatevar(int con, struct fb_info *info); - -/* - * Text console acceleration - */ - -#ifdef FBCON_HAS_CFB8 -static struct display_switch fbcon_cyber8; -#endif - -/* - * Accelerated Functions used by the low level console driver - */ - -static void Cyber_WaitQueue(u_short fifo); -static void Cyber_WaitBlit(void); -static void Cyber_BitBLT(u_short curx, u_short cury, u_short destx, - u_short desty, u_short width, u_short height, - u_short mode); -static void Cyber_RectFill(u_short x, u_short y, u_short width, u_short height, - u_short mode, u_short color); -#if 0 -static void Cyber_MoveCursor(u_short x, u_short y); -#endif - -/* - * Hardware Specific Routines - */ - -static int Cyber_init(void); -static int Cyber_encode_fix(struct fb_fix_screeninfo *fix, - struct cyberfb_par *par); -static int Cyber_decode_var(struct fb_var_screeninfo *var, - struct cyberfb_par *par); -static int Cyber_encode_var(struct fb_var_screeninfo *var, - struct cyberfb_par *par); -static int Cyber_getcolreg(u_int regno, u_int *red, u_int *green, u_int *blue, - u_int *transp, struct fb_info *info); - -/* - * Internal routines - */ - -static void cyberfb_get_par(struct cyberfb_par *par); -static void cyberfb_set_par(struct cyberfb_par *par); -static int do_fb_set_var(struct fb_var_screeninfo *var, int isactive); -static void cyberfb_set_disp(int con, struct fb_info *info); -static int get_video_mode(const char *name); - -/* For cvision_core.c */ -static unsigned short cv64_compute_clock(unsigned long); -static int cv_has_4mb (volatile unsigned char *); -static void cv64_board_init (void); -static void cv64_load_video_mode (struct fb_var_screeninfo *); - - -/* -------------------- Hardware specific routines ------------------------- */ - - -/* - * Initialization - * - * Set the default video mode for this chipset. If a video mode was - * specified on the command line, it will override the default mode. - */ - -static int Cyber_init(void) -{ - volatile unsigned char *regs = CyberRegs; - volatile unsigned long *CursorBase; - int i; - DPRINTK("ENTER\n"); - -/* Init local cmap as greyscale levels */ - for (i = 0; i < 256; i++) { - Cyber_colour_table [i][0] = i; - Cyber_colour_table [i][1] = i; - Cyber_colour_table [i][2] = i; - } - -/* Initialize the board and determine fbmem size */ - cv64_board_init(); -#ifdef CYBERFBDEBUG - DPRINTK("Register state after initing board\n"); - cv64_dump(); -#endif -/* Clear framebuffer memory */ - DPRINTK("Clear framebuffer memory\n"); - memset ((char *)CyberMem, 0, CyberSize); - -/* Disable hardware cursor */ - DPRINTK("Disable HW cursor\n"); - wb_64(regs, S3_CRTC_ADR, S3_REG_LOCK2); - wb_64(regs, S3_CRTC_DATA, 0xa0); - wb_64(regs, S3_CRTC_ADR, S3_HGC_MODE); - wb_64(regs, S3_CRTC_DATA, 0x00); - wb_64(regs, S3_CRTC_ADR, S3_HWGC_DX); - wb_64(regs, S3_CRTC_DATA, 0x00); - wb_64(regs, S3_CRTC_ADR, S3_HWGC_DY); - wb_64(regs, S3_CRTC_DATA, 0x00); - -/* Initialize hardware cursor */ - DPRINTK("Init HW cursor\n"); - CursorBase = (u_long *)((char *)(CyberMem) + CyberSize - 0x400); - for (i=0; i < 8; i++) - { - *(CursorBase +(i*4)) = 0xffffff00; - *(CursorBase+1+(i*4)) = 0xffff0000; - *(CursorBase+2+(i*4)) = 0xffff0000; - *(CursorBase+3+(i*4)) = 0xffff0000; - } - for (i=8; i < 64; i++) - { - *(CursorBase +(i*4)) = 0xffff0000; - *(CursorBase+1+(i*4)) = 0xffff0000; - *(CursorBase+2+(i*4)) = 0xffff0000; - *(CursorBase+3+(i*4)) = 0xffff0000; - } - - cyberfb_setcolreg (255, 56<<8, 100<<8, 160<<8, 0, NULL /* unused */); - cyberfb_setcolreg (254, 0, 0, 0, 0, NULL /* unused */); - - DPRINTK("EXIT\n"); - return 0; -} - - -/* - * This function should fill in the `fix' structure based on the - * values in the `par' structure. - */ - -static int Cyber_encode_fix(struct fb_fix_screeninfo *fix, - struct cyberfb_par *par) -{ - DPRINTK("ENTER\n"); - memset(fix, 0, sizeof(struct fb_fix_screeninfo)); - strcpy(fix->id, cyberfb_name); - fix->smem_start = CyberMem_phys; - fix->smem_len = CyberSize; - fix->mmio_start = CyberRegs_phys; - fix->mmio_len = 0x10000; - - fix->type = FB_TYPE_PACKED_PIXELS; - fix->type_aux = 0; - if (par->var.bits_per_pixel == 15 || par->var.bits_per_pixel == 16 || - par->var.bits_per_pixel == 24 || par->var.bits_per_pixel == 32) { - fix->visual = FB_VISUAL_DIRECTCOLOR; - } else { - fix->visual = FB_VISUAL_PSEUDOCOLOR; - } - - fix->xpanstep = 0; - fix->ypanstep = 0; - fix->ywrapstep = 0; - fix->line_length = 0; - fix->accel = FB_ACCEL_S3_TRIO64; - - DPRINTK("EXIT\n"); - return(0); -} - - -/* -* Fill the `par' structure based on the values in `var'. -* TODO: Verify and adjust values, return -EINVAL if bad. -*/ - -static int Cyber_decode_var(struct fb_var_screeninfo *var, - struct cyberfb_par *par) -{ - DPRINTK("ENTER\n"); - par->var.xres = var->xres; - par->var.yres = var->yres; - par->var.xres_virtual = var->xres_virtual; - par->var.yres_virtual = var->yres_virtual; - par->var.xoffset = var->xoffset; - par->var.yoffset = var->yoffset; - par->var.bits_per_pixel = var->bits_per_pixel; - par->var.grayscale = var->grayscale; - par->var.red = var->red; - par->var.green = var->green; - par->var.blue = var->blue; - par->var.transp = var->transp; - par->var.nonstd = var->nonstd; - par->var.activate = var->activate; - par->var.height = var->height; - par->var.width = var->width; - if (var->accel_flags & FB_ACCELF_TEXT) { - par->var.accel_flags = FB_ACCELF_TEXT; - } else { - par->var.accel_flags = 0; - } - par->var.pixclock = var->pixclock; - par->var.left_margin = var->left_margin; - par->var.right_margin = var->right_margin; - par->var.upper_margin = var->upper_margin; - par->var.lower_margin = var->lower_margin; - par->var.hsync_len = var->hsync_len; - par->var.vsync_len = var->vsync_len; - par->var.sync = var->sync; - par->var.vmode = var->vmode; - DPRINTK("EXIT\n"); - return(0); -} - -/* -* Fill the `var' structure based on the values in `par' and maybe -* other values read out of the hardware. -*/ - -static int Cyber_encode_var(struct fb_var_screeninfo *var, - struct cyberfb_par *par) -{ - DPRINTK("ENTER\n"); - var->xres = par->var.xres; - var->yres = par->var.yres; - var->xres_virtual = par->var.xres_virtual; - var->yres_virtual = par->var.yres_virtual; - var->xoffset = par->var.xoffset; - var->yoffset = par->var.yoffset; - - var->bits_per_pixel = par->var.bits_per_pixel; - var->grayscale = par->var.grayscale; - - var->red = par->var.red; - var->green = par->var.green; - var->blue = par->var.blue; - var->transp = par->var.transp; - - var->nonstd = par->var.nonstd; - var->activate = par->var.activate; - - var->height = par->var.height; - var->width = par->var.width; - - var->accel_flags = par->var.accel_flags; - - var->pixclock = par->var.pixclock; - var->left_margin = par->var.left_margin; - var->right_margin = par->var.right_margin; - var->upper_margin = par->var.upper_margin; - var->lower_margin = par->var.lower_margin; - var->hsync_len = par->var.hsync_len; - var->vsync_len = par->var.vsync_len; - var->sync = par->var.sync; - var->vmode = par->var.vmode; - - DPRINTK("EXIT\n"); - return(0); -} - - -/* - * Set a single color register. Return != 0 for invalid regno. - */ - -static int cyberfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, - u_int transp, struct fb_info *info) -{ - volatile unsigned char *regs = CyberRegs; - - /*DPRINTK("ENTER\n");*/ - if (regno > 255) { - DPRINTK("EXIT - Register # > 255\n"); - return (1); - } - - wb_64(regs, 0x3c8, (unsigned char) regno); - - red >>= 10; - green >>= 10; - blue >>= 10; - - Cyber_colour_table [regno][0] = red; - Cyber_colour_table [regno][1] = green; - Cyber_colour_table [regno][2] = blue; - - wb_64(regs, 0x3c9, red); - wb_64(regs, 0x3c9, green); - wb_64(regs, 0x3c9, blue); - - /*DPRINTK("EXIT\n");*/ - return (0); -} - - -/* -* Read a single color register and split it into -* colors/transparent. Return != 0 for invalid regno. -*/ - -static int Cyber_getcolreg(u_int regno, u_int *red, u_int *green, u_int *blue, - u_int *transp, struct fb_info *info) -{ - int t; - - /*DPRINTK("ENTER\n");*/ - if (regno > 255) { - DPRINTK("EXIT - Register # > 255\n"); - return (1); - } - /* ARB This shifting & oring seems VERY strange */ - t = Cyber_colour_table [regno][0]; - *red = (t<<10) | (t<<4) | (t>>2); - t = Cyber_colour_table [regno][1]; - *green = (t<<10) | (t<<4) | (t>>2); - t = Cyber_colour_table [regno][2]; - *blue = (t<<10) | (t<<4) | (t>>2); - *transp = 0; - /*DPRINTK("EXIT\n");*/ - return (0); -} - - -/* -* (Un)Blank the screen -* blank: 1 = zero fb cmap -* 0 = restore fb cmap from local cmap -*/ -static int cyberfb_blank(int blank, struct fb_info *info) -{ - volatile unsigned char *regs = CyberRegs; - int i; - - DPRINTK("ENTER\n"); -#if 0 -/* Blank by turning gfx off */ - gfx_on_off (1, regs); -#else - if (blank) { - for (i = 0; i < 256; i++) { - wb_64(regs, 0x3c8, (unsigned char) i); - /* ARB Pale red to detect this blanking method */ - wb_64(regs, 0x3c9, 48); - wb_64(regs, 0x3c9, 0); - wb_64(regs, 0x3c9, 0); - } - } else { - for (i = 0; i < 256; i++) { - wb_64(regs, 0x3c8, (unsigned char) i); - wb_64(regs, 0x3c9, Cyber_colour_table[i][0]); - wb_64(regs, 0x3c9, Cyber_colour_table[i][1]); - wb_64(regs, 0x3c9, Cyber_colour_table[i][2]); - } - } -#endif - DPRINTK("EXIT\n"); - return 0; -} - - -/************************************************************** - * We are waiting for "fifo" FIFO-slots empty - */ -static void Cyber_WaitQueue (u_short fifo) -{ - unsigned short status; - - DPRINTK("ENTER\n"); - do { - status = *((u_short volatile *)(CyberRegs + S3_GP_STAT)); - } while (status & fifo); - DPRINTK("EXIT\n"); -} - -/************************************************************** - * We are waiting for Hardware (Graphics Engine) not busy - */ -static void Cyber_WaitBlit (void) -{ - unsigned short status; - - DPRINTK("ENTER\n"); - do { - status = *((u_short volatile *)(CyberRegs + S3_GP_STAT)); - } while (status & S3_HDW_BUSY); - DPRINTK("EXIT\n"); -} - -/************************************************************** - * BitBLT - Through the Plane - */ -static void Cyber_BitBLT (u_short curx, u_short cury, u_short destx, - u_short desty, u_short width, u_short height, - u_short mode) -{ - volatile unsigned char *regs = CyberRegs; - u_short blitcmd = S3_BITBLT; - - DPRINTK("ENTER\n"); - /* Set drawing direction */ - /* -Y, X maj, -X (default) */ - if (curx > destx) { - blitcmd |= 0x0020; /* Drawing direction +X */ - } else { - curx += (width - 1); - destx += (width - 1); - } - - if (cury > desty) { - blitcmd |= 0x0080; /* Drawing direction +Y */ - } else { - cury += (height - 1); - desty += (height - 1); - } - - Cyber_WaitQueue (0x8000); - - *((u_short volatile *)(regs + S3_PIXEL_CNTL)) = 0xa000; - *((u_short volatile *)(regs + S3_FRGD_MIX)) = (0x0060 | mode); - - *((u_short volatile *)(regs + S3_CUR_X)) = curx; - *((u_short volatile *)(regs + S3_CUR_Y)) = cury; - - *((u_short volatile *)(regs + S3_DESTX_DIASTP)) = destx; - *((u_short volatile *)(regs + S3_DESTY_AXSTP)) = desty; - - *((u_short volatile *)(regs + S3_MIN_AXIS_PCNT)) = height - 1; - *((u_short volatile *)(regs + S3_MAJ_AXIS_PCNT)) = width - 1; - - *((u_short volatile *)(regs + S3_CMD)) = blitcmd; - DPRINTK("EXIT\n"); -} - -/************************************************************** - * Rectangle Fill Solid - */ -static void Cyber_RectFill (u_short x, u_short y, u_short width, - u_short height, u_short mode, u_short color) -{ - volatile unsigned char *regs = CyberRegs; - u_short blitcmd = S3_FILLEDRECT; - - DPRINTK("ENTER\n"); - Cyber_WaitQueue (0x8000); - - *((u_short volatile *)(regs + S3_PIXEL_CNTL)) = 0xa000; - *((u_short volatile *)(regs + S3_FRGD_MIX)) = (0x0020 | mode); - - *((u_short volatile *)(regs + S3_MULT_MISC)) = 0xe000; - *((u_short volatile *)(regs + S3_FRGD_COLOR)) = color; - - *((u_short volatile *)(regs + S3_CUR_X)) = x; - *((u_short volatile *)(regs + S3_CUR_Y)) = y; - - *((u_short volatile *)(regs + S3_MIN_AXIS_PCNT)) = height - 1; - *((u_short volatile *)(regs + S3_MAJ_AXIS_PCNT)) = width - 1; - - *((u_short volatile *)(regs + S3_CMD)) = blitcmd; - DPRINTK("EXIT\n"); -} - - -#if 0 -/************************************************************** - * Move cursor to x, y - */ -static void Cyber_MoveCursor (u_short x, u_short y) -{ - volatile unsigned char *regs = CyberRegs; - DPRINTK("ENTER\n"); - *(regs + S3_CRTC_ADR) = 0x39; - *(regs + S3_CRTC_DATA) = 0xa0; - - *(regs + S3_CRTC_ADR) = S3_HWGC_ORGX_H; - *(regs + S3_CRTC_DATA) = (char)((x & 0x0700) >> 8); - *(regs + S3_CRTC_ADR) = S3_HWGC_ORGX_L; - *(regs + S3_CRTC_DATA) = (char)(x & 0x00ff); - - *(regs + S3_CRTC_ADR) = S3_HWGC_ORGY_H; - *(regs + S3_CRTC_DATA) = (char)((y & 0x0700) >> 8); - *(regs + S3_CRTC_ADR) = S3_HWGC_ORGY_L; - *(regs + S3_CRTC_DATA) = (char)(y & 0x00ff); - DPRINTK("EXIT\n"); -} -#endif - - -/* -------------------- Generic routines ---------------------------------- */ - - -/* - * Fill the hardware's `par' structure. - */ - -static void cyberfb_get_par(struct cyberfb_par *par) -{ - DPRINTK("ENTER\n"); - if (current_par_valid) { - *par = current_par; - } else { - Cyber_decode_var(&cyberfb_default, par); - } - DPRINTK("EXIT\n"); -} - - -static void cyberfb_set_par(struct cyberfb_par *par) -{ - DPRINTK("ENTER\n"); - current_par = *par; - current_par_valid = 1; - DPRINTK("EXIT\n"); -} - - -static void cyber_set_video(struct fb_var_screeninfo *var) -{ - - /* Load the video mode defined by the 'var' data */ - cv64_load_video_mode (var); -#ifdef CYBERFBDEBUG - DPRINTK("Register state after loading video mode\n"); - cv64_dump(); -#endif -} - - -static int do_fb_set_var(struct fb_var_screeninfo *var, int isactive) -{ - int err, activate; - struct cyberfb_par par; - - DPRINTK("ENTER\n"); - if ((err = Cyber_decode_var(var, &par))) { - DPRINTK("EXIT - decode_var failed\n"); - return(err); - } - activate = var->activate; - if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW && isactive) - cyberfb_set_par(&par); - Cyber_encode_var(var, &par); - var->activate = activate; - - cyber_set_video(var); - DPRINTK("EXIT\n"); - return 0; -} - -/* - * Get the Fixed Part of the Display - */ - -static int cyberfb_get_fix(struct fb_fix_screeninfo *fix, int con, - struct fb_info *info) -{ - struct cyberfb_par par; - int error = 0; - - DPRINTK("ENTER\n"); - if (con == -1) { - cyberfb_get_par(&par); - } else { - error = Cyber_decode_var(&fb_display[con].var, &par); - } - DPRINTK("EXIT\n"); - return(error ? error : Cyber_encode_fix(fix, &par)); -} - - -/* - * Get the User Defined Part of the Display - */ - -static int cyberfb_get_var(struct fb_var_screeninfo *var, int con, - struct fb_info *info) -{ - struct cyberfb_par par; - int error = 0; - - DPRINTK("ENTER\n"); - if (con == -1) { - cyberfb_get_par(&par); - error = Cyber_encode_var(var, &par); - disp.var = *var; /* ++Andre: don't know if this is the right place */ - } else { - *var = fb_display[con].var; - } - - DPRINTK("EXIT\n"); - return(error); -} - - -static void cyberfb_set_disp(int con, struct fb_info *info) -{ - struct fb_fix_screeninfo fix; - struct display *display; - - DPRINTK("ENTER\n"); - if (con >= 0) - display = &fb_display[con]; - else - display = &disp; /* used during initialization */ - - cyberfb_get_fix(&fix, con, info); - if (con == -1) - con = 0; - display->visual = fix.visual; - display->type = fix.type; - display->type_aux = fix.type_aux; - display->ypanstep = fix.ypanstep; - display->ywrapstep = fix.ywrapstep; - display->can_soft_blank = 1; - display->inverse = Cyberfb_inverse; - switch (display->var.bits_per_pixel) { -#ifdef FBCON_HAS_CFB8 - case 8: - if (display->var.accel_flags & FB_ACCELF_TEXT) { - display->dispsw = &fbcon_cyber8; -#warning FIXME: We should reinit the graphics engine here - } else - display->dispsw = &fbcon_cfb8; - break; -#endif -#ifdef FBCON_HAS_CFB16 - case 16: - display->dispsw = &fbcon_cfb16; - break; -#endif - default: - display->dispsw = NULL; - break; - } - DPRINTK("EXIT\n"); -} - - -/* - * Set the User Defined Part of the Display - */ - -static int cyberfb_set_var(struct fb_var_screeninfo *var, int con, - struct fb_info *info) -{ - int err, oldxres, oldyres, oldvxres, oldvyres, oldbpp, oldaccel; - - DPRINTK("ENTER\n"); - if ((err = do_fb_set_var(var, con == info->currcon))) { - DPRINTK("EXIT - do_fb_set_var failed\n"); - return(err); - } - if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) { - oldxres = fb_display[con].var.xres; - oldyres = fb_display[con].var.yres; - oldvxres = fb_display[con].var.xres_virtual; - oldvyres = fb_display[con].var.yres_virtual; - oldbpp = fb_display[con].var.bits_per_pixel; - oldaccel = fb_display[con].var.accel_flags; - fb_display[con].var = *var; - if (oldxres != var->xres || oldyres != var->yres || - oldvxres != var->xres_virtual || - oldvyres != var->yres_virtual || - oldbpp != var->bits_per_pixel || - oldaccel != var->accel_flags) { - cyberfb_set_disp(con, info); - (*fb_info.changevar)(con); - fb_alloc_cmap(&fb_display[con].cmap, 0, 0); - do_install_cmap(con, info); - } - } - var->activate = 0; - DPRINTK("EXIT\n"); - return(0); -} - - -/* - * Get the Colormap - */ - -static int cyberfb_get_cmap(struct fb_cmap *cmap, int kspc, int con, - struct fb_info *info) -{ - DPRINTK("ENTER\n"); - if (con == info->currcon) { /* current console? */ - DPRINTK("EXIT - console is current console\n"); - return(fb_get_cmap(cmap, kspc, Cyber_getcolreg, info)); - } else if (fb_display[con].cmap.len) { /* non default colormap? */ - DPRINTK("Use console cmap\n"); - fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2); - } else { - DPRINTK("Use default cmap\n"); - fb_copy_cmap(fb_default_cmap(1<<fb_display[con].var.bits_per_pixel), - cmap, kspc ? 0 : 2); - } - DPRINTK("EXIT\n"); - return(0); -} - -static struct fb_ops cyberfb_ops = { - .owner = THIS_MODULE, - .fb_get_fix = cyberfb_get_fix, - .fb_get_var = cyberfb_get_var, - .fb_set_var = cyberfb_set_var, - .fb_get_cmap = cyberfb_get_cmap, - .fb_set_cmap = gen_set_cmap, - .fb_setcolreg = cyberfb_setcolreg, - .fb_blank = cyberfb_blank, -}; - -int __init cyberfb_setup(char *options) -{ - char *this_opt; - DPRINTK("ENTER\n"); - - fb_info.fontname[0] = '\0'; - - if (!options || !*options) { - DPRINTK("EXIT - no options\n"); - return 0; - } - - while ((this_opt = strsep(&options, ",")) != NULL) { - if (!*this_opt) - continue; - if (!strcmp(this_opt, "inverse")) { - Cyberfb_inverse = 1; - fb_invert_cmaps(); - } else if (!strncmp(this_opt, "font:", 5)) { - strcpy(fb_info.fontname, this_opt+5); - } else if (!strcmp (this_opt, "cyber8")) { - cyberfb_default = cyberfb_predefined[CYBER8_DEFMODE].var; - cyberfb_usermode = 1; |