summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2013-02-02 15:42:00 +1000
committerBen Skeggs <bskeggs@redhat.com>2013-06-13 10:38:42 +1000
commit46a7f467eb26e2d1d46f37b8483434835ca2028d (patch)
tree94b9090c8ca40bfbfa04f3968eeb3cc9ae91d426 /bin
parent944a68f7add0d2ac4ed2d7eedfdb72b9da9a5a08 (diff)
downloadnouveau-46a7f467eb26e2d1d46f37b8483434835ca2028d.tar.gz
nv_rdfuc: dumb tool to pull back data from fuc engines
Diffstat (limited to 'bin')
-rw-r--r--bin/Makefile.am2
-rw-r--r--bin/nv_rdfuc.c66
2 files changed, 67 insertions, 1 deletions
diff --git a/bin/Makefile.am b/bin/Makefile.am
index 082fe9724..58f2201a4 100644
--- a/bin/Makefile.am
+++ b/bin/Makefile.am
@@ -4,7 +4,7 @@ bin_PROGRAMS = \
nv_ri08 nv_ri16 nv_ri32 nv_wi08 nv_wi16 nv_wi32 \
nv_rv08 nv_rv16 nv_rv32 nv_wv08 nv_wv16 nv_wv32 \
nv_rs08 nv_rs16 nv_rs32 nv_ws08 nv_ws16 nv_ws32 \
- nv_disp nv_i2c nv_aux nv_init
+ nv_disp nv_i2c nv_aux nv_init nv_rdfuc
AM_CPPFLAGS = -I$(top_srcdir)/nvkm/include \
-I$(top_srcdir)/nvkm \
diff --git a/bin/nv_rdfuc.c b/bin/nv_rdfuc.c
new file mode 100644
index 000000000..540ac4253
--- /dev/null
+++ b/bin/nv_rdfuc.c
@@ -0,0 +1,66 @@
+#include <stdlib.h>
+#include <limits.h>
+#include <unistd.h>
+
+#include <core/os.h>
+#include <core/object.h>
+#include <core/class.h>
+
+int
+main(int argc, char **argv)
+{
+ struct nouveau_object *client;
+ struct nouveau_object *device;
+ u32 fucbase = ~0;
+ int segment = -1;
+ int ret, c, i;
+
+ while ((c = getopt(argc, argv, "-cd")) != -1) {
+ switch (c) {
+ case 'c':
+ segment = 0;
+ break;
+ case 'd':
+ segment = 1;
+ break;
+ case 1:
+ fucbase = strtol(optarg, NULL, 0);
+ break;
+ }
+ }
+
+ if (fucbase == ~0 || segment < 0 || segment > 1)
+ return 1;
+
+ ret = os_client_new(NULL, "info", argc, argv, &client);
+ if (ret)
+ return ret;
+
+ ret = nouveau_object_new(client, ~0, 0, 0x0080,
+ &(struct nv_device_class) {
+ .device = ~0ULL,
+ .disable = ~NV_DEVICE_DISABLE_MMIO,
+ .debug0 = 0,
+ }, sizeof(struct nv_device_class), &device);
+ if (ret)
+ return ret;
+
+ if (segment == 0) {
+ u32 size = (nv_ro32(device, fucbase + 0x0108) & 0x1ff) << 8;
+ nv_wo32(device, fucbase + 0x0180, 0x02000000);
+ for (i = 0; i < size; i += 4) {
+ if (!(i & 0xff))
+ nv_wo32(device, fucbase + 0x0188, i >> 8);
+ printf("0x%08x\n", nv_ro32(device, fucbase + 0x0184));
+ }
+ } else {
+ u32 size = (nv_ro32(device, fucbase + 0x0108) & 0x3fe00) >> 1;
+ nv_wo32(device, fucbase + 0x01c0, 0x02000000);
+ for (i = 0; i < size; i += 4)
+ printf("0x%08x\n", nv_ro32(device, fucbase + 0x01c4));
+ }
+
+
+ os_client_del(&client);
+ return 0;
+}