summaryrefslogtreecommitdiffstats
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.h3
-rw-r--r--drivers/staging/xgifb/XGI_main.h30
-rw-r--r--drivers/staging/xgifb/XGI_main_26.c3876
-rw-r--r--drivers/staging/xgifb/vb_ext.c1737
-rw-r--r--drivers/staging/xgifb/vb_init.c5022
-rw-r--r--drivers/staging/xgifb/vb_setmode.c17041
-rw-r--r--drivers/staging/xgifb/vb_table.h620
-rw-r--r--drivers/staging/xgifb/vb_util.c192
9 files changed, 13123 insertions, 15400 deletions
diff --git a/drivers/staging/xgifb/Makefile b/drivers/staging/xgifb/Makefile
index 2a31770..f2ca6b1 100644
--- a/drivers/staging/xgifb/Makefile
+++ b/drivers/staging/xgifb/Makefile
@@ -1,4 +1,4 @@
obj-$(CONFIG_FB_XGI) += xgifb.o
-xgifb-objs := 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 XGI_accel.o vb_init.o vb_setmode.o vb_util.o vb_ext.o
diff --git a/drivers/staging/xgifb/XGI_accel.h b/drivers/staging/xgifb/XGI_accel.h
index 28c05799..5a0395b 100644
--- a/drivers/staging/xgifb/XGI_accel.h
+++ b/drivers/staging/xgifb/XGI_accel.h
@@ -179,7 +179,7 @@
/* TW: BR(16)+2 = 0x8242 */
-int xgiCmdQueLen;
+static int xgiCmdQueLen;
#define XGI300Idle \
{ \
@@ -488,6 +488,7 @@ int xgiCmdQueLen;
int XGIfb_initaccel(void);
void XGIfb_syncaccel(void);
+int fbcon_XGI_sync(struct fb_info *info);
extern struct video_info xgi_video_info;
diff --git a/drivers/staging/xgifb/XGI_main.h b/drivers/staging/xgifb/XGI_main.h
index fd1152e..72448e8 100644
--- a/drivers/staging/xgifb/XGI_main.h
+++ b/drivers/staging/xgifb/XGI_main.h
@@ -46,8 +46,7 @@
#define XGI_IOTYPE2 __iomem
#define XGIINITSTATIC static
-static struct pci_device_id __devinitdata xgifb_pci_table[] = {
-
+static DEFINE_PCI_DEVICE_TABLE(xgifb_pci_table) = {
{ PCI_VENDOR_ID_XG, PCI_DEVICE_ID_XG_20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ PCI_VENDOR_ID_XG, PCI_DEVICE_ID_XG_27, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
{ PCI_VENDOR_ID_XG, PCI_DEVICE_ID_XG_40, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2},
@@ -351,20 +350,17 @@ static int enable_dstn = 0;
static int XGIfb_ypan = -1;
-int XGIfb_accel = 0;
-
-
static int XGIfb_hwcursor_size = 0;
static int XGIfb_CRT2_write_enable = 0;
-int XGIfb_crt2type = -1; /* TW: CRT2 type (for overriding autodetection) */
-int XGIfb_tvplug = -1; /* PR: Tv plug type (for overriding autodetection) */
+static int XGIfb_crt2type = -1; /* TW: CRT2 type (for overriding autodetection) */
+static int XGIfb_tvplug = -1; /* PR: Tv plug type (for overriding autodetection) */
-int XGIfb_queuemode = -1; /* TW: Use MMIO queue mode by default (310/325 series only) */
+static int XGIfb_queuemode = -1; /* TW: Use MMIO queue mode by default (310/325 series only) */
-unsigned char XGIfb_detectedpdc = 0;
+static unsigned char XGIfb_detectedpdc = 0;
-unsigned char XGIfb_detectedlcda = 0xff;
+static unsigned char XGIfb_detectedlcda = 0xff;
@@ -373,10 +369,10 @@ unsigned char XGIfb_detectedlcda = 0xff;
/* XGIfb_info XGIfbinfo; */
/* TW: Hardware extension; contains data on hardware */
-struct xgi_hw_device_info XGIhw_ext;
+static struct xgi_hw_device_info XGIhw_ext;
/* TW: XGI private structure */
-struct vb_device_info XGI_Pr;
+static struct vb_device_info XGI_Pr;
/* card parameters */
static unsigned long XGIfb_mmio_size = 0;
@@ -393,7 +389,7 @@ typedef enum _XGI_CMDTYPE {
/* mode table */
/* NOT const - will be patched for 1280x960 mode number chaos reasons */
-struct _XGIbios_mode {
+static struct _XGIbios_mode {
char name[15];
u8 mode_no;
u16 vesa_mode_no_1; /* "XGI defined" VESA mode number */
@@ -492,17 +488,17 @@ static int xgifb_mode_idx = 1;
#else
static int xgifb_mode_idx = -1; /* Use a default mode if we are inside the kernel */
#endif
-u8 XGIfb_mode_no = 0;
-u8 XGIfb_rate_idx = 0;
+static u8 XGIfb_mode_no = 0;
+static u8 XGIfb_rate_idx = 0;
/* TW: CR36 evaluation */
-const unsigned short XGI300paneltype[] =
+static const unsigned short XGI300paneltype[] =
{ LCD_UNKNOWN, LCD_800x600, LCD_1024x768, LCD_1280x1024,
LCD_1280x960, LCD_640x480, LCD_1024x600, LCD_1152x768,
LCD_1024x768, LCD_1024x768, LCD_1024x768,
LCD_1024x768, LCD_1024x768, LCD_1024x768, LCD_1024x768 };
-const unsigned short XGI310paneltype[] =
+static const unsigned short XGI310paneltype[] =
{ LCD_UNKNOWN, LCD_800x600, LCD_1024x768, LCD_1280x1024,
LCD_640x480, LCD_1024x600, LCD_1152x864, LCD_1280x960,
LCD_1152x768, LCD_1400x1050,LCD_1280x768, LCD_1600x1200,
diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index 976c39b..4f73d09 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -4,7 +4,7 @@
* Base on TW's sis fbdev code.
*/
-//#include <linux/config.h>
+/* #include <linux/config.h> */
#include <linux/version.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
@@ -29,7 +29,6 @@
#include <linux/types.h>
#include <linux/proc_fs.h>
-
#ifndef XGIFB_PAN
#define XGIFB_PAN
#endif
@@ -44,6 +43,7 @@
#include "XGI_main.h"
#include "vb_util.h"
+int XGIfb_accel = 0;
#define Index_CR_GPIO_Reg1 0x48
#define Index_CR_GPIO_Reg2 0x49
@@ -67,90 +67,84 @@ int XGIfb_GetXG21DefaultLVDSModeIdx(void);
#ifdef XGIFBDEBUG
static void dumpVGAReg(void)
{
- u8 i,reg;
-
-outXGIIDXREG(XGISR, 0x05, 0x86);
-/*
-outXGIIDXREG(XGISR, 0x08, 0x4f);
-outXGIIDXREG(XGISR, 0x0f, 0x20);
-outXGIIDXREG(XGISR, 0x11, 0x4f);
-outXGIIDXREG(XGISR, 0x13, 0x45);
-outXGIIDXREG(XGISR, 0x14, 0x51);
-outXGIIDXREG(XGISR, 0x1e, 0x41);
-outXGIIDXREG(XGISR, 0x1f, 0x0);
-outXGIIDXREG(XGISR, 0x20, 0xa1);
-outXGIIDXREG(XGISR, 0x22, 0xfb);
-outXGIIDXREG(XGISR, 0x26, 0x22);
-outXGIIDXREG(XGISR, 0x3e, 0x07);
-*/
-
-//outXGIIDXREG(XGICR, 0x19, 0x00);
-//outXGIIDXREG(XGICR, 0x1a, 0x3C);
-//outXGIIDXREG(XGICR, 0x22, 0xff);
-//outXGIIDXREG(XGICR, 0x3D, 0x10);
-
-//outXGIIDXREG(XGICR, 0x4a, 0xf3);
-
-//outXGIIDXREG(XGICR, 0x57, 0x0);
-//outXGIIDXREG(XGICR, 0x7a, 0x2c);
-
-//outXGIIDXREG(XGICR, 0x82, 0xcc);
-//outXGIIDXREG(XGICR, 0x8c, 0x0);
-/*
-outXGIIDXREG(XGICR, 0x99, 0x1);
-outXGIIDXREG(XGICR, 0x41, 0x40);
-*/
-
- for(i=0; i < 0x4f; i++)
- {
- inXGIIDXREG(XGISR, i, reg);
- printk("\no 3c4 %x",i);
- printk("\ni 3c5 => %x",reg);
- }
-
- for(i=0; i < 0xF0; i++)
- {
- inXGIIDXREG(XGICR, i, reg);
- printk("\no 3d4 %x",i);
- printk("\ni 3d5 => %x",reg);
- }
-/*
-
- outXGIIDXREG(XGIPART1,0x2F,1);
- for(i=1; i < 0x50; i++)
- {
- inXGIIDXREG(XGIPART1, i, reg);
- printk("\no d004 %x",i);
- printk("\ni d005 => %x",reg);
- }
-
- for(i=0; i < 0x50; i++)
- {
- inXGIIDXREG(XGIPART2, i, reg);
- printk("\no d010 %x",i);
- printk("\ni d011 => %x",reg);
- }
- for(i=0; i < 0x50; i++)
- {
- inXGIIDXREG(XGIPART3, i, reg);
- printk("\no d012 %x",i);
- printk("\ni d013 => %x",reg);
- }
- for(i=0; i < 0x50; i++)
- {
- inXGIIDXREG(XGIPART4, i, reg);
- printk("\no d014 %x",i);
- printk("\ni d015 => %x",reg);
- }
-*/
+ u8 i, reg;
+
+ outXGIIDXREG(XGISR, 0x05, 0x86);
+ /*
+ outXGIIDXREG(XGISR, 0x08, 0x4f);
+ outXGIIDXREG(XGISR, 0x0f, 0x20);
+ outXGIIDXREG(XGISR, 0x11, 0x4f);
+ outXGIIDXREG(XGISR, 0x13, 0x45);
+ outXGIIDXREG(XGISR, 0x14, 0x51);
+ outXGIIDXREG(XGISR, 0x1e, 0x41);
+ outXGIIDXREG(XGISR, 0x1f, 0x0);
+ outXGIIDXREG(XGISR, 0x20, 0xa1);
+ outXGIIDXREG(XGISR, 0x22, 0xfb);
+ outXGIIDXREG(XGISR, 0x26, 0x22);
+ outXGIIDXREG(XGISR, 0x3e, 0x07);
+ */
+
+ /* outXGIIDXREG(XGICR, 0x19, 0x00); */
+ /* outXGIIDXREG(XGICR, 0x1a, 0x3C); */
+ /* outXGIIDXREG(XGICR, 0x22, 0xff); */
+ /* outXGIIDXREG(XGICR, 0x3D, 0x10); */
+
+ /* outXGIIDXREG(XGICR, 0x4a, 0xf3); */
+
+ /* outXGIIDXREG(XGICR, 0x57, 0x0); */
+ /* outXGIIDXREG(XGICR, 0x7a, 0x2c); */
+
+ /* outXGIIDXREG(XGICR, 0x82, 0xcc); */
+ /* outXGIIDXREG(XGICR, 0x8c, 0x0); */
+ /*
+ outXGIIDXREG(XGICR, 0x99, 0x1);
+ outXGIIDXREG(XGICR, 0x41, 0x40);
+ */
+
+ for (i = 0; i < 0x4f; i++) {
+ inXGIIDXREG(XGISR, i, reg);
+ printk("\no 3c4 %x", i);
+ printk("\ni 3c5 => %x", reg);
+ }
+
+ for (i = 0; i < 0xF0; i++) {
+ inXGIIDXREG(XGICR, i, reg);
+ printk("\no 3d4 %x", i);
+ printk("\ni 3d5 => %x", reg);
+ }
+ /*
+ outXGIIDXREG(XGIPART1,0x2F,1);
+ for (i=1; i < 0x50; i++) {
+ inXGIIDXREG(XGIPART1, i, reg);
+ printk("\no d004 %x", i);
+ printk("\ni d005 => %x", reg);
+ }
+
+ for (i=0; i < 0x50; i++) {
+ inXGIIDXREG(XGIPART2, i, reg);
+ printk("\no d010 %x", i);
+ printk("\ni d011 => %x", reg);
+ }
+ for (i=0; i < 0x50; i++) {
+ inXGIIDXREG(XGIPART3, i, reg);
+ printk("\no d012 %x",i);
+ printk("\ni d013 => %x",reg);
+ }
+ for (i=0; i < 0x50; i++) {
+ inXGIIDXREG(XGIPART4, i, reg);
+ printk("\no d014 %x",i);
+ printk("\ni d015 => %x",reg);
+ }
+ */
}
#else
-static inline void dumpVGAReg(void) {}
+static inline void dumpVGAReg(void)
+{
+}
#endif
/* data for XGI components */
-struct video_info xgi_video_info;
-
+struct video_info xgi_video_info;
#if 1
#define DEBUGPRN(x)
@@ -158,251 +152,244 @@ struct video_info xgi_video_info;
#define DEBUGPRN(x) printk(KERN_INFO x "\n");
#endif
-
/* --------------- Hardware Access Routines -------------------------- */
-int
-XGIfb_mode_rate_to_dclock(struct vb_device_info *XGI_Pr, struct xgi_hw_device_info *HwDeviceExtension,
- unsigned char modeno, unsigned char rateindex)
+static int XGIfb_mode_rate_to_dclock(struct vb_device_info *XGI_Pr,
+ struct xgi_hw_device_info *HwDeviceExtension,
+ unsigned char modeno, unsigned char rateindex)
{
- unsigned short ModeNo = modeno;
- unsigned short ModeIdIndex = 0, ClockIndex = 0;
- unsigned short RefreshRateTableIndex = 0;
+ unsigned short ModeNo = modeno;
+ unsigned short ModeIdIndex = 0, ClockIndex = 0;
+ unsigned short RefreshRateTableIndex = 0;
- /*unsigned long temp = 0;*/
- int Clock;
- XGI_Pr->ROMAddr = HwDeviceExtension->pjVirtualRomBase;
- InitTo330Pointer( HwDeviceExtension->jChipType, XGI_Pr ) ;
+ /* unsigned long temp = 0; */
+ int Clock;
+ XGI_Pr->ROMAddr = HwDeviceExtension->pjVirtualRomBase;
+ InitTo330Pointer(HwDeviceExtension->jChipType, XGI_Pr);
- RefreshRateTableIndex = XGI_GetRatePtrCRT2( HwDeviceExtension, ModeNo , ModeIdIndex, XGI_Pr ) ;
+ RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo,
+ ModeIdIndex, XGI_Pr);
-/*
- temp = XGI_SearchModeID( ModeNo , &ModeIdIndex, XGI_Pr ) ;
- if(!temp) {
- printk(KERN_ERR "Could not find mode %x\n", ModeNo);
- return 65000;
- }
+ /*
+ temp = XGI_SearchModeID(ModeNo , &ModeIdIndex, XGI_Pr) ;
+ if (!temp) {
+ printk(KERN_ERR "Could not find mode %x\n", ModeNo);
+ return 65000;
+ }
- RefreshRateTableIndex = XGI_Pr->EModeIDTable[ModeIdIndex].REFindex;
- RefreshRateTableIndex += (rateindex - 1);
+ RefreshRateTableIndex = XGI_Pr->EModeIDTable[ModeIdIndex].REFindex;
+ RefreshRateTableIndex += (rateindex - 1);
-*/
- ClockIndex = XGI_Pr->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
- if(HwDeviceExtension->jChipType < XGI_315H) {
- ClockIndex &= 0x3F;
- }
- Clock = XGI_Pr->VCLKData[ClockIndex].CLOCK * 1000 ;
+ */
+ ClockIndex = XGI_Pr->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
+ if (HwDeviceExtension->jChipType < XGI_315H)
+ ClockIndex &= 0x3F;
+
+ Clock = XGI_Pr->VCLKData[ClockIndex].CLOCK * 1000;
- return(Clock);
+ return Clock;
}
-int
-XGIfb_mode_rate_to_ddata(struct vb_device_info *XGI_Pr, struct xgi_hw_device_info *HwDeviceExtension,
- unsigned char modeno, unsigned char rateindex,
- u32 *left_margin, u32 *right_margin,
- u32 *upper_margin, u32 *lower_margin,
- u32 *hsync_len, u32 *vsync_len,
- u32 *sync, u32 *vmode)
+static int XGIfb_mode_rate_to_ddata(struct vb_device_info *XGI_Pr,
+ struct xgi_hw_device_info *HwDeviceExtension,
+ unsigned char modeno, unsigned char rateindex,
+ u32 *left_margin, u32 *right_margin, u32 *upper_margin,
+ u32 *lower_margin, u32 *hsync_len, u32 *vsync_len, u32 *sync,
+ u32 *vmode)
{
- unsigned short ModeNo = modeno;
- unsigned short ModeIdIndex = 0, index = 0;
- unsigned short RefreshRateTableIndex = 0;
-
- unsigned short VRE, VBE, VRS, VBS, VDE, VT;
- unsigned short HRE, HBE, HRS, HBS, HDE, HT;
- unsigned char sr_data, cr_data, cr_data2;
- unsigned long cr_data3;
- int A, B, C, D, E, F, temp, j;
- XGI_Pr->ROMAddr = HwDeviceExtension->pjVirtualRomBase;
- InitTo330Pointer( HwDeviceExtension->jChipType, XGI_Pr ) ;
- RefreshRateTableIndex = XGI_GetRatePtrCRT2( HwDeviceExtension, ModeNo , ModeIdIndex, XGI_Pr ) ;
-/*
- temp = XGI_SearchModeID( ModeNo, &ModeIdIndex, XGI_Pr);
- if(!temp) return 0;
-
- RefreshRateTableIndex = XGI_Pr->EModeIDTable[ModeIdIndex].REFindex;
- RefreshRateTableIndex += (rateindex - 1);
-*/
- index = XGI_Pr->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
-
- sr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[5];
+ unsigned short ModeNo = modeno;
+ unsigned short ModeIdIndex = 0, index = 0;
+ unsigned short RefreshRateTableIndex = 0;
+
+ unsigned short VRE, VBE, VRS, VBS, VDE, VT;
+ unsigned short HRE, HBE, HRS, HBS, HDE, HT;
+ unsigned char sr_data, cr_data, cr_data2;
+ unsigned long cr_data3;
+ int A, B, C, D, E, F, temp, j;
+ XGI_Pr->ROMAddr = HwDeviceExtension->pjVirtualRomBase;
+ InitTo330Pointer(HwDeviceExtension->jChipType, XGI_Pr);
+ RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo,
+ ModeIdIndex, XGI_Pr);
+ /*
+ temp = XGI_SearchModeID(ModeNo, &ModeIdIndex, XGI_Pr);
+ if (!temp)
+ return 0;
- cr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[0];
+ RefreshRateTableIndex = XGI_Pr->EModeIDTable[ModeIdIndex].REFindex;
+ RefreshRateTableIndex += (rateindex - 1);
+ */
+ index = XGI_Pr->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
- /* Horizontal total */
- HT = (cr_data & 0xff) |
- ((unsigned short) (sr_data & 0x03) << 8);
- A = HT + 5;
+ sr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[5];
- /*cr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[1];
+ cr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[0];
- Horizontal display enable end
- HDE = (cr_data & 0xff) |
- ((unsigned short) (sr_data & 0x0C) << 6);*/
- HDE = (XGI_Pr->RefIndex[RefreshRateTableIndex].XRes >> 3) -1;
- E = HDE + 1;
+ /* Horizontal total */
+ HT = (cr_data & 0xff) | ((unsigned short) (sr_data & 0x03) << 8);
+ A = HT + 5;
- cr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[3];
+ /*
+ cr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[1];
- /* Horizontal retrace (=sync) start */
- HRS = (cr_data & 0xff) |
- ((unsigned short) (sr_data & 0xC0) << 2);
- F = HRS - E - 3;
+ Horizontal display enable end
+ HDE = (cr_data & 0xff) | ((unsigned short) (sr_data & 0x0C) << 6);
+ */
+ HDE = (XGI_Pr->RefIndex[RefreshRateTableIndex].XRes >> 3) - 1;
+ E = HDE + 1;
- cr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[1];
+ cr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[3];
- /* Horizontal blank start */
- HBS = (cr_data & 0xff) |
- ((unsigned short) (sr_data & 0x30) << 4);
+ /* Horizontal retrace (=sync) start */
+ HRS = (cr_data & 0xff) | ((unsigned short) (sr_data & 0xC0) << 2);
+ F = HRS - E - 3;
- sr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[6];
+ cr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[1];
- cr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[2];
+ /* Horizontal blank start */
+ HBS = (cr_data & 0xff) | ((unsigned short) (sr_data & 0x30) << 4);
- cr_data2 = XGI_Pr->XGINEWUB_CRT1Table[index].CR[4];
+ sr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[6];
- /* Horizontal blank end */
- HBE = (cr_data & 0x1f) |
- ((unsigned short) (cr_data2 & 0x80) >> 2) |
- ((unsigned short) (sr_data & 0x03) << 6);
+ cr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[2];
- /* Horizontal retrace (=sync) end */
- HRE = (cr_data2 & 0x1f) | ((sr_data & 0x04) << 3);
+ cr_data2 = XGI_Pr->XGINEWUB_CRT1Table[index].CR[4];
- temp = HBE - ((E - 1) & 255);
- B = (temp > 0) ? temp : (temp + 256);
+ /* Horizontal blank end */
+ HBE = (cr_data & 0x1f) | ((unsigned short) (cr_data2 & 0x80) >> 2)
+ | ((unsigned short) (sr_data & 0x03) << 6);
- temp = HRE - ((E + F + 3) & 63);
- C = (temp > 0) ? temp : (temp + 64);
+ /* Horizontal retrace (=sync) end */
+ HRE = (cr_data2 & 0x1f) | ((sr_data & 0x04) << 3);
- D = B - F - C;
+ temp = HBE - ((E - 1) & 255);
+ B = (temp > 0) ? temp : (temp + 256);
- *left_margin = D * 8;
- *right_margin = F * 8;
- *hsync_len = C * 8;
+ temp = HRE - ((E + F + 3) & 63);
+ C = (temp > 0) ? temp : (temp + 64);
- sr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[14];
+ D = B - F - C;
- cr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[8];
+ *left_margin = D * 8;
+ *right_margin = F * 8;
+ *hsync_len = C * 8;
- cr_data2 = XGI_Pr->XGINEWUB_CRT1Table[index].CR[9];
+ sr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[14];
- /* Vertical total */
- VT = (cr_data & 0xFF) |
- ((unsigned short) (cr_data2 & 0x01) << 8) |
- ((unsigned short)(cr_data2 & 0x20) << 4) |
- ((unsigned short) (sr_data & 0x01) << 10);
- A = VT + 2;
+ cr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[8];
- //cr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[10];
+ cr_data2 = XGI_Pr->XGINEWUB_CRT1Table[index].CR[9];
- /* Vertical display enable end */
-/* VDE = (cr_data & 0xff) |
- ((unsigned short) (cr_data2 & 0x02) << 7) |
- ((unsigned short) (cr_data2 & 0x40) << 3) |
- ((unsigned short) (sr_data & 0x02) << 9); */
- VDE = XGI_Pr->RefIndex[RefreshRateTableIndex].YRes -1;
- E = VDE + 1;
+ /* Vertical total */
+ VT = (cr_data & 0xFF) | ((unsigned short) (cr_data2 & 0x01) << 8)
+ | ((unsigned short) (cr_data2 & 0x20) << 4)
+ | ((unsigned short) (sr_data & 0x01) << 10);
+ A = VT + 2;
- cr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[10];
+ /* cr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[10]; */
- /* Vertical retrace (=sync) start */
- VRS = (cr_data & 0xff) |
- ((unsigned short) (cr_data2 & 0x04) << 6) |
- ((unsigned short) (cr_data2 & 0x80) << 2) |
- ((unsigned short) (sr_data & 0x08) << 7);
- F = VRS + 1 - E;
+ /* Vertical display enable end */
+ /*
+ VDE = (cr_data & 0xff) |
+ ((unsigned short) (cr_data2 & 0x02) << 7) |
+ ((unsigned short) (cr_data2 & 0x40) << 3) |
+ ((unsigned short) (sr_data & 0x02) << 9);
+ */
+ VDE = XGI_Pr->RefIndex[RefreshRateTableIndex].YRes - 1;
+ E = VDE + 1;
- cr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[12];
+ cr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[10];
- cr_data3 = (XGI_Pr->XGINEWUB_CRT1Table[index].CR[14] & 0x80) << 5;
+ /* Vertical retrace (=sync) start */
+ VRS = (cr_data & 0xff) | ((unsigned short) (cr_data2 & 0x04) << 6)
+ | ((unsigned short) (cr_data2 & 0x80) << 2)
+ | ((unsigned short) (sr_data & 0x08) << 7);
+ F = VRS + 1 - E;
- /* Vertical blank start */
- VBS = (cr_data & 0xff) |
- ((unsigned short) (cr_data2 & 0x08) << 5) |
- ((unsigned short) (cr_data3 & 0x20) << 4) |
- ((unsigned short) (sr_data & 0x04) << 8);
+ cr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[12];
- cr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[13];
+ cr_data3 = (XGI_Pr->XGINEWUB_CRT1Table[index].CR[14] & 0x80) << 5;
- /* Vertical blank end */
- VBE = (cr_data & 0xff) |
- ((unsigned short) (sr_data & 0x10) << 4);
- temp = VBE - ((E - 1) & 511);
- B = (temp > 0) ? temp : (temp + 512);
+ /* Vertical blank start */
+ VBS = (cr_data & 0xff) | ((unsigned short) (cr_data2 & 0x08) << 5)
+ | ((unsigned short) (cr_data3 & 0x20) << 4)
+ | ((unsigned short) (sr_data & 0x04) << 8);
- cr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[11];
+ cr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[13];
- /* Vertical retrace (=sync) end */
- VRE = (cr_data & 0x0f) | ((sr_data & 0x20) >> 1);
- temp = VRE - ((E + F - 1) & 31);
- C = (temp > 0) ? temp : (temp + 32);
+ /* Vertical blank end */
+ VBE = (cr_data & 0xff) | ((unsigned short) (sr_data & 0x10) << 4);
+ temp = VBE - ((E - 1) & 511);
+ B = (temp > 0) ? temp : (temp + 512);
- D = B - F - C;
+ cr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[11];
- *upper_margin = D;
- *lower_margin = F;
- *vsync_len = C;
+ /* Vertical retrace (=sync) end */
+ VRE = (cr_data & 0x0f) | ((sr_data & 0x20) >> 1);
+ temp = VRE - ((E + F - 1) & 31);
+ C = (temp > 0) ? temp : (temp + 32);
- if(XGI_Pr->RefIndex[RefreshRateTableIndex].Ext_InfoFlag & 0x8000)
- *sync &= ~FB_SYNC_VERT_HIGH_ACT;
- else
- *sync |= FB_SYNC_VERT_HIGH_ACT;
+ D = B - F - C;
- if(XGI_Pr->RefIndex[RefreshRateTableIndex].Ext_InfoFlag & 0x4000)
- *sync &= ~FB_SYNC_HOR_HIGH_ACT;
- else
- *sync |= FB_SYNC_HOR_HIGH_ACT;
+ *upper_margin = D;
+ *lower_margin = F;
+ *vsync_len = C;
- *vmode = FB_VMODE_NONINTERLACED;
- if(XGI_Pr->RefIndex[RefreshRateTableIndex].Ext_InfoFlag & 0x0080)
- *vmode = FB_VMODE_INTERLACED;
- else {
- j = 0;
- while(XGI_Pr->EModeIDTable[j].Ext_ModeID != 0xff) {
- if(XGI_Pr->EModeIDTable[j].Ext_ModeID ==
- XGI_Pr->RefIndex[RefreshRateTableIndex].ModeID) {
- if(XGI_Pr->EModeIDTable[j].Ext_ModeFlag & DoubleScanMode) {
- *vmode = FB_VMODE_DOUBLE;
- }
- break;
- }
- j++;
- }
- }
-
- return 1;
-}
+ if (XGI_Pr->RefIndex[RefreshRateTableIndex].Ext_InfoFlag & 0x8000)
+ *sync &= ~FB_SYNC_VERT_HIGH_ACT;
+ else
+ *sync |= FB_SYNC_VERT_HIGH_ACT;
+ if (XGI_Pr->RefIndex[RefreshRateTableIndex].Ext_InfoFlag & 0x4000)
+ *sync &= ~FB_SYNC_HOR_HIGH_ACT;
+ else
+ *sync |= FB_SYNC_HOR_HIGH_ACT;
+ *vmode = FB_VMODE_NONINTERLACED;
+ if (XGI_Pr->RefIndex[RefreshRateTableIndex].Ext_InfoFlag & 0x0080)
+ *vmode = FB_VMODE_INTERLACED;
+ else {
+ j = 0;
+ while (XGI_Pr->EModeIDTable[j].Ext_ModeID != 0xff) {
+ if (XGI_Pr->EModeIDTable[j].Ext_ModeID
+ == XGI_Pr->RefIndex[RefreshRateTableIndex].ModeID) {
+ if (XGI_Pr->EModeIDTable[j].Ext_ModeFlag
+ & DoubleScanMode) {
+ *vmode = FB_VMODE_DOUBLE;
+ }
+ break;
+ }
+ j++;
+ }
+ }
+ return 1;
+}
-void XGIRegInit(struct vb_device_info *XGI_Pr, unsigned long BaseAddr)
+static void XGIRegInit(struct vb_device_info *XGI_Pr, unsigned long BaseAddr)
{
- XGI_Pr->RelIO = BaseAddr;
- XGI_Pr->P3c4 = BaseAddr + 0x14;
- XGI_Pr->P3d4 = BaseAddr + 0x24;
- XGI_Pr->P3c0 = BaseAddr + 0x10;
- XGI_Pr->P3ce = BaseAddr + 0x1e;
- XGI_Pr->P3c2 = BaseAddr + 0x12;
- XGI_Pr->P3ca = BaseAddr + 0x1a;
- XGI_Pr->P3c6 = BaseAddr + 0x16;
- XGI_Pr->P3c7 = BaseAddr + 0x17;
- XGI_Pr->P3c8 = BaseAddr + 0x18;
- XGI_Pr->P3c9 = BaseAddr + 0x19;
- XGI_Pr->P3da = BaseAddr + 0x2A;
- XGI_Pr->Part1Port = BaseAddr + XGI_CRT2_PORT_04; /* Digital video interface registers (LCD) */
- XGI_Pr->Part2Port = BaseAddr + XGI_CRT2_PORT_10; /* 301 TV Encoder registers */
- XGI_Pr->Part3Port = BaseAddr + XGI_CRT2_PORT_12; /* 301 Macrovision registers */
- XGI_Pr->Part4Port = BaseAddr + XGI_CRT2_PORT_14; /* 301 VGA2 (and LCD) registers */
- XGI_Pr->Part5Port = BaseAddr + XGI_CRT2_PORT_14+2; /* 301 palette address port registers */
+ XGI_Pr->RelIO = BaseAddr;
+ XGI_Pr->P3c4 = BaseAddr + 0x14;
+ XGI_Pr->P3d4 = BaseAddr + 0x24;
+ XGI_Pr->P3c0 = BaseAddr + 0x10;
+ XGI_Pr->P3ce = BaseAddr + 0x1e;
+ XGI_Pr->P3c2 = BaseAddr + 0x12;
+ XGI_Pr->P3ca = BaseAddr + 0x1a;
+ XGI_Pr->P3c6 = BaseAddr + 0x16;
+ XGI_Pr->P3c7 = BaseAddr + 0x17;
+ XGI_Pr->P3c8 = BaseAddr + 0x18;
+ XGI_Pr->P3c9 = BaseAddr + 0x19;
+ XGI_Pr->P3da = BaseAddr + 0x2A;
+ XGI_Pr->Part1Port = BaseAddr + XGI_CRT2_PORT_04; /* Digital video interface registers (LCD) */
+ XGI_Pr->Part2Port = BaseAddr + XGI_CRT2_PORT_10; /* 301 TV Encoder registers */
+ XGI_Pr->Part3Port = BaseAddr + XGI_CRT2_PORT_12; /* 301 Macrovision registers */
+ XGI_Pr->Part4Port = BaseAddr + XGI_CRT2_PORT_14; /* 301 VGA2 (and LCD) registers */
+ XGI_Pr->Part5Port = BaseAddr + XGI_CRT2_PORT_14 + 2; /* 301 palette address port registers */
}
-
void XGIfb_set_reg4(u16 port, unsigned long data)
{
- outl((u32) (data & 0xffffffff), port);
+ outl((u32)(data & 0xffffffff), port);
}
u32 XGIfb_get_reg3(u16 port)
@@ -410,14 +397,14 @@ u32 XGIfb_get_reg3(u16 port)
u32 data;
data = inl(port);
- return (data);
+ return data;
}
/* ------------ Interface for init & mode switching code ------------- */
-unsigned char
-XGIfb_query_VGA_config_space(struct xgi_hw_device_info *pXGIhw_ext,
- unsigned long offset, unsigned long set, unsigned long *value)
+unsigned char XGIfb_query_VGA_config_space(
+ struct xgi_hw_device_info *pXGIhw_ext, unsigned long offset,
+ unsigned long set, unsigned long *value)
{
static struct pci_dev *pdev = NULL;
static unsigned char init = 0, valid_pdev = 0;
@@ -429,7 +416,8 @@ XGIfb_query_VGA_config_space(struct xgi_hw_device_info *pXGIhw_ext,
if (!init) {
init = 1;
- pdev = pci_get_device(PCI_VENDOR_ID_XG, xgi_video_info.chip_id, pdev);
+ pdev = pci_get_device(PCI_VENDOR_ID_XG, xgi_video_info.chip_id,
+ pdev);
if (pdev) {
valid_pdev = 1;
pci_dev_put(pdev);
@@ -443,14 +431,15 @@ XGIfb_query_VGA_config_space(struct xgi_hw_device_info *pXGIhw_ext,
}
if (set == 0)
- pci_read_config_dword(pdev, offset, (u32 *)value);
+ pci_read_config_dword(pdev, offset, (u32 *) value);
else
pci_write_config_dword(pdev, offset, (u32)(*value));
return 1;
}
-/*unsigned char XGIfb_query_north_bridge_space(struct xgi_hw_device_info *pXGIhw_ext,
+/*
+unsigned char XGIfb_query_north_bridge_space(struct xgi_hw_device_info *pXGIhw_ext,
unsigned long offset, unsigned long set, unsigned long *value)
{
static struct pci_dev *pdev = NULL;
@@ -490,7 +479,7 @@ XGIfb_query_VGA_config_space(struct xgi_hw_device_info *pXGIhw_ext,
if (!valid_pdev) {
printk(KERN_DEBUG "XGIfb: Can't find XGI %d North Bridge device.\n",
- nbridge_id);
+ nbridge_id);
return 0;
}
@@ -508,28 +497,29 @@ static void XGIfb_search_mode(const char *name)
{
int i = 0, j = 0, l;
- if(name == NULL) {
- printk(KERN_ERR "XGIfb: Internal error, using default mode.\n");
- xgifb_mode_idx = DEFAULT_MODE;
- if ((xgi_video_info.chip == XG21) && ((xgi_video_info.disp_state & DISPTYPE_DISP2) == DISPTYPE_LCD))
- {
- xgifb_mode_idx = XGIfb_GetXG21DefaultLVDSModeIdx();
- }
- return;
+ if (name == NULL) {
+ printk(KERN_ERR "XGIfb: Internal error, using default mode.\n");
+ xgifb_mode_idx = DEFAULT_MODE;
+ if ((xgi_video_info.chip == XG21)
+ && ((xgi_video_info.disp_state & DISPTYPE_DISP2)
+ == DISPTYPE_LCD)) {
+ xgifb_mode_idx = XGIfb_GetXG21DefaultLVDSModeIdx();
+ }
+ return;
}
-
- if (!strcmp(name, XGIbios_mode[MODE_INDEX_NONE].name)) {
- printk(KERN_ERR "XGIfb: Mode 'none' not supported anymore. Using default.\n");
- xgifb_mode_idx = DEFAULT_MODE;
- if ((xgi_video_info.chip == XG21) && ((xgi_video_info.disp_state & DISPTYPE_DISP2) == DISPTYPE_LCD))
- {
- xgifb_mode_idx = XGIfb_GetXG21DefaultLVDSModeIdx();
- }
- return;
+ if (!strcmp(name, XGIbios_mode[MODE_INDEX_NONE].name)) {
+ printk(KERN_ERR "XGIfb: Mode 'none' not supported anymore. Using default.\n");
+ xgifb_mode_idx = DEFAULT_MODE;
+ if ((xgi_video_info.chip == XG21)
+ && ((xgi_video_info.disp_state & DISPTYPE_DISP2)
+ == DISPTYPE_LCD)) {
+ xgifb_mode_idx = XGIfb_GetXG21DefaultLVDSModeIdx();
+ }
+ return;
}
- while(XGIbios_mode[i].mode_no != 0) {
+ while (XGIbios_mode[i].mode_no != 0) {
l = min(strlen(name), strlen(XGIbios_mode[i].name));
if (!strncmp(name, XGIbios_mode[i].name, l)) {
xgifb_mode_idx = i;
@@ -538,83 +528,92 @@ static void XGIfb_search_mode(const char *name)
}
i++;
}
- if(!j) printk(KERN_INFO "XGIfb: Invalid mode '%s'\n", name);
+ if (!j)
+ printk(KERN_INFO "XGIfb: Invalid mode '%s'\n", name);
}
static void XGIfb_search_vesamode(unsigned int vesamode)
{
int i = 0, j = 0;
- if(vesamode == 0) {
+ if (vesamode == 0) {
printk(KERN_ERR "XGIfb: Mode 'none' not supported anymore. Using default.\n");
xgifb_mode_idx = DEFAULT_MODE;
- if ((xgi_video_info.chip == XG21) && ((xgi_video_info.disp_state & DISPTYPE_DISP2) == DISPTYPE_LCD))
- {
- xgifb_mode_idx = XGIfb_GetXG21DefaultLVDSModeIdx();
+ if ((xgi_video_info.chip == XG21)
+ && ((xgi_video_info.disp_state & DISPTYPE_DISP2)
+ == DISPTYPE_LCD)) {
+ xgifb_mode_idx = XGIfb_GetXG21DefaultLVDSModeIdx();
}
return;
}
- vesamode &= 0x1dff; /* Clean VESA mode number from other flags */
+ vesamode &= 0x1dff; /* Clean VESA mode number from other flags */
- while(XGIbios_mode[i].mode_no != 0) {
- if( (XGIbios_mode[i].vesa_mode_no_1 == vesamode) ||
- (XGIbios_mode[i].vesa_mode_no_2 == vesamode) ) {
+ while (XGIbios_mode[i].mode_no != 0) {
+ if ((XGIbios_mode[i].vesa_mode_no_1 == vesamode)
+ || (XGIbios_mode[i].vesa_mode_no_2 == vesamode)) {
xgifb_mode_idx = i;
j = 1;
break;
}
i++;
}
- if(!j) printk(KERN_INFO "XGIfb: Invalid VESA mode 0x%x'\n", vesamode);
+ if (!j)
+ printk(KERN_INFO "XGIfb: Invalid VESA mode 0x%x'\n", vesamode);
}
-int XGIfb_GetXG21LVDSData(void)
+static int XGIfb_GetXG21LVDSData(void)
{
- u8 tmp;
- unsigned char *pData;
- int i,j,k;
-
- inXGIIDXREG(XGISR,0x1e,tmp);
- outXGIIDXREG(XGISR, 0x1e, tmp|4);
-
- pData = xgi_video_info.mmio_vbase+0x20000;
- if ((pData[0x0]==0x55) && (pData[0x1]==0xAA) && (pData[0x65] & 0x1))
- {
- i = pData[ 0x316 ] | ( pData[ 0x317 ] << 8 );
- j = pData[ i-1 ] ;
- if ( j == 0xff )
- {
- j = 1;
- }
- k = 0;
- do
- {
- XGI21_LCDCapList[k].LVDS_Capability = pData[ i ] | ( pData[ i + 1 ] << 8 );
- XGI21_LCDCapList[k].LVDSHT = pData[ i + 2 ] | ( pData[ i + 3 ] << 8 ) ;
- XGI21_LCDCapList[k].LVDSVT = pData[ i + 4 ] | ( pData[ i + 5 ] << 8 );
- XGI21_LCDCapList[k].LVDSHDE = pData[ i + 6 ] | ( pData[ i + 7 ] << 8 );
- XGI21_LCDCapList[k].LVDSVDE = pData[ i + 8 ] | ( pData[ i + 9 ] << 8 );
- XGI21_LCDCapList[k].LVDSHFP = pData[ i + 10 ] | ( pData[ i + 11 ] << 8 );
- XGI21_LCDCapList[k].LVDSVFP = pData[ i + 12 ] | ( pData[ i + 13 ] << 8 );
- XGI21_LCDCapList[k].LVDSHSYNC = pData[ i + 14 ] | ( pData[ i + 15 ] << 8 );
- XGI21_LCDCapList[k].LVDSVSYNC = pData[ i + 16 ] | ( pData[ i + 17 ] << 8 );
- XGI21_LCDCapList[k].VCLKData1 = pData[ i + 18 ] ;
- XGI21_LCDCapList[k].VCLKData2 = pData[ i + 19 ] ;
- XGI21_LCDCapList[k].PSC_S1 = pData[ i + 20 ] ;
- XGI21_LCDCapList[k].PSC_S2 = pData[ i + 21 ] ;
- XGI21_LCDCapList[k].PSC_S3 = pData[ i + 22 ] ;
- XGI21_LCDCapList[k].PSC_S4 = pData[ i + 23 ] ;
- XGI21_LCDCapList[k].PSC_S5 = pData[ i + 24 ] ;
- i += 25;
- j--;
- k++;
- } while ((j > 0) &&
- (k < (sizeof(XGI21_LCDCapList)/sizeof(struct XGI21_LVDSCapStruct))));
- return 1;
- }
- return 0;
+ u8 tmp;
+ unsigned char *pData;
+ int i, j, k;
+
+ inXGIIDXREG(XGISR, 0x1e, tmp);
+ outXGIIDXREG(XGISR, 0x1e, tmp | 4);
+
+ pData = xgi_video_info.mmio_vbase + 0x20000;
+ if ((pData[0x0] == 0x55) && (pData[0x1] == 0xAA) && (pData[0x65] & 0x1)) {
+ i = pData[0x316] | (pData[0x317] << 8);
+ j = pData[i - 1];
+ if (j == 0xff)
+ j = 1;
+
+ k = 0;
+ do {
+ XGI21_LCDCapList[k].LVDS_Capability = pData[i]
+ | (pData[i + 1] << 8);
+ XGI21_LCDCapList[k].LVDSHT = pData[i + 2] | (pData[i
+ + 3] << 8);
+ XGI21_LCDCapList[k].LVDSVT = pData[i + 4] | (pData[i
+ + 5] << 8);
+ XGI21_LCDCapList[k].LVDSHDE = pData[i + 6] | (pData[i
+ + 7] << 8);
+ XGI21_LCDCapList[k].LVDSVDE = pData[i + 8] | (pData[i
+ + 9] << 8);
+ XGI21_LCDCapList[k].LVDSHFP = pData[i + 10] | (pData[i
+ + 11] << 8);
+ XGI21_LCDCapList[k].LVDSVFP = pData[i + 12] | (pData[i
+ + 13] << 8);
+ XGI21_LCDCapList[k].LVDSHSYNC = pData[i + 14]
+ | (pData[i + 15] << 8);
+ XGI21_LCDCapList[k].LVDSVSYNC = pData[i + 16]
+ | (pData[i + 17] << 8);
+ XGI21_LCDCapList[k].VCLKData1 = pData[i + 18];
+ XGI21_LCDCapList[k].VCLKData2 = pData[i + 19];
+ XGI21_LCDCapList[k].PSC_S1 = pData[i + 20];
+ XGI21_LCDCapList[k].PSC_S2 = pData[i + 21];
+ XGI21_LCDCapList[k].PSC_S3 = pData[i + 22];
+ XGI21_LCDCapList[k].PSC_S4 = pData[i + 23];
+ XGI21_LCDCapList[k].PSC_S5 = pData[i + 24];
+ i += 25;
+ j--;
+ k++;
+ } while ((j > 0) && (k < (sizeof(XGI21_LCDCapList)
+ / sizeof(struct XGI21_LVDSCapStruct))));
+ return 1;
+ }
+ return 0;
}
int XGIfb_GetXG21DefaultLVDSModeIdx(void)
@@ -624,218 +623,257 @@ int XGIfb_GetXG21DefaultLVDSModeIdx(void)
int XGIfb_mode_idx = 0;
found_mode = 0;
- while( (XGIbios_mode[XGIfb_mode_idx].mode_no != 0) &&
- (XGIbios_mode[XGIfb_mode_idx].xres <= XGI21_LCDCapList[0].LVDSHDE) )
- {
- if( (XGIbios_mode[XGIfb_mode_idx].xres == XGI21_LCDCapList[0].LVDSHDE) &&
- (XGIbios_mode[XGIfb_mode_idx].yres == XGI21_LCDCapList[0].LVDSVDE) &&
- (XGIbios_mode[XGIfb_mode_idx].bpp == 8))
- {
+ while ((XGIbios_mode[XGIfb_mode_idx].mode_no != 0)
+ && (XGIbios_mode[XGIfb_mode_idx].xres
+ <= XGI21_LCDCapList[0].LVDSHDE)) {
+ if ((XGIbios_mode[XGIfb_mode_idx].xres
+ == XGI21_LCDCapList[0].LVDSHDE)
+ && (XGIbios_mode[XGIfb_mode_idx].yres
+ == XGI21_LCDCapList[0].LVDSVDE)
+ && (XGIbios_mode[XGIfb_mode_idx].bpp == 8)) {
XGIfb_mode_no = XGIbios_mode[XGIfb_mode_idx].mode_no;
found_mode = 1;
break;
}
XGIfb_mode_idx++;
}
- if (!found_mode)
- XGIfb_mode_idx = 0;
+ if (!found_mode)
+ XGIfb_mode_idx = 0;
- return (XGIfb_mode_idx);
+ return XGIfb_mode_idx;
}
-
static int XGIfb_validate_mode(int myindex)
{
- u16 xres, yres;
-
- if (xgi_video_info.chip == XG21)
- {
- if ((xgi_video_info.disp_state & DISPTYPE_DISP2) == DISPTYPE_LCD)
- {
- xres = XGI21_LCDCapList[0].LVDSHDE;
- yres = XGI21_LCDCapList[0].LVDSVDE;
- if(XGIbios_mode[myindex].xres > xres)
- return(-1);
- if(XGIbios_mode[myindex].yres > yres)
- return(-1);
- if ((XGIbios_mode[myindex].xres < xres) && (XGIbios_mode[myindex].yres < yres) )
- {
- if (XGIbios_mode[myindex].bpp > 8)
- return(-1);
- }
-
- }
- return(myindex);
-
- }
-
- /* FIXME: for now, all is valid on XG27 */
- if (xgi_video_info.chip == XG27)
- return(myindex);
-
- if(!(XGIbios_mode[myindex].chipset & MD_XGI315))
- return(-1);
-
- switch (xgi_video_info.disp_state & DISPTYPE_DISP2) {
- case DISPTYPE_LCD:
- switch (XGIhw_ext.ulCRT2LCDType) {
- case LCD_640x480:
- xres = 640; yres = 480; break;
- case LCD_800x600:
- xres = 800; yres = 600; break;
- case LCD_1024x600:
- xres = 1024; yres = 600; break;
- case LCD_1024x768:
- xres = 1024; yres = 768; break;
- case LCD_1152x768:
- xres = 1152; yres = 768; break;
- case LCD_1280x960:
- xres = 1280; yres = 960; break;
- case LCD_1280x768:
- xres = 1280; yres = 768; break;
- case LCD_1280x1024:
- xres = 1280; yres = 1024; break;
- case LCD_1400x1050:
- xres = 1400; yres = 1050; break;
- case LCD_1600x1200:
- xres = 1600; yres = 1200; break;
-// case LCD_320x480: // TW: FSTN
-// xres = 320; yres = 480; break;
- default:
- xres = 0; yres = 0; break;
- }
- if(XGIbios_mode[myindex].xres > xres) {
- return(-1);
- }
- if(XGIbios_mode[myindex].yres > yres) {
- return(-1);
+ u16 xres, yres;
+
+ if (xgi_video_info.chip == XG21) {
+ if ((xgi_video_info.disp_state & DISPTYPE_DISP2)
+ == DISPTYPE_LCD) {
+ xres = XGI21_LCDCapList[0].LVDSHDE;
+ yres = XGI21_LCDCapList[0].LVDSVDE;
+ if (XGIbios_mode[myindex].xres > xres)
+ return -1;
+ if (XGIbios_mode[myindex].yres > yres)
+ return -1;
+ if ((XGIbios_mode[myindex].xres < xres)
+ && (XGIbios_mode[myindex].yres < yres)) {
+ if (XGIbios_mode[myindex].bpp > 8)
+ return -1;
+ }
+
+ }
+ return myindex;
+
}
- if((XGIhw_ext.ulExternalChip == 0x01) || // LVDS
- (XGIhw_ext.ulExternalChip == 0x05)) // LVDS+Chrontel
- {
- switch (XGIbios_mode[myindex].xres) {
- case 512:
- if(XGIbios_mode[myindex].yres != 512) return -1;
- if(XGIhw_ext.ulCRT2LCDType == LCD_1024x600) return -1;
- break;
- case 640:
- if((XGIbios_mode[myindex].yres != 400) &&
- (XGIbios_mode[myindex].yres != 480))
- return -1;
- break;
- case 800:
- if(XGIbios_mode[myindex].yres != 600) return -1;
- break;
- case 1024:
- if((XGIbios_mode[myindex].yres != 600) &&
- (XGIbios_mode[myindex].yres != 768))
- return -1;
- if((XGIbios_mode[myindex].yres == 600) &&
- (XGIhw_ext.ulCRT2LCDType != LCD_1024x600))
- return -1;
+
+ /* FIXME: for now, all is valid on XG27 */
+ if (xgi_video_info.chip == XG27)
+ return myindex;
+
+ if (!(XGIbios_mode[myindex].chipset & MD_XGI315))
+ return -1;
+
+ switch (xgi_video_info.disp_state & DISPTYPE_DISP2) {
+ case DISPTYPE_LCD:
+ switch (XGIhw_ext.ulCRT2LCDType) {
+ case LCD_640x480:
+ xres = 640;
+ yres = 480;
break;
- case 1152:
- if((XGIbios_mode[myindex].yres) != 768) return -1;
- if(XGIhw_ext.ulCRT2LCDType != LCD_1152x768) return -1;
+ case LCD_800x600:
+ xres = 800;
+ yres = 600;
break;
- case 1280:
- if((XGIbios_mode[myindex].yres != 768) &&
- (XGIbios_mode[myindex].yres != 1024))
- return -1;
- if((XGIbios_mode[myindex].yres == 768) &&
- (XGIhw_ext.ulCRT2LCDType != LCD_1280x768))
- return -1;
+ case LCD_1024x600:
+ xres = 1024;
+ yres = 600;
break;
- case 1400:
- if(XGIbios_mode[myindex].yres != 1050) return -1;
+ case LCD_1024x768:
+ xres = 1024;
+ yres = 768;
break;
- case 1600:
- if(XGIbios_mode[myindex].yres != 1200) return -1;
+ case LCD_1152x768:
+ xres = 1152;
+ yres = 768;
break;
- default:
- return -1;
- }
- } else {
- switch (XGIbios_mode[myindex].xres) {
- case 512:
- if(XGIbios_mode[myindex].yres != 512) return -1;
- break;
- case 640:
- if((XGIbios_mode[myindex].yres != 400) &&
- (XGIbios_mode[myindex].yres != 480))
- return -1;
- break;
- case 800:
- if(XGIbios_mode[myindex].yres != 600) return -1;
- break;
- case 1024:
- if(XGIbios_mode[myindex].yres != 768) return -1;
+ case LCD_1280x960:
+ xres = 1280;
+ yres = 960;
break;
- case 1280:
- if((XGIbios_mode[myindex].yres != 960) &&
- (XGIbios_mode[myindex].yres != 1024))
- return -1;
- if(XGIbios_mode[myindex].yres == 960) {
- if(XGIhw_ext.ulCRT2LCDType == LCD_1400x1050)
- return -1;
- }
+ case LCD_1280x768:
+ xres = 1280;
+ yres = 768;
break;
- case 1400:
- if(XGIbios_mode[myindex].yres != 1050) return -1;
+ case LCD_1280x1024:
+ xres = 1280;
+ yres = 1024;
break;
- case 1600:
- if(XGIbios_mode[myindex].yres != 1200) return -1;
+ case LCD_1400x1050:
+ xres = 1400;
+ yres = 1050;
break;
- default:
- return -1;
- }
- }
- break;
- case DISPTYPE_TV:
- switch (XGIbios_mode[myindex].xres) {
- case 512:
- case 640:
- case 800:
- break;
- case 720:
- if (xgi_video_info.TV_type == TVMODE_NTSC) {
- if (XGIbios_mode[myindex].yres != 480) {
- return(-1);
+ case LCD_1600x1200:
+ xres = 1600;
+ yres = 1200;
+ break;
+ /* case LCD_320x480: */ /* TW: FSTN */
+ /*
+ xres = 320;
+ yres = 480;
+ break;
+ */
+ default:
+ xres = 0;
+ yres = 0;
+ break;
+ }
+ if (XGIbios_mode[myindex].xres > xres)
+ return -1;
+ if (XGIbios_mode[myindex].yres > yres)
+ return -1;
+ if ((XGIhw_ext.ulExternalChip == 0x01) || /* LVDS */
+ (XGIhw_ext.ulExternalChip == 0x05)) { /* LVDS+Chrontel */
+ switch (XGIbios_mode[myindex].xres) {
+ case 512:
+ if (XGIbios_mode[myindex].yres != 512)
+ return -1;
+ if (XGIhw_ext.ulCRT2LCDType == LCD_1024x600)
+ return -1;
+ break;
+ case 640:
+ if ((XGIbios_mode[myindex].yres != 400)
+ && (XGIbios_mode[myindex].yres
+ != 480))
+ return -1;
+ break;
+ case 800:
+ if (XGIbios_mode[myindex].yres != 600)
+ return -1;
+ break;
+ case 1024:
+ if ((XGIbios_mode[myindex].yres != 600)
+ && (XGIbios_mode[myindex].yres
+ != 768))
+ return -1;
+ if ((XGIbios_mode[myindex].yres == 600)
+ && (XGIhw_ext.ulCRT2LCDType
+ != LCD_1024x600))
+ return -1;
+ break;
+ case 1152:
+ if ((XGIbios_mode[myindex].yres) != 768)
+ return -1;
+ if (XGIhw_ext.ulCRT2LCDType != LCD_1152x768)
+ return -1;
+ break;
+ case 1280:
+ if ((XGIbios_mode[myindex].yres != 768)
+ && (XGIbios_mode[myindex].yres
+ != 1024))
+ return -1;
+ if ((XGIbios_mode[myindex].yres == 768)
+ && (XGIhw_ext.ulCRT2LCDType
+ != LCD_1280x768))
+ return -1;
+ break;
+ case 1400:
+ if (XGIbios_mode[myindex].yres != 1050)
+ return -1;
+ break;
+ case 1600:
+ if (XGIbios_mode[myindex].yres != 1200)
+ return -1;
+ break;
+ default:
+ return -1;
}
- } else if (xgi_video_info.TV_type == TVMODE_PAL) {
- if (XGIbios_mode[myindex].yres != 576) {
- return(-1);
+ } else {
+ switch (XGIbios_mode[myindex].xres) {
+ case 512:
+ if (XGIbios_mode[myindex].yres != 512)
+ return -1;
+ break;
+ case 640:
+ if ((XGIbios_mode[myindex].yres != 400)
+ && (XGIbios_mode[myindex].yres
+ != 480))
+ return -1;
+ break;
+ case 800:
+ if (XGIbios_mode[myindex].yres != 600)
+ return -1;
+ break;
+ case 1024:
+ if (XGIbios_mode[myindex].yres != 768)
+ return -1;
+ break;
+ case 1280:
+ if ((XGIbios_mode[myindex].yres != 960)
+ && (XGIbios_mode[myindex].yres
+ != 1024))
+ return -1;
+ if (XGIbios_mode[myindex].yres == 960) {
+ if (XGIhw_ext.ulCRT2LCDType
+ == LCD_1400x1050)
+ return -1;
+ }
+ break;
+ case 1400:
+ if (XGIbios_mode[myindex].yres != 1050)
+ return -1;
+ break;
+ case 1600:
+ if (XGIbios_mode[myindex].yres != 1200)
+ return -1;
+ break;
+ default:
+ return -1;
}
}
- // TW: LVDS/CHRONTEL does not support 720
- if (xgi_video_info.hasVB == HASVB_LVDS_CHRONTEL ||
- xgi_video_info.hasVB == HASVB_CHRONTEL) {
- return(-1);
- }
break;
- case 1024:
- if (xgi_video_info.TV_type == TVMODE_NTSC) {
- if(XGIbios_mode[myindex].bpp == 32) {
- return(-1);
+ case DISPTYPE_TV:
+ switch (XGIbios_mode[myindex].xres) {
+ case 512:
+ case 640:
+ case 800:
+ break;
+ case 720:
+ if (xgi_video_info.TV_type == TVMODE_NTSC) {
+ if (XGIbios_mode[myindex].yres != 480)
+ return -1;
+ } else if (xgi_video_info.TV_type == TVMODE_PAL) {
+ if (XGIbios_mode[myindex].yres != 576)
+ 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);
- }
+ /* TW: LVDS/CHRONTEL does not support 720 */
+ if (xgi_video_info.hasVB == HASVB_LVDS_CHRONTEL
+ || xgi_video_info.hasVB == HASVB_CHRONTEL) {
+ return -1;
+ }
+ break;
+ case 1024:
+ if (xgi_video_info.TV_type == TVMODE_NTSC) {
+ 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;
}
break;
- default:
- return(-1);
+ case DISPTYPE_CRT2:
+ if (XGIbios_mode[myindex].xres > 1280)
+ return -1;
+ break;
}
- break;
- case DISPTYPE_CRT2:
- if(XGIbios_mode[myindex].xres > 1280) return -1;
- break;
- }
- return(myindex);
+ return myindex;
}
@@ -843,10 +881,10 @@ static void XGIfb_search_crt2type(const char *name)
{
int i = 0;
- if(name == NULL)
+ if (name == NULL)
return;
- while(XGI_crt2type[i].type_no != -1) {
+ while (XGI_crt2type[i].type_no != -1) {
if (!strcmp(name, XGI_crt2type[i].name)) {
XGIfb_crt2type = XGI_crt2type[i].type_no;
XGIfb_tvplug = XGI_crt2type[i].tvplug_no;
@@ -854,7 +892,7 @@ static void XGIfb_search_crt2type(const char *name)
}
i++;
}
- if(XGIfb_crt2type < 0)
+ if (XGIfb_crt2type < 0)
printk(KERN_INFO "XGIfb: Invalid CRT2 type: %s\n", name);
}
@@ -862,7 +900,7 @@ static void XGIfb_search_queuemode(const char *name)
{
int i = 0;
- if(name == NULL)
+ if (name == NULL)
return;
while (XGI_queuemode[i].type_no != -1) {
@@ -886,30 +924,34 @@ static u8 XGIfb_search_refresh_rate(unsigned int rate)
XGIfb_rate_idx = 0;
while ((XGIfb_vrate[i].idx != 0) && (XGIfb_vrate[i].xres <= xres)) {
- if ((XGIfb_vrate[i].xres == xres) && (XGIfb_vrate[i].yres == yres)) {
+ if ((XGIfb_vrate[i].xres == xres) && (XGIfb_vrate[i].yres
+ == yres)) {
if (XGIfb_vrate[i].refresh == rate) {
XGIfb_rate_idx = XGIfb_vrate[i].idx;
break;
} else if (XGIfb_vrate[i].refresh > rate) {
if ((XGIfb_vrate[i].refresh - rate) <= 3) {
DPRINTK("XGIfb: Adjusting rate from %d up to %d\n",
- rate, XGIfb_vrate[i].refresh);
+ rate, XGIfb_vrate[i].refresh);
XGIfb_rate_idx = XGIfb_vrate[i].idx;
- xgi_video_info.refresh_rate = XGIfb_vrate[i].refresh;
- } else if (((rate - XGIfb_vrate[i-1].refresh) <= 2)
- && (XGIfb_vrate[i].idx != 1)) {
+ xgi_video_info.refresh_rate
+ = XGIfb_vrate[i].refresh;
+ } else if (((rate - XGIfb_vrate[i - 1].refresh)
+ <= 2) && (XGIfb_vrate[i].idx
+ != 1)) {
DPRINTK("XGIfb: Adjusting rate from %d down to %d\n",
- rate, XGIfb_vrate[i-1].refresh);
- XGIfb_rate_idx = XGIfb_vrate[i-1].idx;
- xgi_video_info.refresh_rate = XGIfb_vrate[i-1].refresh;
+ rate, XGIfb_vrate[i-1].refresh);
+ XGIfb_rate_idx = XGIfb_vrate[i - 1].idx;
+ xgi_video_info.refresh_rate
+ = XGIfb_vrate[i - 1].refresh;
}
break;
- } else if((rate - XGIfb_vrate[i].refresh) <= 2) {
+ } else if ((rate - XGIfb_vrate[i].refresh) <= 2) {
DPRINTK("XGIfb: Adjusting rate from %d down to %d\n",
rate, XGIfb_vrate[i].refresh);
- XGIfb_rate_idx = XGIfb_vrate[i].idx;
- break;
- }
+ XGIfb_rate_idx = XGIfb_vrate[i].idx;
+ break;
+ }
}
i++;
}
@@ -917,7 +959,7 @@ static u8 XGIfb_search_refresh_rate(unsigned int rate)
return XGIfb_rate_idx;
} else {
printk(KERN_INFO
- "XGIfb: Unsupported rate %d for %dx%d\n", rate, xres, yres);
+ "XGIfb: Unsupported rate %d for %dx%d\n", rate, xres, yres);
return 0;
}
}
@@ -926,7 +968,7 @@ static void XGIfb_search_tvstd(const char *name)
{
int i = 0;
- if(name == NULL)
+ if (name == NULL)
return;
while (XGI_tvtype[i].type_no != -1) {
@@ -940,73 +982,70 @@ static void XGIfb_search_tvstd(const char *name)
static unsigned char XGIfb_bridgeisslave(void)
{
- unsigned char usScratchP1_00;
+ unsigned char usScratchP1_00;
- if (xgi_video_info.hasVB == HASVB_NONE)
- return 0;
+ if (xgi_video_info.hasVB == HASVB_NONE)
+ return 0;
- inXGIIDXREG(XGIPART1,0x00,usScratchP1_00);
- if ((usScratchP1_00 & 0x50) == 0x10)
- return 1;
- else
- 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;
+ unsigned char temp;
+ inXGIIDXREG(XGICR, 0x17, temp);
+ if (!(temp & 0x80))
+ return 0;
- inXGIIDXREG(XGISR,0x1f,temp);
- if (temp & 0xc0)
- return 0;
+ inXGIIDXREG(XGISR, 0x1f, temp);
+ if (temp & 0xc0)
+ return 0;
- if (inXGIREG(XGIINPSTAT) & 0x08)
- return 1;
- else
- 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;
+ 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());
+ 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)
{
- switch(var->bits_per_pixel) {
- case 8:
- var->red.offset = var->green.offset = var->blue.offset = 0;
+ switch (var->bits_per_pixel) {
+ case 8:
+ var->red.offset = var->green.offset = var->blue.offset = 0;
var->red.length = var->green.length = var->blue.length = 6;
xgi_video_info.video_cmap_len = 256;
break;
- case 16:
+ case 16:
var->red.offset = 11;
var->red.length = 5;
var->green.offset = 5;
@@ -1017,7 +1056,7 @@ static void XGIfb_bpp_to_var(struct fb_var_screeninfo *var)
var->transp.length = 0;
xgi_video_info.video_cmap_len = 16;
break;
- case 32:
+ case 32:
var->red.offset = 16;
var->red.length = 8;
var->green.offset = 8;
@@ -1031,69 +1070,66 @@ static void XGIfb_bpp_to_var(struct fb_var_screeninfo *var)
}
}
-
-
static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
- struct fb_info *info)
+ struct fb_info *info)
{
- unsigned int htotal = var->left_margin + var->xres +
- var->right_margin + var->hsync_len;
- unsigned int vtotal = var->upper_margin + var->yres +
- var->lower_margin + var->vsync_len;
+ unsigned int htotal = var->left_margin + var->xres + var->right_margin
+ + var->hsync_len;
+ unsigned int vtotal = var->upper_margin + var->yres + var->lower_margin
+ + var->vsync_len;
#if defined(__powerpc__)
u8 sr_data, cr_data;
#endif
unsigned int drate = 0, hrate = 0;
int found_mode = 0;
int old_mode;
-// unsigned char reg,reg1;
+ /* unsigned char reg, reg1; */
DEBUGPRN("Inside do_set_var");
-// printk(KERN_DEBUG "XGIfb:var->yres=%d, var->upper_margin=%d, var->lower_margin=%d, var->vsync_len=%d\n", var->yres,var->upper_margin,var->lower_margin,var->vsync_len);
+ /* printk(KERN_DEBUG "XGIfb:var->yres=%d, var->upper_margin=%d, var->lower_margin=%d, var->vsync_len=%d\n", var->yres, var->upper_margin, var->lower_margin, var->vsync_len); */
- info->var.xres_virtual = var->xres_virtual;
- info->var.yres_virtual = var->yres_virtual;
- info->var.bits_per_pixel = var->bits_per_pixel;
+ info->var.xres_virtual = var->xres_virtual;
+ info->var.yres_virtual = var->yres_virtual;
+ info->var.bits_per_pixel = var->bits_per_pixel;
if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_NONINTERLACED)
vtotal <<= 1;
else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE)
vtotal <<= 2;
- else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED)
- {
-// vtotal <<= 1;
-// var->yres <<= 1;
+ else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) {
+ /* vtotal <<= 1; */
+ /* var->yres <<= 1; */
}
- if(!htotal || !vtotal) {
+ if (!htotal || !vtotal) {
DPRINTK("XGIfb: Invalid 'var' information\n");
return -EINVAL;
- }
- printk(KERN_DEBUG "XGIfb: var->pixclock=%d, htotal=%d, vtotal=%d\n",
- var->pixclock,htotal,vtotal);
-
+ } printk(KERN_DEBUG "XGIfb: var->pixclock=%d, htotal=%d, vtotal=%d\n",
+ var->pixclock, htotal, vtotal);
-
- if(var->pixclock && htotal && vtotal) {
+ if (var->pixclock && htotal && vtotal) {
drate = 1000000000 / var->pixclock;
hrate = (drate * 1000) / htotal;
- xgi_video_info.refresh_rate = (unsigned int) (hrate * 2 / vtotal);
+ xgi_video_info.refresh_rate = (unsigned int) (hrate * 2
+ / vtotal);
} else {
xgi_video_info.refresh_rate = 60;
}
printk(KERN_DEBUG "XGIfb: Change mode to %dx%dx%d-%dHz\n",
- var->xres,var->yres,var->bits_per_pixel,xgi_video_info.refresh_rate);
+ var->xres, var->yres, var->bits_per_pixel, xgi_video_info.refresh_rate);
old_mode = xgifb_mode_idx;
xgifb_mode_idx = 0;
- while( (XGIbios_mode[xgifb_mode_idx].mode_no != 0) &&
- (XGIbios_mode[xgifb_mode_idx].xres <= var->xres) ) {
- if( (XGIbios_mode[xgifb_mode_idx].xres == var->xres) &&
- (XGIbios_mode[xgifb_mode_idx].yres == var->yres) &&
- (XGIbios_mode[xgifb_mode_idx].bpp == var->bits_per_pixel)) {
+ while ((XGIbios_mode[xgifb_mode_idx].mode_no != 0)
+ && (XGIbios_mode[xgifb_mode_idx].xres <= var->xres)) {
+ if ((XGIbios_mode[xgifb_mode_idx].xres == var->xres)
+ && (XGIbios_mode[xgifb_mode_idx].yres
+ == var->yres)
+ && (XGIbios_mode[xgifb_mode_idx].bpp
+ == var->bits_per_pixel)) {
XGIfb_mode_no = XGIbios_mode[xgifb_mode_idx].mode_no;
found_mode = 1;
break;
@@ -1101,45 +1137,45 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
xgifb_mode_idx++;
}
- if(found_mode)
+ if (found_mode)
xgifb_mode_idx = XGIfb_validate_mode(xgifb_mode_idx);
else
xgifb_mode_idx = -1;
- if(xgifb_mode_idx < 0) {
+ if (xgifb_mode_idx < 0) {
printk(KERN_ERR "XGIfb: Mode %dx%dx%d not supported\n", var->xres,
- var->yres, var->bits_per_pixel);
+ var->yres, var->bits_per_pixel);
xgifb_mode_idx = old_mode;
return -EINVAL;
}
- if(XGIfb_search_refresh_rate(xgi_video_info.refresh_rate) == 0) {
+ if (XGIfb_search_refresh_rate(xgi_video_info.refresh_rate) == 0) {
XGIfb_rate_idx = XGIbios_mode[xgifb_mode_idx].rate_idx;
xgi_video_info.refresh_rate = 60;
}
- if(isactive) {
-
+ if (isactive) {
XGIfb_pre_setmode();
- if(XGISetModeNew( &XGIhw_ext, XGIfb_mode_no) == 0) {
+ if (XGISetModeNew(&XGIhw_ext, XGIfb_mode_no) == 0) {
printk(KERN_ERR "XGIfb: Setting mode[0x%x] failed\n", XGIfb_mode_no);
return -EINVAL;
}
- info->fix.line_length = ((info->var.xres_virtual * info->var.bits_per_pixel)>>6);
+ info->fix.line_length = ((info->var.xres_virtual
+ * info->var.bits_per_pixel) >> 6);
- outXGIIDXREG(XGISR,IND_XGI_PASSWORD,XGI_PASSWORD);
+ outXGIIDXREG(XGISR, IND_XGI_PASSWORD, XGI_PASSWORD);
- outXGIIDXREG(XGICR,0x13,(info->fix.line_length & 0x00ff));
- outXGIIDXREG(XGISR,0x0E,(info->fix.line_length & 0xff00)>>8);
+ outXGIIDXREG(XGICR, 0x13, (info->fix.line_length & 0x00ff));
+ outXGIIDXREG(XGISR, 0x0E, (info->fix.line_length & 0xff00) >> 8);
XGIfb_post_setmode();
- DPRINTK("XGIfb: Set new mode: %dx%dx%d-%d \n",
- XGIbios_mode[xgifb_mode_idx].xres,
- XGIbios_mode[xgifb_mode_idx].yres,
- XGIbios_mode[xgifb_mode_idx].bpp,
- xgi_video_info.refresh_rate);
+ DPRINTK("XGIfb: Set new mode: %dx%dx%d-%d\n",
+ XGIbios_mode[xgifb_mode_idx].xres,
+ XGIbios_mode[xgifb_mode_idx].yres,
+ XGIbios_mode[xgifb_mode_idx].bpp,
+ xgi_video_info.refresh_rate);
xgi_video_info.video_bpp = XGIbios_mode[xgifb_mode_idx].bpp;
xgi_video_info.video_vwidth = info->var.xres_virtual;
@@ -1147,46 +1183,47 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
xgi_video_info.video_vheight = info->var.yres_virtual;
xgi_video_info.video_height = XGIbios_mode[xgifb_mode_idx].yres;
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.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;
+ 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;
- xgi_video_info.XGI310_AccelDepth = 0x00000000;
- xgi_video_info.video_cmap_len = 256;
+ 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;
#if defined(__powerpc__)
- inXGIIDXREG (XGICR, 0x4D, cr_data);
- outXGIIDXREG(XGICR, 0x4D, (cr_data & 0xE0));
+ inXGIIDXREG(XGICR, 0x4D, cr_data);
+ outXGIIDXREG(XGICR, 0x4D, (cr_data & 0xE0));
#endif
- break;
- case 16:
- xgi_video_info.DstColor = 0x8000;
- xgi_video_info.XGI310_AccelDepth = 0x00010000;
+ break;
+ case 16:
+ xgi_video_info.DstColor = 0x8000;
+ xgi_video_info.XGI310_AccelDepth = 0x00010000;
#if defined(__powerpc__)
- inXGIIDXREG (XGICR, 0x4D, cr_data);
- outXGIIDXREG(XGICR, 0x4D, ((cr_data & 0xE0) | 0x0B));
+ inXGIIDXREG(XGICR, 0x4D, cr_data);
+ outXGIIDXREG(XGICR, 0x4D, ((cr_data & 0xE0) | 0x0B));
#endif
- 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;
+ 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;
#if defined(__powerpc__)
- inXGIIDXREG (XGICR, 0x4D, cr_data);
- outXGIIDXREG(XGICR, 0x4D, ((cr_data & 0xE0) | 0x15));
+ inXGIIDXREG(XGICR, 0x4D, cr_data);
+ outXGIIDXREG(XGICR, 0x4D, ((cr_data & 0xE0) | 0x15));
#endif
- break;
- 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;
- }
+ break;
+ 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;
+ }
}
XGIfb_bpp_to_var(var); /*update ARGB info*/
DEBUGPRN("End of do_set_var");
@@ -1200,92 +1237,88 @@ static int XGIfb_pan_var(struct fb_var_screeninfo *var)
{
unsigned int base;
-// printk("Inside pan_var");
+ /* printk("Inside pan_var"); */
if (var->xoffset > (var->xres_virtual - var->xres)) {
-// printk( "Pan: xo: %d xv %d xr %d\n",
-// var->xoffset, var->xres_virtual, var->xres);
+ /* printk("Pan: xo: %d xv %d xr %d\n",
+ var->xoffset, var->xres_virtual, var->xres); */
return -EINVAL;
}
- if(var->yoffset > (var->yres_virtual - var->yres)) {
-// printk( "Pan: yo: %d yv %d yr %d\n",
-// var->yoffset, var->yres_virtual, var->yres);
+ if (var->yoffset > (var->yres_virtual - var->yres)) {
+ /* printk("Pan: yo: %d yv %d yr %d\n",
+ var->yoffset, var->yres_virtual, var->yres); */
return -EINVAL;
}
- base = var->yoffset * var->xres_virtual + var->xoffset;
+ base = var->yoffset * var->xres_virtual + var->xoffset;
- /* calculate base bpp dep. */
- switch(var->bits_per_pixel) {
- case 16:
- base >>= 1;
- break;
+ /* calculate base bpp dep. */
+ switch (var->bits_per_pixel) {
+ case 16:
+ base >>= 1;
+ break;
case 32:
- break;
+ break;
case 8:
- default:
- base >>= 2;
- break;
- }
+ default:
+ base >>= 2;
+ break;
+ }
outXGIIDXREG(XGISR, IND_XGI_PASSWORD, XGI_PASSWORD);
- outXGIIDXREG(XGICR, 0x0D, base & 0xFF);
+ outXGIIDXREG(XGICR, 0x0D, base & 0xFF);
outXGIIDXREG(XGICR, 0x0C, (base >> 8) & 0xFF);
outXGIIDXREG(XGISR, 0x0D, (base >> 16) & 0xFF);
- outXGIIDXREG(XGISR, 0x37, (base >> 24) & 0x03);
+ outXGIIDXREG(XGISR, 0x37, (base >> 24) & 0x03);
setXGIIDXREG(XGISR, 0x37, 0xDF, (base >> 21) & 0x04);
- if(xgi_video_info.disp_state & DISPTYPE_DISP2) {
+ if (xgi_video_info.disp_state & DISPTYPE_DISP2) {
orXGIIDXREG(XGIPART1, XGIfb_CRT2_write_enable, 0x01);
- outXGIIDXREG(XGIPART1, 0x06, (base & 0xFF));
- outXGIIDXREG(XGIPART1, 0x05, ((base >> 8) & 0xFF));
- outXGIIDXREG(XGIPART1, 0x04, ((base >> 16) & 0xFF));
+ outXGIIDXREG(XGIPART1, 0x06, (base & 0xFF));
+ outXGIIDXREG(XGIPART1, 0x05, ((base >> 8) & 0xFF));
+ outXGIIDXREG(XGIPART1, 0x04, ((base >> 16) & 0xFF));
setXGIIDXREG(XGIPART1, 0x02, 0x7F, ((base >> 24) & 0x01) << 7);
- }
-// printk("End of pan_var");
+ }
+ /* printk("End of pan_var"); */
return 0;
}
#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.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;
+ 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;
+ return 0;
}
static int XGIfb_release(struct fb_info *info, int user)
{
- return 0;
+ return 0;
}
static int XGIfb_get_cmap_len(const struct fb_var_screeninfo *var)
{
int rc = 16;
- switch(var->bits_per_pixel) {
+ switch (var->bits_per_pixel) {
case 8:
rc = 256;
break;
@@ -1299,35 +1332,36 @@ static int XGIfb_get_cmap_len(const struct fb_var_screeninfo *var)
return rc;
}
-static int XGIfb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue,
- unsigned transp, struct fb_info *info)
+static int XGIfb_setcolreg(unsigned regno, unsigned red, unsigned green,
+ unsigned blue, unsigned transp, struct fb_info *info)
{
if (regno >= XGIfb_get_cmap_len(&info->var))
return 1;
switch (info->var.bits_per_pixel) {
case 8:
- outXGIREG(XGIDACA, regno);
+ outXGIREG(XGIDACA, regno);
outXGIREG(XGIDACD, (red >> 10));
outXGIREG(XGIDACD, (green >> 10));
outXGIREG(XGIDACD, (blue >> 10));
if (xgi_video_info.disp_state & DISPTYPE_DISP2) {
- outXGIREG(XGIDAC2A, regno);
+ outXGIREG(XGIDAC2A, regno);
outXGIREG(XGIDAC2D, (red >> 8));
outXGIREG(XGIDAC2D, (green >> 8));
outXGIREG(XGIDAC2D, (blue >> 8));
}
break;
case 16:
- ((u32 *)(info->pseudo_palette))[regno] =
- ((red & 0xf800)) | ((green & 0xfc00) >> 5) | ((blue & 0xf800) >> 11);
+ ((u32 *) (info->pseudo_palette))[regno] = ((red & 0xf800))
+ | ((green & 0xfc00) >> 5) | ((blue & 0xf800)
+ >> 11);
break;
case 32:
red >>= 8;
green >>= 8;
blue >>= 8;
- ((u32 *) (info->pseudo_palette))[regno] =
- (red << 16) | (green << 8) | (blue);
+ ((u32 *) (info->pseudo_palette))[regno] = (red << 16) | (green
+ << 8) | (blue);
break;
}
return 0;
@@ -1337,20 +1371,19 @@ static int XGIfb_set_par(struct fb_info *info)
{
int err;
-// printk("XGIfb: inside set_par\n");
- if((err = XGIfb_do_set_var(&info->var, 1, info)))
+ /* printk("XGIfb: inside set_par\n"); */
+ err = XGIfb_do_set_var(&info->var, 1, info);
+ if (err)
return err;
XGIfb_get_fix(&info->fix, -1, info);
-// printk("XGIfb:end of set_par\n");
+ /* printk("XGIfb: end of set_par\n"); */
return 0;
}
-static int XGIfb_check_var(struct fb_var_screeninfo *var,
- struct fb_info *info)
+static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
{
- unsigned int htotal =
- var->left_margin + var->xres + var->right_margin +
- var->hsync_len;
+ unsigned int htotal = var->left_margin + var->xres + var->right_margin
+ + var->hsync_len;
unsigned int vtotal = 0;
unsigned int drate = 0, hrate = 0;
int found_mode = 0;
@@ -1358,90 +1391,91 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var,
DEBUGPRN("Inside check_var");
- if((var->vmode & FB_VMODE_MASK) == FB_VMODE_NONINTERLACED) {
- vtotal = var->upper_margin + var->yres + var->lower_margin +
- var->vsync_len;
+ if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_NONINTERLACED) {
+ vtotal = var->upper_margin + var->yres + var->lower_margin
+ + var->vsync_len;
vtotal <<= 1;
- } else if((var->vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE) {
- vtotal = var->upper_margin + var->yres + var->lower_margin +
- var->vsync_len;
+ } else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE) {
+ vtotal = var->upper_margin + var->yres + var->lower_margin
+ + var->vsync_len;
vtotal <<= 2;
- } else if((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) {
- vtotal = var->upper_margin + (var->yres/2) + var->lower_margin +
- var->vsync_len;
- } else vtotal = var->upper_margin + var->yres + var->lower_margin +
- var->vsync_len;
+ } else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) {
+ vtotal = var->upper_margin + (var->yres / 2)
+ + var->lower_margin + var->vsync_len;
+ } else
+ vtotal = var->upper_margin + var->yres + var->lower_margin
+ + var->vsync_len;
- if(!(htotal) || !(vtotal)) {
+ if (!(htotal) || !(vtotal))
XGIFAIL("XGIfb: no valid timing data");
- }
-
- if(var->pixclock && htotal && vtotal) {
- drate = 1000000000 / var->pixclock;
- hrate = (drate * 1000) / htotal;
- xgi_video_info.refresh_rate = (unsigned int) (hrate * 2 / vtotal);
- printk(KERN_DEBUG \
- "%s: pixclock = %d ,htotal=%d, vtotal=%d\n" \
- "%s: drate=%d, hrate=%d, refresh_rate=%d\n",
- __func__,var->pixclock, htotal, vtotal,
- __func__, drate, hrate, xgi_video_info.refresh_rate);
- } else {
- xgi_video_info.refresh_rate = 60;
- }
+ if (var->pixclock && htotal && vtotal) {
+ drate = 1000000000 / var->pixclock;
+ hrate = (drate * 1000) / htotal;
+ xgi_video_info.refresh_rate = (unsigned int) (hrate * 2 / vtotal);
+ printk(KERN_DEBUG
+ "%s: pixclock = %d ,htotal=%d, vtotal=%d\n"
+ "%s: drate=%d, hrate=%d, refresh_rate=%d\n",
+ __func__, var->pixclock, htotal, vtotal,
+ __func__, drate, hrate, xgi_video_info.refresh_rate);
+ } else {
+ xgi_video_info.refresh_rate = 60;
+ }
-/*
- if((var->pixclock) && (htotal)) {
- drate = 1E12 / var->pixclock;
- hrate = drate / htotal;
- refresh_rate = (unsigned int) (hrate / vtotal * 2 + 0.5);
- } else refresh_rate = 60;
-*/
+ /*
+ if ((var->pixclock) && (htotal)) {
+ drate = 1E12 / var->pixclock;
+ hrate = drate / htotal;
+ refresh_rate = (unsigned int) (hrate / vtotal * 2 + 0.5);
+ } else {
+ refresh_rate = 60;
+ }
+ */
/* TW: Calculation wrong for 1024x600 - force it to 60Hz */
- if((var->xres == 1024) && (var->yres == 600)) refresh_rate = 60;
+ if ((var->xres == 1024) && (var->yres == 600))
+ refresh_rate = 60;
search_idx = 0;
- while((XGIbios_mode[search_idx].mode_no != 0) &&
- (XGIbios_mode[search_idx].xres <= var->xres) ) {
- if((XGIbios_mode[search_idx].xres == var->xres) &&
- (XGIbios_mode[search_idx].yres == var->yres) &&
- (XGIbios_mode[search_idx].bpp == var->bits_per_pixel)) {
- if(XGIfb_validate_mode(search_idx) > 0) {
- found_mode = 1;
- break;
- }
- }
+ while ((XGIbios_mode[search_idx].mode_no != 0) &&
+ (XGIbios_mode[search_idx].xres <= var->xres)) {
+ if ((XGIbios_mode[search_idx].xres == var->xres) &&
+ (XGIbios_mode[search_idx].yres == var->yres) &&
+ (XGIbios_mode[search_idx].bpp == var->bits_per_pixel)) {
+ if (XGIfb_validate_mode(search_idx) > 0) {
+ found_mode = 1;
+ break;
+ }
+ }
search_idx++;
}
- if(!found_mode) {
+ if (!found_mode) {
printk(KERN_ERR "XGIfb: %dx%dx%d is no valid mode\n",
var->xres, var->yres, var->bits_per_pixel);
-
- search_idx = 0;
- while(XGIbios_mode[search_idx].mode_no != 0) {
-
- if( (var->xres <= XGIbios_mode[search_idx].xres) &&
- (var->yres <= XGIbios_mode[search_idx].yres) &&
- (var->bits_per_pixel == XGIbios_mode[search_idx].bpp) ) {
- if(XGIfb_validate_mode(search_idx) > 0) {
- found_mode = 1;
- break;
- }
- }
- search_idx++;
- }
- if(found_mode) {
+ search_idx = 0;
+ while (XGIbios_mode[search_idx].mode_no != 0) {
+
+ if ((var->xres <= XGIbios_mode[search_idx].xres) &&
+ (var->yres <= XGIbios_mode[search_idx].yres) &&
+ (var->bits_per_pixel == XGIbios_mode[search_idx].bpp)) {
+ if (XGIfb_validate_mode(search_idx) > 0) {
+ found_mode = 1;
+ break;
+ }
+ }
+ search_idx++;
+ }
+ if (found_mode) {
var->xres = XGIbios_mode[search_idx].xres;
- var->yres = XGIbios_mode[search_idx].yres;
- printk(KERN_DEBUG "XGIfb: Adapted to mode %dx%dx%d\n",
- var->xres, var->yres, var->bits_per_pixel);
+ var->yres = XGIbios_mode[search_idx].yres;
+ printk(KERN_DEBUG "XGIfb: Adapted to mode %dx%dx%d\n",
+ var->xres, var->yres, var->bits_per_pixel);
} else {
- printk(KERN_ERR "XGIfb: Failed to find similar mode to %dx%dx%d\n",
+ printk(KERN_ERR "XGIfb: Failed to find similar mode to %dx%dx%d\n",
var->xres, var->yres, var->bits_per_pixel);
- return -EINVAL;
+ return -EINVAL;
}
}
@@ -1456,21 +1490,20 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var,
if (var->yoffset < 0)
var->yoffset = 0;
-
- if(!XGIfb_ypan) {
- if(var->xres != var->xres_virtual)
- var->xres_virtual = var->xres;
- if(var->yres != var->yres_virtual)
+ if (!XGIfb_ypan) {
+ if (var->xres != var->xres_virtual)
+ var->xres_virtual = var->xres;
+ if (var->yres != var->yres_virtual)
var->yres_virtual = var->yres;
- }/* else {
- // TW: Now patch yres_virtual if we use panning
- // May I do this?
- var->yres_virtual = xgi_video_info.heapstart / (var->xres * (var->bits_per_pixel >> 3));
- if(var->yres_virtual <= var->yres) {
- // TW: Paranoia check
- var->yres_virtual = var->yres;
- }
- }*/
+ } /* else { */
+ /* TW: Now patch yres_virtual if we use panning */
+ /* May I do this? */
+ /* var->yres_virtual = xgi_video_info.heapstart / (var->xres * (var->bits_per_pixel >> 3)); */
+ /* if (var->yres_virtual <= var->yres) { */
+ /* TW: Paranoia check */
+ /* var->yres_virtual = var->yres; */
+ /* } */
+ /* } */
/* Truncate offsets to maximum if too high */
if (var->xoffset > var->xres_virtual - var->xres)
@@ -1481,21 +1514,21 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var,
/* Set everything else to 0 */
var->red.msb_right =
- var->green.msb_right =
- var->blue.msb_right =
- var->transp.offset = var->transp.length = var->transp.msb_right = 0;
+ var->green.msb_right =
+ var->blue.msb_right =
+ var->transp.offset = var->transp.length = var->transp.msb_right = 0;
DEBUGPRN("end of check_var");
return 0;
}
#ifdef XGIFB_PAN
-static int XGIfb_pan_display( struct fb_var_screeninfo *var,
- struct fb_info* info)
+static int XGIfb_pan_display(struct fb_var_screeninfo *var,
+ struct fb_info *info)
{
int err;
-// printk("\nInside pan_display:");
+ /* printk("\nInside pan_display:\n"); */
if (var->xoffset > (var->xres_virtual - var->xres))
return -EINVAL;
@@ -1503,16 +1536,18 @@ static int XGIfb_pan_display( struct fb_var_screeninfo *var,
return -EINVAL;
if (var->vmode & FB_VMODE_YWRAP) {
- if (var->yoffset < 0
- || var->yoffset >= info->var.yres_virtual
- || var->xoffset) return -EINVAL;
+ if (var->yoffset < 0 || var->yoffset >= info->var.yres_virtual
+ || var->xoffset)
+ return -EINVAL;
} else {
- if (var->xoffset + info->var.xres > info->var.xres_virtual ||
- var->yoffset + info->var.yres > info->var.yres_virtual)
+ if (var->xoffset + info->var.xres > info->var.xres_virtual
+ || var->yoffset + info->var.yres
+ > info->var.yres_virtual)
return -EINVAL;
}
-
- if((err = XGIfb_pan_var(var)) < 0) return err;
+ err = XGIfb_pan_var(var);
+ if (err < 0)
+ return err;
info->var.xoffset = var->xoffset;
info->var.yoffset = var->yoffset;
@@ -1521,139 +1556,135 @@ static int XGIfb_pan_display( struct fb_var_screeninfo *var,
else
info->var.vmode &= ~FB_VMODE_YWRAP;
-// printk(" End of pan_display");
+ /* printk("End of pan_display\n"); */
return 0;
}
#endif
-
static int XGIfb_blank(int blank, struct fb_info *info)
{
u8 reg;
inXGIIDXREG(XGICR, 0x17, reg);
- if(blank > 0)
+ if (blank > 0)
reg &= 0x7f;
else
reg |= 0x80;
- outXGIIDXREG(XGICR, 0x17, reg);
- outXGIIDXREG(XGISR, 0x00, 0x01); /* Synchronous Reset */
- outXGIIDXREG(XGISR, 0x00, 0x03); /* End Reset */
- return(0);
+ outXGIIDXREG(XGICR, 0x17, reg);
+ outXGIIDXREG(XGISR, 0x00, 0x01); /* Synchronous Reset */
+ outXGIIDXREG(XGISR, 0x00, 0x03); /* End Reset */
+ return 0;
}
-
static int XGIfb_ioctl(struct fb_info *info, unsigned int cmd,
- unsigned long arg)
+ unsigned long arg)
{
DEBUGPRN("inside ioctl");
switch (cmd) {
- case FBIO_ALLOC:
+ case FBIO_ALLOC:
if (!capable(CAP_SYS_RAWIO))
return -EPERM;
XGI_malloc((struct XGI_memreq *) arg);
break;
- case FBIO_FREE:
+ 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;
+ 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;
+ 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 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;
- }
-
+ 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;
}
- case FBIOGET_DISPINFO:
- XGI_dispinfo((struct ap_data *)arg);
+
+ 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_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");
+ 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,
- struct fb_info *info)
+ struct fb_info *info)
{
DEBUGPRN("inside get_fix");
memset(fix, 0, sizeof(struct fb_fix_screeninfo));
@@ -1664,175 +1695,168 @@ 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)
+ /* 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)
fix->visual = FB_VISUAL_PSEUDOCOLOR;
else
fix->visual = FB_VISUAL_DIRECTCOLOR;
- fix->xpanstep = 0;
+ fix->xpanstep = 0;
#ifdef XGIFB_PAN
- if(XGIfb_ypan) fix->ypanstep = 1;
+ if (XGIfb_ypan)
+ fix->ypanstep = 1;
#endif
- fix->ywrapstep = 0;
+ 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;
+ 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->accel = FB_ACCEL_XGI_GLAMOUR_2;
DEBUGPRN("end of get_fix");
return 0;
}
-
static struct fb_ops XGIfb_ops = {
- .owner = THIS_MODULE,
- .fb_open = XGIfb_open,
- .fb_release = XGIfb_release,
+ .owner = THIS_MODULE,
+ .fb_open = XGIfb_open,
+ .fb_release = XGIfb_release,
.fb_check_var = XGIfb_check_var,
- .fb_set_par = XGIfb_set_par,
+ .fb_set_par = XGIfb_set_par,
.fb_setcolreg = XGIfb_setcolreg,
#ifdef XGIFB_PAN
- .fb_pan_display = XGIfb_pan_display,
+ .fb_pan_display = XGIfb_pan_display,
#endif
- .fb_blank = XGIfb_blank,
- .fb_fillrect = fbcon_XGI_fillrect,
- .fb_copyarea = fbcon_XGI_copyarea,
+ .fb_blank = XGIfb_blank,
+ .fb_fillrect = fbcon_XGI_fillrect,
+ .fb_copyarea = fbcon_XGI_copyarea,
.fb_imageblit = cfb_imageblit,
- .fb_sync = fbcon_XGI_sync,
- .fb_ioctl = XGIfb_ioctl,
-// .fb_mmap = XGIfb_mmap,
+ .fb_sync = fbcon_XGI_sync,
+ .fb_ioctl = XGIfb_ioctl,
+ /* .fb_mmap = XGIfb_mmap, */
};
/* ---------------- Chip generation dependent routines ---------------- */
-
/* for XGI 315/550/650/740/330 */
static int XGIfb_get_dram_size(void)
{
- u8 ChannelNum,tmp;
- u8 reg = 0;
+ u8 ChannelNum, tmp;
+ u8 reg = 0;
/* xorg driver sets 32MB * 1 channel */
if (xgi_video_info.chip == XG27)
outXGIIDXREG(XGISR, IND_XGI_DRAM_SIZE, 0x51);
- inXGIIDXREG(XGISR, IND_XGI_DRAM_SIZE, reg);
- switch ((reg & XGI_DRAM_SIZE_MASK) >> 4) {
- case XGI_DRAM_SIZE_1MB:
- xgi_video_info.video_size = 0x100000;
- break;
- case XGI_DRAM_SIZE_2MB:
- xgi_video_info.video_size = 0x200000;
- break;
- case XGI_DRAM_SIZE_4MB:
- xgi_video_info.video_size = 0x400000;
- break;
- case XGI_DRAM_SIZE_8MB:
- xgi_video_info.video_size = 0x800000;
- break;
- case XGI_DRAM_SIZE_16MB:
- xgi_video_info.video_size = 0x1000000;
- break;
- case XGI_DRAM_SIZE_32MB:
- xgi_video_info.video_size = 0x2000000;
- break;
- case XGI_DRAM_SIZE_64MB:
- xgi_video_info.video_size = 0x4000000;
- break;
- case XGI_DRAM_SIZE_128MB:
- xgi_video_info.video_size = 0x8000000;
- break;
- case XGI_DRAM_SIZE_256MB:
- xgi_video_info.video_size = 0x10000000;
- break;
- default:
- return -1;
- }
+ inXGIIDXREG(XGISR, IND_XGI_DRAM_SIZE, reg);
+ switch ((reg & XGI_DRAM_SIZE_MASK) >> 4) {
+ case XGI_DRAM_SIZE_1MB:
+ xgi_video_info.video_size = 0x100000;
+ break;
+ case XGI_DRAM_SIZE_2MB:
+ xgi_video_info.video_size = 0x200000;
+ break;
+ case XGI_DRAM_SIZE_4MB:
+ xgi_video_info.video_size = 0x400000;
+ break;
+ case XGI_DRAM_SIZE_8MB:
+ xgi_video_info.video_size = 0x800000;
+ break;
+ case XGI_DRAM_SIZE_16MB:
+ xgi_video_info.video_size = 0x1000000;
+ break;
+ case XGI_DRAM_SIZE_32MB:
+ xgi_video_info.video_size = 0x2000000;
+ break;
+ case XGI_DRAM_SIZE_64MB:
+ xgi_video_info.video_size = 0x4000000;
+ break;
+ case XGI_DRAM_SIZE_128MB:
+ xgi_video_info.video_size = 0x8000000;
+ break;
+ case XGI_DRAM_SIZE_256MB:
+ xgi_video_info.video_size = 0x10000000;
+ break;
+ default:
+ return -1;
+ }
- tmp = (reg & 0x0c) >> 2;
- switch(xgi_video_info.chip)
- {
- case XG20:
- case XG21:
- case XG27:
- ChannelNum = 1;
- break;
-
- case XG42:
- if(reg & 0x04)
- ChannelNum = 2;
- else
- ChannelNum = 1;
- break;
-
- case XG45:
- if(tmp == 1)
- ChannelNum = 2;
- else
- if(tmp == 2)
- ChannelNum = 3;
- else
- if(tmp == 3)
- ChannelNum = 4;
- else
- ChannelNum = 1;
- break;
-
- case XG40:
- default:
- if(tmp == 2)
- ChannelNum = 2;
- else
- if(tmp == 3)
- ChannelNum = 3;
- else
- ChannelNum = 1;
- break;
- }
+ tmp = (reg & 0x0c) >> 2;
+ switch (xgi_video_info.chip) {
+ case XG20:
+ case XG21:
+ case XG27:
+ ChannelNum = 1;
+ break;
+ case XG42:
+ if (reg & 0x04)
+ ChannelNum = 2;
+ else
+ ChannelNum = 1;
+ break;
- xgi_video_info.video_size = xgi_video_info.video_size * ChannelNum;
- //PLiad fixed for benchmarking and fb set
- //xgi_video_info.video_size = 0x200000;//1024x768x16
- //xgi_video_info.video_size = 0x1000000;//benchmark
+ case XG45:
+ if (tmp == 1)
+ ChannelNum = 2;
+ else if (tmp == 2)
+ ChannelNum = 3;
+ else if (tmp == 3)
+ ChannelNum = 4;
+ else
+ ChannelNum = 1;
+ break;
- printk("XGIfb: SR14=%x DramSzie %x ChannelNum %x\n",reg,xgi_video_info.video_size ,ChannelNum );
- return 0;
+ case XG40:
+ default:
+ if (tmp == 2)
+ ChannelNum = 2;
+ else if (tmp == 3)
+ ChannelNum = 3;
+ else
+ ChannelNum = 1;
+ break;
+ }
+
+ xgi_video_info.video_size = xgi_video_info.video_size * ChannelNum;
+ /* PLiad fixed for benchmarking and fb set */
+ /* xgi_video_info.video_size = 0x200000; */ /* 1024x768x16 */
+ /* xgi_video_info.video_size = 0x1000000; */ /* benchmark */
+
+ printk("XGIfb: SR14=%x DramSzie %x ChannelNum %x\n", reg,
+ xgi_video_info.video_size, ChannelNum);
+ return 0;
}
static void XGIfb_detect_VB(void)
{
- u8 cr32, temp=0;
+ u8 cr32, temp = 0;
xgi_video_info.TV_plug = xgi_video_info.TV_type = 0;
- switch(xgi_video_info.hasVB) {
- case HASVB_LVDS_CHRONTEL:
- case HASVB_CHRONTEL:
- break;
- case HASVB_301:
- case HASVB_302:
-// XGI_Sense30x(); //Yi-Lin TV Sense?
- break;
+ switch (xgi_video_info.hasVB) {
+ case HASVB_LVDS_CHRONTEL:
+ case HASVB_CHRONTEL:
+ break;
+ case HASVB_301:
+ case HASVB_302:
+ /* XGI_Sense30x(); */ /* Yi-Lin TV Sense? */
+ break;
}
inXGIIDXREG(XGICR, IND_XGI_SCRATCH_REG_CR32, cr32);
@@ -1858,45 +1882,47 @@ static void XGIfb_detect_VB(void)
else
xgi_video_info.disp_state = 0;
- if(XGIfb_tvplug != -1)
+ if (XGIfb_tvplug != -1)
/* PR/TW: Override with option */
- xgi_video_info.TV_plug = XGIfb_tvplug;
+ xgi_video_info.TV_plug = XGIfb_tvplug;
else if (cr32 & XGI_VB_HIVISION) {
xgi_video_info.TV_type = TVMODE_HIVISION;
xgi_video_info.TV_plug = TVPLUG_SVIDEO;
- }
- else if (cr32 & XGI_VB_SVIDEO)
+ } else if (cr32 & XGI_VB_SVIDEO)
xgi_video_info.TV_plug = TVPLUG_SVIDEO;
else if (cr32 & XGI_VB_COMPOSITE)
xgi_video_info.TV_plug = TVPLUG_COMPOSITE;
else if (cr32 & XGI_VB_SCART)
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)) {
+ 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;
+ inXGIIDXREG(XGICR, 0x38, temp);
+ if (temp & 0x10)
+ xgi_video_info.TV_type = TVMODE_PAL;
+ else
+ xgi_video_info.TV_type = TVMODE_NTSC;
- } else {
+ } 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, 0x79, temp);
+ if (temp & 0x20)
+ 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 */
- if (XGIfb_forcecrt1 != -1) {
- if (XGIfb_forcecrt1) XGIfb_crt1off = 0;
- else XGIfb_crt1off = 1;
- }
+ if (XGIfb_forcecrt1 != -1) {
+ if (XGIfb_forcecrt1)
+ XGIfb_crt1off = 0;
+ else
+ XGIfb_crt1off = 1;
+ }
}
static void XGIfb_get_VB_type(void)
@@ -1904,202 +1930,211 @@ static void XGIfb_get_VB_type(void)
u8 reg;
if (!XGIfb_has_VB()) {
- inXGIIDXREG(XGICR, IND_XGI_SCRATCH_REG_CR37, reg);
+ inXGIIDXREG(XGICR, IND_XGI_SCRATCH_REG_CR37, reg);
switch ((reg & XGI_EXTERNAL_CHIP_MASK) >> 1) {
- case XGI310_EXTERNAL_CHIP_LVDS:
+ case XGI310_EXTERNAL_CHIP_LVDS:
xgi_video_info.hasVB = HASVB_LVDS;
break;
- case XGI310_EXTERNAL_CHIP_LVDS_CHRONTEL:
+ case XGI310_EXTERNAL_CHIP_LVDS_CHRONTEL:
xgi_video_info.hasVB = HASVB_LVDS_CHRONTEL;
break;
- default:
+ default:
break;
}
}
}
-
static int XGIfb_has_VB(void)
{
u8 vb_chipid;
inXGIIDXREG(XGIPART4, 0x00, vb_chipid);
switch (vb_chipid) {
- case 0x01:
+ case 0x01:
xgi_video_info.hasVB = HASVB_301;
break;
- case 0x02:
+ case 0x02:
xgi_video_info.hasVB = HASVB_302;
break;
- default:
+ default:
xgi_video_info.hasVB = HASVB_NONE;
return 0;
}
return 1;
}
-
-
/* ------------------ Sensing routines ------------------ */
/* TW: Determine and detect attached devices on XGI30x */
-int
-XGIDoSense(int tempbl, int tempbh, int tempcl, int tempch)
+int XGIDoSense(int tempbl, int tempbh, int tempcl, int tempch)
{
- int temp,i;
-
- outXGIIDXREG(XGIPART4,0x11,tempbl);
- temp = tempbh | tempcl;
- setXGIIDXREG(XGIPART4,0x10,0xe0,temp);
- for(i=0; i<10; i++) XGI_LongWait(&XGI_Pr);
- tempch &= 0x7f;
- inXGIIDXREG(XGIPART4,0x03,temp);
- temp ^= 0x0e;
- temp &= tempch;
- return(temp);
+ int temp, i;
+
+ outXGIIDXREG(XGIPART4, 0x11, tempbl);
+ temp = tempbh | tempcl;
+ setXGIIDXREG(XGIPART4, 0x10, 0xe0, temp);
+ for (i = 0; i < 10; i++)
+ XGI_LongWait(&XGI_Pr);
+ tempch &= 0x7f;
+ inXGIIDXREG(XGIPART4, 0x03, temp);
+ temp ^= 0x0e;
+ temp &= tempch;
+ return temp;
}
-void
-XGI_Sense30x(void)
+void XGI_Sense30x(void)
{
- u8 backupP4_0d;
- u8 testsvhs_tempbl, testsvhs_tempbh;
- u8 testsvhs_tempcl, testsvhs_tempch;
- u8 testcvbs_tempbl, testcvbs_tempbh;
- u8 testcvbs_tempcl, testcvbs_tempch;
- u8 testvga2_tempbl, testvga2_tempbh;
- u8 testvga2_tempcl, testvga2_tempch;
- int myflag, result;
-
- inXGIIDXREG(XGIPART4,0x0d,backupP4_0d);
- outXGIIDXREG(XGIPART4,0x0d,(backupP4_0d | 0x04));
-
-
-
- testvga2_tempbh = 0x00; testvga2_tempbl = 0xd1;
- testsvhs_tempbh = 0x00; testsvhs_tempbl = 0xb9;
- testcvbs_tempbh = 0x00; testcvbs_tempbl = 0xb3;
- if((XGIhw_ext.ujVBChipID != VB_CHIP_301) &&
- (XGIhw_ext.ujVBChipID != VB_CHIP_302)) {
- testvga2_tempbh = 0x01; testvga2_tempbl = 0x90;
- testsvhs_tempbh = 0x01; testsvhs_tempbl = 0x6b;
- testcvbs_tempbh = 0x01; testcvbs_tempbl = 0x74;
- if(XGIhw_ext.ujVBChipID == VB_CHIP_301LV ||
- XGIhw_ext.ujVBChipID == VB_CHIP_302LV) {
- testvga2_tempbh = 0x00; testvga2_tempbl = 0x00;
- testsvhs_tempbh = 0x02; testsvhs_tempbl = 0x00;
- testcvbs_tempbh = 0x01; testcvbs_tempbl = 0x00;
- }
- }
- if(XGIhw_ext.ujVBChipID != VB_CHIP_301LV &&
- XGIhw_ext.ujVBChipID != VB_CHIP_302LV) {
- inXGIIDXREG(XGIPART4,0x01,myflag);
- if(myflag & 0x04) {
- testvga2_tempbh = 0x00; testvga2_tempbl = 0xfd;
- testsvhs_tempbh = 0x00; testsvhs_tempbl = 0xdd;
- testcvbs_tempbh = 0x00; testcvbs_tempbl = 0xee;
- }
- }
- if((XGIhw_ext.ujVBChipID == VB_CHIP_301LV) ||
- (XGIhw_ext.ujVBChipID == VB_CHIP_302LV) ) {
- testvga2_tempbh = 0x00; testvga2_tempbl = 0x00;
- testvga2_tempch = 0x00; testvga2_tempcl = 0x00;
- testsvhs_tempch = 0x04; testsvhs_tempcl = 0x08;
- testcvbs_tempch = 0x08; testcvbs_tempcl = 0x08;
+ u8 backupP4_0d;
+ u8 testsvhs_tempbl, testsvhs_tempbh;
+ u8 testsvhs_tempcl, testsvhs_tempch;
+ u8 testcvbs_tempbl, testcvbs_tempbh;
+ u8 testcvbs_tempcl, testcvbs_tempch;
+ u8 testvga2_tempbl, testvga2_tempbh;
+ u8 testvga2_tempcl, testvga2_tempch;
+ int myflag, result;
+
+ inXGIIDXREG(XGIPART4, 0x0d, backupP4_0d);
+ outXGIIDXREG(XGIPART4, 0x0d, (backupP4_0d | 0x04));
+
+ testvga2_tempbh = 0x00;
+ testvga2_tempbl = 0xd1;
+ testsvhs_tempbh = 0x00;
+ testsvhs_tempbl = 0xb9;
+ testcvbs_tempbh = 0x00;
+ testcvbs_tempbl = 0xb3;
+ if ((XGIhw_ext.ujVBChipID != VB_CHIP_301) && (XGIhw_ext.ujVBChipID
+ != VB_CHIP_302)) {
+ testvga2_tempbh = 0x01;
+ testvga2_tempbl = 0x90;
+ testsvhs_tempbh = 0x01;
+ testsvhs_tempbl = 0x6b;
+ testcvbs_tempbh = 0x01;
+ testcvbs_tempbl = 0x74;
+ if (XGIhw_ext.ujVBChipID == VB_CHIP_301LV
+ || XGIhw_ext.ujVBChipID == VB_CHIP_302LV) {
+ testvga2_tempbh = 0x00;
+ testvga2_tempbl = 0x00;
+ testsvhs_tempbh = 0x02;
+ testsvhs_tempbl = 0x00;
+ testcvbs_tempbh = 0x01;
+ testcvbs_tempbl = 0x00;
+ }
+ }
+ if (XGIhw_ext.ujVBChipID != VB_CHIP_301LV && XGIhw_ext.ujVBChipID
+ != VB_CHIP_302LV) {
+ inXGIIDXREG(XGIPART4, 0x01, myflag);
+ if (myflag & 0x04) {
+ testvga2_tempbh = 0x00;
+ testvga2_tempbl = 0xfd;
+ testsvhs_tempbh = 0x00;
+ testsvhs_tempbl = 0xdd;
+ testcvbs_tempbh = 0x00;
+ testcvbs_tempbl = 0xee;
+ }
+ }
+ if ((XGIhw_ext.ujVBChipID == VB_CHIP_301LV) || (XGIhw_ext.ujVBChipID
+ == VB_CHIP_302LV)) {
+ testvga2_tempbh = 0x00;
+ testvga2_tempbl = 0x00;
+ testvga2_tempch = 0x00;
+ testvga2_tempcl = 0x00;
+ testsvhs_tempch = 0x04;
+ testsvhs_tempcl = 0x08;
+ testcvbs_tempch = 0x08;
+ testcvbs_tempcl = 0x08;
} else {
- testvga2_tempch = 0x0e; testvga2_tempcl = 0x08;
- testsvhs_tempch = 0x06; testsvhs_tempcl = 0x04;
- testcvbs_tempch = 0x08; testcvbs_tempcl = 0x04;
- }
-
-
- if(testvga2_tempch || testvga2_tempcl || testvga2_tempbh || testvga2_tempbl) {
- result = XGIDoSense(testvga2_tempbl, testvga2_tempbh,
- testvga2_tempcl, testvga2_tempch);
- if(result) {
- printk(KERN_INFO "XGIfb: Detected secondary VGA connection\n");
- orXGIIDXREG(XGICR, 0x32, 0x10);
- }
- }
-
- result = XGIDoSense(testsvhs_tempbl, testsvhs_tempbh,
- testsvhs_tempcl, testsvhs_tempch);
- if(result) {
- printk(KERN_INFO "XGIfb: Detected TV connected to SVHS output\n");
- /* TW: So we can be sure that there IS a SVHS output */
- xgi_video_info.TV_plug = TVPLUG_SVIDEO;
- orXGIIDXREG(XGICR, 0x32, 0x02);
- }
-
- if(!result) {
- result = XGIDoSense(testcvbs_tempbl, testcvbs_tempbh,
- testcvbs_tempcl, testcvbs_tempch);
- if(result) {
- printk(KERN_INFO "XGIfb: Detected TV connected to CVBS output\n");
- /* TW: So we can be sure that there IS a CVBS output */
- xgi_video_info.TV_plug = TVPLUG_COMPOSITE;
- orXGIIDXREG(XGICR, 0x32, 0x01);
- }
- }
- XGIDoSense(0, 0, 0, 0);
-
- outXGIIDXREG(XGIPART4,0x0d,backupP4_0d);
-}
+ testvga2_tempch = 0x0e;
+ testvga2_tempcl = 0x08;
+ testsvhs_tempch = 0x06;
+ testsvhs_tempcl = 0x04;
+ testcvbs_tempch = 0x08;
+ testcvbs_tempcl = 0x04;
+ }
+
+ if (testvga2_tempch || testvga2_tempcl || testvga2_tempbh
+ || testvga2_tempbl) {
+ result = XGIDoSense(testvga2_tempbl, testvga2_tempbh,
+ testvga2_tempcl, testvga2_tempch);
+ if (result) {
+ printk(KERN_INFO "XGIfb: Detected secondary VGA connection\n");
+ orXGIIDXREG(XGICR, 0x32, 0x10);
+ }
+ }
+ result = XGIDoSense(testsvhs_tempbl, testsvhs_tempbh, testsvhs_tempcl,
+ testsvhs_tempch);
+ if (result) {
+ printk(KERN_INFO "XGIfb: Detected TV connected to SVHS output\n");
+ /* TW: So we can be sure that there IS a SVHS output */
+ xgi_video_info.TV_plug = TVPLUG_SVIDEO;
+ orXGIIDXREG(XGICR, 0x32, 0x02);
+ }
+ if (!result) {
+ result = XGIDoSense(testcvbs_tempbl, testcvbs_tempbh,
+ testcvbs_tempcl, testcvbs_tempch);
+ if (result) {
+ printk(KERN_INFO "XGIfb: Detected TV connected to CVBS output\n");
+ /* TW: So we can be sure that there IS a CVBS output */
+ xgi_video_info.TV_plug = TVPLUG_COMPOSITE;
+ orXGIIDXREG(XGICR, 0x32, 0x01);
+ }
+ }
+ XGIDoSense(0, 0, 0, 0);
+
+ 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 = 0;
- unsigned long *read_port = 0;
- unsigned long *write_port = 0;
- XGI_CMDTYPE cmd_type;
+ 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;
+ 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;
+ /* 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 = 0x400000;
+ xgi_video_info.heapstart = XGIfb_mem * 1024;
}
- } 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_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;
+ 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.
+ /* 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
@@ -2129,25 +2164,28 @@ static int XGIfb_heap_init(void)
* 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);
+ */
+ 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;
+ agp_size = COMMAND_QUEUE_AREA_SIZE;
#ifndef AGPOFF
if (XGIfb_queuemode == AGP_CMD_QUEUE) {
agp_info = vmalloc(sizeof(*agp_info));
- memset((void*)agp_info, 0x00, sizeof(*agp_info));
+ memset((void *)agp_info, 0x00, sizeof(*agp_info));
agp_copy_info(agp_info);
agp_backend_acquire();
- agp = agp_allocate_memory(COMMAND_QUEUE_AREA_SIZE/PAGE_SIZE,
- AGP_NORMAL_MEMORY);
+ 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;
@@ -2170,8 +2208,8 @@ static int XGIfb_heap_init(void)
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) {
+ /* } 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 {
@@ -2180,32 +2218,32 @@ static int XGIfb_heap_init(void)
}
switch (agp_size) {
- case 0x80000:
+ case 0x80000:
temp = XGI_CMD_QUEUE_SIZE_512k;
break;
- case 0x100000:
+ case 0x100000:
temp = XGI_CMD_QUEUE_SIZE_1M;
break;
- case 0x200000:
+ case 0x200000:
temp = XGI_CMD_QUEUE_SIZE_2M;
break;
- case 0x400000:
+ case 0x400000:
temp = XGI_CMD_QUEUE_SIZE_4M;
break;
}
switch (cmd_type) {
- case AGP_CMD_QUEUE:
+ 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(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_THRESHOLD, COMMAND_QUEUE_THRESHOLD);
outXGIIDXREG(XGISR, IND_XGI_CMDQUEUE_SET, XGI_CMD_QUEUE_RESET);
@@ -2220,7 +2258,7 @@ static int XGIfb_heap_init(void)
#endif
break;
- case VM_CMD_QUEUE:
+ case VM_CMD_QUEUE:
XGIfb_heap_end -= COMMAND_QUEUE_AREA_SIZE;
XGIfb_heap_size -= COMMAND_QUEUE_AREA_SIZE;
@@ -2241,40 +2279,37 @@ static int XGIfb_heap_init(void)
*cmdq_baseport, COMMAND_QUEUE_AREA_SIZE/1024);
break;
- default: /* MMIO */
+ default: /* MMIO */
-// printk("%s:%d - I'm here\n", __FUNCTION__, __LINE__);
- /* TW: This previously only wrote XGI_MMIO_CMD_ENABLE
+ /* 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 // 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;
- }
-
-
-
+ /* 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) {
+ /* 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;
@@ -2282,55 +2317,58 @@ static int XGIfb_heap_init(void)
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_end, XGIfb_hwcursor_size/1024);
+ }
- XGIfb_heap.poha_chain = NULL;
- XGIfb_heap.poh_freelist = NULL;
+ XGIfb_heap.poha_chain = NULL;
+ XGIfb_heap.poh_freelist = NULL;
- poh = XGIfb_poh_new_node();
+ poh = XGIfb_poh_new_node();
- if(poh == NULL) return 1;
+ 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;
+ 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",
+ 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",
+ 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_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;
+ 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;
+ return 0;
}
static XGI_OH *XGIfb_poh_new_node(void)
{
- int i;
+ int i;
unsigned long cOhs;
- XGI_OHALLOC *poha;
- XGI_OH *poh;
+ XGI_OHALLOC *poha;
+ XGI_OH *poh;
if (XGIfb_heap.poh_freelist == NULL) {
poha = kmalloc(OH_ALLOC_SIZE, GFP_KERNEL);
- if(!poha) return NULL;
+ 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;
+ cOhs = (OH_ALLOC_SIZE - sizeof(XGI_OHALLOC)) / sizeof(XGI_OH)
+ + 1;
poh = &poha->aoh[0];
for (i = cOhs - 1; i != 0; i--) {
@@ -2345,19 +2383,19 @@ static XGI_OH *XGIfb_poh_new_node(void)
poh = XGIfb_heap.poh_freelist;
XGIfb_heap.poh_freelist = poh->poh_next;
- return (poh);
+ return poh;
}
static XGI_OH *XGIfb_poh_allocate(unsigned long size)
{
XGI_OH *pohThis;
XGI_OH *pohRoot;
- int bAllocated = 0;
+ 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);
+ (unsigned int) size / 1024);
+ return NULL;
}
pohThis = XGIfb_heap.oh_free.poh_next;
@@ -2372,8 +2410,8 @@ static XGI_OH *XGIfb_poh_allocate(unsigned long size)
if (!bAllocated) {
DPRINTK("XGIfb: Can't allocate %dk size on offscreen\n",
- (unsigned int) size / 1024);
- return (NULL);
+ (unsigned int) size / 1024);
+ return NULL;
}
if (size == pohThis->size) {
@@ -2382,9 +2420,8 @@ static XGI_OH *XGIfb_poh_allocate(unsigned long size)
} else {
pohRoot = XGIfb_poh_new_node();
- if (pohRoot == NULL) {
- return (NULL);
- }
+ if (pohRoot == NULL)
+ return NULL;
pohRoot->offset = pohThis->offset;
pohRoot->size = size;
@@ -2398,7 +2435,7 @@ static XGI_OH *XGIfb_poh_allocate(unsigned long size)
pohThis = &XGIfb_heap.oh_used;
XGIfb_insert_node(pohThis, pohRoot);
- return (pohRoot);
+ return pohRoot;
}
static void XGIfb_delete_node(XGI_OH *poh)
@@ -2439,8 +2476,8 @@ static XGI_OH *XGIfb_poh_free(unsigned long base)
poh_freed = XGIfb_heap.oh_used.poh_next;
- while(poh_freed != &XGIfb_heap.oh_used) {
- if(poh_freed->offset == base) {
+ while (poh_freed != &XGIfb_heap.oh_used) {
+ if (poh_freed->offset == base) {
foundNode = 1;
break;
}
@@ -2448,7 +2485,8 @@ static XGI_OH *XGIfb_poh_free(unsigned long base)
poh_freed = poh_freed->poh_next;
}
- if (!foundNode) return (NULL);
+ if (!foundNode)
+ return NULL;
XGIfb_heap.max_freesize += poh_freed->size;
@@ -2459,13 +2497,11 @@ static XGI_OH *XGIfb_poh_free(unsigned long base)
pohThis = XGIfb_heap.oh_free.poh_next;
while (pohThis != &XGIfb_heap.oh_free) {
- if (pohThis->offset == ulUpper) {
+ if (pohThis->offset == ulUpper)
poh_next = pohThis;
- }
- else if ((pohThis->offset + pohThis->size) ==
- ulLower) {
+ else if ((pohThis->offset + pohThis->size) == ulLower)
poh_prev = pohThis;
- }
+
pohThis = pohThis->poh_next;
}
@@ -2476,30 +2512,31 @@ static XGI_OH *XGIfb_poh_free(unsigned long base)
XGIfb_delete_node(poh_next);
XGIfb_free_node(poh_freed);
XGIfb_free_node(poh_next);
- return (poh_prev);
+ return poh_prev;
}
if (poh_prev) {
poh_prev->size += poh_freed->size;
XGIfb_free_node(poh_freed);
- return (poh_prev);
+ 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);
+ return poh_next;
}
XGIfb_insert_node(&XGIfb_heap.oh_free, poh_freed);
- return (poh_freed);
+ return poh_freed;
}
static void XGIfb_free_node(XGI_OH *poh)
{
- if(poh == NULL) return;
+ if (poh == NULL)
+ return;
poh->poh_next = XGIfb_heap.poh_freelist;
XGIfb_heap.poh_freelist = poh;
@@ -2512,13 +2549,13 @@ void XGI_malloc(struct XGI_memreq *req)
poh = XGIfb_poh_allocate(req->size);
- if(poh == NULL) {
+ 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));
+ (char *) (poh->offset + (unsigned long) xgi_video_info.video_vbase));
req->offset = poh->offset;
req->size = poh->size;
@@ -2532,9 +2569,9 @@ void XGI_free(unsigned long base)
poh = XGIfb_poh_free(base);
- if(poh == NULL) {
+ if (poh == NULL) {
DPRINTK("XGIfb: XGIfb_poh_free() failed at base 0x%x\n",
- (unsigned int) base);
+ (unsigned int) base);
}
}
@@ -2548,41 +2585,45 @@ static void XGIfb_pre_setmode(void)
cr31 &= ~0x60;
switch (xgi_video_info.disp_state & DISPTYPE_DISP2) {
- case DISPTYPE_CRT2:
+ case DISPTYPE_CRT2:
cr30 = (XGI_VB_OUTPUT_CRT2 | XGI_SIMULTANEOUS_VIEW_ENABLE);
cr31 |= XGI_DRIVER_MODE;
break;
- case DISPTYPE_LCD:
- cr30 = (XGI_VB_OUTPUT_LCD | XGI_SIMULTANEOUS_VIEW_ENABLE);
+ case DISPTYPE_LCD:
+ cr30 = (XGI_VB_OUTPUT_LCD | XGI_SIMULTANEOUS_VIEW_ENABLE);
cr31 |= XGI_DRIVER_MODE;
break;
- case DISPTYPE_TV:
+ case DISPTYPE_TV:
if (xgi_video_info.TV_type == TVMODE_HIVISION)
- cr30 = (XGI_VB_OUTPUT_HIVISION | XGI_SIMULTANEOUS_VIEW_ENABLE);
+ cr30 = (XGI_VB_OUTPUT_HIVISION
+ | XGI_SIMULTANEOUS_VIEW_ENABLE);
else if (xgi_video_info.TV_plug == TVPLUG_SVIDEO)
- cr30 = (XGI_VB_OUTPUT_SVIDEO | XGI_SIMULTANEOUS_VIEW_ENABLE);
+ cr30 = (XGI_VB_OUTPUT_SVIDEO
+ | XGI_SIMULTANEOUS_VIEW_ENABLE);
else if (xgi_video_info.TV_plug == TVPLUG_COMPOSITE)
- cr30 = (XGI_VB_OUTPUT_COMPOSITE | XGI_SIMULTANEOUS_VIEW_ENABLE);
+ cr30 = (XGI_VB_OUTPUT_COMPOSITE
+ | XGI_SIMULTANEOUS_VIEW_ENABLE);
else if (xgi_video_info.TV_plug == TVPLUG_SCART)
- cr30 = (XGI_VB_OUTPUT_SCART | XGI_SIMULTANEOUS_VIEW_ENABLE);
+ cr30 = (XGI_VB_OUTPUT_SCART
+ | XGI_SIMULTANEOUS_VIEW_ENABLE);
cr31 |= XGI_DRIVER_MODE;
- if (XGIfb_tvmode == 1 || xgi_video_info.TV_type == TVMODE_PAL)
+ if (XGIfb_tvmode == 1 || xgi_video_info.TV_type == TVMODE_PAL)
cr31 |= 0x01;
- else
- cr31 &= ~0x01;
+ else
+ cr31 &= ~0x01;
break;
- default: /* disable CRT2 */
+ default: /* disable CRT2 */
cr30 = 0x00;
cr31 |= (XGI_DRIVER_MODE | XGI_VB_OUTPUT_DISABLE);
}
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();
+ outXGIIDXREG(XGICR, IND_XGI_SCRATCH_REG_CR33, (XGIfb_rate_idx & 0x0F));
+ if (xgi_video_info.accel)
+ XGIfb_syncaccel();
}
@@ -2590,32 +2631,33 @@ static void XGIfb_post_setmode(void)
{
u8 reg;
unsigned char doit = 1;
-/* outXGIIDXREG(XGISR,IND_XGI_PASSWORD,XGI_PASSWORD);
- outXGIIDXREG(XGICR,0x13,0x00);
- setXGIIDXREG(XGISR,0x0E,0xF0,0x01);
-*test**/
+ /*
+ outXGIIDXREG(XGISR,IND_XGI_PASSWORD,XGI_PASSWORD);
+ outXGIIDXREG(XGICR, 0x13, 0x00);
+ setXGIIDXREG(XGISR,0x0E, 0xF0, 0x01);
+ *test*
+ */
if (xgi_video_info.video_bpp == 8) {
/* TW: We can't switch off CRT1 on LVDS/Chrontel in 8bpp Modes */
- if ((xgi_video_info.hasVB == HASVB_LVDS) || (xgi_video_info.hasVB == HASVB_LVDS_CHRONTEL)) {
+ if ((xgi_video_info.hasVB == HASVB_LVDS)
+ || (xgi_video_info.hasVB == HASVB_LVDS_CHRONTEL)) {
doit = 0;
}
/* TW: We can't switch off CRT1 on 301B-DH in 8bpp Modes if using LCD */
- if (xgi_video_info.disp_state & DISPTYPE_LCD) {
+ if (xgi_video_info.disp_state & DISPTYPE_LCD)
doit = 0;
- }
}
/* TW: We can't switch off CRT1 if bridge is in slave mode */
- if(xgi_video_info.hasVB != HASVB_NONE) {
+ if (xgi_video_info.hasVB != HASVB_NONE) {
inXGIIDXREG(XGIPART1, 0x00, reg);
-
if ((reg & 0x50) == 0x10)
doit = 0;
-
- } else
+ } else {
XGIfb_crt1off = 0;
+ }
inXGIIDXREG(XGICR, 0x17, reg);
if ((XGIfb_crt1off) && (doit))
@@ -2624,139 +2666,152 @@ static void XGIfb_post_setmode(void)
reg |= 0x80;
outXGIIDXREG(XGICR, 0x17, reg);
- andXGIIDXREG(XGISR, IND_XGI_RAMDAC_CONTROL, ~0x04);
-
- if((xgi_video_info.disp_state & DISPTYPE_TV) && (xgi_video_info.hasVB == HASVB_301)) {
-
- inXGIIDXREG(XGIPART4, 0x01, reg);
-
- if(reg < 0xB0) { /* Set filter for XGI301 */
-
- switch (xgi_video_info.video_width) {
- case 320:
- filter_tb = (xgi_video_info.TV_type == TVMODE_NTSC) ? 4 : 12;
- break;
- case 640:
- filter_tb = (xgi_video_info.TV_type == TVMODE_NTSC) ? 5 : 13;
- break;
- case 720:
- filter_tb = (xgi_video_info.TV_type == TVMODE_NTSC) ? 6 : 14;
- break;
- case 800:
- filter_tb = (xgi_video_info.TV_type == TVMODE_NTSC) ? 7 : 15;
- break;
- default:
- filter = -1;
- break;
- }
-
- orXGIIDXREG(XGIPART1, XGIfb_CRT2_write_enable, 0x01);
-
- if(xgi_video_info.TV_type == TVMODE_NTSC) {
+ andXGIIDXREG(XGISR, IND_XGI_RAMDAC_CONTROL, ~0x04);
- andXGIIDXREG(XGIPART2, 0x3a, 0x1f);
+ if ((xgi_video_info.disp_state & DISPTYPE_TV) && (xgi_video_info.hasVB
+ == HASVB_301)) {
- if (xgi_video_info.TV_plug == TVPLUG_SVIDEO) {
+ inXGIIDXREG(XGIPART4, 0x01, reg);
- andXGIIDXREG(XGIPART2, 0x30, 0xdf);
+ if (reg < 0xB0) { /* Set filter for XGI301 */
- } else if (xgi_video_info.TV_plug == TVPLUG_COMPOSITE) {
+ switch (xgi_video_info.video_width) {
+ case 320:
+ filter_tb = (xgi_video_info.TV_type == TVMODE_NTSC) ? 4 : 12;
+ break;
+ case 640:
+ filter_tb = (xgi_video_info.TV_type == TVMODE_NTSC) ? 5 : 13;
+ break;
+ case 720:
+ filter_tb = (xgi_video_info.TV_type == TVMODE_NTSC) ? 6 : 14;
+ break;
+ case 800:
+ filter_tb = (xgi_video_info.TV_type == TVMODE_NTSC) ? 7 : 15;
+ break;
+ default:
+ filter = -1;
+ break;
+ }
- orXGIIDXREG(XGIPART2, 0x30, 0x20);
+ orXGIIDXREG(XGIPART1, XGIfb_CRT2_write_enable, 0x01);
+
+ if (xgi_video_info.TV_type == TVMODE_NTSC) {
+
+ andXGIIDXREG(XGIPART2, 0x3a, 0x1f);
+
+ if (xgi_video_info.TV_plug == TVPLUG_SVIDEO) {
+
+ andXGIIDXREG(XGIPART2, 0x30, 0xdf);
+
+ } else if (xgi_video_info.TV_plug
+ == TVPLUG_COMPOSITE) {
+
+ orXGIIDXREG(XGIPART2, 0x30, 0x20);
+
+ switch (xgi_video_info.video_width) {
+ case 640:
+ outXGIIDXREG(XGIPART2, 0x35, 0xEB);
+ outXGIIDXREG(XGIPART2, 0x36, 0x04);
+ outXGIIDXREG(XGIPART2, 0x37, 0x25);
+ outXGIIDXREG(XGIPART2, 0x38, 0x18);
+ break;
+ case 720:
+ outXGIIDXREG(XGIPART2, 0x35, 0xEE);
+ outXGIIDXREG(XGIPART2, 0x36, 0x0C);
+ outXGIIDXREG(XGIPART2, 0x37, 0x22);
+ outXGIIDXREG(XGIPART2, 0x38, 0x08);
+ break;
+ case 800:
+ outXGIIDXREG(XGIPART2, 0x35, 0xEB);
+ outXGIIDXREG(XGIPART2, 0x36, 0x15);
+ outXGIIDXREG(XGIPART2, 0x37, 0x25);
+ outXGIIDXREG(XGIPART2, 0x38, 0xF6);
+ break;
+ }
+ }
- switch (xgi_video_info.video_width) {
- case 640:
- outXGIIDXREG(XGIPART2, 0x35, 0xEB);
- outXGIIDXREG(XGIPART2, 0x36, 0x04);
- outXGIIDXREG(XGIPART2, 0x37, 0x25);
- outXGIIDXREG(XGIPART2, 0x38, 0x18);
- break;
- case 720:
- outXGIIDXREG(XGIPART2, 0x35, 0xEE);
- outXGIIDXREG(XGIPART2, 0x36, 0x0C);
- outXGIIDXREG(XGIPART2, 0x37, 0x22);
- outXGIIDXREG(XGIPART2, 0x38, 0x08);
- break;
- case 800:
- outXGIIDXREG(XGIPART2, 0x35, 0xEB);
- outXGIIDXREG(XGIPART2, 0x36, 0x15);
- outXGIIDXREG(XGIPART2, 0x37, 0x25);
- outXGIIDXREG(XGIPART2, 0x38, 0xF6);
- break;
+ } else if (xgi_video_info.TV_type == TVMODE_PAL) {
+
+ andXGIIDXREG(XGIPART2, 0x3A, 0x1F);
+
+ if (xgi_video_info.TV_plug == TVPLUG_SVIDEO) {
+
+ andXGIIDXREG(XGIPART2, 0x30, 0xDF);
+
+ } else if (xgi_video_info.TV_plug
+ == TVPLUG_COMPOSITE) {
+
+ orXGIIDXREG(XGIPART2, 0x30, 0x20);
+
+ switch (xgi_video_info.video_width) {
+ case 640:
+ outXGIIDXREG(XGIPART2, 0x35, 0xF1);
+ outXGIIDXREG(XGIPART2, 0x36, 0xF7);
+ outXGIIDXREG(XGIPART2, 0x37, 0x1F);
+ outXGIIDXREG(XGIPART2, 0x38, 0x32);
+ break;
+ case 720:
+ outXGIIDXREG(XGIPART2, 0x35, 0xF3);
+ outXGIIDXREG(XGIPART2, 0x36, 0x00);
+ outXGIIDXREG(XGIPART2, 0x37, 0x1D);
+ outXGIIDXREG(XGIPART2, 0x38, 0x20);
+ break;
+ case 800:
+ outXGIIDXREG(XGIPART2, 0x35, 0xFC);
+ outXGIIDXREG(XGIPART2, 0x36, 0xFB);
+ outXGIIDXREG(XGIPART2, 0x37, 0x14);
+ outXGIIDXREG(XGIPART2, 0x38, 0x2A);
+ break;
+ }
}
}
- } else if(xgi_video_info.TV_type == TVMODE_PAL) {
-
- andXGIIDXREG(XGIPART2, 0x3A, 0x1F);
-
- if (xgi_video_info.TV_plug == TVPLUG_SVIDEO) {
-
- andXGIIDXREG(XGIPART2, 0x30, 0xDF);
-
- } else if (xgi_video_info.TV_plug == TVPLUG_COMPOSITE) {
-
- orXGIIDXREG(XGIPART2, 0x30, 0x20);
-
- switch (xgi_video_info.video_width) {
- case 640:
- outXGIIDXREG(XGIPART2, 0x35, 0xF1);
- outXGIIDXREG(XGIPART2, 0x36, 0xF7);
- outXGIIDXREG(XGIPART2, 0x37, 0x1F);
- outXGIIDXREG(XGIPART2, 0x38, 0x32);
- break;
- case 720:
- outXGIIDXREG(XGIPART2, 0x35, 0xF3);
- outXGIIDXREG(XGIPART2, 0x36, 0x00);
- outXGIIDXREG(XGIPART2, 0x37, 0x1D);
- outXGIIDXREG(XGIPART2, 0x38, 0x20);
- break;
- case 800:
- outXGIIDXREG(XGIPART2, 0x35, 0xFC);
- outXGIIDXREG(XGIPART2, 0x36, 0xFB);
- outXGIIDXREG(XGIPART2, 0x37, 0x14);
- outXGIIDXREG(XGIPART2, 0x38, 0x2A);
- break;
- }
+ if ((filter >= 0) && (filter <= 7)) {
+ DPRINTK("FilterTable[%d]-%d: %02x %02x %02x %02x\n", filter_tb, filter,
+ XGI_TV_filter[filter_tb].filter[filter][0],
+ XGI_TV_filter[filter_tb].filter[filter][1],
+ XGI_TV_filter[filter_tb].filter[filter][2],
+ XGI_TV_filter[filter_tb].filter[filter][3]
+ );
+ outXGIIDXREG(
+ XGIPART2,
+ 0x35,
+ (XGI_TV_filter[filter_tb].filter[filter][0]));
+ outXGIIDXREG(
+ XGIPART2,
+ 0x36,
+ (XGI_TV_filter[filter_tb].filter[filter][1]));
+ outXGIIDXREG(
+ XGIPART2,
+ 0x37,
+ (XGI_TV_filter[filter_tb].filter[filter][2]));
+ outXGIIDXREG(
+ XGIPART2,
+ 0x38,
+ (XGI_TV_filter[filter_tb].filter[filter][3]));
}
- }
- if ((filter >= 0) && (filter <=7)) {
- DPRINTK("FilterTable[%d]-%d: %02x %02x %02x %02x\n", filter_tb, filter,
- XGI_TV_filter[filter_tb].filter[filter][0],
- XGI_TV_filter[filter_tb].filter[filter][1],
- XGI_TV_filter[filter_tb].filter[filter][2],
- XGI_TV_filter[filter_tb].filter[filter][3]
- );
- outXGIIDXREG(XGIPART2, 0x35, (XGI_TV_filter[filter_tb].filter[filter][0]));
- outXGIIDXREG(XGIPART2, 0x36, (XGI_TV_filter[filter_tb].filter[filter][1]));
- outXGIIDXREG(XGIPART2, 0x37, (XGI_TV_filter[filter_tb].filter[filter][2]));
- outXGIIDXREG(XGIPART2, 0x38, (XGI_TV_filter[filter_tb].filter[filter][3]));
}
- }
-
}
}
-#ifndef MODULE
XGIINITSTATIC int __init XGIfb_setup(char *options)
{
char *this_opt;
-
-
xgi_video_info.refresh_rate = 0;
- printk(KERN_INFO "XGIfb: Options %s\n", options);
+ printk(KERN_INFO "XGIfb: Options %s\n", options);
if (!options || !*options)
return 0;
- while((this_opt = strsep(&options, ",")) != NULL) {
+ while ((this_opt = strsep(&options, ",")) != NULL) {
- if (!*this_opt) continue;
+ if (!*this_opt)
+ continue;
if (!strncmp(this_opt, "mode:", 5)) {
XGIfb_search_mode(this_opt + 5);
@@ -2780,414 +2835,384 @@ XGIINITSTATIC int __init XGIfb_setup(char *options)
XGIfb_search_crt2type(this_opt + 14);
} else if (!strncmp(this_opt, "forcecrt1:", 10)) {
XGIfb_forcecrt1 = (int)simple_strtoul(this_opt + 10, NULL, 0);
- } else if (!strncmp(this_opt, "tvmode:",7)) {
- XGIfb_search_tvstd(this_opt + 7);
- } else if (!strncmp(this_opt, "tvstandard:",11)) {
+ } else if (!strncmp(this_opt, "tvmode:", 7)) {
+ 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)) {
+ } 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;
- }
+ 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;
+ XGIfb_ypan = 0;
} else if (!strncmp(this_opt, "userom:", 7)) {
XGIfb_userom = (int)simple_strtoul(this_opt + 7, NULL, 0);
-// } else if (!strncmp(this_opt, "useoem:", 7)) {
-// XGIfb_useoem = (int)simple_strtoul(this_opt + 7, NULL, 0);
+ /* } else if (!strncmp(this_opt, "useoem:", 7)) { */
+ /* XGIfb_useoem = (int)simple_strtoul(this_opt + 7, NULL, 0); */
} else {
XGIfb_search_mode(this_opt);
-// printk(KERN_INFO "XGIfb: Invalid option %s\n", this_opt);
+ /* printk(KERN_INFO "XGIfb: Invalid option %s\n", this_opt); */
}
/* TW: Acceleration only with MMIO mode */
- if((XGIfb_queuemode != -1) && (XGIfb_queuemode != MMIO_CMD)) {
+ 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;
+ if (XGIfb_accel == 0)
+ XGIfb_ypan = 0;
}
printk("\nxgifb: outa xgifb_setup 3450");
return 0;
}
-#endif
static unsigned char VBIOS_BUF[65535];
-unsigned char *attempt_map_rom(struct pci_dev *dev, void *copy_address)
+static unsigned char *attempt_map_rom(struct pci_dev *dev, void *copy_address)
{
- 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)
- {
+ 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;
- }
+ }
- rom_size &= 0xFFFFF800;
- rom_size = (~rom_size)+1;
+ 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"); return NULL;
- }
+ rom_address = pci_resource_start(dev, 0);
+ if (rom_address == 0 || rom_address == 0xFFFFFFF0) {
+ printk("No suitable rom address found\n");
+ return NULL;
+ }
- printk("ROM Size is %dK, Address is %x\n", rom_size/1024, rom_address);
+ printk("ROM Size is %dK, Address is %x\n", rom_size / 1024, rom_address);
- /* Map ROM */
- pci_write_config_dword(dev, PCI_ROM_ADDRESS, rom_address | PCI_ROM_ADDRESS_ENABLE);
+ /* Map ROM */
+ pci_write_config_dword(dev, PCI_ROM_ADDRESS, rom_address
+ | PCI_ROM_ADDRESS_ENABLE);
- /* memcpy(copy_address, 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++;
+ 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");
+ printk("Copy is done\n");
return copy_address;
}
-int __devinit xgifb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
+static int __devinit xgifb_probe(struct pci_dev *pdev,
+ const struct pci_device_id *ent)
{
u16 reg16;
- u8 reg, reg1;
- u8 CR48,CR38;
+ u8 reg, reg1;
+ u8 CR48, CR38;
if (XGIfb_off)
return -ENXIO;
XGIfb_registered = 0;
memset(&XGIhw_ext, 0, sizeof(struct xgi_hw_device_info));
- fb_info = framebuffer_alloc(sizeof(struct fb_info), &pdev->dev);
- if(!fb_info) return -ENOMEM;
-
- 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);
- xgi_video_info.pcifunc = PCI_FUNC(pdev->devfn);
- xgi_video_info.subsysvendor = pdev->subsystem_vendor;
- xgi_video_info.subsysdevice = pdev->subsystem_device;
-
- 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.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;
-
- XGIRegInit(&XGI_Pr, (unsigned long)XGIhw_ext.pjIOAddress);
-
- outXGIIDXREG(XGISR, IND_XGI_PASSWORD, XGI_PASSWORD);
- inXGIIDXREG(XGISR, IND_XGI_PASSWORD, reg1);
-
- if(reg1 != 0xa1) /*I/O error */
- {
- printk("\nXGIfb: I/O error!!!");
- return -EIO;
- }
+ fb_info = framebuffer_alloc(sizeof(struct fb_info), &pdev->dev);
+ if (!fb_info)
+ return -ENOMEM;
+
+ 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);
+ xgi_video_info.pcifunc = PCI_FUNC(pdev->devfn);
+ xgi_video_info.subsysvendor = pdev->subsystem_vendor;
+ xgi_video_info.subsysdevice = pdev->subsystem_device;
+
+ 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.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;
+
+ XGIRegInit(&XGI_Pr, (unsigned long)XGIhw_ext.pjIOAddress);
+
+ outXGIIDXREG(XGISR, IND_XGI_PASSWORD, XGI_PASSWORD);
+ inXGIIDXREG(XGISR, IND_XGI_PASSWORD, reg1);
+
+ if (reg1 != 0xa1) { /*I/O error */
+ printk("\nXGIfb: I/O error!!!");
+ return -EIO;
+ }
switch (xgi_video_info.chip_id) {
- case PCI_DEVICE_ID_XG_20:
+ case PCI_DEVICE_ID_XG_20:
orXGIIDXREG(XGICR, Index_CR_GPIO_Reg3, GPIOG_EN);
inXGIIDXREG(XGICR, Index_CR_GPIO_Reg1, CR48);
if (CR48&GPIOG_READ)
xgi_video_info.chip = XG21;
else
- xgi_video_info.chip = XG20;
+ 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:
+ 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:
+ 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:
+ 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:
+ 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;
+ default:
+ return -ENODEV;
}
- 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;
- }
+ 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.pDevice = NULL;
+ if ((xgi_video_info.chip == XG21) || (XGIfb_userom)) {
+ XGIhw_ext.pjVirtualRomBase = attempt_map_rom(pdev, VBIOS_BUF);
- if(XGIhw_ext.pjVirtualRomBase)
- printk(KERN_INFO "XGIfb: Video ROM found and mapped to %p\n",XGIhw_ext.pjVirtualRomBase);
+ if (XGIhw_ext.pjVirtualRomBase)
+ printk(KERN_INFO "XGIfb: Video ROM found and mapped to %p\n", XGIhw_ext.pjVirtualRomBase);
else
printk(KERN_INFO "XGIfb: Video ROM not found\n");
- } else {
- XGIhw_ext.pjVirtualRomBase = NULL;
+ } else {
+ 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.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.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
- 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;
+ 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);
- 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
+ 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;
+ }
- outXGIIDXREG(XGISR, IND_XGI_PASSWORD, XGI_PASSWORD);
+ if ((xgifb_mode_idx < 0) || ((XGIbios_mode[xgifb_mode_idx].mode_no) != 0xFF)) {
+ /* Enable PCI_LINEAR_ADDRESSING and MMIO_ENABLE */
+ orXGIIDXREG(XGISR, IND_XGI_PCI_ADDRESS_SET, (XGI_PCI_ADDR_ENABLE | XGI_MEM_MAP_IO_ENABLE));
+ /* Enable 2D accelerator engine */
+ orXGIIDXREG(XGISR, IND_XGI_MODULE_ENABLE, XGI_ENABLE_2D);
+ }
+ XGIhw_ext.ulVideoMemorySize = xgi_video_info.video_size;
- }
+ if (!request_mem_region(xgi_video_info.video_base, xgi_video_info.video_size, "XGIfb FB")) {
+ 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;
}
-#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);
+ if (!request_mem_region(xgi_video_info.mmio_base, XGIfb_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;
+ }
- // yilin Because no VBIOS DRAM Sizing, Dram size will error.
- // Set SR13 ,14 temporarily for UDtech
- outXGIIDXREG(XGISR, 0x13, 0x45);
- outXGIIDXREG(XGISR, 0x14, 0x51);
+ 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);
+ 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);
- }
- }
-#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;
- }
-
-
-
- if((xgifb_mode_idx < 0) || ((XGIbios_mode[xgifb_mode_idx].mode_no) != 0xFF))
- {
- /* Enable PCI_LINEAR_ADDRESSING and MMIO_ENABLE */
- orXGIIDXREG(XGISR, IND_XGI_PCI_ADDRESS_SET, (XGI_PCI_ADDR_ENABLE | XGI_MEM_MAP_IO_ENABLE));
- /* Enable 2D accelerator engine */
- orXGIIDXREG(XGISR, IND_XGI_MODULE_ENABLE, XGI_ENABLE_2D);
- }
-
- XGIhw_ext.ulVideoMemorySize = xgi_video_info.video_size;
-
- if (!request_mem_region(xgi_video_info.video_base, xgi_video_info.video_size, "XGIfb FB"))
- { 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;
- }
-
- if (!request_mem_region(xgi_video_info.mmio_base, XGIfb_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;
- }
-
- 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);
-
- 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);
- printk("XGIfb: XGIInitNew() ...");
- if(XGIInitNew(&XGIhw_ext))
- {
- printk("OK\n");
- }
- else
- {
+ 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);
+ 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))
- {
- xgi_video_info.hasVB = HASVB_NONE;
- if((xgi_video_info.chip == XG20)||(xgi_video_info.chip == XG27))
- xgi_video_info.hasVB = HASVB_NONE;
- else if(xgi_video_info.chip == XG21) {
- inXGIIDXREG(XGICR,0x38,CR38);
- if ((CR38&0xE0) == 0xC0) {
- xgi_video_info.disp_state = DISPTYPE_LCD;
- if (!XGIfb_GetXG21LVDSData()) {
- int m;
- 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) ;
- }
- }
- }
- }
- else if ((CR38&0xE0) == 0x60)
- xgi_video_info.hasVB = HASVB_CHRONTEL ;
- else
+
+ 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)) {
xgi_video_info.hasVB = HASVB_NONE;
- }
- else
- XGIfb_get_VB_type();
+ if ((xgi_video_info.chip == XG20) || (xgi_video_info.chip == XG27)) {
+ xgi_video_info.hasVB = HASVB_NONE;
+ } else if (xgi_video_info.chip == XG21) {
+ inXGIIDXREG(XGICR, 0x38, CR38);
+ if ((CR38&0xE0) == 0xC0) {
+ xgi_video_info.disp_state = DISPTYPE_LCD;
+ if (!XGIfb_GetXG21LVDSData()) {
+ int m;
+ 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);
+ }
+ }
+ }
+ } else if ((CR38&0xE0) == 0x60) {
+ xgi_video_info.hasVB = HASVB_CHRONTEL;
+ } else {
+ xgi_video_info.hasVB = HASVB_NONE;
+ }
+ } else {
+ XGIfb_get_VB_type();
+ }
- XGIhw_ext.ujVBChipID = VB_CHIP_UNKNOWN;
+ XGIhw_ext.ujVBChipID = VB_CHIP_UNKNOWN;
- XGIhw_ext.ulExternalChip = 0;
+ XGIhw_ext.ulExternalChip = 0;
switch (xgi_video_info.hasVB) {
case HASVB_301:
- inXGIIDXREG(XGIPART4, 0x01, reg);
+ inXGIIDXREG(XGIPART4, 0x01, reg);
if (reg >= 0xE0) {
XGIhw_ext.ujVBChipID = VB_CHIP_302LV;
- printk(KERN_INFO "XGIfb: XGI302LV bridge detected (revision 0x%02x)\n",reg);
- } else if (reg >= 0xD0) {
+ printk(KERN_INFO "XGIfb: XGI302LV bridge detected (revision 0x%02x)\n", reg);
+ } else if (reg >= 0xD0) {
XGIhw_ext.ujVBChipID = VB_CHIP_301LV;
- printk(KERN_INFO "XGIfb: XGI301LV bridge detected (revision 0x%02x)\n",reg);
- }
+ printk(KERN_INFO "XGIfb: XGI301LV bridge detected (revision 0x%02x)\n", reg);
+ }
/* else if (reg >= 0xB0) {
XGIhw_ext.ujVBChipID = VB_CHIP_301B;
- inXGIIDXREG(XGIPART4,0x23,reg1);
- printk("XGIfb: XGI301B bridge detected\n");
- }*/
+ inXGIIDXREG(XGIPART4, 0x23, reg1);
+ printk("XGIfb: XGI301B bridge detected\n");
+ } */
else {
XGIhw_ext.ujVBChipID = VB_CHIP_301;
printk("XGIfb: XGI301 bridge detected\n");
}
break;
case HASVB_302:
- inXGIIDXREG(XGIPART4, 0x01, reg);
+ inXGIIDXREG(XGIPART4, 0x01, reg);
if (reg >= 0xE0) {
XGIhw_ext.ujVBChipID = VB_CHIP_302LV;
- printk(KERN_INFO "XGIfb: XGI302LV bridge detected (revision 0x%02x)\n",reg);
- } else if (reg >= 0xD0) {
+ printk(KERN_INFO "XGIfb: XGI302LV bridge detected (revision 0x%02x)\n", reg);
+ } else if (reg >= 0xD0) {
XGIhw_ext.ujVBChipID = VB_CHIP_301LV;
- printk(KERN_INFO "XGIfb: XGI302LV bridge detected (revision 0x%02x)\n",reg);
- } else if (reg >= 0xB0) {
- inXGIIDXREG(XGIPART4,0x23,reg1);
+ printk(KERN_INFO "XGIfb: XGI302LV bridge detected (revision 0x%02x)\n", reg);
+ } else if (reg >= 0xB0) {
+ inXGIIDXREG(XGIPART4, 0x23, reg1);
- XGIhw_ext.ujVBChipID = VB_CHIP_302B;
+ XGIhw_ext.ujVBChipID = VB_CHIP_302B;
} else {
- XGIhw_ext.ujVBChipID = VB_CHIP_302;
+ XGIhw_ext.ujVBChipID = VB_CHIP_302;
printk(KERN_INFO "XGIfb: XGI302 bridge detected\n");
}
break;
@@ -3207,14 +3232,13 @@ int __devinit xgifb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
XGIhw_ext.ulExternalChip = 0x5;
printk(KERN_INFO "XGIfb: LVDS transmitter and Chrontel TV encoder detected\n");
break;
- default:
+ default:
printk(KERN_INFO "XGIfb: No or unknown bridge type detected\n");
break;
}
- if (xgi_video_info.hasVB != HASVB_NONE) {
- XGIfb_detect_VB();
- }
+ if (xgi_video_info.hasVB != HASVB_NONE)
+ XGIfb_detect_VB();
if (xgi_video_info.disp_state & DISPTYPE_DISP2) {
if (XGIfb_crt1off)
@@ -3226,61 +3250,52 @@ int __devinit xgifb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
}
if (xgi_video_info.disp_state & DISPTYPE_LCD) {
- if (!enable_dstn) {
- inXGIIDXREG(XGICR, IND_XGI_LCD_PANEL, reg);
- reg &= 0x0f;
- XGIhw_ext.ulCRT2LCDType = XGI310paneltype[reg];
-
- } else {
- // TW: FSTN/DSTN
- XGIhw_ext.ulCRT2LCDType = LCD_320x480;
- }
+ if (!enable_dstn) {
+ inXGIIDXREG(XGICR, IND_XGI_LCD_PANEL, reg);
+ reg &= 0x0f;
+ XGIhw_ext.ulCRT2LCDType = XGI310paneltype[reg];
+
+ } else {
+ /* TW: FSTN/DSTN */
+ XGIhw_ext.ulCRT2LCDType = LCD_320x480;
+ }
}
XGIfb_detectedpdc = 0;
- XGIfb_detectedlcda = 0xff;
+ XGIfb_detectedlcda = 0xff;
#ifndef LINUXBIOS
- /* TW: Try to find about LCDA */
-
- if((XGIhw_ext.ujVBChipID == VB_CHIP_302B) ||
- (XGIhw_ext.ujVBChipID == VB_CHIP_301LV) ||
- (XGIhw_ext.ujVBChipID == VB_CHIP_302LV))
- {
- int tmp;
- inXGIIDXREG(XGICR,0x34,tmp);
- if(tmp <= 0x13)
- {
- // Currently on LCDA? (Some BIOSes leave CR38)
- inXGIIDXREG(XGICR,0x38,tmp);
- if((tmp & 0x03) == 0x03)
- {
-/* XGI_Pr.XGI_UseLCDA = 1; */
- }else
- {
- // Currently on LCDA? (Some newer BIOSes set D0 in CR35)
- inXGIIDXREG(XGICR,0x35,tmp);
- if(tmp & 0x01)
- {
-/* XGI_Pr.XGI_UseLCDA = 1; */
- }else
- {
- inXGIIDXREG(XGICR,0x30,tmp);
- if(tmp & 0x20)
- {
- inXGIIDXREG(XGIPART1,0x13,tmp);
- if(tmp & 0x04)
- {
-/* XGI_Pr.XGI_UseLCDA = 1; */
- }
- }
- }
- }
- }
-
- }
+ /* TW: Try to find about LCDA */
+
+ if ((XGIhw_ext.ujVBChipID == VB_CHIP_302B) ||
+ (XGIhw_ext.ujVBChipID == VB_CHIP_301LV) ||
+ (XGIhw_ext.ujVBChipID == VB_CHIP_302LV)) {
+ int tmp;
+ inXGIIDXREG(XGICR, 0x34, tmp);
+ if (tmp <= 0x13) {
+ /* Currently on LCDA? (Some BIOSes leave CR38) */
+ inXGIIDXREG(XGICR, 0x38, tmp);
+ if ((tmp & 0x03) == 0x03) {
+ /* XGI_Pr.XGI_UseLCDA = 1; */
+ } else {
+ /* Currently on LCDA? (Some newer BIOSes set D0 in CR35) */
+ inXGIIDXREG(XGICR, 0x35, tmp);
+ if (tmp & 0x01) {
+ /* XGI_Pr.XGI_UseLCDA = 1; */
+ } else {
+ inXGIIDXREG(XGICR, 0x30, tmp);
+ if (tmp & 0x20) {
+ inXGIIDXREG(XGIPART1, 0x13, tmp);
+ if (tmp & 0x04) {
+ /* XGI_Pr.XGI_UseLCDA = 1; */
+ }
+ }
+ }
+ }
+ }
+ }
#endif
@@ -3289,17 +3304,15 @@ int __devinit xgifb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if (xgifb_mode_idx < 0) {
switch (xgi_video_info.disp_state & DISPTYPE_DISP2) {
- case DISPTYPE_LCD:
+ case DISPTYPE_LCD:
xgifb_mode_idx = DEFAULT_LCDMODE;
if (xgi_video_info.chip == XG21)
- {
- xgifb_mode_idx = XGIfb_GetXG21DefaultLVDSModeIdx();
- }
+ xgifb_mode_idx = XGIfb_GetXG21DefaultLVDSModeIdx();
break;
- case DISPTYPE_TV:
+ case DISPTYPE_TV:
xgifb_mode_idx = DEFAULT_TVMODE;
break;
- default:
+ default:
xgifb_mode_idx = DEFAULT_MODE;
break;
}
@@ -3307,47 +3320,43 @@ int __devinit xgifb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
XGIfb_mode_no = XGIbios_mode[xgifb_mode_idx].mode_no;
-
- if( xgi_video_info.refresh_rate == 0)
- xgi_video_info.refresh_rate = 60; /*yilin set default refresh rate */
- if(XGIfb_search_refresh_rate(xgi_video_info.refresh_rate) == 0)
- {
- XGIfb_rate_idx = XGIbios_mode[xgifb_mode_idx].rate_idx;
- xgi_video_info.refresh_rate = 60;
- }
+ if (xgi_video_info.refresh_rate == 0)
+ xgi_video_info.refresh_rate = 60; /* yilin set default refresh rate */
+ if (XGIfb_search_refresh_rate(xgi_video_info.refresh_rate) == 0) {
+ XGIfb_rate_idx = XGIbios_mode[xgifb_mode_idx].rate_idx;
+ xgi_video_info.refresh_rate = 60;
+ }
xgi_video_info.video_bpp = XGIbios_mode[xgifb_mode_idx].bpp;
xgi_video_info.video_vwidth = xgi_video_info.video_width = XGIbios_mode[xgifb_mode_idx].xres;
xgi_video_info.video_vheight = xgi_video_info.video_height = XGIbios_mode[xgifb_mode_idx].yres;
xgi_video_info.org_x = xgi_video_info.org_y = 0;
xgi_video_info.video_linelength = xgi_video_info.video_width * (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;
+ 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;
+ 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;
+ break;
+ case 32:
+ xgi_video_info.DstColor = 0xC000;
+ xgi_video_info.XGI310_AccelDepth = 0x00020000;
xgi_video_info.video_cmap_len = 16;
- break;
+ break;
default:
xgi_video_info.video_cmap_len = 16;
- printk(KERN_INFO "XGIfb: Unsupported depth %d", xgi_video_info.video_bpp);
+ printk(KERN_INFO "XGIfb: Unsupported depth %d", xgi_video_info.video_bpp);
break;
- }
-
-
+ }
printk(KERN_INFO "XGIfb: Default mode is %dx%dx%d (%dHz)\n",
- xgi_video_info.video_width, xgi_video_info.video_height, xgi_video_info.video_bpp,
- xgi_video_info.refresh_rate);
+ xgi_video_info.video_width, xgi_video_info.video_height, xgi_video_info.video_bpp,
+ xgi_video_info.refresh_rate);
default_var.xres = default_var.xres_virtual = xgi_video_info.video_width;
default_var.yres = default_var.yres_virtual = xgi_video_info.video_height;
@@ -3359,29 +3368,29 @@ int __devinit xgifb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
XGIfb_mode_rate_to_dclock(&XGI_Pr, &XGIhw_ext,
XGIfb_mode_no, XGIfb_rate_idx));
- if(XGIfb_mode_rate_to_ddata(&XGI_Pr, &XGIhw_ext,
- XGIfb_mode_no, XGIfb_rate_idx,
- &default_var.left_margin, &default_var.right_margin,
- &default_var.upper_margin, &default_var.lower_margin,
- &default_var.hsync_len, &default_var.vsync_len,
- &default_var.sync, &default_var.vmode)) {
-
- if((default_var.vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) {
- default_var.yres <<= 1;
- default_var.yres_virtual <<= 1;
- } else if((default_var.vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE) {
- default_var.pixclock >>= 1;
- default_var.yres >>= 1;
- default_var.yres_virtual >>= 1;
- }
+ if (XGIfb_mode_rate_to_ddata(&XGI_Pr, &XGIhw_ext,
+ XGIfb_mode_no, XGIfb_rate_idx,
+ &default_var.left_margin, &default_var.right_margin,
+ &default_var.upper_margin, &default_var.lower_margin,
+ &default_var.hsync_len, &default_var.vsync_len,
+ &default_var.sync, &default_var.vmode)) {
+
+ if ((default_var.vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) {
+ default_var.yres <<= 1;
+ default_var.yres_virtual <<= 1;
+ } else if ((default_var.vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE) {
+ default_var.pixclock >>= 1;
+ default_var.yres >>= 1;
+ default_var.yres_virtual >>= 1;
+ }
- }
+ }
xgi_video_info.accel = 0;
- if(XGIfb_accel) {
- xgi_video_info.accel = -1;
- default_var.accel_flags |= FB_ACCELF_TEXT;
- XGIfb_initaccel();
+ if (XGIfb_accel) {
+ xgi_video_info.accel = -1;
+ default_var.accel_flags |= FB_ACCELF_TEXT;
+ XGIfb_initaccel();
}
fb_info->flags = FBINFO_FLAG_DEFAULT;
@@ -3395,33 +3404,21 @@ int __devinit xgifb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
fb_alloc_cmap(&fb_info->cmap, 256 , 0);
-
#ifdef CONFIG_MTRR
xgi_video_info.mtrr = mtrr_add((unsigned int) xgi_video_info.video_base,
(unsigned int) xgi_video_info.video_size,
MTRR_TYPE_WRCOMB, 1);
- if(xgi_video_info.mtrr) {
+ if (xgi_video_info.mtrr)
printk(KERN_INFO "XGIfb: Added MTRRs\n");
- }
#endif
- if(register_framebuffer(fb_info) < 0)
- {
+ if (register_framebuffer(fb_info) < 0)
return -EINVAL;
- }
XGIfb_registered = 1;
- printk(KERN_INFO "XGIfb: Installed XGIFB_GET_INFO ioctl (%lx)\n",
- XGIFB_GET_INFO);
-
-/* printk(KERN_INFO "XGIfb: 2D acceleration is %s, scrolling mode %s\n",
- XGIfb_accel ? "enabled" : "disabled",
- XGIfb_ypan ? "ypan" : "redraw");
-*/
printk(KERN_INFO "fb%d: %s frame buffer device, Version %d.%d.%02d\n",
- fb_info->node, myid, VER_MAJOR, VER_MINOR, VER_LEVEL);
-
+ fb_info->node, myid, VER_MAJOR, VER_MINOR, VER_LEVEL);
}
@@ -3430,7 +3427,6 @@ int __devinit xgifb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
return 0;
}
-
/*****************************************************/
/* PCI DEVICE HANDLING */
/*****************************************************/
@@ -3438,34 +3434,32 @@ int __devinit xgifb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
static void __devexit xgifb_remove(struct pci_dev *pdev)
{
/* Unregister the framebuffer */
-// if(xgi_video_info.registered) {
- unregister_framebuffer(fb_info);
- framebuffer_release(fb_info);
-// }
+ /* if (xgi_video_info.registered) { */
+ unregister_framebuffer(fb_info);
+ framebuffer_release(fb_info);
+ /* } */
pci_set_drvdata(pdev, NULL);
};
static struct pci_driver xgifb_driver = {
- .name = "xgifb",
- .id_table = xgifb_pci_table,
- .probe = xgifb_probe,
- .remove = __devexit_p(xgifb_remove)
+ .name = "xgifb",
+ .id_table = xgifb_pci_table,
+ .probe = xgifb_probe,
+ .remove = __devexit_p(xgifb_remove)
};
XGIINITSTATIC int __init xgifb_init(void)
{
-#ifndef MODULE
char *option = NULL;
if (fb_get_options("xgifb", &option))
return -ENODEV;
XGIfb_setup(option);
-#endif
- return(pci_register_driver(&xgifb_driver));
-}
+ return pci_register_driver(&xgifb_driver);
+}
#ifndef MODULE
module_init(xgifb_init);
@@ -3477,37 +3471,34 @@ module_init(xgifb_init);
#ifdef MODULE
-static char *mode = NULL;
-static int vesa = 0;
+static char *mode = NULL;
+static int vesa = 0;
static unsigned int rate = 0;
-static unsigned int crt1off = 1;
static unsigned int mem = 0;
-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;
-static int nocrt2rate = 0;
-static int scalelcd = -1;
-static char *specialtiming = NULL;
-static int lvdshl = -1;
-static int tvxposoffset = 0, tvyposoffset = 0;
+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;
+static int nocrt2rate = 0;
+static int scalelcd = -1;
+static char *specialtiming = NULL;
+static int lvdshl = -1;
+static int tvxposoffset = 0, tvyposoffset = 0;
#if !defined(__i386__) && !defined(__x86_64__)
-static int resetcard = 0;
-static int videoram = 0;
+static int resetcard = 0;
+static int videoram = 0;
#endif
MODULE_DESCRIPTION("Z7 Z9 Z9S Z11 framebuffer device driver");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("XGITECH , Others");
-
-
module_param(mem, int, 0);
module_param(noaccel, int, 0);
module_param(noypan, int, 0);
@@ -3534,122 +3525,115 @@ 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");
+ "\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");
+ "\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");
+ "\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");
-
-
+ "\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"
- "XxY-Depth@Rate. If the parameter is only one (decimal or hexadecimal)\n"
- "number, it will be interpreted as a VESA mode number. (default: 800x600x8)\n");
+ "\nSelects the desired default display mode in the format XxYxDepth,\n"
+ "eg. 1024x768x16. Other formats supported include XxY-Depth and\n"
+ "XxY-Depth@Rate. If the parameter is only one (decimal or hexadecimal)\n"
+ "number, it will be interpreted as a VESA mode number. (default: 800x600x8)\n");
MODULE_PARM_DESC(vesa,
- "\nSelects the desired default display mode by VESA defined mode number, eg.\n"
- "0x117 (default: 0x0103)\n");
-
+ "\nSelects the desired default display mode by VESA defined mode number, eg.\n"
+ "0x117 (default: 0x0103)\n");
MODULE_PARM_DESC(rate,
- "\nSelects the desired vertical refresh rate for CRT1 (external VGA) in Hz.\n"
- "If the mode is specified in the format XxY-Depth@Rate, this parameter\n"
- "will be ignored (default: 60)\n");
+ "\nSelects the desired vertical refresh rate for CRT1 (external VGA) in Hz.\n"
+ "If the mode is specified in the format XxY-Depth@Rate, this parameter\n"
+ "will be ignored (default: 60)\n");
MODULE_PARM_DESC(forcecrt1,
- "\nNormally, the driver autodetects whether or not CRT1 (external VGA) is \n"
- "connected. With this option, the detection can be overridden (1=CRT1 ON,\n"
- "0=CRT1 OFF) (default: [autodetected])\n");
+ "\nNormally, the driver autodetects whether or not CRT1 (external VGA) is\n"
+ "connected. With this option, the detection can be overridden (1=CRT1 ON,\n"
+ "0=CRT1 OFF) (default: [autodetected])\n");
MODULE_PARM_DESC(forcecrt2type,
- "\nIf this option is omitted, the driver autodetects CRT2 output devices, such as\n"
- "LCD, TV or secondary VGA. With this option, this autodetection can be\n"
- "overridden. Possible parameters are LCD, TV, VGA or NONE. NONE disables CRT2.\n"
- "On systems with a SiS video bridge, parameters SVIDEO, COMPOSITE or SCART can\n"
- "be used instead of TV to override the TV detection. Furthermore, on systems\n"
- "with a SiS video bridge, SVIDEO+COMPOSITE, HIVISION, YPBPR480I, YPBPR480P,\n"
- "YPBPR720P and YPBPR1080I are understood. However, whether or not these work\n"
- "depends on the very hardware in use. (default: [autodetected])\n");
+ "\nIf this option is omitted, the driver autodetects CRT2 output devices, such as\n"
+ "LCD, TV or secondary VGA. With this option, this autodetection can be\n"
+ "overridden. Possible parameters are LCD, TV, VGA or NONE. NONE disables CRT2.\n"
+ "On systems with a SiS video bridge, parameters SVIDEO, COMPOSITE or SCART can\n"
+ "be used instead of TV to override the TV detection. Furthermore, on systems\n"
+ "with a SiS video bridge, SVIDEO+COMPOSITE, HIVISION, YPBPR480I, YPBPR480P,\n"
+ "YPBPR720P and YPBPR1080I are understood. However, whether or not these work\n"
+ "depends on the very hardware in use. (default: [autodetected])\n");
MODULE_PARM_DESC(scalelcd,
- "\nSetting this to 1 will force the driver to scale the LCD image to the panel's\n"
- "native resolution. Setting it to 0 will disable scaling; LVDS panels will\n"
- "show black bars around the image, TMDS panels will probably do the scaling\n"
- "themselves. Default: 1 on LVDS panels, 0 on TMDS panels\n");
+ "\nSetting this to 1 will force the driver to scale the LCD image to the panel's\n"
+ "native resolution. Setting it to 0 will disable scaling; LVDS panels will\n"
+ "show black bars around the image, TMDS panels will probably do the scaling\n"
+ "themselves. Default: 1 on LVDS panels, 0 on TMDS panels\n");
MODULE_PARM_DESC(pdc,
- "\nThis is for manually selecting the LCD panel delay compensation. The driver\n"
- "should detect this correctly in most cases; however, sometimes this is not\n"
- "possible. If you see 'small waves' on the LCD, try setting this to 4, 32 or 24\n"
- "on a 300 series chipset; 6 on a 315 series chipset. If the problem persists,\n"
- "try other values (on 300 series: between 4 and 60 in steps of 4; on 315 series:\n"
- "any value from 0 to 31). (default: autodetected, if LCD is active during start)\n");
+ "\nThis is for manually selecting the LCD panel delay compensation. The driver\n"
+ "should detect this correctly in most cases; however, sometimes this is not\n"
+ "possible. If you see 'small waves' on the LCD, try setting this to 4, 32 or 24\n"
+ "on a 300 series chipset; 6 on a 315 series chipset. If the problem persists,\n"
+ "try other values (on 300 series: between 4 and 60 in steps of 4; on 315 series:\n"
+ "any value from 0 to 31). (default: autodetected, if LCD is active during start)\n");
MODULE_PARM_DESC(pdc1,
- "\nThis is same as pdc, but for LCD-via CRT1. Hence, this is for the 315/330\n"
- "series only. (default: autodetected if LCD is in LCD-via-CRT1 mode during\n"
- "startup) - Note: currently, this has no effect because LCD-via-CRT1 is not\n"
- "implemented yet.\n");
+ "\nThis is same as pdc, but for LCD-via CRT1. Hence, this is for the 315/330\n"
+ "series only. (default: autodetected if LCD is in LCD-via-CRT1 mode during\n"
+ "startup) - Note: currently, this has no effect because LCD-via-CRT1 is not\n"
+ "implemented yet.\n");
MODULE_PARM_DESC(specialtiming,
- "\nPlease refer to documentation for more information on this option.\n");
+ "\nPlease refer to documentation for more information on this option.\n");
MODULE_PARM_DESC(lvdshl,
- "\nPlease refer to documentation for more information on this option.\n");
+ "\nPlease refer to documentation for more information on this option.\n");
MODULE_PARM_DESC(tvstandard,
- "\nThis allows overriding the BIOS default for the TV standard. Valid choices are\n"
- "pal, ntsc, palm and paln. (default: [auto; pal or ntsc only])\n");
+ "\nThis allows overriding the BIOS default for the TV standard. Valid choices are\n"
+ "pal, ntsc, palm and paln. (default: [auto; pal or ntsc only])\n");
MODULE_PARM_DESC(tvxposoffset,
- "\nRelocate TV output horizontally. Possible parameters: -32 through 32.\n"
- "Default: 0\n");
+ "\nRelocate TV output horizontally. Possible parameters: -32 through 32.\n"
+ "Default: 0\n");
MODULE_PARM_DESC(tvyposoffset,
- "\nRelocate TV output vertically. Possible parameters: -32 through 32.\n"
- "Default: 0\n");
+ "\nRelocate TV output vertically. Possible parameters: -32 through 32.\n"
+ "Default: 0\n");
MODULE_PARM_DESC(filter,
- "\nSelects TV flicker filter type (only for systems with a SiS301 video bridge).\n"
- "(Possible values 0-7, default: [no filter])\n");
+ "\nSelects TV flicker filter type (only for systems with a SiS301 video bridge).\n"
+ "(Possible values 0-7, default: [no filter])\n");
MODULE_PARM_DESC(nocrt2rate,
- "\nSetting this to 1 will force the driver to use the default refresh rate for\n"
- "CRT2 if CRT2 type is VGA. (default: 0, use same rate as CRT1)\n");
-
-
-
+ "\nSetting this to 1 will force the driver to use the default refresh rate for\n"
+ "CRT2 if CRT2 type is VGA. (default: 0, use same rate as CRT1)\n");
-int __init xgifb_init_module(void)
+static int __init xgifb_init_module(void)
{
- printk("\nXGIfb_init_module");
- if(mode)
+ printk("\nXGIfb_init_module");
+ if (mode)
XGIfb_search_mode(mode);
else if (vesa != -1)
XGIfb_search_vesamode(vesa);
- return(xgifb_init());
+ return xgifb_init();
}
static void __exit xgifb_remove_module(void)
@@ -3661,7 +3645,7 @@ static void __exit xgifb_remove_module(void)
module_init(xgifb_init_module);
module_exit(xgifb_remove_module);
-#endif /* /MODULE */
+#endif /* /MODULE */
EXPORT_SYMBOL(XGI_malloc);
EXPORT_SYMBOL(XGI_free);
diff --git a/drivers/staging/xgifb/vb_ext.c b/drivers/staging/xgifb/vb_ext.c
index 1ecf9e3..80c7818 100644
--- a/drivers/staging/xgifb/vb_ext.c
+++ b/drivers/staging/xgifb/vb_ext.c
@@ -9,1046 +9,849 @@
#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);
+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);
+ 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_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);
+ struct vb_device_info *pVBInfo);
unsigned char XGINew_SenseHiTV(struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo);
+ struct vb_device_info *pVBInfo);
/**************************************************************
- Dynamic Sense
-*************************************************************/
+ *********************** Dynamic Sense ************************
+ *************************************************************/
void XGI_WaitDisplay(void);
unsigned char XGI_Is301C(struct vb_device_info *);
unsigned char XGI_Is301LV(struct vb_device_info *);
-
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_Is301B */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-unsigned char XGINew_Is301B(struct vb_device_info *pVBInfo)
+static unsigned char XGINew_Is301B(struct vb_device_info *pVBInfo)
{
- unsigned short flag ;
+ unsigned short flag;
- flag = XGINew_GetReg1( pVBInfo->Part4Port , 0x01 ) ;
+ flag = XGINew_GetReg1(pVBInfo->Part4Port, 0x01);
- if ( flag > 0x0B0 )
- return( 0 ) ; /* 301b */
- else
- return( 1 ) ;
+ if (flag > 0x0B0)
+ return 0; /* 301b */
+ else
+ return 1;
}
-/* --------------------------------------------------------------------- */
-/* Function : XGI_Is301C */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
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) & 0xF0) == 0xC0)
+ return 1;
- if ( XGINew_GetReg1( pVBInfo->Part4Port , 0x01 ) >= 0xD0 )
- {
- if ( XGINew_GetReg1( pVBInfo->Part4Port , 0x39 ) == 0xE0 )
- return( 1 ) ;
- }
+ if (XGINew_GetReg1(pVBInfo->Part4Port, 0x01) >= 0xD0) {
+ if (XGINew_GetReg1(pVBInfo->Part4Port, 0x39) == 0xE0)
+ return 1;
+ }
- return( 0 ) ;
+ return 0;
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_Is301LV */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
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 ) ;
+ if (XGINew_GetReg1(pVBInfo->Part4Port, 0x01) >= 0xD0) {
+ if (XGINew_GetReg1(pVBInfo->Part4Port, 0x39) == 0xFF)
+ return 1;
+ }
+ return 0;
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_Sense */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-unsigned char XGINew_Sense(unsigned short tempbx,
- unsigned short tempcx,
- struct vb_device_info *pVBInfo)
+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 ) ;
- temp = ( tempbx & 0xFF00 ) >> 8 ;
- temp |= ( tempcx & 0x00FF ) ;
- XGINew_SetRegANDOR( 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 = temp ^ ( 0x0E ) ;
- temp &= tempch ;
-
- if ( temp > 0 )
- return( 1 ) ;
- else
- return( 0 ) ;
+ unsigned short temp, i, tempch;
+
+ temp = tempbx & 0xFF;
+ XGINew_SetReg1(pVBInfo->Part4Port, 0x11, temp);
+ temp = (tempbx & 0xFF00) >> 8;
+ temp |= (tempcx & 0x00FF);
+ XGINew_SetRegANDOR(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 = temp ^ (0x0E);
+ temp &= tempch;
+
+ if (temp > 0)
+ return 1;
+ else
+ return 0;
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGISetDPMS */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGISetDPMS(struct xgi_hw_device_info *pXGIHWDE,
- unsigned long VESA_POWER_STATE)
+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 ) ;
+ 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);
}
-
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GetSenseStatus */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
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 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 */
}
-
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_SenseLCD */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-unsigned short XGINew_SenseLCD(struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo)
+unsigned short XGINew_SenseLCD(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
{
- /* unsigned short SoftSetting ; */
- unsigned short temp ;
+ /* unsigned short SoftSetting ; */
+ unsigned short temp;
- if ( ( HwDeviceExtension->jChipType >= XG20 ) || ( HwDeviceExtension->jChipType >= XG40 ) )
- temp = 0 ;
- else
- temp=XGINew_GetPanelID(pVBInfo) ;
+ if ((HwDeviceExtension->jChipType >= XG20) || (HwDeviceExtension->jChipType >= XG40))
+ temp = 0;
+ else
+ temp = XGINew_GetPanelID(pVBInfo);
- if( !temp )
- temp = XGINew_GetLCDDDCInfo( HwDeviceExtension, pVBInfo ) ;
+ if (!temp)
+ temp = XGINew_GetLCDDDCInfo(HwDeviceExtension, pVBInfo);
- return( temp ) ;
+ return temp;
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_GetLCDDDCInfo */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
unsigned char XGINew_GetLCDDDCInfo(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
{
- unsigned short temp ;
-
- /* add lcd sense */
- if ( HwDeviceExtension->ulCRT2LCDType == LCD_UNKNOWN )
- {
- return( 0 ) ;
- }
- else
- {
- temp = (unsigned short)HwDeviceExtension->ulCRT2LCDType ;
- switch( HwDeviceExtension->ulCRT2LCDType )
- {
- case LCD_INVALID:
- case LCD_800x600:
- case LCD_1024x768:
- case LCD_1280x1024:
- break ;
-
- case LCD_640x480:
- case LCD_1024x600:
- case LCD_1152x864:
- case LCD_1280x960:
- case LCD_1152x768:
- temp = 0 ;
- break ;
-
- case LCD_1400x1050:
- case LCD_1280x768:
- case LCD_1600x1200:
- break ;
-
- case LCD_1920x1440:
- case LCD_2048x1536:
- temp = 0 ;
- break ;
-
- default:
- break ;
- }
- XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x36 , 0xF0 , temp ) ;
- return( 1 ) ;
- }
+ unsigned short temp;
+
+ /* add lcd sense */
+ if (HwDeviceExtension->ulCRT2LCDType == LCD_UNKNOWN) {
+ return 0;
+ } else {
+ temp = (unsigned short) HwDeviceExtension->ulCRT2LCDType;
+ switch (HwDeviceExtension->ulCRT2LCDType) {
+ case LCD_INVALID:
+ case LCD_800x600:
+ case LCD_1024x768:
+ case LCD_1280x1024:
+ break;
+
+ case LCD_640x480:
+ case LCD_1024x600:
+ case LCD_1152x864:
+ case LCD_1280x960:
+ case LCD_1152x768:
+ temp = 0;
+ break;
+
+ case LCD_1400x1050:
+ case LCD_1280x768:
+ case LCD_1600x1200:
+ break;
+
+ case LCD_1920x1440:
+ case LCD_2048x1536:
+ temp = 0;
+ break;
+
+ default:
+ break;
+ }
+ XGINew_SetRegANDOR(pVBInfo->P3d4, 0x36, 0xF0, temp);
+ return 1;
+ }
}
-
-/* --------------------------------------------------------------------- */
-/* Function : */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
unsigned char XGINew_GetPanelID(struct vb_device_info *pVBInfo)
{
- unsigned short PanelTypeTable[16] = {
- SyncNN | PanelRGB18Bit | Panel800x600 | _PanelType00,
- SyncNN | PanelRGB18Bit | Panel1024x768 | _PanelType01,
- SyncNN | PanelRGB18Bit | Panel800x600 | _PanelType02,
- SyncNN | PanelRGB18Bit | Panel640x480 | _PanelType03,
- SyncNN | PanelRGB18Bit | Panel1024x768 | _PanelType04,
- SyncNN | PanelRGB18Bit | Panel1024x768 | _PanelType05,
- SyncNN | PanelRGB18Bit | Panel1024x768 | _PanelType06,
- SyncNN | PanelRGB24Bit | Panel1024x768 | _PanelType07,
- SyncNN | PanelRGB18Bit | Panel800x600 | _PanelType08,
- SyncNN | PanelRGB18Bit | Panel1024x768 | _PanelType09,
- SyncNN | PanelRGB18Bit | Panel800x600 | _PanelType0A,
- SyncNN | PanelRGB18Bit | Panel1024x768 | _PanelType0B,
- SyncNN | PanelRGB18Bit | Panel1024x768 | _PanelType0C,
- SyncNN | PanelRGB24Bit | Panel1024x768 | _PanelType0D,
- SyncNN | PanelRGB18Bit | Panel1024x768 | _PanelType0E,
- SyncNN | PanelRGB18Bit | Panel1024x768 | _PanelType0F };
- unsigned short tempax , tempbx, temp;
- /* unsigned short return_flag ; */
-
- tempax = XGINew_GetReg1( pVBInfo->P3c4 , 0x1A ) ;
- tempbx = tempax & 0x1E ;
-
- if ( tempax == 0 )
- return( 0 ) ;
- else
- {
-/*
- if ( !( tempax & 0x10 ) )
- {
- if ( pVBInfo->IF_DEF_LVDS == 1 )
- {
- tempbx = 0 ;
- temp = XGINew_GetReg1( pVBInfo->P3c4 , 0x38 ) ;
- if ( temp & 0x40 )
- tempbx |= 0x08 ;
- if ( temp & 0x20 )
- tempbx |= 0x02 ;
- if ( temp & 0x01 )
- tempbx |= 0x01 ;
-
- temp = XGINew_GetReg1( pVBInfo->P3c4 , 0x39 ) ;
- if ( temp & 0x80 )
- tempbx |= 0x04 ;
- }
- else
- {
- return( 0 ) ;
- }
- }
-*/
-
- tempbx = tempbx >> 1 ;
- temp = tempbx & 0x00F ;
- XGINew_SetReg1( pVBInfo->P3d4 , 0x36 , temp ) ;
- tempbx-- ;
- tempbx = PanelTypeTable[ tempbx ] ;
-
- temp = ( tempbx & 0xFF00 ) >> 8 ;
- XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x37 , ~( LCDSyncBit | LCDRGB18Bit ) , temp ) ;
- return( 1 ) ;
- }
+ unsigned short PanelTypeTable[16] = { SyncNN | PanelRGB18Bit
+ | Panel800x600 | _PanelType00, SyncNN | PanelRGB18Bit
+ | Panel1024x768 | _PanelType01, SyncNN | PanelRGB18Bit
+ | Panel800x600 | _PanelType02, SyncNN | PanelRGB18Bit
+ | Panel640x480 | _PanelType03, SyncNN | PanelRGB18Bit
+ | Panel1024x768 | _PanelType04, SyncNN | PanelRGB18Bit
+ | Panel1024x768 | _PanelType05, SyncNN | PanelRGB18Bit
+ | Panel1024x768 | _PanelType06, SyncNN | PanelRGB24Bit
+ | Panel1024x768 | _PanelType07, SyncNN | PanelRGB18Bit
+ | Panel800x600 | _PanelType08, SyncNN | PanelRGB18Bit
+ | Panel1024x768 | _PanelType09, SyncNN | PanelRGB18Bit
+ | Panel800x600 | _PanelType0A, SyncNN | PanelRGB18Bit
+ | Panel1024x768 | _PanelType0B, SyncNN | PanelRGB18Bit
+ | Panel1024x768 | _PanelType0C, SyncNN | PanelRGB24Bit
+ | Panel1024x768 | _PanelType0D, SyncNN | PanelRGB18Bit
+ | Panel1024x768 | _PanelType0E, SyncNN | PanelRGB18Bit
+ | Panel1024x768 | _PanelType0F };
+ unsigned short tempax, tempbx, temp;
+ /* unsigned short return_flag; */
+
+ tempax = XGINew_GetReg1(pVBInfo->P3c4, 0x1A);
+ tempbx = tempax & 0x1E;
+
+ if (tempax == 0)
+ return 0;
+ else {
+ /*
+ if (!(tempax & 0x10)) {
+ if (pVBInfo->IF_DEF_LVDS == 1) {
+ tempbx = 0;
+ temp = XGINew_GetReg1(pVBInfo->P3c4, 0x38);
+ if (temp & 0x40)
+ tempbx |= 0x08;
+ if (temp & 0x20)
+ tempbx |= 0x02;
+ if (temp & 0x01)
+ tempbx |= 0x01;
+
+ temp = XGINew_GetReg1(pVBInfo->P3c4, 0x39);
+ if (temp & 0x80)
+ tempbx |= 0x04;
+ } else {
+ return(0);
+ }
+ }
+ */
+
+ tempbx = tempbx >> 1;
+ temp = tempbx & 0x00F;
+ XGINew_SetReg1(pVBInfo->P3d4, 0x36, temp);
+ tempbx--;
+ tempbx = PanelTypeTable[tempbx];
+
+ temp = (tempbx & 0xFF00) >> 8;
+ XGINew_SetRegANDOR(pVBInfo->P3d4, 0x37, ~(LCDSyncBit
+ | LCDRGB18Bit), temp);
+ return 1;
+ }
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_BridgeIsEnable */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
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 ) ;
-
- if ( flag & 0x050 )
- {
- return( 1 ) ;
- }
- else
- {
- return( 0 ) ;
- }
-
- }
- return( 0 ) ;
+ unsigned short flag;
+
+ if (XGI_BridgeIsOn(pVBInfo) == 0) {
+ flag = XGINew_GetReg1(pVBInfo->Part1Port, 0x0);
+
+ if (flag & 0x050)
+ return 1;
+ else
+ return 0;
+
+ }
+ return 0;
}
-/* ------------------------------------------------------ */
-/* Function : XGINew_SenseHiTV */
-/* Input : */
-/* Output : */
-/* Description : */
-/* ------------------------------------------------------ */
unsigned char XGINew_SenseHiTV(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
{
- unsigned short tempbx , tempcx , temp , i , tempch;
-
- tempbx = *pVBInfo->pYCSenseData2 ;
-
- tempcx = 0x0604 ;
-
- temp = tempbx & 0xFF ;
- XGINew_SetReg1( pVBInfo->Part4Port , 0x11 , temp ) ;
- temp = ( tempbx & 0xFF00 ) >> 8 ;
- temp |= ( tempcx & 0x00FF ) ;
- XGINew_SetRegANDOR( 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 = temp ^ ( 0x0E ) ;
- temp &= tempch ;
-
- if ( temp != tempch )
- return( 0 ) ;
-
- tempbx = *pVBInfo->pVideoSenseData2 ;
-
- tempcx = 0x0804 ;
- temp = tempbx & 0xFF ;
- XGINew_SetReg1( pVBInfo->Part4Port , 0x11 , temp ) ;
- temp = ( tempbx & 0xFF00 ) >> 8 ;
- temp |= ( tempcx & 0x00FF ) ;
- XGINew_SetRegANDOR( 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 = temp ^ ( 0x0E ) ;
- temp &= tempch ;
-
- if ( temp != tempch )
- return( 0 ) ;
- else
- {
- tempbx = 0x3FF ;
- tempcx = 0x0804 ;
- temp = tempbx & 0xFF ;
- XGINew_SetReg1( pVBInfo->Part4Port , 0x11 , temp ) ;
- temp = ( tempbx & 0xFF00 ) >> 8 ;
- temp |= ( tempcx & 0x00FF ) ;
- XGINew_SetRegANDOR( 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 = temp ^ ( 0x0E ) ;
- temp &= tempch ;
-
- if ( temp != tempch )
- return( 1 ) ;
- else
- return( 0 ) ;
- }
+ unsigned short tempbx, tempcx, temp, i, tempch;
+
+ tempbx = *pVBInfo->pYCSenseData2;
+
+ tempcx = 0x0604;
+
+ temp = tempbx & 0xFF;
+ XGINew_SetReg1(pVBInfo->Part4Port, 0x11, temp);
+ temp = (tempbx & 0xFF00) >> 8;
+ temp |= (tempcx & 0x00FF);
+ XGINew_SetRegANDOR(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 = temp ^ (0x0E);
+ temp &= tempch;
+
+ if (temp != tempch)
+ return 0;
+
+ tempbx = *pVBInfo->pVideoSenseData2;
+
+ tempcx = 0x0804;
+ temp = tempbx & 0xFF;
+ XGINew_SetReg1(pVBInfo->Part4Port, 0x11, temp);
+ temp = (tempbx & 0xFF00) >> 8;
+ temp |= (tempcx & 0x00FF);
+ XGINew_SetRegANDOR(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 = temp ^ (0x0E);
+ temp &= tempch;
+
+ if (temp != tempch) {
+ return 0;
+ } else {
+ tempbx = 0x3FF;
+ tempcx = 0x0804;
+ temp = tempbx & 0xFF;
+ XGINew_SetReg1(pVBInfo->Part4Port, 0x11, temp);
+ temp = (tempbx & 0xFF00) >> 8;
+ temp |= (tempcx & 0x00FF);
+ XGINew_SetRegANDOR(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 = temp ^ (0x0E);
+ temp &= tempch;
+
+ if (temp != tempch)
+ return 1;
+ else
+ return 0;
+ }
}
-
-
-/*
-;-----------------------------------------------------------------------------
-; 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
-;-----------------------------------------------------------------------------
-*/
-void XGI_XG21Fun14Sub70(struct vb_device_info *pVBInfo, PX86_REGS pBiosArguments)
+/* ----------------------------------------------------------------------------
+ * 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)
{
-
- 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;
- }
- if ( !XGI_XG21CheckLVDSMode( ModeNo , ModeIdIndex, pVBInfo) )
- {
- continue;
- }
- EModeCount++ ;
- }
+ 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;
+ }
+ if (!XGI_XG21CheckLVDSMode(ModeNo, ModeIdIndex, pVBInfo))
+ continue;
+
+ EModeCount++;
+ }
}
-/*(
-;-----------------------------------------------------------------------------
-;
-; 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
-;
-;-----------------------------------------------------------------------------
-*/
-void XGI_XG21Fun14Sub71(struct vb_device_info *pVBInfo, PX86_REGS pBiosArguments)
+
+/* ----------------------------------------------------------------------------
+ *
+ * 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)
{
- 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++ ;
-
- }
+ 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++;
+
+ }
}
-/*
-;-----------------------------------------------------------------------------
-;
-; 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
-;
-;-----------------------------------------------------------------------------
-*/
-void XGI_XG21Fun14Sub72(struct vb_device_info *pVBInfo, PX86_REGS pBiosArguments)
+
+/* ----------------------------------------------------------------------------
+ *
+ * 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 */
- }
-
- pBiosArguments->x.ax = 0x0014;
+ 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 */
+ }
+
+ pBiosArguments->x.ax = 0x0014;
}
-/*
-;-----------------------------------------------------------------------------
-; 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
-;-----------------------------------------------------------------------------
-*/
-void XGI_XG21Fun14Sub73(struct vb_device_info *pVBInfo, PX86_REGS pBiosArguments)
+/* ----------------------------------------------------------------------------
+ *
+ * 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;
- }
-
- pBiosArguments->x.ax = 0x0014;
+ 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;
+ }
+
+ pBiosArguments->x.ax = 0x0014;
}
-
void XGI_XG21Fun14(struct xgi_hw_device_info *pXGIHWDE, PX86_REGS pBiosArguments)
{
- 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;
- }
+ 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;
+ }
}
diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c
index e02722d..8d59182 100644
--- a/drivers/staging/xgifb/vb_init.c
+++ b/drivers/staging/xgifb/vb_init.c
@@ -15,10 +15,7 @@
#include <asm/io.h>
-
-
-
-unsigned char XGINew_ChannelAB, XGINew_DataBusWidth;
+static unsigned char XGINew_ChannelAB, XGINew_DataBusWidth;
unsigned short XGINew_DRAMType[17][5] = {
{0x0C, 0x0A, 0x02, 0x40, 0x39}, {0x0D, 0x0A, 0x01, 0x40, 0x48},
@@ -31,7 +28,7 @@ unsigned short XGINew_DRAMType[17][5] = {
{0x0B, 0x08, 0x01, 0x04, 0x20}, {0x0A, 0x08, 0x01, 0x02, 0x10},
{0x09, 0x08, 0x01, 0x01, 0x00} };
-unsigned short XGINew_SDRDRAM_TYPE[13][5] = {
+static unsigned short XGINew_SDRDRAM_TYPE[13][5] = {
{ 2, 12, 9, 64, 0x35},
{ 1, 13, 9, 64, 0x44},
{ 2, 12, 8, 32, 0x31},
@@ -46,19 +43,19 @@ unsigned short XGINew_SDRDRAM_TYPE[13][5] = {
{ 1, 10, 8, 4, 0x10},
{ 1, 9, 8, 2, 0x00} };
-unsigned short XGINew_DDRDRAM_TYPE[4][5] = {
+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} };
-unsigned short XGINew_DDRDRAM_TYPE340[4][5] = {
+static unsigned short XGINew_DDRDRAM_TYPE340[4][5] = {
{ 2, 13, 9, 64, 0x45},
{ 2, 12, 9, 32, 0x35},
{ 2, 12, 8, 16, 0x31},
{ 2, 11, 8, 8, 0x21} };
-unsigned short XGINew_DDRDRAM_TYPE20[12][5] = {
+static unsigned short XGINew_DDRDRAM_TYPE20[12][5] = {
{ 2, 14, 11, 128, 0x5D},
{ 2, 14, 10, 64, 0x59},
{ 2, 13, 11, 64, 0x4D},
@@ -89,8 +86,10 @@ 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 *);
-int XGINew_RAMType; /*int ModeIDOffset,StandTable,CRT1Table,ScreenOffset,REFIndex;*/
-unsigned long UNIROM; /* UNIROM */
+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,
@@ -106,2536 +105,2073 @@ 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);
-void DelayUS(unsigned long MicroSeconds)
+static void DelayUS(unsigned long MicroSeconds)
{
udelay(MicroSeconds);
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGIInitNew */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
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;
- 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 j, k ; */
+ struct XGI_DSReg *pSR;
- struct XGI_DSReg *pSR ;
+ unsigned long Temp;
- unsigned long Temp ;
+ pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase;
- pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase ;
+ pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress;
- pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress ;
+ pVBInfo->BaseAddr = (unsigned long) HwDeviceExtension->pjIOAddress;
- pVBInfo->BaseAddr = (unsigned long)HwDeviceExtension->pjIOAddress ;
+ pVideoMemory = (unsigned char *) pVBInfo->ROMAddr;
- pVideoMemory = (unsigned char *)pVBInfo->ROMAddr;
+ /* Newdebugcode(0x99); */
-// 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");
- /* if ( pVBInfo->ROMAddr == 0 ) */
- /* return( 0 ) ; */
+ XGINew_SetReg3((pVBInfo->BaseAddr + 0x12), 0x67); /* 3c2 <- 67 ,ynlai */
- if (pVBInfo->FBAddr == 0) {
- printk("\n pVBInfo->FBAddr == 0 ");
- return 0;
- }
-printk("1");
-if (pVBInfo->BaseAddr == 0) {
- printk("\npVBInfo->BaseAddr == 0 ");
- return 0;
-}
-printk("2");
+ pVBInfo->ISXPDOS = 0;
+ printk("3");
- XGINew_SetReg3( ( pVBInfo->BaseAddr + 0x12 ) , 0x67 ) ; /* 3c2 <- 67 ,ynlai */
+ if (!HwDeviceExtension->bIntegratedMMEnabled)
+ return 0; /* alan */
- pVBInfo->ISXPDOS = 0 ;
-printk("3");
+ printk("4");
-if ( !HwDeviceExtension->bIntegratedMMEnabled )
- return 0; /* alan */
+ /* VBIOSVersion[4] = 0x0; */
-printk("4");
+ /* 09/07/99 modify by domao */
- // VBIOSVersion[ 4 ] = 0x0 ;
+ 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");
- /* 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 < XG20) /* kuku 2004/06/25 */
+ XGI_GetVBType(pVBInfo); /* Run XGI_GetVBType before InitTo330Pointer */
-/*
- 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");
-
- 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");
+ InitTo330Pointer(HwDeviceExtension->jChipType, pVBInfo);
- XGINew_SetDRAMSize_340( HwDeviceExtension , pVBInfo) ;
-}
-printk("21");
+ /* ReadVBIOSData */
+ ReadVBIOSTablData(HwDeviceExtension->jChipType, pVBInfo);
- }
- } /* XG40 */
+ /* 1.Openkey */
+ XGINew_SetReg1(pVBInfo->P3c4, 0x05, 0x86);
+ printk("6");
-printk("22");
+ /* GetXG21Sense (GPIO) */
+ if (HwDeviceExtension->jChipType == XG21)
+ XGINew_GetXG21Sense(HwDeviceExtension, pVBInfo);
+ if (HwDeviceExtension->jChipType == XG27)
+ XGINew_GetXG27Sense(HwDeviceExtension, pVBInfo);
- /* 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 ) ;
-*/
+ printk("7");
-// 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 ) ;
-// }
+ /* 2.Reset Extended register */
- XGINew_SetReg1( pVBInfo->P3c4 , 0x21 , *pVBInfo->pSR21 ) ;
+ for (i = 0x06; i < 0x20; i++)
+ XGINew_SetReg1(pVBInfo->P3c4, i, 0);
-printk("23");
+ for (i = 0x21; i <= 0x27; i++)
+ XGINew_SetReg1(pVBInfo->P3c4, i, 0);
+ /* for(i = 0x06; i <= 0x27; i++) */
+ /* XGINew_SetReg1(pVBInfo->P3c4, i, 0); */
- XGINew_ChkSenseStatus ( HwDeviceExtension , pVBInfo ) ;
- XGINew_SetModeScratch ( HwDeviceExtension , pVBInfo ) ;
+ printk("8");
-printk("24");
+ 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);
-XGINew_SetReg1( pVBInfo->P3d4 , 0x8c , 0x87);
-XGINew_SetReg1( pVBInfo->P3c4 , 0x14 , 0x31);
-printk("25");
+ /* for (i = 0x30; i <= 0x3F; i++) */
+ /* XGINew_SetReg1(pVBInfo->P3d4, i, 0); */
-return 1;
-} /* end of init */
+ 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");
+
+ 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 ====================== */
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_GetXG20DRAMType */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
unsigned char XGINew_GetXG20DRAMType(struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo)
+ struct vb_device_info *pVBInfo)
{
- unsigned char data, temp;
-
- if ( HwDeviceExtension->jChipType < XG20 )
- {
- if ( *pVBInfo->pSoftSetting & SoftDRAMType )
- {
- data = *pVBInfo->pSoftSetting & 0x07 ;
- return( data ) ;
- }
- else
- {
- data = XGINew_GetReg1( pVBInfo->P3c4 , 0x39 ) & 0x02 ;
-
- if ( data == 0 )
- data = ( XGINew_GetReg1( pVBInfo->P3c4 , 0x3A ) & 0x02 ) >> 1 ;
-
- return( data ) ;
- }
- }
- else if ( HwDeviceExtension->jChipType == XG27 )
- {
- if ( *pVBInfo->pSoftSetting & SoftDRAMType )
- {
- data = *pVBInfo->pSoftSetting & 0x07 ;
- return( data ) ;
- }
- temp = XGINew_GetReg1( pVBInfo->P3c4 , 0x3B ) ;
-
- if (( temp & 0x88 )==0x80) /* SR3B[7][3]MAA15 MAA11 (Power on Trapping) */
- data = 0 ; /*DDR*/
- else
- 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 */
-// HOTPLUG_SUPPORT
-// for current XG20 & XG21, GPIOH is floating, driver will fix DDR temporarily
- if ( temp & 0x01 ) /* DVI read GPIOH */
- data = 1 ; /*DDRII*/
- else
- data = 0 ; /*DDR*/
-//~HOTPLUG_SUPPORT
- XGINew_SetRegOR( pVBInfo->P3d4 , 0xB4 , 0x02 ) ;
- return( data ) ;
- }
- else
- {
- data = XGINew_GetReg1( pVBInfo->P3d4 , 0x97 ) & 0x01 ;
-
- if ( data == 1 )
- data ++ ;
-
- return( data );
- }
+ unsigned char data, temp;
+
+ if (HwDeviceExtension->jChipType < XG20) {
+ if (*pVBInfo->pSoftSetting & SoftDRAMType) {
+ data = *pVBInfo->pSoftSetting & 0x07;
+ return data;
+ } else {
+ data = XGINew_GetReg1(pVBInfo->P3c4, 0x39) & 0x02;
+
+ if (data == 0)
+ data = (XGINew_GetReg1(pVBInfo->P3c4, 0x3A) & 0x02) >> 1;
+
+ return data;
+ }
+ } else if (HwDeviceExtension->jChipType == XG27) {
+ if (*pVBInfo->pSoftSetting & SoftDRAMType) {
+ data = *pVBInfo->pSoftSetting & 0x07;
+ return data;
+ }
+ temp = XGINew_GetReg1(pVBInfo->P3c4, 0x3B);
+
+ if ((temp & 0x88) == 0x80) /* SR3B[7][3]MAA15 MAA11 (Power on Trapping) */
+ data = 0; /* DDR */
+ else
+ 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 */
+ /* HOTPLUG_SUPPORT */
+ /* for current XG20 & XG21, GPIOH is floating, driver will fix DDR temporarily */
+ if (temp & 0x01) /* DVI read GPIOH */
+ data = 1; /* DDRII */
+ else
+ data = 0; /* DDR */
+ /* ~HOTPLUG_SUPPORT */
+ XGINew_SetRegOR(pVBInfo->P3d4, 0xB4, 0x02);
+ return data;
+ } else {
+ data = XGINew_GetReg1(pVBInfo->P3d4, 0x97) & 0x01;
+
+ if (data == 1)
+ data++;
+
+ return data;
+ }
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_Get310DRAMType */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-unsigned char XGINew_Get310DRAMType(struct vb_device_info *pVBInfo)
+static unsigned char XGINew_Get310DRAMType(struct vb_device_info *pVBInfo)
{
- unsigned char data ;
+ unsigned char data;
- /* index = XGINew_GetReg1( pVBInfo->P3c4 , 0x1A ) ; */
- /* index &= 07 ; */
+ /* index = XGINew_GetReg1(pVBInfo->P3c4, 0x1A); */
+ /* index &= 07; */
- if ( *pVBInfo->pSoftSetting & SoftDRAMType )
- data = *pVBInfo->pSoftSetting & 0x03 ;
- else
- data = XGINew_GetReg1( pVBInfo->P3c4 , 0x3a ) & 0x03 ;
+ if (*pVBInfo->pSoftSetting & SoftDRAMType)
+ data = *pVBInfo->pSoftSetting & 0x03;
+ else
+ data = XGINew_GetReg1(pVBInfo->P3c4, 0x3a) & 0x03;
- return( data ) ;
+ return data;
}
-
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_Delay15us */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
/*
void XGINew_Delay15us(unsigned long ulMicrsoSec)
{
}
*/
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_SDR_MRS */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_SDR_MRS(struct vb_device_info *pVBInfo)
+static void XGINew_SDR_MRS(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 ) ; */
+ 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); */
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_DDR1x_MRS_340 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_DDR1x_MRS_340(unsigned long P3c4, struct vb_device_info *pVBInfo)
+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 ) ;
-
- 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 ) ;
- }
-
- 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 ) ;
-}
+ XGINew_SetReg1(P3c4, 0x18, 0x01);
+ XGINew_SetReg1(P3c4, 0x19, 0x20);
+ XGINew_SetReg1(P3c4, 0x16, 0x00);
+ XGINew_SetReg1(P3c4, 0x16, 0x80);
+
+ 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);
+ }
+ 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);
+}
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_DDR2x_MRS_340 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_DDR2x_MRS_340(unsigned long P3c4, struct vb_device_info *pVBInfo)
+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 ) ;
+ 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);
}
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_DDRII_Bootup_XG27 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_DDRII_Bootup_XG27(struct xgi_hw_device_info *HwDeviceExtension,
- unsigned long P3c4, struct vb_device_info *pVBInfo)
+static void XGINew_DDRII_Bootup_XG27(
+ struct xgi_hw_device_info *HwDeviceExtension,
+ unsigned long P3c4, struct vb_device_info *pVBInfo)
{
- unsigned long P3d4 = P3c4 + 0x10 ;
- XGINew_RAMType = ( int )XGINew_GetXG20DRAMType( HwDeviceExtension , pVBInfo ) ;
- 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 ) ;
-
+ unsigned long P3d4 = P3c4 + 0x10;
+ XGINew_RAMType = (int) XGINew_GetXG20DRAMType(HwDeviceExtension, pVBInfo);
+ 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);
}
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_DDR2_MRS_XG20 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_DDR2_MRS_XG20(struct xgi_hw_device_info *HwDeviceExtension,
- unsigned long P3c4, struct vb_device_info *pVBInfo)
+
+static void XGINew_DDR2_MRS_XG20(struct xgi_hw_device_info *HwDeviceExtension,
+ 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 , 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 ) ;
+ 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, 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);
}
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_DDR2_MRS_XG20 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_DDR2_MRS_XG27(struct xgi_hw_device_info *HwDeviceExtension,
- unsigned long P3c4, struct vb_device_info *pVBInfo)
+#if 0
+static void XGINew_DDR2_MRS_XG27(struct xgi_hw_device_info *HwDeviceExtension,
+ 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 ) ;
+ unsigned long P3d4 = P3c4 + 0x10;
- XGINew_SetReg1( P3c4 , 0x16 , 0x10 ) ;
- DelayUS( 15 ) ; ////06/11/23 XG27 A0 for CKE enable
- XGINew_SetReg1( P3c4 , 0x16 , 0x90 ) ;
+ XGINew_RAMType = (int) XGINew_GetXG20DRAMType(HwDeviceExtension, pVBInfo);
+ XGINew_SetMemoryClock(HwDeviceExtension , pVBInfo);
- XGINew_SetReg1( P3c4 , 0x18 , 0x00 ) ; /* EMRS3 */
- XGINew_SetReg1( P3c4 , 0x19 , 0xC0 ) ;
+ XGINew_SetReg1(P3d4, 0x97, 0x11); /* CR97 */
+ DelayUS(200);
+ XGINew_SetReg1(P3c4, 0x18, 0x00); /* EMRS2 */
+ XGINew_SetReg1(P3c4, 0x19, 0x80);
- XGINew_SetReg1( P3c4 , 0x16 , 0x00 ) ;
- DelayUS( 15 ) ; ////06/11/22 XG27 A0
- XGINew_SetReg1( P3c4 , 0x16 , 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 , 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 , 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 , 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/22 XG27 A0 */
+ XGINew_SetReg1(P3c4, 0x16, 0x80);
- XGINew_SetReg1( P3c4 , 0x16 , 0x00 ) ;
- DelayUS( 15 ) ; ////06/11/23 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 */
- 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, 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, 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, 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, 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, 0x16, 0x00);
+ DelayUS(30);
+ XGINew_SetReg1(P3c4, 0x16, 0x80);
- XGINew_SetReg1( P3c4 , 0x18 , 0x00 );
- XGINew_SetReg1( P3c4 , 0x19 , 0x40 );
+ XGINew_SetReg1(P3c4, 0x18, 0x00);
+ XGINew_SetReg1(P3c4, 0x19, 0x40);
- XGINew_SetReg1( P3c4 , 0x16 , 0x00 ) ;
- DelayUS( 30 ) ;
- XGINew_SetReg1( P3c4 , 0x16 , 0x80 ) ;
+ 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 */
+ DelayUS(15); /* Start Auto-PreCharge */
+ XGINew_SetReg1(P3c4, 0x1B, 0x04); /* SR1B */
+ DelayUS(200);
+ XGINew_SetReg1(P3c4, 0x1B, 0x03); /* SR1B */
}
+#endif
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_DDR1x_DefaultRegister */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_DDR1x_DefaultRegister(struct xgi_hw_device_info *HwDeviceExtension,
- unsigned long Port, struct vb_device_info *pVBInfo)
+static void XGINew_DDR1x_DefaultRegister(
+ struct xgi_hw_device_info *HwDeviceExtension,
+ unsigned long Port, struct vb_device_info *pVBInfo)
{
- unsigned long P3d4 = Port ,
- P3c4 = Port - 0x10 ;
-
- 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 */
-
- XGINew_SetReg1( P3d4 , 0x98 , 0x01 ) ;
- XGINew_SetReg1( P3d4 , 0x9A , 0x02 ) ;
-
- XGINew_DDR1x_MRS_XG20( P3c4 , pVBInfo) ;
- }
- else
- {
- XGINew_SetMemoryClock( HwDeviceExtension , pVBInfo ) ;
-
- 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:
- 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 */
- break ;
- }
-
- XGINew_SetReg1( P3d4 , 0x97 , 0x00 ) ;
- XGINew_SetReg1( P3d4 , 0x98 , 0x01 ) ;
- XGINew_SetReg1( P3d4 , 0x9A , 0x02 ) ;
- XGINew_DDR1x_MRS_340( P3c4 , pVBInfo ) ;
- }
+ unsigned long P3d4 = Port, P3c4 = Port - 0x10;
+
+ 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 */
+
+ XGINew_SetReg1(P3d4, 0x98, 0x01);
+ XGINew_SetReg1(P3d4, 0x9A, 0x02);
+
+ XGINew_DDR1x_MRS_XG20(P3c4, pVBInfo);
+ } else {
+ XGINew_SetMemoryClock(HwDeviceExtension, pVBInfo);
+
+ 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:
+ 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 */
+ break;
+ }
+
+ XGINew_SetReg1(P3d4, 0x97, 0x00);
+ XGINew_SetReg1(P3d4, 0x98, 0x01);
+ XGINew_SetReg1(P3d4, 0x9A, 0x02);
+ XGINew_DDR1x_MRS_340(P3c4, pVBInfo);
+ }
}
+#if 0
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_DDR2x_DefaultRegister */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_DDR2x_DefaultRegister(struct xgi_hw_device_info *HwDeviceExtension,
- unsigned long Port, struct vb_device_info *pVBInfo)
+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 ) ;
-}
+ unsigned long P3d4 = Port ,
+ P3c4 = Port - 0x10;
+ XGINew_SetMemoryClock(HwDeviceExtension, pVBInfo);
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_DDR2_DefaultRegister */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_DDR2_DefaultRegister(struct xgi_hw_device_info *HwDeviceExtension,
- unsigned long Port, struct vb_device_info *pVBInfo)
-{
- 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 */
- if ( HwDeviceExtension->jChipType == XG27 )
- XGINew_SetReg1( P3d4 , 0x82 , pVBInfo->CR40[ 11 ][ XGINew_RAMType ] ) ; /* CR82 */
- else
- XGINew_SetReg1( P3d4 , 0x82 , 0xA8 ) ; /* CR82 */
-
- XGINew_SetReg1( P3d4 , 0x98 , 0x01 ) ;
- XGINew_SetReg1( P3d4 , 0x9A , 0x02 ) ;
- if ( HwDeviceExtension->jChipType == XG27 )
- XGINew_DDRII_Bootup_XG27( HwDeviceExtension , P3c4 , pVBInfo) ;
- else
- XGINew_DDR2_MRS_XG20( HwDeviceExtension , P3c4, 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);
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_SetDRAMDefaultRegister340 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_SetDRAMDefaultRegister340(struct xgi_hw_device_info *HwDeviceExtension,
- unsigned long Port, struct vb_device_info *pVBInfo)
-{
- unsigned char temp, temp1, temp2, temp3 ,
- i , j , k ;
-
- 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 ] ) ;
-
- temp2 = 0 ;
- for( i = 0 ; i < 4 ; i++ )
- {
- temp = pVBInfo->CR6B[ XGINew_RAMType ][ i ] ; /* CR6B DQS fine tune delay */
- 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 */
- temp2 &= 0xF0 ;
- temp2 += 0x10 ;
- }
- }
-
- temp2 = 0 ;
- for( i = 0 ; i < 4 ; i++ )
- {
- temp = pVBInfo->CR6E[ XGINew_RAMType ][ i ] ; /* CR6E DQM fine tune delay */
- 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 */
- temp2 &= 0xF0 ;
- temp2 += 0x10 ;
- }
- }
-
- temp3 = 0 ;
- for( k = 0 ; k < 4 ; k++ )
- {
- XGINew_SetRegANDOR( 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 */
- temp2 &= 0xF8 ;
- temp2 += 0x08 ;
- }
- }
- temp3 += 0x01 ;
- }
-
- XGINew_SetReg1( P3d4 , 0x80 , pVBInfo->CR40[ 9 ][ XGINew_RAMType ] ) ; /* CR80 */
- XGINew_SetReg1( 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 */
- temp2 &= 0xF0 ;
- temp2 += 0x10 ;
- }
-
- temp = pVBInfo->CR89[ XGINew_RAMType ][ 1 ] ;
- temp1 = temp & 0x03 ;
- temp2 |= temp1 ;
- XGINew_SetReg1( 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 */
-
- if ( HwDeviceExtension->jChipType == XG27 )
- XGINew_SetReg1( P3d4 , 0x8F , *pVBInfo->pCR8F ) ; /* CR8F */
-
- for( j = 0 ; j <= 6 ; j++ )
- XGINew_SetReg1( P3d4 , ( 0x90 + j ) , pVBInfo->CR40[ 14 + j ][ XGINew_RAMType ] ) ; /* CR90 - CR96 */
-
- for( j = 0 ; j <= 2 ; j++ )
- XGINew_SetReg1( P3d4 , ( 0xC3 + j ) , pVBInfo->CR40[ 21 + j ][ XGINew_RAMType ] ) ; /* CRC3 - CRC5 */
-
- for( j = 0 ; j < 2 ; j++ )
- XGINew_SetReg1( P3d4 , ( 0x8A + j ) , pVBInfo->CR40[ 1 + j ][ XGINew_RAMType ] ) ; /* CR8A - CR8B */
-
- if ( ( HwDeviceExtension->jChipType == XG41 ) || ( HwDeviceExtension->jChipType == XG42 ) )
- XGINew_SetReg1( P3d4 , 0x8C , 0x87 ) ;
-
- XGINew_SetReg1( 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 */
- if ( XGINew_RAMType )
- {
- //XGINew_SetReg1( P3c4 , 0x17 , 0xC0 ) ; /* SR17 DDRII */
- XGINew_SetReg1( P3c4 , 0x17 , 0x80 ) ; /* SR17 DDRII */
- if ( HwDeviceExtension->jChipType == XG27 )
- XGINew_SetReg1( P3c4 , 0x17 , 0x02 ) ; /* SR17 DDRII */
-
- }
- else
- XGINew_SetReg1( P3c4 , 0x17 , 0x00 ) ; /* SR17 DDR */
- XGINew_SetReg1( 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 */
- XGINew_DDR2_DefaultRegister( HwDeviceExtension, P3d4, pVBInfo ) ;
- }
- XGINew_SetReg1( P3c4 , 0x1B , pVBInfo->SR15[ 3 ][ XGINew_RAMType ] ) ; /* SR1B */
+ XGINew_DDR2x_MRS_340(P3c4, pVBInfo);
}
+#endif
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_DDR_MRS */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_DDR_MRS(struct vb_device_info *pVBInfo)
+static void XGINew_DDR2_DefaultRegister(
+ struct xgi_hw_device_info *HwDeviceExtension,
+ unsigned long Port, 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);
- }
-*/
+ 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 */
+ if (HwDeviceExtension->jChipType == XG27)
+ XGINew_SetReg1(P3d4, 0x82, pVBInfo->CR40[11][XGINew_RAMType]); /* CR82 */
+ else
+ XGINew_SetReg1(P3d4, 0x82, 0xA8); /* CR82 */
+
+ XGINew_SetReg1(P3d4, 0x98, 0x01);
+ XGINew_SetReg1(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(
+ struct xgi_hw_device_info *HwDeviceExtension,
+ unsigned long Port, struct vb_device_info *pVBInfo)
+{
+ unsigned char temp, temp1, temp2, temp3, i, j, k;
+
+ 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]);
+
+ temp2 = 0;
+ for (i = 0; i < 4; i++) {
+ temp = pVBInfo->CR6B[XGINew_RAMType][i]; /* CR6B DQS fine tune delay */
+ 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 */
+ temp2 &= 0xF0;
+ temp2 += 0x10;
+ }
+ }
-/* check if read cache pointer is correct */
+ temp2 = 0;
+ for (i = 0; i < 4; i++) {
+ temp = pVBInfo->CR6E[XGINew_RAMType][i]; /* CR6E DQM fine tune delay */
+ 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 */
+ temp2 &= 0xF0;
+ temp2 += 0x10;
+ }
+ }
+ temp3 = 0;
+ for (k = 0; k < 4; k++) {
+ XGINew_SetRegANDOR(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 */
+ temp2 &= 0xF8;
+ temp2 += 0x08;
+ }
+ }
+ temp3 += 0x01;
+ }
+ XGINew_SetReg1(P3d4, 0x80, pVBInfo->CR40[9][XGINew_RAMType]); /* CR80 */
+ XGINew_SetReg1(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 */
+ temp2 &= 0xF0;
+ temp2 += 0x10;
+ }
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_VerifyMclk */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_VerifyMclk(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
+ temp = pVBInfo->CR89[XGINew_RAMType][1];
+ temp1 = temp & 0x03;
+ temp2 |= temp1;
+ XGINew_SetReg1(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 */
+
+ if (HwDeviceExtension->jChipType == XG27)
+ XGINew_SetReg1(P3d4, 0x8F, *pVBInfo->pCR8F); /* CR8F */
+
+ for (j = 0; j <= 6; j++)
+ XGINew_SetReg1(P3d4, (0x90 + j),
+ pVBInfo->CR40[14 + j][XGINew_RAMType]); /* CR90 - CR96 */
+
+ for (j = 0; j <= 2; j++)
+ XGINew_SetReg1(P3d4, (0xC3 + j),
+ pVBInfo->CR40[21 + j][XGINew_RAMType]); /* CRC3 - CRC5 */
+
+ for (j = 0; j < 2; j++)
+ XGINew_SetReg1(P3d4, (0x8A + j),
+ pVBInfo->CR40[1 + j][XGINew_RAMType]); /* CR8A - CR8B */
+
+ if ((HwDeviceExtension->jChipType == XG41) || (HwDeviceExtension->jChipType == XG42))
+ XGINew_SetReg1(P3d4, 0x8C, 0x87);
+
+ XGINew_SetReg1(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 */
+ if (XGINew_RAMType) {
+ /* XGINew_SetReg1(P3c4, 0x17, 0xC0); */ /* SR17 DDRII */
+ XGINew_SetReg1(P3c4, 0x17, 0x80); /* SR17 DDRII */
+ if (HwDeviceExtension->jChipType == XG27)
+ XGINew_SetReg1(P3c4, 0x17, 0x02); /* SR17 DDRII */
+
+ } else {
+ XGINew_SetReg1(P3c4, 0x17, 0x00); /* SR17 DDR */
+ }
+ XGINew_SetReg1(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 */
+ 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 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 ;
- }
- }
- }
+ 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);
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_SetDRAMSize_340 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_SetDRAMSize_340(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
-{
- unsigned short data ;
+ Temp = XGINew_GetReg1(pVBInfo->P3c4, 0x3C);
+ Temp |= 0x01; /* MCLK reset */
- pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase ;
- pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress ;
+ Temp = XGINew_GetReg1(pVBInfo->P3c4, 0x3C);
+ Temp &= 0xFE; /* MCLK normal operation */
- XGISetModeNew( HwDeviceExtension , 0x2e ) ;
+ XGINew_SetReg1(pVBInfo->P3c4, 0x21, SR21);
+ pVideoMemory[16 + j] = j;
+ if (pVideoMemory[16 + j] == j) {
+ pVideoMemory[j] = j;
+ break;
+ }
+ }
+ }
+}
- data = XGINew_GetReg1( pVBInfo->P3c4 , 0x21 ) ;
- XGINew_SetReg1(pVBInfo->P3c4, 0x21, (unsigned short)(data & 0xDF)); /* disable read cache */
- XGI_DisplayOff( HwDeviceExtension, pVBInfo );
+void XGINew_SetDRAMSize_340(struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short data;
- /*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 */
-}
+ pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase;
+ pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress;
+ XGISetModeNew(HwDeviceExtension, 0x2e);
-/* --------------------------------------------------------------------- */
-/* Function : */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_SetDRAMSize_310(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
+ 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 ;
+ unsigned short data;
+ pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase, pVBInfo->FBAddr
+ = HwDeviceExtension->pjVideoMemoryAddress;
#ifdef XGI301
- /* XGINew_SetReg1( pVBInfo->P3d4 , 0x30 , 0x40 ) ; */
+ /* 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 ) ;
+ 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 */
+ 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 */
- if ( XGINew_Get310DRAMType( pVBInfo ) < 2 )
- {
- XGINew_SDRSizing( pVBInfo ) ;
- }
- else
- {
- XGINew_DDRSizing( pVBInfo) ;
- }
+ 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_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 */
+ XGINew_EnableRefresh(HwDeviceExtension, pVBInfo);
+ data = XGINew_GetReg1(pVBInfo->P3c4, 0x21);
+ XGINew_SetReg1(pVBInfo->P3c4, 0x21, (unsigned short) (data | 0x20)); /* enable read cache */
}
-
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_SetDRAMModeRegister340 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-
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 ) ;
+ 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);
}
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_SetDRAMModeRegister */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
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 ) ;
- }
+ if (XGINew_Get310DRAMType(pVBInfo) < 2) {
+ XGINew_SDR_MRS(pVBInfo);
+ } else {
+ /* SR16 <- 0F,CF,0F,8F */
+ XGINew_DDR_MRS(pVBInfo);
+ }
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_DisableRefresh */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_DisableRefresh(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
+void XGINew_DisableRefresh(struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
{
- unsigned short data ;
+ unsigned short data;
-
- data = XGINew_GetReg1( pVBInfo->P3c4 , 0x1B ) ;
- data &= 0xF8 ;
- XGINew_SetReg1( pVBInfo->P3c4 , 0x1B , data ) ;
+ data = XGINew_GetReg1(pVBInfo->P3c4, 0x1B);
+ data &= 0xF8;
+ XGINew_SetReg1(pVBInfo->P3c4, 0x1B, data);
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_EnableRefresh */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_EnableRefresh(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
+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 */
-
+ XGINew_SetReg1(pVBInfo->P3c4, 0x1B, pVBInfo->SR15[3][XGINew_RAMType]); /* SR1B */
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_DisableChannelInterleaving */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_DisableChannelInterleaving(int index,
- unsigned short XGINew_DDRDRAM_TYPE[][5],
- struct vb_device_info *pVBInfo)
+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 ) ;
+ 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);
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_SetDRAMSizingType */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_SetDRAMSizingType(int index,
- unsigned short DRAMTYPE_TABLE[][5],
- struct vb_device_info *pVBInfo)
+static void XGINew_SetDRAMSizingType(int index,
+ unsigned short DRAMTYPE_TABLE[][5],
+ struct vb_device_info *pVBInfo)
{
- unsigned short data;
+ unsigned short data;
- data = DRAMTYPE_TABLE[ index ][ 4 ] ;
- XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x13 , 0x80 , data ) ;
- DelayUS( 15 ) ;
- /* should delay 50 ns */
+ data = DRAMTYPE_TABLE[index][4];
+ XGINew_SetRegANDOR(pVBInfo->P3c4, 0x13, 0x80, data);
+ DelayUS(15);
+ /* should delay 50 ns */
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_CheckBusWidth_310 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
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 */
- }
- }
- }
+ 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 */
+ }
+ }
+ }
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_SetRank */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-int XGINew_SetRank(int index,
- unsigned char RankNo,
- unsigned char XGINew_ChannelAB,
- unsigned short DRAMTYPE_TABLE[][5],
- struct vb_device_info *pVBInfo)
+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 ) ;
-}
+ unsigned short data;
+ int RankSize;
+ if ((RankNo == 2) && (DRAMTYPE_TABLE[index][0] == 2))
+ return 0;
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_SetDDRChannel */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-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 ) ;
-}
+ RankSize = DRAMTYPE_TABLE[index][3] / 2 * XGINew_DataBusWidth / 32;
+ if ((RankNo * RankSize) <= 128) {
+ data = 0;
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_CheckColumn */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-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 ) ;
-}
+ 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;
+ }
+}
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_CheckBanks */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-int XGINew_CheckBanks(int index,
- unsigned short DRAMTYPE_TABLE[][5],
- struct vb_device_info *pVBInfo)
+static int XGINew_SetDDRChannel(int index, unsigned char ChannelNo,
+ unsigned char XGINew_ChannelAB,
+ 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 ) ;
+ 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;
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_CheckRank */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-int XGINew_CheckRank(int RankNo, int index,
- unsigned short DRAMTYPE_TABLE[][5],
- struct vb_device_info *pVBInfo)
+ /* 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 ] + 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 );
+ 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;
+ }
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_CheckDDRRank */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-int XGINew_CheckDDRRank(int RankNo, int index,
- unsigned short DRAMTYPE_TABLE[][5],
- struct vb_device_info *pVBInfo)
+ 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 ;
+ 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 = 1 << (DRAMTYPE_TABLE[index][2] + DRAMTYPE_TABLE[index][1]
+ + DRAMTYPE_TABLE[index][0] + XGINew_DataBusWidth / 64
+ + RankNo);
- Increment += Increment / 2 ;
+ 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;
+ 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 + 1)) == 0x456789AB)
+ return 1;
- if ((*(unsigned long *)(pVBInfo->FBAddr + 0)) == 0x01234567)
- return 0;
+ 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 ) ;
+ 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 ) ;
+ return 1;
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_CheckRanks */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-int XGINew_CheckRanks(int RankNo, int index,
- unsigned short DRAMTYPE_TABLE[][5],
- struct vb_device_info *pVBInfo)
+static int XGINew_CheckRanks(int RankNo, int index,
+ unsigned short DRAMTYPE_TABLE[][5],
+ struct vb_device_info *pVBInfo)
{
- int r ;
+ int r;
- for( r = RankNo ; r >= 1 ; r-- )
- {
- if ( !XGINew_CheckRank( r , index , DRAMTYPE_TABLE, pVBInfo ) )
- return( 0 ) ;
- }
+ 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_CheckBanks(index, DRAMTYPE_TABLE, pVBInfo))
+ return 0;
- if ( !XGINew_CheckColumn( index , DRAMTYPE_TABLE, pVBInfo ) )
- return( 0 ) ;
+ if (!XGINew_CheckColumn(index, DRAMTYPE_TABLE, pVBInfo))
+ return 0;
- return( 1 ) ;
+ return 1;
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_CheckDDRRanks */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-int XGINew_CheckDDRRanks(int RankNo, int index,
- unsigned short DRAMTYPE_TABLE[][5],
- struct vb_device_info *pVBInfo)
+static int XGINew_CheckDDRRanks(int RankNo, int index,
+ unsigned short DRAMTYPE_TABLE[][5],
+ struct vb_device_info *pVBInfo)
{
- int r ;
+ int r;
- for( r = RankNo ; r >= 1 ; r-- )
- {
- if ( !XGINew_CheckDDRRank( r , index , DRAMTYPE_TABLE, pVBInfo ) )
- return( 0 ) ;
- }
+ 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_CheckBanks(index, DRAMTYPE_TABLE, pVBInfo))
+ return 0;
- if ( !XGINew_CheckColumn( index , DRAMTYPE_TABLE, pVBInfo ) )
- return( 0 ) ;
+ if (!XGINew_CheckColumn(index, DRAMTYPE_TABLE, pVBInfo))
+ return 0;
- return( 1 ) ;
+ return 1;
}
-
-/* --------------------------------------------------------------------- */
-/* Function : */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
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 ) ;
+ 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;
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_SetDRAMSizeReg */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-unsigned short XGINew_SetDRAMSizeReg(int index,
- unsigned short DRAMTYPE_TABLE[][5],
- struct vb_device_info *pVBInfo)
+static unsigned short XGINew_SetDRAMSizeReg(int index,
+ unsigned short DRAMTYPE_TABLE[][5],
+ struct vb_device_info *pVBInfo)
{
- unsigned short data = 0 , memsize = 0;
- int RankSize ;
- unsigned char ChannelNo ;
+ unsigned short data = 0, memsize = 0;
+ int RankSize;
+ unsigned char ChannelNo;
- RankSize = DRAMTYPE_TABLE[ index ][ 3 ] * XGINew_DataBusWidth / 32 ;
- data = XGINew_GetReg1( pVBInfo->P3c4 , 0x13 ) ;
- data &= 0x80 ;
+ RankSize = DRAMTYPE_TABLE[index][3] * XGINew_DataBusWidth / 32;
+ data = XGINew_GetReg1(pVBInfo->P3c4, 0x13);
+ data &= 0x80;
- if ( data == 0x80 )
- RankSize *= 2 ;
+ if (data == 0x80)
+ RankSize *= 2;
- data = 0 ;
+ data = 0;
- if( XGINew_ChannelAB == 3 )
- ChannelNo = 4 ;
- else
- ChannelNo = XGINew_ChannelAB ;
+ if (XGINew_ChannelAB == 3)
+ ChannelNo = 4;
+ else
+ ChannelNo = XGINew_ChannelAB;
- if ( ChannelNo * RankSize <= 256 )
- {
- while( ( RankSize >>= 1 ) > 0 )
- {
- data += 0x10 ;
- }
+ if (ChannelNo * RankSize <= 256) {
+ while ((RankSize >>= 1) > 0)
+ data += 0x10;
- memsize = data >> 4 ;
+ memsize = data >> 4;
- /* [2004/03/25] Vicent, Fix DRAM Sizing Error */
- XGINew_SetReg1( pVBInfo->P3c4 , 0x14 , ( XGINew_GetReg1( pVBInfo->P3c4 , 0x14 ) & 0x0F ) | ( data & 0xF0 ) ) ;
+ /* [2004/03/25] Vicent, Fix DRAM Sizing Error */
+ XGINew_SetReg1(pVBInfo->P3c4, 0x14, (XGINew_GetReg1(pVBInfo->P3c4, 0x14) & 0x0F) | (data & 0xF0));
- /* data |= XGINew_ChannelAB << 2 ; */
- /* data |= ( XGINew_DataBusWidth / 64 ) << 1 ; */
- /* XGINew_SetReg1( pVBInfo->P3c4 , 0x14 , data ) ; */
+ /* data |= XGINew_ChannelAB << 2; */
+ /* data |= (XGINew_DataBusWidth / 64) << 1; */
+ /* XGINew_SetReg1(pVBInfo->P3c4, 0x14, data); */
- /* should delay */
- /* XGINew_SetDRAMModeRegister340( pVBInfo ) ; */
- }
- return( memsize ) ;
+ /* should delay */
+ /* XGINew_SetDRAMModeRegister340(pVBInfo); */
+ }
+ return memsize;
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_SetDRAMSize20Reg */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-unsigned short XGINew_SetDRAMSize20Reg(int index,
- unsigned short DRAMTYPE_TABLE[][5],
- struct vb_device_info *pVBInfo)
+static unsigned short XGINew_SetDRAMSize20Reg(int index,
+ unsigned short DRAMTYPE_TABLE[][5],
+ struct vb_device_info *pVBInfo)
{
- unsigned short data = 0 , memsize = 0;
- int RankSize ;
- unsigned char ChannelNo ;
+ unsigned short data = 0, memsize = 0;
+ int RankSize;
+ unsigned char ChannelNo;
- RankSize = DRAMTYPE_TABLE[ index ][ 3 ] * XGINew_DataBusWidth / 8 ;
- data = XGINew_GetReg1( pVBInfo->P3c4 , 0x13 ) ;
- data &= 0x80 ;
+ RankSize = DRAMTYPE_TABLE[index][3] * XGINew_DataBusWidth / 8;
+ data = XGINew_GetReg1(pVBInfo->P3c4, 0x13);
+ data &= 0x80;
- if ( data == 0x80 )
- RankSize *= 2 ;
+ if (data == 0x80)
+ RankSize *= 2;
- data = 0 ;
+ data = 0;
- if( XGINew_ChannelAB == 3 )
- ChannelNo = 4 ;
- else
- ChannelNo = XGINew_ChannelAB ;
+ if (XGINew_ChannelAB == 3)
+ ChannelNo = 4;
+ else
+ ChannelNo = XGINew_ChannelAB;
- if ( ChannelNo * RankSize <= 256 )
- {
- while( ( RankSize >>= 1 ) > 0 )
- {
- data += 0x10 ;
- }
+ if (ChannelNo * RankSize <= 256) {
+ while ((RankSize >>= 1) > 0)
+ data += 0x10;
- memsize = data >> 4 ;
+ 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 ) ;
+ /* [2004/03/25] Vicent, Fix DRAM Sizing Error */
+ XGINew_SetReg1(pVBInfo->P3c4, 0x14, (XGINew_GetReg1(pVBInfo->P3c4, 0x14) & 0x0F) | (data & 0xF0));
+ DelayUS(15);
- /* data |= XGINew_ChannelAB << 2 ; */
- /* data |= ( XGINew_DataBusWidth / 64 ) << 1 ; */
- /* XGINew_SetReg1( pVBInfo->P3c4 , 0x14 , data ) ; */
+ /* data |= XGINew_ChannelAB << 2; */
+ /* data |= (XGINew_DataBusWidth / 64) << 1; */
+ /* XGINew_SetReg1(pVBInfo->P3c4, 0x14, data); */
- /* should delay */
- /* XGINew_SetDRAMModeRegister340( pVBInfo ) ; */
- }
- return( memsize ) ;
+ /* should delay */
+ /* XGINew_SetDRAMModeRegister340(pVBInfo); */
+ }
+ return memsize;
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_ReadWriteRest */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-int XGINew_ReadWriteRest(unsigned short StopAddr, unsigned short StartAddr,
- struct vb_device_info *pVBInfo)
+static int XGINew_ReadWriteRest(unsigned short StopAddr,
+ unsigned short StartAddr, struct vb_device_info *pVBInfo)
{
- int i ;
- unsigned long Position = 0 ;
-
- *((unsigned long *)(pVBInfo->FBAddr + Position)) = Position;
+ int i;
+ unsigned long Position = 0;
- for( i = StartAddr ; i <= StopAddr ; i++ )
- {
- Position = 1 << i ;
- *((unsigned long *)(pVBInfo->FBAddr + Position)) = Position;
- }
+ *((unsigned long *) (pVBInfo->FBAddr + Position)) = Position;
- DelayUS( 500 ) ; /* [Vicent] 2004/04/16. Fix #1759 Memory Size error in Multi-Adapter. */
+ for (i = StartAddr; i <= StopAddr; i++) {
+ Position = 1 << i;
+ *((unsigned long *) (pVBInfo->FBAddr + Position)) = Position;
+ }
- Position = 0 ;
+ DelayUS(500); /* [Vicent] 2004/04/16. Fix #1759 Memory Size error in Multi-Adapter. */
- if ((*(unsigned long *)(pVBInfo->FBAddr + Position)) != Position)
- return 0;
+ Position = 0;
- for( i = StartAddr ; i <= StopAddr ; i++ )
- {
- Position = 1 << i ;
- if ((*(unsigned long *)(pVBInfo->FBAddr + Position)) != Position)
+ if ((*(unsigned long *) (pVBInfo->FBAddr + Position)) != Position)
return 0;
- }
- return( 1 ) ;
-}
+ for (i = StartAddr; i <= StopAddr; i++) {
+ Position = 1 << i;
+ if ((*(unsigned long *) (pVBInfo->FBAddr + Position)) != Position)
+ return 0;
+ }
+ return 1;
+}
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_CheckFrequence */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-unsigned char XGINew_CheckFrequence(struct vb_device_info *pVBInfo)
+static unsigned char XGINew_CheckFrequence(struct vb_device_info *pVBInfo)
{
- unsigned char data ;
-
- data = XGINew_GetReg1( pVBInfo->P3d4 , 0x97 ) ;
-
- if ( ( data & 0x10 ) == 0 )
- {
- data = XGINew_GetReg1( pVBInfo->P3c4 , 0x39 ) ;
- data = ( data & 0x02 ) >> 1 ;
- return( data ) ;
- }
- else
- return( data & 0x01 ) ;
-}
+ unsigned char data;
+ data = XGINew_GetReg1(pVBInfo->P3d4, 0x97);
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_CheckChannel */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
+ if ((data & 0x10) == 0) {
+ data = XGINew_GetReg1(pVBInfo->P3c4, 0x39);
+ data = (data & 0x02) >> 1;
+ return data;
+ } else {
+ return data & 0x01;
+ }
+}
+
+static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
{
- unsigned char data;
-
- switch( HwDeviceExtension->jChipType )
- {
- case XG20:
- case XG21:
- data = XGINew_GetReg1( pVBInfo->P3d4 , 0x97 ) ;
- data = data & 0x01;
- XGINew_ChannelAB = 1 ; /* XG20 "JUST" one channel */
-
- if ( data == 0 ) /* Single_32_16 */
- {
-
- if (( HwDeviceExtension->ulVideoMemorySize - 1 ) > 0x1000000)
- {
-
- XGINew_DataBusWidth = 32 ; /* 32 bits */
- XGINew_SetReg1( pVBInfo->P3c4 , 0x13 , 0xB1 ) ; /* 22bit + 2 rank + 32bit */
- XGINew_SetReg1( pVBInfo->P3c4 , 0x14 , 0x52 ) ;
- DelayUS( 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 ) ;
-
- if ( XGINew_ReadWriteRest( 23 , 23 , pVBInfo ) == 1 )
- return ;
- }
- }
-
- 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 ) ;
-
- if ( XGINew_ReadWriteRest( 23 , 22 , pVBInfo ) == 1 )
- return ;
- else
- XGINew_SetReg1( pVBInfo->P3c4 , 0x13 , 0x31 ) ;
- DelayUS( 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 ) ;
-
- 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 ) ;
-
- if ( XGINew_ReadWriteRest( 22 , 22 , pVBInfo ) == 1 )
- return ;
- }
- }
-
-
- 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 ) ;
-
- if ( XGINew_ReadWriteRest( 22 , 21 , pVBInfo ) == 1 )
- return ;
- else
- XGINew_SetReg1( pVBInfo->P3c4 , 0x13 , 0x31 ) ; /* (0x31:12x8x2) 22bit + 1 rank */
- DelayUS( 15 ) ;
- }
- }
- break ;
-
- case XG27:
- XGINew_DataBusWidth = 16 ; /* 16 bits */
- XGINew_ChannelAB = 1 ; /* Single channel */
- XGINew_SetReg1( 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 ) ;
-
- if ( XGINew_ReadWriteRest( 25 , 23 , pVBInfo ) == 1 )
- return ;
-
- XGINew_ChannelAB = 2 ; /* Dual channels */
- XGINew_SetReg1( pVBInfo->P3c4 , 0x14 , 0x48 ) ;
-
- if ( XGINew_ReadWriteRest( 24 , 23 , pVBInfo ) == 1 )
- return ;
-
- XGINew_SetReg1( 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 ) ;
-
- if ( XGINew_ReadWriteRest( 24 , 23 , pVBInfo ) == 1 )
- return ;
-
- XGINew_SetReg1( pVBInfo->P3c4 , 0x14 , 0x38 ) ;
-
- if ( XGINew_ReadWriteRest( 8 , 4 , pVBInfo ) == 1 )
- return ;
- else
- XGINew_SetReg1( 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 ) ;
-
- if ( XGINew_ReadWriteRest( 25 , 24 , pVBInfo ) == 1 )
- return ;
-
- XGINew_ChannelAB = 1 ; /* Single channels */
- XGINew_SetReg1( pVBInfo->P3c4 , 0x14 , 0x52 ) ;
-
- if ( XGINew_ReadWriteRest( 24 , 23 , pVBInfo ) == 1 )
- return ;
-
- XGINew_SetReg1( 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 ) ;
-
- if ( XGINew_ReadWriteRest( 24 , 23 , pVBInfo ) == 1 )
- return ;
-
- XGINew_ChannelAB = 1 ; /* Single channels */
- XGINew_SetReg1( pVBInfo->P3c4 , 0x14 , 0x42 ) ;
-
- if ( XGINew_ReadWriteRest( 8 , 4 , pVBInfo ) == 1 )
- return ;
- else
- XGINew_SetReg1( pVBInfo->P3c4 , 0x14 , 0x43 ) ;
- }
-
- break ;
-
- case XG42:
-/*
- XG42 SR14 D[3] Reserve
- D[2] = 1, Dual Channel
- = 0, Single Channel
+ unsigned char data;
- It's Different from Other XG40 Series.
-*/
- 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 ) ;
-
- if ( XGINew_ReadWriteRest( 24 , 23 , pVBInfo ) == 1 )
- return ;
-
- XGINew_SetReg1( pVBInfo->P3c4 , 0x13 , 0x21 ) ;
- XGINew_SetReg1( 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 ) ;
-
- if ( XGINew_ReadWriteRest( 23 , 22 , pVBInfo ) == 1 )
- return ;
- else
- {
- XGINew_SetReg1( pVBInfo->P3c4 , 0x13 , 0x21 ) ;
- XGINew_SetReg1( 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 ) ;
-
- if ( XGINew_ReadWriteRest( 24 , 23 , pVBInfo ) == 1 )
- return ;
- else
- {
- XGINew_SetReg1( pVBInfo->P3c4 , 0x13 , 0x21 ) ;
- XGINew_SetReg1( pVBInfo->P3c4 , 0x14 , 0x42 ) ;
- }
- }
-
- break ;
-
- default: /* XG40 */
-
- 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 ) ;
-
- if ( XGINew_ReadWriteRest( 25 , 23 , pVBInfo ) == 1 )
- return ;
-
- XGINew_ChannelAB = 2 ; /* 2 channels */
- XGINew_SetReg1( pVBInfo->P3c4 , 0x14 , 0x48 ) ;
-
- if ( XGINew_ReadWriteRest( 24 , 23 , pVBInfo ) == 1 )
- return ;
-
- XGINew_SetReg1( pVBInfo->P3c4 , 0x13 , 0x21 ) ;
- XGINew_SetReg1( 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 ) ;
- }
- }
- else
- { /* DDR */
- XGINew_DataBusWidth = 64 ; /* 64 bits */
- XGINew_ChannelAB = 2 ; /* 2 channels */
- XGINew_SetReg1( pVBInfo->P3c4 , 0x13 , 0xA1 ) ;
- XGINew_SetReg1( 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 ) ;
- }
- }
- break ;
- }
-}
+ switch (HwDeviceExtension->jChipType) {
+ case XG20:
+ case XG21:
+ data = XGINew_GetReg1(pVBInfo->P3d4, 0x97);
+ data = data & 0x01;
+ XGINew_ChannelAB = 1; /* XG20 "JUST" one channel */
+
+ if (data == 0) { /* Single_32_16 */
+
+ if ((HwDeviceExtension->ulVideoMemorySize - 1)
+ > 0x1000000) {
+
+ XGINew_DataBusWidth = 32; /* 32 bits */
+ XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0xB1); /* 22bit + 2 rank + 32bit */
+ XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x52);
+ DelayUS(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);
+
+ if (XGINew_ReadWriteRest(23, 23, pVBInfo) == 1)
+ return;
+ }
+ }
+
+ 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);
+
+ if (XGINew_ReadWriteRest(23, 22, pVBInfo) == 1)
+ return;
+ else
+ XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0x31);
+ DelayUS(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);
+
+ 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);
+
+ if (XGINew_ReadWriteRest(22, 22, pVBInfo) == 1)
+ return;
+ }
+ }
+
+ 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);
+
+ if (XGINew_ReadWriteRest(22, 21, pVBInfo) == 1)
+ return;
+ else
+ XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0x31); /* (0x31:12x8x2) 22bit + 1 rank */
+ DelayUS(15);
+ }
+ }
+ break;
+
+ case XG27:
+ XGINew_DataBusWidth = 16; /* 16 bits */
+ XGINew_ChannelAB = 1; /* Single channel */
+ XGINew_SetReg1(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);
+ if (XGINew_ReadWriteRest(25, 23, pVBInfo) == 1)
+ return;
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_DDRSizing340 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-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 */
- XGINew_CheckChannel( HwDeviceExtension, pVBInfo ) ;
-
-
- if ( HwDeviceExtension->jChipType >= XG20 )
- {
- for( i = 0 ; i < 12 ; i++ )
- {
- XGINew_SetDRAMSizingType( i , XGINew_DDRDRAM_TYPE20, pVBInfo ) ;
- memsize = XGINew_SetDRAMSize20Reg( i , XGINew_DDRDRAM_TYPE20, pVBInfo ) ;
- if ( memsize == 0 )
- continue ;
-
- addr = memsize + ( XGINew_ChannelAB - 2 ) + 20 ;
- if ((HwDeviceExtension->ulVideoMemorySize - 1) < (unsigned long)(1 << addr))
- continue ;
-
- if ( XGINew_ReadWriteRest( addr , 5, pVBInfo ) == 1 )
- return( 1 ) ;
- }
- }
- else
- {
- for( i = 0 ; i < 4 ; i++ )
- {
- XGINew_SetDRAMSizingType( i , XGINew_DDRDRAM_TYPE340, pVBInfo ) ;
- memsize = XGINew_SetDRAMSizeReg( i , XGINew_DDRDRAM_TYPE340, pVBInfo ) ;
-
- if ( memsize == 0 )
- continue ;
-
- addr = memsize + ( XGINew_ChannelAB - 2 ) + 20 ;
- if ((HwDeviceExtension->ulVideoMemorySize - 1) < (unsigned long)(1 << addr))
- continue ;
-
- if ( XGINew_ReadWriteRest( addr , 9, pVBInfo ) == 1 )
- return( 1 ) ;
- }
- }
- return( 0 ) ;
-}
+ XGINew_ChannelAB = 2; /* Dual channels */
+ XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x48);
+ if (XGINew_ReadWriteRest(24, 23, pVBInfo) == 1)
+ return;
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_DDRSizing */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-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 ) ;
-}
+ XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x49);
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_SetMemoryClock */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_SetMemoryClock(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
-{
+ if (XGINew_ReadWriteRest(24, 23, pVBInfo) == 1)
+ return;
+
+ XGINew_ChannelAB = 3;
+ XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0x21);
+ XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x3C);
+
+ if (XGINew_ReadWriteRest(24, 23, pVBInfo) == 1)
+ return;
+
+ XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x38);
+
+ if (XGINew_ReadWriteRest(8, 4, pVBInfo) == 1)
+ return;
+ else
+ XGINew_SetReg1(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);
+
+ if (XGINew_ReadWriteRest(25, 24, pVBInfo) == 1)
+ return;
+ XGINew_ChannelAB = 1; /* Single channels */
+ XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x52);
- 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 ) ;
+ if (XGINew_ReadWriteRest(24, 23, pVBInfo) == 1)
+ return;
+ XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x53);
+ if (XGINew_ReadWriteRest(24, 23, pVBInfo) == 1)
+ return;
- 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 ) ;
+ XGINew_ChannelAB = 2; /* Dual channels */
+ XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0x21);
+ XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x4A);
- /* [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);
- }
+ if (XGINew_ReadWriteRest(24, 23, pVBInfo) == 1)
+ return;
+
+ XGINew_ChannelAB = 1; /* Single channels */
+ XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x42);
+
+ if (XGINew_ReadWriteRest(8, 4, pVBInfo) == 1)
+ return;
+ else
+ XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x43);
+ }
+
+ break;
+
+ case XG42:
+ /*
+ XG42 SR14 D[3] Reserve
+ D[2] = 1, Dual Channel
+ = 0, Single Channel
+
+ It's Different from Other XG40 Series.
+ */
+ 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);
+
+ if (XGINew_ReadWriteRest(24, 23, pVBInfo) == 1)
+ return;
+
+ XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0x21);
+ XGINew_SetReg1(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);
+
+ if (XGINew_ReadWriteRest(23, 22, pVBInfo) == 1)
+ return;
+ else {
+ XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0x21);
+ XGINew_SetReg1(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);
+
+ if (XGINew_ReadWriteRest(24, 23, pVBInfo) == 1)
+ return;
+ else {
+ XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0x21);
+ XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x42);
+ }
+ }
+
+ break;
+
+ default: /* XG40 */
+
+ 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);
+
+ if (XGINew_ReadWriteRest(25, 23, pVBInfo) == 1)
+ return;
+
+ XGINew_ChannelAB = 2; /* 2 channels */
+ XGINew_SetReg1(pVBInfo->P3c4, 0x14, 0x48);
+
+ if (XGINew_ReadWriteRest(24, 23, pVBInfo) == 1)
+ return;
+
+ XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0x21);
+ XGINew_SetReg1(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);
+ }
+ } else { /* DDR */
+ XGINew_DataBusWidth = 64; /* 64 bits */
+ XGINew_ChannelAB = 2; /* 2 channels */
+ XGINew_SetReg1(pVBInfo->P3c4, 0x13, 0xA1);
+ XGINew_SetReg1(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);
+ }
+ }
+ break;
+ }
+}
+
+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 */
+ XGINew_CheckChannel(HwDeviceExtension, pVBInfo);
+
+ if (HwDeviceExtension->jChipType >= XG20) {
+ for (i = 0; i < 12; i++) {
+ XGINew_SetDRAMSizingType(i, XGINew_DDRDRAM_TYPE20, pVBInfo);
+ memsize = XGINew_SetDRAMSize20Reg(i, XGINew_DDRDRAM_TYPE20, pVBInfo);
+ if (memsize == 0)
+ continue;
+
+ addr = memsize + (XGINew_ChannelAB - 2) + 20;
+ if ((HwDeviceExtension->ulVideoMemorySize - 1) < (unsigned long) (1 << addr))
+ continue;
+
+ if (XGINew_ReadWriteRest(addr, 5, pVBInfo) == 1)
+ return 1;
+ }
+ } else {
+ for (i = 0; i < 4; i++) {
+ XGINew_SetDRAMSizingType(i, XGINew_DDRDRAM_TYPE340, pVBInfo);
+ memsize = XGINew_SetDRAMSizeReg(i, XGINew_DDRDRAM_TYPE340, pVBInfo);
+
+ if (memsize == 0)
+ continue;
+
+ addr = memsize + (XGINew_ChannelAB - 2) + 20;
+ if ((HwDeviceExtension->ulVideoMemorySize - 1) < (unsigned long) (1 << addr))
+ continue;
+
+ if (XGINew_ReadWriteRest(addr, 9, pVBInfo) == 1)
+ return 1;
+ }
+ }
+ 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);
+ }
+}
-/* --------------------------------------------------------------------- */
-/* Function : ChkLFB */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
unsigned char ChkLFB(struct vb_device_info *pVBInfo)
{
- if (LFBDRAMTrap & XGINew_GetReg1(pVBInfo->P3d4 , 0x78))
+ if (LFBDRAMTrap & XGINew_GetReg1(pVBInfo->P3d4, 0x78))
return 1;
else
return 0;
}
-
/* --------------------------------------------------------------------- */
/* input : dx ,valid value : CR or second chip's CR */
/* */
@@ -2645,539 +2181,499 @@ unsigned char ChkLFB(struct vb_device_info *pVBInfo)
/* output : none */
/* --------------------------------------------------------------------- */
void SetPowerConsume(struct xgi_hw_device_info *HwDeviceExtension,
- unsigned long XGI_P3d4Port)
+ 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 */
- }
-
- }
-
- }
-}
+ 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 */
+
+ }
+ }
+}
-void XGINew_InitVBIOSData(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
+#if 0
+static void XGINew_InitVBIOSData(struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
{
- /* 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 */
-
- switch(HwDeviceExtension->jChipType)
- {
+ /* 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 */
+
+ switch (HwDeviceExtension->jChipType) {
case XG40:
case XG41:
case XG42:
case XG20:
case XG21:
default:
- InitTo330Pointer(HwDeviceExtension->jChipType,pVBInfo);
- return ;
+ InitTo330Pointer(HwDeviceExtension->jChipType, pVBInfo);
+ return;
}
}
+#endif
-/* --------------------------------------------------------------------- */
-/* Function : ReadVBIOSTablData */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
void ReadVBIOSTablData(unsigned char ChipType, struct vb_device_info *pVBInfo)
{
- volatile unsigned char *pVideoMemory = (unsigned char *)pVBInfo->ROMAddr;
- unsigned long i ;
- unsigned char j, k ;
- /* Volari customize data area end */
-
- if ( ChipType == XG21 )
- {
- pVBInfo->IF_DEF_LVDS = 0 ;
- if (pVideoMemory[ 0x65 ] & 0x1)
- {
- pVBInfo->IF_DEF_LVDS = 1 ;
- i = pVideoMemory[ 0x316 ] | ( pVideoMemory[ 0x317 ] << 8 );
- j = pVideoMemory[ i-1 ] ;
- if ( j != 0xff )
- {
- k = 0;
- do
- {
- pVBInfo->XG21_LVDSCapList[k].LVDS_Capability = pVideoMemory[ i ] | ( pVideoMemory[ i + 1 ] << 8 );
- pVBInfo->XG21_LVDSCapList[k].LVDSHT = pVideoMemory[ i + 2 ] | ( pVideoMemory[ i + 3 ] << 8 ) ;
- pVBInfo->XG21_LVDSCapList[k].LVDSVT = pVideoMemory[ i + 4 ] | ( pVideoMemory[ i + 5 ] << 8 );
- pVBInfo->XG21_LVDSCapList[k].LVDSHDE = pVideoMemory[ i + 6 ] | ( pVideoMemory[ i + 7 ] << 8 );
- pVBInfo->XG21_LVDSCapList[k].LVDSVDE = pVideoMemory[ i + 8 ] | ( pVideoMemory[ i + 9 ] << 8 );
- pVBInfo->XG21_LVDSCapList[k].LVDSHFP = pVideoMemory[ i + 10 ] | ( pVideoMemory[ i + 11 ] << 8 );
- pVBInfo->XG21_LVDSCapList[k].LVDSVFP = pVideoMemory[ i + 12 ] | ( pVideoMemory[ i + 13 ] << 8 );
- pVBInfo->XG21_LVDSCapList[k].LVDSHSYNC = pVideoMemory[ i + 14 ] | ( pVideoMemory[ i + 15 ] << 8 );
- pVBInfo->XG21_LVDSCapList[k].LVDSVSYNC = pVideoMemory[ i + 16 ] | ( pVideoMemory[ i + 17 ] << 8 );
- pVBInfo->XG21_LVDSCapList[k].VCLKData1 = pVideoMemory[ i + 18 ] ;
- pVBInfo->XG21_LVDSCapList[k].VCLKData2 = pVideoMemory[ i + 19 ] ;
- pVBInfo->XG21_LVDSCapList[k].PSC_S1 = pVideoMemory[ i + 20 ] ;
- pVBInfo->XG21_LVDSCapList[k].PSC_S2 = pVideoMemory[ i + 21 ] ;
- pVBInfo->XG21_LVDSCapList[k].PSC_S3 = pVideoMemory[ i + 22 ] ;
- pVBInfo->XG21_LVDSCapList[k].PSC_S4 = pVideoMemory[ i + 23 ] ;
- pVBInfo->XG21_LVDSCapList[k].PSC_S5 = pVideoMemory[ i + 24 ] ;
- i += 25;
- j--;
- k++;
- } while ((j > 0) &&
- (k < (sizeof(XGI21_LCDCapList)/sizeof(struct XGI21_LVDSCapStruct))));
- }
- else
- {
- pVBInfo->XG21_LVDSCapList[0].LVDS_Capability = pVideoMemory[ i ] | ( pVideoMemory[ i + 1 ] << 8 );
- pVBInfo->XG21_LVDSCapList[0].LVDSHT = pVideoMemory[ i + 2 ] | ( pVideoMemory[ i + 3 ] << 8 ) ;
- pVBInfo->XG21_LVDSCapList[0].LVDSVT = pVideoMemory[ i + 4 ] | ( pVideoMemory[ i + 5 ] << 8 );
- pVBInfo->XG21_LVDSCapList[0].LVDSHDE = pVideoMemory[ i + 6 ] | ( pVideoMemory[ i + 7 ] << 8 );
- pVBInfo->XG21_LVDSCapList[0].LVDSVDE = pVideoMemory[ i + 8 ] | ( pVideoMemory[ i + 9 ] << 8 );
- pVBInfo->XG21_LVDSCapList[0].LVDSHFP = pVideoMemory[ i + 10 ] | ( pVideoMemory[ i + 11 ] << 8 );
- pVBInfo->XG21_LVDSCapList[0].LVDSVFP = pVideoMemory[ i + 12 ] | ( pVideoMemory[ i + 13 ] << 8 );
- pVBInfo->XG21_LVDSCapList[0].LVDSHSYNC = pVideoMemory[ i + 14 ] | ( pVideoMemory[ i + 15 ] << 8 );
- pVBInfo->XG21_LVDSCapList[0].LVDSVSYNC = pVideoMemory[ i + 16 ] | ( pVideoMemory[ i + 17 ] << 8 );
- pVBInfo->XG21_LVDSCapList[0].VCLKData1 = pVideoMemory[ i + 18 ] ;
- pVBInfo->XG21_LVDSCapList[0].VCLKData2 = pVideoMemory[ i + 19 ] ;
- pVBInfo->XG21_LVDSCapList[0].PSC_S1 = pVideoMemory[ i + 20 ] ;
- pVBInfo->XG21_LVDSCapList[0].PSC_S2 = pVideoMemory[ i + 21 ] ;
- pVBInfo->XG21_LVDSCapList[0].PSC_S3 = pVideoMemory[ i + 22 ] ;
- pVBInfo->XG21_LVDSCapList[0].PSC_S4 = pVideoMemory[ i + 23 ] ;
- pVBInfo->XG21_LVDSCapList[0].PSC_S5 = pVideoMemory[ i + 24 ] ;
- }
- }
- }
+ volatile unsigned char *pVideoMemory = (unsigned char *) pVBInfo->ROMAddr;
+ unsigned long i;
+ unsigned char j, k;
+ /* Volari customize data area end */
+
+ if (ChipType == XG21) {
+ pVBInfo->IF_DEF_LVDS = 0;
+ if (pVideoMemory[0x65] & 0x1) {
+ pVBInfo->IF_DEF_LVDS = 1;
+ i = pVideoMemory[0x316] | (pVideoMemory[0x317] << 8);
+ j = pVideoMemory[i - 1];
+ if (j != 0xff) {
+ k = 0;
+ do {
+ pVBInfo->XG21_LVDSCapList[k].LVDS_Capability
+ = pVideoMemory[i] | (pVideoMemory[i + 1] << 8);
+ pVBInfo->XG21_LVDSCapList[k].LVDSHT
+ = pVideoMemory[i + 2] | (pVideoMemory[i + 3] << 8);
+ pVBInfo->XG21_LVDSCapList[k].LVDSVT
+ = pVideoMemory[i + 4] | (pVideoMemory[i + 5] << 8);
+ pVBInfo->XG21_LVDSCapList[k].LVDSHDE
+ = pVideoMemory[i + 6] | (pVideoMemory[i + 7] << 8);
+ pVBInfo->XG21_LVDSCapList[k].LVDSVDE
+ = pVideoMemory[i + 8] | (pVideoMemory[i + 9] << 8);
+ pVBInfo->XG21_LVDSCapList[k].LVDSHFP
+ = pVideoMemory[i + 10] | (pVideoMemory[i + 11] << 8);
+ pVBInfo->XG21_LVDSCapList[k].LVDSVFP
+ = pVideoMemory[i + 12] | (pVideoMemory[i + 13] << 8);
+ pVBInfo->XG21_LVDSCapList[k].LVDSHSYNC
+ = pVideoMemory[i + 14] | (pVideoMemory[i + 15] << 8);
+ pVBInfo->XG21_LVDSCapList[k].LVDSVSYNC
+ = pVideoMemory[i + 16] | (pVideoMemory[i + 17] << 8);
+ pVBInfo->XG21_LVDSCapList[k].VCLKData1
+ = pVideoMemory[i + 18];
+ pVBInfo->XG21_LVDSCapList[k].VCLKData2
+ = pVideoMemory[i + 19];
+ pVBInfo->XG21_LVDSCapList[k].PSC_S1
+ = pVideoMemory[i + 20];
+ pVBInfo->XG21_LVDSCapList[k].PSC_S2
+ = pVideoMemory[i + 21];
+ pVBInfo->XG21_LVDSCapList[k].PSC_S3
+ = pVideoMemory[i + 22];
+ pVBInfo->XG21_LVDSCapList[k].PSC_S4
+ = pVideoMemory[i + 23];
+ pVBInfo->XG21_LVDSCapList[k].PSC_S5
+ = pVideoMemory[i + 24];
+ i += 25;
+ j--;
+ k++;
+ } while ((j > 0) && (k < (sizeof(XGI21_LCDCapList) / sizeof(struct XGI21_LVDSCapStruct))));
+ } else {
+ pVBInfo->XG21_LVDSCapList[0].LVDS_Capability
+ = pVideoMemory[i] | (pVideoMemory[i + 1] << 8);
+ pVBInfo->XG21_LVDSCapList[0].LVDSHT
+ = pVideoMemory[i + 2] | (pVideoMemory[i + 3] << 8);
+ pVBInfo->XG21_LVDSCapList[0].LVDSVT
+ = pVideoMemory[i + 4] | (pVideoMemory[i + 5] << 8);
+ pVBInfo->XG21_LVDSCapList[0].LVDSHDE
+ = pVideoMemory[i + 6] | (pVideoMemory[i + 7] << 8);
+ pVBInfo->XG21_LVDSCapList[0].LVDSVDE
+ = pVideoMemory[i + 8] | (pVideoMemory[i + 9] << 8);
+ pVBInfo->XG21_LVDSCapList[0].LVDSHFP
+ = pVideoMemory[i + 10] | (pVideoMemory[i + 11] << 8);
+ pVBInfo->XG21_LVDSCapList[0].LVDSVFP
+ = pVideoMemory[i + 12] | (pVideoMemory[i + 13] << 8);
+ pVBInfo->XG21_LVDSCapList[0].LVDSHSYNC
+ = pVideoMemory[i + 14] | (pVideoMemory[i + 15] << 8);
+ pVBInfo->XG21_LVDSCapList[0].LVDSVSYNC
+ = pVideoMemory[i + 16] | (pVideoMemory[i + 17] << 8);
+ pVBInfo->XG21_LVDSCapList[0].VCLKData1
+ = pVideoMemory[i + 18];
+ pVBInfo->XG21_LVDSCapList[0].VCLKData2
+ = pVideoMemory[i + 19];
+ pVBInfo->XG21_LVDSCapList[0].PSC_S1
+ = pVideoMemory[i + 20];
+ pVBInfo->XG21_LVDSCapList[0].PSC_S2
+ = pVideoMemory[i + 21];
+ pVBInfo->XG21_LVDSCapList[0].PSC_S3
+ = pVideoMemory[i + 22];
+ pVBInfo->XG21_LVDSCapList[0].PSC_S4
+ = pVideoMemory[i + 23];
+ pVBInfo->XG21_LVDSCapList[0].PSC_S5
+ = pVideoMemory[i + 24];
+ }
+ }
+ }
}
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_DDR1x_MRS_XG20 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
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 ) ;
+ 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);
}
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_SetDRAMModeRegister_XG20 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
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 ) ;
+ 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)
+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 */
+ 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);
- 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 ) ;
+ XGINew_SetReg1(pVBInfo->P3c4, 0x1B, 0x03);
}
*/
-/* -------------------------------------------------------- */
-/* Function : XGINew_ChkSenseStatus */
-/* Input : */
-/* Output : */
-/* Description : */
-/* -------------------------------------------------------- */
-void XGINew_ChkSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
+
+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 ) ;
-
- if ( temp & Monitor1Sense )
- tempbx |= ActiveCRT1 ;
- if ( temp & LCDSense )
- tempbx |= ActiveLCD ;
- if ( temp & Monitor2Sense )
- tempbx |= ActiveCRT2 ;
- if ( temp & TVSense )
- {
- tempbx |= ActiveTV ;
- if ( temp & AVIDEOSense )
- tempbx |= ( ActiveAVideo << 8 );
- if ( temp & SVIDEOSense )
- tempbx |= ( ActiveSVideo << 8 );
- if ( temp & SCARTSense )
- tempbx |= ( ActiveSCART << 8 );
- if ( temp & HiTVSense )
- tempbx |= ( ActiveHiTV << 8 );
- if ( temp & YPbPrSense )
- tempbx |= ( ActiveYPbPr << 8 );
- }
-
- tempcx = XGINew_GetReg1( pVBInfo->P3d4 , 0x3d ) ;
- tempcx |= ( XGINew_GetReg1( pVBInfo->P3d4 , 0x3e ) << 8 ) ;
-
- if ( tempbx & tempcx )
- {
- CR3CData = XGINew_GetReg1( pVBInfo->P3d4 , 0x3c ) ;
- if ( !( CR3CData & DisplayDeviceFromCMOS ) )
- {
- tempcx = 0x1FF0 ;
- if ( *pVBInfo->pSoftSetting & ModeSoftSetting )
- {
- tempbx = 0x1FF0 ;
- }
- }
- }
- else
- {
- tempcx = 0x1FF0 ;
- if ( *pVBInfo->pSoftSetting & ModeSoftSetting )
- {
- tempbx = 0x1FF0 ;
- }
- }
-
- tempbx &= tempcx ;
- XGINew_SetReg1( pVBInfo->P3d4, 0x3d , ( tempbx & 0x00FF ) ) ;
- XGINew_SetReg1( pVBInfo->P3d4, 0x3e , ( ( tempbx & 0xFF00 ) >> 8 )) ;
+ unsigned short tempbx = 0, temp, tempcx, CR3CData;
+
+ temp = XGINew_GetReg1(pVBInfo->P3d4, 0x32);
+
+ if (temp & Monitor1Sense)
+ tempbx |= ActiveCRT1;
+ if (temp & LCDSense)
+ tempbx |= ActiveLCD;
+ if (temp & Monitor2Sense)
+ tempbx |= ActiveCRT2;
+ if (temp & TVSense) {
+ tempbx |= ActiveTV;
+ if (temp & AVIDEOSense)
+ tempbx |= (ActiveAVideo << 8);
+ if (temp & SVIDEOSense)
+ tempbx |= (ActiveSVideo << 8);
+ if (temp & SCARTSense)
+ tempbx |= (ActiveSCART << 8);
+ if (temp & HiTVSense)
+ tempbx |= (ActiveHiTV << 8);
+ if (temp & YPbPrSense)
+ tempbx |= (ActiveYPbPr << 8);
+ }
+
+ tempcx = XGINew_GetReg1(pVBInfo->P3d4, 0x3d);
+ tempcx |= (XGINew_GetReg1(pVBInfo->P3d4, 0x3e) << 8);
+
+ if (tempbx & tempcx) {
+ CR3CData = XGINew_GetReg1(pVBInfo->P3d4, 0x3c);
+ if (!(CR3CData & DisplayDeviceFromCMOS)) {
+ tempcx = 0x1FF0;
+ if (*pVBInfo->pSoftSetting & ModeSoftSetting)
+ tempbx = 0x1FF0;
+ }
+ } else {
+ tempcx = 0x1FF0;
+ if (*pVBInfo->pSoftSetting & ModeSoftSetting)
+ tempbx = 0x1FF0;
+ }
+
+ tempbx &= tempcx;
+ XGINew_SetReg1(pVBInfo->P3d4, 0x3d, (tempbx & 0x00FF));
+ XGINew_SetReg1(pVBInfo->P3d4, 0x3e, ((tempbx & 0xFF00) >> 8));
}
-/* -------------------------------------------------------- */
-/* Function : XGINew_SetModeScratch */
-/* Input : */
-/* Output : */
-/* Description : */
-/* -------------------------------------------------------- */
-void XGINew_SetModeScratch(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)
{
- 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 ;
-
- if ( pVBInfo->IF_DEF_CRT2Monitor == 1)
- {
- if ( temp & ActiveCRT2 )
- tempcl = SetCRT2ToRAMDAC ;
- }
-
- if ( temp & ActiveLCD )
- {
- tempcl |= SetCRT2ToLCD ;
- if ( temp & DriverMode )
- {
- if ( temp & ActiveTV )
- {
- tempch = SetToLCDA | EnableDualEdge ;
- temp ^= SetCRT2ToLCD ;
-
- if ( ( temp >> 8 ) & ActiveAVideo )
- tempcl |= SetCRT2ToAVIDEO ;
- if ( ( temp >> 8 ) & ActiveSVideo )
- tempcl |= SetCRT2ToSVIDEO ;
- if ( ( temp >> 8 ) & ActiveSCART )
- tempcl |= SetCRT2ToSCART ;
-
- if ( pVBInfo->IF_DEF_HiVision == 1 )
- {
- if ( ( temp >> 8 ) & ActiveHiTV )
- tempcl |= SetCRT2ToHiVisionTV ;
- }
-
- if ( pVBInfo->IF_DEF_YPbPr == 1 )
- {
- if ( ( temp >> 8 ) & ActiveYPbPr )
- tempch |= SetYPbPr ;
- }
- }
- }
- }
- else
- {
- if ( ( temp >> 8 ) & ActiveAVideo )
- tempcl |= SetCRT2ToAVIDEO ;
- if ( ( temp >> 8 ) & ActiveSVideo )
- tempcl |= SetCRT2ToSVIDEO ;
- if ( ( temp >> 8 ) & ActiveSCART )
- tempcl |= SetCRT2ToSCART ;
-
- if ( pVBInfo->IF_DEF_HiVision == 1 )
- {
- if ( ( temp >> 8 ) & ActiveHiTV )
- tempcl |= SetCRT2ToHiVisionTV ;
- }
-
- if ( pVBInfo->IF_DEF_YPbPr == 1 )
- {
- if ( ( temp >> 8 ) & ActiveYPbPr )
- tempch |= SetYPbPr ;
- }
- }
-
-
- tempcl |= SetSimuScanMode ;
- if ( (!( temp & ActiveCRT1 )) && ( ( temp & ActiveLCD ) || ( temp & ActiveTV ) || ( temp & ActiveCRT2 ) ) )
- tempcl ^= ( SetSimuScanMode | SwitchToCRT2 ) ;
- if ( ( temp & ActiveLCD ) && ( temp & ActiveTV ) )
- tempcl ^= ( SetSimuScanMode | SwitchToCRT2 ) ;
- XGINew_SetReg1( pVBInfo->P3d4, 0x30 , tempcl ) ;
-
- CR31Data = XGINew_GetReg1( 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 ) ;
-
- CR38Data = XGINew_GetReg1( pVBInfo->P3d4 , 0x38 ) ;
- CR38Data &= ~SetYPbPr ;
- CR38Data |= tempch ;
- XGINew_SetReg1( pVBInfo->P3d4, 0x38 , CR38Data ) ;
+ 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;
+
+ if (pVBInfo->IF_DEF_CRT2Monitor == 1) {
+ if (temp & ActiveCRT2)
+ tempcl = SetCRT2ToRAMDAC;
+ }
+
+ if (temp & ActiveLCD) {
+ tempcl |= SetCRT2ToLCD;
+ if (temp & DriverMode) {
+ if (temp & ActiveTV) {
+ tempch = SetToLCDA | EnableDualEdge;
+ temp ^= SetCRT2ToLCD;
+
+ if ((temp >> 8) & ActiveAVideo)
+ tempcl |= SetCRT2ToAVIDEO;
+ if ((temp >> 8) & ActiveSVideo)
+ tempcl |= SetCRT2ToSVIDEO;
+ if ((temp >> 8) & ActiveSCART)
+ tempcl |= SetCRT2ToSCART;
+
+ if (pVBInfo->IF_DEF_HiVision == 1) {
+ if ((temp >> 8) & ActiveHiTV)
+ tempcl |= SetCRT2ToHiVisionTV;
+ }
+
+ if (pVBInfo->IF_DEF_YPbPr == 1) {
+ if ((temp >> 8) & ActiveYPbPr)
+ tempch |= SetYPbPr;
+ }
+ }
+ }
+ } else {
+ if ((temp >> 8) & ActiveAVideo)
+ tempcl |= SetCRT2ToAVIDEO;
+ if ((temp >> 8) & ActiveSVideo)
+ tempcl |= SetCRT2ToSVIDEO;
+ if ((temp >> 8) & ActiveSCART)
+ tempcl |= SetCRT2ToSCART;
+
+ if (pVBInfo->IF_DEF_HiVision == 1) {
+ if ((temp >> 8) & ActiveHiTV)
+ tempcl |= SetCRT2ToHiVisionTV;
+ }
+
+ if (pVBInfo->IF_DEF_YPbPr == 1) {
+ if ((temp >> 8) & ActiveYPbPr)
+ tempch |= SetYPbPr;
+ }
+ }
+
+ tempcl |= SetSimuScanMode;
+ if ((!(temp & ActiveCRT1)) && ((temp & ActiveLCD) || (temp & ActiveTV)
+ || (temp & ActiveCRT2)))
+ tempcl ^= (SetSimuScanMode | SwitchToCRT2);
+ if ((temp & ActiveLCD) && (temp & ActiveTV))
+ tempcl ^= (SetSimuScanMode | SwitchToCRT2);
+ XGINew_SetReg1(pVBInfo->P3d4, 0x30, tempcl);
+
+ CR31Data = XGINew_GetReg1(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);
+
+ CR38Data = XGINew_GetReg1(pVBInfo->P3d4, 0x38);
+ CR38Data &= ~SetYPbPr;
+ CR38Data |= tempch;
+ XGINew_SetReg1(pVBInfo->P3d4, 0x38, CR38Data);
}
-/* -------------------------------------------------------- */
-/* Function : XGINew_GetXG21Sense */
-/* Input : */
-/* Output : */
-/* Description : */
-/* -------------------------------------------------------- */
-void XGINew_GetXG21Sense(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 Temp;
- volatile unsigned char *pVideoMemory = (unsigned char *)pVBInfo->ROMAddr;
+ unsigned char Temp;
+ volatile unsigned char *pVideoMemory =
+ (unsigned char *) pVBInfo->ROMAddr;
- pVBInfo->IF_DEF_LVDS = 0 ;
+ pVBInfo->IF_DEF_LVDS = 0;
#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 */
- }
- else
- {
+ 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 */
+ } else {
#endif
- XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x4A , ~0x03 , 0x03 ) ; /* Enable GPIOA/B read */
- Temp = XGINew_GetReg1( 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 ;
- if ( !Temp )
- XGINew_SetRegANDOR( 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 */
- }
+ XGINew_SetRegANDOR(pVBInfo->P3d4, 0x4A, ~0x03, 0x03); /* Enable GPIOA/B read */
+ Temp = XGINew_GetReg1(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;
+ if (!Temp)
+ XGINew_SetRegANDOR(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 */
+ }
#if 1
- }
+ }
#endif
}
-/* -------------------------------------------------------- */
-/* Function : XGINew_GetXG27Sense */
-/* Input : */
-/* Output : */
-/* Description : */
-/* -------------------------------------------------------- */
-void XGINew_GetXG27Sense(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
+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 ) ;
-
- if ( Temp <= 0x02 )
- {
- pVBInfo->IF_DEF_LVDS = 1 ;
- XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x38 , ~0xE0 , 0xC0 ) ; /* LVDS setting */
- XGINew_SetReg1( pVBInfo->P3d4, 0x30 , 0x21 ) ;
- }
- else
- {
- XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x38 , ~0xE0 , 0xA0 ) ; /* TMDS/DVO setting */
- }
- XGINew_SetRegOR( pVBInfo->P3d4 , 0x32 , LCDSense ) ;
+ 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);
+
+ if (Temp <= 0x02) {
+ pVBInfo->IF_DEF_LVDS = 1;
+ XGINew_SetRegANDOR(pVBInfo->P3d4, 0x38, ~0xE0, 0xC0); /* LVDS setting */
+ XGINew_SetReg1(pVBInfo->P3d4, 0x30, 0x21);
+ } else {
+ XGINew_SetRegANDOR(pVBInfo->P3d4, 0x38, ~0xE0, 0xA0); /* TMDS/DVO setting */
+ }
+ XGINew_SetRegOR(pVBInfo->P3d4, 0x32, LCDSense);
}
@@ -3185,39 +2681,35 @@ 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 ) ;
- temp =0;
- if ( ( CR38 & 0xE0 ) > 0x80 )
- {
- temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x48 ) ;
- temp &= 0x08;
- temp >>= 3;
- }
+ CR4A = XGINew_GetReg1(pVBInfo->P3d4, 0x4A);
+ XGINew_SetRegANDOR(pVBInfo->P3d4, 0x4A, ~0x10, 0x10); /* enable GPIOE read */
+ CR38 = XGINew_GetReg1(pVBInfo->P3d4, 0x38);
+ temp = 0;
+ if ((CR38 & 0xE0) > 0x80) {
+ temp = XGINew_GetReg1(pVBInfo->P3d4, 0x48);
+ temp &= 0x08;
+ temp >>= 3;
+ }
- XGINew_SetReg1( pVBInfo->P3d4, 0x4A , CR4A ) ;
+ XGINew_SetReg1(pVBInfo->P3d4, 0x4A, CR4A);
- return temp;
+ return temp;
}
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 ) ;
- if ( temp <= 2 )
- {
- temp &= 0x03;
- }
- else
- {
- temp = ((temp&0x04)>>1) || ((~temp)&0x01);
- }
- XGINew_SetReg1( pVBInfo->P3d4, 0x4A , CR4A ) ;
-
- return 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);
+ if (temp <= 2)
+ temp &= 0x03;
+ else
+ temp = ((temp & 0x04) >> 1) || ((~temp) & 0x01);
+
+ XGINew_SetReg1(pVBInfo->P3d4, 0x4A, CR4A);
+
+ return temp;
}
diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index d90bf06..7016fdd 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -22,50 +22,50 @@
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);
+ 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 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 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 short ModeNo);
unsigned char XGI_BridgeIsOn(struct vb_device_info *pVBInfo);
-unsigned char XGI_GetModePtr(unsigned short ModeNo,
+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 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 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 ModeIdIndex,
+ struct vb_device_info *pVBInfo);
unsigned short XGI_GetColorDepth(unsigned short ModeNo,
- unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo);
+ 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);
+ 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);
@@ -122,12 +122,13 @@ void XGI_WriteDAC(unsigned short dl, unsigned short ah, unsigned short al, u
/*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);
+ 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);
+ 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);
@@ -151,7 +152,7 @@ void XGI_SetEdgeEnhance(unsigned short ModeNo, unsigned short ModeIdIndex, s
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 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);
@@ -164,11 +165,11 @@ void XGINew_LCD_Wait_Time(unsigned char DelayTime, struct vb_device_info *pV
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);
+ struct vb_device_info *pVBInfo);
unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex,
- unsigned short ModeNo,
- unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo);
+ 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);
@@ -191,7 +192,7 @@ extern void ReadVBIOSTablData(unsigned char ChipType, struct vb_device_info *pVB
/* unsigned short XGINew_flag_clearbuffer; 0: no clear frame buffer 1:clear frame buffer */
-unsigned short XGINew_MDA_DAC[] = {
+static unsigned short XGINew_MDA_DAC[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15,
0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15,
@@ -201,7 +202,7 @@ unsigned short XGINew_MDA_DAC[] = {
0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F};
-unsigned short XGINew_CGA_DAC[] = {
+static unsigned short XGINew_CGA_DAC[] = {
0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x09, 0x15,
0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x09, 0x15,
0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F,
@@ -211,7 +212,7 @@ unsigned short XGINew_CGA_DAC[] = {
0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F,
0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F};
-unsigned short XGINew_EGA_DAC[] = {
+static unsigned short XGINew_EGA_DAC[] = {
0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x05, 0x15,
0x20, 0x30, 0x24, 0x34, 0x21, 0x31, 0x25, 0x35,
0x08, 0x18, 0x0C, 0x1C, 0x09, 0x19, 0x0D, 0x1D,
@@ -221,7 +222,7 @@ unsigned short XGINew_EGA_DAC[] = {
0x0A, 0x1A, 0x0E, 0x1E, 0x0B, 0x1B, 0x0F, 0x1F,
0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F};
-unsigned short XGINew_VGA_DAC[] = {
+static unsigned short XGINew_VGA_DAC[] = {
0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x09, 0x15,
0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F,
0x00, 0x05, 0x08, 0x0B, 0x0E, 0x11, 0x14, 0x18,
@@ -233,1282 +234,1053 @@ unsigned short XGINew_VGA_DAC[] = {
0x08, 0x0C, 0x10, 0x08, 0x0A, 0x0C, 0x0E, 0x10,
0x0B, 0x0C, 0x0D, 0x0F, 0x10};
-
-/* --------------------------------------------------------------------- */
-/* Function : InitTo330Pointer */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo)
{
- pVBInfo->SModeIDTable = (struct XGI_StStruct *) XGI330_SModeIDTable ;
- pVBInfo->StandTable = (struct XGI_StandTableStruct *) XGI330_StandTable ;
- pVBInfo->EModeIDTable = (struct XGI_ExtStruct *) XGI330_EModeIDTable ;
- pVBInfo->RefIndex = (struct XGI_Ext2Struct *) XGI330_RefIndex ;
- pVBInfo->XGINEWUB_CRT1Table = (struct XGI_CRT1TableStruct *) XGI_CRT1Table ;
-
- /* add for new UNIVGABIOS */
- /* 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->VCLKData = (struct XGI_VCLKDataStruct *) XGI_VCLKData ;
- pVBInfo->VBVCLKData = (struct XGI_VBVCLKDataStruct *) XGI_VBVCLKData ;
- pVBInfo->ScreenOffset = XGI330_ScreenOffset ;
- pVBInfo->StResInfo = (struct XGI_StResInfoStruct *) XGI330_StResInfo ;
- pVBInfo->ModeResInfo = (struct XGI_ModeResInfoStruct *) XGI330_ModeResInfo ;
-
- pVBInfo->pOutputSelect = &XGI330_OutputSelect ;
- pVBInfo->pSoftSetting = &XGI330_SoftSetting ;
- pVBInfo->pSR07 = &XGI330_SR07 ;
- pVBInfo->LCDResInfo = 0 ;
- pVBInfo->LCDTypeInfo = 0 ;
- pVBInfo->LCDInfo = 0 ;
- pVBInfo->VBInfo = 0 ;
- pVBInfo->TVInfo = 0;
-
-
- pVBInfo->SR15 = XGI340_SR13 ;
- pVBInfo->CR40 = XGI340_cr41 ;
- pVBInfo->SR25 = XGI330_sr25 ;
- pVBInfo->pSR31 = &XGI330_sr31 ;
- pVBInfo->pSR32 = &XGI330_sr32 ;
- pVBInfo->CR6B = XGI340_CR6B ;
- pVBInfo->CR6E = XGI340_CR6E ;
- pVBInfo->CR6F = XGI340_CR6F ;
- pVBInfo->CR89 = XGI340_CR89 ;
- pVBInfo->AGPReg = XGI340_AGPReg ;
- pVBInfo->SR16 = XGI340_SR16 ;
- pVBInfo->pCRCF = &XG40_CRCF ;
- pVBInfo->pXGINew_DRAMTypeDefinition = &XG40_DRAMTypeDefinition ;
-
-
- pVBInfo->CR49 = XGI330_CR49 ;
- pVBInfo->pSR1F = &XGI330_SR1F ;
- pVBInfo->pSR21 = &XGI330_SR21 ;
- pVBInfo->pSR22 = &XGI330_SR22 ;
- pVBInfo->pSR23 = &XGI330_SR23 ;
- pVBInfo->pSR24 = &XGI330_SR24 ;
- pVBInfo->pSR33 = &XGI330_SR33 ;
-
-
-
- pVBInfo->pCRT2Data_1_2 = &XGI330_CRT2Data_1_2 ;
- pVBInfo->pCRT2Data_4_D = &XGI330_CRT2Data_4_D ;
- pVBInfo->pCRT2Data_4_E = &XGI330_CRT2Data_4_E ;
- pVBInfo->pCRT2Data_4_10 = &XGI330_CRT2Data_4_10 ;
- pVBInfo->pRGBSenseData = &XGI330_RGBSenseData ;
- pVBInfo->pVideoSenseData = &XGI330_VideoSenseData ;
- pVBInfo->pYCSenseData = &XGI330_YCSenseData ;
- pVBInfo->pRGBSenseData2 = &XGI330_RGBSenseData2 ;
- pVBInfo->pVideoSenseData2 = &XGI330_VideoSenseData2 ;
- pVBInfo->pYCSenseData2 = &XGI330_YCSenseData2 ;
-
- pVBInfo->NTSCTiming = XGI330_NTSCTiming ;
- pVBInfo->PALTiming = XGI330_PALTiming ;
- pVBInfo->HiTVExtTiming = XGI330_HiTVExtTiming ;
- pVBInfo->HiTVSt1Timing = XGI330_HiTVSt1Timing ;
- pVBInfo->HiTVSt2Timing = XGI330_HiTVSt2Timing ;
- pVBInfo->HiTVTextTiming = XGI330_HiTVTextTiming ;
- pVBInfo->YPbPr750pTiming = XGI330_YPbPr750pTiming ;
- pVBInfo->YPbPr525pTiming = XGI330_YPbPr525pTiming ;
- pVBInfo->YPbPr525iTiming = XGI330_YPbPr525iTiming ;
- pVBInfo->HiTVGroup3Data = XGI330_HiTVGroup3Data ;
- pVBInfo->HiTVGroup3Simu = XGI330_HiTVGroup3Simu ;
- pVBInfo->HiTVGroup3Text = XGI330_HiTVGroup3Text ;
- pVBInfo->Ren525pGroup3 = XGI330_Ren525pGroup3 ;
- pVBInfo->Ren750pGroup3 = XGI330_Ren750pGroup3 ;
-
-
- pVBInfo->TimingH = (struct XGI_TimingHStruct *) XGI_TimingH ;
- pVBInfo->TimingV = (struct XGI_TimingVStruct *) XGI_TimingV ;
- pVBInfo->UpdateCRT1 = (struct XGI_XG21CRT1Struct *) XGI_UpdateCRT1Table ;
-
- pVBInfo->CHTVVCLKUNTSC = XGI330_CHTVVCLKUNTSC ;
- pVBInfo->CHTVVCLKONTSC = XGI330_CHTVVCLKONTSC ;
- pVBInfo->CHTVVCLKUPAL = XGI330_CHTVVCLKUPAL ;
- pVBInfo->CHTVVCLKOPAL = XGI330_CHTVVCLKOPAL ;
-
- /* 310 customization related */
- if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) )
- pVBInfo->LCDCapList = XGI_LCDDLCapList ;
- else
- pVBInfo->LCDCapList = XGI_LCDCapList ;
-
- if ( ( ChipType == XG21 ) || ( ChipType == XG27 ) )
- pVBInfo->XG21_LVDSCapList = XGI21_LCDCapList ;
-
- pVBInfo->XGI_TVDelayList = XGI301TVDelayList ;
- pVBInfo->XGI_TVDelayList2 = XGI301TVDelayList2 ;
-
-
- pVBInfo->pXGINew_I2CDefinition = &XG40_I2CDefinition ;
-
- if ( ChipType >= XG20 )
- pVBInfo->pXGINew_CR97 = &XG20_CR97 ;
-
- if ( ChipType == XG27 )
- {
- pVBInfo->MCLKData = (struct XGI_MCLKDataStruct *) XGI27New_MCLKData;
- pVBInfo->CR40 = XGI27_cr41 ;
- pVBInfo->pXGINew_CR97 = &XG27_CR97 ;
- pVBInfo->pSR36 = &XG27_SR36 ;
- pVBInfo->pCR8F = &XG27_CR8F ;
- pVBInfo->pCRD0 = XG27_CRD0 ;
- pVBInfo->pCRDE = XG27_CRDE ;
- pVBInfo->pSR40 = &XG27_SR40 ;
- pVBInfo->pSR41 = &XG27_SR41 ;
-
- }
-
- if ( ChipType >= XG20 )
- {
- pVBInfo->pDVOSetting = &XG21_DVOSetting ;
- pVBInfo->pCR2E = &XG21_CR2E ;
- pVBInfo->pCR2F = &XG21_CR2F ;
- pVBInfo->pCR46 = &XG21_CR46 ;
- pVBInfo->pCR47 = &XG21_CR47 ;
- }
+ pVBInfo->SModeIDTable = (struct XGI_StStruct *) XGI330_SModeIDTable;
+ pVBInfo->StandTable = (struct XGI_StandTableStruct *) XGI330_StandTable;
+ pVBInfo->EModeIDTable = (struct XGI_ExtStruct *) XGI330_EModeIDTable;
+ pVBInfo->RefIndex = (struct XGI_Ext2Struct *) XGI330_RefIndex;
+ pVBInfo->XGINEWUB_CRT1Table
+ = (struct XGI_CRT1TableStruct *) XGI_CRT1Table;
+
+ /* add for new UNIVGABIOS */
+ /* 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->VCLKData = (struct XGI_VCLKDataStruct *) XGI_VCLKData;
+ pVBInfo->VBVCLKData = (struct XGI_VBVCLKDataStruct *) XGI_VBVCLKData;
+ pVBInfo->ScreenOffset = XGI330_ScreenOffset;
+ pVBInfo->StResInfo = (struct XGI_StResInfoStruct *) XGI330_StResInfo;
+ pVBInfo->ModeResInfo
+ = (struct XGI_ModeResInfoStruct *) XGI330_ModeResInfo;
+
+ pVBInfo->pOutputSelect = &XGI330_OutputSelect;
+ pVBInfo->pSoftSetting = &XGI330_SoftSetting;
+ pVBInfo->pSR07 = &XGI330_SR07;
+ pVBInfo->LCDResInfo = 0;
+ pVBInfo->LCDTypeInfo = 0;
+ pVBInfo->LCDInfo = 0;
+ pVBInfo->VBInfo = 0;
+ pVBInfo->TVInfo = 0;
+
+ pVBInfo->SR15 = XGI340_SR13;
+ pVBInfo->CR40 = XGI340_cr41;
+ pVBInfo->SR25 = XGI330_sr25;
+ pVBInfo->pSR31 = &XGI330_sr31;
+ pVBInfo->pSR32 = &XGI330_sr32;
+ pVBInfo->CR6B = XGI340_CR6B;
+ pVBInfo->CR6E = XGI340_CR6E;
+ pVBInfo->CR6F = XGI340_CR6F;
+ pVBInfo->CR89 = XGI340_CR89;
+ pVBInfo->AGPReg = XGI340_AGPReg;
+ pVBInfo->SR16 = XGI340_SR16;
+ pVBInfo->pCRCF = &XG40_CRCF;
+ pVBInfo->pXGINew_DRAMTypeDefinition = &XG40_DRAMTypeDefinition;
+
+ pVBInfo->CR49 = XGI330_CR49;
+ pVBInfo->pSR1F = &XGI330_SR1F;
+ pVBInfo->pSR21 = &XGI330_SR21;
+ pVBInfo->pSR22 = &XGI330_SR22;
+ pVBInfo->pSR23 = &XGI330_SR23;
+ pVBInfo->pSR24 = &XGI330_SR24;
+ pVBInfo->pSR33 = &XGI330_SR33;
+
+ pVBInfo->pCRT2Data_1_2 = &XGI330_CRT2Data_1_2;
+ pVBInfo->pCRT2Data_4_D = &XGI330_CRT2Data_4_D;
+ pVBInfo->pCRT2Data_4_E = &XGI330_CRT2Data_4_E;
+ pVBInfo->pCRT2Data_4_10 = &XGI330_CRT2Data_4_10;
+ pVBInfo->pRGBSenseData = &XGI330_RGBSenseData;
+ pVBInfo->pVideoSenseData = &XGI330_VideoSenseData;
+ pVBInfo->pYCSenseData = &XGI330_YCSenseData;
+ pVBInfo->pRGBSenseData2 = &XGI330_RGBSenseData2;
+ pVBInfo->pVideoSenseData2 = &XGI330_VideoSenseData2;
+ pVBInfo->pYCSenseData2 = &XGI330_YCSenseData2;
+
+ pVBInfo->NTSCTiming = XGI330_NTSCTiming;
+ pVBInfo->PALTiming = XGI330_PALTiming;
+ pVBInfo->HiTVExtTiming = XGI330_HiTVExtTiming;
+ pVBInfo->HiTVSt1Timing = XGI330_HiTVSt1Timing;
+ pVBInfo->HiTVSt2Timing = XGI330_HiTVSt2Timing;
+ pVBInfo->HiTVTextTiming = XGI330_HiTVTextTiming;
+ pVBInfo->YPbPr750pTiming = XGI330_YPbPr750pTiming;
+ pVBInfo->YPbPr525pTiming = XGI330_YPbPr525pTiming;
+ pVBInfo->YPbPr525iTiming = XGI330_YPbPr525iTiming;
+ pVBInfo->HiTVGroup3Data = XGI330_HiTVGroup3Data;
+ pVBInfo->HiTVGroup3Simu = XGI330_HiTVGroup3Simu;
+ pVBInfo->HiTVGroup3Text = XGI330_HiTVGroup3Text;
+ pVBInfo->Ren525pGroup3 = XGI330_Ren525pGroup3;
+ pVBInfo->Ren750pGroup3 = XGI330_Ren750pGroup3;
+
+ pVBInfo->TimingH = (struct XGI_TimingHStruct *) XGI_TimingH;
+ pVBInfo->TimingV = (struct XGI_TimingVStruct *) XGI_TimingV;
+ pVBInfo->UpdateCRT1 = (struct XGI_XG21CRT1Struct *) XGI_UpdateCRT1Table;
+
+ pVBInfo->CHTVVCLKUNTSC = XGI330_CHTVVCLKUNTSC;
+ pVBInfo->CHTVVCLKONTSC = XGI330_CHTVVCLKONTSC;
+ pVBInfo->CHTVVCLKUPAL = XGI330_CHTVVCLKUPAL;
+ pVBInfo->CHTVVCLKOPAL = XGI330_CHTVVCLKOPAL;
+
+ /* 310 customization related */
+ if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType & VB_XGI302LV))
+ pVBInfo->LCDCapList = XGI_LCDDLCapList;
+ else
+ pVBInfo->LCDCapList = XGI_LCDCapList;
+ if ((ChipType == XG21) || (ChipType == XG27))
+ pVBInfo->XG21_LVDSCapList = XGI21_LCDCapList;
+ pVBInfo->XGI_TVDelayList = XGI301TVDelayList;
+ pVBInfo->XGI_TVDelayList2 = XGI301TVDelayList2;
+ pVBInfo->pXGINew_I2CDefinition = &XG40_I2CDefinition;
+ if (ChipType >= XG20)
+ pVBInfo->pXGINew_CR97 = &XG20_CR97;
+ if (ChipType == XG27) {
+ pVBInfo->MCLKData
+ = (struct XGI_MCLKDataStruct *) XGI27New_MCLKData;
+ pVBInfo->CR40 = XGI27_cr41;
+ pVBInfo->pXGINew_CR97 = &XG27_CR97;
+ pVBInfo->pSR36 = &XG27_SR36;
+ pVBInfo->pCR8F = &XG27_CR8F;
+ pVBInfo->pCRD0 = XG27_CRD0;
+ pVBInfo->pCRDE = XG27_CRDE;
+ pVBInfo->pSR40 = &XG27_SR40;
+ pVBInfo->pSR41 = &XG27_SR41;
+
+ }
+
+ if (ChipType >= XG20) {
+ pVBInfo->pDVOSetting = &XG21_DVOSetting;
+ pVBInfo->pCR2E = &XG21_CR2E;
+ pVBInfo->pCR2F = &XG21_CR2F;
+ pVBInfo->pCR46 = &XG21_CR46;
+ pVBInfo->pCR47 = &XG21_CR47;
+ }
+
+}
-/* --------------------------------------------------------------------- */
-/* Function : XGISetModeNew */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
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 ) ;
- */
- }
+ 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 ( 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) ;
-*/
+ if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 */
+ XGI_GetVBType(pVBInfo);
- XGI_UpdateModeInfo( HwDeviceExtension, 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 ( HwDeviceExtension->jChipType < XG20 ) /* kuku 2004/06/25 */
-{
- XGI_LockCRT2( HwDeviceExtension, pVBInfo ) ;
-}
+ /*
+ 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);
- return 1;
-}
+ if (temp == 0)
+ return (0);
+ XGI_DisplayOff(HwDeviceExtension, pVBInfo) ;
+ XGI_SetCRT1Group(HwDeviceExtension, ModeNo, ModeIdIndex, pVBInfo);
+ XGI_DisplayOn(HwDeviceExtension, pVBInfo);
+ */
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetCRT1Group */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-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 ) ; */
+ 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); */
+}
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GetModePtr */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
unsigned char XGI_GetModePtr(unsigned short ModeNo, unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo)
+ struct vb_device_info *pVBInfo)
{
- unsigned char index ;
+ unsigned char index;
- if ( ModeNo <= 0x13 )
- index = pVBInfo->SModeIDTable[ ModeIdIndex ].St_StTableIndex ;
- else
- {
- if ( pVBInfo->ModeType <= 0x02 )
- index = 0x1B ; /* 02 -> ModeEGA */
- else
- index = 0x0F ;
- }
- return( index ) ; /* Get pVBInfo->StandTable index */
+ if (ModeNo <= 0x13)
+ index = pVBInfo->SModeIDTable[ModeIdIndex].St_StTableIndex;
+ else {
+ if (pVBInfo->ModeType <= 0x02)
+ index = 0x1B; /* 02 -> ModeEGA */
+ else
+ index = 0x0F;
+ }
+ return index; /* Get pVBInfo->StandTable index */
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetBIOSData */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-/*unsigned char XGI_SetBIOSData(unsigned short ModeNo, unsigned short ModeIdIndex)
-{
- return( 0 ) ;
+/*
+unsigned char XGI_SetBIOSData(unsigned short ModeNo, unsigned short ModeIdIndex) {
+ return (0);
}
*/
-/* --------------------------------------------------------------------- */
-/* Function : XGI_ClearBankRegs */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-/*unsigned char XGI_ClearBankRegs(unsigned short ModeNo, unsigned short ModeIdIndex)
-{
- return( 0 ) ;
+/* unsigned char XGI_ClearBankRegs(unsigned short ModeNo, unsigned short ModeIdIndex) {
+ return( 0 ) ;
}
*/
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetSeqRegs */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
void XGI_SetSeqRegs(unsigned short ModeNo, unsigned short StandTableIndex,
- unsigned short ModeIdIndex, struct vb_device_info *pVBInfo)
+ unsigned short ModeIdIndex, struct vb_device_info *pVBInfo)
{
- unsigned char tempah ,
- SRdata ;
-
- unsigned short i ,
- modeflag ;
-
- if ( ModeNo <= 0x13 )
- modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ;
- else
- modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ;
+ unsigned char tempah, SRdata;
- XGINew_SetReg1( pVBInfo->P3c4 , 0x00 , 0x03 ) ; /* Set SR0 */
- tempah=pVBInfo->StandTable[ StandTableIndex ].SR[ 0 ] ;
+ unsigned short i, modeflag;
- i = SetCRT2ToLCDA ;
- if ( pVBInfo->VBInfo & SetCRT2ToLCDA )
- {
- tempah |= 0x01 ;
- }
- else
- {
- if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToLCD ) )
- {
- if ( pVBInfo->VBInfo & SetInSlaveMode )
- tempah |= 0x01 ;
- }
- }
+ if (ModeNo <= 0x13)
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
+ else
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+
+ XGINew_SetReg1(pVBInfo->P3c4, 0x00, 0x03); /* Set SR0 */
+ tempah = pVBInfo->StandTable[StandTableIndex].SR[0];
+
+ i = SetCRT2ToLCDA;
+ if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
+ tempah |= 0x01;
+ } else {
+ if (pVBInfo->VBInfo & (SetCRT2ToTV | SetCRT2ToLCD)) {
+ if (pVBInfo->VBInfo & SetInSlaveMode)
+ tempah |= 0x01;
+ }
+ }
- tempah |= 0x20 ; /* screen off */
- XGINew_SetReg1( pVBInfo->P3c4 , 0x01 , tempah ) ; /* Set SR1 */
+ tempah |= 0x20; /* screen off */
+ XGINew_SetReg1(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 */
- }
+ 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 */
+ }
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetMiscRegs */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_SetMiscRegs(unsigned short StandTableIndex, struct vb_device_info *pVBInfo)
+void XGI_SetMiscRegs(unsigned short StandTableIndex,
+ struct vb_device_info *pVBInfo)
{
- unsigned char Miscdata ;
+ unsigned char Miscdata;
- Miscdata = pVBInfo->StandTable[ StandTableIndex ].MISC ; /* Get Misc from file */
-/*
- if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) )
- {
- if ( pVBInfo->VBInfo & SetCRT2ToLCDA )
- {
- Miscdata |= 0x0C ;
- }
- }
-*/
+ Miscdata = pVBInfo->StandTable[StandTableIndex].MISC; /* Get Misc from file */
+ /*
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C)) {
+ if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
+ Miscdata |= 0x0C;
+ }
+ }
+ */
- XGINew_SetReg3( pVBInfo->P3c2 , Miscdata ) ; /* Set Misc(3c2) */
+ XGINew_SetReg3(pVBInfo->P3c2, Miscdata); /* Set Misc(3c2) */
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetCRTCRegs */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
void XGI_SetCRTCRegs(struct xgi_hw_device_info *HwDeviceExtension,
- unsigned short StandTableIndex, struct vb_device_info *pVBInfo)
+ unsigned short StandTableIndex, struct vb_device_info *pVBInfo)
{
- unsigned char CRTCdata ;
- unsigned short i ;
+ unsigned char CRTCdata;
+ unsigned short i;
- CRTCdata = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x11);
- CRTCdata &= 0x7f ;
- XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , CRTCdata ) ; /* Unlock CRTC */
+ CRTCdata = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x11);
+ CRTCdata &= 0x7f;
+ XGINew_SetReg1(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 ) */
- }
-/*
- if ( ( HwDeviceExtension->jChipType == XGI_630 )&& ( HwDeviceExtension->jChipRevision == 0x30 ) )
- {
- if ( pVBInfo->VBInfo & SetInSlaveMode )
- {
- if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToTV ) )
- {
- XGINew_SetReg1( pVBInfo->P3d4 , 0x18 , 0xFE ) ;
- }
- }
- }
-*/
+ 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) */
+ }
+ /*
+ if ((HwDeviceExtension->jChipType == XGI_630) && (HwDeviceExtension->jChipRevision == 0x30)) {
+ if (pVBInfo->VBInfo & SetInSlaveMode) {
+ if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToTV)) {
+ XGINew_SetReg1(pVBInfo->P3d4, 0x18, 0xFE);
+ }
+ }
+ }
+ */
}
-
-/* --------------------------------------------------------------------- */
-/* Function : */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
void XGI_SetATTRegs(unsigned short ModeNo, unsigned short StandTableIndex,
- unsigned short ModeIdIndex, struct vb_device_info *pVBInfo)
-{
- unsigned char ARdata ;
- unsigned short i, modeflag;
-
- if ( ModeNo <= 0x13 )
- modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ;
- else
- modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ;
-
- for( i = 0 ; i <= 0x13 ; i++ )
- {
- ARdata = pVBInfo->StandTable[ StandTableIndex ].ATTR[ i ] ;
- if ( modeflag & Charx8Dot ) /* ifndef Dot9 */
- {
- if ( i == 0x13 )
- {
- if ( pVBInfo->VBInfo & SetCRT2ToLCDA )
- ARdata = 0 ;
- else
- {
- if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToLCD ) )
- {
- if ( pVBInfo->VBInfo & SetInSlaveMode )
- ARdata = 0 ;
- }
- }
- }
- }
-
- XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */
- XGINew_SetReg3( pVBInfo->P3c0 , i ) ; /* set index */
- XGINew_SetReg3( pVBInfo->P3c0 , ARdata ) ; /* 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 ) ;
-}
+ unsigned short ModeIdIndex, struct vb_device_info *pVBInfo)
+{
+ unsigned char ARdata;
+ unsigned short i, modeflag;
+ if (ModeNo <= 0x13)
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
+ else
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+
+ for (i = 0; i <= 0x13; i++) {
+ ARdata = pVBInfo->StandTable[StandTableIndex].ATTR[i];
+ if (modeflag & Charx8Dot) { /* ifndef Dot9 */
+ if (i == 0x13) {
+ if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
+ ARdata = 0;
+ } else {
+ if (pVBInfo->VBInfo & (SetCRT2ToTV
+ | SetCRT2ToLCD)) {
+ if (pVBInfo->VBInfo
+ & SetInSlaveMode)
+ ARdata = 0;
+ }
+ }
+ }
+ }
+
+ XGINew_GetReg2(pVBInfo->P3da); /* reset 3da */
+ XGINew_SetReg3(pVBInfo->P3c0, i); /* set index */
+ XGINew_SetReg3(pVBInfo->P3c0, ARdata); /* set data */
+ }
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetGRCRegs */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_SetGRCRegs(unsigned short StandTableIndex, struct vb_device_info *pVBInfo)
+ 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);
+}
+
+void XGI_SetGRCRegs(unsigned short StandTableIndex,
+ struct vb_device_info *pVBInfo)
{
- unsigned char GRdata ;
- unsigned short i ;
+ unsigned char GRdata;
+ unsigned short i;
- 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) */
- }
+ 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) */
+ }
- if ( pVBInfo->ModeType > ModeVGA )
- {
- GRdata = (unsigned char)XGINew_GetReg1(pVBInfo->P3ce, 0x05);
- GRdata &= 0xBF ; /* 256 color disable */
- XGINew_SetReg1( pVBInfo->P3ce , 0x05 , GRdata ) ;
- }
+ if (pVBInfo->ModeType > ModeVGA) {
+ GRdata = (unsigned char) XGINew_GetReg1(pVBInfo->P3ce, 0x05);
+ GRdata &= 0xBF; /* 256 color disable */
+ XGINew_SetReg1(pVBInfo->P3ce, 0x05, GRdata);
+ }
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_ClearExt1Regs */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
void XGI_ClearExt1Regs(struct vb_device_info *pVBInfo)
{
- unsigned short i ;
+ unsigned short i;
- for( i = 0x0A ; i <= 0x0E ; i++ )
- XGINew_SetReg1( pVBInfo->P3c4 , i , 0x00 ) ; /* Clear SR0A-SR0E */
+ for (i = 0x0A; i <= 0x0E; i++)
+ XGINew_SetReg1(pVBInfo->P3c4, i, 0x00); /* Clear SR0A-SR0E */
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetDefaultVCLK */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
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 ) ;
+ 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);
- 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 ) ;
+ 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);
- XGINew_SetRegAND( pVBInfo->P3c4 , 0x31 , ~0x30 ) ;
- return( 0 ) ;
+ XGINew_SetRegAND(pVBInfo->P3c4, 0x31, ~0x30);
+ return 0;
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GetRatePtrCRT2 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
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 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;
-/* --------------------------------------------------------------------- */
-/* Function : XGI_AjustCRT2Rate */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo, unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
- unsigned short *i, struct vb_device_info *pVBInfo)
-{
- unsigned short tempax, tempbx, resinfo, modeflag, infoflag;
-
- if ( ModeNo <= 0x13 )
- {
- modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ModeFlag */
- }
- else
- {
- modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ;
- }
-
- resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ;
- tempbx = pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].ModeID ;
- tempax = 0 ;
-
- if ( pVBInfo->IF_DEF_LVDS == 0 )
- {
- if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC )
- {
- tempax |= SupportRAMDAC2 ;
-
- if ( pVBInfo->VBType & VB_XGI301C )
- tempax |= SupportCRT2in301C ;
- }
-
- if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) /* 301b */
- {
- tempax |= SupportLCD ;
-
- if ( pVBInfo->LCDResInfo != Panel1280x1024 )
- {
- if ( pVBInfo->LCDResInfo != Panel1280x960 )
- {
- if ( pVBInfo->LCDInfo & LCDNonExpanding )
- {
- if ( resinfo >= 9 )
- {
- tempax = 0 ;
- return( 0 ) ;
- }
- }
- }
- }
- }
-
- if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) /* for HiTV */
- {
- if ( ( pVBInfo->VBType & VB_XGI301LV ) && ( pVBInfo->VBExtInfo == VB_YPbPr1080i ) )
- {
- tempax |= SupportYPbPr ;
- if ( pVBInfo->VBInfo & SetInSlaveMode )
- {
- if ( resinfo == 4 )
- return( 0 ) ;
-
- if ( resinfo == 3 )
- return( 0 ) ;
-
- if ( resinfo > 7 )
- return( 0 ) ;
- }
- }
- else
- {
- tempax |= SupportHiVisionTV ;
- if ( pVBInfo->VBInfo & SetInSlaveMode )
- {
- if ( resinfo == 4 )
- return( 0 ) ;
-
- if ( resinfo == 3 )
- {
- if ( pVBInfo->SetFlag & TVSimuMode )
- return( 0 ) ;
- }
-
- if ( resinfo > 7 )
- return( 0 ) ;
- }
- }
- }
- else
- {
- if ( pVBInfo->VBInfo & ( SetCRT2ToAVIDEO | SetCRT2ToSVIDEO | SetCRT2ToSCART | SetCRT2ToYPbPr | SetCRT2ToHiVisionTV ) )
- {
- tempax |= SupportTV ;
-
- if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) )
- {
- tempax |= SupportTV1024 ;
- }
-
- if ( !( pVBInfo->VBInfo & SetPALTV ) )
- {
- if ( modeflag & NoSupportSimuTV )
- {
- if ( pVBInfo->VBInfo & SetInSlaveMode )
- {
- if ( !( pVBInfo->VBInfo & SetNotSimuMode ) )
- {
- return( 0 ) ;
- }
- }
- }
- }
- }
- }
- }
- else /* for LVDS */
- {
- if ( pVBInfo->IF_DEF_CH7005 == 1 )
- {
- if ( pVBInfo->VBInfo & SetCRT2ToTV )
- {
- tempax |= SupportCHTV ;
- }
- }
-
- if ( pVBInfo->VBInfo & SetCRT2ToLCD )
- {
- tempax |= SupportLCD ;
-
- if ( resinfo > 0x08 )
- return( 0 ) ; /* 1024x768 */
-
- if ( pVBInfo->LCDResInfo < Panel1024x768 )
- {
- if ( resinfo > 0x07 )
- return( 0 ) ; /* 800x600 */
-
- if ( resinfo == 0x04 )
- return( 0 ) ; /* 512x384 */
- }
- }
- }
-
- for( ; pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].ModeID == tempbx ; ( *i )-- )
- {
- infoflag = pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].Ext_InfoFlag ;
- if ( infoflag & tempax )
- {
- return( 1 ) ;
- }
- if ( ( *i ) == 0 )
- break ;
- }
-
- for( ( *i ) = 0 ; ; ( *i )++ )
- {
- infoflag = pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].Ext_InfoFlag ;
- if ( pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].ModeID != tempbx )
- {
- return( 0 ) ;
- }
-
- if ( infoflag & tempax )
- {
- return( 1 ) ;
- }
- }
- return( 1 ) ;
-}
+ 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;
+ }
+ }
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetSync */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_SetSync(unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo)
+ 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,
+ unsigned short ModeIdIndex,
+ unsigned short RefreshRateTableIndex, unsigned short *i,
+ struct vb_device_info *pVBInfo)
{
- unsigned short sync ,
- temp ;
+ unsigned short tempax, tempbx, resinfo, modeflag, infoflag;
- sync = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag >> 8 ; /* di+0x00 */
- sync &= 0xC0 ;
- temp = 0x2F ;
- temp |= sync ;
- XGINew_SetReg3( pVBInfo->P3c2 , temp ) ; /* Set Misc(3c2) */
+ if (ModeNo <= 0x13)
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ModeFlag */
+ else
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+
+ resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ tempbx = pVBInfo->RefIndex[RefreshRateTableIndex + (*i)].ModeID;
+ tempax = 0;
+
+ if (pVBInfo->IF_DEF_LVDS == 0) {
+ if (pVBInfo->VBInfo & SetCRT2ToRAMDAC) {
+ tempax |= SupportRAMDAC2;
+
+ if (pVBInfo->VBType & VB_XGI301C)
+ tempax |= SupportCRT2in301C;
+ }
+
+ if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { /* 301b */
+ tempax |= SupportLCD;
+
+ if (pVBInfo->LCDResInfo != Panel1280x1024) {
+ if (pVBInfo->LCDResInfo != Panel1280x960) {
+ if (pVBInfo->LCDInfo & LCDNonExpanding) {
+ if (resinfo >= 9) {
+ tempax = 0;
+ return 0;
+ }
+ }
+ }
+ }
+ }
+
+ if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) { /* for HiTV */
+ if ((pVBInfo->VBType & VB_XGI301LV)
+ && (pVBInfo->VBExtInfo == VB_YPbPr1080i)) {
+ tempax |= SupportYPbPr;
+ if (pVBInfo->VBInfo & SetInSlaveMode) {
+ if (resinfo == 4)
+ return 0;
+
+ if (resinfo == 3)
+ return 0;
+
+ if (resinfo > 7)
+ return 0;
+ }
+ } else {
+ tempax |= SupportHiVisionTV;
+ if (pVBInfo->VBInfo & SetInSlaveMode) {
+ if (resinfo == 4)
+ return 0;
+
+ if (resinfo == 3) {
+ if (pVBInfo->SetFlag
+ & TVSimuMode)
+ return 0;
+ }
+
+ if (resinfo > 7)
+ return 0;
+ }
+ }
+ } else {
+ if (pVBInfo->VBInfo & (SetCRT2ToAVIDEO
+ | SetCRT2ToSVIDEO | SetCRT2ToSCART
+ | SetCRT2ToYPbPr | SetCRT2ToHiVisionTV)) {
+ tempax |= SupportTV;
+
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B
+ | VB_XGI301LV | VB_XGI302LV
+ | VB_XGI301C)) {
+ tempax |= SupportTV1024;
+ }
+
+ if (!(pVBInfo->VBInfo & SetPALTV)) {
+ if (modeflag & NoSupportSimuTV) {
+ if (pVBInfo->VBInfo
+ & SetInSlaveMode) {
+ if (!(pVBInfo->VBInfo
+ & SetNotSimuMode)) {
+ return 0;
+ }
+ }
+ }
+ }
+ }
+ }
+ } else { /* for LVDS */
+ if (pVBInfo->IF_DEF_CH7005 == 1) {
+ if (pVBInfo->VBInfo & SetCRT2ToTV)
+ tempax |= SupportCHTV;
+ }
+
+ if (pVBInfo->VBInfo & SetCRT2ToLCD) {
+ tempax |= SupportLCD;
+
+ if (resinfo > 0x08)
+ return 0; /* 1024x768 */
+
+ if (pVBInfo->LCDResInfo < Panel1024x768) {
+ if (resinfo > 0x07)
+ return 0; /* 800x600 */
+
+ if (resinfo == 0x04)
+ return 0; /* 512x384 */
+ }
+ }
+ }
+
+ for (; pVBInfo->RefIndex[RefreshRateTableIndex + (*i)].ModeID == tempbx; (*i)--) {
+ infoflag
+ = pVBInfo->RefIndex[RefreshRateTableIndex
+ + (*i)].Ext_InfoFlag;
+ if (infoflag & tempax)
+ return 1;
+
+ if ((*i) == 0)
+ break;
+ }
+
+ for ((*i) = 0;; (*i)++) {
+ infoflag
+ = pVBInfo->RefIndex[RefreshRateTableIndex
+ + (*i)].Ext_InfoFlag;
+ if (pVBInfo->RefIndex[RefreshRateTableIndex + (*i)].ModeID
+ != tempbx) {
+ return 0;
+ }
+
+ if (infoflag & tempax)
+ return 1;
+ }
+ return 1;
}
+void XGI_SetSync(unsigned short RefreshRateTableIndex,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short sync, temp;
+
+ sync = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag >> 8; /* di+0x00 */
+ sync &= 0xC0;
+ temp = 0x2F;
+ temp |= sync;
+ XGINew_SetReg3(pVBInfo->P3c2, temp); /* Set Misc(3c2) */
+}
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetCRT1CRTC */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
void XGI_SetCRT1CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
- struct vb_device_info *pVBInfo,
- struct xgi_hw_device_info *HwDeviceExtension)
+ unsigned short RefreshRateTableIndex,
+ struct vb_device_info *pVBInfo,
+ struct xgi_hw_device_info *HwDeviceExtension)
{
- unsigned char index, data;
- unsigned short i;
+ unsigned char index, data;
+ unsigned short i;
- index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; /* Get index */
- index = index&IndexMask ;
+ 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 */
+ 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 < 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 ] ;
+ 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_H(pVBInfo, HwDeviceExtension);
+ XGI_SetCRT1Timing_V(ModeIdIndex, ModeNo, pVBInfo);
+ if (pVBInfo->ModeType > 0x03)
+ XGINew_SetReg1(pVBInfo->P3d4, 0x14, 0x4F);
+}
- XGI_SetCRT1Timing_V( ModeIdIndex , ModeNo, pVBInfo ) ;
+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); */
- if( pVBInfo->ModeType > 0x03 )
- XGINew_SetReg1( pVBInfo->P3d4 , 0x14 , 0x4F ) ;
-}
+ data = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x11); /* unlock cr0-7 */
+ data &= 0x7F;
+ XGINew_SetReg1(pVBInfo->P3d4, 0x11, data);
+ data = pVBInfo->TimingH[0].data[0];
+ XGINew_SetReg1(pVBInfo->P3d4, 0, data);
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetCRT1Timing_H */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-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 ) ; */
-
- data = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x11); /* unlock cr0-7 */
- data &= 0x7F ;
- XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , data ) ;
-
- data = pVBInfo->TimingH[ 0 ].data[ 0 ] ;
- XGINew_SetReg1( 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);
- }
-
- for( i = 0x05 ; i <= 0x06 ; i++ )
- {
- data = pVBInfo->TimingH[ 0 ].data[ i ];
- XGINew_SetReg1(pVBInfo->P3c4, (unsigned short)(i + 6), data);
- }
-
- j = (unsigned char)XGINew_GetReg1(pVBInfo->P3c4, 0x0e);
- j &= 0x1F ;
- data = pVBInfo->TimingH[ 0 ].data[ 7 ] ;
- data &= 0xE0 ;
- data |= j ;
- XGINew_SetReg1( pVBInfo->P3c4 , 0x0e , data ) ;
-
- if ( HwDeviceExtension->jChipType >= XG20 )
- {
- data = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x04);
- data = data - 1 ;
- XGINew_SetReg1( pVBInfo->P3d4 , 0x04 , data ) ;
- data = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x05);
- data1 = data ;
- data1 &= 0xE0 ;
- data &= 0x1F ;
- if ( data == 0 )
- {
- pushax = data ;
- data = (unsigned char)XGINew_GetReg1(pVBInfo->P3c4, 0x0c);
- data &= 0xFB ;
- XGINew_SetReg1( 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);
- data = data >> 5 ;
- data = data + 3 ;
- if ( data > 7 )
- data = data - 7 ;
- data = data << 5 ;
- XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0e , ~0xE0 , data ) ;
- }
-}
+ for (i = 0x01; i <= 0x04; i++) {
+ data = pVBInfo->TimingH[0].data[i];
+ XGINew_SetReg1(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);
+ }
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetCRT1Timing_V */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-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 ) ; */
-
- for( i = 0x00 ; i <= 0x01 ; i++ )
- {
- data = pVBInfo->TimingV[ 0 ].data[ i ] ;
- XGINew_SetReg1(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);
- }
-
- for( i = 0x04 ; i <= 0x05 ; i++ )
- {
- data = pVBInfo->TimingV[ 0 ].data[ i ] ;
- XGINew_SetReg1(pVBInfo->P3d4, (unsigned short)(i + 0x11), data);
- }
-
- j = (unsigned char)XGINew_GetReg1(pVBInfo->P3c4, 0x0a);
- j &= 0xC0 ;
- data = pVBInfo->TimingV[ 0 ].data[ 6 ] ;
- data &= 0x3F ;
- data |= j ;
- XGINew_SetReg1( pVBInfo->P3c4 , 0x0a , data ) ;
-
- data = pVBInfo->TimingV[ 0 ].data[ 6 ] ;
- data &= 0x80 ;
- data = data >> 2 ;
-
- if ( ModeNo <= 0x13 )
- i = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ;
- else
- i = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ;
-
- i &= DoubleScanMode ;
- if ( i )
- data |= 0x80 ;
-
- j = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x09);
- j &= 0x5F ;
- data |= j ;
- XGINew_SetReg1( pVBInfo->P3d4 , 0x09 , data ) ;
+ j = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x0e);
+ j &= 0x1F;
+ data = pVBInfo->TimingH[0].data[7];
+ data &= 0xE0;
+ data |= j;
+ XGINew_SetReg1(pVBInfo->P3c4, 0x0e, data);
+
+ if (HwDeviceExtension->jChipType >= XG20) {
+ data = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x04);
+ data = data - 1;
+ XGINew_SetReg1(pVBInfo->P3d4, 0x04, data);
+ data = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x05);
+ data1 = data;
+ data1 &= 0xE0;
+ data &= 0x1F;
+ if (data == 0) {
+ pushax = data;
+ data = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4,
+ 0x0c);
+ data &= 0xFB;
+ XGINew_SetReg1(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);
+ data = data >> 5;
+ data = data + 3;
+ if (data > 7)
+ data = data - 7;
+ data = data << 5;
+ XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0e, ~0xE0, data);
+ }
}
+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); */
+
+ for (i = 0x00; i <= 0x01; i++) {
+ data = pVBInfo->TimingV[0].data[i];
+ XGINew_SetReg1(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);
+ }
+
+ for (i = 0x04; i <= 0x05; i++) {
+ data = pVBInfo->TimingV[0].data[i];
+ XGINew_SetReg1(pVBInfo->P3d4, (unsigned short) (i + 0x11), data);
+ }
+
+ j = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x0a);
+ j &= 0xC0;
+ data = pVBInfo->TimingV[0].data[6];
+ data &= 0x3F;
+ data |= j;
+ XGINew_SetReg1(pVBInfo->P3c4, 0x0a, data);
+
+ data = pVBInfo->TimingV[0].data[6];
+ data &= 0x80;
+ data = data >> 2;
+
+ if (ModeNo <= 0x13)
+ i = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
+ else
+ i = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+
+ i &= DoubleScanMode;
+ if (i)
+ data |= 0x80;
+
+ j = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x09);
+ j &= 0x5F;
+ data |= j;
+ XGINew_SetReg1(pVBInfo->P3d4, 0x09, data);
+}
/* --------------------------------------------------------------------- */
/* Function : XGI_SetXG21CRTC */
@@ -1517,265 +1289,256 @@ void XGI_SetCRT1Timing_V(unsigned short ModeIdIndex,
/* Description : Set LCD timing */
/* --------------------------------------------------------------------- */
void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
- struct vb_device_info *pVBInfo)
-{
- unsigned char StandTableIndex, index, Tempax, Tempbx, Tempcx, Tempdx;
- unsigned short Temp1, Temp2, Temp3;
-
- 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 */
- Tempbx = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 5 ] ; /* Tempbx: CR05 HRE */
- Tempbx &= 0x1F ; /* Tempbx: HRE[4:0] */
- Tempcx = Tempax ;
- Tempcx &= 0xE0 ; /* Tempcx: HRS[7:5] */
- Tempdx = Tempcx | Tempbx ; /* Tempdx(HRE): HRS[7:5]HRE[4:0] */
- 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 ) ;
-
- 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 */
- 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] */
-
- Temp1 = Tempcx << 1 ; /* Temp1[8]: VRS[8] unsigned char -> unsigned short */
- Temp1 |= Tempbx ; /* Temp1[8:0]: VRS[8:0] */
- Tempax &= 0x80 ; /* Tempax[7]: CR7[7] */
- Temp2 = Tempax << 2 ; /* Temp2[9]: VRS[9] */
- Temp1 |= Temp2 ; /* Temp1[9:0]: VRS[9:0] */
-
- Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 17 ] ; /* CR16 VRE */
- Tempax &= 0x0F ; /* Tempax[3:0]: VRE[3:0] */
- Temp2 = Temp1 & 0x3F0 ; /* Temp2[9:4]: VRS[9:4] */
- Temp2 |= Tempax ; /* Temp2[9:0]: VRE[9:0] */
- Temp3 = Temp1 & 0x0F ; /* Temp3[3:0]: VRS[3:0] */
- if ( Tempax < Temp3 ) /* VRE[3:0]<VRS[3:0] */
- Temp2 |= 0x10 ; /* Temp2: VRE + 0x10 */
- Temp2 &= 0xFF ; /* Temp2[7:0]: VRE[7:0] */
- Tempax = (unsigned char)Temp2; /* Tempax[7:0]: VRE[7:0] */
- Tempax <<= 2 ; /* Tempax << 2: VRE[5:0] */
- Temp1 &= 0x600 ; /* Temp1[10:9]: VRS[10:9] */
- Temp1 >>= 9 ; /* [10:9]->[1:0] */
- 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 */
- }
- 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 */
-
- Tempdx = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 5 ] ; /* SRB */
- Tempdx &= 0xC0 ; /* Tempdx[7:6]: SRB[7:6] */
- Temp1 = Tempdx ; /* Temp1[7:6]: HRS[9:8] */
- Temp1 <<= 2 ; /* Temp1[9:8]: HRS[9:8] */
- Temp1 |= Tempax ; /* Temp1[9:0]: HRS[9:0] */
-
- Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 4 ] ; /* CR5 HRE */
- Tempax &= 0x1F ; /* Tempax[4:0]: HRE[4:0] */
-
- Tempbx = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 6 ] ; /* SRC */
- Tempbx &= 0x04 ; /* Tempbx[2]: HRE[5] */
- Tempbx <<= 3 ; /* Tempbx[5]: HRE[5] */
- Tempax |= Tempbx ; /* Tempax[5:0]: HRE[5:0] */
-
- Temp2 = Temp1 & 0x3C0 ; /* Temp2[9:6]: HRS[9:6] */
- Temp2 |= Tempax ; /* Temp2[9:0]: HRE[9:0] */
-
- Tempcx &= 0x3F ; /* Tempcx[5:0]: HRS[5:0] */
- if( Tempax < Tempcx ) /* HRE < HRS */
- Temp2 |= 0x40 ; /* Temp2 + 0x40 */
-
- Temp2 &= 0xFF ;
- Tempax = (unsigned char)Temp2; /* Tempax: HRE[7:0] */
- 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 ) ;
-
- 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] */
- 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 */
-
- Temp1 = Tempdx ; /* Temp1[7]: Tempdx[7] */
- Temp1 <<= 1 ; /* Temp1[8]: VRS[8] */
- Temp1 |= Tempbx ; /* Temp1[8:0]: VRS[8:0] */
- Tempax &= 0x80 ;
- Temp2 = Tempax << 2 ; /* Temp2[9]: VRS[9] */
- Temp1 |= Temp2 ; /* Temp1[9:0]: VRS[9:0] */
- Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 14 ] ; /* Tempax: SRA */
- Tempax &= 0x08 ; /* Tempax[3]: VRS[3] */
- Temp2 = Tempax ;
- Temp2 <<= 7 ; /* Temp2[10]: VRS[10] */
- Temp1 |= Temp2 ; /* Temp1[10:0]: VRS[10:0] */
-
- Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 11 ] ; /* Tempax: CR11 VRE */
- Tempax &= 0x0F ; /* Tempax[3:0]: VRE[3:0] */
- Tempbx = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 14 ] ; /* Tempbx: SRA */
- Tempbx &= 0x20 ; /* Tempbx[5]: VRE[5] */
- Tempbx >>= 1 ; /* Tempbx[4]: VRE[4] */
- Tempax |= Tempbx ; /* Tempax[4:0]: VRE[4:0] */
- Temp2 = Temp1 & 0x7E0 ; /* Temp2[10:5]: VRS[10:5] */
- Temp2 |= Tempax ; /* Temp2[10:5]: VRE[10:5] */
-
- Temp3 = Temp1 & 0x1F ; /* Temp3[4:0]: VRS[4:0] */
- if ( Tempax < Temp3 ) /* VRE < VRS */
- Temp2 |= 0x20 ; /* VRE + 0x20 */
-
- Temp2 &= 0xFF ;
- Tempax = (unsigned char)Temp2; /* Tempax: VRE[7:0] */
- Tempax <<= 2 ; /* Tempax[7:0]; VRE[5:0]00 */
- Temp1 &= 0x600 ; /* Temp1[10:9]: VRS[10:9] */
- Temp1 >>= 9 ; /* Temp1[1:0]: VRS[10:9] */
- 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 */
- }
+ unsigned short RefreshRateTableIndex,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned char StandTableIndex, index, Tempax, Tempbx, Tempcx, Tempdx;
+ unsigned short Temp1, Temp2, Temp3;
+
+ 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 */
+ Tempbx = pVBInfo->StandTable[StandTableIndex].CRTC[5]; /* Tempbx: CR05 HRE */
+ Tempbx &= 0x1F; /* Tempbx: HRE[4:0] */
+ Tempcx = Tempax;
+ Tempcx &= 0xE0; /* Tempcx: HRS[7:5] */
+ Tempdx = Tempcx | Tempbx; /* Tempdx(HRE): HRS[7:5]HRE[4:0] */
+ 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);
+
+ 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 */
+ 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] */
+
+ Temp1 = Tempcx << 1; /* Temp1[8]: VRS[8] unsigned char -> unsigned short */
+ Temp1 |= Tempbx; /* Temp1[8:0]: VRS[8:0] */
+ Tempax &= 0x80; /* Tempax[7]: CR7[7] */
+ Temp2 = Tempax << 2; /* Temp2[9]: VRS[9] */
+ Temp1 |= Temp2; /* Temp1[9:0]: VRS[9:0] */
+
+ Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[17]; /* CR16 VRE */
+ Tempax &= 0x0F; /* Tempax[3:0]: VRE[3:0] */
+ Temp2 = Temp1 & 0x3F0; /* Temp2[9:4]: VRS[9:4] */
+ Temp2 |= Tempax; /* Temp2[9:0]: VRE[9:0] */
+ Temp3 = Temp1 & 0x0F; /* Temp3[3:0]: VRS[3:0] */
+ if (Tempax < Temp3) /* VRE[3:0]<VRS[3:0] */
+ Temp2 |= 0x10; /* Temp2: VRE + 0x10 */
+ Temp2 &= 0xFF; /* Temp2[7:0]: VRE[7:0] */
+ Tempax = (unsigned char) Temp2; /* Tempax[7:0]: VRE[7:0] */
+ Tempax <<= 2; /* Tempax << 2: VRE[5:0] */
+ Temp1 &= 0x600; /* Temp1[10:9]: VRS[10:9] */
+ Temp1 >>= 9; /* [10:9]->[1:0] */
+ 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 */
+ } 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 */
+
+ Tempdx = pVBInfo->XGINEWUB_CRT1Table[index].CR[5]; /* SRB */
+ Tempdx &= 0xC0; /* Tempdx[7:6]: SRB[7:6] */
+ Temp1 = Tempdx; /* Temp1[7:6]: HRS[9:8] */
+ Temp1 <<= 2; /* Temp1[9:8]: HRS[9:8] */
+ Temp1 |= Tempax; /* Temp1[9:0]: HRS[9:0] */
+
+ Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[4]; /* CR5 HRE */
+ Tempax &= 0x1F; /* Tempax[4:0]: HRE[4:0] */
+
+ Tempbx = pVBInfo->XGINEWUB_CRT1Table[index].CR[6]; /* SRC */
+ Tempbx &= 0x04; /* Tempbx[2]: HRE[5] */
+ Tempbx <<= 3; /* Tempbx[5]: HRE[5] */
+ Tempax |= Tempbx; /* Tempax[5:0]: HRE[5:0] */
+
+ Temp2 = Temp1 & 0x3C0; /* Temp2[9:6]: HRS[9:6] */
+ Temp2 |= Tempax; /* Temp2[9:0]: HRE[9:0] */
+
+ Tempcx &= 0x3F; /* Tempcx[5:0]: HRS[5:0] */
+ if (Tempax < Tempcx) /* HRE < HRS */
+ Temp2 |= 0x40; /* Temp2 + 0x40 */
+
+ Temp2 &= 0xFF;
+ Tempax = (unsigned char) Temp2; /* Tempax: HRE[7:0] */
+ 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);
+
+ 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] */
+ 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 */
+
+ Temp1 = Tempdx; /* Temp1[7]: Tempdx[7] */
+ Temp1 <<= 1; /* Temp1[8]: VRS[8] */
+ Temp1 |= Tempbx; /* Temp1[8:0]: VRS[8:0] */
+ Tempax &= 0x80;
+ Temp2 = Tempax << 2; /* Temp2[9]: VRS[9] */
+ Temp1 |= Temp2; /* Temp1[9:0]: VRS[9:0] */
+ Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[14]; /* Tempax: SRA */
+ Tempax &= 0x08; /* Tempax[3]: VRS[3] */
+ Temp2 = Tempax;
+ Temp2 <<= 7; /* Temp2[10]: VRS[10] */
+ Temp1 |= Temp2; /* Temp1[10:0]: VRS[10:0] */
+
+ Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[11]; /* Tempax: CR11 VRE */
+ Tempax &= 0x0F; /* Tempax[3:0]: VRE[3:0] */
+ Tempbx = pVBInfo->XGINEWUB_CRT1Table[index].CR[14]; /* Tempbx: SRA */
+ Tempbx &= 0x20; /* Tempbx[5]: VRE[5] */
+ Tempbx >>= 1; /* Tempbx[4]: VRE[4] */
+ Tempax |= Tempbx; /* Tempax[4:0]: VRE[4:0] */
+ Temp2 = Temp1 & 0x7E0; /* Temp2[10:5]: VRS[10:5] */
+ Temp2 |= Tempax; /* Temp2[10:5]: VRE[10:5] */
+
+ Temp3 = Temp1 & 0x1F; /* Temp3[4:0]: VRS[4:0] */
+ if (Tempax < Temp3) /* VRE < VRS */
+ Temp2 |= 0x20; /* VRE + 0x20 */
+
+ Temp2 &= 0xFF;
+ Tempax = (unsigned char) Temp2; /* Tempax: VRE[7:0] */
+ Tempax <<= 2; /* Tempax[7:0]; VRE[5:0]00 */
+ Temp1 &= 0x600; /* Temp1[10:9]: VRS[10:9] */
+ Temp1 >>= 9; /* Temp1[1:0]: VRS[10:9] */
+ 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 */
+ }
}
void XGI_SetXG27CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
- struct vb_device_info *pVBInfo)
+ unsigned short RefreshRateTableIndex,
+ struct vb_device_info *pVBInfo)
{
unsigned short StandTableIndex, index, Tempax, Tempbx, Tempcx, Tempdx;
- 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 */
- Tempbx = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 5 ] ; /* Tempbx: CR05 HRE */
- Tempbx &= 0x1F ; /* Tempbx: HRE[4:0] */
- Tempcx = Tempax ;
- Tempcx &= 0xE0 ; /* Tempcx: HRS[7:5] */
- Tempdx = Tempcx | Tempbx ; /* Tempdx(HRE): HRS[7:5]HRE[4:0] */
- 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 ) ;
-
- Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 16 ] ; /* Tempax: CR10 VRS */
- XGINew_SetReg1( 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] */
- Tempcx |= (Tempax << 8) ; /* Tempcx[8] |= VRS[8] */
- Tempcx |= (Tempbx & 0x80)<<2; /* Tempcx[9] |= VRS[9] */
-
-
- Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 17 ] ; /* CR11 VRE */
- Tempax &= 0x0F ; /* Tempax: VRE[3:0] */
- Tempbx = Tempcx ; /* Tempbx=Tempcx=VRS[9:0] */
- Tempbx &= 0x3F0 ; /* Tempbx[9:4]: VRS[9:4] */
- Tempbx |= Tempax ; /* Tempbx[9:0]: VRE[9:0] */
- if ( Tempax <= (Tempcx & 0x0F) ) /* VRE[3:0]<=VRS[3:0] */
- Tempbx |= 0x10 ; /* Tempbx: VRE + 0x10 */
- 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] */
- }
- 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 */
-
- Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 5 ] ; /* SR0B */
- Tempax &= 0xC0 ; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8]*/
- Tempbx |= (Tempax << 2); /* Tempbx: HRS[9:0] */
-
- Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 4 ] ; /* CR5 HRE */
- Tempax &= 0x1F ; /* Tempax[4:0]: HRE[4:0] */
- Tempcx = Tempax ; /* Tempcx: HRE[4:0] */
-
- Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 6 ] ; /* SRC */
- Tempax &= 0x04 ; /* Tempax[2]: HRE[5] */
- Tempax <<= 3 ; /* Tempax[5]: HRE[5] */
- Tempcx |= Tempax ; /* Tempcx[5:0]: HRE[5:0] */
-
- Tempbx = Tempbx & 0x3C0 ; /* Tempbx[9:6]: HRS[9:6] */
- Tempbx |= Tempcx ; /* Tempbx: HRS[9:6]HRE[5:0] */
-
- Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 3 ] ; /* Tempax: CR4 HRS */
- Tempax &= 0x3F ; /* Tempax: HRS[5:0] */
- if( Tempcx <= Tempax ) /* HRE[5:0] < HRS[5:0] */
- Tempbx += 0x40 ; /* Tempbx= Tempbx + 0x40 : HRE[9:0]*/
-
- Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 5 ] ; /* SR0B */
- 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 ) ;
-
- Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 10 ] ; /* CR10 VRS */
- XGINew_SetReg1( 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] */
- Tempcx |= (Tempax<<8) ; /* Tempcx <= VRS[8:0] */
- Tempcx |= ((Tempbx&0x80)<<2) ; /* Tempcx <= VRS[9:0] */
- Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 14 ] ; /* Tempax: SR0A */
- Tempax &= 0x08; /* SR0A[3] VRS[10] */
- Tempcx |= (Tempax<<7) ; /* Tempcx <= VRS[10:0] */
-
-
- Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 11 ] ; /* Tempax: CR11 VRE */
- Tempax &= 0x0F ; /* Tempax[3:0]: VRE[3:0] */
- Tempbx = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 14 ] ; /* Tempbx: SR0A */
- Tempbx &= 0x20 ; /* Tempbx[5]: SR0A[5]: VRE[4] */
- Tempbx >>= 1 ; /* Tempbx[4]: VRE[4] */
- Tempax |= Tempbx ; /* Tempax[4:0]: VRE[4:0] */
- Tempbx = Tempcx ; /* Tempbx: VRS[10:0] */
- Tempbx &= 0x7E0 ; /* Tempbx[10:5]: VRS[10:5] */
- Tempbx |= Tempax ; /* Tempbx: VRS[10:5]VRE[4:0] */
-
- if ( Tempbx <= Tempcx ) /* VRE <= VRS */
- 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] */
- Tempax = Tempcx >> 8;
- XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x07 , Tempax ) ; /* SR35[2:0]:VRS[10:8] */
- }
+ 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 */
+ Tempbx = pVBInfo->StandTable[StandTableIndex].CRTC[5]; /* Tempbx: CR05 HRE */
+ Tempbx &= 0x1F; /* Tempbx: HRE[4:0] */
+ Tempcx = Tempax;
+ Tempcx &= 0xE0; /* Tempcx: HRS[7:5] */
+ Tempdx = Tempcx | Tempbx; /* Tempdx(HRE): HRS[7:5]HRE[4:0] */
+ 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);
+
+ Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[16]; /* Tempax: CR10 VRS */
+ XGINew_SetReg1(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] */
+ Tempcx |= (Tempax << 8); /* Tempcx[8] |= VRS[8] */
+ Tempcx |= (Tempbx & 0x80) << 2; /* Tempcx[9] |= VRS[9] */
+
+ Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[17]; /* CR11 VRE */
+ Tempax &= 0x0F; /* Tempax: VRE[3:0] */
+ Tempbx = Tempcx; /* Tempbx=Tempcx=VRS[9:0] */
+ Tempbx &= 0x3F0; /* Tempbx[9:4]: VRS[9:4] */
+ Tempbx |= Tempax; /* Tempbx[9:0]: VRE[9:0] */
+ if (Tempax <= (Tempcx & 0x0F)) /* VRE[3:0]<=VRS[3:0] */
+ Tempbx |= 0x10; /* Tempbx: VRE + 0x10 */
+ 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] */
+ } 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 */
+
+ Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[5]; /* SR0B */
+ Tempax &= 0xC0; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8]*/
+ Tempbx |= (Tempax << 2); /* Tempbx: HRS[9:0] */
+
+ Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[4]; /* CR5 HRE */
+ Tempax &= 0x1F; /* Tempax[4:0]: HRE[4:0] */
+ Tempcx = Tempax; /* Tempcx: HRE[4:0] */
+
+ Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[6]; /* SRC */
+ Tempax &= 0x04; /* Tempax[2]: HRE[5] */
+ Tempax <<= 3; /* Tempax[5]: HRE[5] */
+ Tempcx |= Tempax; /* Tempcx[5:0]: HRE[5:0] */
+
+ Tempbx = Tempbx & 0x3C0; /* Tempbx[9:6]: HRS[9:6] */
+ Tempbx |= Tempcx; /* Tempbx: HRS[9:6]HRE[5:0] */
+
+ Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[3]; /* Tempax: CR4 HRS */
+ Tempax &= 0x3F; /* Tempax: HRS[5:0] */
+ if (Tempcx <= Tempax) /* HRE[5:0] < HRS[5:0] */
+ Tempbx += 0x40; /* Tempbx= Tempbx + 0x40 : HRE[9:0]*/
+
+ Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[5]; /* SR0B */
+ 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);
+
+ Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[10]; /* CR10 VRS */
+ XGINew_SetReg1(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] */
+ Tempcx |= (Tempax << 8); /* Tempcx <= VRS[8:0] */
+ Tempcx |= ((Tempbx & 0x80) << 2); /* Tempcx <= VRS[9:0] */
+ Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[14]; /* Tempax: SR0A */
+ Tempax &= 0x08; /* SR0A[3] VRS[10] */
+ Tempcx |= (Tempax << 7); /* Tempcx <= VRS[10:0] */
+
+ Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[11]; /* Tempax: CR11 VRE */
+ Tempax &= 0x0F; /* Tempax[3:0]: VRE[3:0] */
+ Tempbx = pVBInfo->XGINEWUB_CRT1Table[index].CR[14]; /* Tempbx: SR0A */
+ Tempbx &= 0x20; /* Tempbx[5]: SR0A[5]: VRE[4] */
+ Tempbx >>= 1; /* Tempbx[4]: VRE[4] */
+ Tempax |= Tempbx; /* Tempax[4:0]: VRE[4:0] */
+ Tempbx = Tempcx; /* Tempbx: VRS[10:0] */
+ Tempbx &= 0x7E0; /* Tempbx[10:5]: VRS[10:5] */
+ Tempbx |= Tempax; /* Tempbx: VRS[10:5]VRE[4:0] */
+
+ if (Tempbx <= Tempcx) /* VRE <= VRS */
+ 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] */
+ Tempax = Tempcx >> 8;
+ XGINew_SetRegANDOR(pVBInfo->P3c4, 0x35, ~0x07, Tempax); /* SR35[2:0]:VRS[10:8] */
+ }
}
-
/* --------------------------------------------------------------------- */
/* Function : XGI_SetXG21LCD */
/* Input : */
@@ -1783,109 +1546,97 @@ void XGI_SetXG27CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
/* Description : All values set zero */
/* --------------------------------------------------------------------- */
void XGI_SetXG21LCD(struct vb_device_info *pVBInfo,
- unsigned short RefreshRateTableIndex,
- unsigned short ModeNo)
+ unsigned short RefreshRateTableIndex, unsigned short ModeNo)
{
unsigned short Data, Temp, b3CC;
unsigned short XGI_P3cc;
- 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 ) ;
- 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 ) ;
- }
-
- Temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ;
-
- if ( Temp & 0x01 )
- {
- XGINew_SetRegOR( pVBInfo->P3c4 , 0x06 , 0x40 ) ; /* 18 bits FP */
- XGINew_SetRegOR( pVBInfo->P3c4 , 0x09 , 0x40 ) ;
- }
-
- XGINew_SetRegOR( pVBInfo->P3c4 , 0x1E , 0x01 ) ; /* Negative blank polarity */
-
- XGINew_SetRegAND( pVBInfo->P3c4 , 0x30 , ~0x20 ) ;
- XGINew_SetRegAND( pVBInfo->P3c4 , 0x35 , ~0x80 ) ;
-
- if ( ModeNo <= 0x13 )
- {
- b3CC = (unsigned char) XGINew_GetReg2(XGI_P3cc);
- if ( b3CC & 0x40 )
- XGINew_SetRegOR( pVBInfo->P3c4 , 0x30 , 0x20 ) ; /* Hsync polarity */
- if ( b3CC & 0x80 )
- XGINew_SetRegOR( pVBInfo->P3c4 , 0x35 , 0x80 ) ; /* Vsync polarity */
- }
- else
- {
- Data = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ;
- if ( Data & 0x4000 )
- XGINew_SetRegOR( pVBInfo->P3c4 , 0x30 , 0x20 ) ; /* Hsync polarity */
- if ( Data & 0x8000 )
- XGINew_SetRegOR( pVBInfo->P3c4 , 0x35 , 0x80 ) ; /* Vsync polarity */
- }
+ 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);
+ 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);
+ }
+
+ Temp = XGINew_GetReg1(pVBInfo->P3d4, 0x37);
+
+ if (Temp & 0x01) {
+ XGINew_SetRegOR(pVBInfo->P3c4, 0x06, 0x40); /* 18 bits FP */
+ XGINew_SetRegOR(pVBInfo->P3c4, 0x09, 0x40);
+ }
+
+ XGINew_SetRegOR(pVBInfo->P3c4, 0x1E, 0x01); /* Negative blank polarity */
+
+ XGINew_SetRegAND(pVBInfo->P3c4, 0x30, ~0x20);
+ XGINew_SetRegAND(pVBInfo->P3c4, 0x35, ~0x80);
+
+ if (ModeNo <= 0x13) {
+ b3CC = (unsigned char) XGINew_GetReg2(XGI_P3cc);
+ if (b3CC & 0x40)
+ XGINew_SetRegOR(pVBInfo->P3c4, 0x30, 0x20); /* Hsync polarity */
+ if (b3CC & 0x80)
+ XGINew_SetRegOR(pVBInfo->P3c4, 0x35, 0x80); /* Vsync polarity */
+ } else {
+ Data = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
+ if (Data & 0x4000)
+ XGINew_SetRegOR(pVBInfo->P3c4, 0x30, 0x20); /* Hsync polarity */
+ if (Data & 0x8000)
+ XGINew_SetRegOR(pVBInfo->P3c4, 0x35, 0x80); /* Vsync polarity */
+ }
}
void XGI_SetXG27LCD(struct vb_device_info *pVBInfo,
- unsigned short RefreshRateTableIndex,
- unsigned short ModeNo)
-{
- unsigned short Data , Temp , b3CC ;
- unsigned short XGI_P3cc ;
-
- 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 ) ;
-
- Temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ;
- if ( ( Temp & 0x03 ) == 0 ) /* dual 12 */
- {
- XGINew_SetReg1( pVBInfo->P3d4 , 0x46 , 0x13 ) ;
- XGINew_SetReg1( 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 ) ;
- }
-
- XGI_SetXG27FPBits(pVBInfo);
-
- XGINew_SetRegOR( pVBInfo->P3c4 , 0x1E , 0x01 ) ; /* Negative blank polarity */
-
- XGINew_SetRegAND( pVBInfo->P3c4 , 0x30 , ~0x20 ) ; /* Hsync polarity */
- XGINew_SetRegAND( pVBInfo->P3c4 , 0x35 , ~0x80 ) ; /* Vsync polarity */
-
- if ( ModeNo <= 0x13 )
- {
- b3CC = (unsigned char) XGINew_GetReg2(XGI_P3cc);
- if ( b3CC & 0x40 )
- XGINew_SetRegOR( pVBInfo->P3c4 , 0x30 , 0x20 ) ; /* Hsync polarity */
- if ( b3CC & 0x80 )
- XGINew_SetRegOR( pVBInfo->P3c4 , 0x35 , 0x80 ) ; /* Vsync polarity */
- }
- else
- {
- Data = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ;
- if ( Data & 0x4000 )
- XGINew_SetRegOR( pVBInfo->P3c4 , 0x30 , 0x20 ) ; /* Hsync polarity */
- if ( Data & 0x8000 )
- XGINew_SetRegOR( pVBInfo->P3c4 , 0x35 , 0x80 ) ; /* Vsync polarity */
- }
+ unsigned short RefreshRateTableIndex, unsigned short ModeNo)
+{
+ unsigned short Data, Temp, b3CC;
+ unsigned short XGI_P3cc;
+
+ 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);
+
+ Temp = XGINew_GetReg1(pVBInfo->P3d4, 0x37);
+ if ((Temp & 0x03) == 0) { /* dual 12 */
+ XGINew_SetReg1(pVBInfo->P3d4, 0x46, 0x13);
+ XGINew_SetReg1(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);
+ }
+
+ XGI_SetXG27FPBits(pVBInfo);
+
+ XGINew_SetRegOR(pVBInfo->P3c4, 0x1E, 0x01); /* Negative blank polarity */
+
+ XGINew_SetRegAND(pVBInfo->P3c4, 0x30, ~0x20); /* Hsync polarity */
+ XGINew_SetRegAND(pVBInfo->P3c4, 0x35, ~0x80); /* Vsync polarity */
+
+ if (ModeNo <= 0x13) {
+ b3CC = (unsigned char) XGINew_GetReg2(XGI_P3cc);
+ if (b3CC & 0x40)
+ XGINew_SetRegOR(pVBInfo->P3c4, 0x30, 0x20); /* Hsync polarity */
+ if (b3CC & 0x80)
+ XGINew_SetRegOR(pVBInfo->P3c4, 0x35, 0x80); /* Vsync polarity */
+ } else {
+ Data = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
+ if (Data & 0x4000)
+ XGINew_SetRegOR(pVBInfo->P3c4, 0x30, 0x20); /* Hsync polarity */
+ if (Data & 0x8000)
+ XGINew_SetRegOR(pVBInfo->P3c4, 0x35, 0x80); /* Vsync polarity */
+ }
}
/* --------------------------------------------------------------------- */
@@ -1894,4772 +1645,4030 @@ 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,
- unsigned short RefreshRateTableIndex)
-{
- int i , index = -1;
-
- XGINew_SetRegAND( pVBInfo->P3d4 , 0x11 , 0x7F ) ; /* Unlock CR0~7 */
- if ( ModeNo <= 0x13 )
- {
- for( i = 0 ; i < 12 ; i++ )
- {
- if ( ModeNo == pVBInfo->UpdateCRT1[ i ].ModeID )
- index = i ;
- }
- }
- else
- {
- if ( ModeNo == 0x2E && ( pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC == RES640x480x60 ) )
- index = 12 ;
- else if ( ModeNo == 0x2E && ( pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC == RES640x480x72 ) )
- index = 13 ;
- else if ( ModeNo == 0x2F )
- index = 14 ;
- else if ( ModeNo == 0x50 )
- index = 15 ;
- else if ( ModeNo == 0x59 )
- index = 16 ;
- }
-
- if( index != -1 )
- {
- XGINew_SetReg1( pVBInfo->P3d4 , 0x02 , pVBInfo->UpdateCRT1[ index ].CR02 ) ;
- XGINew_SetReg1( pVBInfo->P3d4 , 0x03 , pVBInfo->UpdateCRT1[ index ].CR03 ) ;
- XGINew_SetReg1( pVBInfo->P3d4 , 0x15 , pVBInfo->UpdateCRT1[ index ].CR15 ) ;
- XGINew_SetReg1( pVBInfo->P3d4 , 0x16 , pVBInfo->UpdateCRT1[ index ].CR16 ) ;
- }
-}
+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 */
+ if (ModeNo <= 0x13) {
+ for (i = 0; i < 12; i++) {
+ if (ModeNo == pVBInfo->UpdateCRT1[i].ModeID)
+ index = i;
+ }
+ } else {
+ if (ModeNo == 0x2E
+ && (pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC
+ == RES640x480x60))
+ index = 12;
+ else if (ModeNo == 0x2E
+ && (pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC
+ == RES640x480x72))
+ index = 13;
+ else if (ModeNo == 0x2F)
+ index = 14;
+ else if (ModeNo == 0x50)
+ index = 15;
+ else if (ModeNo == 0x59)
+ index = 16;
+ }
+ if (index != -1) {
+ XGINew_SetReg1(pVBInfo->P3d4, 0x02,
+ pVBInfo->UpdateCRT1[index].CR02);
+ XGINew_SetReg1(pVBInfo->P3d4, 0x03,
+ pVBInfo->UpdateCRT1[index].CR03);
+ XGINew_SetReg1(pVBInfo->P3d4, 0x15,
+ pVBInfo->UpdateCRT1[index].CR15);
+ XGINew_SetReg1(pVBInfo->P3d4, 0x16,
+ pVBInfo->UpdateCRT1[index].CR16);
+ }
+}
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetCRT1DE */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension,
- unsigned short ModeNo,
- unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
- struct vb_device_info *pVBInfo)
+ unsigned short ModeNo, unsigned short ModeIdIndex,
+ unsigned short RefreshRateTableIndex,
+ struct vb_device_info *pVBInfo)
{
unsigned short resindex, tempax, tempbx, tempcx, temp, modeflag;
- unsigned char data;
+ unsigned char data;
- resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ;
+ resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo);
- if ( ModeNo <= 0x13 )
- {
- modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ;
- tempax = pVBInfo->StResInfo[ resindex ].HTotal ;
- tempbx = pVBInfo->StResInfo[ resindex ].VTotal ;
- }
- else
- {
- modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ;
- tempax = pVBInfo->ModeResInfo[ resindex ].HTotal ;
- tempbx = pVBInfo->ModeResInfo[ resindex ].VTotal ;
- }
+ if (ModeNo <= 0x13) {
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
+ tempax = pVBInfo->StResInfo[resindex].HTotal;
+ tempbx = pVBInfo->StResInfo[resindex].VTotal;
+ } else {
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ tempax = pVBInfo->ModeResInfo[resindex].HTotal;
+ tempbx = pVBInfo->ModeResInfo[resindex].VTotal;
+ }
- if ( modeflag & HalfDCLK )
- tempax = tempax >> 1 ;
+ if (modeflag & HalfDCLK)
+ tempax = tempax >> 1;
- if ( ModeNo > 0x13 )
- {
- if ( modeflag & HalfDCLK )
- tempax = tempax << 1 ;
+ if (ModeNo > 0x13) {
+ if (modeflag & HalfDCLK)
+ tempax = tempax << 1;
- temp = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ;
+ temp = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
- if ( temp & InterlaceMode )
- tempbx = tempbx >> 1 ;
+ if (temp & InterlaceMode)
+ tempbx = tempbx >> 1;
- if ( modeflag & DoubleScanMode )
- tempbx = tempbx << 1 ;
- }
+ if (modeflag & DoubleScanMode)
+ tempbx = tempbx << 1;
+ }
- tempcx = 8 ;
+ tempcx = 8;
- /* if ( !( modeflag & Charx8Dot ) ) */
- /* tempcx = 9 ; */
+ /* if (!(modeflag & Charx8Dot)) */
+ /* tempcx = 9; */
- tempax /= tempcx ;
- tempax -= 1 ;
- tempbx -= 1 ;
- tempcx = tempax ;
- temp = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x11);
- data = (unsigned char)XGINew_GetReg1(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, (unsigned short)((tempcx & 0x0ff00) >> 10));
- XGINew_SetReg1(pVBInfo->P3d4, 0x12, (unsigned short)(tempbx & 0xff));
- tempax = 0 ;
- tempbx = tempbx >> 8 ;
+ tempax /= tempcx;
+ tempax -= 1;
+ tempbx -= 1;
+ tempcx = tempax;
+ temp = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x11);
+ data = (unsigned char) XGINew_GetReg1(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,
+ (unsigned short) ((tempcx & 0x0ff00) >> 10));
+ XGINew_SetReg1(pVBInfo->P3d4, 0x12, (unsigned short) (tempbx & 0xff));
+ tempax = 0;
+ tempbx = tempbx >> 8;
- if ( tempbx & 0x01 )
- tempax |= 0x02 ;
+ if (tempbx & 0x01)
+ tempax |= 0x02;
- if ( tempbx & 0x02 )
- tempax |= 0x40 ;
+ if (tempbx & 0x02)
+ tempax |= 0x40;
- XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x42 , tempax ) ;
- data = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x07);
- data &= 0xFF ;
- tempax = 0 ;
+ XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x42, tempax);
+ data = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x07);
+ data &= 0xFF;
+ tempax = 0;
- if ( tempbx & 0x04 )
- tempax |= 0x02 ;
+ if (tempbx & 0x04)
+ tempax |= 0x02;
- XGINew_SetRegANDOR( pVBInfo->P3d4 ,0x0a , ~0x02 , tempax ) ;
- XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , temp ) ;
+ XGINew_SetRegANDOR(pVBInfo->P3d4, 0x0a, ~0x02, tempax);
+ XGINew_SetReg1(pVBInfo->P3d4, 0x11, temp);
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GetResInfo */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
unsigned short XGI_GetResInfo(unsigned short ModeNo,
- unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo)
+ unsigned short ModeIdIndex, struct vb_device_info *pVBInfo)
{
unsigned short resindex;
- if ( ModeNo <= 0x13 )
- {
- resindex = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; /* si+St_ResInfo */
- }
- else
- {
- resindex = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; /* si+Ext_ResInfo */
- }
- return( resindex ) ;
-}
+ if (ModeNo <= 0x13)
+ resindex = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo; /* si+St_ResInfo */
+ else
+ resindex = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; /* si+Ext_ResInfo */
+ return resindex;
+}
+
+void XGI_SetCRT1Offset(unsigned short ModeNo, unsigned short ModeIdIndex,
+ unsigned short RefreshRateTableIndex,
+ struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short temp, ah, al, temp2, i, DisplayUnit;
+
+ /* GetOffset */
+ temp = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeInfo;
+ temp = temp >> 8;
+ temp = pVBInfo->ScreenOffset[temp];
+
+ temp2 = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
+ temp2 &= InterlaceMode;
+
+ if (temp2)
+ temp = temp << 1;
+
+ temp2 = pVBInfo->ModeType - ModeEGA;
+
+ switch (temp2) {
+ case 0:
+ temp2 = 1;
+ break;
+ case 1:
+ temp2 = 2;
+ break;
+ case 2:
+ temp2 = 4;
+ break;
+ case 3:
+ temp2 = 4;
+ break;
+ case 4:
+ temp2 = 6;
+ break;
+ case 5:
+ temp2 = 8;
+ break;
+ default:
+ break;
+ }
+ if ((ModeNo >= 0x26) && (ModeNo <= 0x28))
+ temp = temp * temp2 + temp2 / 2;
+ else
+ temp *= temp2;
+
+ /* SetOffset */
+ DisplayUnit = temp;
+ temp2 = temp;
+ temp = temp >> 8; /* ah */
+ temp &= 0x0F;
+ i = XGINew_GetReg1(pVBInfo->P3c4, 0x0E);
+ i &= 0xF0;
+ i |= temp;
+ XGINew_SetReg1(pVBInfo->P3c4, 0x0E, i);
+
+ temp = (unsigned char) temp2;
+ temp &= 0xFF; /* al */
+ XGINew_SetReg1(pVBInfo->P3d4, 0x13, temp);
+
+ /* SetDisplayUnit */
+ temp2 = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
+ temp2 &= InterlaceMode;
+ if (temp2)
+ DisplayUnit >>= 1;
+
+ DisplayUnit = DisplayUnit << 5;
+ ah = (DisplayUnit & 0xff00) >> 8;
+ al = DisplayUnit & 0x00ff;
+ if (al == 0)
+ ah += 1;
+ else
+ ah += 2;
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetCRT1Offset */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_SetCRT1Offset(unsigned short ModeNo,
- unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
- struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo)
-{
- unsigned short temp ,
- ah ,
- al ,
- temp2 ,
- i ,
- DisplayUnit ;
-
- /* GetOffset */
- temp = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeInfo ;
- temp = temp >> 8 ;
- temp = pVBInfo->ScreenOffset[ temp ] ;
-
- temp2 = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ;
- temp2 &= InterlaceMode ;
-
- if ( temp2 )
- temp = temp << 1;
-
- temp2 = pVBInfo->ModeType - ModeEGA ;
-
- switch( temp2 )
- {
- case 0:
- temp2 = 1 ;
- break ;
- case 1:
- temp2 = 2 ;
- break ;
- case 2:
- temp2 = 4 ;
- break ;
- case 3:
- temp2 = 4 ;
- break ;
- case 4:
- temp2 = 6 ;
- break;
- case 5:
- temp2 = 8 ;
- break ;
- default:
- break ;
- }
-
- if ( ( ModeNo >= 0x26 ) && ( ModeNo <= 0x28 ) )
- temp = temp * temp2 + temp2 / 2 ;
- else
- temp *= temp2 ;
-
- /* SetOffset */
- DisplayUnit = temp ;
- temp2 = temp ;
- temp = temp >> 8 ; /* ah */
- temp &= 0x0F ;
- i = XGINew_GetReg1( pVBInfo->P3c4 , 0x0E ) ;
- i &= 0xF0 ;
- i |= temp ;
- XGINew_SetReg1( pVBInfo->P3c4 , 0x0E , i ) ;
-
- temp = (unsigned char)temp2;
- temp &= 0xFF ; /* al */
- XGINew_SetReg1( pVBInfo->P3d4 , 0x13 , temp ) ;
-
- /* SetDisplayUnit */
- temp2 = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ;
- temp2 &= InterlaceMode ;
- if ( temp2 )
- DisplayUnit >>= 1 ;
-
- DisplayUnit = DisplayUnit << 5 ;
- ah = ( DisplayUnit & 0xff00 ) >> 8 ;
- al = DisplayUnit & 0x00ff ;
- if ( al == 0 )
- ah += 1 ;
- else
- ah += 2 ;
-
- if ( HwDeviceExtension->jChipType >= XG20 )
- if ( ( ModeNo == 0x4A ) | (ModeNo == 0x49 ) )
- ah -= 1 ;
-
- XGINew_SetReg1( pVBInfo->P3c4 , 0x10 , ah ) ;
-}
+ if (HwDeviceExtension->jChipType >= XG20)
+ if ((ModeNo == 0x4A) | (ModeNo == 0x49))
+ ah -= 1;
+ XGINew_SetReg1(pVBInfo->P3c4, 0x10, ah);
+}
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetCRT1VCLK */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
void XGI_SetCRT1VCLK(unsigned short ModeNo, unsigned short ModeIdIndex,
- struct xgi_hw_device_info *HwDeviceExtension,
- unsigned short RefreshRateTableIndex,
- struct vb_device_info *pVBInfo)
+ struct xgi_hw_device_info *HwDeviceExtension,
+ unsigned short RefreshRateTableIndex,
+ struct vb_device_info *pVBInfo)
{
unsigned char index, data;
- unsigned short vclkindex ;
-
- 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 , pVBInfo->VCLKData[ index ].SR2B ) ;
- XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->VCLKData[ index ].SR2C ) ;
- XGINew_SetReg1( 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 = pVBInfo->VBVCLKData[ vclkindex ].Part4_A ;
- XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , data ) ;
- data = pVBInfo->VBVCLKData[ vclkindex ].Part4_B ;
- XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , data ) ;
- XGINew_SetReg1( 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 , pVBInfo->VCLKData[ index ].SR2B ) ;
- XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->VCLKData[ index ].SR2C ) ;
- XGINew_SetReg1( 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 ) ;
- index = data ;
- index &= 0xE0 ;
- data &= 0x1F ;
- data = data << 1 ;
- data += 1 ;
- data |= index ;
- XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , data ) ;
- }
- }
-}
+ unsigned short vclkindex;
+
+ 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,
+ pVBInfo->VCLKData[index].SR2B);
+ XGINew_SetReg1(pVBInfo->P3c4, 0x2C,
+ pVBInfo->VCLKData[index].SR2C);
+ XGINew_SetReg1(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 = pVBInfo->VBVCLKData[vclkindex].Part4_A;
+ XGINew_SetReg1(pVBInfo->P3c4, 0x2B, data);
+ data = pVBInfo->VBVCLKData[vclkindex].Part4_B;
+ XGINew_SetReg1(pVBInfo->P3c4, 0x2C, data);
+ XGINew_SetReg1(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,
+ pVBInfo->VCLKData[index].SR2B);
+ XGINew_SetReg1(pVBInfo->P3c4, 0x2C,
+ pVBInfo->VCLKData[index].SR2C);
+ XGINew_SetReg1(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);
+ index = data;
+ index &= 0xE0;
+ data &= 0x1F;
+ data = data << 1;
+ data += 1;
+ data |= index;
+ XGINew_SetReg1(pVBInfo->P3c4, 0x2C, data);
+ }
+ }
+}
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetCRT1FIFO */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
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 &= 0xfe ;
- XGINew_SetReg1( pVBInfo->P3c4 , 0x3D , data ) ; /* diable auto-threshold */
-
- if ( ModeNo > 0x13 )
- {
- XGINew_SetReg1( pVBInfo->P3c4 , 0x08 , 0x34 ) ;
- data = XGINew_GetReg1( pVBInfo->P3c4 , 0x09 ) ;
- data &= 0xC0 ;
- XGINew_SetReg1( pVBInfo->P3c4 , 0x09 , data | 0x30) ;
- data = XGINew_GetReg1( pVBInfo->P3c4 , 0x3D ) ;
- data |= 0x01 ;
- XGINew_SetReg1( pVBInfo->P3c4 , 0x3D , data ) ;
- }
- else
- {
- if (HwDeviceExtension->jChipType == XG27)
- {
- XGINew_SetReg1( pVBInfo->P3c4 , 0x08 , 0x0E ) ;
- data = XGINew_GetReg1( pVBInfo->P3c4 , 0x09 ) ;
- data &= 0xC0 ;
- XGINew_SetReg1( pVBInfo->P3c4 , 0x09 , data | 0x20 ) ;
- }
- else
- {
- XGINew_SetReg1( pVBInfo->P3c4 , 0x08 , 0xAE ) ;
- data = XGINew_GetReg1( pVBInfo->P3c4 , 0x09 ) ;
- data &= 0xF0 ;
- XGINew_SetReg1( pVBInfo->P3c4 , 0x09 , data ) ;
- }
- }
-
- if (HwDeviceExtension->jChipType == XG21)
- {
- XGI_SetXG21FPBits(pVBInfo); /* Fix SR9[7:6] can't read back */
- }
-}
+ struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short data;
+
+ data = XGINew_GetReg1(pVBInfo->P3c4, 0x3D);
+ data &= 0xfe;
+ XGINew_SetReg1(pVBInfo->P3c4, 0x3D, data); /* diable auto-threshold */
+
+ if (ModeNo > 0x13) {
+ XGINew_SetReg1(pVBInfo->P3c4, 0x08, 0x34);
+ data = XGINew_GetReg1(pVBInfo->P3c4, 0x09);
+ data &= 0xC0;
+ XGINew_SetReg1(pVBInfo->P3c4, 0x09, data | 0x30);
+ data = XGINew_GetReg1(pVBInfo->P3c4, 0x3D);
+ data |= 0x01;
+ XGINew_SetReg1(pVBInfo->P3c4, 0x3D, data);
+ } else {
+ if (HwDeviceExtension->jChipType == XG27) {
+ XGINew_SetReg1(pVBInfo->P3c4, 0x08, 0x0E);
+ data = XGINew_GetReg1(pVBInfo->P3c4, 0x09);
+ data &= 0xC0;
+ XGINew_SetReg1(pVBInfo->P3c4, 0x09, data | 0x20);
+ } else {
+ XGINew_SetReg1(pVBInfo->P3c4, 0x08, 0xAE);
+ data = XGINew_GetReg1(pVBInfo->P3c4, 0x09);
+ data &= 0xF0;
+ XGINew_SetReg1(pVBInfo->P3c4, 0x09, data);
+ }
+ }
+ if (HwDeviceExtension->jChipType == XG21)
+ XGI_SetXG21FPBits(pVBInfo); /* Fix SR9[7:6] can't read back */
+}
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetCRT1ModeRegs */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension,
- unsigned short ModeNo, unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
- struct vb_device_info *pVBInfo)
-{
- unsigned short data ,
- data2 ,
- data3 ,
- infoflag = 0 ,
- modeflag ,
- resindex ,
- xres ;
-
- if ( ModeNo > 0x13 )
- {
- modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ;
- infoflag = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ;
- }
- 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 ( ModeNo > 0x13 )
- data = infoflag ;
- else
- data = 0 ;
-
- data2 = 0 ;
-
- if ( ModeNo > 0x13 )
- {
- if ( pVBInfo->ModeType > 0x02 )
- {
- data2 |= 0x02 ;
- data3 = pVBInfo->ModeType - ModeVGA ;
- data3 = data3 << 2 ;
- data2 |= data3 ;
- }
- }
-
- data &= InterlaceMode ;
-
- if ( data )
- data2 |= 0x20 ;
-
- XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x06 , ~0x3F , data2 ) ;
- /* XGINew_SetReg1(pVBInfo->P3c4,0x06,data2); */
- resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ;
- if ( ModeNo <= 0x13 )
- xres = pVBInfo->StResInfo[ resindex ].HTotal ;
- else
- xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; /* xres->ax */
-
- data = 0x0000 ;
- if ( infoflag & InterlaceMode )
- {
- if ( xres == 1024 )
- data = 0x0035 ;
- else if ( xres == 1280 )
- data = 0x0048 ;
- }
-
- data2 = data & 0x00FF ;
- XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x19 , 0xFF , data2 ) ;
- data2 = ( data & 0xFF00 ) >> 8 ;
- XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x19 , 0xFC , data2 ) ;
-
- if( modeflag & HalfDCLK )
- XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x01 , 0xF7 , 0x08 ) ;
-
- data2 = 0 ;
-
- if ( modeflag & LineCompareOff )
- data2 |= 0x08 ;
-
- if ( ModeNo > 0x13 )
- {
- if ( pVBInfo->ModeType == ModeEGA )
- data2 |= 0x40 ;
- }
-
- XGINew_SetRegANDOR( 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 ) ;
-
- XGI_SetVCLKState( HwDeviceExtension , ModeNo , RefreshRateTableIndex, pVBInfo) ;
-
- /* if(modeflag&HalfDCLK)//030305 fix lowresolution bug */
- /* if(XGINew_IF_DEF_NEW_LOWRES) */
- /* XGI_VesaLowResolution(ModeNo,ModeIdIndex);//030305 fix lowresolution bug */
-
- data=XGINew_GetReg1( 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 ) ;
- }
- 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 ) ;
- }
- else
- {
- if ( data & 0x40 )
- data = 0x2c ;
- else
- data = 0x6c ;
- XGINew_SetReg1( pVBInfo->P3d4 , 0x52 , data ) ;
- }
+ unsigned short ModeNo, unsigned short ModeIdIndex,
+ unsigned short RefreshRateTableIndex,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short data, data2, data3, infoflag = 0, modeflag, resindex,
+ xres;
-}
+ if (ModeNo > 0x13) {
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ infoflag
+ = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
+ } 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 (ModeNo > 0x13)
+ data = infoflag;
+ else
+ data = 0;
+
+ data2 = 0;
+
+ if (ModeNo > 0x13) {
+ if (pVBInfo->ModeType > 0x02) {
+ data2 |= 0x02;
+ data3 = pVBInfo->ModeType - ModeVGA;
+ data3 = data3 << 2;
+ data2 |= data3;
+ }
+ }
+
+ data &= InterlaceMode;
+
+ if (data)
+ data2 |= 0x20;
+
+ XGINew_SetRegANDOR(pVBInfo->P3c4, 0x06, ~0x3F, data2);
+ /* XGINew_SetReg1(pVBInfo->P3c4,0x06,data2); */
+ resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo);
+ if (ModeNo <= 0x13)
+ xres = pVBInfo->StResInfo[resindex].HTotal;
+ else
+ xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */
+
+ data = 0x0000;
+ if (infoflag & InterlaceMode) {
+ if (xres == 1024)
+ data = 0x0035;
+ else if (xres == 1280)
+ data = 0x0048;
+ }
+
+ data2 = data & 0x00FF;
+ XGINew_SetRegANDOR(pVBInfo->P3d4, 0x19, 0xFF, data2);
+ data2 = (data & 0xFF00) >> 8;
+ XGINew_SetRegANDOR(pVBInfo->P3d4, 0x19, 0xFC, data2);
+
+ if (modeflag & HalfDCLK)
+ XGINew_SetRegANDOR(pVBInfo->P3c4, 0x01, 0xF7, 0x08);
+
+ data2 = 0;
+
+ if (modeflag & LineCompareOff)
+ data2 |= 0x08;
+
+ if (ModeNo > 0x13) {
+ if (pVBInfo->ModeType == ModeEGA)
+ data2 |= 0x40;
+ }
+
+ XGINew_SetRegANDOR(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);
+
+ XGI_SetVCLKState(HwDeviceExtension, ModeNo, RefreshRateTableIndex,
+ pVBInfo);
+
+ /* if (modeflag&HalfDCLK) //030305 fix lowresolution bug */
+ /* if (XGINew_IF_DEF_NEW_LOWRES) */
+ /* XGI_VesaLowResolution(ModeNo, ModeIdIndex); //030305 fix lowresolution bug */
+
+ data = XGINew_GetReg1(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);
+ } 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);
+ } else {
+ if (data & 0x40)
+ data = 0x2c;
+ else
+ data = 0x6c;
+ XGINew_SetReg1(pVBInfo->P3d4, 0x52, data);
+ }
+
+}
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetVCLKState */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
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 = 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 ;
+ unsigned short ModeNo, unsigned short RefreshRateTableIndex,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short data, data2 = 0;
+ short VCLK;
- XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x07 , 0xFC , data2 ) ;
- if (HwDeviceExtension->jChipType >= XG27 )
- {
- XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x40 , 0xFC , data2&0x03 ) ;
- }
+ unsigned char index;
+ if (ModeNo <= 0x13)
+ VCLK = 0;
+ else {
+ index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
+ index &= IndexMask;
+ VCLK = pVBInfo->VCLKData[index].CLOCK;
+ }
+
+ 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);
}
-/* --------------------------------------------------------------------- */
-/* Function : XGI_VesaLowResolution */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-/*void XGI_VesaLowResolution(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo)
-{
- unsigned short modeflag;
-
- if ( ModeNo > 0x13 )
- modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ;
- else
- modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ;
-
- if ( ModeNo > 0x13 )
- {
- if ( modeflag & DoubleScanMode )
- {
- if ( modeflag & HalfDCLK )
- {
- 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 ) ;
- return ;
- }
- }
- }
- XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0f , 0xff , 0x80 ) ;
- XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x01 , 0xf7 , 0x00 ) ;
- return ;
- }
- }
- }
- XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0f , 0x7f , 0x00 ) ;
+/*
+void XGI_VesaLowResolution(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo)
+{
+ unsigned short modeflag;
+
+ if (ModeNo > 0x13)
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ else
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
+
+ if (ModeNo > 0x13) {
+ if (modeflag & DoubleScanMode) {
+ if (modeflag & HalfDCLK) {
+ 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);
+ return;
+ }
+ }
+ }
+ XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0f, 0xff, 0x80);
+ XGINew_SetRegANDOR(pVBInfo->P3c4, 0x01, 0xf7, 0x00);
+ return;
+ }
+ }
+ }
+ XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0f, 0x7f, 0x00);
}
*/
-/* --------------------------------------------------------------------- */
-/* Function : XGI_LoadDAC */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-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 , ah , dh ,
- *table = NULL ;
-
- if ( ModeNo <= 0x13 )
- data = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ;
- else
- data = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ;
-
- data &= DACInfoFlag ;
- time = 64 ;
-
- if ( data == 0x00 )
- table = XGINew_MDA_DAC ;
- else if ( data == 0x08 )
- table = XGINew_CGA_DAC ;
- else if ( data == 0x10 )
- table = XGINew_EGA_DAC ;
- else if ( data == 0x18 )
- {
- time = 256 ;
- table = XGINew_VGA_DAC ;
- }
-
- if ( time == 256 )
- j = 16 ;
- else
- j = time ;
-
- XGINew_SetReg3( pVBInfo->P3c6 , 0xFF ) ;
- XGINew_SetReg3( pVBInfo->P3c8 , 0x00 ) ;
-
- for( i = 0 ; i < j ; i++ )
- {
- data = table[ i ] ;
-
- for( k = 0 ; k < 3 ; k++ )
- {
- data2 = 0 ;
-
- if ( data & 0x01 )
- data2 = 0x2A ;
-
- if ( data & 0x02 )
- data2 += 0x15 ;
-
- XGINew_SetReg3( pVBInfo->P3c9 , data2 ) ;
- data = data >> 2 ;
- }
- }
-
- if ( time == 256 )
- {
- for( i = 16 ; i < 32 ; i++ )
- {
- data = table[ i ] ;
-
- for( k = 0 ; k < 3 ; k++ )
- XGINew_SetReg3( pVBInfo->P3c9 , data ) ;
- }
-
- si = 32 ;
-
- for( m = 0 ; m < 9 ; m++ )
- {
- di = si ;
- bx = si + 0x04 ;
- dl = 0 ;
-
- for( n = 0 ; n < 3 ; n++ )
- {
- for( o = 0 ; o < 5 ; o++ )
- {
- dh = table[ si ] ;
- ah = table[ di ] ;
- al = table[ bx ] ;
- si++ ;
- XGI_WriteDAC( dl , ah , al , dh, pVBInfo ) ;
- }
-
- si -= 2 ;
-
- for( o = 0 ; o < 3 ; o++ )
- {
- dh = table[ bx ] ;
- ah = table[ di ] ;
- al = table[ si ] ;
- si-- ;
- XGI_WriteDAC( dl , ah , al , dh, pVBInfo ) ;
- }
-
- dl++ ;
- }
-
- si += 5 ;
- }
- }
-}
+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,
+ ah, dh, *table = NULL;
+ if (ModeNo <= 0x13)
+ data = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
+ else
+ data = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+
+ data &= DACInfoFlag;
+ time = 64;
+
+ if (data == 0x00)
+ table = XGINew_MDA_DAC;
+ else if (data == 0x08)
+ table = XGINew_CGA_DAC;
+ else if (data == 0x10)
+ table = XGINew_EGA_DAC;
+ else if (data == 0x18) {
+ time = 256;
+ table = XGINew_VGA_DAC;
+ }
-/* --------------------------------------------------------------------- */
-/* Function : XGI_WriteDAC */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-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);
+ if (time == 256)
+ j = 16;
+ else
+ j = time;
+
+ XGINew_SetReg3(pVBInfo->P3c6, 0xFF);
+ XGINew_SetReg3(pVBInfo->P3c8, 0x00);
+
+ for (i = 0; i < j; i++) {
+ data = table[i];
+
+ for (k = 0; k < 3; k++) {
+ data2 = 0;
+
+ if (data & 0x01)
+ data2 = 0x2A;
+
+ if (data & 0x02)
+ data2 += 0x15;
+
+ XGINew_SetReg3(pVBInfo->P3c9, data2);
+ data = data >> 2;
+ }
+ }
+
+ if (time == 256) {
+ for (i = 16; i < 32; i++) {
+ data = table[i];
+
+ for (k = 0; k < 3; k++)
+ XGINew_SetReg3(pVBInfo->P3c9, data);
+ }
+
+ si = 32;
+
+ for (m = 0; m < 9; m++) {
+ di = si;
+ bx = si + 0x04;
+ dl = 0;
+
+ for (n = 0; n < 3; n++) {
+ for (o = 0; o < 5; o++) {
+ dh = table[si];
+ ah = table[di];
+ al = table[bx];
+ si++;
+ XGI_WriteDAC(dl, ah, al, dh, pVBInfo);
+ }
+
+ si -= 2;
+
+ for (o = 0; o < 3; o++) {
+ dh = table[bx];
+ ah = table[di];
+ al = table[si];
+ si--;
+ XGI_WriteDAC(dl, ah, al, dh, pVBInfo);
+ }
+
+ dl++;
+ }
+
+ si += 5;
+ }
+ }
}
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetLCDAGroup */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_SetLCDAGroup(unsigned short ModeNo,
- unsigned short ModeIdIndex,
- struct xgi_hw_device_info *HwDeviceExtension,
- 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)
{
- unsigned short RefreshRateTableIndex ;
- /* unsigned short temp ; */
+ unsigned short temp, bh, bl;
- /* pVBInfo->SelectCRT2Rate = 0 ; */
+ bh = ah;
+ bl = al;
- 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 (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 ; */
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GetLVDSResInfo */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_GetLVDSResInfo(unsigned short ModeNo,
- unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo)
-{
- unsigned short resindex , xres , yres , modeflag ;
-
- if ( ModeNo <= 0x13 )
- {
- modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; /* si+St_ResInfo */
- }
- else
- {
- modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; /* si+Ext_ResInfo */
- }
-
-
- /* if ( ModeNo > 0x13 ) */
- /* modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; */
- /* else */
- /* modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; */
-
- if ( ModeNo <= 0x13 )
- {
- resindex = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; /* si+St_ResInfo */
- }
- else
- {
- resindex = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; /* si+Ext_ResInfo */
- }
-
- /* resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; */
-
- if ( ModeNo <= 0x13 )
- {
- xres = pVBInfo->StResInfo[ resindex ].HTotal ;
- yres = pVBInfo->StResInfo[ resindex ].VTotal ;
- }
- else
- {
- xres = pVBInfo->ModeResInfo[ resindex ].HTotal ;
- yres = pVBInfo->ModeResInfo[ resindex ].VTotal ;
- }
- if ( ModeNo > 0x13 )
- {
- if ( modeflag & HalfDCLK )
- xres = xres << 1 ;
-
- if ( modeflag & DoubleScanMode )
- yres = yres << 1 ;
- }
- /* if ( modeflag & Charx8Dot ) */
- /* { */
-
- if ( xres == 720 )
- xres = 640 ;
-
- /* } */
- pVBInfo->VGAHDE = xres ;
- pVBInfo->HDE = xres ;
- pVBInfo->VGAVDE = yres ;
- pVBInfo->VDE = yres ;
+ /* 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,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short resindex, xres, yres, modeflag;
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GetLVDSData */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_GetLVDSData(unsigned short ModeNo,
- unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
- struct vb_device_info *pVBInfo)
-{
- unsigned short tempbx ;
- struct XGI330_LVDSDataStruct *LCDPtr = NULL ;
- struct XGI330_CHTVDataStruct *TVPtr = NULL ;
-
- tempbx = 2 ;
-
- if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) )
- {
- LCDPtr = (struct XGI330_LVDSDataStruct *)XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
- pVBInfo->VGAHT = LCDPtr->VGAHT ;
- pVBInfo->VGAVT = LCDPtr->VGAVT ;
- pVBInfo->HT = LCDPtr->LCDHT ;
- pVBInfo->VT = LCDPtr->LCDVT ;
- }
- if ( pVBInfo->IF_DEF_CH7017 == 1 )
- {
- if ( pVBInfo->VBInfo & SetCRT2ToTV )
- {
- TVPtr = (struct XGI330_CHTVDataStruct *)XGI_GetTVPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
- pVBInfo->VGAHT = TVPtr->VGAHT ;
- pVBInfo->VGAVT = TVPtr->VGAVT ;
- pVBInfo->HT = TVPtr->LCDHT ;
- pVBInfo->VT = TVPtr->LCDVT ;
- }
- }
-
- if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) )
- {
- if ( !( pVBInfo->LCDInfo & ( SetLCDtoNonExpanding | EnableScalingLCD ) ) )
- {
- if ( ( pVBInfo->LCDResInfo == Panel1024x768 ) || ( pVBInfo->LCDResInfo == Panel1024x768x75 ) )
- {
- pVBInfo->HDE = 1024 ;
- pVBInfo->VDE = 768 ;
- }
- else if ( ( pVBInfo->LCDResInfo == Panel1280x1024 ) || ( pVBInfo->LCDResInfo == Panel1280x1024x75 ) )
- {
- pVBInfo->HDE = 1280 ;
- pVBInfo->VDE = 1024 ;
- }
- else if ( pVBInfo->LCDResInfo == Panel1400x1050 )
- {
- pVBInfo->HDE = 1400 ;
- pVBInfo->VDE = 1050 ;
- }
- else
- {
- pVBInfo->HDE = 1600 ;
- pVBInfo->VDE = 1200 ;
- }
- }
- }
-}
+ if (ModeNo <= 0x13)
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo; /* si+St_ResInfo */
+ else
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; /* si+Ext_ResInfo */
+ /* if (ModeNo > 0x13) */
+ /* modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; */
+ /* else */
+ /* modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; */
-/* --------------------------------------------------------------------- */
-/* Function : XGI_ModCRT1Regs */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_ModCRT1Regs(unsigned short ModeNo, unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
- struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo)
-{
- unsigned char index;
- unsigned short tempbx , i ;
- struct XGI_LVDSCRT1HDataStruct *LCDPtr = NULL;
- struct XGI_LVDSCRT1VDataStruct *LCDPtr1 = NULL;
- /* struct XGI330_CHTVDataStruct *TVPtr = NULL ; */
- struct XGI_CH7007TV_TimingHStruct *CH7007TV_TimingHPtr = NULL;
- struct XGI_CH7007TV_TimingVStruct *CH7007TV_TimingVPtr = NULL;
-
- if( ModeNo <= 0x13 )
- index = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ;
- else
- index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
-
- index= index & IndexMask ;
-
- if ( ( pVBInfo->IF_DEF_ScaleLCD == 0 ) || ( ( pVBInfo->IF_DEF_ScaleLCD == 1 ) && ( !( pVBInfo->LCDInfo & EnableScalingLCD ) ) ) )
- {
- tempbx = 0 ;
-
- if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) )
- {
- LCDPtr = (struct XGI_LVDSCRT1HDataStruct *)XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
-
- for( i = 0 ; i < 8 ; i++ )
- pVBInfo->TimingH[ 0 ].data[ i ] = LCDPtr[ 0 ].Reg[ i ] ;
- }
-
- if ( pVBInfo->IF_DEF_CH7007 == 1 )
- {
- if ( pVBInfo->VBInfo & SetCRT2ToTV )
- {
- CH7007TV_TimingHPtr = (struct XGI_CH7007TV_TimingHStruct *)XGI_GetTVPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
-
- for( i = 0 ; i < 8 ; i++ )
- pVBInfo->TimingH[ 0 ].data[ i ] = CH7007TV_TimingHPtr[ 0 ].data[ i ] ;
- }
- }
-
- /* if ( pVBInfo->IF_DEF_CH7017 == 1 )
- {
- if ( pVBInfo->VBInfo & SetCRT2ToTV )
- TVPtr = ( struct XGI330_CHTVDataStruct *)XGI_GetTVPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ;
- } */
-
- XGI_SetCRT1Timing_H(pVBInfo,HwDeviceExtension) ;
-
- if ( pVBInfo->IF_DEF_CH7007 == 1 )
- {
- XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , CH7007TV_TimingHPtr[ 0 ].data[ 8 ] ) ;
- XGINew_SetReg1( pVBInfo->P3c4 , 0x2F , CH7007TV_TimingHPtr[ 0 ].data[ 9 ] ) ;
- }
-
- tempbx = 1 ;
-
- if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) )
- {
- LCDPtr1 = (struct XGI_LVDSCRT1VDataStruct *)XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
- for( i = 0 ; i < 7 ; i++ )
- pVBInfo->TimingV[ 0 ].data[ i ] = LCDPtr1[ 0 ].Reg[ i ] ;
- }
-
- if ( pVBInfo->IF_DEF_CH7007 == 1 )
- {
- if ( pVBInfo->VBInfo & SetCRT2ToTV )
- {
- CH7007TV_TimingVPtr = (struct XGI_CH7007TV_TimingVStruct *)XGI_GetTVPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
-
- for( i = 0 ; i < 7 ; i++ )
- pVBInfo->TimingV[ 0 ].data[ i ] = CH7007TV_TimingVPtr[ 0 ].data[ i ] ;
- }
- }
- /* if ( pVBInfo->IF_DEF_CH7017 == 1 )
- {
- if ( pVBInfo->VBInfo & SetCRT2ToTV )
- TVPtr = ( struct XGI330_CHTVDataStruct *)XGI_GetTVPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ;
- } */
-
- XGI_SetCRT1Timing_V( ModeIdIndex , ModeNo , pVBInfo) ;
-
- if ( pVBInfo->IF_DEF_CH7007 == 1 )
- {
- XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x33 , ~0x01 , CH7007TV_TimingVPtr[ 0 ].data[ 7 ]&0x01 ) ;
- XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , CH7007TV_TimingVPtr[ 0 ].data[8 ] ) ;
- XGINew_SetReg1( pVBInfo->P3c4 , 0x3F , CH7007TV_TimingVPtr[ 0 ].data[9 ] ) ;
-
- }
- }
-}
+ if (ModeNo <= 0x13)
+ resindex = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo; /* si+St_ResInfo */
+ else
+ resindex = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; /* si+Ext_ResInfo */
+ /* resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo); */
+ if (ModeNo <= 0x13) {
+ xres = pVBInfo->StResInfo[resindex].HTotal;
+ yres = pVBInfo->StResInfo[resindex].VTotal;
+ } else {
+ xres = pVBInfo->ModeResInfo[resindex].HTotal;
+ yres = pVBInfo->ModeResInfo[resindex].VTotal;
+ }
+ if (ModeNo > 0x13) {
+ if (modeflag & HalfDCLK)
+ xres = xres << 1;
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetLVDSRegs */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
- struct vb_device_info *pVBInfo)
-{
- unsigned short tempbx , tempax , tempcx , tempdx , push1 , push2 , modeflag ;
- unsigned long temp , temp1 , temp2 , temp3 , push3 ;
- struct XGI330_LCDDataDesStruct *LCDPtr = NULL ;
- struct XGI330_LCDDataDesStruct2 *LCDPtr1 = NULL ;
-
- if ( ModeNo > 0x13 )
- modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ;
- else
- modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ;
-
- if ( !( pVBInfo->SetFlag & Win9xDOSMode ) )
- {
- if ( ( pVBInfo->IF_DEF_CH7017 == 0 ) || ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) )
- {
- if ( pVBInfo->IF_DEF_OEMUtil == 1 )
- {
- tempbx = 8 ;
- LCDPtr = (struct XGI330_LCDDataDesStruct *)XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
- }
-
- if ( ( pVBInfo->IF_DEF_OEMUtil == 0 ) || ( LCDPtr == 0 ) )
- {
- tempbx = 3 ;
- if ( pVBInfo->LCDInfo & EnableScalingLCD )
- LCDPtr1 = (struct XGI330_LCDDataDesStruct2 *)XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
- else
- LCDPtr = (struct XGI330_LCDDataDesStruct *)XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
- }
-
- XGI_GetLCDSync( &tempax , &tempbx ,pVBInfo) ;
- push1 = tempbx ;
- push2 = tempax ;
-
- /* GetLCDResInfo */
- if ( ( pVBInfo->LCDResInfo == Panel1024x768 ) || ( pVBInfo->LCDResInfo == Panel1024x768x75 ) )
- {
- tempax = 1024 ;
- tempbx = 768 ;
- }
- else if ( ( pVBInfo->LCDResInfo == Panel1280x1024 ) || ( pVBInfo->LCDResInfo == Panel1280x1024x75 ) )
- {
- tempax = 1280 ;
- tempbx = 1024 ;
- }
- else if ( pVBInfo->LCDResInfo == Panel1400x1050 )
- {
- tempax = 1400 ;
- tempbx = 1050 ;
- }
- else
- {
- tempax = 1600 ;
- tempbx = 1200 ;
- }
-
- if ( pVBInfo->LCDInfo & SetLCDtoNonExpanding )
- {
- pVBInfo->HDE=tempax;
- pVBInfo->VDE=tempbx;
- pVBInfo->VGAHDE=tempax;
- pVBInfo->VGAVDE=tempbx;
- }
-
- if ( ( pVBInfo->IF_DEF_ScaleLCD == 1 ) && ( pVBInfo->LCDInfo & EnableScalingLCD ) )
- {
- tempax=pVBInfo->HDE;
- tempbx=pVBInfo->VDE;
- }
-
- tempax = pVBInfo->HT ;
-
- if ( pVBInfo->LCDInfo & EnableScalingLCD )
- tempbx = LCDPtr1->LCDHDES ;
- else
- tempbx = LCDPtr->LCDHDES ;
-
- tempcx = pVBInfo->HDE ;
- tempbx = tempbx & 0x0fff ;
- tempcx += tempbx ;
-
- if ( tempcx >= tempax )
- tempcx -= tempax ;
-
- XGINew_SetReg1( pVBInfo->Part1Port , 0x1A , tempbx & 0x07 ) ;
-
- tempcx = tempcx >> 3 ;
- tempbx = tempbx >> 3 ;
-
- XGINew_SetReg1(pVBInfo->Part1Port, 0x16, (unsigned short)(tempbx & 0xff));
- XGINew_SetReg1(pVBInfo->Part1Port, 0x17, (unsigned short)(tempcx & 0xff));
-
- tempax = pVBInfo->HT ;
-
- if ( pVBInfo->LCDInfo & EnableScalingLCD )
- tempbx = LCDPtr1->LCDHRS ;
- else
- tempbx = LCDPtr->LCDHRS ;
-
- tempcx = push2 ;
-
- if ( pVBInfo->LCDInfo & EnableScalingLCD )
- tempcx = LCDPtr1->LCDHSync ;
-
- tempcx += tempbx ;
-
- if ( tempcx >= tempax )
- tempcx -= tempax ;
-
- tempax = tempbx & 0x07 ;
- tempax = tempax >> 5 ;
- tempcx = tempcx >> 3 ;
- tempbx = tempbx >> 3 ;
-
- tempcx &= 0x1f ;
- tempax |= tempcx ;
-
- XGINew_SetReg1( pVBInfo->Part1Port , 0x15 , tempax ) ;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x14, (unsigned short)(tempbx & 0xff));
+ if (modeflag & DoubleScanMode)
+ yres = yres << 1;
+ }
+ /* if (modeflag & Charx8Dot) */
+ /* { */
- tempax = pVBInfo->VT ;
- if ( pVBInfo->LCDInfo & EnableScalingLCD )
- tempbx = LCDPtr1->LCDVDES ;
- else
- tempbx = LCDPtr->LCDVDES ;
- tempcx = pVBInfo->VDE ;
+ if (xres == 720)
+ xres = 640;
- tempbx = tempbx & 0x0fff ;
- tempcx += tempbx ;
- if ( tempcx >= tempax )
- tempcx -= tempax ;
+ /* } */
+ pVBInfo->VGAHDE = xres;
+ pVBInfo->HDE = xres;
+ pVBInfo->VGAVDE = yres;
+ pVBInfo->VDE = yres;
+}
- XGINew_SetReg1(pVBInfo->Part1Port, 0x1b, (unsigned short)(tempbx & 0xff));
- XGINew_SetReg1(pVBInfo->Part1Port, 0x1c, (unsigned short)(tempcx & 0xff));
+void XGI_GetLVDSData(unsigned short ModeNo, unsigned short ModeIdIndex,
+ unsigned short RefreshRateTableIndex,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short tempbx;
+ struct XGI330_LVDSDataStruct *LCDPtr = NULL;
+ struct XGI330_CHTVDataStruct *TVPtr = NULL;
- tempbx = ( tempbx >> 8 ) & 0x07 ;
- tempcx = ( tempcx >> 8 ) & 0x07 ;
+ tempbx = 2;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x1d, (unsigned short)((tempcx << 3) | tempbx));
+ if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
+ LCDPtr = (struct XGI330_LVDSDataStruct *) XGI_GetLcdPtr(tempbx,
+ ModeNo, ModeIdIndex, RefreshRateTableIndex,
+ pVBInfo);
+ pVBInfo->VGAHT = LCDPtr->VGAHT;
+ pVBInfo->VGAVT = LCDPtr->VGAVT;
+ pVBInfo->HT = LCDPtr->LCDHT;
+ pVBInfo->VT = LCDPtr->LCDVT;
+ }
+ if (pVBInfo->IF_DEF_CH7017 == 1) {
+ if (pVBInfo->VBInfo & SetCRT2ToTV) {
+ TVPtr = (struct XGI330_CHTVDataStruct *) XGI_GetTVPtr(
+ tempbx, ModeNo, ModeIdIndex,
+ RefreshRateTableIndex, pVBInfo);
+ pVBInfo->VGAHT = TVPtr->VGAHT;
+ pVBInfo->VGAVT = TVPtr->VGAVT;
+ pVBInfo->HT = TVPtr->LCDHT;
+ pVBInfo->VT = TVPtr->LCDVT;
+ }
+ }
- tempax = pVBInfo->VT ;
- if ( pVBInfo->LCDInfo & EnableScalingLCD )
- tempbx = LCDPtr1->LCDVRS ;
- else
- tempbx = LCDPtr->LCDVRS ;
+ if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
+ if (!(pVBInfo->LCDInfo & (SetLCDtoNonExpanding
+ | EnableScalingLCD))) {
+ if ((pVBInfo->LCDResInfo == Panel1024x768)
+ || (pVBInfo->LCDResInfo
+ == Panel1024x768x75)) {
+ pVBInfo->HDE = 1024;
+ pVBInfo->VDE = 768;
+ } else if ((pVBInfo->LCDResInfo == Panel1280x1024)
+ || (pVBInfo->LCDResInfo
+ == Panel1280x1024x75)) {
+ pVBInfo->HDE = 1280;
+ pVBInfo->VDE = 1024;
+ } else if (pVBInfo->LCDResInfo == Panel1400x1050) {
+ pVBInfo->HDE = 1400;
+ pVBInfo->VDE = 1050;
+ } else {
+ pVBInfo->HDE = 1600;
+ pVBInfo->VDE = 1200;
+ }
+ }
+ }
+}
- /* tempbx = tempbx >> 4 ; */
- tempcx = push1 ;
+void XGI_ModCRT1Regs(unsigned short ModeNo, unsigned short ModeIdIndex,
+ unsigned short RefreshRateTableIndex,
+ struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned char index;
+ unsigned short tempbx, i;
+ struct XGI_LVDSCRT1HDataStruct *LCDPtr = NULL;
+ struct XGI_LVDSCRT1VDataStruct *LCDPtr1 = NULL;
+ /* struct XGI330_CHTVDataStruct *TVPtr = NULL; */
+ struct XGI_CH7007TV_TimingHStruct *CH7007TV_TimingHPtr = NULL;
+ struct XGI_CH7007TV_TimingVStruct *CH7007TV_TimingVPtr = NULL;
+
+ if (ModeNo <= 0x13)
+ index = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ else
+ index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+
+ index = index & IndexMask;
+
+ if ((pVBInfo->IF_DEF_ScaleLCD == 0) || ((pVBInfo->IF_DEF_ScaleLCD == 1)
+ && (!(pVBInfo->LCDInfo & EnableScalingLCD)))) {
+ tempbx = 0;
+
+ if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
+ LCDPtr
+ = (struct XGI_LVDSCRT1HDataStruct *) XGI_GetLcdPtr(
+ tempbx, ModeNo,
+ ModeIdIndex,
+ RefreshRateTableIndex,
+ pVBInfo);
+
+ for (i = 0; i < 8; i++)
+ pVBInfo->TimingH[0].data[i] = LCDPtr[0].Reg[i];
+ }
+
+ if (pVBInfo->IF_DEF_CH7007 == 1) {
+ if (pVBInfo->VBInfo & SetCRT2ToTV) {
+ CH7007TV_TimingHPtr
+ = (struct XGI_CH7007TV_TimingHStruct *) XGI_GetTVPtr(
+ tempbx,
+ ModeNo,
+ ModeIdIndex,
+ RefreshRateTableIndex,
+ pVBInfo);
+
+ for (i = 0; i < 8; i++)
+ pVBInfo->TimingH[0].data[i]
+ = CH7007TV_TimingHPtr[0].data[i];
+ }
+ }
+
+ /* if (pVBInfo->IF_DEF_CH7017 == 1) {
+ if (pVBInfo->VBInfo & SetCRT2ToTV)
+ TVPtr = (struct XGI330_CHTVDataStruct *)XGI_GetTVPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
+ }
+ */
+
+ XGI_SetCRT1Timing_H(pVBInfo, HwDeviceExtension);
+
+ if (pVBInfo->IF_DEF_CH7007 == 1) {
+ XGINew_SetReg1(pVBInfo->P3c4, 0x2E,
+ CH7007TV_TimingHPtr[0].data[8]);
+ XGINew_SetReg1(pVBInfo->P3c4, 0x2F,
+ CH7007TV_TimingHPtr[0].data[9]);
+ }
+
+ tempbx = 1;
+
+ if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
+ LCDPtr1
+ = (struct XGI_LVDSCRT1VDataStruct *) XGI_GetLcdPtr(
+ tempbx, ModeNo,
+ ModeIdIndex,
+ RefreshRateTableIndex,
+ pVBInfo);
+ for (i = 0; i < 7; i++)
+ pVBInfo->TimingV[0].data[i] = LCDPtr1[0].Reg[i];
+ }
+
+ if (pVBInfo->IF_DEF_CH7007 == 1) {
+ if (pVBInfo->VBInfo & SetCRT2ToTV) {
+ CH7007TV_TimingVPtr
+ = (struct XGI_CH7007TV_TimingVStruct *) XGI_GetTVPtr(
+ tempbx,
+ ModeNo,
+ ModeIdIndex,
+ RefreshRateTableIndex,
+ pVBInfo);
+
+ for (i = 0; i < 7; i++)
+ pVBInfo->TimingV[0].data[i]
+ = CH7007TV_TimingVPtr[0].data[i];
+ }
+ }
+ /* if (pVBInfo->IF_DEF_CH7017 == 1) {
+ if (pVBInfo->VBInfo & SetCRT2ToTV)
+ TVPtr = (struct XGI330_CHTVDataStruct *)XGI_GetTVPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
+ }
+ */
+
+ XGI_SetCRT1Timing_V(ModeIdIndex, ModeNo, pVBInfo);
+
+ if (pVBInfo->IF_DEF_CH7007 == 1) {
+ XGINew_SetRegANDOR(pVBInfo->P3c4, 0x33, ~0x01,
+ CH7007TV_TimingVPtr[0].data[7] & 0x01);
+ XGINew_SetReg1(pVBInfo->P3c4, 0x34,
+ CH7007TV_TimingVPtr[0].data[8]);
+ XGINew_SetReg1(pVBInfo->P3c4, 0x3F,
+ CH7007TV_TimingVPtr[0].data[9]);
+
+ }
+ }
+}
- if ( pVBInfo->LCDInfo & EnableScalingLCD )
- tempcx = LCDPtr1->LCDVSync ;
+void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
+ unsigned short RefreshRateTableIndex,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short tempbx, tempax, tempcx, tempdx, push1, push2, modeflag;
+ unsigned long temp, temp1, temp2, temp3, push3;
+ struct XGI330_LCDDataDesStruct *LCDPtr = NULL;
+ struct XGI330_LCDDataDesStruct2 *LCDPtr1 = NULL;
- tempcx += tempbx ;
- if ( tempcx >= tempax )
- tempcx -= tempax ;
+ if (ModeNo > 0x13)
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ else
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
+
+ if (!(pVBInfo->SetFlag & Win9xDOSMode)) {
+ if ((pVBInfo->IF_DEF_CH7017 == 0) || (pVBInfo->VBInfo
+ & (SetCRT2ToLCD | SetCRT2ToLCDA))) {
+ if (pVBInfo->IF_DEF_OEMUtil == 1) {
+ tempbx = 8;
+ LCDPtr
+ = (struct XGI330_LCDDataDesStruct *) XGI_GetLcdPtr(
+ tempbx,
+ ModeNo,
+ ModeIdIndex,
+ RefreshRateTableIndex,
+ pVBInfo);
+ }
+
+ if ((pVBInfo->IF_DEF_OEMUtil == 0) || (LCDPtr == NULL)) {
+ tempbx = 3;
+ if (pVBInfo->LCDInfo & EnableScalingLCD)
+ LCDPtr1
+ = (struct XGI330_LCDDataDesStruct2 *) XGI_GetLcdPtr(
+ tempbx,
+ ModeNo,
+ ModeIdIndex,
+ RefreshRateTableIndex,
+ pVBInfo);
+ else
+ LCDPtr
+ = (struct XGI330_LCDDataDesStruct *) XGI_GetLcdPtr(
+ tempbx,
+ ModeNo,
+ ModeIdIndex,
+ RefreshRateTableIndex,
+ pVBInfo);
+ }
+
+ XGI_GetLCDSync(&tempax, &tempbx, pVBInfo);
+ push1 = tempbx;
+ push2 = tempax;
+
+ /* GetLCDResInfo */
+ if ((pVBInfo->LCDResInfo == Panel1024x768)
+ || (pVBInfo->LCDResInfo
+ == Panel1024x768x75)) {
+ tempax = 1024;
+ tempbx = 768;
+ } else if ((pVBInfo->LCDResInfo == Panel1280x1024)
+ || (pVBInfo->LCDResInfo
+ == Panel1280x1024x75)) {
+ tempax = 1280;
+ tempbx = 1024;
+ } else if (pVBInfo->LCDResInfo == Panel1400x1050) {
+ tempax = 1400;
+ tempbx = 1050;
+ } else {
+ tempax = 1600;
+ tempbx = 1200;
+ }
+
+ if (pVBInfo->LCDInfo & SetLCDtoNonExpanding) {
+ pVBInfo->HDE = tempax;
+ pVBInfo->VDE = tempbx;
+ pVBInfo->VGAHDE = tempax;
+ pVBInfo->VGAVDE = tempbx;
+ }
+
+ if ((pVBInfo->IF_DEF_ScaleLCD == 1)
+ && (pVBInfo->LCDInfo & EnableScalingLCD)) {
+ tempax = pVBInfo->HDE;
+ tempbx = pVBInfo->VDE;
+ }
+
+ tempax = pVBInfo->HT;
+
+ if (pVBInfo->LCDInfo & EnableScalingLCD)
+ tempbx = LCDPtr1->LCDHDES;
+ else
+ tempbx = LCDPtr->LCDHDES;
+
+ tempcx = pVBInfo->HDE;
+ tempbx = tempbx & 0x0fff;
+ tempcx += tempbx;
+
+ if (tempcx >= tempax)
+ tempcx -= tempax;
+
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x1A, tempbx & 0x07);
+
+ tempcx = tempcx >> 3;
+ tempbx = tempbx >> 3;
+
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x16,
+ (unsigned short) (tempbx & 0xff));
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x17,
+ (unsigned short) (tempcx & 0xff));
+
+ tempax = pVBInfo->HT;
+
+ if (pVBInfo->LCDInfo & EnableScalingLCD)
+ tempbx = LCDPtr1->LCDHRS;
+ else
+ tempbx = LCDPtr->LCDHRS;
+
+ tempcx = push2;
+
+ if (pVBInfo->LCDInfo & EnableScalingLCD)
+ tempcx = LCDPtr1->LCDHSync;
+
+ tempcx += tempbx;
+
+ if (tempcx >= tempax)
+ tempcx -= tempax;
+
+ tempax = tempbx & 0x07;
+ tempax = tempax >> 5;
+ tempcx = tempcx >> 3;
+ tempbx = tempbx >> 3;
+
+ tempcx &= 0x1f;
+ tempax |= tempcx;
+
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x15, tempax);
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x14,
+ (unsigned short) (tempbx & 0xff));
+
+ tempax = pVBInfo->VT;
+ if (pVBInfo->LCDInfo & EnableScalingLCD)
+ tempbx = LCDPtr1->LCDVDES;
+ else
+ tempbx = LCDPtr->LCDVDES;
+ tempcx = pVBInfo->VDE;
+
+ tempbx = tempbx & 0x0fff;
+ tempcx += tempbx;
+ if (tempcx >= tempax)
+ tempcx -= tempax;
+
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x1b,
+ (unsigned short) (tempbx & 0xff));
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x1c,
+ (unsigned short) (tempcx & 0xff));
+
+ tempbx = (tempbx >> 8) & 0x07;
+ tempcx = (tempcx >> 8) & 0x07;
+
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x1d,
+ (unsigned short) ((tempcx << 3)
+ | tempbx));
+
+ tempax = pVBInfo->VT;
+ if (pVBInfo->LCDInfo & EnableScalingLCD)
+ tempbx = LCDPtr1->LCDVRS;
+ else
+ tempbx = LCDPtr->LCDVRS;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x18, (unsigned short)(tempbx & 0xff));
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, ~0x0f, (unsigned short)(tempcx & 0x0f));
+ /* tempbx = tempbx >> 4; */
+ tempcx = push1;
- tempax = ( ( tempbx >> 8 ) & 0x07 ) << 3 ;
+ if (pVBInfo->LCDInfo & EnableScalingLCD)
+ tempcx = LCDPtr1->LCDVSync;
- tempbx = pVBInfo->VGAVDE ;
- if ( tempbx != pVBInfo->VDE )
- tempax |= 0x40 ;
+ tempcx += tempbx;
+ if (tempcx >= tempax)
+ tempcx -= tempax;
- if ( pVBInfo->LCDInfo & EnableLVDSDDA )
- tempax |= 0x40 ;
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x18,
+ (unsigned short) (tempbx & 0xff));
+ XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, ~0x0f,
+ (unsigned short) (tempcx & 0x0f));
- XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x1a , 0x07 , tempax ) ;
+ tempax = ((tempbx >> 8) & 0x07) << 3;
- tempcx = pVBInfo->VGAVT ;
- tempbx = pVBInfo->VDE ;
- tempax = pVBInfo->VGAVDE ;
- tempcx -= tempax ;
+ tempbx = pVBInfo->VGAVDE;
+ if (tempbx != pVBInfo->VDE)
+ tempax |= 0x40;
- temp = tempax ; /* 0430 ylshieh */
- temp1 = ( temp << 18 ) / tempbx ;
+ if (pVBInfo->LCDInfo & EnableLVDSDDA)
+ tempax |= 0x40;
- tempdx = (unsigned short)((temp << 18) % tempbx);
+ XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x1a, 0x07,
+ tempax);
- if ( tempdx != 0 )
- temp1 += 1 ;
+ tempcx = pVBInfo->VGAVT;
+ tempbx = pVBInfo->VDE;
+ tempax = pVBInfo->VGAVDE;
+ tempcx -= tempax;
- temp2 = temp1 ;
- push3 = temp2 ;
+ temp = tempax; /* 0430 ylshieh */
+ temp1 = (temp << 18) / tempbx;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x37, (unsigned short)(temp2 & 0xff));
- XGINew_SetReg1(pVBInfo->Part1Port, 0x36, (unsigned short)((temp2 >> 8) & 0xff));
+ tempdx = (unsigned short) ((temp << 18) % tempbx);
- tempbx = (unsigned short)(temp2 >> 16);
- tempax = tempbx & 0x03 ;
+ if (tempdx != 0)
+ temp1 += 1;
- tempbx = pVBInfo->VGAVDE ;
- if ( tempbx == pVBInfo->VDE )
- tempax |= 0x04 ;
+ temp2 = temp1;
+ push3 = temp2;
- XGINew_SetReg1( pVBInfo->Part1Port , 0x35 , tempax ) ;
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x37,
+ (unsigned short) (temp2 & 0xff));
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x36,
+ (unsigned short) ((temp2 >> 8) & 0xff));
- if ( pVBInfo->VBType & VB_XGI301C )
- {
- temp2 = push3 ;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x3c, (unsigned short)(temp2 & 0xff));
- XGINew_SetReg1(pVBInfo->Part4Port, 0x3b, (unsigned short)((temp2 >> 8) & 0xff));
- tempbx = (unsigned short)(temp2 >> 16);
- XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x3a, ~0xc0, (unsigned short)((tempbx & 0xff) << 6));
+ tempbx = (unsigned short) (temp2 >> 16);
+ tempax = tempbx & 0x03;
- tempcx = pVBInfo->VGAVDE ;
- if ( tempcx == pVBInfo->VDE )
- XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x30 , ~0x0c , 0x00 ) ;
- else
- XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x30 , ~0x0c , 0x08 ) ;
- }
+ tempbx = pVBInfo->VGAVDE;
+ if (tempbx == pVBInfo->VDE)
+ tempax |= 0x04;
- tempcx = pVBInfo->VGAHDE ;
- tempbx = pVBInfo->HDE ;
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x35, tempax);
- temp1 = tempcx << 16 ;
+ if (pVBInfo->VBType & VB_XGI301C) {
+ temp2 = push3;
+ XGINew_SetReg1(pVBInfo->Part4Port, 0x3c,
+ (unsigned short) (temp2 & 0xff));
+ XGINew_SetReg1(pVBInfo->Part4Port, 0x3b,
+ (unsigned short) ((temp2 >> 8)
+ & 0xff));
+ tempbx = (unsigned short) (temp2 >> 16);
+ XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x3a,
+ ~0xc0,
+ (unsigned short) ((tempbx
+ & 0xff) << 6));
- tempax = (unsigned short)(temp1 / tempbx);
+ tempcx = pVBInfo->VGAVDE;
+ if (tempcx == pVBInfo->VDE)
+ XGINew_SetRegANDOR(pVBInfo->Part4Port,
+ 0x30, ~0x0c, 0x00);
+ else
+ XGINew_SetRegANDOR(pVBInfo->Part4Port,
+ 0x30, ~0x0c, 0x08);
+ }
- if ( ( tempbx & 0xffff ) == ( tempcx & 0xffff ) )
- tempax = 65535 ;
+ tempcx = pVBInfo->VGAHDE;
+ tempbx = pVBInfo->HDE;
- temp3 = tempax ;
- temp1 = pVBInfo->VGAHDE << 16 ;
+ temp1 = tempcx << 16;
- temp1 /= temp3 ;
- temp3 = temp3 << 16 ;
- temp1 -= 1 ;
+ tempax = (unsigned short) (temp1 / tempbx);
- temp3 = ( temp3 & 0xffff0000 ) + ( temp1 & 0xffff ) ;
+ if ((tempbx & 0xffff) == (tempcx & 0xffff))
+ tempax = 65535;
- tempax = (unsigned short)(temp3 & 0xff);
- XGINew_SetReg1( pVBInfo->Part1Port , 0x1f , tempax ) ;
+ temp3 = tempax;
+ temp1 = pVBInfo->VGAHDE << 16;
- temp1 = pVBInfo->VGAVDE << 18 ;
- temp1 = temp1 / push3 ;
- tempbx = (unsigned short)(temp1 & 0xffff);
+ temp1 /= temp3;
+ temp3 = temp3 << 16;
+ temp1 -= 1;
- if ( pVBInfo->LCDResInfo == Panel1024x768 )
- tempbx -= 1 ;
+ temp3 = (temp3 & 0xffff0000) + (temp1 & 0xffff);
- tempax = ( ( tempbx >> 8 ) & 0xff ) << 3 ;
- tempax |= (unsigned short)((temp3 >> 8) & 0x07);
- XGINew_SetReg1(pVBInfo->Part1Port, 0x20, (unsigned short)(tempax & 0xff));
- XGINew_SetReg1(pVBInfo->Part1Port, 0x21, (unsigned short)(tempbx & 0xff));
+ tempax = (unsigned short) (temp3 & 0xff);
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x1f, tempax);
- temp3 = temp3 >> 16 ;
+ temp1 = pVBInfo->VGAVDE << 18;
+ temp1 = temp1 / push3;
+ tempbx = (unsigned short) (temp1 & 0xffff);
- if ( modeflag & HalfDCLK )
- temp3 = temp3 >> 1 ;
+ if (pVBInfo->LCDResInfo == Panel1024x768)
+ tempbx -= 1;
- XGINew_SetReg1(pVBInfo->Part1Port , 0x22, (unsigned short)((temp3 >> 8) & 0xff));
- XGINew_SetReg1(pVBInfo->Part1Port , 0x23, (unsigned short)(temp3 & 0xff));
- }
- }
-}
+ tempax = ((tempbx >> 8) & 0xff) << 3;
+ tempax |= (unsigned short) ((temp3 >> 8) & 0x07);
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x20,
+ (unsigned short) (tempax & 0xff));
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x21,
+ (unsigned short) (tempbx & 0xff));
+ temp3 = temp3 >> 16;
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetCRT2ECLK */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_SetCRT2ECLK(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo)
-{
- unsigned char di_0, di_1, tempal;
- int i ;
-
- tempal = XGI_GetVCLKPtr( RefreshRateTableIndex , ModeNo , ModeIdIndex, pVBInfo ) ;
- XGI_GetVCLKLen( tempal , &di_0 , &di_1, pVBInfo ) ;
- XGI_GetLCDVCLKPtr( &di_0 , &di_1, pVBInfo ) ;
-
- for( i = 0 ; i < 4 ; i++ )
- {
- XGINew_SetRegANDOR(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 ) ;
- }
- else if ( ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) && ( !( pVBInfo->VBInfo & SetInSlaveMode ) ) )
- {
- XGINew_SetReg1( pVBInfo->P3c4 , 0x2e , di_0 ) ;
- XGINew_SetReg1( pVBInfo->P3c4 , 0x2f , di_1 ) ;
- }
- else
- {
- XGINew_SetReg1( pVBInfo->P3c4 , 0x2b , di_0 ) ;
- XGINew_SetReg1( pVBInfo->P3c4 , 0x2c , di_1 ) ;
- }
- }
-}
+ if (modeflag & HalfDCLK)
+ temp3 = temp3 >> 1;
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x22,
+ (unsigned short) ((temp3 >> 8) & 0xff));
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x23,
+ (unsigned short) (temp3 & 0xff));
+ }
+ }
+}
-/* --------------------------------------------------------------------- */
-/* Function : XGI_UpdateModeInfo */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
-{
- unsigned short tempcl ,
- tempch ,
- temp ,
- tempbl ,
- tempax ;
-
- if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) )
- {
- tempcl = 0 ;
- tempch = 0 ;
- temp = XGINew_GetReg1( pVBInfo->P3c4 , 0x01 ) ;
-
- if ( !( temp & 0x20 ) )
- {
- temp = XGINew_GetReg1( 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 ) ;
-
- if ( !( temp & 0x40 ) )
- tempcl |= ActiveCRT1 ;
- }
- }
-
- temp = XGINew_GetReg1( pVBInfo->Part1Port , 0x2e ) ;
- temp &= 0x0f ;
-
- if ( !( temp == 0x08 ) )
- {
- tempax = XGINew_GetReg1( pVBInfo->Part1Port , 0x13 ) ; /* Check ChannelA by Part1_13 [2003/10/03] */
- if ( tempax & 0x04 )
- tempcl = tempcl | ActiveLCD ;
-
- temp &= 0x05 ;
-
- if ( !( tempcl & ActiveLCD ) )
- if ( temp == 0x01 )
- tempcl |= ActiveCRT2 ;
-
- if ( temp == 0x04 )
- tempcl |= ActiveLCD ;
-
- if ( temp == 0x05 )
- {
- temp = XGINew_GetReg1( pVBInfo->Part2Port , 0x00 ) ;
-
- if( !( temp & 0x08 ) )
- tempch |= ActiveAVideo ;
-
- if ( !( temp & 0x04 ) )
- tempch |= ActiveSVideo ;
-
- if ( temp & 0x02 )
- tempch |= ActiveSCART ;
-
- if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV )
- {
- if ( temp & 0x01 )
- tempch |= ActiveHiTV ;
- }
-
- if ( pVBInfo->VBInfo & SetCRT2ToYPbPr )
- {
- temp = XGINew_GetReg1( pVBInfo->Part2Port , 0x4d ) ;
-
- if ( temp & 0x10 )
- tempch |= ActiveYPbPr ;
- }
-
- if ( tempch != 0 )
- tempcl |= ActiveTV ;
- }
- }
-
- temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x3d ) ;
- if ( tempcl & ActiveLCD )
- {
- if ( ( pVBInfo->SetFlag & ReserveTVOption ) )
- {
- if ( temp & ActiveTV )
- tempcl |= ActiveTV ;
- }
- }
- temp = tempcl ;
- tempbl = ~ModeSwitchStatus ;
- XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x3d , tempbl , temp ) ;
-
- if ( !( pVBInfo->SetFlag & ReserveTVOption ) )
- XGINew_SetReg1( pVBInfo->P3d4 , 0x3e , tempch ) ;
- }
- else
- {
- return ;
- }
+void XGI_SetCRT2ECLK(unsigned short ModeNo, unsigned short ModeIdIndex,
+ unsigned short RefreshRateTableIndex,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned char di_0, di_1, tempal;
+ int i;
+
+ tempal = XGI_GetVCLKPtr(RefreshRateTableIndex, ModeNo, ModeIdIndex,
+ pVBInfo);
+ XGI_GetVCLKLen(tempal, &di_0, &di_1, pVBInfo);
+ XGI_GetLCDVCLKPtr(&di_0, &di_1, pVBInfo);
+
+ for (i = 0; i < 4; i++) {
+ XGINew_SetRegANDOR(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);
+ } else if ((!(pVBInfo->VBInfo & SetCRT2ToLCDA))
+ && (!(pVBInfo->VBInfo & SetInSlaveMode))) {
+ XGINew_SetReg1(pVBInfo->P3c4, 0x2e, di_0);
+ XGINew_SetReg1(pVBInfo->P3c4, 0x2f, di_1);
+ } else {
+ XGINew_SetReg1(pVBInfo->P3c4, 0x2b, di_0);
+ XGINew_SetReg1(pVBInfo->P3c4, 0x2c, di_1);
+ }
+ }
}
+void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short tempcl, tempch, temp, tempbl, tempax;
+
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C)) {
+ tempcl = 0;
+ tempch = 0;
+ temp = XGINew_GetReg1(pVBInfo->P3c4, 0x01);
+
+ if (!(temp & 0x20)) {
+ temp = XGINew_GetReg1(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);
+
+ if (!(temp & 0x40))
+ tempcl |= ActiveCRT1;
+ }
+ }
+
+ temp = XGINew_GetReg1(pVBInfo->Part1Port, 0x2e);
+ temp &= 0x0f;
+
+ if (!(temp == 0x08)) {
+ tempax = XGINew_GetReg1(pVBInfo->Part1Port, 0x13); /* Check ChannelA by Part1_13 [2003/10/03] */
+ if (tempax & 0x04)
+ tempcl = tempcl | ActiveLCD;
+
+ temp &= 0x05;
+
+ if (!(tempcl & ActiveLCD))
+ if (temp == 0x01)
+ tempcl |= ActiveCRT2;
+
+ if (temp == 0x04)
+ tempcl |= ActiveLCD;
+
+ if (temp == 0x05) {
+ temp = XGINew_GetReg1(pVBInfo->Part2Port, 0x00);
+
+ if (!(temp & 0x08))
+ tempch |= ActiveAVideo;
+
+ if (!(temp & 0x04))
+ tempch |= ActiveSVideo;
+
+ if (temp & 0x02)
+ tempch |= ActiveSCART;
+
+ if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) {
+ if (temp & 0x01)
+ tempch |= ActiveHiTV;
+ }
+
+ if (pVBInfo->VBInfo & SetCRT2ToYPbPr) {
+ temp = XGINew_GetReg1(
+ pVBInfo->Part2Port,
+ 0x4d);
+
+ if (temp & 0x10)
+ tempch |= ActiveYPbPr;
+ }
+
+ if (tempch != 0)
+ tempcl |= ActiveTV;
+ }
+ }
+
+ temp = XGINew_GetReg1(pVBInfo->P3d4, 0x3d);
+ if (tempcl & ActiveLCD) {
+ if ((pVBInfo->SetFlag & ReserveTVOption)) {
+ if (temp & ActiveTV)
+ tempcl |= ActiveTV;
+ }
+ }
+ temp = tempcl;
+ tempbl = ~ModeSwitchStatus;
+ XGINew_SetRegANDOR(pVBInfo->P3d4, 0x3d, tempbl, temp);
+
+ if (!(pVBInfo->SetFlag & ReserveTVOption))
+ XGINew_SetReg1(pVBInfo->P3d4, 0x3e, tempch);
+ } else {
+ return;
+ }
+}
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GetVGAType */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_GetVGAType(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)
{
- /*
- if ( HwDeviceExtension->jChipType >= XG20 )
- {
- pVBInfo->Set_VGAType = XG20;
- }
- else if ( HwDeviceExtension->jChipType >= XG40 )
- {
- pVBInfo->Set_VGAType = VGA_XGI340 ;
- }
- */
- pVBInfo->Set_VGAType = HwDeviceExtension->jChipType;
+ /*
+ if ( HwDeviceExtension->jChipType >= XG20 ) {
+ pVBInfo->Set_VGAType = XG20;
+ } else if (HwDeviceExtension->jChipType >= XG40) {
+ pVBInfo->Set_VGAType = VGA_XGI340;
+ }
+ */
+ pVBInfo->Set_VGAType = HwDeviceExtension->jChipType;
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GetVBType */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
void XGI_GetVBType(struct vb_device_info *pVBInfo)
{
- unsigned short flag , tempbx , tempah ;
-
- if ( pVBInfo->IF_DEF_CH7007 == 1 )
- {
- pVBInfo->VBType = VB_CH7007 ;
- return;
- }
- if ( pVBInfo->IF_DEF_LVDS == 0 )
- {
- tempbx = VB_XGI302B ;
- flag = XGINew_GetReg1( pVBInfo->Part4Port , 0x00 ) ;
- if ( flag != 0x02 )
- {
- tempbx = VB_XGI301 ;
- flag = XGINew_GetReg1( pVBInfo->Part4Port , 0x01 ) ;
- if ( flag >= 0xB0 )
- {
- tempbx = VB_XGI301B ;
- if ( flag >= 0xC0 )
- {
- tempbx = VB_XGI301C ;
- if ( flag >= 0xD0 )
- {
- tempbx = VB_XGI301LV ;
- if ( flag >= 0xE0 )
- {
- tempbx = VB_XGI302LV ;
- tempah = XGINew_GetReg1( pVBInfo->Part4Port , 0x39 ) ;
- if ( tempah != 0xFF )
- tempbx = VB_XGI301C ;
- }
- }
- }
-
- if ( tempbx & ( VB_XGI301B | VB_XGI302B ) )
- {
- flag = XGINew_GetReg1( pVBInfo->Part4Port , 0x23 ) ;
-
- if ( !( flag & 0x02 ) )
- tempbx = tempbx | VB_NoLCD ;
- }
- }
- }
- pVBInfo->VBType = tempbx ;
- }
-/*
- else if ( pVBInfo->IF_DEF_CH7017 == 1 )
- pVBInfo->VBType = VB_CH7017 ;
- else //LVDS
- pVBInfo->VBType = VB_LVDS_NS ;
-*/
+ unsigned short flag, tempbx, tempah;
+
+ if (pVBInfo->IF_DEF_CH7007 == 1) {
+ pVBInfo->VBType = VB_CH7007;
+ return;
+ }
+ if (pVBInfo->IF_DEF_LVDS == 0) {
+ tempbx = VB_XGI302B;
+ flag = XGINew_GetReg1(pVBInfo->Part4Port, 0x00);
+ if (flag != 0x02) {
+ tempbx = VB_XGI301;
+ flag = XGINew_GetReg1(pVBInfo->Part4Port, 0x01);
+ if (flag >= 0xB0) {
+ tempbx = VB_XGI301B;
+ if (flag >= 0xC0) {
+ tempbx = VB_XGI301C;
+ if (flag >= 0xD0) {
+ tempbx = VB_XGI301LV;
+ if (flag >= 0xE0) {
+ tempbx = VB_XGI302LV;
+ tempah
+ = XGINew_GetReg1(
+ pVBInfo->Part4Port,
+ 0x39);
+ if (tempah != 0xFF)
+ tempbx
+ = VB_XGI301C;
+ }
+ }
+ }
+
+ if (tempbx & (VB_XGI301B | VB_XGI302B)) {
+ flag = XGINew_GetReg1(
+ pVBInfo->Part4Port,
+ 0x23);
+
+ if (!(flag & 0x02))
+ tempbx = tempbx | VB_NoLCD;
+ }
+ }
+ }
+ pVBInfo->VBType = tempbx;
+ }
+ /*
+ else if (pVBInfo->IF_DEF_CH7017 == 1)
+ pVBInfo->VBType = VB_CH7017;
+ else //LVDS
+ pVBInfo->VBType = VB_LVDS_NS;
+ */
}
+void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
+ struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short tempax, push, tempbx, temp, modeflag;
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GetVBInfo */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
-{
- unsigned short tempax ,
- push ,
- tempbx ,
- temp ,
- modeflag ;
-
- if ( ModeNo <= 0x13 )
- {
- modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ;
- }
- else
- {
- modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ;
- }
-
- pVBInfo->SetFlag = 0 ;
- pVBInfo->ModeType = modeflag & ModeInfoFlag ;
- tempbx = 0 ;
-
- if ( pVBInfo->VBType & 0xFFFF )
- {
- temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x30 ) ; /* Check Display Device */
- tempbx = tempbx | temp ;
- temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x31 ) ;
- push = temp ;
- push = push << 8 ;
- tempax = temp << 8 ;
- tempbx = tempbx | tempax ;
- temp = ( SetCRT2ToDualEdge | SetCRT2ToYPbPr | SetCRT2ToLCDA | SetInSlaveMode | DisableCRT2Display ) ;
- temp = 0xFFFF ^ temp ;
- tempbx &= temp ;
-
- temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x38 ) ;
-
- if ( pVBInfo->IF_DEF_LCDA == 1 )
- {
-
- if ( ( pVBInfo->Set_VGAType >= XG20 ) || ( pVBInfo->Set_VGAType >= XG40 ))
- {
- if ( pVBInfo->IF_DEF_LVDS == 0 )
- {
- /* if ( ( pVBInfo->VBType & VB_XGI302B ) || ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) || ( pVBInfo->VBType & VB_XGI301C ) ) */
- if ( pVBInfo->VBType & ( VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) )
- {
- if ( temp & EnableDualEdge )
- {
- tempbx |= SetCRT2ToDualEdge ;
-
- if ( temp & SetToLCDA )
- tempbx |= SetCRT2ToLCDA ;
- }
- }
- }
- else if ( pVBInfo->IF_DEF_CH7017 == 1 )
- {
- if ( pVBInfo->VBType & VB_CH7017 )
- {
- if ( temp & EnableDualEdge )
- {
- tempbx |= SetCRT2ToDualEdge ;
-
- if ( temp & SetToLCDA )
- tempbx |= SetCRT2ToLCDA ;
- }
- }
- }
- }
- }
-
- if ( pVBInfo->IF_DEF_YPbPr == 1 )
- {
- if ( ( ( pVBInfo->IF_DEF_LVDS == 0 ) && ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) || ( pVBInfo->VBType & VB_XGI301C ) ) )
- || ( ( pVBInfo->IF_DEF_CH7017 == 1 ) && ( pVBInfo->VBType&VB_CH7017 ) ) || ( (pVBInfo->IF_DEF_CH7007 == 1) && (pVBInfo->VBType&VB_CH7007) ) ) /* [Billy] 07/05/04 */
- {
- if ( temp & SetYPbPr ) /* temp = CR38 */
- {
- if ( pVBInfo->IF_DEF_HiVision == 1 )
- {
- temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x35 ) ; /* shampoo add for new scratch */
- temp &= YPbPrMode ;
- tempbx |= SetCRT2ToHiVisionTV ;
-
- if ( temp != YPbPrMode1080i ) {
- tempbx &= ( ~SetCRT2ToHiVisionTV ) ;
- tempbx |= SetCRT2ToYPbPr ; }
- }
-
- /* tempbx |= SetCRT2ToYPbPr ; */
- }
- }
- }
-
- tempax = push ; /* restore CR31 */
-
- if ( pVBInfo->IF_DEF_LVDS == 0 )
- {
- if ( pVBInfo->IF_DEF_YPbPr == 1 )
- {
- if ( pVBInfo->IF_DEF_HiVision == 1 )
- temp = 0x09FC ;
- else
- temp = 0x097C ;
- }
- else
- {
- if ( pVBInfo->IF_DEF_HiVision == 1 )
- temp = 0x01FC ;
- else
- temp = 0x017C ;
- }
- }
- else /* 3nd party chip */
- {
- if ( pVBInfo->IF_DEF_CH7017 == 1 )
- temp = ( SetCRT2ToTV | SetCRT2ToLCD | SetCRT2ToLCDA ) ;
- else if ( pVBInfo->IF_DEF_CH7007 == 1 ) /* [Billy] 07/05/03 */
- {
- temp = SetCRT2ToTV ;
- }
- else
- temp = SetCRT2ToLCD ;
- }
-
- if ( !( tempbx & temp ) )
- {
- tempax |= DisableCRT2Display ;
- tempbx = 0 ;
- }
-
- if ( pVBInfo->IF_DEF_LCDA == 1 ) /* Select Display Device */
- {
- if ( !( pVBInfo->VBType & VB_NoLCD ) )
- {
- if ( tempbx & SetCRT2ToLCDA )
- {
- if ( tempbx & SetSimuScanMode )
- tempbx &= ( ~( SetCRT2ToLCD | SetCRT2ToRAMDAC | SwitchToCRT2 ) ) ;
- else
- tempbx &= ( ~( SetCRT2ToLCD | SetCRT2ToRAMDAC | SetCRT2ToTV | SwitchToCRT2 ) ) ;
- }
- }
- }
-
- /* shampoo add */
- if ( !( tempbx & ( SwitchToCRT2 | SetSimuScanMode ) ) ) /* for driver abnormal */
- {
- if ( pVBInfo->IF_DEF_CRT2Monitor == 1 )
- {
- if ( tempbx & SetCRT2ToRAMDAC )
- {
- tempbx &= ( 0xFF00 | SetCRT2ToRAMDAC | SwitchToCRT2 | SetSimuScanMode ) ;
- tempbx &= ( 0x00FF | ( ~SetCRT2ToYPbPr ) ) ;
- }
- }
- else
- tempbx &= ( ~( SetCRT2ToRAMDAC | SetCRT2ToLCD | SetCRT2ToTV ) ) ;
- }
-
- if ( !( pVBInfo->VBType & VB_NoLCD ) )
- {
- if ( tempbx & SetCRT2ToLCD )
- {
- tempbx &= ( 0xFF00 | SetCRT2ToLCD | SwitchToCRT2 | SetSimuScanMode ) ;
- tempbx &= ( 0x00FF | ( ~SetCRT2ToYPbPr ) ) ;
- }
- }
-
- if ( tempbx & SetCRT2ToSCART )
- {
- tempbx &= ( 0xFF00 | SetCRT2ToSCART | SwitchToCRT2 | SetSimuScanMode ) ;
- tempbx &= ( 0x00FF | ( ~SetCRT2ToYPbPr ) ) ;
- }
-
- if ( pVBInfo->IF_DEF_YPbPr == 1 )
- {
- if ( tempbx & SetCRT2ToYPbPr )
- tempbx &= ( 0xFF00 | SwitchToCRT2 | SetSimuScanMode ) ;
- }
-
- if ( pVBInfo->IF_DEF_HiVision == 1 )
- {
- if ( tempbx & SetCRT2ToHiVisionTV )
- tempbx &= ( 0xFF00 | SetCRT2ToHiVisionTV | SwitchToCRT2 | SetSimuScanMode ) ;
- }
-
- if ( tempax & DisableCRT2Display ) /* Set Display Device Info */
- {
- if ( !( tempbx & ( SwitchToCRT2 | SetSimuScanMode ) ) )
- tempbx = DisableCRT2Display ;
- }
-
- if ( !( tempbx & DisableCRT2Display ) )
- {
- if ( ( !( tempbx & DriverMode ) ) || ( !( modeflag & CRT2Mode ) ) )
- {
- if ( pVBInfo->IF_DEF_LCDA == 1 )
- {
- if ( !( tempbx & SetCRT2ToLCDA ) )
- tempbx |= ( SetInSlaveMode | SetSimuScanMode ) ;
- }
-
- if ( pVBInfo->IF_DEF_VideoCapture == 1 )
- {
- if ( ( ( HwDeviceExtension->jChipType == XG40 ) && ( pVBInfo->Set_VGAType == XG40 ) )
- || ( ( HwDeviceExtension->jChipType == XG41 ) && ( pVBInfo->Set_VGAType == XG41 ) )
- || ( ( HwDeviceExtension->jChipType == XG42 ) && ( pVBInfo->Set_VGAType == XG42 ) )
- || ( ( HwDeviceExtension->jChipType == XG45 ) && ( pVBInfo->Set_VGAType == XG45 ) ) )
- {
- if ( ModeNo <= 13 )
- {
- if ( !( tempbx & SetCRT2ToRAMDAC ) ) /*CRT2 not need to support*/
- {
- tempbx &= ( 0x00FF | ( ~SetInSlaveMode ) ) ;
- pVBInfo->SetFlag |= EnableVCMode ;
- }
- }
- }
- }
- }
-
- /*LCD+TV can't support in slave mode (Force LCDA+TV->LCDB)*/
- if ( ( tempbx & SetInSlaveMode ) && ( tempbx & SetCRT2ToLCDA ) )
- {
- tempbx ^= ( SetCRT2ToLCD | SetCRT2ToLCDA | SetCRT2ToDualEdge ) ;
- pVBInfo->SetFlag |= ReserveTVOption ;
- }
- }
- }
-
- pVBInfo->VBInfo = tempbx ;
+ if (ModeNo <= 0x13)
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
+ else
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+
+ pVBInfo->SetFlag = 0;
+ pVBInfo->ModeType = modeflag & ModeInfoFlag;
+ tempbx = 0;
+
+ if (pVBInfo->VBType & 0xFFFF) {
+ temp = XGINew_GetReg1(pVBInfo->P3d4, 0x30); /* Check Display Device */
+ tempbx = tempbx | temp;
+ temp = XGINew_GetReg1(pVBInfo->P3d4, 0x31);
+ push = temp;
+ push = push << 8;
+ tempax = temp << 8;
+ tempbx = tempbx | tempax;
+ temp = (SetCRT2ToDualEdge | SetCRT2ToYPbPr | SetCRT2ToLCDA
+ | SetInSlaveMode | DisableCRT2Display);
+ temp = 0xFFFF ^ temp;
+ tempbx &= temp;
+
+ temp = XGINew_GetReg1(pVBInfo->P3d4, 0x38);
+
+ if (pVBInfo->IF_DEF_LCDA == 1) {
+
+ if ((pVBInfo->Set_VGAType >= XG20)
+ || (pVBInfo->Set_VGAType >= XG40)) {
+ if (pVBInfo->IF_DEF_LVDS == 0) {
+ /* if ((pVBInfo->VBType & VB_XGI302B) || (pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType & VB_XGI302LV) || (pVBInfo->VBType & VB_XGI301C)) */
+ if (pVBInfo->VBType & (VB_XGI302B
+ | VB_XGI301LV
+ | VB_XGI302LV
+ | VB_XGI301C)) {
+ if (temp & EnableDualEdge) {
+ tempbx
+ |= SetCRT2ToDualEdge;
+
+ if (temp & SetToLCDA)
+ tempbx
+ |= SetCRT2ToLCDA;
+ }
+ }
+ } else if (pVBInfo->IF_DEF_CH7017 == 1) {
+ if (pVBInfo->VBType & VB_CH7017) {
+ if (temp & EnableDualEdge) {
+ tempbx
+ |= SetCRT2ToDualEdge;
+
+ if (temp & SetToLCDA)
+ tempbx
+ |= SetCRT2ToLCDA;
+ }
+ }
+ }
+ }
+ }
+
+ if (pVBInfo->IF_DEF_YPbPr == 1) {
+ if (((pVBInfo->IF_DEF_LVDS == 0) && ((pVBInfo->VBType
+ & VB_XGI301LV) || (pVBInfo->VBType
+ & VB_XGI302LV) || (pVBInfo->VBType
+ & VB_XGI301C)))
+ || ((pVBInfo->IF_DEF_CH7017 == 1)
+ && (pVBInfo->VBType
+ & VB_CH7017))
+ || ((pVBInfo->IF_DEF_CH7007 == 1)
+ && (pVBInfo->VBType
+ & VB_CH7007))) { /* [Billy] 07/05/04 */
+ if (temp & SetYPbPr) { /* temp = CR38 */
+ if (pVBInfo->IF_DEF_HiVision == 1) {
+ temp = XGINew_GetReg1(
+ pVBInfo->P3d4,
+ 0x35); /* shampoo add for new scratch */
+ temp &= YPbPrMode;
+ tempbx |= SetCRT2ToHiVisionTV;
+
+ if (temp != YPbPrMode1080i) {
+ tempbx
+ &= (~SetCRT2ToHiVisionTV);
+ tempbx
+ |= SetCRT2ToYPbPr;
+ }
+ }
+
+ /* tempbx |= SetCRT2ToYPbPr; */
+ }
+ }
+ }
+
+ tempax = push; /* restore CR31 */
+
+ if (pVBInfo->IF_DEF_LVDS == 0) {
+ if (pVBInfo->IF_DEF_YPbPr == 1) {
+ if (pVBInfo->IF_DEF_HiVision == 1)
+ temp = 0x09FC;
+ else
+ temp = 0x097C;
+ } else {
+ if (pVBInfo->IF_DEF_HiVision == 1)
+ temp = 0x01FC;
+ else
+ temp = 0x017C;
+ }
+ } else { /* 3nd party chip */
+ if (pVBInfo->IF_DEF_CH7017 == 1)
+ temp = (SetCRT2ToTV | SetCRT2ToLCD
+ | SetCRT2ToLCDA);
+ else if (pVBInfo->IF_DEF_CH7007 == 1) { /* [Billy] 07/05/03 */
+ temp = SetCRT2ToTV;
+ } else
+ temp = SetCRT2ToLCD;
+ }
+
+ if (!(tempbx & temp)) {
+ tempax |= DisableCRT2Display;
+ tempbx = 0;
+ }
+
+ if (pVBInfo->IF_DEF_LCDA == 1) { /* Select Display Device */
+ if (!(pVBInfo->VBType & VB_NoLCD)) {
+ if (tempbx & SetCRT2ToLCDA) {
+ if (tempbx & SetSimuScanMode)
+ tempbx
+ &= (~(SetCRT2ToLCD
+ | SetCRT2ToRAMDAC
+ | SwitchToCRT2));
+ else
+ tempbx
+ &= (~(SetCRT2ToLCD
+ | SetCRT2ToRAMDAC
+ | SetCRT2ToTV
+ | SwitchToCRT2));
+ }
+ }
+ }
+
+ /* shampoo add */
+ if (!(tempbx & (SwitchToCRT2 | SetSimuScanMode))) { /* for driver abnormal */
+ if (pVBInfo->IF_DEF_CRT2Monitor == 1) {
+ if (tempbx & SetCRT2ToRAMDAC) {
+ tempbx &= (0xFF00 | SetCRT2ToRAMDAC
+ | SwitchToCRT2
+ | SetSimuScanMode);
+ tempbx &= (0x00FF | (~SetCRT2ToYPbPr));
+ }
+ } else {
+ tempbx &= (~(SetCRT2ToRAMDAC | SetCRT2ToLCD
+ | SetCRT2ToTV));
+ }
+ }
+
+ if (!(pVBInfo->VBType & VB_NoLCD)) {
+ if (tempbx & SetCRT2ToLCD) {
+ tempbx &= (0xFF00 | SetCRT2ToLCD | SwitchToCRT2
+ | SetSimuScanMode);
+ tempbx &= (0x00FF | (~SetCRT2ToYPbPr));
+ }
+ }
+
+ if (tempbx & SetCRT2ToSCART) {
+ tempbx &= (0xFF00 | SetCRT2ToSCART | SwitchToCRT2
+ | SetSimuScanMode);
+ tempbx &= (0x00FF | (~SetCRT2ToYPbPr));
+ }
+
+ if (pVBInfo->IF_DEF_YPbPr == 1) {
+ if (tempbx & SetCRT2ToYPbPr)
+ tempbx &= (0xFF00 | SwitchToCRT2
+ | SetSimuScanMode);
+ }
+
+ if (pVBInfo->IF_DEF_HiVision == 1) {
+ if (tempbx & SetCRT2ToHiVisionTV)
+ tempbx &= (0xFF00 | SetCRT2ToHiVisionTV
+ | SwitchToCRT2
+ | SetSimuScanMode);
+ }
+
+ if (tempax & DisableCRT2Display) { /* Set Display Device Info */
+ if (!(tempbx & (SwitchToCRT2 | SetSimuScanMode)))
+ tempbx = DisableCRT2Display;
+ }
+
+ if (!(tempbx & DisableCRT2Display)) {
+ if ((!(tempbx & DriverMode))
+ || (!(modeflag & CRT2Mode))) {
+ if (pVBInfo->IF_DEF_LCDA == 1) {
+ if (!(tempbx & SetCRT2ToLCDA))
+ tempbx
+ |= (SetInSlaveMode
+ | SetSimuScanMode);
+ }
+
+ if (pVBInfo->IF_DEF_VideoCapture == 1) {
+ if (((HwDeviceExtension->jChipType
+ == XG40)
+ && (pVBInfo->Set_VGAType
+ == XG40))
+ || ((HwDeviceExtension->jChipType
+ == XG41)
+ && (pVBInfo->Set_VGAType
+ == XG41))
+ || ((HwDeviceExtension->jChipType
+ == XG42)
+ && (pVBInfo->Set_VGAType
+ == XG42))
+ || ((HwDeviceExtension->jChipType
+ == XG45)
+ && (pVBInfo->Set_VGAType
+ == XG45))) {
+ if (ModeNo <= 13) {
+ if (!(tempbx
+ & SetCRT2ToRAMDAC)) { /*CRT2 not need to support*/
+ tempbx
+ &= (0x00FF
+ | (~SetInSlaveMode));
+ pVBInfo->SetFlag
+ |= EnableVCMode;
+ }
+ }
+ }
+ }
+ }
+
+ /* LCD+TV can't support in slave mode (Force LCDA+TV->LCDB) */
+ if ((tempbx & SetInSlaveMode) && (tempbx
+ & SetCRT2ToLCDA)) {
+ tempbx ^= (SetCRT2ToLCD | SetCRT2ToLCDA
+ | SetCRT2ToDualEdge);
+ pVBInfo->SetFlag |= ReserveTVOption;
+ }
+ }
+ }
+
+ pVBInfo->VBInfo = tempbx;
+}
+
+void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short temp, tempbx = 0, resinfo = 0, modeflag, index1;
+
+ tempbx = 0;
+ resinfo = 0;
+
+ if (pVBInfo->VBInfo & SetCRT2ToTV) {
+ if (ModeNo <= 0x13) {
+ modeflag
+ = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ModeFlag */
+ resinfo = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo; /* si+St_ResInfo */
+ } else {
+ modeflag
+ = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ resinfo
+ = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; /* si+Ext_ResInfo */
+ }
+
+ if (pVBInfo->VBInfo & SetCRT2ToTV) {
+ temp = XGINew_GetReg1(pVBInfo->P3d4, 0x35);
+ tempbx = temp;
+ if (tempbx & SetPALTV) {
+ tempbx &= (SetCHTVOverScan | SetPALMTV
+ | SetPALNTV | SetPALTV);
+ if (tempbx & SetPALMTV)
+ tempbx &= ~SetPALTV; /* set to NTSC if PAL-M */
+ } else
+ tempbx &= (SetCHTVOverScan | SetNTSCJ
+ | SetPALTV);
+ /*
+ if (pVBInfo->IF_DEF_LVDS == 0) {
+ index1 = XGINew_GetReg1(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
+ tempbx &= (~SetPALTV);
+ }
+ */
+ }
+
+ if (pVBInfo->IF_DEF_CH7017 == 1) {
+ tempbx = XGINew_GetReg1(pVBInfo->P3d4, 0x35);
+
+ if (tempbx & TVOverScan)
+ tempbx |= SetCHTVOverScan;
+ }
+
+ if (pVBInfo->IF_DEF_CH7007 == 1) { /* [Billy] 07/05/04 */
+ tempbx = XGINew_GetReg1(pVBInfo->P3d4, 0x35);
+
+ if (tempbx & TVOverScan)
+ tempbx |= SetCHTVOverScan;
+ }
+
+ if (pVBInfo->IF_DEF_LVDS == 0) {
+ if (pVBInfo->VBInfo & SetCRT2ToSCART)
+ tempbx |= SetPALTV;
+ }
+
+ if (pVBInfo->IF_DEF_YPbPr == 1) {
+ if (pVBInfo->VBInfo & SetCRT2ToYPbPr) {
+ index1 = XGINew_GetReg1(pVBInfo->P3d4, 0x35);
+ index1 &= YPbPrMode;
+
+ if (index1 == YPbPrMode525i)
+ tempbx |= SetYPbPrMode525i;
+
+ if (index1 == YPbPrMode525p)
+ tempbx = tempbx | SetYPbPrMode525p;
+ if (index1 == YPbPrMode750p)
+ tempbx = tempbx | SetYPbPrMode750p;
+ }
+ }
+
+ if (pVBInfo->IF_DEF_HiVision == 1) {
+ if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV)
+ tempbx = tempbx | SetYPbPrMode1080i | SetPALTV;
+ }
+
+ if (pVBInfo->IF_DEF_LVDS == 0) { /* shampoo */
+ if ((pVBInfo->VBInfo & SetInSlaveMode)
+ && (!(pVBInfo->VBInfo & SetNotSimuMode)))
+ tempbx |= TVSimuMode;
+
+ if (!(tempbx & SetPALTV) && (modeflag > 13) && (resinfo
+ == 8)) /* NTSC 1024x768, */
+ tempbx |= NTSC1024x768;
+
+ tempbx |= RPLLDIV2XO;
+
+ if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) {
+ if (pVBInfo->VBInfo & SetInSlaveMode)
+ tempbx &= (~RPLLDIV2XO);
+ } else {
+ if (tempbx & (SetYPbPrMode525p
+ | SetYPbPrMode750p))
+ tempbx &= (~RPLLDIV2XO);
+ else if (!(pVBInfo->VBType & (VB_XGI301B
+ | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C))) {
+ if (tempbx & TVSimuMode)
+ tempbx &= (~RPLLDIV2XO);
+ }
+ }
+ }
+ }
+ pVBInfo->TVInfo = tempbx;
}
+unsigned char XGI_GetLCDInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short temp, tempax, tempbx, modeflag, resinfo = 0, LCDIdIndex;
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GetTVInfo */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo)
-{
- unsigned short temp ,
- tempbx = 0 ,
- resinfo = 0 ,
- modeflag ,
- index1 ;
-
- tempbx = 0 ;
- resinfo = 0 ;
-
- if ( pVBInfo->VBInfo & SetCRT2ToTV )
- {
- if ( ModeNo <= 0x13 )
- {
- modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ModeFlag */
- resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; /* si+St_ResInfo */
- }
- else
- {
- modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ;
- resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; /* si+Ext_ResInfo */
- }
-
- if ( pVBInfo->VBInfo & SetCRT2ToTV )
- {
- temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x35 ) ;
- tempbx = temp;
- if ( tempbx & SetPALTV )
- {
- tempbx &= ( SetCHTVOverScan | SetPALMTV | SetPALNTV | SetPALTV ) ;
- if ( tempbx & SetPALMTV )
- tempbx &= ~SetPALTV ; /* set to NTSC if PAL-M */
- }
- else
- tempbx &= ( SetCHTVOverScan | SetNTSCJ | SetPALTV ) ;
-/*
- if ( pVBInfo->IF_DEF_LVDS == 0 )
- {
- index1 = XGINew_GetReg1( 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
- tempbx &= ( ~SetPALTV ) ;
- }
-*/
- }
-
- if ( pVBInfo->IF_DEF_CH7017 == 1 )
- {
- tempbx = XGINew_GetReg1( pVBInfo->P3d4 , 0x35 ) ;
-
- if ( tempbx & TVOverScan )
- tempbx |= SetCHTVOverScan ;
- }
-
- if ( pVBInfo->IF_DEF_CH7007 == 1 ) /* [Billy] 07/05/04 */
- {
- tempbx = XGINew_GetReg1( pVBInfo->P3d4 , 0x35 ) ;
-
- if ( tempbx & TVOverScan )
- {
- tempbx |= SetCHTVOverScan ;
- }
- }
-
-
- if ( pVBInfo->IF_DEF_LVDS == 0 )
- {
- if ( pVBInfo->VBInfo & SetCRT2ToSCART )
- tempbx |= SetPALTV ;
- }
-
- if ( pVBInfo->IF_DEF_YPbPr == 1 )
- {
- if ( pVBInfo->VBInfo & SetCRT2ToYPbPr )
- {
- index1 = XGINew_GetReg1( pVBInfo->P3d4 , 0x35 ) ;
- index1 &= YPbPrMode ;
-
- if ( index1 == YPbPrMode525i )
- tempbx |= SetYPbPrMode525i ;
-
- if ( index1 == YPbPrMode525p )
- tempbx = tempbx | SetYPbPrMode525p;
- if ( index1 == YPbPrMode750p)
- tempbx = tempbx | SetYPbPrMode750p;
- }
- }
-
- if ( pVBInfo->IF_DEF_HiVision == 1 )
- {
- if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV )
- {
- tempbx = tempbx | SetYPbPrMode1080i | SetPALTV ;
- }
- }
-
- if ( pVBInfo->IF_DEF_LVDS == 0 )
- { /* shampoo */
- if ( ( pVBInfo->VBInfo & SetInSlaveMode ) && ( !( pVBInfo->VBInfo & SetNotSimuMode ) ) )
- tempbx |= TVSimuMode ;
-
- if ( !( tempbx & SetPALTV ) && ( modeflag > 13 ) && ( resinfo == 8 ) ) /* NTSC 1024x768, */
- tempbx |= NTSC1024x768 ;
-
- tempbx |= RPLLDIV2XO ;
-
- if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV )
- {
- if ( pVBInfo->VBInfo & SetInSlaveMode )
- tempbx &=( ~RPLLDIV2XO ) ;
- }
- else
- {
- if ( tempbx & ( SetYPbPrMode525p | SetYPbPrMode750p ) )
- tempbx &= ( ~RPLLDIV2XO ) ;
- else if ( !( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) )
- {
- if ( tempbx & TVSimuMode )
- tempbx &= ( ~RPLLDIV2XO ) ;
- }
- }
- }
- }
- pVBInfo->TVInfo = tempbx ;
-}
+ pVBInfo->LCDResInfo = 0;
+ pVBInfo->LCDTypeInfo = 0;
+ pVBInfo->LCDInfo = 0;
+ if (ModeNo <= 0x13) {
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ModeFlag // */
+ } else {
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; /* si+Ext_ResInfo // */
+ }
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GetLCDInfo */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-unsigned char XGI_GetLCDInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo)
-{
- unsigned short temp ,
- tempax ,
- tempbx ,
- modeflag ,
- resinfo = 0 ,
- LCDIdIndex ;
-
- pVBInfo->LCDResInfo = 0 ;
- pVBInfo->LCDTypeInfo = 0 ;
- pVBInfo->LCDInfo = 0 ;
-
- if ( ModeNo <= 0x13 )
- {
- modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ModeFlag // */
- }
- else
- {
- modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ;
- resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; /* si+Ext_ResInfo// */
- }
-
- temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x36 ) ; /* Get LCD Res.Info */
- tempbx = temp & 0x0F ;
-
- if ( tempbx == 0 )
- tempbx = Panel1024x768 ; /* default */
-
- /* LCD75 [2003/8/22] Vicent */
- if ( ( tempbx == Panel1024x768 ) || ( tempbx == Panel1280x1024 ) )
- {
- if ( pVBInfo->VBInfo & DriverMode )
- {
- tempax = XGINew_GetReg1( pVBInfo->P3d4 , 0x33 ) ;
- if ( pVBInfo->VBInfo & SetCRT2ToLCDA )
- tempax &= 0x0F ;
- else
- tempax = tempax >> 4 ;
-
- if ( ( resinfo == 6 ) || ( resinfo == 9 ) )
- {
- if ( tempax >= 3 )
- tempbx |= PanelRef75Hz ;
- }
- else if ( ( resinfo == 7 ) || ( resinfo == 8 ) )
- {
- if ( tempax >= 4 )
- tempbx |= PanelRef75Hz ;
- }
- }
- }
-
- pVBInfo->LCDResInfo = tempbx ;
-
- /* End of LCD75 */
-
- if( pVBInfo->IF_DEF_OEMUtil == 1 )
- {
- pVBInfo->LCDTypeInfo = ( temp & 0xf0 ) >> 4 ;
- }
-
- if ( !( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) )
- {
- return 0;
- }
-
- tempbx = 0 ;
-
- temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ;
-
- temp &= ( ScalingLCD | LCDNonExpanding | LCDSyncBit | SetPWDEnable ) ;
-
- if ( ( pVBInfo->IF_DEF_ScaleLCD == 1 ) && ( temp & LCDNonExpanding ) )
- temp &= ~EnableScalingLCD ;
-
- tempbx |= temp ;
-
- LCDIdIndex = XGI_GetLCDCapPtr1(pVBInfo) ;
-
- tempax = pVBInfo->LCDCapList[ LCDIdIndex ].LCD_Capability ;
-
- if ( pVBInfo->IF_DEF_LVDS == 0 ) /* shampoo */
- {
- if ( ( ( pVBInfo->VBType & VB_XGI302LV ) || ( pVBInfo->VBType & VB_XGI301C ) ) && ( tempax & LCDDualLink ) )
- {
- tempbx |= SetLCDDualLink ;
- }
- }
-
- if ( pVBInfo->IF_DEF_CH7017 == 1 )
- {
- if ( tempax & LCDDualLink )
- {
- tempbx |= SetLCDDualLink ;
- }
- }
-
- if ( pVBInfo->IF_DEF_LVDS == 0 )
- {
- if ( ( pVBInfo->LCDResInfo == Panel1400x1050 ) && ( pVBInfo->VBInfo & SetCRT2ToLCD ) && ( ModeNo > 0x13 ) && ( resinfo == 9 ) && ( !( tempbx & EnableScalingLCD ) ) )
- tempbx |= SetLCDtoNonExpanding ; /* set to center in 1280x1024 LCDB for Panel1400x1050 */
- }
+ temp = XGINew_GetReg1(pVBInfo->P3d4, 0x36); /* Get LCD Res.Info */
+ tempbx = temp & 0x0F;
+
+ if (tempbx == 0)
+ tempbx = Panel1024x768; /* default */
+
+ /* LCD75 [2003/8/22] Vicent */
+ if ((tempbx == Panel1024x768) || (tempbx == Panel1280x1024)) {
+ if (pVBInfo->VBInfo & DriverMode) {
+ tempax = XGINew_GetReg1(pVBInfo->P3d4, 0x33);
+ if (pVBInfo->VBInfo & SetCRT2ToLCDA)
+ tempax &= 0x0F;
+ else
+ tempax = tempax >> 4;
+
+ if ((resinfo == 6) || (resinfo == 9)) {
+ if (tempax >= 3)
+ tempbx |= PanelRef75Hz;
+ } else if ((resinfo == 7) || (resinfo == 8)) {
+ if (tempax >= 4)
+ tempbx |= PanelRef75Hz;
+ }
+ }
+ }
-/*
- if ( tempax & LCDBToA )
- {
- tempbx |= SetLCDBToA ;
- }
-*/
+ pVBInfo->LCDResInfo = tempbx;
- if ( pVBInfo->IF_DEF_ExpLink == 1 )
- {
- if ( modeflag & HalfDCLK )
- {
- /* if ( !( pVBInfo->LCDInfo&LCDNonExpanding ) ) */
- if ( !( tempbx & SetLCDtoNonExpanding ) )
- {
- tempbx |= EnableLVDSDDA ;
- }
- else
- {
- if ( ModeNo > 0x13 )
- {
- if ( pVBInfo->LCDResInfo == Panel1024x768 )
- {
- if ( resinfo == 4 )
- { /* 512x384 */
- tempbx |= EnableLVDSDDA ;
- }
- }
- }
- }
- }
- }
-
- if ( pVBInfo->VBInfo & SetInSlaveMode )
- {
- if ( pVBInfo->VBInfo & SetNotSimuMode )
- {
- tempbx |= LCDVESATiming ;
- }
- }
- else
- {
- tempbx |= LCDVESATiming ;
- }
-
- pVBInfo->LCDInfo = tempbx ;
-
- if ( pVBInfo->IF_DEF_PWD == 1 )
- {
- if ( pVBInfo->LCDInfo & SetPWDEnable )
- {
- if ( ( pVBInfo->VBType & VB_XGI302LV ) || ( pVBInfo->VBType & VB_XGI301C ) )
- {
- if ( !( tempax & PWDEnable ) )
- {
- pVBInfo->LCDInfo &= ~SetPWDEnable ;
- }
- }
- }
- }
-
- if ( pVBInfo->IF_DEF_LVDS == 0 )
- {
- if ( tempax & ( LockLCDBToA | StLCDBToA ) )
- {
- if ( pVBInfo->VBInfo & SetInSlaveMode )
- {
- if ( !( tempax & LockLCDBToA ) )
- {
- if ( ModeNo <= 0x13 )
- {
- pVBInfo->VBInfo &= ~( SetSimuScanMode | SetInSlaveMode | SetCRT2ToLCD ) ;
- pVBInfo->VBInfo |= SetCRT2ToLCDA | SetCRT2ToDualEdge ;
- }
- }
- }
- }
- }
+ /* End of LCD75 */
-/*
- if ( pVBInfo->IF_DEF_LVDS == 0 )
- {
- if ( tempax & ( LockLCDBToA | StLCDBToA ) )
- {
- if ( pVBInfo->VBInfo & SetInSlaveMode )
- {
- if ( !( ( !( tempax & LockLCDBToA ) ) && ( ModeNo > 0x13 ) ) )
- {
- pVBInfo->VBInfo&=~(SetSimuScanMode|SetInSlaveMode|SetCRT2ToLCD);
- pVBInfo->VBInfo|=SetCRT2ToLCDA|SetCRT2ToDualEdge;
- }
- }
- }
- }
-*/
+ if (pVBInfo->IF_DEF_OEMUtil == 1)
+ pVBInfo->LCDTypeInfo = (temp & 0xf0) >> 4;
- return( 1 ) ;
-}
+ if (!(pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)))
+ return 0;
+ tempbx = 0;
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SearchModeID */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-unsigned char XGI_SearchModeID(unsigned short ModeNo,
- unsigned short *ModeIdIndex,
- struct vb_device_info *pVBInfo)
-{
+ temp = XGINew_GetReg1(pVBInfo->P3d4, 0x37);
+ temp &= (ScalingLCD | LCDNonExpanding | LCDSyncBit | SetPWDEnable);
+ if ((pVBInfo->IF_DEF_ScaleLCD == 1) && (temp & LCDNonExpanding))
+ temp &= ~EnableScalingLCD;
-#ifdef LINUX /* chiawen for linux solution */
+ tempbx |= temp;
- if ( ModeNo <= 5 )
- ModeNo |= 1 ;
- if ( ModeNo <= 0x13 )
- {
- /* for (*ModeIdIndex=0;*ModeIdIndex<sizeof(pVBInfo->SModeIDTable)/sizeof(struct XGI_StStruct);(*ModeIdIndex)++) */
- for( *ModeIdIndex = 0 ; ; ( *ModeIdIndex )++ )
- {
- if (pVBInfo->SModeIDTable[*ModeIdIndex].St_ModeID == ModeNo)
- break;
- if (pVBInfo->SModeIDTable[*ModeIdIndex].St_ModeID == 0xFF)
- return 0;
- }
-
- if ( ModeNo == 0x07 )
- ( *ModeIdIndex )++ ; /* 400 lines */
-
- if ( ModeNo <= 3 )
- ( *ModeIdIndex ) += 2 ; /* 400 lines */
- /* else 350 lines */
- }
- else
- {
- /* for (*ModeIdIndex=0;*ModeIdIndex<sizeof(pVBInfo->EModeIDTable)/sizeof(struct XGI_ExtStruct);(*ModeIdIndex)++) */
- for( *ModeIdIndex = 0 ; ; ( *ModeIdIndex )++ )
- {
- if (pVBInfo->EModeIDTable[*ModeIdIndex].Ext_ModeID == ModeNo)
- break;
- if (pVBInfo->EModeIDTable[*ModeIdIndex].Ext_ModeID == 0xFF)
- return 0;
- }
- }
+ LCDIdIndex = XGI_GetLCDCapPtr1(pVBInfo);
-#endif
+ tempax = pVBInfo->LCDCapList[LCDIdIndex].LCD_Capability;
- return 1;
-}
+ if (pVBInfo->IF_DEF_LVDS == 0) { /* shampoo */
+ if (((pVBInfo->VBType & VB_XGI302LV) || (pVBInfo->VBType
+ & VB_XGI301C)) && (tempax & LCDDualLink)) {
+ tempbx |= SetLCDDualLink;
+ }
+ }
+ if (pVBInfo->IF_DEF_CH7017 == 1) {
+ if (tempax & LCDDualLink)
+ tempbx |= SetLCDDualLink;
+ }
+ if (pVBInfo->IF_DEF_LVDS == 0) {
+ if ((pVBInfo->LCDResInfo == Panel1400x1050) && (pVBInfo->VBInfo
+ & SetCRT2ToLCD) && (ModeNo > 0x13) && (resinfo
+ == 9) && (!(tempbx & EnableScalingLCD)))
+ tempbx |= SetLCDtoNonExpanding; /* set to center in 1280x1024 LCDB for Panel1400x1050 */
+ }
+ /*
+ if (tempax & LCDBToA) {
+ tempbx |= SetLCDBToA;
+ }
+ */
+
+ if (pVBInfo->IF_DEF_ExpLink == 1) {
+ if (modeflag & HalfDCLK) {
+ /* if (!(pVBInfo->LCDInfo&LCDNonExpanding)) */
+ if (!(tempbx & SetLCDtoNonExpanding)) {
+ tempbx |= EnableLVDSDDA;
+ } else {
+ if (ModeNo > 0x13) {
+ if (pVBInfo->LCDResInfo
+ == Panel1024x768) {
+ if (resinfo == 4) { /* 512x384 */
+ tempbx |= EnableLVDSDDA;
+ }
+ }
+ }
+ }
+ }
+ }
-/* win2000 MM adapter not support standard mode! */
+ if (pVBInfo->VBInfo & SetInSlaveMode) {
+ if (pVBInfo->VBInfo & SetNotSimuMode)
+ tempbx |= LCDVESATiming;
+ } else {
+ tempbx |= LCDVESATiming;
+ }
-/* --------------------------------------------------------------------- */
-/* Function : */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-unsigned char XGINew_CheckMemorySize(struct xgi_hw_device_info *HwDeviceExtension,
- unsigned short ModeNo,
- unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo)
-{
- unsigned short memorysize ,
- modeflag ,
- temp ,
- temp1 ,
- tmp ;
-
-/* if ( ( HwDeviceExtension->jChipType == XGI_650 ) ||
- ( HwDeviceExtension->jChipType == XGI_650M ) )
- {
- return 1;
- } */
-
- if ( ModeNo <= 0x13 )
- {
- modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ;
- }
- else {
- modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ;
- }
-
- /* ModeType = modeflag&ModeInfoFlag ; // Get mode type */
-
- memorysize = modeflag & MemoryInfoFlag ;
- memorysize = memorysize > MemorySizeShift ;
- memorysize++ ; /* Get memory size */
-
- temp = XGINew_GetReg1( pVBInfo->P3c4 , 0x14 ) ; /* Get DRAM Size */
- tmp = temp ;
-
- if ( HwDeviceExtension->jChipType == XG40 )
- {
- temp = 1 << ( ( temp & 0x0F0 ) >> 4 ) ; /* memory size per channel SR14[7:4] */
- if ( ( tmp & 0x0c ) == 0x0C ) /* Qual channels */
- {
- temp <<= 2 ;
- }
- else if ( ( tmp & 0x0c ) == 0x08 ) /* Dual channels */
- {
- temp <<= 1 ;
- }
- }
- else if ( HwDeviceExtension->jChipType == XG42 )
- {
- temp = 1 << ( ( temp & 0x0F0 ) >> 4 ) ; /* memory size per channel SR14[7:4] */
- if ( ( tmp & 0x04 ) == 0x04 ) /* Dual channels */
- {
- temp <<= 1 ;
- }
- }
- else if ( HwDeviceExtension->jChipType == XG45 )
- {
- temp = 1 << ( ( temp & 0x0F0 ) >> 4 ) ; /* memory size per channel SR14[7:4] */
- if ( ( tmp & 0x0c ) == 0x0C ) /* Qual channels */
- {
- temp <<= 2 ;
- }
- else if ( ( tmp & 0x0c ) == 0x08 ) /* triple channels */
- {
- temp1 = temp ;
- temp <<= 1 ;
- temp += temp1 ;
- }
- else if ( ( tmp & 0x0c ) == 0x04 ) /* Dual channels */
- {
- temp <<= 1 ;
- }
- }
- if (temp < memorysize)
- return 0;
- else
- return 1;
-}
+ pVBInfo->LCDInfo = tempbx;
+ if (pVBInfo->IF_DEF_PWD == 1) {
+ if (pVBInfo->LCDInfo & SetPWDEnable) {
+ if ((pVBInfo->VBType & VB_XGI302LV) || (pVBInfo->VBType
+ & VB_XGI301C)) {
+ if (!(tempax & PWDEnable))
+ pVBInfo->LCDInfo &= ~SetPWDEnable;
+ }
+ }
+ }
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_IsLowResolution */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-/*void XGINew_IsLowResolution(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned char XGINew_CheckMemorySize(struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo)
-{
- unsigned short data ;
- unsigned short ModeFlag ;
-
- data = XGINew_GetReg1( pVBInfo->P3c4 , 0x0F ) ;
- data &= 0x7F ;
- XGINew_SetReg1( 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 |= 0x80 ;
- XGINew_SetReg1( pVBInfo->P3c4 , 0x0F , data ) ;
- data = XGINew_GetReg1( pVBInfo->P3c4 , 0x01 ) ;
- data &= 0xF7 ;
- XGINew_SetReg1( pVBInfo->P3c4 , 0x01 , data ) ;
- }
- }
+ if (pVBInfo->IF_DEF_LVDS == 0) {
+ if (tempax & (LockLCDBToA | StLCDBToA)) {
+ if (pVBInfo->VBInfo & SetInSlaveMode) {
+ if (!(tempax & LockLCDBToA)) {
+ if (ModeNo <= 0x13) {
+ pVBInfo->VBInfo
+ &= ~(SetSimuScanMode
+ | SetInSlaveMode
+ | SetCRT2ToLCD);
+ pVBInfo->VBInfo
+ |= SetCRT2ToLCDA
+ | SetCRT2ToDualEdge;
+ }
+ }
+ }
+ }
+ }
+
+ /*
+ if (pVBInfo->IF_DEF_LVDS == 0) {
+ if (tempax & (LockLCDBToA | StLCDBToA)) {
+ if (pVBInfo->VBInfo & SetInSlaveMode) {
+ if (!((!(tempax & LockLCDBToA)) && (ModeNo > 0x13))) {
+ pVBInfo->VBInfo&=~(SetSimuScanMode|SetInSlaveMode|SetCRT2ToLCD);
+ pVBInfo->VBInfo|=SetCRT2ToLCDA|SetCRT2ToDualEdge;
+ }
+ }
+ }
+ }
+ */
+
+ return 1;
}
-*/
+unsigned char XGI_SearchModeID(unsigned short ModeNo,
+ unsigned short *ModeIdIndex, struct vb_device_info *pVBInfo)
+{
+ if (ModeNo <= 5)
+ ModeNo |= 1;
+ if (ModeNo <= 0x13) {
+ /* for (*ModeIdIndex=0; *ModeIdIndex < sizeof(pVBInfo->SModeIDTable) / sizeof(struct XGI_StStruct); (*ModeIdIndex)++) */
+ for (*ModeIdIndex = 0;; (*ModeIdIndex)++) {
+ if (pVBInfo->SModeIDTable[*ModeIdIndex].St_ModeID == ModeNo)
+ break;
+ if (pVBInfo->SModeIDTable[*ModeIdIndex].St_ModeID == 0xFF)
+ return 0;
+ }
+
+ if (ModeNo == 0x07)
+ (*ModeIdIndex)++; /* 400 lines */
+ if (ModeNo <= 3)
+ (*ModeIdIndex) += 2; /* 400 lines */
+ /* else 350 lines */
+ } else {
+ /* for (*ModeIdIndex=0; *ModeIdIndex < sizeof(pVBInfo->EModeIDTable) / sizeof(struct XGI_ExtStruct); (*ModeIdIndex)++) */
+ for (*ModeIdIndex = 0;; (*ModeIdIndex)++) {
+ if (pVBInfo->EModeIDTable[*ModeIdIndex].Ext_ModeID == ModeNo)
+ break;
+ if (pVBInfo->EModeIDTable[*ModeIdIndex].Ext_ModeID == 0xFF)
+ return 0;
+ }
+ }
-/* --------------------------------------------------------------------- */
-/* Function : XGI_DisplayOn */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_DisplayOn(struct xgi_hw_device_info *pXGIHWDE, struct vb_device_info *pVBInfo)
-{
-
- XGINew_SetRegANDOR(pVBInfo->P3c4,0x01,0xDF,0x00);
- if ( pXGIHWDE->jChipType == XG21 )
- {
- if ( pVBInfo->IF_DEF_LVDS == 1 )
- {
- if (!(XGI_XG21GetPSCValue( pVBInfo )&0x1))
- {
- XGI_XG21BLSignalVDD( 0x01 , 0x01, pVBInfo ) ; /* LVDS VDD on */
- XGI_XG21SetPanelDelay( 2,pVBInfo ) ;
- }
- if (!(XGI_XG21GetPSCValue( pVBInfo )&0x20))
- {
- XGI_XG21BLSignalVDD( 0x20 , 0x20, pVBInfo ) ; /* LVDS signal on */
- }
- XGI_XG21SetPanelDelay( 3,pVBInfo ) ;
- XGI_XG21BLSignalVDD( 0x02 , 0x02, pVBInfo ) ; /* LVDS backlight on */
- }
- else
- {
- XGI_XG21BLSignalVDD( 0x20 , 0x20, pVBInfo ) ; /* DVO/DVI signal on */
- }
-
- }
-
- if (pVBInfo->IF_DEF_CH7007 == 1) /* [Billy] 07/05/23 For CH7007 */
- {
-
- }
-
-
- if ( pXGIHWDE->jChipType == XG27 )
- {
- if ( pVBInfo->IF_DEF_LVDS == 1 )
- {
- if (!(XGI_XG27GetPSCValue( pVBInfo )&0x1))
- {
- XGI_XG27BLSignalVDD( 0x01 , 0x01, pVBInfo ) ; /* LVDS VDD on */
- XGI_XG21SetPanelDelay( 2,pVBInfo ) ;
- }
- if (!(XGI_XG27GetPSCValue( pVBInfo )&0x20))
- {
- XGI_XG27BLSignalVDD( 0x20 , 0x20, pVBInfo ) ; /* LVDS signal on */
- }
- XGI_XG21SetPanelDelay( 3,pVBInfo ) ;
- XGI_XG27BLSignalVDD( 0x02 , 0x02, pVBInfo ) ; /* LVDS backlight on */
- }
- else
- {
- XGI_XG27BLSignalVDD( 0x20 , 0x20, pVBInfo ) ; /* DVO/DVI signal on */
- }
-
- }
+ return 1;
}
+/* win2000 MM adapter not support standard mode! */
-/* --------------------------------------------------------------------- */
-/* Function : XGI_DisplayOff */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_DisplayOff(struct xgi_hw_device_info *pXGIHWDE, struct vb_device_info *pVBInfo)
+#if 0
+static unsigned char XGINew_CheckMemorySize(
+ struct xgi_hw_device_info *HwDeviceExtension,
+ unsigned short ModeNo,
+ unsigned short ModeIdIndex,
+ struct vb_device_info *pVBInfo)
{
+ unsigned short memorysize, modeflag, temp, temp1, tmp;
+
+ /*
+ if ((HwDeviceExtension->jChipType == XGI_650) ||
+ (HwDeviceExtension->jChipType == XGI_650M)) {
+ return 1;
+ }
+ */
+
+ if (ModeNo <= 0x13)
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
+ else
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+
+ /* ModeType = modeflag&ModeInfoFlag; // Get mode type */
+
+ memorysize = modeflag & MemoryInfoFlag;
+ memorysize = memorysize > MemorySizeShift;
+ memorysize++; /* Get memory size */
+
+ temp = XGINew_GetReg1(pVBInfo->P3c4, 0x14); /* Get DRAM Size */
+ tmp = temp;
+
+ if (HwDeviceExtension->jChipType == XG40) {
+ temp = 1 << ((temp & 0x0F0) >> 4); /* memory size per channel SR14[7:4] */
+ if ((tmp & 0x0c) == 0x0C) { /* Qual channels */
+ temp <<= 2;
+ } else if ((tmp & 0x0c) == 0x08) { /* Dual channels */
+ temp <<= 1;
+ }
+ } else if (HwDeviceExtension->jChipType == XG42) {
+ temp = 1 << ((temp & 0x0F0) >> 4); /* memory size per channel SR14[7:4] */
+ if ((tmp & 0x04) == 0x04) { /* Dual channels */
+ temp <<= 1;
+ }
+ } else if (HwDeviceExtension->jChipType == XG45) {
+ temp = 1 << ((temp & 0x0F0) >> 4); /* memory size per channel SR14[7:4] */
+ if ((tmp & 0x0c) == 0x0C) { /* Qual channels */
+ temp <<= 2;
+ } else if ((tmp & 0x0c) == 0x08) { /* triple channels */
+ temp1 = temp;
+ temp <<= 1;
+ temp += temp1;
+ } else if ((tmp & 0x0c) == 0x04) { /* Dual channels */
+ temp <<= 1;
+ }
+ }
+ if (temp < memorysize)
+ return 0;
+ else
+ return 1;
+}
+#endif
+
+/*
+void XGINew_IsLowResolution(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned char XGINew_CheckMemorySize(struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo)
+{
+ unsigned short data ;
+ unsigned short ModeFlag ;
+
+ data = XGINew_GetReg1(pVBInfo->P3c4, 0x0F);
+ data &= 0x7F;
+ XGINew_SetReg1(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 |= 0x80;
+ XGINew_SetReg1(pVBInfo->P3c4, 0x0F, data);
+ data = XGINew_GetReg1(pVBInfo->P3c4, 0x01);
+ data &= 0xF7;
+ XGINew_SetReg1(pVBInfo->P3c4, 0x01, data);
+ }
+ }
+}
+*/
- if ( pXGIHWDE->jChipType == XG21 )
- {
- if ( pVBInfo->IF_DEF_LVDS == 1 )
- {
- XGI_XG21BLSignalVDD( 0x02 , 0x00, pVBInfo ) ; /* LVDS backlight off */
- XGI_XG21SetPanelDelay( 3,pVBInfo ) ;
- }
- else
- {
- XGI_XG21BLSignalVDD( 0x20 , 0x00, pVBInfo ) ; /* DVO/DVI signal off */
- }
- }
+void XGI_DisplayOn(struct xgi_hw_device_info *pXGIHWDE,
+ struct vb_device_info *pVBInfo)
+{
+
+ XGINew_SetRegANDOR(pVBInfo->P3c4, 0x01, 0xDF, 0x00);
+ if (pXGIHWDE->jChipType == XG21) {
+ if (pVBInfo->IF_DEF_LVDS == 1) {
+ if (!(XGI_XG21GetPSCValue(pVBInfo) & 0x1)) {
+ XGI_XG21BLSignalVDD(0x01, 0x01, pVBInfo); /* LVDS VDD on */
+ XGI_XG21SetPanelDelay(2, pVBInfo);
+ }
+ if (!(XGI_XG21GetPSCValue(pVBInfo) & 0x20))
+ XGI_XG21BLSignalVDD(0x20, 0x20, pVBInfo); /* LVDS signal on */
+ XGI_XG21SetPanelDelay(3, pVBInfo);
+ XGI_XG21BLSignalVDD(0x02, 0x02, pVBInfo); /* LVDS backlight on */
+ } else {
+ XGI_XG21BLSignalVDD(0x20, 0x20, pVBInfo); /* DVO/DVI signal on */
+ }
- if (pVBInfo->IF_DEF_CH7007 == 1) /*[Billy] 07/05/23 For CH7007 */
- {
- /* if( IsCH7007TVMode( pVBInfo ) == 0 ) */
- {
- }
- }
+ }
+ if (pVBInfo->IF_DEF_CH7007 == 1) { /* [Billy] 07/05/23 For CH7007 */
- if ( pXGIHWDE->jChipType == XG27 )
- {
- if ((XGI_XG27GetPSCValue( pVBInfo )&0x2))
- {
- XGI_XG27BLSignalVDD( 0x02 , 0x00, pVBInfo ) ; /* LVDS backlight off */
- XGI_XG21SetPanelDelay( 3,pVBInfo ) ;
- }
+ }
- if ( pVBInfo->IF_DEF_LVDS == 0 )
- {
- XGI_XG27BLSignalVDD( 0x20 , 0x00, pVBInfo ) ; /* DVO/DVI signal off */
- }
- }
+ if (pXGIHWDE->jChipType == XG27) {
+ if (pVBInfo->IF_DEF_LVDS == 1) {
+ if (!(XGI_XG27GetPSCValue(pVBInfo) & 0x1)) {
+ XGI_XG27BLSignalVDD(0x01, 0x01, pVBInfo); /* LVDS VDD on */
+ XGI_XG21SetPanelDelay(2, pVBInfo);
+ }
+ if (!(XGI_XG27GetPSCValue(pVBInfo) & 0x20))
+ XGI_XG27BLSignalVDD(0x20, 0x20, pVBInfo); /* LVDS signal on */
+ XGI_XG21SetPanelDelay(3, pVBInfo);
+ XGI_XG27BLSignalVDD(0x02, 0x02, pVBInfo); /* LVDS backlight on */
+ } else {
+ XGI_XG27BLSignalVDD(0x20, 0x20, pVBInfo); /* DVO/DVI signal on */
+ }
- XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x01 , 0xDF , 0x20 ) ;
+ }
}
+void XGI_DisplayOff(struct xgi_hw_device_info *pXGIHWDE,
+ struct vb_device_info *pVBInfo)
+{
+
+ if (pXGIHWDE->jChipType == XG21) {
+ if (pVBInfo->IF_DEF_LVDS == 1) {
+ XGI_XG21BLSignalVDD(0x02, 0x00, pVBInfo); /* LVDS backlight off */
+ XGI_XG21SetPanelDelay(3, pVBInfo);
+ } else {
+ XGI_XG21BLSignalVDD(0x20, 0x00, pVBInfo); /* DVO/DVI signal off */
+ }
+ }
+
+ if (pVBInfo->IF_DEF_CH7007 == 1) { /* [Billy] 07/05/23 For CH7007 */
+ /* if (IsCH7007TVMode(pVBInfo) == 0) */
+ {
+ }
+ }
+
+ if (pXGIHWDE->jChipType == XG27) {
+ if ((XGI_XG27GetPSCValue(pVBInfo) & 0x2)) {
+ XGI_XG27BLSignalVDD(0x02, 0x00, pVBInfo); /* LVDS backlight off */
+ XGI_XG21SetPanelDelay(3, pVBInfo);
+ }
+
+ if (pVBInfo->IF_DEF_LVDS == 0)
+ XGI_XG27BLSignalVDD(0x20, 0x00, pVBInfo); /* DVO/DVI signal off */
+ }
+
+ XGINew_SetRegANDOR(pVBInfo->P3c4, 0x01, 0xDF, 0x20);
+}
-/* --------------------------------------------------------------------- */
-/* Function : XGI_WaitDisply */
-/* Input : */
-/* Output : */
-/* Description : chiawen for sensecrt1 */
-/* --------------------------------------------------------------------- */
void XGI_WaitDisply(struct vb_device_info *pVBInfo)
{
- while( ( XGINew_GetReg2( pVBInfo->P3da ) & 0x01 ) )
- break ;
+ while ((XGINew_GetReg2(pVBInfo->P3da) & 0x01))
+ break;
- while( !( XGINew_GetReg2( pVBInfo->P3da ) & 0x01 ) )
- break ;
+ while (!(XGINew_GetReg2(pVBInfo->P3da) & 0x01))
+ break;
}
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SenseCRT1 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-
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 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 } ;
+ unsigned short temp;
+ unsigned char DAC_TEST_PARMS[3] = { 0x0F, 0x0F, 0x0F };
- int i ;
- XGINew_SetReg1( pVBInfo->P3c4 , 0x05 , 0x86 ) ;
+ 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));
+ /* [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);
+ 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));
+ 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)) ;
+ 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));
+ 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));
+ 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 ) ;
+ XGINew_SetReg1(pVBInfo->P3d4, 0x11, 0x00);
- for( i = 0 ; i < 8 ; i++ )
- XGINew_SetReg1(pVBInfo->P3d4, (unsigned short)i, CRTCData[i]);
+ 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 = 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 = 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]);
+ 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, 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_SetReg1(pVBInfo->P3c4, 0x31, 0x00);
+ XGINew_SetReg1(pVBInfo->P3c4, 0x2B, 0x1B);
+ XGINew_SetReg1(pVBInfo->P3c4, 0x2C, 0xE1);
- XGINew_SetReg3( pVBInfo->P3c8 , 0x00 ) ;
+ 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]);
- }
+ 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 ) ;
+ XGI_VBLongWait(pVBInfo);
+ XGI_VBLongWait(pVBInfo);
+ XGI_VBLongWait(pVBInfo);
- XGINew_LCD_Wait_Time( 0x01 , pVBInfo ) ;
+ XGINew_LCD_Wait_Time(0x01, pVBInfo);
- XGI_WaitDisply( pVBInfo ) ;
- temp = XGINew_GetReg2( pVBInfo->P3c2 ) ;
+ 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 ) ;
- }
+ 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 ) ;
+ /* 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 ) ;
- }
+ 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 ) ;
+ 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);
+ /* [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);
+}
+#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)
+{
+ if (!(pVBInfo->SetFlag & Win9xDOSMode))
+ XGINew_SetRegOR(pVBInfo->Part1Port, 0x01, 0x40);
+}
+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 */
+ temp1 = (pVBInfo->VBInfo & SetInSlaveMode) >> 8;
+ temp2 = ~(SetInSlaveMode >> 8);
+ XGINew_SetRegANDOR(pVBInfo->P3d4, 0x31, temp2, temp1);
+}
+
+void XGI_GetCRT2ResInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short xres, yres, modeflag, resindex;
+
+ resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo);
+ if (ModeNo <= 0x13) {
+ xres = pVBInfo->StResInfo[resindex].HTotal;
+ yres = pVBInfo->StResInfo[resindex].VTotal;
+ /* modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; si+St_ResInfo */
+ } else {
+ xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */
+ yres = pVBInfo->ModeResInfo[resindex].VTotal; /* yres->bx */
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+St_ModeFlag */
+
+ /*
+ if (pVBInfo->IF_DEF_FSTN) {
+ xres *= 2;
+ yres *= 2;
+ } else {
+ */
+ if (modeflag & HalfDCLK)
+ xres *= 2;
+
+ if (modeflag & DoubleScanMode)
+ yres *= 2;
+ /* } */
+ }
+ if (pVBInfo->VBInfo & SetCRT2ToLCD) {
+ if (pVBInfo->IF_DEF_LVDS == 0) {
+ if (pVBInfo->LCDResInfo == Panel1600x1200) {
+ if (!(pVBInfo->LCDInfo & LCDVESATiming)) {
+ if (yres == 1024)
+ yres = 1056;
+ }
+ }
+
+ if (pVBInfo->LCDResInfo == Panel1280x1024) {
+ if (yres == 400)
+ yres = 405;
+ else if (yres == 350)
+ yres = 360;
+
+ if (pVBInfo->LCDInfo & LCDVESATiming) {
+ if (yres == 360)
+ yres = 375;
+ }
+ }
+
+ if (pVBInfo->LCDResInfo == Panel1024x768) {
+ if (!(pVBInfo->LCDInfo & LCDVESATiming)) {
+ if (!(pVBInfo->LCDInfo
+ & LCDNonExpanding)) {
+ if (yres == 350)
+ yres = 357;
+ else if (yres == 400)
+ yres = 420;
+ else if (yres == 480)
+ yres = 525;
+ }
+ }
+ }
+ }
+
+ if (xres == 720)
+ xres = 640;
+ }
+ pVBInfo->VGAHDE = xres;
+ pVBInfo->HDE = xres;
+ pVBInfo->VGAVDE = yres;
+ pVBInfo->VDE = yres;
+}
+unsigned char XGI_IsLCDDualLink(struct vb_device_info *pVBInfo)
+{
+ if ((((pVBInfo->VBInfo & SetCRT2ToLCD) | SetCRT2ToLCDA))
+ && (pVBInfo->LCDInfo & SetLCDDualLink)) /* shampoo0129 */
+ return 1;
+ return 0;
+}
-/* --------------------------------------------------------------------- */
-/* Function : XGI_WaitDisplay */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_WaitDisplay(struct vb_device_info *pVBInfo)
+void XGI_GetCRT2Data(unsigned short ModeNo, unsigned short ModeIdIndex,
+ unsigned short RefreshRateTableIndex,
+ struct vb_device_info *pVBInfo)
{
- while( !( XGINew_GetReg2( pVBInfo->P3da ) & 0x01 ) ) ;
+ unsigned short tempax = 0, tempbx, modeflag, resinfo;
- while( XGINew_GetReg2( pVBInfo->P3da ) & 0x01 ) ;
-}
+ struct XGI_LCDDataStruct *LCDPtr = NULL;
+ struct XGI_TVDataStruct *TVPtr = NULL;
+ if (ModeNo <= 0x13) {
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */
+ resinfo = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo;
+ } else {
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */
+ resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ }
+ pVBInfo->NewFlickerMode = 0;
+ pVBInfo->RVBHRS = 50;
+ if (pVBInfo->VBInfo & SetCRT2ToRAMDAC) {
+ XGI_GetRAMDAC2DATA(ModeNo, ModeIdIndex, RefreshRateTableIndex,
+ pVBInfo);
+ return;
+ }
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetCRT2Group301 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-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 ;
-}
+ tempbx = 4;
+
+ if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
+ LCDPtr = (struct XGI_LCDDataStruct *) XGI_GetLcdPtr(tempbx,
+ ModeNo, ModeIdIndex, RefreshRateTableIndex,
+ pVBInfo);
+
+ pVBInfo->RVBHCMAX = LCDPtr->RVBHCMAX;
+ pVBInfo->RVBHCFACT = LCDPtr->RVBHCFACT;
+ pVBInfo->VGAHT = LCDPtr->VGAHT;
+ pVBInfo->VGAVT = LCDPtr->VGAVT;
+ pVBInfo->HT = LCDPtr->LCDHT;
+ pVBInfo->VT = LCDPtr->LCDVT;
+
+ if (pVBInfo->LCDResInfo == Panel1024x768) {
+ tempax = 1024;
+ tempbx = 768;
+
+ if (!(pVBInfo->LCDInfo & LCDVESATiming)) {
+ if (pVBInfo->VGAVDE == 357)
+ tempbx = 527;
+ else if (pVBInfo->VGAVDE == 420)
+ tempbx = 620;
+ else if (pVBInfo->VGAVDE == 525)
+ tempbx = 775;
+ else if (pVBInfo->VGAVDE == 600)
+ tempbx = 775;
+ /* else if (pVBInfo->VGAVDE==350) tempbx=560; */
+ /* else if (pVBInfo->VGAVDE==400) tempbx=640; */
+ else
+ tempbx = 768;
+ } else
+ tempbx = 768;
+ } else if (pVBInfo->LCDResInfo == Panel1024x768x75) {
+ tempax = 1024;
+ tempbx = 768;
+ } else if (pVBInfo->LCDResInfo == Panel1280x1024) {
+ tempax = 1280;
+ if (pVBInfo->VGAVDE == 360)
+ tempbx = 768;
+ else if (pVBInfo->VGAVDE == 375)
+ tempbx = 800;
+ else if (pVBInfo->VGAVDE == 405)
+ tempbx = 864;
+ else
+ tempbx = 1024;
+ } else if (pVBInfo->LCDResInfo == Panel1280x1024x75) {
+ tempax = 1280;
+ tempbx = 1024;
+ } else if (pVBInfo->LCDResInfo == Panel1280x960) {
+ tempax = 1280;
+ if (pVBInfo->VGAVDE == 350)
+ tempbx = 700;
+ else if (pVBInfo->VGAVDE == 400)
+ tempbx = 800;
+ else if (pVBInfo->VGAVDE == 1024)
+ tempbx = 960;
+ else
+ tempbx = 960;
+ } else if (pVBInfo->LCDResInfo == Panel1400x1050) {
+ tempax = 1400;
+ tempbx = 1050;
+
+ if (pVBInfo->VGAVDE == 1024) {
+ tempax = 1280;
+ tempbx = 1024;
+ }
+ } else if (pVBInfo->LCDResInfo == Panel1600x1200) {
+ tempax = 1600;
+ tempbx = 1200; /* alan 10/14/2003 */
+ if (!(pVBInfo->LCDInfo & LCDVESATiming)) {
+ if (pVBInfo->VGAVDE == 350)
+ tempbx = 875;
+ else if (pVBInfo->VGAVDE == 400)
+ tempbx = 1000;
+ }
+ }
+
+ if (pVBInfo->LCDInfo & LCDNonExpanding) {
+ tempax = pVBInfo->VGAHDE;
+ tempbx = pVBInfo->VGAVDE;
+ }
+
+ pVBInfo->HDE = tempax;
+ pVBInfo->VDE = tempbx;
+ return;
+ }
+ if (pVBInfo->VBInfo & (SetCRT2ToTV)) {
+ tempbx = 4;
+ TVPtr = (struct XGI_TVDataStruct *) XGI_GetTVPtr(tempbx,
+ ModeNo, ModeIdIndex, RefreshRateTableIndex,
+ pVBInfo);
+
+ pVBInfo->RVBHCMAX = TVPtr->RVBHCMAX;
+ pVBInfo->RVBHCFACT = TVPtr->RVBHCFACT;
+ pVBInfo->VGAHT = TVPtr->VGAHT;
+ pVBInfo->VGAVT = TVPtr->VGAVT;
+ pVBInfo->HDE = TVPtr->TVHDE;
+ pVBInfo->VDE = TVPtr->TVVDE;
+ pVBInfo->RVBHRS = TVPtr->RVBHRS;
+ pVBInfo->NewFlickerMode = TVPtr->FlickerMode;
+
+ if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) {
+ if (resinfo == 0x08)
+ pVBInfo->NewFlickerMode = 0x40;
+ else if (resinfo == 0x09)
+ pVBInfo->NewFlickerMode = 0x40;
+ else if (resinfo == 0x12)
+ pVBInfo->NewFlickerMode = 0x40;
+
+ if (pVBInfo->VGAVDE == 350)
+ pVBInfo->TVInfo |= TVSimuMode;
+
+ tempax = ExtHiTVHT;
+ tempbx = ExtHiTVVT;
+
+ if (pVBInfo->VBInfo & SetInSlaveMode) {
+ if (pVBInfo->TVInfo & TVSimuMode) {
+ tempax = StHiTVHT;
+ tempbx = StHiTVVT;
+
+ if (!(modeflag & Charx8Dot)) {
+ tempax = StHiTextTVHT;
+ tempbx = StHiTextTVVT;
+ }
+ }
+ }
+ } else if (pVBInfo->VBInfo & SetCRT2ToYPbPr) {
+ if (pVBInfo->TVInfo & SetYPbPrMode750p) {
+ tempax = YPbPrTV750pHT; /* Ext750pTVHT */
+ tempbx = YPbPrTV750pVT; /* Ext750pTVVT */
+ }
+
+ if (pVBInfo->TVInfo & SetYPbPrMode525p) {
+ tempax = YPbPrTV525pHT; /* Ext525pTVHT */
+ tempbx = YPbPrTV525pVT; /* Ext525pTVVT */
+ } else if (pVBInfo->TVInfo & SetYPbPrMode525i) {
+ tempax = YPbPrTV525iHT; /* Ext525iTVHT */
+ tempbx = YPbPrTV525iVT; /* Ext525iTVVT */
+ if (pVBInfo->TVInfo & NTSC1024x768)
+ tempax = NTSC1024x768HT;
+ }
+ } else {
+ tempax = PALHT;
+ tempbx = PALVT;
+ if (!(pVBInfo->TVInfo & SetPALTV)) {
+ tempax = NTSCHT;
+ tempbx = NTSCVT;
+ if (pVBInfo->TVInfo & NTSC1024x768)
+ tempax = NTSC1024x768HT;
+ }
+ }
+
+ pVBInfo->HT = tempax;
+ pVBInfo->VT = tempbx;
+ return;
+ }
+}
-/* --------------------------------------------------------------------- */
-/* Function : XGI_AutoThreshold */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_AutoThreshold(struct vb_device_info *pVBInfo)
+void XGI_SetCRT2VCLK(unsigned short ModeNo, unsigned short ModeIdIndex,
+ unsigned short RefreshRateTableIndex,
+ struct vb_device_info *pVBInfo)
{
- if ( !( pVBInfo->SetFlag & Win9xDOSMode ) )
- XGINew_SetRegOR( pVBInfo->Part1Port , 0x01 , 0x40 ) ;
-}
+ unsigned char di_0, di_1, tempal;
+
+ tempal = XGI_GetVCLKPtr(RefreshRateTableIndex, ModeNo, ModeIdIndex,
+ pVBInfo);
+ XGI_GetVCLKLen(tempal, &di_0, &di_1, pVBInfo);
+ XGI_GetLCDVCLKPtr(&di_0, &di_1, pVBInfo);
+
+ 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);
+ } else { /* 301b/302b/301lv/302lv */
+ XGINew_SetReg1(pVBInfo->Part4Port, 0x0A, di_0);
+ XGINew_SetReg1(pVBInfo->Part4Port, 0x0B, di_1);
+ }
+
+ XGINew_SetReg1(pVBInfo->Part4Port, 0x00, 0x12);
+ if (pVBInfo->VBInfo & SetCRT2ToRAMDAC)
+ XGINew_SetRegOR(pVBInfo->Part4Port, 0x12, 0x28);
+ else
+ XGINew_SetRegOR(pVBInfo->Part4Port, 0x12, 0x08);
+}
/* --------------------------------------------------------------------- */
-/* Function : XGI_SaveCRT2Info */
+/* Function : XGI_GETLCDVCLKPtr */
/* Input : */
-/* Output : */
+/* Output : al -> VCLK Index */
/* Description : */
/* --------------------------------------------------------------------- */
-void XGI_SaveCRT2Info(unsigned short ModeNo, struct vb_device_info *pVBInfo)
+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;
+}
+
+unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex,
+ unsigned short ModeNo, unsigned short ModeIdIndex,
+ struct vb_device_info *pVBInfo)
{
- unsigned short temp1 ,
- temp2 ;
- XGINew_SetReg1( 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 ) ;
-}
+ 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;
+ }
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GetCRT2ResInfo */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_GetCRT2ResInfo(unsigned short ModeNo,
- unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo)
-{
- unsigned short xres ,
- yres ,
- modeflag ,
- resindex ;
-
- resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo) ;
- if ( ModeNo <= 0x13 )
- {
- xres = pVBInfo->StResInfo[ resindex ].HTotal ;
- yres = pVBInfo->StResInfo[ resindex ].VTotal ;
- /* modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; si+St_ResInfo */
- }
- else
- {
- xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; /* xres->ax */
- yres = pVBInfo->ModeResInfo[ resindex ].VTotal ; /* yres->bx */
- modeflag = pVBInfo->EModeIDTable[ ModeIdIndex].Ext_ModeFlag ; /* si+St_ModeFlag */
-
-/* if ( pVBInfo->IF_DEF_FSTN )
- {
- xres *= 2 ;
- yres *= 2 ;
- }
- else
- {
-*/
- if ( modeflag & HalfDCLK )
- xres *= 2;
-
- if ( modeflag & DoubleScanMode )
- yres *= 2 ;
-/* } */
- }
-
- if ( pVBInfo->VBInfo & SetCRT2ToLCD )
- {
- if ( pVBInfo->IF_DEF_LVDS == 0 )
- {
- if ( pVBInfo->LCDResInfo == Panel1600x1200 )
- {
- if ( !( pVBInfo->LCDInfo & LCDVESATiming ) )
- {
- if ( yres == 1024 )
- yres = 1056 ;
- }
- }
-
- if ( pVBInfo->LCDResInfo == Panel1280x1024 )
- {
- if ( yres == 400 )
- yres = 405 ;
- else if ( yres == 350 )
- yres = 360 ;
-
- if ( pVBInfo->LCDInfo & LCDVESATiming )
- {
- if ( yres == 360 )
- yres = 375 ;
- }
- }
-
- if ( pVBInfo->LCDResInfo == Panel1024x768 )
- {
- if ( !( pVBInfo->LCDInfo & LCDVESATiming ) )
- {
- if ( !( pVBInfo->LCDInfo & LCDNonExpanding ) )
- {
- if ( yres == 350 )
- yres = 357 ;
- else if ( yres == 400 )
- yres = 420 ;
- else if ( yres == 480 )
- yres = 525 ;
- }
- }
- }
- }
-
- if ( xres == 720 )
- xres = 640 ;
- }
-
- pVBInfo->VGAHDE = xres ;
- pVBInfo->HDE = xres ;
- pVBInfo->VGAVDE = yres ;
- pVBInfo->VDE = yres ;
+ }
+
+ 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;
+ }
+}
-/* --------------------------------------------------------------------- */
-/* Function : XGI_IsLCDDualLink */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-unsigned char XGI_IsLCDDualLink(struct vb_device_info *pVBInfo)
+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 & SetCRT2ToLCD ) | SetCRT2ToLCDA ) ) && ( pVBInfo->LCDInfo & SetLCDDualLink ) ) /* shampoo0129 */
- return ( 1 ) ;
+ if (pVBInfo->VBInfo & SetInSlaveMode)
+ return;
- return( 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);
}
+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 temp, colordepth, modeinfo, index, infoflag,
+ ColorDepth[] = { 0x01, 0x02, 0x04 };
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GetCRT2Data */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_GetCRT2Data(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo)
-{
- unsigned short tempax = 0,
- tempbx ,
- modeflag ,
- resinfo ;
-
- struct XGI_LCDDataStruct *LCDPtr = NULL ;
- struct XGI_TVDataStruct *TVPtr = NULL ;
-
- if ( ModeNo <= 0x13 )
- {
- modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */
- resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ;
- }
- else
- {
- modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */
- resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ;
- }
-
- pVBInfo->NewFlickerMode = 0 ;
- pVBInfo->RVBHRS = 50 ;
-
- if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC )
- {
- XGI_GetRAMDAC2DATA( ModeNo , ModeIdIndex , RefreshRateTableIndex,pVBInfo ) ;
- return ;
- }
-
- tempbx = 4 ;
-
- if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) )
- {
- LCDPtr = (struct XGI_LCDDataStruct *)XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
-
- pVBInfo->RVBHCMAX = LCDPtr->RVBHCMAX ;
- pVBInfo->RVBHCFACT = LCDPtr->RVBHCFACT ;
- pVBInfo->VGAHT = LCDPtr->VGAHT ;
- pVBInfo->VGAVT = LCDPtr->VGAVT ;
- pVBInfo->HT = LCDPtr->LCDHT ;
- pVBInfo->VT = LCDPtr->LCDVT ;
-
- if ( pVBInfo->LCDResInfo == Panel1024x768 )
- {
- tempax = 1024 ;
- tempbx = 768 ;
-
- if ( !( pVBInfo->LCDInfo & LCDVESATiming ) )
- {
- if ( pVBInfo->VGAVDE == 357 )
- tempbx = 527 ;
- else if ( pVBInfo->VGAVDE == 420 )
- tempbx = 620 ;
- else if ( pVBInfo->VGAVDE == 525 )
- tempbx = 775 ;
- else if ( pVBInfo->VGAVDE == 600 )
- tempbx = 775 ;
- /* else if(pVBInfo->VGAVDE==350) tempbx=560; */
- /* else if(pVBInfo->VGAVDE==400) tempbx=640; */
- else
- tempbx = 768 ;
- }
- else
- tempbx = 768 ;
- }
- else if ( pVBInfo->LCDResInfo == Panel1024x768x75 )
- {
- tempax = 1024 ;
- tempbx = 768 ;
- }
- else if ( pVBInfo->LCDResInfo == Panel1280x1024 )
- {
- tempax = 1280 ;
- if ( pVBInfo->VGAVDE == 360 )
- tempbx = 768 ;
- else if ( pVBInfo->VGAVDE == 375 )
- tempbx = 800 ;
- else if ( pVBInfo->VGAVDE == 405 )
- tempbx = 864 ;
- else
- tempbx = 1024 ;
- }
- else if ( pVBInfo->LCDResInfo == Panel1280x1024x75 )
- {
- tempax = 1280 ;
- tempbx = 1024 ;
- }
- else if ( pVBInfo->LCDResInfo == Panel1280x960 )
- {
- tempax = 1280 ;
- if ( pVBInfo->VGAVDE == 350 )
- tempbx = 700 ;
- else if ( pVBInfo->VGAVDE == 400 )
- tempbx = 800 ;
- else if ( pVBInfo->VGAVDE == 1024 )
- tempbx = 960 ;
- else
- tempbx = 960 ;
- }
- else if ( pVBInfo->LCDResInfo == Panel1400x1050 )
- {
- tempax = 1400 ;
- tempbx = 1050 ;
-
- if ( pVBInfo->VGAVDE == 1024 )
- {
- tempax = 1280 ;
- tempbx = 1024 ;
- }
- }
- else if ( pVBInfo->LCDResInfo == Panel1600x1200 )
- {
- tempax = 1600 ;
- tempbx = 1200 ; /* alan 10/14/2003 */
- if ( !( pVBInfo->LCDInfo & LCDVESATiming ) )
- {
- if ( pVBInfo->VGAVDE == 350 )
- tempbx = 875 ;
- else if ( pVBInfo->VGAVDE == 400 )
- tempbx = 1000 ;
- }
- }
-
- if ( pVBInfo->LCDInfo & LCDNonExpanding )
- {
- tempax = pVBInfo->VGAHDE ;
- tempbx = pVBInfo->VGAVDE ;
- }
-
- pVBInfo->HDE = tempax ;
- pVBInfo->VDE = tempbx ;
- return ;
- }
-
- if ( pVBInfo->VBInfo & ( SetCRT2ToTV ) )
- {
- tempbx = 4 ;
- TVPtr = (struct XGI_TVDataStruct *)XGI_GetTVPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
-
- pVBInfo->RVBHCMAX = TVPtr->RVBHCMAX ;
- pVBInfo->RVBHCFACT = TVPtr->RVBHCFACT ;
- pVBInfo->VGAHT = TVPtr->VGAHT ;
- pVBInfo->VGAVT = TVPtr->VGAVT ;
- pVBInfo->HDE = TVPtr->TVHDE ;
- pVBInfo->VDE = TVPtr->TVVDE ;
- pVBInfo->RVBHRS = TVPtr->RVBHRS ;
- pVBInfo->NewFlickerMode = TVPtr->FlickerMode ;
-
- if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV )
- {
- if ( resinfo == 0x08 )
- pVBInfo->NewFlickerMode = 0x40 ;
- else if ( resinfo == 0x09 )
- pVBInfo->NewFlickerMode = 0x40 ;
- else if ( resinfo == 0x12 )
- pVBInfo->NewFlickerMode = 0x40 ;
-
- if ( pVBInfo->VGAVDE == 350 )
- pVBInfo->TVInfo |= TVSimuMode ;
-
- tempax = ExtHiTVHT ;
- tempbx = ExtHiTVVT ;
-
- if ( pVBInfo->VBInfo & SetInSlaveMode )
- {
- if ( pVBInfo->TVInfo & TVSimuMode )
- {
- tempax = StHiTVHT ;
- tempbx = StHiTVVT ;
-
- if ( !( modeflag & Charx8Dot ) )
- {
- tempax = StHiTextTVHT ;
- tempbx = StHiTextTVVT ;
- }
- }
- }
- }
- else if ( pVBInfo->VBInfo & SetCRT2ToYPbPr )
- {
- if ( pVBInfo->TVInfo & SetYPbPrMode750p )
- {
- tempax = YPbPrTV750pHT ; /* Ext750pTVHT */
- tempbx = YPbPrTV750pVT ; /* Ext750pTVVT */
- }
-
- if ( pVBInfo->TVInfo & SetYPbPrMode525p )
- {
- tempax = YPbPrTV525pHT ; /* Ext525pTVHT */
- tempbx = YPbPrTV525pVT ; /* Ext525pTVVT */
- }
- else if ( pVBInfo->TVInfo & SetYPbPrMode525i )
- {
- tempax = YPbPrTV525iHT ; /* Ext525iTVHT */
- tempbx = YPbPrTV525iVT ; /* Ext525iTVVT */
- if ( pVBInfo->TVInfo & NTSC1024x768 )
- tempax = NTSC1024x768HT ;
- }
- }
- else
- {
- tempax = PALHT ;
- tempbx = PALVT ;
- if ( !( pVBInfo->TVInfo & SetPALTV ) )
- {
- tempax = NTSCHT ;
- tempbx = NTSCVT ;
- if ( pVBInfo->TVInfo & NTSC1024x768 )
- tempax = NTSC1024x768HT ;
- }
- }
-
- pVBInfo->HT = tempax ;
- pVBInfo->VT = tempbx ;
- return ;
- }
+ modeinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeInfo;
+ if (ModeNo <= 0x14)
+ infoflag = 0;
+ else
+ infoflag = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
+
+ index = (modeinfo >> 8) & 0xFF;
+
+ temp = pVBInfo->ScreenOffset[index];
+
+ if (infoflag & InterlaceMode)
+ temp = temp << 1;
+
+ colordepth = XGI_GetColorDepth(ModeNo, ModeIdIndex, pVBInfo);
+
+ if ((ModeNo >= 0x7C) && (ModeNo <= 0x7E)) {
+ temp = ModeNo - 0x7C;
+ colordepth = ColorDepth[temp];
+ temp = 0x6B;
+ if (infoflag & InterlaceMode)
+ temp = temp << 1;
+ return temp * colordepth;
+ } else {
+ return temp * colordepth;
+ }
}
+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 */
+}
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetCRT2VCLK */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_SetCRT2VCLK(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, 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)
{
- unsigned char di_0, di_1, tempal;
+ unsigned short tempcx = 0, CRT1Index = 0, resinfo = 0;
- tempal = XGI_GetVCLKPtr( RefreshRateTableIndex , ModeNo , ModeIdIndex, pVBInfo ) ;
- XGI_GetVCLKLen( tempal, &di_0 , &di_1, pVBInfo ) ;
- XGI_GetLCDVCLKPtr( &di_0 , &di_1, pVBInfo ) ;
+ if (ModeNo > 0x13) {
+ CRT1Index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
+ CRT1Index &= IndexMask;
+ resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ }
- 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 ) ;
- }
- else
- { /* 301b/302b/301lv/302lv */
- XGINew_SetReg1( pVBInfo->Part4Port , 0x0A , di_0 ) ;
- XGINew_SetReg1( pVBInfo->Part4Port , 0x0B , di_1 ) ;
- }
+ XGI_SetCRT2Offset(ModeNo, ModeIdIndex, RefreshRateTableIndex,
+ HwDeviceExtension, pVBInfo);
+ XGI_SetCRT2FIFO(pVBInfo);
+ /* XGI_SetCRT2Sync(ModeNo,RefreshRateTableIndex); */
- XGINew_SetReg1( pVBInfo->Part4Port , 0x00 , 0x12 ) ;
+ for (tempcx = 4; tempcx < 7; tempcx++)
+ XGINew_SetReg1(pVBInfo->Part1Port, tempcx, 0x0);
- if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC )
- XGINew_SetRegOR( pVBInfo->Part4Port , 0x12 , 0x28 ) ;
- else
- XGINew_SetRegOR( pVBInfo->Part4Port , 0x12 , 0x08 ) ;
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x50, 0x00);
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x02, 0x44); /* temp 0206 */
}
-
-/* --------------------------------------------------------------------- */
-/* 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)
+void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
+ struct xgi_hw_device_info *HwDeviceExtension,
+ unsigned short RefreshRateTableIndex,
+ struct vb_device_info *pVBInfo)
{
- unsigned short index ;
+ unsigned short temp = 0, tempax = 0, tempbx = 0, tempcx = 0,
+ pushbx = 0, CRT1Index = 0, modeflag, resinfo = 0;
- if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) )
- {
- if ( pVBInfo->IF_DEF_ScaleLCD == 1 )
- {
- if ( pVBInfo->LCDInfo & EnableScalingLCD )
- return ;
- }
+ if (ModeNo > 0x13) {
+ CRT1Index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
+ CRT1Index &= IndexMask;
+ resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ }
- /* index = XGI_GetLCDCapPtr(pVBInfo) ; */
- index = XGI_GetLCDCapPtr1( pVBInfo) ;
+ if (ModeNo <= 0x13)
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
+ else
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+
+ /* bainy change table name */
+ if (modeflag & HalfDCLK) {
+ temp = (pVBInfo->VGAHT / 2 - 1) & 0x0FF; /* BTVGA2HT 0x08,0x09 */
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x08, temp);
+ temp = (((pVBInfo->VGAHT / 2 - 1) & 0xFF00) >> 8) << 4;
+ XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x09, ~0x0F0, temp);
+ temp = (pVBInfo->VGAHDE / 2 + 16) & 0x0FF; /* BTVGA2HDEE 0x0A,0x0C */
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x0A, temp);
+ tempcx = ((pVBInfo->VGAHT - pVBInfo->VGAHDE) / 2) >> 2;
+ pushbx = pVBInfo->VGAHDE / 2 + 16;
+ tempcx = tempcx >> 1;
+ tempbx = pushbx + tempcx; /* bx BTVGA@HRS 0x0B,0x0C */
+ tempcx += tempbx;
+
+ if (pVBInfo->VBInfo & SetCRT2ToRAMDAC) {
+ tempbx = pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[4];
+ tempbx |= ((pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[14]
+ & 0xC0) << 2);
+ tempbx = (tempbx - 3) << 3; /* (VGAHRS-3)*8 */
+ tempcx = pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[5];
+ tempcx &= 0x1F;
+ temp = pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[15];
+ temp = (temp & 0x04) << (5 - 2); /* VGAHRE D[5] */
+ tempcx = ((tempcx | temp) - 3) << 3; /* (VGAHRE-3)*8 */
+ }
+
+ tempbx += 4;
+ tempcx += 4;
+
+ if (tempcx > (pVBInfo->VGAHT / 2))
+ tempcx = pVBInfo->VGAHT / 2;
+
+ temp = tempbx & 0x00FF;
+
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x0B, temp);
+ } else {
+ temp = (pVBInfo->VGAHT - 1) & 0x0FF; /* BTVGA2HT 0x08,0x09 */
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x08, temp);
+ temp = (((pVBInfo->VGAHT - 1) & 0xFF00) >> 8) << 4;
+ XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x09, ~0x0F0, temp);
+ temp = (pVBInfo->VGAHDE + 16) & 0x0FF; /* BTVGA2HDEE 0x0A,0x0C */
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x0A, temp);
+ tempcx = (pVBInfo->VGAHT - pVBInfo->VGAHDE) >> 2; /* cx */
+ pushbx = pVBInfo->VGAHDE + 16;
+ tempcx = tempcx >> 1;
+ tempbx = pushbx + tempcx; /* bx BTVGA@HRS 0x0B,0x0C */
+ tempcx += tempbx;
+
+ if (pVBInfo->VBInfo & SetCRT2ToRAMDAC) {
+ tempbx = pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[3];
+ tempbx |= ((pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[5]
+ & 0xC0) << 2);
+ tempbx = (tempbx - 3) << 3; /* (VGAHRS-3)*8 */
+ tempcx = pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[4];
+ tempcx &= 0x1F;
+ temp = pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[6];
+ temp = (temp & 0x04) << (5 - 2); /* VGAHRE D[5] */
+ tempcx = ((tempcx | temp) - 3) << 3; /* (VGAHRE-3)*8 */
+ tempbx += 16;
+ tempcx += 16;
+ }
+
+ if (tempcx > pVBInfo->VGAHT)
+ tempcx = pVBInfo->VGAHT;
+
+ temp = tempbx & 0x00FF;
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x0B, temp);
+ }
- 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 ;
-}
+ tempax = (tempax & 0x00FF) | (tempbx & 0xFF00);
+ tempbx = pushbx;
+ tempbx = (tempbx & 0x00FF) | ((tempbx & 0xFF00) << 4);
+ tempax |= (tempbx & 0xFF00);
+ temp = (tempax & 0xFF00) >> 8;
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x0C, temp);
+ temp = tempcx & 0x00FF;
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x0D, temp);
+ tempcx = (pVBInfo->VGAVT - 1);
+ temp = tempcx & 0x00FF;
+
+ if (pVBInfo->IF_DEF_CH7005 == 1) {
+ if (pVBInfo->VBInfo & 0x0C)
+ temp--;
+ }
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x0E, temp);
+ tempbx = pVBInfo->VGAVDE - 1;
+ temp = tempbx & 0x00FF;
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x0F, temp);
+ temp = ((tempbx & 0xFF00) << 3) >> 8;
+ temp |= ((tempcx & 0xFF00) >> 8);
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x12, temp);
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GetVCLKPtr */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-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)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 ;
-}
+ tempax = pVBInfo->VGAVDE;
+ tempbx = pVBInfo->VGAVDE;
+ tempcx = pVBInfo->VGAVT;
+ tempbx = (pVBInfo->VGAVT + pVBInfo->VGAVDE) >> 1; /* BTVGA2VRS 0x10,0x11 */
+ tempcx = ((pVBInfo->VGAVT - pVBInfo->VGAVDE) >> 4) + tempbx + 1; /* BTVGA2VRE 0x11 */
+ if (pVBInfo->VBInfo & SetCRT2ToRAMDAC) {
+ tempbx = pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[10];
+ temp = pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[9];
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GetVCLKLen */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-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 ;
- }
-}
+ if (temp & 0x04)
+ tempbx |= 0x0100;
+ if (temp & 0x080)
+ tempbx |= 0x0200;
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetCRT2Offset */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-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;
+ temp = pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[14];
- if ( pVBInfo->VBInfo & SetInSlaveMode )
- {
- return ;
- }
+ if (temp & 0x08)
+ tempbx |= 0x0400;
- 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);
-}
+ temp = pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[11];
+ tempcx = (tempcx & 0xFF00) | (temp & 0x00FF);
+ }
+ temp = tempbx & 0x00FF;
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x10, temp);
+ temp = ((tempbx & 0xFF00) >> 8) << 4;
+ temp = ((tempcx & 0x000F) | (temp));
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x11, temp);
+ tempax = 0;
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GetOffset */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-unsigned short XGI_GetOffset(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
+ if (modeflag & DoubleScanMode)
+ tempax |= 0x80;
+
+ if (modeflag & HalfDCLK)
+ tempax |= 0x40;
+
+ XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2C, ~0x0C0, tempax);
+}
+
+void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
+ struct xgi_hw_device_info *HwDeviceExtension,
+ unsigned short RefreshRateTableIndex,
+ struct vb_device_info *pVBInfo)
{
- unsigned short temp ,
- colordepth ,
- modeinfo ,
- index ,
- infoflag ,
- ColorDepth[] = { 0x01 , 0x02 , 0x04 } ;
+ unsigned short push1, push2, tempax, tempbx = 0, tempcx, temp, resinfo,
+ modeflag, CRT1Index;
- modeinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeInfo ;
- if ( ModeNo <= 0x14 )
- infoflag = 0 ;
- else
- infoflag = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ;
+ if (ModeNo <= 0x13) {
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */
+ resinfo = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo;
+ } else {
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */
+ resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ CRT1Index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
+ CRT1Index &= IndexMask;
+ }
+ if (!(pVBInfo->VBInfo & SetInSlaveMode))
+ return;
+
+ temp = 0xFF; /* set MAX HT */
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x03, temp);
+ /* if (modeflag & Charx8Dot) */
+ /* tempcx = 0x08; */
+ /* else */
+ tempcx = 0x08;
+
+ if (pVBInfo->VBType & (VB_XGI301LV | VB_XGI302LV | VB_XGI301C))
+ modeflag |= Charx8Dot;
+
+ tempax = pVBInfo->VGAHDE; /* 0x04 Horizontal Display End */
+
+ if (modeflag & HalfDCLK)
+ tempax = tempax >> 1;
+
+ tempax = (tempax / tempcx) - 1;
+ tempbx |= ((tempax & 0x00FF) << 8);
+ temp = tempax & 0x00FF;
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x04, temp);
+
+ temp = (tempbx & 0xFF00) >> 8;
+
+ if (pVBInfo->VBInfo & SetCRT2ToTV) {
+ if (!(pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C)))
+ temp += 2;
+
+ if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) {
+ if (pVBInfo->VBType & VB_XGI301LV) {
+ if (pVBInfo->VBExtInfo == VB_YPbPr1080i) {
+ if (resinfo == 7)
+ temp -= 2;
+ }
+ } else if (resinfo == 7) {
+ temp -= 2;
+ }
+ }
+ }
- index = ( modeinfo >> 8 ) & 0xFF ;
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x05, temp); /* 0x05 Horizontal Display Start */
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x06, 0x03); /* 0x06 Horizontal Blank end */
- temp = pVBInfo->ScreenOffset[ index ] ;
+ if (!(pVBInfo->VBInfo & DisableCRT2Display)) { /* 030226 bainy */
+ if (pVBInfo->VBInfo & SetCRT2ToTV)
+ tempax = pVBInfo->VGAHT;
+ else
+ tempax = XGI_GetVGAHT2(pVBInfo);
+ }
- if ( infoflag & InterlaceMode )
- {
- temp = temp << 1 ;
- }
+ if (tempax >= pVBInfo->VGAHT)
+ tempax = pVBInfo->VGAHT;
+
+ if (modeflag & HalfDCLK)
+ tempax = tempax >> 1;
+
+ tempax = (tempax / tempcx) - 5;
+ tempcx = tempax; /* 20030401 0x07 horizontal Retrace Start */
+ if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) {
+ temp = (tempbx & 0x00FF) - 1;
+ if (!(modeflag & HalfDCLK)) {
+ temp -= 6;
+ if (pVBInfo->TVInfo & TVSimuMode) {
+ temp -= 4;
+ if (ModeNo > 0x13)
+ temp -= 10;
+ }
+ }
+ } else {
+ /* tempcx = tempbx & 0x00FF ; */
+ tempbx = (tempbx & 0xFF00) >> 8;
+ tempcx = (tempcx + tempbx) >> 1;
+ temp = (tempcx & 0x00FF) + 2;
+
+ if (pVBInfo->VBInfo & SetCRT2ToTV) {
+ temp -= 1;
+ if (!(modeflag & HalfDCLK)) {
+ if ((modeflag & Charx8Dot)) {
+ temp += 4;
+ if (pVBInfo->VGAHDE >= 800)
+ temp -= 6;
+ }
+ }
+ } else {
+ if (!(modeflag & HalfDCLK)) {
+ temp -= 4;
+ if (pVBInfo->LCDResInfo != Panel1280x960) {
+ if (pVBInfo->VGAHDE >= 800) {
+ temp -= 7;
+ if (pVBInfo->ModeType
+ == ModeEGA) {
+ if (pVBInfo->VGAVDE
+ == 1024) {
+ temp += 15;
+ if (pVBInfo->LCDResInfo
+ != Panel1280x1024) {
+ temp
+ += 7;
+ }
+ }
+ }
+
+ if (pVBInfo->VGAHDE >= 1280) {
+ if (pVBInfo->LCDResInfo
+ != Panel1280x960) {
+ if (pVBInfo->LCDInfo
+ & LCDNonExpanding) {
+ temp
+ += 28;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
- colordepth = XGI_GetColorDepth( ModeNo , ModeIdIndex, pVBInfo ) ;
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x07, temp); /* 0x07 Horizontal Retrace Start */
+ XGINew_SetReg1(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);
+ }
+
+ if ((ModeNo == 0x00) || (ModeNo == 0x01)) {
+ if (pVBInfo->TVInfo & SetNTSCTV) {
+ XGINew_SetReg1(pVBInfo->Part1Port,
+ 0x07, 0x2A);
+ XGINew_SetReg1(pVBInfo->Part1Port,
+ 0x08, 0x61);
+ } else {
+ XGINew_SetReg1(pVBInfo->Part1Port,
+ 0x07, 0x2A);
+ XGINew_SetReg1(pVBInfo->Part1Port,
+ 0x08, 0x41);
+ XGINew_SetReg1(pVBInfo->Part1Port,
+ 0x0C, 0xF0);
+ }
+ }
+
+ if ((ModeNo == 0x02) || (ModeNo == 0x03) || (ModeNo
+ == 0x07)) {
+ if (pVBInfo->TVInfo & SetNTSCTV) {
+ XGINew_SetReg1(pVBInfo->Part1Port,
+ 0x07, 0x54);
+ XGINew_SetReg1(pVBInfo->Part1Port,
+ 0x08, 0x00);
+ } else {
+ XGINew_SetReg1(pVBInfo->Part1Port,
+ 0x07, 0x55);
+ XGINew_SetReg1(pVBInfo->Part1Port,
+ 0x08, 0x00);
+ XGINew_SetReg1(pVBInfo->Part1Port,
+ 0x0C, 0xF0);
+ }
+ }
+
+ if ((ModeNo == 0x04) || (ModeNo == 0x05) || (ModeNo
+ == 0x0D) || (ModeNo == 0x50)) {
+ if (pVBInfo->TVInfo & SetNTSCTV) {
+ XGINew_SetReg1(pVBInfo->Part1Port,
+ 0x07, 0x30);
+ XGINew_SetReg1(pVBInfo->Part1Port,
+ 0x08, 0x03);
+ } else {
+ XGINew_SetReg1(pVBInfo->Part1Port,
+ 0x07, 0x2f);
+ XGINew_SetReg1(pVBInfo->Part1Port,
+ 0x08, 0x02);
+ }
+ }
+ }
+ }
- if ( ( ModeNo >= 0x7C ) && ( ModeNo <= 0x7E ) )
- {
- temp = ModeNo - 0x7C ;
- colordepth = ColorDepth[ temp ] ;
- temp = 0x6B ;
- if ( infoflag & InterlaceMode )
- {
- temp = temp << 1 ;
+ 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 */
+
+ tempbx = pVBInfo->VGAVT;
+ push1 = tempbx;
+ tempcx = 0x121;
+ tempbx = pVBInfo->VGAVDE; /* 0x0E Virtical Display End */
+
+ if (tempbx == 357)
+ tempbx = 350;
+ if (tempbx == 360)
+ tempbx = 350;
+ if (tempbx == 375)
+ tempbx = 350;
+ if (tempbx == 405)
+ tempbx = 400;
+ if (tempbx == 525)
+ tempbx = 480;
+
+ push2 = tempbx;
+
+ if (pVBInfo->VBInfo & SetCRT2ToLCD) {
+ if (pVBInfo->LCDResInfo == Panel1024x768) {
+ if (!(pVBInfo->LCDInfo & LCDVESATiming)) {
+ if (tempbx == 350)
+ tempbx += 5;
+ if (tempbx == 480)
+ tempbx += 5;
+ }
+ }
}
- return( temp * colordepth ) ;
- }
- else
- return( temp * colordepth ) ;
-}
+ tempbx--;
+ temp = tempbx & 0x00FF;
+ tempbx--;
+ temp = tempbx & 0x00FF;
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x10, temp); /* 0x10 vertical Blank Start */
+ tempbx = push2;
+ tempbx--;
+ temp = tempbx & 0x00FF;
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x0E, temp);
+ if (tempbx & 0x0100)
+ tempcx |= 0x0002;
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetCRT2FIFO */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-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 */
-}
+ tempax = 0x000B;
+ if (modeflag & DoubleScanMode)
+ tempax |= 0x08000;
-/* --------------------------------------------------------------------- */
-/* Function : XGI_PreSetGroup1 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_PreSetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
- struct xgi_hw_device_info *HwDeviceExtension,
- unsigned short RefreshRateTableIndex,
- struct vb_device_info *pVBInfo)
-{
- unsigned short tempcx = 0 ,
- CRT1Index = 0 ,
- resinfo = 0 ;
+ if (tempbx & 0x0200)
+ tempcx |= 0x0040;
- if ( ModeNo > 0x13 )
- {
- CRT1Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ;
- CRT1Index &= IndexMask ;
- resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ;
- }
+ temp = (tempax & 0xFF00) >> 8;
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x0B, temp);
- XGI_SetCRT2Offset( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ;
- XGI_SetCRT2FIFO(pVBInfo) ;
- /* XGI_SetCRT2Sync(ModeNo,RefreshRateTableIndex); */
+ if (tempbx & 0x0400)
+ tempcx |= 0x0600;
- for( tempcx = 4 ; tempcx < 7 ; tempcx++ )
- {
- XGINew_SetReg1( pVBInfo->Part1Port , tempcx , 0x0 ) ;
- }
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x11, 0x00); /* 0x11 Vertival Blank End */
- XGINew_SetReg1( pVBInfo->Part1Port , 0x50 , 0x00 ) ;
- XGINew_SetReg1( pVBInfo->Part1Port , 0x02 , 0x44 ) ; /* temp 0206 */
-}
+ tempax = push1;
+ tempax -= tempbx; /* 0x0C Vertical Retrace Start */
+ tempax = tempax >> 2;
+ push1 = tempax; /* push ax */
+ if (resinfo != 0x09) {
+ tempax = tempax << 1;
+ tempbx += tempax;
+ }
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetGroup1 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
- struct xgi_hw_device_info *HwDeviceExtension,
- unsigned short RefreshRateTableIndex,
- struct vb_device_info *pVBInfo)
-{
- unsigned short temp = 0 ,
- tempax = 0 ,
- tempbx = 0 ,
- tempcx = 0 ,
- pushbx = 0 ,
- CRT1Index = 0 ,
- modeflag ,
- resinfo = 0 ;
-
- if ( ModeNo > 0x13 )
- {
- CRT1Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ;
- CRT1Index &= IndexMask ;
- resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ;
- }
-
- if ( ModeNo <= 0x13 )
- {
- modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ;
- }
- else
- {
- modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ;
- }
-
- /* bainy change table name */
- if ( modeflag & HalfDCLK )
- {
- temp = ( pVBInfo->VGAHT / 2 - 1 ) & 0x0FF ; /* BTVGA2HT 0x08,0x09 */
- XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , temp ) ;
- temp = ( ( ( pVBInfo->VGAHT / 2 - 1 ) & 0xFF00 ) >> 8 ) << 4 ;
- XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x09 , ~0x0F0 , temp ) ;
- temp = ( pVBInfo->VGAHDE / 2 + 16 ) & 0x0FF ; /* BTVGA2HDEE 0x0A,0x0C */
- XGINew_SetReg1( pVBInfo->Part1Port , 0x0A , temp ) ;
- tempcx = ( ( pVBInfo->VGAHT - pVBInfo->VGAHDE ) / 2 ) >> 2 ;
- pushbx = pVBInfo->VGAHDE / 2 + 16 ;
- tempcx = tempcx >> 1 ;
- tempbx = pushbx + tempcx ; /* bx BTVGA@HRS 0x0B,0x0C */
- tempcx += tempbx ;
-
- if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC )
- {
- tempbx = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 4 ] ;
- tempbx |= ( ( pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 14 ] & 0xC0 ) << 2 ) ;
- tempbx = ( tempbx - 3 ) << 3 ; /* (VGAHRS-3)*8 */
- tempcx = pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[ 5 ] ;
- tempcx &= 0x1F ;
- temp = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 15 ] ;
- temp = ( temp & 0x04 ) << ( 5 - 2 ) ; /* VGAHRE D[5] */
- tempcx = ( ( tempcx | temp ) - 3 ) << 3 ; /* (VGAHRE-3)*8 */
- }
-
- tempbx += 4 ;
- tempcx += 4 ;
-
- if ( tempcx > ( pVBInfo->VGAHT / 2 ) )
- tempcx = pVBInfo->VGAHT / 2 ;
-
- temp = tempbx & 0x00FF ;
-
- XGINew_SetReg1( pVBInfo->Part1Port , 0x0B , temp ) ;
- }
- else
- {
- temp = ( pVBInfo->VGAHT - 1 ) & 0x0FF ; /* BTVGA2HT 0x08,0x09 */
- XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , temp ) ;
- temp = ( ( ( pVBInfo->VGAHT - 1 ) & 0xFF00 ) >> 8 ) << 4 ;
- XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x09 , ~0x0F0 , temp ) ;
- temp = ( pVBInfo->VGAHDE + 16 ) & 0x0FF ; /* BTVGA2HDEE 0x0A,0x0C */
- XGINew_SetReg1( pVBInfo->Part1Port , 0x0A , temp ) ;
- tempcx = ( pVBInfo->VGAHT - pVBInfo->VGAHDE ) >> 2 ; /* cx */
- pushbx = pVBInfo->VGAHDE + 16 ;
- tempcx = tempcx >> 1 ;
- tempbx = pushbx + tempcx ; /* bx BTVGA@HRS 0x0B,0x0C */
- tempcx += tempbx ;
-
- if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC )
- {
- tempbx = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 3 ] ;
- tempbx |= ( ( pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 5 ] & 0xC0 ) << 2 ) ;
- tempbx = ( tempbx - 3 ) << 3 ; /* (VGAHRS-3)*8 */
- tempcx = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 4 ] ;
- tempcx &= 0x1F ;
- temp = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 6 ] ;
- temp = ( temp & 0x04 ) << ( 5 - 2 ) ; /* VGAHRE D[5] */
- tempcx = ( ( tempcx | temp ) - 3 ) << 3 ; /* (VGAHRE-3)*8 */
- tempbx += 16 ;
- tempcx += 16 ;
- }
-
- if ( tempcx > pVBInfo->VGAHT )
- tempcx = pVBInfo->VGAHT ;
-
- temp = tempbx & 0x00FF ;
- XGINew_SetReg1( pVBInfo->Part1Port , 0x0B , temp ) ;
- }
-
- tempax = ( tempax & 0x00FF ) | ( tempbx & 0xFF00 ) ;
- tempbx = pushbx ;
- tempbx = ( tempbx & 0x00FF ) | ( ( tempbx & 0xFF00 ) << 4 ) ;
- tempax |= ( tempbx & 0xFF00 ) ;
- temp = ( tempax & 0xFF00 ) >> 8 ;
- XGINew_SetReg1( pVBInfo->Part1Port , 0x0C , temp ) ;
- temp = tempcx & 0x00FF ;
- XGINew_SetReg1( pVBInfo->Part1Port , 0x0D , temp ) ;
- tempcx = ( pVBInfo->VGAVT - 1 ) ;
- temp = tempcx & 0x00FF ;
-
- if ( pVBInfo->IF_DEF_CH7005 == 1 )
- {
- if ( pVBInfo->VBInfo & 0x0C )
- {
- temp-- ;
- }
- }
-
- XGINew_SetReg1( pVBInfo->Part1Port , 0x0E , temp ) ;
- tempbx = pVBInfo->VGAVDE - 1 ;
- temp = tempbx & 0x00FF ;
- XGINew_SetReg1( pVBInfo->Part1Port , 0x0F , temp ) ;
- temp = ( ( tempbx & 0xFF00 ) << 3 ) >> 8 ;
- temp |= ( ( tempcx & 0xFF00 ) >> 8 ) ;
- XGINew_SetReg1( pVBInfo->Part1Port , 0x12 , temp ) ;
-
- tempax = pVBInfo->VGAVDE ;
- tempbx = pVBInfo->VGAVDE ;
- tempcx = pVBInfo->VGAVT ;
- tempbx = ( pVBInfo->VGAVT + pVBInfo->VGAVDE ) >> 1 ; /* BTVGA2VRS 0x10,0x11 */
- tempcx = ( ( pVBInfo->VGAVT - pVBInfo->VGAVDE ) >> 4 ) + tempbx + 1 ; /* BTVGA2VRE 0x11 */
-
- if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC )
- {
- tempbx = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 10 ] ;
- temp = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 9 ] ;
-
- if ( temp & 0x04 )
- tempbx |= 0x0100 ;
-
- if ( temp & 0x080 )
- tempbx |= 0x0200 ;
-
- temp = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 14 ] ;
-
- if ( temp & 0x08 )
- tempbx |= 0x0400 ;
-
- temp = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 11 ] ;
- tempcx = ( tempcx & 0xFF00 ) | ( temp & 0x00FF ) ;
- }
-
- temp = tempbx & 0x00FF ;
- XGINew_SetReg1( pVBInfo->Part1Port , 0x10 , temp ) ;
- temp = ( ( tempbx & 0xFF00 ) >> 8 ) << 4 ;
- temp = ( ( tempcx & 0x000F ) | ( temp ) ) ;
- XGINew_SetReg1( pVBInfo->Part1Port , 0x11 , temp ) ;
- tempax = 0 ;
-
- if ( modeflag & DoubleScanMode )
- tempax |= 0x80 ;
-
- if ( modeflag & HalfDCLK )
- tempax |= 0x40 ;
-
- XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2C , ~0x0C0 , tempax ) ;
-}
+ if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) {
+ if (pVBInfo->VBType & VB_XGI301LV) {
+ if (pVBInfo->TVInfo & SetYPbPrMode1080i) {
+ tempbx -= 10;
+ } else {
+ if (pVBInfo->TVInfo & TVSimuMode) {
+ if (pVBInfo->TVInfo & SetPALTV) {
+ if (pVBInfo->VBType
+ & VB_XGI301LV) {
+ if (!(pVBInfo->TVInfo
+ & (SetYPbPrMode525p
+ | SetYPbPrMode750p
+ | SetYPbPrMode1080i)))
+ tempbx += 40;
+ } else {
+ tempbx += 40;
+ }
+ }
+ }
+ }
+ } else {
+ tempbx -= 10;
+ }
+ } else {
+ if (pVBInfo->TVInfo & TVSimuMode) {
+ if (pVBInfo->TVInfo & SetPALTV) {
+ if (pVBInfo->VBType & VB_XGI301LV) {
+ if (!(pVBInfo->TVInfo
+ & (SetYPbPrMode525p
+ | SetYPbPrMode750p
+ | SetYPbPrMode1080i)))
+ tempbx += 40;
+ } else {
+ tempbx += 40;
+ }
+ }
+ }
+ }
+ tempax = push1;
+ tempax = tempax >> 2;
+ tempax++;
+ tempax += tempbx;
+ push1 = tempax; /* push ax */
+
+ if ((pVBInfo->TVInfo & SetPALTV)) {
+ if (tempbx <= 513) {
+ if (tempax >= 513)
+ tempbx = 513;
+ }
+ }
+ temp = tempbx & 0x00FF;
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x0C, temp);
+ tempbx--;
+ temp = tempbx & 0x00FF;
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x10, temp);
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetLockRegs */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
- struct xgi_hw_device_info *HwDeviceExtension,
- unsigned short RefreshRateTableIndex,
- struct vb_device_info *pVBInfo)
-{
- unsigned short push1 ,
- push2 ,
- tempax ,
- tempbx = 0 ,
- tempcx ,
- temp ,
- resinfo ,
- modeflag ,
- CRT1Index ;
-
- if ( ModeNo <= 0x13 )
- {
- modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */
- resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ;
- }
- else
- {
- modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */
- resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ;
- CRT1Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ;
- CRT1Index &= IndexMask;
- }
-
- if ( !( pVBInfo->VBInfo & SetInSlaveMode ) )
- {
- return ;
- }
-
- temp = 0xFF ; /* set MAX HT */
- XGINew_SetReg1( pVBInfo->Part1Port , 0x03 , temp ) ;
- /* if ( modeflag & Charx8Dot ) tempcx = 0x08 ; */
- /* else */
- tempcx=0x08;
-
- if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) )
- modeflag |= Charx8Dot ;
-
- tempax = pVBInfo->VGAHDE ; /* 0x04 Horizontal Display End */
-
- if ( modeflag & HalfDCLK )
- tempax = tempax >> 1 ;
-
- tempax = ( tempax / tempcx ) - 1 ;
- tempbx |= ( ( tempax & 0x00FF ) << 8 ) ;
- temp = tempax & 0x00FF ;
- XGINew_SetReg1( pVBInfo->Part1Port , 0x04 , temp ) ;
-
- temp = ( tempbx & 0xFF00 ) >> 8 ;
-
- if ( pVBInfo->VBInfo & SetCRT2ToTV )
- {
- if ( !( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) )
- temp += 2 ;
-
- if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV )
- {
- if ( pVBInfo->VBType & VB_XGI301LV )
- {
- if ( pVBInfo->VBExtInfo == VB_YPbPr1080i )
- {
- if ( resinfo == 7 )
- temp -= 2 ;
- }
- }
- else
- if ( resinfo == 7 )
- temp -= 2 ;
- }
- }
-
- XGINew_SetReg1( pVBInfo->Part1Port , 0x05 , temp ) ; /* 0x05 Horizontal Display Start */
- XGINew_SetReg1( pVBInfo->Part1Port , 0x06 , 0x03 ) ; /* 0x06 Horizontal Blank end */
-
- if ( !( pVBInfo->VBInfo & DisableCRT2Display ) )
- { /* 030226 bainy */
- if ( pVBInfo->VBInfo & SetCRT2ToTV )
- tempax = pVBInfo->VGAHT ;
- else
- tempax = XGI_GetVGAHT2( pVBInfo) ;
- }
-
- if ( tempax >= pVBInfo->VGAHT )
- {
- tempax = pVBInfo->VGAHT ;
- }
-
- if ( modeflag & HalfDCLK )
- {
- tempax = tempax >> 1 ;
- }
-
- tempax = ( tempax / tempcx ) - 5 ;
- tempcx = tempax ; /* 20030401 0x07 horizontal Retrace Start */
- if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV )
- {
- temp = ( tempbx & 0x00FF ) - 1 ;
- if ( !( modeflag & HalfDCLK ) )
- {
- temp -= 6 ;
- if ( pVBInfo->TVInfo & TVSimuMode )
- {
- temp -= 4 ;
- if ( ModeNo > 0x13 )
- temp -= 10 ;
- }
- }
- }
- else
- {
- /* tempcx = tempbx & 0x00FF ; */
- tempbx = ( tempbx & 0xFF00 ) >> 8 ;
- tempcx = ( tempcx + tempbx ) >> 1 ;
- temp = ( tempcx & 0x00FF ) + 2 ;
-
- if ( pVBInfo->VBInfo & SetCRT2ToTV )
- {
- temp -= 1 ;
- if ( !( modeflag & HalfDCLK ) )
- {
- if ( ( modeflag & Charx8Dot ) )
- {
- temp += 4 ;
- if ( pVBInfo->VGAHDE >= 800 )
- {
- temp -= 6 ;
- }
- }
- }
- }
- else
- {
- if ( !( modeflag & HalfDCLK ) )
- {
- temp -= 4 ;
- if ( pVBInfo->LCDResInfo != Panel1280x960 )
- {
- if( pVBInfo->VGAHDE >= 800 )
- {
- temp -= 7 ;
- if ( pVBInfo->ModeType == ModeEGA )
- {
- if ( pVBInfo->VGAVDE == 1024 )
- {
- temp += 15 ;
- if ( pVBInfo->LCDResInfo != Panel1280x1024 )
- {
- temp += 7 ;
- }
- }
- }
-
- if ( pVBInfo->VGAHDE >= 1280 )
- {
- if ( pVBInfo->LCDResInfo != Panel1280x960 )
- {
- if ( pVBInfo->LCDInfo & LCDNonExpanding )
- {
- temp += 28 ;
- }
- }
- }
- }
- }
- }
- }
- }
-
- XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , temp ) ; /* 0x07 Horizontal Retrace Start */
- XGINew_SetReg1( 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 ) ;
- }
-
- if ( ( ModeNo == 0x00 ) || ( ModeNo == 0x01 ) )
- {
- if ( pVBInfo->TVInfo & SetNTSCTV )
- {
- XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x2A ) ;
- XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x61 ) ;
- }
- else
- {
- XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x2A ) ;
- XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x41 ) ;
- XGINew_SetReg1( pVBInfo->Part1Port , 0x0C , 0xF0 ) ;
- }
- }
-
- if ( ( ModeNo == 0x02 ) || ( ModeNo == 0x03 ) || ( ModeNo == 0x07 ) )
- {
- if ( pVBInfo->TVInfo & SetNTSCTV )
- {
- XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x54 ) ;
- XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x00 ) ;
- }
- else
- {
- XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x55 ) ;
- XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x00 ) ;
- XGINew_SetReg1( pVBInfo->Part1Port , 0x0C , 0xF0 ) ;
- }
- }
-
- if ( ( ModeNo == 0x04 ) || ( ModeNo == 0x05 ) || ( ModeNo == 0x0D ) || ( ModeNo == 0x50 ) )
- {
- if ( pVBInfo->TVInfo & SetNTSCTV )
- {
- XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x30 ) ;
- XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x03 ) ;
- }
- else
- {
- XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x2f ) ;
- XGINew_SetReg1( 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 */
-
- tempbx = pVBInfo->VGAVT ;
- push1 = tempbx ;
- tempcx = 0x121 ;
- tempbx = pVBInfo->VGAVDE ; /* 0x0E Virtical Display End */
-
- if ( tempbx == 357 )
- tempbx = 350 ;
- if ( tempbx == 360 )
- tempbx =350 ;
- if ( tempbx == 375 )
- tempbx = 350 ;
- if ( tempbx == 405 )
- tempbx = 400 ;
- if ( tempbx == 525 )
- tempbx = 480 ;
-
- push2 = tempbx ;
-
- if ( pVBInfo->VBInfo & SetCRT2ToLCD )
- {
- if ( pVBInfo->LCDResInfo == Panel1024x768 )
- {
- if ( !( pVBInfo->LCDInfo & LCDVESATiming ) )
- {
- if ( tempbx == 350 )
- tempbx += 5 ;
- if ( tempbx == 480 )
- tempbx += 5 ;
- }
- }
- }
- tempbx-- ;
- temp = tempbx & 0x00FF ;
- tempbx-- ;
- temp = tempbx & 0x00FF ;
- XGINew_SetReg1( pVBInfo->Part1Port , 0x10 ,temp ) ; /* 0x10 vertical Blank Start */
- tempbx = push2 ;
- tempbx-- ;
- temp = tempbx & 0x00FF ;
- XGINew_SetReg1( pVBInfo->Part1Port , 0x0E , temp ) ;
-
- if ( tempbx & 0x0100 )
- {
- tempcx |= 0x0002 ;
- }
-
- tempax = 0x000B ;
-
- if ( modeflag & DoubleScanMode )
- {
- tempax |= 0x08000 ;
- }
-
- if ( tempbx & 0x0200 )
- {
- tempcx |= 0x0040 ;
- }
-
- temp = ( tempax & 0xFF00 ) >> 8 ;
- XGINew_SetReg1( pVBInfo->Part1Port , 0x0B , temp ) ;
-
- if ( tempbx & 0x0400 )
- {
- tempcx |= 0x0600 ;
- }
-
- XGINew_SetReg1( pVBInfo->Part1Port , 0x11 , 0x00 ) ; /* 0x11 Vertival Blank End */
-
- tempax = push1 ;
- tempax -= tempbx ; /* 0x0C Vertical Retrace Start */
- tempax = tempax >> 2 ;
- push1 = tempax ; /* push ax */
-
- if ( resinfo != 0x09 )
- {
- tempax = tempax << 1 ;
- tempbx += tempax ;
- }
-
- if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV )
- {
- if ( pVBInfo->VBType & VB_XGI301LV )
- {
- if ( pVBInfo->TVInfo & SetYPbPrMode1080i )
- tempbx -= 10 ;
- else
- {
- if ( pVBInfo->TVInfo & TVSimuMode )
- {
- if ( pVBInfo->TVInfo & SetPALTV )
- {
- if ( pVBInfo->VBType & VB_XGI301LV )
- {
- if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p | SetYPbPrMode1080i ) ) )
- tempbx += 40 ;
- }
- else
- tempbx += 40 ;
- }
- }
- }
- }
- else
- tempbx -= 10 ;
- }
- else
- {
- if ( pVBInfo->TVInfo & TVSimuMode )
- {
- if ( pVBInfo->TVInfo & SetPALTV )
- {
- if ( pVBInfo->VBType & VB_XGI301LV )
- {
- if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p | SetYPbPrMode1080i ) ) )
- tempbx += 40 ;
- }
- else
- tempbx += 40 ;
- }
- }
- }
- tempax = push1 ;
- tempax = tempax >> 2 ;
- tempax++ ;
- tempax += tempbx ;
- push1 = tempax ; /* push ax */
-
- if ( ( pVBInfo->TVInfo & SetPALTV ) )
- {
- if ( tempbx <= 513 )
- {
- if ( tempax >= 513 )
- {
- tempbx = 513 ;
- }
- }
- }
-
- temp = tempbx & 0x00FF ;
- XGINew_SetReg1( pVBInfo->Part1Port , 0x0C , temp ) ;
- tempbx-- ;
- temp = tempbx & 0x00FF ;
- XGINew_SetReg1( pVBInfo->Part1Port , 0x10 , temp ) ;
-
- if ( tempbx & 0x0100 )
- {
- tempcx |= 0x0008 ;
- }
-
- if ( tempbx & 0x0200 )
- {
- XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x0B , 0x0FF , 0x20 ) ;
- }
-
- tempbx++ ;
-
- if ( tempbx & 0x0100 )
- {
- tempcx |= 0x0004 ;
- }
-
- if ( tempbx & 0x0200 )
- {
- tempcx |= 0x0080 ;
- }
-
- if ( tempbx & 0x0400 )
- {
- tempcx |= 0x0C00 ;
- }
-
- tempbx = push1 ; /* pop ax */
- temp = tempbx & 0x00FF ;
- temp &= 0x0F ;
- XGINew_SetReg1( pVBInfo->Part1Port , 0x0D , temp ) ; /* 0x0D vertical Retrace End */
-
- if ( tempbx & 0x0010 )
- {
- tempcx |= 0x2000 ;
- }
-
- temp = tempcx & 0x00FF ;
- XGINew_SetReg1( pVBInfo->Part1Port , 0x0A , temp ) ; /* 0x0A CR07 */
- temp = ( tempcx & 0x0FF00 ) >> 8 ;
- XGINew_SetReg1( pVBInfo->Part1Port , 0x17 , temp ) ; /* 0x17 SR0A */
- tempax = modeflag ;
- temp = ( tempax & 0xFF00 ) >> 8 ;
-
- temp = ( temp >> 1 ) & 0x09 ;
-
- 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 */
-
- if ( pVBInfo->LCDInfo & LCDRGB18Bit )
- temp = 0x80 ;
- else
- temp = 0x00 ;
-
- XGINew_SetReg1( pVBInfo->Part1Port , 0x1A , temp ) ; /* 0x1A SR0E */
-
- return ;
+ if (tempbx & 0x0100)
+ tempcx |= 0x0008;
+
+ if (tempbx & 0x0200)
+ XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x0B, 0x0FF, 0x20);
+
+ tempbx++;
+
+ if (tempbx & 0x0100)
+ tempcx |= 0x0004;
+
+ if (tempbx & 0x0200)
+ tempcx |= 0x0080;
+
+ if (tempbx & 0x0400)
+ tempcx |= 0x0C00;
+
+ tempbx = push1; /* pop ax */
+ temp = tempbx & 0x00FF;
+ temp &= 0x0F;
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x0D, temp); /* 0x0D vertical Retrace End */
+
+ if (tempbx & 0x0010)
+ tempcx |= 0x2000;
+
+ temp = tempcx & 0x00FF;
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x0A, temp); /* 0x0A CR07 */
+ temp = (tempcx & 0x0FF00) >> 8;
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x17, temp); /* 0x17 SR0A */
+ tempax = modeflag;
+ temp = (tempax & 0xFF00) >> 8;
+
+ temp = (temp >> 1) & 0x09;
+
+ 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 */
+
+ if (pVBInfo->LCDInfo & LCDRGB18Bit)
+ temp = 0x80;
+ else
+ temp = 0x00;
+
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x1A, temp); /* 0x1A SR0E */
+
+ return;
}
+void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
+ unsigned short RefreshRateTableIndex,
+ struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short i, j, tempax, tempbx, tempcx, temp, push1, push2,
+ modeflag, resinfo, crt2crtc;
+ unsigned char *TimingPoint;
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetGroup2 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex,
- struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
-{
- unsigned short i ,
- j ,
- tempax ,
- tempbx ,
- tempcx ,
- temp ,
- push1 ,
- push2 ,
- modeflag ,
- resinfo ,
- crt2crtc ;
- unsigned char *TimingPoint ;
-
- unsigned long longtemp ,
- tempeax ,
- tempebx ,
- temp2 ,
- tempecx ;
-
- if ( ModeNo <= 0x13 )
- {
- modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */
- resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ;
- crt2crtc = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ;
- }
- else
- {
- modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */
- resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ;
- crt2crtc = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT2CRTC ;
- }
-
- tempax = 0 ;
-
- if ( !( pVBInfo->VBInfo & SetCRT2ToAVIDEO ) )
- tempax |= 0x0800 ;
-
- if ( !( pVBInfo->VBInfo & SetCRT2ToSVIDEO ) )
- tempax |= 0x0400 ;
-
- if ( pVBInfo->VBInfo & SetCRT2ToSCART )
- tempax |= 0x0200 ;
-
- if ( !( pVBInfo->TVInfo & SetPALTV ) )
- tempax |= 0x1000 ;
-
- if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV )
- tempax |= 0x0100 ;
-
- if ( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) )
- tempax &= 0xfe00 ;
-
- tempax = ( tempax & 0xff00 ) >> 8 ;
-
- XGINew_SetReg1( pVBInfo->Part2Port , 0x0 , tempax ) ;
- TimingPoint = pVBInfo->NTSCTiming ;
-
- if ( pVBInfo->TVInfo & SetPALTV )
- {
- TimingPoint = pVBInfo->PALTiming ;
- }
-
- if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV )
- {
- TimingPoint = pVBInfo->HiTVExtTiming ;
-
- if ( pVBInfo->VBInfo & SetInSlaveMode )
- TimingPoint = pVBInfo->HiTVSt2Timing ;
-
- if ( pVBInfo->SetFlag & TVSimuMode )
- TimingPoint = pVBInfo->HiTVSt1Timing ;
-
- if ( !(modeflag & Charx8Dot) )
- TimingPoint = pVBInfo->HiTVTextTiming ;
- }
-
- if ( pVBInfo->VBInfo & SetCRT2ToYPbPr )
- {
- if ( pVBInfo->TVInfo & SetYPbPrMode525i )
- TimingPoint = pVBInfo->YPbPr525iTiming ;
-
- if ( pVBInfo->TVInfo & SetYPbPrMode525p )
- TimingPoint = pVBInfo->YPbPr525pTiming ;
-
- if ( pVBInfo->TVInfo & SetYPbPrMode750p )
- TimingPoint = pVBInfo->YPbPr750pTiming ;
- }
-
- for( i = 0x01 , j = 0 ; i <= 0x2D ; i++ , j++ )
- {
- XGINew_SetReg1( pVBInfo->Part2Port , i , TimingPoint[ j ] ) ;
- }
-
- for( i = 0x39 ; i <= 0x45 ; i++ , j++ )
- {
- XGINew_SetReg1( pVBInfo->Part2Port , i , TimingPoint[ j ] ) ; /* di->temp2[j] */
- }
-
- if ( pVBInfo->VBInfo & SetCRT2ToTV )
- {
- XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x3A , 0x1F , 0x00 ) ;
- }
-
- temp = pVBInfo->NewFlickerMode ;
- temp &= 0x80 ;
- XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x0A , 0xFF , temp ) ;
-
- if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV )
- tempax = 950 ;
-
- if ( pVBInfo->TVInfo & SetPALTV )
- tempax = 520 ;
- else
- tempax = 440 ;
-
- if ( pVBInfo->VDE <= tempax )
- {
- tempax -= pVBInfo->VDE ;
- tempax = tempax >> 2 ;
- tempax = ( tempax & 0x00FF ) | ( ( tempax & 0x00FF ) << 8 ) ;
- push1 = tempax ;
- temp = ( tempax & 0xFF00 ) >> 8 ;
- temp += (unsigned short)TimingPoint[0];
-
- if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) )
- {
- if ( pVBInfo->VBInfo & ( SetCRT2ToAVIDEO | SetCRT2ToSVIDEO | SetCRT2ToSCART | SetCRT2ToYPbPr ) )
- {
- tempcx=pVBInfo->VGAHDE;
- if ( tempcx >= 1024 )
- {
- temp = 0x17 ; /* NTSC */
- if ( pVBInfo->TVInfo & SetPALTV )
- temp = 0x19 ; /* PAL */
- }
- }
- }
-
- XGINew_SetReg1( pVBInfo->Part2Port , 0x01 , temp ) ;
- tempax = push1 ;
- temp = ( tempax & 0xFF00 ) >> 8 ;
- temp += TimingPoint[ 1 ] ;
-
- if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) )
- {
- if ( ( pVBInfo->VBInfo & ( SetCRT2ToAVIDEO | SetCRT2ToSVIDEO | SetCRT2ToSCART | SetCRT2ToYPbPr ) ) )
- {
- tempcx = pVBInfo->VGAHDE ;
- if ( tempcx >= 1024 )
- {
- temp = 0x1D ; /* NTSC */
- if ( pVBInfo->TVInfo & SetPALTV )
- temp = 0x52 ; /* PAL */
- }
- }
- }
- XGINew_SetReg1( pVBInfo->Part2Port , 0x02 , temp ) ;
- }
-
- /* 301b */
- tempcx = pVBInfo->HT ;
-
- if ( XGI_IsLCDDualLink( pVBInfo ) )
- tempcx = tempcx >> 1 ;
-
- tempcx -= 2 ;
- temp = tempcx & 0x00FF ;
- XGINew_SetReg1( pVBInfo->Part2Port , 0x1B , temp ) ;
-
- temp = ( tempcx & 0xFF00 ) >> 8 ;
- XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x1D , ~0x0F , temp ) ;
-
- tempcx = pVBInfo->HT >> 1 ;
- push1 = tempcx ; /* push cx */
- tempcx += 7 ;
-
- if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV )
- {
- tempcx -= 4 ;
- }
-
- temp = tempcx & 0x00FF ;
- temp = temp << 4 ;
- XGINew_SetRegANDOR( 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 ) ;
- temp = ( tempbx & 0xFF00 ) >> 8 ;
- temp = temp << 4 ;
- XGINew_SetRegANDOR(pVBInfo->Part2Port,0x25,0x0F,temp);
-
- tempbx=push2;
- tempbx=tempbx+8;
- if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV )
- {
- tempbx=tempbx-4;
- tempcx=tempbx;
- }
-
- temp = ( tempbx & 0x00FF ) << 4 ;
- XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x29 , 0x0F , temp ) ;
-
- j += 2 ;
- tempcx += ( TimingPoint[ j ] | ( ( TimingPoint[ j + 1 ] ) << 8 ) ) ;
- temp = tempcx & 0x00FF ;
- XGINew_SetReg1( pVBInfo->Part2Port , 0x27 , temp ) ;
- temp = ( ( tempcx & 0xFF00 ) >> 8 ) << 4 ;
- XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x28 , 0x0F , temp ) ;
-
- tempcx += 8 ;
- if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV )
- {
- tempcx -= 4 ;
- }
-
- temp = tempcx & 0xFF ;
- temp = temp << 4 ;
- XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x2A , 0x0F , temp ) ;
-
- tempcx = push1 ; /* pop cx */
- j += 2 ;
- temp = TimingPoint[ j ] | ( ( TimingPoint[ j + 1 ] ) << 8 ) ;
- tempcx -= temp ;
- temp = tempcx & 0x00FF ;
- temp = temp << 4 ;
- XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x2D , 0x0F ,temp ) ;
-
- tempcx -= 11 ;
-
- if ( !( pVBInfo->VBInfo & SetCRT2ToTV ) )
- {
- tempax = XGI_GetVGAHT2( pVBInfo) ;
- tempcx = tempax - 1 ;
- }
- temp = tempcx & 0x00FF ;
- XGINew_SetReg1( pVBInfo->Part2Port , 0x2E , temp ) ;
-
- tempbx = pVBInfo->VDE ;
-
- if ( pVBInfo->VGAVDE == 360 )
- tempbx = 746 ;
- if ( pVBInfo->VGAVDE == 375 )
- tempbx = 746 ;
- if ( pVBInfo->VGAVDE == 405 )
- tempbx = 853 ;
-
- if ( pVBInfo->VBInfo & SetCRT2ToTV )
- {
- if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) )
- {
- if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) )
- tempbx = tempbx >> 1 ;
- }
- else
- tempbx = tempbx >> 1 ;
- }
-
- tempbx -= 2 ;
- temp = tempbx & 0x00FF ;
-
- if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV )
- {
- if ( pVBInfo->VBType & VB_XGI301LV )
- {
- if ( pVBInfo->TVInfo & SetYPbPrMode1080i )
- {
- if ( pVBInfo->VBInfo & SetInSlaveMode )
- {
- if ( ModeNo == 0x2f )
- temp += 1 ;
- }
- }
- }
- else
- {
- if ( pVBInfo->VBInfo & SetInSlaveMode )
- {
- if ( ModeNo == 0x2f )
- temp += 1 ;
- }
- }
- }
-
- XGINew_SetReg1( pVBInfo->Part2Port , 0x2F , temp ) ;
-
- temp = ( tempcx & 0xFF00 ) >> 8 ;
- temp |= ( ( tempbx & 0xFF00 ) >> 8 ) << 6 ;
-
- if ( !( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) )
- {
- if ( pVBInfo->VBType & VB_XGI301LV )
- {
- if ( pVBInfo->TVInfo & SetYPbPrMode1080i )
- {
- temp |= 0x10 ;
-
- if ( !( pVBInfo->VBInfo & SetCRT2ToSVIDEO ) )
- temp |= 0x20 ;
- }
- }
- else
- {
- temp |= 0x10 ;
- if ( !( pVBInfo->VBInfo & SetCRT2ToSVIDEO ) )
- temp |= 0x20 ;
- }
- }
-
- XGINew_SetReg1( pVBInfo->Part2Port , 0x30 , temp ) ;
-
- if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) /* TV gatingno */
- {
- tempbx = pVBInfo->VDE ;
- tempcx = tempbx - 2 ;
-
- if ( pVBInfo->VBInfo & SetCRT2ToTV )
- {
- if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) )
- tempbx = tempbx >> 1 ;
- }
-
- if ( pVBInfo->VBType & ( VB_XGI302LV | VB_XGI301C ) )
- {
- temp=0;
- if( tempcx & 0x0400 )
- temp |= 0x20 ;
-
- if ( tempbx & 0x0400 )
- temp |= 0x40 ;
-
- XGINew_SetReg1( pVBInfo->Part4Port , 0x10 , temp ) ;
- }
-
- temp = ( ( ( tempbx - 3 ) & 0x0300 ) >> 8 ) << 5 ;
- XGINew_SetReg1( pVBInfo->Part2Port , 0x46 , temp ) ;
- temp = ( tempbx - 3 ) & 0x00FF ;
- XGINew_SetReg1( pVBInfo->Part2Port , 0x47 , temp ) ;
- }
-
- tempbx = tempbx & 0x00FF ;
-
- if ( !( modeflag & HalfDCLK ) )
- {
- tempcx = pVBInfo->VGAHDE ;
- if ( tempcx >= pVBInfo->HDE )
- {
- tempbx |= 0x2000 ;
- tempax &= 0x00FF ;
- }
- }
-
- tempcx = 0x0101 ;
-
- if( pVBInfo->VBInfo & SetCRT2ToTV ) { /*301b*/
- if(pVBInfo->VGAHDE>=1024)
- {
- tempcx=0x1920;
- if(pVBInfo->VGAHDE>=1280)
- {
- tempcx=0x1420;
- tempbx=tempbx&0xDFFF;
- }
- }
- }
-
- if ( !( tempbx & 0x2000 ) )
- {
- if ( modeflag & HalfDCLK )
- {
- tempcx = ( tempcx & 0xFF00 ) | ( ( tempcx & 0x00FF ) << 1 ) ;
- }
-
- push1 = tempbx ;
- tempeax = pVBInfo->VGAHDE ;
- tempebx = ( tempcx & 0xFF00 ) >> 8 ;
- longtemp = tempeax * tempebx ;
- tempecx = tempcx & 0x00FF ;
- longtemp = longtemp / tempecx ;
+ unsigned long longtemp, tempeax, tempebx, temp2, tempecx;
- /* 301b */
- tempecx = 8 * 1024 ;
+ if (ModeNo <= 0x13) {
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */
+ resinfo = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo;
+ crt2crtc = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ } else {
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */
+ resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ crt2crtc
+ = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ }
+
+ tempax = 0;
- if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) )
- {
- tempecx = tempecx * 8 ;
- }
+ if (!(pVBInfo->VBInfo & SetCRT2ToAVIDEO))
+ tempax |= 0x0800;
- longtemp = longtemp * tempecx ;
- tempecx = pVBInfo->HDE ;
- temp2 = longtemp % tempecx ;
- tempeax = longtemp / tempecx ;
- if ( temp2 != 0 )
- {
- tempeax += 1 ;
- }
+ if (!(pVBInfo->VBInfo & SetCRT2ToSVIDEO))
+ tempax |= 0x0400;
- tempax = (unsigned short)tempeax;
+ if (pVBInfo->VBInfo & SetCRT2ToSCART)
+ tempax |= 0x0200;
+
+ if (!(pVBInfo->TVInfo & SetPALTV))
+ tempax |= 0x1000;
+
+ if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV)
+ tempax |= 0x0100;
+
+ if (pVBInfo->TVInfo & (SetYPbPrMode525p | SetYPbPrMode750p))
+ tempax &= 0xfe00;
+
+ tempax = (tempax & 0xff00) >> 8;
+
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x0, tempax);
+ TimingPoint = pVBInfo->NTSCTiming;
+
+ if (pVBInfo->TVInfo & SetPALTV)
+ TimingPoint = pVBInfo->PALTiming;
+
+ if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) {
+ TimingPoint = pVBInfo->HiTVExtTiming;
+
+ if (pVBInfo->VBInfo & SetInSlaveMode)
+ TimingPoint = pVBInfo->HiTVSt2Timing;
+
+ if (pVBInfo->SetFlag & TVSimuMode)
+ TimingPoint = pVBInfo->HiTVSt1Timing;
+
+ if (!(modeflag & Charx8Dot))
+ TimingPoint = pVBInfo->HiTVTextTiming;
+ }
+
+ if (pVBInfo->VBInfo & SetCRT2ToYPbPr) {
+ if (pVBInfo->TVInfo & SetYPbPrMode525i)
+ TimingPoint = pVBInfo->YPbPr525iTiming;
+
+ if (pVBInfo->TVInfo & SetYPbPrMode525p)
+ TimingPoint = pVBInfo->YPbPr525pTiming;
+
+ if (pVBInfo->TVInfo & SetYPbPrMode750p)
+ TimingPoint = pVBInfo->YPbPr750pTiming;
+ }
+
+ for (i = 0x01, j = 0; i <= 0x2D; i++, j++)
+ XGINew_SetReg1(pVBInfo->Part2Port, i, TimingPoint[j]);
+
+ for (i = 0x39; i <= 0x45; i++, j++)
+ XGINew_SetReg1(pVBInfo->Part2Port, i, TimingPoint[j]); /* di->temp2[j] */
+
+ if (pVBInfo->VBInfo & SetCRT2ToTV)
+ XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x3A, 0x1F, 0x00);
+
+ temp = pVBInfo->NewFlickerMode;
+ temp &= 0x80;
+ XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x0A, 0xFF, temp);
+
+ if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV)
+ tempax = 950;
+
+ if (pVBInfo->TVInfo & SetPALTV)
+ tempax = 520;
+ else
+ tempax = 440;
+
+ if (pVBInfo->VDE <= tempax) {
+ tempax -= pVBInfo->VDE;
+ tempax = tempax >> 2;
+ tempax = (tempax & 0x00FF) | ((tempax & 0x00FF) << 8);
+ push1 = tempax;
+ temp = (tempax & 0xFF00) >> 8;
+ temp += (unsigned short) TimingPoint[0];
+
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C)) {
+ if (pVBInfo->VBInfo & (SetCRT2ToAVIDEO
+ | SetCRT2ToSVIDEO | SetCRT2ToSCART
+ | SetCRT2ToYPbPr)) {
+ tempcx = pVBInfo->VGAHDE;
+ if (tempcx >= 1024) {
+ temp = 0x17; /* NTSC */
+ if (pVBInfo->TVInfo & SetPALTV)
+ temp = 0x19; /* PAL */
+ }
+ }
+ }
+
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x01, temp);
+ tempax = push1;
+ temp = (tempax & 0xFF00) >> 8;
+ temp += TimingPoint[1];
+
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C)) {
+ if ((pVBInfo->VBInfo & (SetCRT2ToAVIDEO
+ | SetCRT2ToSVIDEO | SetCRT2ToSCART
+ | SetCRT2ToYPbPr))) {
+ tempcx = pVBInfo->VGAHDE;
+ if (tempcx >= 1024) {
+ temp = 0x1D; /* NTSC */
+ if (pVBInfo->TVInfo & SetPALTV)
+ temp = 0x52; /* PAL */
+ }
+ }
+ }
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x02, temp);
+ }
/* 301b */
- if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) )
- {
- tempcx = ( ( tempax & 0xFF00 ) >> 5 ) >> 8 ;
- }
- /* end 301b */
-
- tempbx = push1 ;
- tempbx = (unsigned short)(((tempeax & 0x0000FF00) & 0x1F00) | (tempbx & 0x00FF));
- tempax = (unsigned short)(((tempeax & 0x000000FF) << 8) | (tempax & 0x00FF));
- temp = ( tempax & 0xFF00 ) >> 8 ;
- }
- else
- {
- temp = ( tempax & 0x00FF ) >> 8 ;
- }
-
- XGINew_SetReg1( pVBInfo->Part2Port , 0x44 , temp ) ;
- temp = ( tempbx & 0xFF00 ) >> 8 ;
- XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x45 , ~0x03F , temp ) ;
- temp = tempcx & 0x00FF ;
-
- if ( tempbx & 0x2000 )
- temp = 0 ;
-
- if ( !( pVBInfo->VBInfo & SetCRT2ToLCD ) )
- temp |= 0x18 ;
-
- XGINew_SetRegANDOR(pVBInfo->Part2Port,0x46,~0x1F,temp);
- if ( pVBInfo->TVInfo & SetPALTV )
- {
- tempbx = 0x0382 ;
- tempcx = 0x007e ;
- }
- else
- {
- tempbx = 0x0369 ;
- tempcx = 0x0061 ;
- }
-
- temp = tempbx & 0x00FF ;
- XGINew_SetReg1( pVBInfo->Part2Port , 0x4b , temp ) ;
- temp = tempcx & 0x00FF ;
- XGINew_SetReg1( pVBInfo->Part2Port , 0x4c , temp ) ;
-
- temp = ( ( tempcx & 0xFF00 ) >> 8 ) & 0x03 ;
- temp = temp << 2 ;
- temp |= ( ( tempbx & 0xFF00 ) >> 8 ) & 0x03 ;
-
- if ( pVBInfo->VBInfo & SetCRT2ToYPbPr )
- {
- temp |= 0x10 ;
-
- if ( pVBInfo->TVInfo & SetYPbPrMode525p )
- temp |= 0x20 ;
-
- if ( pVBInfo->TVInfo & SetYPbPrMode750p )
- 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 ) ) ;
-
- 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 , TimingPoint[ j ] ) ;
- }
- XGINew_SetReg1( 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 , 0x08 ) ; /* PALM Mode */
- }
-
- if ( pVBInfo->TVInfo & SetPALMTV )
- {
- tempax = (unsigned char)XGINew_GetReg1(pVBInfo->Part2Port, 0x01);
- tempax-- ;
- XGINew_SetRegAND( pVBInfo->Part2Port , 0x01 , tempax ) ;
-
- /* if ( !( pVBInfo->VBType & VB_XGI301C ) ) */
- XGINew_SetRegAND( pVBInfo->Part2Port , 0x00 , 0xEF ) ;
- }
-
- if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV )
- {
- if ( !( pVBInfo->VBInfo & SetInSlaveMode ) )
- {
- XGINew_SetReg1( pVBInfo->Part2Port , 0x0B , 0x00 ) ;
- }
- }
-
- if ( pVBInfo->VBInfo & SetCRT2ToTV )
- {
- return ;
- }
-}
+ tempcx = pVBInfo->HT;
+
+ if (XGI_IsLCDDualLink(pVBInfo))
+ tempcx = tempcx >> 1;
+
+ tempcx -= 2;
+ temp = tempcx & 0x00FF;
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x1B, temp);
+
+ temp = (tempcx & 0xFF00) >> 8;
+ XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x1D, ~0x0F, temp);
+
+ tempcx = pVBInfo->HT >> 1;
+ push1 = tempcx; /* push cx */
+ tempcx += 7;
+
+ if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV)
+ tempcx -= 4;
+
+ temp = tempcx & 0x00FF;
+ temp = temp << 4;
+ XGINew_SetRegANDOR(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);
+ temp = (tempbx & 0xFF00) >> 8;
+ temp = temp << 4;
+ XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x25, 0x0F, temp);
+
+ tempbx = push2;
+ tempbx = tempbx + 8;
+ if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) {
+ tempbx = tempbx - 4;
+ tempcx = tempbx;
+ }
+ temp = (tempbx & 0x00FF) << 4;
+ XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x29, 0x0F, temp);
+
+ j += 2;
+ tempcx += (TimingPoint[j] | ((TimingPoint[j + 1]) << 8));
+ temp = tempcx & 0x00FF;
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x27, temp);
+ temp = ((tempcx & 0xFF00) >> 8) << 4;
+ XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x28, 0x0F, temp);
+
+ tempcx += 8;
+ if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV)
+ tempcx -= 4;
+
+ temp = tempcx & 0xFF;
+ temp = temp << 4;
+ XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x2A, 0x0F, temp);
+
+ tempcx = push1; /* pop cx */
+ j += 2;
+ temp = TimingPoint[j] | ((TimingPoint[j + 1]) << 8);
+ tempcx -= temp;
+ temp = tempcx & 0x00FF;
+ temp = temp << 4;
+ XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x2D, 0x0F, temp);
+
+ tempcx -= 11;
+
+ if (!(pVBInfo->VBInfo & SetCRT2ToTV)) {
+ tempax = XGI_GetVGAHT2(pVBInfo);
+ tempcx = tempax - 1;
+ }
+ temp = tempcx & 0x00FF;
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x2E, temp);
+
+ tempbx = pVBInfo->VDE;
+
+ if (pVBInfo->VGAVDE == 360)
+ tempbx = 746;
+ if (pVBInfo->VGAVDE == 375)
+ tempbx = 746;
+ if (pVBInfo->VGAVDE == 405)
+ tempbx = 853;
+
+ if (pVBInfo->VBInfo & SetCRT2ToTV) {
+ if (pVBInfo->VBType & (VB_XGI301LV | VB_XGI302LV | VB_XGI301C)) {
+ if (!(pVBInfo->TVInfo & (SetYPbPrMode525p
+ | SetYPbPrMode750p)))
+ tempbx = tempbx >> 1;
+ } else
+ tempbx = tempbx >> 1;
+ }
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetLCDRegs */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo)
-{
- unsigned short push1 ,
- push2 ,
- pushbx ,
- tempax ,
- tempbx ,
- tempcx ,
- temp ,
- tempah ,
- tempbh ,
- tempch ,
- resinfo ,
- modeflag ,
- CRT1Index ;
-
- struct XGI_LCDDesStruct *LCDBDesPtr = NULL ;
-
-
- if ( ModeNo <= 0x13 )
- {
- modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */
- resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ;
- }
- else
- {
- modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */
- resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ;
- CRT1Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ;
- CRT1Index &= IndexMask ;
- }
-
- if ( !( pVBInfo->VBInfo & SetCRT2ToLCD ) )
- {
- return ;
- }
-
- tempbx = pVBInfo->HDE ; /* RHACTE=HDE-1 */
-
- if ( XGI_IsLCDDualLink( pVBInfo ) )
- tempbx = tempbx >> 1 ;
-
- tempbx -= 1 ;
- temp = tempbx & 0x00FF ;
- XGINew_SetReg1( pVBInfo->Part2Port , 0x2C , temp ) ;
- temp = ( tempbx & 0xFF00 ) >> 8 ;
- temp = temp << 4 ;
- XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x2B , 0x0F , temp ) ;
- temp = 0x01 ;
-
- if ( pVBInfo->LCDResInfo == Panel1280x1024 )
- {
- if ( pVBInfo->ModeType == ModeEGA )
- {
- if ( pVBInfo->VGAHDE >= 1024 )
- {
- temp = 0x02 ;
- if ( pVBInfo->LCDInfo & LCDVESATiming )
- temp = 0x01 ;
- }
- }
- }
-
- XGINew_SetReg1( pVBInfo->Part2Port , 0x0B , temp ) ;
- tempbx = pVBInfo->VDE ; /* RTVACTEO=(VDE-1)&0xFF */
- push1 = tempbx ;
- tempbx-- ;
- temp = tempbx & 0x00FF ;
- XGINew_SetReg1( pVBInfo->Part2Port , 0x03 , temp ) ;
- temp = ( ( tempbx & 0xFF00 ) >> 8 ) & 0x07 ;
- XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x0C , ~0x07 , temp ) ;
-
- tempcx = pVBInfo->VT - 1 ;
- push2 = tempcx + 1 ;
- temp = tempcx & 0x00FF ; /* RVTVT=VT-1 */
- XGINew_SetReg1( 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 ) ;
-
- /* Customized LCDB Des no add */
- tempbx = 5 ;
- LCDBDesPtr = (struct XGI_LCDDesStruct *)XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
- tempah = pVBInfo->LCDResInfo ;
- tempah &= PanelResInfo ;
-
- if ( ( tempah == Panel1024x768 ) || ( tempah == Panel1024x768x75 ) )
- {
- tempbx = 1024 ;
- tempcx = 768 ;
- }
- else if ( ( tempah == Panel1280x1024 ) || ( tempah == Panel1280x1024x75 ) )
- {
- tempbx = 1280 ;
- tempcx = 1024 ;
- }
- else if ( tempah == Panel1400x1050 )
- {
- tempbx = 1400 ;
- tempcx = 1050 ;
- }
- else
- {
- tempbx = 1600 ;
- tempcx = 1200 ;
- }
-
- if ( pVBInfo->LCDInfo & EnableScalingLCD )
- {
- tempbx = pVBInfo->HDE ;
- tempcx = pVBInfo->VDE ;
- }
-
- pushbx = tempbx ;
- tempax = pVBInfo->VT ;
- pVBInfo->LCDHDES = LCDBDesPtr->LCDHDES ;
- pVBInfo->LCDHRS = LCDBDesPtr->LCDHRS ;
- pVBInfo->LCDVDES = LCDBDesPtr->LCDVDES ;
- pVBInfo->LCDVRS = LCDBDesPtr->LCDVRS ;
- tempbx = pVBInfo->LCDVDES ;
- tempcx += tempbx ;
-
- if ( tempcx >= tempax )
- tempcx -= tempax ; /* lcdvdes */
-
- temp = tempbx & 0x00FF ; /* RVEQ1EQ=lcdvdes */
- XGINew_SetReg1( pVBInfo->Part2Port , 0x05 , temp ) ;
- temp = tempcx & 0x00FF ;
- XGINew_SetReg1( 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 ) ;
-
- /* getlcdsync() */
- XGI_GetLCDSync( &tempax , &tempbx,pVBInfo ) ;
- tempcx = tempbx ;
- tempax = pVBInfo->VT ;
- tempbx = pVBInfo->LCDVRS ;
-
- /* if ( SetLCD_Info & EnableScalingLCD ) */
- tempcx += tempbx ;
- if ( tempcx >= tempax )
- tempcx -= tempax ;
-
- temp = tempbx & 0x00FF ; /* RTVACTEE=lcdvrs */
- XGINew_SetReg1( pVBInfo->Part2Port , 0x04 , temp ) ;
- temp = ( tempbx & 0xFF00 ) >> 8 ;
- temp = temp << 4 ;
- temp |= ( tempcx & 0x000F ) ;
- XGINew_SetReg1( pVBInfo->Part2Port , 0x01 , temp ) ;
- tempcx = pushbx ;
- tempax = pVBInfo->HT ;
- tempbx = pVBInfo->LCDHDES ;
- tempbx &= 0x0FFF ;
-
- if ( XGI_IsLCDDualLink( pVBInfo ) )
- {
- tempax = tempax >> 1 ;
- tempbx = tempbx >> 1 ;
- tempcx = tempcx >> 1 ;
- }
-
- if ( pVBInfo->VBType & VB_XGI302LV )
- tempbx += 1 ;
-
- if ( pVBInfo->VBType & VB_XGI301C ) /* tap4 */
- tempbx += 1 ;
-
- tempcx += tempbx ;
-
- if ( tempcx >= tempax )
- tempcx -= tempax ;
-
- temp = tempbx & 0x00FF ;
- XGINew_SetReg1( pVBInfo->Part2Port , 0x1F , temp ) ; /* RHBLKE=lcdhdes */
- temp = ( ( tempbx & 0xFF00 ) >> 8 ) << 4 ;
- XGINew_SetReg1( pVBInfo->Part2Port , 0x20 , temp ) ;
- temp = tempcx & 0x00FF ;
- XGINew_SetReg1( pVBInfo->Part2Port , 0x23 , temp ) ; /* RHEQPLE=lcdhdee */
- temp = ( tempcx & 0xFF00 ) >> 8 ;
- XGINew_SetReg1( pVBInfo->Part2Port , 0x25 , temp ) ;
-
- /* getlcdsync() */
- XGI_GetLCDSync( &tempax , &tempbx ,pVBInfo) ;
- tempcx = tempax ;
- tempax = pVBInfo->HT ;
- tempbx = pVBInfo->LCDHRS ;
- /* if ( SetLCD_Info & EnableScalingLCD) */
- if ( XGI_IsLCDDualLink( pVBInfo) )
- {
- tempax = tempax >> 1 ;
- tempbx = tempbx >> 1 ;
- tempcx = tempcx >> 1 ;
- }
-
- if ( pVBInfo->VBType & VB_XGI302LV )
- tempbx += 1 ;
-
- tempcx += tempbx ;
-
- if ( tempcx >= tempax )
- tempcx -= tempax ;
-
- temp = tempbx & 0x00FF ; /* RHBURSTS=lcdhrs */
- XGINew_SetReg1( pVBInfo->Part2Port , 0x1C , temp ) ;
-
- temp = ( tempbx & 0xFF00 ) >> 8 ;
- temp = temp << 4 ;
- XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x1D , ~0x0F0 , temp ) ;
- temp = tempcx & 0x00FF ; /* RHSYEXP2S=lcdhre */
- XGINew_SetReg1( pVBInfo->Part2Port , 0x21 , temp ) ;
-
- if ( !( pVBInfo->LCDInfo & LCDVESATiming ) )
- {
- if ( pVBInfo->VGAVDE == 525 )
- {
- if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) )
- {
- temp = 0xC6 ;
- }
- else
- temp = 0xC4 ;
-
- XGINew_SetReg1( pVBInfo->Part2Port , 0x2f , temp ) ;
- XGINew_SetReg1( pVBInfo->Part2Port , 0x30 , 0xB3 ) ;
- }
-
- if ( pVBInfo->VGAVDE == 420 )
- {
- if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) )
- {
- temp = 0x4F ;
- }
- else
- temp = 0x4E ;
- XGINew_SetReg1( pVBInfo->Part2Port , 0x2f , temp ) ;
- }
- }
+ tempbx -= 2;
+ temp = tempbx & 0x00FF;
+
+ if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) {
+ if (pVBInfo->VBType & VB_XGI301LV) {
+ if (pVBInfo->TVInfo & SetYPbPrMode1080i) {
+ if (pVBInfo->VBInfo & SetInSlaveMode) {
+ if (ModeNo == 0x2f)
+ temp += 1;
+ }
+ }
+ } else {
+ if (pVBInfo->VBInfo & SetInSlaveMode) {
+ if (ModeNo == 0x2f)
+ temp += 1;
+ }
+ }
+ }
+
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x2F, temp);
+
+ temp = (tempcx & 0xFF00) >> 8;
+ temp |= ((tempbx & 0xFF00) >> 8) << 6;
+
+ if (!(pVBInfo->VBInfo & SetCRT2ToHiVisionTV)) {
+ if (pVBInfo->VBType & VB_XGI301LV) {
+ if (pVBInfo->TVInfo & SetYPbPrMode1080i) {
+ temp |= 0x10;
+
+ if (!(pVBInfo->VBInfo & SetCRT2ToSVIDEO))
+ temp |= 0x20;
+ }
+ } else {
+ temp |= 0x10;
+ if (!(pVBInfo->VBInfo & SetCRT2ToSVIDEO))
+ temp |= 0x20;
+ }
+ }
+
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x30, temp);
+
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C)) { /* TV gatingno */
+ tempbx = pVBInfo->VDE;
+ tempcx = tempbx - 2;
+
+ if (pVBInfo->VBInfo & SetCRT2ToTV) {
+ if (!(pVBInfo->TVInfo & (SetYPbPrMode525p
+ | SetYPbPrMode750p)))
+ tempbx = tempbx >> 1;
+ }
+
+ if (pVBInfo->VBType & (VB_XGI302LV | VB_XGI301C)) {
+ temp = 0;
+ if (tempcx & 0x0400)
+ temp |= 0x20;
+
+ if (tempbx & 0x0400)
+ temp |= 0x40;
+
+ XGINew_SetReg1(pVBInfo->Part4Port, 0x10, temp);
+ }
+
+ temp = (((tempbx - 3) & 0x0300) >> 8) << 5;
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x46, temp);
+ temp = (tempbx - 3) & 0x00FF;
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x47, temp);
+ }
+
+ tempbx = tempbx & 0x00FF;
+
+ if (!(modeflag & HalfDCLK)) {
+ tempcx = pVBInfo->VGAHDE;
+ if (tempcx >= pVBInfo->HDE) {
+ tempbx |= 0x2000;
+ tempax &= 0x00FF;
+ }
+ }
+
+ tempcx = 0x0101;
+
+ if (pVBInfo->VBInfo & SetCRT2ToTV) { /*301b*/
+ if (pVBInfo->VGAHDE >= 1024) {
+ tempcx = 0x1920;
+ if (pVBInfo->VGAHDE >= 1280) {
+ tempcx = 0x1420;
+ tempbx = tempbx & 0xDFFF;
+ }
+ }
+ }
+
+ if (!(tempbx & 0x2000)) {
+ if (modeflag & HalfDCLK)
+ tempcx = (tempcx & 0xFF00) | ((tempcx & 0x00FF) << 1);
+
+ push1 = tempbx;
+ tempeax = pVBInfo->VGAHDE;
+ tempebx = (tempcx & 0xFF00) >> 8;
+ longtemp = tempeax * tempebx;
+ tempecx = tempcx & 0x00FF;
+ longtemp = longtemp / tempecx;
+
+ /* 301b */
+ tempecx = 8 * 1024;
+
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C)) {
+ tempecx = tempecx * 8;
+ }
+
+ longtemp = longtemp * tempecx;
+ tempecx = pVBInfo->HDE;
+ temp2 = longtemp % tempecx;
+ tempeax = longtemp / tempecx;
+ if (temp2 != 0)
+ tempeax += 1;
+
+ tempax = (unsigned short) tempeax;
+
+ /* 301b */
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C)) {
+ tempcx = ((tempax & 0xFF00) >> 5) >> 8;
+ }
+ /* end 301b */
+
+ tempbx = push1;
+ tempbx = (unsigned short) (((tempeax & 0x0000FF00) & 0x1F00)
+ | (tempbx & 0x00FF));
+ tempax = (unsigned short) (((tempeax & 0x000000FF) << 8)
+ | (tempax & 0x00FF));
+ temp = (tempax & 0xFF00) >> 8;
+ } else {
+ temp = (tempax & 0x00FF) >> 8;
+ }
+
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x44, temp);
+ temp = (tempbx & 0xFF00) >> 8;
+ XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x45, ~0x03F, temp);
+ temp = tempcx & 0x00FF;
+
+ if (tempbx & 0x2000)
+ temp = 0;
+
+ if (!(pVBInfo->VBInfo & SetCRT2ToLCD))
+ temp |= 0x18;
+
+ XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x46, ~0x1F, temp);
+ if (pVBInfo->TVInfo & SetPALTV) {
+ tempbx = 0x0382;
+ tempcx = 0x007e;
+ } else {
+ tempbx = 0x0369;
+ tempcx = 0x0061;
+ }
+
+ temp = tempbx & 0x00FF;
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x4b, temp);
+ temp = tempcx & 0x00FF;
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x4c, temp);
+
+ temp = ((tempcx & 0xFF00) >> 8) & 0x03;
+ temp = temp << 2;
+ temp |= ((tempbx & 0xFF00) >> 8) & 0x03;
+
+ if (pVBInfo->VBInfo & SetCRT2ToYPbPr) {
+ temp |= 0x10;
+
+ if (pVBInfo->TVInfo & SetYPbPrMode525p)
+ temp |= 0x20;
+
+ if (pVBInfo->TVInfo & SetYPbPrMode750p)
+ 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));
+
+ 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,
+ TimingPoint[j]);
+ }
+ XGINew_SetReg1(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,
+ 0x08); /* PALM Mode */
+ }
+
+ if (pVBInfo->TVInfo & SetPALMTV) {
+ tempax = (unsigned char) XGINew_GetReg1(pVBInfo->Part2Port,
+ 0x01);
+ tempax--;
+ XGINew_SetRegAND(pVBInfo->Part2Port, 0x01, tempax);
+
+ /* if ( !( pVBInfo->VBType & VB_XGI301C ) ) */
+ XGINew_SetRegAND(pVBInfo->Part2Port, 0x00, 0xEF);
+ }
+
+ if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) {
+ if (!(pVBInfo->VBInfo & SetInSlaveMode))
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x0B, 0x00);
+ }
+
+ if (pVBInfo->VBInfo & SetCRT2ToTV)
+ return;
}
+void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
+ struct xgi_hw_device_info *HwDeviceExtension,
+ unsigned short RefreshRateTableIndex,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short push1, push2, pushbx, tempax, tempbx, tempcx, temp,
+ tempah, tempbh, tempch, resinfo, modeflag, CRT1Index;
+
+ struct XGI_LCDDesStruct *LCDBDesPtr = NULL;
+
+ if (ModeNo <= 0x13) {
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */
+ resinfo = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo;
+ } else {
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */
+ resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ CRT1Index
+ = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
+ CRT1Index &= IndexMask;
+ }
+
+ if (!(pVBInfo->VBInfo & SetCRT2ToLCD))
+ return;
+
+ tempbx = pVBInfo->HDE; /* RHACTE=HDE-1 */
+
+ if (XGI_IsLCDDualLink(pVBInfo))
+ tempbx = tempbx >> 1;
+
+ tempbx -= 1;
+ temp = tempbx & 0x00FF;
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x2C, temp);
+ temp = (tempbx & 0xFF00) >> 8;
+ temp = temp << 4;
+ XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x2B, 0x0F, temp);
+ temp = 0x01;
+
+ if (pVBInfo->LCDResInfo == Panel1280x1024) {
+ if (pVBInfo->ModeType == ModeEGA) {
+ if (pVBInfo->VGAHDE >= 1024) {
+ temp = 0x02;
+ if (pVBInfo->LCDInfo & LCDVESATiming)
+ temp = 0x01;
+ }
+ }
+ }
+
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x0B, temp);
+ tempbx = pVBInfo->VDE; /* RTVACTEO=(VDE-1)&0xFF */
+ push1 = tempbx;
+ tempbx--;
+ temp = tempbx & 0x00FF;
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x03, temp);
+ temp = ((tempbx & 0xFF00) >> 8) & 0x07;
+ XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x0C, ~0x07, temp);
+
+ tempcx = pVBInfo->VT - 1;
+ push2 = tempcx + 1;
+ temp = tempcx & 0x00FF; /* RVTVT=VT-1 */
+ XGINew_SetReg1(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);
+
+ /* Customized LCDB Des no add */
+ tempbx = 5;
+ LCDBDesPtr = (struct XGI_LCDDesStruct *) XGI_GetLcdPtr(tempbx, ModeNo,
+ ModeIdIndex, RefreshRateTableIndex, pVBInfo);
+ tempah = pVBInfo->LCDResInfo;
+ tempah &= PanelResInfo;
+
+ if ((tempah == Panel1024x768) || (tempah == Panel1024x768x75)) {
+ tempbx = 1024;
+ tempcx = 768;
+ } else if ((tempah == Panel1280x1024) || (tempah == Panel1280x1024x75)) {
+ tempbx = 1280;
+ tempcx = 1024;
+ } else if (tempah == Panel1400x1050) {
+ tempbx = 1400;
+ tempcx = 1050;
+ } else {
+ tempbx = 1600;
+ tempcx = 1200;
+ }
+
+ if (pVBInfo->LCDInfo & EnableScalingLCD) {
+ tempbx = pVBInfo->HDE;
+ tempcx = pVBInfo->VDE;
+ }
+
+ pushbx = tempbx;
+ tempax = pVBInfo->VT;
+ pVBInfo->LCDHDES = LCDBDesPtr->LCDHDES;
+ pVBInfo->LCDHRS = LCDBDesPtr->LCDHRS;
+ pVBInfo->LCDVDES = LCDBDesPtr->LCDVDES;
+ pVBInfo->LCDVRS = LCDBDesPtr->LCDVRS;
+ tempbx = pVBInfo->LCDVDES;
+ tempcx += tempbx;
+
+ if (tempcx >= tempax)
+ tempcx -= tempax; /* lcdvdes */
+
+ temp = tempbx & 0x00FF; /* RVEQ1EQ=lcdvdes */
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x05, temp);
+ temp = tempcx & 0x00FF;
+ XGINew_SetReg1(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);
+
+ /* getlcdsync() */
+ XGI_GetLCDSync(&tempax, &tempbx, pVBInfo);
+ tempcx = tempbx;
+ tempax = pVBInfo->VT;
+ tempbx = pVBInfo->LCDVRS;
+
+ /* if (SetLCD_Info & EnableScalingLCD) */
+ tempcx += tempbx;
+ if (tempcx >= tempax)
+ tempcx -= tempax;
+
+ temp = tempbx & 0x00FF; /* RTVACTEE=lcdvrs */
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x04, temp);
+ temp = (tempbx & 0xFF00) >> 8;
+ temp = temp << 4;
+ temp |= (tempcx & 0x000F);
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x01, temp);
+ tempcx = pushbx;
+ tempax = pVBInfo->HT;
+ tempbx = pVBInfo->LCDHDES;
+ tempbx &= 0x0FFF;
+
+ if (XGI_IsLCDDualLink(pVBInfo)) {
+ tempax = tempax >> 1;
+ tempbx = tempbx >> 1;
+ tempcx = tempcx >> 1;
+ }
+
+ if (pVBInfo->VBType & VB_XGI302LV)
+ tempbx += 1;
+
+ if (pVBInfo->VBType & VB_XGI301C) /* tap4 */
+ tempbx += 1;
+
+ tempcx += tempbx;
+
+ if (tempcx >= tempax)
+ tempcx -= tempax;
+
+ temp = tempbx & 0x00FF;
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x1F, temp); /* RHBLKE=lcdhdes */
+ temp = ((tempbx & 0xFF00) >> 8) << 4;
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x20, temp);
+ temp = tempcx & 0x00FF;
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x23, temp); /* RHEQPLE=lcdhdee */
+ temp = (tempcx & 0xFF00) >> 8;
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x25, temp);
+
+ /* getlcdsync() */
+ XGI_GetLCDSync(&tempax, &tempbx, pVBInfo);
+ tempcx = tempax;
+ tempax = pVBInfo->HT;
+ tempbx = pVBInfo->LCDHRS;
+ /* if ( SetLCD_Info & EnableScalingLCD) */
+ if (XGI_IsLCDDualLink(pVBInfo)) {
+ tempax = tempax >> 1;
+ tempbx = tempbx >> 1;
+ tempcx = tempcx >> 1;
+ }
+
+ if (pVBInfo->VBType & VB_XGI302LV)
+ tempbx += 1;
+
+ tempcx += tempbx;
+
+ if (tempcx >= tempax)
+ tempcx -= tempax;
+
+ temp = tempbx & 0x00FF; /* RHBURSTS=lcdhrs */
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x1C, temp);
+
+ temp = (tempbx & 0xFF00) >> 8;
+ temp = temp << 4;
+ XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x1D, ~0x0F0, temp);
+ temp = tempcx & 0x00FF; /* RHSYEXP2S=lcdhre */
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x21, temp);
+
+ if (!(pVBInfo->LCDInfo & LCDVESATiming)) {
+ if (pVBInfo->VGAVDE == 525) {
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B
+ | VB_XGI301LV | VB_XGI302LV
+ | VB_XGI301C)) {
+ temp = 0xC6;
+ } else
+ temp = 0xC4;
+
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x2f, temp);
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x30, 0xB3);
+ }
+
+ if (pVBInfo->VGAVDE == 420) {
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B
+ | VB_XGI301LV | VB_XGI302LV
+ | VB_XGI301C)) {
+ temp = 0x4F;
+ } else
+ temp = 0x4E;
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x2f, temp);
+ }
+ }
+}
/* --------------------------------------------------------------------- */
/* Function : XGI_GetTap4Ptr */
@@ -6668,1134 +5677,973 @@ void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex, struct x
/* Description : */
/* --------------------------------------------------------------------- */
struct XGI301C_Tap4TimingStruct *XGI_GetTap4Ptr(unsigned short tempcx,
- struct vb_device_info *pVBInfo)
-{
- unsigned short tempax ,
- tempbx ,
- i ;
-
- struct XGI301C_Tap4TimingStruct *Tap4TimingPtr ;
-
- if ( tempcx == 0 )
- {
- tempax = pVBInfo->VGAHDE ;
- tempbx = pVBInfo->HDE ;
- }
- else
- {
- tempax = pVBInfo->VGAVDE ;
- tempbx = pVBInfo->VDE ;
- }
-
- if ( tempax < tempbx )
- return &EnlargeTap4Timing[ 0 ] ;
- else if( tempax == tempbx )
- return &NoScaleTap4Timing[ 0 ] ; /* 1:1 */
- else
- Tap4TimingPtr = NTSCTap4Timing ; /* NTSC */
-
- if ( pVBInfo->TVInfo & SetPALTV )
- Tap4TimingPtr = PALTap4Timing ;
-
-
- if ( pVBInfo->VBInfo & SetCRT2ToYPbPr )
- {
- if ( pVBInfo->TVInfo & SetYPbPrMode525i )
- Tap4TimingPtr = YPbPr525iTap4Timing ;
- if ( pVBInfo->TVInfo & SetYPbPrMode525p )
- Tap4TimingPtr = YPbPr525pTap4Timing ;
- if ( pVBInfo->TVInfo & SetYPbPrMode750p )
- Tap4TimingPtr = YPbPr750pTap4Timing ;
- }
-
- if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV )
- Tap4TimingPtr = HiTVTap4Timing ;
-
- i = 0 ;
- while( Tap4TimingPtr[ i ].DE != 0xFFFF )
- {
- if ( Tap4TimingPtr[ i ].DE == tempax )
- break ;
- i++ ;
- }
- return &Tap4TimingPtr[ i ] ;
-}
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short tempax, tempbx, i;
+ struct XGI301C_Tap4TimingStruct *Tap4TimingPtr;
+
+ if (tempcx == 0) {
+ tempax = pVBInfo->VGAHDE;
+ tempbx = pVBInfo->HDE;
+ } else {
+ tempax = pVBInfo->VGAVDE;
+ tempbx = pVBInfo->VDE;
+ }
+
+ if (tempax < tempbx)
+ return &EnlargeTap4Timing[0];
+ else if (tempax == tempbx)
+ return &NoScaleTap4Timing[0]; /* 1:1 */
+ else
+ Tap4TimingPtr = NTSCTap4Timing; /* NTSC */
+
+ if (pVBInfo->TVInfo & SetPALTV)
+ Tap4TimingPtr = PALTap4Timing;
+
+ if (pVBInfo->VBInfo & SetCRT2ToYPbPr) {
+ if (pVBInfo->TVInfo & SetYPbPrMode525i)
+ Tap4TimingPtr = YPbPr525iTap4Timing;
+ if (pVBInfo->TVInfo & SetYPbPrMode525p)
+ Tap4TimingPtr = YPbPr525pTap4Timing;
+ if (pVBInfo->TVInfo & SetYPbPrMode750p)
+ Tap4TimingPtr = YPbPr750pTap4Timing;
+ }
+
+ if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV)
+ Tap4TimingPtr = HiTVTap4Timing;
+
+ i = 0;
+ while (Tap4TimingPtr[i].DE != 0xFFFF) {
+ if (Tap4TimingPtr[i].DE == tempax)
+ break;
+ i++;
+ }
+ return &Tap4TimingPtr[i];
+}
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetTap4Regs */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
void XGI_SetTap4Regs(struct vb_device_info *pVBInfo)
{
- unsigned short i ,
- j ;
+ unsigned short i, j;
- struct XGI301C_Tap4TimingStruct *Tap4TimingPtr ;
+ struct XGI301C_Tap4TimingStruct *Tap4TimingPtr;
- if ( !( pVBInfo->VBType & VB_XGI301C ) )
- return ;
+ if (!(pVBInfo->VBType & VB_XGI301C))
+ return;
#ifndef Tap4
- XGINew_SetRegAND( pVBInfo->Part2Port , 0x4E , 0xEB ) ; /* Disable Tap4 */
+ XGINew_SetRegAND(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 ] ) ;
-
- 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 ] ) ;
- }
-
- if ( ( pVBInfo->VBInfo & SetCRT2ToTV ) && ( !( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) ) )
- XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x4E , ~0x14 , 0x04 ) ; /* Enable V.Scaling */
- else
- XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x4E , ~0x14 , 0x10 ) ; /* Enable H.Scaling */
+ 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]);
+
+ 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]);
+ }
+
+ if ((pVBInfo->VBInfo & SetCRT2ToTV) && (!(pVBInfo->VBInfo & SetCRT2ToHiVisionTV)))
+ XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x4E, ~0x14, 0x04); /* Enable V.Scaling */
+ else
+ XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x4E, ~0x14, 0x10); /* Enable H.Scaling */
#endif
}
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetGroup3 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_SetGroup3(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo)
-{
- unsigned short i;
- unsigned char *tempdi;
- unsigned short modeflag;
-
- if(ModeNo<=0x13)
- {
- modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */
- }
- else
- {
- modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */
- }
-
-
- XGINew_SetReg1(pVBInfo->Part3Port,0x00,0x00);
- if(pVBInfo->TVInfo&SetPALTV)
- {
- XGINew_SetReg1(pVBInfo->Part3Port,0x13,0xFA);
- XGINew_SetReg1(pVBInfo->Part3Port,0x14,0xC8);
- }
- else
- {
- XGINew_SetReg1(pVBInfo->Part3Port,0x13,0xF5);
- XGINew_SetReg1(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);
- }
-
- if((pVBInfo->VBInfo&SetCRT2ToHiVisionTV)|| (pVBInfo->VBInfo&SetCRT2ToYPbPr))
- {
- if(pVBInfo->TVInfo & SetYPbPrMode525i)
- {
- return;
- }
- tempdi=pVBInfo->HiTVGroup3Data;
- if(pVBInfo->SetFlag&TVSimuMode)
- {
- tempdi=pVBInfo->HiTVGroup3Simu;
- if(!(modeflag&Charx8Dot))
- {
- tempdi=pVBInfo->HiTVGroup3Text;
- }
- }
-
- if(pVBInfo->TVInfo & SetYPbPrMode525p)
- {
- tempdi=pVBInfo->Ren525pGroup3;
- }
- if(pVBInfo->TVInfo & SetYPbPrMode750p)
- {
- tempdi=pVBInfo->Ren750pGroup3;
- }
-
- for(i=0;i<=0x3E;i++)
- {
- XGINew_SetReg1(pVBInfo->Part3Port,i,tempdi[i]);
- }
- if(pVBInfo->VBType&VB_XGI301C) /* Marcovision */
- {
- if(pVBInfo->TVInfo & SetYPbPrMode525p)
- {
- XGINew_SetReg1(pVBInfo->Part3Port,0x28,0x3f);
- }
- }
- }
- return;
-} /* {end of XGI_SetGroup3} */
+void XGI_SetGroup3(unsigned short ModeNo, unsigned short ModeIdIndex,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short i;
+ unsigned char *tempdi;
+ unsigned short modeflag;
+ if (ModeNo <= 0x13)
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */
+ else
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */
+
+ XGINew_SetReg1(pVBInfo->Part3Port, 0x00, 0x00);
+ if (pVBInfo->TVInfo & SetPALTV) {
+ XGINew_SetReg1(pVBInfo->Part3Port, 0x13, 0xFA);
+ XGINew_SetReg1(pVBInfo->Part3Port, 0x14, 0xC8);
+ } else {
+ XGINew_SetReg1(pVBInfo->Part3Port, 0x13, 0xF5);
+ XGINew_SetReg1(pVBInfo->Part3Port, 0x14, 0xB7);
+ }
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetGroup4 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
-{
- unsigned short tempax ,
- tempcx ,
- tempbx ,
- modeflag ,
- temp ,
- temp2 ;
-
- unsigned long tempebx ,
- tempeax ,
- templong ;
-
-
- if ( ModeNo <= 0x13 )
- {
- modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */
- }
- else
- {
- modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */
- }
-
- temp = pVBInfo->RVBHCFACT ;
- XGINew_SetReg1( pVBInfo->Part4Port , 0x13 , temp ) ;
-
- tempbx = pVBInfo->RVBHCMAX ;
- temp = tempbx & 0x00FF ;
- XGINew_SetReg1( pVBInfo->Part4Port , 0x14 , temp ) ;
- temp2 = ( ( tempbx & 0xFF00 ) >> 8 ) << 7 ;
- tempcx = pVBInfo->VGAHT - 1 ;
- temp = tempcx & 0x00FF ;
- XGINew_SetReg1( pVBInfo->Part4Port , 0x16 , temp ) ;
-
- temp =( ( tempcx & 0xFF00 ) >> 8 ) << 3 ;
- temp2 |= temp ;
-
- tempcx = pVBInfo->VGAVT - 1 ;
- if ( !( pVBInfo->VBInfo & SetCRT2ToTV ) )
- {
- tempcx -= 5 ;
- }
-
- temp = tempcx & 0x00FF ;
- XGINew_SetReg1( pVBInfo->Part4Port , 0x17 , temp ) ;
- temp = temp2 | ( ( tempcx & 0xFF00 ) >> 8 ) ;
- XGINew_SetReg1( pVBInfo->Part4Port , 0x15 , temp ) ;
- XGINew_SetRegOR( pVBInfo->Part4Port , 0x0D , 0x08 ) ;
- tempcx = pVBInfo->VBInfo ;
- tempbx = pVBInfo->VGAHDE ;
-
- if ( modeflag & HalfDCLK )
- {
- tempbx = tempbx >> 1 ;
- }
-
- if ( XGI_IsLCDDualLink( pVBInfo ) )
- tempbx = tempbx >> 1 ;
-
- if(tempcx&SetCRT2ToHiVisionTV)
- {
- temp=0;
- if(tempbx<=1024)
- temp=0xA0;
- if(tempbx == 1280)
- temp = 0xC0;
- }
- else if(tempcx&SetCRT2ToTV)
- {
- temp=0xA0;
- if(tempbx <= 800)
- temp=0x80;
- }
- else
- {
- temp=0x80;
- if(pVBInfo->VBInfo&SetCRT2ToLCD)
- {
- temp=0;
- if(tempbx>800)
- temp=0x60;
- }
- }
-
- if ( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) )
- {
- temp = 0x00 ;
- if ( pVBInfo->VGAHDE == 1280 )
- temp = 0x40 ;
- if ( pVBInfo->VGAHDE == 1024 )
- temp = 0x20 ;
- }
- XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x0E , ~0xEF , temp ) ;
-
- tempebx = pVBInfo->VDE ;
-
- if ( tempcx & SetCRT2ToHiVisionTV )
- {
- if ( !( temp & 0xE000 ) )
- tempbx = tempbx >> 1 ;
- }
-
- tempcx = pVBInfo->RVBHRS ;
- temp = tempcx & 0x00FF ;
- XGINew_SetReg1( pVBInfo->Part4Port , 0x18 , temp );
-
- tempeax = pVBInfo->VGAVDE ;
- tempcx |= 0x04000 ;
-
-
- if ( tempeax <= tempebx )
- {
- tempcx=(tempcx&(~0x4000));
- tempeax = pVBInfo->VGAVDE ;
- }
- else
- {
- tempeax -= tempebx ;
- }
-
-
- templong = ( tempeax * 256 * 1024 ) % tempebx ;
- tempeax = ( tempeax * 256 * 1024 ) / tempebx ;
- tempebx = tempeax ;
-
- if ( templong != 0 )
- {
- tempebx++ ;
- }
-
-
- temp = (unsigned short)(tempebx & 0x000000FF);
- XGINew_SetReg1( pVBInfo->Part4Port , 0x1B , temp ) ;
-
- temp = (unsigned short)((tempebx & 0x0000FF00) >> 8);
- XGINew_SetReg1( 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 ) ;
-
- /* 301b */
- if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) )
- {
- temp = 0x0028 ;
- XGINew_SetReg1( pVBInfo->Part4Port , 0x1C , temp ) ;
- tempax = pVBInfo->VGAHDE ;
- if ( modeflag & HalfDCLK )
- {
- tempax = tempax >> 1 ;
- }
-
- if ( XGI_IsLCDDualLink( pVBInfo ) )
- tempax = tempax >> 1 ;
-
- /* if((pVBInfo->VBInfo&(SetCRT2ToLCD))||((pVBInfo->TVInfo&SetYPbPrMode525p)||(pVBInfo->TVInfo&SetYPbPrMode750p))) { */
- if ( pVBInfo->VBInfo & SetCRT2ToLCD )
- {
- if ( tempax > 800 )
- tempax -= 800 ;
- }
- else
- {
- if ( pVBInfo->VGAHDE > 800 )
- {
- if ( pVBInfo->VGAHDE == 1024 )
- tempax = ( tempax * 25 / 32 ) - 1 ;
- else
- tempax = ( tempax * 20 / 32 ) - 1 ;
- }
- }
- tempax -= 1 ;
+ if (!(pVBInfo->VBInfo & SetCRT2ToTV))
+ return;
-/*
- if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToHiVisionTV ) )
- {
- if ( pVBInfo->VBType & VB_XGI301LV )
- {
- if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p | SetYPbPrMode1080i ) ) )
- {
- if ( pVBInfo->VGAHDE > 800 )
- {
- if ( pVBInfo->VGAHDE == 1024 )
- tempax = ( tempax * 25 / 32 ) - 1 ;
- else
- tempax = ( tempax * 20 / 32 ) - 1 ;
- }
- }
- }
- else
- {
- if ( pVBInfo->VGAHDE > 800 )
- {
- if ( pVBInfo->VGAHDE == 1024 )
- tempax = ( tempax * 25 / 32 ) - 1 ;
- else
- tempax = ( tempax * 20 / 32 ) - 1 ;
- }
- }
- }
-*/
+ if (pVBInfo->TVInfo & SetPALMTV) {
+ XGINew_SetReg1(pVBInfo->Part3Port, 0x13, 0xFA);
+ XGINew_SetReg1(pVBInfo->Part3Port, 0x14, 0xC8);
+ XGINew_SetReg1(pVBInfo->Part3Port, 0x3D, 0xA8);
+ }
- temp = ( tempax & 0xFF00 ) >> 8 ;
- temp = ( ( temp & 0x0003 ) << 4 ) ;
- XGINew_SetReg1( pVBInfo->Part4Port , 0x1E , temp ) ;
- temp = ( tempax & 0x00FF ) ;
- XGINew_SetReg1( pVBInfo->Part4Port , 0x1D , temp ) ;
-
- if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToHiVisionTV ) )
- {
- if ( pVBInfo->VGAHDE > 800 )
- {
- XGINew_SetRegOR( pVBInfo->Part4Port , 0x1E , 0x08 ) ;
- }
- }
- temp = 0x0036 ;
-
- if ( pVBInfo->VBInfo & SetCRT2ToTV )
- {
- if ( !( pVBInfo->TVInfo & ( NTSC1024x768 | SetYPbPrMode525p | SetYPbPrMode750p | SetYPbPrMode1080i ) ) )
- {
- temp |= 0x0001 ;
- if ( ( pVBInfo->VBInfo & SetInSlaveMode ) && ( !( pVBInfo->TVInfo & TVSimuMode ) ) )
- temp &= ( ~0x0001 ) ;
- }
- }
-
- XGINew_SetRegANDOR( 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 ) ;
- temp = tempbx & 0x00FF ;
- XGINew_SetReg1( pVBInfo->Part4Port , 0x22 , temp ) ;
- }
- /* end 301b */
-
- if ( pVBInfo->ISXPDOS == 0 )
- XGI_SetCRT2VCLK( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ;
-}
+ if ((pVBInfo->VBInfo & SetCRT2ToHiVisionTV) || (pVBInfo->VBInfo
+ & SetCRT2ToYPbPr)) {
+ if (pVBInfo->TVInfo & SetYPbPrMode525i)
+ return;
+ tempdi = pVBInfo->HiTVGroup3Data;
+ if (pVBInfo->SetFlag & TVSimuMode) {
+ tempdi = pVBInfo->HiTVGroup3Simu;
+ if (!(modeflag & Charx8Dot))
+ tempdi = pVBInfo->HiTVGroup3Text;
+ }
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetGroup5 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_SetGroup5(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo)
+ if (pVBInfo->TVInfo & SetYPbPrMode525p)
+ tempdi = pVBInfo->Ren525pGroup3;
+
+ if (pVBInfo->TVInfo & SetYPbPrMode750p)
+ tempdi = pVBInfo->Ren750pGroup3;
+
+ for (i = 0; i <= 0x3E; i++)
+ XGINew_SetReg1(pVBInfo->Part3Port, i, tempdi[i]);
+
+ if (pVBInfo->VBType & VB_XGI301C) { /* Marcovision */
+ if (pVBInfo->TVInfo & SetYPbPrMode525p)
+ XGINew_SetReg1(pVBInfo->Part3Port, 0x28, 0x3f);
+ }
+ }
+ return;
+} /* {end of XGI_SetGroup3} */
+
+void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex,
+ unsigned short RefreshRateTableIndex,
+ struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
{
- unsigned short Pindex ,
- Pdata ;
+ unsigned short tempax, tempcx, tempbx, modeflag, temp, temp2;
+
+ unsigned long tempebx, tempeax, templong;
+
+ if (ModeNo <= 0x13)
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */
+ else
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */
+
+ temp = pVBInfo->RVBHCFACT;
+ XGINew_SetReg1(pVBInfo->Part4Port, 0x13, temp);
+
+ tempbx = pVBInfo->RVBHCMAX;
+ temp = tempbx & 0x00FF;
+ XGINew_SetReg1(pVBInfo->Part4Port, 0x14, temp);
+ temp2 = ((tempbx & 0xFF00) >> 8) << 7;
+ tempcx = pVBInfo->VGAHT - 1;
+ temp = tempcx & 0x00FF;
+ XGINew_SetReg1(pVBInfo->Part4Port, 0x16, temp);
+
+ temp = ((tempcx & 0xFF00) >> 8) << 3;
+ temp2 |= temp;
+
+ tempcx = pVBInfo->VGAVT - 1;
+ if (!(pVBInfo->VBInfo & SetCRT2ToTV))
+ tempcx -= 5;
+
+ temp = tempcx & 0x00FF;
+ XGINew_SetReg1(pVBInfo->Part4Port, 0x17, temp);
+ temp = temp2 | ((tempcx & 0xFF00) >> 8);
+ XGINew_SetReg1(pVBInfo->Part4Port, 0x15, temp);
+ XGINew_SetRegOR(pVBInfo->Part4Port, 0x0D, 0x08);
+ tempcx = pVBInfo->VBInfo;
+ tempbx = pVBInfo->VGAHDE;
+
+ if (modeflag & HalfDCLK)
+ tempbx = tempbx >> 1;
+
+ if (XGI_IsLCDDualLink(pVBInfo))
+ tempbx = tempbx >> 1;
+
+ if (tempcx & SetCRT2ToHiVisionTV) {
+ temp = 0;
+ if (tempbx <= 1024)
+ temp = 0xA0;
+ if (tempbx == 1280)
+ temp = 0xC0;
+ } else if (tempcx & SetCRT2ToTV) {
+ temp = 0xA0;
+ if (tempbx <= 800)
+ temp = 0x80;
+ } else {
+ temp = 0x80;
+ if (pVBInfo->VBInfo & SetCRT2ToLCD) {
+ temp = 0;
+ if (tempbx > 800)
+ temp = 0x60;
+ }
+ }
+
+ if (pVBInfo->TVInfo & (SetYPbPrMode525p | SetYPbPrMode750p)) {
+ temp = 0x00;
+ if (pVBInfo->VGAHDE == 1280)
+ temp = 0x40;
+ if (pVBInfo->VGAHDE == 1024)
+ temp = 0x20;
+ }
+ XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x0E, ~0xEF, temp);
+
+ tempebx = pVBInfo->VDE;
- Pindex = pVBInfo->Part5Port ;
- Pdata = pVBInfo->Part5Port + 1 ;
- if ( pVBInfo->ModeType == ModeVGA )
- {
- if ( !( pVBInfo->VBInfo & ( SetInSlaveMode | LoadDACFlag | CRT2DisplayFlag ) ) )
- {
- XGINew_EnableCRT2(pVBInfo) ;
- /* LoadDAC2(pVBInfo->Part5Port,ModeNo,ModeIdIndex); */
- }
- }
- return ;
+ if (tempcx & SetCRT2ToHiVisionTV) {
+ if (!(temp & 0xE000))
+ tempbx = tempbx >> 1;
+ }
+
+ tempcx = pVBInfo->RVBHRS;
+ temp = tempcx & 0x00FF;
+ XGINew_SetReg1(pVBInfo->Part4Port, 0x18, temp);
+
+ tempeax = pVBInfo->VGAVDE;
+ tempcx |= 0x04000;
+
+ if (tempeax <= tempebx) {
+ tempcx = (tempcx & (~0x4000));
+ tempeax = pVBInfo->VGAVDE;
+ } else {
+ tempeax -= tempebx;
+ }
+
+ templong = (tempeax * 256 * 1024) % tempebx;
+ tempeax = (tempeax * 256 * 1024) / tempebx;
+ tempebx = tempeax;
+
+ if (templong != 0)
+ tempebx++;
+
+ temp = (unsigned short) (tempebx & 0x000000FF);
+ XGINew_SetReg1(pVBInfo->Part4Port, 0x1B, temp);
+
+ temp = (unsigned short) ((tempebx & 0x0000FF00) >> 8);
+ XGINew_SetReg1(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);
+
+ /* 301b */
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C)) {
+ temp = 0x0028;
+ XGINew_SetReg1(pVBInfo->Part4Port, 0x1C, temp);
+ tempax = pVBInfo->VGAHDE;
+ if (modeflag & HalfDCLK)
+ tempax = tempax >> 1;
+
+ if (XGI_IsLCDDualLink(pVBInfo))
+ tempax = tempax >> 1;
+
+ /* if((pVBInfo->VBInfo&(SetCRT2ToLCD))||((pVBInfo->TVInfo&SetYPbPrMode525p)||(pVBInfo->TVInfo&SetYPbPrMode750p))) { */
+ if (pVBInfo->VBInfo & SetCRT2ToLCD) {
+ if (tempax > 800)
+ tempax -= 800;
+ } else {
+ if (pVBInfo->VGAHDE > 800) {
+ if (pVBInfo->VGAHDE == 1024)
+ tempax = (tempax * 25 / 32) - 1;
+ else
+ tempax = (tempax * 20 / 32) - 1;
+ }
+ }
+ tempax -= 1;
+
+ /*
+ if (pVBInfo->VBInfo & (SetCRT2ToTV | SetCRT2ToHiVisionTV)) {
+ if (pVBInfo->VBType & VB_XGI301LV) {
+ if (!(pVBInfo->TVInfo & (SetYPbPrMode525p | SetYPbPrMode750p | SetYPbPrMode1080i))) {
+ if (pVBInfo->VGAHDE > 800) {
+ if (pVBInfo->VGAHDE == 1024)
+ tempax = (tempax * 25 / 32) - 1;
+ else
+ tempax = (tempax * 20 / 32) - 1;
+ }
+ }
+ } else {
+ if (pVBInfo->VGAHDE > 800) {
+ if (pVBInfo->VGAHDE == 1024)
+ tempax = (tempax * 25 / 32) - 1;
+ else
+ tempax = (tempax * 20 / 32) - 1;
+ }
+ }
+ }
+ */
+
+ temp = (tempax & 0xFF00) >> 8;
+ temp = ((temp & 0x0003) << 4);
+ XGINew_SetReg1(pVBInfo->Part4Port, 0x1E, temp);
+ temp = (tempax & 0x00FF);
+ XGINew_SetReg1(pVBInfo->Part4Port, 0x1D, temp);
+
+ if (pVBInfo->VBInfo & (SetCRT2ToTV | SetCRT2ToHiVisionTV)) {
+ if (pVBInfo->VGAHDE > 800)
+ XGINew_SetRegOR(pVBInfo->Part4Port, 0x1E, 0x08);
+
+ }
+ temp = 0x0036;
+
+ if (pVBInfo->VBInfo & SetCRT2ToTV) {
+ if (!(pVBInfo->TVInfo & (NTSC1024x768
+ | SetYPbPrMode525p | SetYPbPrMode750p
+ | SetYPbPrMode1080i))) {
+ temp |= 0x0001;
+ if ((pVBInfo->VBInfo & SetInSlaveMode)
+ && (!(pVBInfo->TVInfo
+ & TVSimuMode)))
+ temp &= (~0x0001);
+ }
+ }
+
+ XGINew_SetRegANDOR(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);
+ temp = tempbx & 0x00FF;
+ XGINew_SetReg1(pVBInfo->Part4Port, 0x22, temp);
+ }
+ /* end 301b */
+
+ if (pVBInfo->ISXPDOS == 0)
+ XGI_SetCRT2VCLK(ModeNo, ModeIdIndex, RefreshRateTableIndex,
+ pVBInfo);
}
+void XGI_SetGroup5(unsigned short ModeNo, unsigned short ModeIdIndex,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short Pindex, Pdata;
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GetLcdPtr */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-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 = 0 ;
-
-
- 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 = 0 ;
- break ;
- default:
- break ;
- }
-
- if ( tempdi == 0x00 ) /* OEMUtil */
- return 0 ;
-
- 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 0 ;
+ Pindex = pVBInfo->Part5Port;
+ Pdata = pVBInfo->Part5Port + 1;
+ if (pVBInfo->ModeType == ModeVGA) {
+ if (!(pVBInfo->VBInfo & (SetInSlaveMode | LoadDACFlag
+ | CRT2DisplayFlag))) {
+ XGINew_EnableCRT2(pVBInfo);
+ /* LoadDAC2(pVBInfo->Part5Port, ModeNo, 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;
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GetTVPtr */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-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 = 0 ;
-
- 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 = 0 ; /*EPLCHTVCRT1Ptr_H;*/
- if ( pVBInfo->IF_DEF_CH7007 == 1 )
- {
- tempdi = XGI_EPLCHTVCRT1Ptr;
- }
- break ;
- case 1:
- tempdi = 0 ; /*EPLCHTVCRT1Ptr_V;*/
- if ( pVBInfo->IF_DEF_CH7007 == 1 )
- {
- tempdi = XGI_EPLCHTVCRT1Ptr;
- }
- break ;
- case 2:
- tempdi = XGI_EPLCHTVDataPtr ;
- break ;
- case 3:
- tempdi = 0 ;
- break ;
- case 4:
- tempdi = XGI_TVDataTable ;
- break ;
- case 5:
- tempdi = 0 ;
- break ;
- case 6:
- tempdi = XGI_EPLCHTVRegPtr ;
- break ;
- default:
- break ;
- }
-
- if ( tempdi == 0x00 ) /* OEMUtil */
- return( 0 ) ;
-
- 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( 0 ) ;
+ 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,
+ 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 */
@@ -7805,16 +6653,15 @@ void *XGI_GetTVPtr(unsigned short BX, unsigned short ModeNo,
/* --------------------------------------------------------------------- */
unsigned char XGI_BacklightByDrv(struct vb_device_info *pVBInfo)
{
- unsigned char tempah ;
+ unsigned char tempah;
- tempah = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x3A) ;
- if (tempah & BacklightControlBit)
- return 1;
- else
- return 0;
+ tempah = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x3A);
+ if (tempah & BacklightControlBit)
+ return 1;
+ else
+ return 0;
}
-
/* --------------------------------------------------------------------- */
/* Function : XGI_FirePWDDisable */
/* Input : */
@@ -7824,7 +6671,7 @@ unsigned char XGI_BacklightByDrv(struct vb_device_info *pVBInfo)
/*
void XGI_FirePWDDisable(struct vb_device_info *pVBInfo)
{
- XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x26 , 0x00 , 0xFC ) ;
+ XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x26, 0x00, 0xFC);
}
*/
@@ -7836,35 +6683,22 @@ void XGI_FirePWDDisable(struct vb_device_info *pVBInfo)
/* --------------------------------------------------------------------- */
void XGI_FirePWDEnable(struct vb_device_info *pVBInfo)
{
- XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x26 , 0x03 , 0xFC ) ;
+ XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x26, 0x03, 0xFC);
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_EnableGatingCRT */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_EnableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
+void XGI_EnableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
{
- XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x63 , 0xBF , 0x40 ) ;
+ XGINew_SetRegANDOR(pVBInfo->P3d4, 0x63, 0xBF, 0x40);
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_DisableGatingCRT */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_DisableGatingCRT(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)
{
- XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x63 , 0xBF , 0x00 ) ;
+ XGINew_SetRegANDOR(pVBInfo->P3d4, 0x63, 0xBF, 0x00);
}
-
/* --------------------------------------------------------------------- */
/* Function : XGI_SetPanelDelay */
/* Input : */
@@ -7877,24 +6711,23 @@ void XGI_DisableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension, struct v
/* --------------------------------------------------------------------- */
void XGI_SetPanelDelay(unsigned short tempbl, struct vb_device_info *pVBInfo)
{
- unsigned short index ;
+ unsigned short index;
- index = XGI_GetLCDCapPtr(pVBInfo) ;
+ index = XGI_GetLCDCapPtr(pVBInfo);
- if ( tempbl == 1 )
- XGINew_LCD_Wait_Time( pVBInfo->LCDCapList[ index ].PSC_S1, 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 == 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 == 3)
+ XGINew_LCD_Wait_Time(pVBInfo->LCDCapList[index].PSC_S3, pVBInfo);
- if ( tempbl == 4 )
- XGINew_LCD_Wait_Time( pVBInfo->LCDCapList[ index ].PSC_S4, pVBInfo ) ;
+ if (tempbl == 4)
+ XGINew_LCD_Wait_Time(pVBInfo->LCDCapList[index].PSC_S4, pVBInfo);
}
-
/* --------------------------------------------------------------------- */
/* Function : XGI_SetPanelPower */
/* Input : */
@@ -7905,25 +6738,25 @@ void XGI_SetPanelDelay(unsigned short tempbl, struct vb_device_info *pVBInfo)
/* = 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)
+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 ) ;
+ if (pVBInfo->VBType & (VB_XGI301LV | VB_XGI302LV | VB_XGI301C))
+ XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x26, tempbl, tempah);
+ else
+ XGINew_SetRegANDOR(pVBInfo->P3c4, 0x11, tempbl, tempah);
}
-unsigned char XG21GPIODataTransfer(unsigned char ujDate)
+static unsigned char XG21GPIODataTransfer(unsigned char ujDate)
{
- unsigned char ujRet = 0;
- unsigned char i = 0;
+ 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;
- }
+ for (i = 0; i < 8; i++) {
+ ujRet = ujRet << 1;
+ /* ujRet |= GETBITS(ujDate >> i, 0:0); */
+ ujRet |= (ujDate >> i) & 1;
+ }
return ujRet;
}
@@ -7936,17 +6769,17 @@ unsigned char XG21GPIODataTransfer(unsigned char ujDate)
/*----------------------------------------------------------------------------*/
unsigned char XGI_XG21GetPSCValue(struct vb_device_info *pVBInfo)
{
- unsigned char CR4A, temp;
+ unsigned char CR4A, temp;
- CR4A = XGINew_GetReg1( pVBInfo->P3d4 , 0x4A ) ;
- XGINew_SetRegAND( pVBInfo->P3d4 , 0x4A , ~0x23 ) ; /* enable GPIO write */
+ CR4A = XGINew_GetReg1(pVBInfo->P3d4, 0x4A);
+ XGINew_SetRegAND(pVBInfo->P3d4, 0x4A, ~0x23); /* enable GPIO write */
- temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x48 ) ;
+ temp = XGINew_GetReg1(pVBInfo->P3d4, 0x48);
- temp = XG21GPIODataTransfer(temp);
- temp &= 0x23;
- XGINew_SetReg1( pVBInfo->P3d4 , 0x4A , CR4A ) ;
- return temp;
+ temp = XG21GPIODataTransfer(temp);
+ temp &= 0x23;
+ XGINew_SetReg1(pVBInfo->P3d4, 0x4A, CR4A);
+ return temp;
}
/*----------------------------------------------------------------------------*/
@@ -7957,19 +6790,19 @@ unsigned char XGI_XG21GetPSCValue(struct vb_device_info *pVBInfo)
/*----------------------------------------------------------------------------*/
unsigned char XGI_XG27GetPSCValue(struct vb_device_info *pVBInfo)
{
- unsigned char CR4A, CRB4, temp;
+ unsigned char CR4A, CRB4, temp;
- CR4A = XGINew_GetReg1( pVBInfo->P3d4 , 0x4A ) ;
- XGINew_SetRegAND( pVBInfo->P3d4 , 0x4A , ~0x0C ) ; /* enable GPIO write */
+ CR4A = XGINew_GetReg1(pVBInfo->P3d4, 0x4A);
+ XGINew_SetRegAND(pVBInfo->P3d4, 0x4A, ~0x0C); /* enable GPIO write */
- temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x48 ) ;
+ 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;
+ temp &= 0x0C;
+ temp >>= 2;
+ XGINew_SetReg1(pVBInfo->P3d4, 0x4A, CR4A);
+ CRB4 = XGINew_GetReg1(pVBInfo->P3d4, 0xB4);
+ temp |= ((CRB4 & 0x04) << 3);
+ return temp;
}
/*----------------------------------------------------------------------------*/
/* input */
@@ -7980,70 +6813,71 @@ unsigned char XGI_XG27GetPSCValue(struct vb_device_info *pVBInfo)
/* 000010b : clear bit 1, to set bit1 */
/* 000001b : clear bit 0, to set bit0 */
/*----------------------------------------------------------------------------*/
-void XGI_XG21BLSignalVDD(unsigned short tempbh, unsigned short tempbl, struct vb_device_info *pVBInfo)
+void XGI_XG21BLSignalVDD(unsigned short tempbh, unsigned short tempbl,
+ struct vb_device_info *pVBInfo)
{
- unsigned char CR4A, temp;
+ unsigned char CR4A, temp;
- CR4A = XGINew_GetReg1( pVBInfo->P3d4 , 0x4A ) ;
- tempbh &= 0x23;
- tempbl &= 0x23;
- XGINew_SetRegAND( pVBInfo->P3d4 , 0x4A , ~tempbh ) ; /* enable GPIO write */
+ CR4A = XGINew_GetReg1(pVBInfo->P3d4, 0x4A);
+ tempbh &= 0x23;
+ tempbl &= 0x23;
+ XGINew_SetRegAND(pVBInfo->P3d4, 0x4A, ~tempbh); /* enable GPIO write */
- if (tempbh&0x20)
- {
- temp = (tempbl>>4)&0x02;
+ if (tempbh & 0x20) {
+ temp = (tempbl >> 4) & 0x02;
- XGINew_SetRegANDOR( pVBInfo->P3d4 , 0xB4 , ~0x02 , temp) ; /* CR B4[1] */
+ XGINew_SetRegANDOR(pVBInfo->P3d4, 0xB4, ~0x02, temp); /* CR B4[1] */
- }
+ }
- temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x48 ) ;
+ temp = XGINew_GetReg1(pVBInfo->P3d4, 0x48);
- temp = XG21GPIODataTransfer(temp);
- temp &= ~tempbh;
- temp |= tempbl;
- XGINew_SetReg1( pVBInfo->P3d4 , 0x48 , temp ) ;
+ temp = XG21GPIODataTransfer(temp);
+ temp &= ~tempbh;
+ temp |= tempbl;
+ XGINew_SetReg1(pVBInfo->P3d4, 0x48, temp);
}
-void XGI_XG27BLSignalVDD(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)
{
- unsigned char CR4A, temp;
- unsigned short tempbh0, tempbl0;
+ unsigned char CR4A, temp;
+ unsigned short tempbh0, tempbl0;
- tempbh0 = tempbh;
- tempbl0 = tempbl;
- tempbh0 &= 0x20;
- tempbl0 &= 0x20;
- tempbh0 >>= 3;
- tempbl0 >>= 3;
+ tempbh0 = tempbh;
+ tempbl0 = tempbl;
+ tempbh0 &= 0x20;
+ tempbl0 &= 0x20;
+ tempbh0 >>= 3;
+ tempbl0 >>= 3;
- if (tempbh&0x20)
- {
- temp = (tempbl>>4)&0x02;
+ if (tempbh & 0x20) {
+ temp = (tempbl >> 4) & 0x02;
- XGINew_SetRegANDOR( pVBInfo->P3d4 , 0xB4 , ~0x02 , temp) ; /* CR B4[1] */
+ XGINew_SetRegANDOR(pVBInfo->P3d4, 0xB4, ~0x02, temp); /* CR B4[1] */
- }
- XGINew_SetRegANDOR( pVBInfo->P3d4 , 0xB4 , ~tempbh0 , tempbl0 ) ;
+ }
+ XGINew_SetRegANDOR(pVBInfo->P3d4, 0xB4, ~tempbh0, tempbl0);
- CR4A = XGINew_GetReg1( 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 ) ;
+ CR4A = XGINew_GetReg1(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);
}
/* --------------------------------------------------------------------- */
unsigned short XGI_GetLVDSOEMTableIndex(struct vb_device_info *pVBInfo)
{
- unsigned short index ;
+ unsigned short index;
- index = XGINew_GetReg1( pVBInfo->P3d4 , 0x36 ) ;
- if (index < sizeof(XGI21_LCDCapList)/sizeof(struct XGI21_LVDSCapStruct))
- return index;
- return 0;
+ index = XGINew_GetReg1(pVBInfo->P3d4, 0x36);
+ if (index < sizeof(XGI21_LCDCapList)
+ / sizeof(struct XGI21_LVDSCapStruct))
+ return index;
+ return 0;
}
/* --------------------------------------------------------------------- */
@@ -8056,472 +6890,470 @@ unsigned short XGI_GetLVDSOEMTableIndex(struct vb_device_info *pVBInfo)
/* : bl : 3 ; T3 : the duration between CPL off and signal off */
/* : bl : 4 ; T4 : the duration signal off and Vdd off */
/* --------------------------------------------------------------------- */
-void XGI_XG21SetPanelDelay(unsigned short tempbl, struct vb_device_info *pVBInfo)
+void XGI_XG21SetPanelDelay(unsigned short tempbl,
+ struct vb_device_info *pVBInfo)
{
- unsigned short index ;
+ unsigned short index;
- index = XGI_GetLVDSOEMTableIndex( pVBInfo );
- if ( tempbl == 1 )
- XGINew_LCD_Wait_Time( pVBInfo->XG21_LVDSCapList[ index ].PSC_S1, pVBInfo ) ;
+ index = XGI_GetLVDSOEMTableIndex(pVBInfo);
+ if (tempbl == 1)
+ XGINew_LCD_Wait_Time(pVBInfo->XG21_LVDSCapList[index].PSC_S1,
+ pVBInfo);
- if ( tempbl == 2 )
- XGINew_LCD_Wait_Time( pVBInfo->XG21_LVDSCapList[ index ].PSC_S2, pVBInfo ) ;
+ if (tempbl == 2)
+ XGINew_LCD_Wait_Time(pVBInfo->XG21_LVDSCapList[index].PSC_S2,
+ pVBInfo);
- if ( tempbl == 3 )
- XGINew_LCD_Wait_Time( pVBInfo->XG21_LVDSCapList[ index ].PSC_S3, pVBInfo ) ;
+ if (tempbl == 3)
+ XGINew_LCD_Wait_Time(pVBInfo->XG21_LVDSCapList[index].PSC_S3,
+ pVBInfo);
- if ( tempbl == 4 )
- XGINew_LCD_Wait_Time( pVBInfo->XG21_LVDSCapList[ index ].PSC_S4, pVBInfo ) ;
+ if (tempbl == 4)
+ XGINew_LCD_Wait_Time(pVBInfo->XG21_LVDSCapList[index].PSC_S4,
+ pVBInfo);
}
unsigned char XGI_XG21CheckLVDSMode(unsigned short ModeNo,
- unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo)
-{
- unsigned short xres ,
- yres ,
- colordepth ,
- modeflag ,
- resindex ,
- lvdstableindex;
-
- resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ;
- if ( ModeNo <= 0x13 )
- {
- xres = pVBInfo->StResInfo[ resindex ].HTotal ;
- yres = pVBInfo->StResInfo[ resindex ].VTotal ;
- modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */
- }
- else
- {
- xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; /* xres->ax */
- yres = pVBInfo->ModeResInfo[ resindex ].VTotal ; /* yres->bx */
- modeflag = pVBInfo->EModeIDTable[ ModeIdIndex].Ext_ModeFlag ; /* si+St_ModeFlag */
- }
-
- if ( !( modeflag & Charx8Dot ) )
- {
- xres /= 9;
- xres *= 8;
- }
-
- if ( ModeNo > 0x13 )
- {
- if ( ( ModeNo>0x13 ) && ( modeflag & HalfDCLK ) )
- {
- xres *= 2 ;
- }
- if ( ( ModeNo>0x13 ) && ( modeflag & DoubleScanMode ) )
- {
- yres *= 2 ;
- }
- }
-
- lvdstableindex = XGI_GetLVDSOEMTableIndex( pVBInfo );
- if ( xres > (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE) )
- return 0;
-
- if ( yres > (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE) )
- return 0;
-
- if ( ModeNo > 0x13 )
- {
- if ( ( xres != (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE) ) ||
- ( yres != (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE)) )
- {
- colordepth = XGI_GetColorDepth( ModeNo , ModeIdIndex, pVBInfo ) ;
- if (colordepth > 2)
- return 0;
-
- }
- }
- return 1;
+ unsigned short ModeIdIndex, struct vb_device_info *pVBInfo)
+{
+ unsigned short xres, yres, colordepth, modeflag, resindex,
+ lvdstableindex;
+
+ resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo);
+ if (ModeNo <= 0x13) {
+ xres = pVBInfo->StResInfo[resindex].HTotal;
+ yres = pVBInfo->StResInfo[resindex].VTotal;
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */
+ } else {
+ xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */
+ yres = pVBInfo->ModeResInfo[resindex].VTotal; /* yres->bx */
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+St_ModeFlag */
+ }
+
+ if (!(modeflag & Charx8Dot)) {
+ xres /= 9;
+ xres *= 8;
+ }
+
+ if (ModeNo > 0x13) {
+ if ((ModeNo > 0x13) && (modeflag & HalfDCLK))
+ xres *= 2;
+
+ if ((ModeNo > 0x13) && (modeflag & DoubleScanMode))
+ yres *= 2;
+
+ }
+
+ lvdstableindex = XGI_GetLVDSOEMTableIndex(pVBInfo);
+ if (xres > (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE))
+ return 0;
+
+ if (yres > (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE))
+ return 0;
+
+ if (ModeNo > 0x13) {
+ if ((xres
+ != (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE))
+ || (yres
+ != (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE))) {
+ colordepth = XGI_GetColorDepth(ModeNo, ModeIdIndex,
+ pVBInfo);
+ if (colordepth > 2)
+ return 0;
+
+ }
+ }
+ return 1;
}
void XGI_SetXG21FPBits(struct vb_device_info *pVBInfo)
{
- unsigned char temp;
+ unsigned char temp;
- temp = XGINew_GetReg1( 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 */
+ temp = XGINew_GetReg1(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 */
}
void XGI_SetXG27FPBits(struct vb_device_info *pVBInfo)
{
- unsigned char temp;
+ unsigned char temp;
- temp = XGINew_GetReg1( 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 */
+ temp = XGINew_GetReg1(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 */
}
void XGI_SetXG21LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo)
-{
- unsigned char temp, Miscdata;
- unsigned short xres ,
- yres ,
- modeflag ,
- resindex ,
- lvdstableindex ;
- unsigned short LVDSHT,LVDSHBS,LVDSHRS,LVDSHRE,LVDSHBE;
- unsigned short LVDSVT,LVDSVBS,LVDSVRS,LVDSVRE,LVDSVBE;
- unsigned short value;
-
- lvdstableindex = XGI_GetLVDSOEMTableIndex( pVBInfo );
-
- temp = (unsigned char) ((pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability & (LCDPolarity << 8)) >> 8);
- temp &= LCDPolarity;
- Miscdata = (unsigned char) XGINew_GetReg2(pVBInfo->P3cc) ;
-
- XGINew_SetReg3( pVBInfo->P3c2 , (Miscdata & 0x3F) | temp ) ;
-
- 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 */
-
- XGI_SetXG21FPBits(pVBInfo);
- resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ;
- if ( ModeNo <= 0x13 )
- {
- xres = pVBInfo->StResInfo[ resindex ].HTotal ;
- yres = pVBInfo->StResInfo[ resindex ].VTotal ;
- modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */
- }
- else
- {
- xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; /* xres->ax */
- yres = pVBInfo->ModeResInfo[ resindex ].VTotal ; /* yres->bx */
- modeflag = pVBInfo->EModeIDTable[ ModeIdIndex].Ext_ModeFlag ; /* si+St_ModeFlag */
- }
-
- if (!( modeflag & Charx8Dot ))
- xres = xres * 8 / 9;
-
- LVDSHT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHT;
-
- LVDSHBS = xres + ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE - xres ) / 2 ;
- if ( ( ModeNo<=0x13 ) && ( modeflag & HalfDCLK ) )
- {
- LVDSHBS -= xres/4 ;
- }
- if (LVDSHBS > LVDSHT) LVDSHBS -= LVDSHT ;
-
- LVDSHRS = LVDSHBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHFP ;
- if (LVDSHRS > LVDSHT) LVDSHRS -= LVDSHT ;
-
- LVDSHRE = LVDSHRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHSYNC ;
- if (LVDSHRE > LVDSHT) LVDSHRE -= LVDSHT ;
-
- LVDSHBE = LVDSHBS + LVDSHT - pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE ;
-
- LVDSVT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVT;
-
- LVDSVBS = yres + ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE - yres ) / 2 ;
- if ( ( ModeNo>0x13 ) && ( modeflag & DoubleScanMode ) )
- {
- LVDSVBS += yres/2 ;
- }
- if (LVDSVBS > LVDSVT) LVDSVBS -= LVDSVT ;
-
- LVDSVRS = LVDSVBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVFP ;
- if (LVDSVRS > LVDSVT) LVDSVRS -= LVDSVT ;
-
- LVDSVRE = LVDSVRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVSYNC ;
- if (LVDSVRE > LVDSVT) LVDSVRE -= LVDSVT ;
-
- 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 */
-
- if (!( modeflag & Charx8Dot ))
- {
- XGINew_SetRegOR( 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) ) ;
-
- /* 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) ) ;
-
- /* 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 ) ;
-
- /* 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) ) ;
-
- /* 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) ) ;
-
- /* 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 ) ;
-
- /* Panel HRE SR2F[7:2] */
- value--;
- XGINew_SetRegANDOR( 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) ) ;
-
- /* 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) ) ;
-
- /* VBE SR0A[4] CR16 */
- value = LVDSVBE - 1;
- XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x10 , ( value & 0x100 ) >> 4 ) ;
- XGINew_SetReg1( pVBInfo->P3d4 , 0x16 , (value & 0xFF) ) ;
+ struct vb_device_info *pVBInfo)
+{
+ unsigned char temp, Miscdata;
+ unsigned short xres, yres, modeflag, resindex, lvdstableindex;
+ unsigned short LVDSHT, LVDSHBS, LVDSHRS, LVDSHRE, LVDSHBE;
+ unsigned short LVDSVT, LVDSVBS, LVDSVRS, LVDSVRE, LVDSVBE;
+ unsigned short value;
+
+ lvdstableindex = XGI_GetLVDSOEMTableIndex(pVBInfo);
+
+ temp = (unsigned char) ((pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability
+ & (LCDPolarity << 8)) >> 8);
+ temp &= LCDPolarity;
+ Miscdata = (unsigned char) XGINew_GetReg2(pVBInfo->P3cc);
+
+ XGINew_SetReg3(pVBInfo->P3c2, (Miscdata & 0x3F) | temp);
+
+ 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 */
+
+ XGI_SetXG21FPBits(pVBInfo);
+ resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo);
+ if (ModeNo <= 0x13) {
+ xres = pVBInfo->StResInfo[resindex].HTotal;
+ yres = pVBInfo->StResInfo[resindex].VTotal;
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */
+ } else {
+ xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */
+ yres = pVBInfo->ModeResInfo[resindex].VTotal; /* yres->bx */
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+St_ModeFlag */
+ }
+
+ if (!(modeflag & Charx8Dot))
+ xres = xres * 8 / 9;
+
+ LVDSHT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHT;
- /* 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) ) ;
-
- /* 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 ) ;
+ LVDSHBS = xres + (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE
+ - xres) / 2;
+ if ((ModeNo <= 0x13) && (modeflag & HalfDCLK))
+ LVDSHBS -= xres / 4;
+
+ if (LVDSHBS > LVDSHT)
+ LVDSHBS -= LVDSHT;
+
+ LVDSHRS = LVDSHBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHFP;
+ if (LVDSHRS > LVDSHT)
+ LVDSHRS -= LVDSHT;
+
+ LVDSHRE = LVDSHRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHSYNC;
+ if (LVDSHRE > LVDSHT)
+ LVDSHRE -= LVDSHT;
+
+ LVDSHBE = LVDSHBS + LVDSHT
+ - pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE;
+
+ LVDSVT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVT;
+
+ LVDSVBS = yres + (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE
+ - yres) / 2;
+ if ((ModeNo > 0x13) && (modeflag & DoubleScanMode))
+ LVDSVBS += yres / 2;
+
+ if (LVDSVBS > LVDSVT)
+ LVDSVBS -= LVDSVT;
+
+ LVDSVRS = LVDSVBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVFP;
+ if (LVDSVRS > LVDSVT)
+ LVDSVRS -= LVDSVT;
+
+ LVDSVRE = LVDSVRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVSYNC;
+ if (LVDSVRE > LVDSVT)
+ LVDSVRE -= LVDSVT;
+
+ 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 */
+
+ if (!(modeflag & Charx8Dot))
+ XGINew_SetRegOR(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));
+
+ /* 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));
+
+ /* 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);
+
+ /* 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));
+
+ /* 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));
+
+ /* 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);
+
+ /* Panel HRE SR2F[7:2] */
+ value--;
+ XGINew_SetRegANDOR(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));
+
+ /* 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));
+
+ /* VBE SR0A[4] CR16 */
+ value = LVDSVBE - 1;
+ XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x10, (value & 0x100) >> 4);
+ XGINew_SetReg1(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));
+
+ /* 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);
+
+ /* 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);
+
+ /* Panel VRE SR3F[7:2] *//* SR3F[7] has to be 0, h/w bug */
+ XGINew_SetRegANDOR(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,
+ 0x2B,
+ pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData1);
+ XGINew_SetReg1(pVBInfo->P3c4,
+ 0x2C,
+ pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData2);
+ value += 0x10;
+ }
- /* 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 ) ;
-
- /* Panel VRE SR3F[7:2] */ /* SR3F[7] has to be 0, h/w bug */
- XGINew_SetRegANDOR( 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 , 0x2B , pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData1) ;
- XGINew_SetReg1( 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*/
-
- XGINew_GetReg2( pVBInfo->P3da ) ; /* Enable Attribute */
- XGINew_SetReg3( pVBInfo->P3c0 , 0x20 ) ;
-
- XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */
- }
+ 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*/
+ XGINew_GetReg2(pVBInfo->P3da); /* Enable Attribute */
+ XGINew_SetReg3(pVBInfo->P3c0, 0x20);
+
+ XGINew_GetReg2(pVBInfo->P3da); /* reset 3da */
+ }
}
/* no shadow case */
void XGI_SetXG27LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo)
-{
- unsigned char temp, Miscdata;
- unsigned short xres ,
- yres ,
- modeflag ,
- resindex ,
- lvdstableindex ;
- unsigned short LVDSHT,LVDSHBS,LVDSHRS,LVDSHRE,LVDSHBE;
- unsigned short LVDSVT,LVDSVBS,LVDSVRS,LVDSVRE,LVDSVBE;
- unsigned short value;
-
- lvdstableindex = XGI_GetLVDSOEMTableIndex( pVBInfo );
- temp = (unsigned char) ((pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability & (LCDPolarity << 8)) >> 8);
- temp &= LCDPolarity;
- Miscdata = (unsigned char) XGINew_GetReg2(pVBInfo->P3cc);
-
- XGINew_SetReg3( pVBInfo->P3c2 , (Miscdata & 0x3F) | temp ) ;
-
- 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 */
-
- XGI_SetXG27FPBits(pVBInfo);
- resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ;
- if ( ModeNo <= 0x13 )
- {
- xres = pVBInfo->StResInfo[ resindex ].HTotal ;
- yres = pVBInfo->StResInfo[ resindex ].VTotal ;
- modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */
- }
- else
- {
- xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; /* xres->ax */
- yres = pVBInfo->ModeResInfo[ resindex ].VTotal ; /* yres->bx */
- modeflag = pVBInfo->EModeIDTable[ ModeIdIndex].Ext_ModeFlag ; /* si+St_ModeFlag */
- }
-
- if (!( modeflag & Charx8Dot ))
- xres = xres * 8 / 9;
-
- LVDSHT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHT;
-
- LVDSHBS = xres + ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE - xres ) / 2 ;
- if ( ( ModeNo<=0x13 ) && ( modeflag & HalfDCLK ) )
- {
- LVDSHBS -= xres/4 ;
- }
- if (LVDSHBS > LVDSHT) LVDSHBS -= LVDSHT ;
-
- LVDSHRS = LVDSHBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHFP ;
- if (LVDSHRS > LVDSHT) LVDSHRS -= LVDSHT ;
-
- LVDSHRE = LVDSHRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHSYNC ;
- if (LVDSHRE > LVDSHT) LVDSHRE -= LVDSHT ;
-
- LVDSHBE = LVDSHBS + LVDSHT - pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE ;
-
- LVDSVT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVT;
-
- LVDSVBS = yres + ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE - yres ) / 2 ;
- if ( ( ModeNo>0x13 ) && ( modeflag & DoubleScanMode ) )
- {
- LVDSVBS += yres/2 ;
- }
- if (LVDSVBS > LVDSVT) LVDSVBS -= LVDSVT ;
-
- LVDSVRS = LVDSVBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVFP ;
- if (LVDSVRS > LVDSVT) LVDSVRS -= LVDSVT ;
-
- LVDSVRE = LVDSVRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVSYNC ;
- if (LVDSVRE > LVDSVT) LVDSVRE -= LVDSVT ;
-
- 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 */
-
- if (!( modeflag & Charx8Dot ))
- {
- XGINew_SetRegOR( 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) ) ;
-
- /* 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) ) ;
-
- /* 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 ) ;
-
- /* 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) ) ;
-
- /* 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) ) ;
-
- /* 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 ) ;
-
- /* Panel HRE SR2F[7:2] */
- value--;
- XGINew_SetRegANDOR( 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) ) ;
-
- /* 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) ) ;
-
- /* VBE SR0A[4] CR16 */
- value = LVDSVBE - 1;
- XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x10 , ( value & 0x100 ) >> 4 ) ;
- XGINew_SetReg1( pVBInfo->P3d4 , 0x16 , (value & 0xFF) ) ;
+ struct vb_device_info *pVBInfo)
+{
+ unsigned char temp, Miscdata;
+ unsigned short xres, yres, modeflag, resindex, lvdstableindex;
+ unsigned short LVDSHT, LVDSHBS, LVDSHRS, LVDSHRE, LVDSHBE;
+ unsigned short LVDSVT, LVDSVBS, LVDSVRS, LVDSVRE, LVDSVBE;
+ unsigned short value;
+
+ lvdstableindex = XGI_GetLVDSOEMTableIndex(pVBInfo);
+ temp = (unsigned char) ((pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability
+ & (LCDPolarity << 8)) >> 8);
+ temp &= LCDPolarity;
+ Miscdata = (unsigned char) XGINew_GetReg2(pVBInfo->P3cc);
+
+ XGINew_SetReg3(pVBInfo->P3c2, (Miscdata & 0x3F) | temp);
+
+ 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 */
+
+ XGI_SetXG27FPBits(pVBInfo);
+ resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo);
+ if (ModeNo <= 0x13) {
+ xres = pVBInfo->StResInfo[resindex].HTotal;
+ yres = pVBInfo->StResInfo[resindex].VTotal;
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */
+ } else {
+ xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */
+ yres = pVBInfo->ModeResInfo[resindex].VTotal; /* yres->bx */
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+St_ModeFlag */
+ }
- /* 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) ) ;
-
- /* Panel VRS SR35[2:0] SR34[7:0] */
- XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x07 , ( value & 0x700 ) >> 8 ) ;
- XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , value & 0xFF ) ;
+ if (!(modeflag & Charx8Dot))
+ xres = xres * 8 / 9;
+
+ LVDSHT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHT;
- /* 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 ) ;
+ LVDSHBS = xres + (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE
+ - xres) / 2;
+ if ((ModeNo <= 0x13) && (modeflag & HalfDCLK))
+ LVDSHBS -= xres / 4;
+
+ if (LVDSHBS > LVDSHT)
+ LVDSHBS -= LVDSHT;
+
+ LVDSHRS = LVDSHBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHFP;
+ if (LVDSHRS > LVDSHT)
+ LVDSHRS -= LVDSHT;
+
+ LVDSHRE = LVDSHRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHSYNC;
+ if (LVDSHRE > LVDSHT)
+ LVDSHRE -= LVDSHT;
+
+ LVDSHBE = LVDSHBS + LVDSHT
+ - pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE;
+
+ LVDSVT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVT;
- /* Panel VRE SR3F[7:2] */
- XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x3F , ~0xFC , ( value << 2 ) & 0xFC ) ;
+ LVDSVBS = yres + (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE
+ - yres) / 2;
+ if ((ModeNo > 0x13) && (modeflag & DoubleScanMode))
+ LVDSVBS += yres / 2;
+
+ if (LVDSVBS > LVDSVT)
+ LVDSVBS -= LVDSVT;
+
+ LVDSVRS = LVDSVBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVFP;
+ if (LVDSVRS > LVDSVT)
+ LVDSVRS -= LVDSVT;
+
+ LVDSVRE = LVDSVRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVSYNC;
+ if (LVDSVRE > LVDSVT)
+ LVDSVRE -= LVDSVT;
+
+ 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 */
+
+ if (!(modeflag & Charx8Dot))
+ XGINew_SetRegOR(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));
+
+ /* 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));
+
+ /* 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);
+
+ /* 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));
+
+ /* 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));
+
+ /* 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);
+
+ /* Panel HRE SR2F[7:2] */
+ value--;
+ XGINew_SetRegANDOR(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));
+
+ /* 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));
+
+ /* VBE SR0A[4] CR16 */
+ value = LVDSVBE - 1;
+ XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x10, (value & 0x100) >> 4);
+ XGINew_SetReg1(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));
+
+ /* Panel VRS SR35[2:0] SR34[7:0] */
+ XGINew_SetRegANDOR(pVBInfo->P3c4, 0x35, ~0x07, (value & 0x700) >> 8);
+ XGINew_SetReg1(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);
+
+ /* Panel VRE SR3F[7:2] */
+ XGINew_SetRegANDOR(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,
+ 0x2B,
+ pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData1);
+ XGINew_SetReg1(pVBInfo->P3c4,
+ 0x2C,
+ pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData2);
+ value += 0x10;
+ }
- for ( temp=0, value = 0; temp < 3; temp++)
- {
-
- XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x31 , ~0x30 , value ) ;
- XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData1) ;
- XGINew_SetReg1( 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*/
-
- XGINew_GetReg2( pVBInfo->P3da ) ; /* Enable Attribute */
- XGINew_SetReg3( pVBInfo->P3c0 , 0x20 ) ;
-
- XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */
- }
+ 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*/
+ XGINew_GetReg2(pVBInfo->P3da); /* Enable Attribute */
+ XGINew_SetReg3(pVBInfo->P3c0, 0x20);
+
+ XGINew_GetReg2(pVBInfo->P3da); /* reset 3da */
+ }
}
@@ -8534,52 +7366,40 @@ void XGI_SetXG27LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex,
/* --------------------------------------------------------------------- */
unsigned char XGI_IsLCDON(struct vb_device_info *pVBInfo)
{
- unsigned short tempax ;
+ unsigned short tempax;
- tempax = pVBInfo->VBInfo ;
- if ( tempax & SetCRT2ToDualEdge )
- return 0;
- else if ( tempax & ( DisableCRT2Display | SwitchToCRT2 | SetSimuScanMode ) )
- return 1;
+ tempax = pVBInfo->VBInfo;
+ if (tempax & SetCRT2ToDualEdge)
+ return 0;
+ else if (tempax & (DisableCRT2Display | SwitchToCRT2 | SetSimuScanMode))
+ return 1;
- return 0;
+ return 0;
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_EnablePWD */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
void XGI_EnablePWD(struct vb_device_info *pVBInfo)
{
- unsigned short index ,
- temp ;
+ 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 */
+ 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 */
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_DisablePWD */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
void XGI_DisablePWD(struct vb_device_info *pVBInfo)
{
- XGINew_SetRegAND( pVBInfo->Part4Port , 0x27 , 0x7F ) ; /* disable PWD */
+ XGINew_SetRegAND(pVBInfo->Part4Port, 0x27, 0x7F); /* disable PWD */
}
-
/* --------------------------------------------------------------------- */
/* Function : XGI_DisableChISLCD */
/* Input : */
@@ -8588,28 +7408,25 @@ void XGI_DisablePWD(struct vb_device_info *pVBInfo)
/* --------------------------------------------------------------------- */
unsigned char XGI_DisableChISLCD(struct vb_device_info *pVBInfo)
{
- unsigned short tempbx ,
- tempah ;
+ unsigned short tempbx, tempah;
- tempbx = pVBInfo->SetFlag & ( DisableChA | DisableChB ) ;
- tempah = ~((unsigned short) XGINew_GetReg1(pVBInfo->Part1Port, 0x2E));
+ tempbx = pVBInfo->SetFlag & (DisableChA | DisableChB);
+ tempah = ~((unsigned short) XGINew_GetReg1(pVBInfo->Part1Port, 0x2E));
- if ( tempbx & ( EnableChA | DisableChA ) )
- {
- if ( !( tempah & 0x08 ) ) /* Chk LCDA Mode */
- return 0 ;
- }
+ if (tempbx & (EnableChA | DisableChA)) {
+ if (!(tempah & 0x08)) /* Chk LCDA Mode */
+ return 0;
+ }
- if ( !( tempbx & ( EnableChB | DisableChB ) ) )
- return 0;
+ if (!(tempbx & (EnableChB | DisableChB)))
+ return 0;
- if ( tempah & 0x01 ) /* Chk LCDB Mode */
- return 1;
+ if (tempah & 0x01) /* Chk LCDB Mode */
+ return 1;
- return 0;
+ return 0;
}
-
/* --------------------------------------------------------------------- */
/* Function : XGI_EnableChISLCD */
/* Input : */
@@ -8618,515 +7435,433 @@ unsigned char XGI_DisableChISLCD(struct vb_device_info *pVBInfo)
/* --------------------------------------------------------------------- */
unsigned char XGI_EnableChISLCD(struct vb_device_info *pVBInfo)
{
- unsigned short tempbx ,
- tempah ;
+ unsigned short tempbx, tempah;
+ tempbx = pVBInfo->SetFlag & (EnableChA | EnableChB);
+ tempah = ~((unsigned short) XGINew_GetReg1(pVBInfo->Part1Port, 0x2E));
- tempbx = pVBInfo->SetFlag & ( EnableChA | EnableChB ) ;
- tempah = ~( (unsigned short)XGINew_GetReg1( pVBInfo->Part1Port , 0x2E ) ) ;
+ if (tempbx & (EnableChA | DisableChA)) {
+ if (!(tempah & 0x08)) /* Chk LCDA Mode */
+ return 0;
+ }
- if ( tempbx & ( EnableChA | DisableChA ) )
- {
- if ( !( tempah & 0x08 ) ) /* Chk LCDA Mode */
+ if (!(tempbx & (EnableChB | DisableChB)))
return 0;
- }
- if ( !( tempbx & ( EnableChB | DisableChB ) ) )
- return 0;
+ if (tempah & 0x01) /* Chk LCDB Mode */
+ return 1;
- if ( tempah & 0x01 ) /* Chk LCDB Mode */
- return 1;
-
- return 0;
+ return 0;
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GetLCDCapPtr */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
unsigned short XGI_GetLCDCapPtr(struct vb_device_info *pVBInfo)
{
- unsigned char tempal ,
- tempah ,
- tempbl ,
- i ;
+ 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 ;
+ 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 ) ;
- }
+ while (tempbl != 0xFF) {
+ if (tempbl & 0x80) { /* OEMUtil */
+ tempal = tempah;
+ tempbl = tempbl & ~(0x80);
+ }
- if ( tempal == tempbl )
- break ;
+ if (tempal == tempbl)
+ break;
- i++ ;
+ i++;
- tempbl = pVBInfo->LCDCapList[ i ].LCD_ID ;
- }
+ tempbl = pVBInfo->LCDCapList[i].LCD_ID;
+ }
- return i ;
+ return i;
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GetLCDCapPtr1 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
unsigned short XGI_GetLCDCapPtr1(struct vb_device_info *pVBInfo)
{
- unsigned short tempah ,
- tempal ,
- tempbl ,
- i ;
+ unsigned short tempah, tempal, tempbl, i;
- tempal = pVBInfo->LCDResInfo ;
- tempah = pVBInfo->LCDTypeInfo ;
+ tempal = pVBInfo->LCDResInfo;
+ tempah = pVBInfo->LCDTypeInfo;
- i = 0 ;
- tempbl = pVBInfo->LCDCapList[ i ].LCD_ID;
+ i = 0;
+ tempbl = pVBInfo->LCDCapList[i].LCD_ID;
- while( tempbl != 0xFF )
- {
- if ( ( tempbl & 0x80 ) && ( tempbl != 0x80 ) )
- {
- tempal = tempah ;
- tempbl &= ~0x80 ;
- }
+ while (tempbl != 0xFF) {
+ if ((tempbl & 0x80) && (tempbl != 0x80)) {
+ tempal = tempah;
+ tempbl &= ~0x80;
+ }
- if ( tempal == tempbl )
- break ;
+ if (tempal == tempbl)
+ break;
- i++ ;
- tempbl = pVBInfo->LCDCapList[ i ].LCD_ID ;
- }
+ i++;
+ tempbl = pVBInfo->LCDCapList[i].LCD_ID;
+ }
- if ( tempbl == 0xFF )
- {
- pVBInfo->LCDResInfo = Panel1024x768 ;
- pVBInfo->LCDTypeInfo = 0 ;
- i = 0 ;
- }
+ if (tempbl == 0xFF) {
+ pVBInfo->LCDResInfo = Panel1024x768;
+ pVBInfo->LCDTypeInfo = 0;
+ i = 0;
+ }
- return i ;
+ return i;
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GetLCDSync */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_GetLCDSync(unsigned short *HSyncWidth , unsigned short *VSyncWidth,
- struct vb_device_info *pVBInfo)
+void XGI_GetLCDSync(unsigned short *HSyncWidth, unsigned short *VSyncWidth,
+ struct vb_device_info *pVBInfo)
{
- unsigned short Index ;
+ unsigned short Index;
- Index = XGI_GetLCDCapPtr(pVBInfo) ;
- *HSyncWidth = pVBInfo->LCDCapList[ Index ].LCD_HSyncWidth ;
- *VSyncWidth = pVBInfo->LCDCapList[ Index ].LCD_VSyncWidth ;
+ Index = XGI_GetLCDCapPtr(pVBInfo);
+ *HSyncWidth = pVBInfo->LCDCapList[Index].LCD_HSyncWidth;
+ *VSyncWidth = pVBInfo->LCDCapList[Index].LCD_VSyncWidth;
- return ;
+ 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;
+ }
-/* --------------------------------------------------------------------- */
-/* Function : XGI_EnableBridge */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-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) ;
- }
+ 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;
+
+ 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)) */
+ }
+ }
-/* --------------------------------------------------------------------- */
-/* Function : XGI_DisableBridge */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
-{
- unsigned short tempax ,
- tempbx ,
- tempah = 0 ,
- tempbl = 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) ) )
- {
- if ( !XGI_IsLCDON(pVBInfo) )
- {
- if ( DISCHARGE )
- {
- tempbx = XGINew_GetCH7005( 0x61 ) ;
- if ( tempbx < 0x01 ) //first time we power up
- XGINew_SetCH7005( 0x0066 ) ; //and disable power sequence
- else
- XGINew_SetCH7005( 0x5f66 ) ; //leave VDD on - disable power
- }
- }
- }
- } */
-
- if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B| VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) )
- {
- tempah = 0x3F ;
- if ( !( pVBInfo->VBInfo & ( DisableCRT2Display | SetSimuScanMode ) ) )
- {
- if ( pVBInfo->VBInfo & SetCRT2ToLCDA )
- {
- if ( pVBInfo->VBInfo & SetCRT2ToDualEdge )
- {
- tempah = 0x7F; /* Disable Channel A */
- if ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) )
- tempah = 0xBF ; /* Disable Channel B */
-
- if ( pVBInfo->SetFlag & DisableChB )
- tempah &= 0xBF ; /* force to disable Cahnnel */
-
- if ( pVBInfo->SetFlag & DisableChA )
- tempah &= 0x7F ; /* Force to disable Channel B */
- }
- }
- }
-
- XGINew_SetRegAND( 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 */
- }
-
- if ( ( pVBInfo->SetFlag & DisableChA ) || ( pVBInfo->VBInfo & ( DisableCRT2Display | SetCRT2ToLCDA | SetSimuScanMode ) ) )
- {
- if ( pVBInfo->SetFlag & GatingCRT )
- XGI_EnableGatingCRT( HwDeviceExtension, pVBInfo ) ;
- XGI_DisplayOff( HwDeviceExtension, pVBInfo) ;
- }
-
- if ( pVBInfo->VBInfo & SetCRT2ToLCDA )
- {
- if ( ( pVBInfo->SetFlag & DisableChA ) || ( pVBInfo->VBInfo & SetCRT2ToLCDA ) )
- XGINew_SetRegAND( pVBInfo->Part1Port , 0x1e , 0xdf ) ; /* Power down */
- }
-
- XGINew_SetRegAND( pVBInfo->P3c4 , 0x32 , 0xdf ) ; /* disable TV as primary VGA swap */
-
- if ( ( pVBInfo->VBInfo & ( SetSimuScanMode | SetCRT2ToDualEdge ) ) )
- XGINew_SetRegAND(pVBInfo->Part2Port,0x00,0xdf);
-
- if ( ( pVBInfo->SetFlag & DisableChB ) || ( pVBInfo->VBInfo & ( DisableCRT2Display | SetSimuScanMode ) )
- || ( ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) && ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToLCD | SetCRT2ToTV ) ) ) )
- XGINew_SetRegOR( 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 */
- }
- }
- 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 */
- }
-
- 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) ;
- }
- }
-}
+ /*
+ if (CH7017) {
+ if (!(pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2toLCDA)) || (XGI_DisableChISLCD(pVBInfo))) {
+ if (!XGI_IsLCDON(pVBInfo)) {
+ if (DISCHARGE) {
+ tempbx = XGINew_GetCH7005(0x61);
+ if (tempbx < 0x01) // first time we power up
+ XGINew_SetCH7005(0x0066); // and disable power sequence
+ else
+ XGINew_SetCH7005(0x5f66); // leave VDD on - disable power
+ }
+ }
+ }
+ }
+ */
+
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C)) {
+ tempah = 0x3F;
+ if (!(pVBInfo->VBInfo & (DisableCRT2Display | SetSimuScanMode))) {
+ if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
+ if (pVBInfo->VBInfo & SetCRT2ToDualEdge) {
+ tempah = 0x7F; /* Disable Channel A */
+ if (!(pVBInfo->VBInfo & SetCRT2ToLCDA))
+ tempah = 0xBF; /* Disable Channel B */
+
+ if (pVBInfo->SetFlag & DisableChB)
+ tempah &= 0xBF; /* force to disable Cahnnel */
+
+ if (pVBInfo->SetFlag & DisableChA)
+ tempah &= 0x7F; /* Force to disable Channel B */
+ }
+ }
+ }
+
+ XGINew_SetRegAND(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 */
+ }
+
+ if ((pVBInfo->SetFlag & DisableChA) || (pVBInfo->VBInfo
+ & (DisableCRT2Display | SetCRT2ToLCDA
+ | SetSimuScanMode))) {
+ if (pVBInfo->SetFlag & GatingCRT)
+ XGI_EnableGatingCRT(HwDeviceExtension, pVBInfo);
+ XGI_DisplayOff(HwDeviceExtension, pVBInfo);
+ }
+
+ if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
+ if ((pVBInfo->SetFlag & DisableChA) || (pVBInfo->VBInfo
+ & SetCRT2ToLCDA))
+ XGINew_SetRegAND(pVBInfo->Part1Port, 0x1e, 0xdf); /* Power down */
+ }
+
+ XGINew_SetRegAND(pVBInfo->P3c4, 0x32, 0xdf); /* disable TV as primary VGA swap */
+
+ if ((pVBInfo->VBInfo & (SetSimuScanMode | SetCRT2ToDualEdge)))
+ XGINew_SetRegAND(pVBInfo->Part2Port, 0x00, 0xdf);
+
+ if ((pVBInfo->SetFlag & DisableChB) || (pVBInfo->VBInfo
+ & (DisableCRT2Display | SetSimuScanMode))
+ || ((!(pVBInfo->VBInfo & SetCRT2ToLCDA))
+ && (pVBInfo->VBInfo
+ & (SetCRT2ToRAMDAC
+ | SetCRT2ToLCD
+ | SetCRT2ToTV))))
+ XGINew_SetRegOR(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 */
+ }
+ } 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 */
+ }
+
+ 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);
+ }
+ }
+}
/* --------------------------------------------------------------------- */
/* Function : XGI_GetTVPtrIndex */
@@ -9147,216 +7882,185 @@ void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension, struct vb_d
/* --------------------------------------------------------------------- */
unsigned short XGI_GetTVPtrIndex(struct vb_device_info *pVBInfo)
{
- unsigned short tempbx = 0 ;
+ unsigned short tempbx = 0;
- if ( pVBInfo->TVInfo & SetPALTV )
- tempbx = 2 ;
- if ( pVBInfo->TVInfo & SetYPbPrMode1080i )
- tempbx = 4 ;
- if ( pVBInfo->TVInfo & SetYPbPrMode525i )
- tempbx = 6 ;
- if ( pVBInfo->TVInfo & SetYPbPrMode525p )
- tempbx = 8 ;
- if ( pVBInfo->TVInfo & SetYPbPrMode750p )
- tempbx = 10 ;
- if ( pVBInfo->TVInfo & TVSimuMode )
- tempbx++ ;
+ if (pVBInfo->TVInfo & SetPALTV)
+ tempbx = 2;
+ if (pVBInfo->TVInfo & SetYPbPrMode1080i)
+ tempbx = 4;
+ if (pVBInfo->TVInfo & SetYPbPrMode525i)
+ tempbx = 6;
+ if (pVBInfo->TVInfo & SetYPbPrMode525p)
+ tempbx = 8;
+ if (pVBInfo->TVInfo & SetYPbPrMode750p)
+ tempbx = 10;
+ if (pVBInfo->TVInfo & TVSimuMode)
+ tempbx++;
- return tempbx ;
+ return tempbx;
}
-
/* --------------------------------------------------------------------- */
/* Function : XGI_OEM310Setting */
/* Input : */
/* Output : */
/* Description : Customized Param. for 301 */
/* --------------------------------------------------------------------- */
-void XGI_OEM310Setting(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo)
+void XGI_OEM310Setting(unsigned short ModeNo, unsigned short ModeIdIndex,
+ struct vb_device_info *pVBInfo)
{
- if ( pVBInfo->SetFlag & Win9xDOSMode )
- return ;
+ if (pVBInfo->SetFlag & Win9xDOSMode)
+ return;
- /* GetPart1IO(); */
- XGI_SetDelayComp(pVBInfo) ;
+ /* GetPart1IO(); */
+ XGI_SetDelayComp(pVBInfo);
- if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) )
- XGI_SetLCDCap(pVBInfo) ;
+ if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA))
+ XGI_SetLCDCap(pVBInfo);
- if ( pVBInfo->VBInfo & SetCRT2ToTV )
- {
- /* GetPart2IO() */
- XGI_SetPhaseIncr(pVBInfo) ;
- XGI_SetYFilter( ModeNo , ModeIdIndex,pVBInfo ) ;
- XGI_SetAntiFlicker( ModeNo , ModeIdIndex,pVBInfo ) ;
+ if (pVBInfo->VBInfo & SetCRT2ToTV) {
+ /* GetPart2IO() */
+ XGI_SetPhaseIncr(pVBInfo);
+ XGI_SetYFilter(ModeNo, ModeIdIndex, pVBInfo);
+ XGI_SetAntiFlicker(ModeNo, ModeIdIndex, pVBInfo);
- if ( pVBInfo->VBType&VB_XGI301)
- XGI_SetEdgeEnhance( ModeNo , ModeIdIndex ,pVBInfo) ;
- }
+ if (pVBInfo->VBType & VB_XGI301)
+ XGI_SetEdgeEnhance(ModeNo, ModeIdIndex, pVBInfo);
+ }
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetDelayComp */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
void XGI_SetDelayComp(struct vb_device_info *pVBInfo)
{
- unsigned short index ;
-
- unsigned char tempah ,
- tempbl ,
- tempbh ;
-
- if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) )
- {
- if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA | SetCRT2ToTV | SetCRT2ToRAMDAC ) )
- {
- tempbl = 0;
- tempbh = 0;
-
- index = XGI_GetTVPtrIndex(pVBInfo ) ; /* Get TV Delay */
- tempbl = pVBInfo->XGI_TVDelayList[ index ] ;
-
- if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) )
- tempbl = pVBInfo->XGI_TVDelayList2[ index ] ;
-
- if ( pVBInfo->VBInfo & SetCRT2ToDualEdge )
- tempbl = tempbl >> 4 ;
-/*
- if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC )
- tempbl = CRT2Delay1 ; // Get CRT2 Delay
-
- if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) )
- tempbl = CRT2Delay2 ;
-*/
- if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) )
- {
- index = XGI_GetLCDCapPtr(pVBInfo) ; /* Get LCD Delay */
- tempbh=pVBInfo->LCDCapList[ index ].LCD_DelayCompensation ;
-
- if ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) )
- tempbl = tempbh ;
- }
-
- tempbl &= 0x0F ;
- tempbh &= 0xF0 ;
- tempah = XGINew_GetReg1( pVBInfo->Part1Port , 0x2D ) ;
-
- if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToLCD | SetCRT2ToTV ) ) /* Channel B */
- {
- tempah &= 0xF0 ;
- tempah |= tempbl ;
- }
-
- if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) /* Channel A */
- {
- tempah &= 0x0F ;
- tempah |= tempbh ;
- }
- XGINew_SetReg1(pVBInfo->Part1Port,0x2D,tempah);
- }
- }
- else if ( pVBInfo->IF_DEF_LVDS == 1 )
- {
- tempbl = 0;
- tempbh = 0;
- if ( pVBInfo->VBInfo & SetCRT2ToLCD )
- {
- tempah = pVBInfo->LCDCapList[ XGI_GetLCDCapPtr(pVBInfo) ].LCD_DelayCompensation ; /* / Get LCD Delay */
- tempah &= 0x0f ;
- tempah = tempah << 4 ;
- XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2D , 0x0f , tempah ) ;
- }
- }
+ unsigned short index;
+
+ unsigned char tempah, tempbl, tempbh;
+
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C)) {
+ if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA
+ | SetCRT2ToTV | SetCRT2ToRAMDAC)) {
+ tempbl = 0;
+ tempbh = 0;
+
+ index = XGI_GetTVPtrIndex(pVBInfo); /* Get TV Delay */
+ tempbl = pVBInfo->XGI_TVDelayList[index];
+
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B
+ | VB_XGI301LV | VB_XGI302LV
+ | VB_XGI301C))
+ tempbl = pVBInfo->XGI_TVDelayList2[index];
+
+ if (pVBInfo->VBInfo & SetCRT2ToDualEdge)
+ tempbl = tempbl >> 4;
+ /*
+ if (pVBInfo->VBInfo & SetCRT2ToRAMDAC)
+ tempbl = CRT2Delay1; // Get CRT2 Delay
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C))
+ tempbl = CRT2Delay2;
+ */
+ if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
+ index = XGI_GetLCDCapPtr(pVBInfo); /* Get LCD Delay */
+ tempbh = pVBInfo->LCDCapList[index].LCD_DelayCompensation;
+
+ if (!(pVBInfo->VBInfo & SetCRT2ToLCDA))
+ tempbl = tempbh;
+ }
+
+ tempbl &= 0x0F;
+ tempbh &= 0xF0;
+ tempah = XGINew_GetReg1(pVBInfo->Part1Port, 0x2D);
+
+ if (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToLCD
+ | SetCRT2ToTV)) { /* Channel B */
+ tempah &= 0xF0;
+ tempah |= tempbl;
+ }
+
+ if (pVBInfo->VBInfo & SetCRT2ToLCDA) { /* Channel A */
+ tempah &= 0x0F;
+ tempah |= tempbh;
+ }
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x2D, tempah);
+ }
+ } else if (pVBInfo->IF_DEF_LVDS == 1) {
+ tempbl = 0;
+ tempbh = 0;
+ if (pVBInfo->VBInfo & SetCRT2ToLCD) {
+ tempah
+ = pVBInfo->LCDCapList[XGI_GetLCDCapPtr(
+ pVBInfo)].LCD_DelayCompensation; /* / Get LCD Delay */
+ tempah &= 0x0f;
+ tempah = tempah << 4;
+ XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2D, 0x0f,
+ tempah);
+ }
+ }
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetLCDCap */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
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));
+ 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));
}
- /* 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 ) ;
+ 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);
+ }
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetLCDCap_A */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
void XGI_SetLCDCap_A(unsigned short tempcx, struct vb_device_info *pVBInfo)
{
- unsigned short temp ;
+ unsigned short temp;
- temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ;
+ temp = XGINew_GetReg1(pVBInfo->P3d4, 0x37);
- if ( temp & LCDRGB18Bit )
- {
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, 0x0F,
- (unsigned short)(0x20 | (tempcx & 0x00C0))); /* Enable Dither */
- XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x1A , 0x7F , 0x80 ) ;
- }
- else
- {
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, 0x0F,
- (unsigned short)(0x30 | (tempcx & 0x00C0)));
- XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x1A , 0x7F , 0x00 ) ;
- }
+ if (temp & LCDRGB18Bit) {
+ XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, 0x0F,
+ (unsigned short) (0x20 | (tempcx & 0x00C0))); /* Enable Dither */
+ XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x1A, 0x7F, 0x80);
+ } else {
+ XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, 0x0F,
+ (unsigned short) (0x30 | (tempcx & 0x00C0)));
+ XGINew_SetRegANDOR(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);
- }
- else
- {
- XGINew_SetRegANDOR(pVBInfo->Part1Port,0x19, 0x0F,(unsigned short)(0x20|(tempcx&0x00C0)) ); // Enable Dither
- XGINew_SetRegANDOR(pVBInfo->Part1Port,0x1A,0x7F,0x80);
- }
-*/
+ /*
+ if (tempcx & EnableLCD24bpp) { // 24bits
+ XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, 0x0F, (unsigned short)(0x30 | (tempcx&0x00C0)));
+ XGINew_SetRegANDOR(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);
+ }
+ */
}
-
/* --------------------------------------------------------------------- */
/* Function : XGI_SetLCDCap_B */
/* Input : cx -> LCD Capability */
@@ -9365,41 +8069,39 @@ void XGI_SetLCDCap_A(unsigned short tempcx, struct vb_device_info *pVBInfo)
/* --------------------------------------------------------------------- */
void XGI_SetLCDCap_B(unsigned short tempcx, struct vb_device_info *pVBInfo)
{
- if ( tempcx & EnableLCD24bpp ) /* 24bits */
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x1A, 0xE0,
- (unsigned short)(((tempcx & 0x00ff) >> 6) | 0x0c));
- else
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x1A, 0xE0,
- (unsigned short)(((tempcx & 0x00ff) >> 6) | 0x18)); /* Enable Dither */
+ if (tempcx & EnableLCD24bpp) /* 24bits */
+ XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x1A, 0xE0,
+ (unsigned short) (((tempcx & 0x00ff) >> 6)
+ | 0x0c));
+ else
+ XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x1A, 0xE0,
+ (unsigned short) (((tempcx & 0x00ff) >> 6)
+ | 0x18)); /* Enable Dither */
}
-
-/* --------------------------------------------------------------------- */
-/* Function : SetSpectrum */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
void SetSpectrum(struct vb_device_info *pVBInfo)
{
- unsigned short index ;
+ unsigned short index;
- index = XGI_GetLCDCapPtr(pVBInfo) ;
+ index = XGI_GetLCDCapPtr(pVBInfo);
- XGINew_SetRegAND( pVBInfo->Part4Port , 0x30 , 0x8F ) ; /* disable down spectrum D[4] */
- XGI_LongWait(pVBInfo) ;
- XGINew_SetRegOR( pVBInfo->Part4Port , 0x30 , 0x20 ) ; /* reset spectrum */
- XGI_LongWait(pVBInfo) ;
+ XGINew_SetRegAND(pVBInfo->Part4Port, 0x30, 0x8F); /* disable down spectrum D[4] */
+ XGI_LongWait(pVBInfo);
+ XGINew_SetRegOR(pVBInfo->Part4Port, 0x30, 0x20); /* reset spectrum */
+ XGI_LongWait(pVBInfo);
- XGINew_SetReg1( pVBInfo->Part4Port , 0x31 , pVBInfo->LCDCapList[ index ].Spectrum_31 ) ;
- XGINew_SetReg1( pVBInfo->Part4Port , 0x32 , pVBInfo->LCDCapList[ index ].Spectrum_32 ) ;
- XGINew_SetReg1( pVBInfo->Part4Port , 0x33 , pVBInfo->LCDCapList[ index ].Spectrum_33 ) ;
- XGINew_SetReg1( pVBInfo->Part4Port , 0x34 , pVBInfo->LCDCapList[ index ].Spectrum_34 ) ;
- XGI_LongWait(pVBInfo) ;
- XGINew_SetRegOR( pVBInfo->Part4Port , 0x30 , 0x40 ) ; /* enable spectrum */
+ XGINew_SetReg1(pVBInfo->Part4Port, 0x31,
+ pVBInfo->LCDCapList[index].Spectrum_31);
+ XGINew_SetReg1(pVBInfo->Part4Port, 0x32,
+ pVBInfo->LCDCapList[index].Spectrum_32);
+ XGINew_SetReg1(pVBInfo->Part4Port, 0x33,
+ pVBInfo->LCDCapList[index].Spectrum_33);
+ XGINew_SetReg1(pVBInfo->Part4Port, 0x34,
+ pVBInfo->LCDCapList[index].Spectrum_34);
+ XGI_LongWait(pVBInfo);
+ XGINew_SetRegOR(pVBInfo->Part4Port, 0x30, 0x40); /* enable spectrum */
}
-
/* --------------------------------------------------------------------- */
/* Function : XGI_SetAntiFlicker */
/* Input : */
@@ -9407,193 +8109,153 @@ void SetSpectrum(struct vb_device_info *pVBInfo)
/* Description : Set TV Customized Param. */
/* --------------------------------------------------------------------- */
void XGI_SetAntiFlicker(unsigned short ModeNo, unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo)
+ struct vb_device_info *pVBInfo)
{
- unsigned short tempbx ,
- index ;
+ unsigned short tempbx, index;
- unsigned char tempah ;
+ unsigned char tempah;
- if (pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) )
- return ;
+ if (pVBInfo->TVInfo & (SetYPbPrMode525p | SetYPbPrMode750p))
+ return;
- tempbx = XGI_GetTVPtrIndex(pVBInfo ) ;
- tempbx &= 0xFE ;
+ tempbx = XGI_GetTVPtrIndex(pVBInfo);
+ tempbx &= 0xFE;
- if ( ModeNo <= 0x13 )
- {
- index = pVBInfo->SModeIDTable[ ModeIdIndex ].VB_StTVFlickerIndex ;
- }
- else
- {
- index = pVBInfo->EModeIDTable[ ModeIdIndex ].VB_ExtTVFlickerIndex ;
- }
+ if (ModeNo <= 0x13)
+ index = pVBInfo->SModeIDTable[ModeIdIndex].VB_StTVFlickerIndex;
+ else
+ index = pVBInfo->EModeIDTable[ModeIdIndex].VB_ExtTVFlickerIndex;
- tempbx += index ;
- tempah = TVAntiFlickList[ tempbx ] ;
- tempah = tempah << 4 ;
+ tempbx += index;
+ tempah = TVAntiFlickList[tempbx];
+ tempah = tempah << 4;
- XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x0A , 0x8F , tempah ) ;
+ XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x0A, 0x8F, tempah);
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetEdgeEnhance */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_SetEdgeEnhance(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)
{
- unsigned short tempbx ,
- index ;
-
- unsigned char tempah ;
+ unsigned short tempbx, index;
+ unsigned char tempah;
- tempbx = XGI_GetTVPtrIndex(pVBInfo ) ;
- tempbx &= 0xFE ;
+ tempbx = XGI_GetTVPtrIndex(pVBInfo);
+ tempbx &= 0xFE;
- if ( ModeNo <= 0x13 )
- {
- index = pVBInfo->SModeIDTable[ ModeIdIndex ].VB_StTVEdgeIndex ;
- }
- else
- {
- index = pVBInfo->EModeIDTable[ ModeIdIndex ].VB_ExtTVEdgeIndex ;
- }
+ if (ModeNo <= 0x13)
+ index = pVBInfo->SModeIDTable[ModeIdIndex].VB_StTVEdgeIndex;
+ else
+ index = pVBInfo->EModeIDTable[ModeIdIndex].VB_ExtTVEdgeIndex;
- tempbx += index ;
- tempah = TVEdgeList[ tempbx ] ;
- tempah = tempah << 5 ;
+ tempbx += index;
+ tempah = TVEdgeList[tempbx];
+ tempah = tempah << 5;
- XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x3A , 0x1F , tempah ) ;
+ XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x3A, 0x1F, tempah);
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetPhaseIncr */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
void XGI_SetPhaseIncr(struct vb_device_info *pVBInfo)
{
- unsigned short tempbx ;
+ unsigned short tempbx;
- unsigned char tempcl ,
- tempch ;
+ unsigned char tempcl, tempch;
- unsigned long tempData ;
+ unsigned long tempData;
- XGI_GetTVPtrIndex2( &tempbx , &tempcl , &tempch, pVBInfo ) ; /* bx, cl, ch */
- tempData = TVPhaseList[ tempbx ] ;
+ XGI_GetTVPtrIndex2(&tempbx, &tempcl, &tempch, pVBInfo); /* bx, cl, ch */
+ tempData = TVPhaseList[tempbx];
- XGINew_SetReg1(pVBInfo->Part2Port, 0x31,
- (unsigned short)(tempData & 0x000000FF));
- XGINew_SetReg1(pVBInfo->Part2Port, 0x32,
- (unsigned short)((tempData & 0x0000FF00) >> 8));
- XGINew_SetReg1(pVBInfo->Part2Port, 0x33,
- (unsigned short)((tempData & 0x00FF0000) >> 16));
- XGINew_SetReg1(pVBInfo->Part2Port, 0x34,
- (unsigned short)((tempData & 0xFF000000) >> 24));
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x31, (unsigned short) (tempData
+ & 0x000000FF));
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x32, (unsigned short) ((tempData
+ & 0x0000FF00) >> 8));
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x33, (unsigned short) ((tempData
+ & 0x00FF0000) >> 16));
+ XGINew_SetReg1(pVBInfo->Part2Port, 0x34, (unsigned short) ((tempData
+ & 0xFF000000) >> 24));
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetYFilter */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
void XGI_SetYFilter(unsigned short ModeNo, unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo)
-{
- unsigned short tempbx ,
- index ;
-
- unsigned char tempcl ,
- tempch ,
- tempal ,
- *filterPtr ;
-
- XGI_GetTVPtrIndex2( &tempbx , &tempcl , &tempch, pVBInfo ) ; /* bx, cl, ch */
-
- switch( tempbx )
- {
- case 0x00:
- case 0x04:
- filterPtr = NTSCYFilter1 ;
- break ;
-
- case 0x01:
- filterPtr = PALYFilter1 ;
- break ;
-
- case 0x02:
- case 0x05:
- case 0x0D:
- filterPtr = PALMYFilter1 ;
- break ;
-
- case 0x03:
- filterPtr = PALNYFilter1 ;
- break ;
-
- case 0x08:
- case 0x0C:
- filterPtr = NTSCYFilter2 ;
- break ;
-
- case 0x0A:
- filterPtr = PALMYFilter2 ;
- break ;
-
- case 0x0B:
- filterPtr = PALNYFilter2 ;
- break ;
-
- case 0x09:
- filterPtr = PALYFilter2 ;
- break ;
-
- default:
- return ;
- }
-
- if ( ModeNo <= 0x13 )
- tempal = pVBInfo->SModeIDTable[ ModeIdIndex ].VB_StTVYFilterIndex ;
- else
- tempal = pVBInfo->EModeIDTable[ ModeIdIndex ].VB_ExtTVYFilterIndex ;
-
- if ( tempcl == 0 )
- index = tempal * 4;
- else
- 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++ ] ) ;
- }
- 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++ ] ) ;
- }
-
- 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++ ] ) ;
- }
-}
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short tempbx, index;
+
+ unsigned char tempcl, tempch, tempal, *filterPtr;
+
+ XGI_GetTVPtrIndex2(&tempbx, &tempcl, &tempch, pVBInfo); /* bx, cl, ch */
+
+ switch (tempbx) {
+ case 0x00:
+ case 0x04:
+ filterPtr = NTSCYFilter1;
+ break;
+ case 0x01:
+ filterPtr = PALYFilter1;
+ break;
+
+ case 0x02:
+ case 0x05:
+ case 0x0D:
+ filterPtr = PALMYFilter1;
+ break;
+
+ case 0x03:
+ filterPtr = PALNYFilter1;
+ break;
+
+ case 0x08:
+ case 0x0C:
+ filterPtr = NTSCYFilter2;
+ break;
+
+ case 0x0A:
+ filterPtr = PALMYFilter2;
+ break;
+
+ case 0x0B:
+ filterPtr = PALNYFilter2;
+ break;
+
+ case 0x09:
+ filterPtr = PALYFilter2;
+ break;
+
+ default:
+ return;
+ }
+
+ if (ModeNo <= 0x13)
+ tempal = pVBInfo->SModeIDTable[ModeIdIndex].VB_StTVYFilterIndex;
+ else
+ tempal
+ = pVBInfo->EModeIDTable[ModeIdIndex].VB_ExtTVYFilterIndex;
+
+ if (tempcl == 0)
+ index = tempal * 4;
+ else
+ 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++]);
+ } 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++]);
+ }
+
+ 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++]);
+ }
+}
/* --------------------------------------------------------------------- */
/* Function : XGI_GetTVPtrIndex2 */
@@ -9612,42 +8274,41 @@ void XGI_SetYFilter(unsigned short ModeNo, unsigned short ModeIdIndex,
/* Description : */
/* --------------------------------------------------------------------- */
void XGI_GetTVPtrIndex2(unsigned short *tempbx, unsigned char *tempcl,
- unsigned char *tempch, struct vb_device_info *pVBInfo)
+ unsigned char *tempch, struct vb_device_info *pVBInfo)
{
- *tempbx = 0 ;
- *tempcl = 0 ;
- *tempch = 0 ;
+ *tempbx = 0;
+ *tempcl = 0;
+ *tempch = 0;
- if ( pVBInfo->TVInfo & SetPALTV )
- *tempbx = 1 ;
+ if (pVBInfo->TVInfo & SetPALTV)
+ *tempbx = 1;
- if ( pVBInfo->TVInfo & SetPALMTV )
- *tempbx = 2 ;
+ if (pVBInfo->TVInfo & SetPALMTV)
+ *tempbx = 2;
- if ( pVBInfo->TVInfo & SetPALNTV )
- *tempbx = 3 ;
+ if (pVBInfo->TVInfo & SetPALNTV)
+ *tempbx = 3;
- if ( pVBInfo->TVInfo & NTSC1024x768 )
- {
- *tempbx = 4 ;
- if ( pVBInfo->TVInfo & SetPALMTV )
- *tempbx = 5 ;
- }
+ 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)) {
+ 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)++ ;
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C))
+ (*tempch)++;
}
-
/* --------------------------------------------------------------------- */
/* Function : XGI_SetCRT2ModeRegs */
/* Input : */
@@ -9655,776 +8316,598 @@ void XGI_GetTVPtrIndex2(unsigned short *tempbx, unsigned char *tempcl,
/* Description : Origin code for crt2group */
/* --------------------------------------------------------------------- */
void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
- struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo)
-{
- unsigned short tempbl ;
- short tempcl ;
-
- unsigned char tempah ;
-
- /* XGINew_SetReg1( 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 &= ~0x10 ; /* BTRAMDAC */
- tempah |= 0x40 ; /* BTRAM */
-
- if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD ) )
- {
- tempah=0x40; /* BTDRAM */
- if ( ModeNo > 0x13 )
- {
- tempcl = pVBInfo->ModeType ;
- tempcl -= ModeVGA ;
- if ( tempcl >= 0 )
- {
- tempah = ( 0x008 >> tempcl ) ; /* BT Color */
- if ( tempah == 0 )
- tempah = 1 ;
- tempah |= 0x040 ;
- }
- }
- if ( pVBInfo->VBInfo & SetInSlaveMode )
- tempah ^= 0x50 ; /* BTDAC */
- }
- }
-
-/* 0210 shampoo
- if ( pVBInfo->VBInfo & DisableCRT2Display )
- {
- tempah = 0 ;
- }
-
- XGINew_SetReg1( pVBInfo->Part1Port , 0x00 , tempah ) ;
- if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD ) )
- {
- tempcl = pVBInfo->ModeType ;
- if ( ModeNo > 0x13 )
- {
- tempcl -= ModeVGA ;
- if ( ( tempcl > 0 ) || ( tempcl == 0 ) )
- {
- tempah=(0x008>>tempcl) ;
- if ( tempah == 0 )
- tempah = 1 ;
- tempah |= 0x040;
- }
- }
- else
- {
- tempah = 0x040 ;
- }
-
- if ( pVBInfo->VBInfo & SetInSlaveMode )
- {
- tempah = ( tempah ^ 0x050 ) ;
- }
- }
-*/
+ struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short tempbl;
+ short tempcl;
+
+ unsigned char tempah;
+
+ /* XGINew_SetReg1(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 &= ~0x10; /* BTRAMDAC */
+ tempah |= 0x40; /* BTRAM */
+
+ if (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToTV
+ | SetCRT2ToLCD)) {
+ tempah = 0x40; /* BTDRAM */
+ if (ModeNo > 0x13) {
+ tempcl = pVBInfo->ModeType;
+ tempcl -= ModeVGA;
+ if (tempcl >= 0) {
+ tempah = (0x008 >> tempcl); /* BT Color */
+ if (tempah == 0)
+ tempah = 1;
+ tempah |= 0x040;
+ }
+ }
+ if (pVBInfo->VBInfo & SetInSlaveMode)
+ tempah ^= 0x50; /* BTDAC */
+ }
+ }
- XGINew_SetReg1( pVBInfo->Part1Port , 0x00 , tempah ) ;
- tempah = 0x08 ;
- tempbl = 0xf0 ;
-
- if ( pVBInfo->VBInfo & DisableCRT2Display )
- XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2e , tempbl , tempah ) ;
- else
- {
- tempah = 0x00 ;
- tempbl = 0xff ;
-
- if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD | SetCRT2ToLCDA ) )
- {
- if ( ( pVBInfo->VBInfo & SetCRT2ToLCDA ) && ( !( pVBInfo->VBInfo & SetSimuScanMode ) ) )
- {
- tempbl &= 0xf7 ;
- tempah |= 0x01 ;
- XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2e , tempbl , tempah ) ;
- }
- else
- {
- if ( pVBInfo->VBInfo & SetCRT2ToLCDA )
- {
- tempbl &= 0xf7 ;
- tempah |= 0x01 ;
- }
-
- if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD ) )
- {
- tempbl &= 0xf8 ;
- tempah = 0x01 ;
-
- if ( !( pVBInfo->VBInfo & SetInSlaveMode ) )
- tempah |= 0x02 ;
-
- if ( !( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) )
- {
- tempah = tempah ^ 0x05 ;
- if ( !( pVBInfo->VBInfo & SetCRT2ToLCD ) )
- tempah = tempah ^ 0x01 ;
- }
-
- if ( !( pVBInfo->VBInfo & SetCRT2ToDualEdge ) )
- tempah |= 0x08 ;
- XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2e , tempbl , tempah ) ;
- }
- else
- XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2e , tempbl , tempah ) ;
- }
- }
- else
- XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2e , tempbl , tempah ) ;
- }
-
- if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD | SetCRT2ToLCDA ) )
- {
- tempah &= ( ~0x08 ) ;
- if ( ( pVBInfo->ModeType == ModeVGA ) && ( !( pVBInfo->VBInfo & SetInSlaveMode ) ) )
- {
- tempah |= 0x010 ;
- }
- tempah |= 0x080 ;
-
- if ( pVBInfo->VBInfo & SetCRT2ToTV )
- {
- /* if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) ) */
- /* { */
- tempah |= 0x020 ;
- if ( ModeNo > 0x13 )
- {
- if ( pVBInfo->VBInfo & DriverMode )
- tempah = tempah ^ 0x20 ;
- }
- /* } */
- }
-
- XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x0D , ~0x0BF , tempah ) ;
- tempah = 0 ;
-
- if ( pVBInfo->LCDInfo & SetLCDDualLink )
- tempah |= 0x40 ;
-
- if ( pVBInfo->VBInfo & SetCRT2ToTV )
- {
- /* if ( ( !( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) ) && ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) ) ) */
- /* { */
- if ( pVBInfo->TVInfo & RPLLDIV2XO )
- tempah |= 0x40 ;
- /* } */
- }
-
- if ( ( pVBInfo->LCDResInfo == Panel1280x1024 ) || ( pVBInfo->LCDResInfo == Panel1280x1024x75 ) )
- tempah |= 0x80 ;
-
- if ( pVBInfo->LCDResInfo == Panel1280x960 )
- tempah |= 0x80 ;
-
- XGINew_SetReg1( pVBInfo->Part4Port , 0x0C , tempah ) ;
- }
-
- if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) )
- {
- tempah = 0 ;
- tempbl = 0xfb ;
-
- if ( pVBInfo->VBInfo & SetCRT2ToDualEdge )
- {
- tempbl=0xff;
- if ( pVBInfo->VBInfo & SetCRT2ToLCDA )
- tempah |= 0x04 ; /* shampoo 0129 */
- }
-
- XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x13 , tempbl , tempah ) ;
- tempah = 0x00 ;
- tempbl = 0xcf ;
- if ( !( pVBInfo->VBInfo & DisableCRT2Display ) )
- {
- if ( pVBInfo->VBInfo & SetCRT2ToDualEdge )
- tempah |= 0x30 ;
- }
-
- XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2c , tempbl , tempah ) ;
- tempah = 0 ;
- tempbl = 0x3f ;
-
- if ( !( pVBInfo->VBInfo & DisableCRT2Display ) )
- {
- if ( pVBInfo->VBInfo & SetCRT2ToDualEdge )
- tempah |= 0xc0 ;
- }
- XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x21 , tempbl , tempah ) ;
- }
-
- tempah = 0 ;
- tempbl = 0x7f ;
- if ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) )
- {
- tempbl = 0xff ;
- if ( !( pVBInfo->VBInfo & SetCRT2ToDualEdge ) )
- tempah |= 0x80 ;
- }
-
- XGINew_SetRegANDOR( 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 ) ;
- }
- }
-}
+ /* 0210 shampoo
+ if (pVBInfo->VBInfo & DisableCRT2Display) {
+ tempah = 0;
+ }
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x00, tempah);
+ if (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD)) {
+ tempcl = pVBInfo->ModeType;
+ if (ModeNo > 0x13) {
+ tempcl -= ModeVGA;
+ if ((tempcl > 0) || (tempcl == 0)) {
+ tempah=(0x008>>tempcl) ;
+ if (tempah == 0)
+ tempah = 1;
+ tempah |= 0x040;
+ }
+ } else {
+ tempah = 0x040;
+ }
+
+ if (pVBInfo->VBInfo & SetInSlaveMode) {
+ tempah = (tempah ^ 0x050);
+ }
+ }
+ */
+
+ XGINew_SetReg1(pVBInfo->Part1Port, 0x00, tempah);
+ tempah = 0x08;
+ tempbl = 0xf0;
+
+ if (pVBInfo->VBInfo & DisableCRT2Display) {
+ XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2e, tempbl, tempah);
+ } else {
+ tempah = 0x00;
+ tempbl = 0xff;
+
+ if (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToTV
+ | SetCRT2ToLCD | SetCRT2ToLCDA)) {
+ if ((pVBInfo->VBInfo & SetCRT2ToLCDA)
+ && (!(pVBInfo->VBInfo & SetSimuScanMode))) {
+ tempbl &= 0xf7;
+ tempah |= 0x01;
+ XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2e,
+ tempbl, tempah);
+ } else {
+ if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
+ tempbl &= 0xf7;
+ tempah |= 0x01;
+ }
+
+ if (pVBInfo->VBInfo & (SetCRT2ToRAMDAC
+ | SetCRT2ToTV | SetCRT2ToLCD)) {
+ tempbl &= 0xf8;
+ tempah = 0x01;
+
+ if (!(pVBInfo->VBInfo & SetInSlaveMode))
+ tempah |= 0x02;
+
+ if (!(pVBInfo->VBInfo & SetCRT2ToRAMDAC)) {
+ tempah = tempah ^ 0x05;
+ if (!(pVBInfo->VBInfo
+ & SetCRT2ToLCD))
+ tempah = tempah ^ 0x01;
+ }
+
+ if (!(pVBInfo->VBInfo
+ & SetCRT2ToDualEdge))
+ tempah |= 0x08;
+ XGINew_SetRegANDOR(pVBInfo->Part1Port,
+ 0x2e, tempbl, tempah);
+ } else {
+ XGINew_SetRegANDOR(pVBInfo->Part1Port,
+ 0x2e, tempbl, tempah);
+ }
+ }
+ } else {
+ XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2e, tempbl,
+ tempah);
+ }
+ }
-/* --------------------------------------------------------------------- */
-/* Function : XGI_CloseCRTC */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_CloseCRTC(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
-{
- unsigned short tempbx ;
+ if (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD
+ | SetCRT2ToLCDA)) {
+ tempah &= (~0x08);
+ if ((pVBInfo->ModeType == ModeVGA) && (!(pVBInfo->VBInfo
+ & SetInSlaveMode))) {
+ tempah |= 0x010;
+ }
+ tempah |= 0x080;
+
+ if (pVBInfo->VBInfo & SetCRT2ToTV) {
+ /* if (!(pVBInfo->TVInfo & (SetYPbPrMode525p | SetYPbPrMode750p))) { */
+ tempah |= 0x020;
+ if (ModeNo > 0x13) {
+ if (pVBInfo->VBInfo & DriverMode)
+ tempah = tempah ^ 0x20;
+ }
+ /* } */
+ }
+
+ XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x0D, ~0x0BF, tempah);
+ tempah = 0;
+
+ if (pVBInfo->LCDInfo & SetLCDDualLink)
+ tempah |= 0x40;
+
+ if (pVBInfo->VBInfo & SetCRT2ToTV) {
+ /* if ((!(pVBInfo->VBInfo & SetCRT2ToHiVisionTV)) && (!(pVBInfo->TVInfo & (SetYPbPrMode525p | SetYPbPrMode750p)))) { */
+ if (pVBInfo->TVInfo & RPLLDIV2XO)
+ tempah |= 0x40;
+ /* } */
+ }
+
+ if ((pVBInfo->LCDResInfo == Panel1280x1024)
+ || (pVBInfo->LCDResInfo == Panel1280x1024x75))
+ tempah |= 0x80;
+
+ if (pVBInfo->LCDResInfo == Panel1280x960)
+ tempah |= 0x80;
+
+ XGINew_SetReg1(pVBInfo->Part4Port, 0x0C, tempah);
+ }
- tempbx = 0 ;
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C)) {
+ tempah = 0;
+ tempbl = 0xfb;
+
+ if (pVBInfo->VBInfo & SetCRT2ToDualEdge) {
+ tempbl = 0xff;
+ if (pVBInfo->VBInfo & SetCRT2ToLCDA)
+ tempah |= 0x04; /* shampoo 0129 */
+ }
+
+ XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x13, tempbl, tempah);
+ tempah = 0x00;
+ tempbl = 0xcf;
+ if (!(pVBInfo->VBInfo & DisableCRT2Display)) {
+ if (pVBInfo->VBInfo & SetCRT2ToDualEdge)
+ tempah |= 0x30;
+ }
+
+ XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2c, tempbl, tempah);
+ tempah = 0;
+ tempbl = 0x3f;
+
+ if (!(pVBInfo->VBInfo & DisableCRT2Display)) {
+ if (pVBInfo->VBInfo & SetCRT2ToDualEdge)
+ tempah |= 0xc0;
+ }
+ XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x21, tempbl, tempah);
+ }
- if ( pVBInfo->VBInfo & SetCRT2ToLCDA )
- tempbx = 0x08A0 ;
+ tempah = 0;
+ tempbl = 0x7f;
+ if (!(pVBInfo->VBInfo & SetCRT2ToLCDA)) {
+ tempbl = 0xff;
+ if (!(pVBInfo->VBInfo & SetCRT2ToDualEdge))
+ tempah |= 0x80;
+ }
+ XGINew_SetRegANDOR(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);
+ }
+ }
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_OpenCRTC */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_OpenCRTC(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
+void XGI_CloseCRTC(struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
{
- unsigned short tempbx ;
+ unsigned short tempbx;
- tempbx = 0 ;
+ tempbx = 0;
+ if (pVBInfo->VBInfo & SetCRT2ToLCDA)
+ tempbx = 0x08A0;
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GetRAMDAC2DATA */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-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 ;
+void XGI_OpenCRTC(struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short tempbx;
+ 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;
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GetColorDepth */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-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;
+ 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 ( ModeNo <= 0x13 )
- {
- modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ;
- }
- else
- {
- modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ;
- }
+ if (temp1 & 0x01)
+ tempbx |= 0x0100;
- index=(modeflag&ModeInfoFlag)-ModeEGA;
+ if (temp1 & 0x20)
+ tempbx |= 0x0200;
+ tempax += 5;
- if ( index < 0 )
- index = 0 ;
+ if (modeflag & Charx8Dot)
+ tempax *= 8;
+ else
+ tempax *= 9;
- return( ColorDepth[ index ] ) ;
+ 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;
-/* --------------------------------------------------------------------- */
-/* Function : XGI_UnLockCRT2 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_UnLockCRT2(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
-{
+ index = (modeflag & ModeInfoFlag) - ModeEGA;
- XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2f , 0xFF , 0x01 ) ;
+ if (index < 0)
+ index = 0;
+ return ColorDepth[index];
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_LockCRT2 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_LockCRT2(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
+void XGI_UnLockCRT2(struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
{
- XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2F , 0xFE , 0x00 ) ;
-
+ XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2f, 0xFF, 0x01);
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_EnableCRT2 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_EnableCRT2(struct vb_device_info *pVBInfo)
+void XGI_LockCRT2(struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
{
- XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x1E , 0xFF , 0x20 ) ;
-}
+ XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2F, 0xFE, 0x00);
+}
-/* --------------------------------------------------------------------- */
-/* Function : */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_LCD_Wait_Time(unsigned char DelayTime, struct vb_device_info *pVBInfo)
+void XGINew_EnableCRT2(struct vb_device_info *pVBInfo)
{
- unsigned short i ,
- j ;
-
- unsigned long temp ,
- flag ;
+ XGINew_SetRegANDOR(pVBInfo->P3c4, 0x1E, 0xFF, 0x20);
+}
- flag = 0 ;
-//printk("XGINew_LCD_Wait_Time");
-//return;
- for( i = 0 ; i < DelayTime ; i++ )
- {
- for( j = 0 ; j < 66 ; j++ )
- {
+void XGINew_LCD_Wait_Time(unsigned char DelayTime,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short i, j;
- temp = XGINew_GetReg3( 0x61 ) ;
+ unsigned long temp, flag;
- //temp &= 0x10000000;
- temp &= 0x10;
- if ( temp == flag )
- continue ;
+ 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;
- flag = temp ;
- }
- }
+ flag = temp;
+ }
+ }
}
-
-
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_BridgeIsOn */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
unsigned char XGI_BridgeIsOn(struct vb_device_info *pVBInfo)
{
- unsigned short flag ;
+ unsigned short flag;
- if ( pVBInfo->IF_DEF_LVDS == 1 )
- {
- return( 1 ) ;
- }
- else
- {
- flag = XGINew_GetReg1( pVBInfo->Part4Port , 0x00 ) ;
- if ( ( flag == 1 ) || ( flag == 2 ) )
- return( 1 ) ; /* 301b */
- else
- return( 0 ) ;
- }
+ if (pVBInfo->IF_DEF_LVDS == 1) {
+ return 1;
+ } else {
+ flag = XGINew_GetReg1(pVBInfo->Part4Port, 0x00);
+ if ((flag == 1) || (flag == 2))
+ return 1; /* 301b */
+ else
+ return 0;
+ }
}
-
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_LongWait */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
void XGI_LongWait(struct vb_device_info *pVBInfo)
{
- unsigned short i ;
+ unsigned short i;
- i = XGINew_GetReg1( pVBInfo->P3c4 , 0x1F ) ;
+ i = XGINew_GetReg1(pVBInfo->P3c4, 0x1F);
- if ( !( i & 0xC0 ) )
- {
- for( i = 0 ; i < 0xFFFF ; i++ )
- {
- if ( !( XGINew_GetReg2( pVBInfo->P3da ) & 0x08 ) )
- break ;
- }
+ if (!(i & 0xC0)) {
+ for (i = 0; i < 0xFFFF; i++) {
+ if (!(XGINew_GetReg2(pVBInfo->P3da) & 0x08))
+ break;
+ }
- for( i = 0 ; i < 0xFFFF ; i++ )
- {
- if ( ( XGINew_GetReg2( pVBInfo->P3da ) & 0x08 ) )
- break ;
+ for (i = 0; i < 0xFFFF; i++) {
+ if ((XGINew_GetReg2(pVBInfo->P3da) & 0x08))
+ break;
+ }
}
- }
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_VBLongWait */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
void XGI_VBLongWait(struct vb_device_info *pVBInfo)
{
- unsigned short tempal ,
- temp ,
- i ,
- j ;
-return ;
- if ( !( pVBInfo->VBInfo & SetCRT2ToTV ) )
- {
- temp = 0 ;
- for( i = 0 ; i < 3 ; i++ )
- {
- for( j = 0 ; j < 100 ; j++ )
- {
- tempal = XGINew_GetReg2( pVBInfo->P3da ) ;
- if ( temp & 0x01 )
- { /* VBWaitMode2 */
- if ( ( tempal & 0x08 ) )
- {
- continue ;
- }
-
- if ( !( tempal & 0x08 ) )
- {
- break ;
- }
- }
- else
- { /* VBWaitMode1 */
- if ( !( tempal & 0x08 ) )
- {
- continue ;
- }
-
- if ( ( tempal & 0x08 ) )
- {
- break ;
- }
- }
- }
- temp = temp ^ 0x01 ;
- }
- }
- else
- {
- XGI_LongWait(pVBInfo) ;
- }
- return ;
+ unsigned short tempal, temp, i, j;
+ return;
+ if (!(pVBInfo->VBInfo & SetCRT2ToTV)) {
+ temp = 0;
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 100; j++) {
+ tempal = XGINew_GetReg2(pVBInfo->P3da);
+ if (temp & 0x01) { /* VBWaitMode2 */
+ if ((tempal & 0x08))
+ continue;
+
+ if (!(tempal & 0x08))
+ break;
+
+ } else { /* VBWaitMode1 */
+ if (!(tempal & 0x08))
+ continue;
+
+ if ((tempal & 0x08))
+ break;
+ }
+ }
+ temp = temp ^ 0x01;
+ }
+ } else {
+ XGI_LongWait(pVBInfo);
+ }
+ return;
}
-
-
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GetVGAHT2 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
unsigned short XGI_GetVGAHT2(struct vb_device_info *pVBInfo)
{
- unsigned long tempax ,
- tempbx ;
+ unsigned long tempax, tempbx;
- tempbx = ( ( pVBInfo->VGAVT - pVBInfo->VGAVDE ) * pVBInfo->RVBHCMAX ) & 0xFFFF ;
- tempax = ( pVBInfo->VT - pVBInfo->VDE ) * pVBInfo->RVBHCFACT ;
- tempax = ( tempax * pVBInfo->HT ) /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 ) ;
+ return (unsigned short) tempax;
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GetVCLK2Ptr */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
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)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 ;
- }
- }
- }
- }
- 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 ) ;
+ 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) 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;
+ }
+ }
+ }
+ } 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;
}
diff --git a/drivers/staging/xgifb/vb_table.h b/drivers/staging/xgifb/vb_table.h
index 510ef76..78b1c79 100644
--- a/drivers/staging/xgifb/vb_table.h
+++ b/drivers/staging/xgifb/vb_table.h
@@ -1,7 +1,7 @@
#define Tap4
-struct XGI_MCLKDataStruct XGI330New_MCLKData[] =
+static struct XGI_MCLKDataStruct XGI330New_MCLKData[] =
{
{ 0x5c,0x23,0x01,166},
{ 0x5c,0x23,0x01,166},
@@ -13,7 +13,7 @@ struct XGI_MCLKDataStruct XGI330New_MCLKData[] =
{ 0x29,0x01,0x81,300}
};
//yilin modify for xgi20
-struct XGI_MCLKDataStruct XGI340New_MCLKData[] =
+static struct XGI_MCLKDataStruct XGI340New_MCLKData[] =
{
{ 0x16,0x01,0x01,166},
{ 0x19,0x02,0x01,124},
@@ -25,7 +25,7 @@ struct XGI_MCLKDataStruct XGI340New_MCLKData[] =
{ 0x5c,0x23,0x01,166}
};
-struct XGI_MCLKDataStruct XGI27New_MCLKData[] =
+static struct XGI_MCLKDataStruct XGI27New_MCLKData[] =
{
{ 0x5c,0x23,0x01,166},
{ 0x19,0x02,0x01,124},
@@ -37,7 +37,7 @@ struct XGI_MCLKDataStruct XGI27New_MCLKData[] =
{ 0x5c,0x23,0x01,166}
};
-struct XGI_ECLKDataStruct XGI330_ECLKData[] =
+static struct XGI_ECLKDataStruct XGI330_ECLKData[] =
{
{ 0x7c,0x08,0x01,200},
{ 0x7c,0x08,0x01,200},
@@ -49,7 +49,7 @@ struct XGI_ECLKDataStruct XGI330_ECLKData[] =
{ 0x29,0x01,0x81,300}
};
//yilin modify for xgi20
-struct XGI_ECLKDataStruct XGI340_ECLKData[] =
+static struct XGI_ECLKDataStruct XGI340_ECLKData[] =
{
{ 0x5c,0x23,0x01,166},
{ 0x55,0x84,0x01,123},
@@ -63,14 +63,14 @@ struct XGI_ECLKDataStruct XGI340_ECLKData[] =
-unsigned char XGI340_SR13[4][8] = {
+static unsigned char XGI340_SR13[4][8] = {
{0x35,0x45,0xb1,0x00,0x00,0x00,0x00,0x00},/* SR13 */
{0x41,0x51,0x5c,0x00,0x00,0x00,0x00,0x00},/* SR14 */
{0x31,0x42,0x42,0x00,0x00,0x00,0x00,0x00},/* SR18 */
{0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00}/* SR1B */
};
-unsigned char XGI340_cr41[24][8] =
+static unsigned char XGI340_cr41[24][8] =
{{0x20,0x50,0x60,0x00,0x00,0x00,0x00,0x00},/* 0 CR41 */
{0xc4,0x40,0x84,0x00,0x00,0x00,0x00,0x00},/* 1 CR8A */
{0xc4,0x40,0x84,0x00,0x00,0x00,0x00,0x00},/* 2 CR8B */
@@ -98,7 +98,7 @@ unsigned char XGI340_cr41[24][8] =
};
-unsigned char XGI27_cr41[24][8] =
+static unsigned char XGI27_cr41[24][8] =
{
{0x20,0x40,0x60,0x00,0x00,0x00,0x00,0x00},/* 0 CR41 */
{0xC4,0x40,0x84,0x00,0x00,0x00,0x00,0x00},/* 1 CR8A */
@@ -126,7 +126,7 @@ unsigned char XGI27_cr41[24][8] =
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}/* 23 CRC5 */
};
-unsigned char XGI340_CR6B[8][4] = {
+static unsigned char XGI340_CR6B[8][4] = {
{0xaa,0xaa,0xaa,0xaa},
{0xaa,0xaa,0xaa,0xaa},
{0xaa,0xaa,0xaa,0xaa},
@@ -137,7 +137,7 @@ unsigned char XGI340_CR6B[8][4] = {
{0x00,0x00,0x00,0x00}
};
-unsigned char XGI340_CR6E[8][4] = {
+static unsigned char XGI340_CR6E[8][4] = {
{0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00},
@@ -148,7 +148,7 @@ unsigned char XGI340_CR6E[8][4] = {
{0x00,0x00,0x00,0x00}
};
-unsigned char XGI340_CR6F[8][32] = {
+static unsigned char XGI340_CR6F[8][32] = {
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
@@ -159,7 +159,7 @@ unsigned char XGI340_CR6F[8][32] = {
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
};
-unsigned char XGI340_CR89[8][2] = {
+static unsigned char XGI340_CR89[8][2] = {
{0x00,0x00},
{0x00,0x00},
{0x00,0x00},
@@ -170,12 +170,14 @@ unsigned char XGI340_CR89[8][2] = {
{0x00,0x00}
};
/* CR47,CR48,CR49,CR4A,CR4B,CR4C,CR70,CR71,CR74,CR75,CR76,CR77 */
-unsigned char XGI340_AGPReg[12] = {0x28, 0x23, 0x00, 0x20, 0x00, 0x20, 0x00,
+static unsigned char XGI340_AGPReg[12] = {
+ 0x28, 0x23, 0x00, 0x20, 0x00, 0x20, 0x00,
0x05, 0xd0, 0x10, 0x10, 0x00};
-unsigned char XGI340_SR16[4] = {0x03, 0x83, 0x03, 0x83};
+static unsigned char XGI340_SR16[4] = {0x03, 0x83, 0x03, 0x83};
-unsigned char XGI330_SR15_1[8][8] = {
+#if 0
+static unsigned char XGI330_SR15_1[8][8] = {
{0x0,0x0,0x00,0x00,0x20,0x20,0x00,0x00},
{0x5,0x15,0x15,0x15,0x15,0x15,0x00,0x00},
{0xba,0xba,0xba,0xba,0xBA,0xBA,0x00,0x00},
@@ -186,7 +188,7 @@ unsigned char XGI330_SR15_1[8][8] = {
{0x0,0xa5,0xfb,0xf6,0xF6,0xF6,0x00,0x00}
};
-unsigned char XGI330_cr40_1[15][8] = {
+static unsigned char XGI330_cr40_1[15][8] = {
{0x66,0x40,0x40,0x28,0x24,0x24,0x00,0x00},
{0x66,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
@@ -203,15 +205,16 @@ unsigned char XGI330_cr40_1[15][8] = {
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0xA2,0x00,0x00,0xA2,0xA2,0x00,0x00},
};
+#endif
-unsigned char XGI330_sr25[] = {0x00, 0x0};
-unsigned char XGI330_sr31 = 0xc0;
-unsigned char XGI330_sr32 = 0x11;
-unsigned char XGI330_SR33 = 0x00;
-unsigned char XG40_CRCF = 0x13;
-unsigned char XG40_DRAMTypeDefinition = 0xFF ;
+static unsigned char XGI330_sr25[] = {0x00, 0x0};
+static unsigned char XGI330_sr31 = 0xc0;
+static unsigned char XGI330_sr32 = 0x11;
+static unsigned char XGI330_SR33 = 0x00;
+static unsigned char XG40_CRCF = 0x13;
+static unsigned char XG40_DRAMTypeDefinition = 0xFF ;
-struct XGI_StStruct XGI330_SModeIDTable[] =
+static struct XGI_StStruct XGI330_SModeIDTable[] =
{
{0x01,0x9208,0x01,0x00,0x10,0x00,0x00,0x01,0x00},
{0x01,0x1210,0x14,0x01,0x00,0x01,0x00,0x01,0x00},
@@ -236,7 +239,7 @@ struct XGI_StStruct XGI330_SModeIDTable[] =
};
-struct XGI_ExtStruct XGI330_EModeIDTable[] =
+static struct XGI_ExtStruct XGI330_EModeIDTable[] =
{
{0x6a,0x2212,0x0407,0x3a81,0x0102,0x08,0x07,0x00,0x00,0x07,0x0e},
{0x2e,0x0a1b,0x0306,0x3a57,0x0101,0x08,0x06,0x00,0x00,0x05,0x06},
@@ -308,7 +311,7 @@ struct XGI_ExtStruct XGI330_EModeIDTable[] =
{0xff,0x0000,0x0000,0x0000,0x0000,0x00,0x00,0x00,0x00,0x00,0x00}
};
-struct XGI_StandTableStruct XGI330_StandTable[] =
+static struct XGI_StandTableStruct XGI330_StandTable[] =
{
/* MD_0_200 */
{
@@ -746,13 +749,13 @@ struct XGI_StandTableStruct XGI330_StandTable[] =
}
};
-struct XGI_TimingHStruct XGI_TimingH[] =
+static struct XGI_TimingHStruct XGI_TimingH[] =
{{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}};
-struct XGI_TimingVStruct XGI_TimingV[] =
+static struct XGI_TimingVStruct XGI_TimingV[] =
{{{0x00,0x00,0x00,0x00,0x00,0x00,0x00}}};
-struct XGI_XG21CRT1Struct XGI_UpdateCRT1Table[] =
+static struct XGI_XG21CRT1Struct XGI_UpdateCRT1Table[] =
{
{0x01,0x27,0x91,0x8f,0xc0}, /* 00 */
{0x03,0x4f,0x83,0x8f,0xc0}, /* 01 */
@@ -773,7 +776,7 @@ struct XGI_XG21CRT1Struct XGI_UpdateCRT1Table[] =
{0x59,0x27,0x91,0x8f,0xc0} /* 16 */
};
-struct XGI_CRT1TableStruct XGI_CRT1Table[] =
+static struct XGI_CRT1TableStruct XGI_CRT1Table[] =
{
{{0x2d,0x28,0x90,0x2c,0x90,0x00,0x04,0x00,
0xbf,0x1f,0x9c,0x8e,0x96,0xb9,0x30}}, /* 0x0 */
@@ -921,7 +924,8 @@ struct XGI_CRT1TableStruct XGI_CRT1Table[] =
0x03,0xDE,0xC0,0x84,0xBF,0x04,0x90}} /* 0x47 */
};
-struct XGI330_CHTVRegDataStruct XGI_CHTVRegUNTSC[] = {
+#if 0
+static struct XGI330_CHTVRegDataStruct XGI_CHTVRegUNTSC[] = {
/* Index:000h,001h,002h,004h,003h,005h,006h,007h,008h,015h,01Fh,00Ch,00Dh,00Eh,00Fh,010h */
{{ 0x4A,0x77,0xBB,0x94,0x84,0x48,0xFE,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01 }},/* 00 (640x200,640x400) */
{{ 0x4A,0x77,0xBB,0x94,0x84,0x48,0xFE,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01 }},/* 01 (640x350) */
@@ -932,7 +936,7 @@ struct XGI330_CHTVRegDataStruct XGI_CHTVRegUNTSC[] = {
{{ 0xEE,0x77,0xBB,0x66,0x87,0x32,0x01,0x5A,0x04,0x00,0x80,0x1B,0xD4,0x2F,0x6F,0x00 }}/* 06 (1024x768) ;;5/6/02 */
};
-struct XGI330_CHTVRegDataStruct XGI_CHTVRegONTSC[] = {
+static struct XGI330_CHTVRegDataStruct XGI_CHTVRegONTSC[] = {
/* Index:000h,001h,002h,004h,003h,005h,006h,007h,008h,015h,01Fh,00Ch,00Dh,00Eh,00Fh,010h */
{{ 0x49,0x77,0xBB,0x7B,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01 }},/* 00 (640x200,640x400) */
{{ 0x49,0x77,0xBB,0x7B,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01 }},/* 01 (640x350) */
@@ -943,7 +947,7 @@ struct XGI330_CHTVRegDataStruct XGI_CHTVRegONTSC[] = {
{{ 0xED,0x77,0xBB,0x66,0x8C,0x21,0x02,0x5A,0x04,0x00,0x80,0x1F,0xA0,0x7E,0x73,0x00 }}/* 06 (1024x768) ;;5/6/02 */
};
-struct XGI330_CHTVRegDataStruct XGI_CHTVRegUPAL[] = {
+static struct XGI330_CHTVRegDataStruct XGI_CHTVRegUPAL[] = {
/* Index:000h,001h,002h,004h,003h,005h,006h,007h,008h,015h,01Fh,00Ch,00Dh,00Eh,00Fh,010h */
{{ 0x41,0x7F,0xB7,0x34,0xAD,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01 }},/* ; 00 (640x200,640x400) */
{{ 0x41,0x7F,0xB7,0x80,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01 }},/* ; 01 (640x350) */
@@ -954,7 +958,7 @@ struct XGI330_CHTVRegDataStruct XGI_CHTVRegUPAL[] = {
{{ 0xE5,0x7F,0xB7,0x1D,0xA7,0x3E,0x04,0x5A,0x05,0x00,0x80,0x20,0x3E,0xE4,0x22,0x00 }}/* ; 06 (1024x768) ;;1/12/02 */
};
-struct XGI330_CHTVRegDataStruct XGI_CHTVRegOPAL[] = {
+static struct XGI330_CHTVRegDataStruct XGI_CHTVRegOPAL[] = {
/* Index:000,0x01,0x02,0x04,0x03,0x05,0x06,0x07,0x08,0x15,0x1F,0x0C,0x0D,0x0E,0x0F,0x10h */
{{ 0x41,0x7F,0xB7,0x36,0xAD,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01 }},/* 00 (640x200,640x400) */
{{ 0x41,0x7F,0xB7,0x86,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01 }},/* 01 (640x350) */
@@ -964,15 +968,18 @@ struct XGI330_CHTVRegDataStruct XGI_CHTVRegOPAL[] = {
{{ 0xC1,0x7F,0xB7,0x4D,0x8C,0x1E,0x31,0x5A,0x05,0x00,0x80,0x26,0x78,0x19,0x34,0x00 }},/* 05 (800x600) ;;1/12/02 */
{{ 0xE4,0x7F,0xB7,0x1E,0xAF,0x29,0x37,0x5A,0x05,0x00,0x80,0x25,0x8C,0xB2,0x2A,0x00 }}/* 06 (1024x768) ;;1/12/02 */
};
+#endif
-unsigned char XGI_CH7017LV1024x768[] = {0x60, 0x02, 0x00, 0x07, 0x40, 0xED, 0xA3,
+static unsigned char XGI_CH7017LV1024x768[] = {
+ 0x60, 0x02, 0x00, 0x07, 0x40, 0xED, 0xA3,
0xC8, 0xC7, 0xAC, 0xE0, 0x02};
-unsigned char XGI_CH7017LV1400x1050[] = {0x60, 0x03, 0x11, 0x00, 0x40, 0xE3, 0xAD,
+static unsigned char XGI_CH7017LV1400x1050[] = {
+ 0x60, 0x03, 0x11, 0x00, 0x40, 0xE3, 0xAD,
0xDB, 0xF6, 0xAC, 0xE0, 0x02};
/*add for new UNIVGABIOS*/
-struct XGI330_LCDDataStruct XGI_StLCD1024x768Data[] =
+static struct XGI330_LCDDataStruct XGI_StLCD1024x768Data[] =
{
{ 62, 25, 800, 546,1344, 806},
{ 32, 15, 930, 546,1344, 806},
@@ -983,7 +990,7 @@ struct XGI330_LCDDataStruct XGI_StLCD1024x768Data[] =
{ 1, 1,1344, 806,1344, 806}
};
-struct XGI330_LCDDataStruct XGI_ExtLCD1024x768Data[] =
+static struct XGI330_LCDDataStruct XGI_ExtLCD1024x768Data[] =
{
{ 42, 25,1536, 419,1344, 806}, /* { 12, 5, 896, 512,1344, 806}, // alan 09/12/2003 */
{ 48, 25,1536, 369,1344, 806}, /* { 12, 5, 896, 510,1344, 806}, // alan 09/12/2003 */
@@ -1011,7 +1018,7 @@ struct XGI330_LCDDataStruct XGI_ExtLCD1024x768Data[] =
{ 1, 1,1344, 806,1344, 806}
};*/
-struct XGI330_LCDDataStruct XGI_CetLCD1024x768Data[] =
+static struct XGI330_LCDDataStruct XGI_CetLCD1024x768Data[] =
{
{ 1,1,1344,806,1344,806 }, /* ; 00 (320x200,320x400,640x200,640x400) */
{ 1,1,1344,806,1344,806 }, /* 01 (320x350,640x350) */
@@ -1022,7 +1029,7 @@ struct XGI330_LCDDataStruct XGI_CetLCD1024x768Data[] =
{ 1,1,1344,806,1344,806 } /* 06 (1024x768x60Hz) */
};
-struct XGI330_LCDDataStruct XGI_StLCD1280x1024Data[] =
+static struct XGI330_LCDDataStruct XGI_StLCD1280x1024Data[] =
{
{ 22, 5, 800, 510,1650,1088},
{ 22, 5, 800, 510,1650,1088},
@@ -1034,7 +1041,7 @@ struct XGI330_LCDDataStruct XGI_StLCD1280x1024Data[] =
{ 1, 1,1688,1066,1688,1066}
};
-struct XGI330_LCDDataStruct XGI_ExtLCD1280x1024Data[] =
+static struct XGI330_LCDDataStruct XGI_ExtLCD1280x1024Data[] =
{
{ 211, 60,1024, 501,1688,1066},
{ 211, 60,1024, 508,1688,1066},
@@ -1046,7 +1053,8 @@ struct XGI330_LCDDataStruct XGI_ExtLCD1280x1024Data[] =
{ 1, 1,1688,1066,1688,1066}
};
-struct XGI330_LCDDataStruct XGI_St2LCD1280x1024Data[] =
+#if 0
+static struct XGI330_LCDDataStruct XGI_St2LCD1280x1024Data[] =
{
{ 22, 5, 800, 510,1650,1088},
{ 22, 5, 800, 510,1650,1088},
@@ -1057,8 +1065,9 @@ struct XGI330_LCDDataStruct XGI_St2LCD1280x1024Data[] =
{ 16, 9,1266, 804,1688,1072},
{ 1, 1,1688,1066,1688,1066}
};
+#endif
-struct XGI330_LCDDataStruct XGI_CetLCD1280x1024Data[] =
+static struct XGI330_LCDDataStruct XGI_CetLCD1280x1024Data[] =
{
{ 1,1,1688,1066,1688,1066 }, /* 00 (320x200,320x400,640x200,640x400) */
{ 1,1,1688,1066,1688,1066 }, /* 01 (320x350,640x350) */
@@ -1071,7 +1080,7 @@ struct XGI330_LCDDataStruct XGI_CetLCD1280x1024Data[] =
{ 1,1,1688,1066,1688,1066 } /* 08 (1400x1050x60Hz) */
};
-struct XGI330_LCDDataStruct XGI_StLCD1400x1050Data[] =
+static struct XGI330_LCDDataStruct XGI_StLCD1400x1050Data[] =
{
{ 211,100,2100,408,1688,1066 }, /* 00 (320x200,320x400,640x200,640x400) */
{ 211,64,1536,358,1688,1066 }, /* 01 (320x350,640x350) */
@@ -1084,7 +1093,7 @@ struct XGI330_LCDDataStruct XGI_StLCD1400x1050Data[] =
{ 1,1,1688,1066,1688,1066 } /* 08 (1400x1050x60Hz) */
};
-struct XGI330_LCDDataStruct XGI_ExtLCD1400x1050Data[] =
+static struct XGI330_LCDDataStruct XGI_ExtLCD1400x1050Data[] =
{
{ 211,100,2100,408,1688,1066 }, /* 00 (320x200,320x400,640x200,640x400) */
{ 211,64,1536,358,1688,1066 }, /* 01 (320x350,640x350) */
@@ -1097,7 +1106,7 @@ struct XGI330_LCDDataStruct XGI_ExtLCD1400x1050Data[] =
{ 1,1,1688,1066,1688,1066 } /* 08 (1400x1050x60Hz) */
};
-struct XGI330_LCDDataStruct XGI_ExtLCD1600x1200Data[] =
+static struct XGI330_LCDDataStruct XGI_ExtLCD1600x1200Data[] =
{
{ 4,1,1620,420,2160,1250 }, /* { 3,1,2160,425,2160,1250 }, // 00 (320x200,320x400,640x200,640x400) // alan 10/14/2003 */
{ 27,7,1920,375,2160,1250 }, /* 01 (320x350,640x350) */
@@ -1111,7 +1120,7 @@ struct XGI330_LCDDataStruct XGI_ExtLCD1600x1200Data[] =
{ 1,1,2160,1250,2160,1250 } /* 09 (1600x1200x60Hz) ;302lv */
};
-struct XGI330_LCDDataStruct XGI_StLCD1600x1200Data[] =
+static struct XGI330_LCDDataStruct XGI_StLCD1600x1200Data[] =
{
{ 27,4,800,500,2160,1250 },/* 00 (320x200,320x400,640x200,640x400) */
{ 27,4,800,500,2160,1250 },/* 01 (320x350,640x350) */
@@ -1125,7 +1134,7 @@ struct XGI330_LCDDataStruct XGI_StLCD1600x1200Data[] =
{ 1,1,2160,1250,2160,1250 } /* 09 (1600x1200) */
};
-struct XGI330_LCDDataStruct XGI_CetLCD1400x1050Data[] =
+static struct XGI330_LCDDataStruct XGI_CetLCD1400x1050Data[] =
{
{ 1,1,1688,1066,1688,1066 }, /* 00 (320x200,320x400,640x200,640x400) */
{ 1,1,1688,1066,1688,1066 }, /* 01 (320x350,640x350) */
@@ -1138,7 +1147,7 @@ struct XGI330_LCDDataStruct XGI_CetLCD1400x1050Data[] =
{ 1,1,1688,1066,1688,1066 } /* 08 (1400x1050x60Hz) */
};
-struct XGI330_LCDDataStruct XGI_NoScalingData[] =
+static struct XGI330_LCDDataStruct XGI_NoScalingData[] =
{
{ 1, 1, 800, 449, 800, 449},
{ 1, 1, 800, 449, 800, 449},
@@ -1150,7 +1159,7 @@ struct XGI330_LCDDataStruct XGI_NoScalingData[] =
{ 1, 1,1688,1066,1688,1066}
};
-struct XGI330_LCDDataStruct XGI_ExtLCD1024x768x75Data[] =
+static struct XGI330_LCDDataStruct XGI_ExtLCD1024x768x75Data[] =
{
{42,25,1536,419,1344,806 }, /* ; 00 (320x200,320x400,640x200,640x400) */
{48,25,1536,369,1344,806 }, /* ; 01 (320x350,640x350) */
@@ -1161,7 +1170,8 @@ struct XGI330_LCDDataStruct XGI_ExtLCD1024x768x75Data[] =
{1,1,1312,800,1312,800 } /* ; 06 (1024x768x75Hz) */
};
-struct XGI330_LCDDataStruct XGI_StLCD1024x768x75Data[] =
+#if 0
+static struct XGI330_LCDDataStruct XGI_StLCD1024x768x75Data[] =
{
{42,25,1536,419,1344,806 }, /* ; 00 (320x200,320x400,640x200,640x400) */
{48,25,1536,369,1344,806 }, /* ; 01 (320x350,640x350) */
@@ -1171,8 +1181,9 @@ struct XGI330_LCDDataStruct XGI_StLCD1024x768x75Data[] =
{41,25,1024,625,1312,800 }, /* ; 05 (800x600x75Hz) */
{1,1,1312,800,1312,800 } /* ; 06 (1024x768x75Hz) */
};
+#endif
-struct XGI330_LCDDataStruct XGI_CetLCD1024x768x75Data[] =
+static struct XGI330_LCDDataStruct XGI_CetLCD1024x768x75Data[] =
{
{1,1,1312,800,1312,800}, /* ; 00 (320x200,320x400,640x200,640x400) */
{1,1,1312,800,1312,800}, /* ; 01 (320x350,640x350) */
@@ -1183,7 +1194,7 @@ struct XGI330_LCDDataStruct XGI_CetLCD1024x768x75Data[] =
{1,1,1312,800,1312,800} /* ; 06 (1024x768x75Hz) */
};
-struct XGI330_LCDDataStruct XGI_ExtLCD1280x1024x75Data[] =
+static struct XGI330_LCDDataStruct XGI_ExtLCD1280x1024x75Data[] =
{
{211,60,1024,501,1688,1066 }, /* ; 00 (320x200,320x400,640x200,640x400) */
{211,60,1024,508,1688,1066 }, /* ; 01 (320x350,640x350) */
@@ -1195,7 +1206,7 @@ struct XGI330_LCDDataStruct XGI_ExtLCD1280x1024x75Data[] =
{1,1,1688,1066,1688,1066 } /* ; 07 (1280x1024x75Hz) */
};
-struct XGI330_LCDDataStruct XGI_StLCD1280x1024x75Data[] =
+static struct XGI330_LCDDataStruct XGI_StLCD1280x1024x75Data[] =
{
{211,60,1024,501,1688,1066 }, /* ; 00 (320x200,320x400,640x200,640x400) */
{211,60,1024,508,1688,1066 }, /* ; 01 (320x350,640x350) */
@@ -1207,7 +1218,7 @@ struct XGI330_LCDDataStruct XGI_StLCD1280x1024x75Data[] =
{1,1,1688,1066,1688,1066 } /* ; 07 (1280x1024x75Hz) */
};
-struct XGI330_LCDDataStruct XGI_CetLCD1280x1024x75Data[] =
+static struct XGI330_LCDDataStruct XGI_CetLCD1280x1024x75Data[] =
{
{1,1,1688,1066,1688,1066}, /* ; 00 (320x200,320x400,640x200,640x400) */
{1,1,1688,1066,1688,1066}, /* ; 01 (320x350,640x350) */
@@ -1219,7 +1230,7 @@ struct XGI330_LCDDataStruct XGI_CetLCD1280x1024x75Data[] =
{1,1,1688,1066,1688,1066} /* ; 07 (1280x1024x75Hz) */
};
-struct XGI330_LCDDataStruct XGI_NoScalingDatax75[] =
+static struct XGI330_LCDDataStruct XGI_NoScalingDatax75[] =
{
{1,1,800,449,800,449 }, /* ; 00 (320x200,320x400,640x200,640x400) */
{1,1,800,449,800,449 }, /* ; 01 (320x350,640x350) */
@@ -1234,7 +1245,7 @@ struct XGI330_LCDDataStruct XGI_NoScalingDatax75[] =
{1,1,1688,806,1688,806 } /* ; 0A (1280x768x75Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_ExtLCDDes1024x768Data[] =
+static struct XGI330_LCDDataDesStruct XGI_ExtLCDDes1024x768Data[] =
{
{ 9,1057,0, 771 }, /* ; 00 (320x200,320x400,640x200,640x400) */
{ 9,1057,0, 771 }, /* ; 01 (320x350,640x350) */
@@ -1245,7 +1256,7 @@ struct XGI330_LCDDataDesStruct XGI_ExtLCDDes1024x768Data[] =
{ 9,1057,805, 770 } /* ; 06 (1024x768x60Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_StLCDDes1024x768Data[] =
+static struct XGI330_LCDDataDesStruct XGI_StLCDDes1024x768Data[] =
{
{ 9,1057,737,703 }, /* ; 00 (320x200,320x400,640x200,640x400) */
{ 9,1057,686,651 }, /* ; 01 (320x350,640x350) */
@@ -1256,7 +1267,7 @@ struct XGI330_LCDDataDesStruct XGI_StLCDDes1024x768Data[] =
{ 9,1057,805,770 } /* ; 06 (1024x768x60Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_CetLCDDes1024x768Data[] =
+static struct XGI330_LCDDataDesStruct XGI_CetLCDDes1024x768Data[] =
{
{ 1152,856,622,587 }, /* ; 00 (320x200,320x400,640x200,640x400) */
{ 1152,856,597,562 }, /* ; 01 (320x350,640x350) */
@@ -1267,7 +1278,7 @@ struct XGI330_LCDDataDesStruct XGI_CetLCDDes1024x768Data[] =
{ 0,1048,805,770 } /* ; 06 (1024x768x60Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_ExtLCDDLDes1280x1024Data[] =
+static struct XGI330_LCDDataDesStruct XGI_ExtLCDDLDes1280x1024Data[] =
{
{ 18,1346,981,940 },/* 00 (320x200,320x400,640x200,640x400) */
{ 18,1346,926,865 },/* 01 (320x350,640x350) */
@@ -1279,7 +1290,7 @@ struct XGI330_LCDDataDesStruct XGI_ExtLCDDLDes1280x1024Data[] =
{ 18,1346,1065,1024 }/* 07 (1280x1024x60Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_StLCDDLDes1280x1024Data[] =
+static struct XGI330_LCDDataDesStruct XGI_StLCDDLDes1280x1024Data[] =
{
{ 18,1346,970,907 },/* 00 (320x200,320x400,640x200,640x400) */
{ 18,1346,917,854 },/* 01 (320x350,640x350) */
@@ -1291,7 +1302,7 @@ struct XGI330_LCDDataDesStruct XGI_StLCDDLDes1280x1024Data[] =
{ 18,1346,1065,1024 }/* 07 (1280x1024x60Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_CetLCDDLDes1280x1024Data[] =
+static struct XGI330_LCDDataDesStruct XGI_CetLCDDLDes1280x1024Data[] =
{
{ 1368,1008,752,711 }, /* 00 (320x200,320x400,640x200,640x400) */
{ 1368,1008,729,688 }, /* 01 (320x350,640x350) */
@@ -1303,7 +1314,7 @@ struct XGI330_LCDDataDesStruct XGI_CetLCDDLDes1280x1024Data[] =
{ 18,1346,1065,1024 } /* 07 (1280x1024x60Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_ExtLCDDes1280x1024Data[] =
+static struct XGI330_LCDDataDesStruct XGI_ExtLCDDes1280x1024Data[] =
{
{ 9,1337,981,940 }, /* ; 00 (320x200,320x400,640x200,640x400) */
{ 9,1337,926,884 }, /* ; 01 (320x350,640x350) alan, 2003/09/30 */
@@ -1315,7 +1326,7 @@ struct XGI330_LCDDataDesStruct XGI_ExtLCDDes1280x1024Data[] =
{ 9,1337,1065,1024 } /* ; 07 (1280x1024x60Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_StLCDDes1280x1024Data[] =
+static struct XGI330_LCDDataDesStruct XGI_StLCDDes1280x1024Data[] =
{
{ 9,1337,970,907 }, /* ; 00 (320x200,320x400,640x200,640x400) */
{ 9,1337,917,854 }, /* ; 01 (320x350,640x350) */
@@ -1327,7 +1338,7 @@ struct XGI330_LCDDataDesStruct XGI_StLCDDes1280x1024Data[] =
{ 9,1337,1065,1024 } /* ; 07 (1280x1024x60Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_CetLCDDes1280x1024Data[] =
+static struct XGI330_LCDDataDesStruct XGI_CetLCDDes1280x1024Data[] =
{
{ 1368,1008,752,711 }, /* 00 (320x200,320x400,640x200,640x400) */
{ 1368,1008,729,688 }, /* 01 (320x350,640x350) */
@@ -1339,7 +1350,7 @@ struct XGI330_LCDDataDesStruct XGI_CetLCDDes1280x1024Data[] =
{ 9,1337,1065,1024 } /* 07 (1280x1024x60Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_StLCDDLDes1400x1050Data[] =
+static struct XGI330_LCDDataDesStruct XGI_StLCDDLDes1400x1050Data[] =
{
{ 18,1464,0,1051 }, /* 00 (320x200,320x400,640x200,640x400) */
{ 18,1464,0,1051 }, /* 01 (320x350,640x350) */
@@ -1352,7 +1363,7 @@ struct XGI330_LCDDataDesStruct XGI_StLCDDLDes1400x1050Data[] =
{ 18,1464,0,1051 } /* 08 (1400x1050x60Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_ExtLCDDLDes1400x1050Data[] =
+static struct XGI330_LCDDataDesStruct XGI_ExtLCDDLDes1400x1050Data[] =
{
{ 18,1464,0,1051 }, /* 00 (320x200,320x400,640x200,640x400) */
{ 18,1464,0,1051 }, /* 01 (320x350,640x350) */
@@ -1365,7 +1376,7 @@ struct XGI330_LCDDataDesStruct XGI_ExtLCDDLDes1400x1050Data[] =
{ 18,1464,0,1051 } /* 08 (1400x1050x60Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_StLCDDes1400x1050Data[] =
+static struct XGI330_LCDDataDesStruct XGI_StLCDDes1400x1050Data[] =
{
{ 9,1455,0,1051 },/* 00 (320x200,320x400,640x200,640x400) */
{ 9,1455,0,1051 },/* 01 (320x350,640x350) */
@@ -1378,7 +1389,7 @@ struct XGI330_LCDDataDesStruct XGI_StLCDDes1400x1050Data[] =
{ 9,1455,0,1051 } /* 08 (1400x1050x60Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_ExtLCDDes1400x1050Data[] =
+static struct XGI330_LCDDataDesStruct XGI_ExtLCDDes1400x1050Data[] =
{
{ 9,1455,0,1051 },/* 00 (320x200,320x400,640x200,640x400) */
{ 9,1455,0,1051 },/* 01 (320x350,640x350) */
@@ -1391,7 +1402,7 @@ struct XGI330_LCDDataDesStruct XGI_ExtLCDDes1400x1050Data[] =
{ 9,1455,0,1051 } /* 08 (1400x1050x60Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_CetLCDDes1400x1050Data[] =
+static struct XGI330_LCDDataDesStruct XGI_CetLCDDes1400x1050Data[] =
{
{ 1308,1068,781,766 }, /* 00 (320x200,320x400,640x200,640x400) */
{ 1308,1068,781,766 }, /* 01 (320x350,640x350) */
@@ -1404,7 +1415,7 @@ struct XGI330_LCDDataDesStruct XGI_CetLCDDes1400x1050Data[] =
{ 18,1464,0,1051 } /* 08 (1400x1050x60Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_CetLCDDes1400x1050Data2[] =
+static struct XGI330_LCDDataDesStruct XGI_CetLCDDes1400x1050Data2[] =
{
{ 0,1448,0,1051 }, /* 00 (320x200,320x400,640x200,640x400) */
{ 0,1448,0,1051 }, /* 01 (320x350,640x350) */
@@ -1415,7 +1426,7 @@ struct XGI330_LCDDataDesStruct XGI_CetLCDDes1400x1050Data2[] =
-struct XGI330_LCDDataDesStruct XGI_ExtLCDDLDes1600x1200Data[] =
+static struct XGI330_LCDDataDesStruct XGI_ExtLCDDLDes1600x1200Data[] =
{
{ 18,1682,0,1201 }, /* 00 (320x200,320x400,640x200,640x400) */
{ 18,1682,0,1201 }, /* 01 (320x350,640x350) */
@@ -1429,7 +1440,7 @@ struct XGI330_LCDDataDesStruct XGI_ExtLCDDLDes1600x1200Data[] =
{ 18,1682,0,1201 } /* 09 (1600x1200x60Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_StLCDDLDes1600x1200Data[] =
+static struct XGI330_LCDDataDesStruct XGI_StLCDDLDes1600x1200Data[] =
{
{ 18,1682,1150,1101 }, /* 00 (320x200,320x400,640x200,640x400) */
{ 18,1682,1083,1034 }, /* 01 (320x350,640x350) */
@@ -1443,7 +1454,7 @@ struct XGI330_LCDDataDesStruct XGI_StLCDDLDes1600x1200Data[] =
{ 18,1682,0,1201 } /* 09 (1600x1200x60Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_ExtLCDDes1600x1200Data[] =
+static struct XGI330_LCDDataDesStruct XGI_ExtLCDDes1600x1200Data[] =
{
{ 9,1673,0,1201 },/* 00 (320x200,320x400,640x200,640x400) */
{ 9,1673,0,1201 },/* 01 (320x350,640x350) */
@@ -1457,7 +1468,7 @@ struct XGI330_LCDDataDesStruct XGI_ExtLCDDes1600x1200Data[] =
{ 9,1673,0,1201 } /* 09 (1600x1200x60Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_StLCDDes1600x1200Data[] =
+static struct XGI330_LCDDataDesStruct XGI_StLCDDes1600x1200Data[] =
{
{ 9,1673,1150,1101 },/* 00 (320x200,320x400,640x200,640x400) */
{ 9,1673,1083,1034 },/* 01 (320x350,640x350) */
@@ -1471,7 +1482,7 @@ struct XGI330_LCDDataDesStruct XGI_StLCDDes1600x1200Data[] =
{ 9,1673,0,1201 } /* 09 (1600x1200x60Hz) */
};
-struct XGI330_LCDDataDesStruct2 XGI_NoScalingDesData[] =
+static struct XGI330_LCDDataDesStruct2 XGI_NoScalingDesData[] =
{
{ 9,657,448,405,96,2 }, /* 00 (320x200,320x400,640x200,640x400) */
{ 9,657,448,355,96,2 }, /* 01 (320x350,640x350) */
@@ -1486,7 +1497,7 @@ struct XGI330_LCDDataDesStruct2 XGI_NoScalingDesData[] =
{ 9,1337,0,771,112,6 } /* 0A (1280x768x60Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_ExtLCDDes1024x768x75Data[] = /* ;;1024x768x75Hz */
+static struct XGI330_LCDDataDesStruct XGI_ExtLCDDes1024x768x75Data[] = /* ;;1024x768x75Hz */
{
{9,1049,0,769}, /* ; 00 (320x200,320x400,640x200,640x400) */
{9,1049,0,769}, /* ; 01 (320x350,640x350) */
@@ -1497,7 +1508,7 @@ struct XGI330_LCDDataDesStruct XGI_ExtLCDDes1024x768x75Data[] = /* ;;1024x768x
{9,1049,0,769} /* ; 06 (1024x768x75Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_StLCDDes1024x768x75Data[] =
+static struct XGI330_LCDDataDesStruct XGI_StLCDDes1024x768x75Data[] =
{
{9,1049,0,769}, /* ; 00 (320x200,320x400,640x200,640x400) */
{9,1049,0,769}, /* ; 01 (320x350,640x350) */
@@ -1508,7 +1519,7 @@ struct XGI330_LCDDataDesStruct XGI_StLCDDes1024x768x75Data[] =
{9,1049,0,769} /* ; 06 (1024x768x75Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_CetLCDDes1024x768x75Data[] = /* ;;1024x768x75Hz */
+static struct XGI330_LCDDataDesStruct XGI_CetLCDDes1024x768x75Data[] = /* ;;1024x768x75Hz */
{
{1152,856,622,587}, /* ; 00 (320x200,320x400,640x200,640x400) */
{1152,856,597,562}, /* ; 01 (320x350,640x350) */
@@ -1519,7 +1530,7 @@ struct XGI330_LCDDataDesStruct XGI_CetLCDDes1024x768x75Data[] = /* ;;1024x768x7
{9,1049,0,769} /* ; 06 (1024x768x75Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_ExtLCDDLDes1280x1024x75Data[] = /* ;;1280x1024x75Hz */
+static struct XGI330_LCDDataDesStruct XGI_ExtLCDDLDes1280x1024x75Data[] = /* ;;1280x1024x75Hz */
{
{18,1314,0,1025 },/* ; 00 (320x200,320x400,640x200,640x400) */
{18,1314,0,1025 },/* ; 01 (320x350,640x350) */
@@ -1531,7 +1542,7 @@ struct XGI330_LCDDataDesStruct XGI_ExtLCDDLDes1280x1024x75Data[] = /* ;
{18,1314,0,1025 }/* ; 07 (1280x1024x60Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_StLCDDLDes1280x1024x75Data[] =
+static struct XGI330_LCDDataDesStruct XGI_StLCDDLDes1280x1024x75Data[] =
{
{18,1314,0,1025 },/* ; 00 (320x200,320x400,640x200,640x400) */
{18,1314,0,1025 },/* ; 01 (320x350,640x350) */
@@ -1543,7 +1554,7 @@ struct XGI330_LCDDataDesStruct XGI_StLCDDLDes1280x1024x75Data[] =
{18,1314,0,1025 }/* ; 07 (1280x1024x60Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_CetLCDDLDes1280x1024x75Data[] = /* 1280x1024x75Hz */
+static struct XGI330_LCDDataDesStruct XGI_CetLCDDLDes1280x1024x75Data[] = /* 1280x1024x75Hz */
{
{1368,1008,752,711}, /* ; 00 (320x200,320x400,640x200,640x400) */
{1368,1008,729,688}, /* ; 01 (320x350,640x350) */
@@ -1555,7 +1566,7 @@ struct XGI330_LCDDataDesStruct XGI_CetLCDDLDes1280x1024x75Data[] = /* 1280x1024
{18,1314,0,1025} /* ; 07 (1280x1024x75Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_ExtLCDDes1280x1024x75Data[] = /* ;;1280x1024x75Hz */
+static struct XGI330_LCDDataDesStruct XGI_ExtLCDDes1280x1024x75Data[] = /* ;;1280x1024x75Hz */
{
{9,1305,0,1025},/* ; 00 (320x200,320x400,640x200,640x400) */
{9,1305,0,1025},/* ; 01 (320x350,640x350) */
@@ -1567,7 +1578,7 @@ struct XGI330_LCDDataDesStruct XGI_ExtLCDDes1280x1024x75Data[] = /* ;;1
{9,1305,0,1025} /* ; 07 (1280x1024x60Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_StLCDDes1280x1024x75Data[] =
+static struct XGI330_LCDDataDesStruct XGI_StLCDDes1280x1024x75Data[] =
{
{9,1305,0,1025},/* ; 00 (320x200,320x400,640x200,640x400) */
{9,1305,0,1025},/* ; 01 (320x350,640x350) */
@@ -1579,7 +1590,7 @@ struct XGI330_LCDDataDesStruct XGI_StLCDDes1280x1024x75Data[] =
{9,1305,0,1025} /* ; 07 (1280x1024x60Hz) */
};
-struct XGI330_LCDDataDesStruct XGI_CetLCDDes1280x1024x75Data[] = /* 1280x1024x75Hz */
+static struct XGI330_LCDDataDesStruct XGI_CetLCDDes1280x1024x75Data[] = /* 1280x1024x75Hz */
{
{1368,1008,752,711}, /* ; 00 (320x200,320x400,640x200,640x400) */
{1368,1008,729,688}, /* ; 01 (320x350,640x350) */
@@ -1591,7 +1602,7 @@ struct XGI330_LCDDataDesStruct XGI_CetLCDDes1280x1024x75Data[] = /* 1280x1024x7
{9,1305,0,1025} /* ; 07 (1280x1024x75Hz) */
};
-struct XGI330_LCDDataDesStruct2 XGI_NoScalingDesDatax75[] = /* Scaling LCD 75Hz */
+static struct XGI330_LCDDataDesStruct2 XGI_NoScalingDesDatax75[] = /* Scaling LCD 75Hz */
{
{9,657,448,405,96,2}, /* ; 00 (320x200,320x400,640x200,640x400) */
{9,657,448,355,96,2}, /* ; 01 (320x350,640x350) */
@@ -1606,7 +1617,7 @@ struct XGI330_LCDDataDesStruct2 XGI_NoScalingDesDatax75[] = /* Scaling LCD 75Hz
{9,1337,0,771,112,6} /* ; 0A (1280x768x60Hz) */
};
-struct XGI330_TVDataStruct XGI_StPALData[] =
+static struct XGI330_TVDataStruct XGI_StPALData[] =
{
{ 1, 1, 864, 525,1270, 400, 100, 0, 760},
{ 1, 1, 864, 525,1270, 350, 100, 0, 760},
@@ -1616,7 +1627,7 @@ struct XGI330_TVDataStruct XGI_StPALData[] =
{ 1, 1, 864, 525,1270, 600, 50, 0, 0}
};
-struct XGI330_TVDataStruct XGI_ExtPALData[] =
+static struct XGI330_TVDataStruct XGI_ExtPALData[] =
{
{ 2, 1,1080, 463,1270, 500, 50, 0, 50},
{ 15, 7,1152, 413,1270, 500, 50, 0, 50},
@@ -1628,7 +1639,7 @@ struct XGI330_TVDataStruct XGI_ExtPALData[] =
{ 3, 2,1080, 619,1270, 540, 438, 0, 438}
};
-struct XGI330_TVDataStruct XGI_StNTSCData[] =
+static struct XGI330_TVDataStruct XGI_StNTSCData[] =
{
{ 1, 1, 858, 525,1270, 400, 50, 0, 760},
{ 1, 1, 858, 525,1270, 350, 50, 0, 640},
@@ -1637,7 +1648,7 @@ struct XGI330_TVDataStruct XGI_StNTSCData[] =
{ 1, 1, 858, 525,1270, 480, 0, 0, 760}
};
-struct XGI330_TVDataStruct XGI_ExtNTSCData[] =
+static struct XGI330_TVDataStruct XGI_ExtNTSCData[] =
{
{ 9, 5, 1001, 453,1270, 420, 171, 0, 171},
{ 12, 5, 858, 403,1270, 420, 171, 0, 171},
@@ -1650,7 +1661,7 @@ struct XGI330_TVDataStruct XGI_ExtNTSCData[] =
{ 3, 2,1001, 533,1270, 420, 0, 0, 0}
};
-struct XGI330_TVDataStruct XGI_St1HiTVData[] =
+static struct XGI330_TVDataStruct XGI_St1HiTVData[] =
{
{ 1,1,892,563,690,800,0,0,0 }, /* 00 (320x200,320x400,640x200,640x400) */
{ 1,1,892,563,690,700,0,0,0 }, /* 01 (320x350,640x350) */
@@ -1660,7 +1671,7 @@ struct XGI330_TVDataStruct XGI_St1HiTVData[] =
{ 8,5,1050,683,1648,960,0x150,1,0 } /* 05 (400x300,800x600) */
};
-struct XGI330_TVDataStruct XGI_St2HiTVData[] =
+static struct XGI330_TVDataStruct XGI_St2HiTVData[] =
{
{ 3,1,840,483,1648,960,0x032,0,0 }, /* 00 (320x200,320x400,640x200,640x400) */
{ 1,1,892,563,690,700,0,0,0 }, /* 01 (320x350,640x350) */
@@ -1671,7 +1682,7 @@ struct XGI330_TVDataStruct XGI_St2HiTVData[] =
};
-struct XGI330_TVDataStruct XGI_ExtHiTVData[] =
+static struct XGI330_TVDataStruct XGI_ExtHiTVData[] =
{
{ 6,1,840,563,1632,960,0,0,0 }, /* 00 (320x200,320x400,640x200,640x400) */
{ 3,1,960,563,1632,960,0,0,0 }, /* 01 (320x350,640x350) */
@@ -1687,7 +1698,7 @@ struct XGI330_TVDataStruct XGI_ExtHiTVData[] =
};
-struct XGI330_TVDataStruct XGI_ExtYPbPr525iData[] =
+static struct XGI330_TVDataStruct XGI_ExtYPbPr525iData[] =
{
{ 9, 5, 1001, 453,1270, 420, 171, 0, 171},
{ 12, 5, 858, 403,1270, 420, 171, 0, 171},
@@ -1700,7 +1711,7 @@ struct XGI330_TVDataStruct XGI_ExtYPbPr525iData[] =
{ 3, 2,1001, 533,1250, 420, 0, 0, 0}
};
-struct XGI330_TVDataStruct XGI_StYPbPr525iData[] =
+static struct XGI330_TVDataStruct XGI_StYPbPr525iData[] =
{
{ 1, 1, 858, 525,1270, 400, 50, 0, 760},
{ 1, 1, 858, 525,1270, 350, 50, 0, 640},
@@ -1709,7 +1720,7 @@ struct XGI330_TVDataStruct XGI_StYPbPr525iData[] =
{ 1, 1, 858, 525,1270, 480, 0, 0, 760},
};
-struct XGI330_TVDataStruct XGI_ExtYPbPr525pData[] =
+static struct XGI330_TVDataStruct XGI_ExtYPbPr525pData[] =
{
{ 9, 5, 1001, 453,1270, 420, 171, 0, 171},
{ 12, 5, 858, 403,1270, 420, 171, 0, 171},
@@ -1722,7 +1733,7 @@ struct XGI330_TVDataStruct XGI_ExtYPbPr525pData[] =
{ 3, 2,1001, 533,1270, 420, 0, 0, 0}
};
-struct XGI330_TVDataStruct XGI_StYPbPr525pData[] =
+static struct XGI330_TVDataStruct XGI_StYPbPr525pData[] =
{
{ 1, 1,1716, 525,1270, 400, 50, 0, 760},
{ 1, 1,1716, 525,1270, 350, 50, 0, 640},
@@ -1731,7 +1742,7 @@ struct XGI330_TVDataStruct XGI_StYPbPr525pData[] =
{ 1, 1,1716, 525,1270, 480, 0, 0, 760},
};
-struct XGI330_TVDataStruct XGI_ExtYPbPr750pData[] =
+static struct XGI330_TVDataStruct XGI_ExtYPbPr750pData[] =
{
{ 3, 1, 935, 470,1130, 680, 50, 0, 0}, /* 00 (320x200,320x400,640x200,640x400) */
{ 24, 7, 935, 420,1130, 680, 50, 0, 0}, /* 01 (320x350,640x350) */
@@ -1746,7 +1757,7 @@ struct XGI330_TVDataStruct XGI_ExtYPbPr750pData[] =
{ 10, 9,1320, 830,1130, 640, 50, 0, 0}
};
-struct XGI330_TVDataStruct XGI_StYPbPr750pData[] =
+static struct XGI330_TVDataStruct XGI_StYPbPr750pData[] =
{
{ 1, 1,1650, 750,1280, 400, 50, 0, 760},
{ 1, 1,1650, 750,1280, 350, 50, 0, 640},
@@ -1755,7 +1766,7 @@ struct XGI330_TVDataStruct XGI_StYPbPr750pData[] =
{ 1, 1,1650, 750,1280, 480, 0, 0, 760},
};
-unsigned char XGI330_NTSCTiming[] = {
+static unsigned char XGI330_NTSCTiming[] = {
0x17,0x1d,0x03,0x09,0x05,0x06,0x0c,0x0c,
0x94,0x49,0x01,0x0a,0x06,0x0d,0x04,0x0a,
0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x1b,
@@ -1765,7 +1776,7 @@ unsigned char XGI330_NTSCTiming[] = {
0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x50,
0x00,0x40,0x44,0x00,0xdb,0x02,0x3b,0x00};
-unsigned char XGI330_PALTiming[] = {
+static unsigned char XGI330_PALTiming[] = {
0x21,0x5A,0x35,0x6e,0x04,0x38,0x3d,0x70,
0x94,0x49,0x01,0x12,0x06,0x3e,0x35,0x6d,
0x06,0x14,0x3e,0x35,0x6d,0x00,0x45,0x2b,
@@ -1775,7 +1786,7 @@ unsigned char XGI330_PALTiming[] = {
0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x63,
0x00,0x40,0x3e,0x00,0xe1,0x02,0x28,0x00};
-unsigned char XGI330_HiTVExtTiming[] =
+static unsigned char XGI330_HiTVExtTiming[] =
{
0x2D,0x60,0x2C,0x5F,0x08,0x31,0x3A,0x64,
0x28,0x02,0x01,0x3D,0x06,0x3E,0x35,0x6D,
@@ -1789,7 +1800,7 @@ unsigned char XGI330_HiTVExtTiming[] =
};
-unsigned char XGI330_HiTVSt1Timing[] =
+static unsigned char XGI330_HiTVSt1Timing[] =
{
0x32,0x65,0x2C,0x5F,0x08,0x31,0x3A,0x65,
0x28,0x02,0x01,0x3D,0x06,0x3E,0x35,0x6D,
@@ -1802,7 +1813,7 @@ unsigned char XGI330_HiTVSt1Timing[] =
0x0E,0x00,0xfc,0xff,0x2d,0x00
};
-unsigned char XGI330_HiTVSt2Timing[] =
+static unsigned char XGI330_HiTVSt2Timing[] =
{
0x32,0x65,0x2C,0x5F,0x08,0x31,0x3A,0x64,
0x28,0x02,0x01,0x3D,0x06,0x3E,0x35,0x6D,
@@ -1815,7 +1826,7 @@ unsigned char XGI330_HiTVSt2Timing[] =
0x27,0x00,0xFC,0xff,0x6a,0x00
};
-unsigned char XGI330_HiTVTextTiming[] =
+static unsigned char XGI330_HiTVTextTiming[] =
{
0x32,0x65,0x2C,0x5F,0x08,0x31,0x3A,0x65,
0x28,0x02,0x01,0x3D,0x06,0x3E,0x35,0x6D,
@@ -1828,7 +1839,7 @@ unsigned char XGI330_HiTVTextTiming[] =
0x11,0x00,0xFC,0xFF,0x32,0x00
};
-unsigned char XGI330_YPbPr750pTiming[] =
+static unsigned char XGI330_YPbPr750pTiming[] =
{
0x30,0x1d,0xe8,0x09,0x09,0xed,0x0c,0x0c,
0x98,0x0a,0x01,0x0c,0x06,0x0d,0x04,0x0a,
@@ -1841,7 +1852,7 @@ unsigned char XGI330_YPbPr750pTiming[] =
0x11,0x00,0xfc,0xff,0x32,0x00
};
-unsigned char XGI330_YPbPr525pTiming[] =
+static unsigned char XGI330_YPbPr525pTiming[] =
{
0x3E,0x11,0x06,0x09,0x0b,0x0c,0x0c,0x0c,
0x98,0x0a,0x01,0x0d,0x06,0x0d,0x04,0x0a,
@@ -1854,7 +1865,7 @@ unsigned char XGI330_YPbPr525pTiming[] =
0x11,0x00,0xFC,0xFF,0x32,0x00
};
-unsigned char XGI330_YPbPr525iTiming[] =
+static unsigned char XGI330_YPbPr525iTiming[] =
{
0x1B,0x21,0x03,0x09,0x05,0x06,0x0C,0x0C,
0x94,0x49,0x01,0x0A,0x06,0x0D,0x04,0x0A,
@@ -1868,7 +1879,7 @@ unsigned char XGI330_YPbPr525iTiming[] =
};
-unsigned char XGI330_HiTVGroup3Data[] =
+static unsigned char XGI330_HiTVGroup3Data[] =
{
0x00,0x1A,0x22,0x63,0x62,0x22,0x08,0x5F,
0x05,0x21,0xB2,0xB2,0x55,0x77,0x2A,0xA6,
@@ -1880,7 +1891,7 @@ unsigned char XGI330_HiTVGroup3Data[] =
0x18,0x05,0x18,0x05,0x4C,0xA8,0x01
};
-unsigned char XGI330_HiTVGroup3Simu[] =
+static unsigned char XGI330_HiTVGroup3Simu[] =
{
0x00,0x1A,0x22,0x63,0x62,0x22,0x08,0x95,
0xDB,0x20,0xB8,0xB8,0x55,0x47,0x2A,0xA6,
@@ -1892,7 +1903,7 @@ unsigned char XGI330_HiTVGroup3Simu[] =
0x18,0x05,0x18,0x05,0x4C,0xA8,0x01
};
-unsigned char XGI330_HiTVGroup3Text[] =
+static unsigned char XGI330_HiTVGroup3Text[] =
{
0x00,0x1A,0x22,0x63,0x62,0x22,0x08,0xA7,
0xF5,0x20,0xCE,0xCE,0x55,0x47,0x2A,0xA6,
@@ -1904,7 +1915,7 @@ unsigned char XGI330_HiTVGroup3Text[] =
0x18,0x05,0x18,0x05,0x4C,0xA8,0x01
};
-unsigned char XGI330_Ren525pGroup3[] =
+static unsigned char XGI330_Ren525pGroup3[] =
{
0x00,0x14,0x15,0x25,0x55,0x15,0x0b,0x13,
0xB1,0x41,0x62,0x62,0xFF,0xF4,0x45,0xa6,
@@ -1916,7 +1927,7 @@ unsigned char XGI330_Ren525pGroup3[] =
0x1a,0x1F,0x25,0x2a,0x4C,0xAA,0x01
};
-unsigned char XGI330_Ren750pGroup3[] =
+static unsigned char XGI330_Ren750pGroup3[] =
{
0x00,0x14,0x15,0x25,0x55,0x15,0x0b,0x7a,
0x54,0x41,0xE7,0xE7,0xFF,0xF4,0x45,0xa6,
@@ -1928,7 +1939,8 @@ unsigned char XGI330_Ren750pGroup3[] =
0x18,0x1D,0x23,0x28,0x4C,0xAA,0x01
};
-struct XGI_PanelDelayTblStruct XGI330_PanelDelayTbl[] =
+#if 0
+static struct XGI_PanelDelayTblStruct XGI330_PanelDelayTbl[] =
{
{{0x00,0x00}},
{{0x00,0x00}},
@@ -1948,7 +1960,7 @@ struct XGI_PanelDelayTblStruct XGI330_PanelDelayTbl[] =
{{0x00,0x00}}
};
-struct XGI330_LVDSDataStruct XGI330_LVDS320x480Data_1[] =
+static struct XGI330_LVDSDataStruct XGI330_LVDS320x480Data_1[] =
{
{848, 433,400,525},
{848, 389,400,525},
@@ -1961,7 +1973,7 @@ struct XGI330_LVDSDataStruct XGI330_LVDS320x480Data_1[] =
{800, 525,1000, 635}
};
-struct XGI330_LVDSDataStruct XGI330_LVDS800x600Data_1[] =
+static struct XGI330_LVDSDataStruct XGI330_LVDS800x600Data_1[] =
{
{848, 433,1060, 629},
{848, 389,1060, 629},
@@ -1974,7 +1986,7 @@ struct XGI330_LVDSDataStruct XGI330_LVDS800x600Data_1[] =
{800, 525,1000, 635}
};
-struct XGI330_LVDSDataStruct XGI330_LVDS800x600Data_2[] =
+static struct XGI330_LVDSDataStruct XGI330_LVDS800x600Data_2[] =
{
{1056, 628,1056, 628},
{1056, 628,1056, 628},
@@ -1986,8 +1998,9 @@ struct XGI330_LVDSDataStruct XGI330_LVDS800x600Data_2[] =
{800, 449,1000, 644},
{800, 525,1000, 635}
};
+#endif
-struct XGI330_LVDSDataStruct XGI_LVDS1024x768Data_1[] =
+static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Data_1[] =
{
{ 960 , 438 , 1344 , 806 } , /* 00 (320x200,320x400,640x200,640x400) */
{ 960 , 388 , 1344 , 806 } , /* 01 (320x350,640x350) */
@@ -1999,7 +2012,7 @@ struct XGI330_LVDSDataStruct XGI_LVDS1024x768Data_1[] =
};
-struct XGI330_LVDSDataStruct XGI_LVDS1024x768Data_2[] =
+static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Data_2[] =
{
{1344, 806,1344, 806},
{1344, 806,1344, 806},
@@ -2012,7 +2025,7 @@ struct XGI330_LVDSDataStruct XGI_LVDS1024x768Data_2[] =
{800, 525,1280, 813}
};
-struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Data_1[] =
+static struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Data_1[] =
{
{1048, 442,1688, 1066},
{1048, 392,1688, 1066},
@@ -2024,7 +2037,7 @@ struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Data_1[] =
{1688, 1066,1688, 1066}
};
-struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Data_2[] =
+static struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Data_2[] =
{
{1344, 806,1344, 806},
{1344, 806,1344, 806},
@@ -2115,7 +2128,7 @@ struct XGI330_LVDSDataStruct XGI_LVDS1280x768SData_2[] =
{1688,806,1688,806}
};
*/
-struct XGI330_LVDSDataStruct XGI_LVDS1400x1050Data_1[] =
+static struct XGI330_LVDSDataStruct XGI_LVDS1400x1050Data_1[] =
{
{928,416,1688,1066},
{928,366,1688,1066},
@@ -2128,7 +2141,7 @@ struct XGI330_LVDSDataStruct XGI_LVDS1400x1050Data_1[] =
{1688,1066,1688,1066}
};
-struct XGI330_LVDSDataStruct XGI_LVDS1400x1050Data_2[] =
+static struct XGI330_LVDSDataStruct XGI_LVDS1400x1050Data_2[] =
{
{1688,1066,1688,1066},
{1688,1066,1688,1066},
@@ -2141,7 +2154,7 @@ struct XGI330_LVDSDataStruct XGI_LVDS1400x1050Data_2[] =
{1688,1066,1688,1066}
};
-struct XGI330_LVDSDataStruct XGI_LVDS1600x1200Data_1[] =
+static struct XGI330_LVDSDataStruct XGI_LVDS1600x1200Data_1[] =
{ /* ;;[ycchen] 12/05/02 LCDHTxLCDVT=2048x1320 */
{ 1088,520,2048,1320 },/* 00 (320x200,320x400,640x200,640x400) */
{ 1088,470,2048,1320 },/* 01 (320x350,640x350) */
@@ -2155,7 +2168,7 @@ struct XGI330_LVDSDataStruct XGI_LVDS1600x1200Data_1[] =
{ 2048,1320,2048,1320 } /* 09 (1600x1200) */
};
-struct XGI330_LVDSDataStruct XGI_LVDSNoScalingData[] =
+static struct XGI330_LVDSDataStruct XGI_LVDSNoScalingData[] =
{
{ 800,449,800,449 }, /* 00 (320x200,320x400,640x200,640x400) */
{ 800,449,800,449 }, /* 01 (320x350,640x350) */
@@ -2170,7 +2183,7 @@ struct XGI330_LVDSDataStruct XGI_LVDSNoScalingData[] =
{ 1688,806,1688,806 } /* 0A (1280x768x60Hz) */
};
-struct XGI330_LVDSDataStruct XGI_LVDS1024x768Data_1x75[] =
+static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Data_1x75[] =
{
{960,438,1312,800 }, /* 00 (320x200,320x400,640x200,640x400) */
{960,388,1312,800 }, /* 01 (320x350,640x350) */
@@ -2182,7 +2195,7 @@ struct XGI330_LVDSDataStruct XGI_LVDS1024x768Data_1x75[] =
};
-struct XGI330_LVDSDataStruct XGI_LVDS1024x768Data_2x75[] =
+static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Data_2x75[] =
{
{1312,800,1312,800}, /* ; 00 (320x200,320x400,640x200,640x400) */
{1312,800,1312,800}, /* ; 01 (320x350,640x350) */
@@ -2193,7 +2206,7 @@ struct XGI330_LVDSDataStruct XGI_LVDS1024x768Data_2x75[] =
{1312,800,1312,800}, /* ; 06 (512x384,1024x768) */
};
-struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Data_1x75[] =
+static struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Data_1x75[] =
{
{1048,442,1688,1066 }, /* ; 00 (320x200,320x400,640x200,640x400) */
{1048,392,1688,1066 }, /* ; 01 (320x350,640x350) */
@@ -2205,7 +2218,7 @@ struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Data_1x75[] =
{1688,1066,1688,1066 }, /* ; 06; 07 (640x512,1280x1024) */
};
-struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Data_2x75[] =
+static struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Data_2x75[] =
{
{1688,1066,1688,1066 }, /* ; 00 (320x200,320x400,640x200,640x400) */
{1688,1066,1688,1066 }, /* ; 01 (320x350,640x350) */
@@ -2217,7 +2230,7 @@ struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Data_2x75[] =
{1688,1066,1688,1066 }, /* ; 06; 07 (640x512,1280x1024) */
};
-struct XGI330_LVDSDataStruct XGI_LVDSNoScalingDatax75[] =
+static struct XGI330_LVDSDataStruct XGI_LVDSNoScalingDatax75[] =
{
{800,449,800,449 }, /* ; 00 (320x200,320x400,640x200,640x400) */
{800,449,800,449 }, /* ; 01 (320x350,640x350) */
@@ -2232,7 +2245,7 @@ struct XGI330_LVDSDataStruct XGI_LVDSNoScalingDatax75[] =
{1688,806,1688,806 }, /* ; 0A (1280x768x75Hz) */
};
-struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_1[] =
+static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_1[] =
{
{ 0,1048, 0, 771 }, /* 00 (320x200,320x400,640x200,640x400) */
{ 0,1048, 0, 771 }, /* 01 (320x350,640x350) */
@@ -2243,7 +2256,7 @@ struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_1[] =
{ 0,1048, 805, 770 } /* 06 (1024x768x60Hz) */
} ;
-struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_2[] =
+static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_2[] =
{
{ 1142, 856, 622, 587 }, /* 00 (320x200,320x400,640x200,640x400) */
{ 1142, 856, 597, 562 }, /* 01 (320x350,640x350) */
@@ -2254,7 +2267,7 @@ struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_2[] =
{ 0,1048, 805, 771 } /* 06 (1024x768x60Hz) */
};
-struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_3[] =
+static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_3[] =
{
{ 320, 24, 622, 587 }, /* 00 (320x200,320x400,640x200,640x400) */
{ 320, 24, 597, 562 }, /* 01 (320x350,640x350) */
@@ -2263,7 +2276,7 @@ struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_3[] =
{ 320, 24, 722, 687 } /* 04 (640x480x60Hz) */
};
-struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Des_1[] =
+static struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Des_1[] =
{
{ 0,1328, 0, 1025 }, /* 00 (320x200,320x400,640x200,640x400) */
{ 0,1328, 0, 1025 }, /* 01 (320x350,640x350) */
@@ -2276,7 +2289,7 @@ struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Des_1[] =
};
/* The Display setting for DE Mode Panel */
-struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Des_2[] =
+static struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Des_2[] =
{
{ 1368,1008,752,711 }, /* 00 (320x200,320x400,640x200,640x400) */
{ 1368,1008,729,688 }, /* 01 (320x350,640x350) */
@@ -2288,7 +2301,7 @@ struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Des_2[] =
{ 0000,1328,0,1025 } /* 07 (1280x1024x60Hz) */
};
-struct XGI330_LVDSDataStruct XGI_LVDS1400x1050Des_1[] =
+static struct XGI330_LVDSDataStruct XGI_LVDS1400x1050Des_1[] =
{
{ 0,1448,0,1051 }, /* 00 (320x200,320x400,640x200,640x400) */
{ 0,1448,0,1051 }, /* 01 (320x350,640x350) */
@@ -2301,7 +2314,7 @@ struct XGI330_LVDSDataStruct XGI_LVDS1400x1050Des_1[] =
{ 0,1448,0,1051 } /* 08 (1400x1050x60Hz) */
};
-struct XGI330_LVDSDataStruct XGI_LVDS1400x1050Des_2[] =
+static struct XGI330_LVDSDataStruct XGI_LVDS1400x1050Des_2[] =
{
{ 1308,1068, 781, 766 }, /* 00 (320x200,320x400,640x200,640x400) */
{ 1308,1068, 781, 766 }, /* 01 (320x350,640x350) */
@@ -2314,7 +2327,7 @@ struct XGI330_LVDSDataStruct XGI_LVDS1400x1050Des_2[] =
{ 0,1448,0,1051 } /* 08 (1400x1050x60Hz) */
};
-struct XGI330_LVDSDataStruct XGI_LVDS1600x1200Des_1[] =
+static struct XGI330_LVDSDataStruct XGI_LVDS1600x1200Des_1[] =
{
{ 0,1664,0,1201 }, /* 00 (320x200,320x400,640x200,640x400) */
{ 0,1664,0,1201 }, /* 01 (320x350,640x350) */
@@ -2330,7 +2343,7 @@ struct XGI330_LVDSDataStruct XGI_LVDS1600x1200Des_1[] =
-struct XGI330_LCDDataDesStruct2 XGI_LVDSNoScalingDesData[] =
+static struct XGI330_LCDDataDesStruct2 XGI_LVDSNoScalingDesData[] =
{
{ 0, 648, 448, 405, 96, 2 }, /* 00 (320x200,320x400,640x200,640x400) */
{ 0, 648, 448, 355, 96, 2 }, /* 01 (320x350,640x350) */
@@ -2345,7 +2358,7 @@ struct XGI330_LCDDataDesStruct2 XGI_LVDSNoScalingDesData[] =
{ 0,1328,0,0771, 112, 6 } /* 0A (1280x768x60Hz) */
};
-struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_1x75[] = /* ; 1024x768 Full-screen */
+static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_1x75[] = /* ; 1024x768 Full-screen */
{
{0,1040,0,769}, /* ; 00 (320x200,320x400,640x200,640x400) */
{0,1040,0,769}, /* ; 01 (320x350,640x350) */
@@ -2356,7 +2369,7 @@ struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_1x75[] = /* ; 1024x768 Full-s
{0,1040,0,769} /* ; 06 (1024x768x75Hz) */
};
-struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_2x75[] = /* ; 1024x768 center-screen (Enh. Mode) */
+static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_2x75[] = /* ; 1024x768 center-screen (Enh. Mode) */
{
{1142, 856,622,587 }, /* 00 (320x200,320x400,640x200,640x400) */
{1142, 856,597,562 }, /* 01 (320x350,640x350) */
@@ -2367,7 +2380,7 @@ struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_2x75[] = /* ; 1024x768 center-s
{ 0,1048,805,771 } /* 06 (1024x768x60Hz) */
};
-struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_3x75[] = /* ; 1024x768 center-screen (St.Mode) */
+static struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_3x75[] = /* ; 1024x768 center-screen (St.Mode) */
{
{320,24,622,587 }, /* ; 00 (320x200,320x400,640x200,640x400) */
{320,24,597,562 }, /* ; 01 (320x350,640x350) */
@@ -2376,7 +2389,7 @@ struct XGI330_LVDSDataStruct XGI_LVDS1024x768Des_3x75[] = /* ; 1024x768 center-s
{320,24,722,687 } /* ; 04 (640x480x60Hz) */
};
-struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Des_1x75[] =
+static struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Des_1x75[] =
{
{0,1296,0,1025}, /* ; 00 (320x200,320x400,640x200,640x400) */
{0,1296,0,1025}, /* ; 01 (320x350,640x350) */
@@ -2389,7 +2402,7 @@ struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Des_1x75[] =
};
/* The Display setting for DE Mode Panel */
-struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Des_2x75[] = /* [ycchen] 02/18/03 Set DE as default */
+static struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Des_2x75[] = /* [ycchen] 02/18/03 Set DE as default */
{
{1368,976,752,711 }, /* ; 00 (320x200,320x400,640x200,640x400) */
{1368,976,729,688 }, /* ; 01 (320x350,640x350) */
@@ -2401,7 +2414,7 @@ struct XGI330_LVDSDataStruct XGI_LVDS1280x1024Des_2x75[] = /* [ycchen] 02/18/0
{0,1296,0,1025 } /* ; 07 (1280x1024x75Hz) */
};
-struct XGI330_LCDDataDesStruct2 XGI_LVDSNoScalingDesDatax75[] = /* Scaling LCD 75Hz */
+static struct XGI330_LCDDataDesStruct2 XGI_LVDSNoScalingDesDatax75[] = /* Scaling LCD 75Hz */
{
{ 0,648,448,405,96,2 }, /* ; 00 (320x200,320x400,640x200,640x400) */
{ 0,648,448,355,96,2 }, /* ; 01 (320x350,640x350) */
@@ -2416,7 +2429,8 @@ struct XGI330_LCDDataDesStruct2 XGI_LVDSNoScalingDesDatax75[] = /* Scaling LCD
{ 0,1328,0,771,112,6 } /* ; 0A (1280x768x75Hz) */
};
-struct XGI330_LVDSDataStruct XGI330_LVDS640x480Data_1[] =
+#if 0
+static struct XGI330_LVDSDataStruct XGI330_LVDS640x480Data_1[] =
{
{800, 449, 800, 449},
{800, 449, 800, 449},
@@ -2428,8 +2442,9 @@ struct XGI330_LVDSDataStruct XGI330_LVDS640x480Data_1[] =
{1056, 628,1056, 628},
{1056, 628,1056, 628}
};
+#endif
-struct XGI330_CHTVDataStruct XGI_CHTVUNTSCData[] =
+static struct XGI330_CHTVDataStruct XGI_CHTVUNTSCData[] =
{
{840, 600, 840, 600},
{840, 600, 840, 600},
@@ -2439,7 +2454,7 @@ struct XGI330_CHTVDataStruct XGI_CHTVUNTSCData[] =
{1064, 750,1064, 750}
};
-struct XGI330_CHTVDataStruct XGI_CHTVONTSCData[] =
+static struct XGI330_CHTVDataStruct XGI_CHTVONTSCData[] =
{
{840, 525, 840, 525},
{840, 525, 840, 525},
@@ -2449,7 +2464,7 @@ struct XGI330_CHTVDataStruct XGI_CHTVONTSCData[] =
{1040, 700,1040, 700}
};
-struct XGI330_CHTVDataStruct XGI_CHTVUPALData[] =
+static struct XGI330_CHTVDataStruct XGI_CHTVUPALData[] =
{
{1008, 625,1008, 625},
{1008, 625,1008, 625},
@@ -2459,7 +2474,7 @@ struct XGI330_CHTVDataStruct XGI_CHTVUPALData[] =
{936, 836, 936, 836}
};
-struct XGI330_CHTVDataStruct XGI_CHTVOPALData[] =
+static struct XGI330_CHTVDataStruct XGI_CHTVOPALData[] =
{
{1008, 625,1008, 625},
{1008, 625,1008, 625},
@@ -2469,7 +2484,7 @@ struct XGI330_CHTVDataStruct XGI_CHTVOPALData[] =
{960, 750, 960, 750}
};
-struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11024x768_1_H[] =
+static struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11024x768_1_H[] =
{
/* CR00,CR02,CR03,CR04,CR05,SR0B,SR0C,SR0E */
{{ 0x4B,0x27,0x8F,0x32,0x1B,0x00,0x45,0x00 }}, /* 00 (320x) */
@@ -2482,7 +2497,7 @@ struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11024x768_1_H[] =
{{ 0xA3,0x7F,0x87,0x86,0x97,0x00,0x02,0x00 }} /* 07 (1024x) */
};
-struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11280x1024_1_H[] =
+static struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11280x1024_1_H[] =
{
/* CR00,CR02,CR03,CR04,CR05,SR0B,SR0C,SR0E */
{{ 0x56,0x27,0x9A,0x30,0x1E,0x00,0x05,0x00 }}, /* 00 (320x) */
@@ -2496,7 +2511,7 @@ struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11280x1024_1_H[] =
{{ 0xCE,0x9F,0x92,0xA8,0x16,0x00,0x07,0x00 }} /* 08 (1280x) */
};
-struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11024x768_2_H[] =
+static struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11024x768_2_H[] =
{
/* CR00,CR02,CR03,CR04,CR05,SR0B,SR0C,SR0E */
{{ 0x63,0x27,0x87,0x3B,0x8C,0x00,0x01,0x00 }}, /* 00 (320x) */
@@ -2509,7 +2524,7 @@ struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11024x768_2_H[] =
{{ 0xA3,0x7F,0x87,0x86,0x97,0x00,0x02,0x00 }} /* 07 (1024x) */
};
-struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11280x1024_2_H[] =
+static struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11280x1024_2_H[] =
{
/* CR00,CR02,CR03,CR04,CR05,SR0B,SR0C,SR0E */
{{ 0x7E,0x3B,0x9A,0x44,0x12,0x00,0x01,0x00 }}, /* 00 (320x) */
@@ -2523,7 +2538,7 @@ struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11280x1024_2_H[] =
{{ 0xCE,0x9F,0x92,0xA8,0x16,0x00,0x07,0x00 }} /* 08 (1280x) */
};
-struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11400x1050_1_H[] =
+static struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11400x1050_1_H[] =
{ /* CR00,CR02,CR03,CR04,CR05,SR0B,SR0C,SR0E */
{{ 0x47,0x27,0x8B,0x2C,0x1A,0x00,0x05,0x00 }}, /* 00 (320x) */
{{ 0x47,0x27,0x8B,0x30,0x1E,0x00,0x05,0x00 }}, /* 01 (360x) */
@@ -2537,7 +2552,7 @@ struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11400x1050_1_H[] =
{{ 0xCE,0xAE,0x92,0xB3,0x01,0x00,0x03,0x00 }} /* 09 (1400x) */
};
-struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11400x1050_2_H[] =
+static struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11400x1050_2_H[] =
{ /* CR00,CR02,CR03,CR04,CR05,SR0B,SR0C,SR0E */
{{ 0x76,0x3F,0x83,0x45,0x8C,0x00,0x41,0x00 }}, /* 00 (320x) */
{{ 0x76,0x3F,0x83,0x45,0x8C,0x00,0x41,0x00 }}, /* 01 (360x) */
@@ -2551,7 +2566,7 @@ struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11400x1050_2_H[] =
{{ 0xCE,0xAE,0x92,0xBC,0x0A,0x00,0x03,0x00 }} /* 09 (1400x) */
};
-struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11600x1200_1_H[] =
+static struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11600x1200_1_H[] =
/* ;302lv channelA [ycchen] 12/05/02 LCDHT=2048 */
{ /* ; CR00,CR02,CR03,CR04,CR05,SR0B,SR0C,SR0E */
{{ 0x5B,0x27,0x9F,0x32,0x0A,0x00,0x01,0x00 }},/* 00 (320x) */
@@ -2567,7 +2582,7 @@ struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11600x1200_1_H[] =
{{ 0xFB,0xC7,0x9F,0xC9,0x81,0x00,0x07,0x00 }} /* 0A (1600x) */
};
-struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11024x768_1_V[] =
+static struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11024x768_1_V[] =
{ /* CR06,CR07,CR10,CR11,CR15,CR16,SR0A+CR09(5->7) */
{{ 0x97,0x1F,0x60,0x87,0x5D,0x83,0x10 }}, /* 00 (x350) */
{{ 0xB4,0x1F,0x92,0x89,0x8F,0xB5,0x30 }}, /* 01 (x400) */
@@ -2576,7 +2591,7 @@ struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11024x768_1_V[] =
{{ 0x24,0xF5,0x02,0x88,0xFF,0x25,0x90 }} /* 04 (x768) */
};
-struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11024x768_2_V[] =
+static struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11024x768_2_V[] =
{ /* CR06,CR07,CR10,CR11,CR15,CR16,SR0A */
{{ 0x24,0xBB,0x31,0x87,0x5D,0x25,0x30 }}, /* 00 (x350) */
{{ 0x24,0xBB,0x4A,0x80,0x8F,0x25,0x30 }}, /* 01 (x400) */
@@ -2585,7 +2600,7 @@ struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11024x768_2_V[] =
{{ 0x24,0xF5,0x02,0x88,0xFF,0x25,0x90 }} /* 04 (x768) */
};
-struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11280x1024_1_V[] =
+static struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11280x1024_1_V[] =
{ /* CR06,CR07,CR10,CR11,CR15,CR16,SR0A */
{{ 0x86,0x1F,0x5E,0x82,0x5D,0x87,0x00 }}, /* 00 (x350) */
{{ 0xB8,0x1F,0x90,0x84,0x8F,0xB9,0x30 }}, /* 01 (x400) */
@@ -2595,7 +2610,7 @@ struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11280x1024_1_V[] =
{{ 0x28,0x5A,0x13,0x87,0xFF,0x29,0xA9 }} /* 05 (x1024) */
};
-struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11280x1024_2_V[] =
+static struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11280x1024_2_V[] =
{ /* CR06,CR07,CR10,CR11,CR15,CR16,SR0A */
{{ 0x28,0xD2,0xAF,0x83,0xAE,0xD8,0xA1 }}, /* 00 (x350) */
{{ 0x28,0xD2,0xC8,0x8C,0xC7,0xF2,0x81 }}, /* 01 (x400) */
@@ -2605,7 +2620,7 @@ struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11280x1024_2_V[] =
{{ 0x28,0x5A,0x13,0x87,0xFF,0x29,0xA9 }} /* 05 (x1024) */
};
-struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11400x1050_1_V[] =
+static struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11400x1050_1_V[] =
{ /* CR06,CR07,CR10,CR11,CR15,CR16,SR0A */
{{ 0x6C,0x1F,0x60,0x84,0x5D,0x6D,0x10 }}, /* 00 (x350) */
{{ 0x9E,0x1F,0x93,0x86,0x8F,0x9F,0x30 }}, /* 01 (x400) */
@@ -2616,7 +2631,7 @@ struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11400x1050_1_V[] =
{{ 0x28,0x10,0x1A,0x80,0x19,0x29,0x0F }} /* 06 (x1050) */
};
-struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11400x1050_2_V[] =
+static struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11400x1050_2_V[] =
{ /* CR06,CR07,CR10,CR11,CR15,CR16,SR0A */
{{ 0x28,0x92,0xB6,0x83,0xB5,0xCF,0x81 }}, /* 00 (x350) */
{{ 0x28,0x92,0xD5,0x82,0xD4,0xEE,0x81 }}, /* 01 (x400) */
@@ -2627,7 +2642,7 @@ struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11400x1050_2_V[] =
{{ 0x28,0x10,0x1A,0x87,0x19,0x29,0x8F }} /* 06 (x1050) */
};
-struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11600x1200_1_V[] =
+static struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11600x1200_1_V[] =
{
/* CR06,CR07,CR10,CR11,CR15,CR16,SR0A+CR09(5->7) */
{{ 0xd4,0x1F,0x81,0x84,0x5D,0xd5,0x10 }}, /* 00 (x350) */
@@ -2640,7 +2655,7 @@ struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11600x1200_1_V[] =
{{ 0x26,0x11,0xd3,0x86,0xaF,0x27,0x3f }} /* 07 (x1200) */
};
-struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11024x768_1_Hx75[] =
+static struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11024x768_1_Hx75[] =
{ /* CR00,CR02,CR03,CR04,CR05,SR0B,SR0C,SR0E */
{{ 0x4B,0x27,0x8F,0x32,0x1B,0x00,0x45,0x00 }},/* ; 00 (320x) */
{{ 0x4B,0x27,0x8F,0x2B,0x03,0x00,0x44,0x00 }},/* ; 01 (360x) */
@@ -2652,7 +2667,7 @@ struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11024x768_1_Hx75[] =
{{ 0x9F,0x7F,0x83,0x85,0x91,0x00,0x02,0x00 }} /* ; 07 (1024x) */
};
-struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11024x768_1_Vx75[] =
+static struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11024x768_1_Vx75[] =
{ /* CR06,CR07,CR10,CR11,CR15,CR16,SR0A+CR09(5->7) */
{{ 0x97,0x1F,0x60,0x87,0x5D,0x83,0x10 }},/* ; 00 (x350) */
{{ 0xB4,0x1F,0x92,0x89,0x8F,0xB5,0x30 }},/* ; 01 (x400) */
@@ -2661,7 +2676,7 @@ struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11024x768_1_Vx75[] =
{{ 0x1E,0xF5,0x00,0x83,0xFF,0x1F,0x90 }} /* ; 04 (x768) */
};
-struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11024x768_2_Hx75[] =
+static struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11024x768_2_Hx75[] =
{ /* CR00,CR02,CR03,CR04,CR05,SR0B,SR0C,SR0E */
{{ 0x63,0x27,0x87,0x3B,0x8C,0x00,0x01,0x00 }},/* ; 00 (320x) */
{{ 0x63,0x27,0x87,0x3B,0x8C,0x00,0x01,0x00 }},/* ; 01 (360x) */
@@ -2673,7 +2688,7 @@ struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11024x768_2_Hx75[] =
{{ 0xA3,0x7F,0x87,0x86,0x97,0x00,0x02,0x00 }} /* ; 07 (1024x) */
};
-struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11024x768_2_Vx75[] =
+static struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11024x768_2_Vx75[] =
{ /* CR06,CR07,CR10,CR11,CR15,CR16,SR0A */
{{ 0x24,0xBB,0x31,0x87,0x5D,0x25,0x30 }},/* ; 00 (x350) */
{{ 0x24,0xBB,0x4A,0x80,0x8F,0x25,0x30 }},/* ; 01 (x400) */
@@ -2682,7 +2697,7 @@ struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11024x768_2_Vx75[] =
{{ 0x24,0xF5,0x02,0x88,0xFF,0x25,0x90 }} /* ; 04 (x768) */
};
-struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11280x1024_1_Hx75[] =
+static struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11280x1024_1_Hx75[] =
{ /* CR00,CR02,CR03,CR04,CR05,SR0B,SR0C,SR0E */
{{ 0x56,0x27,0x9A,0x30,0x1E,0x00,0x05,0x00 }},/* ; 00 (320x) */
{{ 0x56,0x27,0x9A,0x30,0x1E,0x00,0x05,0x00 }},/* ; 01 (360x) */
@@ -2695,7 +2710,7 @@ struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11280x1024_1_Hx75[] =
{{ 0xCE,0x9F,0x92,0xA5,0x17,0x00,0x07,0x00 }} /* ; 08 (1280x) */
};
-struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11280x1024_1_Vx75[] =
+static struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11280x1024_1_Vx75[] =
{ /* CR06,CR07,CR10,CR11,CR15,CR16,SR0A */
{{ 0x86,0xD1,0xBC,0x80,0xBB,0xE5,0x00 }},/* ; 00 (x350) */
{{ 0xB8,0x1F,0x90,0x84,0x8F,0xB9,0x30 }},/* ; 01 (x400) */
@@ -2705,7 +2720,7 @@ struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11280x1024_1_Vx75[] =
{{ 0x28,0x5A,0x13,0x87,0xFF,0x29,0xA9 }} /* ; 05 (x1024) */
};
-struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11280x1024_2_Hx75[] =
+static struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11280x1024_2_Hx75[] =
{
/* CR00,CR02,CR03,CR04,CR05,SR0B,SR0C,SR0E */
{{ 0x7E,0x3B,0x9A,0x44,0x12,0x00,0x01,0x00 }},/* ; 00 (320x) */
@@ -2719,7 +2734,7 @@ struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11280x1024_2_Hx75[] =
{{ 0xCE,0x9F,0x92,0xA8,0x16,0x00,0x07,0x00 }} /* ; 08 (1280x) */
};
-struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11280x1024_2_Vx75[] =
+static struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11280x1024_2_Vx75[] =
{
/* CR06,CR07,CR10,CR11,CR15,CR16,SR0A */
{{ 0x28,0xD2,0xAF,0x83,0xAE,0xD8,0xA1 }},/* ; 00 (x350) */
@@ -2730,7 +2745,8 @@ struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11280x1024_2_Vx75[] =
{{ 0x28,0x5A,0x13,0x87,0xFF,0x29,0xA9 }} /* ; 05 (x1024) */
};
-struct XGI_LVDSCRT1DataStruct XGI_CHTVCRT1UNTSC[] =
+#if 0
+static struct XGI_LVDSCRT1DataStruct XGI_CHTVCRT1UNTSC[] =
{
{{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e,
0xe8,0x84,0x8f,0x57,0x20,0x00,0x01,0x00 }},
@@ -2746,7 +2762,7 @@ struct XGI_LVDSCRT1DataStruct XGI_CHTVCRT1UNTSC[] =
0x90,0x8c,0x57,0xed,0x20,0x00,0x06,0x01 }}
};
-struct XGI_LVDSCRT1DataStruct XGI_CHTVCRT1ONTSC[] =
+static struct XGI_LVDSCRT1DataStruct XGI_CHTVCRT1ONTSC[] =
{
{{0x64,0x4f,0x88,0x5a,0x9f,0x0b,0x3e,
0xc0,0x84,0x8f,0x0c,0x20,0x00,0x01,0x00 }},
@@ -2762,7 +2778,7 @@ struct XGI_LVDSCRT1DataStruct XGI_CHTVCRT1ONTSC[] =
0x7f,0x86,0x57,0xbb,0x00,0x00,0x06,0x01 }}
};
-struct XGI_LVDSCRT1DataStruct XGI_CHTVCRT1UPAL[] =
+static struct XGI_LVDSCRT1DataStruct XGI_CHTVCRT1UPAL[] =
{
{{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
0xf8,0x83,0x8f,0x70,0x20,0x00,0x05,0x00 }},
@@ -2778,7 +2794,7 @@ struct XGI_LVDSCRT1DataStruct XGI_CHTVCRT1UPAL[] =
0xc8,0x8c,0x57,0xe9,0x20,0x00,0x05,0x01 }}
};
-struct XGI_LVDSCRT1DataStruct XGI_CHTVCRT1OPAL[] =
+static struct XGI_LVDSCRT1DataStruct XGI_CHTVCRT1OPAL[] =
{
{{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
0xf0,0x83,0x8f,0x70,0x20,0x00,0x05,0x00 }},
@@ -2793,9 +2809,10 @@ struct XGI_LVDSCRT1DataStruct XGI_CHTVCRT1OPAL[] =
{{0x73,0x63,0x97,0x69,0x8e,0xec,0xf0,
0x90,0x8c,0x57,0xed,0x20,0x00,0x05,0x01 }}
};
+#endif
/*add for new UNIVGABIOS*/
-struct XGI330_LCDDataTablStruct XGI_LCDDataTable[] =
+static struct XGI330_LCDDataTablStruct XGI_LCDDataTable[] =
{
{Panel1024x768,0x0019,0x0001,0}, /* XGI_ExtLCD1024x768Data */
{Panel1024x768,0x0019,0x0000,1}, /* XGI_StLCD1024x768Data */
@@ -2819,7 +2836,7 @@ struct XGI330_LCDDataTablStruct XGI_LCDDataTable[] =
{0xFF,0x0000,0x0000,0} /* End of table */
};
-struct XGI330_LCDDataTablStruct XGI_LCDDesDataTable[] =
+static struct XGI330_LCDDataTablStruct XGI_LCDDesDataTable[] =
{
{Panel1024x768,0x0019,0x0001,0}, /* XGI_ExtLCDDes1024x768Data */
{Panel1024x768,0x0019,0x0000,1}, /* XGI_StLCDDes1024x768Data */
@@ -2844,7 +2861,7 @@ struct XGI330_LCDDataTablStruct XGI_LCDDesDataTable[] =
{0xFF,0x0000,0x0000,0}
};
-struct XGI330_LCDDataTablStruct XGI_EPLLCDCRT1Ptr_H[] =
+static struct XGI330_LCDDataTablStruct XGI_EPLLCDCRT1Ptr_H[] =
{
{Panel1024x768,0x0018,0x0000,0}, /* XGI_LVDSCRT11024x768_1_H */
{Panel1024x768,0x0018,0x0010,1}, /* XGI_LVDSCRT11024x768_2_H */
@@ -2860,7 +2877,7 @@ struct XGI330_LCDDataTablStruct XGI_EPLLCDCRT1Ptr_H[] =
{0xFF,0x0000,0x0000,0}
};
-struct XGI330_LCDDataTablStruct XGI_EPLLCDCRT1Ptr_V[] =
+static struct XGI330_LCDDataTablStruct XGI_EPLLCDCRT1Ptr_V[] =
{
{Panel1024x768,0x0018,0x0000,0}, /* XGI_LVDSCRT11024x768_1_V */
{Panel1024x768,0x0018,0x0010,1}, /* XGI_LVDSCRT11024x768_2_V */
@@ -2876,7 +2893,7 @@ struct XGI330_LCDDataTablStruct XGI_EPLLCDCRT1Ptr_V[] =
{0xFF,0x0000,0x0000,0}
};
-struct XGI330_LCDDataTablStruct XGI_EPLLCDDataPtr[] =
+static struct XGI330_LCDDataTablStruct XGI_EPLLCDDataPtr[] =
{
{Panel1024x768,0x0018,0x0000,0}, /* XGI_LVDS1024x768Data_1 */
{Panel1024x768,0x0018,0x0010,1}, /* XGI_LVDS1024x768Data_2 */
@@ -2894,7 +2911,7 @@ struct XGI330_LCDDataTablStruct XGI_EPLLCDDataPtr[] =
{0xFF,0x0000,0x0000,0}
};
-struct XGI330_LCDDataTablStruct XGI_EPLLCDDesDataPtr[] =
+static struct XGI330_LCDDataTablStruct XGI_EPLLCDDesDataPtr[] =
{
{Panel1024x768,0x0018,0x0000,0}, /* XGI_LVDS1024x768Des_1 */
{Panel1024x768,0x0618,0x0410,1}, /* XGI_LVDS1024x768Des_3 */
@@ -2914,14 +2931,14 @@ struct XGI330_LCDDataTablStruct XGI_EPLLCDDesDataPtr[] =
{0xFF,0x0000,0x0000,0}
};
-struct XGI330_LCDDataTablStruct XGI_EPLCHLCDRegPtr[] =
+static struct XGI330_LCDDataTablStruct XGI_EPLCHLCDRegPtr[] =
{
{Panel1024x768,0x0000,0x0000,0}, /* XGI_CH7017LV1024x768 */
{Panel1400x1050,0x0000,0x0000,1}, /* XGI_CH7017LV1400x1050 */
{0xFF,0x0000,0x0000,0}
};
-struct XGI330_TVDataTablStruct XGI_TVDataTable[] =
+static struct XGI330_TVDataTablStruct XGI_TVDataTable[] =
{
{0x09E1,0x0001,0}, /* XGI_ExtPALData */
{0x09E1,0x0000,1}, /* XGI_ExtNTSCData */
@@ -2939,7 +2956,8 @@ struct XGI330_TVDataTablStruct XGI_TVDataTable[] =
{0xffff,0x0000,12} /* END */
};
-unsigned short TVLenList[] =
+#if 0
+static unsigned short TVLenList[] =
{
LVDSCRT1Len_H,
LVDSCRT1Len_V,
@@ -2950,9 +2968,10 @@ unsigned short TVLenList[] =
0,
CHTVRegLen
} ;
+#endif
/* Chrontel 7017 TV CRT1 Timing List */
-struct XGI330_TVDataTablStruct XGI_EPLCHTVCRT1Ptr[] =
+static struct XGI330_TVDataTablStruct XGI_EPLCHTVCRT1Ptr[] =
{
{0x0011,0x0000,0}, /* XGI_CHTVCRT1UNTSC */
{0x0011,0x0010,1}, /* XGI_CHTVCRT1ONTSC */
@@ -2962,7 +2981,7 @@ struct XGI330_TVDataTablStruct XGI_EPLCHTVCRT1Ptr[] =
};
/* ;;Chrontel 7017 TV Timing List */
-struct XGI330_TVDataTablStruct XGI_EPLCHTVDataPtr[] =
+static struct XGI330_TVDataTablStruct XGI_EPLCHTVDataPtr[] =
{
{0x0011,0x0000,0}, /* XGI_CHTVUNTSCData */
{0x0011,0x0010,1}, /* XGI_CHTVONTSCData */
@@ -2972,7 +2991,7 @@ struct XGI330_TVDataTablStruct XGI_EPLCHTVDataPtr[] =
};
/* ;;Chrontel 7017 TV Reg. List */
-struct XGI330_TVDataTablStruct XGI_EPLCHTVRegPtr[] =
+static struct XGI330_TVDataTablStruct XGI_EPLCHTVRegPtr[] =
{
{0x0011,0x0000,0}, /* XGI_CHTVRegUNTSC */
{0x0011,0x0010,1}, /* XGI_CHTVRegONTSC */
@@ -2981,7 +3000,7 @@ struct XGI330_TVDataTablStruct XGI_EPLCHTVRegPtr[] =
{0xFFFF,0x0000,4}
};
-unsigned short LCDLenList[] =
+static unsigned short LCDLenList[] =
{
LVDSCRT1Len_H,
LVDSCRT1Len_V,
@@ -2995,7 +3014,8 @@ unsigned short LCDLenList[] =
0
} ;
-struct XGI330_LCDCapStruct XGI660_LCDDLCapList[] = /* 660, Dual link */
+#if 0
+static struct XGI330_LCDCapStruct XGI660_LCDDLCapList[] = /* 660, Dual link */
{
/* LCDCap1024x768 */
{Panel1024x768, DefaultLCDCap, 0, 0x014, 0x88, 0x06, VCLK65,
@@ -3026,8 +3046,9 @@ struct XGI330_LCDCapStruct XGI660_LCDDLCapList[] = /* 660, Dual link */
0x6C, 0xC3, 0x35, 0x62, 0x02, 0x14, 0x0A, 0x02, 0x00,
0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x28, 0x10}
};
+#endif
-struct XGI330_LCDCapStruct XGI_LCDDLCapList[] = /* Dual link only */
+static struct XGI330_LCDCapStruct XGI_LCDDLCapList[] = /* Dual link only */
{
/* LCDCap1024x768 */
{Panel1024x768, DefaultLCDCap, 0, 0x012, 0x88, 0x06, VCLK65,
@@ -3059,7 +3080,8 @@ struct XGI330_LCDCapStruct XGI_LCDDLCapList[] = /* Dual link only */
0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x28, 0x10}
};
-struct XGI330_LCDCapStruct XGI660_LCDCapList[] =
+#if 0
+static struct XGI330_LCDCapStruct XGI660_LCDCapList[] =
{
/* LCDCap1024x768 */
{Panel1024x768, DefaultLCDCap, 0, 0x014, 0x88, 0x06, VCLK65,
@@ -3090,8 +3112,9 @@ struct XGI330_LCDCapStruct XGI660_LCDCapList[] =
0x6C, 0xC3, 0x35, 0x62, 0x02, 0x14, 0x0A, 0x02, 0x00,
0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x28, 0x10}
};
+#endif
-struct XGI330_LCDCapStruct XGI_LCDCapList[] =
+static struct XGI330_LCDCapStruct XGI_LCDCapList[] =
{
/* LCDCap1024x768 */
{Panel1024x768, DefaultLCDCap, 0, 0x012, 0x88, 0x06, VCLK65,
@@ -3152,7 +3175,7 @@ struct XGI21_LVDSCapStruct XGI21_LCDCapList[] =
};
-struct XGI_Ext2Struct XGI330_RefIndex[] =
+static struct XGI_Ext2Struct XGI330_RefIndex[] =
{
{Support32Bpp + SupportAllCRT2 + SyncPN, RES320x200, VCLK25_175, 0x00,0x10,0x59, 320, 200},/* 00 */
{Support32Bpp + SupportAllCRT2 + SyncPN, RES320x200, VCLK25_175, 0x00,0x10,0x00, 320, 400},/* 01 */
@@ -3230,8 +3253,8 @@ struct XGI_Ext2Struct XGI330_RefIndex[] =
};
-
-struct XGI330_VCLKDataStruct XGI330_VCLKData[] =
+#if 0
+static struct XGI330_VCLKDataStruct XGI330_VCLKData[] =
{
{ 0x1b,0xe1, 25}, /* 0x0 */
{ 0x4e,0xe4, 28}, /* 0x1 */
@@ -3315,7 +3338,7 @@ struct XGI330_VCLKDataStruct XGI330_VCLKData[] =
{ 0x3b,0x61,108} /* 0x4f */
};
-struct XGI_VBVCLKDataStruct XGI330_VBVCLKData[] =
+static struct XGI_VBVCLKDataStruct XGI330_VBVCLKData[] =
{
{ 0x1b,0xe1, 25}, /* 0x0 */
{ 0x4e,0xe4, 28}, /* 0x1 */
@@ -3392,12 +3415,14 @@ struct XGI_VBVCLKDataStruct XGI330_VBVCLKData[] =
{ 0x5e,0x64,68}, /* 0x48 chiawen for fuj1280x768*/
{ 0x70,0x44,108}, /* 0x49 chiawen for 1400x1050*/
};
+#endif
-unsigned char XGI330_ScreenOffset[] = { 0x14, 0x19, 0x20, 0x28, 0x32, 0x40,
+static unsigned char XGI330_ScreenOffset[] = {
+ 0x14, 0x19, 0x20, 0x28, 0x32, 0x40,
0x50, 0x64, 0x78, 0x80, 0x2d, 0x35,
0x57, 0x48};
-struct XGI_StResInfoStruct XGI330_StResInfo[] =
+static struct XGI_StResInfoStruct XGI330_StResInfo[] =
{
{ 640,400},
{ 640,350},
@@ -3406,7 +3431,7 @@ struct XGI_StResInfoStruct XGI330_StResInfo[] =
{ 640,480}
};
-struct XGI_ModeResInfoStruct XGI330_ModeResInfo[] =
+static struct XGI_ModeResInfoStruct XGI330_ModeResInfo[] =
{
{ 320, 200, 8, 8},
{ 320, 240, 8, 8},
@@ -3433,10 +3458,12 @@ struct XGI_ModeResInfoStruct XGI330_ModeResInfo[] =
{ 1152, 864, 8,16}
};
-unsigned char XGI330_OutputSelect = 0x40;
-unsigned char XGI330_SoftSetting = 0x30;
-unsigned char XGI330_SR07 = 0x18;
-unsigned char XGI330New_SR15[8][8] = {
+static unsigned char XGI330_OutputSelect = 0x40;
+static unsigned char XGI330_SoftSetting = 0x30;
+static unsigned char XGI330_SR07 = 0x18;
+
+#if 0
+static unsigned char XGI330New_SR15[8][8] = {
{0x0,0x4,0x60,0x60},
{0xf,0xf,0xf,0xf},
{0xba,0xba,0xba,0xba},
@@ -3447,71 +3474,78 @@ unsigned char XGI330New_SR15[8][8] = {
{0x0,0xa5,0xfb,0xf6}
};
-unsigned char XGI330New_CR40[5][8] = {
+static unsigned char XGI330New_CR40[5][8] = {
{0x77,0x77,0x44,0x44},
{0x77,0x77,0x44,0x44},
{0x0,0x0,0x0,0x0},
{0x5b,0x5b,0xab,0xab},
{0x0,0x0,0xf0,0xf8}
};
-
-unsigned char XGI330_CR49[] = {0xaa, 0x88};
-unsigned char XGI330_SR1F = 0x0;
-unsigned char XGI330_SR21 = 0xa3;
-unsigned char XGI330_650_SR21 = 0xa7;
-unsigned char XGI330_SR22 = 0xfb;
-unsigned char XGI330_SR23 = 0xf6;
-unsigned char XGI330_SR24 = 0xd;
-
-unsigned char XGI660_SR21 = 0xa3;/* 2003.0312 */
-unsigned char XGI660_SR22 = 0xf3;/* 2003.0312 */
-
-unsigned char XGI330_LVDS_SR32 = 0x00; /* ynlai for 650 LVDS */
-unsigned char XGI330_LVDS_SR33 = 0x00; /* chiawen for 650 LVDS */
-unsigned char XGI330_650_SR31 = 0x40;
-unsigned char XGI330_650_SR33 = 0x04;
-unsigned char XGI330_CRT2Data_1_2 = 0x0;
-unsigned char XGI330_CRT2Data_4_D = 0x0;
-unsigned char XGI330_CRT2Data_4_E = 0x0;
-unsigned char XGI330_CRT2Data_4_10 = 0x80;
-unsigned short XGI330_RGBSenseData = 0xd1;
-unsigned short XGI330_VideoSenseData = 0xb9;
-unsigned short XGI330_YCSenseData = 0xb3;
-unsigned short XGI330_RGBSenseData2 = 0x0190; /*301b*/
-unsigned short XGI330_VideoSenseData2 = 0x0110;
-unsigned short XGI330_YCSenseData2 = 0x016B;
-unsigned char XGI330_NTSCPhase[] = {0x21, 0xed, 0x8a, 0x8};
-unsigned char XGI330_PALPhase[] = {0x2a, 0x5, 0xd3, 0x0};
-unsigned char XGI330_NTSCPhase2[] = {0x21, 0xF0, 0x7B, 0xD6};/*301b*/
-unsigned char XGI330_PALPhase2[] = {0x2a, 0x09, 0x86, 0xe9};
-unsigned char XGI330_PALMPhase[] = {0x21, 0xE4, 0x2E, 0x9B}; /*palmn*/
-unsigned char XGI330_PALNPhase[] = {0x21, 0xF4, 0x3E, 0xBA};
-unsigned char XG40_I2CDefinition = 0x00 ;
-unsigned char XG20_CR97 = 0x10 ;
-
-unsigned char XG21_DVOSetting = 0x00 ;
-unsigned char XG21_CR2E = 0x00 ;
-unsigned char XG21_CR2F = 0x00 ;
-unsigned char XG21_CR46 = 0x00 ;
-unsigned char XG21_CR47 = 0x00 ;
-
-unsigned char XG27_CR97 = 0xC1 ;
-unsigned char XG27_SR36 = 0x30 ;
-unsigned char XG27_CR8F = 0x0C ;
-unsigned char XG27_CRD0[] = {0, 0, 0, 0, 0, 0, 0, 0x82, 0x00, 0x66, 0x01, 0x00};
-unsigned char XG27_CRDE[] = {0, 0};
-unsigned char XG27_SR40 = 0x04 ;
-unsigned char XG27_SR41 = 0x00 ;
-
-unsigned char XGI330_CHTVVCLKUNTSC[] = {0x00};
-
-unsigned char XGI330_CHTVVCLKONTSC[] = {0x00};
-
-unsigned char XGI330_CHTVVCLKUPAL[] = {0x00};
-
-unsigned char XGI330_CHTVVCLKOPAL[] = {0x00};
-
-unsigned char XGI7007_CHTVVCLKUNTSC[] = {CH7007TVVCLK30_2,
+#endif
+
+static unsigned char XGI330_CR49[] = {0xaa, 0x88};
+static unsigned char XGI330_SR1F = 0x0;
+static unsigned char XGI330_SR21 = 0xa3;
+#if 0
+static unsigned char XGI330_650_SR21 = 0xa7;
+#endif
+static unsigned char XGI330_SR22 = 0xfb;
+static unsigned char XGI330_SR23 = 0xf6;
+static unsigned char XGI330_SR24 = 0xd;
+
+#if 0
+static unsigned char XGI660_SR21 = 0xa3;/* 2003.0312 */
+static unsigned char XGI660_SR22 = 0xf3;/* 2003.0312 */
+
+static unsigned char XGI330_LVDS_SR32 = 0x00; /* ynlai for 650 LVDS */
+static unsigned char XGI330_LVDS_SR33 = 0x00; /* chiawen for 650 LVDS */
+static unsigned char XGI330_650_SR31 = 0x40;
+static unsigned char XGI330_650_SR33 = 0x04;
+#endif
+static unsigned char XGI330_CRT2Data_1_2 = 0x0;
+static unsigned char XGI330_CRT2Data_4_D = 0x0;
+static unsigned char XGI330_CRT2Data_4_E = 0x0;
+static unsigned char XGI330_CRT2Data_4_10 = 0x80;
+static unsigned short XGI330_RGBSenseData = 0xd1;
+static unsigned short XGI330_VideoSenseData = 0xb9;
+static unsigned short XGI330_YCSenseData = 0xb3;
+static unsigned short XGI330_RGBSenseData2 = 0x0190; /*301b*/
+static unsigned short XGI330_VideoSenseData2 = 0x0110;
+static unsigned short XGI330_YCSenseData2 = 0x016B;
+#if 0
+static unsigned char XGI330_NTSCPhase[] = {0x21, 0xed, 0x8a, 0x8};
+static unsigned char XGI330_PALPhase[] = {0x2a, 0x5, 0xd3, 0x0};
+static unsigned char XGI330_NTSCPhase2[] = {0x21, 0xF0, 0x7B, 0xD6};/*301b*/
+static unsigned char XGI330_PALPhase2[] = {0x2a, 0x09, 0x86, 0xe9};
+static unsigned char XGI330_PALMPhase[] = {0x21, 0xE4, 0x2E, 0x9B}; /*palmn*/
+static unsigned char XGI330_PALNPhase[] = {0x21, 0xF4, 0x3E, 0xBA};
+#endif
+static unsigned char XG40_I2CDefinition = 0x00 ;
+static unsigned char XG20_CR97 = 0x10 ;
+
+static unsigned char XG21_DVOSetting = 0x00 ;
+static unsigned char XG21_CR2E = 0x00 ;
+static unsigned char XG21_CR2F = 0x00 ;
+static unsigned char XG21_CR46 = 0x00 ;
+static unsigned char XG21_CR47 = 0x00 ;
+
+static unsigned char XG27_CR97 = 0xC1 ;
+static unsigned char XG27_SR36 = 0x30 ;
+static unsigned char XG27_CR8F = 0x0C ;
+static unsigned char XG27_CRD0[] = {0, 0, 0, 0, 0, 0, 0, 0x82, 0x00, 0x66, 0x01, 0x00};
+static unsigned char XG27_CRDE[] = {0, 0};
+static unsigned char XG27_SR40 = 0x04 ;
+static unsigned char XG27_SR41 = 0x00 ;
+
+static unsigned char XGI330_CHTVVCLKUNTSC[] = {0x00};
+
+static unsigned char XGI330_CHTVVCLKONTSC[] = {0x00};
+
+static unsigned char XGI330_CHTVVCLKUPAL[] = {0x00};
+
+static unsigned char XGI330_CHTVVCLKOPAL[] = {0x00};
+
+static unsigned char XGI7007_CHTVVCLKUNTSC[] = {CH7007TVVCLK30_2,
CH7007TVVCLK30_2,
CH7007TVVCLK30_2,
CH7007TVVCLK30_2,
@@ -3519,7 +3553,7 @@ unsigned char XGI7007_CHTVVCLKUNTSC[] = {CH7007TVVCLK30_2,
CH7007TVVCLK47_8
};
-unsigned char XGI7007_CHTVVCLKONTSC[] = {CH7007TVVCLK26_4,
+static unsigned char XGI7007_CHTVVCLKONTSC[] = {CH7007TVVCLK26_4,
CH7007TVVCLK26_4,
CH7007TVVCLK26_4,
CH7007TVVCLK26_4,
@@ -3527,7 +3561,7 @@ unsigned char XGI7007_CHTVVCLKONTSC[] = {CH7007TVVCLK26_4,
CH7007TVVCLK43_6
};
-unsigned char XGI7007_CHTVVCLKUPAL[] = {CH7007TVVCLK31_5,
+static unsigned char XGI7007_CHTVVCLKUPAL[] = {CH7007TVVCLK31_5,
CH7007TVVCLK31_5,
CH7007TVVCLK31_5,
CH7007TVVCLK31_5,
@@ -3535,7 +3569,7 @@ unsigned char XGI7007_CHTVVCLKUPAL[] = {CH7007TVVCLK31_5,
CH7007TVVCLK39
};
-unsigned char XGI7007_CHTVVCLKOPAL[] = {CH7007TVVCLK31_5,
+static unsigned char XGI7007_CHTVVCLKOPAL[] = {CH7007TVVCLK31_5,
CH7007TVVCLK31_5,
CH7007TVVCLK31_5,
CH7007TVVCLK31_5,
@@ -3543,7 +3577,7 @@ unsigned char XGI7007_CHTVVCLKOPAL[] = {CH7007TVVCLK31_5,
CH7007TVVCLK36
};
-struct XGI330_VCLKDataStruct XGI_CH7007VCLKData[] =
+static struct XGI330_VCLKDataStruct XGI_CH7007VCLKData[] =
{
{ 0x60,0x36,30}, /* 0 30.2 MHZ */
{ 0x40,0x4A,28}, /* 1 28.19 MHZ */
@@ -3558,7 +3592,7 @@ struct XGI330_VCLKDataStruct XGI_CH7007VCLKData[] =
{ 0xFF,0x00,0 } /* End mark */
};
-struct XGI330_VCLKDataStruct XGI_VCLKData[] =
+static struct XGI330_VCLKDataStruct XGI_VCLKData[] =
{
/* SR2B,SR2C,SR2D */
{ 0x1B,0xE1,25 },/* 00 (25.175MHz) */
@@ -3759,7 +3793,7 @@ struct XGI330_VCLKDataStruct XGI_VCLKData[] =
{ 0xFF,0x00,0 }/* End mark */
} ;
-struct XGI330_VCLKDataStruct XGI_VBVCLKData[] =
+static struct XGI330_VCLKDataStruct XGI_VBVCLKData[] =
{
{ 0x1B,0xE1,25 },/* 00 (25.175MHz) */
@@ -3960,7 +3994,8 @@ struct XGI330_VCLKDataStruct XGI_VBVCLKData[] =
{ 0xFF,0x00,0 } /* End mark */
};
-unsigned char XGI660_TVDelayList[] =
+#if 0
+static unsigned char XGI660_TVDelayList[] =
{
0x44, /* ; 0 ExtNTSCDelay */
0x44, /* ; 1 StNTSCDelay */
@@ -3976,7 +4011,7 @@ unsigned char XGI660_TVDelayList[] =
0x44 /* ; B StYPbPrDealy(750p) */
};
-unsigned char XGI660_TVDelayList2[] =
+static unsigned char XGI660_TVDelayList2[] =
{
0x44, /* ; 0 ExtNTSCDelay */
0x44, /* ; 1 StNTSCDelay */
@@ -3991,8 +4026,9 @@ unsigned char XGI660_TVDelayList2[] =
0x44, /* ; A ExtYPbPrDelay(750p) */
0x44 /* ; B StYPbPrDealy(750p) */
};
+#endif
-unsigned char XGI301TVDelayList[] =
+static unsigned char XGI301TVDelayList[] =
{
0x22, /* ; 0 ExtNTSCDelay */
0x22, /* ; 1 StNTSCDelay */
@@ -4008,7 +4044,7 @@ unsigned char XGI301TVDelayList[] =
0x22 /* B StYPbPrDealy(750p) */
};
-unsigned char XGI301TVDelayList2[] =
+static unsigned char XGI301TVDelayList2[] =
{
0x22, /* ; 0 ExtNTSCDelay */
0x22, /* ; 1 StNTSCDelay */
@@ -4025,7 +4061,7 @@ unsigned char XGI301TVDelayList2[] =
};
-unsigned char TVAntiFlickList[] =
+static unsigned char TVAntiFlickList[] =
{/* NTSCAntiFlicker */
0x04, /* ; 0 Adaptive */
0x00, /* ; 1 new anti-flicker ? */
@@ -4038,7 +4074,7 @@ unsigned char TVAntiFlickList[] =
};
-unsigned char TVEdgeList[] =
+static unsigned char TVEdgeList[] =
{
0x00, /* ; 0 NTSC No Edge enhance */
0x04, /* ; 1 NTSC Adaptive Edge enhance */
@@ -4048,7 +4084,7 @@ unsigned char TVEdgeList[] =
0x00 /* ; 1 HiTV */
};
-unsigned long TVPhaseList[] =
+static unsigned long TVPhaseList[] =
{ 0x08BAED21, /* ; 0 NTSC phase */
0x00E3052A, /* ; 1 PAL phase */
0x9B2EE421, /* ; 2 PAL-M phase */
@@ -4065,7 +4101,7 @@ unsigned long TVPhaseList[] =
0xE00A831E /* ; D PAL-M 1024x768 */
};
-unsigned char NTSCYFilter1[] =
+static unsigned char NTSCYFilter1[] =
{
0x00,0xF4,0x10,0x38 ,/* 0 : 320x text mode */
0x00,0xF4,0x10,0x38 ,/* 1 : 360x text mode */
@@ -4076,7 +4112,7 @@ unsigned char NTSCYFilter1[] =
0xEB,0x15,0x25,0xF6 /* 6 : 800x gra. mode */
};
-unsigned char PALYFilter1[] =
+static unsigned char PALYFilter1[] =
{
0x00,0xF4,0x10,0x38, /* 0 : 320x text mode */
0x00,0xF4,0x10,0x38 ,/* 1 : 360x text mode */
@@ -4087,7 +4123,7 @@ unsigned char PALYFilter1[] =
0xFC,0xFB,0x14,0x2A /* 6 : 800x gra. mode */
};
-unsigned char PALMYFilter1[] =
+static unsigned char PALMYFilter1[] =
{
0x00,0xF4,0x10,0x38, /* 0 : 320x text mode */
0x00,0xF4,0x10,0x38, /* 1 : 360x text mode */
@@ -4099,7 +4135,7 @@ unsigned char PALMYFilter1[] =
0xFF,0xFF,0xFF,0xFF /* End of Table */
};
-unsigned char PALNYFilter1[] =
+static unsigned char PALNYFilter1[] =
{
0x00,0xF4,0x10,0x38, /* 0 : 320x text mode */
0x00,0xF4,0x10,0x38, /* 1 : 360x text mode */
@@ -4111,7 +4147,7 @@ unsigned char PALNYFilter1[] =
0xFF,0xFF,0xFF,0xFF /* End of Table */
};
-unsigned char NTSCYFilter2[] =
+static unsigned char NTSCYFilter2[] =
{
0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46, /* 0 : 320x text mode */
0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C, /* 1 : 360x text mode */
@@ -4123,7 +4159,7 @@ unsigned char NTSCYFilter2[] =
0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28 /* 7 : 1024xgra. mode */
};
-unsigned char PALYFilter2[] =
+static unsigned char PALYFilter2[] =
{
0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46, /* 0 : 320x text mode */
0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C, /* 1 : 360x text mode */
@@ -4135,7 +4171,7 @@ unsigned char PALYFilter2[] =
0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28 /* 7 : 1024xgra. mode */
};
-unsigned char PALMYFilter2[] =
+static unsigned char PALMYFilter2[] =
{
0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46, /* 0 : 320x text mode */
0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C, /* 1 : 360x text mode */
@@ -4147,7 +4183,7 @@ unsigned char PALMYFilter2[] =
0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28 /* 7 : 1024xgra. mode */
};
-unsigned char PALNYFilter2[] =
+static unsigned char PALNYFilter2[] =
{
0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46, /* 0 : 320x text mode */
0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C, /* 1 : 360x text mode */
@@ -4159,14 +4195,14 @@ unsigned char PALNYFilter2[] =
0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28 /* 7 : 1024xgra. mode */
};
-unsigned char XGI_NTSC1024AdjTime[] =
+static unsigned char XGI_NTSC1024AdjTime[] =
{
0xa7,0x07,0xf2,0x6e,0x17,0x8b,0x73,0x53,
0x13,0x40,0x34,0xF4,0x63,0xBB,0xCC,0x7A,
0x58,0xe4,0x73,0xd0,0x13
};
-struct XGI301C_Tap4TimingStruct HiTVTap4Timing[] =
+static struct XGI301C_Tap4TimingStruct HiTVTap4Timing[] =
{
{0,{
0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F, /* ; C0-C7 */
@@ -4181,7 +4217,7 @@ struct XGI301C_Tap4TimingStruct HiTVTap4Timing[] =
}
};
-struct XGI301C_Tap4TimingStruct EnlargeTap4Timing[] =
+static struct XGI301C_Tap4TimingStruct EnlargeTap4Timing[] =
{
{0,{
0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F, /* ; C0-C7 */
@@ -4196,7 +4232,7 @@ struct XGI301C_Tap4TimingStruct EnlargeTap4Timing[] =
}
};
-struct XGI301C_Tap4TimingStruct NoScaleTap4Timing[] =
+static struct XGI301C_Tap4TimingStruct NoScaleTap4Timing[] =
{
{0,{
0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F, /* ; C0-C7 */
@@ -4211,7 +4247,7 @@ struct XGI301C_Tap4TimingStruct NoScaleTap4Timing[] =
}
};
-struct XGI301C_Tap4TimingStruct PALTap4Timing[] =
+static struct XGI301C_Tap4TimingStruct PALTap4Timing[] =
{
{600, {
0x05,0x19,0x05,0x7D,0x03,0x19,0x06,0x7E, /* ; C0-C7 */
@@ -4249,7 +4285,7 @@ struct XGI301C_Tap4TimingStruct PALTap4Timing[] =
}
};
-struct XGI301C_Tap4TimingStruct NTSCTap4Timing[] =
+static struct XGI301C_Tap4TimingStruct NTSCTap4Timing[] =
{
{480, {
0x04,0x1A,0x04,0x7E,0x03,0x1A,0x06,0x7D, /* ; C0-C7 */
@@ -4287,7 +4323,7 @@ struct XGI301C_Tap4TimingStruct NTSCTap4Timing[] =
}
};
-struct XGI301C_Tap4TimingStruct YPbPr525pTap4Timing[] =
+static struct XGI301C_Tap4TimingStruct YPbPr525pTap4Timing[] =
{
{480, {
0x04,0x1A,0x04,0x7E,0x03,0x1A,0x06,0x7D, /* ; C0-C7 */
@@ -4325,7 +4361,7 @@ struct XGI301C_Tap4TimingStruct YPbPr525pTap4Timing[] =
}
};
-struct XGI301C_Tap4TimingStruct YPbPr525iTap4Timing[] =
+static struct XGI301C_Tap4TimingStruct YPbPr525iTap4Timing[] =
{
{480, {
0x04,0x1A,0x04,0x7E,0x03,0x1A,0x06,0x7D, /* ; C0-C7 */
@@ -4363,7 +4399,7 @@ struct XGI301C_Tap4TimingStruct YPbPr525iTap4Timing[] =
}
};
-struct XGI301C_Tap4TimingStruct YPbPr750pTap4Timing[] =
+static struct XGI301C_Tap4TimingStruct YPbPr750pTap4Timing[] =
{ {0xFFFF,
{
0x05,0x19,0x05,0x7D,0x03,0x19,0x06,0x7E, /* ; C0-C7 */
diff --git a/drivers/staging/xgifb/vb_util.c b/drivers/staging/xgifb/vb_util.c
index 2c40368..65b3954 100644
--- a/drivers/staging/xgifb/vb_util.c
+++ b/drivers/staging/xgifb/vb_util.c
@@ -6,21 +6,20 @@
#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);
+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);
-
+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);
/* --------------------------------------------------------------------- */
/* Function : XGINew_SetReg1 */
@@ -28,181 +27,110 @@ void XGINew_SetRegAND(unsigned long Port,unsigned short Index,
/* Output : */
/* Description : SR CRTC GR */
/* --------------------------------------------------------------------- */
-void XGINew_SetReg1( unsigned long port , unsigned short index , unsigned short data )
+void XGINew_SetReg1(unsigned long port, unsigned short index,
+ unsigned short 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 )
+/*
+void XGINew_SetReg2(unsigned long port, unsigned short index, unsigned short data)
{
- InPortByte((P unsigned char )port + 0x3da - 0x3c0) ;
- OutPortByte( XGINew_P3c0 , index ) ;
- OutPortByte( XGINew_P3c0 , data ) ;
- OutPortByte( XGINew_P3c0 , 0x20 ) ;
-}*/
-
+ InPortByte((P unsigned char)port + 0x3da - 0x3c0) ;
+ OutPortByte(XGINew_P3c0, index);
+ OutPortByte(XGINew_P3c0, data);
+ OutPortByte(XGINew_P3c0, 0x20);
+}
+*/
-/* --------------------------------------------------------------------- */
-/* Function : */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_SetReg3( unsigned long port , unsigned short data )
+void XGINew_SetReg3(unsigned long port, unsigned short data)
{
outb(data, port);
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_SetReg4 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_SetReg4( unsigned long port , unsigned long data )
+void XGINew_SetReg4(unsigned long port, unsigned long data)
{
outl(data, port);
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_GetReg1 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
unsigned char XGINew_GetReg1(unsigned long port, unsigned short index)
{
- unsigned char data ;
+ unsigned char data;
- outb(index, port);
- data = inb(port + 1) ;
- return( data ) ;
+ outb(index, port);
+ data = inb(port + 1);
+ return data;
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_GetReg2 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
unsigned char XGINew_GetReg2(unsigned long port)
{
- unsigned char data ;
+ unsigned char data;
- data = inb(port) ;
+ data = inb(port);
- return( data ) ;
+ return data;
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_GetReg3 */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-unsigned long XGINew_GetReg3( unsigned long port )
+unsigned long XGINew_GetReg3(unsigned long port)
{
- unsigned long data ;
+ unsigned long data;
- data = inl(port) ;
+ data = inl(port);
- return( data ) ;
+ return data;
}
-
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_SetRegANDOR */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_SetRegANDOR( unsigned long Port , unsigned short Index , unsigned short DataAND , unsigned short DataOR )
+void XGINew_SetRegANDOR(unsigned long Port, unsigned short Index,
+ unsigned short DataAND, unsigned short DataOR)
{
- unsigned short temp ;
+ unsigned short temp;
- temp = XGINew_GetReg1( Port , Index ) ; /* XGINew_Part1Port index 02 */
- temp = ( temp & ( DataAND ) ) | DataOR ;
- XGINew_SetReg1( Port , Index , temp ) ;
+ temp = XGINew_GetReg1(Port, Index); /* XGINew_Part1Port index 02 */
+ temp = (temp & (DataAND)) | DataOR;
+ XGINew_SetReg1(Port, Index, temp);
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_SetRegAND */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_SetRegAND(unsigned long Port,unsigned short Index,unsigned short DataAND)
+void XGINew_SetRegAND(unsigned long Port, unsigned short Index,
+ unsigned short DataAND)
{
- unsigned short temp ;
+ unsigned short temp;
- temp = XGINew_GetReg1( Port , Index ) ; /* XGINew_Part1Port index 02 */
- temp &= DataAND ;
- XGINew_SetReg1( Port , Index , temp ) ;
+ temp = XGINew_GetReg1(Port, Index); /* XGINew_Part1Port index 02 */
+ temp &= DataAND;
+ XGINew_SetReg1(Port, Index, temp);
}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGINew_SetRegOR */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGINew_SetRegOR( unsigned long Port , unsigned short Index , unsigned short DataOR )
+void XGINew_SetRegOR(unsigned long Port, unsigned short Index,
+ unsigned short DataOR)
{
- unsigned short temp ;
+ unsigned short temp;
- temp = XGINew_GetReg1( Port , Index ) ; /* XGINew_Part1Port index 02 */
- temp |= DataOR ;
- XGINew_SetReg1( Port , Index , temp ) ;
+ temp = XGINew_GetReg1(Port, Index); /* XGINew_Part1Port index 02 */
+ temp |= DataOR;
+ XGINew_SetReg1(Port, Index, temp);
}
-
-/* --------------------------------------------------------------------- */
-/* Function : NewDelaySecond */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void NewDelaySeconds( int seconds )
+#if 0
+void NewDelaySeconds(int seconds)
{
- int i ;
+ int i;
+ for (i = 0; i < seconds; i++) {
- for( i = 0 ; i < seconds ; i++ )
- {
-
-
-
- }
+ }
}
-
-/* --------------------------------------------------------------------- */
-/* Function : Newdebugcode */
-/* Input : */
-/* Output : */
-/* Description : */
-/* --------------------------------------------------------------------- */
void Newdebugcode(unsigned char code)
{
-// OutPortByte ( 0x80 , code ) ;
- /* OutPortByte ( 0x300 , code ) ; */
- /* NewDelaySeconds( 0x3 ) ; */
+ /* OutPortByte(0x80, code); */
+ /* OutPortByte(0x300, code); */
+ /* NewDelaySeconds(0x3); */
}
-
-
-
+#endif
OpenPOWER on IntegriCloud