summaryrefslogtreecommitdiffstats
path: root/src/broadcom/clif
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2018-06-25 15:37:51 -0700
committerEric Anholt <[email protected]>2018-07-27 17:56:36 -0700
commit95bafeeabfeb1d8348191fa66ed2e5c3b730c54b (patch)
treea8e9cf8e2dd4c0b4b4cd9ef74831c641328fc603 /src/broadcom/clif
parent3c02838d2956692101ae205f1aff362fa3a93c76 (diff)
v3d: Print addresses in CLIFs as references to buffers.
With CLIFs, the parser will choose an address for the buffer being created, so we need to use effectively relocations to buffers instead of the addresses that the driver uses. This is also a whole lot more intelligible for console output than raw addresses!
Diffstat (limited to 'src/broadcom/clif')
-rw-r--r--src/broadcom/clif/clif_dump.c20
-rw-r--r--src/broadcom/clif/clif_private.h3
2 files changed, 18 insertions, 5 deletions
diff --git a/src/broadcom/clif/clif_dump.c b/src/broadcom/clif/clif_dump.c
index f297c774b5a..3b693284e49 100644
--- a/src/broadcom/clif/clif_dump.c
+++ b/src/broadcom/clif/clif_dump.c
@@ -70,20 +70,30 @@ clif_dump_destroy(struct clif_dump *clif)
ralloc_free(clif);
}
-static bool
-clif_lookup_vaddr(struct clif_dump *clif, uint32_t addr, void **vaddr)
+struct clif_bo *
+clif_lookup_bo(struct clif_dump *clif, uint32_t addr)
{
for (int i = 0; i < clif->bo_count; i++) {
struct clif_bo *bo = &clif->bo[i];
if (addr >= bo->offset &&
addr < bo->offset + bo->size) {
- *vaddr = bo->vaddr + addr - bo->offset;
- return true;
+ return bo;
}
}
- return false;
+ return NULL;
+}
+
+static bool
+clif_lookup_vaddr(struct clif_dump *clif, uint32_t addr, void **vaddr)
+{
+ struct clif_bo *bo = clif_lookup_bo(clif, addr);
+ if (!bo)
+ return false;
+
+ *vaddr = bo->vaddr + addr - bo->offset;
+ return true;
}
#define out_uint(_clif, field) out(_clif, " /* %s = */ %u\n", \
diff --git a/src/broadcom/clif/clif_private.h b/src/broadcom/clif/clif_private.h
index da5f2a3cc29..ea96784289a 100644
--- a/src/broadcom/clif/clif_private.h
+++ b/src/broadcom/clif/clif_private.h
@@ -74,6 +74,9 @@ struct reloc_worklist_entry {
};
};
+struct clif_bo *
+clif_lookup_bo(struct clif_dump *clif, uint32_t addr);
+
struct reloc_worklist_entry *
clif_dump_add_address_to_worklist(struct clif_dump *clif,
enum reloc_worklist_type type,