1 /* $XFree86$ */
2 /* $XdotOrg$ */
3 /*
4  * OS depending defines
5  *
6  * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
7  *
8  * If distributed as part of the Linux kernel, the following license terms
9  * apply:
10  *
11  * * This program is free software; you can redistribute it and/or modify
12  * * it under the terms of the GNU General Public License as published by
13  * * the Free Software Foundation; either version 2 of the named License,
14  * * or any later version.
15  * *
16  * * This program is distributed in the hope that it will be useful,
17  * * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * * GNU General Public License for more details.
20  * *
21  * * You should have received a copy of the GNU General Public License
22  * * along with this program; if not, write to the Free Software
23  * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
24  *
25  * Otherwise, the following license terms apply:
26  *
27  * * Redistribution and use in source and binary forms, with or without
28  * * modification, are permitted provided that the following conditions
29  * * are met:
30  * * 1) Redistributions of source code must retain the above copyright
31  * *    notice, this list of conditions and the following disclaimer.
32  * * 2) Redistributions in binary form must reproduce the above copyright
33  * *    notice, this list of conditions and the following disclaimer in the
34  * *    documentation and/or other materials provided with the distribution.
35  * * 3) The name of the author may not be used to endorse or promote products
36  * *    derived from this software without specific prior written permission.
37  * *
38  * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
39  * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
40  * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
41  * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
42  * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
43  * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
44  * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
45  * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
46  * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
47  * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
48  *
49  * Author: 	Thomas Winischhofer <thomas@winischhofer.net>
50  *		Silicon Integrated Systems, Inc. (used by permission)
51  *
52  */
53 
54 /* The choices are: */
55 #define LINUX_KERNEL	   /* Kernel framebuffer */
56 /* #define LINUX_XF86 */   /* XFree86 */
57 
58 #ifdef OutPortByte
59 #undef OutPortByte
60 #endif
61 
62 #ifdef OutPortWord
63 #undef OutPortWord
64 #endif
65 
66 #ifdef OutPortLong
67 #undef OutPortLong
68 #endif
69 
70 #ifdef InPortByte
71 #undef InPortByte
72 #endif
73 
74 #ifdef InPortWord
75 #undef InPortWord
76 #endif
77 
78 #ifdef InPortLong
79 #undef InPortLong
80 #endif
81 
82 /**********************************************************************/
83 /*  LINUX KERNEL                                                      */
84 /**********************************************************************/
85 
86 #ifdef LINUX_KERNEL
87 #include <linux/config.h>
88 
89 #ifdef CONFIG_FB_SIS_300
90 #define SIS300
91 #endif
92 
93 #ifdef CONFIG_FB_SIS_315
94 #define SIS315H
95 #endif
96 
97 #define OutPortByte(p,v) outb((u8)(v),(SISIOADDRESS)(p))
98 #define OutPortWord(p,v) outw((u16)(v),(SISIOADDRESS)(p))
99 #define OutPortLong(p,v) outl((u32)(v),(SISIOADDRESS)(p))
100 #define InPortByte(p)    inb((SISIOADDRESS)(p))
101 #define InPortWord(p)    inw((SISIOADDRESS)(p))
102 #define InPortLong(p)    inl((SISIOADDRESS)(p))
103 #define SiS_SetMemory(MemoryAddress,MemorySize,value) memset_io(MemoryAddress, value, MemorySize)
104 #endif
105 
106 /**********************************************************************/
107 /*  XFree86, X.org                                                    */
108 /**********************************************************************/
109 
110 #ifdef LINUX_XF86
111 #define SIS300
112 #define SIS315H
113 
114 #define OutPortByte(p,v) outb((IOADDRESS)(p),(CARD8)(v))
115 #define OutPortWord(p,v) outw((IOADDRESS)(p),(CARD16)(v))
116 #define OutPortLong(p,v) outl((IOADDRESS)(p),(CARD32)(v))
117 #define InPortByte(p)    inb((IOADDRESS)(p))
118 #define InPortWord(p)    inw((IOADDRESS)(p))
119 #define InPortLong(p)    inl((IOADDRESS)(p))
120 #define SiS_SetMemory(MemoryAddress,MemorySize,value) memset(MemoryAddress, value, MemorySize)
121 #endif
122 
123 
124