diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2015-08-20 14:54:15 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2015-08-28 12:37:36 +1000 |
commit | 558d9ac4b06b61f087c2411117096372124c2575 (patch) | |
tree | 2c74dce96d944ec2977096a9900653a6b71cc7dc /bin/nv_rdfuc.c | |
parent | b9b0ad3ef8a6c5354c88a2571da6f5a7e790fdbb (diff) | |
download | nouveau-558d9ac4b06b61f087c2411117096372124c2575.tar.gz |
bin: punt client/device argument handling into a common helper
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'bin/nv_rdfuc.c')
-rw-r--r-- | bin/nv_rdfuc.c | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/bin/nv_rdfuc.c b/bin/nv_rdfuc.c deleted file mode 100644 index 3a422a847..000000000 --- a/bin/nv_rdfuc.c +++ /dev/null @@ -1,72 +0,0 @@ -#include <stdlib.h> -#include <limits.h> -#include <unistd.h> - -#include <nvif/client.h> -#include <nvif/device.h> -#include <nvif/class.h> - -int -main(int argc, char **argv) -{ - const char *drv = "lib"; - const char *cfg = NULL; - const char *dbg = "error"; - u64 dev = ~0ULL; - struct nvif_client *client; - struct nvif_device *device; - u32 fucbase = ~0; - int segment = -1; - int ret, c, i; - - while ((c = getopt(argc, argv, "-a:b:cd")) != -1) { - switch (c) { - case 'a': dev = strtoull(optarg, NULL, 0); break; - case 'b': drv = optarg; break; - 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 = nvif_client_new(drv, argv[0], dev, cfg, dbg, &client); - if (ret) - return ret; - - ret = nvif_device_new(nvif_object(client), 0x00000000, NV_DEVICE, - &(struct nv_device_v0) { - .device = ~0ULL, - .disable = ~NV_DEVICE_V0_DISABLE_MMIO, - .debug0 = 0, - }, sizeof(struct nv_device_v0), &device); - nvif_client_ref(NULL, &client); - if (ret) - return ret; - - if (segment == 0) { - u32 size = (nvif_rd32(device, fucbase + 0x0108) & 0x1ff) << 8; - nvif_wr32(device, fucbase + 0x0180, 0x02000000); - for (i = 0; i < size; i += 4) { - if (!(i & 0xff)) - nvif_wr32(device, fucbase + 0x0188, i >> 8); - printf("0x%08x\n", nvif_rd32(device, fucbase + 0x0184)); - } - } else { - u32 size = (nvif_rd32(device, fucbase + 0x0108) & 0x3fe00) >> 1; - nvif_wr32(device, fucbase + 0x01c0, 0x02000000); - for (i = 0; i < size; i += 4) - printf("0x%08x\n", nvif_rd32(device, fucbase + 0x01c4)); - } - - nvif_device_ref(NULL, &device); - return 0; -} |