summaryrefslogtreecommitdiff
path: root/bin/nv_rdfunc.h
diff options
context:
space:
mode:
Diffstat (limited to 'bin/nv_rdfunc.h')
-rw-r--r--bin/nv_rdfunc.h38
1 files changed, 11 insertions, 27 deletions
diff --git a/bin/nv_rdfunc.h b/bin/nv_rdfunc.h
index 4668bf497..c9c2aea22 100644
--- a/bin/nv_rdfunc.h
+++ b/bin/nv_rdfunc.h
@@ -6,23 +6,16 @@
#include <nvif/device.h>
#include <nvif/class.h>
-#ifndef ENABLE
-#define ENABLE NV_DEVICE_V0_DISABLE_MMIO
-#endif
-#ifndef DEBUG0
-#define DEBUG0 0ULL
+#ifndef DETECT
+#define DETECT false
#endif
+#include "util.h"
+
int
main(int argc, char **argv)
{
- const char *drv = "lib";
- const char *cfg = NULL;
- const char *dbg = "fatal";
- u64 dev = ~0ULL;
- struct nvif_client *client;
struct nvif_device *device;
- struct nv_device_v0 args = {};
char *rstr = NULL;
enum {
NORMAL,
@@ -38,12 +31,8 @@ main(int argc, char **argv)
int ndata = 0;
int ret, c;
- while ((c = getopt(argc, argv, "-a:b:c:d:qrw")) != -1) {
+ while ((c = getopt(argc, argv, "-qrw"U_GETOPT)) != -1) {
switch (c) {
- case 'a': dev = strtoull(optarg, NULL, 0); break;
- case 'b': drv = optarg; break;
- case 'c': cfg = optarg; break;
- case 'd': dbg = optarg; break;
case 'q': mode = QUIET; break;
case 'r': mode = RATES; break;
case 'w': mode = WATCH; break;
@@ -52,20 +41,15 @@ main(int argc, char **argv)
return 1;
rstr = optarg;
break;
+ default:
+ if (!u_option(c))
+ return 1;
+ break;
}
}
- ret = nvif_client_new(drv, argv[0], dev, cfg, dbg, &client);
- if (ret)
- return ret;
-
- args.device = ~0ULL;
- args.disable = ~ENABLE;
- args.debug0 = ~DEBUG0;
-
- ret = nvif_device_new(nvif_object(client), 0x00000000, NV_DEVICE,
- &args, sizeof(args), &device);
- nvif_client_ref(NULL, &client);
+ ret = u_device("lib", argv[0], "fatal", DETECT, true, 0,
+ 0x00000000, &device);
if (ret)
return ret;