Commit b41edc0a authored by Thomas Winischhofer's avatar Thomas Winischhofer

SiS driver: Renamed options "XvBenchmarkMemcpy" to "BenchmarkMemcpy" and

    "XvSSECopy" to "UseSSE". Fix crash on machines with two or more
    physical SiS cards. Enhanced logic to overrule monitor timings. Make
    driver independent of vgaHW module. Use /dev/port instead of inX/outX
    on ARM and MIPS (untested yet). Fix SiS301 panel misdetection (due to
    very old, buggy BIOS). Clean up.
parent 08079cea
This diff is collapsed.
......@@ -145,36 +145,36 @@ static const SiS_ExtStruct SiS310_EModeIDTable[]=
{0x29,0x4e1b,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x43,-1}, /* 1152x864 */
{0x2a,0x4e3d,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x43,-1},
{0x2b,0x4e7f,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x43,-1},
{0x39,0x6a1b,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x45,-1}, /* 848x480 */
{0x3b,0x6a3d,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x45,-1},
{0x3e,0x6a7f,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x45,-1},
{0x3f,0x6a1b,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x47,-1}, /* 856x480 */
{0x42,0x6a3d,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x47,-1},
{0x45,0x6a7f,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x47,-1},
{0x48,0x6a3b,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x49,-1}, /* 1360x768 */
{0x4b,0x6a7d,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x49,-1},
{0x4e,0x6aff,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x49,-1},
{0x39,0x6a1b,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x46,-1}, /* 848x480 */
{0x3b,0x6a3d,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x46,-1},
{0x3e,0x6a7f,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x46,-1},
{0x3f,0x6a1b,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x48,-1}, /* 856x480 */
{0x42,0x6a3d,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x48,-1},
{0x45,0x6a7f,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x48,-1},
{0x48,0x6a3b,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x4a,-1}, /* 1360x768 */
{0x4b,0x6a7d,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x4a,-1},
{0x4e,0x6aff,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x4a,-1},
{0x4f,0x9a1f,0x0000,SIS_RI_320x200, 0x00,0x00,0x04,0x04,0x25, 0}, /* 320x200x32 */
{0x53,0x9a1f,0x0000,SIS_RI_320x240, 0x00,0x00,0x04,0x04,0x26, 2}, /* 320x240x32 */
{0x54,0xba1f,0x0000,SIS_RI_400x300, 0x00,0x00,0x07,0x07,0x27, 3}, /* 400x300x32 */
{0x5f,0x6a1b,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4a,-1}, /* 768x576 */
{0x60,0x6a1d,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4a,-1},
{0x61,0x6a3f,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4a,-1},
{0x14,0x0e3b,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4b, 7}, /* 1280x800 */
{0x15,0x0e7d,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4b, 7},
{0x16,0x0eff,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4b, 7},
{0x17,0x0e3b,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x4c, 9}, /* 1680x1050 */
{0x18,0x0e7d,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x4c, 9},
{0x19,0x0eff,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x4c, 9},
{0x2c,0x267b,0x0000,SIS_RI_1920x1080,0x00,0x00,0x00,0x00,0x4d,-1}, /* 1920x1080(i) */
{0x2d,0x26fd,0x0000,SIS_RI_1920x1080,0x00,0x00,0x00,0x00,0x4d,-1},
{0x73,0x27ff,0x0000,SIS_RI_1920x1080,0x00,0x00,0x00,0x00,0x4d,-1},
{0x1d,0x6a1b,0x0000,SIS_RI_960x540, 0x00,0x00,0x00,0x00,0x4e,-1}, /* 960x540 */
{0x1e,0x6a3d,0x0000,SIS_RI_960x540, 0x00,0x00,0x00,0x00,0x4e,-1},
{0x1f,0x6a7f,0x0000,SIS_RI_960x540, 0x00,0x00,0x00,0x00,0x4e,-1},
{0x20,0x6a1b,0x0000,SIS_RI_960x600, 0x00,0x00,0x00,0x00,0x4f,-1}, /* 960x600 */
{0x21,0x6a3d,0x0000,SIS_RI_960x600, 0x00,0x00,0x00,0x00,0x4f,-1},
{0x22,0x6a7f,0x0000,SIS_RI_960x600, 0x00,0x00,0x00,0x00,0x4f,-1},
{0x5f,0x6a1b,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4b,-1}, /* 768x576 */
{0x60,0x6a1d,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4b,-1},
{0x61,0x6a3f,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4b,-1},
{0x14,0x0e3b,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4c, 7}, /* 1280x800 */
{0x15,0x0e7d,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4c, 7},
{0x16,0x0eff,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4c, 7},
{0x17,0x0e3b,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x4d, 9}, /* 1680x1050 */
{0x18,0x0e7d,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x4d, 9},
{0x19,0x0eff,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x4d, 9},
{0x2c,0x267b,0x0000,SIS_RI_1920x1080,0x00,0x00,0x00,0x00,0x4e,-1}, /* 1920x1080(i) */
{0x2d,0x26fd,0x0000,SIS_RI_1920x1080,0x00,0x00,0x00,0x00,0x4e,-1},
{0x73,0x27ff,0x0000,SIS_RI_1920x1080,0x00,0x00,0x00,0x00,0x4e,-1},
{0x1d,0x6a1b,0x0000,SIS_RI_960x540, 0x00,0x00,0x00,0x00,0x4f,-1}, /* 960x540 */
{0x1e,0x6a3d,0x0000,SIS_RI_960x540, 0x00,0x00,0x00,0x00,0x4f,-1},
{0x1f,0x6a7f,0x0000,SIS_RI_960x540, 0x00,0x00,0x00,0x00,0x4f,-1},
{0x20,0x6a1b,0x0000,SIS_RI_960x600, 0x00,0x00,0x00,0x00,0x50,-1}, /* 960x600 */
{0x21,0x6a3d,0x0000,SIS_RI_960x600, 0x00,0x00,0x00,0x00,0x50,-1},
{0x22,0x6a7f,0x0000,SIS_RI_960x600, 0x00,0x00,0x00,0x00,0x50,-1},
{0xff,0x0000,0x0000,0, 0x00,0x00,0x00,0x00,0x00,-1}
};
......@@ -247,19 +247,20 @@ static const SiS_Ext2Struct SiS310_RefIndex[]=
{0x0077,0x42,0x5b,0x08,0x11,0x23,1280, 768, 0x30}, /* 0x40 */ /* 0x5b was 0x12 */
{0x0127,0x43,0x4d,0x08,0x0b,0x26,1400,1050, 0x30}, /* 0x41 */
{0x0207,0x4b,0x5a,0x08,0x0b,0x26,1400,1050, 0x30}, /* 0x42 1400x1050-75Hz */
{0x0127,0x44,0x19,0x00,0x1a,0x29,1152, 864, 0x30}, /* 0x43 1152x864-75Hz */
{0x0127,0x4a,0x1e,0x00,0x1a,0x29,1152, 864, 0x30}, /* 0x44 1152x864-85Hz */
{0x0087,0x45,0x57,0x00,0x16,0x39, 848, 480, 0x30}, /* 0x45 848x480-38Hzi */
{0xc067,0x46,0x55,0x0b,0x16,0x39, 848, 480, 0x30}, /* 0x46 848x480-60Hz */
{0x0087,0x47,0x57,0x00,0x17,0x3f, 856, 480, 0x30}, /* 0x47 856x480-38Hzi */
{0xc067,0x48,0x57,0x00,0x17,0x3f, 856, 480, 0x30}, /* 0x48 856x480-60Hz */
{0x0067,0x49,0x58,0x0c,0x1b,0x48,1360, 768, 0x30}, /* 0x49 1360x768-60Hz */
{0x006f,0x4d,0x03,0x06,0x15,0x5f, 768, 576, 0x30}, /* 0x4a 768x576-56Hz */
{0x0067,0x4f,0x5c,0x08,0x0d,0x14,1280, 800, 0x30}, /* 0x4b 1280x800-60Hz */
{0x0067,0x50,0x5d,0x0c,0x0e,0x17,1680,1050, 0x30}, /* 0x4c 1680x1050-60Hz */
{0x0087,0x51,0x69,0x00,0x00,0x2c,1920,1080, 0x30}, /* 0x4d 1920x1080 60Hzi */
{0x0067,0x52,0x6a,0x00,0x1c,0x1d, 960, 540, 0x30}, /* 0x4e 960x540 60Hz */
{0x0077,0x53,0x6b,0x0b,0x1d,0x20, 960, 600, 0x30}, /* 0x4f 960x600 60Hz */
{0x0127,0x54,0x6d,0x00,0x1a,0x29,1152, 864, 0x30}, /* 0x43 1152x864-60Hz */
{0x0127,0x44,0x19,0x00,0x1a,0x29,1152, 864, 0x30}, /* 0x44 1152x864-75Hz */
{0x0127,0x4a,0x1e,0x00,0x1a,0x29,1152, 864, 0x30}, /* 0x45 1152x864-85Hz */
{0x0087,0x45,0x57,0x00,0x16,0x39, 848, 480, 0x30}, /* 0x46 848x480-38Hzi */
{0xc067,0x46,0x55,0x0b,0x16,0x39, 848, 480, 0x30}, /* 0x47 848x480-60Hz */
{0x0087,0x47,0x57,0x00,0x17,0x3f, 856, 480, 0x30}, /* 0x48 856x480-38Hzi */
{0xc067,0x48,0x57,0x00,0x17,0x3f, 856, 480, 0x30}, /* 0x49 856x480-60Hz */
{0x0067,0x49,0x58,0x0c,0x1b,0x48,1360, 768, 0x30}, /* 0x4a 1360x768-60Hz */
{0x006f,0x4d,0x03,0x06,0x15,0x5f, 768, 576, 0x30}, /* 0x4b 768x576-56Hz */
{0x0067,0x4f,0x5c,0x08,0x0d,0x14,1280, 800, 0x30}, /* 0x4c 1280x800-60Hz */
{0x0067,0x50,0x5d,0x0c,0x0e,0x17,1680,1050, 0x30}, /* 0x4d 1680x1050-60Hz */
{0x0087,0x51,0x69,0x00,0x00,0x2c,1920,1080, 0x30}, /* 0x4e 1920x1080 60Hzi */
{0x0067,0x52,0x6a,0x00,0x1c,0x1d, 960, 540, 0x30}, /* 0x4f 960x540 60Hz */
{0x0077,0x53,0x6b,0x0b,0x1d,0x20, 960, 600, 0x30}, /* 0x50 960x600 60Hz */
{0xffff,0x00,0x00,0x00,0x00,0x00, 0, 0, 0}
};
......@@ -597,7 +598,10 @@ static const SiS_CRT1TableStruct SiS310_CRT1Table[]=
0x41}}, /* 0x52 */
{{0x87,0x77,0x77,0x8b,0x81,0x0b,0x68,0xf0, /* 960x600-60 */
0x5a,0x80,0x57,0x57,0x69,0x00,0x00,0x02,
0x01}} /* 0x53 */
0x01}}, /* 0x53 */
{{0xcd,0x8f,0x8f,0x91,0x9b,0x1b,0x7a,0xff, /* 1152x864-60 */
0x64,0x8c,0x5f,0x62,0x7b,0x10,0x00,0x07,
0x41}} /* 0x54 */
};
static const SiS_MCLKDataStruct SiS310_MCLKData_0_315[] =
......@@ -818,7 +822,8 @@ static SiS_VCLKDataStruct SiS310_VCLKData[]=
{ 0x52,0x27, 75}, /* 0x69 1920x1080i 60Hz interlaced */
{ 0x7c,0x6b, 38}, /* 0x6a 960x540@60 */
{ 0xe3,0x56, 41}, /* 0x6b 960x600@60 */
{ 0x45,0x25, 83} /* 0x6c 1280x800 */
{ 0x45,0x25, 83}, /* 0x6c 1280x800 */
{ 0x70,0x28, 90} /* 0x6d 1152x864@60 */
};
static SiS_VBVCLKDataStruct SiS310_VBVCLKData[]=
......@@ -937,7 +942,8 @@ static SiS_VBVCLKDataStruct SiS310_VBVCLKData[]=
{ 0x52,0x27, 75}, /* 0x69 1920x1080i 60Hz interlaced (UNUSED) */
{ 0x7c,0x6b, 38}, /* 0x6a 960x540@60 */
{ 0xe3,0x56, 41}, /* 0x6b 960x600@60 */
{ 0x9c,0x62, 69} /* 0x6c 1280x800 (SiS TMDS) (special) */
{ 0x9c,0x62, 69}, /* 0x6c 1280x800 (SiS TMDS) (special) */
{ 0x70,0x28, 90} /* 0x6d 1152x864@60 */
};
static const DRAM4Type SiS310_SR15[8] = {
......@@ -951,7 +957,7 @@ static const DRAM4Type SiS310_SR15[8] = {
{0x00,0xa5,0xfb,0xf6}
};
#ifndef LINUX_XF86
#ifdef LINUX_KERNEL
static UCHAR SiS310_SR07 = 0x18;
......
......@@ -217,34 +217,6 @@ InitTo300Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
InitCommonPointer(SiS_Pr, HwInfo);
SiS_StandTable[0x04].CRTC[4] = 0x2b;
SiS_StandTable[0x05].CRTC[4] = 0x2b;
SiS_StandTable[0x06].CRTC[4] = 0x54;
SiS_StandTable[0x06].CRTC[5] = 0x80;
SiS_StandTable[0x0d].CRTC[4] = 0x2b;
SiS_StandTable[0x0e].CRTC[4] = 0x54;
SiS_StandTable[0x0e].CRTC[5] = 0x80;
SiS_StandTable[0x11].CRTC[4] = 0x54;
SiS_StandTable[0x11].CRTC[5] = 0x80;
SiS_StandTable[0x11].CRTC[16] = 0x83;
SiS_StandTable[0x11].CRTC[17] = 0x85;
SiS_StandTable[0x12].CRTC[4] = 0x54;
SiS_StandTable[0x12].CRTC[5] = 0x80;
SiS_StandTable[0x12].CRTC[16] = 0x83;
SiS_StandTable[0x12].CRTC[17] = 0x85;
SiS_StandTable[0x13].CRTC[5] = 0xa0;
SiS_StandTable[0x17].CRTC[5] = 0xa0;
SiS_StandTable[0x1a].CRTC[4] = 0x54;
SiS_StandTable[0x1a].CRTC[5] = 0x80;
SiS_StandTable[0x1a].CRTC[16] = 0xea;
SiS_StandTable[0x1a].CRTC[17] = 0x8c;
SiS_StandTable[0x1b].CRTC[4] = 0x54;
SiS_StandTable[0x1b].CRTC[5] = 0x80;
SiS_StandTable[0x1b].CRTC[16] = 0xea;
SiS_StandTable[0x1b].CRTC[17] = 0x8c;
SiS_StandTable[0x1c].CRTC[4] = 0x54;
SiS_StandTable[0x1c].CRTC[5] = 0x80;
SiS_Pr->SiS_SModeIDTable = SiS300_SModeIDTable;
SiS_Pr->SiS_VBModeIDTable = SiS300_VBModeIDTable;
SiS_Pr->SiS_EModeIDTable = SiS300_EModeIDTable;
......@@ -260,7 +232,7 @@ InitTo300Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_Pr->SiS_SR15 = SiS300_SR15;
#ifndef LINUX_XF86
#ifdef LINUX_KERNEL
SiS_Pr->pSiS_SR07 = &SiS300_SR07;
SiS_Pr->SiS_CR40 = SiS300_CR40;
SiS_Pr->SiS_CR49 = SiS300_CR49;
......@@ -399,34 +371,6 @@ InitTo310Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
InitCommonPointer(SiS_Pr, HwInfo);
SiS_StandTable[0x04].CRTC[4] = 0x2c;
SiS_StandTable[0x05].CRTC[4] = 0x2c;
SiS_StandTable[0x06].CRTC[4] = 0x55;
SiS_StandTable[0x06].CRTC[5] = 0x81;
SiS_StandTable[0x0d].CRTC[4] = 0x2c;
SiS_StandTable[0x0e].CRTC[4] = 0x55;
SiS_StandTable[0x0e].CRTC[5] = 0x81;
SiS_StandTable[0x11].CRTC[4] = 0x55;
SiS_StandTable[0x11].CRTC[5] = 0x81;
SiS_StandTable[0x11].CRTC[16] = 0x82;
SiS_StandTable[0x11].CRTC[17] = 0x84;
SiS_StandTable[0x12].CRTC[4] = 0x55;
SiS_StandTable[0x12].CRTC[5] = 0x81;
SiS_StandTable[0x12].CRTC[16] = 0x82;
SiS_StandTable[0x12].CRTC[17] = 0x84;
SiS_StandTable[0x13].CRTC[5] = 0xb1;
SiS_StandTable[0x17].CRTC[5] = 0xb1;
SiS_StandTable[0x1a].CRTC[4] = 0x55;
SiS_StandTable[0x1a].CRTC[5] = 0x81;
SiS_StandTable[0x1a].CRTC[16] = 0xe9;
SiS_StandTable[0x1a].CRTC[17] = 0x8b;
SiS_StandTable[0x1b].CRTC[4] = 0x55;
SiS_StandTable[0x1b].CRTC[5] = 0x81;
SiS_StandTable[0x1b].CRTC[16] = 0xe9;
SiS_StandTable[0x1b].CRTC[17] = 0x8b;
SiS_StandTable[0x1c].CRTC[4] = 0x55;
SiS_StandTable[0x1c].CRTC[5] = 0x81;
SiS_Pr->SiS_SModeIDTable = SiS310_SModeIDTable;
SiS_Pr->SiS_EModeIDTable = SiS310_EModeIDTable;
SiS_Pr->SiS_RefIndex = (SiS_Ext2Struct *)SiS310_RefIndex;
......@@ -456,7 +400,7 @@ InitTo310Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_Pr->SiS_SR15 = SiS310_SR15;
#ifndef LINUX_XF86
#ifdef LINUX_KERNEL
SiS_Pr->pSiS_SR07 = &SiS310_SR07;
SiS_Pr->SiS_CR40 = SiS310_CR40;
SiS_Pr->SiS_CR49 = SiS310_CR49;
......@@ -622,6 +566,7 @@ SiSInitPtr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
/* HELPER: Get ModeID */
/*********************************************/
#ifdef LINUX_XF86
USHORT
SiS_GetModeID(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay,
int Depth, BOOLEAN FSTN, int LCDwidth, int LCDheight)
......@@ -752,6 +697,7 @@ SiS_GetModeID(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay,
return(ModeIndex);
}
#endif
USHORT
SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay,
......@@ -1738,7 +1684,7 @@ SiS_GetVBType(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
/* HELPER: Check RAM size */
/*********************************************/
#ifndef LINUX_XF86
#ifdef LINUX_KERNEL
static BOOLEAN
SiS_CheckMemorySize(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
USHORT ModeNo, USHORT ModeIdIndex)
......@@ -1809,10 +1755,10 @@ SiS_Get310DRAMType(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
return data;
}
USHORT
static USHORT
SiS_GetMCLK(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
USHORT index;
index = SiS_Get310DRAMType(SiS_Pr, HwInfo);
......@@ -1834,26 +1780,26 @@ SiS_GetMCLK(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
/* HELPER: ClearBuffer */
/*********************************************/
#ifndef LINUX_XF86
#ifdef LINUX_KERNEL
static void
SiS_ClearBuffer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
{
UCHAR *VideoMemoryAddress = HwInfo->pjVideoMemoryAddress;
ULONG AdapterMemorySize = (ULONG)HwInfo->ulVideoMemorySize;
USHORT *pBuffer;
UCHAR SISIOMEMTYPE *VideoMemoryAddress = HwInfo->pjVideoMemoryAddress;
ULONG AdapterMemorySize = HwInfo->ulVideoMemorySize;
USHORT SISIOMEMTYPE *pBuffer;
int i;
if(SiS_Pr->SiS_ModeType >= ModeEGA) {
if(ModeNo > 0x13) {
SiS_SetMemory(VideoMemoryAddress, AdapterMemorySize, 0);
} else {
pBuffer = (USHORT *)VideoMemoryAddress;
for(i=0; i<0x4000; i++) pBuffer[i] = 0x0000;
pBuffer = (USHORT SISIOMEMTYPE *)VideoMemoryAddress;
for(i=0; i<0x4000; i++) writew(0x0000, &pBuffer[i]);
}
} else {
if(SiS_Pr->SiS_ModeType < ModeCGA) {
pBuffer = (USHORT *)VideoMemoryAddress;
for(i=0; i<0x4000; i++) pBuffer[i] = 0x0720;
pBuffer = (USHORT SISIOMEMTYPE *)VideoMemoryAddress;
for(i=0; i<0x4000; i++) writew(0x0720, &pBuffer[i]);
} else {
SiS_SetMemory(VideoMemoryAddress, 0x8000, 0);
}
......@@ -2775,7 +2721,7 @@ SiS_SetCRT1FIFO_630(SiS_Private *SiS_Pr, USHORT ModeNo,
data2 = (data2 & 0xC0) >> 5;
data2 <<= 8;
#ifndef LINUX_XF86
#ifdef LINUX_KERNEL
SiS_SetRegLong(0xcf8,0x80000050);
eax = SiS_GetRegLong(0xcfc);
eax &= 0xfffff9ff;
......@@ -2797,7 +2743,7 @@ SiS_SetCRT1FIFO_630(SiS_Private *SiS_Pr, USHORT ModeNo,
data2 = (data2 & 0x0f00) | ((data2 & 0x3000) >> 8);
data2 <<= 20;
#ifndef LINUX_XF86
#ifdef LINUX_KERNEL
SiS_SetRegLong(0xcf8,0x800000A0);
eax = SiS_GetRegLong(0xcfc);
eax &= 0x00ffffff;
......@@ -2816,7 +2762,7 @@ SiS_SetCRT1FIFO_630(SiS_Private *SiS_Pr, USHORT ModeNo,
data2 = (data2 & 0xf0) >> 4;
data2 <<= 24;
#ifndef LINUX_XF86
#ifdef LINUX_KERNEL
SiS_SetRegLong(0xcf8,0x80000050);
eax = SiS_GetRegLong(0xcfc);
eax &= 0xf0ffffff;
......@@ -2834,7 +2780,7 @@ SiS_SetCRT1FIFO_630(SiS_Private *SiS_Pr, USHORT ModeNo,
data2 &= 0x0f;
data2 <<= 24;
#ifndef LINUX_XF86
#ifdef LINUX_KERNEL
SiS_SetRegLong(0xcf8,0x800000A0);
eax = SiS_GetRegLong(0xcfc);
eax &= 0xf0ffffff;
......@@ -3368,7 +3314,7 @@ SiS_SetCRT1Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
SiS_LoadDAC(SiS_Pr, HwInfo, ModeNo, ModeIdIndex);
#ifndef LINUX_XF86
#ifdef LINUX_KERNEL
if(SiS_Pr->SiS_flag_clearbuffer) {
SiS_ClearBuffer(SiS_Pr,HwInfo,ModeNo);
}
......@@ -3493,7 +3439,7 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo)
USHORT ModeIdIndex;
SISIOADDRESS BaseAddr = HwInfo->ulIOAddress;
unsigned char backupreg=0;
#ifndef LINUX_XF86
#ifdef LINUX_KERNEL
USHORT KeepLockReg;
ULONG temp;
......@@ -3522,13 +3468,13 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo)
SiS_Pr->SiS_flag_clearbuffer = 0;
if(!SiS_Pr->UseCustomMode) {
#ifndef LINUX_XF86
#ifdef LINUX_KERNEL
if(!(ModeNo & 0x80)) SiS_Pr->SiS_flag_clearbuffer = 1;
#endif
ModeNo &= 0x7f;
}
#ifndef LINUX_XF86
#ifdef LINUX_KERNEL
KeepLockReg = SiS_GetReg(SiS_Pr->SiS_P3c4,0x05);
#endif
SiS_SetReg(SiS_Pr->SiS_P3c4,0x05,0x86);
......@@ -3563,7 +3509,7 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo)
SiS_GetLCDResInfo(SiS_Pr, ModeNo, ModeIdIndex, HwInfo);
SiS_SetLowModeTest(SiS_Pr, ModeNo, HwInfo);
#ifndef LINUX_XF86
#ifdef LINUX_KERNEL
/* 3. Check memory size (Kernel framebuffer driver only) */
temp = SiS_CheckMemorySize(SiS_Pr, HwInfo, ModeNo, ModeIdIndex);
if(!temp) return(0);
......@@ -3652,7 +3598,7 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo)
}
#endif
#ifndef LINUX_XF86 /* We never lock registers in XF86 */
#ifdef LINUX_KERNEL /* We never lock registers in XF86 */
if(KeepLockReg == 0xA1) SiS_SetReg(SiS_Pr->SiS_P3c4,0x05,0x86);
else SiS_SetReg(SiS_Pr->SiS_P3c4,0x05,0x00);
#endif
......
This diff is collapsed.
This diff is collapsed.
......@@ -54,20 +54,16 @@
#define _INIT301_
#include "osdef.h"
#include "initdef.h"
#include "vgatypes.h"
#include "vstruct.h"
#ifdef LINUX_XF86
#include "xf86.h"
#include "xf86Pci.h"
#include "xf86PciInfo.h"
#include "sis.h"
#include "sis_regs.h"
#endif
#ifdef LINUX_KERNEL
#include "vgatypes.h"
#include "vstruct.h"
#ifdef SIS_CP
#undef SIS_CP
#endif
......@@ -82,7 +78,7 @@
#endif
#endif
const UCHAR SiS_YPbPrTable[3][64] = {
static const UCHAR SiS_YPbPrTable[3][64] = {
{
0x17,0x1d,0x03,0x09,0x05,0x06,0x0c,0x0c,
0x94,0x49,0x01,0x0a,0x06,0x0d,0x04,0x0a,
......@@ -127,7 +123,7 @@ const UCHAR SiS_YPbPrTable[3][64] = {
}
};
const UCHAR SiS_HiTVGroup3_1[] = {
static const UCHAR SiS_HiTVGroup3_1[] = {
0x00, 0x14, 0x15, 0x25, 0x55, 0x15, 0x0b, 0x13,
0xb1, 0x41, 0x62, 0x62, 0xff, 0xf4, 0x45, 0xa6,
0x25, 0x2f, 0x67, 0xf6, 0xbf, 0xff, 0x8e, 0x20,
......@@ -138,7 +134,7 @@ const UCHAR SiS_HiTVGroup3_1[] = {
0x1a, 0x1f, 0x25, 0x2a, 0x4c, 0xaa, 0x01
};
const UCHAR SiS_HiTVGroup3_2[] = {
static const UCHAR SiS_HiTVGroup3_2[] = {
0x00, 0x14, 0x15, 0x25, 0x55, 0x15, 0x0b, 0x7a,
0x54, 0x41, 0xe7, 0xe7, 0xff, 0xf4, 0x45, 0xa6,
0x25, 0x2f, 0x67, 0xf6, 0xbf, 0xff, 0x8e, 0x20,
......@@ -305,8 +301,8 @@ BOOLEAN SiS_IsDualEdge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo);
BOOLEAN SiS_IsVAMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo);
void SiS_SetChrontelGPIO(SiS_Private *SiS_Pr, USHORT myvbinfo);
void SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo,
USHORT ModeIdIndex,PSIS_HW_INFO HwInfo,
int checkcrt2mode);
USHORT ModeIdIndex, PSIS_HW_INFO HwInfo,
int checkcrt2mode);
void SiS_SetYPbPr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo);
void SiS_SetTVMode(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, PSIS_HW_INFO HwInfo);
void SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, PSIS_HW_INFO HwInfo);
......@@ -327,58 +323,61 @@ void SiS_SetCH70xx(SiS_Private *SiS_Pr, USHORT tempax);
USHORT SiS_GetCH70xx(SiS_Private *SiS_Pr, USHORT tempax);
void SiS_SetCH70xxANDOR(SiS_Private *SiS_Pr, USHORT tempax,USHORT tempbh);
#ifdef SIS315H
void SiS_Chrontel701xOn(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo);
void SiS_Chrontel701xOff(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo);
void SiS_ChrontelInitTVVSync(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo);
void SiS_ChrontelDoSomething1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo);
static void SiS_Chrontel701xOn(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo);
static void SiS_Chrontel701xOff(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo);
static void SiS_ChrontelInitTVVSync(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo);
static void SiS_ChrontelDoSomething1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo);
void SiS_Chrontel701xBLOn(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo);
void SiS_Chrontel701xBLOff(SiS_Private *SiS_Pr);
#endif /* 315 */
#ifdef SIS300
void SiS_SetTrumpReg(SiS_Private *SiS_Pr, USHORT tempbx);
USHORT SiS_GetTrumpReg(SiS_Private *SiS_Pr, USHORT tempbx);
static BOOLEAN SiS_SetTrumpionBlock(SiS_Private *SiS_Pr, UCHAR *dataptr);
#if 0
static void SiS_SetTrumpReg(SiS_Private *SiS_Pr, USHORT tempbx);
static USHORT SiS_GetTrumpReg(SiS_Private *SiS_Pr, USHORT tempbx);
#endif
static BOOLEAN SiS_SetTrumpionBlock(SiS_Private *SiS_Pr, UCHAR *dataptr);
#endif
USHORT SiS_ReadDDC1Bit(SiS_Private *SiS_Pr);
void SiS_SetSwitchDDC2(SiS_Private *SiS_Pr);
USHORT SiS_SetStart(SiS_Private *SiS_Pr);
USHORT SiS_SetStop(SiS_Private *SiS_Pr);
void SiS_DDC2Delay(SiS_Private *SiS_Pr, USHORT delaytime);
USHORT SiS_SetSCLKLow(SiS_Private *SiS_Pr);
USHORT SiS_SetSCLKHigh(SiS_Private *SiS_Pr);
USHORT SiS_ReadDDC2Data(SiS_Private *SiS_Pr, USHORT tempax);
USHORT SiS_WriteDDC2Data(SiS_Private *SiS_Pr, USHORT tempax);
USHORT SiS_CheckACK(SiS_Private *SiS_Pr);
USHORT SiS_InitDDCRegs(SiS_Private *SiS_Pr, unsigned long VBFlags, int VGAEngine,
USHORT adaptnum, USHORT DDCdatatype, BOOLEAN checkcr32);
USHORT SiS_WriteDABDDC(SiS_Private *SiS_Pr);
USHORT SiS_PrepareReadDDC(SiS_Private *SiS_Pr);
USHORT SiS_PrepareDDC(SiS_Private *SiS_Pr);
void SiS_SendACK(SiS_Private *SiS_Pr, USHORT yesno);
USHORT SiS_DoProbeDDC(SiS_Private *SiS_Pr);
USHORT SiS_ProbeDDC(SiS_Private *SiS_Pr);
USHORT SiS_ReadDDC(SiS_Private *SiS_Pr, USHORT DDCdatatype, unsigned char *buffer);
USHORT SiS_HandleDDC(SiS_Private *SiS_Pr, unsigned long VBFlags, int VGAEngine,
USHORT adaptnum, USHORT DDCdatatype, unsigned char *buffer);
USHORT SiS_ReadDDC1Bit(SiS_Private *SiS_Pr);
USHORT SiS_HandleDDC(SiS_Private *SiS_Pr, ULONG VBFlags, int VGAEngine,
USHORT adaptnum, USHORT DDCdatatype, UCHAR *buffer);
#ifdef LINUX_XF86
USHORT SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS);
USHORT SiS_SenseVGA2DDC(SiS_Private *SiS_Pr, SISPtr pSiS);
#endif
static void SiS_SetSwitchDDC2(SiS_Private *SiS_Pr);
static USHORT SiS_SetStart(SiS_Private *SiS_Pr);
static USHORT SiS_SetStop(SiS_Private *SiS_Pr);
static USHORT SiS_SetSCLKLow(SiS_Private *SiS_Pr);
static USHORT SiS_SetSCLKHigh(SiS_Private *SiS_Pr);
static USHORT SiS_ReadDDC2Data(SiS_Private *SiS_Pr, USHORT tempax);
static USHORT SiS_WriteDDC2Data(SiS_Private *SiS_Pr, USHORT tempax);
static USHORT SiS_CheckACK(SiS_Private *SiS_Pr);
static USHORT SiS_InitDDCRegs(SiS_Private *SiS_Pr, ULONG VBFlags, int VGAEngine,
USHORT adaptnum, USHORT DDCdatatype, BOOLEAN checkcr32);
static USHORT SiS_WriteDABDDC(SiS_Private *SiS_Pr);
static USHORT SiS_PrepareReadDDC(SiS_Private *SiS_Pr);
static USHORT SiS_PrepareDDC(SiS_Private *SiS_Pr);
static void SiS_SendACK(SiS_Private *SiS_Pr, USHORT yesno);
static USHORT SiS_DoProbeDDC(SiS_Private *SiS_Pr);
static USHORT SiS_ProbeDDC(SiS_Private *SiS_Pr);
static USHORT SiS_ReadDDC(SiS_Private *SiS_Pr, USHORT DDCdatatype, UCHAR *buffer);
#ifdef SIS315H
void SiS_OEM310Setting(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
USHORT ModeNo,USHORT ModeIdIndex, USHORT RRTI);
void SiS_OEM661Setting(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
USHORT ModeNo,USHORT ModeIdIndex, USHORT RRTI);
void SiS_FinalizeLCD(SiS_Private *, USHORT, USHORT, PSIS_HW_INFO);
static void SiS_OEM310Setting(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
USHORT ModeNo,USHORT ModeIdIndex, USHORT RRTI);
static void SiS_OEM661Setting(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
USHORT ModeNo,USHORT ModeIdIndex, USHORT RRTI);
static void SiS_FinalizeLCD(SiS_Private *, USHORT, USHORT, PSIS_HW_INFO);
#endif
#ifdef SIS300
void SiS_OEM300Setting(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
USHORT ModeNo, USHORT ModeIdIndex, USHORT RefTabindex);
void SetOEMLCDData2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
USHORT ModeNo, USHORT ModeIdIndex,USHORT RefTableIndex);
static void SiS_OEM300Setting(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
USHORT ModeNo, USHORT ModeIdIndex, USHORT RefTabindex);
static void SetOEMLCDData2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
USHORT ModeNo, USHORT ModeIdIndex,USHORT RefTableIndex);
#endif
extern void SiS_SetReg(SISIOADDRESS, USHORT, USHORT);
......@@ -389,29 +388,23 @@ extern UCHAR SiS_GetReg(SISIOADDRESS, USHORT);
extern UCHAR SiS_GetRegByte(SISIOADDRESS);
extern USHORT SiS_GetRegShort(SISIOADDRESS);
extern ULONG SiS_GetRegLong(SISIOADDRESS);
extern void SiS_SetRegANDOR(SISIOADDRESS Port,USHORT Index,USHORT DataAND,USHORT DataOR);
extern void SiS_SetRegOR(SISIOADDRESS Port,USHORT Index,USHORT DataOR);
extern void SiS_SetRegAND(SISIOADDRESS Port,USHORT Index,USHORT DataAND);
extern void SiS_SetRegANDOR(SISIOADDRESS, USHORT, USHORT, USHORT);
extern void SiS_SetRegOR(SISIOADDRESS, USHORT, USHORT);
extern void SiS_SetRegAND(SISIOADDRESS, USHORT, USHORT);
extern void SiS_DisplayOff(SiS_Private *SiS_Pr);
extern void SiS_DisplayOn(SiS_Private *SiS_Pr);
extern BOOLEAN SiS_SearchModeID(SiS_Private *, USHORT *, USHORT *);
extern UCHAR SiS_GetModePtr(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex);
extern USHORT SiS_GetColorDepth(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex);
extern USHORT SiS_GetOffset(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,PSIS_HW_INFO HwInfo);
extern void SiS_LoadDAC(SiS_Private *SiS_Pr, PSIS_HW_INFO,USHORT ModeNo,
USHORT ModeIdIndex);
extern void SiS_CalcLCDACRT1Timing(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex);
extern void SiS_MakeClockRegs(ScrnInfoPtr pScrn, int clock, UCHAR *p2b, UCHAR *p2c);
extern UCHAR SiS_GetModePtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex);
extern USHORT SiS_GetColorDepth(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex);
extern USHORT SiS_GetOffset(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
USHORT RefreshRateTableIndex, PSIS_HW_INFO HwInfo);
extern void SiS_LoadDAC(SiS_Private *SiS_Pr, PSIS_HW_INFO, USHORT ModeNo,
USHORT ModeIdIndex);
extern void SiS_CalcLCDACRT1Timing(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex);
#ifdef LINUX_XF86
extern int SiS_FindPanelFromDB(SISPtr pSiS, USHORT panelvendor, USHORT panelproduct, int *maxx, int *maxy, int *prefx, int *prefy);
extern void SiS_MakeClockRegs(ScrnInfoPtr pScrn, int clock, UCHAR *p2b, UCHAR *p2c);
extern int SiS_FindPanelFromDB(SISPtr pSiS, USHORT panelvendor, USHORT panelproduct,
int *maxx, int *maxy, int *prefx, int *prefy);
#endif
#endif
......@@ -416,7 +416,7 @@
#define Panel_640x480_2 0x13 /* SiS 550 */
#define Panel_640x480_3 0x14 /* SiS 550 */
#define Panel_1280x768_2 0x15 /* 30xLV */
#define Panel_1280x768_3 0x16 /* 30xLV */
#define Panel_1280x768_3 0x16 /* (unused) */
#define Panel_1280x800_2 0x17 /* 30xLV */
/* Index in ModeResInfo table */
......@@ -481,7 +481,7 @@
#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 0x46
#define VCLK_CUSTOM_300 0x47
#define VCLK65_315 0x0b /* Index in (VB)VCLKData table (315) */
#define VCLK108_2_315 0x19 /* Index in (VB)VCLKData table (315) */
#define VCLK81_315 0x5b /* Index in (VB)VCLKData table (315) */
......@@ -494,7 +494,7 @@
#define VCLK121_315 0x5d /* Index in VBVCLKData table (315) */
#define VCLK_1280x720 0x5f
#define VCLK_1280x768_2 0x60
#define VCLK_1280x768_3 0x61
#define VCLK_1280x768_3 0x61 /* (unused?) */
#define VCLK_CUSTOM_315 0x62
#define VCLK_1280x720_2 0x63
#define VCLK_720x480 0x67
......
......@@ -50,7 +50,7 @@
*
*/
const UCHAR SiS300_OEMTVDelay301[8][4] =
static const UCHAR SiS300_OEMTVDelay301[8][4] =
{
{0x08,0x08,0x08,0x08},
{0x08,0x08,0x08,0x08},
......@@ -62,7 +62,7 @@ const UCHAR SiS300_OEMTVDelay301[8][4] =
{0x20,0x20,0x20,0x20}
};
const UCHAR SiS300_OEMTVDelayLVDS[8][4] =
static const UCHAR SiS300_OEMTVDelayLVDS[8][4] =
{
{0x20,0x20,0x20,0x20},
{0x20,0x20,0x20,0x20},
......@@ -74,7 +74,7 @@ const UCHAR SiS300_OEMTVDelayLVDS[8][4] =
{0x20,0x20,0x20,0x20}
};
const UCHAR SiS300_OEMTVFlicker[8][4] =
static const UCHAR SiS300_OEMTVFlicker[8][4] =
{
{0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00},
......@@ -87,7 +87,7 @@ const UCHAR SiS300_OEMTVFlicker[8][4] =
};
#if 0 /* TW: Not used */
const UCHAR SiS300_OEMLCDDelay1[12][4]={
static const UCHAR SiS300_OEMLCDDelay1[12][4]={
{0x2c,0x2c,0x2c,0x2c},
{0x20,0x20,0x20,0x20},
{0x20,0x20,0x20,0x20},
......@@ -103,8 +103,8 @@ const UCHAR SiS300_OEMLCDDelay1[12][4]={
};
#endif
/* TW: From 630/301B BIOS */
const UCHAR SiS300_OEMLCDDelay2[64][4] = /* for 301/301b/302b/301LV/302LV */
/* From 630/301B BIOS */
static const UCHAR SiS300_OEMLCDDelay2[64][4] = /* for 301/301b/302b/301LV/302LV */
{
{0x20,0x20,0x20,0x20},
{0x20,0x20,0x20,0x20},
......@@ -172,8 +172,8 @@ const UCHAR SiS300_OEMLCDDelay2[64][4] = /* for 301/301b/302b/301LV/302LV */
{0x20,0x20,0x20,0x20}
};
/* TW: From 300/301LV BIOS */
const UCHAR SiS300_OEMLCDDelay4[12][4] =
/* From 300/301LV BIOS */
static const UCHAR SiS300_OEMLCDDelay4[12][4] =
{
{0x2c,0x2c,0x2c,0x2c},
{0x20,0x20,0x20,0x20},
......@@ -189,8 +189,8 @@ const UCHAR SiS300_OEMLCDDelay4[12][4] =
{0x24,0x24,0x24,0x24}
};
/* TW: From 300/301LV BIOS */
const UCHAR SiS300_OEMLCDDelay5[32][4] =
/* From 300/301LV BIOS */
static const UCHAR SiS300_OEMLCDDelay5[32][4] =
{
{0x20,0x20,0x20,0x20},
{0x20,0x20,0x20,0x20},
......@@ -226,8 +226,8 @@ const UCHAR SiS300_OEMLCDDelay5[32][4] =