diff options
author | Oliver McFadden <z3ro.geek@gmail.com> | 2007-11-01 17:49:21 +0000 |
---|---|---|
committer | Oliver McFadden <z3ro.geek@gmail.com> | 2007-11-01 17:49:21 +0000 |
commit | c4a3a2f8173b515bf03feb95e565fcc77e169b90 (patch) | |
tree | c0e9ec50e44ca355ed9bf41e5c00f276cd1bd520 | |
parent | 2d69856d89a28b6726d7dc63be5cb0f63d44fa83 (diff) |
Added completely untested PCI interface support...
-rw-r--r-- | src/revenge_main.c | 17 | ||||
-rw-r--r-- | src/revenge_main.h | 1 | ||||
-rw-r--r-- | src/revenge_memory.c | 17 |
3 files changed, 26 insertions, 9 deletions
diff --git a/src/revenge_main.c b/src/revenge_main.c index 4a54fcc..b8d363a 100644 --- a/src/revenge_main.c +++ b/src/revenge_main.c @@ -101,6 +101,7 @@ static struct option long_options[] = { {"fast", no_argument, &option_fast, 1}, {"igp", no_argument, &option_interface, INTERFACE_IGP}, {"output", required_argument, 0, 'o'}, + {"pci", no_argument, &option_interface, INTERFACE_PCI}, {"pci-e", no_argument, &option_interface, INTERFACE_PCI_E}, {"verbose", no_argument, &option_verbose, 1}, {0, 0, 0, 0}, @@ -192,8 +193,8 @@ main (int argc, char **argv) exit (EXIT_FAILURE); } break; - case INTERFACE_PCI_E: - detect_pcigart_aperture (); + case INTERFACE_IGP: + detect_igpgart_aperture (); if ((pcigart_mem_map = mmap (NULL, pcigart_len, PROT_READ | PROT_WRITE, MAP_SHARED, mem_fd, pcigart_addr)) == MAP_FAILED) @@ -203,8 +204,9 @@ main (int argc, char **argv) exit (EXIT_FAILURE); } break; - case INTERFACE_IGP: - detect_igpgart_aperture (); + case INTERFACE_PCI: + case INTERFACE_PCI_E: + detect_pcigart_aperture (); if ((pcigart_mem_map = mmap (NULL, pcigart_len, PROT_READ | PROT_WRITE, MAP_SHARED, mem_fd, pcigart_addr)) == MAP_FAILED) @@ -267,9 +269,9 @@ main (int argc, char **argv) exit (EXIT_FAILURE); } break; - case INTERFACE_PCI_E: case INTERFACE_IGP: - default: + case INTERFACE_PCI: + case INTERFACE_PCI_E: if (munmap (pcigart_mem_map, pcigart_len) < 0) { fprintf (stderr, "%s: %s\n", program_invocation_short_name, @@ -277,6 +279,9 @@ main (int argc, char **argv) exit (EXIT_FAILURE); } break; + default: + assert (0); + break; } if (close (mem_fd) < 0) diff --git a/src/revenge_main.h b/src/revenge_main.h index 39d1d7e..a79c990 100644 --- a/src/revenge_main.h +++ b/src/revenge_main.h @@ -27,6 +27,7 @@ enum interface_t { INTERFACE_AGP, INTERFACE_IGP, + INTERFACE_PCI, INTERFACE_PCI_E, }; diff --git a/src/revenge_memory.c b/src/revenge_memory.c index 7a9edc8..fd28e04 100644 --- a/src/revenge_memory.c +++ b/src/revenge_memory.c @@ -62,11 +62,17 @@ memory_gart_to_phys (unsigned int addr) switch (option_interface) { case INTERFACE_IGP: - phys_addr = (pcigart_mem_map[num] & ~0xc); + phys_addr = pcigart_mem_map[num] & ~0xc; break; - default: + case INTERFACE_PCI: + phys_addr = pcigart_mem_map[num]; + break; + case INTERFACE_PCI_E: phys_addr = (pcigart_mem_map[num] & ~0xc) << 8; break; + default: + assert (0); + break; } phys_addr = phys_addr & ~(ATI_PCIGART_PAGE_SIZE - 1); @@ -156,9 +162,14 @@ memory_read (unsigned int addr, unsigned int size) case INTERFACE_AGP: mem_map = memory_read_agp (addr, size); break; - default: + case INTERFACE_IGP: + case INTERFACE_PCI: + case INTERFACE_PCI_E: mem_map = memory_read_pcigart (addr, size); break; + default: + assert (0); + break; } return mem_map; |