aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2014-09-15 16:20:53 -0400
committerDave Airlie <airlied@redhat.com>2014-09-15 16:20:53 -0400
commit4ac073640a528662a7c072a30e92e70ce00ded33 (patch)
tree8c5394ff496af5edf31d7124a7fab95756b97a75
parent19524f7c59c19854caf5b82d89bc558e38da5790 (diff)
parentcc2a9071458254cb0db6153811734750da0233ea (diff)
Merge branch 'linux-3.18' of git://anongit.freedesktop.org/git/nouveau/linux-2.6 into drm-next
This is the main merge request for Nouveau 3.18, overview: - various bits of roy's gt21x clock work - various bits of kepler memory clock work (don't get too excited, there's at least one more major bit left that's busting higher freqs) - misc fan control improvements - kepler hdmi infoframe fixes - dp audio - l2 cache + cbc improvements * 'linux-3.18' of git://anongit.freedesktop.org/git/nouveau/linux-2.6: (68 commits) drm/gt214-/disp: enable dp audio drm/gt214-/kms: fix hda eld regression drm/g94-/disp: calculate some dp audio constants drm/gt214-/kms: perform hda codec setup on displayport too drm/gk104-/disp: infoframe registers moved yet again on kepler drm/nouveau/bios: parse older ramcfg/timing data like we do newer ones drm/nva3/fb/ram: Per-partition regs drm/nouveau/fb/ram: Support strided regs drm/nv50/fb/ram: Store the number of partitions in the designated fields drm/nv50/kms: Set VBLANK time in modeset script drm/nouveau/bios: Add rammap support for version 1.0 drm/gf100-/pwr/memx: block host and fifo around reclock drm/nouveau/pwr/memx: fix command ordering around block/unblock drm/nouveau/pwr/memx: rename fb off/on to block/unblock drm/nva3/clk: Pause the GPU before reclocking drm/nouveau/gpio: rename g92 class to g94 drm/gk104-/fb/ram: move fb enable/disable to same place as nvidia drm/gk104/fb/ram: twiddle some more bits when reclocking drm/nouveau/bios: parse another large chunk of random memory config data drm/gk104-/fb/ram: perform certain steps only when bios data differs ...
-rw-r--r--drivers/gpu/drm/nouveau/Makefile12
-rw-r--r--drivers/gpu/drm/nouveau/core/core/client.c7
-rw-r--r--drivers/gpu/drm/nouveau/core/core/event.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/core/gpuobj.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/core/ioctl.c3
-rw-r--r--drivers/gpu/drm/nouveau/core/core/mm.c97
-rw-r--r--drivers/gpu/drm/nouveau/core/core/notify.c7
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/device/base.c3
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/device/gm100.c9
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/device/nv50.c37
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/device/nvc0.c24
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/device/nve0.c8
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/base.c6
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/conn.c4
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/gm107.c6
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/hdanva3.c15
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/hdanvd0.c20
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/hdminvd0.c3
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/hdminve0.c83
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/nv50.c129
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/nv50.h10
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/nv84.c4
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/nv94.c4
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/nva0.c4
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/nva3.c4
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c80
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/nve0.c6
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/nvf0.c6
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/outpdp.c4
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/priv.h3
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/fifo/base.c6
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/software/nv50.c3
-rw-r--r--drivers/gpu/drm/nouveau/core/include/core/client.h2
-rw-r--r--drivers/gpu/drm/nouveau/core/include/core/device.h1
-rw-r--r--drivers/gpu/drm/nouveau/core/include/core/event.h3
-rw-r--r--drivers/gpu/drm/nouveau/core/include/core/mm.h12
-rw-r--r--drivers/gpu/drm/nouveau/core/include/core/notify.h5
-rw-r--r--drivers/gpu/drm/nouveau/core/include/engine/fifo.h3
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/bar.h1
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/bios/M0205.h32
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/bios/M0209.h30
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/bios/fan.h8
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/bios/ramcfg.h160
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/bios/rammap.h5
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/bios/therm.h10
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/clock.h1
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/fb.h7
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/fb/regsnv04.h21
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/fuse.h30
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/gpio.h2
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/pwr.h3
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/therm.h1
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bar/base.c38
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/M0205.c136
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/M0209.c137
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c1
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/fan.c93
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/rammap.c74
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/timing.c8
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/clock/base.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/clock/nva3.c303
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/clock/nva3.h10
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/clock/nvaa.c37
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/devinit/fbmem.h18
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/gddr5.c4
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nv20.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nv25.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nv30.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nv35.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nv36.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nv40.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/priv.h1
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/ramfuc.h82
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/ramnv04.c17
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/ramnv50.c24
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/ramnva3.c96
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c9
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/ramnve0.c490
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/sddr2.c94
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/sddr3.c47
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fuse/base.c54
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fuse/g80.c81
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fuse/gf100.c83
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fuse/gm107.c66
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fuse/priv.h9
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/gpio/base.c3
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/gpio/nv94.c (renamed from drivers/gpu/drm/nouveau/core/subdev/gpio/nv92.c)12
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c4
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/gpio/priv.h4
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/i2c/base.c4
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/instmem/nv04.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/ltc/base.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c39
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c5
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/ltc/priv.h2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/pwr/base.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/arith.fuc94
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/kernel.fuc122
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/macros.fuc20
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/memx.fuc133
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nv108.fuc4
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nv108.fuc.h903
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nva3.fuc4
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nva3.fuc.h1270
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvc0.fuc4
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvc0.fuc.h1300
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvd0.fuc4
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvd0.fuc.h869
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/os.h11
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/pwr/memx.c58
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/therm/fan.c9
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/therm/fanpwm.c8
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/therm/gm107.c93
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/therm/nv84.c38
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/therm/nva3.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/therm/nvd0.c4
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/therm/priv.h3
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/vm/base.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_abi16.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_chan.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_chan.h2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_connector.c6
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_connector.h4
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drm.c20
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_fbcon.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_fbcon.h3
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_sysfs.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_sysfs.h2
-rw-r--r--drivers/gpu/drm/nouveau/nv50_display.c40
-rw-r--r--drivers/gpu/drm/nouveau/nvif/class.h9
130 files changed, 5638 insertions, 2464 deletions
diff --git a/drivers/gpu/drm/nouveau/Makefile b/drivers/gpu/drm/nouveau/Makefile
index f5d7f7ce4bc6..12c24c8abf7f 100644
--- a/drivers/gpu/drm/nouveau/Makefile
+++ b/drivers/gpu/drm/nouveau/Makefile
@@ -38,6 +38,7 @@ nouveau-y += core/subdev/bios/dcb.o
38nouveau-y += core/subdev/bios/disp.o 38nouveau-y += core/subdev/bios/disp.o
39nouveau-y += core/subdev/bios/dp.o 39nouveau-y += core/subdev/bios/dp.o
40nouveau-y += core/subdev/bios/extdev.o 40nouveau-y += core/subdev/bios/extdev.o
41nouveau-y += core/subdev/bios/fan.o
41nouveau-y += core/subdev/bios/gpio.o 42nouveau-y += core/subdev/bios/gpio.o
42nouveau-y += core/subdev/bios/i2c.o 43nouveau-y += core/subdev/bios/i2c.o
43nouveau-y += core/subdev/bios/init.o 44nouveau-y += core/subdev/bios/init.o
@@ -51,6 +52,8 @@ nouveau-y += core/subdev/bios/therm.o
51nouveau-y += core/subdev/bios/vmap.o 52nouveau-y += core/subdev/bios/vmap.o
52nouveau-y += core/subdev/bios/volt.o 53nouveau-y += core/subdev/bios/volt.o
53nouveau-y += core/subdev/bios/xpio.o 54nouveau-y += core/subdev/bios/xpio.o
55nouveau-y += core/subdev/bios/M0205.o
56nouveau-y += core/subdev/bios/M0209.o
54nouveau-y += core/subdev/bios/P0260.o 57nouveau-y += core/subdev/bios/P0260.o
55nouveau-y += core/subdev/bus/hwsq.o 58nouveau-y += core/subdev/bus/hwsq.o
56nouveau-y += core/subdev/bus/nv04.o 59nouveau-y += core/subdev/bus/nv04.o
@@ -124,12 +127,17 @@ nouveau-y += core/subdev/fb/ramnvc0.o
124nouveau-y += core/subdev/fb/ramnve0.o 127nouveau-y += core/subdev/fb/ramnve0.o
125nouveau-y += core/subdev/fb/ramgk20a.o 128nouveau-y += core/subdev/fb/ramgk20a.o
126nouveau-y += core/subdev/fb/ramgm107.o 129nouveau-y += core/subdev/fb/ramgm107.o
130nouveau-y += core/subdev/fb/sddr2.o
127nouveau-y += core/subdev/fb/sddr3.o 131nouveau-y += core/subdev/fb/sddr3.o
128nouveau-y += core/subdev/fb/gddr5.o 132nouveau-y += core/subdev/fb/gddr5.o
133nouveau-y += core/subdev/fuse/base.o
134nouveau-y += core/subdev/fuse/g80.o
135nouveau-y += core/subdev/fuse/gf100.o
136nouveau-y += core/subdev/fuse/gm107.o
129nouveau-y += core/subdev/gpio/base.o 137nouveau-y += core/subdev/gpio/base.o
130nouveau-y += core/subdev/gpio/nv10.o 138nouveau-y += core/subdev/gpio/nv10.o
131nouveau-y += core/subdev/gpio/nv50.o 139nouveau-y += core/subdev/gpio/nv50.o
132nouveau-y += core/subdev/gpio/nv92.o 140nouveau-y += core/subdev/gpio/nv94.o
133nouveau-y += core/subdev/gpio/nvd0.o 141nouveau-y += core/subdev/gpio/nvd0.o
134nouveau-y += core/subdev/gpio/nve0.o 142nouveau-y += core/subdev/gpio/nve0.o
135nouveau-y += core/subdev/i2c/base.o 143nouveau-y += core/subdev/i2c/base.o
@@ -190,6 +198,7 @@ nouveau-y += core/subdev/therm/nv50.o
190nouveau-y += core/subdev/therm/nv84.o 198nouveau-y += core/subdev/therm/nv84.o
191nouveau-y += core/subdev/therm/nva3.o 199nouveau-y += core/subdev/therm/nva3.o
192nouveau-y += core/subdev/therm/nvd0.o 200nouveau-y += core/subdev/therm/nvd0.o
201nouveau-y += core/subdev/therm/gm107.o
193nouveau-y += core/subdev/timer/base.o 202nouveau-y += core/subdev/timer/base.o
194nouveau-y += core/subdev/timer/nv04.o 203nouveau-y += core/subdev/timer/nv04.o
195nouveau-y += core/subdev/timer/gk20a.o 204nouveau-y += core/subdev/timer/gk20a.o
@@ -252,6 +261,7 @@ nouveau-y += core/engine/disp/hdanvd0.o
252nouveau-y += core/engine/disp/hdminv84.o 261nouveau-y += core/engine/disp/hdminv84.o
253nouveau-y += core/engine/disp/hdminva3.o 262nouveau-y += core/engine/disp/hdminva3.o
254nouveau-y += core/engine/disp/hdminvd0.o 263nouveau-y += core/engine/disp/hdminvd0.o
264nouveau-y += core/engine/disp/hdminve0.o
255nouveau-y += core/engine/disp/piornv50.o 265nouveau-y += core/engine/disp/piornv50.o
256nouveau-y += core/engine/disp/sornv50.o 266nouveau-y += core/engine/disp/sornv50.o
257nouveau-y += core/engine/disp/sornv94.o 267nouveau-y += core/engine/disp/sornv94.o
diff --git a/drivers/gpu/drm/nouveau/core/core/client.c b/drivers/gpu/drm/nouveau/core/core/client.c
index 68bf06768123..e962433294c3 100644
--- a/drivers/gpu/drm/nouveau/core/core/client.c
+++ b/drivers/gpu/drm/nouveau/core/core/client.c
@@ -91,9 +91,10 @@ nvkm_client_notify_del(struct nouveau_client *client, int index)
91} 91}
92 92
93int 93int
94nvkm_client_notify_new(struct nouveau_client *client, 94nvkm_client_notify_new(struct nouveau_object *object,
95 struct nvkm_event *event, void *data, u32 size) 95 struct nvkm_event *event, void *data, u32 size)
96{ 96{
97 struct nouveau_client *client = nouveau_client(object);
97 struct nvkm_client_notify *notify; 98 struct nvkm_client_notify *notify;
98 union { 99 union {
99 struct nvif_notify_req_v0 v0; 100 struct nvif_notify_req_v0 v0;
@@ -127,8 +128,8 @@ nvkm_client_notify_new(struct nouveau_client *client,
127 } 128 }
128 129
129 if (ret == 0) { 130 if (ret == 0) {
130 ret = nvkm_notify_init(event, nvkm_client_notify, false, 131 ret = nvkm_notify_init(object, event, nvkm_client_notify,
131 data, size, reply, &notify->n); 132 false, data, size, reply, &notify->n);
132 if (ret == 0) { 133 if (ret == 0) {
133 client->notify[index] = notify; 134 client->notify[index] = notify;
134 notify->client = client; 135 notify->client = client;
diff --git a/drivers/gpu/drm/nouveau/core/core/event.c b/drivers/gpu/drm/nouveau/core/core/event.c
index 0540a48c5678..ff2b434b3db4 100644
--- a/drivers/gpu/drm/nouveau/core/core/event.c
+++ b/drivers/gpu/drm/nouveau/core/core/event.c
@@ -20,7 +20,7 @@
20 * OTHER DEALINGS IN THE SOFTWARE. 20 * OTHER DEALINGS IN THE SOFTWARE.
21 */ 21 */
22 22
23#include <core/os.h> 23#include <core/object.h>
24#include <core/event.h> 24#include <core/event.h>
25 25
26void 26void
diff --git a/drivers/gpu/drm/nouveau/core/core/gpuobj.c b/drivers/gpu/drm/nouveau/core/core/gpuobj.c
index 560b2214cf1c..daee87702502 100644
--- a/drivers/gpu/drm/nouveau/core/core/gpuobj.c
+++ b/drivers/gpu/drm/nouveau/core/core/gpuobj.c
@@ -115,7 +115,7 @@ nouveau_gpuobj_create_(struct nouveau_object *parent,
115 gpuobj->size = size; 115 gpuobj->size = size;
116 116
117 if (heap) { 117 if (heap) {
118 ret = nouveau_mm_head(heap, 1, size, size, 118 ret = nouveau_mm_head(heap, 0, 1, size, size,
119 max(align, (u32)1), &gpuobj->node); 119 max(align, (u32)1), &gpuobj->node);
120 if (ret) 120 if (ret)
121 return ret; 121 return ret;
diff --git a/drivers/gpu/drm/nouveau/core/core/ioctl.c b/drivers/gpu/drm/nouveau/core/core/ioctl.c
index f7e19bfb489c..692aa92dd850 100644
--- a/drivers/gpu/drm/nouveau/core/core/ioctl.c
+++ b/drivers/gpu/drm/nouveau/core/core/ioctl.c
@@ -349,7 +349,6 @@ nvkm_ioctl_unmap(struct nouveau_handle *handle, void *data, u32 size)
349static int 349static int
350nvkm_ioctl_ntfy_new(struct nouveau_handle *handle, void *data, u32 size) 350nvkm_ioctl_ntfy_new(struct nouveau_handle *handle, void *data, u32 size)
351{ 351{
352 struct nouveau_client *client = nouveau_client(handle->object);
353 struct nouveau_object *object = handle->object; 352 struct nouveau_object *object = handle->object;
354 struct nouveau_ofuncs *ofuncs = object->oclass->ofuncs; 353 struct nouveau_ofuncs *ofuncs = object->oclass->ofuncs;
355 union { 354 union {
@@ -365,7 +364,7 @@ nvkm_ioctl_ntfy_new(struct nouveau_handle *handle, void *data, u32 size)
365 if (ret = -ENODEV, ofuncs->ntfy) 364 if (ret = -ENODEV, ofuncs->ntfy)
366 ret = ofuncs->ntfy(object, args->v0.event, &event); 365 ret = ofuncs->ntfy(object, args->v0.event, &event);
367 if (ret == 0) { 366 if (ret == 0) {
368 ret = nvkm_client_notify_new(client, event, data, size); 367 ret = nvkm_client_notify_new(object, event, data, size);
369 if (ret >= 0) { 368 if (ret >= 0) {
370 args->v0.index = ret; 369 args->v0.index = ret;
371 ret = 0; 370 ret = 0;
diff --git a/drivers/gpu/drm/nouveau/core/core/mm.c b/drivers/gpu/drm/nouveau/core/core/mm.c
index 7a4e0891c5f8..b4f5db66d5b5 100644
--- a/drivers/gpu/drm/nouveau/core/core/mm.c
+++ b/drivers/gpu/drm/nouveau/core/core/mm.c
@@ -28,6 +28,24 @@
28#define node(root, dir) ((root)->nl_entry.dir == &mm->nodes) ? NULL : \ 28#define node(root, dir) ((root)->nl_entry.dir == &mm->nodes) ? NULL : \
29 list_entry((root)->nl_entry.dir, struct nouveau_mm_node, nl_entry) 29 list_entry((root)->nl_entry.dir, struct nouveau_mm_node, nl_entry)
30 30
31static void
32nouveau_mm_dump(struct nouveau_mm *mm, const char *header)
33{
34 struct nouveau_mm_node *node;
35
36 printk(KERN_ERR "nouveau: %s\n", header);
37 printk(KERN_ERR "nouveau: node list:\n");
38 list_for_each_entry(node, &mm->nodes, nl_entry) {
39 printk(KERN_ERR "nouveau: \t%08x %08x %d\n",
40 node->offset, node->length, node->type);
41 }
42 printk(KERN_ERR "nouveau: free list:\n");
43 list_for_each_entry(node, &mm->free, fl_entry) {
44 printk(KERN_ERR "nouveau: \t%08x %08x %d\n",
45 node->offset, node->length, node->type);
46 }
47}
48
31void 49void
32nouveau_mm_free(struct nouveau_mm *mm, struct nouveau_mm_node **pthis) 50nouveau_mm_free(struct nouveau_mm *mm, struct nouveau_mm_node **pthis)
33{ 51{
@@ -37,29 +55,29 @@ nouveau_mm_free(struct nouveau_mm *mm, struct nouveau_mm_node **pthis)
37 struct nouveau_mm_node *prev = node(this, prev); 55 struct nouveau_mm_node *prev = node(this, prev);
38 struct nouveau_mm_node *next = node(this, next); 56 struct nouveau_mm_node *next = node(this, next);
39 57
40 if (prev && prev->type == 0) { 58 if (prev && prev->type == NVKM_MM_TYPE_NONE) {
41 prev->length += this->length; 59 prev->length += this->length;
42 list_del(&this->nl_entry); 60 list_del(&this->nl_entry);
43 kfree(this); this = prev; 61 kfree(this); this = prev;
44 } 62 }
45 63
46 if (next && next->type == 0) { 64 if (next && next->type == NVKM_MM_TYPE_NONE) {
47 next->offset = this->offset; 65 next->offset = this->offset;
48 next->length += this->length; 66 next->length += this->length;
49 if (this->type == 0) 67 if (this->type == NVKM_MM_TYPE_NONE)
50 list_del(&this->fl_entry); 68 list_del(&this->fl_entry);
51 list_del(&this->nl_entry); 69 list_del(&this->nl_entry);
52 kfree(this); this = NULL; 70 kfree(this); this = NULL;
53 } 71 }
54 72
55 if (this && this->type != 0) { 73 if (this && this->type != NVKM_MM_TYPE_NONE) {
56 list_for_each_entry(prev, &mm->free, fl_entry) { 74 list_for_each_entry(prev, &mm->free, fl_entry) {
57 if (this->offset < prev->offset) 75 if (this->offset < prev->offset)
58 break; 76 break;
59 } 77 }
60 78
61 list_add_tail(&this->fl_entry, &prev->fl_entry); 79 list_add_tail(&this->fl_entry, &prev->fl_entry);
62 this->type = 0; 80 this->type = NVKM_MM_TYPE_NONE;
63 } 81 }
64 } 82 }
65 83
@@ -80,27 +98,32 @@ region_head(struct nouveau_mm *mm, struct nouveau_mm_node *a, u32 size)
80 98
81 b->offset = a->offset; 99 b->offset = a->offset;
82 b->length = size; 100 b->length = size;
101 b->heap = a->heap;
83 b->type = a->type; 102 b->type = a->type;
84 a->offset += size; 103 a->offset += size;
85 a->length -= size; 104 a->length -= size;
86 list_add_tail(&b->nl_entry, &a->nl_entry); 105 list_add_tail(&b->nl_entry, &a->nl_entry);
87 if (b->type == 0) 106 if (b->type == NVKM_MM_TYPE_NONE)
88 list_add_tail(&b->fl_entry, &a->fl_entry); 107 list_add_tail(&b->fl_entry, &a->fl_entry);
89 return b; 108 return b;
90} 109}
91 110
92int 111int
93nouveau_mm_head(struct nouveau_mm *mm, u8 type, u32 size_max, u32 size_min, 112nouveau_mm_head(struct nouveau_mm *mm, u8 heap, u8 type, u32 size_max,
94 u32 align, struct nouveau_mm_node **pnode) 113 u32 size_min, u32 align, struct nouveau_mm_node **pnode)
95{ 114{
96 struct nouveau_mm_node *prev, *this, *next; 115 struct nouveau_mm_node *prev, *this, *next;
97 u32 mask = align - 1; 116 u32 mask = align - 1;
98 u32 splitoff; 117 u32 splitoff;
99 u32 s, e; 118 u32 s, e;
100 119
101 BUG_ON(!type); 120 BUG_ON(type == NVKM_MM_TYPE_NONE || type == NVKM_MM_TYPE_HOLE);
102 121
103 list_for_each_entry(this, &mm->free, fl_entry) { 122 list_for_each_entry(this, &mm->free, fl_entry) {
123 if (unlikely(heap != NVKM_MM_HEAP_ANY)) {
124 if (this->heap != heap)
125 continue;
126 }
104 e = this->offset + this->length; 127 e = this->offset + this->length;
105 s = this->offset; 128 s = this->offset;
106 129
@@ -149,27 +172,32 @@ region_tail(struct nouveau_mm *mm, struct nouveau_mm_node *a, u32 size)
149 a->length -= size; 172 a->length -= size;
150 b->offset = a->offset + a->length; 173 b->offset = a->offset + a->length;
151 b->length = size; 174 b->length = size;
175 b->heap = a->heap;
152 b->type = a->type; 176 b->type = a->type;
153 177
154 list_add(&b->nl_entry, &a->nl_entry); 178 list_add(&b->nl_entry, &a->nl_entry);
155 if (b->type == 0) 179 if (b->type == NVKM_MM_TYPE_NONE)
156 list_add(&b->fl_entry, &a->fl_entry); 180 list_add(&b->fl_entry, &a->fl_entry);
157 return b; 181 return b;
158} 182}
159 183
160int 184int
161nouveau_mm_tail(struct nouveau_mm *mm, u8 type, u32 size_max, u32 size_min, 185nouveau_mm_tail(struct nouveau_mm *mm, u8 heap, u8 type, u32 size_max,
162 u32 align, struct nouveau_mm_node **pnode) 186 u32 size_min, u32 align, struct nouveau_mm_node **pnode)
163{ 187{
164 struct nouveau_mm_node *prev, *this, *next; 188 struct nouveau_mm_node *prev, *this, *next;
165 u32 mask = align - 1; 189 u32 mask = align - 1;
166 190
167 BUG_ON(!type); 191 BUG_ON(type == NVKM_MM_TYPE_NONE || type == NVKM_MM_TYPE_HOLE);
168 192
169 list_for_each_entry_reverse(this, &mm->free, fl_entry) { 193 list_for_each_entry_reverse(this, &mm->free, fl_entry) {
170 u32 e = this->offset + this->length; 194 u32 e = this->offset + this->length;
171 u32 s = this->offset; 195 u32 s = this->offset;
172 u32 c = 0, a; 196 u32 c = 0, a;
197 if (unlikely(heap != NVKM_MM_HEAP_ANY)) {
198 if (this->heap != heap)
199 continue;
200 }
173 201
174 prev = node(this, prev); 202 prev = node(this, prev);
175 if (prev && prev->type != type) 203 if (prev && prev->type != type)
@@ -209,9 +237,23 @@ nouveau_mm_tail(struct nouveau_mm *mm, u8 type, u32 size_max, u32 size_min,
209int 237int
210nouveau_mm_init(struct nouveau_mm *mm, u32 offset, u32 length, u32 block) 238nouveau_mm_init(struct nouveau_mm *mm, u32 offset, u32 length, u32 block)
211{ 239{
212 struct nouveau_mm_node *node; 240 struct nouveau_mm_node *node, *prev;
241 u32 next;
213 242
214 if (block) { 243 if (nouveau_mm_initialised(mm)) {
244 prev = list_last_entry(&mm->nodes, typeof(*node), nl_entry);
245 next = prev->offset + prev->length;
246 if (next != offset) {
247 BUG_ON(next > offset);
248 if (!(node = kzalloc(sizeof(*node), GFP_KERNEL)))
249 return -ENOMEM;
250 node->type = NVKM_MM_TYPE_HOLE;
251 node->offset = next;
252 node->length = offset - next;
253 list_add_tail(&node->nl_entry, &mm->nodes);
254 }
255 BUG_ON(block != mm->block_size);
256 } else {
215 INIT_LIST_HEAD(&mm->nodes); 257 INIT_LIST_HEAD(&mm->nodes);
216 INIT_LIST_HEAD(&mm->free); 258 INIT_LIST_HEAD(&mm->free);
217 mm->block_size = block; 259 mm->block_size = block;
@@ -230,25 +272,32 @@ nouveau_mm_init(struct nouveau_mm *mm, u32 offset, u32 length, u32 block)
230 272
231 list_add_tail(&node->nl_entry, &mm->nodes); 273 list_add_tail(&node->nl_entry, &mm->nodes);
232 list_add_tail(&node->fl_entry, &mm->free); 274 list_add_tail(&node->fl_entry, &mm->free);
233 mm->heap_nodes++; 275 node->heap = ++mm->heap_nodes;
234 return 0; 276 return 0;
235} 277}
236 278
237int 279int
238nouveau_mm_fini(struct nouveau_mm *mm) 280nouveau_mm_fini(struct nouveau_mm *mm)
239{ 281{
240 if (nouveau_mm_initialised(mm)) { 282 struct nouveau_mm_node *node, *temp;
241 struct nouveau_mm_node *node, *heap = 283 int nodes = 0;
242 list_first_entry(&mm->nodes, typeof(*heap), nl_entry);
243 int nodes = 0;
244 284
245 list_for_each_entry(node, &mm->nodes, nl_entry) { 285 if (!nouveau_mm_initialised(mm))
246 if (WARN_ON(nodes++ == mm->heap_nodes)) 286 return 0;
287
288 list_for_each_entry(node, &mm->nodes, nl_entry) {
289 if (node->type != NVKM_MM_TYPE_HOLE) {
290 if (++nodes > mm->heap_nodes) {
291 nouveau_mm_dump(mm, "mm not clean!");
247 return -EBUSY; 292 return -EBUSY;
293 }
248 } 294 }
249
250 kfree(heap);
251 } 295 }
252 296
297 list_for_each_entry_safe(node, temp, &mm->nodes, nl_entry) {
298 list_del(&node->nl_entry);
299 kfree(node);
300 }
301 mm->heap_nodes = 0;
253 return 0; 302 return 0;
254} 303}
diff --git a/drivers/gpu/drm/nouveau/core/core/notify.c b/drivers/gpu/drm/nouveau/core/core/notify.c
index 76adb81bdea2..d1bcde55e9d7 100644
--- a/drivers/gpu/drm/nouveau/core/core/notify.c
+++ b/drivers/gpu/drm/nouveau/core/core/notify.c
@@ -134,14 +134,15 @@ nvkm_notify_fini(struct nvkm_notify *notify)
134} 134}
135 135
136int 136int
137nvkm_notify_init(struct nvkm_event *event, int (*func)(struct nvkm_notify *), 137nvkm_notify_init(struct nouveau_object *object, struct nvkm_event *event,
138 bool work, void *data, u32 size, u32 reply, 138 int (*func)(struct nvkm_notify *), bool work,
139 void *data, u32 size, u32 reply,
139 struct nvkm_notify *notify) 140 struct nvkm_notify *notify)
140{ 141{
141 unsigned long flags; 142 unsigned long flags;
142 int ret = -ENODEV; 143 int ret = -ENODEV;
143 if ((notify->event = event), event->refs) { 144 if ((notify->event = event), event->refs) {
144 ret = event->func->ctor(data, size, notify); 145 ret = event->func->ctor(object, data, size, notify);
145 if (ret == 0 && (ret = -EINVAL, notify->size == reply)) { 146 if (ret == 0 && (ret = -EINVAL, notify->size == reply)) {
146 notify->flags = 0; 147 notify->flags = 0;
147 notify->block = 1; 148 notify->block = 1;
diff --git a/drivers/gpu/drm/nouveau/core/engine/device/base.c b/drivers/gpu/drm/nouveau/core/engine/device/base.c
index 8928f7981d4a..0ef5a5713182 100644
--- a/drivers/gpu/drm/nouveau/core/engine/device/base.c
+++ b/drivers/gpu/drm/nouveau/core/engine/device/base.c
@@ -505,7 +505,8 @@ nouveau_device_sclass[] = {
505}; 505};
506 506
507static int 507static int
508nouveau_device_event_ctor(void *data, u32 size, struct nvkm_notify *notify) 508nouveau_device_event_ctor(struct nouveau_object *object, void *data, u32 size,
509 struct nvkm_notify *notify)
509{ 510{
510 if (!WARN_ON(size != 0)) { 511 if (!WARN_ON(size != 0)) {
511 notify->size = 0; 512 notify->size = 0;
diff --git a/drivers/gpu/drm/nouveau/core/engine/device/gm100.c b/drivers/gpu/drm/nouveau/core/engine/device/gm100.c
index 377ec0b8851e..6295668e29a5 100644
--- a/drivers/gpu/drm/nouveau/core/engine/device/gm100.c
+++ b/drivers/gpu/drm/nouveau/core/engine/device/gm100.c
@@ -26,6 +26,7 @@
26#include <subdev/bus.h> 26#include <subdev/bus.h>
27#include <subdev/gpio.h> 27#include <subdev/gpio.h>
28#include <subdev/i2c.h> 28#include <subdev/i2c.h>
29#include <subdev/fuse.h>
29#include <subdev/clock.h> 30#include <subdev/clock.h>
30#include <subdev/therm.h> 31#include <subdev/therm.h>
31#include <subdev/mxm.h> 32#include <subdev/mxm.h>
@@ -62,10 +63,9 @@ gm100_identify(struct nouveau_device *device)
62 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 63 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
63 device->oclass[NVDEV_SUBDEV_GPIO ] = nve0_gpio_oclass; 64 device->oclass[NVDEV_SUBDEV_GPIO ] = nve0_gpio_oclass;
64 device->oclass[NVDEV_SUBDEV_I2C ] = nvd0_i2c_oclass; 65 device->oclass[NVDEV_SUBDEV_I2C ] = nvd0_i2c_oclass;
66 device->oclass[NVDEV_SUBDEV_FUSE ] = &gm107_fuse_oclass;
65 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nve0_clock_oclass; 67 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nve0_clock_oclass;
66#if 0 68 device->oclass[NVDEV_SUBDEV_THERM ] = &gm107_therm_oclass;
67 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
68#endif
69 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 69 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
70 device->oclass[NVDEV_SUBDEV_DEVINIT] = gm107_devinit_oclass; 70 device->oclass[NVDEV_SUBDEV_DEVINIT] = gm107_devinit_oclass;
71 device->oclass[NVDEV_SUBDEV_MC ] = gk20a_mc_oclass; 71 device->oclass[NVDEV_SUBDEV_MC ] = gk20a_mc_oclass;
@@ -77,8 +77,9 @@ gm100_identify(struct nouveau_device *device)
77 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass; 77 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass;
78 device->oclass[NVDEV_SUBDEV_VM ] = &nvc0_vmmgr_oclass; 78 device->oclass[NVDEV_SUBDEV_VM ] = &nvc0_vmmgr_oclass;
79 device->oclass[NVDEV_SUBDEV_BAR ] = &nvc0_bar_oclass; 79 device->oclass[NVDEV_SUBDEV_BAR ] = &nvc0_bar_oclass;
80#if 0
81 device->oclass[NVDEV_SUBDEV_PWR ] = nv108_pwr_oclass; 80 device->oclass[NVDEV_SUBDEV_PWR ] = nv108_pwr_oclass;
81
82#if 0
82 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass; 83 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass;
83#endif 84#endif
84 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvd0_dmaeng_oclass; 85 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvd0_dmaeng_oclass;
diff --git a/drivers/gpu/drm/nouveau/core/engine/device/nv50.c b/drivers/gpu/drm/nouveau/core/engine/device/nv50.c
index 932f84fae459..96f568d1321b 100644
--- a/drivers/gpu/drm/nouveau/core/engine/device/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/engine/device/nv50.c
@@ -26,6 +26,7 @@
26#include <subdev/bus.h> 26#include <subdev/bus.h>
27#include <subdev/gpio.h> 27#include <subdev/gpio.h>
28#include <subdev/i2c.h> 28#include <subdev/i2c.h>
29#include <subdev/fuse.h>
29#include <subdev/clock.h> 30#include <subdev/clock.h>
30#include <subdev/therm.h> 31#include <subdev/therm.h>
31#include <subdev/mxm.h> 32#include <subdev/mxm.h>
@@ -62,6 +63,7 @@ nv50_identify(struct nouveau_device *device)
62 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 63 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
63 device->oclass[NVDEV_SUBDEV_GPIO ] = nv50_gpio_oclass; 64 device->oclass[NVDEV_SUBDEV_GPIO ] = nv50_gpio_oclass;
64 device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass; 65 device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass;
66 device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass;
65 device->oclass[NVDEV_SUBDEV_CLOCK ] = nv50_clock_oclass; 67 device->oclass[NVDEV_SUBDEV_CLOCK ] = nv50_clock_oclass;
66 device->oclass[NVDEV_SUBDEV_THERM ] = &nv50_therm_oclass; 68 device->oclass[NVDEV_SUBDEV_THERM ] = &nv50_therm_oclass;
67 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 69 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
@@ -87,6 +89,7 @@ nv50_identify(struct nouveau_device *device)
87 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 89 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
88 device->oclass[NVDEV_SUBDEV_GPIO ] = nv50_gpio_oclass; 90 device->oclass[NVDEV_SUBDEV_GPIO ] = nv50_gpio_oclass;
89 device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass; 91 device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass;
92 device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass;
90 device->oclass[NVDEV_SUBDEV_CLOCK ] = nv84_clock_oclass; 93 device->oclass[NVDEV_SUBDEV_CLOCK ] = nv84_clock_oclass;
91 device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; 94 device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass;
92 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 95 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
@@ -115,6 +118,7 @@ nv50_identify(struct nouveau_device *device)
115 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 118 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
116 device->oclass[NVDEV_SUBDEV_GPIO ] = nv50_gpio_oclass; 119 device->oclass[NVDEV_SUBDEV_GPIO ] = nv50_gpio_oclass;
117 device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass; 120 device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass;
121 device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass;
118 device->oclass[NVDEV_SUBDEV_CLOCK ] = nv84_clock_oclass; 122 device->oclass[NVDEV_SUBDEV_CLOCK ] = nv84_clock_oclass;
119 device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; 123 device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass;
120 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 124 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
@@ -141,8 +145,9 @@ nv50_identify(struct nouveau_device *device)
141 case 0x92: 145 case 0x92:
142 device->cname = "G92"; 146 device->cname = "G92";
143 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 147 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
144 device->oclass[NVDEV_SUBDEV_GPIO ] = nv92_gpio_oclass; 148 device->oclass[NVDEV_SUBDEV_GPIO ] = nv50_gpio_oclass;
145 device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass; 149 device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass;
150 device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass;
146 device->oclass[NVDEV_SUBDEV_CLOCK ] = nv84_clock_oclass; 151 device->oclass[NVDEV_SUBDEV_CLOCK ] = nv84_clock_oclass;
147 device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; 152 device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass;
148 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 153 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
@@ -169,8 +174,9 @@ nv50_identify(struct nouveau_device *device)
169 case 0x94: 174 case 0x94:
170 device->cname = "G94"; 175 device->cname = "G94";
171 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 176 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
172 device->oclass[NVDEV_SUBDEV_GPIO ] = nv92_gpio_oclass; 177 device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass;
173 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; 178 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass;
179 device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass;
174 device->oclass[NVDEV_SUBDEV_CLOCK ] = nv84_clock_oclass; 180 device->oclass[NVDEV_SUBDEV_CLOCK ] = nv84_clock_oclass;
175 device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; 181 device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass;
176 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 182 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
@@ -197,8 +203,9 @@ nv50_identify(struct nouveau_device *device)
197 case 0x96: 203 case 0x96:
198 device->cname = "G96"; 204 device->cname = "G96";
199 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 205 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
200 device->oclass[NVDEV_SUBDEV_GPIO ] = nv92_gpio_oclass; 206 device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass;
201 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; 207 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass;
208 device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass;
202 device->oclass[NVDEV_SUBDEV_CLOCK ] = nv84_clock_oclass; 209 device->oclass[NVDEV_SUBDEV_CLOCK ] = nv84_clock_oclass;
203 device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; 210 device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass;
204 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 211 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
@@ -225,8 +232,9 @@ nv50_identify(struct nouveau_device *device)
225 case 0x98: 232 case 0x98:
226 device->cname = "G98"; 233 device->cname = "G98";
227 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 234 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
228 device->oclass[NVDEV_SUBDEV_GPIO ] = nv92_gpio_oclass; 235 device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass;
229 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; 236 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass;
237 device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass;
230 device->oclass[NVDEV_SUBDEV_CLOCK ] = nv84_clock_oclass; 238 device->oclass[NVDEV_SUBDEV_CLOCK ] = nv84_clock_oclass;
231 device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; 239 device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass;
232 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 240 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
@@ -253,8 +261,9 @@ nv50_identify(struct nouveau_device *device)
253 case 0xa0: 261 case 0xa0:
254 device->cname = "G200"; 262 device->cname = "G200";
255 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 263 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
256 device->oclass[NVDEV_SUBDEV_GPIO ] = nv92_gpio_oclass; 264 device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass;
257 device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass; 265 device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass;
266 device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass;
258 device->oclass[NVDEV_SUBDEV_CLOCK ] = nv84_clock_oclass; 267 device->oclass[NVDEV_SUBDEV_CLOCK ] = nv84_clock_oclass;
259 device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; 268 device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass;
260 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 269 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
@@ -281,8 +290,9 @@ nv50_identify(struct nouveau_device *device)
281 case 0xaa: 290 case 0xaa:
282 device->cname = "MCP77/MCP78"; 291 device->cname = "MCP77/MCP78";
283 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 292 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
284 device->oclass[NVDEV_SUBDEV_GPIO ] = nv92_gpio_oclass; 293 device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass;
285 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; 294 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass;
295 device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass;
286 device->oclass[NVDEV_SUBDEV_CLOCK ] = nvaa_clock_oclass; 296 device->oclass[NVDEV_SUBDEV_CLOCK ] = nvaa_clock_oclass;
287 device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; 297 device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass;
288 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 298 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
@@ -309,8 +319,9 @@ nv50_identify(struct nouveau_device *device)
309 case 0xac: 319 case 0xac:
310 device->cname = "MCP79/MCP7A"; 320 device->cname = "MCP79/MCP7A";
311 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 321 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
312 device->oclass[NVDEV_SUBDEV_GPIO ] = nv92_gpio_oclass; 322 device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass;
313 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; 323 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass;
324 device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass;
314 device->oclass[NVDEV_SUBDEV_CLOCK ] = nvaa_clock_oclass; 325 device->oclass[NVDEV_SUBDEV_CLOCK ] = nvaa_clock_oclass;
315 device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; 326 device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass;
316 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 327 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
@@ -337,8 +348,9 @@ nv50_identify(struct nouveau_device *device)
337 case 0xa3: 348 case 0xa3:
338 device->cname = "GT215"; 349 device->cname = "GT215";
339 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 350 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
340 device->oclass[NVDEV_SUBDEV_GPIO ] = nv92_gpio_oclass; 351 device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass;
341 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; 352 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass;
353 device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass;
342 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nva3_clock_oclass; 354 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nva3_clock_oclass;
343 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; 355 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
344 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 356 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
@@ -367,8 +379,9 @@ nv50_identify(struct nouveau_device *device)
367 case 0xa5: 379 case 0xa5:
368 device->cname = "GT216"; 380 device->cname = "GT216";
369 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 381 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
370 device->oclass[NVDEV_SUBDEV_GPIO ] = nv92_gpio_oclass; 382 device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass;
371 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; 383 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass;
384 device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass;
372 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nva3_clock_oclass; 385 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nva3_clock_oclass;
373 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; 386 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
374 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 387 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
@@ -396,8 +409,9 @@ nv50_identify(struct nouveau_device *device)
396 case 0xa8: 409 case 0xa8:
397 device->cname = "GT218"; 410 device->cname = "GT218";
398 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 411 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
399 device->oclass[NVDEV_SUBDEV_GPIO ] = nv92_gpio_oclass; 412 device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass;
400 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; 413 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass;
414 device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass;
401 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nva3_clock_oclass; 415 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nva3_clock_oclass;
402 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; 416 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
403 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 417 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
@@ -425,8 +439,9 @@ nv50_identify(struct nouveau_device *device)
425 case 0xaf: 439 case 0xaf:
426 device->cname = "MCP89"; 440 device->cname = "MCP89";
427 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 441 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
428 device->oclass[NVDEV_SUBDEV_GPIO ] = nv92_gpio_oclass; 442 device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass;
429 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; 443 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass;
444 device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass;
430 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nva3_clock_oclass; 445 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nva3_clock_oclass;
431 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; 446 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
432 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 447 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
diff --git a/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c
index b4a2917ce555..cd05677ad4b7 100644
--- a/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c
@@ -26,6 +26,7 @@
26#include <subdev/bus.h> 26#include <subdev/bus.h>
27#include <subdev/gpio.h> 27#include <subdev/gpio.h>
28#include <subdev/i2c.h> 28#include <subdev/i2c.h>
29#include <subdev/fuse.h>
29#include <subdev/clock.h> 30#include <subdev/clock.h>
30#include <subdev/therm.h> 31#include <subdev/therm.h>
31#include <subdev/mxm.h> 32#include <subdev/mxm.h>
@@ -60,8 +61,9 @@ nvc0_identify(struct nouveau_device *device)
60 case 0xc0: 61 case 0xc0:
61 device->cname = "GF100"; 62 device->cname = "GF100";
62 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 63 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
63 device->oclass[NVDEV_SUBDEV_GPIO ] = nv92_gpio_oclass; 64 device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass;
64 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; 65 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass;
66 device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
65 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass; 67 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass;
66 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; 68 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
67 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 69 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
@@ -92,8 +94,9 @@ nvc0_identify(struct nouveau_device *device)
92 case 0xc4: 94 case 0xc4:
93 device->cname = "GF104"; 95 device->cname = "GF104";
94 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 96 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
95 device->oclass[NVDEV_SUBDEV_GPIO ] = nv92_gpio_oclass; 97 device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass;
96 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; 98 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass;
99 device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
97 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass; 100 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass;
98 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; 101 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
99 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 102 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
@@ -124,8 +127,9 @@ nvc0_identify(struct nouveau_device *device)
124 case 0xc3: 127 case 0xc3:
125 device->cname = "GF106"; 128 device->cname = "GF106";
126 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 129 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
127 device->oclass[NVDEV_SUBDEV_GPIO ] = nv92_gpio_oclass; 130 device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass;
128 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; 131 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass;
132 device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
129 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass; 133 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass;
130 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; 134 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
131 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 135 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
@@ -155,8 +159,9 @@ nvc0_identify(struct nouveau_device *device)
155 case 0xce: 159 case 0xce:
156 device->cname = "GF114"; 160 device->cname = "GF114";
157 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 161 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
158 device->oclass[NVDEV_SUBDEV_GPIO ] = nv92_gpio_oclass; 162 device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass;
159 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; 163 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass;
164 device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
160 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass; 165 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass;
161 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; 166 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
162 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 167 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
@@ -187,8 +192,9 @@ nvc0_identify(struct nouveau_device *device)
187 case 0xcf: 192 case 0xcf:
188 device->cname = "GF116"; 193 device->cname = "GF116";
189 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 194 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
190 device->oclass[NVDEV_SUBDEV_GPIO ] = nv92_gpio_oclass; 195 device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass;
191 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; 196 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass;
197 device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
192 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass; 198 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass;
193 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; 199 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
194 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 200 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
@@ -219,8 +225,9 @@ nvc0_identify(struct nouveau_device *device)
219 case 0xc1: 225 case 0xc1:
220 device->cname = "GF108"; 226 device->cname = "GF108";
221 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 227 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
222 device->oclass[NVDEV_SUBDEV_GPIO ] = nv92_gpio_oclass; 228 device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass;
223 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; 229 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass;
230 device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
224 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass; 231 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass;
225 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; 232 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
226 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 233 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
@@ -250,8 +257,9 @@ nvc0_identify(struct nouveau_device *device)
250 case 0xc8: 257 case 0xc8:
251 device->cname = "GF110"; 258 device->cname = "GF110";
252 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 259 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
253 device->oclass[NVDEV_SUBDEV_GPIO ] = nv92_gpio_oclass; 260 device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass;
254 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; 261 device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass;
262 device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
255 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass; 263 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass;
256 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; 264 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
257 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 265 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
@@ -284,6 +292,7 @@ nvc0_identify(struct nouveau_device *device)
284 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 292 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
285 device->oclass[NVDEV_SUBDEV_GPIO ] = nvd0_gpio_oclass; 293 device->oclass[NVDEV_SUBDEV_GPIO ] = nvd0_gpio_oclass;
286 device->oclass[NVDEV_SUBDEV_I2C ] = nvd0_i2c_oclass; 294 device->oclass[NVDEV_SUBDEV_I2C ] = nvd0_i2c_oclass;
295 device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
287 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass; 296 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass;
288 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; 297 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
289 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 298 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
@@ -315,6 +324,7 @@ nvc0_identify(struct nouveau_device *device)
315 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 324 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
316 device->oclass[NVDEV_SUBDEV_GPIO ] = nvd0_gpio_oclass; 325 device->oclass[NVDEV_SUBDEV_GPIO ] = nvd0_gpio_oclass;
317 device->oclass[NVDEV_SUBDEV_I2C ] = gf117_i2c_oclass; 326 device->oclass[NVDEV_SUBDEV_I2C ] = gf117_i2c_oclass;
327 device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
318 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass; 328 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass;
319 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; 329 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
320 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 330 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
diff --git a/drivers/gpu/drm/nouveau/core/engine/device/nve0.c b/drivers/gpu/drm/nouveau/core/engine/device/nve0.c
index cdf9147f32a1..b1b2e484ecfa 100644
--- a/drivers/gpu/drm/nouveau/core/engine/device/nve0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/device/nve0.c
@@ -26,6 +26,7 @@
26#include <subdev/bus.h> 26#include <subdev/bus.h>
27#include <subdev/gpio.h> 27#include <subdev/gpio.h>
28#include <subdev/i2c.h> 28#include <subdev/i2c.h>
29#include <subdev/fuse.h>
29#include <subdev/clock.h> 30#include <subdev/clock.h>
30#include <subdev/therm.h> 31#include <subdev/therm.h>
31#include <subdev/mxm.h> 32#include <subdev/mxm.h>
@@ -62,6 +63,7 @@ nve0_identify(struct nouveau_device *device)
62 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 63 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
63 device->oclass[NVDEV_SUBDEV_GPIO ] = nve0_gpio_oclass; 64 device->oclass[NVDEV_SUBDEV_GPIO ] = nve0_gpio_oclass;
64 device->oclass[NVDEV_SUBDEV_I2C ] = nve0_i2c_oclass; 65 device->oclass[NVDEV_SUBDEV_I2C ] = nve0_i2c_oclass;
66 device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
65 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nve0_clock_oclass; 67 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nve0_clock_oclass;
66 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; 68 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
67 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 69 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
@@ -95,6 +97,7 @@ nve0_identify(struct nouveau_device *device)
95 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 97 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
96 device->oclass[NVDEV_SUBDEV_GPIO ] = nve0_gpio_oclass; 98 device->oclass[NVDEV_SUBDEV_GPIO ] = nve0_gpio_oclass;
97 device->oclass[NVDEV_SUBDEV_I2C ] = nve0_i2c_oclass; 99 device->oclass[NVDEV_SUBDEV_I2C ] = nve0_i2c_oclass;
100 device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
98 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nve0_clock_oclass; 101 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nve0_clock_oclass;
99 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; 102 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
100 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 103 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
@@ -128,6 +131,7 @@ nve0_identify(struct nouveau_device *device)
128 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 131 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
129 device->oclass[NVDEV_SUBDEV_GPIO ] = nve0_gpio_oclass; 132 device->oclass[NVDEV_SUBDEV_GPIO ] = nve0_gpio_oclass;
130 device->oclass[NVDEV_SUBDEV_I2C ] = nve0_i2c_oclass; 133 device->oclass[NVDEV_SUBDEV_I2C ] = nve0_i2c_oclass;
134 device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
131 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nve0_clock_oclass; 135 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nve0_clock_oclass;
132 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; 136 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
133 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 137 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
@@ -161,6 +165,7 @@ nve0_identify(struct nouveau_device *device)
161 device->oclass[NVDEV_SUBDEV_CLOCK ] = &gk20a_clock_oclass; 165 device->oclass[NVDEV_SUBDEV_CLOCK ] = &gk20a_clock_oclass;
162 device->oclass[NVDEV_SUBDEV_MC ] = gk20a_mc_oclass; 166 device->oclass[NVDEV_SUBDEV_MC ] = gk20a_mc_oclass;
163 device->oclass[NVDEV_SUBDEV_BUS ] = nvc0_bus_oclass; 167 device->oclass[NVDEV_SUBDEV_BUS ] = nvc0_bus_oclass;
168 device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
164 device->oclass[NVDEV_SUBDEV_TIMER ] = &gk20a_timer_oclass; 169 device->oclass[NVDEV_SUBDEV_TIMER ] = &gk20a_timer_oclass;
165 device->oclass[NVDEV_SUBDEV_FB ] = gk20a_fb_oclass; 170 device->oclass[NVDEV_SUBDEV_FB ] = gk20a_fb_oclass;
166 device->oclass[NVDEV_SUBDEV_LTC ] = gk104_ltc_oclass; 171 device->oclass[NVDEV_SUBDEV_LTC ] = gk104_ltc_oclass;
@@ -180,6 +185,7 @@ nve0_identify(struct nouveau_device *device)
180 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 185 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
181 device->oclass[NVDEV_SUBDEV_GPIO ] = nve0_gpio_oclass; 186 device->oclass[NVDEV_SUBDEV_GPIO ] = nve0_gpio_oclass;
182 device->oclass[NVDEV_SUBDEV_I2C ] = nve0_i2c_oclass; 187 device->oclass[NVDEV_SUBDEV_I2C ] = nve0_i2c_oclass;
188 device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
183 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nve0_clock_oclass; 189 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nve0_clock_oclass;
184 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; 190 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
185 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 191 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
@@ -213,6 +219,7 @@ nve0_identify(struct nouveau_device *device)
213 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 219 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
214 device->oclass[NVDEV_SUBDEV_GPIO ] = nve0_gpio_oclass; 220 device->oclass[NVDEV_SUBDEV_GPIO ] = nve0_gpio_oclass;
215 device->oclass[NVDEV_SUBDEV_I2C ] = nvd0_i2c_oclass; 221 device->oclass[NVDEV_SUBDEV_I2C ] = nvd0_i2c_oclass;
222 device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
216 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nve0_clock_oclass; 223 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nve0_clock_oclass;
217 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; 224 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
218 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 225 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
@@ -246,6 +253,7 @@ nve0_identify(struct nouveau_device *device)
246 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 253 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
247 device->oclass[NVDEV_SUBDEV_GPIO ] = nve0_gpio_oclass; 254 device->oclass[NVDEV_SUBDEV_GPIO ] = nve0_gpio_oclass;
248 device->oclass[NVDEV_SUBDEV_I2C ] = nve0_i2c_oclass; 255 device->oclass[NVDEV_SUBDEV_I2C ] = nve0_i2c_oclass;
256 device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
249 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nve0_clock_oclass; 257 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nve0_clock_oclass;
250 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; 258 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
251 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 259 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/base.c b/drivers/gpu/drm/nouveau/core/engine/disp/base.c
index 22d55f6cde50..64b84667f3a5 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/base.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/base.c
@@ -32,7 +32,8 @@
32#include "conn.h" 32#include "conn.h"
33 33
34int 34int
35nouveau_disp_vblank_ctor(void *data, u32 size, struct nvkm_notify *notify) 35nouveau_disp_vblank_ctor(struct nouveau_object *object, void *data, u32 size,
36 struct nvkm_notify *notify)
36{ 37{
37 struct nouveau_disp *disp = 38 struct nouveau_disp *disp =
38 container_of(notify->event, typeof(*disp), vblank); 39 container_of(notify->event, typeof(*disp), vblank);
@@ -61,7 +62,8 @@ nouveau_disp_vblank(struct nouveau_disp *disp, int head)
61} 62}
62 63
63static int 64static int
64nouveau_disp_hpd_ctor(void *data, u32 size, struct nvkm_notify *notify) 65nouveau_disp_hpd_ctor(struct nouveau_object *object, void *data, u32 size,
66 struct nvkm_notify *notify)
65{ 67{
66 struct nouveau_disp *disp = 68 struct nouveau_disp *disp =
67 container_of(notify->event, typeof(*disp), hpd); 69 container_of(notify->event, typeof(*disp), hpd);
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/conn.c b/drivers/gpu/drm/nouveau/core/engine/disp/conn.c
index 3d1070228977..1496b567dd4a 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/conn.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/conn.c
@@ -126,8 +126,8 @@ nvkm_connector_create_(struct nouveau_object *parent,
126 return 0; 126 return 0;
127 } 127 }
128 128
129 ret = nvkm_notify_init(&gpio->event, nvkm_connector_hpd, true, 129 ret = nvkm_notify_init(NULL, &gpio->event, nvkm_connector_hpd,
130 &(struct nvkm_gpio_ntfy_req) { 130 true, &(struct nvkm_gpio_ntfy_req) {
131 .mask = NVKM_GPIO_TOGGLED, 131 .mask = NVKM_GPIO_TOGGLED,
132 .line = func.line, 132 .line = func.line,
133 }, 133 },
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/gm107.c b/drivers/gpu/drm/nouveau/core/engine/disp/gm107.c
index d54da8b5f87e..b3df3fe2dc09 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/gm107.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/gm107.c
@@ -68,6 +68,10 @@ gm107_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
68 if (ret) 68 if (ret)
69 return ret; 69 return ret;
70 70
71 ret = nvkm_event_init(&nvd0_disp_chan_uevent, 1, 17, &priv->uevent);
72 if (ret)
73 return ret;
74
71 nv_engine(priv)->sclass = gm107_disp_base_oclass; 75 nv_engine(priv)->sclass = gm107_disp_base_oclass;
72 nv_engine(priv)->cclass = &nv50_disp_cclass; 76 nv_engine(priv)->cclass = &nv50_disp_cclass;
73 nv_subdev(priv)->intr = nvd0_disp_intr; 77 nv_subdev(priv)->intr = nvd0_disp_intr;
@@ -80,7 +84,7 @@ gm107_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
80 priv->dac.sense = nv50_dac_sense; 84 priv->dac.sense = nv50_dac_sense;
81 priv->sor.power = nv50_sor_power; 85 priv->sor.power = nv50_sor_power;
82 priv->sor.hda_eld = nvd0_hda_eld; 86 priv->sor.hda_eld = nvd0_hda_eld;
83 priv->sor.hdmi = nvd0_hdmi_ctrl; 87 priv->sor.hdmi = nve0_hdmi_ctrl;
84 return 0; 88 return 0;
85} 89}
86 90
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/hdanva3.c b/drivers/gpu/drm/nouveau/core/engine/disp/hdanva3.c
index 8b4e06abe533..fe9ef5894dd4 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/hdanva3.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/hdanva3.c
@@ -26,6 +26,8 @@
26#include <nvif/unpack.h> 26#include <nvif/unpack.h>
27#include <nvif/class.h> 27#include <nvif/class.h>
28 28
29#include <subdev/timer.h>
30
29#include "nv50.h" 31#include "nv50.h"
30 32
31int 33int
@@ -46,16 +48,21 @@ nva3_hda_eld(NV50_DISP_MTHD_V1)
46 return ret; 48 return ret;
47 49
48 if (size && args->v0.data[0]) { 50 if (size && args->v0.data[0]) {
51 if (outp->info.type == DCB_OUTPUT_DP) {
52 nv_mask(priv, 0x61c1e0 + soff, 0x8000000d, 0x80000001);
53 nv_wait(priv, 0x61c1e0 + soff, 0x80000000, 0x00000000);
54 }
49 for (i = 0; i < size; i++) 55 for (i = 0; i < size; i++)
50 nv_wr32(priv, 0x61c440 + soff, (i << 8) | args->v0.data[0]); 56 nv_wr32(priv, 0x61c440 + soff, (i << 8) | args->v0.data[0]);
51 for (; i < 0x60; i++) 57 for (; i < 0x60; i++)
52 nv_wr32(priv, 0x61c440 + soff, (i << 8)); 58 nv_wr32(priv, 0x61c440 + soff, (i << 8));
53 nv_mask(priv, 0x61c448 + soff, 0x80000003, 0x80000003); 59 nv_mask(priv, 0x61c448 + soff, 0x80000003, 0x80000003);
54 } else
55 if (size) {
56 nv_mask(priv, 0x61c448 + soff, 0x80000003, 0x80000001);
57 } else { 60 } else {
58 nv_mask(priv, 0x61c448 + soff, 0x80000003, 0x80000000); 61 if (outp->info.type == DCB_OUTPUT_DP) {
62 nv_mask(priv, 0x61c1e0 + soff, 0x80000001, 0x80000000);
63 nv_wait(priv, 0x61c1e0 + soff, 0x80000000, 0x00000000);
64 }
65 nv_mask(priv, 0x61c448 + soff, 0x80000003, 0x80000000 | !!size);
59 } 66 }
60 67
61 return 0; 68 return 0;
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/hdanvd0.c b/drivers/gpu/drm/nouveau/core/engine/disp/hdanvd0.c
index baf558fc12fb..1d4e8432d857 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/hdanvd0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/hdanvd0.c
@@ -26,10 +26,7 @@
26#include <nvif/unpack.h> 26#include <nvif/unpack.h>
27#include <nvif/class.h> 27#include <nvif/class.h>
28 28
29#include <subdev/bios.h> 29#include <subdev/timer.h>
30#include <subdev/bios/dcb.h>
31#include <subdev/bios/dp.h>
32#include <subdev/bios/init.h>
33 30
34#include "nv50.h" 31#include "nv50.h"
35 32
@@ -40,6 +37,7 @@ nvd0_hda_eld(NV50_DISP_MTHD_V1)
40 struct nv50_disp_sor_hda_eld_v0 v0; 37 struct nv50_disp_sor_hda_eld_v0 v0;
41 } *args = data; 38 } *args = data;
42 const u32 soff = outp->or * 0x030; 39 const u32 soff = outp->or * 0x030;
40 const u32 hoff = head * 0x800;
43 int ret, i; 41 int ret, i;
44 42
45 nv_ioctl(object, "disp sor hda eld size %d\n", size); 43 nv_ioctl(object, "disp sor hda eld size %d\n", size);
@@ -51,16 +49,22 @@ nvd0_hda_eld(NV50_DISP_MTHD_V1)
51 return ret; 49 return ret;
52 50
53 if (size && args->v0.data[0]) { 51 if (size && args->v0.data[0]) {
52 if (outp->info.type == DCB_OUTPUT_DP) {
53 nv_mask(priv, 0x616618 + hoff, 0x8000000c, 0x80000001);
54 nv_wait(priv, 0x616618 + hoff, 0x80000000, 0x00000000);
55 }
56 nv_mask(priv, 0x616548 + hoff, 0x00000070, 0x00000000);
54 for (i = 0; i < size; i++) 57 for (i = 0; i < size; i++)
55 nv_wr32(priv, 0x10ec00 + soff, (i << 8) | args->v0.data[i]); 58 nv_wr32(priv, 0x10ec00 + soff, (i << 8) | args->v0.data[i]);
56 for (; i < 0x60; i++) 59 for (; i < 0x60; i++)
57 nv_wr32(priv, 0x10ec00 + soff, (i << 8)); 60 nv_wr32(priv, 0x10ec00 + soff, (i << 8));
58 nv_mask(priv, 0x10ec10 + soff, 0x80000003, 0x80000003); 61 nv_mask(priv, 0x10ec10 + soff, 0x80000003, 0x80000003);
59 } else
60 if (size) {
61 nv_mask(priv, 0x10ec10 + soff, 0x80000003, 0x80000001);
62 } else { 62 } else {
63 nv_mask(priv, 0x10ec10 + soff, 0x80000003, 0x80000000); 63 if (outp->info.type == DCB_OUTPUT_DP) {
64 nv_mask(priv, 0x616618 + hoff, 0x80000001, 0x80000000);
65 nv_wait(priv, 0x616618 + hoff, 0x80000000, 0x00000000);
66 }
67 nv_mask(priv, 0x10ec10 + soff, 0x80000003, 0x80000000 | !!size);
64 } 68 }
65 69
66 return 0; 70 return 0;
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/hdminvd0.c b/drivers/gpu/drm/nouveau/core/engine/disp/hdminvd0.c
index 3106d295b48d..bac4fc4570f0 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/hdminvd0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/hdminvd0.c
@@ -75,8 +75,5 @@ nvd0_hdmi_ctrl(NV50_DISP_MTHD_V1)
75 75
76 /* HDMI_CTRL */ 76 /* HDMI_CTRL */
77 nv_mask(priv, 0x616798 + hoff, 0x401f007f, ctrl); 77 nv_mask(priv, 0x616798 + hoff, 0x401f007f, ctrl);
78
79 /* NFI, audio doesn't work without it though.. */
80 nv_mask(priv, 0x616548 + hoff, 0x00000070, 0x00000000);
81 return 0; 78 return 0;
82} 79}
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/hdminve0.c b/drivers/gpu/drm/nouveau/core/engine/disp/hdminve0.c
new file mode 100644
index 000000000000..528d14ec2f7f
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/hdminve0.c
@@ -0,0 +1,83 @@
1/*
2 * Copyright 2014 Red Hat Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: Ben Skeggs
23 */
24
25#include <core/client.h>
26#include <nvif/unpack.h>
27#include <nvif/class.h>
28
29#include "nv50.h"
30
31int
32nve0_hdmi_ctrl(NV50_DISP_MTHD_V1)
33{
34 const u32 hoff = (head * 0x800);
35 const u32 hdmi = (head * 0x400);
36 union {
37 struct nv50_disp_sor_hdmi_pwr_v0 v0;
38 } *args = data;
39 u32 ctrl;
40 int ret;
41
42 nv_ioctl(object, "disp sor hdmi ctrl size %d\n", size);
43 if (nvif_unpack(args->v0, 0, 0, false)) {
44 nv_ioctl(object, "disp sor hdmi ctrl vers %d state %d "
45 "max_ac_packet %d rekey %d\n",
46 args->v0.version, args->v0.state,
47 args->v0.max_ac_packet, args->v0.rekey);
48 if (args->v0.max_ac_packet > 0x1f || args->v0.rekey > 0x7f)
49 return -EINVAL;
50 ctrl = 0x40000000 * !!args->v0.state;
51 ctrl |= args->v0.max_ac_packet << 16;
52 ctrl |= args->v0.rekey;
53 } else
54 return ret;
55
56 if (!(ctrl & 0x40000000)) {
57 nv_mask(priv, 0x616798 + hoff, 0x40000000, 0x00000000);
58 nv_mask(priv, 0x6900c0 + hdmi, 0x00000001, 0x00000000);
59 nv_mask(priv, 0x690000 + hdmi, 0x00000001, 0x00000000);
60 return 0;
61 }
62
63 /* AVI InfoFrame */
64 nv_mask(priv, 0x690000 + hdmi, 0x00000001, 0x00000000);
65 nv_wr32(priv, 0x690008 + hdmi, 0x000d0282);
66 nv_wr32(priv, 0x69000c + hdmi, 0x0000006f);
67 nv_wr32(priv, 0x690010 + hdmi, 0x00000000);
68 nv_wr32(priv, 0x690014 + hdmi, 0x00000000);
69 nv_wr32(priv, 0x690018 + hdmi, 0x00000000);
70 nv_mask(priv, 0x690000 + hdmi, 0x00000001, 0x00000001);
71
72 /* ??? InfoFrame? */
73 nv_mask(priv, 0x6900c0 + hdmi, 0x00000001, 0x00000000);
74 nv_wr32(priv, 0x6900cc + hdmi, 0x00000010);
75 nv_mask(priv, 0x6900c0 + hdmi, 0x00000001, 0x00000001);
76
77 /* ??? */
78 nv_wr32(priv, 0x690080 + hdmi, 0x82000000);
79
80 /* HDMI_CTRL */
81 nv_mask(priv, 0x616798 + hoff, 0x401f007f, ctrl);
82 return 0;
83}
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
index 4b5bb5d58a54..a7efbff4dc8f 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
@@ -29,6 +29,7 @@
29#include <core/enum.h> 29#include <core/enum.h>
30#include <nvif/unpack.h> 30#include <nvif/unpack.h>
31#include <nvif/class.h> 31#include <nvif/class.h>
32#include <nvif/event.h>
32 33
33#include <subdev/bios.h> 34#include <subdev/bios.h>
34#include <subdev/bios/dcb.h> 35#include <subdev/bios/dcb.h>
@@ -82,6 +83,71 @@ nv50_disp_chan_destroy(struct nv50_disp_chan *chan)
82 nouveau_namedb_destroy(&chan->base); 83 nouveau_namedb_destroy(&chan->base);
83} 84}
84 85
86static void
87nv50_disp_chan_uevent_fini(struct nvkm_event *event, int type, int index)
88{
89 struct nv50_disp_priv *priv = container_of(event, typeof(*priv), uevent);
90 nv_mask(priv, 0x610028, 0x00000001 << index, 0x00000000 << index);
91}
92
93static void
94nv50_disp_chan_uevent_init(struct nvkm_event *event, int types, int index)
95{
96 struct nv50_disp_priv *priv = container_of(event, typeof(*priv), uevent);
97 nv_mask(priv, 0x610028, 0x00000001 << index, 0x00000001 << index);
98}
99
100void
101nv50_disp_chan_uevent_send(struct nv50_disp_priv *priv, int chid)
102{
103 struct nvif_notify_uevent_rep {
104 } rep;
105
106 nvkm_event_send(&priv->uevent, 1, chid, &rep, sizeof(rep));
107}
108
109int
110nv50_disp_chan_uevent_ctor(struct nouveau_object *object, void *data, u32 size,
111 struct nvkm_notify *notify)
112{
113 struct nv50_disp_dmac *dmac = (void *)object;
114 union {
115 struct nvif_notify_uevent_req none;
116 } *args = data;
117 int ret;
118
119 if (nvif_unvers(args->none)) {
120 notify->size = sizeof(struct nvif_notify_uevent_rep);
121 notify->types = 1;
122 notify->index = dmac->base.chid;
123 return 0;
124 }
125
126 return ret;
127}
128
129const struct nvkm_event_func
130nv50_disp_chan_uevent = {
131 .ctor = nv50_disp_chan_uevent_ctor,
132 .init = nv50_disp_chan_uevent_init,
133 .fini = nv50_disp_chan_uevent_fini,
134};
135
136int
137nv50_disp_chan_ntfy(struct nouveau_object *object, u32 type,
138 struct nvkm_event **pevent)
139{
140 struct nv50_disp_priv *priv = (void *)object->engine;
141 switch (type) {
142 case NV50_DISP_CORE_CHANNEL_DMA_V0_NTFY_UEVENT:
143 *pevent = &priv->uevent;
144 return 0;
145 default:
146 break;
147 }
148 return -EINVAL;
149}
150
85int 151int
86nv50_disp_chan_map(struct nouveau_object *object, u64 *addr, u32 *size) 152nv50_disp_chan_map(struct nouveau_object *object, u64 *addr, u32 *size)
87{ 153{
@@ -195,7 +261,7 @@ nv50_disp_dmac_init(struct nouveau_object *object)
195 return ret; 261 return ret;
196 262
197 /* enable error reporting */ 263 /* enable error reporting */
198 nv_mask(priv, 0x610028, 0x00010001 << chid, 0x00010001 << chid); 264 nv_mask(priv, 0x610028, 0x00010000 << chid, 0x00010000 << chid);
199 265
200 /* initialise channel for dma command submission */ 266 /* initialise channel for dma command submission */
201 nv_wr32(priv, 0x610204 + (chid * 0x0010), dmac->push); 267 nv_wr32(priv, 0x610204 + (chid * 0x0010), dmac->push);
@@ -232,7 +298,7 @@ nv50_disp_dmac_fini(struct nouveau_object *object, bool suspend)
232 return -EBUSY; 298 return -EBUSY;
233 } 299 }
234 300
235 /* disable error reporting */ 301 /* disable error reporting and completion notifications */
236 nv_mask(priv, 0x610028, 0x00010001 << chid, 0x00000000 << chid); 302 nv_mask(priv, 0x610028, 0x00010001 << chid, 0x00000000 << chid);
237 303
238 return nv50_disp_chan_fini(&dmac->base, suspend); 304 return nv50_disp_chan_fini(&dmac->base, suspend);
@@ -454,7 +520,7 @@ nv50_disp_mast_init(struct nouveau_object *object)
454 return ret; 520 return ret;
455 521
456 /* enable error reporting */ 522 /* enable error reporting */
457 nv_mask(priv, 0x610028, 0x00010001, 0x00010001); 523 nv_mask(priv, 0x610028, 0x00010000, 0x00010000);
458 524
459 /* attempt to unstick channel from some unknown state */ 525 /* attempt to unstick channel from some unknown state */
460 if ((nv_rd32(priv, 0x610200) & 0x009f0000) == 0x00020000) 526 if ((nv_rd32(priv, 0x610200) & 0x009f0000) == 0x00020000)
@@ -494,7 +560,7 @@ nv50_disp_mast_fini(struct nouveau_object *object, bool suspend)
494 return -EBUSY; 560 return -EBUSY;
495 } 561 }
496 562
497 /* disable error reporting */ 563 /* disable error reporting and completion notifications */
498 nv_mask(priv, 0x610028, 0x00010001, 0x00000000); 564 nv_mask(priv, 0x610028, 0x00010001, 0x00000000);
499 565
500 return nv50_disp_chan_fini(&mast->base, suspend); 566 return nv50_disp_chan_fini(&mast->base, suspend);
@@ -507,6 +573,7 @@ nv50_disp_mast_ofuncs = {
507 .base.init = nv50_disp_mast_init, 573 .base.init = nv50_disp_mast_init,
508 .base.fini = nv50_disp_mast_fini, 574 .base.fini = nv50_disp_mast_fini,
509 .base.map = nv50_disp_chan_map, 575 .base.map = nv50_disp_chan_map,
576 .base.ntfy = nv50_disp_chan_ntfy,
510 .base.rd32 = nv50_disp_chan_rd32, 577 .base.rd32 = nv50_disp_chan_rd32,
511 .base.wr32 = nv50_disp_chan_wr32, 578 .base.wr32 = nv50_disp_chan_wr32,
512 .chid = 0, 579 .chid = 0,
@@ -607,6 +674,7 @@ nv50_disp_sync_ofuncs = {
607 .base.dtor = nv50_disp_dmac_dtor, 674 .base.dtor = nv50_disp_dmac_dtor,
608 .base.init = nv50_disp_dmac_init, 675 .base.init = nv50_disp_dmac_init,
609 .base.fini = nv50_disp_dmac_fini, 676 .base.fini = nv50_disp_dmac_fini,
677 .base.ntfy = nv50_disp_chan_ntfy,
610 .base.map = nv50_disp_chan_map, 678 .base.map = nv50_disp_chan_map,
611 .base.rd32 = nv50_disp_chan_rd32, 679 .base.rd32 = nv50_disp_chan_rd32,
612 .base.wr32 = nv50_disp_chan_wr32, 680 .base.wr32 = nv50_disp_chan_wr32,
@@ -696,6 +764,7 @@ nv50_disp_ovly_ofuncs = {
696 .base.dtor = nv50_disp_dmac_dtor, 764 .base.dtor = nv50_disp_dmac_dtor,
697 .base.init = nv50_disp_dmac_init, 765 .base.init = nv50_disp_dmac_init,
698 .base.fini = nv50_disp_dmac_fini, 766 .base.fini = nv50_disp_dmac_fini,
767 .base.ntfy = nv50_disp_chan_ntfy,
699 .base.map = nv50_disp_chan_map, 768 .base.map = nv50_disp_chan_map,
700 .base.rd32 = nv50_disp_chan_rd32, 769 .base.rd32 = nv50_disp_chan_rd32,
701 .base.wr32 = nv50_disp_chan_wr32, 770 .base.wr32 = nv50_disp_chan_wr32,
@@ -813,6 +882,7 @@ nv50_disp_oimm_ofuncs = {
813 .base.dtor = nv50_disp_pioc_dtor, 882 .base.dtor = nv50_disp_pioc_dtor,
814 .base.init = nv50_disp_pioc_init, 883 .base.init = nv50_disp_pioc_init,
815 .base.fini = nv50_disp_pioc_fini, 884 .base.fini = nv50_disp_pioc_fini,
885 .base.ntfy = nv50_disp_chan_ntfy,
816 .base.map = nv50_disp_chan_map, 886 .base.map = nv50_disp_chan_map,
817 .base.rd32 = nv50_disp_chan_rd32, 887 .base.rd32 = nv50_disp_chan_rd32,
818 .base.wr32 = nv50_disp_chan_wr32, 888 .base.wr32 = nv50_disp_chan_wr32,
@@ -860,6 +930,7 @@ nv50_disp_curs_ofuncs = {
860 .base.dtor = nv50_disp_pioc_dtor, 930 .base.dtor = nv50_disp_pioc_dtor,
861 .base.init = nv50_disp_pioc_init, 931 .base.init = nv50_disp_pioc_init,
862 .base.fini = nv50_disp_pioc_fini, 932 .base.fini = nv50_disp_pioc_fini,
933 .base.ntfy = nv50_disp_chan_ntfy,
863 .base.map = nv50_disp_chan_map, 934 .base.map = nv50_disp_chan_map,
864 .base.rd32 = nv50_disp_chan_rd32, 935 .base.rd32 = nv50_disp_chan_rd32,
865 .base.wr32 = nv50_disp_chan_wr32, 936 .base.wr32 = nv50_disp_chan_wr32,
@@ -1559,7 +1630,7 @@ nv50_disp_intr_unk20_1(struct nv50_disp_priv *priv, int head)
1559} 1630}
1560 1631
1561static void 1632static void
1562nv50_disp_intr_unk20_2_dp(struct nv50_disp_priv *priv, 1633nv50_disp_intr_unk20_2_dp(struct nv50_disp_priv *priv, int head,
1563 struct dcb_output *outp, u32 pclk) 1634 struct dcb_output *outp, u32 pclk)
1564{ 1635{
1565 const int link = !(outp->sorconf.link & 1); 1636 const int link = !(outp->sorconf.link & 1);
@@ -1568,24 +1639,36 @@ nv50_disp_intr_unk20_2_dp(struct nv50_disp_priv *priv,
1568 const u32 loff = (link * 0x080) + soff; 1639 const u32 loff = (link * 0x080) + soff;
1569 const u32 ctrl = nv_rd32(priv, 0x610794 + (or * 8)); 1640 const u32 ctrl = nv_rd32(priv, 0x610794 + (or * 8));
1570 const u32 symbol = 100000; 1641 const u32 symbol = 100000;
1571 u32 dpctrl = nv_rd32(priv, 0x61c10c + loff) & 0x0000f0000; 1642 const s32 vactive = nv_rd32(priv, 0x610af8 + (head * 0x540)) & 0xffff;
1643 const s32 vblanke = nv_rd32(priv, 0x610ae8 + (head * 0x540)) & 0xffff;
1644 const s32 vblanks = nv_rd32(priv, 0x610af0 + (head * 0x540)) & 0xffff;
1645 u32 dpctrl = nv_rd32(priv, 0x61c10c + loff);
1572 u32 clksor = nv_rd32(priv, 0x614300 + soff); 1646 u32 clksor = nv_rd32(priv, 0x614300 + soff);
1573 int bestTU = 0, bestVTUi = 0, bestVTUf = 0, bestVTUa = 0; 1647 int bestTU = 0, bestVTUi = 0, bestVTUf = 0, bestVTUa = 0;
1574 int TU, VTUi, VTUf, VTUa; 1648 int TU, VTUi, VTUf, VTUa;
1575 u64 link_data_rate, link_ratio, unk; 1649 u64 link_data_rate, link_ratio, unk;
1576 u32 best_diff = 64 * symbol; 1650 u32 best_diff = 64 * symbol;
1577 u32 link_nr, link_bw, bits; 1651 u32 link_nr, link_bw, bits;
1578 1652 u64 value;
1579 /* calculate packed data rate for each lane */ 1653
1580 if (dpctrl > 0x00030000) link_nr = 4; 1654 link_bw = (clksor & 0x000c0000) ? 270000 : 162000;
1581 else if (dpctrl > 0x00010000) link_nr = 2; 1655 link_nr = hweight32(dpctrl & 0x000f0000);
1582 else link_nr = 1; 1656
1583 1657 /* symbols/hblank - algorithm taken from comments in tegra driver */
1584 if (clksor & 0x000c0000) 1658 value = vblanke + vactive - vblanks - 7;
1585 link_bw = 270000; 1659 value = value * link_bw;
1586 else 1660 do_div(value, pclk);
1587 link_bw = 162000; 1661 value = value - (3 * !!(dpctrl & 0x00004000)) - (12 / link_nr);
1588 1662 nv_mask(priv, 0x61c1e8 + soff, 0x0000ffff, value);
1663
1664 /* symbols/vblank - algorithm taken from comments in tegra driver */
1665 value = vblanks - vblanke - 25;
1666 value = value * link_bw;
1667 do_div(value, pclk);
1668 value = value - ((36 / link_nr) + 3) - 1;
1669 nv_mask(priv, 0x61c1ec + soff, 0x00ffffff, value);
1670
1671 /* watermark / activesym */
1589 if ((ctrl & 0xf0000) == 0x60000) bits = 30; 1672 if ((ctrl & 0xf0000) == 0x60000) bits = 30;
1590 else if ((ctrl & 0xf0000) == 0x50000) bits = 24; 1673 else if ((ctrl & 0xf0000) == 0x50000) bits = 24;
1591 else bits = 18; 1674 else bits = 18;
@@ -1731,7 +1814,7 @@ nv50_disp_intr_unk20_2(struct nv50_disp_priv *priv, int head)
1731 } else 1814 } else
1732 if (!outp->info.location) { 1815 if (!outp->info.location) {
1733 if (outp->info.type == DCB_OUTPUT_DP) 1816 if (outp->info.type == DCB_OUTPUT_DP)
1734 nv50_disp_intr_unk20_2_dp(priv, &outp->info, pclk); 1817 nv50_disp_intr_unk20_2_dp(priv, head, &outp->info, pclk);
1735 oreg = 0x614300 + (ffs(outp->info.or) - 1) * 0x800; 1818 oreg = 0x614300 + (ffs(outp->info.or) - 1) * 0x800;
1736 oval = (conf & 0x0100) ? 0x00000101 : 0x00000000; 1819 oval = (conf & 0x0100) ? 0x00000101 : 0x00000000;
1737 hval = 0x00000000; 1820 hval = 0x00000000;
@@ -1846,6 +1929,12 @@ nv50_disp_intr(struct nouveau_subdev *subdev)
1846 intr0 &= ~(0x00010000 << chid); 1929 intr0 &= ~(0x00010000 << chid);
1847 } 1930 }
1848 1931
1932 while (intr0 & 0x0000001f) {
1933 u32 chid = __ffs(intr0 & 0x0000001f);
1934 nv50_disp_chan_uevent_send(priv, chid);
1935 intr0 &= ~(0x00000001 << chid);
1936 }
1937
1849 if (intr1 & 0x00000004) { 1938 if (intr1 & 0x00000004) {
1850 nouveau_disp_vblank(&priv->base, 0); 1939 nouveau_disp_vblank(&priv->base, 0);
1851 nv_wr32(priv, 0x610024, 0x00000004); 1940 nv_wr32(priv, 0x610024, 0x00000004);
@@ -1880,6 +1969,10 @@ nv50_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
1880 if (ret) 1969 if (ret)
1881 return ret; 1970 return ret;
1882 1971
1972 ret = nvkm_event_init(&nv50_disp_chan_uevent, 1, 9, &priv->uevent);
1973 if (ret)
1974 return ret;
1975
1883 nv_engine(priv)->sclass = nv50_disp_base_oclass; 1976 nv_engine(priv)->sclass = nv50_disp_base_oclass;
1884 nv_engine(priv)->cclass = &nv50_disp_cclass; 1977 nv_engine(priv)->cclass = &nv50_disp_cclass;
1885 nv_subdev(priv)->intr = nv50_disp_intr; 1978 nv_subdev(priv)->intr = nv50_disp_intr;
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.h b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.h
index 8ab14461f70c..5279feefec06 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.h
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.h
@@ -26,6 +26,8 @@ struct nv50_disp_priv {
26 struct work_struct supervisor; 26 struct work_struct supervisor;
27 u32 super; 27 u32 super;
28 28
29 struct nvkm_event uevent;
30
29 struct { 31 struct {
30 int nr; 32 int nr;
31 } head; 33 } head;
@@ -75,6 +77,7 @@ int nvd0_hda_eld(NV50_DISP_MTHD_V1);
75int nv84_hdmi_ctrl(NV50_DISP_MTHD_V1); 77int nv84_hdmi_ctrl(NV50_DISP_MTHD_V1);
76int nva3_hdmi_ctrl(NV50_DISP_MTHD_V1); 78int nva3_hdmi_ctrl(NV50_DISP_MTHD_V1);
77int nvd0_hdmi_ctrl(NV50_DISP_MTHD_V1); 79int nvd0_hdmi_ctrl(NV50_DISP_MTHD_V1);
80int nve0_hdmi_ctrl(NV50_DISP_MTHD_V1);
78 81
79int nv50_sor_power(NV50_DISP_MTHD_V1); 82int nv50_sor_power(NV50_DISP_MTHD_V1);
80 83
@@ -116,9 +119,16 @@ struct nv50_disp_chan {
116 int chid; 119 int chid;
117}; 120};
118 121
122int nv50_disp_chan_ntfy(struct nouveau_object *, u32, struct nvkm_event **);
119int nv50_disp_chan_map(struct nouveau_object *, u64 *, u32 *); 123int nv50_disp_chan_map(struct nouveau_object *, u64 *, u32 *);
120u32 nv50_disp_chan_rd32(struct nouveau_object *, u64); 124u32 nv50_disp_chan_rd32(struct nouveau_object *, u64);
121void nv50_disp_chan_wr32(struct nouveau_object *, u64, u32); 125void nv50_disp_chan_wr32(struct nouveau_object *, u64, u32);
126extern const struct nvkm_event_func nv50_disp_chan_uevent;
127int nv50_disp_chan_uevent_ctor(struct nouveau_object *, void *, u32,
128 struct nvkm_notify *);
129void nv50_disp_chan_uevent_send(struct nv50_disp_priv *, int);
130
131extern const struct nvkm_event_func nvd0_disp_chan_uevent;
122 132
123#define nv50_disp_chan_init(a) \ 133#define nv50_disp_chan_init(a) \
124 nouveau_namedb_init(&(a)->base) 134 nouveau_namedb_init(&(a)->base)
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nv84.c b/drivers/gpu/drm/nouveau/core/engine/disp/nv84.c
index 788ced1b6182..d36284715b2a 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/nv84.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/nv84.c
@@ -236,6 +236,10 @@ nv84_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
236 if (ret) 236 if (ret)
237 return ret; 237 return ret;
238 238
239 ret = nvkm_event_init(&nv50_disp_chan_uevent, 1, 9, &priv->uevent);
240 if (ret)
241 return ret;
242
239 nv_engine(priv)->sclass = nv84_disp_base_oclass; 243 nv_engine(priv)->sclass = nv84_disp_base_oclass;
240 nv_engine(priv)->cclass = &nv50_disp_cclass; 244 nv_engine(priv)->cclass = &nv50_disp_cclass;
241 nv_subdev(priv)->intr = nv50_disp_intr; 245 nv_subdev(priv)->intr = nv50_disp_intr;
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nv94.c b/drivers/gpu/drm/nouveau/core/engine/disp/nv94.c
index fa79de906eae..a117064002b1 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/nv94.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/nv94.c
@@ -95,6 +95,10 @@ nv94_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
95 if (ret) 95 if (ret)
96 return ret; 96 return ret;
97 97
98 ret = nvkm_event_init(&nv50_disp_chan_uevent, 1, 9, &priv->uevent);
99 if (ret)
100 return ret;
101
98 nv_engine(priv)->sclass = nv94_disp_base_oclass; 102 nv_engine(priv)->sclass = nv94_disp_base_oclass;
99 nv_engine(priv)->cclass = &nv50_disp_cclass; 103 nv_engine(priv)->cclass = &nv50_disp_cclass;
100 nv_subdev(priv)->intr = nv50_disp_intr; 104 nv_subdev(priv)->intr = nv50_disp_intr;
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nva0.c b/drivers/gpu/drm/nouveau/core/engine/disp/nva0.c
index 7af15f5d48dc..c67e68aadd45 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/nva0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/nva0.c
@@ -112,6 +112,10 @@ nva0_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
112 if (ret) 112 if (ret)
113 return ret; 113 return ret;
114 114
115 ret = nvkm_event_init(&nv50_disp_chan_uevent, 1, 9, &priv->uevent);
116 if (ret)
117 return ret;
118
115 nv_engine(priv)->sclass = nva0_disp_base_oclass; 119 nv_engine(priv)->sclass = nva0_disp_base_oclass;
116 nv_engine(priv)->cclass = &nv50_disp_cclass; 120 nv_engine(priv)->cclass = &nv50_disp_cclass;
117 nv_subdev(priv)->intr = nv50_disp_intr; 121 nv_subdev(priv)->intr = nv50_disp_intr;
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nva3.c b/drivers/gpu/drm/nouveau/core/engine/disp/nva3.c
index 6bd39448f8da..22969f355aae 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/nva3.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/nva3.c
@@ -67,6 +67,10 @@ nva3_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
67 if (ret) 67 if (ret)
68 return ret; 68 return ret;
69 69
70 ret = nvkm_event_init(&nv50_disp_chan_uevent, 1, 9, &priv->uevent);
71 if (ret)
72 return ret;
73
70 nv_engine(priv)->sclass = nva3_disp_base_oclass; 74 nv_engine(priv)->sclass = nva3_disp_base_oclass;
71 nv_engine(priv)->cclass = &nv50_disp_cclass; 75 nv_engine(priv)->cclass = &nv50_disp_cclass;
72 nv_subdev(priv)->intr = nv50_disp_intr; 76 nv_subdev(priv)->intr = nv50_disp_intr;
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c b/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c
index a4bb3c774ee1..747e64bb9c06 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c
@@ -43,6 +43,31 @@
43#include "nv50.h" 43#include "nv50.h"
44 44
45/******************************************************************************* 45/*******************************************************************************
46 * EVO channel base class
47 ******************************************************************************/
48
49static void
50nvd0_disp_chan_uevent_fini(struct nvkm_event *event, int type, int index)
51{
52 struct nv50_disp_priv *priv = container_of(event, typeof(*priv), uevent);
53 nv_mask(priv, 0x610090, 0x00000001 << index, 0x00000000 << index);
54}
55
56static void
57nvd0_disp_chan_uevent_init(struct nvkm_event *event, int types, int index)
58{
59 struct nv50_disp_priv *priv = container_of(event, typeof(*priv), uevent);
60 nv_mask(priv, 0x610090, 0x00000001 << index, 0x00000001 << index);
61}
62
63const struct nvkm_event_func
64nvd0_disp_chan_uevent = {
65 .ctor = nv50_disp_chan_uevent_ctor,
66 .init = nvd0_disp_chan_uevent_init,
67 .fini = nvd0_disp_chan_uevent_fini,
68};
69
70/*******************************************************************************
46 * EVO DMA channel base class 71 * EVO DMA channel base class
47 ******************************************************************************/ 72 ******************************************************************************/
48 73
@@ -77,7 +102,6 @@ nvd0_disp_dmac_init(struct nouveau_object *object)
77 return ret; 102 return ret;
78 103
79 /* enable error reporting */ 104 /* enable error reporting */
80 nv_mask(priv, 0x610090, 0x00000001 << chid, 0x00000001 << chid);
81 nv_mask(priv, 0x6100a0, 0x00000001 << chid, 0x00000001 << chid); 105 nv_mask(priv, 0x6100a0, 0x00000001 << chid, 0x00000001 << chid);
82 106
83 /* initialise channel for dma command submission */ 107 /* initialise channel for dma command submission */
@@ -115,7 +139,7 @@ nvd0_disp_dmac_fini(struct nouveau_object *object, bool suspend)
115 return -EBUSY; 139 return -EBUSY;
116 } 140 }
117 141
118 /* disable error reporting */ 142 /* disable error reporting and completion notification */
119 nv_mask(priv, 0x610090, 0x00000001 << chid, 0x00000000); 143 nv_mask(priv, 0x610090, 0x00000001 << chid, 0x00000000);
120 nv_mask(priv, 0x6100a0, 0x00000001 << chid, 0x00000000); 144 nv_mask(priv, 0x6100a0, 0x00000001 << chid, 0x00000000);
121 145
@@ -278,7 +302,6 @@ nvd0_disp_mast_init(struct nouveau_object *object)
278 return ret; 302 return ret;
279 303
280 /* enable error reporting */ 304 /* enable error reporting */
281 nv_mask(priv, 0x610090, 0x00000001, 0x00000001);
282 nv_mask(priv, 0x6100a0, 0x00000001, 0x00000001); 305 nv_mask(priv, 0x6100a0, 0x00000001, 0x00000001);
283 306
284 /* initialise channel for dma command submission */ 307 /* initialise channel for dma command submission */
@@ -313,7 +336,7 @@ nvd0_disp_mast_fini(struct nouveau_object *object, bool suspend)
313 return -EBUSY; 336 return -EBUSY;
314 } 337 }
315 338
316 /* disable error reporting */ 339 /* disable error reporting and completion notification */
317 nv_mask(priv, 0x610090, 0x00000001, 0x00000000); 340 nv_mask(priv, 0x610090, 0x00000001, 0x00000000);
318 nv_mask(priv, 0x6100a0, 0x00000001, 0x00000000); 341 nv_mask(priv, 0x6100a0, 0x00000001, 0x00000000);
319 342
@@ -326,6 +349,7 @@ nvd0_disp_mast_ofuncs = {
326 .base.dtor = nv50_disp_dmac_dtor, 349 .base.dtor = nv50_disp_dmac_dtor,
327 .base.init = nvd0_disp_mast_init, 350 .base.init = nvd0_disp_mast_init,
328 .base.fini = nvd0_disp_mast_fini, 351 .base.fini = nvd0_disp_mast_fini,
352 .base.ntfy = nv50_disp_chan_ntfy,
329 .base.map = nv50_disp_chan_map, 353 .base.map = nv50_disp_chan_map,
330 .base.rd32 = nv50_disp_chan_rd32, 354 .base.rd32 = nv50_disp_chan_rd32,
331 .base.wr32 = nv50_disp_chan_wr32, 355 .base.wr32 = nv50_disp_chan_wr32,
@@ -419,6 +443,7 @@ nvd0_disp_sync_ofuncs = {
419 .base.dtor = nv50_disp_dmac_dtor, 443 .base.dtor = nv50_disp_dmac_dtor,
420 .base.init = nvd0_disp_dmac_init, 444 .base.init = nvd0_disp_dmac_init,
421 .base.fini = nvd0_disp_dmac_fini, 445 .base.fini = nvd0_disp_dmac_fini,
446 .base.ntfy = nv50_disp_chan_ntfy,
422 .base.map = nv50_disp_chan_map, 447 .base.map = nv50_disp_chan_map,
423 .base.rd32 = nv50_disp_chan_rd32, 448 .base.rd32 = nv50_disp_chan_rd32,
424 .base.wr32 = nv50_disp_chan_wr32, 449 .base.wr32 = nv50_disp_chan_wr32,
@@ -499,6 +524,7 @@ nvd0_disp_ovly_ofuncs = {
499 .base.dtor = nv50_disp_dmac_dtor, 524 .base.dtor = nv50_disp_dmac_dtor,
500 .base.init = nvd0_disp_dmac_init, 525 .base.init = nvd0_disp_dmac_init,
501 .base.fini = nvd0_disp_dmac_fini, 526 .base.fini = nvd0_disp_dmac_fini,
527 .base.ntfy = nv50_disp_chan_ntfy,
502 .base.map = nv50_disp_chan_map, 528 .base.map = nv50_disp_chan_map,
503 .base.rd32 = nv50_disp_chan_rd32, 529 .base.rd32 = nv50_disp_chan_rd32,
504 .base.wr32 = nv50_disp_chan_wr32, 530 .base.wr32 = nv50_disp_chan_wr32,
@@ -524,7 +550,6 @@ nvd0_disp_pioc_init(struct nouveau_object *object)
524 return ret; 550 return ret;
525 551
526 /* enable error reporting */ 552 /* enable error reporting */
527 nv_mask(priv, 0x610090, 0x00000001 << chid, 0x00000001 << chid);
528 nv_mask(priv, 0x6100a0, 0x00000001 << chid, 0x00000001 << chid); 553 nv_mask(priv, 0x6100a0, 0x00000001 << chid, 0x00000001 << chid);
529 554
530 /* activate channel */ 555 /* activate channel */
@@ -553,7 +578,7 @@ nvd0_disp_pioc_fini(struct nouveau_object *object, bool suspend)
553 return -EBUSY; 578 return -EBUSY;
554 } 579 }
555 580
556 /* disable error reporting */ 581 /* disable error reporting and completion notification */
557 nv_mask(priv, 0x610090, 0x00000001 << chid, 0x00000000); 582 nv_mask(priv, 0x610090, 0x00000001 << chid, 0x00000000);
558 nv_mask(priv, 0x6100a0, 0x00000001 << chid, 0x00000000); 583 nv_mask(priv, 0x6100a0, 0x00000001 << chid, 0x00000000);
559 584
@@ -570,6 +595,7 @@ nvd0_disp_oimm_ofuncs = {
570 .base.dtor = nv50_disp_pioc_dtor, 595 .base.dtor = nv50_disp_pioc_dtor,
571 .base.init = nvd0_disp_pioc_init, 596 .base.init = nvd0_disp_pioc_init,
572 .base.fini = nvd0_disp_pioc_fini, 597 .base.fini = nvd0_disp_pioc_fini,
598 .base.ntfy = nv50_disp_chan_ntfy,
573 .base.map = nv50_disp_chan_map, 599 .base.map = nv50_disp_chan_map,
574 .base.rd32 = nv50_disp_chan_rd32, 600 .base.rd32 = nv50_disp_chan_rd32,
575 .base.wr32 = nv50_disp_chan_wr32, 601 .base.wr32 = nv50_disp_chan_wr32,
@@ -586,6 +612,7 @@ nvd0_disp_curs_ofuncs = {
586 .base.dtor = nv50_disp_pioc_dtor, 612 .base.dtor = nv50_disp_pioc_dtor,
587 .base.init = nvd0_disp_pioc_init, 613 .base.init = nvd0_disp_pioc_init,
588 .base.fini = nvd0_disp_pioc_fini, 614 .base.fini = nvd0_disp_pioc_fini,
615 .base.ntfy = nv50_disp_chan_ntfy,
589 .base.map = nv50_disp_chan_map, 616 .base.map = nv50_disp_chan_map,
590 .base.rd32 = nv50_disp_chan_rd32, 617 .base.rd32 = nv50_disp_chan_rd32,
591 .base.wr32 = nv50_disp_chan_wr32, 618 .base.wr32 = nv50_disp_chan_wr32,
@@ -949,6 +976,9 @@ nvd0_disp_intr_unk2_2_tu(struct nv50_disp_priv *priv, int head,
949 const int or = ffs(outp->or) - 1; 976 const int or = ffs(outp->or) - 1;
950 const u32 ctrl = nv_rd32(priv, 0x660200 + (or * 0x020)); 977 const u32 ctrl = nv_rd32(priv, 0x660200 + (or * 0x020));
951 const u32 conf = nv_rd32(priv, 0x660404 + (head * 0x300)); 978 const u32 conf = nv_rd32(priv, 0x660404 + (head * 0x300));
979 const s32 vactive = nv_rd32(priv, 0x660414 + (head * 0x300)) & 0xffff;
980 const s32 vblanke = nv_rd32(priv, 0x66041c + (head * 0x300)) & 0xffff;
981 const s32 vblanks = nv_rd32(priv, 0x660420 + (head * 0x300)) & 0xffff;
952 const u32 pclk = nv_rd32(priv, 0x660450 + (head * 0x300)) / 1000; 982 const u32 pclk = nv_rd32(priv, 0x660450 + (head * 0x300)) / 1000;
953 const u32 link = ((ctrl & 0xf00) == 0x800) ? 0 : 1; 983 const u32 link = ((ctrl & 0xf00) == 0x800) ? 0 : 1;
954 const u32 hoff = (head * 0x800); 984 const u32 hoff = (head * 0x800);
@@ -956,23 +986,35 @@ nvd0_disp_intr_unk2_2_tu(struct nv50_disp_priv *priv, int head,
956 const u32 loff = (link * 0x080) + soff; 986 const u32 loff = (link * 0x080) + soff;
957 const u32 symbol = 100000; 987 const u32 symbol = 100000;
958 const u32 TU = 64; 988 const u32 TU = 64;
959 u32 dpctrl = nv_rd32(priv, 0x61c10c + loff) & 0x000f0000; 989 u32 dpctrl = nv_rd32(priv, 0x61c10c + loff);
960 u32 clksor = nv_rd32(priv, 0x612300 + soff); 990 u32 clksor = nv_rd32(priv, 0x612300 + soff);
961 u32 datarate, link_nr, link_bw, bits; 991 u32 datarate, link_nr, link_bw, bits;
962 u64 ratio, value; 992 u64 ratio, value;
963 993
994 link_nr = hweight32(dpctrl & 0x000f0000);
995 link_bw = (clksor & 0x007c0000) >> 18;
996 link_bw *= 27000;
997
998 /* symbols/hblank - algorithm taken from comments in tegra driver */
999 value = vblanke + vactive - vblanks - 7;
1000 value = value * link_bw;
1001 do_div(value, pclk);
1002 value = value - (3 * !!(dpctrl & 0x00004000)) - (12 / link_nr);
1003 nv_mask(priv, 0x616620 + hoff, 0x0000ffff, value);
1004
1005 /* symbols/vblank - algorithm taken from comments in tegra driver */
1006 value = vblanks - vblanke - 25;
1007 value = value * link_bw;
1008 do_div(value, pclk);
1009 value = value - ((36 / link_nr) + 3) - 1;
1010 nv_mask(priv, 0x616624 + hoff, 0x00ffffff, value);
1011
1012 /* watermark */
964 if ((conf & 0x3c0) == 0x180) bits = 30; 1013 if ((conf & 0x3c0) == 0x180) bits = 30;
965 else if ((conf & 0x3c0) == 0x140) bits = 24; 1014 else if ((conf & 0x3c0) == 0x140) bits = 24;
966 else bits = 18; 1015 else bits = 18;
967 datarate = (pclk * bits) / 8; 1016 datarate = (pclk * bits) / 8;
968 1017
969 if (dpctrl > 0x00030000) link_nr = 4;
970 else if (dpctrl > 0x00010000) link_nr = 2;
971 else link_nr = 1;
972
973 link_bw = (clksor & 0x007c0000) >> 18;
974 link_bw *= 27000;
975
976 ratio = datarate; 1018 ratio = datarate;
977 ratio *= symbol; 1019 ratio *= symbol;
978 do_div(ratio, link_nr * link_bw); 1020 do_div(ratio, link_nr * link_bw);
@@ -1153,7 +1195,11 @@ nvd0_disp_intr(struct nouveau_subdev *subdev)
1153 1195
1154 if (intr & 0x00000001) { 1196 if (intr & 0x00000001) {
1155 u32 stat = nv_rd32(priv, 0x61008c); 1197 u32 stat = nv_rd32(priv, 0x61008c);
1156 nv_wr32(priv, 0x61008c, stat); 1198 while (stat) {
1199 int chid = __ffs(stat); stat &= ~(1 << chid);
1200 nv50_disp_chan_uevent_send(priv, chid);
1201 nv_wr32(priv, 0x61008c, 1 << chid);
1202 }
1157 intr &= ~0x00000001; 1203 intr &= ~0x00000001;
1158 } 1204 }
1159 1205
@@ -1209,6 +1255,10 @@ nvd0_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
1209 if (ret) 1255 if (ret)
1210 return ret; 1256 return ret;
1211 1257
1258 ret = nvkm_event_init(&nvd0_disp_chan_uevent, 1, 17, &priv->uevent);
1259 if (ret)
1260 return ret;
1261
1212 nv_engine(priv)->sclass = nvd0_disp_base_oclass; 1262 nv_engine(priv)->sclass = nvd0_disp_base_oclass;
1213 nv_engine(priv)->cclass = &nv50_disp_cclass; 1263 nv_engine(priv)->cclass = &nv50_disp_cclass;
1214 nv_subdev(priv)->intr = nvd0_disp_intr; 1264 nv_subdev(priv)->intr = nvd0_disp_intr;
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nve0.c b/drivers/gpu/drm/nouveau/core/engine/disp/nve0.c
index 47fef1e398c4..db144b2cf06b 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/nve0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/nve0.c
@@ -233,6 +233,10 @@ nve0_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
233 if (ret) 233 if (ret)
234 return ret; 234 return ret;
235 235
236 ret = nvkm_event_init(&nvd0_disp_chan_uevent, 1, 17, &priv->uevent);
237 if (ret)
238 return ret;
239
236 nv_engine(priv)->sclass = nve0_disp_base_oclass; 240 nv_engine(priv)->sclass = nve0_disp_base_oclass;
237 nv_engine(priv)->cclass = &nv50_disp_cclass; 241 nv_engine(priv)->cclass = &nv50_disp_cclass;
238 nv_subdev(priv)->intr = nvd0_disp_intr; 242 nv_subdev(priv)->intr = nvd0_disp_intr;
@@ -245,7 +249,7 @@ nve0_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
245 priv->dac.sense = nv50_dac_sense; 249 priv->dac.sense = nv50_dac_sense;
246 priv->sor.power = nv50_sor_power; 250 priv->sor.power = nv50_sor_power;
247 priv->sor.hda_eld = nvd0_hda_eld; 251 priv->sor.hda_eld = nvd0_hda_eld;
248 priv->sor.hdmi = nvd0_hdmi_ctrl; 252 priv->sor.hdmi = nve0_hdmi_ctrl;
249 return 0; 253 return 0;
250} 254}
251 255
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nvf0.c b/drivers/gpu/drm/nouveau/core/engine/disp/nvf0.c
index 04bda4ac4ed3..402d7d67d806 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/nvf0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/nvf0.c
@@ -68,6 +68,10 @@ nvf0_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
68 if (ret) 68 if (ret)
69 return ret; 69 return ret;
70 70
71 ret = nvkm_event_init(&nvd0_disp_chan_uevent, 1, 17, &priv->uevent);
72 if (ret)
73 return ret;
74
71 nv_engine(priv)->sclass = nvf0_disp_base_oclass; 75 nv_engine(priv)->sclass = nvf0_disp_base_oclass;
72 nv_engine(priv)->cclass = &nv50_disp_cclass; 76 nv_engine(priv)->cclass = &nv50_disp_cclass;
73 nv_subdev(priv)->intr = nvd0_disp_intr; 77 nv_subdev(priv)->intr = nvd0_disp_intr;
@@ -80,7 +84,7 @@ nvf0_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
80 priv->dac.sense = nv50_dac_sense; 84 priv->dac.sense = nv50_dac_sense;
81 priv->sor.power = nv50_sor_power; 85 priv->sor.power = nv50_sor_power;
82 priv->sor.hda_eld = nvd0_hda_eld; 86 priv->sor.hda_eld = nvd0_hda_eld;
83 priv->sor.hdmi = nvd0_hdmi_ctrl; 87 priv->sor.hdmi = nve0_hdmi_ctrl;
84 return 0; 88 return 0;
85} 89}
86 90
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/outpdp.c b/drivers/gpu/drm/nouveau/core/engine/disp/outpdp.c
index 6f6e2a898270..667a9070e006 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/outpdp.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/outpdp.c
@@ -254,7 +254,7 @@ nvkm_output_dp_create_(struct nouveau_object *parent,
254 atomic_set(&outp->lt.done, 0); 254 atomic_set(&outp->lt.done, 0);
255 255
256 /* link maintenance */ 256 /* link maintenance */
257 ret = nvkm_notify_init(&i2c->event, nvkm_output_dp_irq, true, 257 ret = nvkm_notify_init(NULL, &i2c->event, nvkm_output_dp_irq, true,
258 &(struct nvkm_i2c_ntfy_req) { 258 &(struct nvkm_i2c_ntfy_req) {
259 .mask = NVKM_I2C_IRQ, 259 .mask = NVKM_I2C_IRQ,
260 .port = outp->base.edid->index, 260 .port = outp->base.edid->index,
@@ -268,7 +268,7 @@ nvkm_output_dp_create_(struct nouveau_object *parent,
268 } 268 }
269 269
270 /* hotplug detect, replaces gpio-based mechanism with aux events */ 270 /* hotplug detect, replaces gpio-based mechanism with aux events */
271 ret = nvkm_notify_init(&i2c->event, nvkm_output_dp_hpd, true, 271 ret = nvkm_notify_init(NULL, &i2c->event, nvkm_output_dp_hpd, true,
272 &(struct nvkm_i2c_ntfy_req) { 272 &(struct nvkm_i2c_ntfy_req) {
273 .mask = NVKM_I2C_PLUG | NVKM_I2C_UNPLUG, 273 .mask = NVKM_I2C_PLUG | NVKM_I2C_UNPLUG,
274 .port = outp->base.edid->index, 274 .port = outp->base.edid->index,
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/priv.h b/drivers/gpu/drm/nouveau/core/engine/disp/priv.h
index dbd43ae9df81..6a0511d54ce6 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/priv.h
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/priv.h
@@ -40,7 +40,8 @@ int _nouveau_disp_fini(struct nouveau_object *, bool);
40extern struct nouveau_oclass *nvkm_output_oclass; 40extern struct nouveau_oclass *nvkm_output_oclass;
41extern struct nouveau_oclass *nvkm_connector_oclass; 41extern struct nouveau_oclass *nvkm_connector_oclass;
42 42
43int nouveau_disp_vblank_ctor(void *data, u32 size, struct nvkm_notify *); 43int nouveau_disp_vblank_ctor(struct nouveau_object *, void *data, u32 size,
44 struct nvkm_notify *);
44void nouveau_disp_vblank(struct nouveau_disp *, int head); 45void nouveau_disp_vblank(struct nouveau_disp *, int head);
45int nouveau_disp_ntfy(struct nouveau_object *, u32, struct nvkm_event **); 46int nouveau_disp_ntfy(struct nouveau_object *, u32, struct nvkm_event **);
46 47
diff --git a/drivers/gpu/drm/nouveau/core/engine/fifo/base.c b/drivers/gpu/drm/nouveau/core/engine/fifo/base.c
index 0f999fc45ab9..ac8375cf4eef 100644
--- a/drivers/gpu/drm/nouveau/core/engine/fifo/base.c
+++ b/drivers/gpu/drm/nouveau/core/engine/fifo/base.c
@@ -34,7 +34,8 @@
34#include <engine/fifo.h> 34#include <engine/fifo.h>
35 35
36static int 36static int
37nouveau_fifo_event_ctor(void *data, u32 size, struct nvkm_notify *notify) 37nouveau_fifo_event_ctor(struct nouveau_object *object, void *data, u32 size,
38 struct nvkm_notify *notify)
38{ 39{
39 if (size == 0) { 40 if (size == 0) {
40 notify->size = 0; 41 notify->size = 0;
@@ -170,7 +171,8 @@ _nouveau_fifo_channel_wr32(struct nouveau_object *object, u64 addr, u32 data)
170} 171}
171 172
172int 173int
173nouveau_fifo_uevent_ctor(void *data, u32 size, struct nvkm_notify *notify) 174nouveau_fifo_uevent_ctor(struct nouveau_object *object, void *data, u32 size,
175 struct nvkm_notify *notify)
174{ 176{
175 union { 177 union {
176 struct nvif_notify_uevent_req none; 178 struct nvif_notify_uevent_req none;
diff --git a/drivers/gpu/drm/nouveau/core/engine/software/nv50.c b/drivers/gpu/drm/nouveau/core/engine/software/nv50.c
index 4d2994d8cc32..a0fec205f9db 100644
--- a/drivers/gpu/drm/nouveau/core/engine/software/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/engine/software/nv50.c
@@ -175,7 +175,8 @@ nv50_software_context_ctor(struct nouveau_object *parent,
175 return ret; 175 return ret;
176 176
177 for (i = 0; pdisp && i < pdisp->vblank.index_nr; i++) { 177 for (i = 0; pdisp && i < pdisp->vblank.index_nr; i++) {
178 ret = nvkm_notify_init(&pdisp->vblank, pclass->vblank, false, 178 ret = nvkm_notify_init(NULL, &pdisp->vblank, pclass->vblank,
179 false,
179 &(struct nvif_notify_head_req_v0) { 180 &(struct nvif_notify_head_req_v0) {
180 .head = i, 181 .head = i,
181 }, 182 },
diff --git a/drivers/gpu/drm/nouveau/core/include/core/client.h b/drivers/gpu/drm/nouveau/core/include/core/client.h
index 1794a05205d8..b0ce9f6680b5 100644
--- a/drivers/gpu/drm/nouveau/core/include/core/client.h
+++ b/drivers/gpu/drm/nouveau/core/include/core/client.h
@@ -48,7 +48,7 @@ int nouveau_client_init(struct nouveau_client *);
48int nouveau_client_fini(struct nouveau_client *, bool suspend); 48int nouveau_client_fini(struct nouveau_client *, bool suspend);
49const char *nouveau_client_name(void *obj); 49const char *nouveau_client_name(void *obj);
50 50
51int nvkm_client_notify_new(struct nouveau_client *, struct nvkm_event *, 51int nvkm_client_notify_new(struct nouveau_object *, struct nvkm_event *,
52 void *data, u32 size); 52 void *data, u32 size);
53int nvkm_client_notify_del(struct nouveau_client *, int index); 53int nvkm_client_notify_del(struct nouveau_client *, int index);
54int nvkm_client_notify_get(struct nouveau_client *, int index); 54int nvkm_client_notify_get(struct nouveau_client *, int index);
diff --git a/drivers/gpu/drm/nouveau/core/include/core/device.h b/drivers/gpu/drm/nouveau/core/include/core/device.h
index 8743766454a5..1d9d893929bb 100644
--- a/drivers/gpu/drm/nouveau/core/include/core/device.h
+++ b/drivers/gpu/drm/nouveau/core/include/core/device.h
@@ -24,6 +24,7 @@ enum nv_subdev_type {
24 * been created, and are allowed to assume any subdevs in the 24 * been created, and are allowed to assume any subdevs in the
25 * list above them exist and have been initialised. 25 * list above them exist and have been initialised.
26 */ 26 */
27 NVDEV_SUBDEV_FUSE,
27 NVDEV_SUBDEV_MXM, 28 NVDEV_SUBDEV_MXM,
28 NVDEV_SUBDEV_MC, 29 NVDEV_SUBDEV_MC,
29 NVDEV_SUBDEV_BUS, 30 NVDEV_SUBDEV_BUS,
diff --git a/drivers/gpu/drm/nouveau/core/include/core/event.h b/drivers/gpu/drm/nouveau/core/include/core/event.h
index 51e55d03330a..92876528972f 100644
--- a/drivers/gpu/drm/nouveau/core/include/core/event.h
+++ b/drivers/gpu/drm/nouveau/core/include/core/event.h
@@ -4,7 +4,8 @@
4#include <core/notify.h> 4#include <core/notify.h>
5 5
6struct nvkm_event_func { 6struct nvkm_event_func {
7 int (*ctor)(void *data, u32 size, struct nvkm_notify *); 7 int (*ctor)(struct nouveau_object *, void *data, u32 size,
8 struct nvkm_notify *);
8 void (*send)(void *data, u32 size, struct nvkm_notify *); 9 void (*send)(void *data, u32 size, struct nvkm_notify *);
9 void (*init)(struct nvkm_event *, int type, int index); 10 void (*init)(struct nvkm_event *, int type, int index);
10 void (*fini)(struct nvkm_event *, int type, int index); 11 void (*fini)(struct nvkm_event *, int type, int index);
diff --git a/drivers/gpu/drm/nouveau/core/include/core/mm.h b/drivers/gpu/drm/nouveau/core/include/core/mm.h
index 2bf7d0e32261..bfe6931544fe 100644
--- a/drivers/gpu/drm/nouveau/core/include/core/mm.h
+++ b/drivers/gpu/drm/nouveau/core/include/core/mm.h
@@ -6,6 +6,10 @@ struct nouveau_mm_node {
6 struct list_head fl_entry; 6 struct list_head fl_entry;
7 struct list_head rl_entry; 7 struct list_head rl_entry;
8 8
9#define NVKM_MM_HEAP_ANY 0x00
10 u8 heap;
11#define NVKM_MM_TYPE_NONE 0x00
12#define NVKM_MM_TYPE_HOLE 0xff
9 u8 type; 13 u8 type;
10 u32 offset; 14 u32 offset;
11 u32 length; 15 u32 length;
@@ -27,10 +31,10 @@ nouveau_mm_initialised(struct nouveau_mm *mm)
27 31
28int nouveau_mm_init(struct nouveau_mm *, u32 offset, u32 length, u32 block); 32int nouveau_mm_init(struct nouveau_mm *, u32 offset, u32 length, u32 block);
29int nouveau_mm_fini(struct nouveau_mm *); 33int nouveau_mm_fini(struct nouveau_mm *);
30int nouveau_mm_head(struct nouveau_mm *, u8 type, u32 size_max, u32 size_min, 34int nouveau_mm_head(struct nouveau_mm *, u8 heap, u8 type, u32 size_max,
31 u32 align, struct nouveau_mm_node **); 35 u32 size_min, u32 align, struct nouveau_mm_node **);
32int nouveau_mm_tail(struct nouveau_mm *, u8 type, u32 size_max, u32 size_min, 36int nouveau_mm_tail(struct nouveau_mm *, u8 heap, u8 type, u32 size_max,
33 u32 align, struct nouveau_mm_node **); 37 u32 size_min, u32 align, struct nouveau_mm_node **);
34void nouveau_mm_free(struct nouveau_mm *, struct nouveau_mm_node **); 38void nouveau_mm_free(struct nouveau_mm *, struct nouveau_mm_node **);
35 39
36#endif 40#endif
diff --git a/drivers/gpu/drm/nouveau/core/include/core/notify.h b/drivers/gpu/drm/nouveau/core/include/core/notify.h
index 1262d8f020f3..a7c3c5f578cc 100644
--- a/drivers/gpu/drm/nouveau/core/include/core/notify.h
+++ b/drivers/gpu/drm/nouveau/core/include/core/notify.h
@@ -25,8 +25,9 @@ struct nvkm_notify {
25 const void *data; 25 const void *data;
26}; 26};
27 27
28int nvkm_notify_init(struct nvkm_event *, int (*func)(struct nvkm_notify *), 28int nvkm_notify_init(struct nouveau_object *, struct nvkm_event *,
29 bool work, void *data, u32 size, u32 reply, 29 int (*func)(struct nvkm_notify *), bool work,
30 void *data, u32 size, u32 reply,
30 struct nvkm_notify *); 31 struct nvkm_notify *);
31void nvkm_notify_fini(struct nvkm_notify *); 32void nvkm_notify_fini(struct nvkm_notify *);
32void nvkm_notify_get(struct nvkm_notify *); 33void nvkm_notify_get(struct nvkm_notify *);
diff --git a/drivers/gpu/drm/nouveau/core/include/engine/fifo.h b/drivers/gpu/drm/nouveau/core/include/engine/fifo.h
index e5e4d930b2c2..2007453f6fce 100644
--- a/drivers/gpu/drm/nouveau/core/include/engine/fifo.h
+++ b/drivers/gpu/drm/nouveau/core/include/engine/fifo.h
@@ -116,7 +116,8 @@ extern struct nouveau_oclass *nve0_fifo_oclass;
116extern struct nouveau_oclass *gk20a_fifo_oclass; 116extern struct nouveau_oclass *gk20a_fifo_oclass;
117extern struct nouveau_oclass *nv108_fifo_oclass; 117extern struct nouveau_oclass *nv108_fifo_oclass;
118 118
119int nouveau_fifo_uevent_ctor(void *, u32, struct nvkm_notify *); 119int nouveau_fifo_uevent_ctor(struct nouveau_object *, void *, u32,
120 struct nvkm_notify *);
120void nouveau_fifo_uevent(struct nouveau_fifo *); 121void nouveau_fifo_uevent(struct nouveau_fifo *);
121 122
122void nv04_fifo_intr(struct nouveau_subdev *); 123void nv04_fifo_intr(struct nouveau_subdev *);
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/bar.h b/drivers/gpu/drm/nouveau/core/include/subdev/bar.h
index be037fac534c..257ddf6d36d4 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/bar.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/bar.h
@@ -12,7 +12,6 @@ struct nouveau_bar {
12 12
13 int (*alloc)(struct nouveau_bar *, struct nouveau_object *, 13 int (*alloc)(struct nouveau_bar *, struct nouveau_object *,
14 struct nouveau_mem *, struct nouveau_object **); 14 struct nouveau_mem *, struct nouveau_object **);
15 void __iomem *iomem;
16 15
17 int (*kmap)(struct nouveau_bar *, struct nouveau_mem *, 16 int (*kmap)(struct nouveau_bar *, struct nouveau_mem *,
18 u32 flags, struct nouveau_vma *); 17 u32 flags, struct nouveau_vma *);
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/bios/M0205.h b/drivers/gpu/drm/nouveau/core/include/subdev/bios/M0205.h
new file mode 100644
index 000000000000..e171120cec81
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/bios/M0205.h
@@ -0,0 +1,32 @@
1#ifndef __NVBIOS_M0205_H__
2#define __NVBIOS_M0205_H__
3
4struct nvbios_M0205T {
5 u16 freq;
6};
7
8u32 nvbios_M0205Te(struct nouveau_bios *,
9 u8 *ver, u8 *hdr, u8 *cnt, u8 *len, u8 *snr, u8 *ssz);
10u32 nvbios_M0205Tp(struct nouveau_bios *,
11 u8 *ver, u8 *hdr, u8 *cnt, u8 *len, u8 *snr, u8 *ssz,
12 struct nvbios_M0205T *);
13
14struct nvbios_M0205E {
15 u8 type;
16};
17
18u32 nvbios_M0205Ee(struct nouveau_bios *, int idx,
19 u8 *ver, u8 *hdr, u8 *cnt, u8 *len);
20u32 nvbios_M0205Ep(struct nouveau_bios *, int idx,
21 u8 *ver, u8 *hdr, u8 *cnt, u8 *len,
22 struct nvbios_M0205E *);
23
24struct nvbios_M0205S {
25 u8 data;
26};
27
28u32 nvbios_M0205Se(struct nouveau_bios *, int ent, int idx, u8 *ver, u8 *hdr);
29u32 nvbios_M0205Sp(struct nouveau_bios *, int ent, int idx, u8 *ver, u8 *hdr,
30 struct nvbios_M0205S *);
31
32#endif
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/bios/M0209.h b/drivers/gpu/drm/nouveau/core/include/subdev/bios/M0209.h
new file mode 100644
index 000000000000..67dc50d837bc
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/bios/M0209.h
@@ -0,0 +1,30 @@
1#ifndef __NVBIOS_M0209_H__
2#define __NVBIOS_M0209_H__
3
4u32 nvbios_M0209Te(struct nouveau_bios *,
5 u8 *ver, u8 *hdr, u8 *cnt, u8 *len, u8 *snr, u8 *ssz);
6
7struct nvbios_M0209E {
8 u8 v00_40;
9 u8 bits;
10 u8 modulo;
11 u8 v02_40;
12 u8 v02_07;
13 u8 v03;
14};
15
16u32 nvbios_M0209Ee(struct nouveau_bios *, int idx,
17 u8 *ver, u8 *hdr, u8 *cnt, u8 *len);
18u32 nvbios_M0209Ep(struct nouveau_bios *, int idx,
19 u8 *ver, u8 *hdr, u8 *cnt, u8 *len,
20 struct nvbios_M0209E *);
21
22struct nvbios_M0209S {
23 u32 data[0x200];
24};
25
26u32 nvbios_M0209Se(struct nouveau_bios *, int ent, int idx, u8 *ver, u8 *hdr);
27u32 nvbios_M0209Sp(struct nouveau_bios *, int ent, int idx, u8 *ver, u8 *hdr,
28 struct nvbios_M0209S *);
29
30#endif
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/bios/fan.h b/drivers/gpu/drm/nouveau/core/include/subdev/bios/fan.h
new file mode 100644
index 000000000000..119d0874e041
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/bios/fan.h
@@ -0,0 +1,8 @@
1#ifndef __NVBIOS_FAN_H__
2#define __NVBIOS_FAN_H__
3
4#include <subdev/bios/therm.h>
5
6u16 nvbios_fan_parse(struct nouveau_bios *bios, struct nvbios_therm_fan *fan);
7
8#endif
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/bios/ramcfg.h b/drivers/gpu/drm/nouveau/core/include/subdev/bios/ramcfg.h
index c086ac6d677d..a685bbd04568 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/bios/ramcfg.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/bios/ramcfg.h
@@ -4,60 +4,118 @@
4struct nouveau_bios; 4struct nouveau_bios;
5 5
6struct nvbios_ramcfg { 6struct nvbios_ramcfg {
7 unsigned rammap_11_08_01:1; 7 unsigned rammap_ver;
8 unsigned rammap_11_08_0c:2; 8 unsigned rammap_hdr;
9 unsigned rammap_11_08_10:1; 9 unsigned rammap_min;
10 unsigned rammap_11_11_0c:2; 10 unsigned rammap_max;
11 union {
12 struct {
13 unsigned rammap_10_04_02:1;
14 unsigned rammap_10_04_08:1;
15 };
16 struct {
17 unsigned rammap_11_08_01:1;
18 unsigned rammap_11_08_0c:2;
19 unsigned rammap_11_08_10:1;
20 unsigned rammap_11_09_01ff:9;
21 unsigned rammap_11_0a_03fe:9;
22 unsigned rammap_11_0a_0400:1;
23 unsigned rammap_11_0a_0800:1;
24 unsigned rammap_11_0b_01f0:5;
25 unsigned rammap_11_0b_0200:1;
26 unsigned rammap_11_0b_0400:1;
27 unsigned rammap_11_0b_0800:1;
28 unsigned rammap_11_0d:8;
29 unsigned rammap_11_0e:8;
30 unsigned rammap_11_0f:8;
31 unsigned rammap_11_11_0c:2;
32 };
33 };
11 34
12 unsigned ramcfg_11_01_01:1; 35 unsigned ramcfg_ver;
13 unsigned ramcfg_11_01_02:1; 36 unsigned ramcfg_hdr;
14 unsigned ramcfg_11_01_04:1; 37 unsigned ramcfg_timing;
15 unsigned ramcfg_11_01_08:1; 38 union {
16 unsigned ramcfg_11_01_10:1; 39 struct {
17 unsigned ramcfg_11_01_20:1; 40 unsigned ramcfg_10_02_01:1;
18 unsigned ramcfg_11_01_40:1; 41 unsigned ramcfg_10_02_02:1;
19 unsigned ramcfg_11_01_80:1; 42 unsigned ramcfg_10_02_04:1;
20 unsigned ramcfg_11_02_03:2; 43 unsigned ramcfg_10_02_08:1;
21 unsigned ramcfg_11_02_04:1; 44 unsigned ramcfg_10_02_10:1;
22 unsigned ramcfg_11_02_08:1; 45 unsigned ramcfg_10_02_20:1;
23 unsigned ramcfg_11_02_10:1; 46 unsigned ramcfg_10_02_40:1;
24 unsigned ramcfg_11_02_40:1; 47 unsigned ramcfg_10_03_0f:4;
25 unsigned ramcfg_11_02_80:1; 48 unsigned ramcfg_10_05:8;
26 unsigned ramcfg_11_03_0f:4; 49 unsigned ramcfg_10_06:8;
27 unsigned ramcfg_11_03_30:2; 50 unsigned ramcfg_10_07:8;
28 unsigned ramcfg_11_03_c0:2; 51 unsigned ramcfg_10_08:8;
29 unsigned ramcfg_11_03_f0:4; 52 unsigned ramcfg_10_09_0f:4;
30 unsigned ramcfg_11_04:8; 53 unsigned ramcfg_10_09_f0:4;
31 unsigned ramcfg_11_06:8; 54 };
32 unsigned ramcfg_11_07_02:1; 55 struct {
33 unsigned ramcfg_11_07_04:1; 56 unsigned ramcfg_11_01_01:1;
34 unsigned ramcfg_11_07_08:1; 57 unsigned ramcfg_11_01_02:1;
35 unsigned ramcfg_11_07_10:1; 58 unsigned ramcfg_11_01_04:1;
36 unsigned ramcfg_11_07_40:1; 59 unsigned ramcfg_11_01_08:1;
37 unsigned ramcfg_11_07_80:1; 60 unsigned ramcfg_11_01_10:1;
38 unsigned ramcfg_11_08_01:1; 61 unsigned ramcfg_11_01_20:1;
39 unsigned ramcfg_11_08_02:1; 62 unsigned ramcfg_11_01_40:1;
40 unsigned ramcfg_11_08_04:1; 63 unsigned ramcfg_11_01_80:1;
41 unsigned ramcfg_11_08_08:1; 64 unsigned ramcfg_11_02_03:2;
42 unsigned ramcfg_11_08_10:1; 65 unsigned ramcfg_11_02_04:1;
43 unsigned ramcfg_11_08_20:1; 66 unsigned ramcfg_11_02_08:1;
44 unsigned ramcfg_11_09:8; 67 unsigned ramcfg_11_02_10:1;
68 unsigned ramcfg_11_02_40:1;
69 unsigned ramcfg_11_02_80:1;
70 unsigned ramcfg_11_03_0f:4;
71 unsigned ramcfg_11_03_30:2;
72 unsigned ramcfg_11_03_c0:2;
73 unsigned ramcfg_11_03_f0:4;
74 unsigned ramcfg_11_04:8;
75 unsigned ramcfg_11_06:8;
76 unsigned ramcfg_11_07_02:1;
77 unsigned ramcfg_11_07_04:1;
78 unsigned ramcfg_11_07_08:1;
79 unsigned ramcfg_11_07_10:1;
80 unsigned ramcfg_11_07_40:1;
81 unsigned ramcfg_11_07_80:1;
82 unsigned ramcfg_11_08_01:1;
83 unsigned ramcfg_11_08_02:1;
84 unsigned ramcfg_11_08_04:1;
85 unsigned ramcfg_11_08_08:1;
86 unsigned ramcfg_11_08_10:1;
87 unsigned ramcfg_11_08_20:1;
88 unsigned ramcfg_11_09:8;
89 };
90 };
45 91
92 unsigned timing_ver;
93 unsigned timing_hdr;
46 unsigned timing[11]; 94 unsigned timing[11];
47 unsigned timing_20_2e_03:2; 95 union {
48 unsigned timing_20_2e_30:2; 96 struct {
49 unsigned timing_20_2e_c0:2; 97 unsigned timing_10_WR:8;
50 unsigned timing_20_2f_03:2; 98 unsigned timing_10_CL:8;
51 unsigned timing_20_2c_003f:6; 99 unsigned timing_10_ODT:3;
52 unsigned timing_20_2c_1fc0:7; 100 unsigned timing_10_CWL:8;
53 unsigned timing_20_30_f8:5; 101 };
54 unsigned timing_20_30_07:3; 102 struct {
55 unsigned timing_20_31_0007:3; 103 unsigned timing_20_2e_03:2;
56 unsigned timing_20_31_0078:4; 104 unsigned timing_20_2e_30:2;
57 unsigned timing_20_31_0780:4; 105 unsigned timing_20_2e_c0:2;
58 unsigned timing_20_31_0800:1; 106 unsigned timing_20_2f_03:2;
59 unsigned timing_20_31_7000:3; 107 unsigned timing_20_2c_003f:6;
60 unsigned timing_20_31_8000:1; 108 unsigned timing_20_2c_1fc0:7;
109 unsigned timing_20_30_f8:5;
110 unsigned timing_20_30_07:3;
111 unsigned timing_20_31_0007:3;
112 unsigned timing_20_31_0078:4;
113 unsigned timing_20_31_0780:4;
114 unsigned timing_20_31_0800:1;
115 unsigned timing_20_31_7000:3;
116 unsigned timing_20_31_8000:1;
117 };
118 };
61}; 119};
62 120
63u8 nvbios_ramcfg_count(struct nouveau_bios *); 121u8 nvbios_ramcfg_count(struct nouveau_bios *);
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/bios/rammap.h b/drivers/gpu/drm/nouveau/core/include/subdev/bios/rammap.h
index 5bdf8e4db40a..47e021d3e20d 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/bios/rammap.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/bios/rammap.h
@@ -8,9 +8,10 @@ u32 nvbios_rammapTe(struct nouveau_bios *, u8 *ver, u8 *hdr,
8 8
9u32 nvbios_rammapEe(struct nouveau_bios *, int idx, 9u32 nvbios_rammapEe(struct nouveau_bios *, int idx,
10 u8 *ver, u8 *hdr, u8 *cnt, u8 *len); 10 u8 *ver, u8 *hdr, u8 *cnt, u8 *len);
11u32 nvbios_rammapEp(struct nouveau_bios *, int idx,
12 u8 *ver, u8 *hdr, u8 *cnt, u8 *len,
13 struct nvbios_ramcfg *);
11u32 nvbios_rammapEm(struct nouveau_bios *, u16 mhz, 14u32 nvbios_rammapEm(struct nouveau_bios *, u16 mhz,
12 u8 *ver, u8 *hdr, u8 *cnt, u8 *len);
13u32 nvbios_rammapEp(struct nouveau_bios *, u16 mhz,
14 u8 *ver, u8 *hdr, u8 *cnt, u8 *len, 15 u8 *ver, u8 *hdr, u8 *cnt, u8 *len,
15 struct nvbios_ramcfg *); 16 struct nvbios_ramcfg *);
16 17
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/bios/therm.h b/drivers/gpu/drm/nouveau/core/include/subdev/bios/therm.h
index 8dc5051df55d..295d093f3b30 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/bios/therm.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/bios/therm.h
@@ -23,6 +23,12 @@ struct nvbios_therm_sensor {
23 struct nvbios_therm_threshold thrs_shutdown; 23 struct nvbios_therm_threshold thrs_shutdown;
24}; 24};
25 25
26enum nvbios_therm_fan_type {
27 NVBIOS_THERM_FAN_UNK = 0,
28 NVBIOS_THERM_FAN_TOGGLE = 1,
29 NVBIOS_THERM_FAN_PWM = 2,
30};
31
26/* no vbios have more than 6 */ 32/* no vbios have more than 6 */
27#define NOUVEAU_TEMP_FAN_TRIP_MAX 10 33#define NOUVEAU_TEMP_FAN_TRIP_MAX 10
28struct nouveau_therm_trip_point { 34struct nouveau_therm_trip_point {
@@ -38,7 +44,9 @@ enum nvbios_therm_fan_mode {
38}; 44};
39 45
40struct nvbios_therm_fan { 46struct nvbios_therm_fan {
41 u16 pwm_freq; 47 enum nvbios_therm_fan_type type;
48
49 u32 pwm_freq;
42 50
43 u8 min_duty; 51 u8 min_duty;
44 u8 max_duty; 52 u8 max_duty;
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/clock.h b/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
index a5ca00dd2f61..36ed035d4d42 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
@@ -29,6 +29,7 @@ enum nv_clk_src {
29 nv_clk_src_mdiv, 29 nv_clk_src_mdiv,
30 30
31 nv_clk_src_core, 31 nv_clk_src_core,
32 nv_clk_src_core_intm,
32 nv_clk_src_shader, 33 nv_clk_src_shader,
33 34
34 nv_clk_src_mem, 35 nv_clk_src_mem,
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/fb.h b/drivers/gpu/drm/nouveau/core/include/subdev/fb.h
index 871e73914b24..8d0032f15205 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/fb.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/fb.h
@@ -111,6 +111,7 @@ extern struct nouveau_oclass *gm107_fb_oclass;
111#include <subdev/bios/ramcfg.h> 111#include <subdev/bios/ramcfg.h>
112 112
113struct nouveau_ram_data { 113struct nouveau_ram_data {
114 struct list_head head;
114 struct nvbios_ramcfg bios; 115 struct nvbios_ramcfg bios;
115 u32 freq; 116 u32 freq;
116}; 117};
@@ -136,6 +137,7 @@ struct nouveau_ram {
136 137
137 int ranks; 138 int ranks;
138 int parts; 139 int parts;
140 int part_mask;
139 141
140 int (*get)(struct nouveau_fb *, u64 size, u32 align, 142 int (*get)(struct nouveau_fb *, u64 size, u32 align,
141 u32 size_nc, u32 type, struct nouveau_mem **); 143 u32 size_nc, u32 type, struct nouveau_mem **);
@@ -144,11 +146,6 @@ struct nouveau_ram {
144 int (*calc)(struct nouveau_fb *, u32 freq); 146 int (*calc)(struct nouveau_fb *, u32 freq);
145 int (*prog)(struct nouveau_fb *); 147 int (*prog)(struct nouveau_fb *);
146 void (*tidy)(struct nouveau_fb *); 148 void (*tidy)(struct nouveau_fb *);
147 struct {
148 u8 version;
149 u32 data;
150 u8 size;
151 } rammap, ramcfg, timing;
152 u32 freq; 149 u32 freq;
153 u32 mr[16]; 150 u32 mr[16];
154 u32 mr1_nuts; 151 u32 mr1_nuts;
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/fb/regsnv04.h b/drivers/gpu/drm/nouveau/core/include/subdev/fb/regsnv04.h
new file mode 100644
index 000000000000..0f7fc0c52ab2
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/fb/regsnv04.h
@@ -0,0 +1,21 @@
1#ifndef __NOUVEAU_FB_REGS_04_H__
2#define __NOUVEAU_FB_REGS_04_H__
3
4#define NV04_PFB_BOOT_0 0x00100000
5# define NV04_PFB_BOOT_0_RAM_AMOUNT 0x00000003
6# define NV04_PFB_BOOT_0_RAM_AMOUNT_32MB 0x00000000
7# define NV04_PFB_BOOT_0_RAM_AMOUNT_4MB 0x00000001
8# define NV04_PFB_BOOT_0_RAM_AMOUNT_8MB 0x00000002
9# define NV04_PFB_BOOT_0_RAM_AMOUNT_16MB 0x00000003
10# define NV04_PFB_BOOT_0_RAM_WIDTH_128 0x00000004
11# define NV04_PFB_BOOT_0_RAM_TYPE 0x00000028
12# define NV04_PFB_BOOT_0_RAM_TYPE_SGRAM_8MBIT 0x00000000
13# define NV04_PFB_BOOT_0_RAM_TYPE_SGRAM_16MBIT 0x00000008
14# define NV04_PFB_BOOT_0_RAM_TYPE_SGRAM_16MBIT_4BANK 0x00000010
15# define NV04_PFB_BOOT_0_RAM_TYPE_SDRAM_16MBIT 0x00000018
16# define NV04_PFB_BOOT_0_RAM_TYPE_SDRAM_64MBIT 0x00000020
17# define NV04_PFB_BOOT_0_RAM_TYPE_SDRAM_64MBITX16 0x00000028
18# define NV04_PFB_BOOT_0_UMA_ENABLE 0x00000100
19# define NV04_PFB_BOOT_0_UMA_SIZE 0x0000f000
20
21#endif
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/fuse.h b/drivers/gpu/drm/nouveau/core/include/subdev/fuse.h
new file mode 100644
index 000000000000..2b1ddb2a9a7d
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/fuse.h
@@ -0,0 +1,30 @@
1#ifndef __NOUVEAU_FUSE_H__
2#define __NOUVEAU_FUSE_H__
3
4#include <core/subdev.h>
5#include <core/device.h>
6
7struct nouveau_fuse {
8 struct nouveau_subdev base;
9};
10
11static inline struct nouveau_fuse *
12nouveau_fuse(void *obj)
13{
14 return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_FUSE];
15}
16
17#define nouveau_fuse_create(p, e, o, d) \
18 nouveau_fuse_create_((p), (e), (o), sizeof(**d), (void **)d)
19
20int nouveau_fuse_create_(struct nouveau_object *, struct nouveau_object *,
21 struct nouveau_oclass *, int, void **);
22void _nouveau_fuse_dtor(struct nouveau_object *);
23int _nouveau_fuse_init(struct nouveau_object *);
24#define _nouveau_fuse_fini _nouveau_subdev_fini
25
26extern struct nouveau_oclass g80_fuse_oclass;
27extern struct nouveau_oclass gf100_fuse_oclass;
28extern struct nouveau_oclass gm107_fuse_oclass;
29
30#endif
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/gpio.h b/drivers/gpu/drm/nouveau/core/include/subdev/gpio.h
index b73733d21cc7..f855140dbcb7 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/gpio.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/gpio.h
@@ -40,7 +40,7 @@ nouveau_gpio(void *obj)
40 40
41extern struct nouveau_oclass *nv10_gpio_oclass; 41extern struct nouveau_oclass *nv10_gpio_oclass;
42extern struct nouveau_oclass *nv50_gpio_oclass; 42extern struct nouveau_oclass *nv50_gpio_oclass;
43extern struct nouveau_oclass *nv92_gpio_oclass; 43extern struct nouveau_oclass *nv94_gpio_oclass;
44extern struct nouveau_oclass *nvd0_gpio_oclass; 44extern struct nouveau_oclass *nvd0_gpio_oclass;
45extern struct nouveau_oclass *nve0_gpio_oclass; 45extern struct nouveau_oclass *nve0_gpio_oclass;
46 46
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/pwr.h b/drivers/gpu/drm/nouveau/core/include/subdev/pwr.h
index f73feec151db..bf3d1f611333 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/pwr.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/pwr.h
@@ -47,5 +47,8 @@ void nouveau_memx_wr32(struct nouveau_memx *, u32 addr, u32 data);
47void nouveau_memx_wait(struct nouveau_memx *, 47void nouveau_memx_wait(struct nouveau_memx *,
48 u32 addr, u32 mask, u32 data, u32 nsec); 48 u32 addr, u32 mask, u32 data, u32 nsec);
49void nouveau_memx_nsec(struct nouveau_memx *, u32 nsec); 49void nouveau_memx_nsec(struct nouveau_memx *, u32 nsec);
50void nouveau_memx_wait_vblank(struct nouveau_memx *);
51void nouveau_memx_block(struct nouveau_memx *);
52void nouveau_memx_unblock(struct nouveau_memx *);
50 53
51#endif 54#endif
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/therm.h b/drivers/gpu/drm/nouveau/core/include/subdev/therm.h
index d4a68179e586..a437597dcafc 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/therm.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/therm.h
@@ -78,5 +78,6 @@ extern struct nouveau_oclass nv50_therm_oclass;
78extern struct nouveau_oclass nv84_therm_oclass; 78extern struct nouveau_oclass nv84_therm_oclass;
79extern struct nouveau_oclass nva3_therm_oclass; 79extern struct nouveau_oclass nva3_therm_oclass;
80extern struct nouveau_oclass nvd0_therm_oclass; 80extern struct nouveau_oclass nvd0_therm_oclass;
81extern struct nouveau_oclass gm107_therm_oclass;
81 82
82#endif 83#endif
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bar/base.c b/drivers/gpu/drm/nouveau/core/subdev/bar/base.c
index 8bcbdf39cfb2..b1adc69efd88 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bar/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bar/base.c
@@ -38,10 +38,12 @@ struct nouveau_barobj {
38static int 38static int
39nouveau_barobj_ctor(struct nouveau_object *parent, 39nouveau_barobj_ctor(struct nouveau_object *parent,
40 struct nouveau_object *engine, 40 struct nouveau_object *engine,
41 struct nouveau_oclass *oclass, void *mem, u32 size, 41 struct nouveau_oclass *oclass, void *data, u32 size,
42 struct nouveau_object **pobject) 42 struct nouveau_object **pobject)
43{ 43{
44 struct nouveau_device *device = nv_device(parent);
44 struct nouveau_bar *bar = (void *)engine; 45 struct nouveau_bar *bar = (void *)engine;
46 struct nouveau_mem *mem = data;
45 struct nouveau_barobj *barobj; 47 struct nouveau_barobj *barobj;
46 int ret; 48 int ret;
47 49
@@ -54,7 +56,13 @@ nouveau_barobj_ctor(struct nouveau_object *parent,
54 if (ret) 56 if (ret)
55 return ret; 57 return ret;
56 58
57 barobj->iomem = bar->iomem + (u32)barobj->vma.offset; 59 barobj->iomem = ioremap(nv_device_resource_start(device, 3) +
60 (u32)barobj->vma.offset, mem->size << 12);
61 if (!barobj->iomem) {
62 nv_warn(bar, "PRAMIN ioremap failed\n");
63 return -ENOMEM;
64 }
65
58 return 0; 66 return 0;
59} 67}
60 68
@@ -63,8 +71,11 @@ nouveau_barobj_dtor(struct nouveau_object *object)
63{ 71{
64 struct nouveau_bar *bar = (void *)object->engine; 72 struct nouveau_bar *bar = (void *)object->engine;
65 struct nouveau_barobj *barobj = (void *)object; 73 struct nouveau_barobj *barobj = (void *)object;
66 if (barobj->vma.node) 74 if (barobj->vma.node) {
75 if (barobj->iomem)
76 iounmap(barobj->iomem);
67 bar->unmap(bar, &barobj->vma); 77 bar->unmap(bar, &barobj->vma);
78 }
68 nouveau_object_destroy(&barobj->base); 79 nouveau_object_destroy(&barobj->base);
69} 80}
70 81
@@ -99,12 +110,11 @@ nouveau_bar_alloc(struct nouveau_bar *bar, struct nouveau_object *parent,
99 struct nouveau_mem *mem, struct nouveau_object **pobject) 110 struct nouveau_mem *mem, struct nouveau_object **pobject)
100{ 111{
101 struct nouveau_object *engine = nv_object(bar); 112 struct nouveau_object *engine = nv_object(bar);
102 int ret = -ENOMEM; 113 struct nouveau_object *gpuobj;
103 if (bar->iomem) { 114 int ret = nouveau_object_ctor(parent, engine, &nouveau_barobj_oclass,
104 ret = nouveau_object_ctor(parent, engine, 115 mem, 0, &gpuobj);
105 &nouveau_barobj_oclass, 116 if (ret == 0)
106 mem, 0, pobject); 117 *pobject = gpuobj;
107 }
108 return ret; 118 return ret;
109} 119}
110 120
@@ -113,7 +123,6 @@ nouveau_bar_create_(struct nouveau_object *parent,
113 struct nouveau_object *engine, 123 struct nouveau_object *engine,
114 struct nouveau_oclass *oclass, int length, void **pobject) 124 struct nouveau_oclass *oclass, int length, void **pobject)
115{ 125{
116 struct nouveau_device *device = nv_device(parent);
117 struct nouveau_bar *bar; 126 struct nouveau_bar *bar;
118 int ret; 127 int ret;
119 128
@@ -123,21 +132,12 @@ nouveau_bar_create_(struct nouveau_object *parent,
123 if (ret) 132 if (ret)
124 return ret; 133 return ret;
125 134
126 if (nv_device_resource_len(device, 3) != 0) {
127 bar->iomem = ioremap(nv_device_resource_start(device, 3),
128 nv_device_resource_len(device, 3));
129 if (!bar->iomem)
130 nv_warn(bar, "PRAMIN ioremap failed\n");
131 }
132
133 return 0; 135 return 0;
134} 136}
135 137
136void 138void
137nouveau_bar_destroy(struct nouveau_bar *bar) 139nouveau_bar_destroy(struct nouveau_bar *bar)
138{ 140{
139 if (bar->iomem)
140 iounmap(bar->iomem);
141 nouveau_subdev_destroy(&bar->base); 141 nouveau_subdev_destroy(&bar->base);
142} 142}
143 143
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/M0205.c b/drivers/gpu/drm/nouveau/core/subdev/bios/M0205.c
new file mode 100644
index 000000000000..ac9617c5fc2a
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/M0205.c
@@ -0,0 +1,136 @@
1/*
2 * Copyright 2013 Red Hat Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: Ben Skeggs
23 */
24
25#include <subdev/bios.h>
26#include <subdev/bios/bit.h>
27#include <subdev/bios/M0205.h>
28
29u32
30nvbios_M0205Te(struct nouveau_bios *bios,
31 u8 *ver, u8 *hdr, u8 *cnt, u8 *len, u8 *snr, u8 *ssz)
32{
33 struct bit_entry bit_M;
34 u32 data = 0x00000000;
35
36 if (!bit_entry(bios, 'M', &bit_M)) {
37 if (bit_M.version == 2 && bit_M.length > 0x08)
38 data = nv_ro32(bios, bit_M.offset + 0x05);
39 if (data) {
40 *ver = nv_ro08(bios, data + 0x00);
41 switch (*ver) {
42 case 0x10:
43 *hdr = nv_ro08(bios, data + 0x01);
44 *len = nv_ro08(bios, data + 0x02);
45 *ssz = nv_ro08(bios, data + 0x03);
46 *snr = nv_ro08(bios, data + 0x04);
47 *cnt = nv_ro08(bios, data + 0x05);
48 return data;
49 default:
50 break;
51 }
52 }
53 }
54
55 return 0x00000000;
56}
57
58u32
59nvbios_M0205Tp(struct nouveau_bios *bios,
60 u8 *ver, u8 *hdr, u8 *cnt, u8 *len, u8 *snr, u8 *ssz,
61 struct nvbios_M0205T *info)
62{
63 u32 data = nvbios_M0205Te(bios, ver, hdr, cnt, len, snr, ssz);
64 memset(info, 0x00, sizeof(*info));
65 switch (!!data * *ver) {
66 case 0x10:
67 info->freq = nv_ro16(bios, data + 0x06);
68 break;
69 default:
70 break;
71 }
72 return data;
73}
74
75u32
76nvbios_M0205Ee(struct nouveau_bios *bios, int idx,
77 u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
78{
79 u8 snr, ssz;
80 u32 data = nvbios_M0205Te(bios, ver, hdr, cnt, len, &snr, &ssz);
81 if (data && idx < *cnt) {
82 data = data + *hdr + idx * (*len + (snr * ssz));
83 *hdr = *len;
84 *cnt = snr;
85 *len = ssz;
86 return data;
87 }
88 return 0x00000000;
89}
90
91u32
92nvbios_M0205Ep(struct nouveau_bios *bios, int idx,
93 u8 *ver, u8 *hdr, u8 *cnt, u8 *len,
94 struct nvbios_M0205E *info)
95{
96 u32 data = nvbios_M0205Ee(bios, idx, ver, hdr, cnt, len);
97 memset(info, 0x00, sizeof(*info));
98 switch (!!data * *ver) {
99 case 0x10:
100 info->type = nv_ro08(bios, data + 0x00) & 0x0f;
101 return data;
102 default:
103 break;
104 }
105 return 0x00000000;
106}
107
108u32
109nvbios_M0205Se(struct nouveau_bios *bios, int ent, int idx, u8 *ver, u8 *hdr)
110{
111
112 u8 cnt, len;
113 u32 data = nvbios_M0205Ee(bios, ent, ver, hdr, &cnt, &len);
114 if (data && idx < cnt) {
115 data = data + *hdr + idx * len;
116 *hdr = len;
117 return data;
118 }
119 return 0x00000000;
120}
121
122u32
123nvbios_M0205Sp(struct nouveau_bios *bios, int ent, int idx, u8 *ver, u8 *hdr,
124 struct nvbios_M0205S *info)
125{
126 u32 data = nvbios_M0205Se(bios, ent, idx, ver, hdr);
127 memset(info, 0x00, sizeof(*info));
128 switch (!!data * *ver) {
129 case 0x10:
130 info->data = nv_ro08(bios, data + 0x00);
131 return data;
132 default:
133 break;
134 }
135 return 0x00000000;
136}
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/M0209.c b/drivers/gpu/drm/nouveau/core/subdev/bios/M0209.c
new file mode 100644
index 000000000000..b142a510e89f
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/M0209.c
@@ -0,0 +1,137 @@
1/*
2 * Copyright 2013 Red Hat Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: Ben Skeggs
23 */
24
25#include <subdev/bios.h>
26#include <subdev/bios/bit.h>
27#include <subdev/bios/M0209.h>
28
29u32
30nvbios_M0209Te(struct nouveau_bios *bios,
31 u8 *ver, u8 *hdr, u8 *cnt, u8 *len, u8 *snr, u8 *ssz)
32{
33 struct bit_entry bit_M;
34 u32 data = 0x00000000;
35
36 if (!bit_entry(bios, 'M', &bit_M)) {
37 if (bit_M.version == 2 && bit_M.length > 0x0c)
38 data = nv_ro32(bios, bit_M.offset + 0x09);
39 if (data) {
40 *ver = nv_ro08(bios, data + 0x00);
41 switch (*ver) {
42 case 0x10:
43 *hdr = nv_ro08(bios, data + 0x01);
44 *len = nv_ro08(bios, data + 0x02);
45 *ssz = nv_ro08(bios, data + 0x03);
46 *snr = 1;
47 *cnt = nv_ro08(bios, data + 0x04);
48 return data;
49 default:
50 break;
51 }
52 }
53 }
54
55 return 0x00000000;
56}
57
58u32
59nvbios_M0209Ee(struct nouveau_bios *bios, int idx,
60 u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
61{
62 u8 snr, ssz;
63 u32 data = nvbios_M0209Te(bios, ver, hdr, cnt, len, &snr, &ssz);
64 if (data && idx < *cnt) {
65 data = data + *hdr + idx * (*len + (snr * ssz));
66 *hdr = *len;
67 *cnt = snr;
68 *len = ssz;
69 return data;
70 }
71 return 0x00000000;
72}
73
74u32
75nvbios_M0209Ep(struct nouveau_bios *bios, int idx,
76 u8 *ver, u8 *hdr, u8 *cnt, u8 *len,
77 struct nvbios_M0209E *info)
78{
79 u32 data = nvbios_M0209Ee(bios, idx, ver, hdr, cnt, len);
80 memset(info, 0x00, sizeof(*info));
81 switch (!!data * *ver) {
82 case 0x10:
83 info->v00_40 = (nv_ro08(bios, data + 0x00) & 0x40) >> 6;
84 info->bits = nv_ro08(bios, data + 0x00) & 0x3f;
85 info->modulo = nv_ro08(bios, data + 0x01);
86 info->v02_40 = (nv_ro08(bios, data + 0x02) & 0x40) >> 6;
87 info->v02_07 = nv_ro08(bios, data + 0x02) & 0x07;
88 info->v03 = nv_ro08(bios, data + 0x03);
89 return data;
90 default:
91 break;
92 }
93 return 0x00000000;
94}
95
96u32
97nvbios_M0209Se(struct nouveau_bios *bios, int ent, int idx, u8 *ver, u8 *hdr)
98{
99
100 u8 cnt, len;
101 u32 data = nvbios_M0209Ee(bios, ent, ver, hdr, &cnt, &len);
102 if (data && idx < cnt) {
103 data = data + *hdr + idx * len;
104 *hdr = len;
105 return data;
106 }
107 return 0x00000000;
108}
109
110u32
111nvbios_M0209Sp(struct nouveau_bios *bios, int ent, int idx, u8 *ver, u8 *hdr,
112 struct nvbios_M0209S *info)
113{
114 struct nvbios_M0209E M0209E;
115 u8 cnt, len;
116 u32 data = nvbios_M0209Ep(bios, ent, ver, hdr, &cnt, &len, &M0209E);
117 if (data) {
118 u32 i, data = nvbios_M0209Se(bios, ent, idx, ver, hdr);
119 memset(info, 0x00, sizeof(*info));
120 switch (!!data * *ver) {
121 case 0x10:
122 for (i = 0; i < ARRAY_SIZE(info->data); i++) {
123 u32 bits = (i % M0209E.modulo) * M0209E.bits;
124 u32 mask = (1ULL << M0209E.bits) - 1;
125 u16 off = bits / 8;
126 u8 mod = bits % 8;
127 info->data[i] = nv_ro32(bios, data + off);
128 info->data[i] = info->data[i] >> mod;
129 info->data[i] = info->data[i] & mask;
130 }
131 return data;
132 default:
133 break;
134 }
135 }
136 return 0x00000000;
137}
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c b/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c
index 88606bfaf847..bd8d348385b3 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c
@@ -124,6 +124,7 @@ dcb_outp_parse(struct nouveau_bios *bios, u8 idx, u8 *ver, u8 *len,
124 struct dcb_output *outp) 124 struct dcb_output *outp)
125{ 125{
126 u16 dcb = dcb_outp(bios, idx, ver, len); 126 u16 dcb = dcb_outp(bios, idx, ver, len);
127 memset(outp, 0x00, sizeof(*outp));
127 if (dcb) { 128 if (dcb) {
128 if (*ver >= 0x20) { 129 if (*ver >= 0x20) {
129 u32 conn = nv_ro32(bios, dcb + 0x00); 130 u32 conn = nv_ro32(bios, dcb + 0x00);
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/fan.c b/drivers/gpu/drm/nouveau/core/subdev/bios/fan.c
new file mode 100644
index 000000000000..e419892240f5
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/fan.c
@@ -0,0 +1,93 @@
1/*
2 * Copyright 2014 Martin Peres
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: Martin Peres
23 */
24
25#include <subdev/bios.h>
26#include <subdev/bios/bit.h>
27#include <subdev/bios/fan.h>
28
29u16
30nvbios_fan_table(struct nouveau_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
31{
32 struct bit_entry bit_P;
33 u16 fan = 0x0000;
34
35 if (!bit_entry(bios, 'P', &bit_P)) {
36 if (bit_P.version == 2 && bit_P.length >= 0x5a)
37 fan = nv_ro16(bios, bit_P.offset + 0x58);
38
39 if (fan) {
40 *ver = nv_ro08(bios, fan + 0);
41 switch (*ver) {
42 case 0x10:
43 *hdr = nv_ro08(bios, fan + 1);
44 *len = nv_ro08(bios, fan + 2);
45 *cnt = nv_ro08(bios, fan + 3);
46 return fan;
47 default:
48 break;
49 }
50 }
51 }
52
53 return 0x0000;
54}
55
56u16
57nvbios_fan_entry(struct nouveau_bios *bios, int idx, u8 *ver, u8 *hdr,
58 u8 *cnt, u8 *len)
59{
60 u16 data = nvbios_fan_table(bios, ver, hdr, cnt, len);
61 if (data && idx < *cnt)
62 return data + *hdr + (idx * (*len));
63 return 0x0000;
64}
65
66u16
67nvbios_fan_parse(struct nouveau_bios *bios, struct nvbios_therm_fan *fan)
68{
69 u8 ver, hdr, cnt, len;
70
71 u16 data = nvbios_fan_entry(bios, 0, &ver, &hdr, &cnt, &len);
72 if (data) {
73 u8 type = nv_ro08(bios, data + 0x00);
74 switch (type) {
75 case 0:
76 fan->type = NVBIOS_THERM_FAN_TOGGLE;
77 break;
78 case 1:
79 case 2:
80 /* TODO: Understand the difference between the two! */
81 fan->type = NVBIOS_THERM_FAN_PWM;
82 break;
83 default:
84 fan->type = NVBIOS_THERM_FAN_UNK;
85 }
86
87 fan->min_duty = nv_ro08(bios, data + 0x02);
88 fan->max_duty = nv_ro08(bios, data + 0x03);
89
90 fan->pwm_freq = nv_ro32(bios, data + 0x0b) & 0xffffff;
91 }
92 return data;
93}
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/rammap.c b/drivers/gpu/drm/nouveau/core/subdev/bios/rammap.c
index 1811b2cb0472..585e69331ccc 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/rammap.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/rammap.c
@@ -75,31 +75,39 @@ nvbios_rammapEe(struct nouveau_bios *bios, int idx,
75} 75}
76 76
77u32 77u32
78nvbios_rammapEm(struct nouveau_bios *bios, u16 khz, 78nvbios_rammapEp(struct nouveau_bios *bios, int idx,
79 u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
80{
81 int idx = 0;
82 u32 data;
83 while ((data = nvbios_rammapEe(bios, idx++, ver, hdr, cnt, len))) {
84 if (khz >= nv_ro16(bios, data + 0x00) &&
85 khz <= nv_ro16(bios, data + 0x02))
86 break;
87 }
88 return data;
89}
90
91u32
92nvbios_rammapEp(struct nouveau_bios *bios, u16 khz,
93 u8 *ver, u8 *hdr, u8 *cnt, u8 *len, 79 u8 *ver, u8 *hdr, u8 *cnt, u8 *len,
94 struct nvbios_ramcfg *p) 80 struct nvbios_ramcfg *p)
95{ 81{
96 u32 data = nvbios_rammapEm(bios, khz, ver, hdr, cnt, len); 82 u32 data = nvbios_rammapEe(bios, idx, ver, hdr, cnt, len), temp;
97 memset(p, 0x00, sizeof(*p)); 83 memset(p, 0x00, sizeof(*p));
84 p->rammap_ver = *ver;
85 p->rammap_hdr = *hdr;
98 switch (!!data * *ver) { 86 switch (!!data * *ver) {
87 case 0x10:
88 p->rammap_min = nv_ro16(bios, data + 0x00);
89 p->rammap_max = nv_ro16(bios, data + 0x02);
90 p->rammap_10_04_02 = (nv_ro08(bios, data + 0x04) & 0x02) >> 1;
91 p->rammap_10_04_08 = (nv_ro08(bios, data + 0x04) & 0x08) >> 3;
92 break;
99 case 0x11: 93 case 0x11:
94 p->rammap_min = nv_ro16(bios, data + 0x00);
95 p->rammap_max = nv_ro16(bios, data + 0x02);
100 p->rammap_11_08_01 = (nv_ro08(bios, data + 0x08) & 0x01) >> 0; 96 p->rammap_11_08_01 = (nv_ro08(bios, data + 0x08) & 0x01) >> 0;
101 p->rammap_11_08_0c = (nv_ro08(bios, data + 0x08) & 0x0c) >> 2; 97 p->rammap_11_08_0c = (nv_ro08(bios, data + 0x08) & 0x0c) >> 2;
102 p->rammap_11_08_10 = (nv_ro08(bios, data + 0x08) & 0x10) >> 4; 98 p->rammap_11_08_10 = (nv_ro08(bios, data + 0x08) & 0x10) >> 4;
99 temp = nv_ro32(bios, data + 0x09);
100 p->rammap_11_09_01ff = (temp & 0x000001ff) >> 0;
101 p->rammap_11_0a_03fe = (temp & 0x0003fe00) >> 9;
102 p->rammap_11_0a_0400 = (temp & 0x00040000) >> 18;
103 p->rammap_11_0a_0800 = (temp & 0x00080000) >> 19;
104 p->rammap_11_0b_01f0 = (temp & 0x01f00000) >> 20;
105 p->rammap_11_0b_0200 = (temp & 0x02000000) >> 25;
106 p->rammap_11_0b_0400 = (temp & 0x04000000) >> 26;
107 p->rammap_11_0b_0800 = (temp & 0x08000000) >> 27;
108 p->rammap_11_0d = nv_ro08(bios, data + 0x0d);
109 p->rammap_11_0e = nv_ro08(bios, data + 0x0e);
110 p->rammap_11_0f = nv_ro08(bios, data + 0x0f);
103 p->rammap_11_11_0c = (nv_ro08(bios, data + 0x11) & 0x0c) >> 2; 111 p->rammap_11_11_0c = (nv_ro08(bios, data + 0x11) & 0x0c) >> 2;
104 break; 112 break;
105 default: 113 default:
@@ -110,6 +118,20 @@ nvbios_rammapEp(struct nouveau_bios *bios, u16 khz,
110} 118}
111 119
112u32 120u32
121nvbios_rammapEm(struct nouveau_bios *bios, u16 mhz,
122 u8 *ver, u8 *hdr, u8 *cnt, u8 *len,
123 struct nvbios_ramcfg *info)
124{
125 int idx = 0;
126 u32 data;
127 while ((data = nvbios_rammapEp(bios, idx++, ver, hdr, cnt, len, info))) {
128 if (mhz >= info->rammap_min && mhz <= info->rammap_max)
129 break;
130 }
131 return data;
132}
133
134u32
113nvbios_rammapSe(struct nouveau_bios *bios, u32 data, 135nvbios_rammapSe(struct nouveau_bios *bios, u32 data,
114 u8 ever, u8 ehdr, u8 ecnt, u8 elen, int idx, 136 u8 ever, u8 ehdr, u8 ecnt, u8 elen, int idx,
115 u8 *ver, u8 *hdr) 137 u8 *ver, u8 *hdr)
@@ -129,8 +151,28 @@ nvbios_rammapSp(struct nouveau_bios *bios, u32 data,
129 u8 *ver, u8 *hdr, struct nvbios_ramcfg *p) 151 u8 *ver, u8 *hdr, struct nvbios_ramcfg *p)
130{ 152{
131 data = nvbios_rammapSe(bios, data, ever, ehdr, ecnt, elen, idx, ver, hdr); 153 data = nvbios_rammapSe(bios, data, ever, ehdr, ecnt, elen, idx, ver, hdr);
154 p->ramcfg_ver = *ver;
155 p->ramcfg_hdr = *hdr;
132 switch (!!data * *ver) { 156 switch (!!data * *ver) {
157 case 0x10:
158 p->ramcfg_timing = nv_ro08(bios, data + 0x01);
159 p->ramcfg_10_02_01 = (nv_ro08(bios, data + 0x02) & 0x01) >> 0;
160 p->ramcfg_10_02_02 = (nv_ro08(bios, data + 0x02) & 0x02) >> 1;
161 p->ramcfg_10_02_04 = (nv_ro08(bios, data + 0x02) & 0x04) >> 2;
162 p->ramcfg_10_02_08 = (nv_ro08(bios, data + 0x02) & 0x08) >> 3;
163 p->ramcfg_10_02_10 = (nv_ro08(bios, data + 0x02) & 0x10) >> 4;
164 p->ramcfg_10_02_20 = (nv_ro08(bios, data + 0x02) & 0x20) >> 5;
165 p->ramcfg_10_02_40 = (nv_ro08(bios, data + 0x02) & 0x40) >> 6;
166 p->ramcfg_10_03_0f = (nv_ro08(bios, data + 0x03) & 0x0f) >> 0;
167 p->ramcfg_10_05 = (nv_ro08(bios, data + 0x05) & 0xff) >> 0;
168 p->ramcfg_10_06 = (nv_ro08(bios, data + 0x06) & 0xff) >> 0;
169 p->ramcfg_10_07 = (nv_ro08(bios, data + 0x07) & 0xff) >> 0;
170 p->ramcfg_10_08 = (nv_ro08(bios, data + 0x08) & 0xff) >> 0;
171 p->ramcfg_10_09_0f = (nv_ro08(bios, data + 0x09) & 0x0f) >> 0;
172 p->ramcfg_10_09_f0 = (nv_ro08(bios, data + 0x09) & 0xf0) >> 4;
173 break;
133 case 0x11: 174 case 0x11:
175 p->ramcfg_timing = nv_ro08(bios, data + 0x00);
134 p->ramcfg_11_01_01 = (nv_ro08(bios, data + 0x01) & 0x01) >> 0; 176 p->ramcfg_11_01_01 = (nv_ro08(bios, data + 0x01) & 0x01) >> 0;
135 p->ramcfg_11_01_02 = (nv_ro08(bios, data + 0x01) & 0x02) >> 1; 177 p->ramcfg_11_01_02 = (nv_ro08(bios, data + 0x01) & 0x02) >> 1;
136 p->ramcfg_11_01_04 = (nv_ro08(bios, data + 0x01) & 0x04) >> 2; 178 p->ramcfg_11_01_04 = (nv_ro08(bios, data + 0x01) & 0x04) >> 2;
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/timing.c b/drivers/gpu/drm/nouveau/core/subdev/bios/timing.c
index 350d44ab2ba2..46d955eb51eb 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/timing.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/timing.c
@@ -89,7 +89,15 @@ nvbios_timingEp(struct nouveau_bios *bios, int idx,
89 struct nvbios_ramcfg *p) 89 struct nvbios_ramcfg *p)
90{ 90{
91 u16 data = nvbios_timingEe(bios, idx, ver, hdr, cnt, len), temp; 91 u16 data = nvbios_timingEe(bios, idx, ver, hdr, cnt, len), temp;
92 p->timing_ver = *ver;
93 p->timing_hdr = *hdr;
92 switch (!!data * *ver) { 94 switch (!!data * *ver) {
95 case 0x10:
96 p->timing_10_WR = nv_ro08(bios, data + 0x00);
97 p->timing_10_CL = nv_ro08(bios, data + 0x02);
98 p->timing_10_ODT = nv_ro08(bios, data + 0x0e) & 0x07;
99 p->timing_10_CWL = nv_ro08(bios, data + 0x13);
100 break;
93 case 0x20: 101 case 0x20:
94 p->timing[0] = nv_ro32(bios, data + 0x00); 102 p->timing[0] = nv_ro32(bios, data + 0x00);
95 p->timing[1] = nv_ro32(bios, data + 0x04); 103 p->timing[1] = nv_ro32(bios, data + 0x04);
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/base.c b/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
index a276a711294a..e51b72d47129 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
@@ -573,7 +573,7 @@ nouveau_clock_create_(struct nouveau_object *parent,
573 573
574 clk->allow_reclock = allow_reclock; 574 clk->allow_reclock = allow_reclock;
575 575
576 ret = nvkm_notify_init(&device->event, nouveau_clock_pwrsrc, true, 576 ret = nvkm_notify_init(NULL, &device->event, nouveau_clock_pwrsrc, true,
577 NULL, 0, 0, &clk->pwrsrc_ntfy); 577 NULL, 0, 0, &clk->pwrsrc_ntfy);
578 if (ret) 578 if (ret)
579 return ret; 579 return ret;
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/nva3.c b/drivers/gpu/drm/nouveau/core/subdev/clock/nva3.c
index 087012b18956..094551d8ad9b 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/clock/nva3.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/clock/nva3.c
@@ -20,8 +20,10 @@
20 * OTHER DEALINGS IN THE SOFTWARE. 20 * OTHER DEALINGS IN THE SOFTWARE.
21 * 21 *
22 * Authors: Ben Skeggs 22 * Authors: Ben Skeggs
23 * Roy Spliet
23 */ 24 */
24 25
26#include <engine/fifo.h>
25#include <subdev/bios.h> 27#include <subdev/bios.h>
26#include <subdev/bios/pll.h> 28#include <subdev/bios/pll.h>
27#include <subdev/timer.h> 29#include <subdev/timer.h>
@@ -42,9 +44,17 @@ static u32
42read_vco(struct nva3_clock_priv *priv, int clk) 44read_vco(struct nva3_clock_priv *priv, int clk)
43{ 45{
44 u32 sctl = nv_rd32(priv, 0x4120 + (clk * 4)); 46 u32 sctl = nv_rd32(priv, 0x4120 + (clk * 4));
45 if ((sctl & 0x00000030) != 0x00000030) 47
48 switch (sctl & 0x00000030) {
49 case 0x00000000:
50 return nv_device(priv)->crystal;
51 case 0x00000020:
46 return read_pll(priv, 0x41, 0x00e820); 52 return read_pll(priv, 0x41, 0x00e820);
47 return read_pll(priv, 0x42, 0x00e8a0); 53 case 0x00000030:
54 return read_pll(priv, 0x42, 0x00e8a0);
55 default:
56 return 0;
57 }
48} 58}
49 59
50static u32 60static u32
@@ -66,14 +76,25 @@ read_clk(struct nva3_clock_priv *priv, int clk, bool ignore_en)
66 if (!ignore_en && !(sctl & 0x00000100)) 76 if (!ignore_en && !(sctl & 0x00000100))
67 return 0; 77 return 0;
68 78
79 /* out_alt */
80 if (sctl & 0x00000400)
81 return 108000;
82
83 /* vco_out */
69 switch (sctl & 0x00003000) { 84 switch (sctl & 0x00003000) {
70 case 0x00000000: 85 case 0x00000000:
71 return nv_device(priv)->crystal; 86 if (!(sctl & 0x00000200))
87 return nv_device(priv)->crystal;
88 return 0;
72 case 0x00002000: 89 case 0x00002000:
73 if (sctl & 0x00000040) 90 if (sctl & 0x00000040)
74 return 108000; 91 return 108000;
75 return 100000; 92 return 100000;
76 case 0x00003000: 93 case 0x00003000:
94 /* vco_enable */
95 if (!(sctl & 0x00000001))
96 return 0;
97
77 sclk = read_vco(priv, clk); 98 sclk = read_vco(priv, clk);
78 sdiv = ((sctl & 0x003f0000) >> 16) + 2; 99 sdiv = ((sctl & 0x003f0000) >> 16) + 2;
79 return (sclk * 2) / sdiv; 100 return (sclk * 2) / sdiv;
@@ -95,7 +116,9 @@ read_pll(struct nva3_clock_priv *priv, int clk, u32 pll)
95 N = (coef & 0x0000ff00) >> 8; 116 N = (coef & 0x0000ff00) >> 8;
96 P = (coef & 0x003f0000) >> 16; 117 P = (coef & 0x003f0000) >> 16;
97 118
98 /* no post-divider on these.. */ 119 /* no post-divider on these..
120 * XXX: it looks more like two post-"dividers" that
121 * cross each other out in the default RPLL config */
99 if ((pll & 0x00ff00) == 0x00e800) 122 if ((pll & 0x00ff00) == 0x00e800)
100 P = 1; 123 P = 1;
101 124
@@ -114,13 +137,13 @@ static int
114nva3_clock_read(struct nouveau_clock *clk, enum nv_clk_src src) 137nva3_clock_read(struct nouveau_clock *clk, enum nv_clk_src src)
115{ 138{
116 struct nva3_clock_priv *priv = (void *)clk; 139 struct nva3_clock_priv *priv = (void *)clk;
140 u32 hsrc;
117 141
118 switch (src) { 142 switch (src) {
119 case nv_clk_src_crystal: 143 case nv_clk_src_crystal:
120 return nv_device(priv)->crystal; 144 return nv_device(priv)->crystal;
121 case nv_clk_src_href:
122 return 100000;
123 case nv_clk_src_core: 145 case nv_clk_src_core:
146 case nv_clk_src_core_intm:
124 return read_pll(priv, 0x00, 0x4200); 147 return read_pll(priv, 0x00, 0x4200);
125 case nv_clk_src_shader: 148 case nv_clk_src_shader:
126 return read_pll(priv, 0x01, 0x4220); 149 return read_pll(priv, 0x01, 0x4220);
@@ -132,24 +155,33 @@ nva3_clock_read(struct nouveau_clock *clk, enum nv_clk_src src)
132 return read_clk(priv, 0x21, false); 155 return read_clk(priv, 0x21, false);
133 case nv_clk_src_daemon: 156 case nv_clk_src_daemon:
134 return read_clk(priv, 0x25, false); 157 return read_clk(priv, 0x25, false);
158 case nv_clk_src_host:
159 hsrc = (nv_rd32(priv, 0xc040) & 0x30000000) >> 28;
160 switch (hsrc) {
161 case 0:
162 return read_clk(priv, 0x1d, false);
163 case 2:
164 case 3:
165 return 277000;
166 default:
167 nv_error(clk, "unknown HOST clock source %d\n", hsrc);
168 return -EINVAL;
169 }
135 default: 170 default:
136 nv_error(clk, "invalid clock source %d\n", src); 171 nv_error(clk, "invalid clock source %d\n", src);
137 return -EINVAL; 172 return -EINVAL;
138 } 173 }
174
175 return 0;
139} 176}
140 177
141int 178int
142nva3_clock_info(struct nouveau_clock *clock, int clk, u32 pll, u32 khz, 179nva3_clk_info(struct nouveau_clock *clock, int clk, u32 khz,
143 struct nva3_clock_info *info) 180 struct nva3_clock_info *info)
144{ 181{
145 struct nouveau_bios *bios = nouveau_bios(clock);
146 struct nva3_clock_priv *priv = (void *)clock; 182 struct nva3_clock_priv *priv = (void *)clock;
147 struct nvbios_pll limits; 183 u32 oclk, sclk, sdiv, diff;
148 u32 oclk, sclk, sdiv;
149 int P, N, M, diff;
150 int ret;
151 184
152 info->pll = 0;
153 info->clk = 0; 185 info->clk = 0;
154 186
155 switch (khz) { 187 switch (khz) {
@@ -164,43 +196,69 @@ nva3_clock_info(struct nouveau_clock *clock, int clk, u32 pll, u32 khz,
164 return khz; 196 return khz;
165 default: 197 default:
166 sclk = read_vco(priv, clk); 198 sclk = read_vco(priv, clk);
167 sdiv = min((sclk * 2) / (khz - 2999), (u32)65); 199 sdiv = min((sclk * 2) / khz, (u32)65);
168 /* if the clock has a PLL attached, and we can get a within 200 oclk = (sclk * 2) / sdiv;
169 * [-2, 3) MHz of a divider, we'll disable the PLL and use 201 diff = ((khz + 3000) - oclk);
170 * the divider instead. 202
171 * 203 /* When imprecise, play it safe and aim for a clock lower than
172 * divider can go as low as 2, limited here because NVIDIA 204 * desired rather than higher */
205 if (diff < 0) {
206 sdiv++;
207 oclk = (sclk * 2) / sdiv;
208 }
209
210 /* divider can go as low as 2, limited here because NVIDIA
173 * and the VBIOS on my NVA8 seem to prefer using the PLL 211 * and the VBIOS on my NVA8 seem to prefer using the PLL
174 * for 810MHz - is there a good reason? 212 * for 810MHz - is there a good reason?
175 */ 213 * XXX: PLLs with refclk 810MHz? */
176 if (sdiv > 4) { 214 if (sdiv > 4) {
177 oclk = (sclk * 2) / sdiv; 215 info->clk = (((sdiv - 2) << 16) | 0x00003100);
178 diff = khz - oclk; 216 return oclk;
179 if (!pll || (diff >= -2000 && diff < 3000)) {
180 info->clk = (((sdiv - 2) << 16) | 0x00003100);
181 return oclk;
182 }
183 } 217 }
184 218
185 if (!pll)
186 return -ERANGE;
187 break; 219 break;
188 } 220 }
189 221
222 return -ERANGE;
223}
224
225int
226nva3_pll_info(struct nouveau_clock *clock, int clk, u32 pll, u32 khz,
227 struct nva3_clock_info *info)
228{
229 struct nouveau_bios *bios = nouveau_bios(clock);
230 struct nva3_clock_priv *priv = (void *)clock;
231 struct nvbios_pll limits;
232 int P, N, M, diff;
233 int ret;
234
235 info->pll = 0;
236
237 /* If we can get a within [-2, 3) MHz of a divider, we'll disable the
238 * PLL and use the divider instead. */
239 ret = nva3_clk_info(clock, clk, khz, info);
240 diff = khz - ret;
241 if (!pll || (diff >= -2000 && diff < 3000)) {
242 goto out;
243 }
244
245 /* Try with PLL */
190 ret = nvbios_pll_parse(bios, pll, &limits); 246 ret = nvbios_pll_parse(bios, pll, &limits);
191 if (ret) 247 if (ret)
192 return ret; 248 return ret;
193 249
194 limits.refclk = read_clk(priv, clk - 0x10, true); 250 ret = nva3_clk_info(clock, clk - 0x10, limits.refclk, info);
195 if (!limits.refclk) 251 if (ret != limits.refclk)
196 return -EINVAL; 252 return -EINVAL;
197 253
198 ret = nva3_pll_calc(nv_subdev(priv), &limits, khz, &N, NULL, &M, &P); 254 ret = nva3_pll_calc(nv_subdev(priv), &limits, khz, &N, NULL, &M, &P);
199 if (ret >= 0) { 255 if (ret >= 0) {
200 info->clk = nv_rd32(priv, 0x4120 + (clk * 4));
201 info->pll = (P << 16) | (N << 8) | M; 256 info->pll = (P << 16) | (N << 8) | M;
202 } 257 }
203 258
259out:
260 info->fb_delay = max(((khz + 7566) / 15133), (u32) 18);
261
204 return ret ? ret : -ERANGE; 262 return ret ? ret : -ERANGE;
205} 263}
206 264
@@ -208,13 +266,76 @@ static int
208calc_clk(struct nva3_clock_priv *priv, struct nouveau_cstate *cstate, 266calc_clk(struct nva3_clock_priv *priv, struct nouveau_cstate *cstate,
209 int clk, u32 pll, int idx) 267 int clk, u32 pll, int idx)
210{ 268{
211 int ret = nva3_clock_info(&priv->base, clk, pll, cstate->domain[idx], 269 int ret = nva3_pll_info(&priv->base, clk, pll, cstate->domain[idx],
212 &priv->eng[idx]); 270 &priv->eng[idx]);
213 if (ret >= 0) 271 if (ret >= 0)
214 return 0; 272 return 0;
215 return ret; 273 return ret;
216} 274}
217 275
276static int
277calc_host(struct nva3_clock_priv *priv, struct nouveau_cstate *cstate)
278{
279 int ret = 0;
280 u32 kHz = cstate->domain[nv_clk_src_host];
281 struct nva3_clock_info *info = &priv->eng[nv_clk_src_host];
282
283 if (kHz == 277000) {
284 info->clk = 0;
285 info->host_out = NVA3_HOST_277;
286 return 0;
287 }
288
289 info->host_out = NVA3_HOST_CLK;
290
291 ret = nva3_clk_info(&priv->base, 0x1d, kHz, info);
292 if (ret >= 0)
293 return 0;
294 return ret;
295}
296
297int
298nva3_clock_pre(struct nouveau_clock *clk, unsigned long *flags)
299{
300 struct nouveau_fifo *pfifo = nouveau_fifo(clk);
301
302 /* halt and idle execution engines */
303 nv_mask(clk, 0x020060, 0x00070000, 0x00000000);
304 nv_mask(clk, 0x002504, 0x00000001, 0x00000001);
305 /* Wait until the interrupt handler is finished */
306 if (!nv_wait(clk, 0x000100, 0xffffffff, 0x00000000))
307 return -EBUSY;
308
309 if (pfifo)
310 pfifo->pause(pfifo, flags);
311
312 if (!nv_wait(clk, 0x002504, 0x00000010, 0x00000010))
313 return -EIO;
314 if (!nv_wait(clk, 0x00251c, 0x0000003f, 0x0000003f))
315 return -EIO;
316
317 return 0;
318}
319
320void
321nva3_clock_post(struct nouveau_clock *clk, unsigned long *flags)
322{
323 struct nouveau_fifo *pfifo = nouveau_fifo(clk);
324
325 if (pfifo && flags)
326 pfifo->start(pfifo, flags);
327
328 nv_mask(clk, 0x002504, 0x00000001, 0x00000000);
329 nv_mask(clk, 0x020060, 0x00070000, 0x00040000);
330}
331
332static void
333disable_clk_src(struct nva3_clock_priv *priv, u32 src)
334{
335 nv_mask(priv, src, 0x00000100, 0x00000000);
336 nv_mask(priv, src, 0x00000001, 0x00000000);
337}
338
218static void 339static void
219prog_pll(struct nva3_clock_priv *priv, int clk, u32 pll, int idx) 340prog_pll(struct nva3_clock_priv *priv, int clk, u32 pll, int idx)
220{ 341{
@@ -223,24 +344,35 @@ prog_pll(struct nva3_clock_priv *priv, int clk, u32 pll, int idx)
223 const u32 src1 = 0x004160 + (clk * 4); 344 const u32 src1 = 0x004160 + (clk * 4);
224 const u32 ctrl = pll + 0; 345 const u32 ctrl = pll + 0;
225 const u32 coef = pll + 4; 346 const u32 coef = pll + 4;
347 u32 bypass;
226 348
227 if (info->pll) { 349 if (info->pll) {
228 nv_mask(priv, src0, 0x00000101, 0x00000101); 350 /* Always start from a non-PLL clock */
351 bypass = nv_rd32(priv, ctrl) & 0x00000008;
352 if (!bypass) {
353 nv_mask(priv, src1, 0x00000101, 0x00000101);
354 nv_mask(priv, ctrl, 0x00000008, 0x00000008);
355 udelay(20);
356 }
357
358 nv_mask(priv, src0, 0x003f3141, 0x00000101 | info->clk);
229 nv_wr32(priv, coef, info->pll); 359 nv_wr32(priv, coef, info->pll);
230 nv_mask(priv, ctrl, 0x00000015, 0x00000015); 360 nv_mask(priv, ctrl, 0x00000015, 0x00000015);
231 nv_mask(priv, ctrl, 0x00000010, 0x00000000); 361 nv_mask(priv, ctrl, 0x00000010, 0x00000000);
232 nv_wait(priv, ctrl, 0x00020000, 0x00020000); 362 if (!nv_wait(priv, ctrl, 0x00020000, 0x00020000)) {
363 nv_mask(priv, ctrl, 0x00000010, 0x00000010);
364 nv_mask(priv, src0, 0x00000101, 0x00000000);
365 return;
366 }
233 nv_mask(priv, ctrl, 0x00000010, 0x00000010); 367 nv_mask(priv, ctrl, 0x00000010, 0x00000010);
234 nv_mask(priv, ctrl, 0x00000008, 0x00000000); 368 nv_mask(priv, ctrl, 0x00000008, 0x00000000);
235 nv_mask(priv, src1, 0x00000100, 0x00000000); 369 disable_clk_src(priv, src1);
236 nv_mask(priv, src1, 0x00000001, 0x00000000);
237 } else { 370 } else {
238 nv_mask(priv, src1, 0x003f3141, 0x00000101 | info->clk); 371 nv_mask(priv, src1, 0x003f3141, 0x00000101 | info->clk);
239 nv_mask(priv, ctrl, 0x00000018, 0x00000018); 372 nv_mask(priv, ctrl, 0x00000018, 0x00000018);
240 udelay(20); 373 udelay(20);
241 nv_mask(priv, ctrl, 0x00000001, 0x00000000); 374 nv_mask(priv, ctrl, 0x00000001, 0x00000000);
242 nv_mask(priv, src0, 0x00000100, 0x00000000); 375 disable_clk_src(priv, src0);
243 nv_mask(priv, src0, 0x00000001, 0x00000000);
244 } 376 }
245} 377}
246 378
@@ -251,18 +383,72 @@ prog_clk(struct nva3_clock_priv *priv, int clk, int idx)
251 nv_mask(priv, 0x004120 + (clk * 4), 0x003f3141, 0x00000101 | info->clk); 383 nv_mask(priv, 0x004120 + (clk * 4), 0x003f3141, 0x00000101 | info->clk);
252} 384}
253 385
386static void
387prog_host(struct nva3_clock_priv *priv)
388{
389 struct nva3_clock_info *info = &priv->eng[nv_clk_src_host];
390 u32 hsrc = (nv_rd32(priv, 0xc040));
391
392 switch (info->host_out) {
393 case NVA3_HOST_277:
394 if ((hsrc & 0x30000000) == 0) {
395 nv_wr32(priv, 0xc040, hsrc | 0x20000000);
396 disable_clk_src(priv, 0x4194);
397 }
398 break;
399 case NVA3_HOST_CLK:
400 prog_clk(priv, 0x1d, nv_clk_src_host);
401 if ((hsrc & 0x30000000) >= 0x20000000) {
402 nv_wr32(priv, 0xc040, hsrc & ~0x30000000);
403 }
404 break;
405 default:
406 break;
407 }
408
409 /* This seems to be a clock gating factor on idle, always set to 64 */
410 nv_wr32(priv, 0xc044, 0x3e);
411}
412
413static void
414prog_core(struct nva3_clock_priv *priv, int idx)
415{
416 struct nva3_clock_info *info = &priv->eng[idx];
417 u32 fb_delay = nv_rd32(priv, 0x10002c);
418
419 if (fb_delay < info->fb_delay)
420 nv_wr32(priv, 0x10002c, info->fb_delay);
421
422 prog_pll(priv, 0x00, 0x004200, idx);
423
424 if (fb_delay > info->fb_delay)
425 nv_wr32(priv, 0x10002c, info->fb_delay);
426}
427
254static int 428static int
255nva3_clock_calc(struct nouveau_clock *clk, struct nouveau_cstate *cstate) 429nva3_clock_calc(struct nouveau_clock *clk, struct nouveau_cstate *cstate)
256{ 430{
257 struct nva3_clock_priv *priv = (void *)clk; 431 struct nva3_clock_priv *priv = (void *)clk;
432 struct nva3_clock_info *core = &priv->eng[nv_clk_src_core];
258 int ret; 433 int ret;
259 434
260 if ((ret = calc_clk(priv, cstate, 0x10, 0x4200, nv_clk_src_core)) || 435 if ((ret = calc_clk(priv, cstate, 0x10, 0x4200, nv_clk_src_core)) ||
261 (ret = calc_clk(priv, cstate, 0x11, 0x4220, nv_clk_src_shader)) || 436 (ret = calc_clk(priv, cstate, 0x11, 0x4220, nv_clk_src_shader)) ||
262 (ret = calc_clk(priv, cstate, 0x20, 0x0000, nv_clk_src_disp)) || 437 (ret = calc_clk(priv, cstate, 0x20, 0x0000, nv_clk_src_disp)) ||
263 (ret = calc_clk(priv, cstate, 0x21, 0x0000, nv_clk_src_vdec))) 438 (ret = calc_clk(priv, cstate, 0x21, 0x0000, nv_clk_src_vdec)) ||
439 (ret = calc_host(priv, cstate)))
264 return ret; 440 return ret;
265 441
442 /* XXX: Should be reading the highest bit in the VBIOS clock to decide
443 * whether to use a PLL or not... but using a PLL defeats the purpose */
444 if (core->pll) {
445 ret = nva3_clk_info(clk, 0x10,
446 cstate->domain[nv_clk_src_core_intm],
447 &priv->eng[nv_clk_src_core_intm]);
448 if (ret < 0)
449 return ret;
450 }
451
266 return 0; 452 return 0;
267} 453}
268 454
@@ -270,11 +456,31 @@ static int
270nva3_clock_prog(struct nouveau_clock *clk) 456nva3_clock_prog(struct nouveau_clock *clk)
271{ 457{
272 struct nva3_clock_priv *priv = (void *)clk; 458 struct nva3_clock_priv *priv = (void *)clk;
273 prog_pll(priv, 0x00, 0x004200, nv_clk_src_core); 459 struct nva3_clock_info *core = &priv->eng[nv_clk_src_core];
460 int ret = 0;
461 unsigned long flags;
462 unsigned long *f = &flags;
463
464 ret = nva3_clock_pre(clk, f);
465 if (ret)
466 goto out;
467
468 if (core->pll)
469 prog_core(priv, nv_clk_src_core_intm);
470
471 prog_core(priv, nv_clk_src_core);
274 prog_pll(priv, 0x01, 0x004220, nv_clk_src_shader); 472 prog_pll(priv, 0x01, 0x004220, nv_clk_src_shader);
275 prog_clk(priv, 0x20, nv_clk_src_disp); 473 prog_clk(priv, 0x20, nv_clk_src_disp);
276 prog_clk(priv, 0x21, nv_clk_src_vdec); 474 prog_clk(priv, 0x21, nv_clk_src_vdec);
277 return 0; 475 prog_host(priv);
476
477out:
478 if (ret == -EBUSY)
479 f = NULL;
480
481 nva3_clock_post(clk, f);
482
483 return ret;
278} 484}
279 485
280static void 486static void
@@ -284,13 +490,14 @@ nva3_clock_tidy(struct nouveau_clock *clk)
284 490
285static struct nouveau_clocks 491static struct nouveau_clocks
286nva3_domain[] = { 492nva3_domain[] = {
287 { nv_clk_src_crystal, 0xff }, 493 { nv_clk_src_crystal , 0xff },
288 { nv_clk_src_href , 0xff }, 494 { nv_clk_src_core , 0x00, 0, "core", 1000 },
289 { nv_clk_src_core , 0x00, 0, "core", 1000 }, 495 { nv_clk_src_shader , 0x01, 0, "shader", 1000 },
290 { nv_clk_src_shader , 0x01, 0, "shader", 1000 }, 496 { nv_clk_src_mem , 0x02, 0, "memory", 1000 },
291 { nv_clk_src_mem , 0x02, 0, "memory", 1000 }, 497 { nv_clk_src_vdec , 0x03 },
292 { nv_clk_src_vdec , 0x03 }, 498 { nv_clk_src_disp , 0x04 },
293 { nv_clk_src_disp , 0x04 }, 499 { nv_clk_src_host , 0x05 },
500 { nv_clk_src_core_intm, 0x06 },
294 { nv_clk_src_max } 501 { nv_clk_src_max }
295}; 502};
296 503
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/nva3.h b/drivers/gpu/drm/nouveau/core/subdev/clock/nva3.h
index 6229a509b42e..a45a1038b12f 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/clock/nva3.h
+++ b/drivers/gpu/drm/nouveau/core/subdev/clock/nva3.h
@@ -6,9 +6,15 @@
6struct nva3_clock_info { 6struct nva3_clock_info {
7 u32 clk; 7 u32 clk;
8 u32 pll; 8 u32 pll;
9 enum {
10 NVA3_HOST_277,
11 NVA3_HOST_CLK,
12 } host_out;
13 u32 fb_delay;
9}; 14};
10 15
11int nva3_clock_info(struct nouveau_clock *, int, u32, u32, 16int nva3_pll_info(struct nouveau_clock *, int, u32, u32,
12 struct nva3_clock_info *); 17 struct nva3_clock_info *);
13 18int nva3_clock_pre(struct nouveau_clock *clk, unsigned long *flags);
19void nva3_clock_post(struct nouveau_clock *clk, unsigned long *flags);
14#endif 20#endif
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/nvaa.c b/drivers/gpu/drm/nouveau/core/subdev/clock/nvaa.c
index 74e19731b1b7..54aeab8005a0 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/clock/nvaa.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/clock/nvaa.c
@@ -28,6 +28,7 @@
28#include <subdev/timer.h> 28#include <subdev/timer.h>
29#include <subdev/clock.h> 29#include <subdev/clock.h>
30 30
31#include "nva3.h"
31#include "pll.h" 32#include "pll.h"
32 33
33struct nvaa_clock_priv { 34struct nvaa_clock_priv {
@@ -299,25 +300,14 @@ static int
299nvaa_clock_prog(struct nouveau_clock *clk) 300nvaa_clock_prog(struct nouveau_clock *clk)
300{ 301{
301 struct nvaa_clock_priv *priv = (void *)clk; 302 struct nvaa_clock_priv *priv = (void *)clk;
302 struct nouveau_fifo *pfifo = nouveau_fifo(clk); 303 u32 pllmask = 0, mast;
303 unsigned long flags; 304 unsigned long flags;
304 u32 pllmask = 0, mast, ptherm_gate; 305 unsigned long *f = &flags;
305 int ret = -EBUSY; 306 int ret = 0;
306
307 /* halt and idle execution engines */
308 ptherm_gate = nv_mask(clk, 0x020060, 0x00070000, 0x00000000);
309 nv_mask(clk, 0x002504, 0x00000001, 0x00000001);
310 /* Wait until the interrupt handler is finished */
311 if (!nv_wait(clk, 0x000100, 0xffffffff, 0x00000000))
312 goto resume;
313
314 if (pfifo)
315 pfifo->pause(pfifo, &flags);
316 307
317 if (!nv_wait(clk, 0x002504, 0x00000010, 0x00000010)) 308 ret = nva3_clock_pre(clk, f);
318 goto resume; 309 if (ret)
319 if (!nv_wait(clk, 0x00251c, 0x0000003f, 0x0000003f)) 310 goto out;
320 goto resume;
321 311
322 /* First switch to safe clocks: href */ 312 /* First switch to safe clocks: href */
323 mast = nv_mask(clk, 0xc054, 0x03400e70, 0x03400640); 313 mast = nv_mask(clk, 0xc054, 0x03400e70, 0x03400640);
@@ -375,15 +365,8 @@ nvaa_clock_prog(struct nouveau_clock *clk)
375 } 365 }
376 366
377 nv_wr32(clk, 0xc054, mast); 367 nv_wr32(clk, 0xc054, mast);
378 ret = 0;
379 368
380resume: 369resume:
381 if (pfifo)
382 pfifo->start(pfifo, &flags);
383
384 nv_mask(clk, 0x002504, 0x00000001, 0x00000000);
385 nv_wr32(clk, 0x020060, ptherm_gate);
386
387 /* Disable some PLLs and dividers when unused */ 370 /* Disable some PLLs and dividers when unused */
388 if (priv->csrc != nv_clk_src_core) { 371 if (priv->csrc != nv_clk_src_core) {
389 nv_wr32(clk, 0x4040, 0x00000000); 372 nv_wr32(clk, 0x4040, 0x00000000);
@@ -395,6 +378,12 @@ resume:
395 nv_mask(clk, 0x4020, 0x80000000, 0x00000000); 378 nv_mask(clk, 0x4020, 0x80000000, 0x00000000);
396 } 379 }
397 380
381out:
382 if (ret == -EBUSY)
383 f = NULL;
384
385 nva3_clock_post(clk, f);
386
398 return ret; 387 return ret;
399} 388}
400 389
diff --git a/drivers/gpu/drm/nouveau/core/subdev/devinit/fbmem.h b/drivers/gpu/drm/nouveau/core/subdev/devinit/fbmem.h
index 4fe49cf4c99a..6103484fea72 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/devinit/fbmem.h
+++ b/drivers/gpu/drm/nouveau/core/subdev/devinit/fbmem.h
@@ -26,22 +26,8 @@
26 26
27#include <core/device.h> 27#include <core/device.h>
28 28
29#define NV04_PFB_BOOT_0 0x00100000 29#include <subdev/fb/regsnv04.h>
30# define NV04_PFB_BOOT_0_RAM_AMOUNT 0x00000003 30
31# define NV04_PFB_BOOT_0_RAM_AMOUNT_32MB 0x00000000
32# define NV04_PFB_BOOT_0_RAM_AMOUNT_4MB 0x00000001
33# define NV04_PFB_BOOT_0_RAM_AMOUNT_8MB 0x00000002
34# define NV04_PFB_BOOT_0_RAM_AMOUNT_16MB 0x00000003
35# define NV04_PFB_BOOT_0_RAM_WIDTH_128 0x00000004
36# define NV04_PFB_BOOT_0_RAM_TYPE 0x00000028
37# define NV04_PFB_BOOT_0_RAM_TYPE_SGRAM_8MBIT 0x00000000
38# define NV04_PFB_BOOT_0_RAM_TYPE_SGRAM_16MBIT 0x00000008
39# define NV04_PFB_BOOT_0_RAM_TYPE_SGRAM_16MBIT_4BANK 0x00000010
40# define NV04_PFB_BOOT_0_RAM_TYPE_SDRAM_16MBIT 0x00000018
41# define NV04_PFB_BOOT_0_RAM_TYPE_SDRAM_64MBIT 0x00000020
42# define NV04_PFB_BOOT_0_RAM_TYPE_SDRAM_64MBITX16 0x00000028
43# define NV04_PFB_BOOT_0_UMA_ENABLE 0x00000100
44# define NV04_PFB_BOOT_0_UMA_SIZE 0x0000f000
45#define NV04_PFB_DEBUG_0 0x00100080 31#define NV04_PFB_DEBUG_0 0x00100080
46# define NV04_PFB_DEBUG_0_PAGE_MODE 0x00000001 32# define NV04_PFB_DEBUG_0_PAGE_MODE 0x00000001
47# define NV04_PFB_DEBUG_0_REFRESH_OFF 0x00000010 33# define NV04_PFB_DEBUG_0_REFRESH_OFF 0x00000010
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/gddr5.c b/drivers/gpu/drm/nouveau/core/subdev/fb/gddr5.c
index 66fe959b4f74..7fbbe05d5c60 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/gddr5.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/gddr5.c
@@ -40,7 +40,7 @@ nouveau_gddr5_calc(struct nouveau_ram *ram, bool nuts)
40 int WL, CL, WR, at[2], dt, ds; 40 int WL, CL, WR, at[2], dt, ds;
41 int rq = ram->freq < 1000000; /* XXX */ 41 int rq = ram->freq < 1000000; /* XXX */
42 42
43 switch (ram->ramcfg.version) { 43 switch (ram->next->bios.ramcfg_ver) {
44 case 0x11: 44 case 0x11:
45 pd = ram->next->bios.ramcfg_11_01_80; 45 pd = ram->next->bios.ramcfg_11_01_80;
46 lf = ram->next->bios.ramcfg_11_01_40; 46 lf = ram->next->bios.ramcfg_11_01_40;
@@ -54,7 +54,7 @@ nouveau_gddr5_calc(struct nouveau_ram *ram, bool nuts)
54 return -ENOSYS; 54 return -ENOSYS;
55 } 55 }
56 56
57 switch (ram->timing.version) { 57 switch (ram->next->bios.timing_ver) {
58 case 0x20: 58 case 0x20:
59 WL = (ram->next->bios.timing[1] & 0x00000f80) >> 7; 59 WL = (ram->next->bios.timing[1] & 0x00000f80) >> 7;
60 CL = (ram->next->bios.timing[1] & 0x0000001f); 60 CL = (ram->next->bios.timing[1] & 0x0000001f);
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv20.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv20.c
index f003c1b1893f..2209ade63339 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv20.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv20.c
@@ -45,7 +45,7 @@ nv20_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
45{ 45{
46 u32 tiles = DIV_ROUND_UP(size, 0x40); 46 u32 tiles = DIV_ROUND_UP(size, 0x40);
47 u32 tags = round_up(tiles / pfb->ram->parts, 0x40); 47 u32 tags = round_up(tiles / pfb->ram->parts, 0x40);
48 if (!nouveau_mm_head(&pfb->tags, 1, tags, tags, 1, &tile->tag)) { 48 if (!nouveau_mm_head(&pfb->tags, 0, 1, tags, tags, 1, &tile->tag)) {
49 if (!(flags & 2)) tile->zcomp = 0x00000000; /* Z16 */ 49 if (!(flags & 2)) tile->zcomp = 0x00000000; /* Z16 */
50 else tile->zcomp = 0x04000000; /* Z24S8 */ 50 else tile->zcomp = 0x04000000; /* Z24S8 */
51 tile->zcomp |= tile->tag->offset; 51 tile->zcomp |= tile->tag->offset;
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv25.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv25.c
index f34f4223210b..e2a66c355c50 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv25.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv25.c
@@ -32,7 +32,7 @@ nv25_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
32{ 32{
33 u32 tiles = DIV_ROUND_UP(size, 0x40); 33 u32 tiles = DIV_ROUND_UP(size, 0x40);
34 u32 tags = round_up(tiles / pfb->ram->parts, 0x40); 34 u32 tags = round_up(tiles / pfb->ram->parts, 0x40);
35 if (!nouveau_mm_head(&pfb->tags, 1, tags, tags, 1, &tile->tag)) { 35 if (!nouveau_mm_head(&pfb->tags, 0, 1, tags, tags, 1, &tile->tag)) {
36 if (!(flags & 2)) tile->zcomp = 0x00100000; /* Z16 */ 36 if (!(flags & 2)) tile->zcomp = 0x00100000; /* Z16 */
37 else tile->zcomp = 0x00200000; /* Z24S8 */ 37 else tile->zcomp = 0x00200000; /* Z24S8 */
38 tile->zcomp |= tile->tag->offset; 38 tile->zcomp |= tile->tag->offset;
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv30.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv30.c
index 69093f7151f0..cbec402ba5b9 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv30.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv30.c
@@ -51,7 +51,7 @@ nv30_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
51{ 51{
52 u32 tiles = DIV_ROUND_UP(size, 0x40); 52 u32 tiles = DIV_ROUND_UP(size, 0x40);
53 u32 tags = round_up(tiles / pfb->ram->parts, 0x40); 53 u32 tags = round_up(tiles / pfb->ram->parts, 0x40);
54 if (!nouveau_mm_head(&pfb->tags, 1, tags, tags, 1, &tile->tag)) { 54 if (!nouveau_mm_head(&pfb->tags, 0, 1, tags, tags, 1, &tile->tag)) {
55 if (flags & 2) tile->zcomp |= 0x01000000; /* Z16 */ 55 if (flags & 2) tile->zcomp |= 0x01000000; /* Z16 */
56 else tile->zcomp |= 0x02000000; /* Z24S8 */ 56 else tile->zcomp |= 0x02000000; /* Z24S8 */
57 tile->zcomp |= ((tile->tag->offset ) >> 6); 57 tile->zcomp |= ((tile->tag->offset ) >> 6);
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv35.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv35.c
index 161b06e8fc3f..b2cf8c69fb2e 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv35.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv35.c
@@ -32,7 +32,7 @@ nv35_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
32{ 32{
33 u32 tiles = DIV_ROUND_UP(size, 0x40); 33 u32 tiles = DIV_ROUND_UP(size, 0x40);
34 u32 tags = round_up(tiles / pfb->ram->parts, 0x40); 34 u32 tags = round_up(tiles / pfb->ram->parts, 0x40);
35 if (!nouveau_mm_head(&pfb->tags, 1, tags, tags, 1, &tile->tag)) { 35 if (!nouveau_mm_head(&pfb->tags, 0, 1, tags, tags, 1, &tile->tag)) {
36 if (flags & 2) tile->zcomp |= 0x04000000; /* Z16 */ 36 if (flags & 2) tile->zcomp |= 0x04000000; /* Z16 */
37 else tile->zcomp |= 0x08000000; /* Z24S8 */ 37 else tile->zcomp |= 0x08000000; /* Z24S8 */
38 tile->zcomp |= ((tile->tag->offset ) >> 6); 38 tile->zcomp |= ((tile->tag->offset ) >> 6);
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv36.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv36.c
index 2dd3d0aab6bb..b4cdae2a3b2f 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv36.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv36.c
@@ -32,7 +32,7 @@ nv36_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
32{ 32{
33 u32 tiles = DIV_ROUND_UP(size, 0x40); 33 u32 tiles = DIV_ROUND_UP(size, 0x40);
34 u32 tags = round_up(tiles / pfb->ram->parts, 0x40); 34 u32 tags = round_up(tiles / pfb->ram->parts, 0x40);
35 if (!nouveau_mm_head(&pfb->tags, 1, tags, tags, 1, &tile->tag)) { 35 if (!nouveau_mm_head(&pfb->tags, 0, 1, tags, tags, 1, &tile->tag)) {
36 if (flags & 2) tile->zcomp |= 0x10000000; /* Z16 */ 36 if (flags & 2) tile->zcomp |= 0x10000000; /* Z16 */
37 else tile->zcomp |= 0x20000000; /* Z24S8 */ 37 else tile->zcomp |= 0x20000000; /* Z24S8 */
38 tile->zcomp |= ((tile->tag->offset ) >> 6); 38 tile->zcomp |= ((tile->tag->offset ) >> 6);
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv40.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv40.c
index 95a115ab0c86..52814258c212 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv40.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv40.c
@@ -33,7 +33,7 @@ nv40_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
33 u32 tiles = DIV_ROUND_UP(size, 0x80); 33 u32 tiles = DIV_ROUND_UP(size, 0x80);
34 u32 tags = round_up(tiles / pfb->ram->parts, 0x100); 34 u32 tags = round_up(tiles / pfb->ram->parts, 0x100);
35 if ( (flags & 2) && 35 if ( (flags & 2) &&
36 !nouveau_mm_head(&pfb->tags, 1, tags, tags, 1, &tile->tag)) { 36 !nouveau_mm_head(&pfb->tags, 0, 1, tags, tags, 1, &tile->tag)) {
37 tile->zcomp = 0x28000000; /* Z24S8_SPLIT_GRAD */ 37 tile->zcomp = 0x28000000; /* Z24S8_SPLIT_GRAD */
38 tile->zcomp |= ((tile->tag->offset ) >> 8); 38 tile->zcomp |= ((tile->tag->offset ) >> 8);
39 tile->zcomp |= ((tile->tag->offset + tags - 1) >> 8) << 13; 39 tile->zcomp |= ((tile->tag->offset + tags - 1) >> 8) << 13;
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/priv.h b/drivers/gpu/drm/nouveau/core/subdev/fb/priv.h
index 82273f832e42..60322e906dd4 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/priv.h
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/priv.h
@@ -35,6 +35,7 @@ extern struct nouveau_oclass nve0_ram_oclass;
35extern struct nouveau_oclass gk20a_ram_oclass; 35extern struct nouveau_oclass gk20a_ram_oclass;
36extern struct nouveau_oclass gm107_ram_oclass; 36extern struct nouveau_oclass gm107_ram_oclass;
37 37
38int nouveau_sddr2_calc(struct nouveau_ram *ram);
38int nouveau_sddr3_calc(struct nouveau_ram *ram); 39int nouveau_sddr3_calc(struct nouveau_ram *ram);
39int nouveau_gddr5_calc(struct nouveau_ram *ram, bool nuts); 40int nouveau_gddr5_calc(struct nouveau_ram *ram, bool nuts);
40 41
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramfuc.h b/drivers/gpu/drm/nouveau/core/subdev/fb/ramfuc.h
index 2af9cfd2c60f..d1fbbe4b00a2 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/ramfuc.h
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramfuc.h
@@ -12,16 +12,32 @@ struct ramfuc {
12struct ramfuc_reg { 12struct ramfuc_reg {
13 int sequence; 13 int sequence;
14 bool force; 14 bool force;
15 u32 addr[2]; 15 u32 addr;
16 u32 stride; /* in bytes */
17 u32 mask;
16 u32 data; 18 u32 data;
17}; 19};
18 20
19static inline struct ramfuc_reg 21static inline struct ramfuc_reg
22ramfuc_stride(u32 addr, u32 stride, u32 mask)
23{
24 return (struct ramfuc_reg) {
25 .sequence = 0,
26 .addr = addr,
27 .stride = stride,
28 .mask = mask,
29 .data = 0xdeadbeef,
30 };
31}
32
33static inline struct ramfuc_reg
20ramfuc_reg2(u32 addr1, u32 addr2) 34ramfuc_reg2(u32 addr1, u32 addr2)
21{ 35{
22 return (struct ramfuc_reg) { 36 return (struct ramfuc_reg) {
23 .sequence = 0, 37 .sequence = 0,
24 .addr = { addr1, addr2 }, 38 .addr = addr1,
39 .stride = addr2 - addr1,
40 .mask = 0x3,
25 .data = 0xdeadbeef, 41 .data = 0xdeadbeef,
26 }; 42 };
27} 43}
@@ -29,7 +45,13 @@ ramfuc_reg2(u32 addr1, u32 addr2)
29static noinline struct ramfuc_reg 45static noinline struct ramfuc_reg
30ramfuc_reg(u32 addr) 46ramfuc_reg(u32 addr)
31{ 47{
32 return ramfuc_reg2(addr, addr); 48 return (struct ramfuc_reg) {
49 .sequence = 0,
50 .addr = addr,
51 .stride = 0,
52 .mask = 0x1,
53 .data = 0xdeadbeef,
54 };
33} 55}
34 56
35static inline int 57static inline int
@@ -62,18 +84,25 @@ static inline u32
62ramfuc_rd32(struct ramfuc *ram, struct ramfuc_reg *reg) 84ramfuc_rd32(struct ramfuc *ram, struct ramfuc_reg *reg)
63{ 85{
64 if (reg->sequence != ram->sequence) 86 if (reg->sequence != ram->sequence)
65 reg->data = nv_rd32(ram->pfb, reg->addr[0]); 87 reg->data = nv_rd32(ram->pfb, reg->addr);
66 return reg->data; 88 return reg->data;
67} 89}
68 90
69static inline void 91static inline void
70ramfuc_wr32(struct ramfuc *ram, struct ramfuc_reg *reg, u32 data) 92ramfuc_wr32(struct ramfuc *ram, struct ramfuc_reg *reg, u32 data)
71{ 93{
94 unsigned int mask, off = 0;
95
72 reg->sequence = ram->sequence; 96 reg->sequence = ram->sequence;
73 reg->data = data; 97 reg->data = data;
74 if (reg->addr[0] != reg->addr[1]) 98
75 nouveau_memx_wr32(ram->memx, reg->addr[1], reg->data); 99 for (mask = reg->mask; mask > 0; mask = (mask & ~1) >> 1) {
76 nouveau_memx_wr32(ram->memx, reg->addr[0], reg->data); 100 if (mask & 1) {
101 nouveau_memx_wr32(ram->memx, reg->addr+off, reg->data);
102 }
103
104 off += reg->stride;
105 }
77} 106}
78 107
79static inline void 108static inline void
@@ -105,14 +134,35 @@ ramfuc_nsec(struct ramfuc *ram, u32 nsec)
105 nouveau_memx_nsec(ram->memx, nsec); 134 nouveau_memx_nsec(ram->memx, nsec);
106} 135}
107 136
108#define ram_init(s,p) ramfuc_init(&(s)->base, (p)) 137static inline void
109#define ram_exec(s,e) ramfuc_exec(&(s)->base, (e)) 138ramfuc_wait_vblank(struct ramfuc *ram)
110#define ram_have(s,r) ((s)->r_##r.addr[0] != 0x000000) 139{
111#define ram_rd32(s,r) ramfuc_rd32(&(s)->base, &(s)->r_##r) 140 nouveau_memx_wait_vblank(ram->memx);
112#define ram_wr32(s,r,d) ramfuc_wr32(&(s)->base, &(s)->r_##r, (d)) 141}
113#define ram_nuke(s,r) ramfuc_nuke(&(s)->base, &(s)->r_##r) 142
114#define ram_mask(s,r,m,d) ramfuc_mask(&(s)->base, &(s)->r_##r, (m), (d)) 143static inline void
115#define ram_wait(s,r,m,d,n) ramfuc_wait(&(s)->base, (r), (m), (d), (n)) 144ramfuc_block(struct ramfuc *ram)
116#define ram_nsec(s,n) ramfuc_nsec(&(s)->base, (n)) 145{
146 nouveau_memx_block(ram->memx);
147}
148
149static inline void
150ramfuc_unblock(struct ramfuc *ram)
151{
152 nouveau_memx_unblock(ram->memx);
153}
154
155#define ram_init(s,p) ramfuc_init(&(s)->base, (p))
156#define ram_exec(s,e) ramfuc_exec(&(s)->base, (e))
157#define ram_have(s,r) ((s)->r_##r.addr != 0x000000)
158#define ram_rd32(s,r) ramfuc_rd32(&(s)->base, &(s)->r_##r)
159#define ram_wr32(s,r,d) ramfuc_wr32(&(s)->base, &(s)->r_##r, (d))
160#define ram_nuke(s,r) ramfuc_nuke(&(s)->base, &(s)->r_##r)
161#define ram_mask(s,r,m,d) ramfuc_mask(&(s)->base, &(s)->r_##r, (m), (d))
162#define ram_wait(s,r,m,d,n) ramfuc_wait(&(s)->base, (r), (m), (d), (n))
163#define ram_nsec(s,n) ramfuc_nsec(&(s)->base, (n))
164#define ram_wait_vblank(s) ramfuc_wait_vblank(&(s)->base)
165#define ram_block(s) ramfuc_block(&(s)->base)
166#define ram_unblock(s) ramfuc_unblock(&(s)->base)
117 167
118#endif 168#endif
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv04.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv04.c
index e781080d3327..1972268d1410 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv04.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv04.c
@@ -22,22 +22,7 @@
22 * Authors: Ben Skeggs 22 * Authors: Ben Skeggs
23 */ 23 */
24 24
25#define NV04_PFB_BOOT_0 0x00100000 25#include <subdev/fb/regsnv04.h>
26# define NV04_PFB_BOOT_0_RAM_AMOUNT 0x00000003
27# define NV04_PFB_BOOT_0_RAM_AMOUNT_32MB 0x00000000
28# define NV04_PFB_BOOT_0_RAM_AMOUNT_4MB 0x00000001
29# define NV04_PFB_BOOT_0_RAM_AMOUNT_8MB 0x00000002
30# define NV04_PFB_BOOT_0_RAM_AMOUNT_16MB 0x00000003
31# define NV04_PFB_BOOT_0_RAM_WIDTH_128 0x00000004
32# define NV04_PFB_BOOT_0_RAM_TYPE 0x00000028
33# define NV04_PFB_BOOT_0_RAM_TYPE_SGRAM_8MBIT 0x00000000
34# define NV04_PFB_BOOT_0_RAM_TYPE_SGRAM_16MBIT 0x00000008
35# define NV04_PFB_BOOT_0_RAM_TYPE_SGRAM_16MBIT_4BANK 0x00000010
36# define NV04_PFB_BOOT_0_RAM_TYPE_SDRAM_16MBIT 0x00000018
37# define NV04_PFB_BOOT_0_RAM_TYPE_SDRAM_64MBIT 0x00000020
38# define NV04_PFB_BOOT_0_RAM_TYPE_SDRAM_64MBITX16 0x00000028
39# define NV04_PFB_BOOT_0_UMA_ENABLE 0x00000100
40# define NV04_PFB_BOOT_0_UMA_SIZE 0x0000f000
41 26
42#include "priv.h" 27#include "priv.h"
43 28
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv50.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv50.c
index e5d12c24cc43..64a983c96625 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv50.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv50.c
@@ -280,7 +280,7 @@ nv50_ram_get(struct nouveau_fb *pfb, u64 size, u32 align, u32 ncmin,
280 if (align == 16) { 280 if (align == 16) {
281 int n = (max >> 4) * comp; 281 int n = (max >> 4) * comp;
282 282
283 ret = nouveau_mm_head(tags, 1, n, n, 1, &mem->tag); 283 ret = nouveau_mm_head(tags, 0, 1, n, n, 1, &mem->tag);
284 if (ret) 284 if (ret)
285 mem->tag = NULL; 285 mem->tag = NULL;
286 } 286 }
@@ -296,9 +296,9 @@ nv50_ram_get(struct nouveau_fb *pfb, u64 size, u32 align, u32 ncmin,
296 type = nv50_fb_memtype[type]; 296 type = nv50_fb_memtype[type];
297 do { 297 do {
298 if (back) 298 if (back)
299 ret = nouveau_mm_tail(heap, type, max, min, align, &r); 299 ret = nouveau_mm_tail(heap, 0, type, max, min, align, &r);
300 else 300 else
301 ret = nouveau_mm_head(heap, type, max, min, align, &r); 301 ret = nouveau_mm_head(heap, 0, type, max, min, align, &r);
302 if (ret) { 302 if (ret) {
303 mutex_unlock(&pfb->base.mutex); 303 mutex_unlock(&pfb->base.mutex);
304 pfb->ram->put(pfb, &mem); 304 pfb->ram->put(pfb, &mem);
@@ -319,27 +319,22 @@ nv50_ram_get(struct nouveau_fb *pfb, u64 size, u32 align, u32 ncmin,
319static u32 319static u32
320nv50_fb_vram_rblock(struct nouveau_fb *pfb, struct nouveau_ram *ram) 320nv50_fb_vram_rblock(struct nouveau_fb *pfb, struct nouveau_ram *ram)
321{ 321{
322 int i, parts, colbits, rowbitsa, rowbitsb, banks; 322 int colbits, rowbitsa, rowbitsb, banks;
323 u64 rowsize, predicted; 323 u64 rowsize, predicted;
324 u32 r0, r4, rt, ru, rblock_size; 324 u32 r0, r4, rt, rblock_size;
325 325
326 r0 = nv_rd32(pfb, 0x100200); 326 r0 = nv_rd32(pfb, 0x100200);
327 r4 = nv_rd32(pfb, 0x100204); 327 r4 = nv_rd32(pfb, 0x100204);
328 rt = nv_rd32(pfb, 0x100250); 328 rt = nv_rd32(pfb, 0x100250);
329 ru = nv_rd32(pfb, 0x001540); 329 nv_debug(pfb, "memcfg 0x%08x 0x%08x 0x%08x 0x%08x\n", r0, r4, rt,
330 nv_debug(pfb, "memcfg 0x%08x 0x%08x 0x%08x 0x%08x\n", r0, r4, rt, ru); 330 nv_rd32(pfb, 0x001540));
331
332 for (i = 0, parts = 0; i < 8; i++) {
333 if (ru & (0x00010000 << i))
334 parts++;
335 }
336 331
337 colbits = (r4 & 0x0000f000) >> 12; 332 colbits = (r4 & 0x0000f000) >> 12;
338 rowbitsa = ((r4 & 0x000f0000) >> 16) + 8; 333 rowbitsa = ((r4 & 0x000f0000) >> 16) + 8;
339 rowbitsb = ((r4 & 0x00f00000) >> 20) + 8; 334 rowbitsb = ((r4 & 0x00f00000) >> 20) + 8;
340 banks = 1 << (((r4 & 0x03000000) >> 24) + 2); 335 banks = 1 << (((r4 & 0x03000000) >> 24) + 2);
341 336
342 rowsize = parts * banks * (1 << colbits) * 8; 337 rowsize = ram->parts * banks * (1 << colbits) * 8;
343 predicted = rowsize << rowbitsa; 338 predicted = rowsize << rowbitsa;
344 if (r0 & 0x00000004) 339 if (r0 & 0x00000004)
345 predicted += rowsize << rowbitsb; 340 predicted += rowsize << rowbitsb;
@@ -376,6 +371,9 @@ nv50_ram_create_(struct nouveau_object *parent, struct nouveau_object *engine,
376 ram->size = nv_rd32(pfb, 0x10020c); 371 ram->size = nv_rd32(pfb, 0x10020c);
377 ram->size = (ram->size & 0xffffff00) | ((ram->size & 0x000000ff) << 32); 372 ram->size = (ram->size & 0xffffff00) | ((ram->size & 0x000000ff) << 32);
378 373
374 ram->part_mask = (nv_rd32(pfb, 0x001540) & 0x00ff0000) >> 16;
375 ram->parts = hweight8(ram->part_mask);
376
379 switch (nv_rd32(pfb, 0x100714) & 0x00000007) { 377 switch (nv_rd32(pfb, 0x100714) & 0x00000007) {
380 case 0: ram->type = NV_MEM_TYPE_DDR1; break; 378 case 0: ram->type = NV_MEM_TYPE_DDR1; break;
381 case 1: 379 case 1:
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnva3.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnva3.c
index 8076fb195dd5..3601deca0bd5 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnva3.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnva3.c
@@ -79,20 +79,27 @@ nva3_ram_calc(struct nouveau_fb *pfb, u32 freq)
79 struct nva3_ram *ram = (void *)pfb->ram; 79 struct nva3_ram *ram = (void *)pfb->ram;
80 struct nva3_ramfuc *fuc = &ram->fuc; 80 struct nva3_ramfuc *fuc = &ram->fuc;
81 struct nva3_clock_info mclk; 81 struct nva3_clock_info mclk;
82 u8 ver, cnt, len, strap; 82 struct nouveau_ram_data *next;
83 u8 ver, hdr, cnt, len, strap;
83 u32 data; 84 u32 data;
84 struct {
85 u32 data;
86 u8 size;
87 } rammap, ramcfg, timing;
88 u32 r004018, r100760, ctrl; 85 u32 r004018, r100760, ctrl;
89 u32 unk714, unk718, unk71c; 86 u32 unk714, unk718, unk71c;
90 int ret; 87 int ret, i;
88
89 next = &ram->base.target;
90 next->freq = freq;
91 ram->base.next = next;
91 92
92 /* lookup memory config data relevant to the target frequency */ 93 /* lookup memory config data relevant to the target frequency */
93 rammap.data = nvbios_rammapEm(bios, freq / 1000, &ver, &rammap.size, 94 i = 0;
94 &cnt, &ramcfg.size); 95 while ((data = nvbios_rammapEp(bios, i++, &ver, &hdr, &cnt, &len,
95 if (!rammap.data || ver != 0x10 || rammap.size < 0x0e) { 96 &next->bios))) {
97 if (freq / 1000 >= next->bios.rammap_min &&
98 freq / 1000 <= next->bios.rammap_max)
99 break;
100 }
101
102 if (!data || ver != 0x10 || hdr < 0x0e) {
96 nv_error(pfb, "invalid/missing rammap entry\n"); 103 nv_error(pfb, "invalid/missing rammap entry\n");
97 return -EINVAL; 104 return -EINVAL;
98 } 105 }
@@ -104,26 +111,25 @@ nva3_ram_calc(struct nouveau_fb *pfb, u32 freq)
104 return -EINVAL; 111 return -EINVAL;
105 } 112 }
106 113
107 ramcfg.data = rammap.data + rammap.size + (strap * ramcfg.size); 114 data = nvbios_rammapSp(bios, data, ver, hdr, cnt, len, strap,
108 if (!ramcfg.data || ver != 0x10 || ramcfg.size < 0x0e) { 115 &ver, &hdr, &next->bios);
116 if (!data || ver != 0x10 || hdr < 0x0e) {
109 nv_error(pfb, "invalid/missing ramcfg entry\n"); 117 nv_error(pfb, "invalid/missing ramcfg entry\n");
110 return -EINVAL; 118 return -EINVAL;
111 } 119 }
112 120
113 /* lookup memory timings, if bios says they're present */ 121 /* lookup memory timings, if bios says they're present */
114 strap = nv_ro08(bios, ramcfg.data + 0x01); 122 if (next->bios.ramcfg_timing != 0xff) {
115 if (strap != 0xff) { 123 data = nvbios_timingEp(bios, next->bios.ramcfg_timing,
116 timing.data = nvbios_timingEe(bios, strap, &ver, &timing.size, 124 &ver, &hdr, &cnt, &len,
117 &cnt, &len); 125 &next->bios);
118 if (!timing.data || ver != 0x10 || timing.size < 0x19) { 126 if (!data || ver != 0x10 || hdr < 0x19) {
119 nv_error(pfb, "invalid/missing timing entry\n"); 127 nv_error(pfb, "invalid/missing timing entry\n");
120 return -EINVAL; 128 return -EINVAL;
121 } 129 }
122 } else {
123 timing.data = 0;
124 } 130 }
125 131
126 ret = nva3_clock_info(nouveau_clock(pfb), 0x12, 0x4000, freq, &mclk); 132 ret = nva3_pll_info(nouveau_clock(pfb), 0x12, 0x4000, freq, &mclk);
127 if (ret < 0) { 133 if (ret < 0) {
128 nv_error(pfb, "failed mclk calculation\n"); 134 nv_error(pfb, "failed mclk calculation\n");
129 return ret; 135 return ret;
@@ -163,17 +169,17 @@ nva3_ram_calc(struct nouveau_fb *pfb, u32 freq)
163 ram_mask(fuc, 0x004168, 0x003f3141, ctrl); 169 ram_mask(fuc, 0x004168, 0x003f3141, ctrl);
164 } 170 }
165 171
166 if ( (nv_ro08(bios, ramcfg.data + 0x02) & 0x10)) { 172 if (next->bios.ramcfg_10_02_10) {
167 ram_mask(fuc, 0x111104, 0x00000600, 0x00000000); 173 ram_mask(fuc, 0x111104, 0x00000600, 0x00000000);
168 } else { 174 } else {
169 ram_mask(fuc, 0x111100, 0x40000000, 0x40000000); 175 ram_mask(fuc, 0x111100, 0x40000000, 0x40000000);
170 ram_mask(fuc, 0x111104, 0x00000180, 0x00000000); 176 ram_mask(fuc, 0x111104, 0x00000180, 0x00000000);
171 } 177 }
172 178
173 if (!(nv_ro08(bios, rammap.data + 0x04) & 0x02)) 179 if (!next->bios.rammap_10_04_02)
174 ram_mask(fuc, 0x100200, 0x00000800, 0x00000000); 180 ram_mask(fuc, 0x100200, 0x00000800, 0x00000000);
175 ram_wr32(fuc, 0x611200, 0x00003300); 181 ram_wr32(fuc, 0x611200, 0x00003300);
176 if (!(nv_ro08(bios, ramcfg.data + 0x02) & 0x10)) 182 if (!next->bios.ramcfg_10_02_10)
177 ram_wr32(fuc, 0x111100, 0x4c020000); /*XXX*/ 183 ram_wr32(fuc, 0x111100, 0x4c020000); /*XXX*/
178 184
179 ram_wr32(fuc, 0x1002d4, 0x00000001); 185 ram_wr32(fuc, 0x1002d4, 0x00000001);
@@ -202,17 +208,16 @@ nva3_ram_calc(struct nouveau_fb *pfb, u32 freq)
202 ram_wr32(fuc, 0x004018, 0x0000d000 | r004018); 208 ram_wr32(fuc, 0x004018, 0x0000d000 | r004018);
203 } 209 }
204 210
205 if ( (nv_ro08(bios, rammap.data + 0x04) & 0x08)) { 211 if (next->bios.rammap_10_04_08) {
206 u32 unk5a0 = (nv_ro16(bios, ramcfg.data + 0x05) << 8) | 212 ram_wr32(fuc, 0x1005a0, next->bios.ramcfg_10_06 << 16 |
207 nv_ro08(bios, ramcfg.data + 0x05); 213 next->bios.ramcfg_10_05 << 8 |
208 u32 unk5a4 = (nv_ro16(bios, ramcfg.data + 0x07)); 214 next->bios.ramcfg_10_05);
209 u32 unk804 = (nv_ro08(bios, ramcfg.data + 0x09) & 0xf0) << 16 | 215 ram_wr32(fuc, 0x1005a4, next->bios.ramcfg_10_08 << 8 |
210 (nv_ro08(bios, ramcfg.data + 0x03) & 0x0f) << 16 | 216 next->bios.ramcfg_10_07);
211 (nv_ro08(bios, ramcfg.data + 0x09) & 0x0f) | 217 ram_wr32(fuc, 0x10f804, next->bios.ramcfg_10_09_f0 << 20 |
212 0x80000000; 218 next->bios.ramcfg_10_03_0f << 16 |
213 ram_wr32(fuc, 0x1005a0, unk5a0); 219 next->bios.ramcfg_10_09_0f |
214 ram_wr32(fuc, 0x1005a4, unk5a4); 220 0x80000000);
215 ram_wr32(fuc, 0x10f804, unk804);
216 ram_mask(fuc, 0x10053c, 0x00001000, 0x00000000); 221 ram_mask(fuc, 0x10053c, 0x00001000, 0x00000000);
217 } else { 222 } else {
218 ram_mask(fuc, 0x10053c, 0x00001000, 0x00001000); 223 ram_mask(fuc, 0x10053c, 0x00001000, 0x00001000);
@@ -250,27 +255,26 @@ nva3_ram_calc(struct nouveau_fb *pfb, u32 freq)
250 ram_mask(fuc, 0x100220[0], 0x00000000, 0x00000000); 255 ram_mask(fuc, 0x100220[0], 0x00000000, 0x00000000);
251 ram_mask(fuc, 0x100220[8], 0x00000000, 0x00000000); 256 ram_mask(fuc, 0x100220[8], 0x00000000, 0x00000000);
252 257
253 data = (nv_ro08(bios, ramcfg.data + 0x02) & 0x08) ? 0x00000000 : 0x00001000; 258 ram_mask(fuc, 0x100200, 0x00001000, !next->bios.ramcfg_10_02_08 << 12);
254 ram_mask(fuc, 0x100200, 0x00001000, data);
255 259
256 unk714 = ram_rd32(fuc, 0x100714) & ~0xf0000010; 260 unk714 = ram_rd32(fuc, 0x100714) & ~0xf0000010;
257 unk718 = ram_rd32(fuc, 0x100718) & ~0x00000100; 261 unk718 = ram_rd32(fuc, 0x100718) & ~0x00000100;
258 unk71c = ram_rd32(fuc, 0x10071c) & ~0x00000100; 262 unk71c = ram_rd32(fuc, 0x10071c) & ~0x00000100;
259 if ( (nv_ro08(bios, ramcfg.data + 0x02) & 0x20)) 263 if (next->bios.ramcfg_10_02_20)
260 unk714 |= 0xf0000000; 264 unk714 |= 0xf0000000;
261 if (!(nv_ro08(bios, ramcfg.data + 0x02) & 0x04)) 265 if (!next->bios.ramcfg_10_02_04)
262 unk714 |= 0x00000010; 266 unk714 |= 0x00000010;
263 ram_wr32(fuc, 0x100714, unk714); 267 ram_wr32(fuc, 0x100714, unk714);
264 268
265 if (nv_ro08(bios, ramcfg.data + 0x02) & 0x01) 269 if (next->bios.ramcfg_10_02_01)
266 unk71c |= 0x00000100; 270 unk71c |= 0x00000100;
267 ram_wr32(fuc, 0x10071c, unk71c); 271 ram_wr32(fuc, 0x10071c, unk71c);
268 272
269 if (nv_ro08(bios, ramcfg.data + 0x02) & 0x02) 273 if (next->bios.ramcfg_10_02_02)
270 unk718 |= 0x00000100; 274 unk718 |= 0x00000100;
271 ram_wr32(fuc, 0x100718, unk718); 275 ram_wr32(fuc, 0x100718, unk718);
272 276
273 if (nv_ro08(bios, ramcfg.data + 0x02) & 0x10) 277 if (next->bios.ramcfg_10_02_10)
274 ram_wr32(fuc, 0x111100, 0x48000000); /*XXX*/ 278 ram_wr32(fuc, 0x111100, 0x48000000); /*XXX*/
275 279
276 ram_mask(fuc, mr[0], 0x100, 0x100); 280 ram_mask(fuc, mr[0], 0x100, 0x100);
@@ -282,9 +286,9 @@ nva3_ram_calc(struct nouveau_fb *pfb, u32 freq)
282 ram_nsec(fuc, 12000); 286 ram_nsec(fuc, 12000);
283 287
284 ram_wr32(fuc, 0x611200, 0x00003330); 288 ram_wr32(fuc, 0x611200, 0x00003330);
285 if ( (nv_ro08(bios, rammap.data + 0x04) & 0x02)) 289 if (next->bios.rammap_10_04_02)
286 ram_mask(fuc, 0x100200, 0x00000800, 0x00000800); 290 ram_mask(fuc, 0x100200, 0x00000800, 0x00000800);
287 if ( (nv_ro08(bios, ramcfg.data + 0x02) & 0x10)) { 291 if (next->bios.ramcfg_10_02_10) {
288 ram_mask(fuc, 0x111104, 0x00000180, 0x00000180); 292 ram_mask(fuc, 0x111104, 0x00000180, 0x00000180);
289 ram_mask(fuc, 0x111100, 0x40000000, 0x00000000); 293 ram_mask(fuc, 0x111100, 0x40000000, 0x00000000);
290 } else { 294 } else {
@@ -404,11 +408,11 @@ nva3_ram_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
404 ram->fuc.r_0x100714 = ramfuc_reg(0x100714); 408 ram->fuc.r_0x100714 = ramfuc_reg(0x100714);
405 ram->fuc.r_0x100718 = ramfuc_reg(0x100718); 409 ram->fuc.r_0x100718 = ramfuc_reg(0x100718);
406 ram->fuc.r_0x10071c = ramfuc_reg(0x10071c); 410 ram->fuc.r_0x10071c = ramfuc_reg(0x10071c);
407 ram->fuc.r_0x100760 = ramfuc_reg(0x100760); 411 ram->fuc.r_0x100760 = ramfuc_stride(0x100760, 4, ram->base.part_mask);
408 ram->fuc.r_0x1007a0 = ramfuc_reg(0x1007a0); 412 ram->fuc.r_0x1007a0 = ramfuc_stride(0x1007a0, 4, ram->base.part_mask);
409 ram->fuc.r_0x1007e0 = ramfuc_reg(0x1007e0); 413 ram->fuc.r_0x1007e0 = ramfuc_stride(0x1007e0, 4, ram->base.part_mask);
410 ram->fuc.r_0x10f804 = ramfuc_reg(0x10f804); 414 ram->fuc.r_0x10f804 = ramfuc_reg(0x10f804);
411 ram->fuc.r_0x1110e0 = ramfuc_reg(0x1110e0); 415 ram->fuc.r_0x1110e0 = ramfuc_stride(0x1110e0, 4, ram->base.part_mask);
412 ram->fuc.r_0x111100 = ramfuc_reg(0x111100); 416 ram->fuc.r_0x111100 = ramfuc_reg(0x111100);
413 ram->fuc.r_0x111104 = ramfuc_reg(0x111104); 417 ram->fuc.r_0x111104 = ramfuc_reg(0x111104);
414 ram->fuc.r_0x611200 = ramfuc_reg(0x611200); 418 ram->fuc.r_0x611200 = ramfuc_reg(0x611200);
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c
index 2b284b192763..735cb9580abe 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c
@@ -133,6 +133,7 @@ nvc0_ram_calc(struct nouveau_fb *pfb, u32 freq)
133 struct nouveau_bios *bios = nouveau_bios(pfb); 133 struct nouveau_bios *bios = nouveau_bios(pfb);
134 struct nvc0_ram *ram = (void *)pfb->ram; 134 struct nvc0_ram *ram = (void *)pfb->ram;
135 struct nvc0_ramfuc *fuc = &ram->fuc; 135 struct nvc0_ramfuc *fuc = &ram->fuc;
136 struct nvbios_ramcfg cfg;
136 u8 ver, cnt, len, strap; 137 u8 ver, cnt, len, strap;
137 struct { 138 struct {
138 u32 data; 139 u32 data;
@@ -145,7 +146,7 @@ nvc0_ram_calc(struct nouveau_fb *pfb, u32 freq)
145 146
146 /* lookup memory config data relevant to the target frequency */ 147 /* lookup memory config data relevant to the target frequency */
147 rammap.data = nvbios_rammapEm(bios, freq / 1000, &ver, &rammap.size, 148 rammap.data = nvbios_rammapEm(bios, freq / 1000, &ver, &rammap.size,
148 &cnt, &ramcfg.size); 149 &cnt, &ramcfg.size, &cfg);
149 if (!rammap.data || ver != 0x10 || rammap.size < 0x0e) { 150 if (!rammap.data || ver != 0x10 || rammap.size < 0x0e) {
150 nv_error(pfb, "invalid/missing rammap entry\n"); 151 nv_error(pfb, "invalid/missing rammap entry\n");
151 return -EINVAL; 152 return -EINVAL;
@@ -483,9 +484,9 @@ nvc0_ram_get(struct nouveau_fb *pfb, u64 size, u32 align, u32 ncmin,
483 484
484 do { 485 do {
485 if (back) 486 if (back)
486 ret = nouveau_mm_tail(mm, 1, size, ncmin, align, &r); 487 ret = nouveau_mm_tail(mm, 0, 1, size, ncmin, align, &r);
487 else 488 else
488 ret = nouveau_mm_head(mm, 1, size, ncmin, align, &r); 489 ret = nouveau_mm_head(mm, 0, 1, size, ncmin, align, &r);
489 if (ret) { 490 if (ret) {
490 mutex_unlock(&pfb->base.mutex); 491 mutex_unlock(&pfb->base.mutex);
491 pfb->ram->put(pfb, &mem); 492 pfb->ram->put(pfb, &mem);
@@ -562,7 +563,7 @@ nvc0_ram_create_(struct nouveau_object *parent, struct nouveau_object *engine,
562 offset = (0x0200000000ULL >> 12) + (bsize << 8); 563 offset = (0x0200000000ULL >> 12) + (bsize << 8);
563 length = (ram->size >> 12) - ((bsize * parts) << 8) - rsvd_tail; 564 length = (ram->size >> 12) - ((bsize * parts) << 8) - rsvd_tail;
564 565
565 ret = nouveau_mm_init(&pfb->vram, offset, length, 0); 566 ret = nouveau_mm_init(&pfb->vram, offset, length, 1);
566 if (ret) 567 if (ret)
567 nouveau_mm_fini(&pfb->vram); 568 nouveau_mm_fini(&pfb->vram);
568 } 569 }
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnve0.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnve0.c
index c5b46e302319..6bae474abb44 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnve0.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnve0.c
@@ -29,6 +29,8 @@
29#include <subdev/bios/init.h> 29#include <subdev/bios/init.h>
30#include <subdev/bios/rammap.h> 30#include <subdev/bios/rammap.h>
31#include <subdev/bios/timing.h> 31#include <subdev/bios/timing.h>
32#include <subdev/bios/M0205.h>
33#include <subdev/bios/M0209.h>
32 34
33#include <subdev/clock.h> 35#include <subdev/clock.h>
34#include <subdev/clock/pll.h> 36#include <subdev/clock/pll.h>
@@ -41,14 +43,6 @@
41 43
42#include "ramfuc.h" 44#include "ramfuc.h"
43 45
44/* binary driver only executes this path if the condition (a) is true
45 * for any configuration (combination of rammap+ramcfg+timing) that
46 * can be reached on a given card. for now, we will execute the branch
47 * unconditionally in the hope that a "false everywhere" in the bios
48 * tables doesn't actually mean "don't touch this".
49 */
50#define NOTE00(a) 1
51
52struct nve0_ramfuc { 46struct nve0_ramfuc {
53 struct ramfuc base; 47 struct ramfuc base;
54 48
@@ -134,10 +128,12 @@ struct nve0_ram {
134 struct nouveau_ram base; 128 struct nouveau_ram base;
135 struct nve0_ramfuc fuc; 129 struct nve0_ramfuc fuc;
136 130
131 struct list_head cfg;
137 u32 parts; 132 u32 parts;
138 u32 pmask; 133 u32 pmask;
139 u32 pnuts; 134 u32 pnuts;
140 135
136 struct nvbios_ramcfg diff;
141 int from; 137 int from;
142 int mode; 138 int mode;
143 int N1, fN1, M1, P1; 139 int N1, fN1, M1, P1;
@@ -241,7 +237,7 @@ nve0_ram_nuts(struct nve0_ram *ram, struct ramfuc_reg *reg,
241{ 237{
242 struct nve0_fb_priv *priv = (void *)nouveau_fb(ram); 238 struct nve0_fb_priv *priv = (void *)nouveau_fb(ram);
243 struct ramfuc *fuc = &ram->fuc.base; 239 struct ramfuc *fuc = &ram->fuc.base;
244 u32 addr = 0x110000 + (reg->addr[0] & 0xfff); 240 u32 addr = 0x110000 + (reg->addr & 0xfff);
245 u32 mask = _mask | _copy; 241 u32 mask = _mask | _copy;
246 u32 data = (_data & _mask) | (reg->data & _copy); 242 u32 data = (_data & _mask) | (reg->data & _copy);
247 u32 i; 243 u32 i;
@@ -268,6 +264,7 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq)
268 u32 mask, data; 264 u32 mask, data;
269 265
270 ram_mask(fuc, 0x10f808, 0x40000000, 0x40000000); 266 ram_mask(fuc, 0x10f808, 0x40000000, 0x40000000);
267 ram_block(fuc);
271 ram_wr32(fuc, 0x62c000, 0x0f0f0000); 268 ram_wr32(fuc, 0x62c000, 0x0f0f0000);
272 269
273 /* MR1: turn termination on early, for some reason.. */ 270 /* MR1: turn termination on early, for some reason.. */
@@ -478,7 +475,7 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq)
478 ram_mask(fuc, 0x10f2e8, 0xffffffff, next->bios.timing[9]); 475 ram_mask(fuc, 0x10f2e8, 0xffffffff, next->bios.timing[9]);
479 476
480 data = mask = 0x00000000; 477 data = mask = 0x00000000;
481 if (NOTE00(ramcfg_08_20)) { 478 if (ram->diff.ramcfg_11_08_20) {
482 if (next->bios.ramcfg_11_08_20) 479 if (next->bios.ramcfg_11_08_20)
483 data |= 0x01000000; 480 data |= 0x01000000;
484 mask |= 0x01000000; 481 mask |= 0x01000000;
@@ -486,11 +483,11 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq)
486 ram_mask(fuc, 0x10f200, mask, data); 483 ram_mask(fuc, 0x10f200, mask, data);
487 484
488 data = mask = 0x00000000; 485 data = mask = 0x00000000;
489 if (NOTE00(ramcfg_02_03 != 0)) { 486 if (ram->diff.ramcfg_11_02_03) {
490 data |= next->bios.ramcfg_11_02_03 << 8; 487 data |= next->bios.ramcfg_11_02_03 << 8;
491 mask |= 0x00000300; 488 mask |= 0x00000300;
492 } 489 }
493 if (NOTE00(ramcfg_01_10)) { 490 if (ram->diff.ramcfg_11_01_10) {
494 if (next->bios.ramcfg_11_01_10) 491 if (next->bios.ramcfg_11_01_10)
495 data |= 0x70000000; 492 data |= 0x70000000;
496 mask |= 0x70000000; 493 mask |= 0x70000000;
@@ -498,11 +495,11 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq)
498 ram_mask(fuc, 0x10f604, mask, data); 495 ram_mask(fuc, 0x10f604, mask, data);
499 496
500 data = mask = 0x00000000; 497 data = mask = 0x00000000;
501 if (NOTE00(timing_30_07 != 0)) { 498 if (ram->diff.timing_20_30_07) {
502 data |= next->bios.timing_20_30_07 << 28; 499 data |= next->bios.timing_20_30_07 << 28;
503 mask |= 0x70000000; 500 mask |= 0x70000000;
504 } 501 }
505 if (NOTE00(ramcfg_01_01)) { 502 if (ram->diff.ramcfg_11_01_01) {
506 if (next->bios.ramcfg_11_01_01) 503 if (next->bios.ramcfg_11_01_01)
507 data |= 0x00000100; 504 data |= 0x00000100;
508 mask |= 0x00000100; 505 mask |= 0x00000100;
@@ -510,11 +507,11 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq)
510 ram_mask(fuc, 0x10f614, mask, data); 507 ram_mask(fuc, 0x10f614, mask, data);
511 508
512 data = mask = 0x00000000; 509 data = mask = 0x00000000;
513 if (NOTE00(timing_30_07 != 0)) { 510 if (ram->diff.timing_20_30_07) {
514 data |= next->bios.timing_20_30_07 << 28; 511 data |= next->bios.timing_20_30_07 << 28;
515 mask |= 0x70000000; 512 mask |= 0x70000000;
516 } 513 }
517 if (NOTE00(ramcfg_01_02)) { 514 if (ram->diff.ramcfg_11_01_02) {
518 if (next->bios.ramcfg_11_01_02) 515 if (next->bios.ramcfg_11_01_02)
519 data |= 0x00000100; 516 data |= 0x00000100;
520 mask |= 0x00000100; 517 mask |= 0x00000100;
@@ -548,11 +545,11 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq)
548 ram_wr32(fuc, 0x10f870, 0x11111111 * next->bios.ramcfg_11_03_0f); 545 ram_wr32(fuc, 0x10f870, 0x11111111 * next->bios.ramcfg_11_03_0f);
549 546
550 data = mask = 0x00000000; 547 data = mask = 0x00000000;
551 if (NOTE00(ramcfg_02_03 != 0)) { 548 if (ram->diff.ramcfg_11_02_03) {
552 data |= next->bios.ramcfg_11_02_03; 549 data |= next->bios.ramcfg_11_02_03;
553 mask |= 0x00000003; 550 mask |= 0x00000003;
554 } 551 }
555 if (NOTE00(ramcfg_01_10)) { 552 if (ram->diff.ramcfg_11_01_10) {
556 if (next->bios.ramcfg_11_01_10) 553 if (next->bios.ramcfg_11_01_10)
557 data |= 0x00000004; 554 data |= 0x00000004;
558 mask |= 0x00000004; 555 mask |= 0x00000004;
@@ -666,6 +663,7 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq)
666 if (next->bios.ramcfg_11_07_02) 663 if (next->bios.ramcfg_11_07_02)
667 nve0_ram_train(fuc, 0x80020000, 0x01000000); 664 nve0_ram_train(fuc, 0x80020000, 0x01000000);
668 665
666 ram_unblock(fuc);
669 ram_wr32(fuc, 0x62c000, 0x0f0f0f00); 667 ram_wr32(fuc, 0x62c000, 0x0f0f0f00);
670 668
671 if (next->bios.rammap_11_08_01) 669 if (next->bios.rammap_11_08_01)
@@ -695,6 +693,7 @@ nve0_ram_calc_sddr3(struct nouveau_fb *pfb, u32 freq)
695 u32 mask, data; 693 u32 mask, data;
696 694
697 ram_mask(fuc, 0x10f808, 0x40000000, 0x40000000); 695 ram_mask(fuc, 0x10f808, 0x40000000, 0x40000000);
696 ram_block(fuc);
698 ram_wr32(fuc, 0x62c000, 0x0f0f0000); 697 ram_wr32(fuc, 0x62c000, 0x0f0f0000);
699 698
700 if (vc == 1 && ram_have(fuc, gpio2E)) { 699 if (vc == 1 && ram_have(fuc, gpio2E)) {
@@ -917,6 +916,7 @@ nve0_ram_calc_sddr3(struct nouveau_fb *pfb, u32 freq)
917 ram_mask(fuc, 0x10f200, 0x80000000, 0x00000000); 916 ram_mask(fuc, 0x10f200, 0x80000000, 0x00000000);
918 ram_nsec(fuc, 1000); 917 ram_nsec(fuc, 1000);
919 918
919 ram_unblock(fuc);
920 ram_wr32(fuc, 0x62c000, 0x0f0f0f00); 920 ram_wr32(fuc, 0x62c000, 0x0f0f0f00);
921 921
922 if (next->bios.rammap_11_08_01) 922 if (next->bios.rammap_11_08_01)
@@ -932,58 +932,24 @@ nve0_ram_calc_sddr3(struct nouveau_fb *pfb, u32 freq)
932 ******************************************************************************/ 932 ******************************************************************************/
933 933
934static int 934static int
935nve0_ram_calc_data(struct nouveau_fb *pfb, u32 freq, 935nve0_ram_calc_data(struct nouveau_fb *pfb, u32 khz,
936 struct nouveau_ram_data *data) 936 struct nouveau_ram_data *data)
937{ 937{
938 struct nouveau_bios *bios = nouveau_bios(pfb);
939 struct nve0_ram *ram = (void *)pfb->ram; 938 struct nve0_ram *ram = (void *)pfb->ram;
940 u8 strap, cnt, len; 939 struct nouveau_ram_data *cfg;
941 940 u32 mhz = khz / 1000;
942 /* lookup memory config data relevant to the target frequency */ 941
943 ram->base.rammap.data = nvbios_rammapEp(bios, freq / 1000, 942 list_for_each_entry(cfg, &ram->cfg, head) {
944 &ram->base.rammap.version, 943 if (mhz >= cfg->bios.rammap_min &&
945 &ram->base.rammap.size, 944 mhz <= cfg->bios.rammap_max) {
946 &cnt, &len, &data->bios); 945 *data = *cfg;
947 if (!ram->base.rammap.data || ram->base.rammap.version != 0x11 || 946 data->freq = khz;
948 ram->base.rammap.size < 0x09) { 947 return 0;
949 nv_error(pfb, "invalid/missing rammap entry\n");
950 return -EINVAL;
951 }
952
953 /* locate specific data set for the attached memory */
954 strap = nvbios_ramcfg_index(nv_subdev(pfb));
955 ram->base.ramcfg.data = nvbios_rammapSp(bios, ram->base.rammap.data,
956 ram->base.rammap.version,
957 ram->base.rammap.size,
958 cnt, len, strap,
959 &ram->base.ramcfg.version,
960 &ram->base.ramcfg.size,
961 &data->bios);
962 if (!ram->base.ramcfg.data || ram->base.ramcfg.version != 0x11 ||
963 ram->base.ramcfg.size < 0x08) {
964 nv_error(pfb, "invalid/missing ramcfg entry\n");
965 return -EINVAL;
966 }
967
968 /* lookup memory timings, if bios says they're present */
969 strap = nv_ro08(bios, ram->base.ramcfg.data + 0x00);
970 if (strap != 0xff) {
971 ram->base.timing.data =
972 nvbios_timingEp(bios, strap, &ram->base.timing.version,
973 &ram->base.timing.size, &cnt, &len,
974 &data->bios);
975 if (!ram->base.timing.data ||
976 ram->base.timing.version != 0x20 ||
977 ram->base.timing.size < 0x33) {
978 nv_error(pfb, "invalid/missing timing entry\n");
979 return -EINVAL;
980 } 948 }
981 } else {
982 ram->base.timing.data = 0;
983 } 949 }
984 950
985 data->freq = freq; 951 nv_error(ram, "ramcfg data for %dMHz not found\n", mhz);
986 return 0; 952 return -EINVAL;
987} 953}
988 954
989static int 955static int
@@ -1106,13 +1072,99 @@ nve0_ram_calc(struct nouveau_fb *pfb, u32 freq)
1106 return nve0_ram_calc_xits(pfb, ram->base.next); 1072 return nve0_ram_calc_xits(pfb, ram->base.next);
1107} 1073}
1108 1074
1075static void
1076nve0_ram_prog_0(struct nouveau_fb *pfb, u32 freq)
1077{
1078 struct nve0_ram *ram = (void *)pfb->ram;
1079 struct nouveau_ram_data *cfg;
1080 u32 mhz = freq / 1000;
1081 u32 mask, data;
1082
1083 list_for_each_entry(cfg, &ram->cfg, head) {
1084 if (mhz >= cfg->bios.rammap_min &&
1085 mhz <= cfg->bios.rammap_max)
1086 break;
1087 }
1088
1089 if (&cfg->head == &ram->cfg)
1090 return;
1091
1092 if (mask = 0, data = 0, ram->diff.rammap_11_0a_03fe) {
1093 data |= cfg->bios.rammap_11_0a_03fe << 12;
1094 mask |= 0x001ff000;
1095 }
1096 if (ram->diff.rammap_11_09_01ff) {
1097 data |= cfg->bios.rammap_11_09_01ff;
1098 mask |= 0x000001ff;
1099 }
1100 nv_mask(pfb, 0x10f468, mask, data);
1101
1102 if (mask = 0, data = 0, ram->diff.rammap_11_0a_0400) {
1103 data |= cfg->bios.rammap_11_0a_0400;
1104 mask |= 0x00000001;
1105 }
1106 nv_mask(pfb, 0x10f420, mask, data);
1107
1108 if (mask = 0, data = 0, ram->diff.rammap_11_0a_0800) {
1109 data |= cfg->bios.rammap_11_0a_0800;
1110 mask |= 0x00000001;
1111 }
1112 nv_mask(pfb, 0x10f430, mask, data);
1113
1114 if (mask = 0, data = 0, ram->diff.rammap_11_0b_01f0) {
1115 data |= cfg->bios.rammap_11_0b_01f0;
1116 mask |= 0x0000001f;
1117 }
1118 nv_mask(pfb, 0x10f400, mask, data);
1119
1120 if (mask = 0, data = 0, ram->diff.rammap_11_0b_0200) {
1121 data |= cfg->bios.rammap_11_0b_0200 << 9;
1122 mask |= 0x00000200;
1123 }
1124 nv_mask(pfb, 0x10f410, mask, data);
1125
1126 if (mask = 0, data = 0, ram->diff.rammap_11_0d) {
1127 data |= cfg->bios.rammap_11_0d << 16;
1128 mask |= 0x00ff0000;
1129 }
1130 if (ram->diff.rammap_11_0f) {
1131 data |= cfg->bios.rammap_11_0f << 8;
1132 mask |= 0x0000ff00;
1133 }
1134 nv_mask(pfb, 0x10f440, mask, data);
1135
1136 if (mask = 0, data = 0, ram->diff.rammap_11_0e) {
1137 data |= cfg->bios.rammap_11_0e << 8;
1138 mask |= 0x0000ff00;
1139 }
1140 if (ram->diff.rammap_11_0b_0800) {
1141 data |= cfg->bios.rammap_11_0b_0800 << 7;
1142 mask |= 0x00000080;
1143 }
1144 if (ram->diff.rammap_11_0b_0400) {
1145 data |= cfg->bios.rammap_11_0b_0400 << 5;
1146 mask |= 0x00000020;
1147 }
1148 nv_mask(pfb, 0x10f444, mask, data);
1149}
1150
1109static int 1151static int
1110nve0_ram_prog(struct nouveau_fb *pfb) 1152nve0_ram_prog(struct nouveau_fb *pfb)
1111{ 1153{
1112 struct nouveau_device *device = nv_device(pfb); 1154 struct nouveau_device *device = nv_device(pfb);
1113 struct nve0_ram *ram = (void *)pfb->ram; 1155 struct nve0_ram *ram = (void *)pfb->ram;
1114 struct nve0_ramfuc *fuc = &ram->fuc; 1156 struct nve0_ramfuc *fuc = &ram->fuc;
1115 ram_exec(fuc, nouveau_boolopt(device->cfgopt, "NvMemExec", true)); 1157 struct nouveau_ram_data *next = ram->base.next;
1158
1159 if (!nouveau_boolopt(device->cfgopt, "NvMemExec", true)) {
1160 ram_exec(fuc, false);
1161 return (ram->base.next == &ram->base.xition);
1162 }
1163
1164 nve0_ram_prog_0(pfb, 1000);
1165 ram_exec(fuc, true);
1166 nve0_ram_prog_0(pfb, next->freq);
1167
1116 return (ram->base.next == &ram->base.xition); 1168 return (ram->base.next == &ram->base.xition);
1117} 1169}
1118 1170
@@ -1125,24 +1177,147 @@ nve0_ram_tidy(struct nouveau_fb *pfb)
1125 ram_exec(fuc, false); 1177 ram_exec(fuc, false);
1126} 1178}
1127 1179
1180struct nve0_ram_train {
1181 u16 mask;
1182 struct nvbios_M0209S remap;
1183 struct nvbios_M0209S type00;
1184 struct nvbios_M0209S type01;
1185 struct nvbios_M0209S type04;
1186 struct nvbios_M0209S type06;
1187 struct nvbios_M0209S type07;
1188 struct nvbios_M0209S type08;
1189 struct nvbios_M0209S type09;
1190};
1191
1192static int
1193nve0_ram_train_type(struct nouveau_fb *pfb, int i, u8 ramcfg,
1194 struct nve0_ram_train *train)
1195{
1196 struct nouveau_bios *bios = nouveau_bios(pfb);
1197 struct nvbios_M0205E M0205E;
1198 struct nvbios_M0205S M0205S;
1199 struct nvbios_M0209E M0209E;
1200 struct nvbios_M0209S *remap = &train->remap;
1201 struct nvbios_M0209S *value;
1202 u8 ver, hdr, cnt, len;
1203 u32 data;
1204
1205 /* determine type of data for this index */
1206 if (!(data = nvbios_M0205Ep(bios, i, &ver, &hdr, &cnt, &len, &M0205E)))
1207 return -ENOENT;
1208
1209 switch (M0205E.type) {
1210 case 0x00: value = &train->type00; break;
1211 case 0x01: value = &train->type01; break;
1212 case 0x04: value = &train->type04; break;
1213 case 0x06: value = &train->type06; break;
1214 case 0x07: value = &train->type07; break;
1215 case 0x08: value = &train->type08; break;
1216 case 0x09: value = &train->type09; break;
1217 default:
1218 return 0;
1219 }
1220
1221 /* training data index determined by ramcfg strap */
1222 if (!(data = nvbios_M0205Sp(bios, i, ramcfg, &ver, &hdr, &M0205S)))
1223 return -EINVAL;
1224 i = M0205S.data;
1225
1226 /* training data format information */
1227 if (!(data = nvbios_M0209Ep(bios, i, &ver, &hdr, &cnt, &len, &M0209E)))
1228 return -EINVAL;
1229
1230 /* ... and the raw data */
1231 if (!(data = nvbios_M0209Sp(bios, i, 0, &ver, &hdr, value)))
1232 return -EINVAL;
1233
1234 if (M0209E.v02_07 == 2) {
1235 /* of course! why wouldn't we have a pointer to another entry
1236 * in the same table, and use the first one as an array of
1237 * remap indices...
1238 */
1239 if (!(data = nvbios_M0209Sp(bios, M0209E.v03, 0, &ver, &hdr,
1240 remap)))
1241 return -EINVAL;
1242
1243 for (i = 0; i < ARRAY_SIZE(value->data); i++)
1244 value->data[i] = remap->data[value->data[i]];
1245 } else
1246 if (M0209E.v02_07 != 1)
1247 return -EINVAL;
1248
1249 train->mask |= 1 << M0205E.type;
1250 return 0;
1251}
1252
1253static int
1254nve0_ram_train_init_0(struct nouveau_fb *pfb, struct nve0_ram_train *train)
1255{
1256 int i, j;
1257
1258 if ((train->mask & 0x03d3) != 0x03d3) {
1259 nv_warn(pfb, "missing link training data\n");
1260 return -EINVAL;
1261 }
1262
1263 for (i = 0; i < 0x30; i++) {
1264 for (j = 0; j < 8; j += 4) {
1265 nv_wr32(pfb, 0x10f968 + j, 0x00000000 | (i << 8));
1266 nv_wr32(pfb, 0x10f920 + j, 0x00000000 |
1267 train->type08.data[i] << 4 |
1268 train->type06.data[i]);
1269 nv_wr32(pfb, 0x10f918 + j, train->type00.data[i]);
1270 nv_wr32(pfb, 0x10f920 + j, 0x00000100 |
1271 train->type09.data[i] << 4 |
1272 train->type07.data[i]);
1273 nv_wr32(pfb, 0x10f918 + j, train->type01.data[i]);
1274 }
1275 }
1276
1277 for (j = 0; j < 8; j += 4) {
1278 for (i = 0; i < 0x100; i++) {
1279 nv_wr32(pfb, 0x10f968 + j, i);
1280 nv_wr32(pfb, 0x10f900 + j, train->type04.data[i]);
1281 }
1282 }
1283
1284 return 0;
1285}
1286
1287static int
1288nve0_ram_train_init(struct nouveau_fb *pfb)
1289{
1290 u8 ramcfg = nvbios_ramcfg_index(nv_subdev(pfb));
1291 struct nve0_ram_train *train;
1292 int ret = -ENOMEM, i;
1293
1294 if ((train = kzalloc(sizeof(*train), GFP_KERNEL))) {
1295 for (i = 0; i < 0x100; i++) {
1296 ret = nve0_ram_train_type(pfb, i, ramcfg, train);
1297 if (ret && ret != -ENOENT)
1298 break;
1299 }
1300 }
1301
1302 switch (pfb->ram->type) {
1303 case NV_MEM_TYPE_GDDR5:
1304 ret = nve0_ram_train_init_0(pfb, train);
1305 break;
1306 default:
1307 ret = 0;
1308 break;
1309 }
1310
1311 kfree(train);
1312 return ret;
1313}
1314
1128int 1315int
1129nve0_ram_init(struct nouveau_object *object) 1316nve0_ram_init(struct nouveau_object *object)
1130{ 1317{
1131 struct nouveau_fb *pfb = (void *)object->parent; 1318 struct nouveau_fb *pfb = (void *)object->parent;
1132 struct nve0_ram *ram = (void *)object; 1319 struct nve0_ram *ram = (void *)object;
1133 struct nouveau_bios *bios = nouveau_bios(pfb); 1320 struct nouveau_bios *bios = nouveau_bios(pfb);
1134 static const u8 train0[] = {
1135 0x00, 0xff, 0xff, 0x00, 0xff, 0x00,
1136 0x00, 0xff, 0xff, 0x00, 0xff, 0x00,
1137 };
1138 static const u32 train1[] = {
1139 0x00000000, 0xffffffff,
1140 0x55555555, 0xaaaaaaaa,
1141 0x33333333, 0xcccccccc,
1142 0xf0f0f0f0, 0x0f0f0f0f,
1143 0x00ff00ff, 0xff00ff00,
1144 0x0000ffff, 0xffff0000,
1145 };
1146 u8 ver, hdr, cnt, len, snr, ssz; 1321 u8 ver, hdr, cnt, len, snr, ssz;
1147 u32 data, save; 1322 u32 data, save;
1148 int ret, i; 1323 int ret, i;
@@ -1168,51 +1343,107 @@ nve0_ram_init(struct nouveau_object *object)
1168 1343
1169 cnt = nv_ro08(bios, data + 0x14); /* guess at count */ 1344 cnt = nv_ro08(bios, data + 0x14); /* guess at count */
1170 data = nv_ro32(bios, data + 0x10); /* guess u32... */ 1345 data = nv_ro32(bios, data + 0x10); /* guess u32... */
1171 save = nv_rd32(pfb, 0x10f65c); 1346 save = nv_rd32(pfb, 0x10f65c) & 0x000000f0;
1172 for (i = 0; i < cnt; i++) { 1347 for (i = 0; i < cnt; i++, data += 4) {
1173 nv_mask(pfb, 0x10f65c, 0x000000f0, i << 4); 1348 if (i != save >> 4) {
1174 nvbios_exec(&(struct nvbios_init) { 1349 nv_mask(pfb, 0x10f65c, 0x000000f0, i << 4);
1175 .subdev = nv_subdev(pfb), 1350 nvbios_exec(&(struct nvbios_init) {
1176 .bios = bios, 1351 .subdev = nv_subdev(pfb),
1177 .offset = nv_ro32(bios, data), /* guess u32 */ 1352 .bios = bios,
1178 .execute = 1, 1353 .offset = nv_ro32(bios, data),
1179 }); 1354 .execute = 1,
1180 data += 4; 1355 });
1181 } 1356 }
1182 nv_wr32(pfb, 0x10f65c, save); 1357 }
1358 nv_mask(pfb, 0x10f65c, 0x000000f0, save);
1183 nv_mask(pfb, 0x10f584, 0x11000000, 0x00000000); 1359 nv_mask(pfb, 0x10f584, 0x11000000, 0x00000000);
1360 nv_wr32(pfb, 0x10ecc0, 0xffffffff);
1361 nv_mask(pfb, 0x10f160, 0x00000010, 0x00000010);
1184 1362
1185 switch (ram->base.type) { 1363 return nve0_ram_train_init(pfb);
1186 case NV_MEM_TYPE_GDDR5: 1364}
1187 for (i = 0; i < 0x30; i++) {
1188 nv_wr32(pfb, 0x10f968, 0x00000000 | (i << 8));
1189 nv_wr32(pfb, 0x10f920, 0x00000000 | train0[i % 12]);
1190 nv_wr32(pfb, 0x10f918, train1[i % 12]);
1191 nv_wr32(pfb, 0x10f920, 0x00000100 | train0[i % 12]);
1192 nv_wr32(pfb, 0x10f918, train1[i % 12]);
1193
1194 nv_wr32(pfb, 0x10f96c, 0x00000000 | (i << 8));
1195 nv_wr32(pfb, 0x10f924, 0x00000000 | train0[i % 12]);
1196 nv_wr32(pfb, 0x10f91c, train1[i % 12]);
1197 nv_wr32(pfb, 0x10f924, 0x00000100 | train0[i % 12]);
1198 nv_wr32(pfb, 0x10f91c, train1[i % 12]);
1199 }
1200 1365
1201 for (i = 0; i < 0x100; i++) { 1366static int
1202 nv_wr32(pfb, 0x10f968, i); 1367nve0_ram_ctor_data(struct nve0_ram *ram, u8 ramcfg, int i)
1203 nv_wr32(pfb, 0x10f900, train1[2 + (i & 1)]); 1368{
1204 } 1369 struct nouveau_fb *pfb = (void *)nv_object(ram)->parent;
1370 struct nouveau_bios *bios = nouveau_bios(pfb);
1371 struct nouveau_ram_data *cfg;
1372 struct nvbios_ramcfg *d = &ram->diff;
1373 struct nvbios_ramcfg *p, *n;
1374 u8 ver, hdr, cnt, len;
1375 u32 data;
1376 int ret;
1205 1377
1206 for (i = 0; i < 0x100; i++) { 1378 if (!(cfg = kmalloc(sizeof(*cfg), GFP_KERNEL)))
1207 nv_wr32(pfb, 0x10f96c, i); 1379 return -ENOMEM;
1208 nv_wr32(pfb, 0x10f900, train1[2 + (i & 1)]); 1380 p = &list_last_entry(&ram->cfg, typeof(*cfg), head)->bios;
1209 } 1381 n = &cfg->bios;
1210 break; 1382
1211 default: 1383 /* memory config data for a range of target frequencies */
1212 break; 1384 data = nvbios_rammapEp(bios, i, &ver, &hdr, &cnt, &len, &cfg->bios);
1385 if (ret = -ENOENT, !data)
1386 goto done;
1387 if (ret = -ENOSYS, ver != 0x11 || hdr < 0x12)
1388 goto done;
1389
1390 /* ... and a portion specific to the attached memory */
1391 data = nvbios_rammapSp(bios, data, ver, hdr, cnt, len, ramcfg,
1392 &ver, &hdr, &cfg->bios);
1393 if (ret = -EINVAL, !data)
1394 goto done;
1395 if (ret = -ENOSYS, ver != 0x11 || hdr < 0x0a)
1396 goto done;
1397
1398 /* lookup memory timings, if bios says they're present */
1399 if (cfg->bios.ramcfg_timing != 0xff) {
1400 data = nvbios_timingEp(bios, cfg->bios.ramcfg_timing,
1401 &ver, &hdr, &cnt, &len,
1402 &cfg->bios);
1403 if (ret = -EINVAL, !data)
1404 goto done;
1405 if (ret = -ENOSYS, ver != 0x20 || hdr < 0x33)
1406 goto done;
1213 } 1407 }
1214 1408
1215 return 0; 1409 list_add_tail(&cfg->head, &ram->cfg);
1410 if (ret = 0, i == 0)
1411 goto done;
1412
1413 d->rammap_11_0a_03fe |= p->rammap_11_0a_03fe != n->rammap_11_0a_03fe;
1414 d->rammap_11_09_01ff |= p->rammap_11_09_01ff != n->rammap_11_09_01ff;
1415 d->rammap_11_0a_0400 |= p->rammap_11_0a_0400 != n->rammap_11_0a_0400;
1416 d->rammap_11_0a_0800 |= p->rammap_11_0a_0800 != n->rammap_11_0a_0800;
1417 d->rammap_11_0b_01f0 |= p->rammap_11_0b_01f0 != n->rammap_11_0b_01f0;
1418 d->rammap_11_0b_0200 |= p->rammap_11_0b_0200 != n->rammap_11_0b_0200;
1419 d->rammap_11_0d |= p->rammap_11_0d != n->rammap_11_0d;
1420 d->rammap_11_0f |= p->rammap_11_0f != n->rammap_11_0f;
1421 d->rammap_11_0e |= p->rammap_11_0e != n->rammap_11_0e;
1422 d->rammap_11_0b_0800 |= p->rammap_11_0b_0800 != n->rammap_11_0b_0800;
1423 d->rammap_11_0b_0400 |= p->rammap_11_0b_0400 != n->rammap_11_0b_0400;
1424 d->ramcfg_11_01_01 |= p->ramcfg_11_01_01 != n->ramcfg_11_01_01;
1425 d->ramcfg_11_01_02 |= p->ramcfg_11_01_02 != n->ramcfg_11_01_02;
1426 d->ramcfg_11_01_10 |= p->ramcfg_11_01_10 != n->ramcfg_11_01_10;
1427 d->ramcfg_11_02_03 |= p->ramcfg_11_02_03 != n->ramcfg_11_02_03;
1428 d->ramcfg_11_08_20 |= p->ramcfg_11_08_20 != n->ramcfg_11_08_20;
1429 d->timing_20_30_07 |= p->timing_20_30_07 != n->timing_20_30_07;
1430done:
1431 if (ret)
1432 kfree(cfg);
1433 return ret;
1434}
1435
1436static void
1437nve0_ram_dtor(struct nouveau_object *object)
1438{
1439 struct nve0_ram *ram = (void *)object;
1440 struct nouveau_ram_data *cfg, *tmp;
1441
1442 list_for_each_entry_safe(cfg, tmp, &ram->cfg, head) {
1443 kfree(cfg);
1444 }
1445
1446 nouveau_ram_destroy(&ram->base);
1216} 1447}
1217 1448
1218static int 1449static int
@@ -1226,6 +1457,7 @@ nve0_ram_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
1226 struct dcb_gpio_func func; 1457 struct dcb_gpio_func func;
1227 struct nve0_ram *ram; 1458 struct nve0_ram *ram;
1228 int ret, i; 1459 int ret, i;
1460 u8 ramcfg = nvbios_ramcfg_index(nv_subdev(pfb));
1229 u32 tmp; 1461 u32 tmp;
1230 1462
1231 ret = nvc0_ram_create(parent, engine, oclass, 0x022554, &ram); 1463 ret = nvc0_ram_create(parent, engine, oclass, 0x022554, &ram);
@@ -1233,6 +1465,8 @@ nve0_ram_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
1233 if (ret) 1465 if (ret)
1234 return ret; 1466 return ret;
1235 1467
1468 INIT_LIST_HEAD(&ram->cfg);
1469
1236 switch (ram->base.type) { 1470 switch (ram->base.type) {
1237 case NV_MEM_TYPE_DDR3: 1471 case NV_MEM_TYPE_DDR3:
1238 case NV_MEM_TYPE_GDDR5: 1472 case NV_MEM_TYPE_GDDR5:
@@ -1264,7 +1498,26 @@ nve0_ram_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
1264 } 1498 }
1265 } 1499 }
1266 1500
1267 // parse bios data for both pll's 1501 /* parse bios data for all rammap table entries up-front, and
1502 * build information on whether certain fields differ between
1503 * any of the entries.
1504 *
1505 * the binary driver appears to completely ignore some fields
1506 * when all entries contain the same value. at first, it was
1507 * hoped that these were mere optimisations and the bios init
1508 * tables had configured as per the values here, but there is
1509 * evidence now to suggest that this isn't the case and we do
1510 * need to treat this condition as a "don't touch" indicator.
1511 */
1512 for (i = 0; !ret; i++) {
1513 ret = nve0_ram_ctor_data(ram, ramcfg, i);
1514 if (ret && ret != -ENOENT) {
1515 nv_error(pfb, "failed to parse ramcfg data\n");
1516 return ret;
1517 }
1518 }
1519
1520 /* parse bios data for both pll's */
1268 ret = nvbios_pll_parse(bios, 0x0c, &ram->fuc.refpll); 1521 ret = nvbios_pll_parse(bios, 0x0c, &ram->fuc.refpll);
1269 if (ret) { 1522 if (ret) {
1270 nv_error(pfb, "mclk refpll data not found\n"); 1523 nv_error(pfb, "mclk refpll data not found\n");
@@ -1277,6 +1530,7 @@ nve0_ram_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
1277 return ret; 1530 return ret;
1278 } 1531 }
1279 1532
1533 /* lookup memory voltage gpios */
1280 ret = gpio->find(gpio, 0, 0x18, DCB_GPIO_UNUSED, &func); 1534 ret = gpio->find(gpio, 0, 0x18, DCB_GPIO_UNUSED, &func);
1281 if (ret == 0) { 1535 if (ret == 0) {
1282 ram->fuc.r_gpioMV = ramfuc_reg(0x00d610 + (func.line * 0x04)); 1536 ram->fuc.r_gpioMV = ramfuc_reg(0x00d610 + (func.line * 0x04));
@@ -1385,7 +1639,7 @@ nve0_ram_oclass = {
1385 .handle = 0, 1639 .handle = 0,
1386 .ofuncs = &(struct nouveau_ofuncs) { 1640 .ofuncs = &(struct nouveau_ofuncs) {
1387 .ctor = nve0_ram_ctor, 1641 .ctor = nve0_ram_ctor,
1388 .dtor = _nouveau_ram_dtor, 1642 .dtor = nve0_ram_dtor,
1389 .init = nve0_ram_init, 1643 .init = nve0_ram_init,
1390 .fini = _nouveau_ram_fini, 1644 .fini = _nouveau_ram_fini,
1391 } 1645 }
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/sddr2.c b/drivers/gpu/drm/nouveau/core/subdev/fb/sddr2.c
new file mode 100644
index 000000000000..bb1eb8f3e639
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/sddr2.c
@@ -0,0 +1,94 @@
1/*
2 * Copyright 2014 Roy Spliet
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: Roy Spliet <rspliet@eclipso.eu>
23 * Ben Skeggs
24 */
25
26#include "priv.h"
27
28struct ramxlat {
29 int id;
30 u8 enc;
31};
32
33static inline int
34ramxlat(const struct ramxlat *xlat, int id)
35{
36 while (xlat->id >= 0) {
37 if (xlat->id == id)
38 return xlat->enc;
39 xlat++;
40 }
41 return -EINVAL;
42}
43
44static const struct ramxlat
45ramddr2_cl[] = {
46 { 2, 2 }, { 3, 3 }, { 4, 4 }, { 5, 5 }, { 6, 6 },
47 /* The following are available in some, but not all DDR2 docs */
48 { 7, 7 },
49 { -1 }
50};
51
52static const struct ramxlat
53ramddr2_wr[] = {
54 { 2, 1 }, { 3, 2 }, { 4, 3 }, { 5, 4 }, { 6, 5 },
55 /* The following are available in some, but not all DDR2 docs */
56 { 7, 6 },
57 { -1 }
58};
59
60int
61nouveau_sddr2_calc(struct nouveau_ram *ram)
62{
63 int CL, WR, DLL = 0, ODT = 0;
64
65 switch (ram->next->bios.timing_ver) {
66 case 0x10:
67 CL = ram->next->bios.timing_10_CL;
68 WR = ram->next->bios.timing_10_WR;
69 DLL = !ram->next->bios.ramcfg_10_02_40;
70 ODT = ram->next->bios.timing_10_ODT & 3;
71 break;
72 case 0x20:
73 CL = (ram->next->bios.timing[1] & 0x0000001f);
74 WR = (ram->next->bios.timing[2] & 0x007f0000) >> 16;
75 break;
76 default:
77 return -ENOSYS;
78 }
79
80 CL = ramxlat(ramddr2_cl, CL);
81 WR = ramxlat(ramddr2_wr, WR);
82 if (CL < 0 || WR < 0)
83 return -EINVAL;
84
85 ram->mr[0] &= ~0xf70;
86 ram->mr[0] |= (WR & 0x07) << 9;
87 ram->mr[0] |= (CL & 0x07) << 4;
88
89 ram->mr[1] &= ~0x045;
90 ram->mr[1] |= (ODT & 0x1) << 2;
91 ram->mr[1] |= (ODT & 0x2) << 5;
92 ram->mr[1] |= !DLL;
93 return 0;
94}
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/sddr3.c b/drivers/gpu/drm/nouveau/core/subdev/fb/sddr3.c
index ebd4cd9c35d9..83949b11833a 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/sddr3.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/sddr3.c
@@ -20,9 +20,9 @@
20 * OTHER DEALINGS IN THE SOFTWARE. 20 * OTHER DEALINGS IN THE SOFTWARE.
21 * 21 *
22 * Authors: Ben Skeggs <bskeggs@redhat.com> 22 * Authors: Ben Skeggs <bskeggs@redhat.com>
23 * Roy Spliet <rspliet@eclipso.eu>
23 */ 24 */
24 25
25#include <subdev/bios.h>
26#include "priv.h" 26#include "priv.h"
27 27
28struct ramxlat { 28struct ramxlat {
@@ -69,31 +69,52 @@ ramddr3_cwl[] = {
69int 69int
70nouveau_sddr3_calc(struct nouveau_ram *ram) 70nouveau_sddr3_calc(struct nouveau_ram *ram)
71{ 71{
72 struct nouveau_bios *bios = nouveau_bios(ram); 72 int CWL, CL, WR, DLL = 0, ODT = 0;
73 int WL, CL, WR;
74 73
75 switch (!!ram->timing.data * ram->timing.version) { 74 switch (ram->next->bios.timing_ver) {
75 case 0x10:
76 if (ram->next->bios.timing_hdr < 0x17) {
77 /* XXX: NV50: Get CWL from the timing register */
78 return -ENOSYS;
79 }
80 CWL = ram->next->bios.timing_10_CWL;
81 CL = ram->next->bios.timing_10_CL;
82 WR = ram->next->bios.timing_10_WR;
83 DLL = !ram->next->bios.ramcfg_10_02_40;
84 ODT = ram->next->bios.timing_10_ODT;
85 break;
76 case 0x20: 86 case 0x20:
77 WL = (nv_ro16(bios, ram->timing.data + 0x04) & 0x0f80) >> 7; 87 CWL = (ram->next->bios.timing[1] & 0x00000f80) >> 7;
78 CL = nv_ro08(bios, ram->timing.data + 0x04) & 0x1f; 88 CL = (ram->next->bios.timing[1] & 0x0000001f) >> 0;
79 WR = nv_ro08(bios, ram->timing.data + 0x0a) & 0x7f; 89 WR = (ram->next->bios.timing[2] & 0x007f0000) >> 16;
90 /* XXX: Get these values from the VBIOS instead */
91 DLL = !(ram->mr[1] & 0x1);
92 ODT = (ram->mr[1] & 0x004) >> 2 |
93 (ram->mr[1] & 0x040) >> 5 |
94 (ram->mr[1] & 0x200) >> 7;
80 break; 95 break;
81 default: 96 default:
82 return -ENOSYS; 97 return -ENOSYS;
83 } 98 }
84 99
85 WL = ramxlat(ramddr3_cwl, WL); 100 CWL = ramxlat(ramddr3_cwl, CWL);
86 CL = ramxlat(ramddr3_cl, CL); 101 CL = ramxlat(ramddr3_cl, CL);
87 WR = ramxlat(ramddr3_wr, WR); 102 WR = ramxlat(ramddr3_wr, WR);
88 if (WL < 0 || CL < 0 || WR < 0) 103 if (CL < 0 || CWL < 0 || WR < 0)
89 return -EINVAL; 104 return -EINVAL;
90 105
91 ram->mr[0] &= ~0xe74; 106 ram->mr[0] &= ~0xf74;
92 ram->mr[0] |= (WR & 0x07) << 9; 107 ram->mr[0] |= (WR & 0x07) << 9;
93 ram->mr[0] |= (CL & 0x0e) << 3; 108 ram->mr[0] |= (CL & 0x0e) << 3;
94 ram->mr[0] |= (CL & 0x01) << 2; 109 ram->mr[0] |= (CL & 0x01) << 2;
95 110
111 ram->mr[1] &= ~0x245;
112 ram->mr[1] |= (ODT & 0x1) << 2;
113 ram->mr[1] |= (ODT & 0x2) << 5;
114 ram->mr[1] |= (ODT & 0x4) << 7;
115 ram->mr[1] |= !DLL;
116
96 ram->mr[2] &= ~0x038; 117 ram->mr[2] &= ~0x038;
97 ram->mr[2] |= (WL & 0x07) << 3; 118 ram->mr[2] |= (CWL & 0x07) << 3;
98 return 0; 119 return 0;
99} 120}
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fuse/base.c b/drivers/gpu/drm/nouveau/core/subdev/fuse/base.c
new file mode 100644
index 000000000000..9e8e92127715
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/fuse/base.c
@@ -0,0 +1,54 @@
1/*
2 * Copyright 2014 Martin Peres
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: Martin Peres
23 */
24
25#include <subdev/fuse.h>
26
27int
28_nouveau_fuse_init(struct nouveau_object *object)
29{
30 struct nouveau_fuse *fuse = (void *)object;
31 return nouveau_subdev_init(&fuse->base);
32}
33
34void
35_nouveau_fuse_dtor(struct nouveau_object *object)
36{
37 struct nouveau_fuse *fuse = (void *)object;
38 nouveau_subdev_destroy(&fuse->base);
39}
40
41int
42nouveau_fuse_create_(struct nouveau_object *parent,
43 struct nouveau_object *engine,
44 struct nouveau_oclass *oclass, int length, void **pobject)
45{
46 struct nouveau_fuse *fuse;
47 int ret;
48
49 ret = nouveau_subdev_create_(parent, engine, oclass, 0, "FUSE",
50 "fuse", length, pobject);
51 fuse = *pobject;
52
53 return ret;
54}
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fuse/g80.c b/drivers/gpu/drm/nouveau/core/subdev/fuse/g80.c
new file mode 100644
index 000000000000..a374ade485be
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/fuse/g80.c
@@ -0,0 +1,81 @@
1/*
2 * Copyright 2014 Martin Peres
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: Martin Peres
23 */
24
25#include "priv.h"
26
27struct g80_fuse_priv {
28 struct nouveau_fuse base;
29
30 spinlock_t fuse_enable_lock;
31};
32
33static u32
34g80_fuse_rd32(struct nouveau_object *object, u64 addr)
35{
36 struct g80_fuse_priv *priv = (void *)object;
37 unsigned long flags;
38 u32 fuse_enable, val;
39
40 spin_lock_irqsave(&priv->fuse_enable_lock, flags);
41
42 /* racy if another part of nouveau start writing to this reg */
43 fuse_enable = nv_mask(priv, 0x1084, 0x800, 0x800);
44 val = nv_rd32(priv, 0x21000 + addr);
45 nv_wr32(priv, 0x1084, fuse_enable);
46
47 spin_unlock_irqrestore(&priv->fuse_enable_lock, flags);
48
49 return val;
50}
51
52
53static int
54g80_fuse_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
55 struct nouveau_oclass *oclass, void *data, u32 size,
56 struct nouveau_object **pobject)
57{
58 struct g80_fuse_priv *priv;
59 int ret;
60
61 ret = nouveau_fuse_create(parent, engine, oclass, &priv);
62 *pobject = nv_object(priv);
63 if (ret)
64 return ret;
65
66 spin_lock_init(&priv->fuse_enable_lock);
67
68 return 0;
69}
70
71struct nouveau_oclass
72g80_fuse_oclass = {
73 .handle = NV_SUBDEV(FUSE, 0x50),
74 .ofuncs = &(struct nouveau_ofuncs) {
75 .ctor = g80_fuse_ctor,
76 .dtor = _nouveau_fuse_dtor,
77 .init = _nouveau_fuse_init,
78 .fini = _nouveau_fuse_fini,
79 .rd32 = g80_fuse_rd32,
80 },
81};
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fuse/gf100.c b/drivers/gpu/drm/nouveau/core/subdev/fuse/gf100.c
new file mode 100644
index 000000000000..5ed03f54b3d4
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/fuse/gf100.c
@@ -0,0 +1,83 @@
1/*
2 * Copyright 2014 Martin Peres
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: Martin Peres
23 */
24
25#include "priv.h"
26
27struct gf100_fuse_priv {
28 struct nouveau_fuse base;
29
30 spinlock_t fuse_enable_lock;
31};
32
33static u32
34gf100_fuse_rd32(struct nouveau_object *object, u64 addr)
35{
36 struct gf100_fuse_priv *priv = (void *)object;
37 unsigned long flags;
38 u32 fuse_enable, unk, val;
39
40 spin_lock_irqsave(&priv->fuse_enable_lock, flags);
41
42 /* racy if another part of nouveau start writing to these regs */
43 fuse_enable = nv_mask(priv, 0x22400, 0x800, 0x800);
44 unk = nv_mask(priv, 0x21000, 0x1, 0x1);
45 val = nv_rd32(priv, 0x21100 + addr);
46 nv_wr32(priv, 0x21000, unk);
47 nv_wr32(priv, 0x22400, fuse_enable);
48
49 spin_unlock_irqrestore(&priv->fuse_enable_lock, flags);
50
51 return val;
52}
53
54
55static int
56gf100_fuse_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
57 struct nouveau_oclass *oclass, void *data, u32 size,
58 struct nouveau_object **pobject)
59{
60 struct gf100_fuse_priv *priv;
61 int ret;
62
63 ret = nouveau_fuse_create(parent, engine, oclass, &priv);
64 *pobject = nv_object(priv);
65 if (ret)
66 return ret;
67
68 spin_lock_init(&priv->fuse_enable_lock);
69
70 return 0;
71}
72
73struct nouveau_oclass
74gf100_fuse_oclass = {
75 .handle = NV_SUBDEV(FUSE, 0xC0),
76 .ofuncs = &(struct nouveau_ofuncs) {
77 .ctor = gf100_fuse_ctor,
78 .dtor = _nouveau_fuse_dtor,
79 .init = _nouveau_fuse_init,
80 .fini = _nouveau_fuse_fini,
81 .rd32 = gf100_fuse_rd32,
82 },
83};
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fuse/gm107.c b/drivers/gpu/drm/nouveau/core/subdev/fuse/gm107.c
new file mode 100644
index 000000000000..4f1a636c6538
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/fuse/gm107.c
@@ -0,0 +1,66 @@
1/*
2 * Copyright 2014 Martin Peres
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: Martin Peres
23 */
24
25#include "priv.h"
26
27struct gm107_fuse_priv {
28 struct nouveau_fuse base;
29};
30
31static u32
32gm107_fuse_rd32(struct nouveau_object *object, u64 addr)
33{
34 struct gf100_fuse_priv *priv = (void *)object;
35
36 return nv_rd32(priv, 0x21100 + addr);
37}
38
39
40static int
41gm107_fuse_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
42 struct nouveau_oclass *oclass, void *data, u32 size,
43 struct nouveau_object **pobject)
44{
45 struct gm107_fuse_priv *priv;
46 int ret;
47
48 ret = nouveau_fuse_create(parent, engine, oclass, &priv);
49 *pobject = nv_object(priv);
50 if (ret)
51 return ret;
52
53 return 0;
54}
55
56struct nouveau_oclass
57gm107_fuse_oclass = {
58 .handle = NV_SUBDEV(FUSE, 0x117),
59 .ofuncs = &(struct nouveau_ofuncs) {
60 .ctor = gm107_fuse_ctor,
61 .dtor = _nouveau_fuse_dtor,
62 .init = _nouveau_fuse_init,
63 .fini = _nouveau_fuse_fini,
64 .rd32 = gm107_fuse_rd32,
65 },
66};
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fuse/priv.h b/drivers/gpu/drm/nouveau/core/subdev/fuse/priv.h
new file mode 100644
index 000000000000..d2085411a5cb
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/fuse/priv.h
@@ -0,0 +1,9 @@
1#ifndef __NVKM_FUSE_PRIV_H__
2#define __NVKM_FUSE_PRIV_H__
3
4#include <subdev/fuse.h>
5
6int _nouveau_fuse_init(struct nouveau_object *object);
7void _nouveau_fuse_dtor(struct nouveau_object *object);
8
9#endif
diff --git a/drivers/gpu/drm/nouveau/core/subdev/gpio/base.c b/drivers/gpu/drm/nouveau/core/subdev/gpio/base.c
index b1e3ed7c8beb..7ad99b763f4c 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/gpio/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/gpio/base.c
@@ -122,7 +122,8 @@ nouveau_gpio_intr_init(struct nvkm_event *event, int type, int index)
122} 122}
123 123
124static int 124static int
125nouveau_gpio_intr_ctor(void *data, u32 size, struct nvkm_notify *notify) 125nouveau_gpio_intr_ctor(struct nouveau_object *object, void *data, u32 size,
126 struct nvkm_notify *notify)
126{ 127{
127 struct nvkm_gpio_ntfy_req *req = data; 128 struct nvkm_gpio_ntfy_req *req = data;
128 if (!WARN_ON(size != sizeof(*req))) { 129 if (!WARN_ON(size != sizeof(*req))) {
diff --git a/drivers/gpu/drm/nouveau/core/subdev/gpio/nv92.c b/drivers/gpu/drm/nouveau/core/subdev/gpio/nv94.c
index 252083d376f5..cae404ccadac 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/gpio/nv92.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/gpio/nv94.c
@@ -25,7 +25,7 @@
25#include "priv.h" 25#include "priv.h"
26 26
27void 27void
28nv92_gpio_intr_stat(struct nouveau_gpio *gpio, u32 *hi, u32 *lo) 28nv94_gpio_intr_stat(struct nouveau_gpio *gpio, u32 *hi, u32 *lo)
29{ 29{
30 u32 intr0 = nv_rd32(gpio, 0x00e054); 30 u32 intr0 = nv_rd32(gpio, 0x00e054);
31 u32 intr1 = nv_rd32(gpio, 0x00e074); 31 u32 intr1 = nv_rd32(gpio, 0x00e074);
@@ -38,7 +38,7 @@ nv92_gpio_intr_stat(struct nouveau_gpio *gpio, u32 *hi, u32 *lo)
38} 38}
39 39
40void 40void
41nv92_gpio_intr_mask(struct nouveau_gpio *gpio, u32 type, u32 mask, u32 data) 41nv94_gpio_intr_mask(struct nouveau_gpio *gpio, u32 type, u32 mask, u32 data)
42{ 42{
43 u32 inte0 = nv_rd32(gpio, 0x00e050); 43 u32 inte0 = nv_rd32(gpio, 0x00e050);
44 u32 inte1 = nv_rd32(gpio, 0x00e070); 44 u32 inte1 = nv_rd32(gpio, 0x00e070);
@@ -57,8 +57,8 @@ nv92_gpio_intr_mask(struct nouveau_gpio *gpio, u32 type, u32 mask, u32 data)
57} 57}
58 58
59struct nouveau_oclass * 59struct nouveau_oclass *
60nv92_gpio_oclass = &(struct nouveau_gpio_impl) { 60nv94_gpio_oclass = &(struct nouveau_gpio_impl) {
61 .base.handle = NV_SUBDEV(GPIO, 0x92), 61 .base.handle = NV_SUBDEV(GPIO, 0x94),
62 .base.ofuncs = &(struct nouveau_ofuncs) { 62 .base.ofuncs = &(struct nouveau_ofuncs) {
63 .ctor = _nouveau_gpio_ctor, 63 .ctor = _nouveau_gpio_ctor,
64 .dtor = _nouveau_gpio_dtor, 64 .dtor = _nouveau_gpio_dtor,
@@ -66,8 +66,8 @@ nv92_gpio_oclass = &(struct nouveau_gpio_impl) {
66 .fini = _nouveau_gpio_fini, 66 .fini = _nouveau_gpio_fini,
67 }, 67 },
68 .lines = 32, 68 .lines = 32,
69 .intr_stat = nv92_gpio_intr_stat, 69 .intr_stat = nv94_gpio_intr_stat,
70 .intr_mask = nv92_gpio_intr_mask, 70 .intr_mask = nv94_gpio_intr_mask,
71 .drive = nv50_gpio_drive, 71 .drive = nv50_gpio_drive,
72 .sense = nv50_gpio_sense, 72 .sense = nv50_gpio_sense,
73 .reset = nv50_gpio_reset, 73 .reset = nv50_gpio_reset,
diff --git a/drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c b/drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c
index a4682b0956ad..480d6d2af770 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c
@@ -77,8 +77,8 @@ nvd0_gpio_oclass = &(struct nouveau_gpio_impl) {
77 .fini = _nouveau_gpio_fini, 77 .fini = _nouveau_gpio_fini,
78 }, 78 },
79 .lines = 32, 79 .lines = 32,
80 .intr_stat = nv92_gpio_intr_stat, 80 .intr_stat = nv94_gpio_intr_stat,
81 .intr_mask = nv92_gpio_intr_mask, 81 .intr_mask = nv94_gpio_intr_mask,
82 .drive = nvd0_gpio_drive, 82 .drive = nvd0_gpio_drive,
83 .sense = nvd0_gpio_sense, 83 .sense = nvd0_gpio_sense,
84 .reset = nvd0_gpio_reset, 84 .reset = nvd0_gpio_reset,
diff --git a/drivers/gpu/drm/nouveau/core/subdev/gpio/priv.h b/drivers/gpu/drm/nouveau/core/subdev/gpio/priv.h
index e1724dfc86ae..bff98b86e2b5 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/gpio/priv.h
+++ b/drivers/gpu/drm/nouveau/core/subdev/gpio/priv.h
@@ -56,8 +56,8 @@ void nv50_gpio_reset(struct nouveau_gpio *, u8);
56int nv50_gpio_drive(struct nouveau_gpio *, int, int, int); 56int nv50_gpio_drive(struct nouveau_gpio *, int, int, int);
57int nv50_gpio_sense(struct nouveau_gpio *, int); 57int nv50_gpio_sense(struct nouveau_gpio *, int);
58 58
59void nv92_gpio_intr_stat(struct nouveau_gpio *, u32 *, u32 *); 59void nv94_gpio_intr_stat(struct nouveau_gpio *, u32 *, u32 *);
60void nv92_gpio_intr_mask(struct nouveau_gpio *, u32, u32, u32); 60void nv94_gpio_intr_mask(struct nouveau_gpio *, u32, u32, u32);
61 61
62void nvd0_gpio_reset(struct nouveau_gpio *, u8); 62void nvd0_gpio_reset(struct nouveau_gpio *, u8);
63int nvd0_gpio_drive(struct nouveau_gpio *, int, int, int); 63int nvd0_gpio_drive(struct nouveau_gpio *, int, int, int);
diff --git a/drivers/gpu/drm/nouveau/core/subdev/i2c/base.c b/drivers/gpu/drm/nouveau/core/subdev/i2c/base.c
index a652cafde3d6..2b1bf545e488 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/i2c/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/i2c/base.c
@@ -23,6 +23,7 @@
23 */ 23 */
24 24
25#include <core/option.h> 25#include <core/option.h>
26#include <core/object.h>
26#include <core/event.h> 27#include <core/event.h>
27 28
28#include <subdev/bios.h> 29#include <subdev/bios.h>
@@ -346,7 +347,8 @@ nouveau_i2c_intr_init(struct nvkm_event *event, int type, int index)
346} 347}
347 348
348static int 349static int
349nouveau_i2c_intr_ctor(void *data, u32 size, struct nvkm_notify *notify) 350nouveau_i2c_intr_ctor(struct nouveau_object *object, void *data, u32 size,
351 struct nvkm_notify *notify)
350{ 352{
351 struct nvkm_i2c_ntfy_req *req = data; 353 struct nvkm_i2c_ntfy_req *req = data;
352 if (!WARN_ON(size != sizeof(*req))) { 354 if (!WARN_ON(size != sizeof(*req))) {
diff --git a/drivers/gpu/drm/nouveau/core/subdev/instmem/nv04.c b/drivers/gpu/drm/nouveau/core/subdev/instmem/nv04.c
index 7b64befee48f..e8b1401c59c0 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/instmem/nv04.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/instmem/nv04.c
@@ -69,7 +69,7 @@ nv04_instobj_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
69 if (ret) 69 if (ret)
70 return ret; 70 return ret;
71 71
72 ret = nouveau_mm_head(&priv->heap, 1, args->size, args->size, 72 ret = nouveau_mm_head(&priv->heap, 0, 1, args->size, args->size,
73 args->align, &node->mem); 73 args->align, &node->mem);
74 if (ret) 74 if (ret)
75 return ret; 75 return ret;
diff --git a/drivers/gpu/drm/nouveau/core/subdev/ltc/base.c b/drivers/gpu/drm/nouveau/core/subdev/ltc/base.c
index 32ed442c5913..7fa331516f84 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/ltc/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/ltc/base.c
@@ -31,7 +31,7 @@ nvkm_ltc_tags_alloc(struct nouveau_ltc *ltc, u32 n,
31 struct nvkm_ltc_priv *priv = (void *)ltc; 31 struct nvkm_ltc_priv *priv = (void *)ltc;
32 int ret; 32 int ret;
33 33
34 ret = nouveau_mm_head(&priv->tags, 1, n, n, 1, pnode); 34 ret = nouveau_mm_head(&priv->tags, 0, 1, n, n, 1, pnode);
35 if (ret) 35 if (ret)
36 *pnode = NULL; 36 *pnode = NULL;
37 37
diff --git a/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c b/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c
index b54b582e72c4..e7b7872481ef 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c
@@ -62,16 +62,38 @@ gf100_ltc_zbc_clear_depth(struct nvkm_ltc_priv *priv, int i, const u32 depth)
62 nv_wr32(priv, 0x17ea58, depth); 62 nv_wr32(priv, 0x17ea58, depth);
63} 63}
64 64
65static const struct nouveau_bitfield
66gf100_ltc_lts_intr_name[] = {
67 { 0x00000001, "IDLE_ERROR_IQ" },
68 { 0x00000002, "IDLE_ERROR_CBC" },
69 { 0x00000004, "IDLE_ERROR_TSTG" },
70 { 0x00000008, "IDLE_ERROR_DSTG" },
71 { 0x00000010, "EVICTED_CB" },
72 { 0x00000020, "ILLEGAL_COMPSTAT" },
73 { 0x00000040, "BLOCKLINEAR_CB" },
74 { 0x00000100, "ECC_SEC_ERROR" },
75 { 0x00000200, "ECC_DED_ERROR" },
76 { 0x00000400, "DEBUG" },
77 { 0x00000800, "ATOMIC_TO_Z" },
78 { 0x00001000, "ILLEGAL_ATOMIC" },
79 { 0x00002000, "BLKACTIVITY_ERR" },
80 {}
81};
82
65static void 83static void
66gf100_ltc_lts_isr(struct nvkm_ltc_priv *priv, int ltc, int lts) 84gf100_ltc_lts_intr(struct nvkm_ltc_priv *priv, int ltc, int lts)
67{ 85{
68 u32 base = 0x141000 + (ltc * 0x2000) + (lts * 0x400); 86 u32 base = 0x141000 + (ltc * 0x2000) + (lts * 0x400);
69 u32 stat = nv_rd32(priv, base + 0x020); 87 u32 intr = nv_rd32(priv, base + 0x020);
88 u32 stat = intr & 0x0000ffff;
70 89
71 if (stat) { 90 if (stat) {
72 nv_info(priv, "LTC%d_LTS%d: 0x%08x\n", ltc, lts, stat); 91 nv_info(priv, "LTC%d_LTS%d:", ltc, lts);
73 nv_wr32(priv, base + 0x020, stat); 92 nouveau_bitfield_print(gf100_ltc_lts_intr_name, stat);
93 pr_cont("\n");
74 } 94 }
95
96 nv_wr32(priv, base + 0x020, intr);
75} 97}
76 98
77void 99void
@@ -84,14 +106,9 @@ gf100_ltc_intr(struct nouveau_subdev *subdev)
84 while (mask) { 106 while (mask) {
85 u32 lts, ltc = __ffs(mask); 107 u32 lts, ltc = __ffs(mask);
86 for (lts = 0; lts < priv->lts_nr; lts++) 108 for (lts = 0; lts < priv->lts_nr; lts++)
87 gf100_ltc_lts_isr(priv, ltc, lts); 109 gf100_ltc_lts_intr(priv, ltc, lts);
88 mask &= ~(1 << ltc); 110 mask &= ~(1 << ltc);
89 } 111 }
90
91 /* we do something horribly wrong and upset PMFB a lot, so mask off
92 * interrupts from it after the first one until it's fixed
93 */
94 nv_mask(priv, 0x000640, 0x02000000, 0x00000000);
95} 112}
96 113
97static int 114static int
@@ -151,7 +168,7 @@ gf100_ltc_init_tag_ram(struct nouveau_fb *pfb, struct nvkm_ltc_priv *priv)
151 tag_size += tag_align; 168 tag_size += tag_align;
152 tag_size = (tag_size + 0xfff) >> 12; /* round up */ 169 tag_size = (tag_size + 0xfff) >> 12; /* round up */
153 170
154 ret = nouveau_mm_tail(&pfb->vram, 1, tag_size, tag_size, 1, 171 ret = nouveau_mm_tail(&pfb->vram, 1, 1, tag_size, tag_size, 1,
155 &priv->tag_ram); 172 &priv->tag_ram);
156 if (ret) { 173 if (ret) {
157 priv->num_tags = 0; 174 priv->num_tags = 0;
diff --git a/drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c b/drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c
index 4761b2e9af00..a26bed86f384 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c
@@ -87,11 +87,6 @@ gm107_ltc_intr(struct nouveau_subdev *subdev)
87 gm107_ltc_lts_isr(priv, ltc, lts); 87 gm107_ltc_lts_isr(priv, ltc, lts);
88 mask &= ~(1 << ltc); 88 mask &= ~(1 << ltc);
89 } 89 }
90
91 /* we do something horribly wrong and upset PMFB a lot, so mask off
92 * interrupts from it after the first one until it's fixed
93 */
94 nv_mask(priv, 0x000640, 0x02000000, 0x00000000);
95} 90}
96 91
97static int 92static int
diff --git a/drivers/gpu/drm/nouveau/core/subdev/ltc/priv.h b/drivers/gpu/drm/nouveau/core/subdev/ltc/priv.h
index 594924f39126..41f179d93da6 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/ltc/priv.h
+++ b/drivers/gpu/drm/nouveau/core/subdev/ltc/priv.h
@@ -4,6 +4,8 @@
4#include <subdev/ltc.h> 4#include <subdev/ltc.h>
5#include <subdev/fb.h> 5#include <subdev/fb.h>
6 6
7#include <core/enum.h>
8
7struct nvkm_ltc_priv { 9struct nvkm_ltc_priv {
8 struct nouveau_ltc base; 10 struct nouveau_ltc base;
9 u32 ltc_nr; 11 u32 ltc_nr;
diff --git a/drivers/gpu/drm/nouveau/core/subdev/pwr/base.c b/drivers/gpu/drm/nouveau/core/subdev/pwr/base.c
index 69f1f34f6931..0ab55f27ec45 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/pwr/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/pwr/base.c
@@ -203,6 +203,8 @@ _nouveau_pwr_init(struct nouveau_object *object)
203 nv_wait(ppwr, 0x10a04c, 0xffffffff, 0x00000000); 203 nv_wait(ppwr, 0x10a04c, 0xffffffff, 0x00000000);
204 nv_mask(ppwr, 0x000200, 0x00002000, 0x00000000); 204 nv_mask(ppwr, 0x000200, 0x00002000, 0x00000000);
205 nv_mask(ppwr, 0x000200, 0x00002000, 0x00002000); 205 nv_mask(ppwr, 0x000200, 0x00002000, 0x00002000);
206 nv_rd32(ppwr, 0x000200);
207 nv_wait(ppwr, 0x10a10c, 0x00000006, 0x00000000);
206 208
207 /* upload data segment */ 209 /* upload data segment */
208 nv_wr32(ppwr, 0x10a1c0, 0x01000000); 210 nv_wr32(ppwr, 0x10a1c0, 0x01000000);
diff --git a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/arith.fuc b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/arith.fuc
new file mode 100644
index 000000000000..214a6d9e088d
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/arith.fuc
@@ -0,0 +1,94 @@
1/*
2 * Copyright 2014 Martin Peres <martin.peres@free.fr>
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the folloing conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: Martin Peres
23 */
24
25/******************************************************************************
26 * arith data segment
27 *****************************************************************************/
28#ifdef INCLUDE_PROC
29#endif
30
31#ifdef INCLUDE_DATA
32#endif
33
34/******************************************************************************
35 * arith code segment
36 *****************************************************************************/
37#ifdef INCLUDE_CODE
38
39// does a 32x32 -> 64 multiplication
40//
41// A * B = A_lo * B_lo
42// + ( A_hi * B_lo ) << 16
43// + ( A_lo * B_hi ) << 16
44// + ( A_hi * B_hi ) << 32
45//
46// $r15 - current
47// $r14 - A
48// $r13 - B
49// $r12 - mul_lo (return)
50// $r11 - mul_hi (return)
51// $r0 - zero
52mulu32_32_64:
53 push $r1 // A_hi
54 push $r2 // B_hi
55 push $r3 // tmp0
56 push $r4 // tmp1
57
58 shr b32 $r1 $r14 16
59 shr b32 $r2 $r13 16
60
61 clear b32 $r12
62 clear b32 $r11
63
64 // A_lo * B_lo
65 mulu $r12 $r14 $r13
66
67 // ( A_hi * B_lo ) << 16
68 mulu $r3 $r1 $r13 // tmp0 = A_hi * B_lo
69 mov b32 $r4 $r3
70 and $r3 0xffff // tmp0 = tmp0_lo
71 shl b32 $r3 16
72 shr b32 $r4 16 // tmp1 = tmp0_hi
73 add b32 $r12 $r3
74 adc b32 $r11 $r4
75
76 // ( A_lo * B_hi ) << 16
77 mulu $r3 $r14 $r2 // tmp0 = A_lo * B_hi
78 mov b32 $r4 $r3
79 and $r3 0xffff // tmp0 = tmp0_lo
80 shl b32 $r3 16
81 shr b32 $r4 16 // tmp1 = tmp0_hi
82 add b32 $r12 $r3
83 adc b32 $r11 $r4
84
85 // ( A_hi * B_hi ) << 32
86 mulu $r3 $r1 $r2 // tmp0 = A_hi * B_hi
87 add b32 $r11 $r3
88
89 pop $r4
90 pop $r3
91 pop $r2
92 pop $r1
93 ret
94#endif
diff --git a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/kernel.fuc b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/kernel.fuc
index 8f29badd785f..5cf5be63cbef 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/kernel.fuc
+++ b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/kernel.fuc
@@ -98,12 +98,16 @@ wr32:
98// $r14 - ns 98// $r14 - ns
99// $r0 - zero 99// $r0 - zero
100nsec: 100nsec:
101 push $r9
102 push $r8
101 nv_iord($r8, NV_PPWR_TIMER_LOW) 103 nv_iord($r8, NV_PPWR_TIMER_LOW)
102 nsec_loop: 104 nsec_loop:
103 nv_iord($r9, NV_PPWR_TIMER_LOW) 105 nv_iord($r9, NV_PPWR_TIMER_LOW)
104 sub b32 $r9 $r8 106 sub b32 $r9 $r8
105 cmp b32 $r9 $r14 107 cmp b32 $r9 $r14
106 bra l #nsec_loop 108 bra l #nsec_loop
109 pop $r8
110 pop $r9
107 ret 111 ret
108 112
109// busy-wait for a period of time 113// busy-wait for a period of time
@@ -115,6 +119,8 @@ nsec:
115// $r11 - timeout (ns) 119// $r11 - timeout (ns)
116// $r0 - zero 120// $r0 - zero
117wait: 121wait:
122 push $r9
123 push $r8
118 nv_iord($r8, NV_PPWR_TIMER_LOW) 124 nv_iord($r8, NV_PPWR_TIMER_LOW)
119 wait_loop: 125 wait_loop:
120 nv_rd32($r10, $r14) 126 nv_rd32($r10, $r14)
@@ -126,6 +132,8 @@ wait:
126 cmp b32 $r9 $r11 132 cmp b32 $r9 $r11
127 bra l #wait_loop 133 bra l #wait_loop
128 wait_done: 134 wait_done:
135 pop $r8
136 pop $r9
129 ret 137 ret
130 138
131// $r15 - current (kern) 139// $r15 - current (kern)
@@ -242,12 +250,89 @@ intr:
242 bclr $flags $p0 250 bclr $flags $p0
243 iret 251 iret
244 252
245// request the current process be sent a message after a timeout expires 253// calculate the number of ticks in the specified nanoseconds delay
254//
255// $r15 - current
256// $r14 - ns
257// $r14 - ticks (return)
258// $r0 - zero
259ticks_from_ns:
260 push $r12
261 push $r11
262
263 /* try not losing precision (multiply then divide) */
264 imm32($r13, HW_TICKS_PER_US)
265 call #mulu32_32_64
266
267 /* use an immeditate, it's ok because HW_TICKS_PER_US < 16 bits */
268 div $r12 $r12 1000
269
270 /* check if there wasn't any overflow */
271 cmpu b32 $r11 0
272 bra e #ticks_from_ns_quit
273
274 /* let's divide then multiply, too bad for the precision! */
275 div $r14 $r14 1000
276 imm32($r13, HW_TICKS_PER_US)
277 call #mulu32_32_64
278
279 /* this cannot overflow as long as HW_TICKS_PER_US < 1000 */
280
281ticks_from_ns_quit:
282 mov b32 $r14 $r12
283 pop $r11
284 pop $r12
285 ret
286
287// calculate the number of ticks in the specified microsecond delay
288//
289// $r15 - current
290// $r14 - us
291// $r14 - ticks (return)
292// $r0 - zero
293ticks_from_us:
294 push $r12
295 push $r11
296
297 /* simply multiply $us by HW_TICKS_PER_US */
298 imm32($r13, HW_TICKS_PER_US)
299 call #mulu32_32_64
300 mov b32 $r14 $r12
301
302 /* check if there wasn't any overflow */
303 cmpu b32 $r11 0
304 bra e #ticks_from_us_quit
305
306 /* Overflow! */
307 clear b32 $r14
308
309ticks_from_us_quit:
310 pop $r11
311 pop $r12
312 ret
313
314// calculate the number of ticks in the specified microsecond delay
246// 315//
247// $r15 - current 316// $r15 - current
248// $r14 - ticks 317// $r14 - ticks
318// $r14 - us (return)
319// $r0 - zero
320ticks_to_us:
321 /* simply divide $ticks by HW_TICKS_PER_US */
322 imm32($r13, HW_TICKS_PER_US)
323 div $r14 $r14 $r13
324
325 ret
326
327// request the current process be sent a message after a timeout expires
328//
329// $r15 - current
330// $r14 - ticks (make sure it is < 2^31 to avoid any possible overflow)
249// $r0 - zero 331// $r0 - zero
250timer: 332timer:
333 push $r9
334 push $r8
335
251 // interrupts off to prevent racing with timer isr 336 // interrupts off to prevent racing with timer isr
252 bclr $flags ie0 337 bclr $flags ie0
253 338
@@ -255,13 +340,22 @@ timer:
255 ld b32 $r8 D[$r15 + #proc_time] 340 ld b32 $r8 D[$r15 + #proc_time]
256 cmp b32 $r8 0 341 cmp b32 $r8 0
257 bra g #timer_done 342 bra g #timer_done
258 st b32 D[$r15 + #proc_time] $r14
259 343
260 // halt watchdog timer temporarily and check for a pending 344 // halt watchdog timer temporarily
261 // interrupt. if there's one already pending, we can just 345 clear b32 $r8
262 // bail since the timer isr will queue the next soonest
263 // right after it's done
264 nv_iowr(NV_PPWR_WATCHDOG_ENABLE, $r8) 346 nv_iowr(NV_PPWR_WATCHDOG_ENABLE, $r8)
347
348 // find out how much time elapsed since the last update
349 // of the watchdog and add this time to the wanted ticks
350 nv_iord($r8, NV_PPWR_WATCHDOG_TIME)
351 ld b32 $r9 D[$r0 + #time_prev]
352 sub b32 $r9 $r8
353 add b32 $r14 $r9
354 st b32 D[$r15 + #proc_time] $r14
355
356 // check for a pending interrupt. if there's one already
357 // pending, we can just bail since the timer isr will
358 // queue the next soonest right after it's done
265 nv_iord($r8, NV_PPWR_INTR) 359 nv_iord($r8, NV_PPWR_INTR)
266 and $r8 NV_PPWR_INTR_WATCHDOG 360 and $r8 NV_PPWR_INTR_WATCHDOG
267 bra nz #timer_enable 361 bra nz #timer_enable
@@ -272,10 +366,10 @@ timer:
272 cmp b32 $r14 $r0 366 cmp b32 $r14 $r0
273 bra e #timer_reset 367 bra e #timer_reset
274 cmp b32 $r14 $r8 368 cmp b32 $r14 $r8
275 bra l #timer_done 369 bra g #timer_enable
276 timer_reset: 370 timer_reset:
277 nv_iowr(NV_PPWR_WATCHDOG_TIME, $r14) 371 nv_iowr(NV_PPWR_WATCHDOG_TIME, $r14)
278 st b32 D[$r0 + #time_prev] $r14 372 st b32 D[$r0 + #time_prev] $r14
279 373
280 // re-enable the watchdog timer 374 // re-enable the watchdog timer
281 timer_enable: 375 timer_enable:
@@ -285,6 +379,9 @@ timer:
285 // interrupts back on 379 // interrupts back on
286 timer_done: 380 timer_done:
287 bset $flags ie0 381 bset $flags ie0
382
383 pop $r8
384 pop $r9
288 ret 385 ret
289 386
290// send message to another process 387// send message to another process
@@ -371,6 +468,9 @@ send:
371// $r14 - process 468// $r14 - process
372// $r0 - zero 469// $r0 - zero
373recv: 470recv:
471 push $r9
472 push $r8
473
374 ld b32 $r8 D[$r14 + #proc_qget] 474 ld b32 $r8 D[$r14 + #proc_qget]
375 ld b32 $r9 D[$r14 + #proc_qput] 475 ld b32 $r9 D[$r14 + #proc_qput]
376 bclr $flags $p1 476 bclr $flags $p1
@@ -403,6 +503,8 @@ recv:
403 bset $flags $p1 503 bset $flags $p1
404 pop $r15 504 pop $r15
405 recv_done: 505 recv_done:
506 pop $r8
507 pop $r9
406 ret 508 ret
407 509
408init: 510init:
diff --git a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/macros.fuc b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/macros.fuc
index 5668e045bac1..96fc984dafdc 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/macros.fuc
+++ b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/macros.fuc
@@ -250,3 +250,23 @@
250*/ st b32 D[$r0] reg /* 250*/ st b32 D[$r0] reg /*
251*/ clear b32 $r0 251*/ clear b32 $r0
252#endif 252#endif
253
254#define st(size, addr, reg) /*
255*/ movw $r0 addr /*
256*/ st size D[$r0] reg /*
257*/ clear b32 $r0
258
259#define ld(size, reg, addr) /*
260*/ movw $r0 addr /*
261*/ ld size reg D[$r0] /*
262*/ clear b32 $r0
263
264// does a 64+64 -> 64 unsigned addition (C = A + B)
265#define addu64(reg_a_c_hi, reg_a_c_lo, b_hi, b_lo) /*
266*/ add b32 reg_a_c_lo b_lo /*
267*/ adc b32 reg_a_c_hi b_hi
268
269// does a 64+64 -> 64 substraction (C = A - B)
270#define subu64(reg_a_c_hi, reg_a_c_lo, b_hi, b_lo) /*
271*/ sub b32 reg_a_c_lo b_lo /*
272*/ sbb b32 reg_a_c_hi b_hi
diff --git a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/memx.fuc b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/memx.fuc
index d43741eccb11..e89789a53b80 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/memx.fuc
+++ b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/memx.fuc
@@ -43,17 +43,23 @@ process(PROC_MEMX, #memx_init, #memx_recv)
43*/ .b32 func 43*/ .b32 func
44 44
45memx_func_head: 45memx_func_head:
46handler(ENTER , 0x0001, 0x0000, #memx_func_enter) 46handler(ENTER , 0x0000, 0x0000, #memx_func_enter)
47memx_func_next: 47memx_func_next:
48handler(LEAVE , 0x0000, 0x0000, #memx_func_leave) 48handler(LEAVE , 0x0000, 0x0000, #memx_func_leave)
49handler(WR32 , 0x0000, 0x0002, #memx_func_wr32) 49handler(WR32 , 0x0000, 0x0002, #memx_func_wr32)
50handler(WAIT , 0x0004, 0x0000, #memx_func_wait) 50handler(WAIT , 0x0004, 0x0000, #memx_func_wait)
51handler(DELAY , 0x0001, 0x0000, #memx_func_delay) 51handler(DELAY , 0x0001, 0x0000, #memx_func_delay)
52handler(VBLANK, 0x0001, 0x0000, #memx_func_wait_vblank)
52memx_func_tail: 53memx_func_tail:
53 54
54.equ #memx_func_size #memx_func_next - #memx_func_head 55.equ #memx_func_size #memx_func_next - #memx_func_head
55.equ #memx_func_num (#memx_func_tail - #memx_func_head) / #memx_func_size 56.equ #memx_func_num (#memx_func_tail - #memx_func_head) / #memx_func_size
56 57
58memx_ts_start:
59.b32 0
60memx_ts_end:
61.b32 0
62
57memx_data_head: 63memx_data_head:
58.skip 0x0800 64.skip 0x0800
59memx_data_tail: 65memx_data_tail:
@@ -67,19 +73,44 @@ memx_data_tail:
67// 73//
68// $r15 - current (memx) 74// $r15 - current (memx)
69// $r4 - packet length 75// $r4 - packet length
70// +00: bitmask of heads to wait for vblank on
71// $r3 - opcode desciption 76// $r3 - opcode desciption
72// $r0 - zero 77// $r0 - zero
73memx_func_enter: 78memx_func_enter:
79#if NVKM_PPWR_CHIPSET == GT215
80 movw $r8 0x1610
81 nv_rd32($r7, $r8)
82 imm32($r6, 0xfffffffc)
83 and $r7 $r6
84 movw $r6 0x2
85 or $r7 $r6
86 nv_wr32($r8, $r7)
87#else
88 movw $r6 0x001620
89 imm32($r7, ~0x00000aa2);
90 nv_rd32($r8, $r6)
91 and $r8 $r7
92 nv_wr32($r6, $r8)
93
94 imm32($r7, ~0x00000001)
95 nv_rd32($r8, $r6)
96 and $r8 $r7
97 nv_wr32($r6, $r8)
98
99 movw $r6 0x0026f0
100 nv_rd32($r8, $r6)
101 and $r8 $r7
102 nv_wr32($r6, $r8)
103#endif
104
74 mov $r6 NV_PPWR_OUTPUT_SET_FB_PAUSE 105 mov $r6 NV_PPWR_OUTPUT_SET_FB_PAUSE
75 nv_iowr(NV_PPWR_OUTPUT_SET, $r6) 106 nv_iowr(NV_PPWR_OUTPUT_SET, $r6)
76 memx_func_enter_wait: 107 memx_func_enter_wait:
77 nv_iord($r6, NV_PPWR_OUTPUT) 108 nv_iord($r6, NV_PPWR_OUTPUT)
78 and $r6 NV_PPWR_OUTPUT_FB_PAUSE 109 and $r6 NV_PPWR_OUTPUT_FB_PAUSE
79 bra z #memx_func_enter_wait 110 bra z #memx_func_enter_wait
80 //XXX: TODO 111
81 ld b32 $r6 D[$r1 + 0x00] 112 nv_iord($r6, NV_PPWR_TIMER_LOW)
82 add b32 $r1 0x04 113 st b32 D[$r0 + #memx_ts_start] $r6
83 ret 114 ret
84 115
85// description 116// description
@@ -89,14 +120,93 @@ memx_func_enter:
89// $r3 - opcode desciption 120// $r3 - opcode desciption
90// $r0 - zero 121// $r0 - zero
91memx_func_leave: 122memx_func_leave:
123 nv_iord($r6, NV_PPWR_TIMER_LOW)
124 st b32 D[$r0 + #memx_ts_end] $r6
125
92 mov $r6 NV_PPWR_OUTPUT_CLR_FB_PAUSE 126 mov $r6 NV_PPWR_OUTPUT_CLR_FB_PAUSE
93 nv_iowr(NV_PPWR_OUTPUT_CLR, $r6) 127 nv_iowr(NV_PPWR_OUTPUT_CLR, $r6)
94 memx_func_leave_wait: 128 memx_func_leave_wait:
95 nv_iord($r6, NV_PPWR_OUTPUT) 129 nv_iord($r6, NV_PPWR_OUTPUT)
96 and $r6 NV_PPWR_OUTPUT_FB_PAUSE 130 and $r6 NV_PPWR_OUTPUT_FB_PAUSE
97 bra nz #memx_func_leave_wait 131 bra nz #memx_func_leave_wait
132
133#if NVKM_PPWR_CHIPSET == GT215
134 movw $r8 0x1610
135 nv_rd32($r7, $r8)
136 imm32($r6, 0xffffffcc)
137 and $r7 $r6
138 nv_wr32($r8, $r7)
139#else
140 movw $r6 0x0026f0
141 imm32($r7, 0x00000001)
142 nv_rd32($r8, $r6)
143 or $r8 $r7
144 nv_wr32($r6, $r8)
145
146 movw $r6 0x001620
147 nv_rd32($r8, $r6)
148 or $r8 $r7
149 nv_wr32($r6, $r8)
150
151 imm32($r7, 0x00000aa2);
152 nv_rd32($r8, $r6)
153 or $r8 $r7
154 nv_wr32($r6, $r8)
155#endif
156 ret
157
158#if NVKM_PPWR_CHIPSET < GF119
159// description
160//
161// $r15 - current (memx)
162// $r4 - packet length
163// +00: head to wait for vblank on
164// $r3 - opcode desciption
165// $r0 - zero
166memx_func_wait_vblank:
167 ld b32 $r6 D[$r1 + 0x00]
168 cmp b32 $r6 0x0
169 bra z #memx_func_wait_vblank_head0
170 cmp b32 $r6 0x1
171 bra z #memx_func_wait_vblank_head1
172 bra #memx_func_wait_vblank_fini
173
174 memx_func_wait_vblank_head1:
175 movw $r7 0x20
176 bra #memx_func_wait_vblank_0
177
178 memx_func_wait_vblank_head0:
179 movw $r7 0x8
180
181 memx_func_wait_vblank_0:
182 nv_iord($r6, NV_PPWR_INPUT)
183 and $r6 $r7
184 bra nz #memx_func_wait_vblank_0
185
186 memx_func_wait_vblank_1:
187 nv_iord($r6, NV_PPWR_INPUT)
188 and $r6 $r7
189 bra z #memx_func_wait_vblank_1
190
191 memx_func_wait_vblank_fini:
192 add b32 $r1 0x4
193 ret
194
195#else
196
197// XXX: currently no-op
198//
199// $r15 - current (memx)
200// $r4 - packet length
201// +00: head to wait for vblank on
202// $r3 - opcode desciption
203// $r0 - zero
204memx_func_wait_vblank:
205 add b32 $r1 0x4
98 ret 206 ret
99 207
208#endif
209
100// description 210// description
101// 211//
102// $r15 - current (memx) 212// $r15 - current (memx)
@@ -160,14 +270,17 @@ memx_exec:
160 push $r13 270 push $r13
161 mov b32 $r1 $r12 271 mov b32 $r1 $r12
162 mov b32 $r2 $r11 272 mov b32 $r2 $r11
273
163 memx_exec_next: 274 memx_exec_next:
164 // fetch the packet header, and locate opcode info 275 // fetch the packet header
165 ld b32 $r3 D[$r1] 276 ld b32 $r3 D[$r1]
166 add b32 $r1 4 277 add b32 $r1 4
167 shr b32 $r4 $r3 16 278 extr $r4 $r3 16:31
168 mulu $r3 #memx_func_size 279 extr $r3 $r3 0:15
169 280
170 // execute the opcode handler 281 // execute the opcode handler
282 sub b32 $r3 1
283 mulu $r3 #memx_func_size
171 ld b32 $r5 D[$r3 + #memx_func_head + #memx_func] 284 ld b32 $r5 D[$r3 + #memx_func_head + #memx_func]
172 call $r5 285 call $r5
173 286
@@ -176,6 +289,10 @@ memx_exec:
176 bra l #memx_exec_next 289 bra l #memx_exec_next
177 290
178 // send completion reply 291 // send completion reply
292 ld b32 $r11 D[$r0 + #memx_ts_start]
293 ld b32 $r12 D[$r0 + #memx_ts_end]
294 sub b32 $r12 $r11
295 nv_iord($r11, NV_PPWR_INPUT)
179 pop $r13 296 pop $r13
180 pop $r14 297 pop $r14
181 call(send) 298 call(send)
diff --git a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nv108.fuc b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nv108.fuc
index 17a8a383d91a..b439519ec866 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nv108.fuc
+++ b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nv108.fuc
@@ -23,6 +23,7 @@
23 */ 23 */
24 24
25#define NVKM_PPWR_CHIPSET GK208 25#define NVKM_PPWR_CHIPSET GK208
26#define HW_TICKS_PER_US 324
26 27
27#define NVKM_FALCON_PC24 28#define NVKM_FALCON_PC24
28#define NVKM_FALCON_UNSHIFTED_IO 29#define NVKM_FALCON_UNSHIFTED_IO
@@ -34,6 +35,7 @@
34.section #nv108_pwr_data 35.section #nv108_pwr_data
35#define INCLUDE_PROC 36#define INCLUDE_PROC
36#include "kernel.fuc" 37#include "kernel.fuc"
38#include "arith.fuc"
37#include "host.fuc" 39#include "host.fuc"
38#include "memx.fuc" 40#include "memx.fuc"
39#include "perf.fuc" 41#include "perf.fuc"
@@ -44,6 +46,7 @@
44 46
45#define INCLUDE_DATA 47#define INCLUDE_DATA
46#include "kernel.fuc" 48#include "kernel.fuc"
49#include "arith.fuc"
47#include "host.fuc" 50#include "host.fuc"
48#include "memx.fuc" 51#include "memx.fuc"
49#include "perf.fuc" 52#include "perf.fuc"
@@ -56,6 +59,7 @@
56.section #nv108_pwr_code 59.section #nv108_pwr_code
57#define INCLUDE_CODE 60#define INCLUDE_CODE
58#include "kernel.fuc" 61#include "kernel.fuc"
62#include "arith.fuc"
59#include "host.fuc" 63#include "host.fuc"
60#include "memx.fuc" 64#include "memx.fuc"
61#include "perf.fuc" 65#include "perf.fuc"
diff --git a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nv108.fuc.h b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nv108.fuc.h
index 986495d533dd..4d278a96b2bb 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nv108.fuc.h
+++ b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nv108.fuc.h
@@ -24,8 +24,8 @@ uint32_t nv108_pwr_data[] = {
24 0x00000000, 24 0x00000000,
25/* 0x0058: proc_list_head */ 25/* 0x0058: proc_list_head */
26 0x54534f48, 26 0x54534f48,
27 0x00000379, 27 0x00000453,
28 0x0000032a, 28 0x00000404,
29 0x00000000, 29 0x00000000,
30 0x00000000, 30 0x00000000,
31 0x00000000, 31 0x00000000,
@@ -46,8 +46,8 @@ uint32_t nv108_pwr_data[] = {
46 0x00000000, 46 0x00000000,
47 0x00000000, 47 0x00000000,
48 0x584d454d, 48 0x584d454d,
49 0x00000464, 49 0x0000061c,
50 0x00000456, 50 0x0000060e,
51 0x00000000, 51 0x00000000,
52 0x00000000, 52 0x00000000,
53 0x00000000, 53 0x00000000,
@@ -68,8 +68,8 @@ uint32_t nv108_pwr_data[] = {
68 0x00000000, 68 0x00000000,
69 0x00000000, 69 0x00000000,
70 0x46524550, 70 0x46524550,
71 0x00000468, 71 0x00000620,
72 0x00000466, 72 0x0000061e,
73 0x00000000, 73 0x00000000,
74 0x00000000, 74 0x00000000,
75 0x00000000, 75 0x00000000,
@@ -90,8 +90,8 @@ uint32_t nv108_pwr_data[] = {
90 0x00000000, 90 0x00000000,
91 0x00000000, 91 0x00000000,
92 0x5f433249, 92 0x5f433249,
93 0x0000086c, 93 0x00000a24,
94 0x00000713, 94 0x000008cb,
95 0x00000000, 95 0x00000000,
96 0x00000000, 96 0x00000000,
97 0x00000000, 97 0x00000000,
@@ -112,8 +112,8 @@ uint32_t nv108_pwr_data[] = {
112 0x00000000, 112 0x00000000,
113 0x00000000, 113 0x00000000,
114 0x54534554, 114 0x54534554,
115 0x0000088d, 115 0x00000a45,
116 0x0000086e, 116 0x00000a26,
117 0x00000000, 117 0x00000000,
118 0x00000000, 118 0x00000000,
119 0x00000000, 119 0x00000000,
@@ -134,8 +134,8 @@ uint32_t nv108_pwr_data[] = {
134 0x00000000, 134 0x00000000,
135 0x00000000, 135 0x00000000,
136 0x454c4449, 136 0x454c4449,
137 0x00000898, 137 0x00000a50,
138 0x00000896, 138 0x00000a4e,
139 0x00000000, 139 0x00000000,
140 0x00000000, 140 0x00000000,
141 0x00000000, 141 0x00000000,
@@ -227,25 +227,31 @@ uint32_t nv108_pwr_data[] = {
227 0x00000000, 227 0x00000000,
228 0x00000000, 228 0x00000000,
229/* 0x0370: memx_func_head */ 229/* 0x0370: memx_func_head */
230 0x00010000,
231 0x00000000,
232 0x000003a9,
233/* 0x037c: memx_func_next */
234 0x00000001, 230 0x00000001,
235 0x00000000, 231 0x00000000,
236 0x000003c7, 232 0x00000483,
233/* 0x037c: memx_func_next */
237 0x00000002, 234 0x00000002,
235 0x00000000,
236 0x00000500,
237 0x00000003,
238 0x00000002, 238 0x00000002,
239 0x000003df, 239 0x00000580,
240 0x00040003, 240 0x00040004,
241 0x00000000,
242 0x0000059d,
243 0x00010005,
244 0x00000000,
245 0x000005b7,
246 0x00010006,
241 0x00000000, 247 0x00000000,
242 0x000003fc, 248 0x0000057b,
243 0x00010004, 249/* 0x03b8: memx_func_tail */
250/* 0x03b8: memx_ts_start */
244 0x00000000, 251 0x00000000,
245 0x00000416, 252/* 0x03bc: memx_ts_end */
246/* 0x03ac: memx_func_tail */
247/* 0x03ac: memx_data_head */
248 0x00000000, 253 0x00000000,
254/* 0x03c0: memx_data_head */
249 0x00000000, 255 0x00000000,
250 0x00000000, 256 0x00000000,
251 0x00000000, 257 0x00000000,
@@ -757,8 +763,9 @@ uint32_t nv108_pwr_data[] = {
757 0x00000000, 763 0x00000000,
758 0x00000000, 764 0x00000000,
759 0x00000000, 765 0x00000000,
760/* 0x0bac: memx_data_tail */ 766 0x00000000,
761/* 0x0bac: i2c_scl_map */ 767/* 0x0bc0: memx_data_tail */
768/* 0x0bc0: i2c_scl_map */
762 0x00000400, 769 0x00000400,
763 0x00000800, 770 0x00000800,
764 0x00001000, 771 0x00001000,
@@ -769,7 +776,7 @@ uint32_t nv108_pwr_data[] = {
769 0x00020000, 776 0x00020000,
770 0x00040000, 777 0x00040000,
771 0x00080000, 778 0x00080000,
772/* 0x0bd4: i2c_sda_map */ 779/* 0x0be8: i2c_sda_map */
773 0x00100000, 780 0x00100000,
774 0x00200000, 781 0x00200000,
775 0x00400000, 782 0x00400000,
@@ -781,10 +788,69 @@ uint32_t nv108_pwr_data[] = {
781 0x10000000, 788 0x10000000,
782 0x20000000, 789 0x20000000,
783 0x00000000, 790 0x00000000,
791 0x00000000,
792 0x00000000,
793 0x00000000,
794 0x00000000,
795 0x00000000,
796 0x00000000,
797 0x00000000,
798 0x00000000,
799 0x00000000,
800 0x00000000,
801 0x00000000,
802 0x00000000,
803 0x00000000,
804 0x00000000,
805 0x00000000,
806 0x00000000,
807 0x00000000,
808 0x00000000,
809 0x00000000,
810 0x00000000,
811 0x00000000,
812 0x00000000,
813 0x00000000,
814 0x00000000,
815 0x00000000,
816 0x00000000,
817 0x00000000,
818 0x00000000,
819 0x00000000,
820 0x00000000,
821 0x00000000,
822 0x00000000,
823 0x00000000,
824 0x00000000,
825 0x00000000,
826 0x00000000,
827 0x00000000,
828 0x00000000,
829 0x00000000,
830 0x00000000,
831 0x00000000,
832 0x00000000,
833 0x00000000,
834 0x00000000,
835 0x00000000,
836 0x00000000,
837 0x00000000,
838 0x00000000,
839 0x00000000,
840 0x00000000,
841 0x00000000,
842 0x00000000,
843 0x00000000,
844 0x00000000,
845 0x00000000,
846 0x00000000,
847 0x00000000,
848 0x00000000,
849 0x00000000,
784}; 850};
785 851
786uint32_t nv108_pwr_code[] = { 852uint32_t nv108_pwr_code[] = {
787 0x02910ef5, 853 0x031c0ef5,
788/* 0x0004: rd32 */ 854/* 0x0004: rd32 */
789 0xf607a040, 855 0xf607a040,
790 0x04bd000e, 856 0x04bd000e,
@@ -812,15 +878,18 @@ uint32_t nv108_pwr_code[] = {
812 0x7000d4f1, 878 0x7000d4f1,
813 0xf8f61bf4, 879 0xf8f61bf4,
814/* 0x005d: nsec */ 880/* 0x005d: nsec */
815 0xcf2c0800, 881 0xf990f900,
816/* 0x0062: nsec_loop */ 882 0xcf2c0880,
883/* 0x0066: nsec_loop */
817 0x2c090088, 884 0x2c090088,
818 0xbb0099cf, 885 0xbb0099cf,
819 0x9ea60298, 886 0x9ea60298,
820 0xf8f61ef4, 887 0xfcf61ef4,
821/* 0x0071: wait */ 888 0xf890fc80,
822 0xcf2c0800, 889/* 0x0079: wait */
823/* 0x0076: wait_loop */ 890 0xf990f900,
891 0xcf2c0880,
892/* 0x0082: wait_loop */
824 0xeeb20088, 893 0xeeb20088,
825 0x0000047e, 894 0x0000047e,
826 0xadfddab2, 895 0xadfddab2,
@@ -828,28 +897,29 @@ uint32_t nv108_pwr_code[] = {
828 0x2c09100b, 897 0x2c09100b,
829 0xbb0099cf, 898 0xbb0099cf,
830 0x9ba60298, 899 0x9ba60298,
831/* 0x0093: wait_done */ 900/* 0x009f: wait_done */
832 0xf8e61ef4, 901 0xfce61ef4,
833/* 0x0095: intr_watchdog */ 902 0xf890fc80,
903/* 0x00a5: intr_watchdog */
834 0x03e99800, 904 0x03e99800,
835 0xf40096b0, 905 0xf40096b0,
836 0x0a98280b, 906 0x0a98280b,
837 0x029abb9a, 907 0x029abb9a,
838 0x0d0e1cf4, 908 0x0d0e1cf4,
839 0x01de7e01, 909 0x02617e01,
840 0xf494bd00, 910 0xf494bd00,
841/* 0x00b2: intr_watchdog_next_time */ 911/* 0x00c2: intr_watchdog_next_time */
842 0x0a98140e, 912 0x0a98140e,
843 0x00a6b09b, 913 0x00a6b09b,
844 0xa6080bf4, 914 0xa6080bf4,
845 0x061cf49a, 915 0x061cf49a,
846/* 0x00c0: intr_watchdog_next_time_set */ 916/* 0x00d0: intr_watchdog_next_time_set */
847/* 0x00c3: intr_watchdog_next_proc */ 917/* 0x00d3: intr_watchdog_next_proc */
848 0xb59b09b5, 918 0xb59b09b5,
849 0xe0b603e9, 919 0xe0b603e9,
850 0x68e6b158, 920 0x68e6b158,
851 0xc81bf402, 921 0xc81bf402,
852/* 0x00d2: intr */ 922/* 0x00e2: intr */
853 0x00f900f8, 923 0x00f900f8,
854 0x80f904bd, 924 0x80f904bd,
855 0xa0f990f9, 925 0xa0f990f9,
@@ -865,13 +935,13 @@ uint32_t nv108_pwr_code[] = {
865 0xc40088cf, 935 0xc40088cf,
866 0x0bf40289, 936 0x0bf40289,
867 0x9b00b51f, 937 0x9b00b51f,
868 0x957e580e, 938 0xa57e580e,
869 0x09980000, 939 0x09980000,
870 0x0096b09b, 940 0x0096b09b,
871 0x000d0bf4, 941 0x000d0bf4,
872 0x0009f634, 942 0x0009f634,
873 0x09b504bd, 943 0x09b504bd,
874/* 0x0125: intr_skip_watchdog */ 944/* 0x0135: intr_skip_watchdog */
875 0x0089e49a, 945 0x0089e49a,
876 0x360bf408, 946 0x360bf408,
877 0xcf068849, 947 0xcf068849,
@@ -881,20 +951,20 @@ uint32_t nv108_pwr_code[] = {
881 0xc0f900cc, 951 0xc0f900cc,
882 0xf14f484e, 952 0xf14f484e,
883 0x0d5453e3, 953 0x0d5453e3,
884 0x023f7e00, 954 0x02c27e00,
885 0x40c0fc00, 955 0x40c0fc00,
886 0x0cf604c0, 956 0x0cf604c0,
887/* 0x0157: intr_subintr_skip_fifo */ 957/* 0x0167: intr_subintr_skip_fifo */
888 0x4004bd00, 958 0x4004bd00,
889 0x09f60688, 959 0x09f60688,
890/* 0x015f: intr_skip_subintr */ 960/* 0x016f: intr_skip_subintr */
891 0xc404bd00, 961 0xc404bd00,
892 0x0bf42089, 962 0x0bf42089,
893 0xbfa4f107, 963 0xbfa4f107,
894/* 0x0169: intr_skip_pause */ 964/* 0x0179: intr_skip_pause */
895 0x4089c4ff, 965 0x4089c4ff,
896 0xf1070bf4, 966 0xf1070bf4,
897/* 0x0173: intr_skip_user0 */ 967/* 0x0183: intr_skip_user0 */
898 0x00ffbfa4, 968 0x00ffbfa4,
899 0x0008f604, 969 0x0008f604,
900 0x80fc04bd, 970 0x80fc04bd,
@@ -904,304 +974,417 @@ uint32_t nv108_pwr_code[] = {
904 0xfca0fcb0, 974 0xfca0fcb0,
905 0xfc80fc90, 975 0xfc80fc90,
906 0x0032f400, 976 0x0032f400,
907/* 0x0196: timer */ 977/* 0x01a6: ticks_from_ns */
908 0x32f401f8, 978 0xc0f901f8,
909 0x03f89810, 979 0xd7f1b0f9,
910 0xf40086b0, 980 0xd3f00144,
911 0xfeb53a1c, 981 0x7721f500,
912 0xf6380003, 982 0xe8ccec03,
983 0x00b4b003,
984 0xec120bf4,
985 0xf103e8ee,
986 0xf00144d7,
987 0x21f500d3,
988/* 0x01ce: ticks_from_ns_quit */
989 0xceb20377,
990 0xc0fcb0fc,
991/* 0x01d6: ticks_from_us */
992 0xc0f900f8,
993 0xd7f1b0f9,
994 0xd3f00144,
995 0x7721f500,
996 0xb0ceb203,
997 0x0bf400b4,
998/* 0x01ef: ticks_from_us_quit */
999 0xfce4bd05,
1000 0xf8c0fcb0,
1001/* 0x01f5: ticks_to_us */
1002 0x44d7f100,
1003 0x00d3f001,
1004 0xf8ecedff,
1005/* 0x0201: timer */
1006 0xf990f900,
1007 0x1032f480,
1008 0xb003f898,
1009 0x1cf40086,
1010 0x0084bd4a,
1011 0x0008f638,
1012 0x340804bd,
1013 0x980088cf,
1014 0x98bb9a09,
1015 0x00e9bb02,
1016 0x0803feb5,
1017 0x0088cf08,
1018 0xf40284f0,
1019 0x34081c1b,
1020 0xa60088cf,
1021 0x080bf4e0,
1022 0x1cf4e8a6,
1023/* 0x0245: timer_reset */
1024 0xf634000d,
1025 0x04bd000e,
1026/* 0x024f: timer_enable */
1027 0x089a0eb5,
1028 0xf6380001,
913 0x04bd0008, 1029 0x04bd0008,
914 0x88cf0808, 1030/* 0x0258: timer_done */
915 0x0284f000, 1031 0xfc1031f4,
916 0x081c1bf4, 1032 0xf890fc80,
917 0x0088cf34, 1033/* 0x0261: send_proc */
918 0x0bf4e0a6, 1034 0xf980f900,
919 0xf4e8a608, 1035 0x05e89890,
920/* 0x01c6: timer_reset */ 1036 0xf004e998,
921 0x3400161e, 1037 0x89a60486,
922 0xbd000ef6, 1038 0xc42a0bf4,
923 0x9a0eb504, 1039 0x88940398,
924/* 0x01d0: timer_enable */ 1040 0x1880b604,
925 0x38000108, 1041 0x98008ebb,
926 0xbd0008f6, 1042 0x8ab500fa,
927/* 0x01d9: timer_done */ 1043 0x018db500,
928 0x1031f404, 1044 0xb5028cb5,
929/* 0x01de: send_proc */ 1045 0x90b6038b,
930 0x80f900f8, 1046 0x0794f001,
931 0xe89890f9, 1047 0xf404e9b5,
932 0x04e99805, 1048/* 0x029a: send_done */
933 0xa60486f0, 1049 0x90fc0231,
934 0x2a0bf489, 1050 0x00f880fc,
935 0x940398c4, 1051/* 0x02a0: find */
936 0x80b60488, 1052 0x580880f9,
937 0x008ebb18, 1053/* 0x02a7: find_loop */
938 0xb500fa98, 1054 0x980131f4,
939 0x8db5008a, 1055 0xaea6008a,
940 0x028cb501, 1056 0xb6100bf4,
941 0xb6038bb5, 1057 0x86b15880,
942 0x94f00190, 1058 0x1bf40268,
943 0x04e9b507, 1059 0x0132f4f1,
944/* 0x0217: send_done */ 1060/* 0x02bc: find_done */
945 0xfc0231f4, 1061 0x80fc8eb2,
946 0xf880fc90, 1062/* 0x02c2: send */
947/* 0x021d: find */ 1063 0xa07e00f8,
948 0x0880f900, 1064 0x01f40002,
949 0x0131f458, 1065/* 0x02cb: recv */
950/* 0x0224: find_loop */ 1066 0xf900f89b,
951 0xa6008a98, 1067 0x9880f990,
952 0x100bf4ae, 1068 0xe99805e8,
953 0xb15880b6, 1069 0x0132f404,
954 0xf4026886, 1070 0x0bf489a6,
955 0x32f4f11b, 1071 0x0389c43c,
956/* 0x0239: find_done */ 1072 0xf00180b6,
957 0xfc8eb201, 1073 0xe8b50784,
958/* 0x023f: send */ 1074 0x02ea9805,
959 0x7e00f880, 1075 0x8ffef0f9,
960 0xf400021d, 1076 0xb2f0f901,
961 0x00f89b01, 1077 0x049994ef,
962/* 0x0248: recv */ 1078 0xb600e9bb,
963 0x9805e898, 1079 0xeb9818e0,
964 0x32f404e9, 1080 0x02ec9803,
965 0xf489a601, 1081 0x9801ed98,
966 0x89c43c0b, 1082 0xa5f900ee,
967 0x0180b603, 1083 0xf8fef0fc,
968 0xb50784f0, 1084 0x0131f400,
969 0xea9805e8, 1085/* 0x0316: recv_done */
970 0xfef0f902, 1086 0x80fcf0fc,
971 0xf0f9018f, 1087 0x00f890fc,
972 0x9994efb2, 1088/* 0x031c: init */
973 0x00e9bb04, 1089 0xcf010841,
974 0x9818e0b6, 1090 0x11e70011,
975 0xec9803eb, 1091 0x14b60109,
976 0x01ed9802, 1092 0x0014fe08,
977 0xf900ee98, 1093 0xf000e041,
978 0xfef0fca5, 1094 0x1c000013,
979 0x31f400f8,
980/* 0x028f: recv_done */
981 0xf8f0fc01,
982/* 0x0291: init */
983 0x01084100,
984 0xe70011cf,
985 0xb6010911,
986 0x14fe0814,
987 0x00e04100,
988 0x000013f0,
989 0x0001f61c,
990 0xff0104bd,
991 0x01f61400,
992 0x0104bd00,
993 0x0015f102,
994 0xf6100008,
995 0x04bd0001,
996 0xf000d241,
997 0x10fe0013,
998 0x1031f400,
999 0x38000101,
1000 0xbd0001f6, 1095 0xbd0001f6,
1001/* 0x02db: init_proc */ 1096 0x00ff0104,
1002 0x98580f04, 1097 0x0001f614,
1003 0x16b001f1, 1098 0x020104bd,
1004 0xfa0bf400, 1099 0x080015f1,
1005 0xf0b615f9, 1100 0x01f61000,
1006 0xf20ef458,
1007/* 0x02ec: host_send */
1008 0xcf04b041,
1009 0xa0420011,
1010 0x0022cf04,
1011 0x0bf412a6,
1012 0x071ec42e,
1013 0xb704ee94,
1014 0x980270e0,
1015 0xec9803eb,
1016 0x01ed9802,
1017 0x7e00ee98,
1018 0xb600023f,
1019 0x1ec40110,
1020 0x04b0400f,
1021 0xbd000ef6,
1022 0xc70ef404,
1023/* 0x0328: host_send_done */
1024/* 0x032a: host_recv */
1025 0x494100f8,
1026 0x5413f14e,
1027 0xf4e1a652,
1028/* 0x0336: host_recv_wait */
1029 0xcc41b90b,
1030 0x0011cf04,
1031 0xcf04c842,
1032 0x16f00022,
1033 0xf412a608,
1034 0x23c4ef0b,
1035 0x0434b607,
1036 0x02f030b7,
1037 0xb5033bb5,
1038 0x3db5023c,
1039 0x003eb501,
1040 0xf00120b6,
1041 0xc8400f24,
1042 0x0002f604,
1043 0x400204bd,
1044 0x02f60000,
1045 0xf804bd00,
1046/* 0x0379: host_init */
1047 0x00804100,
1048 0xf11014b6,
1049 0x40027015,
1050 0x01f604d0,
1051 0x4104bd00, 1101 0x4104bd00,
1102 0x13f000e2,
1103 0x0010fe00,
1104 0x011031f4,
1105 0xf6380001,
1106 0x04bd0001,
1107/* 0x0366: init_proc */
1108 0xf198580f,
1109 0x0016b001,
1110 0xf9fa0bf4,
1111 0x58f0b615,
1112/* 0x0377: mulu32_32_64 */
1113 0xf9f20ef4,
1114 0xf920f910,
1115 0x9540f930,
1116 0xd29510e1,
1117 0xbdc4bd10,
1118 0xc0edffb4,
1119 0xb2301dff,
1120 0xff34f134,
1121 0x1034b6ff,
1122 0xbb1045b6,
1123 0xb4bb00c3,
1124 0x30e2ff01,
1125 0x34f134b2,
1126 0x34b6ffff,
1127 0x1045b610,
1128 0xbb00c3bb,
1129 0x12ff01b4,
1130 0x00b3bb30,
1131 0x30fc40fc,
1132 0x10fc20fc,
1133/* 0x03c6: host_send */
1134 0xb04100f8,
1135 0x0011cf04,
1136 0xcf04a042,
1137 0x12a60022,
1138 0xc42e0bf4,
1139 0xee94071e,
1140 0x70e0b704,
1141 0x03eb9802,
1142 0x9802ec98,
1143 0xee9801ed,
1144 0x02c27e00,
1145 0x0110b600,
1146 0x400f1ec4,
1147 0x0ef604b0,
1148 0xf404bd00,
1149/* 0x0402: host_send_done */
1150 0x00f8c70e,
1151/* 0x0404: host_recv */
1152 0xf14e4941,
1153 0xa6525413,
1154 0xb90bf4e1,
1155/* 0x0410: host_recv_wait */
1156 0xcf04cc41,
1157 0xc8420011,
1158 0x0022cf04,
1159 0xa60816f0,
1160 0xef0bf412,
1161 0xb60723c4,
1162 0x30b70434,
1163 0x3bb502f0,
1164 0x023cb503,
1165 0xb5013db5,
1166 0x20b6003e,
1167 0x0f24f001,
1168 0xf604c840,
1169 0x04bd0002,
1170 0x00004002,
1171 0xbd0002f6,
1172/* 0x0453: host_init */
1173 0x4100f804,
1052 0x14b60080, 1174 0x14b60080,
1053 0xf015f110, 1175 0x7015f110,
1054 0x04dc4002, 1176 0x04d04002,
1177 0xbd0001f6,
1178 0x00804104,
1179 0xf11014b6,
1180 0x4002f015,
1181 0x01f604dc,
1182 0x0104bd00,
1183 0x04c44001,
1055 0xbd0001f6, 1184 0xbd0001f6,
1056 0x40010104, 1185/* 0x0483: memx_func_enter */
1057 0x01f604c4, 1186 0xf100f804,
1058 0xf804bd00, 1187 0xf1162067,
1059/* 0x03a9: memx_func_enter */ 1188 0xf1f55d77,
1060 0x40040600, 1189 0xb2ffff73,
1061 0x06f607e0, 1190 0x00047e6e,
1062/* 0x03b3: memx_func_enter_wait */ 1191 0xfdd8b200,
1063 0x4604bd00, 1192 0x60f90487,
1064 0x66cf07c0, 1193 0xd0fc80f9,
1065 0x0464f000, 1194 0x2e7ee0fc,
1066 0x98f70bf4, 1195 0x77f10000,
1067 0x10b60016, 1196 0x73f1fffe,
1068/* 0x03c7: memx_func_leave */ 1197 0x6eb2ffff,
1069 0x0600f804, 1198 0x0000047e,
1070 0x07e44004, 1199 0x87fdd8b2,
1071 0xbd0006f6, 1200 0xf960f904,
1072/* 0x03d1: memx_func_leave_wait */ 1201 0xfcd0fc80,
1073 0x07c04604, 1202 0x002e7ee0,
1074 0xf00066cf, 1203 0xf067f100,
1075 0x1bf40464, 1204 0x7e6eb226,
1076/* 0x03df: memx_func_wr32 */ 1205 0xb2000004,
1077 0x9800f8f7, 1206 0x0487fdd8,
1078 0x15980016, 1207 0x80f960f9,
1079 0x0810b601,
1080 0x50f960f9,
1081 0xe0fcd0fc, 1208 0xe0fcd0fc,
1082 0x00002e7e, 1209 0x00002e7e,
1083 0xf40242b6, 1210 0xe0400406,
1084 0x00f8e81b, 1211 0x0006f607,
1085/* 0x03fc: memx_func_wait */ 1212/* 0x04ea: memx_func_enter_wait */
1086 0x88cf2c08, 1213 0xc04604bd,
1087 0x001e9800, 1214 0x0066cf07,
1088 0x98011d98, 1215 0xf40464f0,
1089 0x1b98021c, 1216 0x2c06f70b,
1090 0x1010b603, 1217 0xb50066cf,
1091 0x0000717e, 1218 0x00f8ee06,
1092/* 0x0416: memx_func_delay */ 1219/* 0x0500: memx_func_leave */
1093 0x1e9800f8, 1220 0x66cf2c06,
1094 0x0410b600, 1221 0xef06b500,
1095 0x00005d7e, 1222 0xe4400406,
1096/* 0x0422: memx_exec */ 1223 0x0006f607,
1097 0xe0f900f8, 1224/* 0x0512: memx_func_leave_wait */
1098 0xc1b2d0f9, 1225 0xc04604bd,
1099/* 0x042a: memx_exec_next */ 1226 0x0066cf07,
1100 0x1398b2b2, 1227 0xf40464f0,
1101 0x0410b600, 1228 0x67f1f71b,
1102 0xf0103495, 1229 0x77f126f0,
1103 0x35980c30, 1230 0x73f00001,
1104 0xa655f9de, 1231 0x7e6eb200,
1105 0xed1ef412, 1232 0xb2000004,
1233 0x0587fdd8,
1234 0x80f960f9,
1106 0xe0fcd0fc, 1235 0xe0fcd0fc,
1107 0x00023f7e, 1236 0x00002e7e,
1108/* 0x044a: memx_info */ 1237 0x162067f1,
1109 0xac4c00f8, 1238 0x047e6eb2,
1239 0xd8b20000,
1240 0xf90587fd,
1241 0xfc80f960,
1242 0x7ee0fcd0,
1243 0xf100002e,
1244 0xf00aa277,
1245 0x6eb20073,
1246 0x0000047e,
1247 0x87fdd8b2,
1248 0xf960f905,
1249 0xfcd0fc80,
1250 0x002e7ee0,
1251/* 0x057b: memx_func_wait_vblank */
1252 0xb600f800,
1253 0x00f80410,
1254/* 0x0580: memx_func_wr32 */
1255 0x98001698,
1256 0x10b60115,
1257 0xf960f908,
1258 0xfcd0fc50,
1259 0x002e7ee0,
1260 0x0242b600,
1261 0xf8e81bf4,
1262/* 0x059d: memx_func_wait */
1263 0xcf2c0800,
1264 0x1e980088,
1265 0x011d9800,
1266 0x98021c98,
1267 0x10b6031b,
1268 0x00797e10,
1269/* 0x05b7: memx_func_delay */
1270 0x9800f800,
1271 0x10b6001e,
1272 0x005d7e04,
1273/* 0x05c3: memx_exec */
1274 0xf900f800,
1275 0xb2d0f9e0,
1276/* 0x05cb: memx_exec_next */
1277 0x98b2b2c1,
1278 0x10b60013,
1279 0xf034e704,
1280 0xe033e701,
1281 0x0132b601,
1282 0x980c30f0,
1283 0x55f9de35,
1284 0x1ef412a6,
1285 0xee0b98e5,
1286 0xbbef0c98,
1287 0xc44b02cb,
1288 0x00bbcf07,
1289 0xe0fcd0fc,
1290 0x0002c27e,
1291/* 0x0602: memx_info */
1292 0xc04c00f8,
1110 0x08004b03, 1293 0x08004b03,
1111 0x00023f7e, 1294 0x0002c27e,
1112/* 0x0456: memx_recv */ 1295/* 0x060e: memx_recv */
1113 0xd6b000f8, 1296 0xd6b000f8,
1114 0xc90bf401, 1297 0xb20bf401,
1115 0xf400d6b0, 1298 0xf400d6b0,
1116 0x00f8eb0b, 1299 0x00f8eb0b,
1117/* 0x0464: memx_init */ 1300/* 0x061c: memx_init */
1118/* 0x0466: perf_recv */ 1301/* 0x061e: perf_recv */
1119 0x00f800f8, 1302 0x00f800f8,
1120/* 0x0468: perf_init */ 1303/* 0x0620: perf_init */
1121/* 0x046a: i2c_drive_scl */ 1304/* 0x0622: i2c_drive_scl */
1122 0x36b000f8, 1305 0x36b000f8,
1123 0x0d0bf400, 1306 0x0d0bf400,
1124 0xf607e040, 1307 0xf607e040,
1125 0x04bd0001, 1308 0x04bd0001,
1126/* 0x047a: i2c_drive_scl_lo */ 1309/* 0x0632: i2c_drive_scl_lo */
1127 0xe44000f8, 1310 0xe44000f8,
1128 0x0001f607, 1311 0x0001f607,
1129 0x00f804bd, 1312 0x00f804bd,
1130/* 0x0484: i2c_drive_sda */ 1313/* 0x063c: i2c_drive_sda */
1131 0xf40036b0, 1314 0xf40036b0,
1132 0xe0400d0b, 1315 0xe0400d0b,
1133 0x0002f607, 1316 0x0002f607,
1134 0x00f804bd, 1317 0x00f804bd,
1135/* 0x0494: i2c_drive_sda_lo */ 1318/* 0x064c: i2c_drive_sda_lo */
1136 0xf607e440, 1319 0xf607e440,
1137 0x04bd0002, 1320 0x04bd0002,
1138/* 0x049e: i2c_sense_scl */ 1321/* 0x0656: i2c_sense_scl */
1139 0x32f400f8, 1322 0x32f400f8,
1140 0x07c44301, 1323 0x07c44301,
1141 0xfd0033cf, 1324 0xfd0033cf,
1142 0x0bf40431, 1325 0x0bf40431,
1143 0x0131f406, 1326 0x0131f406,
1144/* 0x04b0: i2c_sense_scl_done */ 1327/* 0x0668: i2c_sense_scl_done */
1145/* 0x04b2: i2c_sense_sda */ 1328/* 0x066a: i2c_sense_sda */
1146 0x32f400f8, 1329 0x32f400f8,
1147 0x07c44301, 1330 0x07c44301,
1148 0xfd0033cf, 1331 0xfd0033cf,
1149 0x0bf40432, 1332 0x0bf40432,
1150 0x0131f406, 1333 0x0131f406,
1151/* 0x04c4: i2c_sense_sda_done */ 1334/* 0x067c: i2c_sense_sda_done */
1152/* 0x04c6: i2c_raise_scl */ 1335/* 0x067e: i2c_raise_scl */
1153 0x40f900f8, 1336 0x40f900f8,
1154 0x03089844, 1337 0x03089844,
1155 0x046a7e01, 1338 0x06227e01,
1156/* 0x04d1: i2c_raise_scl_wait */ 1339/* 0x0689: i2c_raise_scl_wait */
1157 0x03e84e00, 1340 0x03e84e00,
1158 0x00005d7e, 1341 0x00005d7e,
1159 0x00049e7e, 1342 0x0006567e,
1160 0xb60901f4, 1343 0xb60901f4,
1161 0x1bf40142, 1344 0x1bf40142,
1162/* 0x04e5: i2c_raise_scl_done */ 1345/* 0x069d: i2c_raise_scl_done */
1163 0xf840fcef, 1346 0xf840fcef,
1164/* 0x04e9: i2c_start */ 1347/* 0x06a1: i2c_start */
1165 0x049e7e00, 1348 0x06567e00,
1166 0x0d11f400, 1349 0x0d11f400,
1167 0x0004b27e, 1350 0x00066a7e,
1168 0xf40611f4, 1351 0xf40611f4,
1169/* 0x04fa: i2c_start_rep */ 1352/* 0x06b2: i2c_start_rep */
1170 0x00032e0e, 1353 0x00032e0e,
1171 0x00046a7e, 1354 0x0006227e,
1172 0x847e0103, 1355 0x3c7e0103,
1173 0x76bb0004, 1356 0x76bb0006,
1174 0x0465b600, 1357 0x0465b600,
1175 0x659450f9, 1358 0x659450f9,
1176 0x0256bb04, 1359 0x0256bb04,
1177 0x75fd50bd, 1360 0x75fd50bd,
1178 0x7e50fc04, 1361 0x7e50fc04,
1179 0xb60004c6, 1362 0xb600067e,
1180 0x11f40464, 1363 0x11f40464,
1181/* 0x0525: i2c_start_send */ 1364/* 0x06dd: i2c_start_send */
1182 0x7e00031d, 1365 0x7e00031d,
1183 0x4e000484, 1366 0x4e00063c,
1184 0x5d7e1388, 1367 0x5d7e1388,
1185 0x00030000, 1368 0x00030000,
1186 0x00046a7e, 1369 0x0006227e,
1187 0x7e13884e, 1370 0x7e13884e,
1188/* 0x053f: i2c_start_out */ 1371/* 0x06f7: i2c_start_out */
1189 0xf800005d, 1372 0xf800005d,
1190/* 0x0541: i2c_stop */ 1373/* 0x06f9: i2c_stop */
1191 0x7e000300, 1374 0x7e000300,
1192 0x0300046a, 1375 0x03000622,
1193 0x04847e00, 1376 0x063c7e00,
1194 0x03e84e00, 1377 0x03e84e00,
1195 0x00005d7e, 1378 0x00005d7e,
1196 0x6a7e0103, 1379 0x227e0103,
1197 0x884e0004, 1380 0x884e0006,
1198 0x005d7e13, 1381 0x005d7e13,
1199 0x7e010300, 1382 0x7e010300,
1200 0x4e000484, 1383 0x4e00063c,
1201 0x5d7e1388, 1384 0x5d7e1388,
1202 0x00f80000, 1385 0x00f80000,
1203/* 0x0570: i2c_bitw */ 1386/* 0x0728: i2c_bitw */
1204 0x0004847e, 1387 0x00063c7e,
1205 0x7e03e84e, 1388 0x7e03e84e,
1206 0xbb00005d, 1389 0xbb00005d,
1207 0x65b60076, 1390 0x65b60076,
@@ -1209,44 +1392,44 @@ uint32_t nv108_pwr_code[] = {
1209 0x56bb0465, 1392 0x56bb0465,
1210 0xfd50bd02, 1393 0xfd50bd02,
1211 0x50fc0475, 1394 0x50fc0475,
1212 0x0004c67e, 1395 0x00067e7e,
1213 0xf40464b6, 1396 0xf40464b6,
1214 0x884e1711, 1397 0x884e1711,
1215 0x005d7e13, 1398 0x005d7e13,
1216 0x7e000300, 1399 0x7e000300,
1217 0x4e00046a, 1400 0x4e000622,
1218 0x5d7e1388, 1401 0x5d7e1388,
1219/* 0x05ae: i2c_bitw_out */ 1402/* 0x0766: i2c_bitw_out */
1220 0x00f80000, 1403 0x00f80000,
1221/* 0x05b0: i2c_bitr */ 1404/* 0x0768: i2c_bitr */
1222 0x847e0103, 1405 0x3c7e0103,
1223 0xe84e0004, 1406 0xe84e0006,
1224 0x005d7e03, 1407 0x005d7e03,
1225 0x0076bb00, 1408 0x0076bb00,
1226 0xf90465b6, 1409 0xf90465b6,
1227 0x04659450, 1410 0x04659450,
1228 0xbd0256bb, 1411 0xbd0256bb,
1229 0x0475fd50, 1412 0x0475fd50,
1230 0xc67e50fc, 1413 0x7e7e50fc,
1231 0x64b60004, 1414 0x64b60006,
1232 0x1a11f404, 1415 0x1a11f404,
1233 0x0004b27e, 1416 0x00066a7e,
1234 0x6a7e0003, 1417 0x227e0003,
1235 0x884e0004, 1418 0x884e0006,
1236 0x005d7e13, 1419 0x005d7e13,
1237 0x013cf000, 1420 0x013cf000,
1238/* 0x05f3: i2c_bitr_done */ 1421/* 0x07ab: i2c_bitr_done */
1239 0xf80131f4, 1422 0xf80131f4,
1240/* 0x05f5: i2c_get_byte */ 1423/* 0x07ad: i2c_get_byte */
1241 0x04000500, 1424 0x04000500,
1242/* 0x05f9: i2c_get_byte_next */ 1425/* 0x07b1: i2c_get_byte_next */
1243 0x0154b608, 1426 0x0154b608,
1244 0xb60076bb, 1427 0xb60076bb,
1245 0x50f90465, 1428 0x50f90465,
1246 0xbb046594, 1429 0xbb046594,
1247 0x50bd0256, 1430 0x50bd0256,
1248 0xfc0475fd, 1431 0xfc0475fd,
1249 0x05b07e50, 1432 0x07687e50,
1250 0x0464b600, 1433 0x0464b600,
1251 0xfd2a11f4, 1434 0xfd2a11f4,
1252 0x42b60553, 1435 0x42b60553,
@@ -1257,11 +1440,11 @@ uint32_t nv108_pwr_code[] = {
1257 0x0256bb04, 1440 0x0256bb04,
1258 0x75fd50bd, 1441 0x75fd50bd,
1259 0x7e50fc04, 1442 0x7e50fc04,
1260 0xb6000570, 1443 0xb6000728,
1261/* 0x0642: i2c_get_byte_done */ 1444/* 0x07fa: i2c_get_byte_done */
1262 0x00f80464, 1445 0x00f80464,
1263/* 0x0644: i2c_put_byte */ 1446/* 0x07fc: i2c_put_byte */
1264/* 0x0646: i2c_put_byte_next */ 1447/* 0x07fe: i2c_put_byte_next */
1265 0x42b60804, 1448 0x42b60804,
1266 0x3854ff01, 1449 0x3854ff01,
1267 0xb60076bb, 1450 0xb60076bb,
@@ -1269,7 +1452,7 @@ uint32_t nv108_pwr_code[] = {
1269 0xbb046594, 1452 0xbb046594,
1270 0x50bd0256, 1453 0x50bd0256,
1271 0xfc0475fd, 1454 0xfc0475fd,
1272 0x05707e50, 1455 0x07287e50,
1273 0x0464b600, 1456 0x0464b600,
1274 0xb03411f4, 1457 0xb03411f4,
1275 0x1bf40046, 1458 0x1bf40046,
@@ -1278,21 +1461,21 @@ uint32_t nv108_pwr_code[] = {
1278 0x04659450, 1461 0x04659450,
1279 0xbd0256bb, 1462 0xbd0256bb,
1280 0x0475fd50, 1463 0x0475fd50,
1281 0xb07e50fc, 1464 0x687e50fc,
1282 0x64b60005, 1465 0x64b60007,
1283 0x0f11f404, 1466 0x0f11f404,
1284 0xb00076bb, 1467 0xb00076bb,
1285 0x1bf40136, 1468 0x1bf40136,
1286 0x0132f406, 1469 0x0132f406,
1287/* 0x069c: i2c_put_byte_done */ 1470/* 0x0854: i2c_put_byte_done */
1288/* 0x069e: i2c_addr */ 1471/* 0x0856: i2c_addr */
1289 0x76bb00f8, 1472 0x76bb00f8,
1290 0x0465b600, 1473 0x0465b600,
1291 0x659450f9, 1474 0x659450f9,
1292 0x0256bb04, 1475 0x0256bb04,
1293 0x75fd50bd, 1476 0x75fd50bd,
1294 0x7e50fc04, 1477 0x7e50fc04,
1295 0xb60004e9, 1478 0xb60006a1,
1296 0x11f40464, 1479 0x11f40464,
1297 0x2ec3e729, 1480 0x2ec3e729,
1298 0x0134b601, 1481 0x0134b601,
@@ -1302,32 +1485,32 @@ uint32_t nv108_pwr_code[] = {
1302 0x56bb0465, 1485 0x56bb0465,
1303 0xfd50bd02, 1486 0xfd50bd02,
1304 0x50fc0475, 1487 0x50fc0475,
1305 0x0006447e, 1488 0x0007fc7e,
1306/* 0x06e3: i2c_addr_done */ 1489/* 0x089b: i2c_addr_done */
1307 0xf80464b6, 1490 0xf80464b6,
1308/* 0x06e5: i2c_acquire_addr */ 1491/* 0x089d: i2c_acquire_addr */
1309 0xf8cec700, 1492 0xf8cec700,
1310 0xb705e4b6, 1493 0xb705e4b6,
1311 0xf8d014e0, 1494 0xf8d014e0,
1312/* 0x06f1: i2c_acquire */ 1495/* 0x08a9: i2c_acquire */
1313 0x06e57e00, 1496 0x089d7e00,
1314 0x00047e00, 1497 0x00047e00,
1315 0x03d9f000, 1498 0x03d9f000,
1316 0x00002e7e, 1499 0x00002e7e,
1317/* 0x0702: i2c_release */ 1500/* 0x08ba: i2c_release */
1318 0xe57e00f8, 1501 0x9d7e00f8,
1319 0x047e0006, 1502 0x047e0008,
1320 0xdaf00000, 1503 0xdaf00000,
1321 0x002e7e03, 1504 0x002e7e03,
1322/* 0x0713: i2c_recv */ 1505/* 0x08cb: i2c_recv */
1323 0xf400f800, 1506 0xf400f800,
1324 0xc1c70132, 1507 0xc1c70132,
1325 0x0214b6f8, 1508 0x0214b6f8,
1326 0xf52816b0, 1509 0xf52816b0,
1327 0xb801371f, 1510 0xb801371f,
1328 0x000bd413, 1511 0x000be813,
1329 0xb8003298, 1512 0xb8003298,
1330 0x000bac13, 1513 0x000bc013,
1331 0xf4003198, 1514 0xf4003198,
1332 0xd0f90231, 1515 0xd0f90231,
1333 0xd0f9e0f9, 1516 0xd0f9e0f9,
@@ -1339,7 +1522,7 @@ uint32_t nv108_pwr_code[] = {
1339 0x56bb0465, 1522 0x56bb0465,
1340 0xfd50bd02, 1523 0xfd50bd02,
1341 0x50fc0475, 1524 0x50fc0475,
1342 0x0006f17e, 1525 0x0008a97e,
1343 0xfc0464b6, 1526 0xfc0464b6,
1344 0x00d6b0d0, 1527 0x00d6b0d0,
1345 0x00b01bf5, 1528 0x00b01bf5,
@@ -1349,7 +1532,7 @@ uint32_t nv108_pwr_code[] = {
1349 0x0256bb04, 1532 0x0256bb04,
1350 0x75fd50bd, 1533 0x75fd50bd,
1351 0x7e50fc04, 1534 0x7e50fc04,
1352 0xb600069e, 1535 0xb6000856,
1353 0x11f50464, 1536 0x11f50464,
1354 0xc5c700cc, 1537 0xc5c700cc,
1355 0x0076bbe0, 1538 0x0076bbe0,
@@ -1357,8 +1540,8 @@ uint32_t nv108_pwr_code[] = {
1357 0x04659450, 1540 0x04659450,
1358 0xbd0256bb, 1541 0xbd0256bb,
1359 0x0475fd50, 1542 0x0475fd50,
1360 0x447e50fc, 1543 0xfc7e50fc,
1361 0x64b60006, 1544 0x64b60007,
1362 0xa911f504, 1545 0xa911f504,
1363 0xbb010500, 1546 0xbb010500,
1364 0x65b60076, 1547 0x65b60076,
@@ -1366,7 +1549,7 @@ uint32_t nv108_pwr_code[] = {
1366 0x56bb0465, 1549 0x56bb0465,
1367 0xfd50bd02, 1550 0xfd50bd02,
1368 0x50fc0475, 1551 0x50fc0475,
1369 0x00069e7e, 1552 0x0008567e,
1370 0xf50464b6, 1553 0xf50464b6,
1371 0xbb008711, 1554 0xbb008711,
1372 0x65b60076, 1555 0x65b60076,
@@ -1374,7 +1557,7 @@ uint32_t nv108_pwr_code[] = {
1374 0x56bb0465, 1557 0x56bb0465,
1375 0xfd50bd02, 1558 0xfd50bd02,
1376 0x50fc0475, 1559 0x50fc0475,
1377 0x0005f57e, 1560 0x0007ad7e,
1378 0xf40464b6, 1561 0xf40464b6,
1379 0x5bcb6711, 1562 0x5bcb6711,
1380 0x0076bbe0, 1563 0x0076bbe0,
@@ -1382,37 +1565,37 @@ uint32_t nv108_pwr_code[] = {
1382 0x04659450, 1565 0x04659450,
1383 0xbd0256bb, 1566 0xbd0256bb,
1384 0x0475fd50, 1567 0x0475fd50,
1385 0x417e50fc, 1568 0xf97e50fc,
1386 0x64b60005, 1569 0x64b60006,
1387 0xbd5bb204, 1570 0xbd5bb204,
1388 0x410ef474, 1571 0x410ef474,
1389/* 0x0818: i2c_recv_not_rd08 */ 1572/* 0x09d0: i2c_recv_not_rd08 */
1390 0xf401d6b0, 1573 0xf401d6b0,
1391 0x00053b1b, 1574 0x00053b1b,
1392 0x00069e7e, 1575 0x0008567e,
1393 0xc73211f4, 1576 0xc73211f4,
1394 0x447ee0c5, 1577 0xfc7ee0c5,
1395 0x11f40006, 1578 0x11f40007,
1396 0x7e000528, 1579 0x7e000528,
1397 0xf400069e, 1580 0xf4000856,
1398 0xb5c71f11, 1581 0xb5c71f11,
1399 0x06447ee0, 1582 0x07fc7ee0,
1400 0x1511f400, 1583 0x1511f400,
1401 0x0005417e, 1584 0x0006f97e,
1402 0xc5c774bd, 1585 0xc5c774bd,
1403 0x091bf408, 1586 0x091bf408,
1404 0xf40232f4, 1587 0xf40232f4,
1405/* 0x0856: i2c_recv_not_wr08 */ 1588/* 0x0a0e: i2c_recv_not_wr08 */
1406/* 0x0856: i2c_recv_done */ 1589/* 0x0a0e: i2c_recv_done */
1407 0xcec7030e, 1590 0xcec7030e,
1408 0x07027ef8, 1591 0x08ba7ef8,
1409 0xfce0fc00, 1592 0xfce0fc00,
1410 0x0912f4d0, 1593 0x0912f4d0,
1411 0x3f7e7cb2, 1594 0xc27e7cb2,
1412/* 0x086a: i2c_recv_exit */ 1595/* 0x0a22: i2c_recv_exit */
1413 0x00f80002, 1596 0x00f80002,
1414/* 0x086c: i2c_init */ 1597/* 0x0a24: i2c_init */
1415/* 0x086e: test_recv */ 1598/* 0x0a26: test_recv */
1416 0x584100f8, 1599 0x584100f8,
1417 0x0011cf04, 1600 0x0011cf04,
1418 0x400110b6, 1601 0x400110b6,
@@ -1420,28 +1603,28 @@ uint32_t nv108_pwr_code[] = {
1420 0xf104bd00, 1603 0xf104bd00,
1421 0xf1d900e7, 1604 0xf1d900e7,
1422 0x7e134fe3, 1605 0x7e134fe3,
1423 0xf8000196, 1606 0xf8000201,
1424/* 0x088d: test_init */ 1607/* 0x0a45: test_init */
1425 0x08004e00, 1608 0x08004e00,
1426 0x0001967e, 1609 0x0002017e,
1427/* 0x0896: idle_recv */ 1610/* 0x0a4e: idle_recv */
1428 0x00f800f8, 1611 0x00f800f8,
1429/* 0x0898: idle */ 1612/* 0x0a50: idle */
1430 0x410031f4, 1613 0x410031f4,
1431 0x11cf0454, 1614 0x11cf0454,
1432 0x0110b600, 1615 0x0110b600,
1433 0xf6045440, 1616 0xf6045440,
1434 0x04bd0001, 1617 0x04bd0001,
1435/* 0x08ac: idle_loop */ 1618/* 0x0a64: idle_loop */
1436 0x32f45801, 1619 0x32f45801,
1437/* 0x08b1: idle_proc */ 1620/* 0x0a69: idle_proc */
1438/* 0x08b1: idle_proc_exec */ 1621/* 0x0a69: idle_proc_exec */
1439 0xb210f902, 1622 0xb210f902,
1440 0x02487e1e, 1623 0x02cb7e1e,
1441 0xf410fc00, 1624 0xf410fc00,
1442 0x31f40911, 1625 0x31f40911,
1443 0xf00ef402, 1626 0xf00ef402,
1444/* 0x08c4: idle_proc_next */ 1627/* 0x0a7c: idle_proc_next */
1445 0xa65810b6, 1628 0xa65810b6,
1446 0xe81bf41f, 1629 0xe81bf41f,
1447 0xf4e002f4, 1630 0xf4e002f4,
@@ -1457,4 +1640,22 @@ uint32_t nv108_pwr_code[] = {
1457 0x00000000, 1640 0x00000000,
1458 0x00000000, 1641 0x00000000,
1459 0x00000000, 1642 0x00000000,
1643 0x00000000,
1644 0x00000000,
1645 0x00000000,
1646 0x00000000,
1647 0x00000000,
1648 0x00000000,
1649 0x00000000,
1650 0x00000000,
1651 0x00000000,
1652 0x00000000,
1653 0x00000000,
1654 0x00000000,
1655 0x00000000,
1656 0x00000000,
1657 0x00000000,
1658 0x00000000,
1659 0x00000000,
1660 0x00000000,
1460}; 1661};
diff --git a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nva3.fuc b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nva3.fuc
index 6744fcc06151..daa06c1c655e 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nva3.fuc
+++ b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nva3.fuc
@@ -23,6 +23,7 @@
23 */ 23 */
24 24
25#define NVKM_PPWR_CHIPSET GT215 25#define NVKM_PPWR_CHIPSET GT215
26#define HW_TICKS_PER_US 203 // should be 202.5
26 27
27//#define NVKM_FALCON_PC24 28//#define NVKM_FALCON_PC24
28//#define NVKM_FALCON_UNSHIFTED_IO 29//#define NVKM_FALCON_UNSHIFTED_IO
@@ -34,6 +35,7 @@
34.section #nva3_pwr_data 35.section #nva3_pwr_data
35#define INCLUDE_PROC 36#define INCLUDE_PROC
36#include "kernel.fuc" 37#include "kernel.fuc"
38#include "arith.fuc"
37#include "host.fuc" 39#include "host.fuc"
38#include "memx.fuc" 40#include "memx.fuc"
39#include "perf.fuc" 41#include "perf.fuc"
@@ -44,6 +46,7 @@
44 46
45#define INCLUDE_DATA 47#define INCLUDE_DATA
46#include "kernel.fuc" 48#include "kernel.fuc"
49#include "arith.fuc"
47#include "host.fuc" 50#include "host.fuc"
48#include "memx.fuc" 51#include "memx.fuc"
49#include "perf.fuc" 52#include "perf.fuc"
@@ -56,6 +59,7 @@
56.section #nva3_pwr_code 59.section #nva3_pwr_code
57#define INCLUDE_CODE 60#define INCLUDE_CODE
58#include "kernel.fuc" 61#include "kernel.fuc"
62#include "arith.fuc"
59#include "host.fuc" 63#include "host.fuc"
60#include "memx.fuc" 64#include "memx.fuc"
61#include "perf.fuc" 65#include "perf.fuc"
diff --git a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nva3.fuc.h b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nva3.fuc.h
index e087ce3041be..64e97baabc3c 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nva3.fuc.h
+++ b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nva3.fuc.h
@@ -24,8 +24,8 @@ uint32_t nva3_pwr_data[] = {
24 0x00000000, 24 0x00000000,
25/* 0x0058: proc_list_head */ 25/* 0x0058: proc_list_head */
26 0x54534f48, 26 0x54534f48,
27 0x00000430, 27 0x00000512,
28 0x000003cd, 28 0x000004af,
29 0x00000000, 29 0x00000000,
30 0x00000000, 30 0x00000000,
31 0x00000000, 31 0x00000000,
@@ -46,8 +46,8 @@ uint32_t nva3_pwr_data[] = {
46 0x00000000, 46 0x00000000,
47 0x00000000, 47 0x00000000,
48 0x584d454d, 48 0x584d454d,
49 0x00000542, 49 0x000006e0,
50 0x00000534, 50 0x000006d2,
51 0x00000000, 51 0x00000000,
52 0x00000000, 52 0x00000000,
53 0x00000000, 53 0x00000000,
@@ -68,8 +68,8 @@ uint32_t nva3_pwr_data[] = {
68 0x00000000, 68 0x00000000,
69 0x00000000, 69 0x00000000,
70 0x46524550, 70 0x46524550,
71 0x00000546, 71 0x000006e4,
72 0x00000544, 72 0x000006e2,
73 0x00000000, 73 0x00000000,
74 0x00000000, 74 0x00000000,
75 0x00000000, 75 0x00000000,
@@ -90,8 +90,8 @@ uint32_t nva3_pwr_data[] = {
90 0x00000000, 90 0x00000000,
91 0x00000000, 91 0x00000000,
92 0x5f433249, 92 0x5f433249,
93 0x00000976, 93 0x00000b14,
94 0x00000819, 94 0x000009b7,
95 0x00000000, 95 0x00000000,
96 0x00000000, 96 0x00000000,
97 0x00000000, 97 0x00000000,
@@ -112,8 +112,8 @@ uint32_t nva3_pwr_data[] = {
112 0x00000000, 112 0x00000000,
113 0x00000000, 113 0x00000000,
114 0x54534554, 114 0x54534554,
115 0x0000099f, 115 0x00000b3d,
116 0x00000978, 116 0x00000b16,
117 0x00000000, 117 0x00000000,
118 0x00000000, 118 0x00000000,
119 0x00000000, 119 0x00000000,
@@ -134,8 +134,8 @@ uint32_t nva3_pwr_data[] = {
134 0x00000000, 134 0x00000000,
135 0x00000000, 135 0x00000000,
136 0x454c4449, 136 0x454c4449,
137 0x000009ab, 137 0x00000b49,
138 0x000009a9, 138 0x00000b47,
139 0x00000000, 139 0x00000000,
140 0x00000000, 140 0x00000000,
141 0x00000000, 141 0x00000000,
@@ -227,25 +227,31 @@ uint32_t nva3_pwr_data[] = {
227 0x00000000, 227 0x00000000,
228 0x00000000, 228 0x00000000,
229/* 0x0370: memx_func_head */ 229/* 0x0370: memx_func_head */
230 0x00010000,
231 0x00000000,
232 0x0000046f,
233/* 0x037c: memx_func_next */
234 0x00000001, 230 0x00000001,
235 0x00000000, 231 0x00000000,
236 0x00000496, 232 0x00000551,
233/* 0x037c: memx_func_next */
237 0x00000002, 234 0x00000002,
235 0x00000000,
236 0x000005a8,
237 0x00000003,
238 0x00000002, 238 0x00000002,
239 0x000004b7, 239 0x0000063a,
240 0x00040003, 240 0x00040004,
241 0x00000000,
242 0x00000656,
243 0x00010005,
244 0x00000000,
245 0x00000673,
246 0x00010006,
241 0x00000000, 247 0x00000000,
242 0x000004d3, 248 0x000005f8,
243 0x00010004, 249/* 0x03b8: memx_func_tail */
250/* 0x03b8: memx_ts_start */
244 0x00000000, 251 0x00000000,
245 0x000004f0, 252/* 0x03bc: memx_ts_end */
246/* 0x03ac: memx_func_tail */
247/* 0x03ac: memx_data_head */
248 0x00000000, 253 0x00000000,
254/* 0x03c0: memx_data_head */
249 0x00000000, 255 0x00000000,
250 0x00000000, 256 0x00000000,
251 0x00000000, 257 0x00000000,
@@ -757,8 +763,9 @@ uint32_t nva3_pwr_data[] = {
757 0x00000000, 763 0x00000000,
758 0x00000000, 764 0x00000000,
759 0x00000000, 765 0x00000000,
760/* 0x0bac: memx_data_tail */ 766 0x00000000,
761/* 0x0bac: i2c_scl_map */ 767/* 0x0bc0: memx_data_tail */
768/* 0x0bc0: i2c_scl_map */
762 0x00001000, 769 0x00001000,
763 0x00004000, 770 0x00004000,
764 0x00010000, 771 0x00010000,
@@ -769,7 +776,7 @@ uint32_t nva3_pwr_data[] = {
769 0x01000000, 776 0x01000000,
770 0x04000000, 777 0x04000000,
771 0x10000000, 778 0x10000000,
772/* 0x0bd4: i2c_sda_map */ 779/* 0x0be8: i2c_sda_map */
773 0x00002000, 780 0x00002000,
774 0x00008000, 781 0x00008000,
775 0x00020000, 782 0x00020000,
@@ -780,7 +787,7 @@ uint32_t nva3_pwr_data[] = {
780 0x02000000, 787 0x02000000,
781 0x08000000, 788 0x08000000,
782 0x20000000, 789 0x20000000,
783/* 0x0bfc: i2c_ctrl */ 790/* 0x0c10: i2c_ctrl */
784 0x0000e138, 791 0x0000e138,
785 0x0000e150, 792 0x0000e150,
786 0x0000e168, 793 0x0000e168,
@@ -841,15 +848,10 @@ uint32_t nva3_pwr_data[] = {
841 0x00000000, 848 0x00000000,
842 0x00000000, 849 0x00000000,
843 0x00000000, 850 0x00000000,
844 0x00000000,
845 0x00000000,
846 0x00000000,
847 0x00000000,
848 0x00000000,
849}; 851};
850 852
851uint32_t nva3_pwr_code[] = { 853uint32_t nva3_pwr_code[] = {
852 0x030d0ef5, 854 0x039e0ef5,
853/* 0x0004: rd32 */ 855/* 0x0004: rd32 */
854 0x07a007f1, 856 0x07a007f1,
855 0xd00604b6, 857 0xd00604b6,
@@ -885,19 +887,22 @@ uint32_t nva3_pwr_code[] = {
885 0xd4f100dd, 887 0xd4f100dd,
886 0x1bf47000, 888 0x1bf47000,
887/* 0x007f: nsec */ 889/* 0x007f: nsec */
888 0xf000f8f2, 890 0xf900f8f2,
891 0xf080f990,
889 0x84b62c87, 892 0x84b62c87,
890 0x0088cf06, 893 0x0088cf06,
891/* 0x0088: nsec_loop */ 894/* 0x008c: nsec_loop */
892 0xb62c97f0, 895 0xb62c97f0,
893 0x99cf0694, 896 0x99cf0694,
894 0x0298bb00, 897 0x0298bb00,
895 0xf4069eb8, 898 0xf4069eb8,
896 0x00f8f11e, 899 0x80fcf11e,
897/* 0x009c: wait */ 900 0x00f890fc,
901/* 0x00a4: wait */
902 0x80f990f9,
898 0xb62c87f0, 903 0xb62c87f0,
899 0x88cf0684, 904 0x88cf0684,
900/* 0x00a5: wait_loop */ 905/* 0x00b1: wait_loop */
901 0x02eeb900, 906 0x02eeb900,
902 0xb90421f4, 907 0xb90421f4,
903 0xadfd02da, 908 0xadfd02da,
@@ -907,28 +912,29 @@ uint32_t nva3_pwr_code[] = {
907 0x0099cf06, 912 0x0099cf06,
908 0xb80298bb, 913 0xb80298bb,
909 0x1ef4069b, 914 0x1ef4069b,
910/* 0x00c9: wait_done */ 915/* 0x00d5: wait_done */
911/* 0x00cb: intr_watchdog */ 916 0xfc80fcdf,
912 0x9800f8df, 917/* 0x00db: intr_watchdog */
918 0x9800f890,
913 0x96b003e9, 919 0x96b003e9,
914 0x2a0bf400, 920 0x2a0bf400,
915 0xbb9a0a98, 921 0xbb9a0a98,
916 0x1cf4029a, 922 0x1cf4029a,
917 0x01d7f00f, 923 0x01d7f00f,
918 0x025421f5, 924 0x02dd21f5,
919 0x0ef494bd, 925 0x0ef494bd,
920/* 0x00e9: intr_watchdog_next_time */ 926/* 0x00f9: intr_watchdog_next_time */
921 0x9b0a9815, 927 0x9b0a9815,
922 0xf400a6b0, 928 0xf400a6b0,
923 0x9ab8090b, 929 0x9ab8090b,
924 0x061cf406, 930 0x061cf406,
925/* 0x00f8: intr_watchdog_next_time_set */ 931/* 0x0108: intr_watchdog_next_time_set */
926/* 0x00fb: intr_watchdog_next_proc */ 932/* 0x010b: intr_watchdog_next_proc */
927 0x809b0980, 933 0x809b0980,
928 0xe0b603e9, 934 0xe0b603e9,
929 0x68e6b158, 935 0x68e6b158,
930 0xc61bf402, 936 0xc61bf402,
931/* 0x010a: intr */ 937/* 0x011a: intr */
932 0x00f900f8, 938 0x00f900f8,
933 0x80f904bd, 939 0x80f904bd,
934 0xa0f990f9, 940 0xa0f990f9,
@@ -948,13 +954,13 @@ uint32_t nva3_pwr_code[] = {
948 0xf40289c4, 954 0xf40289c4,
949 0x0080230b, 955 0x0080230b,
950 0x58e7f09b, 956 0x58e7f09b,
951 0x98cb21f4, 957 0x98db21f4,
952 0x96b09b09, 958 0x96b09b09,
953 0x110bf400, 959 0x110bf400,
954 0xb63407f0, 960 0xb63407f0,
955 0x09d00604, 961 0x09d00604,
956 0x8004bd00, 962 0x8004bd00,
957/* 0x016e: intr_skip_watchdog */ 963/* 0x017e: intr_skip_watchdog */
958 0x89e49a09, 964 0x89e49a09,
959 0x0bf40800, 965 0x0bf40800,
960 0x8897f148, 966 0x8897f148,
@@ -967,22 +973,22 @@ uint32_t nva3_pwr_code[] = {
967 0x48e7f1c0, 973 0x48e7f1c0,
968 0x53e3f14f, 974 0x53e3f14f,
969 0x00d7f054, 975 0x00d7f054,
970 0x02b921f5, 976 0x034221f5,
971 0x07f1c0fc, 977 0x07f1c0fc,
972 0x04b604c0, 978 0x04b604c0,
973 0x000cd006, 979 0x000cd006,
974/* 0x01ae: intr_subintr_skip_fifo */ 980/* 0x01be: intr_subintr_skip_fifo */
975 0x07f104bd, 981 0x07f104bd,
976 0x04b60688, 982 0x04b60688,
977 0x0009d006, 983 0x0009d006,
978/* 0x01ba: intr_skip_subintr */ 984/* 0x01ca: intr_skip_subintr */
979 0x89c404bd, 985 0x89c404bd,
980 0x070bf420, 986 0x070bf420,
981 0xffbfa4f1, 987 0xffbfa4f1,
982/* 0x01c4: intr_skip_pause */ 988/* 0x01d4: intr_skip_pause */
983 0xf44089c4, 989 0xf44089c4,
984 0xa4f1070b, 990 0xa4f1070b,
985/* 0x01ce: intr_skip_user0 */ 991/* 0x01de: intr_skip_user0 */
986 0x07f0ffbf, 992 0x07f0ffbf,
987 0x0604b604, 993 0x0604b604,
988 0xbd0008d0, 994 0xbd0008d0,
@@ -993,596 +999,732 @@ uint32_t nva3_pwr_code[] = {
993 0x90fca0fc, 999 0x90fca0fc,
994 0x00fc80fc, 1000 0x00fc80fc,
995 0xf80032f4, 1001 0xf80032f4,
996/* 0x01f5: timer */ 1002/* 0x0205: ticks_from_ns */
997 0x1032f401, 1003 0xf9c0f901,
998 0xb003f898, 1004 0xcbd7f1b0,
999 0x1cf40086, 1005 0x00d3f000,
1000 0x03fe8051, 1006 0x041321f5,
1007 0x03e8ccec,
1008 0xf400b4b0,
1009 0xeeec120b,
1010 0xd7f103e8,
1011 0xd3f000cb,
1012 0x1321f500,
1013/* 0x022d: ticks_from_ns_quit */
1014 0x02ceb904,
1015 0xc0fcb0fc,
1016/* 0x0236: ticks_from_us */
1017 0xc0f900f8,
1018 0xd7f1b0f9,
1019 0xd3f000cb,
1020 0x1321f500,
1021 0x02ceb904,
1022 0xf400b4b0,
1023 0xe4bd050b,
1024/* 0x0250: ticks_from_us_quit */
1025 0xc0fcb0fc,
1026/* 0x0256: ticks_to_us */
1027 0xd7f100f8,
1028 0xd3f000cb,
1029 0xecedff00,
1030/* 0x0262: timer */
1031 0x90f900f8,
1032 0x32f480f9,
1033 0x03f89810,
1034 0xf40086b0,
1035 0x84bd651c,
1001 0xb63807f0, 1036 0xb63807f0,
1002 0x08d00604, 1037 0x08d00604,
1003 0xf004bd00, 1038 0xf004bd00,
1004 0x84b60887, 1039 0x84b63487,
1005 0x0088cf06, 1040 0x0088cf06,
1006 0xf40284f0, 1041 0xbb9a0998,
1007 0x87f0261b, 1042 0xe9bb0298,
1008 0x0684b634, 1043 0x03fe8000,
1009 0xb80088cf, 1044 0xb60887f0,
1010 0x0bf406e0, 1045 0x88cf0684,
1011 0x06e8b809, 1046 0x0284f000,
1012/* 0x0233: timer_reset */ 1047 0xf0261bf4,
1013 0xf01f1ef4, 1048 0x84b63487,
1014 0x04b63407, 1049 0x0088cf06,
1015 0x000ed006, 1050 0xf406e0b8,
1016 0x0e8004bd, 1051 0xe8b8090b,
1017/* 0x0241: timer_enable */ 1052 0x111cf406,
1018 0x0187f09a, 1053/* 0x02b8: timer_reset */
1054 0xb63407f0,
1055 0x0ed00604,
1056 0x8004bd00,
1057/* 0x02c6: timer_enable */
1058 0x87f09a0e,
1059 0x3807f001,
1060 0xd00604b6,
1061 0x04bd0008,
1062/* 0x02d4: timer_done */
1063 0xfc1031f4,
1064 0xf890fc80,
1065/* 0x02dd: send_proc */
1066 0xf980f900,
1067 0x05e89890,
1068 0xf004e998,
1069 0x89b80486,
1070 0x2a0bf406,
1071 0x940398c4,
1072 0x80b60488,
1073 0x008ebb18,
1074 0x8000fa98,
1075 0x8d80008a,
1076 0x028c8001,
1077 0xb6038b80,
1078 0x94f00190,
1079 0x04e98007,
1080/* 0x0317: send_done */
1081 0xfc0231f4,
1082 0xf880fc90,
1083/* 0x031d: find */
1084 0xf080f900,
1085 0x31f45887,
1086/* 0x0325: find_loop */
1087 0x008a9801,
1088 0xf406aeb8,
1089 0x80b6100b,
1090 0x6886b158,
1091 0xf01bf402,
1092/* 0x033b: find_done */
1093 0xb90132f4,
1094 0x80fc028e,
1095/* 0x0342: send */
1096 0x21f500f8,
1097 0x01f4031d,
1098/* 0x034b: recv */
1099 0xf900f897,
1100 0x9880f990,
1101 0xe99805e8,
1102 0x0132f404,
1103 0xf40689b8,
1104 0x89c43d0b,
1105 0x0180b603,
1106 0x800784f0,
1107 0xea9805e8,
1108 0xfef0f902,
1109 0xf0f9018f,
1110 0x9402efb9,
1111 0xe9bb0499,
1112 0x18e0b600,
1113 0x9803eb98,
1114 0xed9802ec,
1115 0x00ee9801,
1116 0xf0fca5f9,
1117 0xf400f8fe,
1118 0xf0fc0131,
1119/* 0x0398: recv_done */
1120 0x90fc80fc,
1121/* 0x039e: init */
1122 0x17f100f8,
1123 0x14b60108,
1124 0x0011cf06,
1125 0x010911e7,
1126 0xfe0814b6,
1127 0x17f10014,
1128 0x13f000e0,
1129 0x1c07f000,
1130 0xd00604b6,
1131 0x04bd0001,
1132 0xf0ff17f0,
1133 0x04b61407,
1134 0x0001d006,
1135 0x17f004bd,
1136 0x0015f102,
1137 0x1007f008,
1138 0xd00604b6,
1139 0x04bd0001,
1140 0x011a17f1,
1141 0xfe0013f0,
1142 0x31f40010,
1143 0x0117f010,
1019 0xb63807f0, 1144 0xb63807f0,
1020 0x08d00604,
1021/* 0x024f: timer_done */
1022 0xf404bd00,
1023 0x00f81031,
1024/* 0x0254: send_proc */
1025 0x90f980f9,
1026 0x9805e898,
1027 0x86f004e9,
1028 0x0689b804,
1029 0xc42a0bf4,
1030 0x88940398,
1031 0x1880b604,
1032 0x98008ebb,
1033 0x8a8000fa,
1034 0x018d8000,
1035 0x80028c80,
1036 0x90b6038b,
1037 0x0794f001,
1038 0xf404e980,
1039/* 0x028e: send_done */
1040 0x90fc0231,
1041 0x00f880fc,
1042/* 0x0294: find */
1043 0x87f080f9,
1044 0x0131f458,
1045/* 0x029c: find_loop */
1046 0xb8008a98,
1047 0x0bf406ae,
1048 0x5880b610,
1049 0x026886b1,
1050 0xf4f01bf4,
1051/* 0x02b2: find_done */
1052 0x8eb90132,
1053 0xf880fc02,
1054/* 0x02b9: send */
1055 0x9421f500,
1056 0x9701f402,
1057/* 0x02c2: recv */
1058 0xe89800f8,
1059 0x04e99805,
1060 0xb80132f4,
1061 0x0bf40689,
1062 0x0389c43d,
1063 0xf00180b6,
1064 0xe8800784,
1065 0x02ea9805,
1066 0x8ffef0f9,
1067 0xb9f0f901,
1068 0x999402ef,
1069 0x00e9bb04,
1070 0x9818e0b6,
1071 0xec9803eb,
1072 0x01ed9802,
1073 0xf900ee98,
1074 0xfef0fca5,
1075 0x31f400f8,
1076/* 0x030b: recv_done */
1077 0xf8f0fc01,
1078/* 0x030d: init */
1079 0x0817f100,
1080 0x0614b601,
1081 0xe70011cf,
1082 0xb6010911,
1083 0x14fe0814,
1084 0xe017f100,
1085 0x0013f000,
1086 0xb61c07f0,
1087 0x01d00604, 1145 0x01d00604,
1088 0xf004bd00, 1146 0xf004bd00,
1089 0x07f0ff17, 1147/* 0x0402: init_proc */
1090 0x0604b614, 1148 0xf19858f7,
1091 0xbd0001d0, 1149 0x0016b001,
1092 0x0217f004, 1150 0xf9fa0bf4,
1093 0x080015f1, 1151 0x58f0b615,
1094 0xb61007f0, 1152/* 0x0413: mulu32_32_64 */
1095 0x01d00604, 1153 0xf9f20ef4,
1096 0xf104bd00, 1154 0xf920f910,
1097 0xf0010a17, 1155 0x9540f930,
1098 0x10fe0013, 1156 0xd29510e1,
1099 0x1031f400, 1157 0xbdc4bd10,
1100 0xf00117f0, 1158 0xc0edffb4,
1101 0x04b63807, 1159 0xb9301dff,
1102 0x0001d006, 1160 0x34f10234,
1103 0xf7f004bd, 1161 0x34b6ffff,
1104/* 0x0371: init_proc */ 1162 0x1045b610,
1105 0x01f19858, 1163 0xbb00c3bb,
1106 0xf40016b0, 1164 0xe2ff01b4,
1107 0x15f9fa0b, 1165 0x0234b930,
1108 0xf458f0b6, 1166 0xffff34f1,
1109/* 0x0382: host_send */ 1167 0xb61034b6,
1110 0x17f1f20e, 1168 0xc3bb1045,
1111 0x14b604b0, 1169 0x01b4bb00,
1112 0x0011cf06, 1170 0xbb3012ff,
1113 0x04a027f1, 1171 0x40fc00b3,
1114 0xcf0624b6, 1172 0x20fc30fc,
1115 0x12b80022, 1173 0x00f810fc,
1116 0x320bf406, 1174/* 0x0464: host_send */
1117 0x94071ec4, 1175 0x04b017f1,
1118 0xe0b704ee, 1176 0xcf0614b6,
1119 0xeb980270, 1177 0x27f10011,
1120 0x02ec9803, 1178 0x24b604a0,
1121 0x9801ed98, 1179 0x0022cf06,
1122 0x21f500ee, 1180 0xf40612b8,
1123 0x10b602b9, 1181 0x1ec4320b,
1124 0x0f1ec401, 1182 0x04ee9407,
1125 0x04b007f1, 1183 0x0270e0b7,
1126 0xd00604b6, 1184 0x9803eb98,
1127 0x04bd000e, 1185 0xed9802ec,
1128/* 0x03cb: host_send_done */ 1186 0x00ee9801,
1129 0xf8ba0ef4, 1187 0x034221f5,
1130/* 0x03cd: host_recv */ 1188 0xc40110b6,
1131 0x4917f100, 1189 0x07f10f1e,
1132 0x5413f14e, 1190 0x04b604b0,
1133 0x06e1b852, 1191 0x000ed006,
1134/* 0x03db: host_recv_wait */ 1192 0x0ef404bd,
1135 0xf1aa0bf4, 1193/* 0x04ad: host_send_done */
1136 0xb604cc17, 1194/* 0x04af: host_recv */
1137 0x11cf0614, 1195 0xf100f8ba,
1138 0xc827f100, 1196 0xf14e4917,
1139 0x0624b604, 1197 0xb8525413,
1140 0xf00022cf, 1198 0x0bf406e1,
1141 0x12b80816, 1199/* 0x04bd: host_recv_wait */
1142 0xe60bf406, 1200 0xcc17f1aa,
1143 0xb60723c4, 1201 0x0614b604,
1144 0x30b70434, 1202 0xf10011cf,
1145 0x3b8002f0, 1203 0xb604c827,
1146 0x023c8003, 1204 0x22cf0624,
1147 0x80013d80, 1205 0x0816f000,
1148 0x20b6003e, 1206 0xf40612b8,
1149 0x0f24f001, 1207 0x23c4e60b,
1150 0x04c807f1, 1208 0x0434b607,
1209 0x02f030b7,
1210 0x80033b80,
1211 0x3d80023c,
1212 0x003e8001,
1213 0xf00120b6,
1214 0x07f10f24,
1215 0x04b604c8,
1216 0x0002d006,
1217 0x27f004bd,
1218 0x0007f040,
1151 0xd00604b6, 1219 0xd00604b6,
1152 0x04bd0002, 1220 0x04bd0002,
1153 0xf04027f0, 1221/* 0x0512: host_init */
1154 0x04b60007, 1222 0x17f100f8,
1155 0x0002d006, 1223 0x14b60080,
1156 0x00f804bd, 1224 0x7015f110,
1157/* 0x0430: host_init */ 1225 0xd007f102,
1158 0x008017f1,
1159 0xf11014b6,
1160 0xf1027015,
1161 0xb604d007,
1162 0x01d00604,
1163 0xf104bd00,
1164 0xb6008017,
1165 0x15f11014,
1166 0x07f102f0,
1167 0x04b604dc,
1168 0x0001d006,
1169 0x17f004bd,
1170 0xc407f101,
1171 0x0604b604, 1226 0x0604b604,
1172 0xbd0001d0, 1227 0xbd0001d0,
1173/* 0x046f: memx_func_enter */ 1228 0x8017f104,
1174 0xf000f804, 1229 0x1014b600,
1230 0x02f015f1,
1231 0x04dc07f1,
1232 0xd00604b6,
1233 0x04bd0001,
1234 0xf10117f0,
1235 0xb604c407,
1236 0x01d00604,
1237 0xf804bd00,
1238/* 0x0551: memx_func_enter */
1239 0x1087f100,
1240 0x028eb916,
1241 0xb90421f4,
1242 0x67f102d7,
1243 0x63f1fffc,
1244 0x76fdffff,
1245 0x0267f104,
1246 0x0576fd00,
1247 0x70f980f9,
1248 0xe0fcd0fc,
1249 0xf03f21f4,
1175 0x07f10467, 1250 0x07f10467,
1176 0x04b607e0, 1251 0x04b607e0,
1177 0x0006d006, 1252 0x0006d006,
1178/* 0x047e: memx_func_enter_wait */ 1253/* 0x058a: memx_func_enter_wait */
1179 0x67f104bd, 1254 0x67f104bd,
1180 0x64b607c0, 1255 0x64b607c0,
1181 0x0066cf06, 1256 0x0066cf06,
1182 0xf40464f0, 1257 0xf40464f0,
1183 0x1698f30b, 1258 0x67f0f30b,
1184 0x0410b600, 1259 0x0664b62c,
1185/* 0x0496: memx_func_leave */ 1260 0x800066cf,
1186 0x67f000f8, 1261 0x00f8ee06,
1187 0xe407f104, 1262/* 0x05a8: memx_func_leave */
1188 0x0604b607, 1263 0xb62c67f0,
1189 0xbd0006d0, 1264 0x66cf0664,
1190/* 0x04a5: memx_func_leave_wait */ 1265 0xef068000,
1191 0xc067f104, 1266 0xf10467f0,
1267 0xb607e407,
1268 0x06d00604,
1269/* 0x05c3: memx_func_leave_wait */
1270 0xf104bd00,
1271 0xb607c067,
1272 0x66cf0664,
1273 0x0464f000,
1274 0xf1f31bf4,
1275 0xb9161087,
1276 0x21f4028e,
1277 0x02d7b904,
1278 0xffcc67f1,
1279 0xffff63f1,
1280 0xf90476fd,
1281 0xfc70f980,
1282 0xf4e0fcd0,
1283 0x00f83f21,
1284/* 0x05f8: memx_func_wait_vblank */
1285 0xb0001698,
1286 0x0bf40066,
1287 0x0166b013,
1288 0xf4060bf4,
1289/* 0x060a: memx_func_wait_vblank_head1 */
1290 0x77f12e0e,
1291 0x0ef40020,
1292/* 0x0611: memx_func_wait_vblank_head0 */
1293 0x0877f107,
1294/* 0x0615: memx_func_wait_vblank_0 */
1295 0xc467f100,
1192 0x0664b607, 1296 0x0664b607,
1193 0xf00066cf, 1297 0xfd0066cf,
1194 0x1bf40464, 1298 0x1bf40467,
1195/* 0x04b7: memx_func_wr32 */ 1299/* 0x0625: memx_func_wait_vblank_1 */
1196 0x9800f8f3, 1300 0xc467f1f3,
1197 0x15980016, 1301 0x0664b607,
1198 0x0810b601, 1302 0xfd0066cf,
1199 0x50f960f9, 1303 0x0bf40467,
1200 0xe0fcd0fc, 1304/* 0x0635: memx_func_wait_vblank_fini */
1201 0xb63f21f4, 1305 0x0410b6f3,
1202 0x1bf40242, 1306/* 0x063a: memx_func_wr32 */
1203/* 0x04d3: memx_func_wait */ 1307 0x169800f8,
1204 0xf000f8e9, 1308 0x01159800,
1205 0x84b62c87, 1309 0xf90810b6,
1206 0x0088cf06, 1310 0xfc50f960,
1207 0x98001e98, 1311 0xf4e0fcd0,
1208 0x1c98011d, 1312 0x42b63f21,
1209 0x031b9802, 1313 0xe91bf402,
1210 0xf41010b6, 1314/* 0x0656: memx_func_wait */
1211 0x00f89c21, 1315 0x87f000f8,
1212/* 0x04f0: memx_func_delay */ 1316 0x0684b62c,
1213 0xb6001e98, 1317 0x980088cf,
1214 0x21f40410, 1318 0x1d98001e,
1215/* 0x04fb: memx_exec */ 1319 0x021c9801,
1216 0xf900f87f, 1320 0xb6031b98,
1217 0xb9d0f9e0, 1321 0x21f41010,
1218 0xb2b902c1, 1322/* 0x0673: memx_func_delay */
1219/* 0x0505: memx_exec_next */ 1323 0x9800f8a4,
1220 0x00139802, 1324 0x10b6001e,
1221 0x950410b6, 1325 0x7f21f404,
1222 0x30f01034, 1326/* 0x067e: memx_exec */
1223 0xde35980c, 1327 0xe0f900f8,
1224 0x12b855f9, 1328 0xc1b9d0f9,
1225 0xec1ef406, 1329 0x02b2b902,
1226 0xe0fcd0fc, 1330/* 0x0688: memx_exec_next */
1227 0x02b921f5, 1331 0xb6001398,
1228/* 0x0526: memx_info */ 1332 0x34e70410,
1229 0xc7f100f8, 1333 0x33e701f0,
1230 0xb7f103ac, 1334 0x32b601e0,
1231 0x21f50800, 1335 0x0c30f001,
1232 0x00f802b9, 1336 0xf9de3598,
1233/* 0x0534: memx_recv */ 1337 0x0612b855,
1234 0xf401d6b0, 1338 0x98e41ef4,
1235 0xd6b0c40b, 1339 0x0c98ee0b,
1236 0xe90bf400, 1340 0x02cbbbef,
1237/* 0x0542: memx_init */ 1341 0x07c4b7f1,
1238 0x00f800f8, 1342 0xcf06b4b6,
1239/* 0x0544: perf_recv */ 1343 0xd0fc00bb,
1240/* 0x0546: perf_init */ 1344 0x21f5e0fc,
1345 0x00f80342,
1346/* 0x06c4: memx_info */
1347 0x03c0c7f1,
1348 0x0800b7f1,
1349 0x034221f5,
1350/* 0x06d2: memx_recv */
1351 0xd6b000f8,
1352 0xa90bf401,
1353 0xf400d6b0,
1354 0x00f8e90b,
1355/* 0x06e0: memx_init */
1356/* 0x06e2: perf_recv */
1241 0x00f800f8, 1357 0x00f800f8,
1242/* 0x0548: i2c_drive_scl */ 1358/* 0x06e4: perf_init */
1243 0xf40036b0, 1359/* 0x06e6: i2c_drive_scl */
1244 0x07f1110b,
1245 0x04b607e0,
1246 0x0001d006,
1247 0x00f804bd,
1248/* 0x055c: i2c_drive_scl_lo */
1249 0x07e407f1,
1250 0xd00604b6,
1251 0x04bd0001,
1252/* 0x056a: i2c_drive_sda */
1253 0x36b000f8, 1360 0x36b000f8,
1254 0x110bf400, 1361 0x110bf400,
1255 0x07e007f1, 1362 0x07e007f1,
1256 0xd00604b6, 1363 0xd00604b6,
1257 0x04bd0002, 1364 0x04bd0001,
1258/* 0x057e: i2c_drive_sda_lo */ 1365/* 0x06fa: i2c_drive_scl_lo */
1259 0x07f100f8, 1366 0x07f100f8,
1260 0x04b607e4, 1367 0x04b607e4,
1368 0x0001d006,
1369 0x00f804bd,
1370/* 0x0708: i2c_drive_sda */
1371 0xf40036b0,
1372 0x07f1110b,
1373 0x04b607e0,
1261 0x0002d006, 1374 0x0002d006,
1262 0x00f804bd, 1375 0x00f804bd,
1263/* 0x058c: i2c_sense_scl */ 1376/* 0x071c: i2c_drive_sda_lo */
1264 0xf10132f4, 1377 0x07e407f1,
1265 0xb607c437, 1378 0xd00604b6,
1266 0x33cf0634, 1379 0x04bd0002,
1267 0x0431fd00, 1380/* 0x072a: i2c_sense_scl */
1268 0xf4060bf4, 1381 0x32f400f8,
1269/* 0x05a2: i2c_sense_scl_done */ 1382 0xc437f101,
1270 0x00f80131, 1383 0x0634b607,
1271/* 0x05a4: i2c_sense_sda */ 1384 0xfd0033cf,
1272 0xf10132f4, 1385 0x0bf40431,
1273 0xb607c437, 1386 0x0131f406,
1274 0x33cf0634, 1387/* 0x0740: i2c_sense_scl_done */
1275 0x0432fd00, 1388/* 0x0742: i2c_sense_sda */
1276 0xf4060bf4, 1389 0x32f400f8,
1277/* 0x05ba: i2c_sense_sda_done */ 1390 0xc437f101,
1278 0x00f80131, 1391 0x0634b607,
1279/* 0x05bc: i2c_raise_scl */ 1392 0xfd0033cf,
1280 0x47f140f9, 1393 0x0bf40432,
1281 0x37f00898, 1394 0x0131f406,
1282 0x4821f501, 1395/* 0x0758: i2c_sense_sda_done */
1283/* 0x05c9: i2c_raise_scl_wait */ 1396/* 0x075a: i2c_raise_scl */
1284 0xe8e7f105, 1397 0x40f900f8,
1285 0x7f21f403, 1398 0x089847f1,
1286 0x058c21f5, 1399 0xf50137f0,
1287 0xb60901f4, 1400/* 0x0767: i2c_raise_scl_wait */
1288 0x1bf40142, 1401 0xf106e621,
1289/* 0x05dd: i2c_raise_scl_done */ 1402 0xf403e8e7,
1290 0xf840fcef, 1403 0x21f57f21,
1291/* 0x05e1: i2c_start */ 1404 0x01f4072a,
1292 0x8c21f500, 1405 0x0142b609,
1293 0x0d11f405, 1406/* 0x077b: i2c_raise_scl_done */
1294 0x05a421f5, 1407 0xfcef1bf4,
1295 0xf40611f4, 1408/* 0x077f: i2c_start */
1296/* 0x05f2: i2c_start_rep */ 1409 0xf500f840,
1297 0x37f0300e, 1410 0xf4072a21,
1298 0x4821f500, 1411 0x21f50d11,
1299 0x0137f005, 1412 0x11f40742,
1300 0x056a21f5, 1413 0x300ef406,
1301 0xb60076bb, 1414/* 0x0790: i2c_start_rep */
1302 0x50f90465, 1415 0xf50037f0,
1303 0xbb046594, 1416 0xf006e621,
1304 0x50bd0256, 1417 0x21f50137,
1305 0xfc0475fd, 1418 0x76bb0708,
1306 0xbc21f550, 1419 0x0465b600,
1307 0x0464b605, 1420 0x659450f9,
1308/* 0x061f: i2c_start_send */ 1421 0x0256bb04,
1309 0xf01f11f4, 1422 0x75fd50bd,
1423 0xf550fc04,
1424 0xb6075a21,
1425 0x11f40464,
1426/* 0x07bd: i2c_start_send */
1427 0x0037f01f,
1428 0x070821f5,
1429 0x1388e7f1,
1430 0xf07f21f4,
1310 0x21f50037, 1431 0x21f50037,
1311 0xe7f1056a, 1432 0xe7f106e6,
1312 0x21f41388, 1433 0x21f41388,
1313 0x0037f07f, 1434/* 0x07d9: i2c_start_out */
1314 0x054821f5, 1435/* 0x07db: i2c_stop */
1315 0x1388e7f1, 1436 0xf000f87f,
1316/* 0x063b: i2c_start_out */ 1437 0x21f50037,
1317 0xf87f21f4, 1438 0x37f006e6,
1318/* 0x063d: i2c_stop */ 1439 0x0821f500,
1319 0x0037f000, 1440 0xe8e7f107,
1320 0x054821f5, 1441 0x7f21f403,
1321 0xf50037f0,
1322 0xf1056a21,
1323 0xf403e8e7,
1324 0x37f07f21,
1325 0x4821f501,
1326 0x88e7f105,
1327 0x7f21f413,
1328 0xf50137f0, 1442 0xf50137f0,
1329 0xf1056a21, 1443 0xf106e621,
1330 0xf41388e7, 1444 0xf41388e7,
1331 0x00f87f21, 1445 0x37f07f21,
1332/* 0x0670: i2c_bitw */ 1446 0x0821f501,
1333 0x056a21f5, 1447 0x88e7f107,
1334 0x03e8e7f1,
1335 0xbb7f21f4,
1336 0x65b60076,
1337 0x9450f904,
1338 0x56bb0465,
1339 0xfd50bd02,
1340 0x50fc0475,
1341 0x05bc21f5,
1342 0xf40464b6,
1343 0xe7f11811,
1344 0x21f41388,
1345 0x0037f07f,
1346 0x054821f5,
1347 0x1388e7f1,
1348/* 0x06af: i2c_bitw_out */
1349 0xf87f21f4,
1350/* 0x06b1: i2c_bitr */
1351 0x0137f000,
1352 0x056a21f5,
1353 0x03e8e7f1,
1354 0xbb7f21f4,
1355 0x65b60076,
1356 0x9450f904,
1357 0x56bb0465,
1358 0xfd50bd02,
1359 0x50fc0475,
1360 0x05bc21f5,
1361 0xf40464b6,
1362 0x21f51b11,
1363 0x37f005a4,
1364 0x4821f500,
1365 0x88e7f105,
1366 0x7f21f413, 1448 0x7f21f413,
1367 0xf4013cf0, 1449/* 0x080e: i2c_bitw */
1368/* 0x06f6: i2c_bitr_done */ 1450 0x21f500f8,
1369 0x00f80131, 1451 0xe7f10708,
1370/* 0x06f8: i2c_get_byte */ 1452 0x21f403e8,
1371 0xf00057f0, 1453 0x0076bb7f,
1372/* 0x06fe: i2c_get_byte_next */
1373 0x54b60847,
1374 0x0076bb01,
1375 0xf90465b6, 1454 0xf90465b6,
1376 0x04659450, 1455 0x04659450,
1377 0xbd0256bb, 1456 0xbd0256bb,
1378 0x0475fd50, 1457 0x0475fd50,
1379 0x21f550fc, 1458 0x21f550fc,
1380 0x64b606b1, 1459 0x64b6075a,
1381 0x2b11f404, 1460 0x1811f404,
1382 0xb60553fd, 1461 0x1388e7f1,
1383 0x1bf40142, 1462 0xf07f21f4,
1384 0x0137f0d8, 1463 0x21f50037,
1385 0xb60076bb, 1464 0xe7f106e6,
1386 0x50f90465, 1465 0x21f41388,
1387 0xbb046594, 1466/* 0x084d: i2c_bitw_out */
1388 0x50bd0256, 1467/* 0x084f: i2c_bitr */
1389 0xfc0475fd, 1468 0xf000f87f,
1390 0x7021f550, 1469 0x21f50137,
1391 0x0464b606, 1470 0xe7f10708,
1392/* 0x0748: i2c_get_byte_done */ 1471 0x21f403e8,
1393/* 0x074a: i2c_put_byte */ 1472 0x0076bb7f,
1394 0x47f000f8, 1473 0xf90465b6,
1395/* 0x074d: i2c_put_byte_next */ 1474 0x04659450,
1396 0x0142b608, 1475 0xbd0256bb,
1397 0xbb3854ff, 1476 0x0475fd50,
1477 0x21f550fc,
1478 0x64b6075a,
1479 0x1b11f404,
1480 0x074221f5,
1481 0xf50037f0,
1482 0xf106e621,
1483 0xf41388e7,
1484 0x3cf07f21,
1485 0x0131f401,
1486/* 0x0894: i2c_bitr_done */
1487/* 0x0896: i2c_get_byte */
1488 0x57f000f8,
1489 0x0847f000,
1490/* 0x089c: i2c_get_byte_next */
1491 0xbb0154b6,
1398 0x65b60076, 1492 0x65b60076,
1399 0x9450f904, 1493 0x9450f904,
1400 0x56bb0465, 1494 0x56bb0465,
1401 0xfd50bd02, 1495 0xfd50bd02,
1402 0x50fc0475, 1496 0x50fc0475,
1403 0x067021f5, 1497 0x084f21f5,
1404 0xf40464b6, 1498 0xf40464b6,
1405 0x46b03411, 1499 0x53fd2b11,
1406 0xd81bf400, 1500 0x0142b605,
1407 0xb60076bb, 1501 0xf0d81bf4,
1408 0x50f90465, 1502 0x76bb0137,
1409 0xbb046594, 1503 0x0465b600,
1410 0x50bd0256, 1504 0x659450f9,
1411 0xfc0475fd, 1505 0x0256bb04,
1412 0xb121f550, 1506 0x75fd50bd,
1413 0x0464b606, 1507 0xf550fc04,
1414 0xbb0f11f4, 1508 0xb6080e21,
1415 0x36b00076, 1509/* 0x08e6: i2c_get_byte_done */
1416 0x061bf401, 1510 0x00f80464,
1417/* 0x07a3: i2c_put_byte_done */ 1511/* 0x08e8: i2c_put_byte */
1418 0xf80132f4, 1512/* 0x08eb: i2c_put_byte_next */
1419/* 0x07a5: i2c_addr */ 1513 0xb60847f0,
1420 0x0076bb00, 1514 0x54ff0142,
1515 0x0076bb38,
1421 0xf90465b6, 1516 0xf90465b6,
1422 0x04659450, 1517 0x04659450,
1423 0xbd0256bb, 1518 0xbd0256bb,
1424 0x0475fd50, 1519 0x0475fd50,
1425 0x21f550fc, 1520 0x21f550fc,
1426 0x64b605e1, 1521 0x64b6080e,
1427 0x2911f404, 1522 0x3411f404,
1428 0x012ec3e7, 1523 0xf40046b0,
1429 0xfd0134b6, 1524 0x76bbd81b,
1430 0x76bb0553,
1431 0x0465b600, 1525 0x0465b600,
1432 0x659450f9, 1526 0x659450f9,
1433 0x0256bb04, 1527 0x0256bb04,
1434 0x75fd50bd, 1528 0x75fd50bd,
1435 0xf550fc04, 1529 0xf550fc04,
1436 0xb6074a21, 1530 0xb6084f21,
1437/* 0x07ea: i2c_addr_done */ 1531 0x11f40464,
1438 0x00f80464, 1532 0x0076bb0f,
1439/* 0x07ec: i2c_acquire_addr */ 1533 0xf40136b0,
1440 0xb6f8cec7, 1534 0x32f4061b,
1441 0xe0b702e4, 1535/* 0x0941: i2c_put_byte_done */
1442 0xee980bfc, 1536/* 0x0943: i2c_addr */
1443/* 0x07fb: i2c_acquire */ 1537 0xbb00f801,
1444 0xf500f800,
1445 0xf407ec21,
1446 0xd9f00421,
1447 0x3f21f403,
1448/* 0x080a: i2c_release */
1449 0x21f500f8,
1450 0x21f407ec,
1451 0x03daf004,
1452 0xf83f21f4,
1453/* 0x0819: i2c_recv */
1454 0x0132f400,
1455 0xb6f8c1c7,
1456 0x16b00214,
1457 0x3a1ff528,
1458 0xd413a001,
1459 0x0032980b,
1460 0x0bac13a0,
1461 0xf4003198,
1462 0xd0f90231,
1463 0xd0f9e0f9,
1464 0x000067f1,
1465 0x100063f1,
1466 0xbb016792,
1467 0x65b60076, 1538 0x65b60076,
1468 0x9450f904, 1539 0x9450f904,
1469 0x56bb0465, 1540 0x56bb0465,
1470 0xfd50bd02, 1541 0xfd50bd02,
1471 0x50fc0475, 1542 0x50fc0475,
1472 0x07fb21f5, 1543 0x077f21f5,
1473 0xfc0464b6, 1544 0xf40464b6,
1474 0x00d6b0d0, 1545 0xc3e72911,
1475 0x00b31bf5, 1546 0x34b6012e,
1476 0xbb0057f0, 1547 0x0553fd01,
1477 0x65b60076, 1548 0xb60076bb,
1478 0x9450f904, 1549 0x50f90465,
1479 0x56bb0465, 1550 0xbb046594,
1480 0xfd50bd02, 1551 0x50bd0256,
1481 0x50fc0475, 1552 0xfc0475fd,
1482 0x07a521f5, 1553 0xe821f550,
1483 0xf50464b6, 1554 0x0464b608,
1484 0xc700d011, 1555/* 0x0988: i2c_addr_done */
1485 0x76bbe0c5, 1556/* 0x098a: i2c_acquire_addr */
1486 0x0465b600, 1557 0xcec700f8,
1487 0x659450f9, 1558 0x02e4b6f8,
1488 0x0256bb04, 1559 0x0c10e0b7,
1489 0x75fd50bd, 1560 0xf800ee98,
1490 0xf550fc04, 1561/* 0x0999: i2c_acquire */
1491 0xb6074a21, 1562 0x8a21f500,
1492 0x11f50464, 1563 0x0421f409,
1493 0x57f000ad, 1564 0xf403d9f0,
1565 0x00f83f21,
1566/* 0x09a8: i2c_release */
1567 0x098a21f5,
1568 0xf00421f4,
1569 0x21f403da,
1570/* 0x09b7: i2c_recv */
1571 0xf400f83f,
1572 0xc1c70132,
1573 0x0214b6f8,
1574 0xf52816b0,
1575 0xa0013a1f,
1576 0x980be813,
1577 0x13a00032,
1578 0x31980bc0,
1579 0x0231f400,
1580 0xe0f9d0f9,
1581 0x67f1d0f9,
1582 0x63f10000,
1583 0x67921000,
1494 0x0076bb01, 1584 0x0076bb01,
1495 0xf90465b6, 1585 0xf90465b6,
1496 0x04659450, 1586 0x04659450,
1497 0xbd0256bb, 1587 0xbd0256bb,
1498 0x0475fd50, 1588 0x0475fd50,
1499 0x21f550fc, 1589 0x21f550fc,
1500 0x64b607a5, 1590 0x64b60999,
1501 0x8a11f504, 1591 0xb0d0fc04,
1592 0x1bf500d6,
1593 0x57f000b3,
1502 0x0076bb00, 1594 0x0076bb00,
1503 0xf90465b6, 1595 0xf90465b6,
1504 0x04659450, 1596 0x04659450,
1505 0xbd0256bb, 1597 0xbd0256bb,
1506 0x0475fd50, 1598 0x0475fd50,
1507 0x21f550fc, 1599 0x21f550fc,
1508 0x64b606f8, 1600 0x64b60943,
1509 0x6a11f404, 1601 0xd011f504,
1510 0xbbe05bcb, 1602 0xe0c5c700,
1603 0xb60076bb,
1604 0x50f90465,
1605 0xbb046594,
1606 0x50bd0256,
1607 0xfc0475fd,
1608 0xe821f550,
1609 0x0464b608,
1610 0x00ad11f5,
1611 0xbb0157f0,
1511 0x65b60076, 1612 0x65b60076,
1512 0x9450f904, 1613 0x9450f904,
1513 0x56bb0465, 1614 0x56bb0465,
1514 0xfd50bd02, 1615 0xfd50bd02,
1515 0x50fc0475, 1616 0x50fc0475,
1516 0x063d21f5, 1617 0x094321f5,
1517 0xb90464b6, 1618 0xf50464b6,
1518 0x74bd025b, 1619 0xbb008a11,
1519/* 0x091f: i2c_recv_not_rd08 */ 1620 0x65b60076,
1520 0xb0430ef4, 1621 0x9450f904,
1521 0x1bf401d6, 1622 0x56bb0465,
1522 0x0057f03d, 1623 0xfd50bd02,
1523 0x07a521f5, 1624 0x50fc0475,
1524 0xc73311f4, 1625 0x089621f5,
1525 0x21f5e0c5, 1626 0xf40464b6,
1526 0x11f4074a, 1627 0x5bcb6a11,
1527 0x0057f029, 1628 0x0076bbe0,
1528 0x07a521f5, 1629 0xf90465b6,
1529 0xc71f11f4, 1630 0x04659450,
1530 0x21f5e0b5, 1631 0xbd0256bb,
1531 0x11f4074a, 1632 0x0475fd50,
1532 0x3d21f515, 1633 0x21f550fc,
1533 0xc774bd06, 1634 0x64b607db,
1534 0x1bf408c5, 1635 0x025bb904,
1535 0x0232f409, 1636 0x0ef474bd,
1536/* 0x095f: i2c_recv_not_wr08 */ 1637/* 0x0abd: i2c_recv_not_rd08 */
1537/* 0x095f: i2c_recv_done */ 1638 0x01d6b043,
1538 0xc7030ef4, 1639 0xf03d1bf4,
1539 0x21f5f8ce, 1640 0x21f50057,
1540 0xe0fc080a, 1641 0x11f40943,
1541 0x12f4d0fc, 1642 0xe0c5c733,
1542 0x027cb90a, 1643 0x08e821f5,
1543 0x02b921f5, 1644 0xf02911f4,
1544/* 0x0974: i2c_recv_exit */ 1645 0x21f50057,
1545/* 0x0976: i2c_init */ 1646 0x11f40943,
1546 0x00f800f8, 1647 0xe0b5c71f,
1547/* 0x0978: test_recv */ 1648 0x08e821f5,
1548 0x05d817f1, 1649 0xf51511f4,
1650 0xbd07db21,
1651 0x08c5c774,
1652 0xf4091bf4,
1653 0x0ef40232,
1654/* 0x0afd: i2c_recv_not_wr08 */
1655/* 0x0afd: i2c_recv_done */
1656 0xf8cec703,
1657 0x09a821f5,
1658 0xd0fce0fc,
1659 0xb90a12f4,
1660 0x21f5027c,
1661/* 0x0b12: i2c_recv_exit */
1662 0x00f80342,
1663/* 0x0b14: i2c_init */
1664/* 0x0b16: test_recv */
1665 0x17f100f8,
1666 0x14b605d8,
1667 0x0011cf06,
1668 0xf10110b6,
1669 0xb605d807,
1670 0x01d00604,
1671 0xf104bd00,
1672 0xf1d900e7,
1673 0xf5134fe3,
1674 0xf8026221,
1675/* 0x0b3d: test_init */
1676 0x00e7f100,
1677 0x6221f508,
1678/* 0x0b47: idle_recv */
1679 0xf800f802,
1680/* 0x0b49: idle */
1681 0x0031f400,
1682 0x05d417f1,
1549 0xcf0614b6, 1683 0xcf0614b6,
1550 0x10b60011, 1684 0x10b60011,
1551 0xd807f101, 1685 0xd407f101,
1552 0x0604b605, 1686 0x0604b605,
1553 0xbd0001d0, 1687 0xbd0001d0,
1554 0x00e7f104, 1688/* 0x0b65: idle_loop */
1555 0x4fe3f1d9, 1689 0x5817f004,
1556 0xf521f513, 1690/* 0x0b6b: idle_proc */
1557/* 0x099f: test_init */ 1691/* 0x0b6b: idle_proc_exec */
1558 0xf100f801, 1692 0xf90232f4,
1559 0xf50800e7, 1693 0x021eb910,
1560 0xf801f521, 1694 0x034b21f5,
1561/* 0x09a9: idle_recv */ 1695 0x11f410fc,
1562/* 0x09ab: idle */ 1696 0x0231f409,
1563 0xf400f800, 1697/* 0x0b7f: idle_proc_next */
1564 0x17f10031, 1698 0xb6ef0ef4,
1565 0x14b605d4, 1699 0x1fb85810,
1566 0x0011cf06, 1700 0xe61bf406,
1567 0xf10110b6, 1701 0xf4dd02f4,
1568 0xb605d407, 1702 0x0ef40028,
1569 0x01d00604, 1703 0x000000bb,
1570/* 0x09c7: idle_loop */ 1704 0x00000000,
1571 0xf004bd00, 1705 0x00000000,
1572 0x32f45817, 1706 0x00000000,
1573/* 0x09cd: idle_proc */ 1707 0x00000000,
1574/* 0x09cd: idle_proc_exec */ 1708 0x00000000,
1575 0xb910f902, 1709 0x00000000,
1576 0x21f5021e, 1710 0x00000000,
1577 0x10fc02c2, 1711 0x00000000,
1578 0xf40911f4, 1712 0x00000000,
1579 0x0ef40231, 1713 0x00000000,
1580/* 0x09e1: idle_proc_next */ 1714 0x00000000,
1581 0x5810b6ef, 1715 0x00000000,
1582 0xf4061fb8, 1716 0x00000000,
1583 0x02f4e61b, 1717 0x00000000,
1584 0x0028f4dd, 1718 0x00000000,
1585 0x00bb0ef4, 1719 0x00000000,
1720 0x00000000,
1721 0x00000000,
1722 0x00000000,
1723 0x00000000,
1724 0x00000000,
1725 0x00000000,
1726 0x00000000,
1727 0x00000000,
1586 0x00000000, 1728 0x00000000,
1587 0x00000000, 1729 0x00000000,
1588 0x00000000, 1730 0x00000000,
diff --git a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvc0.fuc b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvc0.fuc
index 48f79434a449..21bf8cc7618f 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvc0.fuc
+++ b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvc0.fuc
@@ -23,6 +23,7 @@
23 */ 23 */
24 24
25#define NVKM_PPWR_CHIPSET GF100 25#define NVKM_PPWR_CHIPSET GF100
26#define HW_TICKS_PER_US 203 // should be 202.5
26 27
27//#define NVKM_FALCON_PC24 28//#define NVKM_FALCON_PC24
28//#define NVKM_FALCON_UNSHIFTED_IO 29//#define NVKM_FALCON_UNSHIFTED_IO
@@ -34,6 +35,7 @@
34.section #nvc0_pwr_data 35.section #nvc0_pwr_data
35#define INCLUDE_PROC 36#define INCLUDE_PROC
36#include "kernel.fuc" 37#include "kernel.fuc"
38#include "arith.fuc"
37#include "host.fuc" 39#include "host.fuc"
38#include "memx.fuc" 40#include "memx.fuc"
39#include "perf.fuc" 41#include "perf.fuc"
@@ -44,6 +46,7 @@
44 46
45#define INCLUDE_DATA 47#define INCLUDE_DATA
46#include "kernel.fuc" 48#include "kernel.fuc"
49#include "arith.fuc"
47#include "host.fuc" 50#include "host.fuc"
48#include "memx.fuc" 51#include "memx.fuc"
49#include "perf.fuc" 52#include "perf.fuc"
@@ -56,6 +59,7 @@
56.section #nvc0_pwr_code 59.section #nvc0_pwr_code
57#define INCLUDE_CODE 60#define INCLUDE_CODE
58#include "kernel.fuc" 61#include "kernel.fuc"
62#include "arith.fuc"
59#include "host.fuc" 63#include "host.fuc"
60#include "memx.fuc" 64#include "memx.fuc"
61#include "perf.fuc" 65#include "perf.fuc"
diff --git a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvc0.fuc.h b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvc0.fuc.h
index 0773ff0e3dc3..ca30fa4011b5 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvc0.fuc.h
+++ b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvc0.fuc.h
@@ -24,8 +24,8 @@ uint32_t nvc0_pwr_data[] = {
24 0x00000000, 24 0x00000000,
25/* 0x0058: proc_list_head */ 25/* 0x0058: proc_list_head */
26 0x54534f48, 26 0x54534f48,
27 0x00000430, 27 0x00000512,
28 0x000003cd, 28 0x000004af,
29 0x00000000, 29 0x00000000,
30 0x00000000, 30 0x00000000,
31 0x00000000, 31 0x00000000,
@@ -46,8 +46,8 @@ uint32_t nvc0_pwr_data[] = {
46 0x00000000, 46 0x00000000,
47 0x00000000, 47 0x00000000,
48 0x584d454d, 48 0x584d454d,
49 0x00000542, 49 0x0000074b,
50 0x00000534, 50 0x0000073d,
51 0x00000000, 51 0x00000000,
52 0x00000000, 52 0x00000000,
53 0x00000000, 53 0x00000000,
@@ -68,8 +68,8 @@ uint32_t nvc0_pwr_data[] = {
68 0x00000000, 68 0x00000000,
69 0x00000000, 69 0x00000000,
70 0x46524550, 70 0x46524550,
71 0x00000546, 71 0x0000074f,
72 0x00000544, 72 0x0000074d,
73 0x00000000, 73 0x00000000,
74 0x00000000, 74 0x00000000,
75 0x00000000, 75 0x00000000,
@@ -90,8 +90,8 @@ uint32_t nvc0_pwr_data[] = {
90 0x00000000, 90 0x00000000,
91 0x00000000, 91 0x00000000,
92 0x5f433249, 92 0x5f433249,
93 0x00000976, 93 0x00000b7f,
94 0x00000819, 94 0x00000a22,
95 0x00000000, 95 0x00000000,
96 0x00000000, 96 0x00000000,
97 0x00000000, 97 0x00000000,
@@ -112,8 +112,8 @@ uint32_t nvc0_pwr_data[] = {
112 0x00000000, 112 0x00000000,
113 0x00000000, 113 0x00000000,
114 0x54534554, 114 0x54534554,
115 0x0000099f, 115 0x00000ba8,
116 0x00000978, 116 0x00000b81,
117 0x00000000, 117 0x00000000,
118 0x00000000, 118 0x00000000,
119 0x00000000, 119 0x00000000,
@@ -134,8 +134,8 @@ uint32_t nvc0_pwr_data[] = {
134 0x00000000, 134 0x00000000,
135 0x00000000, 135 0x00000000,
136 0x454c4449, 136 0x454c4449,
137 0x000009ab, 137 0x00000bb4,
138 0x000009a9, 138 0x00000bb2,
139 0x00000000, 139 0x00000000,
140 0x00000000, 140 0x00000000,
141 0x00000000, 141 0x00000000,
@@ -227,25 +227,31 @@ uint32_t nvc0_pwr_data[] = {
227 0x00000000, 227 0x00000000,
228 0x00000000, 228 0x00000000,
229/* 0x0370: memx_func_head */ 229/* 0x0370: memx_func_head */
230 0x00010000,
231 0x00000000,
232 0x0000046f,
233/* 0x037c: memx_func_next */
234 0x00000001, 230 0x00000001,
235 0x00000000, 231 0x00000000,
236 0x00000496, 232 0x00000551,
233/* 0x037c: memx_func_next */
237 0x00000002, 234 0x00000002,
235 0x00000000,
236 0x000005db,
237 0x00000003,
238 0x00000002, 238 0x00000002,
239 0x000004b7, 239 0x000006a5,
240 0x00040003, 240 0x00040004,
241 0x00000000,
242 0x000006c1,
243 0x00010005,
244 0x00000000,
245 0x000006de,
246 0x00010006,
241 0x00000000, 247 0x00000000,
242 0x000004d3, 248 0x00000663,
243 0x00010004, 249/* 0x03b8: memx_func_tail */
250/* 0x03b8: memx_ts_start */
244 0x00000000, 251 0x00000000,
245 0x000004f0, 252/* 0x03bc: memx_ts_end */
246/* 0x03ac: memx_func_tail */
247/* 0x03ac: memx_data_head */
248 0x00000000, 253 0x00000000,
254/* 0x03c0: memx_data_head */
249 0x00000000, 255 0x00000000,
250 0x00000000, 256 0x00000000,
251 0x00000000, 257 0x00000000,
@@ -757,8 +763,9 @@ uint32_t nvc0_pwr_data[] = {
757 0x00000000, 763 0x00000000,
758 0x00000000, 764 0x00000000,
759 0x00000000, 765 0x00000000,
760/* 0x0bac: memx_data_tail */ 766 0x00000000,
761/* 0x0bac: i2c_scl_map */ 767/* 0x0bc0: memx_data_tail */
768/* 0x0bc0: i2c_scl_map */
762 0x00001000, 769 0x00001000,
763 0x00004000, 770 0x00004000,
764 0x00010000, 771 0x00010000,
@@ -769,7 +776,7 @@ uint32_t nvc0_pwr_data[] = {
769 0x01000000, 776 0x01000000,
770 0x04000000, 777 0x04000000,
771 0x10000000, 778 0x10000000,
772/* 0x0bd4: i2c_sda_map */ 779/* 0x0be8: i2c_sda_map */
773 0x00002000, 780 0x00002000,
774 0x00008000, 781 0x00008000,
775 0x00020000, 782 0x00020000,
@@ -780,7 +787,7 @@ uint32_t nvc0_pwr_data[] = {
780 0x02000000, 787 0x02000000,
781 0x08000000, 788 0x08000000,
782 0x20000000, 789 0x20000000,
783/* 0x0bfc: i2c_ctrl */ 790/* 0x0c10: i2c_ctrl */
784 0x0000e138, 791 0x0000e138,
785 0x0000e150, 792 0x0000e150,
786 0x0000e168, 793 0x0000e168,
@@ -841,15 +848,10 @@ uint32_t nvc0_pwr_data[] = {
841 0x00000000, 848 0x00000000,
842 0x00000000, 849 0x00000000,
843 0x00000000, 850 0x00000000,
844 0x00000000,
845 0x00000000,
846 0x00000000,
847 0x00000000,
848 0x00000000,
849}; 851};
850 852
851uint32_t nvc0_pwr_code[] = { 853uint32_t nvc0_pwr_code[] = {
852 0x030d0ef5, 854 0x039e0ef5,
853/* 0x0004: rd32 */ 855/* 0x0004: rd32 */
854 0x07a007f1, 856 0x07a007f1,
855 0xd00604b6, 857 0xd00604b6,
@@ -885,19 +887,22 @@ uint32_t nvc0_pwr_code[] = {
885 0xd4f100dd, 887 0xd4f100dd,
886 0x1bf47000, 888 0x1bf47000,
887/* 0x007f: nsec */ 889/* 0x007f: nsec */
888 0xf000f8f2, 890 0xf900f8f2,
891 0xf080f990,
889 0x84b62c87, 892 0x84b62c87,
890 0x0088cf06, 893 0x0088cf06,
891/* 0x0088: nsec_loop */ 894/* 0x008c: nsec_loop */
892 0xb62c97f0, 895 0xb62c97f0,
893 0x99cf0694, 896 0x99cf0694,
894 0x0298bb00, 897 0x0298bb00,
895 0xf4069eb8, 898 0xf4069eb8,
896 0x00f8f11e, 899 0x80fcf11e,
897/* 0x009c: wait */ 900 0x00f890fc,
901/* 0x00a4: wait */
902 0x80f990f9,
898 0xb62c87f0, 903 0xb62c87f0,
899 0x88cf0684, 904 0x88cf0684,
900/* 0x00a5: wait_loop */ 905/* 0x00b1: wait_loop */
901 0x02eeb900, 906 0x02eeb900,
902 0xb90421f4, 907 0xb90421f4,
903 0xadfd02da, 908 0xadfd02da,
@@ -907,28 +912,29 @@ uint32_t nvc0_pwr_code[] = {
907 0x0099cf06, 912 0x0099cf06,
908 0xb80298bb, 913 0xb80298bb,
909 0x1ef4069b, 914 0x1ef4069b,
910/* 0x00c9: wait_done */ 915/* 0x00d5: wait_done */
911/* 0x00cb: intr_watchdog */ 916 0xfc80fcdf,
912 0x9800f8df, 917/* 0x00db: intr_watchdog */
918 0x9800f890,
913 0x96b003e9, 919 0x96b003e9,
914 0x2a0bf400, 920 0x2a0bf400,
915 0xbb9a0a98, 921 0xbb9a0a98,
916 0x1cf4029a, 922 0x1cf4029a,
917 0x01d7f00f, 923 0x01d7f00f,
918 0x025421f5, 924 0x02dd21f5,
919 0x0ef494bd, 925 0x0ef494bd,
920/* 0x00e9: intr_watchdog_next_time */ 926/* 0x00f9: intr_watchdog_next_time */
921 0x9b0a9815, 927 0x9b0a9815,
922 0xf400a6b0, 928 0xf400a6b0,
923 0x9ab8090b, 929 0x9ab8090b,
924 0x061cf406, 930 0x061cf406,
925/* 0x00f8: intr_watchdog_next_time_set */ 931/* 0x0108: intr_watchdog_next_time_set */
926/* 0x00fb: intr_watchdog_next_proc */ 932/* 0x010b: intr_watchdog_next_proc */
927 0x809b0980, 933 0x809b0980,
928 0xe0b603e9, 934 0xe0b603e9,
929 0x68e6b158, 935 0x68e6b158,
930 0xc61bf402, 936 0xc61bf402,
931/* 0x010a: intr */ 937/* 0x011a: intr */
932 0x00f900f8, 938 0x00f900f8,
933 0x80f904bd, 939 0x80f904bd,
934 0xa0f990f9, 940 0xa0f990f9,
@@ -948,13 +954,13 @@ uint32_t nvc0_pwr_code[] = {
948 0xf40289c4, 954 0xf40289c4,
949 0x0080230b, 955 0x0080230b,
950 0x58e7f09b, 956 0x58e7f09b,
951 0x98cb21f4, 957 0x98db21f4,
952 0x96b09b09, 958 0x96b09b09,
953 0x110bf400, 959 0x110bf400,
954 0xb63407f0, 960 0xb63407f0,
955 0x09d00604, 961 0x09d00604,
956 0x8004bd00, 962 0x8004bd00,
957/* 0x016e: intr_skip_watchdog */ 963/* 0x017e: intr_skip_watchdog */
958 0x89e49a09, 964 0x89e49a09,
959 0x0bf40800, 965 0x0bf40800,
960 0x8897f148, 966 0x8897f148,
@@ -967,22 +973,22 @@ uint32_t nvc0_pwr_code[] = {
967 0x48e7f1c0, 973 0x48e7f1c0,
968 0x53e3f14f, 974 0x53e3f14f,
969 0x00d7f054, 975 0x00d7f054,
970 0x02b921f5, 976 0x034221f5,
971 0x07f1c0fc, 977 0x07f1c0fc,
972 0x04b604c0, 978 0x04b604c0,
973 0x000cd006, 979 0x000cd006,
974/* 0x01ae: intr_subintr_skip_fifo */ 980/* 0x01be: intr_subintr_skip_fifo */
975 0x07f104bd, 981 0x07f104bd,
976 0x04b60688, 982 0x04b60688,
977 0x0009d006, 983 0x0009d006,
978/* 0x01ba: intr_skip_subintr */ 984/* 0x01ca: intr_skip_subintr */
979 0x89c404bd, 985 0x89c404bd,
980 0x070bf420, 986 0x070bf420,
981 0xffbfa4f1, 987 0xffbfa4f1,
982/* 0x01c4: intr_skip_pause */ 988/* 0x01d4: intr_skip_pause */
983 0xf44089c4, 989 0xf44089c4,
984 0xa4f1070b, 990 0xa4f1070b,
985/* 0x01ce: intr_skip_user0 */ 991/* 0x01de: intr_skip_user0 */
986 0x07f0ffbf, 992 0x07f0ffbf,
987 0x0604b604, 993 0x0604b604,
988 0xbd0008d0, 994 0xbd0008d0,
@@ -993,597 +999,733 @@ uint32_t nvc0_pwr_code[] = {
993 0x90fca0fc, 999 0x90fca0fc,
994 0x00fc80fc, 1000 0x00fc80fc,
995 0xf80032f4, 1001 0xf80032f4,
996/* 0x01f5: timer */ 1002/* 0x0205: ticks_from_ns */
997 0x1032f401, 1003 0xf9c0f901,
998 0xb003f898, 1004 0xcbd7f1b0,
999 0x1cf40086, 1005 0x00d3f000,
1000 0x03fe8051, 1006 0x041321f5,
1007 0x03e8ccec,
1008 0xf400b4b0,
1009 0xeeec120b,
1010 0xd7f103e8,
1011 0xd3f000cb,
1012 0x1321f500,
1013/* 0x022d: ticks_from_ns_quit */
1014 0x02ceb904,
1015 0xc0fcb0fc,
1016/* 0x0236: ticks_from_us */
1017 0xc0f900f8,
1018 0xd7f1b0f9,
1019 0xd3f000cb,
1020 0x1321f500,
1021 0x02ceb904,
1022 0xf400b4b0,
1023 0xe4bd050b,
1024/* 0x0250: ticks_from_us_quit */
1025 0xc0fcb0fc,
1026/* 0x0256: ticks_to_us */
1027 0xd7f100f8,
1028 0xd3f000cb,
1029 0xecedff00,
1030/* 0x0262: timer */
1031 0x90f900f8,
1032 0x32f480f9,
1033 0x03f89810,
1034 0xf40086b0,
1035 0x84bd651c,
1001 0xb63807f0, 1036 0xb63807f0,
1002 0x08d00604, 1037 0x08d00604,
1003 0xf004bd00, 1038 0xf004bd00,
1004 0x84b60887, 1039 0x84b63487,
1005 0x0088cf06, 1040 0x0088cf06,
1006 0xf40284f0, 1041 0xbb9a0998,
1007 0x87f0261b, 1042 0xe9bb0298,
1008 0x0684b634, 1043 0x03fe8000,
1009 0xb80088cf, 1044 0xb60887f0,
1010 0x0bf406e0, 1045 0x88cf0684,
1011 0x06e8b809, 1046 0x0284f000,
1012/* 0x0233: timer_reset */ 1047 0xf0261bf4,
1013 0xf01f1ef4, 1048 0x84b63487,
1014 0x04b63407, 1049 0x0088cf06,
1015 0x000ed006, 1050 0xf406e0b8,
1016 0x0e8004bd, 1051 0xe8b8090b,
1017/* 0x0241: timer_enable */ 1052 0x111cf406,
1018 0x0187f09a, 1053/* 0x02b8: timer_reset */
1054 0xb63407f0,
1055 0x0ed00604,
1056 0x8004bd00,
1057/* 0x02c6: timer_enable */
1058 0x87f09a0e,
1059 0x3807f001,
1060 0xd00604b6,
1061 0x04bd0008,
1062/* 0x02d4: timer_done */
1063 0xfc1031f4,
1064 0xf890fc80,
1065/* 0x02dd: send_proc */
1066 0xf980f900,
1067 0x05e89890,
1068 0xf004e998,
1069 0x89b80486,
1070 0x2a0bf406,
1071 0x940398c4,
1072 0x80b60488,
1073 0x008ebb18,
1074 0x8000fa98,
1075 0x8d80008a,
1076 0x028c8001,
1077 0xb6038b80,
1078 0x94f00190,
1079 0x04e98007,
1080/* 0x0317: send_done */
1081 0xfc0231f4,
1082 0xf880fc90,
1083/* 0x031d: find */
1084 0xf080f900,
1085 0x31f45887,
1086/* 0x0325: find_loop */
1087 0x008a9801,
1088 0xf406aeb8,
1089 0x80b6100b,
1090 0x6886b158,
1091 0xf01bf402,
1092/* 0x033b: find_done */
1093 0xb90132f4,
1094 0x80fc028e,
1095/* 0x0342: send */
1096 0x21f500f8,
1097 0x01f4031d,
1098/* 0x034b: recv */
1099 0xf900f897,
1100 0x9880f990,
1101 0xe99805e8,
1102 0x0132f404,
1103 0xf40689b8,
1104 0x89c43d0b,
1105 0x0180b603,
1106 0x800784f0,
1107 0xea9805e8,
1108 0xfef0f902,
1109 0xf0f9018f,
1110 0x9402efb9,
1111 0xe9bb0499,
1112 0x18e0b600,
1113 0x9803eb98,
1114 0xed9802ec,
1115 0x00ee9801,
1116 0xf0fca5f9,
1117 0xf400f8fe,
1118 0xf0fc0131,
1119/* 0x0398: recv_done */
1120 0x90fc80fc,
1121/* 0x039e: init */
1122 0x17f100f8,
1123 0x14b60108,
1124 0x0011cf06,
1125 0x010911e7,
1126 0xfe0814b6,
1127 0x17f10014,
1128 0x13f000e0,
1129 0x1c07f000,
1130 0xd00604b6,
1131 0x04bd0001,
1132 0xf0ff17f0,
1133 0x04b61407,
1134 0x0001d006,
1135 0x17f004bd,
1136 0x0015f102,
1137 0x1007f008,
1138 0xd00604b6,
1139 0x04bd0001,
1140 0x011a17f1,
1141 0xfe0013f0,
1142 0x31f40010,
1143 0x0117f010,
1019 0xb63807f0, 1144 0xb63807f0,
1020 0x08d00604,
1021/* 0x024f: timer_done */
1022 0xf404bd00,
1023 0x00f81031,
1024/* 0x0254: send_proc */
1025 0x90f980f9,
1026 0x9805e898,
1027 0x86f004e9,
1028 0x0689b804,
1029 0xc42a0bf4,
1030 0x88940398,
1031 0x1880b604,
1032 0x98008ebb,
1033 0x8a8000fa,
1034 0x018d8000,
1035 0x80028c80,
1036 0x90b6038b,
1037 0x0794f001,
1038 0xf404e980,
1039/* 0x028e: send_done */
1040 0x90fc0231,
1041 0x00f880fc,
1042/* 0x0294: find */
1043 0x87f080f9,
1044 0x0131f458,
1045/* 0x029c: find_loop */
1046 0xb8008a98,
1047 0x0bf406ae,
1048 0x5880b610,
1049 0x026886b1,
1050 0xf4f01bf4,
1051/* 0x02b2: find_done */
1052 0x8eb90132,
1053 0xf880fc02,
1054/* 0x02b9: send */
1055 0x9421f500,
1056 0x9701f402,
1057/* 0x02c2: recv */
1058 0xe89800f8,
1059 0x04e99805,
1060 0xb80132f4,
1061 0x0bf40689,
1062 0x0389c43d,
1063 0xf00180b6,
1064 0xe8800784,
1065 0x02ea9805,
1066 0x8ffef0f9,
1067 0xb9f0f901,
1068 0x999402ef,
1069 0x00e9bb04,
1070 0x9818e0b6,
1071 0xec9803eb,
1072 0x01ed9802,
1073 0xf900ee98,
1074 0xfef0fca5,
1075 0x31f400f8,
1076/* 0x030b: recv_done */
1077 0xf8f0fc01,
1078/* 0x030d: init */
1079 0x0817f100,
1080 0x0614b601,
1081 0xe70011cf,
1082 0xb6010911,
1083 0x14fe0814,
1084 0xe017f100,
1085 0x0013f000,
1086 0xb61c07f0,
1087 0x01d00604, 1145 0x01d00604,
1088 0xf004bd00, 1146 0xf004bd00,
1089 0x07f0ff17, 1147/* 0x0402: init_proc */
1090 0x0604b614, 1148 0xf19858f7,
1091 0xbd0001d0, 1149 0x0016b001,
1092 0x0217f004, 1150 0xf9fa0bf4,
1093 0x080015f1, 1151 0x58f0b615,
1094 0xb61007f0, 1152/* 0x0413: mulu32_32_64 */
1095 0x01d00604, 1153 0xf9f20ef4,
1096 0xf104bd00, 1154 0xf920f910,
1097 0xf0010a17, 1155 0x9540f930,
1098 0x10fe0013, 1156 0xd29510e1,
1099 0x1031f400, 1157 0xbdc4bd10,
1100 0xf00117f0, 1158 0xc0edffb4,
1101 0x04b63807, 1159 0xb9301dff,
1102 0x0001d006, 1160 0x34f10234,
1103 0xf7f004bd, 1161 0x34b6ffff,
1104/* 0x0371: init_proc */ 1162 0x1045b610,
1105 0x01f19858, 1163 0xbb00c3bb,
1106 0xf40016b0, 1164 0xe2ff01b4,
1107 0x15f9fa0b, 1165 0x0234b930,
1108 0xf458f0b6, 1166 0xffff34f1,
1109/* 0x0382: host_send */ 1167 0xb61034b6,
1110 0x17f1f20e, 1168 0xc3bb1045,
1111 0x14b604b0, 1169 0x01b4bb00,
1112 0x0011cf06, 1170 0xbb3012ff,
1113 0x04a027f1, 1171 0x40fc00b3,
1114 0xcf0624b6, 1172 0x20fc30fc,
1115 0x12b80022, 1173 0x00f810fc,
1116 0x320bf406, 1174/* 0x0464: host_send */
1117 0x94071ec4, 1175 0x04b017f1,
1118 0xe0b704ee, 1176 0xcf0614b6,
1119 0xeb980270, 1177 0x27f10011,
1120 0x02ec9803, 1178 0x24b604a0,
1121 0x9801ed98, 1179 0x0022cf06,
1122 0x21f500ee, 1180 0xf40612b8,
1123 0x10b602b9, 1181 0x1ec4320b,
1124 0x0f1ec401, 1182 0x04ee9407,
1125 0x04b007f1, 1183 0x0270e0b7,
1126 0xd00604b6, 1184 0x9803eb98,
1127 0x04bd000e, 1185 0xed9802ec,
1128/* 0x03cb: host_send_done */ 1186 0x00ee9801,
1129 0xf8ba0ef4, 1187 0x034221f5,
1130/* 0x03cd: host_recv */ 1188 0xc40110b6,
1131 0x4917f100, 1189 0x07f10f1e,
1132 0x5413f14e, 1190 0x04b604b0,
1133 0x06e1b852, 1191 0x000ed006,
1134/* 0x03db: host_recv_wait */ 1192 0x0ef404bd,
1135 0xf1aa0bf4, 1193/* 0x04ad: host_send_done */
1136 0xb604cc17, 1194/* 0x04af: host_recv */
1137 0x11cf0614, 1195 0xf100f8ba,
1138 0xc827f100, 1196 0xf14e4917,
1139 0x0624b604, 1197 0xb8525413,
1140 0xf00022cf, 1198 0x0bf406e1,
1141 0x12b80816, 1199/* 0x04bd: host_recv_wait */
1142 0xe60bf406, 1200 0xcc17f1aa,
1143 0xb60723c4, 1201 0x0614b604,
1144 0x30b70434, 1202 0xf10011cf,
1145 0x3b8002f0, 1203 0xb604c827,
1146 0x023c8003, 1204 0x22cf0624,
1147 0x80013d80, 1205 0x0816f000,
1148 0x20b6003e, 1206 0xf40612b8,
1149 0x0f24f001, 1207 0x23c4e60b,
1150 0x04c807f1, 1208 0x0434b607,
1209 0x02f030b7,
1210 0x80033b80,
1211 0x3d80023c,
1212 0x003e8001,
1213 0xf00120b6,
1214 0x07f10f24,
1215 0x04b604c8,
1216 0x0002d006,
1217 0x27f004bd,
1218 0x0007f040,
1151 0xd00604b6, 1219 0xd00604b6,
1152 0x04bd0002, 1220 0x04bd0002,
1153 0xf04027f0, 1221/* 0x0512: host_init */
1154 0x04b60007, 1222 0x17f100f8,
1155 0x0002d006, 1223 0x14b60080,
1156 0x00f804bd, 1224 0x7015f110,
1157/* 0x0430: host_init */ 1225 0xd007f102,
1158 0x008017f1,
1159 0xf11014b6,
1160 0xf1027015,
1161 0xb604d007,
1162 0x01d00604,
1163 0xf104bd00,
1164 0xb6008017,
1165 0x15f11014,
1166 0x07f102f0,
1167 0x04b604dc,
1168 0x0001d006,
1169 0x17f004bd,
1170 0xc407f101,
1171 0x0604b604, 1226 0x0604b604,
1172 0xbd0001d0, 1227 0xbd0001d0,
1173/* 0x046f: memx_func_enter */ 1228 0x8017f104,
1174 0xf000f804, 1229 0x1014b600,
1230 0x02f015f1,
1231 0x04dc07f1,
1232 0xd00604b6,
1233 0x04bd0001,
1234 0xf10117f0,
1235 0xb604c407,
1236 0x01d00604,
1237 0xf804bd00,
1238/* 0x0551: memx_func_enter */
1239 0x2067f100,
1240 0x5d77f116,
1241 0xff73f1f5,
1242 0x026eb9ff,
1243 0xb90421f4,
1244 0x87fd02d8,
1245 0xf960f904,
1246 0xfcd0fc80,
1247 0x3f21f4e0,
1248 0xfffe77f1,
1249 0xffff73f1,
1250 0xf4026eb9,
1251 0xd8b90421,
1252 0x0487fd02,
1253 0x80f960f9,
1254 0xe0fcd0fc,
1255 0xf13f21f4,
1256 0xb926f067,
1257 0x21f4026e,
1258 0x02d8b904,
1259 0xf90487fd,
1260 0xfc80f960,
1261 0xf4e0fcd0,
1262 0x67f03f21,
1263 0xe007f104,
1264 0x0604b607,
1265 0xbd0006d0,
1266/* 0x05bd: memx_func_enter_wait */
1267 0xc067f104,
1268 0x0664b607,
1269 0xf00066cf,
1270 0x0bf40464,
1271 0x2c67f0f3,
1272 0xcf0664b6,
1273 0x06800066,
1274/* 0x05db: memx_func_leave */
1275 0xf000f8ee,
1276 0x64b62c67,
1277 0x0066cf06,
1278 0xf0ef0680,
1175 0x07f10467, 1279 0x07f10467,
1176 0x04b607e0, 1280 0x04b607e4,
1177 0x0006d006, 1281 0x0006d006,
1178/* 0x047e: memx_func_enter_wait */ 1282/* 0x05f6: memx_func_leave_wait */
1179 0x67f104bd, 1283 0x67f104bd,
1180 0x64b607c0, 1284 0x64b607c0,
1181 0x0066cf06, 1285 0x0066cf06,
1182 0xf40464f0, 1286 0xf40464f0,
1183 0x1698f30b, 1287 0x67f1f31b,
1288 0x77f126f0,
1289 0x73f00001,
1290 0x026eb900,
1291 0xb90421f4,
1292 0x87fd02d8,
1293 0xf960f905,
1294 0xfcd0fc80,
1295 0x3f21f4e0,
1296 0x162067f1,
1297 0xf4026eb9,
1298 0xd8b90421,
1299 0x0587fd02,
1300 0x80f960f9,
1301 0xe0fcd0fc,
1302 0xf13f21f4,
1303 0xf00aa277,
1304 0x6eb90073,
1305 0x0421f402,
1306 0xfd02d8b9,
1307 0x60f90587,
1308 0xd0fc80f9,
1309 0x21f4e0fc,
1310/* 0x0663: memx_func_wait_vblank */
1311 0x9800f83f,
1312 0x66b00016,
1313 0x130bf400,
1314 0xf40166b0,
1315 0x0ef4060b,
1316/* 0x0675: memx_func_wait_vblank_head1 */
1317 0x2077f12e,
1318 0x070ef400,
1319/* 0x067c: memx_func_wait_vblank_head0 */
1320 0x000877f1,
1321/* 0x0680: memx_func_wait_vblank_0 */
1322 0x07c467f1,
1323 0xcf0664b6,
1324 0x67fd0066,
1325 0xf31bf404,
1326/* 0x0690: memx_func_wait_vblank_1 */
1327 0x07c467f1,
1328 0xcf0664b6,
1329 0x67fd0066,
1330 0xf30bf404,
1331/* 0x06a0: memx_func_wait_vblank_fini */
1332 0xf80410b6,
1333/* 0x06a5: memx_func_wr32 */
1334 0x00169800,
1335 0xb6011598,
1336 0x60f90810,
1337 0xd0fc50f9,
1338 0x21f4e0fc,
1339 0x0242b63f,
1340 0xf8e91bf4,
1341/* 0x06c1: memx_func_wait */
1342 0x2c87f000,
1343 0xcf0684b6,
1344 0x1e980088,
1345 0x011d9800,
1346 0x98021c98,
1347 0x10b6031b,
1348 0xa421f410,
1349/* 0x06de: memx_func_delay */
1350 0x1e9800f8,
1184 0x0410b600, 1351 0x0410b600,
1185/* 0x0496: memx_func_leave */ 1352 0xf87f21f4,
1186 0x67f000f8, 1353/* 0x06e9: memx_exec */
1187 0xe407f104, 1354 0xf9e0f900,
1355 0x02c1b9d0,
1356/* 0x06f3: memx_exec_next */
1357 0x9802b2b9,
1358 0x10b60013,
1359 0xf034e704,
1360 0xe033e701,
1361 0x0132b601,
1362 0x980c30f0,
1363 0x55f9de35,
1364 0xf40612b8,
1365 0x0b98e41e,
1366 0xef0c98ee,
1367 0xf102cbbb,
1368 0xb607c4b7,
1369 0xbbcf06b4,
1370 0xfcd0fc00,
1371 0x4221f5e0,
1372/* 0x072f: memx_info */
1373 0xf100f803,
1374 0xf103c0c7,
1375 0xf50800b7,
1376 0xf8034221,
1377/* 0x073d: memx_recv */
1378 0x01d6b000,
1379 0xb0a90bf4,
1380 0x0bf400d6,
1381/* 0x074b: memx_init */
1382 0xf800f8e9,
1383/* 0x074d: perf_recv */
1384/* 0x074f: perf_init */
1385 0xf800f800,
1386/* 0x0751: i2c_drive_scl */
1387 0x0036b000,
1388 0xf1110bf4,
1389 0xb607e007,
1390 0x01d00604,
1391 0xf804bd00,
1392/* 0x0765: i2c_drive_scl_lo */
1393 0xe407f100,
1188 0x0604b607, 1394 0x0604b607,
1189 0xbd0006d0, 1395 0xbd0001d0,
1190/* 0x04a5: memx_func_leave_wait */ 1396/* 0x0773: i2c_drive_sda */
1191 0xc067f104, 1397 0xb000f804,
1192 0x0664b607, 1398 0x0bf40036,
1193 0xf00066cf, 1399 0xe007f111,
1194 0x1bf40464, 1400 0x0604b607,
1195/* 0x04b7: memx_func_wr32 */ 1401 0xbd0002d0,
1196 0x9800f8f3, 1402/* 0x0787: i2c_drive_sda_lo */
1197 0x15980016, 1403 0xf100f804,
1198 0x0810b601, 1404 0xb607e407,
1199 0x50f960f9, 1405 0x02d00604,
1200 0xe0fcd0fc, 1406 0xf804bd00,
1201 0xb63f21f4, 1407/* 0x0795: i2c_sense_scl */
1202 0x1bf40242, 1408 0x0132f400,
1203/* 0x04d3: memx_func_wait */ 1409 0x07c437f1,
1204 0xf000f8e9, 1410 0xcf0634b6,
1205 0x84b62c87, 1411 0x31fd0033,
1206 0x0088cf06, 1412 0x060bf404,
1207 0x98001e98, 1413/* 0x07ab: i2c_sense_scl_done */
1208 0x1c98011d, 1414 0xf80131f4,
1209 0x031b9802, 1415/* 0x07ad: i2c_sense_sda */
1210 0xf41010b6, 1416 0x0132f400,
1211 0x00f89c21, 1417 0x07c437f1,
1212/* 0x04f0: memx_func_delay */ 1418 0xcf0634b6,
1213 0xb6001e98, 1419 0x32fd0033,
1214 0x21f40410, 1420 0x060bf404,
1215/* 0x04fb: memx_exec */ 1421/* 0x07c3: i2c_sense_sda_done */
1216 0xf900f87f, 1422 0xf80131f4,
1217 0xb9d0f9e0, 1423/* 0x07c5: i2c_raise_scl */
1218 0xb2b902c1, 1424 0xf140f900,
1219/* 0x0505: memx_exec_next */ 1425 0xf0089847,
1220 0x00139802, 1426 0x21f50137,
1221 0x950410b6, 1427/* 0x07d2: i2c_raise_scl_wait */
1222 0x30f01034, 1428 0xe7f10751,
1223 0xde35980c, 1429 0x21f403e8,
1224 0x12b855f9, 1430 0x9521f57f,
1225 0xec1ef406, 1431 0x0901f407,
1226 0xe0fcd0fc, 1432 0xf40142b6,
1227 0x02b921f5, 1433/* 0x07e6: i2c_raise_scl_done */
1228/* 0x0526: memx_info */ 1434 0x40fcef1b,
1229 0xc7f100f8, 1435/* 0x07ea: i2c_start */
1230 0xb7f103ac, 1436 0x21f500f8,
1231 0x21f50800, 1437 0x11f40795,
1232 0x00f802b9, 1438 0xad21f50d,
1233/* 0x0534: memx_recv */ 1439 0x0611f407,
1234 0xf401d6b0, 1440/* 0x07fb: i2c_start_rep */
1235 0xd6b0c40b, 1441 0xf0300ef4,
1236 0xe90bf400,
1237/* 0x0542: memx_init */
1238 0x00f800f8,
1239/* 0x0544: perf_recv */
1240/* 0x0546: perf_init */
1241 0x00f800f8,
1242/* 0x0548: i2c_drive_scl */
1243 0xf40036b0,
1244 0x07f1110b,
1245 0x04b607e0,
1246 0x0001d006,
1247 0x00f804bd,
1248/* 0x055c: i2c_drive_scl_lo */
1249 0x07e407f1,
1250 0xd00604b6,
1251 0x04bd0001,
1252/* 0x056a: i2c_drive_sda */
1253 0x36b000f8,
1254 0x110bf400,
1255 0x07e007f1,
1256 0xd00604b6,
1257 0x04bd0002,
1258/* 0x057e: i2c_drive_sda_lo */
1259 0x07f100f8,
1260 0x04b607e4,
1261 0x0002d006,
1262 0x00f804bd,
1263/* 0x058c: i2c_sense_scl */
1264 0xf10132f4,
1265 0xb607c437,
1266 0x33cf0634,
1267 0x0431fd00,
1268 0xf4060bf4,
1269/* 0x05a2: i2c_sense_scl_done */
1270 0x00f80131,
1271/* 0x05a4: i2c_sense_sda */
1272 0xf10132f4,
1273 0xb607c437,
1274 0x33cf0634,
1275 0x0432fd00,
1276 0xf4060bf4,
1277/* 0x05ba: i2c_sense_sda_done */
1278 0x00f80131,
1279/* 0x05bc: i2c_raise_scl */
1280 0x47f140f9,
1281 0x37f00898,
1282 0x4821f501,
1283/* 0x05c9: i2c_raise_scl_wait */
1284 0xe8e7f105,
1285 0x7f21f403,
1286 0x058c21f5,
1287 0xb60901f4,
1288 0x1bf40142,
1289/* 0x05dd: i2c_raise_scl_done */
1290 0xf840fcef,
1291/* 0x05e1: i2c_start */
1292 0x8c21f500,
1293 0x0d11f405,
1294 0x05a421f5,
1295 0xf40611f4,
1296/* 0x05f2: i2c_start_rep */
1297 0x37f0300e,
1298 0x4821f500,
1299 0x0137f005,
1300 0x056a21f5,
1301 0xb60076bb,
1302 0x50f90465,
1303 0xbb046594,
1304 0x50bd0256,
1305 0xfc0475fd,
1306 0xbc21f550,
1307 0x0464b605,
1308/* 0x061f: i2c_start_send */
1309 0xf01f11f4,
1310 0x21f50037, 1442 0x21f50037,
1311 0xe7f1056a, 1443 0x37f00751,
1312 0x21f41388, 1444 0x7321f501,
1313 0x0037f07f, 1445 0x0076bb07,
1314 0x054821f5, 1446 0xf90465b6,
1315 0x1388e7f1, 1447 0x04659450,
1316/* 0x063b: i2c_start_out */ 1448 0xbd0256bb,
1317 0xf87f21f4, 1449 0x0475fd50,
1318/* 0x063d: i2c_stop */ 1450 0x21f550fc,
1319 0x0037f000, 1451 0x64b607c5,
1320 0x054821f5, 1452 0x1f11f404,
1453/* 0x0828: i2c_start_send */
1321 0xf50037f0, 1454 0xf50037f0,
1322 0xf1056a21, 1455 0xf1077321,
1323 0xf403e8e7, 1456 0xf41388e7,
1324 0x37f07f21, 1457 0x37f07f21,
1325 0x4821f501, 1458 0x5121f500,
1326 0x88e7f105, 1459 0x88e7f107,
1327 0x7f21f413, 1460 0x7f21f413,
1328 0xf50137f0, 1461/* 0x0844: i2c_start_out */
1329 0xf1056a21, 1462/* 0x0846: i2c_stop */
1330 0xf41388e7, 1463 0x37f000f8,
1331 0x00f87f21, 1464 0x5121f500,
1332/* 0x0670: i2c_bitw */ 1465 0x0037f007,
1333 0x056a21f5, 1466 0x077321f5,
1334 0x03e8e7f1, 1467 0x03e8e7f1,
1335 0xbb7f21f4, 1468 0xf07f21f4,
1336 0x65b60076, 1469 0x21f50137,
1337 0x9450f904, 1470 0xe7f10751,
1338 0x56bb0465,
1339 0xfd50bd02,
1340 0x50fc0475,
1341 0x05bc21f5,
1342 0xf40464b6,
1343 0xe7f11811,
1344 0x21f41388, 1471 0x21f41388,
1345 0x0037f07f, 1472 0x0137f07f,
1346 0x054821f5, 1473 0x077321f5,
1347 0x1388e7f1, 1474 0x1388e7f1,
1348/* 0x06af: i2c_bitw_out */
1349 0xf87f21f4, 1475 0xf87f21f4,
1350/* 0x06b1: i2c_bitr */ 1476/* 0x0879: i2c_bitw */
1351 0x0137f000, 1477 0x7321f500,
1352 0x056a21f5, 1478 0xe8e7f107,
1353 0x03e8e7f1, 1479 0x7f21f403,
1354 0xbb7f21f4, 1480 0xb60076bb,
1355 0x65b60076, 1481 0x50f90465,
1356 0x9450f904, 1482 0xbb046594,
1357 0x56bb0465, 1483 0x50bd0256,
1358 0xfd50bd02, 1484 0xfc0475fd,
1359 0x50fc0475, 1485 0xc521f550,
1360 0x05bc21f5, 1486 0x0464b607,
1361 0xf40464b6, 1487 0xf11811f4,
1362 0x21f51b11, 1488 0xf41388e7,
1363 0x37f005a4, 1489 0x37f07f21,
1364 0x4821f500, 1490 0x5121f500,
1365 0x88e7f105, 1491 0x88e7f107,
1366 0x7f21f413, 1492 0x7f21f413,
1367 0xf4013cf0, 1493/* 0x08b8: i2c_bitw_out */
1368/* 0x06f6: i2c_bitr_done */ 1494/* 0x08ba: i2c_bitr */
1369 0x00f80131, 1495 0x37f000f8,
1370/* 0x06f8: i2c_get_byte */ 1496 0x7321f501,
1371 0xf00057f0, 1497 0xe8e7f107,
1372/* 0x06fe: i2c_get_byte_next */ 1498 0x7f21f403,
1373 0x54b60847, 1499 0xb60076bb,
1500 0x50f90465,
1501 0xbb046594,
1502 0x50bd0256,
1503 0xfc0475fd,
1504 0xc521f550,
1505 0x0464b607,
1506 0xf51b11f4,
1507 0xf007ad21,
1508 0x21f50037,
1509 0xe7f10751,
1510 0x21f41388,
1511 0x013cf07f,
1512/* 0x08ff: i2c_bitr_done */
1513 0xf80131f4,
1514/* 0x0901: i2c_get_byte */
1515 0x0057f000,
1516/* 0x0907: i2c_get_byte_next */
1517 0xb60847f0,
1518 0x76bb0154,
1519 0x0465b600,
1520 0x659450f9,
1521 0x0256bb04,
1522 0x75fd50bd,
1523 0xf550fc04,
1524 0xb608ba21,
1525 0x11f40464,
1526 0x0553fd2b,
1527 0xf40142b6,
1528 0x37f0d81b,
1374 0x0076bb01, 1529 0x0076bb01,
1375 0xf90465b6, 1530 0xf90465b6,
1376 0x04659450, 1531 0x04659450,
1377 0xbd0256bb, 1532 0xbd0256bb,
1378 0x0475fd50, 1533 0x0475fd50,
1379 0x21f550fc, 1534 0x21f550fc,
1380 0x64b606b1, 1535 0x64b60879,
1381 0x2b11f404, 1536/* 0x0951: i2c_get_byte_done */
1382 0xb60553fd, 1537/* 0x0953: i2c_put_byte */
1383 0x1bf40142, 1538 0xf000f804,
1384 0x0137f0d8, 1539/* 0x0956: i2c_put_byte_next */
1385 0xb60076bb, 1540 0x42b60847,
1386 0x50f90465, 1541 0x3854ff01,
1387 0xbb046594,
1388 0x50bd0256,
1389 0xfc0475fd,
1390 0x7021f550,
1391 0x0464b606,
1392/* 0x0748: i2c_get_byte_done */
1393/* 0x074a: i2c_put_byte */
1394 0x47f000f8,
1395/* 0x074d: i2c_put_byte_next */
1396 0x0142b608,
1397 0xbb3854ff,
1398 0x65b60076,
1399 0x9450f904,
1400 0x56bb0465,
1401 0xfd50bd02,
1402 0x50fc0475,
1403 0x067021f5,
1404 0xf40464b6,
1405 0x46b03411,
1406 0xd81bf400,
1407 0xb60076bb, 1542 0xb60076bb,
1408 0x50f90465, 1543 0x50f90465,
1409 0xbb046594, 1544 0xbb046594,
1410 0x50bd0256, 1545 0x50bd0256,
1411 0xfc0475fd, 1546 0xfc0475fd,
1412 0xb121f550, 1547 0x7921f550,
1413 0x0464b606, 1548 0x0464b608,
1414 0xbb0f11f4, 1549 0xb03411f4,
1415 0x36b00076, 1550 0x1bf40046,
1416 0x061bf401, 1551 0x0076bbd8,
1417/* 0x07a3: i2c_put_byte_done */
1418 0xf80132f4,
1419/* 0x07a5: i2c_addr */
1420 0x0076bb00,
1421 0xf90465b6, 1552 0xf90465b6,
1422 0x04659450, 1553 0x04659450,
1423 0xbd0256bb, 1554 0xbd0256bb,
1424 0x0475fd50, 1555 0x0475fd50,
1425 0x21f550fc, 1556 0x21f550fc,
1426 0x64b605e1, 1557 0x64b608ba,
1427 0x2911f404, 1558 0x0f11f404,
1428 0x012ec3e7, 1559 0xb00076bb,
1429 0xfd0134b6, 1560 0x1bf40136,
1430 0x76bb0553, 1561 0x0132f406,
1562/* 0x09ac: i2c_put_byte_done */
1563/* 0x09ae: i2c_addr */
1564 0x76bb00f8,
1431 0x0465b600, 1565 0x0465b600,
1432 0x659450f9, 1566 0x659450f9,
1433 0x0256bb04, 1567 0x0256bb04,
1434 0x75fd50bd, 1568 0x75fd50bd,
1435 0xf550fc04, 1569 0xf550fc04,
1436 0xb6074a21, 1570 0xb607ea21,
1437/* 0x07ea: i2c_addr_done */ 1571 0x11f40464,
1438 0x00f80464, 1572 0x2ec3e729,
1439/* 0x07ec: i2c_acquire_addr */ 1573 0x0134b601,
1440 0xb6f8cec7, 1574 0xbb0553fd,
1441 0xe0b702e4,
1442 0xee980bfc,
1443/* 0x07fb: i2c_acquire */
1444 0xf500f800,
1445 0xf407ec21,
1446 0xd9f00421,
1447 0x3f21f403,
1448/* 0x080a: i2c_release */
1449 0x21f500f8,
1450 0x21f407ec,
1451 0x03daf004,
1452 0xf83f21f4,
1453/* 0x0819: i2c_recv */
1454 0x0132f400,
1455 0xb6f8c1c7,
1456 0x16b00214,
1457 0x3a1ff528,
1458 0xd413a001,
1459 0x0032980b,
1460 0x0bac13a0,
1461 0xf4003198,
1462 0xd0f90231,
1463 0xd0f9e0f9,
1464 0x000067f1,
1465 0x100063f1,
1466 0xbb016792,
1467 0x65b60076, 1575 0x65b60076,
1468 0x9450f904, 1576 0x9450f904,
1469 0x56bb0465, 1577 0x56bb0465,
1470 0xfd50bd02, 1578 0xfd50bd02,
1471 0x50fc0475, 1579 0x50fc0475,
1472 0x07fb21f5, 1580 0x095321f5,
1473 0xfc0464b6, 1581/* 0x09f3: i2c_addr_done */
1474 0x00d6b0d0, 1582 0xf80464b6,
1475 0x00b31bf5, 1583/* 0x09f5: i2c_acquire_addr */
1476 0xbb0057f0, 1584 0xf8cec700,
1585 0xb702e4b6,
1586 0x980c10e0,
1587 0x00f800ee,
1588/* 0x0a04: i2c_acquire */
1589 0x09f521f5,
1590 0xf00421f4,
1591 0x21f403d9,
1592/* 0x0a13: i2c_release */
1593 0xf500f83f,
1594 0xf409f521,
1595 0xdaf00421,
1596 0x3f21f403,
1597/* 0x0a22: i2c_recv */
1598 0x32f400f8,
1599 0xf8c1c701,
1600 0xb00214b6,
1601 0x1ff52816,
1602 0x13a0013a,
1603 0x32980be8,
1604 0xc013a000,
1605 0x0031980b,
1606 0xf90231f4,
1607 0xf9e0f9d0,
1608 0x0067f1d0,
1609 0x0063f100,
1610 0x01679210,
1611 0xb60076bb,
1612 0x50f90465,
1613 0xbb046594,
1614 0x50bd0256,
1615 0xfc0475fd,
1616 0x0421f550,
1617 0x0464b60a,
1618 0xd6b0d0fc,
1619 0xb31bf500,
1620 0x0057f000,
1621 0xb60076bb,
1622 0x50f90465,
1623 0xbb046594,
1624 0x50bd0256,
1625 0xfc0475fd,
1626 0xae21f550,
1627 0x0464b609,
1628 0x00d011f5,
1629 0xbbe0c5c7,
1477 0x65b60076, 1630 0x65b60076,
1478 0x9450f904, 1631 0x9450f904,
1479 0x56bb0465, 1632 0x56bb0465,
1480 0xfd50bd02, 1633 0xfd50bd02,
1481 0x50fc0475, 1634 0x50fc0475,
1482 0x07a521f5, 1635 0x095321f5,
1483 0xf50464b6, 1636 0xf50464b6,
1484 0xc700d011, 1637 0xf000ad11,
1485 0x76bbe0c5, 1638 0x76bb0157,
1486 0x0465b600, 1639 0x0465b600,
1487 0x659450f9, 1640 0x659450f9,
1488 0x0256bb04, 1641 0x0256bb04,
1489 0x75fd50bd, 1642 0x75fd50bd,
1490 0xf550fc04, 1643 0xf550fc04,
1491 0xb6074a21, 1644 0xb609ae21,
1492 0x11f50464, 1645 0x11f50464,
1493 0x57f000ad, 1646 0x76bb008a,
1494 0x0076bb01, 1647 0x0465b600,
1495 0xf90465b6, 1648 0x659450f9,
1496 0x04659450, 1649 0x0256bb04,
1497 0xbd0256bb, 1650 0x75fd50bd,
1498 0x0475fd50, 1651 0xf550fc04,
1499 0x21f550fc, 1652 0xb6090121,
1500 0x64b607a5, 1653 0x11f40464,
1501 0x8a11f504, 1654 0xe05bcb6a,
1502 0x0076bb00, 1655 0xb60076bb,
1503 0xf90465b6, 1656 0x50f90465,
1504 0x04659450, 1657 0xbb046594,
1505 0xbd0256bb, 1658 0x50bd0256,
1506 0x0475fd50, 1659 0xfc0475fd,
1507 0x21f550fc, 1660 0x4621f550,
1508 0x64b606f8, 1661 0x0464b608,
1509 0x6a11f404, 1662 0xbd025bb9,
1510 0xbbe05bcb, 1663 0x430ef474,
1511 0x65b60076, 1664/* 0x0b28: i2c_recv_not_rd08 */
1512 0x9450f904, 1665 0xf401d6b0,
1513 0x56bb0465, 1666 0x57f03d1b,
1514 0xfd50bd02, 1667 0xae21f500,
1515 0x50fc0475, 1668 0x3311f409,
1516 0x063d21f5, 1669 0xf5e0c5c7,
1517 0xb90464b6, 1670 0xf4095321,
1518 0x74bd025b, 1671 0x57f02911,
1519/* 0x091f: i2c_recv_not_rd08 */ 1672 0xae21f500,
1520 0xb0430ef4, 1673 0x1f11f409,
1521 0x1bf401d6, 1674 0xf5e0b5c7,
1522 0x0057f03d, 1675 0xf4095321,
1523 0x07a521f5, 1676 0x21f51511,
1524 0xc73311f4, 1677 0x74bd0846,
1525 0x21f5e0c5, 1678 0xf408c5c7,
1526 0x11f4074a, 1679 0x32f4091b,
1527 0x0057f029, 1680 0x030ef402,
1528 0x07a521f5, 1681/* 0x0b68: i2c_recv_not_wr08 */
1529 0xc71f11f4, 1682/* 0x0b68: i2c_recv_done */
1530 0x21f5e0b5, 1683 0xf5f8cec7,
1531 0x11f4074a, 1684 0xfc0a1321,
1532 0x3d21f515, 1685 0xf4d0fce0,
1533 0xc774bd06, 1686 0x7cb90a12,
1534 0x1bf408c5, 1687 0x4221f502,
1535 0x0232f409, 1688/* 0x0b7d: i2c_recv_exit */
1536/* 0x095f: i2c_recv_not_wr08 */ 1689/* 0x0b7f: i2c_init */
1537/* 0x095f: i2c_recv_done */ 1690 0xf800f803,
1538 0xc7030ef4, 1691/* 0x0b81: test_recv */
1539 0x21f5f8ce, 1692 0xd817f100,
1540 0xe0fc080a, 1693 0x0614b605,
1541 0x12f4d0fc, 1694 0xb60011cf,
1542 0x027cb90a, 1695 0x07f10110,
1543 0x02b921f5, 1696 0x04b605d8,
1544/* 0x0974: i2c_recv_exit */ 1697 0x0001d006,
1545/* 0x0976: i2c_init */ 1698 0xe7f104bd,
1699 0xe3f1d900,
1700 0x21f5134f,
1701 0x00f80262,
1702/* 0x0ba8: test_init */
1703 0x0800e7f1,
1704 0x026221f5,
1705/* 0x0bb2: idle_recv */
1546 0x00f800f8, 1706 0x00f800f8,
1547/* 0x0978: test_recv */ 1707/* 0x0bb4: idle */
1548 0x05d817f1, 1708 0xf10031f4,
1549 0xcf0614b6, 1709 0xb605d417,
1550 0x10b60011, 1710 0x11cf0614,
1551 0xd807f101, 1711 0x0110b600,
1552 0x0604b605, 1712 0x05d407f1,
1553 0xbd0001d0, 1713 0xd00604b6,
1554 0x00e7f104, 1714 0x04bd0001,
1555 0x4fe3f1d9, 1715/* 0x0bd0: idle_loop */
1556 0xf521f513, 1716 0xf45817f0,
1557/* 0x099f: test_init */ 1717/* 0x0bd6: idle_proc */
1558 0xf100f801, 1718/* 0x0bd6: idle_proc_exec */
1559 0xf50800e7, 1719 0x10f90232,
1560 0xf801f521, 1720 0xf5021eb9,
1561/* 0x09a9: idle_recv */ 1721 0xfc034b21,
1562/* 0x09ab: idle */ 1722 0x0911f410,
1563 0xf400f800, 1723 0xf40231f4,
1564 0x17f10031, 1724/* 0x0bea: idle_proc_next */
1565 0x14b605d4, 1725 0x10b6ef0e,
1566 0x0011cf06, 1726 0x061fb858,
1567 0xf10110b6, 1727 0xf4e61bf4,
1568 0xb605d407, 1728 0x28f4dd02,
1569 0x01d00604, 1729 0xbb0ef400,
1570/* 0x09c7: idle_loop */
1571 0xf004bd00,
1572 0x32f45817,
1573/* 0x09cd: idle_proc */
1574/* 0x09cd: idle_proc_exec */
1575 0xb910f902,
1576 0x21f5021e,
1577 0x10fc02c2,
1578 0xf40911f4,
1579 0x0ef40231,
1580/* 0x09e1: idle_proc_next */
1581 0x5810b6ef,
1582 0xf4061fb8,
1583 0x02f4e61b,
1584 0x0028f4dd,
1585 0x00bb0ef4,
1586 0x00000000,
1587 0x00000000,
1588 0x00000000, 1730 0x00000000,
1589}; 1731};
diff --git a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvd0.fuc b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvd0.fuc
index 8a89dfe41ce1..b85443261569 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvd0.fuc
+++ b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvd0.fuc
@@ -23,6 +23,7 @@
23 */ 23 */
24 24
25#define NVKM_PPWR_CHIPSET GF119 25#define NVKM_PPWR_CHIPSET GF119
26#define HW_TICKS_PER_US 324
26 27
27//#define NVKM_FALCON_PC24 28//#define NVKM_FALCON_PC24
28#define NVKM_FALCON_UNSHIFTED_IO 29#define NVKM_FALCON_UNSHIFTED_IO
@@ -34,6 +35,7 @@
34.section #nvd0_pwr_data 35.section #nvd0_pwr_data
35#define INCLUDE_PROC 36#define INCLUDE_PROC
36#include "kernel.fuc" 37#include "kernel.fuc"
38#include "arith.fuc"
37#include "host.fuc" 39#include "host.fuc"
38#include "memx.fuc" 40#include "memx.fuc"
39#include "perf.fuc" 41#include "perf.fuc"
@@ -44,6 +46,7 @@
44 46
45#define INCLUDE_DATA 47#define INCLUDE_DATA
46#include "kernel.fuc" 48#include "kernel.fuc"
49#include "arith.fuc"
47#include "host.fuc" 50#include "host.fuc"
48#include "memx.fuc" 51#include "memx.fuc"
49#include "perf.fuc" 52#include "perf.fuc"
@@ -56,6 +59,7 @@
56.section #nvd0_pwr_code 59.section #nvd0_pwr_code
57#define INCLUDE_CODE 60#define INCLUDE_CODE
58#include "kernel.fuc" 61#include "kernel.fuc"
62#include "arith.fuc"
59#include "host.fuc" 63#include "host.fuc"
60#include "memx.fuc" 64#include "memx.fuc"
61#include "perf.fuc" 65#include "perf.fuc"
diff --git a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvd0.fuc.h b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvd0.fuc.h
index 8d369b3faaba..12d86f72ad10 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvd0.fuc.h
+++ b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvd0.fuc.h
@@ -24,8 +24,8 @@ uint32_t nvd0_pwr_data[] = {
24 0x00000000, 24 0x00000000,
25/* 0x0058: proc_list_head */ 25/* 0x0058: proc_list_head */
26 0x54534f48, 26 0x54534f48,
27 0x000003be, 27 0x0000049d,
28 0x00000367, 28 0x00000446,
29 0x00000000, 29 0x00000000,
30 0x00000000, 30 0x00000000,
31 0x00000000, 31 0x00000000,
@@ -46,8 +46,8 @@ uint32_t nvd0_pwr_data[] = {
46 0x00000000, 46 0x00000000,
47 0x00000000, 47 0x00000000,
48 0x584d454d, 48 0x584d454d,
49 0x000004b8, 49 0x00000678,
50 0x000004aa, 50 0x0000066a,
51 0x00000000, 51 0x00000000,
52 0x00000000, 52 0x00000000,
53 0x00000000, 53 0x00000000,
@@ -68,8 +68,8 @@ uint32_t nvd0_pwr_data[] = {
68 0x00000000, 68 0x00000000,
69 0x00000000, 69 0x00000000,
70 0x46524550, 70 0x46524550,
71 0x000004bc, 71 0x0000067c,
72 0x000004ba, 72 0x0000067a,
73 0x00000000, 73 0x00000000,
74 0x00000000, 74 0x00000000,
75 0x00000000, 75 0x00000000,
@@ -90,8 +90,8 @@ uint32_t nvd0_pwr_data[] = {
90 0x00000000, 90 0x00000000,
91 0x00000000, 91 0x00000000,
92 0x5f433249, 92 0x5f433249,
93 0x000008d7, 93 0x00000a97,
94 0x0000077a, 94 0x0000093a,
95 0x00000000, 95 0x00000000,
96 0x00000000, 96 0x00000000,
97 0x00000000, 97 0x00000000,
@@ -112,8 +112,8 @@ uint32_t nvd0_pwr_data[] = {
112 0x00000000, 112 0x00000000,
113 0x00000000, 113 0x00000000,
114 0x54534554, 114 0x54534554,
115 0x000008fa, 115 0x00000aba,
116 0x000008d9, 116 0x00000a99,
117 0x00000000, 117 0x00000000,
118 0x00000000, 118 0x00000000,
119 0x00000000, 119 0x00000000,
@@ -134,8 +134,8 @@ uint32_t nvd0_pwr_data[] = {
134 0x00000000, 134 0x00000000,
135 0x00000000, 135 0x00000000,
136 0x454c4449, 136 0x454c4449,
137 0x00000906, 137 0x00000ac6,
138 0x00000904, 138 0x00000ac4,
139 0x00000000, 139 0x00000000,
140 0x00000000, 140 0x00000000,
141 0x00000000, 141 0x00000000,
@@ -227,24 +227,31 @@ uint32_t nvd0_pwr_data[] = {
227 0x00000000, 227 0x00000000,
228 0x00000000, 228 0x00000000,
229/* 0x0370: memx_func_head */ 229/* 0x0370: memx_func_head */
230 0x00010000,
231 0x00000000,
232 0x000003f4,
233/* 0x037c: memx_func_next */
234 0x00000001, 230 0x00000001,
235 0x00000000, 231 0x00000000,
236 0x00000415, 232 0x000004d3,
233/* 0x037c: memx_func_next */
237 0x00000002, 234 0x00000002,
235 0x00000000,
236 0x00000554,
237 0x00000003,
238 0x00000002, 238 0x00000002,
239 0x00000430, 239 0x000005d8,
240 0x00040003, 240 0x00040004,
241 0x00000000,
242 0x000005f4,
243 0x00010005,
244 0x00000000,
245 0x0000060e,
246 0x00010006,
247 0x00000000,
248 0x000005d3,
249/* 0x03b8: memx_func_tail */
250/* 0x03b8: memx_ts_start */
241 0x00000000, 251 0x00000000,
242 0x0000044c, 252/* 0x03bc: memx_ts_end */
243 0x00010004,
244 0x00000000, 253 0x00000000,
245 0x00000466, 254/* 0x03c0: memx_data_head */
246/* 0x03ac: memx_func_tail */
247/* 0x03ac: memx_data_head */
248 0x00000000, 255 0x00000000,
249 0x00000000, 256 0x00000000,
250 0x00000000, 257 0x00000000,
@@ -757,8 +764,8 @@ uint32_t nvd0_pwr_data[] = {
757 0x00000000, 764 0x00000000,
758 0x00000000, 765 0x00000000,
759 0x00000000, 766 0x00000000,
760/* 0x0bac: memx_data_tail */ 767/* 0x0bc0: memx_data_tail */
761/* 0x0bac: i2c_scl_map */ 768/* 0x0bc0: i2c_scl_map */
762 0x00000400, 769 0x00000400,
763 0x00000800, 770 0x00000800,
764 0x00001000, 771 0x00001000,
@@ -769,7 +776,7 @@ uint32_t nvd0_pwr_data[] = {
769 0x00020000, 776 0x00020000,
770 0x00040000, 777 0x00040000,
771 0x00080000, 778 0x00080000,
772/* 0x0bd4: i2c_sda_map */ 779/* 0x0be8: i2c_sda_map */
773 0x00100000, 780 0x00100000,
774 0x00200000, 781 0x00200000,
775 0x00400000, 782 0x00400000,
@@ -781,10 +788,69 @@ uint32_t nvd0_pwr_data[] = {
781 0x10000000, 788 0x10000000,
782 0x20000000, 789 0x20000000,
783 0x00000000, 790 0x00000000,
791 0x00000000,
792 0x00000000,
793 0x00000000,
794 0x00000000,
795 0x00000000,
796 0x00000000,
797 0x00000000,
798 0x00000000,
799 0x00000000,
800 0x00000000,
801 0x00000000,
802 0x00000000,
803 0x00000000,
804 0x00000000,
805 0x00000000,
806 0x00000000,
807 0x00000000,
808 0x00000000,
809 0x00000000,
810 0x00000000,
811 0x00000000,
812 0x00000000,
813 0x00000000,
814 0x00000000,
815 0x00000000,
816 0x00000000,
817 0x00000000,
818 0x00000000,
819 0x00000000,
820 0x00000000,
821 0x00000000,
822 0x00000000,
823 0x00000000,
824 0x00000000,
825 0x00000000,
826 0x00000000,
827 0x00000000,
828 0x00000000,
829 0x00000000,
830 0x00000000,
831 0x00000000,
832 0x00000000,
833 0x00000000,
834 0x00000000,
835 0x00000000,
836 0x00000000,
837 0x00000000,
838 0x00000000,
839 0x00000000,
840 0x00000000,
841 0x00000000,
842 0x00000000,
843 0x00000000,
844 0x00000000,
845 0x00000000,
846 0x00000000,
847 0x00000000,
848 0x00000000,
849 0x00000000,
784}; 850};
785 851
786uint32_t nvd0_pwr_code[] = { 852uint32_t nvd0_pwr_code[] = {
787 0x02bf0ef5, 853 0x034d0ef5,
788/* 0x0004: rd32 */ 854/* 0x0004: rd32 */
789 0x07a007f1, 855 0x07a007f1,
790 0xbd000ed0, 856 0xbd000ed0,
@@ -814,17 +880,20 @@ uint32_t nvd0_pwr_code[] = {
814 0xd4f100dd, 880 0xd4f100dd,
815 0x1bf47000, 881 0x1bf47000,
816/* 0x0067: nsec */ 882/* 0x0067: nsec */
817 0xf000f8f5, 883 0xf900f8f5,
884 0xf080f990,
818 0x88cf2c87, 885 0x88cf2c87,
819/* 0x006d: nsec_loop */ 886/* 0x0071: nsec_loop */
820 0x2c97f000, 887 0x2c97f000,
821 0xbb0099cf, 888 0xbb0099cf,
822 0x9eb80298, 889 0x9eb80298,
823 0xf41ef406, 890 0xf41ef406,
824/* 0x007e: wait */ 891 0x90fc80fc,
825 0x87f000f8, 892/* 0x0086: wait */
893 0x90f900f8,
894 0x87f080f9,
826 0x0088cf2c, 895 0x0088cf2c,
827/* 0x0084: wait_loop */ 896/* 0x0090: wait_loop */
828 0xf402eeb9, 897 0xf402eeb9,
829 0xdab90421, 898 0xdab90421,
830 0x04adfd02, 899 0x04adfd02,
@@ -833,28 +902,29 @@ uint32_t nvd0_pwr_code[] = {
833 0x0099cf2c, 902 0x0099cf2c,
834 0xb80298bb, 903 0xb80298bb,
835 0x1ef4069b, 904 0x1ef4069b,
836/* 0x00a5: wait_done */ 905/* 0x00b1: wait_done */
837/* 0x00a7: intr_watchdog */ 906 0xfc80fce2,
838 0x9800f8e2, 907/* 0x00b7: intr_watchdog */
908 0x9800f890,
839 0x96b003e9, 909 0x96b003e9,
840 0x2a0bf400, 910 0x2a0bf400,
841 0xbb9a0a98, 911 0xbb9a0a98,
842 0x1cf4029a, 912 0x1cf4029a,
843 0x01d7f00f, 913 0x01d7f00f,
844 0x020621f5, 914 0x028c21f5,
845 0x0ef494bd, 915 0x0ef494bd,
846/* 0x00c5: intr_watchdog_next_time */ 916/* 0x00d5: intr_watchdog_next_time */
847 0x9b0a9815, 917 0x9b0a9815,
848 0xf400a6b0, 918 0xf400a6b0,
849 0x9ab8090b, 919 0x9ab8090b,
850 0x061cf406, 920 0x061cf406,
851/* 0x00d4: intr_watchdog_next_time_set */ 921/* 0x00e4: intr_watchdog_next_time_set */
852/* 0x00d7: intr_watchdog_next_proc */ 922/* 0x00e7: intr_watchdog_next_proc */
853 0x809b0980, 923 0x809b0980,
854 0xe0b603e9, 924 0xe0b603e9,
855 0x68e6b158, 925 0x68e6b158,
856 0xc61bf402, 926 0xc61bf402,
857/* 0x00e6: intr */ 927/* 0x00f6: intr */
858 0x00f900f8, 928 0x00f900f8,
859 0x80f904bd, 929 0x80f904bd,
860 0xa0f990f9, 930 0xa0f990f9,
@@ -872,12 +942,12 @@ uint32_t nvd0_pwr_code[] = {
872 0x0bf40289, 942 0x0bf40289,
873 0x9b008020, 943 0x9b008020,
874 0xf458e7f0, 944 0xf458e7f0,
875 0x0998a721, 945 0x0998b721,
876 0x0096b09b, 946 0x0096b09b,
877 0xf00e0bf4, 947 0xf00e0bf4,
878 0x09d03407, 948 0x09d03407,
879 0x8004bd00, 949 0x8004bd00,
880/* 0x013e: intr_skip_watchdog */ 950/* 0x014e: intr_skip_watchdog */
881 0x89e49a09, 951 0x89e49a09,
882 0x0bf40800, 952 0x0bf40800,
883 0x8897f13c, 953 0x8897f13c,
@@ -889,20 +959,20 @@ uint32_t nvd0_pwr_code[] = {
889 0xf14f48e7, 959 0xf14f48e7,
890 0xf05453e3, 960 0xf05453e3,
891 0x21f500d7, 961 0x21f500d7,
892 0xc0fc026b, 962 0xc0fc02f1,
893 0x04c007f1, 963 0x04c007f1,
894 0xbd000cd0, 964 0xbd000cd0,
895/* 0x0175: intr_subintr_skip_fifo */ 965/* 0x0185: intr_subintr_skip_fifo */
896 0x8807f104, 966 0x8807f104,
897 0x0009d006, 967 0x0009d006,
898/* 0x017e: intr_skip_subintr */ 968/* 0x018e: intr_skip_subintr */
899 0x89c404bd, 969 0x89c404bd,
900 0x070bf420, 970 0x070bf420,
901 0xffbfa4f1, 971 0xffbfa4f1,
902/* 0x0188: intr_skip_pause */ 972/* 0x0198: intr_skip_pause */
903 0xf44089c4, 973 0xf44089c4,
904 0xa4f1070b, 974 0xa4f1070b,
905/* 0x0192: intr_skip_user0 */ 975/* 0x01a2: intr_skip_user0 */
906 0x07f0ffbf, 976 0x07f0ffbf,
907 0x0008d004, 977 0x0008d004,
908 0x80fc04bd, 978 0x80fc04bd,
@@ -912,189 +982,298 @@ uint32_t nvd0_pwr_code[] = {
912 0xfca0fcb0, 982 0xfca0fcb0,
913 0xfc80fc90, 983 0xfc80fc90,
914 0x0032f400, 984 0x0032f400,
915/* 0x01b6: timer */ 985/* 0x01c6: ticks_from_ns */
916 0x32f401f8, 986 0xc0f901f8,
917 0x03f89810, 987 0xd7f1b0f9,
918 0xf40086b0, 988 0xd3f00144,
919 0xfe80421c, 989 0xb321f500,
920 0x3807f003, 990 0xe8ccec03,
991 0x00b4b003,
992 0xec120bf4,
993 0xf103e8ee,
994 0xf00144d7,
995 0x21f500d3,
996/* 0x01ee: ticks_from_ns_quit */
997 0xceb903b3,
998 0xfcb0fc02,
999/* 0x01f7: ticks_from_us */
1000 0xf900f8c0,
1001 0xf1b0f9c0,
1002 0xf00144d7,
1003 0x21f500d3,
1004 0xceb903b3,
1005 0x00b4b002,
1006 0xbd050bf4,
1007/* 0x0211: ticks_from_us_quit */
1008 0xfcb0fce4,
1009/* 0x0217: ticks_to_us */
1010 0xf100f8c0,
1011 0xf00144d7,
1012 0xedff00d3,
1013/* 0x0223: timer */
1014 0xf900f8ec,
1015 0xf480f990,
1016 0xf8981032,
1017 0x0086b003,
1018 0xbd531cf4,
1019 0x3807f084,
921 0xbd0008d0, 1020 0xbd0008d0,
922 0x0887f004, 1021 0x3487f004,
923 0xf00088cf, 1022 0x980088cf,
924 0x1bf40284, 1023 0x98bb9a09,
925 0x3487f020, 1024 0x00e9bb02,
926 0xb80088cf, 1025 0xf003fe80,
927 0x0bf406e0, 1026 0x88cf0887,
928 0x06e8b809, 1027 0x0284f000,
929/* 0x01eb: timer_reset */ 1028 0xf0201bf4,
930 0xf0191ef4, 1029 0x88cf3487,
931 0x0ed03407, 1030 0x06e0b800,
932 0x8004bd00, 1031 0xb8090bf4,
933/* 0x01f6: timer_enable */ 1032 0x1cf406e8,
934 0x87f09a0e, 1033/* 0x026d: timer_reset */
935 0x3807f001, 1034 0x3407f00e,
936 0xbd0008d0, 1035 0xbd000ed0,
937/* 0x0201: timer_done */ 1036 0x9a0e8004,
938 0x1031f404, 1037/* 0x0278: timer_enable */
939/* 0x0206: send_proc */ 1038 0xf00187f0,
940 0x80f900f8, 1039 0x08d03807,
941 0xe89890f9, 1040/* 0x0283: timer_done */
1041 0xf404bd00,
1042 0x80fc1031,
1043 0x00f890fc,
1044/* 0x028c: send_proc */
1045 0x90f980f9,
1046 0x9805e898,
1047 0x86f004e9,
1048 0x0689b804,
1049 0xc42a0bf4,
1050 0x88940398,
1051 0x1880b604,
1052 0x98008ebb,
1053 0x8a8000fa,
1054 0x018d8000,
1055 0x80028c80,
1056 0x90b6038b,
1057 0x0794f001,
1058 0xf404e980,
1059/* 0x02c6: send_done */
1060 0x90fc0231,
1061 0x00f880fc,
1062/* 0x02cc: find */
1063 0x87f080f9,
1064 0x0131f458,
1065/* 0x02d4: find_loop */
1066 0xb8008a98,
1067 0x0bf406ae,
1068 0x5880b610,
1069 0x026886b1,
1070 0xf4f01bf4,
1071/* 0x02ea: find_done */
1072 0x8eb90132,
1073 0xf880fc02,
1074/* 0x02f1: send */
1075 0xcc21f500,
1076 0x9701f402,
1077/* 0x02fa: recv */
1078 0x90f900f8,
1079 0xe89880f9,
942 0x04e99805, 1080 0x04e99805,
943 0xb80486f0, 1081 0xb80132f4,
944 0x0bf40689, 1082 0x0bf40689,
945 0x0398c42a, 1083 0x0389c43d,
946 0xb6048894, 1084 0xf00180b6,
947 0x8ebb1880, 1085 0xe8800784,
948 0x00fa9800, 1086 0x02ea9805,
949 0x80008a80, 1087 0x8ffef0f9,
950 0x8c80018d, 1088 0xb9f0f901,
951 0x038b8002, 1089 0x999402ef,
952 0xf00190b6, 1090 0x00e9bb04,
953 0xe9800794, 1091 0x9818e0b6,
954 0x0231f404,
955/* 0x0240: send_done */
956 0x80fc90fc,
957/* 0x0246: find */
958 0x80f900f8,
959 0xf45887f0,
960/* 0x024e: find_loop */
961 0x8a980131,
962 0x06aeb800,
963 0xb6100bf4,
964 0x86b15880,
965 0x1bf40268,
966 0x0132f4f0,
967/* 0x0264: find_done */
968 0xfc028eb9,
969/* 0x026b: send */
970 0xf500f880,
971 0xf4024621,
972 0x00f89701,
973/* 0x0274: recv */
974 0x9805e898,
975 0x32f404e9,
976 0x0689b801,
977 0xc43d0bf4,
978 0x80b60389,
979 0x0784f001,
980 0x9805e880,
981 0xf0f902ea,
982 0xf9018ffe,
983 0x02efb9f0,
984 0xbb049994,
985 0xe0b600e9,
986 0x03eb9818,
987 0x9802ec98,
988 0xee9801ed,
989 0xfca5f900,
990 0x00f8fef0,
991 0xfc0131f4,
992/* 0x02bd: recv_done */
993/* 0x02bf: init */
994 0xf100f8f0,
995 0xcf010817,
996 0x11e70011,
997 0x14b60109,
998 0x0014fe08,
999 0x00e017f1,
1000 0xf00013f0,
1001 0x01d01c07,
1002 0xf004bd00,
1003 0x07f0ff17,
1004 0x0001d014,
1005 0x17f004bd,
1006 0x0015f102,
1007 0x1007f008,
1008 0xbd0001d0,
1009 0xe617f104,
1010 0x0013f000,
1011 0xf40010fe,
1012 0x17f01031,
1013 0x3807f001,
1014 0xbd0001d0,
1015 0x58f7f004,
1016/* 0x0314: init_proc */
1017 0xb001f198,
1018 0x0bf40016,
1019 0xb615f9fa,
1020 0x0ef458f0,
1021/* 0x0325: host_send */
1022 0xb017f1f2,
1023 0x0011cf04,
1024 0x04a027f1,
1025 0xb80022cf,
1026 0x0bf40612,
1027 0x071ec42f,
1028 0xb704ee94,
1029 0x980270e0,
1030 0xec9803eb, 1092 0xec9803eb,
1031 0x01ed9802, 1093 0x01ed9802,
1032 0xf500ee98, 1094 0xf900ee98,
1033 0xb6026b21, 1095 0xfef0fca5,
1034 0x1ec40110, 1096 0x31f400f8,
1035 0xb007f10f, 1097/* 0x0347: recv_done */
1036 0x000ed004, 1098 0xfcf0fc01,
1037 0x0ef404bd, 1099 0xf890fc80,
1038/* 0x0365: host_send_done */ 1100/* 0x034d: init */
1039/* 0x0367: host_recv */ 1101 0x0817f100,
1040 0xf100f8c3, 1102 0x0011cf01,
1041 0xf14e4917, 1103 0x010911e7,
1042 0xb8525413, 1104 0xfe0814b6,
1043 0x0bf406e1, 1105 0x17f10014,
1044/* 0x0375: host_recv_wait */ 1106 0x13f000e0,
1045 0xcc17f1b3, 1107 0x1c07f000,
1046 0x0011cf04, 1108 0xbd0001d0,
1047 0x04c827f1, 1109 0xff17f004,
1048 0xf00022cf, 1110 0xd01407f0,
1049 0x12b80816, 1111 0x04bd0001,
1050 0xec0bf406, 1112 0xf10217f0,
1051 0xb60723c4, 1113 0xf0080015,
1052 0x30b70434, 1114 0x01d01007,
1053 0x3b8002f0, 1115 0xf104bd00,
1054 0x023c8003, 1116 0xf000f617,
1055 0x80013d80, 1117 0x10fe0013,
1056 0x20b6003e, 1118 0x1031f400,
1057 0x0f24f001, 1119 0xf00117f0,
1058 0x04c807f1, 1120 0x01d03807,
1059 0xbd0002d0, 1121 0xf004bd00,
1060 0x4027f004, 1122/* 0x03a2: init_proc */
1061 0xd00007f0, 1123 0xf19858f7,
1062 0x04bd0002, 1124 0x0016b001,
1063/* 0x03be: host_init */ 1125 0xf9fa0bf4,
1126 0x58f0b615,
1127/* 0x03b3: mulu32_32_64 */
1128 0xf9f20ef4,
1129 0xf920f910,
1130 0x9540f930,
1131 0xd29510e1,
1132 0xbdc4bd10,
1133 0xc0edffb4,
1134 0xb9301dff,
1135 0x34f10234,
1136 0x34b6ffff,
1137 0x1045b610,
1138 0xbb00c3bb,
1139 0xe2ff01b4,
1140 0x0234b930,
1141 0xffff34f1,
1142 0xb61034b6,
1143 0xc3bb1045,
1144 0x01b4bb00,
1145 0xbb3012ff,
1146 0x40fc00b3,
1147 0x20fc30fc,
1148 0x00f810fc,
1149/* 0x0404: host_send */
1150 0x04b017f1,
1151 0xf10011cf,
1152 0xcf04a027,
1153 0x12b80022,
1154 0x2f0bf406,
1155 0x94071ec4,
1156 0xe0b704ee,
1157 0xeb980270,
1158 0x02ec9803,
1159 0x9801ed98,
1160 0x21f500ee,
1161 0x10b602f1,
1162 0x0f1ec401,
1163 0x04b007f1,
1164 0xbd000ed0,
1165 0xc30ef404,
1166/* 0x0444: host_send_done */
1167/* 0x0446: host_recv */
1064 0x17f100f8, 1168 0x17f100f8,
1065 0x14b60080, 1169 0x13f14e49,
1066 0x7015f110, 1170 0xe1b85254,
1067 0xd007f102, 1171 0xb30bf406,
1068 0x0001d004, 1172/* 0x0454: host_recv_wait */
1069 0x17f104bd, 1173 0x04cc17f1,
1070 0x14b60080, 1174 0xf10011cf,
1071 0xf015f110, 1175 0xcf04c827,
1072 0xdc07f102, 1176 0x16f00022,
1073 0x0001d004, 1177 0x0612b808,
1074 0x17f004bd, 1178 0xc4ec0bf4,
1075 0xc407f101, 1179 0x34b60723,
1076 0x0001d004, 1180 0xf030b704,
1077 0x00f804bd, 1181 0x033b8002,
1078/* 0x03f4: memx_func_enter */ 1182 0x80023c80,
1183 0x3e80013d,
1184 0x0120b600,
1185 0xf10f24f0,
1186 0xd004c807,
1187 0x04bd0002,
1188 0xf04027f0,
1189 0x02d00007,
1190 0xf804bd00,
1191/* 0x049d: host_init */
1192 0x8017f100,
1193 0x1014b600,
1194 0x027015f1,
1195 0x04d007f1,
1196 0xbd0001d0,
1197 0x8017f104,
1198 0x1014b600,
1199 0x02f015f1,
1200 0x04dc07f1,
1201 0xbd0001d0,
1202 0x0117f004,
1203 0x04c407f1,
1204 0xbd0001d0,
1205/* 0x04d3: memx_func_enter */
1206 0xf100f804,
1207 0xf1162067,
1208 0xf1f55d77,
1209 0xb9ffff73,
1210 0x21f4026e,
1211 0x02d8b904,
1212 0xf90487fd,
1213 0xfc80f960,
1214 0xf4e0fcd0,
1215 0x77f13321,
1216 0x73f1fffe,
1217 0x6eb9ffff,
1218 0x0421f402,
1219 0xfd02d8b9,
1220 0x60f90487,
1221 0xd0fc80f9,
1222 0x21f4e0fc,
1223 0xf067f133,
1224 0x026eb926,
1225 0xb90421f4,
1226 0x87fd02d8,
1227 0xf960f904,
1228 0xfcd0fc80,
1229 0x3321f4e0,
1079 0xf10467f0, 1230 0xf10467f0,
1080 0xd007e007, 1231 0xd007e007,
1081 0x04bd0006, 1232 0x04bd0006,
1082/* 0x0400: memx_func_enter_wait */ 1233/* 0x053c: memx_func_enter_wait */
1083 0x07c067f1, 1234 0x07c067f1,
1084 0xf00066cf, 1235 0xf00066cf,
1085 0x0bf40464, 1236 0x0bf40464,
1086 0x001698f6, 1237 0x2c67f0f6,
1087 0xf80410b6, 1238 0x800066cf,
1088/* 0x0415: memx_func_leave */ 1239 0x00f8ee06,
1089 0x0467f000, 1240/* 0x0554: memx_func_leave */
1241 0xcf2c67f0,
1242 0x06800066,
1243 0x0467f0ef,
1090 0x07e407f1, 1244 0x07e407f1,
1091 0xbd0006d0, 1245 0xbd0006d0,
1092/* 0x0421: memx_func_leave_wait */ 1246/* 0x0569: memx_func_leave_wait */
1093 0xc067f104, 1247 0xc067f104,
1094 0x0066cf07, 1248 0x0066cf07,
1095 0xf40464f0, 1249 0xf40464f0,
1096 0x00f8f61b, 1250 0x67f1f61b,
1097/* 0x0430: memx_func_wr32 */ 1251 0x77f126f0,
1252 0x73f00001,
1253 0x026eb900,
1254 0xb90421f4,
1255 0x87fd02d8,
1256 0xf960f905,
1257 0xfcd0fc80,
1258 0x3321f4e0,
1259 0x162067f1,
1260 0xf4026eb9,
1261 0xd8b90421,
1262 0x0587fd02,
1263 0x80f960f9,
1264 0xe0fcd0fc,
1265 0xf13321f4,
1266 0xf00aa277,
1267 0x6eb90073,
1268 0x0421f402,
1269 0xfd02d8b9,
1270 0x60f90587,
1271 0xd0fc80f9,
1272 0x21f4e0fc,
1273/* 0x05d3: memx_func_wait_vblank */
1274 0xb600f833,
1275 0x00f80410,
1276/* 0x05d8: memx_func_wr32 */
1098 0x98001698, 1277 0x98001698,
1099 0x10b60115, 1278 0x10b60115,
1100 0xf960f908, 1279 0xf960f908,
@@ -1102,131 +1281,137 @@ uint32_t nvd0_pwr_code[] = {
1102 0x3321f4e0, 1281 0x3321f4e0,
1103 0xf40242b6, 1282 0xf40242b6,
1104 0x00f8e91b, 1283 0x00f8e91b,
1105/* 0x044c: memx_func_wait */ 1284/* 0x05f4: memx_func_wait */
1106 0xcf2c87f0, 1285 0xcf2c87f0,
1107 0x1e980088, 1286 0x1e980088,
1108 0x011d9800, 1287 0x011d9800,
1109 0x98021c98, 1288 0x98021c98,
1110 0x10b6031b, 1289 0x10b6031b,
1111 0x7e21f410, 1290 0x8621f410,
1112/* 0x0466: memx_func_delay */ 1291/* 0x060e: memx_func_delay */
1113 0x1e9800f8, 1292 0x1e9800f8,
1114 0x0410b600, 1293 0x0410b600,
1115 0xf86721f4, 1294 0xf86721f4,
1116/* 0x0471: memx_exec */ 1295/* 0x0619: memx_exec */
1117 0xf9e0f900, 1296 0xf9e0f900,
1118 0x02c1b9d0, 1297 0x02c1b9d0,
1119/* 0x047b: memx_exec_next */ 1298/* 0x0623: memx_exec_next */
1120 0x9802b2b9, 1299 0x9802b2b9,
1121 0x10b60013, 1300 0x10b60013,
1122 0x10349504, 1301 0xf034e704,
1302 0xe033e701,
1303 0x0132b601,
1123 0x980c30f0, 1304 0x980c30f0,
1124 0x55f9de35, 1305 0x55f9de35,
1125 0xf40612b8, 1306 0xf40612b8,
1126 0xd0fcec1e, 1307 0x0b98e41e,
1308 0xef0c98ee,
1309 0xf102cbbb,
1310 0xcf07c4b7,
1311 0xd0fc00bb,
1127 0x21f5e0fc, 1312 0x21f5e0fc,
1128 0x00f8026b, 1313 0x00f802f1,
1129/* 0x049c: memx_info */ 1314/* 0x065c: memx_info */
1130 0x03acc7f1, 1315 0x03c0c7f1,
1131 0x0800b7f1, 1316 0x0800b7f1,
1132 0x026b21f5, 1317 0x02f121f5,
1133/* 0x04aa: memx_recv */ 1318/* 0x066a: memx_recv */
1134 0xd6b000f8, 1319 0xd6b000f8,
1135 0xc40bf401, 1320 0xac0bf401,
1136 0xf400d6b0, 1321 0xf400d6b0,
1137 0x00f8e90b, 1322 0x00f8e90b,
1138/* 0x04b8: memx_init */ 1323/* 0x0678: memx_init */
1139/* 0x04ba: perf_recv */ 1324/* 0x067a: perf_recv */
1140 0x00f800f8, 1325 0x00f800f8,
1141/* 0x04bc: perf_init */ 1326/* 0x067c: perf_init */
1142/* 0x04be: i2c_drive_scl */ 1327/* 0x067e: i2c_drive_scl */
1143 0x36b000f8, 1328 0x36b000f8,
1144 0x0e0bf400, 1329 0x0e0bf400,
1145 0x07e007f1, 1330 0x07e007f1,
1146 0xbd0001d0, 1331 0xbd0001d0,
1147/* 0x04cf: i2c_drive_scl_lo */ 1332/* 0x068f: i2c_drive_scl_lo */
1148 0xf100f804, 1333 0xf100f804,
1149 0xd007e407, 1334 0xd007e407,
1150 0x04bd0001, 1335 0x04bd0001,
1151/* 0x04da: i2c_drive_sda */ 1336/* 0x069a: i2c_drive_sda */
1152 0x36b000f8, 1337 0x36b000f8,
1153 0x0e0bf400, 1338 0x0e0bf400,
1154 0x07e007f1, 1339 0x07e007f1,
1155 0xbd0002d0, 1340 0xbd0002d0,
1156/* 0x04eb: i2c_drive_sda_lo */ 1341/* 0x06ab: i2c_drive_sda_lo */
1157 0xf100f804, 1342 0xf100f804,
1158 0xd007e407, 1343 0xd007e407,
1159 0x04bd0002, 1344 0x04bd0002,
1160/* 0x04f6: i2c_sense_scl */ 1345/* 0x06b6: i2c_sense_scl */
1161 0x32f400f8, 1346 0x32f400f8,
1162 0xc437f101, 1347 0xc437f101,
1163 0x0033cf07, 1348 0x0033cf07,
1164 0xf40431fd, 1349 0xf40431fd,
1165 0x31f4060b, 1350 0x31f4060b,
1166/* 0x0509: i2c_sense_scl_done */ 1351/* 0x06c9: i2c_sense_scl_done */
1167/* 0x050b: i2c_sense_sda */ 1352/* 0x06cb: i2c_sense_sda */
1168 0xf400f801, 1353 0xf400f801,
1169 0x37f10132, 1354 0x37f10132,
1170 0x33cf07c4, 1355 0x33cf07c4,
1171 0x0432fd00, 1356 0x0432fd00,
1172 0xf4060bf4, 1357 0xf4060bf4,
1173/* 0x051e: i2c_sense_sda_done */ 1358/* 0x06de: i2c_sense_sda_done */
1174 0x00f80131, 1359 0x00f80131,
1175/* 0x0520: i2c_raise_scl */ 1360/* 0x06e0: i2c_raise_scl */
1176 0x47f140f9, 1361 0x47f140f9,
1177 0x37f00898, 1362 0x37f00898,
1178 0xbe21f501, 1363 0x7e21f501,
1179/* 0x052d: i2c_raise_scl_wait */ 1364/* 0x06ed: i2c_raise_scl_wait */
1180 0xe8e7f104, 1365 0xe8e7f106,
1181 0x6721f403, 1366 0x6721f403,
1182 0x04f621f5, 1367 0x06b621f5,
1183 0xb60901f4, 1368 0xb60901f4,
1184 0x1bf40142, 1369 0x1bf40142,
1185/* 0x0541: i2c_raise_scl_done */ 1370/* 0x0701: i2c_raise_scl_done */
1186 0xf840fcef, 1371 0xf840fcef,
1187/* 0x0545: i2c_start */ 1372/* 0x0705: i2c_start */
1188 0xf621f500, 1373 0xb621f500,
1189 0x0d11f404, 1374 0x0d11f406,
1190 0x050b21f5, 1375 0x06cb21f5,
1191 0xf40611f4, 1376 0xf40611f4,
1192/* 0x0556: i2c_start_rep */ 1377/* 0x0716: i2c_start_rep */
1193 0x37f0300e, 1378 0x37f0300e,
1194 0xbe21f500, 1379 0x7e21f500,
1195 0x0137f004, 1380 0x0137f006,
1196 0x04da21f5, 1381 0x069a21f5,
1197 0xb60076bb, 1382 0xb60076bb,
1198 0x50f90465, 1383 0x50f90465,
1199 0xbb046594, 1384 0xbb046594,
1200 0x50bd0256, 1385 0x50bd0256,
1201 0xfc0475fd, 1386 0xfc0475fd,
1202 0x2021f550, 1387 0xe021f550,
1203 0x0464b605, 1388 0x0464b606,
1204/* 0x0583: i2c_start_send */ 1389/* 0x0743: i2c_start_send */
1205 0xf01f11f4, 1390 0xf01f11f4,
1206 0x21f50037, 1391 0x21f50037,
1207 0xe7f104da, 1392 0xe7f1069a,
1208 0x21f41388, 1393 0x21f41388,
1209 0x0037f067, 1394 0x0037f067,
1210 0x04be21f5, 1395 0x067e21f5,
1211 0x1388e7f1, 1396 0x1388e7f1,
1212/* 0x059f: i2c_start_out */ 1397/* 0x075f: i2c_start_out */
1213 0xf86721f4, 1398 0xf86721f4,
1214/* 0x05a1: i2c_stop */ 1399/* 0x0761: i2c_stop */
1215 0x0037f000, 1400 0x0037f000,
1216 0x04be21f5, 1401 0x067e21f5,
1217 0xf50037f0, 1402 0xf50037f0,
1218 0xf104da21, 1403 0xf1069a21,
1219 0xf403e8e7, 1404 0xf403e8e7,
1220 0x37f06721, 1405 0x37f06721,
1221 0xbe21f501, 1406 0x7e21f501,
1222 0x88e7f104, 1407 0x88e7f106,
1223 0x6721f413, 1408 0x6721f413,
1224 0xf50137f0, 1409 0xf50137f0,
1225 0xf104da21, 1410 0xf1069a21,
1226 0xf41388e7, 1411 0xf41388e7,
1227 0x00f86721, 1412 0x00f86721,
1228/* 0x05d4: i2c_bitw */ 1413/* 0x0794: i2c_bitw */
1229 0x04da21f5, 1414 0x069a21f5,
1230 0x03e8e7f1, 1415 0x03e8e7f1,
1231 0xbb6721f4, 1416 0xbb6721f4,
1232 0x65b60076, 1417 0x65b60076,
@@ -1234,18 +1419,18 @@ uint32_t nvd0_pwr_code[] = {
1234 0x56bb0465, 1419 0x56bb0465,
1235 0xfd50bd02, 1420 0xfd50bd02,
1236 0x50fc0475, 1421 0x50fc0475,
1237 0x052021f5, 1422 0x06e021f5,
1238 0xf40464b6, 1423 0xf40464b6,
1239 0xe7f11811, 1424 0xe7f11811,
1240 0x21f41388, 1425 0x21f41388,
1241 0x0037f067, 1426 0x0037f067,
1242 0x04be21f5, 1427 0x067e21f5,
1243 0x1388e7f1, 1428 0x1388e7f1,
1244/* 0x0613: i2c_bitw_out */ 1429/* 0x07d3: i2c_bitw_out */
1245 0xf86721f4, 1430 0xf86721f4,
1246/* 0x0615: i2c_bitr */ 1431/* 0x07d5: i2c_bitr */
1247 0x0137f000, 1432 0x0137f000,
1248 0x04da21f5, 1433 0x069a21f5,
1249 0x03e8e7f1, 1434 0x03e8e7f1,
1250 0xbb6721f4, 1435 0xbb6721f4,
1251 0x65b60076, 1436 0x65b60076,
@@ -1253,19 +1438,19 @@ uint32_t nvd0_pwr_code[] = {
1253 0x56bb0465, 1438 0x56bb0465,
1254 0xfd50bd02, 1439 0xfd50bd02,
1255 0x50fc0475, 1440 0x50fc0475,
1256 0x052021f5, 1441 0x06e021f5,
1257 0xf40464b6, 1442 0xf40464b6,
1258 0x21f51b11, 1443 0x21f51b11,
1259 0x37f0050b, 1444 0x37f006cb,
1260 0xbe21f500, 1445 0x7e21f500,
1261 0x88e7f104, 1446 0x88e7f106,
1262 0x6721f413, 1447 0x6721f413,
1263 0xf4013cf0, 1448 0xf4013cf0,
1264/* 0x065a: i2c_bitr_done */ 1449/* 0x081a: i2c_bitr_done */
1265 0x00f80131, 1450 0x00f80131,
1266/* 0x065c: i2c_get_byte */ 1451/* 0x081c: i2c_get_byte */
1267 0xf00057f0, 1452 0xf00057f0,
1268/* 0x0662: i2c_get_byte_next */ 1453/* 0x0822: i2c_get_byte_next */
1269 0x54b60847, 1454 0x54b60847,
1270 0x0076bb01, 1455 0x0076bb01,
1271 0xf90465b6, 1456 0xf90465b6,
@@ -1273,7 +1458,7 @@ uint32_t nvd0_pwr_code[] = {
1273 0xbd0256bb, 1458 0xbd0256bb,
1274 0x0475fd50, 1459 0x0475fd50,
1275 0x21f550fc, 1460 0x21f550fc,
1276 0x64b60615, 1461 0x64b607d5,
1277 0x2b11f404, 1462 0x2b11f404,
1278 0xb60553fd, 1463 0xb60553fd,
1279 0x1bf40142, 1464 0x1bf40142,
@@ -1283,12 +1468,12 @@ uint32_t nvd0_pwr_code[] = {
1283 0xbb046594, 1468 0xbb046594,
1284 0x50bd0256, 1469 0x50bd0256,
1285 0xfc0475fd, 1470 0xfc0475fd,
1286 0xd421f550, 1471 0x9421f550,
1287 0x0464b605, 1472 0x0464b607,
1288/* 0x06ac: i2c_get_byte_done */ 1473/* 0x086c: i2c_get_byte_done */
1289/* 0x06ae: i2c_put_byte */ 1474/* 0x086e: i2c_put_byte */
1290 0x47f000f8, 1475 0x47f000f8,
1291/* 0x06b1: i2c_put_byte_next */ 1476/* 0x0871: i2c_put_byte_next */
1292 0x0142b608, 1477 0x0142b608,
1293 0xbb3854ff, 1478 0xbb3854ff,
1294 0x65b60076, 1479 0x65b60076,
@@ -1296,7 +1481,7 @@ uint32_t nvd0_pwr_code[] = {
1296 0x56bb0465, 1481 0x56bb0465,
1297 0xfd50bd02, 1482 0xfd50bd02,
1298 0x50fc0475, 1483 0x50fc0475,
1299 0x05d421f5, 1484 0x079421f5,
1300 0xf40464b6, 1485 0xf40464b6,
1301 0x46b03411, 1486 0x46b03411,
1302 0xd81bf400, 1487 0xd81bf400,
@@ -1305,21 +1490,21 @@ uint32_t nvd0_pwr_code[] = {
1305 0xbb046594, 1490 0xbb046594,
1306 0x50bd0256, 1491 0x50bd0256,
1307 0xfc0475fd, 1492 0xfc0475fd,
1308 0x1521f550, 1493 0xd521f550,
1309 0x0464b606, 1494 0x0464b607,
1310 0xbb0f11f4, 1495 0xbb0f11f4,
1311 0x36b00076, 1496 0x36b00076,
1312 0x061bf401, 1497 0x061bf401,
1313/* 0x0707: i2c_put_byte_done */ 1498/* 0x08c7: i2c_put_byte_done */
1314 0xf80132f4, 1499 0xf80132f4,
1315/* 0x0709: i2c_addr */ 1500/* 0x08c9: i2c_addr */
1316 0x0076bb00, 1501 0x0076bb00,
1317 0xf90465b6, 1502 0xf90465b6,
1318 0x04659450, 1503 0x04659450,
1319 0xbd0256bb, 1504 0xbd0256bb,
1320 0x0475fd50, 1505 0x0475fd50,
1321 0x21f550fc, 1506 0x21f550fc,
1322 0x64b60545, 1507 0x64b60705,
1323 0x2911f404, 1508 0x2911f404,
1324 0x012ec3e7, 1509 0x012ec3e7,
1325 0xfd0134b6, 1510 0xfd0134b6,
@@ -1329,30 +1514,30 @@ uint32_t nvd0_pwr_code[] = {
1329 0x0256bb04, 1514 0x0256bb04,
1330 0x75fd50bd, 1515 0x75fd50bd,
1331 0xf550fc04, 1516 0xf550fc04,
1332 0xb606ae21, 1517 0xb6086e21,
1333/* 0x074e: i2c_addr_done */ 1518/* 0x090e: i2c_addr_done */
1334 0x00f80464, 1519 0x00f80464,
1335/* 0x0750: i2c_acquire_addr */ 1520/* 0x0910: i2c_acquire_addr */
1336 0xb6f8cec7, 1521 0xb6f8cec7,
1337 0xe0b705e4, 1522 0xe0b705e4,
1338 0x00f8d014, 1523 0x00f8d014,
1339/* 0x075c: i2c_acquire */ 1524/* 0x091c: i2c_acquire */
1340 0x075021f5, 1525 0x091021f5,
1341 0xf00421f4, 1526 0xf00421f4,
1342 0x21f403d9, 1527 0x21f403d9,
1343/* 0x076b: i2c_release */ 1528/* 0x092b: i2c_release */
1344 0xf500f833, 1529 0xf500f833,
1345 0xf4075021, 1530 0xf4091021,
1346 0xdaf00421, 1531 0xdaf00421,
1347 0x3321f403, 1532 0x3321f403,
1348/* 0x077a: i2c_recv */ 1533/* 0x093a: i2c_recv */
1349 0x32f400f8, 1534 0x32f400f8,
1350 0xf8c1c701, 1535 0xf8c1c701,
1351 0xb00214b6, 1536 0xb00214b6,
1352 0x1ff52816, 1537 0x1ff52816,
1353 0x13a0013a, 1538 0x13a0013a,
1354 0x32980bd4, 1539 0x32980be8,
1355 0xac13a000, 1540 0xc013a000,
1356 0x0031980b, 1541 0x0031980b,
1357 0xf90231f4, 1542 0xf90231f4,
1358 0xf9e0f9d0, 1543 0xf9e0f9d0,
@@ -1364,8 +1549,8 @@ uint32_t nvd0_pwr_code[] = {
1364 0xbb046594, 1549 0xbb046594,
1365 0x50bd0256, 1550 0x50bd0256,
1366 0xfc0475fd, 1551 0xfc0475fd,
1367 0x5c21f550, 1552 0x1c21f550,
1368 0x0464b607, 1553 0x0464b609,
1369 0xd6b0d0fc, 1554 0xd6b0d0fc,
1370 0xb31bf500, 1555 0xb31bf500,
1371 0x0057f000, 1556 0x0057f000,
@@ -1374,8 +1559,8 @@ uint32_t nvd0_pwr_code[] = {
1374 0xbb046594, 1559 0xbb046594,
1375 0x50bd0256, 1560 0x50bd0256,
1376 0xfc0475fd, 1561 0xfc0475fd,
1377 0x0921f550, 1562 0xc921f550,
1378 0x0464b607, 1563 0x0464b608,
1379 0x00d011f5, 1564 0x00d011f5,
1380 0xbbe0c5c7, 1565 0xbbe0c5c7,
1381 0x65b60076, 1566 0x65b60076,
@@ -1383,7 +1568,7 @@ uint32_t nvd0_pwr_code[] = {
1383 0x56bb0465, 1568 0x56bb0465,
1384 0xfd50bd02, 1569 0xfd50bd02,
1385 0x50fc0475, 1570 0x50fc0475,
1386 0x06ae21f5, 1571 0x086e21f5,
1387 0xf50464b6, 1572 0xf50464b6,
1388 0xf000ad11, 1573 0xf000ad11,
1389 0x76bb0157, 1574 0x76bb0157,
@@ -1392,7 +1577,7 @@ uint32_t nvd0_pwr_code[] = {
1392 0x0256bb04, 1577 0x0256bb04,
1393 0x75fd50bd, 1578 0x75fd50bd,
1394 0xf550fc04, 1579 0xf550fc04,
1395 0xb6070921, 1580 0xb608c921,
1396 0x11f50464, 1581 0x11f50464,
1397 0x76bb008a, 1582 0x76bb008a,
1398 0x0465b600, 1583 0x0465b600,
@@ -1400,7 +1585,7 @@ uint32_t nvd0_pwr_code[] = {
1400 0x0256bb04, 1585 0x0256bb04,
1401 0x75fd50bd, 1586 0x75fd50bd,
1402 0xf550fc04, 1587 0xf550fc04,
1403 0xb6065c21, 1588 0xb6081c21,
1404 0x11f40464, 1589 0x11f40464,
1405 0xe05bcb6a, 1590 0xe05bcb6a,
1406 0xb60076bb, 1591 0xb60076bb,
@@ -1408,38 +1593,38 @@ uint32_t nvd0_pwr_code[] = {
1408 0xbb046594, 1593 0xbb046594,
1409 0x50bd0256, 1594 0x50bd0256,
1410 0xfc0475fd, 1595 0xfc0475fd,
1411 0xa121f550, 1596 0x6121f550,
1412 0x0464b605, 1597 0x0464b607,
1413 0xbd025bb9, 1598 0xbd025bb9,
1414 0x430ef474, 1599 0x430ef474,
1415/* 0x0880: i2c_recv_not_rd08 */ 1600/* 0x0a40: i2c_recv_not_rd08 */
1416 0xf401d6b0, 1601 0xf401d6b0,
1417 0x57f03d1b, 1602 0x57f03d1b,
1418 0x0921f500, 1603 0xc921f500,
1419 0x3311f407, 1604 0x3311f408,
1420 0xf5e0c5c7, 1605 0xf5e0c5c7,
1421 0xf406ae21, 1606 0xf4086e21,
1422 0x57f02911, 1607 0x57f02911,
1423 0x0921f500, 1608 0xc921f500,
1424 0x1f11f407, 1609 0x1f11f408,
1425 0xf5e0b5c7, 1610 0xf5e0b5c7,
1426 0xf406ae21, 1611 0xf4086e21,
1427 0x21f51511, 1612 0x21f51511,
1428 0x74bd05a1, 1613 0x74bd0761,
1429 0xf408c5c7, 1614 0xf408c5c7,
1430 0x32f4091b, 1615 0x32f4091b,
1431 0x030ef402, 1616 0x030ef402,
1432/* 0x08c0: i2c_recv_not_wr08 */ 1617/* 0x0a80: i2c_recv_not_wr08 */
1433/* 0x08c0: i2c_recv_done */ 1618/* 0x0a80: i2c_recv_done */
1434 0xf5f8cec7, 1619 0xf5f8cec7,
1435 0xfc076b21, 1620 0xfc092b21,
1436 0xf4d0fce0, 1621 0xf4d0fce0,
1437 0x7cb90a12, 1622 0x7cb90a12,
1438 0x6b21f502, 1623 0xf121f502,
1439/* 0x08d5: i2c_recv_exit */ 1624/* 0x0a95: i2c_recv_exit */
1440/* 0x08d7: i2c_init */ 1625/* 0x0a97: i2c_init */
1441 0xf800f802, 1626 0xf800f802,
1442/* 0x08d9: test_recv */ 1627/* 0x0a99: test_recv */
1443 0xd817f100, 1628 0xd817f100,
1444 0x0011cf05, 1629 0x0011cf05,
1445 0xf10110b6, 1630 0xf10110b6,
@@ -1447,29 +1632,29 @@ uint32_t nvd0_pwr_code[] = {
1447 0x04bd0001, 1632 0x04bd0001,
1448 0xd900e7f1, 1633 0xd900e7f1,
1449 0x134fe3f1, 1634 0x134fe3f1,
1450 0x01b621f5, 1635 0x022321f5,
1451/* 0x08fa: test_init */ 1636/* 0x0aba: test_init */
1452 0xe7f100f8, 1637 0xe7f100f8,
1453 0x21f50800, 1638 0x21f50800,
1454 0x00f801b6, 1639 0x00f80223,
1455/* 0x0904: idle_recv */ 1640/* 0x0ac4: idle_recv */
1456/* 0x0906: idle */ 1641/* 0x0ac6: idle */
1457 0x31f400f8, 1642 0x31f400f8,
1458 0xd417f100, 1643 0xd417f100,
1459 0x0011cf05, 1644 0x0011cf05,
1460 0xf10110b6, 1645 0xf10110b6,
1461 0xd005d407, 1646 0xd005d407,
1462 0x04bd0001, 1647 0x04bd0001,
1463/* 0x091c: idle_loop */ 1648/* 0x0adc: idle_loop */
1464 0xf45817f0, 1649 0xf45817f0,
1465/* 0x0922: idle_proc */ 1650/* 0x0ae2: idle_proc */
1466/* 0x0922: idle_proc_exec */ 1651/* 0x0ae2: idle_proc_exec */
1467 0x10f90232, 1652 0x10f90232,
1468 0xf5021eb9, 1653 0xf5021eb9,
1469 0xfc027421, 1654 0xfc02fa21,
1470 0x0911f410, 1655 0x0911f410,
1471 0xf40231f4, 1656 0xf40231f4,
1472/* 0x0936: idle_proc_next */ 1657/* 0x0af6: idle_proc_next */
1473 0x10b6ef0e, 1658 0x10b6ef0e,
1474 0x061fb858, 1659 0x061fb858,
1475 0xf4e61bf4, 1660 0xf4e61bf4,
@@ -1521,4 +1706,20 @@ uint32_t nvd0_pwr_code[] = {
1521 0x00000000, 1706 0x00000000,
1522 0x00000000, 1707 0x00000000,
1523 0x00000000, 1708 0x00000000,
1709 0x00000000,
1710 0x00000000,
1711 0x00000000,
1712 0x00000000,
1713 0x00000000,
1714 0x00000000,
1715 0x00000000,
1716 0x00000000,
1717 0x00000000,
1718 0x00000000,
1719 0x00000000,
1720 0x00000000,
1721 0x00000000,
1722 0x00000000,
1723 0x00000000,
1724 0x00000000,
1524}; 1725};
diff --git a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/os.h b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/os.h
index 574acfa44c8c..522e3079f824 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/os.h
+++ b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/os.h
@@ -19,11 +19,12 @@
19#define MEMX_MSG_EXEC 1 19#define MEMX_MSG_EXEC 1
20 20
21/* MEMX: script opcode definitions */ 21/* MEMX: script opcode definitions */
22#define MEMX_ENTER 0 22#define MEMX_ENTER 1
23#define MEMX_LEAVE 1 23#define MEMX_LEAVE 2
24#define MEMX_WR32 2 24#define MEMX_WR32 3
25#define MEMX_WAIT 3 25#define MEMX_WAIT 4
26#define MEMX_DELAY 4 26#define MEMX_DELAY 5
27#define MEMX_VBLANK 6
27 28
28/* I2C_: message identifiers */ 29/* I2C_: message identifiers */
29#define I2C__MSG_RD08 0 30#define I2C__MSG_RD08 0
diff --git a/drivers/gpu/drm/nouveau/core/subdev/pwr/memx.c b/drivers/gpu/drm/nouveau/core/subdev/pwr/memx.c
index def6a9ac68cf..65eaa2546cad 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/pwr/memx.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/pwr/memx.c
@@ -20,10 +20,11 @@ memx_out(struct nouveau_memx *memx)
20 struct nouveau_pwr *ppwr = memx->ppwr; 20 struct nouveau_pwr *ppwr = memx->ppwr;
21 int i; 21 int i;
22 22
23 if (memx->c.size) { 23 if (memx->c.mthd) {
24 nv_wr32(ppwr, 0x10a1c4, (memx->c.size << 16) | memx->c.mthd); 24 nv_wr32(ppwr, 0x10a1c4, (memx->c.size << 16) | memx->c.mthd);
25 for (i = 0; i < memx->c.size; i++) 25 for (i = 0; i < memx->c.size; i++)
26 nv_wr32(ppwr, 0x10a1c4, memx->c.data[i]); 26 nv_wr32(ppwr, 0x10a1c4, memx->c.data[i]);
27 memx->c.mthd = 0;
27 memx->c.size = 0; 28 memx->c.size = 0;
28 } 29 }
29} 30}
@@ -32,7 +33,7 @@ static void
32memx_cmd(struct nouveau_memx *memx, u32 mthd, u32 size, u32 data[]) 33memx_cmd(struct nouveau_memx *memx, u32 mthd, u32 size, u32 data[])
33{ 34{
34 if ((memx->c.size + size >= ARRAY_SIZE(memx->c.data)) || 35 if ((memx->c.size + size >= ARRAY_SIZE(memx->c.data)) ||
35 (memx->c.size && memx->c.mthd != mthd)) 36 (memx->c.mthd && memx->c.mthd != mthd))
36 memx_out(memx); 37 memx_out(memx);
37 memcpy(&memx->c.data[memx->c.size], data, size * sizeof(data[0])); 38 memcpy(&memx->c.data[memx->c.size], data, size * sizeof(data[0]));
38 memx->c.size += size; 39 memx->c.size += size;
@@ -62,8 +63,7 @@ nouveau_memx_init(struct nouveau_pwr *ppwr, struct nouveau_memx **pmemx)
62 nv_wr32(ppwr, 0x10a580, 0x00000003); 63 nv_wr32(ppwr, 0x10a580, 0x00000003);
63 } while (nv_rd32(ppwr, 0x10a580) != 0x00000003); 64 } while (nv_rd32(ppwr, 0x10a580) != 0x00000003);
64 nv_wr32(ppwr, 0x10a1c0, 0x01000000 | memx->base); 65 nv_wr32(ppwr, 0x10a1c0, 0x01000000 | memx->base);
65 nv_wr32(ppwr, 0x10a1c4, 0x00010000 | MEMX_ENTER); 66
66 nv_wr32(ppwr, 0x10a1c4, 0x00000000);
67 return 0; 67 return 0;
68} 68}
69 69
@@ -78,7 +78,6 @@ nouveau_memx_fini(struct nouveau_memx **pmemx, bool exec)
78 memx_out(memx); 78 memx_out(memx);
79 79
80 /* release data segment access */ 80 /* release data segment access */
81 nv_wr32(ppwr, 0x10a1c4, 0x00000000 | MEMX_LEAVE);
82 finish = nv_rd32(ppwr, 0x10a1c0) & 0x00ffffff; 81 finish = nv_rd32(ppwr, 0x10a1c0) & 0x00ffffff;
83 nv_wr32(ppwr, 0x10a580, 0x00000000); 82 nv_wr32(ppwr, 0x10a580, 0x00000000);
84 83
@@ -88,6 +87,8 @@ nouveau_memx_fini(struct nouveau_memx **pmemx, bool exec)
88 memx->base, finish); 87 memx->base, finish);
89 } 88 }
90 89
90 nv_debug(memx->ppwr, "Exec took %uns, PPWR_IN %08x\n",
91 reply[0], reply[1]);
91 kfree(memx); 92 kfree(memx);
92 return 0; 93 return 0;
93} 94}
@@ -117,4 +118,51 @@ nouveau_memx_nsec(struct nouveau_memx *memx, u32 nsec)
117 memx_out(memx); /* fuc can't handle multiple */ 118 memx_out(memx); /* fuc can't handle multiple */
118} 119}
119 120
121void
122nouveau_memx_wait_vblank(struct nouveau_memx *memx)
123{
124 struct nouveau_pwr *ppwr = memx->ppwr;
125 u32 heads, x, y, px = 0;
126 int i, head_sync;
127
128 if (nv_device(ppwr)->chipset < 0xd0) {
129 heads = nv_rd32(ppwr, 0x610050);
130 for (i = 0; i < 2; i++) {
131 /* Heuristic: sync to head with biggest resolution */
132 if (heads & (2 << (i << 3))) {
133 x = nv_rd32(ppwr, 0x610b40 + (0x540 * i));
134 y = (x & 0xffff0000) >> 16;
135 x &= 0x0000ffff;
136 if ((x * y) > px) {
137 px = (x * y);
138 head_sync = i;
139 }
140 }
141 }
142 }
143
144 if (px == 0) {
145 nv_debug(memx->ppwr, "WAIT VBLANK !NO ACTIVE HEAD\n");
146 return;
147 }
148
149 nv_debug(memx->ppwr, "WAIT VBLANK HEAD%d\n", head_sync);
150 memx_cmd(memx, MEMX_VBLANK, 1, (u32[]){ head_sync });
151 memx_out(memx); /* fuc can't handle multiple */
152}
153
154void
155nouveau_memx_block(struct nouveau_memx *memx)
156{
157 nv_debug(memx->ppwr, " HOST BLOCKED\n");
158 memx_cmd(memx, MEMX_ENTER, 0, NULL);
159}
160
161void
162nouveau_memx_unblock(struct nouveau_memx *memx)
163{
164 nv_debug(memx->ppwr, " HOST UNBLOCKED\n");
165 memx_cmd(memx, MEMX_LEAVE, 0, NULL);
166}
167
120#endif 168#endif
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/fan.c b/drivers/gpu/drm/nouveau/core/subdev/therm/fan.c
index 016990a8252c..3656d605168f 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/therm/fan.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/therm/fan.c
@@ -31,6 +31,8 @@
31#include <subdev/gpio.h> 31#include <subdev/gpio.h>
32#include <subdev/timer.h> 32#include <subdev/timer.h>
33 33
34#include <subdev/bios/fan.h>
35
34static int 36static int
35nouveau_fan_update(struct nouveau_fan *fan, bool immediate, int target) 37nouveau_fan_update(struct nouveau_fan *fan, bool immediate, int target)
36{ 38{
@@ -275,8 +277,11 @@ nouveau_therm_fan_ctor(struct nouveau_therm *therm)
275 /* other random init... */ 277 /* other random init... */
276 nouveau_therm_fan_set_defaults(therm); 278 nouveau_therm_fan_set_defaults(therm);
277 nvbios_perf_fan_parse(bios, &priv->fan->perf); 279 nvbios_perf_fan_parse(bios, &priv->fan->perf);
278 if (nvbios_therm_fan_parse(bios, &priv->fan->bios)) 280 if (!nvbios_fan_parse(bios, &priv->fan->bios)) {
279 nv_error(therm, "parsing the thermal table failed\n"); 281 nv_debug(therm, "parsing the fan table failed\n");
282 if (nvbios_therm_fan_parse(bios, &priv->fan->bios))
283 nv_error(therm, "parsing both fan tables failed\n");
284 }
280 nouveau_therm_fan_safety_checks(therm); 285 nouveau_therm_fan_safety_checks(therm);
281 return 0; 286 return 0;
282} 287}
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/fanpwm.c b/drivers/gpu/drm/nouveau/core/subdev/therm/fanpwm.c
index 9a5c07340263..c629d7f2a6a4 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/therm/fanpwm.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/therm/fanpwm.c
@@ -25,6 +25,8 @@
25 25
26#include <core/option.h> 26#include <core/option.h>
27#include <subdev/gpio.h> 27#include <subdev/gpio.h>
28#include <subdev/bios.h>
29#include <subdev/bios/fan.h>
28 30
29#include "priv.h" 31#include "priv.h"
30 32
@@ -86,11 +88,15 @@ nouveau_fanpwm_create(struct nouveau_therm *therm, struct dcb_gpio_func *func)
86{ 88{
87 struct nouveau_device *device = nv_device(therm); 89 struct nouveau_device *device = nv_device(therm);
88 struct nouveau_therm_priv *tpriv = (void *)therm; 90 struct nouveau_therm_priv *tpriv = (void *)therm;
91 struct nouveau_bios *bios = nouveau_bios(therm);
89 struct nouveau_fanpwm_priv *priv; 92 struct nouveau_fanpwm_priv *priv;
93 struct nvbios_therm_fan fan;
90 u32 divs, duty; 94 u32 divs, duty;
91 95
96 nvbios_fan_parse(bios, &fan);
97
92 if (!nouveau_boolopt(device->cfgopt, "NvFanPWM", func->param) || 98 if (!nouveau_boolopt(device->cfgopt, "NvFanPWM", func->param) ||
93 !therm->pwm_ctrl || 99 !therm->pwm_ctrl || fan.type == NVBIOS_THERM_FAN_TOGGLE ||
94 therm->pwm_get(therm, func->line, &divs, &duty) == -ENODEV) 100 therm->pwm_get(therm, func->line, &divs, &duty) == -ENODEV)
95 return -ENODEV; 101 return -ENODEV;
96 102
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/gm107.c b/drivers/gpu/drm/nouveau/core/subdev/therm/gm107.c
new file mode 100644
index 000000000000..668cf3322285
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/therm/gm107.c
@@ -0,0 +1,93 @@
1/*
2 * Copyright 2014 Martin Peres
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: Martin Peres
23 */
24
25#include "priv.h"
26
27struct gm107_therm_priv {
28 struct nouveau_therm_priv base;
29};
30
31static int
32gm107_fan_pwm_ctrl(struct nouveau_therm *therm, int line, bool enable)
33{
34 /* nothing to do, it seems hardwired */
35 return 0;
36}
37
38static int
39gm107_fan_pwm_get(struct nouveau_therm *therm, int line, u32 *divs, u32 *duty)
40{
41 *divs = nv_rd32(therm, 0x10eb20) & 0x1fff;
42 *duty = nv_rd32(therm, 0x10eb24) & 0x1fff;
43 return 0;
44}
45
46static int
47gm107_fan_pwm_set(struct nouveau_therm *therm, int line, u32 divs, u32 duty)
48{
49 nv_mask(therm, 0x10eb10, 0x1fff, divs); /* keep the high bits */
50 nv_wr32(therm, 0x10eb14, duty | 0x80000000);
51 return 0;
52}
53
54static int
55gm107_fan_pwm_clock(struct nouveau_therm *therm, int line)
56{
57 return nv_device(therm)->crystal * 1000;
58}
59
60static int
61gm107_therm_ctor(struct nouveau_object *parent,
62 struct nouveau_object *engine,
63 struct nouveau_oclass *oclass, void *data, u32 size,
64 struct nouveau_object **pobject)
65{
66 struct gm107_therm_priv *priv;
67 int ret;
68
69 ret = nouveau_therm_create(parent, engine, oclass, &priv);
70 *pobject = nv_object(priv);
71 if (ret)
72 return ret;
73
74 priv->base.base.pwm_ctrl = gm107_fan_pwm_ctrl;
75 priv->base.base.pwm_get = gm107_fan_pwm_get;
76 priv->base.base.pwm_set = gm107_fan_pwm_set;
77 priv->base.base.pwm_clock = gm107_fan_pwm_clock;
78 priv->base.base.temp_get = nv84_temp_get;
79 priv->base.base.fan_sense = nva3_therm_fan_sense;
80 priv->base.sensor.program_alarms = nouveau_therm_program_alarms_polling;
81 return nouveau_therm_preinit(&priv->base.base);
82}
83
84struct nouveau_oclass
85gm107_therm_oclass = {
86 .handle = NV_SUBDEV(THERM, 0x117),
87 .ofuncs = &(struct nouveau_ofuncs) {
88 .ctor = gm107_therm_ctor,
89 .dtor = _nouveau_therm_dtor,
90 .init = nvd0_therm_init,
91 .fini = nv84_therm_fini,
92 },
93};
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/nv84.c b/drivers/gpu/drm/nouveau/core/subdev/therm/nv84.c
index 1d15c52fad0c..14e2e09bfc24 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/therm/nv84.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/therm/nv84.c
@@ -24,6 +24,7 @@
24 */ 24 */
25 25
26#include "priv.h" 26#include "priv.h"
27#include <subdev/fuse.h>
27 28
28struct nv84_therm_priv { 29struct nv84_therm_priv {
29 struct nouveau_therm_priv base; 30 struct nouveau_therm_priv base;
@@ -32,7 +33,25 @@ struct nv84_therm_priv {
32int 33int
33nv84_temp_get(struct nouveau_therm *therm) 34nv84_temp_get(struct nouveau_therm *therm)
34{ 35{
35 return nv_rd32(therm, 0x20400); 36 struct nouveau_fuse *fuse = nouveau_fuse(therm);
37
38 if (nv_ro32(fuse, 0x1a8) == 1)
39 return nv_rd32(therm, 0x20400);
40 else
41 return -ENODEV;
42}
43
44void
45nv84_sensor_setup(struct nouveau_therm *therm)
46{
47 struct nouveau_fuse *fuse = nouveau_fuse(therm);
48
49 /* enable temperature reading for cards with insane defaults */
50 if (nv_ro32(fuse, 0x1a8) == 1) {
51 nv_mask(therm, 0x20008, 0x80008000, 0x80000000);
52 nv_mask(therm, 0x2000c, 0x80000003, 0x00000000);
53 mdelay(20); /* wait for the temperature to stabilize */
54 }
36} 55}
37 56
38static void 57static void
@@ -171,6 +190,21 @@ nv84_therm_intr(struct nouveau_subdev *subdev)
171} 190}
172 191
173static int 192static int
193nv84_therm_init(struct nouveau_object *object)
194{
195 struct nv84_therm_priv *priv = (void *)object;
196 int ret;
197
198 ret = nouveau_therm_init(&priv->base.base);
199 if (ret)
200 return ret;
201
202 nv84_sensor_setup(&priv->base.base);
203
204 return 0;
205}
206
207static int
174nv84_therm_ctor(struct nouveau_object *parent, 208nv84_therm_ctor(struct nouveau_object *parent,
175 struct nouveau_object *engine, 209 struct nouveau_object *engine,
176 struct nouveau_oclass *oclass, void *data, u32 size, 210 struct nouveau_oclass *oclass, void *data, u32 size,
@@ -228,7 +262,7 @@ nv84_therm_oclass = {
228 .ofuncs = &(struct nouveau_ofuncs) { 262 .ofuncs = &(struct nouveau_ofuncs) {
229 .ctor = nv84_therm_ctor, 263 .ctor = nv84_therm_ctor,
230 .dtor = _nouveau_therm_dtor, 264 .dtor = _nouveau_therm_dtor,
231 .init = _nouveau_therm_init, 265 .init = nv84_therm_init,
232 .fini = nv84_therm_fini, 266 .fini = nv84_therm_fini,
233 }, 267 },
234}; 268};
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/nva3.c b/drivers/gpu/drm/nouveau/core/subdev/therm/nva3.c
index 0478b2e3fb1d..7893357a7e9f 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/therm/nva3.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/therm/nva3.c
@@ -51,6 +51,8 @@ nva3_therm_init(struct nouveau_object *object)
51 if (ret) 51 if (ret)
52 return ret; 52 return ret;
53 53
54 nv84_sensor_setup(&priv->base.base);
55
54 /* enable fan tach, count revolutions per-second */ 56 /* enable fan tach, count revolutions per-second */
55 nv_mask(priv, 0x00e720, 0x00000003, 0x00000002); 57 nv_mask(priv, 0x00e720, 0x00000003, 0x00000002);
56 if (tach->func != DCB_GPIO_UNUSED) { 58 if (tach->func != DCB_GPIO_UNUSED) {
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/nvd0.c b/drivers/gpu/drm/nouveau/core/subdev/therm/nvd0.c
index bbf117be572f..b70f7cc649b8 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/therm/nvd0.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/therm/nvd0.c
@@ -114,7 +114,7 @@ nvd0_fan_pwm_clock(struct nouveau_therm *therm, int line)
114 return nv_device(therm)->crystal * 1000 / 10; 114 return nv_device(therm)->crystal * 1000 / 10;
115} 115}
116 116
117static int 117int
118nvd0_therm_init(struct nouveau_object *object) 118nvd0_therm_init(struct nouveau_object *object)
119{ 119{
120 struct nvd0_therm_priv *priv = (void *)object; 120 struct nvd0_therm_priv *priv = (void *)object;
@@ -150,6 +150,8 @@ nvd0_therm_ctor(struct nouveau_object *parent,
150 if (ret) 150 if (ret)
151 return ret; 151 return ret;
152 152
153 nv84_sensor_setup(&priv->base.base);
154
153 priv->base.base.pwm_ctrl = nvd0_fan_pwm_ctrl; 155 priv->base.base.pwm_ctrl = nvd0_fan_pwm_ctrl;
154 priv->base.base.pwm_get = nvd0_fan_pwm_get; 156 priv->base.base.pwm_get = nvd0_fan_pwm_get;
155 priv->base.base.pwm_set = nvd0_fan_pwm_set; 157 priv->base.base.pwm_set = nvd0_fan_pwm_set;
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/priv.h b/drivers/gpu/drm/nouveau/core/subdev/therm/priv.h
index 916fca5c7816..7dba8c281a0b 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/therm/priv.h
+++ b/drivers/gpu/drm/nouveau/core/subdev/therm/priv.h
@@ -145,10 +145,13 @@ int nv50_fan_pwm_get(struct nouveau_therm *, int, u32 *, u32 *);
145int nv50_fan_pwm_set(struct nouveau_therm *, int, u32, u32); 145int nv50_fan_pwm_set(struct nouveau_therm *, int, u32, u32);
146int nv50_fan_pwm_clock(struct nouveau_therm *, int); 146int nv50_fan_pwm_clock(struct nouveau_therm *, int);
147int nv84_temp_get(struct nouveau_therm *therm); 147int nv84_temp_get(struct nouveau_therm *therm);
148void nv84_sensor_setup(struct nouveau_therm *therm);
148int nv84_therm_fini(struct nouveau_object *object, bool suspend); 149int nv84_therm_fini(struct nouveau_object *object, bool suspend);
149 150
150int nva3_therm_fan_sense(struct nouveau_therm *); 151int nva3_therm_fan_sense(struct nouveau_therm *);
151 152
153int nvd0_therm_init(struct nouveau_object *object);
154
152int nouveau_fanpwm_create(struct nouveau_therm *, struct dcb_gpio_func *); 155int nouveau_fanpwm_create(struct nouveau_therm *, struct dcb_gpio_func *);
153int nouveau_fantog_create(struct nouveau_therm *, struct dcb_gpio_func *); 156int nouveau_fantog_create(struct nouveau_therm *, struct dcb_gpio_func *);
154int nouveau_fannil_create(struct nouveau_therm *); 157int nouveau_fannil_create(struct nouveau_therm *);
diff --git a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
index 7dd680ff2f6f..f75a683bd47a 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
@@ -296,7 +296,7 @@ nouveau_vm_get(struct nouveau_vm *vm, u64 size, u32 page_shift,
296 int ret; 296 int ret;
297 297
298 mutex_lock(&nv_subdev(vmm)->mutex); 298 mutex_lock(&nv_subdev(vmm)->mutex);
299 ret = nouveau_mm_head(&vm->mm, page_shift, msize, msize, align, 299 ret = nouveau_mm_head(&vm->mm, 0, page_shift, msize, msize, align,
300 &vma->node); 300 &vma->node);
301 if (unlikely(ret != 0)) { 301 if (unlikely(ret != 0)) {
302 mutex_unlock(&nv_subdev(vmm)->mutex); 302 mutex_unlock(&nv_subdev(vmm)->mutex);
diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c
index 615714c1727d..a24faa5e2a2a 100644
--- a/drivers/gpu/drm/nouveau/nouveau_abi16.c
+++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c
@@ -448,7 +448,7 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS)
448 list_add(&ntfy->head, &chan->notifiers); 448 list_add(&ntfy->head, &chan->notifiers);
449 ntfy->handle = info->handle; 449 ntfy->handle = info->handle;
450 450
451 ret = nouveau_mm_head(&chan->heap, 1, info->size, info->size, 1, 451 ret = nouveau_mm_head(&chan->heap, 0, 1, info->size, info->size, 1,
452 &ntfy->node); 452 &ntfy->node);
453 if (ret) 453 if (ret)
454 goto done; 454 goto done;
diff --git a/drivers/gpu/drm/nouveau/nouveau_chan.c b/drivers/gpu/drm/nouveau/nouveau_chan.c
index 99cd9e4a2aa6..9a362ddd8225 100644
--- a/drivers/gpu/drm/nouveau/nouveau_chan.c
+++ b/drivers/gpu/drm/nouveau/nouveau_chan.c
@@ -36,7 +36,7 @@
36#include "nouveau_abi16.h" 36#include "nouveau_abi16.h"
37 37
38MODULE_PARM_DESC(vram_pushbuf, "Create DMA push buffers in VRAM"); 38MODULE_PARM_DESC(vram_pushbuf, "Create DMA push buffers in VRAM");
39static int nouveau_vram_pushbuf; 39int nouveau_vram_pushbuf;
40module_param_named(vram_pushbuf, nouveau_vram_pushbuf, int, 0400); 40module_param_named(vram_pushbuf, nouveau_vram_pushbuf, int, 0400);
41 41
42int 42int
diff --git a/drivers/gpu/drm/nouveau/nouveau_chan.h b/drivers/gpu/drm/nouveau/nouveau_chan.h
index 20163709d608..8309c24ee698 100644
--- a/drivers/gpu/drm/nouveau/nouveau_chan.h
+++ b/drivers/gpu/drm/nouveau/nouveau_chan.h
@@ -47,4 +47,6 @@ int nouveau_channel_new(struct nouveau_drm *, struct nvif_device *,
47void nouveau_channel_del(struct nouveau_channel **); 47void nouveau_channel_del(struct nouveau_channel **);
48int nouveau_channel_idle(struct nouveau_channel *); 48int nouveau_channel_idle(struct nouveau_channel *);
49 49
50extern int nouveau_vram_pushbuf;
51
50#endif 52#endif
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index 1ec44c83e919..c8ac9482cf2e 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -45,15 +45,15 @@
45#include <nvif/event.h> 45#include <nvif/event.h>
46 46
47MODULE_PARM_DESC(tv_disable, "Disable TV-out detection"); 47MODULE_PARM_DESC(tv_disable, "Disable TV-out detection");
48static int nouveau_tv_disable = 0; 48int nouveau_tv_disable = 0;
49module_param_named(tv_disable, nouveau_tv_disable, int, 0400); 49module_param_named(tv_disable, nouveau_tv_disable, int, 0400);
50 50
51MODULE_PARM_DESC(ignorelid, "Ignore ACPI lid status"); 51MODULE_PARM_DESC(ignorelid, "Ignore ACPI lid status");
52static int nouveau_ignorelid = 0; 52int nouveau_ignorelid = 0;
53module_param_named(ignorelid, nouveau_ignorelid, int, 0400); 53module_param_named(ignorelid, nouveau_ignorelid, int, 0400);
54 54
55MODULE_PARM_DESC(duallink, "Allow dual-link TMDS (default: enabled)"); 55MODULE_PARM_DESC(duallink, "Allow dual-link TMDS (default: enabled)");
56static int nouveau_duallink = 1; 56int nouveau_duallink = 1;
57module_param_named(duallink, nouveau_duallink, int, 0400); 57module_param_named(duallink, nouveau_duallink, int, 0400);
58 58
59struct nouveau_encoder * 59struct nouveau_encoder *
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.h b/drivers/gpu/drm/nouveau/nouveau_connector.h
index 68029d041dd2..629a380c7085 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.h
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.h
@@ -105,4 +105,8 @@ nouveau_crtc_connector_get(struct nouveau_crtc *nv_crtc)
105struct drm_connector * 105struct drm_connector *
106nouveau_connector_create(struct drm_device *, int index); 106nouveau_connector_create(struct drm_device *, int index);
107 107
108extern int nouveau_tv_disable;
109extern int nouveau_ignorelid;
110extern int nouveau_duallink;
111
108#endif /* __NOUVEAU_CONNECTOR_H__ */ 112#endif /* __NOUVEAU_CONNECTOR_H__ */
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index cee1eaf64117..244d78fc0cb5 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -51,6 +51,7 @@
51#include "nouveau_fence.h" 51#include "nouveau_fence.h"
52#include "nouveau_debugfs.h" 52#include "nouveau_debugfs.h"
53#include "nouveau_usif.h" 53#include "nouveau_usif.h"
54#include "nouveau_connector.h"
54 55
55MODULE_PARM_DESC(config, "option string to pass to driver core"); 56MODULE_PARM_DESC(config, "option string to pass to driver core");
56static char *nouveau_config; 57static char *nouveau_config;
@@ -1028,6 +1029,23 @@ static int nouveau_pmops_runtime_idle(struct device *dev)
1028 return 1; 1029 return 1;
1029} 1030}
1030 1031
1032static void nouveau_display_options(void)
1033{
1034 DRM_DEBUG_DRIVER("Loading Nouveau with parameters:\n");
1035
1036 DRM_DEBUG_DRIVER("... tv_disable : %d\n", nouveau_tv_disable);
1037 DRM_DEBUG_DRIVER("... ignorelid : %d\n", nouveau_ignorelid);
1038 DRM_DEBUG_DRIVER("... duallink : %d\n", nouveau_duallink);
1039 DRM_DEBUG_DRIVER("... nofbaccel : %d\n", nouveau_nofbaccel);
1040 DRM_DEBUG_DRIVER("... config : %s\n", nouveau_config);
1041 DRM_DEBUG_DRIVER("... debug : %s\n", nouveau_debug);
1042 DRM_DEBUG_DRIVER("... noaccel : %d\n", nouveau_noaccel);
1043 DRM_DEBUG_DRIVER("... modeset : %d\n", nouveau_modeset);
1044 DRM_DEBUG_DRIVER("... runpm : %d\n", nouveau_runtime_pm);
1045 DRM_DEBUG_DRIVER("... vram_pushbuf : %d\n", nouveau_vram_pushbuf);
1046 DRM_DEBUG_DRIVER("... pstate : %d\n", nouveau_pstate);
1047}
1048
1031static const struct dev_pm_ops nouveau_pm_ops = { 1049static const struct dev_pm_ops nouveau_pm_ops = {
1032 .suspend = nouveau_pmops_suspend, 1050 .suspend = nouveau_pmops_suspend,
1033 .resume = nouveau_pmops_resume, 1051 .resume = nouveau_pmops_resume,
@@ -1093,6 +1111,8 @@ nouveau_drm_init(void)
1093 driver_platform = driver_stub; 1111 driver_platform = driver_stub;
1094 driver_platform.set_busid = drm_platform_set_busid; 1112 driver_platform.set_busid = drm_platform_set_busid;
1095 1113
1114 nouveau_display_options();
1115
1096 if (nouveau_modeset == -1) { 1116 if (nouveau_modeset == -1) {
1097#ifdef CONFIG_VGA_CONSOLE 1117#ifdef CONFIG_VGA_CONSOLE
1098 if (vgacon_text_force()) 1118 if (vgacon_text_force())
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
index 8bdd27091db8..f0ae10ca3ba9 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
@@ -52,7 +52,7 @@
52#include "nouveau_crtc.h" 52#include "nouveau_crtc.h"
53 53
54MODULE_PARM_DESC(nofbaccel, "Disable fbcon acceleration"); 54MODULE_PARM_DESC(nofbaccel, "Disable fbcon acceleration");
55static int nouveau_nofbaccel = 0; 55int nouveau_nofbaccel = 0;
56module_param_named(nofbaccel, nouveau_nofbaccel, int, 0400); 56module_param_named(nofbaccel, nouveau_nofbaccel, int, 0400);
57 57
58static void 58static void
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.h b/drivers/gpu/drm/nouveau/nouveau_fbcon.h
index 34658cfa8f5d..1e2e9e27a03b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.h
+++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.h
@@ -72,5 +72,8 @@ void nouveau_fbcon_accel_save_disable(struct drm_device *dev);
72void nouveau_fbcon_accel_restore(struct drm_device *dev); 72void nouveau_fbcon_accel_restore(struct drm_device *dev);
73 73
74void nouveau_fbcon_output_poll_changed(struct drm_device *dev); 74void nouveau_fbcon_output_poll_changed(struct drm_device *dev);
75
76extern int nouveau_nofbaccel;
77
75#endif /* __NV50_FBCON_H__ */ 78#endif /* __NV50_FBCON_H__ */
76 79
diff --git a/drivers/gpu/drm/nouveau/nouveau_sysfs.c b/drivers/gpu/drm/nouveau/nouveau_sysfs.c
index 3c6962d15b26..8fbbf3093d86 100644
--- a/drivers/gpu/drm/nouveau/nouveau_sysfs.c
+++ b/drivers/gpu/drm/nouveau/nouveau_sysfs.c
@@ -29,7 +29,7 @@
29#include "nouveau_sysfs.h" 29#include "nouveau_sysfs.h"
30 30
31MODULE_PARM_DESC(pstate, "enable sysfs pstate file, which will be moved in the future"); 31MODULE_PARM_DESC(pstate, "enable sysfs pstate file, which will be moved in the future");
32static int nouveau_pstate; 32int nouveau_pstate;
33module_param_named(pstate, nouveau_pstate, int, 0400); 33module_param_named(pstate, nouveau_pstate, int, 0400);
34 34
35static inline struct drm_device * 35static inline struct drm_device *
diff --git a/drivers/gpu/drm/nouveau/nouveau_sysfs.h b/drivers/gpu/drm/nouveau/nouveau_sysfs.h
index f973378160f8..4e5ea9241b28 100644
--- a/drivers/gpu/drm/nouveau/nouveau_sysfs.h
+++ b/drivers/gpu/drm/nouveau/nouveau_sysfs.h
@@ -16,4 +16,6 @@ nouveau_sysfs(struct drm_device *dev)
16int nouveau_sysfs_init(struct drm_device *); 16int nouveau_sysfs_init(struct drm_device *);
17void nouveau_sysfs_fini(struct drm_device *); 17void nouveau_sysfs_fini(struct drm_device *);
18 18
19extern int nouveau_pstate;
20
19#endif 21#endif
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index 03949eaa629f..fdb3e1adea1e 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -1066,7 +1066,7 @@ nv50_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *umode,
1066 u32 vscan = (mode->flags & DRM_MODE_FLAG_DBLSCAN) ? 2 : 1; 1066 u32 vscan = (mode->flags & DRM_MODE_FLAG_DBLSCAN) ? 2 : 1;
1067 u32 hactive, hsynce, hbackp, hfrontp, hblanke, hblanks; 1067 u32 hactive, hsynce, hbackp, hfrontp, hblanke, hblanks;
1068 u32 vactive, vsynce, vbackp, vfrontp, vblanke, vblanks; 1068 u32 vactive, vsynce, vbackp, vfrontp, vblanke, vblanks;
1069 u32 vblan2e = 0, vblan2s = 1; 1069 u32 vblan2e = 0, vblan2s = 1, vblankus = 0;
1070 u32 *push; 1070 u32 *push;
1071 int ret; 1071 int ret;
1072 1072
@@ -1083,6 +1083,11 @@ nv50_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *umode,
1083 vblanke = vsynce + vbackp; 1083 vblanke = vsynce + vbackp;
1084 vfrontp = (mode->vsync_start - mode->vdisplay) * vscan / ilace; 1084 vfrontp = (mode->vsync_start - mode->vdisplay) * vscan / ilace;
1085 vblanks = vactive - vfrontp - 1; 1085 vblanks = vactive - vfrontp - 1;
1086 /* XXX: Safe underestimate, even "0" works */
1087 vblankus = (vactive - mode->vdisplay - 2) * hactive;
1088 vblankus *= 1000;
1089 vblankus /= mode->clock;
1090
1086 if (mode->flags & DRM_MODE_FLAG_INTERLACE) { 1091 if (mode->flags & DRM_MODE_FLAG_INTERLACE) {
1087 vblan2e = vactive + vsynce + vbackp; 1092 vblan2e = vactive + vsynce + vbackp;
1088 vblan2s = vblan2e + (mode->vdisplay * vscan / ilace); 1093 vblan2s = vblan2e + (mode->vdisplay * vscan / ilace);
@@ -1099,14 +1104,14 @@ nv50_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *umode,
1099 evo_mthd(push, 0x0804 + (nv_crtc->index * 0x400), 2); 1104 evo_mthd(push, 0x0804 + (nv_crtc->index * 0x400), 2);
1100 evo_data(push, 0x00800000 | mode->clock); 1105 evo_data(push, 0x00800000 | mode->clock);
1101 evo_data(push, (ilace == 2) ? 2 : 0); 1106 evo_data(push, (ilace == 2) ? 2 : 0);
1102 evo_mthd(push, 0x0810 + (nv_crtc->index * 0x400), 6); 1107 evo_mthd(push, 0x0810 + (nv_crtc->index * 0x400), 8);
1103 evo_data(push, 0x00000000); 1108 evo_data(push, 0x00000000);
1104 evo_data(push, (vactive << 16) | hactive); 1109 evo_data(push, (vactive << 16) | hactive);
1105 evo_data(push, ( vsynce << 16) | hsynce); 1110 evo_data(push, ( vsynce << 16) | hsynce);
1106 evo_data(push, (vblanke << 16) | hblanke); 1111 evo_data(push, (vblanke << 16) | hblanke);
1107 evo_data(push, (vblanks << 16) | hblanks); 1112 evo_data(push, (vblanks << 16) | hblanks);
1108 evo_data(push, (vblan2e << 16) | vblan2s); 1113 evo_data(push, (vblan2e << 16) | vblan2s);
1109 evo_mthd(push, 0x082c + (nv_crtc->index * 0x400), 1); 1114 evo_data(push, vblankus);
1110 evo_data(push, 0x00000000); 1115 evo_data(push, 0x00000000);
1111 evo_mthd(push, 0x0900 + (nv_crtc->index * 0x400), 2); 1116 evo_mthd(push, 0x0900 + (nv_crtc->index * 0x400), 2);
1112 evo_data(push, 0x00000311); 1117 evo_data(push, 0x00000311);
@@ -1651,17 +1656,21 @@ static void
1651nv50_audio_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode) 1656nv50_audio_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode)
1652{ 1657{
1653 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); 1658 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
1659 struct nouveau_crtc *nv_crtc = nouveau_crtc(encoder->crtc);
1654 struct nouveau_connector *nv_connector; 1660 struct nouveau_connector *nv_connector;
1655 struct nv50_disp *disp = nv50_disp(encoder->dev); 1661 struct nv50_disp *disp = nv50_disp(encoder->dev);
1656 struct { 1662 struct __packed {
1657 struct nv50_disp_mthd_v1 base; 1663 struct {
1658 struct nv50_disp_sor_hda_eld_v0 eld; 1664 struct nv50_disp_mthd_v1 mthd;
1665 struct nv50_disp_sor_hda_eld_v0 eld;
1666 } base;
1659 u8 data[sizeof(nv_connector->base.eld)]; 1667 u8 data[sizeof(nv_connector->base.eld)];
1660 } args = { 1668 } args = {
1661 .base.version = 1, 1669 .base.mthd.version = 1,
1662 .base.method = NV50_DISP_MTHD_V1_SOR_HDA_ELD, 1670 .base.mthd.method = NV50_DISP_MTHD_V1_SOR_HDA_ELD,
1663 .base.hasht = nv_encoder->dcb->hasht, 1671 .base.mthd.hasht = nv_encoder->dcb->hasht,
1664 .base.hashm = nv_encoder->dcb->hashm, 1672 .base.mthd.hashm = (0xf0ff & nv_encoder->dcb->hashm) |
1673 (0x0100 << nv_crtc->index),
1665 }; 1674 };
1666 1675
1667 nv_connector = nouveau_encoder_connector_get(nv_encoder); 1676 nv_connector = nouveau_encoder_connector_get(nv_encoder);
@@ -1671,11 +1680,11 @@ nv50_audio_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode)
1671 drm_edid_to_eld(&nv_connector->base, nv_connector->edid); 1680 drm_edid_to_eld(&nv_connector->base, nv_connector->edid);
1672 memcpy(args.data, nv_connector->base.eld, sizeof(args.data)); 1681 memcpy(args.data, nv_connector->base.eld, sizeof(args.data));
1673 1682
1674 nvif_mthd(disp->disp, 0, &args, sizeof(args)); 1683 nvif_mthd(disp->disp, 0, &args, sizeof(args.base) + args.data[2] * 4);
1675} 1684}
1676 1685
1677static void 1686static void
1678nv50_audio_disconnect(struct drm_encoder *encoder) 1687nv50_audio_disconnect(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc)
1679{ 1688{
1680 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); 1689 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
1681 struct nv50_disp *disp = nv50_disp(encoder->dev); 1690 struct nv50_disp *disp = nv50_disp(encoder->dev);
@@ -1686,7 +1695,8 @@ nv50_audio_disconnect(struct drm_encoder *encoder)
1686 .base.version = 1, 1695 .base.version = 1,
1687 .base.method = NV50_DISP_MTHD_V1_SOR_HDA_ELD, 1696 .base.method = NV50_DISP_MTHD_V1_SOR_HDA_ELD,
1688 .base.hasht = nv_encoder->dcb->hasht, 1697 .base.hasht = nv_encoder->dcb->hasht,
1689 .base.hashm = nv_encoder->dcb->hashm, 1698 .base.hashm = (0xf0ff & nv_encoder->dcb->hashm) |
1699 (0x0100 << nv_crtc->index),
1690 }; 1700 };
1691 1701
1692 nvif_mthd(disp->disp, 0, &args, sizeof(args)); 1702 nvif_mthd(disp->disp, 0, &args, sizeof(args));
@@ -1745,8 +1755,6 @@ nv50_hdmi_disconnect(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc)
1745 (0x0100 << nv_crtc->index), 1755 (0x0100 << nv_crtc->index),
1746 }; 1756 };
1747 1757
1748 nv50_audio_disconnect(encoder);
1749
1750 nvif_mthd(disp->disp, 0, &args, sizeof(args)); 1758 nvif_mthd(disp->disp, 0, &args, sizeof(args));
1751} 1759}
1752 1760
@@ -1855,6 +1863,7 @@ nv50_sor_disconnect(struct drm_encoder *encoder)
1855 if (nv_crtc) { 1863 if (nv_crtc) {
1856 nv50_crtc_prepare(&nv_crtc->base); 1864 nv50_crtc_prepare(&nv_crtc->base);
1857 nv50_sor_ctrl(nv_encoder, 1 << nv_crtc->index, 0); 1865 nv50_sor_ctrl(nv_encoder, 1 << nv_crtc->index, 0);
1866 nv50_audio_disconnect(encoder, nv_crtc);
1858 nv50_hdmi_disconnect(&nv_encoder->base.base, nv_crtc); 1867 nv50_hdmi_disconnect(&nv_encoder->base.base, nv_crtc);
1859 } 1868 }
1860} 1869}
@@ -1954,6 +1963,7 @@ nv50_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *umode,
1954 proto = 0x8; 1963 proto = 0x8;
1955 else 1964 else
1956 proto = 0x9; 1965 proto = 0x9;
1966 nv50_audio_mode_set(encoder, mode);
1957 break; 1967 break;
1958 default: 1968 default:
1959 BUG_ON(1); 1969 BUG_ON(1);
diff --git a/drivers/gpu/drm/nouveau/nvif/class.h b/drivers/gpu/drm/nouveau/nvif/class.h
index 573491f84792..e5a27df0672b 100644
--- a/drivers/gpu/drm/nouveau/nvif/class.h
+++ b/drivers/gpu/drm/nouveau/nvif/class.h
@@ -479,6 +479,8 @@ struct nv50_disp_core_channel_dma_v0 {
479 __u32 pushbuf; 479 __u32 pushbuf;
480}; 480};
481 481
482#define NV50_DISP_CORE_CHANNEL_DMA_V0_NTFY_UEVENT 0x00
483
482/* cursor immediate */ 484/* cursor immediate */
483struct nv50_disp_cursor_v0 { 485struct nv50_disp_cursor_v0 {
484 __u8 version; 486 __u8 version;
@@ -486,6 +488,8 @@ struct nv50_disp_cursor_v0 {
486 __u8 pad02[6]; 488 __u8 pad02[6];
487}; 489};
488 490
491#define NV50_DISP_CURSOR_V0_NTFY_UEVENT 0x00
492
489/* base */ 493/* base */
490struct nv50_disp_base_channel_dma_v0 { 494struct nv50_disp_base_channel_dma_v0 {
491 __u8 version; 495 __u8 version;
@@ -494,6 +498,8 @@ struct nv50_disp_base_channel_dma_v0 {
494 __u32 pushbuf; 498 __u32 pushbuf;
495}; 499};
496 500
501#define NV50_DISP_BASE_CHANNEL_DMA_V0_NTFY_UEVENT 0x00
502
497/* overlay */ 503/* overlay */
498struct nv50_disp_overlay_channel_dma_v0 { 504struct nv50_disp_overlay_channel_dma_v0 {
499 __u8 version; 505 __u8 version;
@@ -502,6 +508,8 @@ struct nv50_disp_overlay_channel_dma_v0 {
502 __u32 pushbuf; 508 __u32 pushbuf;
503}; 509};
504 510
511#define NV50_DISP_OVERLAY_CHANNEL_DMA_V0_NTFY_UEVENT 0x00
512
505/* overlay immediate */ 513/* overlay immediate */
506struct nv50_disp_overlay_v0 { 514struct nv50_disp_overlay_v0 {
507 __u8 version; 515 __u8 version;
@@ -509,6 +517,7 @@ struct nv50_disp_overlay_v0 {
509 __u8 pad02[6]; 517 __u8 pad02[6];
510}; 518};
511 519
520#define NV50_DISP_OVERLAY_V0_NTFY_UEVENT 0x00
512 521
513/******************************************************************************* 522/*******************************************************************************
514 * fermi 523 * fermi