init.h revision dfe64dd3
1/*
2 * Data and prototypes for init.c
3 *
4 * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
5 *
6 * If distributed as part of the Linux kernel, the following license terms
7 * apply:
8 *
9 * * This program is free software; you can redistribute it and/or modify
10 * * it under the terms of the GNU General Public License as published by
11 * * the Free Software Foundation; either version 2 of the named License,
12 * * or any later version.
13 * *
14 * * This program is distributed in the hope that it will be useful,
15 * * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * * GNU General Public License for more details.
18 * *
19 * * You should have received a copy of the GNU General Public License
20 * * along with this program; if not, write to the Free Software
21 * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
22 *
23 * Otherwise, the following license terms apply:
24 *
25 * * Redistribution and use in source and binary forms, with or without
26 * * modification, are permitted provided that the following conditions
27 * * are met:
28 * * 1) Redistributions of source code must retain the above copyright
29 * *    notice, this list of conditions and the following disclaimer.
30 * * 2) Redistributions in binary form must reproduce the above copyright
31 * *    notice, this list of conditions and the following disclaimer in the
32 * *    documentation and/or other materials provided with the distribution.
33 * * 3) The name of the author may not be used to endorse or promote products
34 * *    derived from this software without specific prior written permission.
35 * *
36 * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
37 * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38 * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
39 * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
40 * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
41 * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
42 * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
43 * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44 * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
45 * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46 *
47 * Author: 	Thomas Winischhofer <thomas@winischhofer.net>
48 *
49 */
50
51#ifndef _INIT_
52#define _INIT_
53
54#include "osdef.h"
55
56#include "vgatypes.h"
57#include "vb_struct.h"
58
59#ifdef LINUX_XF86
60#include "xf86.h"
61#include "xf86Pci.h"
62#include "xf86PciInfo.h"
63#include "xf86_OSproc.h"
64#include "xgi.h"
65#include "xgi_regs.h"
66#endif
67
68#ifdef LINUX_KERNEL
69#ifdef XGI_CP
70#undef XGI_CP
71#endif
72#include <linux/config.h>
73#include <linux/version.h>
74#include <linux/types.h>
75#include <asm/io.h>
76#include <linux/fb.h>
77#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
78#include <linux/xgifb.h>
79#else
80#include <video/xgifb.h>
81#endif
82#endif
83
84/* Mode numbers */
85static const USHORT  ModeIndex_320x200[]      = {0x59, 0x41, 0x00, 0x4f};
86static const USHORT  ModeIndex_320x240[]      = {0x50, 0x56, 0x00, 0x53};
87static const USHORT  ModeIndex_320x240_FSTN[] = {0x5a, 0x5b, 0x00, 0x00};  /* FSTN */
88static const USHORT  ModeIndex_400x300[]      = {0x51, 0x57, 0x00, 0x54};
89static const USHORT  ModeIndex_512x384[]      = {0x52, 0x58, 0x00, 0x5c};
90static const USHORT  ModeIndex_640x400[]      = {0x2f, 0x5d, 0x00, 0x5e};
91static const USHORT  ModeIndex_640x480[]      = {0x2e, 0x44, 0x00, 0x62};
92static const USHORT  ModeIndex_720x480[]      = {0x31, 0x33, 0x00, 0x35};
93static const USHORT  ModeIndex_720x576[]      = {0x32, 0x34, 0x00, 0x36};
94static const USHORT  ModeIndex_768x576[]      = {0x5f, 0x60, 0x00, 0x61};
95static const USHORT  ModeIndex_800x480[]      = {0x70, 0x7a, 0x00, 0x76};
96static const USHORT  ModeIndex_800x600[]      = {0x30, 0x47, 0x00, 0x63};
97static const USHORT  ModeIndex_848x480[]      = {0x39, 0x3b, 0x00, 0x3e};
98static const USHORT  ModeIndex_856x480[]      = {0x3f, 0x42, 0x00, 0x45};
99static const USHORT  ModeIndex_1024x768[]     = {0x38, 0x4a, 0x00, 0x64};
100static const USHORT  ModeIndex_1024x576[]     = {0x71, 0x74, 0x00, 0x77};
101static const USHORT  ModeIndex_1024x600[]     = {0x20, 0x21, 0x00, 0x22};  /* 300 series only */
102static const USHORT  ModeIndex_1280x1024[]    = {0x3a, 0x4d, 0x00, 0x65};
103static const USHORT  ModeIndex_1280x960[]     = {0x7b, 0x7c, 0x00, 0x7d};
104static const USHORT  ModeIndex_1152x768[]     = {0x23, 0x24, 0x00, 0x25};  /* 300 series only */
105static const USHORT  ModeIndex_1152x864[]     = {0x20, 0x21, 0x00, 0x22};
106static const USHORT  ModeIndex_310_1280x768[] = {0x23, 0x24, 0x00, 0x25};
107static const USHORT  ModeIndex_1280x720[]     = {0x79, 0x75, 0x00, 0x78};
108static const USHORT  ModeIndex_1280x800[]     = {0x14, 0x15, 0x00, 0x16};
109static const USHORT  ModeIndex_1360x768[]     = {0x48, 0x4b, 0x00, 0x4e};
110static const USHORT  ModeIndex_1400x1050[]    = {0x26, 0x27, 0x00, 0x28};  /* 315 series only */
111/* static const USHORT  ModeIndex_1440x900[]	  = {0x26, 0x27, 0x00, 0x28}; */ /* Jong@09292009 */
112static const USHORT  ModeIndex_1680x1050[]    = {0x17, 0x18, 0x00, 0x19};  /* 315 series only */
113static const USHORT  ModeIndex_1600x1200[]    = {0x3c, 0x3d, 0x00, 0x66};
114static const USHORT  ModeIndex_1920x1440[]    = {0x68, 0x69, 0x00, 0x6b};
115static const USHORT  ModeIndex_310_2048x1536[]= {0x6c, 0x6d, 0x00, 0x6e};
116
117
118void	XGI_New_DisplayOn(VB_DEVICE_INFO *XGI_Pr);
119void	XGI_New_DisplayOff(VB_DEVICE_INFO *XGI_Pr);
120
121void	XGI_New_GetVBType(VB_DEVICE_INFO *XGI_Pr, PXGI_HW_DEVICE_INFO HwInfo);
122USHORT	XGI_GetMCLK(VB_DEVICE_INFO *XGI_Pr, PXGI_HW_DEVICE_INFO HwInfo);
123USHORT	XGI_New_GetOffset(VB_DEVICE_INFO *XGI_Pr,USHORT ModeNo,USHORT ModeIdIndex,
124              USHORT RefreshRateTableIndex,PXGI_HW_DEVICE_INFO HwInfo);
125void	XGI_New_LoadDAC(VB_DEVICE_INFO *XGI_Pr, PXGI_HW_DEVICE_INFO HwInfo, USHORT ModeNo, USHORT ModeIdIndex);
126#ifdef LINUX_XF86
127BOOLEAN	XGIBIOSSetMode(VB_DEVICE_INFO *XGI_Pr, PXGI_HW_DEVICE_INFO HwInfo,
128    ScrnInfoPtr pScrn, DisplayModePtr mode);
129
130BOOLEAN	XGIBIOSSetModeCRT1(VB_DEVICE_INFO *XGI_Pr, PXGI_HW_DEVICE_INFO HwInfo,
131    ScrnInfoPtr pScrn, DisplayModePtr mode);
132#endif
133
134#ifdef LINUX_XF86
135extern unsigned char XGI_GetSetBIOSScratch(ScrnInfoPtr pScrn, USHORT offset, unsigned char value);
136extern unsigned char XGI_GetSetModeID(ScrnInfoPtr pScrn, unsigned char id);
137extern USHORT XGI_CalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode,
138    unsigned long VBFlags);
139#endif
140
141#endif
142
143