summaryrefslogtreecommitdiff
path: root/bin/nv_wvfunc.h
diff options
context:
space:
mode:
Diffstat (limited to 'bin/nv_wvfunc.h')
-rw-r--r--bin/nv_wvfunc.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/bin/nv_wvfunc.h b/bin/nv_wvfunc.h
new file mode 100644
index 000000000..1f218ffc6
--- /dev/null
+++ b/bin/nv_wvfunc.h
@@ -0,0 +1,24 @@
+#include <stdlib.h>
+
+#include <core/os.h>
+#include <core/object.h>
+#include <core/device.h>
+
+static void
+nv_wvram(struct nouveau_object *device, u64 addr, CAST data)
+{
+ if (nv_device(device)->card_type >= NV_50 &&
+ nv_device(device)->card_type <= NV_E0) {
+ u32 pmem = nv_ro32(device, 0x001700);
+ nv_wo32(device, 0x001700, 0x00000000 | (addr >> 16));
+ WVRAM(device, 0x700000 + (addr & 0xffffULL), data);
+ nv_wo32(device, 0x001700, pmem);
+ } else {
+ printk("unsupported chipset\n");
+ exit(1);
+ }
+}
+
+#define WRITE(o,v) nv_wvram(device, (o), (v))
+#define ENABLE (NV_DEVICE_DISABLE_MMIO | NV_DEVICE_DISABLE_IDENTIFY)
+#include "nv_wrfunc.h"