/* $XFree86$ */
+/* $XdotOrg$ */
/*
* OS depending defines
*
- * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
+ * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria
*
* If distributed as part of the Linux kernel, the following license terms
* apply:
* * 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) All advertising materials mentioning features or use of this software
- * * must display the following acknowledgement: "This product includes
- * * software developed by Thomas Winischhofer, Vienna, Austria."
- * * 4) The name of the author may not be used to endorse or promote products
+ * * 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 EXPRESS OR
*
*/
-/* The choices are: */
-
-#define LINUX_KERNEL /* Kernel framebuffer */
-/* #define LINUX_XF86 */ /* XFree86 */
-
-/**********************************************************************/
-#ifdef LINUX_KERNEL /* -------------------------- */
-#include <linux/config.h>
-#include <linux/version.h>
-
-#ifdef CONFIG_FB_SIS_300
-#define SIS300
-#endif
-
-#ifdef CONFIG_FB_SIS_315
-#define SIS315H
-#endif
-
-#if 1
-#define SISFBACCEL /* Include 2D acceleration */
-#endif
-
-#endif
-
-#ifdef LINUX_XF86 /* ----------------------------- */
-#define SIS300
-#define SIS315H
-#endif
+#ifndef _SIS_OSDEF_H_
+#define _SIS_OSDEF_H_
-/**********************************************************************/
-#ifdef LINUX_XF86
-#define SiS_SetMemory(MemoryAddress,MemorySize,value) memset(MemoryAddress, value, MemorySize)
-#define SiS_MemoryCopy(Destination,Soruce,Length) memcpy(Destination,Soruce,Length)
-#endif
-
-#ifdef LINUX_KERNEL
-#define SiS_SetMemory(MemoryAddress,MemorySize,value) memset(MemoryAddress, value, MemorySize)
-#define SiS_MemoryCopy(Destination,Soruce,Length) memcpy(Destination,Soruce,Length)
-#endif
+/* The choices are: */
+#define SIS_LINUX_KERNEL /* Linux kernel framebuffer */
+#undef SIS_XORG_XF86 /* XFree86/X.org */
-/**********************************************************************/
+#undef SIS_LINUX_KERNEL_24
+#undef SIS_LINUX_KERNEL_26
#ifdef OutPortByte
#undef OutPortByte
-#endif /* OutPortByte */
+#endif
#ifdef OutPortWord
#undef OutPortWord
-#endif /* OutPortWord */
+#endif
#ifdef OutPortLong
#undef OutPortLong
-#endif /* OutPortLong */
+#endif
#ifdef InPortByte
#undef InPortByte
-#endif /* InPortByte */
+#endif
#ifdef InPortWord
#undef InPortWord
-#endif /* InPortWord */
+#endif
#ifdef InPortLong
#undef InPortLong
-#endif /* InPortLong */
+#endif
/**********************************************************************/
-/* LINUX XF86 */
+/* LINUX KERNEL */
/**********************************************************************/
-#ifdef LINUX_XF86
-#define OutPortByte(p,v) outb((CARD16)(p),(CARD8)(v))
-#define OutPortWord(p,v) outw((CARD16)(p),(CARD16)(v))
-#define OutPortLong(p,v) outl((CARD16)(p),(CARD32)(v))
-#define InPortByte(p) inb((CARD16)(p))
-#define InPortWord(p) inw((CARD16)(p))
-#define InPortLong(p) inl((CARD16)(p))
+#ifdef SIS_LINUX_KERNEL
+#include <linux/config.h>
+#include <linux/version.h>
+
+#ifdef CONFIG_FB_SIS_300
+#define SIS300
#endif
+#ifdef CONFIG_FB_SIS_315
+#define SIS315H
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+#define SIS_LINUX_KERNEL_26
+#else
+#define SIS_LINUX_KERNEL_24
+#endif
+
+#if !defined(SIS300) && !defined(SIS315H)
+#warning Neither CONFIG_FB_SIS_300 nor CONFIG_FB_SIS_315 is set
+#warning sisfb will not work!
+#endif
+
+#define OutPortByte(p,v) outb((u8)(v),(SISIOADDRESS)(p))
+#define OutPortWord(p,v) outw((u16)(v),(SISIOADDRESS)(p))
+#define OutPortLong(p,v) outl((u32)(v),(SISIOADDRESS)(p))
+#define InPortByte(p) inb((SISIOADDRESS)(p))
+#define InPortWord(p) inw((SISIOADDRESS)(p))
+#define InPortLong(p) inl((SISIOADDRESS)(p))
+#define SiS_SetMemory(MemoryAddress,MemorySize,value) memset_io(MemoryAddress, value, MemorySize)
+
+#endif /* LINUX_KERNEL */
+
/**********************************************************************/
-/* LINUX KERNEL */
+/* XFree86/X.org */
/**********************************************************************/
-#ifdef LINUX_KERNEL
-#define OutPortByte(p,v) outb((u8)(v),(u16)(p))
-#define OutPortWord(p,v) outw((u16)(v),(u16)(p))
-#define OutPortLong(p,v) outl((u32)(v),(u16)(p))
-#define InPortByte(p) inb((u16)(p))
-#define InPortWord(p) inw((u16)(p))
-#define InPortLong(p) inl((u16)(p))
-#endif
+#ifdef SIS_XORG_XF86
+
+#define SIS300
+#define SIS315H
+
+#define OutPortByte(p,v) outSISREG((IOADDRESS)(p),(CARD8)(v))
+#define OutPortWord(p,v) outSISREGW((IOADDRESS)(p),(CARD16)(v))
+#define OutPortLong(p,v) outSISREGL((IOADDRESS)(p),(CARD32)(v))
+#define InPortByte(p) inSISREG((IOADDRESS)(p))
+#define InPortWord(p) inSISREGW((IOADDRESS)(p))
+#define InPortLong(p) inSISREGL((IOADDRESS)(p))
+#define SiS_SetMemory(MemoryAddress,MemorySize,value) memset(MemoryAddress, value, MemorySize)
+#endif /* XF86 */
+#endif /* _OSDEF_H_ */