1
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_noinline.c,v 3.6 2002/01/25 21:56:20 tsi Exp $ */
3
* Copyright 1998 by Metro Link Incorporated
5
* Permission to use, copy, modify, distribute, and sell this software
6
* and its documentation for any purpose is hereby granted without fee,
7
* provided that the above copyright notice appear in all copies and that
8
* both that copyright notice and this permission notice appear in
9
* supporting documentation, and that the name of Metro Link
10
* Incorporated not be used in advertising or publicity pertaining to
11
* distribution of the software without specific, written prior
12
* permission. Metro Link Incorporated makes no representations
13
* about the suitability of this software for any purpose. It is
14
* provided "as is" without express or implied warranty.
16
* METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD
17
* TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
18
* AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE
19
* LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
20
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
21
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
22
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
26
#if /* NO_INLINE && */ defined(__powerpc__)
30
extern volatile unsigned char *ioBase;
35
__asm__ __volatile__ ("eieio");
39
ldl_brx(volatile unsigned char *base, int ndx)
41
register unsigned long tmp = *(volatile unsigned long *)(base+ndx);
42
return( ((tmp & 0x000000ff) << 24) |
43
((tmp & 0x0000ff00) << 8) |
44
((tmp & 0x00ff0000) >> 8) |
45
((tmp & 0xff000000) >> 24) );
49
ldw_brx(volatile unsigned char *base, int ndx)
51
register unsigned short tmp = *(volatile unsigned short *)(base+ndx);
52
return((tmp << 8) | (tmp >> 8));
56
stl_brx(unsigned long val, volatile unsigned char *base, int ndx)
58
unsigned char *p = (unsigned char *)&val;
59
unsigned long tmp = (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | (p[0] << 0);
60
*(volatile unsigned long *)(base+ndx) = tmp;
64
stw_brx(unsigned short val, volatile unsigned char *base, int ndx)
66
unsigned char *p = (unsigned char *)&val;
67
unsigned short tmp = (p[1] << 8) | p[0];
68
*(volatile unsigned short *)(base+ndx) = tmp;
72
outb(IOADDRESS port, unsigned char value)
74
*((volatile unsigned char *)(ioBase + port)) = value; eieio();
78
outw(IOADDRESS port, unsigned short value)
80
stw_brx(value, ioBase, port); eieio();
84
outl(IOADDRESS port, unsigned int value)
86
stl_brx(value, ioBase, port); eieio();
94
val = *((volatile unsigned char *)(ioBase + port)); eieio();
103
val = ldw_brx(ioBase, port); eieio();
112
val = ldl_brx(ioBase, port); eieio();
119
return (((*(unsigned char *)(p)) |
120
(*((unsigned char *)(p)+1)<<8) |
121
(*((unsigned char *)(p)+2)<<16) |
122
(*((unsigned char *)(p)+3)<<24)));
134
return(((*(unsigned char *)(p)) |
135
(*((unsigned char *)(p)+1)<<8)));
139
stl_u(unsigned long v, void *p)
142
(*(unsigned char *)(p)) = (v);
143
(*((unsigned char *)(p)+1)) = ((v) >> 8);
144
(*((unsigned char *)(p)+2)) = ((v) >> 16);
145
(*((unsigned char *)(p)+3)) = ((v) >> 24);
149
stq_u(unsigned long v, void *p)
155
stw_u(unsigned short v, void *p)
157
(*(unsigned char *)(p)) = (v);
158
(*((unsigned char *)(p)+1)) = ((v) >> 8);
165
__asm__ __volatile__("eieio");
169
write_mem_barrier(void)
171
__asm__ __volatile__("eieio");
174
#endif /* NO_INLINE && __powerpc__ */