Commit 99122035 authored by Alessandro Rubini's avatar Alessandro Rubini

sdbfs/userspace/sdb-read: fix address display for inner levels

This finally allows me to look at the content of an FPGA:

  wrs# sdb-read -l -e 0x70000 -m 0x100000@0x10000000 /dev/mem
  /tmp2/sdb-read: listing format is to be defined
  0000000000000651:e6a542c9 @ 00000000-0007ffff WB4-Crossbar-GSI
  0000000000000651:eef0b198 @ 00000000-0001ffff WB4-Bridge-GSI
  0000000000000651:e6a542c9 @ 00000000-0001ffff   WB4-Crossbar-GSI
  000000000000ce42:66cfeb52 @ 00000000-0000ffff   WB4-BlockRAM
  000000000000ce42:e2d13d04 @ 00010000-000100ff   WR-Periph-UART
  000000000000ce42:65158dc0 @ 00010100-000101ff   WR-Soft-PLL
  000000000000ce42:e503947e @ 00010200-0001021f   WB-SPI.Control
  000000000000ce42:441c5143 @ 00010300-000103ff   WB-GPIO-Port
  000000000000ce42:57494266 @ 00010400-000104ff   WB Simple Timer
  000000000000ce42:de0d8ced @ 00010500-000105ff   WR-PPS-Generator
  000000000000ce42:ba07b9d3 @ 00020000-0002ffff WRSW NIC
  0000000000000651:eef0b198 @ 00030000-00037fff WB4-Bridge-GSI
  0000000000000651:e6a542c9 @ 00030000-00037fff   WB4-Crossbar-GSI
  000000000000ce42:650c2d4f @ 00030000-000300ff   WR-Endpoint
  000000000000ce42:650c2d4f @ 00030400-000304ff   WR-Endpoint
  000000000000ce42:650c2d4f @ 00030800-000308ff   WR-Endpoint
  000000000000ce42:650c2d4f @ 00030c00-00030cff   WR-Endpoint
  [...]
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 088045d8
......@@ -68,7 +68,7 @@ static int do_read(struct sdbfs *fs, int offset, void *buf, int count)
}
/* Boring ascii representation of a device */
static void list_device(struct sdb_device *d, int depth)
static void list_device(struct sdb_device *d, int depth, int base)
{
struct sdb_product *p;
struct sdb_component *c;
......@@ -92,7 +92,7 @@ static void list_device(struct sdb_device *d, int depth)
/* hack: show directory level looking at the internals */
printf("%016llx:%08x @ %08llx-%08llx ",
ntohll(p->vendor_id), ntohl(p->device_id),
ntohll(c->addr_first), ntohll(c->addr_last));
base + ntohll(c->addr_first), base + ntohll(c->addr_last));
for (i = 0; i < depth; i++)
printf(" ");
printf("%.19s\n", p->name);
......@@ -105,7 +105,7 @@ static void do_list(struct sdbfs *fs)
int new = 1;
while ( (d = sdbfs_scan(fs, new)) != NULL) {
list_device(d, fs->depth);
list_device(d, fs->depth, fs->base[fs->depth]);
new = 0;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment