summaryrefslogtreecommitdiff
path: root/bin/nv_wvfunc.h
blob: ea631fa50e58936ffd7b49fca2bb370a95ec370a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdlib.h>

#include <nvif/device.h>

static void
nv_wvram(struct nvif_device *device, u64 addr, CAST data)
{
	if (device->info.family >= NV_DEVICE_INFO_V0_TESLA &&
	    device->info.family <= NV_DEVICE_INFO_V0_MAXWELL) {
		u32 pmem = nvif_rd32(&device->object, 0x001700);
		nvif_wr32(&device->object, 0x001700, 0x00000000 | (addr >> 16));
		WVRAM(&device->object, 0x700000 + (addr & 0xffffULL), data);
		nvif_wr32(&device->object, 0x001700, pmem);
	} else {
		printk("unsupported chipset\n");
		exit(1);
	}
}

#define WRITE(o,v) nv_wvram(device, (o), (v))
#define DETECT true
#include "nv_wrfunc.h"