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