summaryrefslogtreecommitdiff
path: root/xc/programs/Xserver/hw/xfree86/common/compiler.h
diff options
context:
space:
mode:
authorldelgass <ldelgass>2003-03-30 04:49:52 +0000
committerldelgass <ldelgass>2003-03-30 04:49:52 +0000
commitb8c3a04c9a0316029234e9f6d23bd41fc3d6b21f (patch)
tree04302240ba49af242bd168881e18855a8a1b863a /xc/programs/Xserver/hw/xfree86/common/compiler.h
parentebce8f934a8bb868f6d390ec3b35a3dc2ae18c0b (diff)
Merge trunk - 4.3.0, filpmach64-0-0-6-20030330
Diffstat (limited to 'xc/programs/Xserver/hw/xfree86/common/compiler.h')
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/compiler.h86
1 files changed, 45 insertions, 41 deletions
diff --git a/xc/programs/Xserver/hw/xfree86/common/compiler.h b/xc/programs/Xserver/hw/xfree86/common/compiler.h
index dfb1bb71d..4dda2f6c6 100644
--- a/xc/programs/Xserver/hw/xfree86/common/compiler.h
+++ b/xc/programs/Xserver/hw/xfree86/common/compiler.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.94 2002/09/16 18:05:42 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.99 2003/01/29 15:23:20 tsi Exp $ */
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
*
@@ -87,7 +87,8 @@ extern int ffs(unsigned long);
# if defined(NO_INLINE) || defined(DO_PROTOTYPES)
-# if !defined(__sparc__) && !defined(__arm32__)
+# if !defined(__sparc__) && !defined(__arm32__) \
+ && !(defined(__alpha__) && defined(linux))
extern void outb(unsigned short, unsigned char);
extern void outw(unsigned short, unsigned short);
@@ -96,7 +97,7 @@ extern unsigned int inb(unsigned short);
extern unsigned int inw(unsigned short);
extern unsigned int inl(unsigned short);
-# else /* __sparc__ */
+# else /* __sparc__, __arm32__, __alpha__*/
extern void outb(unsigned long, unsigned char);
extern void outw(unsigned long, unsigned short);
@@ -105,7 +106,7 @@ extern unsigned int inb(unsigned long);
extern unsigned int inw(unsigned long);
extern unsigned int inl(unsigned long);
-# endif /* __sparc__ */
+# endif /* __sparc__, __arm32__, __alpha__ */
extern unsigned long ldq_u(unsigned long *);
extern unsigned long ldl_u(unsigned int *);
@@ -124,60 +125,62 @@ extern unsigned short ldw_brx(volatile unsigned char *, int);
# ifndef NO_INLINE
# ifdef __GNUC__
-# if (defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__)) && defined(__alpha__)
-# ifdef linux
+# if (defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) && defined(__alpha__)
+# ifdef linux
/* for Linux on Alpha, we use the LIBC _inx/_outx routines */
/* note that the appropriate setup via "ioperm" needs to be done */
/* *before* any inx/outx is done. */
-extern void _outb(char val, unsigned short port);
+extern void (*_alpha_outb)(char val, unsigned long port);
static __inline__ void
-outb(unsigned short port, unsigned char val)
+outb(unsigned long port, unsigned char val)
{
- _outb(val, port);
+ _alpha_outb(val, port);
}
-extern void _outw(short val, unsigned short port);
+extern void (*_alpha_outw)(short val, unsigned long port);
static __inline__ void
-outw(unsigned short port, unsigned short val)
+outw(unsigned long port, unsigned short val)
{
- _outw(val, port);
+ _alpha_outw(val, port);
}
-extern void _outl(int val, unsigned short port);
+extern void (*_alpha_outl)(int val, unsigned long port);
static __inline__ void
-outl(unsigned short port, unsigned int val)
+outl(unsigned long port, unsigned int val)
{
- _outl(val, port);
+ _alpha_outl(val, port);
}
-extern unsigned int _inb(unsigned short port);
+extern unsigned int (*_alpha_inb)(unsigned long port);
static __inline__ unsigned int
-inb(unsigned short port)
+inb(unsigned long port)
{
- return _inb(port);
+ return _alpha_inb(port);
}
-extern unsigned int _inw(unsigned short port);
+extern unsigned int (*_alpha_inw)(unsigned long port);
static __inline__ unsigned int
-inw(unsigned short port)
+inw(unsigned long port)
{
- return _inw(port);
+ return _alpha_inw(port);
}
-extern unsigned int _inl(unsigned short port);
+extern unsigned int (*_alpha_inl)(unsigned long port);
static __inline__ unsigned int
-inl(unsigned short port)
+inl(unsigned long port)
{
- return _inl(port);
+ return _alpha_inl(port);
}
# endif /* linux */
-# if defined(__FreeBSD__) && !defined(DO_PROTOTYPES)
+# if (defined(__FreeBSD__) || defined(__OpenBSD__)) \
+ && !defined(DO_PROTOTYPES)
-/* for FreeBSD on Alpha, we use the libio inx/outx routines */
+/* for FreeBSD and OpenBSD on Alpha, we use the libio (resp. libalpha) */
+/* inx/outx routines */
/* note that the appropriate setup via "ioperm" needs to be done */
/* *before* any inx/outx is done. */
@@ -188,7 +191,8 @@ extern unsigned char inb(unsigned int port);
extern unsigned short inw(unsigned int port);
extern unsigned int inl(unsigned int port);
-# endif /* __FreeBSD__ && !DO_PROTOTYPES */
+# endif /* (__FreeBSD__ || __OpenBSD__ ) && !DO_PROTOTYPES */
+
#if defined(__NetBSD__)
#include <machine/pio.h>
@@ -215,7 +219,7 @@ struct __una_u16 { unsigned short x __attribute__((packed)); };
static __inline__ unsigned long ldq_u(unsigned long * r11)
{
-# if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
const struct __una_u64 *ptr = (const struct __una_u64 *) r11;
return ptr->x;
# else
@@ -234,7 +238,7 @@ static __inline__ unsigned long ldq_u(unsigned long * r11)
static __inline__ unsigned long ldl_u(unsigned int * r11)
{
-# if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
const struct __una_u32 *ptr = (const struct __una_u32 *) r11;
return ptr->x;
# else
@@ -253,7 +257,7 @@ static __inline__ unsigned long ldl_u(unsigned int * r11)
static __inline__ unsigned long ldw_u(unsigned short * r11)
{
-# if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
const struct __una_u16 *ptr = (const struct __una_u16 *) r11;
return ptr->x;
# else
@@ -276,7 +280,7 @@ static __inline__ unsigned long ldw_u(unsigned short * r11)
static __inline__ void stq_u(unsigned long r5, unsigned long * r11)
{
-# if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
struct __una_u64 *ptr = (struct __una_u64 *) r11;
ptr->x = r5;
# else
@@ -301,7 +305,7 @@ static __inline__ void stq_u(unsigned long r5, unsigned long * r11)
static __inline__ void stl_u(unsigned long r5, unsigned int * r11)
{
-# if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
struct __una_u32 *ptr = (struct __una_u32 *) r11;
ptr->x = r5;
# else
@@ -326,7 +330,7 @@ static __inline__ void stl_u(unsigned long r5, unsigned int * r11)
static __inline__ void stw_u(unsigned long r5, unsigned short * r11)
{
-# if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
struct __una_u16 *ptr = (struct __una_u16 *) r11;
ptr->x = r5;
# else
@@ -766,7 +770,7 @@ struct __una_u16 { unsigned short x __attribute__((packed)); };
static __inline__ unsigned long ldq_u(unsigned long *p)
{
-# if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
# if defined(__arch64__) || defined(__sparcv9)
const struct __una_u64 *ptr = (const struct __una_u64 *) p;
# else
@@ -782,7 +786,7 @@ static __inline__ unsigned long ldq_u(unsigned long *p)
static __inline__ unsigned long ldl_u(unsigned int *p)
{
-# if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
const struct __una_u32 *ptr = (const struct __una_u32 *) p;
return ptr->x;
# else
@@ -794,7 +798,7 @@ static __inline__ unsigned long ldl_u(unsigned int *p)
static __inline__ unsigned long ldw_u(unsigned short *p)
{
-# if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
const struct __una_u16 *ptr = (const struct __una_u16 *) p;
return ptr->x;
# else
@@ -806,7 +810,7 @@ static __inline__ unsigned long ldw_u(unsigned short *p)
static __inline__ void stq_u(unsigned long val, unsigned long *p)
{
-# if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
# if defined(__arch64__) || defined(__sparcv9)
struct __una_u64 *ptr = (struct __una_u64 *) p;
# else
@@ -821,7 +825,7 @@ static __inline__ void stq_u(unsigned long val, unsigned long *p)
static __inline__ void stl_u(unsigned long val, unsigned int *p)
{
-# if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
struct __una_u32 *ptr = (struct __una_u32 *) p;
ptr->x = val;
# else
@@ -832,7 +836,7 @@ static __inline__ void stl_u(unsigned long val, unsigned int *p)
static __inline__ void stw_u(unsigned long val, unsigned short *p)
{
-# if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
struct __una_u16 *ptr = (struct __una_u16 *) p;
ptr->x = val;
# else
@@ -1021,7 +1025,7 @@ xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset,
extern volatile unsigned char *ioBase;
-# define eieio() __asm__ __volatile__ ("eieio")
+# define eieio() __asm__ __volatile__ ("eieio" ::: "memory")
static __inline__ unsigned char
xf86ReadMmio8(__volatile__ void *base, const unsigned long offset)
@@ -1237,7 +1241,7 @@ inl(unsigned short port)
# define stw_u(v,p) (*(unsigned char *)(p)) = (v); \
(*((unsigned char *)(p)+1)) = ((v) >> 8)
-# define mem_barrier() eieio()
+# define mem_barrier() eieio()
# define write_mem_barrier() eieio()
# else /* ix86 */