1 /*******************************************************************************
3 *******************************************************************************/
6 * Create a dependency that should be immune from the effect of register
7 * renaming as is commonly seen in superscalar processors. This should
8 * insert a minimum of 100-ns delays between reads/writes at clock rates
11 * Slowbcopy(char *src, char *dst, int count)
15 #ifdef HAVE_XORG_CONFIG_H
16 #include <xorg-config.h>
22 #include "xf86_OSlib.h"
25 static int really_slow_bcopy
;
28 xf86SetReallySlowBcopy(void)
30 really_slow_bcopy
= 1;
33 #if defined(__i386__) || defined(__x86_64__)
34 static void xf86_really_slow_bcopy(unsigned char *src
, unsigned char *dst
, int len
)
44 /* The outb() isn't needed on my machine, but who knows ... -- ost */
46 xf86SlowBcopy(unsigned char *src
, unsigned char *dst
, int len
)
48 #if defined(__i386__) || defined(__x86_64__)
49 if (really_slow_bcopy
) {
50 xf86_really_slow_bcopy(src
, dst
, len
);
60 * The Jensen lacks dense memory, thus we have to address the bus via
61 * the sparse addressing scheme. Time critical code uses routines from
64 * Martin Ostermann (ost@comnets.rwth-aachen.de) - Apr.-Sep. 1996
69 unsigned long _bus_base(void);
71 #ifdef TEST_JENSEN_CODE /* define to test the Sparse addressing on a non-Jensen */
77 #define isJensen() (!_bus_base())
87 xf86SlowBCopyFromBus(unsigned char *src
, unsigned char *dst
, int count
)
94 addr
= (unsigned long) src
;
96 result
= *(volatile int *) addr
;
97 result
>>= ((addr
>>SPARSE
) & 3) * 8;
98 *dst
++ = (unsigned char) (0xffUL
& result
);
105 xf86SlowBcopy(src
,dst
,count
);
109 xf86SlowBCopyToBus(unsigned char *src
, unsigned char *dst
, int count
)
115 addr
= (unsigned long) dst
;
117 *(volatile unsigned int *) addr
= (unsigned short)(*src
) * 0x01010101;
125 xf86SlowBcopy(src
,dst
,count
);