summaryrefslogtreecommitdiff
path: root/drivers/staging/xgifb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/xgifb')
-rw-r--r--drivers/staging/xgifb/Makefile2
-rw-r--r--drivers/staging/xgifb/XGI_accel.c289
-rw-r--r--drivers/staging/xgifb/XGI_accel.h500
-rw-r--r--drivers/staging/xgifb/XGI_main.h126
-rw-r--r--drivers/staging/xgifb/XGI_main_26.c1014
-rw-r--r--drivers/staging/xgifb/XGIfb.h96
-rw-r--r--drivers/staging/xgifb/vb_ext.c782
-rw-r--r--drivers/staging/xgifb/vb_ext.h6
-rw-r--r--drivers/staging/xgifb/vb_init.c2561
-rw-r--r--drivers/staging/xgifb/vb_setmode.c6072
-rw-r--r--drivers/staging/xgifb/vb_setmode.h4
-rw-r--r--drivers/staging/xgifb/vb_table.h23
-rw-r--r--drivers/staging/xgifb/vb_util.c124
-rw-r--r--drivers/staging/xgifb/vb_util.h16
-rw-r--r--drivers/staging/xgifb/vgatypes.h47
15 files changed, 3808 insertions, 7854 deletions
diff --git a/drivers/staging/xgifb/Makefile b/drivers/staging/xgifb/Makefile
index f2ca6b1f4cc6..3c8c7de9eadd 100644
--- a/drivers/staging/xgifb/Makefile
+++ b/drivers/staging/xgifb/Makefile
@@ -1,4 +1,4 @@
obj-$(CONFIG_FB_XGI) += xgifb.o
-xgifb-y := XGI_main_26.o XGI_accel.o vb_init.o vb_setmode.o vb_util.o vb_ext.o
+xgifb-y := XGI_main_26.o vb_init.o vb_setmode.o vb_util.o vb_ext.o
diff --git a/drivers/staging/xgifb/XGI_accel.c b/drivers/staging/xgifb/XGI_accel.c
deleted file mode 100644
index 79549742cff1..000000000000
--- a/drivers/staging/xgifb/XGI_accel.c
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * XGI 300/630/730/540/315/550/650/740 frame buffer driver
- * for Linux kernels 2.4.x and 2.5.x
- *
- * 2D acceleration part
- *
- * Based on the X driver's XGI300_accel.c which is
- * Copyright Xavier Ducoin <x.ducoin@lectra.com>
- * Copyright 2002 by Thomas Winischhofer, Vienna, Austria
- * and XGI310_accel.c which is
- * Copyright 2002 by Thomas Winischhofer, Vienna, Austria
- *
- * Author: Thomas Winischhofer <thomas@winischhofer.net>
- * (see http://www.winischhofer.net/
- * for more information and updates)
- */
-
-//#include <linux/config.h>
-#include <linux/version.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/string.h>
-#include <linux/mm.h>
-#include <linux/tty.h>
-#include <linux/slab.h>
-#include <linux/delay.h>
-#include <linux/fb.h>
-#include <linux/console.h>
-#include <linux/selection.h>
-#include <linux/ioport.h>
-#include <linux/init.h>
-#include <linux/pci.h>
-#include <linux/vt_kern.h>
-#include <linux/capability.h>
-#include <linux/fs.h>
-#include <linux/agp_backend.h>
-
-#include <linux/types.h>
-#include <asm/io.h>
-
-#ifdef CONFIG_MTRR
-#include <asm/mtrr.h>
-#endif
-
-#include "vgatypes.h"
-#include "vb_struct.h"
-#include "XGIfb.h"
-#include "XGI_accel.h"
-
-static const int XGIALUConv[] =
-{
- 0x00, /* dest = 0; 0, GXclear, 0 */
- 0x88, /* dest &= src; DSa, GXand, 0x1 */
- 0x44, /* dest = src & ~dest; SDna, GXandReverse, 0x2 */
- 0xCC, /* dest = src; S, GXcopy, 0x3 */
- 0x22, /* dest &= ~src; DSna, GXandInverted, 0x4 */
- 0xAA, /* dest = dest; D, GXnoop, 0x5 */
- 0x66, /* dest = ^src; DSx, GXxor, 0x6 */
- 0xEE, /* dest |= src; DSo, GXor, 0x7 */
- 0x11, /* dest = ~src & ~dest; DSon, GXnor, 0x8 */
- 0x99, /* dest ^= ~src ; DSxn, GXequiv, 0x9 */
- 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */
- 0xDD, /* dest = src|~dest ; SDno, GXorReverse, 0xB */
- 0x33, /* dest = ~src; Sn, GXcopyInverted, 0xC */
- 0xBB, /* dest |= ~src; DSno, GXorInverted, 0xD */
- 0x77, /* dest = ~src|~dest; DSan, GXnand, 0xE */
- 0xFF, /* dest = 0xFF; 1, GXset, 0xF */
-};
-/* same ROP but with Pattern as Source */
-static const int XGIPatALUConv[] =
-{
- 0x00, /* dest = 0; 0, GXclear, 0 */
- 0xA0, /* dest &= src; DPa, GXand, 0x1 */
- 0x50, /* dest = src & ~dest; PDna, GXandReverse, 0x2 */
- 0xF0, /* dest = src; P, GXcopy, 0x3 */
- 0x0A, /* dest &= ~src; DPna, GXandInverted, 0x4 */
- 0xAA, /* dest = dest; D, GXnoop, 0x5 */
- 0x5A, /* dest = ^src; DPx, GXxor, 0x6 */
- 0xFA, /* dest |= src; DPo, GXor, 0x7 */
- 0x05, /* dest = ~src & ~dest; DPon, GXnor, 0x8 */
- 0xA5, /* dest ^= ~src ; DPxn, GXequiv, 0x9 */
- 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */
- 0xF5, /* dest = src|~dest ; PDno, GXorReverse, 0xB */
- 0x0F, /* dest = ~src; Pn, GXcopyInverted, 0xC */
- 0xAF, /* dest |= ~src; DPno, GXorInverted, 0xD */
- 0x5F, /* dest = ~src|~dest; DPan, GXnand, 0xE */
- 0xFF, /* dest = 0xFF; 1, GXset, 0xF */
-};
-
-static const unsigned char myrops[] = {
- 3, 10, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
- };
-
-/* 300 series */
-static void
-XGI310Sync(void)
-{
- XGI310Idle
-}
-
-/* 310/325 series ------------------------------------------------ */
-
-static void
-XGI310SetupForScreenToScreenCopy(int xdir, int ydir, int rop,
- unsigned int planemask, int trans_color)
-{
- XGI310SetupDSTColorDepth(xgi_video_info.DstColor);
- XGI310SetupSRCPitch(xgi_video_info.video_linelength)
- XGI310SetupDSTRect(xgi_video_info.video_linelength, 0xFFF)
- if (trans_color != -1) {
- XGI310SetupROP(0x0A)
- XGI310SetupSRCTrans(trans_color)
- XGI310SetupCMDFlag(TRANSPARENT_BITBLT)
- } else {
- XGI310SetupROP(XGIALUConv[rop])
- /* Set command - not needed, both 0 */
- /* XGISetupCMDFlag(BITBLT | SRCVIDEO) */
- }
- XGI310SetupCMDFlag(xgi_video_info.XGI310_AccelDepth)
- /* TW: The 310/325 series is smart enough to know the direction */
-}
-
-static void
-XGI310SubsequentScreenToScreenCopy(int src_x, int src_y, int dst_x, int dst_y,
- int width, int height)
-{
- long srcbase, dstbase;
- int mymin, mymax;
-
- srcbase = dstbase = 0;
- mymin = min(src_y, dst_y);
- mymax = max(src_y, dst_y);
-
- /* Although the chip knows the direction to use
- * if the source and destination areas overlap,
- * that logic fails if we fiddle with the bitmap
- * addresses. Therefore, we check if the source
- * and destination blitting areas overlap and
- * adapt the bitmap addresses synchronously
- * if the coordinates exceed the valid range.
- * The the areas do not overlap, we do our
- * normal check.
- */
- if((mymax - mymin) < height) {
- if((src_y >= 2048) || (dst_y >= 2048)) {
- srcbase = xgi_video_info.video_linelength * mymin;
- dstbase = xgi_video_info.video_linelength * mymin;
- src_y -= mymin;
- dst_y -= mymin;
- }
- } else {
- if(src_y >= 2048) {
- srcbase = xgi_video_info.video_linelength * src_y;
- src_y = 0;
- }
- if(dst_y >= 2048) {
- dstbase = xgi_video_info.video_linelength * dst_y;
- dst_y = 0;
- }
- }
-
- XGI310SetupSRCBase(srcbase);
- XGI310SetupDSTBase(dstbase);
- XGI310SetupRect(width, height)
- XGI310SetupSRCXY(src_x, src_y)
- XGI310SetupDSTXY(dst_x, dst_y)
- XGI310DoCMD
-}
-
-static void
-XGI310SetupForSolidFill(int color, int rop, unsigned int planemask)
-{
- XGI310SetupPATFG(color)
- XGI310SetupDSTRect(xgi_video_info.video_linelength, 0xFFF)
- XGI310SetupDSTColorDepth(xgi_video_info.DstColor);
- XGI310SetupROP(XGIPatALUConv[rop])
- XGI310SetupCMDFlag(PATFG | xgi_video_info.XGI310_AccelDepth)
-}
-
-static void
-XGI310SubsequentSolidFillRect(int x, int y, int w, int h)
-{
- long dstbase;
-
- dstbase = 0;
- if(y >= 2048) {
- dstbase = xgi_video_info.video_linelength * y;
- y = 0;
- }
- XGI310SetupDSTBase(dstbase)
- XGI310SetupDSTXY(x,y)
- XGI310SetupRect(w,h)
- XGI310SetupCMDFlag(BITBLT)
- XGI310DoCMD
-}
-
-/* --------------------------------------------------------------------- */
-
-/* The exported routines */
-
-int XGIfb_initaccel(void)
-{
-#ifdef XGIFB_USE_SPINLOCKS
- spin_lock_init(&xgi_video_info.lockaccel);
-#endif
- return(0);
-}
-
-void XGIfb_syncaccel(void)
-{
-
- XGI310Sync();
-
-}
-
-int fbcon_XGI_sync(struct fb_info *info)
-{
- if(!XGIfb_accel) return 0;
- CRITFLAGS
-
- XGI310Sync();
-
- CRITEND
- return 0;
-}
-
-void fbcon_XGI_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
-{
- int col=0;
- CRITFLAGS
-
-
- if(!rect->width || !rect->height)
- return;
-
- if(!XGIfb_accel) {
- cfb_fillrect(info, rect);
- return;
- }
-
- switch(info->var.bits_per_pixel) {
- case 8: col = rect->color;
- break;
- case 16: col = ((u32 *)(info->pseudo_palette))[rect->color];
- break;
- case 32: col = ((u32 *)(info->pseudo_palette))[rect->color];
- break;
- }
-
-
- CRITBEGIN
- XGI310SetupForSolidFill(col, myrops[rect->rop], 0);
- XGI310SubsequentSolidFillRect(rect->dx, rect->dy, rect->width, rect->height);
- CRITEND
- XGI310Sync();
-
-
-}
-
-void fbcon_XGI_copyarea(struct fb_info *info, const struct fb_copyarea *area)
-{
- int xdir, ydir;
- CRITFLAGS
-
-
- if(!XGIfb_accel) {
- cfb_copyarea(info, area);
- return;
- }
-
- if(!area->width || !area->height)
- return;
-
- if(area->sx < area->dx) xdir = 0;
- else xdir = 1;
- if(area->sy < area->dy) ydir = 0;
- else ydir = 1;
-
- CRITBEGIN
- XGI310SetupForScreenToScreenCopy(xdir, ydir, 3, 0, -1);
- XGI310SubsequentScreenToScreenCopy(area->sx, area->sy, area->dx, area->dy, area->width, area->height);
- CRITEND
- XGI310Sync();
-
-}
-
-
-
diff --git a/drivers/staging/xgifb/XGI_accel.h b/drivers/staging/xgifb/XGI_accel.h
deleted file mode 100644
index 5a0395bef2f2..000000000000
--- a/drivers/staging/xgifb/XGI_accel.h
+++ /dev/null
@@ -1,500 +0,0 @@
-/*
- * XGI 300/630/730/540/315/550/650/740 frame buffer driver
- * for Linux kernels 2.4.x and 2.5.x
- *
- * 2D acceleration part
- *
- * Based on the X driver's XGI300_accel.h which is
- * Copyright Xavier Ducoin <x.ducoin@lectra.com>
- * Copyright 2002 by Thomas Winischhofer, Vienna, Austria
- * and XGI310_accel.h which is
- * Copyright 2002 by Thomas Winischhofer, Vienna, Austria
- *
- * Author: Thomas Winischhofer <thomas@winischhofer.net>:
- * (see http://www.winischhofer.net/
- * for more information and updates)
- */
-
-#ifndef _XGIFB_ACCEL_H
-#define _XGIFB_ACCEL_H
-
-/* Guard accelerator accesses with spin_lock_irqsave? Works well without. */
-#undef XGIFB_USE_SPINLOCKS
-
-#ifdef XGIFB_USE_SPINLOCKS
-#include <linux/spinlock.h>
-#define CRITBEGIN spin_lock_irqsave(&xgi_video_info.lockaccel), critflags);
-#define CRITEND spin_unlock_irqrestore(&xgi_video_info.lockaccel), critflags);
-#define CRITFLAGS unsigned long critflags;
-#else
-#define CRITBEGIN
-#define CRITEND
-#define CRITFLAGS
-#endif
-
-/* Definitions for the XGI engine communication. */
-
-#define PATREGSIZE 384 /* Pattern register size. 384 bytes @ 0x8300 */
-#define BR(x) (0x8200 | (x) << 2)
-#define PBR(x) (0x8300 | (x) << 2)
-
-/* XGI300 engine commands */
-#define BITBLT 0x00000000 /* Blit */
-#define COLOREXP 0x00000001 /* Color expand */
-#define ENCOLOREXP 0x00000002 /* Enhanced color expand */
-#define MULTIPLE_SCANLINE 0x00000003 /* ? */
-#define LINE 0x00000004 /* Draw line */
-#define TRAPAZOID_FILL 0x00000005 /* Fill trapezoid */
-#define TRANSPARENT_BITBLT 0x00000006 /* Transparent Blit */
-
-/* Additional engine commands for 310/325 */
-#define ALPHA_BLEND 0x00000007 /* Alpha blend ? */
-#define A3D_FUNCTION 0x00000008 /* 3D command ? */
-#define CLEAR_Z_BUFFER 0x00000009 /* ? */
-#define GRADIENT_FILL 0x0000000A /* Gradient fill */
-#define STRETCH_BITBLT 0x0000000B /* Stretched Blit */
-
-/* source select */
-#define SRCVIDEO 0x00000000 /* source is video RAM */
-#define SRCSYSTEM 0x00000010 /* source is system memory */
-#define SRCCPUBLITBUF SRCSYSTEM /* source is CPU-driven BitBuffer (for color expand) */
-#define SRCAGP 0x00000020 /* source is AGP memory (?) */
-
-/* Pattern flags */
-#define PATFG 0x00000000 /* foreground color */
-#define PATPATREG 0x00000040 /* pattern in pattern buffer (0x8300) */
-#define PATMONO 0x00000080 /* mono pattern */
-
-/* blitting direction (300 series only) */
-#define X_INC 0x00010000
-#define X_DEC 0x00000000
-#define Y_INC 0x00020000
-#define Y_DEC 0x00000000
-
-/* Clipping flags */
-#define NOCLIP 0x00000000
-#define NOMERGECLIP 0x04000000
-#define CLIPENABLE 0x00040000
-#define CLIPWITHOUTMERGE 0x04040000
-
-/* Transparency */
-#define OPAQUE 0x00000000
-#define TRANSPARENT 0x00100000
-
-/* ? */
-#define DSTAGP 0x02000000
-#define DSTVIDEO 0x02000000
-
-/* Line */
-#define LINE_STYLE 0x00800000
-#define NO_RESET_COUNTER 0x00400000
-#define NO_LAST_PIXEL 0x00200000
-
-/* Subfunctions for Color/Enhanced Color Expansion (310/325 only) */
-#define COLOR_TO_MONO 0x00100000
-#define AA_TEXT 0x00200000
-
-/* Some general registers for 310/325 series */
-#define SRC_ADDR 0x8200
-#define SRC_PITCH 0x8204
-#define AGP_BASE 0x8206 /* color-depth dependent value */
-#define SRC_Y 0x8208
-#define SRC_X 0x820A
-#define DST_Y 0x820C
-#define DST_X 0x820E
-#define DST_ADDR 0x8210
-#define DST_PITCH 0x8214
-#define DST_HEIGHT 0x8216
-#define RECT_WIDTH 0x8218
-#define RECT_HEIGHT 0x821A
-#define PAT_FGCOLOR 0x821C
-#define PAT_BGCOLOR 0x8220
-#define SRC_FGCOLOR 0x8224
-#define SRC_BGCOLOR 0x8228
-#define MONO_MASK 0x822C
-#define LEFT_CLIP 0x8234
-#define TOP_CLIP 0x8236
-#define RIGHT_CLIP 0x8238
-#define BOTTOM_CLIP 0x823A
-#define COMMAND_READY 0x823C
-#define FIRE_TRIGGER 0x8240
-
-#define PATTERN_REG 0x8300 /* 384 bytes pattern buffer */
-
-/* Line registers */
-#define LINE_X0 SRC_Y
-#define LINE_X1 DST_Y
-#define LINE_Y0 SRC_X
-#define LINE_Y1 DST_X
-#define LINE_COUNT RECT_WIDTH
-#define LINE_STYLE_PERIOD RECT_HEIGHT
-#define LINE_STYLE_0 MONO_MASK
-#define LINE_STYLE_1 0x8230
-#define LINE_XN PATTERN_REG
-#define LINE_YN PATTERN_REG+2
-
-/* Transparent bitblit registers */
-#define TRANS_DST_KEY_HIGH PAT_FGCOLOR
-#define TRANS_DST_KEY_LOW PAT_BGCOLOR
-#define TRANS_SRC_KEY_HIGH SRC_FGCOLOR
-#define TRANS_SRC_KEY_LOW SRC_BGCOLOR
-
-/* Queue */
-#define Q_BASE_ADDR 0x85C0 /* Base address of software queue (?) */
-#define Q_WRITE_PTR 0x85C4 /* Current write pointer (?) */
-#define Q_READ_PTR 0x85C8 /* Current read pointer (?) */
-#define Q_STATUS 0x85CC /* queue status */
-
-
-#define MMIO_IN8(base, offset) \
- *(volatile u8 *)(((u8*)(base)) + (offset))
-#define MMIO_IN16(base, offset) \
- *(volatile u16 *)(void *)(((u8*)(base)) + (offset))
-#define MMIO_IN32(base, offset) \
- *(volatile u32 *)(void *)(((u8*)(base)) + (offset))
-#define MMIO_OUT8(base, offset, val) \
- *(volatile u8 *)(((u8*)(base)) + (offset)) = (val)
-#define MMIO_OUT16(base, offset, val) \
- *(volatile u16 *)(void *)(((u8*)(base)) + (offset)) = (val)
-#define MMIO_OUT32(base, offset, val) \
- *(volatile u32 *)(void *)(((u8*)(base)) + (offset)) = (val)
-
-
-
-/* ------------- XGI 300 series -------------- */
-
-/* Macros to do useful things with the XGI BitBLT engine */
-
-/* BR(16) (0x8420):
-
- bit 31 2D engine: 1 is idle,
- bit 30 3D engine: 1 is idle,
- bit 29 Command queue: 1 is empty
-
- bits 28:24: Current CPU driven BitBlt buffer stage bit[4:0]
-
- bits 15:0: Current command queue length
-
-*/
-
-/* TW: BR(16)+2 = 0x8242 */
-
-static int xgiCmdQueLen;
-
-#define XGI300Idle \
- { \
- while( (MMIO_IN16(xgi_video_info.mmio_vbase, BR(16)+2) & 0xE000) != 0xE000){}; \
- while( (MMIO_IN16(xgi_video_info.mmio_vbase, BR(16)+2) & 0xE000) != 0xE000){}; \
- while( (MMIO_IN16(xgi_video_info.mmio_vbase, BR(16)+2) & 0xE000) != 0xE000){}; \
- xgiCmdQueLen=MMIO_IN16(xgi_video_info.mmio_vbase, 0x8240); \
- }
-/* TW: (do three times, because 2D engine seems quite unsure about whether or not it's idle) */
-
-#define XGI300SetupSRCBase(base) \
- if (xgiCmdQueLen <= 0) XGI300Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, BR(0), base);\
- xgiCmdQueLen --;
-
-#define XGI300SetupSRCPitch(pitch) \
- if (xgiCmdQueLen <= 0) XGI300Idle;\
- MMIO_OUT16(xgi_video_info.mmio_vbase, BR(1), pitch);\
- xgiCmdQueLen --;
-
-#define XGI300SetupSRCXY(x,y) \
- if (xgiCmdQueLen <= 0) XGI300Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, BR(2), (x)<<16 | (y) );\
- xgiCmdQueLen --;
-
-#define XGI300SetupDSTBase(base) \
- if (xgiCmdQueLen <= 0) XGI300Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, BR(4), base);\
- xgiCmdQueLen --;
-
-#define XGI300SetupDSTXY(x,y) \
- if (xgiCmdQueLen <= 0) XGI300Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, BR(3), (x)<<16 | (y) );\
- xgiCmdQueLen --;
-
-#define XGI300SetupDSTRect(x,y) \
- if (xgiCmdQueLen <= 0) XGI300Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, BR(5), (y)<<16 | (x) );\
- xgiCmdQueLen --;
-
-#define XGI300SetupDSTColorDepth(bpp) \
- if (xgiCmdQueLen <= 0) XGI300Idle;\
- MMIO_OUT16(xgi_video_info.mmio_vbase, BR(1)+2, bpp);\
- xgiCmdQueLen --;
-
-#define XGI300SetupRect(w,h) \
- if (xgiCmdQueLen <= 0) XGI300Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, BR(6), (h)<<16 | (w) );\
- xgiCmdQueLen --;
-
-#define XGI300SetupPATFG(color) \
- if (xgiCmdQueLen <= 0) XGI300Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, BR(7), color);\
- xgiCmdQueLen --;
-
-#define XGI300SetupPATBG(color) \
- if (xgiCmdQueLen <= 0) XGI300Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, BR(8), color);\
- xgiCmdQueLen --;
-
-#define XGI300SetupSRCFG(color) \
- if (xgiCmdQueLen <= 0) XGI300Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, BR(9), color);\
- xgiCmdQueLen --;
-
-#define XGI300SetupSRCBG(color) \
- if (xgiCmdQueLen <= 0) XGI300Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, BR(10), color);\
- xgiCmdQueLen --;
-
-/* 0x8224 src colorkey high */
-/* 0x8228 src colorkey low */
-/* 0x821c dest colorkey high */
-/* 0x8220 dest colorkey low */
-#define XGI300SetupSRCTrans(color) \
- if (xgiCmdQueLen <= 1) XGI300Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, 0x8224, color);\
- MMIO_OUT32(xgi_video_info.mmio_vbase, 0x8228, color);\
- xgiCmdQueLen -= 2;
-
-#define XGI300SetupDSTTrans(color) \
- if (xgiCmdQueLen <= 1) XGI300Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, 0x821C, color); \
- MMIO_OUT32(xgi_video_info.mmio_vbase, 0x8220, color); \
- xgiCmdQueLen -= 2;
-
-#define XGI300SetupMONOPAT(p0,p1) \
- if (xgiCmdQueLen <= 1) XGI300Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, BR(11), p0);\
- MMIO_OUT32(xgi_video_info.mmio_vbase, BR(12), p1);\
- xgiCmdQueLen -= 2;
-
-#define XGI300SetupClipLT(left,top) \
- if (xgiCmdQueLen <= 0) XGI300Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, BR(13), ((left) & 0xFFFF) | (top)<<16 );\
- xgiCmdQueLen--;
-
-#define XGI300SetupClipRB(right,bottom) \
- if (xgiCmdQueLen <= 0) XGI300Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, BR(14), ((right) & 0xFFFF) | (bottom)<<16 );\
- xgiCmdQueLen--;
-
-/* General */
-#define XGI300SetupROP(rop) \
- xgi_video_info.CommandReg = (rop) << 8;
-
-#define XGI300SetupCMDFlag(flags) \
- xgi_video_info.CommandReg |= (flags);
-
-#define XGI300DoCMD \
- if (xgiCmdQueLen <= 1) XGI300Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, BR(15), xgi_video_info.CommandReg); \
- MMIO_OUT32(xgi_video_info.mmio_vbase, BR(16), 0);\
- xgiCmdQueLen -= 2;
-
-/* Line */
-#define XGI300SetupX0Y0(x,y) \
- if (xgiCmdQueLen <= 0) XGI300Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, BR(2), (y)<<16 | (x) );\
- xgiCmdQueLen--;
-
-#define XGI300SetupX1Y1(x,y) \
- if (xgiCmdQueLen <= 0) XGI300Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, BR(3), (y)<<16 | (x) );\
- xgiCmdQueLen--;
-
-#define XGI300SetupLineCount(c) \
- if (xgiCmdQueLen <= 0) XGI300Idle;\
- MMIO_OUT16(xgi_video_info.mmio_vbase, BR(6), c);\
- xgiCmdQueLen--;
-
-#define XGI300SetupStylePeriod(p) \
- if (xgiCmdQueLen <= 0) XGI300Idle;\
- MMIO_OUT16(xgi_video_info.mmio_vbase, BR(6)+2, p);\
- xgiCmdQueLen--;
-
-#define XGI300SetupStyleLow(ls) \
- if (xgiCmdQueLen <= 0) XGI300Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, BR(11), ls);\
- xgiCmdQueLen--;
-
-#define XGI300SetupStyleHigh(ls) \
- if (xgiCmdQueLen <= 0) XGI300Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, BR(12), ls);\
- xgiCmdQueLen--;
-
-
-
-/* ----------- XGI 310/325 series --------------- */
-
-/* Q_STATUS:
- bit 31 = 1: All engines idle and all queues empty
- bit 30 = 1: Hardware Queue (=HW CQ, 2D queue, 3D queue) empty
- bit 29 = 1: 2D engine is idle
- bit 28 = 1: 3D engine is idle
- bit 27 = 1: HW command queue empty
- bit 26 = 1: 2D queue empty
- bit 25 = 1: 3D queue empty
- bit 24 = 1: SW command queue empty
- bits 23:16: 2D counter 3
- bits 15:8: 2D counter 2
- bits 7:0: 2D counter 1
-
- Where is the command queue length (current amount of commands the queue
- can accept) on the 310/325 series? (The current implementation is taken
- from 300 series and certainly wrong...)
-*/
-
-/* TW: FIXME: xgiCmdQueLen is... where....? */
-#define XGI310Idle \
- { \
- while( (MMIO_IN16(xgi_video_info.mmio_vbase, Q_STATUS+2) & 0x8000) != 0x8000){}; \
- while( (MMIO_IN16(xgi_video_info.mmio_vbase, Q_STATUS+2) & 0x8000) != 0x8000){}; \
- xgiCmdQueLen=MMIO_IN16(xgi_video_info.mmio_vbase, Q_STATUS); \
- }
-
-#define XGI310SetupSRCBase(base) \
- if (xgiCmdQueLen <= 0) XGI310Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, SRC_ADDR, base);\
- xgiCmdQueLen--;
-
-#define XGI310SetupSRCPitch(pitch) \
- if (xgiCmdQueLen <= 0) XGI310Idle;\
- MMIO_OUT16(xgi_video_info.mmio_vbase, SRC_PITCH, pitch);\
- xgiCmdQueLen--;
-
-#define XGI310SetupSRCXY(x,y) \
- if (xgiCmdQueLen <= 0) XGI310Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, SRC_Y, (x)<<16 | (y) );\
- xgiCmdQueLen--;
-
-#define XGI310SetupDSTBase(base) \
- if (xgiCmdQueLen <= 0) XGI310Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, DST_ADDR, base);\
- xgiCmdQueLen--;
-
-#define XGI310SetupDSTXY(x,y) \
- if (xgiCmdQueLen <= 0) XGI310Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, DST_Y, (x)<<16 | (y) );\
- xgiCmdQueLen--;
-
-#define XGI310SetupDSTRect(x,y) \
- if (xgiCmdQueLen <= 0) XGI310Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, DST_PITCH, (y)<<16 | (x) );\
- xgiCmdQueLen--;
-
-#define XGI310SetupDSTColorDepth(bpp) \
- if (xgiCmdQueLen <= 0) XGI310Idle;\
- MMIO_OUT16(xgi_video_info.mmio_vbase, AGP_BASE, bpp);\
- xgiCmdQueLen--;
-
-#define XGI310SetupRect(w,h) \
- if (xgiCmdQueLen <= 0) XGI310Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, RECT_WIDTH, (h)<<16 | (w) );\
- xgiCmdQueLen--;
-
-#define XGI310SetupPATFG(color) \
- if (xgiCmdQueLen <= 0) XGI310Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, PAT_FGCOLOR, color);\
- xgiCmdQueLen--;
-
-#define XGI310SetupPATBG(color) \
- if (xgiCmdQueLen <= 0) XGI310Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, PAT_BGCOLOR, color);\
- xgiCmdQueLen--;
-
-#define XGI310SetupSRCFG(color) \
- if (xgiCmdQueLen <= 0) XGI310Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, SRC_FGCOLOR, color);\
- xgiCmdQueLen--;
-
-#define XGI310SetupSRCBG(color) \
- if (xgiCmdQueLen <= 0) XGI310Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, SRC_BGCOLOR, color);\
- xgiCmdQueLen--;
-
-#define XGI310SetupSRCTrans(color) \
- if (xgiCmdQueLen <= 1) XGI310Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, TRANS_SRC_KEY_HIGH, color);\
- MMIO_OUT32(xgi_video_info.mmio_vbase, TRANS_SRC_KEY_LOW, color);\
- xgiCmdQueLen -= 2;
-
-#define XGI310SetupDSTTrans(color) \
- if (xgiCmdQueLen <= 1) XGI310Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, TRANS_DST_KEY_HIGH, color); \
- MMIO_OUT32(xgi_video_info.mmio_vbase, TRANS_DST_KEY_LOW, color); \
- xgiCmdQueLen -= 2;
-
-#define XGI310SetupMONOPAT(p0,p1) \
- if (xgiCmdQueLen <= 1) XGI310Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, MONO_MASK, p0);\
- MMIO_OUT32(xgi_video_info.mmio_vbase, MONO_MASK+4, p1);\
- xgiCmdQueLen -= 2;
-
-#define XGI310SetupClipLT(left,top) \
- if (xgiCmdQueLen <= 0) XGI310Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, LEFT_CLIP, ((left) & 0xFFFF) | (top)<<16 );\
- xgiCmdQueLen--;
-
-#define XGI310SetupClipRB(right,bottom) \
- if (xgiCmdQueLen <= 0) XGI310Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, RIGHT_CLIP, ((right) & 0xFFFF) | (bottom)<<16 );\
- xgiCmdQueLen--;
-
-#define XGI310SetupROP(rop) \
- xgi_video_info.CommandReg = (rop) << 8;
-
-#define XGI310SetupCMDFlag(flags) \
- xgi_video_info.CommandReg |= (flags);
-
-#define XGI310DoCMD \
- if (xgiCmdQueLen <= 1) XGI310Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, COMMAND_READY, xgi_video_info.CommandReg); \
- MMIO_OUT32(xgi_video_info.mmio_vbase, FIRE_TRIGGER, 0); \
- xgiCmdQueLen -= 2;
-
-#define XGI310SetupX0Y0(x,y) \
- if (xgiCmdQueLen <= 0) XGI310Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, LINE_X0, (y)<<16 | (x) );\
- xgiCmdQueLen--;
-
-#define XGI310SetupX1Y1(x,y) \
- if (xgiCmdQueLen <= 0) XGI310Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, LINE_X1, (y)<<16 | (x) );\
- xgiCmdQueLen--;
-
-#define XGI310SetupLineCount(c) \
- if (xgiCmdQueLen <= 0) XGI310Idle;\
- MMIO_OUT16(xgi_video_info.mmio_vbase, LINE_COUNT, c);\
- xgiCmdQueLen--;
-
-#define XGI310SetupStylePeriod(p) \
- if (xgiCmdQueLen <= 0) XGI310Idle;\
- MMIO_OUT16(xgi_video_info.mmio_vbase, LINE_STYLE_PERIOD, p);\
- xgiCmdQueLen--;
-
-#define XGI310SetupStyleLow(ls) \
- if (xgiCmdQueLen <= 0) XGI310Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, LINE_STYLE_0, ls);\
- xgiCmdQueLen--;
-
-#define XGI310SetupStyleHigh(ls) \
- if (xgiCmdQueLen <= 0) XGI310Idle;\
- MMIO_OUT32(xgi_video_info.mmio_vbase, LINE_STYLE_1, ls);\
- xgiCmdQueLen--;
-
-int XGIfb_initaccel(void);
-void XGIfb_syncaccel(void);
-int fbcon_XGI_sync(struct fb_info *info);
-
-extern struct video_info xgi_video_info;
-
-extern int XGIfb_accel;
-void fbcon_XGI_fillrect(struct fb_info *info, const struct fb_fillrect *rect);
-void fbcon_XGI_copyarea(struct fb_info *info, const struct fb_copyarea *area);
-
-
-#endif
diff --git a/drivers/staging/xgifb/XGI_main.h b/drivers/staging/xgifb/XGI_main.h
index 72448e88fd8b..46b5958ddf37 100644
--- a/drivers/staging/xgifb/XGI_main.h
+++ b/drivers/staging/xgifb/XGI_main.h
@@ -9,9 +9,6 @@
#include "vb_struct.h"
#include "vb_def.h"
-//#define LINUXBIOS /* turn this on when compiling for LINUXBIOS */
-#define AGPOFF /* default is turn off AGP */
-
#define XGIFAIL(x) do { printk(x "\n"); return -EINVAL; } while(0)
#define VER_MAJOR 0
@@ -66,27 +63,6 @@ MODULE_DEVICE_TABLE(pci, xgifb_pci_table);
#define MAX_ROM_SCAN 0x10000
-#define HW_CURSOR_CAP 0x80
-#define TURBO_QUEUE_CAP 0x40
-#define AGP_CMD_QUEUE_CAP 0x20
-#define VM_CMD_QUEUE_CAP 0x10
-#define MMIO_CMD_QUEUE_CAP 0x08
-
-
-
-/* For 315 series */
-
-#define COMMAND_QUEUE_AREA_SIZE 0x80000 /* 512K */
-#define COMMAND_QUEUE_THRESHOLD 0x1F
-
-
-/* TW */
-#define HW_CURSOR_AREA_SIZE_315 0x4000 /* 16K */
-#define HW_CURSOR_AREA_SIZE_300 0x1000 /* 4K */
-
-#define OH_ALLOC_SIZE 4000
-#define SENTINEL 0x7fffffff
-
#define SEQ_ADR 0x14
#define SEQ_DATA 0x15
#define DAC_ADR 0x18
@@ -195,16 +171,6 @@ MODULE_DEVICE_TABLE(pci, xgifb_pci_table);
#define XGI_MEM_MAP_IO_ENABLE 0x01 /* SR20 */
#define XGI_PCI_ADDR_ENABLE 0x80
-#define XGI_AGP_CMDQUEUE_ENABLE 0x80 /* 315/650/740 SR26 */
-#define XGI_VRAM_CMDQUEUE_ENABLE 0x40
-#define XGI_MMIO_CMD_ENABLE 0x20
-#define XGI_CMD_QUEUE_SIZE_512k 0x00
-#define XGI_CMD_QUEUE_SIZE_1M 0x04
-#define XGI_CMD_QUEUE_SIZE_2M 0x08
-#define XGI_CMD_QUEUE_SIZE_4M 0x0C
-#define XGI_CMD_QUEUE_RESET 0x01
-#define XGI_CMD_AUTO_CORR 0x02
-
#define XGI_SIMULTANEOUS_VIEW_ENABLE 0x01 /* CR30 */
#define XGI_MODE_SELECT_CRT2 0x02
#define XGI_VB_OUTPUT_COMPOSITE 0x04
@@ -337,27 +303,22 @@ static u32 pseudo_palette[17];
static int XGIfb_off = 0;
static int XGIfb_crt1off = 0;
static int XGIfb_forcecrt1 = -1;
-static int XGIvga_enabled = 0;
static int XGIfb_userom = 0;
//static int XGIfb_useoem = -1;
/* global flags */
static int XGIfb_registered;
static int XGIfb_tvmode = 0;
-static int XGIfb_mem = 0;
static int XGIfb_pdc = 0;
static int enable_dstn = 0;
static int XGIfb_ypan = -1;
-static int XGIfb_hwcursor_size = 0;
static int XGIfb_CRT2_write_enable = 0;
static int XGIfb_crt2type = -1; /* TW: CRT2 type (for overriding autodetection) */
static int XGIfb_tvplug = -1; /* PR: Tv plug type (for overriding autodetection) */
-static int XGIfb_queuemode = -1; /* TW: Use MMIO queue mode by default (310/325 series only) */
-
static unsigned char XGIfb_detectedpdc = 0;
static unsigned char XGIfb_detectedlcda = 0xff;
@@ -374,16 +335,6 @@ static struct xgi_hw_device_info XGIhw_ext;
/* TW: XGI private structure */
static struct vb_device_info XGI_Pr;
-/* card parameters */
-static unsigned long XGIfb_mmio_size = 0;
-static u8 XGIfb_caps = 0;
-
-typedef enum _XGI_CMDTYPE {
- MMIO_CMD = 0,
- AGP_CMD_QUEUE,
- VM_CMD_QUEUE,
-} XGI_CMDTYPE;
-
#define MD_XGI300 1
#define MD_XGI315 2
@@ -526,20 +477,6 @@ static const struct _XGI_crt2type {
{"\0", -1, -1}
};
-/* Queue mode selection for 310 series */
-static const struct _XGI_queuemode {
- char name[6];
- int type_no;
-} XGI_queuemode[] = {
- {"AGP", AGP_CMD_QUEUE},
- {"VRAM", VM_CMD_QUEUE},
- {"MMIO", MMIO_CMD},
- {"agp", AGP_CMD_QUEUE},
- {"vram", VM_CMD_QUEUE},
- {"mmio", MMIO_CMD},
- {"\0", -1}
-};
-
/* TV standard */
static const struct _XGI_tvtype {
char name[6];
@@ -594,33 +531,6 @@ static const struct _chswtable {
{ 0, 0, "" , "" }
};
-typedef struct _XGI_OH {
- struct _XGI_OH *poh_next;
- struct _XGI_OH *poh_prev;
- unsigned long offset;
- unsigned long size;
-} XGI_OH;
-
-typedef struct _XGI_OHALLOC {
- struct _XGI_OHALLOC *poha_next;
- XGI_OH aoh[1];
-} XGI_OHALLOC;
-
-typedef struct _XGI_HEAP {
- XGI_OH oh_free;
- XGI_OH oh_used;
- XGI_OH *poh_freelist;
- XGI_OHALLOC *poha_chain;
- unsigned long max_freesize;
-} XGI_HEAP;
-
-static unsigned long XGIfb_hwcursor_vbase;
-
-static unsigned long XGIfb_heap_start;
-static unsigned long XGIfb_heap_end;
-static unsigned long XGIfb_heap_size;
-static XGI_HEAP XGIfb_heap;
-
// Eden Chen
static const struct _XGI_TV_filter {
u8 filter[9][4];
@@ -794,14 +704,6 @@ static int XGIfb_blank(int blank,
/*static int XGIfb_mmap(struct fb_info *info, struct file *file,
struct vm_area_struct *vma);
*/
-extern void fbcon_XGI_fillrect(struct fb_info *info,
- const struct fb_fillrect *rect);
-extern void fbcon_XGI_copyarea(struct fb_info *info,
- const struct fb_copyarea *area);
-extern int fbcon_XGI_sync(struct fb_info *info);
-
-static int XGIfb_ioctl(struct fb_info *info, unsigned int cmd,
- unsigned long arg);
/*
extern int XGIfb_mode_rate_to_dclock(VB_DEVICE_INFO *XGI_Pr,
@@ -820,10 +722,6 @@ extern unsigned char XGI_SearchModeID(unsigned short ModeNo,
static int XGIfb_get_fix(struct fb_fix_screeninfo *fix, int con,
struct fb_info *info);
-/* Internal 2D accelerator functions */
-extern int XGIfb_initaccel(void);
-extern void XGIfb_syncaccel(void);
-
/* Internal general routines */
static void XGIfb_search_mode(const char *name);
static int XGIfb_validate_mode(int modeindex);
@@ -836,21 +734,6 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
static void XGIfb_pre_setmode(void);
static void XGIfb_post_setmode(void);
-static unsigned char XGIfb_CheckVBRetrace(void);
-static unsigned char XGIfbcheckvretracecrt2(void);
-static unsigned char XGIfbcheckvretracecrt1(void);
-static unsigned char XGIfb_bridgeisslave(void);
-
-struct XGI_memreq {
- unsigned long offset;
- unsigned long size;
-};
-
-/* XGI-specific Export functions */
-void XGI_dispinfo(struct ap_data *rec);
-void XGI_malloc(struct XGI_memreq *req);
-void XGI_free(unsigned long base);
-
/* Internal hardware access routines */
void XGIfb_set_reg4(u16 port, unsigned long data);
u32 XGIfb_get_reg3(u16 port);
@@ -864,15 +747,6 @@ static void XGIfb_get_VB_type(void);
static int XGIfb_has_VB(void);
-/* Internal heap routines */
-static int XGIfb_heap_init(void);
-static XGI_OH *XGIfb_poh_new_node(void);
-static XGI_OH *XGIfb_poh_allocate(unsigned long size);
-static void XGIfb_delete_node(XGI_OH *poh);
-static void XGIfb_insert_node(XGI_OH *pohList, XGI_OH *poh);
-static XGI_OH *XGIfb_poh_free(unsigned long base);
-static void XGIfb_free_node(XGI_OH *poh);
-
/* Internal routines to access PCI configuration space */
unsigned char XGIfb_query_VGA_config_space(struct xgi_hw_device_info *pXGIhw_ext,
unsigned long offset,
diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index ee008e5a0cbc..721bd25fe542 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -43,8 +43,6 @@
#include "XGI_main.h"
#include "vb_util.h"
-int XGIfb_accel = 0;
-
#define Index_CR_GPIO_Reg1 0x48
#define Index_CR_GPIO_Reg2 0x49
#define Index_CR_GPIO_Reg3 0x4a
@@ -54,6 +52,8 @@ int XGIfb_accel = 0;
#define GPIOG_READ (1<<1)
int XGIfb_GetXG21DefaultLVDSModeIdx(void);
+#define XGIFB_ROM_SIZE 65536
+
/* -------------------- Macro definitions ---------------------------- */
#undef XGIFBDEBUG
@@ -182,8 +182,6 @@ static int XGIfb_mode_rate_to_dclock(struct vb_device_info *XGI_Pr,
*/
ClockIndex = XGI_Pr->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
- if (HwDeviceExtension->jChipType < XGI_315H)
- ClockIndex &= 0x3F;
Clock = XGI_Pr->VCLKData[ClockIndex].CLOCK * 1000;
@@ -859,12 +857,6 @@ static int XGIfb_validate_mode(int myindex)
if (XGIbios_mode[myindex].bpp == 32)
return -1;
}
- /* TW: LVDS/CHRONTEL only supports < 800 (1024 on 650/Ch7019) */
- if (xgi_video_info.hasVB == HASVB_LVDS_CHRONTEL
- || xgi_video_info.hasVB == HASVB_CHRONTEL) {
- if (xgi_video_info.chip < XGI_315H)
- return -1;
- }
break;
default:
return -1;
@@ -898,24 +890,6 @@ static void XGIfb_search_crt2type(const char *name)
printk(KERN_INFO "XGIfb: Invalid CRT2 type: %s\n", name);
}
-static void XGIfb_search_queuemode(const char *name)
-{
- int i = 0;
-
- if (name == NULL)
- return;
-
- while (XGI_queuemode[i].type_no != -1) {
- if (!strcmp(name, XGI_queuemode[i].name)) {
- XGIfb_queuemode = XGI_queuemode[i].type_no;
- break;
- }
- i++;
- }
- if (XGIfb_queuemode < 0)
- printk(KERN_INFO "XGIfb: Invalid queuemode type: %s\n", name);
-}
-
static u8 XGIfb_search_refresh_rate(unsigned int rate)
{
u16 xres, yres;
@@ -982,61 +956,6 @@ static void XGIfb_search_tvstd(const char *name)
}
}
-static unsigned char XGIfb_bridgeisslave(void)
-{
- unsigned char usScratchP1_00;
-
- if (xgi_video_info.hasVB == HASVB_NONE)
- return 0;
-
- inXGIIDXREG(XGIPART1, 0x00, usScratchP1_00);
- if ((usScratchP1_00 & 0x50) == 0x10)
- return 1;
- else
- return 0;
-}
-
-static unsigned char XGIfbcheckvretracecrt1(void)
-{
- unsigned char temp;
-
- inXGIIDXREG(XGICR, 0x17, temp);
- if (!(temp & 0x80))
- return 0;
-
- inXGIIDXREG(XGISR, 0x1f, temp);
- if (temp & 0xc0)
- return 0;
-
- if (inXGIREG(XGIINPSTAT) & 0x08)
- return 1;
- else
- return 0;
-}
-
-static unsigned char XGIfbcheckvretracecrt2(void)
-{
- unsigned char temp;
- if (xgi_video_info.hasVB == HASVB_NONE)
- return 0;
- inXGIIDXREG(XGIPART1, 0x30, temp);
- if (temp & 0x02)
- return 0;
- else
- return 1;
-}
-
-static unsigned char XGIfb_CheckVBRetrace(void)
-{
- if (xgi_video_info.disp_state & DISPTYPE_DISP2) {
- if (XGIfb_bridgeisslave())
- return XGIfbcheckvretracecrt1();
- else
- return XGIfbcheckvretracecrt2();
- }
- return XGIfbcheckvretracecrt1();
-}
-
/* ----------- FBDev related routines for all series ----------- */
static void XGIfb_bpp_to_var(struct fb_var_screeninfo *var)
@@ -1187,11 +1106,6 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
xgi_video_info.org_x = xgi_video_info.org_y = 0;
xgi_video_info.video_linelength = info->var.xres_virtual
* (xgi_video_info.video_bpp >> 3);
- xgi_video_info.accel = 0;
- if (XGIfb_accel) {
- xgi_video_info.accel = (var->accel_flags
- & FB_ACCELF_TEXT) ? -1 : 0;
- }
switch (xgi_video_info.video_bpp) {
case 8:
xgi_video_info.DstColor = 0x0000;
@@ -1223,7 +1137,6 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
default:
xgi_video_info.video_cmap_len = 16;
printk(KERN_ERR "XGIfb: Unsupported depth %d", xgi_video_info.video_bpp);
- xgi_video_info.accel = 0;
break;
}
}
@@ -1286,26 +1199,6 @@ static int XGIfb_pan_var(struct fb_var_screeninfo *var)
}
#endif
-void XGI_dispinfo(struct ap_data *rec)
-{
- rec->minfo.bpp = xgi_video_info.video_bpp;
- rec->minfo.xres = xgi_video_info.video_width;
- rec->minfo.yres = xgi_video_info.video_height;
- rec->minfo.v_xres = xgi_video_info.video_vwidth;
- rec->minfo.v_yres = xgi_video_info.video_vheight;
- rec->minfo.org_x = xgi_video_info.org_x;
- rec->minfo.org_y = xgi_video_info.org_y;
- rec->minfo.vrate = xgi_video_info.refresh_rate;
- rec->iobase = xgi_video_info.vga_base - 0x30;
- rec->mem_size = xgi_video_info.video_size;
- rec->disp_state = xgi_video_info.disp_state;
- rec->version = (VER_MAJOR << 24) | (VER_MINOR << 16) | VER_LEVEL;
- rec->hasVB = xgi_video_info.hasVB;
- rec->TV_type = xgi_video_info.TV_type;
- rec->TV_plug = xgi_video_info.TV_plug;
- rec->chip = xgi_video_info.chip;
-}
-
static int XGIfb_open(struct fb_info *info, int user)
{
return 0;
@@ -1580,109 +1473,6 @@ static int XGIfb_blank(int blank, struct fb_info *info)
return 0;
}
-static int XGIfb_ioctl(struct fb_info *info, unsigned int cmd,
- unsigned long arg)
-{
- DEBUGPRN("inside ioctl");
- switch (cmd) {
- case FBIO_ALLOC:
- if (!capable(CAP_SYS_RAWIO))
- return -EPERM;
- XGI_malloc((struct XGI_memreq *) arg);
- break;
- case FBIO_FREE:
- if (!capable(CAP_SYS_RAWIO))
- return -EPERM;
- XGI_free(*(unsigned long *) arg);
- break;
- case FBIOGET_HWCINFO: {
- unsigned long *hwc_offset = (unsigned long *) arg;
-
- if (XGIfb_caps & HW_CURSOR_CAP)
- *hwc_offset
- = XGIfb_hwcursor_vbase
- - (unsigned long) xgi_video_info.video_vbase;
- else
- *hwc_offset = 0;
-
- break;
- }
- case FBIOPUT_MODEINFO: {
- struct mode_info *x = (struct mode_info *) arg;
-
- xgi_video_info.video_bpp = x->bpp;
- xgi_video_info.video_width = x->xres;
- xgi_video_info.video_height = x->yres;
- xgi_video_info.video_vwidth = x->v_xres;
- xgi_video_info.video_vheight = x->v_yres;
- xgi_video_info.org_x = x->org_x;
- xgi_video_info.org_y = x->org_y;
- xgi_video_info.refresh_rate = x->vrate;
- xgi_video_info.video_linelength = xgi_video_info.video_vwidth
- * (xgi_video_info.video_bpp >> 3);
- switch (xgi_video_info.video_bpp) {
- case 8:
- xgi_video_info.DstColor = 0x0000;
- xgi_video_info.XGI310_AccelDepth = 0x00000000;
- xgi_video_info.video_cmap_len = 256;
- break;
- case 16:
- xgi_video_info.DstColor = 0x8000;
- xgi_video_info.XGI310_AccelDepth = 0x00010000;
- xgi_video_info.video_cmap_len = 16;
- break;
- case 32:
- xgi_video_info.DstColor = 0xC000;
- xgi_video_info.XGI310_AccelDepth = 0x00020000;
- xgi_video_info.video_cmap_len = 16;
- break;
- default:
- xgi_video_info.video_cmap_len = 16;
- printk(KERN_ERR "XGIfb: Unsupported accel depth %d", xgi_video_info.video_bpp);
- xgi_video_info.accel = 0;
- break;
- }
-
- break;
- }
- case FBIOGET_DISPINFO:
- XGI_dispinfo((struct ap_data *) arg);
- break;
- case XGIFB_GET_INFO: /* TW: New for communication with X driver */
- {
- struct XGIfb_info *x = (struct XGIfb_info *) arg;
-
- /* x->XGIfb_id = XGIFB_ID; */
- x->XGIfb_version = VER_MAJOR;
- x->XGIfb_revision = VER_MINOR;
- x->XGIfb_patchlevel = VER_LEVEL;
- x->chip_id = xgi_video_info.chip_id;
- x->memory = xgi_video_info.video_size / 1024;
- x->heapstart = xgi_video_info.heapstart / 1024;
- x->fbvidmode = XGIfb_mode_no;
- x->XGIfb_caps = XGIfb_caps;
- x->XGIfb_tqlen = 512; /* yet unused */
- x->XGIfb_pcibus = xgi_video_info.pcibus;
- x->XGIfb_pcislot = xgi_video_info.pcislot;
- x->XGIfb_pcifunc = xgi_video_info.pcifunc;
- x->XGIfb_lcdpdc = XGIfb_detectedpdc;
- x->XGIfb_lcda = XGIfb_detectedlcda;
- break;
- }
- case XGIFB_GET_VBRSTATUS: {
- unsigned long *vbrstatus = (unsigned long *) arg;
- if (XGIfb_CheckVBRetrace())
- *vbrstatus = 1;
- else
- *vbrstatus = 0;
- }
- default:
- return -EINVAL;
- } DEBUGPRN("end of ioctl");
- return 0;
-
-}
-
/* ----------- FBDev related routines for all series ---------- */
static int XGIfb_get_fix(struct fb_fix_screeninfo *fix, int con,
@@ -1697,16 +1487,6 @@ static int XGIfb_get_fix(struct fb_fix_screeninfo *fix, int con,
fix->smem_len = xgi_video_info.video_size;
- /* if((!XGIfb_mem) || (XGIfb_mem > (xgi_video_info.video_size/1024))) {
- if (xgi_video_info.video_size > 0x1000000) {
- fix->smem_len = 0xD00000;
- } else if (xgi_video_info.video_size > 0x800000)
- fix->smem_len = 0x800000;
- else
- fix->smem_len = 0x400000;
- } else
- fix->smem_len = XGIfb_mem * 1024;
- */
fix->type = video_type;
fix->type_aux = 0;
if (xgi_video_info.video_bpp == 8)
@@ -1721,11 +1501,8 @@ static int XGIfb_get_fix(struct fb_fix_screeninfo *fix, int con,
fix->ywrapstep = 0;
fix->line_length = xgi_video_info.video_linelength;
fix->mmio_start = xgi_video_info.mmio_base;
- fix->mmio_len = XGIfb_mmio_size;
- if (xgi_video_info.chip >= XG40)
- fix->accel = FB_ACCEL_XGI_XABRE;
- else
- fix->accel = FB_ACCEL_XGI_GLAMOUR_2;
+ fix->mmio_len = xgi_video_info.mmio_size;
+ fix->accel = FB_ACCEL_XGI_XABRE;
DEBUGPRN("end of get_fix");
return 0;
@@ -1742,11 +1519,9 @@ static struct fb_ops XGIfb_ops = {
.fb_pan_display = XGIfb_pan_display,
#endif
.fb_blank = XGIfb_blank,
- .fb_fillrect = fbcon_XGI_fillrect,
- .fb_copyarea = fbcon_XGI_copyarea,
+ .fb_fillrect = cfb_fillrect,
+ .fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
- .fb_sync = fbcon_XGI_sync,
- .fb_ioctl = XGIfb_ioctl,
/* .fb_mmap = XGIfb_mmap, */
};
@@ -1898,24 +1673,11 @@ static void XGIfb_detect_VB(void)
xgi_video_info.TV_plug = TVPLUG_SCART;
if (xgi_video_info.TV_type == 0) {
- /* TW: PAL/NTSC changed for 650 */
- if ((xgi_video_info.chip <= XGI_315PRO) || (xgi_video_info.chip
- >= XGI_330)) {
-
- inXGIIDXREG(XGICR, 0x38, temp);
- if (temp & 0x10)
- xgi_video_info.TV_type = TVMODE_PAL;
- else
- xgi_video_info.TV_type = TVMODE_NTSC;
-
- } else {
-
- inXGIIDXREG(XGICR, 0x79, temp);
- if (temp & 0x20)
- xgi_video_info.TV_type = TVMODE_PAL;
- else
- xgi_video_info.TV_type = TVMODE_NTSC;
- }
+ inXGIIDXREG(XGICR, 0x38, temp);
+ if (temp & 0x10)
+ xgi_video_info.TV_type = TVMODE_PAL;
+ else
+ xgi_video_info.TV_type = TVMODE_NTSC;
}
/* TW: Copy forceCRT1 option to CRT1off if option is given */
@@ -2087,495 +1849,6 @@ void XGI_Sense30x(void)
outXGIIDXREG(XGIPART4, 0x0d, backupP4_0d);
}
-/* ------------------------ Heap routines -------------------------- */
-
-static int XGIfb_heap_init(void)
-{
- XGI_OH *poh;
- u8 temp = 0;
-
- int agp_enabled = 1;
- u32 agp_size;
- unsigned long *cmdq_baseport = NULL;
- unsigned long *read_port = NULL;
- unsigned long *write_port = NULL;
- XGI_CMDTYPE cmd_type;
-#ifndef AGPOFF
- struct agp_kern_info *agp_info;
- struct agp_memory *agp;
- u32 agp_phys;
-#endif
-
- /* TW: The heap start is either set manually using the "mem" parameter, or
- * defaults as follows:
- * -) If more than 16MB videoRAM available, let our heap start at 12MB.
- * -) If more than 8MB videoRAM available, let our heap start at 8MB.
- * -) If 4MB or less is available, let it start at 4MB.
- * This is for avoiding a clash with X driver which uses the beginning
- * of the videoRAM. To limit size of X framebuffer, use Option MaxXFBMem
- * in XF86Config-4.
- * The heap start can also be specified by parameter "mem" when starting the XGIfb
- * driver. XGIfb mem=1024 lets heap starts at 1MB, etc.
- */
- if ((!XGIfb_mem) || (XGIfb_mem > (xgi_video_info.video_size / 1024))) {
- if (xgi_video_info.video_size > 0x1000000)
- xgi_video_info.heapstart = 0xD00000;
- else if (xgi_video_info.video_size > 0x800000)
- xgi_video_info.heapstart = 0x800000;
- else
- xgi_video_info.heapstart = 0x400000;
- } else {
- xgi_video_info.heapstart = XGIfb_mem * 1024;
- }
- XGIfb_heap_start = (unsigned long) (xgi_video_info.video_vbase
- + xgi_video_info.heapstart);
- printk(KERN_INFO "XGIfb: Memory heap starting at %dK\n",
- (int)(xgi_video_info.heapstart / 1024));
-
- XGIfb_heap_end = (unsigned long) xgi_video_info.video_vbase
- + xgi_video_info.video_size;
- XGIfb_heap_size = XGIfb_heap_end - XGIfb_heap_start;
-
- /* TW: Now initialize the 310 series' command queue mode.
- * On 310/325, there are three queue modes available which
- * are chosen by setting bits 7:5 in SR26:
- * 1. MMIO queue mode (bit 5, 0x20). The hardware will keep
- * track of the queue, the FIFO, command parsing and so
- * on. This is the one comparable to the 300 series.
- * 2. VRAM queue mode (bit 6, 0x40). In this case, one will
- * have to do queue management himself. Register 0x85c4 will
- * hold the location of the next free queue slot, 0x85c8
- * is the "queue read pointer" whose way of working is
- * unknown to me. Anyway, this mode would require a
- * translation of the MMIO commands to some kind of
- * accelerator assembly and writing these commands
- * to the memory location pointed to by 0x85c4.
- * We will not use this, as nobody knows how this
- * "assembly" works, and as it would require a complete
- * re-write of the accelerator code.
- * 3. AGP queue mode (bit 7, 0x80). Works as 2., but keeps the
- * queue in AGP memory space.
- *
- * SR26 bit 4 is called "Bypass H/W queue".
- * SR26 bit 1 is called "Enable Command Queue Auto Correction"
- * SR26 bit 0 resets the queue
- * Size of queue memory is encoded in bits 3:2 like this:
- * 00 (0x00) 512K
- * 01 (0x04) 1M
- * 10 (0x08) 2M
- * 11 (0x0C) 4M
- * The queue location is to be written to 0x85C0.
- *
- */
- cmdq_baseport = (unsigned long *) (xgi_video_info.mmio_vbase
- + MMIO_QUEUE_PHYBASE);
- write_port = (unsigned long *) (xgi_video_info.mmio_vbase
- + MMIO_QUEUE_WRITEPORT);
- read_port = (unsigned long *) (xgi_video_info.mmio_vbase
- + MMIO_QUEUE_READPORT);
-
- DPRINTK("AGP base: 0x%p, read: 0x%p, write: 0x%p\n", cmdq_baseport, read_port, write_port);
-
- agp_size = COMMAND_QUEUE_AREA_SIZE;
-
-#ifndef AGPOFF
- if (XGIfb_queuemode == AGP_CMD_QUEUE) {
- agp_info = vzalloc(sizeof(*agp_info));
- agp_copy_info(agp_info);
-
- agp_backend_acquire();
-
- agp = agp_allocate_memory(COMMAND_QUEUE_AREA_SIZE / PAGE_SIZE,
- AGP_NORMAL_MEMORY);
- if (agp == NULL) {
- DPRINTK("XGIfb: Allocating AGP buffer failed.\n");
- agp_enabled = 0;
- } else {
- if (agp_bind_memory(agp, agp->pg_start) != 0) {
- DPRINTK("XGIfb: AGP: Failed to bind memory\n");
- /* TODO: Free AGP memory here */
- agp_enabled = 0;
- } else {
- agp_enable(0);
- }
- }
- }
-#else
- agp_enabled = 0;
-#endif
-
- /* TW: Now select the queue mode */
-
- if ((agp_enabled) && (XGIfb_queuemode == AGP_CMD_QUEUE)) {
- cmd_type = AGP_CMD_QUEUE;
- printk(KERN_INFO "XGIfb: Using AGP queue mode\n");
- /* } else if (XGIfb_heap_size >= COMMAND_QUEUE_AREA_SIZE) */
- } else if (XGIfb_queuemode == VM_CMD_QUEUE) {
- cmd_type = VM_CMD_QUEUE;
- printk(KERN_INFO "XGIfb: Using VRAM queue mode\n");
- } else {
- printk(KERN_INFO "XGIfb: Using MMIO queue mode\n");
- cmd_type = MMIO_CMD;
- }
-
- switch (agp_size) {
- case 0x80000:
- temp = XGI_CMD_QUEUE_SIZE_512k;
- break;
- case 0x100000:
- temp = XGI_CMD_QUEUE_SIZE_1M;
- break;
- case 0x200000:
- temp = XGI_CMD_QUEUE_SIZE_2M;
- break;
- case 0x400000:
- temp = XGI_CMD_QUEUE_SIZE_4M;
- break;
- }
-
- switch (cmd_type) {
- case AGP_CMD_QUEUE:
-#ifndef AGPOFF
- DPRINTK("XGIfb: AGP buffer base = 0x%lx, offset = 0x%x, size = %dK\n",
- agp_info->aper_base, agp->physical, agp_size/1024);
-
- agp_phys = agp_info->aper_base + agp->physical;
-
- outXGIIDXREG(XGICR, IND_XGI_AGP_IO_PAD, 0);
- outXGIIDXREG(XGICR, IND_XGI_AGP_IO_PAD, XGI_AGP_2X);
-
- outXGIIDXREG(XGISR, IND_XGI_CMDQUEUE_THRESHOLD, COMMAND_QUEUE_THRESHOLD);
-
- outXGIIDXREG(XGISR, IND_XGI_CMDQUEUE_SET, XGI_CMD_QUEUE_RESET);
-
- *write_port = *read_port;
-
- temp |= XGI_AGP_CMDQUEUE_ENABLE;
- outXGIIDXREG(XGISR, IND_XGI_CMDQUEUE_SET, temp);
-
- *cmdq_baseport = agp_phys;
-
- XGIfb_caps |= AGP_CMD_QUEUE_CAP;
-#endif
- break;
-
- case VM_CMD_QUEUE:
- XGIfb_heap_end -= COMMAND_QUEUE_AREA_SIZE;
- XGIfb_heap_size -= COMMAND_QUEUE_AREA_SIZE;
-
- outXGIIDXREG(XGISR, IND_XGI_CMDQUEUE_THRESHOLD, COMMAND_QUEUE_THRESHOLD);
-
- outXGIIDXREG(XGISR, IND_XGI_CMDQUEUE_SET, XGI_CMD_QUEUE_RESET);
-
- *write_port = *read_port;
-
- temp |= XGI_VRAM_CMDQUEUE_ENABLE;
- outXGIIDXREG(XGISR, IND_XGI_CMDQUEUE_SET, temp);
-
- *cmdq_baseport = xgi_video_info.video_size - COMMAND_QUEUE_AREA_SIZE;
-
- XGIfb_caps |= VM_CMD_QUEUE_CAP;
-
- DPRINTK("XGIfb: VM Cmd Queue offset = 0x%lx, size is %dK\n",
- *cmdq_baseport, COMMAND_QUEUE_AREA_SIZE/1024);
- break;
-
- default: /* MMIO */
-
- /* printk("%s:%d - I'm here\n", __FUNCTION__, __LINE__); */
- /* TW: This previously only wrote XGI_MMIO_CMD_ENABLE
- * to IND_XGI_CMDQUEUE_SET. I doubt that this is
- * enough. Reserve memory in any way.
- */
- /* FIXME XGIfb_heap_end -= COMMAND_QUEUE_AREA_SIZE; */
- /* FIXME XGIfb_heap_size -= COMMAND_QUEUE_AREA_SIZE; */
- /* FIXME */
- /* FIXME outXGIIDXREG(XGISR, IND_XGI_CMDQUEUE_THRESHOLD, COMMAND_QUEUE_THRESHOLD); */
- /* FIXME outXGIIDXREG(XGISR, IND_XGI_CMDQUEUE_SET, XGI_CMD_QUEUE_RESET); */
- /* FIXME */
- /* FIXME *write_port = *read_port; */
- /* FIXME */
- /* FIXME *//* TW: Set Auto_Correction bit */
- /* FIXME temp |= (XGI_MMIO_CMD_ENABLE | XGI_CMD_AUTO_CORR); */
- /* FIXME outXGIIDXREG(XGISR, IND_XGI_CMDQUEUE_SET, temp); */
- /* FIXME */
- /* FIXME *cmdq_baseport = xgi_video_info.video_size - COMMAND_QUEUE_AREA_SIZE; */
- /* FIXME */
- /* FIXME XGIfb_caps |= MMIO_CMD_QUEUE_CAP; */
- /* FIXME */
- /* FIXME DPRINTK("XGIfb: MMIO Cmd Queue offset = 0x%lx, size is %dK\n", */
- /* FIXME *cmdq_baseport, COMMAND_QUEUE_AREA_SIZE/1024); */
- break;
-}
-
- /* TW: Now reserve memory for the HWCursor. It is always located at the very
- top of the videoRAM, right below the TB memory area (if used). */
- if (XGIfb_heap_size >= XGIfb_hwcursor_size) {
- XGIfb_heap_end -= XGIfb_hwcursor_size;
- XGIfb_heap_size -= XGIfb_hwcursor_size;
- XGIfb_hwcursor_vbase = XGIfb_heap_end;
-
- XGIfb_caps |= HW_CURSOR_CAP;
-
- DPRINTK("XGIfb: Hardware Cursor start at 0x%lx, size is %dK\n",
- XGIfb_heap_end, XGIfb_hwcursor_size/1024);
- }
-
- XGIfb_heap.poha_chain = NULL;
- XGIfb_heap.poh_freelist = NULL;
-
- poh = XGIfb_poh_new_node();
-
- if (poh == NULL)
- return 1;
-
- poh->poh_next = &XGIfb_heap.oh_free;
- poh->poh_prev = &XGIfb_heap.oh_free;
- poh->size = XGIfb_heap_end - XGIfb_heap_start + 1;
- poh->offset = XGIfb_heap_start - (unsigned long) xgi_video_info.video_vbase;
-
- DPRINTK("XGIfb: Heap start:0x%p, end:0x%p, len=%dk\n",
- (char *) XGIfb_heap_start, (char *) XGIfb_heap_end,
- (unsigned int) poh->size / 1024);
-
- DPRINTK("XGIfb: First Node offset:0x%x, size:%dk\n",
- (unsigned int) poh->offset, (unsigned int) poh->size / 1024);
-
- XGIfb_heap.oh_free.poh_next = poh;
- XGIfb_heap.oh_free.poh_prev = poh;
- XGIfb_heap.oh_free.size = 0;
- XGIfb_heap.max_freesize = poh->size;
-
- XGIfb_heap.oh_used.poh_next = &XGIfb_heap.oh_used;
- XGIfb_heap.oh_used.poh_prev = &XGIfb_heap.oh_used;
- XGIfb_heap.oh_used.size = SENTINEL;
-
- return 0;
-}
-
-static XGI_OH *XGIfb_poh_new_node(void)
-{
- int i;
- unsigned long cOhs;
- XGI_OHALLOC *poha;
- XGI_OH *poh;
-
- if (XGIfb_heap.poh_freelist == NULL) {
- poha = kmalloc(OH_ALLOC_SIZE, GFP_KERNEL);
- if (!poha)
- return NULL;
-
- poha->poha_next = XGIfb_heap.poha_chain;
- XGIfb_heap.poha_chain = poha;
-
- cOhs = (OH_ALLOC_SIZE - sizeof(XGI_OHALLOC)) / sizeof(XGI_OH)
- + 1;
-
- poh = &poha->aoh[0];
- for (i = cOhs - 1; i != 0; i--) {
- poh->poh_next = poh + 1;
- poh = poh + 1;
- }
-
- poh->poh_next = NULL;
- XGIfb_heap.poh_freelist = &poha->aoh[0];
- }
-
- poh = XGIfb_heap.poh_freelist;
- XGIfb_heap.poh_freelist = poh->poh_next;
-
- return poh;
-}
-
-static XGI_OH *XGIfb_poh_allocate(unsigned long size)
-{
- XGI_OH *pohThis;
- XGI_OH *pohRoot;
- int bAllocated = 0;
-
- if (size > XGIfb_heap.max_freesize) {
- DPRINTK("XGIfb: Can't allocate %dk size on offscreen\n",
- (unsigned int) size / 1024);
- return NULL;
- }
-
- pohThis = XGIfb_heap.oh_free.poh_next;
-
- while (pohThis != &XGIfb_heap.oh_free) {
- if (size <= pohThis->size) {
- bAllocated = 1;
- break;
- }
- pohThis = pohThis->poh_next;
- }
-
- if (!bAllocated) {
- DPRINTK("XGIfb: Can't allocate %dk size on offscreen\n",
- (unsigned int) size / 1024);
- return NULL;
- }
-
- if (size == pohThis->size) {
- pohRoot = pohThis;
- XGIfb_delete_node(pohThis);
- } else {
- pohRoot = XGIfb_poh_new_node();
-
- if (pohRoot == NULL)
- return NULL;
-
- pohRoot->offset = pohThis->offset;
- pohRoot->size = size;
-
- pohThis->offset += size;
- pohThis->size -= size;
- }
-
- XGIfb_heap.max_freesize -= size;
-
- pohThis = &XGIfb_heap.oh_used;
- XGIfb_insert_node(pohThis, pohRoot);
-
- return pohRoot;
-}
-
-static void XGIfb_delete_node(XGI_OH *poh)
-{
- XGI_OH *poh_prev;
- XGI_OH *poh_next;
-
- poh_prev = poh->poh_prev;
- poh_next = poh->poh_next;
-
- poh_prev->poh_next = poh_next;
- poh_next->poh_prev = poh_prev;
-
-}
-
-static void XGIfb_insert_node(XGI_OH *pohList, XGI_OH *poh)
-{
- XGI_OH *pohTemp;
-
- pohTemp = pohList->poh_next;
-
- pohList->poh_next = poh;
- pohTemp->poh_prev = poh;
-
- poh->poh_prev = pohList;
- poh->poh_next = pohTemp;
-}
-
-static XGI_OH *XGIfb_poh_free(unsigned long base)
-{
- XGI_OH *pohThis;
- XGI_OH *poh_freed;
- XGI_OH *poh_prev;
- XGI_OH *poh_next;
- unsigned long ulUpper;
- unsigned long ulLower;
- int foundNode = 0;
-
- poh_freed = XGIfb_heap.oh_used.poh_next;
-
- while (poh_freed != &XGIfb_heap.oh_used) {
- if (poh_freed->offset == base) {
- foundNode = 1;
- break;
- }
-
- poh_freed = poh_freed->poh_next;
- }
-
- if (!foundNode)
- return NULL;
-
- XGIfb_heap.max_freesize += poh_freed->size;
-
- poh_prev = poh_next = NULL;
- ulUpper = poh_freed->offset + poh_freed->size;
- ulLower = poh_freed->offset;
-
- pohThis = XGIfb_heap.oh_free.poh_next;
-
- while (pohThis != &XGIfb_heap.oh_free) {
- if (pohThis->offset == ulUpper)
- poh_next = pohThis;
- else if ((pohThis->offset + pohThis->size) == ulLower)
- poh_prev = pohThis;
-
- pohThis = pohThis->poh_next;
- }
-
- XGIfb_delete_node(poh_freed);
-
- if (poh_prev && poh_next) {
- poh_prev->size += (poh_freed->size + poh_next->size);
- XGIfb_delete_node(poh_next);
- XGIfb_free_node(poh_freed);
- XGIfb_free_node(poh_next);
- return poh_prev;
- }
-
- if (poh_prev) {
- poh_prev->size += poh_freed->size;
- XGIfb_free_node(poh_freed);
- return poh_prev;
- }
-
- if (poh_next) {
- poh_next->size += poh_freed->size;
- poh_next->offset = poh_freed->offset;
- XGIfb_free_node(poh_freed);
- return poh_next;
- }
-
- XGIfb_insert_node(&XGIfb_heap.oh_free, poh_freed);
-
- return poh_freed;
-}
-
-static void XGIfb_free_node(XGI_OH *poh)
-{
- if (poh == NULL)
- return;
-
- poh->poh_next = XGIfb_heap.poh_freelist;
- XGIfb_heap.poh_freelist = poh;
-
-}
-
-void XGI_malloc(struct XGI_memreq *req)
-{
- XGI_OH *poh;
-
- poh = XGIfb_poh_allocate(req->size);
-
- if (poh == NULL) {
- req->offset = 0;
- req->size = 0;
- DPRINTK("XGIfb: Video RAM allocation failed\n");
- } else {
- DPRINTK("XGIfb: Video RAM allocation succeeded: 0x%p\n",
- (char *) (poh->offset + (unsigned long) xgi_video_info.video_vbase));
-
- req->offset = poh->offset;
- req->size = poh->size;
- }
-
-}
-
-void XGI_free(unsigned long base)
-{
- XGI_OH *poh;
-
- poh = XGIfb_poh_free(base);
-
- if (poh == NULL) {
- DPRINTK("XGIfb: XGIfb_poh_free() failed at base 0x%x\n",
- (unsigned int) base);
- }
-}
-
/* --------------------- SetMode routines ------------------------- */
static void XGIfb_pre_setmode(void)
@@ -2622,10 +1895,6 @@ static void XGIfb_pre_setmode(void)
outXGIIDXREG(XGICR, IND_XGI_SCRATCH_REG_CR30, cr30);
outXGIIDXREG(XGICR, IND_XGI_SCRATCH_REG_CR31, cr31);
outXGIIDXREG(XGICR, IND_XGI_SCRATCH_REG_CR33, (XGIfb_rate_idx & 0x0F));
-
- if (xgi_video_info.accel)
- XGIfb_syncaccel();
-
}
static void XGIfb_post_setmode(void)
@@ -2840,22 +2109,16 @@ XGIINITSTATIC int __init XGIfb_setup(char *options)
XGIfb_search_tvstd(this_opt + 7);
} else if (!strncmp(this_opt, "tvstandard:", 11)) {
XGIfb_search_tvstd(this_opt + 7);
- } else if (!strncmp(this_opt, "mem:", 4)) {
- XGIfb_mem = simple_strtoul(this_opt + 4, NULL, 0);
} else if (!strncmp(this_opt, "dstn", 4)) {
enable_dstn = 1;
/* TW: DSTN overrules forcecrt2type */
XGIfb_crt2type = DISPTYPE_LCD;
- } else if (!strncmp(this_opt, "queuemode:", 10)) {
- XGIfb_search_queuemode(this_opt + 10);
} else if (!strncmp(this_opt, "pdc:", 4)) {
XGIfb_pdc = simple_strtoul(this_opt + 4, NULL, 0);
if (XGIfb_pdc & ~0x3c) {
printk(KERN_INFO "XGIfb: Illegal pdc parameter\n");
XGIfb_pdc = 0;
}
- } else if (!strncmp(this_opt, "noaccel", 7)) {
- XGIfb_accel = 0;
} else if (!strncmp(this_opt, "noypan", 6)) {
XGIfb_ypan = 0;
} else if (!strncmp(this_opt, "userom:", 7)) {
@@ -2867,74 +2130,43 @@ XGIINITSTATIC int __init XGIfb_setup(char *options)
/* printk(KERN_INFO "XGIfb: Invalid option %s\n", this_opt); */
}
- /* TW: Acceleration only with MMIO mode */
- if ((XGIfb_queuemode != -1) && (XGIfb_queuemode != MMIO_CMD)) {
- XGIfb_ypan = 0;
- XGIfb_accel = 0;
- }
/* TW: Panning only with acceleration */
- if (XGIfb_accel == 0)
- XGIfb_ypan = 0;
+ XGIfb_ypan = 0;
}
printk("\nxgifb: outa xgifb_setup 3450");
return 0;
}
-static unsigned char VBIOS_BUF[65535];
-
-static unsigned char *attempt_map_rom(struct pci_dev *dev, void *copy_address)
+static unsigned char *xgifb_copy_rom(struct pci_dev *dev)
{
- u32 rom_size = 0;
- u32 rom_address = 0;
- int j;
-
- /* Get the size of the expansion rom */
- pci_write_config_dword(dev, PCI_ROM_ADDRESS, 0xFFFFFFFF);
- pci_read_config_dword(dev, PCI_ROM_ADDRESS, &rom_size);
- if ((rom_size & 0x01) == 0) {
- printk("No ROM\n");
- return NULL;
- }
+ void __iomem *rom_address;
+ unsigned char *rom_copy;
+ size_t rom_size;
- rom_size &= 0xFFFFF800;
- rom_size = (~rom_size) + 1;
-
- rom_address = pci_resource_start(dev, 0);
- if (rom_address == 0 || rom_address == 0xFFFFFFF0) {
- printk("No suitable rom address found\n");
+ rom_address = pci_map_rom(dev, &rom_size);
+ if (rom_address == NULL)
return NULL;
- }
- printk("ROM Size is %dK, Address is %x\n", rom_size / 1024, rom_address);
+ rom_copy = vzalloc(XGIFB_ROM_SIZE);
+ if (rom_copy == NULL)
+ goto done;
- /* Map ROM */
- pci_write_config_dword(dev, PCI_ROM_ADDRESS, rom_address
- | PCI_ROM_ADDRESS_ENABLE);
+ rom_size = min_t(size_t, rom_size, XGIFB_ROM_SIZE);
+ memcpy_fromio(rom_copy, rom_address, rom_size);
- /* memcpy(copy_address, rom_address, rom_size); */
- {
- unsigned char *virt_addr = ioremap(rom_address, 0x8000000);
-
- unsigned char *from = (unsigned char *) virt_addr;
- unsigned char *to = (unsigned char *) copy_address;
- for (j = 0; j < 65536 /*rom_size*/; j++)
- *to++ = *from++;
- }
-
- pci_write_config_dword(dev, PCI_ROM_ADDRESS, 0);
-
- printk("Copy is done\n");
-
- return copy_address;
+done:
+ pci_unmap_rom(dev, rom_address);
+ return rom_copy;
}
static int __devinit xgifb_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
- u16 reg16;
u8 reg, reg1;
u8 CR48, CR38;
+ int ret;
+
if (XGIfb_off)
return -ENXIO;
@@ -2947,9 +2179,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
xgi_video_info.chip_id = pdev->device;
pci_read_config_byte(pdev, PCI_REVISION_ID, &xgi_video_info.revision_id);
- pci_read_config_word(pdev, PCI_COMMAND, &reg16);
XGIhw_ext.jChipRevision = xgi_video_info.revision_id;
- XGIvga_enabled = reg16 & 0x01;
xgi_video_info.pcibus = pdev->bus->number;
xgi_video_info.pcislot = PCI_SLOT(pdev->devfn);
@@ -2959,15 +2189,17 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
xgi_video_info.video_base = pci_resource_start(pdev, 0);
xgi_video_info.mmio_base = pci_resource_start(pdev, 1);
- XGIfb_mmio_size = pci_resource_len(pdev, 1);
+ xgi_video_info.mmio_size = pci_resource_len(pdev, 1);
xgi_video_info.vga_base = pci_resource_start(pdev, 2) + 0x30;
XGIhw_ext.pjIOAddress = (unsigned char *)xgi_video_info.vga_base;
/* XGI_Pr.RelIO = ioremap(pci_resource_start(pdev, 2), 128) + 0x30; */
printk("XGIfb: Relocate IO address: %lx [%08lx]\n",
(unsigned long)pci_resource_start(pdev, 2), XGI_Pr.RelIO);
- if (pci_enable_device(pdev))
- return -EIO;
+ if (pci_enable_device(pdev)) {
+ ret = -EIO;
+ goto error;
+ }
XGIRegInit(&XGI_Pr, (unsigned long)XGIhw_ext.pjIOAddress);
@@ -2976,7 +2208,8 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
if (reg1 != 0xa1) { /*I/O error */
printk("\nXGIfb: I/O error!!!");
- return -EIO;
+ ret = -EIO;
+ goto error;
}
switch (xgi_video_info.chip_id) {
@@ -2987,54 +2220,34 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
xgi_video_info.chip = XG21;
else
xgi_video_info.chip = XG20;
- XGIfb_hwcursor_size = HW_CURSOR_AREA_SIZE_315 * 2;
XGIfb_CRT2_write_enable = IND_XGI_CRT2_WRITE_ENABLE_315;
break;
case PCI_DEVICE_ID_XG_40:
xgi_video_info.chip = XG40;
- XGIfb_hwcursor_size = HW_CURSOR_AREA_SIZE_315 * 2;
XGIfb_CRT2_write_enable = IND_XGI_CRT2_WRITE_ENABLE_315;
break;
case PCI_DEVICE_ID_XG_41:
xgi_video_info.chip = XG41;
- XGIfb_hwcursor_size = HW_CURSOR_AREA_SIZE_315 * 2;
XGIfb_CRT2_write_enable = IND_XGI_CRT2_WRITE_ENABLE_315;
break;
case PCI_DEVICE_ID_XG_42:
xgi_video_info.chip = XG42;
- XGIfb_hwcursor_size = HW_CURSOR_AREA_SIZE_315 * 2;
XGIfb_CRT2_write_enable = IND_XGI_CRT2_WRITE_ENABLE_315;
break;
case PCI_DEVICE_ID_XG_27:
xgi_video_info.chip = XG27;
- XGIfb_hwcursor_size = HW_CURSOR_AREA_SIZE_315 * 2;
XGIfb_CRT2_write_enable = IND_XGI_CRT2_WRITE_ENABLE_315;
break;
default:
- return -ENODEV;
+ ret = -ENODEV;
+ goto error;
}
printk("XGIfb:chipid = %x\n", xgi_video_info.chip);
XGIhw_ext.jChipType = xgi_video_info.chip;
- switch (xgi_video_info.chip) {
- case XG40:
- case XG41:
- case XG42:
- case XG45:
- case XG20:
- case XG21:
- case XG27:
- XGIhw_ext.bIntegratedMMEnabled = 1;
- break;
- default:
- break;
- }
-
- XGIhw_ext.pDevice = NULL;
if ((xgi_video_info.chip == XG21) || (XGIfb_userom)) {
- XGIhw_ext.pjVirtualRomBase = attempt_map_rom(pdev, VBIOS_BUF);
-
+ XGIhw_ext.pjVirtualRomBase = xgifb_copy_rom(pdev);
if (XGIhw_ext.pjVirtualRomBase)
printk(KERN_INFO "XGIfb: Video ROM found and mapped to %p\n", XGIhw_ext.pjVirtualRomBase);
else
@@ -3043,64 +2256,12 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
XGIhw_ext.pjVirtualRomBase = NULL;
printk(KERN_INFO "XGIfb: Video ROM usage disabled\n");
}
- XGIhw_ext.pjCustomizedROMImage = NULL;
- XGIhw_ext.bSkipDramSizing = 0;
XGIhw_ext.pQueryVGAConfigSpace = &XGIfb_query_VGA_config_space;
- /* XGIhw_ext.pQueryNorthBridgeSpace = &XGIfb_query_north_bridge_space; */
- strcpy(XGIhw_ext.szVBIOSVer, "0.84");
-
- XGIhw_ext.pSR = vmalloc(sizeof(struct XGI_DSReg) * SR_BUFFER_SIZE);
- if (XGIhw_ext.pSR == NULL) {
- printk(KERN_ERR "XGIfb: Fatal error: Allocating SRReg space failed.\n");
- return -ENODEV;
- }
- XGIhw_ext.pSR[0].jIdx = XGIhw_ext.pSR[0].jVal = 0xFF;
- XGIhw_ext.pCR = vmalloc(sizeof(struct XGI_DSReg) * CR_BUFFER_SIZE);
- if (XGIhw_ext.pCR == NULL) {
- vfree(XGIhw_ext.pSR);
- printk(KERN_ERR "XGIfb: Fatal error: Allocating CRReg space failed.\n");
- return -ENODEV;
- }
- XGIhw_ext.pCR[0].jIdx = XGIhw_ext.pCR[0].jVal = 0xFF;
-
- if (!XGIvga_enabled) {
- /* Mapping Max FB Size for 315 Init */
- XGIhw_ext.pjVideoMemoryAddress = ioremap(xgi_video_info.video_base, 0x10000000);
- if ((xgifb_mode_idx < 0) || ((XGIbios_mode[xgifb_mode_idx].mode_no) != 0xFF)) {
-#ifdef LINUXBIOS
- printk("XGIfb: XGIInit() ...");
- /* XGIInitNewt for LINUXBIOS only */
- if (XGIInitNew(&XGIhw_ext))
- printk("OK\n");
- else
- printk("Fail\n");
-#endif
-
- outXGIIDXREG(XGISR, IND_XGI_PASSWORD, XGI_PASSWORD);
-
- }
- }
-#ifdef LINUXBIOS
- else {
- XGIhw_ext.pjVideoMemoryAddress = ioremap(xgi_video_info.video_base, 0x10000000);
- if ((xgifb_mode_idx < 0) || ((XGIbios_mode[xgifb_mode_idx].mode_no) != 0xFF)) {
-
- outXGIIDXREG(XGISR, IND_XGI_PASSWORD, XGI_PASSWORD);
-
- /* yilin Because no VBIOS DRAM Sizing, Dram size will error. */
- /* Set SR13 ,14 temporarily for UDtech */
- outXGIIDXREG(XGISR, 0x13, 0x45);
- outXGIIDXREG(XGISR, 0x14, 0x51);
-
- }
- }
-#endif
if (XGIfb_get_dram_size()) {
- vfree(XGIhw_ext.pSR);
- vfree(XGIhw_ext.pCR);
printk(KERN_INFO "XGIfb: Fatal error: Unable to determine RAM size.\n");
- return -ENODEV;
+ ret = -ENODEV;
+ goto error;
}
if ((xgifb_mode_idx < 0) || ((XGIbios_mode[xgifb_mode_idx].mode_no) != 0xFF)) {
@@ -3116,37 +2277,35 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
printk("unable request memory size %x", xgi_video_info.video_size);
printk(KERN_ERR "XGIfb: Fatal error: Unable to reserve frame buffer memory\n");
printk(KERN_ERR "XGIfb: Is there another framebuffer driver active?\n");
- vfree(XGIhw_ext.pSR);
- vfree(XGIhw_ext.pCR);
- return -ENODEV;
+ ret = -ENODEV;
+ goto error;
}
- if (!request_mem_region(xgi_video_info.mmio_base, XGIfb_mmio_size, "XGIfb MMIO")) {
+ if (!request_mem_region(xgi_video_info.mmio_base,
+ xgi_video_info.mmio_size,
+ "XGIfb MMIO")) {
printk(KERN_ERR "XGIfb: Fatal error: Unable to reserve MMIO region\n");
- release_mem_region(xgi_video_info.video_base, xgi_video_info.video_size);
- vfree(XGIhw_ext.pSR);
- vfree(XGIhw_ext.pCR);
- return -ENODEV;
+ ret = -ENODEV;
+ goto error_0;
}
xgi_video_info.video_vbase = XGIhw_ext.pjVideoMemoryAddress =
ioremap(xgi_video_info.video_base, xgi_video_info.video_size);
- xgi_video_info.mmio_vbase = ioremap(xgi_video_info.mmio_base, XGIfb_mmio_size);
+ xgi_video_info.mmio_vbase = ioremap(xgi_video_info.mmio_base,
+ xgi_video_info.mmio_size);
printk(KERN_INFO "XGIfb: Framebuffer at 0x%lx, mapped to 0x%p, size %dk\n",
xgi_video_info.video_base, xgi_video_info.video_vbase, xgi_video_info.video_size / 1024);
printk(KERN_INFO "XGIfb: MMIO at 0x%lx, mapped to 0x%p, size %ldk\n",
- xgi_video_info.mmio_base, xgi_video_info.mmio_vbase, XGIfb_mmio_size / 1024);
+ xgi_video_info.mmio_base, xgi_video_info.mmio_vbase,
+ xgi_video_info.mmio_size / 1024);
printk("XGIfb: XGIInitNew() ...");
if (XGIInitNew(&XGIhw_ext))
printk("OK\n");
else
printk("Fail\n");
- if (XGIfb_heap_init())
- printk(KERN_WARNING "XGIfb: Failed to initialize offscreen memory heap\n");
-
xgi_video_info.mtrr = (unsigned int) 0;
if ((xgifb_mode_idx < 0) || ((XGIbios_mode[xgifb_mode_idx].mode_no) != 0xFF)) {
@@ -3162,7 +2321,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
for (m = 0; m < sizeof(XGI21_LCDCapList)/sizeof(struct XGI21_LVDSCapStruct); m++) {
if ((XGI21_LCDCapList[m].LVDSHDE == XGIbios_mode[xgifb_mode_idx].xres) &&
(XGI21_LCDCapList[m].LVDSVDE == XGIbios_mode[xgifb_mode_idx].yres)) {
- XGINew_SetReg1(XGI_Pr.P3d4, 0x36, m);
+ xgifb_reg_set(XGI_Pr.P3d4, 0x36, m);
}
}
}
@@ -3265,7 +2424,6 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
XGIfb_detectedpdc = 0;
XGIfb_detectedlcda = 0xff;
-#ifndef LINUXBIOS
/* TW: Try to find about LCDA */
@@ -3298,8 +2456,6 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
}
-#endif
-
if (xgifb_mode_idx >= 0)
xgifb_mode_idx = XGIfb_validate_mode(xgifb_mode_idx);
@@ -3387,13 +2543,6 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
}
- xgi_video_info.accel = 0;
- if (XGIfb_accel) {
- xgi_video_info.accel = -1;
- default_var.accel_flags |= FB_ACCELF_TEXT;
- XGIfb_initaccel();
- }
-
fb_info->flags = FBINFO_FLAG_DEFAULT;
fb_info->var = default_var;
fb_info->fix = XGIfb_fix;
@@ -3413,8 +2562,10 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
printk(KERN_INFO "XGIfb: Added MTRRs\n");
#endif
- if (register_framebuffer(fb_info) < 0)
- return -EINVAL;
+ if (register_framebuffer(fb_info) < 0) {
+ ret = -EINVAL;
+ goto error_1;
+ }
XGIfb_registered = 1;
@@ -3426,6 +2577,18 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
dumpVGAReg();
return 0;
+
+error_1:
+ iounmap(xgi_video_info.mmio_vbase);
+ iounmap(xgi_video_info.video_vbase);
+ release_mem_region(xgi_video_info.mmio_base, xgi_video_info.mmio_size);
+error_0:
+ release_mem_region(xgi_video_info.video_base,
+ xgi_video_info.video_size);
+error:
+ vfree(XGIhw_ext.pjVirtualRomBase);
+ framebuffer_release(fb_info);
+ return ret;
}
/*****************************************************/
@@ -3434,15 +2597,16 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
static void __devexit xgifb_remove(struct pci_dev *pdev)
{
- /* Unregister the framebuffer */
- /* if (xgi_video_info.registered) { */
unregister_framebuffer(fb_info);
+ iounmap(xgi_video_info.mmio_vbase);
+ iounmap(xgi_video_info.video_vbase);
+ release_mem_region(xgi_video_info.mmio_base, xgi_video_info.mmio_size);
+ release_mem_region(xgi_video_info.video_base,
+ xgi_video_info.video_size);
+ vfree(XGIhw_ext.pjVirtualRomBase);
framebuffer_release(fb_info);
- /* } */
-
pci_set_drvdata(pdev, NULL);
-
-};
+}
static struct pci_driver xgifb_driver = {
.name = "xgifb",
@@ -3480,9 +2644,7 @@ static char *forcecrt2type = NULL;
static int forcecrt1 = -1;
static int pdc = -1;
static int pdc1 = -1;
-static int noaccel = -1;
static int noypan = -1;
-static int nomax = -1;
static int userom = -1;
static int useoem = -1;
static char *tvstandard = NULL;
@@ -3501,9 +2663,7 @@ MODULE_LICENSE("GPL");
MODULE_AUTHOR("XGITECH , Others");
module_param(mem, int, 0);
-module_param(noaccel, int, 0);
module_param(noypan, int, 0);
-module_param(nomax, int, 0);
module_param(userom, int, 0);
module_param(useoem, int, 0);
module_param(mode, charp, 0);
@@ -3526,30 +2686,10 @@ module_param(resetcard, int, 0);
module_param(videoram, int, 0);
#endif
-MODULE_PARM_DESC(mem,
- "\nDetermines the beginning of the video memory heap in KB. This heap is used\n"
- "for video RAM management for eg. DRM/DRI. On 300 series, the default depends\n"
- "on the amount of video RAM available. If 8MB of video RAM or less is available,\n"
- "the heap starts at 4096KB, if between 8 and 16MB are available at 8192KB,\n"
- "otherwise at 12288KB. On 315 and Xabre series, the heap size is 32KB by default.\n"
- "The value is to be specified without 'KB' and must match the MaxXFBMem setting\n"
- "for XFree86 4.x/X.org 6.7 and later.\n");
-
-MODULE_PARM_DESC(noaccel,
- "\nIf set to anything other than 0, 2D acceleration will be disabled.\n"
- "(default: 0)\n");
-
MODULE_PARM_DESC(noypan,
"\nIf set to anything other than 0, y-panning will be disabled and scrolling\n"
"will be performed by redrawing the screen. (default: 0)\n");
-MODULE_PARM_DESC(nomax,
- "\nIf y-panning is enabled, xgifb will by default use the entire available video\n"
- "memory for the virtual screen in order to optimize scrolling performance. If\n"
- "this is set to anything other than 0, xgifb will not do this and thereby\n"
- "enable the user to positively specify a virtual Y size of the screen using\n"
- "fbset. (default: 0)\n");
-
MODULE_PARM_DESC(mode,
"\nSelects the desired default display mode in the format XxYxDepth,\n"
"eg. 1024x768x16. Other formats supported include XxY-Depth and\n"
@@ -3647,7 +2787,3 @@ module_init(xgifb_init_module);
module_exit(xgifb_remove_module);
#endif /* /MODULE */
-
-EXPORT_SYMBOL(XGI_malloc);
-EXPORT_SYMBOL(XGI_free);
-
diff --git a/drivers/staging/xgifb/XGIfb.h b/drivers/staging/xgifb/XGIfb.h
index ef86a64d6996..b43a7588e57d 100644
--- a/drivers/staging/xgifb/XGIfb.h
+++ b/drivers/staging/xgifb/XGIfb.h
@@ -1,6 +1,5 @@
#ifndef _LINUX_XGIFB
#define _LINUX_XGIFB
-#include <linux/spinlock.h>
#include <asm/ioctl.h>
#include <asm/types.h>
@@ -28,23 +27,6 @@
#endif
enum XGI_CHIP_TYPE {
- XGI_VGALegacy = 0,
- XGI_300,
- XGI_630,
- XGI_730,
- XGI_540,
- XGI_315H,
- XGI_315,
- XGI_315PRO,
- XGI_550,
- XGI_640,
- XGI_740,
- XGI_650,
- XGI_650M,
- XGI_330 = 16,
- XGI_660,
- XGI_661,
- XGI_760,
XG40 = 32,
XG41,
XG42,
@@ -52,7 +34,6 @@ enum XGI_CHIP_TYPE {
XG20 = 48,
XG21,
XG27,
- MAX_XGI_CHIP
};
enum xgi_tvtype {
@@ -65,36 +46,6 @@ enum xgi_tvtype {
TVMODE_TOTAL
};
-
-struct XGIfb_info {
- unsigned long XGIfb_id;
- int chip_id; /* PCI ID of detected chip */
- int memory; /* video memory in KB which XGIfb manages */
- int heapstart; /* heap start (= XGIfb "mem" argument) in KB */
- unsigned char fbvidmode; /* current XGIfb mode */
-
- unsigned char XGIfb_version;
- unsigned char XGIfb_revision;
- unsigned char XGIfb_patchlevel;
-
- unsigned char XGIfb_caps; /* XGIfb capabilities */
-
- int XGIfb_tqlen; /* turbo queue length (in KB) */
-
- unsigned int XGIfb_pcibus; /* The card's PCI ID */
- unsigned int XGIfb_pcislot;
- unsigned int XGIfb_pcifunc;
-
- unsigned char XGIfb_lcdpdc; /* PanelDelayCompensation */
-
- unsigned char XGIfb_lcda; /* Detected status of LCDA for low res/text modes */
-
- char reserved[235]; /* for future use */
-};
-
-
-
-
enum xgi_tv_plug { /* vicki@030226 */
// TVPLUG_Legacy = 0,
// TVPLUG_COMPOSITE,
@@ -113,58 +64,16 @@ enum xgi_tv_plug { /* vicki@030226 */
TVPLUG_TOTAL
};
-
-struct mode_info {
- int bpp;
- int xres;
- int yres;
- int v_xres;
- int v_yres;
- int org_x;
- int org_y;
- unsigned int vrate;
-};
-
-struct ap_data {
- struct mode_info minfo;
- unsigned long iobase;
- unsigned int mem_size;
- unsigned long disp_state;
- enum XGI_CHIP_TYPE chip;
- unsigned char hasVB;
- enum xgi_tvtype TV_type;
- enum xgi_tv_plug TV_plug;
- unsigned long version;
- char reserved[256];
-};
-
-
-
-/* If changing this, vgatypes.h must also be changed (for X driver) */
-
-
-/*
- * NOTE! The ioctl types used to be "size_t" by mistake, but were
- * really meant to be __u32. Changed to "__u32" even though that
- * changes the value on 64-bit architectures, because the value
- * (with a 4-byte size) is also hardwired in vgatypes.h for user
- * space exports. So "__u32" is actually more compatible, duh!
- */
-#define XGIFB_GET_INFO _IOR('n',0xF8,__u32)
-#define XGIFB_GET_VBRSTATUS _IOR('n',0xF9,__u32)
-
-
-
struct video_info{
int chip_id;
unsigned int video_size;
unsigned long video_base;
char * video_vbase;
unsigned long mmio_base;
+ unsigned long mmio_size;
char * mmio_vbase;
unsigned long vga_base;
unsigned long mtrr;
- unsigned long heapstart;
int video_bpp;
int video_cmap_len;
@@ -189,13 +98,10 @@ struct video_info{
unsigned long XGI310_AccelDepth;
unsigned long CommandReg;
- spinlock_t lockaccel;
-
unsigned int pcibus;
unsigned int pcislot;
unsigned int pcifunc;
- int accel;
unsigned short subsysvendor;
unsigned short subsysdevice;
diff --git a/drivers/staging/xgifb/vb_ext.c b/drivers/staging/xgifb/vb_ext.c
index 80c78185a2e2..d7c1b2ebed17 100644
--- a/drivers/staging/xgifb/vb_ext.c
+++ b/drivers/staging/xgifb/vb_ext.c
@@ -9,41 +9,16 @@
#include "vb_util.h"
#include "vb_setmode.h"
#include "vb_ext.h"
-extern unsigned char XGI330_SoftSetting;
-extern unsigned char XGI330_OutputSelect;
-extern unsigned short XGI330_RGBSenseData2;
-extern unsigned short XGI330_YCSenseData2;
-extern unsigned short XGI330_VideoSenseData2;
-void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo);
-unsigned char XGINew_GetPanelID(struct vb_device_info *pVBInfo);
-unsigned short XGINew_SenseLCD(struct xgi_hw_device_info *,
- struct vb_device_info *pVBInfo);
-unsigned char XGINew_GetLCDDDCInfo(
- struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo);
-void XGISetDPMS(struct xgi_hw_device_info *pXGIHWDE,
- unsigned long VESA_POWER_STATE);
-unsigned char XGINew_BridgeIsEnable(struct xgi_hw_device_info *,
- struct vb_device_info *pVBInfo);
-unsigned char XGINew_Sense(unsigned short tempbx, unsigned short tempcx,
- struct vb_device_info *pVBInfo);
-unsigned char XGINew_SenseHiTV(struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo);
/**************************************************************
*********************** Dynamic Sense ************************
*************************************************************/
-void XGI_WaitDisplay(void);
-unsigned char XGI_Is301C(struct vb_device_info *);
-unsigned char XGI_Is301LV(struct vb_device_info *);
-
static unsigned char XGINew_Is301B(struct vb_device_info *pVBInfo)
{
unsigned short flag;
- flag = XGINew_GetReg1(pVBInfo->Part4Port, 0x01);
+ flag = xgifb_reg_get(pVBInfo->Part4Port, 0x01);
if (flag > 0x0B0)
return 0; /* 301b */
@@ -51,43 +26,21 @@ static unsigned char XGINew_Is301B(struct vb_device_info *pVBInfo)
return 1;
}
-unsigned char XGI_Is301C(struct vb_device_info *pVBInfo)
-{
- if ((XGINew_GetReg1(pVBInfo->Part4Port, 0x01) & 0xF0) == 0xC0)
- return 1;
-
- if (XGINew_GetReg1(pVBInfo->Part4Port, 0x01) >= 0xD0) {
- if (XGINew_GetReg1(pVBInfo->Part4Port, 0x39) == 0xE0)
- return 1;
- }
-
- return 0;
-}
-
-unsigned char XGI_Is301LV(struct vb_device_info *pVBInfo)
-{
- if (XGINew_GetReg1(pVBInfo->Part4Port, 0x01) >= 0xD0) {
- if (XGINew_GetReg1(pVBInfo->Part4Port, 0x39) == 0xFF)
- return 1;
- }
- return 0;
-}
-
-unsigned char XGINew_Sense(unsigned short tempbx, unsigned short tempcx, struct vb_device_info *pVBInfo)
+static unsigned char XGINew_Sense(unsigned short tempbx, unsigned short tempcx, struct vb_device_info *pVBInfo)
{
unsigned short temp, i, tempch;
temp = tempbx & 0xFF;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x11, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x11, temp);
temp = (tempbx & 0xFF00) >> 8;
temp |= (tempcx & 0x00FF);
- XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x10, ~0x1F, temp);
+ xgifb_reg_and_or(pVBInfo->Part4Port, 0x10, ~0x1F, temp);
for (i = 0; i < 10; i++)
XGI_LongWait(pVBInfo);
tempch = (tempcx & 0x7F00) >> 8;
- temp = XGINew_GetReg1(pVBInfo->Part4Port, 0x03);
+ temp = xgifb_reg_get(pVBInfo->Part4Port, 0x03);
temp = temp ^ (0x0E);
temp &= tempch;
@@ -97,347 +50,7 @@ unsigned char XGINew_Sense(unsigned short tempbx, unsigned short tempcx, struct
return 0;
}
-void XGISetDPMS(struct xgi_hw_device_info *pXGIHWDE, unsigned long VESA_POWER_STATE)
-{
- unsigned short ModeNo, ModeIdIndex;
- unsigned char temp;
- struct vb_device_info VBINF;
- struct vb_device_info *pVBInfo = &VBINF;
- pVBInfo->BaseAddr = (unsigned long) pXGIHWDE->pjIOAddress;
- pVBInfo->ROMAddr = pXGIHWDE->pjVirtualRomBase;
-
- pVBInfo->IF_DEF_LVDS = 0;
- pVBInfo->IF_DEF_CH7005 = 0;
- pVBInfo->IF_DEF_HiVision = 1;
- pVBInfo->IF_DEF_LCDA = 1;
- pVBInfo->IF_DEF_CH7017 = 0;
- pVBInfo->IF_DEF_YPbPr = 1;
- pVBInfo->IF_DEF_CRT2Monitor = 0;
- pVBInfo->IF_DEF_VideoCapture = 0;
- pVBInfo->IF_DEF_ScaleLCD = 0;
- pVBInfo->IF_DEF_OEMUtil = 0;
- pVBInfo->IF_DEF_PWD = 0;
-
- InitTo330Pointer(pXGIHWDE->jChipType, pVBInfo);
- ReadVBIOSTablData(pXGIHWDE->jChipType, pVBInfo);
-
- pVBInfo->P3c4 = pVBInfo->BaseAddr + 0x14;
- pVBInfo->P3d4 = pVBInfo->BaseAddr + 0x24;
- pVBInfo->P3c0 = pVBInfo->BaseAddr + 0x10;
- pVBInfo->P3ce = pVBInfo->BaseAddr + 0x1e;
- pVBInfo->P3c2 = pVBInfo->BaseAddr + 0x12;
- pVBInfo->P3ca = pVBInfo->BaseAddr + 0x1a;
- pVBInfo->P3c6 = pVBInfo->BaseAddr + 0x16;
- pVBInfo->P3c7 = pVBInfo->BaseAddr + 0x17;
- pVBInfo->P3c8 = pVBInfo->BaseAddr + 0x18;
- pVBInfo->P3c9 = pVBInfo->BaseAddr + 0x19;
- pVBInfo->P3da = pVBInfo->BaseAddr + 0x2A;
- pVBInfo->Part0Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_00;
- pVBInfo->Part1Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_04;
- pVBInfo->Part2Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_10;
- pVBInfo->Part3Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_12;
- pVBInfo->Part4Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14;
- pVBInfo->Part5Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14 + 2;
-
- if (pXGIHWDE->jChipType == XG27) {
- if ((XGINew_GetReg1(pVBInfo->P3d4, 0x38) & 0xE0) == 0xC0) {
- if (XGINew_GetReg1(pVBInfo->P3d4, 0x30) & 0x20)
- pVBInfo->IF_DEF_LVDS = 1;
- }
- }
-
- if (pVBInfo->IF_DEF_CH7007 == 0)
- XGINew_SetModeScratch(pXGIHWDE, pVBInfo);
-
- XGINew_SetReg1(pVBInfo->P3c4, 0x05, 0x86); /* 1.Openkey */
- XGI_UnLockCRT2(pXGIHWDE, pVBInfo);
- ModeNo = XGINew_GetReg1(pVBInfo->P3d4, 0x34);
- XGI_SearchModeID(ModeNo, &ModeIdIndex, pVBInfo);
- XGI_GetVGAType(pXGIHWDE, pVBInfo);
-
- if ((pXGIHWDE->ujVBChipID == VB_CHIP_301) || (pXGIHWDE->ujVBChipID == VB_CHIP_302) || (pVBInfo->IF_DEF_CH7007 == 1)) {
- XGI_GetVBType(pVBInfo);
- XGI_GetVBInfo(ModeNo, ModeIdIndex, pXGIHWDE, pVBInfo);
- XGI_GetTVInfo(ModeNo, ModeIdIndex, pVBInfo);
- XGI_GetLCDInfo(ModeNo, ModeIdIndex, pVBInfo);
- }
-
- if (VESA_POWER_STATE == 0x00000400)
- XGINew_SetReg1(pVBInfo->Part4Port, 0x31, (unsigned char) (XGINew_GetReg1(pVBInfo->Part4Port, 0x31) & 0xFE));
- else
- XGINew_SetReg1(pVBInfo->Part4Port, 0x31, (unsigned char) (XGINew_GetReg1(pVBInfo->Part4Port, 0x31) | 0x01));
-
- temp = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x1f);
- temp &= 0x3f;
- switch (VESA_POWER_STATE) {
- case 0x00000000: /* on */
- if ((pXGIHWDE->ujVBChipID == VB_CHIP_301) || (pXGIHWDE->ujVBChipID == VB_CHIP_302)) {
- XGINew_SetReg1(pVBInfo->P3c4, 0x1f, (unsigned char) (temp | 0x00));
- XGI_EnableBridge(pXGIHWDE, pVBInfo);
- } else {
- if (pXGIHWDE->jChipType == XG21) {
- if (pVBInfo->IF_DEF_LVDS == 1) {
- XGI_XG21BLSignalVDD(0x01, 0x01, pVBInfo); /* LVDS VDD on */
- XGI_XG21SetPanelDelay(2, pVBInfo);
- }
- }
- if (pXGIHWDE->jChipType == XG27) {
- if (pVBInfo->IF_DEF_LVDS == 1) {
- XGI_XG27BLSignalVDD(0x01, 0x01, pVBInfo); /* LVDS VDD on */
- XGI_XG21SetPanelDelay(2, pVBInfo);
- }
- }
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x1F, ~0xC0, 0x00);
- XGINew_SetRegAND(pVBInfo->P3c4, 0x01, ~0x20); /* CRT on */
-
- if (pXGIHWDE->jChipType == XG21) {
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x38);
- if (temp & 0xE0) {
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x09, ~0x80, 0x80); /* DVO ON */
- XGI_SetXG21FPBits(pVBInfo);
- XGINew_SetRegAND(pVBInfo->P3d4, 0x4A, ~0x20); /* Enable write GPIOF */
- /* XGINew_SetRegANDOR(pVBInfo->P3d4, 0x48, ~0x20, 0x20); *//* LCD Display ON */
- }
- XGI_XG21BLSignalVDD(0x20, 0x20, pVBInfo); /* LVDS signal on */
- XGI_DisplayOn(pXGIHWDE, pVBInfo);
- }
- if (pXGIHWDE->jChipType == XG27) {
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x38);
- if (temp & 0xE0) {
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x09, ~0x80, 0x80); /* DVO ON */
- XGI_SetXG27FPBits(pVBInfo);
- XGINew_SetRegAND(pVBInfo->P3d4, 0x4A, ~0x20); /* Enable write GPIOF */
- /* XGINew_SetRegANDOR(pVBInfo->P3d4, 0x48, ~0x20, 0x20); *//* LCD Display ON */
- }
- XGI_XG27BLSignalVDD(0x20, 0x20, pVBInfo); /* LVDS signal on */
- XGI_DisplayOn(pXGIHWDE, pVBInfo);
- }
- }
- break;
-
- case 0x00000100: /* standby */
- if (pXGIHWDE->jChipType >= XG21)
- XGI_DisplayOff(pXGIHWDE, pVBInfo);
- XGINew_SetReg1(pVBInfo->P3c4, 0x1f, (unsigned char) (temp | 0x40));
- break;
-
- case 0x00000200: /* suspend */
- if (pXGIHWDE->jChipType == XG21) {
- XGI_DisplayOff(pXGIHWDE, pVBInfo);
- XGI_XG21BLSignalVDD(0x20, 0x00, pVBInfo); /* LVDS signal off */
- }
- if (pXGIHWDE->jChipType == XG27) {
- XGI_DisplayOff(pXGIHWDE, pVBInfo);
- XGI_XG27BLSignalVDD(0x20, 0x00, pVBInfo); /* LVDS signal off */
- }
- XGINew_SetReg1(pVBInfo->P3c4, 0x1f, (unsigned char) (temp | 0x80));
- break;
-
- case 0x00000400: /* off */
- if ((pXGIHWDE->ujVBChipID == VB_CHIP_301) || (pXGIHWDE->ujVBChipID == VB_CHIP_302)) {
- XGINew_SetReg1(pVBInfo->P3c4, 0x1f, (unsigned char) (temp | 0xc0));
- XGI_DisableBridge(pXGIHWDE, pVBInfo);
- } else {
- if (pXGIHWDE->jChipType == XG21) {
- XGI_DisplayOff(pXGIHWDE, pVBInfo);
-
- XGI_XG21BLSignalVDD(0x20, 0x00, pVBInfo); /* LVDS signal off */
-
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x38);
- if (temp & 0xE0) {
- XGINew_SetRegAND(pVBInfo->P3c4, 0x09, ~0x80); /* DVO Off */
- XGINew_SetRegAND(pVBInfo->P3d4, 0x4A, ~0x20); /* Enable write GPIOF */
- /* XGINew_SetRegAND(pVBInfo->P3d4, 0x48, ~0x20); *//* LCD Display OFF */
- }
- }
- if (pXGIHWDE->jChipType == XG27) {
- XGI_DisplayOff(pXGIHWDE, pVBInfo);
-
- XGI_XG27BLSignalVDD(0x20, 0x00, pVBInfo); /* LVDS signal off */
-
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x38);
- if (temp & 0xE0)
- XGINew_SetRegAND(pVBInfo->P3c4, 0x09, ~0x80); /* DVO Off */
- }
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x1F, ~0xC0, 0xC0);
- XGINew_SetRegOR(pVBInfo->P3c4, 0x01, 0x20); /* CRT Off */
-
- if ((pXGIHWDE->jChipType == XG21) && (pVBInfo->IF_DEF_LVDS == 1)) {
- XGI_XG21SetPanelDelay(4, pVBInfo);
- XGI_XG21BLSignalVDD(0x01, 0x00, pVBInfo); /* LVDS VDD off */
- XGI_XG21SetPanelDelay(5, pVBInfo);
- }
- if ((pXGIHWDE->jChipType == XG27) && (pVBInfo->IF_DEF_LVDS == 1)) {
- XGI_XG21SetPanelDelay(4, pVBInfo);
- XGI_XG27BLSignalVDD(0x01, 0x00, pVBInfo); /* LVDS VDD off */
- XGI_XG21SetPanelDelay(5, pVBInfo);
- }
- }
- break;
-
- default:
- break;
- }
- XGI_LockCRT2(pXGIHWDE, pVBInfo);
-}
-
-void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
-{
- unsigned short tempax = 0, tempbx, tempcx, temp, P2reg0 = 0, SenseModeNo = 0,
- OutputSelect = *pVBInfo->pOutputSelect, ModeIdIndex, i;
- pVBInfo->BaseAddr = (unsigned long) HwDeviceExtension->pjIOAddress;
-
- if (pVBInfo->IF_DEF_LVDS == 1) {
- tempax = XGINew_GetReg1(pVBInfo->P3c4, 0x1A); /* ynlai 02/27/2002 */
- tempbx = XGINew_GetReg1(pVBInfo->P3c4, 0x1B);
- tempax = ((tempax & 0xFE) >> 1) | (tempbx << 8);
- if (tempax == 0x00) { /* Get Panel id from DDC */
- temp = XGINew_GetLCDDDCInfo(HwDeviceExtension, pVBInfo);
- if (temp == 1) { /* LCD connect */
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x39, 0xFF, 0x01); /* set CR39 bit0="1" */
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x37, 0xEF, 0x00); /* clean CR37 bit4="0" */
- temp = LCDSense;
- } else { /* LCD don't connect */
- temp = 0;
- }
- } else {
- XGINew_GetPanelID(pVBInfo);
- temp = LCDSense;
- }
-
- tempbx = ~(LCDSense | AVIDEOSense | SVIDEOSense);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x32, tempbx, temp);
- } else { /* for 301 */
- if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) { /* for HiVision */
- tempax = XGINew_GetReg1(pVBInfo->P3c4, 0x38);
- temp = tempax & 0x01;
- tempax = XGINew_GetReg1(pVBInfo->P3c4, 0x3A);
- temp = temp | (tempax & 0x02);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x32, 0xA0, temp);
- } else {
- if (XGI_BridgeIsOn(pVBInfo)) {
- P2reg0 = XGINew_GetReg1(pVBInfo->Part2Port, 0x00);
- if (!XGINew_BridgeIsEnable(HwDeviceExtension, pVBInfo)) {
- SenseModeNo = 0x2e;
- /* XGINew_SetReg1(pVBInfo->P3d4, 0x30, 0x41); */
- /* XGISetModeNew(HwDeviceExtension, 0x2e); // ynlai InitMode */
-
- temp = XGI_SearchModeID(SenseModeNo, &ModeIdIndex, pVBInfo);
- XGI_GetVGAType(HwDeviceExtension, pVBInfo);
- XGI_GetVBType(pVBInfo);
- pVBInfo->SetFlag = 0x00;
- pVBInfo->ModeType = ModeVGA;
- pVBInfo->VBInfo = SetCRT2ToRAMDAC | LoadDACFlag | SetInSlaveMode;
- XGI_GetLCDInfo(0x2e, ModeIdIndex, pVBInfo);
- XGI_GetTVInfo(0x2e, ModeIdIndex, pVBInfo);
- XGI_EnableBridge(HwDeviceExtension, pVBInfo);
- XGI_SetCRT2Group301(SenseModeNo, HwDeviceExtension, pVBInfo);
- XGI_SetCRT2ModeRegs(0x2e, HwDeviceExtension, pVBInfo);
- /* XGI_DisableBridge( HwDeviceExtension, pVBInfo ) ; */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x01, 0xDF, 0x20); /* Display Off 0212 */
- for (i = 0; i < 20; i++)
- XGI_LongWait(pVBInfo);
- }
- XGINew_SetReg1(pVBInfo->Part2Port, 0x00, 0x1c);
- tempax = 0;
- tempbx = *pVBInfo->pRGBSenseData;
-
- if (!(XGINew_Is301B(pVBInfo)))
- tempbx = *pVBInfo->pRGBSenseData2;
-
- tempcx = 0x0E08;
- if (XGINew_Sense(tempbx, tempcx, pVBInfo)) {
- if (XGINew_Sense(tempbx, tempcx, pVBInfo))
- tempax |= Monitor2Sense;
- }
-
- if (pVBInfo->VBType & VB_XGI301C)
- XGINew_SetRegOR(pVBInfo->Part4Port, 0x0d, 0x04);
-
- if (XGINew_SenseHiTV(HwDeviceExtension, pVBInfo)) { /* add by kuku for Multi-adapter sense HiTV */
- tempax |= HiTVSense;
- if ((pVBInfo->VBType & VB_XGI301C))
- tempax ^= (HiTVSense | YPbPrSense);
- }
-
- if (!(tempax & (HiTVSense | YPbPrSense))) { /* start */
-
- tempbx = *pVBInfo->pYCSenseData;
-
- if (!(XGINew_Is301B(pVBInfo)))
- tempbx = *pVBInfo->pYCSenseData2;
-
- tempcx = 0x0604;
- if (XGINew_Sense(tempbx, tempcx, pVBInfo)) {
- if (XGINew_Sense(tempbx, tempcx, pVBInfo))
- tempax |= SVIDEOSense;
- }
-
- if (OutputSelect & BoardTVType) {
- tempbx = *pVBInfo->pVideoSenseData;
-
- if (!(XGINew_Is301B(pVBInfo)))
- tempbx = *pVBInfo->pVideoSenseData2;
-
- tempcx = 0x0804;
- if (XGINew_Sense(tempbx, tempcx, pVBInfo)) {
- if (XGINew_Sense(tempbx, tempcx, pVBInfo))
- tempax |= AVIDEOSense;
- }
- } else {
- if (!(tempax & SVIDEOSense)) {
- tempbx = *pVBInfo->pVideoSenseData;
-
- if (!(XGINew_Is301B(pVBInfo)))
- tempbx = *pVBInfo->pVideoSenseData2;
-
- tempcx = 0x0804;
- if (XGINew_Sense(tempbx, tempcx, pVBInfo)) {
- if (XGINew_Sense(tempbx, tempcx, pVBInfo))
- tempax |= AVIDEOSense;
- }
- }
- }
- }
- } /* end */
- if (!(tempax & Monitor2Sense)) {
- if (XGINew_SenseLCD(HwDeviceExtension, pVBInfo))
- tempax |= LCDSense;
- }
- tempbx = 0;
- tempcx = 0;
- XGINew_Sense(tempbx, tempcx, pVBInfo);
-
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x32, ~0xDF, tempax);
- XGINew_SetReg1(pVBInfo->Part2Port, 0x00, P2reg0);
-
- if (!(P2reg0 & 0x20)) {
- pVBInfo->VBInfo = DisableCRT2Display;
- /* XGI_SetCRT2Group301(SenseModeNo, HwDeviceExtension, pVBInfo); */
- }
- }
- }
- XGI_DisableBridge(HwDeviceExtension, pVBInfo); /* shampoo 0226 */
-
-}
-
-unsigned short XGINew_SenseLCD(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
-{
- /* unsigned short SoftSetting ; */
- unsigned short temp;
-
- if ((HwDeviceExtension->jChipType >= XG20) || (HwDeviceExtension->jChipType >= XG40))
- temp = 0;
- else
- temp = XGINew_GetPanelID(pVBInfo);
-
- if (!temp)
- temp = XGINew_GetLCDDDCInfo(HwDeviceExtension, pVBInfo);
-
- return temp;
-}
-
-unsigned char XGINew_GetLCDDDCInfo(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
+static unsigned char XGINew_GetLCDDDCInfo(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
{
unsigned short temp;
@@ -474,12 +87,12 @@ unsigned char XGINew_GetLCDDDCInfo(struct xgi_hw_device_info *HwDeviceExtension,
default:
break;
}
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x36, 0xF0, temp);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x36, 0xF0, temp);
return 1;
}
}
-unsigned char XGINew_GetPanelID(struct vb_device_info *pVBInfo)
+static unsigned char XGINew_GetPanelID(struct vb_device_info *pVBInfo)
{
unsigned short PanelTypeTable[16] = { SyncNN | PanelRGB18Bit
| Panel800x600 | _PanelType00, SyncNN | PanelRGB18Bit
@@ -501,7 +114,7 @@ unsigned char XGINew_GetPanelID(struct vb_device_info *pVBInfo)
unsigned short tempax, tempbx, temp;
/* unsigned short return_flag; */
- tempax = XGINew_GetReg1(pVBInfo->P3c4, 0x1A);
+ tempax = xgifb_reg_get(pVBInfo->P3c4, 0x1A);
tempbx = tempax & 0x1E;
if (tempax == 0)
@@ -511,7 +124,7 @@ unsigned char XGINew_GetPanelID(struct vb_device_info *pVBInfo)
if (!(tempax & 0x10)) {
if (pVBInfo->IF_DEF_LVDS == 1) {
tempbx = 0;
- temp = XGINew_GetReg1(pVBInfo->P3c4, 0x38);
+ temp = xgifb_reg_get(pVBInfo->P3c4, 0x38);
if (temp & 0x40)
tempbx |= 0x08;
if (temp & 0x20)
@@ -519,7 +132,7 @@ unsigned char XGINew_GetPanelID(struct vb_device_info *pVBInfo)
if (temp & 0x01)
tempbx |= 0x01;
- temp = XGINew_GetReg1(pVBInfo->P3c4, 0x39);
+ temp = xgifb_reg_get(pVBInfo->P3c4, 0x39);
if (temp & 0x80)
tempbx |= 0x04;
} else {
@@ -530,23 +143,23 @@ unsigned char XGINew_GetPanelID(struct vb_device_info *pVBInfo)
tempbx = tempbx >> 1;
temp = tempbx & 0x00F;
- XGINew_SetReg1(pVBInfo->P3d4, 0x36, temp);
+ xgifb_reg_set(pVBInfo->P3d4, 0x36, temp);
tempbx--;
tempbx = PanelTypeTable[tempbx];
temp = (tempbx & 0xFF00) >> 8;
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x37, ~(LCDSyncBit
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x37, ~(LCDSyncBit
| LCDRGB18Bit), temp);
return 1;
}
}
-unsigned char XGINew_BridgeIsEnable(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
+static unsigned char XGINew_BridgeIsEnable(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
{
unsigned short flag;
if (XGI_BridgeIsOn(pVBInfo) == 0) {
- flag = XGINew_GetReg1(pVBInfo->Part1Port, 0x0);
+ flag = xgifb_reg_get(pVBInfo->Part1Port, 0x0);
if (flag & 0x050)
return 1;
@@ -557,7 +170,7 @@ unsigned char XGINew_BridgeIsEnable(struct xgi_hw_device_info *HwDeviceExtension
return 0;
}
-unsigned char XGINew_SenseHiTV(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
+static unsigned char XGINew_SenseHiTV(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
{
unsigned short tempbx, tempcx, temp, i, tempch;
@@ -566,16 +179,16 @@ unsigned char XGINew_SenseHiTV(struct xgi_hw_device_info *HwDeviceExtension, str
tempcx = 0x0604;
temp = tempbx & 0xFF;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x11, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x11, temp);
temp = (tempbx & 0xFF00) >> 8;
temp |= (tempcx & 0x00FF);
- XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x10, ~0x1F, temp);
+ xgifb_reg_and_or(pVBInfo->Part4Port, 0x10, ~0x1F, temp);
for (i = 0; i < 10; i++)
XGI_LongWait(pVBInfo);
tempch = (tempcx & 0xFF00) >> 8;
- temp = XGINew_GetReg1(pVBInfo->Part4Port, 0x03);
+ temp = xgifb_reg_get(pVBInfo->Part4Port, 0x03);
temp = temp ^ (0x0E);
temp &= tempch;
@@ -586,16 +199,16 @@ unsigned char XGINew_SenseHiTV(struct xgi_hw_device_info *HwDeviceExtension, str
tempcx = 0x0804;
temp = tempbx & 0xFF;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x11, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x11, temp);
temp = (tempbx & 0xFF00) >> 8;
temp |= (tempcx & 0x00FF);
- XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x10, ~0x1F, temp);
+ xgifb_reg_and_or(pVBInfo->Part4Port, 0x10, ~0x1F, temp);
for (i = 0; i < 10; i++)
XGI_LongWait(pVBInfo);
tempch = (tempcx & 0xFF00) >> 8;
- temp = XGINew_GetReg1(pVBInfo->Part4Port, 0x03);
+ temp = xgifb_reg_get(pVBInfo->Part4Port, 0x03);
temp = temp ^ (0x0E);
temp &= tempch;
@@ -605,16 +218,16 @@ unsigned char XGINew_SenseHiTV(struct xgi_hw_device_info *HwDeviceExtension, str
tempbx = 0x3FF;
tempcx = 0x0804;
temp = tempbx & 0xFF;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x11, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x11, temp);
temp = (tempbx & 0xFF00) >> 8;
temp |= (tempcx & 0x00FF);
- XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x10, ~0x1F, temp);
+ xgifb_reg_and_or(pVBInfo->Part4Port, 0x10, ~0x1F, temp);
for (i = 0; i < 10; i++)
XGI_LongWait(pVBInfo);
tempch = (tempcx & 0xFF00) >> 8;
- temp = XGINew_GetReg1(pVBInfo->Part4Port, 0x03);
+ temp = xgifb_reg_get(pVBInfo->Part4Port, 0x03);
temp = temp ^ (0x0E);
temp &= tempch;
@@ -625,233 +238,152 @@ unsigned char XGINew_SenseHiTV(struct xgi_hw_device_info *HwDeviceExtension, str
}
}
-/* ----------------------------------------------------------------------------
- * Description: Get Panel support
- * O/P :
- * BL: Panel ID=81h for no scaler LVDS
- * BH: Panel enhanced Mode Count
- * CX: Panel H. resolution
- * DX: PAnel V. resolution
- * ----------------------------------------------------------------------------
- */
-static void XGI_XG21Fun14Sub70(struct vb_device_info *pVBInfo, PX86_REGS pBiosArguments)
+void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
{
- unsigned short ModeIdIndex;
- unsigned short ModeNo;
-
- unsigned short EModeCount;
- unsigned short lvdstableindex;
-
- lvdstableindex = XGI_GetLVDSOEMTableIndex(pVBInfo);
- pBiosArguments->h.bl = 0x81;
- pBiosArguments->x.cx = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE;
- pBiosArguments->x.dx = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE;
- EModeCount = 0;
-
- pBiosArguments->x.ax = 0x0014;
- for (ModeIdIndex = 0;; ModeIdIndex++) {
- ModeNo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeID;
- if (pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeID == 0xFF) {
- pBiosArguments->h.bh = (unsigned char) EModeCount;
- return;
+ unsigned short tempax = 0, tempbx, tempcx, temp, P2reg0 = 0, SenseModeNo = 0,
+ OutputSelect = *pVBInfo->pOutputSelect, ModeIdIndex, i;
+ pVBInfo->BaseAddr = (unsigned long) HwDeviceExtension->pjIOAddress;
+
+ if (pVBInfo->IF_DEF_LVDS == 1) {
+ tempax = xgifb_reg_get(pVBInfo->P3c4, 0x1A); /* ynlai 02/27/2002 */
+ tempbx = xgifb_reg_get(pVBInfo->P3c4, 0x1B);
+ tempax = ((tempax & 0xFE) >> 1) | (tempbx << 8);
+ if (tempax == 0x00) { /* Get Panel id from DDC */
+ temp = XGINew_GetLCDDDCInfo(HwDeviceExtension, pVBInfo);
+ if (temp == 1) { /* LCD connect */
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x39, 0xFF, 0x01); /* set CR39 bit0="1" */
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x37, 0xEF, 0x00); /* clean CR37 bit4="0" */
+ temp = LCDSense;
+ } else { /* LCD don't connect */
+ temp = 0;
+ }
+ } else {
+ XGINew_GetPanelID(pVBInfo);
+ temp = LCDSense;
}
- if (!XGI_XG21CheckLVDSMode(ModeNo, ModeIdIndex, pVBInfo))
- continue;
- EModeCount++;
- }
-}
+ tempbx = ~(LCDSense | AVIDEOSense | SVIDEOSense);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x32, tempbx, temp);
+ } else { /* for 301 */
+ if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) { /* for HiVision */
+ tempax = xgifb_reg_get(pVBInfo->P3c4, 0x38);
+ temp = tempax & 0x01;
+ tempax = xgifb_reg_get(pVBInfo->P3c4, 0x3A);
+ temp = temp | (tempax & 0x02);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x32, 0xA0, temp);
+ } else {
+ if (XGI_BridgeIsOn(pVBInfo)) {
+ P2reg0 = xgifb_reg_get(pVBInfo->Part2Port, 0x00);
+ if (!XGINew_BridgeIsEnable(HwDeviceExtension, pVBInfo)) {
+ SenseModeNo = 0x2e;
+ /* xgifb_reg_set(pVBInfo->P3d4, 0x30, 0x41); */
+ /* XGISetModeNew(HwDeviceExtension, 0x2e); // ynlai InitMode */
-/* ----------------------------------------------------------------------------
- *
- * Description: Get Panel mode ID for enhanced mode
- * I/P : BH: EModeIndex ( which < Panel enhanced Mode Count )
- * O/P :
- * BL: Mode ID
- * CX: H. resolution of the assigned by the index
- * DX: V. resolution of the assigned by the index
- *
- * ----------------------------------------------------------------------------
- */
-
-static void XGI_XG21Fun14Sub71(struct vb_device_info *pVBInfo, PX86_REGS pBiosArguments)
-{
+ temp = XGI_SearchModeID(SenseModeNo, &ModeIdIndex, pVBInfo);
+ XGI_GetVGAType(HwDeviceExtension, pVBInfo);
+ XGI_GetVBType(pVBInfo);
+ pVBInfo->SetFlag = 0x00;
+ pVBInfo->ModeType = ModeVGA;
+ pVBInfo->VBInfo = SetCRT2ToRAMDAC | LoadDACFlag | SetInSlaveMode;
+ XGI_GetLCDInfo(0x2e, ModeIdIndex, pVBInfo);
+ XGI_GetTVInfo(0x2e, ModeIdIndex, pVBInfo);
+ XGI_EnableBridge(HwDeviceExtension, pVBInfo);
+ XGI_SetCRT2Group301(SenseModeNo, HwDeviceExtension, pVBInfo);
+ XGI_SetCRT2ModeRegs(0x2e, HwDeviceExtension, pVBInfo);
+ /* XGI_DisableBridge( HwDeviceExtension, pVBInfo ) ; */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x01, 0xDF, 0x20); /* Display Off 0212 */
+ for (i = 0; i < 20; i++)
+ XGI_LongWait(pVBInfo);
+ }
+ xgifb_reg_set(pVBInfo->Part2Port, 0x00, 0x1c);
+ tempax = 0;
+ tempbx = *pVBInfo->pRGBSenseData;
- unsigned short EModeCount;
- unsigned short ModeIdIndex, resindex;
- unsigned short ModeNo;
- unsigned short EModeIndex = pBiosArguments->h.bh;
-
- EModeCount = 0;
- for (ModeIdIndex = 0;; ModeIdIndex++) {
- ModeNo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeID;
- if (pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeID == 0xFF) {
- pBiosArguments->x.ax = 0x0114;
- return;
- }
- if (!XGI_XG21CheckLVDSMode(ModeNo, ModeIdIndex, pVBInfo))
- continue;
-
- if (EModeCount == EModeIndex) {
- resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo);
- pBiosArguments->h.bl = (unsigned char) ModeNo;
- pBiosArguments->x.cx = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */
- pBiosArguments->x.dx = pVBInfo->ModeResInfo[resindex].VTotal; /* yres->bx */
- pBiosArguments->x.ax = 0x0014;
- }
- EModeCount++;
+ if (!(XGINew_Is301B(pVBInfo)))
+ tempbx = *pVBInfo->pRGBSenseData2;
- }
+ tempcx = 0x0E08;
+ if (XGINew_Sense(tempbx, tempcx, pVBInfo)) {
+ if (XGINew_Sense(tempbx, tempcx, pVBInfo))
+ tempax |= Monitor2Sense;
+ }
-}
+ if (pVBInfo->VBType & VB_XGI301C)
+ xgifb_reg_or(pVBInfo->Part4Port, 0x0d, 0x04);
-/* ----------------------------------------------------------------------------
- *
- * Description: Validate Panel modes ID support
- * I/P :
- * BL: ModeID
- * O/P :
- * CX: H. resolution of the assigned by the index
- * DX: V. resolution of the assigned by the index
- *
- * ----------------------------------------------------------------------------
- */
-static void XGI_XG21Fun14Sub72(struct vb_device_info *pVBInfo, PX86_REGS pBiosArguments)
-{
- unsigned short ModeIdIndex, resindex;
- unsigned short ModeNo;
-
- ModeNo = pBiosArguments->h.bl;
- XGI_SearchModeID(ModeNo, &ModeIdIndex, pVBInfo);
- if (!XGI_XG21CheckLVDSMode(ModeNo, ModeIdIndex, pVBInfo)) {
- pBiosArguments->x.cx = 0;
- pBiosArguments->x.dx = 0;
- pBiosArguments->x.ax = 0x0114;
- return;
- }
- resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo);
- if (ModeNo <= 0x13) {
- pBiosArguments->x.cx = pVBInfo->StResInfo[resindex].HTotal;
- pBiosArguments->x.dx = pVBInfo->StResInfo[resindex].VTotal;
- } else {
- pBiosArguments->x.cx = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */
- pBiosArguments->x.dx = pVBInfo->ModeResInfo[resindex].VTotal; /* yres->bx */
- }
+ if (XGINew_SenseHiTV(HwDeviceExtension, pVBInfo)) { /* add by kuku for Multi-adapter sense HiTV */
+ tempax |= HiTVSense;
+ if ((pVBInfo->VBType & VB_XGI301C))
+ tempax ^= (HiTVSense | YPbPrSense);
+ }
- pBiosArguments->x.ax = 0x0014;
+ if (!(tempax & (HiTVSense | YPbPrSense))) { /* start */
-}
+ tempbx = *pVBInfo->pYCSenseData;
-/* ----------------------------------------------------------------------------
- *
- * Description: Get Customized Panel misc. information support
- * I/P : Select
- * to get panel horizontal timing
- * to get panel vertical timing
- * to get channel clock parameter
- * to get panel misc information
- *
- * O/P :
- * BL: for input Select = 0 ;
- * BX: *Value1 = Horizontal total
- * CX: *Value2 = Horizontal front porch
- * DX: *Value2 = Horizontal sync width
- * BL: for input Select = 1 ;
- * BX: *Value1 = Vertical total
- * CX: *Value2 = Vertical front porch
- * DX: *Value2 = Vertical sync width
- * BL: for input Select = 2 ;
- * BX: Value1 = The first CLK parameter
- * CX: Value2 = The second CLK parameter
- * BL: for input Select = 4 ;
- * BX[15]: *Value1 D[15] VESA V. Polarity
- * BX[14]: *Value1 D[14] VESA H. Polarity
- * BX[7]: *Value1 D[7] Panel V. Polarity
- * BX[6]: *Value1 D[6] Panel H. Polarity
- * ----------------------------------------------------------------------------
- */
-static void XGI_XG21Fun14Sub73(struct vb_device_info *pVBInfo, PX86_REGS pBiosArguments)
-{
- unsigned char Select;
-
- unsigned short lvdstableindex;
-
- lvdstableindex = XGI_GetLVDSOEMTableIndex(pVBInfo);
- Select = pBiosArguments->h.bl;
-
- switch (Select) {
- case 0:
- pBiosArguments->x.bx = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHT;
- pBiosArguments->x.cx = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHFP;
- pBiosArguments->x.dx = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHSYNC;
- break;
- case 1:
- pBiosArguments->x.bx = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVT;
- pBiosArguments->x.cx = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVFP;
- pBiosArguments->x.dx = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVSYNC;
- break;
- case 2:
- pBiosArguments->x.bx = pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData1;
- pBiosArguments->x.cx = pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData2;
- break;
- case 4:
- pBiosArguments->x.bx = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability;
- break;
+ if (!(XGINew_Is301B(pVBInfo)))
+ tempbx = *pVBInfo->pYCSenseData2;
+
+ tempcx = 0x0604;
+ if (XGINew_Sense(tempbx, tempcx, pVBInfo)) {
+ if (XGINew_Sense(tempbx, tempcx, pVBInfo))
+ tempax |= SVIDEOSense;
+ }
+
+ if (OutputSelect & BoardTVType) {
+ tempbx = *pVBInfo->pVideoSenseData;
+
+ if (!(XGINew_Is301B(pVBInfo)))
+ tempbx = *pVBInfo->pVideoSenseData2;
+
+ tempcx = 0x0804;
+ if (XGINew_Sense(tempbx, tempcx, pVBInfo)) {
+ if (XGINew_Sense(tempbx, tempcx, pVBInfo))
+ tempax |= AVIDEOSense;
+ }
+ } else {
+ if (!(tempax & SVIDEOSense)) {
+ tempbx = *pVBInfo->pVideoSenseData;
+
+ if (!(XGINew_Is301B(pVBInfo)))
+ tempbx = *pVBInfo->pVideoSenseData2;
+
+ tempcx = 0x0804;
+ if (XGINew_Sense(tempbx, tempcx, pVBInfo)) {
+ if (XGINew_Sense(tempbx, tempcx, pVBInfo))
+ tempax |= AVIDEOSense;
+ }
+ }
+ }
+ }
+ } /* end */
+ if (!(tempax & Monitor2Sense)) {
+ if (XGINew_SenseLCD(HwDeviceExtension, pVBInfo))
+ tempax |= LCDSense;
+ }
+ tempbx = 0;
+ tempcx = 0;
+ XGINew_Sense(tempbx, tempcx, pVBInfo);
+
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x32, ~0xDF, tempax);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x00, P2reg0);
+
+ if (!(P2reg0 & 0x20)) {
+ pVBInfo->VBInfo = DisableCRT2Display;
+ /* XGI_SetCRT2Group301(SenseModeNo, HwDeviceExtension, pVBInfo); */
+ }
+ }
}
+ XGI_DisableBridge(HwDeviceExtension, pVBInfo); /* shampoo 0226 */
- pBiosArguments->x.ax = 0x0014;
}
-void XGI_XG21Fun14(struct xgi_hw_device_info *pXGIHWDE, PX86_REGS pBiosArguments)
+unsigned short XGINew_SenseLCD(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
{
- struct vb_device_info VBINF;
- struct vb_device_info *pVBInfo = &VBINF;
-
- pVBInfo->IF_DEF_LVDS = 0;
- pVBInfo->IF_DEF_CH7005 = 0;
- pVBInfo->IF_DEF_HiVision = 1;
- pVBInfo->IF_DEF_LCDA = 1;
- pVBInfo->IF_DEF_CH7017 = 0;
- pVBInfo->IF_DEF_YPbPr = 1;
- pVBInfo->IF_DEF_CRT2Monitor = 0;
- pVBInfo->IF_DEF_VideoCapture = 0;
- pVBInfo->IF_DEF_ScaleLCD = 0;
- pVBInfo->IF_DEF_OEMUtil = 0;
- pVBInfo->IF_DEF_PWD = 0;
-
- InitTo330Pointer(pXGIHWDE->jChipType, pVBInfo);
- ReadVBIOSTablData(pXGIHWDE->jChipType, pVBInfo);
-
- pVBInfo->P3c4 = pVBInfo->BaseAddr + 0x14;
- pVBInfo->P3d4 = pVBInfo->BaseAddr + 0x24;
- pVBInfo->P3c0 = pVBInfo->BaseAddr + 0x10;
- pVBInfo->P3ce = pVBInfo->BaseAddr + 0x1e;
- pVBInfo->P3c2 = pVBInfo->BaseAddr + 0x12;
- pVBInfo->P3ca = pVBInfo->BaseAddr + 0x1a;
- pVBInfo->P3c6 = pVBInfo->BaseAddr + 0x16;
- pVBInfo->P3c7 = pVBInfo->BaseAddr + 0x17;
- pVBInfo->P3c8 = pVBInfo->BaseAddr + 0x18;
- pVBInfo->P3c9 = pVBInfo->BaseAddr + 0x19;
- pVBInfo->P3da = pVBInfo->BaseAddr + 0x2A;
- pVBInfo->Part0Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_00;
- pVBInfo->Part1Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_04;
- pVBInfo->Part2Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_10;
- pVBInfo->Part3Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_12;
- pVBInfo->Part4Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14;
- pVBInfo->Part5Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14 + 2;
-
- switch (pBiosArguments->x.ax) {
- case 0x1470:
- XGI_XG21Fun14Sub70(pVBInfo, pBiosArguments);
- break;
- case 0x1471:
- XGI_XG21Fun14Sub71(pVBInfo, pBiosArguments);
- break;
- case 0x1472:
- XGI_XG21Fun14Sub72(pVBInfo, pBiosArguments);
- break;
- case 0x1473:
- XGI_XG21Fun14Sub73(pVBInfo, pBiosArguments);
- break;
- }
+ /* unsigned short SoftSetting ; */
+ unsigned short temp;
+
+ temp = XGINew_GetLCDDDCInfo(HwDeviceExtension, pVBInfo);
+
+ return temp;
}
diff --git a/drivers/staging/xgifb/vb_ext.h b/drivers/staging/xgifb/vb_ext.h
index 5cc4d12c2254..cabe365579c5 100644
--- a/drivers/staging/xgifb/vb_ext.h
+++ b/drivers/staging/xgifb/vb_ext.h
@@ -21,13 +21,7 @@ typedef union _X86_REGS {
struct BYTEREGS h;
} X86_REGS, *PX86_REGS;
-extern void XGI_XG21Fun14(struct xgi_hw_device_info *pXGIHWDE, PX86_REGS pBiosArguments);
-extern void XGISetDPMS(struct xgi_hw_device_info *pXGIHWDE,
- unsigned long VESA_POWER_STATE);
extern void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo);
-extern void XGINew_SetModeScratch(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) ;
-extern void ReadVBIOSTablData(unsigned char ChipType,
- struct vb_device_info *pVBInfo);
extern unsigned short XGINew_SenseLCD(struct xgi_hw_device_info *,
struct vb_device_info *pVBInfo);
diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c
index 8d591828cee5..61d137098aa1 100644
--- a/drivers/staging/xgifb/vb_init.c
+++ b/drivers/staging/xgifb/vb_init.c
@@ -17,38 +17,6 @@
static unsigned char XGINew_ChannelAB, XGINew_DataBusWidth;
-unsigned short XGINew_DRAMType[17][5] = {
- {0x0C, 0x0A, 0x02, 0x40, 0x39}, {0x0D, 0x0A, 0x01, 0x40, 0x48},
- {0x0C, 0x09, 0x02, 0x20, 0x35}, {0x0D, 0x09, 0x01, 0x20, 0x44},
- {0x0C, 0x08, 0x02, 0x10, 0x31}, {0x0D, 0x08, 0x01, 0x10, 0x40},
- {0x0C, 0x0A, 0x01, 0x20, 0x34}, {0x0C, 0x09, 0x01, 0x08, 0x32},
- {0x0B, 0x08, 0x02, 0x08, 0x21}, {0x0C, 0x08, 0x01, 0x08, 0x30},
- {0x0A, 0x08, 0x02, 0x04, 0x11}, {0x0B, 0x0A, 0x01, 0x10, 0x28},
- {0x09, 0x08, 0x02, 0x02, 0x01}, {0x0B, 0x09, 0x01, 0x08, 0x24},
- {0x0B, 0x08, 0x01, 0x04, 0x20}, {0x0A, 0x08, 0x01, 0x02, 0x10},
- {0x09, 0x08, 0x01, 0x01, 0x00} };
-
-static unsigned short XGINew_SDRDRAM_TYPE[13][5] = {
- { 2, 12, 9, 64, 0x35},
- { 1, 13, 9, 64, 0x44},
- { 2, 12, 8, 32, 0x31},
- { 2, 11, 9, 32, 0x25},
- { 1, 12, 9, 32, 0x34},
- { 1, 13, 8, 32, 0x40},
- { 2, 11, 8, 16, 0x21},
- { 1, 12, 8, 16, 0x30},
- { 1, 11, 9, 16, 0x24},
- { 1, 11, 8, 8, 0x20},
- { 2, 9, 8, 4, 0x01},
- { 1, 10, 8, 4, 0x10},
- { 1, 9, 8, 2, 0x00} };
-
-static unsigned short XGINew_DDRDRAM_TYPE[4][5] = {
- { 2, 12, 9, 64, 0x35},
- { 2, 12, 8, 32, 0x31},
- { 2, 11, 8, 16, 0x21},
- { 2, 9, 8, 4, 0x01} };
-
static unsigned short XGINew_DDRDRAM_TYPE340[4][5] = {
{ 2, 13, 9, 64, 0x45},
{ 2, 12, 9, 32, 0x35},
@@ -69,430 +37,9 @@ static unsigned short XGINew_DDRDRAM_TYPE20[12][5] = {
{ 2, 12, 9, 8, 0x35},
{ 2, 12, 8, 4, 0x31} };
-void XGINew_SetDRAMSize_340(struct xgi_hw_device_info *, struct vb_device_info *);
-void XGINew_SetDRAMSize_310(struct xgi_hw_device_info *, struct vb_device_info *);
-void XGINew_SetMemoryClock(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *);
-void XGINew_SetDRAMModeRegister(struct vb_device_info *);
-void XGINew_SetDRAMModeRegister340(struct xgi_hw_device_info *HwDeviceExtension);
-void XGINew_SetDRAMDefaultRegister340(struct xgi_hw_device_info *HwDeviceExtension,
- unsigned long, struct vb_device_info *);
-unsigned char XGINew_GetXG20DRAMType(struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo);
-unsigned char XGIInitNew(struct xgi_hw_device_info *HwDeviceExtension);
-
-int XGINew_DDRSizing340(struct xgi_hw_device_info *, struct vb_device_info *);
-void XGINew_DisableRefresh(struct xgi_hw_device_info *, struct vb_device_info *) ;
-void XGINew_CheckBusWidth_310(struct vb_device_info *) ;
-int XGINew_SDRSizing(struct vb_device_info *);
-int XGINew_DDRSizing(struct vb_device_info *);
-void XGINew_EnableRefresh(struct xgi_hw_device_info *, struct vb_device_info *);
-static int XGINew_RAMType; /*int ModeIDOffset,StandTable,CRT1Table,ScreenOffset,REFIndex;*/
-#if 0
-static unsigned long UNIROM;
-#endif
-unsigned char ChkLFB(struct vb_device_info *);
-void XGINew_Delay15us(unsigned long);
-void SetPowerConsume(struct xgi_hw_device_info *HwDeviceExtension,
- unsigned long XGI_P3d4Port);
-void ReadVBIOSTablData(unsigned char ChipType, struct vb_device_info *pVBInfo);
-void XGINew_DDR1x_MRS_XG20(unsigned long P3c4, struct vb_device_info *pVBInfo);
-void XGINew_SetDRAMModeRegister_XG20(struct xgi_hw_device_info *HwDeviceExtension);
-void XGINew_SetDRAMModeRegister_XG27(struct xgi_hw_device_info *HwDeviceExtension);
-void XGINew_ChkSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) ;
-void XGINew_SetModeScratch(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) ;
-void XGINew_GetXG21Sense(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) ;
-unsigned char GetXG21FPBits(struct vb_device_info *pVBInfo);
-void XGINew_GetXG27Sense(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) ;
-unsigned char GetXG27FPBits(struct vb_device_info *pVBInfo);
-
-static void DelayUS(unsigned long MicroSeconds)
-{
- udelay(MicroSeconds);
-}
-
-unsigned char XGIInitNew(struct xgi_hw_device_info *HwDeviceExtension)
-{
- struct vb_device_info VBINF;
- struct vb_device_info *pVBInfo = &VBINF;
- unsigned char i, temp = 0, temp1;
- /* VBIOSVersion[5]; */
- volatile unsigned char *pVideoMemory;
-
- /* unsigned long j, k; */
-
- struct XGI_DSReg *pSR;
-
- unsigned long Temp;
-
- pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase;
-
- pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress;
-
- pVBInfo->BaseAddr = (unsigned long) HwDeviceExtension->pjIOAddress;
-
- pVideoMemory = (unsigned char *) pVBInfo->ROMAddr;
-
- /* Newdebugcode(0x99); */
-
-
- /* if (pVBInfo->ROMAddr == 0) */
- /* return(0); */
-
- if (pVBInfo->FBAddr == NULL) {
- printk("\n pVBInfo->FBAddr == 0 ");
- return 0;
- }
- printk("1");
- if (pVBInfo->BaseAddr == 0) {
- printk("\npVBInfo->BaseAddr == 0 ");
- return 0;
- }
- printk("2");
-
- XGINew_SetReg3((pVBInfo->BaseAddr + 0x12), 0x67); /* 3c2 <- 67 ,ynlai */
-
- pVBInfo->ISXPDOS = 0;
- printk("3");
-
- if (!HwDeviceExtension->bIntegratedMMEnabled)
- return 0; /* alan */
-
- printk("4");
-
- /* VBIOSVersion[4] = 0x0; */
-
- /* 09/07/99 modify by domao */
-
- pVBInfo->P3c4 = pVBInfo->BaseAddr + 0x14;
- pVBInfo->P3d4 = pVBInfo->BaseAddr + 0x24;
- pVBInfo->P3c0 = pVBInfo->BaseAddr + 0x10;
- pVBInfo->P3ce = pVBInfo->BaseAddr + 0x1e;
- pVBInfo->P3c2 = pVBInfo->BaseAddr + 0x12;
- pVBInfo->P3ca = pVBInfo->BaseAddr + 0x1a;
- pVBInfo->P3c6 = pVBInfo->BaseAddr + 0x16;
- pVBInfo->P3c7 = pVBInfo->BaseAddr + 0x17;
- pVBInfo->P3c8 = pVBInfo->BaseAddr + 0x18;
- pVBInfo->P3c9 = pVBInfo->BaseAddr + 0x19;
- pVBInfo->P3da = pVBInfo->BaseAddr + 0x2A;
- pVBInfo->Part0Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_00;
- pVBInfo->Part1Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_04;
- pVBInfo->Part2Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_10;
- pVBInfo->Part3Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_12;
- pVBInfo->Part4Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14;
- pVBInfo->Part5Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14 + 2;
- printk("5");
-
- if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 */
- XGI_GetVBType(pVBInfo); /* Run XGI_GetVBType before InitTo330Pointer */
-
- InitTo330Pointer(HwDeviceExtension->jChipType, pVBInfo);
-
- /* ReadVBIOSData */
- ReadVBIOSTablData(HwDeviceExtension->jChipType, pVBInfo);
-
- /* 1.Openkey */
- XGINew_SetReg1(pVBInfo->P3c4, 0x05, 0x86);
- printk("6");
-
- /* GetXG21Sense (GPIO) */
- if (HwDeviceExtension->jChipType == XG21)
- XGINew_GetXG21Sense(HwDeviceExtension, pVBInfo);
-
- if (HwDeviceExtension->jChipType == XG27)
- XGINew_GetXG27Sense(HwDeviceExtension, pVBInfo);
-
- printk("7");
-
- /* 2.Reset Extended register */
-
- for (i = 0x06; i < 0x20; i++)
- XGINew_SetReg1(pVBInfo->P3c4, i, 0);
-
- for (i = 0x21; i <= 0x27; i++)
- XGINew_SetReg1(pVBInfo->P3c4, i, 0);
-
- /* for(i = 0x06; i <= 0x27; i++) */
- /* XGINew_SetReg1(pVBInfo->P3c4, i, 0); */
-
- printk("8");
-
- if ((HwDeviceExtension->jChipType >= XG20) || (HwDeviceExtension->jChipType >= XG40)) {
- for (i = 0x31; i <= 0x3B; i++)
- XGINew_SetReg1(pVBInfo->P3c4, i, 0);
- } else {
- for (i = 0x31; i <= 0x3D; i++)
- XGINew_SetReg1(pVBInfo->P3c4, i, 0);
- }
- printk("9");
-
- if (HwDeviceExtension->jChipType == XG42) /* [Hsuan] 2004/08/20 Auto over driver for XG42 */
- XGINew_SetReg1(pVBInfo->P3c4, 0x3B, 0xC0);
-
- /* for (i = 0x30; i <= 0x3F; i++) */
- /* XGINew_SetReg1(pVBInfo->P3d4, i, 0); */
-
- for (i = 0x79; i <= 0x7C; i++)
- XGINew_SetReg1(pVBInfo->P3d4, i, 0); /* shampoo 0208 */
-
- printk("10");
-
- if (HwDeviceExtension->jChipType >= XG20)
- XGINew_SetReg1(pVBInfo->P3d4, 0x97, *pVBInfo->pXGINew_CR97);
-
- /* 3.SetMemoryClock
-
- if (HwDeviceExtension->jChipType >= XG40)
- XGINew_RAMType = (int)XGINew_GetXG20DRAMType(HwDeviceExtension, pVBInfo);
-
- if (HwDeviceExtension->jChipType < XG40)
- XGINew_SetMemoryClock(HwDeviceExtension, pVBInfo); */
-
- printk("11");
-
- /* 4.SetDefExt1Regs begin */
- XGINew_SetReg1(pVBInfo->P3c4, 0x07, *pVBInfo->pSR07);
- if (HwDeviceExtension->jChipType == XG27) {
- XGINew_SetReg1(pVBInfo->P3c4, 0x40, *pVBInfo->pSR40);
- XGINew_SetReg1(pVBInfo->P3c4, 0x41, *pVBInfo->pSR41);
- }
- XGINew_SetReg1(pVBInfo->P3c4, 0x11, 0x0F);
- XGINew_SetReg1(pVBInfo->P3c4, 0x1F, *pVBInfo->pSR1F);
- /* XGINew_SetReg1(pVBInfo->P3c4, 0x20, 0x20); */
- XGINew_SetReg1(pVBInfo->P3c4, 0x20, 0xA0); /* alan, 2001/6/26 Frame buffer can read/write SR20 */
- XGINew_SetReg1(pVBInfo->P3c4, 0x36, 0x70); /* Hsuan, 2006/01/01 H/W request for slow corner chip */
- if (HwDeviceExtension->jChipType == XG27) /* Alan 12/07/2006 */
- XGINew_SetReg1(pVBInfo->P3c4, 0x36, *pVBInfo->pSR36);
-
- /* SR11 = 0x0F; */
- /* XGINew_SetReg1(pVBInfo->P3c4, 0x11, SR11); */
-
- printk("12");
-
- if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */
- /* Set AGP Rate */
- /*
- temp1 = XGINew_GetReg1(pVBInfo->P3c4, 0x3B);
- temp1 &= 0x02;
- if (temp1 == 0x02) {
- XGINew_SetReg4(0xcf8, 0x80000000);
- ChipsetID = XGINew_GetReg3(0x0cfc);
- XGINew_SetReg4(0xcf8, 0x8000002C);
- VendorID = XGINew_GetReg3(0x0cfc);
- VendorID &= 0x0000FFFF;
- XGINew_SetReg4(0xcf8, 0x8001002C);
- GraphicVendorID = XGINew_GetReg3(0x0cfc);
- GraphicVendorID &= 0x0000FFFF;
-
- if (ChipsetID == 0x7301039)
- XGINew_SetReg1(pVBInfo->P3d4, 0x5F, 0x09);
-
- ChipsetID &= 0x0000FFFF;
-
- if ((ChipsetID == 0x700E) || (ChipsetID == 0x1022) || (ChipsetID == 0x1106) || (ChipsetID == 0x10DE)) {
- if (ChipsetID == 0x1106) {
- if ((VendorID == 0x1019) && (GraphicVendorID == 0x1019))
- XGINew_SetReg1(pVBInfo->P3d4, 0x5F, 0x0D);
- else
- XGINew_SetReg1(pVBInfo->P3d4, 0x5F, 0x0B);
- } else {
- XGINew_SetReg1(pVBInfo->P3d4, 0x5F, 0x0B);
- }
- }
- }
- */
-
- printk("13");
-
- if (HwDeviceExtension->jChipType >= XG40) {
- /* Set AGP customize registers (in SetDefAGPRegs) Start */
- for (i = 0x47; i <= 0x4C; i++)
- XGINew_SetReg1(pVBInfo->P3d4, i, pVBInfo->AGPReg[i - 0x47]);
-
- for (i = 0x70; i <= 0x71; i++)
- XGINew_SetReg1(pVBInfo->P3d4, i, pVBInfo->AGPReg[6 + i - 0x70]);
-
- for (i = 0x74; i <= 0x77; i++)
- XGINew_SetReg1(pVBInfo->P3d4, i, pVBInfo->AGPReg[8 + i - 0x74]);
- /* Set AGP customize registers (in SetDefAGPRegs) End */
- /* [Hsuan]2004/12/14 AGP Input Delay Adjustment on 850 */
- /* XGINew_SetReg4(0xcf8 , 0x80000000); */
- /* ChipsetID = XGINew_GetReg3(0x0cfc); */
- /* if (ChipsetID == 0x25308086) */
- /* XGINew_SetReg1(pVBInfo->P3d4, 0x77, 0xF0); */
-
- HwDeviceExtension->pQueryVGAConfigSpace(HwDeviceExtension, 0x50, 0, &Temp); /* Get */
- Temp >>= 20;
- Temp &= 0xF;
-
- if (Temp == 1)
- XGINew_SetReg1(pVBInfo->P3d4, 0x48, 0x20); /* CR48 */
- }
- printk("14");
-
- if (HwDeviceExtension->jChipType < XG40)
- XGINew_SetReg1(pVBInfo->P3d4, 0x49, pVBInfo->CR49[0]);
- } /* != XG20 */
-
- /* Set PCI */
- XGINew_SetReg1(pVBInfo->P3c4, 0x23, *pVBInfo->pSR23);
- XGINew_SetReg1(pVBInfo->P3c4, 0x24, *pVBInfo->pSR24);
- XGINew_SetReg1(pVBInfo->P3c4, 0x25, pVBInfo->SR25[0]);
- printk("15");
-
- if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */
- /* Set VB */
- XGI_UnLockCRT2(HwDeviceExtension, pVBInfo);
- XGINew_SetRegANDOR(pVBInfo->Part0Port, 0x3F, 0xEF, 0x00); /* alan, disable VideoCapture */
- XGINew_SetReg1(pVBInfo->Part1Port, 0x00, 0x00);
- temp1 = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x7B); /* chk if BCLK>=100MHz */
- temp = (unsigned char) ((temp1 >> 4) & 0x0F);
-
- XGINew_SetReg1(pVBInfo->Part1Port, 0x02, (*pVBInfo->pCRT2Data_1_2));
-
- printk("16");
-
- XGINew_SetReg1(pVBInfo->Part1Port, 0x2E, 0x08); /* use VB */
- } /* != XG20 */
-
- XGINew_SetReg1(pVBInfo->P3c4, 0x27, 0x1F);
-
- if ((HwDeviceExtension->jChipType == XG42)
- && XGINew_GetXG20DRAMType(HwDeviceExtension, pVBInfo) != 0) { /* Not DDR */
- XGINew_SetReg1(pVBInfo->P3c4, 0x31, (*pVBInfo->pSR31 & 0x3F) | 0x40);
- XGINew_SetReg1(pVBInfo->P3c4, 0x32, (*pVBInfo->pSR32 & 0xFC) | 0x01);
- } else {
- XGINew_SetReg1(pVBInfo->P3c4, 0x31, *pVBInfo->pSR31);
- XGINew_SetReg1(pVBInfo->P3c4, 0x32, *pVBInfo->pSR32);
- }
- XGINew_SetReg1(pVBInfo->P3c4, 0x33, *pVBInfo->pSR33);
- printk("17");
-
- /*
- if (HwDeviceExtension->jChipType >= XG40)
- SetPowerConsume (HwDeviceExtension, pVBInfo->P3c4); */
-
- if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */
- if (XGI_BridgeIsOn(pVBInfo) == 1) {
- if (pVBInfo->IF_DEF_LVDS == 0) {
- XGINew_SetReg1(pVBInfo->Part2Port, 0x00, 0x1C);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x0D, *pVBInfo->pCRT2Data_4_D);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x0E, *pVBInfo->pCRT2Data_4_E);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x10, *pVBInfo->pCRT2Data_4_10);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x0F, 0x3F);
- }
-
- XGI_LockCRT2(HwDeviceExtension, pVBInfo);
- }
- } /* != XG20 */
- printk("18");
+static int XGINew_RAMType;
- if (HwDeviceExtension->jChipType < XG40)
- XGINew_SetReg1(pVBInfo->P3d4, 0x83, 0x00);
- printk("181");
-
- if (HwDeviceExtension->bSkipSense == 0) {
- printk("182");
-
- XGI_SenseCRT1(pVBInfo);
-
- printk("183");
- /* XGINew_DetectMonitor(HwDeviceExtension); */
- pVBInfo->IF_DEF_CH7007 = 0;
- if ((HwDeviceExtension->jChipType == XG21) && (pVBInfo->IF_DEF_CH7007)) {
- printk("184");
- XGI_GetSenseStatus(HwDeviceExtension, pVBInfo); /* sense CRT2 */
- printk("185");
-
- }
- if (HwDeviceExtension->jChipType == XG21) {
- printk("186");
-
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x32, ~Monitor1Sense, Monitor1Sense); /* Z9 default has CRT */
- temp = GetXG21FPBits(pVBInfo);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x37, ~0x01, temp);
- printk("187");
-
- }
- if (HwDeviceExtension->jChipType == XG27) {
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x32, ~Monitor1Sense, Monitor1Sense); /* Z9 default has CRT */
- temp = GetXG27FPBits(pVBInfo);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x37, ~0x03, temp);
- }
- }
- printk("19");
-
- if (HwDeviceExtension->jChipType >= XG40) {
- if (HwDeviceExtension->jChipType >= XG40)
- XGINew_RAMType = (int) XGINew_GetXG20DRAMType(HwDeviceExtension, pVBInfo);
-
- XGINew_SetDRAMDefaultRegister340(HwDeviceExtension, pVBInfo->P3d4, pVBInfo);
-
- if (HwDeviceExtension->bSkipDramSizing == 1) {
- pSR = HwDeviceExtension->pSR;
- if (pSR != NULL) {
- while (pSR->jIdx != 0xFF) {
- XGINew_SetReg1(pVBInfo->P3c4, pSR->jIdx, pSR->jVal);
- pSR++;
- }
- }
- /* XGINew_SetDRAMModeRegister340(pVBInfo); */
- } /* SkipDramSizing */
- else {
- {
- printk("20");
- XGINew_SetDRAMSize_340(HwDeviceExtension, pVBInfo);
- }
- printk("21");
-
- }
- } /* XG40 */
-
- printk("22");
-
- /* SetDefExt2Regs begin */
- /*
- AGP = 1;
- temp = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x3A);
- temp &= 0x30;
- if (temp == 0x30)
- AGP = 0;
-
- if (AGP == 0)
- *pVBInfo->pSR21 &= 0xEF;
-
- XGINew_SetReg1(pVBInfo->P3c4, 0x21, *pVBInfo->pSR21);
- if (AGP == 1)
- *pVBInfo->pSR22 &= 0x20;
- XGINew_SetReg1(pVBInfo->P3c4, 0x22, *pVBInfo->pSR22);
- */
- /* base = 0x80000000; */
- /* OutPortLong(0xcf8, base); */
- /* Temp = (InPortLong(0xcfc) & 0xFFFF); */
- /* if (Temp == 0x1039) { */
- XGINew_SetReg1(pVBInfo->P3c4, 0x22, (unsigned char) ((*pVBInfo->pSR22) & 0xFE));
- /* } else { */
- /* XGINew_SetReg1(pVBInfo->P3c4, 0x22, *pVBInfo->pSR22); */
- /* } */
-
- XGINew_SetReg1(pVBInfo->P3c4, 0x21, *pVBInfo->pSR21);
-
- printk("23");
-
- XGINew_ChkSenseStatus(HwDeviceExtension, pVBInfo);
- XGINew_SetModeScratch(HwDeviceExtension, pVBInfo);
-
- printk("24");
-
- XGINew_SetReg1(pVBInfo->P3d4, 0x8c, 0x87);
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x31);
- printk("25");
-
- return 1;
-} /* end of init */
-
-/* ============== alan ====================== */
-
-unsigned char XGINew_GetXG20DRAMType(struct xgi_hw_device_info *HwDeviceExtension,
+static unsigned char XGINew_GetXG20DRAMType(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
unsigned char data, temp;
@@ -502,10 +49,10 @@ unsigned char XGINew_GetXG20DRAMType(struct xgi_hw_device_info *HwDeviceExtensio
data = *pVBInfo->pSoftSetting & 0x07;
return data;
} else {
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x39) & 0x02;
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x39) & 0x02;
if (data == 0)
- data = (XGINew_GetReg1(pVBInfo->P3c4, 0x3A) & 0x02) >> 1;
+ data = (xgifb_reg_get(pVBInfo->P3c4, 0x3A) & 0x02) >> 1;
return data;
}
@@ -514,7 +61,7 @@ unsigned char XGINew_GetXG20DRAMType(struct xgi_hw_device_info *HwDeviceExtensio
data = *pVBInfo->pSoftSetting & 0x07;
return data;
}
- temp = XGINew_GetReg1(pVBInfo->P3c4, 0x3B);
+ temp = xgifb_reg_get(pVBInfo->P3c4, 0x3B);
if ((temp & 0x88) == 0x80) /* SR3B[7][3]MAA15 MAA11 (Power on Trapping) */
data = 0; /* DDR */
@@ -522,10 +69,10 @@ unsigned char XGINew_GetXG20DRAMType(struct xgi_hw_device_info *HwDeviceExtensio
data = 1; /* DDRII */
return data;
} else if (HwDeviceExtension->jChipType == XG21) {
- XGINew_SetRegAND(pVBInfo->P3d4, 0xB4, ~0x02); /* Independent GPIO control */
- DelayUS(800);
- XGINew_SetRegOR(pVBInfo->P3d4, 0x4A, 0x80); /* Enable GPIOH read */
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x48); /* GPIOF 0:DVI 1:DVO */
+ xgifb_reg_and(pVBInfo->P3d4, 0xB4, ~0x02); /* Independent GPIO control */
+ udelay(800);
+ xgifb_reg_or(pVBInfo->P3d4, 0x4A, 0x80); /* Enable GPIOH read */
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x48); /* GPIOF 0:DVI 1:DVO */
/* HOTPLUG_SUPPORT */
/* for current XG20 & XG21, GPIOH is floating, driver will fix DDR temporarily */
if (temp & 0x01) /* DVI read GPIOH */
@@ -533,10 +80,10 @@ unsigned char XGINew_GetXG20DRAMType(struct xgi_hw_device_info *HwDeviceExtensio
else
data = 0; /* DDR */
/* ~HOTPLUG_SUPPORT */
- XGINew_SetRegOR(pVBInfo->P3d4, 0xB4, 0x02);
+ xgifb_reg_or(pVBInfo->P3d4, 0xB4, 0x02);
return data;
} else {
- data = XGINew_GetReg1(pVBInfo->P3d4, 0x97) & 0x01;
+ data = xgifb_reg_get(pVBInfo->P3d4, 0x97) & 0x01;
if (data == 1)
data++;
@@ -545,91 +92,59 @@ unsigned char XGINew_GetXG20DRAMType(struct xgi_hw_device_info *HwDeviceExtensio
}
}
-static unsigned char XGINew_Get310DRAMType(struct vb_device_info *pVBInfo)
+static void XGINew_DDR1x_MRS_340(unsigned long P3c4, struct vb_device_info *pVBInfo)
{
- unsigned char data;
-
- /* index = XGINew_GetReg1(pVBInfo->P3c4, 0x1A); */
- /* index &= 07; */
+ xgifb_reg_set(P3c4, 0x18, 0x01);
+ xgifb_reg_set(P3c4, 0x19, 0x20);
+ xgifb_reg_set(P3c4, 0x16, 0x00);
+ xgifb_reg_set(P3c4, 0x16, 0x80);
- if (*pVBInfo->pSoftSetting & SoftDRAMType)
- data = *pVBInfo->pSoftSetting & 0x03;
- else
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x3a) & 0x03;
-
- return data;
-}
+ if (*pVBInfo->pXGINew_DRAMTypeDefinition != 0x0C) { /* Samsung F Die */
+ mdelay(3);
+ xgifb_reg_set(P3c4, 0x18, 0x00);
+ xgifb_reg_set(P3c4, 0x19, 0x20);
+ xgifb_reg_set(P3c4, 0x16, 0x00);
+ xgifb_reg_set(P3c4, 0x16, 0x80);
+ }
-/*
-void XGINew_Delay15us(unsigned long ulMicrsoSec)
-{
+ udelay(60);
+ xgifb_reg_set(P3c4, 0x18, pVBInfo->SR15[2][XGINew_RAMType]); /* SR18 */
+ xgifb_reg_set(P3c4, 0x19, 0x01);
+ xgifb_reg_set(P3c4, 0x16, pVBInfo->SR16[0]);
+ xgifb_reg_set(P3c4, 0x16, pVBInfo->SR16[1]);
+ mdelay(1);
+ xgifb_reg_set(P3c4, 0x1B, 0x03);
+ udelay(500);
+ xgifb_reg_set(P3c4, 0x18, pVBInfo->SR15[2][XGINew_RAMType]); /* SR18 */
+ xgifb_reg_set(P3c4, 0x19, 0x00);
+ xgifb_reg_set(P3c4, 0x16, pVBInfo->SR16[2]);
+ xgifb_reg_set(P3c4, 0x16, pVBInfo->SR16[3]);
+ xgifb_reg_set(P3c4, 0x1B, 0x00);
}
-*/
-static void XGINew_SDR_MRS(struct vb_device_info *pVBInfo)
+static void XGINew_SetMemoryClock(struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
{
- unsigned short data;
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x16);
- data &= 0x3F; /* SR16 D7=0,D6=0 */
- XGINew_SetReg1(pVBInfo->P3c4, 0x16, data); /* enable mode register set(MRS) low */
- /* XGINew_Delay15us(0x100); */
- data |= 0x80; /* SR16 D7=1,D6=0 */
- XGINew_SetReg1(pVBInfo->P3c4, 0x16, data); /* enable mode register set(MRS) high */
- /* XGINew_Delay15us(0x100); */
-}
+ xgifb_reg_set(pVBInfo->P3c4, 0x28, pVBInfo->MCLKData[XGINew_RAMType].SR28);
+ xgifb_reg_set(pVBInfo->P3c4, 0x29, pVBInfo->MCLKData[XGINew_RAMType].SR29);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2A, pVBInfo->MCLKData[XGINew_RAMType].SR2A);
-static void XGINew_DDR1x_MRS_340(unsigned long P3c4, struct vb_device_info *pVBInfo)
-{
- XGINew_SetReg1(P3c4, 0x18, 0x01);
- XGINew_SetReg1(P3c4, 0x19, 0x20);
- XGINew_SetReg1(P3c4, 0x16, 0x00);
- XGINew_SetReg1(P3c4, 0x16, 0x80);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2E, pVBInfo->ECLKData[XGINew_RAMType].SR2E);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2F, pVBInfo->ECLKData[XGINew_RAMType].SR2F);
+ xgifb_reg_set(pVBInfo->P3c4, 0x30, pVBInfo->ECLKData[XGINew_RAMType].SR30);
- if (*pVBInfo->pXGINew_DRAMTypeDefinition != 0x0C) { /* Samsung F Die */
- DelayUS(3000); /* Delay 67 x 3 Delay15us */
- XGINew_SetReg1(P3c4, 0x18, 0x00);
- XGINew_SetReg1(P3c4, 0x19, 0x20);
- XGINew_SetReg1(P3c4, 0x16, 0x00);
- XGINew_SetReg1(P3c4, 0x16, 0x80);
+ /* [Vicent] 2004/07/07, When XG42 ECLK = MCLK = 207MHz, Set SR32 D[1:0] = 10b */
+ /* [Hsuan] 2004/08/20, Modify SR32 value, when MCLK=207MHZ, ELCK=250MHz, Set SR32 D[1:0] = 10b */
+ if (HwDeviceExtension->jChipType == XG42) {
+ if ((pVBInfo->MCLKData[XGINew_RAMType].SR28 == 0x1C)
+ && (pVBInfo->MCLKData[XGINew_RAMType].SR29 == 0x01)
+ && (((pVBInfo->ECLKData[XGINew_RAMType].SR2E == 0x1C)
+ && (pVBInfo->ECLKData[XGINew_RAMType].SR2F == 0x01))
+ || ((pVBInfo->ECLKData[XGINew_RAMType].SR2E == 0x22)
+ && (pVBInfo->ECLKData[XGINew_RAMType].SR2F == 0x01))))
+ xgifb_reg_set(pVBInfo->P3c4, 0x32, ((unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x32) & 0xFC) | 0x02);
}
-
- DelayUS(60);
- XGINew_SetReg1(P3c4, 0x18, pVBInfo->SR15[2][XGINew_RAMType]); /* SR18 */
- XGINew_SetReg1(P3c4, 0x19, 0x01);
- XGINew_SetReg1(P3c4, 0x16, pVBInfo->SR16[0]);
- XGINew_SetReg1(P3c4, 0x16, pVBInfo->SR16[1]);
- DelayUS(1000);
- XGINew_SetReg1(P3c4, 0x1B, 0x03);
- DelayUS(500);
- XGINew_SetReg1(P3c4, 0x18, pVBInfo->SR15[2][XGINew_RAMType]); /* SR18 */
- XGINew_SetReg1(P3c4, 0x19, 0x00);
- XGINew_SetReg1(P3c4, 0x16, pVBInfo->SR16[2]);
- XGINew_SetReg1(P3c4, 0x16, pVBInfo->SR16[3]);
- XGINew_SetReg1(P3c4, 0x1B, 0x00);
-}
-
-static void XGINew_DDR2x_MRS_340(unsigned long P3c4, struct vb_device_info *pVBInfo)
-{
- XGINew_SetReg1(P3c4, 0x18, 0x00);
- XGINew_SetReg1(P3c4, 0x19, 0x20);
- XGINew_SetReg1(P3c4, 0x16, 0x00);
- XGINew_SetReg1(P3c4, 0x16, 0x80);
- DelayUS(60);
- XGINew_SetReg1(P3c4, 0x18, pVBInfo->SR15[2][XGINew_RAMType]); /* SR18 */
- /* XGINew_SetReg1(P3c4 ,0x18 ,0x31); */
- XGINew_SetReg1(P3c4, 0x19, 0x01);
- XGINew_SetReg1(P3c4, 0x16, 0x05);
- XGINew_SetReg1(P3c4, 0x16, 0x85);
- DelayUS(1000);
- XGINew_SetReg1(P3c4, 0x1B, 0x03);
- DelayUS(500);
- /* XGINew_SetReg1(P3c4, 0x18, 0x31); */
- XGINew_SetReg1(P3c4, 0x18, pVBInfo->SR15[2][XGINew_RAMType]); /* SR18 */
- XGINew_SetReg1(P3c4, 0x19, 0x00);
- XGINew_SetReg1(P3c4, 0x16, 0x05);
- XGINew_SetReg1(P3c4, 0x16, 0x85);
- XGINew_SetReg1(P3c4, 0x1B, 0x00);
}
static void XGINew_DDRII_Bootup_XG27(
@@ -641,68 +156,68 @@ static void XGINew_DDRII_Bootup_XG27(
XGINew_SetMemoryClock(HwDeviceExtension, pVBInfo);
/* Set Double Frequency */
- /* XGINew_SetReg1(P3d4, 0x97, 0x11); *//* CR97 */
- XGINew_SetReg1(P3d4, 0x97, *pVBInfo->pXGINew_CR97); /* CR97 */
-
- DelayUS(200);
-
- XGINew_SetReg1(P3c4, 0x18, 0x00); /* Set SR18 */ /* EMRS2 */
- XGINew_SetReg1(P3c4, 0x19, 0x80); /* Set SR19 */
- XGINew_SetReg1(P3c4, 0x16, 0x20); /* Set SR16 */
- DelayUS(15);
- XGINew_SetReg1(P3c4, 0x16, 0xA0); /* Set SR16 */
- DelayUS(15);
-
- XGINew_SetReg1(P3c4, 0x18, 0x00); /* Set SR18 */ /* EMRS3 */
- XGINew_SetReg1(P3c4, 0x19, 0xC0); /* Set SR19 */
- XGINew_SetReg1(P3c4, 0x16, 0x20); /* Set SR16 */
- DelayUS(15);
- XGINew_SetReg1(P3c4, 0x16, 0xA0); /* Set SR16 */
- DelayUS(15);
-
- XGINew_SetReg1(P3c4, 0x18, 0x00); /* Set SR18 */ /* EMRS1 */
- XGINew_SetReg1(P3c4, 0x19, 0x40); /* Set SR19 */
- XGINew_SetReg1(P3c4, 0x16, 0x20); /* Set SR16 */
- DelayUS(30);
- XGINew_SetReg1(P3c4, 0x16, 0xA0); /* Set SR16 */
- DelayUS(15);
-
- XGINew_SetReg1(P3c4, 0x18, 0x42); /* Set SR18 */ /* MRS, DLL Enable */
- XGINew_SetReg1(P3c4, 0x19, 0x0A); /* Set SR19 */
- XGINew_SetReg1(P3c4, 0x16, 0x00); /* Set SR16 */
- DelayUS(30);
- XGINew_SetReg1(P3c4, 0x16, 0x00); /* Set SR16 */
- XGINew_SetReg1(P3c4, 0x16, 0x80); /* Set SR16 */
- /* DelayUS(15); */
-
- XGINew_SetReg1(P3c4, 0x1B, 0x04); /* Set SR1B */
- DelayUS(60);
- XGINew_SetReg1(P3c4, 0x1B, 0x00); /* Set SR1B */
-
- XGINew_SetReg1(P3c4, 0x18, 0x42); /* Set SR18 */ /* MRS, DLL Reset */
- XGINew_SetReg1(P3c4, 0x19, 0x08); /* Set SR19 */
- XGINew_SetReg1(P3c4, 0x16, 0x00); /* Set SR16 */
-
- DelayUS(30);
- XGINew_SetReg1(P3c4, 0x16, 0x83); /* Set SR16 */
- DelayUS(15);
-
- XGINew_SetReg1(P3c4, 0x18, 0x80); /* Set SR18 */ /* MRS, ODT */
- XGINew_SetReg1(P3c4, 0x19, 0x46); /* Set SR19 */
- XGINew_SetReg1(P3c4, 0x16, 0x20); /* Set SR16 */
- DelayUS(30);
- XGINew_SetReg1(P3c4, 0x16, 0xA0); /* Set SR16 */
- DelayUS(15);
-
- XGINew_SetReg1(P3c4, 0x18, 0x00); /* Set SR18 */ /* EMRS */
- XGINew_SetReg1(P3c4, 0x19, 0x40); /* Set SR19 */
- XGINew_SetReg1(P3c4, 0x16, 0x20); /* Set SR16 */
- DelayUS(30);
- XGINew_SetReg1(P3c4, 0x16, 0xA0); /* Set SR16 */
- DelayUS(15);
-
- XGINew_SetReg1(P3c4, 0x1B, 0x04); /* Set SR1B refresh control 000:close; 010:open */
- DelayUS(200);
+ /* xgifb_reg_set(P3d4, 0x97, 0x11); *//* CR97 */
+ xgifb_reg_set(P3d4, 0x97, *pVBInfo->pXGINew_CR97); /* CR97 */
+
+ udelay(200);
+
+ xgifb_reg_set(P3c4, 0x18, 0x00); /* Set SR18 */ /* EMRS2 */
+ xgifb_reg_set(P3c4, 0x19, 0x80); /* Set SR19 */
+ xgifb_reg_set(P3c4, 0x16, 0x20); /* Set SR16 */
+ udelay(15);
+ xgifb_reg_set(P3c4, 0x16, 0xA0); /* Set SR16 */
+ udelay(15);
+
+ xgifb_reg_set(P3c4, 0x18, 0x00); /* Set SR18 */ /* EMRS3 */
+ xgifb_reg_set(P3c4, 0x19, 0xC0); /* Set SR19 */
+ xgifb_reg_set(P3c4, 0x16, 0x20); /* Set SR16 */
+ udelay(15);
+ xgifb_reg_set(P3c4, 0x16, 0xA0); /* Set SR16 */
+ udelay(15);
+
+ xgifb_reg_set(P3c4, 0x18, 0x00); /* Set SR18 */ /* EMRS1 */
+ xgifb_reg_set(P3c4, 0x19, 0x40); /* Set SR19 */
+ xgifb_reg_set(P3c4, 0x16, 0x20); /* Set SR16 */
+ udelay(30);
+ xgifb_reg_set(P3c4, 0x16, 0xA0); /* Set SR16 */
+ udelay(15);
+
+ xgifb_reg_set(P3c4, 0x18, 0x42); /* Set SR18 */ /* MRS, DLL Enable */
+ xgifb_reg_set(P3c4, 0x19, 0x0A); /* Set SR19 */
+ xgifb_reg_set(P3c4, 0x16, 0x00); /* Set SR16 */
+ udelay(30);
+ xgifb_reg_set(P3c4, 0x16, 0x00); /* Set SR16 */
+ xgifb_reg_set(P3c4, 0x16, 0x80); /* Set SR16 */
+ /* udelay(15); */
+
+ xgifb_reg_set(P3c4, 0x1B, 0x04); /* Set SR1B */
+ udelay(60);
+ xgifb_reg_set(P3c4, 0x1B, 0x00); /* Set SR1B */
+
+ xgifb_reg_set(P3c4, 0x18, 0x42); /* Set SR18 */ /* MRS, DLL Reset */
+ xgifb_reg_set(P3c4, 0x19, 0x08); /* Set SR19 */
+ xgifb_reg_set(P3c4, 0x16, 0x00); /* Set SR16 */
+
+ udelay(30);
+ xgifb_reg_set(P3c4, 0x16, 0x83); /* Set SR16 */
+ udelay(15);
+
+ xgifb_reg_set(P3c4, 0x18, 0x80); /* Set SR18 */ /* MRS, ODT */
+ xgifb_reg_set(P3c4, 0x19, 0x46); /* Set SR19 */
+ xgifb_reg_set(P3c4, 0x16, 0x20); /* Set SR16 */
+ udelay(30);
+ xgifb_reg_set(P3c4, 0x16, 0xA0); /* Set SR16 */
+ udelay(15);
+
+ xgifb_reg_set(P3c4, 0x18, 0x00); /* Set SR18 */ /* EMRS */
+ xgifb_reg_set(P3c4, 0x19, 0x40); /* Set SR19 */
+ xgifb_reg_set(P3c4, 0x16, 0x20); /* Set SR16 */
+ udelay(30);
+ xgifb_reg_set(P3c4, 0x16, 0xA0); /* Set SR16 */
+ udelay(15);
+
+ xgifb_reg_set(P3c4, 0x1B, 0x04); /* Set SR1B refresh control 000:close; 010:open */
+ udelay(200);
}
@@ -714,117 +229,74 @@ static void XGINew_DDR2_MRS_XG20(struct xgi_hw_device_info *HwDeviceExtension,
XGINew_RAMType = (int) XGINew_GetXG20DRAMType(HwDeviceExtension, pVBInfo);
XGINew_SetMemoryClock(HwDeviceExtension, pVBInfo);
- XGINew_SetReg1(P3d4, 0x97, 0x11); /* CR97 */
-
- DelayUS(200);
- XGINew_SetReg1(P3c4, 0x18, 0x00); /* EMRS2 */
- XGINew_SetReg1(P3c4, 0x19, 0x80);
- XGINew_SetReg1(P3c4, 0x16, 0x05);
- XGINew_SetReg1(P3c4, 0x16, 0x85);
-
- XGINew_SetReg1(P3c4, 0x18, 0x00); /* EMRS3 */
- XGINew_SetReg1(P3c4, 0x19, 0xC0);
- XGINew_SetReg1(P3c4, 0x16, 0x05);
- XGINew_SetReg1(P3c4, 0x16, 0x85);
-
- XGINew_SetReg1(P3c4, 0x18, 0x00); /* EMRS1 */
- XGINew_SetReg1(P3c4, 0x19, 0x40);
- XGINew_SetReg1(P3c4, 0x16, 0x05);
- XGINew_SetReg1(P3c4, 0x16, 0x85);
-
- /* XGINew_SetReg1(P3c4, 0x18, 0x52); */ /* MRS1 */
- XGINew_SetReg1(P3c4, 0x18, 0x42); /* MRS1 */
- XGINew_SetReg1(P3c4, 0x19, 0x02);
- XGINew_SetReg1(P3c4, 0x16, 0x05);
- XGINew_SetReg1(P3c4, 0x16, 0x85);
-
- DelayUS(15);
- XGINew_SetReg1(P3c4, 0x1B, 0x04); /* SR1B */
- DelayUS(30);
- XGINew_SetReg1(P3c4, 0x1B, 0x00); /* SR1B */
- DelayUS(100);
-
- /* XGINew_SetReg1(P3c4 ,0x18, 0x52); */ /* MRS2 */
- XGINew_SetReg1(P3c4, 0x18, 0x42); /* MRS1 */
- XGINew_SetReg1(P3c4, 0x19, 0x00);
- XGINew_SetReg1(P3c4, 0x16, 0x05);
- XGINew_SetReg1(P3c4, 0x16, 0x85);
-
- DelayUS(200);
+ xgifb_reg_set(P3d4, 0x97, 0x11); /* CR97 */
+
+ udelay(200);
+ xgifb_reg_set(P3c4, 0x18, 0x00); /* EMRS2 */
+ xgifb_reg_set(P3c4, 0x19, 0x80);
+ xgifb_reg_set(P3c4, 0x16, 0x05);
+ xgifb_reg_set(P3c4, 0x16, 0x85);
+
+ xgifb_reg_set(P3c4, 0x18, 0x00); /* EMRS3 */
+ xgifb_reg_set(P3c4, 0x19, 0xC0);
+ xgifb_reg_set(P3c4, 0x16, 0x05);
+ xgifb_reg_set(P3c4, 0x16, 0x85);
+
+ xgifb_reg_set(P3c4, 0x18, 0x00); /* EMRS1 */
+ xgifb_reg_set(P3c4, 0x19, 0x40);
+ xgifb_reg_set(P3c4, 0x16, 0x05);
+ xgifb_reg_set(P3c4, 0x16, 0x85);
+
+ /* xgifb_reg_set(P3c4, 0x18, 0x52); */ /* MRS1 */
+ xgifb_reg_set(P3c4, 0x18, 0x42); /* MRS1 */
+ xgifb_reg_set(P3c4, 0x19, 0x02);
+ xgifb_reg_set(P3c4, 0x16, 0x05);
+ xgifb_reg_set(P3c4, 0x16, 0x85);
+
+ udelay(15);
+ xgifb_reg_set(P3c4, 0x1B, 0x04); /* SR1B */
+ udelay(30);
+ xgifb_reg_set(P3c4, 0x1B, 0x00); /* SR1B */
+ udelay(100);
+
+ /* xgifb_reg_set(P3c4 ,0x18, 0x52); */ /* MRS2 */
+ xgifb_reg_set(P3c4, 0x18, 0x42); /* MRS1 */
+ xgifb_reg_set(P3c4, 0x19, 0x00);
+ xgifb_reg_set(P3c4, 0x16, 0x05);
+ xgifb_reg_set(P3c4, 0x16, 0x85);
+
+ udelay(200);
}
-#if 0
-static void XGINew_DDR2_MRS_XG27(struct xgi_hw_device_info *HwDeviceExtension,
- unsigned long P3c4, struct vb_device_info *pVBInfo)
+static void XGINew_DDR1x_MRS_XG20(unsigned long P3c4, struct vb_device_info *pVBInfo)
{
- unsigned long P3d4 = P3c4 + 0x10;
-
- XGINew_RAMType = (int) XGINew_GetXG20DRAMType(HwDeviceExtension, pVBInfo);
- XGINew_SetMemoryClock(HwDeviceExtension , pVBInfo);
-
- XGINew_SetReg1(P3d4, 0x97, 0x11); /* CR97 */
- DelayUS(200);
- XGINew_SetReg1(P3c4, 0x18, 0x00); /* EMRS2 */
- XGINew_SetReg1(P3c4, 0x19, 0x80);
-
- XGINew_SetReg1(P3c4, 0x16, 0x10);
- DelayUS(15); /* 06/11/23 XG27 A0 for CKE enable */
- XGINew_SetReg1(P3c4, 0x16, 0x90);
-
- XGINew_SetReg1(P3c4, 0x18, 0x00); /* EMRS3 */
- XGINew_SetReg1(P3c4, 0x19, 0xC0);
-
- XGINew_SetReg1(P3c4, 0x16, 0x00);
- DelayUS(15); /* 06/11/22 XG27 A0 */
- XGINew_SetReg1(P3c4, 0x16, 0x80);
-
- XGINew_SetReg1(P3c4, 0x18, 0x00); /* EMRS1 */
- XGINew_SetReg1(P3c4, 0x19, 0x40);
-
- XGINew_SetReg1(P3c4, 0x16, 0x00);
- DelayUS(15); /* 06/11/22 XG27 A0 */
- XGINew_SetReg1(P3c4, 0x16, 0x80);
-
- XGINew_SetReg1(P3c4, 0x18, 0x42); /* MRS1 */
- XGINew_SetReg1(P3c4, 0x19, 0x06); /* [Billy]06/11/22 DLL Reset for XG27 Hynix DRAM */
-
- XGINew_SetReg1(P3c4, 0x16, 0x00);
- DelayUS(15); /* 06/11/23 XG27 A0 */
- XGINew_SetReg1(P3c4, 0x16, 0x80);
-
- DelayUS(30); /* 06/11/23 XG27 A0 Start Auto-PreCharge */
- XGINew_SetReg1(P3c4, 0x1B, 0x04); /* SR1B */
- DelayUS(60);
- XGINew_SetReg1(P3c4, 0x1B, 0x00); /* SR1B */
-
- XGINew_SetReg1(P3c4, 0x18, 0x42); /* MRS1 */
- XGINew_SetReg1(P3c4, 0x19, 0x04); /* DLL without Reset for XG27 Hynix DRAM */
-
- XGINew_SetReg1(P3c4, 0x16, 0x00);
- DelayUS(30);
- XGINew_SetReg1(P3c4, 0x16, 0x80);
-
- XGINew_SetReg1(P3c4, 0x18, 0x80); /* XG27 OCD ON */
- XGINew_SetReg1(P3c4, 0x19, 0x46);
-
- XGINew_SetReg1(P3c4, 0x16, 0x00);
- DelayUS(30);
- XGINew_SetReg1(P3c4, 0x16, 0x80);
-
- XGINew_SetReg1(P3c4, 0x18, 0x00);
- XGINew_SetReg1(P3c4, 0x19, 0x40);
-
- XGINew_SetReg1(P3c4, 0x16, 0x00);
- DelayUS(30);
- XGINew_SetReg1(P3c4, 0x16, 0x80);
-
- DelayUS(15); /* Start Auto-PreCharge */
- XGINew_SetReg1(P3c4, 0x1B, 0x04); /* SR1B */
- DelayUS(200);
- XGINew_SetReg1(P3c4, 0x1B, 0x03); /* SR1B */
+ xgifb_reg_set(P3c4, 0x18, 0x01);
+ xgifb_reg_set(P3c4, 0x19, 0x40);
+ xgifb_reg_set(P3c4, 0x16, 0x00);
+ xgifb_reg_set(P3c4, 0x16, 0x80);
+ udelay(60);
+
+ xgifb_reg_set(P3c4, 0x18, 0x00);
+ xgifb_reg_set(P3c4, 0x19, 0x40);
+ xgifb_reg_set(P3c4, 0x16, 0x00);
+ xgifb_reg_set(P3c4, 0x16, 0x80);
+ udelay(60);
+ xgifb_reg_set(P3c4, 0x18, pVBInfo->SR15[2][XGINew_RAMType]); /* SR18 */
+ /* xgifb_reg_set(P3c4, 0x18, 0x31); */
+ xgifb_reg_set(P3c4, 0x19, 0x01);
+ xgifb_reg_set(P3c4, 0x16, 0x03);
+ xgifb_reg_set(P3c4, 0x16, 0x83);
+ mdelay(1);
+ xgifb_reg_set(P3c4, 0x1B, 0x03);
+ udelay(500);
+ /* xgifb_reg_set(P3c4, 0x18, 0x31); */
+ xgifb_reg_set(P3c4, 0x18, pVBInfo->SR15[2][XGINew_RAMType]); /* SR18 */
+ xgifb_reg_set(P3c4, 0x19, 0x00);
+ xgifb_reg_set(P3c4, 0x16, 0x03);
+ xgifb_reg_set(P3c4, 0x16, 0x83);
+ xgifb_reg_set(P3c4, 0x1B, 0x00);
}
-#endif
static void XGINew_DDR1x_DefaultRegister(
struct xgi_hw_device_info *HwDeviceExtension,
@@ -834,12 +306,12 @@ static void XGINew_DDR1x_DefaultRegister(
if (HwDeviceExtension->jChipType >= XG20) {
XGINew_SetMemoryClock(HwDeviceExtension, pVBInfo);
- XGINew_SetReg1(P3d4, 0x82, pVBInfo->CR40[11][XGINew_RAMType]); /* CR82 */
- XGINew_SetReg1(P3d4, 0x85, pVBInfo->CR40[12][XGINew_RAMType]); /* CR85 */
- XGINew_SetReg1(P3d4, 0x86, pVBInfo->CR40[13][XGINew_RAMType]); /* CR86 */
+ xgifb_reg_set(P3d4, 0x82, pVBInfo->CR40[11][XGINew_RAMType]); /* CR82 */
+ xgifb_reg_set(P3d4, 0x85, pVBInfo->CR40[12][XGINew_RAMType]); /* CR85 */
+ xgifb_reg_set(P3d4, 0x86, pVBInfo->CR40[13][XGINew_RAMType]); /* CR86 */
- XGINew_SetReg1(P3d4, 0x98, 0x01);
- XGINew_SetReg1(P3d4, 0x9A, 0x02);
+ xgifb_reg_set(P3d4, 0x98, 0x01);
+ xgifb_reg_set(P3d4, 0x9A, 0x02);
XGINew_DDR1x_MRS_XG20(P3c4, pVBInfo);
} else {
@@ -848,79 +320,34 @@ static void XGINew_DDR1x_DefaultRegister(
switch (HwDeviceExtension->jChipType) {
case XG41:
case XG42:
- XGINew_SetReg1(P3d4, 0x82, pVBInfo->CR40[11][XGINew_RAMType]); /* CR82 */
- XGINew_SetReg1(P3d4, 0x85, pVBInfo->CR40[12][XGINew_RAMType]); /* CR85 */
- XGINew_SetReg1(P3d4, 0x86, pVBInfo->CR40[13][XGINew_RAMType]); /* CR86 */
+ xgifb_reg_set(P3d4, 0x82, pVBInfo->CR40[11][XGINew_RAMType]); /* CR82 */
+ xgifb_reg_set(P3d4, 0x85, pVBInfo->CR40[12][XGINew_RAMType]); /* CR85 */
+ xgifb_reg_set(P3d4, 0x86, pVBInfo->CR40[13][XGINew_RAMType]); /* CR86 */
break;
default:
- XGINew_SetReg1(P3d4, 0x82, 0x88);
- XGINew_SetReg1(P3d4, 0x86, 0x00);
- XGINew_GetReg1(P3d4, 0x86); /* Insert read command for delay */
- XGINew_SetReg1(P3d4, 0x86, 0x88);
- XGINew_GetReg1(P3d4, 0x86);
- XGINew_SetReg1(P3d4, 0x86, pVBInfo->CR40[13][XGINew_RAMType]);
- XGINew_SetReg1(P3d4, 0x82, 0x77);
- XGINew_SetReg1(P3d4, 0x85, 0x00);
- XGINew_GetReg1(P3d4, 0x85); /* Insert read command for delay */
- XGINew_SetReg1(P3d4, 0x85, 0x88);
- XGINew_GetReg1(P3d4, 0x85); /* Insert read command for delay */
- XGINew_SetReg1(P3d4, 0x85, pVBInfo->CR40[12][XGINew_RAMType]); /* CR85 */
- XGINew_SetReg1(P3d4, 0x82, pVBInfo->CR40[11][XGINew_RAMType]); /* CR82 */
+ xgifb_reg_set(P3d4, 0x82, 0x88);
+ xgifb_reg_set(P3d4, 0x86, 0x00);
+ xgifb_reg_get(P3d4, 0x86); /* Insert read command for delay */
+ xgifb_reg_set(P3d4, 0x86, 0x88);
+ xgifb_reg_get(P3d4, 0x86);
+ xgifb_reg_set(P3d4, 0x86, pVBInfo->CR40[13][XGINew_RAMType]);
+ xgifb_reg_set(P3d4, 0x82, 0x77);
+ xgifb_reg_set(P3d4, 0x85, 0x00);
+ xgifb_reg_get(P3d4, 0x85); /* Insert read command for delay */
+ xgifb_reg_set(P3d4, 0x85, 0x88);
+ xgifb_reg_get(P3d4, 0x85); /* Insert read command for delay */
+ xgifb_reg_set(P3d4, 0x85, pVBInfo->CR40[12][XGINew_RAMType]); /* CR85 */
+ xgifb_reg_set(P3d4, 0x82, pVBInfo->CR40[11][XGINew_RAMType]); /* CR82 */
break;
}
- XGINew_SetReg1(P3d4, 0x97, 0x00);
- XGINew_SetReg1(P3d4, 0x98, 0x01);
- XGINew_SetReg1(P3d4, 0x9A, 0x02);
+ xgifb_reg_set(P3d4, 0x97, 0x00);
+ xgifb_reg_set(P3d4, 0x98, 0x01);
+ xgifb_reg_set(P3d4, 0x9A, 0x02);
XGINew_DDR1x_MRS_340(P3c4, pVBInfo);
}
}
-#if 0
-
-static void XGINew_DDR2x_DefaultRegister(
- struct xgi_hw_device_info *HwDeviceExtension,
- unsigned long Port, struct vb_device_info *pVBInfo)
-{
- unsigned long P3d4 = Port ,
- P3c4 = Port - 0x10;
-
- XGINew_SetMemoryClock(HwDeviceExtension, pVBInfo);
-
- /* 20040906 Hsuan modify CR82, CR85, CR86 for XG42 */
- switch (HwDeviceExtension->jChipType) {
- case XG41:
- case XG42:
- XGINew_SetReg1(P3d4, 0x82, pVBInfo->CR40[11][XGINew_RAMType]); /* CR82 */
- XGINew_SetReg1(P3d4, 0x85, pVBInfo->CR40[12][XGINew_RAMType]); /* CR85 */
- XGINew_SetReg1(P3d4, 0x86, pVBInfo->CR40[13][XGINew_RAMType]); /* CR86 */
- break;
- default:
- /* keep following setting sequence, each setting in the same reg insert idle */
- XGINew_SetReg1(P3d4, 0x82, 0x88);
- XGINew_SetReg1(P3d4, 0x86, 0x00);
- XGINew_GetReg1(P3d4, 0x86); /* Insert read command for delay */
- XGINew_SetReg1(P3d4, 0x86, 0x88);
- XGINew_SetReg1(P3d4, 0x82, 0x77);
- XGINew_SetReg1(P3d4, 0x85, 0x00);
- XGINew_GetReg1(P3d4, 0x85); /* Insert read command for delay */
- XGINew_SetReg1(P3d4, 0x85, 0x88);
- XGINew_GetReg1(P3d4, 0x85); /* Insert read command for delay */
- XGINew_SetReg1(P3d4, 0x85, pVBInfo->CR40[12][XGINew_RAMType]); /* CR85 */
- XGINew_SetReg1(P3d4, 0x82, pVBInfo->CR40[11][XGINew_RAMType]); /* CR82 */
- }
- XGINew_SetReg1(P3d4, 0x97, 0x11);
- if (HwDeviceExtension->jChipType == XG42)
- XGINew_SetReg1(P3d4, 0x98, 0x01);
- else
- XGINew_SetReg1(P3d4, 0x98, 0x03);
-
- XGINew_SetReg1(P3d4, 0x9A, 0x02);
-
- XGINew_DDR2x_MRS_340(P3c4, pVBInfo);
-}
-#endif
-
static void XGINew_DDR2_DefaultRegister(
struct xgi_hw_device_info *HwDeviceExtension,
unsigned long Port, struct vb_device_info *pVBInfo)
@@ -928,32 +355,32 @@ static void XGINew_DDR2_DefaultRegister(
unsigned long P3d4 = Port, P3c4 = Port - 0x10;
/* keep following setting sequence, each setting in the same reg insert idle */
- XGINew_SetReg1(P3d4, 0x82, 0x77);
- XGINew_SetReg1(P3d4, 0x86, 0x00);
- XGINew_GetReg1(P3d4, 0x86); /* Insert read command for delay */
- XGINew_SetReg1(P3d4, 0x86, 0x88);
- XGINew_GetReg1(P3d4, 0x86); /* Insert read command for delay */
- XGINew_SetReg1(P3d4, 0x86, pVBInfo->CR40[13][XGINew_RAMType]); /* CR86 */
- XGINew_SetReg1(P3d4, 0x82, 0x77);
- XGINew_SetReg1(P3d4, 0x85, 0x00);
- XGINew_GetReg1(P3d4, 0x85); /* Insert read command for delay */
- XGINew_SetReg1(P3d4, 0x85, 0x88);
- XGINew_GetReg1(P3d4, 0x85); /* Insert read command for delay */
- XGINew_SetReg1(P3d4, 0x85, pVBInfo->CR40[12][XGINew_RAMType]); /* CR85 */
+ xgifb_reg_set(P3d4, 0x82, 0x77);
+ xgifb_reg_set(P3d4, 0x86, 0x00);
+ xgifb_reg_get(P3d4, 0x86); /* Insert read command for delay */
+ xgifb_reg_set(P3d4, 0x86, 0x88);
+ xgifb_reg_get(P3d4, 0x86); /* Insert read command for delay */
+ xgifb_reg_set(P3d4, 0x86, pVBInfo->CR40[13][XGINew_RAMType]); /* CR86 */
+ xgifb_reg_set(P3d4, 0x82, 0x77);
+ xgifb_reg_set(P3d4, 0x85, 0x00);
+ xgifb_reg_get(P3d4, 0x85); /* Insert read command for delay */
+ xgifb_reg_set(P3d4, 0x85, 0x88);
+ xgifb_reg_get(P3d4, 0x85); /* Insert read command for delay */
+ xgifb_reg_set(P3d4, 0x85, pVBInfo->CR40[12][XGINew_RAMType]); /* CR85 */
if (HwDeviceExtension->jChipType == XG27)
- XGINew_SetReg1(P3d4, 0x82, pVBInfo->CR40[11][XGINew_RAMType]); /* CR82 */
+ xgifb_reg_set(P3d4, 0x82, pVBInfo->CR40[11][XGINew_RAMType]); /* CR82 */
else
- XGINew_SetReg1(P3d4, 0x82, 0xA8); /* CR82 */
+ xgifb_reg_set(P3d4, 0x82, 0xA8); /* CR82 */
- XGINew_SetReg1(P3d4, 0x98, 0x01);
- XGINew_SetReg1(P3d4, 0x9A, 0x02);
+ xgifb_reg_set(P3d4, 0x98, 0x01);
+ xgifb_reg_set(P3d4, 0x9A, 0x02);
if (HwDeviceExtension->jChipType == XG27)
XGINew_DDRII_Bootup_XG27(HwDeviceExtension, P3c4, pVBInfo);
else
XGINew_DDR2_MRS_XG20(HwDeviceExtension, P3c4, pVBInfo);
}
-void XGINew_SetDRAMDefaultRegister340(
+static void XGINew_SetDRAMDefaultRegister340(
struct xgi_hw_device_info *HwDeviceExtension,
unsigned long Port, struct vb_device_info *pVBInfo)
{
@@ -961,10 +388,10 @@ void XGINew_SetDRAMDefaultRegister340(
unsigned long P3d4 = Port, P3c4 = Port - 0x10;
- XGINew_SetReg1(P3d4, 0x6D, pVBInfo->CR40[8][XGINew_RAMType]);
- XGINew_SetReg1(P3d4, 0x68, pVBInfo->CR40[5][XGINew_RAMType]);
- XGINew_SetReg1(P3d4, 0x69, pVBInfo->CR40[6][XGINew_RAMType]);
- XGINew_SetReg1(P3d4, 0x6A, pVBInfo->CR40[7][XGINew_RAMType]);
+ xgifb_reg_set(P3d4, 0x6D, pVBInfo->CR40[8][XGINew_RAMType]);
+ xgifb_reg_set(P3d4, 0x68, pVBInfo->CR40[5][XGINew_RAMType]);
+ xgifb_reg_set(P3d4, 0x69, pVBInfo->CR40[6][XGINew_RAMType]);
+ xgifb_reg_set(P3d4, 0x6A, pVBInfo->CR40[7][XGINew_RAMType]);
temp2 = 0;
for (i = 0; i < 4; i++) {
@@ -972,8 +399,8 @@ void XGINew_SetDRAMDefaultRegister340(
for (j = 0; j < 4; j++) {
temp1 = ((temp >> (2 * j)) & 0x03) << 2;
temp2 |= temp1;
- XGINew_SetReg1(P3d4, 0x6B, temp2);
- XGINew_GetReg1(P3d4, 0x6B); /* Insert read command for delay */
+ xgifb_reg_set(P3d4, 0x6B, temp2);
+ xgifb_reg_get(P3d4, 0x6B); /* Insert read command for delay */
temp2 &= 0xF0;
temp2 += 0x10;
}
@@ -985,8 +412,8 @@ void XGINew_SetDRAMDefaultRegister340(
for (j = 0; j < 4; j++) {
temp1 = ((temp >> (2 * j)) & 0x03) << 2;
temp2 |= temp1;
- XGINew_SetReg1(P3d4, 0x6E, temp2);
- XGINew_GetReg1(P3d4, 0x6E); /* Insert read command for delay */
+ xgifb_reg_set(P3d4, 0x6E, temp2);
+ xgifb_reg_get(P3d4, 0x6E); /* Insert read command for delay */
temp2 &= 0xF0;
temp2 += 0x10;
}
@@ -994,15 +421,15 @@ void XGINew_SetDRAMDefaultRegister340(
temp3 = 0;
for (k = 0; k < 4; k++) {
- XGINew_SetRegANDOR(P3d4, 0x6E, 0xFC, temp3); /* CR6E_D[1:0] select channel */
+ xgifb_reg_and_or(P3d4, 0x6E, 0xFC, temp3); /* CR6E_D[1:0] select channel */
temp2 = 0;
for (i = 0; i < 8; i++) {
temp = pVBInfo->CR6F[XGINew_RAMType][8 * k + i]; /* CR6F DQ fine tune delay */
for (j = 0; j < 4; j++) {
temp1 = (temp >> (2 * j)) & 0x03;
temp2 |= temp1;
- XGINew_SetReg1(P3d4, 0x6F, temp2);
- XGINew_GetReg1(P3d4, 0x6F); /* Insert read command for delay */
+ xgifb_reg_set(P3d4, 0x6F, temp2);
+ xgifb_reg_get(P3d4, 0x6F); /* Insert read command for delay */
temp2 &= 0xF8;
temp2 += 0x08;
}
@@ -1010,16 +437,16 @@ void XGINew_SetDRAMDefaultRegister340(
temp3 += 0x01;
}
- XGINew_SetReg1(P3d4, 0x80, pVBInfo->CR40[9][XGINew_RAMType]); /* CR80 */
- XGINew_SetReg1(P3d4, 0x81, pVBInfo->CR40[10][XGINew_RAMType]); /* CR81 */
+ xgifb_reg_set(P3d4, 0x80, pVBInfo->CR40[9][XGINew_RAMType]); /* CR80 */
+ xgifb_reg_set(P3d4, 0x81, pVBInfo->CR40[10][XGINew_RAMType]); /* CR81 */
temp2 = 0x80;
temp = pVBInfo->CR89[XGINew_RAMType][0]; /* CR89 terminator type select */
for (j = 0; j < 4; j++) {
temp1 = (temp >> (2 * j)) & 0x03;
temp2 |= temp1;
- XGINew_SetReg1(P3d4, 0x89, temp2);
- XGINew_GetReg1(P3d4, 0x89); /* Insert read command for delay */
+ xgifb_reg_set(P3d4, 0x89, temp2);
+ xgifb_reg_get(P3d4, 0x89); /* Insert read command for delay */
temp2 &= 0xF0;
temp2 += 0x10;
}
@@ -1027,319 +454,59 @@ void XGINew_SetDRAMDefaultRegister340(
temp = pVBInfo->CR89[XGINew_RAMType][1];
temp1 = temp & 0x03;
temp2 |= temp1;
- XGINew_SetReg1(P3d4, 0x89, temp2);
+ xgifb_reg_set(P3d4, 0x89, temp2);
temp = pVBInfo->CR40[3][XGINew_RAMType];
temp1 = temp & 0x0F;
temp2 = (temp >> 4) & 0x07;
temp3 = temp & 0x80;
- XGINew_SetReg1(P3d4, 0x45, temp1); /* CR45 */
- XGINew_SetReg1(P3d4, 0x99, temp2); /* CR99 */
- XGINew_SetRegOR(P3d4, 0x40, temp3); /* CR40_D[7] */
- XGINew_SetReg1(P3d4, 0x41, pVBInfo->CR40[0][XGINew_RAMType]); /* CR41 */
+ xgifb_reg_set(P3d4, 0x45, temp1); /* CR45 */
+ xgifb_reg_set(P3d4, 0x99, temp2); /* CR99 */
+ xgifb_reg_or(P3d4, 0x40, temp3); /* CR40_D[7] */
+ xgifb_reg_set(P3d4, 0x41, pVBInfo->CR40[0][XGINew_RAMType]); /* CR41 */
if (HwDeviceExtension->jChipType == XG27)
- XGINew_SetReg1(P3d4, 0x8F, *pVBInfo->pCR8F); /* CR8F */
+ xgifb_reg_set(P3d4, 0x8F, *pVBInfo->pCR8F); /* CR8F */
for (j = 0; j <= 6; j++)
- XGINew_SetReg1(P3d4, (0x90 + j),
+ xgifb_reg_set(P3d4, (0x90 + j),
pVBInfo->CR40[14 + j][XGINew_RAMType]); /* CR90 - CR96 */
for (j = 0; j <= 2; j++)
- XGINew_SetReg1(P3d4, (0xC3 + j),
+ xgifb_reg_set(P3d4, (0xC3 + j),
pVBInfo->CR40[21 + j][XGINew_RAMType]); /* CRC3 - CRC5 */
for (j = 0; j < 2; j++)
- XGINew_SetReg1(P3d4, (0x8A + j),
+ xgifb_reg_set(P3d4, (0x8A + j),
pVBInfo->CR40[1 + j][XGINew_RAMType]); /* CR8A - CR8B */
if ((HwDeviceExtension->jChipType == XG41) || (HwDeviceExtension->jChipType == XG42))
- XGINew_SetReg1(P3d4, 0x8C, 0x87);
+ xgifb_reg_set(P3d4, 0x8C, 0x87);
- XGINew_SetReg1(P3d4, 0x59, pVBInfo->CR40[4][XGINew_RAMType]); /* CR59 */
+ xgifb_reg_set(P3d4, 0x59, pVBInfo->CR40[4][XGINew_RAMType]); /* CR59 */
- XGINew_SetReg1(P3d4, 0x83, 0x09); /* CR83 */
- XGINew_SetReg1(P3d4, 0x87, 0x00); /* CR87 */
- XGINew_SetReg1(P3d4, 0xCF, *pVBInfo->pCRCF); /* CRCF */
+ xgifb_reg_set(P3d4, 0x83, 0x09); /* CR83 */
+ xgifb_reg_set(P3d4, 0x87, 0x00); /* CR87 */
+ xgifb_reg_set(P3d4, 0xCF, *pVBInfo->pCRCF); /* CRCF */
if (XGINew_RAMType) {
- /* XGINew_SetReg1(P3c4, 0x17, 0xC0); */ /* SR17 DDRII */
- XGINew_SetReg1(P3c4, 0x17, 0x80); /* SR17 DDRII */
+ /* xgifb_reg_set(P3c4, 0x17, 0xC0); */ /* SR17 DDRII */
+ xgifb_reg_set(P3c4, 0x17, 0x80); /* SR17 DDRII */
if (HwDeviceExtension->jChipType == XG27)
- XGINew_SetReg1(P3c4, 0x17, 0x02); /* SR17 DDRII */
+ xgifb_reg_set(P3c4, 0x17, 0x02); /* SR17 DDRII */
} else {
- XGINew_SetReg1(P3c4, 0x17, 0x00); /* SR17 DDR */
+ xgifb_reg_set(P3c4, 0x17, 0x00); /* SR17 DDR */
}
- XGINew_SetReg1(P3c4, 0x1A, 0x87); /* SR1A */
+ xgifb_reg_set(P3c4, 0x1A, 0x87); /* SR1A */
temp = XGINew_GetXG20DRAMType(HwDeviceExtension, pVBInfo);
if (temp == 0) {
XGINew_DDR1x_DefaultRegister(HwDeviceExtension, P3d4, pVBInfo);
} else {
- XGINew_SetReg1(P3d4, 0xB0, 0x80); /* DDRII Dual frequency mode */
+ xgifb_reg_set(P3d4, 0xB0, 0x80); /* DDRII Dual frequency mode */
XGINew_DDR2_DefaultRegister(HwDeviceExtension, P3d4, pVBInfo);
}
- XGINew_SetReg1(P3c4, 0x1B, pVBInfo->SR15[3][XGINew_RAMType]); /* SR1B */
-}
-
-static void XGINew_DDR_MRS(struct vb_device_info *pVBInfo)
-{
- unsigned short data;
-
- volatile unsigned char *pVideoMemory = (unsigned char *) pVBInfo->ROMAddr;
-
- /* SR16 <- 1F,DF,2F,AF */
- /* yriver modified SR16 <- 0F,DF,0F,AF */
- /* enable DLL of DDR SD/SGRAM , SR16 D4=1 */
- data = pVideoMemory[0xFB];
- /* data = XGINew_GetReg1(pVBInfo->P3c4, 0x16); */
-
- data &= 0x0F;
- XGINew_SetReg1(pVBInfo->P3c4, 0x16, data);
- data |= 0xC0;
- XGINew_SetReg1(pVBInfo->P3c4, 0x16, data);
- data &= 0x0F;
- XGINew_SetReg1(pVBInfo->P3c4, 0x16, data);
- data |= 0x80;
- XGINew_SetReg1(pVBInfo->P3c4, 0x16, data);
- data &= 0x0F;
- XGINew_SetReg1(pVBInfo->P3c4, 0x16, data);
- data |= 0xD0;
- XGINew_SetReg1(pVBInfo->P3c4, 0x16, data);
- data &= 0x0F;
- XGINew_SetReg1(pVBInfo->P3c4, 0x16, data);
- data |= 0xA0;
- XGINew_SetReg1(pVBInfo->P3c4, 0x16, data);
- /*
- else {
- data &= 0x0F;
- data |= 0x10;
- XGINew_SetReg1(pVBInfo->P3c4,0x16,data);
-
- if (!(pVBInfo->SR15[1][XGINew_RAMType] & 0x10)) {
- data &= 0x0F;
- }
-
- data |= 0xC0;
- XGINew_SetReg1(pVBInfo->P3c4,0x16,data);
-
- data &= 0x0F;
- data |= 0x20;
- XGINew_SetReg1(pVBInfo->P3c4,0x16,data);
- if (!(pVBInfo->SR15[1][XGINew_RAMType] & 0x10)) {
- data &= 0x0F;
- }
-
- data |= 0x80;
- XGINew_SetReg1(pVBInfo->P3c4,0x16,data);
- }
- */
-}
-
-/* check if read cache pointer is correct */
-
-static void XGINew_VerifyMclk(struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo)
-{
- unsigned char *pVideoMemory = pVBInfo->FBAddr;
- unsigned char i, j;
- unsigned short Temp, SR21;
-
- pVideoMemory[0] = 0xaa; /* alan */
- pVideoMemory[16] = 0x55; /* note: PCI read cache is off */
-
- if ((pVideoMemory[0] != 0xaa) || (pVideoMemory[16] != 0x55)) {
- for (i = 0, j = 16; i < 2; i++, j += 16) {
- SR21 = XGINew_GetReg1(pVBInfo->P3c4, 0x21);
- Temp = SR21 & 0xFB; /* disable PCI post write buffer empty gating */
- XGINew_SetReg1(pVBInfo->P3c4, 0x21, Temp);
-
- Temp = XGINew_GetReg1(pVBInfo->P3c4, 0x3C);
- Temp |= 0x01; /* MCLK reset */
-
- Temp = XGINew_GetReg1(pVBInfo->P3c4, 0x3C);
- Temp &= 0xFE; /* MCLK normal operation */
-
- XGINew_SetReg1(pVBInfo->P3c4, 0x21, SR21);
-
- pVideoMemory[16 + j] = j;
- if (pVideoMemory[16 + j] == j) {
- pVideoMemory[j] = j;
- break;
- }
- }
- }
-}
-
-void XGINew_SetDRAMSize_340(struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo)
-{
- unsigned short data;
-
- pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase;
- pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress;
-
- XGISetModeNew(HwDeviceExtension, 0x2e);
-
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x21);
- XGINew_SetReg1(pVBInfo->P3c4, 0x21, (unsigned short) (data & 0xDF)); /* disable read cache */
- XGI_DisplayOff(HwDeviceExtension, pVBInfo);
-
- /* data = XGINew_GetReg1(pVBInfo->P3c4, 0x1); */
- /* data |= 0x20 ; */
- /* XGINew_SetReg1(pVBInfo->P3c4, 0x01, data); *//* Turn OFF Display */
- XGINew_DDRSizing340(HwDeviceExtension, pVBInfo);
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x21);
- XGINew_SetReg1(pVBInfo->P3c4, 0x21, (unsigned short) (data | 0x20)); /* enable read cache */
-}
-
-void XGINew_SetDRAMSize_310(struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo)
-{
- unsigned short data;
- pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase, pVBInfo->FBAddr
- = HwDeviceExtension->pjVideoMemoryAddress;
-#ifdef XGI301
- /* XGINew_SetReg1(pVBInfo->P3d4, 0x30, 0x40); */
-#endif
-
-#ifdef XGI302 /* alan,should change value */
- XGINew_SetReg1(pVBInfo->P3d4, 0x30, 0x4D);
- XGINew_SetReg1(pVBInfo->P3d4, 0x31, 0xc0);
- XGINew_SetReg1(pVBInfo->P3d4, 0x34, 0x3F);
-#endif
-
- XGISetModeNew(HwDeviceExtension, 0x2e);
-
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x21);
- XGINew_SetReg1(pVBInfo->P3c4, 0x21, (unsigned short) (data & 0xDF)); /* disable read cache */
-
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x1);
- data |= 0x20;
- XGINew_SetReg1(pVBInfo->P3c4, 0x01, data); /* Turn OFF Display */
-
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x16);
-
- XGINew_SetReg1(pVBInfo->P3c4, 0x16, (unsigned short) (data | 0x0F)); /* assume lowest speed DRAM */
-
- XGINew_SetDRAMModeRegister(pVBInfo);
- XGINew_DisableRefresh(HwDeviceExtension, pVBInfo);
- XGINew_CheckBusWidth_310(pVBInfo);
- XGINew_VerifyMclk(HwDeviceExtension, pVBInfo); /* alan 2000/7/3 */
-
- if (XGINew_Get310DRAMType(pVBInfo) < 2)
- XGINew_SDRSizing(pVBInfo);
- else
- XGINew_DDRSizing(pVBInfo);
-
- XGINew_SetReg1(pVBInfo->P3c4, 0x16, pVBInfo->SR15[1][XGINew_RAMType]); /* restore SR16 */
-
- XGINew_EnableRefresh(HwDeviceExtension, pVBInfo);
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x21);
- XGINew_SetReg1(pVBInfo->P3c4, 0x21, (unsigned short) (data | 0x20)); /* enable read cache */
-}
-
-void XGINew_SetDRAMModeRegister340(struct xgi_hw_device_info *HwDeviceExtension)
-{
- unsigned char data;
- struct vb_device_info VBINF;
- struct vb_device_info *pVBInfo = &VBINF;
- pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase;
- pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress;
- pVBInfo->BaseAddr = (unsigned long) HwDeviceExtension->pjIOAddress;
- pVBInfo->ISXPDOS = 0;
-
- pVBInfo->P3c4 = pVBInfo->BaseAddr + 0x14;
- pVBInfo->P3d4 = pVBInfo->BaseAddr + 0x24;
- pVBInfo->P3c0 = pVBInfo->BaseAddr + 0x10;
- pVBInfo->P3ce = pVBInfo->BaseAddr + 0x1e;
- pVBInfo->P3c2 = pVBInfo->BaseAddr + 0x12;
- pVBInfo->P3ca = pVBInfo->BaseAddr + 0x1a;
- pVBInfo->P3c6 = pVBInfo->BaseAddr + 0x16;
- pVBInfo->P3c7 = pVBInfo->BaseAddr + 0x17;
- pVBInfo->P3c8 = pVBInfo->BaseAddr + 0x18;
- pVBInfo->P3c9 = pVBInfo->BaseAddr + 0x19;
- pVBInfo->P3da = pVBInfo->BaseAddr + 0x2A;
- pVBInfo->Part0Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_00;
- pVBInfo->Part1Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_04;
- pVBInfo->Part2Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_10;
- pVBInfo->Part3Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_12;
- pVBInfo->Part4Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14;
- pVBInfo->Part5Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14 + 2;
- if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 */
- XGI_GetVBType(pVBInfo); /* Run XGI_GetVBType before InitTo330Pointer */
-
- InitTo330Pointer(HwDeviceExtension->jChipType, pVBInfo);
-
- ReadVBIOSTablData(HwDeviceExtension->jChipType, pVBInfo);
-
- if (XGINew_GetXG20DRAMType(HwDeviceExtension, pVBInfo) == 0) {
- data = (XGINew_GetReg1(pVBInfo->P3c4, 0x39) & 0x02) >> 1;
- if (data == 0x01)
- XGINew_DDR2x_MRS_340(pVBInfo->P3c4, pVBInfo);
- else
- XGINew_DDR1x_MRS_340(pVBInfo->P3c4, pVBInfo);
- } else {
- XGINew_DDR2_MRS_XG20(HwDeviceExtension, pVBInfo->P3c4, pVBInfo);
- }
- XGINew_SetReg1(pVBInfo->P3c4, 0x1B, 0x03);
-}
-
-void XGINew_SetDRAMModeRegister(struct vb_device_info *pVBInfo)
-{
- if (XGINew_Get310DRAMType(pVBInfo) < 2) {
- XGINew_SDR_MRS(pVBInfo);
- } else {
- /* SR16 <- 0F,CF,0F,8F */
- XGINew_DDR_MRS(pVBInfo);
- }
-}
-
-void XGINew_DisableRefresh(struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo)
-{
- unsigned short data;
-
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x1B);
- data &= 0xF8;
- XGINew_SetReg1(pVBInfo->P3c4, 0x1B, data);
-
-}
-
-void XGINew_EnableRefresh(struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo)
-{
-
- XGINew_SetReg1(pVBInfo->P3c4, 0x1B, pVBInfo->SR15[3][XGINew_RAMType]); /* SR1B */
-
-}
-
-static void XGINew_DisableChannelInterleaving(int index,
- unsigned short XGINew_DDRDRAM_TYPE[][5],
- struct vb_device_info *pVBInfo)
-{
- unsigned short data;
-
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x15);
- data &= 0x1F;
-
- switch (XGINew_DDRDRAM_TYPE[index][3]) {
- case 64:
- data |= 0;
- break;
- case 32:
- data |= 0x20;
- break;
- case 16:
- data |= 0x40;
- break;
- case 4:
- data |= 0x60;
- break;
- default:
- break;
- }
- XGINew_SetReg1(pVBInfo->P3c4, 0x15, data);
+ xgifb_reg_set(P3c4, 0x1B, pVBInfo->SR15[3][XGINew_RAMType]); /* SR1B */
}
static void XGINew_SetDRAMSizingType(int index,
@@ -1349,354 +516,11 @@ static void XGINew_SetDRAMSizingType(int index,
unsigned short data;
data = DRAMTYPE_TABLE[index][4];
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x13, 0x80, data);
- DelayUS(15);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x13, 0x80, data);
+ udelay(15);
/* should delay 50 ns */
}
-void XGINew_CheckBusWidth_310(struct vb_device_info *pVBInfo)
-{
- unsigned short data;
- volatile unsigned long *pVideoMemory;
-
- pVideoMemory = (unsigned long *) pVBInfo->FBAddr;
-
- if (XGINew_Get310DRAMType(pVBInfo) < 2) {
- XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0x00);
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x12);
- /* should delay */
- XGINew_SDR_MRS(pVBInfo);
-
- XGINew_ChannelAB = 0;
- XGINew_DataBusWidth = 128;
- pVideoMemory[0] = 0x01234567L;
- pVideoMemory[1] = 0x456789ABL;
- pVideoMemory[2] = 0x89ABCDEFL;
- pVideoMemory[3] = 0xCDEF0123L;
- pVideoMemory[4] = 0x55555555L;
- pVideoMemory[5] = 0x55555555L;
- pVideoMemory[6] = 0xFFFFFFFFL;
- pVideoMemory[7] = 0xFFFFFFFFL;
-
- if ((pVideoMemory[3] != 0xCDEF0123L) || (pVideoMemory[2]
- != 0x89ABCDEFL)) {
- /* ChannelA64Bit */
- XGINew_DataBusWidth = 64;
- XGINew_ChannelAB = 0;
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x14);
- XGINew_SetReg1(pVBInfo->P3c4, 0x14,
- (unsigned short) (data & 0xFD));
- }
-
- if ((pVideoMemory[1] != 0x456789ABL) || (pVideoMemory[0]
- != 0x01234567L)) {
- /* ChannelB64Bit */
- XGINew_DataBusWidth = 64;
- XGINew_ChannelAB = 1;
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x14);
- XGINew_SetReg1(pVBInfo->P3c4, 0x14,
- (unsigned short) ((data & 0xFD) | 0x01));
- }
-
- return;
- } else {
- /* DDR Dual channel */
- XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0x00);
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x02); /* Channel A, 64bit */
- /* should delay */
- XGINew_DDR_MRS(pVBInfo);
-
- XGINew_ChannelAB = 0;
- XGINew_DataBusWidth = 64;
- pVideoMemory[0] = 0x01234567L;
- pVideoMemory[1] = 0x456789ABL;
- pVideoMemory[2] = 0x89ABCDEFL;
- pVideoMemory[3] = 0xCDEF0123L;
- pVideoMemory[4] = 0x55555555L;
- pVideoMemory[5] = 0x55555555L;
- pVideoMemory[6] = 0xAAAAAAAAL;
- pVideoMemory[7] = 0xAAAAAAAAL;
-
- if (pVideoMemory[1] == 0x456789ABL) {
- if (pVideoMemory[0] == 0x01234567L) {
- /* Channel A 64bit */
- return;
- }
- } else {
- if (pVideoMemory[0] == 0x01234567L) {
- /* Channel A 32bit */
- XGINew_DataBusWidth = 32;
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x00);
- return;
- }
- }
-
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x03); /* Channel B, 64bit */
- XGINew_DDR_MRS(pVBInfo);
-
- XGINew_ChannelAB = 1;
- XGINew_DataBusWidth = 64;
- pVideoMemory[0] = 0x01234567L;
- pVideoMemory[1] = 0x456789ABL;
- pVideoMemory[2] = 0x89ABCDEFL;
- pVideoMemory[3] = 0xCDEF0123L;
- pVideoMemory[4] = 0x55555555L;
- pVideoMemory[5] = 0x55555555L;
- pVideoMemory[6] = 0xAAAAAAAAL;
- pVideoMemory[7] = 0xAAAAAAAAL;
-
- if (pVideoMemory[1] == 0x456789ABL) {
- /* Channel B 64 */
- if (pVideoMemory[0] == 0x01234567L) {
- /* Channel B 64bit */
- return;
- } else {
- /* error */
- }
- } else {
- if (pVideoMemory[0] == 0x01234567L) {
- /* Channel B 32 */
- XGINew_DataBusWidth = 32;
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x01);
- } else {
- /* error */
- }
- }
- }
-}
-
-static int XGINew_SetRank(int index, unsigned char RankNo,
- unsigned char XGINew_ChannelAB,
- unsigned short DRAMTYPE_TABLE[][5],
- struct vb_device_info *pVBInfo)
-{
- unsigned short data;
- int RankSize;
-
- if ((RankNo == 2) && (DRAMTYPE_TABLE[index][0] == 2))
- return 0;
-
- RankSize = DRAMTYPE_TABLE[index][3] / 2 * XGINew_DataBusWidth / 32;
-
- if ((RankNo * RankSize) <= 128) {
- data = 0;
-
- while ((RankSize >>= 1) > 0)
- data += 0x10;
-
- data |= (RankNo - 1) << 2;
- data |= (XGINew_DataBusWidth / 64) & 2;
- data |= XGINew_ChannelAB;
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, data);
- /* should delay */
- XGINew_SDR_MRS(pVBInfo);
- return 1;
- } else {
- return 0;
- }
-}
-
-static int XGINew_SetDDRChannel(int index, unsigned char ChannelNo,
- unsigned char XGINew_ChannelAB,
- unsigned short DRAMTYPE_TABLE[][5],
- struct vb_device_info *pVBInfo)
-{
- unsigned short data;
- int RankSize;
-
- RankSize = DRAMTYPE_TABLE[index][3] / 2 * XGINew_DataBusWidth / 32;
- /* RankSize = DRAMTYPE_TABLE[index][3]; */
- if (ChannelNo * RankSize <= 128) {
- data = 0;
- while ((RankSize >>= 1) > 0)
- data += 0x10;
-
- if (ChannelNo == 2)
- data |= 0x0C;
-
- data |= (XGINew_DataBusWidth / 32) & 2;
- data |= XGINew_ChannelAB;
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, data);
- /* should delay */
- XGINew_DDR_MRS(pVBInfo);
- return 1;
- } else {
- return 0;
- }
-}
-
-static int XGINew_CheckColumn(int index, unsigned short DRAMTYPE_TABLE[][5],
- struct vb_device_info *pVBInfo)
-{
- int i;
- unsigned long Increment, Position;
-
- /* Increment = 1 << (DRAMTYPE_TABLE[index][2] + XGINew_DataBusWidth / 64 + 1); */
- Increment = 1 << (10 + XGINew_DataBusWidth / 64);
-
- for (i = 0, Position = 0; i < 2; i++) {
- *((unsigned long *) (pVBInfo->FBAddr + Position)) = Position;
- Position += Increment;
- }
-
- for (i = 0, Position = 0; i < 2; i++) {
- /* if ( pVBInfo->FBAddr[ Position ] != Position ) */
- if ((*(unsigned long *) (pVBInfo->FBAddr + Position)) != Position)
- return 0;
- Position += Increment;
- }
- return 1;
-}
-
-static int XGINew_CheckBanks(int index, unsigned short DRAMTYPE_TABLE[][5],
- struct vb_device_info *pVBInfo)
-{
- int i;
- unsigned long Increment, Position;
-
- Increment = 1 << (DRAMTYPE_TABLE[index][2] + XGINew_DataBusWidth / 64 + 2);
-
- for (i = 0, Position = 0; i < 4; i++) {
- /* pVBInfo->FBAddr[Position] = Position; */
- *((unsigned long *) (pVBInfo->FBAddr + Position)) = Position;
- Position += Increment;
- }
-
- for (i = 0, Position = 0; i < 4; i++) {
- /* if (pVBInfo->FBAddr[Position] != Position) */
- if ((*(unsigned long *) (pVBInfo->FBAddr + Position)) != Position)
- return 0;
- Position += Increment;
- }
- return 1;
-}
-
-static int XGINew_CheckRank(int RankNo, int index,
- unsigned short DRAMTYPE_TABLE[][5],
- struct vb_device_info *pVBInfo)
-{
- int i;
- unsigned long Increment, Position;
-
- Increment = 1 << (DRAMTYPE_TABLE[index][2] + DRAMTYPE_TABLE[index][1]
- + DRAMTYPE_TABLE[index][0] + XGINew_DataBusWidth / 64
- + RankNo);
-
- for (i = 0, Position = 0; i < 2; i++) {
- /* pVBInfo->FBAddr[Position] = Position; */
- /* *((unsigned long *)(pVBInfo->FBAddr)) = Position; */
- *((unsigned long *) (pVBInfo->FBAddr + Position)) = Position;
- Position += Increment;
- }
-
- for (i = 0, Position = 0; i < 2; i++) {
- /* if (pVBInfo->FBAddr[Position] != Position) */
- /* if ((*(unsigned long *)(pVBInfo->FBAddr)) != Position) */
- if ((*(unsigned long *) (pVBInfo->FBAddr + Position)) != Position)
- return 0;
- Position += Increment;
- }
- return 1;
-}
-
-static int XGINew_CheckDDRRank(int RankNo, int index,
- unsigned short DRAMTYPE_TABLE[][5],
- struct vb_device_info *pVBInfo)
-{
- unsigned long Increment, Position;
- unsigned short data;
-
- Increment = 1 << (DRAMTYPE_TABLE[index][2] + DRAMTYPE_TABLE[index][1]
- + DRAMTYPE_TABLE[index][0] + XGINew_DataBusWidth / 64
- + RankNo);
-
- Increment += Increment / 2;
-
- Position = 0;
- *((unsigned long *) (pVBInfo->FBAddr + Position + 0)) = 0x01234567;
- *((unsigned long *) (pVBInfo->FBAddr + Position + 1)) = 0x456789AB;
- *((unsigned long *) (pVBInfo->FBAddr + Position + 2)) = 0x55555555;
- *((unsigned long *) (pVBInfo->FBAddr + Position + 3)) = 0x55555555;
- *((unsigned long *) (pVBInfo->FBAddr + Position + 4)) = 0xAAAAAAAA;
- *((unsigned long *) (pVBInfo->FBAddr + Position + 5)) = 0xAAAAAAAA;
-
- if ((*(unsigned long *) (pVBInfo->FBAddr + 1)) == 0x456789AB)
- return 1;
-
- if ((*(unsigned long *) (pVBInfo->FBAddr + 0)) == 0x01234567)
- return 0;
-
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x14);
- data &= 0xF3;
- data |= 0x0E;
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, data);
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x15);
- data += 0x20;
- XGINew_SetReg1(pVBInfo->P3c4, 0x15, data);
-
- return 1;
-}
-
-static int XGINew_CheckRanks(int RankNo, int index,
- unsigned short DRAMTYPE_TABLE[][5],
- struct vb_device_info *pVBInfo)
-{
- int r;
-
- for (r = RankNo; r >= 1; r--) {
- if (!XGINew_CheckRank(r, index, DRAMTYPE_TABLE, pVBInfo))
- return 0;
- }
-
- if (!XGINew_CheckBanks(index, DRAMTYPE_TABLE, pVBInfo))
- return 0;
-
- if (!XGINew_CheckColumn(index, DRAMTYPE_TABLE, pVBInfo))
- return 0;
-
- return 1;
-}
-
-static int XGINew_CheckDDRRanks(int RankNo, int index,
- unsigned short DRAMTYPE_TABLE[][5],
- struct vb_device_info *pVBInfo)
-{
- int r;
-
- for (r = RankNo; r >= 1; r--) {
- if (!XGINew_CheckDDRRank(r, index, DRAMTYPE_TABLE, pVBInfo))
- return 0;
- }
-
- if (!XGINew_CheckBanks(index, DRAMTYPE_TABLE, pVBInfo))
- return 0;
-
- if (!XGINew_CheckColumn(index, DRAMTYPE_TABLE, pVBInfo))
- return 0;
-
- return 1;
-}
-
-int XGINew_SDRSizing(struct vb_device_info *pVBInfo)
-{
- int i;
- unsigned char j;
-
- for (i = 0; i < 13; i++) {
- XGINew_SetDRAMSizingType(i, XGINew_SDRDRAM_TYPE, pVBInfo);
-
- for (j = 2; j > 0; j--) {
- if (!XGINew_SetRank(i, (unsigned char) j, XGINew_ChannelAB, XGINew_SDRDRAM_TYPE, pVBInfo)) {
- continue;
- } else {
- if (XGINew_CheckRanks(j, i, XGINew_SDRDRAM_TYPE, pVBInfo))
- return 1;
- }
- }
- }
- return 0;
-}
-
static unsigned short XGINew_SetDRAMSizeReg(int index,
unsigned short DRAMTYPE_TABLE[][5],
struct vb_device_info *pVBInfo)
@@ -1706,7 +530,7 @@ static unsigned short XGINew_SetDRAMSizeReg(int index,
unsigned char ChannelNo;
RankSize = DRAMTYPE_TABLE[index][3] * XGINew_DataBusWidth / 32;
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x13);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x13);
data &= 0x80;
if (data == 0x80)
@@ -1726,11 +550,11 @@ static unsigned short XGINew_SetDRAMSizeReg(int index,
memsize = data >> 4;
/* [2004/03/25] Vicent, Fix DRAM Sizing Error */
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, (XGINew_GetReg1(pVBInfo->P3c4, 0x14) & 0x0F) | (data & 0xF0));
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, (xgifb_reg_get(pVBInfo->P3c4, 0x14) & 0x0F) | (data & 0xF0));
/* data |= XGINew_ChannelAB << 2; */
/* data |= (XGINew_DataBusWidth / 64) << 1; */
- /* XGINew_SetReg1(pVBInfo->P3c4, 0x14, data); */
+ /* xgifb_reg_set(pVBInfo->P3c4, 0x14, data); */
/* should delay */
/* XGINew_SetDRAMModeRegister340(pVBInfo); */
@@ -1747,7 +571,7 @@ static unsigned short XGINew_SetDRAMSize20Reg(int index,
unsigned char ChannelNo;
RankSize = DRAMTYPE_TABLE[index][3] * XGINew_DataBusWidth / 8;
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x13);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x13);
data &= 0x80;
if (data == 0x80)
@@ -1767,12 +591,12 @@ static unsigned short XGINew_SetDRAMSize20Reg(int index,
memsize = data >> 4;
/* [2004/03/25] Vicent, Fix DRAM Sizing Error */
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, (XGINew_GetReg1(pVBInfo->P3c4, 0x14) & 0x0F) | (data & 0xF0));
- DelayUS(15);
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, (xgifb_reg_get(pVBInfo->P3c4, 0x14) & 0x0F) | (data & 0xF0));
+ udelay(15);
/* data |= XGINew_ChannelAB << 2; */
/* data |= (XGINew_DataBusWidth / 64) << 1; */
- /* XGINew_SetReg1(pVBInfo->P3c4, 0x14, data); */
+ /* xgifb_reg_set(pVBInfo->P3c4, 0x14, data); */
/* should delay */
/* XGINew_SetDRAMModeRegister340(pVBInfo); */
@@ -1793,7 +617,7 @@ static int XGINew_ReadWriteRest(unsigned short StopAddr,
*((unsigned long *) (pVBInfo->FBAddr + Position)) = Position;
}
- DelayUS(500); /* [Vicent] 2004/04/16. Fix #1759 Memory Size error in Multi-Adapter. */
+ udelay(500); /* [Vicent] 2004/04/16. Fix #1759 Memory Size error in Multi-Adapter. */
Position = 0;
@@ -1812,10 +636,10 @@ static unsigned char XGINew_CheckFrequence(struct vb_device_info *pVBInfo)
{
unsigned char data;
- data = XGINew_GetReg1(pVBInfo->P3d4, 0x97);
+ data = xgifb_reg_get(pVBInfo->P3d4, 0x97);
if ((data & 0x10) == 0) {
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x39);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x39);
data = (data & 0x02) >> 1;
return data;
} else {
@@ -1831,7 +655,7 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension,
switch (HwDeviceExtension->jChipType) {
case XG20:
case XG21:
- data = XGINew_GetReg1(pVBInfo->P3d4, 0x97);
+ data = xgifb_reg_get(pVBInfo->P3d4, 0x97);
data = data & 0x01;
XGINew_ChannelAB = 1; /* XG20 "JUST" one channel */
@@ -1841,17 +665,17 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension,
> 0x1000000) {
XGINew_DataBusWidth = 32; /* 32 bits */
- XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0xB1); /* 22bit + 2 rank + 32bit */
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x52);
- DelayUS(15);
+ xgifb_reg_set(pVBInfo->P3c4, 0x13, 0xB1); /* 22bit + 2 rank + 32bit */
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x52);
+ udelay(15);
if (XGINew_ReadWriteRest(24, 23, pVBInfo) == 1)
return;
if ((HwDeviceExtension->ulVideoMemorySize - 1) > 0x800000) {
- XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0x31); /* 22bit + 1 rank + 32bit */
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x42);
- DelayUS(15);
+ xgifb_reg_set(pVBInfo->P3c4, 0x13, 0x31); /* 22bit + 1 rank + 32bit */
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x42);
+ udelay(15);
if (XGINew_ReadWriteRest(23, 23, pVBInfo) == 1)
return;
@@ -1860,32 +684,32 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension,
if ((HwDeviceExtension->ulVideoMemorySize - 1) > 0x800000) {
XGINew_DataBusWidth = 16; /* 16 bits */
- XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0xB1); /* 22bit + 2 rank + 16bit */
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x41);
- DelayUS(15);
+ xgifb_reg_set(pVBInfo->P3c4, 0x13, 0xB1); /* 22bit + 2 rank + 16bit */
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x41);
+ udelay(15);
if (XGINew_ReadWriteRest(23, 22, pVBInfo) == 1)
return;
else
- XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0x31);
- DelayUS(15);
+ xgifb_reg_set(pVBInfo->P3c4, 0x13, 0x31);
+ udelay(15);
}
} else { /* Dual_16_8 */
if ((HwDeviceExtension->ulVideoMemorySize - 1) > 0x800000) {
XGINew_DataBusWidth = 16; /* 16 bits */
- XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0xB1); /* (0x31:12x8x2) 22bit + 2 rank */
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x41); /* 0x41:16Mx16 bit*/
- DelayUS(15);
+ xgifb_reg_set(pVBInfo->P3c4, 0x13, 0xB1); /* (0x31:12x8x2) 22bit + 2 rank */
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x41); /* 0x41:16Mx16 bit*/
+ udelay(15);
if (XGINew_ReadWriteRest(23, 22, pVBInfo) == 1)
return;
if ((HwDeviceExtension->ulVideoMemorySize - 1) > 0x400000) {
- XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0x31); /* (0x31:12x8x2) 22bit + 1 rank */
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x31); /* 0x31:8Mx16 bit*/
- DelayUS(15);
+ xgifb_reg_set(pVBInfo->P3c4, 0x13, 0x31); /* (0x31:12x8x2) 22bit + 1 rank */
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x31); /* 0x31:8Mx16 bit*/
+ udelay(15);
if (XGINew_ReadWriteRest(22, 22, pVBInfo) == 1)
return;
@@ -1894,15 +718,15 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension,
if ((HwDeviceExtension->ulVideoMemorySize - 1) > 0x400000) {
XGINew_DataBusWidth = 8; /* 8 bits */
- XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0xB1); /* (0x31:12x8x2) 22bit + 2 rank */
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x30); /* 0x30:8Mx8 bit*/
- DelayUS(15);
+ xgifb_reg_set(pVBInfo->P3c4, 0x13, 0xB1); /* (0x31:12x8x2) 22bit + 2 rank */
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x30); /* 0x30:8Mx8 bit*/
+ udelay(15);
if (XGINew_ReadWriteRest(22, 21, pVBInfo) == 1)
return;
else
- XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0x31); /* (0x31:12x8x2) 22bit + 1 rank */
- DelayUS(15);
+ xgifb_reg_set(pVBInfo->P3c4, 0x13, 0x31); /* (0x31:12x8x2) 22bit + 1 rank */
+ udelay(15);
}
}
break;
@@ -1910,76 +734,76 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension,
case XG27:
XGINew_DataBusWidth = 16; /* 16 bits */
XGINew_ChannelAB = 1; /* Single channel */
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x51); /* 32Mx16 bit*/
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x51); /* 32Mx16 bit*/
break;
case XG41:
if (XGINew_CheckFrequence(pVBInfo) == 1) {
XGINew_DataBusWidth = 32; /* 32 bits */
XGINew_ChannelAB = 3; /* Quad Channel */
- XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0xA1);
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x4C);
+ xgifb_reg_set(pVBInfo->P3c4, 0x13, 0xA1);
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x4C);
if (XGINew_ReadWriteRest(25, 23, pVBInfo) == 1)
return;
XGINew_ChannelAB = 2; /* Dual channels */
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x48);
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x48);
if (XGINew_ReadWriteRest(24, 23, pVBInfo) == 1)
return;
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x49);
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x49);
if (XGINew_ReadWriteRest(24, 23, pVBInfo) == 1)
return;
XGINew_ChannelAB = 3;
- XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0x21);
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x3C);
+ xgifb_reg_set(pVBInfo->P3c4, 0x13, 0x21);
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x3C);
if (XGINew_ReadWriteRest(24, 23, pVBInfo) == 1)
return;
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x38);
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x38);
if (XGINew_ReadWriteRest(8, 4, pVBInfo) == 1)
return;
else
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x39);
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x39);
} else { /* DDR */
XGINew_DataBusWidth = 64; /* 64 bits */
XGINew_ChannelAB = 2; /* Dual channels */
- XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0xA1);
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x5A);
+ xgifb_reg_set(pVBInfo->P3c4, 0x13, 0xA1);
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x5A);
if (XGINew_ReadWriteRest(25, 24, pVBInfo) == 1)
return;
XGINew_ChannelAB = 1; /* Single channels */
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x52);
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x52);
if (XGINew_ReadWriteRest(24, 23, pVBInfo) == 1)
return;
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x53);
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x53);
if (XGINew_ReadWriteRest(24, 23, pVBInfo) == 1)
return;
XGINew_ChannelAB = 2; /* Dual channels */
- XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0x21);
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x4A);
+ xgifb_reg_set(pVBInfo->P3c4, 0x13, 0x21);
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x4A);
if (XGINew_ReadWriteRest(24, 23, pVBInfo) == 1)
return;
XGINew_ChannelAB = 1; /* Single channels */
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x42);
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x42);
if (XGINew_ReadWriteRest(8, 4, pVBInfo) == 1)
return;
else
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x43);
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x43);
}
break;
@@ -1995,38 +819,38 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension,
if (XGINew_CheckFrequence(pVBInfo) == 1) { /* DDRII, DDR2x */
XGINew_DataBusWidth = 32; /* 32 bits */
XGINew_ChannelAB = 2; /* 2 Channel */
- XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0xA1);
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x44);
+ xgifb_reg_set(pVBInfo->P3c4, 0x13, 0xA1);
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x44);
if (XGINew_ReadWriteRest(24, 23, pVBInfo) == 1)
return;
- XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0x21);
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x34);
+ xgifb_reg_set(pVBInfo->P3c4, 0x13, 0x21);
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x34);
if (XGINew_ReadWriteRest(23, 22, pVBInfo) == 1)
return;
XGINew_ChannelAB = 1; /* Single Channel */
- XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0xA1);
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x40);
+ xgifb_reg_set(pVBInfo->P3c4, 0x13, 0xA1);
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x40);
if (XGINew_ReadWriteRest(23, 22, pVBInfo) == 1)
return;
else {
- XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0x21);
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x30);
+ xgifb_reg_set(pVBInfo->P3c4, 0x13, 0x21);
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x30);
}
} else { /* DDR */
XGINew_DataBusWidth = 64; /* 64 bits */
XGINew_ChannelAB = 1; /* 1 channels */
- XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0xA1);
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x52);
+ xgifb_reg_set(pVBInfo->P3c4, 0x13, 0xA1);
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x52);
if (XGINew_ReadWriteRest(24, 23, pVBInfo) == 1)
return;
else {
- XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0x21);
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x42);
+ xgifb_reg_set(pVBInfo->P3c4, 0x13, 0x21);
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x42);
}
}
@@ -2037,52 +861,52 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension,
if (XGINew_CheckFrequence(pVBInfo) == 1) { /* DDRII */
XGINew_DataBusWidth = 32; /* 32 bits */
XGINew_ChannelAB = 3;
- XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0xA1);
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x4C);
+ xgifb_reg_set(pVBInfo->P3c4, 0x13, 0xA1);
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x4C);
if (XGINew_ReadWriteRest(25, 23, pVBInfo) == 1)
return;
XGINew_ChannelAB = 2; /* 2 channels */
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x48);
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x48);
if (XGINew_ReadWriteRest(24, 23, pVBInfo) == 1)
return;
- XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0x21);
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x3C);
+ xgifb_reg_set(pVBInfo->P3c4, 0x13, 0x21);
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x3C);
if (XGINew_ReadWriteRest(24, 23, pVBInfo) == 1) {
XGINew_ChannelAB = 3; /* 4 channels */
} else {
XGINew_ChannelAB = 2; /* 2 channels */
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x38);
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x38);
}
} else { /* DDR */
XGINew_DataBusWidth = 64; /* 64 bits */
XGINew_ChannelAB = 2; /* 2 channels */
- XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0xA1);
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x5A);
+ xgifb_reg_set(pVBInfo->P3c4, 0x13, 0xA1);
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x5A);
if (XGINew_ReadWriteRest(25, 24, pVBInfo) == 1) {
return;
} else {
- XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0x21);
- XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x4A);
+ xgifb_reg_set(pVBInfo->P3c4, 0x13, 0x21);
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x4A);
}
}
break;
}
}
-int XGINew_DDRSizing340(struct xgi_hw_device_info *HwDeviceExtension,
+static int XGINew_DDRSizing340(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
int i;
unsigned short memsize, addr;
- XGINew_SetReg1(pVBInfo->P3c4, 0x15, 0x00); /* noninterleaving */
- XGINew_SetReg1(pVBInfo->P3c4, 0x1C, 0x00); /* nontiling */
+ xgifb_reg_set(pVBInfo->P3c4, 0x15, 0x00); /* noninterleaving */
+ xgifb_reg_set(pVBInfo->P3c4, 0x1C, 0x00); /* nontiling */
XGINew_CheckChannel(HwDeviceExtension, pVBInfo);
if (HwDeviceExtension->jChipType >= XG20) {
@@ -2118,136 +942,29 @@ int XGINew_DDRSizing340(struct xgi_hw_device_info *HwDeviceExtension,
return 0;
}
-int XGINew_DDRSizing(struct vb_device_info *pVBInfo)
-{
- int i;
- unsigned char j;
-
- for (i = 0; i < 4; i++) {
- XGINew_SetDRAMSizingType(i, XGINew_DDRDRAM_TYPE, pVBInfo);
- XGINew_DisableChannelInterleaving(i, XGINew_DDRDRAM_TYPE, pVBInfo);
- for (j = 2; j > 0; j--) {
- XGINew_SetDDRChannel(i, j, XGINew_ChannelAB, XGINew_DDRDRAM_TYPE, pVBInfo);
- if (!XGINew_SetRank(i, (unsigned char) j, XGINew_ChannelAB, XGINew_DDRDRAM_TYPE, pVBInfo)) {
- continue;
- } else {
- if (XGINew_CheckDDRRanks(j, i, XGINew_DDRDRAM_TYPE, pVBInfo))
- return 1;
- }
- }
- }
- return 0;
-}
-
-void XGINew_SetMemoryClock(struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo)
-{
-
- XGINew_SetReg1(pVBInfo->P3c4, 0x28, pVBInfo->MCLKData[XGINew_RAMType].SR28);
- XGINew_SetReg1(pVBInfo->P3c4, 0x29, pVBInfo->MCLKData[XGINew_RAMType].SR29);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2A, pVBInfo->MCLKData[XGINew_RAMType].SR2A);
-
- XGINew_SetReg1(pVBInfo->P3c4, 0x2E, pVBInfo->ECLKData[XGINew_RAMType].SR2E);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2F, pVBInfo->ECLKData[XGINew_RAMType].SR2F);
- XGINew_SetReg1(pVBInfo->P3c4, 0x30, pVBInfo->ECLKData[XGINew_RAMType].SR30);
-
- /* [Vicent] 2004/07/07, When XG42 ECLK = MCLK = 207MHz, Set SR32 D[1:0] = 10b */
- /* [Hsuan] 2004/08/20, Modify SR32 value, when MCLK=207MHZ, ELCK=250MHz, Set SR32 D[1:0] = 10b */
- if (HwDeviceExtension->jChipType == XG42) {
- if ((pVBInfo->MCLKData[XGINew_RAMType].SR28 == 0x1C)
- && (pVBInfo->MCLKData[XGINew_RAMType].SR29 == 0x01)
- && (((pVBInfo->ECLKData[XGINew_RAMType].SR2E == 0x1C)
- && (pVBInfo->ECLKData[XGINew_RAMType].SR2F == 0x01))
- || ((pVBInfo->ECLKData[XGINew_RAMType].SR2E == 0x22)
- && (pVBInfo->ECLKData[XGINew_RAMType].SR2F == 0x01))))
- XGINew_SetReg1(pVBInfo->P3c4, 0x32, ((unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x32) & 0xFC) | 0x02);
- }
-}
-
-unsigned char ChkLFB(struct vb_device_info *pVBInfo)
-{
- if (LFBDRAMTrap & XGINew_GetReg1(pVBInfo->P3d4, 0x78))
- return 1;
- else
- return 0;
-}
-
-/* --------------------------------------------------------------------- */
-/* input : dx ,valid value : CR or second chip's CR */
-/* */
-/* SetPowerConsume : */
-/* Description: reduce 40/43 power consumption in first chip or */
-/* in second chip, assume CR A1 D[6]="1" in this case */
-/* output : none */
-/* --------------------------------------------------------------------- */
-void SetPowerConsume(struct xgi_hw_device_info *HwDeviceExtension,
- unsigned long XGI_P3d4Port)
-{
- unsigned long lTemp;
- unsigned char bTemp;
-
- HwDeviceExtension->pQueryVGAConfigSpace(HwDeviceExtension, 0x08, 0, &lTemp); /* Get */
- if ((lTemp & 0xFF) == 0) {
- /* set CR58 D[5]=0 D[3]=0 */
- XGINew_SetRegAND(XGI_P3d4Port, 0x58, 0xD7);
- bTemp = (unsigned char) XGINew_GetReg1(XGI_P3d4Port, 0xCB);
- if (bTemp & 0x20) {
- if (!(bTemp & 0x10))
- XGINew_SetRegANDOR(XGI_P3d4Port, 0x58, 0xD7, 0x20); /* CR58 D[5]=1 D[3]=0 */
- else
- XGINew_SetRegANDOR(XGI_P3d4Port, 0x58, 0xD7, 0x08); /* CR58 D[5]=0 D[3]=1 */
-
- }
-
- }
-}
-
-#if 0
-static void XGINew_InitVBIOSData(struct xgi_hw_device_info *HwDeviceExtension,
+static void XGINew_SetDRAMSize_340(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
+ unsigned short data;
- /* unsigned long ROMAddr = (unsigned long) HwDeviceExtension->pjVirtualRomBase; */
pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase;
pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress;
- pVBInfo->BaseAddr = (unsigned long) HwDeviceExtension->pjIOAddress;
- pVBInfo->ISXPDOS = 0;
- pVBInfo->P3c4 = pVBInfo->BaseAddr + 0x14;
- pVBInfo->P3d4 = pVBInfo->BaseAddr + 0x24;
- pVBInfo->P3c0 = pVBInfo->BaseAddr + 0x10;
- pVBInfo->P3ce = pVBInfo->BaseAddr + 0x1e;
- pVBInfo->P3c2 = pVBInfo->BaseAddr + 0x12;
- pVBInfo->P3ca = pVBInfo->BaseAddr + 0x1a;
- pVBInfo->P3c6 = pVBInfo->BaseAddr + 0x16;
- pVBInfo->P3c7 = pVBInfo->BaseAddr + 0x17;
- pVBInfo->P3c8 = pVBInfo->BaseAddr + 0x18;
- pVBInfo->P3c9 = pVBInfo->BaseAddr + 0x19;
- pVBInfo->P3da = pVBInfo->BaseAddr + 0x2A;
- pVBInfo->Part0Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_00;
- pVBInfo->Part1Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_04;
- pVBInfo->Part2Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_10;
- pVBInfo->Part3Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_12;
- pVBInfo->Part4Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14;
- pVBInfo->Part5Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14 + 2;
- if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 */
- XGI_GetVBType(pVBInfo); /* Run XGI_GetVBType before InitTo330Pointer */
+ XGISetModeNew(HwDeviceExtension, 0x2e);
- switch (HwDeviceExtension->jChipType) {
- case XG40:
- case XG41:
- case XG42:
- case XG20:
- case XG21:
- default:
- InitTo330Pointer(HwDeviceExtension->jChipType, pVBInfo);
- return;
- }
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x21);
+ xgifb_reg_set(pVBInfo->P3c4, 0x21, (unsigned short) (data & 0xDF)); /* disable read cache */
+ XGI_DisplayOff(HwDeviceExtension, pVBInfo);
+ /* data = xgifb_reg_get(pVBInfo->P3c4, 0x1); */
+ /* data |= 0x20 ; */
+ /* xgifb_reg_set(pVBInfo->P3c4, 0x01, data); *//* Turn OFF Display */
+ XGINew_DDRSizing340(HwDeviceExtension, pVBInfo);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x21);
+ xgifb_reg_set(pVBInfo->P3c4, 0x21, (unsigned short) (data | 0x20)); /* enable read cache */
}
-#endif
-void ReadVBIOSTablData(unsigned char ChipType, struct vb_device_info *pVBInfo)
+static void ReadVBIOSTablData(unsigned char ChipType, struct vb_device_info *pVBInfo)
{
volatile unsigned char *pVideoMemory = (unsigned char *) pVBInfo->ROMAddr;
unsigned long i;
@@ -2337,166 +1054,12 @@ void ReadVBIOSTablData(unsigned char ChipType, struct vb_device_info *pVBInfo)
}
}
-void XGINew_DDR1x_MRS_XG20(unsigned long P3c4, struct vb_device_info *pVBInfo)
-{
-
- XGINew_SetReg1(P3c4, 0x18, 0x01);
- XGINew_SetReg1(P3c4, 0x19, 0x40);
- XGINew_SetReg1(P3c4, 0x16, 0x00);
- XGINew_SetReg1(P3c4, 0x16, 0x80);
- DelayUS(60);
-
- XGINew_SetReg1(P3c4, 0x18, 0x00);
- XGINew_SetReg1(P3c4, 0x19, 0x40);
- XGINew_SetReg1(P3c4, 0x16, 0x00);
- XGINew_SetReg1(P3c4, 0x16, 0x80);
- DelayUS(60);
- XGINew_SetReg1(P3c4, 0x18, pVBInfo->SR15[2][XGINew_RAMType]); /* SR18 */
- /* XGINew_SetReg1(P3c4, 0x18, 0x31); */
- XGINew_SetReg1(P3c4, 0x19, 0x01);
- XGINew_SetReg1(P3c4, 0x16, 0x03);
- XGINew_SetReg1(P3c4, 0x16, 0x83);
- DelayUS(1000);
- XGINew_SetReg1(P3c4, 0x1B, 0x03);
- DelayUS(500);
- /* XGINew_SetReg1(P3c4, 0x18, 0x31); */
- XGINew_SetReg1(P3c4, 0x18, pVBInfo->SR15[2][XGINew_RAMType]); /* SR18 */
- XGINew_SetReg1(P3c4, 0x19, 0x00);
- XGINew_SetReg1(P3c4, 0x16, 0x03);
- XGINew_SetReg1(P3c4, 0x16, 0x83);
- XGINew_SetReg1(P3c4, 0x1B, 0x00);
-}
-
-void XGINew_SetDRAMModeRegister_XG20(struct xgi_hw_device_info *HwDeviceExtension)
-{
- struct vb_device_info VBINF;
- struct vb_device_info *pVBInfo = &VBINF;
- pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase;
- pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress;
- pVBInfo->BaseAddr = (unsigned long) HwDeviceExtension->pjIOAddress;
- pVBInfo->ISXPDOS = 0;
-
- pVBInfo->P3c4 = pVBInfo->BaseAddr + 0x14;
- pVBInfo->P3d4 = pVBInfo->BaseAddr + 0x24;
- pVBInfo->P3c0 = pVBInfo->BaseAddr + 0x10;
- pVBInfo->P3ce = pVBInfo->BaseAddr + 0x1e;
- pVBInfo->P3c2 = pVBInfo->BaseAddr + 0x12;
- pVBInfo->P3ca = pVBInfo->BaseAddr + 0x1a;
- pVBInfo->P3c6 = pVBInfo->BaseAddr + 0x16;
- pVBInfo->P3c7 = pVBInfo->BaseAddr + 0x17;
- pVBInfo->P3c8 = pVBInfo->BaseAddr + 0x18;
- pVBInfo->P3c9 = pVBInfo->BaseAddr + 0x19;
- pVBInfo->P3da = pVBInfo->BaseAddr + 0x2A;
- pVBInfo->Part0Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_00;
- pVBInfo->Part1Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_04;
- pVBInfo->Part2Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_10;
- pVBInfo->Part3Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_12;
- pVBInfo->Part4Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14;
- pVBInfo->Part5Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14 + 2;
-
- InitTo330Pointer(HwDeviceExtension->jChipType, pVBInfo);
-
- ReadVBIOSTablData(HwDeviceExtension->jChipType, pVBInfo);
-
- if (XGINew_GetXG20DRAMType(HwDeviceExtension, pVBInfo) == 0)
- XGINew_DDR1x_MRS_XG20(pVBInfo->P3c4, pVBInfo);
- else
- XGINew_DDR2_MRS_XG20(HwDeviceExtension, pVBInfo->P3c4, pVBInfo);
-
- XGINew_SetReg1(pVBInfo->P3c4, 0x1B, 0x03);
-}
-
-void XGINew_SetDRAMModeRegister_XG27(
- struct xgi_hw_device_info *HwDeviceExtension)
-{
- struct vb_device_info VBINF;
- struct vb_device_info *pVBInfo = &VBINF;
- pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase;
- pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress;
- pVBInfo->BaseAddr = (unsigned long) HwDeviceExtension->pjIOAddress;
- pVBInfo->ISXPDOS = 0;
-
- pVBInfo->P3c4 = pVBInfo->BaseAddr + 0x14;
- pVBInfo->P3d4 = pVBInfo->BaseAddr + 0x24;
- pVBInfo->P3c0 = pVBInfo->BaseAddr + 0x10;
- pVBInfo->P3ce = pVBInfo->BaseAddr + 0x1e;
- pVBInfo->P3c2 = pVBInfo->BaseAddr + 0x12;
- pVBInfo->P3ca = pVBInfo->BaseAddr + 0x1a;
- pVBInfo->P3c6 = pVBInfo->BaseAddr + 0x16;
- pVBInfo->P3c7 = pVBInfo->BaseAddr + 0x17;
- pVBInfo->P3c8 = pVBInfo->BaseAddr + 0x18;
- pVBInfo->P3c9 = pVBInfo->BaseAddr + 0x19;
- pVBInfo->P3da = pVBInfo->BaseAddr + 0x2A;
- pVBInfo->Part0Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_00;
- pVBInfo->Part1Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_04;
- pVBInfo->Part2Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_10;
- pVBInfo->Part3Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_12;
- pVBInfo->Part4Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14;
- pVBInfo->Part5Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14 + 2;
-
- InitTo330Pointer(HwDeviceExtension->jChipType, pVBInfo);
-
- ReadVBIOSTablData(HwDeviceExtension->jChipType, pVBInfo);
-
- if (XGINew_GetXG20DRAMType(HwDeviceExtension, pVBInfo) == 0)
- XGINew_DDR1x_MRS_XG20(pVBInfo->P3c4, pVBInfo);
- else
- /* XGINew_DDR2_MRS_XG27(HwDeviceExtension, pVBInfo->P3c4, pVBInfo); */
- XGINew_DDRII_Bootup_XG27(HwDeviceExtension, pVBInfo->P3c4, pVBInfo);
-
- /* XGINew_SetReg1(pVBInfo->P3c4, 0x1B, 0x03); */
- XGINew_SetReg1(pVBInfo->P3c4, 0x1B, pVBInfo->SR15[3][XGINew_RAMType]); /* SR1B */
-
-}
-
-/*
-void XGINew_SetDRAMModeRegister_XG27(struct xgi_hw_device_info *HwDeviceExtension)
-{
- unsigned char data;
- struct vb_device_info VBINF;
- struct vb_device_info *pVBInfo = &VBINF;
- pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase;
- pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress;
- pVBInfo->BaseAddr = HwDeviceExtension->pjIOAddress;
- pVBInfo->ISXPDOS = 0;
-
- pVBInfo->P3c4 = pVBInfo->BaseAddr + 0x14;
- pVBInfo->P3d4 = pVBInfo->BaseAddr + 0x24;
- pVBInfo->P3c0 = pVBInfo->BaseAddr + 0x10;
- pVBInfo->P3ce = pVBInfo->BaseAddr + 0x1e;
- pVBInfo->P3c2 = pVBInfo->BaseAddr + 0x12;
- pVBInfo->P3ca = pVBInfo->BaseAddr + 0x1a;
- pVBInfo->P3c6 = pVBInfo->BaseAddr + 0x16;
- pVBInfo->P3c7 = pVBInfo->BaseAddr + 0x17;
- pVBInfo->P3c8 = pVBInfo->BaseAddr + 0x18;
- pVBInfo->P3c9 = pVBInfo->BaseAddr + 0x19;
- pVBInfo->P3da = pVBInfo->BaseAddr + 0x2A;
- pVBInfo->Part0Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_00;
- pVBInfo->Part1Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_04;
- pVBInfo->Part2Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_10;
- pVBInfo->Part3Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_12;
- pVBInfo->Part4Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14;
- pVBInfo->Part5Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14 + 2;
-
- InitTo330Pointer(HwDeviceExtension->jChipType,pVBInfo);
-
- ReadVBIOSTablData(HwDeviceExtension->jChipType , pVBInfo);
-
- if (XGINew_GetXG20DRAMType(HwDeviceExtension, pVBInfo) == 0)
- XGINew_DDR1x_MRS_XG20(pVBInfo->P3c4, pVBInfo);
- else
- XGINew_DDR2_MRS_XG27(HwDeviceExtension, pVBInfo->P3c4, pVBInfo);
-
- XGINew_SetReg1(pVBInfo->P3c4, 0x1B, 0x03);
-}
-*/
-
-void XGINew_ChkSenseStatus(struct xgi_hw_device_info *HwDeviceExtension,
+static void XGINew_ChkSenseStatus(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
unsigned short tempbx = 0, temp, tempcx, CR3CData;
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x32);
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x32);
if (temp & Monitor1Sense)
tempbx |= ActiveCRT1;
@@ -2518,11 +1081,11 @@ void XGINew_ChkSenseStatus(struct xgi_hw_device_info *HwDeviceExtension,
tempbx |= (ActiveYPbPr << 8);
}
- tempcx = XGINew_GetReg1(pVBInfo->P3d4, 0x3d);
- tempcx |= (XGINew_GetReg1(pVBInfo->P3d4, 0x3e) << 8);
+ tempcx = xgifb_reg_get(pVBInfo->P3d4, 0x3d);
+ tempcx |= (xgifb_reg_get(pVBInfo->P3d4, 0x3e) << 8);
if (tempbx & tempcx) {
- CR3CData = XGINew_GetReg1(pVBInfo->P3d4, 0x3c);
+ CR3CData = xgifb_reg_get(pVBInfo->P3d4, 0x3c);
if (!(CR3CData & DisplayDeviceFromCMOS)) {
tempcx = 0x1FF0;
if (*pVBInfo->pSoftSetting & ModeSoftSetting)
@@ -2535,18 +1098,18 @@ void XGINew_ChkSenseStatus(struct xgi_hw_device_info *HwDeviceExtension,
}
tempbx &= tempcx;
- XGINew_SetReg1(pVBInfo->P3d4, 0x3d, (tempbx & 0x00FF));
- XGINew_SetReg1(pVBInfo->P3d4, 0x3e, ((tempbx & 0xFF00) >> 8));
+ xgifb_reg_set(pVBInfo->P3d4, 0x3d, (tempbx & 0x00FF));
+ xgifb_reg_set(pVBInfo->P3d4, 0x3e, ((tempbx & 0xFF00) >> 8));
}
-void XGINew_SetModeScratch(struct xgi_hw_device_info *HwDeviceExtension,
+static void XGINew_SetModeScratch(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
unsigned short temp, tempcl = 0, tempch = 0, CR31Data, CR38Data;
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x3d);
- temp |= XGINew_GetReg1(pVBInfo->P3d4, 0x3e) << 8;
- temp |= (XGINew_GetReg1(pVBInfo->P3d4, 0x31) & (DriverMode >> 8)) << 8;
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x3d);
+ temp |= xgifb_reg_get(pVBInfo->P3d4, 0x3e) << 8;
+ temp |= (xgifb_reg_get(pVBInfo->P3d4, 0x31) & (DriverMode >> 8)) << 8;
if (pVBInfo->IF_DEF_CRT2Monitor == 1) {
if (temp & ActiveCRT2)
@@ -2603,25 +1166,25 @@ void XGINew_SetModeScratch(struct xgi_hw_device_info *HwDeviceExtension,
tempcl ^= (SetSimuScanMode | SwitchToCRT2);
if ((temp & ActiveLCD) && (temp & ActiveTV))
tempcl ^= (SetSimuScanMode | SwitchToCRT2);
- XGINew_SetReg1(pVBInfo->P3d4, 0x30, tempcl);
+ xgifb_reg_set(pVBInfo->P3d4, 0x30, tempcl);
- CR31Data = XGINew_GetReg1(pVBInfo->P3d4, 0x31);
+ CR31Data = xgifb_reg_get(pVBInfo->P3d4, 0x31);
CR31Data &= ~(SetNotSimuMode >> 8);
if (!(temp & ActiveCRT1))
CR31Data |= (SetNotSimuMode >> 8);
CR31Data &= ~(DisableCRT2Display >> 8);
if (!((temp & ActiveLCD) || (temp & ActiveTV) || (temp & ActiveCRT2)))
CR31Data |= (DisableCRT2Display >> 8);
- XGINew_SetReg1(pVBInfo->P3d4, 0x31, CR31Data);
+ xgifb_reg_set(pVBInfo->P3d4, 0x31, CR31Data);
- CR38Data = XGINew_GetReg1(pVBInfo->P3d4, 0x38);
+ CR38Data = xgifb_reg_get(pVBInfo->P3d4, 0x38);
CR38Data &= ~SetYPbPr;
CR38Data |= tempch;
- XGINew_SetReg1(pVBInfo->P3d4, 0x38, CR38Data);
+ xgifb_reg_set(pVBInfo->P3d4, 0x38, CR38Data);
}
-void XGINew_GetXG21Sense(struct xgi_hw_device_info *HwDeviceExtension,
+static void XGINew_GetXG21Sense(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
unsigned char Temp;
@@ -2633,83 +1196,421 @@ void XGINew_GetXG21Sense(struct xgi_hw_device_info *HwDeviceExtension,
#if 1
if ((pVideoMemory[0x65] & 0x01)) { /* For XG21 LVDS */
pVBInfo->IF_DEF_LVDS = 1;
- XGINew_SetRegOR(pVBInfo->P3d4, 0x32, LCDSense);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x38, ~0xE0, 0xC0); /* LVDS on chip */
+ xgifb_reg_or(pVBInfo->P3d4, 0x32, LCDSense);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x38, ~0xE0, 0xC0); /* LVDS on chip */
} else {
#endif
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x4A, ~0x03, 0x03); /* Enable GPIOA/B read */
- Temp = XGINew_GetReg1(pVBInfo->P3d4, 0x48) & 0xC0;
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x4A, ~0x03, 0x03); /* Enable GPIOA/B read */
+ Temp = xgifb_reg_get(pVBInfo->P3d4, 0x48) & 0xC0;
if (Temp == 0xC0) { /* DVI & DVO GPIOA/B pull high */
XGINew_SenseLCD(HwDeviceExtension, pVBInfo);
- XGINew_SetRegOR(pVBInfo->P3d4, 0x32, LCDSense);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x4A, ~0x20, 0x20); /* Enable read GPIOF */
- Temp = XGINew_GetReg1(pVBInfo->P3d4, 0x48) & 0x04;
+ xgifb_reg_or(pVBInfo->P3d4, 0x32, LCDSense);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x4A, ~0x20, 0x20); /* Enable read GPIOF */
+ Temp = xgifb_reg_get(pVBInfo->P3d4, 0x48) & 0x04;
if (!Temp)
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x38, ~0xE0, 0x80); /* TMDS on chip */
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x38, ~0xE0, 0x80); /* TMDS on chip */
else
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x38, ~0xE0, 0xA0); /* Only DVO on chip */
- XGINew_SetRegAND(pVBInfo->P3d4, 0x4A, ~0x20); /* Disable read GPIOF */
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x38, ~0xE0, 0xA0); /* Only DVO on chip */
+ xgifb_reg_and(pVBInfo->P3d4, 0x4A, ~0x20); /* Disable read GPIOF */
}
#if 1
}
#endif
}
-void XGINew_GetXG27Sense(struct xgi_hw_device_info *HwDeviceExtension,
+static void XGINew_GetXG27Sense(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
unsigned char Temp, bCR4A;
pVBInfo->IF_DEF_LVDS = 0;
- bCR4A = XGINew_GetReg1(pVBInfo->P3d4, 0x4A);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x4A, ~0x07, 0x07); /* Enable GPIOA/B/C read */
- Temp = XGINew_GetReg1(pVBInfo->P3d4, 0x48) & 0x07;
- XGINew_SetReg1(pVBInfo->P3d4, 0x4A, bCR4A);
+ bCR4A = xgifb_reg_get(pVBInfo->P3d4, 0x4A);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x4A, ~0x07, 0x07); /* Enable GPIOA/B/C read */
+ Temp = xgifb_reg_get(pVBInfo->P3d4, 0x48) & 0x07;
+ xgifb_reg_set(pVBInfo->P3d4, 0x4A, bCR4A);
if (Temp <= 0x02) {
pVBInfo->IF_DEF_LVDS = 1;
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x38, ~0xE0, 0xC0); /* LVDS setting */
- XGINew_SetReg1(pVBInfo->P3d4, 0x30, 0x21);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x38, ~0xE0, 0xC0); /* LVDS setting */
+ xgifb_reg_set(pVBInfo->P3d4, 0x30, 0x21);
} else {
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x38, ~0xE0, 0xA0); /* TMDS/DVO setting */
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x38, ~0xE0, 0xA0); /* TMDS/DVO setting */
}
- XGINew_SetRegOR(pVBInfo->P3d4, 0x32, LCDSense);
+ xgifb_reg_or(pVBInfo->P3d4, 0x32, LCDSense);
}
-unsigned char GetXG21FPBits(struct vb_device_info *pVBInfo)
+static unsigned char GetXG21FPBits(struct vb_device_info *pVBInfo)
{
unsigned char CR38, CR4A, temp;
- CR4A = XGINew_GetReg1(pVBInfo->P3d4, 0x4A);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x4A, ~0x10, 0x10); /* enable GPIOE read */
- CR38 = XGINew_GetReg1(pVBInfo->P3d4, 0x38);
+ CR4A = xgifb_reg_get(pVBInfo->P3d4, 0x4A);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x4A, ~0x10, 0x10); /* enable GPIOE read */
+ CR38 = xgifb_reg_get(pVBInfo->P3d4, 0x38);
temp = 0;
if ((CR38 & 0xE0) > 0x80) {
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x48);
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x48);
temp &= 0x08;
temp >>= 3;
}
- XGINew_SetReg1(pVBInfo->P3d4, 0x4A, CR4A);
+ xgifb_reg_set(pVBInfo->P3d4, 0x4A, CR4A);
return temp;
}
-unsigned char GetXG27FPBits(struct vb_device_info *pVBInfo)
+static unsigned char GetXG27FPBits(struct vb_device_info *pVBInfo)
{
unsigned char CR4A, temp;
- CR4A = XGINew_GetReg1(pVBInfo->P3d4, 0x4A);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x4A, ~0x03, 0x03); /* enable GPIOA/B/C read */
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x48);
+ CR4A = xgifb_reg_get(pVBInfo->P3d4, 0x4A);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x4A, ~0x03, 0x03); /* enable GPIOA/B/C read */
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x48);
if (temp <= 2)
temp &= 0x03;
else
temp = ((temp & 0x04) >> 1) || ((~temp) & 0x01);
- XGINew_SetReg1(pVBInfo->P3d4, 0x4A, CR4A);
+ xgifb_reg_set(pVBInfo->P3d4, 0x4A, CR4A);
return temp;
}
+unsigned char XGIInitNew(struct xgi_hw_device_info *HwDeviceExtension)
+{
+ struct vb_device_info VBINF;
+ struct vb_device_info *pVBInfo = &VBINF;
+ unsigned char i, temp = 0, temp1;
+ /* VBIOSVersion[5]; */
+ volatile unsigned char *pVideoMemory;
+
+ /* unsigned long j, k; */
+
+ unsigned long Temp;
+
+ pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase;
+
+ pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress;
+
+ pVBInfo->BaseAddr = (unsigned long) HwDeviceExtension->pjIOAddress;
+
+ pVideoMemory = (unsigned char *) pVBInfo->ROMAddr;
+
+ /* Newdebugcode(0x99); */
+
+
+ /* if (pVBInfo->ROMAddr == 0) */
+ /* return(0); */
+
+ if (pVBInfo->FBAddr == NULL) {
+ printk("\n pVBInfo->FBAddr == 0 ");
+ return 0;
+ }
+ printk("1");
+ if (pVBInfo->BaseAddr == 0) {
+ printk("\npVBInfo->BaseAddr == 0 ");
+ return 0;
+ }
+ printk("2");
+
+ outb(0x67, (pVBInfo->BaseAddr + 0x12)); /* 3c2 <- 67 ,ynlai */
+
+ pVBInfo->ISXPDOS = 0;
+ printk("3");
+
+ printk("4");
+
+ /* VBIOSVersion[4] = 0x0; */
+
+ /* 09/07/99 modify by domao */
+
+ pVBInfo->P3c4 = pVBInfo->BaseAddr + 0x14;
+ pVBInfo->P3d4 = pVBInfo->BaseAddr + 0x24;
+ pVBInfo->P3c0 = pVBInfo->BaseAddr + 0x10;
+ pVBInfo->P3ce = pVBInfo->BaseAddr + 0x1e;
+ pVBInfo->P3c2 = pVBInfo->BaseAddr + 0x12;
+ pVBInfo->P3ca = pVBInfo->BaseAddr + 0x1a;
+ pVBInfo->P3c6 = pVBInfo->BaseAddr + 0x16;
+ pVBInfo->P3c7 = pVBInfo->BaseAddr + 0x17;
+ pVBInfo->P3c8 = pVBInfo->BaseAddr + 0x18;
+ pVBInfo->P3c9 = pVBInfo->BaseAddr + 0x19;
+ pVBInfo->P3da = pVBInfo->BaseAddr + 0x2A;
+ pVBInfo->Part0Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_00;
+ pVBInfo->Part1Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_04;
+ pVBInfo->Part2Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_10;
+ pVBInfo->Part3Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_12;
+ pVBInfo->Part4Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14;
+ pVBInfo->Part5Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14 + 2;
+ printk("5");
+
+ if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 */
+ XGI_GetVBType(pVBInfo); /* Run XGI_GetVBType before InitTo330Pointer */
+
+ InitTo330Pointer(HwDeviceExtension->jChipType, pVBInfo);
+
+ /* ReadVBIOSData */
+ ReadVBIOSTablData(HwDeviceExtension->jChipType, pVBInfo);
+
+ /* 1.Openkey */
+ xgifb_reg_set(pVBInfo->P3c4, 0x05, 0x86);
+ printk("6");
+
+ /* GetXG21Sense (GPIO) */
+ if (HwDeviceExtension->jChipType == XG21)
+ XGINew_GetXG21Sense(HwDeviceExtension, pVBInfo);
+
+ if (HwDeviceExtension->jChipType == XG27)
+ XGINew_GetXG27Sense(HwDeviceExtension, pVBInfo);
+
+ printk("7");
+
+ /* 2.Reset Extended register */
+
+ for (i = 0x06; i < 0x20; i++)
+ xgifb_reg_set(pVBInfo->P3c4, i, 0);
+
+ for (i = 0x21; i <= 0x27; i++)
+ xgifb_reg_set(pVBInfo->P3c4, i, 0);
+
+ /* for(i = 0x06; i <= 0x27; i++) */
+ /* xgifb_reg_set(pVBInfo->P3c4, i, 0); */
+
+ printk("8");
+
+ for (i = 0x31; i <= 0x3B; i++)
+ xgifb_reg_set(pVBInfo->P3c4, i, 0);
+ printk("9");
+
+ if (HwDeviceExtension->jChipType == XG42) /* [Hsuan] 2004/08/20 Auto over driver for XG42 */
+ xgifb_reg_set(pVBInfo->P3c4, 0x3B, 0xC0);
+
+ /* for (i = 0x30; i <= 0x3F; i++) */
+ /* xgifb_reg_set(pVBInfo->P3d4, i, 0); */
+
+ for (i = 0x79; i <= 0x7C; i++)
+ xgifb_reg_set(pVBInfo->P3d4, i, 0); /* shampoo 0208 */
+
+ printk("10");
+
+ if (HwDeviceExtension->jChipType >= XG20)
+ xgifb_reg_set(pVBInfo->P3d4, 0x97, *pVBInfo->pXGINew_CR97);
+
+ /* 3.SetMemoryClock
+
+ XGINew_RAMType = (int)XGINew_GetXG20DRAMType(HwDeviceExtension, pVBInfo);
+ */
+
+ printk("11");
+
+ /* 4.SetDefExt1Regs begin */
+ xgifb_reg_set(pVBInfo->P3c4, 0x07, *pVBInfo->pSR07);
+ if (HwDeviceExtension->jChipType == XG27) {
+ xgifb_reg_set(pVBInfo->P3c4, 0x40, *pVBInfo->pSR40);
+ xgifb_reg_set(pVBInfo->P3c4, 0x41, *pVBInfo->pSR41);
+ }
+ xgifb_reg_set(pVBInfo->P3c4, 0x11, 0x0F);
+ xgifb_reg_set(pVBInfo->P3c4, 0x1F, *pVBInfo->pSR1F);
+ /* xgifb_reg_set(pVBInfo->P3c4, 0x20, 0x20); */
+ xgifb_reg_set(pVBInfo->P3c4, 0x20, 0xA0); /* alan, 2001/6/26 Frame buffer can read/write SR20 */
+ xgifb_reg_set(pVBInfo->P3c4, 0x36, 0x70); /* Hsuan, 2006/01/01 H/W request for slow corner chip */
+ if (HwDeviceExtension->jChipType == XG27) /* Alan 12/07/2006 */
+ xgifb_reg_set(pVBInfo->P3c4, 0x36, *pVBInfo->pSR36);
+
+ /* SR11 = 0x0F; */
+ /* xgifb_reg_set(pVBInfo->P3c4, 0x11, SR11); */
+
+ printk("12");
+
+ if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */
+ /* Set AGP Rate */
+ /*
+ temp1 = xgifb_reg_get(pVBInfo->P3c4, 0x3B);
+ temp1 &= 0x02;
+ if (temp1 == 0x02) {
+ outl(0x80000000, 0xcf8);
+ ChipsetID = inl(0x0cfc);
+ outl(0x8000002C, 0xcf8);
+ VendorID = inl(0x0cfc);
+ VendorID &= 0x0000FFFF;
+ outl(0x8001002C, 0xcf8);
+ GraphicVendorID = inl(0x0cfc);
+ GraphicVendorID &= 0x0000FFFF;
+
+ if (ChipsetID == 0x7301039)
+ xgifb_reg_set(pVBInfo->P3d4, 0x5F, 0x09);
+
+ ChipsetID &= 0x0000FFFF;
+
+ if ((ChipsetID == 0x700E) || (ChipsetID == 0x1022) || (ChipsetID == 0x1106) || (ChipsetID == 0x10DE)) {
+ if (ChipsetID == 0x1106) {
+ if ((VendorID == 0x1019) && (GraphicVendorID == 0x1019))
+ xgifb_reg_set(pVBInfo->P3d4, 0x5F, 0x0D);
+ else
+ xgifb_reg_set(pVBInfo->P3d4, 0x5F, 0x0B);
+ } else {
+ xgifb_reg_set(pVBInfo->P3d4, 0x5F, 0x0B);
+ }
+ }
+ }
+ */
+
+ printk("13");
+
+ /* Set AGP customize registers (in SetDefAGPRegs) Start */
+ for (i = 0x47; i <= 0x4C; i++)
+ xgifb_reg_set(pVBInfo->P3d4, i, pVBInfo->AGPReg[i - 0x47]);
+
+ for (i = 0x70; i <= 0x71; i++)
+ xgifb_reg_set(pVBInfo->P3d4, i, pVBInfo->AGPReg[6 + i - 0x70]);
+
+ for (i = 0x74; i <= 0x77; i++)
+ xgifb_reg_set(pVBInfo->P3d4, i, pVBInfo->AGPReg[8 + i - 0x74]);
+ /* Set AGP customize registers (in SetDefAGPRegs) End */
+ /* [Hsuan]2004/12/14 AGP Input Delay Adjustment on 850 */
+ /* outl(0x80000000, 0xcf8); */
+ /* ChipsetID = inl(0x0cfc); */
+ /* if (ChipsetID == 0x25308086) */
+ /* xgifb_reg_set(pVBInfo->P3d4, 0x77, 0xF0); */
+
+ HwDeviceExtension->pQueryVGAConfigSpace(HwDeviceExtension, 0x50, 0, &Temp); /* Get */
+ Temp >>= 20;
+ Temp &= 0xF;
+
+ if (Temp == 1)
+ xgifb_reg_set(pVBInfo->P3d4, 0x48, 0x20); /* CR48 */
+ printk("14");
+ } /* != XG20 */
+
+ /* Set PCI */
+ xgifb_reg_set(pVBInfo->P3c4, 0x23, *pVBInfo->pSR23);
+ xgifb_reg_set(pVBInfo->P3c4, 0x24, *pVBInfo->pSR24);
+ xgifb_reg_set(pVBInfo->P3c4, 0x25, pVBInfo->SR25[0]);
+ printk("15");
+
+ if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */
+ /* Set VB */
+ XGI_UnLockCRT2(HwDeviceExtension, pVBInfo);
+ xgifb_reg_and_or(pVBInfo->Part0Port, 0x3F, 0xEF, 0x00); /* alan, disable VideoCapture */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x00, 0x00);
+ temp1 = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x7B); /* chk if BCLK>=100MHz */
+ temp = (unsigned char) ((temp1 >> 4) & 0x0F);
+
+ xgifb_reg_set(pVBInfo->Part1Port, 0x02, (*pVBInfo->pCRT2Data_1_2));
+
+ printk("16");
+
+ xgifb_reg_set(pVBInfo->Part1Port, 0x2E, 0x08); /* use VB */
+ } /* != XG20 */
+
+ xgifb_reg_set(pVBInfo->P3c4, 0x27, 0x1F);
+
+ if ((HwDeviceExtension->jChipType == XG42)
+ && XGINew_GetXG20DRAMType(HwDeviceExtension, pVBInfo) != 0) { /* Not DDR */
+ xgifb_reg_set(pVBInfo->P3c4, 0x31, (*pVBInfo->pSR31 & 0x3F) | 0x40);
+ xgifb_reg_set(pVBInfo->P3c4, 0x32, (*pVBInfo->pSR32 & 0xFC) | 0x01);
+ } else {
+ xgifb_reg_set(pVBInfo->P3c4, 0x31, *pVBInfo->pSR31);
+ xgifb_reg_set(pVBInfo->P3c4, 0x32, *pVBInfo->pSR32);
+ }
+ xgifb_reg_set(pVBInfo->P3c4, 0x33, *pVBInfo->pSR33);
+ printk("17");
+
+ /*
+ SetPowerConsume (HwDeviceExtension, pVBInfo->P3c4); */
+
+ if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */
+ if (XGI_BridgeIsOn(pVBInfo) == 1) {
+ if (pVBInfo->IF_DEF_LVDS == 0) {
+ xgifb_reg_set(pVBInfo->Part2Port, 0x00, 0x1C);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x0D, *pVBInfo->pCRT2Data_4_D);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x0E, *pVBInfo->pCRT2Data_4_E);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x10, *pVBInfo->pCRT2Data_4_10);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x0F, 0x3F);
+ }
+
+ XGI_LockCRT2(HwDeviceExtension, pVBInfo);
+ }
+ } /* != XG20 */
+ printk("18");
+
+ printk("181");
+
+ printk("182");
+
+ XGI_SenseCRT1(pVBInfo);
+
+ printk("183");
+ /* XGINew_DetectMonitor(HwDeviceExtension); */
+ pVBInfo->IF_DEF_CH7007 = 0;
+ if ((HwDeviceExtension->jChipType == XG21) && (pVBInfo->IF_DEF_CH7007)) {
+ printk("184");
+ XGI_GetSenseStatus(HwDeviceExtension, pVBInfo); /* sense CRT2 */
+ printk("185");
+
+ }
+ if (HwDeviceExtension->jChipType == XG21) {
+ printk("186");
+
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x32, ~Monitor1Sense, Monitor1Sense); /* Z9 default has CRT */
+ temp = GetXG21FPBits(pVBInfo);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x37, ~0x01, temp);
+ printk("187");
+
+ }
+ if (HwDeviceExtension->jChipType == XG27) {
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x32, ~Monitor1Sense, Monitor1Sense); /* Z9 default has CRT */
+ temp = GetXG27FPBits(pVBInfo);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x37, ~0x03, temp);
+ }
+ printk("19");
+
+ XGINew_RAMType = (int) XGINew_GetXG20DRAMType(HwDeviceExtension, pVBInfo);
+
+ XGINew_SetDRAMDefaultRegister340(HwDeviceExtension, pVBInfo->P3d4, pVBInfo);
+
+ printk("20");
+ XGINew_SetDRAMSize_340(HwDeviceExtension, pVBInfo);
+ printk("21");
+
+ printk("22");
+
+ /* SetDefExt2Regs begin */
+ /*
+ AGP = 1;
+ temp = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x3A);
+ temp &= 0x30;
+ if (temp == 0x30)
+ AGP = 0;
+
+ if (AGP == 0)
+ *pVBInfo->pSR21 &= 0xEF;
+
+ xgifb_reg_set(pVBInfo->P3c4, 0x21, *pVBInfo->pSR21);
+ if (AGP == 1)
+ *pVBInfo->pSR22 &= 0x20;
+ xgifb_reg_set(pVBInfo->P3c4, 0x22, *pVBInfo->pSR22);
+ */
+ /* base = 0x80000000; */
+ /* OutPortLong(0xcf8, base); */
+ /* Temp = (InPortLong(0xcfc) & 0xFFFF); */
+ /* if (Temp == 0x1039) { */
+ xgifb_reg_set(pVBInfo->P3c4, 0x22, (unsigned char) ((*pVBInfo->pSR22) & 0xFE));
+ /* } else { */
+ /* xgifb_reg_set(pVBInfo->P3c4, 0x22, *pVBInfo->pSR22); */
+ /* } */
+
+ xgifb_reg_set(pVBInfo->P3c4, 0x21, *pVBInfo->pSR21);
+
+ printk("23");
+
+ XGINew_ChkSenseStatus(HwDeviceExtension, pVBInfo);
+ XGINew_SetModeScratch(HwDeviceExtension, pVBInfo);
+
+ printk("24");
+
+ xgifb_reg_set(pVBInfo->P3d4, 0x8c, 0x87);
+ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x31);
+ printk("25");
+
+ return 1;
+} /* end of init */
diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index e19b932492e1..9669c22cc82c 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -1,5 +1,6 @@
#include <asm/io.h>
+#include <linux/delay.h>
#include <linux/types.h>
#include <linux/version.h>
#include "XGIfb.h"
@@ -10,7 +11,7 @@
#include "vb_struct.h"
#include "vb_util.h"
#include "vb_table.h"
-
+#include "vb_setmode.h"
#define IndexMask 0xff
@@ -18,180 +19,6 @@
#define XGI_MASK_DUAL_CHIP 0x04 /* SR3A */
#endif
-
-
-unsigned char XGI_IsLCDDualLink(struct vb_device_info *pVBInfo);
-unsigned char XGI_SetCRT2Group301(unsigned short ModeNo,
- struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo);
-unsigned char XGI_BacklightByDrv(struct vb_device_info *pVBInfo);
-
-unsigned char XGI_IsLCDON(struct vb_device_info *pVBInfo);
-unsigned char XGI_DisableChISLCD(struct vb_device_info *pVBInfo);
-unsigned char XGI_EnableChISLCD(struct vb_device_info *pVBInfo);
-unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo,
- unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
- unsigned short *i, struct vb_device_info *pVBInfo);
-unsigned char XGI_SearchModeID(unsigned short ModeNo,
- unsigned short *ModeIdIndex,
- struct vb_device_info *pVBInfo);
-unsigned char XGI_GetLCDInfo(unsigned short ModeNo,
- unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo);
-unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension,
- unsigned short ModeNo);
-unsigned char XGI_BridgeIsOn(struct vb_device_info *pVBInfo);
-unsigned char XGI_GetModePtr(unsigned short ModeNo,
- unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo);
-unsigned short XGI_GetOffset(unsigned short ModeNo,
- unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
- struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo);
-unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE,
- unsigned short ModeNo,
- unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo);
-unsigned short XGI_GetResInfo(unsigned short ModeNo,
- unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo);
-unsigned short XGI_GetColorDepth(unsigned short ModeNo,
- unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo);
-unsigned short XGI_GetVGAHT2(struct vb_device_info *pVBInfo);
-unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo,
- unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
- struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo);
-void XGI_VBLongWait(struct vb_device_info *pVBInfo);
-void XGI_SaveCRT2Info(unsigned short ModeNo, struct vb_device_info *pVBInfo);
-void XGI_GetCRT2Data(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_GetCRT2ResInfo(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void XGI_PreSetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo);
-void XGI_SetGroup3(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo);
-void XGI_SetGroup5(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void *XGI_GetLcdPtr(unsigned short BX, unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void *XGI_GetTVPtr(unsigned short BX, unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_FirePWDEnable(struct vb_device_info *pVBInfo);
-void XGI_EnableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo);
-void XGI_DisableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo);
-void XGI_SetPanelDelay(unsigned short tempbl, struct vb_device_info *pVBInfo);
-void XGI_SetPanelPower(unsigned short tempah, unsigned short tempbl, struct vb_device_info *pVBInfo);
-void XGI_EnablePWD(struct vb_device_info *pVBInfo);
-void XGI_DisablePWD(struct vb_device_info *pVBInfo);
-void XGI_AutoThreshold(struct vb_device_info *pVBInfo);
-void XGI_SetTap4Regs(struct vb_device_info *pVBInfo);
-
-void XGI_DisplayOn(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo);
-void XGI_DisplayOff(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo);
-void XGI_SetCRT1Group(struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_SetXG21LCD(struct vb_device_info *pVBInfo, unsigned short RefreshRateTableIndex, unsigned short ModeNo);
-void XGI_SetXG27CRTC(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_SetXG27LCD(struct vb_device_info *pVBInfo, unsigned short RefreshRateTableIndex, unsigned short ModeNo);
-void XGI_UpdateXG21CRTC(unsigned short ModeNo, struct vb_device_info *pVBInfo, unsigned short RefreshRateTableIndex);
-void XGI_WaitDisply(struct vb_device_info *pVBInfo);
-void XGI_SenseCRT1(struct vb_device_info *pVBInfo);
-void XGI_SetSeqRegs(unsigned short ModeNo, unsigned short StandTableIndex, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void XGI_SetMiscRegs(unsigned short StandTableIndex, struct vb_device_info *pVBInfo);
-void XGI_SetCRTCRegs(struct xgi_hw_device_info *HwDeviceExtension, unsigned short StandTableIndex, struct vb_device_info *pVBInfo);
-void XGI_SetATTRegs(unsigned short ModeNo, unsigned short StandTableIndex, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void XGI_SetGRCRegs(unsigned short StandTableIndex, struct vb_device_info *pVBInfo);
-void XGI_ClearExt1Regs(struct vb_device_info *pVBInfo);
-
-void XGI_SetSync(unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_SetCRT1CRTC(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo, struct xgi_hw_device_info *HwDeviceExtension);
-void XGI_SetCRT1Timing_H(struct vb_device_info *pVBInfo, struct xgi_hw_device_info *HwDeviceExtension);
-void XGI_SetCRT1Timing_V(unsigned short ModeIdIndex, unsigned short ModeNo, struct vb_device_info *pVBInfo);
-void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_SetCRT1VCLK(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_SetCRT1FIFO(unsigned short ModeNo, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo);
-void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_SetVCLKState(struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-
-void XGI_LoadDAC(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void XGI_WriteDAC(unsigned short dl, unsigned short ah, unsigned short al, unsigned short dh, struct vb_device_info *pVBInfo);
-/*void XGI_ClearBuffer(struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo, struct vb_device_info *pVBInfo);*/
-void XGI_SetLCDAGroup(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo);
-void XGI_GetLVDSResInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo);
-void XGI_GetLVDSData(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-unsigned short XGI_GetLVDSOEMTableIndex(struct vb_device_info *pVBInfo);
-void XGI_ModCRT1Regs(unsigned short ModeNo, unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
- struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo);
-void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo);
-void XGI_GetVGAType(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo);
-void XGI_GetVBType(struct vb_device_info *pVBInfo);
-void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo);
-void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void XGI_SetCRT2ECLK(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void InitTo330Pointer(unsigned char, struct vb_device_info *pVBInfo);
-void XGI_GetLCDSync(unsigned short *HSyncWidth, unsigned short *VSyncWidth, struct vb_device_info *pVBInfo);
-void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo);
-void XGI_EnableBridge(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo);
-void XGI_SetCRT2VCLK(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_OEM310Setting(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void XGI_SetDelayComp(struct vb_device_info *pVBInfo);
-void XGI_SetLCDCap(struct vb_device_info *pVBInfo);
-void XGI_SetLCDCap_A(unsigned short tempcx, struct vb_device_info *pVBInfo);
-void XGI_SetLCDCap_B(unsigned short tempcx, struct vb_device_info *pVBInfo);
-void SetSpectrum(struct vb_device_info *pVBInfo);
-void XGI_SetAntiFlicker(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void XGI_SetEdgeEnhance(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void XGI_SetPhaseIncr(struct vb_device_info *pVBInfo);
-void XGI_SetYFilter(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void XGI_GetTVPtrIndex2(unsigned short *tempbx, unsigned char* tempcl,
- unsigned char *tempch, struct vb_device_info *pVBInfo);
-unsigned short XGI_GetTVPtrIndex(struct vb_device_info *pVBInfo);
-void XGI_SetCRT2ModeRegs(unsigned short ModeNo, struct xgi_hw_device_info *, struct vb_device_info *pVBInfo);
-void XGI_CloseCRTC(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo);
-void XGI_OpenCRTC(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo);
-void XGI_GetRAMDAC2DATA(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_UnLockCRT2(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo);
-void XGI_LockCRT2(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo);
-void XGINew_EnableCRT2(struct vb_device_info *pVBInfo);
-void XGINew_LCD_Wait_Time(unsigned char DelayTime, struct vb_device_info *pVBInfo);
-void XGI_LongWait(struct vb_device_info *pVBInfo);
-void XGI_SetCRT1Offset(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo);
-void XGI_GetLCDVCLKPtr(unsigned char *di_0, unsigned char *di_1,
- struct vb_device_info *pVBInfo);
-unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex,
- unsigned short ModeNo,
- unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo);
-void XGI_GetVCLKLen(unsigned char tempal, unsigned char *di_0,
- unsigned char *di_1, struct vb_device_info *pVBInfo);
-unsigned short XGI_GetLCDCapPtr(struct vb_device_info *pVBInfo);
-unsigned short XGI_GetLCDCapPtr1(struct vb_device_info *pVBInfo);
-struct XGI301C_Tap4TimingStruct *XGI_GetTap4Ptr(unsigned short tempcx, struct vb_device_info *pVBInfo);
-void XGI_SetXG21FPBits(struct vb_device_info *pVBInfo);
-void XGI_SetXG27FPBits(struct vb_device_info *pVBInfo);
-unsigned char XGI_XG21GetPSCValue(struct vb_device_info *pVBInfo);
-unsigned char XGI_XG27GetPSCValue(struct vb_device_info *pVBInfo);
-void XGI_XG21BLSignalVDD(unsigned short tempbh, unsigned short tempbl, struct vb_device_info *pVBInfo);
-void XGI_XG27BLSignalVDD(unsigned short tempbh, unsigned short tempbl, struct vb_device_info *pVBInfo);
-void XGI_XG21SetPanelDelay(unsigned short tempbl, struct vb_device_info *pVBInfo);
-unsigned char XGI_XG21CheckLVDSMode(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void XGI_SetXG21LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void XGI_SetXG27LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-unsigned char XGI_SetDefaultVCLK(struct vb_device_info *pVBInfo);
-
-extern void ReadVBIOSTablData(unsigned char ChipType, struct vb_device_info *pVBInfo);
-
-/* unsigned short XGINew_flag_clearbuffer; 0: no clear frame buffer 1:clear frame buffer */
-
-
static unsigned short XGINew_MDA_DAC[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15,
@@ -247,18 +74,8 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo)
/* XGINew_UBLCDDataTable = (struct XGI_LCDDataTablStruct *) XGI_LCDDataTable; */
/* XGINew_UBTVDataTable = (XGI_TVDataTablStruct *) XGI_TVDataTable; */
- if (ChipType >= XG40) {
- pVBInfo->MCLKData
- = (struct XGI_MCLKDataStruct *) XGI340New_MCLKData;
- pVBInfo->ECLKData
- = (struct XGI_ECLKDataStruct *) XGI340_ECLKData;
- } else {
- pVBInfo->MCLKData
- = (struct XGI_MCLKDataStruct *) XGI330New_MCLKData;
- pVBInfo->ECLKData
- = (struct XGI_ECLKDataStruct *) XGI330_ECLKData;
- }
-
+ pVBInfo->MCLKData = (struct XGI_MCLKDataStruct *) XGI340New_MCLKData;
+ pVBInfo->ECLKData = (struct XGI_ECLKDataStruct *) XGI340_ECLKData;
pVBInfo->VCLKData = (struct XGI_VCLKDataStruct *) XGI_VCLKData;
pVBInfo->VBVCLKData = (struct XGI_VBVCLKDataStruct *) XGI_VBVCLKData;
pVBInfo->ScreenOffset = XGI330_ScreenOffset;
@@ -373,314 +190,7 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo)
}
-unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension,
- unsigned short ModeNo)
-{
- unsigned short ModeIdIndex;
- /* unsigned char *pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress; */
- struct vb_device_info VBINF;
- struct vb_device_info *pVBInfo = &VBINF;
- pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase;
- pVBInfo->BaseAddr = (unsigned long) HwDeviceExtension->pjIOAddress;
- pVBInfo->IF_DEF_LVDS = 0;
- pVBInfo->IF_DEF_CH7005 = 0;
- pVBInfo->IF_DEF_LCDA = 1;
- pVBInfo->IF_DEF_CH7017 = 0;
- pVBInfo->IF_DEF_CH7007 = 0; /* [Billy] 2007/05/14 */
- pVBInfo->IF_DEF_VideoCapture = 0;
- pVBInfo->IF_DEF_ScaleLCD = 0;
- pVBInfo->IF_DEF_OEMUtil = 0;
- pVBInfo->IF_DEF_PWD = 0;
-
- if (HwDeviceExtension->jChipType >= XG20) { /* kuku 2004/06/25 */
- pVBInfo->IF_DEF_YPbPr = 0;
- pVBInfo->IF_DEF_HiVision = 0;
- pVBInfo->IF_DEF_CRT2Monitor = 0;
- pVBInfo->VBType = 0; /*set VBType default 0*/
- } else if (HwDeviceExtension->jChipType >= XG40) {
- pVBInfo->IF_DEF_YPbPr = 1;
- pVBInfo->IF_DEF_HiVision = 1;
- pVBInfo->IF_DEF_CRT2Monitor = 1;
- } else {
- pVBInfo->IF_DEF_YPbPr = 1;
- pVBInfo->IF_DEF_HiVision = 1;
- pVBInfo->IF_DEF_CRT2Monitor = 0;
- }
-
- pVBInfo->P3c4 = pVBInfo->BaseAddr + 0x14;
- pVBInfo->P3d4 = pVBInfo->BaseAddr + 0x24;
- pVBInfo->P3c0 = pVBInfo->BaseAddr + 0x10;
- pVBInfo->P3ce = pVBInfo->BaseAddr + 0x1e;
- pVBInfo->P3c2 = pVBInfo->BaseAddr + 0x12;
- pVBInfo->P3cc = pVBInfo->BaseAddr + 0x1C;
- pVBInfo->P3ca = pVBInfo->BaseAddr + 0x1a;
- pVBInfo->P3c6 = pVBInfo->BaseAddr + 0x16;
- pVBInfo->P3c7 = pVBInfo->BaseAddr + 0x17;
- pVBInfo->P3c8 = pVBInfo->BaseAddr + 0x18;
- pVBInfo->P3c9 = pVBInfo->BaseAddr + 0x19;
- pVBInfo->P3da = pVBInfo->BaseAddr + 0x2A;
- pVBInfo->Part0Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_00;
- pVBInfo->Part1Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_04;
- pVBInfo->Part2Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_10;
- pVBInfo->Part3Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_12;
- pVBInfo->Part4Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14;
- pVBInfo->Part5Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14 + 2;
-
- if (HwDeviceExtension->jChipType == XG21) { /* for x86 Linux, XG21 LVDS */
- if ((XGINew_GetReg1(pVBInfo->P3d4, 0x38) & 0xE0) == 0xC0)
- pVBInfo->IF_DEF_LVDS = 1;
- }
- if (HwDeviceExtension->jChipType == XG27) {
- if ((XGINew_GetReg1(pVBInfo->P3d4, 0x38) & 0xE0) == 0xC0) {
- if (XGINew_GetReg1(pVBInfo->P3d4, 0x30) & 0x20)
- pVBInfo->IF_DEF_LVDS = 1;
- }
- }
-
- if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 */
- XGI_GetVBType(pVBInfo);
-
- InitTo330Pointer(HwDeviceExtension->jChipType, pVBInfo);
- if (ModeNo & 0x80) {
- ModeNo = ModeNo & 0x7F;
- /* XGINew_flag_clearbuffer = 0; */
- }
- /* else {
- XGINew_flag_clearbuffer = 1;
- }
- */
- XGINew_SetReg1(pVBInfo->P3c4, 0x05, 0x86);
-
- if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 1.Openkey */
- XGI_UnLockCRT2(HwDeviceExtension, pVBInfo);
-
- XGI_SearchModeID(ModeNo, &ModeIdIndex, pVBInfo);
-
- XGI_GetVGAType(HwDeviceExtension, pVBInfo);
-
- if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */
- XGI_GetVBInfo(ModeNo, ModeIdIndex, HwDeviceExtension, pVBInfo);
- XGI_GetTVInfo(ModeNo, ModeIdIndex, pVBInfo);
- XGI_GetLCDInfo(ModeNo, ModeIdIndex, pVBInfo);
- XGI_DisableBridge(HwDeviceExtension, pVBInfo);
- /* XGI_OpenCRTC(HwDeviceExtension, pVBInfo); */
-
- if (pVBInfo->VBInfo & (SetSimuScanMode | SetCRT2ToLCDA)) {
- XGI_SetCRT1Group(HwDeviceExtension, ModeNo,
- ModeIdIndex, pVBInfo);
-
- if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
- XGI_SetLCDAGroup(ModeNo, ModeIdIndex,
- HwDeviceExtension, pVBInfo);
- }
- } else {
- if (!(pVBInfo->VBInfo & SwitchToCRT2)) {
- XGI_SetCRT1Group(HwDeviceExtension, ModeNo,
- ModeIdIndex, pVBInfo);
- if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
- XGI_SetLCDAGroup(ModeNo, ModeIdIndex,
- HwDeviceExtension,
- pVBInfo);
- }
- }
- }
-
- if (pVBInfo->VBInfo & (SetSimuScanMode | SwitchToCRT2)) {
- switch (HwDeviceExtension->ujVBChipID) {
- case VB_CHIP_301:
- XGI_SetCRT2Group301(ModeNo, HwDeviceExtension,
- pVBInfo); /*add for CRT2 */
- break;
-
- case VB_CHIP_302:
- XGI_SetCRT2Group301(ModeNo, HwDeviceExtension,
- pVBInfo); /*add for CRT2 */
- break;
-
- default:
- break;
- }
- }
-
- XGI_SetCRT2ModeRegs(ModeNo, HwDeviceExtension, pVBInfo);
- XGI_OEM310Setting(ModeNo, ModeIdIndex, pVBInfo); /*0212*/
- XGI_CloseCRTC(HwDeviceExtension, pVBInfo);
- XGI_EnableBridge(HwDeviceExtension, pVBInfo);
- } /* !XG20 */
- else {
- if (pVBInfo->IF_DEF_LVDS == 1)
- if (!XGI_XG21CheckLVDSMode(ModeNo, ModeIdIndex, pVBInfo))
- return 0;
-
- if (ModeNo <= 0x13) {
- pVBInfo->ModeType
- = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag
- & ModeInfoFlag;
- } else {
- pVBInfo->ModeType
- = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag
- & ModeInfoFlag;
- }
-
- pVBInfo->SetFlag = 0;
- if (pVBInfo->IF_DEF_CH7007 != 1)
- pVBInfo->VBInfo = DisableCRT2Display;
-
- XGI_DisplayOff(HwDeviceExtension, pVBInfo);
-
- XGI_SetCRT1Group(HwDeviceExtension, ModeNo, ModeIdIndex,
- pVBInfo);
-
- XGI_DisplayOn(HwDeviceExtension, pVBInfo);
- /*
- if (HwDeviceExtension->jChipType == XG21)
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x09, ~0x80, 0x80);
- */
- }
-
- /*
- if (ModeNo <= 0x13) {
- modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
- } else {
- modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- }
- pVBInfo->ModeType = modeflag&ModeInfoFlag;
- pVBInfo->SetFlag = 0x00;
- pVBInfo->VBInfo = DisableCRT2Display;
- temp = XGINew_CheckMemorySize(HwDeviceExtension, ModeNo, ModeIdIndex, pVBInfo);
-
- if (temp == 0)
- return (0);
-
- XGI_DisplayOff(HwDeviceExtension, pVBInfo) ;
- XGI_SetCRT1Group(HwDeviceExtension, ModeNo, ModeIdIndex, pVBInfo);
- XGI_DisplayOn(HwDeviceExtension, pVBInfo);
- */
-
- XGI_UpdateModeInfo(HwDeviceExtension, pVBInfo);
-
- if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */
- XGI_LockCRT2(HwDeviceExtension, pVBInfo);
- }
-
- return 1;
-}
-
-void XGI_SetCRT1Group(struct xgi_hw_device_info *HwDeviceExtension,
- unsigned short ModeNo, unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo)
-{
- unsigned short StandTableIndex, RefreshRateTableIndex, b3CC, temp;
-
- unsigned short XGINew_P3cc = pVBInfo->P3cc;
-
- /* XGINew_CRT1Mode = ModeNo; // SaveModeID */
- StandTableIndex = XGI_GetModePtr(ModeNo, ModeIdIndex, pVBInfo);
- /* XGI_SetBIOSData(ModeNo, ModeIdIndex); */
- /* XGI_ClearBankRegs(ModeNo, ModeIdIndex); */
- XGI_SetSeqRegs(ModeNo, StandTableIndex, ModeIdIndex, pVBInfo);
- XGI_SetMiscRegs(StandTableIndex, pVBInfo);
- XGI_SetCRTCRegs(HwDeviceExtension, StandTableIndex, pVBInfo);
- XGI_SetATTRegs(ModeNo, StandTableIndex, ModeIdIndex, pVBInfo);
- XGI_SetGRCRegs(StandTableIndex, pVBInfo);
- XGI_ClearExt1Regs(pVBInfo);
-
- /* if (pVBInfo->IF_DEF_ExpLink) */
- if (HwDeviceExtension->jChipType == XG27) {
- if (pVBInfo->IF_DEF_LVDS == 0)
- XGI_SetDefaultVCLK(pVBInfo);
- }
-
- temp = ~ProgrammingCRT2;
- pVBInfo->SetFlag &= temp;
- pVBInfo->SelectCRT2Rate = 0;
-
- if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
- | VB_XGI302LV | VB_XGI301C)) {
- if (pVBInfo->VBInfo & (SetSimuScanMode | SetCRT2ToLCDA
- | SetInSlaveMode)) {
- pVBInfo->SetFlag |= ProgrammingCRT2;
- }
- }
-
- RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo,
- ModeIdIndex, pVBInfo);
- if (RefreshRateTableIndex != 0xFFFF) {
- XGI_SetSync(RefreshRateTableIndex, pVBInfo);
- XGI_SetCRT1CRTC(ModeNo, ModeIdIndex, RefreshRateTableIndex,
- pVBInfo, HwDeviceExtension);
- XGI_SetCRT1DE(HwDeviceExtension, ModeNo, ModeIdIndex,
- RefreshRateTableIndex, pVBInfo);
- XGI_SetCRT1Offset(ModeNo, ModeIdIndex, RefreshRateTableIndex,
- HwDeviceExtension, pVBInfo);
- XGI_SetCRT1VCLK(ModeNo, ModeIdIndex, HwDeviceExtension,
- RefreshRateTableIndex, pVBInfo);
- }
-
- if ((HwDeviceExtension->jChipType >= XG20)
- && (HwDeviceExtension->jChipType < XG27)) { /* fix H/W DCLK/2 bug */
- if ((ModeNo == 0x00) | (ModeNo == 0x01)) {
- XGINew_SetReg1(pVBInfo->P3c4, 0x2B, 0x4E);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2C, 0xE9);
- b3CC = (unsigned char) XGINew_GetReg2(XGINew_P3cc);
- XGINew_SetReg3(XGINew_P3cc, (b3CC |= 0x0C));
- } else if ((ModeNo == 0x04) | (ModeNo == 0x05) | (ModeNo
- == 0x0D)) {
- XGINew_SetReg1(pVBInfo->P3c4, 0x2B, 0x1B);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2C, 0xE3);
- b3CC = (unsigned char) XGINew_GetReg2(XGINew_P3cc);
- XGINew_SetReg3(XGINew_P3cc, (b3CC |= 0x0C));
- }
- }
-
- if (HwDeviceExtension->jChipType >= XG21) {
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x38);
- if (temp & 0xA0) {
-
- /* XGINew_SetRegAND(pVBInfo->P3d4, 0x4A, ~0x20); *//* Enable write GPIOF */
- /* XGINew_SetRegAND(pVBInfo->P3d4, 0x48, ~0x20); *//* P. DWN */
- /* XG21 CRT1 Timing */
- if (HwDeviceExtension->jChipType == XG27)
- XGI_SetXG27CRTC(ModeNo, ModeIdIndex,
- RefreshRateTableIndex, pVBInfo);
- else
- XGI_SetXG21CRTC(ModeNo, ModeIdIndex,
- RefreshRateTableIndex, pVBInfo);
-
- XGI_UpdateXG21CRTC(ModeNo, pVBInfo,
- RefreshRateTableIndex);
-
- if (HwDeviceExtension->jChipType == XG27)
- XGI_SetXG27LCD(pVBInfo, RefreshRateTableIndex,
- ModeNo);
- else
- XGI_SetXG21LCD(pVBInfo, RefreshRateTableIndex,
- ModeNo);
-
- if (pVBInfo->IF_DEF_LVDS == 1) {
- if (HwDeviceExtension->jChipType == XG27)
- XGI_SetXG27LVDSPara(ModeNo,
- ModeIdIndex, pVBInfo);
- else
- XGI_SetXG21LVDSPara(ModeNo,
- ModeIdIndex, pVBInfo);
- }
- /* XGINew_SetRegOR(pVBInfo->P3d4, 0x48, 0x20); *//* P. ON */
- }
- }
-
- pVBInfo->SetFlag &= (~ProgrammingCRT2);
- XGI_SetCRT1FIFO(ModeNo, HwDeviceExtension, pVBInfo);
- XGI_SetCRT1ModeRegs(HwDeviceExtension, ModeNo, ModeIdIndex,
- RefreshRateTableIndex, pVBInfo);
-
- /* XGI_LoadCharacter(); //dif ifdef TVFont */
-
- XGI_LoadDAC(ModeNo, ModeIdIndex, pVBInfo);
- /* XGI_ClearBuffer(HwDeviceExtension, ModeNo, pVBInfo); */
-}
-
-unsigned char XGI_GetModePtr(unsigned short ModeNo, unsigned short ModeIdIndex,
+static unsigned char XGI_GetModePtr(unsigned short ModeNo, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo)
{
unsigned char index;
@@ -707,7 +217,7 @@ unsigned char XGI_SetBIOSData(unsigned short ModeNo, unsigned short ModeIdIndex)
}
*/
-void XGI_SetSeqRegs(unsigned short ModeNo, unsigned short StandTableIndex,
+static void XGI_SetSeqRegs(unsigned short ModeNo, unsigned short StandTableIndex,
unsigned short ModeIdIndex, struct vb_device_info *pVBInfo)
{
unsigned char tempah, SRdata;
@@ -719,7 +229,7 @@ void XGI_SetSeqRegs(unsigned short ModeNo, unsigned short StandTableIndex,
else
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- XGINew_SetReg1(pVBInfo->P3c4, 0x00, 0x03); /* Set SR0 */
+ xgifb_reg_set(pVBInfo->P3c4, 0x00, 0x03); /* Set SR0 */
tempah = pVBInfo->StandTable[StandTableIndex].SR[0];
i = SetCRT2ToLCDA;
@@ -733,15 +243,15 @@ void XGI_SetSeqRegs(unsigned short ModeNo, unsigned short StandTableIndex,
}
tempah |= 0x20; /* screen off */
- XGINew_SetReg1(pVBInfo->P3c4, 0x01, tempah); /* Set SR1 */
+ xgifb_reg_set(pVBInfo->P3c4, 0x01, tempah); /* Set SR1 */
for (i = 02; i <= 04; i++) {
SRdata = pVBInfo->StandTable[StandTableIndex].SR[i - 1]; /* Get SR2,3,4 from file */
- XGINew_SetReg1(pVBInfo->P3c4, i, SRdata); /* Set SR2 3 4 */
+ xgifb_reg_set(pVBInfo->P3c4, i, SRdata); /* Set SR2 3 4 */
}
}
-void XGI_SetMiscRegs(unsigned short StandTableIndex,
+static void XGI_SetMiscRegs(unsigned short StandTableIndex,
struct vb_device_info *pVBInfo)
{
unsigned char Miscdata;
@@ -755,35 +265,35 @@ void XGI_SetMiscRegs(unsigned short StandTableIndex,
}
*/
- XGINew_SetReg3(pVBInfo->P3c2, Miscdata); /* Set Misc(3c2) */
+ outb(Miscdata, pVBInfo->P3c2); /* Set Misc(3c2) */
}
-void XGI_SetCRTCRegs(struct xgi_hw_device_info *HwDeviceExtension,
+static void XGI_SetCRTCRegs(struct xgi_hw_device_info *HwDeviceExtension,
unsigned short StandTableIndex, struct vb_device_info *pVBInfo)
{
unsigned char CRTCdata;
unsigned short i;
- CRTCdata = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x11);
+ CRTCdata = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x11);
CRTCdata &= 0x7f;
- XGINew_SetReg1(pVBInfo->P3d4, 0x11, CRTCdata); /* Unlock CRTC */
+ xgifb_reg_set(pVBInfo->P3d4, 0x11, CRTCdata); /* Unlock CRTC */
for (i = 0; i <= 0x18; i++) {
CRTCdata = pVBInfo->StandTable[StandTableIndex].CRTC[i]; /* Get CRTC from file */
- XGINew_SetReg1(pVBInfo->P3d4, i, CRTCdata); /* Set CRTC(3d4) */
+ xgifb_reg_set(pVBInfo->P3d4, i, CRTCdata); /* Set CRTC(3d4) */
}
/*
if ((HwDeviceExtension->jChipType == XGI_630) && (HwDeviceExtension->jChipRevision == 0x30)) {
if (pVBInfo->VBInfo & SetInSlaveMode) {
if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToTV)) {
- XGINew_SetReg1(pVBInfo->P3d4, 0x18, 0xFE);
+ xgifb_reg_set(pVBInfo->P3d4, 0x18, 0xFE);
}
}
}
*/
}
-void XGI_SetATTRegs(unsigned short ModeNo, unsigned short StandTableIndex,
+static void XGI_SetATTRegs(unsigned short ModeNo, unsigned short StandTableIndex,
unsigned short ModeIdIndex, struct vb_device_info *pVBInfo)
{
unsigned char ARdata;
@@ -811,19 +321,19 @@ void XGI_SetATTRegs(unsigned short ModeNo, unsigned short StandTableIndex,
}
}
- XGINew_GetReg2(pVBInfo->P3da); /* reset 3da */
- XGINew_SetReg3(pVBInfo->P3c0, i); /* set index */
- XGINew_SetReg3(pVBInfo->P3c0, ARdata); /* set data */
+ inb(pVBInfo->P3da); /* reset 3da */
+ outb(i, pVBInfo->P3c0); /* set index */
+ outb(ARdata, pVBInfo->P3c0); /* set data */
}
- XGINew_GetReg2(pVBInfo->P3da); /* reset 3da */
- XGINew_SetReg3(pVBInfo->P3c0, 0x14); /* set index */
- XGINew_SetReg3(pVBInfo->P3c0, 0x00); /* set data */
- XGINew_GetReg2(pVBInfo->P3da); /* Enable Attribute */
- XGINew_SetReg3(pVBInfo->P3c0, 0x20);
+ inb(pVBInfo->P3da); /* reset 3da */
+ outb(0x14, pVBInfo->P3c0); /* set index */
+ outb(0x00, pVBInfo->P3c0); /* set data */
+ inb(pVBInfo->P3da); /* Enable Attribute */
+ outb(0x20, pVBInfo->P3c0);
}
-void XGI_SetGRCRegs(unsigned short StandTableIndex,
+static void XGI_SetGRCRegs(unsigned short StandTableIndex,
struct vb_device_info *pVBInfo)
{
unsigned char GRdata;
@@ -831,159 +341,40 @@ void XGI_SetGRCRegs(unsigned short StandTableIndex,
for (i = 0; i <= 0x08; i++) {
GRdata = pVBInfo->StandTable[StandTableIndex].GRC[i]; /* Get GR from file */
- XGINew_SetReg1(pVBInfo->P3ce, i, GRdata); /* Set GR(3ce) */
+ xgifb_reg_set(pVBInfo->P3ce, i, GRdata); /* Set GR(3ce) */
}
if (pVBInfo->ModeType > ModeVGA) {
- GRdata = (unsigned char) XGINew_GetReg1(pVBInfo->P3ce, 0x05);
+ GRdata = (unsigned char) xgifb_reg_get(pVBInfo->P3ce, 0x05);
GRdata &= 0xBF; /* 256 color disable */
- XGINew_SetReg1(pVBInfo->P3ce, 0x05, GRdata);
+ xgifb_reg_set(pVBInfo->P3ce, 0x05, GRdata);
}
}
-void XGI_ClearExt1Regs(struct vb_device_info *pVBInfo)
+static void XGI_ClearExt1Regs(struct vb_device_info *pVBInfo)
{
unsigned short i;
for (i = 0x0A; i <= 0x0E; i++)
- XGINew_SetReg1(pVBInfo->P3c4, i, 0x00); /* Clear SR0A-SR0E */
+ xgifb_reg_set(pVBInfo->P3c4, i, 0x00); /* Clear SR0A-SR0E */
}
-unsigned char XGI_SetDefaultVCLK(struct vb_device_info *pVBInfo)
+static unsigned char XGI_SetDefaultVCLK(struct vb_device_info *pVBInfo)
{
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x31, ~0x30, 0x20);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2B, pVBInfo->VCLKData[0].SR2B);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2C, pVBInfo->VCLKData[0].SR2C);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x31, ~0x30, 0x20);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2B, pVBInfo->VCLKData[0].SR2B);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2C, pVBInfo->VCLKData[0].SR2C);
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x31, ~0x30, 0x10);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2B, pVBInfo->VCLKData[1].SR2B);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2C, pVBInfo->VCLKData[1].SR2C);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x31, ~0x30, 0x10);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2B, pVBInfo->VCLKData[1].SR2B);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2C, pVBInfo->VCLKData[1].SR2C);
- XGINew_SetRegAND(pVBInfo->P3c4, 0x31, ~0x30);
+ xgifb_reg_and(pVBInfo->P3c4, 0x31, ~0x30);
return 0;
}
-unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE,
- unsigned short ModeNo, unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo)
-{
- short LCDRefreshIndex[] = { 0x00, 0x00, 0x03, 0x01 },
- LCDARefreshIndex[] = { 0x00, 0x00, 0x03, 0x01, 0x01,
- 0x01, 0x01 };
-
- unsigned short RefreshRateTableIndex, i, modeflag, index, temp;
-
- if (ModeNo <= 0x13)
- modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
- else
- modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
-
- if (pVBInfo->IF_DEF_CH7005 == 1) {
- if (pVBInfo->VBInfo & SetCRT2ToTV) {
- if (modeflag & HalfDCLK)
- return 0;
- }
- }
-
- if (ModeNo < 0x14)
- return 0xFFFF;
-
- index = XGINew_GetReg1(pVBInfo->P3d4, 0x33);
- index = index >> pVBInfo->SelectCRT2Rate;
- index &= 0x0F;
-
- if (pVBInfo->LCDInfo & LCDNonExpanding)
- index = 0;
-
- if (index > 0)
- index--;
-
- if (pVBInfo->SetFlag & ProgrammingCRT2) {
- if (pVBInfo->IF_DEF_CH7005 == 1) {
- if (pVBInfo->VBInfo & SetCRT2ToTV)
- index = 0;
- }
-
- if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
- if (pVBInfo->IF_DEF_LVDS == 0) {
- if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B
- | VB_XGI301LV | VB_XGI302LV
- | VB_XGI301C))
- temp
- = LCDARefreshIndex[pVBInfo->LCDResInfo
- & 0x0F]; /* 301b */
- else
- temp
- = LCDRefreshIndex[pVBInfo->LCDResInfo
- & 0x0F];
-
- if (index > temp)
- index = temp;
- } else {
- index = 0;
- }
- }
- }
-
- RefreshRateTableIndex = pVBInfo->EModeIDTable[ModeIdIndex].REFindex;
- ModeNo = pVBInfo->RefIndex[RefreshRateTableIndex].ModeID;
- if (pXGIHWDE->jChipType >= XG20) { /* for XG20, XG21, XG27 */
- /*
- if (pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag & XG2xNotSupport) {
- index++;
- }
- */
- if ((pVBInfo->RefIndex[RefreshRateTableIndex].XRes == 800)
- && (pVBInfo->RefIndex[RefreshRateTableIndex].YRes
- == 600)) {
- index++;
- }
- /* Alan 10/19/2007; do the similiar adjustment like XGISearchCRT1Rate() */
- if ((pVBInfo->RefIndex[RefreshRateTableIndex].XRes == 1024)
- && (pVBInfo->RefIndex[RefreshRateTableIndex].YRes
- == 768)) {
- index++;
- }
- if ((pVBInfo->RefIndex[RefreshRateTableIndex].XRes == 1280)
- && (pVBInfo->RefIndex[RefreshRateTableIndex].YRes
- == 1024)) {
- index++;
- }
- }
-
- i = 0;
- do {
- if (pVBInfo->RefIndex[RefreshRateTableIndex + i].ModeID
- != ModeNo)
- break;
- temp
- = pVBInfo->RefIndex[RefreshRateTableIndex + i].Ext_InfoFlag;
- temp &= ModeInfoFlag;
- if (temp < pVBInfo->ModeType)
- break;
- i++;
- index--;
-
- } while (index != 0xFFFF);
- if (!(pVBInfo->VBInfo & SetCRT2ToRAMDAC)) {
- if (pVBInfo->VBInfo & SetInSlaveMode) {
- temp
- = pVBInfo->RefIndex[RefreshRateTableIndex
- + i - 1].Ext_InfoFlag;
- if (temp & InterlaceMode)
- i++;
- }
- }
- i--;
- if ((pVBInfo->SetFlag & ProgrammingCRT2)) {
- temp = XGI_AjustCRT2Rate(ModeNo, ModeIdIndex,
- RefreshRateTableIndex, &i, pVBInfo);
- }
- return RefreshRateTableIndex + i; /* return (0x01 | (temp1<<1)); */
-}
-
-unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo,
+static unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo,
unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex, unsigned short *i,
struct vb_device_info *pVBInfo)
@@ -1125,7 +516,7 @@ unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo,
return 1;
}
-void XGI_SetSync(unsigned short RefreshRateTableIndex,
+static void XGI_SetSync(unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
{
unsigned short sync, temp;
@@ -1134,134 +525,103 @@ void XGI_SetSync(unsigned short RefreshRateTableIndex,
sync &= 0xC0;
temp = 0x2F;
temp |= sync;
- XGINew_SetReg3(pVBInfo->P3c2, temp); /* Set Misc(3c2) */
+ outb(temp, pVBInfo->P3c2); /* Set Misc(3c2) */
}
-void XGI_SetCRT1CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
- struct vb_device_info *pVBInfo,
- struct xgi_hw_device_info *HwDeviceExtension)
-{
- unsigned char index, data;
- unsigned short i;
-
- index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; /* Get index */
- index = index & IndexMask;
-
- data = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x11);
- data &= 0x7F;
- XGINew_SetReg1(pVBInfo->P3d4, 0x11, data); /* Unlock CRTC */
-
- for (i = 0; i < 8; i++)
- pVBInfo->TimingH[0].data[i]
- = pVBInfo->XGINEWUB_CRT1Table[index].CR[i];
-
- for (i = 0; i < 7; i++)
- pVBInfo->TimingV[0].data[i]
- = pVBInfo->XGINEWUB_CRT1Table[index].CR[i + 8];
-
- XGI_SetCRT1Timing_H(pVBInfo, HwDeviceExtension);
-
- XGI_SetCRT1Timing_V(ModeIdIndex, ModeNo, pVBInfo);
-
- if (pVBInfo->ModeType > 0x03)
- XGINew_SetReg1(pVBInfo->P3d4, 0x14, 0x4F);
-}
-
-void XGI_SetCRT1Timing_H(struct vb_device_info *pVBInfo,
+static void XGI_SetCRT1Timing_H(struct vb_device_info *pVBInfo,
struct xgi_hw_device_info *HwDeviceExtension)
{
unsigned char data, data1, pushax;
unsigned short i, j;
- /* XGINew_SetReg1(pVBInfo->P3d4, 0x51, 0); */
- /* XGINew_SetReg1(pVBInfo->P3d4, 0x56, 0); */
- /* XGINew_SetRegANDOR(pVBInfo->P3d4, 0x11, 0x7f, 0x00); */
+ /* xgifb_reg_set(pVBInfo->P3d4, 0x51, 0); */
+ /* xgifb_reg_set(pVBInfo->P3d4, 0x56, 0); */
+ /* xgifb_reg_and_or(pVBInfo->P3d4, 0x11, 0x7f, 0x00); */
- data = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x11); /* unlock cr0-7 */
+ data = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x11); /* unlock cr0-7 */
data &= 0x7F;
- XGINew_SetReg1(pVBInfo->P3d4, 0x11, data);
+ xgifb_reg_set(pVBInfo->P3d4, 0x11, data);
data = pVBInfo->TimingH[0].data[0];
- XGINew_SetReg1(pVBInfo->P3d4, 0, data);
+ xgifb_reg_set(pVBInfo->P3d4, 0, data);
for (i = 0x01; i <= 0x04; i++) {
data = pVBInfo->TimingH[0].data[i];
- XGINew_SetReg1(pVBInfo->P3d4, (unsigned short) (i + 1), data);
+ xgifb_reg_set(pVBInfo->P3d4, (unsigned short) (i + 1), data);
}
for (i = 0x05; i <= 0x06; i++) {
data = pVBInfo->TimingH[0].data[i];
- XGINew_SetReg1(pVBInfo->P3c4, (unsigned short) (i + 6), data);
+ xgifb_reg_set(pVBInfo->P3c4, (unsigned short) (i + 6), data);
}
- j = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x0e);
+ j = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x0e);
j &= 0x1F;
data = pVBInfo->TimingH[0].data[7];
data &= 0xE0;
data |= j;
- XGINew_SetReg1(pVBInfo->P3c4, 0x0e, data);
+ xgifb_reg_set(pVBInfo->P3c4, 0x0e, data);
if (HwDeviceExtension->jChipType >= XG20) {
- data = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x04);
+ data = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x04);
data = data - 1;
- XGINew_SetReg1(pVBInfo->P3d4, 0x04, data);
- data = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x05);
+ xgifb_reg_set(pVBInfo->P3d4, 0x04, data);
+ data = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x05);
data1 = data;
data1 &= 0xE0;
data &= 0x1F;
if (data == 0) {
pushax = data;
- data = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4,
+ data = (unsigned char) xgifb_reg_get(pVBInfo->P3c4,
0x0c);
data &= 0xFB;
- XGINew_SetReg1(pVBInfo->P3c4, 0x0c, data);
+ xgifb_reg_set(pVBInfo->P3c4, 0x0c, data);
data = pushax;
}
data = data - 1;
data |= data1;
- XGINew_SetReg1(pVBInfo->P3d4, 0x05, data);
- data = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x0e);
+ xgifb_reg_set(pVBInfo->P3d4, 0x05, data);
+ data = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x0e);
data = data >> 5;
data = data + 3;
if (data > 7)
data = data - 7;
data = data << 5;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0e, ~0xE0, data);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0e, ~0xE0, data);
}
}
-void XGI_SetCRT1Timing_V(unsigned short ModeIdIndex, unsigned short ModeNo,
+static void XGI_SetCRT1Timing_V(unsigned short ModeIdIndex, unsigned short ModeNo,
struct vb_device_info *pVBInfo)
{
unsigned char data;
unsigned short i, j;
- /* XGINew_SetReg1(pVBInfo->P3d4, 0x51, 0); */
- /* XGINew_SetReg1(pVBInfo->P3d4, 0x56, 0); */
- /* XGINew_SetRegANDOR(pVBInfo->P3d4, 0x11, 0x7f, 0x00); */
+ /* xgifb_reg_set(pVBInfo->P3d4, 0x51, 0); */
+ /* xgifb_reg_set(pVBInfo->P3d4, 0x56, 0); */
+ /* xgifb_reg_and_or(pVBInfo->P3d4, 0x11, 0x7f, 0x00); */
for (i = 0x00; i <= 0x01; i++) {
data = pVBInfo->TimingV[0].data[i];
- XGINew_SetReg1(pVBInfo->P3d4, (unsigned short) (i + 6), data);
+ xgifb_reg_set(pVBInfo->P3d4, (unsigned short) (i + 6), data);
}
for (i = 0x02; i <= 0x03; i++) {
data = pVBInfo->TimingV[0].data[i];
- XGINew_SetReg1(pVBInfo->P3d4, (unsigned short) (i + 0x0e), data);
+ xgifb_reg_set(pVBInfo->P3d4, (unsigned short) (i + 0x0e), data);
}
for (i = 0x04; i <= 0x05; i++) {
data = pVBInfo->TimingV[0].data[i];
- XGINew_SetReg1(pVBInfo->P3d4, (unsigned short) (i + 0x11), data);
+ xgifb_reg_set(pVBInfo->P3d4, (unsigned short) (i + 0x11), data);
}
- j = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x0a);
+ j = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x0a);
j &= 0xC0;
data = pVBInfo->TimingV[0].data[6];
data &= 0x3F;
data |= j;
- XGINew_SetReg1(pVBInfo->P3c4, 0x0a, data);
+ xgifb_reg_set(pVBInfo->P3c4, 0x0a, data);
data = pVBInfo->TimingV[0].data[6];
data &= 0x80;
@@ -1276,10 +636,41 @@ void XGI_SetCRT1Timing_V(unsigned short ModeIdIndex, unsigned short ModeNo,
if (i)
data |= 0x80;
- j = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x09);
+ j = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x09);
j &= 0x5F;
data |= j;
- XGINew_SetReg1(pVBInfo->P3d4, 0x09, data);
+ xgifb_reg_set(pVBInfo->P3d4, 0x09, data);
+}
+
+static void XGI_SetCRT1CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
+ unsigned short RefreshRateTableIndex,
+ struct vb_device_info *pVBInfo,
+ struct xgi_hw_device_info *HwDeviceExtension)
+{
+ unsigned char index, data;
+ unsigned short i;
+
+ index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; /* Get index */
+ index = index & IndexMask;
+
+ data = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x11);
+ data &= 0x7F;
+ xgifb_reg_set(pVBInfo->P3d4, 0x11, data); /* Unlock CRTC */
+
+ for (i = 0; i < 8; i++)
+ pVBInfo->TimingH[0].data[i]
+ = pVBInfo->XGINEWUB_CRT1Table[index].CR[i];
+
+ for (i = 0; i < 7; i++)
+ pVBInfo->TimingV[0].data[i]
+ = pVBInfo->XGINEWUB_CRT1Table[index].CR[i + 8];
+
+ XGI_SetCRT1Timing_H(pVBInfo, HwDeviceExtension);
+
+ XGI_SetCRT1Timing_V(ModeIdIndex, ModeNo, pVBInfo);
+
+ if (pVBInfo->ModeType > 0x03)
+ xgifb_reg_set(pVBInfo->P3d4, 0x14, 0x4F);
}
/* --------------------------------------------------------------------- */
@@ -1288,7 +679,7 @@ void XGI_SetCRT1Timing_V(unsigned short ModeIdIndex, unsigned short ModeNo,
/* Output : Fill CRT Hsync/Vsync to SR2E/SR2F/SR30/SR33/SR34/SR3F */
/* Description : Set LCD timing */
/* --------------------------------------------------------------------- */
-void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
{
@@ -1298,7 +689,7 @@ void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
if (ModeNo <= 0x13) {
StandTableIndex = XGI_GetModePtr(ModeNo, ModeIdIndex, pVBInfo);
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[4]; /* CR04 HRS */
- XGINew_SetReg1(pVBInfo->P3c4, 0x2E, Tempax); /* SR2E [7:0]->HRS */
+ xgifb_reg_set(pVBInfo->P3c4, 0x2E, Tempax); /* SR2E [7:0]->HRS */
Tempbx = pVBInfo->StandTable[StandTableIndex].CRTC[5]; /* Tempbx: CR05 HRE */
Tempbx &= 0x1F; /* Tempbx: HRE[4:0] */
Tempcx = Tempax;
@@ -1307,19 +698,19 @@ void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
if (Tempbx < (Tempax & 0x1F)) /* IF HRE < HRS */
Tempdx |= 0x20; /* Tempdx: HRE = HRE + 0x20 */
Tempdx <<= 2; /* Tempdx << 2 */
- XGINew_SetReg1(pVBInfo->P3c4, 0x2F, Tempdx); /* SR2F [7:2]->HRE */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x30, 0xE3, 00);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2F, Tempdx); /* SR2F [7:2]->HRE */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x30, 0xE3, 00);
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[16]; /* Tempax: CR16 VRS */
Tempbx = Tempax; /* Tempbx=Tempax */
Tempax &= 0x01; /* Tempax: VRS[0] */
- XGINew_SetRegOR(pVBInfo->P3c4, 0x33, Tempax); /* SR33[0]->VRS */
+ xgifb_reg_or(pVBInfo->P3c4, 0x33, Tempax); /* SR33[0]->VRS */
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[7]; /* Tempax: CR7 VRS */
Tempdx = Tempbx >> 1; /* Tempdx: VRS[7:1] */
Tempcx = Tempax & 0x04; /* Tempcx: CR7[2] */
Tempcx <<= 5; /* Tempcx[7]: VRS[8] */
Tempdx |= Tempcx; /* Tempdx: VRS[8:1] */
- XGINew_SetReg1(pVBInfo->P3c4, 0x34, Tempdx); /* SR34[7:0]: VRS[8:1] */
+ xgifb_reg_set(pVBInfo->P3c4, 0x34, Tempdx); /* SR34[7:0]: VRS[8:1] */
Temp1 = Tempcx << 1; /* Temp1[8]: VRS[8] unsigned char -> unsigned short */
Temp1 |= Tempbx; /* Temp1[8:0]: VRS[8:0] */
@@ -1342,12 +733,12 @@ void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
Tempbx = (unsigned char) Temp1; /* Tempbx[1:0]: VRS[10:9] */
Tempax |= Tempbx; /* VRE[5:0]VRS[10:9] */
Tempax &= 0x7F;
- XGINew_SetReg1(pVBInfo->P3c4, 0x3F, Tempax); /* SR3F D[7:2]->VRE D[1:0]->VRS */
+ xgifb_reg_set(pVBInfo->P3c4, 0x3F, Tempax); /* SR3F D[7:2]->VRE D[1:0]->VRS */
} else {
index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[3]; /* Tempax: CR4 HRS */
Tempcx = Tempax; /* Tempcx: HRS */
- XGINew_SetReg1(pVBInfo->P3c4, 0x2E, Tempax); /* SR2E[7:0]->HRS */
+ xgifb_reg_set(pVBInfo->P3c4, 0x2E, Tempax); /* SR2E[7:0]->HRS */
Tempdx = pVBInfo->XGINEWUB_CRT1Table[index].CR[5]; /* SRB */
Tempdx &= 0xC0; /* Tempdx[7:6]: SRB[7:6] */
@@ -1375,19 +766,19 @@ void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
Tempax <<= 2; /* Tempax[7:2]: HRE[5:0] */
Tempdx >>= 6; /* Tempdx[7:6]->[1:0] HRS[9:8] */
Tempax |= Tempdx; /* HRE[5:0]HRS[9:8] */
- XGINew_SetReg1(pVBInfo->P3c4, 0x2F, Tempax); /* SR2F D[7:2]->HRE, D[1:0]->HRS */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x30, 0xE3, 00);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2F, Tempax); /* SR2F D[7:2]->HRE, D[1:0]->HRS */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x30, 0xE3, 00);
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[10]; /* CR10 VRS */
Tempbx = Tempax; /* Tempbx: VRS */
Tempax &= 0x01; /* Tempax[0]: VRS[0] */
- XGINew_SetRegOR(pVBInfo->P3c4, 0x33, Tempax); /* SR33[0]->VRS[0] */
+ xgifb_reg_or(pVBInfo->P3c4, 0x33, Tempax); /* SR33[0]->VRS[0] */
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[9]; /* CR7[2][7] VRE */
Tempcx = Tempbx >> 1; /* Tempcx[6:0]: VRS[7:1] */
Tempdx = Tempax & 0x04; /* Tempdx[2]: CR7[2] */
Tempdx <<= 5; /* Tempdx[7]: VRS[8] */
Tempcx |= Tempdx; /* Tempcx[7:0]: VRS[8:1] */
- XGINew_SetReg1(pVBInfo->P3c4, 0x34, Tempcx); /* SR34[8:1]->VRS */
+ xgifb_reg_set(pVBInfo->P3c4, 0x34, Tempcx); /* SR34[8:1]->VRS */
Temp1 = Tempdx; /* Temp1[7]: Tempdx[7] */
Temp1 <<= 1; /* Temp1[8]: VRS[8] */
@@ -1422,11 +813,11 @@ void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
Tempbx = (unsigned char) Temp1;
Tempax |= Tempbx; /* Tempax[7:0]: VRE[5:0]VRS[10:9] */
Tempax &= 0x7F;
- XGINew_SetReg1(pVBInfo->P3c4, 0x3F, Tempax); /* SR3F D[7:2]->VRE D[1:0]->VRS */
+ xgifb_reg_set(pVBInfo->P3c4, 0x3F, Tempax); /* SR3F D[7:2]->VRE D[1:0]->VRS */
}
}
-void XGI_SetXG27CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetXG27CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
{
@@ -1435,7 +826,7 @@ void XGI_SetXG27CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
if (ModeNo <= 0x13) {
StandTableIndex = XGI_GetModePtr(ModeNo, ModeIdIndex, pVBInfo);
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[4]; /* CR04 HRS */
- XGINew_SetReg1(pVBInfo->P3c4, 0x2E, Tempax); /* SR2E [7:0]->HRS */
+ xgifb_reg_set(pVBInfo->P3c4, 0x2E, Tempax); /* SR2E [7:0]->HRS */
Tempbx = pVBInfo->StandTable[StandTableIndex].CRTC[5]; /* Tempbx: CR05 HRE */
Tempbx &= 0x1F; /* Tempbx: HRE[4:0] */
Tempcx = Tempax;
@@ -1444,17 +835,17 @@ void XGI_SetXG27CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
if (Tempbx < (Tempax & 0x1F)) /* IF HRE < HRS */
Tempdx |= 0x20; /* Tempdx: HRE = HRE + 0x20 */
Tempdx <<= 2; /* Tempdx << 2 */
- XGINew_SetReg1(pVBInfo->P3c4, 0x2F, Tempdx); /* SR2F [7:2]->HRE */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x30, 0xE3, 00);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2F, Tempdx); /* SR2F [7:2]->HRE */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x30, 0xE3, 00);
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[16]; /* Tempax: CR10 VRS */
- XGINew_SetReg1(pVBInfo->P3c4, 0x34, Tempax); /* SR34[7:0]->VRS */
+ xgifb_reg_set(pVBInfo->P3c4, 0x34, Tempax); /* SR34[7:0]->VRS */
Tempcx = Tempax; /* Tempcx=Tempax=VRS[7:0] */
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[7]; /* Tempax[7][2]: CR7[7][2] VRS[9][8] */
Tempbx = Tempax; /* Tempbx=CR07 */
Tempax &= 0x04; /* Tempax[2]: CR07[2] VRS[8] */
Tempax >>= 2;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x35, ~0x01, Tempax); /* SR35 D[0]->VRS D[8] */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x01, Tempax); /* SR35 D[0]->VRS D[8] */
Tempcx |= (Tempax << 8); /* Tempcx[8] |= VRS[8] */
Tempcx |= (Tempbx & 0x80) << 2; /* Tempcx[9] |= VRS[9] */
@@ -1468,13 +859,13 @@ void XGI_SetXG27CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
Tempax = (unsigned char) Tempbx & 0xFF; /* Tempax[7:0]: VRE[7:0] */
Tempax <<= 2; /* Tempax << 2: VRE[5:0] */
Tempcx = (Tempcx & 0x600) >> 8; /* Tempcx VRS[10:9] */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x3F, ~0xFC, Tempax); /* SR3F D[7:2]->VRE D[5:0] */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x35, ~0x06, Tempcx); /* SR35 D[2:1]->VRS[10:9] */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x3F, ~0xFC, Tempax); /* SR3F D[7:2]->VRE D[5:0] */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x06, Tempcx); /* SR35 D[2:1]->VRS[10:9] */
} else {
index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[3]; /* Tempax: CR4 HRS */
Tempbx = Tempax; /* Tempbx: HRS[7:0] */
- XGINew_SetReg1(pVBInfo->P3c4, 0x2E, Tempax); /* SR2E[7:0]->HRS */
+ xgifb_reg_set(pVBInfo->P3c4, 0x2E, Tempax); /* SR2E[7:0]->HRS */
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[5]; /* SR0B */
Tempax &= 0xC0; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8]*/
@@ -1501,18 +892,18 @@ void XGI_SetXG27CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
Tempax &= 0xC0; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8]*/
Tempax >>= 6; /* Tempax[1:0]: HRS[9:8]*/
Tempax |= ((Tempbx << 2) & 0xFF); /* Tempax[7:2]: HRE[5:0] */
- XGINew_SetReg1(pVBInfo->P3c4, 0x2F, Tempax); /* SR2F [7:2][1:0]: HRE[5:0]HRS[9:8] */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x30, 0xE3, 00);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2F, Tempax); /* SR2F [7:2][1:0]: HRE[5:0]HRS[9:8] */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x30, 0xE3, 00);
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[10]; /* CR10 VRS */
- XGINew_SetReg1(pVBInfo->P3c4, 0x34, Tempax); /* SR34[7:0]->VRS[7:0] */
+ xgifb_reg_set(pVBInfo->P3c4, 0x34, Tempax); /* SR34[7:0]->VRS[7:0] */
Tempcx = Tempax; /* Tempcx <= VRS[7:0] */
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[9]; /* CR7[7][2] VRS[9][8] */
Tempbx = Tempax; /* Tempbx <= CR07[7:0] */
Tempax = Tempax & 0x04; /* Tempax[2]: CR7[2]: VRS[8] */
Tempax >>= 2; /* Tempax[0]: VRS[8] */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x35, ~0x01, Tempax); /* SR35[0]: VRS[8] */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x01, Tempax); /* SR35[0]: VRS[8] */
Tempcx |= (Tempax << 8); /* Tempcx <= VRS[8:0] */
Tempcx |= ((Tempbx & 0x80) << 2); /* Tempcx <= VRS[9:0] */
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[14]; /* Tempax: SR0A */
@@ -1533,9 +924,9 @@ void XGI_SetXG27CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
Tempbx |= 0x20; /* VRE + 0x20 */
Tempax = (Tempbx << 2) & 0xFF; /* Tempax: Tempax[7:0]; VRE[5:0]00 */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x3F, ~0xFC, Tempax); /* SR3F[7:2]:VRE[5:0] */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x3F, ~0xFC, Tempax); /* SR3F[7:2]:VRE[5:0] */
Tempax = Tempcx >> 8;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x35, ~0x07, Tempax); /* SR35[2:0]:VRS[10:8] */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x07, Tempax); /* SR35[2:0]:VRS[10:8] */
}
}
@@ -1545,7 +936,7 @@ void XGI_SetXG27CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
/* Output : FCLK duty cycle, FCLK delay compensation */
/* Description : All values set zero */
/* --------------------------------------------------------------------- */
-void XGI_SetXG21LCD(struct vb_device_info *pVBInfo,
+static void XGI_SetXG21LCD(struct vb_device_info *pVBInfo,
unsigned short RefreshRateTableIndex, unsigned short ModeNo)
{
unsigned short Data, Temp, b3CC;
@@ -1553,45 +944,45 @@ void XGI_SetXG21LCD(struct vb_device_info *pVBInfo,
XGI_P3cc = pVBInfo->P3cc;
- XGINew_SetReg1(pVBInfo->P3d4, 0x2E, 0x00);
- XGINew_SetReg1(pVBInfo->P3d4, 0x2F, 0x00);
- XGINew_SetReg1(pVBInfo->P3d4, 0x46, 0x00);
- XGINew_SetReg1(pVBInfo->P3d4, 0x47, 0x00);
+ xgifb_reg_set(pVBInfo->P3d4, 0x2E, 0x00);
+ xgifb_reg_set(pVBInfo->P3d4, 0x2F, 0x00);
+ xgifb_reg_set(pVBInfo->P3d4, 0x46, 0x00);
+ xgifb_reg_set(pVBInfo->P3d4, 0x47, 0x00);
if (((*pVBInfo->pDVOSetting) & 0xC0) == 0xC0) {
- XGINew_SetReg1(pVBInfo->P3d4, 0x2E, *pVBInfo->pCR2E);
- XGINew_SetReg1(pVBInfo->P3d4, 0x2F, *pVBInfo->pCR2F);
- XGINew_SetReg1(pVBInfo->P3d4, 0x46, *pVBInfo->pCR46);
- XGINew_SetReg1(pVBInfo->P3d4, 0x47, *pVBInfo->pCR47);
+ xgifb_reg_set(pVBInfo->P3d4, 0x2E, *pVBInfo->pCR2E);
+ xgifb_reg_set(pVBInfo->P3d4, 0x2F, *pVBInfo->pCR2F);
+ xgifb_reg_set(pVBInfo->P3d4, 0x46, *pVBInfo->pCR46);
+ xgifb_reg_set(pVBInfo->P3d4, 0x47, *pVBInfo->pCR47);
}
- Temp = XGINew_GetReg1(pVBInfo->P3d4, 0x37);
+ Temp = xgifb_reg_get(pVBInfo->P3d4, 0x37);
if (Temp & 0x01) {
- XGINew_SetRegOR(pVBInfo->P3c4, 0x06, 0x40); /* 18 bits FP */
- XGINew_SetRegOR(pVBInfo->P3c4, 0x09, 0x40);
+ xgifb_reg_or(pVBInfo->P3c4, 0x06, 0x40); /* 18 bits FP */
+ xgifb_reg_or(pVBInfo->P3c4, 0x09, 0x40);
}
- XGINew_SetRegOR(pVBInfo->P3c4, 0x1E, 0x01); /* Negative blank polarity */
+ xgifb_reg_or(pVBInfo->P3c4, 0x1E, 0x01); /* Negative blank polarity */
- XGINew_SetRegAND(pVBInfo->P3c4, 0x30, ~0x20);
- XGINew_SetRegAND(pVBInfo->P3c4, 0x35, ~0x80);
+ xgifb_reg_and(pVBInfo->P3c4, 0x30, ~0x20);
+ xgifb_reg_and(pVBInfo->P3c4, 0x35, ~0x80);
if (ModeNo <= 0x13) {
- b3CC = (unsigned char) XGINew_GetReg2(XGI_P3cc);
+ b3CC = (unsigned char) inb(XGI_P3cc);
if (b3CC & 0x40)
- XGINew_SetRegOR(pVBInfo->P3c4, 0x30, 0x20); /* Hsync polarity */
+ xgifb_reg_or(pVBInfo->P3c4, 0x30, 0x20); /* Hsync polarity */
if (b3CC & 0x80)
- XGINew_SetRegOR(pVBInfo->P3c4, 0x35, 0x80); /* Vsync polarity */
+ xgifb_reg_or(pVBInfo->P3c4, 0x35, 0x80); /* Vsync polarity */
} else {
Data = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
if (Data & 0x4000)
- XGINew_SetRegOR(pVBInfo->P3c4, 0x30, 0x20); /* Hsync polarity */
+ xgifb_reg_or(pVBInfo->P3c4, 0x30, 0x20); /* Hsync polarity */
if (Data & 0x8000)
- XGINew_SetRegOR(pVBInfo->P3c4, 0x35, 0x80); /* Vsync polarity */
+ xgifb_reg_or(pVBInfo->P3c4, 0x35, 0x80); /* Vsync polarity */
}
}
-void XGI_SetXG27LCD(struct vb_device_info *pVBInfo,
+static void XGI_SetXG27LCD(struct vb_device_info *pVBInfo,
unsigned short RefreshRateTableIndex, unsigned short ModeNo)
{
unsigned short Data, Temp, b3CC;
@@ -1599,43 +990,43 @@ void XGI_SetXG27LCD(struct vb_device_info *pVBInfo,
XGI_P3cc = pVBInfo->P3cc;
- XGINew_SetReg1(pVBInfo->P3d4, 0x2E, 0x00);
- XGINew_SetReg1(pVBInfo->P3d4, 0x2F, 0x00);
- XGINew_SetReg1(pVBInfo->P3d4, 0x46, 0x00);
- XGINew_SetReg1(pVBInfo->P3d4, 0x47, 0x00);
+ xgifb_reg_set(pVBInfo->P3d4, 0x2E, 0x00);
+ xgifb_reg_set(pVBInfo->P3d4, 0x2F, 0x00);
+ xgifb_reg_set(pVBInfo->P3d4, 0x46, 0x00);
+ xgifb_reg_set(pVBInfo->P3d4, 0x47, 0x00);
- Temp = XGINew_GetReg1(pVBInfo->P3d4, 0x37);
+ Temp = xgifb_reg_get(pVBInfo->P3d4, 0x37);
if ((Temp & 0x03) == 0) { /* dual 12 */
- XGINew_SetReg1(pVBInfo->P3d4, 0x46, 0x13);
- XGINew_SetReg1(pVBInfo->P3d4, 0x47, 0x13);
+ xgifb_reg_set(pVBInfo->P3d4, 0x46, 0x13);
+ xgifb_reg_set(pVBInfo->P3d4, 0x47, 0x13);
}
if (((*pVBInfo->pDVOSetting) & 0xC0) == 0xC0) {
- XGINew_SetReg1(pVBInfo->P3d4, 0x2E, *pVBInfo->pCR2E);
- XGINew_SetReg1(pVBInfo->P3d4, 0x2F, *pVBInfo->pCR2F);
- XGINew_SetReg1(pVBInfo->P3d4, 0x46, *pVBInfo->pCR46);
- XGINew_SetReg1(pVBInfo->P3d4, 0x47, *pVBInfo->pCR47);
+ xgifb_reg_set(pVBInfo->P3d4, 0x2E, *pVBInfo->pCR2E);
+ xgifb_reg_set(pVBInfo->P3d4, 0x2F, *pVBInfo->pCR2F);
+ xgifb_reg_set(pVBInfo->P3d4, 0x46, *pVBInfo->pCR46);
+ xgifb_reg_set(pVBInfo->P3d4, 0x47, *pVBInfo->pCR47);
}
XGI_SetXG27FPBits(pVBInfo);
- XGINew_SetRegOR(pVBInfo->P3c4, 0x1E, 0x01); /* Negative blank polarity */
+ xgifb_reg_or(pVBInfo->P3c4, 0x1E, 0x01); /* Negative blank polarity */
- XGINew_SetRegAND(pVBInfo->P3c4, 0x30, ~0x20); /* Hsync polarity */
- XGINew_SetRegAND(pVBInfo->P3c4, 0x35, ~0x80); /* Vsync polarity */
+ xgifb_reg_and(pVBInfo->P3c4, 0x30, ~0x20); /* Hsync polarity */
+ xgifb_reg_and(pVBInfo->P3c4, 0x35, ~0x80); /* Vsync polarity */
if (ModeNo <= 0x13) {
- b3CC = (unsigned char) XGINew_GetReg2(XGI_P3cc);
+ b3CC = (unsigned char) inb(XGI_P3cc);
if (b3CC & 0x40)
- XGINew_SetRegOR(pVBInfo->P3c4, 0x30, 0x20); /* Hsync polarity */
+ xgifb_reg_or(pVBInfo->P3c4, 0x30, 0x20); /* Hsync polarity */
if (b3CC & 0x80)
- XGINew_SetRegOR(pVBInfo->P3c4, 0x35, 0x80); /* Vsync polarity */
+ xgifb_reg_or(pVBInfo->P3c4, 0x35, 0x80); /* Vsync polarity */
} else {
Data = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
if (Data & 0x4000)
- XGINew_SetRegOR(pVBInfo->P3c4, 0x30, 0x20); /* Hsync polarity */
+ xgifb_reg_or(pVBInfo->P3c4, 0x30, 0x20); /* Hsync polarity */
if (Data & 0x8000)
- XGINew_SetRegOR(pVBInfo->P3c4, 0x35, 0x80); /* Vsync polarity */
+ xgifb_reg_or(pVBInfo->P3c4, 0x35, 0x80); /* Vsync polarity */
}
}
@@ -1645,12 +1036,12 @@ void XGI_SetXG27LCD(struct vb_device_info *pVBInfo,
/* Output : CRT1 CRTC */
/* Description : Modify CRT1 Hsync/Vsync to fix LCD mode timing */
/* --------------------------------------------------------------------- */
-void XGI_UpdateXG21CRTC(unsigned short ModeNo, struct vb_device_info *pVBInfo,
+static void XGI_UpdateXG21CRTC(unsigned short ModeNo, struct vb_device_info *pVBInfo,
unsigned short RefreshRateTableIndex)
{
int i, index = -1;
- XGINew_SetRegAND(pVBInfo->P3d4, 0x11, 0x7F); /* Unlock CR0~7 */
+ xgifb_reg_and(pVBInfo->P3d4, 0x11, 0x7F); /* Unlock CR0~7 */
if (ModeNo <= 0x13) {
for (i = 0; i < 12; i++) {
if (ModeNo == pVBInfo->UpdateCRT1[i].ModeID)
@@ -1674,18 +1065,18 @@ void XGI_UpdateXG21CRTC(unsigned short ModeNo, struct vb_device_info *pVBInfo,
}
if (index != -1) {
- XGINew_SetReg1(pVBInfo->P3d4, 0x02,
+ xgifb_reg_set(pVBInfo->P3d4, 0x02,
pVBInfo->UpdateCRT1[index].CR02);
- XGINew_SetReg1(pVBInfo->P3d4, 0x03,
+ xgifb_reg_set(pVBInfo->P3d4, 0x03,
pVBInfo->UpdateCRT1[index].CR03);
- XGINew_SetReg1(pVBInfo->P3d4, 0x15,
+ xgifb_reg_set(pVBInfo->P3d4, 0x15,
pVBInfo->UpdateCRT1[index].CR15);
- XGINew_SetReg1(pVBInfo->P3d4, 0x16,
+ xgifb_reg_set(pVBInfo->P3d4, 0x16,
pVBInfo->UpdateCRT1[index].CR16);
}
}
-void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension,
+static void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension,
unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
@@ -1731,14 +1122,14 @@ void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension,
tempax -= 1;
tempbx -= 1;
tempcx = tempax;
- temp = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x11);
- data = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x11);
+ temp = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x11);
+ data = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x11);
data &= 0x7F;
- XGINew_SetReg1(pVBInfo->P3d4, 0x11, data); /* Unlock CRTC */
- XGINew_SetReg1(pVBInfo->P3d4, 0x01, (unsigned short) (tempcx & 0xff));
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x0b, ~0x0c,
+ xgifb_reg_set(pVBInfo->P3d4, 0x11, data); /* Unlock CRTC */
+ xgifb_reg_set(pVBInfo->P3d4, 0x01, (unsigned short) (tempcx & 0xff));
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x0b, ~0x0c,
(unsigned short) ((tempcx & 0x0ff00) >> 10));
- XGINew_SetReg1(pVBInfo->P3d4, 0x12, (unsigned short) (tempbx & 0xff));
+ xgifb_reg_set(pVBInfo->P3d4, 0x12, (unsigned short) (tempbx & 0xff));
tempax = 0;
tempbx = tempbx >> 8;
@@ -1748,16 +1139,16 @@ void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension,
if (tempbx & 0x02)
tempax |= 0x40;
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x42, tempax);
- data = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x07);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x42, tempax);
+ data = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x07);
data &= 0xFF;
tempax = 0;
if (tempbx & 0x04)
tempax |= 0x02;
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x0a, ~0x02, tempax);
- XGINew_SetReg1(pVBInfo->P3d4, 0x11, temp);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x0a, ~0x02, tempax);
+ xgifb_reg_set(pVBInfo->P3d4, 0x11, temp);
}
unsigned short XGI_GetResInfo(unsigned short ModeNo,
@@ -1772,7 +1163,7 @@ unsigned short XGI_GetResInfo(unsigned short ModeNo,
return resindex;
}
-void XGI_SetCRT1Offset(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetCRT1Offset(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
@@ -1825,14 +1216,14 @@ void XGI_SetCRT1Offset(unsigned short ModeNo, unsigned short ModeIdIndex,
temp2 = temp;
temp = temp >> 8; /* ah */
temp &= 0x0F;
- i = XGINew_GetReg1(pVBInfo->P3c4, 0x0E);
+ i = xgifb_reg_get(pVBInfo->P3c4, 0x0E);
i &= 0xF0;
i |= temp;
- XGINew_SetReg1(pVBInfo->P3c4, 0x0E, i);
+ xgifb_reg_set(pVBInfo->P3c4, 0x0E, i);
temp = (unsigned char) temp2;
temp &= 0xFF; /* al */
- XGINew_SetReg1(pVBInfo->P3d4, 0x13, temp);
+ xgifb_reg_set(pVBInfo->P3d4, 0x13, temp);
/* SetDisplayUnit */
temp2 = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
@@ -1852,10 +1243,183 @@ void XGI_SetCRT1Offset(unsigned short ModeNo, unsigned short ModeIdIndex,
if ((ModeNo == 0x4A) | (ModeNo == 0x49))
ah -= 1;
- XGINew_SetReg1(pVBInfo->P3c4, 0x10, ah);
+ xgifb_reg_set(pVBInfo->P3c4, 0x10, ah);
+}
+
+static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo,
+ unsigned short ModeIdIndex,
+ unsigned short RefreshRateTableIndex,
+ struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short tempbx;
+
+ unsigned short LCDXlat1VCLK[4] = { VCLK65 + 2, VCLK65 + 2, VCLK65 + 2,
+ VCLK65 + 2 };
+ unsigned short LCDXlat2VCLK[4] = { VCLK108_2 + 5, VCLK108_2 + 5,
+ VCLK108_2 + 5, VCLK108_2 + 5 };
+ unsigned short LVDSXlat1VCLK[4] = { VCLK40, VCLK40, VCLK40, VCLK40 };
+ unsigned short LVDSXlat2VCLK[4] = { VCLK65 + 2, VCLK65 + 2, VCLK65 + 2,
+ VCLK65 + 2 };
+ unsigned short LVDSXlat3VCLK[4] = { VCLK65 + 2, VCLK65 + 2, VCLK65 + 2,
+ VCLK65 + 2 };
+
+ unsigned short CRT2Index, VCLKIndex;
+ unsigned short modeflag, resinfo;
+ unsigned char *CHTVVCLKPtr = NULL;
+
+ if (ModeNo <= 0x13) {
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */
+ resinfo = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo;
+ CRT2Index = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ } else {
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */
+ resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ CRT2Index
+ = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ }
+
+ if (pVBInfo->IF_DEF_LVDS == 0) {
+ CRT2Index = CRT2Index >> 6; /* for LCD */
+ if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { /*301b*/
+ if (pVBInfo->LCDResInfo != Panel1024x768)
+ VCLKIndex = LCDXlat2VCLK[CRT2Index];
+ else
+ VCLKIndex = LCDXlat1VCLK[CRT2Index];
+ } else { /* for TV */
+ if (pVBInfo->VBInfo & SetCRT2ToTV) {
+ if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) {
+ if (pVBInfo->SetFlag & RPLLDIV2XO) {
+ VCLKIndex = HiTVVCLKDIV2;
+
+ VCLKIndex += 25;
+
+ } else {
+ VCLKIndex = HiTVVCLK;
+
+ VCLKIndex += 25;
+
+ }
+
+ if (pVBInfo->SetFlag & TVSimuMode) {
+ if (modeflag & Charx8Dot) {
+ VCLKIndex
+ = HiTVSimuVCLK;
+
+ VCLKIndex += 25;
+
+ } else {
+ VCLKIndex
+ = HiTVTextVCLK;
+
+ VCLKIndex += 25;
+
+ }
+ }
+
+ if (pVBInfo->VBType & VB_XGI301LV) { /* 301lv */
+ if (!(pVBInfo->VBExtInfo
+ == VB_YPbPr1080i)) {
+ VCLKIndex
+ = YPbPr750pVCLK;
+ if (!(pVBInfo->VBExtInfo
+ == VB_YPbPr750p)) {
+ VCLKIndex
+ = YPbPr525pVCLK;
+ if (!(pVBInfo->VBExtInfo
+ == VB_YPbPr525p)) {
+ VCLKIndex
+ = YPbPr525iVCLK_2;
+ if (!(pVBInfo->SetFlag
+ & RPLLDIV2XO))
+ VCLKIndex
+ = YPbPr525iVCLK;
+ }
+ }
+ }
+ }
+ } else {
+ if (pVBInfo->VBInfo & SetCRT2ToTV) {
+ if (pVBInfo->SetFlag
+ & RPLLDIV2XO) {
+ VCLKIndex = TVVCLKDIV2;
+
+ VCLKIndex += 25;
+
+ } else {
+ VCLKIndex = TVVCLK;
+
+ VCLKIndex += 25;
+
+ }
+ }
+ }
+ } else { /* for CRT2 */
+ VCLKIndex = (unsigned char) inb(
+ (pVBInfo->P3ca + 0x02)); /* Port 3cch */
+ VCLKIndex = ((VCLKIndex >> 2) & 0x03);
+ if (ModeNo > 0x13) {
+ VCLKIndex
+ = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; /* di+Ext_CRTVCLK */
+ VCLKIndex &= IndexMask;
+ }
+ }
+ }
+ } else { /* LVDS */
+ if (ModeNo <= 0x13)
+ VCLKIndex = CRT2Index;
+ else
+ VCLKIndex = CRT2Index;
+
+ if (pVBInfo->IF_DEF_CH7005 == 1) {
+ if (!(pVBInfo->VBInfo & SetCRT2ToLCD)) {
+ VCLKIndex &= 0x1f;
+ tempbx = 0;
+
+ if (pVBInfo->VBInfo & SetPALTV)
+ tempbx += 2;
+
+ if (pVBInfo->VBInfo & SetCHTVOverScan)
+ tempbx += 1;
+
+ switch (tempbx) {
+ case 0:
+ CHTVVCLKPtr = pVBInfo->CHTVVCLKUNTSC;
+ break;
+ case 1:
+ CHTVVCLKPtr = pVBInfo->CHTVVCLKONTSC;
+ break;
+ case 2:
+ CHTVVCLKPtr = pVBInfo->CHTVVCLKUPAL;
+ break;
+ case 3:
+ CHTVVCLKPtr = pVBInfo->CHTVVCLKOPAL;
+ break;
+ default:
+ break;
+ }
+
+ VCLKIndex = CHTVVCLKPtr[VCLKIndex];
+ }
+ } else {
+ VCLKIndex = VCLKIndex >> 6;
+ if ((pVBInfo->LCDResInfo == Panel800x600)
+ || (pVBInfo->LCDResInfo == Panel320x480))
+ VCLKIndex = LVDSXlat1VCLK[VCLKIndex];
+ else if ((pVBInfo->LCDResInfo == Panel1024x768)
+ || (pVBInfo->LCDResInfo
+ == Panel1024x768x75))
+ VCLKIndex = LVDSXlat2VCLK[VCLKIndex];
+ else
+ VCLKIndex = LVDSXlat3VCLK[VCLKIndex];
+ }
+ }
+ /* VCLKIndex = VCLKIndex&IndexMask; */
+
+ return VCLKIndex;
}
-void XGI_SetCRT1VCLK(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetCRT1VCLK(unsigned short ModeNo, unsigned short ModeIdIndex,
struct xgi_hw_device_info *HwDeviceExtension,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
@@ -1865,82 +1429,82 @@ void XGI_SetCRT1VCLK(unsigned short ModeNo, unsigned short ModeIdIndex,
if (pVBInfo->IF_DEF_LVDS == 1) {
index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x31) & 0xCF;
- XGINew_SetReg1(pVBInfo->P3c4, 0x31, data);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2B,
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x31) & 0xCF;
+ xgifb_reg_set(pVBInfo->P3c4, 0x31, data);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2B,
pVBInfo->VCLKData[index].SR2B);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2C,
+ xgifb_reg_set(pVBInfo->P3c4, 0x2C,
pVBInfo->VCLKData[index].SR2C);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2D, 0x01);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2D, 0x01);
} else if ((pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
| VB_XGI302LV | VB_XGI301C)) && (pVBInfo->VBInfo
& SetCRT2ToLCDA)) {
vclkindex = XGI_GetVCLK2Ptr(ModeNo, ModeIdIndex,
RefreshRateTableIndex, HwDeviceExtension,
pVBInfo);
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x31) & 0xCF;
- XGINew_SetReg1(pVBInfo->P3c4, 0x31, data);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x31) & 0xCF;
+ xgifb_reg_set(pVBInfo->P3c4, 0x31, data);
data = pVBInfo->VBVCLKData[vclkindex].Part4_A;
- XGINew_SetReg1(pVBInfo->P3c4, 0x2B, data);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2B, data);
data = pVBInfo->VBVCLKData[vclkindex].Part4_B;
- XGINew_SetReg1(pVBInfo->P3c4, 0x2C, data);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2D, 0x01);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2C, data);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2D, 0x01);
} else {
index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x31) & 0xCF;
- XGINew_SetReg1(pVBInfo->P3c4, 0x31, data);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2B,
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x31) & 0xCF;
+ xgifb_reg_set(pVBInfo->P3c4, 0x31, data);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2B,
pVBInfo->VCLKData[index].SR2B);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2C,
+ xgifb_reg_set(pVBInfo->P3c4, 0x2C,
pVBInfo->VCLKData[index].SR2C);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2D, 0x01);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2D, 0x01);
}
if (HwDeviceExtension->jChipType >= XG20) {
if (pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag & HalfDCLK) {
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x2B);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2B, data);
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x2C);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x2B);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2B, data);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x2C);
index = data;
index &= 0xE0;
data &= 0x1F;
data = data << 1;
data += 1;
data |= index;
- XGINew_SetReg1(pVBInfo->P3c4, 0x2C, data);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2C, data);
}
}
}
-void XGI_SetCRT1FIFO(unsigned short ModeNo,
+static void XGI_SetCRT1FIFO(unsigned short ModeNo,
struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
unsigned short data;
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x3D);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x3D);
data &= 0xfe;
- XGINew_SetReg1(pVBInfo->P3c4, 0x3D, data); /* diable auto-threshold */
+ xgifb_reg_set(pVBInfo->P3c4, 0x3D, data); /* diable auto-threshold */
if (ModeNo > 0x13) {
- XGINew_SetReg1(pVBInfo->P3c4, 0x08, 0x34);
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x09);
+ xgifb_reg_set(pVBInfo->P3c4, 0x08, 0x34);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x09);
data &= 0xC0;
- XGINew_SetReg1(pVBInfo->P3c4, 0x09, data | 0x30);
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x3D);
+ xgifb_reg_set(pVBInfo->P3c4, 0x09, data | 0x30);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x3D);
data |= 0x01;
- XGINew_SetReg1(pVBInfo->P3c4, 0x3D, data);
+ xgifb_reg_set(pVBInfo->P3c4, 0x3D, data);
} else {
if (HwDeviceExtension->jChipType == XG27) {
- XGINew_SetReg1(pVBInfo->P3c4, 0x08, 0x0E);
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x09);
+ xgifb_reg_set(pVBInfo->P3c4, 0x08, 0x0E);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x09);
data &= 0xC0;
- XGINew_SetReg1(pVBInfo->P3c4, 0x09, data | 0x20);
+ xgifb_reg_set(pVBInfo->P3c4, 0x09, data | 0x20);
} else {
- XGINew_SetReg1(pVBInfo->P3c4, 0x08, 0xAE);
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x09);
+ xgifb_reg_set(pVBInfo->P3c4, 0x08, 0xAE);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x09);
data &= 0xF0;
- XGINew_SetReg1(pVBInfo->P3c4, 0x09, data);
+ xgifb_reg_set(pVBInfo->P3c4, 0x09, data);
}
}
@@ -1948,7 +1512,60 @@ void XGI_SetCRT1FIFO(unsigned short ModeNo,
XGI_SetXG21FPBits(pVBInfo); /* Fix SR9[7:6] can't read back */
}
-void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension,
+static void XGI_SetVCLKState(struct xgi_hw_device_info *HwDeviceExtension,
+ unsigned short ModeNo, unsigned short RefreshRateTableIndex,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short data, data2 = 0;
+ short VCLK;
+
+ unsigned char index;
+
+ if (ModeNo <= 0x13)
+ VCLK = 0;
+ else {
+ index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
+ index &= IndexMask;
+ VCLK = pVBInfo->VCLKData[index].CLOCK;
+ }
+
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x32);
+ data &= 0xf3;
+ if (VCLK >= 200)
+ data |= 0x0c; /* VCLK > 200 */
+
+ if (HwDeviceExtension->jChipType >= XG20)
+ data &= ~0x04; /* 2 pixel mode */
+
+ xgifb_reg_set(pVBInfo->P3c4, 0x32, data);
+
+ if (HwDeviceExtension->jChipType < XG20) {
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x1F);
+ data &= 0xE7;
+ if (VCLK < 200)
+ data |= 0x10;
+ xgifb_reg_set(pVBInfo->P3c4, 0x1F, data);
+ }
+
+ /* Jong for Adavantech LCD ripple issue
+ if ((VCLK >= 0) && (VCLK < 135))
+ data2 = 0x03;
+ else if ((VCLK >= 135) && (VCLK < 160))
+ data2 = 0x02;
+ else if ((VCLK >= 160) && (VCLK < 260))
+ data2 = 0x01;
+ else if (VCLK > 260)
+ data2 = 0x00;
+ */
+ data2 = 0x00;
+
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x07, 0xFC, data2);
+ if (HwDeviceExtension->jChipType >= XG27)
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x40, 0xFC, data2 & 0x03);
+
+}
+
+static void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension,
unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
@@ -1963,8 +1580,8 @@ void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension,
} else
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ModeFlag */
- if (XGINew_GetReg1(pVBInfo->P3d4, 0x31) & 0x01)
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x1F, 0x3F, 0x00);
+ if (xgifb_reg_get(pVBInfo->P3d4, 0x31) & 0x01)
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x1F, 0x3F, 0x00);
if (ModeNo > 0x13)
data = infoflag;
@@ -1987,8 +1604,8 @@ void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension,
if (data)
data2 |= 0x20;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x06, ~0x3F, data2);
- /* XGINew_SetReg1(pVBInfo->P3c4,0x06,data2); */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x06, ~0x3F, data2);
+ /* xgifb_reg_set(pVBInfo->P3c4,0x06,data2); */
resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo);
if (ModeNo <= 0x13)
xres = pVBInfo->StResInfo[resindex].HTotal;
@@ -2004,12 +1621,12 @@ void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension,
}
data2 = data & 0x00FF;
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x19, 0xFF, data2);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x19, 0xFF, data2);
data2 = (data & 0xFF00) >> 8;
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x19, 0xFC, data2);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x19, 0xFC, data2);
if (modeflag & HalfDCLK)
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x01, 0xF7, 0x08);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x01, 0xF7, 0x08);
data2 = 0;
@@ -2021,14 +1638,14 @@ void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension,
data2 |= 0x40;
}
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0F, ~0x48, data2);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0F, ~0x48, data2);
data = 0x60;
if (pVBInfo->ModeType != ModeText) {
data = data ^ 0x60;
if (pVBInfo->ModeType != ModeEGA)
data = data ^ 0xA0;
}
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x21, 0x1F, data);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x21, 0x1F, data);
XGI_SetVCLKState(HwDeviceExtension, ModeNo, RefreshRateTableIndex,
pVBInfo);
@@ -2037,86 +1654,32 @@ void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension,
/* if (XGINew_IF_DEF_NEW_LOWRES) */
/* XGI_VesaLowResolution(ModeNo, ModeIdIndex); //030305 fix lowresolution bug */
- data = XGINew_GetReg1(pVBInfo->P3d4, 0x31);
+ data = xgifb_reg_get(pVBInfo->P3d4, 0x31);
if (HwDeviceExtension->jChipType == XG27) {
if (data & 0x40)
data = 0x2c;
else
data = 0x6c;
- XGINew_SetReg1(pVBInfo->P3d4, 0x52, data);
- XGINew_SetRegOR(pVBInfo->P3d4, 0x51, 0x10);
+ xgifb_reg_set(pVBInfo->P3d4, 0x52, data);
+ xgifb_reg_or(pVBInfo->P3d4, 0x51, 0x10);
} else if (HwDeviceExtension->jChipType >= XG20) {
if (data & 0x40)
data = 0x33;
else
data = 0x73;
- XGINew_SetReg1(pVBInfo->P3d4, 0x52, data);
- XGINew_SetReg1(pVBInfo->P3d4, 0x51, 0x02);
+ xgifb_reg_set(pVBInfo->P3d4, 0x52, data);
+ xgifb_reg_set(pVBInfo->P3d4, 0x51, 0x02);
} else {
if (data & 0x40)
data = 0x2c;
else
data = 0x6c;
- XGINew_SetReg1(pVBInfo->P3d4, 0x52, data);
- }
-
-}
-
-void XGI_SetVCLKState(struct xgi_hw_device_info *HwDeviceExtension,
- unsigned short ModeNo, unsigned short RefreshRateTableIndex,
- struct vb_device_info *pVBInfo)
-{
- unsigned short data, data2 = 0;
- short VCLK;
-
- unsigned char index;
-
- if (ModeNo <= 0x13)
- VCLK = 0;
- else {
- index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
- index &= IndexMask;
- VCLK = pVBInfo->VCLKData[index].CLOCK;
+ xgifb_reg_set(pVBInfo->P3d4, 0x52, data);
}
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x32);
- data &= 0xf3;
- if (VCLK >= 200)
- data |= 0x0c; /* VCLK > 200 */
-
- if (HwDeviceExtension->jChipType >= XG20)
- data &= ~0x04; /* 2 pixel mode */
-
- XGINew_SetReg1(pVBInfo->P3c4, 0x32, data);
-
- if (HwDeviceExtension->jChipType < XG20) {
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x1F);
- data &= 0xE7;
- if (VCLK < 200)
- data |= 0x10;
- XGINew_SetReg1(pVBInfo->P3c4, 0x1F, data);
- }
-
- /* Jong for Adavantech LCD ripple issue
- if ((VCLK >= 0) && (VCLK < 135))
- data2 = 0x03;
- else if ((VCLK >= 135) && (VCLK < 160))
- data2 = 0x02;
- else if ((VCLK >= 160) && (VCLK < 260))
- data2 = 0x01;
- else if (VCLK > 260)
- data2 = 0x00;
- */
- data2 = 0x00;
-
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x07, 0xFC, data2);
- if (HwDeviceExtension->jChipType >= XG27)
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x40, 0xFC, data2 & 0x03);
-
}
-
/*
void XGI_VesaLowResolution(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo)
{
@@ -2133,23 +1696,50 @@ void XGI_VesaLowResolution(unsigned short ModeNo, unsigned short ModeIdIndex, st
if (pVBInfo->VBType & VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C)) {
if (!(pVBInfo->VBInfo & SetCRT2ToRAMDAC)) {
if (pVBInfo->VBInfo & SetInSlaveMode) {
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x01, 0xf7, 0x00);
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0f, 0x7f, 0x00);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x01, 0xf7, 0x00);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0f, 0x7f, 0x00);
return;
}
}
}
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0f, 0xff, 0x80);
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x01, 0xf7, 0x00);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0f, 0xff, 0x80);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x01, 0xf7, 0x00);
return;
}
}
}
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0f, 0x7f, 0x00);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0f, 0x7f, 0x00);
}
*/
-void XGI_LoadDAC(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_WriteDAC(unsigned short dl, unsigned short ah, unsigned short al,
+ unsigned short dh, struct vb_device_info *pVBInfo)
+{
+ unsigned short temp, bh, bl;
+
+ bh = ah;
+ bl = al;
+
+ if (dl != 0) {
+ temp = bh;
+ bh = dh;
+ dh = temp;
+ if (dl == 1) {
+ temp = bl;
+ bl = dh;
+ dh = temp;
+ } else {
+ temp = bl;
+ bl = bh;
+ bh = temp;
+ }
+ }
+ outb((unsigned short) dh, pVBInfo->P3c9);
+ outb((unsigned short) bh, pVBInfo->P3c9);
+ outb((unsigned short) bl, pVBInfo->P3c9);
+}
+
+static void XGI_LoadDAC(unsigned short ModeNo, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo)
{
unsigned short data, data2, time, i, j, k, m, n, o, si, di, bx, dl, al,
@@ -2179,8 +1769,8 @@ void XGI_LoadDAC(unsigned short ModeNo, unsigned short ModeIdIndex,
else
j = time;
- XGINew_SetReg3(pVBInfo->P3c6, 0xFF);
- XGINew_SetReg3(pVBInfo->P3c8, 0x00);
+ outb(0xFF, pVBInfo->P3c6);
+ outb(0x00, pVBInfo->P3c8);
for (i = 0; i < j; i++) {
data = table[i];
@@ -2194,7 +1784,7 @@ void XGI_LoadDAC(unsigned short ModeNo, unsigned short ModeIdIndex,
if (data & 0x02)
data2 += 0x15;
- XGINew_SetReg3(pVBInfo->P3c9, data2);
+ outb(data2, pVBInfo->P3c9);
data = data >> 2;
}
}
@@ -2204,7 +1794,7 @@ void XGI_LoadDAC(unsigned short ModeNo, unsigned short ModeIdIndex,
data = table[i];
for (k = 0; k < 3; k++)
- XGINew_SetReg3(pVBInfo->P3c9, data);
+ outb(data, pVBInfo->P3c9);
}
si = 32;
@@ -2241,54 +1831,7 @@ void XGI_LoadDAC(unsigned short ModeNo, unsigned short ModeIdIndex,
}
}
-void XGI_WriteDAC(unsigned short dl, unsigned short ah, unsigned short al,
- unsigned short dh, struct vb_device_info *pVBInfo)
-{
- unsigned short temp, bh, bl;
-
- bh = ah;
- bl = al;
-
- if (dl != 0) {
- temp = bh;
- bh = dh;
- dh = temp;
- if (dl == 1) {
- temp = bl;
- bl = dh;
- dh = temp;
- } else {
- temp = bl;
- bl = bh;
- bh = temp;
- }
- }
- XGINew_SetReg3(pVBInfo->P3c9, (unsigned short) dh);
- XGINew_SetReg3(pVBInfo->P3c9, (unsigned short) bh);
- XGINew_SetReg3(pVBInfo->P3c9, (unsigned short) bl);
-}
-
-void XGI_SetLCDAGroup(unsigned short ModeNo, unsigned short ModeIdIndex,
- struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo)
-{
- unsigned short RefreshRateTableIndex;
- /* unsigned short temp ; */
-
- /* pVBInfo->SelectCRT2Rate = 0; */
-
- pVBInfo->SetFlag |= ProgrammingCRT2;
- RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo,
- ModeIdIndex, pVBInfo);
- XGI_GetLVDSResInfo(ModeNo, ModeIdIndex, pVBInfo);
- XGI_GetLVDSData(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
- XGI_ModCRT1Regs(ModeNo, ModeIdIndex, RefreshRateTableIndex,
- HwDeviceExtension, pVBInfo);
- XGI_SetLVDSRegs(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
- XGI_SetCRT2ECLK(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
-}
-
-void XGI_GetLVDSResInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_GetLVDSResInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo)
{
unsigned short resindex, xres, yres, modeflag;
@@ -2337,7 +1880,621 @@ void XGI_GetLVDSResInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
pVBInfo->VDE = yres;
}
-void XGI_GetLVDSData(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void *XGI_GetLcdPtr(unsigned short BX, unsigned short ModeNo,
+ unsigned short ModeIdIndex,
+ unsigned short RefreshRateTableIndex,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short i, tempdx, tempcx, tempbx, tempal, modeflag, table;
+
+ struct XGI330_LCDDataTablStruct *tempdi = NULL;
+
+ tempbx = BX;
+
+ if (ModeNo <= 0x13) {
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
+ tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ } else {
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ }
+
+ tempal = tempal & 0x0f;
+
+ if (tempbx <= 1) { /* ExpLink */
+ if (ModeNo <= 0x13) {
+ tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC; /* find no Ext_CRT2CRTC2 */
+ } else {
+ tempal
+ = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ }
+
+ if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
+ if (ModeNo <= 0x13)
+ tempal
+ = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC2;
+ else
+ tempal
+ = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC2;
+ }
+
+ if (tempbx & 0x01)
+ tempal = (tempal >> 4);
+
+ tempal = (tempal & 0x0f);
+ }
+
+ tempcx = LCDLenList[tempbx]; /* mov cl,byte ptr cs:LCDLenList[bx] */
+
+ if (pVBInfo->LCDInfo & EnableScalingLCD) { /* ScaleLCD */
+ if ((tempbx == 5) || (tempbx) == 7)
+ tempcx = LCDDesDataLen2;
+ else if ((tempbx == 3) || (tempbx == 8))
+ tempcx = LVDSDesDataLen2;
+ }
+ /* mov di, word ptr cs:LCDDataList[bx] */
+ /* tempdi = pVideoMemory[LCDDataList + tempbx * 2] | (pVideoMemory[LCDDataList + tempbx * 2 + 1] << 8); */
+
+ switch (tempbx) {
+ case 0:
+ tempdi = XGI_EPLLCDCRT1Ptr_H;
+ break;
+ case 1:
+ tempdi = XGI_EPLLCDCRT1Ptr_V;
+ break;
+ case 2:
+ tempdi = XGI_EPLLCDDataPtr;
+ break;
+ case 3:
+ tempdi = XGI_EPLLCDDesDataPtr;
+ break;
+ case 4:
+ tempdi = XGI_LCDDataTable;
+ break;
+ case 5:
+ tempdi = XGI_LCDDesDataTable;
+ break;
+ case 6:
+ tempdi = XGI_EPLCHLCDRegPtr;
+ break;
+ case 7:
+ case 8:
+ case 9:
+ tempdi = NULL;
+ break;
+ default:
+ break;
+ }
+
+ if (tempdi == NULL) /* OEMUtil */
+ return NULL;
+
+ table = tempbx;
+ i = 0;
+
+ while (tempdi[i].PANELID != 0xff) {
+ tempdx = pVBInfo->LCDResInfo;
+ if (tempbx & 0x0080) { /* OEMUtil */
+ tempbx &= (~0x0080);
+ tempdx = pVBInfo->LCDTypeInfo;
+ }
+
+ if (pVBInfo->LCDInfo & EnableScalingLCD)
+ tempdx &= (~PanelResInfo);
+
+ if (tempdi[i].PANELID == tempdx) {
+ tempbx = tempdi[i].MASK;
+ tempdx = pVBInfo->LCDInfo;
+
+ if (ModeNo <= 0x13) /* alan 09/10/2003 */
+ tempdx |= SetLCDStdMode;
+
+ if (modeflag & HalfDCLK)
+ tempdx |= SetLCDLowResolution;
+
+ tempbx &= tempdx;
+ if (tempbx == tempdi[i].CAP)
+ break;
+ }
+ i++;
+ }
+
+ if (table == 0) {
+ switch (tempdi[i].DATAPTR) {
+ case 0:
+ return &XGI_LVDSCRT11024x768_1_H[tempal];
+ break;
+ case 1:
+ return &XGI_LVDSCRT11024x768_2_H[tempal];
+ break;
+ case 2:
+ return &XGI_LVDSCRT11280x1024_1_H[tempal];
+ break;
+ case 3:
+ return &XGI_LVDSCRT11280x1024_2_H[tempal];
+ break;
+ case 4:
+ return &XGI_LVDSCRT11400x1050_1_H[tempal];
+ break;
+ case 5:
+ return &XGI_LVDSCRT11400x1050_2_H[tempal];
+ break;
+ case 6:
+ return &XGI_LVDSCRT11600x1200_1_H[tempal];
+ break;
+ case 7:
+ return &XGI_LVDSCRT11024x768_1_Hx75[tempal];
+ break;
+ case 8:
+ return &XGI_LVDSCRT11024x768_2_Hx75[tempal];
+ break;
+ case 9:
+ return &XGI_LVDSCRT11280x1024_1_Hx75[tempal];
+ break;
+ case 10:
+ return &XGI_LVDSCRT11280x1024_2_Hx75[tempal];
+ break;
+ default:
+ break;
+ }
+ } else if (table == 1) {
+ switch (tempdi[i].DATAPTR) {
+ case 0:
+ return &XGI_LVDSCRT11024x768_1_V[tempal];
+ break;
+ case 1:
+ return &XGI_LVDSCRT11024x768_2_V[tempal];
+ break;
+ case 2:
+ return &XGI_LVDSCRT11280x1024_1_V[tempal];
+ break;
+ case 3:
+ return &XGI_LVDSCRT11280x1024_2_V[tempal];
+ break;
+ case 4:
+ return &XGI_LVDSCRT11400x1050_1_V[tempal];
+ break;
+ case 5:
+ return &XGI_LVDSCRT11400x1050_2_V[tempal];
+ break;
+ case 6:
+ return &XGI_LVDSCRT11600x1200_1_V[tempal];
+ break;
+ case 7:
+ return &XGI_LVDSCRT11024x768_1_Vx75[tempal];
+ break;
+ case 8:
+ return &XGI_LVDSCRT11024x768_2_Vx75[tempal];
+ break;
+ case 9:
+ return &XGI_LVDSCRT11280x1024_1_Vx75[tempal];
+ break;
+ case 10:
+ return &XGI_LVDSCRT11280x1024_2_Vx75[tempal];
+ break;
+ default:
+ break;
+ }
+ } else if (table == 2) {
+ switch (tempdi[i].DATAPTR) {
+ case 0:
+ return &XGI_LVDS1024x768Data_1[tempal];
+ break;
+ case 1:
+ return &XGI_LVDS1024x768Data_2[tempal];
+ break;
+ case 2:
+ return &XGI_LVDS1280x1024Data_1[tempal];
+ break;
+ case 3:
+ return &XGI_LVDS1280x1024Data_2[tempal];
+ break;
+ case 4:
+ return &XGI_LVDS1400x1050Data_1[tempal];
+ break;
+ case 5:
+ return &XGI_LVDS1400x1050Data_2[tempal];
+ break;
+ case 6:
+ return &XGI_LVDS1600x1200Data_1[tempal];
+ break;
+ case 7:
+ return &XGI_LVDSNoScalingData[tempal];
+ break;
+ case 8:
+ return &XGI_LVDS1024x768Data_1x75[tempal];
+ break;
+ case 9:
+ return &XGI_LVDS1024x768Data_2x75[tempal];
+ break;
+ case 10:
+ return &XGI_LVDS1280x1024Data_1x75[tempal];
+ break;
+ case 11:
+ return &XGI_LVDS1280x1024Data_2x75[tempal];
+ break;
+ case 12:
+ return &XGI_LVDSNoScalingDatax75[tempal];
+ break;
+ default:
+ break;
+ }
+ } else if (table == 3) {
+ switch (tempdi[i].DATAPTR) {
+ case 0:
+ return &XGI_LVDS1024x768Des_1[tempal];
+ break;
+ case 1:
+ return &XGI_LVDS1024x768Des_3[tempal];
+ break;
+ case 2:
+ return &XGI_LVDS1024x768Des_2[tempal];
+ break;
+ case 3:
+ return &XGI_LVDS1280x1024Des_1[tempal];
+ break;
+ case 4:
+ return &XGI_LVDS1280x1024Des_2[tempal];
+ break;
+ case 5:
+ return &XGI_LVDS1400x1050Des_1[tempal];
+ break;
+ case 6:
+ return &XGI_LVDS1400x1050Des_2[tempal];
+ break;
+ case 7:
+ return &XGI_LVDS1600x1200Des_1[tempal];
+ break;
+ case 8:
+ return &XGI_LVDSNoScalingDesData[tempal];
+ break;
+ case 9:
+ return &XGI_LVDS1024x768Des_1x75[tempal];
+ break;
+ case 10:
+ return &XGI_LVDS1024x768Des_3x75[tempal];
+ break;
+ case 11:
+ return &XGI_LVDS1024x768Des_2x75[tempal];
+ break;
+ case 12:
+ return &XGI_LVDS1280x1024Des_1x75[tempal];
+ break;
+ case 13:
+ return &XGI_LVDS1280x1024Des_2x75[tempal];
+ break;
+ case 14:
+ return &XGI_LVDSNoScalingDesDatax75[tempal];
+ break;
+ default:
+ break;
+ }
+ } else if (table == 4) {
+ switch (tempdi[i].DATAPTR) {
+ case 0:
+ return &XGI_ExtLCD1024x768Data[tempal];
+ break;
+ case 1:
+ return &XGI_StLCD1024x768Data[tempal];
+ break;
+ case 2:
+ return &XGI_CetLCD1024x768Data[tempal];
+ break;
+ case 3:
+ return &XGI_ExtLCD1280x1024Data[tempal];
+ break;
+ case 4:
+ return &XGI_StLCD1280x1024Data[tempal];
+ break;
+ case 5:
+ return &XGI_CetLCD1280x1024Data[tempal];
+ break;
+ case 6:
+ return &XGI_ExtLCD1400x1050Data[tempal];
+ break;
+ case 7:
+ return &XGI_StLCD1400x1050Data[tempal];
+ break;
+ case 8:
+ return &XGI_CetLCD1400x1050Data[tempal];
+ break;
+ case 9:
+ return &XGI_ExtLCD1600x1200Data[tempal];
+ break;
+ case 10:
+ return &XGI_StLCD1600x1200Data[tempal];
+ break;
+ case 11:
+ return &XGI_NoScalingData[tempal];
+ break;
+ case 12:
+ return &XGI_ExtLCD1024x768x75Data[tempal];
+ break;
+ case 13:
+ return &XGI_ExtLCD1024x768x75Data[tempal];
+ break;
+ case 14:
+ return &XGI_CetLCD1024x768x75Data[tempal];
+ break;
+ case 15:
+ return &XGI_ExtLCD1280x1024x75Data[tempal];
+ break;
+ case 16:
+ return &XGI_StLCD1280x1024x75Data[tempal];
+ break;
+ case 17:
+ return &XGI_CetLCD1280x1024x75Data[tempal];
+ break;
+ case 18:
+ return &XGI_NoScalingDatax75[tempal];
+ break;
+ default:
+ break;
+ }
+ } else if (table == 5) {
+ switch (tempdi[i].DATAPTR) {
+ case 0:
+ return &XGI_ExtLCDDes1024x768Data[tempal];
+ break;
+ case 1:
+ return &XGI_StLCDDes1024x768Data[tempal];
+ break;
+ case 2:
+ return &XGI_CetLCDDes1024x768Data[tempal];
+ break;
+ case 3:
+ if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
+ & VB_XGI302LV))
+ return &XGI_ExtLCDDLDes1280x1024Data[tempal];
+ else
+ return &XGI_ExtLCDDes1280x1024Data[tempal];
+ break;
+ case 4:
+ if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
+ & VB_XGI302LV))
+ return &XGI_StLCDDLDes1280x1024Data[tempal];
+ else
+ return &XGI_StLCDDes1280x1024Data[tempal];
+ break;
+ case 5:
+ if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
+ & VB_XGI302LV))
+ return &XGI_CetLCDDLDes1280x1024Data[tempal];
+ else
+ return &XGI_CetLCDDes1280x1024Data[tempal];
+ break;
+ case 6:
+ if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
+ & VB_XGI302LV))
+ return &XGI_ExtLCDDLDes1400x1050Data[tempal];
+ else
+ return &XGI_ExtLCDDes1400x1050Data[tempal];
+ break;
+ case 7:
+ if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
+ & VB_XGI302LV))
+ return &XGI_StLCDDLDes1400x1050Data[tempal];
+ else
+ return &XGI_StLCDDes1400x1050Data[tempal];
+ break;
+ case 8:
+ return &XGI_CetLCDDes1400x1050Data[tempal];
+ break;
+ case 9:
+ return &XGI_CetLCDDes1400x1050Data2[tempal];
+ break;
+ case 10:
+ if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
+ & VB_XGI302LV))
+ return &XGI_ExtLCDDLDes1600x1200Data[tempal];
+ else
+ return &XGI_ExtLCDDes1600x1200Data[tempal];
+ break;
+ case 11:
+ if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
+ & VB_XGI302LV))
+ return &XGI_StLCDDLDes1600x1200Data[tempal];
+ else
+ return &XGI_StLCDDes1600x1200Data[tempal];
+ break;
+ case 12:
+ return &XGI_NoScalingDesData[tempal];
+ break;
+ case 13:
+ return &XGI_ExtLCDDes1024x768x75Data[tempal];
+ break;
+ case 14:
+ return &XGI_StLCDDes1024x768x75Data[tempal];
+ break;
+ case 15:
+ return &XGI_CetLCDDes1024x768x75Data[tempal];
+ break;
+ case 16:
+ if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
+ & VB_XGI302LV))
+ return &XGI_ExtLCDDLDes1280x1024x75Data[tempal];
+ else
+ return &XGI_ExtLCDDes1280x1024x75Data[tempal];
+ break;
+ case 17:
+ if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
+ & VB_XGI302LV))
+ return &XGI_StLCDDLDes1280x1024x75Data[tempal];
+ else
+ return &XGI_StLCDDes1280x1024x75Data[tempal];
+ break;
+ case 18:
+ if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
+ & VB_XGI302LV))
+ return &XGI_CetLCDDLDes1280x1024x75Data[tempal];
+ else
+ return &XGI_CetLCDDes1280x1024x75Data[tempal];
+ break;
+ case 19:
+ return &XGI_NoScalingDesDatax75[tempal];
+ break;
+ default:
+ break;
+ }
+ } else if (table == 6) {
+ switch (tempdi[i].DATAPTR) {
+ case 0:
+ return &XGI_CH7017LV1024x768[tempal];
+ break;
+ case 1:
+ return &XGI_CH7017LV1400x1050[tempal];
+ break;
+ default:
+ break;
+ }
+ }
+ return NULL;
+}
+
+static void *XGI_GetTVPtr(unsigned short BX, unsigned short ModeNo,
+ unsigned short ModeIdIndex,
+ unsigned short RefreshRateTableIndex,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short i, tempdx, tempbx, tempal, modeflag, table;
+ struct XGI330_TVDataTablStruct *tempdi = NULL;
+
+ tempbx = BX;
+
+ if (ModeNo <= 0x13) {
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
+ tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ } else {
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ }
+
+ tempal = tempal & 0x3f;
+ table = tempbx;
+
+ switch (tempbx) {
+ case 0:
+ tempdi = NULL; /*EPLCHTVCRT1Ptr_H;*/
+ if (pVBInfo->IF_DEF_CH7007 == 1)
+ tempdi = XGI_EPLCHTVCRT1Ptr;
+
+ break;
+ case 1:
+ tempdi = NULL; /*EPLCHTVCRT1Ptr_V;*/
+ if (pVBInfo->IF_DEF_CH7007 == 1)
+ tempdi = XGI_EPLCHTVCRT1Ptr;
+
+ break;
+ case 2:
+ tempdi = XGI_EPLCHTVDataPtr;
+ break;
+ case 3:
+ tempdi = NULL;
+ break;
+ case 4:
+ tempdi = XGI_TVDataTable;
+ break;
+ case 5:
+ tempdi = NULL;
+ break;
+ case 6:
+ tempdi = XGI_EPLCHTVRegPtr;
+ break;
+ default:
+ break;
+ }
+
+ if (tempdi == NULL) /* OEMUtil */
+ return NULL;
+
+ tempdx = pVBInfo->TVInfo;
+
+ if (pVBInfo->VBInfo & SetInSlaveMode)
+ tempdx = tempdx | SetTVLockMode;
+
+ if (modeflag & HalfDCLK)
+ tempdx = tempdx | SetTVLowResolution;
+
+ i = 0;
+
+ while (tempdi[i].MASK != 0xffff) {
+ if ((tempdx & tempdi[i].MASK) == tempdi[i].CAP)
+ break;
+ i++;
+ }
+
+ if (table == 0x00) { /* 07/05/22 */
+ } else if (table == 0x01) {
+ } else if (table == 0x04) {
+ switch (tempdi[i].DATAPTR) {
+ case 0:
+ return &XGI_ExtPALData[tempal];
+ break;
+ case 1:
+ return &XGI_ExtNTSCData[tempal];
+ break;
+ case 2:
+ return &XGI_StPALData[tempal];
+ break;
+ case 3:
+ return &XGI_StNTSCData[tempal];
+ break;
+ case 4:
+ return &XGI_ExtHiTVData[tempal];
+ break;
+ case 5:
+ return &XGI_St2HiTVData[tempal];
+ break;
+ case 6:
+ return &XGI_ExtYPbPr525iData[tempal];
+ break;
+ case 7:
+ return &XGI_ExtYPbPr525pData[tempal];
+ break;
+ case 8:
+ return &XGI_ExtYPbPr750pData[tempal];
+ break;
+ case 9:
+ return &XGI_StYPbPr525iData[tempal];
+ break;
+ case 10:
+ return &XGI_StYPbPr525pData[tempal];
+ break;
+ case 11:
+ return &XGI_StYPbPr750pData[tempal];
+ break;
+ case 12: /* avoid system hang */
+ return &XGI_ExtNTSCData[tempal];
+ break;
+ case 13:
+ return &XGI_St1HiTVData[tempal];
+ break;
+ default:
+ break;
+ }
+ } else if (table == 0x02) {
+ switch (tempdi[i].DATAPTR) {
+ case 0:
+ return &XGI_CHTVUNTSCData[tempal];
+ break;
+ case 1:
+ return &XGI_CHTVONTSCData[tempal];
+ break;
+ case 2:
+ return &XGI_CHTVUPALData[tempal];
+ break;
+ case 3:
+ return &XGI_CHTVOPALData[tempal];
+ break;
+ default:
+ break;
+ }
+ } else if (table == 0x06) {
+ }
+ return NULL;
+}
+
+static void XGI_GetLVDSData(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
{
@@ -2392,7 +2549,7 @@ void XGI_GetLVDSData(unsigned short ModeNo, unsigned short ModeIdIndex,
}
}
-void XGI_ModCRT1Regs(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_ModCRT1Regs(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
@@ -2453,9 +2610,9 @@ void XGI_ModCRT1Regs(unsigned short ModeNo, unsigned short ModeIdIndex,
XGI_SetCRT1Timing_H(pVBInfo, HwDeviceExtension);
if (pVBInfo->IF_DEF_CH7007 == 1) {
- XGINew_SetReg1(pVBInfo->P3c4, 0x2E,
+ xgifb_reg_set(pVBInfo->P3c4, 0x2E,
CH7007TV_TimingHPtr[0].data[8]);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2F,
+ xgifb_reg_set(pVBInfo->P3c4, 0x2F,
CH7007TV_TimingHPtr[0].data[9]);
}
@@ -2496,18 +2653,89 @@ void XGI_ModCRT1Regs(unsigned short ModeNo, unsigned short ModeIdIndex,
XGI_SetCRT1Timing_V(ModeIdIndex, ModeNo, pVBInfo);
if (pVBInfo->IF_DEF_CH7007 == 1) {
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x33, ~0x01,
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x33, ~0x01,
CH7007TV_TimingVPtr[0].data[7] & 0x01);
- XGINew_SetReg1(pVBInfo->P3c4, 0x34,
+ xgifb_reg_set(pVBInfo->P3c4, 0x34,
CH7007TV_TimingVPtr[0].data[8]);
- XGINew_SetReg1(pVBInfo->P3c4, 0x3F,
+ xgifb_reg_set(pVBInfo->P3c4, 0x3F,
CH7007TV_TimingVPtr[0].data[9]);
}
}
}
-void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
+static unsigned short XGI_GetLCDCapPtr(struct vb_device_info *pVBInfo)
+{
+ unsigned char tempal, tempah, tempbl, i;
+
+ tempah = xgifb_reg_get(pVBInfo->P3d4, 0x36);
+ tempal = tempah & 0x0F;
+ tempah = tempah & 0xF0;
+ i = 0;
+ tempbl = pVBInfo->LCDCapList[i].LCD_ID;
+
+ while (tempbl != 0xFF) {
+ if (tempbl & 0x80) { /* OEMUtil */
+ tempal = tempah;
+ tempbl = tempbl & ~(0x80);
+ }
+
+ if (tempal == tempbl)
+ break;
+
+ i++;
+
+ tempbl = pVBInfo->LCDCapList[i].LCD_ID;
+ }
+
+ return i;
+}
+
+static unsigned short XGI_GetLCDCapPtr1(struct vb_device_info *pVBInfo)
+{
+ unsigned short tempah, tempal, tempbl, i;
+
+ tempal = pVBInfo->LCDResInfo;
+ tempah = pVBInfo->LCDTypeInfo;
+
+ i = 0;
+ tempbl = pVBInfo->LCDCapList[i].LCD_ID;
+
+ while (tempbl != 0xFF) {
+ if ((tempbl & 0x80) && (tempbl != 0x80)) {
+ tempal = tempah;
+ tempbl &= ~0x80;
+ }
+
+ if (tempal == tempbl)
+ break;
+
+ i++;
+ tempbl = pVBInfo->LCDCapList[i].LCD_ID;
+ }
+
+ if (tempbl == 0xFF) {
+ pVBInfo->LCDResInfo = Panel1024x768;
+ pVBInfo->LCDTypeInfo = 0;
+ i = 0;
+ }
+
+ return i;
+}
+
+static void XGI_GetLCDSync(unsigned short *HSyncWidth, unsigned short *VSyncWidth,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short Index;
+
+ Index = XGI_GetLCDCapPtr(pVBInfo);
+ *HSyncWidth = pVBInfo->LCDCapList[Index].LCD_HSyncWidth;
+ *VSyncWidth = pVBInfo->LCDCapList[Index].LCD_VSyncWidth;
+
+ return;
+}
+
+static void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
{
@@ -2605,14 +2833,14 @@ void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
if (tempcx >= tempax)
tempcx -= tempax;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x1A, tempbx & 0x07);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x1A, tempbx & 0x07);
tempcx = tempcx >> 3;
tempbx = tempbx >> 3;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x16,
+ xgifb_reg_set(pVBInfo->Part1Port, 0x16,
(unsigned short) (tempbx & 0xff));
- XGINew_SetReg1(pVBInfo->Part1Port, 0x17,
+ xgifb_reg_set(pVBInfo->Part1Port, 0x17,
(unsigned short) (tempcx & 0xff));
tempax = pVBInfo->HT;
@@ -2640,8 +2868,8 @@ void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
tempcx &= 0x1f;
tempax |= tempcx;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x15, tempax);
- XGINew_SetReg1(pVBInfo->Part1Port, 0x14,
+ xgifb_reg_set(pVBInfo->Part1Port, 0x15, tempax);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x14,
(unsigned short) (tempbx & 0xff));
tempax = pVBInfo->VT;
@@ -2656,15 +2884,15 @@ void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
if (tempcx >= tempax)
tempcx -= tempax;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x1b,
+ xgifb_reg_set(pVBInfo->Part1Port, 0x1b,
(unsigned short) (tempbx & 0xff));
- XGINew_SetReg1(pVBInfo->Part1Port, 0x1c,
+ xgifb_reg_set(pVBInfo->Part1Port, 0x1c,
(unsigned short) (tempcx & 0xff));
tempbx = (tempbx >> 8) & 0x07;
tempcx = (tempcx >> 8) & 0x07;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x1d,
+ xgifb_reg_set(pVBInfo->Part1Port, 0x1d,
(unsigned short) ((tempcx << 3)
| tempbx));
@@ -2684,9 +2912,9 @@ void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
if (tempcx >= tempax)
tempcx -= tempax;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x18,
+ xgifb_reg_set(pVBInfo->Part1Port, 0x18,
(unsigned short) (tempbx & 0xff));
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, ~0x0f,
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x19, ~0x0f,
(unsigned short) (tempcx & 0x0f));
tempax = ((tempbx >> 8) & 0x07) << 3;
@@ -2698,7 +2926,7 @@ void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
if (pVBInfo->LCDInfo & EnableLVDSDDA)
tempax |= 0x40;
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x1a, 0x07,
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x1a, 0x07,
tempax);
tempcx = pVBInfo->VGAVT;
@@ -2717,9 +2945,9 @@ void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
temp2 = temp1;
push3 = temp2;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x37,
+ xgifb_reg_set(pVBInfo->Part1Port, 0x37,
(unsigned short) (temp2 & 0xff));
- XGINew_SetReg1(pVBInfo->Part1Port, 0x36,
+ xgifb_reg_set(pVBInfo->Part1Port, 0x36,
(unsigned short) ((temp2 >> 8) & 0xff));
tempbx = (unsigned short) (temp2 >> 16);
@@ -2729,27 +2957,27 @@ void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
if (tempbx == pVBInfo->VDE)
tempax |= 0x04;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x35, tempax);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x35, tempax);
if (pVBInfo->VBType & VB_XGI301C) {
temp2 = push3;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x3c,
+ xgifb_reg_set(pVBInfo->Part4Port, 0x3c,
(unsigned short) (temp2 & 0xff));
- XGINew_SetReg1(pVBInfo->Part4Port, 0x3b,
+ xgifb_reg_set(pVBInfo->Part4Port, 0x3b,
(unsigned short) ((temp2 >> 8)
& 0xff));
tempbx = (unsigned short) (temp2 >> 16);
- XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x3a,
+ xgifb_reg_and_or(pVBInfo->Part4Port, 0x3a,
~0xc0,
(unsigned short) ((tempbx
& 0xff) << 6));
tempcx = pVBInfo->VGAVDE;
if (tempcx == pVBInfo->VDE)
- XGINew_SetRegANDOR(pVBInfo->Part4Port,
+ xgifb_reg_and_or(pVBInfo->Part4Port,
0x30, ~0x0c, 0x00);
else
- XGINew_SetRegANDOR(pVBInfo->Part4Port,
+ xgifb_reg_and_or(pVBInfo->Part4Port,
0x30, ~0x0c, 0x08);
}
@@ -2773,7 +3001,7 @@ void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
temp3 = (temp3 & 0xffff0000) + (temp1 & 0xffff);
tempax = (unsigned short) (temp3 & 0xff);
- XGINew_SetReg1(pVBInfo->Part1Port, 0x1f, tempax);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x1f, tempax);
temp1 = pVBInfo->VGAVDE << 18;
temp1 = temp1 / push3;
@@ -2784,9 +3012,9 @@ void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
tempax = ((tempbx >> 8) & 0xff) << 3;
tempax |= (unsigned short) ((temp3 >> 8) & 0x07);
- XGINew_SetReg1(pVBInfo->Part1Port, 0x20,
+ xgifb_reg_set(pVBInfo->Part1Port, 0x20,
(unsigned short) (tempax & 0xff));
- XGINew_SetReg1(pVBInfo->Part1Port, 0x21,
+ xgifb_reg_set(pVBInfo->Part1Port, 0x21,
(unsigned short) (tempbx & 0xff));
temp3 = temp3 >> 16;
@@ -2794,15 +3022,223 @@ void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
if (modeflag & HalfDCLK)
temp3 = temp3 >> 1;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x22,
+ xgifb_reg_set(pVBInfo->Part1Port, 0x22,
(unsigned short) ((temp3 >> 8) & 0xff));
- XGINew_SetReg1(pVBInfo->Part1Port, 0x23,
+ xgifb_reg_set(pVBInfo->Part1Port, 0x23,
(unsigned short) (temp3 & 0xff));
}
}
}
-void XGI_SetCRT2ECLK(unsigned short ModeNo, unsigned short ModeIdIndex,
+/* --------------------------------------------------------------------- */
+/* Function : XGI_GETLCDVCLKPtr */
+/* Input : */
+/* Output : al -> VCLK Index */
+/* Description : */
+/* --------------------------------------------------------------------- */
+static void XGI_GetLCDVCLKPtr(unsigned char *di_0, unsigned char *di_1,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short index;
+
+ if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
+ if (pVBInfo->IF_DEF_ScaleLCD == 1) {
+ if (pVBInfo->LCDInfo & EnableScalingLCD)
+ return;
+ }
+
+ /* index = XGI_GetLCDCapPtr(pVBInfo); */
+ index = XGI_GetLCDCapPtr1(pVBInfo);
+
+ if (pVBInfo->VBInfo & SetCRT2ToLCD) { /* LCDB */
+ *di_0 = pVBInfo->LCDCapList[index].LCUCHAR_VCLKData1;
+ *di_1 = pVBInfo->LCDCapList[index].LCUCHAR_VCLKData2;
+ } else { /* LCDA */
+ *di_0 = pVBInfo->LCDCapList[index].LCDA_VCLKData1;
+ *di_1 = pVBInfo->LCDCapList[index].LCDA_VCLKData2;
+ }
+ }
+ return;
+}
+
+static unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex,
+ unsigned short ModeNo, unsigned short ModeIdIndex,
+ struct vb_device_info *pVBInfo)
+{
+
+ unsigned short index, modeflag;
+ unsigned short tempbx;
+ unsigned char tempal;
+ unsigned char *CHTVVCLKPtr = NULL;
+
+ if (ModeNo <= 0x13)
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */
+ else
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */
+
+ if ((pVBInfo->SetFlag & ProgrammingCRT2) && (!(pVBInfo->LCDInfo
+ & EnableScalingLCD))) { /* {LCDA/LCDB} */
+ index = XGI_GetLCDCapPtr(pVBInfo);
+ tempal = pVBInfo->LCDCapList[index].LCD_VCLK;
+
+ if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA))
+ return tempal;
+
+ /* {TV} */
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C)) {
+ if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) {
+ tempal = HiTVVCLKDIV2;
+ if (!(pVBInfo->TVInfo & RPLLDIV2XO))
+ tempal = HiTVVCLK;
+ if (pVBInfo->TVInfo & TVSimuMode) {
+ tempal = HiTVSimuVCLK;
+ if (!(modeflag & Charx8Dot))
+ tempal = HiTVTextVCLK;
+
+ }
+ return tempal;
+ }
+
+ if (pVBInfo->TVInfo & SetYPbPrMode750p) {
+ tempal = YPbPr750pVCLK;
+ return tempal;
+ }
+
+ if (pVBInfo->TVInfo & SetYPbPrMode525p) {
+ tempal = YPbPr525pVCLK;
+ return tempal;
+ }
+
+ tempal = NTSC1024VCLK;
+
+ if (!(pVBInfo->TVInfo & NTSC1024x768)) {
+ tempal = TVVCLKDIV2;
+ if (!(pVBInfo->TVInfo & RPLLDIV2XO))
+ tempal = TVVCLK;
+ }
+
+ if (pVBInfo->VBInfo & SetCRT2ToTV)
+ return tempal;
+ }
+ /* else if ((pVBInfo->IF_DEF_CH7017==1)&&(pVBInfo->VBType&VB_CH7017)) {
+ if (ModeNo<=0x13)
+ *tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ else
+ *tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ *tempal = *tempal & 0x1F;
+ tempbx = 0;
+ if (pVBInfo->TVInfo & SetPALTV)
+ tempbx = tempbx + 2;
+ if (pVBInfo->TVInfo & SetCHTVOverScan)
+ tempbx++;
+ tempbx = tempbx << 1;
+ } */
+ } /* {End of VB} */
+
+ if ((pVBInfo->IF_DEF_CH7007 == 1) && (pVBInfo->VBType & VB_CH7007)) { /* [Billy] 07/05/08 CH7007 */
+ /* VideoDebugPrint((0, "XGI_GetVCLKPtr: pVBInfo->IF_DEF_CH7007==1\n")); */
+ if ((pVBInfo->VBInfo & SetCRT2ToTV)) {
+ if (ModeNo <= 0x13) {
+ tempal
+ = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ } else {
+ tempal
+ = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ }
+
+ tempal = tempal & 0x0F;
+ tempbx = 0;
+
+ if (pVBInfo->TVInfo & SetPALTV)
+ tempbx = tempbx + 2;
+
+ if (pVBInfo->TVInfo & SetCHTVOverScan)
+ tempbx++;
+
+ /** tempbx = tempbx << 1; CH7007 ? **/
+
+ /* [Billy]07/05/29 CH7007 */
+ if (pVBInfo->IF_DEF_CH7007 == 1) {
+ switch (tempbx) {
+ case 0:
+ CHTVVCLKPtr = XGI7007_CHTVVCLKUNTSC;
+ break;
+ case 1:
+ CHTVVCLKPtr = XGI7007_CHTVVCLKONTSC;
+ break;
+ case 2:
+ CHTVVCLKPtr = XGI7007_CHTVVCLKUPAL;
+ break;
+ case 3:
+ CHTVVCLKPtr = XGI7007_CHTVVCLKOPAL;
+ break;
+ default:
+ break;
+
+ }
+ }
+ /* else {
+ switch(tempbx) {
+ case 0:
+ CHTVVCLKPtr = pVBInfo->CHTVVCLKUNTSC;
+ break;
+ case 1:
+ CHTVVCLKPtr = pVBInfo->CHTVVCLKONTSC;
+ break;
+ case 2:
+ CHTVVCLKPtr = pVBInfo->CHTVVCLKUPAL;
+ break;
+ case 3:
+ CHTVVCLKPtr = pVBInfo->CHTVVCLKOPAL;
+ break;
+ default:
+ break;
+ }
+ }
+ */
+
+ tempal = CHTVVCLKPtr[tempal];
+ return tempal;
+ }
+
+ }
+
+ tempal = (unsigned char) inb((pVBInfo->P3ca + 0x02));
+ tempal = tempal >> 2;
+ tempal &= 0x03;
+
+ if ((pVBInfo->LCDInfo & EnableScalingLCD) && (modeflag & Charx8Dot)) /* for Dot8 Scaling LCD */
+ tempal = tempal ^ tempal; /* ; set to VCLK25MHz always */
+
+ if (ModeNo <= 0x13)
+ return tempal;
+
+ tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
+ return tempal;
+}
+
+static void XGI_GetVCLKLen(unsigned char tempal, unsigned char *di_0,
+ unsigned char *di_1, struct vb_device_info *pVBInfo)
+{
+ if (pVBInfo->IF_DEF_CH7007 == 1) { /* [Billy] 2007/05/16 */
+ /* VideoDebugPrint((0, "XGI_GetVCLKLen: pVBInfo->IF_DEF_CH7007==1\n")); */
+ *di_0 = (unsigned char) XGI_CH7007VCLKData[tempal].SR2B;
+ *di_1 = (unsigned char) XGI_CH7007VCLKData[tempal].SR2C;
+ } else if (pVBInfo->VBType & (VB_XGI301 | VB_XGI301B | VB_XGI302B
+ | VB_XGI301LV | VB_XGI302LV | VB_XGI301C)) {
+ if ((!(pVBInfo->VBInfo & SetCRT2ToLCDA)) && (pVBInfo->SetFlag
+ & ProgrammingCRT2)) {
+ *di_0 = (unsigned char) XGI_VBVCLKData[tempal].SR2B;
+ *di_1 = XGI_VBVCLKData[tempal].SR2C;
+ }
+ } else {
+ *di_0 = XGI_VCLKData[tempal].SR2B;
+ *di_1 = XGI_VCLKData[tempal].SR2C;
+ }
+}
+
+static void XGI_SetCRT2ECLK(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
{
@@ -2815,23 +3251,23 @@ void XGI_SetCRT2ECLK(unsigned short ModeNo, unsigned short ModeIdIndex,
XGI_GetLCDVCLKPtr(&di_0, &di_1, pVBInfo);
for (i = 0; i < 4; i++) {
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x31, ~0x30,
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x31, ~0x30,
(unsigned short) (0x10 * i));
if (pVBInfo->IF_DEF_CH7007 == 1) {
- XGINew_SetReg1(pVBInfo->P3c4, 0x2b, di_0);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2c, di_1);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2b, di_0);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2c, di_1);
} else if ((!(pVBInfo->VBInfo & SetCRT2ToLCDA))
&& (!(pVBInfo->VBInfo & SetInSlaveMode))) {
- XGINew_SetReg1(pVBInfo->P3c4, 0x2e, di_0);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2f, di_1);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2e, di_0);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2f, di_1);
} else {
- XGINew_SetReg1(pVBInfo->P3c4, 0x2b, di_0);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2c, di_1);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2b, di_0);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2c, di_1);
}
}
}
-void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension,
+static void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
unsigned short tempcl, tempch, temp, tempbl, tempax;
@@ -2840,30 +3276,22 @@ void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension,
| VB_XGI302LV | VB_XGI301C)) {
tempcl = 0;
tempch = 0;
- temp = XGINew_GetReg1(pVBInfo->P3c4, 0x01);
+ temp = xgifb_reg_get(pVBInfo->P3c4, 0x01);
if (!(temp & 0x20)) {
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x17);
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x17);
if (temp & 0x80) {
- if ((HwDeviceExtension->jChipType >= XG20)
- || (HwDeviceExtension->jChipType
- >= XG40))
- temp = XGINew_GetReg1(pVBInfo->P3d4,
- 0x53);
- else
- temp = XGINew_GetReg1(pVBInfo->P3d4,
- 0x63);
-
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x53);
if (!(temp & 0x40))
tempcl |= ActiveCRT1;
}
}
- temp = XGINew_GetReg1(pVBInfo->Part1Port, 0x2e);
+ temp = xgifb_reg_get(pVBInfo->Part1Port, 0x2e);
temp &= 0x0f;
if (!(temp == 0x08)) {
- tempax = XGINew_GetReg1(pVBInfo->Part1Port, 0x13); /* Check ChannelA by Part1_13 [2003/10/03] */
+ tempax = xgifb_reg_get(pVBInfo->Part1Port, 0x13); /* Check ChannelA by Part1_13 [2003/10/03] */
if (tempax & 0x04)
tempcl = tempcl | ActiveLCD;
@@ -2877,7 +3305,7 @@ void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension,
tempcl |= ActiveLCD;
if (temp == 0x05) {
- temp = XGINew_GetReg1(pVBInfo->Part2Port, 0x00);
+ temp = xgifb_reg_get(pVBInfo->Part2Port, 0x00);
if (!(temp & 0x08))
tempch |= ActiveAVideo;
@@ -2894,7 +3322,7 @@ void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension,
}
if (pVBInfo->VBInfo & SetCRT2ToYPbPr) {
- temp = XGINew_GetReg1(
+ temp = xgifb_reg_get(
pVBInfo->Part2Port,
0x4d);
@@ -2907,7 +3335,7 @@ void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension,
}
}
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x3d);
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x3d);
if (tempcl & ActiveLCD) {
if ((pVBInfo->SetFlag & ReserveTVOption)) {
if (temp & ActiveTV)
@@ -2916,10 +3344,10 @@ void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension,
}
temp = tempcl;
tempbl = ~ModeSwitchStatus;
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x3d, tempbl, temp);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x3d, tempbl, temp);
if (!(pVBInfo->SetFlag & ReserveTVOption))
- XGINew_SetReg1(pVBInfo->P3d4, 0x3e, tempch);
+ xgifb_reg_set(pVBInfo->P3d4, 0x3e, tempch);
} else {
return;
}
@@ -2931,7 +3359,7 @@ void XGI_GetVGAType(struct xgi_hw_device_info *HwDeviceExtension,
/*
if ( HwDeviceExtension->jChipType >= XG20 ) {
pVBInfo->Set_VGAType = XG20;
- } else if (HwDeviceExtension->jChipType >= XG40) {
+ } else {
pVBInfo->Set_VGAType = VGA_XGI340;
}
*/
@@ -2948,10 +3376,10 @@ void XGI_GetVBType(struct vb_device_info *pVBInfo)
}
if (pVBInfo->IF_DEF_LVDS == 0) {
tempbx = VB_XGI302B;
- flag = XGINew_GetReg1(pVBInfo->Part4Port, 0x00);
+ flag = xgifb_reg_get(pVBInfo->Part4Port, 0x00);
if (flag != 0x02) {
tempbx = VB_XGI301;
- flag = XGINew_GetReg1(pVBInfo->Part4Port, 0x01);
+ flag = xgifb_reg_get(pVBInfo->Part4Port, 0x01);
if (flag >= 0xB0) {
tempbx = VB_XGI301B;
if (flag >= 0xC0) {
@@ -2961,7 +3389,7 @@ void XGI_GetVBType(struct vb_device_info *pVBInfo)
if (flag >= 0xE0) {
tempbx = VB_XGI302LV;
tempah
- = XGINew_GetReg1(
+ = xgifb_reg_get(
pVBInfo->Part4Port,
0x39);
if (tempah != 0xFF)
@@ -2972,7 +3400,7 @@ void XGI_GetVBType(struct vb_device_info *pVBInfo)
}
if (tempbx & (VB_XGI301B | VB_XGI302B)) {
- flag = XGINew_GetReg1(
+ flag = xgifb_reg_get(
pVBInfo->Part4Port,
0x23);
@@ -3008,9 +3436,9 @@ void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
tempbx = 0;
if (pVBInfo->VBType & 0xFFFF) {
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x30); /* Check Display Device */
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x30); /* Check Display Device */
tempbx = tempbx | temp;
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x31);
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x31);
push = temp;
push = push << 8;
tempax = temp << 8;
@@ -3020,7 +3448,7 @@ void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
temp = 0xFFFF ^ temp;
tempbx &= temp;
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x38);
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x38);
if (pVBInfo->IF_DEF_LCDA == 1) {
@@ -3069,7 +3497,7 @@ void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
& VB_CH7007))) { /* [Billy] 07/05/04 */
if (temp & SetYPbPr) { /* temp = CR38 */
if (pVBInfo->IF_DEF_HiVision == 1) {
- temp = XGINew_GetReg1(
+ temp = xgifb_reg_get(
pVBInfo->P3d4,
0x35); /* shampoo add for new scratch */
temp &= YPbPrMode;
@@ -3257,7 +3685,7 @@ void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
}
if (pVBInfo->VBInfo & SetCRT2ToTV) {
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x35);
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x35);
tempbx = temp;
if (tempbx & SetPALTV) {
tempbx &= (SetCHTVOverScan | SetPALMTV
@@ -3269,7 +3697,7 @@ void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
| SetPALTV);
/*
if (pVBInfo->IF_DEF_LVDS == 0) {
- index1 = XGINew_GetReg1(pVBInfo->P3d4, 0x38); //PAL-M/PAL-N Info
+ index1 = xgifb_reg_get(pVBInfo->P3d4, 0x38); //PAL-M/PAL-N Info
temp2 = (index1 & 0xC0) >> 5; //00:PAL, 01:PAL-M, 10:PAL-N
tempbx |= temp2;
if (temp2 & 0x02) //PAL-M
@@ -3279,14 +3707,14 @@ void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
}
if (pVBInfo->IF_DEF_CH7017 == 1) {
- tempbx = XGINew_GetReg1(pVBInfo->P3d4, 0x35);
+ tempbx = xgifb_reg_get(pVBInfo->P3d4, 0x35);
if (tempbx & TVOverScan)
tempbx |= SetCHTVOverScan;
}
if (pVBInfo->IF_DEF_CH7007 == 1) { /* [Billy] 07/05/04 */
- tempbx = XGINew_GetReg1(pVBInfo->P3d4, 0x35);
+ tempbx = xgifb_reg_get(pVBInfo->P3d4, 0x35);
if (tempbx & TVOverScan)
tempbx |= SetCHTVOverScan;
@@ -3299,7 +3727,7 @@ void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
if (pVBInfo->IF_DEF_YPbPr == 1) {
if (pVBInfo->VBInfo & SetCRT2ToYPbPr) {
- index1 = XGINew_GetReg1(pVBInfo->P3d4, 0x35);
+ index1 = xgifb_reg_get(pVBInfo->P3d4, 0x35);
index1 &= YPbPrMode;
if (index1 == YPbPrMode525i)
@@ -3363,7 +3791,7 @@ unsigned char XGI_GetLCDInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; /* si+Ext_ResInfo // */
}
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x36); /* Get LCD Res.Info */
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x36); /* Get LCD Res.Info */
tempbx = temp & 0x0F;
if (tempbx == 0)
@@ -3372,7 +3800,7 @@ unsigned char XGI_GetLCDInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
/* LCD75 [2003/8/22] Vicent */
if ((tempbx == Panel1024x768) || (tempbx == Panel1280x1024)) {
if (pVBInfo->VBInfo & DriverMode) {
- tempax = XGINew_GetReg1(pVBInfo->P3d4, 0x33);
+ tempax = xgifb_reg_get(pVBInfo->P3d4, 0x33);
if (pVBInfo->VBInfo & SetCRT2ToLCDA)
tempax &= 0x0F;
else
@@ -3400,7 +3828,7 @@ unsigned char XGI_GetLCDInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
tempbx = 0;
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x37);
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x37);
temp &= (ScalingLCD | LCDNonExpanding | LCDSyncBit | SetPWDEnable);
@@ -3570,7 +3998,7 @@ static unsigned char XGINew_CheckMemorySize(
memorysize = memorysize > MemorySizeShift;
memorysize++; /* Get memory size */
- temp = XGINew_GetReg1(pVBInfo->P3c4, 0x14); /* Get DRAM Size */
+ temp = xgifb_reg_get(pVBInfo->P3c4, 0x14); /* Get DRAM Size */
tmp = temp;
if (HwDeviceExtension->jChipType == XG40) {
@@ -3610,29 +4038,87 @@ void XGINew_IsLowResolution(unsigned short ModeNo, unsigned short ModeIdIndex, u
unsigned short data ;
unsigned short ModeFlag ;
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x0F);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x0F);
data &= 0x7F;
- XGINew_SetReg1(pVBInfo->P3c4, 0x0F, data);
+ xgifb_reg_set(pVBInfo->P3c4, 0x0F, data);
if (ModeNo > 0x13) {
ModeFlag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
if ((ModeFlag & HalfDCLK) && (ModeFlag & DoubleScanMode)) {
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x0F);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x0F);
data |= 0x80;
- XGINew_SetReg1(pVBInfo->P3c4, 0x0F, data);
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x01);
+ xgifb_reg_set(pVBInfo->P3c4, 0x0F, data);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x01);
data &= 0xF7;
- XGINew_SetReg1(pVBInfo->P3c4, 0x01, data);
+ xgifb_reg_set(pVBInfo->P3c4, 0x01, data);
}
}
}
*/
+static unsigned char XG21GPIODataTransfer(unsigned char ujDate)
+{
+ unsigned char ujRet = 0;
+ unsigned char i = 0;
+
+ for (i = 0; i < 8; i++) {
+ ujRet = ujRet << 1;
+ /* ujRet |= GETBITS(ujDate >> i, 0:0); */
+ ujRet |= (ujDate >> i) & 1;
+ }
+
+ return ujRet;
+}
+
+/*----------------------------------------------------------------------------*/
+/* output */
+/* bl[5] : LVDS signal */
+/* bl[1] : LVDS backlight */
+/* bl[0] : LVDS VDD */
+/*----------------------------------------------------------------------------*/
+static unsigned char XGI_XG21GetPSCValue(struct vb_device_info *pVBInfo)
+{
+ unsigned char CR4A, temp;
+
+ CR4A = xgifb_reg_get(pVBInfo->P3d4, 0x4A);
+ xgifb_reg_and(pVBInfo->P3d4, 0x4A, ~0x23); /* enable GPIO write */
+
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x48);
+
+ temp = XG21GPIODataTransfer(temp);
+ temp &= 0x23;
+ xgifb_reg_set(pVBInfo->P3d4, 0x4A, CR4A);
+ return temp;
+}
+
+/*----------------------------------------------------------------------------*/
+/* output */
+/* bl[5] : LVDS signal */
+/* bl[1] : LVDS backlight */
+/* bl[0] : LVDS VDD */
+/*----------------------------------------------------------------------------*/
+static unsigned char XGI_XG27GetPSCValue(struct vb_device_info *pVBInfo)
+{
+ unsigned char CR4A, CRB4, temp;
+
+ CR4A = xgifb_reg_get(pVBInfo->P3d4, 0x4A);
+ xgifb_reg_and(pVBInfo->P3d4, 0x4A, ~0x0C); /* enable GPIO write */
+
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x48);
+
+ temp &= 0x0C;
+ temp >>= 2;
+ xgifb_reg_set(pVBInfo->P3d4, 0x4A, CR4A);
+ CRB4 = xgifb_reg_get(pVBInfo->P3d4, 0xB4);
+ temp |= ((CRB4 & 0x04) << 3);
+ return temp;
+}
+
void XGI_DisplayOn(struct xgi_hw_device_info *pXGIHWDE,
struct vb_device_info *pVBInfo)
{
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x01, 0xDF, 0x00);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x01, 0xDF, 0x00);
if (pXGIHWDE->jChipType == XG21) {
if (pVBInfo->IF_DEF_LVDS == 1) {
if (!(XGI_XG21GetPSCValue(pVBInfo) & 0x1)) {
@@ -3699,184 +4185,43 @@ void XGI_DisplayOff(struct xgi_hw_device_info *pXGIHWDE,
XGI_XG27BLSignalVDD(0x20, 0x00, pVBInfo); /* DVO/DVI signal off */
}
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x01, 0xDF, 0x20);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x01, 0xDF, 0x20);
}
-void XGI_WaitDisply(struct vb_device_info *pVBInfo)
+static void XGI_WaitDisply(struct vb_device_info *pVBInfo)
{
- while ((XGINew_GetReg2(pVBInfo->P3da) & 0x01))
+ while ((inb(pVBInfo->P3da) & 0x01))
break;
- while (!(XGINew_GetReg2(pVBInfo->P3da) & 0x01))
+ while (!(inb(pVBInfo->P3da) & 0x01))
break;
}
-void XGI_SenseCRT1(struct vb_device_info *pVBInfo)
-{
- unsigned char CRTCData[17] = { 0x5F, 0x4F, 0x50, 0x82, 0x55, 0x81,
- 0x0B, 0x3E, 0xE9, 0x0B, 0xDF, 0xE7, 0x04, 0x00, 0x00,
- 0x05, 0x00 };
-
- unsigned char SR01 = 0, SR1F = 0, SR07 = 0, SR06 = 0;
-
- unsigned char CR17, CR63, SR31;
- unsigned short temp;
- unsigned char DAC_TEST_PARMS[3] = { 0x0F, 0x0F, 0x0F };
-
- int i;
- XGINew_SetReg1(pVBInfo->P3c4, 0x05, 0x86);
-
- /* [2004/05/06] Vicent to fix XG42 single LCD sense to CRT+LCD */
- XGINew_SetReg1(pVBInfo->P3d4, 0x57, 0x4A);
- XGINew_SetReg1(pVBInfo->P3d4, 0x53, (unsigned char) (XGINew_GetReg1(
- pVBInfo->P3d4, 0x53) | 0x02));
-
- SR31 = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x31);
- CR63 = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x63);
- SR01 = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x01);
-
- XGINew_SetReg1(pVBInfo->P3c4, 0x01, (unsigned char) (SR01 & 0xDF));
- XGINew_SetReg1(pVBInfo->P3d4, 0x63, (unsigned char) (CR63 & 0xBF));
-
- CR17 = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x17);
- XGINew_SetReg1(pVBInfo->P3d4, 0x17, (unsigned char) (CR17 | 0x80));
-
- SR1F = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x1F);
- XGINew_SetReg1(pVBInfo->P3c4, 0x1F, (unsigned char) (SR1F | 0x04));
-
- SR07 = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x07);
- XGINew_SetReg1(pVBInfo->P3c4, 0x07, (unsigned char) (SR07 & 0xFB));
- SR06 = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x06);
- XGINew_SetReg1(pVBInfo->P3c4, 0x06, (unsigned char) (SR06 & 0xC3));
-
- XGINew_SetReg1(pVBInfo->P3d4, 0x11, 0x00);
-
- for (i = 0; i < 8; i++)
- XGINew_SetReg1(pVBInfo->P3d4, (unsigned short) i, CRTCData[i]);
-
- for (i = 8; i < 11; i++)
- XGINew_SetReg1(pVBInfo->P3d4, (unsigned short) (i + 8),
- CRTCData[i]);
-
- for (i = 11; i < 13; i++)
- XGINew_SetReg1(pVBInfo->P3d4, (unsigned short) (i + 4),
- CRTCData[i]);
-
- for (i = 13; i < 16; i++)
- XGINew_SetReg1(pVBInfo->P3c4, (unsigned short) (i - 3),
- CRTCData[i]);
-
- XGINew_SetReg1(pVBInfo->P3c4, 0x0E, (unsigned char) (CRTCData[16]
- & 0xE0));
-
- XGINew_SetReg1(pVBInfo->P3c4, 0x31, 0x00);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2B, 0x1B);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2C, 0xE1);
-
- XGINew_SetReg3(pVBInfo->P3c8, 0x00);
-
- for (i = 0; i < 256; i++) {
- XGINew_SetReg3((pVBInfo->P3c8 + 1),
- (unsigned char) DAC_TEST_PARMS[0]);
- XGINew_SetReg3((pVBInfo->P3c8 + 1),
- (unsigned char) DAC_TEST_PARMS[1]);
- XGINew_SetReg3((pVBInfo->P3c8 + 1),
- (unsigned char) DAC_TEST_PARMS[2]);
- }
-
- XGI_VBLongWait(pVBInfo);
- XGI_VBLongWait(pVBInfo);
- XGI_VBLongWait(pVBInfo);
-
- XGINew_LCD_Wait_Time(0x01, pVBInfo);
-
- XGI_WaitDisply(pVBInfo);
- temp = XGINew_GetReg2(pVBInfo->P3c2);
-
- if (temp & 0x10)
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x32, 0xDF, 0x20);
- else
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x32, 0xDF, 0x00);
-
- /* alan, avoid display something, set BLACK DAC if not restore DAC */
- XGINew_SetReg3(pVBInfo->P3c8, 0x00);
-
- for (i = 0; i < 256; i++) {
- XGINew_SetReg3((pVBInfo->P3c8 + 1), 0);
- XGINew_SetReg3((pVBInfo->P3c8 + 1), 0);
- XGINew_SetReg3((pVBInfo->P3c8 + 1), 0);
- }
-
- XGINew_SetReg1(pVBInfo->P3c4, 0x01, SR01);
- XGINew_SetReg1(pVBInfo->P3d4, 0x63, CR63);
- XGINew_SetReg1(pVBInfo->P3c4, 0x31, SR31);
-
- /* [2004/05/11] Vicent */
- XGINew_SetReg1(pVBInfo->P3d4, 0x53, (unsigned char) (XGINew_GetReg1(
- pVBInfo->P3d4, 0x53) & 0xFD));
- XGINew_SetReg1(pVBInfo->P3c4, 0x1F, (unsigned char) SR1F);
-}
-
#if 0
static void XGI_WaitDisplay(struct vb_device_info *pVBInfo)
{
- while (!(XGINew_GetReg2(pVBInfo->P3da) & 0x01));
- while (XGINew_GetReg2(pVBInfo->P3da) & 0x01);
+ while (!(inb(pVBInfo->P3da) & 0x01));
+ while (inb(pVBInfo->P3da) & 0x01);
}
#endif
-unsigned char XGI_SetCRT2Group301(unsigned short ModeNo,
- struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo)
-{
- unsigned short tempbx, ModeIdIndex, RefreshRateTableIndex;
-
- tempbx = pVBInfo->VBInfo;
- pVBInfo->SetFlag |= ProgrammingCRT2;
- XGI_SearchModeID(ModeNo, &ModeIdIndex, pVBInfo);
- pVBInfo->SelectCRT2Rate = 4;
- RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo,
- ModeIdIndex, pVBInfo);
- XGI_SaveCRT2Info(ModeNo, pVBInfo);
- XGI_GetCRT2ResInfo(ModeNo, ModeIdIndex, pVBInfo);
- XGI_GetCRT2Data(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
- XGI_PreSetGroup1(ModeNo, ModeIdIndex, HwDeviceExtension,
- RefreshRateTableIndex, pVBInfo);
- XGI_SetGroup1(ModeNo, ModeIdIndex, HwDeviceExtension,
- RefreshRateTableIndex, pVBInfo);
- XGI_SetLockRegs(ModeNo, ModeIdIndex, HwDeviceExtension,
- RefreshRateTableIndex, pVBInfo);
- XGI_SetGroup2(ModeNo, ModeIdIndex, RefreshRateTableIndex,
- HwDeviceExtension, pVBInfo);
- XGI_SetLCDRegs(ModeNo, ModeIdIndex, HwDeviceExtension,
- RefreshRateTableIndex, pVBInfo);
- XGI_SetTap4Regs(pVBInfo);
- XGI_SetGroup3(ModeNo, ModeIdIndex, pVBInfo);
- XGI_SetGroup4(ModeNo, ModeIdIndex, RefreshRateTableIndex,
- HwDeviceExtension, pVBInfo);
- XGI_SetCRT2VCLK(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
- XGI_SetGroup5(ModeNo, ModeIdIndex, pVBInfo);
- XGI_AutoThreshold(pVBInfo);
- return 1;
-}
-
-void XGI_AutoThreshold(struct vb_device_info *pVBInfo)
+static void XGI_AutoThreshold(struct vb_device_info *pVBInfo)
{
if (!(pVBInfo->SetFlag & Win9xDOSMode))
- XGINew_SetRegOR(pVBInfo->Part1Port, 0x01, 0x40);
+ xgifb_reg_or(pVBInfo->Part1Port, 0x01, 0x40);
}
-void XGI_SaveCRT2Info(unsigned short ModeNo, struct vb_device_info *pVBInfo)
+static void XGI_SaveCRT2Info(unsigned short ModeNo, struct vb_device_info *pVBInfo)
{
unsigned short temp1, temp2;
- XGINew_SetReg1(pVBInfo->P3d4, 0x34, ModeNo); /* reserve CR34 for CRT1 Mode No */
+ xgifb_reg_set(pVBInfo->P3d4, 0x34, ModeNo); /* reserve CR34 for CRT1 Mode No */
temp1 = (pVBInfo->VBInfo & SetInSlaveMode) >> 8;
temp2 = ~(SetInSlaveMode >> 8);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x31, temp2, temp1);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x31, temp2, temp1);
}
-void XGI_GetCRT2ResInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_GetCRT2ResInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo)
{
unsigned short xres, yres, modeflag, resindex;
@@ -3951,7 +4296,7 @@ void XGI_GetCRT2ResInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
pVBInfo->VDE = yres;
}
-unsigned char XGI_IsLCDDualLink(struct vb_device_info *pVBInfo)
+static unsigned char XGI_IsLCDDualLink(struct vb_device_info *pVBInfo)
{
if ((pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) &&
@@ -3961,7 +4306,64 @@ unsigned char XGI_IsLCDDualLink(struct vb_device_info *pVBInfo)
return 0;
}
-void XGI_GetCRT2Data(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_GetRAMDAC2DATA(unsigned short ModeNo, unsigned short ModeIdIndex,
+ unsigned short RefreshRateTableIndex,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short tempax, tempbx, temp1, temp2, modeflag = 0, tempcx,
+ StandTableIndex, CRT1Index;
+
+ pVBInfo->RVBHCMAX = 1;
+ pVBInfo->RVBHCFACT = 1;
+
+ if (ModeNo <= 0x13) {
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
+ StandTableIndex = XGI_GetModePtr(ModeNo, ModeIdIndex, pVBInfo);
+ tempax = pVBInfo->StandTable[StandTableIndex].CRTC[0];
+ tempbx = pVBInfo->StandTable[StandTableIndex].CRTC[6];
+ temp1 = pVBInfo->StandTable[StandTableIndex].CRTC[7];
+ } else {
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ CRT1Index
+ = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
+ CRT1Index &= IndexMask;
+ temp1
+ = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[0];
+ temp2
+ = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[5];
+ tempax = (temp1 & 0xFF) | ((temp2 & 0x03) << 8);
+ tempbx
+ = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[8];
+ tempcx
+ = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[14]
+ << 8;
+ tempcx &= 0x0100;
+ tempcx = tempcx << 2;
+ tempbx |= tempcx;
+ temp1
+ = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[9];
+ }
+
+ if (temp1 & 0x01)
+ tempbx |= 0x0100;
+
+ if (temp1 & 0x20)
+ tempbx |= 0x0200;
+ tempax += 5;
+
+ if (modeflag & Charx8Dot)
+ tempax *= 8;
+ else
+ tempax *= 9;
+
+ pVBInfo->VGAHT = tempax;
+ pVBInfo->HT = tempax;
+ tempbx++;
+ pVBInfo->VGAVT = tempbx;
+ pVBInfo->VT = tempbx;
+}
+
+static void XGI_GetCRT2Data(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
{
@@ -4147,7 +4549,7 @@ void XGI_GetCRT2Data(unsigned short ModeNo, unsigned short ModeIdIndex,
}
}
-void XGI_SetCRT2VCLK(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetCRT2VCLK(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
{
@@ -4160,253 +4562,43 @@ void XGI_SetCRT2VCLK(unsigned short ModeNo, unsigned short ModeIdIndex,
if (pVBInfo->VBType & VB_XGI301) { /* shampoo 0129 */
/* 301 */
- XGINew_SetReg1(pVBInfo->Part4Port, 0x0A, 0x10);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x0B, di_1);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x0A, di_0);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x0A, 0x10);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x0B, di_1);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x0A, di_0);
} else { /* 301b/302b/301lv/302lv */
- XGINew_SetReg1(pVBInfo->Part4Port, 0x0A, di_0);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x0B, di_1);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x0A, di_0);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x0B, di_1);
}
- XGINew_SetReg1(pVBInfo->Part4Port, 0x00, 0x12);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x00, 0x12);
if (pVBInfo->VBInfo & SetCRT2ToRAMDAC)
- XGINew_SetRegOR(pVBInfo->Part4Port, 0x12, 0x28);
+ xgifb_reg_or(pVBInfo->Part4Port, 0x12, 0x28);
else
- XGINew_SetRegOR(pVBInfo->Part4Port, 0x12, 0x08);
-}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GETLCDVCLKPtr */
-/* Input : */
-/* Output : al -> VCLK Index */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_GetLCDVCLKPtr(unsigned char *di_0, unsigned char *di_1,
- struct vb_device_info *pVBInfo)
-{
- unsigned short index;
-
- if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
- if (pVBInfo->IF_DEF_ScaleLCD == 1) {
- if (pVBInfo->LCDInfo & EnableScalingLCD)
- return;
- }
-
- /* index = XGI_GetLCDCapPtr(pVBInfo); */
- index = XGI_GetLCDCapPtr1(pVBInfo);
-
- if (pVBInfo->VBInfo & SetCRT2ToLCD) { /* LCDB */
- *di_0 = pVBInfo->LCDCapList[index].LCUCHAR_VCLKData1;
- *di_1 = pVBInfo->LCDCapList[index].LCUCHAR_VCLKData2;
- } else { /* LCDA */
- *di_0 = pVBInfo->LCDCapList[index].LCDA_VCLKData1;
- *di_1 = pVBInfo->LCDCapList[index].LCDA_VCLKData2;
- }
- }
- return;
+ xgifb_reg_or(pVBInfo->Part4Port, 0x12, 0x08);
}
-unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex,
- unsigned short ModeNo, unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo)
+static unsigned short XGI_GetColorDepth(unsigned short ModeNo,
+ unsigned short ModeIdIndex, struct vb_device_info *pVBInfo)
{
-
- unsigned short index, modeflag;
- unsigned short tempbx;
- unsigned char tempal;
- unsigned char *CHTVVCLKPtr = NULL;
+ unsigned short ColorDepth[6] = { 1, 2, 4, 4, 6, 8 };
+ short index;
+ unsigned short modeflag;
if (ModeNo <= 0x13)
- modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
else
- modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */
-
- if ((pVBInfo->SetFlag & ProgrammingCRT2) && (!(pVBInfo->LCDInfo
- & EnableScalingLCD))) { /* {LCDA/LCDB} */
- index = XGI_GetLCDCapPtr(pVBInfo);
- tempal = pVBInfo->LCDCapList[index].LCD_VCLK;
-
- if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA))
- return tempal;
-
- /* {TV} */
- if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
- | VB_XGI302LV | VB_XGI301C)) {
- if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) {
- tempal = HiTVVCLKDIV2;
- if (!(pVBInfo->TVInfo & RPLLDIV2XO))
- tempal = HiTVVCLK;
- if (pVBInfo->TVInfo & TVSimuMode) {
- tempal = HiTVSimuVCLK;
- if (!(modeflag & Charx8Dot))
- tempal = HiTVTextVCLK;
-
- }
- return tempal;
- }
-
- if (pVBInfo->TVInfo & SetYPbPrMode750p) {
- tempal = YPbPr750pVCLK;
- return tempal;
- }
-
- if (pVBInfo->TVInfo & SetYPbPrMode525p) {
- tempal = YPbPr525pVCLK;
- return tempal;
- }
-
- tempal = NTSC1024VCLK;
-
- if (!(pVBInfo->TVInfo & NTSC1024x768)) {
- tempal = TVVCLKDIV2;
- if (!(pVBInfo->TVInfo & RPLLDIV2XO))
- tempal = TVVCLK;
- }
-
- if (pVBInfo->VBInfo & SetCRT2ToTV)
- return tempal;
- }
- /* else if ((pVBInfo->IF_DEF_CH7017==1)&&(pVBInfo->VBType&VB_CH7017)) {
- if (ModeNo<=0x13)
- *tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
- else
- *tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
- *tempal = *tempal & 0x1F;
- tempbx = 0;
- if (pVBInfo->TVInfo & SetPALTV)
- tempbx = tempbx + 2;
- if (pVBInfo->TVInfo & SetCHTVOverScan)
- tempbx++;
- tempbx = tempbx << 1;
- } */
- } /* {End of VB} */
-
- if ((pVBInfo->IF_DEF_CH7007 == 1) && (pVBInfo->VBType & VB_CH7007)) { /* [Billy] 07/05/08 CH7007 */
- /* VideoDebugPrint((0, "XGI_GetVCLKPtr: pVBInfo->IF_DEF_CH7007==1\n")); */
- if ((pVBInfo->VBInfo & SetCRT2ToTV)) {
- if (ModeNo <= 0x13) {
- tempal
- = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
- } else {
- tempal
- = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
- }
-
- tempal = tempal & 0x0F;
- tempbx = 0;
-
- if (pVBInfo->TVInfo & SetPALTV)
- tempbx = tempbx + 2;
-
- if (pVBInfo->TVInfo & SetCHTVOverScan)
- tempbx++;
-
- /** tempbx = tempbx << 1; CH7007 ? **/
-
- /* [Billy]07/05/29 CH7007 */
- if (pVBInfo->IF_DEF_CH7007 == 1) {
- switch (tempbx) {
- case 0:
- CHTVVCLKPtr = XGI7007_CHTVVCLKUNTSC;
- break;
- case 1:
- CHTVVCLKPtr = XGI7007_CHTVVCLKONTSC;
- break;
- case 2:
- CHTVVCLKPtr = XGI7007_CHTVVCLKUPAL;
- break;
- case 3:
- CHTVVCLKPtr = XGI7007_CHTVVCLKOPAL;
- break;
- default:
- break;
-
- }
- }
- /* else {
- switch(tempbx) {
- case 0:
- CHTVVCLKPtr = pVBInfo->CHTVVCLKUNTSC;
- break;
- case 1:
- CHTVVCLKPtr = pVBInfo->CHTVVCLKONTSC;
- break;
- case 2:
- CHTVVCLKPtr = pVBInfo->CHTVVCLKUPAL;
- break;
- case 3:
- CHTVVCLKPtr = pVBInfo->CHTVVCLKOPAL;
- break;
- default:
- break;
- }
- }
- */
-
- tempal = CHTVVCLKPtr[tempal];
- return tempal;
- }
-
- }
-
- tempal = (unsigned char) XGINew_GetReg2((pVBInfo->P3ca + 0x02));
- tempal = tempal >> 2;
- tempal &= 0x03;
-
- if ((pVBInfo->LCDInfo & EnableScalingLCD) && (modeflag & Charx8Dot)) /* for Dot8 Scaling LCD */
- tempal = tempal ^ tempal; /* ; set to VCLK25MHz always */
-
- if (ModeNo <= 0x13)
- return tempal;
-
- tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
- return tempal;
-}
-
-void XGI_GetVCLKLen(unsigned char tempal, unsigned char *di_0,
- unsigned char *di_1, struct vb_device_info *pVBInfo)
-{
- if (pVBInfo->IF_DEF_CH7007 == 1) { /* [Billy] 2007/05/16 */
- /* VideoDebugPrint((0, "XGI_GetVCLKLen: pVBInfo->IF_DEF_CH7007==1\n")); */
- *di_0 = (unsigned char) XGI_CH7007VCLKData[tempal].SR2B;
- *di_1 = (unsigned char) XGI_CH7007VCLKData[tempal].SR2C;
- } else if (pVBInfo->VBType & (VB_XGI301 | VB_XGI301B | VB_XGI302B
- | VB_XGI301LV | VB_XGI302LV | VB_XGI301C)) {
- if ((!(pVBInfo->VBInfo & SetCRT2ToLCDA)) && (pVBInfo->SetFlag
- & ProgrammingCRT2)) {
- *di_0 = (unsigned char) XGI_VBVCLKData[tempal].SR2B;
- *di_1 = XGI_VBVCLKData[tempal].SR2C;
- }
- } else {
- *di_0 = XGI_VCLKData[tempal].SR2B;
- *di_1 = XGI_VCLKData[tempal].SR2C;
- }
-}
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
-static void XGI_SetCRT2Offset(unsigned short ModeNo,
- unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
- struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo)
-{
- unsigned short offset;
- unsigned char temp;
+ index = (modeflag & ModeInfoFlag) - ModeEGA;
- if (pVBInfo->VBInfo & SetInSlaveMode)
- return;
+ if (index < 0)
+ index = 0;
- offset = XGI_GetOffset(ModeNo, ModeIdIndex, RefreshRateTableIndex,
- HwDeviceExtension, pVBInfo);
- temp = (unsigned char) (offset & 0xFF);
- XGINew_SetReg1(pVBInfo->Part1Port, 0x07, temp);
- temp = (unsigned char) ((offset & 0xFF00) >> 8);
- XGINew_SetReg1(pVBInfo->Part1Port, 0x09, temp);
- temp = (unsigned char) (((offset >> 3) & 0xFF) + 1);
- XGINew_SetReg1(pVBInfo->Part1Port, 0x03, temp);
+ return ColorDepth[index];
}
-unsigned short XGI_GetOffset(unsigned short ModeNo, unsigned short ModeIdIndex,
+static unsigned short XGI_GetOffset(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
@@ -4441,13 +4633,35 @@ unsigned short XGI_GetOffset(unsigned short ModeNo, unsigned short ModeIdIndex,
}
}
+static void XGI_SetCRT2Offset(unsigned short ModeNo,
+ unsigned short ModeIdIndex,
+ unsigned short RefreshRateTableIndex,
+ struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short offset;
+ unsigned char temp;
+
+ if (pVBInfo->VBInfo & SetInSlaveMode)
+ return;
+
+ offset = XGI_GetOffset(ModeNo, ModeIdIndex, RefreshRateTableIndex,
+ HwDeviceExtension, pVBInfo);
+ temp = (unsigned char) (offset & 0xFF);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x07, temp);
+ temp = (unsigned char) ((offset & 0xFF00) >> 8);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x09, temp);
+ temp = (unsigned char) (((offset >> 3) & 0xFF) + 1);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x03, temp);
+}
+
static void XGI_SetCRT2FIFO(struct vb_device_info *pVBInfo)
{
- XGINew_SetReg1(pVBInfo->Part1Port, 0x01, 0x3B); /* threshold high ,disable auto threshold */
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x02, ~(0x3F), 0x04); /* threshold low default 04h */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x01, 0x3B); /* threshold high ,disable auto threshold */
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x02, ~(0x3F), 0x04); /* threshold low default 04h */
}
-void XGI_PreSetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_PreSetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
struct xgi_hw_device_info *HwDeviceExtension,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
@@ -4466,13 +4680,13 @@ void XGI_PreSetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
/* XGI_SetCRT2Sync(ModeNo,RefreshRateTableIndex); */
for (tempcx = 4; tempcx < 7; tempcx++)
- XGINew_SetReg1(pVBInfo->Part1Port, tempcx, 0x0);
+ xgifb_reg_set(pVBInfo->Part1Port, tempcx, 0x0);
- XGINew_SetReg1(pVBInfo->Part1Port, 0x50, 0x00);
- XGINew_SetReg1(pVBInfo->Part1Port, 0x02, 0x44); /* temp 0206 */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x50, 0x00);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x02, 0x44); /* temp 0206 */
}
-void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
struct xgi_hw_device_info *HwDeviceExtension,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
@@ -4494,11 +4708,11 @@ void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
/* bainy change table name */
if (modeflag & HalfDCLK) {
temp = (pVBInfo->VGAHT / 2 - 1) & 0x0FF; /* BTVGA2HT 0x08,0x09 */
- XGINew_SetReg1(pVBInfo->Part1Port, 0x08, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x08, temp);
temp = (((pVBInfo->VGAHT / 2 - 1) & 0xFF00) >> 8) << 4;
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x09, ~0x0F0, temp);
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x09, ~0x0F0, temp);
temp = (pVBInfo->VGAHDE / 2 + 16) & 0x0FF; /* BTVGA2HDEE 0x0A,0x0C */
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0A, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0A, temp);
tempcx = ((pVBInfo->VGAHT - pVBInfo->VGAHDE) / 2) >> 2;
pushbx = pVBInfo->VGAHDE / 2 + 16;
tempcx = tempcx >> 1;
@@ -4525,14 +4739,14 @@ void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0B, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0B, temp);
} else {
temp = (pVBInfo->VGAHT - 1) & 0x0FF; /* BTVGA2HT 0x08,0x09 */
- XGINew_SetReg1(pVBInfo->Part1Port, 0x08, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x08, temp);
temp = (((pVBInfo->VGAHT - 1) & 0xFF00) >> 8) << 4;
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x09, ~0x0F0, temp);
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x09, ~0x0F0, temp);
temp = (pVBInfo->VGAHDE + 16) & 0x0FF; /* BTVGA2HDEE 0x0A,0x0C */
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0A, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0A, temp);
tempcx = (pVBInfo->VGAHT - pVBInfo->VGAHDE) >> 2; /* cx */
pushbx = pVBInfo->VGAHDE + 16;
tempcx = tempcx >> 1;
@@ -4557,7 +4771,7 @@ void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
tempcx = pVBInfo->VGAHT;
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0B, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0B, temp);
}
tempax = (tempax & 0x00FF) | (tempbx & 0xFF00);
@@ -4565,9 +4779,9 @@ void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
tempbx = (tempbx & 0x00FF) | ((tempbx & 0xFF00) << 4);
tempax |= (tempbx & 0xFF00);
temp = (tempax & 0xFF00) >> 8;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0C, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0C, temp);
temp = tempcx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0D, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0D, temp);
tempcx = (pVBInfo->VGAVT - 1);
temp = tempcx & 0x00FF;
@@ -4576,13 +4790,13 @@ void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
temp--;
}
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0E, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0E, temp);
tempbx = pVBInfo->VGAVDE - 1;
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0F, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0F, temp);
temp = ((tempbx & 0xFF00) << 3) >> 8;
temp |= ((tempcx & 0xFF00) >> 8);
- XGINew_SetReg1(pVBInfo->Part1Port, 0x12, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x12, temp);
tempax = pVBInfo->VGAVDE;
tempbx = pVBInfo->VGAVDE;
@@ -4610,10 +4824,10 @@ void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
}
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x10, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x10, temp);
temp = ((tempbx & 0xFF00) >> 8) << 4;
temp = ((tempcx & 0x000F) | (temp));
- XGINew_SetReg1(pVBInfo->Part1Port, 0x11, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x11, temp);
tempax = 0;
if (modeflag & DoubleScanMode)
@@ -4622,10 +4836,22 @@ void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
if (modeflag & HalfDCLK)
tempax |= 0x40;
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2C, ~0x0C0, tempax);
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x2C, ~0x0C0, tempax);
+}
+
+static unsigned short XGI_GetVGAHT2(struct vb_device_info *pVBInfo)
+{
+ unsigned long tempax, tempbx;
+
+ tempbx = ((pVBInfo->VGAVT - pVBInfo->VGAVDE) * pVBInfo->RVBHCMAX)
+ & 0xFFFF;
+ tempax = (pVBInfo->VT - pVBInfo->VDE) * pVBInfo->RVBHCFACT;
+ tempax = (tempax * pVBInfo->HT) / tempbx;
+
+ return (unsigned short) tempax;
}
-void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
struct xgi_hw_device_info *HwDeviceExtension,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
@@ -4647,7 +4873,7 @@ void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
return;
temp = 0xFF; /* set MAX HT */
- XGINew_SetReg1(pVBInfo->Part1Port, 0x03, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x03, temp);
/* if (modeflag & Charx8Dot) */
/* tempcx = 0x08; */
/* else */
@@ -4664,7 +4890,7 @@ void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
tempax = (tempax / tempcx) - 1;
tempbx |= ((tempax & 0x00FF) << 8);
temp = tempax & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x04, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x04, temp);
temp = (tempbx & 0xFF00) >> 8;
@@ -4685,8 +4911,8 @@ void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
}
}
- XGINew_SetReg1(pVBInfo->Part1Port, 0x05, temp); /* 0x05 Horizontal Display Start */
- XGINew_SetReg1(pVBInfo->Part1Port, 0x06, 0x03); /* 0x06 Horizontal Blank end */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x05, temp); /* 0x05 Horizontal Display Start */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x06, 0x03); /* 0x06 Horizontal Blank end */
if (!(pVBInfo->VBInfo & DisableCRT2Display)) { /* 030226 bainy */
if (pVBInfo->VBInfo & SetCRT2ToTV)
@@ -4763,30 +4989,30 @@ void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
}
}
- XGINew_SetReg1(pVBInfo->Part1Port, 0x07, temp); /* 0x07 Horizontal Retrace Start */
- XGINew_SetReg1(pVBInfo->Part1Port, 0x08, 0); /* 0x08 Horizontal Retrace End */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x07, temp); /* 0x07 Horizontal Retrace Start */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x08, 0); /* 0x08 Horizontal Retrace End */
if (pVBInfo->VBInfo & SetCRT2ToTV) {
if (pVBInfo->TVInfo & TVSimuMode) {
if ((ModeNo == 0x06) || (ModeNo == 0x10) || (ModeNo
== 0x11) || (ModeNo == 0x13) || (ModeNo
== 0x0F)) {
- XGINew_SetReg1(pVBInfo->Part1Port, 0x07, 0x5b);
- XGINew_SetReg1(pVBInfo->Part1Port, 0x08, 0x03);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x07, 0x5b);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x08, 0x03);
}
if ((ModeNo == 0x00) || (ModeNo == 0x01)) {
if (pVBInfo->TVInfo & SetNTSCTV) {
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x07, 0x2A);
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x08, 0x61);
} else {
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x07, 0x2A);
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x08, 0x41);
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x0C, 0xF0);
}
}
@@ -4794,16 +5020,16 @@ void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
if ((ModeNo == 0x02) || (ModeNo == 0x03) || (ModeNo
== 0x07)) {
if (pVBInfo->TVInfo & SetNTSCTV) {
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x07, 0x54);
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x08, 0x00);
} else {
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x07, 0x55);
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x08, 0x00);
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x0C, 0xF0);
}
}
@@ -4811,23 +5037,23 @@ void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
if ((ModeNo == 0x04) || (ModeNo == 0x05) || (ModeNo
== 0x0D) || (ModeNo == 0x50)) {
if (pVBInfo->TVInfo & SetNTSCTV) {
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x07, 0x30);
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x08, 0x03);
} else {
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x07, 0x2f);
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x08, 0x02);
}
}
}
}
- XGINew_SetReg1(pVBInfo->Part1Port, 0x18, 0x03); /* 0x18 SR0B */
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, 0xF0, 0x00);
- XGINew_SetReg1(pVBInfo->Part1Port, 0x09, 0xFF); /* 0x09 Set Max VT */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x18, 0x03); /* 0x18 SR0B */
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x19, 0xF0, 0x00);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x09, 0xFF); /* 0x09 Set Max VT */
tempbx = pVBInfo->VGAVT;
push1 = tempbx;
@@ -4861,11 +5087,11 @@ void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
temp = tempbx & 0x00FF;
tempbx--;
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x10, temp); /* 0x10 vertical Blank Start */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x10, temp); /* 0x10 vertical Blank Start */
tempbx = push2;
tempbx--;
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0E, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0E, temp);
if (tempbx & 0x0100)
tempcx |= 0x0002;
@@ -4879,12 +5105,12 @@ void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
tempcx |= 0x0040;
temp = (tempax & 0xFF00) >> 8;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0B, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0B, temp);
if (tempbx & 0x0400)
tempcx |= 0x0600;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x11, 0x00); /* 0x11 Vertival Blank End */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x11, 0x00); /* 0x11 Vertival Blank End */
tempax = push1;
tempax -= tempbx; /* 0x0C Vertical Retrace Start */
@@ -4948,16 +5174,16 @@ void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
}
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0C, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0C, temp);
tempbx--;
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x10, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x10, temp);
if (tempbx & 0x0100)
tempcx |= 0x0008;
if (tempbx & 0x0200)
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x0B, 0x0FF, 0x20);
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x0B, 0x0FF, 0x20);
tempbx++;
@@ -4973,15 +5199,15 @@ void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
tempbx = push1; /* pop ax */
temp = tempbx & 0x00FF;
temp &= 0x0F;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0D, temp); /* 0x0D vertical Retrace End */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0D, temp); /* 0x0D vertical Retrace End */
if (tempbx & 0x0010)
tempcx |= 0x2000;
temp = tempcx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0A, temp); /* 0x0A CR07 */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0A, temp); /* 0x0A CR07 */
temp = (tempcx & 0x0FF00) >> 8;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x17, temp); /* 0x17 SR0A */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x17, temp); /* 0x17 SR0A */
tempax = modeflag;
temp = (tempax & 0xFF00) >> 8;
@@ -4990,21 +5216,21 @@ void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
if (pVBInfo->VBType & (VB_XGI301LV | VB_XGI302LV | VB_XGI301C))
temp |= 0x01;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x16, temp); /* 0x16 SR01 */
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0F, 0); /* 0x0F CR14 */
- XGINew_SetReg1(pVBInfo->Part1Port, 0x12, 0); /* 0x12 CR17 */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x16, temp); /* 0x16 SR01 */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0F, 0); /* 0x0F CR14 */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x12, 0); /* 0x12 CR17 */
if (pVBInfo->LCDInfo & LCDRGB18Bit)
temp = 0x80;
else
temp = 0x00;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x1A, temp); /* 0x1A SR0E */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x1A, temp); /* 0x1A SR0E */
return;
}
-void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
@@ -5048,7 +5274,7 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
tempax = (tempax & 0xff00) >> 8;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x0, tempax);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x0, tempax);
TimingPoint = pVBInfo->NTSCTiming;
if (pVBInfo->TVInfo & SetPALTV)
@@ -5079,17 +5305,17 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
}
for (i = 0x01, j = 0; i <= 0x2D; i++, j++)
- XGINew_SetReg1(pVBInfo->Part2Port, i, TimingPoint[j]);
+ xgifb_reg_set(pVBInfo->Part2Port, i, TimingPoint[j]);
for (i = 0x39; i <= 0x45; i++, j++)
- XGINew_SetReg1(pVBInfo->Part2Port, i, TimingPoint[j]); /* di->temp2[j] */
+ xgifb_reg_set(pVBInfo->Part2Port, i, TimingPoint[j]); /* di->temp2[j] */
if (pVBInfo->VBInfo & SetCRT2ToTV)
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x3A, 0x1F, 0x00);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x3A, 0x1F, 0x00);
temp = pVBInfo->NewFlickerMode;
temp &= 0x80;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x0A, 0xFF, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x0A, 0xFF, temp);
if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV)
tempax = 950;
@@ -5121,7 +5347,7 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
}
}
- XGINew_SetReg1(pVBInfo->Part2Port, 0x01, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x01, temp);
tempax = push1;
temp = (tempax & 0xFF00) >> 8;
temp += TimingPoint[1];
@@ -5139,7 +5365,7 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
}
}
}
- XGINew_SetReg1(pVBInfo->Part2Port, 0x02, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x02, temp);
}
/* 301b */
@@ -5150,10 +5376,10 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
tempcx -= 2;
temp = tempcx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x1B, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x1B, temp);
temp = (tempcx & 0xFF00) >> 8;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x1D, ~0x0F, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x1D, ~0x0F, temp);
tempcx = pVBInfo->HT >> 1;
push1 = tempcx; /* push cx */
@@ -5164,16 +5390,16 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
temp = tempcx & 0x00FF;
temp = temp << 4;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x22, 0x0F, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x22, 0x0F, temp);
tempbx = TimingPoint[j] | ((TimingPoint[j + 1]) << 8);
tempbx += tempcx;
push2 = tempbx;
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x24, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x24, temp);
temp = (tempbx & 0xFF00) >> 8;
temp = temp << 4;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x25, 0x0F, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x25, 0x0F, temp);
tempbx = push2;
tempbx = tempbx + 8;
@@ -5183,14 +5409,14 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
}
temp = (tempbx & 0x00FF) << 4;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x29, 0x0F, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x29, 0x0F, temp);
j += 2;
tempcx += (TimingPoint[j] | ((TimingPoint[j + 1]) << 8));
temp = tempcx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x27, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x27, temp);
temp = ((tempcx & 0xFF00) >> 8) << 4;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x28, 0x0F, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x28, 0x0F, temp);
tempcx += 8;
if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV)
@@ -5198,7 +5424,7 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
temp = tempcx & 0xFF;
temp = temp << 4;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x2A, 0x0F, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x2A, 0x0F, temp);
tempcx = push1; /* pop cx */
j += 2;
@@ -5206,7 +5432,7 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
tempcx -= temp;
temp = tempcx & 0x00FF;
temp = temp << 4;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x2D, 0x0F, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x2D, 0x0F, temp);
tempcx -= 11;
@@ -5215,7 +5441,7 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
tempcx = tempax - 1;
}
temp = tempcx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x2E, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x2E, temp);
tempbx = pVBInfo->VDE;
@@ -5254,7 +5480,7 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
}
}
- XGINew_SetReg1(pVBInfo->Part2Port, 0x2F, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x2F, temp);
temp = (tempcx & 0xFF00) >> 8;
temp |= ((tempbx & 0xFF00) >> 8) << 6;
@@ -5274,7 +5500,7 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
}
}
- XGINew_SetReg1(pVBInfo->Part2Port, 0x30, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x30, temp);
if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
| VB_XGI302LV | VB_XGI301C)) { /* TV gatingno */
@@ -5295,13 +5521,13 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
if (tempbx & 0x0400)
temp |= 0x40;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x10, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x10, temp);
}
temp = (((tempbx - 3) & 0x0300) >> 8) << 5;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x46, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x46, temp);
temp = (tempbx - 3) & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x47, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x47, temp);
}
tempbx = tempbx & 0x00FF;
@@ -5371,9 +5597,9 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
temp = (tempax & 0x00FF) >> 8;
}
- XGINew_SetReg1(pVBInfo->Part2Port, 0x44, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x44, temp);
temp = (tempbx & 0xFF00) >> 8;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x45, ~0x03F, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x45, ~0x03F, temp);
temp = tempcx & 0x00FF;
if (tempbx & 0x2000)
@@ -5382,7 +5608,7 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
if (!(pVBInfo->VBInfo & SetCRT2ToLCD))
temp |= 0x18;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x46, ~0x1F, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x46, ~0x1F, temp);
if (pVBInfo->TVInfo & SetPALTV) {
tempbx = 0x0382;
tempcx = 0x007e;
@@ -5392,9 +5618,9 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
}
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x4b, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x4b, temp);
temp = tempcx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x4c, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x4c, temp);
temp = ((tempcx & 0xFF00) >> 8) & 0x03;
temp = temp << 2;
@@ -5410,48 +5636,48 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
temp |= 0x60;
}
- XGINew_SetReg1(pVBInfo->Part2Port, 0x4d, temp);
- temp = XGINew_GetReg1(pVBInfo->Part2Port, 0x43); /* 301b change */
- XGINew_SetReg1(pVBInfo->Part2Port, 0x43, (unsigned short) (temp - 3));
+ xgifb_reg_set(pVBInfo->Part2Port, 0x4d, temp);
+ temp = xgifb_reg_get(pVBInfo->Part2Port, 0x43); /* 301b change */
+ xgifb_reg_set(pVBInfo->Part2Port, 0x43, (unsigned short) (temp - 3));
if (!(pVBInfo->TVInfo & (SetYPbPrMode525p | SetYPbPrMode750p))) {
if (pVBInfo->TVInfo & NTSC1024x768) {
TimingPoint = XGI_NTSC1024AdjTime;
for (i = 0x1c, j = 0; i <= 0x30; i++, j++) {
- XGINew_SetReg1(pVBInfo->Part2Port, i,
+ xgifb_reg_set(pVBInfo->Part2Port, i,
TimingPoint[j]);
}
- XGINew_SetReg1(pVBInfo->Part2Port, 0x43, 0x72);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x43, 0x72);
}
}
/* [ycchen] 01/14/03 Modify for 301C PALM Support */
if (pVBInfo->VBType & VB_XGI301C) {
if (pVBInfo->TVInfo & SetPALMTV)
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x4E, ~0x08,
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x4E, ~0x08,
0x08); /* PALM Mode */
}
if (pVBInfo->TVInfo & SetPALMTV) {
- tempax = (unsigned char) XGINew_GetReg1(pVBInfo->Part2Port,
+ tempax = (unsigned char) xgifb_reg_get(pVBInfo->Part2Port,
0x01);
tempax--;
- XGINew_SetRegAND(pVBInfo->Part2Port, 0x01, tempax);
+ xgifb_reg_and(pVBInfo->Part2Port, 0x01, tempax);
/* if ( !( pVBInfo->VBType & VB_XGI301C ) ) */
- XGINew_SetRegAND(pVBInfo->Part2Port, 0x00, 0xEF);
+ xgifb_reg_and(pVBInfo->Part2Port, 0x00, 0xEF);
}
if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) {
if (!(pVBInfo->VBInfo & SetInSlaveMode))
- XGINew_SetReg1(pVBInfo->Part2Port, 0x0B, 0x00);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x0B, 0x00);
}
if (pVBInfo->VBInfo & SetCRT2ToTV)
return;
}
-void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
struct xgi_hw_device_info *HwDeviceExtension,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
@@ -5482,10 +5708,10 @@ void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
tempbx -= 1;
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x2C, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x2C, temp);
temp = (tempbx & 0xFF00) >> 8;
temp = temp << 4;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x2B, 0x0F, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x2B, 0x0F, temp);
temp = 0x01;
if (pVBInfo->LCDResInfo == Panel1280x1024) {
@@ -5498,26 +5724,26 @@ void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
}
}
- XGINew_SetReg1(pVBInfo->Part2Port, 0x0B, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x0B, temp);
tempbx = pVBInfo->VDE; /* RTVACTEO=(VDE-1)&0xFF */
push1 = tempbx;
tempbx--;
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x03, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x03, temp);
temp = ((tempbx & 0xFF00) >> 8) & 0x07;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x0C, ~0x07, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x0C, ~0x07, temp);
tempcx = pVBInfo->VT - 1;
push2 = tempcx + 1;
temp = tempcx & 0x00FF; /* RVTVT=VT-1 */
- XGINew_SetReg1(pVBInfo->Part2Port, 0x19, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x19, temp);
temp = (tempcx & 0xFF00) >> 8;
temp = temp << 5;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x1A, temp);
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x09, 0xF0, 0x00);
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x0A, 0xF0, 0x00);
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x17, 0xFB, 0x00);
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x18, 0xDF, 0x00);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x1A, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x09, 0xF0, 0x00);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x0A, 0xF0, 0x00);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x17, 0xFB, 0x00);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x18, 0xDF, 0x00);
/* Customized LCDB Des no add */
tempbx = 5;
@@ -5558,15 +5784,15 @@ void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
tempcx -= tempax; /* lcdvdes */
temp = tempbx & 0x00FF; /* RVEQ1EQ=lcdvdes */
- XGINew_SetReg1(pVBInfo->Part2Port, 0x05, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x05, temp);
temp = tempcx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x06, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x06, temp);
tempch = ((tempcx & 0xFF00) >> 8) & 0x07;
tempbh = ((tempbx & 0xFF00) >> 8) & 0x07;
tempah = tempch;
tempah = tempah << 3;
tempah |= tempbh;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x02, tempah);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x02, tempah);
/* getlcdsync() */
XGI_GetLCDSync(&tempax, &tempbx, pVBInfo);
@@ -5580,11 +5806,11 @@ void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
tempcx -= tempax;
temp = tempbx & 0x00FF; /* RTVACTEE=lcdvrs */
- XGINew_SetReg1(pVBInfo->Part2Port, 0x04, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x04, temp);
temp = (tempbx & 0xFF00) >> 8;
temp = temp << 4;
temp |= (tempcx & 0x000F);
- XGINew_SetReg1(pVBInfo->Part2Port, 0x01, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x01, temp);
tempcx = pushbx;
tempax = pVBInfo->HT;
tempbx = pVBInfo->LCDHDES;
@@ -5608,13 +5834,13 @@ void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
tempcx -= tempax;
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x1F, temp); /* RHBLKE=lcdhdes */
+ xgifb_reg_set(pVBInfo->Part2Port, 0x1F, temp); /* RHBLKE=lcdhdes */
temp = ((tempbx & 0xFF00) >> 8) << 4;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x20, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x20, temp);
temp = tempcx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x23, temp); /* RHEQPLE=lcdhdee */
+ xgifb_reg_set(pVBInfo->Part2Port, 0x23, temp); /* RHEQPLE=lcdhdee */
temp = (tempcx & 0xFF00) >> 8;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x25, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x25, temp);
/* getlcdsync() */
XGI_GetLCDSync(&tempax, &tempbx, pVBInfo);
@@ -5637,13 +5863,13 @@ void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
tempcx -= tempax;
temp = tempbx & 0x00FF; /* RHBURSTS=lcdhrs */
- XGINew_SetReg1(pVBInfo->Part2Port, 0x1C, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x1C, temp);
temp = (tempbx & 0xFF00) >> 8;
temp = temp << 4;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x1D, ~0x0F0, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x1D, ~0x0F0, temp);
temp = tempcx & 0x00FF; /* RHSYEXP2S=lcdhre */
- XGINew_SetReg1(pVBInfo->Part2Port, 0x21, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x21, temp);
if (!(pVBInfo->LCDInfo & LCDVESATiming)) {
if (pVBInfo->VGAVDE == 525) {
@@ -5654,8 +5880,8 @@ void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
} else
temp = 0xC4;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x2f, temp);
- XGINew_SetReg1(pVBInfo->Part2Port, 0x30, 0xB3);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x2f, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x30, 0xB3);
}
if (pVBInfo->VGAVDE == 420) {
@@ -5665,7 +5891,7 @@ void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
temp = 0x4F;
} else
temp = 0x4E;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x2f, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x2f, temp);
}
}
}
@@ -5676,7 +5902,7 @@ void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
/* Output : di -> Tap4 Reg. Setting Pointer */
/* Description : */
/* --------------------------------------------------------------------- */
-struct XGI301C_Tap4TimingStruct *XGI_GetTap4Ptr(unsigned short tempcx,
+static struct XGI301C_Tap4TimingStruct *XGI_GetTap4Ptr(unsigned short tempcx,
struct vb_device_info *pVBInfo)
{
unsigned short tempax, tempbx, i;
@@ -5722,7 +5948,7 @@ struct XGI301C_Tap4TimingStruct *XGI_GetTap4Ptr(unsigned short tempcx,
return &Tap4TimingPtr[i];
}
-void XGI_SetTap4Regs(struct vb_device_info *pVBInfo)
+static void XGI_SetTap4Regs(struct vb_device_info *pVBInfo)
{
unsigned short i, j;
@@ -5732,27 +5958,27 @@ void XGI_SetTap4Regs(struct vb_device_info *pVBInfo)
return;
#ifndef Tap4
- XGINew_SetRegAND(pVBInfo->Part2Port, 0x4E, 0xEB); /* Disable Tap4 */
+ xgifb_reg_and(pVBInfo->Part2Port, 0x4E, 0xEB); /* Disable Tap4 */
#else /* Tap4 Setting */
Tap4TimingPtr = XGI_GetTap4Ptr(0, pVBInfo); /* Set Horizontal Scaling */
for (i = 0x80, j = 0; i <= 0xBF; i++, j++)
- XGINew_SetReg1(pVBInfo->Part2Port, i, Tap4TimingPtr->Reg[j]);
+ xgifb_reg_set(pVBInfo->Part2Port, i, Tap4TimingPtr->Reg[j]);
if ((pVBInfo->VBInfo & SetCRT2ToTV) && (!(pVBInfo->VBInfo & SetCRT2ToHiVisionTV))) {
Tap4TimingPtr = XGI_GetTap4Ptr(1, pVBInfo); /* Set Vertical Scaling */
for (i = 0xC0, j = 0; i < 0xFF; i++, j++)
- XGINew_SetReg1(pVBInfo->Part2Port, i, Tap4TimingPtr->Reg[j]);
+ xgifb_reg_set(pVBInfo->Part2Port, i, Tap4TimingPtr->Reg[j]);
}
if ((pVBInfo->VBInfo & SetCRT2ToTV) && (!(pVBInfo->VBInfo & SetCRT2ToHiVisionTV)))
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x4E, ~0x14, 0x04); /* Enable V.Scaling */
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x4E, ~0x14, 0x04); /* Enable V.Scaling */
else
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x4E, ~0x14, 0x10); /* Enable H.Scaling */
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x4E, ~0x14, 0x10); /* Enable H.Scaling */
#endif
}
-void XGI_SetGroup3(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetGroup3(unsigned short ModeNo, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo)
{
unsigned short i;
@@ -5764,22 +5990,22 @@ void XGI_SetGroup3(unsigned short ModeNo, unsigned short ModeIdIndex,
else
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */
- XGINew_SetReg1(pVBInfo->Part3Port, 0x00, 0x00);
+ xgifb_reg_set(pVBInfo->Part3Port, 0x00, 0x00);
if (pVBInfo->TVInfo & SetPALTV) {
- XGINew_SetReg1(pVBInfo->Part3Port, 0x13, 0xFA);
- XGINew_SetReg1(pVBInfo->Part3Port, 0x14, 0xC8);
+ xgifb_reg_set(pVBInfo->Part3Port, 0x13, 0xFA);
+ xgifb_reg_set(pVBInfo->Part3Port, 0x14, 0xC8);
} else {
- XGINew_SetReg1(pVBInfo->Part3Port, 0x13, 0xF5);
- XGINew_SetReg1(pVBInfo->Part3Port, 0x14, 0xB7);
+ xgifb_reg_set(pVBInfo->Part3Port, 0x13, 0xF5);
+ xgifb_reg_set(pVBInfo->Part3Port, 0x14, 0xB7);
}
if (!(pVBInfo->VBInfo & SetCRT2ToTV))
return;
if (pVBInfo->TVInfo & SetPALMTV) {
- XGINew_SetReg1(pVBInfo->Part3Port, 0x13, 0xFA);
- XGINew_SetReg1(pVBInfo->Part3Port, 0x14, 0xC8);
- XGINew_SetReg1(pVBInfo->Part3Port, 0x3D, 0xA8);
+ xgifb_reg_set(pVBInfo->Part3Port, 0x13, 0xFA);
+ xgifb_reg_set(pVBInfo->Part3Port, 0x14, 0xC8);
+ xgifb_reg_set(pVBInfo->Part3Port, 0x3D, 0xA8);
}
if ((pVBInfo->VBInfo & SetCRT2ToHiVisionTV) || (pVBInfo->VBInfo
@@ -5801,17 +6027,17 @@ void XGI_SetGroup3(unsigned short ModeNo, unsigned short ModeIdIndex,
tempdi = pVBInfo->Ren750pGroup3;
for (i = 0; i <= 0x3E; i++)
- XGINew_SetReg1(pVBInfo->Part3Port, i, tempdi[i]);
+ xgifb_reg_set(pVBInfo->Part3Port, i, tempdi[i]);
if (pVBInfo->VBType & VB_XGI301C) { /* Marcovision */
if (pVBInfo->TVInfo & SetYPbPrMode525p)
- XGINew_SetReg1(pVBInfo->Part3Port, 0x28, 0x3f);
+ xgifb_reg_set(pVBInfo->Part3Port, 0x28, 0x3f);
}
}
return;
} /* {end of XGI_SetGroup3} */
-void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
@@ -5826,15 +6052,15 @@ void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex,
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */
temp = pVBInfo->RVBHCFACT;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x13, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x13, temp);
tempbx = pVBInfo->RVBHCMAX;
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x14, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x14, temp);
temp2 = ((tempbx & 0xFF00) >> 8) << 7;
tempcx = pVBInfo->VGAHT - 1;
temp = tempcx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x16, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x16, temp);
temp = ((tempcx & 0xFF00) >> 8) << 3;
temp2 |= temp;
@@ -5844,10 +6070,10 @@ void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex,
tempcx -= 5;
temp = tempcx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x17, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x17, temp);
temp = temp2 | ((tempcx & 0xFF00) >> 8);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x15, temp);
- XGINew_SetRegOR(pVBInfo->Part4Port, 0x0D, 0x08);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x15, temp);
+ xgifb_reg_or(pVBInfo->Part4Port, 0x0D, 0x08);
tempcx = pVBInfo->VBInfo;
tempbx = pVBInfo->VGAHDE;
@@ -5883,7 +6109,7 @@ void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex,
if (pVBInfo->VGAHDE == 1024)
temp = 0x20;
}
- XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x0E, ~0xEF, temp);
+ xgifb_reg_and_or(pVBInfo->Part4Port, 0x0E, ~0xEF, temp);
tempebx = pVBInfo->VDE;
@@ -5894,7 +6120,7 @@ void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex,
tempcx = pVBInfo->RVBHRS;
temp = tempcx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x18, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x18, temp);
tempeax = pVBInfo->VGAVDE;
tempcx |= 0x04000;
@@ -5914,21 +6140,21 @@ void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex,
tempebx++;
temp = (unsigned short) (tempebx & 0x000000FF);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x1B, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x1B, temp);
temp = (unsigned short) ((tempebx & 0x0000FF00) >> 8);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x1A, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x1A, temp);
tempbx = (unsigned short) (tempebx >> 16);
temp = tempbx & 0x00FF;
temp = temp << 4;
temp |= ((tempcx & 0xFF00) >> 8);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x19, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x19, temp);
/* 301b */
if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
| VB_XGI302LV | VB_XGI301C)) {
temp = 0x0028;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x1C, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x1C, temp);
tempax = pVBInfo->VGAHDE;
if (modeflag & HalfDCLK)
tempax = tempax >> 1;
@@ -5974,13 +6200,13 @@ void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex,
temp = (tempax & 0xFF00) >> 8;
temp = ((temp & 0x0003) << 4);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x1E, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x1E, temp);
temp = (tempax & 0x00FF);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x1D, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x1D, temp);
if (pVBInfo->VBInfo & (SetCRT2ToTV | SetCRT2ToHiVisionTV)) {
if (pVBInfo->VGAHDE > 800)
- XGINew_SetRegOR(pVBInfo->Part4Port, 0x1E, 0x08);
+ xgifb_reg_or(pVBInfo->Part4Port, 0x1E, 0x08);
}
temp = 0x0036;
@@ -5997,15 +6223,15 @@ void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex,
}
}
- XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x1F, 0x00C0, temp);
+ xgifb_reg_and_or(pVBInfo->Part4Port, 0x1F, 0x00C0, temp);
tempbx = pVBInfo->HT;
if (XGI_IsLCDDualLink(pVBInfo))
tempbx = tempbx >> 1;
tempbx = (tempbx >> 1) - 2;
temp = ((tempbx & 0x0700) >> 8) << 3;
- XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x21, 0x00C0, temp);
+ xgifb_reg_and_or(pVBInfo->Part4Port, 0x21, 0x00C0, temp);
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x22, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x22, temp);
}
/* end 301b */
@@ -6014,7 +6240,12 @@ void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex,
pVBInfo);
}
-void XGI_SetGroup5(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGINew_EnableCRT2(struct vb_device_info *pVBInfo)
+{
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x1E, 0xFF, 0x20);
+}
+
+static void XGI_SetGroup5(unsigned short ModeNo, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo)
{
unsigned short Pindex, Pdata;
@@ -6031,779 +6262,19 @@ void XGI_SetGroup5(unsigned short ModeNo, unsigned short ModeIdIndex,
return;
}
-void *XGI_GetLcdPtr(unsigned short BX, unsigned short ModeNo,
- unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
- struct vb_device_info *pVBInfo)
-{
- unsigned short i, tempdx, tempcx, tempbx, tempal, modeflag, table;
-
- struct XGI330_LCDDataTablStruct *tempdi = NULL;
-
- tempbx = BX;
-
- if (ModeNo <= 0x13) {
- modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
- tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
- } else {
- modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
- }
-
- tempal = tempal & 0x0f;
-
- if (tempbx <= 1) { /* ExpLink */
- if (ModeNo <= 0x13) {
- tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC; /* find no Ext_CRT2CRTC2 */
- } else {
- tempal
- = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
- }
-
- if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
- if (ModeNo <= 0x13)
- tempal
- = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC2;
- else
- tempal
- = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC2;
- }
-
- if (tempbx & 0x01)
- tempal = (tempal >> 4);
-
- tempal = (tempal & 0x0f);
- }
-
- tempcx = LCDLenList[tempbx]; /* mov cl,byte ptr cs:LCDLenList[bx] */
-
- if (pVBInfo->LCDInfo & EnableScalingLCD) { /* ScaleLCD */
- if ((tempbx == 5) || (tempbx) == 7)
- tempcx = LCDDesDataLen2;
- else if ((tempbx == 3) || (tempbx == 8))
- tempcx = LVDSDesDataLen2;
- }
- /* mov di, word ptr cs:LCDDataList[bx] */
- /* tempdi = pVideoMemory[LCDDataList + tempbx * 2] | (pVideoMemory[LCDDataList + tempbx * 2 + 1] << 8); */
-
- switch (tempbx) {
- case 0:
- tempdi = XGI_EPLLCDCRT1Ptr_H;
- break;
- case 1:
- tempdi = XGI_EPLLCDCRT1Ptr_V;
- break;
- case 2:
- tempdi = XGI_EPLLCDDataPtr;
- break;
- case 3:
- tempdi = XGI_EPLLCDDesDataPtr;
- break;
- case 4:
- tempdi = XGI_LCDDataTable;
- break;
- case 5:
- tempdi = XGI_LCDDesDataTable;
- break;
- case 6:
- tempdi = XGI_EPLCHLCDRegPtr;
- break;
- case 7:
- case 8:
- case 9:
- tempdi = NULL;
- break;
- default:
- break;
- }
-
- if (tempdi == NULL) /* OEMUtil */
- return NULL;
-
- table = tempbx;
- i = 0;
-
- while (tempdi[i].PANELID != 0xff) {
- tempdx = pVBInfo->LCDResInfo;
- if (tempbx & 0x0080) { /* OEMUtil */
- tempbx &= (~0x0080);
- tempdx = pVBInfo->LCDTypeInfo;
- }
-
- if (pVBInfo->LCDInfo & EnableScalingLCD)
- tempdx &= (~PanelResInfo);
-
- if (tempdi[i].PANELID == tempdx) {
- tempbx = tempdi[i].MASK;
- tempdx = pVBInfo->LCDInfo;
-
- if (ModeNo <= 0x13) /* alan 09/10/2003 */
- tempdx |= SetLCDStdMode;
-
- if (modeflag & HalfDCLK)
- tempdx |= SetLCDLowResolution;
-
- tempbx &= tempdx;
- if (tempbx == tempdi[i].CAP)
- break;
- }
- i++;
- }
-
- if (table == 0) {
- switch (tempdi[i].DATAPTR) {
- case 0:
- return &XGI_LVDSCRT11024x768_1_H[tempal];
- break;
- case 1:
- return &XGI_LVDSCRT11024x768_2_H[tempal];
- break;
- case 2:
- return &XGI_LVDSCRT11280x1024_1_H[tempal];
- break;
- case 3:
- return &XGI_LVDSCRT11280x1024_2_H[tempal];
- break;
- case 4:
- return &XGI_LVDSCRT11400x1050_1_H[tempal];
- break;
- case 5:
- return &XGI_LVDSCRT11400x1050_2_H[tempal];
- break;
- case 6:
- return &XGI_LVDSCRT11600x1200_1_H[tempal];
- break;
- case 7:
- return &XGI_LVDSCRT11024x768_1_Hx75[tempal];
- break;
- case 8:
- return &XGI_LVDSCRT11024x768_2_Hx75[tempal];
- break;
- case 9:
- return &XGI_LVDSCRT11280x1024_1_Hx75[tempal];
- break;
- case 10:
- return &XGI_LVDSCRT11280x1024_2_Hx75[tempal];
- break;
- default:
- break;
- }
- } else if (table == 1) {
- switch (tempdi[i].DATAPTR) {
- case 0:
- return &XGI_LVDSCRT11024x768_1_V[tempal];
- break;
- case 1:
- return &XGI_LVDSCRT11024x768_2_V[tempal];
- break;
- case 2:
- return &XGI_LVDSCRT11280x1024_1_V[tempal];
- break;
- case 3:
- return &XGI_LVDSCRT11280x1024_2_V[tempal];
- break;
- case 4:
- return &XGI_LVDSCRT11400x1050_1_V[tempal];
- break;
- case 5:
- return &XGI_LVDSCRT11400x1050_2_V[tempal];
- break;
- case 6:
- return &XGI_LVDSCRT11600x1200_1_V[tempal];
- break;
- case 7:
- return &XGI_LVDSCRT11024x768_1_Vx75[tempal];
- break;
- case 8:
- return &XGI_LVDSCRT11024x768_2_Vx75[tempal];
- break;
- case 9:
- return &XGI_LVDSCRT11280x1024_1_Vx75[tempal];
- break;
- case 10:
- return &XGI_LVDSCRT11280x1024_2_Vx75[tempal];
- break;
- default:
- break;
- }
- } else if (table == 2) {
- switch (tempdi[i].DATAPTR) {
- case 0:
- return &XGI_LVDS1024x768Data_1[tempal];
- break;
- case 1:
- return &XGI_LVDS1024x768Data_2[tempal];
- break;
- case 2:
- return &XGI_LVDS1280x1024Data_1[tempal];
- break;
- case 3:
- return &XGI_LVDS1280x1024Data_2[tempal];
- break;
- case 4:
- return &XGI_LVDS1400x1050Data_1[tempal];
- break;
- case 5:
- return &XGI_LVDS1400x1050Data_2[tempal];
- break;
- case 6:
- return &XGI_LVDS1600x1200Data_1[tempal];
- break;
- case 7:
- return &XGI_LVDSNoScalingData[tempal];
- break;
- case 8:
- return &XGI_LVDS1024x768Data_1x75[tempal];
- break;
- case 9:
- return &XGI_LVDS1024x768Data_2x75[tempal];
- break;
- case 10:
- return &XGI_LVDS1280x1024Data_1x75[tempal];
- break;
- case 11:
- return &XGI_LVDS1280x1024Data_2x75[tempal];
- break;
- case 12:
- return &XGI_LVDSNoScalingDatax75[tempal];
- break;
- default:
- break;
- }
- } else if (table == 3) {
- switch (tempdi[i].DATAPTR) {
- case 0:
- return &XGI_LVDS1024x768Des_1[tempal];
- break;
- case 1:
- return &XGI_LVDS1024x768Des_3[tempal];
- break;
- case 2:
- return &XGI_LVDS1024x768Des_2[tempal];
- break;
- case 3:
- return &XGI_LVDS1280x1024Des_1[tempal];
- break;
- case 4:
- return &XGI_LVDS1280x1024Des_2[tempal];
- break;
- case 5:
- return &XGI_LVDS1400x1050Des_1[tempal];
- break;
- case 6:
- return &XGI_LVDS1400x1050Des_2[tempal];
- break;
- case 7:
- return &XGI_LVDS1600x1200Des_1[tempal];
- break;
- case 8:
- return &XGI_LVDSNoScalingDesData[tempal];
- break;
- case 9:
- return &XGI_LVDS1024x768Des_1x75[tempal];
- break;
- case 10:
- return &XGI_LVDS1024x768Des_3x75[tempal];
- break;
- case 11:
- return &XGI_LVDS1024x768Des_2x75[tempal];
- break;
- case 12:
- return &XGI_LVDS1280x1024Des_1x75[tempal];
- break;
- case 13:
- return &XGI_LVDS1280x1024Des_2x75[tempal];
- break;
- case 14:
- return &XGI_LVDSNoScalingDesDatax75[tempal];
- break;
- default:
- break;
- }
- } else if (table == 4) {
- switch (tempdi[i].DATAPTR) {
- case 0:
- return &XGI_ExtLCD1024x768Data[tempal];
- break;
- case 1:
- return &XGI_StLCD1024x768Data[tempal];
- break;
- case 2:
- return &XGI_CetLCD1024x768Data[tempal];
- break;
- case 3:
- return &XGI_ExtLCD1280x1024Data[tempal];
- break;
- case 4:
- return &XGI_StLCD1280x1024Data[tempal];
- break;
- case 5:
- return &XGI_CetLCD1280x1024Data[tempal];
- break;
- case 6:
- return &XGI_ExtLCD1400x1050Data[tempal];
- break;
- case 7:
- return &XGI_StLCD1400x1050Data[tempal];
- break;
- case 8:
- return &XGI_CetLCD1400x1050Data[tempal];
- break;
- case 9:
- return &XGI_ExtLCD1600x1200Data[tempal];
- break;
- case 10:
- return &XGI_StLCD1600x1200Data[tempal];
- break;
- case 11:
- return &XGI_NoScalingData[tempal];
- break;
- case 12:
- return &XGI_ExtLCD1024x768x75Data[tempal];
- break;
- case 13:
- return &XGI_ExtLCD1024x768x75Data[tempal];
- break;
- case 14:
- return &XGI_CetLCD1024x768x75Data[tempal];
- break;
- case 15:
- return &XGI_ExtLCD1280x1024x75Data[tempal];
- break;
- case 16:
- return &XGI_StLCD1280x1024x75Data[tempal];
- break;
- case 17:
- return &XGI_CetLCD1280x1024x75Data[tempal];
- break;
- case 18:
- return &XGI_NoScalingDatax75[tempal];
- break;
- default:
- break;
- }
- } else if (table == 5) {
- switch (tempdi[i].DATAPTR) {
- case 0:
- return &XGI_ExtLCDDes1024x768Data[tempal];
- break;
- case 1:
- return &XGI_StLCDDes1024x768Data[tempal];
- break;
- case 2:
- return &XGI_CetLCDDes1024x768Data[tempal];
- break;
- case 3:
- if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
- & VB_XGI302LV))
- return &XGI_ExtLCDDLDes1280x1024Data[tempal];
- else
- return &XGI_ExtLCDDes1280x1024Data[tempal];
- break;
- case 4:
- if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
- & VB_XGI302LV))
- return &XGI_StLCDDLDes1280x1024Data[tempal];
- else
- return &XGI_StLCDDes1280x1024Data[tempal];
- break;
- case 5:
- if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
- & VB_XGI302LV))
- return &XGI_CetLCDDLDes1280x1024Data[tempal];
- else
- return &XGI_CetLCDDes1280x1024Data[tempal];
- break;
- case 6:
- if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
- & VB_XGI302LV))
- return &XGI_ExtLCDDLDes1400x1050Data[tempal];
- else
- return &XGI_ExtLCDDes1400x1050Data[tempal];
- break;
- case 7:
- if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
- & VB_XGI302LV))
- return &XGI_StLCDDLDes1400x1050Data[tempal];
- else
- return &XGI_StLCDDes1400x1050Data[tempal];
- break;
- case 8:
- return &XGI_CetLCDDes1400x1050Data[tempal];
- break;
- case 9:
- return &XGI_CetLCDDes1400x1050Data2[tempal];
- break;
- case 10:
- if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
- & VB_XGI302LV))
- return &XGI_ExtLCDDLDes1600x1200Data[tempal];
- else
- return &XGI_ExtLCDDes1600x1200Data[tempal];
- break;
- case 11:
- if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
- & VB_XGI302LV))
- return &XGI_StLCDDLDes1600x1200Data[tempal];
- else
- return &XGI_StLCDDes1600x1200Data[tempal];
- break;
- case 12:
- return &XGI_NoScalingDesData[tempal];
- break;
- case 13:
- return &XGI_ExtLCDDes1024x768x75Data[tempal];
- break;
- case 14:
- return &XGI_StLCDDes1024x768x75Data[tempal];
- break;
- case 15:
- return &XGI_CetLCDDes1024x768x75Data[tempal];
- break;
- case 16:
- if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
- & VB_XGI302LV))
- return &XGI_ExtLCDDLDes1280x1024x75Data[tempal];
- else
- return &XGI_ExtLCDDes1280x1024x75Data[tempal];
- break;
- case 17:
- if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
- & VB_XGI302LV))
- return &XGI_StLCDDLDes1280x1024x75Data[tempal];
- else
- return &XGI_StLCDDes1280x1024x75Data[tempal];
- break;
- case 18:
- if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
- & VB_XGI302LV))
- return &XGI_CetLCDDLDes1280x1024x75Data[tempal];
- else
- return &XGI_CetLCDDes1280x1024x75Data[tempal];
- break;
- case 19:
- return &XGI_NoScalingDesDatax75[tempal];
- break;
- default:
- break;
- }
- } else if (table == 6) {
- switch (tempdi[i].DATAPTR) {
- case 0:
- return &XGI_CH7017LV1024x768[tempal];
- break;
- case 1:
- return &XGI_CH7017LV1400x1050[tempal];
- break;
- default:
- break;
- }
- }
- return NULL;
-}
-
-void *XGI_GetTVPtr(unsigned short BX, unsigned short ModeNo,
- unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
+static void XGI_EnableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
- unsigned short i, tempdx, tempbx, tempal, modeflag, table;
- struct XGI330_TVDataTablStruct *tempdi = NULL;
-
- tempbx = BX;
-
- if (ModeNo <= 0x13) {
- modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
- tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
- } else {
- modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
- }
-
- tempal = tempal & 0x3f;
- table = tempbx;
-
- switch (tempbx) {
- case 0:
- tempdi = NULL; /*EPLCHTVCRT1Ptr_H;*/
- if (pVBInfo->IF_DEF_CH7007 == 1)
- tempdi = XGI_EPLCHTVCRT1Ptr;
-
- break;
- case 1:
- tempdi = NULL; /*EPLCHTVCRT1Ptr_V;*/
- if (pVBInfo->IF_DEF_CH7007 == 1)
- tempdi = XGI_EPLCHTVCRT1Ptr;
-
- break;
- case 2:
- tempdi = XGI_EPLCHTVDataPtr;
- break;
- case 3:
- tempdi = NULL;
- break;
- case 4:
- tempdi = XGI_TVDataTable;
- break;
- case 5:
- tempdi = NULL;
- break;
- case 6:
- tempdi = XGI_EPLCHTVRegPtr;
- break;
- default:
- break;
- }
-
- if (tempdi == NULL) /* OEMUtil */
- return NULL;
-
- tempdx = pVBInfo->TVInfo;
-
- if (pVBInfo->VBInfo & SetInSlaveMode)
- tempdx = tempdx | SetTVLockMode;
-
- if (modeflag & HalfDCLK)
- tempdx = tempdx | SetTVLowResolution;
-
- i = 0;
-
- while (tempdi[i].MASK != 0xffff) {
- if ((tempdx & tempdi[i].MASK) == tempdi[i].CAP)
- break;
- i++;
- }
-
- if (table == 0x00) { /* 07/05/22 */
- } else if (table == 0x01) {
- } else if (table == 0x04) {
- switch (tempdi[i].DATAPTR) {
- case 0:
- return &XGI_ExtPALData[tempal];
- break;
- case 1:
- return &XGI_ExtNTSCData[tempal];
- break;
- case 2:
- return &XGI_StPALData[tempal];
- break;
- case 3:
- return &XGI_StNTSCData[tempal];
- break;
- case 4:
- return &XGI_ExtHiTVData[tempal];
- break;
- case 5:
- return &XGI_St2HiTVData[tempal];
- break;
- case 6:
- return &XGI_ExtYPbPr525iData[tempal];
- break;
- case 7:
- return &XGI_ExtYPbPr525pData[tempal];
- break;
- case 8:
- return &XGI_ExtYPbPr750pData[tempal];
- break;
- case 9:
- return &XGI_StYPbPr525iData[tempal];
- break;
- case 10:
- return &XGI_StYPbPr525pData[tempal];
- break;
- case 11:
- return &XGI_StYPbPr750pData[tempal];
- break;
- case 12: /* avoid system hang */
- return &XGI_ExtNTSCData[tempal];
- break;
- case 13:
- return &XGI_St1HiTVData[tempal];
- break;
- default:
- break;
- }
- } else if (table == 0x02) {
- switch (tempdi[i].DATAPTR) {
- case 0:
- return &XGI_CHTVUNTSCData[tempal];
- break;
- case 1:
- return &XGI_CHTVONTSCData[tempal];
- break;
- case 2:
- return &XGI_CHTVUPALData[tempal];
- break;
- case 3:
- return &XGI_CHTVOPALData[tempal];
- break;
- default:
- break;
- }
- } else if (table == 0x06) {
- }
- return NULL;
-}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_BacklightByDrv */
-/* Input : */
-/* Output : 1 -> Skip backlight control */
-/* Description : */
-/* --------------------------------------------------------------------- */
-unsigned char XGI_BacklightByDrv(struct vb_device_info *pVBInfo)
-{
- unsigned char tempah;
-
- tempah = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x3A);
- if (tempah & BacklightControlBit)
- return 1;
- else
- return 0;
-}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_FirePWDDisable */
-/* Input : */
-/* Output : */
-/* Description : Turn off VDD & Backlight : Fire disable procedure */
-/* --------------------------------------------------------------------- */
-/*
-void XGI_FirePWDDisable(struct vb_device_info *pVBInfo)
-{
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x26, 0x00, 0xFC);
-}
-*/
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_FirePWDEnable */
-/* Input : */
-/* Output : */
-/* Description : Turn on VDD & Backlight : Fire enable procedure */
-/* --------------------------------------------------------------------- */
-void XGI_FirePWDEnable(struct vb_device_info *pVBInfo)
-{
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x26, 0x03, 0xFC);
-}
-
-void XGI_EnableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo)
-{
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x63, 0xBF, 0x40);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x63, 0xBF, 0x40);
}
-void XGI_DisableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension,
+static void XGI_DisableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x63, 0xBF, 0x00);
-}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetPanelDelay */
-/* Input : */
-/* Output : */
-/* Description : */
-/* I/P : bl : 1 ; T1 : the duration between CPL on and signal on */
-/* : bl : 2 ; T2 : the duration signal on and Vdd on */
-/* : bl : 3 ; T3 : the duration between CPL off and signal off */
-/* : bl : 4 ; T4 : the duration signal off and Vdd off */
-/* --------------------------------------------------------------------- */
-void XGI_SetPanelDelay(unsigned short tempbl, struct vb_device_info *pVBInfo)
-{
- unsigned short index;
-
- index = XGI_GetLCDCapPtr(pVBInfo);
-
- if (tempbl == 1)
- XGINew_LCD_Wait_Time(pVBInfo->LCDCapList[index].PSC_S1, pVBInfo);
-
- if (tempbl == 2)
- XGINew_LCD_Wait_Time(pVBInfo->LCDCapList[index].PSC_S2, pVBInfo);
-
- if (tempbl == 3)
- XGINew_LCD_Wait_Time(pVBInfo->LCDCapList[index].PSC_S3, pVBInfo);
-
- if (tempbl == 4)
- XGINew_LCD_Wait_Time(pVBInfo->LCDCapList[index].PSC_S4, pVBInfo);
-}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetPanelPower */
-/* Input : */
-/* Output : */
-/* Description : */
-/* I/O : ah = 0011b = 03h ; Backlight on, Power on */
-/* = 0111b = 07h ; Backlight on, Power off */
-/* = 1011b = 0Bh ; Backlight off, Power on */
-/* = 1111b = 0Fh ; Backlight off, Power off */
-/* --------------------------------------------------------------------- */
-void XGI_SetPanelPower(unsigned short tempah, unsigned short tempbl,
- struct vb_device_info *pVBInfo)
-{
- if (pVBInfo->VBType & (VB_XGI301LV | VB_XGI302LV | VB_XGI301C))
- XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x26, tempbl, tempah);
- else
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x11, tempbl, tempah);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x63, 0xBF, 0x00);
}
-static unsigned char XG21GPIODataTransfer(unsigned char ujDate)
-{
- unsigned char ujRet = 0;
- unsigned char i = 0;
-
- for (i = 0; i < 8; i++) {
- ujRet = ujRet << 1;
- /* ujRet |= GETBITS(ujDate >> i, 0:0); */
- ujRet |= (ujDate >> i) & 1;
- }
-
- return ujRet;
-}
-
-/*----------------------------------------------------------------------------*/
-/* output */
-/* bl[5] : LVDS signal */
-/* bl[1] : LVDS backlight */
-/* bl[0] : LVDS VDD */
-/*----------------------------------------------------------------------------*/
-unsigned char XGI_XG21GetPSCValue(struct vb_device_info *pVBInfo)
-{
- unsigned char CR4A, temp;
-
- CR4A = XGINew_GetReg1(pVBInfo->P3d4, 0x4A);
- XGINew_SetRegAND(pVBInfo->P3d4, 0x4A, ~0x23); /* enable GPIO write */
-
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x48);
-
- temp = XG21GPIODataTransfer(temp);
- temp &= 0x23;
- XGINew_SetReg1(pVBInfo->P3d4, 0x4A, CR4A);
- return temp;
-}
-
-/*----------------------------------------------------------------------------*/
-/* output */
-/* bl[5] : LVDS signal */
-/* bl[1] : LVDS backlight */
-/* bl[0] : LVDS VDD */
-/*----------------------------------------------------------------------------*/
-unsigned char XGI_XG27GetPSCValue(struct vb_device_info *pVBInfo)
-{
- unsigned char CR4A, CRB4, temp;
-
- CR4A = XGINew_GetReg1(pVBInfo->P3d4, 0x4A);
- XGINew_SetRegAND(pVBInfo->P3d4, 0x4A, ~0x0C); /* enable GPIO write */
-
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x48);
-
- temp &= 0x0C;
- temp >>= 2;
- XGINew_SetReg1(pVBInfo->P3d4, 0x4A, CR4A);
- CRB4 = XGINew_GetReg1(pVBInfo->P3d4, 0xB4);
- temp |= ((CRB4 & 0x04) << 3);
- return temp;
-}
/*----------------------------------------------------------------------------*/
/* input */
/* bl[5] : 1;LVDS signal on */
@@ -6818,24 +6289,24 @@ void XGI_XG21BLSignalVDD(unsigned short tempbh, unsigned short tempbl,
{
unsigned char CR4A, temp;
- CR4A = XGINew_GetReg1(pVBInfo->P3d4, 0x4A);
+ CR4A = xgifb_reg_get(pVBInfo->P3d4, 0x4A);
tempbh &= 0x23;
tempbl &= 0x23;
- XGINew_SetRegAND(pVBInfo->P3d4, 0x4A, ~tempbh); /* enable GPIO write */
+ xgifb_reg_and(pVBInfo->P3d4, 0x4A, ~tempbh); /* enable GPIO write */
if (tempbh & 0x20) {
temp = (tempbl >> 4) & 0x02;
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0xB4, ~0x02, temp); /* CR B4[1] */
+ xgifb_reg_and_or(pVBInfo->P3d4, 0xB4, ~0x02, temp); /* CR B4[1] */
}
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x48);
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x48);
temp = XG21GPIODataTransfer(temp);
temp &= ~tempbh;
temp |= tempbl;
- XGINew_SetReg1(pVBInfo->P3d4, 0x48, temp);
+ xgifb_reg_set(pVBInfo->P3d4, 0x48, temp);
}
void XGI_XG27BLSignalVDD(unsigned short tempbh, unsigned short tempbl,
@@ -6854,18 +6325,18 @@ void XGI_XG27BLSignalVDD(unsigned short tempbh, unsigned short tempbl,
if (tempbh & 0x20) {
temp = (tempbl >> 4) & 0x02;
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0xB4, ~0x02, temp); /* CR B4[1] */
+ xgifb_reg_and_or(pVBInfo->P3d4, 0xB4, ~0x02, temp); /* CR B4[1] */
}
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0xB4, ~tempbh0, tempbl0);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0xB4, ~tempbh0, tempbl0);
- CR4A = XGINew_GetReg1(pVBInfo->P3d4, 0x4A);
+ CR4A = xgifb_reg_get(pVBInfo->P3d4, 0x4A);
tempbh &= 0x03;
tempbl &= 0x03;
tempbh <<= 2;
tempbl <<= 2; /* GPIOC,GPIOD */
- XGINew_SetRegAND(pVBInfo->P3d4, 0x4A, ~tempbh); /* enable GPIO write */
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x48, ~tempbh, tempbl);
+ xgifb_reg_and(pVBInfo->P3d4, 0x4A, ~tempbh); /* enable GPIO write */
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x48, ~tempbh, tempbl);
}
/* --------------------------------------------------------------------- */
@@ -6873,7 +6344,7 @@ unsigned short XGI_GetLVDSOEMTableIndex(struct vb_device_info *pVBInfo)
{
unsigned short index;
- index = XGINew_GetReg1(pVBInfo->P3d4, 0x36);
+ index = xgifb_reg_get(pVBInfo->P3d4, 0x36);
if (index < sizeof(XGI21_LCDCapList)
/ sizeof(struct XGI21_LVDSCapStruct))
return index;
@@ -6897,20 +6368,16 @@ void XGI_XG21SetPanelDelay(unsigned short tempbl,
index = XGI_GetLVDSOEMTableIndex(pVBInfo);
if (tempbl == 1)
- XGINew_LCD_Wait_Time(pVBInfo->XG21_LVDSCapList[index].PSC_S1,
- pVBInfo);
+ mdelay(pVBInfo->XG21_LVDSCapList[index].PSC_S1);
if (tempbl == 2)
- XGINew_LCD_Wait_Time(pVBInfo->XG21_LVDSCapList[index].PSC_S2,
- pVBInfo);
+ mdelay(pVBInfo->XG21_LVDSCapList[index].PSC_S2);
if (tempbl == 3)
- XGINew_LCD_Wait_Time(pVBInfo->XG21_LVDSCapList[index].PSC_S3,
- pVBInfo);
+ mdelay(pVBInfo->XG21_LVDSCapList[index].PSC_S3);
if (tempbl == 4)
- XGINew_LCD_Wait_Time(pVBInfo->XG21_LVDSCapList[index].PSC_S4,
- pVBInfo);
+ mdelay(pVBInfo->XG21_LVDSCapList[index].PSC_S4);
}
unsigned char XGI_XG21CheckLVDSMode(unsigned short ModeNo,
@@ -6970,10 +6437,10 @@ void XGI_SetXG21FPBits(struct vb_device_info *pVBInfo)
{
unsigned char temp;
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x37); /* D[0] 1: 18bit */
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x37); /* D[0] 1: 18bit */
temp = (temp & 1) << 6;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x06, ~0x40, temp); /* SR06[6] 18bit Dither */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x09, ~0xc0, temp | 0x80); /* SR09[7] enable FP output, SR09[6] 1: sigle 18bits, 0: dual 12bits */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x06, ~0x40, temp); /* SR06[6] 18bit Dither */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x09, ~0xc0, temp | 0x80); /* SR09[7] enable FP output, SR09[6] 1: sigle 18bits, 0: dual 12bits */
}
@@ -6981,14 +6448,14 @@ void XGI_SetXG27FPBits(struct vb_device_info *pVBInfo)
{
unsigned char temp;
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x37); /* D[1:0] 01: 18bit, 00: dual 12, 10: single 24 */
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x37); /* D[1:0] 01: 18bit, 00: dual 12, 10: single 24 */
temp = (temp & 3) << 6;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x06, ~0xc0, temp & 0x80); /* SR06[7]0: dual 12/1: single 24 [6] 18bit Dither <= 0 h/w recommend */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x09, ~0xc0, temp | 0x80); /* SR09[7] enable FP output, SR09[6] 1: sigle 18bits, 0: 24bits */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x06, ~0xc0, temp & 0x80); /* SR06[7]0: dual 12/1: single 24 [6] 18bit Dither <= 0 h/w recommend */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x09, ~0xc0, temp | 0x80); /* SR09[7] enable FP output, SR09[6] 1: sigle 18bits, 0: 24bits */
}
-void XGI_SetXG21LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetXG21LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo)
{
unsigned char temp, Miscdata;
@@ -7002,14 +6469,14 @@ void XGI_SetXG21LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex,
temp = (unsigned char) ((pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability
& (LCDPolarity << 8)) >> 8);
temp &= LCDPolarity;
- Miscdata = (unsigned char) XGINew_GetReg2(pVBInfo->P3cc);
+ Miscdata = (unsigned char) inb(pVBInfo->P3cc);
- XGINew_SetReg3(pVBInfo->P3c2, (Miscdata & 0x3F) | temp);
+ outb((Miscdata & 0x3F) | temp, pVBInfo->P3c2);
temp = (unsigned char) (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability
& LCDPolarity);
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x35, ~0x80, temp & 0x80); /* SR35[7] FP VSync polarity */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x30, ~0x20, (temp & 0x40) >> 1); /* SR30[5] FP HSync polarity */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x80, temp & 0x80); /* SR35[7] FP VSync polarity */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x30, ~0x20, (temp & 0x40) >> 1); /* SR30[5] FP HSync polarity */
XGI_SetXG21FPBits(pVBInfo);
resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo);
@@ -7068,113 +6535,113 @@ void XGI_SetXG21LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex,
LVDSVBE = LVDSVBS + LVDSVT
- pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE;
- temp = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x11);
- XGINew_SetReg1(pVBInfo->P3d4, 0x11, temp & 0x7f); /* Unlock CRTC */
+ temp = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x11);
+ xgifb_reg_set(pVBInfo->P3d4, 0x11, temp & 0x7f); /* Unlock CRTC */
if (!(modeflag & Charx8Dot))
- XGINew_SetRegOR(pVBInfo->P3c4, 0x1, 0x1);
+ xgifb_reg_or(pVBInfo->P3c4, 0x1, 0x1);
/* HT SR0B[1:0] CR00 */
value = (LVDSHT >> 3) - 5;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0B, ~0x03, (value & 0x300) >> 8);
- XGINew_SetReg1(pVBInfo->P3d4, 0x0, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0B, ~0x03, (value & 0x300) >> 8);
+ xgifb_reg_set(pVBInfo->P3d4, 0x0, (value & 0xFF));
/* HBS SR0B[5:4] CR02 */
value = (LVDSHBS >> 3) - 1;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0B, ~0x30, (value & 0x300) >> 4);
- XGINew_SetReg1(pVBInfo->P3d4, 0x2, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0B, ~0x30, (value & 0x300) >> 4);
+ xgifb_reg_set(pVBInfo->P3d4, 0x2, (value & 0xFF));
/* HBE SR0C[1:0] CR05[7] CR03[4:0] */
value = (LVDSHBE >> 3) - 1;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0C, ~0x03, (value & 0xC0) >> 6);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x05, ~0x80, (value & 0x20) << 2);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x03, ~0x1F, value & 0x1F);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0C, ~0x03, (value & 0xC0) >> 6);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x05, ~0x80, (value & 0x20) << 2);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x03, ~0x1F, value & 0x1F);
/* HRS SR0B[7:6] CR04 */
value = (LVDSHRS >> 3) + 2;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0B, ~0xC0, (value & 0x300) >> 2);
- XGINew_SetReg1(pVBInfo->P3d4, 0x4, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0B, ~0xC0, (value & 0x300) >> 2);
+ xgifb_reg_set(pVBInfo->P3d4, 0x4, (value & 0xFF));
/* Panel HRS SR2F[1:0] SR2E[7:0] */
value--;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x2F, ~0x03, (value & 0x300) >> 8);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2E, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x2F, ~0x03, (value & 0x300) >> 8);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2E, (value & 0xFF));
/* HRE SR0C[2] CR05[4:0] */
value = (LVDSHRE >> 3) + 2;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0C, ~0x04, (value & 0x20) >> 3);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x05, ~0x1F, value & 0x1F);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0C, ~0x04, (value & 0x20) >> 3);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x05, ~0x1F, value & 0x1F);
/* Panel HRE SR2F[7:2] */
value--;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x2F, ~0xFC, value << 2);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x2F, ~0xFC, value << 2);
/* VT SR0A[0] CR07[5][0] CR06 */
value = LVDSVT - 2;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x01, (value & 0x400) >> 10);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x20, (value & 0x200) >> 4);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x01, (value & 0x100) >> 8);
- XGINew_SetReg1(pVBInfo->P3d4, 0x06, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0A, ~0x01, (value & 0x400) >> 10);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x20, (value & 0x200) >> 4);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x01, (value & 0x100) >> 8);
+ xgifb_reg_set(pVBInfo->P3d4, 0x06, (value & 0xFF));
/* VBS SR0A[2] CR09[5] CR07[3] CR15 */
value = LVDSVBS - 1;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x04, (value & 0x400) >> 8);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x09, ~0x20, (value & 0x200) >> 4);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x08, (value & 0x100) >> 5);
- XGINew_SetReg1(pVBInfo->P3d4, 0x15, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0A, ~0x04, (value & 0x400) >> 8);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x09, ~0x20, (value & 0x200) >> 4);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x08, (value & 0x100) >> 5);
+ xgifb_reg_set(pVBInfo->P3d4, 0x15, (value & 0xFF));
/* VBE SR0A[4] CR16 */
value = LVDSVBE - 1;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x10, (value & 0x100) >> 4);
- XGINew_SetReg1(pVBInfo->P3d4, 0x16, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0A, ~0x10, (value & 0x100) >> 4);
+ xgifb_reg_set(pVBInfo->P3d4, 0x16, (value & 0xFF));
/* VRS SR0A[3] CR7[7][2] CR10 */
value = LVDSVRS - 1;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x08, (value & 0x400) >> 7);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x80, (value & 0x200) >> 2);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x04, (value & 0x100) >> 6);
- XGINew_SetReg1(pVBInfo->P3d4, 0x10, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0A, ~0x08, (value & 0x400) >> 7);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x80, (value & 0x200) >> 2);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x04, (value & 0x100) >> 6);
+ xgifb_reg_set(pVBInfo->P3d4, 0x10, (value & 0xFF));
/* Panel VRS SR3F[1:0] SR34[7:0] SR33[0] */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x3F, ~0x03, (value & 0x600) >> 9);
- XGINew_SetReg1(pVBInfo->P3c4, 0x34, (value >> 1) & 0xFF);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x33, ~0x01, value & 0x01);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x3F, ~0x03, (value & 0x600) >> 9);
+ xgifb_reg_set(pVBInfo->P3c4, 0x34, (value >> 1) & 0xFF);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x33, ~0x01, value & 0x01);
/* VRE SR0A[5] CR11[3:0] */
value = LVDSVRE - 1;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x20, (value & 0x10) << 1);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x11, ~0x0F, value & 0x0F);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0A, ~0x20, (value & 0x10) << 1);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x11, ~0x0F, value & 0x0F);
/* Panel VRE SR3F[7:2] *//* SR3F[7] has to be 0, h/w bug */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x3F, ~0xFC, (value << 2) & 0x7C);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x3F, ~0xFC, (value << 2) & 0x7C);
for (temp = 0, value = 0; temp < 3; temp++) {
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x31, ~0x30, value);
- XGINew_SetReg1(pVBInfo->P3c4,
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x31, ~0x30, value);
+ xgifb_reg_set(pVBInfo->P3c4,
0x2B,
pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData1);
- XGINew_SetReg1(pVBInfo->P3c4,
+ xgifb_reg_set(pVBInfo->P3c4,
0x2C,
pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData2);
value += 0x10;
}
if (!(modeflag & Charx8Dot)) {
- XGINew_GetReg2(pVBInfo->P3da); /* reset 3da */
- XGINew_SetReg3(pVBInfo->P3c0, 0x13); /* set index */
- XGINew_SetReg3(pVBInfo->P3c0, 0x00); /* set data, panning = 0, shift left 1 dot*/
+ inb(pVBInfo->P3da); /* reset 3da */
+ outb(0x13, pVBInfo->P3c0); /* set index */
+ outb(0x00, pVBInfo->P3c0); /* set data, panning = 0, shift left 1 dot*/
- XGINew_GetReg2(pVBInfo->P3da); /* Enable Attribute */
- XGINew_SetReg3(pVBInfo->P3c0, 0x20);
+ inb(pVBInfo->P3da); /* Enable Attribute */
+ outb(0x20, pVBInfo->P3c0);
- XGINew_GetReg2(pVBInfo->P3da); /* reset 3da */
+ inb(pVBInfo->P3da); /* reset 3da */
}
}
/* no shadow case */
-void XGI_SetXG27LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetXG27LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo)
{
unsigned char temp, Miscdata;
@@ -7187,14 +6654,14 @@ void XGI_SetXG27LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex,
temp = (unsigned char) ((pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability
& (LCDPolarity << 8)) >> 8);
temp &= LCDPolarity;
- Miscdata = (unsigned char) XGINew_GetReg2(pVBInfo->P3cc);
+ Miscdata = (unsigned char) inb(pVBInfo->P3cc);
- XGINew_SetReg3(pVBInfo->P3c2, (Miscdata & 0x3F) | temp);
+ outb((Miscdata & 0x3F) | temp, pVBInfo->P3c2);
temp = (unsigned char) (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability
& LCDPolarity);
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x35, ~0x80, temp & 0x80); /* SR35[7] FP VSync polarity */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x30, ~0x20, (temp & 0x40) >> 1); /* SR30[5] FP HSync polarity */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x80, temp & 0x80); /* SR35[7] FP VSync polarity */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x30, ~0x20, (temp & 0x40) >> 1); /* SR30[5] FP HSync polarity */
XGI_SetXG27FPBits(pVBInfo);
resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo);
@@ -7253,106 +6720,106 @@ void XGI_SetXG27LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex,
LVDSVBE = LVDSVBS + LVDSVT
- pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE;
- temp = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x11);
- XGINew_SetReg1(pVBInfo->P3d4, 0x11, temp & 0x7f); /* Unlock CRTC */
+ temp = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x11);
+ xgifb_reg_set(pVBInfo->P3d4, 0x11, temp & 0x7f); /* Unlock CRTC */
if (!(modeflag & Charx8Dot))
- XGINew_SetRegOR(pVBInfo->P3c4, 0x1, 0x1);
+ xgifb_reg_or(pVBInfo->P3c4, 0x1, 0x1);
/* HT SR0B[1:0] CR00 */
value = (LVDSHT >> 3) - 5;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0B, ~0x03, (value & 0x300) >> 8);
- XGINew_SetReg1(pVBInfo->P3d4, 0x0, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0B, ~0x03, (value & 0x300) >> 8);
+ xgifb_reg_set(pVBInfo->P3d4, 0x0, (value & 0xFF));
/* HBS SR0B[5:4] CR02 */
value = (LVDSHBS >> 3) - 1;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0B, ~0x30, (value & 0x300) >> 4);
- XGINew_SetReg1(pVBInfo->P3d4, 0x2, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0B, ~0x30, (value & 0x300) >> 4);
+ xgifb_reg_set(pVBInfo->P3d4, 0x2, (value & 0xFF));
/* HBE SR0C[1:0] CR05[7] CR03[4:0] */
value = (LVDSHBE >> 3) - 1;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0C, ~0x03, (value & 0xC0) >> 6);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x05, ~0x80, (value & 0x20) << 2);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x03, ~0x1F, value & 0x1F);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0C, ~0x03, (value & 0xC0) >> 6);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x05, ~0x80, (value & 0x20) << 2);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x03, ~0x1F, value & 0x1F);
/* HRS SR0B[7:6] CR04 */
value = (LVDSHRS >> 3) + 2;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0B, ~0xC0, (value & 0x300) >> 2);
- XGINew_SetReg1(pVBInfo->P3d4, 0x4, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0B, ~0xC0, (value & 0x300) >> 2);
+ xgifb_reg_set(pVBInfo->P3d4, 0x4, (value & 0xFF));
/* Panel HRS SR2F[1:0] SR2E[7:0] */
value--;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x2F, ~0x03, (value & 0x300) >> 8);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2E, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x2F, ~0x03, (value & 0x300) >> 8);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2E, (value & 0xFF));
/* HRE SR0C[2] CR05[4:0] */
value = (LVDSHRE >> 3) + 2;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0C, ~0x04, (value & 0x20) >> 3);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x05, ~0x1F, value & 0x1F);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0C, ~0x04, (value & 0x20) >> 3);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x05, ~0x1F, value & 0x1F);
/* Panel HRE SR2F[7:2] */
value--;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x2F, ~0xFC, value << 2);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x2F, ~0xFC, value << 2);
/* VT SR0A[0] CR07[5][0] CR06 */
value = LVDSVT - 2;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x01, (value & 0x400) >> 10);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x20, (value & 0x200) >> 4);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x01, (value & 0x100) >> 8);
- XGINew_SetReg1(pVBInfo->P3d4, 0x06, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0A, ~0x01, (value & 0x400) >> 10);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x20, (value & 0x200) >> 4);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x01, (value & 0x100) >> 8);
+ xgifb_reg_set(pVBInfo->P3d4, 0x06, (value & 0xFF));
/* VBS SR0A[2] CR09[5] CR07[3] CR15 */
value = LVDSVBS - 1;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x04, (value & 0x400) >> 8);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x09, ~0x20, (value & 0x200) >> 4);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x08, (value & 0x100) >> 5);
- XGINew_SetReg1(pVBInfo->P3d4, 0x15, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0A, ~0x04, (value & 0x400) >> 8);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x09, ~0x20, (value & 0x200) >> 4);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x08, (value & 0x100) >> 5);
+ xgifb_reg_set(pVBInfo->P3d4, 0x15, (value & 0xFF));
/* VBE SR0A[4] CR16 */
value = LVDSVBE - 1;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x10, (value & 0x100) >> 4);
- XGINew_SetReg1(pVBInfo->P3d4, 0x16, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0A, ~0x10, (value & 0x100) >> 4);
+ xgifb_reg_set(pVBInfo->P3d4, 0x16, (value & 0xFF));
/* VRS SR0A[3] CR7[7][2] CR10 */
value = LVDSVRS - 1;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x08, (value & 0x400) >> 7);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x80, (value & 0x200) >> 2);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x04, (value & 0x100) >> 6);
- XGINew_SetReg1(pVBInfo->P3d4, 0x10, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0A, ~0x08, (value & 0x400) >> 7);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x80, (value & 0x200) >> 2);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x04, (value & 0x100) >> 6);
+ xgifb_reg_set(pVBInfo->P3d4, 0x10, (value & 0xFF));
/* Panel VRS SR35[2:0] SR34[7:0] */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x35, ~0x07, (value & 0x700) >> 8);
- XGINew_SetReg1(pVBInfo->P3c4, 0x34, value & 0xFF);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x07, (value & 0x700) >> 8);
+ xgifb_reg_set(pVBInfo->P3c4, 0x34, value & 0xFF);
/* VRE SR0A[5] CR11[3:0] */
value = LVDSVRE - 1;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x20, (value & 0x10) << 1);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x11, ~0x0F, value & 0x0F);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0A, ~0x20, (value & 0x10) << 1);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x11, ~0x0F, value & 0x0F);
/* Panel VRE SR3F[7:2] */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x3F, ~0xFC, (value << 2) & 0xFC);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x3F, ~0xFC, (value << 2) & 0xFC);
for (temp = 0, value = 0; temp < 3; temp++) {
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x31, ~0x30, value);
- XGINew_SetReg1(pVBInfo->P3c4,
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x31, ~0x30, value);
+ xgifb_reg_set(pVBInfo->P3c4,
0x2B,
pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData1);
- XGINew_SetReg1(pVBInfo->P3c4,
+ xgifb_reg_set(pVBInfo->P3c4,
0x2C,
pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData2);
value += 0x10;
}
if (!(modeflag & Charx8Dot)) {
- XGINew_GetReg2(pVBInfo->P3da); /* reset 3da */
- XGINew_SetReg3(pVBInfo->P3c0, 0x13); /* set index */
- XGINew_SetReg3(pVBInfo->P3c0, 0x00); /* set data, panning = 0, shift left 1 dot*/
+ inb(pVBInfo->P3da); /* reset 3da */
+ outb(0x13, pVBInfo->P3c0); /* set index */
+ outb(0x00, pVBInfo->P3c0); /* set data, panning = 0, shift left 1 dot*/
- XGINew_GetReg2(pVBInfo->P3da); /* Enable Attribute */
- XGINew_SetReg3(pVBInfo->P3c0, 0x20);
+ inb(pVBInfo->P3da); /* Enable Attribute */
+ outb(0x20, pVBInfo->P3c0);
- XGINew_GetReg2(pVBInfo->P3da); /* reset 3da */
+ inb(pVBInfo->P3da); /* reset 3da */
}
}
@@ -7364,7 +6831,7 @@ void XGI_SetXG27LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex,
/* 1: Disable PSC */
/* Description : */
/* --------------------------------------------------------------------- */
-unsigned char XGI_IsLCDON(struct vb_device_info *pVBInfo)
+static unsigned char XGI_IsLCDON(struct vb_device_info *pVBInfo)
{
unsigned short tempax;
@@ -7377,41 +6844,18 @@ unsigned char XGI_IsLCDON(struct vb_device_info *pVBInfo)
return 0;
}
-void XGI_EnablePWD(struct vb_device_info *pVBInfo)
-{
- unsigned short index, temp;
-
- index = XGI_GetLCDCapPtr(pVBInfo);
- temp = pVBInfo->LCDCapList[index].PWD_2B;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x2B, temp);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x2C,
- pVBInfo->LCDCapList[index].PWD_2C);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x2D,
- pVBInfo->LCDCapList[index].PWD_2D);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x2E,
- pVBInfo->LCDCapList[index].PWD_2E);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x2F,
- pVBInfo->LCDCapList[index].PWD_2F);
- XGINew_SetRegOR(pVBInfo->Part4Port, 0x27, 0x80); /* enable PWD */
-}
-
-void XGI_DisablePWD(struct vb_device_info *pVBInfo)
-{
- XGINew_SetRegAND(pVBInfo->Part4Port, 0x27, 0x7F); /* disable PWD */
-}
-
/* --------------------------------------------------------------------- */
/* Function : XGI_DisableChISLCD */
/* Input : */
/* Output : 0 -> Not LCD Mode */
/* Description : */
/* --------------------------------------------------------------------- */
-unsigned char XGI_DisableChISLCD(struct vb_device_info *pVBInfo)
+static unsigned char XGI_DisableChISLCD(struct vb_device_info *pVBInfo)
{
unsigned short tempbx, tempah;
tempbx = pVBInfo->SetFlag & (DisableChA | DisableChB);
- tempah = ~((unsigned short) XGINew_GetReg1(pVBInfo->Part1Port, 0x2E));
+ tempah = ~((unsigned short) xgifb_reg_get(pVBInfo->Part1Port, 0x2E));
if (tempbx & (EnableChA | DisableChA)) {
if (!(tempah & 0x08)) /* Chk LCDA Mode */
@@ -7433,12 +6877,12 @@ unsigned char XGI_DisableChISLCD(struct vb_device_info *pVBInfo)
/* Output : 0 -> Not LCD mode */
/* Description : */
/* --------------------------------------------------------------------- */
-unsigned char XGI_EnableChISLCD(struct vb_device_info *pVBInfo)
+static unsigned char XGI_EnableChISLCD(struct vb_device_info *pVBInfo)
{
unsigned short tempbx, tempah;
tempbx = pVBInfo->SetFlag & (EnableChA | EnableChB);
- tempah = ~((unsigned short) XGINew_GetReg1(pVBInfo->Part1Port, 0x2E));
+ tempah = ~((unsigned short) xgifb_reg_get(pVBInfo->Part1Port, 0x2E));
if (tempbx & (EnableChA | DisableChA)) {
if (!(tempah & 0x08)) /* Chk LCDA Mode */
@@ -7454,298 +6898,14 @@ unsigned char XGI_EnableChISLCD(struct vb_device_info *pVBInfo)
return 0;
}
-unsigned short XGI_GetLCDCapPtr(struct vb_device_info *pVBInfo)
-{
- unsigned char tempal, tempah, tempbl, i;
-
- tempah = XGINew_GetReg1(pVBInfo->P3d4, 0x36);
- tempal = tempah & 0x0F;
- tempah = tempah & 0xF0;
- i = 0;
- tempbl = pVBInfo->LCDCapList[i].LCD_ID;
-
- while (tempbl != 0xFF) {
- if (tempbl & 0x80) { /* OEMUtil */
- tempal = tempah;
- tempbl = tempbl & ~(0x80);
- }
-
- if (tempal == tempbl)
- break;
-
- i++;
-
- tempbl = pVBInfo->LCDCapList[i].LCD_ID;
- }
-
- return i;
-}
-
-unsigned short XGI_GetLCDCapPtr1(struct vb_device_info *pVBInfo)
-{
- unsigned short tempah, tempal, tempbl, i;
-
- tempal = pVBInfo->LCDResInfo;
- tempah = pVBInfo->LCDTypeInfo;
-
- i = 0;
- tempbl = pVBInfo->LCDCapList[i].LCD_ID;
-
- while (tempbl != 0xFF) {
- if ((tempbl & 0x80) && (tempbl != 0x80)) {
- tempal = tempah;
- tempbl &= ~0x80;
- }
-
- if (tempal == tempbl)
- break;
-
- i++;
- tempbl = pVBInfo->LCDCapList[i].LCD_ID;
- }
-
- if (tempbl == 0xFF) {
- pVBInfo->LCDResInfo = Panel1024x768;
- pVBInfo->LCDTypeInfo = 0;
- i = 0;
- }
-
- return i;
-}
-
-void XGI_GetLCDSync(unsigned short *HSyncWidth, unsigned short *VSyncWidth,
- struct vb_device_info *pVBInfo)
-{
- unsigned short Index;
-
- Index = XGI_GetLCDCapPtr(pVBInfo);
- *HSyncWidth = pVBInfo->LCDCapList[Index].LCD_HSyncWidth;
- *VSyncWidth = pVBInfo->LCDCapList[Index].LCD_VSyncWidth;
-
- return;
-}
-
-void XGI_EnableBridge(struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo)
-{
- unsigned short tempbl, tempah;
-
- if (pVBInfo->SetFlag == Win9xDOSMode) {
- if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
- | VB_XGI302LV | VB_XGI301C)) {
- XGI_DisplayOn(HwDeviceExtension, pVBInfo);
- return;
- } else
- /* LVDS or CH7017 */
- return;
- }
-
- if (HwDeviceExtension->jChipType < XG40) {
- if (!XGI_DisableChISLCD(pVBInfo)) {
- if ((XGI_EnableChISLCD(pVBInfo)) || (pVBInfo->VBInfo
- & (SetCRT2ToLCD | SetCRT2ToLCDA))) {
- if (pVBInfo->LCDInfo & SetPWDEnable) {
- XGI_EnablePWD(pVBInfo);
- } else {
- pVBInfo->LCDInfo &= (~SetPWDEnable);
- if (pVBInfo->VBType & (VB_XGI301LV
- | VB_XGI302LV
- | VB_XGI301C)) {
- tempbl = 0xFD;
- tempah = 0x02;
- } else {
- tempbl = 0xFB;
- tempah = 0x00;
- }
-
- XGI_SetPanelPower(tempah, tempbl,
- pVBInfo);
- XGI_SetPanelDelay(1, pVBInfo);
- }
- }
- }
- } /* Not 340 */
-
- if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
- | VB_XGI302LV | VB_XGI301C)) {
- if (!(pVBInfo->SetFlag & DisableChA)) {
- if (pVBInfo->SetFlag & EnableChA) {
- XGINew_SetReg1(pVBInfo->Part1Port, 0x1E, 0x20); /* Power on */
- } else {
- if (pVBInfo->VBInfo & SetCRT2ToDualEdge) { /* SetCRT2ToLCDA ) */
- XGINew_SetReg1(pVBInfo->Part1Port,
- 0x1E, 0x20); /* Power on */
- }
- }
- }
-
- if (!(pVBInfo->SetFlag & DisableChB)) {
- if ((pVBInfo->SetFlag & EnableChB) || (pVBInfo->VBInfo
- & (SetCRT2ToLCD | SetCRT2ToTV
- | SetCRT2ToRAMDAC))) {
- tempah = (unsigned char) XGINew_GetReg1(
- pVBInfo->P3c4, 0x32);
- tempah &= 0xDF;
- if (pVBInfo->VBInfo & SetInSlaveMode) {
- if (!(pVBInfo->VBInfo & SetCRT2ToRAMDAC))
- tempah |= 0x20;
- }
- XGINew_SetReg1(pVBInfo->P3c4, 0x32, tempah);
- XGINew_SetRegOR(pVBInfo->P3c4, 0x1E, 0x20);
-
- tempah = (unsigned char) XGINew_GetReg1(
- pVBInfo->Part1Port, 0x2E);
-
- if (!(tempah & 0x80))
- XGINew_SetRegOR(pVBInfo->Part1Port,
- 0x2E, 0x80); /* BVBDOENABLE = 1 */
-
- XGINew_SetRegAND(pVBInfo->Part1Port, 0x00, 0x7F); /* BScreenOFF = 0 */
- }
- }
-
- if ((pVBInfo->SetFlag & (EnableChA | EnableChB))
- || (!(pVBInfo->VBInfo & DisableCRT2Display))) {
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x00, ~0xE0,
- 0x20); /* shampoo 0129 */
- if (pVBInfo->VBType & (VB_XGI302LV | VB_XGI301C)) {
- if (!XGI_DisableChISLCD(pVBInfo)) {
- if (XGI_EnableChISLCD(pVBInfo)
- || (pVBInfo->VBInfo
- & (SetCRT2ToLCD
- | SetCRT2ToLCDA)))
- XGINew_SetRegAND(
- pVBInfo->Part4Port,
- 0x2A, 0x7F); /* LVDS PLL power on */
- }
- XGINew_SetRegAND(pVBInfo->Part4Port, 0x30, 0x7F); /* LVDS Driver power on */
- }
- }
-
- tempah = 0x00;
-
- if (!(pVBInfo->VBInfo & DisableCRT2Display)) {
- tempah = 0xc0;
-
- if (!(pVBInfo->VBInfo & SetSimuScanMode)) {
- if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
- if (pVBInfo->VBInfo & SetCRT2ToDualEdge) {
- tempah = tempah & 0x40;
- if (pVBInfo->VBInfo
- & SetCRT2ToLCDA)
- tempah = tempah ^ 0xC0;
-
- if (pVBInfo->SetFlag
- & DisableChB)
- tempah &= 0xBF;
-
- if (pVBInfo->SetFlag
- & DisableChA)
- tempah &= 0x7F;
-
- if (pVBInfo->SetFlag
- & EnableChB)
- tempah |= 0x40;
-
- if (pVBInfo->SetFlag
- & EnableChA)
- tempah |= 0x80;
- }
- }
- }
- }
-
- XGINew_SetRegOR(pVBInfo->Part4Port, 0x1F, tempah); /* EnablePart4_1F */
-
- if (pVBInfo->SetFlag & Win9xDOSMode) {
- XGI_DisplayOn(HwDeviceExtension, pVBInfo);
- return;
- }
-
- if (!(pVBInfo->SetFlag & DisableChA)) {
- XGI_VBLongWait(pVBInfo);
- if (!(pVBInfo->SetFlag & GatingCRT)) {
- XGI_DisableGatingCRT(HwDeviceExtension, pVBInfo);
- XGI_DisplayOn(HwDeviceExtension, pVBInfo);
- XGI_VBLongWait(pVBInfo);
- }
- }
- } /* 301 */
- else { /* LVDS */
- if (pVBInfo->VBInfo & (SetCRT2ToTV | SetCRT2ToLCD
- | SetCRT2ToLCDA))
- XGINew_SetRegOR(pVBInfo->Part1Port, 0x1E, 0x20); /* enable CRT2 */
-
- tempah = (unsigned char) XGINew_GetReg1(pVBInfo->Part1Port,
- 0x2E);
- if (!(tempah & 0x80))
- XGINew_SetRegOR(pVBInfo->Part1Port, 0x2E, 0x80); /* BVBDOENABLE = 1 */
-
- XGINew_SetRegAND(pVBInfo->Part1Port, 0x00, 0x7F);
- XGI_DisplayOn(HwDeviceExtension, pVBInfo);
- } /* End of VB */
-
- if (HwDeviceExtension->jChipType < XG40) {
- if (!XGI_EnableChISLCD(pVBInfo)) {
- if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
- if (XGI_BacklightByDrv(pVBInfo))
- return;
- } else
- return;
- }
-
- if (pVBInfo->LCDInfo & SetPWDEnable) {
- XGI_FirePWDEnable(pVBInfo);
- return;
- }
-
- XGI_SetPanelDelay(2, pVBInfo);
-
- if (pVBInfo->VBType & (VB_XGI301LV | VB_XGI302LV | VB_XGI301C)) {
- tempah = 0x01;
- tempbl = 0xFE; /* turn on backlght */
- } else {
- tempbl = 0xF7;
- tempah = 0x00;
- }
- XGI_SetPanelPower(tempah, tempbl, pVBInfo);
- }
-}
-
void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
- unsigned short tempax, tempbx, tempah = 0, tempbl = 0;
+ unsigned short tempah = 0;
if (pVBInfo->SetFlag == Win9xDOSMode)
return;
- if (HwDeviceExtension->jChipType < XG40) {
- if ((!(pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)))
- || (XGI_DisableChISLCD(pVBInfo))) {
- if (!XGI_IsLCDON(pVBInfo)) {
- if (pVBInfo->LCDInfo & SetPWDEnable)
- XGI_EnablePWD(pVBInfo);
- else {
- pVBInfo->LCDInfo &= ~SetPWDEnable;
- XGI_DisablePWD(pVBInfo);
- if (pVBInfo->VBType & (VB_XGI301LV
- | VB_XGI302LV
- | VB_XGI301C)) {
- tempbx = 0xFE; /* not 01h */
- tempax = 0;
- } else {
- tempbx = 0xF7; /* not 08h */
- tempax = 0x08;
- }
- XGI_SetPanelPower(tempax, tempbx,
- pVBInfo);
- XGI_SetPanelDelay(3, pVBInfo);
- }
- } /* end if (!XGI_IsLCDON(pVBInfo)) */
- }
- }
-
/*
if (CH7017) {
if (!(pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2toLCDA)) || (XGI_DisableChISLCD(pVBInfo))) {
@@ -7781,13 +6941,13 @@ void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension,
}
}
- XGINew_SetRegAND(pVBInfo->Part4Port, 0x1F, tempah); /* disable part4_1f */
+ xgifb_reg_and(pVBInfo->Part4Port, 0x1F, tempah); /* disable part4_1f */
if (pVBInfo->VBType & (VB_XGI302LV | VB_XGI301C)) {
if (((pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)))
|| (XGI_DisableChISLCD(pVBInfo))
|| (XGI_IsLCDON(pVBInfo)))
- XGINew_SetRegOR(pVBInfo->Part4Port, 0x30, 0x80); /* LVDS Driver power down */
+ xgifb_reg_or(pVBInfo->Part4Port, 0x30, 0x80); /* LVDS Driver power down */
}
if ((pVBInfo->SetFlag & DisableChA) || (pVBInfo->VBInfo
@@ -7801,13 +6961,13 @@ void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension,
if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
if ((pVBInfo->SetFlag & DisableChA) || (pVBInfo->VBInfo
& SetCRT2ToLCDA))
- XGINew_SetRegAND(pVBInfo->Part1Port, 0x1e, 0xdf); /* Power down */
+ xgifb_reg_and(pVBInfo->Part1Port, 0x1e, 0xdf); /* Power down */
}
- XGINew_SetRegAND(pVBInfo->P3c4, 0x32, 0xdf); /* disable TV as primary VGA swap */
+ xgifb_reg_and(pVBInfo->P3c4, 0x32, 0xdf); /* disable TV as primary VGA swap */
if ((pVBInfo->VBInfo & (SetSimuScanMode | SetCRT2ToDualEdge)))
- XGINew_SetRegAND(pVBInfo->Part2Port, 0x00, 0xdf);
+ xgifb_reg_and(pVBInfo->Part2Port, 0x00, 0xdf);
if ((pVBInfo->SetFlag & DisableChB) || (pVBInfo->VBInfo
& (DisableCRT2Display | SetSimuScanMode))
@@ -7816,51 +6976,29 @@ void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension,
& (SetCRT2ToRAMDAC
| SetCRT2ToLCD
| SetCRT2ToTV))))
- XGINew_SetRegOR(pVBInfo->Part1Port, 0x00, 0x80); /* BScreenOff=1 */
+ xgifb_reg_or(pVBInfo->Part1Port, 0x00, 0x80); /* BScreenOff=1 */
if ((pVBInfo->SetFlag & DisableChB) || (pVBInfo->VBInfo
& (DisableCRT2Display | SetSimuScanMode))
|| (!(pVBInfo->VBInfo & SetCRT2ToLCDA))
|| (pVBInfo->VBInfo & (SetCRT2ToRAMDAC
| SetCRT2ToLCD | SetCRT2ToTV))) {
- tempah = XGINew_GetReg1(pVBInfo->Part1Port, 0x00); /* save Part1 index 0 */
- XGINew_SetRegOR(pVBInfo->Part1Port, 0x00, 0x10); /* BTDAC = 1, avoid VB reset */
- XGINew_SetRegAND(pVBInfo->Part1Port, 0x1E, 0xDF); /* disable CRT2 */
- XGINew_SetReg1(pVBInfo->Part1Port, 0x00, tempah); /* restore Part1 index 0 */
+ tempah = xgifb_reg_get(pVBInfo->Part1Port, 0x00); /* save Part1 index 0 */
+ xgifb_reg_or(pVBInfo->Part1Port, 0x00, 0x10); /* BTDAC = 1, avoid VB reset */
+ xgifb_reg_and(pVBInfo->Part1Port, 0x1E, 0xDF); /* disable CRT2 */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x00, tempah); /* restore Part1 index 0 */
}
} else { /* {301} */
if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToTV)) {
- XGINew_SetRegOR(pVBInfo->Part1Port, 0x00, 0x80); /* BScreenOff=1 */
- XGINew_SetRegAND(pVBInfo->Part1Port, 0x1E, 0xDF); /* Disable CRT2 */
- XGINew_SetRegAND(pVBInfo->P3c4, 0x32, 0xDF); /* Disable TV asPrimary VGA swap */
+ xgifb_reg_or(pVBInfo->Part1Port, 0x00, 0x80); /* BScreenOff=1 */
+ xgifb_reg_and(pVBInfo->Part1Port, 0x1E, 0xDF); /* Disable CRT2 */
+ xgifb_reg_and(pVBInfo->P3c4, 0x32, 0xDF); /* Disable TV asPrimary VGA swap */
}
if (pVBInfo->VBInfo & (DisableCRT2Display | SetCRT2ToLCDA
| SetSimuScanMode))
XGI_DisplayOff(HwDeviceExtension, pVBInfo);
}
-
- if (HwDeviceExtension->jChipType < XG40) {
- if (!(pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA))
- || (XGI_DisableChISLCD(pVBInfo))
- || (XGI_IsLCDON(pVBInfo))) {
- if (pVBInfo->LCDInfo & SetPWDEnable) {
- if (pVBInfo->LCDInfo & SetPWDEnable)
- XGI_BacklightByDrv(pVBInfo);
- else {
- XGI_SetPanelDelay(4, pVBInfo);
- if (pVBInfo->VBType & VB_XGI301LV) {
- tempbl = 0xFD;
- tempah = 0x00;
- } else {
- tempbl = 0xFB;
- tempah = 0x04;
- }
- }
- }
- XGI_SetPanelPower(tempah, tempbl, pVBInfo);
- }
- }
}
/* --------------------------------------------------------------------- */
@@ -7880,7 +7018,7 @@ void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension,
/* A : Ext750p */
/* B : St750p */
/* --------------------------------------------------------------------- */
-unsigned short XGI_GetTVPtrIndex(struct vb_device_info *pVBInfo)
+static unsigned short XGI_GetTVPtrIndex(struct vb_device_info *pVBInfo)
{
unsigned short tempbx = 0;
@@ -7901,35 +7039,58 @@ unsigned short XGI_GetTVPtrIndex(struct vb_device_info *pVBInfo)
}
/* --------------------------------------------------------------------- */
-/* Function : XGI_OEM310Setting */
+/* Function : XGI_GetTVPtrIndex2 */
/* Input : */
-/* Output : */
-/* Description : Customized Param. for 301 */
+/* Output : bx 0 : NTSC */
+/* 1 : PAL */
+/* 2 : PALM */
+/* 3 : PALN */
+/* 4 : NTSC1024x768 */
+/* 5 : PAL-M 1024x768 */
+/* 6-7: reserved */
+/* cl 0 : YFilter1 */
+/* 1 : YFilter2 */
+/* ch 0 : 301A */
+/* 1 : 301B/302B/301LV/302LV */
+/* Description : */
/* --------------------------------------------------------------------- */
-void XGI_OEM310Setting(unsigned short ModeNo, unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo)
+static void XGI_GetTVPtrIndex2(unsigned short *tempbx, unsigned char *tempcl,
+ unsigned char *tempch, struct vb_device_info *pVBInfo)
{
- if (pVBInfo->SetFlag & Win9xDOSMode)
- return;
+ *tempbx = 0;
+ *tempcl = 0;
+ *tempch = 0;
- /* GetPart1IO(); */
- XGI_SetDelayComp(pVBInfo);
+ if (pVBInfo->TVInfo & SetPALTV)
+ *tempbx = 1;
- if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA))
- XGI_SetLCDCap(pVBInfo);
+ if (pVBInfo->TVInfo & SetPALMTV)
+ *tempbx = 2;
- if (pVBInfo->VBInfo & SetCRT2ToTV) {
- /* GetPart2IO() */
- XGI_SetPhaseIncr(pVBInfo);
- XGI_SetYFilter(ModeNo, ModeIdIndex, pVBInfo);
- XGI_SetAntiFlicker(ModeNo, ModeIdIndex, pVBInfo);
+ if (pVBInfo->TVInfo & SetPALNTV)
+ *tempbx = 3;
- if (pVBInfo->VBType & VB_XGI301)
- XGI_SetEdgeEnhance(ModeNo, ModeIdIndex, pVBInfo);
+ if (pVBInfo->TVInfo & NTSC1024x768) {
+ *tempbx = 4;
+ if (pVBInfo->TVInfo & SetPALMTV)
+ *tempbx = 5;
+ }
+
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C)) {
+ if ((!(pVBInfo->VBInfo & SetInSlaveMode)) || (pVBInfo->TVInfo
+ & TVSimuMode)) {
+ *tempbx += 8;
+ *tempcl += 1;
+ }
}
+
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C))
+ (*tempch)++;
}
-void XGI_SetDelayComp(struct vb_device_info *pVBInfo)
+static void XGI_SetDelayComp(struct vb_device_info *pVBInfo)
{
unsigned short index;
@@ -7968,7 +7129,7 @@ void XGI_SetDelayComp(struct vb_device_info *pVBInfo)
tempbl &= 0x0F;
tempbh &= 0xF0;
- tempah = XGINew_GetReg1(pVBInfo->Part1Port, 0x2D);
+ tempah = xgifb_reg_get(pVBInfo->Part1Port, 0x2D);
if (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToLCD
| SetCRT2ToTV)) { /* Channel B */
@@ -7980,7 +7141,7 @@ void XGI_SetDelayComp(struct vb_device_info *pVBInfo)
tempah &= 0x0F;
tempah |= tempbh;
}
- XGINew_SetReg1(pVBInfo->Part1Port, 0x2D, tempah);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x2D, tempah);
}
} else if (pVBInfo->IF_DEF_LVDS == 1) {
tempbl = 0;
@@ -7991,72 +7152,35 @@ void XGI_SetDelayComp(struct vb_device_info *pVBInfo)
pVBInfo)].LCD_DelayCompensation; /* / Get LCD Delay */
tempah &= 0x0f;
tempah = tempah << 4;
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2D, 0x0f,
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x2D, 0x0f,
tempah);
}
}
}
-void XGI_SetLCDCap(struct vb_device_info *pVBInfo)
-{
- unsigned short tempcx;
-
- tempcx = pVBInfo->LCDCapList[XGI_GetLCDCapPtr(pVBInfo)].LCD_Capability;
-
- if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
- | VB_XGI302LV | VB_XGI301C)) {
- if (pVBInfo->VBType & (VB_XGI301LV | VB_XGI302LV | VB_XGI301C)) { /* 301LV/302LV only */
- /* Set 301LV Capability */
- XGINew_SetReg1(pVBInfo->Part4Port, 0x24,
- (unsigned char) (tempcx & 0x1F));
- }
- /* VB Driving */
- XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x0D,
- ~((EnableVBCLKDRVLOW | EnablePLLSPLOW) >> 8),
- (unsigned short) ((tempcx & (EnableVBCLKDRVLOW
- | EnablePLLSPLOW)) >> 8));
- }
-
- if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
- | VB_XGI302LV | VB_XGI301C)) {
- if (pVBInfo->VBInfo & SetCRT2ToLCD)
- XGI_SetLCDCap_B(tempcx, pVBInfo);
- else if (pVBInfo->VBInfo & SetCRT2ToLCDA)
- XGI_SetLCDCap_A(tempcx, pVBInfo);
-
- if (pVBInfo->VBType & (VB_XGI302LV | VB_XGI301C)) {
- if (tempcx & EnableSpectrum)
- SetSpectrum(pVBInfo);
- }
- } else {
- /* LVDS,CH7017 */
- XGI_SetLCDCap_A(tempcx, pVBInfo);
- }
-}
-
-void XGI_SetLCDCap_A(unsigned short tempcx, struct vb_device_info *pVBInfo)
+static void XGI_SetLCDCap_A(unsigned short tempcx, struct vb_device_info *pVBInfo)
{
unsigned short temp;
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x37);
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x37);
if (temp & LCDRGB18Bit) {
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, 0x0F,
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x19, 0x0F,
(unsigned short) (0x20 | (tempcx & 0x00C0))); /* Enable Dither */
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x1A, 0x7F, 0x80);
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x1A, 0x7F, 0x80);
} else {
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, 0x0F,
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x19, 0x0F,
(unsigned short) (0x30 | (tempcx & 0x00C0)));
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x1A, 0x7F, 0x00);
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x1A, 0x7F, 0x00);
}
/*
if (tempcx & EnableLCD24bpp) { // 24bits
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, 0x0F, (unsigned short)(0x30 | (tempcx&0x00C0)));
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x1A, 0x7F, 0x00);
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x19, 0x0F, (unsigned short)(0x30 | (tempcx&0x00C0)));
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x1A, 0x7F, 0x00);
} else {
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, 0x0F, (unsigned short)(0x20 | (tempcx&0x00C0))); // Enable Dither
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x1A, 0x7F, 0x80);
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x19, 0x0F, (unsigned short)(0x20 | (tempcx&0x00C0))); // Enable Dither
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x1A, 0x7F, 0x80);
}
*/
}
@@ -8067,39 +7191,76 @@ void XGI_SetLCDCap_A(unsigned short tempcx, struct vb_device_info *pVBInfo)
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
-void XGI_SetLCDCap_B(unsigned short tempcx, struct vb_device_info *pVBInfo)
+static void XGI_SetLCDCap_B(unsigned short tempcx, struct vb_device_info *pVBInfo)
{
if (tempcx & EnableLCD24bpp) /* 24bits */
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x1A, 0xE0,
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x1A, 0xE0,
(unsigned short) (((tempcx & 0x00ff) >> 6)
| 0x0c));
else
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x1A, 0xE0,
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x1A, 0xE0,
(unsigned short) (((tempcx & 0x00ff) >> 6)
| 0x18)); /* Enable Dither */
}
-void SetSpectrum(struct vb_device_info *pVBInfo)
+static void SetSpectrum(struct vb_device_info *pVBInfo)
{
unsigned short index;
index = XGI_GetLCDCapPtr(pVBInfo);
- XGINew_SetRegAND(pVBInfo->Part4Port, 0x30, 0x8F); /* disable down spectrum D[4] */
+ xgifb_reg_and(pVBInfo->Part4Port, 0x30, 0x8F); /* disable down spectrum D[4] */
XGI_LongWait(pVBInfo);
- XGINew_SetRegOR(pVBInfo->Part4Port, 0x30, 0x20); /* reset spectrum */
+ xgifb_reg_or(pVBInfo->Part4Port, 0x30, 0x20); /* reset spectrum */
XGI_LongWait(pVBInfo);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x31,
+ xgifb_reg_set(pVBInfo->Part4Port, 0x31,
pVBInfo->LCDCapList[index].Spectrum_31);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x32,
+ xgifb_reg_set(pVBInfo->Part4Port, 0x32,
pVBInfo->LCDCapList[index].Spectrum_32);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x33,
+ xgifb_reg_set(pVBInfo->Part4Port, 0x33,
pVBInfo->LCDCapList[index].Spectrum_33);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x34,
+ xgifb_reg_set(pVBInfo->Part4Port, 0x34,
pVBInfo->LCDCapList[index].Spectrum_34);
XGI_LongWait(pVBInfo);
- XGINew_SetRegOR(pVBInfo->Part4Port, 0x30, 0x40); /* enable spectrum */
+ xgifb_reg_or(pVBInfo->Part4Port, 0x30, 0x40); /* enable spectrum */
+}
+
+static void XGI_SetLCDCap(struct vb_device_info *pVBInfo)
+{
+ unsigned short tempcx;
+
+ tempcx = pVBInfo->LCDCapList[XGI_GetLCDCapPtr(pVBInfo)].LCD_Capability;
+
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C)) {
+ if (pVBInfo->VBType & (VB_XGI301LV | VB_XGI302LV | VB_XGI301C)) { /* 301LV/302LV only */
+ /* Set 301LV Capability */
+ xgifb_reg_set(pVBInfo->Part4Port, 0x24,
+ (unsigned char) (tempcx & 0x1F));
+ }
+ /* VB Driving */
+ xgifb_reg_and_or(pVBInfo->Part4Port, 0x0D,
+ ~((EnableVBCLKDRVLOW | EnablePLLSPLOW) >> 8),
+ (unsigned short) ((tempcx & (EnableVBCLKDRVLOW
+ | EnablePLLSPLOW)) >> 8));
+ }
+
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C)) {
+ if (pVBInfo->VBInfo & SetCRT2ToLCD)
+ XGI_SetLCDCap_B(tempcx, pVBInfo);
+ else if (pVBInfo->VBInfo & SetCRT2ToLCDA)
+ XGI_SetLCDCap_A(tempcx, pVBInfo);
+
+ if (pVBInfo->VBType & (VB_XGI302LV | VB_XGI301C)) {
+ if (tempcx & EnableSpectrum)
+ SetSpectrum(pVBInfo);
+ }
+ } else {
+ /* LVDS,CH7017 */
+ XGI_SetLCDCap_A(tempcx, pVBInfo);
+ }
}
/* --------------------------------------------------------------------- */
@@ -8108,7 +7269,7 @@ void SetSpectrum(struct vb_device_info *pVBInfo)
/* Output : */
/* Description : Set TV Customized Param. */
/* --------------------------------------------------------------------- */
-void XGI_SetAntiFlicker(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetAntiFlicker(unsigned short ModeNo, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo)
{
unsigned short tempbx, index;
@@ -8130,10 +7291,10 @@ void XGI_SetAntiFlicker(unsigned short ModeNo, unsigned short ModeIdIndex,
tempah = TVAntiFlickList[tempbx];
tempah = tempah << 4;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x0A, 0x8F, tempah);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x0A, 0x8F, tempah);
}
-void XGI_SetEdgeEnhance(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetEdgeEnhance(unsigned short ModeNo, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo)
{
unsigned short tempbx, index;
@@ -8152,10 +7313,10 @@ void XGI_SetEdgeEnhance(unsigned short ModeNo, unsigned short ModeIdIndex,
tempah = TVEdgeList[tempbx];
tempah = tempah << 5;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x3A, 0x1F, tempah);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x3A, 0x1F, tempah);
}
-void XGI_SetPhaseIncr(struct vb_device_info *pVBInfo)
+static void XGI_SetPhaseIncr(struct vb_device_info *pVBInfo)
{
unsigned short tempbx;
@@ -8166,17 +7327,17 @@ void XGI_SetPhaseIncr(struct vb_device_info *pVBInfo)
XGI_GetTVPtrIndex2(&tempbx, &tempcl, &tempch, pVBInfo); /* bx, cl, ch */
tempData = TVPhaseList[tempbx];
- XGINew_SetReg1(pVBInfo->Part2Port, 0x31, (unsigned short) (tempData
+ xgifb_reg_set(pVBInfo->Part2Port, 0x31, (unsigned short) (tempData
& 0x000000FF));
- XGINew_SetReg1(pVBInfo->Part2Port, 0x32, (unsigned short) ((tempData
+ xgifb_reg_set(pVBInfo->Part2Port, 0x32, (unsigned short) ((tempData
& 0x0000FF00) >> 8));
- XGINew_SetReg1(pVBInfo->Part2Port, 0x33, (unsigned short) ((tempData
+ xgifb_reg_set(pVBInfo->Part2Port, 0x33, (unsigned short) ((tempData
& 0x00FF0000) >> 16));
- XGINew_SetReg1(pVBInfo->Part2Port, 0x34, (unsigned short) ((tempData
+ xgifb_reg_set(pVBInfo->Part2Port, 0x34, (unsigned short) ((tempData
& 0xFF000000) >> 24));
}
-void XGI_SetYFilter(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetYFilter(unsigned short ModeNo, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo)
{
unsigned short tempbx, index;
@@ -8238,75 +7399,52 @@ void XGI_SetYFilter(unsigned short ModeNo, unsigned short ModeIdIndex,
index = tempal * 7;
if ((tempcl == 0) && (tempch == 1)) {
- XGINew_SetReg1(pVBInfo->Part2Port, 0x35, 0);
- XGINew_SetReg1(pVBInfo->Part2Port, 0x36, 0);
- XGINew_SetReg1(pVBInfo->Part2Port, 0x37, 0);
- XGINew_SetReg1(pVBInfo->Part2Port, 0x38, filterPtr[index++]);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x35, 0);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x36, 0);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x37, 0);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x38, filterPtr[index++]);
} else {
- XGINew_SetReg1(pVBInfo->Part2Port, 0x35, filterPtr[index++]);
- XGINew_SetReg1(pVBInfo->Part2Port, 0x36, filterPtr[index++]);
- XGINew_SetReg1(pVBInfo->Part2Port, 0x37, filterPtr[index++]);
- XGINew_SetReg1(pVBInfo->Part2Port, 0x38, filterPtr[index++]);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x35, filterPtr[index++]);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x36, filterPtr[index++]);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x37, filterPtr[index++]);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x38, filterPtr[index++]);
}
if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
| VB_XGI302LV | VB_XGI301C)) {
- XGINew_SetReg1(pVBInfo->Part2Port, 0x48, filterPtr[index++]);
- XGINew_SetReg1(pVBInfo->Part2Port, 0x49, filterPtr[index++]);
- XGINew_SetReg1(pVBInfo->Part2Port, 0x4A, filterPtr[index++]);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x48, filterPtr[index++]);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x49, filterPtr[index++]);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x4A, filterPtr[index++]);
}
}
/* --------------------------------------------------------------------- */
-/* Function : XGI_GetTVPtrIndex2 */
+/* Function : XGI_OEM310Setting */
/* Input : */
-/* Output : bx 0 : NTSC */
-/* 1 : PAL */
-/* 2 : PALM */
-/* 3 : PALN */
-/* 4 : NTSC1024x768 */
-/* 5 : PAL-M 1024x768 */
-/* 6-7: reserved */
-/* cl 0 : YFilter1 */
-/* 1 : YFilter2 */
-/* ch 0 : 301A */
-/* 1 : 301B/302B/301LV/302LV */
-/* Description : */
+/* Output : */
+/* Description : Customized Param. for 301 */
/* --------------------------------------------------------------------- */
-void XGI_GetTVPtrIndex2(unsigned short *tempbx, unsigned char *tempcl,
- unsigned char *tempch, struct vb_device_info *pVBInfo)
+static void XGI_OEM310Setting(unsigned short ModeNo, unsigned short ModeIdIndex,
+ struct vb_device_info *pVBInfo)
{
- *tempbx = 0;
- *tempcl = 0;
- *tempch = 0;
-
- if (pVBInfo->TVInfo & SetPALTV)
- *tempbx = 1;
+ if (pVBInfo->SetFlag & Win9xDOSMode)
+ return;
- if (pVBInfo->TVInfo & SetPALMTV)
- *tempbx = 2;
+ /* GetPart1IO(); */
+ XGI_SetDelayComp(pVBInfo);
- if (pVBInfo->TVInfo & SetPALNTV)
- *tempbx = 3;
+ if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA))
+ XGI_SetLCDCap(pVBInfo);
- if (pVBInfo->TVInfo & NTSC1024x768) {
- *tempbx = 4;
- if (pVBInfo->TVInfo & SetPALMTV)
- *tempbx = 5;
- }
+ if (pVBInfo->VBInfo & SetCRT2ToTV) {
+ /* GetPart2IO() */
+ XGI_SetPhaseIncr(pVBInfo);
+ XGI_SetYFilter(ModeNo, ModeIdIndex, pVBInfo);
+ XGI_SetAntiFlicker(ModeNo, ModeIdIndex, pVBInfo);
- if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
- | VB_XGI302LV | VB_XGI301C)) {
- if ((!(pVBInfo->VBInfo & SetInSlaveMode)) || (pVBInfo->TVInfo
- & TVSimuMode)) {
- *tempbx += 8;
- *tempcl += 1;
- }
+ if (pVBInfo->VBType & VB_XGI301)
+ XGI_SetEdgeEnhance(ModeNo, ModeIdIndex, pVBInfo);
}
-
- if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
- | VB_XGI302LV | VB_XGI301C))
- (*tempch)++;
}
/* --------------------------------------------------------------------- */
@@ -8324,10 +7462,10 @@ void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
unsigned char tempah;
- /* XGINew_SetReg1(pVBInfo->Part1Port, 0x03, 0x00); // fix write part1 index 0 BTDRAM bit Bug */
+ /* xgifb_reg_set(pVBInfo->Part1Port, 0x03, 0x00); // fix write part1 index 0 BTDRAM bit Bug */
tempah = 0;
if (!(pVBInfo->VBInfo & DisableCRT2Display)) {
- tempah = XGINew_GetReg1(pVBInfo->Part1Port, 0x00);
+ tempah = xgifb_reg_get(pVBInfo->Part1Port, 0x00);
tempah &= ~0x10; /* BTRAMDAC */
tempah |= 0x40; /* BTRAM */
@@ -8354,7 +7492,7 @@ void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
tempah = 0;
}
- XGINew_SetReg1(pVBInfo->Part1Port, 0x00, tempah);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x00, tempah);
if (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD)) {
tempcl = pVBInfo->ModeType;
if (ModeNo > 0x13) {
@@ -8375,12 +7513,12 @@ void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
}
*/
- XGINew_SetReg1(pVBInfo->Part1Port, 0x00, tempah);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x00, tempah);
tempah = 0x08;
tempbl = 0xf0;
if (pVBInfo->VBInfo & DisableCRT2Display) {
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2e, tempbl, tempah);
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x2e, tempbl, tempah);
} else {
tempah = 0x00;
tempbl = 0xff;
@@ -8391,7 +7529,7 @@ void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
&& (!(pVBInfo->VBInfo & SetSimuScanMode))) {
tempbl &= 0xf7;
tempah |= 0x01;
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2e,
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x2e,
tempbl, tempah);
} else {
if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
@@ -8417,15 +7555,15 @@ void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
if (!(pVBInfo->VBInfo
& SetCRT2ToDualEdge))
tempah |= 0x08;
- XGINew_SetRegANDOR(pVBInfo->Part1Port,
+ xgifb_reg_and_or(pVBInfo->Part1Port,
0x2e, tempbl, tempah);
} else {
- XGINew_SetRegANDOR(pVBInfo->Part1Port,
+ xgifb_reg_and_or(pVBInfo->Part1Port,
0x2e, tempbl, tempah);
}
}
} else {
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2e, tempbl,
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x2e, tempbl,
tempah);
}
}
@@ -8449,7 +7587,7 @@ void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
/* } */
}
- XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x0D, ~0x0BF, tempah);
+ xgifb_reg_and_or(pVBInfo->Part4Port, 0x0D, ~0x0BF, tempah);
tempah = 0;
if (pVBInfo->LCDInfo & SetLCDDualLink)
@@ -8469,7 +7607,7 @@ void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
if (pVBInfo->LCDResInfo == Panel1280x960)
tempah |= 0x80;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x0C, tempah);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x0C, tempah);
}
if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
@@ -8483,7 +7621,7 @@ void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
tempah |= 0x04; /* shampoo 0129 */
}
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x13, tempbl, tempah);
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x13, tempbl, tempah);
tempah = 0x00;
tempbl = 0xcf;
if (!(pVBInfo->VBInfo & DisableCRT2Display)) {
@@ -8491,7 +7629,7 @@ void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
tempah |= 0x30;
}
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2c, tempbl, tempah);
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x2c, tempbl, tempah);
tempah = 0;
tempbl = 0x3f;
@@ -8499,7 +7637,7 @@ void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
if (pVBInfo->VBInfo & SetCRT2ToDualEdge)
tempah |= 0xc0;
}
- XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x21, tempbl, tempah);
+ xgifb_reg_and_or(pVBInfo->Part4Port, 0x21, tempbl, tempah);
}
tempah = 0;
@@ -8510,17 +7648,17 @@ void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
tempah |= 0x80;
}
- XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x23, tempbl, tempah);
+ xgifb_reg_and_or(pVBInfo->Part4Port, 0x23, tempbl, tempah);
if (pVBInfo->VBType & (VB_XGI302LV | VB_XGI301C)) {
if (pVBInfo->LCDInfo & SetLCDDualLink) {
- XGINew_SetRegOR(pVBInfo->Part4Port, 0x27, 0x20);
- XGINew_SetRegOR(pVBInfo->Part4Port, 0x34, 0x10);
+ xgifb_reg_or(pVBInfo->Part4Port, 0x27, 0x20);
+ xgifb_reg_or(pVBInfo->Part4Port, 0x34, 0x10);
}
}
}
-void XGI_CloseCRTC(struct xgi_hw_device_info *HwDeviceExtension,
+static void XGI_CloseCRTC(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
unsigned short tempbx;
@@ -8539,88 +7677,11 @@ void XGI_OpenCRTC(struct xgi_hw_device_info *HwDeviceExtension,
tempbx = 0;
}
-void XGI_GetRAMDAC2DATA(unsigned short ModeNo, unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
- struct vb_device_info *pVBInfo)
-{
- unsigned short tempax, tempbx, temp1, temp2, modeflag = 0, tempcx,
- StandTableIndex, CRT1Index;
-
- pVBInfo->RVBHCMAX = 1;
- pVBInfo->RVBHCFACT = 1;
-
- if (ModeNo <= 0x13) {
- modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
- StandTableIndex = XGI_GetModePtr(ModeNo, ModeIdIndex, pVBInfo);
- tempax = pVBInfo->StandTable[StandTableIndex].CRTC[0];
- tempbx = pVBInfo->StandTable[StandTableIndex].CRTC[6];
- temp1 = pVBInfo->StandTable[StandTableIndex].CRTC[7];
- } else {
- modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- CRT1Index
- = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
- CRT1Index &= IndexMask;
- temp1
- = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[0];
- temp2
- = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[5];
- tempax = (temp1 & 0xFF) | ((temp2 & 0x03) << 8);
- tempbx
- = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[8];
- tempcx
- = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[14]
- << 8;
- tempcx &= 0x0100;
- tempcx = tempcx << 2;
- tempbx |= tempcx;
- temp1
- = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[9];
- }
-
- if (temp1 & 0x01)
- tempbx |= 0x0100;
-
- if (temp1 & 0x20)
- tempbx |= 0x0200;
- tempax += 5;
-
- if (modeflag & Charx8Dot)
- tempax *= 8;
- else
- tempax *= 9;
-
- pVBInfo->VGAHT = tempax;
- pVBInfo->HT = tempax;
- tempbx++;
- pVBInfo->VGAVT = tempbx;
- pVBInfo->VT = tempbx;
-}
-
-unsigned short XGI_GetColorDepth(unsigned short ModeNo,
- unsigned short ModeIdIndex, struct vb_device_info *pVBInfo)
-{
- unsigned short ColorDepth[6] = { 1, 2, 4, 4, 6, 8 };
- short index;
- unsigned short modeflag;
-
- if (ModeNo <= 0x13)
- modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
- else
- modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
-
- index = (modeflag & ModeInfoFlag) - ModeEGA;
-
- if (index < 0)
- index = 0;
-
- return ColorDepth[index];
-}
-
void XGI_UnLockCRT2(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2f, 0xFF, 0x01);
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x2f, 0xFF, 0x01);
}
@@ -8628,36 +7689,8 @@ void XGI_LockCRT2(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2F, 0xFE, 0x00);
-
-}
-
-void XGINew_EnableCRT2(struct vb_device_info *pVBInfo)
-{
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x1E, 0xFF, 0x20);
-}
-
-void XGINew_LCD_Wait_Time(unsigned char DelayTime,
- struct vb_device_info *pVBInfo)
-{
- unsigned short i, j;
-
- unsigned long temp, flag;
-
- flag = 0;
- /* printk("XGINew_LCD_Wait_Time"); */
- /* return; */
- for (i = 0; i < DelayTime; i++) {
- for (j = 0; j < 66; j++) {
- temp = XGINew_GetReg3(0x61);
- /* temp &= 0x10000000; */
- temp &= 0x10;
- if (temp == flag)
- continue;
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x2F, 0xFE, 0x00);
- flag = temp;
- }
- }
}
unsigned char XGI_BridgeIsOn(struct vb_device_info *pVBInfo)
@@ -8667,7 +7700,7 @@ unsigned char XGI_BridgeIsOn(struct vb_device_info *pVBInfo)
if (pVBInfo->IF_DEF_LVDS == 1) {
return 1;
} else {
- flag = XGINew_GetReg1(pVBInfo->Part4Port, 0x00);
+ flag = xgifb_reg_get(pVBInfo->Part4Port, 0x00);
if ((flag == 1) || (flag == 2))
return 1; /* 301b */
else
@@ -8679,22 +7712,22 @@ void XGI_LongWait(struct vb_device_info *pVBInfo)
{
unsigned short i;
- i = XGINew_GetReg1(pVBInfo->P3c4, 0x1F);
+ i = xgifb_reg_get(pVBInfo->P3c4, 0x1F);
if (!(i & 0xC0)) {
for (i = 0; i < 0xFFFF; i++) {
- if (!(XGINew_GetReg2(pVBInfo->P3da) & 0x08))
+ if (!(inb(pVBInfo->P3da) & 0x08))
break;
}
for (i = 0; i < 0xFFFF; i++) {
- if ((XGINew_GetReg2(pVBInfo->P3da) & 0x08))
+ if ((inb(pVBInfo->P3da) & 0x08))
break;
}
}
}
-void XGI_VBLongWait(struct vb_device_info *pVBInfo)
+static void XGI_VBLongWait(struct vb_device_info *pVBInfo)
{
unsigned short tempal, temp, i, j;
return;
@@ -8702,7 +7735,7 @@ void XGI_VBLongWait(struct vb_device_info *pVBInfo)
temp = 0;
for (i = 0; i < 3; i++) {
for (j = 0; j < 100; j++) {
- tempal = XGINew_GetReg2(pVBInfo->P3da);
+ tempal = inb(pVBInfo->P3da);
if (temp & 0x01) { /* VBWaitMode2 */
if ((tempal & 0x08))
continue;
@@ -8726,188 +7759,717 @@ void XGI_VBLongWait(struct vb_device_info *pVBInfo)
return;
}
-unsigned short XGI_GetVGAHT2(struct vb_device_info *pVBInfo)
+unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE,
+ unsigned short ModeNo, unsigned short ModeIdIndex,
+ struct vb_device_info *pVBInfo)
{
- unsigned long tempax, tempbx;
+ short LCDRefreshIndex[] = { 0x00, 0x00, 0x03, 0x01 },
+ LCDARefreshIndex[] = { 0x00, 0x00, 0x03, 0x01, 0x01,
+ 0x01, 0x01 };
- tempbx = ((pVBInfo->VGAVT - pVBInfo->VGAVDE) * pVBInfo->RVBHCMAX)
- & 0xFFFF;
- tempax = (pVBInfo->VT - pVBInfo->VDE) * pVBInfo->RVBHCFACT;
- tempax = (tempax * pVBInfo->HT) / tempbx;
+ unsigned short RefreshRateTableIndex, i, modeflag, index, temp;
- return (unsigned short) tempax;
+ if (ModeNo <= 0x13)
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
+ else
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+
+ if (pVBInfo->IF_DEF_CH7005 == 1) {
+ if (pVBInfo->VBInfo & SetCRT2ToTV) {
+ if (modeflag & HalfDCLK)
+ return 0;
+ }
+ }
+
+ if (ModeNo < 0x14)
+ return 0xFFFF;
+
+ index = xgifb_reg_get(pVBInfo->P3d4, 0x33);
+ index = index >> pVBInfo->SelectCRT2Rate;
+ index &= 0x0F;
+
+ if (pVBInfo->LCDInfo & LCDNonExpanding)
+ index = 0;
+
+ if (index > 0)
+ index--;
+
+ if (pVBInfo->SetFlag & ProgrammingCRT2) {
+ if (pVBInfo->IF_DEF_CH7005 == 1) {
+ if (pVBInfo->VBInfo & SetCRT2ToTV)
+ index = 0;
+ }
+
+ if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
+ if (pVBInfo->IF_DEF_LVDS == 0) {
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B
+ | VB_XGI301LV | VB_XGI302LV
+ | VB_XGI301C))
+ temp
+ = LCDARefreshIndex[pVBInfo->LCDResInfo
+ & 0x0F]; /* 301b */
+ else
+ temp
+ = LCDRefreshIndex[pVBInfo->LCDResInfo
+ & 0x0F];
+
+ if (index > temp)
+ index = temp;
+ } else {
+ index = 0;
+ }
+ }
+ }
+
+ RefreshRateTableIndex = pVBInfo->EModeIDTable[ModeIdIndex].REFindex;
+ ModeNo = pVBInfo->RefIndex[RefreshRateTableIndex].ModeID;
+ if (pXGIHWDE->jChipType >= XG20) { /* for XG20, XG21, XG27 */
+ /*
+ if (pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag & XG2xNotSupport) {
+ index++;
+ }
+ */
+ if ((pVBInfo->RefIndex[RefreshRateTableIndex].XRes == 800)
+ && (pVBInfo->RefIndex[RefreshRateTableIndex].YRes
+ == 600)) {
+ index++;
+ }
+ /* Alan 10/19/2007; do the similar adjustment like XGISearchCRT1Rate() */
+ if ((pVBInfo->RefIndex[RefreshRateTableIndex].XRes == 1024)
+ && (pVBInfo->RefIndex[RefreshRateTableIndex].YRes
+ == 768)) {
+ index++;
+ }
+ if ((pVBInfo->RefIndex[RefreshRateTableIndex].XRes == 1280)
+ && (pVBInfo->RefIndex[RefreshRateTableIndex].YRes
+ == 1024)) {
+ index++;
+ }
+ }
+
+ i = 0;
+ do {
+ if (pVBInfo->RefIndex[RefreshRateTableIndex + i].ModeID
+ != ModeNo)
+ break;
+ temp
+ = pVBInfo->RefIndex[RefreshRateTableIndex + i].Ext_InfoFlag;
+ temp &= ModeInfoFlag;
+ if (temp < pVBInfo->ModeType)
+ break;
+ i++;
+ index--;
+
+ } while (index != 0xFFFF);
+ if (!(pVBInfo->VBInfo & SetCRT2ToRAMDAC)) {
+ if (pVBInfo->VBInfo & SetInSlaveMode) {
+ temp
+ = pVBInfo->RefIndex[RefreshRateTableIndex
+ + i - 1].Ext_InfoFlag;
+ if (temp & InterlaceMode)
+ i++;
+ }
+ }
+ i--;
+ if ((pVBInfo->SetFlag & ProgrammingCRT2)) {
+ temp = XGI_AjustCRT2Rate(ModeNo, ModeIdIndex,
+ RefreshRateTableIndex, &i, pVBInfo);
+ }
+ return RefreshRateTableIndex + i; /* return (0x01 | (temp1<<1)); */
}
-unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo,
- unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
+static void XGI_SetLCDAGroup(unsigned short ModeNo, unsigned short ModeIdIndex,
struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
- unsigned short tempbx;
+ unsigned short RefreshRateTableIndex;
+ /* unsigned short temp ; */
- unsigned short LCDXlat1VCLK[4] = { VCLK65 + 2, VCLK65 + 2, VCLK65 + 2,
- VCLK65 + 2 };
- unsigned short LCDXlat2VCLK[4] = { VCLK108_2 + 5, VCLK108_2 + 5,
- VCLK108_2 + 5, VCLK108_2 + 5 };
- unsigned short LVDSXlat1VCLK[4] = { VCLK40, VCLK40, VCLK40, VCLK40 };
- unsigned short LVDSXlat2VCLK[4] = { VCLK65 + 2, VCLK65 + 2, VCLK65 + 2,
- VCLK65 + 2 };
- unsigned short LVDSXlat3VCLK[4] = { VCLK65 + 2, VCLK65 + 2, VCLK65 + 2,
- VCLK65 + 2 };
+ /* pVBInfo->SelectCRT2Rate = 0; */
- unsigned short CRT2Index, VCLKIndex;
- unsigned short modeflag, resinfo;
- unsigned char *CHTVVCLKPtr = NULL;
+ pVBInfo->SetFlag |= ProgrammingCRT2;
+ RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo,
+ ModeIdIndex, pVBInfo);
+ XGI_GetLVDSResInfo(ModeNo, ModeIdIndex, pVBInfo);
+ XGI_GetLVDSData(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
+ XGI_ModCRT1Regs(ModeNo, ModeIdIndex, RefreshRateTableIndex,
+ HwDeviceExtension, pVBInfo);
+ XGI_SetLVDSRegs(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
+ XGI_SetCRT2ECLK(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
+}
- if (ModeNo <= 0x13) {
- modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */
- resinfo = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo;
- CRT2Index = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
- } else {
- modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */
- resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
- CRT2Index
- = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
- }
+unsigned char XGI_SetCRT2Group301(unsigned short ModeNo,
+ struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short tempbx, ModeIdIndex, RefreshRateTableIndex;
- if (pVBInfo->IF_DEF_LVDS == 0) {
- CRT2Index = CRT2Index >> 6; /* for LCD */
- if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { /*301b*/
- if (pVBInfo->LCDResInfo != Panel1024x768)
- VCLKIndex = LCDXlat2VCLK[CRT2Index];
- else
- VCLKIndex = LCDXlat1VCLK[CRT2Index];
- } else { /* for TV */
- if (pVBInfo->VBInfo & SetCRT2ToTV) {
- if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) {
- if (pVBInfo->SetFlag & RPLLDIV2XO) {
- VCLKIndex = HiTVVCLKDIV2;
+ tempbx = pVBInfo->VBInfo;
+ pVBInfo->SetFlag |= ProgrammingCRT2;
+ XGI_SearchModeID(ModeNo, &ModeIdIndex, pVBInfo);
+ pVBInfo->SelectCRT2Rate = 4;
+ RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo,
+ ModeIdIndex, pVBInfo);
+ XGI_SaveCRT2Info(ModeNo, pVBInfo);
+ XGI_GetCRT2ResInfo(ModeNo, ModeIdIndex, pVBInfo);
+ XGI_GetCRT2Data(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
+ XGI_PreSetGroup1(ModeNo, ModeIdIndex, HwDeviceExtension,
+ RefreshRateTableIndex, pVBInfo);
+ XGI_SetGroup1(ModeNo, ModeIdIndex, HwDeviceExtension,
+ RefreshRateTableIndex, pVBInfo);
+ XGI_SetLockRegs(ModeNo, ModeIdIndex, HwDeviceExtension,
+ RefreshRateTableIndex, pVBInfo);
+ XGI_SetGroup2(ModeNo, ModeIdIndex, RefreshRateTableIndex,
+ HwDeviceExtension, pVBInfo);
+ XGI_SetLCDRegs(ModeNo, ModeIdIndex, HwDeviceExtension,
+ RefreshRateTableIndex, pVBInfo);
+ XGI_SetTap4Regs(pVBInfo);
+ XGI_SetGroup3(ModeNo, ModeIdIndex, pVBInfo);
+ XGI_SetGroup4(ModeNo, ModeIdIndex, RefreshRateTableIndex,
+ HwDeviceExtension, pVBInfo);
+ XGI_SetCRT2VCLK(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
+ XGI_SetGroup5(ModeNo, ModeIdIndex, pVBInfo);
+ XGI_AutoThreshold(pVBInfo);
+ return 1;
+}
- VCLKIndex += 25;
+void XGI_SenseCRT1(struct vb_device_info *pVBInfo)
+{
+ unsigned char CRTCData[17] = { 0x5F, 0x4F, 0x50, 0x82, 0x55, 0x81,
+ 0x0B, 0x3E, 0xE9, 0x0B, 0xDF, 0xE7, 0x04, 0x00, 0x00,
+ 0x05, 0x00 };
- } else {
- VCLKIndex = HiTVVCLK;
+ unsigned char SR01 = 0, SR1F = 0, SR07 = 0, SR06 = 0;
- VCLKIndex += 25;
+ unsigned char CR17, CR63, SR31;
+ unsigned short temp;
+ unsigned char DAC_TEST_PARMS[3] = { 0x0F, 0x0F, 0x0F };
- }
+ int i;
+ xgifb_reg_set(pVBInfo->P3c4, 0x05, 0x86);
- if (pVBInfo->SetFlag & TVSimuMode) {
- if (modeflag & Charx8Dot) {
- VCLKIndex
- = HiTVSimuVCLK;
+ /* [2004/05/06] Vicent to fix XG42 single LCD sense to CRT+LCD */
+ xgifb_reg_set(pVBInfo->P3d4, 0x57, 0x4A);
+ xgifb_reg_set(pVBInfo->P3d4, 0x53, (unsigned char) (xgifb_reg_get(
+ pVBInfo->P3d4, 0x53) | 0x02));
- VCLKIndex += 25;
+ SR31 = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x31);
+ CR63 = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x63);
+ SR01 = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x01);
- } else {
- VCLKIndex
- = HiTVTextVCLK;
+ xgifb_reg_set(pVBInfo->P3c4, 0x01, (unsigned char) (SR01 & 0xDF));
+ xgifb_reg_set(pVBInfo->P3d4, 0x63, (unsigned char) (CR63 & 0xBF));
- VCLKIndex += 25;
+ CR17 = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x17);
+ xgifb_reg_set(pVBInfo->P3d4, 0x17, (unsigned char) (CR17 | 0x80));
- }
- }
+ SR1F = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x1F);
+ xgifb_reg_set(pVBInfo->P3c4, 0x1F, (unsigned char) (SR1F | 0x04));
- if (pVBInfo->VBType & VB_XGI301LV) { /* 301lv */
- if (!(pVBInfo->VBExtInfo
- == VB_YPbPr1080i)) {
- VCLKIndex
- = YPbPr750pVCLK;
- if (!(pVBInfo->VBExtInfo
- == VB_YPbPr750p)) {
- VCLKIndex
- = YPbPr525pVCLK;
- if (!(pVBInfo->VBExtInfo
- == VB_YPbPr525p)) {
- VCLKIndex
- = YPbPr525iVCLK_2;
- if (!(pVBInfo->SetFlag
- & RPLLDIV2XO))
- VCLKIndex
- = YPbPr525iVCLK;
- }
- }
- }
- }
- } else {
- if (pVBInfo->VBInfo & SetCRT2ToTV) {
- if (pVBInfo->SetFlag
- & RPLLDIV2XO) {
- VCLKIndex = TVVCLKDIV2;
+ SR07 = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x07);
+ xgifb_reg_set(pVBInfo->P3c4, 0x07, (unsigned char) (SR07 & 0xFB));
+ SR06 = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x06);
+ xgifb_reg_set(pVBInfo->P3c4, 0x06, (unsigned char) (SR06 & 0xC3));
- VCLKIndex += 25;
+ xgifb_reg_set(pVBInfo->P3d4, 0x11, 0x00);
- } else {
- VCLKIndex = TVVCLK;
+ for (i = 0; i < 8; i++)
+ xgifb_reg_set(pVBInfo->P3d4, (unsigned short) i, CRTCData[i]);
- VCLKIndex += 25;
+ for (i = 8; i < 11; i++)
+ xgifb_reg_set(pVBInfo->P3d4, (unsigned short) (i + 8),
+ CRTCData[i]);
- }
- }
+ for (i = 11; i < 13; i++)
+ xgifb_reg_set(pVBInfo->P3d4, (unsigned short) (i + 4),
+ CRTCData[i]);
+
+ for (i = 13; i < 16; i++)
+ xgifb_reg_set(pVBInfo->P3c4, (unsigned short) (i - 3),
+ CRTCData[i]);
+
+ xgifb_reg_set(pVBInfo->P3c4, 0x0E, (unsigned char) (CRTCData[16]
+ & 0xE0));
+
+ xgifb_reg_set(pVBInfo->P3c4, 0x31, 0x00);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2B, 0x1B);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2C, 0xE1);
+
+ outb(0x00, pVBInfo->P3c8);
+
+ for (i = 0; i < 256; i++) {
+ outb((unsigned char) DAC_TEST_PARMS[0], (pVBInfo->P3c8 + 1));
+ outb((unsigned char) DAC_TEST_PARMS[1], (pVBInfo->P3c8 + 1));
+ outb((unsigned char) DAC_TEST_PARMS[2], (pVBInfo->P3c8 + 1));
+ }
+
+ XGI_VBLongWait(pVBInfo);
+ XGI_VBLongWait(pVBInfo);
+ XGI_VBLongWait(pVBInfo);
+
+ mdelay(1);
+
+ XGI_WaitDisply(pVBInfo);
+ temp = inb(pVBInfo->P3c2);
+
+ if (temp & 0x10)
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x32, 0xDF, 0x20);
+ else
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x32, 0xDF, 0x00);
+
+ /* alan, avoid display something, set BLACK DAC if not restore DAC */
+ outb(0x00, pVBInfo->P3c8);
+
+ for (i = 0; i < 256; i++) {
+ outb(0, (pVBInfo->P3c8 + 1));
+ outb(0, (pVBInfo->P3c8 + 1));
+ outb(0, (pVBInfo->P3c8 + 1));
+ }
+
+ xgifb_reg_set(pVBInfo->P3c4, 0x01, SR01);
+ xgifb_reg_set(pVBInfo->P3d4, 0x63, CR63);
+ xgifb_reg_set(pVBInfo->P3c4, 0x31, SR31);
+
+ /* [2004/05/11] Vicent */
+ xgifb_reg_set(pVBInfo->P3d4, 0x53, (unsigned char) (xgifb_reg_get(
+ pVBInfo->P3d4, 0x53) & 0xFD));
+ xgifb_reg_set(pVBInfo->P3c4, 0x1F, (unsigned char) SR1F);
+}
+
+void XGI_EnableBridge(struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short tempah;
+
+ if (pVBInfo->SetFlag == Win9xDOSMode) {
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C)) {
+ XGI_DisplayOn(HwDeviceExtension, pVBInfo);
+ return;
+ } else
+ /* LVDS or CH7017 */
+ return;
+ }
+
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C)) {
+ if (!(pVBInfo->SetFlag & DisableChA)) {
+ if (pVBInfo->SetFlag & EnableChA) {
+ xgifb_reg_set(pVBInfo->Part1Port, 0x1E, 0x20); /* Power on */
+ } else {
+ if (pVBInfo->VBInfo & SetCRT2ToDualEdge) { /* SetCRT2ToLCDA ) */
+ xgifb_reg_set(pVBInfo->Part1Port,
+ 0x1E, 0x20); /* Power on */
}
- } else { /* for CRT2 */
- VCLKIndex = (unsigned char) XGINew_GetReg2(
- (pVBInfo->P3ca + 0x02)); /* Port 3cch */
- VCLKIndex = ((VCLKIndex >> 2) & 0x03);
- if (ModeNo > 0x13) {
- VCLKIndex
- = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; /* di+Ext_CRTVCLK */
- VCLKIndex &= IndexMask;
+ }
+ }
+
+ if (!(pVBInfo->SetFlag & DisableChB)) {
+ if ((pVBInfo->SetFlag & EnableChB) || (pVBInfo->VBInfo
+ & (SetCRT2ToLCD | SetCRT2ToTV
+ | SetCRT2ToRAMDAC))) {
+ tempah = (unsigned char) xgifb_reg_get(
+ pVBInfo->P3c4, 0x32);
+ tempah &= 0xDF;
+ if (pVBInfo->VBInfo & SetInSlaveMode) {
+ if (!(pVBInfo->VBInfo & SetCRT2ToRAMDAC))
+ tempah |= 0x20;
}
+ xgifb_reg_set(pVBInfo->P3c4, 0x32, tempah);
+ xgifb_reg_or(pVBInfo->P3c4, 0x1E, 0x20);
+
+ tempah = (unsigned char) xgifb_reg_get(
+ pVBInfo->Part1Port, 0x2E);
+
+ if (!(tempah & 0x80))
+ xgifb_reg_or(pVBInfo->Part1Port,
+ 0x2E, 0x80); /* BVBDOENABLE = 1 */
+
+ xgifb_reg_and(pVBInfo->Part1Port, 0x00, 0x7F); /* BScreenOFF = 0 */
}
}
- } else { /* LVDS */
- if (ModeNo <= 0x13)
- VCLKIndex = CRT2Index;
- else
- VCLKIndex = CRT2Index;
- if (pVBInfo->IF_DEF_CH7005 == 1) {
- if (!(pVBInfo->VBInfo & SetCRT2ToLCD)) {
- VCLKIndex &= 0x1f;
- tempbx = 0;
+ if ((pVBInfo->SetFlag & (EnableChA | EnableChB))
+ || (!(pVBInfo->VBInfo & DisableCRT2Display))) {
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x00, ~0xE0,
+ 0x20); /* shampoo 0129 */
+ if (pVBInfo->VBType & (VB_XGI302LV | VB_XGI301C)) {
+ if (!XGI_DisableChISLCD(pVBInfo)) {
+ if (XGI_EnableChISLCD(pVBInfo)
+ || (pVBInfo->VBInfo
+ & (SetCRT2ToLCD
+ | SetCRT2ToLCDA)))
+ xgifb_reg_and(
+ pVBInfo->Part4Port,
+ 0x2A, 0x7F); /* LVDS PLL power on */
+ }
+ xgifb_reg_and(pVBInfo->Part4Port, 0x30, 0x7F); /* LVDS Driver power on */
+ }
+ }
- if (pVBInfo->VBInfo & SetPALTV)
- tempbx += 2;
+ tempah = 0x00;
- if (pVBInfo->VBInfo & SetCHTVOverScan)
- tempbx += 1;
+ if (!(pVBInfo->VBInfo & DisableCRT2Display)) {
+ tempah = 0xc0;
- switch (tempbx) {
- case 0:
- CHTVVCLKPtr = pVBInfo->CHTVVCLKUNTSC;
- break;
- case 1:
- CHTVVCLKPtr = pVBInfo->CHTVVCLKONTSC;
- break;
- case 2:
- CHTVVCLKPtr = pVBInfo->CHTVVCLKUPAL;
- break;
- case 3:
- CHTVVCLKPtr = pVBInfo->CHTVVCLKOPAL;
- break;
- default:
- break;
+ if (!(pVBInfo->VBInfo & SetSimuScanMode)) {
+ if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
+ if (pVBInfo->VBInfo & SetCRT2ToDualEdge) {
+ tempah = tempah & 0x40;
+ if (pVBInfo->VBInfo
+ & SetCRT2ToLCDA)
+ tempah = tempah ^ 0xC0;
+
+ if (pVBInfo->SetFlag
+ & DisableChB)
+ tempah &= 0xBF;
+
+ if (pVBInfo->SetFlag
+ & DisableChA)
+ tempah &= 0x7F;
+
+ if (pVBInfo->SetFlag
+ & EnableChB)
+ tempah |= 0x40;
+
+ if (pVBInfo->SetFlag
+ & EnableChA)
+ tempah |= 0x80;
+ }
}
+ }
+ }
- VCLKIndex = CHTVVCLKPtr[VCLKIndex];
+ xgifb_reg_or(pVBInfo->Part4Port, 0x1F, tempah); /* EnablePart4_1F */
+
+ if (pVBInfo->SetFlag & Win9xDOSMode) {
+ XGI_DisplayOn(HwDeviceExtension, pVBInfo);
+ return;
+ }
+
+ if (!(pVBInfo->SetFlag & DisableChA)) {
+ XGI_VBLongWait(pVBInfo);
+ if (!(pVBInfo->SetFlag & GatingCRT)) {
+ XGI_DisableGatingCRT(HwDeviceExtension, pVBInfo);
+ XGI_DisplayOn(HwDeviceExtension, pVBInfo);
+ XGI_VBLongWait(pVBInfo);
}
- } else {
- VCLKIndex = VCLKIndex >> 6;
- if ((pVBInfo->LCDResInfo == Panel800x600)
- || (pVBInfo->LCDResInfo == Panel320x480))
- VCLKIndex = LVDSXlat1VCLK[VCLKIndex];
- else if ((pVBInfo->LCDResInfo == Panel1024x768)
- || (pVBInfo->LCDResInfo
- == Panel1024x768x75))
- VCLKIndex = LVDSXlat2VCLK[VCLKIndex];
+ }
+ } /* 301 */
+ else { /* LVDS */
+ if (pVBInfo->VBInfo & (SetCRT2ToTV | SetCRT2ToLCD
+ | SetCRT2ToLCDA))
+ xgifb_reg_or(pVBInfo->Part1Port, 0x1E, 0x20); /* enable CRT2 */
+
+ tempah = (unsigned char) xgifb_reg_get(pVBInfo->Part1Port,
+ 0x2E);
+ if (!(tempah & 0x80))
+ xgifb_reg_or(pVBInfo->Part1Port, 0x2E, 0x80); /* BVBDOENABLE = 1 */
+
+ xgifb_reg_and(pVBInfo->Part1Port, 0x00, 0x7F);
+ XGI_DisplayOn(HwDeviceExtension, pVBInfo);
+ } /* End of VB */
+}
+
+static void XGI_SetCRT1Group(struct xgi_hw_device_info *HwDeviceExtension,
+ unsigned short ModeNo, unsigned short ModeIdIndex,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short StandTableIndex, RefreshRateTableIndex, b3CC, temp;
+
+ unsigned short XGINew_P3cc = pVBInfo->P3cc;
+
+ /* XGINew_CRT1Mode = ModeNo; // SaveModeID */
+ StandTableIndex = XGI_GetModePtr(ModeNo, ModeIdIndex, pVBInfo);
+ /* XGI_SetBIOSData(ModeNo, ModeIdIndex); */
+ /* XGI_ClearBankRegs(ModeNo, ModeIdIndex); */
+ XGI_SetSeqRegs(ModeNo, StandTableIndex, ModeIdIndex, pVBInfo);
+ XGI_SetMiscRegs(StandTableIndex, pVBInfo);
+ XGI_SetCRTCRegs(HwDeviceExtension, StandTableIndex, pVBInfo);
+ XGI_SetATTRegs(ModeNo, StandTableIndex, ModeIdIndex, pVBInfo);
+ XGI_SetGRCRegs(StandTableIndex, pVBInfo);
+ XGI_ClearExt1Regs(pVBInfo);
+
+ /* if (pVBInfo->IF_DEF_ExpLink) */
+ if (HwDeviceExtension->jChipType == XG27) {
+ if (pVBInfo->IF_DEF_LVDS == 0)
+ XGI_SetDefaultVCLK(pVBInfo);
+ }
+
+ temp = ~ProgrammingCRT2;
+ pVBInfo->SetFlag &= temp;
+ pVBInfo->SelectCRT2Rate = 0;
+
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C)) {
+ if (pVBInfo->VBInfo & (SetSimuScanMode | SetCRT2ToLCDA
+ | SetInSlaveMode)) {
+ pVBInfo->SetFlag |= ProgrammingCRT2;
+ }
+ }
+
+ RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo,
+ ModeIdIndex, pVBInfo);
+ if (RefreshRateTableIndex != 0xFFFF) {
+ XGI_SetSync(RefreshRateTableIndex, pVBInfo);
+ XGI_SetCRT1CRTC(ModeNo, ModeIdIndex, RefreshRateTableIndex,
+ pVBInfo, HwDeviceExtension);
+ XGI_SetCRT1DE(HwDeviceExtension, ModeNo, ModeIdIndex,
+ RefreshRateTableIndex, pVBInfo);
+ XGI_SetCRT1Offset(ModeNo, ModeIdIndex, RefreshRateTableIndex,
+ HwDeviceExtension, pVBInfo);
+ XGI_SetCRT1VCLK(ModeNo, ModeIdIndex, HwDeviceExtension,
+ RefreshRateTableIndex, pVBInfo);
+ }
+
+ if ((HwDeviceExtension->jChipType >= XG20)
+ && (HwDeviceExtension->jChipType < XG27)) { /* fix H/W DCLK/2 bug */
+ if ((ModeNo == 0x00) | (ModeNo == 0x01)) {
+ xgifb_reg_set(pVBInfo->P3c4, 0x2B, 0x4E);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2C, 0xE9);
+ b3CC = (unsigned char) inb(XGINew_P3cc);
+ outb((b3CC |= 0x0C), XGINew_P3cc);
+ } else if ((ModeNo == 0x04) | (ModeNo == 0x05) | (ModeNo
+ == 0x0D)) {
+ xgifb_reg_set(pVBInfo->P3c4, 0x2B, 0x1B);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2C, 0xE3);
+ b3CC = (unsigned char) inb(XGINew_P3cc);
+ outb((b3CC |= 0x0C), XGINew_P3cc);
+ }
+ }
+
+ if (HwDeviceExtension->jChipType >= XG21) {
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x38);
+ if (temp & 0xA0) {
+
+ /* xgifb_reg_and(pVBInfo->P3d4, 0x4A, ~0x20); *//* Enable write GPIOF */
+ /* xgifb_reg_and(pVBInfo->P3d4, 0x48, ~0x20); *//* P. DWN */
+ /* XG21 CRT1 Timing */
+ if (HwDeviceExtension->jChipType == XG27)
+ XGI_SetXG27CRTC(ModeNo, ModeIdIndex,
+ RefreshRateTableIndex, pVBInfo);
else
- VCLKIndex = LVDSXlat3VCLK[VCLKIndex];
+ XGI_SetXG21CRTC(ModeNo, ModeIdIndex,
+ RefreshRateTableIndex, pVBInfo);
+
+ XGI_UpdateXG21CRTC(ModeNo, pVBInfo,
+ RefreshRateTableIndex);
+
+ if (HwDeviceExtension->jChipType == XG27)
+ XGI_SetXG27LCD(pVBInfo, RefreshRateTableIndex,
+ ModeNo);
+ else
+ XGI_SetXG21LCD(pVBInfo, RefreshRateTableIndex,
+ ModeNo);
+
+ if (pVBInfo->IF_DEF_LVDS == 1) {
+ if (HwDeviceExtension->jChipType == XG27)
+ XGI_SetXG27LVDSPara(ModeNo,
+ ModeIdIndex, pVBInfo);
+ else
+ XGI_SetXG21LVDSPara(ModeNo,
+ ModeIdIndex, pVBInfo);
+ }
+ /* xgifb_reg_or(pVBInfo->P3d4, 0x48, 0x20); *//* P. ON */
}
}
- /* VCLKIndex = VCLKIndex&IndexMask; */
- return VCLKIndex;
+ pVBInfo->SetFlag &= (~ProgrammingCRT2);
+ XGI_SetCRT1FIFO(ModeNo, HwDeviceExtension, pVBInfo);
+ XGI_SetCRT1ModeRegs(HwDeviceExtension, ModeNo, ModeIdIndex,
+ RefreshRateTableIndex, pVBInfo);
+
+ /* XGI_LoadCharacter(); //dif ifdef TVFont */
+
+ XGI_LoadDAC(ModeNo, ModeIdIndex, pVBInfo);
+ /* XGI_ClearBuffer(HwDeviceExtension, ModeNo, pVBInfo); */
}
+unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension,
+ unsigned short ModeNo)
+{
+ unsigned short ModeIdIndex;
+ /* unsigned char *pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress; */
+ struct vb_device_info VBINF;
+ struct vb_device_info *pVBInfo = &VBINF;
+ pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase;
+ pVBInfo->BaseAddr = (unsigned long) HwDeviceExtension->pjIOAddress;
+ pVBInfo->IF_DEF_LVDS = 0;
+ pVBInfo->IF_DEF_CH7005 = 0;
+ pVBInfo->IF_DEF_LCDA = 1;
+ pVBInfo->IF_DEF_CH7017 = 0;
+ pVBInfo->IF_DEF_CH7007 = 0; /* [Billy] 2007/05/14 */
+ pVBInfo->IF_DEF_VideoCapture = 0;
+ pVBInfo->IF_DEF_ScaleLCD = 0;
+ pVBInfo->IF_DEF_OEMUtil = 0;
+ pVBInfo->IF_DEF_PWD = 0;
+
+ if (HwDeviceExtension->jChipType >= XG20) { /* kuku 2004/06/25 */
+ pVBInfo->IF_DEF_YPbPr = 0;
+ pVBInfo->IF_DEF_HiVision = 0;
+ pVBInfo->IF_DEF_CRT2Monitor = 0;
+ pVBInfo->VBType = 0; /*set VBType default 0*/
+ } else {
+ pVBInfo->IF_DEF_YPbPr = 1;
+ pVBInfo->IF_DEF_HiVision = 1;
+ pVBInfo->IF_DEF_CRT2Monitor = 1;
+ }
+
+ pVBInfo->P3c4 = pVBInfo->BaseAddr + 0x14;
+ pVBInfo->P3d4 = pVBInfo->BaseAddr + 0x24;
+ pVBInfo->P3c0 = pVBInfo->BaseAddr + 0x10;
+ pVBInfo->P3ce = pVBInfo->BaseAddr + 0x1e;
+ pVBInfo->P3c2 = pVBInfo->BaseAddr + 0x12;
+ pVBInfo->P3cc = pVBInfo->BaseAddr + 0x1C;
+ pVBInfo->P3ca = pVBInfo->BaseAddr + 0x1a;
+ pVBInfo->P3c6 = pVBInfo->BaseAddr + 0x16;
+ pVBInfo->P3c7 = pVBInfo->BaseAddr + 0x17;
+ pVBInfo->P3c8 = pVBInfo->BaseAddr + 0x18;
+ pVBInfo->P3c9 = pVBInfo->BaseAddr + 0x19;
+ pVBInfo->P3da = pVBInfo->BaseAddr + 0x2A;
+ pVBInfo->Part0Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_00;
+ pVBInfo->Part1Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_04;
+ pVBInfo->Part2Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_10;
+ pVBInfo->Part3Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_12;
+ pVBInfo->Part4Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14;
+ pVBInfo->Part5Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14 + 2;
+
+ if (HwDeviceExtension->jChipType == XG21) { /* for x86 Linux, XG21 LVDS */
+ if ((xgifb_reg_get(pVBInfo->P3d4, 0x38) & 0xE0) == 0xC0)
+ pVBInfo->IF_DEF_LVDS = 1;
+ }
+ if (HwDeviceExtension->jChipType == XG27) {
+ if ((xgifb_reg_get(pVBInfo->P3d4, 0x38) & 0xE0) == 0xC0) {
+ if (xgifb_reg_get(pVBInfo->P3d4, 0x30) & 0x20)
+ pVBInfo->IF_DEF_LVDS = 1;
+ }
+ }
+
+ if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 */
+ XGI_GetVBType(pVBInfo);
+
+ InitTo330Pointer(HwDeviceExtension->jChipType, pVBInfo);
+ if (ModeNo & 0x80) {
+ ModeNo = ModeNo & 0x7F;
+ /* XGINew_flag_clearbuffer = 0; */
+ }
+ /* else {
+ XGINew_flag_clearbuffer = 1;
+ }
+ */
+ xgifb_reg_set(pVBInfo->P3c4, 0x05, 0x86);
+
+ if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 1.Openkey */
+ XGI_UnLockCRT2(HwDeviceExtension, pVBInfo);
+
+ XGI_SearchModeID(ModeNo, &ModeIdIndex, pVBInfo);
+
+ XGI_GetVGAType(HwDeviceExtension, pVBInfo);
+
+ if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */
+ XGI_GetVBInfo(ModeNo, ModeIdIndex, HwDeviceExtension, pVBInfo);
+ XGI_GetTVInfo(ModeNo, ModeIdIndex, pVBInfo);
+ XGI_GetLCDInfo(ModeNo, ModeIdIndex, pVBInfo);
+ XGI_DisableBridge(HwDeviceExtension, pVBInfo);
+ /* XGI_OpenCRTC(HwDeviceExtension, pVBInfo); */
+
+ if (pVBInfo->VBInfo & (SetSimuScanMode | SetCRT2ToLCDA)) {
+ XGI_SetCRT1Group(HwDeviceExtension, ModeNo,
+ ModeIdIndex, pVBInfo);
+
+ if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
+ XGI_SetLCDAGroup(ModeNo, ModeIdIndex,
+ HwDeviceExtension, pVBInfo);
+ }
+ } else {
+ if (!(pVBInfo->VBInfo & SwitchToCRT2)) {
+ XGI_SetCRT1Group(HwDeviceExtension, ModeNo,
+ ModeIdIndex, pVBInfo);
+ if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
+ XGI_SetLCDAGroup(ModeNo, ModeIdIndex,
+ HwDeviceExtension,
+ pVBInfo);
+ }
+ }
+ }
+
+ if (pVBInfo->VBInfo & (SetSimuScanMode | SwitchToCRT2)) {
+ switch (HwDeviceExtension->ujVBChipID) {
+ case VB_CHIP_301:
+ XGI_SetCRT2Group301(ModeNo, HwDeviceExtension,
+ pVBInfo); /*add for CRT2 */
+ break;
+
+ case VB_CHIP_302:
+ XGI_SetCRT2Group301(ModeNo, HwDeviceExtension,
+ pVBInfo); /*add for CRT2 */
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ XGI_SetCRT2ModeRegs(ModeNo, HwDeviceExtension, pVBInfo);
+ XGI_OEM310Setting(ModeNo, ModeIdIndex, pVBInfo); /*0212*/
+ XGI_CloseCRTC(HwDeviceExtension, pVBInfo);
+ XGI_EnableBridge(HwDeviceExtension, pVBInfo);
+ } /* !XG20 */
+ else {
+ if (pVBInfo->IF_DEF_LVDS == 1)
+ if (!XGI_XG21CheckLVDSMode(ModeNo, ModeIdIndex, pVBInfo))
+ return 0;
+
+ if (ModeNo <= 0x13) {
+ pVBInfo->ModeType
+ = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag
+ & ModeInfoFlag;
+ } else {
+ pVBInfo->ModeType
+ = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag
+ & ModeInfoFlag;
+ }
+
+ pVBInfo->SetFlag = 0;
+ if (pVBInfo->IF_DEF_CH7007 != 1)
+ pVBInfo->VBInfo = DisableCRT2Display;
+
+ XGI_DisplayOff(HwDeviceExtension, pVBInfo);
+
+ XGI_SetCRT1Group(HwDeviceExtension, ModeNo, ModeIdIndex,
+ pVBInfo);
+
+ XGI_DisplayOn(HwDeviceExtension, pVBInfo);
+ /*
+ if (HwDeviceExtension->jChipType == XG21)
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x09, ~0x80, 0x80);
+ */
+ }
+
+ /*
+ if (ModeNo <= 0x13) {
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
+ } else {
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ }
+ pVBInfo->ModeType = modeflag&ModeInfoFlag;
+ pVBInfo->SetFlag = 0x00;
+ pVBInfo->VBInfo = DisableCRT2Display;
+ temp = XGINew_CheckMemorySize(HwDeviceExtension, ModeNo, ModeIdIndex, pVBInfo);
+
+ if (temp == 0)
+ return (0);
+
+ XGI_DisplayOff(HwDeviceExtension, pVBInfo) ;
+ XGI_SetCRT1Group(HwDeviceExtension, ModeNo, ModeIdIndex, pVBInfo);
+ XGI_DisplayOn(HwDeviceExtension, pVBInfo);
+ */
+
+ XGI_UpdateModeInfo(HwDeviceExtension, pVBInfo);
+
+ if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */
+ XGI_LockCRT2(HwDeviceExtension, pVBInfo);
+ }
+
+ return 1;
+}
diff --git a/drivers/staging/xgifb/vb_setmode.h b/drivers/staging/xgifb/vb_setmode.h
index 0dcc29796176..7a2e564b0744 100644
--- a/drivers/staging/xgifb/vb_setmode.h
+++ b/drivers/staging/xgifb/vb_setmode.h
@@ -17,9 +17,6 @@ extern void XGI_SenseCRT1(struct vb_device_info *);
extern void XGI_GetVGAType(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *);
extern void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *);
extern void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *);
-extern void XGI_SetCRT1Offset(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *);
-extern void XGI_SetLCDAGroup(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *);
-extern void XGI_WaitDisply(struct vb_device_info *);
extern unsigned short XGI_GetResInfo(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
extern unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo) ;
@@ -36,7 +33,6 @@ extern void XGI_XG21BLSignalVDD(unsigned short tempbh, unsigned short temp
extern void XGI_XG27BLSignalVDD(unsigned short tempbh, unsigned short tempbl, struct vb_device_info *pVBInfo);
extern void XGI_XG21SetPanelDelay(unsigned short tempbl, struct vb_device_info *pVBInfo);
extern unsigned char XGI_XG21CheckLVDSMode(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-extern void XGI_SetXG21LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
extern unsigned short XGI_GetLVDSOEMTableIndex(struct vb_device_info *pVBInfo);
#endif
diff --git a/drivers/staging/xgifb/vb_table.h b/drivers/staging/xgifb/vb_table.h
index 78b1c796f01e..d71cd55a7057 100644
--- a/drivers/staging/xgifb/vb_table.h
+++ b/drivers/staging/xgifb/vb_table.h
@@ -1,17 +1,5 @@
#define Tap4
-
-static struct XGI_MCLKDataStruct XGI330New_MCLKData[] =
-{
- { 0x5c,0x23,0x01,166},
- { 0x5c,0x23,0x01,166},
- { 0x7C,0x08,0x80,200},
- { 0x79,0x06,0x80,250},
- { 0x29,0x01,0x81,300},
- { 0x29,0x01,0x81,300},
- { 0x29,0x01,0x81,300},
- { 0x29,0x01,0x81,300}
-};
//yilin modify for xgi20
static struct XGI_MCLKDataStruct XGI340New_MCLKData[] =
{
@@ -37,17 +25,6 @@ static struct XGI_MCLKDataStruct XGI27New_MCLKData[] =
{ 0x5c,0x23,0x01,166}
};
-static struct XGI_ECLKDataStruct XGI330_ECLKData[] =
-{
- { 0x7c,0x08,0x01,200},
- { 0x7c,0x08,0x01,200},
- { 0x7C,0x08,0x80,200},
- { 0x79,0x06,0x80,250},
- { 0x29,0x01,0x81,300},
- { 0x29,0x01,0x81,300},
- { 0x29,0x01,0x81,300},
- { 0x29,0x01,0x81,300}
-};
//yilin modify for xgi20
static struct XGI_ECLKDataStruct XGI340_ECLKData[] =
{
diff --git a/drivers/staging/xgifb/vb_util.c b/drivers/staging/xgifb/vb_util.c
index 65b3954d8ff2..a97e44f98c08 100644
--- a/drivers/staging/xgifb/vb_util.c
+++ b/drivers/staging/xgifb/vb_util.c
@@ -6,131 +6,47 @@
#include <asm/io.h>
#include <linux/types.h>
-void XGINew_SetReg1(unsigned long, unsigned short, unsigned short);
-void XGINew_SetReg2(unsigned long, unsigned short, unsigned short);
-void XGINew_SetReg3(unsigned long, unsigned short);
-void XGINew_SetReg4(unsigned long, unsigned long);
-unsigned char XGINew_GetReg1(unsigned long, unsigned short);
-unsigned char XGINew_GetReg2(unsigned long);
-unsigned long XGINew_GetReg3(unsigned long);
-void XGINew_ClearDAC(unsigned char *);
-void XGINew_SetRegANDOR(unsigned long Port, unsigned short Index,
- unsigned short DataAND, unsigned short DataOR);
-void XGINew_SetRegOR(unsigned long Port, unsigned short Index,
- unsigned short DataOR);
-void XGINew_SetRegAND(unsigned long Port, unsigned short Index,
- unsigned short DataAND);
+#include "vb_util.h"
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_SetReg1 */
-/* Input : */
-/* Output : */
-/* Description : SR CRTC GR */
-/* --------------------------------------------------------------------- */
-void XGINew_SetReg1(unsigned long port, unsigned short index,
- unsigned short data)
+void xgifb_reg_set(unsigned long port, u8 index, u8 data)
{
outb(index, port);
outb(data, port + 1);
}
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_SetReg2 */
-/* Input : */
-/* Output : */
-/* Description : AR( 3C0 ) */
-/* --------------------------------------------------------------------- */
-/*
-void XGINew_SetReg2(unsigned long port, unsigned short index, unsigned short data)
+u8 xgifb_reg_get(unsigned long port, u8 index)
{
- InPortByte((P unsigned char)port + 0x3da - 0x3c0) ;
- OutPortByte(XGINew_P3c0, index);
- OutPortByte(XGINew_P3c0, data);
- OutPortByte(XGINew_P3c0, 0x20);
-}
-*/
-
-void XGINew_SetReg3(unsigned long port, unsigned short data)
-{
- outb(data, port);
-}
-
-void XGINew_SetReg4(unsigned long port, unsigned long data)
-{
- outl(data, port);
-}
-
-unsigned char XGINew_GetReg1(unsigned long port, unsigned short index)
-{
- unsigned char data;
+ u8 data;
outb(index, port);
data = inb(port + 1);
return data;
}
-unsigned char XGINew_GetReg2(unsigned long port)
+void xgifb_reg_and_or(unsigned long port, u8 index,
+ unsigned data_and, unsigned data_or)
{
- unsigned char data;
-
- data = inb(port);
+ u8 temp;
- return data;
+ temp = xgifb_reg_get(port, index); /* XGINew_Part1Port index 02 */
+ temp = (temp & data_and) | data_or;
+ xgifb_reg_set(port, index, temp);
}
-unsigned long XGINew_GetReg3(unsigned long port)
+void xgifb_reg_and(unsigned long port, u8 index, unsigned data_and)
{
- unsigned long data;
-
- data = inl(port);
+ u8 temp;
- return data;
+ temp = xgifb_reg_get(port, index); /* XGINew_Part1Port index 02 */
+ temp &= data_and;
+ xgifb_reg_set(port, index, temp);
}
-void XGINew_SetRegANDOR(unsigned long Port, unsigned short Index,
- unsigned short DataAND, unsigned short DataOR)
+void xgifb_reg_or(unsigned long port, u8 index, unsigned data_or)
{
- unsigned short temp;
-
- temp = XGINew_GetReg1(Port, Index); /* XGINew_Part1Port index 02 */
- temp = (temp & (DataAND)) | DataOR;
- XGINew_SetReg1(Port, Index, temp);
-}
+ u8 temp;
-void XGINew_SetRegAND(unsigned long Port, unsigned short Index,
- unsigned short DataAND)
-{
- unsigned short temp;
-
- temp = XGINew_GetReg1(Port, Index); /* XGINew_Part1Port index 02 */
- temp &= DataAND;
- XGINew_SetReg1(Port, Index, temp);
-}
-
-void XGINew_SetRegOR(unsigned long Port, unsigned short Index,
- unsigned short DataOR)
-{
- unsigned short temp;
-
- temp = XGINew_GetReg1(Port, Index); /* XGINew_Part1Port index 02 */
- temp |= DataOR;
- XGINew_SetReg1(Port, Index, temp);
-}
-
-#if 0
-void NewDelaySeconds(int seconds)
-{
- int i;
-
- for (i = 0; i < seconds; i++) {
-
- }
-}
-
-void Newdebugcode(unsigned char code)
-{
- /* OutPortByte(0x80, code); */
- /* OutPortByte(0x300, code); */
- /* NewDelaySeconds(0x3); */
+ temp = xgifb_reg_get(port, index); /* XGINew_Part1Port index 02 */
+ temp |= data_or;
+ xgifb_reg_set(port, index, temp);
}
-#endif
diff --git a/drivers/staging/xgifb/vb_util.h b/drivers/staging/xgifb/vb_util.h
index 156f6445c88d..9161de1d37dd 100644
--- a/drivers/staging/xgifb/vb_util.h
+++ b/drivers/staging/xgifb/vb_util.h
@@ -1,15 +1,9 @@
#ifndef _VBUTIL_
#define _VBUTIL_
-extern void NewDelaySeconds( int );
-extern void Newdebugcode(unsigned char);
-extern void XGINew_SetReg1(unsigned long, unsigned short, unsigned short);
-extern void XGINew_SetReg3(unsigned long, unsigned short);
-extern unsigned char XGINew_GetReg1(unsigned long, unsigned short);
-extern unsigned char XGINew_GetReg2(unsigned long);
-extern void XGINew_SetReg4(unsigned long, unsigned long);
-extern unsigned long XGINew_GetReg3(unsigned long);
-extern void XGINew_SetRegOR(unsigned long Port,unsigned short Index,unsigned short DataOR);
-extern void XGINew_SetRegAND(unsigned long Port,unsigned short Index,unsigned short DataAND);
-extern void XGINew_SetRegANDOR(unsigned long Port,unsigned short Index,unsigned short DataAND,unsigned short DataOR);
+extern void xgifb_reg_set(unsigned long, u8, u8);
+extern u8 xgifb_reg_get(unsigned long, u8);
+extern void xgifb_reg_or(unsigned long, u8, unsigned);
+extern void xgifb_reg_and(unsigned long, u8, unsigned);
+extern void xgifb_reg_and_or(unsigned long, u8, unsigned, unsigned);
#endif
diff --git a/drivers/staging/xgifb/vgatypes.h b/drivers/staging/xgifb/vgatypes.h
index df839eeb5efd..d613e84aab62 100644
--- a/drivers/staging/xgifb/vgatypes.h
+++ b/drivers/staging/xgifb/vgatypes.h
@@ -4,10 +4,6 @@
#include <linux/ioctl.h>
-#ifndef VBIOS_VER_MAX_LENGTH
-#define VBIOS_VER_MAX_LENGTH 5
-#endif
-
#ifndef XGI_VB_CHIP_TYPE
enum XGI_VB_CHIP_TYPE {
VB_CHIP_Legacy = 0,
@@ -65,10 +61,6 @@ struct xgi_hw_device_info
unsigned char *pjVirtualRomBase; /* ROM image */
- unsigned char UseROM; /* Use the ROM image if provided */
-
- void *pDevice;
-
unsigned char *pjVideoMemoryAddress;/* base virtual memory address */
/* of Linear VGA memory */
@@ -76,12 +68,6 @@ struct xgi_hw_device_info
unsigned char *pjIOAddress; /* base I/O address of VGA ports (0x3B0) */
- unsigned char *pjCustomizedROMImage;
-
- unsigned char *pj2ndVideoMemoryAddress;
- unsigned long ul2ndVideoMemorySize;
-
- unsigned char *pj2ndIOAddress;
unsigned char jChipType; /* Used to Identify Graphics Chip */
/* defined in the data structure type */
/* "XGI_CHIP_TYPE" */
@@ -92,45 +78,14 @@ struct xgi_hw_device_info
/* defined in the data structure type */
/* "XGI_VB_CHIP_TYPE" */
- unsigned char bNewScratch;
-
unsigned long ulCRT2LCDType; /* defined in the data structure type */
- unsigned long usExternalChip; /* NO VB or other video bridge (other than */
- /* video bridge) */
-
- unsigned char bIntegratedMMEnabled;/* supporting integration MM enable */
-
- unsigned char bSkipDramSizing; /* True: Skip video memory sizing. */
-
- unsigned char bSkipSense;
-
- unsigned char bIsPowerSaving; /* True: XGIInit() is invoked by power management,
- otherwise by 2nd adapter's initialzation */
-
- struct XGI_DSReg *pSR; /* restore SR registers in initial function. */
- /* end data :(idx, val) = (FF, FF). */
- /* Note : restore SR registers if */
- /* bSkipDramSizing = 1 */
-
- struct XGI_DSReg *pCR; /* restore CR registers in initial function. */
- /* end data :(idx, val) = (FF, FF) */
- /* Note : restore cR registers if */
- /* bSkipDramSizing = 1 */
-
unsigned char(*pQueryVGAConfigSpace)(struct xgi_hw_device_info *,
unsigned long, unsigned long,
unsigned long *);
-
- unsigned char(*pQueryNorthBridgeSpace)(struct xgi_hw_device_info *,
- unsigned long, unsigned long,
- unsigned long *);
-
- unsigned char szVBIOSVer[VBIOS_VER_MAX_LENGTH];
-
};
-/* Addtional IOCTL for communication xgifb <> X driver */
+/* Additional IOCTL for communication xgifb <> X driver */
/* If changing this, xgifb.h must also be changed (for xgifb) */