drivers/xgi: Remove dead code

This was used by the now-gone Asus KFSN4-DRE mainboard. Drop it.

Change-Id: Id00c883ed0f80e7af96fdf3f6e2985dd5b227831
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41402
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Angel Pons
2020-05-14 11:19:55 +02:00
parent 81f9ae9ff1
commit c1c6c51ec0
22 changed files with 0 additions and 13273 deletions

View File

@@ -1,7 +0,0 @@
config DRIVERS_XGI_Z79_COMMON
bool
select VGA if VGA_TEXT_FRAMEBUFFER
select NO_EDID_FILL_FB
select MAINBOARD_HAS_NATIVE_VGA_INIT
select HAVE_LINEAR_FRAMEBUFFER if MAINBOARD_DO_NATIVE_VGA_INIT
select HAVE_VGA_TEXT_FRAMEBUFFER if MAINBOARD_DO_NATIVE_VGA_INIT

View File

@@ -1 +0,0 @@
ramstage-$(CONFIG_DRIVERS_XGI_Z79_COMMON) += vb_init.c vb_util.c vb_setmode.c xgi_coreboot.c

View File

@@ -1,851 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Code taken from the Linux xgifb driver (v3.18.5)
* Select functions taken from the Linux xgifb driver file XGI_main_26.c
*
* Original file header:
* XG20, XG21, XG40, XG42 frame buffer device
* for Linux kernels 2.5.x, 2.6.x
* Base on TW's sis fbdev code.
*/
#define Index_CR_GPIO_Reg1 0x48
#define Index_CR_GPIO_Reg3 0x4a
#define GPIOG_EN (1<<6)
#define GPIOG_READ (1<<1)
// static char *mode;
static int vesa = -1;
static unsigned int refresh_rate;
/* ---------------- Chip generation dependent routines ---------------- */
/* for XGI 315/550/650/740/330 */
static int XGIfb_get_dram_size(struct xgifb_video_info *xgifb_info)
{
u8 ChannelNum, tmp;
u8 reg = 0;
/* xorg driver sets 32MB * 1 channel */
if (xgifb_info->chip == XG27)
xgifb_reg_set(XGISR, IND_SIS_DRAM_SIZE, 0x51);
reg = xgifb_reg_get(XGISR, IND_SIS_DRAM_SIZE);
if (!reg)
return -1;
switch ((reg & XGI_DRAM_SIZE_MASK) >> 4) {
case XGI_DRAM_SIZE_1MB:
xgifb_info->video_size = 0x100000;
break;
case XGI_DRAM_SIZE_2MB:
xgifb_info->video_size = 0x200000;
break;
case XGI_DRAM_SIZE_4MB:
xgifb_info->video_size = 0x400000;
break;
case XGI_DRAM_SIZE_8MB:
xgifb_info->video_size = 0x800000;
break;
case XGI_DRAM_SIZE_16MB:
xgifb_info->video_size = 0x1000000;
break;
case XGI_DRAM_SIZE_32MB:
xgifb_info->video_size = 0x2000000;
break;
case XGI_DRAM_SIZE_64MB:
xgifb_info->video_size = 0x4000000;
break;
case XGI_DRAM_SIZE_128MB:
xgifb_info->video_size = 0x8000000;
break;
case XGI_DRAM_SIZE_256MB:
xgifb_info->video_size = 0x10000000;
break;
default:
return -1;
}
tmp = (reg & 0x0c) >> 2;
switch (xgifb_info->chip) {
case XG20:
case XG21:
case XG27:
ChannelNum = 1;
break;
case XG42:
if (reg & 0x04)
ChannelNum = 2;
else
ChannelNum = 1;
break;
case XG40:
default:
if (tmp == 2)
ChannelNum = 2;
else if (tmp == 3)
ChannelNum = 3;
else
ChannelNum = 1;
break;
}
xgifb_info->video_size = xgifb_info->video_size * ChannelNum;
pr_info("SR14=%x DramSize %x ChannelNum %x\n",
reg,
xgifb_info->video_size, ChannelNum);
return 0;
}
void XGIRegInit(struct vb_device_info *XGI_Pr, unsigned long 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->P3cc = BaseAddr + 0x1c;
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->Part0Port = BaseAddr + XGI_CRT2_PORT_00;
/* Digital video interface registers (LCD) */
XGI_Pr->Part1Port = BaseAddr + SIS_CRT2_PORT_04;
/* 301 TV Encoder registers */
XGI_Pr->Part2Port = BaseAddr + SIS_CRT2_PORT_10;
/* 301 Macrovision registers */
XGI_Pr->Part3Port = BaseAddr + SIS_CRT2_PORT_12;
/* 301 VGA2 (and LCD) registers */
XGI_Pr->Part4Port = BaseAddr + SIS_CRT2_PORT_14;
/* 301 palette address port registers */
XGI_Pr->Part5Port = BaseAddr + SIS_CRT2_PORT_14 + 2;
}
/* ------------------ Internal helper routines ----------------- */
static int XGIfb_GetXG21DefaultLVDSModeIdx(struct xgifb_video_info *xgifb_info)
{
int i = 0;
while ((XGIbios_mode[i].mode_no != 0)
&& (XGIbios_mode[i].xres <= xgifb_info->lvds_data.LVDSHDE)) {
if ((XGIbios_mode[i].xres == xgifb_info->lvds_data.LVDSHDE)
&& (XGIbios_mode[i].yres == xgifb_info->lvds_data.LVDSVDE)
&& (XGIbios_mode[i].bpp == 8)) {
return i;
}
i++;
}
return -1;
}
static u8 XGIfb_search_refresh_rate(struct xgifb_video_info *xgifb_info,
unsigned int rate)
{
u16 xres, yres;
int i = 0;
xres = XGIbios_mode[xgifb_info->mode_idx].xres;
yres = XGIbios_mode[xgifb_info->mode_idx].yres;
xgifb_info->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].refresh == rate) {
xgifb_info->rate_idx = XGIfb_vrate[i].idx;
break;
} else if (XGIfb_vrate[i].refresh > rate) {
if ((XGIfb_vrate[i].refresh - rate) <= 3) {
pr_debug("Adjusting rate from %d up to %d\n",
rate, XGIfb_vrate[i].refresh);
xgifb_info->rate_idx =
XGIfb_vrate[i].idx;
xgifb_info->refresh_rate =
XGIfb_vrate[i].refresh;
} else if (((rate - XGIfb_vrate[i - 1].refresh)
<= 2) && (XGIfb_vrate[i].idx
!= 1)) {
pr_debug("Adjusting rate from %d down to %d\n",
rate,
XGIfb_vrate[i-1].refresh);
xgifb_info->rate_idx =
XGIfb_vrate[i - 1].idx;
xgifb_info->refresh_rate =
XGIfb_vrate[i - 1].refresh;
}
break;
} else if ((rate - XGIfb_vrate[i].refresh) <= 2) {
pr_debug("Adjusting rate from %d down to %d\n",
rate, XGIfb_vrate[i].refresh);
xgifb_info->rate_idx = XGIfb_vrate[i].idx;
break;
}
}
i++;
}
if (xgifb_info->rate_idx > 0)
return xgifb_info->rate_idx;
pr_info("Unsupported rate %d for %dx%d\n",
rate, xres, yres);
return 0;
}
static void XGIfb_detect_VB(struct xgifb_video_info *xgifb_info)
{
u8 cr32, temp = 0;
xgifb_info->TV_plug = xgifb_info->TV_type = 0;
cr32 = xgifb_reg_get(XGICR, IND_XGI_SCRATCH_REG_CR32);
if ((cr32 & SIS_CRT1) && !XGIfb_crt1off)
XGIfb_crt1off = 0;
else {
if (cr32 & 0x5F)
XGIfb_crt1off = 1;
else
XGIfb_crt1off = 0;
}
if (!xgifb_info->display2_force) {
if (cr32 & SIS_VB_TV)
xgifb_info->display2 = XGIFB_DISP_TV;
else if (cr32 & SIS_VB_LCD)
xgifb_info->display2 = XGIFB_DISP_LCD;
else if (cr32 & SIS_VB_CRT2)
xgifb_info->display2 = XGIFB_DISP_CRT;
else
xgifb_info->display2 = XGIFB_DISP_NONE;
}
if (XGIfb_tvplug != -1)
/* Override with option */
xgifb_info->TV_plug = XGIfb_tvplug;
else if (cr32 & SIS_VB_HIVISION) {
xgifb_info->TV_type = TVMODE_HIVISION;
xgifb_info->TV_plug = TVPLUG_SVIDEO;
} else if (cr32 & SIS_VB_SVIDEO)
xgifb_info->TV_plug = TVPLUG_SVIDEO;
else if (cr32 & SIS_VB_COMPOSITE)
xgifb_info->TV_plug = TVPLUG_COMPOSITE;
else if (cr32 & SIS_VB_SCART)
xgifb_info->TV_plug = TVPLUG_SCART;
if (xgifb_info->TV_type == 0) {
temp = xgifb_reg_get(XGICR, 0x38);
if (temp & 0x10)
xgifb_info->TV_type = TVMODE_PAL;
else
xgifb_info->TV_type = TVMODE_NTSC;
}
/* Copy forceCRT1 option to CRT1off if option is given */
if (XGIfb_forcecrt1 != -1) {
if (XGIfb_forcecrt1)
XGIfb_crt1off = 0;
else
XGIfb_crt1off = 1;
}
}
static int XGIfb_has_VB(struct xgifb_video_info *xgifb_info)
{
u8 vb_chipid;
vb_chipid = xgifb_reg_get(XGIPART4, 0x00);
switch (vb_chipid) {
case 0x01:
xgifb_info->hasVB = HASVB_301;
break;
case 0x02:
xgifb_info->hasVB = HASVB_302;
break;
default:
xgifb_info->hasVB = HASVB_NONE;
return 0;
}
return 1;
}
static void XGIfb_get_VB_type(struct xgifb_video_info *xgifb_info)
{
u8 reg;
if (!XGIfb_has_VB(xgifb_info)) {
reg = xgifb_reg_get(XGICR, IND_XGI_SCRATCH_REG_CR37);
switch ((reg & SIS_EXTERNAL_CHIP_MASK) >> 1) {
case SIS_EXTERNAL_CHIP_LVDS:
xgifb_info->hasVB = HASVB_LVDS;
break;
case SIS_EXTERNAL_CHIP_LVDS_CHRONTEL:
xgifb_info->hasVB = HASVB_LVDS_CHRONTEL;
break;
default:
break;
}
}
}
#if 0
static void XGIfb_search_mode(struct xgifb_video_info *xgifb_info,
const char *name)
{
unsigned int xres;
unsigned int yres;
unsigned int bpp;
int i;
if (sscanf(name, "%ux%ux%u", &xres, &yres, &bpp) != 3)
goto invalid_mode;
if (bpp == 24)
bpp = 32; /* That's for people who mix up color and fb depth. */
for (i = 0; XGIbios_mode[i].mode_no != 0; i++)
if (XGIbios_mode[i].xres == xres &&
XGIbios_mode[i].yres == yres &&
XGIbios_mode[i].bpp == bpp) {
xgifb_info->mode_idx = i;
return;
}
invalid_mode:
pr_info("Invalid mode '%s'\n", name);
}
#endif
static void XGIfb_search_vesamode(struct xgifb_video_info *xgifb_info,
unsigned int vesamode)
{
int i = 0;
if (vesamode == 0)
goto invalid;
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)) {
xgifb_info->mode_idx = i;
return;
}
i++;
}
invalid:
pr_info("Invalid VESA mode 0x%x'\n", vesamode);
}
static int XGIfb_validate_mode(struct xgifb_video_info *xgifb_info, int myindex)
{
u16 xres, yres;
struct xgi_hw_device_info *hw_info = &xgifb_info->hw_info;
unsigned long required_mem;
if (xgifb_info->chip == XG21) {
if (xgifb_info->display2 == XGIFB_DISP_LCD) {
xres = xgifb_info->lvds_data.LVDSHDE;
yres = xgifb_info->lvds_data.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;
}
}
goto check_memory;
}
/* FIXME: for now, all is valid on XG27 */
if (xgifb_info->chip == XG27)
goto check_memory;
if (!(XGIbios_mode[myindex].chipset & MD_XGI315))
return -1;
switch (xgifb_info->display2) {
case XGIFB_DISP_LCD:
switch (hw_info->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;
default:
xres = 0;
yres = 0;
break;
}
if (XGIbios_mode[myindex].xres > xres)
return -1;
if (XGIbios_mode[myindex].yres > yres)
return -1;
if ((hw_info->ulExternalChip == 0x01) || /* LVDS */
(hw_info->ulExternalChip == 0x05)) { /* LVDS+Chrontel */
switch (XGIbios_mode[myindex].xres) {
case 512:
if (XGIbios_mode[myindex].yres != 512)
return -1;
if (hw_info->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) &&
(hw_info->ulCRT2LCDType != LCD_1024x600))
return -1;
break;
case 1152:
if ((XGIbios_mode[myindex].yres) != 768)
return -1;
if (hw_info->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) &&
(hw_info->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 {
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 (hw_info->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;
}
}
break;
case XGIFB_DISP_TV:
switch (XGIbios_mode[myindex].xres) {
case 512:
case 640:
case 800:
break;
case 720:
if (xgifb_info->TV_type == TVMODE_NTSC) {
if (XGIbios_mode[myindex].yres != 480)
return -1;
} else if (xgifb_info->TV_type == TVMODE_PAL) {
if (XGIbios_mode[myindex].yres != 576)
return -1;
}
/* LVDS/CHRONTEL does not support 720 */
if (xgifb_info->hasVB == HASVB_LVDS_CHRONTEL ||
xgifb_info->hasVB == HASVB_CHRONTEL) {
return -1;
}
break;
case 1024:
if (xgifb_info->TV_type == TVMODE_NTSC) {
if (XGIbios_mode[myindex].bpp == 32)
return -1;
}
break;
default:
return -1;
}
break;
case XGIFB_DISP_CRT:
if (XGIbios_mode[myindex].xres > 1280)
return -1;
break;
case XGIFB_DISP_NONE:
break;
}
check_memory:
required_mem = XGIbios_mode[myindex].xres * XGIbios_mode[myindex].yres *
XGIbios_mode[myindex].bpp / 8;
if (required_mem > xgifb_info->video_size)
return -1;
return myindex;
}
/* --------------------- SetMode routines ------------------------- */
static void XGIfb_pre_setmode(struct xgifb_video_info *xgifb_info)
{
u8 cr30 = 0, cr31 = 0;
cr31 = xgifb_reg_get(XGICR, 0x31);
cr31 &= ~0x60;
switch (xgifb_info->display2) {
case XGIFB_DISP_CRT:
cr30 = (SIS_VB_OUTPUT_CRT2 | SIS_SIMULTANEOUS_VIEW_ENABLE);
cr31 |= SIS_DRIVER_MODE;
break;
case XGIFB_DISP_LCD:
cr30 = (SIS_VB_OUTPUT_LCD | SIS_SIMULTANEOUS_VIEW_ENABLE);
cr31 |= SIS_DRIVER_MODE;
break;
case XGIFB_DISP_TV:
if (xgifb_info->TV_type == TVMODE_HIVISION)
cr30 = (SIS_VB_OUTPUT_HIVISION
| SIS_SIMULTANEOUS_VIEW_ENABLE);
else if (xgifb_info->TV_plug == TVPLUG_SVIDEO)
cr30 = (SIS_VB_OUTPUT_SVIDEO
| SIS_SIMULTANEOUS_VIEW_ENABLE);
else if (xgifb_info->TV_plug == TVPLUG_COMPOSITE)
cr30 = (SIS_VB_OUTPUT_COMPOSITE
| SIS_SIMULTANEOUS_VIEW_ENABLE);
else if (xgifb_info->TV_plug == TVPLUG_SCART)
cr30 = (SIS_VB_OUTPUT_SCART
| SIS_SIMULTANEOUS_VIEW_ENABLE);
cr31 |= SIS_DRIVER_MODE;
if (XGIfb_tvmode == 1 || xgifb_info->TV_type == TVMODE_PAL)
cr31 |= 0x01;
else
cr31 &= ~0x01;
break;
default: /* disable CRT2 */
cr30 = 0x00;
cr31 |= (SIS_DRIVER_MODE | SIS_VB_OUTPUT_DISABLE);
}
xgifb_reg_set(XGICR, IND_XGI_SCRATCH_REG_CR30, cr30);
xgifb_reg_set(XGICR, IND_XGI_SCRATCH_REG_CR31, cr31);
xgifb_reg_set(XGICR, IND_XGI_SCRATCH_REG_CR33,
(xgifb_info->rate_idx & 0x0F));
}
static void XGIfb_post_setmode(struct xgifb_video_info *xgifb_info)
{
u8 reg;
unsigned char doit = 1;
if (xgifb_info->video_bpp == 8) {
/*
* We can't switch off CRT1 on LVDS/Chrontel
* in 8bpp Modes
*/
if ((xgifb_info->hasVB == HASVB_LVDS) ||
(xgifb_info->hasVB == HASVB_LVDS_CHRONTEL)) {
doit = 0;
}
/*
* We can't switch off CRT1 on 301B-DH
* in 8bpp Modes if using LCD
*/
if (xgifb_info->display2 == XGIFB_DISP_LCD)
doit = 0;
}
/* We can't switch off CRT1 if bridge is in slave mode */
if (xgifb_info->hasVB != HASVB_NONE) {
reg = xgifb_reg_get(XGIPART1, 0x00);
if ((reg & 0x50) == 0x10)
doit = 0;
} else {
XGIfb_crt1off = 0;
}
reg = xgifb_reg_get(XGICR, 0x17);
if ((XGIfb_crt1off) && (doit))
reg &= ~0x80;
else
reg |= 0x80;
xgifb_reg_set(XGICR, 0x17, reg);
xgifb_reg_and(XGISR, IND_SIS_RAMDAC_CONTROL, ~0x04);
if (xgifb_info->display2 == XGIFB_DISP_TV &&
xgifb_info->hasVB == HASVB_301) {
reg = xgifb_reg_get(XGIPART4, 0x01);
if (reg < 0xB0) { /* Set filter for XGI301 */
int filter_tb;
switch (xgifb_info->video_width) {
case 320:
filter_tb = (xgifb_info->TV_type ==
TVMODE_NTSC) ? 4 : 12;
break;
case 640:
filter_tb = (xgifb_info->TV_type ==
TVMODE_NTSC) ? 5 : 13;
break;
case 720:
filter_tb = (xgifb_info->TV_type ==
TVMODE_NTSC) ? 6 : 14;
break;
case 800:
filter_tb = (xgifb_info->TV_type ==
TVMODE_NTSC) ? 7 : 15;
break;
default:
filter_tb = 0;
filter = -1;
break;
}
xgifb_reg_or(XGIPART1,
SIS_CRT2_WENABLE_315,
0x01);
if (xgifb_info->TV_type == TVMODE_NTSC) {
xgifb_reg_and(XGIPART2, 0x3a, 0x1f);
if (xgifb_info->TV_plug == TVPLUG_SVIDEO) {
xgifb_reg_and(XGIPART2, 0x30, 0xdf);
} else if (xgifb_info->TV_plug
== TVPLUG_COMPOSITE) {
xgifb_reg_or(XGIPART2, 0x30, 0x20);
switch (xgifb_info->video_width) {
case 640:
xgifb_reg_set(XGIPART2,
0x35,
0xEB);
xgifb_reg_set(XGIPART2,
0x36,
0x04);
xgifb_reg_set(XGIPART2,
0x37,
0x25);
xgifb_reg_set(XGIPART2,
0x38,
0x18);
break;
case 720:
xgifb_reg_set(XGIPART2,
0x35,
0xEE);
xgifb_reg_set(XGIPART2,
0x36,
0x0C);
xgifb_reg_set(XGIPART2,
0x37,
0x22);
xgifb_reg_set(XGIPART2,
0x38,
0x08);
break;
case 800:
xgifb_reg_set(XGIPART2,
0x35,
0xEB);
xgifb_reg_set(XGIPART2,
0x36,
0x15);
xgifb_reg_set(XGIPART2,
0x37,
0x25);
xgifb_reg_set(XGIPART2,
0x38,
0xF6);
break;
}
}
} else if (xgifb_info->TV_type == TVMODE_PAL) {
xgifb_reg_and(XGIPART2, 0x3A, 0x1F);
if (xgifb_info->TV_plug == TVPLUG_SVIDEO) {
xgifb_reg_and(XGIPART2, 0x30, 0xDF);
} else if (xgifb_info->TV_plug
== TVPLUG_COMPOSITE) {
xgifb_reg_or(XGIPART2, 0x30, 0x20);
switch (xgifb_info->video_width) {
case 640:
xgifb_reg_set(XGIPART2,
0x35,
0xF1);
xgifb_reg_set(XGIPART2,
0x36,
0xF7);
xgifb_reg_set(XGIPART2,
0x37,
0x1F);
xgifb_reg_set(XGIPART2,
0x38,
0x32);
break;
case 720:
xgifb_reg_set(XGIPART2,
0x35,
0xF3);
xgifb_reg_set(XGIPART2,
0x36,
0x00);
xgifb_reg_set(XGIPART2,
0x37,
0x1D);
xgifb_reg_set(XGIPART2,
0x38,
0x20);
break;
case 800:
xgifb_reg_set(XGIPART2,
0x35,
0xFC);
xgifb_reg_set(XGIPART2,
0x36,
0xFB);
xgifb_reg_set(XGIPART2,
0x37,
0x14);
xgifb_reg_set(XGIPART2,
0x38,
0x2A);
break;
}
}
}
if ((filter >= 0) && (filter <= 7)) {
pr_debug("FilterTable[%d]-%d: %*ph\n",
filter_tb, filter,
4, XGI_TV_filter[filter_tb].
filter[filter]);
xgifb_reg_set(
XGIPART2,
0x35,
(XGI_TV_filter[filter_tb].
filter[filter][0]));
xgifb_reg_set(
XGIPART2,
0x36,
(XGI_TV_filter[filter_tb].
filter[filter][1]));
xgifb_reg_set(
XGIPART2,
0x37,
(XGI_TV_filter[filter_tb].
filter[filter][2]));
xgifb_reg_set(
XGIPART2,
0x38,
(XGI_TV_filter[filter_tb].
filter[filter][3]));
}
}
}
}

View File

@@ -1,375 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* File taken from the Linux xgifb driver (v3.18.5) */
#ifndef _XGIFB_MAIN
#define _XGIFB_MAIN
/* coreboot includes */
#include "xgi_coreboot.h"
/* ------------------- Constant Definitions ------------------------- */
#include "XGIfb.h"
#include "vb_def.h"
#define PCI_DEVICE_ID_XGI_42 0x042
#define PCI_DEVICE_ID_XGI_27 0x027
/* To be included in fb.h */
#define XGISR (xgifb_info->dev_info.P3c4)
#define XGICR (xgifb_info->dev_info.P3d4)
#define XGIDACA (xgifb_info->dev_info.P3c8)
#define XGIDACD (xgifb_info->dev_info.P3c9)
#define XGIPART1 (xgifb_info->dev_info.Part1Port)
#define XGIPART2 (xgifb_info->dev_info.Part2Port)
#define XGIPART3 (xgifb_info->dev_info.Part3Port)
#define XGIPART4 (xgifb_info->dev_info.Part4Port)
#define XGIPART5 (xgifb_info->dev_info.Part5Port)
#define XGIDAC2A XGIPART5
#define XGIDAC2D (XGIPART5 + 1)
#define IND_XGI_SCRATCH_REG_CR30 0x30 /* CRs */
#define IND_XGI_SCRATCH_REG_CR31 0x31
#define IND_XGI_SCRATCH_REG_CR32 0x32
#define IND_XGI_SCRATCH_REG_CR33 0x33
#define IND_XGI_LCD_PANEL 0x36
#define IND_XGI_SCRATCH_REG_CR37 0x37
#define XGI_DRAM_SIZE_MASK 0xF0 /*SR14 */
#define XGI_DRAM_SIZE_1MB 0x00
#define XGI_DRAM_SIZE_2MB 0x01
#define XGI_DRAM_SIZE_4MB 0x02
#define XGI_DRAM_SIZE_8MB 0x03
#define XGI_DRAM_SIZE_16MB 0x04
#define XGI_DRAM_SIZE_32MB 0x05
#define XGI_DRAM_SIZE_64MB 0x06
#define XGI_DRAM_SIZE_128MB 0x07
#define XGI_DRAM_SIZE_256MB 0x08
/* ------------------- Global Variables ----------------------------- */
/* display status */
static int XGIfb_crt1off;
static int XGIfb_forcecrt1 = -1;
/* global flags */
static int XGIfb_tvmode;
static int enable_dstn;
// static int XGIfb_ypan = -1;
/* TW: CRT2 type (for overriding autodetection) */
static int XGIfb_crt2type = -1;
/* PR: Tv plug type (for overriding autodetection) */
static int XGIfb_tvplug = -1;
#define MD_XGI315 1
/* mode table */
static const struct _XGIbios_mode {
u8 mode_no;
u16 vesa_mode_no_1; /* "XGI defined" VESA mode number */
u16 vesa_mode_no_2; /* Real VESA mode numbers */
u16 xres;
u16 yres;
u16 bpp;
u8 chipset;
} XGIbios_mode[] = {
{ 0x56, 0x0000, 0x0000, 320, 240, 16, MD_XGI315 },
{ 0x5A, 0x0000, 0x0000, 320, 480, 8, MD_XGI315 },
{ 0x5B, 0x0000, 0x0000, 320, 480, 16, MD_XGI315 },
{ 0x2E, 0x0101, 0x0101, 640, 480, 8, MD_XGI315 },
{ 0x44, 0x0111, 0x0111, 640, 480, 16, MD_XGI315 },
{ 0x62, 0x013a, 0x0112, 640, 480, 32, MD_XGI315 },
{ 0x31, 0x0000, 0x0000, 720, 480, 8, MD_XGI315 },
{ 0x33, 0x0000, 0x0000, 720, 480, 16, MD_XGI315 },
{ 0x35, 0x0000, 0x0000, 720, 480, 32, MD_XGI315 },
{ 0x32, 0x0000, 0x0000, 720, 576, 8, MD_XGI315 },
{ 0x34, 0x0000, 0x0000, 720, 576, 16, MD_XGI315 },
{ 0x36, 0x0000, 0x0000, 720, 576, 32, MD_XGI315 },
{ 0x36, 0x0000, 0x0000, 720, 576, 32, MD_XGI315 },
{ 0x70, 0x0000, 0x0000, 800, 480, 8, MD_XGI315 },
{ 0x7a, 0x0000, 0x0000, 800, 480, 16, MD_XGI315 },
{ 0x76, 0x0000, 0x0000, 800, 480, 32, MD_XGI315 },
{ 0x30, 0x0103, 0x0103, 800, 600, 8, MD_XGI315 },
#define DEFAULT_MODE 17 /* index for 800x600x16 */
{ 0x47, 0x0114, 0x0114, 800, 600, 16, MD_XGI315 },
{ 0x63, 0x013b, 0x0115, 800, 600, 32, MD_XGI315 },
{ 0x71, 0x0000, 0x0000, 1024, 576, 8, MD_XGI315 },
{ 0x74, 0x0000, 0x0000, 1024, 576, 16, MD_XGI315 },
{ 0x77, 0x0000, 0x0000, 1024, 576, 32, MD_XGI315 },
{ 0x77, 0x0000, 0x0000, 1024, 576, 32, MD_XGI315 },
{ 0x20, 0x0000, 0x0000, 1024, 600, 8, },
{ 0x21, 0x0000, 0x0000, 1024, 600, 16, },
{ 0x22, 0x0000, 0x0000, 1024, 600, 32, },
{ 0x38, 0x0105, 0x0105, 1024, 768, 8, MD_XGI315 },
{ 0x4A, 0x0117, 0x0117, 1024, 768, 16, MD_XGI315 },
{ 0x64, 0x013c, 0x0118, 1024, 768, 32, MD_XGI315 },
{ 0x64, 0x013c, 0x0118, 1024, 768, 32, MD_XGI315 },
{ 0x23, 0x0000, 0x0000, 1152, 768, 8, },
{ 0x24, 0x0000, 0x0000, 1152, 768, 16, },
{ 0x25, 0x0000, 0x0000, 1152, 768, 32, },
{ 0x79, 0x0000, 0x0000, 1280, 720, 8, MD_XGI315 },
{ 0x75, 0x0000, 0x0000, 1280, 720, 16, MD_XGI315 },
{ 0x78, 0x0000, 0x0000, 1280, 720, 32, MD_XGI315 },
{ 0x23, 0x0000, 0x0000, 1280, 768, 8, MD_XGI315 },
{ 0x24, 0x0000, 0x0000, 1280, 768, 16, MD_XGI315 },
{ 0x25, 0x0000, 0x0000, 1280, 768, 32, MD_XGI315 },
{ 0x7C, 0x0000, 0x0000, 1280, 960, 8, MD_XGI315 },
{ 0x7D, 0x0000, 0x0000, 1280, 960, 16, MD_XGI315 },
{ 0x7E, 0x0000, 0x0000, 1280, 960, 32, MD_XGI315 },
{ 0x3A, 0x0107, 0x0107, 1280, 1024, 8, MD_XGI315 },
{ 0x4D, 0x011a, 0x011a, 1280, 1024, 16, MD_XGI315 },
{ 0x65, 0x013d, 0x011b, 1280, 1024, 32, MD_XGI315 },
{ 0x26, 0x0000, 0x0000, 1400, 1050, 8, MD_XGI315 },
{ 0x27, 0x0000, 0x0000, 1400, 1050, 16, MD_XGI315 },
{ 0x28, 0x0000, 0x0000, 1400, 1050, 32, MD_XGI315 },
{ 0x3C, 0x0130, 0x011c, 1600, 1200, 8, MD_XGI315 },
{ 0x3D, 0x0131, 0x011e, 1600, 1200, 16, MD_XGI315 },
{ 0x66, 0x013e, 0x011f, 1600, 1200, 32, MD_XGI315 },
{ 0x68, 0x013f, 0x0000, 1920, 1440, 8, MD_XGI315 },
{ 0x69, 0x0140, 0x0000, 1920, 1440, 16, MD_XGI315 },
{ 0x6B, 0x0141, 0x0000, 1920, 1440, 32, MD_XGI315 },
{ 0x6c, 0x0000, 0x0000, 2048, 1536, 8, MD_XGI315 },
{ 0x6d, 0x0000, 0x0000, 2048, 1536, 16, MD_XGI315 },
{ 0x6e, 0x0000, 0x0000, 2048, 1536, 32, MD_XGI315 },
{ 0 },
};
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,
LCD_1024x768, LCD_1024x768, LCD_1024x768};
static const struct _XGI_crt2type {
char name[10];
int type_no;
int tvplug_no;
} XGI_crt2type[] = {
{"NONE", 0, -1},
{"LCD", XGIFB_DISP_LCD, -1},
{"TV", XGIFB_DISP_TV, -1},
{"VGA", XGIFB_DISP_CRT, -1},
{"SVIDEO", XGIFB_DISP_TV, TVPLUG_SVIDEO},
{"COMPOSITE", XGIFB_DISP_TV, TVPLUG_COMPOSITE},
{"SCART", XGIFB_DISP_TV, TVPLUG_SCART},
{"none", 0, -1},
{"lcd", XGIFB_DISP_LCD, -1},
{"tv", XGIFB_DISP_TV, -1},
{"vga", XGIFB_DISP_CRT, -1},
{"svideo", XGIFB_DISP_TV, TVPLUG_SVIDEO},
{"composite", XGIFB_DISP_TV, TVPLUG_COMPOSITE},
{"scart", XGIFB_DISP_TV, TVPLUG_SCART},
{"\0", -1, -1}
};
/* TV standard */
static const struct _XGI_tvtype {
char name[6];
int type_no;
} XGI_tvtype[] = {
{"PAL", 1},
{"NTSC", 2},
{"pal", 1},
{"ntsc", 2},
{"\0", -1}
};
static const struct _XGI_vrate {
u16 idx;
u16 xres;
u16 yres;
u16 refresh;
} XGIfb_vrate[] = {
{1, 640, 480, 60}, {2, 640, 480, 72},
{3, 640, 480, 75}, {4, 640, 480, 85},
{5, 640, 480, 100}, {6, 640, 480, 120},
{7, 640, 480, 160}, {8, 640, 480, 200},
{1, 720, 480, 60},
{1, 720, 576, 58},
{1, 800, 480, 60}, {2, 800, 480, 75}, {3, 800, 480, 85},
{1, 800, 600, 60}, {2, 800, 600, 72}, {3, 800, 600, 75},
{4, 800, 600, 85}, {5, 800, 600, 100},
{6, 800, 600, 120}, {7, 800, 600, 160},
{1, 1024, 768, 60}, {2, 1024, 768, 70}, {3, 1024, 768, 75},
{4, 1024, 768, 85}, {5, 1024, 768, 100}, {6, 1024, 768, 120},
{1, 1024, 576, 60}, {2, 1024, 576, 75}, {3, 1024, 576, 85},
{1, 1024, 600, 60},
{1, 1152, 768, 60},
{1, 1280, 720, 60}, {2, 1280, 720, 75}, {3, 1280, 720, 85},
{1, 1280, 768, 60},
{1, 1280, 1024, 60}, {2, 1280, 1024, 75}, {3, 1280, 1024, 85},
{1, 1280, 960, 70},
{1, 1400, 1050, 60},
{1, 1600, 1200, 60}, {2, 1600, 1200, 65},
{3, 1600, 1200, 70}, {4, 1600, 1200, 75},
{5, 1600, 1200, 85}, {6, 1600, 1200, 100},
{7, 1600, 1200, 120},
{1, 1920, 1440, 60}, {2, 1920, 1440, 65},
{3, 1920, 1440, 70}, {4, 1920, 1440, 75},
{5, 1920, 1440, 85}, {6, 1920, 1440, 100},
{1, 2048, 1536, 60}, {2, 2048, 1536, 65},
{3, 2048, 1536, 70}, {4, 2048, 1536, 75},
{5, 2048, 1536, 85},
{0, 0, 0, 0}
};
static const struct _XGI_TV_filter {
u8 filter[9][4];
} XGI_TV_filter[] = {
{ { {0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_0 */
{0x00, 0xE0, 0x10, 0x60},
{0x00, 0xEE, 0x10, 0x44},
{0x00, 0xF4, 0x10, 0x38},
{0xF8, 0xF4, 0x18, 0x38},
{0xFC, 0xFB, 0x14, 0x2A},
{0x00, 0x00, 0x10, 0x20},
{0x00, 0x04, 0x10, 0x18},
{0xFF, 0xFF, 0xFF, 0xFF} } },
{ { {0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_1 */
{0x00, 0xE0, 0x10, 0x60},
{0x00, 0xEE, 0x10, 0x44},
{0x00, 0xF4, 0x10, 0x38},
{0xF8, 0xF4, 0x18, 0x38},
{0xFC, 0xFB, 0x14, 0x2A},
{0x00, 0x00, 0x10, 0x20},
{0x00, 0x04, 0x10, 0x18},
{0xFF, 0xFF, 0xFF, 0xFF} } },
{ { {0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_2 */
{0xF5, 0xEE, 0x1B, 0x44},
{0xF8, 0xF4, 0x18, 0x38},
{0xEB, 0x04, 0x25, 0x18},
{0xF1, 0x05, 0x1F, 0x16},
{0xF6, 0x06, 0x1A, 0x14},
{0xFA, 0x06, 0x16, 0x14},
{0x00, 0x04, 0x10, 0x18},
{0xFF, 0xFF, 0xFF, 0xFF} } },
{ { {0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_3 */
{0xF1, 0x04, 0x1F, 0x18},
{0xEE, 0x0D, 0x22, 0x06},
{0xF7, 0x06, 0x19, 0x14},
{0xF4, 0x0B, 0x1C, 0x0A},
{0xFA, 0x07, 0x16, 0x12},
{0xF9, 0x0A, 0x17, 0x0C},
{0x00, 0x07, 0x10, 0x12},
{0xFF, 0xFF, 0xFF, 0xFF} } },
{ { {0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_4 */
{0x00, 0xE0, 0x10, 0x60},
{0x00, 0xEE, 0x10, 0x44},
{0x00, 0xF4, 0x10, 0x38},
{0xF8, 0xF4, 0x18, 0x38},
{0xFC, 0xFB, 0x14, 0x2A},
{0x00, 0x00, 0x10, 0x20},
{0x00, 0x04, 0x10, 0x18},
{0xFF, 0xFF, 0xFF, 0xFF} } },
{ { {0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_5 */
{0xF5, 0xEE, 0x1B, 0x44},
{0xF8, 0xF4, 0x18, 0x38},
{0xEB, 0x04, 0x25, 0x18},
{0xF1, 0x05, 0x1F, 0x16},
{0xF6, 0x06, 0x1A, 0x14},
{0xFA, 0x06, 0x16, 0x14},
{0x00, 0x04, 0x10, 0x18},
{0xFF, 0xFF, 0xFF, 0xFF} } },
{ { {0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_6 */
{0xEB, 0x04, 0x25, 0x18},
{0xE7, 0x0E, 0x29, 0x04},
{0xEE, 0x0C, 0x22, 0x08},
{0xF6, 0x0B, 0x1A, 0x0A},
{0xF9, 0x0A, 0x17, 0x0C},
{0xFC, 0x0A, 0x14, 0x0C},
{0x00, 0x08, 0x10, 0x10},
{0xFF, 0xFF, 0xFF, 0xFF} } },
{ { {0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_7 */
{0xEC, 0x02, 0x24, 0x1C},
{0xF2, 0x04, 0x1E, 0x18},
{0xEB, 0x15, 0x25, 0xF6},
{0xF4, 0x10, 0x1C, 0x00},
{0xF8, 0x0F, 0x18, 0x02},
{0x00, 0x04, 0x10, 0x18},
{0x01, 0x06, 0x0F, 0x14},
{0xFF, 0xFF, 0xFF, 0xFF} } },
{ { {0x00, 0x00, 0x00, 0x40}, /* PALFilter_0 */
{0x00, 0xE0, 0x10, 0x60},
{0x00, 0xEE, 0x10, 0x44},
{0x00, 0xF4, 0x10, 0x38},
{0xF8, 0xF4, 0x18, 0x38},
{0xFC, 0xFB, 0x14, 0x2A},
{0x00, 0x00, 0x10, 0x20},
{0x00, 0x04, 0x10, 0x18},
{0xFF, 0xFF, 0xFF, 0xFF} } },
{ { {0x00, 0x00, 0x00, 0x40}, /* PALFilter_1 */
{0x00, 0xE0, 0x10, 0x60},
{0x00, 0xEE, 0x10, 0x44},
{0x00, 0xF4, 0x10, 0x38},
{0xF8, 0xF4, 0x18, 0x38},
{0xFC, 0xFB, 0x14, 0x2A},
{0x00, 0x00, 0x10, 0x20},
{0x00, 0x04, 0x10, 0x18},
{0xFF, 0xFF, 0xFF, 0xFF} } },
{ { {0x00, 0x00, 0x00, 0x40}, /* PALFilter_2 */
{0xF5, 0xEE, 0x1B, 0x44},
{0xF8, 0xF4, 0x18, 0x38},
{0xF1, 0xF7, 0x01, 0x32},
{0xF5, 0xFB, 0x1B, 0x2A},
{0xF9, 0xFF, 0x17, 0x22},
{0xFB, 0x01, 0x15, 0x1E},
{0x00, 0x04, 0x10, 0x18},
{0xFF, 0xFF, 0xFF, 0xFF} } },
{ { {0x00, 0x00, 0x00, 0x40}, /* PALFilter_3 */
{0xF5, 0xFB, 0x1B, 0x2A},
{0xEE, 0xFE, 0x22, 0x24},
{0xF3, 0x00, 0x1D, 0x20},
{0xF9, 0x03, 0x17, 0x1A},
{0xFB, 0x02, 0x14, 0x1E},
{0xFB, 0x04, 0x15, 0x18},
{0x00, 0x06, 0x10, 0x14},
{0xFF, 0xFF, 0xFF, 0xFF} } },
{ { {0x00, 0x00, 0x00, 0x40}, /* PALFilter_4 */
{0x00, 0xE0, 0x10, 0x60},
{0x00, 0xEE, 0x10, 0x44},
{0x00, 0xF4, 0x10, 0x38},
{0xF8, 0xF4, 0x18, 0x38},
{0xFC, 0xFB, 0x14, 0x2A},
{0x00, 0x00, 0x10, 0x20},
{0x00, 0x04, 0x10, 0x18},
{0xFF, 0xFF, 0xFF, 0xFF} } },
{ { {0x00, 0x00, 0x00, 0x40}, /* PALFilter_5 */
{0xF5, 0xEE, 0x1B, 0x44},
{0xF8, 0xF4, 0x18, 0x38},
{0xF1, 0xF7, 0x1F, 0x32},
{0xF5, 0xFB, 0x1B, 0x2A},
{0xF9, 0xFF, 0x17, 0x22},
{0xFB, 0x01, 0x15, 0x1E},
{0x00, 0x04, 0x10, 0x18},
{0xFF, 0xFF, 0xFF, 0xFF} } },
{ { {0x00, 0x00, 0x00, 0x40}, /* PALFilter_6 */
{0xF5, 0xEE, 0x1B, 0x2A},
{0xEE, 0xFE, 0x22, 0x24},
{0xF3, 0x00, 0x1D, 0x20},
{0xF9, 0x03, 0x17, 0x1A},
{0xFB, 0x02, 0x14, 0x1E},
{0xFB, 0x04, 0x15, 0x18},
{0x00, 0x06, 0x10, 0x14},
{0xFF, 0xFF, 0xFF, 0xFF} } },
{ { {0x00, 0x00, 0x00, 0x40}, /* PALFilter_7 */
{0xF5, 0xEE, 0x1B, 0x44},
{0xF8, 0xF4, 0x18, 0x38},
{0xFC, 0xFB, 0x14, 0x2A},
{0xEB, 0x05, 0x25, 0x16},
{0xF1, 0x05, 0x1F, 0x16},
{0xFA, 0x07, 0x16, 0x12},
{0x00, 0x07, 0x10, 0x12},
{0xFF, 0xFF, 0xFF, 0xFF} } }
};
static int filter = -1;
#endif

View File

@@ -1,138 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* File taken from the Linux xgifb driver (v3.18.5) */
#ifndef _LINUX_XGIFB
#define _LINUX_XGIFB
#include "vgatypes.h"
#include "vb_struct.h"
enum xgifb_display_type {
XGIFB_DISP_NONE = 0,
XGIFB_DISP_CRT,
XGIFB_DISP_LCD,
XGIFB_DISP_TV,
};
#define HASVB_NONE 0x00
#define HASVB_301 0x01
#define HASVB_LVDS 0x02
#define HASVB_TRUMPION 0x04
#define HASVB_LVDS_CHRONTEL 0x10
#define HASVB_302 0x20
#define HASVB_CHRONTEL 0x80
enum XGI_CHIP_TYPE {
XG40 = 32,
XG42,
XG20 = 48,
XG21,
XG27,
};
enum xgi_tvtype {
TVMODE_NTSC = 0,
TVMODE_PAL,
TVMODE_HIVISION,
TVTYPE_PALM,
TVTYPE_PALN,
TVTYPE_NTSCJ,
TVMODE_TOTAL
};
enum xgi_tv_plug {
TVPLUG_UNKNOWN = 0,
TVPLUG_COMPOSITE = 1,
TVPLUG_SVIDEO = 2,
TVPLUG_COMPOSITE_AND_SVIDEO = 3,
TVPLUG_SCART = 4,
TVPLUG_YPBPR_525i = 5,
TVPLUG_YPBPR_525P = 6,
TVPLUG_YPBPR_750P = 7,
TVPLUG_YPBPR_1080i = 8,
TVPLUG_TOTAL
};
struct XGIfb_info {
unsigned long XGIfb_id;
int chip_id; /* PCI ID of detected chip */
int memory; /* video memory in KB which XGIfb manages */
int heapstart; /* heap start (= XGIfb "mem" argument) in KB */
unsigned char fbvidmode; /* current XGIfb mode */
unsigned char XGIfb_version;
unsigned char XGIfb_revision;
unsigned char XGIfb_patchlevel;
unsigned char XGIfb_caps; /* XGIfb capabilities */
int XGIfb_tqlen; /* turbo queue length (in KB) */
unsigned int XGIfb_pcibus; /* The card's PCI ID */
unsigned int XGIfb_pcislot;
unsigned int XGIfb_pcifunc;
unsigned char XGIfb_lcdpdc; /* PanelDelayCompensation */
unsigned char XGIfb_lcda; /* Detected status of LCDA for low res/text modes */
char reserved[235]; /* for future use */
};
struct xgifb_video_info {
struct fb_info *fb_info;
struct xgi_hw_device_info hw_info;
struct vb_device_info dev_info;
int mode_idx;
int rate_idx;
u32 pseudo_palette[17];
int chip_id;
unsigned int video_size;
phys_addr_t video_base;
void __iomem *video_vbase;
phys_addr_t mmio_base;
unsigned long mmio_size;
void __iomem *mmio_vbase;
unsigned long vga_base;
int mtrr;
int video_bpp;
int video_cmap_len;
int video_width;
int video_height;
int video_vwidth;
int video_vheight;
int org_x;
int org_y;
int video_linelength;
unsigned int refresh_rate;
enum xgifb_display_type display2; /* the second display output type */
bool display2_force;
unsigned char hasVB;
unsigned char TV_type;
unsigned char TV_plug;
struct XGI21_LVDSCapStruct lvds_data;
enum XGI_CHIP_TYPE chip;
unsigned char revision_id;
unsigned short DstColor;
unsigned long XGI310_AccelDepth;
unsigned long CommandReg;
unsigned int pcibus;
unsigned int pcislot;
unsigned int pcifunc;
unsigned short subsysvendor;
unsigned short subsysdevice;
char reserved[236];
};
#endif

View File

@@ -1,704 +0,0 @@
/* $XFree86$ */
/* $XdotOrg$ */
/*
* Global definitions for init.c and init301.c
*
* Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria
*
* If distributed as part of the Linux kernel, the following license terms
* apply:
*
* * This program is free software; you can redistribute it and/or modify
* * it under the terms of the GNU General Public License as published by
* * the Free Software Foundation; either version 2 of the named License,
* * or any later version.
* *
* * This program is distributed in the hope that it will be useful,
* * but WITHOUT ANY WARRANTY; without even the implied warranty of
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* * GNU General Public License for more details.
*
* Otherwise, the following license terms apply:
*
* * Redistribution and use in source and binary forms, with or without
* * modification, are permitted provided that the following conditions
* * are met:
* * 1) Redistributions of source code must retain the above copyright
* * notice, this list of conditions and the following disclaimer.
* * 2) Redistributions in binary form must reproduce the above copyright
* * notice, this list of conditions and the following disclaimer in the
* * documentation and/or other materials provided with the distribution.
* * 3) The name of the author may not be used to endorse or promote products
* * derived from this software without specific prior written permission.
* *
* * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Author: Thomas Winischhofer <thomas@winischhofer.net>
*
*/
#ifndef _INITDEF_
#define _INITDEF_
#define IS_SIS330 (SiS_Pr->ChipType == SIS_330)
#define IS_SIS550 (SiS_Pr->ChipType == SIS_550)
#define IS_SIS650 (SiS_Pr->ChipType == SIS_650) /* All versions, incl 651, M65x */
#define IS_SIS740 (SiS_Pr->ChipType == SIS_740)
#define IS_SIS651 (SiS_Pr->SiS_SysFlags & (SF_Is651 | SF_Is652))
#define IS_SISM650 (SiS_Pr->SiS_SysFlags & (SF_IsM650 | SF_IsM652 | SF_IsM653))
#define IS_SIS65x (IS_SIS651 || IS_SISM650) /* Only special versions of 65x */
#define IS_SIS661 (SiS_Pr->ChipType == SIS_661)
#define IS_SIS741 (SiS_Pr->ChipType == SIS_741)
#define IS_SIS660 (SiS_Pr->ChipType == SIS_660)
#define IS_SIS760 (SiS_Pr->ChipType == SIS_760)
#define IS_SIS761 (SiS_Pr->ChipType == SIS_761)
#define IS_SIS661741660760 (IS_SIS661 || IS_SIS741 || IS_SIS660 || IS_SIS760 || IS_SIS761)
#define IS_SIS650740 ((SiS_Pr->ChipType >= SIS_650) && (SiS_Pr->ChipType < SIS_330))
#define IS_SIS550650740 (IS_SIS550 || IS_SIS650740)
#define IS_SIS650740660 (IS_SIS650 || IS_SIS740 || IS_SIS661741660760)
#define IS_SIS550650740660 (IS_SIS550 || IS_SIS650740660)
#define SISGETROMW(x) (ROMAddr[(x)] | (ROMAddr[(x)+1] << 8))
/* SiS_VBType */
#define VB_SIS301 0x0001
#define VB_SIS301B 0x0002
#define VB_SIS302B 0x0004
#define VB_SIS301LV 0x0008
#define VB_SIS302LV 0x0010
#define VB_SIS302ELV 0x0020
#define VB_SIS301C 0x0040
#define VB_SIS307T 0x0080
#define VB_SIS307LV 0x0100
#define VB_UMC 0x4000
#define VB_NoLCD 0x8000
#define VB_SIS30xB (VB_SIS301B | VB_SIS301C | VB_SIS302B | VB_SIS307T)
#define VB_SIS30xC (VB_SIS301C | VB_SIS307T)
#define VB_SISTMDS (VB_SIS301 | VB_SIS301B | VB_SIS301C | VB_SIS302B | VB_SIS307T)
#define VB_SISLVDS (VB_SIS301LV | VB_SIS302LV | VB_SIS302ELV | VB_SIS307LV)
#define VB_SIS30xBLV (VB_SIS30xB | VB_SISLVDS)
#define VB_SIS30xCLV (VB_SIS30xC | VB_SIS302ELV | VB_SIS307LV)
#define VB_SISVB (VB_SIS301 | VB_SIS30xBLV)
#define VB_SISLCDA (VB_SIS302B | VB_SIS301C | VB_SIS307T | VB_SISLVDS)
#define VB_SISTMDSLCDA (VB_SIS301C | VB_SIS307T)
#define VB_SISPART4SCALER (VB_SIS301C | VB_SIS307T | VB_SIS302ELV | VB_SIS307LV)
#define VB_SISHIVISION (VB_SIS301 | VB_SIS301B | VB_SIS302B)
#define VB_SISYPBPR (VB_SIS301C | VB_SIS307T | VB_SIS301LV | VB_SIS302LV | VB_SIS302ELV | VB_SIS307LV)
#define VB_SISTAP4SCALER (VB_SIS301C | VB_SIS307T | VB_SIS302ELV | VB_SIS307LV)
#define VB_SISPART4OVERFLOW (VB_SIS301C | VB_SIS307T | VB_SIS302LV | VB_SIS302ELV | VB_SIS307LV)
#define VB_SISPWD (VB_SIS301C | VB_SIS307T | VB_SISLVDS)
#define VB_SISEMI (VB_SIS302LV | VB_SIS302ELV | VB_SIS307LV)
#define VB_SISPOWER (VB_SIS301C | VB_SIS307T | VB_SIS302LV | VB_SIS302ELV | VB_SIS307LV)
#define VB_SISDUALLINK (VB_SIS302LV | VB_SIS302ELV | VB_SIS307T | VB_SIS307LV)
#define VB_SISVGA2 VB_SISTMDS
#define VB_SISRAMDAC202 (VB_SIS301C | VB_SIS307T)
/* VBInfo */
#define SetSimuScanMode 0x0001 /* CR 30 */
#define SwitchCRT2 0x0002
#define SetCRT2ToAVIDEO 0x0004
#define SetCRT2ToSVIDEO 0x0008
#define SetCRT2ToSCART 0x0010
#define SetCRT2ToLCD 0x0020
#define SetCRT2ToRAMDAC 0x0040
#define SetCRT2ToHiVision 0x0080 /* for SiS bridge */
#define SetCRT2ToCHYPbPr SetCRT2ToHiVision /* for Chrontel */
#define SetNTSCTV 0x0000 /* CR 31 */
#define SetPALTV 0x0100 /* Deprecated here, now in TVMode */
#define SetInSlaveMode 0x0200
#define SetNotSimuMode 0x0400
#define SetNotSimuTVMode SetNotSimuMode
#define SetDispDevSwitch 0x0800
#define SetCRT2ToYPbPr525750 0x0800
#define LoadDACFlag 0x1000
#define DisableCRT2Display 0x2000
#define DriverMode 0x4000
#define HotKeySwitch 0x8000
#define SetCRT2ToLCDA 0x8000
/* v-- Needs change in sis_vga.c if changed (GPIO) --v */
#define SetCRT2ToTV (SetCRT2ToYPbPr525750|SetCRT2ToHiVision|SetCRT2ToSCART|SetCRT2ToSVIDEO|SetCRT2ToAVIDEO)
#define SetCRT2ToTVNoYPbPrHiVision (SetCRT2ToSCART | SetCRT2ToSVIDEO | SetCRT2ToAVIDEO)
#define SetCRT2ToTVNoHiVision (SetCRT2ToYPbPr525750 | SetCRT2ToSCART | SetCRT2ToSVIDEO | SetCRT2ToAVIDEO)
/* SiS_ModeType */
#define ModeText 0x00
#define ModeCGA 0x01
#define ModeEGA 0x02
#define ModeVGA 0x03
#define Mode15Bpp 0x04
#define Mode16Bpp 0x05
#define Mode24Bpp 0x06
#define Mode32Bpp 0x07
#define ModeTypeMask 0x07
#define IsTextMode 0x07
#define DACInfoFlag 0x0018
#define MemoryInfoFlag 0x01E0
#define MemorySizeShift 5
/* modeflag */
#define Charx8Dot 0x0200
#define LineCompareOff 0x0400
#define CRT2Mode 0x0800
#define HalfDCLK 0x1000
#define NoSupportSimuTV 0x2000
#define NoSupportLCDScale 0x4000 /* SiS bridge: No scaling possible (no matter what panel) */
#define DoubleScanMode 0x8000
/* Infoflag */
#define SupportTV 0x0008
#define SupportTV1024 0x0800
#define SupportCHTV 0x0800
#define Support64048060Hz 0x0800 /* Special for 640x480 LCD */
#define SupportHiVision 0x0010
#define SupportYPbPr750p 0x1000
#define SupportLCD 0x0020
#define SupportRAMDAC2 0x0040 /* All (<= 100Mhz) */
#define SupportRAMDAC2_135 0x0100 /* All except DH (<= 135Mhz) */
#define SupportRAMDAC2_162 0x0200 /* B, C (<= 162Mhz) */
#define SupportRAMDAC2_202 0x0400 /* C (<= 202Mhz) */
#define InterlaceMode 0x0080
#define SyncPP 0x0000
#define HaveWideTiming 0x2000 /* Have specific wide- and non-wide timing */
#define SyncPN 0x4000
#define SyncNP 0x8000
#define SyncNN 0xc000
/* SetFlag */
#define ProgrammingCRT2 0x0001
#define LowModeTests 0x0002
/* #define TVSimuMode 0x0002 - deprecated */
/* #define RPLLDIV2XO 0x0004 - deprecated */
#define LCDVESATiming 0x0008
#define EnableLVDSDDA 0x0010
#define SetDispDevSwitchFlag 0x0020
#define CheckWinDos 0x0040
#define SetDOSMode 0x0080
/* TVMode flag */
#define TVSetPAL 0x0001
#define TVSetNTSCJ 0x0002
#define TVSetPALM 0x0004
#define TVSetPALN 0x0008
#define TVSetCHOverScan 0x0010
#define TVSetYPbPr525i 0x0020 /* new 0x10 */
#define TVSetYPbPr525p 0x0040 /* new 0x20 */
#define TVSetYPbPr750p 0x0080 /* new 0x40 */
#define TVSetHiVision 0x0100 /* new 0x80; = 1080i, software-wise identical */
#define TVSetTVSimuMode 0x0200 /* new 0x200, prev. 0x800 */
#define TVRPLLDIV2XO 0x0400 /* prev 0x1000 */
#define TVSetNTSC1024 0x0800 /* new 0x100, prev. 0x2000 */
#define TVSet525p1024 0x1000 /* TW */
#define TVAspect43 0x2000
#define TVAspect169 0x4000
#define TVAspect43LB 0x8000
/* YPbPr flag (>=315, <661; converted to TVMode) */
#define YPbPr525p 0x0001
#define YPbPr750p 0x0002
#define YPbPr525i 0x0004
#define YPbPrHiVision 0x0008
#define YPbPrModeMask (YPbPr750p | YPbPr525p | YPbPr525i | YPbPrHiVision)
/* SysFlags (to identify special versions) */
#define SF_Is651 0x0001
#define SF_IsM650 0x0002
#define SF_Is652 0x0004
#define SF_IsM652 0x0008
#define SF_IsM653 0x0010
#define SF_IsM661 0x0020
#define SF_IsM741 0x0040
#define SF_IsM760 0x0080
#define SF_760UMA 0x4000 /* 76x: We have UMA */
#define SF_760LFB 0x8000 /* 76x: We have LFB */
/* CR32 (Newer 630, and 315 series)
[0] VB connected with CVBS
[1] VB connected with SVHS
[2] VB connected with SCART
[3] VB connected with LCD
[4] VB connected with CRT2 (secondary VGA)
[5] CRT1 monitor is connected
[6] VB connected with Hi-Vision TV
[7] <= 330: VB connected with DVI combo connector
>= 661: VB connected to YPbPr
*/
/* CR35 (300 series only) */
#define TVOverScan 0x10
#define TVOverScanShift 4
/* CR35 (661 series only)
[0] 1 = PAL, 0 = NTSC
[1] 1 = NTSC-J (if D0 = 0)
[2] 1 = PALM (if D0 = 1)
[3] 1 = PALN (if D0 = 1)
[4] 1 = Overscan (Chrontel only)
[7:5] (only if D2 in CR38 is set)
000 525i
001 525p
010 750p
011 1080i (or HiVision on 301, 301B)
*/
/* CR37
[0] Set 24/18 bit (0/1) RGB to LVDS/TMDS transmitter (set by BIOS)
[3:1] External chip
300 series:
001 SiS301 (never seen)
010 LVDS
011 LVDS + Tumpion Zurac
100 LVDS + Chrontel 7005
110 Chrontel 7005
315/330 series
001 SiS30x (never seen)
010 LVDS
011 LVDS + Chrontel 7019
660 series [2:1] only:
reserved (chip type now in CR38)
All other combinations reserved
[3] 661 only: Pass 1:1 data
[4] LVDS: 0: Panel Link expands / 1: Panel Link does not expand
30x: 0: Bridge scales / 1: Bridge does not scale = Panel scales (if possible)
[5] LCD polarity select
0: VESA DMT Standard
1: EDID 2.x defined
[6] LCD horizontal polarity select
0: High active
1: Low active
[7] LCD vertical polarity select
0: High active
1: Low active
*/
/* CR37: LCDInfo */
#define LCDRGB18Bit 0x0001
#define LCDNonExpanding 0x0010
#define LCDSync 0x0020
#define LCDPass11 0x0100 /* 0: center screen, 1: Pass 1:1 data */
#define LCDDualLink 0x0200
#define DontExpandLCD LCDNonExpanding
#define LCDNonExpandingShift 4
#define DontExpandLCDShift LCDNonExpandingShift
#define LCDSyncBit 0x00e0
#define LCDSyncShift 6
/* CR38 (315 series) */
#define EnableDualEdge 0x01
#define SetToLCDA 0x02 /* LCD channel A (301C/302B/30x(E)LV and 650+LVDS only) */
#define EnableCHScart 0x04 /* Scart on Ch7019 (unofficial definition - TW) */
#define EnableCHYPbPr 0x08 /* YPbPr on Ch7019 (480i HDTV); only on 650/Ch7019 systems */
#define EnableSiSYPbPr 0x08 /* Enable YPbPr mode (30xLV/301C only) */
#define EnableYPbPr525i 0x00 /* Enable 525i YPbPr mode (30xLV/301C only) (mask 0x30) */
#define EnableYPbPr525p 0x10 /* Enable 525p YPbPr mode (30xLV/301C only) (mask 0x30) */
#define EnableYPbPr750p 0x20 /* Enable 750p YPbPr mode (30xLV/301C only) (mask 0x30) */
#define EnableYPbPr1080i 0x30 /* Enable 1080i YPbPr mode (30xLV/301C only) (mask 0x30) */
#define EnablePALM 0x40 /* 1 = Set PALM */
#define EnablePALN 0x80 /* 1 = Set PALN */
#define EnableNTSCJ EnablePALM /* Not BIOS */
/* CR38 (661 and later)
D[7:5] 000 No VB
001 301 series VB
010 LVDS
011 Chrontel 7019
100 Conexant
D2 Enable YPbPr output (see CR35)
D[1:0] LCDA (like before)
*/
#define EnablePALMN 0x40 /* Romflag: 1 = Allow PALM/PALN */
/* CR39 (650 only) */
#define LCDPass1_1 0x01 /* 0: center screen, 1: pass 1:1 data output */
#define Enable302LV_DualLink 0x04 /* 302LV only; enable dual link */
/* CR39 (661 and later)
D[7] LVDS (SiS or third party)
D[1:0] YPbPr Aspect Ratio
00 4:3 letterbox
01 4:3
10 16:9
11 4:3
*/
/* CR3B (651+301C)
D[1:0] YPbPr Aspect Ratio
?
*/
/* CR79 (315/330 series only; not 661 and later)
[3-0] Notify driver
0001 Mode Switch event (set by BIOS)
0010 Epansion On/Off event
0011 TV UnderScan/OverScan event
0100 Set Brightness event
0101 Set Contrast event
0110 Set Mute event
0111 Set Volume Up/Down event
[4] Enable Backlight Control by BIOS/driver
(set by driver; set means that the BIOS should
not touch the backlight registers because eg.
the driver already switched off the backlight)
[5] PAL/NTSC (set by BIOS)
[6] Expansion On/Off (set by BIOS; copied to CR32[4])
[7] TV UnderScan/OverScan (set by BIOS)
*/
/* CR7C - 661 and later
[7] DualEdge enabled (or: to be enabled)
[6] CRT2 = TV/LCD/VGA enabled (or: to be enabled)
[5] Init done (set at end of SiS_Init)
{4] LVDS LCD capabilities
[3] LVDS LCD capabilities
[2] LVDS LCD capabilities (PWD)
[1] LVDS LCD capabilities (PWD)
[0] LVDS=1, TMDS=0 (SiS or third party)
*/
/* CR7E - 661 and later
VBType:
[7] LVDS (third party)
[3] 301C
[2] 302LV
[1] 301LV
[0] 301B
*/
/* LCDResInfo */
#define Panel300_800x600 0x01 /* CR36 */
#define Panel300_1024x768 0x02
#define Panel300_1280x1024 0x03
#define Panel300_1280x960 0x04
#define Panel300_640x480 0x05
#define Panel300_1024x600 0x06
#define Panel300_1152x768 0x07
#define Panel300_1280x768 0x0a
#define Panel300_Custom 0x0f
#define Panel300_Barco1366 0x10
#define Panel310_800x600 0x01
#define Panel310_1024x768 0x02
#define Panel310_1280x1024 0x03
#define Panel310_640x480 0x04
#define Panel310_1024x600 0x05
#define Panel310_1152x864 0x06
#define Panel310_1280x960 0x07
#define Panel310_1152x768 0x08 /* LVDS only */
#define Panel310_1400x1050 0x09
#define Panel310_1280x768 0x0a
#define Panel310_1600x1200 0x0b
#define Panel310_320x240_2 0x0c /* xSTN */
#define Panel310_320x240_3 0x0d /* xSTN */
#define Panel310_320x240_1 0x0e /* xSTN - This is fake, can be any */
#define Panel310_Custom 0x0f
#define Panel661_800x600 0x01
#define Panel661_1024x768 0x02
#define Panel661_1280x1024 0x03
#define Panel661_640x480 0x04
#define Panel661_1024x600 0x05
#define Panel661_1152x864 0x06
#define Panel661_1280x960 0x07
#define Panel661_1280x854 0x08
#define Panel661_1400x1050 0x09
#define Panel661_1280x768 0x0a
#define Panel661_1600x1200 0x0b
#define Panel661_1280x800 0x0c
#define Panel661_1680x1050 0x0d
#define Panel661_1280x720 0x0e
#define Panel661_Custom 0x0f
#define Panel_800x600 0x01 /* Unified values */
#define Panel_1024x768 0x02 /* MUST match BIOS values from 0-e */
#define Panel_1280x1024 0x03
#define Panel_640x480 0x04
#define Panel_1024x600 0x05
#define Panel_1152x864 0x06
#define Panel_1280x960 0x07
#define Panel_1152x768 0x08 /* LVDS only */
#define Panel_1400x1050 0x09
#define Panel_1280x768 0x0a /* 30xB/C and LVDS only (BIOS: all) */
#define Panel_1600x1200 0x0b
#define Panel_1280x800 0x0c /* 661etc (TMDS) */
#define Panel_1680x1050 0x0d /* 661etc */
#define Panel_1280x720 0x0e /* 661etc */
#define Panel_Custom 0x0f /* MUST BE 0x0f (for DVI DDC detection) */
#define Panel_320x240_1 0x10 /* SiS 550 xSTN */
#define Panel_Barco1366 0x11
#define Panel_848x480 0x12
#define Panel_320x240_2 0x13 /* SiS 550 xSTN */
#define Panel_320x240_3 0x14 /* SiS 550 xSTN */
#define Panel_1280x768_2 0x15 /* 30xLV */
#define Panel_1280x768_3 0x16 /* (unused) */
#define Panel_1280x800_2 0x17 /* 30xLV */
#define Panel_856x480 0x18
#define Panel_1280x854 0x19 /* 661etc */
/* Index in ModeResInfo table */
#define SIS_RI_320x200 0
#define SIS_RI_320x240 1
#define SIS_RI_320x400 2
#define SIS_RI_400x300 3
#define SIS_RI_512x384 4
#define SIS_RI_640x400 5
#define SIS_RI_640x480 6
#define SIS_RI_800x600 7
#define SIS_RI_1024x768 8
#define SIS_RI_1280x1024 9
#define SIS_RI_1600x1200 10
#define SIS_RI_1920x1440 11
#define SIS_RI_2048x1536 12
#define SIS_RI_720x480 13
#define SIS_RI_720x576 14
#define SIS_RI_1280x960 15
#define SIS_RI_800x480 16
#define SIS_RI_1024x576 17
#define SIS_RI_1280x720 18
#define SIS_RI_856x480 19
#define SIS_RI_1280x768 20
#define SIS_RI_1400x1050 21
#define SIS_RI_1152x864 22 /* Up to here SiS conforming */
#define SIS_RI_848x480 23
#define SIS_RI_1360x768 24
#define SIS_RI_1024x600 25
#define SIS_RI_1152x768 26
#define SIS_RI_768x576 27
#define SIS_RI_1360x1024 28
#define SIS_RI_1680x1050 29
#define SIS_RI_1280x800 30
#define SIS_RI_1920x1080 31
#define SIS_RI_960x540 32
#define SIS_RI_960x600 33
#define SIS_RI_1280x854 34
/* CR5F */
#define IsM650 0x80
/* Timing data */
#define NTSCHT 1716
#define NTSC2HT 1920
#define NTSCVT 525
#define PALHT 1728
#define PALVT 625
#define StHiTVHT 892
#define StHiTVVT 1126
#define StHiTextTVHT 1000
#define StHiTextTVVT 1126
#define ExtHiTVHT 2100
#define ExtHiTVVT 1125
/* Indices in (VB)VCLKData tables */
#define VCLK28 0x00 /* Index in VCLKData table (300 and 315) */
#define VCLK40 0x04 /* Index in VCLKData table (300 and 315) */
#define VCLK65_300 0x09 /* Index in VCLKData table (300) */
#define VCLK108_2_300 0x14 /* Index in VCLKData table (300) */
#define VCLK81_300 0x3f /* Index in VCLKData table (300) */
#define VCLK108_3_300 0x42 /* Index in VCLKData table (300) */
#define VCLK100_300 0x43 /* Index in VCLKData table (300) */
#define VCLK34_300 0x3d /* Index in VCLKData table (300) */
#define VCLK_CUSTOM_300 0x47
#define VCLK65_315 0x0b /* Indices in (VB)VCLKData table (315) */
#define VCLK108_2_315 0x19
#define VCLK81_315 0x5b
#define VCLK162_315 0x5e
#define VCLK108_3_315 0x45
#define VCLK100_315 0x46
#define VCLK34_315 0x55
#define VCLK68_315 0x0d
#define VCLK_1280x800_315_2 0x5c
#define VCLK121_315 0x5d
#define VCLK130_315 0x72
#define VCLK_1280x720 0x5f
#define VCLK_1280x768_2 0x60
#define VCLK_1280x768_3 0x61 /* (unused?) */
#define VCLK_CUSTOM_315 0x62
#define VCLK_1280x720_2 0x63
#define VCLK_720x480 0x67
#define VCLK_720x576 0x68
#define VCLK_768x576 0x68
#define VCLK_848x480 0x65
#define VCLK_856x480 0x66
#define VCLK_800x480 0x65
#define VCLK_1024x576 0x51
#define VCLK_1152x864 0x64
#define VCLK_1360x768 0x58
#define VCLK_1280x800_315 0x6c
#define VCLK_1280x854 0x76
#define TVCLKBASE_300 0x21 /* Indices on TV clocks in VCLKData table (300) */
#define TVCLKBASE_315 0x3a /* Indices on TV clocks in (VB)VCLKData table (315) */
#define TVVCLKDIV2 0x00 /* Index relative to TVCLKBASE */
#define TVVCLK 0x01 /* Index relative to TVCLKBASE */
#define HiTVVCLKDIV2 0x02 /* Index relative to TVCLKBASE */
#define HiTVVCLK 0x03 /* Index relative to TVCLKBASE */
#define HiTVSimuVCLK 0x04 /* Index relative to TVCLKBASE */
#define HiTVTextVCLK 0x05 /* Index relative to TVCLKBASE */
#define YPbPr750pVCLK 0x25 /* Index relative to TVCLKBASE; was 0x0f NOT relative */
/* ------------------------------ */
#define SetSCARTOutput 0x01
#define HotPlugFunction 0x08
#define StStructSize 0x06
#define SIS_VIDEO_CAPTURE 0x00 - 0x30
#define SIS_VIDEO_PLAYBACK 0x02 - 0x30
#define SIS_CRT2_PORT_04 0x04 - 0x30
#define SIS_CRT2_PORT_10 0x10 - 0x30
#define SIS_CRT2_PORT_12 0x12 - 0x30
#define SIS_CRT2_PORT_14 0x14 - 0x30
#define ADR_CRT2PtrData 0x20E
#define offset_Zurac 0x210 /* TW: Trumpion Zurac data pointer */
#define ADR_LVDSDesPtrData 0x212
#define ADR_LVDSCRT1DataPtr 0x214
#define ADR_CHTVVCLKPtr 0x216
#define ADR_CHTVRegDataPtr 0x218
#define LCDDataLen 8
#define HiTVDataLen 12
#define TVDataLen 16
#define LVDSDataLen 6
#define LVDSDesDataLen 3
#define ActiveNonExpanding 0x40
#define ActiveNonExpandingShift 6
#define ActivePAL 0x20
#define ActivePALShift 5
#define ModeSwitchStatus 0x0F
#define SoftTVType 0x40
#define SoftSettingAddr 0x52
#define ModeSettingAddr 0x53
#define _PanelType00 0x00
#define _PanelType01 0x08
#define _PanelType02 0x10
#define _PanelType03 0x18
#define _PanelType04 0x20
#define _PanelType05 0x28
#define _PanelType06 0x30
#define _PanelType07 0x38
#define _PanelType08 0x40
#define _PanelType09 0x48
#define _PanelType0A 0x50
#define _PanelType0B 0x58
#define _PanelType0C 0x60
#define _PanelType0D 0x68
#define _PanelType0E 0x70
#define _PanelType0F 0x78
#define PRIMARY_VGA 0 /* 1: SiS is primary vga 0:SiS is secondary vga */
#define BIOSIDCodeAddr 0x235 /* Offsets to ptrs in BIOS image */
#define OEMUtilIDCodeAddr 0x237
#define VBModeIDTableAddr 0x239
#define OEMTVPtrAddr 0x241
#define PhaseTableAddr 0x243
#define NTSCFilterTableAddr 0x245
#define PALFilterTableAddr 0x247
#define OEMLCDPtr_1Addr 0x249
#define OEMLCDPtr_2Addr 0x24B
#define LCDHPosTable_1Addr 0x24D
#define LCDHPosTable_2Addr 0x24F
#define LCDVPosTable_1Addr 0x251
#define LCDVPosTable_2Addr 0x253
#define OEMLCDPIDTableAddr 0x255
#define VBModeStructSize 5
#define PhaseTableSize 4
#define FilterTableSize 4
#define LCDHPosTableSize 7
#define LCDVPosTableSize 5
#define OEMLVDSPIDTableSize 4
#define LVDSHPosTableSize 4
#define LVDSVPosTableSize 6
#define VB_ModeID 0
#define VB_TVTableIndex 1
#define VB_LCDTableIndex 2
#define VB_LCDHIndex 3
#define VB_LCDVIndex 4
#define OEMLCDEnable 0x0001
#define OEMLCDDelayEnable 0x0002
#define OEMLCDPOSEnable 0x0004
#define OEMTVEnable 0x0100
#define OEMTVDelayEnable 0x0200
#define OEMTVFlickerEnable 0x0400
#define OEMTVPhaseEnable 0x0800
#define OEMTVFilterEnable 0x1000
#define OEMLCDPanelIDSupport 0x0080
/*
=============================================================
for 315 series (old data layout)
=============================================================
*/
#define SoftDRAMType 0x80
#define SoftSetting_OFFSET 0x52
#define SR07_OFFSET 0x7C
#define SR15_OFFSET 0x7D
#define SR16_OFFSET 0x81
#define SR17_OFFSET 0x85
#define SR19_OFFSET 0x8D
#define SR1F_OFFSET 0x99
#define SR21_OFFSET 0x9A
#define SR22_OFFSET 0x9B
#define SR23_OFFSET 0x9C
#define SR24_OFFSET 0x9D
#define SR25_OFFSET 0x9E
#define SR31_OFFSET 0x9F
#define SR32_OFFSET 0xA0
#define SR33_OFFSET 0xA1
#define CR40_OFFSET 0xA2
#define SR25_1_OFFSET 0xF6
#define CR49_OFFSET 0xF7
#define VB310Data_1_2_Offset 0xB6
#define VB310Data_4_D_Offset 0xB7
#define VB310Data_4_E_Offset 0xB8
#define VB310Data_4_10_Offset 0xBB
#define RGBSenseDataOffset 0xBD
#define YCSenseDataOffset 0xBF
#define VideoSenseDataOffset 0xC1
#define OutputSelectOffset 0xF3
#define ECLK_MCLK_DISTANCE 0x14
#define VBIOSTablePointerStart 0x100
#define StandTablePtrOffset VBIOSTablePointerStart+0x02
#define EModeIDTablePtrOffset VBIOSTablePointerStart+0x04
#define CRT1TablePtrOffset VBIOSTablePointerStart+0x06
#define ScreenOffsetPtrOffset VBIOSTablePointerStart+0x08
#define VCLKDataPtrOffset VBIOSTablePointerStart+0x0A
#define MCLKDataPtrOffset VBIOSTablePointerStart+0x0E
#define CRT2PtrDataPtrOffset VBIOSTablePointerStart+0x10
#define TVAntiFlickPtrOffset VBIOSTablePointerStart+0x12
#define TVDelayPtr1Offset VBIOSTablePointerStart+0x14
#define TVPhaseIncrPtr1Offset VBIOSTablePointerStart+0x16
#define TVYFilterPtr1Offset VBIOSTablePointerStart+0x18
#define LCDDelayPtr1Offset VBIOSTablePointerStart+0x20
#define TVEdgePtr1Offset VBIOSTablePointerStart+0x24
#define CRT2Delay1Offset VBIOSTablePointerStart+0x28
#endif

View File

@@ -1,261 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* File taken from the Linux xgifb driver (v3.18.5) */
#ifndef _VB_DEF_
#define _VB_DEF_
#define VB_XGI301C 0x0020 /* for 301C */
#define SupportCRT2in301C 0x0100 /* for 301C */
#define SetCHTVOverScan 0x8000
#define Panel_320x480 0x07 /*fstn*/
#define PanelResInfo 0x1F /* CR36 Panel Type/LCDResInfo */
#define Panel_1024x768x75 0x22
#define Panel_1280x1024x75 0x23
#define PanelRef60Hz 0x00
#define PanelRef75Hz 0x20
#define YPbPr525iVCLK 0x03B
#define YPbPr525iVCLK_2 0x03A
#define XGI_CRT2_PORT_00 (0x00 - 0x030)
#define SupportAllCRT2 0x0078
#define NoSupportTV 0x0070
#define NoSupportHiVisionTV 0x0060
#define NoSupportLCD 0x0058
/* -------------- SetMode Stack/Scratch */
#define XGI_SetCRT2ToLCDA 0x0100
#define SetCRT2ToDualEdge 0x8000
#define ReserveTVOption 0x0008
#define SetTVLowResolution 0x0400
#define TVSimuMode 0x0800
#define RPLLDIV2XO 0x1000
#define NTSC1024x768 0x2000
#define SetTVLockMode 0x4000
#define XGI_LCDVESATiming 0x0001 /* LCD Info/CR37 */
#define XGI_EnableLVDSDDA 0x0002
#define EnableScalingLCD 0x0008
#define SetPWDEnable 0x0004
#define SetLCDtoNonExpanding 0x0010
#define SetLCDDualLink 0x0100
#define SetLCDLowResolution 0x0200
/* LCD Capability shampoo */
#define DefaultLCDCap 0x80ea
#define EnableLCD24bpp 0x0004 /* default */
#define LCDPolarity 0x00c0 /* default: SyncNN */
#define XGI_LCDDualLink 0x0100
#define EnableSpectrum 0x0200
#define PWDEnable 0x0400
#define EnableVBCLKDRVLOW 0x4000
#define EnablePLLSPLOW 0x8000
#define AVIDEOSense 0x01 /* CR32 */
#define SVIDEOSense 0x02
#define SCARTSense 0x04
#define LCDSense 0x08
#define Monitor2Sense 0x10
#define Monitor1Sense 0x20
#define HiTVSense 0x40
#define YPbPrSense 0x80 /* NEW SCRATCH */
#define TVSense 0xc7
#define YPbPrMode 0xe0
#define YPbPrMode525i 0x00
#define YPbPrMode525p 0x20
#define YPbPrMode750p 0x40
#define YPbPrMode1080i 0x60
#define ScalingLCD 0x08
#define SetYPbPr 0x04
/* ---------------------- VUMA Information */
#define DisplayDeviceFromCMOS 0x10
/* ---------------------- HK Evnet Definition */
#define XGI_ModeSwitchStatus 0xf0
#define ActiveCRT1 0x10
#define ActiveLCD 0x0020
#define ActiveTV 0x40
#define ActiveCRT2 0x80
#define ActiveAVideo 0x01
#define ActiveSVideo 0x02
#define ActiveSCART 0x04
#define ActiveHiTV 0x08
#define ActiveYPbPr 0x10
#define NTSC1024x768HT 1908
#define YPbPrTV525iHT 1716 /* YPbPr */
#define YPbPrTV525iVT 525
#define YPbPrTV525pHT 1716
#define YPbPrTV525pVT 525
#define YPbPrTV750pHT 1650
#define YPbPrTV750pVT 750
#define VCLK25_175 0x00
#define VCLK28_322 0x01
#define VCLK31_5 0x02
#define VCLK36 0x03
#define VCLK43_163 0x05
#define VCLK44_9 0x06
#define VCLK49_5 0x07
#define VCLK50 0x08
#define VCLK52_406 0x09
#define VCLK56_25 0x0A
#define VCLK68_179 0x0D
#define VCLK72_852 0x0E
#define VCLK75 0x0F
#define VCLK78_75 0x11
#define VCLK79_411 0x12
#define VCLK83_95 0x13
#define VCLK86_6 0x15
#define VCLK94_5 0x16
#define VCLK113_309 0x1B
#define VCLK116_406 0x1C
#define VCLK135_5 0x1E
#define VCLK139_054 0x1F
#define VCLK157_5 0x20
#define VCLK162 0x21
#define VCLK175 0x22
#define VCLK189 0x23
#define VCLK202_5 0x25
#define VCLK229_5 0x26
#define VCLK234 0x27
#define VCLK254_817 0x29
#define VCLK266_952 0x2B
#define VCLK269_655 0x2C
#define VCLK277_015 0x2E
#define VCLK291_132 0x30
#define VCLK291_766 0x31
#define VCLK315_195 0x33
#define VCLK323_586 0x34
#define VCLK330_615 0x35
#define VCLK340_477 0x37
#define VCLK375_847 0x38
#define VCLK388_631 0x39
#define VCLK125_999 0x51
#define VCLK148_5 0x52
#define VCLK217_325 0x55
#define XGI_YPbPr750pVCLK 0x57
#define VCLK39_77 0x40
#define YPbPr525pVCLK 0x3A
#define NTSC1024VCLK 0x41
#define VCLK35_2 0x49 /* ; 800x480 */
#define VCLK122_61 0x4A
#define VCLK80_350 0x4B
#define VCLK107_385 0x4C
#define RES320x200 0x00
#define RES320x240 0x01
#define RES400x300 0x02
#define RES512x384 0x03
#define RES640x400 0x04
#define RES640x480x60 0x05
#define RES640x480x72 0x06
#define RES640x480x75 0x07
#define RES640x480x85 0x08
#define RES640x480x100 0x09
#define RES640x480x120 0x0A
#define RES640x480x160 0x0B
#define RES640x480x200 0x0C
#define RES800x600x56 0x0D
#define RES800x600x60 0x0E
#define RES800x600x72 0x0F
#define RES800x600x75 0x10
#define RES800x600x85 0x11
#define RES800x600x100 0x12
#define RES800x600x120 0x13
#define RES800x600x160 0x14
#define RES1024x768x43 0x15
#define RES1024x768x60 0x16
#define RES1024x768x70 0x17
#define RES1024x768x75 0x18
#define RES1024x768x85 0x19
#define RES1024x768x100 0x1A
#define RES1024x768x120 0x1B
#define RES1280x1024x43 0x1C
#define RES1280x1024x60 0x1D
#define RES1280x1024x75 0x1E
#define RES1280x1024x85 0x1F
#define RES1600x1200x60 0x20
#define RES1600x1200x65 0x21
#define RES1600x1200x70 0x22
#define RES1600x1200x75 0x23
#define RES1600x1200x85 0x24
#define RES1600x1200x100 0x25
#define RES1600x1200x120 0x26
#define RES1920x1440x60 0x27
#define RES1920x1440x65 0x28
#define RES1920x1440x70 0x29
#define RES1920x1440x75 0x2A
#define RES1920x1440x85 0x2B
#define RES1920x1440x100 0x2C
#define RES2048x1536x60 0x2D
#define RES2048x1536x65 0x2E
#define RES2048x1536x70 0x2F
#define RES2048x1536x75 0x30
#define RES2048x1536x85 0x31
#define RES800x480x60 0x32
#define RES800x480x75 0x33
#define RES800x480x85 0x34
#define RES1024x576x60 0x35
#define RES1024x576x75 0x36
#define RES1024x576x85 0x37
#define RES1280x720x60 0x38
#define RES1280x720x75 0x39
#define RES1280x720x85 0x3A
#define RES1280x960x60 0x3B
#define RES720x480x60 0x3C
#define RES720x576x56 0x3D
#define RES856x480x79I 0x3E
#define RES856x480x60 0x3F
#define RES1280x768x60 0x40
#define RES1400x1050x60 0x41
#define RES1152x864x60 0x42
#define RES1152x864x75 0x43
#define RES1024x768x160 0x44
#define RES1280x960x75 0x45
#define RES1280x960x85 0x46
#define RES1280x960x120 0x47
#define XG27_CR8F 0x0C
#define XG27_SR36 0x30
#define XG27_SR40 0x04
#define XG27_SR41 0x00
#define XG40_CRCF 0x13
#define XGI330_CRT2Data_1_2 0
#define XGI330_CRT2Data_4_D 0
#define XGI330_CRT2Data_4_E 0
#define XGI330_CRT2Data_4_10 0x80
#define XGI330_SR07 0x18
#define XGI330_SR1F 0
#define XGI330_SR23 0xf6
#define XGI330_SR24 0x0d
#define XGI330_SR31 0xc0
#define XGI330_SR32 0x11
#define XGI330_SR33 0
extern const struct XGI_ExtStruct XGI330_EModeIDTable[];
extern const struct XGI_Ext2Struct XGI330_RefIndex[];
extern const struct XGI_CRT1TableStruct XGI_CRT1Table[];
extern const struct XGI_ECLKDataStruct XGI340_ECLKData[];
extern const struct SiS_VCLKData XGI_VCLKData[];
extern const unsigned char XGI340_CR6B[][4];
extern const unsigned char XGI340_AGPReg[];
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* File taken from the Linux xgifb driver (v3.18.5) */
#ifndef _VBINIT_
#define _VBINIT_
extern unsigned char XGIInitNew(struct pci_dev *pdev);
extern void XGIRegInit(struct vb_device_info *, unsigned long);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,27 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* File taken from the Linux xgifb driver (v3.18.5) */
#ifndef _VBSETMODE_
#define _VBSETMODE_
extern void InitTo330Pointer(unsigned char, struct vb_device_info *);
extern void XGI_UnLockCRT2(struct vb_device_info *);
extern void XGI_LockCRT2(struct vb_device_info *);
extern void XGI_DisplayOff(struct xgifb_video_info *,
struct xgi_hw_device_info *,
struct vb_device_info *);
extern void XGI_GetVBType(struct vb_device_info *);
extern void XGI_SenseCRT1(struct vb_device_info *);
extern unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
struct xgi_hw_device_info *HwDeviceExtension,
unsigned short ModeNo);
extern unsigned char XGI_SearchModeID(unsigned short ModeNo,
unsigned short *ModeIdIndex);
extern unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE,
unsigned short ModeNo,
unsigned short ModeIdIndex,
struct vb_device_info *);
#endif

View File

@@ -1,169 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* File taken from the Linux xgifb driver (v3.18.5) */
#ifndef _VB_STRUCT_
#define _VB_STRUCT_
struct XGI_LVDSCRT1HDataStruct {
unsigned char Reg[8];
};
struct XGI_LVDSCRT1VDataStruct {
unsigned char Reg[7];
};
struct XGI_ExtStruct {
unsigned char Ext_ModeID;
unsigned short Ext_ModeFlag;
unsigned short Ext_ModeInfo;
unsigned char Ext_RESINFO;
unsigned char VB_ExtTVYFilterIndex;
unsigned char REFindex;
};
struct XGI_Ext2Struct {
unsigned short Ext_InfoFlag;
unsigned char Ext_CRT1CRTC;
unsigned char Ext_CRTVCLK;
unsigned char Ext_CRT2CRTC;
unsigned char Ext_CRT2CRTC2;
unsigned char ModeID;
unsigned short XRes;
unsigned short YRes;
};
struct XGI_ECLKDataStruct {
unsigned char SR2E, SR2F, SR30;
unsigned short CLOCK;
};
/*add for new UNIVGABIOS*/
struct XGI_LCDDesStruct {
unsigned short LCDHDES;
unsigned short LCDHRS;
unsigned short LCDVDES;
unsigned short LCDVRS;
};
struct XGI330_LCDDataDesStruct2 {
unsigned short LCDHDES;
unsigned short LCDHRS;
unsigned short LCDVDES;
unsigned short LCDVRS;
unsigned short LCDHSync;
unsigned short LCDVSync;
};
struct XGI330_LCDDataTablStruct {
unsigned char PANELID;
unsigned short MASK;
unsigned short CAP;
void const *DATAPTR;
};
struct XGI330_TVDataTablStruct {
unsigned short MASK;
unsigned short CAP;
struct SiS_TVData const *DATAPTR;
};
struct XGI_TimingHStruct {
unsigned char data[8];
};
struct XGI_TimingVStruct {
unsigned char data[7];
};
struct XGI_XG21CRT1Struct {
unsigned char ModeID, CR02, CR03, CR15, CR16;
};
struct XGI330_LCDCapStruct {
unsigned char LCD_ID;
unsigned short LCD_Capability;
unsigned char LCD_HSyncWidth;
unsigned char LCD_VSyncWidth;
unsigned char LCD_VCLK;
unsigned char LCDA_VCLKData1;
unsigned char LCDA_VCLKData2;
unsigned char LCUCHAR_VCLKData1;
unsigned char LCUCHAR_VCLKData2;
unsigned char Spectrum_31;
unsigned char Spectrum_32;
unsigned char Spectrum_33;
unsigned char Spectrum_34;
};
struct XGI21_LVDSCapStruct {
unsigned short LVDS_Capability;
unsigned short LVDSHT;
unsigned short LVDSVT;
unsigned short LVDSHDE;
unsigned short LVDSVDE;
unsigned short LVDSHFP;
unsigned short LVDSVFP;
unsigned short LVDSHSYNC;
unsigned short LVDSVSYNC;
unsigned char VCLKData1;
unsigned char VCLKData2;
unsigned char PSC_S1; /* Duration between CPL on and signal on */
unsigned char PSC_S2; /* Duration signal on and Vdd on */
unsigned char PSC_S3; /* Duration between CPL off and signal off */
unsigned char PSC_S4; /* Duration signal off and Vdd off */
unsigned char PSC_S5;
};
struct XGI_CRT1TableStruct {
unsigned char CR[16];
};
struct XGI301C_Tap4TimingStruct {
unsigned short DE;
unsigned char Reg[64]; /* C0-FF */
};
struct vb_device_info {
unsigned long P3c4, P3d4, P3c0, P3ce, P3c2, P3cc;
unsigned long P3ca, P3c6, P3c7, P3c8, P3c9, P3da;
unsigned long Part0Port, Part1Port, Part2Port;
unsigned long Part3Port, Part4Port, Part5Port;
unsigned short RVBHCFACT, RVBHCMAX, RVBHRS;
unsigned short VGAVT, VGAHT, VGAVDE, VGAHDE;
unsigned short VT, HT, VDE, HDE;
unsigned short LCDHRS, LCDVRS, LCDHDES, LCDVDES;
unsigned short ModeType;
unsigned short IF_DEF_LVDS;
unsigned short IF_DEF_CRT2Monitor;
unsigned short IF_DEF_YPbPr;
unsigned short IF_DEF_HiVision;
unsigned short LCDResInfo, LCDTypeInfo, VBType;/*301b*/
unsigned short VBInfo, TVInfo, LCDInfo;
unsigned short SetFlag;
unsigned short NewFlickerMode;
unsigned short SelectCRT2Rate;
void __iomem *FBAddr;
unsigned char const *SR18;
unsigned char const (*CR40)[3];
struct SiS_MCLKData const *MCLKData;
unsigned char XGINew_CR97;
struct XGI330_LCDCapStruct const *LCDCapList;
struct XGI_TimingHStruct TimingH;
struct XGI_TimingVStruct TimingV;
int ram_type;
int ram_channel;
int ram_bus;
}; /* _struct vb_device_info */
#endif /* _VB_STRUCT_ */

File diff suppressed because it is too large Load Diff

View File

@@ -1,50 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* File taken from the Linux xgifb driver (v3.18.5) */
#include "xgi_coreboot.h"
#include "vgatypes.h"
#include "vb_util.h"
void xgifb_reg_set(unsigned long port, u8 index, u8 data)
{
outb(index, port);
outb(data, port + 1);
}
u8 xgifb_reg_get(unsigned long port, u8 index)
{
u8 data;
outb(index, port);
data = inb(port + 1);
return data;
}
void xgifb_reg_and_or(unsigned long port, u8 index,
unsigned int data_and, unsigned int data_or)
{
u8 temp;
temp = xgifb_reg_get(port, index); /* XGINew_Part1Port index 02 */
temp = (temp & data_and) | data_or;
xgifb_reg_set(port, index, temp);
}
void xgifb_reg_and(unsigned long port, u8 index, unsigned int data_and)
{
u8 temp;
temp = xgifb_reg_get(port, index); /* XGINew_Part1Port index 02 */
temp &= data_and;
xgifb_reg_set(port, index, temp);
}
void xgifb_reg_or(unsigned long port, u8 index, unsigned int data_or)
{
u8 temp;
temp = xgifb_reg_get(port, index); /* XGINew_Part1Port index 02 */
temp |= data_or;
xgifb_reg_set(port, index, temp);
}

View File

@@ -1,12 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* File taken from the Linux xgifb driver (v3.18.5) */
#ifndef _VBUTIL_
#define _VBUTIL_
extern void xgifb_reg_set(unsigned long, u8, u8);
extern u8 xgifb_reg_get(unsigned long, u8);
extern void xgifb_reg_or(unsigned long, u8, unsigned int);
extern void xgifb_reg_and(unsigned long, u8, unsigned int);
extern void xgifb_reg_and_or(unsigned long, u8, unsigned int, unsigned int);
#endif

View File

@@ -1,48 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* File taken from the Linux xgifb driver (v3.18.5) */
#ifndef _VGATYPES_
#define _VGATYPES_
enum XGI_VB_CHIP_TYPE {
VB_CHIP_Legacy = 0,
VB_CHIP_301,
VB_CHIP_301B,
VB_CHIP_301LV,
VB_CHIP_302,
VB_CHIP_302B,
VB_CHIP_302LV,
VB_CHIP_301C,
VB_CHIP_302ELV,
VB_CHIP_UNKNOWN, /* other video bridge or no video bridge */
MAX_VB_CHIP
};
struct xgi_hw_device_info {
unsigned long ulExternalChip; /* NO VB or other video bridge*/
/* if ujVBChipID = VB_CHIP_UNKNOWN, */
void __iomem *pjVideoMemoryAddress;/* base virtual memory address */
/* of Linear VGA memory */
unsigned long ulVideoMemorySize; /* size, in bytes, of the
memory on the board */
unsigned char jChipType; /* Used to Identify Graphics Chip */
/* defined in the data structure type */
/* "XGI_CHIP_TYPE" */
unsigned char jChipRevision; /* Used to Identify Graphics
Chip Revision */
unsigned char ujVBChipID; /* the ID of video bridge */
/* defined in the data structure type */
/* "XGI_VB_CHIP_TYPE" */
unsigned long ulCRT2LCDType; /* defined in the data structure type */
};
/* Additional IOCTL for communication xgifb <> X driver */
/* If changing this, xgifb.h must also be changed (for xgifb) */
#endif

View File

@@ -1,546 +0,0 @@
/* $XFree86$ */
/* $XdotOrg$ */
/*
* General structure definitions for universal mode switching modules
*
* Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria
*
* If distributed as part of the Linux kernel, the following license terms
* apply:
*
* * This program is free software; you can redistribute it and/or modify
* * it under the terms of the GNU General Public License as published by
* * the Free Software Foundation; either version 2 of the named License,
* * or any later version.
* *
* * This program is distributed in the hope that it will be useful,
* * but WITHOUT ANY WARRANTY; without even the implied warranty of
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* * GNU General Public License for more details.
*
* Otherwise, the following license terms apply:
*
* * Redistribution and use in source and binary forms, with or without
* * modification, are permitted provided that the following conditions
* * are met:
* * 1) Redistributions of source code must retain the above copyright
* * notice, this list of conditions and the following disclaimer.
* * 2) Redistributions in binary form must reproduce the above copyright
* * notice, this list of conditions and the following disclaimer in the
* * documentation and/or other materials provided with the distribution.
* * 3) The name of the author may not be used to endorse or promote products
* * derived from this software without specific prior written permission.
* *
* * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Author: Thomas Winischhofer <thomas@winischhofer.net>
*
*/
#ifndef _VSTRUCT_H_
#define _VSTRUCT_H_
struct SiS_PanelDelayTbl {
unsigned char timer[2];
};
struct SiS_LCDData {
unsigned short RVBHCMAX;
unsigned short RVBHCFACT;
unsigned short VGAHT;
unsigned short VGAVT;
unsigned short LCDHT;
unsigned short LCDVT;
};
struct SiS_TVData {
unsigned short RVBHCMAX;
unsigned short RVBHCFACT;
unsigned short VGAHT;
unsigned short VGAVT;
unsigned short TVHDE;
unsigned short TVVDE;
unsigned short RVBHRS;
unsigned char FlickerMode;
unsigned short HALFRVBHRS;
unsigned short RVBHRS2;
unsigned char RY1COE;
unsigned char RY2COE;
unsigned char RY3COE;
unsigned char RY4COE;
};
struct SiS_LVDSData {
unsigned short VGAHT;
unsigned short VGAVT;
unsigned short LCDHT;
unsigned short LCDVT;
};
struct SiS_LVDSDes {
unsigned short LCDHDES;
unsigned short LCDVDES;
};
struct SiS_LVDSCRT1Data {
unsigned char CR[15];
};
struct SiS_CHTVRegData {
unsigned char Reg[16];
};
struct SiS_St {
unsigned char St_ModeID;
unsigned short St_ModeFlag;
unsigned char St_StTableIndex;
unsigned char St_CRT2CRTC;
unsigned char St_ResInfo;
unsigned char VB_StTVFlickerIndex;
unsigned char VB_StTVEdgeIndex;
unsigned char VB_StTVYFilterIndex;
unsigned char St_PDC;
};
struct SiS_VBMode {
unsigned char ModeID;
unsigned char VB_TVDelayIndex;
unsigned char VB_TVFlickerIndex;
unsigned char VB_TVPhaseIndex;
unsigned char VB_TVYFilterIndex;
unsigned char VB_LCDDelayIndex;
unsigned char _VB_LCDHIndex;
unsigned char _VB_LCDVIndex;
};
struct SiS_StandTable_S {
unsigned char CRT_COLS;
unsigned char ROWS;
unsigned char CHAR_HEIGHT;
unsigned short CRT_LEN;
unsigned char SR[4];
unsigned char MISC;
unsigned char CRTC[0x19];
unsigned char ATTR[0x14];
unsigned char GRC[9];
};
struct SiS_Ext {
unsigned char Ext_ModeID;
unsigned short Ext_ModeFlag;
unsigned short Ext_VESAID;
unsigned char Ext_RESINFO;
unsigned char VB_ExtTVFlickerIndex;
unsigned char VB_ExtTVEdgeIndex;
unsigned char VB_ExtTVYFilterIndex;
unsigned char VB_ExtTVYFilterIndexROM661;
unsigned char REFindex;
char ROMMODEIDX661;
};
struct SiS_Ext2 {
unsigned short Ext_InfoFlag;
unsigned char Ext_CRT1CRTC;
unsigned char Ext_CRTVCLK;
unsigned char Ext_CRT2CRTC;
unsigned char Ext_CRT2CRTC_NS;
unsigned char ModeID;
unsigned short XRes;
unsigned short YRes;
unsigned char Ext_PDC;
unsigned char Ext_FakeCRT2CRTC;
unsigned char Ext_FakeCRT2Clk;
unsigned char Ext_CRT1CRTC_NORM;
unsigned char Ext_CRTVCLK_NORM;
unsigned char Ext_CRT1CRTC_WIDE;
unsigned char Ext_CRTVCLK_WIDE;
};
struct SiS_Part2PortTbl {
unsigned char CR[12];
};
struct SiS_CRT1Table {
unsigned char CR[17];
};
struct SiS_MCLKData {
unsigned char SR28,SR29,SR2A;
unsigned short CLOCK;
};
struct SiS_VCLKData {
unsigned char SR2B,SR2C;
unsigned short CLOCK;
};
struct SiS_VBVCLKData {
unsigned char Part4_A,Part4_B;
unsigned short CLOCK;
};
struct SiS_StResInfo_S {
unsigned short HTotal;
unsigned short VTotal;
};
struct SiS_ModeResInfo_S {
unsigned short HTotal;
unsigned short VTotal;
unsigned char XChar;
unsigned char YChar;
};
/* Defines for SiS_CustomT */
/* Never change these for sisfb compatibility */
#define CUT_NONE 0
#define CUT_FORCENONE 1
#define CUT_BARCO1366 2
#define CUT_BARCO1024 3
#define CUT_COMPAQ1280 4
#define CUT_COMPAQ12802 5
#define CUT_PANEL848 6
#define CUT_CLEVO1024 7
#define CUT_CLEVO10242 8
#define CUT_CLEVO1400 9
#define CUT_CLEVO14002 10
#define CUT_UNIWILL1024 11
#define CUT_ASUSL3000D 12
#define CUT_UNIWILL10242 13
#define CUT_ACER1280 14
#define CUT_COMPAL1400_1 15
#define CUT_COMPAL1400_2 16
#define CUT_ASUSA2H_1 17
#define CUT_ASUSA2H_2 18
#define CUT_UNKNOWNLCD 19
#define CUT_AOP8060 20
#define CUT_PANEL856 21
struct SiS_Private
{
unsigned char ChipType;
unsigned char ChipRevision;
void *ivideo;
unsigned char *VirtualRomBase;
bool UseROM;
unsigned char SISIOMEMTYPE *VideoMemoryAddress;
unsigned int VideoMemorySize;
SISIOADDRESS IOAddress;
SISIOADDRESS IOAddress2; /* For dual chip XGI volari */
SISIOADDRESS RelIO;
SISIOADDRESS SiS_P3c4;
SISIOADDRESS SiS_P3d4;
SISIOADDRESS SiS_P3c0;
SISIOADDRESS SiS_P3ce;
SISIOADDRESS SiS_P3c2;
SISIOADDRESS SiS_P3ca;
SISIOADDRESS SiS_P3c6;
SISIOADDRESS SiS_P3c7;
SISIOADDRESS SiS_P3c8;
SISIOADDRESS SiS_P3c9;
SISIOADDRESS SiS_P3cb;
SISIOADDRESS SiS_P3cc;
SISIOADDRESS SiS_P3cd;
SISIOADDRESS SiS_P3da;
SISIOADDRESS SiS_Part1Port;
SISIOADDRESS SiS_Part2Port;
SISIOADDRESS SiS_Part3Port;
SISIOADDRESS SiS_Part4Port;
SISIOADDRESS SiS_Part5Port;
SISIOADDRESS SiS_VidCapt;
SISIOADDRESS SiS_VidPlay;
unsigned short SiS_IF_DEF_LVDS;
unsigned short SiS_IF_DEF_CH70xx;
unsigned short SiS_IF_DEF_CONEX;
unsigned short SiS_IF_DEF_TRUMPION;
unsigned short SiS_IF_DEF_DSTN;
unsigned short SiS_IF_DEF_FSTN;
unsigned short SiS_SysFlags;
unsigned char SiS_VGAINFO;
bool SiS_UseROM;
bool SiS_ROMNew;
bool SiS_XGIROM;
bool SiS_NeedRomModeData;
bool PanelSelfDetected;
bool DDCPortMixup;
int SiS_CHOverScan;
bool SiS_CHSOverScan;
bool SiS_ChSW;
bool SiS_UseLCDA;
int SiS_UseOEM;
unsigned int SiS_CustomT;
int SiS_UseWide, SiS_UseWideCRT2;
int SiS_TVBlue;
unsigned short SiS_Backup70xx;
bool HaveEMI;
bool HaveEMILCD;
bool OverruleEMI;
unsigned char EMI_30,EMI_31,EMI_32,EMI_33;
unsigned short SiS_EMIOffset;
unsigned short SiS_PWDOffset;
short PDC, PDCA;
unsigned char SiS_MyCR63;
unsigned short SiS_CRT1Mode;
unsigned short SiS_flag_clearbuffer;
int SiS_RAMType;
unsigned char SiS_ChannelAB;
unsigned char SiS_DataBusWidth;
unsigned short SiS_ModeType;
unsigned short SiS_VBInfo;
unsigned short SiS_TVMode;
unsigned short SiS_LCDResInfo;
unsigned short SiS_LCDTypeInfo;
unsigned short SiS_LCDInfo;
unsigned short SiS_LCDInfo661;
unsigned short SiS_VBType;
unsigned short SiS_VBExtInfo;
unsigned short SiS_YPbPr;
unsigned short SiS_SelectCRT2Rate;
unsigned short SiS_SetFlag;
unsigned short SiS_RVBHCFACT;
unsigned short SiS_RVBHCMAX;
unsigned short SiS_RVBHRS;
unsigned short SiS_RVBHRS2;
unsigned short SiS_VGAVT;
unsigned short SiS_VGAHT;
unsigned short SiS_VT;
unsigned short SiS_HT;
unsigned short SiS_VGAVDE;
unsigned short SiS_VGAHDE;
unsigned short SiS_VDE;
unsigned short SiS_HDE;
unsigned short SiS_NewFlickerMode;
unsigned short SiS_RY1COE;
unsigned short SiS_RY2COE;
unsigned short SiS_RY3COE;
unsigned short SiS_RY4COE;
unsigned short SiS_LCDHDES;
unsigned short SiS_LCDVDES;
SISIOADDRESS SiS_DDC_Port;
unsigned short SiS_DDC_Index;
unsigned short SiS_DDC_Data;
unsigned short SiS_DDC_NData;
unsigned short SiS_DDC_Clk;
unsigned short SiS_DDC_NClk;
unsigned short SiS_DDC_DeviceAddr;
unsigned short SiS_DDC_ReadAddr;
unsigned short SiS_DDC_SecAddr;
unsigned short SiS_ChrontelInit;
bool SiS_SensibleSR11;
unsigned short SiS661LCD2TableSize;
unsigned short SiS_PanelMinLVDS;
unsigned short SiS_PanelMin301;
const struct SiS_St *SiS_SModeIDTable;
const struct SiS_StandTable_S *SiS_StandTable;
const struct SiS_Ext *SiS_EModeIDTable;
const struct SiS_Ext2 *SiS_RefIndex;
const struct SiS_VBMode *SiS_VBModeIDTable;
const struct SiS_CRT1Table *SiS_CRT1Table;
const struct SiS_MCLKData *SiS_MCLKData_0;
const struct SiS_MCLKData *SiS_MCLKData_1;
struct SiS_VCLKData *SiS_VCLKData;
struct SiS_VBVCLKData *SiS_VBVCLKData;
const struct SiS_StResInfo_S *SiS_StResInfo;
const struct SiS_ModeResInfo_S *SiS_ModeResInfo;
const unsigned char *pSiS_OutputSelect;
const unsigned char *pSiS_SoftSetting;
const unsigned char *SiS_SR15;
const struct SiS_PanelDelayTbl *SiS_PanelDelayTbl;
const struct SiS_PanelDelayTbl *SiS_PanelDelayTblLVDS;
/* SiS bridge */
const struct SiS_LCDData *SiS_ExtLCD1024x768Data;
const struct SiS_LCDData *SiS_St2LCD1024x768Data;
const struct SiS_LCDData *SiS_LCD1280x720Data;
const struct SiS_LCDData *SiS_StLCD1280x768_2Data;
const struct SiS_LCDData *SiS_ExtLCD1280x768_2Data;
const struct SiS_LCDData *SiS_LCD1280x800Data;
const struct SiS_LCDData *SiS_LCD1280x800_2Data;
const struct SiS_LCDData *SiS_LCD1280x854Data;
const struct SiS_LCDData *SiS_LCD1280x960Data;
const struct SiS_LCDData *SiS_ExtLCD1280x1024Data;
const struct SiS_LCDData *SiS_St2LCD1280x1024Data;
const struct SiS_LCDData *SiS_StLCD1400x1050Data;
const struct SiS_LCDData *SiS_ExtLCD1400x1050Data;
const struct SiS_LCDData *SiS_StLCD1600x1200Data;
const struct SiS_LCDData *SiS_ExtLCD1600x1200Data;
const struct SiS_LCDData *SiS_LCD1680x1050Data;
const struct SiS_LCDData *SiS_NoScaleData;
const struct SiS_TVData *SiS_StPALData;
const struct SiS_TVData *SiS_ExtPALData;
const struct SiS_TVData *SiS_StNTSCData;
const struct SiS_TVData *SiS_ExtNTSCData;
const struct SiS_TVData *SiS_St1HiTVData;
const struct SiS_TVData *SiS_St2HiTVData;
const struct SiS_TVData *SiS_ExtHiTVData;
const struct SiS_TVData *SiS_St525iData;
const struct SiS_TVData *SiS_St525pData;
const struct SiS_TVData *SiS_St750pData;
const struct SiS_TVData *SiS_Ext525iData;
const struct SiS_TVData *SiS_Ext525pData;
const struct SiS_TVData *SiS_Ext750pData;
const unsigned char *SiS_NTSCTiming;
const unsigned char *SiS_PALTiming;
const unsigned char *SiS_HiTVExtTiming;
const unsigned char *SiS_HiTVSt1Timing;
const unsigned char *SiS_HiTVSt2Timing;
const unsigned char *SiS_HiTVGroup3Data;
const unsigned char *SiS_HiTVGroup3Simu;
#if 0
const unsigned char *SiS_HiTVTextTiming;
const unsigned char *SiS_HiTVGroup3Text;
#endif
const struct SiS_Part2PortTbl *SiS_CRT2Part2_1024x768_1;
const struct SiS_Part2PortTbl *SiS_CRT2Part2_1024x768_2;
const struct SiS_Part2PortTbl *SiS_CRT2Part2_1024x768_3;
/* LVDS, Chrontel */
const struct SiS_LVDSData *SiS_LVDS320x240Data_1;
const struct SiS_LVDSData *SiS_LVDS320x240Data_2;
const struct SiS_LVDSData *SiS_LVDS640x480Data_1;
const struct SiS_LVDSData *SiS_LVDS800x600Data_1;
const struct SiS_LVDSData *SiS_LVDS1024x600Data_1;
const struct SiS_LVDSData *SiS_LVDS1024x768Data_1;
const struct SiS_LVDSData *SiS_LVDSBARCO1366Data_1;
const struct SiS_LVDSData *SiS_LVDSBARCO1366Data_2;
const struct SiS_LVDSData *SiS_LVDSBARCO1024Data_1;
const struct SiS_LVDSData *SiS_LVDS848x480Data_1;
const struct SiS_LVDSData *SiS_LVDS848x480Data_2;
const struct SiS_LVDSData *SiS_CHTVUNTSCData;
const struct SiS_LVDSData *SiS_CHTVONTSCData;
const struct SiS_LVDSData *SiS_CHTVUPALData;
const struct SiS_LVDSData *SiS_CHTVOPALData;
const struct SiS_LVDSData *SiS_CHTVUPALMData;
const struct SiS_LVDSData *SiS_CHTVOPALMData;
const struct SiS_LVDSData *SiS_CHTVUPALNData;
const struct SiS_LVDSData *SiS_CHTVOPALNData;
const struct SiS_LVDSData *SiS_CHTVSOPALData;
const struct SiS_LVDSDes *SiS_PanelType04_1a;
const struct SiS_LVDSDes *SiS_PanelType04_2a;
const struct SiS_LVDSDes *SiS_PanelType04_1b;
const struct SiS_LVDSDes *SiS_PanelType04_2b;
const struct SiS_LVDSCRT1Data *SiS_LVDSCRT1320x240_1;
const struct SiS_LVDSCRT1Data *SiS_LVDSCRT1320x240_2;
const struct SiS_LVDSCRT1Data *SiS_LVDSCRT1320x240_2_H;
const struct SiS_LVDSCRT1Data *SiS_LVDSCRT1320x240_3;
const struct SiS_LVDSCRT1Data *SiS_LVDSCRT1320x240_3_H;
const struct SiS_LVDSCRT1Data *SiS_LVDSCRT1640x480_1;
const struct SiS_LVDSCRT1Data *SiS_LVDSCRT1640x480_1_H;
const struct SiS_LVDSCRT1Data *SiS_CHTVCRT1UNTSC;
const struct SiS_LVDSCRT1Data *SiS_CHTVCRT1ONTSC;
const struct SiS_LVDSCRT1Data *SiS_CHTVCRT1UPAL;
const struct SiS_LVDSCRT1Data *SiS_CHTVCRT1OPAL;
const struct SiS_LVDSCRT1Data *SiS_CHTVCRT1SOPAL;
const struct SiS_CHTVRegData *SiS_CHTVReg_UNTSC;
const struct SiS_CHTVRegData *SiS_CHTVReg_ONTSC;
const struct SiS_CHTVRegData *SiS_CHTVReg_UPAL;
const struct SiS_CHTVRegData *SiS_CHTVReg_OPAL;
const struct SiS_CHTVRegData *SiS_CHTVReg_UPALM;
const struct SiS_CHTVRegData *SiS_CHTVReg_OPALM;
const struct SiS_CHTVRegData *SiS_CHTVReg_UPALN;
const struct SiS_CHTVRegData *SiS_CHTVReg_OPALN;
const struct SiS_CHTVRegData *SiS_CHTVReg_SOPAL;
const unsigned char *SiS_CHTVVCLKUNTSC;
const unsigned char *SiS_CHTVVCLKONTSC;
const unsigned char *SiS_CHTVVCLKUPAL;
const unsigned char *SiS_CHTVVCLKOPAL;
const unsigned char *SiS_CHTVVCLKUPALM;
const unsigned char *SiS_CHTVVCLKOPALM;
const unsigned char *SiS_CHTVVCLKUPALN;
const unsigned char *SiS_CHTVVCLKOPALN;
const unsigned char *SiS_CHTVVCLKSOPAL;
unsigned short PanelXRes, PanelHT;
unsigned short PanelYRes, PanelVT;
unsigned short PanelHRS, PanelHRE;
unsigned short PanelVRS, PanelVRE;
unsigned short PanelVCLKIdx300;
unsigned short PanelVCLKIdx315;
bool Alternate1600x1200;
bool UseCustomMode;
bool CRT1UsesCustomMode;
unsigned short CHDisplay;
unsigned short CHSyncStart;
unsigned short CHSyncEnd;
unsigned short CHTotal;
unsigned short CHBlankStart;
unsigned short CHBlankEnd;
unsigned short CVDisplay;
unsigned short CVSyncStart;
unsigned short CVSyncEnd;
unsigned short CVTotal;
unsigned short CVBlankStart;
unsigned short CVBlankEnd;
unsigned int CDClock;
unsigned int CFlags;
unsigned char CCRT1CRTC[17];
unsigned char CSR2B;
unsigned char CSR2C;
unsigned short CSRClock;
unsigned short CSRClock_CRT1;
unsigned short CModeFlag;
unsigned short CModeFlag_CRT1;
unsigned short CInfoFlag;
int LVDSHL;
bool Backup;
unsigned char Backup_Mode;
unsigned char Backup_14;
unsigned char Backup_15;
unsigned char Backup_16;
unsigned char Backup_17;
unsigned char Backup_18;
unsigned char Backup_19;
unsigned char Backup_1a;
unsigned char Backup_1b;
unsigned char Backup_1c;
unsigned char Backup_1d;
unsigned char Init_P4_0E;
int UsePanelScaler;
int CenterScreen;
unsigned short CP_Vendor, CP_Product;
bool CP_HaveCustomData;
int CP_PreferredX, CP_PreferredY, CP_PreferredIndex;
int CP_MaxX, CP_MaxY, CP_MaxClock;
unsigned char CP_PrefSR2B, CP_PrefSR2C;
unsigned short CP_PrefClock;
bool CP_Supports64048075;
int CP_HDisplay[7], CP_VDisplay[7]; /* For Custom LCD panel dimensions */
int CP_HTotal[7], CP_VTotal[7];
int CP_HSyncStart[7], CP_VSyncStart[7];
int CP_HSyncEnd[7], CP_VSyncEnd[7];
int CP_HBlankStart[7], CP_VBlankStart[7];
int CP_HBlankEnd[7], CP_VBlankEnd[7];
int CP_Clock[7];
bool CP_DataValid[7];
bool CP_HSync_P[7], CP_VSync_P[7], CP_SyncValid[7];
};
#endif

View File

@@ -1,431 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* Code taken from the Linux xgifb driver (v3.18.5) */
#include <stdlib.h>
#include <vbe.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ids.h>
#include <device/pci_ops.h>
#include <pc80/vga.h>
#include "xgi_coreboot.h"
#include "vstruct.h"
#include "XGIfb.h"
#include "XGI_main.h"
#include "vb_init.h"
#include "vb_util.h"
#include "vb_setmode.h"
#include "XGI_main.c"
static int xgi_vbe_valid;
static struct lb_framebuffer xgi_fb;
int xgifb_probe(struct pci_dev *pdev, struct xgifb_video_info *xgifb_info)
{
u8 reg, reg1;
u8 CR48, CR38;
int ret;
struct xgi_hw_device_info *hw_info;
unsigned long video_size_max;
hw_info = &xgifb_info->hw_info;
xgifb_info->chip_id = pdev->device;
pci_read_config_byte(pdev,
PCI_REVISION_ID,
&xgifb_info->revision_id);
hw_info->jChipRevision = xgifb_info->revision_id;
xgifb_info->subsysvendor = pdev->subsystem_vendor;
xgifb_info->subsysdevice = pdev->subsystem_device;
video_size_max = pci_resource_len(pdev, 0);
xgifb_info->video_base = pci_resource_start(pdev, 0);
xgifb_info->mmio_base = pci_resource_start(pdev, 1);
xgifb_info->mmio_size = pci_resource_len(pdev, 1);
xgifb_info->vga_base = pci_resource_start(pdev, 2) + 0x30;
dev_info(&pdev->dev, "Relocate IO address: %Lx [%08lx]\n",
(u64) pci_resource_start(pdev, 2),
xgifb_info->vga_base);
if (XGIfb_crt2type != -1) {
xgifb_info->display2 = XGIfb_crt2type;
xgifb_info->display2_force = true;
}
XGIRegInit(&xgifb_info->dev_info, xgifb_info->vga_base);
xgifb_reg_set(XGISR, IND_SIS_PASSWORD, SIS_PASSWORD);
reg1 = xgifb_reg_get(XGISR, IND_SIS_PASSWORD);
if (reg1 != 0xa1) {
dev_err(&pdev->dev, "I/O error\n");
ret = -5;
goto error_disable;
}
switch (xgifb_info->chip_id) {
case PCI_DEVICE_ID_XGI_20:
xgifb_reg_or(XGICR, Index_CR_GPIO_Reg3, GPIOG_EN);
CR48 = xgifb_reg_get(XGICR, Index_CR_GPIO_Reg1);
if (CR48&GPIOG_READ)
xgifb_info->chip = XG21;
else
xgifb_info->chip = XG20;
break;
case PCI_DEVICE_ID_XGI_40:
xgifb_info->chip = XG40;
break;
case PCI_DEVICE_ID_XGI_42:
xgifb_info->chip = XG42;
break;
case PCI_DEVICE_ID_XGI_27:
xgifb_info->chip = XG27;
break;
default:
ret = -19;
goto error_disable;
}
dev_info(&pdev->dev, "chipid = %x\n", xgifb_info->chip);
hw_info->jChipType = xgifb_info->chip;
if (XGIfb_get_dram_size(xgifb_info)) {
xgifb_info->video_size = min_t(unsigned long, video_size_max,
SZ_16M);
} else if (xgifb_info->video_size > video_size_max) {
xgifb_info->video_size = video_size_max;
}
if (CONFIG(LINEAR_FRAMEBUFFER)) {
/* Enable PCI_LINEAR_ADDRESSING and MMIO_ENABLE */
xgifb_reg_or(XGISR,
IND_SIS_PCI_ADDRESS_SET,
(SIS_PCI_ADDR_ENABLE | SIS_MEM_MAP_IO_ENABLE));
/* Enable 2D accelerator engine */
xgifb_reg_or(XGISR, IND_SIS_MODULE_ENABLE, SIS_ENABLE_2D);
}
hw_info->ulVideoMemorySize = xgifb_info->video_size;
xgifb_info->video_vbase = hw_info->pjVideoMemoryAddress =
(void *)(intptr_t)xgifb_info->video_base;
xgifb_info->mmio_vbase = (void *)(intptr_t)xgifb_info->mmio_base;
dev_info(&pdev->dev,
"Framebuffer at 0x%Lx, mapped to %p, size %dk\n",
(u64) xgifb_info->video_base,
xgifb_info->video_vbase,
xgifb_info->video_size / 1024);
dev_info(&pdev->dev,
"MMIO at 0x%Lx, mapped to %p, size %ldk\n",
(u64) xgifb_info->mmio_base, xgifb_info->mmio_vbase,
xgifb_info->mmio_size / 1024);
pci_set_drvdata(pdev, xgifb_info);
if (!XGIInitNew(pdev))
dev_err(&pdev->dev, "XGIInitNew() failed!\n");
xgifb_info->mtrr = -1;
xgifb_info->hasVB = HASVB_NONE;
if ((xgifb_info->chip == XG20) ||
(xgifb_info->chip == XG27)) {
xgifb_info->hasVB = HASVB_NONE;
} else if (xgifb_info->chip == XG21) {
CR38 = xgifb_reg_get(XGICR, 0x38);
if ((CR38 & 0xE0) == 0xC0)
xgifb_info->display2 = XGIFB_DISP_LCD;
else if ((CR38 & 0xE0) == 0x60)
xgifb_info->hasVB = HASVB_CHRONTEL;
else
xgifb_info->hasVB = HASVB_NONE;
} else {
XGIfb_get_VB_type(xgifb_info);
}
hw_info->ujVBChipID = VB_CHIP_UNKNOWN;
hw_info->ulExternalChip = 0;
switch (xgifb_info->hasVB) {
case HASVB_301:
reg = xgifb_reg_get(XGIPART4, 0x01);
if (reg >= 0xE0) {
hw_info->ujVBChipID = VB_CHIP_302LV;
dev_info(&pdev->dev,
"XGI302LV bridge detected (revision 0x%02x)\n",
reg);
} else if (reg >= 0xD0) {
hw_info->ujVBChipID = VB_CHIP_301LV;
dev_info(&pdev->dev,
"XGI301LV bridge detected (revision 0x%02x)\n",
reg);
} else {
hw_info->ujVBChipID = VB_CHIP_301;
dev_info(&pdev->dev, "XGI301 bridge detected\n");
}
break;
case HASVB_302:
reg = xgifb_reg_get(XGIPART4, 0x01);
if (reg >= 0xE0) {
hw_info->ujVBChipID = VB_CHIP_302LV;
dev_info(&pdev->dev,
"XGI302LV bridge detected (revision 0x%02x)\n",
reg);
} else if (reg >= 0xD0) {
hw_info->ujVBChipID = VB_CHIP_301LV;
dev_info(&pdev->dev,
"XGI302LV bridge detected (revision 0x%02x)\n",
reg);
} else if (reg >= 0xB0) {
reg1 = xgifb_reg_get(XGIPART4, 0x23);
hw_info->ujVBChipID = VB_CHIP_302B;
} else {
hw_info->ujVBChipID = VB_CHIP_302;
dev_info(&pdev->dev, "XGI302 bridge detected\n");
}
break;
case HASVB_LVDS:
hw_info->ulExternalChip = 0x1;
dev_info(&pdev->dev, "LVDS transmitter detected\n");
break;
case HASVB_TRUMPION:
hw_info->ulExternalChip = 0x2;
dev_info(&pdev->dev, "Trumpion Zurac LVDS scaler detected\n");
break;
case HASVB_CHRONTEL:
hw_info->ulExternalChip = 0x4;
dev_info(&pdev->dev, "Chrontel TV encoder detected\n");
break;
case HASVB_LVDS_CHRONTEL:
hw_info->ulExternalChip = 0x5;
dev_info(&pdev->dev,
"LVDS transmitter and Chrontel TV encoder detected\n");
break;
default:
dev_info(&pdev->dev, "No or unknown bridge type detected\n");
break;
}
if (xgifb_info->hasVB != HASVB_NONE)
XGIfb_detect_VB(xgifb_info);
else if (xgifb_info->chip != XG21)
xgifb_info->display2 = XGIFB_DISP_NONE;
if (xgifb_info->display2 == XGIFB_DISP_LCD) {
if (!enable_dstn) {
reg = xgifb_reg_get(XGICR, IND_XGI_LCD_PANEL);
reg &= 0x0f;
hw_info->ulCRT2LCDType = XGI310paneltype[reg];
}
}
xgifb_info->mode_idx = -1;
/* FIXME coreboot does not provide sscanf, needed by XGIfb_search_mode */
/* if (mode)
XGIfb_search_mode(xgifb_info, mode);
else */if (vesa != -1)
XGIfb_search_vesamode(xgifb_info, vesa);
if (xgifb_info->mode_idx >= 0)
xgifb_info->mode_idx =
XGIfb_validate_mode(xgifb_info, xgifb_info->mode_idx);
if (xgifb_info->mode_idx < 0) {
if (xgifb_info->display2 == XGIFB_DISP_LCD &&
xgifb_info->chip == XG21)
xgifb_info->mode_idx =
XGIfb_GetXG21DefaultLVDSModeIdx(xgifb_info);
else
if (CONFIG(LINEAR_FRAMEBUFFER))
xgifb_info->mode_idx = DEFAULT_MODE;
else
xgifb_info->mode_idx = DEFAULT_TEXT_MODE;
}
if (xgifb_info->mode_idx < 0) {
dev_err(&pdev->dev, "No supported video mode found\n");
ret = -22;
goto error_1;
}
/* set default refresh rate */
xgifb_info->refresh_rate = refresh_rate;
if (xgifb_info->refresh_rate == 0)
xgifb_info->refresh_rate = 60;
if (XGIfb_search_refresh_rate(xgifb_info,
xgifb_info->refresh_rate) == 0) {
xgifb_info->rate_idx = 1;
xgifb_info->refresh_rate = 60;
}
xgifb_info->video_bpp = XGIbios_mode[xgifb_info->mode_idx].bpp;
xgifb_info->video_vwidth =
xgifb_info->video_width =
XGIbios_mode[xgifb_info->mode_idx].xres;
xgifb_info->video_vheight =
xgifb_info->video_height =
XGIbios_mode[xgifb_info->mode_idx].yres;
xgifb_info->org_x = xgifb_info->org_y = 0;
xgifb_info->video_linelength =
xgifb_info->video_width *
(xgifb_info->video_bpp >> 3);
switch (xgifb_info->video_bpp) {
case 8:
xgifb_info->DstColor = 0x0000;
xgifb_info->XGI310_AccelDepth = 0x00000000;
xgifb_info->video_cmap_len = 256;
break;
case 16:
xgifb_info->DstColor = 0x8000;
xgifb_info->XGI310_AccelDepth = 0x00010000;
xgifb_info->video_cmap_len = 16;
break;
case 32:
xgifb_info->DstColor = 0xC000;
xgifb_info->XGI310_AccelDepth = 0x00020000;
xgifb_info->video_cmap_len = 16;
break;
default:
xgifb_info->video_cmap_len = 16;
pr_info("Unsupported depth %d\n",
xgifb_info->video_bpp);
break;
}
pr_info("Default mode is %dx%dx%d (%dHz)\n",
xgifb_info->video_width,
xgifb_info->video_height,
xgifb_info->video_bpp,
xgifb_info->refresh_rate);
return 0;
error_1:
error_disable:
return ret;
}
int xgifb_modeset(struct pci_dev *pdev, struct xgifb_video_info *xgifb_info)
{
struct xgi_hw_device_info *hw_info;
hw_info = &xgifb_info->hw_info;
if (CONFIG(LINEAR_FRAMEBUFFER)) {
/* Set mode */
XGIfb_pre_setmode(xgifb_info);
if (XGISetModeNew(xgifb_info, hw_info,
XGIbios_mode[xgifb_info->mode_idx].mode_no)
== 0) {
pr_err("Setting mode[0x%x] failed\n",
XGIbios_mode[xgifb_info->mode_idx].mode_no);
return -22;
}
xgifb_info->video_linelength =
xgifb_info->video_width *
(xgifb_info->video_bpp >> 3);
xgifb_reg_set(XGISR, IND_SIS_PASSWORD, SIS_PASSWORD);
xgifb_reg_set(XGICR, 0x13,
(xgifb_info->video_linelength & 0x00ff));
xgifb_reg_set(XGISR, 0x0e,
(xgifb_info->video_linelength & 0xff00) >> 8);
XGIfb_post_setmode(xgifb_info);
pr_debug("Set new mode: %dx%dx%d-%d\n",
XGIbios_mode[xgifb_info->mode_idx].xres,
XGIbios_mode[xgifb_info->mode_idx].yres,
XGIbios_mode[xgifb_info->mode_idx].bpp,
xgifb_info->refresh_rate);
/* Set LinuxBIOS framebuffer information */
xgi_vbe_valid = 1;
xgi_fb.physical_address = xgifb_info->video_base;
xgi_fb.x_resolution = xgifb_info->video_width;
xgi_fb.y_resolution = xgifb_info->video_height;
xgi_fb.bytes_per_line =
xgifb_info->video_width * xgifb_info->video_bpp;
xgi_fb.bits_per_pixel = xgifb_info->video_bpp;
xgi_fb.reserved_mask_pos = 0;
xgi_fb.reserved_mask_size = 0;
switch (xgifb_info->video_bpp) {
case 32:
case 24:
/* packed into 4-byte words */
xgi_fb.reserved_mask_pos = 24;
xgi_fb.reserved_mask_size = 8;
xgi_fb.red_mask_pos = 16;
xgi_fb.red_mask_size = 8;
xgi_fb.green_mask_pos = 8;
xgi_fb.green_mask_size = 8;
xgi_fb.blue_mask_pos = 0;
xgi_fb.blue_mask_size = 8;
break;
case 16:
/* packed into 2-byte words */
xgi_fb.red_mask_pos = 11;
xgi_fb.red_mask_size = 5;
xgi_fb.green_mask_pos = 5;
xgi_fb.green_mask_size = 6;
xgi_fb.blue_mask_pos = 0;
xgi_fb.blue_mask_size = 5;
break;
default:
printk(BIOS_SPEW, "%s: unsupported BPP %d\n", __func__,
xgifb_info->video_bpp);
xgi_vbe_valid = 0;
}
} else {
/*
* FIXME
* Text mode is slightly unstable/jittery
* (bad/incomplete DDR init?)
*/
/* Initialize standard VGA text mode */
vga_io_init();
vga_textmode_init();
printk(BIOS_INFO, "XGI VGA text mode initialized\n");
/* if we don't have console, at least print something... */
vga_line_write(0, "XGI VGA text mode initialized");
}
return 0;
}
static int vbe_mode_info_valid(void)
{
return xgi_vbe_valid;
}
int fill_lb_framebuffer(struct lb_framebuffer *framebuffer)
{
if (!vbe_mode_info_valid())
return -1;
*framebuffer = xgi_fb;
return 0;
}
struct xgifb_video_info *xgifb_video_info_ptr;
struct xgifb_video_info *pci_get_drvdata(struct pci_dev *pdev) {
return xgifb_video_info_ptr;
}
void pci_set_drvdata(struct pci_dev *pdev, struct xgifb_video_info *data) {
xgifb_video_info_ptr = data;
}

View File

@@ -1,264 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/* Portions marked below taken from XGI/SiS Linux kernel drivers */
#ifndef _XGI_COREBOOT_
#define _XGI_COREBOOT_
#include <stdlib.h>
#include <stdint.h>
#include <arch/io.h>
#include <boot/coreboot_tables.h>
#include <delay.h>
#include <device/mmio.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ops.h>
#include "initdef.h"
/* Begin code taken from Linux kernel 3.18.5 */
/* For 315/Xabre series */
#define COMMAND_QUEUE_AREA_SIZE (512 * 1024) /* 512K */
#define COMMAND_QUEUE_AREA_SIZE_Z7 (128 * 1024) /* 128k for XGI Z7 */
#define HW_CURSOR_AREA_SIZE_315 16384 /* 16K */
#define COMMAND_QUEUE_THRESHOLD 0x1F
#define SIS_OH_ALLOC_SIZE 4000
#define SENTINEL 0x7fffffff
#define SEQ_ADR 0x14
#define SEQ_DATA 0x15
#define DAC_ADR 0x18
#define DAC_DATA 0x19
#define CRTC_ADR 0x24
#define CRTC_DATA 0x25
#define DAC2_ADR (0x16-0x30)
#define DAC2_DATA (0x17-0x30)
#define VB_PART1_ADR (0x04-0x30)
#define VB_PART1_DATA (0x05-0x30)
#define VB_PART2_ADR (0x10-0x30)
#define VB_PART2_DATA (0x11-0x30)
#define VB_PART3_ADR (0x12-0x30)
#define VB_PART3_DATA (0x13-0x30)
#define VB_PART4_ADR (0x14-0x30)
#define VB_PART4_DATA (0x15-0x30)
#define SISSR ivideo->SiS_Pr.SiS_P3c4
#define SISCR ivideo->SiS_Pr.SiS_P3d4
#define SISDACA ivideo->SiS_Pr.SiS_P3c8
#define SISDACD ivideo->SiS_Pr.SiS_P3c9
#define SISPART1 ivideo->SiS_Pr.SiS_Part1Port
#define SISPART2 ivideo->SiS_Pr.SiS_Part2Port
#define SISPART3 ivideo->SiS_Pr.SiS_Part3Port
#define SISPART4 ivideo->SiS_Pr.SiS_Part4Port
#define SISPART5 ivideo->SiS_Pr.SiS_Part5Port
#define SISDAC2A SISPART5
#define SISDAC2D (SISPART5 + 1)
#define SISMISCR (ivideo->SiS_Pr.RelIO + 0x1c)
#define SISMISCW ivideo->SiS_Pr.SiS_P3c2
#define SISINPSTAT (ivideo->SiS_Pr.RelIO + 0x2a)
#define SISPEL ivideo->SiS_Pr.SiS_P3c6
#define SISVGAENABLE (ivideo->SiS_Pr.RelIO + 0x13)
#define SISVID (ivideo->SiS_Pr.RelIO + 0x02 - 0x30)
#define SISCAP (ivideo->SiS_Pr.RelIO + 0x00 - 0x30)
#define IND_SIS_PASSWORD 0x05 /* SRs */
#define IND_SIS_COLOR_MODE 0x06
#define IND_SIS_RAMDAC_CONTROL 0x07
#define IND_SIS_DRAM_SIZE 0x14
#define IND_SIS_MODULE_ENABLE 0x1E
#define IND_SIS_PCI_ADDRESS_SET 0x20
#define IND_SIS_TURBOQUEUE_ADR 0x26
#define IND_SIS_TURBOQUEUE_SET 0x27
#define IND_SIS_POWER_ON_TRAP 0x38
#define IND_SIS_POWER_ON_TRAP2 0x39
#define IND_SIS_CMDQUEUE_SET 0x26
#define IND_SIS_CMDQUEUE_THRESHOLD 0x27
#define IND_SIS_AGP_IO_PAD 0x48
#define SIS_CRT2_WENABLE_300 0x24 /* Part1 */
#define SIS_CRT2_WENABLE_315 0x2F
#define SIS_PASSWORD 0x86 /* SR05 */
#define SIS_INTERLACED_MODE 0x20 /* SR06 */
#define SIS_8BPP_COLOR_MODE 0x0
#define SIS_15BPP_COLOR_MODE 0x1
#define SIS_16BPP_COLOR_MODE 0x2
#define SIS_32BPP_COLOR_MODE 0x4
#define SIS_ENABLE_2D 0x40 /* SR1E */
#define SIS_MEM_MAP_IO_ENABLE 0x01 /* SR20 */
#define SIS_PCI_ADDR_ENABLE 0x80
#define SIS_AGP_CMDQUEUE_ENABLE 0x80 /* 315/330/340 series SR26 */
#define SIS_VRAM_CMDQUEUE_ENABLE 0x40
#define SIS_MMIO_CMD_ENABLE 0x20
#define SIS_CMD_QUEUE_SIZE_512k 0x00
#define SIS_CMD_QUEUE_SIZE_1M 0x04
#define SIS_CMD_QUEUE_SIZE_2M 0x08
#define SIS_CMD_QUEUE_SIZE_4M 0x0C
#define SIS_CMD_QUEUE_RESET 0x01
#define SIS_CMD_AUTO_CORR 0x02
#define SIS_CMD_QUEUE_SIZE_Z7_64k 0x00 /* XGI Z7 */
#define SIS_CMD_QUEUE_SIZE_Z7_128k 0x04
#define SIS_SIMULTANEOUS_VIEW_ENABLE 0x01 /* CR30 */
#define SIS_MODE_SELECT_CRT2 0x02
#define SIS_VB_OUTPUT_COMPOSITE 0x04
#define SIS_VB_OUTPUT_SVIDEO 0x08
#define SIS_VB_OUTPUT_SCART 0x10
#define SIS_VB_OUTPUT_LCD 0x20
#define SIS_VB_OUTPUT_CRT2 0x40
#define SIS_VB_OUTPUT_HIVISION 0x80
#define SIS_VB_OUTPUT_DISABLE 0x20 /* CR31 */
#define SIS_DRIVER_MODE 0x40
#define SIS_VB_COMPOSITE 0x01 /* CR32 */
#define SIS_VB_SVIDEO 0x02
#define SIS_VB_SCART 0x04
#define SIS_VB_LCD 0x08
#define SIS_VB_CRT2 0x10
#define SIS_CRT1 0x20
#define SIS_VB_HIVISION 0x40
#define SIS_VB_YPBPR 0x80
#define SIS_VB_TV (SIS_VB_COMPOSITE | SIS_VB_SVIDEO | \
SIS_VB_SCART | SIS_VB_HIVISION | SIS_VB_YPBPR)
#define SIS_EXTERNAL_CHIP_MASK 0x0E /* CR37 (< SiS 660) */
#define SIS_EXTERNAL_CHIP_SIS301 0x01 /* in CR37 << 1 ! */
#define SIS_EXTERNAL_CHIP_LVDS 0x02
#define SIS_EXTERNAL_CHIP_TRUMPION 0x03
#define SIS_EXTERNAL_CHIP_LVDS_CHRONTEL 0x04
#define SIS_EXTERNAL_CHIP_CHRONTEL 0x05
#define SIS310_EXTERNAL_CHIP_LVDS 0x02
#define SIS310_EXTERNAL_CHIP_LVDS_CHRONTEL 0x03
#define SIS_AGP_2X 0x20 /* CR48 */
/* vbflags, private entries (others in sisfb.h) */
#define VB_CONEXANT 0x00000800 /* 661 series only */
#define VB_TRUMPION VB_CONEXANT /* 300 series only */
#define VB_302ELV 0x00004000
#define VB_301 0x00100000 /* Video bridge type */
#define VB_301B 0x00200000
#define VB_302B 0x00400000
#define VB_30xBDH 0x00800000 /* 30xB DH version (w/o LCD support) */
#define VB_LVDS 0x01000000
#define VB_CHRONTEL 0x02000000
#define VB_301LV 0x04000000
#define VB_302LV 0x08000000
#define VB_301C 0x10000000
#define VB_SISBRIDGE (VB_301|VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV|VB_302ELV)
#define VB_VIDEOBRIDGE (VB_SISBRIDGE | VB_LVDS | VB_CHRONTEL | VB_CONEXANT)
enum _SIS_LCD_TYPE {
LCD_INVALID = 0,
LCD_800x600,
LCD_1024x768,
LCD_1280x1024,
LCD_1280x960,
LCD_640x480,
LCD_1600x1200,
LCD_1920x1440,
LCD_2048x1536,
LCD_320x240, /* FSTN */
LCD_1400x1050,
LCD_1152x864,
LCD_1152x768,
LCD_1280x768,
LCD_1024x600,
LCD_320x240_2, /* DSTN */
LCD_320x240_3, /* DSTN */
LCD_848x480,
LCD_1280x800,
LCD_1680x1050,
LCD_1280x720,
LCD_1280x854,
LCD_CUSTOM,
LCD_UNKNOWN
};
/* End code taken from Linux kernel 3.18.5 */
#define DEFAULT_TEXT_MODE 16 /* index for 800x600x8 */
/* coreboot <--> kernel code interface */
#define __iomem
#define SISIOMEMTYPE
typedef unsigned long SISIOADDRESS;
typedef u64 phys_addr_t;
#define pci_dev device
#define SZ_16M 0x01000000
#define min_t(type, x, y) ({ \
type __min1 = (x); \
type __min2 = (y); \
__min1 < __min2 ? __min1 : __min2; })
#define dev_info(dev, format, arg...) printk(BIOS_INFO, "XGI VGA: " format, ##arg)
#define dev_dbg(dev, format, arg...) printk(BIOS_DEBUG, "XGI VGA: " format, ##arg)
#define dev_err(dev, format, arg...) printk(BIOS_ERR, "XGI VGA: " format, ##arg)
#define pr_info(format, arg...) printk(BIOS_INFO, "XGI VGA: " format, ##arg)
#define pr_debug(format, arg...) printk(BIOS_INFO, "XGI VGA: " format, ##arg)
#define pr_err(format, arg...) printk(BIOS_ERR, "XGI VGA: " format, ##arg)
static inline int pci_read_config_dword(struct pci_dev *dev, int where,
u32 *val)
{
*val = pci_read_config32(dev, where);
return 0;
}
static inline int pci_read_config_byte(struct pci_dev *dev, int where,
u8 *val)
{
*val = pci_read_config8(dev, where);
return 0;
}
static inline struct resource* resource_at_bar(struct pci_dev *dev, u8 bar) {
struct resource *res = dev->resource_list;
int i;
for (i = 0; i < bar; i++) {
res = res->next;
if (res == NULL)
return NULL;
}
return res;
}
static inline resource_t pci_resource_len(struct pci_dev *dev, u8 bar) {
struct resource *res = resource_at_bar(dev, bar);
if (res)
return res->size;
else
return 0;
}
static inline resource_t pci_resource_start(struct pci_dev *dev, u8 bar) {
struct resource *res = resource_at_bar(dev, bar);
if (res)
return res->base;
else
return 0;
}
struct xgifb_video_info *pci_get_drvdata(struct pci_dev *pdev);
void pci_set_drvdata(struct pci_dev *pdev, struct xgifb_video_info *data);
int xgifb_probe(struct pci_dev *pdev, struct xgifb_video_info *xgifb_info);
int xgifb_modeset(struct pci_dev *pdev, struct xgifb_video_info *xgifb_info);
#endif

View File

@@ -1,3 +0,0 @@
config DRIVERS_XGI_Z9S
bool
select DRIVERS_XGI_Z79_COMMON

View File

@@ -1 +0,0 @@
ramstage-$(CONFIG_DRIVERS_XGI_Z9S) += z9s.c

View File

@@ -1,48 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <stdlib.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ids.h>
#include <device/pci_ops.h>
#include "../common/xgi_coreboot.h"
#include "../common/XGIfb.h"
static void xgi_z9s_set_resources(struct device *dev)
{
/* Reserve VGA regions */
mmio_resource(dev, 3, 0xa0000 >> 10, 0x1ffff >> 10);
/* Run standard resource set routine */
pci_dev_set_resources(dev);
}
static void xgi_z9s_init(struct device *dev)
{
u8 ret;
struct xgifb_video_info *xgifb_info;
if (CONFIG(MAINBOARD_DO_NATIVE_VGA_INIT)) {
printk(BIOS_INFO, "XGI Z9s: initializing video device\n");
xgifb_info = malloc(sizeof(*xgifb_info));
ret = xgifb_probe(dev, xgifb_info);
if (!ret)
xgifb_modeset(dev, xgifb_info);
free(xgifb_info);
}
}
static struct device_operations xgi_z9s_ops = {
.read_resources = pci_dev_read_resources,
.set_resources = xgi_z9s_set_resources,
.enable_resources = pci_dev_enable_resources,
.init = xgi_z9s_init,
};
static const struct pci_driver xgi_z9s_driver __pci_driver = {
.ops = &xgi_z9s_ops,
.vendor = PCI_VENDOR_ID_XGI,
.device = PCI_DEVICE_ID_XGI_20,
};