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(__amd64__)
35 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(__amd64__)
49 if (really_slow_bcopy
) {
50 xf86_really_slow_bcopy(src
, dst
, len
);
62 unsigned long _bus_base(void);
64 #define useSparse() (!_bus_base())
77 xf86SlowBCopyFromBus(unsigned char *src
, unsigned char *dst
, int count
)
83 addr
= (unsigned long) src
;
85 result
= *(volatile int *) addr
;
86 result
>>= ((addr
>> SPARSE
) & 3) * 8;
87 *dst
++ = (unsigned char) (0xffUL
& result
);
94 xf86SlowBcopy(src
, dst
, count
);
98 xf86SlowBCopyToBus(unsigned char *src
, unsigned char *dst
, int count
)
103 addr
= (unsigned long) dst
;
105 *(volatile unsigned int *) addr
=
106 (unsigned short) (*src
) * 0x01010101;
114 xf86SlowBcopy(src
, dst
, count
);