blob: 841ca3190cd4d15fbe329763016a0e5639698bc9 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* $XFree86$ */
2/* $XdotOrg$ */
3/*
4 * OS depending defines
5 *
Thomas Winischhofer544393f2005-09-09 13:04:45 -07006 * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 *
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 EXPRESS 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#ifndef _SIS_OSDEF_H_
55#define _SIS_OSDEF_H_
56
57/* The choices are: */
Thomas Winischhofer544393f2005-09-09 13:04:45 -070058#define SIS_LINUX_KERNEL /* Linux kernel framebuffer */
59#undef SIS_XORG_XF86 /* XFree86/X.org */
60
61#undef SIS_LINUX_KERNEL_24
62#undef SIS_LINUX_KERNEL_26
Linus Torvalds1da177e2005-04-16 15:20:36 -070063
64#ifdef OutPortByte
65#undef OutPortByte
66#endif
67
68#ifdef OutPortWord
69#undef OutPortWord
70#endif
71
72#ifdef OutPortLong
73#undef OutPortLong
74#endif
75
76#ifdef InPortByte
77#undef InPortByte
78#endif
79
80#ifdef InPortWord
81#undef InPortWord
82#endif
83
84#ifdef InPortLong
85#undef InPortLong
86#endif
87
88/**********************************************************************/
89/* LINUX KERNEL */
90/**********************************************************************/
91
Thomas Winischhofer544393f2005-09-09 13:04:45 -070092#ifdef SIS_LINUX_KERNEL
Linus Torvalds1da177e2005-04-16 15:20:36 -070093#include <linux/config.h>
Thomas Winischhofer544393f2005-09-09 13:04:45 -070094#include <linux/version.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070095
96#ifdef CONFIG_FB_SIS_300
97#define SIS300
98#endif
99
100#ifdef CONFIG_FB_SIS_315
101#define SIS315H
102#endif
103
Thomas Winischhofer544393f2005-09-09 13:04:45 -0700104#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
105#define SIS_LINUX_KERNEL_26
106#else
107#define SIS_LINUX_KERNEL_24
108#endif
109
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110#if !defined(SIS300) && !defined(SIS315H)
111#warning Neither CONFIG_FB_SIS_300 nor CONFIG_FB_SIS_315 is set
112#warning sisfb will not work!
113#endif
114
115#define OutPortByte(p,v) outb((u8)(v),(SISIOADDRESS)(p))
116#define OutPortWord(p,v) outw((u16)(v),(SISIOADDRESS)(p))
117#define OutPortLong(p,v) outl((u32)(v),(SISIOADDRESS)(p))
118#define InPortByte(p) inb((SISIOADDRESS)(p))
119#define InPortWord(p) inw((SISIOADDRESS)(p))
120#define InPortLong(p) inl((SISIOADDRESS)(p))
121#define SiS_SetMemory(MemoryAddress,MemorySize,value) memset_io(MemoryAddress, value, MemorySize)
Thomas Winischhofer544393f2005-09-09 13:04:45 -0700122
123#endif /* LINUX_KERNEL */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124
125/**********************************************************************/
126/* XFree86/X.org */
127/**********************************************************************/
128
Thomas Winischhofer544393f2005-09-09 13:04:45 -0700129#ifdef SIS_XORG_XF86
130
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131#define SIS300
132#define SIS315H
133
134#define OutPortByte(p,v) outSISREG((IOADDRESS)(p),(CARD8)(v))
135#define OutPortWord(p,v) outSISREGW((IOADDRESS)(p),(CARD16)(v))
136#define OutPortLong(p,v) outSISREGL((IOADDRESS)(p),(CARD32)(v))
137#define InPortByte(p) inSISREG((IOADDRESS)(p))
138#define InPortWord(p) inSISREGW((IOADDRESS)(p))
139#define InPortLong(p) inSISREGL((IOADDRESS)(p))
140#define SiS_SetMemory(MemoryAddress,MemorySize,value) memset(MemoryAddress, value, MemorySize)
Thomas Winischhofer544393f2005-09-09 13:04:45 -0700141
142#endif /* XF86 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143
144#endif /* _OSDEF_H_ */