summaryrefslogtreecommitdiff
path: root/avivotool.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2008-11-11 09:23:23 +1000
committerDave Airlie <airlied@linux.ie>2008-11-11 09:23:23 +1000
commita57f3bfe041781627106920ac8d9140c9758be1a (patch)
treec1f316b77fd498bf40c3833c0fd3e3b9a224cb5a /avivotool.c
parent76bb1d39d22b64471d92d9eac7f57ad9623b7baf (diff)
add more ram dumping stuff
Diffstat (limited to 'avivotool.c')
-rw-r--r--avivotool.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/avivotool.c b/avivotool.c
index 3e48f62..745436c 100644
--- a/avivotool.c
+++ b/avivotool.c
@@ -34,6 +34,11 @@
#include "radeon_reg.h"
#include "xf86i2c.h"
+struct atom_context *atom_init(void *bios);
+void atom_dump(struct atom_context *ctx);
+
+static struct atom_context *atom_ctx;
+
int debug;
int debug_i2c = 1;
int skip;
@@ -54,11 +59,12 @@ unsigned int ctrl_region, fb_region;
unsigned char * volatile ctrl_mem;
unsigned char * volatile fb_mem;
+
static void fatal(char *why)
{
fprintf(stderr, why);
pci_system_cleanup();
- exit(-1);
+
}
static void radeon_set(unsigned long offset, const char *name, unsigned int value)
@@ -1398,7 +1404,7 @@ void radeon_reg_set(const char *inname, unsigned int value)
}
/* Find and map the buffers. */
-static void map_radeon_mem(void)
+static int map_radeon_mem(void)
{
#if 0
struct pci_id_match match;
@@ -1467,9 +1473,11 @@ static void map_radeon_mem(void)
}
}
- if (!avivo_device)
- fatal("cannot find Radeon device\n");
-
+ if (!avivo_device){
+ printf("cannot find Radeon device\n");
+ return -1;
+ }
+
if (pci_device_map_region(avivo_device, ctrl_region, 1) != 0)
fatal("mapping ctrl region\n");
ctrl_mem = avivo_device->regions[ctrl_region].memory;
@@ -1887,7 +1895,8 @@ void radeon_rom_tables(const char * file)
radeon_rom_atom_tmds_pll(bios, master);
radeon_rom_atom_lvds(bios, master);
- atom_dump(bios);
+ atom_ctx = atom_init(bios);
+ atom_dump(atom_ctx);
// add more ...
}
else {
@@ -1901,6 +1910,7 @@ void radeon_rom_tables(const char * file)
int main(int argc, char *argv[])
{
+ int ret;
if (argc == 1)
usage();
@@ -1916,8 +1926,10 @@ int main(int argc, char *argv[])
argc--;
}
+ ret = map_radeon_mem();
if (strcmp(argv[1], "romtables") != 0) {
- map_radeon_mem();
+ if (ret!=0)
+ fatal("Unable to see card\n");
}
if (argc == 2) {