summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Cencora <m.cencora@gmail.com>2007-11-08 22:58:48 +0000
committerOliver McFadden <z3ro.geek@gmail.com>2007-11-08 22:58:48 +0000
commit524886cb602eb4d091133b263ffdf18dd9e04f88 (patch)
tree6517d94242288c350be0262d5af882dda77205b9
parent16b02305d7eeff63dc5b211b5ad95fddc5989928 (diff)
Added initial RS690 GART support.
The RS690 registers were found via reverse engineering.
-rw-r--r--src/revenge_detect.c17
-rw-r--r--src/revenge_detect.h2
-rw-r--r--src/revenge_main.c14
-rw-r--r--src/revenge_main.h12
-rw-r--r--src/revenge_memory.c2
-rw-r--r--src/revenge_register.c19
-rw-r--r--src/revenge_register.h3
7 files changed, 69 insertions, 0 deletions
diff --git a/src/revenge_detect.c b/src/revenge_detect.c
index 5ed41da..6f18e79 100644
--- a/src/revenge_detect.c
+++ b/src/revenge_detect.c
@@ -1,5 +1,6 @@
/*
* $Id$
+ * Copyright (C) 2007 Maciej Cencora <m.cencora@gmail.com>
* Copyright (C) 2007 Oliver McFadden <z3ro.geek@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -153,6 +154,22 @@ detect_pcigart_aperture (void)
}
void
+detect_rs690gart_aperture (void)
+{
+ pcigart_addr = register_read_rs690 (RADEON_RS690GART_BASE_ADDR);
+ pcigart_start = register_read_rs690 (RADEON_RS690GART_START);
+ pcigart_end = register_read_rs690 (RADEON_RS690GART_END);
+ pcigart_len = pcigart_end - pcigart_start;
+
+ if (option_debug)
+ {
+ printf
+ ("%s: pcigart_addr = 0x%08x pcigart_len = 0x%08x pcigart_start = 0x%08x pcigart_end = 0x%08x\n",
+ __func__, pcigart_addr, pcigart_len, pcigart_start, pcigart_end);
+ }
+}
+
+void
detect_igpgart_aperture (void)
{
unsigned int agp_addr;
diff --git a/src/revenge_detect.h b/src/revenge_detect.h
index b53fae2..99de026 100644
--- a/src/revenge_detect.h
+++ b/src/revenge_detect.h
@@ -1,5 +1,6 @@
/*
* $Id$
+ * Copyright (C) 2007 Maciej Cencora <m.cencora@gmail.com>
* Copyright (C) 2007 Oliver McFadden <z3ro.geek@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -39,6 +40,7 @@ extern int gl_max_texture_units;
void detect_agp_aperture (void);
void detect_fb_aperture (void);
void detect_pcigart_aperture (void);
+void detect_rs690gart_aperture (void);
void detect_igpgart_aperture (void);
void detect_reg_aperture (void);
void detect_max_texture_units (void);
diff --git a/src/revenge_main.c b/src/revenge_main.c
index b8d363a..725a7f5 100644
--- a/src/revenge_main.c
+++ b/src/revenge_main.c
@@ -1,6 +1,7 @@
/*
* $Id$
* Copyright (C) 2007 Christoph Brill <egore911@egore911.de>
+ * Copyright (C) 2007 Maciej Cencora <m.cencora@gmail.com>
* Copyright (C) 2007 Oliver McFadden <z3ro.geek@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -103,6 +104,7 @@ static struct option long_options[] = {
{"output", required_argument, 0, 'o'},
{"pci", no_argument, &option_interface, INTERFACE_PCI},
{"pci-e", no_argument, &option_interface, INTERFACE_PCI_E},
+ {"rs690", no_argument, &option_interface, INTERFACE_RS690},
{"verbose", no_argument, &option_verbose, 1},
{0, 0, 0, 0},
};
@@ -216,6 +218,17 @@ main (int argc, char **argv)
exit (EXIT_FAILURE);
}
break;
+ case INTERFACE_RS690:
+ detect_rs690gart_aperture ();
+ if ((pcigart_mem_map =
+ mmap (NULL, pcigart_len, PROT_READ | PROT_WRITE, MAP_SHARED,
+ mem_fd, pcigart_addr)) == MAP_FAILED)
+ {
+ fprintf (stderr, "%s: %s\n", program_invocation_short_name,
+ strerror (errno));
+ exit (EXIT_FAILURE);
+ }
+ break;
default:
assert (0);
break;
@@ -272,6 +285,7 @@ main (int argc, char **argv)
case INTERFACE_IGP:
case INTERFACE_PCI:
case INTERFACE_PCI_E:
+ case INTERFACE_RS690:
if (munmap (pcigart_mem_map, pcigart_len) < 0)
{
fprintf (stderr, "%s: %s\n", program_invocation_short_name,
diff --git a/src/revenge_main.h b/src/revenge_main.h
index a79c990..31f9bad 100644
--- a/src/revenge_main.h
+++ b/src/revenge_main.h
@@ -1,5 +1,6 @@
/*
* $Id$
+ * Copyright (C) 2007 Maciej Cencora <m.cencora@gmail.com>
* Copyright (C) 2007 Oliver McFadden <z3ro.geek@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -29,6 +30,7 @@ enum interface_t
INTERFACE_IGP,
INTERFACE_PCI,
INTERFACE_PCI_E,
+ INTERFACE_RS690,
};
#define AVIVO_CRTC1_FB_LOCATION 0x6110
@@ -113,6 +115,16 @@ enum interface_t
#define RADEON_IGPGART_ENABLE 0x38
#define RADEON_IGPGART_UNK_39 0x39
+#define RADEON_RS690GART_INDEX 0x78
+# define RADEON_RS690GART_INDEX_MASK 0x1ff
+# define RADEON_RS690GART_INDEX_WRITEBIT (1 << 9)
+# define RADEON_RS690GART_INDEX_WRITEACK 0x7f /* write ack value */
+#define RADEON_RS690GART_DATA 0x7c
+
+#define RADEON_RS690GART_BASE_ADDR 0x2c
+#define RADEON_RS690GART_START 0x100
+#define RADEON_RS690GART_END 0x101
+
#define R300_TX_SIZE_0 0x4480
# define R300_TX_WIDTHMASK_SHIFT 0
# define R300_TX_WIDTHMASK_MASK 0x7ff
diff --git a/src/revenge_memory.c b/src/revenge_memory.c
index fd28e04..587a84f 100644
--- a/src/revenge_memory.c
+++ b/src/revenge_memory.c
@@ -62,6 +62,7 @@ memory_gart_to_phys (unsigned int addr)
switch (option_interface)
{
case INTERFACE_IGP:
+ case INTERFACE_RS690:
phys_addr = pcigart_mem_map[num] & ~0xc;
break;
case INTERFACE_PCI:
@@ -165,6 +166,7 @@ memory_read (unsigned int addr, unsigned int size)
case INTERFACE_IGP:
case INTERFACE_PCI:
case INTERFACE_PCI_E:
+ case INTERFACE_RS690:
mem_map = memory_read_pcigart (addr, size);
break;
default:
diff --git a/src/revenge_register.c b/src/revenge_register.c
index 05d1b58..0ac7afc 100644
--- a/src/revenge_register.c
+++ b/src/revenge_register.c
@@ -1,5 +1,6 @@
/*
* $Id$
+ * Copyright (C) 2007 Maciej Cencora <m.cencora@gmail.com>
* Copyright (C) 2007 Oliver McFadden <z3ro.geek@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -52,6 +53,7 @@ unsigned int
register_read_igp (unsigned int key)
{
unsigned int ret;
+
register_write (RADEON_IGPGART_INDEX, key & 0x7f);
ret = register_read (RADEON_IGPGART_DATA);
register_write (RADEON_IGPGART_INDEX, 0x7f);
@@ -65,3 +67,20 @@ register_write_igp (unsigned int key, unsigned int val)
register_write (RADEON_IGPGART_DATA, val);
register_write (RADEON_IGPGART_INDEX, 0x7f);
}
+
+unsigned int
+register_read_rs690 (unsigned int key)
+{
+ register_write (RADEON_RS690GART_INDEX, key & RADEON_RS690GART_INDEX_MASK);
+ return register_read (RADEON_RS690GART_DATA);
+}
+
+void
+register_write_rs690 (unsigned int key, unsigned int val)
+{
+ register_write (RADEON_RS690GART_INDEX,
+ (key & RADEON_RS690GART_INDEX_MASK) |
+ RADEON_RS690GART_INDEX_WRITEBIT);
+ register_write (RADEON_RS690GART_DATA, val);
+ register_write (RADEON_RS690GART_INDEX, RADEON_RS690GART_INDEX_WRITEACK);
+}
diff --git a/src/revenge_register.h b/src/revenge_register.h
index 59e624e..1438420 100644
--- a/src/revenge_register.h
+++ b/src/revenge_register.h
@@ -1,5 +1,6 @@
/*
* $Id$
+ * Copyright (C) 2007 Maciej Cencora <m.cencora@gmail.com>
* Copyright (C) 2007 Oliver McFadden <z3ro.geek@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -29,5 +30,7 @@ unsigned int register_read_pcie (unsigned int key);
void register_write_pcie (unsigned int key, unsigned int val);
unsigned int register_read_igp (unsigned int key);
void register_write_igp (unsigned int key, unsigned int val);
+unsigned int register_read_rs690 (unsigned int key);
+void register_write_rs690 (unsigned int key, unsigned int val);
#endif