summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2009-10-06 20:58:30 -0400
committerPeter Hutterer <peter.hutterer@who-t.net>2009-10-15 13:54:46 +1000
commita08186fe59f003fc9e1edceb1d95d2e316766e2a (patch)
treed49ab8bd6295716f8c99c715390acb59e1c2340d
parente116bebb1324c5cdb806a70683ca747321c536b0 (diff)
Fix breakage on alpha caused by c7680befe5ae
Pinpointed by by Michael Cree. Commit c7680befe5ae removed Jensen support, but at the same time broke support for dense memory systems. Signed-off-by: Matt Turner <mattst88@gmail.com> (cherry picked from commit 9625f6d328d6f516520930227b218979309938bc)
-rw-r--r--hw/xfree86/os-support/misc/SlowBcopy.c62
1 files changed, 39 insertions, 23 deletions
diff --git a/hw/xfree86/os-support/misc/SlowBcopy.c b/hw/xfree86/os-support/misc/SlowBcopy.c
index 182a3e6ec..0021b5544 100644
--- a/hw/xfree86/os-support/misc/SlowBcopy.c
+++ b/hw/xfree86/os-support/misc/SlowBcopy.c
@@ -59,10 +59,16 @@ xf86SlowBcopy(unsigned char *src, unsigned char *dst, int len)
#ifdef linux
+unsigned long _bus_base(void);
+
+#define useSparse() (!_bus_base())
+
#define SPARSE (7)
#else
+#define useSparse() 0
+
#define SPARSE 0
#endif
@@ -70,32 +76,42 @@ xf86SlowBcopy(unsigned char *src, unsigned char *dst, int len)
void
xf86SlowBCopyFromBus(unsigned char *src, unsigned char *dst, int count)
{
- unsigned long addr;
- long result;
-
- addr = (unsigned long) src;
- while( count ){
- result = *(volatile int *) addr;
- result >>= ((addr>>SPARSE) & 3) * 8;
- *dst++ = (unsigned char) (0xffUL & result);
- addr += 1<<SPARSE;
- count--;
- outb(0x80, 0x00);
- }
+ if (useSparse())
+ {
+ unsigned long addr;
+ long result;
+
+ addr = (unsigned long) src;
+ while (count) {
+ result = *(volatile int *) addr;
+ result >>= ((addr>>SPARSE) & 3) * 8;
+ *dst++ = (unsigned char) (0xffUL & result);
+ addr += 1<<SPARSE;
+ count--;
+ outb(0x80, 0x00);
+ }
+ }
+ else
+ xf86SlowBcopy(src, dst, count);
}
-
+
void
xf86SlowBCopyToBus(unsigned char *src, unsigned char *dst, int count)
{
- unsigned long addr;
-
- addr = (unsigned long) dst;
- while(count) {
- *(volatile unsigned int *) addr = (unsigned short)(*src) * 0x01010101;
- src++;
- addr += 1<<SPARSE;
- count--;
- outb(0x80, 0x00);
- }
+ if (useSparse())
+ {
+ unsigned long addr;
+
+ addr = (unsigned long) dst;
+ while (count) {
+ *(volatile unsigned int *) addr = (unsigned short)(*src) * 0x01010101;
+ src++;
+ addr += 1<<SPARSE;
+ count--;
+ outb(0x80, 0x00);
+ }
+ }
+ else
+ xf86SlowBcopy(src, dst, count);
}
#endif