summaryrefslogtreecommitdiff
path: root/bin/nv_wrfunc.h
diff options
context:
space:
mode:
Diffstat (limited to 'bin/nv_wrfunc.h')
-rw-r--r--bin/nv_wrfunc.h27
1 files changed, 19 insertions, 8 deletions
diff --git a/bin/nv_wrfunc.h b/bin/nv_wrfunc.h
index eae75c248..c0e24efd1 100644
--- a/bin/nv_wrfunc.h
+++ b/bin/nv_wrfunc.h
@@ -2,8 +2,9 @@
#include <limits.h>
#include <unistd.h>
-#include <core/os.h>
-#include <core/object.h>
+#include <nvif/client.h>
+#include <nvif/device.h>
+#include <nvif/class.h>
#include <core/class.h>
#ifndef ENABLE
@@ -16,16 +17,24 @@
int
MAIN(int argc, char **argv)
{
- struct nouveau_object *client;
- struct nouveau_object *device;
+ const char *drv = NULL;
+ const char *cfg = NULL;
+ const char *dbg = "fatal";
+ u64 dev = ~0ULL;
+ struct nvif_client *client;
+ struct nvif_device *device;
struct nv_device_class args;
char *rstr = NULL;
char *vstr = NULL;
int quiet = 0;
int ret, c;
- while ((c = getopt(argc, argv, "-q")) != -1) {
+ while ((c = getopt(argc, argv, "-a:b:c:d:q")) != -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':
quiet = 1;
break;
@@ -41,7 +50,7 @@ MAIN(int argc, char **argv)
}
}
- ret = os_client_new(NULL, "fatal", argc, argv, &client);
+ ret = nvif_client_new(drv, argv[0], dev, cfg, dbg, &client);
if (ret)
return ret;
@@ -49,8 +58,9 @@ MAIN(int argc, char **argv)
args.disable = ~ENABLE;
args.debug0 = ~DEBUG0;
- ret = nouveau_object_new(client, ~0, 0, 0x0080, &args, sizeof(args),
- &device);
+ ret = nvif_device_new(nvif_object(client), 0, NV_DEVICE_CLASS,
+ &args, sizeof(args), &device);
+ nvif_client_ref(NULL, &client);
if (ret)
return ret;
@@ -97,5 +107,6 @@ MAIN(int argc, char **argv)
}
}
+ nvif_device_ref(NULL, &device);
return 0;
}