📄 init.h
字号:
/* $XFree86$ *//* $XdotOrg$ *//* * Data and prototypes for init.c * * Copyright (C) 2001-2004 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. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the Free Software * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * 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 EXPRESSED 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 _INIT_#define _INIT_#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 "xf86_OSproc.h"#include "sis.h"#include "sis_regs.h"#endif#ifdef LINUX_KERNEL#ifdef SIS_CP#undef SIS_CP#endif#include <linux/config.h>#include <linux/version.h>#include <linux/types.h>#include <asm/io.h>#include <linux/fb.h>#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)#include <linux/sisfb.h>#else#include <video/sisfb.h>#endif#endif/* Mode numbers */const USHORT ModeIndex_320x200[] = {0x59, 0x41, 0x00, 0x4f};const USHORT ModeIndex_320x240[] = {0x50, 0x56, 0x00, 0x53};const USHORT ModeIndex_320x240_FSTN[] = {0x5a, 0x5b, 0x00, 0x00}; /* FSTN */const USHORT ModeIndex_400x300[] = {0x51, 0x57, 0x00, 0x54};const USHORT ModeIndex_512x384[] = {0x52, 0x58, 0x00, 0x5c};const USHORT ModeIndex_640x400[] = {0x2f, 0x5d, 0x00, 0x5e};const USHORT ModeIndex_640x480[] = {0x2e, 0x44, 0x00, 0x62};const USHORT ModeIndex_720x480[] = {0x31, 0x33, 0x00, 0x35};const USHORT ModeIndex_720x576[] = {0x32, 0x34, 0x00, 0x36};const USHORT ModeIndex_768x576[] = {0x5f, 0x60, 0x00, 0x61};const USHORT ModeIndex_800x480[] = {0x70, 0x7a, 0x00, 0x76};const USHORT ModeIndex_800x600[] = {0x30, 0x47, 0x00, 0x63};const USHORT ModeIndex_848x480[] = {0x39, 0x3b, 0x00, 0x3e};const USHORT ModeIndex_856x480[] = {0x3f, 0x42, 0x00, 0x45};const USHORT ModeIndex_1024x768[] = {0x38, 0x4a, 0x00, 0x64};const USHORT ModeIndex_1024x576[] = {0x71, 0x74, 0x00, 0x77};const USHORT ModeIndex_1024x600[] = {0x20, 0x21, 0x00, 0x22}; /* 300 series only */const USHORT ModeIndex_1280x1024[] = {0x3a, 0x4d, 0x00, 0x65};const USHORT ModeIndex_1280x960[] = {0x7c, 0x7d, 0x00, 0x7e};const USHORT ModeIndex_1152x768[] = {0x23, 0x24, 0x00, 0x25}; /* 300 series only */const USHORT ModeIndex_1152x864[] = {0x29, 0x2a, 0x00, 0x2b};const USHORT ModeIndex_300_1280x768[] = {0x55, 0x5a, 0x00, 0x5b};const USHORT ModeIndex_310_1280x768[] = {0x23, 0x24, 0x00, 0x25};const USHORT ModeIndex_1280x720[] = {0x79, 0x75, 0x00, 0x78};const USHORT ModeIndex_1280x800[] = {0x14, 0x15, 0x00, 0x16};const USHORT ModeIndex_1360x768[] = {0x48, 0x4b, 0x00, 0x4e};const USHORT ModeIndex_300_1360x1024[]= {0x67, 0x6f, 0x00, 0x72}; /* 300 series, BARCO only */const USHORT ModeIndex_1400x1050[] = {0x26, 0x27, 0x00, 0x28}; /* 315 series only */const USHORT ModeIndex_1680x1050[] = {0x17, 0x18, 0x00, 0x19}; /* 315 series only */const USHORT ModeIndex_1600x1200[] = {0x3c, 0x3d, 0x00, 0x66};const USHORT ModeIndex_1920x1440[] = {0x68, 0x69, 0x00, 0x6b};const USHORT ModeIndex_300_2048x1536[]= {0x6c, 0x6d, 0x00, 0x00};const USHORT ModeIndex_310_2048x1536[]= {0x6c, 0x6d, 0x00, 0x6e};const USHORT SiS_DRAMType[17][5]={ {0x0C,0x0A,0x02,0x40,0x39}, {0x0D,0x0A,0x01,0x40,0x48}, {0x0C,0x09,0x02,0x20,0x35}, {0x0D,0x09,0x01,0x20,0x44}, {0x0C,0x08,0x02,0x10,0x31}, {0x0D,0x08,0x01,0x10,0x40}, {0x0C,0x0A,0x01,0x20,0x34}, {0x0C,0x09,0x01,0x08,0x32}, {0x0B,0x08,0x02,0x08,0x21}, {0x0C,0x08,0x01,0x08,0x30}, {0x0A,0x08,0x02,0x04,0x11}, {0x0B,0x0A,0x01,0x10,0x28}, {0x09,0x08,0x02,0x02,0x01}, {0x0B,0x09,0x01,0x08,0x24}, {0x0B,0x08,0x01,0x04,0x20}, {0x0A,0x08,0x01,0x02,0x10}, {0x09,0x08,0x01,0x01,0x00}};const USHORT SiS_SDRDRAM_TYPE[13][5] ={ { 2,12, 9,64,0x35}, { 1,13, 9,64,0x44}, { 2,12, 8,32,0x31}, { 2,11, 9,32,0x25}, { 1,12, 9,32,0x34}, { 1,13, 8,32,0x40}, { 2,11, 8,16,0x21}, { 1,12, 8,16,0x30}, { 1,11, 9,16,0x24}, { 1,11, 8, 8,0x20}, { 2, 9, 8, 4,0x01}, { 1,10, 8, 4,0x10}, { 1, 9, 8, 2,0x00}};const USHORT SiS_DDRDRAM_TYPE[4][5] ={ { 2,12, 9,64,0x35}, { 2,12, 8,32,0x31}, { 2,11, 8,16,0x21}, { 2, 9, 8, 4,0x01}};const USHORT SiS_MDA_DAC[] ={ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F};const USHORT SiS_CGA_DAC[] ={ 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F};const USHORT SiS_EGA_DAC[] ={ 0x00,0x10,0x04,0x14,0x01,0x11,0x05,0x15, 0x20,0x30,0x24,0x34,0x21,0x31,0x25,0x35, 0x08,0x18,0x0C,0x1C,0x09,0x19,0x0D,0x1D, 0x28,0x38,0x2C,0x3C,0x29,0x39,0x2D,0x3D, 0x02,0x12,0x06,0x16,0x03,0x13,0x07,0x17, 0x22,0x32,0x26,0x36,0x23,0x33,0x27,0x37, 0x0A,0x1A,0x0E,0x1E,0x0B,0x1B,0x0F,0x1F, 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F};const USHORT SiS_VGA_DAC[] ={ 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, 0x00,0x05,0x08,0x0B,0x0E,0x11,0x14,0x18, 0x1C,0x20,0x24,0x28,0x2D,0x32,0x38,0x3F, 0x00,0x10,0x1F,0x2F,0x3F,0x1F,0x27,0x2F, 0x37,0x3F,0x2D,0x31,0x36,0x3A,0x3F,0x00, 0x07,0x0E,0x15,0x1C,0x0E,0x11,0x15,0x18, 0x1C,0x14,0x16,0x18,0x1A,0x1C,0x00,0x04, 0x08,0x0C,0x10,0x08,0x0A,0x0C,0x0E,0x10, 0x0B,0x0C,0x0D,0x0F,0x10};static const SiS_StResInfoStruct SiS_StResInfo[]={ { 640,400}, { 640,350}, { 720,400}, { 720,350}, { 640,480}};static const SiS_ModeResInfoStruct SiS_ModeResInfo[] ={ { 320, 200, 8, 8}, /* 0x00 */ { 320, 240, 8, 8}, /* 0x01 */ { 320, 400, 8, 8}, /* 0x02 */ { 400, 300, 8, 8}, /* 0x03 */ { 512, 384, 8, 8}, /* 0x04 */ { 640, 400, 8,16}, /* 0x05 */ { 640, 480, 8,16}, /* 0x06 */ { 800, 600, 8,16}, /* 0x07 */ { 1024, 768, 8,16}, /* 0x08 */ { 1280,1024, 8,16}, /* 0x09 */ { 1600,1200, 8,16}, /* 0x0a */ { 1920,1440, 8,16}, /* 0x0b */ { 2048,1536, 8,16}, /* 0x0c */ { 720, 480, 8,16}, /* 0x0d */ { 720, 576, 8,16}, /* 0x0e */ { 1280, 960, 8,16}, /* 0x0f */ { 800, 480, 8,16}, /* 0x10 */ { 1024, 576, 8,16}, /* 0x11 */ { 1280, 720, 8,16}, /* 0x12 */ { 856, 480, 8,16}, /* 0x13 */ { 1280, 768, 8,16}, /* 0x14 */ { 1400,1050, 8,16}, /* 0x15 */ { 1152, 864, 8,16}, /* 0x16 */ { 848, 480, 8,16}, /* 0x17 */ { 1360, 768, 8,16}, /* 0x18 */ { 1024, 600, 8,16}, /* 0x19 */ { 1152, 768, 8,16}, /* 0x1a */ { 768, 576, 8,16}, /* 0x1b */ { 1360,1024, 8,16}, /* 0x1c */ { 1680,1050, 8,16}, /* 0x1d */ { 1280, 800, 8,16} /* 0x1e */ };static SiS_StandTableStruct SiS_StandTable[]={/* 0x00: MD_0_200 */ { 0x28,0x18,0x08,0x0800, {0x09,0x03,0x00,0x02}, 0x63, {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, 0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3, 0xff}, {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, 0x08,0x00,0x0f,0x00}, {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, 0xff} },/* 0x01: MD_1_200 */ { 0x28,0x18,0x08,0x0800, {0x09,0x03,0x00,0x02}, 0x63, {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, 0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3, 0xff}, {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, 0x08,0x00,0x0f,0x00}, {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, 0xff} },/* 0x02: MD_2_200 */ { 0x50,0x18,0x08,0x1000, {0x01,0x03,0x00,0x02}, 0x63, {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3, 0xff}, {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, 0x08,0x00,0x0f,0x00}, {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, 0xff} },/* 0x03: MD_3_200 - mode 0x03 - 0 */ { 0x50,0x18,0x08,0x1000, {0x01,0x03,0x00,0x02}, 0x63, {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3, 0xff}, {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, 0x08,0x00,0x0f,0x00}, {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, 0xff} },/* 0x04: MD_4 */ { 0x28,0x18,0x08,0x4000, {0x09,0x03,0x00,0x02}, 0x63, {0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, /* 0x2c is 2b for 300 */ 0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00, 0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xa2, 0xff}, {0x00,0x13,0x15,0x17,0x02,0x04,0x06,0x07, 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, 0x01,0x00,0x03,0x00}, {0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00, 0xff} },/* 0x05: MD_5 */ { 0x28,0x18,0x08,0x4000, {0x09,0x03,0x00,0x02}, 0x63, {0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, /* 0x2c is 2b for 300 */ 0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00, 0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xa2, 0xff}, {0x00,0x13,0x15,0x17,0x02,0x04,0x06,0x07, 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, 0x01,0x00,0x03,0x00}, {0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00, 0xff} },/* 0x06: MD_6 */ { 0x50,0x18,0x08,0x4000, {0x01,0x01,0x00,0x06}, 0x63, {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, /* 55,81 is 54,80 for 300 */ 0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00, 0x9c,0x8e,0x8f,0x28,0x00,0x96,0xb9,0xc2, 0xff}, {0x00,0x17,0x17,0x17,0x17,0x17,0x17,0x17, 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, 0x01,0x00,0x01,0x00}, {0x00,0x00,0x00,0x00,0x00,0x00,0x0d,0x00, 0xff} },/* 0x07: MD_7 */ { 0x50,0x18,0x0e,0x1000, {0x00,0x03,0x00,0x03}, 0xa6, {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, 0x83,0x85,0x5d,0x28,0x0d,0x63,0xba,0xa3, 0xff}, {0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08, 0x10,0x18,0x18,0x18,0x18,0x18,0x18,0x18, 0x0e,0x00,0x0f,0x08}, {0x00,0x00,0x00,0x00,0x00,0x10,0x0a,0x00, 0xff} },/* 0x08: MDA_DAC */ { 0x00,0x00,0x00,0x0000, {0x00,0x00,0x00,0x15}, 0x15, {0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, 0x15,0x15,0x15,0x15,0x15,0x15,0x3f,0x3f, 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x00, 0x00}, {0x00,0x00,0x00,0x00,0x00,0x15,0x15,0x15, 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, 0x15,0x15,0x15,0x15}, {0x15,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, 0x3f} },/* 0x09: CGA_DAC */ { 0x00,0x10,0x04,0x0114, {0x11,0x09,0x15,0x00}, 0x10, {0x04,0x14,0x01,0x11,0x09,0x15,0x2a,0x3a, 0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x2a,0x3a, 0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x00,0x10, 0x04}, {0x14,0x01,0x11,0x09,0x15,0x00,0x10,0x04, 0x14,0x01,0x11,0x09,0x15,0x2a,0x3a,0x2e, 0x3e,0x2b,0x3b,0x2f}, {0x3f,0x2a,0x3a,0x2e,0x3e,0x2b,0x3b,0x2f, 0x3f} },/* 0x0a: EGA_DAC */ { 0x00,0x10,0x04,0x0114, {0x11,0x05,0x15,0x20}, 0x30, {0x24,0x34,0x21,0x31,0x25,0x35,0x08,0x18,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -