aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/nouveau')
-rw-r--r--drivers/gpu/drm/nouveau/Kconfig7
-rw-r--r--drivers/gpu/drm/nouveau/Makefile34
-rw-r--r--drivers/gpu/drm/nouveau/core/core/mm.c1
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/bsp/nv84.c27
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/bsp/nv98.c93
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/bsp/nvc0.c3
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/bsp/nve0.c3
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/copy/fuc/nva3.fuc.h4
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/copy/fuc/nvc0.fuc.h4
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/copy/nva3.c21
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/copy/nvc0.c10
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/copy/nve0.c47
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/crypt/fuc/nv98.fuc.h4
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/crypt/nv84.c8
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/crypt/nv98.c10
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/device/nv50.c36
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/device/nvc0.c36
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/device/nve0.c23
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/hdminva3.c4
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/nv50.c12
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c14
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/nve0.c3
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/nvf0.c3
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/falcon.c (renamed from drivers/gpu/drm/nouveau/core/core/falcon.c)3
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/fifo/nv40.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/fifo/nv84.c4
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c57
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.c4073
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc1.c823
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc3.c99
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc8.c370
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd7.c290
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd9.c515
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/ctxnve0.c2793
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/ctxnve4.c1018
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/ctxnvf0.c328
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/com.fuc (renamed from drivers/gpu/drm/nouveau/core/engine/graph/fuc/nvc0.fuc)69
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpc.fuc404
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvc0.fuc530
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvc0.fuc.h664
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvd7.fuc42
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvd7.fuc.h475
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc442
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc.h576
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvf0.fuc42
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvf0.fuc.h475
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/hub.fuc724
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc855
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h1173
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvd7.fuc40
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvd7.fuc.h921
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc779
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h1124
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvf0.fuc40
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvf0.fuc.h918
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/macros.fuc89
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/nve0.fuc400
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/os.h7
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nv50.c18
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c1116
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h225
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nvc1.c144
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nvc3.c110
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nvc8.c141
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nvd7.c167
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nvd9.c165
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nve0.c807
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nve4.c354
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nvf0.c248
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/mpeg/nv50.c8
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/mpeg/nv84.c1
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/ppp/nvc0.c3
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/vp/nv84.c27
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/vp/nv98.c93
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/vp/nvc0.c3
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/vp/nve0.c3
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/xtensa.c170
-rw-r--r--drivers/gpu/drm/nouveau/core/include/core/device.h5
-rw-r--r--drivers/gpu/drm/nouveau/core/include/core/mm.h2
-rw-r--r--drivers/gpu/drm/nouveau/core/include/engine/bsp.h1
-rw-r--r--drivers/gpu/drm/nouveau/core/include/engine/copy.h1
-rw-r--r--drivers/gpu/drm/nouveau/core/include/engine/falcon.h (renamed from drivers/gpu/drm/nouveau/core/include/core/falcon.h)0
-rw-r--r--drivers/gpu/drm/nouveau/core/include/engine/graph.h10
-rw-r--r--drivers/gpu/drm/nouveau/core/include/engine/mpeg.h1
-rw-r--r--drivers/gpu/drm/nouveau/core/include/engine/vp.h1
-rw-r--r--drivers/gpu/drm/nouveau/core/include/engine/xtensa.h38
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/clock.h2
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/devinit.h21
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/fb.h95
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/vm.h5
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bar/nv50.c13
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c10
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/base.c6
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/init.c7
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/clock/nv04.c274
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/clock/nv40.c1
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/clock/nv50.c45
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/clock/nva3.c37
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c36
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/clock/pll.h4
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/clock/pllnv04.c17
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/clock/pllnva3.c18
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/devinit/base.c23
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/devinit/nv04.c329
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/devinit/nv05.c3
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/devinit/nv10.c3
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/devinit/nv1a.c4
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/devinit/nv20.c5
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/devinit/nv50.c78
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/devinit/nva3.c87
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/devinit/nvc0.c90
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/devinit/priv.h25
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/base.c125
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nv04.c54
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nv10.c20
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nv1a.c32
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nv20.c26
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nv25.c9
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nv30.c9
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nv35.c9
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nv36.c9
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nv40.c25
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nv41.c23
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nv44.c22
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nv46.c7
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nv47.c7
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nv49.c25
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nv4e.c15
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c199
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c143
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/priv.h87
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/ramnv04.c95
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/ramnv10.c61
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/ramnv1a.c71
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/ramnv20.c63
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/ramnv40.c65
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/ramnv41.c64
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/ramnv44.c62
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/ramnv49.c64
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/ramnv4e.c55
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/ramnv50.c232
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c186
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/instmem/nv50.c4
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/ltcg/nvc0.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/mc/nv50.c1
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/mc/nvc0.c1
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/vm/base.c44
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/vm/nv50.c56
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/vm/nvc0.c57
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_abi16.c1
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bios.c10
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bo.c12
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_chan.c4
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_display.c116
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drm.c1
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drm.h1
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_fbcon.c27
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_fence.c73
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_fence.h2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_gem.c84
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_gem.h1
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_mem.c14
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_prime.c9
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_ttm.c28
-rw-r--r--drivers/gpu/drm/nouveau/nv50_display.c18
-rw-r--r--drivers/gpu/drm/nouveau/nv50_pm.c4
-rw-r--r--drivers/gpu/drm/nouveau/nva3_pm.c4
-rw-r--r--drivers/gpu/drm/nouveau/nvc0_pm.c8
168 files changed, 15665 insertions, 13452 deletions
diff --git a/drivers/gpu/drm/nouveau/Kconfig b/drivers/gpu/drm/nouveau/Kconfig
index a7ff6d5a34b9..ff80f12480ea 100644
--- a/drivers/gpu/drm/nouveau/Kconfig
+++ b/drivers/gpu/drm/nouveau/Kconfig
@@ -15,6 +15,13 @@ config DRM_NOUVEAU
15 select ACPI_WMI if ACPI && X86 15 select ACPI_WMI if ACPI && X86
16 select MXM_WMI if ACPI && X86 16 select MXM_WMI if ACPI && X86
17 select POWER_SUPPLY 17 select POWER_SUPPLY
18 # Similar to i915, we need to select ACPI_VIDEO and it's dependencies
19 select BACKLIGHT_LCD_SUPPORT if ACPI && X86
20 select BACKLIGHT_CLASS_DEVICE if ACPI && X86
21 select VIDEO_OUTPUT_CONTROL if ACPI && X86
22 select INPUT if ACPI && X86
23 select THERMAL if ACPI && X86
24 select ACPI_VIDEO if ACPI && X86
18 help 25 help
19 Choose this option for open-source nVidia support. 26 Choose this option for open-source nVidia support.
20 27
diff --git a/drivers/gpu/drm/nouveau/Makefile b/drivers/gpu/drm/nouveau/Makefile
index 998e8b4444f3..d939a1da3203 100644
--- a/drivers/gpu/drm/nouveau/Makefile
+++ b/drivers/gpu/drm/nouveau/Makefile
@@ -12,7 +12,6 @@ nouveau-y += core/core/engctx.o
12nouveau-y += core/core/engine.o 12nouveau-y += core/core/engine.o
13nouveau-y += core/core/enum.o 13nouveau-y += core/core/enum.o
14nouveau-y += core/core/event.o 14nouveau-y += core/core/event.o
15nouveau-y += core/core/falcon.o
16nouveau-y += core/core/gpuobj.o 15nouveau-y += core/core/gpuobj.o
17nouveau-y += core/core/handle.o 16nouveau-y += core/core/handle.o
18nouveau-y += core/core/mm.o 17nouveau-y += core/core/mm.o
@@ -60,6 +59,8 @@ nouveau-y += core/subdev/devinit/nv10.o
60nouveau-y += core/subdev/devinit/nv1a.o 59nouveau-y += core/subdev/devinit/nv1a.o
61nouveau-y += core/subdev/devinit/nv20.o 60nouveau-y += core/subdev/devinit/nv20.o
62nouveau-y += core/subdev/devinit/nv50.o 61nouveau-y += core/subdev/devinit/nv50.o
62nouveau-y += core/subdev/devinit/nva3.o
63nouveau-y += core/subdev/devinit/nvc0.o
63nouveau-y += core/subdev/fb/base.o 64nouveau-y += core/subdev/fb/base.o
64nouveau-y += core/subdev/fb/nv04.o 65nouveau-y += core/subdev/fb/nv04.o
65nouveau-y += core/subdev/fb/nv10.o 66nouveau-y += core/subdev/fb/nv10.o
@@ -78,6 +79,17 @@ nouveau-y += core/subdev/fb/nv49.o
78nouveau-y += core/subdev/fb/nv4e.o 79nouveau-y += core/subdev/fb/nv4e.o
79nouveau-y += core/subdev/fb/nv50.o 80nouveau-y += core/subdev/fb/nv50.o
80nouveau-y += core/subdev/fb/nvc0.o 81nouveau-y += core/subdev/fb/nvc0.o
82nouveau-y += core/subdev/fb/ramnv04.o
83nouveau-y += core/subdev/fb/ramnv10.o
84nouveau-y += core/subdev/fb/ramnv1a.o
85nouveau-y += core/subdev/fb/ramnv20.o
86nouveau-y += core/subdev/fb/ramnv40.o
87nouveau-y += core/subdev/fb/ramnv41.o
88nouveau-y += core/subdev/fb/ramnv44.o
89nouveau-y += core/subdev/fb/ramnv49.o
90nouveau-y += core/subdev/fb/ramnv4e.o
91nouveau-y += core/subdev/fb/ramnv50.o
92nouveau-y += core/subdev/fb/ramnvc0.o
81nouveau-y += core/subdev/gpio/base.o 93nouveau-y += core/subdev/gpio/base.o
82nouveau-y += core/subdev/gpio/nv10.o 94nouveau-y += core/subdev/gpio/nv10.o
83nouveau-y += core/subdev/gpio/nv50.o 95nouveau-y += core/subdev/gpio/nv50.o
@@ -129,12 +141,15 @@ nouveau-y += core/subdev/vm/nv44.o
129nouveau-y += core/subdev/vm/nv50.o 141nouveau-y += core/subdev/vm/nv50.o
130nouveau-y += core/subdev/vm/nvc0.o 142nouveau-y += core/subdev/vm/nvc0.o
131 143
144nouveau-y += core/engine/falcon.o
145nouveau-y += core/engine/xtensa.o
132nouveau-y += core/engine/dmaobj/base.o 146nouveau-y += core/engine/dmaobj/base.o
133nouveau-y += core/engine/dmaobj/nv04.o 147nouveau-y += core/engine/dmaobj/nv04.o
134nouveau-y += core/engine/dmaobj/nv50.o 148nouveau-y += core/engine/dmaobj/nv50.o
135nouveau-y += core/engine/dmaobj/nvc0.o 149nouveau-y += core/engine/dmaobj/nvc0.o
136nouveau-y += core/engine/dmaobj/nvd0.o 150nouveau-y += core/engine/dmaobj/nvd0.o
137nouveau-y += core/engine/bsp/nv84.o 151nouveau-y += core/engine/bsp/nv84.o
152nouveau-y += core/engine/bsp/nv98.o
138nouveau-y += core/engine/bsp/nvc0.o 153nouveau-y += core/engine/bsp/nvc0.o
139nouveau-y += core/engine/bsp/nve0.o 154nouveau-y += core/engine/bsp/nve0.o
140nouveau-y += core/engine/copy/nva3.o 155nouveau-y += core/engine/copy/nva3.o
@@ -185,7 +200,13 @@ nouveau-y += core/engine/fifo/nve0.o
185nouveau-y += core/engine/graph/ctxnv40.o 200nouveau-y += core/engine/graph/ctxnv40.o
186nouveau-y += core/engine/graph/ctxnv50.o 201nouveau-y += core/engine/graph/ctxnv50.o
187nouveau-y += core/engine/graph/ctxnvc0.o 202nouveau-y += core/engine/graph/ctxnvc0.o
188nouveau-y += core/engine/graph/ctxnve0.o 203nouveau-y += core/engine/graph/ctxnvc1.o
204nouveau-y += core/engine/graph/ctxnvc3.o
205nouveau-y += core/engine/graph/ctxnvc8.o
206nouveau-y += core/engine/graph/ctxnvd7.o
207nouveau-y += core/engine/graph/ctxnvd9.o
208nouveau-y += core/engine/graph/ctxnve4.o
209nouveau-y += core/engine/graph/ctxnvf0.o
189nouveau-y += core/engine/graph/nv04.o 210nouveau-y += core/engine/graph/nv04.o
190nouveau-y += core/engine/graph/nv10.o 211nouveau-y += core/engine/graph/nv10.o
191nouveau-y += core/engine/graph/nv20.o 212nouveau-y += core/engine/graph/nv20.o
@@ -197,7 +218,13 @@ nouveau-y += core/engine/graph/nv35.o
197nouveau-y += core/engine/graph/nv40.o 218nouveau-y += core/engine/graph/nv40.o
198nouveau-y += core/engine/graph/nv50.o 219nouveau-y += core/engine/graph/nv50.o
199nouveau-y += core/engine/graph/nvc0.o 220nouveau-y += core/engine/graph/nvc0.o
200nouveau-y += core/engine/graph/nve0.o 221nouveau-y += core/engine/graph/nvc1.o
222nouveau-y += core/engine/graph/nvc3.o
223nouveau-y += core/engine/graph/nvc8.o
224nouveau-y += core/engine/graph/nvd7.o
225nouveau-y += core/engine/graph/nvd9.o
226nouveau-y += core/engine/graph/nve4.o
227nouveau-y += core/engine/graph/nvf0.o
201nouveau-y += core/engine/mpeg/nv31.o 228nouveau-y += core/engine/mpeg/nv31.o
202nouveau-y += core/engine/mpeg/nv40.o 229nouveau-y += core/engine/mpeg/nv40.o
203nouveau-y += core/engine/mpeg/nv50.o 230nouveau-y += core/engine/mpeg/nv50.o
@@ -209,6 +236,7 @@ nouveau-y += core/engine/software/nv10.o
209nouveau-y += core/engine/software/nv50.o 236nouveau-y += core/engine/software/nv50.o
210nouveau-y += core/engine/software/nvc0.o 237nouveau-y += core/engine/software/nvc0.o
211nouveau-y += core/engine/vp/nv84.o 238nouveau-y += core/engine/vp/nv84.o
239nouveau-y += core/engine/vp/nv98.o
212nouveau-y += core/engine/vp/nvc0.o 240nouveau-y += core/engine/vp/nvc0.o
213nouveau-y += core/engine/vp/nve0.o 241nouveau-y += core/engine/vp/nve0.o
214 242
diff --git a/drivers/gpu/drm/nouveau/core/core/mm.c b/drivers/gpu/drm/nouveau/core/core/mm.c
index 0261a11b2ae0..d8291724dbd4 100644
--- a/drivers/gpu/drm/nouveau/core/core/mm.c
+++ b/drivers/gpu/drm/nouveau/core/core/mm.c
@@ -208,7 +208,6 @@ nouveau_mm_init(struct nouveau_mm *mm, u32 offset, u32 length, u32 block)
208 struct nouveau_mm_node *node; 208 struct nouveau_mm_node *node;
209 209
210 if (block) { 210 if (block) {
211 mutex_init(&mm->mutex);
212 INIT_LIST_HEAD(&mm->nodes); 211 INIT_LIST_HEAD(&mm->nodes);
213 INIT_LIST_HEAD(&mm->free); 212 INIT_LIST_HEAD(&mm->free);
214 mm->block_size = block; 213 mm->block_size = block;
diff --git a/drivers/gpu/drm/nouveau/core/engine/bsp/nv84.c b/drivers/gpu/drm/nouveau/core/engine/bsp/nv84.c
index 1d9f614cb97d..1e8e75c0684a 100644
--- a/drivers/gpu/drm/nouveau/core/engine/bsp/nv84.c
+++ b/drivers/gpu/drm/nouveau/core/engine/bsp/nv84.c
@@ -19,24 +19,19 @@
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE. 20 * OTHER DEALINGS IN THE SOFTWARE.
21 * 21 *
22 * Authors: Ben Skeggs 22 * Authors: Ben Skeggs, Ilia Mirkin
23 */ 23 */
24 24
25#include <core/engctx.h> 25#include <engine/xtensa.h>
26#include <core/class.h>
27
28#include <engine/bsp.h> 26#include <engine/bsp.h>
29 27
30struct nv84_bsp_priv {
31 struct nouveau_engine base;
32};
33
34/******************************************************************************* 28/*******************************************************************************
35 * BSP object classes 29 * BSP object classes
36 ******************************************************************************/ 30 ******************************************************************************/
37 31
38static struct nouveau_oclass 32static struct nouveau_oclass
39nv84_bsp_sclass[] = { 33nv84_bsp_sclass[] = {
34 { 0x74b0, &nouveau_object_ofuncs },
40 {}, 35 {},
41}; 36};
42 37
@@ -48,7 +43,7 @@ static struct nouveau_oclass
48nv84_bsp_cclass = { 43nv84_bsp_cclass = {
49 .handle = NV_ENGCTX(BSP, 0x84), 44 .handle = NV_ENGCTX(BSP, 0x84),
50 .ofuncs = &(struct nouveau_ofuncs) { 45 .ofuncs = &(struct nouveau_ofuncs) {
51 .ctor = _nouveau_engctx_ctor, 46 .ctor = _nouveau_xtensa_engctx_ctor,
52 .dtor = _nouveau_engctx_dtor, 47 .dtor = _nouveau_engctx_dtor,
53 .init = _nouveau_engctx_init, 48 .init = _nouveau_engctx_init,
54 .fini = _nouveau_engctx_fini, 49 .fini = _nouveau_engctx_fini,
@@ -66,10 +61,10 @@ nv84_bsp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
66 struct nouveau_oclass *oclass, void *data, u32 size, 61 struct nouveau_oclass *oclass, void *data, u32 size,
67 struct nouveau_object **pobject) 62 struct nouveau_object **pobject)
68{ 63{
69 struct nv84_bsp_priv *priv; 64 struct nouveau_xtensa *priv;
70 int ret; 65 int ret;
71 66
72 ret = nouveau_engine_create(parent, engine, oclass, true, 67 ret = nouveau_xtensa_create(parent, engine, oclass, 0x103000, true,
73 "PBSP", "bsp", &priv); 68 "PBSP", "bsp", &priv);
74 *pobject = nv_object(priv); 69 *pobject = nv_object(priv);
75 if (ret) 70 if (ret)
@@ -78,6 +73,8 @@ nv84_bsp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
78 nv_subdev(priv)->unit = 0x04008000; 73 nv_subdev(priv)->unit = 0x04008000;
79 nv_engine(priv)->cclass = &nv84_bsp_cclass; 74 nv_engine(priv)->cclass = &nv84_bsp_cclass;
80 nv_engine(priv)->sclass = nv84_bsp_sclass; 75 nv_engine(priv)->sclass = nv84_bsp_sclass;
76 priv->fifo_val = 0x1111;
77 priv->unkd28 = 0x90044;
81 return 0; 78 return 0;
82} 79}
83 80
@@ -86,8 +83,10 @@ nv84_bsp_oclass = {
86 .handle = NV_ENGINE(BSP, 0x84), 83 .handle = NV_ENGINE(BSP, 0x84),
87 .ofuncs = &(struct nouveau_ofuncs) { 84 .ofuncs = &(struct nouveau_ofuncs) {
88 .ctor = nv84_bsp_ctor, 85 .ctor = nv84_bsp_ctor,
89 .dtor = _nouveau_engine_dtor, 86 .dtor = _nouveau_xtensa_dtor,
90 .init = _nouveau_engine_init, 87 .init = _nouveau_xtensa_init,
91 .fini = _nouveau_engine_fini, 88 .fini = _nouveau_xtensa_fini,
89 .rd32 = _nouveau_xtensa_rd32,
90 .wr32 = _nouveau_xtensa_wr32,
92 }, 91 },
93}; 92};
diff --git a/drivers/gpu/drm/nouveau/core/engine/bsp/nv98.c b/drivers/gpu/drm/nouveau/core/engine/bsp/nv98.c
new file mode 100644
index 000000000000..8bf92b0e6d82
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/bsp/nv98.c
@@ -0,0 +1,93 @@
1/*
2 * Copyright 2012 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/engctx.h>
26#include <core/class.h>
27
28#include <engine/bsp.h>
29
30struct nv98_bsp_priv {
31 struct nouveau_engine base;
32};
33
34/*******************************************************************************
35 * BSP object classes
36 ******************************************************************************/
37
38static struct nouveau_oclass
39nv98_bsp_sclass[] = {
40 {},
41};
42
43/*******************************************************************************
44 * BSP context
45 ******************************************************************************/
46
47static struct nouveau_oclass
48nv98_bsp_cclass = {
49 .handle = NV_ENGCTX(BSP, 0x98),
50 .ofuncs = &(struct nouveau_ofuncs) {
51 .ctor = _nouveau_engctx_ctor,
52 .dtor = _nouveau_engctx_dtor,
53 .init = _nouveau_engctx_init,
54 .fini = _nouveau_engctx_fini,
55 .rd32 = _nouveau_engctx_rd32,
56 .wr32 = _nouveau_engctx_wr32,
57 },
58};
59
60/*******************************************************************************
61 * BSP engine/subdev functions
62 ******************************************************************************/
63
64static int
65nv98_bsp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
66 struct nouveau_oclass *oclass, void *data, u32 size,
67 struct nouveau_object **pobject)
68{
69 struct nv98_bsp_priv *priv;
70 int ret;
71
72 ret = nouveau_engine_create(parent, engine, oclass, true,
73 "PBSP", "bsp", &priv);
74 *pobject = nv_object(priv);
75 if (ret)
76 return ret;
77
78 nv_subdev(priv)->unit = 0x04008000;
79 nv_engine(priv)->cclass = &nv98_bsp_cclass;
80 nv_engine(priv)->sclass = nv98_bsp_sclass;
81 return 0;
82}
83
84struct nouveau_oclass
85nv98_bsp_oclass = {
86 .handle = NV_ENGINE(BSP, 0x98),
87 .ofuncs = &(struct nouveau_ofuncs) {
88 .ctor = nv98_bsp_ctor,
89 .dtor = _nouveau_engine_dtor,
90 .init = _nouveau_engine_init,
91 .fini = _nouveau_engine_fini,
92 },
93};
diff --git a/drivers/gpu/drm/nouveau/core/engine/bsp/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/bsp/nvc0.c
index 0a5aa6bb0870..262c9f5f5f60 100644
--- a/drivers/gpu/drm/nouveau/core/engine/bsp/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/bsp/nvc0.c
@@ -22,8 +22,7 @@
22 * Authors: Maarten Lankhorst 22 * Authors: Maarten Lankhorst
23 */ 23 */
24 24
25#include <core/falcon.h> 25#include <engine/falcon.h>
26
27#include <engine/bsp.h> 26#include <engine/bsp.h>
28 27
29struct nvc0_bsp_priv { 28struct nvc0_bsp_priv {
diff --git a/drivers/gpu/drm/nouveau/core/engine/bsp/nve0.c b/drivers/gpu/drm/nouveau/core/engine/bsp/nve0.c
index d4f23bbd75b4..c46882c83982 100644
--- a/drivers/gpu/drm/nouveau/core/engine/bsp/nve0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/bsp/nve0.c
@@ -22,8 +22,7 @@
22 * Authors: Ben Skeggs 22 * Authors: Ben Skeggs
23 */ 23 */
24 24
25#include <core/falcon.h> 25#include <engine/falcon.h>
26
27#include <engine/bsp.h> 26#include <engine/bsp.h>
28 27
29struct nve0_bsp_priv { 28struct nve0_bsp_priv {
diff --git a/drivers/gpu/drm/nouveau/core/engine/copy/fuc/nva3.fuc.h b/drivers/gpu/drm/nouveau/core/engine/copy/fuc/nva3.fuc.h
index c92520f3ed46..241b27201206 100644
--- a/drivers/gpu/drm/nouveau/core/engine/copy/fuc/nva3.fuc.h
+++ b/drivers/gpu/drm/nouveau/core/engine/copy/fuc/nva3.fuc.h
@@ -1,4 +1,4 @@
1static u32 nva3_pcopy_data[] = { 1uint32_t nva3_pcopy_data[] = {
2/* 0x0000: ctx_object */ 2/* 0x0000: ctx_object */
3 0x00000000, 3 0x00000000,
4/* 0x0004: ctx_dma */ 4/* 0x0004: ctx_dma */
@@ -183,7 +183,7 @@ static u32 nva3_pcopy_data[] = {
183 0x00000800, 183 0x00000800,
184}; 184};
185 185
186static u32 nva3_pcopy_code[] = { 186uint32_t nva3_pcopy_code[] = {
187/* 0x0000: main */ 187/* 0x0000: main */
188 0x04fe04bd, 188 0x04fe04bd,
189 0x3517f000, 189 0x3517f000,
diff --git a/drivers/gpu/drm/nouveau/core/engine/copy/fuc/nvc0.fuc.h b/drivers/gpu/drm/nouveau/core/engine/copy/fuc/nvc0.fuc.h
index 0d98c6c0958d..98cc4216a372 100644
--- a/drivers/gpu/drm/nouveau/core/engine/copy/fuc/nvc0.fuc.h
+++ b/drivers/gpu/drm/nouveau/core/engine/copy/fuc/nvc0.fuc.h
@@ -1,4 +1,4 @@
1static u32 nvc0_pcopy_data[] = { 1uint32_t nvc0_pcopy_data[] = {
2/* 0x0000: ctx_object */ 2/* 0x0000: ctx_object */
3 0x00000000, 3 0x00000000,
4/* 0x0004: ctx_query_address_high */ 4/* 0x0004: ctx_query_address_high */
@@ -171,7 +171,7 @@ static u32 nvc0_pcopy_data[] = {
171 0x00000800, 171 0x00000800,
172}; 172};
173 173
174static u32 nvc0_pcopy_code[] = { 174uint32_t nvc0_pcopy_code[] = {
175/* 0x0000: main */ 175/* 0x0000: main */
176 0x04fe04bd, 176 0x04fe04bd,
177 0x3517f000, 177 0x3517f000,
diff --git a/drivers/gpu/drm/nouveau/core/engine/copy/nva3.c b/drivers/gpu/drm/nouveau/core/engine/copy/nva3.c
index d6dc2a65ccd1..f31527733e00 100644
--- a/drivers/gpu/drm/nouveau/core/engine/copy/nva3.c
+++ b/drivers/gpu/drm/nouveau/core/engine/copy/nva3.c
@@ -22,16 +22,17 @@
22 * Authors: Ben Skeggs 22 * Authors: Ben Skeggs
23 */ 23 */
24 24
25#include <core/client.h> 25#include <engine/falcon.h>
26#include <core/falcon.h> 26#include <engine/fifo.h>
27#include <core/class.h> 27#include <engine/copy.h>
28#include <core/enum.h>
29 28
30#include <subdev/fb.h> 29#include <subdev/fb.h>
31#include <subdev/vm.h> 30#include <subdev/vm.h>
32 31
33#include <engine/fifo.h> 32#include <core/client.h>
34#include <engine/copy.h> 33#include <core/class.h>
34#include <core/enum.h>
35
35 36
36#include "fuc/nva3.fuc.h" 37#include "fuc/nva3.fuc.h"
37 38
@@ -117,13 +118,6 @@ nva3_copy_intr(struct nouveau_subdev *subdev)
117} 118}
118 119
119static int 120static int
120nva3_copy_tlb_flush(struct nouveau_engine *engine)
121{
122 nv50_vm_flush_engine(&engine->base, 0x0d);
123 return 0;
124}
125
126static int
127nva3_copy_ctor(struct nouveau_object *parent, struct nouveau_object *engine, 121nva3_copy_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
128 struct nouveau_oclass *oclass, void *data, u32 size, 122 struct nouveau_oclass *oclass, void *data, u32 size,
129 struct nouveau_object **pobject) 123 struct nouveau_object **pobject)
@@ -142,7 +136,6 @@ nva3_copy_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
142 nv_subdev(priv)->intr = nva3_copy_intr; 136 nv_subdev(priv)->intr = nva3_copy_intr;
143 nv_engine(priv)->cclass = &nva3_copy_cclass; 137 nv_engine(priv)->cclass = &nva3_copy_cclass;
144 nv_engine(priv)->sclass = nva3_copy_sclass; 138 nv_engine(priv)->sclass = nva3_copy_sclass;
145 nv_engine(priv)->tlb_flush = nva3_copy_tlb_flush;
146 nv_falcon(priv)->code.data = nva3_pcopy_code; 139 nv_falcon(priv)->code.data = nva3_pcopy_code;
147 nv_falcon(priv)->code.size = sizeof(nva3_pcopy_code); 140 nv_falcon(priv)->code.size = sizeof(nva3_pcopy_code);
148 nv_falcon(priv)->data.data = nva3_pcopy_data; 141 nv_falcon(priv)->data.data = nva3_pcopy_data;
diff --git a/drivers/gpu/drm/nouveau/core/engine/copy/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/copy/nvc0.c
index b3ed2737e21f..993df09ad643 100644
--- a/drivers/gpu/drm/nouveau/core/engine/copy/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/copy/nvc0.c
@@ -22,13 +22,15 @@
22 * Authors: Ben Skeggs 22 * Authors: Ben Skeggs
23 */ 23 */
24 24
25#include <core/falcon.h> 25#include <engine/falcon.h>
26#include <core/class.h>
27#include <core/enum.h>
28
29#include <engine/fifo.h> 26#include <engine/fifo.h>
30#include <engine/copy.h> 27#include <engine/copy.h>
31 28
29#include <core/class.h>
30#include <core/enum.h>
31#include <core/class.h>
32#include <core/enum.h>
33
32#include "fuc/nvc0.fuc.h" 34#include "fuc/nvc0.fuc.h"
33 35
34struct nvc0_copy_priv { 36struct nvc0_copy_priv {
diff --git a/drivers/gpu/drm/nouveau/core/engine/copy/nve0.c b/drivers/gpu/drm/nouveau/core/engine/copy/nve0.c
index dbbe9e8998fe..30f1ef1edcc5 100644
--- a/drivers/gpu/drm/nouveau/core/engine/copy/nve0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/copy/nve0.c
@@ -67,6 +67,19 @@ nve0_copy_cclass = {
67 * PCOPY engine/subdev functions 67 * PCOPY engine/subdev functions
68 ******************************************************************************/ 68 ******************************************************************************/
69 69
70static void
71nve0_copy_intr(struct nouveau_subdev *subdev)
72{
73 const int ce = nv_subidx(nv_object(subdev)) - NVDEV_ENGINE_COPY0;
74 struct nve0_copy_priv *priv = (void *)subdev;
75 u32 stat = nv_rd32(priv, 0x104908 + (ce * 0x1000));
76
77 if (stat) {
78 nv_warn(priv, "unhandled intr 0x%08x\n", stat);
79 nv_wr32(priv, 0x104908 + (ce * 0x1000), stat);
80 }
81}
82
70static int 83static int
71nve0_copy0_ctor(struct nouveau_object *parent, struct nouveau_object *engine, 84nve0_copy0_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
72 struct nouveau_oclass *oclass, void *data, u32 size, 85 struct nouveau_oclass *oclass, void *data, u32 size,
@@ -85,6 +98,7 @@ nve0_copy0_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
85 return ret; 98 return ret;
86 99
87 nv_subdev(priv)->unit = 0x00000040; 100 nv_subdev(priv)->unit = 0x00000040;
101 nv_subdev(priv)->intr = nve0_copy_intr;
88 nv_engine(priv)->cclass = &nve0_copy_cclass; 102 nv_engine(priv)->cclass = &nve0_copy_cclass;
89 nv_engine(priv)->sclass = nve0_copy_sclass; 103 nv_engine(priv)->sclass = nve0_copy_sclass;
90 return 0; 104 return 0;
@@ -108,6 +122,28 @@ nve0_copy1_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
108 return ret; 122 return ret;
109 123
110 nv_subdev(priv)->unit = 0x00000080; 124 nv_subdev(priv)->unit = 0x00000080;
125 nv_subdev(priv)->intr = nve0_copy_intr;
126 nv_engine(priv)->cclass = &nve0_copy_cclass;
127 nv_engine(priv)->sclass = nve0_copy_sclass;
128 return 0;
129}
130
131static int
132nve0_copy2_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
133 struct nouveau_oclass *oclass, void *data, u32 size,
134 struct nouveau_object **pobject)
135{
136 struct nve0_copy_priv *priv;
137 int ret;
138
139 ret = nouveau_engine_create(parent, engine, oclass, true,
140 "PCE2", "copy2", &priv);
141 *pobject = nv_object(priv);
142 if (ret)
143 return ret;
144
145 nv_subdev(priv)->unit = 0x00200000;
146 nv_subdev(priv)->intr = nve0_copy_intr;
111 nv_engine(priv)->cclass = &nve0_copy_cclass; 147 nv_engine(priv)->cclass = &nve0_copy_cclass;
112 nv_engine(priv)->sclass = nve0_copy_sclass; 148 nv_engine(priv)->sclass = nve0_copy_sclass;
113 return 0; 149 return 0;
@@ -134,3 +170,14 @@ nve0_copy1_oclass = {
134 .fini = _nouveau_engine_fini, 170 .fini = _nouveau_engine_fini,
135 }, 171 },
136}; 172};
173
174struct nouveau_oclass
175nve0_copy2_oclass = {
176 .handle = NV_ENGINE(COPY2, 0xe0),
177 .ofuncs = &(struct nouveau_ofuncs) {
178 .ctor = nve0_copy2_ctor,
179 .dtor = _nouveau_engine_dtor,
180 .init = _nouveau_engine_init,
181 .fini = _nouveau_engine_fini,
182 },
183};
diff --git a/drivers/gpu/drm/nouveau/core/engine/crypt/fuc/nv98.fuc.h b/drivers/gpu/drm/nouveau/core/engine/crypt/fuc/nv98.fuc.h
index 09962e4210e9..38676c74e6e0 100644
--- a/drivers/gpu/drm/nouveau/core/engine/crypt/fuc/nv98.fuc.h
+++ b/drivers/gpu/drm/nouveau/core/engine/crypt/fuc/nv98.fuc.h
@@ -1,4 +1,4 @@
1static uint32_t nv98_pcrypt_data[] = { 1uint32_t nv98_pcrypt_data[] = {
2/* 0x0000: ctx_dma */ 2/* 0x0000: ctx_dma */
3/* 0x0000: ctx_dma_query */ 3/* 0x0000: ctx_dma_query */
4 0x00000000, 4 0x00000000,
@@ -150,7 +150,7 @@ static uint32_t nv98_pcrypt_data[] = {
150 0x00000000, 150 0x00000000,
151}; 151};
152 152
153static uint32_t nv98_pcrypt_code[] = { 153uint32_t nv98_pcrypt_code[] = {
154 0x17f004bd, 154 0x17f004bd,
155 0x0010fe35, 155 0x0010fe35,
156 0xf10004fe, 156 0xf10004fe,
diff --git a/drivers/gpu/drm/nouveau/core/engine/crypt/nv84.c b/drivers/gpu/drm/nouveau/core/engine/crypt/nv84.c
index 5bc021f471f9..2551dafbec73 100644
--- a/drivers/gpu/drm/nouveau/core/engine/crypt/nv84.c
+++ b/drivers/gpu/drm/nouveau/core/engine/crypt/nv84.c
@@ -141,13 +141,6 @@ nv84_crypt_intr(struct nouveau_subdev *subdev)
141} 141}
142 142
143static int 143static int
144nv84_crypt_tlb_flush(struct nouveau_engine *engine)
145{
146 nv50_vm_flush_engine(&engine->base, 0x0a);
147 return 0;
148}
149
150static int
151nv84_crypt_ctor(struct nouveau_object *parent, struct nouveau_object *engine, 144nv84_crypt_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
152 struct nouveau_oclass *oclass, void *data, u32 size, 145 struct nouveau_oclass *oclass, void *data, u32 size,
153 struct nouveau_object **pobject) 146 struct nouveau_object **pobject)
@@ -165,7 +158,6 @@ nv84_crypt_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
165 nv_subdev(priv)->intr = nv84_crypt_intr; 158 nv_subdev(priv)->intr = nv84_crypt_intr;
166 nv_engine(priv)->cclass = &nv84_crypt_cclass; 159 nv_engine(priv)->cclass = &nv84_crypt_cclass;
167 nv_engine(priv)->sclass = nv84_crypt_sclass; 160 nv_engine(priv)->sclass = nv84_crypt_sclass;
168 nv_engine(priv)->tlb_flush = nv84_crypt_tlb_flush;
169 return 0; 161 return 0;
170} 162}
171 163
diff --git a/drivers/gpu/drm/nouveau/core/engine/crypt/nv98.c b/drivers/gpu/drm/nouveau/core/engine/crypt/nv98.c
index 8bf8955051d4..c7082377ec76 100644
--- a/drivers/gpu/drm/nouveau/core/engine/crypt/nv98.c
+++ b/drivers/gpu/drm/nouveau/core/engine/crypt/nv98.c
@@ -27,11 +27,11 @@
27#include <core/enum.h> 27#include <core/enum.h>
28#include <core/class.h> 28#include <core/class.h>
29#include <core/engctx.h> 29#include <core/engctx.h>
30#include <core/falcon.h>
31 30
32#include <subdev/timer.h> 31#include <subdev/timer.h>
33#include <subdev/fb.h> 32#include <subdev/fb.h>
34 33
34#include <engine/falcon.h>
35#include <engine/fifo.h> 35#include <engine/fifo.h>
36#include <engine/crypt.h> 36#include <engine/crypt.h>
37 37
@@ -119,13 +119,6 @@ nv98_crypt_intr(struct nouveau_subdev *subdev)
119} 119}
120 120
121static int 121static int
122nv98_crypt_tlb_flush(struct nouveau_engine *engine)
123{
124 nv50_vm_flush_engine(&engine->base, 0x0a);
125 return 0;
126}
127
128static int
129nv98_crypt_ctor(struct nouveau_object *parent, struct nouveau_object *engine, 122nv98_crypt_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
130 struct nouveau_oclass *oclass, void *data, u32 size, 123 struct nouveau_oclass *oclass, void *data, u32 size,
131 struct nouveau_object **pobject) 124 struct nouveau_object **pobject)
@@ -143,7 +136,6 @@ nv98_crypt_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
143 nv_subdev(priv)->intr = nv98_crypt_intr; 136 nv_subdev(priv)->intr = nv98_crypt_intr;
144 nv_engine(priv)->cclass = &nv98_crypt_cclass; 137 nv_engine(priv)->cclass = &nv98_crypt_cclass;
145 nv_engine(priv)->sclass = nv98_crypt_sclass; 138 nv_engine(priv)->sclass = nv98_crypt_sclass;
146 nv_engine(priv)->tlb_flush = nv98_crypt_tlb_flush;
147 nv_falcon(priv)->code.data = nv98_pcrypt_code; 139 nv_falcon(priv)->code.data = nv98_pcrypt_code;
148 nv_falcon(priv)->code.size = sizeof(nv98_pcrypt_code); 140 nv_falcon(priv)->code.size = sizeof(nv98_pcrypt_code);
149 nv_falcon(priv)->data.data = nv98_pcrypt_data; 141 nv_falcon(priv)->data.data = nv98_pcrypt_data;
diff --git a/drivers/gpu/drm/nouveau/core/engine/device/nv50.c b/drivers/gpu/drm/nouveau/core/engine/device/nv50.c
index 5e8c3de75593..ffc18b80c5d9 100644
--- a/drivers/gpu/drm/nouveau/core/engine/device/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/engine/device/nv50.c
@@ -227,9 +227,9 @@ nv50_identify(struct nouveau_device *device)
227 device->oclass[NVDEV_ENGINE_FIFO ] = &nv84_fifo_oclass; 227 device->oclass[NVDEV_ENGINE_FIFO ] = &nv84_fifo_oclass;
228 device->oclass[NVDEV_ENGINE_SW ] = &nv50_software_oclass; 228 device->oclass[NVDEV_ENGINE_SW ] = &nv50_software_oclass;
229 device->oclass[NVDEV_ENGINE_GR ] = &nv50_graph_oclass; 229 device->oclass[NVDEV_ENGINE_GR ] = &nv50_graph_oclass;
230 device->oclass[NVDEV_ENGINE_VP ] = &nv84_vp_oclass; 230 device->oclass[NVDEV_ENGINE_VP ] = &nv98_vp_oclass;
231 device->oclass[NVDEV_ENGINE_CRYPT ] = &nv98_crypt_oclass; 231 device->oclass[NVDEV_ENGINE_CRYPT ] = &nv98_crypt_oclass;
232 device->oclass[NVDEV_ENGINE_BSP ] = &nv84_bsp_oclass; 232 device->oclass[NVDEV_ENGINE_BSP ] = &nv98_bsp_oclass;
233 device->oclass[NVDEV_ENGINE_PPP ] = &nv98_ppp_oclass; 233 device->oclass[NVDEV_ENGINE_PPP ] = &nv98_ppp_oclass;
234 device->oclass[NVDEV_ENGINE_DISP ] = &nv94_disp_oclass; 234 device->oclass[NVDEV_ENGINE_DISP ] = &nv94_disp_oclass;
235 break; 235 break;
@@ -279,9 +279,9 @@ nv50_identify(struct nouveau_device *device)
279 device->oclass[NVDEV_ENGINE_FIFO ] = &nv84_fifo_oclass; 279 device->oclass[NVDEV_ENGINE_FIFO ] = &nv84_fifo_oclass;
280 device->oclass[NVDEV_ENGINE_SW ] = &nv50_software_oclass; 280 device->oclass[NVDEV_ENGINE_SW ] = &nv50_software_oclass;
281 device->oclass[NVDEV_ENGINE_GR ] = &nv50_graph_oclass; 281 device->oclass[NVDEV_ENGINE_GR ] = &nv50_graph_oclass;
282 device->oclass[NVDEV_ENGINE_VP ] = &nv84_vp_oclass; 282 device->oclass[NVDEV_ENGINE_VP ] = &nv98_vp_oclass;
283 device->oclass[NVDEV_ENGINE_CRYPT ] = &nv98_crypt_oclass; 283 device->oclass[NVDEV_ENGINE_CRYPT ] = &nv98_crypt_oclass;
284 device->oclass[NVDEV_ENGINE_BSP ] = &nv84_bsp_oclass; 284 device->oclass[NVDEV_ENGINE_BSP ] = &nv98_bsp_oclass;
285 device->oclass[NVDEV_ENGINE_PPP ] = &nv98_ppp_oclass; 285 device->oclass[NVDEV_ENGINE_PPP ] = &nv98_ppp_oclass;
286 device->oclass[NVDEV_ENGINE_DISP ] = &nv94_disp_oclass; 286 device->oclass[NVDEV_ENGINE_DISP ] = &nv94_disp_oclass;
287 break; 287 break;
@@ -305,9 +305,9 @@ nv50_identify(struct nouveau_device *device)
305 device->oclass[NVDEV_ENGINE_FIFO ] = &nv84_fifo_oclass; 305 device->oclass[NVDEV_ENGINE_FIFO ] = &nv84_fifo_oclass;
306 device->oclass[NVDEV_ENGINE_SW ] = &nv50_software_oclass; 306 device->oclass[NVDEV_ENGINE_SW ] = &nv50_software_oclass;
307 device->oclass[NVDEV_ENGINE_GR ] = &nv50_graph_oclass; 307 device->oclass[NVDEV_ENGINE_GR ] = &nv50_graph_oclass;
308 device->oclass[NVDEV_ENGINE_VP ] = &nv84_vp_oclass; 308 device->oclass[NVDEV_ENGINE_VP ] = &nv98_vp_oclass;
309 device->oclass[NVDEV_ENGINE_CRYPT ] = &nv98_crypt_oclass; 309 device->oclass[NVDEV_ENGINE_CRYPT ] = &nv98_crypt_oclass;
310 device->oclass[NVDEV_ENGINE_BSP ] = &nv84_bsp_oclass; 310 device->oclass[NVDEV_ENGINE_BSP ] = &nv98_bsp_oclass;
311 device->oclass[NVDEV_ENGINE_PPP ] = &nv98_ppp_oclass; 311 device->oclass[NVDEV_ENGINE_PPP ] = &nv98_ppp_oclass;
312 device->oclass[NVDEV_ENGINE_DISP ] = &nv94_disp_oclass; 312 device->oclass[NVDEV_ENGINE_DISP ] = &nv94_disp_oclass;
313 break; 313 break;
@@ -319,7 +319,7 @@ nv50_identify(struct nouveau_device *device)
319 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nva3_clock_oclass; 319 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nva3_clock_oclass;
320 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; 320 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
321 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 321 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
322 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass; 322 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nva3_devinit_oclass;
323 device->oclass[NVDEV_SUBDEV_MC ] = &nv98_mc_oclass; 323 device->oclass[NVDEV_SUBDEV_MC ] = &nv98_mc_oclass;
324 device->oclass[NVDEV_SUBDEV_BUS ] = &nv50_bus_oclass; 324 device->oclass[NVDEV_SUBDEV_BUS ] = &nv50_bus_oclass;
325 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; 325 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
@@ -332,8 +332,8 @@ nv50_identify(struct nouveau_device *device)
332 device->oclass[NVDEV_ENGINE_SW ] = &nv50_software_oclass; 332 device->oclass[NVDEV_ENGINE_SW ] = &nv50_software_oclass;
333 device->oclass[NVDEV_ENGINE_GR ] = &nv50_graph_oclass; 333 device->oclass[NVDEV_ENGINE_GR ] = &nv50_graph_oclass;
334 device->oclass[NVDEV_ENGINE_MPEG ] = &nv84_mpeg_oclass; 334 device->oclass[NVDEV_ENGINE_MPEG ] = &nv84_mpeg_oclass;
335 device->oclass[NVDEV_ENGINE_VP ] = &nv84_vp_oclass; 335 device->oclass[NVDEV_ENGINE_VP ] = &nv98_vp_oclass;
336 device->oclass[NVDEV_ENGINE_BSP ] = &nv84_bsp_oclass; 336 device->oclass[NVDEV_ENGINE_BSP ] = &nv98_bsp_oclass;
337 device->oclass[NVDEV_ENGINE_PPP ] = &nv98_ppp_oclass; 337 device->oclass[NVDEV_ENGINE_PPP ] = &nv98_ppp_oclass;
338 device->oclass[NVDEV_ENGINE_COPY0 ] = &nva3_copy_oclass; 338 device->oclass[NVDEV_ENGINE_COPY0 ] = &nva3_copy_oclass;
339 device->oclass[NVDEV_ENGINE_DISP ] = &nva3_disp_oclass; 339 device->oclass[NVDEV_ENGINE_DISP ] = &nva3_disp_oclass;
@@ -346,7 +346,7 @@ nv50_identify(struct nouveau_device *device)
346 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nva3_clock_oclass; 346 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nva3_clock_oclass;
347 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; 347 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
348 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 348 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
349 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass; 349 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nva3_devinit_oclass;
350 device->oclass[NVDEV_SUBDEV_MC ] = &nv98_mc_oclass; 350 device->oclass[NVDEV_SUBDEV_MC ] = &nv98_mc_oclass;
351 device->oclass[NVDEV_SUBDEV_BUS ] = &nv50_bus_oclass; 351 device->oclass[NVDEV_SUBDEV_BUS ] = &nv50_bus_oclass;
352 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; 352 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
@@ -358,8 +358,8 @@ nv50_identify(struct nouveau_device *device)
358 device->oclass[NVDEV_ENGINE_FIFO ] = &nv84_fifo_oclass; 358 device->oclass[NVDEV_ENGINE_FIFO ] = &nv84_fifo_oclass;
359 device->oclass[NVDEV_ENGINE_SW ] = &nv50_software_oclass; 359 device->oclass[NVDEV_ENGINE_SW ] = &nv50_software_oclass;
360 device->oclass[NVDEV_ENGINE_GR ] = &nv50_graph_oclass; 360 device->oclass[NVDEV_ENGINE_GR ] = &nv50_graph_oclass;
361 device->oclass[NVDEV_ENGINE_VP ] = &nv84_vp_oclass; 361 device->oclass[NVDEV_ENGINE_VP ] = &nv98_vp_oclass;
362 device->oclass[NVDEV_ENGINE_BSP ] = &nv84_bsp_oclass; 362 device->oclass[NVDEV_ENGINE_BSP ] = &nv98_bsp_oclass;
363 device->oclass[NVDEV_ENGINE_PPP ] = &nv98_ppp_oclass; 363 device->oclass[NVDEV_ENGINE_PPP ] = &nv98_ppp_oclass;
364 device->oclass[NVDEV_ENGINE_COPY0 ] = &nva3_copy_oclass; 364 device->oclass[NVDEV_ENGINE_COPY0 ] = &nva3_copy_oclass;
365 device->oclass[NVDEV_ENGINE_DISP ] = &nva3_disp_oclass; 365 device->oclass[NVDEV_ENGINE_DISP ] = &nva3_disp_oclass;
@@ -372,7 +372,7 @@ nv50_identify(struct nouveau_device *device)
372 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nva3_clock_oclass; 372 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nva3_clock_oclass;
373 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; 373 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
374 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 374 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
375 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass; 375 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nva3_devinit_oclass;
376 device->oclass[NVDEV_SUBDEV_MC ] = &nv98_mc_oclass; 376 device->oclass[NVDEV_SUBDEV_MC ] = &nv98_mc_oclass;
377 device->oclass[NVDEV_SUBDEV_BUS ] = &nv50_bus_oclass; 377 device->oclass[NVDEV_SUBDEV_BUS ] = &nv50_bus_oclass;
378 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; 378 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
@@ -384,8 +384,8 @@ nv50_identify(struct nouveau_device *device)
384 device->oclass[NVDEV_ENGINE_FIFO ] = &nv84_fifo_oclass; 384 device->oclass[NVDEV_ENGINE_FIFO ] = &nv84_fifo_oclass;
385 device->oclass[NVDEV_ENGINE_SW ] = &nv50_software_oclass; 385 device->oclass[NVDEV_ENGINE_SW ] = &nv50_software_oclass;
386 device->oclass[NVDEV_ENGINE_GR ] = &nv50_graph_oclass; 386 device->oclass[NVDEV_ENGINE_GR ] = &nv50_graph_oclass;
387 device->oclass[NVDEV_ENGINE_VP ] = &nv84_vp_oclass; 387 device->oclass[NVDEV_ENGINE_VP ] = &nv98_vp_oclass;
388 device->oclass[NVDEV_ENGINE_BSP ] = &nv84_bsp_oclass; 388 device->oclass[NVDEV_ENGINE_BSP ] = &nv98_bsp_oclass;
389 device->oclass[NVDEV_ENGINE_PPP ] = &nv98_ppp_oclass; 389 device->oclass[NVDEV_ENGINE_PPP ] = &nv98_ppp_oclass;
390 device->oclass[NVDEV_ENGINE_COPY0 ] = &nva3_copy_oclass; 390 device->oclass[NVDEV_ENGINE_COPY0 ] = &nva3_copy_oclass;
391 device->oclass[NVDEV_ENGINE_DISP ] = &nva3_disp_oclass; 391 device->oclass[NVDEV_ENGINE_DISP ] = &nva3_disp_oclass;
@@ -398,7 +398,7 @@ nv50_identify(struct nouveau_device *device)
398 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nva3_clock_oclass; 398 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nva3_clock_oclass;
399 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; 399 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
400 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 400 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
401 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass; 401 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nva3_devinit_oclass;
402 device->oclass[NVDEV_SUBDEV_MC ] = &nv98_mc_oclass; 402 device->oclass[NVDEV_SUBDEV_MC ] = &nv98_mc_oclass;
403 device->oclass[NVDEV_SUBDEV_BUS ] = &nv50_bus_oclass; 403 device->oclass[NVDEV_SUBDEV_BUS ] = &nv50_bus_oclass;
404 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; 404 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
@@ -410,8 +410,8 @@ nv50_identify(struct nouveau_device *device)
410 device->oclass[NVDEV_ENGINE_FIFO ] = &nv84_fifo_oclass; 410 device->oclass[NVDEV_ENGINE_FIFO ] = &nv84_fifo_oclass;
411 device->oclass[NVDEV_ENGINE_SW ] = &nv50_software_oclass; 411 device->oclass[NVDEV_ENGINE_SW ] = &nv50_software_oclass;
412 device->oclass[NVDEV_ENGINE_GR ] = &nv50_graph_oclass; 412 device->oclass[NVDEV_ENGINE_GR ] = &nv50_graph_oclass;
413 device->oclass[NVDEV_ENGINE_VP ] = &nv84_vp_oclass; 413 device->oclass[NVDEV_ENGINE_VP ] = &nv98_vp_oclass;
414 device->oclass[NVDEV_ENGINE_BSP ] = &nv84_bsp_oclass; 414 device->oclass[NVDEV_ENGINE_BSP ] = &nv98_bsp_oclass;
415 device->oclass[NVDEV_ENGINE_PPP ] = &nv98_ppp_oclass; 415 device->oclass[NVDEV_ENGINE_PPP ] = &nv98_ppp_oclass;
416 device->oclass[NVDEV_ENGINE_COPY0 ] = &nva3_copy_oclass; 416 device->oclass[NVDEV_ENGINE_COPY0 ] = &nva3_copy_oclass;
417 device->oclass[NVDEV_ENGINE_DISP ] = &nva3_disp_oclass; 417 device->oclass[NVDEV_ENGINE_DISP ] = &nva3_disp_oclass;
diff --git a/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c
index a36e64e98ef3..418f51f50d7a 100644
--- a/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c
@@ -62,7 +62,7 @@ nvc0_identify(struct nouveau_device *device)
62 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass; 62 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass;
63 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; 63 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
64 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 64 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
65 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass; 65 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nvc0_devinit_oclass;
66 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass; 66 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass;
67 device->oclass[NVDEV_SUBDEV_BUS ] = &nvc0_bus_oclass; 67 device->oclass[NVDEV_SUBDEV_BUS ] = &nvc0_bus_oclass;
68 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; 68 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
@@ -75,7 +75,7 @@ nvc0_identify(struct nouveau_device *device)
75 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvc0_dmaeng_oclass; 75 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvc0_dmaeng_oclass;
76 device->oclass[NVDEV_ENGINE_FIFO ] = &nvc0_fifo_oclass; 76 device->oclass[NVDEV_ENGINE_FIFO ] = &nvc0_fifo_oclass;
77 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass; 77 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass;
78 device->oclass[NVDEV_ENGINE_GR ] = &nvc0_graph_oclass; 78 device->oclass[NVDEV_ENGINE_GR ] = nvc0_graph_oclass;
79 device->oclass[NVDEV_ENGINE_VP ] = &nvc0_vp_oclass; 79 device->oclass[NVDEV_ENGINE_VP ] = &nvc0_vp_oclass;
80 device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass; 80 device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass;
81 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; 81 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass;
@@ -91,7 +91,7 @@ nvc0_identify(struct nouveau_device *device)
91 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass; 91 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass;
92 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; 92 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
93 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 93 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
94 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass; 94 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nvc0_devinit_oclass;
95 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass; 95 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass;
96 device->oclass[NVDEV_SUBDEV_BUS ] = &nvc0_bus_oclass; 96 device->oclass[NVDEV_SUBDEV_BUS ] = &nvc0_bus_oclass;
97 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; 97 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
@@ -104,7 +104,7 @@ nvc0_identify(struct nouveau_device *device)
104 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvc0_dmaeng_oclass; 104 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvc0_dmaeng_oclass;
105 device->oclass[NVDEV_ENGINE_FIFO ] = &nvc0_fifo_oclass; 105 device->oclass[NVDEV_ENGINE_FIFO ] = &nvc0_fifo_oclass;
106 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass; 106 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass;
107 device->oclass[NVDEV_ENGINE_GR ] = &nvc0_graph_oclass; 107 device->oclass[NVDEV_ENGINE_GR ] = nvc3_graph_oclass;
108 device->oclass[NVDEV_ENGINE_VP ] = &nvc0_vp_oclass; 108 device->oclass[NVDEV_ENGINE_VP ] = &nvc0_vp_oclass;
109 device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass; 109 device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass;
110 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; 110 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass;
@@ -120,7 +120,7 @@ nvc0_identify(struct nouveau_device *device)
120 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass; 120 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass;
121 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; 121 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
122 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 122 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
123 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass; 123 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nvc0_devinit_oclass;
124 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass; 124 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass;
125 device->oclass[NVDEV_SUBDEV_BUS ] = &nvc0_bus_oclass; 125 device->oclass[NVDEV_SUBDEV_BUS ] = &nvc0_bus_oclass;
126 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; 126 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
@@ -133,7 +133,7 @@ nvc0_identify(struct nouveau_device *device)
133 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvc0_dmaeng_oclass; 133 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvc0_dmaeng_oclass;
134 device->oclass[NVDEV_ENGINE_FIFO ] = &nvc0_fifo_oclass; 134 device->oclass[NVDEV_ENGINE_FIFO ] = &nvc0_fifo_oclass;
135 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass; 135 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass;
136 device->oclass[NVDEV_ENGINE_GR ] = &nvc0_graph_oclass; 136 device->oclass[NVDEV_ENGINE_GR ] = nvc3_graph_oclass;
137 device->oclass[NVDEV_ENGINE_VP ] = &nvc0_vp_oclass; 137 device->oclass[NVDEV_ENGINE_VP ] = &nvc0_vp_oclass;
138 device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass; 138 device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass;
139 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; 139 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass;
@@ -148,7 +148,7 @@ nvc0_identify(struct nouveau_device *device)
148 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass; 148 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass;
149 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; 149 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
150 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 150 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
151 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass; 151 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nvc0_devinit_oclass;
152 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass; 152 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass;
153 device->oclass[NVDEV_SUBDEV_BUS ] = &nvc0_bus_oclass; 153 device->oclass[NVDEV_SUBDEV_BUS ] = &nvc0_bus_oclass;
154 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; 154 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
@@ -161,7 +161,7 @@ nvc0_identify(struct nouveau_device *device)
161 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvc0_dmaeng_oclass; 161 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvc0_dmaeng_oclass;
162 device->oclass[NVDEV_ENGINE_FIFO ] = &nvc0_fifo_oclass; 162 device->oclass[NVDEV_ENGINE_FIFO ] = &nvc0_fifo_oclass;
163 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass; 163 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass;
164 device->oclass[NVDEV_ENGINE_GR ] = &nvc0_graph_oclass; 164 device->oclass[NVDEV_ENGINE_GR ] = nvc3_graph_oclass;
165 device->oclass[NVDEV_ENGINE_VP ] = &nvc0_vp_oclass; 165 device->oclass[NVDEV_ENGINE_VP ] = &nvc0_vp_oclass;
166 device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass; 166 device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass;
167 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; 167 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass;
@@ -177,7 +177,7 @@ nvc0_identify(struct nouveau_device *device)
177 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass; 177 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass;
178 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; 178 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
179 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 179 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
180 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass; 180 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nvc0_devinit_oclass;
181 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass; 181 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass;
182 device->oclass[NVDEV_SUBDEV_BUS ] = &nvc0_bus_oclass; 182 device->oclass[NVDEV_SUBDEV_BUS ] = &nvc0_bus_oclass;
183 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; 183 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
@@ -190,7 +190,7 @@ nvc0_identify(struct nouveau_device *device)
190 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvc0_dmaeng_oclass; 190 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvc0_dmaeng_oclass;
191 device->oclass[NVDEV_ENGINE_FIFO ] = &nvc0_fifo_oclass; 191 device->oclass[NVDEV_ENGINE_FIFO ] = &nvc0_fifo_oclass;
192 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass; 192 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass;
193 device->oclass[NVDEV_ENGINE_GR ] = &nvc0_graph_oclass; 193 device->oclass[NVDEV_ENGINE_GR ] = nvc3_graph_oclass;
194 device->oclass[NVDEV_ENGINE_VP ] = &nvc0_vp_oclass; 194 device->oclass[NVDEV_ENGINE_VP ] = &nvc0_vp_oclass;
195 device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass; 195 device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass;
196 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; 196 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass;
@@ -206,7 +206,7 @@ nvc0_identify(struct nouveau_device *device)
206 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass; 206 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass;
207 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; 207 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
208 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 208 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
209 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass; 209 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nvc0_devinit_oclass;
210 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass; 210 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass;
211 device->oclass[NVDEV_SUBDEV_BUS ] = &nvc0_bus_oclass; 211 device->oclass[NVDEV_SUBDEV_BUS ] = &nvc0_bus_oclass;
212 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; 212 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
@@ -219,7 +219,7 @@ nvc0_identify(struct nouveau_device *device)
219 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvc0_dmaeng_oclass; 219 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvc0_dmaeng_oclass;
220 device->oclass[NVDEV_ENGINE_FIFO ] = &nvc0_fifo_oclass; 220 device->oclass[NVDEV_ENGINE_FIFO ] = &nvc0_fifo_oclass;
221 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass; 221 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass;
222 device->oclass[NVDEV_ENGINE_GR ] = &nvc0_graph_oclass; 222 device->oclass[NVDEV_ENGINE_GR ] = nvc1_graph_oclass;
223 device->oclass[NVDEV_ENGINE_VP ] = &nvc0_vp_oclass; 223 device->oclass[NVDEV_ENGINE_VP ] = &nvc0_vp_oclass;
224 device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass; 224 device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass;
225 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; 225 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass;
@@ -234,7 +234,7 @@ nvc0_identify(struct nouveau_device *device)
234 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass; 234 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass;
235 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; 235 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
236 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 236 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
237 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass; 237 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nvc0_devinit_oclass;
238 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass; 238 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass;
239 device->oclass[NVDEV_SUBDEV_BUS ] = &nvc0_bus_oclass; 239 device->oclass[NVDEV_SUBDEV_BUS ] = &nvc0_bus_oclass;
240 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; 240 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
@@ -247,7 +247,7 @@ nvc0_identify(struct nouveau_device *device)
247 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvc0_dmaeng_oclass; 247 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvc0_dmaeng_oclass;
248 device->oclass[NVDEV_ENGINE_FIFO ] = &nvc0_fifo_oclass; 248 device->oclass[NVDEV_ENGINE_FIFO ] = &nvc0_fifo_oclass;
249 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass; 249 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass;
250 device->oclass[NVDEV_ENGINE_GR ] = &nvc0_graph_oclass; 250 device->oclass[NVDEV_ENGINE_GR ] = nvc8_graph_oclass;
251 device->oclass[NVDEV_ENGINE_VP ] = &nvc0_vp_oclass; 251 device->oclass[NVDEV_ENGINE_VP ] = &nvc0_vp_oclass;
252 device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass; 252 device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass;
253 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; 253 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass;
@@ -263,7 +263,7 @@ nvc0_identify(struct nouveau_device *device)
263 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass; 263 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass;
264 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; 264 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
265 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 265 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
266 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass; 266 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nvc0_devinit_oclass;
267 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass; 267 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass;
268 device->oclass[NVDEV_SUBDEV_BUS ] = &nvc0_bus_oclass; 268 device->oclass[NVDEV_SUBDEV_BUS ] = &nvc0_bus_oclass;
269 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; 269 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
@@ -276,7 +276,7 @@ nvc0_identify(struct nouveau_device *device)
276 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvd0_dmaeng_oclass; 276 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvd0_dmaeng_oclass;
277 device->oclass[NVDEV_ENGINE_FIFO ] = &nvc0_fifo_oclass; 277 device->oclass[NVDEV_ENGINE_FIFO ] = &nvc0_fifo_oclass;
278 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass; 278 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass;
279 device->oclass[NVDEV_ENGINE_GR ] = &nvc0_graph_oclass; 279 device->oclass[NVDEV_ENGINE_GR ] = nvd9_graph_oclass;
280 device->oclass[NVDEV_ENGINE_VP ] = &nvc0_vp_oclass; 280 device->oclass[NVDEV_ENGINE_VP ] = &nvc0_vp_oclass;
281 device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass; 281 device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass;
282 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; 282 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass;
@@ -291,7 +291,7 @@ nvc0_identify(struct nouveau_device *device)
291 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass; 291 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass;
292 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; 292 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
293 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 293 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
294 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass; 294 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nvc0_devinit_oclass;
295 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass; 295 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass;
296 device->oclass[NVDEV_SUBDEV_BUS ] = &nvc0_bus_oclass; 296 device->oclass[NVDEV_SUBDEV_BUS ] = &nvc0_bus_oclass;
297 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; 297 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
@@ -304,7 +304,7 @@ nvc0_identify(struct nouveau_device *device)
304 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvd0_dmaeng_oclass; 304 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvd0_dmaeng_oclass;
305 device->oclass[NVDEV_ENGINE_FIFO ] = &nvc0_fifo_oclass; 305 device->oclass[NVDEV_ENGINE_FIFO ] = &nvc0_fifo_oclass;
306 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass; 306 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass;
307 device->oclass[NVDEV_ENGINE_GR ] = &nvc0_graph_oclass; 307 device->oclass[NVDEV_ENGINE_GR ] = nvd7_graph_oclass;
308 device->oclass[NVDEV_ENGINE_VP ] = &nvc0_vp_oclass; 308 device->oclass[NVDEV_ENGINE_VP ] = &nvc0_vp_oclass;
309 device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass; 309 device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass;
310 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; 310 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass;
diff --git a/drivers/gpu/drm/nouveau/core/engine/device/nve0.c b/drivers/gpu/drm/nouveau/core/engine/device/nve0.c
index a354e409cdff..7aca1877add4 100644
--- a/drivers/gpu/drm/nouveau/core/engine/device/nve0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/device/nve0.c
@@ -62,7 +62,7 @@ nve0_identify(struct nouveau_device *device)
62 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass; 62 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass;
63 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; 63 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
64 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 64 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
65 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass; 65 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nvc0_devinit_oclass;
66 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass; 66 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass;
67 device->oclass[NVDEV_SUBDEV_BUS ] = &nvc0_bus_oclass; 67 device->oclass[NVDEV_SUBDEV_BUS ] = &nvc0_bus_oclass;
68 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; 68 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
@@ -75,10 +75,11 @@ nve0_identify(struct nouveau_device *device)
75 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvd0_dmaeng_oclass; 75 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvd0_dmaeng_oclass;
76 device->oclass[NVDEV_ENGINE_FIFO ] = &nve0_fifo_oclass; 76 device->oclass[NVDEV_ENGINE_FIFO ] = &nve0_fifo_oclass;
77 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass; 77 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass;
78 device->oclass[NVDEV_ENGINE_GR ] = &nve0_graph_oclass; 78 device->oclass[NVDEV_ENGINE_GR ] = nve4_graph_oclass;
79 device->oclass[NVDEV_ENGINE_DISP ] = &nve0_disp_oclass; 79 device->oclass[NVDEV_ENGINE_DISP ] = &nve0_disp_oclass;
80 device->oclass[NVDEV_ENGINE_COPY0 ] = &nve0_copy0_oclass; 80 device->oclass[NVDEV_ENGINE_COPY0 ] = &nve0_copy0_oclass;
81 device->oclass[NVDEV_ENGINE_COPY1 ] = &nve0_copy1_oclass; 81 device->oclass[NVDEV_ENGINE_COPY1 ] = &nve0_copy1_oclass;
82 device->oclass[NVDEV_ENGINE_COPY2 ] = &nve0_copy2_oclass;
82 device->oclass[NVDEV_ENGINE_BSP ] = &nve0_bsp_oclass; 83 device->oclass[NVDEV_ENGINE_BSP ] = &nve0_bsp_oclass;
83 device->oclass[NVDEV_ENGINE_VP ] = &nve0_vp_oclass; 84 device->oclass[NVDEV_ENGINE_VP ] = &nve0_vp_oclass;
84 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; 85 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass;
@@ -91,7 +92,7 @@ nve0_identify(struct nouveau_device *device)
91 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass; 92 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass;
92 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; 93 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
93 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 94 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
94 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass; 95 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nvc0_devinit_oclass;
95 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass; 96 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass;
96 device->oclass[NVDEV_SUBDEV_BUS ] = &nvc0_bus_oclass; 97 device->oclass[NVDEV_SUBDEV_BUS ] = &nvc0_bus_oclass;
97 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; 98 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
@@ -104,10 +105,11 @@ nve0_identify(struct nouveau_device *device)
104 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvd0_dmaeng_oclass; 105 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvd0_dmaeng_oclass;
105 device->oclass[NVDEV_ENGINE_FIFO ] = &nve0_fifo_oclass; 106 device->oclass[NVDEV_ENGINE_FIFO ] = &nve0_fifo_oclass;
106 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass; 107 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass;
107 device->oclass[NVDEV_ENGINE_GR ] = &nve0_graph_oclass; 108 device->oclass[NVDEV_ENGINE_GR ] = nve4_graph_oclass;
108 device->oclass[NVDEV_ENGINE_DISP ] = &nve0_disp_oclass; 109 device->oclass[NVDEV_ENGINE_DISP ] = &nve0_disp_oclass;
109 device->oclass[NVDEV_ENGINE_COPY0 ] = &nve0_copy0_oclass; 110 device->oclass[NVDEV_ENGINE_COPY0 ] = &nve0_copy0_oclass;
110 device->oclass[NVDEV_ENGINE_COPY1 ] = &nve0_copy1_oclass; 111 device->oclass[NVDEV_ENGINE_COPY1 ] = &nve0_copy1_oclass;
112 device->oclass[NVDEV_ENGINE_COPY2 ] = &nve0_copy2_oclass;
111 device->oclass[NVDEV_ENGINE_BSP ] = &nve0_bsp_oclass; 113 device->oclass[NVDEV_ENGINE_BSP ] = &nve0_bsp_oclass;
112 device->oclass[NVDEV_ENGINE_VP ] = &nve0_vp_oclass; 114 device->oclass[NVDEV_ENGINE_VP ] = &nve0_vp_oclass;
113 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; 115 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass;
@@ -120,7 +122,7 @@ nve0_identify(struct nouveau_device *device)
120 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass; 122 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass;
121 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; 123 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
122 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 124 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
123 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass; 125 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nvc0_devinit_oclass;
124 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass; 126 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass;
125 device->oclass[NVDEV_SUBDEV_BUS ] = &nvc0_bus_oclass; 127 device->oclass[NVDEV_SUBDEV_BUS ] = &nvc0_bus_oclass;
126 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; 128 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
@@ -133,10 +135,11 @@ nve0_identify(struct nouveau_device *device)
133 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvd0_dmaeng_oclass; 135 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvd0_dmaeng_oclass;
134 device->oclass[NVDEV_ENGINE_FIFO ] = &nve0_fifo_oclass; 136 device->oclass[NVDEV_ENGINE_FIFO ] = &nve0_fifo_oclass;
135 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass; 137 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass;
136 device->oclass[NVDEV_ENGINE_GR ] = &nve0_graph_oclass; 138 device->oclass[NVDEV_ENGINE_GR ] = nve4_graph_oclass;
137 device->oclass[NVDEV_ENGINE_DISP ] = &nve0_disp_oclass; 139 device->oclass[NVDEV_ENGINE_DISP ] = &nve0_disp_oclass;
138 device->oclass[NVDEV_ENGINE_COPY0 ] = &nve0_copy0_oclass; 140 device->oclass[NVDEV_ENGINE_COPY0 ] = &nve0_copy0_oclass;
139 device->oclass[NVDEV_ENGINE_COPY1 ] = &nve0_copy1_oclass; 141 device->oclass[NVDEV_ENGINE_COPY1 ] = &nve0_copy1_oclass;
142 device->oclass[NVDEV_ENGINE_COPY2 ] = &nve0_copy2_oclass;
140 device->oclass[NVDEV_ENGINE_BSP ] = &nve0_bsp_oclass; 143 device->oclass[NVDEV_ENGINE_BSP ] = &nve0_bsp_oclass;
141 device->oclass[NVDEV_ENGINE_VP ] = &nve0_vp_oclass; 144 device->oclass[NVDEV_ENGINE_VP ] = &nve0_vp_oclass;
142 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; 145 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass;
@@ -149,7 +152,7 @@ nve0_identify(struct nouveau_device *device)
149 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass; 152 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass;
150 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; 153 device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
151 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 154 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
152 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass; 155 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nvc0_devinit_oclass;
153 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass; 156 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass;
154 device->oclass[NVDEV_SUBDEV_BUS ] = &nvc0_bus_oclass; 157 device->oclass[NVDEV_SUBDEV_BUS ] = &nvc0_bus_oclass;
155 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; 158 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
@@ -160,16 +163,14 @@ nve0_identify(struct nouveau_device *device)
160 device->oclass[NVDEV_SUBDEV_VM ] = &nvc0_vmmgr_oclass; 163 device->oclass[NVDEV_SUBDEV_VM ] = &nvc0_vmmgr_oclass;
161 device->oclass[NVDEV_SUBDEV_BAR ] = &nvc0_bar_oclass; 164 device->oclass[NVDEV_SUBDEV_BAR ] = &nvc0_bar_oclass;
162 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvd0_dmaeng_oclass; 165 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvd0_dmaeng_oclass;
163#if 0
164 device->oclass[NVDEV_ENGINE_FIFO ] = &nve0_fifo_oclass; 166 device->oclass[NVDEV_ENGINE_FIFO ] = &nve0_fifo_oclass;
165 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass; 167 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass;
166 device->oclass[NVDEV_ENGINE_GR ] = &nve0_graph_oclass; 168 device->oclass[NVDEV_ENGINE_GR ] = nvf0_graph_oclass;
167#endif
168 device->oclass[NVDEV_ENGINE_DISP ] = &nvf0_disp_oclass; 169 device->oclass[NVDEV_ENGINE_DISP ] = &nvf0_disp_oclass;
169#if 0
170 device->oclass[NVDEV_ENGINE_COPY0 ] = &nve0_copy0_oclass; 170 device->oclass[NVDEV_ENGINE_COPY0 ] = &nve0_copy0_oclass;
171 device->oclass[NVDEV_ENGINE_COPY1 ] = &nve0_copy1_oclass; 171 device->oclass[NVDEV_ENGINE_COPY1 ] = &nve0_copy1_oclass;
172 device->oclass[NVDEV_ENGINE_COPY2 ] = &nve0_copy2_oclass; 172 device->oclass[NVDEV_ENGINE_COPY2 ] = &nve0_copy2_oclass;
173#if 0
173 device->oclass[NVDEV_ENGINE_BSP ] = &nve0_bsp_oclass; 174 device->oclass[NVDEV_ENGINE_BSP ] = &nve0_bsp_oclass;
174 device->oclass[NVDEV_ENGINE_VP ] = &nve0_vp_oclass; 175 device->oclass[NVDEV_ENGINE_VP ] = &nve0_vp_oclass;
175 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; 176 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass;
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/hdminva3.c b/drivers/gpu/drm/nouveau/core/engine/disp/hdminva3.c
index f065fc248adf..db8c6fd46278 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/hdminva3.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/hdminva3.c
@@ -55,6 +55,10 @@ nva3_hdmi_ctrl(struct nv50_disp_priv *priv, int head, int or, u32 data)
55 nv_wr32(priv, 0x61c510 + soff, 0x00000000); 55 nv_wr32(priv, 0x61c510 + soff, 0x00000000);
56 nv_mask(priv, 0x61c500 + soff, 0x00000001, 0x00000001); 56 nv_mask(priv, 0x61c500 + soff, 0x00000001, 0x00000001);
57 57
58 nv_mask(priv, 0x61c5d0 + soff, 0x00070001, 0x00010001); /* SPARE, HW_CTS */
59 nv_mask(priv, 0x61c568 + soff, 0x00010101, 0x00000000); /* ACR_CTRL, ?? */
60 nv_mask(priv, 0x61c578 + soff, 0x80000000, 0x80000000); /* ACR_0441_ENABLE */
61
58 /* ??? */ 62 /* ??? */
59 nv_mask(priv, 0x61733c, 0x00100000, 0x00100000); /* RESETF */ 63 nv_mask(priv, 0x61733c, 0x00100000, 0x00100000); /* RESETF */
60 nv_mask(priv, 0x61733c, 0x10000000, 0x10000000); /* LOOKUP_EN */ 64 nv_mask(priv, 0x61733c, 0x10000000, 0x10000000); /* LOOKUP_EN */
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
index 6a38402fa56c..7ffe2f309f12 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
@@ -34,9 +34,9 @@
34#include <subdev/bios/disp.h> 34#include <subdev/bios/disp.h>
35#include <subdev/bios/init.h> 35#include <subdev/bios/init.h>
36#include <subdev/bios/pll.h> 36#include <subdev/bios/pll.h>
37#include <subdev/devinit.h>
37#include <subdev/timer.h> 38#include <subdev/timer.h>
38#include <subdev/fb.h> 39#include <subdev/fb.h>
39#include <subdev/clock.h>
40 40
41#include "nv50.h" 41#include "nv50.h"
42 42
@@ -987,10 +987,10 @@ nv50_disp_intr_unk20_0(struct nv50_disp_priv *priv, int head)
987static void 987static void
988nv50_disp_intr_unk20_1(struct nv50_disp_priv *priv, int head) 988nv50_disp_intr_unk20_1(struct nv50_disp_priv *priv, int head)
989{ 989{
990 struct nouveau_clock *clk = nouveau_clock(priv); 990 struct nouveau_devinit *devinit = nouveau_devinit(priv);
991 u32 pclk = nv_rd32(priv, 0x610ad0 + (head * 0x540)) & 0x3fffff; 991 u32 pclk = nv_rd32(priv, 0x610ad0 + (head * 0x540)) & 0x3fffff;
992 if (pclk) 992 if (pclk)
993 clk->pll_set(clk, PLL_VPLL0 + head, pclk); 993 devinit->pll_set(devinit, PLL_VPLL0 + head, pclk);
994} 994}
995 995
996static void 996static void
@@ -1107,6 +1107,7 @@ nv50_disp_intr_unk20_2(struct nv50_disp_priv *priv, int head)
1107 u32 pclk = nv_rd32(priv, 0x610ad0 + (head * 0x540)) & 0x3fffff; 1107 u32 pclk = nv_rd32(priv, 0x610ad0 + (head * 0x540)) & 0x3fffff;
1108 u32 hval, hreg = 0x614200 + (head * 0x800); 1108 u32 hval, hreg = 0x614200 + (head * 0x800);
1109 u32 oval, oreg; 1109 u32 oval, oreg;
1110 u32 mask;
1110 u32 conf = exec_clkcmp(priv, head, 0xff, pclk, &outp); 1111 u32 conf = exec_clkcmp(priv, head, 0xff, pclk, &outp);
1111 if (conf != ~0) { 1112 if (conf != ~0) {
1112 if (outp.location == 0 && outp.type == DCB_OUTPUT_DP) { 1113 if (outp.location == 0 && outp.type == DCB_OUTPUT_DP) {
@@ -1133,6 +1134,7 @@ nv50_disp_intr_unk20_2(struct nv50_disp_priv *priv, int head)
1133 oreg = 0x614280 + (ffs(outp.or) - 1) * 0x800; 1134 oreg = 0x614280 + (ffs(outp.or) - 1) * 0x800;
1134 oval = 0x00000000; 1135 oval = 0x00000000;
1135 hval = 0x00000000; 1136 hval = 0x00000000;
1137 mask = 0xffffffff;
1136 } else 1138 } else
1137 if (!outp.location) { 1139 if (!outp.location) {
1138 if (outp.type == DCB_OUTPUT_DP) 1140 if (outp.type == DCB_OUTPUT_DP)
@@ -1140,14 +1142,16 @@ nv50_disp_intr_unk20_2(struct nv50_disp_priv *priv, int head)
1140 oreg = 0x614300 + (ffs(outp.or) - 1) * 0x800; 1142 oreg = 0x614300 + (ffs(outp.or) - 1) * 0x800;
1141 oval = (conf & 0x0100) ? 0x00000101 : 0x00000000; 1143 oval = (conf & 0x0100) ? 0x00000101 : 0x00000000;
1142 hval = 0x00000000; 1144 hval = 0x00000000;
1145 mask = 0x00000707;
1143 } else { 1146 } else {
1144 oreg = 0x614380 + (ffs(outp.or) - 1) * 0x800; 1147 oreg = 0x614380 + (ffs(outp.or) - 1) * 0x800;
1145 oval = 0x00000001; 1148 oval = 0x00000001;
1146 hval = 0x00000001; 1149 hval = 0x00000001;
1150 mask = 0x00000707;
1147 } 1151 }
1148 1152
1149 nv_mask(priv, hreg, 0x0000000f, hval); 1153 nv_mask(priv, hreg, 0x0000000f, hval);
1150 nv_mask(priv, oreg, 0x00000707, oval); 1154 nv_mask(priv, oreg, mask, oval);
1151 } 1155 }
1152} 1156}
1153 1157
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c b/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c
index 019eacd8a68f..52dd7a1db729 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c
@@ -29,15 +29,14 @@
29 29
30#include <engine/disp.h> 30#include <engine/disp.h>
31 31
32#include <subdev/timer.h>
33#include <subdev/fb.h>
34#include <subdev/clock.h>
35
36#include <subdev/bios.h> 32#include <subdev/bios.h>
37#include <subdev/bios/dcb.h> 33#include <subdev/bios/dcb.h>
38#include <subdev/bios/disp.h> 34#include <subdev/bios/disp.h>
39#include <subdev/bios/init.h> 35#include <subdev/bios/init.h>
40#include <subdev/bios/pll.h> 36#include <subdev/bios/pll.h>
37#include <subdev/devinit.h>
38#include <subdev/fb.h>
39#include <subdev/timer.h>
41 40
42#include "nv50.h" 41#include "nv50.h"
43 42
@@ -738,10 +737,10 @@ nvd0_disp_intr_unk2_0(struct nv50_disp_priv *priv, int head)
738static void 737static void
739nvd0_disp_intr_unk2_1(struct nv50_disp_priv *priv, int head) 738nvd0_disp_intr_unk2_1(struct nv50_disp_priv *priv, int head)
740{ 739{
741 struct nouveau_clock *clk = nouveau_clock(priv); 740 struct nouveau_devinit *devinit = nouveau_devinit(priv);
742 u32 pclk = nv_rd32(priv, 0x660450 + (head * 0x300)) / 1000; 741 u32 pclk = nv_rd32(priv, 0x660450 + (head * 0x300)) / 1000;
743 if (pclk) 742 if (pclk)
744 clk->pll_set(clk, PLL_VPLL0 + head, pclk); 743 devinit->pll_set(devinit, PLL_VPLL0 + head, pclk);
745 nv_wr32(priv, 0x612200 + (head * 0x800), 0x00000000); 744 nv_wr32(priv, 0x612200 + (head * 0x800), 0x00000000);
746} 745}
747 746
@@ -959,6 +958,9 @@ nvd0_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
959 int heads = nv_rd32(parent, 0x022448); 958 int heads = nv_rd32(parent, 0x022448);
960 int ret; 959 int ret;
961 960
961 if (nv_rd32(parent, 0x022500) & 0x00000001)
962 return -ENODEV;
963
962 ret = nouveau_disp_create(parent, engine, oclass, heads, 964 ret = nouveau_disp_create(parent, engine, oclass, heads,
963 "PDISP", "display", &priv); 965 "PDISP", "display", &priv);
964 *pobject = nv_object(priv); 966 *pobject = nv_object(priv);
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nve0.c b/drivers/gpu/drm/nouveau/core/engine/disp/nve0.c
index 20725b363d58..fb1fe6ae5e74 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/nve0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/nve0.c
@@ -54,6 +54,9 @@ nve0_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
54 int heads = nv_rd32(parent, 0x022448); 54 int heads = nv_rd32(parent, 0x022448);
55 int ret; 55 int ret;
56 56
57 if (nv_rd32(parent, 0x022500) & 0x00000001)
58 return -ENODEV;
59
57 ret = nouveau_disp_create(parent, engine, oclass, heads, 60 ret = nouveau_disp_create(parent, engine, oclass, heads,
58 "PDISP", "display", &priv); 61 "PDISP", "display", &priv);
59 *pobject = nv_object(priv); 62 *pobject = nv_object(priv);
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nvf0.c b/drivers/gpu/drm/nouveau/core/engine/disp/nvf0.c
index a488c36e40f9..42aa6b97dbea 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/nvf0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/nvf0.c
@@ -54,6 +54,9 @@ nvf0_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
54 int heads = nv_rd32(parent, 0x022448); 54 int heads = nv_rd32(parent, 0x022448);
55 int ret; 55 int ret;
56 56
57 if (nv_rd32(parent, 0x022500) & 0x00000001)
58 return -ENODEV;
59
57 ret = nouveau_disp_create(parent, engine, oclass, heads, 60 ret = nouveau_disp_create(parent, engine, oclass, heads,
58 "PDISP", "display", &priv); 61 "PDISP", "display", &priv);
59 *pobject = nv_object(priv); 62 *pobject = nv_object(priv);
diff --git a/drivers/gpu/drm/nouveau/core/core/falcon.c b/drivers/gpu/drm/nouveau/core/engine/falcon.c
index e05c15777588..3c7a31f7590e 100644
--- a/drivers/gpu/drm/nouveau/core/core/falcon.c
+++ b/drivers/gpu/drm/nouveau/core/engine/falcon.c
@@ -20,8 +20,7 @@
20 * OTHER DEALINGS IN THE SOFTWARE. 20 * OTHER DEALINGS IN THE SOFTWARE.
21 */ 21 */
22 22
23#include <core/falcon.h> 23#include <engine/falcon.h>
24
25#include <subdev/timer.h> 24#include <subdev/timer.h>
26 25
27u32 26u32
diff --git a/drivers/gpu/drm/nouveau/core/engine/fifo/nv40.c b/drivers/gpu/drm/nouveau/core/engine/fifo/nv40.c
index 2b1f91721225..5c7433d5069f 100644
--- a/drivers/gpu/drm/nouveau/core/engine/fifo/nv40.c
+++ b/drivers/gpu/drm/nouveau/core/engine/fifo/nv40.c
@@ -320,7 +320,7 @@ nv40_fifo_init(struct nouveau_object *object)
320 break; 320 break;
321 default: 321 default:
322 nv_wr32(priv, 0x002230, 0x00000000); 322 nv_wr32(priv, 0x002230, 0x00000000);
323 nv_wr32(priv, 0x002220, ((pfb->ram.size - 512 * 1024 + 323 nv_wr32(priv, 0x002220, ((pfb->ram->size - 512 * 1024 +
324 priv->ramfc->addr) >> 16) | 324 priv->ramfc->addr) >> 16) |
325 0x00030000); 325 0x00030000);
326 break; 326 break;
diff --git a/drivers/gpu/drm/nouveau/core/engine/fifo/nv84.c b/drivers/gpu/drm/nouveau/core/engine/fifo/nv84.c
index 35b94bd18808..7f53196cff52 100644
--- a/drivers/gpu/drm/nouveau/core/engine/fifo/nv84.c
+++ b/drivers/gpu/drm/nouveau/core/engine/fifo/nv84.c
@@ -56,7 +56,9 @@ nv84_fifo_context_attach(struct nouveau_object *parent,
56 switch (nv_engidx(object->engine)) { 56 switch (nv_engidx(object->engine)) {
57 case NVDEV_ENGINE_SW : return 0; 57 case NVDEV_ENGINE_SW : return 0;
58 case NVDEV_ENGINE_GR : addr = 0x0020; break; 58 case NVDEV_ENGINE_GR : addr = 0x0020; break;
59 case NVDEV_ENGINE_VP : addr = 0x0040; break;
59 case NVDEV_ENGINE_MPEG : addr = 0x0060; break; 60 case NVDEV_ENGINE_MPEG : addr = 0x0060; break;
61 case NVDEV_ENGINE_BSP : addr = 0x0080; break;
60 case NVDEV_ENGINE_CRYPT: addr = 0x00a0; break; 62 case NVDEV_ENGINE_CRYPT: addr = 0x00a0; break;
61 case NVDEV_ENGINE_COPY0: addr = 0x00c0; break; 63 case NVDEV_ENGINE_COPY0: addr = 0x00c0; break;
62 default: 64 default:
@@ -89,7 +91,9 @@ nv84_fifo_context_detach(struct nouveau_object *parent, bool suspend,
89 switch (nv_engidx(object->engine)) { 91 switch (nv_engidx(object->engine)) {
90 case NVDEV_ENGINE_SW : return 0; 92 case NVDEV_ENGINE_SW : return 0;
91 case NVDEV_ENGINE_GR : engn = 0; addr = 0x0020; break; 93 case NVDEV_ENGINE_GR : engn = 0; addr = 0x0020; break;
94 case NVDEV_ENGINE_VP : engn = 3; addr = 0x0040; break;
92 case NVDEV_ENGINE_MPEG : engn = 1; addr = 0x0060; break; 95 case NVDEV_ENGINE_MPEG : engn = 1; addr = 0x0060; break;
96 case NVDEV_ENGINE_BSP : engn = 5; addr = 0x0080; break;
93 case NVDEV_ENGINE_CRYPT: engn = 4; addr = 0x00a0; break; 97 case NVDEV_ENGINE_CRYPT: engn = 4; addr = 0x00a0; break;
94 case NVDEV_ENGINE_COPY0: engn = 2; addr = 0x00c0; break; 98 case NVDEV_ENGINE_COPY0: engn = 2; addr = 0x00c0; break;
95 default: 99 default:
diff --git a/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c b/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c
index 56192a7242ae..09644fa9602c 100644
--- a/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c
@@ -44,7 +44,8 @@ static const struct {
44 u64 subdev; 44 u64 subdev;
45 u64 mask; 45 u64 mask;
46} fifo_engine[] = { 46} fifo_engine[] = {
47 _(NVDEV_ENGINE_GR , (1ULL << NVDEV_ENGINE_SW)), 47 _(NVDEV_ENGINE_GR , (1ULL << NVDEV_ENGINE_SW) |
48 (1ULL << NVDEV_ENGINE_COPY2)),
48 _(NVDEV_ENGINE_VP , 0), 49 _(NVDEV_ENGINE_VP , 0),
49 _(NVDEV_ENGINE_PPP , 0), 50 _(NVDEV_ENGINE_PPP , 0),
50 _(NVDEV_ENGINE_BSP , 0), 51 _(NVDEV_ENGINE_BSP , 0),
@@ -96,18 +97,6 @@ nve0_fifo_playlist_update(struct nve0_fifo_priv *priv, u32 engine)
96 97
97 mutex_lock(&nv_subdev(priv)->mutex); 98 mutex_lock(&nv_subdev(priv)->mutex);
98 cur = engn->playlist[engn->cur_playlist]; 99 cur = engn->playlist[engn->cur_playlist];
99 if (unlikely(cur == NULL)) {
100 int ret = nouveau_gpuobj_new(nv_object(priv), NULL,
101 0x8000, 0x1000, 0, &cur);
102 if (ret) {
103 mutex_unlock(&nv_subdev(priv)->mutex);
104 nv_error(priv, "playlist alloc failed\n");
105 return;
106 }
107
108 engn->playlist[engn->cur_playlist] = cur;
109 }
110
111 engn->cur_playlist = !engn->cur_playlist; 100 engn->cur_playlist = !engn->cur_playlist;
112 101
113 for (i = 0, p = 0; i < priv->base.max; i++) { 102 for (i = 0, p = 0; i < priv->base.max; i++) {
@@ -138,10 +127,12 @@ nve0_fifo_context_attach(struct nouveau_object *parent,
138 int ret; 127 int ret;
139 128
140 switch (nv_engidx(object->engine)) { 129 switch (nv_engidx(object->engine)) {
141 case NVDEV_ENGINE_SW : return 0; 130 case NVDEV_ENGINE_SW :
142 case NVDEV_ENGINE_GR :
143 case NVDEV_ENGINE_COPY0: 131 case NVDEV_ENGINE_COPY0:
144 case NVDEV_ENGINE_COPY1: addr = 0x0210; break; 132 case NVDEV_ENGINE_COPY1:
133 case NVDEV_ENGINE_COPY2:
134 return 0;
135 case NVDEV_ENGINE_GR : addr = 0x0210; break;
145 case NVDEV_ENGINE_BSP : addr = 0x0270; break; 136 case NVDEV_ENGINE_BSP : addr = 0x0270; break;
146 case NVDEV_ENGINE_VP : addr = 0x0250; break; 137 case NVDEV_ENGINE_VP : addr = 0x0250; break;
147 case NVDEV_ENGINE_PPP : addr = 0x0260; break; 138 case NVDEV_ENGINE_PPP : addr = 0x0260; break;
@@ -176,9 +167,10 @@ nve0_fifo_context_detach(struct nouveau_object *parent, bool suspend,
176 167
177 switch (nv_engidx(object->engine)) { 168 switch (nv_engidx(object->engine)) {
178 case NVDEV_ENGINE_SW : return 0; 169 case NVDEV_ENGINE_SW : return 0;
179 case NVDEV_ENGINE_GR :
180 case NVDEV_ENGINE_COPY0: 170 case NVDEV_ENGINE_COPY0:
181 case NVDEV_ENGINE_COPY1: addr = 0x0210; break; 171 case NVDEV_ENGINE_COPY1:
172 case NVDEV_ENGINE_COPY2: addr = 0x0000; break;
173 case NVDEV_ENGINE_GR : addr = 0x0210; break;
182 case NVDEV_ENGINE_BSP : addr = 0x0270; break; 174 case NVDEV_ENGINE_BSP : addr = 0x0270; break;
183 case NVDEV_ENGINE_VP : addr = 0x0250; break; 175 case NVDEV_ENGINE_VP : addr = 0x0250; break;
184 case NVDEV_ENGINE_PPP : addr = 0x0260; break; 176 case NVDEV_ENGINE_PPP : addr = 0x0260; break;
@@ -194,9 +186,12 @@ nve0_fifo_context_detach(struct nouveau_object *parent, bool suspend,
194 return -EBUSY; 186 return -EBUSY;
195 } 187 }
196 188
197 nv_wo32(base, addr + 0x00, 0x00000000); 189 if (addr) {
198 nv_wo32(base, addr + 0x04, 0x00000000); 190 nv_wo32(base, addr + 0x00, 0x00000000);
199 bar->flush(bar); 191 nv_wo32(base, addr + 0x04, 0x00000000);
192 bar->flush(bar);
193 }
194
200 return 0; 195 return 0;
201} 196}
202 197
@@ -226,8 +221,10 @@ nve0_fifo_chan_ctor(struct nouveau_object *parent,
226 } 221 }
227 } 222 }
228 223
229 if (i == FIFO_ENGINE_NR) 224 if (i == FIFO_ENGINE_NR) {
225 nv_error(priv, "unsupported engines 0x%08x\n", args->engine);
230 return -ENODEV; 226 return -ENODEV;
227 }
231 228
232 ret = nouveau_fifo_channel_create(parent, engine, oclass, 1, 229 ret = nouveau_fifo_channel_create(parent, engine, oclass, 1,
233 priv->user.bar.offset, 0x200, 230 priv->user.bar.offset, 0x200,
@@ -592,13 +589,25 @@ nve0_fifo_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
592 struct nouveau_object **pobject) 589 struct nouveau_object **pobject)
593{ 590{
594 struct nve0_fifo_priv *priv; 591 struct nve0_fifo_priv *priv;
595 int ret; 592 int ret, i;
596 593
597 ret = nouveau_fifo_create(parent, engine, oclass, 0, 4095, &priv); 594 ret = nouveau_fifo_create(parent, engine, oclass, 0, 4095, &priv);
598 *pobject = nv_object(priv); 595 *pobject = nv_object(priv);
599 if (ret) 596 if (ret)
600 return ret; 597 return ret;
601 598
599 for (i = 0; i < FIFO_ENGINE_NR; i++) {
600 ret = nouveau_gpuobj_new(nv_object(priv), NULL, 0x8000, 0x1000,
601 0, &priv->engine[i].playlist[0]);
602 if (ret)
603 return ret;
604
605 ret = nouveau_gpuobj_new(nv_object(priv), NULL, 0x8000, 0x1000,
606 0, &priv->engine[i].playlist[1]);
607 if (ret)
608 return ret;
609 }
610
602 ret = nouveau_gpuobj_new(nv_object(priv), NULL, 4096 * 0x200, 0x1000, 611 ret = nouveau_gpuobj_new(nv_object(priv), NULL, 4096 * 0x200, 0x1000,
603 NVOBJ_FLAG_ZERO_ALLOC, &priv->user.mem); 612 NVOBJ_FLAG_ZERO_ALLOC, &priv->user.mem);
604 if (ret) 613 if (ret)
@@ -629,7 +638,7 @@ nve0_fifo_dtor(struct nouveau_object *object)
629 nouveau_gpuobj_unmap(&priv->user.bar); 638 nouveau_gpuobj_unmap(&priv->user.bar);
630 nouveau_gpuobj_ref(NULL, &priv->user.mem); 639 nouveau_gpuobj_ref(NULL, &priv->user.mem);
631 640
632 for (i = 0; i < ARRAY_SIZE(priv->engine); i++) { 641 for (i = 0; i < FIFO_ENGINE_NR; i++) {
633 nouveau_gpuobj_ref(NULL, &priv->engine[i].playlist[1]); 642 nouveau_gpuobj_ref(NULL, &priv->engine[i].playlist[1]);
634 nouveau_gpuobj_ref(NULL, &priv->engine[i].playlist[0]); 643 nouveau_gpuobj_ref(NULL, &priv->engine[i].playlist[0]);
635 } 644 }
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.c
index 4cc6269d4077..64dca260912f 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.c
@@ -24,3015 +24,1220 @@
24 24
25#include "nvc0.h" 25#include "nvc0.h"
26 26
27void 27struct nvc0_graph_init
28nv_icmd(struct nvc0_graph_priv *priv, u32 icmd, u32 data) 28nvc0_grctx_init_icmd[] = {
29{ 29 { 0x001000, 1, 0x01, 0x00000004 },
30 nv_wr32(priv, 0x400204, data); 30 { 0x0000a9, 1, 0x01, 0x0000ffff },
31 nv_wr32(priv, 0x400200, icmd); 31 { 0x000038, 1, 0x01, 0x0fac6881 },
32 while (nv_rd32(priv, 0x400700) & 2) {} 32 { 0x00003d, 1, 0x01, 0x00000001 },
33} 33 { 0x0000e8, 8, 0x01, 0x00000400 },
34 { 0x000078, 8, 0x01, 0x00000300 },
35 { 0x000050, 1, 0x01, 0x00000011 },
36 { 0x000058, 8, 0x01, 0x00000008 },
37 { 0x000208, 8, 0x01, 0x00000001 },
38 { 0x000081, 1, 0x01, 0x00000001 },
39 { 0x000085, 1, 0x01, 0x00000004 },
40 { 0x000088, 1, 0x01, 0x00000400 },
41 { 0x000090, 1, 0x01, 0x00000300 },
42 { 0x000098, 1, 0x01, 0x00001001 },
43 { 0x0000e3, 1, 0x01, 0x00000001 },
44 { 0x0000da, 1, 0x01, 0x00000001 },
45 { 0x0000f8, 1, 0x01, 0x00000003 },
46 { 0x0000fa, 1, 0x01, 0x00000001 },
47 { 0x00009f, 4, 0x01, 0x0000ffff },
48 { 0x0000b1, 1, 0x01, 0x00000001 },
49 { 0x0000b2, 40, 0x01, 0x00000000 },
50 { 0x000210, 8, 0x01, 0x00000040 },
51 { 0x000218, 8, 0x01, 0x0000c080 },
52 { 0x0000ad, 1, 0x01, 0x0000013e },
53 { 0x0000e1, 1, 0x01, 0x00000010 },
54 { 0x000290, 16, 0x01, 0x00000000 },
55 { 0x0003b0, 16, 0x01, 0x00000000 },
56 { 0x0002a0, 16, 0x01, 0x00000000 },
57 { 0x000420, 16, 0x01, 0x00000000 },
58 { 0x0002b0, 16, 0x01, 0x00000000 },
59 { 0x000430, 16, 0x01, 0x00000000 },
60 { 0x0002c0, 16, 0x01, 0x00000000 },
61 { 0x0004d0, 16, 0x01, 0x00000000 },
62 { 0x000720, 16, 0x01, 0x00000000 },
63 { 0x0008c0, 16, 0x01, 0x00000000 },
64 { 0x000890, 16, 0x01, 0x00000000 },
65 { 0x0008e0, 16, 0x01, 0x00000000 },
66 { 0x0008a0, 16, 0x01, 0x00000000 },
67 { 0x0008f0, 16, 0x01, 0x00000000 },
68 { 0x00094c, 1, 0x01, 0x000000ff },
69 { 0x00094d, 1, 0x01, 0xffffffff },
70 { 0x00094e, 1, 0x01, 0x00000002 },
71 { 0x0002ec, 1, 0x01, 0x00000001 },
72 { 0x000303, 1, 0x01, 0x00000001 },
73 { 0x0002e6, 1, 0x01, 0x00000001 },
74 { 0x000466, 1, 0x01, 0x00000052 },
75 { 0x000301, 1, 0x01, 0x3f800000 },
76 { 0x000304, 1, 0x01, 0x30201000 },
77 { 0x000305, 1, 0x01, 0x70605040 },
78 { 0x000306, 1, 0x01, 0xb8a89888 },
79 { 0x000307, 1, 0x01, 0xf8e8d8c8 },
80 { 0x00030a, 1, 0x01, 0x00ffff00 },
81 { 0x00030b, 1, 0x01, 0x0000001a },
82 { 0x00030c, 1, 0x01, 0x00000001 },
83 { 0x000318, 1, 0x01, 0x00000001 },
84 { 0x000340, 1, 0x01, 0x00000000 },
85 { 0x000375, 1, 0x01, 0x00000001 },
86 { 0x000351, 1, 0x01, 0x00000100 },
87 { 0x00037d, 1, 0x01, 0x00000006 },
88 { 0x0003a0, 1, 0x01, 0x00000002 },
89 { 0x0003aa, 1, 0x01, 0x00000001 },
90 { 0x0003a9, 1, 0x01, 0x00000001 },
91 { 0x000380, 1, 0x01, 0x00000001 },
92 { 0x000360, 1, 0x01, 0x00000040 },
93 { 0x000366, 2, 0x01, 0x00000000 },
94 { 0x000368, 1, 0x01, 0x00001fff },
95 { 0x000370, 2, 0x01, 0x00000000 },
96 { 0x000372, 1, 0x01, 0x003fffff },
97 { 0x00037a, 1, 0x01, 0x00000012 },
98 { 0x0005e0, 5, 0x01, 0x00000022 },
99 { 0x000619, 1, 0x01, 0x00000003 },
100 { 0x000811, 1, 0x01, 0x00000003 },
101 { 0x000812, 1, 0x01, 0x00000004 },
102 { 0x000813, 1, 0x01, 0x00000006 },
103 { 0x000814, 1, 0x01, 0x00000008 },
104 { 0x000815, 1, 0x01, 0x0000000b },
105 { 0x000800, 6, 0x01, 0x00000001 },
106 { 0x000632, 1, 0x01, 0x00000001 },
107 { 0x000633, 1, 0x01, 0x00000002 },
108 { 0x000634, 1, 0x01, 0x00000003 },
109 { 0x000635, 1, 0x01, 0x00000004 },
110 { 0x000654, 1, 0x01, 0x3f800000 },
111 { 0x000657, 1, 0x01, 0x3f800000 },
112 { 0x000655, 2, 0x01, 0x3f800000 },
113 { 0x0006cd, 1, 0x01, 0x3f800000 },
114 { 0x0007f5, 1, 0x01, 0x3f800000 },
115 { 0x0007dc, 1, 0x01, 0x39291909 },
116 { 0x0007dd, 1, 0x01, 0x79695949 },
117 { 0x0007de, 1, 0x01, 0xb9a99989 },
118 { 0x0007df, 1, 0x01, 0xf9e9d9c9 },
119 { 0x0007e8, 1, 0x01, 0x00003210 },
120 { 0x0007e9, 1, 0x01, 0x00007654 },
121 { 0x0007ea, 1, 0x01, 0x00000098 },
122 { 0x0007ec, 1, 0x01, 0x39291909 },
123 { 0x0007ed, 1, 0x01, 0x79695949 },
124 { 0x0007ee, 1, 0x01, 0xb9a99989 },
125 { 0x0007ef, 1, 0x01, 0xf9e9d9c9 },
126 { 0x0007f0, 1, 0x01, 0x00003210 },
127 { 0x0007f1, 1, 0x01, 0x00007654 },
128 { 0x0007f2, 1, 0x01, 0x00000098 },
129 { 0x0005a5, 1, 0x01, 0x00000001 },
130 { 0x000980, 128, 0x01, 0x00000000 },
131 { 0x000468, 1, 0x01, 0x00000004 },
132 { 0x00046c, 1, 0x01, 0x00000001 },
133 { 0x000470, 96, 0x01, 0x00000000 },
134 { 0x000510, 16, 0x01, 0x3f800000 },
135 { 0x000520, 1, 0x01, 0x000002b6 },
136 { 0x000529, 1, 0x01, 0x00000001 },
137 { 0x000530, 16, 0x01, 0xffff0000 },
138 { 0x000585, 1, 0x01, 0x0000003f },
139 { 0x000576, 1, 0x01, 0x00000003 },
140 { 0x000586, 1, 0x01, 0x00000040 },
141 { 0x000582, 2, 0x01, 0x00000080 },
142 { 0x0005c2, 1, 0x01, 0x00000001 },
143 { 0x000638, 1, 0x01, 0x00000001 },
144 { 0x000639, 1, 0x01, 0x00000001 },
145 { 0x00063a, 1, 0x01, 0x00000002 },
146 { 0x00063b, 2, 0x01, 0x00000001 },
147 { 0x00063d, 1, 0x01, 0x00000002 },
148 { 0x00063e, 1, 0x01, 0x00000001 },
149 { 0x0008b8, 8, 0x01, 0x00000001 },
150 { 0x000900, 8, 0x01, 0x00000001 },
151 { 0x000908, 8, 0x01, 0x00000002 },
152 { 0x000910, 16, 0x01, 0x00000001 },
153 { 0x000920, 8, 0x01, 0x00000002 },
154 { 0x000928, 8, 0x01, 0x00000001 },
155 { 0x000648, 9, 0x01, 0x00000001 },
156 { 0x000658, 1, 0x01, 0x0000000f },
157 { 0x0007ff, 1, 0x01, 0x0000000a },
158 { 0x00066a, 1, 0x01, 0x40000000 },
159 { 0x00066b, 1, 0x01, 0x10000000 },
160 { 0x00066c, 2, 0x01, 0xffff0000 },
161 { 0x0007af, 2, 0x01, 0x00000008 },
162 { 0x0007f6, 1, 0x01, 0x00000001 },
163 { 0x0006b2, 1, 0x01, 0x00000055 },
164 { 0x0007ad, 1, 0x01, 0x00000003 },
165 { 0x000937, 1, 0x01, 0x00000001 },
166 { 0x000971, 1, 0x01, 0x00000008 },
167 { 0x000972, 1, 0x01, 0x00000040 },
168 { 0x000973, 1, 0x01, 0x0000012c },
169 { 0x00097c, 1, 0x01, 0x00000040 },
170 { 0x000979, 1, 0x01, 0x00000003 },
171 { 0x000975, 1, 0x01, 0x00000020 },
172 { 0x000976, 1, 0x01, 0x00000001 },
173 { 0x000977, 1, 0x01, 0x00000020 },
174 { 0x000978, 1, 0x01, 0x00000001 },
175 { 0x000957, 1, 0x01, 0x00000003 },
176 { 0x00095e, 1, 0x01, 0x20164010 },
177 { 0x00095f, 1, 0x01, 0x00000020 },
178 { 0x000683, 1, 0x01, 0x00000006 },
179 { 0x000685, 1, 0x01, 0x003fffff },
180 { 0x000687, 1, 0x01, 0x00000c48 },
181 { 0x0006a0, 1, 0x01, 0x00000005 },
182 { 0x000840, 1, 0x01, 0x00300008 },
183 { 0x000841, 1, 0x01, 0x04000080 },
184 { 0x000842, 1, 0x01, 0x00300008 },
185 { 0x000843, 1, 0x01, 0x04000080 },
186 { 0x000818, 8, 0x01, 0x00000000 },
187 { 0x000848, 16, 0x01, 0x00000000 },
188 { 0x000738, 1, 0x01, 0x00000000 },
189 { 0x0006aa, 1, 0x01, 0x00000001 },
190 { 0x0006ab, 1, 0x01, 0x00000002 },
191 { 0x0006ac, 1, 0x01, 0x00000080 },
192 { 0x0006ad, 2, 0x01, 0x00000100 },
193 { 0x0006b1, 1, 0x01, 0x00000011 },
194 { 0x0006bb, 1, 0x01, 0x000000cf },
195 { 0x0006ce, 1, 0x01, 0x2a712488 },
196 { 0x000739, 1, 0x01, 0x4085c000 },
197 { 0x00073a, 1, 0x01, 0x00000080 },
198 { 0x000786, 1, 0x01, 0x80000100 },
199 { 0x00073c, 1, 0x01, 0x00010100 },
200 { 0x00073d, 1, 0x01, 0x02800000 },
201 { 0x000787, 1, 0x01, 0x000000cf },
202 { 0x00078c, 1, 0x01, 0x00000008 },
203 { 0x000792, 1, 0x01, 0x00000001 },
204 { 0x000794, 1, 0x01, 0x00000001 },
205 { 0x000795, 2, 0x01, 0x00000001 },
206 { 0x000797, 1, 0x01, 0x000000cf },
207 { 0x000836, 1, 0x01, 0x00000001 },
208 { 0x00079a, 1, 0x01, 0x00000002 },
209 { 0x000833, 1, 0x01, 0x04444480 },
210 { 0x0007a1, 1, 0x01, 0x00000001 },
211 { 0x0007a3, 1, 0x01, 0x00000001 },
212 { 0x0007a4, 2, 0x01, 0x00000001 },
213 { 0x000831, 1, 0x01, 0x00000004 },
214 { 0x00080c, 1, 0x01, 0x00000002 },
215 { 0x00080d, 2, 0x01, 0x00000100 },
216 { 0x00080f, 1, 0x01, 0x00000001 },
217 { 0x000823, 1, 0x01, 0x00000002 },
218 { 0x000824, 2, 0x01, 0x00000100 },
219 { 0x000826, 1, 0x01, 0x00000001 },
220 { 0x00095d, 1, 0x01, 0x00000001 },
221 { 0x00082b, 1, 0x01, 0x00000004 },
222 { 0x000942, 1, 0x01, 0x00010001 },
223 { 0x000943, 1, 0x01, 0x00000001 },
224 { 0x000944, 1, 0x01, 0x00000022 },
225 { 0x0007c5, 1, 0x01, 0x00010001 },
226 { 0x000834, 1, 0x01, 0x00000001 },
227 { 0x0007c7, 1, 0x01, 0x00000001 },
228 { 0x00c1b0, 8, 0x01, 0x0000000f },
229 { 0x00c1b8, 1, 0x01, 0x0fac6881 },
230 { 0x00c1b9, 1, 0x01, 0x00fac688 },
231 { 0x01e100, 1, 0x01, 0x00000001 },
232 { 0x001000, 1, 0x01, 0x00000002 },
233 { 0x0006aa, 1, 0x01, 0x00000001 },
234 { 0x0006ad, 2, 0x01, 0x00000100 },
235 { 0x0006b1, 1, 0x01, 0x00000011 },
236 { 0x00078c, 1, 0x01, 0x00000008 },
237 { 0x000792, 1, 0x01, 0x00000001 },
238 { 0x000794, 1, 0x01, 0x00000001 },
239 { 0x000795, 2, 0x01, 0x00000001 },
240 { 0x000797, 1, 0x01, 0x000000cf },
241 { 0x00079a, 1, 0x01, 0x00000002 },
242 { 0x000833, 1, 0x01, 0x04444480 },
243 { 0x0007a1, 1, 0x01, 0x00000001 },
244 { 0x0007a3, 1, 0x01, 0x00000001 },
245 { 0x0007a4, 2, 0x01, 0x00000001 },
246 { 0x000831, 1, 0x01, 0x00000004 },
247 { 0x01e100, 1, 0x01, 0x00000001 },
248 { 0x001000, 1, 0x01, 0x00000014 },
249 { 0x000351, 1, 0x01, 0x00000100 },
250 { 0x000957, 1, 0x01, 0x00000003 },
251 { 0x00095d, 1, 0x01, 0x00000001 },
252 { 0x00082b, 1, 0x01, 0x00000004 },
253 { 0x000942, 1, 0x01, 0x00010001 },
254 { 0x000943, 1, 0x01, 0x00000001 },
255 { 0x0007c5, 1, 0x01, 0x00010001 },
256 { 0x000834, 1, 0x01, 0x00000001 },
257 { 0x0007c7, 1, 0x01, 0x00000001 },
258 { 0x01e100, 1, 0x01, 0x00000001 },
259 { 0x001000, 1, 0x01, 0x00000001 },
260 { 0x00080c, 1, 0x01, 0x00000002 },
261 { 0x00080d, 2, 0x01, 0x00000100 },
262 { 0x00080f, 1, 0x01, 0x00000001 },
263 { 0x000823, 1, 0x01, 0x00000002 },
264 { 0x000824, 2, 0x01, 0x00000100 },
265 { 0x000826, 1, 0x01, 0x00000001 },
266 { 0x01e100, 1, 0x01, 0x00000001 },
267 {}
268};
269
270struct nvc0_graph_init
271nvc0_grctx_init_9097[] = {
272 { 0x000800, 8, 0x40, 0x00000000 },
273 { 0x000804, 8, 0x40, 0x00000000 },
274 { 0x000808, 8, 0x40, 0x00000400 },
275 { 0x00080c, 8, 0x40, 0x00000300 },
276 { 0x000810, 1, 0x04, 0x000000cf },
277 { 0x000850, 7, 0x40, 0x00000000 },
278 { 0x000814, 8, 0x40, 0x00000040 },
279 { 0x000818, 8, 0x40, 0x00000001 },
280 { 0x00081c, 8, 0x40, 0x00000000 },
281 { 0x000820, 8, 0x40, 0x00000000 },
282 { 0x002700, 8, 0x20, 0x00000000 },
283 { 0x002704, 8, 0x20, 0x00000000 },
284 { 0x002708, 8, 0x20, 0x00000000 },
285 { 0x00270c, 8, 0x20, 0x00000000 },
286 { 0x002710, 8, 0x20, 0x00014000 },
287 { 0x002714, 8, 0x20, 0x00000040 },
288 { 0x001c00, 16, 0x10, 0x00000000 },
289 { 0x001c04, 16, 0x10, 0x00000000 },
290 { 0x001c08, 16, 0x10, 0x00000000 },
291 { 0x001c0c, 16, 0x10, 0x00000000 },
292 { 0x001d00, 16, 0x10, 0x00000000 },
293 { 0x001d04, 16, 0x10, 0x00000000 },
294 { 0x001d08, 16, 0x10, 0x00000000 },
295 { 0x001d0c, 16, 0x10, 0x00000000 },
296 { 0x001f00, 16, 0x08, 0x00000000 },
297 { 0x001f04, 16, 0x08, 0x00000000 },
298 { 0x001f80, 16, 0x08, 0x00000000 },
299 { 0x001f84, 16, 0x08, 0x00000000 },
300 { 0x002200, 5, 0x10, 0x00000022 },
301 { 0x002000, 1, 0x04, 0x00000000 },
302 { 0x002040, 1, 0x04, 0x00000011 },
303 { 0x002080, 1, 0x04, 0x00000020 },
304 { 0x0020c0, 1, 0x04, 0x00000030 },
305 { 0x002100, 1, 0x04, 0x00000040 },
306 { 0x002140, 1, 0x04, 0x00000051 },
307 { 0x00200c, 6, 0x40, 0x00000001 },
308 { 0x002010, 1, 0x04, 0x00000000 },
309 { 0x002050, 1, 0x04, 0x00000000 },
310 { 0x002090, 1, 0x04, 0x00000001 },
311 { 0x0020d0, 1, 0x04, 0x00000002 },
312 { 0x002110, 1, 0x04, 0x00000003 },
313 { 0x002150, 1, 0x04, 0x00000004 },
314 { 0x000380, 4, 0x20, 0x00000000 },
315 { 0x000384, 4, 0x20, 0x00000000 },
316 { 0x000388, 4, 0x20, 0x00000000 },
317 { 0x00038c, 4, 0x20, 0x00000000 },
318 { 0x000700, 4, 0x10, 0x00000000 },
319 { 0x000704, 4, 0x10, 0x00000000 },
320 { 0x000708, 4, 0x10, 0x00000000 },
321 { 0x002800, 128, 0x04, 0x00000000 },
322 { 0x000a00, 16, 0x20, 0x00000000 },
323 { 0x000a04, 16, 0x20, 0x00000000 },
324 { 0x000a08, 16, 0x20, 0x00000000 },
325 { 0x000a0c, 16, 0x20, 0x00000000 },
326 { 0x000a10, 16, 0x20, 0x00000000 },
327 { 0x000a14, 16, 0x20, 0x00000000 },
328 { 0x000c00, 16, 0x10, 0x00000000 },
329 { 0x000c04, 16, 0x10, 0x00000000 },
330 { 0x000c08, 16, 0x10, 0x00000000 },
331 { 0x000c0c, 16, 0x10, 0x3f800000 },
332 { 0x000d00, 8, 0x08, 0xffff0000 },
333 { 0x000d04, 8, 0x08, 0xffff0000 },
334 { 0x000e00, 16, 0x10, 0x00000000 },
335 { 0x000e04, 16, 0x10, 0xffff0000 },
336 { 0x000e08, 16, 0x10, 0xffff0000 },
337 { 0x000d40, 4, 0x08, 0x00000000 },
338 { 0x000d44, 4, 0x08, 0x00000000 },
339 { 0x001e00, 8, 0x20, 0x00000001 },
340 { 0x001e04, 8, 0x20, 0x00000001 },
341 { 0x001e08, 8, 0x20, 0x00000002 },
342 { 0x001e0c, 8, 0x20, 0x00000001 },
343 { 0x001e10, 8, 0x20, 0x00000001 },
344 { 0x001e14, 8, 0x20, 0x00000002 },
345 { 0x001e18, 8, 0x20, 0x00000001 },
346 { 0x003400, 128, 0x04, 0x00000000 },
347 { 0x00030c, 1, 0x04, 0x00000001 },
348 { 0x001944, 1, 0x04, 0x00000000 },
349 { 0x001514, 1, 0x04, 0x00000000 },
350 { 0x000d68, 1, 0x04, 0x0000ffff },
351 { 0x00121c, 1, 0x04, 0x0fac6881 },
352 { 0x000fac, 1, 0x04, 0x00000001 },
353 { 0x001538, 1, 0x04, 0x00000001 },
354 { 0x000fe0, 2, 0x04, 0x00000000 },
355 { 0x000fe8, 1, 0x04, 0x00000014 },
356 { 0x000fec, 1, 0x04, 0x00000040 },
357 { 0x000ff0, 1, 0x04, 0x00000000 },
358 { 0x00179c, 1, 0x04, 0x00000000 },
359 { 0x001228, 1, 0x04, 0x00000400 },
360 { 0x00122c, 1, 0x04, 0x00000300 },
361 { 0x001230, 1, 0x04, 0x00010001 },
362 { 0x0007f8, 1, 0x04, 0x00000000 },
363 { 0x0015b4, 1, 0x04, 0x00000001 },
364 { 0x0015cc, 1, 0x04, 0x00000000 },
365 { 0x001534, 1, 0x04, 0x00000000 },
366 { 0x000fb0, 1, 0x04, 0x00000000 },
367 { 0x0015d0, 1, 0x04, 0x00000000 },
368 { 0x00153c, 1, 0x04, 0x00000000 },
369 { 0x0016b4, 1, 0x04, 0x00000003 },
370 { 0x000fbc, 4, 0x04, 0x0000ffff },
371 { 0x000df8, 2, 0x04, 0x00000000 },
372 { 0x001948, 1, 0x04, 0x00000000 },
373 { 0x001970, 1, 0x04, 0x00000001 },
374 { 0x00161c, 1, 0x04, 0x000009f0 },
375 { 0x000dcc, 1, 0x04, 0x00000010 },
376 { 0x00163c, 1, 0x04, 0x00000000 },
377 { 0x0015e4, 1, 0x04, 0x00000000 },
378 { 0x001160, 32, 0x04, 0x25e00040 },
379 { 0x001880, 32, 0x04, 0x00000000 },
380 { 0x000f84, 2, 0x04, 0x00000000 },
381 { 0x0017c8, 2, 0x04, 0x00000000 },
382 { 0x0017d0, 1, 0x04, 0x000000ff },
383 { 0x0017d4, 1, 0x04, 0xffffffff },
384 { 0x0017d8, 1, 0x04, 0x00000002 },
385 { 0x0017dc, 1, 0x04, 0x00000000 },
386 { 0x0015f4, 2, 0x04, 0x00000000 },
387 { 0x001434, 2, 0x04, 0x00000000 },
388 { 0x000d74, 1, 0x04, 0x00000000 },
389 { 0x000dec, 1, 0x04, 0x00000001 },
390 { 0x0013a4, 1, 0x04, 0x00000000 },
391 { 0x001318, 1, 0x04, 0x00000001 },
392 { 0x001644, 1, 0x04, 0x00000000 },
393 { 0x000748, 1, 0x04, 0x00000000 },
394 { 0x000de8, 1, 0x04, 0x00000000 },
395 { 0x001648, 1, 0x04, 0x00000000 },
396 { 0x0012a4, 1, 0x04, 0x00000000 },
397 { 0x001120, 4, 0x04, 0x00000000 },
398 { 0x001118, 1, 0x04, 0x00000000 },
399 { 0x00164c, 1, 0x04, 0x00000000 },
400 { 0x001658, 1, 0x04, 0x00000000 },
401 { 0x001910, 1, 0x04, 0x00000290 },
402 { 0x001518, 1, 0x04, 0x00000000 },
403 { 0x00165c, 1, 0x04, 0x00000001 },
404 { 0x001520, 1, 0x04, 0x00000000 },
405 { 0x001604, 1, 0x04, 0x00000000 },
406 { 0x001570, 1, 0x04, 0x00000000 },
407 { 0x0013b0, 2, 0x04, 0x3f800000 },
408 { 0x00020c, 1, 0x04, 0x00000000 },
409 { 0x001670, 1, 0x04, 0x30201000 },
410 { 0x001674, 1, 0x04, 0x70605040 },
411 { 0x001678, 1, 0x04, 0xb8a89888 },
412 { 0x00167c, 1, 0x04, 0xf8e8d8c8 },
413 { 0x00166c, 1, 0x04, 0x00000000 },
414 { 0x001680, 1, 0x04, 0x00ffff00 },
415 { 0x0012d0, 1, 0x04, 0x00000003 },
416 { 0x0012d4, 1, 0x04, 0x00000002 },
417 { 0x001684, 2, 0x04, 0x00000000 },
418 { 0x000dac, 2, 0x04, 0x00001b02 },
419 { 0x000db4, 1, 0x04, 0x00000000 },
420 { 0x00168c, 1, 0x04, 0x00000000 },
421 { 0x0015bc, 1, 0x04, 0x00000000 },
422 { 0x00156c, 1, 0x04, 0x00000000 },
423 { 0x00187c, 1, 0x04, 0x00000000 },
424 { 0x001110, 1, 0x04, 0x00000001 },
425 { 0x000dc0, 3, 0x04, 0x00000000 },
426 { 0x001234, 1, 0x04, 0x00000000 },
427 { 0x001690, 1, 0x04, 0x00000000 },
428 { 0x0012ac, 1, 0x04, 0x00000001 },
429 { 0x0002c4, 1, 0x04, 0x00000000 },
430 { 0x000790, 5, 0x04, 0x00000000 },
431 { 0x00077c, 1, 0x04, 0x00000000 },
432 { 0x001000, 1, 0x04, 0x00000010 },
433 { 0x0010fc, 1, 0x04, 0x00000000 },
434 { 0x001290, 1, 0x04, 0x00000000 },
435 { 0x000218, 1, 0x04, 0x00000010 },
436 { 0x0012d8, 1, 0x04, 0x00000000 },
437 { 0x0012dc, 1, 0x04, 0x00000010 },
438 { 0x000d94, 1, 0x04, 0x00000001 },
439 { 0x00155c, 2, 0x04, 0x00000000 },
440 { 0x001564, 1, 0x04, 0x00001fff },
441 { 0x001574, 2, 0x04, 0x00000000 },
442 { 0x00157c, 1, 0x04, 0x003fffff },
443 { 0x001354, 1, 0x04, 0x00000000 },
444 { 0x001664, 1, 0x04, 0x00000000 },
445 { 0x001610, 1, 0x04, 0x00000012 },
446 { 0x001608, 2, 0x04, 0x00000000 },
447 { 0x00162c, 1, 0x04, 0x00000003 },
448 { 0x000210, 1, 0x04, 0x00000000 },
449 { 0x000320, 1, 0x04, 0x00000000 },
450 { 0x000324, 6, 0x04, 0x3f800000 },
451 { 0x000750, 1, 0x04, 0x00000000 },
452 { 0x000760, 1, 0x04, 0x39291909 },
453 { 0x000764, 1, 0x04, 0x79695949 },
454 { 0x000768, 1, 0x04, 0xb9a99989 },
455 { 0x00076c, 1, 0x04, 0xf9e9d9c9 },
456 { 0x000770, 1, 0x04, 0x30201000 },
457 { 0x000774, 1, 0x04, 0x70605040 },
458 { 0x000778, 1, 0x04, 0x00009080 },
459 { 0x000780, 1, 0x04, 0x39291909 },
460 { 0x000784, 1, 0x04, 0x79695949 },
461 { 0x000788, 1, 0x04, 0xb9a99989 },
462 { 0x00078c, 1, 0x04, 0xf9e9d9c9 },
463 { 0x0007d0, 1, 0x04, 0x30201000 },
464 { 0x0007d4, 1, 0x04, 0x70605040 },
465 { 0x0007d8, 1, 0x04, 0x00009080 },
466 { 0x00037c, 1, 0x04, 0x00000001 },
467 { 0x000740, 2, 0x04, 0x00000000 },
468 { 0x002600, 1, 0x04, 0x00000000 },
469 { 0x001918, 1, 0x04, 0x00000000 },
470 { 0x00191c, 1, 0x04, 0x00000900 },
471 { 0x001920, 1, 0x04, 0x00000405 },
472 { 0x001308, 1, 0x04, 0x00000001 },
473 { 0x001924, 1, 0x04, 0x00000000 },
474 { 0x0013ac, 1, 0x04, 0x00000000 },
475 { 0x00192c, 1, 0x04, 0x00000001 },
476 { 0x00193c, 1, 0x04, 0x00002c1c },
477 { 0x000d7c, 1, 0x04, 0x00000000 },
478 { 0x000f8c, 1, 0x04, 0x00000000 },
479 { 0x0002c0, 1, 0x04, 0x00000001 },
480 { 0x001510, 1, 0x04, 0x00000000 },
481 { 0x001940, 1, 0x04, 0x00000000 },
482 { 0x000ff4, 2, 0x04, 0x00000000 },
483 { 0x00194c, 2, 0x04, 0x00000000 },
484 { 0x001968, 1, 0x04, 0x00000000 },
485 { 0x001590, 1, 0x04, 0x0000003f },
486 { 0x0007e8, 4, 0x04, 0x00000000 },
487 { 0x00196c, 1, 0x04, 0x00000011 },
488 { 0x00197c, 1, 0x04, 0x00000000 },
489 { 0x000fcc, 2, 0x04, 0x00000000 },
490 { 0x0002d8, 1, 0x04, 0x00000040 },
491 { 0x001980, 1, 0x04, 0x00000080 },
492 { 0x001504, 1, 0x04, 0x00000080 },
493 { 0x001984, 1, 0x04, 0x00000000 },
494 { 0x000300, 1, 0x04, 0x00000001 },
495 { 0x0013a8, 1, 0x04, 0x00000000 },
496 { 0x0012ec, 1, 0x04, 0x00000000 },
497 { 0x001310, 1, 0x04, 0x00000000 },
498 { 0x001314, 1, 0x04, 0x00000001 },
499 { 0x001380, 1, 0x04, 0x00000000 },
500 { 0x001384, 4, 0x04, 0x00000001 },
501 { 0x001394, 1, 0x04, 0x00000000 },
502 { 0x00139c, 1, 0x04, 0x00000000 },
503 { 0x001398, 1, 0x04, 0x00000000 },
504 { 0x001594, 1, 0x04, 0x00000000 },
505 { 0x001598, 4, 0x04, 0x00000001 },
506 { 0x000f54, 3, 0x04, 0x00000000 },
507 { 0x0019bc, 1, 0x04, 0x00000000 },
508 { 0x000f9c, 2, 0x04, 0x00000000 },
509 { 0x0012cc, 1, 0x04, 0x00000000 },
510 { 0x0012e8, 1, 0x04, 0x00000000 },
511 { 0x00130c, 1, 0x04, 0x00000001 },
512 { 0x001360, 8, 0x04, 0x00000000 },
513 { 0x00133c, 2, 0x04, 0x00000001 },
514 { 0x001344, 1, 0x04, 0x00000002 },
515 { 0x001348, 2, 0x04, 0x00000001 },
516 { 0x001350, 1, 0x04, 0x00000002 },
517 { 0x001358, 1, 0x04, 0x00000001 },
518 { 0x0012e4, 1, 0x04, 0x00000000 },
519 { 0x00131c, 1, 0x04, 0x00000000 },
520 { 0x001320, 3, 0x04, 0x00000000 },
521 { 0x0019c0, 1, 0x04, 0x00000000 },
522 { 0x001140, 1, 0x04, 0x00000000 },
523 { 0x0019c4, 1, 0x04, 0x00000000 },
524 { 0x0019c8, 1, 0x04, 0x00001500 },
525 { 0x00135c, 1, 0x04, 0x00000000 },
526 { 0x000f90, 1, 0x04, 0x00000000 },
527 { 0x0019e0, 8, 0x04, 0x00000001 },
528 { 0x0019cc, 1, 0x04, 0x00000001 },
529 { 0x0015b8, 1, 0x04, 0x00000000 },
530 { 0x001a00, 1, 0x04, 0x00001111 },
531 { 0x001a04, 7, 0x04, 0x00000000 },
532 { 0x000d6c, 2, 0x04, 0xffff0000 },
533 { 0x0010f8, 1, 0x04, 0x00001010 },
534 { 0x000d80, 5, 0x04, 0x00000000 },
535 { 0x000da0, 1, 0x04, 0x00000000 },
536 { 0x001508, 1, 0x04, 0x80000000 },
537 { 0x00150c, 1, 0x04, 0x40000000 },
538 { 0x001668, 1, 0x04, 0x00000000 },
539 { 0x000318, 2, 0x04, 0x00000008 },
540 { 0x000d9c, 1, 0x04, 0x00000001 },
541 { 0x0007dc, 1, 0x04, 0x00000000 },
542 { 0x00074c, 1, 0x04, 0x00000055 },
543 { 0x001420, 1, 0x04, 0x00000003 },
544 { 0x0017bc, 2, 0x04, 0x00000000 },
545 { 0x0017c4, 1, 0x04, 0x00000001 },
546 { 0x001008, 1, 0x04, 0x00000008 },
547 { 0x00100c, 1, 0x04, 0x00000040 },
548 { 0x001010, 1, 0x04, 0x0000012c },
549 { 0x000d60, 1, 0x04, 0x00000040 },
550 { 0x00075c, 1, 0x04, 0x00000003 },
551 { 0x001018, 1, 0x04, 0x00000020 },
552 { 0x00101c, 1, 0x04, 0x00000001 },
553 { 0x001020, 1, 0x04, 0x00000020 },
554 { 0x001024, 1, 0x04, 0x00000001 },
555 { 0x001444, 3, 0x04, 0x00000000 },
556 { 0x000360, 1, 0x04, 0x20164010 },
557 { 0x000364, 1, 0x04, 0x00000020 },
558 { 0x000368, 1, 0x04, 0x00000000 },
559 { 0x000de4, 1, 0x04, 0x00000000 },
560 { 0x000204, 1, 0x04, 0x00000006 },
561 { 0x000208, 1, 0x04, 0x00000000 },
562 { 0x0002cc, 1, 0x04, 0x003fffff },
563 { 0x0002d0, 1, 0x04, 0x00000c48 },
564 { 0x001220, 1, 0x04, 0x00000005 },
565 { 0x000fdc, 1, 0x04, 0x00000000 },
566 { 0x000f98, 1, 0x04, 0x00300008 },
567 { 0x001284, 1, 0x04, 0x04000080 },
568 { 0x001450, 1, 0x04, 0x00300008 },
569 { 0x001454, 1, 0x04, 0x04000080 },
570 { 0x000214, 1, 0x04, 0x00000000 },
571 {}
572};
573
574struct nvc0_graph_init
575nvc0_grctx_init_902d[] = {
576 { 0x000200, 1, 0x04, 0x000000cf },
577 { 0x000204, 1, 0x04, 0x00000001 },
578 { 0x000208, 1, 0x04, 0x00000020 },
579 { 0x00020c, 1, 0x04, 0x00000001 },
580 { 0x000210, 1, 0x04, 0x00000000 },
581 { 0x000214, 1, 0x04, 0x00000080 },
582 { 0x000218, 2, 0x04, 0x00000100 },
583 { 0x000220, 2, 0x04, 0x00000000 },
584 { 0x000230, 1, 0x04, 0x000000cf },
585 { 0x000234, 1, 0x04, 0x00000001 },
586 { 0x000238, 1, 0x04, 0x00000020 },
587 { 0x00023c, 1, 0x04, 0x00000001 },
588 { 0x000244, 1, 0x04, 0x00000080 },
589 { 0x000248, 2, 0x04, 0x00000100 },
590 {}
591};
592
593struct nvc0_graph_init
594nvc0_grctx_init_9039[] = {
595 { 0x00030c, 3, 0x04, 0x00000000 },
596 { 0x000320, 1, 0x04, 0x00000000 },
597 { 0x000238, 2, 0x04, 0x00000000 },
598 { 0x000318, 2, 0x04, 0x00000000 },
599 {}
600};
601
602struct nvc0_graph_init
603nvc0_grctx_init_90c0[] = {
604 { 0x00270c, 8, 0x20, 0x00000000 },
605 { 0x00030c, 1, 0x04, 0x00000001 },
606 { 0x001944, 1, 0x04, 0x00000000 },
607 { 0x000758, 1, 0x04, 0x00000100 },
608 { 0x0002c4, 1, 0x04, 0x00000000 },
609 { 0x000790, 5, 0x04, 0x00000000 },
610 { 0x00077c, 1, 0x04, 0x00000000 },
611 { 0x000204, 3, 0x04, 0x00000000 },
612 { 0x000214, 1, 0x04, 0x00000000 },
613 { 0x00024c, 1, 0x04, 0x00000000 },
614 { 0x000d94, 1, 0x04, 0x00000001 },
615 { 0x001608, 2, 0x04, 0x00000000 },
616 { 0x001664, 1, 0x04, 0x00000000 },
617 {}
618};
619
620struct nvc0_graph_init
621nvc0_grctx_init_base[] = {
622 { 0x400204, 2, 0x04, 0x00000000 },
623 {}
624};
625
626struct nvc0_graph_init
627nvc0_grctx_init_unk40xx[] = {
628 { 0x404004, 10, 0x04, 0x00000000 },
629 { 0x404044, 1, 0x04, 0x00000000 },
630 { 0x404094, 1, 0x04, 0x00000000 },
631 { 0x404098, 12, 0x04, 0x00000000 },
632 { 0x4040c8, 1, 0x04, 0xf0000087 },
633 { 0x4040d0, 6, 0x04, 0x00000000 },
634 { 0x4040e8, 1, 0x04, 0x00001000 },
635 { 0x4040f8, 1, 0x04, 0x00000000 },
636 { 0x404130, 1, 0x04, 0x00000000 },
637 { 0x404134, 1, 0x04, 0x00000000 },
638 { 0x404138, 1, 0x04, 0x20000040 },
639 { 0x404150, 1, 0x04, 0x0000002e },
640 { 0x404154, 1, 0x04, 0x00000400 },
641 { 0x404158, 1, 0x04, 0x00000200 },
642 { 0x404164, 1, 0x04, 0x00000055 },
643 { 0x404168, 1, 0x04, 0x00000000 },
644 { 0x404174, 1, 0x04, 0x00000000 },
645 { 0x404178, 2, 0x04, 0x00000000 },
646 { 0x404200, 8, 0x04, 0x00000000 },
647 {}
648};
649
650struct nvc0_graph_init
651nvc0_grctx_init_unk44xx[] = {
652 { 0x404404, 14, 0x04, 0x00000000 },
653 { 0x404460, 2, 0x04, 0x00000000 },
654 { 0x404468, 1, 0x04, 0x00ffffff },
655 { 0x40446c, 1, 0x04, 0x00000000 },
656 { 0x404480, 1, 0x04, 0x00000001 },
657 { 0x404498, 1, 0x04, 0x00000001 },
658 {}
659};
660
661struct nvc0_graph_init
662nvc0_grctx_init_unk46xx[] = {
663 { 0x404604, 1, 0x04, 0x00000015 },
664 { 0x404608, 1, 0x04, 0x00000000 },
665 { 0x40460c, 1, 0x04, 0x00002e00 },
666 { 0x404610, 1, 0x04, 0x00000100 },
667 { 0x404618, 8, 0x04, 0x00000000 },
668 { 0x404638, 1, 0x04, 0x00000004 },
669 { 0x40463c, 8, 0x04, 0x00000000 },
670 { 0x40465c, 1, 0x04, 0x007f0100 },
671 { 0x404660, 7, 0x04, 0x00000000 },
672 { 0x40467c, 1, 0x04, 0x00000002 },
673 { 0x404680, 8, 0x04, 0x00000000 },
674 { 0x4046a0, 1, 0x04, 0x007f0080 },
675 { 0x4046a4, 18, 0x04, 0x00000000 },
676 { 0x4046f0, 2, 0x04, 0x00000000 },
677 {}
678};
679
680struct nvc0_graph_init
681nvc0_grctx_init_unk47xx[] = {
682 { 0x404700, 13, 0x04, 0x00000000 },
683 { 0x404734, 1, 0x04, 0x00000100 },
684 { 0x404738, 8, 0x04, 0x00000000 },
685 {}
686};
687
688struct nvc0_graph_init
689nvc0_grctx_init_unk58xx[] = {
690 { 0x405800, 1, 0x04, 0x078000bf },
691 { 0x405830, 1, 0x04, 0x02180000 },
692 { 0x405834, 2, 0x04, 0x00000000 },
693 { 0x405854, 1, 0x04, 0x00000000 },
694 { 0x405870, 4, 0x04, 0x00000001 },
695 { 0x405a00, 2, 0x04, 0x00000000 },
696 { 0x405a18, 1, 0x04, 0x00000000 },
697 {}
698};
699
700struct nvc0_graph_init
701nvc0_grctx_init_unk60xx[] = {
702 { 0x406020, 1, 0x04, 0x000103c1 },
703 { 0x406028, 4, 0x04, 0x00000001 },
704 {}
705};
706
707struct nvc0_graph_init
708nvc0_grctx_init_unk64xx[] = {
709 { 0x4064a8, 1, 0x04, 0x00000000 },
710 { 0x4064ac, 1, 0x04, 0x00003fff },
711 { 0x4064b4, 2, 0x04, 0x00000000 },
712 {}
713};
714
715struct nvc0_graph_init
716nvc0_grctx_init_unk78xx[] = {
717 { 0x407804, 1, 0x04, 0x00000023 },
718 { 0x40780c, 1, 0x04, 0x0a418820 },
719 { 0x407810, 1, 0x04, 0x062080e6 },
720 { 0x407814, 1, 0x04, 0x020398a4 },
721 { 0x407818, 1, 0x04, 0x0e629062 },
722 { 0x40781c, 1, 0x04, 0x0a418820 },
723 { 0x407820, 1, 0x04, 0x000000e6 },
724 { 0x4078bc, 1, 0x04, 0x00000103 },
725 {}
726};
727
728struct nvc0_graph_init
729nvc0_grctx_init_unk80xx[] = {
730 { 0x408000, 2, 0x04, 0x00000000 },
731 { 0x408008, 1, 0x04, 0x00000018 },
732 { 0x40800c, 2, 0x04, 0x00000000 },
733 { 0x408014, 1, 0x04, 0x00000069 },
734 { 0x408018, 1, 0x04, 0xe100e100 },
735 { 0x408064, 1, 0x04, 0x00000000 },
736 {}
737};
738
739struct nvc0_graph_init
740nvc0_grctx_init_rop[] = {
741 { 0x408800, 1, 0x04, 0x02802a3c },
742 { 0x408804, 1, 0x04, 0x00000040 },
743 { 0x408808, 1, 0x04, 0x0003e00d },
744 { 0x408900, 1, 0x04, 0x3080b801 },
745 { 0x408904, 1, 0x04, 0x02000001 },
746 { 0x408908, 1, 0x04, 0x00c80929 },
747 { 0x408980, 1, 0x04, 0x0000011d },
748 {}
749};
750
751struct nvc0_graph_init
752nvc0_grctx_init_gpc_0[] = {
753 { 0x418380, 1, 0x04, 0x00000016 },
754 { 0x418400, 1, 0x04, 0x38004e00 },
755 { 0x418404, 1, 0x04, 0x71e0ffff },
756 { 0x418408, 1, 0x04, 0x00000000 },
757 { 0x41840c, 1, 0x04, 0x00001008 },
758 { 0x418410, 1, 0x04, 0x0fff0fff },
759 { 0x418414, 1, 0x04, 0x00200fff },
760 { 0x418450, 6, 0x04, 0x00000000 },
761 { 0x418468, 1, 0x04, 0x00000001 },
762 { 0x41846c, 2, 0x04, 0x00000000 },
763 { 0x418600, 1, 0x04, 0x0000001f },
764 { 0x418684, 1, 0x04, 0x0000000f },
765 { 0x418700, 1, 0x04, 0x00000002 },
766 { 0x418704, 1, 0x04, 0x00000080 },
767 { 0x418708, 1, 0x04, 0x00000000 },
768 { 0x41870c, 1, 0x04, 0x07c80000 },
769 { 0x418710, 1, 0x04, 0x00000000 },
770 { 0x418800, 1, 0x04, 0x0006860a },
771 { 0x418808, 3, 0x04, 0x00000000 },
772 { 0x418828, 1, 0x04, 0x00008442 },
773 { 0x418830, 1, 0x04, 0x00000001 },
774 { 0x4188d8, 1, 0x04, 0x00000008 },
775 { 0x4188e0, 1, 0x04, 0x01000000 },
776 { 0x4188e8, 5, 0x04, 0x00000000 },
777 { 0x4188fc, 1, 0x04, 0x00100000 },
778 { 0x41891c, 1, 0x04, 0x00ff00ff },
779 { 0x418924, 1, 0x04, 0x00000000 },
780 { 0x418928, 1, 0x04, 0x00ffff00 },
781 { 0x41892c, 1, 0x04, 0x0000ff00 },
782 { 0x418b00, 1, 0x04, 0x00000000 },
783 { 0x418b08, 1, 0x04, 0x0a418820 },
784 { 0x418b0c, 1, 0x04, 0x062080e6 },
785 { 0x418b10, 1, 0x04, 0x020398a4 },
786 { 0x418b14, 1, 0x04, 0x0e629062 },
787 { 0x418b18, 1, 0x04, 0x0a418820 },
788 { 0x418b1c, 1, 0x04, 0x000000e6 },
789 { 0x418bb8, 1, 0x04, 0x00000103 },
790 { 0x418c08, 1, 0x04, 0x00000001 },
791 { 0x418c10, 8, 0x04, 0x00000000 },
792 { 0x418c80, 1, 0x04, 0x20200004 },
793 { 0x418c8c, 1, 0x04, 0x00000001 },
794 { 0x419000, 1, 0x04, 0x00000780 },
795 { 0x419004, 2, 0x04, 0x00000000 },
796 { 0x419014, 1, 0x04, 0x00000004 },
797 {}
798};
799
800struct nvc0_graph_init
801nvc0_grctx_init_gpc_1[] = {
802 { 0x418a00, 3, 0x04, 0x00000000 },
803 { 0x418a0c, 1, 0x04, 0x00010000 },
804 { 0x418a10, 3, 0x04, 0x00000000 },
805 { 0x418a20, 3, 0x04, 0x00000000 },
806 { 0x418a2c, 1, 0x04, 0x00010000 },
807 { 0x418a30, 3, 0x04, 0x00000000 },
808 { 0x418a40, 3, 0x04, 0x00000000 },
809 { 0x418a4c, 1, 0x04, 0x00010000 },
810 { 0x418a50, 3, 0x04, 0x00000000 },
811 { 0x418a60, 3, 0x04, 0x00000000 },
812 { 0x418a6c, 1, 0x04, 0x00010000 },
813 { 0x418a70, 3, 0x04, 0x00000000 },
814 { 0x418a80, 3, 0x04, 0x00000000 },
815 { 0x418a8c, 1, 0x04, 0x00010000 },
816 { 0x418a90, 3, 0x04, 0x00000000 },
817 { 0x418aa0, 3, 0x04, 0x00000000 },
818 { 0x418aac, 1, 0x04, 0x00010000 },
819 { 0x418ab0, 3, 0x04, 0x00000000 },
820 { 0x418ac0, 3, 0x04, 0x00000000 },
821 { 0x418acc, 1, 0x04, 0x00010000 },
822 { 0x418ad0, 3, 0x04, 0x00000000 },
823 { 0x418ae0, 3, 0x04, 0x00000000 },
824 { 0x418aec, 1, 0x04, 0x00010000 },
825 { 0x418af0, 3, 0x04, 0x00000000 },
826 {}
827};
828
829struct nvc0_graph_init
830nvc0_grctx_init_tpc[] = {
831 { 0x419818, 1, 0x04, 0x00000000 },
832 { 0x41983c, 1, 0x04, 0x00038bc7 },
833 { 0x419848, 1, 0x04, 0x00000000 },
834 { 0x419864, 1, 0x04, 0x0000012a },
835 { 0x419888, 1, 0x04, 0x00000000 },
836 { 0x419a00, 1, 0x04, 0x000001f0 },
837 { 0x419a04, 1, 0x04, 0x00000001 },
838 { 0x419a08, 1, 0x04, 0x00000023 },
839 { 0x419a0c, 1, 0x04, 0x00020000 },
840 { 0x419a10, 1, 0x04, 0x00000000 },
841 { 0x419a14, 1, 0x04, 0x00000200 },
842 { 0x419b00, 1, 0x04, 0x0a418820 },
843 { 0x419b04, 1, 0x04, 0x062080e6 },
844 { 0x419b08, 1, 0x04, 0x020398a4 },
845 { 0x419b0c, 1, 0x04, 0x0e629062 },
846 { 0x419b10, 1, 0x04, 0x0a418820 },
847 { 0x419b14, 1, 0x04, 0x000000e6 },
848 { 0x419bd0, 1, 0x04, 0x00900103 },
849 { 0x419be0, 1, 0x04, 0x00000001 },
850 { 0x419be4, 1, 0x04, 0x00000000 },
851 { 0x419c00, 1, 0x04, 0x00000002 },
852 { 0x419c04, 1, 0x04, 0x00000006 },
853 { 0x419c08, 1, 0x04, 0x00000002 },
854 { 0x419c20, 1, 0x04, 0x00000000 },
855 { 0x419cb0, 1, 0x04, 0x00060048 },
856 { 0x419ce8, 1, 0x04, 0x00000000 },
857 { 0x419cf4, 1, 0x04, 0x00000183 },
858 { 0x419d20, 1, 0x04, 0x02180000 },
859 { 0x419d24, 1, 0x04, 0x00001fff },
860 { 0x419e04, 3, 0x04, 0x00000000 },
861 { 0x419e10, 1, 0x04, 0x00000002 },
862 { 0x419e44, 1, 0x04, 0x001beff2 },
863 { 0x419e48, 1, 0x04, 0x00000000 },
864 { 0x419e4c, 1, 0x04, 0x0000000f },
865 { 0x419e50, 17, 0x04, 0x00000000 },
866 { 0x419e98, 1, 0x04, 0x00000000 },
867 { 0x419f50, 2, 0x04, 0x00000000 },
868 {}
869};
34 870
35int 871void
36nvc0_grctx_init(struct nvc0_graph_priv *priv, struct nvc0_grctx *info) 872nvc0_grctx_generate_mods(struct nvc0_graph_priv *priv, struct nvc0_grctx *info)
37{ 873{
38 struct nouveau_bar *bar = nouveau_bar(priv); 874 int gpc, tpc;
39 struct nouveau_gpuobj *chan; 875 u32 offset;
40 u32 size = (0x80000 + priv->size + 4095) & ~4095;
41 int ret, i;
42
43 /* allocate memory to for a "channel", which we'll use to generate
44 * the default context values
45 */
46 ret = nouveau_gpuobj_new(nv_object(priv), NULL, size, 0x1000,
47 NVOBJ_FLAG_ZERO_ALLOC, &info->chan);
48 chan = info->chan;
49 if (ret) {
50 nv_error(priv, "failed to allocate channel memory, %d\n", ret);
51 return ret;
52 }
53
54 /* PGD pointer */
55 nv_wo32(chan, 0x0200, lower_32_bits(chan->addr + 0x1000));
56 nv_wo32(chan, 0x0204, upper_32_bits(chan->addr + 0x1000));
57 nv_wo32(chan, 0x0208, 0xffffffff);
58 nv_wo32(chan, 0x020c, 0x000000ff);
59
60 /* PGT[0] pointer */
61 nv_wo32(chan, 0x1000, 0x00000000);
62 nv_wo32(chan, 0x1004, 0x00000001 | (chan->addr + 0x2000) >> 8);
63
64 /* identity-map the whole "channel" into its own vm */
65 for (i = 0; i < size / 4096; i++) {
66 u64 addr = ((chan->addr + (i * 4096)) >> 8) | 1;
67 nv_wo32(chan, 0x2000 + (i * 8), lower_32_bits(addr));
68 nv_wo32(chan, 0x2004 + (i * 8), upper_32_bits(addr));
69 }
70
71 /* context pointer (virt) */
72 nv_wo32(chan, 0x0210, 0x00080004);
73 nv_wo32(chan, 0x0214, 0x00000000);
74 876
75 bar->flush(bar); 877 mmio_data(0x002000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
76 878 mmio_data(0x008000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
77 nv_wr32(priv, 0x100cb8, (chan->addr + 0x1000) >> 8); 879 mmio_data(0x060000, 0x1000, NV_MEM_ACCESS_RW);
78 nv_wr32(priv, 0x100cbc, 0x80000001);
79 nv_wait(priv, 0x100c80, 0x00008000, 0x00008000);
80
81 /* setup default state for mmio list construction */
82 info->data = priv->mmio_data;
83 info->mmio = priv->mmio_list;
84 info->addr = 0x2000 + (i * 8);
85 info->priv = priv;
86 info->buffer_nr = 0;
87 880
88 if (priv->firmware) { 881 mmio_list(0x408004, 0x00000000, 8, 0);
89 nv_wr32(priv, 0x409840, 0x00000030); 882 mmio_list(0x408008, 0x80000018, 0, 0);
90 nv_wr32(priv, 0x409500, 0x80000000 | chan->addr >> 12); 883 mmio_list(0x40800c, 0x00000000, 8, 1);
91 nv_wr32(priv, 0x409504, 0x00000003); 884 mmio_list(0x408010, 0x80000000, 0, 0);
92 if (!nv_wait(priv, 0x409800, 0x00000010, 0x00000010)) 885 mmio_list(0x418810, 0x80000000, 12, 2);
93 nv_error(priv, "load_ctx timeout\n"); 886 mmio_list(0x419848, 0x10000000, 12, 2);
887 mmio_list(0x419004, 0x00000000, 8, 1);
888 mmio_list(0x419008, 0x00000000, 0, 0);
889 mmio_list(0x418808, 0x00000000, 8, 0);
890 mmio_list(0x41880c, 0x80000018, 0, 0);
94 891
95 nv_wo32(chan, 0x8001c, 1); 892 mmio_list(0x405830, 0x02180000, 0, 0);
96 nv_wo32(chan, 0x80020, 0);
97 nv_wo32(chan, 0x80028, 0);
98 nv_wo32(chan, 0x8002c, 0);
99 bar->flush(bar);
100 return 0;
101 }
102 893
103 /* HUB_FUC(SET_CHAN) */ 894 for (gpc = 0, offset = 0; gpc < priv->gpc_nr; gpc++) {
104 nv_wr32(priv, 0x409840, 0x80000000); 895 for (tpc = 0; tpc < priv->tpc_nr[gpc]; tpc++) {
105 nv_wr32(priv, 0x409500, 0x80000000 | chan->addr >> 12); 896 u32 addr = TPC_UNIT(gpc, tpc, 0x0520);
106 nv_wr32(priv, 0x409504, 0x00000001); 897 mmio_list(addr, 0x02180000 | offset, 0, 0);
107 if (!nv_wait(priv, 0x409800, 0x80000000, 0x80000000)) { 898 offset += 0x0324;
108 nv_error(priv, "HUB_SET_CHAN timeout\n"); 899 }
109 nvc0_graph_ctxctl_debug(priv);
110 nouveau_gpuobj_ref(NULL, &info->chan);
111 return -EBUSY;
112 } 900 }
113
114 return 0;
115} 901}
116 902
117void 903void
118nvc0_grctx_data(struct nvc0_grctx *info, u32 size, u32 align, u32 access) 904nvc0_grctx_generate_unkn(struct nvc0_graph_priv *priv)
119{ 905{
120 info->buffer[info->buffer_nr] = info->addr;
121 info->buffer[info->buffer_nr] += (align - 1);
122 info->buffer[info->buffer_nr] &= ~(align - 1);
123 info->addr = info->buffer[info->buffer_nr++] + size;
124
125 info->data->size = size;
126 info->data->align = align;
127 info->data->access = access;
128 info->data++;
129} 906}
130 907
131void 908void
132nvc0_grctx_mmio(struct nvc0_grctx *info, u32 addr, u32 data, u32 shift, u32 buf) 909nvc0_grctx_generate_tpcid(struct nvc0_graph_priv *priv)
133{ 910{
134 struct nvc0_graph_priv *priv = info->priv; 911 int gpc, tpc, id;
135
136 info->mmio->addr = addr;
137 info->mmio->data = data;
138 info->mmio->shift = shift;
139 info->mmio->buffer = buf;
140 info->mmio++;
141 912
142 if (shift) 913 for (tpc = 0, id = 0; tpc < 4; tpc++) {
143 data |= info->buffer[buf] >> shift; 914 for (gpc = 0; gpc < priv->gpc_nr; gpc++) {
144 nv_wr32(priv, addr, data); 915 if (tpc < priv->tpc_nr[gpc]) {
145} 916 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x698), id);
146 917 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x4e8), id);
147int 918 nv_wr32(priv, GPC_UNIT(gpc, 0x0c10 + tpc * 4), id);
148nvc0_grctx_fini(struct nvc0_grctx *info) 919 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x088), id);
149{ 920 id++;
150 struct nvc0_graph_priv *priv = info->priv; 921 }
151 int i;
152
153 /* trigger a context unload by unsetting the "next channel valid" bit
154 * and faking a context switch interrupt
155 */
156 nv_mask(priv, 0x409b04, 0x80000000, 0x00000000);
157 nv_wr32(priv, 0x409000, 0x00000100);
158 if (!nv_wait(priv, 0x409b00, 0x80000000, 0x00000000)) {
159 nv_error(priv, "grctx template channel unload timeout\n");
160 return -EBUSY;
161 }
162
163 priv->data = kmalloc(priv->size, GFP_KERNEL);
164 if (priv->data) {
165 for (i = 0; i < priv->size; i += 4)
166 priv->data[i / 4] = nv_ro32(info->chan, 0x80000 + i);
167 }
168
169 nouveau_gpuobj_ref(NULL, &info->chan);
170 return priv->data ? 0 : -ENOMEM;
171}
172 922
173static void 923 nv_wr32(priv, GPC_UNIT(gpc, 0x0c08), priv->tpc_nr[gpc]);
174nvc0_grctx_generate_9097(struct nvc0_graph_priv *priv) 924 nv_wr32(priv, GPC_UNIT(gpc, 0x0c8c), priv->tpc_nr[gpc]);
175{ 925 }
176 u32 fermi = nvc0_graph_class(priv);
177 u32 mthd;
178
179 nv_mthd(priv, 0x9097, 0x0800, 0x00000000);
180 nv_mthd(priv, 0x9097, 0x0840, 0x00000000);
181 nv_mthd(priv, 0x9097, 0x0880, 0x00000000);
182 nv_mthd(priv, 0x9097, 0x08c0, 0x00000000);
183 nv_mthd(priv, 0x9097, 0x0900, 0x00000000);
184 nv_mthd(priv, 0x9097, 0x0940, 0x00000000);
185 nv_mthd(priv, 0x9097, 0x0980, 0x00000000);
186 nv_mthd(priv, 0x9097, 0x09c0, 0x00000000);
187 nv_mthd(priv, 0x9097, 0x0804, 0x00000000);
188 nv_mthd(priv, 0x9097, 0x0844, 0x00000000);
189 nv_mthd(priv, 0x9097, 0x0884, 0x00000000);
190 nv_mthd(priv, 0x9097, 0x08c4, 0x00000000);
191 nv_mthd(priv, 0x9097, 0x0904, 0x00000000);
192 nv_mthd(priv, 0x9097, 0x0944, 0x00000000);
193 nv_mthd(priv, 0x9097, 0x0984, 0x00000000);
194 nv_mthd(priv, 0x9097, 0x09c4, 0x00000000);
195 nv_mthd(priv, 0x9097, 0x0808, 0x00000400);
196 nv_mthd(priv, 0x9097, 0x0848, 0x00000400);
197 nv_mthd(priv, 0x9097, 0x0888, 0x00000400);
198 nv_mthd(priv, 0x9097, 0x08c8, 0x00000400);
199 nv_mthd(priv, 0x9097, 0x0908, 0x00000400);
200 nv_mthd(priv, 0x9097, 0x0948, 0x00000400);
201 nv_mthd(priv, 0x9097, 0x0988, 0x00000400);
202 nv_mthd(priv, 0x9097, 0x09c8, 0x00000400);
203 nv_mthd(priv, 0x9097, 0x080c, 0x00000300);
204 nv_mthd(priv, 0x9097, 0x084c, 0x00000300);
205 nv_mthd(priv, 0x9097, 0x088c, 0x00000300);
206 nv_mthd(priv, 0x9097, 0x08cc, 0x00000300);
207 nv_mthd(priv, 0x9097, 0x090c, 0x00000300);
208 nv_mthd(priv, 0x9097, 0x094c, 0x00000300);
209 nv_mthd(priv, 0x9097, 0x098c, 0x00000300);
210 nv_mthd(priv, 0x9097, 0x09cc, 0x00000300);
211 nv_mthd(priv, 0x9097, 0x0810, 0x000000cf);
212 nv_mthd(priv, 0x9097, 0x0850, 0x00000000);
213 nv_mthd(priv, 0x9097, 0x0890, 0x00000000);
214 nv_mthd(priv, 0x9097, 0x08d0, 0x00000000);
215 nv_mthd(priv, 0x9097, 0x0910, 0x00000000);
216 nv_mthd(priv, 0x9097, 0x0950, 0x00000000);
217 nv_mthd(priv, 0x9097, 0x0990, 0x00000000);
218 nv_mthd(priv, 0x9097, 0x09d0, 0x00000000);
219 nv_mthd(priv, 0x9097, 0x0814, 0x00000040);
220 nv_mthd(priv, 0x9097, 0x0854, 0x00000040);
221 nv_mthd(priv, 0x9097, 0x0894, 0x00000040);
222 nv_mthd(priv, 0x9097, 0x08d4, 0x00000040);
223 nv_mthd(priv, 0x9097, 0x0914, 0x00000040);
224 nv_mthd(priv, 0x9097, 0x0954, 0x00000040);
225 nv_mthd(priv, 0x9097, 0x0994, 0x00000040);
226 nv_mthd(priv, 0x9097, 0x09d4, 0x00000040);
227 nv_mthd(priv, 0x9097, 0x0818, 0x00000001);
228 nv_mthd(priv, 0x9097, 0x0858, 0x00000001);
229 nv_mthd(priv, 0x9097, 0x0898, 0x00000001);
230 nv_mthd(priv, 0x9097, 0x08d8, 0x00000001);
231 nv_mthd(priv, 0x9097, 0x0918, 0x00000001);
232 nv_mthd(priv, 0x9097, 0x0958, 0x00000001);
233 nv_mthd(priv, 0x9097, 0x0998, 0x00000001);
234 nv_mthd(priv, 0x9097, 0x09d8, 0x00000001);
235 nv_mthd(priv, 0x9097, 0x081c, 0x00000000);
236 nv_mthd(priv, 0x9097, 0x085c, 0x00000000);
237 nv_mthd(priv, 0x9097, 0x089c, 0x00000000);
238 nv_mthd(priv, 0x9097, 0x08dc, 0x00000000);
239 nv_mthd(priv, 0x9097, 0x091c, 0x00000000);
240 nv_mthd(priv, 0x9097, 0x095c, 0x00000000);
241 nv_mthd(priv, 0x9097, 0x099c, 0x00000000);
242 nv_mthd(priv, 0x9097, 0x09dc, 0x00000000);
243 nv_mthd(priv, 0x9097, 0x0820, 0x00000000);
244 nv_mthd(priv, 0x9097, 0x0860, 0x00000000);
245 nv_mthd(priv, 0x9097, 0x08a0, 0x00000000);
246 nv_mthd(priv, 0x9097, 0x08e0, 0x00000000);
247 nv_mthd(priv, 0x9097, 0x0920, 0x00000000);
248 nv_mthd(priv, 0x9097, 0x0960, 0x00000000);
249 nv_mthd(priv, 0x9097, 0x09a0, 0x00000000);
250 nv_mthd(priv, 0x9097, 0x09e0, 0x00000000);
251 nv_mthd(priv, 0x9097, 0x2700, 0x00000000);
252 nv_mthd(priv, 0x9097, 0x2720, 0x00000000);
253 nv_mthd(priv, 0x9097, 0x2740, 0x00000000);
254 nv_mthd(priv, 0x9097, 0x2760, 0x00000000);
255 nv_mthd(priv, 0x9097, 0x2780, 0x00000000);
256 nv_mthd(priv, 0x9097, 0x27a0, 0x00000000);
257 nv_mthd(priv, 0x9097, 0x27c0, 0x00000000);
258 nv_mthd(priv, 0x9097, 0x27e0, 0x00000000);
259 nv_mthd(priv, 0x9097, 0x2704, 0x00000000);
260 nv_mthd(priv, 0x9097, 0x2724, 0x00000000);
261 nv_mthd(priv, 0x9097, 0x2744, 0x00000000);
262 nv_mthd(priv, 0x9097, 0x2764, 0x00000000);
263 nv_mthd(priv, 0x9097, 0x2784, 0x00000000);
264 nv_mthd(priv, 0x9097, 0x27a4, 0x00000000);
265 nv_mthd(priv, 0x9097, 0x27c4, 0x00000000);
266 nv_mthd(priv, 0x9097, 0x27e4, 0x00000000);
267 nv_mthd(priv, 0x9097, 0x2708, 0x00000000);
268 nv_mthd(priv, 0x9097, 0x2728, 0x00000000);
269 nv_mthd(priv, 0x9097, 0x2748, 0x00000000);
270 nv_mthd(priv, 0x9097, 0x2768, 0x00000000);
271 nv_mthd(priv, 0x9097, 0x2788, 0x00000000);
272 nv_mthd(priv, 0x9097, 0x27a8, 0x00000000);
273 nv_mthd(priv, 0x9097, 0x27c8, 0x00000000);
274 nv_mthd(priv, 0x9097, 0x27e8, 0x00000000);
275 nv_mthd(priv, 0x9097, 0x270c, 0x00000000);
276 nv_mthd(priv, 0x9097, 0x272c, 0x00000000);
277 nv_mthd(priv, 0x9097, 0x274c, 0x00000000);
278 nv_mthd(priv, 0x9097, 0x276c, 0x00000000);
279 nv_mthd(priv, 0x9097, 0x278c, 0x00000000);
280 nv_mthd(priv, 0x9097, 0x27ac, 0x00000000);
281 nv_mthd(priv, 0x9097, 0x27cc, 0x00000000);
282 nv_mthd(priv, 0x9097, 0x27ec, 0x00000000);
283 nv_mthd(priv, 0x9097, 0x2710, 0x00014000);
284 nv_mthd(priv, 0x9097, 0x2730, 0x00014000);
285 nv_mthd(priv, 0x9097, 0x2750, 0x00014000);
286 nv_mthd(priv, 0x9097, 0x2770, 0x00014000);
287 nv_mthd(priv, 0x9097, 0x2790, 0x00014000);
288 nv_mthd(priv, 0x9097, 0x27b0, 0x00014000);
289 nv_mthd(priv, 0x9097, 0x27d0, 0x00014000);
290 nv_mthd(priv, 0x9097, 0x27f0, 0x00014000);
291 nv_mthd(priv, 0x9097, 0x2714, 0x00000040);
292 nv_mthd(priv, 0x9097, 0x2734, 0x00000040);
293 nv_mthd(priv, 0x9097, 0x2754, 0x00000040);
294 nv_mthd(priv, 0x9097, 0x2774, 0x00000040);
295 nv_mthd(priv, 0x9097, 0x2794, 0x00000040);
296 nv_mthd(priv, 0x9097, 0x27b4, 0x00000040);
297 nv_mthd(priv, 0x9097, 0x27d4, 0x00000040);
298 nv_mthd(priv, 0x9097, 0x27f4, 0x00000040);
299 nv_mthd(priv, 0x9097, 0x1c00, 0x00000000);
300 nv_mthd(priv, 0x9097, 0x1c10, 0x00000000);
301 nv_mthd(priv, 0x9097, 0x1c20, 0x00000000);
302 nv_mthd(priv, 0x9097, 0x1c30, 0x00000000);
303 nv_mthd(priv, 0x9097, 0x1c40, 0x00000000);
304 nv_mthd(priv, 0x9097, 0x1c50, 0x00000000);
305 nv_mthd(priv, 0x9097, 0x1c60, 0x00000000);
306 nv_mthd(priv, 0x9097, 0x1c70, 0x00000000);
307 nv_mthd(priv, 0x9097, 0x1c80, 0x00000000);
308 nv_mthd(priv, 0x9097, 0x1c90, 0x00000000);
309 nv_mthd(priv, 0x9097, 0x1ca0, 0x00000000);
310 nv_mthd(priv, 0x9097, 0x1cb0, 0x00000000);
311 nv_mthd(priv, 0x9097, 0x1cc0, 0x00000000);
312 nv_mthd(priv, 0x9097, 0x1cd0, 0x00000000);
313 nv_mthd(priv, 0x9097, 0x1ce0, 0x00000000);
314 nv_mthd(priv, 0x9097, 0x1cf0, 0x00000000);
315 nv_mthd(priv, 0x9097, 0x1c04, 0x00000000);
316 nv_mthd(priv, 0x9097, 0x1c14, 0x00000000);
317 nv_mthd(priv, 0x9097, 0x1c24, 0x00000000);
318 nv_mthd(priv, 0x9097, 0x1c34, 0x00000000);
319 nv_mthd(priv, 0x9097, 0x1c44, 0x00000000);
320 nv_mthd(priv, 0x9097, 0x1c54, 0x00000000);
321 nv_mthd(priv, 0x9097, 0x1c64, 0x00000000);
322 nv_mthd(priv, 0x9097, 0x1c74, 0x00000000);
323 nv_mthd(priv, 0x9097, 0x1c84, 0x00000000);
324 nv_mthd(priv, 0x9097, 0x1c94, 0x00000000);
325 nv_mthd(priv, 0x9097, 0x1ca4, 0x00000000);
326 nv_mthd(priv, 0x9097, 0x1cb4, 0x00000000);
327 nv_mthd(priv, 0x9097, 0x1cc4, 0x00000000);
328 nv_mthd(priv, 0x9097, 0x1cd4, 0x00000000);
329 nv_mthd(priv, 0x9097, 0x1ce4, 0x00000000);
330 nv_mthd(priv, 0x9097, 0x1cf4, 0x00000000);
331 nv_mthd(priv, 0x9097, 0x1c08, 0x00000000);
332 nv_mthd(priv, 0x9097, 0x1c18, 0x00000000);
333 nv_mthd(priv, 0x9097, 0x1c28, 0x00000000);
334 nv_mthd(priv, 0x9097, 0x1c38, 0x00000000);
335 nv_mthd(priv, 0x9097, 0x1c48, 0x00000000);
336 nv_mthd(priv, 0x9097, 0x1c58, 0x00000000);
337 nv_mthd(priv, 0x9097, 0x1c68, 0x00000000);
338 nv_mthd(priv, 0x9097, 0x1c78, 0x00000000);
339 nv_mthd(priv, 0x9097, 0x1c88, 0x00000000);
340 nv_mthd(priv, 0x9097, 0x1c98, 0x00000000);
341 nv_mthd(priv, 0x9097, 0x1ca8, 0x00000000);
342 nv_mthd(priv, 0x9097, 0x1cb8, 0x00000000);
343 nv_mthd(priv, 0x9097, 0x1cc8, 0x00000000);
344 nv_mthd(priv, 0x9097, 0x1cd8, 0x00000000);
345 nv_mthd(priv, 0x9097, 0x1ce8, 0x00000000);
346 nv_mthd(priv, 0x9097, 0x1cf8, 0x00000000);
347 nv_mthd(priv, 0x9097, 0x1c0c, 0x00000000);
348 nv_mthd(priv, 0x9097, 0x1c1c, 0x00000000);
349 nv_mthd(priv, 0x9097, 0x1c2c, 0x00000000);
350 nv_mthd(priv, 0x9097, 0x1c3c, 0x00000000);
351 nv_mthd(priv, 0x9097, 0x1c4c, 0x00000000);
352 nv_mthd(priv, 0x9097, 0x1c5c, 0x00000000);
353 nv_mthd(priv, 0x9097, 0x1c6c, 0x00000000);
354 nv_mthd(priv, 0x9097, 0x1c7c, 0x00000000);
355 nv_mthd(priv, 0x9097, 0x1c8c, 0x00000000);
356 nv_mthd(priv, 0x9097, 0x1c9c, 0x00000000);
357 nv_mthd(priv, 0x9097, 0x1cac, 0x00000000);
358 nv_mthd(priv, 0x9097, 0x1cbc, 0x00000000);
359 nv_mthd(priv, 0x9097, 0x1ccc, 0x00000000);
360 nv_mthd(priv, 0x9097, 0x1cdc, 0x00000000);
361 nv_mthd(priv, 0x9097, 0x1cec, 0x00000000);
362 nv_mthd(priv, 0x9097, 0x1cfc, 0x00000000);
363 nv_mthd(priv, 0x9097, 0x1d00, 0x00000000);
364 nv_mthd(priv, 0x9097, 0x1d10, 0x00000000);
365 nv_mthd(priv, 0x9097, 0x1d20, 0x00000000);
366 nv_mthd(priv, 0x9097, 0x1d30, 0x00000000);
367 nv_mthd(priv, 0x9097, 0x1d40, 0x00000000);
368 nv_mthd(priv, 0x9097, 0x1d50, 0x00000000);
369 nv_mthd(priv, 0x9097, 0x1d60, 0x00000000);
370 nv_mthd(priv, 0x9097, 0x1d70, 0x00000000);
371 nv_mthd(priv, 0x9097, 0x1d80, 0x00000000);
372 nv_mthd(priv, 0x9097, 0x1d90, 0x00000000);
373 nv_mthd(priv, 0x9097, 0x1da0, 0x00000000);
374 nv_mthd(priv, 0x9097, 0x1db0, 0x00000000);
375 nv_mthd(priv, 0x9097, 0x1dc0, 0x00000000);
376 nv_mthd(priv, 0x9097, 0x1dd0, 0x00000000);
377 nv_mthd(priv, 0x9097, 0x1de0, 0x00000000);
378 nv_mthd(priv, 0x9097, 0x1df0, 0x00000000);
379 nv_mthd(priv, 0x9097, 0x1d04, 0x00000000);
380 nv_mthd(priv, 0x9097, 0x1d14, 0x00000000);
381 nv_mthd(priv, 0x9097, 0x1d24, 0x00000000);
382 nv_mthd(priv, 0x9097, 0x1d34, 0x00000000);
383 nv_mthd(priv, 0x9097, 0x1d44, 0x00000000);
384 nv_mthd(priv, 0x9097, 0x1d54, 0x00000000);
385 nv_mthd(priv, 0x9097, 0x1d64, 0x00000000);
386 nv_mthd(priv, 0x9097, 0x1d74, 0x00000000);
387 nv_mthd(priv, 0x9097, 0x1d84, 0x00000000);
388 nv_mthd(priv, 0x9097, 0x1d94, 0x00000000);
389 nv_mthd(priv, 0x9097, 0x1da4, 0x00000000);
390 nv_mthd(priv, 0x9097, 0x1db4, 0x00000000);
391 nv_mthd(priv, 0x9097, 0x1dc4, 0x00000000);
392 nv_mthd(priv, 0x9097, 0x1dd4, 0x00000000);
393 nv_mthd(priv, 0x9097, 0x1de4, 0x00000000);
394 nv_mthd(priv, 0x9097, 0x1df4, 0x00000000);
395 nv_mthd(priv, 0x9097, 0x1d08, 0x00000000);
396 nv_mthd(priv, 0x9097, 0x1d18, 0x00000000);
397 nv_mthd(priv, 0x9097, 0x1d28, 0x00000000);
398 nv_mthd(priv, 0x9097, 0x1d38, 0x00000000);
399 nv_mthd(priv, 0x9097, 0x1d48, 0x00000000);
400 nv_mthd(priv, 0x9097, 0x1d58, 0x00000000);
401 nv_mthd(priv, 0x9097, 0x1d68, 0x00000000);
402 nv_mthd(priv, 0x9097, 0x1d78, 0x00000000);
403 nv_mthd(priv, 0x9097, 0x1d88, 0x00000000);
404 nv_mthd(priv, 0x9097, 0x1d98, 0x00000000);
405 nv_mthd(priv, 0x9097, 0x1da8, 0x00000000);
406 nv_mthd(priv, 0x9097, 0x1db8, 0x00000000);
407 nv_mthd(priv, 0x9097, 0x1dc8, 0x00000000);
408 nv_mthd(priv, 0x9097, 0x1dd8, 0x00000000);
409 nv_mthd(priv, 0x9097, 0x1de8, 0x00000000);
410 nv_mthd(priv, 0x9097, 0x1df8, 0x00000000);
411 nv_mthd(priv, 0x9097, 0x1d0c, 0x00000000);
412 nv_mthd(priv, 0x9097, 0x1d1c, 0x00000000);
413 nv_mthd(priv, 0x9097, 0x1d2c, 0x00000000);
414 nv_mthd(priv, 0x9097, 0x1d3c, 0x00000000);
415 nv_mthd(priv, 0x9097, 0x1d4c, 0x00000000);
416 nv_mthd(priv, 0x9097, 0x1d5c, 0x00000000);
417 nv_mthd(priv, 0x9097, 0x1d6c, 0x00000000);
418 nv_mthd(priv, 0x9097, 0x1d7c, 0x00000000);
419 nv_mthd(priv, 0x9097, 0x1d8c, 0x00000000);
420 nv_mthd(priv, 0x9097, 0x1d9c, 0x00000000);
421 nv_mthd(priv, 0x9097, 0x1dac, 0x00000000);
422 nv_mthd(priv, 0x9097, 0x1dbc, 0x00000000);
423 nv_mthd(priv, 0x9097, 0x1dcc, 0x00000000);
424 nv_mthd(priv, 0x9097, 0x1ddc, 0x00000000);
425 nv_mthd(priv, 0x9097, 0x1dec, 0x00000000);
426 nv_mthd(priv, 0x9097, 0x1dfc, 0x00000000);
427 nv_mthd(priv, 0x9097, 0x1f00, 0x00000000);
428 nv_mthd(priv, 0x9097, 0x1f08, 0x00000000);
429 nv_mthd(priv, 0x9097, 0x1f10, 0x00000000);
430 nv_mthd(priv, 0x9097, 0x1f18, 0x00000000);
431 nv_mthd(priv, 0x9097, 0x1f20, 0x00000000);
432 nv_mthd(priv, 0x9097, 0x1f28, 0x00000000);
433 nv_mthd(priv, 0x9097, 0x1f30, 0x00000000);
434 nv_mthd(priv, 0x9097, 0x1f38, 0x00000000);
435 nv_mthd(priv, 0x9097, 0x1f40, 0x00000000);
436 nv_mthd(priv, 0x9097, 0x1f48, 0x00000000);
437 nv_mthd(priv, 0x9097, 0x1f50, 0x00000000);
438 nv_mthd(priv, 0x9097, 0x1f58, 0x00000000);
439 nv_mthd(priv, 0x9097, 0x1f60, 0x00000000);
440 nv_mthd(priv, 0x9097, 0x1f68, 0x00000000);
441 nv_mthd(priv, 0x9097, 0x1f70, 0x00000000);
442 nv_mthd(priv, 0x9097, 0x1f78, 0x00000000);
443 nv_mthd(priv, 0x9097, 0x1f04, 0x00000000);
444 nv_mthd(priv, 0x9097, 0x1f0c, 0x00000000);
445 nv_mthd(priv, 0x9097, 0x1f14, 0x00000000);
446 nv_mthd(priv, 0x9097, 0x1f1c, 0x00000000);
447 nv_mthd(priv, 0x9097, 0x1f24, 0x00000000);
448 nv_mthd(priv, 0x9097, 0x1f2c, 0x00000000);
449 nv_mthd(priv, 0x9097, 0x1f34, 0x00000000);
450 nv_mthd(priv, 0x9097, 0x1f3c, 0x00000000);
451 nv_mthd(priv, 0x9097, 0x1f44, 0x00000000);
452 nv_mthd(priv, 0x9097, 0x1f4c, 0x00000000);
453 nv_mthd(priv, 0x9097, 0x1f54, 0x00000000);
454 nv_mthd(priv, 0x9097, 0x1f5c, 0x00000000);
455 nv_mthd(priv, 0x9097, 0x1f64, 0x00000000);
456 nv_mthd(priv, 0x9097, 0x1f6c, 0x00000000);
457 nv_mthd(priv, 0x9097, 0x1f74, 0x00000000);
458 nv_mthd(priv, 0x9097, 0x1f7c, 0x00000000);
459 nv_mthd(priv, 0x9097, 0x1f80, 0x00000000);
460 nv_mthd(priv, 0x9097, 0x1f88, 0x00000000);
461 nv_mthd(priv, 0x9097, 0x1f90, 0x00000000);
462 nv_mthd(priv, 0x9097, 0x1f98, 0x00000000);
463 nv_mthd(priv, 0x9097, 0x1fa0, 0x00000000);
464 nv_mthd(priv, 0x9097, 0x1fa8, 0x00000000);
465 nv_mthd(priv, 0x9097, 0x1fb0, 0x00000000);
466 nv_mthd(priv, 0x9097, 0x1fb8, 0x00000000);
467 nv_mthd(priv, 0x9097, 0x1fc0, 0x00000000);
468 nv_mthd(priv, 0x9097, 0x1fc8, 0x00000000);
469 nv_mthd(priv, 0x9097, 0x1fd0, 0x00000000);
470 nv_mthd(priv, 0x9097, 0x1fd8, 0x00000000);
471 nv_mthd(priv, 0x9097, 0x1fe0, 0x00000000);
472 nv_mthd(priv, 0x9097, 0x1fe8, 0x00000000);
473 nv_mthd(priv, 0x9097, 0x1ff0, 0x00000000);
474 nv_mthd(priv, 0x9097, 0x1ff8, 0x00000000);
475 nv_mthd(priv, 0x9097, 0x1f84, 0x00000000);
476 nv_mthd(priv, 0x9097, 0x1f8c, 0x00000000);
477 nv_mthd(priv, 0x9097, 0x1f94, 0x00000000);
478 nv_mthd(priv, 0x9097, 0x1f9c, 0x00000000);
479 nv_mthd(priv, 0x9097, 0x1fa4, 0x00000000);
480 nv_mthd(priv, 0x9097, 0x1fac, 0x00000000);
481 nv_mthd(priv, 0x9097, 0x1fb4, 0x00000000);
482 nv_mthd(priv, 0x9097, 0x1fbc, 0x00000000);
483 nv_mthd(priv, 0x9097, 0x1fc4, 0x00000000);
484 nv_mthd(priv, 0x9097, 0x1fcc, 0x00000000);
485 nv_mthd(priv, 0x9097, 0x1fd4, 0x00000000);
486 nv_mthd(priv, 0x9097, 0x1fdc, 0x00000000);
487 nv_mthd(priv, 0x9097, 0x1fe4, 0x00000000);
488 nv_mthd(priv, 0x9097, 0x1fec, 0x00000000);
489 nv_mthd(priv, 0x9097, 0x1ff4, 0x00000000);
490 nv_mthd(priv, 0x9097, 0x1ffc, 0x00000000);
491 nv_mthd(priv, 0x9097, 0x2200, 0x00000022);
492 nv_mthd(priv, 0x9097, 0x2210, 0x00000022);
493 nv_mthd(priv, 0x9097, 0x2220, 0x00000022);
494 nv_mthd(priv, 0x9097, 0x2230, 0x00000022);
495 nv_mthd(priv, 0x9097, 0x2240, 0x00000022);
496 nv_mthd(priv, 0x9097, 0x2000, 0x00000000);
497 nv_mthd(priv, 0x9097, 0x2040, 0x00000011);
498 nv_mthd(priv, 0x9097, 0x2080, 0x00000020);
499 nv_mthd(priv, 0x9097, 0x20c0, 0x00000030);
500 nv_mthd(priv, 0x9097, 0x2100, 0x00000040);
501 nv_mthd(priv, 0x9097, 0x2140, 0x00000051);
502 nv_mthd(priv, 0x9097, 0x200c, 0x00000001);
503 nv_mthd(priv, 0x9097, 0x204c, 0x00000001);
504 nv_mthd(priv, 0x9097, 0x208c, 0x00000001);
505 nv_mthd(priv, 0x9097, 0x20cc, 0x00000001);
506 nv_mthd(priv, 0x9097, 0x210c, 0x00000001);
507 nv_mthd(priv, 0x9097, 0x214c, 0x00000001);
508 nv_mthd(priv, 0x9097, 0x2010, 0x00000000);
509 nv_mthd(priv, 0x9097, 0x2050, 0x00000000);
510 nv_mthd(priv, 0x9097, 0x2090, 0x00000001);
511 nv_mthd(priv, 0x9097, 0x20d0, 0x00000002);
512 nv_mthd(priv, 0x9097, 0x2110, 0x00000003);
513 nv_mthd(priv, 0x9097, 0x2150, 0x00000004);
514 nv_mthd(priv, 0x9097, 0x0380, 0x00000000);
515 nv_mthd(priv, 0x9097, 0x03a0, 0x00000000);
516 nv_mthd(priv, 0x9097, 0x03c0, 0x00000000);
517 nv_mthd(priv, 0x9097, 0x03e0, 0x00000000);
518 nv_mthd(priv, 0x9097, 0x0384, 0x00000000);
519 nv_mthd(priv, 0x9097, 0x03a4, 0x00000000);
520 nv_mthd(priv, 0x9097, 0x03c4, 0x00000000);
521 nv_mthd(priv, 0x9097, 0x03e4, 0x00000000);
522 nv_mthd(priv, 0x9097, 0x0388, 0x00000000);
523 nv_mthd(priv, 0x9097, 0x03a8, 0x00000000);
524 nv_mthd(priv, 0x9097, 0x03c8, 0x00000000);
525 nv_mthd(priv, 0x9097, 0x03e8, 0x00000000);
526 nv_mthd(priv, 0x9097, 0x038c, 0x00000000);
527 nv_mthd(priv, 0x9097, 0x03ac, 0x00000000);
528 nv_mthd(priv, 0x9097, 0x03cc, 0x00000000);
529 nv_mthd(priv, 0x9097, 0x03ec, 0x00000000);
530 nv_mthd(priv, 0x9097, 0x0700, 0x00000000);
531 nv_mthd(priv, 0x9097, 0x0710, 0x00000000);
532 nv_mthd(priv, 0x9097, 0x0720, 0x00000000);
533 nv_mthd(priv, 0x9097, 0x0730, 0x00000000);
534 nv_mthd(priv, 0x9097, 0x0704, 0x00000000);
535 nv_mthd(priv, 0x9097, 0x0714, 0x00000000);
536 nv_mthd(priv, 0x9097, 0x0724, 0x00000000);
537 nv_mthd(priv, 0x9097, 0x0734, 0x00000000);
538 nv_mthd(priv, 0x9097, 0x0708, 0x00000000);
539 nv_mthd(priv, 0x9097, 0x0718, 0x00000000);
540 nv_mthd(priv, 0x9097, 0x0728, 0x00000000);
541 nv_mthd(priv, 0x9097, 0x0738, 0x00000000);
542 nv_mthd(priv, 0x9097, 0x2800, 0x00000000);
543 nv_mthd(priv, 0x9097, 0x2804, 0x00000000);
544 nv_mthd(priv, 0x9097, 0x2808, 0x00000000);
545 nv_mthd(priv, 0x9097, 0x280c, 0x00000000);
546 nv_mthd(priv, 0x9097, 0x2810, 0x00000000);
547 nv_mthd(priv, 0x9097, 0x2814, 0x00000000);
548 nv_mthd(priv, 0x9097, 0x2818, 0x00000000);
549 nv_mthd(priv, 0x9097, 0x281c, 0x00000000);
550 nv_mthd(priv, 0x9097, 0x2820, 0x00000000);
551 nv_mthd(priv, 0x9097, 0x2824, 0x00000000);
552 nv_mthd(priv, 0x9097, 0x2828, 0x00000000);
553 nv_mthd(priv, 0x9097, 0x282c, 0x00000000);
554 nv_mthd(priv, 0x9097, 0x2830, 0x00000000);
555 nv_mthd(priv, 0x9097, 0x2834, 0x00000000);
556 nv_mthd(priv, 0x9097, 0x2838, 0x00000000);
557 nv_mthd(priv, 0x9097, 0x283c, 0x00000000);
558 nv_mthd(priv, 0x9097, 0x2840, 0x00000000);
559 nv_mthd(priv, 0x9097, 0x2844, 0x00000000);
560 nv_mthd(priv, 0x9097, 0x2848, 0x00000000);
561 nv_mthd(priv, 0x9097, 0x284c, 0x00000000);
562 nv_mthd(priv, 0x9097, 0x2850, 0x00000000);
563 nv_mthd(priv, 0x9097, 0x2854, 0x00000000);
564 nv_mthd(priv, 0x9097, 0x2858, 0x00000000);
565 nv_mthd(priv, 0x9097, 0x285c, 0x00000000);
566 nv_mthd(priv, 0x9097, 0x2860, 0x00000000);
567 nv_mthd(priv, 0x9097, 0x2864, 0x00000000);
568 nv_mthd(priv, 0x9097, 0x2868, 0x00000000);
569 nv_mthd(priv, 0x9097, 0x286c, 0x00000000);
570 nv_mthd(priv, 0x9097, 0x2870, 0x00000000);
571 nv_mthd(priv, 0x9097, 0x2874, 0x00000000);
572 nv_mthd(priv, 0x9097, 0x2878, 0x00000000);
573 nv_mthd(priv, 0x9097, 0x287c, 0x00000000);
574 nv_mthd(priv, 0x9097, 0x2880, 0x00000000);
575 nv_mthd(priv, 0x9097, 0x2884, 0x00000000);
576 nv_mthd(priv, 0x9097, 0x2888, 0x00000000);
577 nv_mthd(priv, 0x9097, 0x288c, 0x00000000);
578 nv_mthd(priv, 0x9097, 0x2890, 0x00000000);
579 nv_mthd(priv, 0x9097, 0x2894, 0x00000000);
580 nv_mthd(priv, 0x9097, 0x2898, 0x00000000);
581 nv_mthd(priv, 0x9097, 0x289c, 0x00000000);
582 nv_mthd(priv, 0x9097, 0x28a0, 0x00000000);
583 nv_mthd(priv, 0x9097, 0x28a4, 0x00000000);
584 nv_mthd(priv, 0x9097, 0x28a8, 0x00000000);
585 nv_mthd(priv, 0x9097, 0x28ac, 0x00000000);
586 nv_mthd(priv, 0x9097, 0x28b0, 0x00000000);
587 nv_mthd(priv, 0x9097, 0x28b4, 0x00000000);
588 nv_mthd(priv, 0x9097, 0x28b8, 0x00000000);
589 nv_mthd(priv, 0x9097, 0x28bc, 0x00000000);
590 nv_mthd(priv, 0x9097, 0x28c0, 0x00000000);
591 nv_mthd(priv, 0x9097, 0x28c4, 0x00000000);
592 nv_mthd(priv, 0x9097, 0x28c8, 0x00000000);
593 nv_mthd(priv, 0x9097, 0x28cc, 0x00000000);
594 nv_mthd(priv, 0x9097, 0x28d0, 0x00000000);
595 nv_mthd(priv, 0x9097, 0x28d4, 0x00000000);
596 nv_mthd(priv, 0x9097, 0x28d8, 0x00000000);
597 nv_mthd(priv, 0x9097, 0x28dc, 0x00000000);
598 nv_mthd(priv, 0x9097, 0x28e0, 0x00000000);
599 nv_mthd(priv, 0x9097, 0x28e4, 0x00000000);
600 nv_mthd(priv, 0x9097, 0x28e8, 0x00000000);
601 nv_mthd(priv, 0x9097, 0x28ec, 0x00000000);
602 nv_mthd(priv, 0x9097, 0x28f0, 0x00000000);
603 nv_mthd(priv, 0x9097, 0x28f4, 0x00000000);
604 nv_mthd(priv, 0x9097, 0x28f8, 0x00000000);
605 nv_mthd(priv, 0x9097, 0x28fc, 0x00000000);
606 nv_mthd(priv, 0x9097, 0x2900, 0x00000000);
607 nv_mthd(priv, 0x9097, 0x2904, 0x00000000);
608 nv_mthd(priv, 0x9097, 0x2908, 0x00000000);
609 nv_mthd(priv, 0x9097, 0x290c, 0x00000000);
610 nv_mthd(priv, 0x9097, 0x2910, 0x00000000);
611 nv_mthd(priv, 0x9097, 0x2914, 0x00000000);
612 nv_mthd(priv, 0x9097, 0x2918, 0x00000000);
613 nv_mthd(priv, 0x9097, 0x291c, 0x00000000);
614 nv_mthd(priv, 0x9097, 0x2920, 0x00000000);
615 nv_mthd(priv, 0x9097, 0x2924, 0x00000000);
616 nv_mthd(priv, 0x9097, 0x2928, 0x00000000);
617 nv_mthd(priv, 0x9097, 0x292c, 0x00000000);
618 nv_mthd(priv, 0x9097, 0x2930, 0x00000000);
619 nv_mthd(priv, 0x9097, 0x2934, 0x00000000);
620 nv_mthd(priv, 0x9097, 0x2938, 0x00000000);
621 nv_mthd(priv, 0x9097, 0x293c, 0x00000000);
622 nv_mthd(priv, 0x9097, 0x2940, 0x00000000);
623 nv_mthd(priv, 0x9097, 0x2944, 0x00000000);
624 nv_mthd(priv, 0x9097, 0x2948, 0x00000000);
625 nv_mthd(priv, 0x9097, 0x294c, 0x00000000);
626 nv_mthd(priv, 0x9097, 0x2950, 0x00000000);
627 nv_mthd(priv, 0x9097, 0x2954, 0x00000000);
628 nv_mthd(priv, 0x9097, 0x2958, 0x00000000);
629 nv_mthd(priv, 0x9097, 0x295c, 0x00000000);
630 nv_mthd(priv, 0x9097, 0x2960, 0x00000000);
631 nv_mthd(priv, 0x9097, 0x2964, 0x00000000);
632 nv_mthd(priv, 0x9097, 0x2968, 0x00000000);
633 nv_mthd(priv, 0x9097, 0x296c, 0x00000000);
634 nv_mthd(priv, 0x9097, 0x2970, 0x00000000);
635 nv_mthd(priv, 0x9097, 0x2974, 0x00000000);
636 nv_mthd(priv, 0x9097, 0x2978, 0x00000000);
637 nv_mthd(priv, 0x9097, 0x297c, 0x00000000);
638 nv_mthd(priv, 0x9097, 0x2980, 0x00000000);
639 nv_mthd(priv, 0x9097, 0x2984, 0x00000000);
640 nv_mthd(priv, 0x9097, 0x2988, 0x00000000);
641 nv_mthd(priv, 0x9097, 0x298c, 0x00000000);
642 nv_mthd(priv, 0x9097, 0x2990, 0x00000000);
643 nv_mthd(priv, 0x9097, 0x2994, 0x00000000);
644 nv_mthd(priv, 0x9097, 0x2998, 0x00000000);
645 nv_mthd(priv, 0x9097, 0x299c, 0x00000000);
646 nv_mthd(priv, 0x9097, 0x29a0, 0x00000000);
647 nv_mthd(priv, 0x9097, 0x29a4, 0x00000000);
648 nv_mthd(priv, 0x9097, 0x29a8, 0x00000000);
649 nv_mthd(priv, 0x9097, 0x29ac, 0x00000000);
650 nv_mthd(priv, 0x9097, 0x29b0, 0x00000000);
651 nv_mthd(priv, 0x9097, 0x29b4, 0x00000000);
652 nv_mthd(priv, 0x9097, 0x29b8, 0x00000000);
653 nv_mthd(priv, 0x9097, 0x29bc, 0x00000000);
654 nv_mthd(priv, 0x9097, 0x29c0, 0x00000000);
655 nv_mthd(priv, 0x9097, 0x29c4, 0x00000000);
656 nv_mthd(priv, 0x9097, 0x29c8, 0x00000000);
657 nv_mthd(priv, 0x9097, 0x29cc, 0x00000000);
658 nv_mthd(priv, 0x9097, 0x29d0, 0x00000000);
659 nv_mthd(priv, 0x9097, 0x29d4, 0x00000000);
660 nv_mthd(priv, 0x9097, 0x29d8, 0x00000000);
661 nv_mthd(priv, 0x9097, 0x29dc, 0x00000000);
662 nv_mthd(priv, 0x9097, 0x29e0, 0x00000000);
663 nv_mthd(priv, 0x9097, 0x29e4, 0x00000000);
664 nv_mthd(priv, 0x9097, 0x29e8, 0x00000000);
665 nv_mthd(priv, 0x9097, 0x29ec, 0x00000000);
666 nv_mthd(priv, 0x9097, 0x29f0, 0x00000000);
667 nv_mthd(priv, 0x9097, 0x29f4, 0x00000000);
668 nv_mthd(priv, 0x9097, 0x29f8, 0x00000000);
669 nv_mthd(priv, 0x9097, 0x29fc, 0x00000000);
670 nv_mthd(priv, 0x9097, 0x0a00, 0x00000000);
671 nv_mthd(priv, 0x9097, 0x0a20, 0x00000000);
672 nv_mthd(priv, 0x9097, 0x0a40, 0x00000000);
673 nv_mthd(priv, 0x9097, 0x0a60, 0x00000000);
674 nv_mthd(priv, 0x9097, 0x0a80, 0x00000000);
675 nv_mthd(priv, 0x9097, 0x0aa0, 0x00000000);
676 nv_mthd(priv, 0x9097, 0x0ac0, 0x00000000);
677 nv_mthd(priv, 0x9097, 0x0ae0, 0x00000000);
678 nv_mthd(priv, 0x9097, 0x0b00, 0x00000000);
679 nv_mthd(priv, 0x9097, 0x0b20, 0x00000000);
680 nv_mthd(priv, 0x9097, 0x0b40, 0x00000000);
681 nv_mthd(priv, 0x9097, 0x0b60, 0x00000000);
682 nv_mthd(priv, 0x9097, 0x0b80, 0x00000000);
683 nv_mthd(priv, 0x9097, 0x0ba0, 0x00000000);
684 nv_mthd(priv, 0x9097, 0x0bc0, 0x00000000);
685 nv_mthd(priv, 0x9097, 0x0be0, 0x00000000);
686 nv_mthd(priv, 0x9097, 0x0a04, 0x00000000);
687 nv_mthd(priv, 0x9097, 0x0a24, 0x00000000);
688 nv_mthd(priv, 0x9097, 0x0a44, 0x00000000);
689 nv_mthd(priv, 0x9097, 0x0a64, 0x00000000);
690 nv_mthd(priv, 0x9097, 0x0a84, 0x00000000);
691 nv_mthd(priv, 0x9097, 0x0aa4, 0x00000000);
692 nv_mthd(priv, 0x9097, 0x0ac4, 0x00000000);
693 nv_mthd(priv, 0x9097, 0x0ae4, 0x00000000);
694 nv_mthd(priv, 0x9097, 0x0b04, 0x00000000);
695 nv_mthd(priv, 0x9097, 0x0b24, 0x00000000);
696 nv_mthd(priv, 0x9097, 0x0b44, 0x00000000);
697 nv_mthd(priv, 0x9097, 0x0b64, 0x00000000);
698 nv_mthd(priv, 0x9097, 0x0b84, 0x00000000);
699 nv_mthd(priv, 0x9097, 0x0ba4, 0x00000000);
700 nv_mthd(priv, 0x9097, 0x0bc4, 0x00000000);
701 nv_mthd(priv, 0x9097, 0x0be4, 0x00000000);
702 nv_mthd(priv, 0x9097, 0x0a08, 0x00000000);
703 nv_mthd(priv, 0x9097, 0x0a28, 0x00000000);
704 nv_mthd(priv, 0x9097, 0x0a48, 0x00000000);
705 nv_mthd(priv, 0x9097, 0x0a68, 0x00000000);
706 nv_mthd(priv, 0x9097, 0x0a88, 0x00000000);
707 nv_mthd(priv, 0x9097, 0x0aa8, 0x00000000);
708 nv_mthd(priv, 0x9097, 0x0ac8, 0x00000000);
709 nv_mthd(priv, 0x9097, 0x0ae8, 0x00000000);
710 nv_mthd(priv, 0x9097, 0x0b08, 0x00000000);
711 nv_mthd(priv, 0x9097, 0x0b28, 0x00000000);
712 nv_mthd(priv, 0x9097, 0x0b48, 0x00000000);
713 nv_mthd(priv, 0x9097, 0x0b68, 0x00000000);
714 nv_mthd(priv, 0x9097, 0x0b88, 0x00000000);
715 nv_mthd(priv, 0x9097, 0x0ba8, 0x00000000);
716 nv_mthd(priv, 0x9097, 0x0bc8, 0x00000000);
717 nv_mthd(priv, 0x9097, 0x0be8, 0x00000000);
718 nv_mthd(priv, 0x9097, 0x0a0c, 0x00000000);
719 nv_mthd(priv, 0x9097, 0x0a2c, 0x00000000);
720 nv_mthd(priv, 0x9097, 0x0a4c, 0x00000000);
721 nv_mthd(priv, 0x9097, 0x0a6c, 0x00000000);
722 nv_mthd(priv, 0x9097, 0x0a8c, 0x00000000);
723 nv_mthd(priv, 0x9097, 0x0aac, 0x00000000);
724 nv_mthd(priv, 0x9097, 0x0acc, 0x00000000);
725 nv_mthd(priv, 0x9097, 0x0aec, 0x00000000);
726 nv_mthd(priv, 0x9097, 0x0b0c, 0x00000000);
727 nv_mthd(priv, 0x9097, 0x0b2c, 0x00000000);
728 nv_mthd(priv, 0x9097, 0x0b4c, 0x00000000);
729 nv_mthd(priv, 0x9097, 0x0b6c, 0x00000000);
730 nv_mthd(priv, 0x9097, 0x0b8c, 0x00000000);
731 nv_mthd(priv, 0x9097, 0x0bac, 0x00000000);
732 nv_mthd(priv, 0x9097, 0x0bcc, 0x00000000);
733 nv_mthd(priv, 0x9097, 0x0bec, 0x00000000);
734 nv_mthd(priv, 0x9097, 0x0a10, 0x00000000);
735 nv_mthd(priv, 0x9097, 0x0a30, 0x00000000);
736 nv_mthd(priv, 0x9097, 0x0a50, 0x00000000);
737 nv_mthd(priv, 0x9097, 0x0a70, 0x00000000);
738 nv_mthd(priv, 0x9097, 0x0a90, 0x00000000);
739 nv_mthd(priv, 0x9097, 0x0ab0, 0x00000000);
740 nv_mthd(priv, 0x9097, 0x0ad0, 0x00000000);
741 nv_mthd(priv, 0x9097, 0x0af0, 0x00000000);
742 nv_mthd(priv, 0x9097, 0x0b10, 0x00000000);
743 nv_mthd(priv, 0x9097, 0x0b30, 0x00000000);
744 nv_mthd(priv, 0x9097, 0x0b50, 0x00000000);
745 nv_mthd(priv, 0x9097, 0x0b70, 0x00000000);
746 nv_mthd(priv, 0x9097, 0x0b90, 0x00000000);
747 nv_mthd(priv, 0x9097, 0x0bb0, 0x00000000);
748 nv_mthd(priv, 0x9097, 0x0bd0, 0x00000000);
749 nv_mthd(priv, 0x9097, 0x0bf0, 0x00000000);
750 nv_mthd(priv, 0x9097, 0x0a14, 0x00000000);
751 nv_mthd(priv, 0x9097, 0x0a34, 0x00000000);
752 nv_mthd(priv, 0x9097, 0x0a54, 0x00000000);
753 nv_mthd(priv, 0x9097, 0x0a74, 0x00000000);
754 nv_mthd(priv, 0x9097, 0x0a94, 0x00000000);
755 nv_mthd(priv, 0x9097, 0x0ab4, 0x00000000);
756 nv_mthd(priv, 0x9097, 0x0ad4, 0x00000000);
757 nv_mthd(priv, 0x9097, 0x0af4, 0x00000000);
758 nv_mthd(priv, 0x9097, 0x0b14, 0x00000000);
759 nv_mthd(priv, 0x9097, 0x0b34, 0x00000000);
760 nv_mthd(priv, 0x9097, 0x0b54, 0x00000000);
761 nv_mthd(priv, 0x9097, 0x0b74, 0x00000000);
762 nv_mthd(priv, 0x9097, 0x0b94, 0x00000000);
763 nv_mthd(priv, 0x9097, 0x0bb4, 0x00000000);
764 nv_mthd(priv, 0x9097, 0x0bd4, 0x00000000);
765 nv_mthd(priv, 0x9097, 0x0bf4, 0x00000000);
766 nv_mthd(priv, 0x9097, 0x0c00, 0x00000000);
767 nv_mthd(priv, 0x9097, 0x0c10, 0x00000000);
768 nv_mthd(priv, 0x9097, 0x0c20, 0x00000000);
769 nv_mthd(priv, 0x9097, 0x0c30, 0x00000000);
770 nv_mthd(priv, 0x9097, 0x0c40, 0x00000000);
771 nv_mthd(priv, 0x9097, 0x0c50, 0x00000000);
772 nv_mthd(priv, 0x9097, 0x0c60, 0x00000000);
773 nv_mthd(priv, 0x9097, 0x0c70, 0x00000000);
774 nv_mthd(priv, 0x9097, 0x0c80, 0x00000000);
775 nv_mthd(priv, 0x9097, 0x0c90, 0x00000000);
776 nv_mthd(priv, 0x9097, 0x0ca0, 0x00000000);
777 nv_mthd(priv, 0x9097, 0x0cb0, 0x00000000);
778 nv_mthd(priv, 0x9097, 0x0cc0, 0x00000000);
779 nv_mthd(priv, 0x9097, 0x0cd0, 0x00000000);
780 nv_mthd(priv, 0x9097, 0x0ce0, 0x00000000);
781 nv_mthd(priv, 0x9097, 0x0cf0, 0x00000000);
782 nv_mthd(priv, 0x9097, 0x0c04, 0x00000000);
783 nv_mthd(priv, 0x9097, 0x0c14, 0x00000000);
784 nv_mthd(priv, 0x9097, 0x0c24, 0x00000000);
785 nv_mthd(priv, 0x9097, 0x0c34, 0x00000000);
786 nv_mthd(priv, 0x9097, 0x0c44, 0x00000000);
787 nv_mthd(priv, 0x9097, 0x0c54, 0x00000000);
788 nv_mthd(priv, 0x9097, 0x0c64, 0x00000000);
789 nv_mthd(priv, 0x9097, 0x0c74, 0x00000000);
790 nv_mthd(priv, 0x9097, 0x0c84, 0x00000000);
791 nv_mthd(priv, 0x9097, 0x0c94, 0x00000000);
792 nv_mthd(priv, 0x9097, 0x0ca4, 0x00000000);
793 nv_mthd(priv, 0x9097, 0x0cb4, 0x00000000);
794 nv_mthd(priv, 0x9097, 0x0cc4, 0x00000000);
795 nv_mthd(priv, 0x9097, 0x0cd4, 0x00000000);
796 nv_mthd(priv, 0x9097, 0x0ce4, 0x00000000);
797 nv_mthd(priv, 0x9097, 0x0cf4, 0x00000000);
798 nv_mthd(priv, 0x9097, 0x0c08, 0x00000000);
799 nv_mthd(priv, 0x9097, 0x0c18, 0x00000000);
800 nv_mthd(priv, 0x9097, 0x0c28, 0x00000000);
801 nv_mthd(priv, 0x9097, 0x0c38, 0x00000000);
802 nv_mthd(priv, 0x9097, 0x0c48, 0x00000000);
803 nv_mthd(priv, 0x9097, 0x0c58, 0x00000000);
804 nv_mthd(priv, 0x9097, 0x0c68, 0x00000000);
805 nv_mthd(priv, 0x9097, 0x0c78, 0x00000000);
806 nv_mthd(priv, 0x9097, 0x0c88, 0x00000000);
807 nv_mthd(priv, 0x9097, 0x0c98, 0x00000000);
808 nv_mthd(priv, 0x9097, 0x0ca8, 0x00000000);
809 nv_mthd(priv, 0x9097, 0x0cb8, 0x00000000);
810 nv_mthd(priv, 0x9097, 0x0cc8, 0x00000000);
811 nv_mthd(priv, 0x9097, 0x0cd8, 0x00000000);
812 nv_mthd(priv, 0x9097, 0x0ce8, 0x00000000);
813 nv_mthd(priv, 0x9097, 0x0cf8, 0x00000000);
814 nv_mthd(priv, 0x9097, 0x0c0c, 0x3f800000);
815 nv_mthd(priv, 0x9097, 0x0c1c, 0x3f800000);
816 nv_mthd(priv, 0x9097, 0x0c2c, 0x3f800000);
817 nv_mthd(priv, 0x9097, 0x0c3c, 0x3f800000);
818 nv_mthd(priv, 0x9097, 0x0c4c, 0x3f800000);
819 nv_mthd(priv, 0x9097, 0x0c5c, 0x3f800000);
820 nv_mthd(priv, 0x9097, 0x0c6c, 0x3f800000);
821 nv_mthd(priv, 0x9097, 0x0c7c, 0x3f800000);
822 nv_mthd(priv, 0x9097, 0x0c8c, 0x3f800000);
823 nv_mthd(priv, 0x9097, 0x0c9c, 0x3f800000);
824 nv_mthd(priv, 0x9097, 0x0cac, 0x3f800000);
825 nv_mthd(priv, 0x9097, 0x0cbc, 0x3f800000);
826 nv_mthd(priv, 0x9097, 0x0ccc, 0x3f800000);
827 nv_mthd(priv, 0x9097, 0x0cdc, 0x3f800000);
828 nv_mthd(priv, 0x9097, 0x0cec, 0x3f800000);
829 nv_mthd(priv, 0x9097, 0x0cfc, 0x3f800000);
830 nv_mthd(priv, 0x9097, 0x0d00, 0xffff0000);
831 nv_mthd(priv, 0x9097, 0x0d08, 0xffff0000);
832 nv_mthd(priv, 0x9097, 0x0d10, 0xffff0000);
833 nv_mthd(priv, 0x9097, 0x0d18, 0xffff0000);
834 nv_mthd(priv, 0x9097, 0x0d20, 0xffff0000);
835 nv_mthd(priv, 0x9097, 0x0d28, 0xffff0000);
836 nv_mthd(priv, 0x9097, 0x0d30, 0xffff0000);
837 nv_mthd(priv, 0x9097, 0x0d38, 0xffff0000);
838 nv_mthd(priv, 0x9097, 0x0d04, 0xffff0000);
839 nv_mthd(priv, 0x9097, 0x0d0c, 0xffff0000);
840 nv_mthd(priv, 0x9097, 0x0d14, 0xffff0000);
841 nv_mthd(priv, 0x9097, 0x0d1c, 0xffff0000);
842 nv_mthd(priv, 0x9097, 0x0d24, 0xffff0000);
843 nv_mthd(priv, 0x9097, 0x0d2c, 0xffff0000);
844 nv_mthd(priv, 0x9097, 0x0d34, 0xffff0000);
845 nv_mthd(priv, 0x9097, 0x0d3c, 0xffff0000);
846 nv_mthd(priv, 0x9097, 0x0e00, 0x00000000);
847 nv_mthd(priv, 0x9097, 0x0e10, 0x00000000);
848 nv_mthd(priv, 0x9097, 0x0e20, 0x00000000);
849 nv_mthd(priv, 0x9097, 0x0e30, 0x00000000);
850 nv_mthd(priv, 0x9097, 0x0e40, 0x00000000);
851 nv_mthd(priv, 0x9097, 0x0e50, 0x00000000);
852 nv_mthd(priv, 0x9097, 0x0e60, 0x00000000);
853 nv_mthd(priv, 0x9097, 0x0e70, 0x00000000);
854 nv_mthd(priv, 0x9097, 0x0e80, 0x00000000);
855 nv_mthd(priv, 0x9097, 0x0e90, 0x00000000);
856 nv_mthd(priv, 0x9097, 0x0ea0, 0x00000000);
857 nv_mthd(priv, 0x9097, 0x0eb0, 0x00000000);
858 nv_mthd(priv, 0x9097, 0x0ec0, 0x00000000);
859 nv_mthd(priv, 0x9097, 0x0ed0, 0x00000000);
860 nv_mthd(priv, 0x9097, 0x0ee0, 0x00000000);
861 nv_mthd(priv, 0x9097, 0x0ef0, 0x00000000);
862 nv_mthd(priv, 0x9097, 0x0e04, 0xffff0000);
863 nv_mthd(priv, 0x9097, 0x0e14, 0xffff0000);
864 nv_mthd(priv, 0x9097, 0x0e24, 0xffff0000);
865 nv_mthd(priv, 0x9097, 0x0e34, 0xffff0000);
866 nv_mthd(priv, 0x9097, 0x0e44, 0xffff0000);
867 nv_mthd(priv, 0x9097, 0x0e54, 0xffff0000);
868 nv_mthd(priv, 0x9097, 0x0e64, 0xffff0000);
869 nv_mthd(priv, 0x9097, 0x0e74, 0xffff0000);
870 nv_mthd(priv, 0x9097, 0x0e84, 0xffff0000);
871 nv_mthd(priv, 0x9097, 0x0e94, 0xffff0000);
872 nv_mthd(priv, 0x9097, 0x0ea4, 0xffff0000);
873 nv_mthd(priv, 0x9097, 0x0eb4, 0xffff0000);
874 nv_mthd(priv, 0x9097, 0x0ec4, 0xffff0000);
875 nv_mthd(priv, 0x9097, 0x0ed4, 0xffff0000);
876 nv_mthd(priv, 0x9097, 0x0ee4, 0xffff0000);
877 nv_mthd(priv, 0x9097, 0x0ef4, 0xffff0000);
878 nv_mthd(priv, 0x9097, 0x0e08, 0xffff0000);
879 nv_mthd(priv, 0x9097, 0x0e18, 0xffff0000);
880 nv_mthd(priv, 0x9097, 0x0e28, 0xffff0000);
881 nv_mthd(priv, 0x9097, 0x0e38, 0xffff0000);
882 nv_mthd(priv, 0x9097, 0x0e48, 0xffff0000);
883 nv_mthd(priv, 0x9097, 0x0e58, 0xffff0000);
884 nv_mthd(priv, 0x9097, 0x0e68, 0xffff0000);
885 nv_mthd(priv, 0x9097, 0x0e78, 0xffff0000);
886 nv_mthd(priv, 0x9097, 0x0e88, 0xffff0000);
887 nv_mthd(priv, 0x9097, 0x0e98, 0xffff0000);
888 nv_mthd(priv, 0x9097, 0x0ea8, 0xffff0000);
889 nv_mthd(priv, 0x9097, 0x0eb8, 0xffff0000);
890 nv_mthd(priv, 0x9097, 0x0ec8, 0xffff0000);
891 nv_mthd(priv, 0x9097, 0x0ed8, 0xffff0000);
892 nv_mthd(priv, 0x9097, 0x0ee8, 0xffff0000);
893 nv_mthd(priv, 0x9097, 0x0ef8, 0xffff0000);
894 nv_mthd(priv, 0x9097, 0x0d40, 0x00000000);
895 nv_mthd(priv, 0x9097, 0x0d48, 0x00000000);
896 nv_mthd(priv, 0x9097, 0x0d50, 0x00000000);
897 nv_mthd(priv, 0x9097, 0x0d58, 0x00000000);
898 nv_mthd(priv, 0x9097, 0x0d44, 0x00000000);
899 nv_mthd(priv, 0x9097, 0x0d4c, 0x00000000);
900 nv_mthd(priv, 0x9097, 0x0d54, 0x00000000);
901 nv_mthd(priv, 0x9097, 0x0d5c, 0x00000000);
902 nv_mthd(priv, 0x9097, 0x1e00, 0x00000001);
903 nv_mthd(priv, 0x9097, 0x1e20, 0x00000001);
904 nv_mthd(priv, 0x9097, 0x1e40, 0x00000001);
905 nv_mthd(priv, 0x9097, 0x1e60, 0x00000001);
906 nv_mthd(priv, 0x9097, 0x1e80, 0x00000001);
907 nv_mthd(priv, 0x9097, 0x1ea0, 0x00000001);
908 nv_mthd(priv, 0x9097, 0x1ec0, 0x00000001);
909 nv_mthd(priv, 0x9097, 0x1ee0, 0x00000001);
910 nv_mthd(priv, 0x9097, 0x1e04, 0x00000001);
911 nv_mthd(priv, 0x9097, 0x1e24, 0x00000001);
912 nv_mthd(priv, 0x9097, 0x1e44, 0x00000001);
913 nv_mthd(priv, 0x9097, 0x1e64, 0x00000001);
914 nv_mthd(priv, 0x9097, 0x1e84, 0x00000001);
915 nv_mthd(priv, 0x9097, 0x1ea4, 0x00000001);
916 nv_mthd(priv, 0x9097, 0x1ec4, 0x00000001);
917 nv_mthd(priv, 0x9097, 0x1ee4, 0x00000001);
918 nv_mthd(priv, 0x9097, 0x1e08, 0x00000002);
919 nv_mthd(priv, 0x9097, 0x1e28, 0x00000002);
920 nv_mthd(priv, 0x9097, 0x1e48, 0x00000002);
921 nv_mthd(priv, 0x9097, 0x1e68, 0x00000002);
922 nv_mthd(priv, 0x9097, 0x1e88, 0x00000002);
923 nv_mthd(priv, 0x9097, 0x1ea8, 0x00000002);
924 nv_mthd(priv, 0x9097, 0x1ec8, 0x00000002);
925 nv_mthd(priv, 0x9097, 0x1ee8, 0x00000002);
926 nv_mthd(priv, 0x9097, 0x1e0c, 0x00000001);
927 nv_mthd(priv, 0x9097, 0x1e2c, 0x00000001);
928 nv_mthd(priv, 0x9097, 0x1e4c, 0x00000001);
929 nv_mthd(priv, 0x9097, 0x1e6c, 0x00000001);
930 nv_mthd(priv, 0x9097, 0x1e8c, 0x00000001);
931 nv_mthd(priv, 0x9097, 0x1eac, 0x00000001);
932 nv_mthd(priv, 0x9097, 0x1ecc, 0x00000001);
933 nv_mthd(priv, 0x9097, 0x1eec, 0x00000001);
934 nv_mthd(priv, 0x9097, 0x1e10, 0x00000001);
935 nv_mthd(priv, 0x9097, 0x1e30, 0x00000001);
936 nv_mthd(priv, 0x9097, 0x1e50, 0x00000001);
937 nv_mthd(priv, 0x9097, 0x1e70, 0x00000001);
938 nv_mthd(priv, 0x9097, 0x1e90, 0x00000001);
939 nv_mthd(priv, 0x9097, 0x1eb0, 0x00000001);
940 nv_mthd(priv, 0x9097, 0x1ed0, 0x00000001);
941 nv_mthd(priv, 0x9097, 0x1ef0, 0x00000001);
942 nv_mthd(priv, 0x9097, 0x1e14, 0x00000002);
943 nv_mthd(priv, 0x9097, 0x1e34, 0x00000002);
944 nv_mthd(priv, 0x9097, 0x1e54, 0x00000002);
945 nv_mthd(priv, 0x9097, 0x1e74, 0x00000002);
946 nv_mthd(priv, 0x9097, 0x1e94, 0x00000002);
947 nv_mthd(priv, 0x9097, 0x1eb4, 0x00000002);
948 nv_mthd(priv, 0x9097, 0x1ed4, 0x00000002);
949 nv_mthd(priv, 0x9097, 0x1ef4, 0x00000002);
950 nv_mthd(priv, 0x9097, 0x1e18, 0x00000001);
951 nv_mthd(priv, 0x9097, 0x1e38, 0x00000001);
952 nv_mthd(priv, 0x9097, 0x1e58, 0x00000001);
953 nv_mthd(priv, 0x9097, 0x1e78, 0x00000001);
954 nv_mthd(priv, 0x9097, 0x1e98, 0x00000001);
955 nv_mthd(priv, 0x9097, 0x1eb8, 0x00000001);
956 nv_mthd(priv, 0x9097, 0x1ed8, 0x00000001);
957 nv_mthd(priv, 0x9097, 0x1ef8, 0x00000001);
958 if (fermi == 0x9097) {
959 for (mthd = 0x3400; mthd <= 0x35fc; mthd += 4)
960 nv_mthd(priv, 0x9097, mthd, 0x00000000);
961 } 926 }
962 nv_mthd(priv, 0x9097, 0x030c, 0x00000001);
963 nv_mthd(priv, 0x9097, 0x1944, 0x00000000);
964 nv_mthd(priv, 0x9097, 0x1514, 0x00000000);
965 nv_mthd(priv, 0x9097, 0x0d68, 0x0000ffff);
966 nv_mthd(priv, 0x9097, 0x121c, 0x0fac6881);
967 nv_mthd(priv, 0x9097, 0x0fac, 0x00000001);
968 nv_mthd(priv, 0x9097, 0x1538, 0x00000001);
969 nv_mthd(priv, 0x9097, 0x0fe0, 0x00000000);
970 nv_mthd(priv, 0x9097, 0x0fe4, 0x00000000);
971 nv_mthd(priv, 0x9097, 0x0fe8, 0x00000014);
972 nv_mthd(priv, 0x9097, 0x0fec, 0x00000040);
973 nv_mthd(priv, 0x9097, 0x0ff0, 0x00000000);
974 nv_mthd(priv, 0x9097, 0x179c, 0x00000000);
975 nv_mthd(priv, 0x9097, 0x1228, 0x00000400);
976 nv_mthd(priv, 0x9097, 0x122c, 0x00000300);
977 nv_mthd(priv, 0x9097, 0x1230, 0x00010001);
978 nv_mthd(priv, 0x9097, 0x07f8, 0x00000000);
979 nv_mthd(priv, 0x9097, 0x15b4, 0x00000001);
980 nv_mthd(priv, 0x9097, 0x15cc, 0x00000000);
981 nv_mthd(priv, 0x9097, 0x1534, 0x00000000);
982 nv_mthd(priv, 0x9097, 0x0fb0, 0x00000000);
983 nv_mthd(priv, 0x9097, 0x15d0, 0x00000000);
984 nv_mthd(priv, 0x9097, 0x153c, 0x00000000);
985 nv_mthd(priv, 0x9097, 0x16b4, 0x00000003);
986 nv_mthd(priv, 0x9097, 0x0fbc, 0x0000ffff);
987 nv_mthd(priv, 0x9097, 0x0fc0, 0x0000ffff);
988 nv_mthd(priv, 0x9097, 0x0fc4, 0x0000ffff);
989 nv_mthd(priv, 0x9097, 0x0fc8, 0x0000ffff);
990 nv_mthd(priv, 0x9097, 0x0df8, 0x00000000);
991 nv_mthd(priv, 0x9097, 0x0dfc, 0x00000000);
992 nv_mthd(priv, 0x9097, 0x1948, 0x00000000);
993 nv_mthd(priv, 0x9097, 0x1970, 0x00000001);
994 nv_mthd(priv, 0x9097, 0x161c, 0x000009f0);
995 nv_mthd(priv, 0x9097, 0x0dcc, 0x00000010);
996 nv_mthd(priv, 0x9097, 0x163c, 0x00000000);
997 nv_mthd(priv, 0x9097, 0x15e4, 0x00000000);
998 nv_mthd(priv, 0x9097, 0x1160, 0x25e00040);
999 nv_mthd(priv, 0x9097, 0x1164, 0x25e00040);
1000 nv_mthd(priv, 0x9097, 0x1168, 0x25e00040);
1001 nv_mthd(priv, 0x9097, 0x116c, 0x25e00040);
1002 nv_mthd(priv, 0x9097, 0x1170, 0x25e00040);
1003 nv_mthd(priv, 0x9097, 0x1174, 0x25e00040);
1004 nv_mthd(priv, 0x9097, 0x1178, 0x25e00040);
1005 nv_mthd(priv, 0x9097, 0x117c, 0x25e00040);
1006 nv_mthd(priv, 0x9097, 0x1180, 0x25e00040);
1007 nv_mthd(priv, 0x9097, 0x1184, 0x25e00040);
1008 nv_mthd(priv, 0x9097, 0x1188, 0x25e00040);
1009 nv_mthd(priv, 0x9097, 0x118c, 0x25e00040);
1010 nv_mthd(priv, 0x9097, 0x1190, 0x25e00040);
1011 nv_mthd(priv, 0x9097, 0x1194, 0x25e00040);
1012 nv_mthd(priv, 0x9097, 0x1198, 0x25e00040);
1013 nv_mthd(priv, 0x9097, 0x119c, 0x25e00040);
1014 nv_mthd(priv, 0x9097, 0x11a0, 0x25e00040);
1015 nv_mthd(priv, 0x9097, 0x11a4, 0x25e00040);
1016 nv_mthd(priv, 0x9097, 0x11a8, 0x25e00040);
1017 nv_mthd(priv, 0x9097, 0x11ac, 0x25e00040);
1018 nv_mthd(priv, 0x9097, 0x11b0, 0x25e00040);
1019 nv_mthd(priv, 0x9097, 0x11b4, 0x25e00040);
1020 nv_mthd(priv, 0x9097, 0x11b8, 0x25e00040);
1021 nv_mthd(priv, 0x9097, 0x11bc, 0x25e00040);
1022 nv_mthd(priv, 0x9097, 0x11c0, 0x25e00040);
1023 nv_mthd(priv, 0x9097, 0x11c4, 0x25e00040);
1024 nv_mthd(priv, 0x9097, 0x11c8, 0x25e00040);
1025 nv_mthd(priv, 0x9097, 0x11cc, 0x25e00040);
1026 nv_mthd(priv, 0x9097, 0x11d0, 0x25e00040);
1027 nv_mthd(priv, 0x9097, 0x11d4, 0x25e00040);
1028 nv_mthd(priv, 0x9097, 0x11d8, 0x25e00040);
1029 nv_mthd(priv, 0x9097, 0x11dc, 0x25e00040);
1030 nv_mthd(priv, 0x9097, 0x1880, 0x00000000);
1031 nv_mthd(priv, 0x9097, 0x1884, 0x00000000);
1032 nv_mthd(priv, 0x9097, 0x1888, 0x00000000);
1033 nv_mthd(priv, 0x9097, 0x188c, 0x00000000);
1034 nv_mthd(priv, 0x9097, 0x1890, 0x00000000);
1035 nv_mthd(priv, 0x9097, 0x1894, 0x00000000);
1036 nv_mthd(priv, 0x9097, 0x1898, 0x00000000);
1037 nv_mthd(priv, 0x9097, 0x189c, 0x00000000);
1038 nv_mthd(priv, 0x9097, 0x18a0, 0x00000000);
1039 nv_mthd(priv, 0x9097, 0x18a4, 0x00000000);
1040 nv_mthd(priv, 0x9097, 0x18a8, 0x00000000);
1041 nv_mthd(priv, 0x9097, 0x18ac, 0x00000000);
1042 nv_mthd(priv, 0x9097, 0x18b0, 0x00000000);
1043 nv_mthd(priv, 0x9097, 0x18b4, 0x00000000);
1044 nv_mthd(priv, 0x9097, 0x18b8, 0x00000000);
1045 nv_mthd(priv, 0x9097, 0x18bc, 0x00000000);
1046 nv_mthd(priv, 0x9097, 0x18c0, 0x00000000);
1047 nv_mthd(priv, 0x9097, 0x18c4, 0x00000000);
1048 nv_mthd(priv, 0x9097, 0x18c8, 0x00000000);
1049 nv_mthd(priv, 0x9097, 0x18cc, 0x00000000);
1050 nv_mthd(priv, 0x9097, 0x18d0, 0x00000000);
1051 nv_mthd(priv, 0x9097, 0x18d4, 0x00000000);
1052 nv_mthd(priv, 0x9097, 0x18d8, 0x00000000);
1053 nv_mthd(priv, 0x9097, 0x18dc, 0x00000000);
1054 nv_mthd(priv, 0x9097, 0x18e0, 0x00000000);
1055 nv_mthd(priv, 0x9097, 0x18e4, 0x00000000);
1056 nv_mthd(priv, 0x9097, 0x18e8, 0x00000000);
1057 nv_mthd(priv, 0x9097, 0x18ec, 0x00000000);
1058 nv_mthd(priv, 0x9097, 0x18f0, 0x00000000);
1059 nv_mthd(priv, 0x9097, 0x18f4, 0x00000000);
1060 nv_mthd(priv, 0x9097, 0x18f8, 0x00000000);
1061 nv_mthd(priv, 0x9097, 0x18fc, 0x00000000);
1062 nv_mthd(priv, 0x9097, 0x0f84, 0x00000000);
1063 nv_mthd(priv, 0x9097, 0x0f88, 0x00000000);
1064 nv_mthd(priv, 0x9097, 0x17c8, 0x00000000);
1065 nv_mthd(priv, 0x9097, 0x17cc, 0x00000000);
1066 nv_mthd(priv, 0x9097, 0x17d0, 0x000000ff);
1067 nv_mthd(priv, 0x9097, 0x17d4, 0xffffffff);
1068 nv_mthd(priv, 0x9097, 0x17d8, 0x00000002);
1069 nv_mthd(priv, 0x9097, 0x17dc, 0x00000000);
1070 nv_mthd(priv, 0x9097, 0x15f4, 0x00000000);
1071 nv_mthd(priv, 0x9097, 0x15f8, 0x00000000);
1072 nv_mthd(priv, 0x9097, 0x1434, 0x00000000);
1073 nv_mthd(priv, 0x9097, 0x1438, 0x00000000);
1074 nv_mthd(priv, 0x9097, 0x0d74, 0x00000000);
1075 nv_mthd(priv, 0x9097, 0x0dec, 0x00000001);
1076 nv_mthd(priv, 0x9097, 0x13a4, 0x00000000);
1077 nv_mthd(priv, 0x9097, 0x1318, 0x00000001);
1078 nv_mthd(priv, 0x9097, 0x1644, 0x00000000);
1079 nv_mthd(priv, 0x9097, 0x0748, 0x00000000);
1080 nv_mthd(priv, 0x9097, 0x0de8, 0x00000000);
1081 nv_mthd(priv, 0x9097, 0x1648, 0x00000000);
1082 nv_mthd(priv, 0x9097, 0x12a4, 0x00000000);
1083 nv_mthd(priv, 0x9097, 0x1120, 0x00000000);
1084 nv_mthd(priv, 0x9097, 0x1124, 0x00000000);
1085 nv_mthd(priv, 0x9097, 0x1128, 0x00000000);
1086 nv_mthd(priv, 0x9097, 0x112c, 0x00000000);
1087 nv_mthd(priv, 0x9097, 0x1118, 0x00000000);
1088 nv_mthd(priv, 0x9097, 0x164c, 0x00000000);
1089 nv_mthd(priv, 0x9097, 0x1658, 0x00000000);
1090 nv_mthd(priv, 0x9097, 0x1910, 0x00000290);
1091 nv_mthd(priv, 0x9097, 0x1518, 0x00000000);
1092 nv_mthd(priv, 0x9097, 0x165c, 0x00000001);
1093 nv_mthd(priv, 0x9097, 0x1520, 0x00000000);
1094 nv_mthd(priv, 0x9097, 0x1604, 0x00000000);
1095 nv_mthd(priv, 0x9097, 0x1570, 0x00000000);
1096 nv_mthd(priv, 0x9097, 0x13b0, 0x3f800000);
1097 nv_mthd(priv, 0x9097, 0x13b4, 0x3f800000);
1098 nv_mthd(priv, 0x9097, 0x020c, 0x00000000);
1099 nv_mthd(priv, 0x9097, 0x1670, 0x30201000);
1100 nv_mthd(priv, 0x9097, 0x1674, 0x70605040);
1101 nv_mthd(priv, 0x9097, 0x1678, 0xb8a89888);
1102 nv_mthd(priv, 0x9097, 0x167c, 0xf8e8d8c8);
1103 nv_mthd(priv, 0x9097, 0x166c, 0x00000000);
1104 nv_mthd(priv, 0x9097, 0x1680, 0x00ffff00);
1105 nv_mthd(priv, 0x9097, 0x12d0, 0x00000003);
1106 nv_mthd(priv, 0x9097, 0x12d4, 0x00000002);
1107 nv_mthd(priv, 0x9097, 0x1684, 0x00000000);
1108 nv_mthd(priv, 0x9097, 0x1688, 0x00000000);
1109 nv_mthd(priv, 0x9097, 0x0dac, 0x00001b02);
1110 nv_mthd(priv, 0x9097, 0x0db0, 0x00001b02);
1111 nv_mthd(priv, 0x9097, 0x0db4, 0x00000000);
1112 nv_mthd(priv, 0x9097, 0x168c, 0x00000000);
1113 nv_mthd(priv, 0x9097, 0x15bc, 0x00000000);
1114 nv_mthd(priv, 0x9097, 0x156c, 0x00000000);
1115 nv_mthd(priv, 0x9097, 0x187c, 0x00000000);
1116 nv_mthd(priv, 0x9097, 0x1110, 0x00000001);
1117 nv_mthd(priv, 0x9097, 0x0dc0, 0x00000000);
1118 nv_mthd(priv, 0x9097, 0x0dc4, 0x00000000);
1119 nv_mthd(priv, 0x9097, 0x0dc8, 0x00000000);
1120 nv_mthd(priv, 0x9097, 0x1234, 0x00000000);
1121 nv_mthd(priv, 0x9097, 0x1690, 0x00000000);
1122 nv_mthd(priv, 0x9097, 0x12ac, 0x00000001);
1123 nv_mthd(priv, 0x9097, 0x02c4, 0x00000000);
1124 nv_mthd(priv, 0x9097, 0x0790, 0x00000000);
1125 nv_mthd(priv, 0x9097, 0x0794, 0x00000000);
1126 nv_mthd(priv, 0x9097, 0x0798, 0x00000000);
1127 nv_mthd(priv, 0x9097, 0x079c, 0x00000000);
1128 nv_mthd(priv, 0x9097, 0x07a0, 0x00000000);
1129 nv_mthd(priv, 0x9097, 0x077c, 0x00000000);
1130 nv_mthd(priv, 0x9097, 0x1000, 0x00000010);
1131 nv_mthd(priv, 0x9097, 0x10fc, 0x00000000);
1132 nv_mthd(priv, 0x9097, 0x1290, 0x00000000);
1133 nv_mthd(priv, 0x9097, 0x0218, 0x00000010);
1134 nv_mthd(priv, 0x9097, 0x12d8, 0x00000000);
1135 nv_mthd(priv, 0x9097, 0x12dc, 0x00000010);
1136 nv_mthd(priv, 0x9097, 0x0d94, 0x00000001);
1137 nv_mthd(priv, 0x9097, 0x155c, 0x00000000);
1138 nv_mthd(priv, 0x9097, 0x1560, 0x00000000);
1139 nv_mthd(priv, 0x9097, 0x1564, 0x00001fff);
1140 nv_mthd(priv, 0x9097, 0x1574, 0x00000000);
1141 nv_mthd(priv, 0x9097, 0x1578, 0x00000000);
1142 nv_mthd(priv, 0x9097, 0x157c, 0x003fffff);
1143 nv_mthd(priv, 0x9097, 0x1354, 0x00000000);
1144 nv_mthd(priv, 0x9097, 0x1664, 0x00000000);
1145 nv_mthd(priv, 0x9097, 0x1610, 0x00000012);
1146 nv_mthd(priv, 0x9097, 0x1608, 0x00000000);
1147 nv_mthd(priv, 0x9097, 0x160c, 0x00000000);
1148 nv_mthd(priv, 0x9097, 0x162c, 0x00000003);
1149 nv_mthd(priv, 0x9097, 0x0210, 0x00000000);
1150 nv_mthd(priv, 0x9097, 0x0320, 0x00000000);
1151 nv_mthd(priv, 0x9097, 0x0324, 0x3f800000);
1152 nv_mthd(priv, 0x9097, 0x0328, 0x3f800000);
1153 nv_mthd(priv, 0x9097, 0x032c, 0x3f800000);
1154 nv_mthd(priv, 0x9097, 0x0330, 0x3f800000);
1155 nv_mthd(priv, 0x9097, 0x0334, 0x3f800000);
1156 nv_mthd(priv, 0x9097, 0x0338, 0x3f800000);
1157 nv_mthd(priv, 0x9097, 0x0750, 0x00000000);
1158 nv_mthd(priv, 0x9097, 0x0760, 0x39291909);
1159 nv_mthd(priv, 0x9097, 0x0764, 0x79695949);
1160 nv_mthd(priv, 0x9097, 0x0768, 0xb9a99989);
1161 nv_mthd(priv, 0x9097, 0x076c, 0xf9e9d9c9);
1162 nv_mthd(priv, 0x9097, 0x0770, 0x30201000);
1163 nv_mthd(priv, 0x9097, 0x0774, 0x70605040);
1164 nv_mthd(priv, 0x9097, 0x0778, 0x00009080);
1165 nv_mthd(priv, 0x9097, 0x0780, 0x39291909);
1166 nv_mthd(priv, 0x9097, 0x0784, 0x79695949);
1167 nv_mthd(priv, 0x9097, 0x0788, 0xb9a99989);
1168 nv_mthd(priv, 0x9097, 0x078c, 0xf9e9d9c9);
1169 nv_mthd(priv, 0x9097, 0x07d0, 0x30201000);
1170 nv_mthd(priv, 0x9097, 0x07d4, 0x70605040);
1171 nv_mthd(priv, 0x9097, 0x07d8, 0x00009080);
1172 nv_mthd(priv, 0x9097, 0x037c, 0x00000001);
1173 nv_mthd(priv, 0x9097, 0x0740, 0x00000000);
1174 nv_mthd(priv, 0x9097, 0x0744, 0x00000000);
1175 nv_mthd(priv, 0x9097, 0x2600, 0x00000000);
1176 nv_mthd(priv, 0x9097, 0x1918, 0x00000000);
1177 nv_mthd(priv, 0x9097, 0x191c, 0x00000900);
1178 nv_mthd(priv, 0x9097, 0x1920, 0x00000405);
1179 nv_mthd(priv, 0x9097, 0x1308, 0x00000001);
1180 nv_mthd(priv, 0x9097, 0x1924, 0x00000000);
1181 nv_mthd(priv, 0x9097, 0x13ac, 0x00000000);
1182 nv_mthd(priv, 0x9097, 0x192c, 0x00000001);
1183 nv_mthd(priv, 0x9097, 0x193c, 0x00002c1c);
1184 nv_mthd(priv, 0x9097, 0x0d7c, 0x00000000);
1185 nv_mthd(priv, 0x9097, 0x0f8c, 0x00000000);
1186 nv_mthd(priv, 0x9097, 0x02c0, 0x00000001);
1187 nv_mthd(priv, 0x9097, 0x1510, 0x00000000);
1188 nv_mthd(priv, 0x9097, 0x1940, 0x00000000);
1189 nv_mthd(priv, 0x9097, 0x0ff4, 0x00000000);
1190 nv_mthd(priv, 0x9097, 0x0ff8, 0x00000000);
1191 nv_mthd(priv, 0x9097, 0x194c, 0x00000000);
1192 nv_mthd(priv, 0x9097, 0x1950, 0x00000000);
1193 nv_mthd(priv, 0x9097, 0x1968, 0x00000000);
1194 nv_mthd(priv, 0x9097, 0x1590, 0x0000003f);
1195 nv_mthd(priv, 0x9097, 0x07e8, 0x00000000);
1196 nv_mthd(priv, 0x9097, 0x07ec, 0x00000000);
1197 nv_mthd(priv, 0x9097, 0x07f0, 0x00000000);
1198 nv_mthd(priv, 0x9097, 0x07f4, 0x00000000);
1199 nv_mthd(priv, 0x9097, 0x196c, 0x00000011);
1200 nv_mthd(priv, 0x9097, 0x197c, 0x00000000);
1201 nv_mthd(priv, 0x9097, 0x0fcc, 0x00000000);
1202 nv_mthd(priv, 0x9097, 0x0fd0, 0x00000000);
1203 nv_mthd(priv, 0x9097, 0x02d8, 0x00000040);
1204 nv_mthd(priv, 0x9097, 0x1980, 0x00000080);
1205 nv_mthd(priv, 0x9097, 0x1504, 0x00000080);
1206 nv_mthd(priv, 0x9097, 0x1984, 0x00000000);
1207 nv_mthd(priv, 0x9097, 0x0300, 0x00000001);
1208 nv_mthd(priv, 0x9097, 0x13a8, 0x00000000);
1209 nv_mthd(priv, 0x9097, 0x12ec, 0x00000000);
1210 nv_mthd(priv, 0x9097, 0x1310, 0x00000000);
1211 nv_mthd(priv, 0x9097, 0x1314, 0x00000001);
1212 nv_mthd(priv, 0x9097, 0x1380, 0x00000000);
1213 nv_mthd(priv, 0x9097, 0x1384, 0x00000001);
1214 nv_mthd(priv, 0x9097, 0x1388, 0x00000001);
1215 nv_mthd(priv, 0x9097, 0x138c, 0x00000001);
1216 nv_mthd(priv, 0x9097, 0x1390, 0x00000001);
1217 nv_mthd(priv, 0x9097, 0x1394, 0x00000000);
1218 nv_mthd(priv, 0x9097, 0x139c, 0x00000000);
1219 nv_mthd(priv, 0x9097, 0x1398, 0x00000000);
1220 nv_mthd(priv, 0x9097, 0x1594, 0x00000000);
1221 nv_mthd(priv, 0x9097, 0x1598, 0x00000001);
1222 nv_mthd(priv, 0x9097, 0x159c, 0x00000001);
1223 nv_mthd(priv, 0x9097, 0x15a0, 0x00000001);
1224 nv_mthd(priv, 0x9097, 0x15a4, 0x00000001);
1225 nv_mthd(priv, 0x9097, 0x0f54, 0x00000000);
1226 nv_mthd(priv, 0x9097, 0x0f58, 0x00000000);
1227 nv_mthd(priv, 0x9097, 0x0f5c, 0x00000000);
1228 nv_mthd(priv, 0x9097, 0x19bc, 0x00000000);
1229 nv_mthd(priv, 0x9097, 0x0f9c, 0x00000000);
1230 nv_mthd(priv, 0x9097, 0x0fa0, 0x00000000);
1231 nv_mthd(priv, 0x9097, 0x12cc, 0x00000000);
1232 nv_mthd(priv, 0x9097, 0x12e8, 0x00000000);
1233 nv_mthd(priv, 0x9097, 0x130c, 0x00000001);
1234 nv_mthd(priv, 0x9097, 0x1360, 0x00000000);
1235 nv_mthd(priv, 0x9097, 0x1364, 0x00000000);
1236 nv_mthd(priv, 0x9097, 0x1368, 0x00000000);
1237 nv_mthd(priv, 0x9097, 0x136c, 0x00000000);
1238 nv_mthd(priv, 0x9097, 0x1370, 0x00000000);
1239 nv_mthd(priv, 0x9097, 0x1374, 0x00000000);
1240 nv_mthd(priv, 0x9097, 0x1378, 0x00000000);
1241 nv_mthd(priv, 0x9097, 0x137c, 0x00000000);
1242 nv_mthd(priv, 0x9097, 0x133c, 0x00000001);
1243 nv_mthd(priv, 0x9097, 0x1340, 0x00000001);
1244 nv_mthd(priv, 0x9097, 0x1344, 0x00000002);
1245 nv_mthd(priv, 0x9097, 0x1348, 0x00000001);
1246 nv_mthd(priv, 0x9097, 0x134c, 0x00000001);
1247 nv_mthd(priv, 0x9097, 0x1350, 0x00000002);
1248 nv_mthd(priv, 0x9097, 0x1358, 0x00000001);
1249 nv_mthd(priv, 0x9097, 0x12e4, 0x00000000);
1250 nv_mthd(priv, 0x9097, 0x131c, 0x00000000);
1251 nv_mthd(priv, 0x9097, 0x1320, 0x00000000);
1252 nv_mthd(priv, 0x9097, 0x1324, 0x00000000);
1253 nv_mthd(priv, 0x9097, 0x1328, 0x00000000);
1254 nv_mthd(priv, 0x9097, 0x19c0, 0x00000000);
1255 nv_mthd(priv, 0x9097, 0x1140, 0x00000000);
1256 nv_mthd(priv, 0x9097, 0x19c4, 0x00000000);
1257 nv_mthd(priv, 0x9097, 0x19c8, 0x00001500);
1258 nv_mthd(priv, 0x9097, 0x135c, 0x00000000);
1259 nv_mthd(priv, 0x9097, 0x0f90, 0x00000000);
1260 nv_mthd(priv, 0x9097, 0x19e0, 0x00000001);
1261 nv_mthd(priv, 0x9097, 0x19e4, 0x00000001);
1262 nv_mthd(priv, 0x9097, 0x19e8, 0x00000001);
1263 nv_mthd(priv, 0x9097, 0x19ec, 0x00000001);
1264 nv_mthd(priv, 0x9097, 0x19f0, 0x00000001);
1265 nv_mthd(priv, 0x9097, 0x19f4, 0x00000001);
1266 nv_mthd(priv, 0x9097, 0x19f8, 0x00000001);
1267 nv_mthd(priv, 0x9097, 0x19fc, 0x00000001);
1268 nv_mthd(priv, 0x9097, 0x19cc, 0x00000001);
1269 nv_mthd(priv, 0x9097, 0x15b8, 0x00000000);
1270 nv_mthd(priv, 0x9097, 0x1a00, 0x00001111);
1271 nv_mthd(priv, 0x9097, 0x1a04, 0x00000000);
1272 nv_mthd(priv, 0x9097, 0x1a08, 0x00000000);
1273 nv_mthd(priv, 0x9097, 0x1a0c, 0x00000000);
1274 nv_mthd(priv, 0x9097, 0x1a10, 0x00000000);
1275 nv_mthd(priv, 0x9097, 0x1a14, 0x00000000);
1276 nv_mthd(priv, 0x9097, 0x1a18, 0x00000000);
1277 nv_mthd(priv, 0x9097, 0x1a1c, 0x00000000);
1278 nv_mthd(priv, 0x9097, 0x0d6c, 0xffff0000);
1279 nv_mthd(priv, 0x9097, 0x0d70, 0xffff0000);
1280 nv_mthd(priv, 0x9097, 0x10f8, 0x00001010);
1281 nv_mthd(priv, 0x9097, 0x0d80, 0x00000000);
1282 nv_mthd(priv, 0x9097, 0x0d84, 0x00000000);
1283 nv_mthd(priv, 0x9097, 0x0d88, 0x00000000);
1284 nv_mthd(priv, 0x9097, 0x0d8c, 0x00000000);
1285 nv_mthd(priv, 0x9097, 0x0d90, 0x00000000);
1286 nv_mthd(priv, 0x9097, 0x0da0, 0x00000000);
1287 nv_mthd(priv, 0x9097, 0x1508, 0x80000000);
1288 nv_mthd(priv, 0x9097, 0x150c, 0x40000000);
1289 nv_mthd(priv, 0x9097, 0x1668, 0x00000000);
1290 nv_mthd(priv, 0x9097, 0x0318, 0x00000008);
1291 nv_mthd(priv, 0x9097, 0x031c, 0x00000008);
1292 nv_mthd(priv, 0x9097, 0x0d9c, 0x00000001);
1293 nv_mthd(priv, 0x9097, 0x07dc, 0x00000000);
1294 nv_mthd(priv, 0x9097, 0x074c, 0x00000055);
1295 nv_mthd(priv, 0x9097, 0x1420, 0x00000003);
1296 nv_mthd(priv, 0x9097, 0x17bc, 0x00000000);
1297 nv_mthd(priv, 0x9097, 0x17c0, 0x00000000);
1298 nv_mthd(priv, 0x9097, 0x17c4, 0x00000001);
1299 nv_mthd(priv, 0x9097, 0x1008, 0x00000008);
1300 nv_mthd(priv, 0x9097, 0x100c, 0x00000040);
1301 nv_mthd(priv, 0x9097, 0x1010, 0x0000012c);
1302 nv_mthd(priv, 0x9097, 0x0d60, 0x00000040);
1303 nv_mthd(priv, 0x9097, 0x075c, 0x00000003);
1304 nv_mthd(priv, 0x9097, 0x1018, 0x00000020);
1305 nv_mthd(priv, 0x9097, 0x101c, 0x00000001);
1306 nv_mthd(priv, 0x9097, 0x1020, 0x00000020);
1307 nv_mthd(priv, 0x9097, 0x1024, 0x00000001);
1308 nv_mthd(priv, 0x9097, 0x1444, 0x00000000);
1309 nv_mthd(priv, 0x9097, 0x1448, 0x00000000);
1310 nv_mthd(priv, 0x9097, 0x144c, 0x00000000);
1311 nv_mthd(priv, 0x9097, 0x0360, 0x20164010);
1312 nv_mthd(priv, 0x9097, 0x0364, 0x00000020);
1313 nv_mthd(priv, 0x9097, 0x0368, 0x00000000);
1314 nv_mthd(priv, 0x9097, 0x0de4, 0x00000000);
1315 nv_mthd(priv, 0x9097, 0x0204, 0x00000006);
1316 nv_mthd(priv, 0x9097, 0x0208, 0x00000000);
1317 nv_mthd(priv, 0x9097, 0x02cc, 0x003fffff);
1318 nv_mthd(priv, 0x9097, 0x02d0, 0x00000c48);
1319 nv_mthd(priv, 0x9097, 0x1220, 0x00000005);
1320 nv_mthd(priv, 0x9097, 0x0fdc, 0x00000000);
1321 nv_mthd(priv, 0x9097, 0x0f98, 0x00300008);
1322 nv_mthd(priv, 0x9097, 0x1284, 0x04000080);
1323 nv_mthd(priv, 0x9097, 0x1450, 0x00300008);
1324 nv_mthd(priv, 0x9097, 0x1454, 0x04000080);
1325 nv_mthd(priv, 0x9097, 0x0214, 0x00000000);
1326 /* in trace, right after 0x90c0, not here */
1327 nv_mthd(priv, 0x9097, 0x3410, 0x80002006);
1328} 927}
1329 928
1330static void 929void
1331nvc0_grctx_generate_9197(struct nvc0_graph_priv *priv) 930nvc0_grctx_generate_r406028(struct nvc0_graph_priv *priv)
1332{ 931{
1333 u32 fermi = nvc0_graph_class(priv); 932 u32 tmp[GPC_MAX / 8] = {}, i = 0;
1334 u32 mthd; 933 for (i = 0; i < priv->gpc_nr; i++)
1335 934 tmp[i / 8] |= priv->tpc_nr[i] << ((i % 8) * 4);
1336 if (fermi == 0x9197) { 935 for (i = 0; i < 4; i++) {
1337 for (mthd = 0x3400; mthd <= 0x35fc; mthd += 4) 936 nv_wr32(priv, 0x406028 + (i * 4), tmp[i]);
1338 nv_mthd(priv, 0x9197, mthd, 0x00000000); 937 nv_wr32(priv, 0x405870 + (i * 4), tmp[i]);
1339 } 938 }
1340 nv_mthd(priv, 0x9197, 0x02e4, 0x0000b001);
1341} 939}
1342 940
1343static void 941void
1344nvc0_grctx_generate_9297(struct nvc0_graph_priv *priv) 942nvc0_grctx_generate_r4060a8(struct nvc0_graph_priv *priv)
1345{ 943{
1346 u32 fermi = nvc0_graph_class(priv); 944 u8 tpcnr[GPC_MAX], data[TPC_MAX];
1347 u32 mthd; 945 int gpc, tpc, i;
1348 946
1349 if (fermi == 0x9297) { 947 memcpy(tpcnr, priv->tpc_nr, sizeof(priv->tpc_nr));
1350 for (mthd = 0x3400; mthd <= 0x35fc; mthd += 4) 948 memset(data, 0x1f, sizeof(data));
1351 nv_mthd(priv, 0x9297, mthd, 0x00000000); 949
950 gpc = -1;
951 for (tpc = 0; tpc < priv->tpc_total; tpc++) {
952 do {
953 gpc = (gpc + 1) % priv->gpc_nr;
954 } while (!tpcnr[gpc]);
955 tpcnr[gpc]--;
956 data[tpc] = gpc;
1352 } 957 }
1353 nv_mthd(priv, 0x9297, 0x036c, 0x00000000);
1354 nv_mthd(priv, 0x9297, 0x0370, 0x00000000);
1355 nv_mthd(priv, 0x9297, 0x07a4, 0x00000000);
1356 nv_mthd(priv, 0x9297, 0x07a8, 0x00000000);
1357 nv_mthd(priv, 0x9297, 0x0374, 0x00000000);
1358 nv_mthd(priv, 0x9297, 0x0378, 0x00000020);
1359}
1360 958
1361static void 959 for (i = 0; i < 4; i++)
1362nvc0_grctx_generate_902d(struct nvc0_graph_priv *priv) 960 nv_wr32(priv, 0x4060a8 + (i * 4), ((u32 *)data)[i]);
1363{
1364 nv_mthd(priv, 0x902d, 0x0200, 0x000000cf);
1365 nv_mthd(priv, 0x902d, 0x0204, 0x00000001);
1366 nv_mthd(priv, 0x902d, 0x0208, 0x00000020);
1367 nv_mthd(priv, 0x902d, 0x020c, 0x00000001);
1368 nv_mthd(priv, 0x902d, 0x0210, 0x00000000);
1369 nv_mthd(priv, 0x902d, 0x0214, 0x00000080);
1370 nv_mthd(priv, 0x902d, 0x0218, 0x00000100);
1371 nv_mthd(priv, 0x902d, 0x021c, 0x00000100);
1372 nv_mthd(priv, 0x902d, 0x0220, 0x00000000);
1373 nv_mthd(priv, 0x902d, 0x0224, 0x00000000);
1374 nv_mthd(priv, 0x902d, 0x0230, 0x000000cf);
1375 nv_mthd(priv, 0x902d, 0x0234, 0x00000001);
1376 nv_mthd(priv, 0x902d, 0x0238, 0x00000020);
1377 nv_mthd(priv, 0x902d, 0x023c, 0x00000001);
1378 nv_mthd(priv, 0x902d, 0x0244, 0x00000080);
1379 nv_mthd(priv, 0x902d, 0x0248, 0x00000100);
1380 nv_mthd(priv, 0x902d, 0x024c, 0x00000100);
1381}
1382
1383static void
1384nvc0_grctx_generate_9039(struct nvc0_graph_priv *priv)
1385{
1386 nv_mthd(priv, 0x9039, 0x030c, 0x00000000);
1387 nv_mthd(priv, 0x9039, 0x0310, 0x00000000);
1388 nv_mthd(priv, 0x9039, 0x0314, 0x00000000);
1389 nv_mthd(priv, 0x9039, 0x0320, 0x00000000);
1390 nv_mthd(priv, 0x9039, 0x0238, 0x00000000);
1391 nv_mthd(priv, 0x9039, 0x023c, 0x00000000);
1392 nv_mthd(priv, 0x9039, 0x0318, 0x00000000);
1393 nv_mthd(priv, 0x9039, 0x031c, 0x00000000);
1394} 961}
1395 962
1396static void 963void
1397nvc0_grctx_generate_90c0(struct nvc0_graph_priv *priv) 964nvc0_grctx_generate_r418bb8(struct nvc0_graph_priv *priv)
1398{ 965{
1399 int i; 966 u32 data[6] = {}, data2[2] = {};
1400 967 u8 tpcnr[GPC_MAX];
1401 for (i = 0; nv_device(priv)->chipset >= 0xd0 && i < 4; i++) { 968 u8 shift, ntpcv;
1402 nv_mthd(priv, 0x90c0, 0x2700 + (i * 0x40), 0x00000000); 969 int gpc, tpc, i;
1403 nv_mthd(priv, 0x90c0, 0x2720 + (i * 0x40), 0x00000000); 970
1404 nv_mthd(priv, 0x90c0, 0x2704 + (i * 0x40), 0x00000000); 971 /* calculate first set of magics */
1405 nv_mthd(priv, 0x90c0, 0x2724 + (i * 0x40), 0x00000000); 972 memcpy(tpcnr, priv->tpc_nr, sizeof(priv->tpc_nr));
1406 nv_mthd(priv, 0x90c0, 0x2708 + (i * 0x40), 0x00000000); 973
1407 nv_mthd(priv, 0x90c0, 0x2728 + (i * 0x40), 0x00000000); 974 gpc = -1;
975 for (tpc = 0; tpc < priv->tpc_total; tpc++) {
976 do {
977 gpc = (gpc + 1) % priv->gpc_nr;
978 } while (!tpcnr[gpc]);
979 tpcnr[gpc]--;
980
981 data[tpc / 6] |= gpc << ((tpc % 6) * 5);
1408 } 982 }
1409 nv_mthd(priv, 0x90c0, 0x270c, 0x00000000);
1410 nv_mthd(priv, 0x90c0, 0x272c, 0x00000000);
1411 nv_mthd(priv, 0x90c0, 0x274c, 0x00000000);
1412 nv_mthd(priv, 0x90c0, 0x276c, 0x00000000);
1413 nv_mthd(priv, 0x90c0, 0x278c, 0x00000000);
1414 nv_mthd(priv, 0x90c0, 0x27ac, 0x00000000);
1415 nv_mthd(priv, 0x90c0, 0x27cc, 0x00000000);
1416 nv_mthd(priv, 0x90c0, 0x27ec, 0x00000000);
1417 for (i = 0; nv_device(priv)->chipset >= 0xd0 && i < 4; i++) {
1418 nv_mthd(priv, 0x90c0, 0x2710 + (i * 0x40), 0x00014000);
1419 nv_mthd(priv, 0x90c0, 0x2730 + (i * 0x40), 0x00014000);
1420 nv_mthd(priv, 0x90c0, 0x2714 + (i * 0x40), 0x00000040);
1421 nv_mthd(priv, 0x90c0, 0x2734 + (i * 0x40), 0x00000040);
1422 }
1423 nv_mthd(priv, 0x90c0, 0x030c, 0x00000001);
1424 nv_mthd(priv, 0x90c0, 0x1944, 0x00000000);
1425 nv_mthd(priv, 0x90c0, 0x0758, 0x00000100);
1426 nv_mthd(priv, 0x90c0, 0x02c4, 0x00000000);
1427 nv_mthd(priv, 0x90c0, 0x0790, 0x00000000);
1428 nv_mthd(priv, 0x90c0, 0x0794, 0x00000000);
1429 nv_mthd(priv, 0x90c0, 0x0798, 0x00000000);
1430 nv_mthd(priv, 0x90c0, 0x079c, 0x00000000);
1431 nv_mthd(priv, 0x90c0, 0x07a0, 0x00000000);
1432 nv_mthd(priv, 0x90c0, 0x077c, 0x00000000);
1433 nv_mthd(priv, 0x90c0, 0x0204, 0x00000000);
1434 nv_mthd(priv, 0x90c0, 0x0208, 0x00000000);
1435 nv_mthd(priv, 0x90c0, 0x020c, 0x00000000);
1436 nv_mthd(priv, 0x90c0, 0x0214, 0x00000000);
1437 nv_mthd(priv, 0x90c0, 0x024c, 0x00000000);
1438 nv_mthd(priv, 0x90c0, 0x0d94, 0x00000001);
1439 nv_mthd(priv, 0x90c0, 0x1608, 0x00000000);
1440 nv_mthd(priv, 0x90c0, 0x160c, 0x00000000);
1441 nv_mthd(priv, 0x90c0, 0x1664, 0x00000000);
1442}
1443 983
1444static void 984 for (; tpc < 32; tpc++)
1445nvc0_grctx_generate_dispatch(struct nvc0_graph_priv *priv) 985 data[tpc / 6] |= 7 << ((tpc % 6) * 5);
1446{
1447 int i;
1448 986
1449 nv_wr32(priv, 0x404004, 0x00000000); 987 /* and the second... */
1450 nv_wr32(priv, 0x404008, 0x00000000); 988 shift = 0;
1451 nv_wr32(priv, 0x40400c, 0x00000000); 989 ntpcv = priv->tpc_total;
1452 nv_wr32(priv, 0x404010, 0x00000000); 990 while (!(ntpcv & (1 << 4))) {
1453 nv_wr32(priv, 0x404014, 0x00000000); 991 ntpcv <<= 1;
1454 nv_wr32(priv, 0x404018, 0x00000000); 992 shift++;
1455 nv_wr32(priv, 0x40401c, 0x00000000); 993 }
1456 nv_wr32(priv, 0x404020, 0x00000000);
1457 nv_wr32(priv, 0x404024, 0x00000000);
1458 nv_wr32(priv, 0x404028, 0x00000000);
1459 nv_wr32(priv, 0x40402c, 0x00000000);
1460 nv_wr32(priv, 0x404044, 0x00000000);
1461 nv_wr32(priv, 0x404094, 0x00000000);
1462 nv_wr32(priv, 0x404098, 0x00000000);
1463 nv_wr32(priv, 0x40409c, 0x00000000);
1464 nv_wr32(priv, 0x4040a0, 0x00000000);
1465 nv_wr32(priv, 0x4040a4, 0x00000000);
1466 nv_wr32(priv, 0x4040a8, 0x00000000);
1467 nv_wr32(priv, 0x4040ac, 0x00000000);
1468 nv_wr32(priv, 0x4040b0, 0x00000000);
1469 nv_wr32(priv, 0x4040b4, 0x00000000);
1470 nv_wr32(priv, 0x4040b8, 0x00000000);
1471 nv_wr32(priv, 0x4040bc, 0x00000000);
1472 nv_wr32(priv, 0x4040c0, 0x00000000);
1473 nv_wr32(priv, 0x4040c4, 0x00000000);
1474 nv_wr32(priv, 0x4040c8, 0xf0000087);
1475 nv_wr32(priv, 0x4040d4, 0x00000000);
1476 nv_wr32(priv, 0x4040d8, 0x00000000);
1477 nv_wr32(priv, 0x4040dc, 0x00000000);
1478 nv_wr32(priv, 0x4040e0, 0x00000000);
1479 nv_wr32(priv, 0x4040e4, 0x00000000);
1480 nv_wr32(priv, 0x4040e8, 0x00001000);
1481 nv_wr32(priv, 0x4040f8, 0x00000000);
1482 nv_wr32(priv, 0x404130, 0x00000000);
1483 nv_wr32(priv, 0x404134, 0x00000000);
1484 nv_wr32(priv, 0x404138, 0x20000040);
1485 nv_wr32(priv, 0x404150, 0x0000002e);
1486 nv_wr32(priv, 0x404154, 0x00000400);
1487 nv_wr32(priv, 0x404158, 0x00000200);
1488 nv_wr32(priv, 0x404164, 0x00000055);
1489 nv_wr32(priv, 0x404168, 0x00000000);
1490 nv_wr32(priv, 0x404174, 0x00000000);
1491 nv_wr32(priv, 0x404178, 0x00000000);
1492 nv_wr32(priv, 0x40417c, 0x00000000);
1493 for (i = 0; i < 8; i++)
1494 nv_wr32(priv, 0x404200 + (i * 4), 0x00000000); /* subc */
1495}
1496
1497static void
1498nvc0_grctx_generate_macro(struct nvc0_graph_priv *priv)
1499{
1500 nv_wr32(priv, 0x404404, 0x00000000);
1501 nv_wr32(priv, 0x404408, 0x00000000);
1502 nv_wr32(priv, 0x40440c, 0x00000000);
1503 nv_wr32(priv, 0x404410, 0x00000000);
1504 nv_wr32(priv, 0x404414, 0x00000000);
1505 nv_wr32(priv, 0x404418, 0x00000000);
1506 nv_wr32(priv, 0x40441c, 0x00000000);
1507 nv_wr32(priv, 0x404420, 0x00000000);
1508 nv_wr32(priv, 0x404424, 0x00000000);
1509 nv_wr32(priv, 0x404428, 0x00000000);
1510 nv_wr32(priv, 0x40442c, 0x00000000);
1511 nv_wr32(priv, 0x404430, 0x00000000);
1512 nv_wr32(priv, 0x404434, 0x00000000);
1513 nv_wr32(priv, 0x404438, 0x00000000);
1514 nv_wr32(priv, 0x404460, 0x00000000);
1515 nv_wr32(priv, 0x404464, 0x00000000);
1516 nv_wr32(priv, 0x404468, 0x00ffffff);
1517 nv_wr32(priv, 0x40446c, 0x00000000);
1518 nv_wr32(priv, 0x404480, 0x00000001);
1519 nv_wr32(priv, 0x404498, 0x00000001);
1520}
1521
1522static void
1523nvc0_grctx_generate_m2mf(struct nvc0_graph_priv *priv)
1524{
1525 nv_wr32(priv, 0x404604, 0x00000015);
1526 nv_wr32(priv, 0x404608, 0x00000000);
1527 nv_wr32(priv, 0x40460c, 0x00002e00);
1528 nv_wr32(priv, 0x404610, 0x00000100);
1529 nv_wr32(priv, 0x404618, 0x00000000);
1530 nv_wr32(priv, 0x40461c, 0x00000000);
1531 nv_wr32(priv, 0x404620, 0x00000000);
1532 nv_wr32(priv, 0x404624, 0x00000000);
1533 nv_wr32(priv, 0x404628, 0x00000000);
1534 nv_wr32(priv, 0x40462c, 0x00000000);
1535 nv_wr32(priv, 0x404630, 0x00000000);
1536 nv_wr32(priv, 0x404634, 0x00000000);
1537 nv_wr32(priv, 0x404638, 0x00000004);
1538 nv_wr32(priv, 0x40463c, 0x00000000);
1539 nv_wr32(priv, 0x404640, 0x00000000);
1540 nv_wr32(priv, 0x404644, 0x00000000);
1541 nv_wr32(priv, 0x404648, 0x00000000);
1542 nv_wr32(priv, 0x40464c, 0x00000000);
1543 nv_wr32(priv, 0x404650, 0x00000000);
1544 nv_wr32(priv, 0x404654, 0x00000000);
1545 nv_wr32(priv, 0x404658, 0x00000000);
1546 nv_wr32(priv, 0x40465c, 0x007f0100);
1547 nv_wr32(priv, 0x404660, 0x00000000);
1548 nv_wr32(priv, 0x404664, 0x00000000);
1549 nv_wr32(priv, 0x404668, 0x00000000);
1550 nv_wr32(priv, 0x40466c, 0x00000000);
1551 nv_wr32(priv, 0x404670, 0x00000000);
1552 nv_wr32(priv, 0x404674, 0x00000000);
1553 nv_wr32(priv, 0x404678, 0x00000000);
1554 nv_wr32(priv, 0x40467c, 0x00000002);
1555 nv_wr32(priv, 0x404680, 0x00000000);
1556 nv_wr32(priv, 0x404684, 0x00000000);
1557 nv_wr32(priv, 0x404688, 0x00000000);
1558 nv_wr32(priv, 0x40468c, 0x00000000);
1559 nv_wr32(priv, 0x404690, 0x00000000);
1560 nv_wr32(priv, 0x404694, 0x00000000);
1561 nv_wr32(priv, 0x404698, 0x00000000);
1562 nv_wr32(priv, 0x40469c, 0x00000000);
1563 nv_wr32(priv, 0x4046a0, 0x007f0080);
1564 nv_wr32(priv, 0x4046a4, 0x00000000);
1565 nv_wr32(priv, 0x4046a8, 0x00000000);
1566 nv_wr32(priv, 0x4046ac, 0x00000000);
1567 nv_wr32(priv, 0x4046b0, 0x00000000);
1568 nv_wr32(priv, 0x4046b4, 0x00000000);
1569 nv_wr32(priv, 0x4046b8, 0x00000000);
1570 nv_wr32(priv, 0x4046bc, 0x00000000);
1571 nv_wr32(priv, 0x4046c0, 0x00000000);
1572 nv_wr32(priv, 0x4046c4, 0x00000000);
1573 nv_wr32(priv, 0x4046c8, 0x00000000);
1574 nv_wr32(priv, 0x4046cc, 0x00000000);
1575 nv_wr32(priv, 0x4046d0, 0x00000000);
1576 nv_wr32(priv, 0x4046d4, 0x00000000);
1577 nv_wr32(priv, 0x4046d8, 0x00000000);
1578 nv_wr32(priv, 0x4046dc, 0x00000000);
1579 nv_wr32(priv, 0x4046e0, 0x00000000);
1580 nv_wr32(priv, 0x4046e4, 0x00000000);
1581 nv_wr32(priv, 0x4046e8, 0x00000000);
1582 nv_wr32(priv, 0x4046f0, 0x00000000);
1583 nv_wr32(priv, 0x4046f4, 0x00000000);
1584}
1585 994
1586static void 995 data2[0] = (ntpcv << 16);
1587nvc0_grctx_generate_unk47xx(struct nvc0_graph_priv *priv) 996 data2[0] |= (shift << 21);
1588{ 997 data2[0] |= (((1 << (0 + 5)) % ntpcv) << 24);
1589 nv_wr32(priv, 0x404700, 0x00000000); 998 for (i = 1; i < 7; i++)
1590 nv_wr32(priv, 0x404704, 0x00000000); 999 data2[1] |= ((1 << (i + 5)) % ntpcv) << ((i - 1) * 5);
1591 nv_wr32(priv, 0x404708, 0x00000000);
1592 nv_wr32(priv, 0x40470c, 0x00000000);
1593 nv_wr32(priv, 0x404710, 0x00000000);
1594 nv_wr32(priv, 0x404714, 0x00000000);
1595 nv_wr32(priv, 0x404718, 0x00000000);
1596 nv_wr32(priv, 0x40471c, 0x00000000);
1597 nv_wr32(priv, 0x404720, 0x00000000);
1598 nv_wr32(priv, 0x404724, 0x00000000);
1599 nv_wr32(priv, 0x404728, 0x00000000);
1600 nv_wr32(priv, 0x40472c, 0x00000000);
1601 nv_wr32(priv, 0x404730, 0x00000000);
1602 nv_wr32(priv, 0x404734, 0x00000100);
1603 nv_wr32(priv, 0x404738, 0x00000000);
1604 nv_wr32(priv, 0x40473c, 0x00000000);
1605 nv_wr32(priv, 0x404740, 0x00000000);
1606 nv_wr32(priv, 0x404744, 0x00000000);
1607 nv_wr32(priv, 0x404748, 0x00000000);
1608 nv_wr32(priv, 0x40474c, 0x00000000);
1609 nv_wr32(priv, 0x404750, 0x00000000);
1610 nv_wr32(priv, 0x404754, 0x00000000);
1611}
1612 1000
1613static void 1001 /* GPC_BROADCAST */
1614nvc0_grctx_generate_shaders(struct nvc0_graph_priv *priv) 1002 nv_wr32(priv, 0x418bb8, (priv->tpc_total << 8) |
1615{ 1003 priv->magic_not_rop_nr);
1004 for (i = 0; i < 6; i++)
1005 nv_wr32(priv, 0x418b08 + (i * 4), data[i]);
1616 1006
1617 if (nv_device(priv)->chipset >= 0xd0) { 1007 /* GPC_BROADCAST.TP_BROADCAST */
1618 nv_wr32(priv, 0x405800, 0x0f8000bf); 1008 nv_wr32(priv, 0x419bd0, (priv->tpc_total << 8) |
1619 nv_wr32(priv, 0x405830, 0x02180218); 1009 priv->magic_not_rop_nr | data2[0]);
1620 nv_wr32(priv, 0x405834, 0x08000000); 1010 nv_wr32(priv, 0x419be4, data2[1]);
1621 } else 1011 for (i = 0; i < 6; i++)
1622 if (nv_device(priv)->chipset == 0xc1) { 1012 nv_wr32(priv, 0x419b00 + (i * 4), data[i]);
1623 nv_wr32(priv, 0x405800, 0x0f8000bf); 1013
1624 nv_wr32(priv, 0x405830, 0x02180218); 1014 /* UNK78xx */
1625 nv_wr32(priv, 0x405834, 0x00000000); 1015 nv_wr32(priv, 0x4078bc, (priv->tpc_total << 8) |
1626 } else { 1016 priv->magic_not_rop_nr);
1627 nv_wr32(priv, 0x405800, 0x078000bf); 1017 for (i = 0; i < 6; i++)
1628 nv_wr32(priv, 0x405830, 0x02180000); 1018 nv_wr32(priv, 0x40780c + (i * 4), data[i]);
1629 nv_wr32(priv, 0x405834, 0x00000000);
1630 }
1631 nv_wr32(priv, 0x405838, 0x00000000);
1632 nv_wr32(priv, 0x405854, 0x00000000);
1633 nv_wr32(priv, 0x405870, 0x00000001);
1634 nv_wr32(priv, 0x405874, 0x00000001);
1635 nv_wr32(priv, 0x405878, 0x00000001);
1636 nv_wr32(priv, 0x40587c, 0x00000001);
1637 nv_wr32(priv, 0x405a00, 0x00000000);
1638 nv_wr32(priv, 0x405a04, 0x00000000);
1639 nv_wr32(priv, 0x405a18, 0x00000000);
1640} 1019}
1641 1020
1642static void 1021void
1643nvc0_grctx_generate_unk60xx(struct nvc0_graph_priv *priv) 1022nvc0_grctx_generate_r406800(struct nvc0_graph_priv *priv)
1644{ 1023{
1645 nv_wr32(priv, 0x406020, 0x000103c1); 1024 u64 tpc_mask = 0, tpc_set = 0;
1646 nv_wr32(priv, 0x406028, 0x00000001); 1025 u8 tpcnr[GPC_MAX];
1647 nv_wr32(priv, 0x40602c, 0x00000001); 1026 int gpc, tpc;
1648 nv_wr32(priv, 0x406030, 0x00000001); 1027 int i, a, b;
1649 nv_wr32(priv, 0x406034, 0x00000001); 1028
1650} 1029 memcpy(tpcnr, priv->tpc_nr, sizeof(priv->tpc_nr));
1030 for (gpc = 0; gpc < priv->gpc_nr; gpc++)
1031 tpc_mask |= ((1ULL << priv->tpc_nr[gpc]) - 1) << (gpc * 8);
1032
1033 for (i = 0, gpc = -1, b = -1; i < 32; i++) {
1034 a = (i * (priv->tpc_total - 1)) / 32;
1035 if (a != b) {
1036 b = a;
1037 do {
1038 gpc = (gpc + 1) % priv->gpc_nr;
1039 } while (!tpcnr[gpc]);
1040 tpc = priv->tpc_nr[gpc] - tpcnr[gpc]--;
1651 1041
1652static void 1042 tpc_set |= 1 << ((gpc * 8) + tpc);
1653nvc0_grctx_generate_unk64xx(struct nvc0_graph_priv *priv) 1043 }
1654{
1655 1044
1656 nv_wr32(priv, 0x4064a8, 0x00000000); 1045 nv_wr32(priv, 0x406800 + (i * 0x20), lower_32_bits(tpc_set));
1657 nv_wr32(priv, 0x4064ac, 0x00003fff); 1046 nv_wr32(priv, 0x406c00 + (i * 0x20), lower_32_bits(tpc_set ^ tpc_mask));
1658 nv_wr32(priv, 0x4064b4, 0x00000000); 1047 if (priv->gpc_nr > 4) {
1659 nv_wr32(priv, 0x4064b8, 0x00000000); 1048 nv_wr32(priv, 0x406804 + (i * 0x20), upper_32_bits(tpc_set));
1660 if (nv_device(priv)->chipset >= 0xd0) 1049 nv_wr32(priv, 0x406c04 + (i * 0x20), upper_32_bits(tpc_set ^ tpc_mask));
1661 nv_wr32(priv, 0x4064bc, 0x00000000); 1050 }
1662 if (nv_device(priv)->chipset == 0xc1 ||
1663 nv_device(priv)->chipset >= 0xd0) {
1664 nv_wr32(priv, 0x4064c0, 0x80140078);
1665 nv_wr32(priv, 0x4064c4, 0x0086ffff);
1666 } 1051 }
1667} 1052}
1668 1053
1669static void 1054void
1670nvc0_grctx_generate_tpbus(struct nvc0_graph_priv *priv) 1055nvc0_grctx_generate_main(struct nvc0_graph_priv *priv, struct nvc0_grctx *info)
1671{ 1056{
1672 nv_wr32(priv, 0x407804, 0x00000023); 1057 struct nvc0_grctx_oclass *oclass = (void *)nv_engine(priv)->cclass;
1673 nv_wr32(priv, 0x40780c, 0x0a418820); 1058 int i;
1674 nv_wr32(priv, 0x407810, 0x062080e6);
1675 nv_wr32(priv, 0x407814, 0x020398a4);
1676 nv_wr32(priv, 0x407818, 0x0e629062);
1677 nv_wr32(priv, 0x40781c, 0x0a418820);
1678 nv_wr32(priv, 0x407820, 0x000000e6);
1679 nv_wr32(priv, 0x4078bc, 0x00000103);
1680}
1681 1059
1682static void 1060 nv_mask(priv, 0x000260, 0x00000001, 0x00000000);
1683nvc0_grctx_generate_ccache(struct nvc0_graph_priv *priv)
1684{
1685 nv_wr32(priv, 0x408000, 0x00000000);
1686 nv_wr32(priv, 0x408004, 0x00000000);
1687 nv_wr32(priv, 0x408008, 0x00000018);
1688 nv_wr32(priv, 0x40800c, 0x00000000);
1689 nv_wr32(priv, 0x408010, 0x00000000);
1690 nv_wr32(priv, 0x408014, 0x00000069);
1691 nv_wr32(priv, 0x408018, 0xe100e100);
1692 nv_wr32(priv, 0x408064, 0x00000000);
1693}
1694 1061
1695static void 1062 for (i = 0; oclass->hub[i]; i++)
1696nvc0_grctx_generate_rop(struct nvc0_graph_priv *priv) 1063 nvc0_graph_mmio(priv, oclass->hub[i]);
1697{ 1064 for (i = 0; oclass->gpc[i]; i++)
1698 int chipset = nv_device(priv)->chipset; 1065 nvc0_graph_mmio(priv, oclass->gpc[i]);
1699
1700 /* ROPC_BROADCAST */
1701 nv_wr32(priv, 0x408800, 0x02802a3c);
1702 nv_wr32(priv, 0x408804, 0x00000040);
1703 if (chipset >= 0xd0) {
1704 nv_wr32(priv, 0x408808, 0x1043e005);
1705 nv_wr32(priv, 0x408900, 0x3080b801);
1706 nv_wr32(priv, 0x408904, 0x1043e005);
1707 nv_wr32(priv, 0x408908, 0x00c8102f);
1708 } else
1709 if (chipset == 0xc1) {
1710 nv_wr32(priv, 0x408808, 0x1003e005);
1711 nv_wr32(priv, 0x408900, 0x3080b801);
1712 nv_wr32(priv, 0x408904, 0x62000001);
1713 nv_wr32(priv, 0x408908, 0x00c80929);
1714 } else {
1715 nv_wr32(priv, 0x408808, 0x0003e00d);
1716 nv_wr32(priv, 0x408900, 0x3080b801);
1717 nv_wr32(priv, 0x408904, 0x02000001);
1718 nv_wr32(priv, 0x408908, 0x00c80929);
1719 }
1720 nv_wr32(priv, 0x40890c, 0x00000000);
1721 nv_wr32(priv, 0x408980, 0x0000011d);
1722}
1723 1066
1724static void 1067 nv_wr32(priv, 0x404154, 0x00000000);
1725nvc0_grctx_generate_gpc(struct nvc0_graph_priv *priv)
1726{
1727 int chipset = nv_device(priv)->chipset;
1728 int i;
1729 1068
1730 /* GPC_BROADCAST */ 1069 oclass->mods(priv, info);
1731 nv_wr32(priv, 0x418380, 0x00000016); 1070 oclass->unkn(priv);
1732 nv_wr32(priv, 0x418400, 0x38004e00);
1733 nv_wr32(priv, 0x418404, 0x71e0ffff);
1734 nv_wr32(priv, 0x418408, 0x00000000);
1735 nv_wr32(priv, 0x41840c, 0x00001008);
1736 nv_wr32(priv, 0x418410, 0x0fff0fff);
1737 nv_wr32(priv, 0x418414, chipset < 0xd0 ? 0x00200fff : 0x02200fff);
1738 nv_wr32(priv, 0x418450, 0x00000000);
1739 nv_wr32(priv, 0x418454, 0x00000000);
1740 nv_wr32(priv, 0x418458, 0x00000000);
1741 nv_wr32(priv, 0x41845c, 0x00000000);
1742 nv_wr32(priv, 0x418460, 0x00000000);
1743 nv_wr32(priv, 0x418464, 0x00000000);
1744 nv_wr32(priv, 0x418468, 0x00000001);
1745 nv_wr32(priv, 0x41846c, 0x00000000);
1746 nv_wr32(priv, 0x418470, 0x00000000);
1747 nv_wr32(priv, 0x418600, 0x0000001f);
1748 nv_wr32(priv, 0x418684, 0x0000000f);
1749 nv_wr32(priv, 0x418700, 0x00000002);
1750 nv_wr32(priv, 0x418704, 0x00000080);
1751 nv_wr32(priv, 0x418708, 0x00000000);
1752 nv_wr32(priv, 0x41870c, chipset < 0xd0 ? 0x07c80000 : 0x00000000);
1753 nv_wr32(priv, 0x418710, 0x00000000);
1754 nv_wr32(priv, 0x418800, chipset < 0xd0 ? 0x0006860a : 0x7006860a);
1755 nv_wr32(priv, 0x418808, 0x00000000);
1756 nv_wr32(priv, 0x41880c, 0x00000000);
1757 nv_wr32(priv, 0x418810, 0x00000000);
1758 nv_wr32(priv, 0x418828, 0x00008442);
1759 if (chipset == 0xc1 || chipset >= 0xd0)
1760 nv_wr32(priv, 0x418830, 0x10000001);
1761 else
1762 nv_wr32(priv, 0x418830, 0x00000001);
1763 nv_wr32(priv, 0x4188d8, 0x00000008);
1764 nv_wr32(priv, 0x4188e0, 0x01000000);
1765 nv_wr32(priv, 0x4188e8, 0x00000000);
1766 nv_wr32(priv, 0x4188ec, 0x00000000);
1767 nv_wr32(priv, 0x4188f0, 0x00000000);
1768 nv_wr32(priv, 0x4188f4, 0x00000000);
1769 nv_wr32(priv, 0x4188f8, 0x00000000);
1770 if (chipset >= 0xd0)
1771 nv_wr32(priv, 0x4188fc, 0x20100008);
1772 else if (chipset == 0xc1)
1773 nv_wr32(priv, 0x4188fc, 0x00100018);
1774 else
1775 nv_wr32(priv, 0x4188fc, 0x00100000);
1776 nv_wr32(priv, 0x41891c, 0x00ff00ff);
1777 nv_wr32(priv, 0x418924, 0x00000000);
1778 nv_wr32(priv, 0x418928, 0x00ffff00);
1779 nv_wr32(priv, 0x41892c, 0x0000ff00);
1780 for (i = 0; i < 8; i++) {
1781 nv_wr32(priv, 0x418a00 + (i * 0x20), 0x00000000);
1782 nv_wr32(priv, 0x418a04 + (i * 0x20), 0x00000000);
1783 nv_wr32(priv, 0x418a08 + (i * 0x20), 0x00000000);
1784 nv_wr32(priv, 0x418a0c + (i * 0x20), 0x00010000);
1785 nv_wr32(priv, 0x418a10 + (i * 0x20), 0x00000000);
1786 nv_wr32(priv, 0x418a14 + (i * 0x20), 0x00000000);
1787 nv_wr32(priv, 0x418a18 + (i * 0x20), 0x00000000);
1788 }
1789 nv_wr32(priv, 0x418b00, chipset < 0xd0 ? 0x00000000 : 0x00000006);
1790 nv_wr32(priv, 0x418b08, 0x0a418820);
1791 nv_wr32(priv, 0x418b0c, 0x062080e6);
1792 nv_wr32(priv, 0x418b10, 0x020398a4);
1793 nv_wr32(priv, 0x418b14, 0x0e629062);
1794 nv_wr32(priv, 0x418b18, 0x0a418820);
1795 nv_wr32(priv, 0x418b1c, 0x000000e6);
1796 nv_wr32(priv, 0x418bb8, 0x00000103);
1797 nv_wr32(priv, 0x418c08, 0x00000001);
1798 nv_wr32(priv, 0x418c10, 0x00000000);
1799 nv_wr32(priv, 0x418c14, 0x00000000);
1800 nv_wr32(priv, 0x418c18, 0x00000000);
1801 nv_wr32(priv, 0x418c1c, 0x00000000);
1802 nv_wr32(priv, 0x418c20, 0x00000000);
1803 nv_wr32(priv, 0x418c24, 0x00000000);
1804 nv_wr32(priv, 0x418c28, 0x00000000);
1805 nv_wr32(priv, 0x418c2c, 0x00000000);
1806 if (chipset == 0xc1 || chipset >= 0xd0)
1807 nv_wr32(priv, 0x418c6c, 0x00000001);
1808 nv_wr32(priv, 0x418c80, 0x20200004);
1809 nv_wr32(priv, 0x418c8c, 0x00000001);
1810 nv_wr32(priv, 0x419000, 0x00000780);
1811 nv_wr32(priv, 0x419004, 0x00000000);
1812 nv_wr32(priv, 0x419008, 0x00000000);
1813 nv_wr32(priv, 0x419014, 0x00000004);
1814}
1815 1071
1816static void 1072 nvc0_grctx_generate_tpcid(priv);
1817nvc0_grctx_generate_tp(struct nvc0_graph_priv *priv) 1073 nvc0_grctx_generate_r406028(priv);
1818{ 1074 nvc0_grctx_generate_r4060a8(priv);
1819 int chipset = nv_device(priv)->chipset; 1075 nvc0_grctx_generate_r418bb8(priv);
1076 nvc0_grctx_generate_r406800(priv);
1820 1077
1821 /* GPC_BROADCAST.TP_BROADCAST */ 1078 nvc0_graph_icmd(priv, oclass->icmd);
1822 nv_wr32(priv, 0x419818, 0x00000000); 1079 nv_wr32(priv, 0x404154, 0x00000400);
1823 nv_wr32(priv, 0x41983c, 0x00038bc7); 1080 nvc0_graph_mthd(priv, oclass->mthd);
1824 nv_wr32(priv, 0x419848, 0x00000000); 1081 nv_mask(priv, 0x000260, 0x00000001, 0x00000001);
1825 if (chipset == 0xc1 || chipset >= 0xd0)
1826 nv_wr32(priv, 0x419864, 0x00000129);
1827 else
1828 nv_wr32(priv, 0x419864, 0x0000012a);
1829 nv_wr32(priv, 0x419888, 0x00000000);
1830 nv_wr32(priv, 0x419a00, 0x000001f0);
1831 nv_wr32(priv, 0x419a04, 0x00000001);
1832 nv_wr32(priv, 0x419a08, 0x00000023);
1833 nv_wr32(priv, 0x419a0c, 0x00020000);
1834 nv_wr32(priv, 0x419a10, 0x00000000);
1835 nv_wr32(priv, 0x419a14, 0x00000200);
1836 nv_wr32(priv, 0x419a1c, 0x00000000);
1837 nv_wr32(priv, 0x419a20, 0x00000800);
1838 if (chipset >= 0xd0)
1839 nv_wr32(priv, 0x00419ac4, 0x0017f440);
1840 else if (chipset != 0xc0 && chipset != 0xc8)
1841 nv_wr32(priv, 0x00419ac4, 0x0007f440);
1842 nv_wr32(priv, 0x419b00, 0x0a418820);
1843 nv_wr32(priv, 0x419b04, 0x062080e6);
1844 nv_wr32(priv, 0x419b08, 0x020398a4);
1845 nv_wr32(priv, 0x419b0c, 0x0e629062);
1846 nv_wr32(priv, 0x419b10, 0x0a418820);
1847 nv_wr32(priv, 0x419b14, 0x000000e6);
1848 nv_wr32(priv, 0x419bd0, 0x00900103);
1849 if (chipset == 0xc1 || chipset >= 0xd0)
1850 nv_wr32(priv, 0x419be0, 0x00400001);
1851 else
1852 nv_wr32(priv, 0x419be0, 0x00000001);
1853 nv_wr32(priv, 0x419be4, 0x00000000);
1854 nv_wr32(priv, 0x419c00, chipset < 0xd0 ? 0x00000002 : 0x0000000a);
1855 nv_wr32(priv, 0x419c04, 0x00000006);
1856 nv_wr32(priv, 0x419c08, 0x00000002);
1857 nv_wr32(priv, 0x419c20, 0x00000000);
1858 if (nv_device(priv)->chipset >= 0xd0) {
1859 nv_wr32(priv, 0x419c24, 0x00084210);
1860 nv_wr32(priv, 0x419c28, 0x3cf3cf3c);
1861 nv_wr32(priv, 0x419cb0, 0x00020048);
1862 } else
1863 if (chipset == 0xce || chipset == 0xcf) {
1864 nv_wr32(priv, 0x419cb0, 0x00020048);
1865 } else {
1866 nv_wr32(priv, 0x419cb0, 0x00060048);
1867 }
1868 nv_wr32(priv, 0x419ce8, 0x00000000);
1869 nv_wr32(priv, 0x419cf4, 0x00000183);
1870 if (chipset == 0xc1 || chipset >= 0xd0)
1871 nv_wr32(priv, 0x419d20, 0x12180000);
1872 else
1873 nv_wr32(priv, 0x419d20, 0x02180000);
1874 nv_wr32(priv, 0x419d24, 0x00001fff);
1875 if (chipset == 0xc1 || chipset >= 0xd0)
1876 nv_wr32(priv, 0x419d44, 0x02180218);
1877 nv_wr32(priv, 0x419e04, 0x00000000);
1878 nv_wr32(priv, 0x419e08, 0x00000000);
1879 nv_wr32(priv, 0x419e0c, 0x00000000);
1880 nv_wr32(priv, 0x419e10, 0x00000002);
1881 nv_wr32(priv, 0x419e44, 0x001beff2);
1882 nv_wr32(priv, 0x419e48, 0x00000000);
1883 nv_wr32(priv, 0x419e4c, 0x0000000f);
1884 nv_wr32(priv, 0x419e50, 0x00000000);
1885 nv_wr32(priv, 0x419e54, 0x00000000);
1886 nv_wr32(priv, 0x419e58, 0x00000000);
1887 nv_wr32(priv, 0x419e5c, 0x00000000);
1888 nv_wr32(priv, 0x419e60, 0x00000000);
1889 nv_wr32(priv, 0x419e64, 0x00000000);
1890 nv_wr32(priv, 0x419e68, 0x00000000);
1891 nv_wr32(priv, 0x419e6c, 0x00000000);
1892 nv_wr32(priv, 0x419e70, 0x00000000);
1893 nv_wr32(priv, 0x419e74, 0x00000000);
1894 nv_wr32(priv, 0x419e78, 0x00000000);
1895 nv_wr32(priv, 0x419e7c, 0x00000000);
1896 nv_wr32(priv, 0x419e80, 0x00000000);
1897 nv_wr32(priv, 0x419e84, 0x00000000);
1898 nv_wr32(priv, 0x419e88, 0x00000000);
1899 nv_wr32(priv, 0x419e8c, 0x00000000);
1900 nv_wr32(priv, 0x419e90, 0x00000000);
1901 nv_wr32(priv, 0x419e98, 0x00000000);
1902 if (chipset != 0xc0 && chipset != 0xc8)
1903 nv_wr32(priv, 0x419ee0, 0x00011110);
1904 nv_wr32(priv, 0x419f50, 0x00000000);
1905 nv_wr32(priv, 0x419f54, 0x00000000);
1906 if (chipset != 0xc0 && chipset != 0xc8)
1907 nv_wr32(priv, 0x419f58, 0x00000000);
1908} 1082}
1909 1083
1910int 1084int
1911nvc0_grctx_generate(struct nvc0_graph_priv *priv) 1085nvc0_grctx_generate(struct nvc0_graph_priv *priv)
1912{ 1086{
1087 struct nvc0_grctx_oclass *oclass = (void *)nv_engine(priv)->cclass;
1088 struct nouveau_bar *bar = nouveau_bar(priv);
1089 struct nouveau_gpuobj *chan;
1913 struct nvc0_grctx info; 1090 struct nvc0_grctx info;
1914 int ret, i, gpc, tpc, id; 1091 int ret, i;
1915 u32 fermi = nvc0_graph_class(priv);
1916 u32 r000260, tmp;
1917 1092
1918 ret = nvc0_grctx_init(priv, &info); 1093 /* allocate memory to for a "channel", which we'll use to generate
1919 if (ret) 1094 * the default context values
1095 */
1096 ret = nouveau_gpuobj_new(nv_object(priv), NULL, 0x80000 + priv->size,
1097 0x1000, NVOBJ_FLAG_ZERO_ALLOC, &chan);
1098 if (ret) {
1099 nv_error(priv, "failed to allocate channel memory, %d\n", ret);
1920 return ret; 1100 return ret;
1921
1922 r000260 = nv_rd32(priv, 0x000260);
1923 nv_wr32(priv, 0x000260, r000260 & ~1);
1924 nv_wr32(priv, 0x400208, 0x00000000);
1925
1926 nvc0_grctx_generate_dispatch(priv);
1927 nvc0_grctx_generate_macro(priv);
1928 nvc0_grctx_generate_m2mf(priv);
1929 nvc0_grctx_generate_unk47xx(priv);
1930 nvc0_grctx_generate_shaders(priv);
1931 nvc0_grctx_generate_unk60xx(priv);
1932 nvc0_grctx_generate_unk64xx(priv);
1933 nvc0_grctx_generate_tpbus(priv);
1934 nvc0_grctx_generate_ccache(priv);
1935 nvc0_grctx_generate_rop(priv);
1936 nvc0_grctx_generate_gpc(priv);
1937 nvc0_grctx_generate_tp(priv);
1938
1939 nv_wr32(priv, 0x404154, 0x00000000);
1940
1941 /* generate per-context mmio list data */
1942 mmio_data(0x002000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
1943 mmio_data(0x008000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
1944 mmio_data(0x060000, 0x1000, NV_MEM_ACCESS_RW);
1945 mmio_list(0x408004, 0x00000000, 8, 0);
1946 mmio_list(0x408008, 0x80000018, 0, 0);
1947 mmio_list(0x40800c, 0x00000000, 8, 1);
1948 mmio_list(0x408010, 0x80000000, 0, 0);
1949 mmio_list(0x418810, 0x80000000, 12, 2);
1950 mmio_list(0x419848, 0x10000000, 12, 2);
1951 mmio_list(0x419004, 0x00000000, 8, 1);
1952 mmio_list(0x419008, 0x00000000, 0, 0);
1953 mmio_list(0x418808, 0x00000000, 8, 0);
1954 mmio_list(0x41880c, 0x80000018, 0, 0);
1955 if (nv_device(priv)->chipset != 0xc1) {
1956 tmp = 0x02180000;
1957 mmio_list(0x405830, tmp, 0, 0);
1958 for (gpc = 0; gpc < priv->gpc_nr; gpc++) {
1959 for (tpc = 0; tpc < priv->tpc_nr[gpc]; tpc++) {
1960 u32 reg = TPC_UNIT(gpc, tpc, 0x0520);
1961 mmio_list(reg, tmp, 0, 0);
1962 tmp += 0x0324;
1963 }
1964 }
1965 } else {
1966 tmp = 0x02180000;
1967 mmio_list(0x405830, 0x00000218 | tmp, 0, 0);
1968 mmio_list(0x4064c4, 0x0086ffff, 0, 0);
1969 for (gpc = 0; gpc < priv->gpc_nr; gpc++) {
1970 for (tpc = 0; tpc < priv->tpc_nr[gpc]; tpc++) {
1971 u32 reg = TPC_UNIT(gpc, tpc, 0x0520);
1972 mmio_list(reg, 0x10000000 | tmp, 0, 0);
1973 tmp += 0x0324;
1974 }
1975 for (tpc = 0; tpc < priv->tpc_nr[gpc]; tpc++) {
1976 u32 reg = TPC_UNIT(gpc, tpc, 0x0544);
1977 mmio_list(reg, tmp, 0, 0);
1978 tmp += 0x0324;
1979 }
1980 }
1981 } 1101 }
1982 1102
1983 for (tpc = 0, id = 0; tpc < 4; tpc++) { 1103 /* PGD pointer */
1984 for (gpc = 0; gpc < priv->gpc_nr; gpc++) { 1104 nv_wo32(chan, 0x0200, lower_32_bits(chan->addr + 0x1000));
1985 if (tpc < priv->tpc_nr[gpc]) { 1105 nv_wo32(chan, 0x0204, upper_32_bits(chan->addr + 0x1000));
1986 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x698), id); 1106 nv_wo32(chan, 0x0208, 0xffffffff);
1987 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x4e8), id); 1107 nv_wo32(chan, 0x020c, 0x000000ff);
1988 nv_wr32(priv, GPC_UNIT(gpc, 0x0c10 + tpc * 4), id);
1989 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x088), id);
1990 id++;
1991 }
1992
1993 nv_wr32(priv, GPC_UNIT(gpc, 0x0c08), priv->tpc_nr[gpc]);
1994 nv_wr32(priv, GPC_UNIT(gpc, 0x0c8c), priv->tpc_nr[gpc]);
1995 }
1996 }
1997
1998 tmp = 0;
1999 for (i = 0; i < priv->gpc_nr; i++)
2000 tmp |= priv->tpc_nr[i] << (i * 4);
2001 nv_wr32(priv, 0x406028, tmp);
2002 nv_wr32(priv, 0x405870, tmp);
2003
2004 nv_wr32(priv, 0x40602c, 0x00000000);
2005 nv_wr32(priv, 0x405874, 0x00000000);
2006 nv_wr32(priv, 0x406030, 0x00000000);
2007 nv_wr32(priv, 0x405878, 0x00000000);
2008 nv_wr32(priv, 0x406034, 0x00000000);
2009 nv_wr32(priv, 0x40587c, 0x00000000);
2010
2011 if (1) {
2012 u8 tpcnr[GPC_MAX], data[TPC_MAX];
2013
2014 memcpy(tpcnr, priv->tpc_nr, sizeof(priv->tpc_nr));
2015 memset(data, 0x1f, sizeof(data));
2016 1108
2017 gpc = -1; 1109 /* PGT[0] pointer */
2018 for (tpc = 0; tpc < priv->tpc_total; tpc++) { 1110 nv_wo32(chan, 0x1000, 0x00000000);
2019 do { 1111 nv_wo32(chan, 0x1004, 0x00000001 | (chan->addr + 0x2000) >> 8);
2020 gpc = (gpc + 1) % priv->gpc_nr;
2021 } while (!tpcnr[gpc]);
2022 tpcnr[gpc]--;
2023 data[tpc] = gpc;
2024 }
2025 1112
2026 for (i = 0; i < 4; i++) 1113 /* identity-map the whole "channel" into its own vm */
2027 nv_wr32(priv, 0x4060a8 + (i * 4), ((u32 *)data)[i]); 1114 for (i = 0; i < chan->size / 4096; i++) {
1115 u64 addr = ((chan->addr + (i * 4096)) >> 8) | 1;
1116 nv_wo32(chan, 0x2000 + (i * 8), lower_32_bits(addr));
1117 nv_wo32(chan, 0x2004 + (i * 8), upper_32_bits(addr));
2028 } 1118 }
2029 1119
2030 if (1) { 1120 /* context pointer (virt) */
2031 u32 data[6] = {}, data2[2] = {}; 1121 nv_wo32(chan, 0x0210, 0x00080004);
2032 u8 tpcnr[GPC_MAX]; 1122 nv_wo32(chan, 0x0214, 0x00000000);
2033 u8 shift, ntpcv;
2034
2035 /* calculate first set of magics */
2036 memcpy(tpcnr, priv->tpc_nr, sizeof(priv->tpc_nr));
2037 1123
2038 gpc = -1; 1124 bar->flush(bar);
2039 for (tpc = 0; tpc < priv->tpc_total; tpc++) {
2040 do {
2041 gpc = (gpc + 1) % priv->gpc_nr;
2042 } while (!tpcnr[gpc]);
2043 tpcnr[gpc]--;
2044 1125
2045 data[tpc / 6] |= gpc << ((tpc % 6) * 5); 1126 nv_wr32(priv, 0x100cb8, (chan->addr + 0x1000) >> 8);
2046 } 1127 nv_wr32(priv, 0x100cbc, 0x80000001);
1128 nv_wait(priv, 0x100c80, 0x00008000, 0x00008000);
2047 1129
2048 for (; tpc < 32; tpc++) 1130 /* setup default state for mmio list construction */
2049 data[tpc / 6] |= 7 << ((tpc % 6) * 5); 1131 info.priv = priv;
1132 info.data = priv->mmio_data;
1133 info.mmio = priv->mmio_list;
1134 info.addr = 0x2000 + (i * 8);
1135 info.buffer_nr = 0;
2050 1136
2051 /* and the second... */ 1137 /* make channel current */
2052 shift = 0; 1138 if (priv->firmware) {
2053 ntpcv = priv->tpc_total; 1139 nv_wr32(priv, 0x409840, 0x00000030);
2054 while (!(ntpcv & (1 << 4))) { 1140 nv_wr32(priv, 0x409500, 0x80000000 | chan->addr >> 12);
2055 ntpcv <<= 1; 1141 nv_wr32(priv, 0x409504, 0x00000003);
2056 shift++; 1142 if (!nv_wait(priv, 0x409800, 0x00000010, 0x00000010))
2057 } 1143 nv_error(priv, "load_ctx timeout\n");
2058 1144
2059 data2[0] = (ntpcv << 16); 1145 nv_wo32(chan, 0x8001c, 1);
2060 data2[0] |= (shift << 21); 1146 nv_wo32(chan, 0x80020, 0);
2061 data2[0] |= (((1 << (0 + 5)) % ntpcv) << 24); 1147 nv_wo32(chan, 0x80028, 0);
2062 for (i = 1; i < 7; i++) 1148 nv_wo32(chan, 0x8002c, 0);
2063 data2[1] |= ((1 << (i + 5)) % ntpcv) << ((i - 1) * 5); 1149 bar->flush(bar);
2064 1150 } else {
2065 /* GPC_BROADCAST */ 1151 nv_wr32(priv, 0x409840, 0x80000000);
2066 nv_wr32(priv, 0x418bb8, (priv->tpc_total << 8) | 1152 nv_wr32(priv, 0x409500, 0x80000000 | chan->addr >> 12);
2067 priv->magic_not_rop_nr); 1153 nv_wr32(priv, 0x409504, 0x00000001);
2068 for (i = 0; i < 6; i++) 1154 if (!nv_wait(priv, 0x409800, 0x80000000, 0x80000000))
2069 nv_wr32(priv, 0x418b08 + (i * 4), data[i]); 1155 nv_error(priv, "HUB_SET_CHAN timeout\n");
2070
2071 /* GPC_BROADCAST.TP_BROADCAST */
2072 nv_wr32(priv, 0x419bd0, (priv->tpc_total << 8) |
2073 priv->magic_not_rop_nr |
2074 data2[0]);
2075 nv_wr32(priv, 0x419be4, data2[1]);
2076 for (i = 0; i < 6; i++)
2077 nv_wr32(priv, 0x419b00 + (i * 4), data[i]);
2078
2079 /* UNK78xx */
2080 nv_wr32(priv, 0x4078bc, (priv->tpc_total << 8) |
2081 priv->magic_not_rop_nr);
2082 for (i = 0; i < 6; i++)
2083 nv_wr32(priv, 0x40780c + (i * 4), data[i]);
2084 } 1156 }
2085 1157
2086 if (1) { 1158 oclass->main(priv, &info);
2087 u32 tpc_mask = 0, tpc_set = 0;
2088 u8 tpcnr[GPC_MAX], a, b;
2089
2090 memcpy(tpcnr, priv->tpc_nr, sizeof(priv->tpc_nr));
2091 for (gpc = 0; gpc < priv->gpc_nr; gpc++)
2092 tpc_mask |= ((1 << priv->tpc_nr[gpc]) - 1) << (gpc * 8);
2093
2094 for (i = 0, gpc = -1, b = -1; i < 32; i++) {
2095 a = (i * (priv->tpc_total - 1)) / 32;
2096 if (a != b) {
2097 b = a;
2098 do {
2099 gpc = (gpc + 1) % priv->gpc_nr;
2100 } while (!tpcnr[gpc]);
2101 tpc = priv->tpc_nr[gpc] - tpcnr[gpc]--;
2102
2103 tpc_set |= 1 << ((gpc * 8) + tpc);
2104 }
2105 1159
2106 nv_wr32(priv, 0x406800 + (i * 0x20), tpc_set); 1160 /* trigger a context unload by unsetting the "next channel valid" bit
2107 nv_wr32(priv, 0x406c00 + (i * 0x20), tpc_set ^ tpc_mask); 1161 * and faking a context switch interrupt
2108 } 1162 */
1163 nv_mask(priv, 0x409b04, 0x80000000, 0x00000000);
1164 nv_wr32(priv, 0x409000, 0x00000100);
1165 if (!nv_wait(priv, 0x409b00, 0x80000000, 0x00000000)) {
1166 nv_error(priv, "grctx template channel unload timeout\n");
1167 ret = -EBUSY;
1168 goto done;
2109 } 1169 }
2110 1170
2111 nv_wr32(priv, 0x400208, 0x80000000); 1171 priv->data = kmalloc(priv->size, GFP_KERNEL);
2112 1172 if (priv->data) {
2113 nv_icmd(priv, 0x00001000, 0x00000004); 1173 for (i = 0; i < priv->size; i += 4)
2114 nv_icmd(priv, 0x000000a9, 0x0000ffff); 1174 priv->data[i / 4] = nv_ro32(chan, 0x80000 + i);
2115 nv_icmd(priv, 0x00000038, 0x0fac6881); 1175 ret = 0;
2116 nv_icmd(priv, 0x0000003d, 0x00000001); 1176 } else {
2117 nv_icmd(priv, 0x000000e8, 0x00000400); 1177 ret = -ENOMEM;
2118 nv_icmd(priv, 0x000000e9, 0x00000400);
2119 nv_icmd(priv, 0x000000ea, 0x00000400);
2120 nv_icmd(priv, 0x000000eb, 0x00000400);
2121 nv_icmd(priv, 0x000000ec, 0x00000400);
2122 nv_icmd(priv, 0x000000ed, 0x00000400);
2123 nv_icmd(priv, 0x000000ee, 0x00000400);
2124 nv_icmd(priv, 0x000000ef, 0x00000400);
2125 nv_icmd(priv, 0x00000078, 0x00000300);
2126 nv_icmd(priv, 0x00000079, 0x00000300);
2127 nv_icmd(priv, 0x0000007a, 0x00000300);
2128 nv_icmd(priv, 0x0000007b, 0x00000300);
2129 nv_icmd(priv, 0x0000007c, 0x00000300);
2130 nv_icmd(priv, 0x0000007d, 0x00000300);
2131 nv_icmd(priv, 0x0000007e, 0x00000300);
2132 nv_icmd(priv, 0x0000007f, 0x00000300);
2133 nv_icmd(priv, 0x00000050, 0x00000011);
2134 nv_icmd(priv, 0x00000058, 0x00000008);
2135 nv_icmd(priv, 0x00000059, 0x00000008);
2136 nv_icmd(priv, 0x0000005a, 0x00000008);
2137 nv_icmd(priv, 0x0000005b, 0x00000008);
2138 nv_icmd(priv, 0x0000005c, 0x00000008);
2139 nv_icmd(priv, 0x0000005d, 0x00000008);
2140 nv_icmd(priv, 0x0000005e, 0x00000008);
2141 nv_icmd(priv, 0x0000005f, 0x00000008);
2142 nv_icmd(priv, 0x00000208, 0x00000001);
2143 nv_icmd(priv, 0x00000209, 0x00000001);
2144 nv_icmd(priv, 0x0000020a, 0x00000001);
2145 nv_icmd(priv, 0x0000020b, 0x00000001);
2146 nv_icmd(priv, 0x0000020c, 0x00000001);
2147 nv_icmd(priv, 0x0000020d, 0x00000001);
2148 nv_icmd(priv, 0x0000020e, 0x00000001);
2149 nv_icmd(priv, 0x0000020f, 0x00000001);
2150 nv_icmd(priv, 0x00000081, 0x00000001);
2151 nv_icmd(priv, 0x00000085, 0x00000004);
2152 nv_icmd(priv, 0x00000088, 0x00000400);
2153 nv_icmd(priv, 0x00000090, 0x00000300);
2154 nv_icmd(priv, 0x00000098, 0x00001001);
2155 nv_icmd(priv, 0x000000e3, 0x00000001);
2156 nv_icmd(priv, 0x000000da, 0x00000001);
2157 nv_icmd(priv, 0x000000f8, 0x00000003);
2158 nv_icmd(priv, 0x000000fa, 0x00000001);
2159 nv_icmd(priv, 0x0000009f, 0x0000ffff);
2160 nv_icmd(priv, 0x000000a0, 0x0000ffff);
2161 nv_icmd(priv, 0x000000a1, 0x0000ffff);
2162 nv_icmd(priv, 0x000000a2, 0x0000ffff);
2163 nv_icmd(priv, 0x000000b1, 0x00000001);
2164 nv_icmd(priv, 0x000000b2, 0x00000000);
2165 nv_icmd(priv, 0x000000b3, 0x00000000);
2166 nv_icmd(priv, 0x000000b4, 0x00000000);
2167 nv_icmd(priv, 0x000000b5, 0x00000000);
2168 nv_icmd(priv, 0x000000b6, 0x00000000);
2169 nv_icmd(priv, 0x000000b7, 0x00000000);
2170 nv_icmd(priv, 0x000000b8, 0x00000000);
2171 nv_icmd(priv, 0x000000b9, 0x00000000);
2172 nv_icmd(priv, 0x000000ba, 0x00000000);
2173 nv_icmd(priv, 0x000000bb, 0x00000000);
2174 nv_icmd(priv, 0x000000bc, 0x00000000);
2175 nv_icmd(priv, 0x000000bd, 0x00000000);
2176 nv_icmd(priv, 0x000000be, 0x00000000);
2177 nv_icmd(priv, 0x000000bf, 0x00000000);
2178 nv_icmd(priv, 0x000000c0, 0x00000000);
2179 nv_icmd(priv, 0x000000c1, 0x00000000);
2180 nv_icmd(priv, 0x000000c2, 0x00000000);
2181 nv_icmd(priv, 0x000000c3, 0x00000000);
2182 nv_icmd(priv, 0x000000c4, 0x00000000);
2183 nv_icmd(priv, 0x000000c5, 0x00000000);
2184 nv_icmd(priv, 0x000000c6, 0x00000000);
2185 nv_icmd(priv, 0x000000c7, 0x00000000);
2186 nv_icmd(priv, 0x000000c8, 0x00000000);
2187 nv_icmd(priv, 0x000000c9, 0x00000000);
2188 nv_icmd(priv, 0x000000ca, 0x00000000);
2189 nv_icmd(priv, 0x000000cb, 0x00000000);
2190 nv_icmd(priv, 0x000000cc, 0x00000000);
2191 nv_icmd(priv, 0x000000cd, 0x00000000);
2192 nv_icmd(priv, 0x000000ce, 0x00000000);
2193 nv_icmd(priv, 0x000000cf, 0x00000000);
2194 nv_icmd(priv, 0x000000d0, 0x00000000);
2195 nv_icmd(priv, 0x000000d1, 0x00000000);
2196 nv_icmd(priv, 0x000000d2, 0x00000000);
2197 nv_icmd(priv, 0x000000d3, 0x00000000);
2198 nv_icmd(priv, 0x000000d4, 0x00000000);
2199 nv_icmd(priv, 0x000000d5, 0x00000000);
2200 nv_icmd(priv, 0x000000d6, 0x00000000);
2201 nv_icmd(priv, 0x000000d7, 0x00000000);
2202 nv_icmd(priv, 0x000000d8, 0x00000000);
2203 nv_icmd(priv, 0x000000d9, 0x00000000);
2204 nv_icmd(priv, 0x00000210, 0x00000040);
2205 nv_icmd(priv, 0x00000211, 0x00000040);
2206 nv_icmd(priv, 0x00000212, 0x00000040);
2207 nv_icmd(priv, 0x00000213, 0x00000040);
2208 nv_icmd(priv, 0x00000214, 0x00000040);
2209 nv_icmd(priv, 0x00000215, 0x00000040);
2210 nv_icmd(priv, 0x00000216, 0x00000040);
2211 nv_icmd(priv, 0x00000217, 0x00000040);
2212 if (nv_device(priv)->chipset >= 0xd0) {
2213 for (i = 0x0400; i <= 0x0417; i++)
2214 nv_icmd(priv, i, 0x00000040);
2215 }
2216 nv_icmd(priv, 0x00000218, 0x0000c080);
2217 nv_icmd(priv, 0x00000219, 0x0000c080);
2218 nv_icmd(priv, 0x0000021a, 0x0000c080);
2219 nv_icmd(priv, 0x0000021b, 0x0000c080);
2220 nv_icmd(priv, 0x0000021c, 0x0000c080);
2221 nv_icmd(priv, 0x0000021d, 0x0000c080);
2222 nv_icmd(priv, 0x0000021e, 0x0000c080);
2223 nv_icmd(priv, 0x0000021f, 0x0000c080);
2224 if (nv_device(priv)->chipset >= 0xd0) {
2225 for (i = 0x0440; i <= 0x0457; i++)
2226 nv_icmd(priv, i, 0x0000c080);
2227 } 1178 }
2228 nv_icmd(priv, 0x000000ad, 0x0000013e);
2229 nv_icmd(priv, 0x000000e1, 0x00000010);
2230 nv_icmd(priv, 0x00000290, 0x00000000);
2231 nv_icmd(priv, 0x00000291, 0x00000000);
2232 nv_icmd(priv, 0x00000292, 0x00000000);
2233 nv_icmd(priv, 0x00000293, 0x00000000);
2234 nv_icmd(priv, 0x00000294, 0x00000000);
2235 nv_icmd(priv, 0x00000295, 0x00000000);
2236 nv_icmd(priv, 0x00000296, 0x00000000);
2237 nv_icmd(priv, 0x00000297, 0x00000000);
2238 nv_icmd(priv, 0x00000298, 0x00000000);
2239 nv_icmd(priv, 0x00000299, 0x00000000);
2240 nv_icmd(priv, 0x0000029a, 0x00000000);
2241 nv_icmd(priv, 0x0000029b, 0x00000000);
2242 nv_icmd(priv, 0x0000029c, 0x00000000);
2243 nv_icmd(priv, 0x0000029d, 0x00000000);
2244 nv_icmd(priv, 0x0000029e, 0x00000000);
2245 nv_icmd(priv, 0x0000029f, 0x00000000);
2246 nv_icmd(priv, 0x000003b0, 0x00000000);
2247 nv_icmd(priv, 0x000003b1, 0x00000000);
2248 nv_icmd(priv, 0x000003b2, 0x00000000);
2249 nv_icmd(priv, 0x000003b3, 0x00000000);
2250 nv_icmd(priv, 0x000003b4, 0x00000000);
2251 nv_icmd(priv, 0x000003b5, 0x00000000);
2252 nv_icmd(priv, 0x000003b6, 0x00000000);
2253 nv_icmd(priv, 0x000003b7, 0x00000000);
2254 nv_icmd(priv, 0x000003b8, 0x00000000);
2255 nv_icmd(priv, 0x000003b9, 0x00000000);
2256 nv_icmd(priv, 0x000003ba, 0x00000000);
2257 nv_icmd(priv, 0x000003bb, 0x00000000);
2258 nv_icmd(priv, 0x000003bc, 0x00000000);
2259 nv_icmd(priv, 0x000003bd, 0x00000000);
2260 nv_icmd(priv, 0x000003be, 0x00000000);
2261 nv_icmd(priv, 0x000003bf, 0x00000000);
2262 nv_icmd(priv, 0x000002a0, 0x00000000);
2263 nv_icmd(priv, 0x000002a1, 0x00000000);
2264 nv_icmd(priv, 0x000002a2, 0x00000000);
2265 nv_icmd(priv, 0x000002a3, 0x00000000);
2266 nv_icmd(priv, 0x000002a4, 0x00000000);
2267 nv_icmd(priv, 0x000002a5, 0x00000000);
2268 nv_icmd(priv, 0x000002a6, 0x00000000);
2269 nv_icmd(priv, 0x000002a7, 0x00000000);
2270 nv_icmd(priv, 0x000002a8, 0x00000000);
2271 nv_icmd(priv, 0x000002a9, 0x00000000);
2272 nv_icmd(priv, 0x000002aa, 0x00000000);
2273 nv_icmd(priv, 0x000002ab, 0x00000000);
2274 nv_icmd(priv, 0x000002ac, 0x00000000);
2275 nv_icmd(priv, 0x000002ad, 0x00000000);
2276 nv_icmd(priv, 0x000002ae, 0x00000000);
2277 nv_icmd(priv, 0x000002af, 0x00000000);
2278 nv_icmd(priv, 0x00000420, 0x00000000);
2279 nv_icmd(priv, 0x00000421, 0x00000000);
2280 nv_icmd(priv, 0x00000422, 0x00000000);
2281 nv_icmd(priv, 0x00000423, 0x00000000);
2282 nv_icmd(priv, 0x00000424, 0x00000000);
2283 nv_icmd(priv, 0x00000425, 0x00000000);
2284 nv_icmd(priv, 0x00000426, 0x00000000);
2285 nv_icmd(priv, 0x00000427, 0x00000000);
2286 nv_icmd(priv, 0x00000428, 0x00000000);
2287 nv_icmd(priv, 0x00000429, 0x00000000);
2288 nv_icmd(priv, 0x0000042a, 0x00000000);
2289 nv_icmd(priv, 0x0000042b, 0x00000000);
2290 nv_icmd(priv, 0x0000042c, 0x00000000);
2291 nv_icmd(priv, 0x0000042d, 0x00000000);
2292 nv_icmd(priv, 0x0000042e, 0x00000000);
2293 nv_icmd(priv, 0x0000042f, 0x00000000);
2294 nv_icmd(priv, 0x000002b0, 0x00000000);
2295 nv_icmd(priv, 0x000002b1, 0x00000000);
2296 nv_icmd(priv, 0x000002b2, 0x00000000);
2297 nv_icmd(priv, 0x000002b3, 0x00000000);
2298 nv_icmd(priv, 0x000002b4, 0x00000000);
2299 nv_icmd(priv, 0x000002b5, 0x00000000);
2300 nv_icmd(priv, 0x000002b6, 0x00000000);
2301 nv_icmd(priv, 0x000002b7, 0x00000000);
2302 nv_icmd(priv, 0x000002b8, 0x00000000);
2303 nv_icmd(priv, 0x000002b9, 0x00000000);
2304 nv_icmd(priv, 0x000002ba, 0x00000000);
2305 nv_icmd(priv, 0x000002bb, 0x00000000);
2306 nv_icmd(priv, 0x000002bc, 0x00000000);
2307 nv_icmd(priv, 0x000002bd, 0x00000000);
2308 nv_icmd(priv, 0x000002be, 0x00000000);
2309 nv_icmd(priv, 0x000002bf, 0x00000000);
2310 nv_icmd(priv, 0x00000430, 0x00000000);
2311 nv_icmd(priv, 0x00000431, 0x00000000);
2312 nv_icmd(priv, 0x00000432, 0x00000000);
2313 nv_icmd(priv, 0x00000433, 0x00000000);
2314 nv_icmd(priv, 0x00000434, 0x00000000);
2315 nv_icmd(priv, 0x00000435, 0x00000000);
2316 nv_icmd(priv, 0x00000436, 0x00000000);
2317 nv_icmd(priv, 0x00000437, 0x00000000);
2318 nv_icmd(priv, 0x00000438, 0x00000000);
2319 nv_icmd(priv, 0x00000439, 0x00000000);
2320 nv_icmd(priv, 0x0000043a, 0x00000000);
2321 nv_icmd(priv, 0x0000043b, 0x00000000);
2322 nv_icmd(priv, 0x0000043c, 0x00000000);
2323 nv_icmd(priv, 0x0000043d, 0x00000000);
2324 nv_icmd(priv, 0x0000043e, 0x00000000);
2325 nv_icmd(priv, 0x0000043f, 0x00000000);
2326 nv_icmd(priv, 0x000002c0, 0x00000000);
2327 nv_icmd(priv, 0x000002c1, 0x00000000);
2328 nv_icmd(priv, 0x000002c2, 0x00000000);
2329 nv_icmd(priv, 0x000002c3, 0x00000000);
2330 nv_icmd(priv, 0x000002c4, 0x00000000);
2331 nv_icmd(priv, 0x000002c5, 0x00000000);
2332 nv_icmd(priv, 0x000002c6, 0x00000000);
2333 nv_icmd(priv, 0x000002c7, 0x00000000);
2334 nv_icmd(priv, 0x000002c8, 0x00000000);
2335 nv_icmd(priv, 0x000002c9, 0x00000000);
2336 nv_icmd(priv, 0x000002ca, 0x00000000);
2337 nv_icmd(priv, 0x000002cb, 0x00000000);
2338 nv_icmd(priv, 0x000002cc, 0x00000000);
2339 nv_icmd(priv, 0x000002cd, 0x00000000);
2340 nv_icmd(priv, 0x000002ce, 0x00000000);
2341 nv_icmd(priv, 0x000002cf, 0x00000000);
2342 nv_icmd(priv, 0x000004d0, 0x00000000);
2343 nv_icmd(priv, 0x000004d1, 0x00000000);
2344 nv_icmd(priv, 0x000004d2, 0x00000000);
2345 nv_icmd(priv, 0x000004d3, 0x00000000);
2346 nv_icmd(priv, 0x000004d4, 0x00000000);
2347 nv_icmd(priv, 0x000004d5, 0x00000000);
2348 nv_icmd(priv, 0x000004d6, 0x00000000);
2349 nv_icmd(priv, 0x000004d7, 0x00000000);
2350 nv_icmd(priv, 0x000004d8, 0x00000000);
2351 nv_icmd(priv, 0x000004d9, 0x00000000);
2352 nv_icmd(priv, 0x000004da, 0x00000000);
2353 nv_icmd(priv, 0x000004db, 0x00000000);
2354 nv_icmd(priv, 0x000004dc, 0x00000000);
2355 nv_icmd(priv, 0x000004dd, 0x00000000);
2356 nv_icmd(priv, 0x000004de, 0x00000000);
2357 nv_icmd(priv, 0x000004df, 0x00000000);
2358 nv_icmd(priv, 0x00000720, 0x00000000);
2359 nv_icmd(priv, 0x00000721, 0x00000000);
2360 nv_icmd(priv, 0x00000722, 0x00000000);
2361 nv_icmd(priv, 0x00000723, 0x00000000);
2362 nv_icmd(priv, 0x00000724, 0x00000000);
2363 nv_icmd(priv, 0x00000725, 0x00000000);
2364 nv_icmd(priv, 0x00000726, 0x00000000);
2365 nv_icmd(priv, 0x00000727, 0x00000000);
2366 nv_icmd(priv, 0x00000728, 0x00000000);
2367 nv_icmd(priv, 0x00000729, 0x00000000);
2368 nv_icmd(priv, 0x0000072a, 0x00000000);
2369 nv_icmd(priv, 0x0000072b, 0x00000000);
2370 nv_icmd(priv, 0x0000072c, 0x00000000);
2371 nv_icmd(priv, 0x0000072d, 0x00000000);
2372 nv_icmd(priv, 0x0000072e, 0x00000000);
2373 nv_icmd(priv, 0x0000072f, 0x00000000);
2374 nv_icmd(priv, 0x000008c0, 0x00000000);
2375 nv_icmd(priv, 0x000008c1, 0x00000000);
2376 nv_icmd(priv, 0x000008c2, 0x00000000);
2377 nv_icmd(priv, 0x000008c3, 0x00000000);
2378 nv_icmd(priv, 0x000008c4, 0x00000000);
2379 nv_icmd(priv, 0x000008c5, 0x00000000);
2380 nv_icmd(priv, 0x000008c6, 0x00000000);
2381 nv_icmd(priv, 0x000008c7, 0x00000000);
2382 nv_icmd(priv, 0x000008c8, 0x00000000);
2383 nv_icmd(priv, 0x000008c9, 0x00000000);
2384 nv_icmd(priv, 0x000008ca, 0x00000000);
2385 nv_icmd(priv, 0x000008cb, 0x00000000);
2386 nv_icmd(priv, 0x000008cc, 0x00000000);
2387 nv_icmd(priv, 0x000008cd, 0x00000000);
2388 nv_icmd(priv, 0x000008ce, 0x00000000);
2389 nv_icmd(priv, 0x000008cf, 0x00000000);
2390 nv_icmd(priv, 0x00000890, 0x00000000);
2391 nv_icmd(priv, 0x00000891, 0x00000000);
2392 nv_icmd(priv, 0x00000892, 0x00000000);
2393 nv_icmd(priv, 0x00000893, 0x00000000);
2394 nv_icmd(priv, 0x00000894, 0x00000000);
2395 nv_icmd(priv, 0x00000895, 0x00000000);
2396 nv_icmd(priv, 0x00000896, 0x00000000);
2397 nv_icmd(priv, 0x00000897, 0x00000000);
2398 nv_icmd(priv, 0x00000898, 0x00000000);
2399 nv_icmd(priv, 0x00000899, 0x00000000);
2400 nv_icmd(priv, 0x0000089a, 0x00000000);
2401 nv_icmd(priv, 0x0000089b, 0x00000000);
2402 nv_icmd(priv, 0x0000089c, 0x00000000);
2403 nv_icmd(priv, 0x0000089d, 0x00000000);
2404 nv_icmd(priv, 0x0000089e, 0x00000000);
2405 nv_icmd(priv, 0x0000089f, 0x00000000);
2406 nv_icmd(priv, 0x000008e0, 0x00000000);
2407 nv_icmd(priv, 0x000008e1, 0x00000000);
2408 nv_icmd(priv, 0x000008e2, 0x00000000);
2409 nv_icmd(priv, 0x000008e3, 0x00000000);
2410 nv_icmd(priv, 0x000008e4, 0x00000000);
2411 nv_icmd(priv, 0x000008e5, 0x00000000);
2412 nv_icmd(priv, 0x000008e6, 0x00000000);
2413 nv_icmd(priv, 0x000008e7, 0x00000000);
2414 nv_icmd(priv, 0x000008e8, 0x00000000);
2415 nv_icmd(priv, 0x000008e9, 0x00000000);
2416 nv_icmd(priv, 0x000008ea, 0x00000000);
2417 nv_icmd(priv, 0x000008eb, 0x00000000);
2418 nv_icmd(priv, 0x000008ec, 0x00000000);
2419 nv_icmd(priv, 0x000008ed, 0x00000000);
2420 nv_icmd(priv, 0x000008ee, 0x00000000);
2421 nv_icmd(priv, 0x000008ef, 0x00000000);
2422 nv_icmd(priv, 0x000008a0, 0x00000000);
2423 nv_icmd(priv, 0x000008a1, 0x00000000);
2424 nv_icmd(priv, 0x000008a2, 0x00000000);
2425 nv_icmd(priv, 0x000008a3, 0x00000000);
2426 nv_icmd(priv, 0x000008a4, 0x00000000);
2427 nv_icmd(priv, 0x000008a5, 0x00000000);
2428 nv_icmd(priv, 0x000008a6, 0x00000000);
2429 nv_icmd(priv, 0x000008a7, 0x00000000);
2430 nv_icmd(priv, 0x000008a8, 0x00000000);
2431 nv_icmd(priv, 0x000008a9, 0x00000000);
2432 nv_icmd(priv, 0x000008aa, 0x00000000);
2433 nv_icmd(priv, 0x000008ab, 0x00000000);
2434 nv_icmd(priv, 0x000008ac, 0x00000000);
2435 nv_icmd(priv, 0x000008ad, 0x00000000);
2436 nv_icmd(priv, 0x000008ae, 0x00000000);
2437 nv_icmd(priv, 0x000008af, 0x00000000);
2438 nv_icmd(priv, 0x000008f0, 0x00000000);
2439 nv_icmd(priv, 0x000008f1, 0x00000000);
2440 nv_icmd(priv, 0x000008f2, 0x00000000);
2441 nv_icmd(priv, 0x000008f3, 0x00000000);
2442 nv_icmd(priv, 0x000008f4, 0x00000000);
2443 nv_icmd(priv, 0x000008f5, 0x00000000);
2444 nv_icmd(priv, 0x000008f6, 0x00000000);
2445 nv_icmd(priv, 0x000008f7, 0x00000000);
2446 nv_icmd(priv, 0x000008f8, 0x00000000);
2447 nv_icmd(priv, 0x000008f9, 0x00000000);
2448 nv_icmd(priv, 0x000008fa, 0x00000000);
2449 nv_icmd(priv, 0x000008fb, 0x00000000);
2450 nv_icmd(priv, 0x000008fc, 0x00000000);
2451 nv_icmd(priv, 0x000008fd, 0x00000000);
2452 nv_icmd(priv, 0x000008fe, 0x00000000);
2453 nv_icmd(priv, 0x000008ff, 0x00000000);
2454 nv_icmd(priv, 0x0000094c, 0x000000ff);
2455 nv_icmd(priv, 0x0000094d, 0xffffffff);
2456 nv_icmd(priv, 0x0000094e, 0x00000002);
2457 nv_icmd(priv, 0x000002ec, 0x00000001);
2458 nv_icmd(priv, 0x00000303, 0x00000001);
2459 nv_icmd(priv, 0x000002e6, 0x00000001);
2460 nv_icmd(priv, 0x00000466, 0x00000052);
2461 nv_icmd(priv, 0x00000301, 0x3f800000);
2462 nv_icmd(priv, 0x00000304, 0x30201000);
2463 nv_icmd(priv, 0x00000305, 0x70605040);
2464 nv_icmd(priv, 0x00000306, 0xb8a89888);
2465 nv_icmd(priv, 0x00000307, 0xf8e8d8c8);
2466 nv_icmd(priv, 0x0000030a, 0x00ffff00);
2467 nv_icmd(priv, 0x0000030b, 0x0000001a);
2468 nv_icmd(priv, 0x0000030c, 0x00000001);
2469 nv_icmd(priv, 0x00000318, 0x00000001);
2470 nv_icmd(priv, 0x00000340, 0x00000000);
2471 nv_icmd(priv, 0x00000375, 0x00000001);
2472 nv_icmd(priv, 0x00000351, 0x00000100);
2473 nv_icmd(priv, 0x0000037d, 0x00000006);
2474 nv_icmd(priv, 0x000003a0, 0x00000002);
2475 nv_icmd(priv, 0x000003aa, 0x00000001);
2476 nv_icmd(priv, 0x000003a9, 0x00000001);
2477 nv_icmd(priv, 0x00000380, 0x00000001);
2478 nv_icmd(priv, 0x00000360, 0x00000040);
2479 nv_icmd(priv, 0x00000366, 0x00000000);
2480 nv_icmd(priv, 0x00000367, 0x00000000);
2481 nv_icmd(priv, 0x00000368, 0x00001fff);
2482 nv_icmd(priv, 0x00000370, 0x00000000);
2483 nv_icmd(priv, 0x00000371, 0x00000000);
2484 nv_icmd(priv, 0x00000372, 0x003fffff);
2485 nv_icmd(priv, 0x0000037a, 0x00000012);
2486 nv_icmd(priv, 0x000005e0, 0x00000022);
2487 nv_icmd(priv, 0x000005e1, 0x00000022);
2488 nv_icmd(priv, 0x000005e2, 0x00000022);
2489 nv_icmd(priv, 0x000005e3, 0x00000022);
2490 nv_icmd(priv, 0x000005e4, 0x00000022);
2491 nv_icmd(priv, 0x00000619, 0x00000003);
2492 nv_icmd(priv, 0x00000811, 0x00000003);
2493 nv_icmd(priv, 0x00000812, 0x00000004);
2494 nv_icmd(priv, 0x00000813, 0x00000006);
2495 nv_icmd(priv, 0x00000814, 0x00000008);
2496 nv_icmd(priv, 0x00000815, 0x0000000b);
2497 nv_icmd(priv, 0x00000800, 0x00000001);
2498 nv_icmd(priv, 0x00000801, 0x00000001);
2499 nv_icmd(priv, 0x00000802, 0x00000001);
2500 nv_icmd(priv, 0x00000803, 0x00000001);
2501 nv_icmd(priv, 0x00000804, 0x00000001);
2502 nv_icmd(priv, 0x00000805, 0x00000001);
2503 nv_icmd(priv, 0x00000632, 0x00000001);
2504 nv_icmd(priv, 0x00000633, 0x00000002);
2505 nv_icmd(priv, 0x00000634, 0x00000003);
2506 nv_icmd(priv, 0x00000635, 0x00000004);
2507 nv_icmd(priv, 0x00000654, 0x3f800000);
2508 nv_icmd(priv, 0x00000657, 0x3f800000);
2509 nv_icmd(priv, 0x00000655, 0x3f800000);
2510 nv_icmd(priv, 0x00000656, 0x3f800000);
2511 nv_icmd(priv, 0x000006cd, 0x3f800000);
2512 nv_icmd(priv, 0x000007f5, 0x3f800000);
2513 nv_icmd(priv, 0x000007dc, 0x39291909);
2514 nv_icmd(priv, 0x000007dd, 0x79695949);
2515 nv_icmd(priv, 0x000007de, 0xb9a99989);
2516 nv_icmd(priv, 0x000007df, 0xf9e9d9c9);
2517 nv_icmd(priv, 0x000007e8, 0x00003210);
2518 nv_icmd(priv, 0x000007e9, 0x00007654);
2519 nv_icmd(priv, 0x000007ea, 0x00000098);
2520 nv_icmd(priv, 0x000007ec, 0x39291909);
2521 nv_icmd(priv, 0x000007ed, 0x79695949);
2522 nv_icmd(priv, 0x000007ee, 0xb9a99989);
2523 nv_icmd(priv, 0x000007ef, 0xf9e9d9c9);
2524 nv_icmd(priv, 0x000007f0, 0x00003210);
2525 nv_icmd(priv, 0x000007f1, 0x00007654);
2526 nv_icmd(priv, 0x000007f2, 0x00000098);
2527 nv_icmd(priv, 0x000005a5, 0x00000001);
2528 nv_icmd(priv, 0x00000980, 0x00000000);
2529 nv_icmd(priv, 0x00000981, 0x00000000);
2530 nv_icmd(priv, 0x00000982, 0x00000000);
2531 nv_icmd(priv, 0x00000983, 0x00000000);
2532 nv_icmd(priv, 0x00000984, 0x00000000);
2533 nv_icmd(priv, 0x00000985, 0x00000000);
2534 nv_icmd(priv, 0x00000986, 0x00000000);
2535 nv_icmd(priv, 0x00000987, 0x00000000);
2536 nv_icmd(priv, 0x00000988, 0x00000000);
2537 nv_icmd(priv, 0x00000989, 0x00000000);
2538 nv_icmd(priv, 0x0000098a, 0x00000000);
2539 nv_icmd(priv, 0x0000098b, 0x00000000);
2540 nv_icmd(priv, 0x0000098c, 0x00000000);
2541 nv_icmd(priv, 0x0000098d, 0x00000000);
2542 nv_icmd(priv, 0x0000098e, 0x00000000);
2543 nv_icmd(priv, 0x0000098f, 0x00000000);
2544 nv_icmd(priv, 0x00000990, 0x00000000);
2545 nv_icmd(priv, 0x00000991, 0x00000000);
2546 nv_icmd(priv, 0x00000992, 0x00000000);
2547 nv_icmd(priv, 0x00000993, 0x00000000);
2548 nv_icmd(priv, 0x00000994, 0x00000000);
2549 nv_icmd(priv, 0x00000995, 0x00000000);
2550 nv_icmd(priv, 0x00000996, 0x00000000);
2551 nv_icmd(priv, 0x00000997, 0x00000000);
2552 nv_icmd(priv, 0x00000998, 0x00000000);
2553 nv_icmd(priv, 0x00000999, 0x00000000);
2554 nv_icmd(priv, 0x0000099a, 0x00000000);
2555 nv_icmd(priv, 0x0000099b, 0x00000000);
2556 nv_icmd(priv, 0x0000099c, 0x00000000);
2557 nv_icmd(priv, 0x0000099d, 0x00000000);
2558 nv_icmd(priv, 0x0000099e, 0x00000000);
2559 nv_icmd(priv, 0x0000099f, 0x00000000);
2560 nv_icmd(priv, 0x000009a0, 0x00000000);
2561 nv_icmd(priv, 0x000009a1, 0x00000000);
2562 nv_icmd(priv, 0x000009a2, 0x00000000);
2563 nv_icmd(priv, 0x000009a3, 0x00000000);
2564 nv_icmd(priv, 0x000009a4, 0x00000000);
2565 nv_icmd(priv, 0x000009a5, 0x00000000);
2566 nv_icmd(priv, 0x000009a6, 0x00000000);
2567 nv_icmd(priv, 0x000009a7, 0x00000000);
2568 nv_icmd(priv, 0x000009a8, 0x00000000);
2569 nv_icmd(priv, 0x000009a9, 0x00000000);
2570 nv_icmd(priv, 0x000009aa, 0x00000000);
2571 nv_icmd(priv, 0x000009ab, 0x00000000);
2572 nv_icmd(priv, 0x000009ac, 0x00000000);
2573 nv_icmd(priv, 0x000009ad, 0x00000000);
2574 nv_icmd(priv, 0x000009ae, 0x00000000);
2575 nv_icmd(priv, 0x000009af, 0x00000000);
2576 nv_icmd(priv, 0x000009b0, 0x00000000);
2577 nv_icmd(priv, 0x000009b1, 0x00000000);
2578 nv_icmd(priv, 0x000009b2, 0x00000000);
2579 nv_icmd(priv, 0x000009b3, 0x00000000);
2580 nv_icmd(priv, 0x000009b4, 0x00000000);
2581 nv_icmd(priv, 0x000009b5, 0x00000000);
2582 nv_icmd(priv, 0x000009b6, 0x00000000);
2583 nv_icmd(priv, 0x000009b7, 0x00000000);
2584 nv_icmd(priv, 0x000009b8, 0x00000000);
2585 nv_icmd(priv, 0x000009b9, 0x00000000);
2586 nv_icmd(priv, 0x000009ba, 0x00000000);
2587 nv_icmd(priv, 0x000009bb, 0x00000000);
2588 nv_icmd(priv, 0x000009bc, 0x00000000);
2589 nv_icmd(priv, 0x000009bd, 0x00000000);
2590 nv_icmd(priv, 0x000009be, 0x00000000);
2591 nv_icmd(priv, 0x000009bf, 0x00000000);
2592 nv_icmd(priv, 0x000009c0, 0x00000000);
2593 nv_icmd(priv, 0x000009c1, 0x00000000);
2594 nv_icmd(priv, 0x000009c2, 0x00000000);
2595 nv_icmd(priv, 0x000009c3, 0x00000000);
2596 nv_icmd(priv, 0x000009c4, 0x00000000);
2597 nv_icmd(priv, 0x000009c5, 0x00000000);
2598 nv_icmd(priv, 0x000009c6, 0x00000000);
2599 nv_icmd(priv, 0x000009c7, 0x00000000);
2600 nv_icmd(priv, 0x000009c8, 0x00000000);
2601 nv_icmd(priv, 0x000009c9, 0x00000000);
2602 nv_icmd(priv, 0x000009ca, 0x00000000);
2603 nv_icmd(priv, 0x000009cb, 0x00000000);
2604 nv_icmd(priv, 0x000009cc, 0x00000000);
2605 nv_icmd(priv, 0x000009cd, 0x00000000);
2606 nv_icmd(priv, 0x000009ce, 0x00000000);
2607 nv_icmd(priv, 0x000009cf, 0x00000000);
2608 nv_icmd(priv, 0x000009d0, 0x00000000);
2609 nv_icmd(priv, 0x000009d1, 0x00000000);
2610 nv_icmd(priv, 0x000009d2, 0x00000000);
2611 nv_icmd(priv, 0x000009d3, 0x00000000);
2612 nv_icmd(priv, 0x000009d4, 0x00000000);
2613 nv_icmd(priv, 0x000009d5, 0x00000000);
2614 nv_icmd(priv, 0x000009d6, 0x00000000);
2615 nv_icmd(priv, 0x000009d7, 0x00000000);
2616 nv_icmd(priv, 0x000009d8, 0x00000000);
2617 nv_icmd(priv, 0x000009d9, 0x00000000);
2618 nv_icmd(priv, 0x000009da, 0x00000000);
2619 nv_icmd(priv, 0x000009db, 0x00000000);
2620 nv_icmd(priv, 0x000009dc, 0x00000000);
2621 nv_icmd(priv, 0x000009dd, 0x00000000);
2622 nv_icmd(priv, 0x000009de, 0x00000000);
2623 nv_icmd(priv, 0x000009df, 0x00000000);
2624 nv_icmd(priv, 0x000009e0, 0x00000000);
2625 nv_icmd(priv, 0x000009e1, 0x00000000);
2626 nv_icmd(priv, 0x000009e2, 0x00000000);
2627 nv_icmd(priv, 0x000009e3, 0x00000000);
2628 nv_icmd(priv, 0x000009e4, 0x00000000);
2629 nv_icmd(priv, 0x000009e5, 0x00000000);
2630 nv_icmd(priv, 0x000009e6, 0x00000000);
2631 nv_icmd(priv, 0x000009e7, 0x00000000);
2632 nv_icmd(priv, 0x000009e8, 0x00000000);
2633 nv_icmd(priv, 0x000009e9, 0x00000000);
2634 nv_icmd(priv, 0x000009ea, 0x00000000);
2635 nv_icmd(priv, 0x000009eb, 0x00000000);
2636 nv_icmd(priv, 0x000009ec, 0x00000000);
2637 nv_icmd(priv, 0x000009ed, 0x00000000);
2638 nv_icmd(priv, 0x000009ee, 0x00000000);
2639 nv_icmd(priv, 0x000009ef, 0x00000000);
2640 nv_icmd(priv, 0x000009f0, 0x00000000);
2641 nv_icmd(priv, 0x000009f1, 0x00000000);
2642 nv_icmd(priv, 0x000009f2, 0x00000000);
2643 nv_icmd(priv, 0x000009f3, 0x00000000);
2644 nv_icmd(priv, 0x000009f4, 0x00000000);
2645 nv_icmd(priv, 0x000009f5, 0x00000000);
2646 nv_icmd(priv, 0x000009f6, 0x00000000);
2647 nv_icmd(priv, 0x000009f7, 0x00000000);
2648 nv_icmd(priv, 0x000009f8, 0x00000000);
2649 nv_icmd(priv, 0x000009f9, 0x00000000);
2650 nv_icmd(priv, 0x000009fa, 0x00000000);
2651 nv_icmd(priv, 0x000009fb, 0x00000000);
2652 nv_icmd(priv, 0x000009fc, 0x00000000);
2653 nv_icmd(priv, 0x000009fd, 0x00000000);
2654 nv_icmd(priv, 0x000009fe, 0x00000000);
2655 nv_icmd(priv, 0x000009ff, 0x00000000);
2656 nv_icmd(priv, 0x00000468, 0x00000004);
2657 nv_icmd(priv, 0x0000046c, 0x00000001);
2658 nv_icmd(priv, 0x00000470, 0x00000000);
2659 nv_icmd(priv, 0x00000471, 0x00000000);
2660 nv_icmd(priv, 0x00000472, 0x00000000);
2661 nv_icmd(priv, 0x00000473, 0x00000000);
2662 nv_icmd(priv, 0x00000474, 0x00000000);
2663 nv_icmd(priv, 0x00000475, 0x00000000);
2664 nv_icmd(priv, 0x00000476, 0x00000000);
2665 nv_icmd(priv, 0x00000477, 0x00000000);
2666 nv_icmd(priv, 0x00000478, 0x00000000);
2667 nv_icmd(priv, 0x00000479, 0x00000000);
2668 nv_icmd(priv, 0x0000047a, 0x00000000);
2669 nv_icmd(priv, 0x0000047b, 0x00000000);
2670 nv_icmd(priv, 0x0000047c, 0x00000000);
2671 nv_icmd(priv, 0x0000047d, 0x00000000);
2672 nv_icmd(priv, 0x0000047e, 0x00000000);
2673 nv_icmd(priv, 0x0000047f, 0x00000000);
2674 nv_icmd(priv, 0x00000480, 0x00000000);
2675 nv_icmd(priv, 0x00000481, 0x00000000);
2676 nv_icmd(priv, 0x00000482, 0x00000000);
2677 nv_icmd(priv, 0x00000483, 0x00000000);
2678 nv_icmd(priv, 0x00000484, 0x00000000);
2679 nv_icmd(priv, 0x00000485, 0x00000000);
2680 nv_icmd(priv, 0x00000486, 0x00000000);
2681 nv_icmd(priv, 0x00000487, 0x00000000);
2682 nv_icmd(priv, 0x00000488, 0x00000000);
2683 nv_icmd(priv, 0x00000489, 0x00000000);
2684 nv_icmd(priv, 0x0000048a, 0x00000000);
2685 nv_icmd(priv, 0x0000048b, 0x00000000);
2686 nv_icmd(priv, 0x0000048c, 0x00000000);
2687 nv_icmd(priv, 0x0000048d, 0x00000000);
2688 nv_icmd(priv, 0x0000048e, 0x00000000);
2689 nv_icmd(priv, 0x0000048f, 0x00000000);
2690 nv_icmd(priv, 0x00000490, 0x00000000);
2691 nv_icmd(priv, 0x00000491, 0x00000000);
2692 nv_icmd(priv, 0x00000492, 0x00000000);
2693 nv_icmd(priv, 0x00000493, 0x00000000);
2694 nv_icmd(priv, 0x00000494, 0x00000000);
2695 nv_icmd(priv, 0x00000495, 0x00000000);
2696 nv_icmd(priv, 0x00000496, 0x00000000);
2697 nv_icmd(priv, 0x00000497, 0x00000000);
2698 nv_icmd(priv, 0x00000498, 0x00000000);
2699 nv_icmd(priv, 0x00000499, 0x00000000);
2700 nv_icmd(priv, 0x0000049a, 0x00000000);
2701 nv_icmd(priv, 0x0000049b, 0x00000000);
2702 nv_icmd(priv, 0x0000049c, 0x00000000);
2703 nv_icmd(priv, 0x0000049d, 0x00000000);
2704 nv_icmd(priv, 0x0000049e, 0x00000000);
2705 nv_icmd(priv, 0x0000049f, 0x00000000);
2706 nv_icmd(priv, 0x000004a0, 0x00000000);
2707 nv_icmd(priv, 0x000004a1, 0x00000000);
2708 nv_icmd(priv, 0x000004a2, 0x00000000);
2709 nv_icmd(priv, 0x000004a3, 0x00000000);
2710 nv_icmd(priv, 0x000004a4, 0x00000000);
2711 nv_icmd(priv, 0x000004a5, 0x00000000);
2712 nv_icmd(priv, 0x000004a6, 0x00000000);
2713 nv_icmd(priv, 0x000004a7, 0x00000000);
2714 nv_icmd(priv, 0x000004a8, 0x00000000);
2715 nv_icmd(priv, 0x000004a9, 0x00000000);
2716 nv_icmd(priv, 0x000004aa, 0x00000000);
2717 nv_icmd(priv, 0x000004ab, 0x00000000);
2718 nv_icmd(priv, 0x000004ac, 0x00000000);
2719 nv_icmd(priv, 0x000004ad, 0x00000000);
2720 nv_icmd(priv, 0x000004ae, 0x00000000);
2721 nv_icmd(priv, 0x000004af, 0x00000000);
2722 nv_icmd(priv, 0x000004b0, 0x00000000);
2723 nv_icmd(priv, 0x000004b1, 0x00000000);
2724 nv_icmd(priv, 0x000004b2, 0x00000000);
2725 nv_icmd(priv, 0x000004b3, 0x00000000);
2726 nv_icmd(priv, 0x000004b4, 0x00000000);
2727 nv_icmd(priv, 0x000004b5, 0x00000000);
2728 nv_icmd(priv, 0x000004b6, 0x00000000);
2729 nv_icmd(priv, 0x000004b7, 0x00000000);
2730 nv_icmd(priv, 0x000004b8, 0x00000000);
2731 nv_icmd(priv, 0x000004b9, 0x00000000);
2732 nv_icmd(priv, 0x000004ba, 0x00000000);
2733 nv_icmd(priv, 0x000004bb, 0x00000000);
2734 nv_icmd(priv, 0x000004bc, 0x00000000);
2735 nv_icmd(priv, 0x000004bd, 0x00000000);
2736 nv_icmd(priv, 0x000004be, 0x00000000);
2737 nv_icmd(priv, 0x000004bf, 0x00000000);
2738 nv_icmd(priv, 0x000004c0, 0x00000000);
2739 nv_icmd(priv, 0x000004c1, 0x00000000);
2740 nv_icmd(priv, 0x000004c2, 0x00000000);
2741 nv_icmd(priv, 0x000004c3, 0x00000000);
2742 nv_icmd(priv, 0x000004c4, 0x00000000);
2743 nv_icmd(priv, 0x000004c5, 0x00000000);
2744 nv_icmd(priv, 0x000004c6, 0x00000000);
2745 nv_icmd(priv, 0x000004c7, 0x00000000);
2746 nv_icmd(priv, 0x000004c8, 0x00000000);
2747 nv_icmd(priv, 0x000004c9, 0x00000000);
2748 nv_icmd(priv, 0x000004ca, 0x00000000);
2749 nv_icmd(priv, 0x000004cb, 0x00000000);
2750 nv_icmd(priv, 0x000004cc, 0x00000000);
2751 nv_icmd(priv, 0x000004cd, 0x00000000);
2752 nv_icmd(priv, 0x000004ce, 0x00000000);
2753 nv_icmd(priv, 0x000004cf, 0x00000000);
2754 nv_icmd(priv, 0x00000510, 0x3f800000);
2755 nv_icmd(priv, 0x00000511, 0x3f800000);
2756 nv_icmd(priv, 0x00000512, 0x3f800000);
2757 nv_icmd(priv, 0x00000513, 0x3f800000);
2758 nv_icmd(priv, 0x00000514, 0x3f800000);
2759 nv_icmd(priv, 0x00000515, 0x3f800000);
2760 nv_icmd(priv, 0x00000516, 0x3f800000);
2761 nv_icmd(priv, 0x00000517, 0x3f800000);
2762 nv_icmd(priv, 0x00000518, 0x3f800000);
2763 nv_icmd(priv, 0x00000519, 0x3f800000);
2764 nv_icmd(priv, 0x0000051a, 0x3f800000);
2765 nv_icmd(priv, 0x0000051b, 0x3f800000);
2766 nv_icmd(priv, 0x0000051c, 0x3f800000);
2767 nv_icmd(priv, 0x0000051d, 0x3f800000);
2768 nv_icmd(priv, 0x0000051e, 0x3f800000);
2769 nv_icmd(priv, 0x0000051f, 0x3f800000);
2770 nv_icmd(priv, 0x00000520, 0x000002b6);
2771 nv_icmd(priv, 0x00000529, 0x00000001);
2772 nv_icmd(priv, 0x00000530, 0xffff0000);
2773 nv_icmd(priv, 0x00000531, 0xffff0000);
2774 nv_icmd(priv, 0x00000532, 0xffff0000);
2775 nv_icmd(priv, 0x00000533, 0xffff0000);
2776 nv_icmd(priv, 0x00000534, 0xffff0000);
2777 nv_icmd(priv, 0x00000535, 0xffff0000);
2778 nv_icmd(priv, 0x00000536, 0xffff0000);
2779 nv_icmd(priv, 0x00000537, 0xffff0000);
2780 nv_icmd(priv, 0x00000538, 0xffff0000);
2781 nv_icmd(priv, 0x00000539, 0xffff0000);
2782 nv_icmd(priv, 0x0000053a, 0xffff0000);
2783 nv_icmd(priv, 0x0000053b, 0xffff0000);
2784 nv_icmd(priv, 0x0000053c, 0xffff0000);
2785 nv_icmd(priv, 0x0000053d, 0xffff0000);
2786 nv_icmd(priv, 0x0000053e, 0xffff0000);
2787 nv_icmd(priv, 0x0000053f, 0xffff0000);
2788 nv_icmd(priv, 0x00000585, 0x0000003f);
2789 nv_icmd(priv, 0x00000576, 0x00000003);
2790 if (nv_device(priv)->chipset == 0xc1 ||
2791 nv_device(priv)->chipset >= 0xd0)
2792 nv_icmd(priv, 0x0000057b, 0x00000059);
2793 nv_icmd(priv, 0x00000586, 0x00000040);
2794 nv_icmd(priv, 0x00000582, 0x00000080);
2795 nv_icmd(priv, 0x00000583, 0x00000080);
2796 nv_icmd(priv, 0x000005c2, 0x00000001);
2797 nv_icmd(priv, 0x00000638, 0x00000001);
2798 nv_icmd(priv, 0x00000639, 0x00000001);
2799 nv_icmd(priv, 0x0000063a, 0x00000002);
2800 nv_icmd(priv, 0x0000063b, 0x00000001);
2801 nv_icmd(priv, 0x0000063c, 0x00000001);
2802 nv_icmd(priv, 0x0000063d, 0x00000002);
2803 nv_icmd(priv, 0x0000063e, 0x00000001);
2804 nv_icmd(priv, 0x000008b8, 0x00000001);
2805 nv_icmd(priv, 0x000008b9, 0x00000001);
2806 nv_icmd(priv, 0x000008ba, 0x00000001);
2807 nv_icmd(priv, 0x000008bb, 0x00000001);
2808 nv_icmd(priv, 0x000008bc, 0x00000001);
2809 nv_icmd(priv, 0x000008bd, 0x00000001);
2810 nv_icmd(priv, 0x000008be, 0x00000001);
2811 nv_icmd(priv, 0x000008bf, 0x00000001);
2812 nv_icmd(priv, 0x00000900, 0x00000001);
2813 nv_icmd(priv, 0x00000901, 0x00000001);
2814 nv_icmd(priv, 0x00000902, 0x00000001);
2815 nv_icmd(priv, 0x00000903, 0x00000001);
2816 nv_icmd(priv, 0x00000904, 0x00000001);
2817 nv_icmd(priv, 0x00000905, 0x00000001);
2818 nv_icmd(priv, 0x00000906, 0x00000001);
2819 nv_icmd(priv, 0x00000907, 0x00000001);
2820 nv_icmd(priv, 0x00000908, 0x00000002);
2821 nv_icmd(priv, 0x00000909, 0x00000002);
2822 nv_icmd(priv, 0x0000090a, 0x00000002);
2823 nv_icmd(priv, 0x0000090b, 0x00000002);
2824 nv_icmd(priv, 0x0000090c, 0x00000002);
2825 nv_icmd(priv, 0x0000090d, 0x00000002);
2826 nv_icmd(priv, 0x0000090e, 0x00000002);
2827 nv_icmd(priv, 0x0000090f, 0x00000002);
2828 nv_icmd(priv, 0x00000910, 0x00000001);
2829 nv_icmd(priv, 0x00000911, 0x00000001);
2830 nv_icmd(priv, 0x00000912, 0x00000001);
2831 nv_icmd(priv, 0x00000913, 0x00000001);
2832 nv_icmd(priv, 0x00000914, 0x00000001);
2833 nv_icmd(priv, 0x00000915, 0x00000001);
2834 nv_icmd(priv, 0x00000916, 0x00000001);
2835 nv_icmd(priv, 0x00000917, 0x00000001);
2836 nv_icmd(priv, 0x00000918, 0x00000001);
2837 nv_icmd(priv, 0x00000919, 0x00000001);
2838 nv_icmd(priv, 0x0000091a, 0x00000001);
2839 nv_icmd(priv, 0x0000091b, 0x00000001);
2840 nv_icmd(priv, 0x0000091c, 0x00000001);
2841 nv_icmd(priv, 0x0000091d, 0x00000001);
2842 nv_icmd(priv, 0x0000091e, 0x00000001);
2843 nv_icmd(priv, 0x0000091f, 0x00000001);
2844 nv_icmd(priv, 0x00000920, 0x00000002);
2845 nv_icmd(priv, 0x00000921, 0x00000002);
2846 nv_icmd(priv, 0x00000922, 0x00000002);
2847 nv_icmd(priv, 0x00000923, 0x00000002);
2848 nv_icmd(priv, 0x00000924, 0x00000002);
2849 nv_icmd(priv, 0x00000925, 0x00000002);
2850 nv_icmd(priv, 0x00000926, 0x00000002);
2851 nv_icmd(priv, 0x00000927, 0x00000002);
2852 nv_icmd(priv, 0x00000928, 0x00000001);
2853 nv_icmd(priv, 0x00000929, 0x00000001);
2854 nv_icmd(priv, 0x0000092a, 0x00000001);
2855 nv_icmd(priv, 0x0000092b, 0x00000001);
2856 nv_icmd(priv, 0x0000092c, 0x00000001);
2857 nv_icmd(priv, 0x0000092d, 0x00000001);
2858 nv_icmd(priv, 0x0000092e, 0x00000001);
2859 nv_icmd(priv, 0x0000092f, 0x00000001);
2860 nv_icmd(priv, 0x00000648, 0x00000001);
2861 nv_icmd(priv, 0x00000649, 0x00000001);
2862 nv_icmd(priv, 0x0000064a, 0x00000001);
2863 nv_icmd(priv, 0x0000064b, 0x00000001);
2864 nv_icmd(priv, 0x0000064c, 0x00000001);
2865 nv_icmd(priv, 0x0000064d, 0x00000001);
2866 nv_icmd(priv, 0x0000064e, 0x00000001);
2867 nv_icmd(priv, 0x0000064f, 0x00000001);
2868 nv_icmd(priv, 0x00000650, 0x00000001);
2869 nv_icmd(priv, 0x00000658, 0x0000000f);
2870 nv_icmd(priv, 0x000007ff, 0x0000000a);
2871 nv_icmd(priv, 0x0000066a, 0x40000000);
2872 nv_icmd(priv, 0x0000066b, 0x10000000);
2873 nv_icmd(priv, 0x0000066c, 0xffff0000);
2874 nv_icmd(priv, 0x0000066d, 0xffff0000);
2875 nv_icmd(priv, 0x000007af, 0x00000008);
2876 nv_icmd(priv, 0x000007b0, 0x00000008);
2877 nv_icmd(priv, 0x000007f6, 0x00000001);
2878 nv_icmd(priv, 0x000006b2, 0x00000055);
2879 nv_icmd(priv, 0x000007ad, 0x00000003);
2880 nv_icmd(priv, 0x00000937, 0x00000001);
2881 nv_icmd(priv, 0x00000971, 0x00000008);
2882 nv_icmd(priv, 0x00000972, 0x00000040);
2883 nv_icmd(priv, 0x00000973, 0x0000012c);
2884 nv_icmd(priv, 0x0000097c, 0x00000040);
2885 nv_icmd(priv, 0x00000979, 0x00000003);
2886 nv_icmd(priv, 0x00000975, 0x00000020);
2887 nv_icmd(priv, 0x00000976, 0x00000001);
2888 nv_icmd(priv, 0x00000977, 0x00000020);
2889 nv_icmd(priv, 0x00000978, 0x00000001);
2890 nv_icmd(priv, 0x00000957, 0x00000003);
2891 nv_icmd(priv, 0x0000095e, 0x20164010);
2892 nv_icmd(priv, 0x0000095f, 0x00000020);
2893 if (nv_device(priv)->chipset >= 0xd0)
2894 nv_icmd(priv, 0x0000097d, 0x00000020);
2895 nv_icmd(priv, 0x00000683, 0x00000006);
2896 nv_icmd(priv, 0x00000685, 0x003fffff);
2897 nv_icmd(priv, 0x00000687, 0x00000c48);
2898 nv_icmd(priv, 0x000006a0, 0x00000005);
2899 nv_icmd(priv, 0x00000840, 0x00300008);
2900 nv_icmd(priv, 0x00000841, 0x04000080);
2901 nv_icmd(priv, 0x00000842, 0x00300008);
2902 nv_icmd(priv, 0x00000843, 0x04000080);
2903 nv_icmd(priv, 0x00000818, 0x00000000);
2904 nv_icmd(priv, 0x00000819, 0x00000000);
2905 nv_icmd(priv, 0x0000081a, 0x00000000);
2906 nv_icmd(priv, 0x0000081b, 0x00000000);
2907 nv_icmd(priv, 0x0000081c, 0x00000000);
2908 nv_icmd(priv, 0x0000081d, 0x00000000);
2909 nv_icmd(priv, 0x0000081e, 0x00000000);
2910 nv_icmd(priv, 0x0000081f, 0x00000000);
2911 nv_icmd(priv, 0x00000848, 0x00000000);
2912 nv_icmd(priv, 0x00000849, 0x00000000);
2913 nv_icmd(priv, 0x0000084a, 0x00000000);
2914 nv_icmd(priv, 0x0000084b, 0x00000000);
2915 nv_icmd(priv, 0x0000084c, 0x00000000);
2916 nv_icmd(priv, 0x0000084d, 0x00000000);
2917 nv_icmd(priv, 0x0000084e, 0x00000000);
2918 nv_icmd(priv, 0x0000084f, 0x00000000);
2919 nv_icmd(priv, 0x00000850, 0x00000000);
2920 nv_icmd(priv, 0x00000851, 0x00000000);
2921 nv_icmd(priv, 0x00000852, 0x00000000);
2922 nv_icmd(priv, 0x00000853, 0x00000000);
2923 nv_icmd(priv, 0x00000854, 0x00000000);
2924 nv_icmd(priv, 0x00000855, 0x00000000);
2925 nv_icmd(priv, 0x00000856, 0x00000000);
2926 nv_icmd(priv, 0x00000857, 0x00000000);
2927 nv_icmd(priv, 0x00000738, 0x00000000);
2928 nv_icmd(priv, 0x000006aa, 0x00000001);
2929 nv_icmd(priv, 0x000006ab, 0x00000002);
2930 nv_icmd(priv, 0x000006ac, 0x00000080);
2931 nv_icmd(priv, 0x000006ad, 0x00000100);
2932 nv_icmd(priv, 0x000006ae, 0x00000100);
2933 nv_icmd(priv, 0x000006b1, 0x00000011);
2934 nv_icmd(priv, 0x000006bb, 0x000000cf);
2935 nv_icmd(priv, 0x000006ce, 0x2a712488);
2936 nv_icmd(priv, 0x00000739, 0x4085c000);
2937 nv_icmd(priv, 0x0000073a, 0x00000080);
2938 nv_icmd(priv, 0x00000786, 0x80000100);
2939 nv_icmd(priv, 0x0000073c, 0x00010100);
2940 nv_icmd(priv, 0x0000073d, 0x02800000);
2941 nv_icmd(priv, 0x00000787, 0x000000cf);
2942 nv_icmd(priv, 0x0000078c, 0x00000008);
2943 nv_icmd(priv, 0x00000792, 0x00000001);
2944 nv_icmd(priv, 0x00000794, 0x00000001);
2945 nv_icmd(priv, 0x00000795, 0x00000001);
2946 nv_icmd(priv, 0x00000796, 0x00000001);
2947 nv_icmd(priv, 0x00000797, 0x000000cf);
2948 nv_icmd(priv, 0x00000836, 0x00000001);
2949 nv_icmd(priv, 0x0000079a, 0x00000002);
2950 nv_icmd(priv, 0x00000833, 0x04444480);
2951 nv_icmd(priv, 0x000007a1, 0x00000001);
2952 nv_icmd(priv, 0x000007a3, 0x00000001);
2953 nv_icmd(priv, 0x000007a4, 0x00000001);
2954 nv_icmd(priv, 0x000007a5, 0x00000001);
2955 nv_icmd(priv, 0x00000831, 0x00000004);
2956 nv_icmd(priv, 0x0000080c, 0x00000002);
2957 nv_icmd(priv, 0x0000080d, 0x00000100);
2958 nv_icmd(priv, 0x0000080e, 0x00000100);
2959 nv_icmd(priv, 0x0000080f, 0x00000001);
2960 nv_icmd(priv, 0x00000823, 0x00000002);
2961 nv_icmd(priv, 0x00000824, 0x00000100);
2962 nv_icmd(priv, 0x00000825, 0x00000100);
2963 nv_icmd(priv, 0x00000826, 0x00000001);
2964 nv_icmd(priv, 0x0000095d, 0x00000001);
2965 nv_icmd(priv, 0x0000082b, 0x00000004);
2966 nv_icmd(priv, 0x00000942, 0x00010001);
2967 nv_icmd(priv, 0x00000943, 0x00000001);
2968 nv_icmd(priv, 0x00000944, 0x00000022);
2969 nv_icmd(priv, 0x000007c5, 0x00010001);
2970 nv_icmd(priv, 0x00000834, 0x00000001);
2971 nv_icmd(priv, 0x000007c7, 0x00000001);
2972 nv_icmd(priv, 0x0000c1b0, 0x0000000f);
2973 nv_icmd(priv, 0x0000c1b1, 0x0000000f);
2974 nv_icmd(priv, 0x0000c1b2, 0x0000000f);
2975 nv_icmd(priv, 0x0000c1b3, 0x0000000f);
2976 nv_icmd(priv, 0x0000c1b4, 0x0000000f);
2977 nv_icmd(priv, 0x0000c1b5, 0x0000000f);
2978 nv_icmd(priv, 0x0000c1b6, 0x0000000f);
2979 nv_icmd(priv, 0x0000c1b7, 0x0000000f);
2980 nv_icmd(priv, 0x0000c1b8, 0x0fac6881);
2981 nv_icmd(priv, 0x0000c1b9, 0x00fac688);
2982 nv_icmd(priv, 0x0001e100, 0x00000001);
2983 nv_icmd(priv, 0x00001000, 0x00000002);
2984 nv_icmd(priv, 0x000006aa, 0x00000001);
2985 nv_icmd(priv, 0x000006ad, 0x00000100);
2986 nv_icmd(priv, 0x000006ae, 0x00000100);
2987 nv_icmd(priv, 0x000006b1, 0x00000011);
2988 nv_icmd(priv, 0x0000078c, 0x00000008);
2989 nv_icmd(priv, 0x00000792, 0x00000001);
2990 nv_icmd(priv, 0x00000794, 0x00000001);
2991 nv_icmd(priv, 0x00000795, 0x00000001);
2992 nv_icmd(priv, 0x00000796, 0x00000001);
2993 nv_icmd(priv, 0x00000797, 0x000000cf);
2994 nv_icmd(priv, 0x0000079a, 0x00000002);
2995 nv_icmd(priv, 0x00000833, 0x04444480);
2996 nv_icmd(priv, 0x000007a1, 0x00000001);
2997 nv_icmd(priv, 0x000007a3, 0x00000001);
2998 nv_icmd(priv, 0x000007a4, 0x00000001);
2999 nv_icmd(priv, 0x000007a5, 0x00000001);
3000 nv_icmd(priv, 0x00000831, 0x00000004);
3001 nv_icmd(priv, 0x0001e100, 0x00000001);
3002 nv_icmd(priv, 0x00001000, 0x00000014);
3003 nv_icmd(priv, 0x00000351, 0x00000100);
3004 nv_icmd(priv, 0x00000957, 0x00000003);
3005 nv_icmd(priv, 0x0000095d, 0x00000001);
3006 nv_icmd(priv, 0x0000082b, 0x00000004);
3007 nv_icmd(priv, 0x00000942, 0x00010001);
3008 nv_icmd(priv, 0x00000943, 0x00000001);
3009 nv_icmd(priv, 0x000007c5, 0x00010001);
3010 nv_icmd(priv, 0x00000834, 0x00000001);
3011 nv_icmd(priv, 0x000007c7, 0x00000001);
3012 nv_icmd(priv, 0x0001e100, 0x00000001);
3013 nv_icmd(priv, 0x00001000, 0x00000001);
3014 nv_icmd(priv, 0x0000080c, 0x00000002);
3015 nv_icmd(priv, 0x0000080d, 0x00000100);
3016 nv_icmd(priv, 0x0000080e, 0x00000100);
3017 nv_icmd(priv, 0x0000080f, 0x00000001);
3018 nv_icmd(priv, 0x00000823, 0x00000002);
3019 nv_icmd(priv, 0x00000824, 0x00000100);
3020 nv_icmd(priv, 0x00000825, 0x00000100);
3021 nv_icmd(priv, 0x00000826, 0x00000001);
3022 nv_icmd(priv, 0x0001e100, 0x00000001);
3023 nv_wr32(priv, 0x400208, 0x00000000);
3024 nv_wr32(priv, 0x404154, 0x00000400);
3025
3026 nvc0_grctx_generate_9097(priv);
3027 if (fermi >= 0x9197)
3028 nvc0_grctx_generate_9197(priv);
3029 if (fermi >= 0x9297)
3030 nvc0_grctx_generate_9297(priv);
3031 nvc0_grctx_generate_902d(priv);
3032 nvc0_grctx_generate_9039(priv);
3033 nvc0_grctx_generate_90c0(priv);
3034 1179
3035 nv_wr32(priv, 0x000260, r000260); 1180done:
3036 1181 nouveau_gpuobj_ref(NULL, &chan);
3037 return nvc0_grctx_fini(&info); 1182 return ret;
3038} 1183}
1184
1185struct nvc0_graph_init *
1186nvc0_grctx_init_hub[] = {
1187 nvc0_grctx_init_base,
1188 nvc0_grctx_init_unk40xx,
1189 nvc0_grctx_init_unk44xx,
1190 nvc0_grctx_init_unk46xx,
1191 nvc0_grctx_init_unk47xx,
1192 nvc0_grctx_init_unk58xx,
1193 nvc0_grctx_init_unk60xx,
1194 nvc0_grctx_init_unk64xx,
1195 nvc0_grctx_init_unk78xx,
1196 nvc0_grctx_init_unk80xx,
1197 nvc0_grctx_init_rop,
1198 NULL
1199};
1200
1201static struct nvc0_graph_init *
1202nvc0_grctx_init_gpc[] = {
1203 nvc0_grctx_init_gpc_0,
1204 nvc0_grctx_init_gpc_1,
1205 nvc0_grctx_init_tpc,
1206 NULL
1207};
1208
1209struct nvc0_graph_init
1210nvc0_grctx_init_mthd_magic[] = {
1211 { 0x3410, 1, 0x04, 0x00000000 },
1212 {}
1213};
1214
1215struct nvc0_graph_mthd
1216nvc0_grctx_init_mthd[] = {
1217 { 0x9097, nvc0_grctx_init_9097, },
1218 { 0x902d, nvc0_grctx_init_902d, },
1219 { 0x9039, nvc0_grctx_init_9039, },
1220 { 0x90c0, nvc0_grctx_init_90c0, },
1221 { 0x902d, nvc0_grctx_init_mthd_magic, },
1222 {}
1223};
1224
1225struct nouveau_oclass *
1226nvc0_grctx_oclass = &(struct nvc0_grctx_oclass) {
1227 .base.handle = NV_ENGCTX(GR, 0xc0),
1228 .base.ofuncs = &(struct nouveau_ofuncs) {
1229 .ctor = nvc0_graph_context_ctor,
1230 .dtor = nvc0_graph_context_dtor,
1231 .init = _nouveau_graph_context_init,
1232 .fini = _nouveau_graph_context_fini,
1233 .rd32 = _nouveau_graph_context_rd32,
1234 .wr32 = _nouveau_graph_context_wr32,
1235 },
1236 .main = nvc0_grctx_generate_main,
1237 .mods = nvc0_grctx_generate_mods,
1238 .unkn = nvc0_grctx_generate_unkn,
1239 .hub = nvc0_grctx_init_hub,
1240 .gpc = nvc0_grctx_init_gpc,
1241 .icmd = nvc0_grctx_init_icmd,
1242 .mthd = nvc0_grctx_init_mthd,
1243}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc1.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc1.c
new file mode 100644
index 000000000000..e5be3ee7f172
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc1.c
@@ -0,0 +1,823 @@
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 <bskeggs@redhat.com>
23 */
24
25#include "nvc0.h"
26
27static struct nvc0_graph_init
28nvc1_grctx_init_icmd[] = {
29 { 0x001000, 1, 0x01, 0x00000004 },
30 { 0x0000a9, 1, 0x01, 0x0000ffff },
31 { 0x000038, 1, 0x01, 0x0fac6881 },
32 { 0x00003d, 1, 0x01, 0x00000001 },
33 { 0x0000e8, 8, 0x01, 0x00000400 },
34 { 0x000078, 8, 0x01, 0x00000300 },
35 { 0x000050, 1, 0x01, 0x00000011 },
36 { 0x000058, 8, 0x01, 0x00000008 },
37 { 0x000208, 8, 0x01, 0x00000001 },
38 { 0x000081, 1, 0x01, 0x00000001 },
39 { 0x000085, 1, 0x01, 0x00000004 },
40 { 0x000088, 1, 0x01, 0x00000400 },
41 { 0x000090, 1, 0x01, 0x00000300 },
42 { 0x000098, 1, 0x01, 0x00001001 },
43 { 0x0000e3, 1, 0x01, 0x00000001 },
44 { 0x0000da, 1, 0x01, 0x00000001 },
45 { 0x0000f8, 1, 0x01, 0x00000003 },
46 { 0x0000fa, 1, 0x01, 0x00000001 },
47 { 0x00009f, 4, 0x01, 0x0000ffff },
48 { 0x0000b1, 1, 0x01, 0x00000001 },
49 { 0x0000b2, 40, 0x01, 0x00000000 },
50 { 0x000210, 8, 0x01, 0x00000040 },
51 { 0x000218, 8, 0x01, 0x0000c080 },
52 { 0x0000ad, 1, 0x01, 0x0000013e },
53 { 0x0000e1, 1, 0x01, 0x00000010 },
54 { 0x000290, 16, 0x01, 0x00000000 },
55 { 0x0003b0, 16, 0x01, 0x00000000 },
56 { 0x0002a0, 16, 0x01, 0x00000000 },
57 { 0x000420, 16, 0x01, 0x00000000 },
58 { 0x0002b0, 16, 0x01, 0x00000000 },
59 { 0x000430, 16, 0x01, 0x00000000 },
60 { 0x0002c0, 16, 0x01, 0x00000000 },
61 { 0x0004d0, 16, 0x01, 0x00000000 },
62 { 0x000720, 16, 0x01, 0x00000000 },
63 { 0x0008c0, 16, 0x01, 0x00000000 },
64 { 0x000890, 16, 0x01, 0x00000000 },
65 { 0x0008e0, 16, 0x01, 0x00000000 },
66 { 0x0008a0, 16, 0x01, 0x00000000 },
67 { 0x0008f0, 16, 0x01, 0x00000000 },
68 { 0x00094c, 1, 0x01, 0x000000ff },
69 { 0x00094d, 1, 0x01, 0xffffffff },
70 { 0x00094e, 1, 0x01, 0x00000002 },
71 { 0x0002ec, 1, 0x01, 0x00000001 },
72 { 0x000303, 1, 0x01, 0x00000001 },
73 { 0x0002e6, 1, 0x01, 0x00000001 },
74 { 0x000466, 1, 0x01, 0x00000052 },
75 { 0x000301, 1, 0x01, 0x3f800000 },
76 { 0x000304, 1, 0x01, 0x30201000 },
77 { 0x000305, 1, 0x01, 0x70605040 },
78 { 0x000306, 1, 0x01, 0xb8a89888 },
79 { 0x000307, 1, 0x01, 0xf8e8d8c8 },
80 { 0x00030a, 1, 0x01, 0x00ffff00 },
81 { 0x00030b, 1, 0x01, 0x0000001a },
82 { 0x00030c, 1, 0x01, 0x00000001 },
83 { 0x000318, 1, 0x01, 0x00000001 },
84 { 0x000340, 1, 0x01, 0x00000000 },
85 { 0x000375, 1, 0x01, 0x00000001 },
86 { 0x000351, 1, 0x01, 0x00000100 },
87 { 0x00037d, 1, 0x01, 0x00000006 },
88 { 0x0003a0, 1, 0x01, 0x00000002 },
89 { 0x0003aa, 1, 0x01, 0x00000001 },
90 { 0x0003a9, 1, 0x01, 0x00000001 },
91 { 0x000380, 1, 0x01, 0x00000001 },
92 { 0x000360, 1, 0x01, 0x00000040 },
93 { 0x000366, 2, 0x01, 0x00000000 },
94 { 0x000368, 1, 0x01, 0x00001fff },
95 { 0x000370, 2, 0x01, 0x00000000 },
96 { 0x000372, 1, 0x01, 0x003fffff },
97 { 0x00037a, 1, 0x01, 0x00000012 },
98 { 0x0005e0, 5, 0x01, 0x00000022 },
99 { 0x000619, 1, 0x01, 0x00000003 },
100 { 0x000811, 1, 0x01, 0x00000003 },
101 { 0x000812, 1, 0x01, 0x00000004 },
102 { 0x000813, 1, 0x01, 0x00000006 },
103 { 0x000814, 1, 0x01, 0x00000008 },
104 { 0x000815, 1, 0x01, 0x0000000b },
105 { 0x000800, 6, 0x01, 0x00000001 },
106 { 0x000632, 1, 0x01, 0x00000001 },
107 { 0x000633, 1, 0x01, 0x00000002 },
108 { 0x000634, 1, 0x01, 0x00000003 },
109 { 0x000635, 1, 0x01, 0x00000004 },
110 { 0x000654, 1, 0x01, 0x3f800000 },
111 { 0x000657, 1, 0x01, 0x3f800000 },
112 { 0x000655, 2, 0x01, 0x3f800000 },
113 { 0x0006cd, 1, 0x01, 0x3f800000 },
114 { 0x0007f5, 1, 0x01, 0x3f800000 },
115 { 0x0007dc, 1, 0x01, 0x39291909 },
116 { 0x0007dd, 1, 0x01, 0x79695949 },
117 { 0x0007de, 1, 0x01, 0xb9a99989 },
118 { 0x0007df, 1, 0x01, 0xf9e9d9c9 },
119 { 0x0007e8, 1, 0x01, 0x00003210 },
120 { 0x0007e9, 1, 0x01, 0x00007654 },
121 { 0x0007ea, 1, 0x01, 0x00000098 },
122 { 0x0007ec, 1, 0x01, 0x39291909 },
123 { 0x0007ed, 1, 0x01, 0x79695949 },
124 { 0x0007ee, 1, 0x01, 0xb9a99989 },
125 { 0x0007ef, 1, 0x01, 0xf9e9d9c9 },
126 { 0x0007f0, 1, 0x01, 0x00003210 },
127 { 0x0007f1, 1, 0x01, 0x00007654 },
128 { 0x0007f2, 1, 0x01, 0x00000098 },
129 { 0x0005a5, 1, 0x01, 0x00000001 },
130 { 0x000980, 128, 0x01, 0x00000000 },
131 { 0x000468, 1, 0x01, 0x00000004 },
132 { 0x00046c, 1, 0x01, 0x00000001 },
133 { 0x000470, 96, 0x01, 0x00000000 },
134 { 0x000510, 16, 0x01, 0x3f800000 },
135 { 0x000520, 1, 0x01, 0x000002b6 },
136 { 0x000529, 1, 0x01, 0x00000001 },
137 { 0x000530, 16, 0x01, 0xffff0000 },
138 { 0x000585, 1, 0x01, 0x0000003f },
139 { 0x000576, 1, 0x01, 0x00000003 },
140 { 0x00057b, 1, 0x01, 0x00000059 },
141 { 0x000586, 1, 0x01, 0x00000040 },
142 { 0x000582, 2, 0x01, 0x00000080 },
143 { 0x0005c2, 1, 0x01, 0x00000001 },
144 { 0x000638, 1, 0x01, 0x00000001 },
145 { 0x000639, 1, 0x01, 0x00000001 },
146 { 0x00063a, 1, 0x01, 0x00000002 },
147 { 0x00063b, 2, 0x01, 0x00000001 },
148 { 0x00063d, 1, 0x01, 0x00000002 },
149 { 0x00063e, 1, 0x01, 0x00000001 },
150 { 0x0008b8, 8, 0x01, 0x00000001 },
151 { 0x000900, 8, 0x01, 0x00000001 },
152 { 0x000908, 8, 0x01, 0x00000002 },
153 { 0x000910, 16, 0x01, 0x00000001 },
154 { 0x000920, 8, 0x01, 0x00000002 },
155 { 0x000928, 8, 0x01, 0x00000001 },
156 { 0x000648, 9, 0x01, 0x00000001 },
157 { 0x000658, 1, 0x01, 0x0000000f },
158 { 0x0007ff, 1, 0x01, 0x0000000a },
159 { 0x00066a, 1, 0x01, 0x40000000 },
160 { 0x00066b, 1, 0x01, 0x10000000 },
161 { 0x00066c, 2, 0x01, 0xffff0000 },
162 { 0x0007af, 2, 0x01, 0x00000008 },
163 { 0x0007f6, 1, 0x01, 0x00000001 },
164 { 0x0006b2, 1, 0x01, 0x00000055 },
165 { 0x0007ad, 1, 0x01, 0x00000003 },
166 { 0x000937, 1, 0x01, 0x00000001 },
167 { 0x000971, 1, 0x01, 0x00000008 },
168 { 0x000972, 1, 0x01, 0x00000040 },
169 { 0x000973, 1, 0x01, 0x0000012c },
170 { 0x00097c, 1, 0x01, 0x00000040 },
171 { 0x000979, 1, 0x01, 0x00000003 },
172 { 0x000975, 1, 0x01, 0x00000020 },
173 { 0x000976, 1, 0x01, 0x00000001 },
174 { 0x000977, 1, 0x01, 0x00000020 },
175 { 0x000978, 1, 0x01, 0x00000001 },
176 { 0x000957, 1, 0x01, 0x00000003 },
177 { 0x00095e, 1, 0x01, 0x20164010 },
178 { 0x00095f, 1, 0x01, 0x00000020 },
179 { 0x000683, 1, 0x01, 0x00000006 },
180 { 0x000685, 1, 0x01, 0x003fffff },
181 { 0x000687, 1, 0x01, 0x00000c48 },
182 { 0x0006a0, 1, 0x01, 0x00000005 },
183 { 0x000840, 1, 0x01, 0x00300008 },
184 { 0x000841, 1, 0x01, 0x04000080 },
185 { 0x000842, 1, 0x01, 0x00300008 },
186 { 0x000843, 1, 0x01, 0x04000080 },
187 { 0x000818, 8, 0x01, 0x00000000 },
188 { 0x000848, 16, 0x01, 0x00000000 },
189 { 0x000738, 1, 0x01, 0x00000000 },
190 { 0x0006aa, 1, 0x01, 0x00000001 },
191 { 0x0006ab, 1, 0x01, 0x00000002 },
192 { 0x0006ac, 1, 0x01, 0x00000080 },
193 { 0x0006ad, 2, 0x01, 0x00000100 },
194 { 0x0006b1, 1, 0x01, 0x00000011 },
195 { 0x0006bb, 1, 0x01, 0x000000cf },
196 { 0x0006ce, 1, 0x01, 0x2a712488 },
197 { 0x000739, 1, 0x01, 0x4085c000 },
198 { 0x00073a, 1, 0x01, 0x00000080 },
199 { 0x000786, 1, 0x01, 0x80000100 },
200 { 0x00073c, 1, 0x01, 0x00010100 },
201 { 0x00073d, 1, 0x01, 0x02800000 },
202 { 0x000787, 1, 0x01, 0x000000cf },
203 { 0x00078c, 1, 0x01, 0x00000008 },
204 { 0x000792, 1, 0x01, 0x00000001 },
205 { 0x000794, 1, 0x01, 0x00000001 },
206 { 0x000795, 2, 0x01, 0x00000001 },
207 { 0x000797, 1, 0x01, 0x000000cf },
208 { 0x000836, 1, 0x01, 0x00000001 },
209 { 0x00079a, 1, 0x01, 0x00000002 },
210 { 0x000833, 1, 0x01, 0x04444480 },
211 { 0x0007a1, 1, 0x01, 0x00000001 },
212 { 0x0007a3, 1, 0x01, 0x00000001 },
213 { 0x0007a4, 2, 0x01, 0x00000001 },
214 { 0x000831, 1, 0x01, 0x00000004 },
215 { 0x00080c, 1, 0x01, 0x00000002 },
216 { 0x00080d, 2, 0x01, 0x00000100 },
217 { 0x00080f, 1, 0x01, 0x00000001 },
218 { 0x000823, 1, 0x01, 0x00000002 },
219 { 0x000824, 2, 0x01, 0x00000100 },
220 { 0x000826, 1, 0x01, 0x00000001 },
221 { 0x00095d, 1, 0x01, 0x00000001 },
222 { 0x00082b, 1, 0x01, 0x00000004 },
223 { 0x000942, 1, 0x01, 0x00010001 },
224 { 0x000943, 1, 0x01, 0x00000001 },
225 { 0x000944, 1, 0x01, 0x00000022 },
226 { 0x0007c5, 1, 0x01, 0x00010001 },
227 { 0x000834, 1, 0x01, 0x00000001 },
228 { 0x0007c7, 1, 0x01, 0x00000001 },
229 { 0x00c1b0, 8, 0x01, 0x0000000f },
230 { 0x00c1b8, 1, 0x01, 0x0fac6881 },
231 { 0x00c1b9, 1, 0x01, 0x00fac688 },
232 { 0x01e100, 1, 0x01, 0x00000001 },
233 { 0x001000, 1, 0x01, 0x00000002 },
234 { 0x0006aa, 1, 0x01, 0x00000001 },
235 { 0x0006ad, 2, 0x01, 0x00000100 },
236 { 0x0006b1, 1, 0x01, 0x00000011 },
237 { 0x00078c, 1, 0x01, 0x00000008 },
238 { 0x000792, 1, 0x01, 0x00000001 },
239 { 0x000794, 1, 0x01, 0x00000001 },
240 { 0x000795, 2, 0x01, 0x00000001 },
241 { 0x000797, 1, 0x01, 0x000000cf },
242 { 0x00079a, 1, 0x01, 0x00000002 },
243 { 0x000833, 1, 0x01, 0x04444480 },
244 { 0x0007a1, 1, 0x01, 0x00000001 },
245 { 0x0007a3, 1, 0x01, 0x00000001 },
246 { 0x0007a4, 2, 0x01, 0x00000001 },
247 { 0x000831, 1, 0x01, 0x00000004 },
248 { 0x01e100, 1, 0x01, 0x00000001 },
249 { 0x001000, 1, 0x01, 0x00000014 },
250 { 0x000351, 1, 0x01, 0x00000100 },
251 { 0x000957, 1, 0x01, 0x00000003 },
252 { 0x00095d, 1, 0x01, 0x00000001 },
253 { 0x00082b, 1, 0x01, 0x00000004 },
254 { 0x000942, 1, 0x01, 0x00010001 },
255 { 0x000943, 1, 0x01, 0x00000001 },
256 { 0x0007c5, 1, 0x01, 0x00010001 },
257 { 0x000834, 1, 0x01, 0x00000001 },
258 { 0x0007c7, 1, 0x01, 0x00000001 },
259 { 0x01e100, 1, 0x01, 0x00000001 },
260 { 0x001000, 1, 0x01, 0x00000001 },
261 { 0x00080c, 1, 0x01, 0x00000002 },
262 { 0x00080d, 2, 0x01, 0x00000100 },
263 { 0x00080f, 1, 0x01, 0x00000001 },
264 { 0x000823, 1, 0x01, 0x00000002 },
265 { 0x000824, 2, 0x01, 0x00000100 },
266 { 0x000826, 1, 0x01, 0x00000001 },
267 { 0x01e100, 1, 0x01, 0x00000001 },
268 {}
269};
270
271struct nvc0_graph_init
272nvc1_grctx_init_9097[] = {
273 { 0x000800, 8, 0x40, 0x00000000 },
274 { 0x000804, 8, 0x40, 0x00000000 },
275 { 0x000808, 8, 0x40, 0x00000400 },
276 { 0x00080c, 8, 0x40, 0x00000300 },
277 { 0x000810, 1, 0x04, 0x000000cf },
278 { 0x000850, 7, 0x40, 0x00000000 },
279 { 0x000814, 8, 0x40, 0x00000040 },
280 { 0x000818, 8, 0x40, 0x00000001 },
281 { 0x00081c, 8, 0x40, 0x00000000 },
282 { 0x000820, 8, 0x40, 0x00000000 },
283 { 0x002700, 8, 0x20, 0x00000000 },
284 { 0x002704, 8, 0x20, 0x00000000 },
285 { 0x002708, 8, 0x20, 0x00000000 },
286 { 0x00270c, 8, 0x20, 0x00000000 },
287 { 0x002710, 8, 0x20, 0x00014000 },
288 { 0x002714, 8, 0x20, 0x00000040 },
289 { 0x001c00, 16, 0x10, 0x00000000 },
290 { 0x001c04, 16, 0x10, 0x00000000 },
291 { 0x001c08, 16, 0x10, 0x00000000 },
292 { 0x001c0c, 16, 0x10, 0x00000000 },
293 { 0x001d00, 16, 0x10, 0x00000000 },
294 { 0x001d04, 16, 0x10, 0x00000000 },
295 { 0x001d08, 16, 0x10, 0x00000000 },
296 { 0x001d0c, 16, 0x10, 0x00000000 },
297 { 0x001f00, 16, 0x08, 0x00000000 },
298 { 0x001f04, 16, 0x08, 0x00000000 },
299 { 0x001f80, 16, 0x08, 0x00000000 },
300 { 0x001f84, 16, 0x08, 0x00000000 },
301 { 0x002200, 5, 0x10, 0x00000022 },
302 { 0x002000, 1, 0x04, 0x00000000 },
303 { 0x002040, 1, 0x04, 0x00000011 },
304 { 0x002080, 1, 0x04, 0x00000020 },
305 { 0x0020c0, 1, 0x04, 0x00000030 },
306 { 0x002100, 1, 0x04, 0x00000040 },
307 { 0x002140, 1, 0x04, 0x00000051 },
308 { 0x00200c, 6, 0x40, 0x00000001 },
309 { 0x002010, 1, 0x04, 0x00000000 },
310 { 0x002050, 1, 0x04, 0x00000000 },
311 { 0x002090, 1, 0x04, 0x00000001 },
312 { 0x0020d0, 1, 0x04, 0x00000002 },
313 { 0x002110, 1, 0x04, 0x00000003 },
314 { 0x002150, 1, 0x04, 0x00000004 },
315 { 0x000380, 4, 0x20, 0x00000000 },
316 { 0x000384, 4, 0x20, 0x00000000 },
317 { 0x000388, 4, 0x20, 0x00000000 },
318 { 0x00038c, 4, 0x20, 0x00000000 },
319 { 0x000700, 4, 0x10, 0x00000000 },
320 { 0x000704, 4, 0x10, 0x00000000 },
321 { 0x000708, 4, 0x10, 0x00000000 },
322 { 0x002800, 128, 0x04, 0x00000000 },
323 { 0x000a00, 16, 0x20, 0x00000000 },
324 { 0x000a04, 16, 0x20, 0x00000000 },
325 { 0x000a08, 16, 0x20, 0x00000000 },
326 { 0x000a0c, 16, 0x20, 0x00000000 },
327 { 0x000a10, 16, 0x20, 0x00000000 },
328 { 0x000a14, 16, 0x20, 0x00000000 },
329 { 0x000c00, 16, 0x10, 0x00000000 },
330 { 0x000c04, 16, 0x10, 0x00000000 },
331 { 0x000c08, 16, 0x10, 0x00000000 },
332 { 0x000c0c, 16, 0x10, 0x3f800000 },
333 { 0x000d00, 8, 0x08, 0xffff0000 },
334 { 0x000d04, 8, 0x08, 0xffff0000 },
335 { 0x000e00, 16, 0x10, 0x00000000 },
336 { 0x000e04, 16, 0x10, 0xffff0000 },
337 { 0x000e08, 16, 0x10, 0xffff0000 },
338 { 0x000d40, 4, 0x08, 0x00000000 },
339 { 0x000d44, 4, 0x08, 0x00000000 },
340 { 0x001e00, 8, 0x20, 0x00000001 },
341 { 0x001e04, 8, 0x20, 0x00000001 },
342 { 0x001e08, 8, 0x20, 0x00000002 },
343 { 0x001e0c, 8, 0x20, 0x00000001 },
344 { 0x001e10, 8, 0x20, 0x00000001 },
345 { 0x001e14, 8, 0x20, 0x00000002 },
346 { 0x001e18, 8, 0x20, 0x00000001 },
347 { 0x00030c, 1, 0x04, 0x00000001 },
348 { 0x001944, 1, 0x04, 0x00000000 },
349 { 0x001514, 1, 0x04, 0x00000000 },
350 { 0x000d68, 1, 0x04, 0x0000ffff },
351 { 0x00121c, 1, 0x04, 0x0fac6881 },
352 { 0x000fac, 1, 0x04, 0x00000001 },
353 { 0x001538, 1, 0x04, 0x00000001 },
354 { 0x000fe0, 2, 0x04, 0x00000000 },
355 { 0x000fe8, 1, 0x04, 0x00000014 },
356 { 0x000fec, 1, 0x04, 0x00000040 },
357 { 0x000ff0, 1, 0x04, 0x00000000 },
358 { 0x00179c, 1, 0x04, 0x00000000 },
359 { 0x001228, 1, 0x04, 0x00000400 },
360 { 0x00122c, 1, 0x04, 0x00000300 },
361 { 0x001230, 1, 0x04, 0x00010001 },
362 { 0x0007f8, 1, 0x04, 0x00000000 },
363 { 0x0015b4, 1, 0x04, 0x00000001 },
364 { 0x0015cc, 1, 0x04, 0x00000000 },
365 { 0x001534, 1, 0x04, 0x00000000 },
366 { 0x000fb0, 1, 0x04, 0x00000000 },
367 { 0x0015d0, 1, 0x04, 0x00000000 },
368 { 0x00153c, 1, 0x04, 0x00000000 },
369 { 0x0016b4, 1, 0x04, 0x00000003 },
370 { 0x000fbc, 4, 0x04, 0x0000ffff },
371 { 0x000df8, 2, 0x04, 0x00000000 },
372 { 0x001948, 1, 0x04, 0x00000000 },
373 { 0x001970, 1, 0x04, 0x00000001 },
374 { 0x00161c, 1, 0x04, 0x000009f0 },
375 { 0x000dcc, 1, 0x04, 0x00000010 },
376 { 0x00163c, 1, 0x04, 0x00000000 },
377 { 0x0015e4, 1, 0x04, 0x00000000 },
378 { 0x001160, 32, 0x04, 0x25e00040 },
379 { 0x001880, 32, 0x04, 0x00000000 },
380 { 0x000f84, 2, 0x04, 0x00000000 },
381 { 0x0017c8, 2, 0x04, 0x00000000 },
382 { 0x0017d0, 1, 0x04, 0x000000ff },
383 { 0x0017d4, 1, 0x04, 0xffffffff },
384 { 0x0017d8, 1, 0x04, 0x00000002 },
385 { 0x0017dc, 1, 0x04, 0x00000000 },
386 { 0x0015f4, 2, 0x04, 0x00000000 },
387 { 0x001434, 2, 0x04, 0x00000000 },
388 { 0x000d74, 1, 0x04, 0x00000000 },
389 { 0x000dec, 1, 0x04, 0x00000001 },
390 { 0x0013a4, 1, 0x04, 0x00000000 },
391 { 0x001318, 1, 0x04, 0x00000001 },
392 { 0x001644, 1, 0x04, 0x00000000 },
393 { 0x000748, 1, 0x04, 0x00000000 },
394 { 0x000de8, 1, 0x04, 0x00000000 },
395 { 0x001648, 1, 0x04, 0x00000000 },
396 { 0x0012a4, 1, 0x04, 0x00000000 },
397 { 0x001120, 4, 0x04, 0x00000000 },
398 { 0x001118, 1, 0x04, 0x00000000 },
399 { 0x00164c, 1, 0x04, 0x00000000 },
400 { 0x001658, 1, 0x04, 0x00000000 },
401 { 0x001910, 1, 0x04, 0x00000290 },
402 { 0x001518, 1, 0x04, 0x00000000 },
403 { 0x00165c, 1, 0x04, 0x00000001 },
404 { 0x001520, 1, 0x04, 0x00000000 },
405 { 0x001604, 1, 0x04, 0x00000000 },
406 { 0x001570, 1, 0x04, 0x00000000 },
407 { 0x0013b0, 2, 0x04, 0x3f800000 },
408 { 0x00020c, 1, 0x04, 0x00000000 },
409 { 0x001670, 1, 0x04, 0x30201000 },
410 { 0x001674, 1, 0x04, 0x70605040 },
411 { 0x001678, 1, 0x04, 0xb8a89888 },
412 { 0x00167c, 1, 0x04, 0xf8e8d8c8 },
413 { 0x00166c, 1, 0x04, 0x00000000 },
414 { 0x001680, 1, 0x04, 0x00ffff00 },
415 { 0x0012d0, 1, 0x04, 0x00000003 },
416 { 0x0012d4, 1, 0x04, 0x00000002 },
417 { 0x001684, 2, 0x04, 0x00000000 },
418 { 0x000dac, 2, 0x04, 0x00001b02 },
419 { 0x000db4, 1, 0x04, 0x00000000 },
420 { 0x00168c, 1, 0x04, 0x00000000 },
421 { 0x0015bc, 1, 0x04, 0x00000000 },
422 { 0x00156c, 1, 0x04, 0x00000000 },
423 { 0x00187c, 1, 0x04, 0x00000000 },
424 { 0x001110, 1, 0x04, 0x00000001 },
425 { 0x000dc0, 3, 0x04, 0x00000000 },
426 { 0x001234, 1, 0x04, 0x00000000 },
427 { 0x001690, 1, 0x04, 0x00000000 },
428 { 0x0012ac, 1, 0x04, 0x00000001 },
429 { 0x0002c4, 1, 0x04, 0x00000000 },
430 { 0x000790, 5, 0x04, 0x00000000 },
431 { 0x00077c, 1, 0x04, 0x00000000 },
432 { 0x001000, 1, 0x04, 0x00000010 },
433 { 0x0010fc, 1, 0x04, 0x00000000 },
434 { 0x001290, 1, 0x04, 0x00000000 },
435 { 0x000218, 1, 0x04, 0x00000010 },
436 { 0x0012d8, 1, 0x04, 0x00000000 },
437 { 0x0012dc, 1, 0x04, 0x00000010 },
438 { 0x000d94, 1, 0x04, 0x00000001 },
439 { 0x00155c, 2, 0x04, 0x00000000 },
440 { 0x001564, 1, 0x04, 0x00001fff },
441 { 0x001574, 2, 0x04, 0x00000000 },
442 { 0x00157c, 1, 0x04, 0x003fffff },
443 { 0x001354, 1, 0x04, 0x00000000 },
444 { 0x001664, 1, 0x04, 0x00000000 },
445 { 0x001610, 1, 0x04, 0x00000012 },
446 { 0x001608, 2, 0x04, 0x00000000 },
447 { 0x00162c, 1, 0x04, 0x00000003 },
448 { 0x000210, 1, 0x04, 0x00000000 },
449 { 0x000320, 1, 0x04, 0x00000000 },
450 { 0x000324, 6, 0x04, 0x3f800000 },
451 { 0x000750, 1, 0x04, 0x00000000 },
452 { 0x000760, 1, 0x04, 0x39291909 },
453 { 0x000764, 1, 0x04, 0x79695949 },
454 { 0x000768, 1, 0x04, 0xb9a99989 },
455 { 0x00076c, 1, 0x04, 0xf9e9d9c9 },
456 { 0x000770, 1, 0x04, 0x30201000 },
457 { 0x000774, 1, 0x04, 0x70605040 },
458 { 0x000778, 1, 0x04, 0x00009080 },
459 { 0x000780, 1, 0x04, 0x39291909 },
460 { 0x000784, 1, 0x04, 0x79695949 },
461 { 0x000788, 1, 0x04, 0xb9a99989 },
462 { 0x00078c, 1, 0x04, 0xf9e9d9c9 },
463 { 0x0007d0, 1, 0x04, 0x30201000 },
464 { 0x0007d4, 1, 0x04, 0x70605040 },
465 { 0x0007d8, 1, 0x04, 0x00009080 },
466 { 0x00037c, 1, 0x04, 0x00000001 },
467 { 0x000740, 2, 0x04, 0x00000000 },
468 { 0x002600, 1, 0x04, 0x00000000 },
469 { 0x001918, 1, 0x04, 0x00000000 },
470 { 0x00191c, 1, 0x04, 0x00000900 },
471 { 0x001920, 1, 0x04, 0x00000405 },
472 { 0x001308, 1, 0x04, 0x00000001 },
473 { 0x001924, 1, 0x04, 0x00000000 },
474 { 0x0013ac, 1, 0x04, 0x00000000 },
475 { 0x00192c, 1, 0x04, 0x00000001 },
476 { 0x00193c, 1, 0x04, 0x00002c1c },
477 { 0x000d7c, 1, 0x04, 0x00000000 },
478 { 0x000f8c, 1, 0x04, 0x00000000 },
479 { 0x0002c0, 1, 0x04, 0x00000001 },
480 { 0x001510, 1, 0x04, 0x00000000 },
481 { 0x001940, 1, 0x04, 0x00000000 },
482 { 0x000ff4, 2, 0x04, 0x00000000 },
483 { 0x00194c, 2, 0x04, 0x00000000 },
484 { 0x001968, 1, 0x04, 0x00000000 },
485 { 0x001590, 1, 0x04, 0x0000003f },
486 { 0x0007e8, 4, 0x04, 0x00000000 },
487 { 0x00196c, 1, 0x04, 0x00000011 },
488 { 0x00197c, 1, 0x04, 0x00000000 },
489 { 0x000fcc, 2, 0x04, 0x00000000 },
490 { 0x0002d8, 1, 0x04, 0x00000040 },
491 { 0x001980, 1, 0x04, 0x00000080 },
492 { 0x001504, 1, 0x04, 0x00000080 },
493 { 0x001984, 1, 0x04, 0x00000000 },
494 { 0x000300, 1, 0x04, 0x00000001 },
495 { 0x0013a8, 1, 0x04, 0x00000000 },
496 { 0x0012ec, 1, 0x04, 0x00000000 },
497 { 0x001310, 1, 0x04, 0x00000000 },
498 { 0x001314, 1, 0x04, 0x00000001 },
499 { 0x001380, 1, 0x04, 0x00000000 },
500 { 0x001384, 4, 0x04, 0x00000001 },
501 { 0x001394, 1, 0x04, 0x00000000 },
502 { 0x00139c, 1, 0x04, 0x00000000 },
503 { 0x001398, 1, 0x04, 0x00000000 },
504 { 0x001594, 1, 0x04, 0x00000000 },
505 { 0x001598, 4, 0x04, 0x00000001 },
506 { 0x000f54, 3, 0x04, 0x00000000 },
507 { 0x0019bc, 1, 0x04, 0x00000000 },
508 { 0x000f9c, 2, 0x04, 0x00000000 },
509 { 0x0012cc, 1, 0x04, 0x00000000 },
510 { 0x0012e8, 1, 0x04, 0x00000000 },
511 { 0x00130c, 1, 0x04, 0x00000001 },
512 { 0x001360, 8, 0x04, 0x00000000 },
513 { 0x00133c, 2, 0x04, 0x00000001 },
514 { 0x001344, 1, 0x04, 0x00000002 },
515 { 0x001348, 2, 0x04, 0x00000001 },
516 { 0x001350, 1, 0x04, 0x00000002 },
517 { 0x001358, 1, 0x04, 0x00000001 },
518 { 0x0012e4, 1, 0x04, 0x00000000 },
519 { 0x00131c, 1, 0x04, 0x00000000 },
520 { 0x001320, 3, 0x04, 0x00000000 },
521 { 0x0019c0, 1, 0x04, 0x00000000 },
522 { 0x001140, 1, 0x04, 0x00000000 },
523 { 0x0019c4, 1, 0x04, 0x00000000 },
524 { 0x0019c8, 1, 0x04, 0x00001500 },
525 { 0x00135c, 1, 0x04, 0x00000000 },
526 { 0x000f90, 1, 0x04, 0x00000000 },
527 { 0x0019e0, 8, 0x04, 0x00000001 },
528 { 0x0019cc, 1, 0x04, 0x00000001 },
529 { 0x0015b8, 1, 0x04, 0x00000000 },
530 { 0x001a00, 1, 0x04, 0x00001111 },
531 { 0x001a04, 7, 0x04, 0x00000000 },
532 { 0x000d6c, 2, 0x04, 0xffff0000 },
533 { 0x0010f8, 1, 0x04, 0x00001010 },
534 { 0x000d80, 5, 0x04, 0x00000000 },
535 { 0x000da0, 1, 0x04, 0x00000000 },
536 { 0x001508, 1, 0x04, 0x80000000 },
537 { 0x00150c, 1, 0x04, 0x40000000 },
538 { 0x001668, 1, 0x04, 0x00000000 },
539 { 0x000318, 2, 0x04, 0x00000008 },
540 { 0x000d9c, 1, 0x04, 0x00000001 },
541 { 0x0007dc, 1, 0x04, 0x00000000 },
542 { 0x00074c, 1, 0x04, 0x00000055 },
543 { 0x001420, 1, 0x04, 0x00000003 },
544 { 0x0017bc, 2, 0x04, 0x00000000 },
545 { 0x0017c4, 1, 0x04, 0x00000001 },
546 { 0x001008, 1, 0x04, 0x00000008 },
547 { 0x00100c, 1, 0x04, 0x00000040 },
548 { 0x001010, 1, 0x04, 0x0000012c },
549 { 0x000d60, 1, 0x04, 0x00000040 },
550 { 0x00075c, 1, 0x04, 0x00000003 },
551 { 0x001018, 1, 0x04, 0x00000020 },
552 { 0x00101c, 1, 0x04, 0x00000001 },
553 { 0x001020, 1, 0x04, 0x00000020 },
554 { 0x001024, 1, 0x04, 0x00000001 },
555 { 0x001444, 3, 0x04, 0x00000000 },
556 { 0x000360, 1, 0x04, 0x20164010 },
557 { 0x000364, 1, 0x04, 0x00000020 },
558 { 0x000368, 1, 0x04, 0x00000000 },
559 { 0x000de4, 1, 0x04, 0x00000000 },
560 { 0x000204, 1, 0x04, 0x00000006 },
561 { 0x000208, 1, 0x04, 0x00000000 },
562 { 0x0002cc, 1, 0x04, 0x003fffff },
563 { 0x0002d0, 1, 0x04, 0x00000c48 },
564 { 0x001220, 1, 0x04, 0x00000005 },
565 { 0x000fdc, 1, 0x04, 0x00000000 },
566 { 0x000f98, 1, 0x04, 0x00300008 },
567 { 0x001284, 1, 0x04, 0x04000080 },
568 { 0x001450, 1, 0x04, 0x00300008 },
569 { 0x001454, 1, 0x04, 0x04000080 },
570 { 0x000214, 1, 0x04, 0x00000000 },
571 {}
572};
573
574static struct nvc0_graph_init
575nvc1_grctx_init_9197[] = {
576 { 0x003400, 128, 0x04, 0x00000000 },
577 { 0x0002e4, 1, 0x04, 0x0000b001 },
578 {}
579};
580
581static struct nvc0_graph_init
582nvc1_grctx_init_unk58xx[] = {
583 { 0x405800, 1, 0x04, 0x0f8000bf },
584 { 0x405830, 1, 0x04, 0x02180218 },
585 { 0x405834, 2, 0x04, 0x00000000 },
586 { 0x405854, 1, 0x04, 0x00000000 },
587 { 0x405870, 4, 0x04, 0x00000001 },
588 { 0x405a00, 2, 0x04, 0x00000000 },
589 { 0x405a18, 1, 0x04, 0x00000000 },
590};
591
592static struct nvc0_graph_init
593nvc1_grctx_init_rop[] = {
594 { 0x408800, 1, 0x04, 0x02802a3c },
595 { 0x408804, 1, 0x04, 0x00000040 },
596 { 0x408808, 1, 0x04, 0x1003e005 },
597 { 0x408900, 1, 0x04, 0x3080b801 },
598 { 0x408904, 1, 0x04, 0x62000001 },
599 { 0x408908, 1, 0x04, 0x00c80929 },
600 { 0x408980, 1, 0x04, 0x0000011d },
601};
602
603static struct nvc0_graph_init
604nvc1_grctx_init_gpc_0[] = {
605 { 0x418380, 1, 0x04, 0x00000016 },
606 { 0x418400, 1, 0x04, 0x38004e00 },
607 { 0x418404, 1, 0x04, 0x71e0ffff },
608 { 0x418408, 1, 0x04, 0x00000000 },
609 { 0x41840c, 1, 0x04, 0x00001008 },
610 { 0x418410, 1, 0x04, 0x0fff0fff },
611 { 0x418414, 1, 0x04, 0x00200fff },
612 { 0x418450, 6, 0x04, 0x00000000 },
613 { 0x418468, 1, 0x04, 0x00000001 },
614 { 0x41846c, 2, 0x04, 0x00000000 },
615 { 0x418600, 1, 0x04, 0x0000001f },
616 { 0x418684, 1, 0x04, 0x0000000f },
617 { 0x418700, 1, 0x04, 0x00000002 },
618 { 0x418704, 1, 0x04, 0x00000080 },
619 { 0x418708, 1, 0x04, 0x00000000 },
620 { 0x41870c, 1, 0x04, 0x07c80000 },
621 { 0x418710, 1, 0x04, 0x00000000 },
622 { 0x418800, 1, 0x04, 0x0006860a },
623 { 0x418808, 3, 0x04, 0x00000000 },
624 { 0x418828, 1, 0x04, 0x00008442 },
625 { 0x418830, 1, 0x04, 0x10000001 },
626 { 0x4188d8, 1, 0x04, 0x00000008 },
627 { 0x4188e0, 1, 0x04, 0x01000000 },
628 { 0x4188e8, 5, 0x04, 0x00000000 },
629 { 0x4188fc, 1, 0x04, 0x00100018 },
630 { 0x41891c, 1, 0x04, 0x00ff00ff },
631 { 0x418924, 1, 0x04, 0x00000000 },
632 { 0x418928, 1, 0x04, 0x00ffff00 },
633 { 0x41892c, 1, 0x04, 0x0000ff00 },
634 { 0x418a00, 3, 0x04, 0x00000000 },
635 { 0x418a0c, 1, 0x04, 0x00010000 },
636 { 0x418a10, 3, 0x04, 0x00000000 },
637 { 0x418a20, 3, 0x04, 0x00000000 },
638 { 0x418a2c, 1, 0x04, 0x00010000 },
639 { 0x418a30, 3, 0x04, 0x00000000 },
640 { 0x418a40, 3, 0x04, 0x00000000 },
641 { 0x418a4c, 1, 0x04, 0x00010000 },
642 { 0x418a50, 3, 0x04, 0x00000000 },
643 { 0x418a60, 3, 0x04, 0x00000000 },
644 { 0x418a6c, 1, 0x04, 0x00010000 },
645 { 0x418a70, 3, 0x04, 0x00000000 },
646 { 0x418a80, 3, 0x04, 0x00000000 },
647 { 0x418a8c, 1, 0x04, 0x00010000 },
648 { 0x418a90, 3, 0x04, 0x00000000 },
649 { 0x418aa0, 3, 0x04, 0x00000000 },
650 { 0x418aac, 1, 0x04, 0x00010000 },
651 { 0x418ab0, 3, 0x04, 0x00000000 },
652 { 0x418ac0, 3, 0x04, 0x00000000 },
653 { 0x418acc, 1, 0x04, 0x00010000 },
654 { 0x418ad0, 3, 0x04, 0x00000000 },
655 { 0x418ae0, 3, 0x04, 0x00000000 },
656 { 0x418aec, 1, 0x04, 0x00010000 },
657 { 0x418af0, 3, 0x04, 0x00000000 },
658 { 0x418b00, 1, 0x04, 0x00000000 },
659 { 0x418b08, 1, 0x04, 0x0a418820 },
660 { 0x418b0c, 1, 0x04, 0x062080e6 },
661 { 0x418b10, 1, 0x04, 0x020398a4 },
662 { 0x418b14, 1, 0x04, 0x0e629062 },
663 { 0x418b18, 1, 0x04, 0x0a418820 },
664 { 0x418b1c, 1, 0x04, 0x000000e6 },
665 { 0x418bb8, 1, 0x04, 0x00000103 },
666 { 0x418c08, 1, 0x04, 0x00000001 },
667 { 0x418c10, 8, 0x04, 0x00000000 },
668 { 0x418c6c, 1, 0x04, 0x00000001 },
669 { 0x418c80, 1, 0x04, 0x20200004 },
670 { 0x418c8c, 1, 0x04, 0x00000001 },
671 { 0x419000, 1, 0x04, 0x00000780 },
672 { 0x419004, 2, 0x04, 0x00000000 },
673 { 0x419014, 1, 0x04, 0x00000004 },
674};
675
676static struct nvc0_graph_init
677nvc1_grctx_init_tpc[] = {
678 { 0x419818, 1, 0x04, 0x00000000 },
679 { 0x41983c, 1, 0x04, 0x00038bc7 },
680 { 0x419848, 1, 0x04, 0x00000000 },
681 { 0x419864, 1, 0x04, 0x00000129 },
682 { 0x419888, 1, 0x04, 0x00000000 },
683 { 0x419a00, 1, 0x04, 0x000001f0 },
684 { 0x419a04, 1, 0x04, 0x00000001 },
685 { 0x419a08, 1, 0x04, 0x00000023 },
686 { 0x419a0c, 1, 0x04, 0x00020000 },
687 { 0x419a10, 1, 0x04, 0x00000000 },
688 { 0x419a14, 1, 0x04, 0x00000200 },
689 { 0x419a1c, 1, 0x04, 0x00000000 },
690 { 0x419a20, 1, 0x04, 0x00000800 },
691 { 0x419ac4, 1, 0x04, 0x0007f440 },
692 { 0x419b00, 1, 0x04, 0x0a418820 },
693 { 0x419b04, 1, 0x04, 0x062080e6 },
694 { 0x419b08, 1, 0x04, 0x020398a4 },
695 { 0x419b0c, 1, 0x04, 0x0e629062 },
696 { 0x419b10, 1, 0x04, 0x0a418820 },
697 { 0x419b14, 1, 0x04, 0x000000e6 },
698 { 0x419bd0, 1, 0x04, 0x00900103 },
699 { 0x419be0, 1, 0x04, 0x00400001 },
700 { 0x419be4, 1, 0x04, 0x00000000 },
701 { 0x419c00, 1, 0x04, 0x00000002 },
702 { 0x419c04, 1, 0x04, 0x00000006 },
703 { 0x419c08, 1, 0x04, 0x00000002 },
704 { 0x419c20, 1, 0x04, 0x00000000 },
705 { 0x419cb0, 1, 0x04, 0x00020048 },
706 { 0x419ce8, 1, 0x04, 0x00000000 },
707 { 0x419cf4, 1, 0x04, 0x00000183 },
708 { 0x419d20, 1, 0x04, 0x12180000 },
709 { 0x419d24, 1, 0x04, 0x00001fff },
710 { 0x419d44, 1, 0x04, 0x02180218 },
711 { 0x419e04, 3, 0x04, 0x00000000 },
712 { 0x419e10, 1, 0x04, 0x00000002 },
713 { 0x419e44, 1, 0x04, 0x001beff2 },
714 { 0x419e48, 1, 0x04, 0x00000000 },
715 { 0x419e4c, 1, 0x04, 0x0000000f },
716 { 0x419e50, 17, 0x04, 0x00000000 },
717 { 0x419e98, 1, 0x04, 0x00000000 },
718 { 0x419ee0, 1, 0x04, 0x00011110 },
719 { 0x419f30, 11, 0x04, 0x00000000 },
720};
721
722void
723nvc1_grctx_generate_mods(struct nvc0_graph_priv *priv, struct nvc0_grctx *info)
724{
725 int gpc, tpc;
726 u32 offset;
727
728 mmio_data(0x002000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
729 mmio_data(0x008000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
730 mmio_data(0x060000, 0x1000, NV_MEM_ACCESS_RW);
731 mmio_list(0x408004, 0x00000000, 8, 0);
732 mmio_list(0x408008, 0x80000018, 0, 0);
733 mmio_list(0x40800c, 0x00000000, 8, 1);
734 mmio_list(0x408010, 0x80000000, 0, 0);
735 mmio_list(0x418810, 0x80000000, 12, 2);
736 mmio_list(0x419848, 0x10000000, 12, 2);
737 mmio_list(0x419004, 0x00000000, 8, 1);
738 mmio_list(0x419008, 0x00000000, 0, 0);
739 mmio_list(0x418808, 0x00000000, 8, 0);
740 mmio_list(0x41880c, 0x80000018, 0, 0);
741
742 mmio_list(0x405830, 0x02180218, 0, 0);
743 mmio_list(0x4064c4, 0x0086ffff, 0, 0);
744
745 for (gpc = 0, offset = 0; gpc < priv->gpc_nr; gpc++) {
746 for (tpc = 0; tpc < priv->tpc_nr[gpc]; tpc++) {
747 u32 addr = TPC_UNIT(gpc, tpc, 0x0520);
748 mmio_list(addr, 0x12180000 | offset, 0, 0);
749 offset += 0x0324;
750 }
751 for (tpc = 0; tpc < priv->tpc_nr[gpc]; tpc++) {
752 u32 addr = TPC_UNIT(gpc, tpc, 0x0544);
753 mmio_list(addr, 0x02180000 | offset, 0, 0);
754 offset += 0x0324;
755 }
756 }
757}
758
759void
760nvc1_grctx_generate_unkn(struct nvc0_graph_priv *priv)
761{
762 nv_mask(priv, 0x418c6c, 0x00000001, 0x00000001);
763 nv_mask(priv, 0x41980c, 0x00000010, 0x00000010);
764 nv_mask(priv, 0x419814, 0x00000004, 0x00000004);
765 nv_mask(priv, 0x4064c0, 0x80000000, 0x80000000);
766 nv_mask(priv, 0x405800, 0x08000000, 0x08000000);
767 nv_mask(priv, 0x419c00, 0x00000008, 0x00000008);
768}
769
770static struct nvc0_graph_init *
771nvc1_grctx_init_hub[] = {
772 nvc0_grctx_init_base,
773 nvc0_grctx_init_unk40xx,
774 nvc0_grctx_init_unk44xx,
775 nvc0_grctx_init_unk46xx,
776 nvc0_grctx_init_unk47xx,
777 nvc1_grctx_init_unk58xx,
778 nvc0_grctx_init_unk60xx,
779 nvc0_grctx_init_unk64xx,
780 nvc0_grctx_init_unk78xx,
781 nvc0_grctx_init_unk80xx,
782 nvc1_grctx_init_rop,
783 NULL
784};
785
786struct nvc0_graph_init *
787nvc1_grctx_init_gpc[] = {
788 nvc1_grctx_init_gpc_0,
789 nvc0_grctx_init_gpc_1,
790 nvc1_grctx_init_tpc,
791 NULL
792};
793
794static struct nvc0_graph_mthd
795nvc1_grctx_init_mthd[] = {
796 { 0x9097, nvc1_grctx_init_9097, },
797 { 0x9197, nvc1_grctx_init_9197, },
798 { 0x902d, nvc0_grctx_init_902d, },
799 { 0x9039, nvc0_grctx_init_9039, },
800 { 0x90c0, nvc0_grctx_init_90c0, },
801 { 0x902d, nvc0_grctx_init_mthd_magic, },
802 {}
803};
804
805struct nouveau_oclass *
806nvc1_grctx_oclass = &(struct nvc0_grctx_oclass) {
807 .base.handle = NV_ENGCTX(GR, 0xc1),
808 .base.ofuncs = &(struct nouveau_ofuncs) {
809 .ctor = nvc0_graph_context_ctor,
810 .dtor = nvc0_graph_context_dtor,
811 .init = _nouveau_graph_context_init,
812 .fini = _nouveau_graph_context_fini,
813 .rd32 = _nouveau_graph_context_rd32,
814 .wr32 = _nouveau_graph_context_wr32,
815 },
816 .main = nvc0_grctx_generate_main,
817 .mods = nvc1_grctx_generate_mods,
818 .unkn = nvc1_grctx_generate_unkn,
819 .hub = nvc1_grctx_init_hub,
820 .gpc = nvc1_grctx_init_gpc,
821 .icmd = nvc1_grctx_init_icmd,
822 .mthd = nvc1_grctx_init_mthd,
823}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc3.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc3.c
new file mode 100644
index 000000000000..8f237b3bd8c6
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc3.c
@@ -0,0 +1,99 @@
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 <bskeggs@redhat.com>
23 */
24
25#include "nvc0.h"
26
27static struct nvc0_graph_init
28nvc3_grctx_init_tpc[] = {
29 { 0x419818, 1, 0x04, 0x00000000 },
30 { 0x41983c, 1, 0x04, 0x00038bc7 },
31 { 0x419848, 1, 0x04, 0x00000000 },
32 { 0x419864, 1, 0x04, 0x0000012a },
33 { 0x419888, 1, 0x04, 0x00000000 },
34 { 0x419a00, 1, 0x04, 0x000001f0 },
35 { 0x419a04, 1, 0x04, 0x00000001 },
36 { 0x419a08, 1, 0x04, 0x00000023 },
37 { 0x419a0c, 1, 0x04, 0x00020000 },
38 { 0x419a10, 1, 0x04, 0x00000000 },
39 { 0x419a14, 1, 0x04, 0x00000200 },
40 { 0x419a1c, 1, 0x04, 0x00000000 },
41 { 0x419a20, 1, 0x04, 0x00000800 },
42 { 0x419ac4, 1, 0x04, 0x0007f440 },
43 { 0x419b00, 1, 0x04, 0x0a418820 },
44 { 0x419b04, 1, 0x04, 0x062080e6 },
45 { 0x419b08, 1, 0x04, 0x020398a4 },
46 { 0x419b0c, 1, 0x04, 0x0e629062 },
47 { 0x419b10, 1, 0x04, 0x0a418820 },
48 { 0x419b14, 1, 0x04, 0x000000e6 },
49 { 0x419bd0, 1, 0x04, 0x00900103 },
50 { 0x419be0, 1, 0x04, 0x00000001 },
51 { 0x419be4, 1, 0x04, 0x00000000 },
52 { 0x419c00, 1, 0x04, 0x00000002 },
53 { 0x419c04, 1, 0x04, 0x00000006 },
54 { 0x419c08, 1, 0x04, 0x00000002 },
55 { 0x419c20, 1, 0x04, 0x00000000 },
56 { 0x419cb0, 1, 0x04, 0x00020048 },
57 { 0x419ce8, 1, 0x04, 0x00000000 },
58 { 0x419cf4, 1, 0x04, 0x00000183 },
59 { 0x419d20, 1, 0x04, 0x02180000 },
60 { 0x419d24, 1, 0x04, 0x00001fff },
61 { 0x419e04, 3, 0x04, 0x00000000 },
62 { 0x419e10, 1, 0x04, 0x00000002 },
63 { 0x419e44, 1, 0x04, 0x001beff2 },
64 { 0x419e48, 1, 0x04, 0x00000000 },
65 { 0x419e4c, 1, 0x04, 0x0000000f },
66 { 0x419e50, 17, 0x04, 0x00000000 },
67 { 0x419e98, 1, 0x04, 0x00000000 },
68 { 0x419ee0, 1, 0x04, 0x00011110 },
69 { 0x419f30, 11, 0x04, 0x00000000 },
70 {}
71};
72
73struct nvc0_graph_init *
74nvc3_grctx_init_gpc[] = {
75 nvc0_grctx_init_gpc_0,
76 nvc0_grctx_init_gpc_1,
77 nvc3_grctx_init_tpc,
78 NULL
79};
80
81struct nouveau_oclass *
82nvc3_grctx_oclass = &(struct nvc0_grctx_oclass) {
83 .base.handle = NV_ENGCTX(GR, 0xc3),
84 .base.ofuncs = &(struct nouveau_ofuncs) {
85 .ctor = nvc0_graph_context_ctor,
86 .dtor = nvc0_graph_context_dtor,
87 .init = _nouveau_graph_context_init,
88 .fini = _nouveau_graph_context_fini,
89 .rd32 = _nouveau_graph_context_rd32,
90 .wr32 = _nouveau_graph_context_wr32,
91 },
92 .main = nvc0_grctx_generate_main,
93 .mods = nvc0_grctx_generate_mods,
94 .unkn = nvc0_grctx_generate_unkn,
95 .hub = nvc0_grctx_init_hub,
96 .gpc = nvc3_grctx_init_gpc,
97 .icmd = nvc0_grctx_init_icmd,
98 .mthd = nvc0_grctx_init_mthd,
99}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc8.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc8.c
new file mode 100644
index 000000000000..d0d4ce3c4892
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc8.c
@@ -0,0 +1,370 @@
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 <bskeggs@redhat.com>
23 */
24
25#include "nvc0.h"
26
27static struct nvc0_graph_init
28nvc8_grctx_init_icmd[] = {
29 { 0x001000, 1, 0x01, 0x00000004 },
30 { 0x0000a9, 1, 0x01, 0x0000ffff },
31 { 0x000038, 1, 0x01, 0x0fac6881 },
32 { 0x00003d, 1, 0x01, 0x00000001 },
33 { 0x0000e8, 8, 0x01, 0x00000400 },
34 { 0x000078, 8, 0x01, 0x00000300 },
35 { 0x000050, 1, 0x01, 0x00000011 },
36 { 0x000058, 8, 0x01, 0x00000008 },
37 { 0x000208, 8, 0x01, 0x00000001 },
38 { 0x000081, 1, 0x01, 0x00000001 },
39 { 0x000085, 1, 0x01, 0x00000004 },
40 { 0x000088, 1, 0x01, 0x00000400 },
41 { 0x000090, 1, 0x01, 0x00000300 },
42 { 0x000098, 1, 0x01, 0x00001001 },
43 { 0x0000e3, 1, 0x01, 0x00000001 },
44 { 0x0000da, 1, 0x01, 0x00000001 },
45 { 0x0000f8, 1, 0x01, 0x00000003 },
46 { 0x0000fa, 1, 0x01, 0x00000001 },
47 { 0x00009f, 4, 0x01, 0x0000ffff },
48 { 0x0000b1, 1, 0x01, 0x00000001 },
49 { 0x0000b2, 40, 0x01, 0x00000000 },
50 { 0x000210, 8, 0x01, 0x00000040 },
51 { 0x000218, 8, 0x01, 0x0000c080 },
52 { 0x0000ad, 1, 0x01, 0x0000013e },
53 { 0x0000e1, 1, 0x01, 0x00000010 },
54 { 0x000290, 16, 0x01, 0x00000000 },
55 { 0x0003b0, 16, 0x01, 0x00000000 },
56 { 0x0002a0, 16, 0x01, 0x00000000 },
57 { 0x000420, 16, 0x01, 0x00000000 },
58 { 0x0002b0, 16, 0x01, 0x00000000 },
59 { 0x000430, 16, 0x01, 0x00000000 },
60 { 0x0002c0, 16, 0x01, 0x00000000 },
61 { 0x0004d0, 16, 0x01, 0x00000000 },
62 { 0x000720, 16, 0x01, 0x00000000 },
63 { 0x0008c0, 16, 0x01, 0x00000000 },
64 { 0x000890, 16, 0x01, 0x00000000 },
65 { 0x0008e0, 16, 0x01, 0x00000000 },
66 { 0x0008a0, 16, 0x01, 0x00000000 },
67 { 0x0008f0, 16, 0x01, 0x00000000 },
68 { 0x00094c, 1, 0x01, 0x000000ff },
69 { 0x00094d, 1, 0x01, 0xffffffff },
70 { 0x00094e, 1, 0x01, 0x00000002 },
71 { 0x0002ec, 1, 0x01, 0x00000001 },
72 { 0x000303, 1, 0x01, 0x00000001 },
73 { 0x0002e6, 1, 0x01, 0x00000001 },
74 { 0x000466, 1, 0x01, 0x00000052 },
75 { 0x000301, 1, 0x01, 0x3f800000 },
76 { 0x000304, 1, 0x01, 0x30201000 },
77 { 0x000305, 1, 0x01, 0x70605040 },
78 { 0x000306, 1, 0x01, 0xb8a89888 },
79 { 0x000307, 1, 0x01, 0xf8e8d8c8 },
80 { 0x00030a, 1, 0x01, 0x00ffff00 },
81 { 0x00030b, 1, 0x01, 0x0000001a },
82 { 0x00030c, 1, 0x01, 0x00000001 },
83 { 0x000318, 1, 0x01, 0x00000001 },
84 { 0x000340, 1, 0x01, 0x00000000 },
85 { 0x000375, 1, 0x01, 0x00000001 },
86 { 0x000351, 1, 0x01, 0x00000100 },
87 { 0x00037d, 1, 0x01, 0x00000006 },
88 { 0x0003a0, 1, 0x01, 0x00000002 },
89 { 0x0003aa, 1, 0x01, 0x00000001 },
90 { 0x0003a9, 1, 0x01, 0x00000001 },
91 { 0x000380, 1, 0x01, 0x00000001 },
92 { 0x000360, 1, 0x01, 0x00000040 },
93 { 0x000366, 2, 0x01, 0x00000000 },
94 { 0x000368, 1, 0x01, 0x00001fff },
95 { 0x000370, 2, 0x01, 0x00000000 },
96 { 0x000372, 1, 0x01, 0x003fffff },
97 { 0x00037a, 1, 0x01, 0x00000012 },
98 { 0x0005e0, 5, 0x01, 0x00000022 },
99 { 0x000619, 1, 0x01, 0x00000003 },
100 { 0x000811, 1, 0x01, 0x00000003 },
101 { 0x000812, 1, 0x01, 0x00000004 },
102 { 0x000813, 1, 0x01, 0x00000006 },
103 { 0x000814, 1, 0x01, 0x00000008 },
104 { 0x000815, 1, 0x01, 0x0000000b },
105 { 0x000800, 6, 0x01, 0x00000001 },
106 { 0x000632, 1, 0x01, 0x00000001 },
107 { 0x000633, 1, 0x01, 0x00000002 },
108 { 0x000634, 1, 0x01, 0x00000003 },
109 { 0x000635, 1, 0x01, 0x00000004 },
110 { 0x000654, 1, 0x01, 0x3f800000 },
111 { 0x000657, 1, 0x01, 0x3f800000 },
112 { 0x000655, 2, 0x01, 0x3f800000 },
113 { 0x0006cd, 1, 0x01, 0x3f800000 },
114 { 0x0007f5, 1, 0x01, 0x3f800000 },
115 { 0x0007dc, 1, 0x01, 0x39291909 },
116 { 0x0007dd, 1, 0x01, 0x79695949 },
117 { 0x0007de, 1, 0x01, 0xb9a99989 },
118 { 0x0007df, 1, 0x01, 0xf9e9d9c9 },
119 { 0x0007e8, 1, 0x01, 0x00003210 },
120 { 0x0007e9, 1, 0x01, 0x00007654 },
121 { 0x0007ea, 1, 0x01, 0x00000098 },
122 { 0x0007ec, 1, 0x01, 0x39291909 },
123 { 0x0007ed, 1, 0x01, 0x79695949 },
124 { 0x0007ee, 1, 0x01, 0xb9a99989 },
125 { 0x0007ef, 1, 0x01, 0xf9e9d9c9 },
126 { 0x0007f0, 1, 0x01, 0x00003210 },
127 { 0x0007f1, 1, 0x01, 0x00007654 },
128 { 0x0007f2, 1, 0x01, 0x00000098 },
129 { 0x0005a5, 1, 0x01, 0x00000001 },
130 { 0x000980, 128, 0x01, 0x00000000 },
131 { 0x000468, 1, 0x01, 0x00000004 },
132 { 0x00046c, 1, 0x01, 0x00000001 },
133 { 0x000470, 96, 0x01, 0x00000000 },
134 { 0x000510, 16, 0x01, 0x3f800000 },
135 { 0x000520, 1, 0x01, 0x000002b6 },
136 { 0x000529, 1, 0x01, 0x00000001 },
137 { 0x000530, 16, 0x01, 0xffff0000 },
138 { 0x000585, 1, 0x01, 0x0000003f },
139 { 0x000576, 1, 0x01, 0x00000003 },
140 { 0x00057b, 1, 0x01, 0x00000059 },
141 { 0x000586, 1, 0x01, 0x00000040 },
142 { 0x000582, 2, 0x01, 0x00000080 },
143 { 0x0005c2, 1, 0x01, 0x00000001 },
144 { 0x000638, 1, 0x01, 0x00000001 },
145 { 0x000639, 1, 0x01, 0x00000001 },
146 { 0x00063a, 1, 0x01, 0x00000002 },
147 { 0x00063b, 2, 0x01, 0x00000001 },
148 { 0x00063d, 1, 0x01, 0x00000002 },
149 { 0x00063e, 1, 0x01, 0x00000001 },
150 { 0x0008b8, 8, 0x01, 0x00000001 },
151 { 0x000900, 8, 0x01, 0x00000001 },
152 { 0x000908, 8, 0x01, 0x00000002 },
153 { 0x000910, 16, 0x01, 0x00000001 },
154 { 0x000920, 8, 0x01, 0x00000002 },
155 { 0x000928, 8, 0x01, 0x00000001 },
156 { 0x000648, 9, 0x01, 0x00000001 },
157 { 0x000658, 1, 0x01, 0x0000000f },
158 { 0x0007ff, 1, 0x01, 0x0000000a },
159 { 0x00066a, 1, 0x01, 0x40000000 },
160 { 0x00066b, 1, 0x01, 0x10000000 },
161 { 0x00066c, 2, 0x01, 0xffff0000 },
162 { 0x0007af, 2, 0x01, 0x00000008 },
163 { 0x0007f6, 1, 0x01, 0x00000001 },
164 { 0x0006b2, 1, 0x01, 0x00000055 },
165 { 0x0007ad, 1, 0x01, 0x00000003 },
166 { 0x000937, 1, 0x01, 0x00000001 },
167 { 0x000971, 1, 0x01, 0x00000008 },
168 { 0x000972, 1, 0x01, 0x00000040 },
169 { 0x000973, 1, 0x01, 0x0000012c },
170 { 0x00097c, 1, 0x01, 0x00000040 },
171 { 0x000979, 1, 0x01, 0x00000003 },
172 { 0x000975, 1, 0x01, 0x00000020 },
173 { 0x000976, 1, 0x01, 0x00000001 },
174 { 0x000977, 1, 0x01, 0x00000020 },
175 { 0x000978, 1, 0x01, 0x00000001 },
176 { 0x000957, 1, 0x01, 0x00000003 },
177 { 0x00095e, 1, 0x01, 0x20164010 },
178 { 0x00095f, 1, 0x01, 0x00000020 },
179 { 0x00097d, 1, 0x01, 0x00000020 },
180 { 0x000683, 1, 0x01, 0x00000006 },
181 { 0x000685, 1, 0x01, 0x003fffff },
182 { 0x000687, 1, 0x01, 0x00000c48 },
183 { 0x0006a0, 1, 0x01, 0x00000005 },
184 { 0x000840, 1, 0x01, 0x00300008 },
185 { 0x000841, 1, 0x01, 0x04000080 },
186 { 0x000842, 1, 0x01, 0x00300008 },
187 { 0x000843, 1, 0x01, 0x04000080 },
188 { 0x000818, 8, 0x01, 0x00000000 },
189 { 0x000848, 16, 0x01, 0x00000000 },
190 { 0x000738, 1, 0x01, 0x00000000 },
191 { 0x0006aa, 1, 0x01, 0x00000001 },
192 { 0x0006ab, 1, 0x01, 0x00000002 },
193 { 0x0006ac, 1, 0x01, 0x00000080 },
194 { 0x0006ad, 2, 0x01, 0x00000100 },
195 { 0x0006b1, 1, 0x01, 0x00000011 },
196 { 0x0006bb, 1, 0x01, 0x000000cf },
197 { 0x0006ce, 1, 0x01, 0x2a712488 },
198 { 0x000739, 1, 0x01, 0x4085c000 },
199 { 0x00073a, 1, 0x01, 0x00000080 },
200 { 0x000786, 1, 0x01, 0x80000100 },
201 { 0x00073c, 1, 0x01, 0x00010100 },
202 { 0x00073d, 1, 0x01, 0x02800000 },
203 { 0x000787, 1, 0x01, 0x000000cf },
204 { 0x00078c, 1, 0x01, 0x00000008 },
205 { 0x000792, 1, 0x01, 0x00000001 },
206 { 0x000794, 1, 0x01, 0x00000001 },
207 { 0x000795, 2, 0x01, 0x00000001 },
208 { 0x000797, 1, 0x01, 0x000000cf },
209 { 0x000836, 1, 0x01, 0x00000001 },
210 { 0x00079a, 1, 0x01, 0x00000002 },
211 { 0x000833, 1, 0x01, 0x04444480 },
212 { 0x0007a1, 1, 0x01, 0x00000001 },
213 { 0x0007a3, 1, 0x01, 0x00000001 },
214 { 0x0007a4, 2, 0x01, 0x00000001 },
215 { 0x000831, 1, 0x01, 0x00000004 },
216 { 0x00080c, 1, 0x01, 0x00000002 },
217 { 0x00080d, 2, 0x01, 0x00000100 },
218 { 0x00080f, 1, 0x01, 0x00000001 },
219 { 0x000823, 1, 0x01, 0x00000002 },
220 { 0x000824, 2, 0x01, 0x00000100 },
221 { 0x000826, 1, 0x01, 0x00000001 },
222 { 0x00095d, 1, 0x01, 0x00000001 },
223 { 0x00082b, 1, 0x01, 0x00000004 },
224 { 0x000942, 1, 0x01, 0x00010001 },
225 { 0x000943, 1, 0x01, 0x00000001 },
226 { 0x000944, 1, 0x01, 0x00000022 },
227 { 0x0007c5, 1, 0x01, 0x00010001 },
228 { 0x000834, 1, 0x01, 0x00000001 },
229 { 0x0007c7, 1, 0x01, 0x00000001 },
230 { 0x00c1b0, 8, 0x01, 0x0000000f },
231 { 0x00c1b8, 1, 0x01, 0x0fac6881 },
232 { 0x00c1b9, 1, 0x01, 0x00fac688 },
233 { 0x01e100, 1, 0x01, 0x00000001 },
234 { 0x001000, 1, 0x01, 0x00000002 },
235 { 0x0006aa, 1, 0x01, 0x00000001 },
236 { 0x0006ad, 2, 0x01, 0x00000100 },
237 { 0x0006b1, 1, 0x01, 0x00000011 },
238 { 0x00078c, 1, 0x01, 0x00000008 },
239 { 0x000792, 1, 0x01, 0x00000001 },
240 { 0x000794, 1, 0x01, 0x00000001 },
241 { 0x000795, 2, 0x01, 0x00000001 },
242 { 0x000797, 1, 0x01, 0x000000cf },
243 { 0x00079a, 1, 0x01, 0x00000002 },
244 { 0x000833, 1, 0x01, 0x04444480 },
245 { 0x0007a1, 1, 0x01, 0x00000001 },
246 { 0x0007a3, 1, 0x01, 0x00000001 },
247 { 0x0007a4, 2, 0x01, 0x00000001 },
248 { 0x000831, 1, 0x01, 0x00000004 },
249 { 0x01e100, 1, 0x01, 0x00000001 },
250 { 0x001000, 1, 0x01, 0x00000014 },
251 { 0x000351, 1, 0x01, 0x00000100 },
252 { 0x000957, 1, 0x01, 0x00000003 },
253 { 0x00095d, 1, 0x01, 0x00000001 },
254 { 0x00082b, 1, 0x01, 0x00000004 },
255 { 0x000942, 1, 0x01, 0x00010001 },
256 { 0x000943, 1, 0x01, 0x00000001 },
257 { 0x0007c5, 1, 0x01, 0x00010001 },
258 { 0x000834, 1, 0x01, 0x00000001 },
259 { 0x0007c7, 1, 0x01, 0x00000001 },
260 { 0x01e100, 1, 0x01, 0x00000001 },
261 { 0x001000, 1, 0x01, 0x00000001 },
262 { 0x00080c, 1, 0x01, 0x00000002 },
263 { 0x00080d, 2, 0x01, 0x00000100 },
264 { 0x00080f, 1, 0x01, 0x00000001 },
265 { 0x000823, 1, 0x01, 0x00000002 },
266 { 0x000824, 2, 0x01, 0x00000100 },
267 { 0x000826, 1, 0x01, 0x00000001 },
268 { 0x01e100, 1, 0x01, 0x00000001 },
269 {}
270};
271
272static struct nvc0_graph_init
273nvc8_grctx_init_tpc[] = {
274 { 0x419818, 1, 0x04, 0x00000000 },
275 { 0x41983c, 1, 0x04, 0x00038bc7 },
276 { 0x419848, 1, 0x04, 0x00000000 },
277 { 0x419864, 1, 0x04, 0x0000012a },
278 { 0x419888, 1, 0x04, 0x00000000 },
279 { 0x419a00, 1, 0x04, 0x000001f0 },
280 { 0x419a04, 1, 0x04, 0x00000001 },
281 { 0x419a08, 1, 0x04, 0x00000023 },
282 { 0x419a0c, 1, 0x04, 0x00020000 },
283 { 0x419a10, 1, 0x04, 0x00000000 },
284 { 0x419a14, 1, 0x04, 0x00000200 },
285 { 0x419a1c, 1, 0x04, 0x00000000 },
286 { 0x419a20, 1, 0x04, 0x00000800 },
287 { 0x419b00, 1, 0x04, 0x0a418820 },
288 { 0x419b04, 1, 0x04, 0x062080e6 },
289 { 0x419b08, 1, 0x04, 0x020398a4 },
290 { 0x419b0c, 1, 0x04, 0x0e629062 },
291 { 0x419b10, 1, 0x04, 0x0a418820 },
292 { 0x419b14, 1, 0x04, 0x000000e6 },
293 { 0x419bd0, 1, 0x04, 0x00900103 },
294 { 0x419be0, 1, 0x04, 0x00000001 },
295 { 0x419be4, 1, 0x04, 0x00000000 },
296 { 0x419c00, 1, 0x04, 0x00000002 },
297 { 0x419c04, 1, 0x04, 0x00000006 },
298 { 0x419c08, 1, 0x04, 0x00000002 },
299 { 0x419c20, 1, 0x04, 0x00000000 },
300 { 0x419cb0, 1, 0x04, 0x00060048 },
301 { 0x419ce8, 1, 0x04, 0x00000000 },
302 { 0x419cf4, 1, 0x04, 0x00000183 },
303 { 0x419d20, 1, 0x04, 0x02180000 },
304 { 0x419d24, 1, 0x04, 0x00001fff },
305 { 0x419e04, 3, 0x04, 0x00000000 },
306 { 0x419e10, 1, 0x04, 0x00000002 },
307 { 0x419e44, 1, 0x04, 0x001beff2 },
308 { 0x419e48, 1, 0x04, 0x00000000 },
309 { 0x419e4c, 1, 0x04, 0x0000000f },
310 { 0x419e50, 17, 0x04, 0x00000000 },
311 { 0x419e98, 1, 0x04, 0x00000000 },
312 { 0x419f50, 2, 0x04, 0x00000000 },
313 {}
314};
315
316struct nvc0_graph_init
317nvc8_grctx_init_9197[] = {
318 { 0x0002e4, 1, 0x04, 0x0000b001 },
319 {}
320};
321
322struct nvc0_graph_init
323nvc8_grctx_init_9297[] = {
324 { 0x003400, 128, 0x04, 0x00000000 },
325 { 0x00036c, 2, 0x04, 0x00000000 },
326 { 0x0007a4, 2, 0x04, 0x00000000 },
327 { 0x000374, 1, 0x04, 0x00000000 },
328 { 0x000378, 1, 0x04, 0x00000020 },
329 {}
330};
331
332static struct nvc0_graph_mthd
333nvc8_grctx_init_mthd[] = {
334 { 0x9097, nvc1_grctx_init_9097, },
335 { 0x9197, nvc8_grctx_init_9197, },
336 { 0x9297, nvc8_grctx_init_9297, },
337 { 0x902d, nvc0_grctx_init_902d, },
338 { 0x9039, nvc0_grctx_init_9039, },
339 { 0x90c0, nvc0_grctx_init_90c0, },
340 { 0x902d, nvc0_grctx_init_mthd_magic, },
341 {}
342};
343
344static struct nvc0_graph_init *
345nvc8_grctx_init_gpc[] = {
346 nvc0_grctx_init_gpc_0,
347 nvc0_grctx_init_gpc_1,
348 nvc8_grctx_init_tpc,
349 NULL
350};
351
352struct nouveau_oclass *
353nvc8_grctx_oclass = &(struct nvc0_grctx_oclass) {
354 .base.handle = NV_ENGCTX(GR, 0xc8),
355 .base.ofuncs = &(struct nouveau_ofuncs) {
356 .ctor = nvc0_graph_context_ctor,
357 .dtor = nvc0_graph_context_dtor,
358 .init = _nouveau_graph_context_init,
359 .fini = _nouveau_graph_context_fini,
360 .rd32 = _nouveau_graph_context_rd32,
361 .wr32 = _nouveau_graph_context_wr32,
362 },
363 .main = nvc0_grctx_generate_main,
364 .mods = nvc0_grctx_generate_mods,
365 .unkn = nvc0_grctx_generate_unkn,
366 .hub = nvc0_grctx_init_hub,
367 .gpc = nvc8_grctx_init_gpc,
368 .icmd = nvc8_grctx_init_icmd,
369 .mthd = nvc8_grctx_init_mthd,
370}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd7.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd7.c
new file mode 100644
index 000000000000..438e78410808
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd7.c
@@ -0,0 +1,290 @@
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 <bskeggs@redhat.com>
23 */
24
25#include "nvc0.h"
26
27struct nvc0_graph_init
28nvd7_grctx_init_unk40xx[] = {
29 { 0x404004, 10, 0x04, 0x00000000 },
30 { 0x404044, 1, 0x04, 0x00000000 },
31 { 0x404094, 1, 0x04, 0x00000000 },
32 { 0x404098, 12, 0x04, 0x00000000 },
33 { 0x4040c8, 1, 0x04, 0xf0000087 },
34 { 0x4040d0, 6, 0x04, 0x00000000 },
35 { 0x4040e8, 1, 0x04, 0x00001000 },
36 { 0x4040f8, 1, 0x04, 0x00000000 },
37 { 0x404130, 1, 0x04, 0x00000000 },
38 { 0x404134, 1, 0x04, 0x00000000 },
39 { 0x404138, 1, 0x04, 0x20000040 },
40 { 0x404150, 1, 0x04, 0x0000002e },
41 { 0x404154, 1, 0x04, 0x00000400 },
42 { 0x404158, 1, 0x04, 0x00000200 },
43 { 0x404164, 1, 0x04, 0x00000055 },
44 { 0x404168, 1, 0x04, 0x00000000 },
45 { 0x404178, 2, 0x04, 0x00000000 },
46 { 0x404200, 8, 0x04, 0x00000000 },
47 {}
48};
49
50static struct nvc0_graph_init
51nvd7_grctx_init_unk58xx[] = {
52 { 0x405800, 1, 0x04, 0x0f8000bf },
53 { 0x405830, 1, 0x04, 0x02180324 },
54 { 0x405834, 1, 0x04, 0x08000000 },
55 { 0x405838, 1, 0x04, 0x00000000 },
56 { 0x405854, 1, 0x04, 0x00000000 },
57 { 0x405870, 4, 0x04, 0x00000001 },
58 { 0x405a00, 2, 0x04, 0x00000000 },
59 { 0x405a18, 1, 0x04, 0x00000000 },
60 {}
61};
62
63static struct nvc0_graph_init
64nvd7_grctx_init_unk64xx[] = {
65 { 0x4064a8, 1, 0x04, 0x00000000 },
66 { 0x4064ac, 1, 0x04, 0x00003fff },
67 { 0x4064b4, 3, 0x04, 0x00000000 },
68 { 0x4064c0, 1, 0x04, 0x801a0078 },
69 { 0x4064c4, 1, 0x04, 0x00c9ffff },
70 { 0x4064d0, 8, 0x04, 0x00000000 },
71 {}
72};
73
74static struct nvc0_graph_init
75nvd7_grctx_init_gpc_0[] = {
76 { 0x418380, 1, 0x04, 0x00000016 },
77 { 0x418400, 1, 0x04, 0x38004e00 },
78 { 0x418404, 1, 0x04, 0x71e0ffff },
79 { 0x41840c, 1, 0x04, 0x00001008 },
80 { 0x418410, 1, 0x04, 0x0fff0fff },
81 { 0x418414, 1, 0x04, 0x02200fff },
82 { 0x418450, 6, 0x04, 0x00000000 },
83 { 0x418468, 1, 0x04, 0x00000001 },
84 { 0x41846c, 2, 0x04, 0x00000000 },
85 { 0x418600, 1, 0x04, 0x0000001f },
86 { 0x418684, 1, 0x04, 0x0000000f },
87 { 0x418700, 1, 0x04, 0x00000002 },
88 { 0x418704, 1, 0x04, 0x00000080 },
89 { 0x418708, 3, 0x04, 0x00000000 },
90 { 0x418800, 1, 0x04, 0x7006860a },
91 { 0x418808, 3, 0x04, 0x00000000 },
92 { 0x418828, 1, 0x04, 0x00008442 },
93 { 0x418830, 1, 0x04, 0x10000001 },
94 { 0x4188d8, 1, 0x04, 0x00000008 },
95 { 0x4188e0, 1, 0x04, 0x01000000 },
96 { 0x4188e8, 5, 0x04, 0x00000000 },
97 { 0x4188fc, 1, 0x04, 0x20100018 },
98 { 0x41891c, 1, 0x04, 0x00ff00ff },
99 { 0x418924, 1, 0x04, 0x00000000 },
100 { 0x418928, 1, 0x04, 0x00ffff00 },
101 { 0x41892c, 1, 0x04, 0x0000ff00 },
102 { 0x418b00, 1, 0x04, 0x00000006 },
103 { 0x418b08, 1, 0x04, 0x0a418820 },
104 { 0x418b0c, 1, 0x04, 0x062080e6 },
105 { 0x418b10, 1, 0x04, 0x020398a4 },
106 { 0x418b14, 1, 0x04, 0x0e629062 },
107 { 0x418b18, 1, 0x04, 0x0a418820 },
108 { 0x418b1c, 1, 0x04, 0x000000e6 },
109 { 0x418bb8, 1, 0x04, 0x00000103 },
110 { 0x418c08, 1, 0x04, 0x00000001 },
111 { 0x418c10, 8, 0x04, 0x00000000 },
112 { 0x418c6c, 1, 0x04, 0x00000001 },
113 { 0x418c80, 1, 0x04, 0x20200004 },
114 { 0x418c8c, 1, 0x04, 0x00000001 },
115 { 0x419000, 1, 0x04, 0x00000780 },
116 { 0x419004, 2, 0x04, 0x00000000 },
117 { 0x419014, 1, 0x04, 0x00000004 },
118 {}
119};
120
121static struct nvc0_graph_init
122nvd7_grctx_init_tpc[] = {
123 { 0x419848, 1, 0x04, 0x00000000 },
124 { 0x419864, 1, 0x04, 0x00000129 },
125 { 0x419888, 1, 0x04, 0x00000000 },
126 { 0x419a00, 1, 0x04, 0x000001f0 },
127 { 0x419a04, 1, 0x04, 0x00000001 },
128 { 0x419a08, 1, 0x04, 0x00000023 },
129 { 0x419a0c, 1, 0x04, 0x00020000 },
130 { 0x419a10, 1, 0x04, 0x00000000 },
131 { 0x419a14, 1, 0x04, 0x00000200 },
132 { 0x419a1c, 1, 0x04, 0x00008000 },
133 { 0x419a20, 1, 0x04, 0x00000800 },
134 { 0x419ac4, 1, 0x04, 0x0017f440 },
135 { 0x419c00, 1, 0x04, 0x0000000a },
136 { 0x419c04, 1, 0x04, 0x00000006 },
137 { 0x419c08, 1, 0x04, 0x00000002 },
138 { 0x419c20, 1, 0x04, 0x00000000 },
139 { 0x419c24, 1, 0x04, 0x00084210 },
140 { 0x419c28, 1, 0x04, 0x3efbefbe },
141 { 0x419cb0, 1, 0x04, 0x00020048 },
142 { 0x419ce8, 1, 0x04, 0x00000000 },
143 { 0x419cf4, 1, 0x04, 0x00000183 },
144 { 0x419e04, 3, 0x04, 0x00000000 },
145 { 0x419e10, 1, 0x04, 0x00000002 },
146 { 0x419e44, 1, 0x04, 0x001beff2 },
147 { 0x419e48, 1, 0x04, 0x00000000 },
148 { 0x419e4c, 1, 0x04, 0x0000000f },
149 { 0x419e50, 17, 0x04, 0x00000000 },
150 { 0x419e98, 1, 0x04, 0x00000000 },
151 { 0x419ee0, 1, 0x04, 0x00010110 },
152 { 0x419f30, 11, 0x04, 0x00000000 },
153 {}
154};
155
156static struct nvc0_graph_init
157nvd7_grctx_init_unk[] = {
158 { 0x41be24, 1, 0x04, 0x00000002 },
159 { 0x41bec0, 1, 0x04, 0x12180000 },
160 { 0x41bec4, 1, 0x04, 0x00003fff },
161 { 0x41bee4, 1, 0x04, 0x03240218 },
162 { 0x41bf00, 1, 0x04, 0x0a418820 },
163 { 0x41bf04, 1, 0x04, 0x062080e6 },
164 { 0x41bf08, 1, 0x04, 0x020398a4 },
165 { 0x41bf0c, 1, 0x04, 0x0e629062 },
166 { 0x41bf10, 1, 0x04, 0x0a418820 },
167 { 0x41bf14, 1, 0x04, 0x000000e6 },
168 { 0x41bfd0, 1, 0x04, 0x00900103 },
169 { 0x41bfe0, 1, 0x04, 0x00400001 },
170 { 0x41bfe4, 1, 0x04, 0x00000000 },
171 {}
172};
173
174static void
175nvd7_grctx_generate_mods(struct nvc0_graph_priv *priv, struct nvc0_grctx *info)
176{
177 u32 magic[GPC_MAX][2];
178 u32 offset;
179 int gpc;
180
181 mmio_data(0x003000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
182 mmio_data(0x008000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
183 mmio_data(0x060000, 0x1000, NV_MEM_ACCESS_RW);
184 mmio_list(0x40800c, 0x00000000, 8, 1);
185 mmio_list(0x408010, 0x80000000, 0, 0);
186 mmio_list(0x419004, 0x00000000, 8, 1);
187 mmio_list(0x419008, 0x00000000, 0, 0);
188 mmio_list(0x408004, 0x00000000, 8, 0);
189 mmio_list(0x408008, 0x80000018, 0, 0);
190 mmio_list(0x418808, 0x00000000, 8, 0);
191 mmio_list(0x41880c, 0x80000018, 0, 0);
192 mmio_list(0x418810, 0x80000000, 12, 2);
193 mmio_list(0x419848, 0x10000000, 12, 2);
194
195 mmio_list(0x405830, 0x02180324, 0, 0);
196 mmio_list(0x4064c4, 0x00c9ffff, 0, 0);
197
198 for (gpc = 0, offset = 0; gpc < priv->gpc_nr; gpc++) {
199 u16 magic0 = 0x0218 * priv->tpc_nr[gpc];
200 u16 magic1 = 0x0324 * priv->tpc_nr[gpc];
201 magic[gpc][0] = 0x10000000 | (magic0 << 16) | offset;
202 magic[gpc][1] = 0x00000000 | (magic1 << 16);
203 offset += 0x0324 * priv->tpc_nr[gpc];
204 }
205
206 for (gpc = 0; gpc < priv->gpc_nr; gpc++) {
207 mmio_list(GPC_UNIT(gpc, 0x30c0), magic[gpc][0], 0, 0);
208 mmio_list(GPC_UNIT(gpc, 0x30e4), magic[gpc][1] | offset, 0, 0);
209 offset += 0x07ff * priv->tpc_nr[gpc];
210 }
211 mmio_list(0x17e91c, 0x03060609, 0, 0); /* different from kepler */
212}
213
214void
215nvd7_grctx_generate_main(struct nvc0_graph_priv *priv, struct nvc0_grctx *info)
216{
217 struct nvc0_grctx_oclass *oclass = (void *)nv_engine(priv)->cclass;
218 int i;
219
220 nv_mask(priv, 0x000260, 0x00000001, 0x00000000);
221
222 for (i = 0; oclass->hub[i]; i++)
223 nvc0_graph_mmio(priv, oclass->hub[i]);
224 for (i = 0; oclass->gpc[i]; i++)
225 nvc0_graph_mmio(priv, oclass->gpc[i]);
226
227 nv_wr32(priv, 0x404154, 0x00000000);
228
229 oclass->mods(priv, info);
230 oclass->unkn(priv);
231
232 nvc0_grctx_generate_tpcid(priv);
233 nvc0_grctx_generate_r406028(priv);
234 nvc0_grctx_generate_r4060a8(priv);
235 nve4_grctx_generate_r418bb8(priv);
236 nvc0_grctx_generate_r406800(priv);
237
238 for (i = 0; i < 8; i++)
239 nv_wr32(priv, 0x4064d0 + (i * 0x04), 0x00000000);
240
241 nvc0_graph_icmd(priv, oclass->icmd);
242 nv_wr32(priv, 0x404154, 0x00000400);
243 nvc0_graph_mthd(priv, oclass->mthd);
244 nv_mask(priv, 0x000260, 0x00000001, 0x00000001);
245}
246
247
248static struct nvc0_graph_init *
249nvd7_grctx_init_hub[] = {
250 nvc0_grctx_init_base,
251 nvd7_grctx_init_unk40xx,
252 nvc0_grctx_init_unk44xx,
253 nvc0_grctx_init_unk46xx,
254 nvc0_grctx_init_unk47xx,
255 nvd7_grctx_init_unk58xx,
256 nvc0_grctx_init_unk60xx,
257 nvd7_grctx_init_unk64xx,
258 nvc0_grctx_init_unk78xx,
259 nvc0_grctx_init_unk80xx,
260 nvd9_grctx_init_rop,
261};
262
263struct nvc0_graph_init *
264nvd7_grctx_init_gpc[] = {
265 nvd7_grctx_init_gpc_0,
266 nvc0_grctx_init_gpc_1,
267 nvd7_grctx_init_tpc,
268 nvd7_grctx_init_unk,
269 NULL
270};
271
272struct nouveau_oclass *
273nvd7_grctx_oclass = &(struct nvc0_grctx_oclass) {
274 .base.handle = NV_ENGCTX(GR, 0xd7),
275 .base.ofuncs = &(struct nouveau_ofuncs) {
276 .ctor = nvc0_graph_context_ctor,
277 .dtor = nvc0_graph_context_dtor,
278 .init = _nouveau_graph_context_init,
279 .fini = _nouveau_graph_context_fini,
280 .rd32 = _nouveau_graph_context_rd32,
281 .wr32 = _nouveau_graph_context_wr32,
282 },
283 .main = nvd7_grctx_generate_main,
284 .mods = nvd7_grctx_generate_mods,
285 .unkn = nve4_grctx_generate_unkn,
286 .hub = nvd7_grctx_init_hub,
287 .gpc = nvd7_grctx_init_gpc,
288 .icmd = nvd9_grctx_init_icmd,
289 .mthd = nvd9_grctx_init_mthd,
290}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd9.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd9.c
new file mode 100644
index 000000000000..818a4751df46
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd9.c
@@ -0,0 +1,515 @@
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 <bskeggs@redhat.com>
23 */
24
25#include "nvc0.h"
26
27struct nvc0_graph_init
28nvd9_grctx_init_90c0[] = {
29 { 0x002700, 4, 0x40, 0x00000000 },
30 { 0x002720, 4, 0x40, 0x00000000 },
31 { 0x002704, 4, 0x40, 0x00000000 },
32 { 0x002724, 4, 0x40, 0x00000000 },
33 { 0x002708, 4, 0x40, 0x00000000 },
34 { 0x002728, 4, 0x40, 0x00000000 },
35 { 0x00270c, 8, 0x20, 0x00000000 },
36 { 0x002710, 4, 0x40, 0x00014000 },
37 { 0x002730, 4, 0x40, 0x00014000 },
38 { 0x002714, 4, 0x40, 0x00000040 },
39 { 0x002734, 4, 0x40, 0x00000040 },
40 { 0x00030c, 1, 0x04, 0x00000001 },
41 { 0x001944, 1, 0x04, 0x00000000 },
42 { 0x000758, 1, 0x04, 0x00000100 },
43 { 0x0002c4, 1, 0x04, 0x00000000 },
44 { 0x000790, 5, 0x04, 0x00000000 },
45 { 0x00077c, 1, 0x04, 0x00000000 },
46 { 0x000204, 3, 0x04, 0x00000000 },
47 { 0x000214, 1, 0x04, 0x00000000 },
48 { 0x00024c, 1, 0x04, 0x00000000 },
49 { 0x000d94, 1, 0x04, 0x00000001 },
50 { 0x001608, 2, 0x04, 0x00000000 },
51 { 0x001664, 1, 0x04, 0x00000000 },
52 {}
53};
54
55struct nvc0_graph_init
56nvd9_grctx_init_icmd[] = {
57 { 0x001000, 1, 0x01, 0x00000004 },
58 { 0x0000a9, 1, 0x01, 0x0000ffff },
59 { 0x000038, 1, 0x01, 0x0fac6881 },
60 { 0x00003d, 1, 0x01, 0x00000001 },
61 { 0x0000e8, 8, 0x01, 0x00000400 },
62 { 0x000078, 8, 0x01, 0x00000300 },
63 { 0x000050, 1, 0x01, 0x00000011 },
64 { 0x000058, 8, 0x01, 0x00000008 },
65 { 0x000208, 8, 0x01, 0x00000001 },
66 { 0x000081, 1, 0x01, 0x00000001 },
67 { 0x000085, 1, 0x01, 0x00000004 },
68 { 0x000088, 1, 0x01, 0x00000400 },
69 { 0x000090, 1, 0x01, 0x00000300 },
70 { 0x000098, 1, 0x01, 0x00001001 },
71 { 0x0000e3, 1, 0x01, 0x00000001 },
72 { 0x0000da, 1, 0x01, 0x00000001 },
73 { 0x0000f8, 1, 0x01, 0x00000003 },
74 { 0x0000fa, 1, 0x01, 0x00000001 },
75 { 0x00009f, 4, 0x01, 0x0000ffff },
76 { 0x0000b1, 1, 0x01, 0x00000001 },
77 { 0x0000b2, 40, 0x01, 0x00000000 },
78 { 0x000210, 8, 0x01, 0x00000040 },
79 { 0x000400, 24, 0x01, 0x00000040 },
80 { 0x000218, 8, 0x01, 0x0000c080 },
81 { 0x000440, 24, 0x01, 0x0000c080 },
82 { 0x0000ad, 1, 0x01, 0x0000013e },
83 { 0x0000e1, 1, 0x01, 0x00000010 },
84 { 0x000290, 16, 0x01, 0x00000000 },
85 { 0x0003b0, 16, 0x01, 0x00000000 },
86 { 0x0002a0, 16, 0x01, 0x00000000 },
87 { 0x000420, 16, 0x01, 0x00000000 },
88 { 0x0002b0, 16, 0x01, 0x00000000 },
89 { 0x000430, 16, 0x01, 0x00000000 },
90 { 0x0002c0, 16, 0x01, 0x00000000 },
91 { 0x0004d0, 16, 0x01, 0x00000000 },
92 { 0x000720, 16, 0x01, 0x00000000 },
93 { 0x0008c0, 16, 0x01, 0x00000000 },
94 { 0x000890, 16, 0x01, 0x00000000 },
95 { 0x0008e0, 16, 0x01, 0x00000000 },
96 { 0x0008a0, 16, 0x01, 0x00000000 },
97 { 0x0008f0, 16, 0x01, 0x00000000 },
98 { 0x00094c, 1, 0x01, 0x000000ff },
99 { 0x00094d, 1, 0x01, 0xffffffff },
100 { 0x00094e, 1, 0x01, 0x00000002 },
101 { 0x0002ec, 1, 0x01, 0x00000001 },
102 { 0x000303, 1, 0x01, 0x00000001 },
103 { 0x0002e6, 1, 0x01, 0x00000001 },
104 { 0x000466, 1, 0x01, 0x00000052 },
105 { 0x000301, 1, 0x01, 0x3f800000 },
106 { 0x000304, 1, 0x01, 0x30201000 },
107 { 0x000305, 1, 0x01, 0x70605040 },
108 { 0x000306, 1, 0x01, 0xb8a89888 },
109 { 0x000307, 1, 0x01, 0xf8e8d8c8 },
110 { 0x00030a, 1, 0x01, 0x00ffff00 },
111 { 0x00030b, 1, 0x01, 0x0000001a },
112 { 0x00030c, 1, 0x01, 0x00000001 },
113 { 0x000318, 1, 0x01, 0x00000001 },
114 { 0x000340, 1, 0x01, 0x00000000 },
115 { 0x000375, 1, 0x01, 0x00000001 },
116 { 0x000351, 1, 0x01, 0x00000100 },
117 { 0x00037d, 1, 0x01, 0x00000006 },
118 { 0x0003a0, 1, 0x01, 0x00000002 },
119 { 0x0003aa, 1, 0x01, 0x00000001 },
120 { 0x0003a9, 1, 0x01, 0x00000001 },
121 { 0x000380, 1, 0x01, 0x00000001 },
122 { 0x000360, 1, 0x01, 0x00000040 },
123 { 0x000366, 2, 0x01, 0x00000000 },
124 { 0x000368, 1, 0x01, 0x00001fff },
125 { 0x000370, 2, 0x01, 0x00000000 },
126 { 0x000372, 1, 0x01, 0x003fffff },
127 { 0x00037a, 1, 0x01, 0x00000012 },
128 { 0x0005e0, 5, 0x01, 0x00000022 },
129 { 0x000619, 1, 0x01, 0x00000003 },
130 { 0x000811, 1, 0x01, 0x00000003 },
131 { 0x000812, 1, 0x01, 0x00000004 },
132 { 0x000813, 1, 0x01, 0x00000006 },
133 { 0x000814, 1, 0x01, 0x00000008 },
134 { 0x000815, 1, 0x01, 0x0000000b },
135 { 0x000800, 6, 0x01, 0x00000001 },
136 { 0x000632, 1, 0x01, 0x00000001 },
137 { 0x000633, 1, 0x01, 0x00000002 },
138 { 0x000634, 1, 0x01, 0x00000003 },
139 { 0x000635, 1, 0x01, 0x00000004 },
140 { 0x000654, 1, 0x01, 0x3f800000 },
141 { 0x000657, 1, 0x01, 0x3f800000 },
142 { 0x000655, 2, 0x01, 0x3f800000 },
143 { 0x0006cd, 1, 0x01, 0x3f800000 },
144 { 0x0007f5, 1, 0x01, 0x3f800000 },
145 { 0x0007dc, 1, 0x01, 0x39291909 },
146 { 0x0007dd, 1, 0x01, 0x79695949 },
147 { 0x0007de, 1, 0x01, 0xb9a99989 },
148 { 0x0007df, 1, 0x01, 0xf9e9d9c9 },
149 { 0x0007e8, 1, 0x01, 0x00003210 },
150 { 0x0007e9, 1, 0x01, 0x00007654 },
151 { 0x0007ea, 1, 0x01, 0x00000098 },
152 { 0x0007ec, 1, 0x01, 0x39291909 },
153 { 0x0007ed, 1, 0x01, 0x79695949 },
154 { 0x0007ee, 1, 0x01, 0xb9a99989 },
155 { 0x0007ef, 1, 0x01, 0xf9e9d9c9 },
156 { 0x0007f0, 1, 0x01, 0x00003210 },
157 { 0x0007f1, 1, 0x01, 0x00007654 },
158 { 0x0007f2, 1, 0x01, 0x00000098 },
159 { 0x0005a5, 1, 0x01, 0x00000001 },
160 { 0x000980, 128, 0x01, 0x00000000 },
161 { 0x000468, 1, 0x01, 0x00000004 },
162 { 0x00046c, 1, 0x01, 0x00000001 },
163 { 0x000470, 96, 0x01, 0x00000000 },
164 { 0x000510, 16, 0x01, 0x3f800000 },
165 { 0x000520, 1, 0x01, 0x000002b6 },
166 { 0x000529, 1, 0x01, 0x00000001 },
167 { 0x000530, 16, 0x01, 0xffff0000 },
168 { 0x000585, 1, 0x01, 0x0000003f },
169 { 0x000576, 1, 0x01, 0x00000003 },
170 { 0x00057b, 1, 0x01, 0x00000059 },
171 { 0x000586, 1, 0x01, 0x00000040 },
172 { 0x000582, 2, 0x01, 0x00000080 },
173 { 0x0005c2, 1, 0x01, 0x00000001 },
174 { 0x000638, 1, 0x01, 0x00000001 },
175 { 0x000639, 1, 0x01, 0x00000001 },
176 { 0x00063a, 1, 0x01, 0x00000002 },
177 { 0x00063b, 2, 0x01, 0x00000001 },
178 { 0x00063d, 1, 0x01, 0x00000002 },
179 { 0x00063e, 1, 0x01, 0x00000001 },
180 { 0x0008b8, 8, 0x01, 0x00000001 },
181 { 0x000900, 8, 0x01, 0x00000001 },
182 { 0x000908, 8, 0x01, 0x00000002 },
183 { 0x000910, 16, 0x01, 0x00000001 },
184 { 0x000920, 8, 0x01, 0x00000002 },
185 { 0x000928, 8, 0x01, 0x00000001 },
186 { 0x000648, 9, 0x01, 0x00000001 },
187 { 0x000658, 1, 0x01, 0x0000000f },
188 { 0x0007ff, 1, 0x01, 0x0000000a },
189 { 0x00066a, 1, 0x01, 0x40000000 },
190 { 0x00066b, 1, 0x01, 0x10000000 },
191 { 0x00066c, 2, 0x01, 0xffff0000 },
192 { 0x0007af, 2, 0x01, 0x00000008 },
193 { 0x0007f6, 1, 0x01, 0x00000001 },
194 { 0x0006b2, 1, 0x01, 0x00000055 },
195 { 0x0007ad, 1, 0x01, 0x00000003 },
196 { 0x000937, 1, 0x01, 0x00000001 },
197 { 0x000971, 1, 0x01, 0x00000008 },
198 { 0x000972, 1, 0x01, 0x00000040 },
199 { 0x000973, 1, 0x01, 0x0000012c },
200 { 0x00097c, 1, 0x01, 0x00000040 },
201 { 0x000979, 1, 0x01, 0x00000003 },
202 { 0x000975, 1, 0x01, 0x00000020 },
203 { 0x000976, 1, 0x01, 0x00000001 },
204 { 0x000977, 1, 0x01, 0x00000020 },
205 { 0x000978, 1, 0x01, 0x00000001 },
206 { 0x000957, 1, 0x01, 0x00000003 },
207 { 0x00095e, 1, 0x01, 0x20164010 },
208 { 0x00095f, 1, 0x01, 0x00000020 },
209 { 0x00097d, 1, 0x01, 0x00000020 },
210 { 0x000683, 1, 0x01, 0x00000006 },
211 { 0x000685, 1, 0x01, 0x003fffff },
212 { 0x000687, 1, 0x01, 0x00000c48 },
213 { 0x0006a0, 1, 0x01, 0x00000005 },
214 { 0x000840, 1, 0x01, 0x00300008 },
215 { 0x000841, 1, 0x01, 0x04000080 },
216 { 0x000842, 1, 0x01, 0x00300008 },
217 { 0x000843, 1, 0x01, 0x04000080 },
218 { 0x000818, 8, 0x01, 0x00000000 },
219 { 0x000848, 16, 0x01, 0x00000000 },
220 { 0x000738, 1, 0x01, 0x00000000 },
221 { 0x0006aa, 1, 0x01, 0x00000001 },
222 { 0x0006ab, 1, 0x01, 0x00000002 },
223 { 0x0006ac, 1, 0x01, 0x00000080 },
224 { 0x0006ad, 2, 0x01, 0x00000100 },
225 { 0x0006b1, 1, 0x01, 0x00000011 },
226 { 0x0006bb, 1, 0x01, 0x000000cf },
227 { 0x0006ce, 1, 0x01, 0x2a712488 },
228 { 0x000739, 1, 0x01, 0x4085c000 },
229 { 0x00073a, 1, 0x01, 0x00000080 },
230 { 0x000786, 1, 0x01, 0x80000100 },
231 { 0x00073c, 1, 0x01, 0x00010100 },
232 { 0x00073d, 1, 0x01, 0x02800000 },
233 { 0x000787, 1, 0x01, 0x000000cf },
234 { 0x00078c, 1, 0x01, 0x00000008 },
235 { 0x000792, 1, 0x01, 0x00000001 },
236 { 0x000794, 1, 0x01, 0x00000001 },
237 { 0x000795, 2, 0x01, 0x00000001 },
238 { 0x000797, 1, 0x01, 0x000000cf },
239 { 0x000836, 1, 0x01, 0x00000001 },
240 { 0x00079a, 1, 0x01, 0x00000002 },
241 { 0x000833, 1, 0x01, 0x04444480 },
242 { 0x0007a1, 1, 0x01, 0x00000001 },
243 { 0x0007a3, 1, 0x01, 0x00000001 },
244 { 0x0007a4, 2, 0x01, 0x00000001 },
245 { 0x000831, 1, 0x01, 0x00000004 },
246 { 0x00080c, 1, 0x01, 0x00000002 },
247 { 0x00080d, 2, 0x01, 0x00000100 },
248 { 0x00080f, 1, 0x01, 0x00000001 },
249 { 0x000823, 1, 0x01, 0x00000002 },
250 { 0x000824, 2, 0x01, 0x00000100 },
251 { 0x000826, 1, 0x01, 0x00000001 },
252 { 0x00095d, 1, 0x01, 0x00000001 },
253 { 0x00082b, 1, 0x01, 0x00000004 },
254 { 0x000942, 1, 0x01, 0x00010001 },
255 { 0x000943, 1, 0x01, 0x00000001 },
256 { 0x000944, 1, 0x01, 0x00000022 },
257 { 0x0007c5, 1, 0x01, 0x00010001 },
258 { 0x000834, 1, 0x01, 0x00000001 },
259 { 0x0007c7, 1, 0x01, 0x00000001 },
260 { 0x00c1b0, 8, 0x01, 0x0000000f },
261 { 0x00c1b8, 1, 0x01, 0x0fac6881 },
262 { 0x00c1b9, 1, 0x01, 0x00fac688 },
263 { 0x01e100, 1, 0x01, 0x00000001 },
264 { 0x001000, 1, 0x01, 0x00000002 },
265 { 0x0006aa, 1, 0x01, 0x00000001 },
266 { 0x0006ad, 2, 0x01, 0x00000100 },
267 { 0x0006b1, 1, 0x01, 0x00000011 },
268 { 0x00078c, 1, 0x01, 0x00000008 },
269 { 0x000792, 1, 0x01, 0x00000001 },
270 { 0x000794, 1, 0x01, 0x00000001 },
271 { 0x000795, 2, 0x01, 0x00000001 },
272 { 0x000797, 1, 0x01, 0x000000cf },
273 { 0x00079a, 1, 0x01, 0x00000002 },
274 { 0x000833, 1, 0x01, 0x04444480 },
275 { 0x0007a1, 1, 0x01, 0x00000001 },
276 { 0x0007a3, 1, 0x01, 0x00000001 },
277 { 0x0007a4, 2, 0x01, 0x00000001 },
278 { 0x000831, 1, 0x01, 0x00000004 },
279 { 0x01e100, 1, 0x01, 0x00000001 },
280 { 0x001000, 1, 0x01, 0x00000014 },
281 { 0x000351, 1, 0x01, 0x00000100 },
282 { 0x000957, 1, 0x01, 0x00000003 },
283 { 0x00095d, 1, 0x01, 0x00000001 },
284 { 0x00082b, 1, 0x01, 0x00000004 },
285 { 0x000942, 1, 0x01, 0x00010001 },
286 { 0x000943, 1, 0x01, 0x00000001 },
287 { 0x0007c5, 1, 0x01, 0x00010001 },
288 { 0x000834, 1, 0x01, 0x00000001 },
289 { 0x0007c7, 1, 0x01, 0x00000001 },
290 { 0x01e100, 1, 0x01, 0x00000001 },
291 { 0x001000, 1, 0x01, 0x00000001 },
292 { 0x00080c, 1, 0x01, 0x00000002 },
293 { 0x00080d, 2, 0x01, 0x00000100 },
294 { 0x00080f, 1, 0x01, 0x00000001 },
295 { 0x000823, 1, 0x01, 0x00000002 },
296 { 0x000824, 2, 0x01, 0x00000100 },
297 { 0x000826, 1, 0x01, 0x00000001 },
298 { 0x01e100, 1, 0x01, 0x00000001 },
299 {}
300};
301
302struct nvc0_graph_init
303nvd9_grctx_init_unk40xx[] = {
304 { 0x404004, 11, 0x04, 0x00000000 },
305 { 0x404044, 1, 0x04, 0x00000000 },
306 { 0x404094, 1, 0x04, 0x00000000 },
307 { 0x404098, 12, 0x04, 0x00000000 },
308 { 0x4040c8, 1, 0x04, 0xf0000087 },
309 { 0x4040d0, 6, 0x04, 0x00000000 },
310 { 0x4040e8, 1, 0x04, 0x00001000 },
311 { 0x4040f8, 1, 0x04, 0x00000000 },
312 { 0x404130, 1, 0x04, 0x00000000 },
313 { 0x404134, 1, 0x04, 0x00000000 },
314 { 0x404138, 1, 0x04, 0x20000040 },
315 { 0x404150, 1, 0x04, 0x0000002e },
316 { 0x404154, 1, 0x04, 0x00000400 },
317 { 0x404158, 1, 0x04, 0x00000200 },
318 { 0x404164, 1, 0x04, 0x00000055 },
319 { 0x404168, 1, 0x04, 0x00000000 },
320 { 0x404178, 2, 0x04, 0x00000000 },
321 { 0x404200, 8, 0x04, 0x00000000 },
322 {}
323};
324
325static struct nvc0_graph_init
326nvd9_grctx_init_unk58xx[] = {
327 { 0x405800, 1, 0x04, 0x0f8000bf },
328 { 0x405830, 1, 0x04, 0x02180218 },
329 { 0x405834, 1, 0x04, 0x08000000 },
330 { 0x405838, 1, 0x04, 0x00000000 },
331 { 0x405854, 1, 0x04, 0x00000000 },
332 { 0x405870, 4, 0x04, 0x00000001 },
333 { 0x405a00, 2, 0x04, 0x00000000 },
334 { 0x405a18, 1, 0x04, 0x00000000 },
335 {}
336};
337
338static struct nvc0_graph_init
339nvd9_grctx_init_unk64xx[] = {
340 { 0x4064a8, 1, 0x04, 0x00000000 },
341 { 0x4064ac, 1, 0x04, 0x00003fff },
342 { 0x4064b4, 3, 0x04, 0x00000000 },
343 { 0x4064c0, 1, 0x04, 0x80140078 },
344 { 0x4064c4, 1, 0x04, 0x0086ffff },
345 {}
346};
347
348struct nvc0_graph_init
349nvd9_grctx_init_rop[] = {
350 { 0x408800, 1, 0x04, 0x02802a3c },
351 { 0x408804, 1, 0x04, 0x00000040 },
352 { 0x408808, 1, 0x04, 0x1043e005 },
353 { 0x408900, 1, 0x04, 0x3080b801 },
354 { 0x408904, 1, 0x04, 0x1043e005 },
355 { 0x408908, 1, 0x04, 0x00c8102f },
356 { 0x408980, 1, 0x04, 0x0000011d },
357 {}
358};
359
360static struct nvc0_graph_init
361nvd9_grctx_init_gpc_0[] = {
362 { 0x418380, 1, 0x04, 0x00000016 },
363 { 0x418400, 1, 0x04, 0x38004e00 },
364 { 0x418404, 1, 0x04, 0x71e0ffff },
365 { 0x41840c, 1, 0x04, 0x00001008 },
366 { 0x418410, 1, 0x04, 0x0fff0fff },
367 { 0x418414, 1, 0x04, 0x02200fff },
368 { 0x418450, 6, 0x04, 0x00000000 },
369 { 0x418468, 1, 0x04, 0x00000001 },
370 { 0x41846c, 2, 0x04, 0x00000000 },
371 { 0x418600, 1, 0x04, 0x0000001f },
372 { 0x418684, 1, 0x04, 0x0000000f },
373 { 0x418700, 1, 0x04, 0x00000002 },
374 { 0x418704, 1, 0x04, 0x00000080 },
375 { 0x418708, 3, 0x04, 0x00000000 },
376 { 0x418800, 1, 0x04, 0x7006860a },
377 { 0x418808, 3, 0x04, 0x00000000 },
378 { 0x418828, 1, 0x04, 0x00008442 },
379 { 0x418830, 1, 0x04, 0x10000001 },
380 { 0x4188d8, 1, 0x04, 0x00000008 },
381 { 0x4188e0, 1, 0x04, 0x01000000 },
382 { 0x4188e8, 5, 0x04, 0x00000000 },
383 { 0x4188fc, 1, 0x04, 0x20100008 },
384 { 0x41891c, 1, 0x04, 0x00ff00ff },
385 { 0x418924, 1, 0x04, 0x00000000 },
386 { 0x418928, 1, 0x04, 0x00ffff00 },
387 { 0x41892c, 1, 0x04, 0x0000ff00 },
388 { 0x418b00, 1, 0x04, 0x00000006 },
389 { 0x418b08, 1, 0x04, 0x0a418820 },
390 { 0x418b0c, 1, 0x04, 0x062080e6 },
391 { 0x418b10, 1, 0x04, 0x020398a4 },
392 { 0x418b14, 1, 0x04, 0x0e629062 },
393 { 0x418b18, 1, 0x04, 0x0a418820 },
394 { 0x418b1c, 1, 0x04, 0x000000e6 },
395 { 0x418bb8, 1, 0x04, 0x00000103 },
396 { 0x418c08, 1, 0x04, 0x00000001 },
397 { 0x418c10, 8, 0x04, 0x00000000 },
398 { 0x418c6c, 1, 0x04, 0x00000001 },
399 { 0x418c80, 1, 0x04, 0x20200004 },
400 { 0x418c8c, 1, 0x04, 0x00000001 },
401 { 0x419000, 1, 0x04, 0x00000780 },
402 { 0x419004, 2, 0x04, 0x00000000 },
403 { 0x419014, 1, 0x04, 0x00000004 },
404 {}
405};
406
407static struct nvc0_graph_init
408nvd9_grctx_init_tpc[] = {
409 { 0x419818, 1, 0x04, 0x00000000 },
410 { 0x41983c, 1, 0x04, 0x00038bc7 },
411 { 0x419848, 1, 0x04, 0x00000000 },
412 { 0x419864, 1, 0x04, 0x00000129 },
413 { 0x419888, 1, 0x04, 0x00000000 },
414 { 0x419a00, 1, 0x04, 0x000001f0 },
415 { 0x419a04, 1, 0x04, 0x00000001 },
416 { 0x419a08, 1, 0x04, 0x00000023 },
417 { 0x419a0c, 1, 0x04, 0x00020000 },
418 { 0x419a10, 1, 0x04, 0x00000000 },
419 { 0x419a14, 1, 0x04, 0x00000200 },
420 { 0x419a1c, 1, 0x04, 0x00000000 },
421 { 0x419a20, 1, 0x04, 0x00000800 },
422 { 0x419ac4, 1, 0x04, 0x0017f440 },
423 { 0x419b00, 1, 0x04, 0x0a418820 },
424 { 0x419b04, 1, 0x04, 0x062080e6 },
425 { 0x419b08, 1, 0x04, 0x020398a4 },
426 { 0x419b0c, 1, 0x04, 0x0e629062 },
427 { 0x419b10, 1, 0x04, 0x0a418820 },
428 { 0x419b14, 1, 0x04, 0x000000e6 },
429 { 0x419bd0, 1, 0x04, 0x00900103 },
430 { 0x419be0, 1, 0x04, 0x00400001 },
431 { 0x419be4, 1, 0x04, 0x00000000 },
432 { 0x419c00, 1, 0x04, 0x0000000a },
433 { 0x419c04, 1, 0x04, 0x00000006 },
434 { 0x419c08, 1, 0x04, 0x00000002 },
435 { 0x419c20, 1, 0x04, 0x00000000 },
436 { 0x419c24, 1, 0x04, 0x00084210 },
437 { 0x419c28, 1, 0x04, 0x3cf3cf3c },
438 { 0x419cb0, 1, 0x04, 0x00020048 },
439 { 0x419ce8, 1, 0x04, 0x00000000 },
440 { 0x419cf4, 1, 0x04, 0x00000183 },
441 { 0x419d20, 1, 0x04, 0x12180000 },
442 { 0x419d24, 1, 0x04, 0x00001fff },
443 { 0x419d44, 1, 0x04, 0x02180218 },
444 { 0x419e04, 3, 0x04, 0x00000000 },
445 { 0x419e10, 1, 0x04, 0x00000002 },
446 { 0x419e44, 1, 0x04, 0x001beff2 },
447 { 0x419e48, 1, 0x04, 0x00000000 },
448 { 0x419e4c, 1, 0x04, 0x0000000f },
449 { 0x419e50, 17, 0x04, 0x00000000 },
450 { 0x419e98, 1, 0x04, 0x00000000 },
451 { 0x419ee0, 1, 0x04, 0x00010110 },
452 { 0x419f30, 11, 0x04, 0x00000000 },
453 {}
454};
455
456static struct nvc0_graph_init *
457nvd9_grctx_init_hub[] = {
458 nvc0_grctx_init_base,
459 nvd9_grctx_init_unk40xx,
460 nvc0_grctx_init_unk44xx,
461 nvc0_grctx_init_unk46xx,
462 nvc0_grctx_init_unk47xx,
463 nvd9_grctx_init_unk58xx,
464 nvc0_grctx_init_unk60xx,
465 nvd9_grctx_init_unk64xx,
466 nvc0_grctx_init_unk78xx,
467 nvc0_grctx_init_unk80xx,
468 nvd9_grctx_init_rop,
469};
470
471struct nvc0_graph_init *
472nvd9_grctx_init_gpc[] = {
473 nvd9_grctx_init_gpc_0,
474 nvc0_grctx_init_gpc_1,
475 nvd9_grctx_init_tpc,
476 NULL
477};
478
479struct nvc0_graph_init
480nvd9_grctx_init_mthd_magic[] = {
481 { 0x3410, 1, 0x04, 0x80002006 },
482 {}
483};
484
485struct nvc0_graph_mthd
486nvd9_grctx_init_mthd[] = {
487 { 0x9097, nvc1_grctx_init_9097, },
488 { 0x9197, nvc8_grctx_init_9197, },
489 { 0x9297, nvc8_grctx_init_9297, },
490 { 0x902d, nvc0_grctx_init_902d, },
491 { 0x9039, nvc0_grctx_init_9039, },
492 { 0x90c0, nvd9_grctx_init_90c0, },
493 { 0x902d, nvd9_grctx_init_mthd_magic, },
494 {}
495};
496
497struct nouveau_oclass *
498nvd9_grctx_oclass = &(struct nvc0_grctx_oclass) {
499 .base.handle = NV_ENGCTX(GR, 0xd9),
500 .base.ofuncs = &(struct nouveau_ofuncs) {
501 .ctor = nvc0_graph_context_ctor,
502 .dtor = nvc0_graph_context_dtor,
503 .init = _nouveau_graph_context_init,
504 .fini = _nouveau_graph_context_fini,
505 .rd32 = _nouveau_graph_context_rd32,
506 .wr32 = _nouveau_graph_context_wr32,
507 },
508 .main = nvc0_grctx_generate_main,
509 .mods = nvc1_grctx_generate_mods,
510 .unkn = nvc1_grctx_generate_unkn,
511 .hub = nvd9_grctx_init_hub,
512 .gpc = nvd9_grctx_init_gpc,
513 .icmd = nvd9_grctx_init_icmd,
514 .mthd = nvd9_grctx_init_mthd,
515}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnve0.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnve0.c
deleted file mode 100644
index ae27dae3fe38..000000000000
--- a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnve0.c
+++ /dev/null
@@ -1,2793 +0,0 @@
1/*
2 * Copyright 2010 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 "nvc0.h"
26
27static void
28nve0_grctx_generate_icmd(struct nvc0_graph_priv *priv)
29{
30 nv_wr32(priv, 0x400208, 0x80000000);
31 nv_icmd(priv, 0x001000, 0x00000004);
32 nv_icmd(priv, 0x000039, 0x00000000);
33 nv_icmd(priv, 0x00003a, 0x00000000);
34 nv_icmd(priv, 0x00003b, 0x00000000);
35 nv_icmd(priv, 0x0000a9, 0x0000ffff);
36 nv_icmd(priv, 0x000038, 0x0fac6881);
37 nv_icmd(priv, 0x00003d, 0x00000001);
38 nv_icmd(priv, 0x0000e8, 0x00000400);
39 nv_icmd(priv, 0x0000e9, 0x00000400);
40 nv_icmd(priv, 0x0000ea, 0x00000400);
41 nv_icmd(priv, 0x0000eb, 0x00000400);
42 nv_icmd(priv, 0x0000ec, 0x00000400);
43 nv_icmd(priv, 0x0000ed, 0x00000400);
44 nv_icmd(priv, 0x0000ee, 0x00000400);
45 nv_icmd(priv, 0x0000ef, 0x00000400);
46 nv_icmd(priv, 0x000078, 0x00000300);
47 nv_icmd(priv, 0x000079, 0x00000300);
48 nv_icmd(priv, 0x00007a, 0x00000300);
49 nv_icmd(priv, 0x00007b, 0x00000300);
50 nv_icmd(priv, 0x00007c, 0x00000300);
51 nv_icmd(priv, 0x00007d, 0x00000300);
52 nv_icmd(priv, 0x00007e, 0x00000300);
53 nv_icmd(priv, 0x00007f, 0x00000300);
54 nv_icmd(priv, 0x000050, 0x00000011);
55 nv_icmd(priv, 0x000058, 0x00000008);
56 nv_icmd(priv, 0x000059, 0x00000008);
57 nv_icmd(priv, 0x00005a, 0x00000008);
58 nv_icmd(priv, 0x00005b, 0x00000008);
59 nv_icmd(priv, 0x00005c, 0x00000008);
60 nv_icmd(priv, 0x00005d, 0x00000008);
61 nv_icmd(priv, 0x00005e, 0x00000008);
62 nv_icmd(priv, 0x00005f, 0x00000008);
63 nv_icmd(priv, 0x000208, 0x00000001);
64 nv_icmd(priv, 0x000209, 0x00000001);
65 nv_icmd(priv, 0x00020a, 0x00000001);
66 nv_icmd(priv, 0x00020b, 0x00000001);
67 nv_icmd(priv, 0x00020c, 0x00000001);
68 nv_icmd(priv, 0x00020d, 0x00000001);
69 nv_icmd(priv, 0x00020e, 0x00000001);
70 nv_icmd(priv, 0x00020f, 0x00000001);
71 nv_icmd(priv, 0x000081, 0x00000001);
72 nv_icmd(priv, 0x000085, 0x00000004);
73 nv_icmd(priv, 0x000088, 0x00000400);
74 nv_icmd(priv, 0x000090, 0x00000300);
75 nv_icmd(priv, 0x000098, 0x00001001);
76 nv_icmd(priv, 0x0000e3, 0x00000001);
77 nv_icmd(priv, 0x0000da, 0x00000001);
78 nv_icmd(priv, 0x0000f8, 0x00000003);
79 nv_icmd(priv, 0x0000fa, 0x00000001);
80 nv_icmd(priv, 0x00009f, 0x0000ffff);
81 nv_icmd(priv, 0x0000a0, 0x0000ffff);
82 nv_icmd(priv, 0x0000a1, 0x0000ffff);
83 nv_icmd(priv, 0x0000a2, 0x0000ffff);
84 nv_icmd(priv, 0x0000b1, 0x00000001);
85 nv_icmd(priv, 0x0000ad, 0x0000013e);
86 nv_icmd(priv, 0x0000e1, 0x00000010);
87 nv_icmd(priv, 0x000290, 0x00000000);
88 nv_icmd(priv, 0x000291, 0x00000000);
89 nv_icmd(priv, 0x000292, 0x00000000);
90 nv_icmd(priv, 0x000293, 0x00000000);
91 nv_icmd(priv, 0x000294, 0x00000000);
92 nv_icmd(priv, 0x000295, 0x00000000);
93 nv_icmd(priv, 0x000296, 0x00000000);
94 nv_icmd(priv, 0x000297, 0x00000000);
95 nv_icmd(priv, 0x000298, 0x00000000);
96 nv_icmd(priv, 0x000299, 0x00000000);
97 nv_icmd(priv, 0x00029a, 0x00000000);
98 nv_icmd(priv, 0x00029b, 0x00000000);
99 nv_icmd(priv, 0x00029c, 0x00000000);
100 nv_icmd(priv, 0x00029d, 0x00000000);
101 nv_icmd(priv, 0x00029e, 0x00000000);
102 nv_icmd(priv, 0x00029f, 0x00000000);
103 nv_icmd(priv, 0x0003b0, 0x00000000);
104 nv_icmd(priv, 0x0003b1, 0x00000000);
105 nv_icmd(priv, 0x0003b2, 0x00000000);
106 nv_icmd(priv, 0x0003b3, 0x00000000);
107 nv_icmd(priv, 0x0003b4, 0x00000000);
108 nv_icmd(priv, 0x0003b5, 0x00000000);
109 nv_icmd(priv, 0x0003b6, 0x00000000);
110 nv_icmd(priv, 0x0003b7, 0x00000000);
111 nv_icmd(priv, 0x0003b8, 0x00000000);
112 nv_icmd(priv, 0x0003b9, 0x00000000);
113 nv_icmd(priv, 0x0003ba, 0x00000000);
114 nv_icmd(priv, 0x0003bb, 0x00000000);
115 nv_icmd(priv, 0x0003bc, 0x00000000);
116 nv_icmd(priv, 0x0003bd, 0x00000000);
117 nv_icmd(priv, 0x0003be, 0x00000000);
118 nv_icmd(priv, 0x0003bf, 0x00000000);
119 nv_icmd(priv, 0x0002a0, 0x00000000);
120 nv_icmd(priv, 0x0002a1, 0x00000000);
121 nv_icmd(priv, 0x0002a2, 0x00000000);
122 nv_icmd(priv, 0x0002a3, 0x00000000);
123 nv_icmd(priv, 0x0002a4, 0x00000000);
124 nv_icmd(priv, 0x0002a5, 0x00000000);
125 nv_icmd(priv, 0x0002a6, 0x00000000);
126 nv_icmd(priv, 0x0002a7, 0x00000000);
127 nv_icmd(priv, 0x0002a8, 0x00000000);
128 nv_icmd(priv, 0x0002a9, 0x00000000);
129 nv_icmd(priv, 0x0002aa, 0x00000000);
130 nv_icmd(priv, 0x0002ab, 0x00000000);
131 nv_icmd(priv, 0x0002ac, 0x00000000);
132 nv_icmd(priv, 0x0002ad, 0x00000000);
133 nv_icmd(priv, 0x0002ae, 0x00000000);
134 nv_icmd(priv, 0x0002af, 0x00000000);
135 nv_icmd(priv, 0x000420, 0x00000000);
136 nv_icmd(priv, 0x000421, 0x00000000);
137 nv_icmd(priv, 0x000422, 0x00000000);
138 nv_icmd(priv, 0x000423, 0x00000000);
139 nv_icmd(priv, 0x000424, 0x00000000);
140 nv_icmd(priv, 0x000425, 0x00000000);
141 nv_icmd(priv, 0x000426, 0x00000000);
142 nv_icmd(priv, 0x000427, 0x00000000);
143 nv_icmd(priv, 0x000428, 0x00000000);
144 nv_icmd(priv, 0x000429, 0x00000000);
145 nv_icmd(priv, 0x00042a, 0x00000000);
146 nv_icmd(priv, 0x00042b, 0x00000000);
147 nv_icmd(priv, 0x00042c, 0x00000000);
148 nv_icmd(priv, 0x00042d, 0x00000000);
149 nv_icmd(priv, 0x00042e, 0x00000000);
150 nv_icmd(priv, 0x00042f, 0x00000000);
151 nv_icmd(priv, 0x0002b0, 0x00000000);
152 nv_icmd(priv, 0x0002b1, 0x00000000);
153 nv_icmd(priv, 0x0002b2, 0x00000000);
154 nv_icmd(priv, 0x0002b3, 0x00000000);
155 nv_icmd(priv, 0x0002b4, 0x00000000);
156 nv_icmd(priv, 0x0002b5, 0x00000000);
157 nv_icmd(priv, 0x0002b6, 0x00000000);
158 nv_icmd(priv, 0x0002b7, 0x00000000);
159 nv_icmd(priv, 0x0002b8, 0x00000000);
160 nv_icmd(priv, 0x0002b9, 0x00000000);
161 nv_icmd(priv, 0x0002ba, 0x00000000);
162 nv_icmd(priv, 0x0002bb, 0x00000000);
163 nv_icmd(priv, 0x0002bc, 0x00000000);
164 nv_icmd(priv, 0x0002bd, 0x00000000);
165 nv_icmd(priv, 0x0002be, 0x00000000);
166 nv_icmd(priv, 0x0002bf, 0x00000000);
167 nv_icmd(priv, 0x000430, 0x00000000);
168 nv_icmd(priv, 0x000431, 0x00000000);
169 nv_icmd(priv, 0x000432, 0x00000000);
170 nv_icmd(priv, 0x000433, 0x00000000);
171 nv_icmd(priv, 0x000434, 0x00000000);
172 nv_icmd(priv, 0x000435, 0x00000000);
173 nv_icmd(priv, 0x000436, 0x00000000);
174 nv_icmd(priv, 0x000437, 0x00000000);
175 nv_icmd(priv, 0x000438, 0x00000000);
176 nv_icmd(priv, 0x000439, 0x00000000);
177 nv_icmd(priv, 0x00043a, 0x00000000);
178 nv_icmd(priv, 0x00043b, 0x00000000);
179 nv_icmd(priv, 0x00043c, 0x00000000);
180 nv_icmd(priv, 0x00043d, 0x00000000);
181 nv_icmd(priv, 0x00043e, 0x00000000);
182 nv_icmd(priv, 0x00043f, 0x00000000);
183 nv_icmd(priv, 0x0002c0, 0x00000000);
184 nv_icmd(priv, 0x0002c1, 0x00000000);
185 nv_icmd(priv, 0x0002c2, 0x00000000);
186 nv_icmd(priv, 0x0002c3, 0x00000000);
187 nv_icmd(priv, 0x0002c4, 0x00000000);
188 nv_icmd(priv, 0x0002c5, 0x00000000);
189 nv_icmd(priv, 0x0002c6, 0x00000000);
190 nv_icmd(priv, 0x0002c7, 0x00000000);
191 nv_icmd(priv, 0x0002c8, 0x00000000);
192 nv_icmd(priv, 0x0002c9, 0x00000000);
193 nv_icmd(priv, 0x0002ca, 0x00000000);
194 nv_icmd(priv, 0x0002cb, 0x00000000);
195 nv_icmd(priv, 0x0002cc, 0x00000000);
196 nv_icmd(priv, 0x0002cd, 0x00000000);
197 nv_icmd(priv, 0x0002ce, 0x00000000);
198 nv_icmd(priv, 0x0002cf, 0x00000000);
199 nv_icmd(priv, 0x0004d0, 0x00000000);
200 nv_icmd(priv, 0x0004d1, 0x00000000);
201 nv_icmd(priv, 0x0004d2, 0x00000000);
202 nv_icmd(priv, 0x0004d3, 0x00000000);
203 nv_icmd(priv, 0x0004d4, 0x00000000);
204 nv_icmd(priv, 0x0004d5, 0x00000000);
205 nv_icmd(priv, 0x0004d6, 0x00000000);
206 nv_icmd(priv, 0x0004d7, 0x00000000);
207 nv_icmd(priv, 0x0004d8, 0x00000000);
208 nv_icmd(priv, 0x0004d9, 0x00000000);
209 nv_icmd(priv, 0x0004da, 0x00000000);
210 nv_icmd(priv, 0x0004db, 0x00000000);
211 nv_icmd(priv, 0x0004dc, 0x00000000);
212 nv_icmd(priv, 0x0004dd, 0x00000000);
213 nv_icmd(priv, 0x0004de, 0x00000000);
214 nv_icmd(priv, 0x0004df, 0x00000000);
215 nv_icmd(priv, 0x000720, 0x00000000);
216 nv_icmd(priv, 0x000721, 0x00000000);
217 nv_icmd(priv, 0x000722, 0x00000000);
218 nv_icmd(priv, 0x000723, 0x00000000);
219 nv_icmd(priv, 0x000724, 0x00000000);
220 nv_icmd(priv, 0x000725, 0x00000000);
221 nv_icmd(priv, 0x000726, 0x00000000);
222 nv_icmd(priv, 0x000727, 0x00000000);
223 nv_icmd(priv, 0x000728, 0x00000000);
224 nv_icmd(priv, 0x000729, 0x00000000);
225 nv_icmd(priv, 0x00072a, 0x00000000);
226 nv_icmd(priv, 0x00072b, 0x00000000);
227 nv_icmd(priv, 0x00072c, 0x00000000);
228 nv_icmd(priv, 0x00072d, 0x00000000);
229 nv_icmd(priv, 0x00072e, 0x00000000);
230 nv_icmd(priv, 0x00072f, 0x00000000);
231 nv_icmd(priv, 0x0008c0, 0x00000000);
232 nv_icmd(priv, 0x0008c1, 0x00000000);
233 nv_icmd(priv, 0x0008c2, 0x00000000);
234 nv_icmd(priv, 0x0008c3, 0x00000000);
235 nv_icmd(priv, 0x0008c4, 0x00000000);
236 nv_icmd(priv, 0x0008c5, 0x00000000);
237 nv_icmd(priv, 0x0008c6, 0x00000000);
238 nv_icmd(priv, 0x0008c7, 0x00000000);
239 nv_icmd(priv, 0x0008c8, 0x00000000);
240 nv_icmd(priv, 0x0008c9, 0x00000000);
241 nv_icmd(priv, 0x0008ca, 0x00000000);
242 nv_icmd(priv, 0x0008cb, 0x00000000);
243 nv_icmd(priv, 0x0008cc, 0x00000000);
244 nv_icmd(priv, 0x0008cd, 0x00000000);
245 nv_icmd(priv, 0x0008ce, 0x00000000);
246 nv_icmd(priv, 0x0008cf, 0x00000000);
247 nv_icmd(priv, 0x000890, 0x00000000);
248 nv_icmd(priv, 0x000891, 0x00000000);
249 nv_icmd(priv, 0x000892, 0x00000000);
250 nv_icmd(priv, 0x000893, 0x00000000);
251 nv_icmd(priv, 0x000894, 0x00000000);
252 nv_icmd(priv, 0x000895, 0x00000000);
253 nv_icmd(priv, 0x000896, 0x00000000);
254 nv_icmd(priv, 0x000897, 0x00000000);
255 nv_icmd(priv, 0x000898, 0x00000000);
256 nv_icmd(priv, 0x000899, 0x00000000);
257 nv_icmd(priv, 0x00089a, 0x00000000);
258 nv_icmd(priv, 0x00089b, 0x00000000);
259 nv_icmd(priv, 0x00089c, 0x00000000);
260 nv_icmd(priv, 0x00089d, 0x00000000);
261 nv_icmd(priv, 0x00089e, 0x00000000);
262 nv_icmd(priv, 0x00089f, 0x00000000);
263 nv_icmd(priv, 0x0008e0, 0x00000000);
264 nv_icmd(priv, 0x0008e1, 0x00000000);
265 nv_icmd(priv, 0x0008e2, 0x00000000);
266 nv_icmd(priv, 0x0008e3, 0x00000000);
267 nv_icmd(priv, 0x0008e4, 0x00000000);
268 nv_icmd(priv, 0x0008e5, 0x00000000);
269 nv_icmd(priv, 0x0008e6, 0x00000000);
270 nv_icmd(priv, 0x0008e7, 0x00000000);
271 nv_icmd(priv, 0x0008e8, 0x00000000);
272 nv_icmd(priv, 0x0008e9, 0x00000000);
273 nv_icmd(priv, 0x0008ea, 0x00000000);
274 nv_icmd(priv, 0x0008eb, 0x00000000);
275 nv_icmd(priv, 0x0008ec, 0x00000000);
276 nv_icmd(priv, 0x0008ed, 0x00000000);
277 nv_icmd(priv, 0x0008ee, 0x00000000);
278 nv_icmd(priv, 0x0008ef, 0x00000000);
279 nv_icmd(priv, 0x0008a0, 0x00000000);
280 nv_icmd(priv, 0x0008a1, 0x00000000);
281 nv_icmd(priv, 0x0008a2, 0x00000000);
282 nv_icmd(priv, 0x0008a3, 0x00000000);
283 nv_icmd(priv, 0x0008a4, 0x00000000);
284 nv_icmd(priv, 0x0008a5, 0x00000000);
285 nv_icmd(priv, 0x0008a6, 0x00000000);
286 nv_icmd(priv, 0x0008a7, 0x00000000);
287 nv_icmd(priv, 0x0008a8, 0x00000000);
288 nv_icmd(priv, 0x0008a9, 0x00000000);
289 nv_icmd(priv, 0x0008aa, 0x00000000);
290 nv_icmd(priv, 0x0008ab, 0x00000000);
291 nv_icmd(priv, 0x0008ac, 0x00000000);
292 nv_icmd(priv, 0x0008ad, 0x00000000);
293 nv_icmd(priv, 0x0008ae, 0x00000000);
294 nv_icmd(priv, 0x0008af, 0x00000000);
295 nv_icmd(priv, 0x0008f0, 0x00000000);
296 nv_icmd(priv, 0x0008f1, 0x00000000);
297 nv_icmd(priv, 0x0008f2, 0x00000000);
298 nv_icmd(priv, 0x0008f3, 0x00000000);
299 nv_icmd(priv, 0x0008f4, 0x00000000);
300 nv_icmd(priv, 0x0008f5, 0x00000000);
301 nv_icmd(priv, 0x0008f6, 0x00000000);
302 nv_icmd(priv, 0x0008f7, 0x00000000);
303 nv_icmd(priv, 0x0008f8, 0x00000000);
304 nv_icmd(priv, 0x0008f9, 0x00000000);
305 nv_icmd(priv, 0x0008fa, 0x00000000);
306 nv_icmd(priv, 0x0008fb, 0x00000000);
307 nv_icmd(priv, 0x0008fc, 0x00000000);
308 nv_icmd(priv, 0x0008fd, 0x00000000);
309 nv_icmd(priv, 0x0008fe, 0x00000000);
310 nv_icmd(priv, 0x0008ff, 0x00000000);
311 nv_icmd(priv, 0x00094c, 0x000000ff);
312 nv_icmd(priv, 0x00094d, 0xffffffff);
313 nv_icmd(priv, 0x00094e, 0x00000002);
314 nv_icmd(priv, 0x0002ec, 0x00000001);
315 nv_icmd(priv, 0x000303, 0x00000001);
316 nv_icmd(priv, 0x0002e6, 0x00000001);
317 nv_icmd(priv, 0x000466, 0x00000052);
318 nv_icmd(priv, 0x000301, 0x3f800000);
319 nv_icmd(priv, 0x000304, 0x30201000);
320 nv_icmd(priv, 0x000305, 0x70605040);
321 nv_icmd(priv, 0x000306, 0xb8a89888);
322 nv_icmd(priv, 0x000307, 0xf8e8d8c8);
323 nv_icmd(priv, 0x00030a, 0x00ffff00);
324 nv_icmd(priv, 0x00030b, 0x0000001a);
325 nv_icmd(priv, 0x00030c, 0x00000001);
326 nv_icmd(priv, 0x000318, 0x00000001);
327 nv_icmd(priv, 0x000340, 0x00000000);
328 nv_icmd(priv, 0x000375, 0x00000001);
329 nv_icmd(priv, 0x00037d, 0x00000006);
330 nv_icmd(priv, 0x0003a0, 0x00000002);
331 nv_icmd(priv, 0x0003aa, 0x00000001);
332 nv_icmd(priv, 0x0003a9, 0x00000001);
333 nv_icmd(priv, 0x000380, 0x00000001);
334 nv_icmd(priv, 0x000383, 0x00000011);
335 nv_icmd(priv, 0x000360, 0x00000040);
336 nv_icmd(priv, 0x000366, 0x00000000);
337 nv_icmd(priv, 0x000367, 0x00000000);
338 nv_icmd(priv, 0x000368, 0x00000fff);
339 nv_icmd(priv, 0x000370, 0x00000000);
340 nv_icmd(priv, 0x000371, 0x00000000);
341 nv_icmd(priv, 0x000372, 0x000fffff);
342 nv_icmd(priv, 0x00037a, 0x00000012);
343 nv_icmd(priv, 0x000619, 0x00000003);
344 nv_icmd(priv, 0x000811, 0x00000003);
345 nv_icmd(priv, 0x000812, 0x00000004);
346 nv_icmd(priv, 0x000813, 0x00000006);
347 nv_icmd(priv, 0x000814, 0x00000008);
348 nv_icmd(priv, 0x000815, 0x0000000b);
349 nv_icmd(priv, 0x000800, 0x00000001);
350 nv_icmd(priv, 0x000801, 0x00000001);
351 nv_icmd(priv, 0x000802, 0x00000001);
352 nv_icmd(priv, 0x000803, 0x00000001);
353 nv_icmd(priv, 0x000804, 0x00000001);
354 nv_icmd(priv, 0x000805, 0x00000001);
355 nv_icmd(priv, 0x000632, 0x00000001);
356 nv_icmd(priv, 0x000633, 0x00000002);
357 nv_icmd(priv, 0x000634, 0x00000003);
358 nv_icmd(priv, 0x000635, 0x00000004);
359 nv_icmd(priv, 0x000654, 0x3f800000);
360 nv_icmd(priv, 0x000657, 0x3f800000);
361 nv_icmd(priv, 0x000655, 0x3f800000);
362 nv_icmd(priv, 0x000656, 0x3f800000);
363 nv_icmd(priv, 0x0006cd, 0x3f800000);
364 nv_icmd(priv, 0x0007f5, 0x3f800000);
365 nv_icmd(priv, 0x0007dc, 0x39291909);
366 nv_icmd(priv, 0x0007dd, 0x79695949);
367 nv_icmd(priv, 0x0007de, 0xb9a99989);
368 nv_icmd(priv, 0x0007df, 0xf9e9d9c9);
369 nv_icmd(priv, 0x0007e8, 0x00003210);
370 nv_icmd(priv, 0x0007e9, 0x00007654);
371 nv_icmd(priv, 0x0007ea, 0x00000098);
372 nv_icmd(priv, 0x0007ec, 0x39291909);
373 nv_icmd(priv, 0x0007ed, 0x79695949);
374 nv_icmd(priv, 0x0007ee, 0xb9a99989);
375 nv_icmd(priv, 0x0007ef, 0xf9e9d9c9);
376 nv_icmd(priv, 0x0007f0, 0x00003210);
377 nv_icmd(priv, 0x0007f1, 0x00007654);
378 nv_icmd(priv, 0x0007f2, 0x00000098);
379 nv_icmd(priv, 0x0005a5, 0x00000001);
380 nv_icmd(priv, 0x000980, 0x00000000);
381 nv_icmd(priv, 0x000981, 0x00000000);
382 nv_icmd(priv, 0x000982, 0x00000000);
383 nv_icmd(priv, 0x000983, 0x00000000);
384 nv_icmd(priv, 0x000984, 0x00000000);
385 nv_icmd(priv, 0x000985, 0x00000000);
386 nv_icmd(priv, 0x000986, 0x00000000);
387 nv_icmd(priv, 0x000987, 0x00000000);
388 nv_icmd(priv, 0x000988, 0x00000000);
389 nv_icmd(priv, 0x000989, 0x00000000);
390 nv_icmd(priv, 0x00098a, 0x00000000);
391 nv_icmd(priv, 0x00098b, 0x00000000);
392 nv_icmd(priv, 0x00098c, 0x00000000);
393 nv_icmd(priv, 0x00098d, 0x00000000);
394 nv_icmd(priv, 0x00098e, 0x00000000);
395 nv_icmd(priv, 0x00098f, 0x00000000);
396 nv_icmd(priv, 0x000990, 0x00000000);
397 nv_icmd(priv, 0x000991, 0x00000000);
398 nv_icmd(priv, 0x000992, 0x00000000);
399 nv_icmd(priv, 0x000993, 0x00000000);
400 nv_icmd(priv, 0x000994, 0x00000000);
401 nv_icmd(priv, 0x000995, 0x00000000);
402 nv_icmd(priv, 0x000996, 0x00000000);
403 nv_icmd(priv, 0x000997, 0x00000000);
404 nv_icmd(priv, 0x000998, 0x00000000);
405 nv_icmd(priv, 0x000999, 0x00000000);
406 nv_icmd(priv, 0x00099a, 0x00000000);
407 nv_icmd(priv, 0x00099b, 0x00000000);
408 nv_icmd(priv, 0x00099c, 0x00000000);
409 nv_icmd(priv, 0x00099d, 0x00000000);
410 nv_icmd(priv, 0x00099e, 0x00000000);
411 nv_icmd(priv, 0x00099f, 0x00000000);
412 nv_icmd(priv, 0x0009a0, 0x00000000);
413 nv_icmd(priv, 0x0009a1, 0x00000000);
414 nv_icmd(priv, 0x0009a2, 0x00000000);
415 nv_icmd(priv, 0x0009a3, 0x00000000);
416 nv_icmd(priv, 0x0009a4, 0x00000000);
417 nv_icmd(priv, 0x0009a5, 0x00000000);
418 nv_icmd(priv, 0x0009a6, 0x00000000);
419 nv_icmd(priv, 0x0009a7, 0x00000000);
420 nv_icmd(priv, 0x0009a8, 0x00000000);
421 nv_icmd(priv, 0x0009a9, 0x00000000);
422 nv_icmd(priv, 0x0009aa, 0x00000000);
423 nv_icmd(priv, 0x0009ab, 0x00000000);
424 nv_icmd(priv, 0x0009ac, 0x00000000);
425 nv_icmd(priv, 0x0009ad, 0x00000000);
426 nv_icmd(priv, 0x0009ae, 0x00000000);
427 nv_icmd(priv, 0x0009af, 0x00000000);
428 nv_icmd(priv, 0x0009b0, 0x00000000);
429 nv_icmd(priv, 0x0009b1, 0x00000000);
430 nv_icmd(priv, 0x0009b2, 0x00000000);
431 nv_icmd(priv, 0x0009b3, 0x00000000);
432 nv_icmd(priv, 0x0009b4, 0x00000000);
433 nv_icmd(priv, 0x0009b5, 0x00000000);
434 nv_icmd(priv, 0x0009b6, 0x00000000);
435 nv_icmd(priv, 0x0009b7, 0x00000000);
436 nv_icmd(priv, 0x0009b8, 0x00000000);
437 nv_icmd(priv, 0x0009b9, 0x00000000);
438 nv_icmd(priv, 0x0009ba, 0x00000000);
439 nv_icmd(priv, 0x0009bb, 0x00000000);
440 nv_icmd(priv, 0x0009bc, 0x00000000);
441 nv_icmd(priv, 0x0009bd, 0x00000000);
442 nv_icmd(priv, 0x0009be, 0x00000000);
443 nv_icmd(priv, 0x0009bf, 0x00000000);
444 nv_icmd(priv, 0x0009c0, 0x00000000);
445 nv_icmd(priv, 0x0009c1, 0x00000000);
446 nv_icmd(priv, 0x0009c2, 0x00000000);
447 nv_icmd(priv, 0x0009c3, 0x00000000);
448 nv_icmd(priv, 0x0009c4, 0x00000000);
449 nv_icmd(priv, 0x0009c5, 0x00000000);
450 nv_icmd(priv, 0x0009c6, 0x00000000);
451 nv_icmd(priv, 0x0009c7, 0x00000000);
452 nv_icmd(priv, 0x0009c8, 0x00000000);
453 nv_icmd(priv, 0x0009c9, 0x00000000);
454 nv_icmd(priv, 0x0009ca, 0x00000000);
455 nv_icmd(priv, 0x0009cb, 0x00000000);
456 nv_icmd(priv, 0x0009cc, 0x00000000);
457 nv_icmd(priv, 0x0009cd, 0x00000000);
458 nv_icmd(priv, 0x0009ce, 0x00000000);
459 nv_icmd(priv, 0x0009cf, 0x00000000);
460 nv_icmd(priv, 0x0009d0, 0x00000000);
461 nv_icmd(priv, 0x0009d1, 0x00000000);
462 nv_icmd(priv, 0x0009d2, 0x00000000);
463 nv_icmd(priv, 0x0009d3, 0x00000000);
464 nv_icmd(priv, 0x0009d4, 0x00000000);
465 nv_icmd(priv, 0x0009d5, 0x00000000);
466 nv_icmd(priv, 0x0009d6, 0x00000000);
467 nv_icmd(priv, 0x0009d7, 0x00000000);
468 nv_icmd(priv, 0x0009d8, 0x00000000);
469 nv_icmd(priv, 0x0009d9, 0x00000000);
470 nv_icmd(priv, 0x0009da, 0x00000000);
471 nv_icmd(priv, 0x0009db, 0x00000000);
472 nv_icmd(priv, 0x0009dc, 0x00000000);
473 nv_icmd(priv, 0x0009dd, 0x00000000);
474 nv_icmd(priv, 0x0009de, 0x00000000);
475 nv_icmd(priv, 0x0009df, 0x00000000);
476 nv_icmd(priv, 0x0009e0, 0x00000000);
477 nv_icmd(priv, 0x0009e1, 0x00000000);
478 nv_icmd(priv, 0x0009e2, 0x00000000);
479 nv_icmd(priv, 0x0009e3, 0x00000000);
480 nv_icmd(priv, 0x0009e4, 0x00000000);
481 nv_icmd(priv, 0x0009e5, 0x00000000);
482 nv_icmd(priv, 0x0009e6, 0x00000000);
483 nv_icmd(priv, 0x0009e7, 0x00000000);
484 nv_icmd(priv, 0x0009e8, 0x00000000);
485 nv_icmd(priv, 0x0009e9, 0x00000000);
486 nv_icmd(priv, 0x0009ea, 0x00000000);
487 nv_icmd(priv, 0x0009eb, 0x00000000);
488 nv_icmd(priv, 0x0009ec, 0x00000000);
489 nv_icmd(priv, 0x0009ed, 0x00000000);
490 nv_icmd(priv, 0x0009ee, 0x00000000);
491 nv_icmd(priv, 0x0009ef, 0x00000000);
492 nv_icmd(priv, 0x0009f0, 0x00000000);
493 nv_icmd(priv, 0x0009f1, 0x00000000);
494 nv_icmd(priv, 0x0009f2, 0x00000000);
495 nv_icmd(priv, 0x0009f3, 0x00000000);
496 nv_icmd(priv, 0x0009f4, 0x00000000);
497 nv_icmd(priv, 0x0009f5, 0x00000000);
498 nv_icmd(priv, 0x0009f6, 0x00000000);
499 nv_icmd(priv, 0x0009f7, 0x00000000);
500 nv_icmd(priv, 0x0009f8, 0x00000000);
501 nv_icmd(priv, 0x0009f9, 0x00000000);
502 nv_icmd(priv, 0x0009fa, 0x00000000);
503 nv_icmd(priv, 0x0009fb, 0x00000000);
504 nv_icmd(priv, 0x0009fc, 0x00000000);
505 nv_icmd(priv, 0x0009fd, 0x00000000);
506 nv_icmd(priv, 0x0009fe, 0x00000000);
507 nv_icmd(priv, 0x0009ff, 0x00000000);
508 nv_icmd(priv, 0x000468, 0x00000004);
509 nv_icmd(priv, 0x00046c, 0x00000001);
510 nv_icmd(priv, 0x000470, 0x00000000);
511 nv_icmd(priv, 0x000471, 0x00000000);
512 nv_icmd(priv, 0x000472, 0x00000000);
513 nv_icmd(priv, 0x000473, 0x00000000);
514 nv_icmd(priv, 0x000474, 0x00000000);
515 nv_icmd(priv, 0x000475, 0x00000000);
516 nv_icmd(priv, 0x000476, 0x00000000);
517 nv_icmd(priv, 0x000477, 0x00000000);
518 nv_icmd(priv, 0x000478, 0x00000000);
519 nv_icmd(priv, 0x000479, 0x00000000);
520 nv_icmd(priv, 0x00047a, 0x00000000);
521 nv_icmd(priv, 0x00047b, 0x00000000);
522 nv_icmd(priv, 0x00047c, 0x00000000);
523 nv_icmd(priv, 0x00047d, 0x00000000);
524 nv_icmd(priv, 0x00047e, 0x00000000);
525 nv_icmd(priv, 0x00047f, 0x00000000);
526 nv_icmd(priv, 0x000480, 0x00000000);
527 nv_icmd(priv, 0x000481, 0x00000000);
528 nv_icmd(priv, 0x000482, 0x00000000);
529 nv_icmd(priv, 0x000483, 0x00000000);
530 nv_icmd(priv, 0x000484, 0x00000000);
531 nv_icmd(priv, 0x000485, 0x00000000);
532 nv_icmd(priv, 0x000486, 0x00000000);
533 nv_icmd(priv, 0x000487, 0x00000000);
534 nv_icmd(priv, 0x000488, 0x00000000);
535 nv_icmd(priv, 0x000489, 0x00000000);
536 nv_icmd(priv, 0x00048a, 0x00000000);
537 nv_icmd(priv, 0x00048b, 0x00000000);
538 nv_icmd(priv, 0x00048c, 0x00000000);
539 nv_icmd(priv, 0x00048d, 0x00000000);
540 nv_icmd(priv, 0x00048e, 0x00000000);
541 nv_icmd(priv, 0x00048f, 0x00000000);
542 nv_icmd(priv, 0x000490, 0x00000000);
543 nv_icmd(priv, 0x000491, 0x00000000);
544 nv_icmd(priv, 0x000492, 0x00000000);
545 nv_icmd(priv, 0x000493, 0x00000000);
546 nv_icmd(priv, 0x000494, 0x00000000);
547 nv_icmd(priv, 0x000495, 0x00000000);
548 nv_icmd(priv, 0x000496, 0x00000000);
549 nv_icmd(priv, 0x000497, 0x00000000);
550 nv_icmd(priv, 0x000498, 0x00000000);
551 nv_icmd(priv, 0x000499, 0x00000000);
552 nv_icmd(priv, 0x00049a, 0x00000000);
553 nv_icmd(priv, 0x00049b, 0x00000000);
554 nv_icmd(priv, 0x00049c, 0x00000000);
555 nv_icmd(priv, 0x00049d, 0x00000000);
556 nv_icmd(priv, 0x00049e, 0x00000000);
557 nv_icmd(priv, 0x00049f, 0x00000000);
558 nv_icmd(priv, 0x0004a0, 0x00000000);
559 nv_icmd(priv, 0x0004a1, 0x00000000);
560 nv_icmd(priv, 0x0004a2, 0x00000000);
561 nv_icmd(priv, 0x0004a3, 0x00000000);
562 nv_icmd(priv, 0x0004a4, 0x00000000);
563 nv_icmd(priv, 0x0004a5, 0x00000000);
564 nv_icmd(priv, 0x0004a6, 0x00000000);
565 nv_icmd(priv, 0x0004a7, 0x00000000);
566 nv_icmd(priv, 0x0004a8, 0x00000000);
567 nv_icmd(priv, 0x0004a9, 0x00000000);
568 nv_icmd(priv, 0x0004aa, 0x00000000);
569 nv_icmd(priv, 0x0004ab, 0x00000000);
570 nv_icmd(priv, 0x0004ac, 0x00000000);
571 nv_icmd(priv, 0x0004ad, 0x00000000);
572 nv_icmd(priv, 0x0004ae, 0x00000000);
573 nv_icmd(priv, 0x0004af, 0x00000000);
574 nv_icmd(priv, 0x0004b0, 0x00000000);
575 nv_icmd(priv, 0x0004b1, 0x00000000);
576 nv_icmd(priv, 0x0004b2, 0x00000000);
577 nv_icmd(priv, 0x0004b3, 0x00000000);
578 nv_icmd(priv, 0x0004b4, 0x00000000);
579 nv_icmd(priv, 0x0004b5, 0x00000000);
580 nv_icmd(priv, 0x0004b6, 0x00000000);
581 nv_icmd(priv, 0x0004b7, 0x00000000);
582 nv_icmd(priv, 0x0004b8, 0x00000000);
583 nv_icmd(priv, 0x0004b9, 0x00000000);
584 nv_icmd(priv, 0x0004ba, 0x00000000);
585 nv_icmd(priv, 0x0004bb, 0x00000000);
586 nv_icmd(priv, 0x0004bc, 0x00000000);
587 nv_icmd(priv, 0x0004bd, 0x00000000);
588 nv_icmd(priv, 0x0004be, 0x00000000);
589 nv_icmd(priv, 0x0004bf, 0x00000000);
590 nv_icmd(priv, 0x0004c0, 0x00000000);
591 nv_icmd(priv, 0x0004c1, 0x00000000);
592 nv_icmd(priv, 0x0004c2, 0x00000000);
593 nv_icmd(priv, 0x0004c3, 0x00000000);
594 nv_icmd(priv, 0x0004c4, 0x00000000);
595 nv_icmd(priv, 0x0004c5, 0x00000000);
596 nv_icmd(priv, 0x0004c6, 0x00000000);
597 nv_icmd(priv, 0x0004c7, 0x00000000);
598 nv_icmd(priv, 0x0004c8, 0x00000000);
599 nv_icmd(priv, 0x0004c9, 0x00000000);
600 nv_icmd(priv, 0x0004ca, 0x00000000);
601 nv_icmd(priv, 0x0004cb, 0x00000000);
602 nv_icmd(priv, 0x0004cc, 0x00000000);
603 nv_icmd(priv, 0x0004cd, 0x00000000);
604 nv_icmd(priv, 0x0004ce, 0x00000000);
605 nv_icmd(priv, 0x0004cf, 0x00000000);
606 nv_icmd(priv, 0x000510, 0x3f800000);
607 nv_icmd(priv, 0x000511, 0x3f800000);
608 nv_icmd(priv, 0x000512, 0x3f800000);
609 nv_icmd(priv, 0x000513, 0x3f800000);
610 nv_icmd(priv, 0x000514, 0x3f800000);
611 nv_icmd(priv, 0x000515, 0x3f800000);
612 nv_icmd(priv, 0x000516, 0x3f800000);
613 nv_icmd(priv, 0x000517, 0x3f800000);
614 nv_icmd(priv, 0x000518, 0x3f800000);
615 nv_icmd(priv, 0x000519, 0x3f800000);
616 nv_icmd(priv, 0x00051a, 0x3f800000);
617 nv_icmd(priv, 0x00051b, 0x3f800000);
618 nv_icmd(priv, 0x00051c, 0x3f800000);
619 nv_icmd(priv, 0x00051d, 0x3f800000);
620 nv_icmd(priv, 0x00051e, 0x3f800000);
621 nv_icmd(priv, 0x00051f, 0x3f800000);
622 nv_icmd(priv, 0x000520, 0x000002b6);
623 nv_icmd(priv, 0x000529, 0x00000001);
624 nv_icmd(priv, 0x000530, 0xffff0000);
625 nv_icmd(priv, 0x000531, 0xffff0000);
626 nv_icmd(priv, 0x000532, 0xffff0000);
627 nv_icmd(priv, 0x000533, 0xffff0000);
628 nv_icmd(priv, 0x000534, 0xffff0000);
629 nv_icmd(priv, 0x000535, 0xffff0000);
630 nv_icmd(priv, 0x000536, 0xffff0000);
631 nv_icmd(priv, 0x000537, 0xffff0000);
632 nv_icmd(priv, 0x000538, 0xffff0000);
633 nv_icmd(priv, 0x000539, 0xffff0000);
634 nv_icmd(priv, 0x00053a, 0xffff0000);
635 nv_icmd(priv, 0x00053b, 0xffff0000);
636 nv_icmd(priv, 0x00053c, 0xffff0000);
637 nv_icmd(priv, 0x00053d, 0xffff0000);
638 nv_icmd(priv, 0x00053e, 0xffff0000);
639 nv_icmd(priv, 0x00053f, 0xffff0000);
640 nv_icmd(priv, 0x000585, 0x0000003f);
641 nv_icmd(priv, 0x000576, 0x00000003);
642 nv_icmd(priv, 0x00057b, 0x00000059);
643 nv_icmd(priv, 0x000586, 0x00000040);
644 nv_icmd(priv, 0x000582, 0x00000080);
645 nv_icmd(priv, 0x000583, 0x00000080);
646 nv_icmd(priv, 0x0005c2, 0x00000001);
647 nv_icmd(priv, 0x000638, 0x00000001);
648 nv_icmd(priv, 0x000639, 0x00000001);
649 nv_icmd(priv, 0x00063a, 0x00000002);
650 nv_icmd(priv, 0x00063b, 0x00000001);
651 nv_icmd(priv, 0x00063c, 0x00000001);
652 nv_icmd(priv, 0x00063d, 0x00000002);
653 nv_icmd(priv, 0x00063e, 0x00000001);
654 nv_icmd(priv, 0x0008b8, 0x00000001);
655 nv_icmd(priv, 0x0008b9, 0x00000001);
656 nv_icmd(priv, 0x0008ba, 0x00000001);
657 nv_icmd(priv, 0x0008bb, 0x00000001);
658 nv_icmd(priv, 0x0008bc, 0x00000001);
659 nv_icmd(priv, 0x0008bd, 0x00000001);
660 nv_icmd(priv, 0x0008be, 0x00000001);
661 nv_icmd(priv, 0x0008bf, 0x00000001);
662 nv_icmd(priv, 0x000900, 0x00000001);
663 nv_icmd(priv, 0x000901, 0x00000001);
664 nv_icmd(priv, 0x000902, 0x00000001);
665 nv_icmd(priv, 0x000903, 0x00000001);
666 nv_icmd(priv, 0x000904, 0x00000001);
667 nv_icmd(priv, 0x000905, 0x00000001);
668 nv_icmd(priv, 0x000906, 0x00000001);
669 nv_icmd(priv, 0x000907, 0x00000001);
670 nv_icmd(priv, 0x000908, 0x00000002);
671 nv_icmd(priv, 0x000909, 0x00000002);
672 nv_icmd(priv, 0x00090a, 0x00000002);
673 nv_icmd(priv, 0x00090b, 0x00000002);
674 nv_icmd(priv, 0x00090c, 0x00000002);
675 nv_icmd(priv, 0x00090d, 0x00000002);
676 nv_icmd(priv, 0x00090e, 0x00000002);
677 nv_icmd(priv, 0x00090f, 0x00000002);
678 nv_icmd(priv, 0x000910, 0x00000001);
679 nv_icmd(priv, 0x000911, 0x00000001);
680 nv_icmd(priv, 0x000912, 0x00000001);
681 nv_icmd(priv, 0x000913, 0x00000001);
682 nv_icmd(priv, 0x000914, 0x00000001);
683 nv_icmd(priv, 0x000915, 0x00000001);
684 nv_icmd(priv, 0x000916, 0x00000001);
685 nv_icmd(priv, 0x000917, 0x00000001);
686 nv_icmd(priv, 0x000918, 0x00000001);
687 nv_icmd(priv, 0x000919, 0x00000001);
688 nv_icmd(priv, 0x00091a, 0x00000001);
689 nv_icmd(priv, 0x00091b, 0x00000001);
690 nv_icmd(priv, 0x00091c, 0x00000001);
691 nv_icmd(priv, 0x00091d, 0x00000001);
692 nv_icmd(priv, 0x00091e, 0x00000001);
693 nv_icmd(priv, 0x00091f, 0x00000001);
694 nv_icmd(priv, 0x000920, 0x00000002);
695 nv_icmd(priv, 0x000921, 0x00000002);
696 nv_icmd(priv, 0x000922, 0x00000002);
697 nv_icmd(priv, 0x000923, 0x00000002);
698 nv_icmd(priv, 0x000924, 0x00000002);
699 nv_icmd(priv, 0x000925, 0x00000002);
700 nv_icmd(priv, 0x000926, 0x00000002);
701 nv_icmd(priv, 0x000927, 0x00000002);
702 nv_icmd(priv, 0x000928, 0x00000001);
703 nv_icmd(priv, 0x000929, 0x00000001);
704 nv_icmd(priv, 0x00092a, 0x00000001);
705 nv_icmd(priv, 0x00092b, 0x00000001);
706 nv_icmd(priv, 0x00092c, 0x00000001);
707 nv_icmd(priv, 0x00092d, 0x00000001);
708 nv_icmd(priv, 0x00092e, 0x00000001);
709 nv_icmd(priv, 0x00092f, 0x00000001);
710 nv_icmd(priv, 0x000648, 0x00000001);
711 nv_icmd(priv, 0x000649, 0x00000001);
712 nv_icmd(priv, 0x00064a, 0x00000001);
713 nv_icmd(priv, 0x00064b, 0x00000001);
714 nv_icmd(priv, 0x00064c, 0x00000001);
715 nv_icmd(priv, 0x00064d, 0x00000001);
716 nv_icmd(priv, 0x00064e, 0x00000001);
717 nv_icmd(priv, 0x00064f, 0x00000001);
718 nv_icmd(priv, 0x000650, 0x00000001);
719 nv_icmd(priv, 0x000658, 0x0000000f);
720 nv_icmd(priv, 0x0007ff, 0x0000000a);
721 nv_icmd(priv, 0x00066a, 0x40000000);
722 nv_icmd(priv, 0x00066b, 0x10000000);
723 nv_icmd(priv, 0x00066c, 0xffff0000);
724 nv_icmd(priv, 0x00066d, 0xffff0000);
725 nv_icmd(priv, 0x0007af, 0x00000008);
726 nv_icmd(priv, 0x0007b0, 0x00000008);
727 nv_icmd(priv, 0x0007f6, 0x00000001);
728 nv_icmd(priv, 0x0006b2, 0x00000055);
729 nv_icmd(priv, 0x0007ad, 0x00000003);
730 nv_icmd(priv, 0x000937, 0x00000001);
731 nv_icmd(priv, 0x000971, 0x00000008);
732 nv_icmd(priv, 0x000972, 0x00000040);
733 nv_icmd(priv, 0x000973, 0x0000012c);
734 nv_icmd(priv, 0x00097c, 0x00000040);
735 nv_icmd(priv, 0x000979, 0x00000003);
736 nv_icmd(priv, 0x000975, 0x00000020);
737 nv_icmd(priv, 0x000976, 0x00000001);
738 nv_icmd(priv, 0x000977, 0x00000020);
739 nv_icmd(priv, 0x000978, 0x00000001);
740 nv_icmd(priv, 0x000957, 0x00000003);
741 nv_icmd(priv, 0x00095e, 0x20164010);
742 nv_icmd(priv, 0x00095f, 0x00000020);
743 nv_icmd(priv, 0x00097d, 0x00000020);
744 nv_icmd(priv, 0x000683, 0x00000006);
745 nv_icmd(priv, 0x000685, 0x003fffff);
746 nv_icmd(priv, 0x000687, 0x003fffff);
747 nv_icmd(priv, 0x0006a0, 0x00000005);
748 nv_icmd(priv, 0x000840, 0x00400008);
749 nv_icmd(priv, 0x000841, 0x08000080);
750 nv_icmd(priv, 0x000842, 0x00400008);
751 nv_icmd(priv, 0x000843, 0x08000080);
752 nv_icmd(priv, 0x000818, 0x00000000);
753 nv_icmd(priv, 0x000819, 0x00000000);
754 nv_icmd(priv, 0x00081a, 0x00000000);
755 nv_icmd(priv, 0x00081b, 0x00000000);
756 nv_icmd(priv, 0x00081c, 0x00000000);
757 nv_icmd(priv, 0x00081d, 0x00000000);
758 nv_icmd(priv, 0x00081e, 0x00000000);
759 nv_icmd(priv, 0x00081f, 0x00000000);
760 nv_icmd(priv, 0x000848, 0x00000000);
761 nv_icmd(priv, 0x000849, 0x00000000);
762 nv_icmd(priv, 0x00084a, 0x00000000);
763 nv_icmd(priv, 0x00084b, 0x00000000);
764 nv_icmd(priv, 0x00084c, 0x00000000);
765 nv_icmd(priv, 0x00084d, 0x00000000);
766 nv_icmd(priv, 0x00084e, 0x00000000);
767 nv_icmd(priv, 0x00084f, 0x00000000);
768 nv_icmd(priv, 0x000850, 0x00000000);
769 nv_icmd(priv, 0x000851, 0x00000000);
770 nv_icmd(priv, 0x000852, 0x00000000);
771 nv_icmd(priv, 0x000853, 0x00000000);
772 nv_icmd(priv, 0x000854, 0x00000000);
773 nv_icmd(priv, 0x000855, 0x00000000);
774 nv_icmd(priv, 0x000856, 0x00000000);
775 nv_icmd(priv, 0x000857, 0x00000000);
776 nv_icmd(priv, 0x000738, 0x00000000);
777 nv_icmd(priv, 0x0006aa, 0x00000001);
778 nv_icmd(priv, 0x0006ab, 0x00000002);
779 nv_icmd(priv, 0x0006ac, 0x00000080);
780 nv_icmd(priv, 0x0006ad, 0x00000100);
781 nv_icmd(priv, 0x0006ae, 0x00000100);
782 nv_icmd(priv, 0x0006b1, 0x00000011);
783 nv_icmd(priv, 0x0006bb, 0x000000cf);
784 nv_icmd(priv, 0x0006ce, 0x2a712488);
785 nv_icmd(priv, 0x000739, 0x4085c000);
786 nv_icmd(priv, 0x00073a, 0x00000080);
787 nv_icmd(priv, 0x000786, 0x80000100);
788 nv_icmd(priv, 0x00073c, 0x00010100);
789 nv_icmd(priv, 0x00073d, 0x02800000);
790 nv_icmd(priv, 0x000787, 0x000000cf);
791 nv_icmd(priv, 0x00078c, 0x00000008);
792 nv_icmd(priv, 0x000792, 0x00000001);
793 nv_icmd(priv, 0x000794, 0x00000001);
794 nv_icmd(priv, 0x000795, 0x00000001);
795 nv_icmd(priv, 0x000796, 0x00000001);
796 nv_icmd(priv, 0x000797, 0x000000cf);
797 nv_icmd(priv, 0x000836, 0x00000001);
798 nv_icmd(priv, 0x00079a, 0x00000002);
799 nv_icmd(priv, 0x000833, 0x04444480);
800 nv_icmd(priv, 0x0007a1, 0x00000001);
801 nv_icmd(priv, 0x0007a3, 0x00000001);
802 nv_icmd(priv, 0x0007a4, 0x00000001);
803 nv_icmd(priv, 0x0007a5, 0x00000001);
804 nv_icmd(priv, 0x000831, 0x00000004);
805 nv_icmd(priv, 0x000b07, 0x00000002);
806 nv_icmd(priv, 0x000b08, 0x00000100);
807 nv_icmd(priv, 0x000b09, 0x00000100);
808 nv_icmd(priv, 0x000b0a, 0x00000001);
809 nv_icmd(priv, 0x000a04, 0x000000ff);
810 nv_icmd(priv, 0x000a0b, 0x00000040);
811 nv_icmd(priv, 0x00097f, 0x00000100);
812 nv_icmd(priv, 0x000a02, 0x00000001);
813 nv_icmd(priv, 0x000809, 0x00000007);
814 nv_icmd(priv, 0x00c221, 0x00000040);
815 nv_icmd(priv, 0x00c1b0, 0x0000000f);
816 nv_icmd(priv, 0x00c1b1, 0x0000000f);
817 nv_icmd(priv, 0x00c1b2, 0x0000000f);
818 nv_icmd(priv, 0x00c1b3, 0x0000000f);
819 nv_icmd(priv, 0x00c1b4, 0x0000000f);
820 nv_icmd(priv, 0x00c1b5, 0x0000000f);
821 nv_icmd(priv, 0x00c1b6, 0x0000000f);
822 nv_icmd(priv, 0x00c1b7, 0x0000000f);
823 nv_icmd(priv, 0x00c1b8, 0x0fac6881);
824 nv_icmd(priv, 0x00c1b9, 0x00fac688);
825 nv_icmd(priv, 0x00c401, 0x00000001);
826 nv_icmd(priv, 0x00c402, 0x00010001);
827 nv_icmd(priv, 0x00c403, 0x00000001);
828 nv_icmd(priv, 0x00c404, 0x00000001);
829 nv_icmd(priv, 0x00c40e, 0x00000020);
830 nv_icmd(priv, 0x00c500, 0x00000003);
831 nv_icmd(priv, 0x01e100, 0x00000001);
832 nv_icmd(priv, 0x001000, 0x00000002);
833 nv_icmd(priv, 0x0006aa, 0x00000001);
834 nv_icmd(priv, 0x0006ad, 0x00000100);
835 nv_icmd(priv, 0x0006ae, 0x00000100);
836 nv_icmd(priv, 0x0006b1, 0x00000011);
837 nv_icmd(priv, 0x00078c, 0x00000008);
838 nv_icmd(priv, 0x000792, 0x00000001);
839 nv_icmd(priv, 0x000794, 0x00000001);
840 nv_icmd(priv, 0x000795, 0x00000001);
841 nv_icmd(priv, 0x000796, 0x00000001);
842 nv_icmd(priv, 0x000797, 0x000000cf);
843 nv_icmd(priv, 0x00079a, 0x00000002);
844 nv_icmd(priv, 0x000833, 0x04444480);
845 nv_icmd(priv, 0x0007a1, 0x00000001);
846 nv_icmd(priv, 0x0007a3, 0x00000001);
847 nv_icmd(priv, 0x0007a4, 0x00000001);
848 nv_icmd(priv, 0x0007a5, 0x00000001);
849 nv_icmd(priv, 0x000831, 0x00000004);
850 nv_icmd(priv, 0x01e100, 0x00000001);
851 nv_icmd(priv, 0x001000, 0x00000008);
852 nv_icmd(priv, 0x000039, 0x00000000);
853 nv_icmd(priv, 0x00003a, 0x00000000);
854 nv_icmd(priv, 0x00003b, 0x00000000);
855 nv_icmd(priv, 0x000380, 0x00000001);
856 nv_icmd(priv, 0x000366, 0x00000000);
857 nv_icmd(priv, 0x000367, 0x00000000);
858 nv_icmd(priv, 0x000368, 0x00000fff);
859 nv_icmd(priv, 0x000370, 0x00000000);
860 nv_icmd(priv, 0x000371, 0x00000000);
861 nv_icmd(priv, 0x000372, 0x000fffff);
862 nv_icmd(priv, 0x000813, 0x00000006);
863 nv_icmd(priv, 0x000814, 0x00000008);
864 nv_icmd(priv, 0x000957, 0x00000003);
865 nv_icmd(priv, 0x000818, 0x00000000);
866 nv_icmd(priv, 0x000819, 0x00000000);
867 nv_icmd(priv, 0x00081a, 0x00000000);
868 nv_icmd(priv, 0x00081b, 0x00000000);
869 nv_icmd(priv, 0x00081c, 0x00000000);
870 nv_icmd(priv, 0x00081d, 0x00000000);
871 nv_icmd(priv, 0x00081e, 0x00000000);
872 nv_icmd(priv, 0x00081f, 0x00000000);
873 nv_icmd(priv, 0x000848, 0x00000000);
874 nv_icmd(priv, 0x000849, 0x00000000);
875 nv_icmd(priv, 0x00084a, 0x00000000);
876 nv_icmd(priv, 0x00084b, 0x00000000);
877 nv_icmd(priv, 0x00084c, 0x00000000);
878 nv_icmd(priv, 0x00084d, 0x00000000);
879 nv_icmd(priv, 0x00084e, 0x00000000);
880 nv_icmd(priv, 0x00084f, 0x00000000);
881 nv_icmd(priv, 0x000850, 0x00000000);
882 nv_icmd(priv, 0x000851, 0x00000000);
883 nv_icmd(priv, 0x000852, 0x00000000);
884 nv_icmd(priv, 0x000853, 0x00000000);
885 nv_icmd(priv, 0x000854, 0x00000000);
886 nv_icmd(priv, 0x000855, 0x00000000);
887 nv_icmd(priv, 0x000856, 0x00000000);
888 nv_icmd(priv, 0x000857, 0x00000000);
889 nv_icmd(priv, 0x000738, 0x00000000);
890 nv_icmd(priv, 0x000b07, 0x00000002);
891 nv_icmd(priv, 0x000b08, 0x00000100);
892 nv_icmd(priv, 0x000b09, 0x00000100);
893 nv_icmd(priv, 0x000b0a, 0x00000001);
894 nv_icmd(priv, 0x000a04, 0x000000ff);
895 nv_icmd(priv, 0x00097f, 0x00000100);
896 nv_icmd(priv, 0x000a02, 0x00000001);
897 nv_icmd(priv, 0x000809, 0x00000007);
898 nv_icmd(priv, 0x00c221, 0x00000040);
899 nv_icmd(priv, 0x00c401, 0x00000001);
900 nv_icmd(priv, 0x00c402, 0x00010001);
901 nv_icmd(priv, 0x00c403, 0x00000001);
902 nv_icmd(priv, 0x00c404, 0x00000001);
903 nv_icmd(priv, 0x00c40e, 0x00000020);
904 nv_icmd(priv, 0x00c500, 0x00000003);
905 nv_icmd(priv, 0x01e100, 0x00000001);
906 nv_icmd(priv, 0x001000, 0x00000001);
907 nv_icmd(priv, 0x000b07, 0x00000002);
908 nv_icmd(priv, 0x000b08, 0x00000100);
909 nv_icmd(priv, 0x000b09, 0x00000100);
910 nv_icmd(priv, 0x000b0a, 0x00000001);
911 nv_icmd(priv, 0x01e100, 0x00000001);
912 nv_wr32(priv, 0x400208, 0x00000000);
913}
914
915static void
916nve0_grctx_generate_a097(struct nvc0_graph_priv *priv)
917{
918 nv_mthd(priv, 0xa097, 0x0800, 0x00000000);
919 nv_mthd(priv, 0xa097, 0x0840, 0x00000000);
920 nv_mthd(priv, 0xa097, 0x0880, 0x00000000);
921 nv_mthd(priv, 0xa097, 0x08c0, 0x00000000);
922 nv_mthd(priv, 0xa097, 0x0900, 0x00000000);
923 nv_mthd(priv, 0xa097, 0x0940, 0x00000000);
924 nv_mthd(priv, 0xa097, 0x0980, 0x00000000);
925 nv_mthd(priv, 0xa097, 0x09c0, 0x00000000);
926 nv_mthd(priv, 0xa097, 0x0804, 0x00000000);
927 nv_mthd(priv, 0xa097, 0x0844, 0x00000000);
928 nv_mthd(priv, 0xa097, 0x0884, 0x00000000);
929 nv_mthd(priv, 0xa097, 0x08c4, 0x00000000);
930 nv_mthd(priv, 0xa097, 0x0904, 0x00000000);
931 nv_mthd(priv, 0xa097, 0x0944, 0x00000000);
932 nv_mthd(priv, 0xa097, 0x0984, 0x00000000);
933 nv_mthd(priv, 0xa097, 0x09c4, 0x00000000);
934 nv_mthd(priv, 0xa097, 0x0808, 0x00000400);
935 nv_mthd(priv, 0xa097, 0x0848, 0x00000400);
936 nv_mthd(priv, 0xa097, 0x0888, 0x00000400);
937 nv_mthd(priv, 0xa097, 0x08c8, 0x00000400);
938 nv_mthd(priv, 0xa097, 0x0908, 0x00000400);
939 nv_mthd(priv, 0xa097, 0x0948, 0x00000400);
940 nv_mthd(priv, 0xa097, 0x0988, 0x00000400);
941 nv_mthd(priv, 0xa097, 0x09c8, 0x00000400);
942 nv_mthd(priv, 0xa097, 0x080c, 0x00000300);
943 nv_mthd(priv, 0xa097, 0x084c, 0x00000300);
944 nv_mthd(priv, 0xa097, 0x088c, 0x00000300);
945 nv_mthd(priv, 0xa097, 0x08cc, 0x00000300);
946 nv_mthd(priv, 0xa097, 0x090c, 0x00000300);
947 nv_mthd(priv, 0xa097, 0x094c, 0x00000300);
948 nv_mthd(priv, 0xa097, 0x098c, 0x00000300);
949 nv_mthd(priv, 0xa097, 0x09cc, 0x00000300);
950 nv_mthd(priv, 0xa097, 0x0810, 0x000000cf);
951 nv_mthd(priv, 0xa097, 0x0850, 0x00000000);
952 nv_mthd(priv, 0xa097, 0x0890, 0x00000000);
953 nv_mthd(priv, 0xa097, 0x08d0, 0x00000000);
954 nv_mthd(priv, 0xa097, 0x0910, 0x00000000);
955 nv_mthd(priv, 0xa097, 0x0950, 0x00000000);
956 nv_mthd(priv, 0xa097, 0x0990, 0x00000000);
957 nv_mthd(priv, 0xa097, 0x09d0, 0x00000000);
958 nv_mthd(priv, 0xa097, 0x0814, 0x00000040);
959 nv_mthd(priv, 0xa097, 0x0854, 0x00000040);
960 nv_mthd(priv, 0xa097, 0x0894, 0x00000040);
961 nv_mthd(priv, 0xa097, 0x08d4, 0x00000040);
962 nv_mthd(priv, 0xa097, 0x0914, 0x00000040);
963 nv_mthd(priv, 0xa097, 0x0954, 0x00000040);
964 nv_mthd(priv, 0xa097, 0x0994, 0x00000040);
965 nv_mthd(priv, 0xa097, 0x09d4, 0x00000040);
966 nv_mthd(priv, 0xa097, 0x0818, 0x00000001);
967 nv_mthd(priv, 0xa097, 0x0858, 0x00000001);
968 nv_mthd(priv, 0xa097, 0x0898, 0x00000001);
969 nv_mthd(priv, 0xa097, 0x08d8, 0x00000001);
970 nv_mthd(priv, 0xa097, 0x0918, 0x00000001);
971 nv_mthd(priv, 0xa097, 0x0958, 0x00000001);
972 nv_mthd(priv, 0xa097, 0x0998, 0x00000001);
973 nv_mthd(priv, 0xa097, 0x09d8, 0x00000001);
974 nv_mthd(priv, 0xa097, 0x081c, 0x00000000);
975 nv_mthd(priv, 0xa097, 0x085c, 0x00000000);
976 nv_mthd(priv, 0xa097, 0x089c, 0x00000000);
977 nv_mthd(priv, 0xa097, 0x08dc, 0x00000000);
978 nv_mthd(priv, 0xa097, 0x091c, 0x00000000);
979 nv_mthd(priv, 0xa097, 0x095c, 0x00000000);
980 nv_mthd(priv, 0xa097, 0x099c, 0x00000000);
981 nv_mthd(priv, 0xa097, 0x09dc, 0x00000000);
982 nv_mthd(priv, 0xa097, 0x0820, 0x00000000);
983 nv_mthd(priv, 0xa097, 0x0860, 0x00000000);
984 nv_mthd(priv, 0xa097, 0x08a0, 0x00000000);
985 nv_mthd(priv, 0xa097, 0x08e0, 0x00000000);
986 nv_mthd(priv, 0xa097, 0x0920, 0x00000000);
987 nv_mthd(priv, 0xa097, 0x0960, 0x00000000);
988 nv_mthd(priv, 0xa097, 0x09a0, 0x00000000);
989 nv_mthd(priv, 0xa097, 0x09e0, 0x00000000);
990 nv_mthd(priv, 0xa097, 0x1c00, 0x00000000);
991 nv_mthd(priv, 0xa097, 0x1c10, 0x00000000);
992 nv_mthd(priv, 0xa097, 0x1c20, 0x00000000);
993 nv_mthd(priv, 0xa097, 0x1c30, 0x00000000);
994 nv_mthd(priv, 0xa097, 0x1c40, 0x00000000);
995 nv_mthd(priv, 0xa097, 0x1c50, 0x00000000);
996 nv_mthd(priv, 0xa097, 0x1c60, 0x00000000);
997 nv_mthd(priv, 0xa097, 0x1c70, 0x00000000);
998 nv_mthd(priv, 0xa097, 0x1c80, 0x00000000);
999 nv_mthd(priv, 0xa097, 0x1c90, 0x00000000);
1000 nv_mthd(priv, 0xa097, 0x1ca0, 0x00000000);
1001 nv_mthd(priv, 0xa097, 0x1cb0, 0x00000000);
1002 nv_mthd(priv, 0xa097, 0x1cc0, 0x00000000);
1003 nv_mthd(priv, 0xa097, 0x1cd0, 0x00000000);
1004 nv_mthd(priv, 0xa097, 0x1ce0, 0x00000000);
1005 nv_mthd(priv, 0xa097, 0x1cf0, 0x00000000);
1006 nv_mthd(priv, 0xa097, 0x1c04, 0x00000000);
1007 nv_mthd(priv, 0xa097, 0x1c14, 0x00000000);
1008 nv_mthd(priv, 0xa097, 0x1c24, 0x00000000);
1009 nv_mthd(priv, 0xa097, 0x1c34, 0x00000000);
1010 nv_mthd(priv, 0xa097, 0x1c44, 0x00000000);
1011 nv_mthd(priv, 0xa097, 0x1c54, 0x00000000);
1012 nv_mthd(priv, 0xa097, 0x1c64, 0x00000000);
1013 nv_mthd(priv, 0xa097, 0x1c74, 0x00000000);
1014 nv_mthd(priv, 0xa097, 0x1c84, 0x00000000);
1015 nv_mthd(priv, 0xa097, 0x1c94, 0x00000000);
1016 nv_mthd(priv, 0xa097, 0x1ca4, 0x00000000);
1017 nv_mthd(priv, 0xa097, 0x1cb4, 0x00000000);
1018 nv_mthd(priv, 0xa097, 0x1cc4, 0x00000000);
1019 nv_mthd(priv, 0xa097, 0x1cd4, 0x00000000);
1020 nv_mthd(priv, 0xa097, 0x1ce4, 0x00000000);
1021 nv_mthd(priv, 0xa097, 0x1cf4, 0x00000000);
1022 nv_mthd(priv, 0xa097, 0x1c08, 0x00000000);
1023 nv_mthd(priv, 0xa097, 0x1c18, 0x00000000);
1024 nv_mthd(priv, 0xa097, 0x1c28, 0x00000000);
1025 nv_mthd(priv, 0xa097, 0x1c38, 0x00000000);
1026 nv_mthd(priv, 0xa097, 0x1c48, 0x00000000);
1027 nv_mthd(priv, 0xa097, 0x1c58, 0x00000000);
1028 nv_mthd(priv, 0xa097, 0x1c68, 0x00000000);
1029 nv_mthd(priv, 0xa097, 0x1c78, 0x00000000);
1030 nv_mthd(priv, 0xa097, 0x1c88, 0x00000000);
1031 nv_mthd(priv, 0xa097, 0x1c98, 0x00000000);
1032 nv_mthd(priv, 0xa097, 0x1ca8, 0x00000000);
1033 nv_mthd(priv, 0xa097, 0x1cb8, 0x00000000);
1034 nv_mthd(priv, 0xa097, 0x1cc8, 0x00000000);
1035 nv_mthd(priv, 0xa097, 0x1cd8, 0x00000000);
1036 nv_mthd(priv, 0xa097, 0x1ce8, 0x00000000);
1037 nv_mthd(priv, 0xa097, 0x1cf8, 0x00000000);
1038 nv_mthd(priv, 0xa097, 0x1c0c, 0x00000000);
1039 nv_mthd(priv, 0xa097, 0x1c1c, 0x00000000);
1040 nv_mthd(priv, 0xa097, 0x1c2c, 0x00000000);
1041 nv_mthd(priv, 0xa097, 0x1c3c, 0x00000000);
1042 nv_mthd(priv, 0xa097, 0x1c4c, 0x00000000);
1043 nv_mthd(priv, 0xa097, 0x1c5c, 0x00000000);
1044 nv_mthd(priv, 0xa097, 0x1c6c, 0x00000000);
1045 nv_mthd(priv, 0xa097, 0x1c7c, 0x00000000);
1046 nv_mthd(priv, 0xa097, 0x1c8c, 0x00000000);
1047 nv_mthd(priv, 0xa097, 0x1c9c, 0x00000000);
1048 nv_mthd(priv, 0xa097, 0x1cac, 0x00000000);
1049 nv_mthd(priv, 0xa097, 0x1cbc, 0x00000000);
1050 nv_mthd(priv, 0xa097, 0x1ccc, 0x00000000);
1051 nv_mthd(priv, 0xa097, 0x1cdc, 0x00000000);
1052 nv_mthd(priv, 0xa097, 0x1cec, 0x00000000);
1053 nv_mthd(priv, 0xa097, 0x1cfc, 0x00000000);
1054 nv_mthd(priv, 0xa097, 0x1d00, 0x00000000);
1055 nv_mthd(priv, 0xa097, 0x1d10, 0x00000000);
1056 nv_mthd(priv, 0xa097, 0x1d20, 0x00000000);
1057 nv_mthd(priv, 0xa097, 0x1d30, 0x00000000);
1058 nv_mthd(priv, 0xa097, 0x1d40, 0x00000000);
1059 nv_mthd(priv, 0xa097, 0x1d50, 0x00000000);
1060 nv_mthd(priv, 0xa097, 0x1d60, 0x00000000);
1061 nv_mthd(priv, 0xa097, 0x1d70, 0x00000000);
1062 nv_mthd(priv, 0xa097, 0x1d80, 0x00000000);
1063 nv_mthd(priv, 0xa097, 0x1d90, 0x00000000);
1064 nv_mthd(priv, 0xa097, 0x1da0, 0x00000000);
1065 nv_mthd(priv, 0xa097, 0x1db0, 0x00000000);
1066 nv_mthd(priv, 0xa097, 0x1dc0, 0x00000000);
1067 nv_mthd(priv, 0xa097, 0x1dd0, 0x00000000);
1068 nv_mthd(priv, 0xa097, 0x1de0, 0x00000000);
1069 nv_mthd(priv, 0xa097, 0x1df0, 0x00000000);
1070 nv_mthd(priv, 0xa097, 0x1d04, 0x00000000);
1071 nv_mthd(priv, 0xa097, 0x1d14, 0x00000000);
1072 nv_mthd(priv, 0xa097, 0x1d24, 0x00000000);
1073 nv_mthd(priv, 0xa097, 0x1d34, 0x00000000);
1074 nv_mthd(priv, 0xa097, 0x1d44, 0x00000000);
1075 nv_mthd(priv, 0xa097, 0x1d54, 0x00000000);
1076 nv_mthd(priv, 0xa097, 0x1d64, 0x00000000);
1077 nv_mthd(priv, 0xa097, 0x1d74, 0x00000000);
1078 nv_mthd(priv, 0xa097, 0x1d84, 0x00000000);
1079 nv_mthd(priv, 0xa097, 0x1d94, 0x00000000);
1080 nv_mthd(priv, 0xa097, 0x1da4, 0x00000000);
1081 nv_mthd(priv, 0xa097, 0x1db4, 0x00000000);
1082 nv_mthd(priv, 0xa097, 0x1dc4, 0x00000000);
1083 nv_mthd(priv, 0xa097, 0x1dd4, 0x00000000);
1084 nv_mthd(priv, 0xa097, 0x1de4, 0x00000000);
1085 nv_mthd(priv, 0xa097, 0x1df4, 0x00000000);
1086 nv_mthd(priv, 0xa097, 0x1d08, 0x00000000);
1087 nv_mthd(priv, 0xa097, 0x1d18, 0x00000000);
1088 nv_mthd(priv, 0xa097, 0x1d28, 0x00000000);
1089 nv_mthd(priv, 0xa097, 0x1d38, 0x00000000);
1090 nv_mthd(priv, 0xa097, 0x1d48, 0x00000000);
1091 nv_mthd(priv, 0xa097, 0x1d58, 0x00000000);
1092 nv_mthd(priv, 0xa097, 0x1d68, 0x00000000);
1093 nv_mthd(priv, 0xa097, 0x1d78, 0x00000000);
1094 nv_mthd(priv, 0xa097, 0x1d88, 0x00000000);
1095 nv_mthd(priv, 0xa097, 0x1d98, 0x00000000);
1096 nv_mthd(priv, 0xa097, 0x1da8, 0x00000000);
1097 nv_mthd(priv, 0xa097, 0x1db8, 0x00000000);
1098 nv_mthd(priv, 0xa097, 0x1dc8, 0x00000000);
1099 nv_mthd(priv, 0xa097, 0x1dd8, 0x00000000);
1100 nv_mthd(priv, 0xa097, 0x1de8, 0x00000000);
1101 nv_mthd(priv, 0xa097, 0x1df8, 0x00000000);
1102 nv_mthd(priv, 0xa097, 0x1d0c, 0x00000000);
1103 nv_mthd(priv, 0xa097, 0x1d1c, 0x00000000);
1104 nv_mthd(priv, 0xa097, 0x1d2c, 0x00000000);
1105 nv_mthd(priv, 0xa097, 0x1d3c, 0x00000000);
1106 nv_mthd(priv, 0xa097, 0x1d4c, 0x00000000);
1107 nv_mthd(priv, 0xa097, 0x1d5c, 0x00000000);
1108 nv_mthd(priv, 0xa097, 0x1d6c, 0x00000000);
1109 nv_mthd(priv, 0xa097, 0x1d7c, 0x00000000);
1110 nv_mthd(priv, 0xa097, 0x1d8c, 0x00000000);
1111 nv_mthd(priv, 0xa097, 0x1d9c, 0x00000000);
1112 nv_mthd(priv, 0xa097, 0x1dac, 0x00000000);
1113 nv_mthd(priv, 0xa097, 0x1dbc, 0x00000000);
1114 nv_mthd(priv, 0xa097, 0x1dcc, 0x00000000);
1115 nv_mthd(priv, 0xa097, 0x1ddc, 0x00000000);
1116 nv_mthd(priv, 0xa097, 0x1dec, 0x00000000);
1117 nv_mthd(priv, 0xa097, 0x1dfc, 0x00000000);
1118 nv_mthd(priv, 0xa097, 0x1f00, 0x00000000);
1119 nv_mthd(priv, 0xa097, 0x1f08, 0x00000000);
1120 nv_mthd(priv, 0xa097, 0x1f10, 0x00000000);
1121 nv_mthd(priv, 0xa097, 0x1f18, 0x00000000);
1122 nv_mthd(priv, 0xa097, 0x1f20, 0x00000000);
1123 nv_mthd(priv, 0xa097, 0x1f28, 0x00000000);
1124 nv_mthd(priv, 0xa097, 0x1f30, 0x00000000);
1125 nv_mthd(priv, 0xa097, 0x1f38, 0x00000000);
1126 nv_mthd(priv, 0xa097, 0x1f40, 0x00000000);
1127 nv_mthd(priv, 0xa097, 0x1f48, 0x00000000);
1128 nv_mthd(priv, 0xa097, 0x1f50, 0x00000000);
1129 nv_mthd(priv, 0xa097, 0x1f58, 0x00000000);
1130 nv_mthd(priv, 0xa097, 0x1f60, 0x00000000);
1131 nv_mthd(priv, 0xa097, 0x1f68, 0x00000000);
1132 nv_mthd(priv, 0xa097, 0x1f70, 0x00000000);
1133 nv_mthd(priv, 0xa097, 0x1f78, 0x00000000);
1134 nv_mthd(priv, 0xa097, 0x1f04, 0x00000000);
1135 nv_mthd(priv, 0xa097, 0x1f0c, 0x00000000);
1136 nv_mthd(priv, 0xa097, 0x1f14, 0x00000000);
1137 nv_mthd(priv, 0xa097, 0x1f1c, 0x00000000);
1138 nv_mthd(priv, 0xa097, 0x1f24, 0x00000000);
1139 nv_mthd(priv, 0xa097, 0x1f2c, 0x00000000);
1140 nv_mthd(priv, 0xa097, 0x1f34, 0x00000000);
1141 nv_mthd(priv, 0xa097, 0x1f3c, 0x00000000);
1142 nv_mthd(priv, 0xa097, 0x1f44, 0x00000000);
1143 nv_mthd(priv, 0xa097, 0x1f4c, 0x00000000);
1144 nv_mthd(priv, 0xa097, 0x1f54, 0x00000000);
1145 nv_mthd(priv, 0xa097, 0x1f5c, 0x00000000);
1146 nv_mthd(priv, 0xa097, 0x1f64, 0x00000000);
1147 nv_mthd(priv, 0xa097, 0x1f6c, 0x00000000);
1148 nv_mthd(priv, 0xa097, 0x1f74, 0x00000000);
1149 nv_mthd(priv, 0xa097, 0x1f7c, 0x00000000);
1150 nv_mthd(priv, 0xa097, 0x1f80, 0x00000000);
1151 nv_mthd(priv, 0xa097, 0x1f88, 0x00000000);
1152 nv_mthd(priv, 0xa097, 0x1f90, 0x00000000);
1153 nv_mthd(priv, 0xa097, 0x1f98, 0x00000000);
1154 nv_mthd(priv, 0xa097, 0x1fa0, 0x00000000);
1155 nv_mthd(priv, 0xa097, 0x1fa8, 0x00000000);
1156 nv_mthd(priv, 0xa097, 0x1fb0, 0x00000000);
1157 nv_mthd(priv, 0xa097, 0x1fb8, 0x00000000);
1158 nv_mthd(priv, 0xa097, 0x1fc0, 0x00000000);
1159 nv_mthd(priv, 0xa097, 0x1fc8, 0x00000000);
1160 nv_mthd(priv, 0xa097, 0x1fd0, 0x00000000);
1161 nv_mthd(priv, 0xa097, 0x1fd8, 0x00000000);
1162 nv_mthd(priv, 0xa097, 0x1fe0, 0x00000000);
1163 nv_mthd(priv, 0xa097, 0x1fe8, 0x00000000);
1164 nv_mthd(priv, 0xa097, 0x1ff0, 0x00000000);
1165 nv_mthd(priv, 0xa097, 0x1ff8, 0x00000000);
1166 nv_mthd(priv, 0xa097, 0x1f84, 0x00000000);
1167 nv_mthd(priv, 0xa097, 0x1f8c, 0x00000000);
1168 nv_mthd(priv, 0xa097, 0x1f94, 0x00000000);
1169 nv_mthd(priv, 0xa097, 0x1f9c, 0x00000000);
1170 nv_mthd(priv, 0xa097, 0x1fa4, 0x00000000);
1171 nv_mthd(priv, 0xa097, 0x1fac, 0x00000000);
1172 nv_mthd(priv, 0xa097, 0x1fb4, 0x00000000);
1173 nv_mthd(priv, 0xa097, 0x1fbc, 0x00000000);
1174 nv_mthd(priv, 0xa097, 0x1fc4, 0x00000000);
1175 nv_mthd(priv, 0xa097, 0x1fcc, 0x00000000);
1176 nv_mthd(priv, 0xa097, 0x1fd4, 0x00000000);
1177 nv_mthd(priv, 0xa097, 0x1fdc, 0x00000000);
1178 nv_mthd(priv, 0xa097, 0x1fe4, 0x00000000);
1179 nv_mthd(priv, 0xa097, 0x1fec, 0x00000000);
1180 nv_mthd(priv, 0xa097, 0x1ff4, 0x00000000);
1181 nv_mthd(priv, 0xa097, 0x1ffc, 0x00000000);
1182 nv_mthd(priv, 0xa097, 0x2000, 0x00000000);
1183 nv_mthd(priv, 0xa097, 0x2040, 0x00000011);
1184 nv_mthd(priv, 0xa097, 0x2080, 0x00000020);
1185 nv_mthd(priv, 0xa097, 0x20c0, 0x00000030);
1186 nv_mthd(priv, 0xa097, 0x2100, 0x00000040);
1187 nv_mthd(priv, 0xa097, 0x2140, 0x00000051);
1188 nv_mthd(priv, 0xa097, 0x200c, 0x00000001);
1189 nv_mthd(priv, 0xa097, 0x204c, 0x00000001);
1190 nv_mthd(priv, 0xa097, 0x208c, 0x00000001);
1191 nv_mthd(priv, 0xa097, 0x20cc, 0x00000001);
1192 nv_mthd(priv, 0xa097, 0x210c, 0x00000001);
1193 nv_mthd(priv, 0xa097, 0x214c, 0x00000001);
1194 nv_mthd(priv, 0xa097, 0x2010, 0x00000000);
1195 nv_mthd(priv, 0xa097, 0x2050, 0x00000000);
1196 nv_mthd(priv, 0xa097, 0x2090, 0x00000001);
1197 nv_mthd(priv, 0xa097, 0x20d0, 0x00000002);
1198 nv_mthd(priv, 0xa097, 0x2110, 0x00000003);
1199 nv_mthd(priv, 0xa097, 0x2150, 0x00000004);
1200 nv_mthd(priv, 0xa097, 0x0380, 0x00000000);
1201 nv_mthd(priv, 0xa097, 0x03a0, 0x00000000);
1202 nv_mthd(priv, 0xa097, 0x03c0, 0x00000000);
1203 nv_mthd(priv, 0xa097, 0x03e0, 0x00000000);
1204 nv_mthd(priv, 0xa097, 0x0384, 0x00000000);
1205 nv_mthd(priv, 0xa097, 0x03a4, 0x00000000);
1206 nv_mthd(priv, 0xa097, 0x03c4, 0x00000000);
1207 nv_mthd(priv, 0xa097, 0x03e4, 0x00000000);
1208 nv_mthd(priv, 0xa097, 0x0388, 0x00000000);
1209 nv_mthd(priv, 0xa097, 0x03a8, 0x00000000);
1210 nv_mthd(priv, 0xa097, 0x03c8, 0x00000000);
1211 nv_mthd(priv, 0xa097, 0x03e8, 0x00000000);
1212 nv_mthd(priv, 0xa097, 0x038c, 0x00000000);
1213 nv_mthd(priv, 0xa097, 0x03ac, 0x00000000);
1214 nv_mthd(priv, 0xa097, 0x03cc, 0x00000000);
1215 nv_mthd(priv, 0xa097, 0x03ec, 0x00000000);
1216 nv_mthd(priv, 0xa097, 0x0700, 0x00000000);
1217 nv_mthd(priv, 0xa097, 0x0710, 0x00000000);
1218 nv_mthd(priv, 0xa097, 0x0720, 0x00000000);
1219 nv_mthd(priv, 0xa097, 0x0730, 0x00000000);
1220 nv_mthd(priv, 0xa097, 0x0704, 0x00000000);
1221 nv_mthd(priv, 0xa097, 0x0714, 0x00000000);
1222 nv_mthd(priv, 0xa097, 0x0724, 0x00000000);
1223 nv_mthd(priv, 0xa097, 0x0734, 0x00000000);
1224 nv_mthd(priv, 0xa097, 0x0708, 0x00000000);
1225 nv_mthd(priv, 0xa097, 0x0718, 0x00000000);
1226 nv_mthd(priv, 0xa097, 0x0728, 0x00000000);
1227 nv_mthd(priv, 0xa097, 0x0738, 0x00000000);
1228 nv_mthd(priv, 0xa097, 0x2800, 0x00000000);
1229 nv_mthd(priv, 0xa097, 0x2804, 0x00000000);
1230 nv_mthd(priv, 0xa097, 0x2808, 0x00000000);
1231 nv_mthd(priv, 0xa097, 0x280c, 0x00000000);
1232 nv_mthd(priv, 0xa097, 0x2810, 0x00000000);
1233 nv_mthd(priv, 0xa097, 0x2814, 0x00000000);
1234 nv_mthd(priv, 0xa097, 0x2818, 0x00000000);
1235 nv_mthd(priv, 0xa097, 0x281c, 0x00000000);
1236 nv_mthd(priv, 0xa097, 0x2820, 0x00000000);
1237 nv_mthd(priv, 0xa097, 0x2824, 0x00000000);
1238 nv_mthd(priv, 0xa097, 0x2828, 0x00000000);
1239 nv_mthd(priv, 0xa097, 0x282c, 0x00000000);
1240 nv_mthd(priv, 0xa097, 0x2830, 0x00000000);
1241 nv_mthd(priv, 0xa097, 0x2834, 0x00000000);
1242 nv_mthd(priv, 0xa097, 0x2838, 0x00000000);
1243 nv_mthd(priv, 0xa097, 0x283c, 0x00000000);
1244 nv_mthd(priv, 0xa097, 0x2840, 0x00000000);
1245 nv_mthd(priv, 0xa097, 0x2844, 0x00000000);
1246 nv_mthd(priv, 0xa097, 0x2848, 0x00000000);
1247 nv_mthd(priv, 0xa097, 0x284c, 0x00000000);
1248 nv_mthd(priv, 0xa097, 0x2850, 0x00000000);
1249 nv_mthd(priv, 0xa097, 0x2854, 0x00000000);
1250 nv_mthd(priv, 0xa097, 0x2858, 0x00000000);
1251 nv_mthd(priv, 0xa097, 0x285c, 0x00000000);
1252 nv_mthd(priv, 0xa097, 0x2860, 0x00000000);
1253 nv_mthd(priv, 0xa097, 0x2864, 0x00000000);
1254 nv_mthd(priv, 0xa097, 0x2868, 0x00000000);
1255 nv_mthd(priv, 0xa097, 0x286c, 0x00000000);
1256 nv_mthd(priv, 0xa097, 0x2870, 0x00000000);
1257 nv_mthd(priv, 0xa097, 0x2874, 0x00000000);
1258 nv_mthd(priv, 0xa097, 0x2878, 0x00000000);
1259 nv_mthd(priv, 0xa097, 0x287c, 0x00000000);
1260 nv_mthd(priv, 0xa097, 0x2880, 0x00000000);
1261 nv_mthd(priv, 0xa097, 0x2884, 0x00000000);
1262 nv_mthd(priv, 0xa097, 0x2888, 0x00000000);
1263 nv_mthd(priv, 0xa097, 0x288c, 0x00000000);
1264 nv_mthd(priv, 0xa097, 0x2890, 0x00000000);
1265 nv_mthd(priv, 0xa097, 0x2894, 0x00000000);
1266 nv_mthd(priv, 0xa097, 0x2898, 0x00000000);
1267 nv_mthd(priv, 0xa097, 0x289c, 0x00000000);
1268 nv_mthd(priv, 0xa097, 0x28a0, 0x00000000);
1269 nv_mthd(priv, 0xa097, 0x28a4, 0x00000000);
1270 nv_mthd(priv, 0xa097, 0x28a8, 0x00000000);
1271 nv_mthd(priv, 0xa097, 0x28ac, 0x00000000);
1272 nv_mthd(priv, 0xa097, 0x28b0, 0x00000000);
1273 nv_mthd(priv, 0xa097, 0x28b4, 0x00000000);
1274 nv_mthd(priv, 0xa097, 0x28b8, 0x00000000);
1275 nv_mthd(priv, 0xa097, 0x28bc, 0x00000000);
1276 nv_mthd(priv, 0xa097, 0x28c0, 0x00000000);
1277 nv_mthd(priv, 0xa097, 0x28c4, 0x00000000);
1278 nv_mthd(priv, 0xa097, 0x28c8, 0x00000000);
1279 nv_mthd(priv, 0xa097, 0x28cc, 0x00000000);
1280 nv_mthd(priv, 0xa097, 0x28d0, 0x00000000);
1281 nv_mthd(priv, 0xa097, 0x28d4, 0x00000000);
1282 nv_mthd(priv, 0xa097, 0x28d8, 0x00000000);
1283 nv_mthd(priv, 0xa097, 0x28dc, 0x00000000);
1284 nv_mthd(priv, 0xa097, 0x28e0, 0x00000000);
1285 nv_mthd(priv, 0xa097, 0x28e4, 0x00000000);
1286 nv_mthd(priv, 0xa097, 0x28e8, 0x00000000);
1287 nv_mthd(priv, 0xa097, 0x28ec, 0x00000000);
1288 nv_mthd(priv, 0xa097, 0x28f0, 0x00000000);
1289 nv_mthd(priv, 0xa097, 0x28f4, 0x00000000);
1290 nv_mthd(priv, 0xa097, 0x28f8, 0x00000000);
1291 nv_mthd(priv, 0xa097, 0x28fc, 0x00000000);
1292 nv_mthd(priv, 0xa097, 0x2900, 0x00000000);
1293 nv_mthd(priv, 0xa097, 0x2904, 0x00000000);
1294 nv_mthd(priv, 0xa097, 0x2908, 0x00000000);
1295 nv_mthd(priv, 0xa097, 0x290c, 0x00000000);
1296 nv_mthd(priv, 0xa097, 0x2910, 0x00000000);
1297 nv_mthd(priv, 0xa097, 0x2914, 0x00000000);
1298 nv_mthd(priv, 0xa097, 0x2918, 0x00000000);
1299 nv_mthd(priv, 0xa097, 0x291c, 0x00000000);
1300 nv_mthd(priv, 0xa097, 0x2920, 0x00000000);
1301 nv_mthd(priv, 0xa097, 0x2924, 0x00000000);
1302 nv_mthd(priv, 0xa097, 0x2928, 0x00000000);
1303 nv_mthd(priv, 0xa097, 0x292c, 0x00000000);
1304 nv_mthd(priv, 0xa097, 0x2930, 0x00000000);
1305 nv_mthd(priv, 0xa097, 0x2934, 0x00000000);
1306 nv_mthd(priv, 0xa097, 0x2938, 0x00000000);
1307 nv_mthd(priv, 0xa097, 0x293c, 0x00000000);
1308 nv_mthd(priv, 0xa097, 0x2940, 0x00000000);
1309 nv_mthd(priv, 0xa097, 0x2944, 0x00000000);
1310 nv_mthd(priv, 0xa097, 0x2948, 0x00000000);
1311 nv_mthd(priv, 0xa097, 0x294c, 0x00000000);
1312 nv_mthd(priv, 0xa097, 0x2950, 0x00000000);
1313 nv_mthd(priv, 0xa097, 0x2954, 0x00000000);
1314 nv_mthd(priv, 0xa097, 0x2958, 0x00000000);
1315 nv_mthd(priv, 0xa097, 0x295c, 0x00000000);
1316 nv_mthd(priv, 0xa097, 0x2960, 0x00000000);
1317 nv_mthd(priv, 0xa097, 0x2964, 0x00000000);
1318 nv_mthd(priv, 0xa097, 0x2968, 0x00000000);
1319 nv_mthd(priv, 0xa097, 0x296c, 0x00000000);
1320 nv_mthd(priv, 0xa097, 0x2970, 0x00000000);
1321 nv_mthd(priv, 0xa097, 0x2974, 0x00000000);
1322 nv_mthd(priv, 0xa097, 0x2978, 0x00000000);
1323 nv_mthd(priv, 0xa097, 0x297c, 0x00000000);
1324 nv_mthd(priv, 0xa097, 0x2980, 0x00000000);
1325 nv_mthd(priv, 0xa097, 0x2984, 0x00000000);
1326 nv_mthd(priv, 0xa097, 0x2988, 0x00000000);
1327 nv_mthd(priv, 0xa097, 0x298c, 0x00000000);
1328 nv_mthd(priv, 0xa097, 0x2990, 0x00000000);
1329 nv_mthd(priv, 0xa097, 0x2994, 0x00000000);
1330 nv_mthd(priv, 0xa097, 0x2998, 0x00000000);
1331 nv_mthd(priv, 0xa097, 0x299c, 0x00000000);
1332 nv_mthd(priv, 0xa097, 0x29a0, 0x00000000);
1333 nv_mthd(priv, 0xa097, 0x29a4, 0x00000000);
1334 nv_mthd(priv, 0xa097, 0x29a8, 0x00000000);
1335 nv_mthd(priv, 0xa097, 0x29ac, 0x00000000);
1336 nv_mthd(priv, 0xa097, 0x29b0, 0x00000000);
1337 nv_mthd(priv, 0xa097, 0x29b4, 0x00000000);
1338 nv_mthd(priv, 0xa097, 0x29b8, 0x00000000);
1339 nv_mthd(priv, 0xa097, 0x29bc, 0x00000000);
1340 nv_mthd(priv, 0xa097, 0x29c0, 0x00000000);
1341 nv_mthd(priv, 0xa097, 0x29c4, 0x00000000);
1342 nv_mthd(priv, 0xa097, 0x29c8, 0x00000000);
1343 nv_mthd(priv, 0xa097, 0x29cc, 0x00000000);
1344 nv_mthd(priv, 0xa097, 0x29d0, 0x00000000);
1345 nv_mthd(priv, 0xa097, 0x29d4, 0x00000000);
1346 nv_mthd(priv, 0xa097, 0x29d8, 0x00000000);
1347 nv_mthd(priv, 0xa097, 0x29dc, 0x00000000);
1348 nv_mthd(priv, 0xa097, 0x29e0, 0x00000000);
1349 nv_mthd(priv, 0xa097, 0x29e4, 0x00000000);
1350 nv_mthd(priv, 0xa097, 0x29e8, 0x00000000);
1351 nv_mthd(priv, 0xa097, 0x29ec, 0x00000000);
1352 nv_mthd(priv, 0xa097, 0x29f0, 0x00000000);
1353 nv_mthd(priv, 0xa097, 0x29f4, 0x00000000);
1354 nv_mthd(priv, 0xa097, 0x29f8, 0x00000000);
1355 nv_mthd(priv, 0xa097, 0x29fc, 0x00000000);
1356 nv_mthd(priv, 0xa097, 0x0a00, 0x00000000);
1357 nv_mthd(priv, 0xa097, 0x0a20, 0x00000000);
1358 nv_mthd(priv, 0xa097, 0x0a40, 0x00000000);
1359 nv_mthd(priv, 0xa097, 0x0a60, 0x00000000);
1360 nv_mthd(priv, 0xa097, 0x0a80, 0x00000000);
1361 nv_mthd(priv, 0xa097, 0x0aa0, 0x00000000);
1362 nv_mthd(priv, 0xa097, 0x0ac0, 0x00000000);
1363 nv_mthd(priv, 0xa097, 0x0ae0, 0x00000000);
1364 nv_mthd(priv, 0xa097, 0x0b00, 0x00000000);
1365 nv_mthd(priv, 0xa097, 0x0b20, 0x00000000);
1366 nv_mthd(priv, 0xa097, 0x0b40, 0x00000000);
1367 nv_mthd(priv, 0xa097, 0x0b60, 0x00000000);
1368 nv_mthd(priv, 0xa097, 0x0b80, 0x00000000);
1369 nv_mthd(priv, 0xa097, 0x0ba0, 0x00000000);
1370 nv_mthd(priv, 0xa097, 0x0bc0, 0x00000000);
1371 nv_mthd(priv, 0xa097, 0x0be0, 0x00000000);
1372 nv_mthd(priv, 0xa097, 0x0a04, 0x00000000);
1373 nv_mthd(priv, 0xa097, 0x0a24, 0x00000000);
1374 nv_mthd(priv, 0xa097, 0x0a44, 0x00000000);
1375 nv_mthd(priv, 0xa097, 0x0a64, 0x00000000);
1376 nv_mthd(priv, 0xa097, 0x0a84, 0x00000000);
1377 nv_mthd(priv, 0xa097, 0x0aa4, 0x00000000);
1378 nv_mthd(priv, 0xa097, 0x0ac4, 0x00000000);
1379 nv_mthd(priv, 0xa097, 0x0ae4, 0x00000000);
1380 nv_mthd(priv, 0xa097, 0x0b04, 0x00000000);
1381 nv_mthd(priv, 0xa097, 0x0b24, 0x00000000);
1382 nv_mthd(priv, 0xa097, 0x0b44, 0x00000000);
1383 nv_mthd(priv, 0xa097, 0x0b64, 0x00000000);
1384 nv_mthd(priv, 0xa097, 0x0b84, 0x00000000);
1385 nv_mthd(priv, 0xa097, 0x0ba4, 0x00000000);
1386 nv_mthd(priv, 0xa097, 0x0bc4, 0x00000000);
1387 nv_mthd(priv, 0xa097, 0x0be4, 0x00000000);
1388 nv_mthd(priv, 0xa097, 0x0a08, 0x00000000);
1389 nv_mthd(priv, 0xa097, 0x0a28, 0x00000000);
1390 nv_mthd(priv, 0xa097, 0x0a48, 0x00000000);
1391 nv_mthd(priv, 0xa097, 0x0a68, 0x00000000);
1392 nv_mthd(priv, 0xa097, 0x0a88, 0x00000000);
1393 nv_mthd(priv, 0xa097, 0x0aa8, 0x00000000);
1394 nv_mthd(priv, 0xa097, 0x0ac8, 0x00000000);
1395 nv_mthd(priv, 0xa097, 0x0ae8, 0x00000000);
1396 nv_mthd(priv, 0xa097, 0x0b08, 0x00000000);
1397 nv_mthd(priv, 0xa097, 0x0b28, 0x00000000);
1398 nv_mthd(priv, 0xa097, 0x0b48, 0x00000000);
1399 nv_mthd(priv, 0xa097, 0x0b68, 0x00000000);
1400 nv_mthd(priv, 0xa097, 0x0b88, 0x00000000);
1401 nv_mthd(priv, 0xa097, 0x0ba8, 0x00000000);
1402 nv_mthd(priv, 0xa097, 0x0bc8, 0x00000000);
1403 nv_mthd(priv, 0xa097, 0x0be8, 0x00000000);
1404 nv_mthd(priv, 0xa097, 0x0a0c, 0x00000000);
1405 nv_mthd(priv, 0xa097, 0x0a2c, 0x00000000);
1406 nv_mthd(priv, 0xa097, 0x0a4c, 0x00000000);
1407 nv_mthd(priv, 0xa097, 0x0a6c, 0x00000000);
1408 nv_mthd(priv, 0xa097, 0x0a8c, 0x00000000);
1409 nv_mthd(priv, 0xa097, 0x0aac, 0x00000000);
1410 nv_mthd(priv, 0xa097, 0x0acc, 0x00000000);
1411 nv_mthd(priv, 0xa097, 0x0aec, 0x00000000);
1412 nv_mthd(priv, 0xa097, 0x0b0c, 0x00000000);
1413 nv_mthd(priv, 0xa097, 0x0b2c, 0x00000000);
1414 nv_mthd(priv, 0xa097, 0x0b4c, 0x00000000);
1415 nv_mthd(priv, 0xa097, 0x0b6c, 0x00000000);
1416 nv_mthd(priv, 0xa097, 0x0b8c, 0x00000000);
1417 nv_mthd(priv, 0xa097, 0x0bac, 0x00000000);
1418 nv_mthd(priv, 0xa097, 0x0bcc, 0x00000000);
1419 nv_mthd(priv, 0xa097, 0x0bec, 0x00000000);
1420 nv_mthd(priv, 0xa097, 0x0a10, 0x00000000);
1421 nv_mthd(priv, 0xa097, 0x0a30, 0x00000000);
1422 nv_mthd(priv, 0xa097, 0x0a50, 0x00000000);
1423 nv_mthd(priv, 0xa097, 0x0a70, 0x00000000);
1424 nv_mthd(priv, 0xa097, 0x0a90, 0x00000000);
1425 nv_mthd(priv, 0xa097, 0x0ab0, 0x00000000);
1426 nv_mthd(priv, 0xa097, 0x0ad0, 0x00000000);
1427 nv_mthd(priv, 0xa097, 0x0af0, 0x00000000);
1428 nv_mthd(priv, 0xa097, 0x0b10, 0x00000000);
1429 nv_mthd(priv, 0xa097, 0x0b30, 0x00000000);
1430 nv_mthd(priv, 0xa097, 0x0b50, 0x00000000);
1431 nv_mthd(priv, 0xa097, 0x0b70, 0x00000000);
1432 nv_mthd(priv, 0xa097, 0x0b90, 0x00000000);
1433 nv_mthd(priv, 0xa097, 0x0bb0, 0x00000000);
1434 nv_mthd(priv, 0xa097, 0x0bd0, 0x00000000);
1435 nv_mthd(priv, 0xa097, 0x0bf0, 0x00000000);
1436 nv_mthd(priv, 0xa097, 0x0a14, 0x00000000);
1437 nv_mthd(priv, 0xa097, 0x0a34, 0x00000000);
1438 nv_mthd(priv, 0xa097, 0x0a54, 0x00000000);
1439 nv_mthd(priv, 0xa097, 0x0a74, 0x00000000);
1440 nv_mthd(priv, 0xa097, 0x0a94, 0x00000000);
1441 nv_mthd(priv, 0xa097, 0x0ab4, 0x00000000);
1442 nv_mthd(priv, 0xa097, 0x0ad4, 0x00000000);
1443 nv_mthd(priv, 0xa097, 0x0af4, 0x00000000);
1444 nv_mthd(priv, 0xa097, 0x0b14, 0x00000000);
1445 nv_mthd(priv, 0xa097, 0x0b34, 0x00000000);
1446 nv_mthd(priv, 0xa097, 0x0b54, 0x00000000);
1447 nv_mthd(priv, 0xa097, 0x0b74, 0x00000000);
1448 nv_mthd(priv, 0xa097, 0x0b94, 0x00000000);
1449 nv_mthd(priv, 0xa097, 0x0bb4, 0x00000000);
1450 nv_mthd(priv, 0xa097, 0x0bd4, 0x00000000);
1451 nv_mthd(priv, 0xa097, 0x0bf4, 0x00000000);
1452 nv_mthd(priv, 0xa097, 0x0c00, 0x00000000);
1453 nv_mthd(priv, 0xa097, 0x0c10, 0x00000000);
1454 nv_mthd(priv, 0xa097, 0x0c20, 0x00000000);
1455 nv_mthd(priv, 0xa097, 0x0c30, 0x00000000);
1456 nv_mthd(priv, 0xa097, 0x0c40, 0x00000000);
1457 nv_mthd(priv, 0xa097, 0x0c50, 0x00000000);
1458 nv_mthd(priv, 0xa097, 0x0c60, 0x00000000);
1459 nv_mthd(priv, 0xa097, 0x0c70, 0x00000000);
1460 nv_mthd(priv, 0xa097, 0x0c80, 0x00000000);
1461 nv_mthd(priv, 0xa097, 0x0c90, 0x00000000);
1462 nv_mthd(priv, 0xa097, 0x0ca0, 0x00000000);
1463 nv_mthd(priv, 0xa097, 0x0cb0, 0x00000000);
1464 nv_mthd(priv, 0xa097, 0x0cc0, 0x00000000);
1465 nv_mthd(priv, 0xa097, 0x0cd0, 0x00000000);
1466 nv_mthd(priv, 0xa097, 0x0ce0, 0x00000000);
1467 nv_mthd(priv, 0xa097, 0x0cf0, 0x00000000);
1468 nv_mthd(priv, 0xa097, 0x0c04, 0x00000000);
1469 nv_mthd(priv, 0xa097, 0x0c14, 0x00000000);
1470 nv_mthd(priv, 0xa097, 0x0c24, 0x00000000);
1471 nv_mthd(priv, 0xa097, 0x0c34, 0x00000000);
1472 nv_mthd(priv, 0xa097, 0x0c44, 0x00000000);
1473 nv_mthd(priv, 0xa097, 0x0c54, 0x00000000);
1474 nv_mthd(priv, 0xa097, 0x0c64, 0x00000000);
1475 nv_mthd(priv, 0xa097, 0x0c74, 0x00000000);
1476 nv_mthd(priv, 0xa097, 0x0c84, 0x00000000);
1477 nv_mthd(priv, 0xa097, 0x0c94, 0x00000000);
1478 nv_mthd(priv, 0xa097, 0x0ca4, 0x00000000);
1479 nv_mthd(priv, 0xa097, 0x0cb4, 0x00000000);
1480 nv_mthd(priv, 0xa097, 0x0cc4, 0x00000000);
1481 nv_mthd(priv, 0xa097, 0x0cd4, 0x00000000);
1482 nv_mthd(priv, 0xa097, 0x0ce4, 0x00000000);
1483 nv_mthd(priv, 0xa097, 0x0cf4, 0x00000000);
1484 nv_mthd(priv, 0xa097, 0x0c08, 0x00000000);
1485 nv_mthd(priv, 0xa097, 0x0c18, 0x00000000);
1486 nv_mthd(priv, 0xa097, 0x0c28, 0x00000000);
1487 nv_mthd(priv, 0xa097, 0x0c38, 0x00000000);
1488 nv_mthd(priv, 0xa097, 0x0c48, 0x00000000);
1489 nv_mthd(priv, 0xa097, 0x0c58, 0x00000000);
1490 nv_mthd(priv, 0xa097, 0x0c68, 0x00000000);
1491 nv_mthd(priv, 0xa097, 0x0c78, 0x00000000);
1492 nv_mthd(priv, 0xa097, 0x0c88, 0x00000000);
1493 nv_mthd(priv, 0xa097, 0x0c98, 0x00000000);
1494 nv_mthd(priv, 0xa097, 0x0ca8, 0x00000000);
1495 nv_mthd(priv, 0xa097, 0x0cb8, 0x00000000);
1496 nv_mthd(priv, 0xa097, 0x0cc8, 0x00000000);
1497 nv_mthd(priv, 0xa097, 0x0cd8, 0x00000000);
1498 nv_mthd(priv, 0xa097, 0x0ce8, 0x00000000);
1499 nv_mthd(priv, 0xa097, 0x0cf8, 0x00000000);
1500 nv_mthd(priv, 0xa097, 0x0c0c, 0x3f800000);
1501 nv_mthd(priv, 0xa097, 0x0c1c, 0x3f800000);
1502 nv_mthd(priv, 0xa097, 0x0c2c, 0x3f800000);
1503 nv_mthd(priv, 0xa097, 0x0c3c, 0x3f800000);
1504 nv_mthd(priv, 0xa097, 0x0c4c, 0x3f800000);
1505 nv_mthd(priv, 0xa097, 0x0c5c, 0x3f800000);
1506 nv_mthd(priv, 0xa097, 0x0c6c, 0x3f800000);
1507 nv_mthd(priv, 0xa097, 0x0c7c, 0x3f800000);
1508 nv_mthd(priv, 0xa097, 0x0c8c, 0x3f800000);
1509 nv_mthd(priv, 0xa097, 0x0c9c, 0x3f800000);
1510 nv_mthd(priv, 0xa097, 0x0cac, 0x3f800000);
1511 nv_mthd(priv, 0xa097, 0x0cbc, 0x3f800000);
1512 nv_mthd(priv, 0xa097, 0x0ccc, 0x3f800000);
1513 nv_mthd(priv, 0xa097, 0x0cdc, 0x3f800000);
1514 nv_mthd(priv, 0xa097, 0x0cec, 0x3f800000);
1515 nv_mthd(priv, 0xa097, 0x0cfc, 0x3f800000);
1516 nv_mthd(priv, 0xa097, 0x0d00, 0xffff0000);
1517 nv_mthd(priv, 0xa097, 0x0d08, 0xffff0000);
1518 nv_mthd(priv, 0xa097, 0x0d10, 0xffff0000);
1519 nv_mthd(priv, 0xa097, 0x0d18, 0xffff0000);
1520 nv_mthd(priv, 0xa097, 0x0d20, 0xffff0000);
1521 nv_mthd(priv, 0xa097, 0x0d28, 0xffff0000);
1522 nv_mthd(priv, 0xa097, 0x0d30, 0xffff0000);
1523 nv_mthd(priv, 0xa097, 0x0d38, 0xffff0000);
1524 nv_mthd(priv, 0xa097, 0x0d04, 0xffff0000);
1525 nv_mthd(priv, 0xa097, 0x0d0c, 0xffff0000);
1526 nv_mthd(priv, 0xa097, 0x0d14, 0xffff0000);
1527 nv_mthd(priv, 0xa097, 0x0d1c, 0xffff0000);
1528 nv_mthd(priv, 0xa097, 0x0d24, 0xffff0000);
1529 nv_mthd(priv, 0xa097, 0x0d2c, 0xffff0000);
1530 nv_mthd(priv, 0xa097, 0x0d34, 0xffff0000);
1531 nv_mthd(priv, 0xa097, 0x0d3c, 0xffff0000);
1532 nv_mthd(priv, 0xa097, 0x0e00, 0x00000000);
1533 nv_mthd(priv, 0xa097, 0x0e10, 0x00000000);
1534 nv_mthd(priv, 0xa097, 0x0e20, 0x00000000);
1535 nv_mthd(priv, 0xa097, 0x0e30, 0x00000000);
1536 nv_mthd(priv, 0xa097, 0x0e40, 0x00000000);
1537 nv_mthd(priv, 0xa097, 0x0e50, 0x00000000);
1538 nv_mthd(priv, 0xa097, 0x0e60, 0x00000000);
1539 nv_mthd(priv, 0xa097, 0x0e70, 0x00000000);
1540 nv_mthd(priv, 0xa097, 0x0e80, 0x00000000);
1541 nv_mthd(priv, 0xa097, 0x0e90, 0x00000000);
1542 nv_mthd(priv, 0xa097, 0x0ea0, 0x00000000);
1543 nv_mthd(priv, 0xa097, 0x0eb0, 0x00000000);
1544 nv_mthd(priv, 0xa097, 0x0ec0, 0x00000000);
1545 nv_mthd(priv, 0xa097, 0x0ed0, 0x00000000);
1546 nv_mthd(priv, 0xa097, 0x0ee0, 0x00000000);
1547 nv_mthd(priv, 0xa097, 0x0ef0, 0x00000000);
1548 nv_mthd(priv, 0xa097, 0x0e04, 0xffff0000);
1549 nv_mthd(priv, 0xa097, 0x0e14, 0xffff0000);
1550 nv_mthd(priv, 0xa097, 0x0e24, 0xffff0000);
1551 nv_mthd(priv, 0xa097, 0x0e34, 0xffff0000);
1552 nv_mthd(priv, 0xa097, 0x0e44, 0xffff0000);
1553 nv_mthd(priv, 0xa097, 0x0e54, 0xffff0000);
1554 nv_mthd(priv, 0xa097, 0x0e64, 0xffff0000);
1555 nv_mthd(priv, 0xa097, 0x0e74, 0xffff0000);
1556 nv_mthd(priv, 0xa097, 0x0e84, 0xffff0000);
1557 nv_mthd(priv, 0xa097, 0x0e94, 0xffff0000);
1558 nv_mthd(priv, 0xa097, 0x0ea4, 0xffff0000);
1559 nv_mthd(priv, 0xa097, 0x0eb4, 0xffff0000);
1560 nv_mthd(priv, 0xa097, 0x0ec4, 0xffff0000);
1561 nv_mthd(priv, 0xa097, 0x0ed4, 0xffff0000);
1562 nv_mthd(priv, 0xa097, 0x0ee4, 0xffff0000);
1563 nv_mthd(priv, 0xa097, 0x0ef4, 0xffff0000);
1564 nv_mthd(priv, 0xa097, 0x0e08, 0xffff0000);
1565 nv_mthd(priv, 0xa097, 0x0e18, 0xffff0000);
1566 nv_mthd(priv, 0xa097, 0x0e28, 0xffff0000);
1567 nv_mthd(priv, 0xa097, 0x0e38, 0xffff0000);
1568 nv_mthd(priv, 0xa097, 0x0e48, 0xffff0000);
1569 nv_mthd(priv, 0xa097, 0x0e58, 0xffff0000);
1570 nv_mthd(priv, 0xa097, 0x0e68, 0xffff0000);
1571 nv_mthd(priv, 0xa097, 0x0e78, 0xffff0000);
1572 nv_mthd(priv, 0xa097, 0x0e88, 0xffff0000);
1573 nv_mthd(priv, 0xa097, 0x0e98, 0xffff0000);
1574 nv_mthd(priv, 0xa097, 0x0ea8, 0xffff0000);
1575 nv_mthd(priv, 0xa097, 0x0eb8, 0xffff0000);
1576 nv_mthd(priv, 0xa097, 0x0ec8, 0xffff0000);
1577 nv_mthd(priv, 0xa097, 0x0ed8, 0xffff0000);
1578 nv_mthd(priv, 0xa097, 0x0ee8, 0xffff0000);
1579 nv_mthd(priv, 0xa097, 0x0ef8, 0xffff0000);
1580 nv_mthd(priv, 0xa097, 0x0d40, 0x00000000);
1581 nv_mthd(priv, 0xa097, 0x0d48, 0x00000000);
1582 nv_mthd(priv, 0xa097, 0x0d50, 0x00000000);
1583 nv_mthd(priv, 0xa097, 0x0d58, 0x00000000);
1584 nv_mthd(priv, 0xa097, 0x0d44, 0x00000000);
1585 nv_mthd(priv, 0xa097, 0x0d4c, 0x00000000);
1586 nv_mthd(priv, 0xa097, 0x0d54, 0x00000000);
1587 nv_mthd(priv, 0xa097, 0x0d5c, 0x00000000);
1588 nv_mthd(priv, 0xa097, 0x1e00, 0x00000001);
1589 nv_mthd(priv, 0xa097, 0x1e20, 0x00000001);
1590 nv_mthd(priv, 0xa097, 0x1e40, 0x00000001);
1591 nv_mthd(priv, 0xa097, 0x1e60, 0x00000001);
1592 nv_mthd(priv, 0xa097, 0x1e80, 0x00000001);
1593 nv_mthd(priv, 0xa097, 0x1ea0, 0x00000001);
1594 nv_mthd(priv, 0xa097, 0x1ec0, 0x00000001);
1595 nv_mthd(priv, 0xa097, 0x1ee0, 0x00000001);
1596 nv_mthd(priv, 0xa097, 0x1e04, 0x00000001);
1597 nv_mthd(priv, 0xa097, 0x1e24, 0x00000001);
1598 nv_mthd(priv, 0xa097, 0x1e44, 0x00000001);
1599 nv_mthd(priv, 0xa097, 0x1e64, 0x00000001);
1600 nv_mthd(priv, 0xa097, 0x1e84, 0x00000001);
1601 nv_mthd(priv, 0xa097, 0x1ea4, 0x00000001);
1602 nv_mthd(priv, 0xa097, 0x1ec4, 0x00000001);
1603 nv_mthd(priv, 0xa097, 0x1ee4, 0x00000001);
1604 nv_mthd(priv, 0xa097, 0x1e08, 0x00000002);
1605 nv_mthd(priv, 0xa097, 0x1e28, 0x00000002);
1606 nv_mthd(priv, 0xa097, 0x1e48, 0x00000002);
1607 nv_mthd(priv, 0xa097, 0x1e68, 0x00000002);
1608 nv_mthd(priv, 0xa097, 0x1e88, 0x00000002);
1609 nv_mthd(priv, 0xa097, 0x1ea8, 0x00000002);
1610 nv_mthd(priv, 0xa097, 0x1ec8, 0x00000002);
1611 nv_mthd(priv, 0xa097, 0x1ee8, 0x00000002);
1612 nv_mthd(priv, 0xa097, 0x1e0c, 0x00000001);
1613 nv_mthd(priv, 0xa097, 0x1e2c, 0x00000001);
1614 nv_mthd(priv, 0xa097, 0x1e4c, 0x00000001);
1615 nv_mthd(priv, 0xa097, 0x1e6c, 0x00000001);
1616 nv_mthd(priv, 0xa097, 0x1e8c, 0x00000001);
1617 nv_mthd(priv, 0xa097, 0x1eac, 0x00000001);
1618 nv_mthd(priv, 0xa097, 0x1ecc, 0x00000001);
1619 nv_mthd(priv, 0xa097, 0x1eec, 0x00000001);
1620 nv_mthd(priv, 0xa097, 0x1e10, 0x00000001);
1621 nv_mthd(priv, 0xa097, 0x1e30, 0x00000001);
1622 nv_mthd(priv, 0xa097, 0x1e50, 0x00000001);
1623 nv_mthd(priv, 0xa097, 0x1e70, 0x00000001);
1624 nv_mthd(priv, 0xa097, 0x1e90, 0x00000001);
1625 nv_mthd(priv, 0xa097, 0x1eb0, 0x00000001);
1626 nv_mthd(priv, 0xa097, 0x1ed0, 0x00000001);
1627 nv_mthd(priv, 0xa097, 0x1ef0, 0x00000001);
1628 nv_mthd(priv, 0xa097, 0x1e14, 0x00000002);
1629 nv_mthd(priv, 0xa097, 0x1e34, 0x00000002);
1630 nv_mthd(priv, 0xa097, 0x1e54, 0x00000002);
1631 nv_mthd(priv, 0xa097, 0x1e74, 0x00000002);
1632 nv_mthd(priv, 0xa097, 0x1e94, 0x00000002);
1633 nv_mthd(priv, 0xa097, 0x1eb4, 0x00000002);
1634 nv_mthd(priv, 0xa097, 0x1ed4, 0x00000002);
1635 nv_mthd(priv, 0xa097, 0x1ef4, 0x00000002);
1636 nv_mthd(priv, 0xa097, 0x1e18, 0x00000001);
1637 nv_mthd(priv, 0xa097, 0x1e38, 0x00000001);
1638 nv_mthd(priv, 0xa097, 0x1e58, 0x00000001);
1639 nv_mthd(priv, 0xa097, 0x1e78, 0x00000001);
1640 nv_mthd(priv, 0xa097, 0x1e98, 0x00000001);
1641 nv_mthd(priv, 0xa097, 0x1eb8, 0x00000001);
1642 nv_mthd(priv, 0xa097, 0x1ed8, 0x00000001);
1643 nv_mthd(priv, 0xa097, 0x1ef8, 0x00000001);
1644 nv_mthd(priv, 0xa097, 0x3400, 0x00000000);
1645 nv_mthd(priv, 0xa097, 0x3404, 0x00000000);
1646 nv_mthd(priv, 0xa097, 0x3408, 0x00000000);
1647 nv_mthd(priv, 0xa097, 0x340c, 0x00000000);
1648 nv_mthd(priv, 0xa097, 0x3410, 0x00000000);
1649 nv_mthd(priv, 0xa097, 0x3414, 0x00000000);
1650 nv_mthd(priv, 0xa097, 0x3418, 0x00000000);
1651 nv_mthd(priv, 0xa097, 0x341c, 0x00000000);
1652 nv_mthd(priv, 0xa097, 0x3420, 0x00000000);
1653 nv_mthd(priv, 0xa097, 0x3424, 0x00000000);
1654 nv_mthd(priv, 0xa097, 0x3428, 0x00000000);
1655 nv_mthd(priv, 0xa097, 0x342c, 0x00000000);
1656 nv_mthd(priv, 0xa097, 0x3430, 0x00000000);
1657 nv_mthd(priv, 0xa097, 0x3434, 0x00000000);
1658 nv_mthd(priv, 0xa097, 0x3438, 0x00000000);
1659 nv_mthd(priv, 0xa097, 0x343c, 0x00000000);
1660 nv_mthd(priv, 0xa097, 0x3440, 0x00000000);
1661 nv_mthd(priv, 0xa097, 0x3444, 0x00000000);
1662 nv_mthd(priv, 0xa097, 0x3448, 0x00000000);
1663 nv_mthd(priv, 0xa097, 0x344c, 0x00000000);
1664 nv_mthd(priv, 0xa097, 0x3450, 0x00000000);
1665 nv_mthd(priv, 0xa097, 0x3454, 0x00000000);
1666 nv_mthd(priv, 0xa097, 0x3458, 0x00000000);
1667 nv_mthd(priv, 0xa097, 0x345c, 0x00000000);
1668 nv_mthd(priv, 0xa097, 0x3460, 0x00000000);
1669 nv_mthd(priv, 0xa097, 0x3464, 0x00000000);
1670 nv_mthd(priv, 0xa097, 0x3468, 0x00000000);
1671 nv_mthd(priv, 0xa097, 0x346c, 0x00000000);
1672 nv_mthd(priv, 0xa097, 0x3470, 0x00000000);
1673 nv_mthd(priv, 0xa097, 0x3474, 0x00000000);
1674 nv_mthd(priv, 0xa097, 0x3478, 0x00000000);
1675 nv_mthd(priv, 0xa097, 0x347c, 0x00000000);
1676 nv_mthd(priv, 0xa097, 0x3480, 0x00000000);
1677 nv_mthd(priv, 0xa097, 0x3484, 0x00000000);
1678 nv_mthd(priv, 0xa097, 0x3488, 0x00000000);
1679 nv_mthd(priv, 0xa097, 0x348c, 0x00000000);
1680 nv_mthd(priv, 0xa097, 0x3490, 0x00000000);
1681 nv_mthd(priv, 0xa097, 0x3494, 0x00000000);
1682 nv_mthd(priv, 0xa097, 0x3498, 0x00000000);
1683 nv_mthd(priv, 0xa097, 0x349c, 0x00000000);
1684 nv_mthd(priv, 0xa097, 0x34a0, 0x00000000);
1685 nv_mthd(priv, 0xa097, 0x34a4, 0x00000000);
1686 nv_mthd(priv, 0xa097, 0x34a8, 0x00000000);
1687 nv_mthd(priv, 0xa097, 0x34ac, 0x00000000);
1688 nv_mthd(priv, 0xa097, 0x34b0, 0x00000000);
1689 nv_mthd(priv, 0xa097, 0x34b4, 0x00000000);
1690 nv_mthd(priv, 0xa097, 0x34b8, 0x00000000);
1691 nv_mthd(priv, 0xa097, 0x34bc, 0x00000000);
1692 nv_mthd(priv, 0xa097, 0x34c0, 0x00000000);
1693 nv_mthd(priv, 0xa097, 0x34c4, 0x00000000);
1694 nv_mthd(priv, 0xa097, 0x34c8, 0x00000000);
1695 nv_mthd(priv, 0xa097, 0x34cc, 0x00000000);
1696 nv_mthd(priv, 0xa097, 0x34d0, 0x00000000);
1697 nv_mthd(priv, 0xa097, 0x34d4, 0x00000000);
1698 nv_mthd(priv, 0xa097, 0x34d8, 0x00000000);
1699 nv_mthd(priv, 0xa097, 0x34dc, 0x00000000);
1700 nv_mthd(priv, 0xa097, 0x34e0, 0x00000000);
1701 nv_mthd(priv, 0xa097, 0x34e4, 0x00000000);
1702 nv_mthd(priv, 0xa097, 0x34e8, 0x00000000);
1703 nv_mthd(priv, 0xa097, 0x34ec, 0x00000000);
1704 nv_mthd(priv, 0xa097, 0x34f0, 0x00000000);
1705 nv_mthd(priv, 0xa097, 0x34f4, 0x00000000);
1706 nv_mthd(priv, 0xa097, 0x34f8, 0x00000000);
1707 nv_mthd(priv, 0xa097, 0x34fc, 0x00000000);
1708 nv_mthd(priv, 0xa097, 0x3500, 0x00000000);
1709 nv_mthd(priv, 0xa097, 0x3504, 0x00000000);
1710 nv_mthd(priv, 0xa097, 0x3508, 0x00000000);
1711 nv_mthd(priv, 0xa097, 0x350c, 0x00000000);
1712 nv_mthd(priv, 0xa097, 0x3510, 0x00000000);
1713 nv_mthd(priv, 0xa097, 0x3514, 0x00000000);
1714 nv_mthd(priv, 0xa097, 0x3518, 0x00000000);
1715 nv_mthd(priv, 0xa097, 0x351c, 0x00000000);
1716 nv_mthd(priv, 0xa097, 0x3520, 0x00000000);
1717 nv_mthd(priv, 0xa097, 0x3524, 0x00000000);
1718 nv_mthd(priv, 0xa097, 0x3528, 0x00000000);
1719 nv_mthd(priv, 0xa097, 0x352c, 0x00000000);
1720 nv_mthd(priv, 0xa097, 0x3530, 0x00000000);
1721 nv_mthd(priv, 0xa097, 0x3534, 0x00000000);
1722 nv_mthd(priv, 0xa097, 0x3538, 0x00000000);
1723 nv_mthd(priv, 0xa097, 0x353c, 0x00000000);
1724 nv_mthd(priv, 0xa097, 0x3540, 0x00000000);
1725 nv_mthd(priv, 0xa097, 0x3544, 0x00000000);
1726 nv_mthd(priv, 0xa097, 0x3548, 0x00000000);
1727 nv_mthd(priv, 0xa097, 0x354c, 0x00000000);
1728 nv_mthd(priv, 0xa097, 0x3550, 0x00000000);
1729 nv_mthd(priv, 0xa097, 0x3554, 0x00000000);
1730 nv_mthd(priv, 0xa097, 0x3558, 0x00000000);
1731 nv_mthd(priv, 0xa097, 0x355c, 0x00000000);
1732 nv_mthd(priv, 0xa097, 0x3560, 0x00000000);
1733 nv_mthd(priv, 0xa097, 0x3564, 0x00000000);
1734 nv_mthd(priv, 0xa097, 0x3568, 0x00000000);
1735 nv_mthd(priv, 0xa097, 0x356c, 0x00000000);
1736 nv_mthd(priv, 0xa097, 0x3570, 0x00000000);
1737 nv_mthd(priv, 0xa097, 0x3574, 0x00000000);
1738 nv_mthd(priv, 0xa097, 0x3578, 0x00000000);
1739 nv_mthd(priv, 0xa097, 0x357c, 0x00000000);
1740 nv_mthd(priv, 0xa097, 0x3580, 0x00000000);
1741 nv_mthd(priv, 0xa097, 0x3584, 0x00000000);
1742 nv_mthd(priv, 0xa097, 0x3588, 0x00000000);
1743 nv_mthd(priv, 0xa097, 0x358c, 0x00000000);
1744 nv_mthd(priv, 0xa097, 0x3590, 0x00000000);
1745 nv_mthd(priv, 0xa097, 0x3594, 0x00000000);
1746 nv_mthd(priv, 0xa097, 0x3598, 0x00000000);
1747 nv_mthd(priv, 0xa097, 0x359c, 0x00000000);
1748 nv_mthd(priv, 0xa097, 0x35a0, 0x00000000);
1749 nv_mthd(priv, 0xa097, 0x35a4, 0x00000000);
1750 nv_mthd(priv, 0xa097, 0x35a8, 0x00000000);
1751 nv_mthd(priv, 0xa097, 0x35ac, 0x00000000);
1752 nv_mthd(priv, 0xa097, 0x35b0, 0x00000000);
1753 nv_mthd(priv, 0xa097, 0x35b4, 0x00000000);
1754 nv_mthd(priv, 0xa097, 0x35b8, 0x00000000);
1755 nv_mthd(priv, 0xa097, 0x35bc, 0x00000000);
1756 nv_mthd(priv, 0xa097, 0x35c0, 0x00000000);
1757 nv_mthd(priv, 0xa097, 0x35c4, 0x00000000);
1758 nv_mthd(priv, 0xa097, 0x35c8, 0x00000000);
1759 nv_mthd(priv, 0xa097, 0x35cc, 0x00000000);
1760 nv_mthd(priv, 0xa097, 0x35d0, 0x00000000);
1761 nv_mthd(priv, 0xa097, 0x35d4, 0x00000000);
1762 nv_mthd(priv, 0xa097, 0x35d8, 0x00000000);
1763 nv_mthd(priv, 0xa097, 0x35dc, 0x00000000);
1764 nv_mthd(priv, 0xa097, 0x35e0, 0x00000000);
1765 nv_mthd(priv, 0xa097, 0x35e4, 0x00000000);
1766 nv_mthd(priv, 0xa097, 0x35e8, 0x00000000);
1767 nv_mthd(priv, 0xa097, 0x35ec, 0x00000000);
1768 nv_mthd(priv, 0xa097, 0x35f0, 0x00000000);
1769 nv_mthd(priv, 0xa097, 0x35f4, 0x00000000);
1770 nv_mthd(priv, 0xa097, 0x35f8, 0x00000000);
1771 nv_mthd(priv, 0xa097, 0x35fc, 0x00000000);
1772 nv_mthd(priv, 0xa097, 0x030c, 0x00000001);
1773 nv_mthd(priv, 0xa097, 0x1944, 0x00000000);
1774 nv_mthd(priv, 0xa097, 0x1514, 0x00000000);
1775 nv_mthd(priv, 0xa097, 0x0d68, 0x0000ffff);
1776 nv_mthd(priv, 0xa097, 0x121c, 0x0fac6881);
1777 nv_mthd(priv, 0xa097, 0x0fac, 0x00000001);
1778 nv_mthd(priv, 0xa097, 0x1538, 0x00000001);
1779 nv_mthd(priv, 0xa097, 0x0fe0, 0x00000000);
1780 nv_mthd(priv, 0xa097, 0x0fe4, 0x00000000);
1781 nv_mthd(priv, 0xa097, 0x0fe8, 0x00000014);
1782 nv_mthd(priv, 0xa097, 0x0fec, 0x00000040);
1783 nv_mthd(priv, 0xa097, 0x0ff0, 0x00000000);
1784 nv_mthd(priv, 0xa097, 0x179c, 0x00000000);
1785 nv_mthd(priv, 0xa097, 0x1228, 0x00000400);
1786 nv_mthd(priv, 0xa097, 0x122c, 0x00000300);
1787 nv_mthd(priv, 0xa097, 0x1230, 0x00010001);
1788 nv_mthd(priv, 0xa097, 0x07f8, 0x00000000);
1789 nv_mthd(priv, 0xa097, 0x15b4, 0x00000001);
1790 nv_mthd(priv, 0xa097, 0x15cc, 0x00000000);
1791 nv_mthd(priv, 0xa097, 0x1534, 0x00000000);
1792 nv_mthd(priv, 0xa097, 0x0fb0, 0x00000000);
1793 nv_mthd(priv, 0xa097, 0x15d0, 0x00000000);
1794 nv_mthd(priv, 0xa097, 0x153c, 0x00000000);
1795 nv_mthd(priv, 0xa097, 0x16b4, 0x00000003);
1796 nv_mthd(priv, 0xa097, 0x0fbc, 0x0000ffff);
1797 nv_mthd(priv, 0xa097, 0x0fc0, 0x0000ffff);
1798 nv_mthd(priv, 0xa097, 0x0fc4, 0x0000ffff);
1799 nv_mthd(priv, 0xa097, 0x0fc8, 0x0000ffff);
1800 nv_mthd(priv, 0xa097, 0x0df8, 0x00000000);
1801 nv_mthd(priv, 0xa097, 0x0dfc, 0x00000000);
1802 nv_mthd(priv, 0xa097, 0x1948, 0x00000000);
1803 nv_mthd(priv, 0xa097, 0x1970, 0x00000001);
1804 nv_mthd(priv, 0xa097, 0x161c, 0x000009f0);
1805 nv_mthd(priv, 0xa097, 0x0dcc, 0x00000010);
1806 nv_mthd(priv, 0xa097, 0x163c, 0x00000000);
1807 nv_mthd(priv, 0xa097, 0x15e4, 0x00000000);
1808 nv_mthd(priv, 0xa097, 0x1160, 0x25e00040);
1809 nv_mthd(priv, 0xa097, 0x1164, 0x25e00040);
1810 nv_mthd(priv, 0xa097, 0x1168, 0x25e00040);
1811 nv_mthd(priv, 0xa097, 0x116c, 0x25e00040);
1812 nv_mthd(priv, 0xa097, 0x1170, 0x25e00040);
1813 nv_mthd(priv, 0xa097, 0x1174, 0x25e00040);
1814 nv_mthd(priv, 0xa097, 0x1178, 0x25e00040);
1815 nv_mthd(priv, 0xa097, 0x117c, 0x25e00040);
1816 nv_mthd(priv, 0xa097, 0x1180, 0x25e00040);
1817 nv_mthd(priv, 0xa097, 0x1184, 0x25e00040);
1818 nv_mthd(priv, 0xa097, 0x1188, 0x25e00040);
1819 nv_mthd(priv, 0xa097, 0x118c, 0x25e00040);
1820 nv_mthd(priv, 0xa097, 0x1190, 0x25e00040);
1821 nv_mthd(priv, 0xa097, 0x1194, 0x25e00040);
1822 nv_mthd(priv, 0xa097, 0x1198, 0x25e00040);
1823 nv_mthd(priv, 0xa097, 0x119c, 0x25e00040);
1824 nv_mthd(priv, 0xa097, 0x11a0, 0x25e00040);
1825 nv_mthd(priv, 0xa097, 0x11a4, 0x25e00040);
1826 nv_mthd(priv, 0xa097, 0x11a8, 0x25e00040);
1827 nv_mthd(priv, 0xa097, 0x11ac, 0x25e00040);
1828 nv_mthd(priv, 0xa097, 0x11b0, 0x25e00040);
1829 nv_mthd(priv, 0xa097, 0x11b4, 0x25e00040);
1830 nv_mthd(priv, 0xa097, 0x11b8, 0x25e00040);
1831 nv_mthd(priv, 0xa097, 0x11bc, 0x25e00040);
1832 nv_mthd(priv, 0xa097, 0x11c0, 0x25e00040);
1833 nv_mthd(priv, 0xa097, 0x11c4, 0x25e00040);
1834 nv_mthd(priv, 0xa097, 0x11c8, 0x25e00040);
1835 nv_mthd(priv, 0xa097, 0x11cc, 0x25e00040);
1836 nv_mthd(priv, 0xa097, 0x11d0, 0x25e00040);
1837 nv_mthd(priv, 0xa097, 0x11d4, 0x25e00040);
1838 nv_mthd(priv, 0xa097, 0x11d8, 0x25e00040);
1839 nv_mthd(priv, 0xa097, 0x11dc, 0x25e00040);
1840 nv_mthd(priv, 0xa097, 0x1880, 0x00000000);
1841 nv_mthd(priv, 0xa097, 0x1884, 0x00000000);
1842 nv_mthd(priv, 0xa097, 0x1888, 0x00000000);
1843 nv_mthd(priv, 0xa097, 0x188c, 0x00000000);
1844 nv_mthd(priv, 0xa097, 0x1890, 0x00000000);
1845 nv_mthd(priv, 0xa097, 0x1894, 0x00000000);
1846 nv_mthd(priv, 0xa097, 0x1898, 0x00000000);
1847 nv_mthd(priv, 0xa097, 0x189c, 0x00000000);
1848 nv_mthd(priv, 0xa097, 0x18a0, 0x00000000);
1849 nv_mthd(priv, 0xa097, 0x18a4, 0x00000000);
1850 nv_mthd(priv, 0xa097, 0x18a8, 0x00000000);
1851 nv_mthd(priv, 0xa097, 0x18ac, 0x00000000);
1852 nv_mthd(priv, 0xa097, 0x18b0, 0x00000000);
1853 nv_mthd(priv, 0xa097, 0x18b4, 0x00000000);
1854 nv_mthd(priv, 0xa097, 0x18b8, 0x00000000);
1855 nv_mthd(priv, 0xa097, 0x18bc, 0x00000000);
1856 nv_mthd(priv, 0xa097, 0x18c0, 0x00000000);
1857 nv_mthd(priv, 0xa097, 0x18c4, 0x00000000);
1858 nv_mthd(priv, 0xa097, 0x18c8, 0x00000000);
1859 nv_mthd(priv, 0xa097, 0x18cc, 0x00000000);
1860 nv_mthd(priv, 0xa097, 0x18d0, 0x00000000);
1861 nv_mthd(priv, 0xa097, 0x18d4, 0x00000000);
1862 nv_mthd(priv, 0xa097, 0x18d8, 0x00000000);
1863 nv_mthd(priv, 0xa097, 0x18dc, 0x00000000);
1864 nv_mthd(priv, 0xa097, 0x18e0, 0x00000000);
1865 nv_mthd(priv, 0xa097, 0x18e4, 0x00000000);
1866 nv_mthd(priv, 0xa097, 0x18e8, 0x00000000);
1867 nv_mthd(priv, 0xa097, 0x18ec, 0x00000000);
1868 nv_mthd(priv, 0xa097, 0x18f0, 0x00000000);
1869 nv_mthd(priv, 0xa097, 0x18f4, 0x00000000);
1870 nv_mthd(priv, 0xa097, 0x18f8, 0x00000000);
1871 nv_mthd(priv, 0xa097, 0x18fc, 0x00000000);
1872 nv_mthd(priv, 0xa097, 0x0f84, 0x00000000);
1873 nv_mthd(priv, 0xa097, 0x0f88, 0x00000000);
1874 nv_mthd(priv, 0xa097, 0x17c8, 0x00000000);
1875 nv_mthd(priv, 0xa097, 0x17cc, 0x00000000);
1876 nv_mthd(priv, 0xa097, 0x17d0, 0x000000ff);
1877 nv_mthd(priv, 0xa097, 0x17d4, 0xffffffff);
1878 nv_mthd(priv, 0xa097, 0x17d8, 0x00000002);
1879 nv_mthd(priv, 0xa097, 0x17dc, 0x00000000);
1880 nv_mthd(priv, 0xa097, 0x15f4, 0x00000000);
1881 nv_mthd(priv, 0xa097, 0x15f8, 0x00000000);
1882 nv_mthd(priv, 0xa097, 0x1434, 0x00000000);
1883 nv_mthd(priv, 0xa097, 0x1438, 0x00000000);
1884 nv_mthd(priv, 0xa097, 0x0d74, 0x00000000);
1885 nv_mthd(priv, 0xa097, 0x0dec, 0x00000001);
1886 nv_mthd(priv, 0xa097, 0x13a4, 0x00000000);
1887 nv_mthd(priv, 0xa097, 0x1318, 0x00000001);
1888 nv_mthd(priv, 0xa097, 0x1644, 0x00000000);
1889 nv_mthd(priv, 0xa097, 0x0748, 0x00000000);
1890 nv_mthd(priv, 0xa097, 0x0de8, 0x00000000);
1891 nv_mthd(priv, 0xa097, 0x1648, 0x00000000);
1892 nv_mthd(priv, 0xa097, 0x12a4, 0x00000000);
1893 nv_mthd(priv, 0xa097, 0x1120, 0x00000000);
1894 nv_mthd(priv, 0xa097, 0x1124, 0x00000000);
1895 nv_mthd(priv, 0xa097, 0x1128, 0x00000000);
1896 nv_mthd(priv, 0xa097, 0x112c, 0x00000000);
1897 nv_mthd(priv, 0xa097, 0x1118, 0x00000000);
1898 nv_mthd(priv, 0xa097, 0x164c, 0x00000000);
1899 nv_mthd(priv, 0xa097, 0x1658, 0x00000000);
1900 nv_mthd(priv, 0xa097, 0x1910, 0x00000290);
1901 nv_mthd(priv, 0xa097, 0x1518, 0x00000000);
1902 nv_mthd(priv, 0xa097, 0x165c, 0x00000001);
1903 nv_mthd(priv, 0xa097, 0x1520, 0x00000000);
1904 nv_mthd(priv, 0xa097, 0x1604, 0x00000000);
1905 nv_mthd(priv, 0xa097, 0x1570, 0x00000000);
1906 nv_mthd(priv, 0xa097, 0x13b0, 0x3f800000);
1907 nv_mthd(priv, 0xa097, 0x13b4, 0x3f800000);
1908 nv_mthd(priv, 0xa097, 0x020c, 0x00000000);
1909 nv_mthd(priv, 0xa097, 0x1670, 0x30201000);
1910 nv_mthd(priv, 0xa097, 0x1674, 0x70605040);
1911 nv_mthd(priv, 0xa097, 0x1678, 0xb8a89888);
1912 nv_mthd(priv, 0xa097, 0x167c, 0xf8e8d8c8);
1913 nv_mthd(priv, 0xa097, 0x166c, 0x00000000);
1914 nv_mthd(priv, 0xa097, 0x1680, 0x00ffff00);
1915 nv_mthd(priv, 0xa097, 0x12d0, 0x00000003);
1916 nv_mthd(priv, 0xa097, 0x12d4, 0x00000002);
1917 nv_mthd(priv, 0xa097, 0x1684, 0x00000000);
1918 nv_mthd(priv, 0xa097, 0x1688, 0x00000000);
1919 nv_mthd(priv, 0xa097, 0x0dac, 0x00001b02);
1920 nv_mthd(priv, 0xa097, 0x0db0, 0x00001b02);
1921 nv_mthd(priv, 0xa097, 0x0db4, 0x00000000);
1922 nv_mthd(priv, 0xa097, 0x168c, 0x00000000);
1923 nv_mthd(priv, 0xa097, 0x15bc, 0x00000000);
1924 nv_mthd(priv, 0xa097, 0x156c, 0x00000000);
1925 nv_mthd(priv, 0xa097, 0x187c, 0x00000000);
1926 nv_mthd(priv, 0xa097, 0x1110, 0x00000001);
1927 nv_mthd(priv, 0xa097, 0x0dc0, 0x00000000);
1928 nv_mthd(priv, 0xa097, 0x0dc4, 0x00000000);
1929 nv_mthd(priv, 0xa097, 0x0dc8, 0x00000000);
1930 nv_mthd(priv, 0xa097, 0x1234, 0x00000000);
1931 nv_mthd(priv, 0xa097, 0x1690, 0x00000000);
1932 nv_mthd(priv, 0xa097, 0x12ac, 0x00000001);
1933 nv_mthd(priv, 0xa097, 0x0790, 0x00000000);
1934 nv_mthd(priv, 0xa097, 0x0794, 0x00000000);
1935 nv_mthd(priv, 0xa097, 0x0798, 0x00000000);
1936 nv_mthd(priv, 0xa097, 0x079c, 0x00000000);
1937 nv_mthd(priv, 0xa097, 0x07a0, 0x00000000);
1938 nv_mthd(priv, 0xa097, 0x077c, 0x00000000);
1939 nv_mthd(priv, 0xa097, 0x1000, 0x00000010);
1940 nv_mthd(priv, 0xa097, 0x10fc, 0x00000000);
1941 nv_mthd(priv, 0xa097, 0x1290, 0x00000000);
1942 nv_mthd(priv, 0xa097, 0x0218, 0x00000010);
1943 nv_mthd(priv, 0xa097, 0x12d8, 0x00000000);
1944 nv_mthd(priv, 0xa097, 0x12dc, 0x00000010);
1945 nv_mthd(priv, 0xa097, 0x0d94, 0x00000001);
1946 nv_mthd(priv, 0xa097, 0x155c, 0x00000000);
1947 nv_mthd(priv, 0xa097, 0x1560, 0x00000000);
1948 nv_mthd(priv, 0xa097, 0x1564, 0x00000fff);
1949 nv_mthd(priv, 0xa097, 0x1574, 0x00000000);
1950 nv_mthd(priv, 0xa097, 0x1578, 0x00000000);
1951 nv_mthd(priv, 0xa097, 0x157c, 0x000fffff);
1952 nv_mthd(priv, 0xa097, 0x1354, 0x00000000);
1953 nv_mthd(priv, 0xa097, 0x1610, 0x00000012);
1954 nv_mthd(priv, 0xa097, 0x1608, 0x00000000);
1955 nv_mthd(priv, 0xa097, 0x160c, 0x00000000);
1956 nv_mthd(priv, 0xa097, 0x260c, 0x00000000);
1957 nv_mthd(priv, 0xa097, 0x07ac, 0x00000000);
1958 nv_mthd(priv, 0xa097, 0x162c, 0x00000003);
1959 nv_mthd(priv, 0xa097, 0x0210, 0x00000000);
1960 nv_mthd(priv, 0xa097, 0x0320, 0x00000000);
1961 nv_mthd(priv, 0xa097, 0x0324, 0x3f800000);
1962 nv_mthd(priv, 0xa097, 0x0328, 0x3f800000);
1963 nv_mthd(priv, 0xa097, 0x032c, 0x3f800000);
1964 nv_mthd(priv, 0xa097, 0x0330, 0x3f800000);
1965 nv_mthd(priv, 0xa097, 0x0334, 0x3f800000);
1966 nv_mthd(priv, 0xa097, 0x0338, 0x3f800000);
1967 nv_mthd(priv, 0xa097, 0x0750, 0x00000000);
1968 nv_mthd(priv, 0xa097, 0x0760, 0x39291909);
1969 nv_mthd(priv, 0xa097, 0x0764, 0x79695949);
1970 nv_mthd(priv, 0xa097, 0x0768, 0xb9a99989);
1971 nv_mthd(priv, 0xa097, 0x076c, 0xf9e9d9c9);
1972 nv_mthd(priv, 0xa097, 0x0770, 0x30201000);
1973 nv_mthd(priv, 0xa097, 0x0774, 0x70605040);
1974 nv_mthd(priv, 0xa097, 0x0778, 0x00009080);
1975 nv_mthd(priv, 0xa097, 0x0780, 0x39291909);
1976 nv_mthd(priv, 0xa097, 0x0784, 0x79695949);
1977 nv_mthd(priv, 0xa097, 0x0788, 0xb9a99989);
1978 nv_mthd(priv, 0xa097, 0x078c, 0xf9e9d9c9);
1979 nv_mthd(priv, 0xa097, 0x07d0, 0x30201000);
1980 nv_mthd(priv, 0xa097, 0x07d4, 0x70605040);
1981 nv_mthd(priv, 0xa097, 0x07d8, 0x00009080);
1982 nv_mthd(priv, 0xa097, 0x037c, 0x00000001);
1983 nv_mthd(priv, 0xa097, 0x0740, 0x00000000);
1984 nv_mthd(priv, 0xa097, 0x0744, 0x00000000);
1985 nv_mthd(priv, 0xa097, 0x2600, 0x00000000);
1986 nv_mthd(priv, 0xa097, 0x1918, 0x00000000);
1987 nv_mthd(priv, 0xa097, 0x191c, 0x00000900);
1988 nv_mthd(priv, 0xa097, 0x1920, 0x00000405);
1989 nv_mthd(priv, 0xa097, 0x1308, 0x00000001);
1990 nv_mthd(priv, 0xa097, 0x1924, 0x00000000);
1991 nv_mthd(priv, 0xa097, 0x13ac, 0x00000000);
1992 nv_mthd(priv, 0xa097, 0x192c, 0x00000001);
1993 nv_mthd(priv, 0xa097, 0x193c, 0x00002c1c);
1994 nv_mthd(priv, 0xa097, 0x0d7c, 0x00000000);
1995 nv_mthd(priv, 0xa097, 0x0f8c, 0x00000000);
1996 nv_mthd(priv, 0xa097, 0x02c0, 0x00000001);
1997 nv_mthd(priv, 0xa097, 0x1510, 0x00000000);
1998 nv_mthd(priv, 0xa097, 0x1940, 0x00000000);
1999 nv_mthd(priv, 0xa097, 0x0ff4, 0x00000000);
2000 nv_mthd(priv, 0xa097, 0x0ff8, 0x00000000);
2001 nv_mthd(priv, 0xa097, 0x194c, 0x00000000);
2002 nv_mthd(priv, 0xa097, 0x1950, 0x00000000);
2003 nv_mthd(priv, 0xa097, 0x1968, 0x00000000);
2004 nv_mthd(priv, 0xa097, 0x1590, 0x0000003f);
2005 nv_mthd(priv, 0xa097, 0x07e8, 0x00000000);
2006 nv_mthd(priv, 0xa097, 0x07ec, 0x00000000);
2007 nv_mthd(priv, 0xa097, 0x07f0, 0x00000000);
2008 nv_mthd(priv, 0xa097, 0x07f4, 0x00000000);
2009 nv_mthd(priv, 0xa097, 0x196c, 0x00000011);
2010 nv_mthd(priv, 0xa097, 0x02e4, 0x0000b001);
2011 nv_mthd(priv, 0xa097, 0x036c, 0x00000000);
2012 nv_mthd(priv, 0xa097, 0x0370, 0x00000000);
2013 nv_mthd(priv, 0xa097, 0x197c, 0x00000000);
2014 nv_mthd(priv, 0xa097, 0x0fcc, 0x00000000);
2015 nv_mthd(priv, 0xa097, 0x0fd0, 0x00000000);
2016 nv_mthd(priv, 0xa097, 0x02d8, 0x00000040);
2017 nv_mthd(priv, 0xa097, 0x1980, 0x00000080);
2018 nv_mthd(priv, 0xa097, 0x1504, 0x00000080);
2019 nv_mthd(priv, 0xa097, 0x1984, 0x00000000);
2020 nv_mthd(priv, 0xa097, 0x0300, 0x00000001);
2021 nv_mthd(priv, 0xa097, 0x13a8, 0x00000000);
2022 nv_mthd(priv, 0xa097, 0x12ec, 0x00000000);
2023 nv_mthd(priv, 0xa097, 0x1310, 0x00000000);
2024 nv_mthd(priv, 0xa097, 0x1314, 0x00000001);
2025 nv_mthd(priv, 0xa097, 0x1380, 0x00000000);
2026 nv_mthd(priv, 0xa097, 0x1384, 0x00000001);
2027 nv_mthd(priv, 0xa097, 0x1388, 0x00000001);
2028 nv_mthd(priv, 0xa097, 0x138c, 0x00000001);
2029 nv_mthd(priv, 0xa097, 0x1390, 0x00000001);
2030 nv_mthd(priv, 0xa097, 0x1394, 0x00000000);
2031 nv_mthd(priv, 0xa097, 0x139c, 0x00000000);
2032 nv_mthd(priv, 0xa097, 0x1398, 0x00000000);
2033 nv_mthd(priv, 0xa097, 0x1594, 0x00000000);
2034 nv_mthd(priv, 0xa097, 0x1598, 0x00000001);
2035 nv_mthd(priv, 0xa097, 0x159c, 0x00000001);
2036 nv_mthd(priv, 0xa097, 0x15a0, 0x00000001);
2037 nv_mthd(priv, 0xa097, 0x15a4, 0x00000001);
2038 nv_mthd(priv, 0xa097, 0x0f54, 0x00000000);
2039 nv_mthd(priv, 0xa097, 0x0f58, 0x00000000);
2040 nv_mthd(priv, 0xa097, 0x0f5c, 0x00000000);
2041 nv_mthd(priv, 0xa097, 0x19bc, 0x00000000);
2042 nv_mthd(priv, 0xa097, 0x0f9c, 0x00000000);
2043 nv_mthd(priv, 0xa097, 0x0fa0, 0x00000000);
2044 nv_mthd(priv, 0xa097, 0x12cc, 0x00000000);
2045 nv_mthd(priv, 0xa097, 0x12e8, 0x00000000);
2046 nv_mthd(priv, 0xa097, 0x130c, 0x00000001);
2047 nv_mthd(priv, 0xa097, 0x1360, 0x00000000);
2048 nv_mthd(priv, 0xa097, 0x1364, 0x00000000);
2049 nv_mthd(priv, 0xa097, 0x1368, 0x00000000);
2050 nv_mthd(priv, 0xa097, 0x136c, 0x00000000);
2051 nv_mthd(priv, 0xa097, 0x1370, 0x00000000);
2052 nv_mthd(priv, 0xa097, 0x1374, 0x00000000);
2053 nv_mthd(priv, 0xa097, 0x1378, 0x00000000);
2054 nv_mthd(priv, 0xa097, 0x137c, 0x00000000);
2055 nv_mthd(priv, 0xa097, 0x133c, 0x00000001);
2056 nv_mthd(priv, 0xa097, 0x1340, 0x00000001);
2057 nv_mthd(priv, 0xa097, 0x1344, 0x00000002);
2058 nv_mthd(priv, 0xa097, 0x1348, 0x00000001);
2059 nv_mthd(priv, 0xa097, 0x134c, 0x00000001);
2060 nv_mthd(priv, 0xa097, 0x1350, 0x00000002);
2061 nv_mthd(priv, 0xa097, 0x1358, 0x00000001);
2062 nv_mthd(priv, 0xa097, 0x12e4, 0x00000000);
2063 nv_mthd(priv, 0xa097, 0x131c, 0x00000000);
2064 nv_mthd(priv, 0xa097, 0x1320, 0x00000000);
2065 nv_mthd(priv, 0xa097, 0x1324, 0x00000000);
2066 nv_mthd(priv, 0xa097, 0x1328, 0x00000000);
2067 nv_mthd(priv, 0xa097, 0x19c0, 0x00000000);
2068 nv_mthd(priv, 0xa097, 0x1140, 0x00000000);
2069 nv_mthd(priv, 0xa097, 0x19c4, 0x00000000);
2070 nv_mthd(priv, 0xa097, 0x19c8, 0x00001500);
2071 nv_mthd(priv, 0xa097, 0x135c, 0x00000000);
2072 nv_mthd(priv, 0xa097, 0x0f90, 0x00000000);
2073 nv_mthd(priv, 0xa097, 0x19e0, 0x00000001);
2074 nv_mthd(priv, 0xa097, 0x19e4, 0x00000001);
2075 nv_mthd(priv, 0xa097, 0x19e8, 0x00000001);
2076 nv_mthd(priv, 0xa097, 0x19ec, 0x00000001);
2077 nv_mthd(priv, 0xa097, 0x19f0, 0x00000001);
2078 nv_mthd(priv, 0xa097, 0x19f4, 0x00000001);
2079 nv_mthd(priv, 0xa097, 0x19f8, 0x00000001);
2080 nv_mthd(priv, 0xa097, 0x19fc, 0x00000001);
2081 nv_mthd(priv, 0xa097, 0x19cc, 0x00000001);
2082 nv_mthd(priv, 0xa097, 0x15b8, 0x00000000);
2083 nv_mthd(priv, 0xa097, 0x1a00, 0x00001111);
2084 nv_mthd(priv, 0xa097, 0x1a04, 0x00000000);
2085 nv_mthd(priv, 0xa097, 0x1a08, 0x00000000);
2086 nv_mthd(priv, 0xa097, 0x1a0c, 0x00000000);
2087 nv_mthd(priv, 0xa097, 0x1a10, 0x00000000);
2088 nv_mthd(priv, 0xa097, 0x1a14, 0x00000000);
2089 nv_mthd(priv, 0xa097, 0x1a18, 0x00000000);
2090 nv_mthd(priv, 0xa097, 0x1a1c, 0x00000000);
2091 nv_mthd(priv, 0xa097, 0x0d6c, 0xffff0000);
2092 nv_mthd(priv, 0xa097, 0x0d70, 0xffff0000);
2093 nv_mthd(priv, 0xa097, 0x10f8, 0x00001010);
2094 nv_mthd(priv, 0xa097, 0x0d80, 0x00000000);
2095 nv_mthd(priv, 0xa097, 0x0d84, 0x00000000);
2096 nv_mthd(priv, 0xa097, 0x0d88, 0x00000000);
2097 nv_mthd(priv, 0xa097, 0x0d8c, 0x00000000);
2098 nv_mthd(priv, 0xa097, 0x0d90, 0x00000000);
2099 nv_mthd(priv, 0xa097, 0x0da0, 0x00000000);
2100 nv_mthd(priv, 0xa097, 0x07a4, 0x00000000);
2101 nv_mthd(priv, 0xa097, 0x07a8, 0x00000000);
2102 nv_mthd(priv, 0xa097, 0x1508, 0x80000000);
2103 nv_mthd(priv, 0xa097, 0x150c, 0x40000000);
2104 nv_mthd(priv, 0xa097, 0x1668, 0x00000000);
2105 nv_mthd(priv, 0xa097, 0x0318, 0x00000008);
2106 nv_mthd(priv, 0xa097, 0x031c, 0x00000008);
2107 nv_mthd(priv, 0xa097, 0x0d9c, 0x00000001);
2108 nv_mthd(priv, 0xa097, 0x0374, 0x00000000);
2109 nv_mthd(priv, 0xa097, 0x0378, 0x00000020);
2110 nv_mthd(priv, 0xa097, 0x07dc, 0x00000000);
2111 nv_mthd(priv, 0xa097, 0x074c, 0x00000055);
2112 nv_mthd(priv, 0xa097, 0x1420, 0x00000003);
2113 nv_mthd(priv, 0xa097, 0x17bc, 0x00000000);
2114 nv_mthd(priv, 0xa097, 0x17c0, 0x00000000);
2115 nv_mthd(priv, 0xa097, 0x17c4, 0x00000001);
2116 nv_mthd(priv, 0xa097, 0x1008, 0x00000008);
2117 nv_mthd(priv, 0xa097, 0x100c, 0x00000040);
2118 nv_mthd(priv, 0xa097, 0x1010, 0x0000012c);
2119 nv_mthd(priv, 0xa097, 0x0d60, 0x00000040);
2120 nv_mthd(priv, 0xa097, 0x075c, 0x00000003);
2121 nv_mthd(priv, 0xa097, 0x1018, 0x00000020);
2122 nv_mthd(priv, 0xa097, 0x101c, 0x00000001);
2123 nv_mthd(priv, 0xa097, 0x1020, 0x00000020);
2124 nv_mthd(priv, 0xa097, 0x1024, 0x00000001);
2125 nv_mthd(priv, 0xa097, 0x1444, 0x00000000);
2126 nv_mthd(priv, 0xa097, 0x1448, 0x00000000);
2127 nv_mthd(priv, 0xa097, 0x144c, 0x00000000);
2128 nv_mthd(priv, 0xa097, 0x0360, 0x20164010);
2129 nv_mthd(priv, 0xa097, 0x0364, 0x00000020);
2130 nv_mthd(priv, 0xa097, 0x0368, 0x00000000);
2131 nv_mthd(priv, 0xa097, 0x0de4, 0x00000000);
2132 nv_mthd(priv, 0xa097, 0x0204, 0x00000006);
2133 nv_mthd(priv, 0xa097, 0x0208, 0x00000000);
2134 nv_mthd(priv, 0xa097, 0x02cc, 0x003fffff);
2135 nv_mthd(priv, 0xa097, 0x02d0, 0x003fffff);
2136 nv_mthd(priv, 0xa097, 0x1220, 0x00000005);
2137 nv_mthd(priv, 0xa097, 0x0fdc, 0x00000000);
2138 nv_mthd(priv, 0xa097, 0x0f98, 0x00400008);
2139 nv_mthd(priv, 0xa097, 0x1284, 0x08000080);
2140 nv_mthd(priv, 0xa097, 0x1450, 0x00400008);
2141 nv_mthd(priv, 0xa097, 0x1454, 0x08000080);
2142 nv_mthd(priv, 0xa097, 0x0214, 0x00000000);
2143}
2144
2145static void
2146nve0_grctx_generate_902d(struct nvc0_graph_priv *priv)
2147{
2148 nv_mthd(priv, 0x902d, 0x0200, 0x000000cf);
2149 nv_mthd(priv, 0x902d, 0x0204, 0x00000001);
2150 nv_mthd(priv, 0x902d, 0x0208, 0x00000020);
2151 nv_mthd(priv, 0x902d, 0x020c, 0x00000001);
2152 nv_mthd(priv, 0x902d, 0x0210, 0x00000000);
2153 nv_mthd(priv, 0x902d, 0x0214, 0x00000080);
2154 nv_mthd(priv, 0x902d, 0x0218, 0x00000100);
2155 nv_mthd(priv, 0x902d, 0x021c, 0x00000100);
2156 nv_mthd(priv, 0x902d, 0x0220, 0x00000000);
2157 nv_mthd(priv, 0x902d, 0x0224, 0x00000000);
2158 nv_mthd(priv, 0x902d, 0x0230, 0x000000cf);
2159 nv_mthd(priv, 0x902d, 0x0234, 0x00000001);
2160 nv_mthd(priv, 0x902d, 0x0238, 0x00000020);
2161 nv_mthd(priv, 0x902d, 0x023c, 0x00000001);
2162 nv_mthd(priv, 0x902d, 0x0244, 0x00000080);
2163 nv_mthd(priv, 0x902d, 0x0248, 0x00000100);
2164 nv_mthd(priv, 0x902d, 0x024c, 0x00000100);
2165 nv_mthd(priv, 0x902d, 0x3410, 0x00000000);
2166}
2167
2168static void
2169nve0_graph_generate_unk40xx(struct nvc0_graph_priv *priv)
2170{
2171 nv_wr32(priv, 0x404010, 0x0);
2172 nv_wr32(priv, 0x404014, 0x0);
2173 nv_wr32(priv, 0x404018, 0x0);
2174 nv_wr32(priv, 0x40401c, 0x0);
2175 nv_wr32(priv, 0x404020, 0x0);
2176 nv_wr32(priv, 0x404024, 0xe000);
2177 nv_wr32(priv, 0x404028, 0x0);
2178 nv_wr32(priv, 0x4040a8, 0x0);
2179 nv_wr32(priv, 0x4040ac, 0x0);
2180 nv_wr32(priv, 0x4040b0, 0x0);
2181 nv_wr32(priv, 0x4040b4, 0x0);
2182 nv_wr32(priv, 0x4040b8, 0x0);
2183 nv_wr32(priv, 0x4040bc, 0x0);
2184 nv_wr32(priv, 0x4040c0, 0x0);
2185 nv_wr32(priv, 0x4040c4, 0x0);
2186 nv_wr32(priv, 0x4040c8, 0xf800008f);
2187 nv_wr32(priv, 0x4040d0, 0x0);
2188 nv_wr32(priv, 0x4040d4, 0x0);
2189 nv_wr32(priv, 0x4040d8, 0x0);
2190 nv_wr32(priv, 0x4040dc, 0x0);
2191 nv_wr32(priv, 0x4040e0, 0x0);
2192 nv_wr32(priv, 0x4040e4, 0x0);
2193 nv_wr32(priv, 0x4040e8, 0x1000);
2194 nv_wr32(priv, 0x4040f8, 0x0);
2195 nv_wr32(priv, 0x404130, 0x0);
2196 nv_wr32(priv, 0x404134, 0x0);
2197 nv_wr32(priv, 0x404138, 0x20000040);
2198 nv_wr32(priv, 0x404150, 0x2e);
2199 nv_wr32(priv, 0x404154, 0x400);
2200 nv_wr32(priv, 0x404158, 0x200);
2201 nv_wr32(priv, 0x404164, 0x55);
2202 nv_wr32(priv, 0x4041a0, 0x0);
2203 nv_wr32(priv, 0x4041a4, 0x0);
2204 nv_wr32(priv, 0x4041a8, 0x0);
2205 nv_wr32(priv, 0x4041ac, 0x0);
2206 nv_wr32(priv, 0x404200, 0x0);
2207 nv_wr32(priv, 0x404204, 0x0);
2208 nv_wr32(priv, 0x404208, 0x0);
2209 nv_wr32(priv, 0x40420c, 0x0);
2210}
2211
2212static void
2213nve0_graph_generate_unk44xx(struct nvc0_graph_priv *priv)
2214{
2215 nv_wr32(priv, 0x404404, 0x0);
2216 nv_wr32(priv, 0x404408, 0x0);
2217 nv_wr32(priv, 0x40440c, 0x0);
2218 nv_wr32(priv, 0x404410, 0x0);
2219 nv_wr32(priv, 0x404414, 0x0);
2220 nv_wr32(priv, 0x404418, 0x0);
2221 nv_wr32(priv, 0x40441c, 0x0);
2222 nv_wr32(priv, 0x404420, 0x0);
2223 nv_wr32(priv, 0x404424, 0x0);
2224 nv_wr32(priv, 0x404428, 0x0);
2225 nv_wr32(priv, 0x40442c, 0x0);
2226 nv_wr32(priv, 0x404430, 0x0);
2227 nv_wr32(priv, 0x404434, 0x0);
2228 nv_wr32(priv, 0x404438, 0x0);
2229 nv_wr32(priv, 0x404460, 0x0);
2230 nv_wr32(priv, 0x404464, 0x0);
2231 nv_wr32(priv, 0x404468, 0xffffff);
2232 nv_wr32(priv, 0x40446c, 0x0);
2233 nv_wr32(priv, 0x404480, 0x1);
2234 nv_wr32(priv, 0x404498, 0x1);
2235}
2236
2237static void
2238nve0_graph_generate_unk46xx(struct nvc0_graph_priv *priv)
2239{
2240 nv_wr32(priv, 0x404604, 0x14);
2241 nv_wr32(priv, 0x404608, 0x0);
2242 nv_wr32(priv, 0x40460c, 0x3fff);
2243 nv_wr32(priv, 0x404610, 0x100);
2244 nv_wr32(priv, 0x404618, 0x0);
2245 nv_wr32(priv, 0x40461c, 0x0);
2246 nv_wr32(priv, 0x404620, 0x0);
2247 nv_wr32(priv, 0x404624, 0x0);
2248 nv_wr32(priv, 0x40462c, 0x0);
2249 nv_wr32(priv, 0x404630, 0x0);
2250 nv_wr32(priv, 0x404640, 0x0);
2251 nv_wr32(priv, 0x404654, 0x0);
2252 nv_wr32(priv, 0x404660, 0x0);
2253 nv_wr32(priv, 0x404678, 0x0);
2254 nv_wr32(priv, 0x40467c, 0x2);
2255 nv_wr32(priv, 0x404680, 0x0);
2256 nv_wr32(priv, 0x404684, 0x0);
2257 nv_wr32(priv, 0x404688, 0x0);
2258 nv_wr32(priv, 0x40468c, 0x0);
2259 nv_wr32(priv, 0x404690, 0x0);
2260 nv_wr32(priv, 0x404694, 0x0);
2261 nv_wr32(priv, 0x404698, 0x0);
2262 nv_wr32(priv, 0x40469c, 0x0);
2263 nv_wr32(priv, 0x4046a0, 0x7f0080);
2264 nv_wr32(priv, 0x4046a4, 0x0);
2265 nv_wr32(priv, 0x4046a8, 0x0);
2266 nv_wr32(priv, 0x4046ac, 0x0);
2267 nv_wr32(priv, 0x4046b0, 0x0);
2268 nv_wr32(priv, 0x4046b4, 0x0);
2269 nv_wr32(priv, 0x4046b8, 0x0);
2270 nv_wr32(priv, 0x4046bc, 0x0);
2271 nv_wr32(priv, 0x4046c0, 0x0);
2272 nv_wr32(priv, 0x4046c8, 0x0);
2273 nv_wr32(priv, 0x4046cc, 0x0);
2274 nv_wr32(priv, 0x4046d0, 0x0);
2275}
2276
2277static void
2278nve0_graph_generate_unk47xx(struct nvc0_graph_priv *priv)
2279{
2280 nv_wr32(priv, 0x404700, 0x0);
2281 nv_wr32(priv, 0x404704, 0x0);
2282 nv_wr32(priv, 0x404708, 0x0);
2283 nv_wr32(priv, 0x404718, 0x0);
2284 nv_wr32(priv, 0x40471c, 0x0);
2285 nv_wr32(priv, 0x404720, 0x0);
2286 nv_wr32(priv, 0x404724, 0x0);
2287 nv_wr32(priv, 0x404728, 0x0);
2288 nv_wr32(priv, 0x40472c, 0x0);
2289 nv_wr32(priv, 0x404730, 0x0);
2290 nv_wr32(priv, 0x404734, 0x100);
2291 nv_wr32(priv, 0x404738, 0x0);
2292 nv_wr32(priv, 0x40473c, 0x0);
2293 nv_wr32(priv, 0x404744, 0x0);
2294 nv_wr32(priv, 0x404748, 0x0);
2295 nv_wr32(priv, 0x404754, 0x0);
2296}
2297
2298static void
2299nve0_graph_generate_unk58xx(struct nvc0_graph_priv *priv)
2300{
2301 nv_wr32(priv, 0x405800, 0xf8000bf);
2302 nv_wr32(priv, 0x405830, 0x2180648);
2303 nv_wr32(priv, 0x405834, 0x8000000);
2304 nv_wr32(priv, 0x405838, 0x0);
2305 nv_wr32(priv, 0x405854, 0x0);
2306 nv_wr32(priv, 0x405870, 0x1);
2307 nv_wr32(priv, 0x405874, 0x1);
2308 nv_wr32(priv, 0x405878, 0x1);
2309 nv_wr32(priv, 0x40587c, 0x1);
2310 nv_wr32(priv, 0x405a00, 0x0);
2311 nv_wr32(priv, 0x405a04, 0x0);
2312 nv_wr32(priv, 0x405a18, 0x0);
2313 nv_wr32(priv, 0x405b00, 0x0);
2314 nv_wr32(priv, 0x405b10, 0x1000);
2315}
2316
2317static void
2318nve0_graph_generate_unk60xx(struct nvc0_graph_priv *priv)
2319{
2320 nv_wr32(priv, 0x406020, 0x4103c1);
2321 nv_wr32(priv, 0x406028, 0x1);
2322 nv_wr32(priv, 0x40602c, 0x1);
2323 nv_wr32(priv, 0x406030, 0x1);
2324 nv_wr32(priv, 0x406034, 0x1);
2325}
2326
2327static void
2328nve0_graph_generate_unk64xx(struct nvc0_graph_priv *priv)
2329{
2330 nv_wr32(priv, 0x4064a8, 0x0);
2331 nv_wr32(priv, 0x4064ac, 0x3fff);
2332 nv_wr32(priv, 0x4064b4, 0x0);
2333 nv_wr32(priv, 0x4064b8, 0x0);
2334 nv_wr32(priv, 0x4064c0, 0x801a00f0);
2335 nv_wr32(priv, 0x4064c4, 0x192ffff);
2336 nv_wr32(priv, 0x4064c8, 0x1800600);
2337 nv_wr32(priv, 0x4064cc, 0x0);
2338 nv_wr32(priv, 0x4064d0, 0x0);
2339 nv_wr32(priv, 0x4064d4, 0x0);
2340 nv_wr32(priv, 0x4064d8, 0x0);
2341 nv_wr32(priv, 0x4064dc, 0x0);
2342 nv_wr32(priv, 0x4064e0, 0x0);
2343 nv_wr32(priv, 0x4064e4, 0x0);
2344 nv_wr32(priv, 0x4064e8, 0x0);
2345 nv_wr32(priv, 0x4064ec, 0x0);
2346 nv_wr32(priv, 0x4064fc, 0x22a);
2347}
2348
2349static void
2350nve0_graph_generate_unk70xx(struct nvc0_graph_priv *priv)
2351{
2352 nv_wr32(priv, 0x407040, 0x0);
2353}
2354
2355static void
2356nve0_graph_generate_unk78xx(struct nvc0_graph_priv *priv)
2357{
2358 nv_wr32(priv, 0x407804, 0x23);
2359 nv_wr32(priv, 0x40780c, 0xa418820);
2360 nv_wr32(priv, 0x407810, 0x62080e6);
2361 nv_wr32(priv, 0x407814, 0x20398a4);
2362 nv_wr32(priv, 0x407818, 0xe629062);
2363 nv_wr32(priv, 0x40781c, 0xa418820);
2364 nv_wr32(priv, 0x407820, 0xe6);
2365 nv_wr32(priv, 0x4078bc, 0x103);
2366}
2367
2368static void
2369nve0_graph_generate_unk80xx(struct nvc0_graph_priv *priv)
2370{
2371 nv_wr32(priv, 0x408000, 0x0);
2372 nv_wr32(priv, 0x408004, 0x0);
2373 nv_wr32(priv, 0x408008, 0x30);
2374 nv_wr32(priv, 0x40800c, 0x0);
2375 nv_wr32(priv, 0x408010, 0x0);
2376 nv_wr32(priv, 0x408014, 0x69);
2377 nv_wr32(priv, 0x408018, 0xe100e100);
2378 nv_wr32(priv, 0x408064, 0x0);
2379}
2380
2381static void
2382nve0_graph_generate_unk88xx(struct nvc0_graph_priv *priv)
2383{
2384 nv_wr32(priv, 0x408800, 0x2802a3c);
2385 nv_wr32(priv, 0x408804, 0x40);
2386 nv_wr32(priv, 0x408808, 0x1043e005);
2387 nv_wr32(priv, 0x408840, 0xb);
2388 nv_wr32(priv, 0x408900, 0x3080b801);
2389 nv_wr32(priv, 0x408904, 0x62000001);
2390 nv_wr32(priv, 0x408908, 0xc8102f);
2391 nv_wr32(priv, 0x408980, 0x11d);
2392}
2393
2394static void
2395nve0_graph_generate_gpc(struct nvc0_graph_priv *priv)
2396{
2397 nv_wr32(priv, 0x418380, 0x16);
2398 nv_wr32(priv, 0x418400, 0x38004e00);
2399 nv_wr32(priv, 0x418404, 0x71e0ffff);
2400 nv_wr32(priv, 0x41840c, 0x1008);
2401 nv_wr32(priv, 0x418410, 0xfff0fff);
2402 nv_wr32(priv, 0x418414, 0x2200fff);
2403 nv_wr32(priv, 0x418450, 0x0);
2404 nv_wr32(priv, 0x418454, 0x0);
2405 nv_wr32(priv, 0x418458, 0x0);
2406 nv_wr32(priv, 0x41845c, 0x0);
2407 nv_wr32(priv, 0x418460, 0x0);
2408 nv_wr32(priv, 0x418464, 0x0);
2409 nv_wr32(priv, 0x418468, 0x1);
2410 nv_wr32(priv, 0x41846c, 0x0);
2411 nv_wr32(priv, 0x418470, 0x0);
2412 nv_wr32(priv, 0x418600, 0x1f);
2413 nv_wr32(priv, 0x418684, 0xf);
2414 nv_wr32(priv, 0x418700, 0x2);
2415 nv_wr32(priv, 0x418704, 0x80);
2416 nv_wr32(priv, 0x418708, 0x0);
2417 nv_wr32(priv, 0x41870c, 0x0);
2418 nv_wr32(priv, 0x418710, 0x0);
2419 nv_wr32(priv, 0x418800, 0x7006860a);
2420 nv_wr32(priv, 0x418808, 0x0);
2421 nv_wr32(priv, 0x41880c, 0x0);
2422 nv_wr32(priv, 0x418810, 0x0);
2423 nv_wr32(priv, 0x418828, 0x44);
2424 nv_wr32(priv, 0x418830, 0x10000001);
2425 nv_wr32(priv, 0x4188d8, 0x8);
2426 nv_wr32(priv, 0x4188e0, 0x1000000);
2427 nv_wr32(priv, 0x4188e8, 0x0);
2428 nv_wr32(priv, 0x4188ec, 0x0);
2429 nv_wr32(priv, 0x4188f0, 0x0);
2430 nv_wr32(priv, 0x4188f4, 0x0);
2431 nv_wr32(priv, 0x4188f8, 0x0);
2432 nv_wr32(priv, 0x4188fc, 0x20100018);
2433 nv_wr32(priv, 0x41891c, 0xff00ff);
2434 nv_wr32(priv, 0x418924, 0x0);
2435 nv_wr32(priv, 0x418928, 0xffff00);
2436 nv_wr32(priv, 0x41892c, 0xff00);
2437 nv_wr32(priv, 0x418a00, 0x0);
2438 nv_wr32(priv, 0x418a04, 0x0);
2439 nv_wr32(priv, 0x418a08, 0x0);
2440 nv_wr32(priv, 0x418a0c, 0x10000);
2441 nv_wr32(priv, 0x418a10, 0x0);
2442 nv_wr32(priv, 0x418a14, 0x0);
2443 nv_wr32(priv, 0x418a18, 0x0);
2444 nv_wr32(priv, 0x418a20, 0x0);
2445 nv_wr32(priv, 0x418a24, 0x0);
2446 nv_wr32(priv, 0x418a28, 0x0);
2447 nv_wr32(priv, 0x418a2c, 0x10000);
2448 nv_wr32(priv, 0x418a30, 0x0);
2449 nv_wr32(priv, 0x418a34, 0x0);
2450 nv_wr32(priv, 0x418a38, 0x0);
2451 nv_wr32(priv, 0x418a40, 0x0);
2452 nv_wr32(priv, 0x418a44, 0x0);
2453 nv_wr32(priv, 0x418a48, 0x0);
2454 nv_wr32(priv, 0x418a4c, 0x10000);
2455 nv_wr32(priv, 0x418a50, 0x0);
2456 nv_wr32(priv, 0x418a54, 0x0);
2457 nv_wr32(priv, 0x418a58, 0x0);
2458 nv_wr32(priv, 0x418a60, 0x0);
2459 nv_wr32(priv, 0x418a64, 0x0);
2460 nv_wr32(priv, 0x418a68, 0x0);
2461 nv_wr32(priv, 0x418a6c, 0x10000);
2462 nv_wr32(priv, 0x418a70, 0x0);
2463 nv_wr32(priv, 0x418a74, 0x0);
2464 nv_wr32(priv, 0x418a78, 0x0);
2465 nv_wr32(priv, 0x418a80, 0x0);
2466 nv_wr32(priv, 0x418a84, 0x0);
2467 nv_wr32(priv, 0x418a88, 0x0);
2468 nv_wr32(priv, 0x418a8c, 0x10000);
2469 nv_wr32(priv, 0x418a90, 0x0);
2470 nv_wr32(priv, 0x418a94, 0x0);
2471 nv_wr32(priv, 0x418a98, 0x0);
2472 nv_wr32(priv, 0x418aa0, 0x0);
2473 nv_wr32(priv, 0x418aa4, 0x0);
2474 nv_wr32(priv, 0x418aa8, 0x0);
2475 nv_wr32(priv, 0x418aac, 0x10000);
2476 nv_wr32(priv, 0x418ab0, 0x0);
2477 nv_wr32(priv, 0x418ab4, 0x0);
2478 nv_wr32(priv, 0x418ab8, 0x0);
2479 nv_wr32(priv, 0x418ac0, 0x0);
2480 nv_wr32(priv, 0x418ac4, 0x0);
2481 nv_wr32(priv, 0x418ac8, 0x0);
2482 nv_wr32(priv, 0x418acc, 0x10000);
2483 nv_wr32(priv, 0x418ad0, 0x0);
2484 nv_wr32(priv, 0x418ad4, 0x0);
2485 nv_wr32(priv, 0x418ad8, 0x0);
2486 nv_wr32(priv, 0x418ae0, 0x0);
2487 nv_wr32(priv, 0x418ae4, 0x0);
2488 nv_wr32(priv, 0x418ae8, 0x0);
2489 nv_wr32(priv, 0x418aec, 0x10000);
2490 nv_wr32(priv, 0x418af0, 0x0);
2491 nv_wr32(priv, 0x418af4, 0x0);
2492 nv_wr32(priv, 0x418af8, 0x0);
2493 nv_wr32(priv, 0x418b00, 0x6);
2494 nv_wr32(priv, 0x418b08, 0xa418820);
2495 nv_wr32(priv, 0x418b0c, 0x62080e6);
2496 nv_wr32(priv, 0x418b10, 0x20398a4);
2497 nv_wr32(priv, 0x418b14, 0xe629062);
2498 nv_wr32(priv, 0x418b18, 0xa418820);
2499 nv_wr32(priv, 0x418b1c, 0xe6);
2500 nv_wr32(priv, 0x418bb8, 0x103);
2501 nv_wr32(priv, 0x418c08, 0x1);
2502 nv_wr32(priv, 0x418c10, 0x0);
2503 nv_wr32(priv, 0x418c14, 0x0);
2504 nv_wr32(priv, 0x418c18, 0x0);
2505 nv_wr32(priv, 0x418c1c, 0x0);
2506 nv_wr32(priv, 0x418c20, 0x0);
2507 nv_wr32(priv, 0x418c24, 0x0);
2508 nv_wr32(priv, 0x418c28, 0x0);
2509 nv_wr32(priv, 0x418c2c, 0x0);
2510 nv_wr32(priv, 0x418c40, 0xffffffff);
2511 nv_wr32(priv, 0x418c6c, 0x1);
2512 nv_wr32(priv, 0x418c80, 0x20200004);
2513 nv_wr32(priv, 0x418c8c, 0x1);
2514 nv_wr32(priv, 0x419000, 0x780);
2515 nv_wr32(priv, 0x419004, 0x0);
2516 nv_wr32(priv, 0x419008, 0x0);
2517 nv_wr32(priv, 0x419014, 0x4);
2518}
2519
2520static void
2521nve0_graph_generate_tpc(struct nvc0_graph_priv *priv)
2522{
2523 nv_wr32(priv, 0x419848, 0x0);
2524 nv_wr32(priv, 0x419864, 0x129);
2525 nv_wr32(priv, 0x419888, 0x0);
2526 nv_wr32(priv, 0x419a00, 0xf0);
2527 nv_wr32(priv, 0x419a04, 0x1);
2528 nv_wr32(priv, 0x419a08, 0x21);
2529 nv_wr32(priv, 0x419a0c, 0x20000);
2530 nv_wr32(priv, 0x419a10, 0x0);
2531 nv_wr32(priv, 0x419a14, 0x200);
2532 nv_wr32(priv, 0x419a1c, 0xc000);
2533 nv_wr32(priv, 0x419a20, 0x800);
2534 nv_wr32(priv, 0x419a30, 0x1);
2535 nv_wr32(priv, 0x419ac4, 0x37f440);
2536 nv_wr32(priv, 0x419c00, 0xa);
2537 nv_wr32(priv, 0x419c04, 0x80000006);
2538 nv_wr32(priv, 0x419c08, 0x2);
2539 nv_wr32(priv, 0x419c20, 0x0);
2540 nv_wr32(priv, 0x419c24, 0x84210);
2541 nv_wr32(priv, 0x419c28, 0x3efbefbe);
2542 nv_wr32(priv, 0x419ce8, 0x0);
2543 nv_wr32(priv, 0x419cf4, 0x3203);
2544 nv_wr32(priv, 0x419e04, 0x0);
2545 nv_wr32(priv, 0x419e08, 0x0);
2546 nv_wr32(priv, 0x419e0c, 0x0);
2547 nv_wr32(priv, 0x419e10, 0x402);
2548 nv_wr32(priv, 0x419e44, 0x13eff2);
2549 nv_wr32(priv, 0x419e48, 0x0);
2550 nv_wr32(priv, 0x419e4c, 0x7f);
2551 nv_wr32(priv, 0x419e50, 0x0);
2552 nv_wr32(priv, 0x419e54, 0x0);
2553 nv_wr32(priv, 0x419e58, 0x0);
2554 nv_wr32(priv, 0x419e5c, 0x0);
2555 nv_wr32(priv, 0x419e60, 0x0);
2556 nv_wr32(priv, 0x419e64, 0x0);
2557 nv_wr32(priv, 0x419e68, 0x0);
2558 nv_wr32(priv, 0x419e6c, 0x0);
2559 nv_wr32(priv, 0x419e70, 0x0);
2560 nv_wr32(priv, 0x419e74, 0x0);
2561 nv_wr32(priv, 0x419e78, 0x0);
2562 nv_wr32(priv, 0x419e7c, 0x0);
2563 nv_wr32(priv, 0x419e80, 0x0);
2564 nv_wr32(priv, 0x419e84, 0x0);
2565 nv_wr32(priv, 0x419e88, 0x0);
2566 nv_wr32(priv, 0x419e8c, 0x0);
2567 nv_wr32(priv, 0x419e90, 0x0);
2568 nv_wr32(priv, 0x419e94, 0x0);
2569 nv_wr32(priv, 0x419e98, 0x0);
2570 nv_wr32(priv, 0x419eac, 0x1fcf);
2571 nv_wr32(priv, 0x419eb0, 0xd3f);
2572 nv_wr32(priv, 0x419ec8, 0x1304f);
2573 nv_wr32(priv, 0x419f30, 0x0);
2574 nv_wr32(priv, 0x419f34, 0x0);
2575 nv_wr32(priv, 0x419f38, 0x0);
2576 nv_wr32(priv, 0x419f3c, 0x0);
2577 nv_wr32(priv, 0x419f40, 0x0);
2578 nv_wr32(priv, 0x419f44, 0x0);
2579 nv_wr32(priv, 0x419f48, 0x0);
2580 nv_wr32(priv, 0x419f4c, 0x0);
2581 nv_wr32(priv, 0x419f58, 0x0);
2582 nv_wr32(priv, 0x419f78, 0xb);
2583}
2584
2585static void
2586nve0_graph_generate_tpcunk(struct nvc0_graph_priv *priv)
2587{
2588 nv_wr32(priv, 0x41be24, 0x6);
2589 nv_wr32(priv, 0x41bec0, 0x12180000);
2590 nv_wr32(priv, 0x41bec4, 0x37f7f);
2591 nv_wr32(priv, 0x41bee4, 0x6480430);
2592 nv_wr32(priv, 0x41bf00, 0xa418820);
2593 nv_wr32(priv, 0x41bf04, 0x62080e6);
2594 nv_wr32(priv, 0x41bf08, 0x20398a4);
2595 nv_wr32(priv, 0x41bf0c, 0xe629062);
2596 nv_wr32(priv, 0x41bf10, 0xa418820);
2597 nv_wr32(priv, 0x41bf14, 0xe6);
2598 nv_wr32(priv, 0x41bfd0, 0x900103);
2599 nv_wr32(priv, 0x41bfe0, 0x400001);
2600 nv_wr32(priv, 0x41bfe4, 0x0);
2601}
2602
2603int
2604nve0_grctx_generate(struct nvc0_graph_priv *priv)
2605{
2606 struct nvc0_grctx info;
2607 int ret, i, gpc, tpc, id;
2608 u32 data[6] = {}, data2[2] = {}, tmp;
2609 u32 tpc_set = 0, tpc_mask = 0;
2610 u32 magic[GPC_MAX][2], offset;
2611 u8 tpcnr[GPC_MAX], a, b;
2612 u8 shift, ntpcv;
2613
2614 ret = nvc0_grctx_init(priv, &info);
2615 if (ret)
2616 return ret;
2617
2618 nv_mask(priv, 0x000260, 0x00000001, 0x00000000);
2619 nv_wr32(priv, 0x400204, 0x00000000);
2620 nv_wr32(priv, 0x400208, 0x00000000);
2621
2622 nve0_graph_generate_unk40xx(priv);
2623 nve0_graph_generate_unk44xx(priv);
2624 nve0_graph_generate_unk46xx(priv);
2625 nve0_graph_generate_unk47xx(priv);
2626 nve0_graph_generate_unk58xx(priv);
2627 nve0_graph_generate_unk60xx(priv);
2628 nve0_graph_generate_unk64xx(priv);
2629 nve0_graph_generate_unk70xx(priv);
2630 nve0_graph_generate_unk78xx(priv);
2631 nve0_graph_generate_unk80xx(priv);
2632 nve0_graph_generate_unk88xx(priv);
2633 nve0_graph_generate_gpc(priv);
2634 nve0_graph_generate_tpc(priv);
2635 nve0_graph_generate_tpcunk(priv);
2636
2637 nv_wr32(priv, 0x404154, 0x0);
2638
2639 mmio_data(0x003000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
2640 mmio_data(0x008000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
2641 mmio_data(0x060000, 0x1000, NV_MEM_ACCESS_RW);
2642 mmio_list(0x40800c, 0x00000000, 8, 1);
2643 mmio_list(0x408010, 0x80000000, 0, 0);
2644 mmio_list(0x419004, 0x00000000, 8, 1);
2645 mmio_list(0x419008, 0x00000000, 0, 0);
2646 mmio_list(0x4064cc, 0x80000000, 0, 0);
2647 mmio_list(0x408004, 0x00000000, 8, 0);
2648 mmio_list(0x408008, 0x80000030, 0, 0);
2649 mmio_list(0x418808, 0x00000000, 8, 0);
2650 mmio_list(0x41880c, 0x80000030, 0, 0);
2651 mmio_list(0x4064c8, 0x01800600, 0, 0);
2652 mmio_list(0x418810, 0x80000000, 12, 2);
2653 mmio_list(0x419848, 0x10000000, 12, 2);
2654 mmio_list(0x405830, 0x02180648, 0, 0);
2655 mmio_list(0x4064c4, 0x0192ffff, 0, 0);
2656 for (gpc = 0, offset = 0; gpc < priv->gpc_nr; gpc++) {
2657 u16 magic0 = 0x0218 * priv->tpc_nr[gpc];
2658 u16 magic1 = 0x0648 * priv->tpc_nr[gpc];
2659 magic[gpc][0] = 0x10000000 | (magic0 << 16) | offset;
2660 magic[gpc][1] = 0x00000000 | (magic1 << 16);
2661 offset += 0x0324 * priv->tpc_nr[gpc];
2662 }
2663 for (gpc = 0; gpc < priv->gpc_nr; gpc++) {
2664 mmio_list(GPC_UNIT(gpc, 0x30c0), magic[gpc][0], 0, 0);
2665 mmio_list(GPC_UNIT(gpc, 0x30e4), magic[gpc][1] | offset, 0, 0);
2666 offset += 0x07ff * priv->tpc_nr[gpc];
2667 }
2668 mmio_list(0x17e91c, 0x06060609, 0, 0);
2669 mmio_list(0x17e920, 0x00090a05, 0, 0);
2670
2671 nv_wr32(priv, 0x418c6c, 0x1);
2672 nv_wr32(priv, 0x41980c, 0x10);
2673 nv_wr32(priv, 0x41be08, 0x4);
2674 nv_wr32(priv, 0x4064c0, 0x801a00f0);
2675 nv_wr32(priv, 0x405800, 0xf8000bf);
2676 nv_wr32(priv, 0x419c00, 0xa);
2677
2678 for (tpc = 0, id = 0; tpc < 4; tpc++) {
2679 for (gpc = 0; gpc < priv->gpc_nr; gpc++) {
2680 if (tpc < priv->tpc_nr[gpc]) {
2681 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x0698), id);
2682 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x04e8), id);
2683 nv_wr32(priv, GPC_UNIT(gpc, 0x0c10 + tpc * 4), id);
2684 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x0088), id++);
2685 }
2686
2687 nv_wr32(priv, GPC_UNIT(gpc, 0x0c08), priv->tpc_nr[gpc]);
2688 nv_wr32(priv, GPC_UNIT(gpc, 0x0c8c), priv->tpc_nr[gpc]);
2689 }
2690 }
2691
2692 tmp = 0;
2693 for (i = 0; i < priv->gpc_nr; i++)
2694 tmp |= priv->tpc_nr[i] << (i * 4);
2695 nv_wr32(priv, 0x406028, tmp);
2696 nv_wr32(priv, 0x405870, tmp);
2697
2698 nv_wr32(priv, 0x40602c, 0x0);
2699 nv_wr32(priv, 0x405874, 0x0);
2700 nv_wr32(priv, 0x406030, 0x0);
2701 nv_wr32(priv, 0x405878, 0x0);
2702 nv_wr32(priv, 0x406034, 0x0);
2703 nv_wr32(priv, 0x40587c, 0x0);
2704
2705 /* calculate first set of magics */
2706 memcpy(tpcnr, priv->tpc_nr, sizeof(priv->tpc_nr));
2707
2708 gpc = -1;
2709 for (tpc = 0; tpc < priv->tpc_total; tpc++) {
2710 do {
2711 gpc = (gpc + 1) % priv->gpc_nr;
2712 } while (!tpcnr[gpc]);
2713 tpcnr[gpc]--;
2714
2715 data[tpc / 6] |= gpc << ((tpc % 6) * 5);
2716 }
2717
2718 for (; tpc < 32; tpc++)
2719 data[tpc / 6] |= 7 << ((tpc % 6) * 5);
2720
2721 /* and the second... */
2722 shift = 0;
2723 ntpcv = priv->tpc_total;
2724 while (!(ntpcv & (1 << 4))) {
2725 ntpcv <<= 1;
2726 shift++;
2727 }
2728
2729 data2[0] = ntpcv << 16;
2730 data2[0] |= shift << 21;
2731 data2[0] |= (((1 << (0 + 5)) % ntpcv) << 24);
2732 data2[0] |= priv->tpc_total << 8;
2733 data2[0] |= priv->magic_not_rop_nr;
2734 for (i = 1; i < 7; i++)
2735 data2[1] |= ((1 << (i + 5)) % ntpcv) << ((i - 1) * 5);
2736
2737 /* and write it all the various parts of PGRAPH */
2738 nv_wr32(priv, 0x418bb8, (priv->tpc_total << 8) | priv->magic_not_rop_nr);
2739 for (i = 0; i < 6; i++)
2740 nv_wr32(priv, 0x418b08 + (i * 4), data[i]);
2741
2742 nv_wr32(priv, 0x41bfd0, data2[0]);
2743 nv_wr32(priv, 0x41bfe4, data2[1]);
2744 for (i = 0; i < 6; i++)
2745 nv_wr32(priv, 0x41bf00 + (i * 4), data[i]);
2746
2747 nv_wr32(priv, 0x4078bc, (priv->tpc_total << 8) | priv->magic_not_rop_nr);
2748 for (i = 0; i < 6; i++)
2749 nv_wr32(priv, 0x40780c + (i * 4), data[i]);
2750
2751
2752 memcpy(tpcnr, priv->tpc_nr, sizeof(priv->tpc_nr));
2753 for (gpc = 0; gpc < priv->gpc_nr; gpc++)
2754 tpc_mask |= ((1 << priv->tpc_nr[gpc]) - 1) << (gpc * 8);
2755
2756 for (i = 0, gpc = -1, b = -1; i < 32; i++) {
2757 a = (i * (priv->tpc_total - 1)) / 32;
2758 if (a != b) {
2759 b = a;
2760 do {
2761 gpc = (gpc + 1) % priv->gpc_nr;
2762 } while (!tpcnr[gpc]);
2763 tpc = priv->tpc_nr[gpc] - tpcnr[gpc]--;
2764
2765 tpc_set |= 1 << ((gpc * 8) + tpc);
2766 }
2767
2768 nv_wr32(priv, 0x406800 + (i * 0x20), tpc_set);
2769 nv_wr32(priv, 0x406c00 + (i * 0x20), tpc_set ^ tpc_mask);
2770 }
2771
2772 for (i = 0; i < 8; i++)
2773 nv_wr32(priv, 0x4064d0 + (i * 0x04), 0x00000000);
2774
2775 nv_wr32(priv, 0x405b00, (priv->tpc_total << 8) | priv->gpc_nr);
2776 if (priv->gpc_nr == 1) {
2777 nv_mask(priv, 0x408850, 0x0000000f, priv->tpc_nr[0]);
2778 nv_mask(priv, 0x408958, 0x0000000f, priv->tpc_nr[0]);
2779 } else {
2780 nv_mask(priv, 0x408850, 0x0000000f, priv->gpc_nr);
2781 nv_mask(priv, 0x408958, 0x0000000f, priv->gpc_nr);
2782 }
2783 nv_mask(priv, 0x419f78, 0x00000001, 0x00000000);
2784
2785 nve0_grctx_generate_icmd(priv);
2786 nve0_grctx_generate_a097(priv);
2787 nve0_grctx_generate_902d(priv);
2788
2789 nv_mask(priv, 0x000260, 0x00000001, 0x00000001);
2790 nv_wr32(priv, 0x418800, 0x7026860a); //XXX
2791 nv_wr32(priv, 0x41be10, 0x00bb8bc7); //XXX
2792 return nvc0_grctx_fini(&info);
2793}
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnve4.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnve4.c
new file mode 100644
index 000000000000..e2de73ee5eee
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnve4.c
@@ -0,0 +1,1018 @@
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 <bskeggs@redhat.com>
23 */
24
25#include "nvc0.h"
26
27struct nvc0_graph_init
28nve4_grctx_init_icmd[] = {
29 { 0x001000, 1, 0x01, 0x00000004 },
30 { 0x000039, 3, 0x01, 0x00000000 },
31 { 0x0000a9, 1, 0x01, 0x0000ffff },
32 { 0x000038, 1, 0x01, 0x0fac6881 },
33 { 0x00003d, 1, 0x01, 0x00000001 },
34 { 0x0000e8, 8, 0x01, 0x00000400 },
35 { 0x000078, 8, 0x01, 0x00000300 },
36 { 0x000050, 1, 0x01, 0x00000011 },
37 { 0x000058, 8, 0x01, 0x00000008 },
38 { 0x000208, 8, 0x01, 0x00000001 },
39 { 0x000081, 1, 0x01, 0x00000001 },
40 { 0x000085, 1, 0x01, 0x00000004 },
41 { 0x000088, 1, 0x01, 0x00000400 },
42 { 0x000090, 1, 0x01, 0x00000300 },
43 { 0x000098, 1, 0x01, 0x00001001 },
44 { 0x0000e3, 1, 0x01, 0x00000001 },
45 { 0x0000da, 1, 0x01, 0x00000001 },
46 { 0x0000f8, 1, 0x01, 0x00000003 },
47 { 0x0000fa, 1, 0x01, 0x00000001 },
48 { 0x00009f, 4, 0x01, 0x0000ffff },
49 { 0x0000b1, 1, 0x01, 0x00000001 },
50 { 0x0000ad, 1, 0x01, 0x0000013e },
51 { 0x0000e1, 1, 0x01, 0x00000010 },
52 { 0x000290, 16, 0x01, 0x00000000 },
53 { 0x0003b0, 16, 0x01, 0x00000000 },
54 { 0x0002a0, 16, 0x01, 0x00000000 },
55 { 0x000420, 16, 0x01, 0x00000000 },
56 { 0x0002b0, 16, 0x01, 0x00000000 },
57 { 0x000430, 16, 0x01, 0x00000000 },
58 { 0x0002c0, 16, 0x01, 0x00000000 },
59 { 0x0004d0, 16, 0x01, 0x00000000 },
60 { 0x000720, 16, 0x01, 0x00000000 },
61 { 0x0008c0, 16, 0x01, 0x00000000 },
62 { 0x000890, 16, 0x01, 0x00000000 },
63 { 0x0008e0, 16, 0x01, 0x00000000 },
64 { 0x0008a0, 16, 0x01, 0x00000000 },
65 { 0x0008f0, 16, 0x01, 0x00000000 },
66 { 0x00094c, 1, 0x01, 0x000000ff },
67 { 0x00094d, 1, 0x01, 0xffffffff },
68 { 0x00094e, 1, 0x01, 0x00000002 },
69 { 0x0002ec, 1, 0x01, 0x00000001 },
70 { 0x000303, 1, 0x01, 0x00000001 },
71 { 0x0002e6, 1, 0x01, 0x00000001 },
72 { 0x000466, 1, 0x01, 0x00000052 },
73 { 0x000301, 1, 0x01, 0x3f800000 },
74 { 0x000304, 1, 0x01, 0x30201000 },
75 { 0x000305, 1, 0x01, 0x70605040 },
76 { 0x000306, 1, 0x01, 0xb8a89888 },
77 { 0x000307, 1, 0x01, 0xf8e8d8c8 },
78 { 0x00030a, 1, 0x01, 0x00ffff00 },
79 { 0x00030b, 1, 0x01, 0x0000001a },
80 { 0x00030c, 1, 0x01, 0x00000001 },
81 { 0x000318, 1, 0x01, 0x00000001 },
82 { 0x000340, 1, 0x01, 0x00000000 },
83 { 0x000375, 1, 0x01, 0x00000001 },
84 { 0x00037d, 1, 0x01, 0x00000006 },
85 { 0x0003a0, 1, 0x01, 0x00000002 },
86 { 0x0003aa, 1, 0x01, 0x00000001 },
87 { 0x0003a9, 1, 0x01, 0x00000001 },
88 { 0x000380, 1, 0x01, 0x00000001 },
89 { 0x000383, 1, 0x01, 0x00000011 },
90 { 0x000360, 1, 0x01, 0x00000040 },
91 { 0x000366, 2, 0x01, 0x00000000 },
92 { 0x000368, 1, 0x01, 0x00000fff },
93 { 0x000370, 2, 0x01, 0x00000000 },
94 { 0x000372, 1, 0x01, 0x000fffff },
95 { 0x00037a, 1, 0x01, 0x00000012 },
96 { 0x000619, 1, 0x01, 0x00000003 },
97 { 0x000811, 1, 0x01, 0x00000003 },
98 { 0x000812, 1, 0x01, 0x00000004 },
99 { 0x000813, 1, 0x01, 0x00000006 },
100 { 0x000814, 1, 0x01, 0x00000008 },
101 { 0x000815, 1, 0x01, 0x0000000b },
102 { 0x000800, 6, 0x01, 0x00000001 },
103 { 0x000632, 1, 0x01, 0x00000001 },
104 { 0x000633, 1, 0x01, 0x00000002 },
105 { 0x000634, 1, 0x01, 0x00000003 },
106 { 0x000635, 1, 0x01, 0x00000004 },
107 { 0x000654, 1, 0x01, 0x3f800000 },
108 { 0x000657, 1, 0x01, 0x3f800000 },
109 { 0x000655, 2, 0x01, 0x3f800000 },
110 { 0x0006cd, 1, 0x01, 0x3f800000 },
111 { 0x0007f5, 1, 0x01, 0x3f800000 },
112 { 0x0007dc, 1, 0x01, 0x39291909 },
113 { 0x0007dd, 1, 0x01, 0x79695949 },
114 { 0x0007de, 1, 0x01, 0xb9a99989 },
115 { 0x0007df, 1, 0x01, 0xf9e9d9c9 },
116 { 0x0007e8, 1, 0x01, 0x00003210 },
117 { 0x0007e9, 1, 0x01, 0x00007654 },
118 { 0x0007ea, 1, 0x01, 0x00000098 },
119 { 0x0007ec, 1, 0x01, 0x39291909 },
120 { 0x0007ed, 1, 0x01, 0x79695949 },
121 { 0x0007ee, 1, 0x01, 0xb9a99989 },
122 { 0x0007ef, 1, 0x01, 0xf9e9d9c9 },
123 { 0x0007f0, 1, 0x01, 0x00003210 },
124 { 0x0007f1, 1, 0x01, 0x00007654 },
125 { 0x0007f2, 1, 0x01, 0x00000098 },
126 { 0x0005a5, 1, 0x01, 0x00000001 },
127 { 0x000980, 128, 0x01, 0x00000000 },
128 { 0x000468, 1, 0x01, 0x00000004 },
129 { 0x00046c, 1, 0x01, 0x00000001 },
130 { 0x000470, 96, 0x01, 0x00000000 },
131 { 0x000510, 16, 0x01, 0x3f800000 },
132 { 0x000520, 1, 0x01, 0x000002b6 },
133 { 0x000529, 1, 0x01, 0x00000001 },
134 { 0x000530, 16, 0x01, 0xffff0000 },
135 { 0x000585, 1, 0x01, 0x0000003f },
136 { 0x000576, 1, 0x01, 0x00000003 },
137 { 0x00057b, 1, 0x01, 0x00000059 },
138 { 0x000586, 1, 0x01, 0x00000040 },
139 { 0x000582, 2, 0x01, 0x00000080 },
140 { 0x0005c2, 1, 0x01, 0x00000001 },
141 { 0x000638, 1, 0x01, 0x00000001 },
142 { 0x000639, 1, 0x01, 0x00000001 },
143 { 0x00063a, 1, 0x01, 0x00000002 },
144 { 0x00063b, 2, 0x01, 0x00000001 },
145 { 0x00063d, 1, 0x01, 0x00000002 },
146 { 0x00063e, 1, 0x01, 0x00000001 },
147 { 0x0008b8, 8, 0x01, 0x00000001 },
148 { 0x000900, 8, 0x01, 0x00000001 },
149 { 0x000908, 8, 0x01, 0x00000002 },
150 { 0x000910, 16, 0x01, 0x00000001 },
151 { 0x000920, 8, 0x01, 0x00000002 },
152 { 0x000928, 8, 0x01, 0x00000001 },
153 { 0x000648, 9, 0x01, 0x00000001 },
154 { 0x000658, 1, 0x01, 0x0000000f },
155 { 0x0007ff, 1, 0x01, 0x0000000a },
156 { 0x00066a, 1, 0x01, 0x40000000 },
157 { 0x00066b, 1, 0x01, 0x10000000 },
158 { 0x00066c, 2, 0x01, 0xffff0000 },
159 { 0x0007af, 2, 0x01, 0x00000008 },
160 { 0x0007f6, 1, 0x01, 0x00000001 },
161 { 0x0006b2, 1, 0x01, 0x00000055 },
162 { 0x0007ad, 1, 0x01, 0x00000003 },
163 { 0x000937, 1, 0x01, 0x00000001 },
164 { 0x000971, 1, 0x01, 0x00000008 },
165 { 0x000972, 1, 0x01, 0x00000040 },
166 { 0x000973, 1, 0x01, 0x0000012c },
167 { 0x00097c, 1, 0x01, 0x00000040 },
168 { 0x000979, 1, 0x01, 0x00000003 },
169 { 0x000975, 1, 0x01, 0x00000020 },
170 { 0x000976, 1, 0x01, 0x00000001 },
171 { 0x000977, 1, 0x01, 0x00000020 },
172 { 0x000978, 1, 0x01, 0x00000001 },
173 { 0x000957, 1, 0x01, 0x00000003 },
174 { 0x00095e, 1, 0x01, 0x20164010 },
175 { 0x00095f, 1, 0x01, 0x00000020 },
176 { 0x00097d, 1, 0x01, 0x00000020 },
177 { 0x000683, 1, 0x01, 0x00000006 },
178 { 0x000685, 1, 0x01, 0x003fffff },
179 { 0x000687, 1, 0x01, 0x003fffff },
180 { 0x0006a0, 1, 0x01, 0x00000005 },
181 { 0x000840, 1, 0x01, 0x00400008 },
182 { 0x000841, 1, 0x01, 0x08000080 },
183 { 0x000842, 1, 0x01, 0x00400008 },
184 { 0x000843, 1, 0x01, 0x08000080 },
185 { 0x0006aa, 1, 0x01, 0x00000001 },
186 { 0x0006ab, 1, 0x01, 0x00000002 },
187 { 0x0006ac, 1, 0x01, 0x00000080 },
188 { 0x0006ad, 2, 0x01, 0x00000100 },
189 { 0x0006b1, 1, 0x01, 0x00000011 },
190 { 0x0006bb, 1, 0x01, 0x000000cf },
191 { 0x0006ce, 1, 0x01, 0x2a712488 },
192 { 0x000739, 1, 0x01, 0x4085c000 },
193 { 0x00073a, 1, 0x01, 0x00000080 },
194 { 0x000786, 1, 0x01, 0x80000100 },
195 { 0x00073c, 1, 0x01, 0x00010100 },
196 { 0x00073d, 1, 0x01, 0x02800000 },
197 { 0x000787, 1, 0x01, 0x000000cf },
198 { 0x00078c, 1, 0x01, 0x00000008 },
199 { 0x000792, 1, 0x01, 0x00000001 },
200 { 0x000794, 1, 0x01, 0x00000001 },
201 { 0x000795, 2, 0x01, 0x00000001 },
202 { 0x000797, 1, 0x01, 0x000000cf },
203 { 0x000836, 1, 0x01, 0x00000001 },
204 { 0x00079a, 1, 0x01, 0x00000002 },
205 { 0x000833, 1, 0x01, 0x04444480 },
206 { 0x0007a1, 1, 0x01, 0x00000001 },
207 { 0x0007a3, 1, 0x01, 0x00000001 },
208 { 0x0007a4, 2, 0x01, 0x00000001 },
209 { 0x000831, 1, 0x01, 0x00000004 },
210 { 0x000b07, 1, 0x01, 0x00000002 },
211 { 0x000b08, 2, 0x01, 0x00000100 },
212 { 0x000b0a, 1, 0x01, 0x00000001 },
213 { 0x000a04, 1, 0x01, 0x000000ff },
214 { 0x000a0b, 1, 0x01, 0x00000040 },
215 { 0x00097f, 1, 0x01, 0x00000100 },
216 { 0x000a02, 1, 0x01, 0x00000001 },
217 { 0x000809, 1, 0x01, 0x00000007 },
218 { 0x00c221, 1, 0x01, 0x00000040 },
219 { 0x00c1b0, 8, 0x01, 0x0000000f },
220 { 0x00c1b8, 1, 0x01, 0x0fac6881 },
221 { 0x00c1b9, 1, 0x01, 0x00fac688 },
222 { 0x00c401, 1, 0x01, 0x00000001 },
223 { 0x00c402, 1, 0x01, 0x00010001 },
224 { 0x00c403, 2, 0x01, 0x00000001 },
225 { 0x00c40e, 1, 0x01, 0x00000020 },
226 { 0x00c500, 1, 0x01, 0x00000003 },
227 { 0x01e100, 1, 0x01, 0x00000001 },
228 { 0x001000, 1, 0x01, 0x00000002 },
229 { 0x0006aa, 1, 0x01, 0x00000001 },
230 { 0x0006ad, 2, 0x01, 0x00000100 },
231 { 0x0006b1, 1, 0x01, 0x00000011 },
232 { 0x00078c, 1, 0x01, 0x00000008 },
233 { 0x000792, 1, 0x01, 0x00000001 },
234 { 0x000794, 1, 0x01, 0x00000001 },
235 { 0x000795, 2, 0x01, 0x00000001 },
236 { 0x000797, 1, 0x01, 0x000000cf },
237 { 0x00079a, 1, 0x01, 0x00000002 },
238 { 0x000833, 1, 0x01, 0x04444480 },
239 { 0x0007a1, 1, 0x01, 0x00000001 },
240 { 0x0007a3, 1, 0x01, 0x00000001 },
241 { 0x0007a4, 2, 0x01, 0x00000001 },
242 { 0x000831, 1, 0x01, 0x00000004 },
243 { 0x01e100, 1, 0x01, 0x00000001 },
244 { 0x001000, 1, 0x01, 0x00000008 },
245 { 0x000039, 3, 0x01, 0x00000000 },
246 { 0x000380, 1, 0x01, 0x00000001 },
247 { 0x000366, 2, 0x01, 0x00000000 },
248 { 0x000368, 1, 0x01, 0x00000fff },
249 { 0x000370, 2, 0x01, 0x00000000 },
250 { 0x000372, 1, 0x01, 0x000fffff },
251 { 0x000813, 1, 0x01, 0x00000006 },
252 { 0x000814, 1, 0x01, 0x00000008 },
253 { 0x000957, 1, 0x01, 0x00000003 },
254 { 0x000b07, 1, 0x01, 0x00000002 },
255 { 0x000b08, 2, 0x01, 0x00000100 },
256 { 0x000b0a, 1, 0x01, 0x00000001 },
257 { 0x000a04, 1, 0x01, 0x000000ff },
258 { 0x00097f, 1, 0x01, 0x00000100 },
259 { 0x000a02, 1, 0x01, 0x00000001 },
260 { 0x000809, 1, 0x01, 0x00000007 },
261 { 0x00c221, 1, 0x01, 0x00000040 },
262 { 0x00c401, 1, 0x01, 0x00000001 },
263 { 0x00c402, 1, 0x01, 0x00010001 },
264 { 0x00c403, 2, 0x01, 0x00000001 },
265 { 0x00c40e, 1, 0x01, 0x00000020 },
266 { 0x00c500, 1, 0x01, 0x00000003 },
267 { 0x01e100, 1, 0x01, 0x00000001 },
268 { 0x001000, 1, 0x01, 0x00000001 },
269 { 0x000b07, 1, 0x01, 0x00000002 },
270 { 0x000b08, 2, 0x01, 0x00000100 },
271 { 0x000b0a, 1, 0x01, 0x00000001 },
272 { 0x01e100, 1, 0x01, 0x00000001 },
273 {}
274};
275
276struct nvc0_graph_init
277nve4_grctx_init_a097[] = {
278 { 0x000800, 8, 0x40, 0x00000000 },
279 { 0x000804, 8, 0x40, 0x00000000 },
280 { 0x000808, 8, 0x40, 0x00000400 },
281 { 0x00080c, 8, 0x40, 0x00000300 },
282 { 0x000810, 1, 0x04, 0x000000cf },
283 { 0x000850, 7, 0x40, 0x00000000 },
284 { 0x000814, 8, 0x40, 0x00000040 },
285 { 0x000818, 8, 0x40, 0x00000001 },
286 { 0x00081c, 8, 0x40, 0x00000000 },
287 { 0x000820, 8, 0x40, 0x00000000 },
288 { 0x001c00, 16, 0x10, 0x00000000 },
289 { 0x001c04, 16, 0x10, 0x00000000 },
290 { 0x001c08, 16, 0x10, 0x00000000 },
291 { 0x001c0c, 16, 0x10, 0x00000000 },
292 { 0x001d00, 16, 0x10, 0x00000000 },
293 { 0x001d04, 16, 0x10, 0x00000000 },
294 { 0x001d08, 16, 0x10, 0x00000000 },
295 { 0x001d0c, 16, 0x10, 0x00000000 },
296 { 0x001f00, 16, 0x08, 0x00000000 },
297 { 0x001f04, 16, 0x08, 0x00000000 },
298 { 0x001f80, 16, 0x08, 0x00000000 },
299 { 0x001f84, 16, 0x08, 0x00000000 },
300 { 0x002000, 1, 0x04, 0x00000000 },
301 { 0x002040, 1, 0x04, 0x00000011 },
302 { 0x002080, 1, 0x04, 0x00000020 },
303 { 0x0020c0, 1, 0x04, 0x00000030 },
304 { 0x002100, 1, 0x04, 0x00000040 },
305 { 0x002140, 1, 0x04, 0x00000051 },
306 { 0x00200c, 6, 0x40, 0x00000001 },
307 { 0x002010, 1, 0x04, 0x00000000 },
308 { 0x002050, 1, 0x04, 0x00000000 },
309 { 0x002090, 1, 0x04, 0x00000001 },
310 { 0x0020d0, 1, 0x04, 0x00000002 },
311 { 0x002110, 1, 0x04, 0x00000003 },
312 { 0x002150, 1, 0x04, 0x00000004 },
313 { 0x000380, 4, 0x20, 0x00000000 },
314 { 0x000384, 4, 0x20, 0x00000000 },
315 { 0x000388, 4, 0x20, 0x00000000 },
316 { 0x00038c, 4, 0x20, 0x00000000 },
317 { 0x000700, 4, 0x10, 0x00000000 },
318 { 0x000704, 4, 0x10, 0x00000000 },
319 { 0x000708, 4, 0x10, 0x00000000 },
320 { 0x002800, 128, 0x04, 0x00000000 },
321 { 0x000a00, 16, 0x20, 0x00000000 },
322 { 0x000a04, 16, 0x20, 0x00000000 },
323 { 0x000a08, 16, 0x20, 0x00000000 },
324 { 0x000a0c, 16, 0x20, 0x00000000 },
325 { 0x000a10, 16, 0x20, 0x00000000 },
326 { 0x000a14, 16, 0x20, 0x00000000 },
327 { 0x000c00, 16, 0x10, 0x00000000 },
328 { 0x000c04, 16, 0x10, 0x00000000 },
329 { 0x000c08, 16, 0x10, 0x00000000 },
330 { 0x000c0c, 16, 0x10, 0x3f800000 },
331 { 0x000d00, 8, 0x08, 0xffff0000 },
332 { 0x000d04, 8, 0x08, 0xffff0000 },
333 { 0x000e00, 16, 0x10, 0x00000000 },
334 { 0x000e04, 16, 0x10, 0xffff0000 },
335 { 0x000e08, 16, 0x10, 0xffff0000 },
336 { 0x000d40, 4, 0x08, 0x00000000 },
337 { 0x000d44, 4, 0x08, 0x00000000 },
338 { 0x001e00, 8, 0x20, 0x00000001 },
339 { 0x001e04, 8, 0x20, 0x00000001 },
340 { 0x001e08, 8, 0x20, 0x00000002 },
341 { 0x001e0c, 8, 0x20, 0x00000001 },
342 { 0x001e10, 8, 0x20, 0x00000001 },
343 { 0x001e14, 8, 0x20, 0x00000002 },
344 { 0x001e18, 8, 0x20, 0x00000001 },
345 { 0x003400, 128, 0x04, 0x00000000 },
346 { 0x00030c, 1, 0x04, 0x00000001 },
347 { 0x001944, 1, 0x04, 0x00000000 },
348 { 0x001514, 1, 0x04, 0x00000000 },
349 { 0x000d68, 1, 0x04, 0x0000ffff },
350 { 0x00121c, 1, 0x04, 0x0fac6881 },
351 { 0x000fac, 1, 0x04, 0x00000001 },
352 { 0x001538, 1, 0x04, 0x00000001 },
353 { 0x000fe0, 2, 0x04, 0x00000000 },
354 { 0x000fe8, 1, 0x04, 0x00000014 },
355 { 0x000fec, 1, 0x04, 0x00000040 },
356 { 0x000ff0, 1, 0x04, 0x00000000 },
357 { 0x00179c, 1, 0x04, 0x00000000 },
358 { 0x001228, 1, 0x04, 0x00000400 },
359 { 0x00122c, 1, 0x04, 0x00000300 },
360 { 0x001230, 1, 0x04, 0x00010001 },
361 { 0x0007f8, 1, 0x04, 0x00000000 },
362 { 0x0015b4, 1, 0x04, 0x00000001 },
363 { 0x0015cc, 1, 0x04, 0x00000000 },
364 { 0x001534, 1, 0x04, 0x00000000 },
365 { 0x000fb0, 1, 0x04, 0x00000000 },
366 { 0x0015d0, 1, 0x04, 0x00000000 },
367 { 0x00153c, 1, 0x04, 0x00000000 },
368 { 0x0016b4, 1, 0x04, 0x00000003 },
369 { 0x000fbc, 4, 0x04, 0x0000ffff },
370 { 0x000df8, 2, 0x04, 0x00000000 },
371 { 0x001948, 1, 0x04, 0x00000000 },
372 { 0x001970, 1, 0x04, 0x00000001 },
373 { 0x00161c, 1, 0x04, 0x000009f0 },
374 { 0x000dcc, 1, 0x04, 0x00000010 },
375 { 0x00163c, 1, 0x04, 0x00000000 },
376 { 0x0015e4, 1, 0x04, 0x00000000 },
377 { 0x001160, 32, 0x04, 0x25e00040 },
378 { 0x001880, 32, 0x04, 0x00000000 },
379 { 0x000f84, 2, 0x04, 0x00000000 },
380 { 0x0017c8, 2, 0x04, 0x00000000 },
381 { 0x0017d0, 1, 0x04, 0x000000ff },
382 { 0x0017d4, 1, 0x04, 0xffffffff },
383 { 0x0017d8, 1, 0x04, 0x00000002 },
384 { 0x0017dc, 1, 0x04, 0x00000000 },
385 { 0x0015f4, 2, 0x04, 0x00000000 },
386 { 0x001434, 2, 0x04, 0x00000000 },
387 { 0x000d74, 1, 0x04, 0x00000000 },
388 { 0x000dec, 1, 0x04, 0x00000001 },
389 { 0x0013a4, 1, 0x04, 0x00000000 },
390 { 0x001318, 1, 0x04, 0x00000001 },
391 { 0x001644, 1, 0x04, 0x00000000 },
392 { 0x000748, 1, 0x04, 0x00000000 },
393 { 0x000de8, 1, 0x04, 0x00000000 },
394 { 0x001648, 1, 0x04, 0x00000000 },
395 { 0x0012a4, 1, 0x04, 0x00000000 },
396 { 0x001120, 4, 0x04, 0x00000000 },
397 { 0x001118, 1, 0x04, 0x00000000 },
398 { 0x00164c, 1, 0x04, 0x00000000 },
399 { 0x001658, 1, 0x04, 0x00000000 },
400 { 0x001910, 1, 0x04, 0x00000290 },
401 { 0x001518, 1, 0x04, 0x00000000 },
402 { 0x00165c, 1, 0x04, 0x00000001 },
403 { 0x001520, 1, 0x04, 0x00000000 },
404 { 0x001604, 1, 0x04, 0x00000000 },
405 { 0x001570, 1, 0x04, 0x00000000 },
406 { 0x0013b0, 2, 0x04, 0x3f800000 },
407 { 0x00020c, 1, 0x04, 0x00000000 },
408 { 0x001670, 1, 0x04, 0x30201000 },
409 { 0x001674, 1, 0x04, 0x70605040 },
410 { 0x001678, 1, 0x04, 0xb8a89888 },
411 { 0x00167c, 1, 0x04, 0xf8e8d8c8 },
412 { 0x00166c, 1, 0x04, 0x00000000 },
413 { 0x001680, 1, 0x04, 0x00ffff00 },
414 { 0x0012d0, 1, 0x04, 0x00000003 },
415 { 0x0012d4, 1, 0x04, 0x00000002 },
416 { 0x001684, 2, 0x04, 0x00000000 },
417 { 0x000dac, 2, 0x04, 0x00001b02 },
418 { 0x000db4, 1, 0x04, 0x00000000 },
419 { 0x00168c, 1, 0x04, 0x00000000 },
420 { 0x0015bc, 1, 0x04, 0x00000000 },
421 { 0x00156c, 1, 0x04, 0x00000000 },
422 { 0x00187c, 1, 0x04, 0x00000000 },
423 { 0x001110, 1, 0x04, 0x00000001 },
424 { 0x000dc0, 3, 0x04, 0x00000000 },
425 { 0x001234, 1, 0x04, 0x00000000 },
426 { 0x001690, 1, 0x04, 0x00000000 },
427 { 0x0012ac, 1, 0x04, 0x00000001 },
428 { 0x000790, 5, 0x04, 0x00000000 },
429 { 0x00077c, 1, 0x04, 0x00000000 },
430 { 0x001000, 1, 0x04, 0x00000010 },
431 { 0x0010fc, 1, 0x04, 0x00000000 },
432 { 0x001290, 1, 0x04, 0x00000000 },
433 { 0x000218, 1, 0x04, 0x00000010 },
434 { 0x0012d8, 1, 0x04, 0x00000000 },
435 { 0x0012dc, 1, 0x04, 0x00000010 },
436 { 0x000d94, 1, 0x04, 0x00000001 },
437 { 0x00155c, 2, 0x04, 0x00000000 },
438 { 0x001564, 1, 0x04, 0x00000fff },
439 { 0x001574, 2, 0x04, 0x00000000 },
440 { 0x00157c, 1, 0x04, 0x000fffff },
441 { 0x001354, 1, 0x04, 0x00000000 },
442 { 0x001610, 1, 0x04, 0x00000012 },
443 { 0x001608, 2, 0x04, 0x00000000 },
444 { 0x00260c, 1, 0x04, 0x00000000 },
445 { 0x0007ac, 1, 0x04, 0x00000000 },
446 { 0x00162c, 1, 0x04, 0x00000003 },
447 { 0x000210, 1, 0x04, 0x00000000 },
448 { 0x000320, 1, 0x04, 0x00000000 },
449 { 0x000324, 6, 0x04, 0x3f800000 },
450 { 0x000750, 1, 0x04, 0x00000000 },
451 { 0x000760, 1, 0x04, 0x39291909 },
452 { 0x000764, 1, 0x04, 0x79695949 },
453 { 0x000768, 1, 0x04, 0xb9a99989 },
454 { 0x00076c, 1, 0x04, 0xf9e9d9c9 },
455 { 0x000770, 1, 0x04, 0x30201000 },
456 { 0x000774, 1, 0x04, 0x70605040 },
457 { 0x000778, 1, 0x04, 0x00009080 },
458 { 0x000780, 1, 0x04, 0x39291909 },
459 { 0x000784, 1, 0x04, 0x79695949 },
460 { 0x000788, 1, 0x04, 0xb9a99989 },
461 { 0x00078c, 1, 0x04, 0xf9e9d9c9 },
462 { 0x0007d0, 1, 0x04, 0x30201000 },
463 { 0x0007d4, 1, 0x04, 0x70605040 },
464 { 0x0007d8, 1, 0x04, 0x00009080 },
465 { 0x00037c, 1, 0x04, 0x00000001 },
466 { 0x000740, 2, 0x04, 0x00000000 },
467 { 0x002600, 1, 0x04, 0x00000000 },
468 { 0x001918, 1, 0x04, 0x00000000 },
469 { 0x00191c, 1, 0x04, 0x00000900 },
470 { 0x001920, 1, 0x04, 0x00000405 },
471 { 0x001308, 1, 0x04, 0x00000001 },
472 { 0x001924, 1, 0x04, 0x00000000 },
473 { 0x0013ac, 1, 0x04, 0x00000000 },
474 { 0x00192c, 1, 0x04, 0x00000001 },
475 { 0x00193c, 1, 0x04, 0x00002c1c },
476 { 0x000d7c, 1, 0x04, 0x00000000 },
477 { 0x000f8c, 1, 0x04, 0x00000000 },
478 { 0x0002c0, 1, 0x04, 0x00000001 },
479 { 0x001510, 1, 0x04, 0x00000000 },
480 { 0x001940, 1, 0x04, 0x00000000 },
481 { 0x000ff4, 2, 0x04, 0x00000000 },
482 { 0x00194c, 2, 0x04, 0x00000000 },
483 { 0x001968, 1, 0x04, 0x00000000 },
484 { 0x001590, 1, 0x04, 0x0000003f },
485 { 0x0007e8, 4, 0x04, 0x00000000 },
486 { 0x00196c, 1, 0x04, 0x00000011 },
487 { 0x0002e4, 1, 0x04, 0x0000b001 },
488 { 0x00036c, 2, 0x04, 0x00000000 },
489 { 0x00197c, 1, 0x04, 0x00000000 },
490 { 0x000fcc, 2, 0x04, 0x00000000 },
491 { 0x0002d8, 1, 0x04, 0x00000040 },
492 { 0x001980, 1, 0x04, 0x00000080 },
493 { 0x001504, 1, 0x04, 0x00000080 },
494 { 0x001984, 1, 0x04, 0x00000000 },
495 { 0x000300, 1, 0x04, 0x00000001 },
496 { 0x0013a8, 1, 0x04, 0x00000000 },
497 { 0x0012ec, 1, 0x04, 0x00000000 },
498 { 0x001310, 1, 0x04, 0x00000000 },
499 { 0x001314, 1, 0x04, 0x00000001 },
500 { 0x001380, 1, 0x04, 0x00000000 },
501 { 0x001384, 4, 0x04, 0x00000001 },
502 { 0x001394, 1, 0x04, 0x00000000 },
503 { 0x00139c, 1, 0x04, 0x00000000 },
504 { 0x001398, 1, 0x04, 0x00000000 },
505 { 0x001594, 1, 0x04, 0x00000000 },
506 { 0x001598, 4, 0x04, 0x00000001 },
507 { 0x000f54, 3, 0x04, 0x00000000 },
508 { 0x0019bc, 1, 0x04, 0x00000000 },
509 { 0x000f9c, 2, 0x04, 0x00000000 },
510 { 0x0012cc, 1, 0x04, 0x00000000 },
511 { 0x0012e8, 1, 0x04, 0x00000000 },
512 { 0x00130c, 1, 0x04, 0x00000001 },
513 { 0x001360, 8, 0x04, 0x00000000 },
514 { 0x00133c, 2, 0x04, 0x00000001 },
515 { 0x001344, 1, 0x04, 0x00000002 },
516 { 0x001348, 2, 0x04, 0x00000001 },
517 { 0x001350, 1, 0x04, 0x00000002 },
518 { 0x001358, 1, 0x04, 0x00000001 },
519 { 0x0012e4, 1, 0x04, 0x00000000 },
520 { 0x00131c, 1, 0x04, 0x00000000 },
521 { 0x001320, 3, 0x04, 0x00000000 },
522 { 0x0019c0, 1, 0x04, 0x00000000 },
523 { 0x001140, 1, 0x04, 0x00000000 },
524 { 0x0019c4, 1, 0x04, 0x00000000 },
525 { 0x0019c8, 1, 0x04, 0x00001500 },
526 { 0x00135c, 1, 0x04, 0x00000000 },
527 { 0x000f90, 1, 0x04, 0x00000000 },
528 { 0x0019e0, 8, 0x04, 0x00000001 },
529 { 0x0019cc, 1, 0x04, 0x00000001 },
530 { 0x0015b8, 1, 0x04, 0x00000000 },
531 { 0x001a00, 1, 0x04, 0x00001111 },
532 { 0x001a04, 7, 0x04, 0x00000000 },
533 { 0x000d6c, 2, 0x04, 0xffff0000 },
534 { 0x0010f8, 1, 0x04, 0x00001010 },
535 { 0x000d80, 5, 0x04, 0x00000000 },
536 { 0x000da0, 1, 0x04, 0x00000000 },
537 { 0x0007a4, 2, 0x04, 0x00000000 },
538 { 0x001508, 1, 0x04, 0x80000000 },
539 { 0x00150c, 1, 0x04, 0x40000000 },
540 { 0x001668, 1, 0x04, 0x00000000 },
541 { 0x000318, 2, 0x04, 0x00000008 },
542 { 0x000d9c, 1, 0x04, 0x00000001 },
543 { 0x000374, 1, 0x04, 0x00000000 },
544 { 0x000378, 1, 0x04, 0x00000020 },
545 { 0x0007dc, 1, 0x04, 0x00000000 },
546 { 0x00074c, 1, 0x04, 0x00000055 },
547 { 0x001420, 1, 0x04, 0x00000003 },
548 { 0x0017bc, 2, 0x04, 0x00000000 },
549 { 0x0017c4, 1, 0x04, 0x00000001 },
550 { 0x001008, 1, 0x04, 0x00000008 },
551 { 0x00100c, 1, 0x04, 0x00000040 },
552 { 0x001010, 1, 0x04, 0x0000012c },
553 { 0x000d60, 1, 0x04, 0x00000040 },
554 { 0x00075c, 1, 0x04, 0x00000003 },
555 { 0x001018, 1, 0x04, 0x00000020 },
556 { 0x00101c, 1, 0x04, 0x00000001 },
557 { 0x001020, 1, 0x04, 0x00000020 },
558 { 0x001024, 1, 0x04, 0x00000001 },
559 { 0x001444, 3, 0x04, 0x00000000 },
560 { 0x000360, 1, 0x04, 0x20164010 },
561 { 0x000364, 1, 0x04, 0x00000020 },
562 { 0x000368, 1, 0x04, 0x00000000 },
563 { 0x000de4, 1, 0x04, 0x00000000 },
564 { 0x000204, 1, 0x04, 0x00000006 },
565 { 0x000208, 1, 0x04, 0x00000000 },
566 { 0x0002cc, 2, 0x04, 0x003fffff },
567 { 0x001220, 1, 0x04, 0x00000005 },
568 { 0x000fdc, 1, 0x04, 0x00000000 },
569 { 0x000f98, 1, 0x04, 0x00400008 },
570 { 0x001284, 1, 0x04, 0x08000080 },
571 { 0x001450, 1, 0x04, 0x00400008 },
572 { 0x001454, 1, 0x04, 0x08000080 },
573 { 0x000214, 1, 0x04, 0x00000000 },
574 {}
575};
576
577static struct nvc0_graph_init
578nve4_grctx_init_unk40xx[] = {
579 { 0x404010, 5, 0x04, 0x00000000 },
580 { 0x404024, 1, 0x04, 0x0000e000 },
581 { 0x404028, 1, 0x04, 0x00000000 },
582 { 0x4040a8, 1, 0x04, 0x00000000 },
583 { 0x4040ac, 7, 0x04, 0x00000000 },
584 { 0x4040c8, 1, 0x04, 0xf800008f },
585 { 0x4040d0, 6, 0x04, 0x00000000 },
586 { 0x4040e8, 1, 0x04, 0x00001000 },
587 { 0x4040f8, 1, 0x04, 0x00000000 },
588 { 0x404130, 1, 0x04, 0x00000000 },
589 { 0x404134, 1, 0x04, 0x00000000 },
590 { 0x404138, 1, 0x04, 0x20000040 },
591 { 0x404150, 1, 0x04, 0x0000002e },
592 { 0x404154, 1, 0x04, 0x00000400 },
593 { 0x404158, 1, 0x04, 0x00000200 },
594 { 0x404164, 1, 0x04, 0x00000055 },
595 { 0x4041a0, 4, 0x04, 0x00000000 },
596 { 0x404200, 4, 0x04, 0x00000000 },
597 {}
598};
599
600struct nvc0_graph_init
601nve4_grctx_init_unk46xx[] = {
602 { 0x404604, 1, 0x04, 0x00000014 },
603 { 0x404608, 1, 0x04, 0x00000000 },
604 { 0x40460c, 1, 0x04, 0x00003fff },
605 { 0x404610, 1, 0x04, 0x00000100 },
606 { 0x404618, 4, 0x04, 0x00000000 },
607 { 0x40462c, 2, 0x04, 0x00000000 },
608 { 0x404640, 1, 0x04, 0x00000000 },
609 { 0x404654, 1, 0x04, 0x00000000 },
610 { 0x404660, 1, 0x04, 0x00000000 },
611 { 0x404678, 1, 0x04, 0x00000000 },
612 { 0x40467c, 1, 0x04, 0x00000002 },
613 { 0x404680, 8, 0x04, 0x00000000 },
614 { 0x4046a0, 1, 0x04, 0x007f0080 },
615 { 0x4046a4, 8, 0x04, 0x00000000 },
616 { 0x4046c8, 3, 0x04, 0x00000000 },
617 {}
618};
619
620struct nvc0_graph_init
621nve4_grctx_init_unk47xx[] = {
622 { 0x404700, 3, 0x04, 0x00000000 },
623 { 0x404718, 7, 0x04, 0x00000000 },
624 { 0x404734, 1, 0x04, 0x00000100 },
625 { 0x404738, 2, 0x04, 0x00000000 },
626 { 0x404744, 2, 0x04, 0x00000000 },
627 { 0x404754, 1, 0x04, 0x00000000 },
628 {}
629};
630
631struct nvc0_graph_init
632nve4_grctx_init_unk58xx[] = {
633 { 0x405800, 1, 0x04, 0x0f8000bf },
634 { 0x405830, 1, 0x04, 0x02180648 },
635 { 0x405834, 1, 0x04, 0x08000000 },
636 { 0x405838, 1, 0x04, 0x00000000 },
637 { 0x405854, 1, 0x04, 0x00000000 },
638 { 0x405870, 4, 0x04, 0x00000001 },
639 { 0x405a00, 2, 0x04, 0x00000000 },
640 { 0x405a18, 1, 0x04, 0x00000000 },
641 {}
642};
643
644static struct nvc0_graph_init
645nve4_grctx_init_unk5bxx[] = {
646 { 0x405b00, 1, 0x04, 0x00000000 },
647 { 0x405b10, 1, 0x04, 0x00001000 },
648 {}
649};
650
651static struct nvc0_graph_init
652nve4_grctx_init_unk60xx[] = {
653 { 0x406020, 1, 0x04, 0x004103c1 },
654 { 0x406028, 4, 0x04, 0x00000001 },
655 {}
656};
657
658static struct nvc0_graph_init
659nve4_grctx_init_unk64xx[] = {
660 { 0x4064a8, 1, 0x04, 0x00000000 },
661 { 0x4064ac, 1, 0x04, 0x00003fff },
662 { 0x4064b4, 2, 0x04, 0x00000000 },
663 { 0x4064c0, 1, 0x04, 0x801a00f0 },
664 { 0x4064c4, 1, 0x04, 0x0192ffff },
665 { 0x4064c8, 1, 0x04, 0x01800600 },
666 { 0x4064cc, 9, 0x04, 0x00000000 },
667 { 0x4064fc, 1, 0x04, 0x0000022a },
668 {}
669};
670
671static struct nvc0_graph_init
672nve4_grctx_init_unk70xx[] = {
673 { 0x407040, 1, 0x04, 0x00000000 },
674 {}
675};
676
677struct nvc0_graph_init
678nve4_grctx_init_unk80xx[] = {
679 { 0x408000, 2, 0x04, 0x00000000 },
680 { 0x408008, 1, 0x04, 0x00000030 },
681 { 0x40800c, 2, 0x04, 0x00000000 },
682 { 0x408014, 1, 0x04, 0x00000069 },
683 { 0x408018, 1, 0x04, 0xe100e100 },
684 { 0x408064, 1, 0x04, 0x00000000 },
685 {}
686};
687
688static struct nvc0_graph_init
689nve4_grctx_init_rop[] = {
690 { 0x408800, 1, 0x04, 0x02802a3c },
691 { 0x408804, 1, 0x04, 0x00000040 },
692 { 0x408808, 1, 0x04, 0x1043e005 },
693 { 0x408840, 1, 0x04, 0x0000000b },
694 { 0x408900, 1, 0x04, 0x3080b801 },
695 { 0x408904, 1, 0x04, 0x62000001 },
696 { 0x408908, 1, 0x04, 0x00c8102f },
697 { 0x408980, 1, 0x04, 0x0000011d },
698 {}
699};
700
701static struct nvc0_graph_init
702nve4_grctx_init_gpc_0[] = {
703 { 0x418380, 1, 0x04, 0x00000016 },
704 { 0x418400, 1, 0x04, 0x38004e00 },
705 { 0x418404, 1, 0x04, 0x71e0ffff },
706 { 0x41840c, 1, 0x04, 0x00001008 },
707 { 0x418410, 1, 0x04, 0x0fff0fff },
708 { 0x418414, 1, 0x04, 0x02200fff },
709 { 0x418450, 6, 0x04, 0x00000000 },
710 { 0x418468, 1, 0x04, 0x00000001 },
711 { 0x41846c, 2, 0x04, 0x00000000 },
712 { 0x418600, 1, 0x04, 0x0000001f },
713 { 0x418684, 1, 0x04, 0x0000000f },
714 { 0x418700, 1, 0x04, 0x00000002 },
715 { 0x418704, 1, 0x04, 0x00000080 },
716 { 0x418708, 3, 0x04, 0x00000000 },
717 { 0x418800, 1, 0x04, 0x7006860a },
718 { 0x418808, 3, 0x04, 0x00000000 },
719 { 0x418828, 1, 0x04, 0x00000044 },
720 { 0x418830, 1, 0x04, 0x10000001 },
721 { 0x4188d8, 1, 0x04, 0x00000008 },
722 { 0x4188e0, 1, 0x04, 0x01000000 },
723 { 0x4188e8, 5, 0x04, 0x00000000 },
724 { 0x4188fc, 1, 0x04, 0x20100018 },
725 { 0x41891c, 1, 0x04, 0x00ff00ff },
726 { 0x418924, 1, 0x04, 0x00000000 },
727 { 0x418928, 1, 0x04, 0x00ffff00 },
728 { 0x41892c, 1, 0x04, 0x0000ff00 },
729 { 0x418b00, 1, 0x04, 0x00000006 },
730 { 0x418b08, 1, 0x04, 0x0a418820 },
731 { 0x418b0c, 1, 0x04, 0x062080e6 },
732 { 0x418b10, 1, 0x04, 0x020398a4 },
733 { 0x418b14, 1, 0x04, 0x0e629062 },
734 { 0x418b18, 1, 0x04, 0x0a418820 },
735 { 0x418b1c, 1, 0x04, 0x000000e6 },
736 { 0x418bb8, 1, 0x04, 0x00000103 },
737 { 0x418c08, 1, 0x04, 0x00000001 },
738 { 0x418c10, 8, 0x04, 0x00000000 },
739 { 0x418c40, 1, 0x04, 0xffffffff },
740 { 0x418c6c, 1, 0x04, 0x00000001 },
741 { 0x418c80, 1, 0x04, 0x20200004 },
742 { 0x418c8c, 1, 0x04, 0x00000001 },
743 { 0x419000, 1, 0x04, 0x00000780 },
744 { 0x419004, 2, 0x04, 0x00000000 },
745 { 0x419014, 1, 0x04, 0x00000004 },
746 {}
747};
748
749static struct nvc0_graph_init
750nve4_grctx_init_tpc[] = {
751 { 0x419848, 1, 0x04, 0x00000000 },
752 { 0x419864, 1, 0x04, 0x00000129 },
753 { 0x419888, 1, 0x04, 0x00000000 },
754 { 0x419a00, 1, 0x04, 0x000000f0 },
755 { 0x419a04, 1, 0x04, 0x00000001 },
756 { 0x419a08, 1, 0x04, 0x00000021 },
757 { 0x419a0c, 1, 0x04, 0x00020000 },
758 { 0x419a10, 1, 0x04, 0x00000000 },
759 { 0x419a14, 1, 0x04, 0x00000200 },
760 { 0x419a1c, 1, 0x04, 0x0000c000 },
761 { 0x419a20, 1, 0x04, 0x00000800 },
762 { 0x419a30, 1, 0x04, 0x00000001 },
763 { 0x419ac4, 1, 0x04, 0x0037f440 },
764 { 0x419c00, 1, 0x04, 0x0000000a },
765 { 0x419c04, 1, 0x04, 0x80000006 },
766 { 0x419c08, 1, 0x04, 0x00000002 },
767 { 0x419c20, 1, 0x04, 0x00000000 },
768 { 0x419c24, 1, 0x04, 0x00084210 },
769 { 0x419c28, 1, 0x04, 0x3efbefbe },
770 { 0x419ce8, 1, 0x04, 0x00000000 },
771 { 0x419cf4, 1, 0x04, 0x00003203 },
772 { 0x419e04, 3, 0x04, 0x00000000 },
773 { 0x419e10, 1, 0x04, 0x00000402 },
774 { 0x419e44, 1, 0x04, 0x0013eff2 },
775 { 0x419e48, 1, 0x04, 0x00000000 },
776 { 0x419e4c, 1, 0x04, 0x0000007f },
777 { 0x419e50, 19, 0x04, 0x00000000 },
778 { 0x419eac, 1, 0x04, 0x00001f8f },
779 { 0x419eb0, 1, 0x04, 0x00000d3f },
780 { 0x419ec8, 1, 0x04, 0x0001304f },
781 { 0x419f30, 8, 0x04, 0x00000000 },
782 { 0x419f58, 1, 0x04, 0x00000000 },
783 { 0x419f70, 1, 0x04, 0x00000000 },
784 { 0x419f78, 1, 0x04, 0x0000000b },
785 { 0x419f7c, 1, 0x04, 0x0000027a },
786 {}
787};
788
789static struct nvc0_graph_init
790nve4_grctx_init_unk[] = {
791 { 0x41be24, 1, 0x04, 0x00000006 },
792 { 0x41bec0, 1, 0x04, 0x12180000 },
793 { 0x41bec4, 1, 0x04, 0x00037f7f },
794 { 0x41bee4, 1, 0x04, 0x06480430 },
795 { 0x41bf00, 1, 0x04, 0x0a418820 },
796 { 0x41bf04, 1, 0x04, 0x062080e6 },
797 { 0x41bf08, 1, 0x04, 0x020398a4 },
798 { 0x41bf0c, 1, 0x04, 0x0e629062 },
799 { 0x41bf10, 1, 0x04, 0x0a418820 },
800 { 0x41bf14, 1, 0x04, 0x000000e6 },
801 { 0x41bfd0, 1, 0x04, 0x00900103 },
802 { 0x41bfe0, 1, 0x04, 0x00400001 },
803 { 0x41bfe4, 1, 0x04, 0x00000000 },
804 {}
805};
806
807static void
808nve4_grctx_generate_mods(struct nvc0_graph_priv *priv, struct nvc0_grctx *info)
809{
810 u32 magic[GPC_MAX][2];
811 u32 offset;
812 int gpc;
813
814 mmio_data(0x003000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
815 mmio_data(0x008000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
816 mmio_data(0x060000, 0x1000, NV_MEM_ACCESS_RW);
817 mmio_list(0x40800c, 0x00000000, 8, 1);
818 mmio_list(0x408010, 0x80000000, 0, 0);
819 mmio_list(0x419004, 0x00000000, 8, 1);
820 mmio_list(0x419008, 0x00000000, 0, 0);
821 mmio_list(0x4064cc, 0x80000000, 0, 0);
822 mmio_list(0x408004, 0x00000000, 8, 0);
823 mmio_list(0x408008, 0x80000030, 0, 0);
824 mmio_list(0x418808, 0x00000000, 8, 0);
825 mmio_list(0x41880c, 0x80000030, 0, 0);
826 mmio_list(0x4064c8, 0x01800600, 0, 0);
827 mmio_list(0x418810, 0x80000000, 12, 2);
828 mmio_list(0x419848, 0x10000000, 12, 2);
829
830 mmio_list(0x405830, 0x02180648, 0, 0);
831 mmio_list(0x4064c4, 0x0192ffff, 0, 0);
832
833 for (gpc = 0, offset = 0; gpc < priv->gpc_nr; gpc++) {
834 u16 magic0 = 0x0218 * priv->tpc_nr[gpc];
835 u16 magic1 = 0x0648 * priv->tpc_nr[gpc];
836 magic[gpc][0] = 0x10000000 | (magic0 << 16) | offset;
837 magic[gpc][1] = 0x00000000 | (magic1 << 16);
838 offset += 0x0324 * priv->tpc_nr[gpc];
839 }
840
841 for (gpc = 0; gpc < priv->gpc_nr; gpc++) {
842 mmio_list(GPC_UNIT(gpc, 0x30c0), magic[gpc][0], 0, 0);
843 mmio_list(GPC_UNIT(gpc, 0x30e4), magic[gpc][1] | offset, 0, 0);
844 offset += 0x07ff * priv->tpc_nr[gpc];
845 }
846
847 mmio_list(0x17e91c, 0x06060609, 0, 0);
848 mmio_list(0x17e920, 0x00090a05, 0, 0);
849}
850
851void
852nve4_grctx_generate_unkn(struct nvc0_graph_priv *priv)
853{
854 nv_mask(priv, 0x418c6c, 0x00000001, 0x00000001);
855 nv_mask(priv, 0x41980c, 0x00000010, 0x00000010);
856 nv_mask(priv, 0x41be08, 0x00000004, 0x00000004);
857 nv_mask(priv, 0x4064c0, 0x80000000, 0x80000000);
858 nv_mask(priv, 0x405800, 0x08000000, 0x08000000);
859 nv_mask(priv, 0x419c00, 0x00000008, 0x00000008);
860}
861
862void
863nve4_grctx_generate_r418bb8(struct nvc0_graph_priv *priv)
864{
865 u32 data[6] = {}, data2[2] = {};
866 u8 tpcnr[GPC_MAX];
867 u8 shift, ntpcv;
868 int gpc, tpc, i;
869
870 /* calculate first set of magics */
871 memcpy(tpcnr, priv->tpc_nr, sizeof(priv->tpc_nr));
872
873 gpc = -1;
874 for (tpc = 0; tpc < priv->tpc_total; tpc++) {
875 do {
876 gpc = (gpc + 1) % priv->gpc_nr;
877 } while (!tpcnr[gpc]);
878 tpcnr[gpc]--;
879
880 data[tpc / 6] |= gpc << ((tpc % 6) * 5);
881 }
882
883 for (; tpc < 32; tpc++)
884 data[tpc / 6] |= 7 << ((tpc % 6) * 5);
885
886 /* and the second... */
887 shift = 0;
888 ntpcv = priv->tpc_total;
889 while (!(ntpcv & (1 << 4))) {
890 ntpcv <<= 1;
891 shift++;
892 }
893
894 data2[0] = (ntpcv << 16);
895 data2[0] |= (shift << 21);
896 data2[0] |= (((1 << (0 + 5)) % ntpcv) << 24);
897 for (i = 1; i < 7; i++)
898 data2[1] |= ((1 << (i + 5)) % ntpcv) << ((i - 1) * 5);
899
900 /* GPC_BROADCAST */
901 nv_wr32(priv, 0x418bb8, (priv->tpc_total << 8) |
902 priv->magic_not_rop_nr);
903 for (i = 0; i < 6; i++)
904 nv_wr32(priv, 0x418b08 + (i * 4), data[i]);
905
906 /* GPC_BROADCAST.TP_BROADCAST */
907 nv_wr32(priv, 0x41bfd0, (priv->tpc_total << 8) |
908 priv->magic_not_rop_nr | data2[0]);
909 nv_wr32(priv, 0x41bfe4, data2[1]);
910 for (i = 0; i < 6; i++)
911 nv_wr32(priv, 0x41bf00 + (i * 4), data[i]);
912
913 /* UNK78xx */
914 nv_wr32(priv, 0x4078bc, (priv->tpc_total << 8) |
915 priv->magic_not_rop_nr);
916 for (i = 0; i < 6; i++)
917 nv_wr32(priv, 0x40780c + (i * 4), data[i]);
918}
919
920void
921nve4_grctx_generate_main(struct nvc0_graph_priv *priv, struct nvc0_grctx *info)
922{
923 struct nvc0_grctx_oclass *oclass = (void *)nv_engine(priv)->cclass;
924 int i;
925
926 nv_mask(priv, 0x000260, 0x00000001, 0x00000000);
927
928 for (i = 0; oclass->hub[i]; i++)
929 nvc0_graph_mmio(priv, oclass->hub[i]);
930 for (i = 0; oclass->gpc[i]; i++)
931 nvc0_graph_mmio(priv, oclass->gpc[i]);
932
933 nv_wr32(priv, 0x404154, 0x00000000);
934
935 oclass->mods(priv, info);
936 oclass->unkn(priv);
937
938 nvc0_grctx_generate_tpcid(priv);
939 nvc0_grctx_generate_r406028(priv);
940 nve4_grctx_generate_r418bb8(priv);
941 nvc0_grctx_generate_r406800(priv);
942
943 for (i = 0; i < 8; i++)
944 nv_wr32(priv, 0x4064d0 + (i * 0x04), 0x00000000);
945
946 nv_wr32(priv, 0x405b00, (priv->tpc_total << 8) | priv->gpc_nr);
947 if (priv->gpc_nr == 1) {
948 nv_mask(priv, 0x408850, 0x0000000f, priv->tpc_nr[0]);
949 nv_mask(priv, 0x408958, 0x0000000f, priv->tpc_nr[0]);
950 } else {
951 nv_mask(priv, 0x408850, 0x0000000f, priv->gpc_nr);
952 nv_mask(priv, 0x408958, 0x0000000f, priv->gpc_nr);
953 }
954 nv_mask(priv, 0x419f78, 0x00000001, 0x00000000);
955
956 nvc0_graph_icmd(priv, oclass->icmd);
957 nv_wr32(priv, 0x404154, 0x00000400);
958 nvc0_graph_mthd(priv, oclass->mthd);
959 nv_mask(priv, 0x000260, 0x00000001, 0x00000001);
960
961 nv_mask(priv, 0x418800, 0x00200000, 0x00200000);
962 nv_mask(priv, 0x41be10, 0x00800000, 0x00800000);
963}
964
965static struct nvc0_graph_init *
966nve4_grctx_init_hub[] = {
967 nvc0_grctx_init_base,
968 nve4_grctx_init_unk40xx,
969 nvc0_grctx_init_unk44xx,
970 nve4_grctx_init_unk46xx,
971 nve4_grctx_init_unk47xx,
972 nve4_grctx_init_unk58xx,
973 nve4_grctx_init_unk5bxx,
974 nve4_grctx_init_unk60xx,
975 nve4_grctx_init_unk64xx,
976 nve4_grctx_init_unk70xx,
977 nvc0_grctx_init_unk78xx,
978 nve4_grctx_init_unk80xx,
979 nve4_grctx_init_rop,
980 NULL
981};
982
983struct nvc0_graph_init *
984nve4_grctx_init_gpc[] = {
985 nve4_grctx_init_gpc_0,
986 nvc0_grctx_init_gpc_1,
987 nve4_grctx_init_tpc,
988 nve4_grctx_init_unk,
989 NULL
990};
991
992static struct nvc0_graph_mthd
993nve4_grctx_init_mthd[] = {
994 { 0xa097, nve4_grctx_init_a097, },
995 { 0x902d, nvc0_grctx_init_902d, },
996 { 0x902d, nvc0_grctx_init_mthd_magic, },
997 {}
998};
999
1000struct nouveau_oclass *
1001nve4_grctx_oclass = &(struct nvc0_grctx_oclass) {
1002 .base.handle = NV_ENGCTX(GR, 0xe4),
1003 .base.ofuncs = &(struct nouveau_ofuncs) {
1004 .ctor = nvc0_graph_context_ctor,
1005 .dtor = nvc0_graph_context_dtor,
1006 .init = _nouveau_graph_context_init,
1007 .fini = _nouveau_graph_context_fini,
1008 .rd32 = _nouveau_graph_context_rd32,
1009 .wr32 = _nouveau_graph_context_wr32,
1010 },
1011 .main = nve4_grctx_generate_main,
1012 .mods = nve4_grctx_generate_mods,
1013 .unkn = nve4_grctx_generate_unkn,
1014 .hub = nve4_grctx_init_hub,
1015 .gpc = nve4_grctx_init_gpc,
1016 .icmd = nve4_grctx_init_icmd,
1017 .mthd = nve4_grctx_init_mthd,
1018}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvf0.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvf0.c
new file mode 100644
index 000000000000..dcb2ebb8c29d
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvf0.c
@@ -0,0 +1,328 @@
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 <bskeggs@redhat.com>
23 */
24
25#include "nvc0.h"
26
27static struct nvc0_graph_init
28nvf0_grctx_init_unk40xx[] = {
29 { 0x404004, 8, 0x04, 0x00000000 },
30 { 0x404024, 1, 0x04, 0x0000e000 },
31 { 0x404028, 8, 0x04, 0x00000000 },
32 { 0x4040a8, 8, 0x04, 0x00000000 },
33 { 0x4040c8, 1, 0x04, 0xf800008f },
34 { 0x4040d0, 6, 0x04, 0x00000000 },
35 { 0x4040e8, 1, 0x04, 0x00001000 },
36 { 0x4040f8, 1, 0x04, 0x00000000 },
37 { 0x404100, 10, 0x04, 0x00000000 },
38 { 0x404130, 2, 0x04, 0x00000000 },
39 { 0x404138, 1, 0x04, 0x20000040 },
40 { 0x404150, 1, 0x04, 0x0000002e },
41 { 0x404154, 1, 0x04, 0x00000400 },
42 { 0x404158, 1, 0x04, 0x00000200 },
43 { 0x404164, 1, 0x04, 0x00000055 },
44 { 0x40417c, 2, 0x04, 0x00000000 },
45 { 0x4041a0, 4, 0x04, 0x00000000 },
46 { 0x404200, 1, 0x04, 0x0000a197 },
47 { 0x404204, 1, 0x04, 0x0000a1c0 },
48 { 0x404208, 1, 0x04, 0x0000a140 },
49 { 0x40420c, 1, 0x04, 0x0000902d },
50 {}
51};
52
53static struct nvc0_graph_init
54nvf0_grctx_init_unk44xx[] = {
55 { 0x404404, 12, 0x04, 0x00000000 },
56 { 0x404438, 1, 0x04, 0x00000000 },
57 { 0x404460, 2, 0x04, 0x00000000 },
58 { 0x404468, 1, 0x04, 0x00ffffff },
59 { 0x40446c, 1, 0x04, 0x00000000 },
60 { 0x404480, 1, 0x04, 0x00000001 },
61 { 0x404498, 1, 0x04, 0x00000001 },
62 {}
63};
64
65static struct nvc0_graph_init
66nvf0_grctx_init_unk5bxx[] = {
67 { 0x405b00, 1, 0x04, 0x00000000 },
68 { 0x405b10, 1, 0x04, 0x00001000 },
69 { 0x405b20, 1, 0x04, 0x04000000 },
70 {}
71};
72
73static struct nvc0_graph_init
74nvf0_grctx_init_unk60xx[] = {
75 { 0x406020, 1, 0x04, 0x034103c1 },
76 { 0x406028, 4, 0x04, 0x00000001 },
77 {}
78};
79
80static struct nvc0_graph_init
81nvf0_grctx_init_unk64xx[] = {
82 { 0x4064a8, 1, 0x04, 0x00000000 },
83 { 0x4064ac, 1, 0x04, 0x00003fff },
84 { 0x4064b0, 3, 0x04, 0x00000000 },
85 { 0x4064c0, 1, 0x04, 0x802000f0 },
86 { 0x4064c4, 1, 0x04, 0x0192ffff },
87 { 0x4064c8, 1, 0x04, 0x018007c0 },
88 { 0x4064cc, 9, 0x04, 0x00000000 },
89 { 0x4064fc, 1, 0x04, 0x0000022a },
90 {}
91};
92
93static struct nvc0_graph_init
94nvf0_grctx_init_unk88xx[] = {
95 { 0x408800, 1, 0x04, 0x12802a3c },
96 { 0x408804, 1, 0x04, 0x00000040 },
97 { 0x408808, 1, 0x04, 0x1003e005 },
98 { 0x408840, 1, 0x04, 0x0000000b },
99 { 0x408900, 1, 0x04, 0x3080b801 },
100 { 0x408904, 1, 0x04, 0x62000001 },
101 { 0x408908, 1, 0x04, 0x00c8102f },
102 { 0x408980, 1, 0x04, 0x0000011d },
103 {}
104};
105
106static struct nvc0_graph_init
107nvf0_grctx_init_gpc_0[] = {
108 { 0x418380, 1, 0x04, 0x00000016 },
109 { 0x418400, 1, 0x04, 0x38004e00 },
110 { 0x418404, 1, 0x04, 0x71e0ffff },
111 { 0x41840c, 1, 0x04, 0x00001008 },
112 { 0x418410, 1, 0x04, 0x0fff0fff },
113 { 0x418414, 1, 0x04, 0x02200fff },
114 { 0x418450, 6, 0x04, 0x00000000 },
115 { 0x418468, 1, 0x04, 0x00000001 },
116 { 0x41846c, 2, 0x04, 0x00000000 },
117 { 0x418600, 1, 0x04, 0x0000001f },
118 { 0x418684, 1, 0x04, 0x0000000f },
119 { 0x418700, 1, 0x04, 0x00000002 },
120 { 0x418704, 1, 0x04, 0x00000080 },
121 { 0x418708, 3, 0x04, 0x00000000 },
122 { 0x418800, 1, 0x04, 0x7006860a },
123 { 0x418808, 1, 0x04, 0x00000000 },
124 { 0x41880c, 1, 0x04, 0x00000030 },
125 { 0x418810, 1, 0x04, 0x00000000 },
126 { 0x418828, 1, 0x04, 0x00000044 },
127 { 0x418830, 1, 0x04, 0x10000001 },
128 { 0x4188d8, 1, 0x04, 0x00000008 },
129 { 0x4188e0, 1, 0x04, 0x01000000 },
130 { 0x4188e8, 5, 0x04, 0x00000000 },
131 { 0x4188fc, 1, 0x04, 0x20100018 },
132 { 0x41891c, 1, 0x04, 0x00ff00ff },
133 { 0x418924, 1, 0x04, 0x00000000 },
134 { 0x418928, 1, 0x04, 0x00ffff00 },
135 { 0x41892c, 1, 0x04, 0x0000ff00 },
136 { 0x418b00, 1, 0x04, 0x00000006 },
137 { 0x418b08, 1, 0x04, 0x0a418820 },
138 { 0x418b0c, 1, 0x04, 0x062080e6 },
139 { 0x418b10, 1, 0x04, 0x020398a4 },
140 { 0x418b14, 1, 0x04, 0x0e629062 },
141 { 0x418b18, 1, 0x04, 0x0a418820 },
142 { 0x418b1c, 1, 0x04, 0x000000e6 },
143 { 0x418bb8, 1, 0x04, 0x00000103 },
144 { 0x418c08, 1, 0x04, 0x00000001 },
145 { 0x418c10, 8, 0x04, 0x00000000 },
146 { 0x418c40, 1, 0x04, 0xffffffff },
147 { 0x418c6c, 1, 0x04, 0x00000001 },
148 { 0x418c80, 1, 0x04, 0x20200004 },
149 { 0x418c8c, 1, 0x04, 0x00000001 },
150 { 0x418d24, 1, 0x04, 0x00000000 },
151 { 0x419000, 1, 0x04, 0x00000780 },
152 { 0x419004, 2, 0x04, 0x00000000 },
153 { 0x419014, 1, 0x04, 0x00000004 },
154 {}
155};
156
157static struct nvc0_graph_init
158nvf0_grctx_init_tpc[] = {
159 { 0x419848, 1, 0x04, 0x00000000 },
160 { 0x419864, 1, 0x04, 0x00000129 },
161 { 0x419888, 1, 0x04, 0x00000000 },
162 { 0x419a00, 1, 0x04, 0x000000f0 },
163 { 0x419a04, 1, 0x04, 0x00000001 },
164 { 0x419a08, 1, 0x04, 0x00000021 },
165 { 0x419a0c, 1, 0x04, 0x00020000 },
166 { 0x419a10, 1, 0x04, 0x00000000 },
167 { 0x419a14, 1, 0x04, 0x00000200 },
168 { 0x419a1c, 1, 0x04, 0x0000c000 },
169 { 0x419a20, 1, 0x04, 0x00020800 },
170 { 0x419a30, 1, 0x04, 0x00000001 },
171 { 0x419ac4, 1, 0x04, 0x0037f440 },
172 { 0x419c00, 1, 0x04, 0x0000001a },
173 { 0x419c04, 1, 0x04, 0x80000006 },
174 { 0x419c08, 1, 0x04, 0x00000002 },
175 { 0x419c20, 1, 0x04, 0x00000000 },
176 { 0x419c24, 1, 0x04, 0x00084210 },
177 { 0x419c28, 1, 0x04, 0x3efbefbe },
178 { 0x419ce8, 1, 0x04, 0x00000000 },
179 { 0x419cf4, 1, 0x04, 0x00000203 },
180 { 0x419e04, 1, 0x04, 0x00000000 },
181 { 0x419e08, 1, 0x04, 0x0000001d },
182 { 0x419e0c, 1, 0x04, 0x00000000 },
183 { 0x419e10, 1, 0x04, 0x00001c02 },
184 { 0x419e44, 1, 0x04, 0x0013eff2 },
185 { 0x419e48, 1, 0x04, 0x00000000 },
186 { 0x419e4c, 1, 0x04, 0x0000007f },
187 { 0x419e50, 2, 0x04, 0x00000000 },
188 { 0x419e58, 1, 0x04, 0x00000001 },
189 { 0x419e5c, 3, 0x04, 0x00000000 },
190 { 0x419e68, 1, 0x04, 0x00000002 },
191 { 0x419e6c, 12, 0x04, 0x00000000 },
192 { 0x419eac, 1, 0x04, 0x00001fcf },
193 { 0x419eb0, 1, 0x04, 0x0db00da0 },
194 { 0x419eb8, 1, 0x04, 0x00000000 },
195 { 0x419ec8, 1, 0x04, 0x0001304f },
196 { 0x419f30, 4, 0x04, 0x00000000 },
197 { 0x419f40, 1, 0x04, 0x00000018 },
198 { 0x419f44, 3, 0x04, 0x00000000 },
199 { 0x419f58, 1, 0x04, 0x00000000 },
200 { 0x419f70, 1, 0x04, 0x00007300 },
201 { 0x419f78, 1, 0x04, 0x000000eb },
202 { 0x419f7c, 1, 0x04, 0x00000404 },
203 {}
204};
205
206static struct nvc0_graph_init
207nvf0_grctx_init_unk[] = {
208 { 0x41be24, 1, 0x04, 0x00000006 },
209 { 0x41bec0, 1, 0x04, 0x10000000 },
210 { 0x41bec4, 1, 0x04, 0x00037f7f },
211 { 0x41bee4, 1, 0x04, 0x00000000 },
212 { 0x41bf00, 1, 0x04, 0x0a418820 },
213 { 0x41bf04, 1, 0x04, 0x062080e6 },
214 { 0x41bf08, 1, 0x04, 0x020398a4 },
215 { 0x41bf0c, 1, 0x04, 0x0e629062 },
216 { 0x41bf10, 1, 0x04, 0x0a418820 },
217 { 0x41bf14, 1, 0x04, 0x000000e6 },
218 { 0x41bfd0, 1, 0x04, 0x00900103 },
219 { 0x41bfe0, 1, 0x04, 0x00400001 },
220 { 0x41bfe4, 1, 0x04, 0x00000000 },
221 {}
222};
223
224static void
225nvf0_grctx_generate_mods(struct nvc0_graph_priv *priv, struct nvc0_grctx *info)
226{
227 u32 magic[GPC_MAX][4];
228 u32 offset;
229 int gpc;
230
231 mmio_data(0x003000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
232 mmio_data(0x008000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
233 mmio_data(0x060000, 0x1000, NV_MEM_ACCESS_RW);
234 mmio_list(0x40800c, 0x00000000, 8, 1);
235 mmio_list(0x408010, 0x80000000, 0, 0);
236 mmio_list(0x419004, 0x00000000, 8, 1);
237 mmio_list(0x419008, 0x00000000, 0, 0);
238 mmio_list(0x4064cc, 0x80000000, 0, 0);
239 mmio_list(0x408004, 0x00000000, 8, 0);
240 mmio_list(0x408008, 0x80000030, 0, 0);
241 mmio_list(0x418808, 0x00000000, 8, 0);
242 mmio_list(0x41880c, 0x80000030, 0, 0);
243 mmio_list(0x4064c8, 0x01800600, 0, 0);
244 mmio_list(0x418810, 0x80000000, 12, 2);
245 mmio_list(0x419848, 0x10000000, 12, 2);
246
247 mmio_list(0x405830, 0x02180648, 0, 0);
248 mmio_list(0x4064c4, 0x0192ffff, 0, 0);
249
250 for (gpc = 0, offset = 0; gpc < priv->gpc_nr; gpc++) {
251 u16 magic0 = 0x0218 * (priv->tpc_nr[gpc] - 1);
252 u16 magic1 = 0x0648 * (priv->tpc_nr[gpc] - 1);
253 u16 magic2 = 0x0218;
254 u16 magic3 = 0x0648;
255 magic[gpc][0] = 0x10000000 | (magic0 << 16) | offset;
256 magic[gpc][1] = 0x00000000 | (magic1 << 16);
257 offset += 0x0324 * (priv->tpc_nr[gpc] - 1);;
258 magic[gpc][2] = 0x10000000 | (magic2 << 16) | offset;
259 magic[gpc][3] = 0x00000000 | (magic3 << 16);
260 offset += 0x0324;
261 }
262
263 for (gpc = 0; gpc < priv->gpc_nr; gpc++) {
264 mmio_list(GPC_UNIT(gpc, 0x30c0), magic[gpc][0], 0, 0);
265 mmio_list(GPC_UNIT(gpc, 0x30e4), magic[gpc][1] | offset, 0, 0);
266 offset += 0x07ff * (priv->tpc_nr[gpc] - 1);
267 mmio_list(GPC_UNIT(gpc, 0x32c0), magic[gpc][2], 0, 0);
268 mmio_list(GPC_UNIT(gpc, 0x32e4), magic[gpc][3] | offset, 0, 0);
269 offset += 0x07ff;
270 }
271
272 mmio_list(0x17e91c, 0x06060609, 0, 0);
273 mmio_list(0x17e920, 0x00090a05, 0, 0);
274}
275
276static struct nvc0_graph_init *
277nvf0_grctx_init_hub[] = {
278 nvc0_grctx_init_base,
279 nvf0_grctx_init_unk40xx,
280 nvf0_grctx_init_unk44xx,
281 nve4_grctx_init_unk46xx,
282 nve4_grctx_init_unk47xx,
283 nve4_grctx_init_unk58xx,
284 nvf0_grctx_init_unk5bxx,
285 nvf0_grctx_init_unk60xx,
286 nvf0_grctx_init_unk64xx,
287 nve4_grctx_init_unk80xx,
288 nvf0_grctx_init_unk88xx,
289 nvd9_grctx_init_rop,
290 NULL
291};
292
293struct nvc0_graph_init *
294nvf0_grctx_init_gpc[] = {
295 nvf0_grctx_init_gpc_0,
296 nvc0_grctx_init_gpc_1,
297 nvf0_grctx_init_tpc,
298 nvf0_grctx_init_unk,
299 NULL
300};
301
302static struct nvc0_graph_mthd
303nvf0_grctx_init_mthd[] = {
304 { 0xa197, nvc1_grctx_init_9097, },
305 { 0x902d, nvc0_grctx_init_902d, },
306 { 0x902d, nvc0_grctx_init_mthd_magic, },
307 {}
308};
309
310struct nouveau_oclass *
311nvf0_grctx_oclass = &(struct nvc0_grctx_oclass) {
312 .base.handle = NV_ENGCTX(GR, 0xf0),
313 .base.ofuncs = &(struct nouveau_ofuncs) {
314 .ctor = nvc0_graph_context_ctor,
315 .dtor = nvc0_graph_context_dtor,
316 .init = _nouveau_graph_context_init,
317 .fini = _nouveau_graph_context_fini,
318 .rd32 = _nouveau_graph_context_rd32,
319 .wr32 = _nouveau_graph_context_wr32,
320 },
321 .main = nve4_grctx_generate_main,
322 .mods = nvf0_grctx_generate_mods,
323 .unkn = nve4_grctx_generate_unkn,
324 .hub = nvf0_grctx_init_hub,
325 .gpc = nvf0_grctx_init_gpc,
326 .icmd = nvc0_grctx_init_icmd,
327 .mthd = nvf0_grctx_init_mthd,
328}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/nvc0.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/com.fuc
index e6b228844a32..5d24b6de16cc 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/nvc0.fuc
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/com.fuc
@@ -23,42 +23,7 @@
23 * Authors: Ben Skeggs 23 * Authors: Ben Skeggs
24 */ 24 */
25 25
26define(`mmctx_data', `.b32 eval((($2 - 1) << 26) | $1)') 26#ifdef INCLUDE_CODE
27define(`queue_init', `.skip eval((2 * 4) + ((8 * 4) * 2))')
28
29ifdef(`include_code', `
30// Error codes
31define(`E_BAD_COMMAND', 0x01)
32define(`E_CMD_OVERFLOW', 0x02)
33
34// Util macros to help with debugging ucode hangs etc
35define(`T_WAIT', 0)
36define(`T_MMCTX', 1)
37define(`T_STRWAIT', 2)
38define(`T_STRINIT', 3)
39define(`T_AUTO', 4)
40define(`T_CHAN', 5)
41define(`T_LOAD', 6)
42define(`T_SAVE', 7)
43define(`T_LCHAN', 8)
44define(`T_LCTXH', 9)
45
46define(`trace_set', `
47 mov $r8 0x83c
48 shl b32 $r8 6
49 clear b32 $r9
50 bset $r9 $1
51 iowr I[$r8 + 0x000] $r9 // CC_SCRATCH[7]
52')
53
54define(`trace_clr', `
55 mov $r8 0x85c
56 shl b32 $r8 6
57 clear b32 $r9
58 bset $r9 $1
59 iowr I[$r8 + 0x000] $r9 // CC_SCRATCH[7]
60')
61
62// queue_put - add request to queue 27// queue_put - add request to queue
63// 28//
64// In : $r13 queue pointer 29// In : $r13 queue pointer
@@ -178,27 +143,37 @@ watchdog_clear:
178 iowr I[$r8 + 0x000] $r0 143 iowr I[$r8 + 0x000] $r0
179 ret 144 ret
180 145
181// wait_done{z,o} - wait on FUC_DONE bit to become clear/set 146// wait_donez - wait on FUC_DONE bit to become clear
147//
148// In : $r10 bit to wait on
149//
150wait_donez:
151 trace_set(T_WAIT);
152 nv_iowr(NV_PGRAPH_FECS_CC_SCRATCH_VAL(6), 0, $r10)
153 wait_donez_ne:
154 nv_iord($r8, NV_PGRAPH_FECS_SIGNAL, 0)
155 xbit $r8 $r8 $r10
156 bra ne #wait_donez_ne
157 trace_clr(T_WAIT)
158 ret
159
160// wait_doneo - wait on FUC_DONE bit to become set
182// 161//
183// In : $r10 bit to wait on 162// In : $r10 bit to wait on
184// 163//
185define(`wait_done', ` 164wait_doneo:
186$1:
187 trace_set(T_WAIT); 165 trace_set(T_WAIT);
188 mov $r8 0x818 166 mov $r8 0x818
189 shl b32 $r8 6 167 shl b32 $r8 6
190 iowr I[$r8 + 0x000] $r10 // CC_SCRATCH[6] = wait bit 168 iowr I[$r8 + 0x000] $r10
191 wait_done_$1: 169 wait_doneo_e:
192 mov $r8 0x400 170 mov $r8 0x400
193 shl b32 $r8 6 171 shl b32 $r8 6
194 iord $r8 I[$r8 + 0x000] // DONE 172 iord $r8 I[$r8 + 0x000]
195 xbit $r8 $r8 $r10 173 xbit $r8 $r8 $r10
196 bra $2 #wait_done_$1 174 bra e #wait_doneo_e
197 trace_clr(T_WAIT) 175 trace_clr(T_WAIT)
198 ret 176 ret
199')
200wait_done(wait_donez, ne)
201wait_done(wait_doneo, e)
202 177
203// mmctx_size - determine size of a mmio list transfer 178// mmctx_size - determine size of a mmio list transfer
204// 179//
@@ -397,4 +372,4 @@ strand_ctx_init:
397 sub b32 $r15 $r14 $r15 372 sub b32 $r15 $r14 $r15
398 trace_clr(T_STRINIT) 373 trace_clr(T_STRINIT)
399 ret 374 ret
400') 375#endif
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpc.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpc.fuc
new file mode 100644
index 000000000000..5547c1b3f4f2
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpc.fuc
@@ -0,0 +1,404 @@
1/* fuc microcode for nvc0 PGRAPH/GPC
2 *
3 * Copyright 2011 Red Hat Inc.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 * OTHER DEALINGS IN THE SOFTWARE.
22 *
23 * Authors: Ben Skeggs
24 */
25
26/* TODO
27 * - bracket certain functions with scratch writes, useful for debugging
28 * - watchdog timer around ctx operations
29 */
30
31#ifdef INCLUDE_DATA
32gpc_mmio_list_head: .b32 #mmio_list_base
33gpc_mmio_list_tail:
34tpc_mmio_list_head: .b32 #mmio_list_base
35tpc_mmio_list_tail:
36unk_mmio_list_head: .b32 #mmio_list_base
37unk_mmio_list_tail: .b32 #mmio_list_base
38
39gpc_id: .b32 0
40
41tpc_count: .b32 0
42tpc_mask: .b32 0
43
44#if NV_PGRAPH_GPCX_UNK__SIZE > 0
45unk_count: .b32 0
46unk_mask: .b32 0
47#endif
48
49cmd_queue: queue_init
50
51mmio_list_base:
52#endif
53
54#ifdef INCLUDE_CODE
55// reports an exception to the host
56//
57// In: $r15 error code (see nvc0.fuc)
58//
59error:
60 push $r14
61 mov $r14 -0x67ec // 0x9814
62 sethi $r14 0x400000
63 call #nv_wr32 // HUB_CTXCTL_CC_SCRATCH[5] = error code
64 add b32 $r14 0x41c
65 mov $r15 1
66 call #nv_wr32 // HUB_CTXCTL_INTR_UP_SET
67 pop $r14
68 ret
69
70// GPC fuc initialisation, executed by triggering ucode start, will
71// fall through to main loop after completion.
72//
73// Input:
74// CC_SCRATCH[1]: context base
75//
76// Output:
77// CC_SCRATCH[0]:
78// 31:31: set to signal completion
79// CC_SCRATCH[1]:
80// 31:0: GPC context size
81//
82init:
83 clear b32 $r0
84 mov $sp $r0
85
86 // enable fifo access
87 mov $r1 0x1200
88 mov $r2 2
89 iowr I[$r1 + 0x000] $r2 // FIFO_ENABLE
90
91 // setup i0 handler, and route all interrupts to it
92 mov $r1 #ih
93 mov $iv0 $r1
94 mov $r1 0x400
95 iowr I[$r1 + 0x300] $r0 // INTR_DISPATCH
96
97 // enable fifo interrupt
98 mov $r2 4
99 iowr I[$r1 + 0x000] $r2 // INTR_EN_SET
100
101 // enable interrupts
102 bset $flags ie0
103
104 // figure out which GPC we are, and how many TPCs we have
105 mov $r1 0x608
106 shl b32 $r1 6
107 iord $r2 I[$r1 + 0x000] // UNITS
108 mov $r3 1
109 and $r2 0x1f
110 shl b32 $r3 $r2
111 sub b32 $r3 1
112 st b32 D[$r0 + #tpc_count] $r2
113 st b32 D[$r0 + #tpc_mask] $r3
114 add b32 $r1 0x400
115 iord $r2 I[$r1 + 0x000] // MYINDEX
116 st b32 D[$r0 + #gpc_id] $r2
117
118#if NV_PGRAPH_GPCX_UNK__SIZE > 0
119 // figure out which, and how many, UNKs are actually present
120 mov $r14 0x0c30
121 sethi $r14 0x500000
122 clear b32 $r2
123 clear b32 $r3
124 clear b32 $r4
125 init_unk_loop:
126 call #nv_rd32
127 cmp b32 $r15 0
128 bra z #init_unk_next
129 mov $r15 1
130 shl b32 $r15 $r2
131 or $r4 $r15
132 add b32 $r3 1
133 init_unk_next:
134 add b32 $r2 1
135 add b32 $r14 4
136 cmp b32 $r2 NV_PGRAPH_GPCX_UNK__SIZE
137 bra ne #init_unk_loop
138 init_unk_done:
139 st b32 D[$r0 + #unk_count] $r3
140 st b32 D[$r0 + #unk_mask] $r4
141#endif
142
143 // initialise context base, and size tracking
144 nv_iord($r2, NV_PGRAPH_GPCX_GPCCS_CC_SCRATCH_VAL(1), 0)
145 clear b32 $r3 // track GPC context size here
146
147 // set mmctx base addresses now so we don't have to do it later,
148 // they don't currently ever change
149 mov $r4 0x700
150 shl b32 $r4 6
151 shr b32 $r5 $r2 8
152 iowr I[$r4 + 0x000] $r5 // MMCTX_SAVE_SWBASE
153 iowr I[$r4 + 0x100] $r5 // MMCTX_LOAD_SWBASE
154
155 // calculate GPC mmio context size
156 ld b32 $r14 D[$r0 + #gpc_mmio_list_head]
157 ld b32 $r15 D[$r0 + #gpc_mmio_list_tail]
158 call #mmctx_size
159 add b32 $r2 $r15
160 add b32 $r3 $r15
161
162 // calculate per-TPC mmio context size
163 ld b32 $r14 D[$r0 + #tpc_mmio_list_head]
164 ld b32 $r15 D[$r0 + #tpc_mmio_list_tail]
165 call #mmctx_size
166 ld b32 $r14 D[$r0 + #tpc_count]
167 mulu $r14 $r15
168 add b32 $r2 $r14
169 add b32 $r3 $r14
170
171#if NV_PGRAPH_GPCX_UNK__SIZE > 0
172 // calculate per-UNK mmio context size
173 ld b32 $r14 D[$r0 + #unk_mmio_list_head]
174 ld b32 $r15 D[$r0 + #unk_mmio_list_tail]
175 call #mmctx_size
176 ld b32 $r14 D[$r0 + #unk_count]
177 mulu $r14 $r15
178 add b32 $r2 $r14
179 add b32 $r3 $r14
180#endif
181
182 // round up base/size to 256 byte boundary (for strand SWBASE)
183 add b32 $r4 0x1300
184 shr b32 $r3 2
185 iowr I[$r4 + 0x000] $r3 // MMCTX_LOAD_COUNT, wtf for?!?
186 shr b32 $r2 8
187 shr b32 $r3 6
188 add b32 $r2 1
189 add b32 $r3 1
190 shl b32 $r2 8
191 shl b32 $r3 8
192
193 // calculate size of strand context data
194 mov b32 $r15 $r2
195 call #strand_ctx_init
196 add b32 $r3 $r15
197
198 // save context size, and tell HUB we're done
199 nv_iowr(NV_PGRAPH_GPCX_GPCCS_CC_SCRATCH_VAL(1), 0, $r3)
200 clear b32 $r2
201 bset $r2 31
202 nv_iowr(NV_PGRAPH_GPCX_GPCCS_CC_SCRATCH_SET(0), 0, $r2)
203
204// Main program loop, very simple, sleeps until woken up by the interrupt
205// handler, pulls a command from the queue and executes its handler
206//
207main:
208 bset $flags $p0
209 sleep $p0
210 mov $r13 #cmd_queue
211 call #queue_get
212 bra $p1 #main
213
214 // 0x0000-0x0003 are all context transfers
215 cmpu b32 $r14 0x04
216 bra nc #main_not_ctx_xfer
217 // fetch $flags and mask off $p1/$p2
218 mov $r1 $flags
219 mov $r2 0x0006
220 not b32 $r2
221 and $r1 $r2
222 // set $p1/$p2 according to transfer type
223 shl b32 $r14 1
224 or $r1 $r14
225 mov $flags $r1
226 // transfer context data
227 call #ctx_xfer
228 bra #main
229
230 main_not_ctx_xfer:
231 shl b32 $r15 $r14 16
232 or $r15 E_BAD_COMMAND
233 call #error
234 bra #main
235
236// interrupt handler
237ih:
238 push $r8
239 mov $r8 $flags
240 push $r8
241 push $r9
242 push $r10
243 push $r11
244 push $r13
245 push $r14
246 push $r15
247 clear b32 $r0
248
249 // incoming fifo command?
250 iord $r10 I[$r0 + 0x200] // INTR
251 and $r11 $r10 0x00000004
252 bra e #ih_no_fifo
253 // queue incoming fifo command for later processing
254 mov $r11 0x1900
255 mov $r13 #cmd_queue
256 iord $r14 I[$r11 + 0x100] // FIFO_CMD
257 iord $r15 I[$r11 + 0x000] // FIFO_DATA
258 call #queue_put
259 add b32 $r11 0x400
260 mov $r14 1
261 iowr I[$r11 + 0x000] $r14 // FIFO_ACK
262
263 // ack, and wake up main()
264 ih_no_fifo:
265 iowr I[$r0 + 0x100] $r10 // INTR_ACK
266
267 pop $r15
268 pop $r14
269 pop $r13
270 pop $r11
271 pop $r10
272 pop $r9
273 pop $r8
274 mov $flags $r8
275 pop $r8
276 bclr $flags $p0
277 iret
278
279// Set this GPC's bit in HUB_BAR, used to signal completion of various
280// activities to the HUB fuc
281//
282hub_barrier_done:
283 mov $r15 1
284 ld b32 $r14 D[$r0 + #gpc_id]
285 shl b32 $r15 $r14
286 mov $r14 -0x6be8 // 0x409418 - HUB_BAR_SET
287 sethi $r14 0x400000
288 call #nv_wr32
289 ret
290
291// Disables various things, waits a bit, and re-enables them..
292//
293// Not sure how exactly this helps, perhaps "ENABLE" is not such a
294// good description for the bits we turn off? Anyways, without this,
295// funny things happen.
296//
297ctx_redswitch:
298 mov $r14 0x614
299 shl b32 $r14 6
300 mov $r15 0x020
301 iowr I[$r14] $r15 // GPC_RED_SWITCH = POWER
302 mov $r15 8
303 ctx_redswitch_delay:
304 sub b32 $r15 1
305 bra ne #ctx_redswitch_delay
306 mov $r15 0xa20
307 iowr I[$r14] $r15 // GPC_RED_SWITCH = UNK11, ENABLE, POWER
308 ret
309
310// Transfer GPC context data between GPU and storage area
311//
312// In: $r15 context base address
313// $p1 clear on save, set on load
314// $p2 set if opposite direction done/will be done, so:
315// on save it means: "a load will follow this save"
316// on load it means: "a save preceeded this load"
317//
318ctx_xfer:
319 // set context base address
320 mov $r1 0xa04
321 shl b32 $r1 6
322 iowr I[$r1 + 0x000] $r15// MEM_BASE
323 bra not $p1 #ctx_xfer_not_load
324 call #ctx_redswitch
325 ctx_xfer_not_load:
326
327 // strands
328 mov $r1 0x4afc
329 sethi $r1 0x20000
330 mov $r2 0xc
331 iowr I[$r1] $r2 // STRAND_CMD(0x3f) = 0x0c
332 call #strand_wait
333 mov $r2 0x47fc
334 sethi $r2 0x20000
335 iowr I[$r2] $r0 // STRAND_FIRST_GENE(0x3f) = 0x00
336 xbit $r2 $flags $p1
337 add b32 $r2 3
338 iowr I[$r1] $r2 // STRAND_CMD(0x3f) = 0x03/0x04 (SAVE/LOAD)
339
340 // mmio context
341 xbit $r10 $flags $p1 // direction
342 or $r10 2 // first
343 mov $r11 0x0000
344 sethi $r11 0x500000
345 ld b32 $r12 D[$r0 + #gpc_id]
346 shl b32 $r12 15
347 add b32 $r11 $r12 // base = NV_PGRAPH_GPCn
348 ld b32 $r12 D[$r0 + #gpc_mmio_list_head]
349 ld b32 $r13 D[$r0 + #gpc_mmio_list_tail]
350 mov $r14 0 // not multi
351 call #mmctx_xfer
352
353 // per-TPC mmio context
354 xbit $r10 $flags $p1 // direction
355#if !NV_PGRAPH_GPCX_UNK__SIZE
356 or $r10 4 // last
357#endif
358 mov $r11 0x4000
359 sethi $r11 0x500000 // base = NV_PGRAPH_GPC0_TPC0
360 ld b32 $r12 D[$r0 + #gpc_id]
361 shl b32 $r12 15
362 add b32 $r11 $r12 // base = NV_PGRAPH_GPCn_TPC0
363 ld b32 $r12 D[$r0 + #tpc_mmio_list_head]
364 ld b32 $r13 D[$r0 + #tpc_mmio_list_tail]
365 ld b32 $r15 D[$r0 + #tpc_mask]
366 mov $r14 0x800 // stride = 0x800
367 call #mmctx_xfer
368
369#if NV_PGRAPH_GPCX_UNK__SIZE > 0
370 // per-UNK mmio context
371 xbit $r10 $flags $p1 // direction
372 or $r10 4 // last
373 mov $r11 0x3000
374 sethi $r11 0x500000 // base = NV_PGRAPH_GPC0_UNK0
375 ld b32 $r12 D[$r0 + #gpc_id]
376 shl b32 $r12 15
377 add b32 $r11 $r12 // base = NV_PGRAPH_GPCn_UNK0
378 ld b32 $r12 D[$r0 + #unk_mmio_list_head]
379 ld b32 $r13 D[$r0 + #unk_mmio_list_tail]
380 ld b32 $r15 D[$r0 + #unk_mask]
381 mov $r14 0x200 // stride = 0x200
382 call #mmctx_xfer
383#endif
384
385 // wait for strands to finish
386 call #strand_wait
387
388 // if load, or a save without a load following, do some
389 // unknown stuff that's done after finishing a block of
390 // strand commands
391 bra $p1 #ctx_xfer_post
392 bra not $p2 #ctx_xfer_done
393 ctx_xfer_post:
394 mov $r1 0x4afc
395 sethi $r1 0x20000
396 mov $r2 0xd
397 iowr I[$r1] $r2 // STRAND_CMD(0x3f) = 0x0d
398 call #strand_wait
399
400 // mark completion in HUB's barrier
401 ctx_xfer_done:
402 call #hub_barrier_done
403 ret
404#endif
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvc0.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvc0.fuc
index f7055af0f2a6..5ae06a2d64c9 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvc0.fuc
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvc0.fuc
@@ -1,6 +1,5 @@
1/* fuc microcode for nvc0 PGRAPH/GPC 1/*
2 * 2 * Copyright 2013 Red Hat Inc.
3 * Copyright 2011 Red Hat Inc.
4 * 3 *
5 * Permission is hereby granted, free of charge, to any person obtaining a 4 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"), 5 * copy of this software and associated documentation files (the "Software"),
@@ -20,525 +19,24 @@
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 * OTHER DEALINGS IN THE SOFTWARE. 20 * OTHER DEALINGS IN THE SOFTWARE.
22 * 21 *
23 * Authors: Ben Skeggs 22 * Authors: Ben Skeggs <bskeggs@redhat.com>
24 */ 23 */
25 24
26/* To build: 25#define NV_PGRAPH_GPCX_UNK__SIZE 0x00000000
27 * m4 gpcnvc0.fuc | envyas -a -w -m fuc -V fuc3 -o gpcnvc0.fuc.h
28 */
29 26
30/* TODO 27#define CHIPSET GF100
31 * - bracket certain functions with scratch writes, useful for debugging 28#include "macros.fuc"
32 * - watchdog timer around ctx operations
33 */
34 29
35.section #nvc0_grgpc_data 30.section #nvc0_grgpc_data
36include(`nvc0.fuc') 31#define INCLUDE_DATA
37gpc_id: .b32 0 32#include "com.fuc"
38gpc_mmio_list_head: .b32 0 33#include "gpc.fuc"
39gpc_mmio_list_tail: .b32 0 34#undef INCLUDE_DATA
40
41tpc_count: .b32 0
42tpc_mask: .b32 0
43tpc_mmio_list_head: .b32 0
44tpc_mmio_list_tail: .b32 0
45
46cmd_queue: queue_init
47
48// chipset descriptions
49chipsets:
50.b8 0xc0 0 0 0
51.b16 #nvc0_gpc_mmio_head
52.b16 #nvc0_gpc_mmio_tail
53.b16 #nvc0_tpc_mmio_head
54.b16 #nvc0_tpc_mmio_tail
55.b8 0xc1 0 0 0
56.b16 #nvc0_gpc_mmio_head
57.b16 #nvc1_gpc_mmio_tail
58.b16 #nvc0_tpc_mmio_head
59.b16 #nvc1_tpc_mmio_tail
60.b8 0xc3 0 0 0
61.b16 #nvc0_gpc_mmio_head
62.b16 #nvc0_gpc_mmio_tail
63.b16 #nvc0_tpc_mmio_head
64.b16 #nvc3_tpc_mmio_tail
65.b8 0xc4 0 0 0
66.b16 #nvc0_gpc_mmio_head
67.b16 #nvc0_gpc_mmio_tail
68.b16 #nvc0_tpc_mmio_head
69.b16 #nvc3_tpc_mmio_tail
70.b8 0xc8 0 0 0
71.b16 #nvc0_gpc_mmio_head
72.b16 #nvc0_gpc_mmio_tail
73.b16 #nvc0_tpc_mmio_head
74.b16 #nvc0_tpc_mmio_tail
75.b8 0xce 0 0 0
76.b16 #nvc0_gpc_mmio_head
77.b16 #nvc0_gpc_mmio_tail
78.b16 #nvc0_tpc_mmio_head
79.b16 #nvc3_tpc_mmio_tail
80.b8 0xcf 0 0 0
81.b16 #nvc0_gpc_mmio_head
82.b16 #nvc0_gpc_mmio_tail
83.b16 #nvc0_tpc_mmio_head
84.b16 #nvcf_tpc_mmio_tail
85.b8 0xd9 0 0 0
86.b16 #nvd9_gpc_mmio_head
87.b16 #nvd9_gpc_mmio_tail
88.b16 #nvd9_tpc_mmio_head
89.b16 #nvd9_tpc_mmio_tail
90.b8 0xd7 0 0 0
91.b16 #nvd9_gpc_mmio_head
92.b16 #nvd9_gpc_mmio_tail
93.b16 #nvd9_tpc_mmio_head
94.b16 #nvd9_tpc_mmio_tail
95.b8 0 0 0 0
96
97// GPC mmio lists
98nvc0_gpc_mmio_head:
99mmctx_data(0x000380, 1)
100mmctx_data(0x000400, 6)
101mmctx_data(0x000450, 9)
102mmctx_data(0x000600, 1)
103mmctx_data(0x000684, 1)
104mmctx_data(0x000700, 5)
105mmctx_data(0x000800, 1)
106mmctx_data(0x000808, 3)
107mmctx_data(0x000828, 1)
108mmctx_data(0x000830, 1)
109mmctx_data(0x0008d8, 1)
110mmctx_data(0x0008e0, 1)
111mmctx_data(0x0008e8, 6)
112mmctx_data(0x00091c, 1)
113mmctx_data(0x000924, 3)
114mmctx_data(0x000b00, 1)
115mmctx_data(0x000b08, 6)
116mmctx_data(0x000bb8, 1)
117mmctx_data(0x000c08, 1)
118mmctx_data(0x000c10, 8)
119mmctx_data(0x000c80, 1)
120mmctx_data(0x000c8c, 1)
121mmctx_data(0x001000, 3)
122mmctx_data(0x001014, 1)
123nvc0_gpc_mmio_tail:
124mmctx_data(0x000c6c, 1);
125nvc1_gpc_mmio_tail:
126
127nvd9_gpc_mmio_head:
128mmctx_data(0x000380, 1)
129mmctx_data(0x000400, 2)
130mmctx_data(0x00040c, 3)
131mmctx_data(0x000450, 9)
132mmctx_data(0x000600, 1)
133mmctx_data(0x000684, 1)
134mmctx_data(0x000700, 5)
135mmctx_data(0x000800, 1)
136mmctx_data(0x000808, 3)
137mmctx_data(0x000828, 1)
138mmctx_data(0x000830, 1)
139mmctx_data(0x0008d8, 1)
140mmctx_data(0x0008e0, 1)
141mmctx_data(0x0008e8, 6)
142mmctx_data(0x00091c, 1)
143mmctx_data(0x000924, 3)
144mmctx_data(0x000b00, 1)
145mmctx_data(0x000b08, 6)
146mmctx_data(0x000bb8, 1)
147mmctx_data(0x000c08, 1)
148mmctx_data(0x000c10, 8)
149mmctx_data(0x000c6c, 1)
150mmctx_data(0x000c80, 1)
151mmctx_data(0x000c8c, 1)
152mmctx_data(0x001000, 3)
153mmctx_data(0x001014, 1)
154nvd9_gpc_mmio_tail:
155
156// TPC mmio lists
157nvc0_tpc_mmio_head:
158mmctx_data(0x000018, 1)
159mmctx_data(0x00003c, 1)
160mmctx_data(0x000048, 1)
161mmctx_data(0x000064, 1)
162mmctx_data(0x000088, 1)
163mmctx_data(0x000200, 6)
164mmctx_data(0x00021c, 2)
165mmctx_data(0x000300, 6)
166mmctx_data(0x0003d0, 1)
167mmctx_data(0x0003e0, 2)
168mmctx_data(0x000400, 3)
169mmctx_data(0x000420, 1)
170mmctx_data(0x0004b0, 1)
171mmctx_data(0x0004e8, 1)
172mmctx_data(0x0004f4, 1)
173mmctx_data(0x000520, 2)
174mmctx_data(0x000604, 4)
175mmctx_data(0x000644, 20)
176mmctx_data(0x000698, 1)
177mmctx_data(0x000750, 2)
178nvc0_tpc_mmio_tail:
179mmctx_data(0x000758, 1)
180mmctx_data(0x0002c4, 1)
181mmctx_data(0x0006e0, 1)
182nvcf_tpc_mmio_tail:
183mmctx_data(0x0004bc, 1)
184nvc3_tpc_mmio_tail:
185mmctx_data(0x000544, 1)
186nvc1_tpc_mmio_tail:
187
188nvd9_tpc_mmio_head:
189mmctx_data(0x000018, 1)
190mmctx_data(0x00003c, 1)
191mmctx_data(0x000048, 1)
192mmctx_data(0x000064, 1)
193mmctx_data(0x000088, 1)
194mmctx_data(0x000200, 6)
195mmctx_data(0x00021c, 2)
196mmctx_data(0x0002c4, 1)
197mmctx_data(0x000300, 6)
198mmctx_data(0x0003d0, 1)
199mmctx_data(0x0003e0, 2)
200mmctx_data(0x000400, 3)
201mmctx_data(0x000420, 3)
202mmctx_data(0x0004b0, 1)
203mmctx_data(0x0004e8, 1)
204mmctx_data(0x0004f4, 1)
205mmctx_data(0x000520, 2)
206mmctx_data(0x000544, 1)
207mmctx_data(0x000604, 4)
208mmctx_data(0x000644, 20)
209mmctx_data(0x000698, 1)
210mmctx_data(0x0006e0, 1)
211mmctx_data(0x000750, 3)
212nvd9_tpc_mmio_tail:
213 35
214.section #nvc0_grgpc_code 36.section #nvc0_grgpc_code
37#define INCLUDE_CODE
215bra #init 38bra #init
216define(`include_code') 39#include "com.fuc"
217include(`nvc0.fuc') 40#include "gpc.fuc"
218
219// reports an exception to the host
220//
221// In: $r15 error code (see nvc0.fuc)
222//
223error:
224 push $r14
225 mov $r14 -0x67ec // 0x9814
226 sethi $r14 0x400000
227 call #nv_wr32 // HUB_CTXCTL_CC_SCRATCH[5] = error code
228 add b32 $r14 0x41c
229 mov $r15 1
230 call #nv_wr32 // HUB_CTXCTL_INTR_UP_SET
231 pop $r14
232 ret
233
234// GPC fuc initialisation, executed by triggering ucode start, will
235// fall through to main loop after completion.
236//
237// Input:
238// CC_SCRATCH[0]: chipset (PMC_BOOT_0 read returns 0x0bad0bad... sigh)
239// CC_SCRATCH[1]: context base
240//
241// Output:
242// CC_SCRATCH[0]:
243// 31:31: set to signal completion
244// CC_SCRATCH[1]:
245// 31:0: GPC context size
246//
247init:
248 clear b32 $r0
249 mov $sp $r0
250
251 // enable fifo access
252 mov $r1 0x1200
253 mov $r2 2
254 iowr I[$r1 + 0x000] $r2 // FIFO_ENABLE
255
256 // setup i0 handler, and route all interrupts to it
257 mov $r1 #ih
258 mov $iv0 $r1
259 mov $r1 0x400
260 iowr I[$r1 + 0x300] $r0 // INTR_DISPATCH
261
262 // enable fifo interrupt
263 mov $r2 4
264 iowr I[$r1 + 0x000] $r2 // INTR_EN_SET
265
266 // enable interrupts
267 bset $flags ie0
268
269 // figure out which GPC we are, and how many TPCs we have
270 mov $r1 0x608
271 shl b32 $r1 6
272 iord $r2 I[$r1 + 0x000] // UNITS
273 mov $r3 1
274 and $r2 0x1f
275 shl b32 $r3 $r2
276 sub b32 $r3 1
277 st b32 D[$r0 + #tpc_count] $r2
278 st b32 D[$r0 + #tpc_mask] $r3
279 add b32 $r1 0x400
280 iord $r2 I[$r1 + 0x000] // MYINDEX
281 st b32 D[$r0 + #gpc_id] $r2
282
283 // find context data for this chipset
284 mov $r2 0x800
285 shl b32 $r2 6
286 iord $r2 I[$r2 + 0x000] // CC_SCRATCH[0]
287 mov $r1 #chipsets - 12
288 init_find_chipset:
289 add b32 $r1 12
290 ld b32 $r3 D[$r1 + 0x00]
291 cmpu b32 $r3 $r2
292 bra e #init_context
293 cmpu b32 $r3 0
294 bra ne #init_find_chipset
295 // unknown chipset
296 ret
297
298 // initialise context base, and size tracking
299 init_context:
300 mov $r2 0x800
301 shl b32 $r2 6
302 iord $r2 I[$r2 + 0x100] // CC_SCRATCH[1], initial base
303 clear b32 $r3 // track GPC context size here
304
305 // set mmctx base addresses now so we don't have to do it later,
306 // they don't currently ever change
307 mov $r4 0x700
308 shl b32 $r4 6
309 shr b32 $r5 $r2 8
310 iowr I[$r4 + 0x000] $r5 // MMCTX_SAVE_SWBASE
311 iowr I[$r4 + 0x100] $r5 // MMCTX_LOAD_SWBASE
312
313 // calculate GPC mmio context size, store the chipset-specific
314 // mmio list pointers somewhere we can get at them later without
315 // re-parsing the chipset list
316 clear b32 $r14
317 clear b32 $r15
318 ld b16 $r14 D[$r1 + 4]
319 ld b16 $r15 D[$r1 + 6]
320 st b16 D[$r0 + #gpc_mmio_list_head] $r14
321 st b16 D[$r0 + #gpc_mmio_list_tail] $r15
322 call #mmctx_size
323 add b32 $r2 $r15
324 add b32 $r3 $r15
325
326 // calculate per-TPC mmio context size, store the list pointers
327 ld b16 $r14 D[$r1 + 8]
328 ld b16 $r15 D[$r1 + 10]
329 st b16 D[$r0 + #tpc_mmio_list_head] $r14
330 st b16 D[$r0 + #tpc_mmio_list_tail] $r15
331 call #mmctx_size
332 ld b32 $r14 D[$r0 + #tpc_count]
333 mulu $r14 $r15
334 add b32 $r2 $r14
335 add b32 $r3 $r14
336
337 // round up base/size to 256 byte boundary (for strand SWBASE)
338 add b32 $r4 0x1300
339 shr b32 $r3 2
340 iowr I[$r4 + 0x000] $r3 // MMCTX_LOAD_COUNT, wtf for?!?
341 shr b32 $r2 8
342 shr b32 $r3 6
343 add b32 $r2 1
344 add b32 $r3 1
345 shl b32 $r2 8
346 shl b32 $r3 8
347
348 // calculate size of strand context data
349 mov b32 $r15 $r2
350 call #strand_ctx_init
351 add b32 $r3 $r15
352
353 // save context size, and tell HUB we're done
354 mov $r1 0x800
355 shl b32 $r1 6
356 iowr I[$r1 + 0x100] $r3 // CC_SCRATCH[1] = context size
357 add b32 $r1 0x800
358 clear b32 $r2
359 bset $r2 31
360 iowr I[$r1 + 0x000] $r2 // CC_SCRATCH[0] |= 0x80000000
361
362// Main program loop, very simple, sleeps until woken up by the interrupt
363// handler, pulls a command from the queue and executes its handler
364//
365main:
366 bset $flags $p0
367 sleep $p0
368 mov $r13 #cmd_queue
369 call #queue_get
370 bra $p1 #main
371
372 // 0x0000-0x0003 are all context transfers
373 cmpu b32 $r14 0x04
374 bra nc #main_not_ctx_xfer
375 // fetch $flags and mask off $p1/$p2
376 mov $r1 $flags
377 mov $r2 0x0006
378 not b32 $r2
379 and $r1 $r2
380 // set $p1/$p2 according to transfer type
381 shl b32 $r14 1
382 or $r1 $r14
383 mov $flags $r1
384 // transfer context data
385 call #ctx_xfer
386 bra #main
387
388 main_not_ctx_xfer:
389 shl b32 $r15 $r14 16
390 or $r15 E_BAD_COMMAND
391 call #error
392 bra #main
393
394// interrupt handler
395ih:
396 push $r8
397 mov $r8 $flags
398 push $r8
399 push $r9
400 push $r10
401 push $r11
402 push $r13
403 push $r14
404 push $r15
405
406 // incoming fifo command?
407 iord $r10 I[$r0 + 0x200] // INTR
408 and $r11 $r10 0x00000004
409 bra e #ih_no_fifo
410 // queue incoming fifo command for later processing
411 mov $r11 0x1900
412 mov $r13 #cmd_queue
413 iord $r14 I[$r11 + 0x100] // FIFO_CMD
414 iord $r15 I[$r11 + 0x000] // FIFO_DATA
415 call #queue_put
416 add b32 $r11 0x400
417 mov $r14 1
418 iowr I[$r11 + 0x000] $r14 // FIFO_ACK
419
420 // ack, and wake up main()
421 ih_no_fifo:
422 iowr I[$r0 + 0x100] $r10 // INTR_ACK
423
424 pop $r15
425 pop $r14
426 pop $r13
427 pop $r11
428 pop $r10
429 pop $r9
430 pop $r8
431 mov $flags $r8
432 pop $r8
433 bclr $flags $p0
434 iret
435
436// Set this GPC's bit in HUB_BAR, used to signal completion of various
437// activities to the HUB fuc
438//
439hub_barrier_done:
440 mov $r15 1
441 ld b32 $r14 D[$r0 + #gpc_id]
442 shl b32 $r15 $r14
443 mov $r14 -0x6be8 // 0x409418 - HUB_BAR_SET
444 sethi $r14 0x400000
445 call #nv_wr32
446 ret
447
448// Disables various things, waits a bit, and re-enables them..
449//
450// Not sure how exactly this helps, perhaps "ENABLE" is not such a
451// good description for the bits we turn off? Anyways, without this,
452// funny things happen.
453//
454ctx_redswitch:
455 mov $r14 0x614
456 shl b32 $r14 6
457 mov $r15 0x020
458 iowr I[$r14] $r15 // GPC_RED_SWITCH = POWER
459 mov $r15 8
460 ctx_redswitch_delay:
461 sub b32 $r15 1
462 bra ne #ctx_redswitch_delay
463 mov $r15 0xa20
464 iowr I[$r14] $r15 // GPC_RED_SWITCH = UNK11, ENABLE, POWER
465 ret
466
467// Transfer GPC context data between GPU and storage area
468//
469// In: $r15 context base address
470// $p1 clear on save, set on load
471// $p2 set if opposite direction done/will be done, so:
472// on save it means: "a load will follow this save"
473// on load it means: "a save preceeded this load"
474//
475ctx_xfer:
476 // set context base address
477 mov $r1 0xa04
478 shl b32 $r1 6
479 iowr I[$r1 + 0x000] $r15// MEM_BASE
480 bra not $p1 #ctx_xfer_not_load
481 call #ctx_redswitch
482 ctx_xfer_not_load:
483
484 // strands
485 mov $r1 0x4afc
486 sethi $r1 0x20000
487 mov $r2 0xc
488 iowr I[$r1] $r2 // STRAND_CMD(0x3f) = 0x0c
489 call #strand_wait
490 mov $r2 0x47fc
491 sethi $r2 0x20000
492 iowr I[$r2] $r0 // STRAND_FIRST_GENE(0x3f) = 0x00
493 xbit $r2 $flags $p1
494 add b32 $r2 3
495 iowr I[$r1] $r2 // STRAND_CMD(0x3f) = 0x03/0x04 (SAVE/LOAD)
496
497 // mmio context
498 xbit $r10 $flags $p1 // direction
499 or $r10 2 // first
500 mov $r11 0x0000
501 sethi $r11 0x500000
502 ld b32 $r12 D[$r0 + #gpc_id]
503 shl b32 $r12 15
504 add b32 $r11 $r12 // base = NV_PGRAPH_GPCn
505 ld b32 $r12 D[$r0 + #gpc_mmio_list_head]
506 ld b32 $r13 D[$r0 + #gpc_mmio_list_tail]
507 mov $r14 0 // not multi
508 call #mmctx_xfer
509
510 // per-TPC mmio context
511 xbit $r10 $flags $p1 // direction
512 or $r10 4 // last
513 mov $r11 0x4000
514 sethi $r11 0x500000 // base = NV_PGRAPH_GPC0_TPC0
515 ld b32 $r12 D[$r0 + #gpc_id]
516 shl b32 $r12 15
517 add b32 $r11 $r12 // base = NV_PGRAPH_GPCn_TPC0
518 ld b32 $r12 D[$r0 + #tpc_mmio_list_head]
519 ld b32 $r13 D[$r0 + #tpc_mmio_list_tail]
520 ld b32 $r15 D[$r0 + #tpc_mask]
521 mov $r14 0x800 // stride = 0x800
522 call #mmctx_xfer
523
524 // wait for strands to finish
525 call #strand_wait
526
527 // if load, or a save without a load following, do some
528 // unknown stuff that's done after finishing a block of
529 // strand commands
530 bra $p1 #ctx_xfer_post
531 bra not $p2 #ctx_xfer_done
532 ctx_xfer_post:
533 mov $r1 0x4afc
534 sethi $r1 0x20000
535 mov $r2 0xd
536 iowr I[$r1] $r2 // STRAND_CMD(0x3f) = 0x0d
537 call #strand_wait
538
539 // mark completion in HUB's barrier
540 ctx_xfer_done:
541 call #hub_barrier_done
542 ret
543
544.align 256 41.align 256
42#undef INCLUDE_CODE
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvc0.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvc0.fuc.h
index 96050ddb22ca..f2b0dea80116 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvc0.fuc.h
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvc0.fuc.h
@@ -1,17 +1,19 @@
1uint32_t nvc0_grgpc_data[] = { 1uint32_t nvc0_grgpc_data[] = {
2/* 0x0000: gpc_id */ 2/* 0x0000: gpc_mmio_list_head */
3 0x00000000, 3 0x00000064,
4/* 0x0004: gpc_mmio_list_head */ 4/* 0x0004: gpc_mmio_list_tail */
5 0x00000000, 5/* 0x0004: tpc_mmio_list_head */
6/* 0x0008: gpc_mmio_list_tail */ 6 0x00000064,
7 0x00000000, 7/* 0x0008: tpc_mmio_list_tail */
8/* 0x000c: tpc_count */ 8/* 0x0008: unk_mmio_list_head */
9 0x00000000, 9 0x00000064,
10/* 0x0010: tpc_mask */ 10/* 0x000c: unk_mmio_list_tail */
11 0x00000064,
12/* 0x0010: gpc_id */
11 0x00000000, 13 0x00000000,
12/* 0x0014: tpc_mmio_list_head */ 14/* 0x0014: tpc_count */
13 0x00000000, 15 0x00000000,
14/* 0x0018: tpc_mmio_list_tail */ 16/* 0x0018: tpc_mask */
15 0x00000000, 17 0x00000000,
16/* 0x001c: cmd_queue */ 18/* 0x001c: cmd_queue */
17 0x00000000, 19 0x00000000,
@@ -32,153 +34,17 @@ uint32_t nvc0_grgpc_data[] = {
32 0x00000000, 34 0x00000000,
33 0x00000000, 35 0x00000000,
34 0x00000000, 36 0x00000000,
35/* 0x0064: chipsets */
36 0x000000c0,
37 0x012800c8,
38 0x01e40194,
39 0x000000c1,
40 0x012c00c8,
41 0x01f80194,
42 0x000000c3,
43 0x012800c8,
44 0x01f40194,
45 0x000000c4,
46 0x012800c8,
47 0x01f40194,
48 0x000000c8,
49 0x012800c8,
50 0x01e40194,
51 0x000000ce,
52 0x012800c8,
53 0x01f40194,
54 0x000000cf,
55 0x012800c8,
56 0x01f00194,
57 0x000000d9,
58 0x0194012c,
59 0x025401f8,
60 0x00000000,
61/* 0x00c8: nvc0_gpc_mmio_head */
62 0x00000380,
63 0x14000400,
64 0x20000450,
65 0x00000600,
66 0x00000684,
67 0x10000700,
68 0x00000800,
69 0x08000808,
70 0x00000828,
71 0x00000830,
72 0x000008d8,
73 0x000008e0,
74 0x140008e8,
75 0x0000091c,
76 0x08000924,
77 0x00000b00,
78 0x14000b08,
79 0x00000bb8,
80 0x00000c08,
81 0x1c000c10,
82 0x00000c80,
83 0x00000c8c,
84 0x08001000,
85 0x00001014,
86/* 0x0128: nvc0_gpc_mmio_tail */
87 0x00000c6c,
88/* 0x012c: nvc1_gpc_mmio_tail */
89/* 0x012c: nvd9_gpc_mmio_head */
90 0x00000380,
91 0x04000400,
92 0x0800040c,
93 0x20000450,
94 0x00000600,
95 0x00000684,
96 0x10000700,
97 0x00000800,
98 0x08000808,
99 0x00000828,
100 0x00000830,
101 0x000008d8,
102 0x000008e0,
103 0x140008e8,
104 0x0000091c,
105 0x08000924,
106 0x00000b00,
107 0x14000b08,
108 0x00000bb8,
109 0x00000c08,
110 0x1c000c10,
111 0x00000c6c,
112 0x00000c80,
113 0x00000c8c,
114 0x08001000,
115 0x00001014,
116/* 0x0194: nvd9_gpc_mmio_tail */
117/* 0x0194: nvc0_tpc_mmio_head */
118 0x00000018,
119 0x0000003c,
120 0x00000048,
121 0x00000064,
122 0x00000088,
123 0x14000200,
124 0x0400021c,
125 0x14000300,
126 0x000003d0,
127 0x040003e0,
128 0x08000400,
129 0x00000420,
130 0x000004b0,
131 0x000004e8,
132 0x000004f4,
133 0x04000520,
134 0x0c000604,
135 0x4c000644,
136 0x00000698,
137 0x04000750,
138/* 0x01e4: nvc0_tpc_mmio_tail */
139 0x00000758,
140 0x000002c4,
141 0x000006e0,
142/* 0x01f0: nvcf_tpc_mmio_tail */
143 0x000004bc,
144/* 0x01f4: nvc3_tpc_mmio_tail */
145 0x00000544,
146/* 0x01f8: nvc1_tpc_mmio_tail */
147/* 0x01f8: nvd9_tpc_mmio_head */
148 0x00000018,
149 0x0000003c,
150 0x00000048,
151 0x00000064,
152 0x00000088,
153 0x14000200,
154 0x0400021c,
155 0x000002c4,
156 0x14000300,
157 0x000003d0,
158 0x040003e0,
159 0x08000400,
160 0x08000420,
161 0x000004b0,
162 0x000004e8,
163 0x000004f4,
164 0x04000520,
165 0x00000544,
166 0x0c000604,
167 0x4c000644,
168 0x00000698,
169 0x000006e0,
170 0x08000750,
171}; 37};
172 38
173uint32_t nvc0_grgpc_code[] = { 39uint32_t nvc0_grgpc_code[] = {
174 0x03060ef5, 40 0x03180ef5,
175/* 0x0004: queue_put */ 41/* 0x0004: queue_put */
176 0x9800d898, 42 0x9800d898,
177 0x86f001d9, 43 0x86f001d9,
178 0x0489b808, 44 0x0489b808,
179 0xf00c1bf4, 45 0xf00c1bf4,
180 0x21f502f7, 46 0x21f502f7,
181 0x00f802ec, 47 0x00f802fe,
182/* 0x001c: queue_put_next */ 48/* 0x001c: queue_put_next */
183 0xb60798c4, 49 0xb60798c4,
184 0x8dbb0384, 50 0x8dbb0384,
@@ -210,7 +76,7 @@ uint32_t nvc0_grgpc_code[] = {
210 0xc800bccf, 76 0xc800bccf,
211 0x1bf41fcc, 77 0x1bf41fcc,
212 0x06a7f0fa, 78 0x06a7f0fa,
213 0x010321f5, 79 0x010921f5,
214 0xf840bfcf, 80 0xf840bfcf,
215/* 0x008d: nv_wr32 */ 81/* 0x008d: nv_wr32 */
216 0x28b7f100, 82 0x28b7f100,
@@ -232,63 +98,66 @@ uint32_t nvc0_grgpc_code[] = {
232 0x0684b604, 98 0x0684b604,
233 0xf80080d0, 99 0xf80080d0,
234/* 0x00c9: wait_donez */ 100/* 0x00c9: wait_donez */
235 0x3c87f100, 101 0xf094bd00,
236 0x0684b608, 102 0x07f10099,
237 0x99f094bd, 103 0x03f00f00,
238 0x0089d000, 104 0x0009d002,
239 0x081887f1, 105 0x07f104bd,
240 0xd00684b6, 106 0x03f00600,
241/* 0x00e2: wait_done_wait_donez */ 107 0x000ad002,
242 0x87f1008a, 108/* 0x00e6: wait_donez_ne */
243 0x84b60400, 109 0x87f104bd,
244 0x0088cf06, 110 0x83f00000,
111 0x0088cf01,
245 0xf4888aff, 112 0xf4888aff,
246 0x87f1f31b, 113 0x94bdf31b,
247 0x84b6085c, 114 0xf10099f0,
248 0xf094bd06, 115 0xf0170007,
249 0x89d00099, 116 0x09d00203,
250/* 0x0103: wait_doneo */ 117 0xf804bd00,
251 0xf100f800, 118/* 0x0109: wait_doneo */
252 0xb6083c87, 119 0xf094bd00,
253 0x94bd0684, 120 0x07f10099,
254 0xd00099f0, 121 0x03f00f00,
255 0x87f10089, 122 0x0009d002,
123 0x87f104bd,
256 0x84b60818, 124 0x84b60818,
257 0x008ad006, 125 0x008ad006,
258/* 0x011c: wait_done_wait_doneo */ 126/* 0x0124: wait_doneo_e */
259 0x040087f1, 127 0x040087f1,
260 0xcf0684b6, 128 0xcf0684b6,
261 0x8aff0088, 129 0x8aff0088,
262 0xf30bf488, 130 0xf30bf488,
263 0x085c87f1, 131 0x99f094bd,
264 0xbd0684b6, 132 0x0007f100,
265 0x0099f094, 133 0x0203f017,
266 0xf80089d0, 134 0xbd0009d0,
267/* 0x013d: mmctx_size */ 135/* 0x0147: mmctx_size */
268/* 0x013f: nv_mmctx_size_loop */ 136 0xbd00f804,
269 0x9894bd00, 137/* 0x0149: nv_mmctx_size_loop */
270 0x85b600e8, 138 0x00e89894,
271 0x0180b61a, 139 0xb61a85b6,
272 0xbb0284b6, 140 0x84b60180,
273 0xe0b60098, 141 0x0098bb02,
274 0x04efb804, 142 0xb804e0b6,
275 0xb9eb1bf4, 143 0x1bf404ef,
276 0x00f8029f, 144 0x029fb9eb,
277/* 0x015c: mmctx_xfer */ 145/* 0x0166: mmctx_xfer */
278 0x083c87f1, 146 0x94bd00f8,
279 0xbd0684b6, 147 0xf10199f0,
280 0x0199f094, 148 0xf00f0007,
281 0xf10089d0, 149 0x09d00203,
150 0xf104bd00,
282 0xb6071087, 151 0xb6071087,
283 0x94bd0684, 152 0x94bd0684,
284 0xf405bbfd, 153 0xf405bbfd,
285 0x8bd0090b, 154 0x8bd0090b,
286 0x0099f000, 155 0x0099f000,
287/* 0x0180: mmctx_base_disabled */ 156/* 0x018c: mmctx_base_disabled */
288 0xf405eefd, 157 0xf405eefd,
289 0x8ed00c0b, 158 0x8ed00c0b,
290 0xc08fd080, 159 0xc08fd080,
291/* 0x018f: mmctx_multi_disabled */ 160/* 0x019b: mmctx_multi_disabled */
292 0xb70199f0, 161 0xb70199f0,
293 0xc8010080, 162 0xc8010080,
294 0xb4b600ab, 163 0xb4b600ab,
@@ -296,8 +165,8 @@ uint32_t nvc0_grgpc_code[] = {
296 0xb601aec8, 165 0xb601aec8,
297 0xbefd11e4, 166 0xbefd11e4,
298 0x008bd005, 167 0x008bd005,
299/* 0x01a8: mmctx_exec_loop */ 168/* 0x01b4: mmctx_exec_loop */
300/* 0x01a8: mmctx_wait_free */ 169/* 0x01b4: mmctx_wait_free */
301 0xf0008ecf, 170 0xf0008ecf,
302 0x0bf41fe4, 171 0x0bf41fe4,
303 0x00ce98fa, 172 0x00ce98fa,
@@ -306,76 +175,77 @@ uint32_t nvc0_grgpc_code[] = {
306 0x04cdb804, 175 0x04cdb804,
307 0xc8e81bf4, 176 0xc8e81bf4,
308 0x1bf402ab, 177 0x1bf402ab,
309/* 0x01c9: mmctx_fini_wait */ 178/* 0x01d5: mmctx_fini_wait */
310 0x008bcf18, 179 0x008bcf18,
311 0xb01fb4f0, 180 0xb01fb4f0,
312 0x1bf410b4, 181 0x1bf410b4,
313 0x02a7f0f7, 182 0x02a7f0f7,
314 0xf4c921f4, 183 0xf4c921f4,
315/* 0x01de: mmctx_stop */ 184/* 0x01ea: mmctx_stop */
316 0xabc81b0e, 185 0xabc81b0e,
317 0x10b4b600, 186 0x10b4b600,
318 0xf00cb9f0, 187 0xf00cb9f0,
319 0x8bd012b9, 188 0x8bd012b9,
320/* 0x01ed: mmctx_stop_wait */ 189/* 0x01f9: mmctx_stop_wait */
321 0x008bcf00, 190 0x008bcf00,
322 0xf412bbc8, 191 0xf412bbc8,
323/* 0x01f6: mmctx_done */ 192/* 0x0202: mmctx_done */
324 0x87f1fa1b, 193 0x94bdfa1b,
325 0x84b6085c, 194 0xf10199f0,
326 0xf094bd06, 195 0xf0170007,
327 0x89d00199, 196 0x09d00203,
328/* 0x0207: strand_wait */ 197 0xf804bd00,
329 0xf900f800, 198/* 0x0215: strand_wait */
330 0x02a7f0a0, 199 0xf0a0f900,
331 0xfcc921f4, 200 0x21f402a7,
332/* 0x0213: strand_pre */ 201 0xf8a0fcc9,
333 0xf100f8a0, 202/* 0x0221: strand_pre */
334 0xf04afc87, 203 0xfc87f100,
335 0x97f00283, 204 0x0283f04a,
336 0x0089d00c, 205 0xd00c97f0,
337 0x020721f5,
338/* 0x0226: strand_post */
339 0x87f100f8,
340 0x83f04afc,
341 0x0d97f002,
342 0xf50089d0,
343 0xf8020721,
344/* 0x0239: strand_set */
345 0xfca7f100,
346 0x02a3f04f,
347 0x0500aba2,
348 0xd00fc7f0,
349 0xc7f000ac,
350 0x00bcd00b,
351 0x020721f5,
352 0xf000aed0,
353 0xbcd00ac7,
354 0x0721f500,
355/* 0x0263: strand_ctx_init */
356 0xf100f802,
357 0xb6083c87,
358 0x94bd0684,
359 0xd00399f0,
360 0x21f50089, 206 0x21f50089,
361 0xe7f00213, 207 0x00f80215,
362 0x3921f503, 208/* 0x0234: strand_post */
209 0x4afc87f1,
210 0xf00283f0,
211 0x89d00d97,
212 0x1521f500,
213/* 0x0247: strand_set */
214 0xf100f802,
215 0xf04ffca7,
216 0xaba202a3,
217 0xc7f00500,
218 0x00acd00f,
219 0xd00bc7f0,
220 0x21f500bc,
221 0xaed00215,
222 0x0ac7f000,
223 0xf500bcd0,
224 0xf8021521,
225/* 0x0271: strand_ctx_init */
226 0xf094bd00,
227 0x07f10399,
228 0x03f00f00,
229 0x0009d002,
230 0x21f504bd,
231 0xe7f00221,
232 0x4721f503,
363 0xfca7f102, 233 0xfca7f102,
364 0x02a3f046, 234 0x02a3f046,
365 0x0400aba0, 235 0x0400aba0,
366 0xf040a0d0, 236 0xf040a0d0,
367 0xbcd001c7, 237 0xbcd001c7,
368 0x0721f500, 238 0x1521f500,
369 0x010c9202, 239 0x010c9202,
370 0xf000acd0, 240 0xf000acd0,
371 0xbcd002c7, 241 0xbcd002c7,
372 0x0721f500, 242 0x1521f500,
373 0x2621f502, 243 0x3421f502,
374 0x8087f102, 244 0x8087f102,
375 0x0684b608, 245 0x0684b608,
376 0xb70089cf, 246 0xb70089cf,
377 0x95220080, 247 0x95220080,
378/* 0x02ba: ctx_init_strand_loop */ 248/* 0x02ca: ctx_init_strand_loop */
379 0x8ed008fe, 249 0x8ed008fe,
380 0x408ed000, 250 0x408ed000,
381 0xb6808acf, 251 0xb6808acf,
@@ -384,86 +254,74 @@ uint32_t nvc0_grgpc_code[] = {
384 0xb60480b6, 254 0xb60480b6,
385 0x1bf40192, 255 0x1bf40192,
386 0x08e4b6e8, 256 0x08e4b6e8,
387 0xf1f2efbc, 257 0xbdf2efbc,
388 0xb6085c87, 258 0x0399f094,
389 0x94bd0684, 259 0x170007f1,
390 0xd00399f0, 260 0xd00203f0,
391 0x00f80089, 261 0x04bd0009,
392/* 0x02ec: error */ 262/* 0x02fe: error */
393 0xe7f1e0f9, 263 0xe0f900f8,
394 0xe3f09814, 264 0x9814e7f1,
395 0x8d21f440, 265 0xf440e3f0,
396 0x041ce0b7, 266 0xe0b78d21,
397 0xf401f7f0, 267 0xf7f0041c,
398 0xe0fc8d21, 268 0x8d21f401,
399/* 0x0306: init */ 269 0x00f8e0fc,
400 0x04bd00f8, 270/* 0x0318: init */
401 0xf10004fe, 271 0x04fe04bd,
402 0xf0120017, 272 0x0017f100,
403 0x12d00227, 273 0x0227f012,
404 0x3e17f100, 274 0xf10012d0,
405 0x0010fe04, 275 0xfe042617,
406 0x040017f1, 276 0x17f10010,
407 0xf0c010d0, 277 0x10d00400,
408 0x12d00427, 278 0x0427f0c0,
409 0x1031f400, 279 0xf40012d0,
410 0x060817f1, 280 0x17f11031,
411 0xcf0614b6, 281 0x14b60608,
412 0x37f00012, 282 0x0012cf06,
413 0x1f24f001, 283 0xf00137f0,
414 0xb60432bb, 284 0x32bb1f24,
415 0x02800132, 285 0x0132b604,
416 0x04038003, 286 0x80050280,
417 0x040010b7, 287 0x10b70603,
418 0x800012cf, 288 0x12cf0400,
419 0x27f10002, 289 0x04028000,
420 0x24b60800, 290 0x010027f1,
421 0x0022cf06, 291 0xcf0223f0,
422/* 0x035f: init_find_chipset */ 292 0x34bd0022,
423 0xb65817f0, 293 0x070047f1,
424 0x13980c10, 294 0x950644b6,
425 0x0432b800, 295 0x45d00825,
426 0xb00b0bf4, 296 0x4045d000,
427 0x1bf40034, 297 0x98000e98,
428/* 0x0373: init_context */ 298 0x21f5010f,
429 0xf100f8f1, 299 0x2fbb0147,
430 0xb6080027, 300 0x003fbb00,
431 0x22cf0624, 301 0x98010e98,
432 0xf134bd40, 302 0x21f5020f,
433 0xb6070047, 303 0x0e980147,
434 0x25950644, 304 0x00effd05,
435 0x0045d008, 305 0xbb002ebb,
436 0xbd4045d0, 306 0x40b7003e,
437 0x58f4bde4, 307 0x35b61300,
438 0x1f58021e, 308 0x0043d002,
439 0x020e4003, 309 0xb60825b6,
440 0xf5040f40, 310 0x20b60635,
441 0xbb013d21, 311 0x0130b601,
442 0x3fbb002f, 312 0xb60824b6,
443 0x041e5800, 313 0x2fb90834,
444 0x40051f58, 314 0x7121f502,
445 0x0f400a0e, 315 0x003fbb02,
446 0x3d21f50c, 316 0x010007f1,
447 0x030e9801, 317 0xd00203f0,
448 0xbb00effd, 318 0x04bd0003,
449 0x3ebb002e, 319 0x29f024bd,
450 0x0040b700, 320 0x0007f11f,
451 0x0235b613, 321 0x0203f008,
452 0xb60043d0, 322 0xbd0002d0,
453 0x35b60825, 323/* 0x03e9: main */
454 0x0120b606, 324 0x0031f404,
455 0xb60130b6,
456 0x34b60824,
457 0x022fb908,
458 0x026321f5,
459 0xf1003fbb,
460 0xb6080017,
461 0x13d00614,
462 0x0010b740,
463 0xf024bd08,
464 0x12d01f29,
465/* 0x0401: main */
466 0x0031f400,
467 0xf00028f4, 325 0xf00028f4,
468 0x21f41cd7, 326 0x21f41cd7,
469 0xf401f439, 327 0xf401f439,
@@ -474,94 +332,100 @@ uint32_t nvc0_grgpc_code[] = {
474 0x01e4b604, 332 0x01e4b604,
475 0xfe051efd, 333 0xfe051efd,
476 0x21f50018, 334 0x21f50018,
477 0x0ef404c3, 335 0x0ef404ad,
478/* 0x0431: main_not_ctx_xfer */ 336/* 0x0419: main_not_ctx_xfer */
479 0x10ef94d3, 337 0x10ef94d3,
480 0xf501f5f0, 338 0xf501f5f0,
481 0xf402ec21, 339 0xf402fe21,
482/* 0x043e: ih */ 340/* 0x0426: ih */
483 0x80f9c60e, 341 0x80f9c60e,
484 0xf90188fe, 342 0xf90188fe,
485 0xf990f980, 343 0xf990f980,
486 0xf9b0f9a0, 344 0xf9b0f9a0,
487 0xf9e0f9d0, 345 0xf9e0f9d0,
488 0x800acff0, 346 0xcf04bdf0,
489 0xf404abc4, 347 0xabc4800a,
490 0xb7f11d0b, 348 0x1d0bf404,
491 0xd7f01900, 349 0x1900b7f1,
492 0x40becf1c, 350 0xcf1cd7f0,
493 0xf400bfcf, 351 0xbfcf40be,
494 0xb0b70421, 352 0x0421f400,
495 0xe7f00400, 353 0x0400b0b7,
496 0x00bed001, 354 0xd001e7f0,
497/* 0x0474: ih_no_fifo */ 355/* 0x045e: ih_no_fifo */
498 0xfc400ad0, 356 0x0ad000be,
499 0xfce0fcf0, 357 0xfcf0fc40,
500 0xfcb0fcd0, 358 0xfcd0fce0,
501 0xfc90fca0, 359 0xfca0fcb0,
502 0x0088fe80, 360 0xfe80fc90,
503 0x32f480fc, 361 0x80fc0088,
504/* 0x048f: hub_barrier_done */ 362 0xf80032f4,
505 0xf001f800, 363/* 0x0479: hub_barrier_done */
506 0x0e9801f7, 364 0x01f7f001,
507 0x04febb00, 365 0xbb040e98,
508 0x9418e7f1, 366 0xe7f104fe,
509 0xf440e3f0, 367 0xe3f09418,
510 0x00f88d21, 368 0x8d21f440,
511/* 0x04a4: ctx_redswitch */ 369/* 0x048e: ctx_redswitch */
512 0x0614e7f1, 370 0xe7f100f8,
513 0xf006e4b6, 371 0xe4b60614,
514 0xefd020f7, 372 0x20f7f006,
515 0x08f7f000, 373 0xf000efd0,
516/* 0x04b4: ctx_redswitch_delay */ 374/* 0x049e: ctx_redswitch_delay */
517 0xf401f2b6, 375 0xf2b608f7,
518 0xf7f1fd1b, 376 0xfd1bf401,
519 0xefd00a20, 377 0x0a20f7f1,
520/* 0x04c3: ctx_xfer */ 378 0xf800efd0,
521 0xf100f800, 379/* 0x04ad: ctx_xfer */
522 0xb60a0417, 380 0x0417f100,
523 0x1fd00614, 381 0x0614b60a,
524 0x0711f400, 382 0xf4001fd0,
525 0x04a421f5, 383 0x21f50711,
526/* 0x04d4: ctx_xfer_not_load */ 384/* 0x04be: ctx_xfer_not_load */
527 0x4afc17f1, 385 0x17f1048e,
528 0xf00213f0, 386 0x13f04afc,
529 0x12d00c27, 387 0x0c27f002,
530 0x0721f500, 388 0xf50012d0,
531 0xfc27f102, 389 0xf1021521,
532 0x0223f047, 390 0xf047fc27,
533 0xf00020d0, 391 0x20d00223,
534 0x20b6012c, 392 0x012cf000,
535 0x0012d003, 393 0xd00320b6,
394 0xacf00012,
395 0x02a5f001,
396 0xf000b7f0,
397 0x0c9850b3,
398 0x0fc4b604,
399 0x9800bcbb,
400 0x0d98000c,
401 0x00e7f001,
402 0x016621f5,
536 0xf001acf0, 403 0xf001acf0,
537 0xb7f002a5, 404 0xb7f104a5,
538 0x50b3f000, 405 0xb3f04000,
539 0xb6000c98, 406 0x040c9850,
540 0xbcbb0fc4, 407 0xbb0fc4b6,
541 0x010c9800, 408 0x0c9800bc,
542 0xf0020d98, 409 0x020d9801,
543 0x21f500e7, 410 0xf1060f98,
544 0xacf0015c, 411 0xf50800e7,
545 0x04a5f001, 412 0xf5016621,
546 0x4000b7f1, 413 0xf4021521,
547 0x9850b3f0, 414 0x12f40601,
548 0xc4b6000c, 415/* 0x0535: ctx_xfer_post */
549 0x00bcbb0f, 416 0xfc17f114,
550 0x98050c98, 417 0x0213f04a,
551 0x0f98060d, 418 0xd00d27f0,
552 0x00e7f104, 419 0x21f50012,
553 0x5c21f508, 420/* 0x0546: ctx_xfer_done */
554 0x0721f501, 421 0x21f50215,
555 0x0601f402, 422 0x00f80479,
556/* 0x054b: ctx_xfer_post */ 423 0x00000000,
557 0xf11412f4, 424 0x00000000,
558 0xf04afc17, 425 0x00000000,
559 0x27f00213, 426 0x00000000,
560 0x0012d00d, 427 0x00000000,
561 0x020721f5, 428 0x00000000,
562/* 0x055c: ctx_xfer_done */
563 0x048f21f5,
564 0x000000f8,
565 0x00000000, 429 0x00000000,
566 0x00000000, 430 0x00000000,
567 0x00000000, 431 0x00000000,
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvd7.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvd7.fuc
new file mode 100644
index 000000000000..c2f754edbd7d
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvd7.fuc
@@ -0,0 +1,42 @@
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 <bskeggs@redhat.com>
23 */
24
25#define NV_PGRAPH_GPCX_UNK__SIZE 0x00000001
26
27#define CHIPSET GF117
28#include "macros.fuc"
29
30.section #nvd7_grgpc_data
31#define INCLUDE_DATA
32#include "com.fuc"
33#include "gpc.fuc"
34#undef INCLUDE_DATA
35
36.section #nvd7_grgpc_code
37#define INCLUDE_CODE
38bra #init
39#include "com.fuc"
40#include "gpc.fuc"
41.align 256
42#undef INCLUDE_CODE
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvd7.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvd7.fuc.h
new file mode 100644
index 000000000000..dd346c2a1624
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvd7.fuc.h
@@ -0,0 +1,475 @@
1uint32_t nvd7_grgpc_data[] = {
2/* 0x0000: gpc_mmio_list_head */
3 0x0000006c,
4/* 0x0004: gpc_mmio_list_tail */
5/* 0x0004: tpc_mmio_list_head */
6 0x0000006c,
7/* 0x0008: tpc_mmio_list_tail */
8/* 0x0008: unk_mmio_list_head */
9 0x0000006c,
10/* 0x000c: unk_mmio_list_tail */
11 0x0000006c,
12/* 0x0010: gpc_id */
13 0x00000000,
14/* 0x0014: tpc_count */
15 0x00000000,
16/* 0x0018: tpc_mask */
17 0x00000000,
18/* 0x001c: unk_count */
19 0x00000000,
20/* 0x0020: unk_mask */
21 0x00000000,
22/* 0x0024: cmd_queue */
23 0x00000000,
24 0x00000000,
25 0x00000000,
26 0x00000000,
27 0x00000000,
28 0x00000000,
29 0x00000000,
30 0x00000000,
31 0x00000000,
32 0x00000000,
33 0x00000000,
34 0x00000000,
35 0x00000000,
36 0x00000000,
37 0x00000000,
38 0x00000000,
39 0x00000000,
40 0x00000000,
41};
42
43uint32_t nvd7_grgpc_code[] = {
44 0x03180ef5,
45/* 0x0004: queue_put */
46 0x9800d898,
47 0x86f001d9,
48 0x0489b808,
49 0xf00c1bf4,
50 0x21f502f7,
51 0x00f802fe,
52/* 0x001c: queue_put_next */
53 0xb60798c4,
54 0x8dbb0384,
55 0x0880b600,
56 0x80008e80,
57 0x90b6018f,
58 0x0f94f001,
59 0xf801d980,
60/* 0x0039: queue_get */
61 0x0131f400,
62 0x9800d898,
63 0x89b801d9,
64 0x210bf404,
65 0xb60789c4,
66 0x9dbb0394,
67 0x0890b600,
68 0x98009e98,
69 0x80b6019f,
70 0x0f84f001,
71 0xf400d880,
72/* 0x0066: queue_get_done */
73 0x00f80132,
74/* 0x0068: nv_rd32 */
75 0x0728b7f1,
76 0xb906b4b6,
77 0xc9f002ec,
78 0x00bcd01f,
79/* 0x0078: nv_rd32_wait */
80 0xc800bccf,
81 0x1bf41fcc,
82 0x06a7f0fa,
83 0x010921f5,
84 0xf840bfcf,
85/* 0x008d: nv_wr32 */
86 0x28b7f100,
87 0x06b4b607,
88 0xb980bfd0,
89 0xc9f002ec,
90 0x1ec9f01f,
91/* 0x00a3: nv_wr32_wait */
92 0xcf00bcd0,
93 0xccc800bc,
94 0xfa1bf41f,
95/* 0x00ae: watchdog_reset */
96 0x87f100f8,
97 0x84b60430,
98 0x1ff9f006,
99 0xf8008fd0,
100/* 0x00bd: watchdog_clear */
101 0x3087f100,
102 0x0684b604,
103 0xf80080d0,
104/* 0x00c9: wait_donez */
105 0xf094bd00,
106 0x07f10099,
107 0x03f00f00,
108 0x0009d002,
109 0x07f104bd,
110 0x03f00600,
111 0x000ad002,
112/* 0x00e6: wait_donez_ne */
113 0x87f104bd,
114 0x83f00000,
115 0x0088cf01,
116 0xf4888aff,
117 0x94bdf31b,
118 0xf10099f0,
119 0xf0170007,
120 0x09d00203,
121 0xf804bd00,
122/* 0x0109: wait_doneo */
123 0xf094bd00,
124 0x07f10099,
125 0x03f00f00,
126 0x0009d002,
127 0x87f104bd,
128 0x84b60818,
129 0x008ad006,
130/* 0x0124: wait_doneo_e */
131 0x040087f1,
132 0xcf0684b6,
133 0x8aff0088,
134 0xf30bf488,
135 0x99f094bd,
136 0x0007f100,
137 0x0203f017,
138 0xbd0009d0,
139/* 0x0147: mmctx_size */
140 0xbd00f804,
141/* 0x0149: nv_mmctx_size_loop */
142 0x00e89894,
143 0xb61a85b6,
144 0x84b60180,
145 0x0098bb02,
146 0xb804e0b6,
147 0x1bf404ef,
148 0x029fb9eb,
149/* 0x0166: mmctx_xfer */
150 0x94bd00f8,
151 0xf10199f0,
152 0xf00f0007,
153 0x09d00203,
154 0xf104bd00,
155 0xb6071087,
156 0x94bd0684,
157 0xf405bbfd,
158 0x8bd0090b,
159 0x0099f000,
160/* 0x018c: mmctx_base_disabled */
161 0xf405eefd,
162 0x8ed00c0b,
163 0xc08fd080,
164/* 0x019b: mmctx_multi_disabled */
165 0xb70199f0,
166 0xc8010080,
167 0xb4b600ab,
168 0x0cb9f010,
169 0xb601aec8,
170 0xbefd11e4,
171 0x008bd005,
172/* 0x01b4: mmctx_exec_loop */
173/* 0x01b4: mmctx_wait_free */
174 0xf0008ecf,
175 0x0bf41fe4,
176 0x00ce98fa,
177 0xd005e9fd,
178 0xc0b6c08e,
179 0x04cdb804,
180 0xc8e81bf4,
181 0x1bf402ab,
182/* 0x01d5: mmctx_fini_wait */
183 0x008bcf18,
184 0xb01fb4f0,
185 0x1bf410b4,
186 0x02a7f0f7,
187 0xf4c921f4,
188/* 0x01ea: mmctx_stop */
189 0xabc81b0e,
190 0x10b4b600,
191 0xf00cb9f0,
192 0x8bd012b9,
193/* 0x01f9: mmctx_stop_wait */
194 0x008bcf00,
195 0xf412bbc8,
196/* 0x0202: mmctx_done */
197 0x94bdfa1b,
198 0xf10199f0,
199 0xf0170007,
200 0x09d00203,
201 0xf804bd00,
202/* 0x0215: strand_wait */
203 0xf0a0f900,
204 0x21f402a7,
205 0xf8a0fcc9,
206/* 0x0221: strand_pre */
207 0xfc87f100,
208 0x0283f04a,
209 0xd00c97f0,
210 0x21f50089,
211 0x00f80215,
212/* 0x0234: strand_post */
213 0x4afc87f1,
214 0xf00283f0,
215 0x89d00d97,
216 0x1521f500,
217/* 0x0247: strand_set */
218 0xf100f802,
219 0xf04ffca7,
220 0xaba202a3,
221 0xc7f00500,
222 0x00acd00f,
223 0xd00bc7f0,
224 0x21f500bc,
225 0xaed00215,
226 0x0ac7f000,
227 0xf500bcd0,
228 0xf8021521,
229/* 0x0271: strand_ctx_init */
230 0xf094bd00,
231 0x07f10399,
232 0x03f00f00,
233 0x0009d002,
234 0x21f504bd,
235 0xe7f00221,
236 0x4721f503,
237 0xfca7f102,
238 0x02a3f046,
239 0x0400aba0,
240 0xf040a0d0,
241 0xbcd001c7,
242 0x1521f500,
243 0x010c9202,
244 0xf000acd0,
245 0xbcd002c7,
246 0x1521f500,
247 0x3421f502,
248 0x8087f102,
249 0x0684b608,
250 0xb70089cf,
251 0x95220080,
252/* 0x02ca: ctx_init_strand_loop */
253 0x8ed008fe,
254 0x408ed000,
255 0xb6808acf,
256 0xa0b606a5,
257 0x00eabb01,
258 0xb60480b6,
259 0x1bf40192,
260 0x08e4b6e8,
261 0xbdf2efbc,
262 0x0399f094,
263 0x170007f1,
264 0xd00203f0,
265 0x04bd0009,
266/* 0x02fe: error */
267 0xe0f900f8,
268 0x9814e7f1,
269 0xf440e3f0,
270 0xe0b78d21,
271 0xf7f0041c,
272 0x8d21f401,
273 0x00f8e0fc,
274/* 0x0318: init */
275 0x04fe04bd,
276 0x0017f100,
277 0x0227f012,
278 0xf10012d0,
279 0xfe047017,
280 0x17f10010,
281 0x10d00400,
282 0x0427f0c0,
283 0xf40012d0,
284 0x17f11031,
285 0x14b60608,
286 0x0012cf06,
287 0xf00137f0,
288 0x32bb1f24,
289 0x0132b604,
290 0x80050280,
291 0x10b70603,
292 0x12cf0400,
293 0x04028000,
294 0x0c30e7f1,
295 0xbd50e3f0,
296 0xbd34bd24,
297/* 0x0371: init_unk_loop */
298 0x6821f444,
299 0xf400f6b0,
300 0xf7f00f0b,
301 0x04f2bb01,
302 0xb6054ffd,
303/* 0x0386: init_unk_next */
304 0x20b60130,
305 0x04e0b601,
306 0xf40126b0,
307/* 0x0392: init_unk_done */
308 0x0380e21b,
309 0x08048007,
310 0x010027f1,
311 0xcf0223f0,
312 0x34bd0022,
313 0x070047f1,
314 0x950644b6,
315 0x45d00825,
316 0x4045d000,
317 0x98000e98,
318 0x21f5010f,
319 0x2fbb0147,
320 0x003fbb00,
321 0x98010e98,
322 0x21f5020f,
323 0x0e980147,
324 0x00effd05,
325 0xbb002ebb,
326 0x0e98003e,
327 0x030f9802,
328 0x014721f5,
329 0xfd070e98,
330 0x2ebb00ef,
331 0x003ebb00,
332 0x130040b7,
333 0xd00235b6,
334 0x25b60043,
335 0x0635b608,
336 0xb60120b6,
337 0x24b60130,
338 0x0834b608,
339 0xf5022fb9,
340 0xbb027121,
341 0x07f1003f,
342 0x03f00100,
343 0x0003d002,
344 0x24bd04bd,
345 0xf11f29f0,
346 0xf0080007,
347 0x02d00203,
348/* 0x0433: main */
349 0xf404bd00,
350 0x28f40031,
351 0x24d7f000,
352 0xf43921f4,
353 0xe4b0f401,
354 0x1e18f404,
355 0xf00181fe,
356 0x20bd0627,
357 0xb60412fd,
358 0x1efd01e4,
359 0x0018fe05,
360 0x04f721f5,
361/* 0x0463: main_not_ctx_xfer */
362 0x94d30ef4,
363 0xf5f010ef,
364 0xfe21f501,
365 0xc60ef402,
366/* 0x0470: ih */
367 0x88fe80f9,
368 0xf980f901,
369 0xf9a0f990,
370 0xf9d0f9b0,
371 0xbdf0f9e0,
372 0x800acf04,
373 0xf404abc4,
374 0xb7f11d0b,
375 0xd7f01900,
376 0x40becf24,
377 0xf400bfcf,
378 0xb0b70421,
379 0xe7f00400,
380 0x00bed001,
381/* 0x04a8: ih_no_fifo */
382 0xfc400ad0,
383 0xfce0fcf0,
384 0xfcb0fcd0,
385 0xfc90fca0,
386 0x0088fe80,
387 0x32f480fc,
388/* 0x04c3: hub_barrier_done */
389 0xf001f800,
390 0x0e9801f7,
391 0x04febb04,
392 0x9418e7f1,
393 0xf440e3f0,
394 0x00f88d21,
395/* 0x04d8: ctx_redswitch */
396 0x0614e7f1,
397 0xf006e4b6,
398 0xefd020f7,
399 0x08f7f000,
400/* 0x04e8: ctx_redswitch_delay */
401 0xf401f2b6,
402 0xf7f1fd1b,
403 0xefd00a20,
404/* 0x04f7: ctx_xfer */
405 0xf100f800,
406 0xb60a0417,
407 0x1fd00614,
408 0x0711f400,
409 0x04d821f5,
410/* 0x0508: ctx_xfer_not_load */
411 0x4afc17f1,
412 0xf00213f0,
413 0x12d00c27,
414 0x1521f500,
415 0xfc27f102,
416 0x0223f047,
417 0xf00020d0,
418 0x20b6012c,
419 0x0012d003,
420 0xf001acf0,
421 0xb7f002a5,
422 0x50b3f000,
423 0xb6040c98,
424 0xbcbb0fc4,
425 0x000c9800,
426 0xf0010d98,
427 0x21f500e7,
428 0xacf00166,
429 0x00b7f101,
430 0x50b3f040,
431 0xb6040c98,
432 0xbcbb0fc4,
433 0x010c9800,
434 0x98020d98,
435 0xe7f1060f,
436 0x21f50800,
437 0xacf00166,
438 0x04a5f001,
439 0x3000b7f1,
440 0x9850b3f0,
441 0xc4b6040c,
442 0x00bcbb0f,
443 0x98020c98,
444 0x0f98030d,
445 0x00e7f108,
446 0x6621f502,
447 0x1521f501,
448 0x0601f402,
449/* 0x05a3: ctx_xfer_post */
450 0xf11412f4,
451 0xf04afc17,
452 0x27f00213,
453 0x0012d00d,
454 0x021521f5,
455/* 0x05b4: ctx_xfer_done */
456 0x04c321f5,
457 0x000000f8,
458 0x00000000,
459 0x00000000,
460 0x00000000,
461 0x00000000,
462 0x00000000,
463 0x00000000,
464 0x00000000,
465 0x00000000,
466 0x00000000,
467 0x00000000,
468 0x00000000,
469 0x00000000,
470 0x00000000,
471 0x00000000,
472 0x00000000,
473 0x00000000,
474 0x00000000,
475};
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc
index 62ab231cd6b6..6b906cd2a31f 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc
@@ -1,6 +1,5 @@
1/* fuc microcode for nve0 PGRAPH/GPC 1/*
2 * 2 * Copyright 2013 Red Hat Inc.
3 * Copyright 2011 Red Hat Inc.
4 * 3 *
5 * Permission is hereby granted, free of charge, to any person obtaining a 4 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"), 5 * copy of this software and associated documentation files (the "Software"),
@@ -20,437 +19,24 @@
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 * OTHER DEALINGS IN THE SOFTWARE. 20 * OTHER DEALINGS IN THE SOFTWARE.
22 * 21 *
23 * Authors: Ben Skeggs 22 * Authors: Ben Skeggs <bskeggs@redhat.com>
24 */ 23 */
25 24
26/* To build: 25#define NV_PGRAPH_GPCX_UNK__SIZE 0x00000001
27 * m4 nve0_grgpc.fuc | envyas -a -w -m fuc -V nva3 -o nve0_grgpc.fuc.h
28 */
29 26
30/* TODO 27#define CHIPSET GK100
31 * - bracket certain functions with scratch writes, useful for debugging 28#include "macros.fuc"
32 * - watchdog timer around ctx operations
33 */
34 29
35.section #nve0_grgpc_data 30.section #nve0_grgpc_data
36include(`nve0.fuc') 31#define INCLUDE_DATA
37gpc_id: .b32 0 32#include "com.fuc"
38gpc_mmio_list_head: .b32 0 33#include "gpc.fuc"
39gpc_mmio_list_tail: .b32 0 34#undef INCLUDE_DATA
40
41tpc_count: .b32 0
42tpc_mask: .b32 0
43tpc_mmio_list_head: .b32 0
44tpc_mmio_list_tail: .b32 0
45
46cmd_queue: queue_init
47
48// chipset descriptions
49chipsets:
50.b8 0xe4 0 0 0
51.b16 #nve4_gpc_mmio_head
52.b16 #nve4_gpc_mmio_tail
53.b16 #nve4_tpc_mmio_head
54.b16 #nve4_tpc_mmio_tail
55.b8 0xe7 0 0 0
56.b16 #nve4_gpc_mmio_head
57.b16 #nve4_gpc_mmio_tail
58.b16 #nve4_tpc_mmio_head
59.b16 #nve4_tpc_mmio_tail
60.b8 0xe6 0 0 0
61.b16 #nve4_gpc_mmio_head
62.b16 #nve4_gpc_mmio_tail
63.b16 #nve4_tpc_mmio_head
64.b16 #nve4_tpc_mmio_tail
65.b8 0 0 0 0
66
67// GPC mmio lists
68nve4_gpc_mmio_head:
69mmctx_data(0x000380, 1)
70mmctx_data(0x000400, 2)
71mmctx_data(0x00040c, 3)
72mmctx_data(0x000450, 9)
73mmctx_data(0x000600, 1)
74mmctx_data(0x000684, 1)
75mmctx_data(0x000700, 5)
76mmctx_data(0x000800, 1)
77mmctx_data(0x000808, 3)
78mmctx_data(0x000828, 1)
79mmctx_data(0x000830, 1)
80mmctx_data(0x0008d8, 1)
81mmctx_data(0x0008e0, 1)
82mmctx_data(0x0008e8, 6)
83mmctx_data(0x00091c, 1)
84mmctx_data(0x000924, 3)
85mmctx_data(0x000b00, 1)
86mmctx_data(0x000b08, 6)
87mmctx_data(0x000bb8, 1)
88mmctx_data(0x000c08, 1)
89mmctx_data(0x000c10, 8)
90mmctx_data(0x000c40, 1)
91mmctx_data(0x000c6c, 1)
92mmctx_data(0x000c80, 1)
93mmctx_data(0x000c8c, 1)
94mmctx_data(0x001000, 3)
95mmctx_data(0x001014, 1)
96mmctx_data(0x003024, 1)
97mmctx_data(0x0030c0, 2)
98mmctx_data(0x0030e4, 1)
99mmctx_data(0x003100, 6)
100mmctx_data(0x0031d0, 1)
101mmctx_data(0x0031e0, 2)
102nve4_gpc_mmio_tail:
103
104// TPC mmio lists
105nve4_tpc_mmio_head:
106mmctx_data(0x000048, 1)
107mmctx_data(0x000064, 1)
108mmctx_data(0x000088, 1)
109mmctx_data(0x000200, 6)
110mmctx_data(0x00021c, 2)
111mmctx_data(0x000230, 1)
112mmctx_data(0x0002c4, 1)
113mmctx_data(0x000400, 3)
114mmctx_data(0x000420, 3)
115mmctx_data(0x0004e8, 1)
116mmctx_data(0x0004f4, 1)
117mmctx_data(0x000604, 4)
118mmctx_data(0x000644, 22)
119mmctx_data(0x0006ac, 2)
120mmctx_data(0x0006c8, 1)
121mmctx_data(0x000730, 8)
122mmctx_data(0x000758, 1)
123mmctx_data(0x000778, 1)
124nve4_tpc_mmio_tail:
125 35
126.section #nve0_grgpc_code 36.section #nve0_grgpc_code
37#define INCLUDE_CODE
127bra #init 38bra #init
128define(`include_code') 39#include "com.fuc"
129include(`nve0.fuc') 40#include "gpc.fuc"
130
131// reports an exception to the host
132//
133// In: $r15 error code (see nve0.fuc)
134//
135error:
136 push $r14
137 mov $r14 -0x67ec // 0x9814
138 sethi $r14 0x400000
139 call #nv_wr32 // HUB_CTXCTL_CC_SCRATCH[5] = error code
140 add b32 $r14 0x41c
141 mov $r15 1
142 call #nv_wr32 // HUB_CTXCTL_INTR_UP_SET
143 pop $r14
144 ret
145
146// GPC fuc initialisation, executed by triggering ucode start, will
147// fall through to main loop after completion.
148//
149// Input:
150// CC_SCRATCH[0]: chipset (PMC_BOOT_0 read returns 0x0bad0bad... sigh)
151// CC_SCRATCH[1]: context base
152//
153// Output:
154// CC_SCRATCH[0]:
155// 31:31: set to signal completion
156// CC_SCRATCH[1]:
157// 31:0: GPC context size
158//
159init:
160 clear b32 $r0
161 mov $sp $r0
162
163 // enable fifo access
164 mov $r1 0x1200
165 mov $r2 2
166 iowr I[$r1 + 0x000] $r2 // FIFO_ENABLE
167
168 // setup i0 handler, and route all interrupts to it
169 mov $r1 #ih
170 mov $iv0 $r1
171 mov $r1 0x400
172 iowr I[$r1 + 0x300] $r0 // INTR_DISPATCH
173
174 // enable fifo interrupt
175 mov $r2 4
176 iowr I[$r1 + 0x000] $r2 // INTR_EN_SET
177
178 // enable interrupts
179 bset $flags ie0
180
181 // figure out which GPC we are, and how many TPCs we have
182 mov $r1 0x608
183 shl b32 $r1 6
184 iord $r2 I[$r1 + 0x000] // UNITS
185 mov $r3 1
186 and $r2 0x1f
187 shl b32 $r3 $r2
188 sub b32 $r3 1
189 st b32 D[$r0 + #tpc_count] $r2
190 st b32 D[$r0 + #tpc_mask] $r3
191 add b32 $r1 0x400
192 iord $r2 I[$r1 + 0x000] // MYINDEX
193 st b32 D[$r0 + #gpc_id] $r2
194
195 // find context data for this chipset
196 mov $r2 0x800
197 shl b32 $r2 6
198 iord $r2 I[$r2 + 0x000] // CC_SCRATCH[0]
199 mov $r1 #chipsets - 12
200 init_find_chipset:
201 add b32 $r1 12
202 ld b32 $r3 D[$r1 + 0x00]
203 cmpu b32 $r3 $r2
204 bra e #init_context
205 cmpu b32 $r3 0
206 bra ne #init_find_chipset
207 // unknown chipset
208 ret
209
210 // initialise context base, and size tracking
211 init_context:
212 mov $r2 0x800
213 shl b32 $r2 6
214 iord $r2 I[$r2 + 0x100] // CC_SCRATCH[1], initial base
215 clear b32 $r3 // track GPC context size here
216
217 // set mmctx base addresses now so we don't have to do it later,
218 // they don't currently ever change
219 mov $r4 0x700
220 shl b32 $r4 6
221 shr b32 $r5 $r2 8
222 iowr I[$r4 + 0x000] $r5 // MMCTX_SAVE_SWBASE
223 iowr I[$r4 + 0x100] $r5 // MMCTX_LOAD_SWBASE
224
225 // calculate GPC mmio context size, store the chipset-specific
226 // mmio list pointers somewhere we can get at them later without
227 // re-parsing the chipset list
228 clear b32 $r14
229 clear b32 $r15
230 ld b16 $r14 D[$r1 + 4]
231 ld b16 $r15 D[$r1 + 6]
232 st b16 D[$r0 + #gpc_mmio_list_head] $r14
233 st b16 D[$r0 + #gpc_mmio_list_tail] $r15
234 call #mmctx_size
235 add b32 $r2 $r15
236 add b32 $r3 $r15
237
238 // calculate per-TPC mmio context size, store the list pointers
239 ld b16 $r14 D[$r1 + 8]
240 ld b16 $r15 D[$r1 + 10]
241 st b16 D[$r0 + #tpc_mmio_list_head] $r14
242 st b16 D[$r0 + #tpc_mmio_list_tail] $r15
243 call #mmctx_size
244 ld b32 $r14 D[$r0 + #tpc_count]
245 mulu $r14 $r15
246 add b32 $r2 $r14
247 add b32 $r3 $r14
248
249 // round up base/size to 256 byte boundary (for strand SWBASE)
250 add b32 $r4 0x1300
251 shr b32 $r3 2
252 iowr I[$r4 + 0x000] $r3 // MMCTX_LOAD_COUNT, wtf for?!?
253 shr b32 $r2 8
254 shr b32 $r3 6
255 add b32 $r2 1
256 add b32 $r3 1
257 shl b32 $r2 8
258 shl b32 $r3 8
259
260 // calculate size of strand context data
261 mov b32 $r15 $r2
262 call #strand_ctx_init
263 add b32 $r3 $r15
264
265 // save context size, and tell HUB we're done
266 mov $r1 0x800
267 shl b32 $r1 6
268 iowr I[$r1 + 0x100] $r3 // CC_SCRATCH[1] = context size
269 add b32 $r1 0x800
270 clear b32 $r2
271 bset $r2 31
272 iowr I[$r1 + 0x000] $r2 // CC_SCRATCH[0] |= 0x80000000
273
274// Main program loop, very simple, sleeps until woken up by the interrupt
275// handler, pulls a command from the queue and executes its handler
276//
277main:
278 bset $flags $p0
279 sleep $p0
280 mov $r13 #cmd_queue
281 call #queue_get
282 bra $p1 #main
283
284 // 0x0000-0x0003 are all context transfers
285 cmpu b32 $r14 0x04
286 bra nc #main_not_ctx_xfer
287 // fetch $flags and mask off $p1/$p2
288 mov $r1 $flags
289 mov $r2 0x0006
290 not b32 $r2
291 and $r1 $r2
292 // set $p1/$p2 according to transfer type
293 shl b32 $r14 1
294 or $r1 $r14
295 mov $flags $r1
296 // transfer context data
297 call #ctx_xfer
298 bra #main
299
300 main_not_ctx_xfer:
301 shl b32 $r15 $r14 16
302 or $r15 E_BAD_COMMAND
303 call #error
304 bra #main
305
306// interrupt handler
307ih:
308 push $r8
309 mov $r8 $flags
310 push $r8
311 push $r9
312 push $r10
313 push $r11
314 push $r13
315 push $r14
316 push $r15
317
318 // incoming fifo command?
319 iord $r10 I[$r0 + 0x200] // INTR
320 and $r11 $r10 0x00000004
321 bra e #ih_no_fifo
322 // queue incoming fifo command for later processing
323 mov $r11 0x1900
324 mov $r13 #cmd_queue
325 iord $r14 I[$r11 + 0x100] // FIFO_CMD
326 iord $r15 I[$r11 + 0x000] // FIFO_DATA
327 call #queue_put
328 add b32 $r11 0x400
329 mov $r14 1
330 iowr I[$r11 + 0x000] $r14 // FIFO_ACK
331
332 // ack, and wake up main()
333 ih_no_fifo:
334 iowr I[$r0 + 0x100] $r10 // INTR_ACK
335
336 pop $r15
337 pop $r14
338 pop $r13
339 pop $r11
340 pop $r10
341 pop $r9
342 pop $r8
343 mov $flags $r8
344 pop $r8
345 bclr $flags $p0
346 iret
347
348// Set this GPC's bit in HUB_BAR, used to signal completion of various
349// activities to the HUB fuc
350//
351hub_barrier_done:
352 mov $r15 1
353 ld b32 $r14 D[$r0 + #gpc_id]
354 shl b32 $r15 $r14
355 mov $r14 -0x6be8 // 0x409418 - HUB_BAR_SET
356 sethi $r14 0x400000
357 call #nv_wr32
358 ret
359
360// Disables various things, waits a bit, and re-enables them..
361//
362// Not sure how exactly this helps, perhaps "ENABLE" is not such a
363// good description for the bits we turn off? Anyways, without this,
364// funny things happen.
365//
366ctx_redswitch:
367 mov $r14 0x614
368 shl b32 $r14 6
369 mov $r15 0x020
370 iowr I[$r14] $r15 // GPC_RED_SWITCH = POWER
371 mov $r15 8
372 ctx_redswitch_delay:
373 sub b32 $r15 1
374 bra ne #ctx_redswitch_delay
375 mov $r15 0xa20
376 iowr I[$r14] $r15 // GPC_RED_SWITCH = UNK11, ENABLE, POWER
377 ret
378
379// Transfer GPC context data between GPU and storage area
380//
381// In: $r15 context base address
382// $p1 clear on save, set on load
383// $p2 set if opposite direction done/will be done, so:
384// on save it means: "a load will follow this save"
385// on load it means: "a save preceeded this load"
386//
387ctx_xfer:
388 // set context base address
389 mov $r1 0xa04
390 shl b32 $r1 6
391 iowr I[$r1 + 0x000] $r15// MEM_BASE
392 bra not $p1 #ctx_xfer_not_load
393 call #ctx_redswitch
394 ctx_xfer_not_load:
395
396 // strands
397 mov $r1 0x4afc
398 sethi $r1 0x20000
399 mov $r2 0xc
400 iowr I[$r1] $r2 // STRAND_CMD(0x3f) = 0x0c
401 call #strand_wait
402 mov $r2 0x47fc
403 sethi $r2 0x20000
404 iowr I[$r2] $r0 // STRAND_FIRST_GENE(0x3f) = 0x00
405 xbit $r2 $flags $p1
406 add b32 $r2 3
407 iowr I[$r1] $r2 // STRAND_CMD(0x3f) = 0x03/0x04 (SAVE/LOAD)
408
409 // mmio context
410 xbit $r10 $flags $p1 // direction
411 or $r10 2 // first
412 mov $r11 0x0000
413 sethi $r11 0x500000
414 ld b32 $r12 D[$r0 + #gpc_id]
415 shl b32 $r12 15
416 add b32 $r11 $r12 // base = NV_PGRAPH_GPCn
417 ld b32 $r12 D[$r0 + #gpc_mmio_list_head]
418 ld b32 $r13 D[$r0 + #gpc_mmio_list_tail]
419 mov $r14 0 // not multi
420 call #mmctx_xfer
421
422 // per-TPC mmio context
423 xbit $r10 $flags $p1 // direction
424 or $r10 4 // last
425 mov $r11 0x4000
426 sethi $r11 0x500000 // base = NV_PGRAPH_GPC0_TPC0
427 ld b32 $r12 D[$r0 + #gpc_id]
428 shl b32 $r12 15
429 add b32 $r11 $r12 // base = NV_PGRAPH_GPCn_TPC0
430 ld b32 $r12 D[$r0 + #tpc_mmio_list_head]
431 ld b32 $r13 D[$r0 + #tpc_mmio_list_tail]
432 ld b32 $r15 D[$r0 + #tpc_mask]
433 mov $r14 0x800 // stride = 0x800
434 call #mmctx_xfer
435
436 // wait for strands to finish
437 call #strand_wait
438
439 // if load, or a save without a load following, do some
440 // unknown stuff that's done after finishing a block of
441 // strand commands
442 bra $p1 #ctx_xfer_post
443 bra not $p2 #ctx_xfer_done
444 ctx_xfer_post:
445 mov $r1 0x4afc
446 sethi $r1 0x20000
447 mov $r2 0xd
448 iowr I[$r1] $r2 // STRAND_CMD(0x3f) = 0x0d
449 call #strand_wait
450
451 // mark completion in HUB's barrier
452 ctx_xfer_done:
453 call #hub_barrier_done
454 ret
455
456.align 256 41.align 256
42#undef INCLUDE_CODE
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc.h
index 09ee4702c8b2..7ff5ef6b0804 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc.h
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc.h
@@ -1,19 +1,27 @@
1uint32_t nve0_grgpc_data[] = { 1uint32_t nve0_grgpc_data[] = {
2/* 0x0000: gpc_id */ 2/* 0x0000: gpc_mmio_list_head */
3 0x0000006c,
4/* 0x0004: gpc_mmio_list_tail */
5/* 0x0004: tpc_mmio_list_head */
6 0x0000006c,
7/* 0x0008: tpc_mmio_list_tail */
8/* 0x0008: unk_mmio_list_head */
9 0x0000006c,
10/* 0x000c: unk_mmio_list_tail */
11 0x0000006c,
12/* 0x0010: gpc_id */
3 0x00000000, 13 0x00000000,
4/* 0x0004: gpc_mmio_list_head */ 14/* 0x0014: tpc_count */
5 0x00000000, 15 0x00000000,
6/* 0x0008: gpc_mmio_list_tail */ 16/* 0x0018: tpc_mask */
7 0x00000000, 17 0x00000000,
8/* 0x000c: tpc_count */ 18/* 0x001c: unk_count */
9 0x00000000, 19 0x00000000,
10/* 0x0010: tpc_mask */ 20/* 0x0020: unk_mask */
11 0x00000000, 21 0x00000000,
12/* 0x0014: tpc_mmio_list_head */ 22/* 0x0024: cmd_queue */
13 0x00000000, 23 0x00000000,
14/* 0x0018: tpc_mmio_list_tail */
15 0x00000000, 24 0x00000000,
16/* 0x001c: cmd_queue */
17 0x00000000, 25 0x00000000,
18 0x00000000, 26 0x00000000,
19 0x00000000, 27 0x00000000,
@@ -30,84 +38,17 @@ uint32_t nve0_grgpc_data[] = {
30 0x00000000, 38 0x00000000,
31 0x00000000, 39 0x00000000,
32 0x00000000, 40 0x00000000,
33 0x00000000,
34 0x00000000,
35/* 0x0064: chipsets */
36 0x000000e4,
37 0x0110008c,
38 0x01580110,
39 0x000000e7,
40 0x0110008c,
41 0x01580110,
42 0x000000e6,
43 0x0110008c,
44 0x01580110,
45 0x00000000,
46/* 0x008c: nve4_gpc_mmio_head */
47 0x00000380,
48 0x04000400,
49 0x0800040c,
50 0x20000450,
51 0x00000600,
52 0x00000684,
53 0x10000700,
54 0x00000800,
55 0x08000808,
56 0x00000828,
57 0x00000830,
58 0x000008d8,
59 0x000008e0,
60 0x140008e8,
61 0x0000091c,
62 0x08000924,
63 0x00000b00,
64 0x14000b08,
65 0x00000bb8,
66 0x00000c08,
67 0x1c000c10,
68 0x00000c40,
69 0x00000c6c,
70 0x00000c80,
71 0x00000c8c,
72 0x08001000,
73 0x00001014,
74 0x00003024,
75 0x040030c0,
76 0x000030e4,
77 0x14003100,
78 0x000031d0,
79 0x040031e0,
80/* 0x0110: nve4_gpc_mmio_tail */
81/* 0x0110: nve4_tpc_mmio_head */
82 0x00000048,
83 0x00000064,
84 0x00000088,
85 0x14000200,
86 0x0400021c,
87 0x00000230,
88 0x000002c4,
89 0x08000400,
90 0x08000420,
91 0x000004e8,
92 0x000004f4,
93 0x0c000604,
94 0x54000644,
95 0x040006ac,
96 0x000006c8,
97 0x1c000730,
98 0x00000758,
99 0x00000778,
100}; 41};
101 42
102uint32_t nve0_grgpc_code[] = { 43uint32_t nve0_grgpc_code[] = {
103 0x03060ef5, 44 0x03180ef5,
104/* 0x0004: queue_put */ 45/* 0x0004: queue_put */
105 0x9800d898, 46 0x9800d898,
106 0x86f001d9, 47 0x86f001d9,
107 0x0489b808, 48 0x0489b808,
108 0xf00c1bf4, 49 0xf00c1bf4,
109 0x21f502f7, 50 0x21f502f7,
110 0x00f802ec, 51 0x00f802fe,
111/* 0x001c: queue_put_next */ 52/* 0x001c: queue_put_next */
112 0xb60798c4, 53 0xb60798c4,
113 0x8dbb0384, 54 0x8dbb0384,
@@ -139,7 +80,7 @@ uint32_t nve0_grgpc_code[] = {
139 0xc800bccf, 80 0xc800bccf,
140 0x1bf41fcc, 81 0x1bf41fcc,
141 0x06a7f0fa, 82 0x06a7f0fa,
142 0x010321f5, 83 0x010921f5,
143 0xf840bfcf, 84 0xf840bfcf,
144/* 0x008d: nv_wr32 */ 85/* 0x008d: nv_wr32 */
145 0x28b7f100, 86 0x28b7f100,
@@ -161,63 +102,66 @@ uint32_t nve0_grgpc_code[] = {
161 0x0684b604, 102 0x0684b604,
162 0xf80080d0, 103 0xf80080d0,
163/* 0x00c9: wait_donez */ 104/* 0x00c9: wait_donez */
164 0x3c87f100, 105 0xf094bd00,
165 0x0684b608, 106 0x07f10099,
166 0x99f094bd, 107 0x03f00f00,
167 0x0089d000, 108 0x0009d002,
168 0x081887f1, 109 0x07f104bd,
169 0xd00684b6, 110 0x03f00600,
170/* 0x00e2: wait_done_wait_donez */ 111 0x000ad002,
171 0x87f1008a, 112/* 0x00e6: wait_donez_ne */
172 0x84b60400, 113 0x87f104bd,
173 0x0088cf06, 114 0x83f00000,
115 0x0088cf01,
174 0xf4888aff, 116 0xf4888aff,
175 0x87f1f31b, 117 0x94bdf31b,
176 0x84b6085c, 118 0xf10099f0,
177 0xf094bd06, 119 0xf0170007,
178 0x89d00099, 120 0x09d00203,
179/* 0x0103: wait_doneo */ 121 0xf804bd00,
180 0xf100f800, 122/* 0x0109: wait_doneo */
181 0xb6083c87, 123 0xf094bd00,
182 0x94bd0684, 124 0x07f10099,
183 0xd00099f0, 125 0x03f00f00,
184 0x87f10089, 126 0x0009d002,
127 0x87f104bd,
185 0x84b60818, 128 0x84b60818,
186 0x008ad006, 129 0x008ad006,
187/* 0x011c: wait_done_wait_doneo */ 130/* 0x0124: wait_doneo_e */
188 0x040087f1, 131 0x040087f1,
189 0xcf0684b6, 132 0xcf0684b6,
190 0x8aff0088, 133 0x8aff0088,
191 0xf30bf488, 134 0xf30bf488,
192 0x085c87f1, 135 0x99f094bd,
193 0xbd0684b6, 136 0x0007f100,
194 0x0099f094, 137 0x0203f017,
195 0xf80089d0, 138 0xbd0009d0,
196/* 0x013d: mmctx_size */ 139/* 0x0147: mmctx_size */
197/* 0x013f: nv_mmctx_size_loop */ 140 0xbd00f804,
198 0x9894bd00, 141/* 0x0149: nv_mmctx_size_loop */
199 0x85b600e8, 142 0x00e89894,
200 0x0180b61a, 143 0xb61a85b6,
201 0xbb0284b6, 144 0x84b60180,
202 0xe0b60098, 145 0x0098bb02,
203 0x04efb804, 146 0xb804e0b6,
204 0xb9eb1bf4, 147 0x1bf404ef,
205 0x00f8029f, 148 0x029fb9eb,
206/* 0x015c: mmctx_xfer */ 149/* 0x0166: mmctx_xfer */
207 0x083c87f1, 150 0x94bd00f8,
208 0xbd0684b6, 151 0xf10199f0,
209 0x0199f094, 152 0xf00f0007,
210 0xf10089d0, 153 0x09d00203,
154 0xf104bd00,
211 0xb6071087, 155 0xb6071087,
212 0x94bd0684, 156 0x94bd0684,
213 0xf405bbfd, 157 0xf405bbfd,
214 0x8bd0090b, 158 0x8bd0090b,
215 0x0099f000, 159 0x0099f000,
216/* 0x0180: mmctx_base_disabled */ 160/* 0x018c: mmctx_base_disabled */
217 0xf405eefd, 161 0xf405eefd,
218 0x8ed00c0b, 162 0x8ed00c0b,
219 0xc08fd080, 163 0xc08fd080,
220/* 0x018f: mmctx_multi_disabled */ 164/* 0x019b: mmctx_multi_disabled */
221 0xb70199f0, 165 0xb70199f0,
222 0xc8010080, 166 0xc8010080,
223 0xb4b600ab, 167 0xb4b600ab,
@@ -225,8 +169,8 @@ uint32_t nve0_grgpc_code[] = {
225 0xb601aec8, 169 0xb601aec8,
226 0xbefd11e4, 170 0xbefd11e4,
227 0x008bd005, 171 0x008bd005,
228/* 0x01a8: mmctx_exec_loop */ 172/* 0x01b4: mmctx_exec_loop */
229/* 0x01a8: mmctx_wait_free */ 173/* 0x01b4: mmctx_wait_free */
230 0xf0008ecf, 174 0xf0008ecf,
231 0x0bf41fe4, 175 0x0bf41fe4,
232 0x00ce98fa, 176 0x00ce98fa,
@@ -235,76 +179,77 @@ uint32_t nve0_grgpc_code[] = {
235 0x04cdb804, 179 0x04cdb804,
236 0xc8e81bf4, 180 0xc8e81bf4,
237 0x1bf402ab, 181 0x1bf402ab,
238/* 0x01c9: mmctx_fini_wait */ 182/* 0x01d5: mmctx_fini_wait */
239 0x008bcf18, 183 0x008bcf18,
240 0xb01fb4f0, 184 0xb01fb4f0,
241 0x1bf410b4, 185 0x1bf410b4,
242 0x02a7f0f7, 186 0x02a7f0f7,
243 0xf4c921f4, 187 0xf4c921f4,
244/* 0x01de: mmctx_stop */ 188/* 0x01ea: mmctx_stop */
245 0xabc81b0e, 189 0xabc81b0e,
246 0x10b4b600, 190 0x10b4b600,
247 0xf00cb9f0, 191 0xf00cb9f0,
248 0x8bd012b9, 192 0x8bd012b9,
249/* 0x01ed: mmctx_stop_wait */ 193/* 0x01f9: mmctx_stop_wait */
250 0x008bcf00, 194 0x008bcf00,
251 0xf412bbc8, 195 0xf412bbc8,
252/* 0x01f6: mmctx_done */ 196/* 0x0202: mmctx_done */
253 0x87f1fa1b, 197 0x94bdfa1b,
254 0x84b6085c, 198 0xf10199f0,
255 0xf094bd06, 199 0xf0170007,
256 0x89d00199, 200 0x09d00203,
257/* 0x0207: strand_wait */ 201 0xf804bd00,
258 0xf900f800, 202/* 0x0215: strand_wait */
259 0x02a7f0a0, 203 0xf0a0f900,
260 0xfcc921f4, 204 0x21f402a7,
261/* 0x0213: strand_pre */ 205 0xf8a0fcc9,
262 0xf100f8a0, 206/* 0x0221: strand_pre */
263 0xf04afc87, 207 0xfc87f100,
264 0x97f00283, 208 0x0283f04a,
265 0x0089d00c, 209 0xd00c97f0,
266 0x020721f5,
267/* 0x0226: strand_post */
268 0x87f100f8,
269 0x83f04afc,
270 0x0d97f002,
271 0xf50089d0,
272 0xf8020721,
273/* 0x0239: strand_set */
274 0xfca7f100,
275 0x02a3f04f,
276 0x0500aba2,
277 0xd00fc7f0,
278 0xc7f000ac,
279 0x00bcd00b,
280 0x020721f5,
281 0xf000aed0,
282 0xbcd00ac7,
283 0x0721f500,
284/* 0x0263: strand_ctx_init */
285 0xf100f802,
286 0xb6083c87,
287 0x94bd0684,
288 0xd00399f0,
289 0x21f50089, 210 0x21f50089,
290 0xe7f00213, 211 0x00f80215,
291 0x3921f503, 212/* 0x0234: strand_post */
213 0x4afc87f1,
214 0xf00283f0,
215 0x89d00d97,
216 0x1521f500,
217/* 0x0247: strand_set */
218 0xf100f802,
219 0xf04ffca7,
220 0xaba202a3,
221 0xc7f00500,
222 0x00acd00f,
223 0xd00bc7f0,
224 0x21f500bc,
225 0xaed00215,
226 0x0ac7f000,
227 0xf500bcd0,
228 0xf8021521,
229/* 0x0271: strand_ctx_init */
230 0xf094bd00,
231 0x07f10399,
232 0x03f00f00,
233 0x0009d002,
234 0x21f504bd,
235 0xe7f00221,
236 0x4721f503,
292 0xfca7f102, 237 0xfca7f102,
293 0x02a3f046, 238 0x02a3f046,
294 0x0400aba0, 239 0x0400aba0,
295 0xf040a0d0, 240 0xf040a0d0,
296 0xbcd001c7, 241 0xbcd001c7,
297 0x0721f500, 242 0x1521f500,
298 0x010c9202, 243 0x010c9202,
299 0xf000acd0, 244 0xf000acd0,
300 0xbcd002c7, 245 0xbcd002c7,
301 0x0721f500, 246 0x1521f500,
302 0x2621f502, 247 0x3421f502,
303 0x8087f102, 248 0x8087f102,
304 0x0684b608, 249 0x0684b608,
305 0xb70089cf, 250 0xb70089cf,
306 0x95220080, 251 0x95220080,
307/* 0x02ba: ctx_init_strand_loop */ 252/* 0x02ca: ctx_init_strand_loop */
308 0x8ed008fe, 253 0x8ed008fe,
309 0x408ed000, 254 0x408ed000,
310 0xb6808acf, 255 0xb6808acf,
@@ -313,150 +258,160 @@ uint32_t nve0_grgpc_code[] = {
313 0xb60480b6, 258 0xb60480b6,
314 0x1bf40192, 259 0x1bf40192,
315 0x08e4b6e8, 260 0x08e4b6e8,
316 0xf1f2efbc, 261 0xbdf2efbc,
317 0xb6085c87, 262 0x0399f094,
318 0x94bd0684, 263 0x170007f1,
319 0xd00399f0, 264 0xd00203f0,
320 0x00f80089, 265 0x04bd0009,
321/* 0x02ec: error */ 266/* 0x02fe: error */
322 0xe7f1e0f9, 267 0xe0f900f8,
323 0xe3f09814, 268 0x9814e7f1,
324 0x8d21f440, 269 0xf440e3f0,
325 0x041ce0b7, 270 0xe0b78d21,
326 0xf401f7f0, 271 0xf7f0041c,
327 0xe0fc8d21, 272 0x8d21f401,
328/* 0x0306: init */ 273 0x00f8e0fc,
329 0x04bd00f8, 274/* 0x0318: init */
330 0xf10004fe, 275 0x04fe04bd,
331 0xf0120017, 276 0x0017f100,
332 0x12d00227, 277 0x0227f012,
333 0x3e17f100, 278 0xf10012d0,
334 0x0010fe04, 279 0xfe047017,
335 0x040017f1, 280 0x17f10010,
336 0xf0c010d0, 281 0x10d00400,
337 0x12d00427, 282 0x0427f0c0,
338 0x1031f400, 283 0xf40012d0,
339 0x060817f1, 284 0x17f11031,
340 0xcf0614b6, 285 0x14b60608,
341 0x37f00012, 286 0x0012cf06,
342 0x1f24f001, 287 0xf00137f0,
343 0xb60432bb, 288 0x32bb1f24,
344 0x02800132, 289 0x0132b604,
345 0x04038003, 290 0x80050280,
346 0x040010b7, 291 0x10b70603,
347 0x800012cf, 292 0x12cf0400,
348 0x27f10002, 293 0x04028000,
349 0x24b60800, 294 0x0c30e7f1,
350 0x0022cf06, 295 0xbd50e3f0,
351/* 0x035f: init_find_chipset */ 296 0xbd34bd24,
352 0xb65817f0, 297/* 0x0371: init_unk_loop */
353 0x13980c10, 298 0x6821f444,
354 0x0432b800, 299 0xf400f6b0,
355 0xb00b0bf4, 300 0xf7f00f0b,
356 0x1bf40034, 301 0x04f2bb01,
357/* 0x0373: init_context */ 302 0xb6054ffd,
358 0xf100f8f1, 303/* 0x0386: init_unk_next */
359 0xb6080027, 304 0x20b60130,
360 0x22cf0624, 305 0x04e0b601,
361 0xf134bd40, 306 0xf40126b0,
362 0xb6070047, 307/* 0x0392: init_unk_done */
363 0x25950644, 308 0x0380e21b,
364 0x0045d008, 309 0x08048007,
365 0xbd4045d0, 310 0x010027f1,
366 0x58f4bde4, 311 0xcf0223f0,
367 0x1f58021e, 312 0x34bd0022,
368 0x020e4003, 313 0x070047f1,
369 0xf5040f40, 314 0x950644b6,
370 0xbb013d21, 315 0x45d00825,
371 0x3fbb002f, 316 0x4045d000,
372 0x041e5800, 317 0x98000e98,
373 0x40051f58, 318 0x21f5010f,
374 0x0f400a0e, 319 0x2fbb0147,
375 0x3d21f50c, 320 0x003fbb00,
376 0x030e9801, 321 0x98010e98,
377 0xbb00effd, 322 0x21f5020f,
378 0x3ebb002e, 323 0x0e980147,
379 0x0040b700, 324 0x00effd05,
380 0x0235b613, 325 0xbb002ebb,
381 0xb60043d0, 326 0x0e98003e,
382 0x35b60825, 327 0x030f9802,
383 0x0120b606, 328 0x014721f5,
384 0xb60130b6, 329 0xfd070e98,
385 0x34b60824, 330 0x2ebb00ef,
386 0x022fb908, 331 0x003ebb00,
387 0x026321f5, 332 0x130040b7,
388 0xf1003fbb, 333 0xd00235b6,
389 0xb6080017, 334 0x25b60043,
390 0x13d00614, 335 0x0635b608,
391 0x0010b740, 336 0xb60120b6,
392 0xf024bd08, 337 0x24b60130,
393 0x12d01f29, 338 0x0834b608,
394/* 0x0401: main */ 339 0xf5022fb9,
395 0x0031f400, 340 0xbb027121,
396 0xf00028f4, 341 0x07f1003f,
397 0x21f41cd7, 342 0x03f00100,
398 0xf401f439, 343 0x0003d002,
399 0xf404e4b0, 344 0x24bd04bd,
400 0x81fe1e18, 345 0xf11f29f0,
401 0x0627f001, 346 0xf0080007,
402 0x12fd20bd, 347 0x02d00203,
403 0x01e4b604, 348/* 0x0433: main */
404 0xfe051efd, 349 0xf404bd00,
405 0x21f50018, 350 0x28f40031,
406 0x0ef404c3, 351 0x24d7f000,
407/* 0x0431: main_not_ctx_xfer */ 352 0xf43921f4,
408 0x10ef94d3, 353 0xe4b0f401,
409 0xf501f5f0, 354 0x1e18f404,
410 0xf402ec21, 355 0xf00181fe,
411/* 0x043e: ih */ 356 0x20bd0627,
412 0x80f9c60e, 357 0xb60412fd,
413 0xf90188fe, 358 0x1efd01e4,
414 0xf990f980, 359 0x0018fe05,
415 0xf9b0f9a0, 360 0x04f721f5,
416 0xf9e0f9d0, 361/* 0x0463: main_not_ctx_xfer */
417 0x800acff0, 362 0x94d30ef4,
363 0xf5f010ef,
364 0xfe21f501,
365 0xc60ef402,
366/* 0x0470: ih */
367 0x88fe80f9,
368 0xf980f901,
369 0xf9a0f990,
370 0xf9d0f9b0,
371 0xbdf0f9e0,
372 0x800acf04,
418 0xf404abc4, 373 0xf404abc4,
419 0xb7f11d0b, 374 0xb7f11d0b,
420 0xd7f01900, 375 0xd7f01900,
421 0x40becf1c, 376 0x40becf24,
422 0xf400bfcf, 377 0xf400bfcf,
423 0xb0b70421, 378 0xb0b70421,
424 0xe7f00400, 379 0xe7f00400,
425 0x00bed001, 380 0x00bed001,
426/* 0x0474: ih_no_fifo */ 381/* 0x04a8: ih_no_fifo */
427 0xfc400ad0, 382 0xfc400ad0,
428 0xfce0fcf0, 383 0xfce0fcf0,
429 0xfcb0fcd0, 384 0xfcb0fcd0,
430 0xfc90fca0, 385 0xfc90fca0,
431 0x0088fe80, 386 0x0088fe80,
432 0x32f480fc, 387 0x32f480fc,
433/* 0x048f: hub_barrier_done */ 388/* 0x04c3: hub_barrier_done */
434 0xf001f800, 389 0xf001f800,
435 0x0e9801f7, 390 0x0e9801f7,
436 0x04febb00, 391 0x04febb04,
437 0x9418e7f1, 392 0x9418e7f1,
438 0xf440e3f0, 393 0xf440e3f0,
439 0x00f88d21, 394 0x00f88d21,
440/* 0x04a4: ctx_redswitch */ 395/* 0x04d8: ctx_redswitch */
441 0x0614e7f1, 396 0x0614e7f1,
442 0xf006e4b6, 397 0xf006e4b6,
443 0xefd020f7, 398 0xefd020f7,
444 0x08f7f000, 399 0x08f7f000,
445/* 0x04b4: ctx_redswitch_delay */ 400/* 0x04e8: ctx_redswitch_delay */
446 0xf401f2b6, 401 0xf401f2b6,
447 0xf7f1fd1b, 402 0xf7f1fd1b,
448 0xefd00a20, 403 0xefd00a20,
449/* 0x04c3: ctx_xfer */ 404/* 0x04f7: ctx_xfer */
450 0xf100f800, 405 0xf100f800,
451 0xb60a0417, 406 0xb60a0417,
452 0x1fd00614, 407 0x1fd00614,
453 0x0711f400, 408 0x0711f400,
454 0x04a421f5, 409 0x04d821f5,
455/* 0x04d4: ctx_xfer_not_load */ 410/* 0x0508: ctx_xfer_not_load */
456 0x4afc17f1, 411 0x4afc17f1,
457 0xf00213f0, 412 0xf00213f0,
458 0x12d00c27, 413 0x12d00c27,
459 0x0721f500, 414 0x1521f500,
460 0xfc27f102, 415 0xfc27f102,
461 0x0223f047, 416 0x0223f047,
462 0xf00020d0, 417 0xf00020d0,
@@ -465,31 +420,40 @@ uint32_t nve0_grgpc_code[] = {
465 0xf001acf0, 420 0xf001acf0,
466 0xb7f002a5, 421 0xb7f002a5,
467 0x50b3f000, 422 0x50b3f000,
468 0xb6000c98, 423 0xb6040c98,
469 0xbcbb0fc4, 424 0xbcbb0fc4,
470 0x010c9800, 425 0x000c9800,
471 0xf0020d98, 426 0xf0010d98,
472 0x21f500e7, 427 0x21f500e7,
473 0xacf0015c, 428 0xacf00166,
429 0x00b7f101,
430 0x50b3f040,
431 0xb6040c98,
432 0xbcbb0fc4,
433 0x010c9800,
434 0x98020d98,
435 0xe7f1060f,
436 0x21f50800,
437 0xacf00166,
474 0x04a5f001, 438 0x04a5f001,
475 0x4000b7f1, 439 0x3000b7f1,
476 0x9850b3f0, 440 0x9850b3f0,
477 0xc4b6000c, 441 0xc4b6040c,
478 0x00bcbb0f, 442 0x00bcbb0f,
479 0x98050c98, 443 0x98020c98,
480 0x0f98060d, 444 0x0f98030d,
481 0x00e7f104, 445 0x00e7f108,
482 0x5c21f508, 446 0x6621f502,
483 0x0721f501, 447 0x1521f501,
484 0x0601f402, 448 0x0601f402,
485/* 0x054b: ctx_xfer_post */ 449/* 0x05a3: ctx_xfer_post */
486 0xf11412f4, 450 0xf11412f4,
487 0xf04afc17, 451 0xf04afc17,
488 0x27f00213, 452 0x27f00213,
489 0x0012d00d, 453 0x0012d00d,
490 0x020721f5, 454 0x021521f5,
491/* 0x055c: ctx_xfer_done */ 455/* 0x05b4: ctx_xfer_done */
492 0x048f21f5, 456 0x04c321f5,
493 0x000000f8, 457 0x000000f8,
494 0x00000000, 458 0x00000000,
495 0x00000000, 459 0x00000000,
@@ -508,26 +472,4 @@ uint32_t nve0_grgpc_code[] = {
508 0x00000000, 472 0x00000000,
509 0x00000000, 473 0x00000000,
510 0x00000000, 474 0x00000000,
511 0x00000000,
512 0x00000000,
513 0x00000000,
514 0x00000000,
515 0x00000000,
516 0x00000000,
517 0x00000000,
518 0x00000000,
519 0x00000000,
520 0x00000000,
521 0x00000000,
522 0x00000000,
523 0x00000000,
524 0x00000000,
525 0x00000000,
526 0x00000000,
527 0x00000000,
528 0x00000000,
529 0x00000000,
530 0x00000000,
531 0x00000000,
532 0x00000000,
533}; 475};
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvf0.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvf0.fuc
new file mode 100644
index 000000000000..90bbe525b626
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvf0.fuc
@@ -0,0 +1,42 @@
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 <bskeggs@redhat.com>
23 */
24
25#define NV_PGRAPH_GPCX_UNK__SIZE 0x00000002
26
27#define CHIPSET GK110
28#include "macros.fuc"
29
30.section #nvf0_grgpc_data
31#define INCLUDE_DATA
32#include "com.fuc"
33#include "gpc.fuc"
34#undef INCLUDE_DATA
35
36.section #nvf0_grgpc_code
37#define INCLUDE_CODE
38bra #init
39#include "com.fuc"
40#include "gpc.fuc"
41.align 256
42#undef INCLUDE_CODE
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvf0.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvf0.fuc.h
new file mode 100644
index 000000000000..f870507be880
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvf0.fuc.h
@@ -0,0 +1,475 @@
1uint32_t nvf0_grgpc_data[] = {
2/* 0x0000: gpc_mmio_list_head */
3 0x0000006c,
4/* 0x0004: gpc_mmio_list_tail */
5/* 0x0004: tpc_mmio_list_head */
6 0x0000006c,
7/* 0x0008: tpc_mmio_list_tail */
8/* 0x0008: unk_mmio_list_head */
9 0x0000006c,
10/* 0x000c: unk_mmio_list_tail */
11 0x0000006c,
12/* 0x0010: gpc_id */
13 0x00000000,
14/* 0x0014: tpc_count */
15 0x00000000,
16/* 0x0018: tpc_mask */
17 0x00000000,
18/* 0x001c: unk_count */
19 0x00000000,
20/* 0x0020: unk_mask */
21 0x00000000,
22/* 0x0024: cmd_queue */
23 0x00000000,
24 0x00000000,
25 0x00000000,
26 0x00000000,
27 0x00000000,
28 0x00000000,
29 0x00000000,
30 0x00000000,
31 0x00000000,
32 0x00000000,
33 0x00000000,
34 0x00000000,
35 0x00000000,
36 0x00000000,
37 0x00000000,
38 0x00000000,
39 0x00000000,
40 0x00000000,
41};
42
43uint32_t nvf0_grgpc_code[] = {
44 0x03180ef5,
45/* 0x0004: queue_put */
46 0x9800d898,
47 0x86f001d9,
48 0x0489b808,
49 0xf00c1bf4,
50 0x21f502f7,
51 0x00f802fe,
52/* 0x001c: queue_put_next */
53 0xb60798c4,
54 0x8dbb0384,
55 0x0880b600,
56 0x80008e80,
57 0x90b6018f,
58 0x0f94f001,
59 0xf801d980,
60/* 0x0039: queue_get */
61 0x0131f400,
62 0x9800d898,
63 0x89b801d9,
64 0x210bf404,
65 0xb60789c4,
66 0x9dbb0394,
67 0x0890b600,
68 0x98009e98,
69 0x80b6019f,
70 0x0f84f001,
71 0xf400d880,
72/* 0x0066: queue_get_done */
73 0x00f80132,
74/* 0x0068: nv_rd32 */
75 0x0728b7f1,
76 0xb906b4b6,
77 0xc9f002ec,
78 0x00bcd01f,
79/* 0x0078: nv_rd32_wait */
80 0xc800bccf,
81 0x1bf41fcc,
82 0x06a7f0fa,
83 0x010921f5,
84 0xf840bfcf,
85/* 0x008d: nv_wr32 */
86 0x28b7f100,
87 0x06b4b607,
88 0xb980bfd0,
89 0xc9f002ec,
90 0x1ec9f01f,
91/* 0x00a3: nv_wr32_wait */
92 0xcf00bcd0,
93 0xccc800bc,
94 0xfa1bf41f,
95/* 0x00ae: watchdog_reset */
96 0x87f100f8,
97 0x84b60430,
98 0x1ff9f006,
99 0xf8008fd0,
100/* 0x00bd: watchdog_clear */
101 0x3087f100,
102 0x0684b604,
103 0xf80080d0,
104/* 0x00c9: wait_donez */
105 0xf094bd00,
106 0x07f10099,
107 0x03f03700,
108 0x0009d002,
109 0x07f104bd,
110 0x03f00600,
111 0x000ad002,
112/* 0x00e6: wait_donez_ne */
113 0x87f104bd,
114 0x83f00000,
115 0x0088cf01,
116 0xf4888aff,
117 0x94bdf31b,
118 0xf10099f0,
119 0xf0170007,
120 0x09d00203,
121 0xf804bd00,
122/* 0x0109: wait_doneo */
123 0xf094bd00,
124 0x07f10099,
125 0x03f03700,
126 0x0009d002,
127 0x87f104bd,
128 0x84b60818,
129 0x008ad006,
130/* 0x0124: wait_doneo_e */
131 0x040087f1,
132 0xcf0684b6,
133 0x8aff0088,
134 0xf30bf488,
135 0x99f094bd,
136 0x0007f100,
137 0x0203f017,
138 0xbd0009d0,
139/* 0x0147: mmctx_size */
140 0xbd00f804,
141/* 0x0149: nv_mmctx_size_loop */
142 0x00e89894,
143 0xb61a85b6,
144 0x84b60180,
145 0x0098bb02,
146 0xb804e0b6,
147 0x1bf404ef,
148 0x029fb9eb,
149/* 0x0166: mmctx_xfer */
150 0x94bd00f8,
151 0xf10199f0,
152 0xf0370007,
153 0x09d00203,
154 0xf104bd00,
155 0xb6071087,
156 0x94bd0684,
157 0xf405bbfd,
158 0x8bd0090b,
159 0x0099f000,
160/* 0x018c: mmctx_base_disabled */
161 0xf405eefd,
162 0x8ed00c0b,
163 0xc08fd080,
164/* 0x019b: mmctx_multi_disabled */
165 0xb70199f0,
166 0xc8010080,
167 0xb4b600ab,
168 0x0cb9f010,
169 0xb601aec8,
170 0xbefd11e4,
171 0x008bd005,
172/* 0x01b4: mmctx_exec_loop */
173/* 0x01b4: mmctx_wait_free */
174 0xf0008ecf,
175 0x0bf41fe4,
176 0x00ce98fa,
177 0xd005e9fd,
178 0xc0b6c08e,
179 0x04cdb804,
180 0xc8e81bf4,
181 0x1bf402ab,
182/* 0x01d5: mmctx_fini_wait */
183 0x008bcf18,
184 0xb01fb4f0,
185 0x1bf410b4,
186 0x02a7f0f7,
187 0xf4c921f4,
188/* 0x01ea: mmctx_stop */
189 0xabc81b0e,
190 0x10b4b600,
191 0xf00cb9f0,
192 0x8bd012b9,
193/* 0x01f9: mmctx_stop_wait */
194 0x008bcf00,
195 0xf412bbc8,
196/* 0x0202: mmctx_done */
197 0x94bdfa1b,
198 0xf10199f0,
199 0xf0170007,
200 0x09d00203,
201 0xf804bd00,
202/* 0x0215: strand_wait */
203 0xf0a0f900,
204 0x21f402a7,
205 0xf8a0fcc9,
206/* 0x0221: strand_pre */
207 0xfc87f100,
208 0x0283f04a,
209 0xd00c97f0,
210 0x21f50089,
211 0x00f80215,
212/* 0x0234: strand_post */
213 0x4afc87f1,
214 0xf00283f0,
215 0x89d00d97,
216 0x1521f500,
217/* 0x0247: strand_set */
218 0xf100f802,
219 0xf04ffca7,
220 0xaba202a3,
221 0xc7f00500,
222 0x00acd00f,
223 0xd00bc7f0,
224 0x21f500bc,
225 0xaed00215,
226 0x0ac7f000,
227 0xf500bcd0,
228 0xf8021521,
229/* 0x0271: strand_ctx_init */
230 0xf094bd00,
231 0x07f10399,
232 0x03f03700,
233 0x0009d002,
234 0x21f504bd,
235 0xe7f00221,
236 0x4721f503,
237 0xfca7f102,
238 0x02a3f046,
239 0x0400aba0,
240 0xf040a0d0,
241 0xbcd001c7,
242 0x1521f500,
243 0x010c9202,
244 0xf000acd0,
245 0xbcd002c7,
246 0x1521f500,
247 0x3421f502,
248 0x8087f102,
249 0x0684b608,
250 0xb70089cf,
251 0x95220080,
252/* 0x02ca: ctx_init_strand_loop */
253 0x8ed008fe,
254 0x408ed000,
255 0xb6808acf,
256 0xa0b606a5,
257 0x00eabb01,
258 0xb60480b6,
259 0x1bf40192,
260 0x08e4b6e8,
261 0xbdf2efbc,
262 0x0399f094,
263 0x170007f1,
264 0xd00203f0,
265 0x04bd0009,
266/* 0x02fe: error */
267 0xe0f900f8,
268 0x9814e7f1,
269 0xf440e3f0,
270 0xe0b78d21,
271 0xf7f0041c,
272 0x8d21f401,
273 0x00f8e0fc,
274/* 0x0318: init */
275 0x04fe04bd,
276 0x0017f100,
277 0x0227f012,
278 0xf10012d0,
279 0xfe047017,
280 0x17f10010,
281 0x10d00400,
282 0x0427f0c0,
283 0xf40012d0,
284 0x17f11031,
285 0x14b60608,
286 0x0012cf06,
287 0xf00137f0,
288 0x32bb1f24,
289 0x0132b604,
290 0x80050280,
291 0x10b70603,
292 0x12cf0400,
293 0x04028000,
294 0x0c30e7f1,
295 0xbd50e3f0,
296 0xbd34bd24,
297/* 0x0371: init_unk_loop */
298 0x6821f444,
299 0xf400f6b0,
300 0xf7f00f0b,
301 0x04f2bb01,
302 0xb6054ffd,
303/* 0x0386: init_unk_next */
304 0x20b60130,
305 0x04e0b601,
306 0xf40226b0,
307/* 0x0392: init_unk_done */
308 0x0380e21b,
309 0x08048007,
310 0x010027f1,
311 0xcf0223f0,
312 0x34bd0022,
313 0x070047f1,
314 0x950644b6,
315 0x45d00825,
316 0x4045d000,
317 0x98000e98,
318 0x21f5010f,
319 0x2fbb0147,
320 0x003fbb00,
321 0x98010e98,
322 0x21f5020f,
323 0x0e980147,
324 0x00effd05,
325 0xbb002ebb,
326 0x0e98003e,
327 0x030f9802,
328 0x014721f5,
329 0xfd070e98,
330 0x2ebb00ef,
331 0x003ebb00,
332 0x130040b7,
333 0xd00235b6,
334 0x25b60043,
335 0x0635b608,
336 0xb60120b6,
337 0x24b60130,
338 0x0834b608,
339 0xf5022fb9,
340 0xbb027121,
341 0x07f1003f,
342 0x03f00100,
343 0x0003d002,
344 0x24bd04bd,
345 0xf11f29f0,
346 0xf0300007,
347 0x02d00203,
348/* 0x0433: main */
349 0xf404bd00,
350 0x28f40031,
351 0x24d7f000,
352 0xf43921f4,
353 0xe4b0f401,
354 0x1e18f404,
355 0xf00181fe,
356 0x20bd0627,
357 0xb60412fd,
358 0x1efd01e4,
359 0x0018fe05,
360 0x04f721f5,
361/* 0x0463: main_not_ctx_xfer */
362 0x94d30ef4,
363 0xf5f010ef,
364 0xfe21f501,
365 0xc60ef402,
366/* 0x0470: ih */
367 0x88fe80f9,
368 0xf980f901,
369 0xf9a0f990,
370 0xf9d0f9b0,
371 0xbdf0f9e0,
372 0x800acf04,
373 0xf404abc4,
374 0xb7f11d0b,
375 0xd7f01900,
376 0x40becf24,
377 0xf400bfcf,
378 0xb0b70421,
379 0xe7f00400,
380 0x00bed001,
381/* 0x04a8: ih_no_fifo */
382 0xfc400ad0,
383 0xfce0fcf0,
384 0xfcb0fcd0,
385 0xfc90fca0,
386 0x0088fe80,
387 0x32f480fc,
388/* 0x04c3: hub_barrier_done */
389 0xf001f800,
390 0x0e9801f7,
391 0x04febb04,
392 0x9418e7f1,
393 0xf440e3f0,
394 0x00f88d21,
395/* 0x04d8: ctx_redswitch */
396 0x0614e7f1,
397 0xf006e4b6,
398 0xefd020f7,
399 0x08f7f000,
400/* 0x04e8: ctx_redswitch_delay */
401 0xf401f2b6,
402 0xf7f1fd1b,
403 0xefd00a20,
404/* 0x04f7: ctx_xfer */
405 0xf100f800,
406 0xb60a0417,
407 0x1fd00614,
408 0x0711f400,
409 0x04d821f5,
410/* 0x0508: ctx_xfer_not_load */
411 0x4afc17f1,
412 0xf00213f0,
413 0x12d00c27,
414 0x1521f500,
415 0xfc27f102,
416 0x0223f047,
417 0xf00020d0,
418 0x20b6012c,
419 0x0012d003,
420 0xf001acf0,
421 0xb7f002a5,
422 0x50b3f000,
423 0xb6040c98,
424 0xbcbb0fc4,
425 0x000c9800,
426 0xf0010d98,
427 0x21f500e7,
428 0xacf00166,
429 0x00b7f101,
430 0x50b3f040,
431 0xb6040c98,
432 0xbcbb0fc4,
433 0x010c9800,
434 0x98020d98,
435 0xe7f1060f,
436 0x21f50800,
437 0xacf00166,
438 0x04a5f001,
439 0x3000b7f1,
440 0x9850b3f0,
441 0xc4b6040c,
442 0x00bcbb0f,
443 0x98020c98,
444 0x0f98030d,
445 0x00e7f108,
446 0x6621f502,
447 0x1521f501,
448 0x0601f402,
449/* 0x05a3: ctx_xfer_post */
450 0xf11412f4,
451 0xf04afc17,
452 0x27f00213,
453 0x0012d00d,
454 0x021521f5,
455/* 0x05b4: ctx_xfer_done */
456 0x04c321f5,
457 0x000000f8,
458 0x00000000,
459 0x00000000,
460 0x00000000,
461 0x00000000,
462 0x00000000,
463 0x00000000,
464 0x00000000,
465 0x00000000,
466 0x00000000,
467 0x00000000,
468 0x00000000,
469 0x00000000,
470 0x00000000,
471 0x00000000,
472 0x00000000,
473 0x00000000,
474 0x00000000,
475};
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hub.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hub.fuc
new file mode 100644
index 000000000000..b82d2ae89917
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hub.fuc
@@ -0,0 +1,724 @@
1/* fuc microcode for nvc0 PGRAPH/HUB
2 *
3 * Copyright 2011 Red Hat Inc.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 * OTHER DEALINGS IN THE SOFTWARE.
22 *
23 * Authors: Ben Skeggs
24 */
25
26#ifdef INCLUDE_DATA
27hub_mmio_list_head: .b32 #hub_mmio_list_base
28hub_mmio_list_tail: .b32 #hub_mmio_list_next
29
30gpc_count: .b32 0
31rop_count: .b32 0
32cmd_queue: queue_init
33
34ctx_current: .b32 0
35
36.align 256
37chan_data:
38chan_mmio_count: .b32 0
39chan_mmio_address: .b32 0
40
41.align 256
42xfer_data: .skip 256
43
44hub_mmio_list_base:
45.b32 0x0417e91c // 0x17e91c, 2
46hub_mmio_list_next:
47#endif
48
49#ifdef INCLUDE_CODE
50// reports an exception to the host
51//
52// In: $r15 error code (see nvc0.fuc)
53//
54error:
55 nv_iowr(NV_PGRAPH_FECS_CC_SCRATCH_VAL(5), 0, $r15)
56 mov $r15 1
57 nv_iowr(NV_PGRAPH_FECS_INTR_UP_SET, 0, $r15)
58 ret
59
60// HUB fuc initialisation, executed by triggering ucode start, will
61// fall through to main loop after completion.
62//
63// Output:
64// CC_SCRATCH[0]:
65// 31:31: set to signal completion
66// CC_SCRATCH[1]:
67// 31:0: total PGRAPH context size
68//
69init:
70 clear b32 $r0
71 mov $sp $r0
72 mov $xdbase $r0
73
74 // enable fifo access
75 mov $r1 0x1200
76 mov $r2 2
77 iowr I[$r1 + 0x000] $r2 // FIFO_ENABLE
78
79 // setup i0 handler, and route all interrupts to it
80 mov $r1 #ih
81 mov $iv0 $r1
82 mov $r1 0x400
83 iowr I[$r1 + 0x300] $r0 // INTR_DISPATCH
84
85 // route HUB_CHANNEL_SWITCH to fuc interrupt 8
86 mov $r3 0x404
87 shl b32 $r3 6
88 mov $r2 0x2003 // { HUB_CHANNEL_SWITCH, ZERO } -> intr 8
89 iowr I[$r3 + 0x000] $r2
90
91 // not sure what these are, route them because NVIDIA does, and
92 // the IRQ handler will signal the host if we ever get one.. we
93 // may find out if/why we need to handle these if so..
94 //
95 mov $r2 0x2004
96 iowr I[$r3 + 0x004] $r2 // { 0x04, ZERO } -> intr 9
97 mov $r2 0x200b
98 iowr I[$r3 + 0x008] $r2 // { 0x0b, ZERO } -> intr 10
99 mov $r2 0x200c
100 iowr I[$r3 + 0x01c] $r2 // { 0x0c, ZERO } -> intr 15
101
102 // enable all INTR_UP interrupts
103 mov $r2 0xc24
104 shl b32 $r2 6
105 not b32 $r3 $r0
106 iowr I[$r2] $r3
107
108 // enable fifo, ctxsw, 9, 10, 15 interrupts
109 mov $r2 -0x78fc // 0x8704
110 sethi $r2 0
111 iowr I[$r1 + 0x000] $r2 // INTR_EN_SET
112
113 // fifo level triggered, rest edge
114 sub b32 $r1 0x100
115 mov $r2 4
116 iowr I[$r1] $r2
117
118 // enable interrupts
119 bset $flags ie0
120
121 // fetch enabled GPC/ROP counts
122 mov $r14 -0x69fc // 0x409604
123 sethi $r14 0x400000
124 call #nv_rd32
125 extr $r1 $r15 16:20
126 st b32 D[$r0 + #rop_count] $r1
127 and $r15 0x1f
128 st b32 D[$r0 + #gpc_count] $r15
129
130 // set BAR_REQMASK to GPC mask
131 mov $r1 1
132 shl b32 $r1 $r15
133 sub b32 $r1 1
134 mov $r2 0x40c
135 shl b32 $r2 6
136 iowr I[$r2 + 0x000] $r1
137 iowr I[$r2 + 0x100] $r1
138
139 // context size calculation, reserve first 256 bytes for use by fuc
140 mov $r1 256
141
142 // calculate size of mmio context data
143 ld b32 $r14 D[$r0 + #hub_mmio_list_head]
144 ld b32 $r15 D[$r0 + #hub_mmio_list_tail]
145 call #mmctx_size
146
147 // set mmctx base addresses now so we don't have to do it later,
148 // they don't (currently) ever change
149 mov $r3 0x700
150 shl b32 $r3 6
151 shr b32 $r4 $r1 8
152 iowr I[$r3 + 0x000] $r4 // MMCTX_SAVE_SWBASE
153 iowr I[$r3 + 0x100] $r4 // MMCTX_LOAD_SWBASE
154 add b32 $r3 0x1300
155 add b32 $r1 $r15
156 shr b32 $r15 2
157 iowr I[$r3 + 0x000] $r15 // MMCTX_LOAD_COUNT, wtf for?!?
158
159 // strands, base offset needs to be aligned to 256 bytes
160 shr b32 $r1 8
161 add b32 $r1 1
162 shl b32 $r1 8
163 mov b32 $r15 $r1
164 call #strand_ctx_init
165 add b32 $r1 $r15
166
167 // initialise each GPC in sequence by passing in the offset of its
168 // context data in GPCn_CC_SCRATCH[1], and starting its FUC (which
169 // has previously been uploaded by the host) running.
170 //
171 // the GPC fuc init sequence will set GPCn_CC_SCRATCH[0] bit 31
172 // when it has completed, and return the size of its context data
173 // in GPCn_CC_SCRATCH[1]
174 //
175 ld b32 $r3 D[$r0 + #gpc_count]
176 mov $r4 0x2000
177 sethi $r4 0x500000
178 init_gpc:
179 // setup, and start GPC ucode running
180 add b32 $r14 $r4 0x804
181 mov b32 $r15 $r1
182 call #nv_wr32 // CC_SCRATCH[1] = ctx offset
183 add b32 $r14 $r4 0x10c
184 clear b32 $r15
185 call #nv_wr32
186 add b32 $r14 $r4 0x104
187 call #nv_wr32 // ENTRY
188 add b32 $r14 $r4 0x100
189 mov $r15 2 // CTRL_START_TRIGGER
190 call #nv_wr32 // CTRL
191
192 // wait for it to complete, and adjust context size
193 add b32 $r14 $r4 0x800
194 init_gpc_wait:
195 call #nv_rd32
196 xbit $r15 $r15 31
197 bra e #init_gpc_wait
198 add b32 $r14 $r4 0x804
199 call #nv_rd32
200 add b32 $r1 $r15
201
202 // next!
203 add b32 $r4 0x8000
204 sub b32 $r3 1
205 bra ne #init_gpc
206
207 // save context size, and tell host we're ready
208 nv_iowr(NV_PGRAPH_FECS_CC_SCRATCH_VAL(1), 0, $r1)
209 clear b32 $r1
210 bset $r1 31
211 nv_iowr(NV_PGRAPH_FECS_CC_SCRATCH_SET(0), 0, $r1)
212
213// Main program loop, very simple, sleeps until woken up by the interrupt
214// handler, pulls a command from the queue and executes its handler
215//
216main:
217 // sleep until we have something to do
218 bset $flags $p0
219 sleep $p0
220 mov $r13 #cmd_queue
221 call #queue_get
222 bra $p1 #main
223
224 // context switch, requested by GPU?
225 cmpu b32 $r14 0x4001
226 bra ne #main_not_ctx_switch
227 trace_set(T_AUTO)
228 mov $r1 0xb00
229 shl b32 $r1 6
230 iord $r2 I[$r1 + 0x100] // CHAN_NEXT
231 iord $r1 I[$r1 + 0x000] // CHAN_CUR
232
233 xbit $r3 $r1 31
234 bra e #chsw_no_prev
235 xbit $r3 $r2 31
236 bra e #chsw_prev_no_next
237 push $r2
238 mov b32 $r2 $r1
239 trace_set(T_SAVE)
240 bclr $flags $p1
241 bset $flags $p2
242 call #ctx_xfer
243 trace_clr(T_SAVE);
244 pop $r2
245 trace_set(T_LOAD);
246 bset $flags $p1
247 call #ctx_xfer
248 trace_clr(T_LOAD);
249 bra #chsw_done
250 chsw_prev_no_next:
251 push $r2
252 mov b32 $r2 $r1
253 bclr $flags $p1
254 bclr $flags $p2
255 call #ctx_xfer
256 pop $r2
257 mov $r1 0xb00
258 shl b32 $r1 6
259 iowr I[$r1] $r2
260 bra #chsw_done
261 chsw_no_prev:
262 xbit $r3 $r2 31
263 bra e #chsw_done
264 bset $flags $p1
265 bclr $flags $p2
266 call #ctx_xfer
267
268 // ack the context switch request
269 chsw_done:
270 mov $r1 0xb0c
271 shl b32 $r1 6
272 mov $r2 1
273 iowr I[$r1 + 0x000] $r2 // 0x409b0c
274 trace_clr(T_AUTO)
275 bra #main
276
277 // request to set current channel? (*not* a context switch)
278 main_not_ctx_switch:
279 cmpu b32 $r14 0x0001
280 bra ne #main_not_ctx_chan
281 mov b32 $r2 $r15
282 call #ctx_chan
283 bra #main_done
284
285 // request to store current channel context?
286 main_not_ctx_chan:
287 cmpu b32 $r14 0x0002
288 bra ne #main_not_ctx_save
289 trace_set(T_SAVE)
290 bclr $flags $p1
291 bclr $flags $p2
292 call #ctx_xfer
293 trace_clr(T_SAVE)
294 bra #main_done
295
296 main_not_ctx_save:
297 shl b32 $r15 $r14 16
298 or $r15 E_BAD_COMMAND
299 call #error
300 bra #main
301
302 main_done:
303 clear b32 $r2
304 bset $r2 31
305 nv_iowr(NV_PGRAPH_FECS_CC_SCRATCH_SET(0), 0, $r2)
306 bra #main
307
308// interrupt handler
309ih:
310 push $r8
311 mov $r8 $flags
312 push $r8
313 push $r9
314 push $r10
315 push $r11
316 push $r13
317 push $r14
318 push $r15
319 clear b32 $r0
320
321 // incoming fifo command?
322 iord $r10 I[$r0 + 0x200] // INTR
323 and $r11 $r10 0x00000004
324 bra e #ih_no_fifo
325 // queue incoming fifo command for later processing
326 mov $r11 0x1900
327 mov $r13 #cmd_queue
328 iord $r14 I[$r11 + 0x100] // FIFO_CMD
329 iord $r15 I[$r11 + 0x000] // FIFO_DATA
330 call #queue_put
331 add b32 $r11 0x400
332 mov $r14 1
333 iowr I[$r11 + 0x000] $r14 // FIFO_ACK
334
335 // context switch request?
336 ih_no_fifo:
337 and $r11 $r10 0x00000100
338 bra e #ih_no_ctxsw
339 // enqueue a context switch for later processing
340 mov $r13 #cmd_queue
341 mov $r14 0x4001
342 call #queue_put
343
344 // anything we didn't handle, bring it to the host's attention
345 ih_no_ctxsw:
346 mov $r11 0x104
347 not b32 $r11
348 and $r11 $r10 $r11
349 bra e #ih_no_other
350 mov $r10 0xc1c
351 shl b32 $r10 6
352 iowr I[$r10] $r11 // INTR_UP_SET
353
354 // ack, and wake up main()
355 ih_no_other:
356 iowr I[$r0 + 0x100] $r10 // INTR_ACK
357
358 pop $r15
359 pop $r14
360 pop $r13
361 pop $r11
362 pop $r10
363 pop $r9
364 pop $r8
365 mov $flags $r8
366 pop $r8
367 bclr $flags $p0
368 iret
369
370#if CHIPSET < GK100
371// Not real sure, but, MEM_CMD 7 will hang forever if this isn't done
372ctx_4160s:
373 mov $r14 0x4160
374 sethi $r14 0x400000
375 mov $r15 1
376 call #nv_wr32
377 ctx_4160s_wait:
378 call #nv_rd32
379 xbit $r15 $r15 4
380 bra e #ctx_4160s_wait
381 ret
382
383// Without clearing again at end of xfer, some things cause PGRAPH
384// to hang with STATUS=0x00000007 until it's cleared.. fbcon can
385// still function with it set however...
386ctx_4160c:
387 mov $r14 0x4160
388 sethi $r14 0x400000
389 clear b32 $r15
390 call #nv_wr32
391 ret
392#endif
393
394// Again, not real sure
395//
396// In: $r15 value to set 0x404170 to
397//
398ctx_4170s:
399 mov $r14 0x4170
400 sethi $r14 0x400000
401 or $r15 0x10
402 call #nv_wr32
403 ret
404
405// Waits for a ctx_4170s() call to complete
406//
407ctx_4170w:
408 mov $r14 0x4170
409 sethi $r14 0x400000
410 call #nv_rd32
411 and $r15 0x10
412 bra ne #ctx_4170w
413 ret
414
415// Disables various things, waits a bit, and re-enables them..
416//
417// Not sure how exactly this helps, perhaps "ENABLE" is not such a
418// good description for the bits we turn off? Anyways, without this,
419// funny things happen.
420//
421ctx_redswitch:
422 mov $r14 0x614
423 shl b32 $r14 6
424 mov $r15 0x270
425 iowr I[$r14] $r15 // HUB_RED_SWITCH = ENABLE_GPC, POWER_ALL
426 mov $r15 8
427 ctx_redswitch_delay:
428 sub b32 $r15 1
429 bra ne #ctx_redswitch_delay
430 mov $r15 0x770
431 iowr I[$r14] $r15 // HUB_RED_SWITCH = ENABLE_ALL, POWER_ALL
432 ret
433
434// Not a clue what this is for, except that unless the value is 0x10, the
435// strand context is saved (and presumably restored) incorrectly..
436//
437// In: $r15 value to set to (0x00/0x10 are used)
438//
439ctx_86c:
440 mov $r14 0x86c
441 shl b32 $r14 6
442 iowr I[$r14] $r15 // HUB(0x86c) = val
443 mov $r14 -0x75ec
444 sethi $r14 0x400000
445 call #nv_wr32 // ROP(0xa14) = val
446 mov $r14 -0x5794
447 sethi $r14 0x410000
448 call #nv_wr32 // GPC(0x86c) = val
449 ret
450
451// ctx_load - load's a channel's ctxctl data, and selects its vm
452//
453// In: $r2 channel address
454//
455ctx_load:
456 trace_set(T_CHAN)
457
458 // switch to channel, somewhat magic in parts..
459 mov $r10 12 // DONE_UNK12
460 call #wait_donez
461 mov $r1 0xa24
462 shl b32 $r1 6
463 iowr I[$r1 + 0x000] $r0 // 0x409a24
464 mov $r3 0xb00
465 shl b32 $r3 6
466 iowr I[$r3 + 0x100] $r2 // CHAN_NEXT
467 mov $r1 0xa0c
468 shl b32 $r1 6
469 mov $r4 7
470 iowr I[$r1 + 0x000] $r2 // MEM_CHAN
471 iowr I[$r1 + 0x100] $r4 // MEM_CMD
472 ctx_chan_wait_0:
473 iord $r4 I[$r1 + 0x100]
474 and $r4 0x1f
475 bra ne #ctx_chan_wait_0
476 iowr I[$r3 + 0x000] $r2 // CHAN_CUR
477
478 // load channel header, fetch PGRAPH context pointer
479 mov $xtargets $r0
480 bclr $r2 31
481 shl b32 $r2 4
482 add b32 $r2 2
483
484 trace_set(T_LCHAN)
485 mov $r1 0xa04
486 shl b32 $r1 6
487 iowr I[$r1 + 0x000] $r2 // MEM_BASE
488 mov $r1 0xa20
489 shl b32 $r1 6
490 mov $r2 0x0002
491 sethi $r2 0x80000000
492 iowr I[$r1 + 0x000] $r2 // MEM_TARGET = vram
493 mov $r1 0x10 // chan + 0x0210
494 mov $r2 #xfer_data
495 sethi $r2 0x00020000 // 16 bytes
496 xdld $r1 $r2
497 xdwait
498 trace_clr(T_LCHAN)
499
500 // update current context
501 ld b32 $r1 D[$r0 + #xfer_data + 4]
502 shl b32 $r1 24
503 ld b32 $r2 D[$r0 + #xfer_data + 0]
504 shr b32 $r2 8
505 or $r1 $r2
506 st b32 D[$r0 + #ctx_current] $r1
507
508 // set transfer base to start of context, and fetch context header
509 trace_set(T_LCTXH)
510 mov $r2 0xa04
511 shl b32 $r2 6
512 iowr I[$r2 + 0x000] $r1 // MEM_BASE
513 mov $r2 1
514 mov $r1 0xa20
515 shl b32 $r1 6
516 iowr I[$r1 + 0x000] $r2 // MEM_TARGET = vm
517 mov $r1 #chan_data
518 sethi $r1 0x00060000 // 256 bytes
519 xdld $r0 $r1
520 xdwait
521 trace_clr(T_LCTXH)
522
523 trace_clr(T_CHAN)
524 ret
525
526// ctx_chan - handler for HUB_SET_CHAN command, will set a channel as
527// the active channel for ctxctl, but not actually transfer
528// any context data. intended for use only during initial
529// context construction.
530//
531// In: $r2 channel address
532//
533ctx_chan:
534#if CHIPSET < GK100
535 call #ctx_4160s
536#endif
537 call #ctx_load
538 mov $r10 12 // DONE_UNK12
539 call #wait_donez
540 mov $r1 0xa10
541 shl b32 $r1 6
542 mov $r2 5
543 iowr I[$r1 + 0x000] $r2 // MEM_CMD = 5 (???)
544 ctx_chan_wait:
545 iord $r2 I[$r1 + 0x000]
546 or $r2 $r2
547 bra ne #ctx_chan_wait
548#if CHIPSET < GK100
549 call #ctx_4160c
550#endif
551 ret
552
553// Execute per-context state overrides list
554//
555// Only executed on the first load of a channel. Might want to look into
556// removing this and having the host directly modify the channel's context
557// to change this state... The nouveau DRM already builds this list as
558// it's definitely needed for NVIDIA's, so we may as well use it for now
559//
560// Input: $r1 mmio list length
561//
562ctx_mmio_exec:
563 // set transfer base to be the mmio list
564 ld b32 $r3 D[$r0 + #chan_mmio_address]
565 mov $r2 0xa04
566 shl b32 $r2 6
567 iowr I[$r2 + 0x000] $r3 // MEM_BASE
568
569 clear b32 $r3
570 ctx_mmio_loop:
571 // fetch next 256 bytes of mmio list if necessary
572 and $r4 $r3 0xff
573 bra ne #ctx_mmio_pull
574 mov $r5 #xfer_data
575 sethi $r5 0x00060000 // 256 bytes
576 xdld $r3 $r5
577 xdwait
578
579 // execute a single list entry
580 ctx_mmio_pull:
581 ld b32 $r14 D[$r4 + #xfer_data + 0x00]
582 ld b32 $r15 D[$r4 + #xfer_data + 0x04]
583 call #nv_wr32
584
585 // next!
586 add b32 $r3 8
587 sub b32 $r1 1
588 bra ne #ctx_mmio_loop
589
590 // set transfer base back to the current context
591 ctx_mmio_done:
592 ld b32 $r3 D[$r0 + #ctx_current]
593 iowr I[$r2 + 0x000] $r3 // MEM_BASE
594
595 // disable the mmio list now, we don't need/want to execute it again
596 st b32 D[$r0 + #chan_mmio_count] $r0
597 mov $r1 #chan_data
598 sethi $r1 0x00060000 // 256 bytes
599 xdst $r0 $r1
600 xdwait
601 ret
602
603// Transfer HUB context data between GPU and storage area
604//
605// In: $r2 channel address
606// $p1 clear on save, set on load
607// $p2 set if opposite direction done/will be done, so:
608// on save it means: "a load will follow this save"
609// on load it means: "a save preceeded this load"
610//
611ctx_xfer:
612 // according to mwk, some kind of wait for idle
613 mov $r15 0xc00
614 shl b32 $r15 6
615 mov $r14 4
616 iowr I[$r15 + 0x200] $r14
617 ctx_xfer_idle:
618 iord $r14 I[$r15 + 0x000]
619 and $r14 0x2000
620 bra ne #ctx_xfer_idle
621
622 bra not $p1 #ctx_xfer_pre
623 bra $p2 #ctx_xfer_pre_load
624 ctx_xfer_pre:
625 mov $r15 0x10
626 call #ctx_86c
627#if CHIPSET < GK100
628 call #ctx_4160s
629#endif
630 bra not $p1 #ctx_xfer_exec
631
632 ctx_xfer_pre_load:
633 mov $r15 2
634 call #ctx_4170s
635 call #ctx_4170w
636 call #ctx_redswitch
637 clear b32 $r15
638 call #ctx_4170s
639 call #ctx_load
640
641 // fetch context pointer, and initiate xfer on all GPCs
642 ctx_xfer_exec:
643 ld b32 $r1 D[$r0 + #ctx_current]
644 mov $r2 0x414
645 shl b32 $r2 6
646 iowr I[$r2 + 0x000] $r0 // BAR_STATUS = reset
647 mov $r14 -0x5b00
648 sethi $r14 0x410000
649 mov b32 $r15 $r1
650 call #nv_wr32 // GPC_BCAST_WRCMD_DATA = ctx pointer
651 add b32 $r14 4
652 xbit $r15 $flags $p1
653 xbit $r2 $flags $p2
654 shl b32 $r2 1
655 or $r15 $r2
656 call #nv_wr32 // GPC_BCAST_WRCMD_CMD = GPC_XFER(type)
657
658 // strands
659 mov $r1 0x4afc
660 sethi $r1 0x20000
661 mov $r2 0xc
662 iowr I[$r1] $r2 // STRAND_CMD(0x3f) = 0x0c
663 call #strand_wait
664 mov $r2 0x47fc
665 sethi $r2 0x20000
666 iowr I[$r2] $r0 // STRAND_FIRST_GENE(0x3f) = 0x00
667 xbit $r2 $flags $p1
668 add b32 $r2 3
669 iowr I[$r1] $r2 // STRAND_CMD(0x3f) = 0x03/0x04 (SAVE/LOAD)
670
671 // mmio context
672 xbit $r10 $flags $p1 // direction
673 or $r10 6 // first, last
674 mov $r11 0 // base = 0
675 ld b32 $r12 D[$r0 + #hub_mmio_list_head]
676 ld b32 $r13 D[$r0 + #hub_mmio_list_tail]
677 mov $r14 0 // not multi
678 call #mmctx_xfer
679
680 // wait for GPCs to all complete
681 mov $r10 8 // DONE_BAR
682 call #wait_doneo
683
684 // wait for strand xfer to complete
685 call #strand_wait
686
687 // post-op
688 bra $p1 #ctx_xfer_post
689 mov $r10 12 // DONE_UNK12
690 call #wait_donez
691 mov $r1 0xa10
692 shl b32 $r1 6
693 mov $r2 5
694 iowr I[$r1] $r2 // MEM_CMD
695 ctx_xfer_post_save_wait:
696 iord $r2 I[$r1]
697 or $r2 $r2
698 bra ne #ctx_xfer_post_save_wait
699
700 bra $p2 #ctx_xfer_done
701 ctx_xfer_post:
702 mov $r15 2
703 call #ctx_4170s
704 clear b32 $r15
705 call #ctx_86c
706 call #strand_post
707 call #ctx_4170w
708 clear b32 $r15
709 call #ctx_4170s
710
711 bra not $p1 #ctx_xfer_no_post_mmio
712 ld b32 $r1 D[$r0 + #chan_mmio_count]
713 or $r1 $r1
714 bra e #ctx_xfer_no_post_mmio
715 call #ctx_mmio_exec
716
717 ctx_xfer_no_post_mmio:
718#if CHIPSET < GK100
719 call #ctx_4160c
720#endif
721
722 ctx_xfer_done:
723 ret
724#endif
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc
index 7fbdebb2bafb..3ff52badf932 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc
@@ -1,6 +1,5 @@
1/* fuc microcode for nvc0 PGRAPH/HUB 1/*
2 * 2 * Copyright 2013 Red Hat Inc.
3 * Copyright 2011 Red Hat Inc.
4 * 3 *
5 * Permission is hereby granted, free of charge, to any person obtaining a 4 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"), 5 * copy of this software and associated documentation files (the "Software"),
@@ -20,850 +19,22 @@
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 * OTHER DEALINGS IN THE SOFTWARE. 20 * OTHER DEALINGS IN THE SOFTWARE.
22 * 21 *
23 * Authors: Ben Skeggs 22 * Authors: Ben Skeggs <bskeggs@redhat.com>
24 */ 23 */
25 24
26/* To build: 25#define CHIPSET GF100
27 * m4 hubnvc0.fuc | envyas -a -w -m fuc -V fuc3 -o hubnvc0.fuc.h 26#include "macros.fuc"
28 */
29 27
30.section #nvc0_grhub_data 28.section #nvc0_grhub_data
31include(`nvc0.fuc') 29#define INCLUDE_DATA
32gpc_count: .b32 0 30#include "com.fuc"
33rop_count: .b32 0 31#include "hub.fuc"
34cmd_queue: queue_init 32#undef INCLUDE_DATA
35hub_mmio_list_head: .b32 0
36hub_mmio_list_tail: .b32 0
37
38ctx_current: .b32 0
39
40chipsets:
41.b8 0xc0 0 0 0
42.b16 #nvc0_hub_mmio_head
43.b16 #nvc0_hub_mmio_tail
44.b8 0xc1 0 0 0
45.b16 #nvc0_hub_mmio_head
46.b16 #nvc1_hub_mmio_tail
47.b8 0xc3 0 0 0
48.b16 #nvc0_hub_mmio_head
49.b16 #nvc0_hub_mmio_tail
50.b8 0xc4 0 0 0
51.b16 #nvc0_hub_mmio_head
52.b16 #nvc0_hub_mmio_tail
53.b8 0xc8 0 0 0
54.b16 #nvc0_hub_mmio_head
55.b16 #nvc0_hub_mmio_tail
56.b8 0xce 0 0 0
57.b16 #nvc0_hub_mmio_head
58.b16 #nvc0_hub_mmio_tail
59.b8 0xcf 0 0 0
60.b16 #nvc0_hub_mmio_head
61.b16 #nvc0_hub_mmio_tail
62.b8 0xd9 0 0 0
63.b16 #nvd9_hub_mmio_head
64.b16 #nvd9_hub_mmio_tail
65.b8 0xd7 0 0 0
66.b16 #nvd9_hub_mmio_head
67.b16 #nvd9_hub_mmio_tail
68.b8 0 0 0 0
69
70nvc0_hub_mmio_head:
71mmctx_data(0x17e91c, 2)
72mmctx_data(0x400204, 2)
73mmctx_data(0x404004, 11)
74mmctx_data(0x404044, 1)
75mmctx_data(0x404094, 14)
76mmctx_data(0x4040d0, 7)
77mmctx_data(0x4040f8, 1)
78mmctx_data(0x404130, 3)
79mmctx_data(0x404150, 3)
80mmctx_data(0x404164, 2)
81mmctx_data(0x404174, 3)
82mmctx_data(0x404200, 8)
83mmctx_data(0x404404, 14)
84mmctx_data(0x404460, 4)
85mmctx_data(0x404480, 1)
86mmctx_data(0x404498, 1)
87mmctx_data(0x404604, 4)
88mmctx_data(0x404618, 32)
89mmctx_data(0x404698, 21)
90mmctx_data(0x4046f0, 2)
91mmctx_data(0x404700, 22)
92mmctx_data(0x405800, 1)
93mmctx_data(0x405830, 3)
94mmctx_data(0x405854, 1)
95mmctx_data(0x405870, 4)
96mmctx_data(0x405a00, 2)
97mmctx_data(0x405a18, 1)
98mmctx_data(0x406020, 1)
99mmctx_data(0x406028, 4)
100mmctx_data(0x4064a8, 2)
101mmctx_data(0x4064b4, 2)
102mmctx_data(0x407804, 1)
103mmctx_data(0x40780c, 6)
104mmctx_data(0x4078bc, 1)
105mmctx_data(0x408000, 7)
106mmctx_data(0x408064, 1)
107mmctx_data(0x408800, 3)
108mmctx_data(0x408900, 4)
109mmctx_data(0x408980, 1)
110nvc0_hub_mmio_tail:
111mmctx_data(0x4064c0, 2)
112nvc1_hub_mmio_tail:
113
114nvd9_hub_mmio_head:
115mmctx_data(0x17e91c, 2)
116mmctx_data(0x400204, 2)
117mmctx_data(0x404004, 10)
118mmctx_data(0x404044, 1)
119mmctx_data(0x404094, 14)
120mmctx_data(0x4040d0, 7)
121mmctx_data(0x4040f8, 1)
122mmctx_data(0x404130, 3)
123mmctx_data(0x404150, 3)
124mmctx_data(0x404164, 2)
125mmctx_data(0x404178, 2)
126mmctx_data(0x404200, 8)
127mmctx_data(0x404404, 14)
128mmctx_data(0x404460, 4)
129mmctx_data(0x404480, 1)
130mmctx_data(0x404498, 1)
131mmctx_data(0x404604, 4)
132mmctx_data(0x404618, 32)
133mmctx_data(0x404698, 21)
134mmctx_data(0x4046f0, 2)
135mmctx_data(0x404700, 22)
136mmctx_data(0x405800, 1)
137mmctx_data(0x405830, 3)
138mmctx_data(0x405854, 1)
139mmctx_data(0x405870, 4)
140mmctx_data(0x405a00, 2)
141mmctx_data(0x405a18, 1)
142mmctx_data(0x406020, 1)
143mmctx_data(0x406028, 4)
144mmctx_data(0x4064a8, 2)
145mmctx_data(0x4064b4, 5)
146mmctx_data(0x407804, 1)
147mmctx_data(0x40780c, 6)
148mmctx_data(0x4078bc, 1)
149mmctx_data(0x408000, 7)
150mmctx_data(0x408064, 1)
151mmctx_data(0x408800, 3)
152mmctx_data(0x408900, 4)
153mmctx_data(0x408980, 1)
154nvd9_hub_mmio_tail:
155
156.align 256
157chan_data:
158chan_mmio_count: .b32 0
159chan_mmio_address: .b32 0
160
161.align 256
162xfer_data: .b32 0
163 33
164.section #nvc0_grhub_code 34.section #nvc0_grhub_code
35#define INCLUDE_CODE
165bra #init 36bra #init
166define(`include_code') 37#include "com.fuc"
167include(`nvc0.fuc') 38#include "hub.fuc"
168
169// reports an exception to the host
170//
171// In: $r15 error code (see nvc0.fuc)
172//
173error:
174 push $r14
175 mov $r14 0x814
176 shl b32 $r14 6
177 iowr I[$r14 + 0x000] $r15 // CC_SCRATCH[5] = error code
178 mov $r14 0xc1c
179 shl b32 $r14 6
180 mov $r15 1
181 iowr I[$r14 + 0x000] $r15 // INTR_UP_SET
182 pop $r14
183 ret
184
185// HUB fuc initialisation, executed by triggering ucode start, will
186// fall through to main loop after completion.
187//
188// Input:
189// CC_SCRATCH[0]: chipset (PMC_BOOT_0 read returns 0x0bad0bad... sigh)
190//
191// Output:
192// CC_SCRATCH[0]:
193// 31:31: set to signal completion
194// CC_SCRATCH[1]:
195// 31:0: total PGRAPH context size
196//
197init:
198 clear b32 $r0
199 mov $sp $r0
200 mov $xdbase $r0
201
202 // enable fifo access
203 mov $r1 0x1200
204 mov $r2 2
205 iowr I[$r1 + 0x000] $r2 // FIFO_ENABLE
206
207 // setup i0 handler, and route all interrupts to it
208 mov $r1 #ih
209 mov $iv0 $r1
210 mov $r1 0x400
211 iowr I[$r1 + 0x300] $r0 // INTR_DISPATCH
212
213 // route HUB_CHANNEL_SWITCH to fuc interrupt 8
214 mov $r3 0x404
215 shl b32 $r3 6
216 mov $r2 0x2003 // { HUB_CHANNEL_SWITCH, ZERO } -> intr 8
217 iowr I[$r3 + 0x000] $r2
218
219 // not sure what these are, route them because NVIDIA does, and
220 // the IRQ handler will signal the host if we ever get one.. we
221 // may find out if/why we need to handle these if so..
222 //
223 mov $r2 0x2004
224 iowr I[$r3 + 0x004] $r2 // { 0x04, ZERO } -> intr 9
225 mov $r2 0x200b
226 iowr I[$r3 + 0x008] $r2 // { 0x0b, ZERO } -> intr 10
227 mov $r2 0x200c
228 iowr I[$r3 + 0x01c] $r2 // { 0x0c, ZERO } -> intr 15
229
230 // enable all INTR_UP interrupts
231 mov $r2 0xc24
232 shl b32 $r2 6
233 not b32 $r3 $r0
234 iowr I[$r2] $r3
235
236 // enable fifo, ctxsw, 9, 10, 15 interrupts
237 mov $r2 -0x78fc // 0x8704
238 sethi $r2 0
239 iowr I[$r1 + 0x000] $r2 // INTR_EN_SET
240
241 // fifo level triggered, rest edge
242 sub b32 $r1 0x100
243 mov $r2 4
244 iowr I[$r1] $r2
245
246 // enable interrupts
247 bset $flags ie0
248
249 // fetch enabled GPC/ROP counts
250 mov $r14 -0x69fc // 0x409604
251 sethi $r14 0x400000
252 call #nv_rd32
253 extr $r1 $r15 16:20
254 st b32 D[$r0 + #rop_count] $r1
255 and $r15 0x1f
256 st b32 D[$r0 + #gpc_count] $r15
257
258 // set BAR_REQMASK to GPC mask
259 mov $r1 1
260 shl b32 $r1 $r15
261 sub b32 $r1 1
262 mov $r2 0x40c
263 shl b32 $r2 6
264 iowr I[$r2 + 0x000] $r1
265 iowr I[$r2 + 0x100] $r1
266
267 // find context data for this chipset
268 mov $r2 0x800
269 shl b32 $r2 6
270 iord $r2 I[$r2 + 0x000] // CC_SCRATCH[0]
271 mov $r15 #chipsets - 8
272 init_find_chipset:
273 add b32 $r15 8
274 ld b32 $r3 D[$r15 + 0x00]
275 cmpu b32 $r3 $r2
276 bra e #init_context
277 cmpu b32 $r3 0
278 bra ne #init_find_chipset
279 // unknown chipset
280 ret
281
282 // context size calculation, reserve first 256 bytes for use by fuc
283 init_context:
284 mov $r1 256
285
286 // calculate size of mmio context data
287 ld b16 $r14 D[$r15 + 4]
288 ld b16 $r15 D[$r15 + 6]
289 sethi $r14 0
290 st b32 D[$r0 + #hub_mmio_list_head] $r14
291 st b32 D[$r0 + #hub_mmio_list_tail] $r15
292 call #mmctx_size
293
294 // set mmctx base addresses now so we don't have to do it later,
295 // they don't (currently) ever change
296 mov $r3 0x700
297 shl b32 $r3 6
298 shr b32 $r4 $r1 8
299 iowr I[$r3 + 0x000] $r4 // MMCTX_SAVE_SWBASE
300 iowr I[$r3 + 0x100] $r4 // MMCTX_LOAD_SWBASE
301 add b32 $r3 0x1300
302 add b32 $r1 $r15
303 shr b32 $r15 2
304 iowr I[$r3 + 0x000] $r15 // MMCTX_LOAD_COUNT, wtf for?!?
305
306 // strands, base offset needs to be aligned to 256 bytes
307 shr b32 $r1 8
308 add b32 $r1 1
309 shl b32 $r1 8
310 mov b32 $r15 $r1
311 call #strand_ctx_init
312 add b32 $r1 $r15
313
314 // initialise each GPC in sequence by passing in the offset of its
315 // context data in GPCn_CC_SCRATCH[1], and starting its FUC (which
316 // has previously been uploaded by the host) running.
317 //
318 // the GPC fuc init sequence will set GPCn_CC_SCRATCH[0] bit 31
319 // when it has completed, and return the size of its context data
320 // in GPCn_CC_SCRATCH[1]
321 //
322 ld b32 $r3 D[$r0 + #gpc_count]
323 mov $r4 0x2000
324 sethi $r4 0x500000
325 init_gpc:
326 // setup, and start GPC ucode running
327 add b32 $r14 $r4 0x804
328 mov b32 $r15 $r1
329 call #nv_wr32 // CC_SCRATCH[1] = ctx offset
330 add b32 $r14 $r4 0x800
331 mov b32 $r15 $r2
332 call #nv_wr32 // CC_SCRATCH[0] = chipset
333 add b32 $r14 $r4 0x10c
334 clear b32 $r15
335 call #nv_wr32
336 add b32 $r14 $r4 0x104
337 call #nv_wr32 // ENTRY
338 add b32 $r14 $r4 0x100
339 mov $r15 2 // CTRL_START_TRIGGER
340 call #nv_wr32 // CTRL
341
342 // wait for it to complete, and adjust context size
343 add b32 $r14 $r4 0x800
344 init_gpc_wait:
345 call #nv_rd32
346 xbit $r15 $r15 31
347 bra e #init_gpc_wait
348 add b32 $r14 $r4 0x804
349 call #nv_rd32
350 add b32 $r1 $r15
351
352 // next!
353 add b32 $r4 0x8000
354 sub b32 $r3 1
355 bra ne #init_gpc
356
357 // save context size, and tell host we're ready
358 mov $r2 0x800
359 shl b32 $r2 6
360 iowr I[$r2 + 0x100] $r1 // CC_SCRATCH[1] = context size
361 add b32 $r2 0x800
362 clear b32 $r1
363 bset $r1 31
364 iowr I[$r2 + 0x000] $r1 // CC_SCRATCH[0] |= 0x80000000
365
366// Main program loop, very simple, sleeps until woken up by the interrupt
367// handler, pulls a command from the queue and executes its handler
368//
369main:
370 // sleep until we have something to do
371 bset $flags $p0
372 sleep $p0
373 mov $r13 #cmd_queue
374 call #queue_get
375 bra $p1 #main
376
377 // context switch, requested by GPU?
378 cmpu b32 $r14 0x4001
379 bra ne #main_not_ctx_switch
380 trace_set(T_AUTO)
381 mov $r1 0xb00
382 shl b32 $r1 6
383 iord $r2 I[$r1 + 0x100] // CHAN_NEXT
384 iord $r1 I[$r1 + 0x000] // CHAN_CUR
385
386 xbit $r3 $r1 31
387 bra e #chsw_no_prev
388 xbit $r3 $r2 31
389 bra e #chsw_prev_no_next
390 push $r2
391 mov b32 $r2 $r1
392 trace_set(T_SAVE)
393 bclr $flags $p1
394 bset $flags $p2
395 call #ctx_xfer
396 trace_clr(T_SAVE);
397 pop $r2
398 trace_set(T_LOAD);
399 bset $flags $p1
400 call #ctx_xfer
401 trace_clr(T_LOAD);
402 bra #chsw_done
403 chsw_prev_no_next:
404 push $r2
405 mov b32 $r2 $r1
406 bclr $flags $p1
407 bclr $flags $p2
408 call #ctx_xfer
409 pop $r2
410 mov $r1 0xb00
411 shl b32 $r1 6
412 iowr I[$r1] $r2
413 bra #chsw_done
414 chsw_no_prev:
415 xbit $r3 $r2 31
416 bra e #chsw_done
417 bset $flags $p1
418 bclr $flags $p2
419 call #ctx_xfer
420
421 // ack the context switch request
422 chsw_done:
423 mov $r1 0xb0c
424 shl b32 $r1 6
425 mov $r2 1
426 iowr I[$r1 + 0x000] $r2 // 0x409b0c
427 trace_clr(T_AUTO)
428 bra #main
429
430 // request to set current channel? (*not* a context switch)
431 main_not_ctx_switch:
432 cmpu b32 $r14 0x0001
433 bra ne #main_not_ctx_chan
434 mov b32 $r2 $r15
435 call #ctx_chan
436 bra #main_done
437
438 // request to store current channel context?
439 main_not_ctx_chan:
440 cmpu b32 $r14 0x0002
441 bra ne #main_not_ctx_save
442 trace_set(T_SAVE)
443 bclr $flags $p1
444 bclr $flags $p2
445 call #ctx_xfer
446 trace_clr(T_SAVE)
447 bra #main_done
448
449 main_not_ctx_save:
450 shl b32 $r15 $r14 16
451 or $r15 E_BAD_COMMAND
452 call #error
453 bra #main
454
455 main_done:
456 mov $r1 0x820
457 shl b32 $r1 6
458 clear b32 $r2
459 bset $r2 31
460 iowr I[$r1 + 0x000] $r2 // CC_SCRATCH[0] |= 0x80000000
461 bra #main
462
463// interrupt handler
464ih:
465 push $r8
466 mov $r8 $flags
467 push $r8
468 push $r9
469 push $r10
470 push $r11
471 push $r13
472 push $r14
473 push $r15
474
475 // incoming fifo command?
476 iord $r10 I[$r0 + 0x200] // INTR
477 and $r11 $r10 0x00000004
478 bra e #ih_no_fifo
479 // queue incoming fifo command for later processing
480 mov $r11 0x1900
481 mov $r13 #cmd_queue
482 iord $r14 I[$r11 + 0x100] // FIFO_CMD
483 iord $r15 I[$r11 + 0x000] // FIFO_DATA
484 call #queue_put
485 add b32 $r11 0x400
486 mov $r14 1
487 iowr I[$r11 + 0x000] $r14 // FIFO_ACK
488
489 // context switch request?
490 ih_no_fifo:
491 and $r11 $r10 0x00000100
492 bra e #ih_no_ctxsw
493 // enqueue a context switch for later processing
494 mov $r13 #cmd_queue
495 mov $r14 0x4001
496 call #queue_put
497
498 // anything we didn't handle, bring it to the host's attention
499 ih_no_ctxsw:
500 mov $r11 0x104
501 not b32 $r11
502 and $r11 $r10 $r11
503 bra e #ih_no_other
504 mov $r10 0xc1c
505 shl b32 $r10 6
506 iowr I[$r10] $r11 // INTR_UP_SET
507
508 // ack, and wake up main()
509 ih_no_other:
510 iowr I[$r0 + 0x100] $r10 // INTR_ACK
511
512 pop $r15
513 pop $r14
514 pop $r13
515 pop $r11
516 pop $r10
517 pop $r9
518 pop $r8
519 mov $flags $r8
520 pop $r8
521 bclr $flags $p0
522 iret
523
524// Not real sure, but, MEM_CMD 7 will hang forever if this isn't done
525ctx_4160s:
526 mov $r14 0x4160
527 sethi $r14 0x400000
528 mov $r15 1
529 call #nv_wr32
530 ctx_4160s_wait:
531 call #nv_rd32
532 xbit $r15 $r15 4
533 bra e #ctx_4160s_wait
534 ret
535
536// Without clearing again at end of xfer, some things cause PGRAPH
537// to hang with STATUS=0x00000007 until it's cleared.. fbcon can
538// still function with it set however...
539ctx_4160c:
540 mov $r14 0x4160
541 sethi $r14 0x400000
542 clear b32 $r15
543 call #nv_wr32
544 ret
545
546// Again, not real sure
547//
548// In: $r15 value to set 0x404170 to
549//
550ctx_4170s:
551 mov $r14 0x4170
552 sethi $r14 0x400000
553 or $r15 0x10
554 call #nv_wr32
555 ret
556
557// Waits for a ctx_4170s() call to complete
558//
559ctx_4170w:
560 mov $r14 0x4170
561 sethi $r14 0x400000
562 call #nv_rd32
563 and $r15 0x10
564 bra ne #ctx_4170w
565 ret
566
567// Disables various things, waits a bit, and re-enables them..
568//
569// Not sure how exactly this helps, perhaps "ENABLE" is not such a
570// good description for the bits we turn off? Anyways, without this,
571// funny things happen.
572//
573ctx_redswitch:
574 mov $r14 0x614
575 shl b32 $r14 6
576 mov $r15 0x270
577 iowr I[$r14] $r15 // HUB_RED_SWITCH = ENABLE_GPC, POWER_ALL
578 mov $r15 8
579 ctx_redswitch_delay:
580 sub b32 $r15 1
581 bra ne #ctx_redswitch_delay
582 mov $r15 0x770
583 iowr I[$r14] $r15 // HUB_RED_SWITCH = ENABLE_ALL, POWER_ALL
584 ret
585
586// Not a clue what this is for, except that unless the value is 0x10, the
587// strand context is saved (and presumably restored) incorrectly..
588//
589// In: $r15 value to set to (0x00/0x10 are used)
590//
591ctx_86c:
592 mov $r14 0x86c
593 shl b32 $r14 6
594 iowr I[$r14] $r15 // HUB(0x86c) = val
595 mov $r14 -0x75ec
596 sethi $r14 0x400000
597 call #nv_wr32 // ROP(0xa14) = val
598 mov $r14 -0x5794
599 sethi $r14 0x410000
600 call #nv_wr32 // GPC(0x86c) = val
601 ret
602
603// ctx_load - load's a channel's ctxctl data, and selects its vm
604//
605// In: $r2 channel address
606//
607ctx_load:
608 trace_set(T_CHAN)
609
610 // switch to channel, somewhat magic in parts..
611 mov $r10 12 // DONE_UNK12
612 call #wait_donez
613 mov $r1 0xa24
614 shl b32 $r1 6
615 iowr I[$r1 + 0x000] $r0 // 0x409a24
616 mov $r3 0xb00
617 shl b32 $r3 6
618 iowr I[$r3 + 0x100] $r2 // CHAN_NEXT
619 mov $r1 0xa0c
620 shl b32 $r1 6
621 mov $r4 7
622 iowr I[$r1 + 0x000] $r2 // MEM_CHAN
623 iowr I[$r1 + 0x100] $r4 // MEM_CMD
624 ctx_chan_wait_0:
625 iord $r4 I[$r1 + 0x100]
626 and $r4 0x1f
627 bra ne #ctx_chan_wait_0
628 iowr I[$r3 + 0x000] $r2 // CHAN_CUR
629
630 // load channel header, fetch PGRAPH context pointer
631 mov $xtargets $r0
632 bclr $r2 31
633 shl b32 $r2 4
634 add b32 $r2 2
635
636 trace_set(T_LCHAN)
637 mov $r1 0xa04
638 shl b32 $r1 6
639 iowr I[$r1 + 0x000] $r2 // MEM_BASE
640 mov $r1 0xa20
641 shl b32 $r1 6
642 mov $r2 0x0002
643 sethi $r2 0x80000000
644 iowr I[$r1 + 0x000] $r2 // MEM_TARGET = vram
645 mov $r1 0x10 // chan + 0x0210
646 mov $r2 #xfer_data
647 sethi $r2 0x00020000 // 16 bytes
648 xdld $r1 $r2
649 xdwait
650 trace_clr(T_LCHAN)
651
652 // update current context
653 ld b32 $r1 D[$r0 + #xfer_data + 4]
654 shl b32 $r1 24
655 ld b32 $r2 D[$r0 + #xfer_data + 0]
656 shr b32 $r2 8
657 or $r1 $r2
658 st b32 D[$r0 + #ctx_current] $r1
659
660 // set transfer base to start of context, and fetch context header
661 trace_set(T_LCTXH)
662 mov $r2 0xa04
663 shl b32 $r2 6
664 iowr I[$r2 + 0x000] $r1 // MEM_BASE
665 mov $r2 1
666 mov $r1 0xa20
667 shl b32 $r1 6
668 iowr I[$r1 + 0x000] $r2 // MEM_TARGET = vm
669 mov $r1 #chan_data
670 sethi $r1 0x00060000 // 256 bytes
671 xdld $r0 $r1
672 xdwait
673 trace_clr(T_LCTXH)
674
675 trace_clr(T_CHAN)
676 ret
677
678// ctx_chan - handler for HUB_SET_CHAN command, will set a channel as
679// the active channel for ctxctl, but not actually transfer
680// any context data. intended for use only during initial
681// context construction.
682//
683// In: $r2 channel address
684//
685ctx_chan:
686 call #ctx_4160s
687 call #ctx_load
688 mov $r10 12 // DONE_UNK12
689 call #wait_donez
690 mov $r1 0xa10
691 shl b32 $r1 6
692 mov $r2 5
693 iowr I[$r1 + 0x000] $r2 // MEM_CMD = 5 (???)
694 ctx_chan_wait:
695 iord $r2 I[$r1 + 0x000]
696 or $r2 $r2
697 bra ne #ctx_chan_wait
698 call #ctx_4160c
699 ret
700
701// Execute per-context state overrides list
702//
703// Only executed on the first load of a channel. Might want to look into
704// removing this and having the host directly modify the channel's context
705// to change this state... The nouveau DRM already builds this list as
706// it's definitely needed for NVIDIA's, so we may as well use it for now
707//
708// Input: $r1 mmio list length
709//
710ctx_mmio_exec:
711 // set transfer base to be the mmio list
712 ld b32 $r3 D[$r0 + #chan_mmio_address]
713 mov $r2 0xa04
714 shl b32 $r2 6
715 iowr I[$r2 + 0x000] $r3 // MEM_BASE
716
717 clear b32 $r3
718 ctx_mmio_loop:
719 // fetch next 256 bytes of mmio list if necessary
720 and $r4 $r3 0xff
721 bra ne #ctx_mmio_pull
722 mov $r5 #xfer_data
723 sethi $r5 0x00060000 // 256 bytes
724 xdld $r3 $r5
725 xdwait
726
727 // execute a single list entry
728 ctx_mmio_pull:
729 ld b32 $r14 D[$r4 + #xfer_data + 0x00]
730 ld b32 $r15 D[$r4 + #xfer_data + 0x04]
731 call #nv_wr32
732
733 // next!
734 add b32 $r3 8
735 sub b32 $r1 1
736 bra ne #ctx_mmio_loop
737
738 // set transfer base back to the current context
739 ctx_mmio_done:
740 ld b32 $r3 D[$r0 + #ctx_current]
741 iowr I[$r2 + 0x000] $r3 // MEM_BASE
742
743 // disable the mmio list now, we don't need/want to execute it again
744 st b32 D[$r0 + #chan_mmio_count] $r0
745 mov $r1 #chan_data
746 sethi $r1 0x00060000 // 256 bytes
747 xdst $r0 $r1
748 xdwait
749 ret
750
751// Transfer HUB context data between GPU and storage area
752//
753// In: $r2 channel address
754// $p1 clear on save, set on load
755// $p2 set if opposite direction done/will be done, so:
756// on save it means: "a load will follow this save"
757// on load it means: "a save preceeded this load"
758//
759ctx_xfer:
760 // according to mwk, some kind of wait for idle
761 mov $r15 0xc00
762 shl b32 $r15 6
763 mov $r14 4
764 iowr I[$r15 + 0x200] $r14
765 ctx_xfer_idle:
766 iord $r14 I[$r15 + 0x000]
767 and $r14 0x2000
768 bra ne #ctx_xfer_idle
769
770 bra not $p1 #ctx_xfer_pre
771 bra $p2 #ctx_xfer_pre_load
772 ctx_xfer_pre:
773 mov $r15 0x10
774 call #ctx_86c
775 call #ctx_4160s
776 bra not $p1 #ctx_xfer_exec
777
778 ctx_xfer_pre_load:
779 mov $r15 2
780 call #ctx_4170s
781 call #ctx_4170w
782 call #ctx_redswitch
783 clear b32 $r15
784 call #ctx_4170s
785 call #ctx_load
786
787 // fetch context pointer, and initiate xfer on all GPCs
788 ctx_xfer_exec:
789 ld b32 $r1 D[$r0 + #ctx_current]
790 mov $r2 0x414
791 shl b32 $r2 6
792 iowr I[$r2 + 0x000] $r0 // BAR_STATUS = reset
793 mov $r14 -0x5b00
794 sethi $r14 0x410000
795 mov b32 $r15 $r1
796 call #nv_wr32 // GPC_BCAST_WRCMD_DATA = ctx pointer
797 add b32 $r14 4
798 xbit $r15 $flags $p1
799 xbit $r2 $flags $p2
800 shl b32 $r2 1
801 or $r15 $r2
802 call #nv_wr32 // GPC_BCAST_WRCMD_CMD = GPC_XFER(type)
803
804 // strands
805 mov $r1 0x4afc
806 sethi $r1 0x20000
807 mov $r2 0xc
808 iowr I[$r1] $r2 // STRAND_CMD(0x3f) = 0x0c
809 call #strand_wait
810 mov $r2 0x47fc
811 sethi $r2 0x20000
812 iowr I[$r2] $r0 // STRAND_FIRST_GENE(0x3f) = 0x00
813 xbit $r2 $flags $p1
814 add b32 $r2 3
815 iowr I[$r1] $r2 // STRAND_CMD(0x3f) = 0x03/0x04 (SAVE/LOAD)
816
817 // mmio context
818 xbit $r10 $flags $p1 // direction
819 or $r10 6 // first, last
820 mov $r11 0 // base = 0
821 ld b32 $r12 D[$r0 + #hub_mmio_list_head]
822 ld b32 $r13 D[$r0 + #hub_mmio_list_tail]
823 mov $r14 0 // not multi
824 call #mmctx_xfer
825
826 // wait for GPCs to all complete
827 mov $r10 8 // DONE_BAR
828 call #wait_doneo
829
830 // wait for strand xfer to complete
831 call #strand_wait
832
833 // post-op
834 bra $p1 #ctx_xfer_post
835 mov $r10 12 // DONE_UNK12
836 call #wait_donez
837 mov $r1 0xa10
838 shl b32 $r1 6
839 mov $r2 5
840 iowr I[$r1] $r2 // MEM_CMD
841 ctx_xfer_post_save_wait:
842 iord $r2 I[$r1]
843 or $r2 $r2
844 bra ne #ctx_xfer_post_save_wait
845
846 bra $p2 #ctx_xfer_done
847 ctx_xfer_post:
848 mov $r15 2
849 call #ctx_4170s
850 clear b32 $r15
851 call #ctx_86c
852 call #strand_post
853 call #ctx_4170w
854 clear b32 $r15
855 call #ctx_4170s
856
857 bra not $p1 #ctx_xfer_no_post_mmio
858 ld b32 $r1 D[$r0 + #chan_mmio_count]
859 or $r1 $r1
860 bra e #ctx_xfer_no_post_mmio
861 call #ctx_mmio_exec
862
863 ctx_xfer_no_post_mmio:
864 call #ctx_4160c
865
866 ctx_xfer_done:
867 ret
868
869.align 256 39.align 256
40#undef INCLUDE_CODE
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h
index bb03d2a1d57b..b59f694c0423 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h
@@ -1,9 +1,90 @@
1uint32_t nvc0_grhub_data[] = { 1uint32_t nvc0_grhub_data[] = {
2/* 0x0000: gpc_count */ 2/* 0x0000: hub_mmio_list_head */
3 0x00000300,
4/* 0x0004: hub_mmio_list_tail */
5 0x00000304,
6/* 0x0008: gpc_count */
7 0x00000000,
8/* 0x000c: rop_count */
9 0x00000000,
10/* 0x0010: cmd_queue */
11 0x00000000,
12 0x00000000,
13 0x00000000,
14 0x00000000,
15 0x00000000,
16 0x00000000,
17 0x00000000,
18 0x00000000,
19 0x00000000,
20 0x00000000,
21 0x00000000,
22 0x00000000,
23 0x00000000,
24 0x00000000,
25 0x00000000,
26 0x00000000,
27 0x00000000,
28 0x00000000,
29/* 0x0058: ctx_current */
30 0x00000000,
31 0x00000000,
32 0x00000000,
33 0x00000000,
34 0x00000000,
35 0x00000000,
36 0x00000000,
37 0x00000000,
38 0x00000000,
39 0x00000000,
40 0x00000000,
41 0x00000000,
42 0x00000000,
43 0x00000000,
44 0x00000000,
45 0x00000000,
46 0x00000000,
47 0x00000000,
48 0x00000000,
49 0x00000000,
50 0x00000000,
51 0x00000000,
52 0x00000000,
53 0x00000000,
54 0x00000000,
55 0x00000000,
56 0x00000000,
57 0x00000000,
58 0x00000000,
59 0x00000000,
60 0x00000000,
61 0x00000000,
62 0x00000000,
63 0x00000000,
64 0x00000000,
65 0x00000000,
66 0x00000000,
67 0x00000000,
68 0x00000000,
69 0x00000000,
70 0x00000000,
71 0x00000000,
72/* 0x0100: chan_data */
73/* 0x0100: chan_mmio_count */
74 0x00000000,
75/* 0x0104: chan_mmio_address */
76 0x00000000,
77 0x00000000,
78 0x00000000,
79 0x00000000,
80 0x00000000,
81 0x00000000,
82 0x00000000,
83 0x00000000,
84 0x00000000,
85 0x00000000,
3 0x00000000, 86 0x00000000,
4/* 0x0004: rop_count */
5 0x00000000, 87 0x00000000,
6/* 0x0008: cmd_queue */
7 0x00000000, 88 0x00000000,
8 0x00000000, 89 0x00000000,
9 0x00000000, 90 0x00000000,
@@ -22,114 +103,9 @@ uint32_t nvc0_grhub_data[] = {
22 0x00000000, 103 0x00000000,
23 0x00000000, 104 0x00000000,
24 0x00000000, 105 0x00000000,
25/* 0x0050: hub_mmio_list_head */
26 0x00000000, 106 0x00000000,
27/* 0x0054: hub_mmio_list_tail */
28 0x00000000, 107 0x00000000,
29/* 0x0058: ctx_current */
30 0x00000000, 108 0x00000000,
31/* 0x005c: chipsets */
32 0x000000c0,
33 0x013c00a0,
34 0x000000c1,
35 0x014000a0,
36 0x000000c3,
37 0x013c00a0,
38 0x000000c4,
39 0x013c00a0,
40 0x000000c8,
41 0x013c00a0,
42 0x000000ce,
43 0x013c00a0,
44 0x000000cf,
45 0x013c00a0,
46 0x000000d9,
47 0x01dc0140,
48 0x00000000,
49/* 0x00a0: nvc0_hub_mmio_head */
50 0x0417e91c,
51 0x04400204,
52 0x28404004,
53 0x00404044,
54 0x34404094,
55 0x184040d0,
56 0x004040f8,
57 0x08404130,
58 0x08404150,
59 0x04404164,
60 0x08404174,
61 0x1c404200,
62 0x34404404,
63 0x0c404460,
64 0x00404480,
65 0x00404498,
66 0x0c404604,
67 0x7c404618,
68 0x50404698,
69 0x044046f0,
70 0x54404700,
71 0x00405800,
72 0x08405830,
73 0x00405854,
74 0x0c405870,
75 0x04405a00,
76 0x00405a18,
77 0x00406020,
78 0x0c406028,
79 0x044064a8,
80 0x044064b4,
81 0x00407804,
82 0x1440780c,
83 0x004078bc,
84 0x18408000,
85 0x00408064,
86 0x08408800,
87 0x0c408900,
88 0x00408980,
89/* 0x013c: nvc0_hub_mmio_tail */
90 0x044064c0,
91/* 0x0140: nvc1_hub_mmio_tail */
92/* 0x0140: nvd9_hub_mmio_head */
93 0x0417e91c,
94 0x04400204,
95 0x24404004,
96 0x00404044,
97 0x34404094,
98 0x184040d0,
99 0x004040f8,
100 0x08404130,
101 0x08404150,
102 0x04404164,
103 0x04404178,
104 0x1c404200,
105 0x34404404,
106 0x0c404460,
107 0x00404480,
108 0x00404498,
109 0x0c404604,
110 0x7c404618,
111 0x50404698,
112 0x044046f0,
113 0x54404700,
114 0x00405800,
115 0x08405830,
116 0x00405854,
117 0x0c405870,
118 0x04405a00,
119 0x00405a18,
120 0x00406020,
121 0x0c406028,
122 0x044064a8,
123 0x104064b4,
124 0x00407804,
125 0x1440780c,
126 0x004078bc,
127 0x18408000,
128 0x00408064,
129 0x08408800,
130 0x0c408900,
131 0x00408980,
132/* 0x01dc: nvd9_hub_mmio_tail */
133 0x00000000, 109 0x00000000,
134 0x00000000, 110 0x00000000,
135 0x00000000, 111 0x00000000,
@@ -139,10 +115,7 @@ uint32_t nvc0_grhub_data[] = {
139 0x00000000, 115 0x00000000,
140 0x00000000, 116 0x00000000,
141 0x00000000, 117 0x00000000,
142/* 0x0200: chan_data */
143/* 0x0200: chan_mmio_count */
144 0x00000000, 118 0x00000000,
145/* 0x0204: chan_mmio_address */
146 0x00000000, 119 0x00000000,
147 0x00000000, 120 0x00000000,
148 0x00000000, 121 0x00000000,
@@ -163,6 +136,7 @@ uint32_t nvc0_grhub_data[] = {
163 0x00000000, 136 0x00000000,
164 0x00000000, 137 0x00000000,
165 0x00000000, 138 0x00000000,
139/* 0x0200: xfer_data */
166 0x00000000, 140 0x00000000,
167 0x00000000, 141 0x00000000,
168 0x00000000, 142 0x00000000,
@@ -206,19 +180,40 @@ uint32_t nvc0_grhub_data[] = {
206 0x00000000, 180 0x00000000,
207 0x00000000, 181 0x00000000,
208 0x00000000, 182 0x00000000,
209/* 0x0300: xfer_data */
210 0x00000000, 183 0x00000000,
184 0x00000000,
185 0x00000000,
186 0x00000000,
187 0x00000000,
188 0x00000000,
189 0x00000000,
190 0x00000000,
191 0x00000000,
192 0x00000000,
193 0x00000000,
194 0x00000000,
195 0x00000000,
196 0x00000000,
197 0x00000000,
198 0x00000000,
199 0x00000000,
200 0x00000000,
201 0x00000000,
202 0x00000000,
203 0x00000000,
204/* 0x0300: hub_mmio_list_base */
205 0x0417e91c,
211}; 206};
212 207
213uint32_t nvc0_grhub_code[] = { 208uint32_t nvc0_grhub_code[] = {
214 0x03090ef5, 209 0x031b0ef5,
215/* 0x0004: queue_put */ 210/* 0x0004: queue_put */
216 0x9800d898, 211 0x9800d898,
217 0x86f001d9, 212 0x86f001d9,
218 0x0489b808, 213 0x0489b808,
219 0xf00c1bf4, 214 0xf00c1bf4,
220 0x21f502f7, 215 0x21f502f7,
221 0x00f802ec, 216 0x00f802fe,
222/* 0x001c: queue_put_next */ 217/* 0x001c: queue_put_next */
223 0xb60798c4, 218 0xb60798c4,
224 0x8dbb0384, 219 0x8dbb0384,
@@ -250,7 +245,7 @@ uint32_t nvc0_grhub_code[] = {
250 0xc800bccf, 245 0xc800bccf,
251 0x1bf41fcc, 246 0x1bf41fcc,
252 0x06a7f0fa, 247 0x06a7f0fa,
253 0x010321f5, 248 0x010921f5,
254 0xf840bfcf, 249 0xf840bfcf,
255/* 0x008d: nv_wr32 */ 250/* 0x008d: nv_wr32 */
256 0x28b7f100, 251 0x28b7f100,
@@ -272,63 +267,66 @@ uint32_t nvc0_grhub_code[] = {
272 0x0684b604, 267 0x0684b604,
273 0xf80080d0, 268 0xf80080d0,
274/* 0x00c9: wait_donez */ 269/* 0x00c9: wait_donez */
275 0x3c87f100, 270 0xf094bd00,
276 0x0684b608, 271 0x07f10099,
277 0x99f094bd, 272 0x03f00f00,
278 0x0089d000, 273 0x0009d002,
279 0x081887f1, 274 0x07f104bd,
280 0xd00684b6, 275 0x03f00600,
281/* 0x00e2: wait_done_wait_donez */ 276 0x000ad002,
282 0x87f1008a, 277/* 0x00e6: wait_donez_ne */
283 0x84b60400, 278 0x87f104bd,
284 0x0088cf06, 279 0x83f00000,
280 0x0088cf01,
285 0xf4888aff, 281 0xf4888aff,
286 0x87f1f31b, 282 0x94bdf31b,
287 0x84b6085c, 283 0xf10099f0,
288 0xf094bd06, 284 0xf0170007,
289 0x89d00099, 285 0x09d00203,
290/* 0x0103: wait_doneo */ 286 0xf804bd00,
291 0xf100f800, 287/* 0x0109: wait_doneo */
292 0xb6083c87, 288 0xf094bd00,
293 0x94bd0684, 289 0x07f10099,
294 0xd00099f0, 290 0x03f00f00,
295 0x87f10089, 291 0x0009d002,
292 0x87f104bd,
296 0x84b60818, 293 0x84b60818,
297 0x008ad006, 294 0x008ad006,
298/* 0x011c: wait_done_wait_doneo */ 295/* 0x0124: wait_doneo_e */
299 0x040087f1, 296 0x040087f1,
300 0xcf0684b6, 297 0xcf0684b6,
301 0x8aff0088, 298 0x8aff0088,
302 0xf30bf488, 299 0xf30bf488,
303 0x085c87f1, 300 0x99f094bd,
304 0xbd0684b6, 301 0x0007f100,
305 0x0099f094, 302 0x0203f017,
306 0xf80089d0, 303 0xbd0009d0,
307/* 0x013d: mmctx_size */ 304/* 0x0147: mmctx_size */
308/* 0x013f: nv_mmctx_size_loop */ 305 0xbd00f804,
309 0x9894bd00, 306/* 0x0149: nv_mmctx_size_loop */
310 0x85b600e8, 307 0x00e89894,
311 0x0180b61a, 308 0xb61a85b6,
312 0xbb0284b6, 309 0x84b60180,
313 0xe0b60098, 310 0x0098bb02,
314 0x04efb804, 311 0xb804e0b6,
315 0xb9eb1bf4, 312 0x1bf404ef,
316 0x00f8029f, 313 0x029fb9eb,
317/* 0x015c: mmctx_xfer */ 314/* 0x0166: mmctx_xfer */
318 0x083c87f1, 315 0x94bd00f8,
319 0xbd0684b6, 316 0xf10199f0,
320 0x0199f094, 317 0xf00f0007,
321 0xf10089d0, 318 0x09d00203,
319 0xf104bd00,
322 0xb6071087, 320 0xb6071087,
323 0x94bd0684, 321 0x94bd0684,
324 0xf405bbfd, 322 0xf405bbfd,
325 0x8bd0090b, 323 0x8bd0090b,
326 0x0099f000, 324 0x0099f000,
327/* 0x0180: mmctx_base_disabled */ 325/* 0x018c: mmctx_base_disabled */
328 0xf405eefd, 326 0xf405eefd,
329 0x8ed00c0b, 327 0x8ed00c0b,
330 0xc08fd080, 328 0xc08fd080,
331/* 0x018f: mmctx_multi_disabled */ 329/* 0x019b: mmctx_multi_disabled */
332 0xb70199f0, 330 0xb70199f0,
333 0xc8010080, 331 0xc8010080,
334 0xb4b600ab, 332 0xb4b600ab,
@@ -336,8 +334,8 @@ uint32_t nvc0_grhub_code[] = {
336 0xb601aec8, 334 0xb601aec8,
337 0xbefd11e4, 335 0xbefd11e4,
338 0x008bd005, 336 0x008bd005,
339/* 0x01a8: mmctx_exec_loop */ 337/* 0x01b4: mmctx_exec_loop */
340/* 0x01a8: mmctx_wait_free */ 338/* 0x01b4: mmctx_wait_free */
341 0xf0008ecf, 339 0xf0008ecf,
342 0x0bf41fe4, 340 0x0bf41fe4,
343 0x00ce98fa, 341 0x00ce98fa,
@@ -346,76 +344,77 @@ uint32_t nvc0_grhub_code[] = {
346 0x04cdb804, 344 0x04cdb804,
347 0xc8e81bf4, 345 0xc8e81bf4,
348 0x1bf402ab, 346 0x1bf402ab,
349/* 0x01c9: mmctx_fini_wait */ 347/* 0x01d5: mmctx_fini_wait */
350 0x008bcf18, 348 0x008bcf18,
351 0xb01fb4f0, 349 0xb01fb4f0,
352 0x1bf410b4, 350 0x1bf410b4,
353 0x02a7f0f7, 351 0x02a7f0f7,
354 0xf4c921f4, 352 0xf4c921f4,
355/* 0x01de: mmctx_stop */ 353/* 0x01ea: mmctx_stop */
356 0xabc81b0e, 354 0xabc81b0e,
357 0x10b4b600, 355 0x10b4b600,
358 0xf00cb9f0, 356 0xf00cb9f0,
359 0x8bd012b9, 357 0x8bd012b9,
360/* 0x01ed: mmctx_stop_wait */ 358/* 0x01f9: mmctx_stop_wait */
361 0x008bcf00, 359 0x008bcf00,
362 0xf412bbc8, 360 0xf412bbc8,
363/* 0x01f6: mmctx_done */ 361/* 0x0202: mmctx_done */
364 0x87f1fa1b, 362 0x94bdfa1b,
365 0x84b6085c, 363 0xf10199f0,
366 0xf094bd06, 364 0xf0170007,
367 0x89d00199, 365 0x09d00203,
368/* 0x0207: strand_wait */ 366 0xf804bd00,
369 0xf900f800, 367/* 0x0215: strand_wait */
370 0x02a7f0a0, 368 0xf0a0f900,
371 0xfcc921f4, 369 0x21f402a7,
372/* 0x0213: strand_pre */ 370 0xf8a0fcc9,
373 0xf100f8a0, 371/* 0x0221: strand_pre */
374 0xf04afc87, 372 0xfc87f100,
375 0x97f00283, 373 0x0283f04a,
376 0x0089d00c, 374 0xd00c97f0,
377 0x020721f5,
378/* 0x0226: strand_post */
379 0x87f100f8,
380 0x83f04afc,
381 0x0d97f002,
382 0xf50089d0,
383 0xf8020721,
384/* 0x0239: strand_set */
385 0xfca7f100,
386 0x02a3f04f,
387 0x0500aba2,
388 0xd00fc7f0,
389 0xc7f000ac,
390 0x00bcd00b,
391 0x020721f5,
392 0xf000aed0,
393 0xbcd00ac7,
394 0x0721f500,
395/* 0x0263: strand_ctx_init */
396 0xf100f802,
397 0xb6083c87,
398 0x94bd0684,
399 0xd00399f0,
400 0x21f50089, 375 0x21f50089,
401 0xe7f00213, 376 0x00f80215,
402 0x3921f503, 377/* 0x0234: strand_post */
378 0x4afc87f1,
379 0xf00283f0,
380 0x89d00d97,
381 0x1521f500,
382/* 0x0247: strand_set */
383 0xf100f802,
384 0xf04ffca7,
385 0xaba202a3,
386 0xc7f00500,
387 0x00acd00f,
388 0xd00bc7f0,
389 0x21f500bc,
390 0xaed00215,
391 0x0ac7f000,
392 0xf500bcd0,
393 0xf8021521,
394/* 0x0271: strand_ctx_init */
395 0xf094bd00,
396 0x07f10399,
397 0x03f00f00,
398 0x0009d002,
399 0x21f504bd,
400 0xe7f00221,
401 0x4721f503,
403 0xfca7f102, 402 0xfca7f102,
404 0x02a3f046, 403 0x02a3f046,
405 0x0400aba0, 404 0x0400aba0,
406 0xf040a0d0, 405 0xf040a0d0,
407 0xbcd001c7, 406 0xbcd001c7,
408 0x0721f500, 407 0x1521f500,
409 0x010c9202, 408 0x010c9202,
410 0xf000acd0, 409 0xf000acd0,
411 0xbcd002c7, 410 0xbcd002c7,
412 0x0721f500, 411 0x1521f500,
413 0x2621f502, 412 0x3421f502,
414 0x8087f102, 413 0x8087f102,
415 0x0684b608, 414 0x0684b608,
416 0xb70089cf, 415 0xb70089cf,
417 0x95220080, 416 0x95220080,
418/* 0x02ba: ctx_init_strand_loop */ 417/* 0x02ca: ctx_init_strand_loop */
419 0x8ed008fe, 418 0x8ed008fe,
420 0x408ed000, 419 0x408ed000,
421 0xb6808acf, 420 0xb6808acf,
@@ -424,73 +423,61 @@ uint32_t nvc0_grhub_code[] = {
424 0xb60480b6, 423 0xb60480b6,
425 0x1bf40192, 424 0x1bf40192,
426 0x08e4b6e8, 425 0x08e4b6e8,
427 0xf1f2efbc, 426 0xbdf2efbc,
428 0xb6085c87, 427 0x0399f094,
429 0x94bd0684, 428 0x170007f1,
430 0xd00399f0, 429 0xd00203f0,
431 0x00f80089, 430 0x04bd0009,
432/* 0x02ec: error */ 431/* 0x02fe: error */
433 0xe7f1e0f9, 432 0x07f100f8,
434 0xe4b60814, 433 0x03f00500,
435 0x00efd006, 434 0x000fd002,
436 0x0c1ce7f1, 435 0xf7f004bd,
437 0xf006e4b6, 436 0x0007f101,
438 0xefd001f7, 437 0x0303f007,
439 0xf8e0fc00, 438 0xbd000fd0,
440/* 0x0309: init */ 439/* 0x031b: init */
441 0xfe04bd00, 440 0xbd00f804,
442 0x07fe0004, 441 0x0004fe04,
443 0x0017f100, 442 0xf10007fe,
444 0x0227f012, 443 0xf0120017,
445 0xf10012d0, 444 0x12d00227,
446 0xfe05b917, 445 0xb117f100,
447 0x17f10010, 446 0x0010fe05,
448 0x10d00400, 447 0x040017f1,
449 0x0437f1c0, 448 0xf1c010d0,
450 0x0634b604, 449 0xb6040437,
451 0x200327f1, 450 0x27f10634,
452 0xf10032d0, 451 0x32d02003,
453 0xd0200427,
454 0x27f10132,
455 0x32d0200b,
456 0x0c27f102,
457 0x0732d020,
458 0x0c2427f1,
459 0xb90624b6,
460 0x23d00003,
461 0x0427f100, 452 0x0427f100,
462 0x0023f087, 453 0x0132d020,
463 0xb70012d0, 454 0x200b27f1,
464 0xf0010012, 455 0xf10232d0,
465 0x12d00427, 456 0xd0200c27,
466 0x1031f400, 457 0x27f10732,
467 0x9604e7f1, 458 0x24b60c24,
468 0xf440e3f0, 459 0x0003b906,
469 0xf1c76821, 460 0xf10023d0,
470 0x01018090, 461 0xf0870427,
471 0x801ff4f0, 462 0x12d00023,
472 0x17f0000f, 463 0x0012b700,
473 0x041fbb01, 464 0x0427f001,
474 0xf10112b6, 465 0xf40012d0,
475 0xb6040c27, 466 0xe7f11031,
476 0x21d00624, 467 0xe3f09604,
477 0x4021d000, 468 0x6821f440,
478 0x080027f1, 469 0x8090f1c7,
479 0xcf0624b6, 470 0xf4f00301,
480 0xf7f00022, 471 0x020f801f,
481/* 0x03a9: init_find_chipset */ 472 0xbb0117f0,
482 0x08f0b654, 473 0x12b6041f,
483 0xb800f398, 474 0x0c27f101,
484 0x0bf40432, 475 0x0624b604,
485 0x0034b00b, 476 0xd00021d0,
486 0xf8f11bf4, 477 0x17f14021,
487/* 0x03bd: init_context */ 478 0x0e980100,
488 0x0017f100, 479 0x010f9800,
489 0x02fe5801, 480 0x014721f5,
490 0xf003ff58,
491 0x0e8000e3,
492 0x150f8014,
493 0x013d21f5,
494 0x070037f1, 481 0x070037f1,
495 0x950634b6, 482 0x950634b6,
496 0x34d00814, 483 0x34d00814,
@@ -501,208 +488,213 @@ uint32_t nvc0_grhub_code[] = {
501 0x0815b600, 488 0x0815b600,
502 0xb60110b6, 489 0xb60110b6,
503 0x1fb90814, 490 0x1fb90814,
504 0x6321f502, 491 0x7121f502,
505 0x001fbb02, 492 0x001fbb02,
506 0xf1000398, 493 0xf1020398,
507 0xf0200047, 494 0xf0200047,
508/* 0x040e: init_gpc */ 495/* 0x03f6: init_gpc */
509 0x4ea05043, 496 0x4ea05043,
510 0x1fb90804, 497 0x1fb90804,
511 0x8d21f402, 498 0x8d21f402,
512 0x08004ea0, 499 0x010c4ea0,
513 0xf4022fb9, 500 0x21f4f4bd,
514 0x4ea08d21, 501 0x044ea08d,
515 0xf4bd010c, 502 0x8d21f401,
516 0xa08d21f4, 503 0x01004ea0,
517 0xf401044e, 504 0xf402f7f0,
518 0x4ea08d21, 505 0x4ea08d21,
519 0xf7f00100, 506/* 0x041e: init_gpc_wait */
520 0x8d21f402, 507 0x21f40800,
521 0x08004ea0, 508 0x1fffc868,
522/* 0x0440: init_gpc_wait */ 509 0xa0fa0bf4,
523 0xc86821f4, 510 0xf408044e,
524 0x0bf41fff, 511 0x1fbb6821,
525 0x044ea0fa, 512 0x0040b700,
526 0x6821f408, 513 0x0132b680,
527 0xb7001fbb, 514 0xf1be1bf4,
528 0xb6800040, 515 0xf0010007,
529 0x1bf40132, 516 0x01d00203,
530 0x0027f1b4, 517 0xbd04bd00,
531 0x0624b608,
532 0xb74021d0,
533 0xbd080020,
534 0x1f19f014, 518 0x1f19f014,
535/* 0x0473: main */ 519 0x080007f1,
536 0xf40021d0, 520 0xd00203f0,
537 0x28f40031, 521 0x04bd0001,
538 0x08d7f000, 522/* 0x0458: main */
539 0xf43921f4, 523 0xf40031f4,
540 0xe4b1f401, 524 0xd7f00028,
541 0x1bf54001, 525 0x3921f410,
542 0x87f100d1, 526 0xb1f401f4,
543 0x84b6083c, 527 0xf54001e4,
544 0xf094bd06, 528 0xbd00de1b,
545 0x89d00499, 529 0x0499f094,
546 0x0017f100, 530 0x0f0007f1,
547 0x0614b60b, 531 0xd00203f0,
548 0xcf4012cf, 532 0x04bd0009,
549 0x13c80011, 533 0x0b0017f1,
550 0x7e0bf41f, 534 0xcf0614b6,
535 0x11cf4012,
536 0x1f13c800,
537 0x00870bf5,
551 0xf41f23c8, 538 0xf41f23c8,
552 0x20f95a0b, 539 0x20f9620b,
553 0xf10212b9, 540 0xbd0212b9,
554 0xb6083c87,
555 0x94bd0684,
556 0xd00799f0,
557 0x32f40089,
558 0x0231f401,
559 0x082921f5,
560 0x085c87f1,
561 0xbd0684b6,
562 0x0799f094, 541 0x0799f094,
563 0xfc0089d0, 542 0x0f0007f1,
564 0x3c87f120, 543 0xd00203f0,
565 0x0684b608, 544 0x04bd0009,
566 0x99f094bd, 545 0xf40132f4,
567 0x0089d006, 546 0x21f50231,
568 0xf50131f4, 547 0x94bd082f,
569 0xf1082921, 548 0xf10799f0,
570 0xb6085c87, 549 0xf0170007,
571 0x94bd0684, 550 0x09d00203,
572 0xd00699f0, 551 0xfc04bd00,
573 0x0ef40089, 552 0xf094bd20,
574/* 0x0509: chsw_prev_no_next */ 553 0x07f10699,
554 0x03f00f00,
555 0x0009d002,
556 0x31f404bd,
557 0x2f21f501,
558 0xf094bd08,
559 0x07f10699,
560 0x03f01700,
561 0x0009d002,
562 0x0ef404bd,
563/* 0x04f9: chsw_prev_no_next */
575 0xb920f931, 564 0xb920f931,
576 0x32f40212, 565 0x32f40212,
577 0x0232f401, 566 0x0232f401,
578 0x082921f5, 567 0x082f21f5,
579 0x17f120fc, 568 0x17f120fc,
580 0x14b60b00, 569 0x14b60b00,
581 0x0012d006, 570 0x0012d006,
582/* 0x0527: chsw_no_prev */ 571/* 0x0517: chsw_no_prev */
583 0xc8130ef4, 572 0xc8130ef4,
584 0x0bf41f23, 573 0x0bf41f23,
585 0x0131f40d, 574 0x0131f40d,
586 0xf50232f4, 575 0xf50232f4,
587/* 0x0537: chsw_done */ 576/* 0x0527: chsw_done */
588 0xf1082921, 577 0xf1082f21,
589 0xb60b0c17, 578 0xb60b0c17,
590 0x27f00614, 579 0x27f00614,
591 0x0012d001, 580 0x0012d001,
592 0x085c87f1,
593 0xbd0684b6,
594 0x0499f094,
595 0xf50089d0,
596/* 0x0557: main_not_ctx_switch */
597 0xb0ff200e,
598 0x1bf401e4,
599 0x02f2b90d,
600 0x07b521f5,
601/* 0x0567: main_not_ctx_chan */
602 0xb0420ef4,
603 0x1bf402e4,
604 0x3c87f12e,
605 0x0684b608,
606 0x99f094bd, 581 0x99f094bd,
607 0x0089d007, 582 0x0007f104,
583 0x0203f017,
584 0xbd0009d0,
585 0x130ef504,
586/* 0x0549: main_not_ctx_switch */
587 0x01e4b0ff,
588 0xb90d1bf4,
589 0x21f502f2,
590 0x0ef407bb,
591/* 0x0559: main_not_ctx_chan */
592 0x02e4b046,
593 0xbd321bf4,
594 0x0799f094,
595 0x0f0007f1,
596 0xd00203f0,
597 0x04bd0009,
608 0xf40132f4, 598 0xf40132f4,
609 0x21f50232, 599 0x21f50232,
610 0x87f10829, 600 0x94bd082f,
611 0x84b6085c, 601 0xf10799f0,
612 0xf094bd06, 602 0xf0170007,
613 0x89d00799, 603 0x09d00203,
614 0x110ef400, 604 0xf404bd00,
615/* 0x0598: main_not_ctx_save */ 605/* 0x058e: main_not_ctx_save */
616 0xf010ef94, 606 0xef94110e,
617 0x21f501f5, 607 0x01f5f010,
618 0x0ef502ec, 608 0x02fe21f5,
619/* 0x05a6: main_done */ 609 0xfec00ef5,
620 0x17f1fed1, 610/* 0x059c: main_done */
621 0x14b60820, 611 0x29f024bd,
622 0xf024bd06, 612 0x0007f11f,
623 0x12d01f29, 613 0x0203f008,
624 0xbe0ef500, 614 0xbd0002d0,
625/* 0x05b9: ih */ 615 0xab0ef504,
616/* 0x05b1: ih */
626 0xfe80f9fe, 617 0xfe80f9fe,
627 0x80f90188, 618 0x80f90188,
628 0xa0f990f9, 619 0xa0f990f9,
629 0xd0f9b0f9, 620 0xd0f9b0f9,
630 0xf0f9e0f9, 621 0xf0f9e0f9,
631 0xc4800acf, 622 0x0acf04bd,
632 0x0bf404ab, 623 0x04abc480,
633 0x00b7f11d, 624 0xf11d0bf4,
634 0x08d7f019, 625 0xf01900b7,
635 0xcf40becf, 626 0xbecf10d7,
636 0x21f400bf, 627 0x00bfcf40,
637 0x00b0b704, 628 0xb70421f4,
638 0x01e7f004, 629 0xf00400b0,
639/* 0x05ef: ih_no_fifo */ 630 0xbed001e7,
640 0xe400bed0, 631/* 0x05e9: ih_no_fifo */
641 0xf40100ab, 632 0x00abe400,
642 0xd7f00d0b, 633 0x0d0bf401,
643 0x01e7f108, 634 0xf110d7f0,
644 0x0421f440, 635 0xf44001e7,
645/* 0x0600: ih_no_ctxsw */ 636/* 0x05fa: ih_no_ctxsw */
646 0x0104b7f1, 637 0xb7f10421,
647 0xabffb0bd, 638 0xb0bd0104,
648 0x0d0bf4b4, 639 0xf4b4abff,
649 0x0c1ca7f1, 640 0xa7f10d0b,
650 0xd006a4b6, 641 0xa4b60c1c,
651/* 0x0616: ih_no_other */ 642 0x00abd006,
652 0x0ad000ab, 643/* 0x0610: ih_no_other */
653 0xfcf0fc40, 644 0xfc400ad0,
654 0xfcd0fce0, 645 0xfce0fcf0,
655 0xfca0fcb0, 646 0xfcb0fcd0,
656 0xfe80fc90, 647 0xfc90fca0,
657 0x80fc0088, 648 0x0088fe80,
658 0xf80032f4, 649 0x32f480fc,
659/* 0x0631: ctx_4160s */ 650/* 0x062b: ctx_4160s */
660 0x60e7f101, 651 0xf101f800,
661 0x40e3f041, 652 0xf04160e7,
662 0xf401f7f0, 653 0xf7f040e3,
663/* 0x063e: ctx_4160s_wait */ 654 0x8d21f401,
664 0x21f48d21, 655/* 0x0638: ctx_4160s_wait */
665 0x04ffc868, 656 0xc86821f4,
666 0xf8fa0bf4, 657 0x0bf404ff,
667/* 0x0649: ctx_4160c */ 658/* 0x0643: ctx_4160c */
668 0x60e7f100, 659 0xf100f8fa,
660 0xf04160e7,
661 0xf4bd40e3,
662 0xf88d21f4,
663/* 0x0651: ctx_4170s */
664 0x70e7f100,
669 0x40e3f041, 665 0x40e3f041,
670 0x21f4f4bd, 666 0xf410f5f0,
671/* 0x0657: ctx_4170s */
672 0xf100f88d,
673 0xf04170e7,
674 0xf5f040e3,
675 0x8d21f410,
676/* 0x0666: ctx_4170w */
677 0xe7f100f8,
678 0xe3f04170,
679 0x6821f440,
680 0xf410f4f0,
681 0x00f8f31b,
682/* 0x0678: ctx_redswitch */
683 0x0614e7f1,
684 0xf106e4b6,
685 0xd00270f7,
686 0xf7f000ef,
687/* 0x0689: ctx_redswitch_delay */
688 0x01f2b608,
689 0xf1fd1bf4,
690 0xd00770f7,
691 0x00f800ef,
692/* 0x0698: ctx_86c */
693 0x086ce7f1,
694 0xd006e4b6,
695 0xe7f100ef,
696 0xe3f08a14,
697 0x8d21f440,
698 0xa86ce7f1,
699 0xf441e3f0,
700 0x00f88d21, 667 0x00f88d21,
701/* 0x06b8: ctx_load */ 668/* 0x0660: ctx_4170w */
702 0x083c87f1, 669 0x4170e7f1,
703 0xbd0684b6, 670 0xf440e3f0,
704 0x0599f094, 671 0xf4f06821,
705 0xf00089d0, 672 0xf31bf410,
673/* 0x0672: ctx_redswitch */
674 0xe7f100f8,
675 0xe4b60614,
676 0x70f7f106,
677 0x00efd002,
678/* 0x0683: ctx_redswitch_delay */
679 0xb608f7f0,
680 0x1bf401f2,
681 0x70f7f1fd,
682 0x00efd007,
683/* 0x0692: ctx_86c */
684 0xe7f100f8,
685 0xe4b6086c,
686 0x00efd006,
687 0x8a14e7f1,
688 0xf440e3f0,
689 0xe7f18d21,
690 0xe3f0a86c,
691 0x8d21f441,
692/* 0x06b2: ctx_load */
693 0x94bd00f8,
694 0xf10599f0,
695 0xf00f0007,
696 0x09d00203,
697 0xf004bd00,
706 0x21f40ca7, 698 0x21f40ca7,
707 0x2417f1c9, 699 0x2417f1c9,
708 0x0614b60a, 700 0x0614b60a,
@@ -713,168 +705,169 @@ uint32_t nvc0_grhub_code[] = {
713 0x0614b60a, 705 0x0614b60a,
714 0xd00747f0, 706 0xd00747f0,
715 0x14d00012, 707 0x14d00012,
716/* 0x06f1: ctx_chan_wait_0 */ 708/* 0x06ed: ctx_chan_wait_0 */
717 0x4014cf40, 709 0x4014cf40,
718 0xf41f44f0, 710 0xf41f44f0,
719 0x32d0fa1b, 711 0x32d0fa1b,
720 0x000bfe00, 712 0x000bfe00,
721 0xb61f2af0, 713 0xb61f2af0,
722 0x20b60424, 714 0x20b60424,
723 0x3c87f102, 715 0xf094bd02,
724 0x0684b608, 716 0x07f10899,
717 0x03f00f00,
718 0x0009d002,
719 0x17f104bd,
720 0x14b60a04,
721 0x0012d006,
722 0x0a2017f1,
723 0xf00614b6,
724 0x23f10227,
725 0x12d08000,
726 0x1017f000,
727 0x020027f1,
728 0xfa0223f0,
729 0x03f80512,
725 0x99f094bd, 730 0x99f094bd,
726 0x0089d008, 731 0x0007f108,
727 0x0a0417f1, 732 0x0203f017,
728 0xd00614b6, 733 0xbd0009d0,
729 0x17f10012, 734 0x81019804,
730 0x14b60a20,
731 0x0227f006,
732 0x800023f1,
733 0xf00012d0,
734 0x27f11017,
735 0x23f00300,
736 0x0512fa02,
737 0x87f103f8,
738 0x84b6085c,
739 0xf094bd06,
740 0x89d00899,
741 0xc1019800,
742 0x981814b6, 735 0x981814b6,
743 0x25b6c002, 736 0x25b68002,
744 0x0512fd08, 737 0x0512fd08,
745 0xf1160180, 738 0xbd160180,
746 0xb6083c87, 739 0x0999f094,
747 0x94bd0684, 740 0x0f0007f1,
748 0xd00999f0, 741 0xd00203f0,
749 0x27f10089, 742 0x04bd0009,
750 0x24b60a04, 743 0x0a0427f1,
751 0x0021d006, 744 0xd00624b6,
752 0xf10127f0, 745 0x27f00021,
753 0xb60a2017, 746 0x2017f101,
754 0x12d00614, 747 0x0614b60a,
755 0x0017f100, 748 0xf10012d0,
756 0x0613f002, 749 0xf0010017,
757 0xf80501fa,
758 0x5c87f103,
759 0x0684b608,
760 0x99f094bd,
761 0x0089d009,
762 0x085c87f1,
763 0xbd0684b6,
764 0x0599f094,
765 0xf80089d0,
766/* 0x07b5: ctx_chan */
767 0x3121f500,
768 0xb821f506,
769 0x0ca7f006,
770 0xf1c921f4,
771 0xb60a1017,
772 0x27f00614,
773 0x0012d005,
774/* 0x07d0: ctx_chan_wait */
775 0xfd0012cf,
776 0x1bf40522,
777 0x4921f5fa,
778/* 0x07df: ctx_mmio_exec */
779 0x9800f806,
780 0x27f18103,
781 0x24b60a04,
782 0x0023d006,
783/* 0x07ee: ctx_mmio_loop */
784 0x34c434bd,
785 0x0f1bf4ff,
786 0x030057f1,
787 0xfa0653f0,
788 0x03f80535,
789/* 0x0800: ctx_mmio_pull */
790 0x98c04e98,
791 0x21f4c14f,
792 0x0830b68d,
793 0xf40112b6,
794/* 0x0812: ctx_mmio_done */
795 0x0398df1b,
796 0x0023d016,
797 0xf1800080,
798 0xf0020017,
799 0x01fa0613, 750 0x01fa0613,
800 0xf803f806, 751 0xbd03f805,
801/* 0x0829: ctx_xfer */ 752 0x0999f094,
802 0x00f7f100, 753 0x170007f1,
803 0x06f4b60c, 754 0xd00203f0,
804 0xd004e7f0, 755 0x04bd0009,
805/* 0x0836: ctx_xfer_idle */ 756 0x99f094bd,
806 0xfecf80fe, 757 0x0007f105,
807 0x00e4f100, 758 0x0203f017,
808 0xf91bf420, 759 0xbd0009d0,
809 0xf40611f4, 760/* 0x07bb: ctx_chan */
810/* 0x0846: ctx_xfer_pre */ 761 0xf500f804,
811 0xf7f01102, 762 0xf5062b21,
812 0x9821f510, 763 0xf006b221,
813 0x3121f506, 764 0x21f40ca7,
814 0x1c11f406, 765 0x1017f1c9,
815/* 0x0854: ctx_xfer_pre_load */ 766 0x0614b60a,
816 0xf502f7f0, 767 0xd00527f0,
817 0xf5065721, 768/* 0x07d6: ctx_chan_wait */
818 0xf5066621, 769 0x12cf0012,
819 0xbd067821, 770 0x0522fd00,
820 0x5721f5f4, 771 0xf5fa1bf4,
821 0xb821f506, 772 0xf8064321,
822/* 0x086d: ctx_xfer_exec */ 773/* 0x07e5: ctx_mmio_exec */
823 0x16019806, 774 0x41039800,
824 0x041427f1, 775 0x0a0427f1,
825 0xd00624b6, 776 0xd00624b6,
826 0xe7f10020, 777 0x34bd0023,
827 0xe3f0a500, 778/* 0x07f4: ctx_mmio_loop */
828 0x021fb941, 779 0xf4ff34c4,
780 0x57f10f1b,
781 0x53f00200,
782 0x0535fa06,
783/* 0x0806: ctx_mmio_pull */
784 0x4e9803f8,
785 0x814f9880,
829 0xb68d21f4, 786 0xb68d21f4,
830 0xfcf004e0, 787 0x12b60830,
831 0x022cf001, 788 0xdf1bf401,
832 0xfd0124b6, 789/* 0x0818: ctx_mmio_done */
833 0x21f405f2, 790 0xd0160398,
834 0xfc17f18d, 791 0x00800023,
835 0x0213f04a, 792 0x0017f140,
836 0xd00c27f0, 793 0x0613f001,
837 0x21f50012, 794 0xf80601fa,
838 0x27f10207, 795/* 0x082f: ctx_xfer */
839 0x23f047fc, 796 0xf100f803,
840 0x0020d002, 797 0xb60c00f7,
841 0xb6012cf0, 798 0xe7f006f4,
842 0x12d00320, 799 0x80fed004,
843 0x01acf000, 800/* 0x083c: ctx_xfer_idle */
844 0xf006a5f0, 801 0xf100fecf,
845 0x0c9800b7, 802 0xf42000e4,
846 0x150d9814, 803 0x11f4f91b,
847 0xf500e7f0, 804 0x1102f406,
848 0xf0015c21, 805/* 0x084c: ctx_xfer_pre */
849 0x21f508a7, 806 0xf510f7f0,
850 0x21f50103, 807 0xf5069221,
851 0x01f40207, 808 0xf4062b21,
852 0x0ca7f022, 809/* 0x085a: ctx_xfer_pre_load */
853 0xf1c921f4, 810 0xf7f01c11,
854 0xb60a1017, 811 0x5121f502,
855 0x27f00614, 812 0x6021f506,
856 0x0012d005, 813 0x7221f506,
857/* 0x08f4: ctx_xfer_post_save_wait */
858 0xfd0012cf,
859 0x1bf40522,
860 0x3202f4fa,
861/* 0x0900: ctx_xfer_post */
862 0xf502f7f0,
863 0xbd065721,
864 0x9821f5f4,
865 0x2621f506,
866 0x6621f502,
867 0xf5f4bd06, 814 0xf5f4bd06,
868 0xf4065721, 815 0xf5065121,
869 0x01981011, 816/* 0x0873: ctx_xfer_exec */
870 0x0511fd80, 817 0x9806b221,
871 0xf5070bf4, 818 0x27f11601,
872/* 0x092b: ctx_xfer_no_post_mmio */ 819 0x24b60414,
873 0xf507df21, 820 0x0020d006,
874/* 0x092f: ctx_xfer_done */ 821 0xa500e7f1,
875 0xf8064921, 822 0xb941e3f0,
876 0x00000000, 823 0x21f4021f,
877 0x00000000, 824 0x04e0b68d,
825 0xf001fcf0,
826 0x24b6022c,
827 0x05f2fd01,
828 0xf18d21f4,
829 0xf04afc17,
830 0x27f00213,
831 0x0012d00c,
832 0x021521f5,
833 0x47fc27f1,
834 0xd00223f0,
835 0x2cf00020,
836 0x0320b601,
837 0xf00012d0,
838 0xa5f001ac,
839 0x00b7f006,
840 0x98000c98,
841 0xe7f0010d,
842 0x6621f500,
843 0x08a7f001,
844 0x010921f5,
845 0x021521f5,
846 0xf02201f4,
847 0x21f40ca7,
848 0x1017f1c9,
849 0x0614b60a,
850 0xd00527f0,
851/* 0x08fa: ctx_xfer_post_save_wait */
852 0x12cf0012,
853 0x0522fd00,
854 0xf4fa1bf4,
855/* 0x0906: ctx_xfer_post */
856 0xf7f03202,
857 0x5121f502,
858 0xf5f4bd06,
859 0xf5069221,
860 0xf5023421,
861 0xbd066021,
862 0x5121f5f4,
863 0x1011f406,
864 0xfd400198,
865 0x0bf40511,
866 0xe521f507,
867/* 0x0931: ctx_xfer_no_post_mmio */
868 0x4321f507,
869/* 0x0935: ctx_xfer_done */
870 0x0000f806,
878 0x00000000, 871 0x00000000,
879 0x00000000, 872 0x00000000,
880 0x00000000, 873 0x00000000,
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvd7.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvd7.fuc
new file mode 100644
index 000000000000..afbe03ac9077
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvd7.fuc
@@ -0,0 +1,40 @@
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 <bskeggs@redhat.com>
23 */
24
25#define CHIPSET GF117
26#include "macros.fuc"
27
28.section #nvd7_grhub_data
29#define INCLUDE_DATA
30#include "com.fuc"
31#include "hub.fuc"
32#undef INCLUDE_DATA
33
34.section #nvd7_grhub_code
35#define INCLUDE_CODE
36bra #init
37#include "com.fuc"
38#include "hub.fuc"
39.align 256
40#undef INCLUDE_CODE
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvd7.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvd7.fuc.h
new file mode 100644
index 000000000000..a1b9f763996a
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvd7.fuc.h
@@ -0,0 +1,921 @@
1uint32_t nvd7_grhub_data[] = {
2/* 0x0000: hub_mmio_list_head */
3 0x00000300,
4/* 0x0004: hub_mmio_list_tail */
5 0x00000304,
6/* 0x0008: gpc_count */
7 0x00000000,
8/* 0x000c: rop_count */
9 0x00000000,
10/* 0x0010: cmd_queue */
11 0x00000000,
12 0x00000000,
13 0x00000000,
14 0x00000000,
15 0x00000000,
16 0x00000000,
17 0x00000000,
18 0x00000000,
19 0x00000000,
20 0x00000000,
21 0x00000000,
22 0x00000000,
23 0x00000000,
24 0x00000000,
25 0x00000000,
26 0x00000000,
27 0x00000000,
28 0x00000000,
29/* 0x0058: ctx_current */
30 0x00000000,
31 0x00000000,
32 0x00000000,
33 0x00000000,
34 0x00000000,
35 0x00000000,
36 0x00000000,
37 0x00000000,
38 0x00000000,
39 0x00000000,
40 0x00000000,
41 0x00000000,
42 0x00000000,
43 0x00000000,
44 0x00000000,
45 0x00000000,
46 0x00000000,
47 0x00000000,
48 0x00000000,
49 0x00000000,
50 0x00000000,
51 0x00000000,
52 0x00000000,
53 0x00000000,
54 0x00000000,
55 0x00000000,
56 0x00000000,
57 0x00000000,
58 0x00000000,
59 0x00000000,
60 0x00000000,
61 0x00000000,
62 0x00000000,
63 0x00000000,
64 0x00000000,
65 0x00000000,
66 0x00000000,
67 0x00000000,
68 0x00000000,
69 0x00000000,
70 0x00000000,
71 0x00000000,
72/* 0x0100: chan_data */
73/* 0x0100: chan_mmio_count */
74 0x00000000,
75/* 0x0104: chan_mmio_address */
76 0x00000000,
77 0x00000000,
78 0x00000000,
79 0x00000000,
80 0x00000000,
81 0x00000000,
82 0x00000000,
83 0x00000000,
84 0x00000000,
85 0x00000000,
86 0x00000000,
87 0x00000000,
88 0x00000000,
89 0x00000000,
90 0x00000000,
91 0x00000000,
92 0x00000000,
93 0x00000000,
94 0x00000000,
95 0x00000000,
96 0x00000000,
97 0x00000000,
98 0x00000000,
99 0x00000000,
100 0x00000000,
101 0x00000000,
102 0x00000000,
103 0x00000000,
104 0x00000000,
105 0x00000000,
106 0x00000000,
107 0x00000000,
108 0x00000000,
109 0x00000000,
110 0x00000000,
111 0x00000000,
112 0x00000000,
113 0x00000000,
114 0x00000000,
115 0x00000000,
116 0x00000000,
117 0x00000000,
118 0x00000000,
119 0x00000000,
120 0x00000000,
121 0x00000000,
122 0x00000000,
123 0x00000000,
124 0x00000000,
125 0x00000000,
126 0x00000000,
127 0x00000000,
128 0x00000000,
129 0x00000000,
130 0x00000000,
131 0x00000000,
132 0x00000000,
133 0x00000000,
134 0x00000000,
135 0x00000000,
136 0x00000000,
137 0x00000000,
138 0x00000000,
139/* 0x0200: xfer_data */
140 0x00000000,
141 0x00000000,
142 0x00000000,
143 0x00000000,
144 0x00000000,
145 0x00000000,
146 0x00000000,
147 0x00000000,
148 0x00000000,
149 0x00000000,
150 0x00000000,
151 0x00000000,
152 0x00000000,
153 0x00000000,
154 0x00000000,
155 0x00000000,
156 0x00000000,
157 0x00000000,
158 0x00000000,
159 0x00000000,
160 0x00000000,
161 0x00000000,
162 0x00000000,
163 0x00000000,
164 0x00000000,
165 0x00000000,
166 0x00000000,
167 0x00000000,
168 0x00000000,
169 0x00000000,
170 0x00000000,
171 0x00000000,
172 0x00000000,
173 0x00000000,
174 0x00000000,
175 0x00000000,
176 0x00000000,
177 0x00000000,
178 0x00000000,
179 0x00000000,
180 0x00000000,
181 0x00000000,
182 0x00000000,
183 0x00000000,
184 0x00000000,
185 0x00000000,
186 0x00000000,
187 0x00000000,
188 0x00000000,
189 0x00000000,
190 0x00000000,
191 0x00000000,
192 0x00000000,
193 0x00000000,
194 0x00000000,
195 0x00000000,
196 0x00000000,
197 0x00000000,
198 0x00000000,
199 0x00000000,
200 0x00000000,
201 0x00000000,
202 0x00000000,
203 0x00000000,
204/* 0x0300: hub_mmio_list_base */
205 0x0417e91c,
206};
207
208uint32_t nvd7_grhub_code[] = {
209 0x031b0ef5,
210/* 0x0004: queue_put */
211 0x9800d898,
212 0x86f001d9,
213 0x0489b808,
214 0xf00c1bf4,
215 0x21f502f7,
216 0x00f802fe,
217/* 0x001c: queue_put_next */
218 0xb60798c4,
219 0x8dbb0384,
220 0x0880b600,
221 0x80008e80,
222 0x90b6018f,
223 0x0f94f001,
224 0xf801d980,
225/* 0x0039: queue_get */
226 0x0131f400,
227 0x9800d898,
228 0x89b801d9,
229 0x210bf404,
230 0xb60789c4,
231 0x9dbb0394,
232 0x0890b600,
233 0x98009e98,
234 0x80b6019f,
235 0x0f84f001,
236 0xf400d880,
237/* 0x0066: queue_get_done */
238 0x00f80132,
239/* 0x0068: nv_rd32 */
240 0x0728b7f1,
241 0xb906b4b6,
242 0xc9f002ec,
243 0x00bcd01f,
244/* 0x0078: nv_rd32_wait */
245 0xc800bccf,
246 0x1bf41fcc,
247 0x06a7f0fa,
248 0x010921f5,
249 0xf840bfcf,
250/* 0x008d: nv_wr32 */
251 0x28b7f100,
252 0x06b4b607,
253 0xb980bfd0,
254 0xc9f002ec,
255 0x1ec9f01f,
256/* 0x00a3: nv_wr32_wait */
257 0xcf00bcd0,
258 0xccc800bc,
259 0xfa1bf41f,
260/* 0x00ae: watchdog_reset */
261 0x87f100f8,
262 0x84b60430,
263 0x1ff9f006,
264 0xf8008fd0,
265/* 0x00bd: watchdog_clear */
266 0x3087f100,
267 0x0684b604,
268 0xf80080d0,
269/* 0x00c9: wait_donez */
270 0xf094bd00,
271 0x07f10099,
272 0x03f00f00,
273 0x0009d002,
274 0x07f104bd,
275 0x03f00600,
276 0x000ad002,
277/* 0x00e6: wait_donez_ne */
278 0x87f104bd,
279 0x83f00000,
280 0x0088cf01,
281 0xf4888aff,
282 0x94bdf31b,
283 0xf10099f0,
284 0xf0170007,
285 0x09d00203,
286 0xf804bd00,
287/* 0x0109: wait_doneo */
288 0xf094bd00,
289 0x07f10099,
290 0x03f00f00,
291 0x0009d002,
292 0x87f104bd,
293 0x84b60818,
294 0x008ad006,
295/* 0x0124: wait_doneo_e */
296 0x040087f1,
297 0xcf0684b6,
298 0x8aff0088,
299 0xf30bf488,
300 0x99f094bd,
301 0x0007f100,
302 0x0203f017,
303 0xbd0009d0,
304/* 0x0147: mmctx_size */
305 0xbd00f804,
306/* 0x0149: nv_mmctx_size_loop */
307 0x00e89894,
308 0xb61a85b6,
309 0x84b60180,
310 0x0098bb02,
311 0xb804e0b6,
312 0x1bf404ef,
313 0x029fb9eb,
314/* 0x0166: mmctx_xfer */
315 0x94bd00f8,
316 0xf10199f0,
317 0xf00f0007,
318 0x09d00203,
319 0xf104bd00,
320 0xb6071087,
321 0x94bd0684,
322 0xf405bbfd,
323 0x8bd0090b,
324 0x0099f000,
325/* 0x018c: mmctx_base_disabled */
326 0xf405eefd,
327 0x8ed00c0b,
328 0xc08fd080,
329/* 0x019b: mmctx_multi_disabled */
330 0xb70199f0,
331 0xc8010080,
332 0xb4b600ab,
333 0x0cb9f010,
334 0xb601aec8,
335 0xbefd11e4,
336 0x008bd005,
337/* 0x01b4: mmctx_exec_loop */
338/* 0x01b4: mmctx_wait_free */
339 0xf0008ecf,
340 0x0bf41fe4,
341 0x00ce98fa,
342 0xd005e9fd,
343 0xc0b6c08e,
344 0x04cdb804,
345 0xc8e81bf4,
346 0x1bf402ab,
347/* 0x01d5: mmctx_fini_wait */
348 0x008bcf18,
349 0xb01fb4f0,
350 0x1bf410b4,
351 0x02a7f0f7,
352 0xf4c921f4,
353/* 0x01ea: mmctx_stop */
354 0xabc81b0e,
355 0x10b4b600,
356 0xf00cb9f0,
357 0x8bd012b9,
358/* 0x01f9: mmctx_stop_wait */
359 0x008bcf00,
360 0xf412bbc8,
361/* 0x0202: mmctx_done */
362 0x94bdfa1b,
363 0xf10199f0,
364 0xf0170007,
365 0x09d00203,
366 0xf804bd00,
367/* 0x0215: strand_wait */
368 0xf0a0f900,
369 0x21f402a7,
370 0xf8a0fcc9,
371/* 0x0221: strand_pre */
372 0xfc87f100,
373 0x0283f04a,
374 0xd00c97f0,
375 0x21f50089,
376 0x00f80215,
377/* 0x0234: strand_post */
378 0x4afc87f1,
379 0xf00283f0,
380 0x89d00d97,
381 0x1521f500,
382/* 0x0247: strand_set */
383 0xf100f802,
384 0xf04ffca7,
385 0xaba202a3,
386 0xc7f00500,
387 0x00acd00f,
388 0xd00bc7f0,
389 0x21f500bc,
390 0xaed00215,
391 0x0ac7f000,
392 0xf500bcd0,
393 0xf8021521,
394/* 0x0271: strand_ctx_init */
395 0xf094bd00,
396 0x07f10399,
397 0x03f00f00,
398 0x0009d002,
399 0x21f504bd,
400 0xe7f00221,
401 0x4721f503,
402 0xfca7f102,
403 0x02a3f046,
404 0x0400aba0,
405 0xf040a0d0,
406 0xbcd001c7,
407 0x1521f500,
408 0x010c9202,
409 0xf000acd0,
410 0xbcd002c7,
411 0x1521f500,
412 0x3421f502,
413 0x8087f102,
414 0x0684b608,
415 0xb70089cf,
416 0x95220080,
417/* 0x02ca: ctx_init_strand_loop */
418 0x8ed008fe,
419 0x408ed000,
420 0xb6808acf,
421 0xa0b606a5,
422 0x00eabb01,
423 0xb60480b6,
424 0x1bf40192,
425 0x08e4b6e8,
426 0xbdf2efbc,
427 0x0399f094,
428 0x170007f1,
429 0xd00203f0,
430 0x04bd0009,
431/* 0x02fe: error */
432 0x07f100f8,
433 0x03f00500,
434 0x000fd002,
435 0xf7f004bd,
436 0x0007f101,
437 0x0303f007,
438 0xbd000fd0,
439/* 0x031b: init */
440 0xbd00f804,
441 0x0004fe04,
442 0xf10007fe,
443 0xf0120017,
444 0x12d00227,
445 0xb117f100,
446 0x0010fe05,
447 0x040017f1,
448 0xf1c010d0,
449 0xb6040437,
450 0x27f10634,
451 0x32d02003,
452 0x0427f100,
453 0x0132d020,
454 0x200b27f1,
455 0xf10232d0,
456 0xd0200c27,
457 0x27f10732,
458 0x24b60c24,
459 0x0003b906,
460 0xf10023d0,
461 0xf0870427,
462 0x12d00023,
463 0x0012b700,
464 0x0427f001,
465 0xf40012d0,
466 0xe7f11031,
467 0xe3f09604,
468 0x6821f440,
469 0x8090f1c7,
470 0xf4f00301,
471 0x020f801f,
472 0xbb0117f0,
473 0x12b6041f,
474 0x0c27f101,
475 0x0624b604,
476 0xd00021d0,
477 0x17f14021,
478 0x0e980100,
479 0x010f9800,
480 0x014721f5,
481 0x070037f1,
482 0x950634b6,
483 0x34d00814,
484 0x4034d000,
485 0x130030b7,
486 0xb6001fbb,
487 0x3fd002f5,
488 0x0815b600,
489 0xb60110b6,
490 0x1fb90814,
491 0x7121f502,
492 0x001fbb02,
493 0xf1020398,
494 0xf0200047,
495/* 0x03f6: init_gpc */
496 0x4ea05043,
497 0x1fb90804,
498 0x8d21f402,
499 0x010c4ea0,
500 0x21f4f4bd,
501 0x044ea08d,
502 0x8d21f401,
503 0x01004ea0,
504 0xf402f7f0,
505 0x4ea08d21,
506/* 0x041e: init_gpc_wait */
507 0x21f40800,
508 0x1fffc868,
509 0xa0fa0bf4,
510 0xf408044e,
511 0x1fbb6821,
512 0x0040b700,
513 0x0132b680,
514 0xf1be1bf4,
515 0xf0010007,
516 0x01d00203,
517 0xbd04bd00,
518 0x1f19f014,
519 0x080007f1,
520 0xd00203f0,
521 0x04bd0001,
522/* 0x0458: main */
523 0xf40031f4,
524 0xd7f00028,
525 0x3921f410,
526 0xb1f401f4,
527 0xf54001e4,
528 0xbd00de1b,
529 0x0499f094,
530 0x0f0007f1,
531 0xd00203f0,
532 0x04bd0009,
533 0x0b0017f1,
534 0xcf0614b6,
535 0x11cf4012,
536 0x1f13c800,
537 0x00870bf5,
538 0xf41f23c8,
539 0x20f9620b,
540 0xbd0212b9,
541 0x0799f094,
542 0x0f0007f1,
543 0xd00203f0,
544 0x04bd0009,
545 0xf40132f4,
546 0x21f50231,
547 0x94bd082f,
548 0xf10799f0,
549 0xf0170007,
550 0x09d00203,
551 0xfc04bd00,
552 0xf094bd20,
553 0x07f10699,
554 0x03f00f00,
555 0x0009d002,
556 0x31f404bd,
557 0x2f21f501,
558 0xf094bd08,
559 0x07f10699,
560 0x03f01700,
561 0x0009d002,
562 0x0ef404bd,
563/* 0x04f9: chsw_prev_no_next */
564 0xb920f931,
565 0x32f40212,
566 0x0232f401,
567 0x082f21f5,
568 0x17f120fc,
569 0x14b60b00,
570 0x0012d006,
571/* 0x0517: chsw_no_prev */
572 0xc8130ef4,
573 0x0bf41f23,
574 0x0131f40d,
575 0xf50232f4,
576/* 0x0527: chsw_done */
577 0xf1082f21,
578 0xb60b0c17,
579 0x27f00614,
580 0x0012d001,
581 0x99f094bd,
582 0x0007f104,
583 0x0203f017,
584 0xbd0009d0,
585 0x130ef504,
586/* 0x0549: main_not_ctx_switch */
587 0x01e4b0ff,
588 0xb90d1bf4,
589 0x21f502f2,
590 0x0ef407bb,
591/* 0x0559: main_not_ctx_chan */
592 0x02e4b046,
593 0xbd321bf4,
594 0x0799f094,
595 0x0f0007f1,
596 0xd00203f0,
597 0x04bd0009,
598 0xf40132f4,
599 0x21f50232,
600 0x94bd082f,
601 0xf10799f0,
602 0xf0170007,
603 0x09d00203,
604 0xf404bd00,
605/* 0x058e: main_not_ctx_save */
606 0xef94110e,
607 0x01f5f010,
608 0x02fe21f5,
609 0xfec00ef5,
610/* 0x059c: main_done */
611 0x29f024bd,
612 0x0007f11f,
613 0x0203f008,
614 0xbd0002d0,
615 0xab0ef504,
616/* 0x05b1: ih */
617 0xfe80f9fe,
618 0x80f90188,
619 0xa0f990f9,
620 0xd0f9b0f9,
621 0xf0f9e0f9,
622 0x0acf04bd,
623 0x04abc480,
624 0xf11d0bf4,
625 0xf01900b7,
626 0xbecf10d7,
627 0x00bfcf40,
628 0xb70421f4,
629 0xf00400b0,
630 0xbed001e7,
631/* 0x05e9: ih_no_fifo */
632 0x00abe400,
633 0x0d0bf401,
634 0xf110d7f0,
635 0xf44001e7,
636/* 0x05fa: ih_no_ctxsw */
637 0xb7f10421,
638 0xb0bd0104,
639 0xf4b4abff,
640 0xa7f10d0b,
641 0xa4b60c1c,
642 0x00abd006,
643/* 0x0610: ih_no_other */
644 0xfc400ad0,
645 0xfce0fcf0,
646 0xfcb0fcd0,
647 0xfc90fca0,
648 0x0088fe80,
649 0x32f480fc,
650/* 0x062b: ctx_4160s */
651 0xf101f800,
652 0xf04160e7,
653 0xf7f040e3,
654 0x8d21f401,
655/* 0x0638: ctx_4160s_wait */
656 0xc86821f4,
657 0x0bf404ff,
658/* 0x0643: ctx_4160c */
659 0xf100f8fa,
660 0xf04160e7,
661 0xf4bd40e3,
662 0xf88d21f4,
663/* 0x0651: ctx_4170s */
664 0x70e7f100,
665 0x40e3f041,
666 0xf410f5f0,
667 0x00f88d21,
668/* 0x0660: ctx_4170w */
669 0x4170e7f1,
670 0xf440e3f0,
671 0xf4f06821,
672 0xf31bf410,
673/* 0x0672: ctx_redswitch */
674 0xe7f100f8,
675 0xe4b60614,
676 0x70f7f106,
677 0x00efd002,
678/* 0x0683: ctx_redswitch_delay */
679 0xb608f7f0,
680 0x1bf401f2,
681 0x70f7f1fd,
682 0x00efd007,
683/* 0x0692: ctx_86c */
684 0xe7f100f8,
685 0xe4b6086c,
686 0x00efd006,
687 0x8a14e7f1,
688 0xf440e3f0,
689 0xe7f18d21,
690 0xe3f0a86c,
691 0x8d21f441,
692/* 0x06b2: ctx_load */
693 0x94bd00f8,
694 0xf10599f0,
695 0xf00f0007,
696 0x09d00203,
697 0xf004bd00,
698 0x21f40ca7,
699 0x2417f1c9,
700 0x0614b60a,
701 0xf10010d0,
702 0xb60b0037,
703 0x32d00634,
704 0x0c17f140,
705 0x0614b60a,
706 0xd00747f0,
707 0x14d00012,
708/* 0x06ed: ctx_chan_wait_0 */
709 0x4014cf40,
710 0xf41f44f0,
711 0x32d0fa1b,
712 0x000bfe00,
713 0xb61f2af0,
714 0x20b60424,
715 0xf094bd02,
716 0x07f10899,
717 0x03f00f00,
718 0x0009d002,
719 0x17f104bd,
720 0x14b60a04,
721 0x0012d006,
722 0x0a2017f1,
723 0xf00614b6,
724 0x23f10227,
725 0x12d08000,
726 0x1017f000,
727 0x020027f1,
728 0xfa0223f0,
729 0x03f80512,
730 0x99f094bd,
731 0x0007f108,
732 0x0203f017,
733 0xbd0009d0,
734 0x81019804,
735 0x981814b6,
736 0x25b68002,
737 0x0512fd08,
738 0xbd160180,
739 0x0999f094,
740 0x0f0007f1,
741 0xd00203f0,
742 0x04bd0009,
743 0x0a0427f1,
744 0xd00624b6,
745 0x27f00021,
746 0x2017f101,
747 0x0614b60a,
748 0xf10012d0,
749 0xf0010017,
750 0x01fa0613,
751 0xbd03f805,
752 0x0999f094,
753 0x170007f1,
754 0xd00203f0,
755 0x04bd0009,
756 0x99f094bd,
757 0x0007f105,
758 0x0203f017,
759 0xbd0009d0,
760/* 0x07bb: ctx_chan */
761 0xf500f804,
762 0xf5062b21,
763 0xf006b221,
764 0x21f40ca7,
765 0x1017f1c9,
766 0x0614b60a,
767 0xd00527f0,
768/* 0x07d6: ctx_chan_wait */
769 0x12cf0012,
770 0x0522fd00,
771 0xf5fa1bf4,
772 0xf8064321,
773/* 0x07e5: ctx_mmio_exec */
774 0x41039800,
775 0x0a0427f1,
776 0xd00624b6,
777 0x34bd0023,
778/* 0x07f4: ctx_mmio_loop */
779 0xf4ff34c4,
780 0x57f10f1b,
781 0x53f00200,
782 0x0535fa06,
783/* 0x0806: ctx_mmio_pull */
784 0x4e9803f8,
785 0x814f9880,
786 0xb68d21f4,
787 0x12b60830,
788 0xdf1bf401,
789/* 0x0818: ctx_mmio_done */
790 0xd0160398,
791 0x00800023,
792 0x0017f140,
793 0x0613f001,
794 0xf80601fa,
795/* 0x082f: ctx_xfer */
796 0xf100f803,
797 0xb60c00f7,
798 0xe7f006f4,
799 0x80fed004,
800/* 0x083c: ctx_xfer_idle */
801 0xf100fecf,
802 0xf42000e4,
803 0x11f4f91b,
804 0x1102f406,
805/* 0x084c: ctx_xfer_pre */
806 0xf510f7f0,
807 0xf5069221,
808 0xf4062b21,
809/* 0x085a: ctx_xfer_pre_load */
810 0xf7f01c11,
811 0x5121f502,
812 0x6021f506,
813 0x7221f506,
814 0xf5f4bd06,
815 0xf5065121,
816/* 0x0873: ctx_xfer_exec */
817 0x9806b221,
818 0x27f11601,
819 0x24b60414,
820 0x0020d006,
821 0xa500e7f1,
822 0xb941e3f0,
823 0x21f4021f,
824 0x04e0b68d,
825 0xf001fcf0,
826 0x24b6022c,
827 0x05f2fd01,
828 0xf18d21f4,
829 0xf04afc17,
830 0x27f00213,
831 0x0012d00c,
832 0x021521f5,
833 0x47fc27f1,
834 0xd00223f0,
835 0x2cf00020,
836 0x0320b601,
837 0xf00012d0,
838 0xa5f001ac,
839 0x00b7f006,
840 0x98000c98,
841 0xe7f0010d,
842 0x6621f500,
843 0x08a7f001,
844 0x010921f5,
845 0x021521f5,
846 0xf02201f4,
847 0x21f40ca7,
848 0x1017f1c9,
849 0x0614b60a,
850 0xd00527f0,
851/* 0x08fa: ctx_xfer_post_save_wait */
852 0x12cf0012,
853 0x0522fd00,
854 0xf4fa1bf4,
855/* 0x0906: ctx_xfer_post */
856 0xf7f03202,
857 0x5121f502,
858 0xf5f4bd06,
859 0xf5069221,
860 0xf5023421,
861 0xbd066021,
862 0x5121f5f4,
863 0x1011f406,
864 0xfd400198,
865 0x0bf40511,
866 0xe521f507,
867/* 0x0931: ctx_xfer_no_post_mmio */
868 0x4321f507,
869/* 0x0935: ctx_xfer_done */
870 0x0000f806,
871 0x00000000,
872 0x00000000,
873 0x00000000,
874 0x00000000,
875 0x00000000,
876 0x00000000,
877 0x00000000,
878 0x00000000,
879 0x00000000,
880 0x00000000,
881 0x00000000,
882 0x00000000,
883 0x00000000,
884 0x00000000,
885 0x00000000,
886 0x00000000,
887 0x00000000,
888 0x00000000,
889 0x00000000,
890 0x00000000,
891 0x00000000,
892 0x00000000,
893 0x00000000,
894 0x00000000,
895 0x00000000,
896 0x00000000,
897 0x00000000,
898 0x00000000,
899 0x00000000,
900 0x00000000,
901 0x00000000,
902 0x00000000,
903 0x00000000,
904 0x00000000,
905 0x00000000,
906 0x00000000,
907 0x00000000,
908 0x00000000,
909 0x00000000,
910 0x00000000,
911 0x00000000,
912 0x00000000,
913 0x00000000,
914 0x00000000,
915 0x00000000,
916 0x00000000,
917 0x00000000,
918 0x00000000,
919 0x00000000,
920 0x00000000,
921};
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc
index 7fe9d7cf486b..d4840f1879fd 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc
@@ -1,6 +1,5 @@
1/* fuc microcode for nve0 PGRAPH/HUB 1/*
2 * 2 * Copyright 2013 Red Hat Inc.
3 * Copyright 2011 Red Hat Inc.
4 * 3 *
5 * Permission is hereby granted, free of charge, to any person obtaining a 4 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"), 5 * copy of this software and associated documentation files (the "Software"),
@@ -20,774 +19,22 @@
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 * OTHER DEALINGS IN THE SOFTWARE. 20 * OTHER DEALINGS IN THE SOFTWARE.
22 * 21 *
23 * Authors: Ben Skeggs 22 * Authors: Ben Skeggs <bskeggs@redhat.com>
24 */ 23 */
25 24
26/* To build: 25#define CHIPSET GK100
27 * m4 nve0_grhub.fuc | envyas -a -w -m fuc -V nva3 -o nve0_grhub.fuc.h 26#include "macros.fuc"
28 */
29 27
30.section #nve0_grhub_data 28.section #nve0_grhub_data
31include(`nve0.fuc') 29#define INCLUDE_DATA
32gpc_count: .b32 0 30#include "com.fuc"
33rop_count: .b32 0 31#include "hub.fuc"
34cmd_queue: queue_init 32#undef INCLUDE_DATA
35hub_mmio_list_head: .b32 0
36hub_mmio_list_tail: .b32 0
37
38ctx_current: .b32 0
39
40chipsets:
41.b8 0xe4 0 0 0
42.b16 #nve4_hub_mmio_head
43.b16 #nve4_hub_mmio_tail
44.b8 0xe7 0 0 0
45.b16 #nve4_hub_mmio_head
46.b16 #nve4_hub_mmio_tail
47.b8 0xe6 0 0 0
48.b16 #nve4_hub_mmio_head
49.b16 #nve4_hub_mmio_tail
50.b8 0 0 0 0
51
52nve4_hub_mmio_head:
53mmctx_data(0x17e91c, 2)
54mmctx_data(0x400204, 2)
55mmctx_data(0x404010, 7)
56mmctx_data(0x4040a8, 9)
57mmctx_data(0x4040d0, 7)
58mmctx_data(0x4040f8, 1)
59mmctx_data(0x404130, 3)
60mmctx_data(0x404150, 3)
61mmctx_data(0x404164, 1)
62mmctx_data(0x4041a0, 4)
63mmctx_data(0x404200, 4)
64mmctx_data(0x404404, 14)
65mmctx_data(0x404460, 4)
66mmctx_data(0x404480, 1)
67mmctx_data(0x404498, 1)
68mmctx_data(0x404604, 4)
69mmctx_data(0x404618, 4)
70mmctx_data(0x40462c, 2)
71mmctx_data(0x404640, 1)
72mmctx_data(0x404654, 1)
73mmctx_data(0x404660, 1)
74mmctx_data(0x404678, 19)
75mmctx_data(0x4046c8, 3)
76mmctx_data(0x404700, 3)
77mmctx_data(0x404718, 10)
78mmctx_data(0x404744, 2)
79mmctx_data(0x404754, 1)
80mmctx_data(0x405800, 1)
81mmctx_data(0x405830, 3)
82mmctx_data(0x405854, 1)
83mmctx_data(0x405870, 4)
84mmctx_data(0x405a00, 2)
85mmctx_data(0x405a18, 1)
86mmctx_data(0x405b00, 1)
87mmctx_data(0x405b10, 1)
88mmctx_data(0x406020, 1)
89mmctx_data(0x406028, 4)
90mmctx_data(0x4064a8, 2)
91mmctx_data(0x4064b4, 2)
92mmctx_data(0x4064c0, 12)
93mmctx_data(0x4064fc, 1)
94mmctx_data(0x407040, 1)
95mmctx_data(0x407804, 1)
96mmctx_data(0x40780c, 6)
97mmctx_data(0x4078bc, 1)
98mmctx_data(0x408000, 7)
99mmctx_data(0x408064, 1)
100mmctx_data(0x408800, 3)
101mmctx_data(0x408840, 1)
102mmctx_data(0x408900, 3)
103mmctx_data(0x408980, 1)
104nve4_hub_mmio_tail:
105
106.align 256
107chan_data:
108chan_mmio_count: .b32 0
109chan_mmio_address: .b32 0
110
111.align 256
112xfer_data: .b32 0
113 33
114.section #nve0_grhub_code 34.section #nve0_grhub_code
35#define INCLUDE_CODE
115bra #init 36bra #init
116define(`include_code') 37#include "com.fuc"
117include(`nve0.fuc') 38#include "hub.fuc"
118
119// reports an exception to the host
120//
121// In: $r15 error code (see nve0.fuc)
122//
123error:
124 push $r14
125 mov $r14 0x814
126 shl b32 $r14 6
127 iowr I[$r14 + 0x000] $r15 // CC_SCRATCH[5] = error code
128 mov $r14 0xc1c
129 shl b32 $r14 6
130 mov $r15 1
131 iowr I[$r14 + 0x000] $r15 // INTR_UP_SET
132 pop $r14
133 ret
134
135// HUB fuc initialisation, executed by triggering ucode start, will
136// fall through to main loop after completion.
137//
138// Input:
139// CC_SCRATCH[0]: chipset (PMC_BOOT_0 read returns 0x0bad0bad... sigh)
140//
141// Output:
142// CC_SCRATCH[0]:
143// 31:31: set to signal completion
144// CC_SCRATCH[1]:
145// 31:0: total PGRAPH context size
146//
147init:
148 clear b32 $r0
149 mov $sp $r0
150 mov $xdbase $r0
151
152 // enable fifo access
153 mov $r1 0x1200
154 mov $r2 2
155 iowr I[$r1 + 0x000] $r2 // FIFO_ENABLE
156
157 // setup i0 handler, and route all interrupts to it
158 mov $r1 #ih
159 mov $iv0 $r1
160 mov $r1 0x400
161 iowr I[$r1 + 0x300] $r0 // INTR_DISPATCH
162
163 // route HUB_CHANNEL_SWITCH to fuc interrupt 8
164 mov $r3 0x404
165 shl b32 $r3 6
166 mov $r2 0x2003 // { HUB_CHANNEL_SWITCH, ZERO } -> intr 8
167 iowr I[$r3 + 0x000] $r2
168
169 // not sure what these are, route them because NVIDIA does, and
170 // the IRQ handler will signal the host if we ever get one.. we
171 // may find out if/why we need to handle these if so..
172 //
173 mov $r2 0x2004
174 iowr I[$r3 + 0x004] $r2 // { 0x04, ZERO } -> intr 9
175 mov $r2 0x200b
176 iowr I[$r3 + 0x008] $r2 // { 0x0b, ZERO } -> intr 10
177 mov $r2 0x200c
178 iowr I[$r3 + 0x01c] $r2 // { 0x0c, ZERO } -> intr 15
179
180 // enable all INTR_UP interrupts
181 mov $r2 0xc24
182 shl b32 $r2 6
183 not b32 $r3 $r0
184 iowr I[$r2] $r3
185
186 // enable fifo, ctxsw, 9, 10, 15 interrupts
187 mov $r2 -0x78fc // 0x8704
188 sethi $r2 0
189 iowr I[$r1 + 0x000] $r2 // INTR_EN_SET
190
191 // fifo level triggered, rest edge
192 sub b32 $r1 0x100
193 mov $r2 4
194 iowr I[$r1] $r2
195
196 // enable interrupts
197 bset $flags ie0
198
199 // fetch enabled GPC/ROP counts
200 mov $r14 -0x69fc // 0x409604
201 sethi $r14 0x400000
202 call #nv_rd32
203 extr $r1 $r15 16:20
204 st b32 D[$r0 + #rop_count] $r1
205 and $r15 0x1f
206 st b32 D[$r0 + #gpc_count] $r15
207
208 // set BAR_REQMASK to GPC mask
209 mov $r1 1
210 shl b32 $r1 $r15
211 sub b32 $r1 1
212 mov $r2 0x40c
213 shl b32 $r2 6
214 iowr I[$r2 + 0x000] $r1
215 iowr I[$r2 + 0x100] $r1
216
217 // find context data for this chipset
218 mov $r2 0x800
219 shl b32 $r2 6
220 iord $r2 I[$r2 + 0x000] // CC_SCRATCH[0]
221 mov $r15 #chipsets - 8
222 init_find_chipset:
223 add b32 $r15 8
224 ld b32 $r3 D[$r15 + 0x00]
225 cmpu b32 $r3 $r2
226 bra e #init_context
227 cmpu b32 $r3 0
228 bra ne #init_find_chipset
229 // unknown chipset
230 ret
231
232 // context size calculation, reserve first 256 bytes for use by fuc
233 init_context:
234 mov $r1 256
235
236 // calculate size of mmio context data
237 ld b16 $r14 D[$r15 + 4]
238 ld b16 $r15 D[$r15 + 6]
239 sethi $r14 0
240 st b32 D[$r0 + #hub_mmio_list_head] $r14
241 st b32 D[$r0 + #hub_mmio_list_tail] $r15
242 call #mmctx_size
243
244 // set mmctx base addresses now so we don't have to do it later,
245 // they don't (currently) ever change
246 mov $r3 0x700
247 shl b32 $r3 6
248 shr b32 $r4 $r1 8
249 iowr I[$r3 + 0x000] $r4 // MMCTX_SAVE_SWBASE
250 iowr I[$r3 + 0x100] $r4 // MMCTX_LOAD_SWBASE
251 add b32 $r3 0x1300
252 add b32 $r1 $r15
253 shr b32 $r15 2
254 iowr I[$r3 + 0x000] $r15 // MMCTX_LOAD_COUNT, wtf for?!?
255
256 // strands, base offset needs to be aligned to 256 bytes
257 shr b32 $r1 8
258 add b32 $r1 1
259 shl b32 $r1 8
260 mov b32 $r15 $r1
261 call #strand_ctx_init
262 add b32 $r1 $r15
263
264 // initialise each GPC in sequence by passing in the offset of its
265 // context data in GPCn_CC_SCRATCH[1], and starting its FUC (which
266 // has previously been uploaded by the host) running.
267 //
268 // the GPC fuc init sequence will set GPCn_CC_SCRATCH[0] bit 31
269 // when it has completed, and return the size of its context data
270 // in GPCn_CC_SCRATCH[1]
271 //
272 ld b32 $r3 D[$r0 + #gpc_count]
273 mov $r4 0x2000
274 sethi $r4 0x500000
275 init_gpc:
276 // setup, and start GPC ucode running
277 add b32 $r14 $r4 0x804
278 mov b32 $r15 $r1
279 call #nv_wr32 // CC_SCRATCH[1] = ctx offset
280 add b32 $r14 $r4 0x800
281 mov b32 $r15 $r2
282 call #nv_wr32 // CC_SCRATCH[0] = chipset
283 add b32 $r14 $r4 0x10c
284 clear b32 $r15
285 call #nv_wr32
286 add b32 $r14 $r4 0x104
287 call #nv_wr32 // ENTRY
288 add b32 $r14 $r4 0x100
289 mov $r15 2 // CTRL_START_TRIGGER
290 call #nv_wr32 // CTRL
291
292 // wait for it to complete, and adjust context size
293 add b32 $r14 $r4 0x800
294 init_gpc_wait:
295 call #nv_rd32
296 xbit $r15 $r15 31
297 bra e #init_gpc_wait
298 add b32 $r14 $r4 0x804
299 call #nv_rd32
300 add b32 $r1 $r15
301
302 // next!
303 add b32 $r4 0x8000
304 sub b32 $r3 1
305 bra ne #init_gpc
306
307 // save context size, and tell host we're ready
308 mov $r2 0x800
309 shl b32 $r2 6
310 iowr I[$r2 + 0x100] $r1 // CC_SCRATCH[1] = context size
311 add b32 $r2 0x800
312 clear b32 $r1
313 bset $r1 31
314 iowr I[$r2 + 0x000] $r1 // CC_SCRATCH[0] |= 0x80000000
315
316// Main program loop, very simple, sleeps until woken up by the interrupt
317// handler, pulls a command from the queue and executes its handler
318//
319main:
320 // sleep until we have something to do
321 bset $flags $p0
322 sleep $p0
323 mov $r13 #cmd_queue
324 call #queue_get
325 bra $p1 #main
326
327 // context switch, requested by GPU?
328 cmpu b32 $r14 0x4001
329 bra ne #main_not_ctx_switch
330 trace_set(T_AUTO)
331 mov $r1 0xb00
332 shl b32 $r1 6
333 iord $r2 I[$r1 + 0x100] // CHAN_NEXT
334 iord $r1 I[$r1 + 0x000] // CHAN_CUR
335
336 xbit $r3 $r1 31
337 bra e #chsw_no_prev
338 xbit $r3 $r2 31
339 bra e #chsw_prev_no_next
340 push $r2
341 mov b32 $r2 $r1
342 trace_set(T_SAVE)
343 bclr $flags $p1
344 bset $flags $p2
345 call #ctx_xfer
346 trace_clr(T_SAVE);
347 pop $r2
348 trace_set(T_LOAD);
349 bset $flags $p1
350 call #ctx_xfer
351 trace_clr(T_LOAD);
352 bra #chsw_done
353 chsw_prev_no_next:
354 push $r2
355 mov b32 $r2 $r1
356 bclr $flags $p1
357 bclr $flags $p2
358 call #ctx_xfer
359 pop $r2
360 mov $r1 0xb00
361 shl b32 $r1 6
362 iowr I[$r1] $r2
363 bra #chsw_done
364 chsw_no_prev:
365 xbit $r3 $r2 31
366 bra e #chsw_done
367 bset $flags $p1
368 bclr $flags $p2
369 call #ctx_xfer
370
371 // ack the context switch request
372 chsw_done:
373 mov $r1 0xb0c
374 shl b32 $r1 6
375 mov $r2 1
376 iowr I[$r1 + 0x000] $r2 // 0x409b0c
377 trace_clr(T_AUTO)
378 bra #main
379
380 // request to set current channel? (*not* a context switch)
381 main_not_ctx_switch:
382 cmpu b32 $r14 0x0001
383 bra ne #main_not_ctx_chan
384 mov b32 $r2 $r15
385 call #ctx_chan
386 bra #main_done
387
388 // request to store current channel context?
389 main_not_ctx_chan:
390 cmpu b32 $r14 0x0002
391 bra ne #main_not_ctx_save
392 trace_set(T_SAVE)
393 bclr $flags $p1
394 bclr $flags $p2
395 call #ctx_xfer
396 trace_clr(T_SAVE)
397 bra #main_done
398
399 main_not_ctx_save:
400 shl b32 $r15 $r14 16
401 or $r15 E_BAD_COMMAND
402 call #error
403 bra #main
404
405 main_done:
406 mov $r1 0x820
407 shl b32 $r1 6
408 clear b32 $r2
409 bset $r2 31
410 iowr I[$r1 + 0x000] $r2 // CC_SCRATCH[0] |= 0x80000000
411 bra #main
412
413// interrupt handler
414ih:
415 push $r8
416 mov $r8 $flags
417 push $r8
418 push $r9
419 push $r10
420 push $r11
421 push $r13
422 push $r14
423 push $r15
424
425 // incoming fifo command?
426 iord $r10 I[$r0 + 0x200] // INTR
427 and $r11 $r10 0x00000004
428 bra e #ih_no_fifo
429 // queue incoming fifo command for later processing
430 mov $r11 0x1900
431 mov $r13 #cmd_queue
432 iord $r14 I[$r11 + 0x100] // FIFO_CMD
433 iord $r15 I[$r11 + 0x000] // FIFO_DATA
434 call #queue_put
435 add b32 $r11 0x400
436 mov $r14 1
437 iowr I[$r11 + 0x000] $r14 // FIFO_ACK
438
439 // context switch request?
440 ih_no_fifo:
441 and $r11 $r10 0x00000100
442 bra e #ih_no_ctxsw
443 // enqueue a context switch for later processing
444 mov $r13 #cmd_queue
445 mov $r14 0x4001
446 call #queue_put
447
448 // anything we didn't handle, bring it to the host's attention
449 ih_no_ctxsw:
450 mov $r11 0x104
451 not b32 $r11
452 and $r11 $r10 $r11
453 bra e #ih_no_other
454 mov $r10 0xc1c
455 shl b32 $r10 6
456 iowr I[$r10] $r11 // INTR_UP_SET
457
458 // ack, and wake up main()
459 ih_no_other:
460 iowr I[$r0 + 0x100] $r10 // INTR_ACK
461
462 pop $r15
463 pop $r14
464 pop $r13
465 pop $r11
466 pop $r10
467 pop $r9
468 pop $r8
469 mov $flags $r8
470 pop $r8
471 bclr $flags $p0
472 iret
473
474// Again, not real sure
475//
476// In: $r15 value to set 0x404170 to
477//
478ctx_4170s:
479 mov $r14 0x4170
480 sethi $r14 0x400000
481 or $r15 0x10
482 call #nv_wr32
483 ret
484
485// Waits for a ctx_4170s() call to complete
486//
487ctx_4170w:
488 mov $r14 0x4170
489 sethi $r14 0x400000
490 call #nv_rd32
491 and $r15 0x10
492 bra ne #ctx_4170w
493 ret
494
495// Disables various things, waits a bit, and re-enables them..
496//
497// Not sure how exactly this helps, perhaps "ENABLE" is not such a
498// good description for the bits we turn off? Anyways, without this,
499// funny things happen.
500//
501ctx_redswitch:
502 mov $r14 0x614
503 shl b32 $r14 6
504 mov $r15 0x270
505 iowr I[$r14] $r15 // HUB_RED_SWITCH = ENABLE_GPC, POWER_ALL
506 mov $r15 8
507 ctx_redswitch_delay:
508 sub b32 $r15 1
509 bra ne #ctx_redswitch_delay
510 mov $r15 0x770
511 iowr I[$r14] $r15 // HUB_RED_SWITCH = ENABLE_ALL, POWER_ALL
512 ret
513
514// Not a clue what this is for, except that unless the value is 0x10, the
515// strand context is saved (and presumably restored) incorrectly..
516//
517// In: $r15 value to set to (0x00/0x10 are used)
518//
519ctx_86c:
520 mov $r14 0x86c
521 shl b32 $r14 6
522 iowr I[$r14] $r15 // HUB(0x86c) = val
523 mov $r14 -0x75ec
524 sethi $r14 0x400000
525 call #nv_wr32 // ROP(0xa14) = val
526 mov $r14 -0x5794
527 sethi $r14 0x410000
528 call #nv_wr32 // GPC(0x86c) = val
529 ret
530
531// ctx_load - load's a channel's ctxctl data, and selects its vm
532//
533// In: $r2 channel address
534//
535ctx_load:
536 trace_set(T_CHAN)
537
538 // switch to channel, somewhat magic in parts..
539 mov $r10 12 // DONE_UNK12
540 call #wait_donez
541 mov $r1 0xa24
542 shl b32 $r1 6
543 iowr I[$r1 + 0x000] $r0 // 0x409a24
544 mov $r3 0xb00
545 shl b32 $r3 6
546 iowr I[$r3 + 0x100] $r2 // CHAN_NEXT
547 mov $r1 0xa0c
548 shl b32 $r1 6
549 mov $r4 7
550 iowr I[$r1 + 0x000] $r2 // MEM_CHAN
551 iowr I[$r1 + 0x100] $r4 // MEM_CMD
552 ctx_chan_wait_0:
553 iord $r4 I[$r1 + 0x100]
554 and $r4 0x1f
555 bra ne #ctx_chan_wait_0
556 iowr I[$r3 + 0x000] $r2 // CHAN_CUR
557
558 // load channel header, fetch PGRAPH context pointer
559 mov $xtargets $r0
560 bclr $r2 31
561 shl b32 $r2 4
562 add b32 $r2 2
563
564 trace_set(T_LCHAN)
565 mov $r1 0xa04
566 shl b32 $r1 6
567 iowr I[$r1 + 0x000] $r2 // MEM_BASE
568 mov $r1 0xa20
569 shl b32 $r1 6
570 mov $r2 0x0002
571 sethi $r2 0x80000000
572 iowr I[$r1 + 0x000] $r2 // MEM_TARGET = vram
573 mov $r1 0x10 // chan + 0x0210
574 mov $r2 #xfer_data
575 sethi $r2 0x00020000 // 16 bytes
576 xdld $r1 $r2
577 xdwait
578 trace_clr(T_LCHAN)
579
580 // update current context
581 ld b32 $r1 D[$r0 + #xfer_data + 4]
582 shl b32 $r1 24
583 ld b32 $r2 D[$r0 + #xfer_data + 0]
584 shr b32 $r2 8
585 or $r1 $r2
586 st b32 D[$r0 + #ctx_current] $r1
587
588 // set transfer base to start of context, and fetch context header
589 trace_set(T_LCTXH)
590 mov $r2 0xa04
591 shl b32 $r2 6
592 iowr I[$r2 + 0x000] $r1 // MEM_BASE
593 mov $r2 1
594 mov $r1 0xa20
595 shl b32 $r1 6
596 iowr I[$r1 + 0x000] $r2 // MEM_TARGET = vm
597 mov $r1 #chan_data
598 sethi $r1 0x00060000 // 256 bytes
599 xdld $r0 $r1
600 xdwait
601 trace_clr(T_LCTXH)
602
603 trace_clr(T_CHAN)
604 ret
605
606// ctx_chan - handler for HUB_SET_CHAN command, will set a channel as
607// the active channel for ctxctl, but not actually transfer
608// any context data. intended for use only during initial
609// context construction.
610//
611// In: $r2 channel address
612//
613ctx_chan:
614 call #ctx_load
615 mov $r10 12 // DONE_UNK12
616 call #wait_donez
617 mov $r1 0xa10
618 shl b32 $r1 6
619 mov $r2 5
620 iowr I[$r1 + 0x000] $r2 // MEM_CMD = 5 (???)
621 ctx_chan_wait:
622 iord $r2 I[$r1 + 0x000]
623 or $r2 $r2
624 bra ne #ctx_chan_wait
625 ret
626
627// Execute per-context state overrides list
628//
629// Only executed on the first load of a channel. Might want to look into
630// removing this and having the host directly modify the channel's context
631// to change this state... The nouveau DRM already builds this list as
632// it's definitely needed for NVIDIA's, so we may as well use it for now
633//
634// Input: $r1 mmio list length
635//
636ctx_mmio_exec:
637 // set transfer base to be the mmio list
638 ld b32 $r3 D[$r0 + #chan_mmio_address]
639 mov $r2 0xa04
640 shl b32 $r2 6
641 iowr I[$r2 + 0x000] $r3 // MEM_BASE
642
643 clear b32 $r3
644 ctx_mmio_loop:
645 // fetch next 256 bytes of mmio list if necessary
646 and $r4 $r3 0xff
647 bra ne #ctx_mmio_pull
648 mov $r5 #xfer_data
649 sethi $r5 0x00060000 // 256 bytes
650 xdld $r3 $r5
651 xdwait
652
653 // execute a single list entry
654 ctx_mmio_pull:
655 ld b32 $r14 D[$r4 + #xfer_data + 0x00]
656 ld b32 $r15 D[$r4 + #xfer_data + 0x04]
657 call #nv_wr32
658
659 // next!
660 add b32 $r3 8
661 sub b32 $r1 1
662 bra ne #ctx_mmio_loop
663
664 // set transfer base back to the current context
665 ctx_mmio_done:
666 ld b32 $r3 D[$r0 + #ctx_current]
667 iowr I[$r2 + 0x000] $r3 // MEM_BASE
668
669 // disable the mmio list now, we don't need/want to execute it again
670 st b32 D[$r0 + #chan_mmio_count] $r0
671 mov $r1 #chan_data
672 sethi $r1 0x00060000 // 256 bytes
673 xdst $r0 $r1
674 xdwait
675 ret
676
677// Transfer HUB context data between GPU and storage area
678//
679// In: $r2 channel address
680// $p1 clear on save, set on load
681// $p2 set if opposite direction done/will be done, so:
682// on save it means: "a load will follow this save"
683// on load it means: "a save preceeded this load"
684//
685ctx_xfer:
686 // according to mwk, some kind of wait for idle
687 mov $r15 0xc00
688 shl b32 $r15 6
689 mov $r14 4
690 iowr I[$r15 + 0x200] $r14
691 ctx_xfer_idle:
692 iord $r14 I[$r15 + 0x000]
693 and $r14 0x2000
694 bra ne #ctx_xfer_idle
695
696 bra not $p1 #ctx_xfer_pre
697 bra $p2 #ctx_xfer_pre_load
698 ctx_xfer_pre:
699 mov $r15 0x10
700 call #ctx_86c
701 bra not $p1 #ctx_xfer_exec
702
703 ctx_xfer_pre_load:
704 mov $r15 2
705 call #ctx_4170s
706 call #ctx_4170w
707 call #ctx_redswitch
708 clear b32 $r15
709 call #ctx_4170s
710 call #ctx_load
711
712 // fetch context pointer, and initiate xfer on all GPCs
713 ctx_xfer_exec:
714 ld b32 $r1 D[$r0 + #ctx_current]
715 mov $r2 0x414
716 shl b32 $r2 6
717 iowr I[$r2 + 0x000] $r0 // BAR_STATUS = reset
718 mov $r14 -0x5b00
719 sethi $r14 0x410000
720 mov b32 $r15 $r1
721 call #nv_wr32 // GPC_BCAST_WRCMD_DATA = ctx pointer
722 add b32 $r14 4
723 xbit $r15 $flags $p1
724 xbit $r2 $flags $p2
725 shl b32 $r2 1
726 or $r15 $r2
727 call #nv_wr32 // GPC_BCAST_WRCMD_CMD = GPC_XFER(type)
728
729 // strands
730 mov $r1 0x4afc
731 sethi $r1 0x20000
732 mov $r2 0xc
733 iowr I[$r1] $r2 // STRAND_CMD(0x3f) = 0x0c
734 call #strand_wait
735 mov $r2 0x47fc
736 sethi $r2 0x20000
737 iowr I[$r2] $r0 // STRAND_FIRST_GENE(0x3f) = 0x00
738 xbit $r2 $flags $p1
739 add b32 $r2 3
740 iowr I[$r1] $r2 // STRAND_CMD(0x3f) = 0x03/0x04 (SAVE/LOAD)
741
742 // mmio context
743 xbit $r10 $flags $p1 // direction
744 or $r10 6 // first, last
745 mov $r11 0 // base = 0
746 ld b32 $r12 D[$r0 + #hub_mmio_list_head]
747 ld b32 $r13 D[$r0 + #hub_mmio_list_tail]
748 mov $r14 0 // not multi
749 call #mmctx_xfer
750
751 // wait for GPCs to all complete
752 mov $r10 8 // DONE_BAR
753 call #wait_doneo
754
755 // wait for strand xfer to complete
756 call #strand_wait
757
758 // post-op
759 bra $p1 #ctx_xfer_post
760 mov $r10 12 // DONE_UNK12
761 call #wait_donez
762 mov $r1 0xa10
763 shl b32 $r1 6
764 mov $r2 5
765 iowr I[$r1] $r2 // MEM_CMD
766 ctx_xfer_post_save_wait:
767 iord $r2 I[$r1]
768 or $r2 $r2
769 bra ne #ctx_xfer_post_save_wait
770
771 bra $p2 #ctx_xfer_done
772 ctx_xfer_post:
773 mov $r15 2
774 call #ctx_4170s
775 clear b32 $r15
776 call #ctx_86c
777 call #strand_post
778 call #ctx_4170w
779 clear b32 $r15
780 call #ctx_4170s
781
782 bra not $p1 #ctx_xfer_no_post_mmio
783 ld b32 $r1 D[$r0 + #chan_mmio_count]
784 or $r1 $r1
785 bra e #ctx_xfer_no_post_mmio
786 call #ctx_mmio_exec
787
788 ctx_xfer_no_post_mmio:
789
790 ctx_xfer_done:
791 ret
792
793.align 256 39.align 256
40#undef INCLUDE_CODE
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h
index e3421af68ab9..eb7bc0e9576e 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h
@@ -1,9 +1,13 @@
1uint32_t nve0_grhub_data[] = { 1uint32_t nve0_grhub_data[] = {
2/* 0x0000: gpc_count */ 2/* 0x0000: hub_mmio_list_head */
3 0x00000300,
4/* 0x0004: hub_mmio_list_tail */
5 0x00000304,
6/* 0x0008: gpc_count */
3 0x00000000, 7 0x00000000,
4/* 0x0004: rop_count */ 8/* 0x000c: rop_count */
5 0x00000000, 9 0x00000000,
6/* 0x0008: cmd_queue */ 10/* 0x0010: cmd_queue */
7 0x00000000, 11 0x00000000,
8 0x00000000, 12 0x00000000,
9 0x00000000, 13 0x00000000,
@@ -22,73 +26,11 @@ uint32_t nve0_grhub_data[] = {
22 0x00000000, 26 0x00000000,
23 0x00000000, 27 0x00000000,
24 0x00000000, 28 0x00000000,
25/* 0x0050: hub_mmio_list_head */ 29/* 0x0058: ctx_current */
26 0x00000000, 30 0x00000000,
27/* 0x0054: hub_mmio_list_tail */
28 0x00000000, 31 0x00000000,
29/* 0x0058: ctx_current */
30 0x00000000, 32 0x00000000,
31/* 0x005c: chipsets */
32 0x000000e4,
33 0x01440078,
34 0x000000e7,
35 0x01440078,
36 0x000000e6,
37 0x01440078,
38 0x00000000, 33 0x00000000,
39/* 0x0078: nve4_hub_mmio_head */
40 0x0417e91c,
41 0x04400204,
42 0x18404010,
43 0x204040a8,
44 0x184040d0,
45 0x004040f8,
46 0x08404130,
47 0x08404150,
48 0x00404164,
49 0x0c4041a0,
50 0x0c404200,
51 0x34404404,
52 0x0c404460,
53 0x00404480,
54 0x00404498,
55 0x0c404604,
56 0x0c404618,
57 0x0440462c,
58 0x00404640,
59 0x00404654,
60 0x00404660,
61 0x48404678,
62 0x084046c8,
63 0x08404700,
64 0x24404718,
65 0x04404744,
66 0x00404754,
67 0x00405800,
68 0x08405830,
69 0x00405854,
70 0x0c405870,
71 0x04405a00,
72 0x00405a18,
73 0x00405b00,
74 0x00405b10,
75 0x00406020,
76 0x0c406028,
77 0x044064a8,
78 0x044064b4,
79 0x2c4064c0,
80 0x004064fc,
81 0x00407040,
82 0x00407804,
83 0x1440780c,
84 0x004078bc,
85 0x18408000,
86 0x00408064,
87 0x08408800,
88 0x00408840,
89 0x08408900,
90 0x00408980,
91/* 0x0144: nve4_hub_mmio_tail */
92 0x00000000, 34 0x00000000,
93 0x00000000, 35 0x00000000,
94 0x00000000, 36 0x00000000,
@@ -127,6 +69,47 @@ uint32_t nve0_grhub_data[] = {
127 0x00000000, 69 0x00000000,
128 0x00000000, 70 0x00000000,
129 0x00000000, 71 0x00000000,
72/* 0x0100: chan_data */
73/* 0x0100: chan_mmio_count */
74 0x00000000,
75/* 0x0104: chan_mmio_address */
76 0x00000000,
77 0x00000000,
78 0x00000000,
79 0x00000000,
80 0x00000000,
81 0x00000000,
82 0x00000000,
83 0x00000000,
84 0x00000000,
85 0x00000000,
86 0x00000000,
87 0x00000000,
88 0x00000000,
89 0x00000000,
90 0x00000000,
91 0x00000000,
92 0x00000000,
93 0x00000000,
94 0x00000000,
95 0x00000000,
96 0x00000000,
97 0x00000000,
98 0x00000000,
99 0x00000000,
100 0x00000000,
101 0x00000000,
102 0x00000000,
103 0x00000000,
104 0x00000000,
105 0x00000000,
106 0x00000000,
107 0x00000000,
108 0x00000000,
109 0x00000000,
110 0x00000000,
111 0x00000000,
112 0x00000000,
130 0x00000000, 113 0x00000000,
131 0x00000000, 114 0x00000000,
132 0x00000000, 115 0x00000000,
@@ -136,10 +119,7 @@ uint32_t nve0_grhub_data[] = {
136 0x00000000, 119 0x00000000,
137 0x00000000, 120 0x00000000,
138 0x00000000, 121 0x00000000,
139/* 0x0200: chan_data */
140/* 0x0200: chan_mmio_count */
141 0x00000000, 122 0x00000000,
142/* 0x0204: chan_mmio_address */
143 0x00000000, 123 0x00000000,
144 0x00000000, 124 0x00000000,
145 0x00000000, 125 0x00000000,
@@ -156,6 +136,7 @@ uint32_t nve0_grhub_data[] = {
156 0x00000000, 136 0x00000000,
157 0x00000000, 137 0x00000000,
158 0x00000000, 138 0x00000000,
139/* 0x0200: xfer_data */
159 0x00000000, 140 0x00000000,
160 0x00000000, 141 0x00000000,
161 0x00000000, 142 0x00000000,
@@ -203,19 +184,36 @@ uint32_t nve0_grhub_data[] = {
203 0x00000000, 184 0x00000000,
204 0x00000000, 185 0x00000000,
205 0x00000000, 186 0x00000000,
206/* 0x0300: xfer_data */
207 0x00000000, 187 0x00000000,
188 0x00000000,
189 0x00000000,
190 0x00000000,
191 0x00000000,
192 0x00000000,
193 0x00000000,
194 0x00000000,
195 0x00000000,
196 0x00000000,
197 0x00000000,
198 0x00000000,
199 0x00000000,
200 0x00000000,
201 0x00000000,
202 0x00000000,
203 0x00000000,
204/* 0x0300: hub_mmio_list_base */
205 0x0417e91c,
208}; 206};
209 207
210uint32_t nve0_grhub_code[] = { 208uint32_t nve0_grhub_code[] = {
211 0x03090ef5, 209 0x031b0ef5,
212/* 0x0004: queue_put */ 210/* 0x0004: queue_put */
213 0x9800d898, 211 0x9800d898,
214 0x86f001d9, 212 0x86f001d9,
215 0x0489b808, 213 0x0489b808,
216 0xf00c1bf4, 214 0xf00c1bf4,
217 0x21f502f7, 215 0x21f502f7,
218 0x00f802ec, 216 0x00f802fe,
219/* 0x001c: queue_put_next */ 217/* 0x001c: queue_put_next */
220 0xb60798c4, 218 0xb60798c4,
221 0x8dbb0384, 219 0x8dbb0384,
@@ -247,7 +245,7 @@ uint32_t nve0_grhub_code[] = {
247 0xc800bccf, 245 0xc800bccf,
248 0x1bf41fcc, 246 0x1bf41fcc,
249 0x06a7f0fa, 247 0x06a7f0fa,
250 0x010321f5, 248 0x010921f5,
251 0xf840bfcf, 249 0xf840bfcf,
252/* 0x008d: nv_wr32 */ 250/* 0x008d: nv_wr32 */
253 0x28b7f100, 251 0x28b7f100,
@@ -269,63 +267,66 @@ uint32_t nve0_grhub_code[] = {
269 0x0684b604, 267 0x0684b604,
270 0xf80080d0, 268 0xf80080d0,
271/* 0x00c9: wait_donez */ 269/* 0x00c9: wait_donez */
272 0x3c87f100, 270 0xf094bd00,
273 0x0684b608, 271 0x07f10099,
274 0x99f094bd, 272 0x03f00f00,
275 0x0089d000, 273 0x0009d002,
276 0x081887f1, 274 0x07f104bd,
277 0xd00684b6, 275 0x03f00600,
278/* 0x00e2: wait_done_wait_donez */ 276 0x000ad002,
279 0x87f1008a, 277/* 0x00e6: wait_donez_ne */
280 0x84b60400, 278 0x87f104bd,
281 0x0088cf06, 279 0x83f00000,
280 0x0088cf01,
282 0xf4888aff, 281 0xf4888aff,
283 0x87f1f31b, 282 0x94bdf31b,
284 0x84b6085c, 283 0xf10099f0,
285 0xf094bd06, 284 0xf0170007,
286 0x89d00099, 285 0x09d00203,
287/* 0x0103: wait_doneo */ 286 0xf804bd00,
288 0xf100f800, 287/* 0x0109: wait_doneo */
289 0xb6083c87, 288 0xf094bd00,
290 0x94bd0684, 289 0x07f10099,
291 0xd00099f0, 290 0x03f00f00,
292 0x87f10089, 291 0x0009d002,
292 0x87f104bd,
293 0x84b60818, 293 0x84b60818,
294 0x008ad006, 294 0x008ad006,
295/* 0x011c: wait_done_wait_doneo */ 295/* 0x0124: wait_doneo_e */
296 0x040087f1, 296 0x040087f1,
297 0xcf0684b6, 297 0xcf0684b6,
298 0x8aff0088, 298 0x8aff0088,
299 0xf30bf488, 299 0xf30bf488,
300 0x085c87f1, 300 0x99f094bd,
301 0xbd0684b6, 301 0x0007f100,
302 0x0099f094, 302 0x0203f017,
303 0xf80089d0, 303 0xbd0009d0,
304/* 0x013d: mmctx_size */ 304/* 0x0147: mmctx_size */
305/* 0x013f: nv_mmctx_size_loop */ 305 0xbd00f804,
306 0x9894bd00, 306/* 0x0149: nv_mmctx_size_loop */
307 0x85b600e8, 307 0x00e89894,
308 0x0180b61a, 308 0xb61a85b6,
309 0xbb0284b6, 309 0x84b60180,
310 0xe0b60098, 310 0x0098bb02,
311 0x04efb804, 311 0xb804e0b6,
312 0xb9eb1bf4, 312 0x1bf404ef,
313 0x00f8029f, 313 0x029fb9eb,
314/* 0x015c: mmctx_xfer */ 314/* 0x0166: mmctx_xfer */
315 0x083c87f1, 315 0x94bd00f8,
316 0xbd0684b6, 316 0xf10199f0,
317 0x0199f094, 317 0xf00f0007,
318 0xf10089d0, 318 0x09d00203,
319 0xf104bd00,
319 0xb6071087, 320 0xb6071087,
320 0x94bd0684, 321 0x94bd0684,
321 0xf405bbfd, 322 0xf405bbfd,
322 0x8bd0090b, 323 0x8bd0090b,
323 0x0099f000, 324 0x0099f000,
324/* 0x0180: mmctx_base_disabled */ 325/* 0x018c: mmctx_base_disabled */
325 0xf405eefd, 326 0xf405eefd,
326 0x8ed00c0b, 327 0x8ed00c0b,
327 0xc08fd080, 328 0xc08fd080,
328/* 0x018f: mmctx_multi_disabled */ 329/* 0x019b: mmctx_multi_disabled */
329 0xb70199f0, 330 0xb70199f0,
330 0xc8010080, 331 0xc8010080,
331 0xb4b600ab, 332 0xb4b600ab,
@@ -333,8 +334,8 @@ uint32_t nve0_grhub_code[] = {
333 0xb601aec8, 334 0xb601aec8,
334 0xbefd11e4, 335 0xbefd11e4,
335 0x008bd005, 336 0x008bd005,
336/* 0x01a8: mmctx_exec_loop */ 337/* 0x01b4: mmctx_exec_loop */
337/* 0x01a8: mmctx_wait_free */ 338/* 0x01b4: mmctx_wait_free */
338 0xf0008ecf, 339 0xf0008ecf,
339 0x0bf41fe4, 340 0x0bf41fe4,
340 0x00ce98fa, 341 0x00ce98fa,
@@ -343,76 +344,77 @@ uint32_t nve0_grhub_code[] = {
343 0x04cdb804, 344 0x04cdb804,
344 0xc8e81bf4, 345 0xc8e81bf4,
345 0x1bf402ab, 346 0x1bf402ab,
346/* 0x01c9: mmctx_fini_wait */ 347/* 0x01d5: mmctx_fini_wait */
347 0x008bcf18, 348 0x008bcf18,
348 0xb01fb4f0, 349 0xb01fb4f0,
349 0x1bf410b4, 350 0x1bf410b4,
350 0x02a7f0f7, 351 0x02a7f0f7,
351 0xf4c921f4, 352 0xf4c921f4,
352/* 0x01de: mmctx_stop */ 353/* 0x01ea: mmctx_stop */
353 0xabc81b0e, 354 0xabc81b0e,
354 0x10b4b600, 355 0x10b4b600,
355 0xf00cb9f0, 356 0xf00cb9f0,
356 0x8bd012b9, 357 0x8bd012b9,
357/* 0x01ed: mmctx_stop_wait */ 358/* 0x01f9: mmctx_stop_wait */
358 0x008bcf00, 359 0x008bcf00,
359 0xf412bbc8, 360 0xf412bbc8,
360/* 0x01f6: mmctx_done */ 361/* 0x0202: mmctx_done */
361 0x87f1fa1b, 362 0x94bdfa1b,
362 0x84b6085c, 363 0xf10199f0,
363 0xf094bd06, 364 0xf0170007,
364 0x89d00199, 365 0x09d00203,
365/* 0x0207: strand_wait */ 366 0xf804bd00,
366 0xf900f800, 367/* 0x0215: strand_wait */
367 0x02a7f0a0, 368 0xf0a0f900,
368 0xfcc921f4, 369 0x21f402a7,
369/* 0x0213: strand_pre */ 370 0xf8a0fcc9,
370 0xf100f8a0, 371/* 0x0221: strand_pre */
371 0xf04afc87, 372 0xfc87f100,
372 0x97f00283, 373 0x0283f04a,
373 0x0089d00c, 374 0xd00c97f0,
374 0x020721f5,
375/* 0x0226: strand_post */
376 0x87f100f8,
377 0x83f04afc,
378 0x0d97f002,
379 0xf50089d0,
380 0xf8020721,
381/* 0x0239: strand_set */
382 0xfca7f100,
383 0x02a3f04f,
384 0x0500aba2,
385 0xd00fc7f0,
386 0xc7f000ac,
387 0x00bcd00b,
388 0x020721f5,
389 0xf000aed0,
390 0xbcd00ac7,
391 0x0721f500,
392/* 0x0263: strand_ctx_init */
393 0xf100f802,
394 0xb6083c87,
395 0x94bd0684,
396 0xd00399f0,
397 0x21f50089, 375 0x21f50089,
398 0xe7f00213, 376 0x00f80215,
399 0x3921f503, 377/* 0x0234: strand_post */
378 0x4afc87f1,
379 0xf00283f0,
380 0x89d00d97,
381 0x1521f500,
382/* 0x0247: strand_set */
383 0xf100f802,
384 0xf04ffca7,
385 0xaba202a3,
386 0xc7f00500,
387 0x00acd00f,
388 0xd00bc7f0,
389 0x21f500bc,
390 0xaed00215,
391 0x0ac7f000,
392 0xf500bcd0,
393 0xf8021521,
394/* 0x0271: strand_ctx_init */
395 0xf094bd00,
396 0x07f10399,
397 0x03f00f00,
398 0x0009d002,
399 0x21f504bd,
400 0xe7f00221,
401 0x4721f503,
400 0xfca7f102, 402 0xfca7f102,
401 0x02a3f046, 403 0x02a3f046,
402 0x0400aba0, 404 0x0400aba0,
403 0xf040a0d0, 405 0xf040a0d0,
404 0xbcd001c7, 406 0xbcd001c7,
405 0x0721f500, 407 0x1521f500,
406 0x010c9202, 408 0x010c9202,
407 0xf000acd0, 409 0xf000acd0,
408 0xbcd002c7, 410 0xbcd002c7,
409 0x0721f500, 411 0x1521f500,
410 0x2621f502, 412 0x3421f502,
411 0x8087f102, 413 0x8087f102,
412 0x0684b608, 414 0x0684b608,
413 0xb70089cf, 415 0xb70089cf,
414 0x95220080, 416 0x95220080,
415/* 0x02ba: ctx_init_strand_loop */ 417/* 0x02ca: ctx_init_strand_loop */
416 0x8ed008fe, 418 0x8ed008fe,
417 0x408ed000, 419 0x408ed000,
418 0xb6808acf, 420 0xb6808acf,
@@ -421,73 +423,61 @@ uint32_t nve0_grhub_code[] = {
421 0xb60480b6, 423 0xb60480b6,
422 0x1bf40192, 424 0x1bf40192,
423 0x08e4b6e8, 425 0x08e4b6e8,
424 0xf1f2efbc, 426 0xbdf2efbc,
425 0xb6085c87, 427 0x0399f094,
426 0x94bd0684, 428 0x170007f1,
427 0xd00399f0, 429 0xd00203f0,
428 0x00f80089, 430 0x04bd0009,
429/* 0x02ec: error */ 431/* 0x02fe: error */
430 0xe7f1e0f9, 432 0x07f100f8,
431 0xe4b60814, 433 0x03f00500,
432 0x00efd006, 434 0x000fd002,
433 0x0c1ce7f1, 435 0xf7f004bd,
434 0xf006e4b6, 436 0x0007f101,
435 0xefd001f7, 437 0x0303f007,
436 0xf8e0fc00, 438 0xbd000fd0,
437/* 0x0309: init */ 439/* 0x031b: init */
438 0xfe04bd00, 440 0xbd00f804,
439 0x07fe0004, 441 0x0004fe04,
440 0x0017f100, 442 0xf10007fe,
441 0x0227f012, 443 0xf0120017,
442 0xf10012d0, 444 0x12d00227,
443 0xfe05b917, 445 0xb117f100,
444 0x17f10010, 446 0x0010fe05,
445 0x10d00400, 447 0x040017f1,
446 0x0437f1c0, 448 0xf1c010d0,
447 0x0634b604, 449 0xb6040437,
448 0x200327f1, 450 0x27f10634,
449 0xf10032d0, 451 0x32d02003,
450 0xd0200427,
451 0x27f10132,
452 0x32d0200b,
453 0x0c27f102,
454 0x0732d020,
455 0x0c2427f1,
456 0xb90624b6,
457 0x23d00003,
458 0x0427f100, 452 0x0427f100,
459 0x0023f087, 453 0x0132d020,
460 0xb70012d0, 454 0x200b27f1,
461 0xf0010012, 455 0xf10232d0,
462 0x12d00427, 456 0xd0200c27,
463 0x1031f400, 457 0x27f10732,
464 0x9604e7f1, 458 0x24b60c24,
465 0xf440e3f0, 459 0x0003b906,
466 0xf1c76821, 460 0xf10023d0,
467 0x01018090, 461 0xf0870427,
468 0x801ff4f0, 462 0x12d00023,
469 0x17f0000f, 463 0x0012b700,
470 0x041fbb01, 464 0x0427f001,
471 0xf10112b6, 465 0xf40012d0,
472 0xb6040c27, 466 0xe7f11031,
473 0x21d00624, 467 0xe3f09604,
474 0x4021d000, 468 0x6821f440,
475 0x080027f1, 469 0x8090f1c7,
476 0xcf0624b6, 470 0xf4f00301,
477 0xf7f00022, 471 0x020f801f,
478/* 0x03a9: init_find_chipset */ 472 0xbb0117f0,
479 0x08f0b654, 473 0x12b6041f,
480 0xb800f398, 474 0x0c27f101,
481 0x0bf40432, 475 0x0624b604,
482 0x0034b00b, 476 0xd00021d0,
483 0xf8f11bf4, 477 0x17f14021,
484/* 0x03bd: init_context */ 478 0x0e980100,
485 0x0017f100, 479 0x010f9800,
486 0x02fe5801, 480 0x014721f5,
487 0xf003ff58,
488 0x0e8000e3,
489 0x150f8014,
490 0x013d21f5,
491 0x070037f1, 481 0x070037f1,
492 0x950634b6, 482 0x950634b6,
493 0x34d00814, 483 0x34d00814,
@@ -498,196 +488,201 @@ uint32_t nve0_grhub_code[] = {
498 0x0815b600, 488 0x0815b600,
499 0xb60110b6, 489 0xb60110b6,
500 0x1fb90814, 490 0x1fb90814,
501 0x6321f502, 491 0x7121f502,
502 0x001fbb02, 492 0x001fbb02,
503 0xf1000398, 493 0xf1020398,
504 0xf0200047, 494 0xf0200047,
505/* 0x040e: init_gpc */ 495/* 0x03f6: init_gpc */
506 0x4ea05043, 496 0x4ea05043,
507 0x1fb90804, 497 0x1fb90804,
508 0x8d21f402, 498 0x8d21f402,
509 0x08004ea0, 499 0x010c4ea0,
510 0xf4022fb9, 500 0x21f4f4bd,
511 0x4ea08d21, 501 0x044ea08d,
512 0xf4bd010c, 502 0x8d21f401,
513 0xa08d21f4, 503 0x01004ea0,
514 0xf401044e, 504 0xf402f7f0,
515 0x4ea08d21, 505 0x4ea08d21,
516 0xf7f00100, 506/* 0x041e: init_gpc_wait */
517 0x8d21f402, 507 0x21f40800,
518 0x08004ea0, 508 0x1fffc868,
519/* 0x0440: init_gpc_wait */ 509 0xa0fa0bf4,
520 0xc86821f4, 510 0xf408044e,
521 0x0bf41fff, 511 0x1fbb6821,
522 0x044ea0fa, 512 0x0040b700,
523 0x6821f408, 513 0x0132b680,
524 0xb7001fbb, 514 0xf1be1bf4,
525 0xb6800040, 515 0xf0010007,
526 0x1bf40132, 516 0x01d00203,
527 0x0027f1b4, 517 0xbd04bd00,
528 0x0624b608,
529 0xb74021d0,
530 0xbd080020,
531 0x1f19f014, 518 0x1f19f014,
532/* 0x0473: main */ 519 0x080007f1,
533 0xf40021d0, 520 0xd00203f0,
534 0x28f40031, 521 0x04bd0001,
535 0x08d7f000, 522/* 0x0458: main */
536 0xf43921f4, 523 0xf40031f4,
537 0xe4b1f401, 524 0xd7f00028,
538 0x1bf54001, 525 0x3921f410,
539 0x87f100d1, 526 0xb1f401f4,
540 0x84b6083c, 527 0xf54001e4,
541 0xf094bd06, 528 0xbd00de1b,
542 0x89d00499, 529 0x0499f094,
543 0x0017f100, 530 0x0f0007f1,
544 0x0614b60b, 531 0xd00203f0,
545 0xcf4012cf, 532 0x04bd0009,
546 0x13c80011, 533 0x0b0017f1,
547 0x7e0bf41f, 534 0xcf0614b6,
535 0x11cf4012,
536 0x1f13c800,
537 0x00870bf5,
548 0xf41f23c8, 538 0xf41f23c8,
549 0x20f95a0b, 539 0x20f9620b,
550 0xf10212b9, 540 0xbd0212b9,
551 0xb6083c87,
552 0x94bd0684,
553 0xd00799f0,
554 0x32f40089,
555 0x0231f401,
556 0x07fb21f5,
557 0x085c87f1,
558 0xbd0684b6,
559 0x0799f094, 541 0x0799f094,
560 0xfc0089d0, 542 0x0f0007f1,
561 0x3c87f120, 543 0xd00203f0,
562 0x0684b608, 544 0x04bd0009,
563 0x99f094bd, 545 0xf40132f4,
564 0x0089d006, 546 0x21f50231,
565 0xf50131f4, 547 0x94bd0801,
566 0xf107fb21, 548 0xf10799f0,
567 0xb6085c87, 549 0xf0170007,
568 0x94bd0684, 550 0x09d00203,
569 0xd00699f0, 551 0xfc04bd00,
570 0x0ef40089, 552 0xf094bd20,
571/* 0x0509: chsw_prev_no_next */ 553 0x07f10699,
554 0x03f00f00,
555 0x0009d002,
556 0x31f404bd,
557 0x0121f501,
558 0xf094bd08,
559 0x07f10699,
560 0x03f01700,
561 0x0009d002,
562 0x0ef404bd,
563/* 0x04f9: chsw_prev_no_next */
572 0xb920f931, 564 0xb920f931,
573 0x32f40212, 565 0x32f40212,
574 0x0232f401, 566 0x0232f401,
575 0x07fb21f5, 567 0x080121f5,
576 0x17f120fc, 568 0x17f120fc,
577 0x14b60b00, 569 0x14b60b00,
578 0x0012d006, 570 0x0012d006,
579/* 0x0527: chsw_no_prev */ 571/* 0x0517: chsw_no_prev */
580 0xc8130ef4, 572 0xc8130ef4,
581 0x0bf41f23, 573 0x0bf41f23,
582 0x0131f40d, 574 0x0131f40d,
583 0xf50232f4, 575 0xf50232f4,
584/* 0x0537: chsw_done */ 576/* 0x0527: chsw_done */
585 0xf107fb21, 577 0xf1080121,
586 0xb60b0c17, 578 0xb60b0c17,
587 0x27f00614, 579 0x27f00614,
588 0x0012d001, 580 0x0012d001,
589 0x085c87f1,
590 0xbd0684b6,
591 0x0499f094,
592 0xf50089d0,
593/* 0x0557: main_not_ctx_switch */
594 0xb0ff200e,
595 0x1bf401e4,
596 0x02f2b90d,
597 0x078f21f5,
598/* 0x0567: main_not_ctx_chan */
599 0xb0420ef4,
600 0x1bf402e4,
601 0x3c87f12e,
602 0x0684b608,
603 0x99f094bd, 581 0x99f094bd,
604 0x0089d007, 582 0x0007f104,
583 0x0203f017,
584 0xbd0009d0,
585 0x130ef504,
586/* 0x0549: main_not_ctx_switch */
587 0x01e4b0ff,
588 0xb90d1bf4,
589 0x21f502f2,
590 0x0ef40795,
591/* 0x0559: main_not_ctx_chan */
592 0x02e4b046,
593 0xbd321bf4,
594 0x0799f094,
595 0x0f0007f1,
596 0xd00203f0,
597 0x04bd0009,
605 0xf40132f4, 598 0xf40132f4,
606 0x21f50232, 599 0x21f50232,
607 0x87f107fb, 600 0x94bd0801,
608 0x84b6085c, 601 0xf10799f0,
609 0xf094bd06, 602 0xf0170007,
610 0x89d00799, 603 0x09d00203,
611 0x110ef400, 604 0xf404bd00,
612/* 0x0598: main_not_ctx_save */ 605/* 0x058e: main_not_ctx_save */
613 0xf010ef94, 606 0xef94110e,
614 0x21f501f5, 607 0x01f5f010,
615 0x0ef502ec, 608 0x02fe21f5,
616/* 0x05a6: main_done */ 609 0xfec00ef5,
617 0x17f1fed1, 610/* 0x059c: main_done */
618 0x14b60820, 611 0x29f024bd,
619 0xf024bd06, 612 0x0007f11f,
620 0x12d01f29, 613 0x0203f008,
621 0xbe0ef500, 614 0xbd0002d0,
622/* 0x05b9: ih */ 615 0xab0ef504,
616/* 0x05b1: ih */
623 0xfe80f9fe, 617 0xfe80f9fe,
624 0x80f90188, 618 0x80f90188,
625 0xa0f990f9, 619 0xa0f990f9,
626 0xd0f9b0f9, 620 0xd0f9b0f9,
627 0xf0f9e0f9, 621 0xf0f9e0f9,
628 0xc4800acf, 622 0x0acf04bd,
629 0x0bf404ab, 623 0x04abc480,
630 0x00b7f11d, 624 0xf11d0bf4,
631 0x08d7f019, 625 0xf01900b7,
632 0xcf40becf, 626 0xbecf10d7,
633 0x21f400bf, 627 0x00bfcf40,
634 0x00b0b704, 628 0xb70421f4,
635 0x01e7f004, 629 0xf00400b0,
636/* 0x05ef: ih_no_fifo */ 630 0xbed001e7,
637 0xe400bed0, 631/* 0x05e9: ih_no_fifo */
638 0xf40100ab, 632 0x00abe400,
639 0xd7f00d0b, 633 0x0d0bf401,
640 0x01e7f108, 634 0xf110d7f0,
641 0x0421f440, 635 0xf44001e7,
642/* 0x0600: ih_no_ctxsw */ 636/* 0x05fa: ih_no_ctxsw */
643 0x0104b7f1, 637 0xb7f10421,
644 0xabffb0bd, 638 0xb0bd0104,
645 0x0d0bf4b4, 639 0xf4b4abff,
646 0x0c1ca7f1, 640 0xa7f10d0b,
647 0xd006a4b6, 641 0xa4b60c1c,
648/* 0x0616: ih_no_other */ 642 0x00abd006,
649 0x0ad000ab, 643/* 0x0610: ih_no_other */
650 0xfcf0fc40, 644 0xfc400ad0,
651 0xfcd0fce0, 645 0xfce0fcf0,
652 0xfca0fcb0, 646 0xfcb0fcd0,
653 0xfe80fc90, 647 0xfc90fca0,
654 0x80fc0088, 648 0x0088fe80,
655 0xf80032f4, 649 0x32f480fc,
656/* 0x0631: ctx_4170s */ 650/* 0x062b: ctx_4170s */
657 0x70e7f101, 651 0xf101f800,
658 0x40e3f041, 652 0xf04170e7,
659 0xf410f5f0, 653 0xf5f040e3,
660 0x00f88d21, 654 0x8d21f410,
661/* 0x0640: ctx_4170w */ 655/* 0x063a: ctx_4170w */
662 0x4170e7f1,
663 0xf440e3f0,
664 0xf4f06821,
665 0xf31bf410,
666/* 0x0652: ctx_redswitch */
667 0xe7f100f8, 656 0xe7f100f8,
668 0xe4b60614, 657 0xe3f04170,
669 0x70f7f106, 658 0x6821f440,
670 0x00efd002, 659 0xf410f4f0,
671/* 0x0663: ctx_redswitch_delay */ 660 0x00f8f31b,
672 0xb608f7f0, 661/* 0x064c: ctx_redswitch */
673 0x1bf401f2, 662 0x0614e7f1,
674 0x70f7f1fd, 663 0xf106e4b6,
675 0x00efd007, 664 0xd00270f7,
676/* 0x0672: ctx_86c */ 665 0xf7f000ef,
677 0xe7f100f8, 666/* 0x065d: ctx_redswitch_delay */
678 0xe4b6086c, 667 0x01f2b608,
679 0x00efd006, 668 0xf1fd1bf4,
680 0x8a14e7f1, 669 0xd00770f7,
681 0xf440e3f0, 670 0x00f800ef,
682 0xe7f18d21, 671/* 0x066c: ctx_86c */
683 0xe3f0a86c, 672 0x086ce7f1,
684 0x8d21f441, 673 0xd006e4b6,
685/* 0x0692: ctx_load */ 674 0xe7f100ef,
686 0x87f100f8, 675 0xe3f08a14,
687 0x84b6083c, 676 0x8d21f440,
688 0xf094bd06, 677 0xa86ce7f1,
689 0x89d00599, 678 0xf441e3f0,
690 0x0ca7f000, 679 0x00f88d21,
680/* 0x068c: ctx_load */
681 0x99f094bd,
682 0x0007f105,
683 0x0203f00f,
684 0xbd0009d0,
685 0x0ca7f004,
691 0xf1c921f4, 686 0xf1c921f4,
692 0xb60a2417, 687 0xb60a2417,
693 0x10d00614, 688 0x10d00614,
@@ -697,162 +692,227 @@ uint32_t nve0_grhub_code[] = {
697 0xb60a0c17, 692 0xb60a0c17,
698 0x47f00614, 693 0x47f00614,
699 0x0012d007, 694 0x0012d007,
700/* 0x06cb: ctx_chan_wait_0 */ 695/* 0x06c7: ctx_chan_wait_0 */
701 0xcf4014d0, 696 0xcf4014d0,
702 0x44f04014, 697 0x44f04014,
703 0xfa1bf41f, 698 0xfa1bf41f,
704 0xfe0032d0, 699 0xfe0032d0,
705 0x2af0000b, 700 0x2af0000b,
706 0x0424b61f, 701 0x0424b61f,
707 0xf10220b6, 702 0xbd0220b6,
708 0xb6083c87,
709 0x94bd0684,
710 0xd00899f0,
711 0x17f10089,
712 0x14b60a04,
713 0x0012d006,
714 0x0a2017f1,
715 0xf00614b6,
716 0x23f10227,
717 0x12d08000,
718 0x1017f000,
719 0x030027f1,
720 0xfa0223f0,
721 0x03f80512,
722 0x085c87f1,
723 0xbd0684b6,
724 0x0899f094, 703 0x0899f094,
725 0x980089d0, 704 0x0f0007f1,
726 0x14b6c101, 705 0xd00203f0,
727 0xc0029818, 706 0x04bd0009,
707 0x0a0417f1,
708 0xd00614b6,
709 0x17f10012,
710 0x14b60a20,
711 0x0227f006,
712 0x800023f1,
713 0xf00012d0,
714 0x27f11017,
715 0x23f00200,
716 0x0512fa02,
717 0x94bd03f8,
718 0xf10899f0,
719 0xf0170007,
720 0x09d00203,
721 0x9804bd00,
722 0x14b68101,
723 0x80029818,
728 0xfd0825b6, 724 0xfd0825b6,
729 0x01800512, 725 0x01800512,
730 0x3c87f116, 726 0xf094bd16,
731 0x0684b608, 727 0x07f10999,
732 0x99f094bd, 728 0x03f00f00,
733 0x0089d009, 729 0x0009d002,
734 0x0a0427f1, 730 0x27f104bd,
735 0xd00624b6, 731 0x24b60a04,
736 0x27f00021, 732 0x0021d006,
737 0x2017f101, 733 0xf10127f0,
738 0x0614b60a, 734 0xb60a2017,
739 0xf10012d0, 735 0x12d00614,
740 0xf0020017, 736 0x0017f100,
737 0x0613f001,
738 0xf80501fa,
739 0xf094bd03,
740 0x07f10999,
741 0x03f01700,
742 0x0009d002,
743 0x94bd04bd,
744 0xf10599f0,
745 0xf0170007,
746 0x09d00203,
747 0xf804bd00,
748/* 0x0795: ctx_chan */
749 0x8c21f500,
750 0x0ca7f006,
751 0xf1c921f4,
752 0xb60a1017,
753 0x27f00614,
754 0x0012d005,
755/* 0x07ac: ctx_chan_wait */
756 0xfd0012cf,
757 0x1bf40522,
758/* 0x07b7: ctx_mmio_exec */
759 0x9800f8fa,
760 0x27f14103,
761 0x24b60a04,
762 0x0023d006,
763/* 0x07c6: ctx_mmio_loop */
764 0x34c434bd,
765 0x0f1bf4ff,
766 0x020057f1,
767 0xfa0653f0,
768 0x03f80535,
769/* 0x07d8: ctx_mmio_pull */
770 0x98804e98,
771 0x21f4814f,
772 0x0830b68d,
773 0xf40112b6,
774/* 0x07ea: ctx_mmio_done */
775 0x0398df1b,
776 0x0023d016,
777 0xf1400080,
778 0xf0010017,
741 0x01fa0613, 779 0x01fa0613,
742 0xf103f805, 780 0xf803f806,
743 0xb6085c87, 781/* 0x0801: ctx_xfer */
744 0x94bd0684, 782 0x00f7f100,
745 0xd00999f0, 783 0x06f4b60c,
746 0x87f10089, 784 0xd004e7f0,
747 0x84b6085c, 785/* 0x080e: ctx_xfer_idle */
748 0xf094bd06, 786 0xfecf80fe,
749 0x89d00599, 787 0x00e4f100,
750/* 0x078f: ctx_chan */ 788 0xf91bf420,
751 0xf500f800, 789 0xf40611f4,
752 0xf0069221, 790/* 0x081e: ctx_xfer_pre */
753 0x21f40ca7, 791 0xf7f00d02,
754 0x1017f1c9, 792 0x6c21f510,
755 0x0614b60a, 793 0x1c11f406,
756 0xd00527f0, 794/* 0x0828: ctx_xfer_pre_load */
757/* 0x07a6: ctx_chan_wait */ 795 0xf502f7f0,
758 0x12cf0012, 796 0xf5062b21,
759 0x0522fd00, 797 0xf5063a21,
760 0xf8fa1bf4, 798 0xbd064c21,
761/* 0x07b1: ctx_mmio_exec */ 799 0x2b21f5f4,
762 0x81039800, 800 0x8c21f506,
763 0x0a0427f1, 801/* 0x0841: ctx_xfer_exec */
802 0x16019806,
803 0x041427f1,
764 0xd00624b6, 804 0xd00624b6,
765 0x34bd0023, 805 0xe7f10020,
766/* 0x07c0: ctx_mmio_loop */ 806 0xe3f0a500,
767 0xf4ff34c4, 807 0x021fb941,
768 0x57f10f1b,
769 0x53f00300,
770 0x0535fa06,
771/* 0x07d2: ctx_mmio_pull */
772 0x4e9803f8,
773 0xc14f98c0,
774 0xb68d21f4, 808 0xb68d21f4,
775 0x12b60830, 809 0xfcf004e0,
776 0xdf1bf401, 810 0x022cf001,
777/* 0x07e4: ctx_mmio_done */ 811 0xfd0124b6,
778 0xd0160398, 812 0x21f405f2,
779 0x00800023, 813 0xfc17f18d,
780 0x0017f180, 814 0x0213f04a,
781 0x0613f002, 815 0xd00c27f0,
782 0xf80601fa, 816 0x21f50012,
783/* 0x07fb: ctx_xfer */ 817 0x27f10215,
784 0xf100f803, 818 0x23f047fc,
785 0xb60c00f7, 819 0x0020d002,
786 0xe7f006f4, 820 0xb6012cf0,
787 0x80fed004, 821 0x12d00320,
788/* 0x0808: ctx_xfer_idle */ 822 0x01acf000,
789 0xf100fecf, 823 0xf006a5f0,
790 0xf42000e4, 824 0x0c9800b7,
791 0x11f4f91b, 825 0x010d9800,
792 0x0d02f406, 826 0xf500e7f0,
793/* 0x0818: ctx_xfer_pre */ 827 0xf0016621,
794 0xf510f7f0, 828 0x21f508a7,
795 0xf4067221, 829 0x21f50109,
796/* 0x0822: ctx_xfer_pre_load */ 830 0x01f40215,
797 0xf7f01c11, 831 0x0ca7f022,
798 0x3121f502, 832 0xf1c921f4,
799 0x4021f506, 833 0xb60a1017,
800 0x5221f506, 834 0x27f00614,
801 0xf5f4bd06, 835 0x0012d005,
802 0xf5063121, 836/* 0x08c8: ctx_xfer_post_save_wait */
803/* 0x083b: ctx_xfer_exec */ 837 0xfd0012cf,
804 0x98069221, 838 0x1bf40522,
805 0x27f11601, 839 0x2e02f4fa,
806 0x24b60414, 840/* 0x08d4: ctx_xfer_post */
807 0x0020d006, 841 0xf502f7f0,
808 0xa500e7f1, 842 0xbd062b21,
809 0xb941e3f0, 843 0x6c21f5f4,
810 0x21f4021f, 844 0x3421f506,
811 0x04e0b68d, 845 0x3a21f502,
812 0xf001fcf0,
813 0x24b6022c,
814 0x05f2fd01,
815 0xf18d21f4,
816 0xf04afc17,
817 0x27f00213,
818 0x0012d00c,
819 0x020721f5,
820 0x47fc27f1,
821 0xd00223f0,
822 0x2cf00020,
823 0x0320b601,
824 0xf00012d0,
825 0xa5f001ac,
826 0x00b7f006,
827 0x98140c98,
828 0xe7f0150d,
829 0x5c21f500,
830 0x08a7f001,
831 0x010321f5,
832 0x020721f5,
833 0xf02201f4,
834 0x21f40ca7,
835 0x1017f1c9,
836 0x0614b60a,
837 0xd00527f0,
838/* 0x08c2: ctx_xfer_post_save_wait */
839 0x12cf0012,
840 0x0522fd00,
841 0xf4fa1bf4,
842/* 0x08ce: ctx_xfer_post */
843 0xf7f02e02,
844 0x3121f502,
845 0xf5f4bd06, 846 0xf5f4bd06,
846 0xf5067221, 847 0xf4062b21,
847 0xf5022621, 848 0x01981011,
848 0xbd064021, 849 0x0511fd40,
849 0x3121f5f4, 850 0xf5070bf4,
850 0x1011f406, 851/* 0x08ff: ctx_xfer_no_post_mmio */
851 0xfd800198, 852/* 0x08ff: ctx_xfer_done */
852 0x0bf40511, 853 0xf807b721,
853 0xb121f507, 854 0x00000000,
854/* 0x08f9: ctx_xfer_no_post_mmio */ 855 0x00000000,
855/* 0x08f9: ctx_xfer_done */ 856 0x00000000,
856 0x0000f807, 857 0x00000000,
858 0x00000000,
859 0x00000000,
860 0x00000000,
861 0x00000000,
862 0x00000000,
863 0x00000000,
864 0x00000000,
865 0x00000000,
866 0x00000000,
867 0x00000000,
868 0x00000000,
869 0x00000000,
870 0x00000000,
871 0x00000000,
872 0x00000000,
873 0x00000000,
874 0x00000000,
875 0x00000000,
876 0x00000000,
877 0x00000000,
878 0x00000000,
879 0x00000000,
880 0x00000000,
881 0x00000000,
882 0x00000000,
883 0x00000000,
884 0x00000000,
885 0x00000000,
886 0x00000000,
887 0x00000000,
888 0x00000000,
889 0x00000000,
890 0x00000000,
891 0x00000000,
892 0x00000000,
893 0x00000000,
894 0x00000000,
895 0x00000000,
896 0x00000000,
897 0x00000000,
898 0x00000000,
899 0x00000000,
900 0x00000000,
901 0x00000000,
902 0x00000000,
903 0x00000000,
904 0x00000000,
905 0x00000000,
906 0x00000000,
907 0x00000000,
908 0x00000000,
909 0x00000000,
910 0x00000000,
911 0x00000000,
912 0x00000000,
913 0x00000000,
914 0x00000000,
915 0x00000000,
916 0x00000000,
857 0x00000000, 917 0x00000000,
858}; 918};
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvf0.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvf0.fuc
new file mode 100644
index 000000000000..ec42ed29b50d
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvf0.fuc
@@ -0,0 +1,40 @@
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 <bskeggs@redhat.com>
23 */
24
25#define CHIPSET GK110
26#include "macros.fuc"
27
28.section #nvf0_grhub_data
29#define INCLUDE_DATA
30#include "com.fuc"
31#include "hub.fuc"
32#undef INCLUDE_DATA
33
34.section #nvf0_grhub_code
35#define INCLUDE_CODE
36bra #init
37#include "com.fuc"
38#include "hub.fuc"
39.align 256
40#undef INCLUDE_CODE
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvf0.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvf0.fuc.h
new file mode 100644
index 000000000000..438506d14749
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvf0.fuc.h
@@ -0,0 +1,918 @@
1uint32_t nvf0_grhub_data[] = {
2/* 0x0000: hub_mmio_list_head */
3 0x00000300,
4/* 0x0004: hub_mmio_list_tail */
5 0x00000304,
6/* 0x0008: gpc_count */
7 0x00000000,
8/* 0x000c: rop_count */
9 0x00000000,
10/* 0x0010: cmd_queue */
11 0x00000000,
12 0x00000000,
13 0x00000000,
14 0x00000000,
15 0x00000000,
16 0x00000000,
17 0x00000000,
18 0x00000000,
19 0x00000000,
20 0x00000000,
21 0x00000000,
22 0x00000000,
23 0x00000000,
24 0x00000000,
25 0x00000000,
26 0x00000000,
27 0x00000000,
28 0x00000000,
29/* 0x0058: ctx_current */
30 0x00000000,
31 0x00000000,
32 0x00000000,
33 0x00000000,
34 0x00000000,
35 0x00000000,
36 0x00000000,
37 0x00000000,
38 0x00000000,
39 0x00000000,
40 0x00000000,
41 0x00000000,
42 0x00000000,
43 0x00000000,
44 0x00000000,
45 0x00000000,
46 0x00000000,
47 0x00000000,
48 0x00000000,
49 0x00000000,
50 0x00000000,
51 0x00000000,
52 0x00000000,
53 0x00000000,
54 0x00000000,
55 0x00000000,
56 0x00000000,
57 0x00000000,
58 0x00000000,
59 0x00000000,
60 0x00000000,
61 0x00000000,
62 0x00000000,
63 0x00000000,
64 0x00000000,
65 0x00000000,
66 0x00000000,
67 0x00000000,
68 0x00000000,
69 0x00000000,
70 0x00000000,
71 0x00000000,
72/* 0x0100: chan_data */
73/* 0x0100: chan_mmio_count */
74 0x00000000,
75/* 0x0104: chan_mmio_address */
76 0x00000000,
77 0x00000000,
78 0x00000000,
79 0x00000000,
80 0x00000000,
81 0x00000000,
82 0x00000000,
83 0x00000000,
84 0x00000000,
85 0x00000000,
86 0x00000000,
87 0x00000000,
88 0x00000000,
89 0x00000000,
90 0x00000000,
91 0x00000000,
92 0x00000000,
93 0x00000000,
94 0x00000000,
95 0x00000000,
96 0x00000000,
97 0x00000000,
98 0x00000000,
99 0x00000000,
100 0x00000000,
101 0x00000000,
102 0x00000000,
103 0x00000000,
104 0x00000000,
105 0x00000000,
106 0x00000000,
107 0x00000000,
108 0x00000000,
109 0x00000000,
110 0x00000000,
111 0x00000000,
112 0x00000000,
113 0x00000000,
114 0x00000000,
115 0x00000000,
116 0x00000000,
117 0x00000000,
118 0x00000000,
119 0x00000000,
120 0x00000000,
121 0x00000000,
122 0x00000000,
123 0x00000000,
124 0x00000000,
125 0x00000000,
126 0x00000000,
127 0x00000000,
128 0x00000000,
129 0x00000000,
130 0x00000000,
131 0x00000000,
132 0x00000000,
133 0x00000000,
134 0x00000000,
135 0x00000000,
136 0x00000000,
137 0x00000000,
138 0x00000000,
139/* 0x0200: xfer_data */
140 0x00000000,
141 0x00000000,
142 0x00000000,
143 0x00000000,
144 0x00000000,
145 0x00000000,
146 0x00000000,
147 0x00000000,
148 0x00000000,
149 0x00000000,
150 0x00000000,
151 0x00000000,
152 0x00000000,
153 0x00000000,
154 0x00000000,
155 0x00000000,
156 0x00000000,
157 0x00000000,
158 0x00000000,
159 0x00000000,
160 0x00000000,
161 0x00000000,
162 0x00000000,
163 0x00000000,
164 0x00000000,
165 0x00000000,
166 0x00000000,
167 0x00000000,
168 0x00000000,
169 0x00000000,
170 0x00000000,
171 0x00000000,
172 0x00000000,
173 0x00000000,
174 0x00000000,
175 0x00000000,
176 0x00000000,
177 0x00000000,
178 0x00000000,
179 0x00000000,
180 0x00000000,
181 0x00000000,
182 0x00000000,
183 0x00000000,
184 0x00000000,
185 0x00000000,
186 0x00000000,
187 0x00000000,
188 0x00000000,
189 0x00000000,
190 0x00000000,
191 0x00000000,
192 0x00000000,
193 0x00000000,
194 0x00000000,
195 0x00000000,
196 0x00000000,
197 0x00000000,
198 0x00000000,
199 0x00000000,
200 0x00000000,
201 0x00000000,
202 0x00000000,
203 0x00000000,
204/* 0x0300: hub_mmio_list_base */
205 0x0417e91c,
206};
207
208uint32_t nvf0_grhub_code[] = {
209 0x031b0ef5,
210/* 0x0004: queue_put */
211 0x9800d898,
212 0x86f001d9,
213 0x0489b808,
214 0xf00c1bf4,
215 0x21f502f7,
216 0x00f802fe,
217/* 0x001c: queue_put_next */
218 0xb60798c4,
219 0x8dbb0384,
220 0x0880b600,
221 0x80008e80,
222 0x90b6018f,
223 0x0f94f001,
224 0xf801d980,
225/* 0x0039: queue_get */
226 0x0131f400,
227 0x9800d898,
228 0x89b801d9,
229 0x210bf404,
230 0xb60789c4,
231 0x9dbb0394,
232 0x0890b600,
233 0x98009e98,
234 0x80b6019f,
235 0x0f84f001,
236 0xf400d880,
237/* 0x0066: queue_get_done */
238 0x00f80132,
239/* 0x0068: nv_rd32 */
240 0x0728b7f1,
241 0xb906b4b6,
242 0xc9f002ec,
243 0x00bcd01f,
244/* 0x0078: nv_rd32_wait */
245 0xc800bccf,
246 0x1bf41fcc,
247 0x06a7f0fa,
248 0x010921f5,
249 0xf840bfcf,
250/* 0x008d: nv_wr32 */
251 0x28b7f100,
252 0x06b4b607,
253 0xb980bfd0,
254 0xc9f002ec,
255 0x1ec9f01f,
256/* 0x00a3: nv_wr32_wait */
257 0xcf00bcd0,
258 0xccc800bc,
259 0xfa1bf41f,
260/* 0x00ae: watchdog_reset */
261 0x87f100f8,
262 0x84b60430,
263 0x1ff9f006,
264 0xf8008fd0,
265/* 0x00bd: watchdog_clear */
266 0x3087f100,
267 0x0684b604,
268 0xf80080d0,
269/* 0x00c9: wait_donez */
270 0xf094bd00,
271 0x07f10099,
272 0x03f03700,
273 0x0009d002,
274 0x07f104bd,
275 0x03f00600,
276 0x000ad002,
277/* 0x00e6: wait_donez_ne */
278 0x87f104bd,
279 0x83f00000,
280 0x0088cf01,
281 0xf4888aff,
282 0x94bdf31b,
283 0xf10099f0,
284 0xf0170007,
285 0x09d00203,
286 0xf804bd00,
287/* 0x0109: wait_doneo */
288 0xf094bd00,
289 0x07f10099,
290 0x03f03700,
291 0x0009d002,
292 0x87f104bd,
293 0x84b60818,
294 0x008ad006,
295/* 0x0124: wait_doneo_e */
296 0x040087f1,
297 0xcf0684b6,
298 0x8aff0088,
299 0xf30bf488,
300 0x99f094bd,
301 0x0007f100,
302 0x0203f017,
303 0xbd0009d0,
304/* 0x0147: mmctx_size */
305 0xbd00f804,
306/* 0x0149: nv_mmctx_size_loop */
307 0x00e89894,
308 0xb61a85b6,
309 0x84b60180,
310 0x0098bb02,
311 0xb804e0b6,
312 0x1bf404ef,
313 0x029fb9eb,
314/* 0x0166: mmctx_xfer */
315 0x94bd00f8,
316 0xf10199f0,
317 0xf0370007,
318 0x09d00203,
319 0xf104bd00,
320 0xb6071087,
321 0x94bd0684,
322 0xf405bbfd,
323 0x8bd0090b,
324 0x0099f000,
325/* 0x018c: mmctx_base_disabled */
326 0xf405eefd,
327 0x8ed00c0b,
328 0xc08fd080,
329/* 0x019b: mmctx_multi_disabled */
330 0xb70199f0,
331 0xc8010080,
332 0xb4b600ab,
333 0x0cb9f010,
334 0xb601aec8,
335 0xbefd11e4,
336 0x008bd005,
337/* 0x01b4: mmctx_exec_loop */
338/* 0x01b4: mmctx_wait_free */
339 0xf0008ecf,
340 0x0bf41fe4,
341 0x00ce98fa,
342 0xd005e9fd,
343 0xc0b6c08e,
344 0x04cdb804,
345 0xc8e81bf4,
346 0x1bf402ab,
347/* 0x01d5: mmctx_fini_wait */
348 0x008bcf18,
349 0xb01fb4f0,
350 0x1bf410b4,
351 0x02a7f0f7,
352 0xf4c921f4,
353/* 0x01ea: mmctx_stop */
354 0xabc81b0e,
355 0x10b4b600,
356 0xf00cb9f0,
357 0x8bd012b9,
358/* 0x01f9: mmctx_stop_wait */
359 0x008bcf00,
360 0xf412bbc8,
361/* 0x0202: mmctx_done */
362 0x94bdfa1b,
363 0xf10199f0,
364 0xf0170007,
365 0x09d00203,
366 0xf804bd00,
367/* 0x0215: strand_wait */
368 0xf0a0f900,
369 0x21f402a7,
370 0xf8a0fcc9,
371/* 0x0221: strand_pre */
372 0xfc87f100,
373 0x0283f04a,
374 0xd00c97f0,
375 0x21f50089,
376 0x00f80215,
377/* 0x0234: strand_post */
378 0x4afc87f1,
379 0xf00283f0,
380 0x89d00d97,
381 0x1521f500,
382/* 0x0247: strand_set */
383 0xf100f802,
384 0xf04ffca7,
385 0xaba202a3,
386 0xc7f00500,
387 0x00acd00f,
388 0xd00bc7f0,
389 0x21f500bc,
390 0xaed00215,
391 0x0ac7f000,
392 0xf500bcd0,
393 0xf8021521,
394/* 0x0271: strand_ctx_init */
395 0xf094bd00,
396 0x07f10399,
397 0x03f03700,
398 0x0009d002,
399 0x21f504bd,
400 0xe7f00221,
401 0x4721f503,
402 0xfca7f102,
403 0x02a3f046,
404 0x0400aba0,
405 0xf040a0d0,
406 0xbcd001c7,
407 0x1521f500,
408 0x010c9202,
409 0xf000acd0,
410 0xbcd002c7,
411 0x1521f500,
412 0x3421f502,
413 0x8087f102,
414 0x0684b608,
415 0xb70089cf,
416 0x95220080,
417/* 0x02ca: ctx_init_strand_loop */
418 0x8ed008fe,
419 0x408ed000,
420 0xb6808acf,
421 0xa0b606a5,
422 0x00eabb01,
423 0xb60480b6,
424 0x1bf40192,
425 0x08e4b6e8,
426 0xbdf2efbc,
427 0x0399f094,
428 0x170007f1,
429 0xd00203f0,
430 0x04bd0009,
431/* 0x02fe: error */
432 0x07f100f8,
433 0x03f00500,
434 0x000fd002,
435 0xf7f004bd,
436 0x0007f101,
437 0x0303f007,
438 0xbd000fd0,
439/* 0x031b: init */
440 0xbd00f804,
441 0x0004fe04,
442 0xf10007fe,
443 0xf0120017,
444 0x12d00227,
445 0xb117f100,
446 0x0010fe05,
447 0x040017f1,
448 0xf1c010d0,
449 0xb6040437,
450 0x27f10634,
451 0x32d02003,
452 0x0427f100,
453 0x0132d020,
454 0x200b27f1,
455 0xf10232d0,
456 0xd0200c27,
457 0x27f10732,
458 0x24b60c24,
459 0x0003b906,
460 0xf10023d0,
461 0xf0870427,
462 0x12d00023,
463 0x0012b700,
464 0x0427f001,
465 0xf40012d0,
466 0xe7f11031,
467 0xe3f09604,
468 0x6821f440,
469 0x8090f1c7,
470 0xf4f00301,
471 0x020f801f,
472 0xbb0117f0,
473 0x12b6041f,
474 0x0c27f101,
475 0x0624b604,
476 0xd00021d0,
477 0x17f14021,
478 0x0e980100,
479 0x010f9800,
480 0x014721f5,
481 0x070037f1,
482 0x950634b6,
483 0x34d00814,
484 0x4034d000,
485 0x130030b7,
486 0xb6001fbb,
487 0x3fd002f5,
488 0x0815b600,
489 0xb60110b6,
490 0x1fb90814,
491 0x7121f502,
492 0x001fbb02,
493 0xf1020398,
494 0xf0200047,
495/* 0x03f6: init_gpc */
496 0x4ea05043,
497 0x1fb90804,
498 0x8d21f402,
499 0x010c4ea0,
500 0x21f4f4bd,
501 0x044ea08d,
502 0x8d21f401,
503 0x01004ea0,
504 0xf402f7f0,
505 0x4ea08d21,
506/* 0x041e: init_gpc_wait */
507 0x21f40800,
508 0x1fffc868,
509 0xa0fa0bf4,
510 0xf408044e,
511 0x1fbb6821,
512 0x0040b700,
513 0x0132b680,
514 0xf1be1bf4,
515 0xf0010007,
516 0x01d00203,
517 0xbd04bd00,
518 0x1f19f014,
519 0x300007f1,
520 0xd00203f0,
521 0x04bd0001,
522/* 0x0458: main */
523 0xf40031f4,
524 0xd7f00028,
525 0x3921f410,
526 0xb1f401f4,
527 0xf54001e4,
528 0xbd00de1b,
529 0x0499f094,
530 0x370007f1,
531 0xd00203f0,
532 0x04bd0009,
533 0x0b0017f1,
534 0xcf0614b6,
535 0x11cf4012,
536 0x1f13c800,
537 0x00870bf5,
538 0xf41f23c8,
539 0x20f9620b,
540 0xbd0212b9,
541 0x0799f094,
542 0x370007f1,
543 0xd00203f0,
544 0x04bd0009,
545 0xf40132f4,
546 0x21f50231,
547 0x94bd0801,
548 0xf10799f0,
549 0xf0170007,
550 0x09d00203,
551 0xfc04bd00,
552 0xf094bd20,
553 0x07f10699,
554 0x03f03700,
555 0x0009d002,
556 0x31f404bd,
557 0x0121f501,
558 0xf094bd08,
559 0x07f10699,
560 0x03f01700,
561 0x0009d002,
562 0x0ef404bd,
563/* 0x04f9: chsw_prev_no_next */
564 0xb920f931,
565 0x32f40212,
566 0x0232f401,
567 0x080121f5,
568 0x17f120fc,
569 0x14b60b00,
570 0x0012d006,
571/* 0x0517: chsw_no_prev */
572 0xc8130ef4,
573 0x0bf41f23,
574 0x0131f40d,
575 0xf50232f4,
576/* 0x0527: chsw_done */
577 0xf1080121,
578 0xb60b0c17,
579 0x27f00614,
580 0x0012d001,
581 0x99f094bd,
582 0x0007f104,
583 0x0203f017,
584 0xbd0009d0,
585 0x130ef504,
586/* 0x0549: main_not_ctx_switch */
587 0x01e4b0ff,
588 0xb90d1bf4,
589 0x21f502f2,
590 0x0ef40795,
591/* 0x0559: main_not_ctx_chan */
592 0x02e4b046,
593 0xbd321bf4,
594 0x0799f094,
595 0x370007f1,
596 0xd00203f0,
597 0x04bd0009,
598 0xf40132f4,
599 0x21f50232,
600 0x94bd0801,
601 0xf10799f0,
602 0xf0170007,
603 0x09d00203,
604 0xf404bd00,
605/* 0x058e: main_not_ctx_save */
606 0xef94110e,
607 0x01f5f010,
608 0x02fe21f5,
609 0xfec00ef5,
610/* 0x059c: main_done */
611 0x29f024bd,
612 0x0007f11f,
613 0x0203f030,
614 0xbd0002d0,
615 0xab0ef504,
616/* 0x05b1: ih */
617 0xfe80f9fe,
618 0x80f90188,
619 0xa0f990f9,
620 0xd0f9b0f9,
621 0xf0f9e0f9,
622 0x0acf04bd,
623 0x04abc480,
624 0xf11d0bf4,
625 0xf01900b7,
626 0xbecf10d7,
627 0x00bfcf40,
628 0xb70421f4,
629 0xf00400b0,
630 0xbed001e7,
631/* 0x05e9: ih_no_fifo */
632 0x00abe400,
633 0x0d0bf401,
634 0xf110d7f0,
635 0xf44001e7,
636/* 0x05fa: ih_no_ctxsw */
637 0xb7f10421,
638 0xb0bd0104,
639 0xf4b4abff,
640 0xa7f10d0b,
641 0xa4b60c1c,
642 0x00abd006,
643/* 0x0610: ih_no_other */
644 0xfc400ad0,
645 0xfce0fcf0,
646 0xfcb0fcd0,
647 0xfc90fca0,
648 0x0088fe80,
649 0x32f480fc,
650/* 0x062b: ctx_4170s */
651 0xf101f800,
652 0xf04170e7,
653 0xf5f040e3,
654 0x8d21f410,
655/* 0x063a: ctx_4170w */
656 0xe7f100f8,
657 0xe3f04170,
658 0x6821f440,
659 0xf410f4f0,
660 0x00f8f31b,
661/* 0x064c: ctx_redswitch */
662 0x0614e7f1,
663 0xf106e4b6,
664 0xd00270f7,
665 0xf7f000ef,
666/* 0x065d: ctx_redswitch_delay */
667 0x01f2b608,
668 0xf1fd1bf4,
669 0xd00770f7,
670 0x00f800ef,
671/* 0x066c: ctx_86c */
672 0x086ce7f1,
673 0xd006e4b6,
674 0xe7f100ef,
675 0xe3f08a14,
676 0x8d21f440,
677 0xa86ce7f1,
678 0xf441e3f0,
679 0x00f88d21,
680/* 0x068c: ctx_load */
681 0x99f094bd,
682 0x0007f105,
683 0x0203f037,
684 0xbd0009d0,
685 0x0ca7f004,
686 0xf1c921f4,
687 0xb60a2417,
688 0x10d00614,
689 0x0037f100,
690 0x0634b60b,
691 0xf14032d0,
692 0xb60a0c17,
693 0x47f00614,
694 0x0012d007,
695/* 0x06c7: ctx_chan_wait_0 */
696 0xcf4014d0,
697 0x44f04014,
698 0xfa1bf41f,
699 0xfe0032d0,
700 0x2af0000b,
701 0x0424b61f,
702 0xbd0220b6,
703 0x0899f094,
704 0x370007f1,
705 0xd00203f0,
706 0x04bd0009,
707 0x0a0417f1,
708 0xd00614b6,
709 0x17f10012,
710 0x14b60a20,
711 0x0227f006,
712 0x800023f1,
713 0xf00012d0,
714 0x27f11017,
715 0x23f00200,
716 0x0512fa02,
717 0x94bd03f8,
718 0xf10899f0,
719 0xf0170007,
720 0x09d00203,
721 0x9804bd00,
722 0x14b68101,
723 0x80029818,
724 0xfd0825b6,
725 0x01800512,
726 0xf094bd16,
727 0x07f10999,
728 0x03f03700,
729 0x0009d002,
730 0x27f104bd,
731 0x24b60a04,
732 0x0021d006,
733 0xf10127f0,
734 0xb60a2017,
735 0x12d00614,
736 0x0017f100,
737 0x0613f001,
738 0xf80501fa,
739 0xf094bd03,
740 0x07f10999,
741 0x03f01700,
742 0x0009d002,
743 0x94bd04bd,
744 0xf10599f0,
745 0xf0170007,
746 0x09d00203,
747 0xf804bd00,
748/* 0x0795: ctx_chan */
749 0x8c21f500,
750 0x0ca7f006,
751 0xf1c921f4,
752 0xb60a1017,
753 0x27f00614,
754 0x0012d005,
755/* 0x07ac: ctx_chan_wait */
756 0xfd0012cf,
757 0x1bf40522,
758/* 0x07b7: ctx_mmio_exec */
759 0x9800f8fa,
760 0x27f14103,
761 0x24b60a04,
762 0x0023d006,
763/* 0x07c6: ctx_mmio_loop */
764 0x34c434bd,
765 0x0f1bf4ff,
766 0x020057f1,
767 0xfa0653f0,
768 0x03f80535,
769/* 0x07d8: ctx_mmio_pull */
770 0x98804e98,
771 0x21f4814f,
772 0x0830b68d,
773 0xf40112b6,
774/* 0x07ea: ctx_mmio_done */
775 0x0398df1b,
776 0x0023d016,
777 0xf1400080,
778 0xf0010017,
779 0x01fa0613,
780 0xf803f806,
781/* 0x0801: ctx_xfer */
782 0x00f7f100,
783 0x06f4b60c,
784 0xd004e7f0,
785/* 0x080e: ctx_xfer_idle */
786 0xfecf80fe,
787 0x00e4f100,
788 0xf91bf420,
789 0xf40611f4,
790/* 0x081e: ctx_xfer_pre */
791 0xf7f00d02,
792 0x6c21f510,
793 0x1c11f406,
794/* 0x0828: ctx_xfer_pre_load */
795 0xf502f7f0,
796 0xf5062b21,
797 0xf5063a21,
798 0xbd064c21,
799 0x2b21f5f4,
800 0x8c21f506,
801/* 0x0841: ctx_xfer_exec */
802 0x16019806,
803 0x041427f1,
804 0xd00624b6,
805 0xe7f10020,
806 0xe3f0a500,
807 0x021fb941,
808 0xb68d21f4,
809 0xfcf004e0,
810 0x022cf001,
811 0xfd0124b6,
812 0x21f405f2,
813 0xfc17f18d,
814 0x0213f04a,
815 0xd00c27f0,
816 0x21f50012,
817 0x27f10215,
818 0x23f047fc,
819 0x0020d002,
820 0xb6012cf0,
821 0x12d00320,
822 0x01acf000,
823 0xf006a5f0,
824 0x0c9800b7,
825 0x010d9800,
826 0xf500e7f0,
827 0xf0016621,
828 0x21f508a7,
829 0x21f50109,
830 0x01f40215,
831 0x0ca7f022,
832 0xf1c921f4,
833 0xb60a1017,
834 0x27f00614,
835 0x0012d005,
836/* 0x08c8: ctx_xfer_post_save_wait */
837 0xfd0012cf,
838 0x1bf40522,
839 0x2e02f4fa,
840/* 0x08d4: ctx_xfer_post */
841 0xf502f7f0,
842 0xbd062b21,
843 0x6c21f5f4,
844 0x3421f506,
845 0x3a21f502,
846 0xf5f4bd06,
847 0xf4062b21,
848 0x01981011,
849 0x0511fd40,
850 0xf5070bf4,
851/* 0x08ff: ctx_xfer_no_post_mmio */
852/* 0x08ff: ctx_xfer_done */
853 0xf807b721,
854 0x00000000,
855 0x00000000,
856 0x00000000,
857 0x00000000,
858 0x00000000,
859 0x00000000,
860 0x00000000,
861 0x00000000,
862 0x00000000,
863 0x00000000,
864 0x00000000,
865 0x00000000,
866 0x00000000,
867 0x00000000,
868 0x00000000,
869 0x00000000,
870 0x00000000,
871 0x00000000,
872 0x00000000,
873 0x00000000,
874 0x00000000,
875 0x00000000,
876 0x00000000,
877 0x00000000,
878 0x00000000,
879 0x00000000,
880 0x00000000,
881 0x00000000,
882 0x00000000,
883 0x00000000,
884 0x00000000,
885 0x00000000,
886 0x00000000,
887 0x00000000,
888 0x00000000,
889 0x00000000,
890 0x00000000,
891 0x00000000,
892 0x00000000,
893 0x00000000,
894 0x00000000,
895 0x00000000,
896 0x00000000,
897 0x00000000,
898 0x00000000,
899 0x00000000,
900 0x00000000,
901 0x00000000,
902 0x00000000,
903 0x00000000,
904 0x00000000,
905 0x00000000,
906 0x00000000,
907 0x00000000,
908 0x00000000,
909 0x00000000,
910 0x00000000,
911 0x00000000,
912 0x00000000,
913 0x00000000,
914 0x00000000,
915 0x00000000,
916 0x00000000,
917 0x00000000,
918};
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/macros.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/macros.fuc
new file mode 100644
index 000000000000..33a5a82eccbd
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/macros.fuc
@@ -0,0 +1,89 @@
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 <bskeggs@redhat.com>
23 */
24
25#include "os.h"
26
27#define GF100 0xc0
28#define GF117 0xd7
29#define GK100 0xe0
30#define GK110 0xf0
31
32#define NV_PGRAPH_FECS_SIGNAL 0x409400
33#if CHIPSET < GK110
34#define NV_PGRAPH_FECS_CC_SCRATCH_VAL(n) ((n) * 4 + 0x409800)
35#define NV_PGRAPH_FECS_CC_SCRATCH_SET(n) ((n) * 4 + 0x409820)
36#define NV_PGRAPH_FECS_CC_SCRATCH_CLR(n) ((n) * 4 + 0x409840)
37#else
38#define NV_PGRAPH_FECS_CC_SCRATCH_VAL(n) ((n) * 4 + 0x409800)
39#define NV_PGRAPH_FECS_CC_SCRATCH_CLR(n) ((n) * 4 + 0x409840)
40#define NV_PGRAPH_FECS_CC_SCRATCH_SET(n) ((n) * 4 + 0x4098c0)
41#endif
42#define NV_PGRAPH_FECS_INTR_UP_SET 0x409c1c
43
44#if CHIPSET < GK110
45#define NV_PGRAPH_GPCX_GPCCS_CC_SCRATCH_VAL(n) ((n) * 4 + 0x41a800)
46#define NV_PGRAPH_GPCX_GPCCS_CC_SCRATCH_SET(n) ((n) * 4 + 0x41a820)
47#define NV_PGRAPH_GPCX_GPCCS_CC_SCRATCH_CLR(n) ((n) * 4 + 0x41a840)
48#else
49#define NV_PGRAPH_GPCX_GPCCS_CC_SCRATCH_VAL(n) ((n) * 4 + 0x41a800)
50#define NV_PGRAPH_GPCX_GPCCS_CC_SCRATCH_CLR(n) ((n) * 4 + 0x41a840)
51#define NV_PGRAPH_GPCX_GPCCS_CC_SCRATCH_SET(n) ((n) * 4 + 0x41a8c0)
52#endif
53
54#define mmctx_data(r,c) .b32 (((c - 1) << 26) | r)
55#define queue_init .skip 72 // (2 * 4) + ((8 * 4) * 2)
56
57#define T_WAIT 0
58#define T_MMCTX 1
59#define T_STRWAIT 2
60#define T_STRINIT 3
61#define T_AUTO 4
62#define T_CHAN 5
63#define T_LOAD 6
64#define T_SAVE 7
65#define T_LCHAN 8
66#define T_LCTXH 9
67
68#define nv_mkmm(rv,r) /*
69*/ movw rv ((r) & 0x0000fffc) /*
70*/ sethi rv ((r) & 0x00ff0000)
71#define nv_mkio(rv,r,i) /*
72*/ nv_mkmm(rv, (((r) & 0xffc) << 6) | ((i) << 2))
73
74#define nv_iord(rv,r,i) /*
75*/ nv_mkio(rv,r,i) /*
76*/ iord rv I[rv]
77#define nv_iowr(r,i,rv) /*
78*/ nv_mkio($r0,r,i) /*
79*/ iowr I[$r0] rv /*
80*/ clear b32 $r0
81
82#define trace_set(bit) /*
83*/ clear b32 $r9 /*
84*/ bset $r9 bit /*
85*/ nv_iowr(NV_PGRAPH_FECS_CC_SCRATCH_SET(7), 0, $r9)
86#define trace_clr(bit) /*
87*/ clear b32 $r9 /*
88*/ bset $r9 bit /*
89*/ nv_iowr(NV_PGRAPH_FECS_CC_SCRATCH_CLR(7), 0, $r9)
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/nve0.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/nve0.fuc
deleted file mode 100644
index f16a5d53319d..000000000000
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/nve0.fuc
+++ /dev/null
@@ -1,400 +0,0 @@
1/* fuc microcode util functions for nve0 PGRAPH
2 *
3 * Copyright 2011 Red Hat Inc.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 * OTHER DEALINGS IN THE SOFTWARE.
22 *
23 * Authors: Ben Skeggs
24 */
25
26define(`mmctx_data', `.b32 eval((($2 - 1) << 26) | $1)')
27define(`queue_init', `.skip eval((2 * 4) + ((8 * 4) * 2))')
28
29ifdef(`include_code', `
30// Error codes
31define(`E_BAD_COMMAND', 0x01)
32define(`E_CMD_OVERFLOW', 0x02)
33
34// Util macros to help with debugging ucode hangs etc
35define(`T_WAIT', 0)
36define(`T_MMCTX', 1)
37define(`T_STRWAIT', 2)
38define(`T_STRINIT', 3)
39define(`T_AUTO', 4)
40define(`T_CHAN', 5)
41define(`T_LOAD', 6)
42define(`T_SAVE', 7)
43define(`T_LCHAN', 8)
44define(`T_LCTXH', 9)
45
46define(`trace_set', `
47 mov $r8 0x83c
48 shl b32 $r8 6
49 clear b32 $r9
50 bset $r9 $1
51 iowr I[$r8 + 0x000] $r9 // CC_SCRATCH[7]
52')
53
54define(`trace_clr', `
55 mov $r8 0x85c
56 shl b32 $r8 6
57 clear b32 $r9
58 bset $r9 $1
59 iowr I[$r8 + 0x000] $r9 // CC_SCRATCH[7]
60')
61
62// queue_put - add request to queue
63//
64// In : $r13 queue pointer
65// $r14 command
66// $r15 data
67//
68queue_put:
69 // make sure we have space..
70 ld b32 $r8 D[$r13 + 0x0] // GET
71 ld b32 $r9 D[$r13 + 0x4] // PUT
72 xor $r8 8
73 cmpu b32 $r8 $r9
74 bra ne #queue_put_next
75 mov $r15 E_CMD_OVERFLOW
76 call #error
77 ret
78
79 // store cmd/data on queue
80 queue_put_next:
81 and $r8 $r9 7
82 shl b32 $r8 3
83 add b32 $r8 $r13
84 add b32 $r8 8
85 st b32 D[$r8 + 0x0] $r14
86 st b32 D[$r8 + 0x4] $r15
87
88 // update PUT
89 add b32 $r9 1
90 and $r9 0xf
91 st b32 D[$r13 + 0x4] $r9
92 ret
93
94// queue_get - fetch request from queue
95//
96// In : $r13 queue pointer
97//
98// Out: $p1 clear on success (data available)
99// $r14 command
100// $r15 data
101//
102queue_get:
103 bset $flags $p1
104 ld b32 $r8 D[$r13 + 0x0] // GET
105 ld b32 $r9 D[$r13 + 0x4] // PUT
106 cmpu b32 $r8 $r9
107 bra e #queue_get_done
108 // fetch first cmd/data pair
109 and $r9 $r8 7
110 shl b32 $r9 3
111 add b32 $r9 $r13
112 add b32 $r9 8
113 ld b32 $r14 D[$r9 + 0x0]
114 ld b32 $r15 D[$r9 + 0x4]
115
116 // update GET
117 add b32 $r8 1
118 and $r8 0xf
119 st b32 D[$r13 + 0x0] $r8
120 bclr $flags $p1
121queue_get_done:
122 ret
123
124// nv_rd32 - read 32-bit value from nv register
125//
126// In : $r14 register
127// Out: $r15 value
128//
129nv_rd32:
130 mov $r11 0x728
131 shl b32 $r11 6
132 mov b32 $r12 $r14
133 bset $r12 31 // MMIO_CTRL_PENDING
134 iowr I[$r11 + 0x000] $r12 // MMIO_CTRL
135 nv_rd32_wait:
136 iord $r12 I[$r11 + 0x000]
137 xbit $r12 $r12 31
138 bra ne #nv_rd32_wait
139 mov $r10 6 // DONE_MMIO_RD
140 call #wait_doneo
141 iord $r15 I[$r11 + 0x100] // MMIO_RDVAL
142 ret
143
144// nv_wr32 - write 32-bit value to nv register
145//
146// In : $r14 register
147// $r15 value
148//
149nv_wr32:
150 mov $r11 0x728
151 shl b32 $r11 6
152 iowr I[$r11 + 0x200] $r15 // MMIO_WRVAL
153 mov b32 $r12 $r14
154 bset $r12 31 // MMIO_CTRL_PENDING
155 bset $r12 30 // MMIO_CTRL_WRITE
156 iowr I[$r11 + 0x000] $r12 // MMIO_CTRL
157 nv_wr32_wait:
158 iord $r12 I[$r11 + 0x000]
159 xbit $r12 $r12 31
160 bra ne #nv_wr32_wait
161 ret
162
163// (re)set watchdog timer
164//
165// In : $r15 timeout
166//
167watchdog_reset:
168 mov $r8 0x430
169 shl b32 $r8 6
170 bset $r15 31
171 iowr I[$r8 + 0x000] $r15
172 ret
173
174// clear watchdog timer
175watchdog_clear:
176 mov $r8 0x430
177 shl b32 $r8 6
178 iowr I[$r8 + 0x000] $r0
179 ret
180
181// wait_done{z,o} - wait on FUC_DONE bit to become clear/set
182//
183// In : $r10 bit to wait on
184//
185define(`wait_done', `
186$1:
187 trace_set(T_WAIT);
188 mov $r8 0x818
189 shl b32 $r8 6
190 iowr I[$r8 + 0x000] $r10 // CC_SCRATCH[6] = wait bit
191 wait_done_$1:
192 mov $r8 0x400
193 shl b32 $r8 6
194 iord $r8 I[$r8 + 0x000] // DONE
195 xbit $r8 $r8 $r10
196 bra $2 #wait_done_$1
197 trace_clr(T_WAIT)
198 ret
199')
200wait_done(wait_donez, ne)
201wait_done(wait_doneo, e)
202
203// mmctx_size - determine size of a mmio list transfer
204//
205// In : $r14 mmio list head
206// $r15 mmio list tail
207// Out: $r15 transfer size (in bytes)
208//
209mmctx_size:
210 clear b32 $r9
211 nv_mmctx_size_loop:
212 ld b32 $r8 D[$r14]
213 shr b32 $r8 26
214 add b32 $r8 1
215 shl b32 $r8 2
216 add b32 $r9 $r8
217 add b32 $r14 4
218 cmpu b32 $r14 $r15
219 bra ne #nv_mmctx_size_loop
220 mov b32 $r15 $r9
221 ret
222
223// mmctx_xfer - execute a list of mmio transfers
224//
225// In : $r10 flags
226// bit 0: direction (0 = save, 1 = load)
227// bit 1: set if first transfer
228// bit 2: set if last transfer
229// $r11 base
230// $r12 mmio list head
231// $r13 mmio list tail
232// $r14 multi_stride
233// $r15 multi_mask
234//
235mmctx_xfer:
236 trace_set(T_MMCTX)
237 mov $r8 0x710
238 shl b32 $r8 6
239 clear b32 $r9
240 or $r11 $r11
241 bra e #mmctx_base_disabled
242 iowr I[$r8 + 0x000] $r11 // MMCTX_BASE
243 bset $r9 0 // BASE_EN
244 mmctx_base_disabled:
245 or $r14 $r14
246 bra e #mmctx_multi_disabled
247 iowr I[$r8 + 0x200] $r14 // MMCTX_MULTI_STRIDE
248 iowr I[$r8 + 0x300] $r15 // MMCTX_MULTI_MASK
249 bset $r9 1 // MULTI_EN
250 mmctx_multi_disabled:
251 add b32 $r8 0x100
252
253 xbit $r11 $r10 0
254 shl b32 $r11 16 // DIR
255 bset $r11 12 // QLIMIT = 0x10
256 xbit $r14 $r10 1
257 shl b32 $r14 17
258 or $r11 $r14 // START_TRIGGER
259 iowr I[$r8 + 0x000] $r11 // MMCTX_CTRL
260
261 // loop over the mmio list, and send requests to the hw
262 mmctx_exec_loop:
263 // wait for space in mmctx queue
264 mmctx_wait_free:
265 iord $r14 I[$r8 + 0x000] // MMCTX_CTRL
266 and $r14 0x1f
267 bra e #mmctx_wait_free
268
269 // queue up an entry
270 ld b32 $r14 D[$r12]
271 or $r14 $r9
272 iowr I[$r8 + 0x300] $r14
273 add b32 $r12 4
274 cmpu b32 $r12 $r13
275 bra ne #mmctx_exec_loop
276
277 xbit $r11 $r10 2
278 bra ne #mmctx_stop
279 // wait for queue to empty
280 mmctx_fini_wait:
281 iord $r11 I[$r8 + 0x000] // MMCTX_CTRL
282 and $r11 0x1f
283 cmpu b32 $r11 0x10
284 bra ne #mmctx_fini_wait
285 mov $r10 2 // DONE_MMCTX
286 call #wait_donez
287 bra #mmctx_done
288 mmctx_stop:
289 xbit $r11 $r10 0
290 shl b32 $r11 16 // DIR
291 bset $r11 12 // QLIMIT = 0x10
292 bset $r11 18 // STOP_TRIGGER
293 iowr I[$r8 + 0x000] $r11 // MMCTX_CTRL
294 mmctx_stop_wait:
295 // wait for STOP_TRIGGER to clear
296 iord $r11 I[$r8 + 0x000] // MMCTX_CTRL
297 xbit $r11 $r11 18
298 bra ne #mmctx_stop_wait
299 mmctx_done:
300 trace_clr(T_MMCTX)
301 ret
302
303// Wait for DONE_STRAND
304//
305strand_wait:
306 push $r10
307 mov $r10 2
308 call #wait_donez
309 pop $r10
310 ret
311
312// unknown - call before issuing strand commands
313//
314strand_pre:
315 mov $r8 0x4afc
316 sethi $r8 0x20000
317 mov $r9 0xc
318 iowr I[$r8] $r9
319 call #strand_wait
320 ret
321
322// unknown - call after issuing strand commands
323//
324strand_post:
325 mov $r8 0x4afc
326 sethi $r8 0x20000
327 mov $r9 0xd
328 iowr I[$r8] $r9
329 call #strand_wait
330 ret
331
332// Selects strand set?!
333//
334// In: $r14 id
335//
336strand_set:
337 mov $r10 0x4ffc
338 sethi $r10 0x20000
339 sub b32 $r11 $r10 0x500
340 mov $r12 0xf
341 iowr I[$r10 + 0x000] $r12 // 0x93c = 0xf
342 mov $r12 0xb
343 iowr I[$r11 + 0x000] $r12 // 0x928 = 0xb
344 call #strand_wait
345 iowr I[$r10 + 0x000] $r14 // 0x93c = <id>
346 mov $r12 0xa
347 iowr I[$r11 + 0x000] $r12 // 0x928 = 0xa
348 call #strand_wait
349 ret
350
351// Initialise strand context data
352//
353// In : $r15 context base
354// Out: $r15 context size (in bytes)
355//
356// Strandset(?) 3 hardcoded currently
357//
358strand_ctx_init:
359 trace_set(T_STRINIT)
360 call #strand_pre
361 mov $r14 3
362 call #strand_set
363 mov $r10 0x46fc
364 sethi $r10 0x20000
365 add b32 $r11 $r10 0x400
366 iowr I[$r10 + 0x100] $r0 // STRAND_FIRST_GENE = 0
367 mov $r12 1
368 iowr I[$r11 + 0x000] $r12 // STRAND_CMD = LATCH_FIRST_GENE
369 call #strand_wait
370 sub b32 $r12 $r0 1
371 iowr I[$r10 + 0x000] $r12 // STRAND_GENE_CNT = 0xffffffff
372 mov $r12 2
373 iowr I[$r11 + 0x000] $r12 // STRAND_CMD = LATCH_GENE_CNT
374 call #strand_wait
375 call #strand_post
376
377 // read the size of each strand, poke the context offset of
378 // each into STRAND_{SAVE,LOAD}_SWBASE now, no need to worry
379 // about it later then.
380 mov $r8 0x880
381 shl b32 $r8 6
382 iord $r9 I[$r8 + 0x000] // STRANDS
383 add b32 $r8 0x2200
384 shr b32 $r14 $r15 8
385 ctx_init_strand_loop:
386 iowr I[$r8 + 0x000] $r14 // STRAND_SAVE_SWBASE
387 iowr I[$r8 + 0x100] $r14 // STRAND_LOAD_SWBASE
388 iord $r10 I[$r8 + 0x200] // STRAND_SIZE
389 shr b32 $r10 6
390 add b32 $r10 1
391 add b32 $r14 $r10
392 add b32 $r8 4
393 sub b32 $r9 1
394 bra ne #ctx_init_strand_loop
395
396 shl b32 $r14 8
397 sub b32 $r15 $r14 $r15
398 trace_clr(T_STRINIT)
399 ret
400')
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/os.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/os.h
new file mode 100644
index 000000000000..fd1d380de094
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/os.h
@@ -0,0 +1,7 @@
1#ifndef __NVKM_GRAPH_OS_H__
2#define __NVKM_GRAPH_OS_H__
3
4#define E_BAD_COMMAND 0x00000001
5#define E_CMD_OVERFLOW 0x00000002
6
7#endif
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c b/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c
index 1ac36110ca19..03de5175dd9f 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c
@@ -186,13 +186,6 @@ nv50_graph_cclass = {
186 * PGRAPH engine/subdev functions 186 * PGRAPH engine/subdev functions
187 ******************************************************************************/ 187 ******************************************************************************/
188 188
189static int
190nv50_graph_tlb_flush(struct nouveau_engine *engine)
191{
192 nv50_vm_flush_engine(&engine->base, 0x00);
193 return 0;
194}
195
196static const struct nouveau_bitfield nv50_pgraph_status[] = { 189static const struct nouveau_bitfield nv50_pgraph_status[] = {
197 { 0x00000001, "BUSY" }, /* set when any bit is set */ 190 { 0x00000001, "BUSY" }, /* set when any bit is set */
198 { 0x00000002, "DISPATCH" }, 191 { 0x00000002, "DISPATCH" },
@@ -302,8 +295,10 @@ nv84_graph_tlb_flush(struct nouveau_engine *engine)
302 nv_rd32(priv, 0x400388)); 295 nv_rd32(priv, 0x400388));
303 } 296 }
304 297
305 nv50_vm_flush_engine(&engine->base, 0x00);
306 298
299 nv_wr32(priv, 0x100c80, 0x00000001);
300 if (!nv_wait(priv, 0x100c80, 0x00000001, 0x00000000))
301 nv_error(priv, "vm flush timeout\n");
307 nv_mask(priv, 0x400500, 0x00000001, 0x00000001); 302 nv_mask(priv, 0x400500, 0x00000001, 0x00000001);
308 spin_unlock_irqrestore(&priv->lock, flags); 303 spin_unlock_irqrestore(&priv->lock, flags);
309 return timeout ? -EBUSY : 0; 304 return timeout ? -EBUSY : 0;
@@ -857,10 +852,9 @@ nv50_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
857 852
858 }; 853 };
859 854
860 if (nv_device(priv)->chipset == 0x50 || 855 /* unfortunate hw bug workaround... */
861 nv_device(priv)->chipset == 0xac) 856 if (nv_device(priv)->chipset != 0x50 &&
862 nv_engine(priv)->tlb_flush = nv50_graph_tlb_flush; 857 nv_device(priv)->chipset != 0xac)
863 else
864 nv_engine(priv)->tlb_flush = nv84_graph_tlb_flush; 858 nv_engine(priv)->tlb_flush = nv84_graph_tlb_flush;
865 859
866 spin_lock_init(&priv->lock); 860 spin_lock_init(&priv->lock);
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
index f9b9d82c287f..3f4f35cc3848 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
@@ -23,14 +23,12 @@
23 */ 23 */
24 24
25#include "nvc0.h" 25#include "nvc0.h"
26#include "fuc/hubnvc0.fuc.h"
27#include "fuc/gpcnvc0.fuc.h"
28 26
29/******************************************************************************* 27/*******************************************************************************
30 * Graphics object classes 28 * Graphics object classes
31 ******************************************************************************/ 29 ******************************************************************************/
32 30
33static struct nouveau_oclass 31struct nouveau_oclass
34nvc0_graph_sclass[] = { 32nvc0_graph_sclass[] = {
35 { 0x902d, &nouveau_object_ofuncs }, 33 { 0x902d, &nouveau_object_ofuncs },
36 { 0x9039, &nouveau_object_ofuncs }, 34 { 0x9039, &nouveau_object_ofuncs },
@@ -39,40 +37,6 @@ nvc0_graph_sclass[] = {
39 {} 37 {}
40}; 38};
41 39
42static struct nouveau_oclass
43nvc1_graph_sclass[] = {
44 { 0x902d, &nouveau_object_ofuncs },
45 { 0x9039, &nouveau_object_ofuncs },
46 { 0x9097, &nouveau_object_ofuncs },
47 { 0x90c0, &nouveau_object_ofuncs },
48 { 0x9197, &nouveau_object_ofuncs },
49 {}
50};
51
52static struct nouveau_oclass
53nvc8_graph_sclass[] = {
54 { 0x902d, &nouveau_object_ofuncs },
55 { 0x9039, &nouveau_object_ofuncs },
56 { 0x9097, &nouveau_object_ofuncs },
57 { 0x90c0, &nouveau_object_ofuncs },
58 { 0x9197, &nouveau_object_ofuncs },
59 { 0x9297, &nouveau_object_ofuncs },
60 {}
61};
62
63u64
64nvc0_graph_units(struct nouveau_graph *graph)
65{
66 struct nvc0_graph_priv *priv = (void *)graph;
67 u64 cfg;
68
69 cfg = (u32)priv->gpc_nr;
70 cfg |= (u32)priv->tpc_total << 8;
71 cfg |= (u64)priv->rop_nr << 32;
72
73 return cfg;
74}
75
76/******************************************************************************* 40/*******************************************************************************
77 * PGRAPH context 41 * PGRAPH context
78 ******************************************************************************/ 42 ******************************************************************************/
@@ -181,60 +145,308 @@ nvc0_graph_context_dtor(struct nouveau_object *object)
181 nouveau_graph_context_destroy(&chan->base); 145 nouveau_graph_context_destroy(&chan->base);
182} 146}
183 147
184static struct nouveau_oclass
185nvc0_graph_cclass = {
186 .ofuncs = &(struct nouveau_ofuncs) {
187 .ctor = nvc0_graph_context_ctor,
188 .dtor = nvc0_graph_context_dtor,
189 .init = _nouveau_graph_context_init,
190 .fini = _nouveau_graph_context_fini,
191 .rd32 = _nouveau_graph_context_rd32,
192 .wr32 = _nouveau_graph_context_wr32,
193 },
194};
195
196/******************************************************************************* 148/*******************************************************************************
197 * PGRAPH engine/subdev functions 149 * PGRAPH engine/subdev functions
198 ******************************************************************************/ 150 ******************************************************************************/
199 151
200static void 152struct nvc0_graph_init
201nvc0_graph_ctxctl_debug_unit(struct nvc0_graph_priv *priv, u32 base) 153nvc0_graph_init_regs[] = {
154 { 0x400080, 1, 0x04, 0x003083c2 },
155 { 0x400088, 1, 0x04, 0x00006fe7 },
156 { 0x40008c, 1, 0x04, 0x00000000 },
157 { 0x400090, 1, 0x04, 0x00000030 },
158 { 0x40013c, 1, 0x04, 0x013901f7 },
159 { 0x400140, 1, 0x04, 0x00000100 },
160 { 0x400144, 1, 0x04, 0x00000000 },
161 { 0x400148, 1, 0x04, 0x00000110 },
162 { 0x400138, 1, 0x04, 0x00000000 },
163 { 0x400130, 2, 0x04, 0x00000000 },
164 { 0x400124, 1, 0x04, 0x00000002 },
165 {}
166};
167
168struct nvc0_graph_init
169nvc0_graph_init_unk40xx[] = {
170 { 0x40415c, 1, 0x04, 0x00000000 },
171 { 0x404170, 1, 0x04, 0x00000000 },
172 {}
173};
174
175struct nvc0_graph_init
176nvc0_graph_init_unk44xx[] = {
177 { 0x404488, 2, 0x04, 0x00000000 },
178 {}
179};
180
181struct nvc0_graph_init
182nvc0_graph_init_unk78xx[] = {
183 { 0x407808, 1, 0x04, 0x00000000 },
184 {}
185};
186
187struct nvc0_graph_init
188nvc0_graph_init_unk60xx[] = {
189 { 0x406024, 1, 0x04, 0x00000000 },
190 {}
191};
192
193struct nvc0_graph_init
194nvc0_graph_init_unk58xx[] = {
195 { 0x405844, 1, 0x04, 0x00ffffff },
196 { 0x405850, 1, 0x04, 0x00000000 },
197 { 0x405908, 1, 0x04, 0x00000000 },
198 {}
199};
200
201struct nvc0_graph_init
202nvc0_graph_init_unk80xx[] = {
203 { 0x40803c, 1, 0x04, 0x00000000 },
204 {}
205};
206
207struct nvc0_graph_init
208nvc0_graph_init_gpc[] = {
209 { 0x4184a0, 1, 0x04, 0x00000000 },
210 { 0x418604, 1, 0x04, 0x00000000 },
211 { 0x418680, 1, 0x04, 0x00000000 },
212 { 0x418714, 1, 0x04, 0x80000000 },
213 { 0x418384, 1, 0x04, 0x00000000 },
214 { 0x418814, 3, 0x04, 0x00000000 },
215 { 0x418b04, 1, 0x04, 0x00000000 },
216 { 0x4188c8, 1, 0x04, 0x80000000 },
217 { 0x4188cc, 1, 0x04, 0x00000000 },
218 { 0x4188d0, 1, 0x04, 0x00010000 },
219 { 0x4188d4, 1, 0x04, 0x00000001 },
220 { 0x418910, 1, 0x04, 0x00010001 },
221 { 0x418914, 1, 0x04, 0x00000301 },
222 { 0x418918, 1, 0x04, 0x00800000 },
223 { 0x418980, 1, 0x04, 0x77777770 },
224 { 0x418984, 3, 0x04, 0x77777777 },
225 { 0x418c04, 1, 0x04, 0x00000000 },
226 { 0x418c88, 1, 0x04, 0x00000000 },
227 { 0x418d00, 1, 0x04, 0x00000000 },
228 { 0x418f08, 1, 0x04, 0x00000000 },
229 { 0x418e00, 1, 0x04, 0x00000050 },
230 { 0x418e08, 1, 0x04, 0x00000000 },
231 { 0x41900c, 1, 0x04, 0x00000000 },
232 { 0x419018, 1, 0x04, 0x00000000 },
233 {}
234};
235
236static struct nvc0_graph_init
237nvc0_graph_init_tpc[] = {
238 { 0x419d08, 2, 0x04, 0x00000000 },
239 { 0x419d10, 1, 0x04, 0x00000014 },
240 { 0x419ab0, 1, 0x04, 0x00000000 },
241 { 0x419ab8, 1, 0x04, 0x000000e7 },
242 { 0x419abc, 2, 0x04, 0x00000000 },
243 { 0x41980c, 3, 0x04, 0x00000000 },
244 { 0x419844, 1, 0x04, 0x00000000 },
245 { 0x41984c, 1, 0x04, 0x00005bc5 },
246 { 0x419850, 4, 0x04, 0x00000000 },
247 { 0x419c98, 1, 0x04, 0x00000000 },
248 { 0x419ca8, 1, 0x04, 0x80000000 },
249 { 0x419cb4, 1, 0x04, 0x00000000 },
250 { 0x419cb8, 1, 0x04, 0x00008bf4 },
251 { 0x419cbc, 1, 0x04, 0x28137606 },
252 { 0x419cc0, 2, 0x04, 0x00000000 },
253 { 0x419bd4, 1, 0x04, 0x00800000 },
254 { 0x419bdc, 1, 0x04, 0x00000000 },
255 { 0x419d2c, 1, 0x04, 0x00000000 },
256 { 0x419c0c, 1, 0x04, 0x00000000 },
257 { 0x419e00, 1, 0x04, 0x00000000 },
258 { 0x419ea0, 1, 0x04, 0x00000000 },
259 { 0x419ea4, 1, 0x04, 0x00000100 },
260 { 0x419ea8, 1, 0x04, 0x00001100 },
261 { 0x419eac, 1, 0x04, 0x11100702 },
262 { 0x419eb0, 1, 0x04, 0x00000003 },
263 { 0x419eb4, 4, 0x04, 0x00000000 },
264 { 0x419ec8, 1, 0x04, 0x06060618 },
265 { 0x419ed0, 1, 0x04, 0x0eff0e38 },
266 { 0x419ed4, 1, 0x04, 0x011104f1 },
267 { 0x419edc, 1, 0x04, 0x00000000 },
268 { 0x419f00, 1, 0x04, 0x00000000 },
269 { 0x419f2c, 1, 0x04, 0x00000000 },
270 {}
271};
272
273struct nvc0_graph_init
274nvc0_graph_init_unk88xx[] = {
275 { 0x40880c, 1, 0x04, 0x00000000 },
276 { 0x408910, 9, 0x04, 0x00000000 },
277 { 0x408950, 1, 0x04, 0x00000000 },
278 { 0x408954, 1, 0x04, 0x0000ffff },
279 { 0x408984, 1, 0x04, 0x00000000 },
280 { 0x408988, 1, 0x04, 0x08040201 },
281 { 0x40898c, 1, 0x04, 0x80402010 },
282 {}
283};
284
285struct nvc0_graph_init
286nvc0_graph_tpc_0[] = {
287 { 0x50405c, 1, 0x04, 0x00000001 },
288 {}
289};
290
291void
292nvc0_graph_mmio(struct nvc0_graph_priv *priv, struct nvc0_graph_init *init)
202{ 293{
203 nv_error(priv, "%06x - done 0x%08x\n", base, 294 for (; init && init->count; init++) {
204 nv_rd32(priv, base + 0x400)); 295 u32 addr = init->addr, i;
205 nv_error(priv, "%06x - stat 0x%08x 0x%08x 0x%08x 0x%08x\n", base, 296 for (i = 0; i < init->count; i++) {
206 nv_rd32(priv, base + 0x800), nv_rd32(priv, base + 0x804), 297 nv_wr32(priv, addr, init->data);
207 nv_rd32(priv, base + 0x808), nv_rd32(priv, base + 0x80c)); 298 addr += init->pitch;
208 nv_error(priv, "%06x - stat 0x%08x 0x%08x 0x%08x 0x%08x\n", base, 299 }
209 nv_rd32(priv, base + 0x810), nv_rd32(priv, base + 0x814), 300 }
210 nv_rd32(priv, base + 0x818), nv_rd32(priv, base + 0x81c));
211} 301}
212 302
213void 303void
214nvc0_graph_ctxctl_debug(struct nvc0_graph_priv *priv) 304nvc0_graph_icmd(struct nvc0_graph_priv *priv, struct nvc0_graph_init *init)
215{ 305{
216 u32 gpcnr = nv_rd32(priv, 0x409604) & 0xffff; 306 u32 addr, data;
217 u32 gpc; 307 int i, j;
308
309 nv_wr32(priv, 0x400208, 0x80000000);
310 for (i = 0; init->count; init++, i++) {
311 if (!i || data != init->data) {
312 nv_wr32(priv, 0x400204, init->data);
313 data = init->data;
314 }
218 315
219 nvc0_graph_ctxctl_debug_unit(priv, 0x409000); 316 addr = init->addr;
220 for (gpc = 0; gpc < gpcnr; gpc++) 317 for (j = 0; j < init->count; j++) {
221 nvc0_graph_ctxctl_debug_unit(priv, 0x502000 + (gpc * 0x8000)); 318 nv_wr32(priv, 0x400200, addr);
319 addr += init->pitch;
320 while (nv_rd32(priv, 0x400700) & 0x00000002) {}
321 }
322 }
323 nv_wr32(priv, 0x400208, 0x00000000);
324}
325
326void
327nvc0_graph_mthd(struct nvc0_graph_priv *priv, struct nvc0_graph_mthd *mthds)
328{
329 struct nvc0_graph_mthd *mthd;
330 struct nvc0_graph_init *init;
331 int i = 0, j;
332 u32 data;
333
334 while ((mthd = &mthds[i++]) && (init = mthd->init)) {
335 u32 addr = 0x80000000 | mthd->oclass;
336 for (data = 0; init->count; init++) {
337 if (data != init->data) {
338 nv_wr32(priv, 0x40448c, init->data);
339 data = init->data;
340 }
341
342 addr = (addr & 0x8000ffff) | (init->addr << 14);
343 for (j = 0; j < init->count; j++) {
344 nv_wr32(priv, 0x404488, addr);
345 addr += init->pitch << 14;
346 }
347 }
348 }
349}
350
351u64
352nvc0_graph_units(struct nouveau_graph *graph)
353{
354 struct nvc0_graph_priv *priv = (void *)graph;
355 u64 cfg;
356
357 cfg = (u32)priv->gpc_nr;
358 cfg |= (u32)priv->tpc_total << 8;
359 cfg |= (u64)priv->rop_nr << 32;
360
361 return cfg;
222} 362}
223 363
364static const struct nouveau_enum nve0_sked_error[] = {
365 { 7, "CONSTANT_BUFFER_SIZE" },
366 { 9, "LOCAL_MEMORY_SIZE_POS" },
367 { 10, "LOCAL_MEMORY_SIZE_NEG" },
368 { 11, "WARP_CSTACK_SIZE" },
369 { 12, "TOTAL_TEMP_SIZE" },
370 { 13, "REGISTER_COUNT" },
371 { 18, "TOTAL_THREADS" },
372 { 20, "PROGRAM_OFFSET" },
373 { 21, "SHARED_MEMORY_SIZE" },
374 { 25, "SHARED_CONFIG_TOO_SMALL" },
375 { 26, "TOTAL_REGISTER_COUNT" },
376 {}
377};
378
379static const struct nouveau_enum nvc0_gpc_rop_error[] = {
380 { 1, "RT_PITCH_OVERRUN" },
381 { 4, "RT_WIDTH_OVERRUN" },
382 { 5, "RT_HEIGHT_OVERRUN" },
383 { 7, "ZETA_STORAGE_TYPE_MISMATCH" },
384 { 8, "RT_STORAGE_TYPE_MISMATCH" },
385 { 10, "RT_LINEAR_MISMATCH" },
386 {}
387};
388
224static void 389static void
225nvc0_graph_ctxctl_isr(struct nvc0_graph_priv *priv) 390nvc0_graph_trap_gpc_rop(struct nvc0_graph_priv *priv, int gpc)
226{ 391{
227 u32 ustat = nv_rd32(priv, 0x409c18); 392 u32 trap[4];
393 int i;
228 394
229 if (ustat & 0x00000001) 395 trap[0] = nv_rd32(priv, GPC_UNIT(gpc, 0x0420));
230 nv_error(priv, "CTXCTRL ucode error\n"); 396 trap[1] = nv_rd32(priv, GPC_UNIT(gpc, 0x0434));
231 if (ustat & 0x00080000) 397 trap[2] = nv_rd32(priv, GPC_UNIT(gpc, 0x0438));
232 nv_error(priv, "CTXCTRL watchdog timeout\n"); 398 trap[3] = nv_rd32(priv, GPC_UNIT(gpc, 0x043c));
233 if (ustat & ~0x00080001) 399
234 nv_error(priv, "CTXCTRL 0x%08x\n", ustat); 400 nv_error(priv, "GPC%d/PROP trap:", gpc);
401 for (i = 0; i <= 29; ++i) {
402 if (!(trap[0] & (1 << i)))
403 continue;
404 pr_cont(" ");
405 nouveau_enum_print(nvc0_gpc_rop_error, i);
406 }
407 pr_cont("\n");
235 408
236 nvc0_graph_ctxctl_debug(priv); 409 nv_error(priv, "x = %u, y = %u, format = %x, storage type = %x\n",
237 nv_wr32(priv, 0x409c20, ustat); 410 trap[1] & 0xffff, trap[1] >> 16, (trap[2] >> 8) & 0x3f,
411 trap[3] & 0xff);
412 nv_wr32(priv, GPC_UNIT(gpc, 0x0420), 0xc0000000);
413}
414
415static const struct nouveau_enum nvc0_mp_warp_error[] = {
416 { 0x00, "NO_ERROR" },
417 { 0x01, "STACK_MISMATCH" },
418 { 0x05, "MISALIGNED_PC" },
419 { 0x08, "MISALIGNED_GPR" },
420 { 0x09, "INVALID_OPCODE" },
421 { 0x0d, "GPR_OUT_OF_BOUNDS" },
422 { 0x0e, "MEM_OUT_OF_BOUNDS" },
423 { 0x0f, "UNALIGNED_MEM_ACCESS" },
424 { 0x11, "INVALID_PARAM" },
425 {}
426};
427
428static const struct nouveau_bitfield nvc0_mp_global_error[] = {
429 { 0x00000004, "MULTIPLE_WARP_ERRORS" },
430 { 0x00000008, "OUT_OF_STACK_SPACE" },
431 {}
432};
433
434static void
435nvc0_graph_trap_mp(struct nvc0_graph_priv *priv, int gpc, int tpc)
436{
437 u32 werr = nv_rd32(priv, TPC_UNIT(gpc, tpc, 0x648));
438 u32 gerr = nv_rd32(priv, TPC_UNIT(gpc, tpc, 0x650));
439
440 nv_error(priv, "GPC%i/TPC%i/MP trap:", gpc, tpc);
441 nouveau_bitfield_print(nvc0_mp_global_error, gerr);
442 if (werr) {
443 pr_cont(" ");
444 nouveau_enum_print(nvc0_mp_warp_error, werr & 0xffff);
445 }
446 pr_cont("\n");
447
448 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x648), 0x00000000);
449 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x650), gerr);
238} 450}
239 451
240static void 452static void
@@ -246,18 +458,11 @@ nvc0_graph_trap_tpc(struct nvc0_graph_priv *priv, int gpc, int tpc)
246 u32 trap = nv_rd32(priv, TPC_UNIT(gpc, tpc, 0x0224)); 458 u32 trap = nv_rd32(priv, TPC_UNIT(gpc, tpc, 0x0224));
247 nv_error(priv, "GPC%d/TPC%d/TEX: 0x%08x\n", gpc, tpc, trap); 459 nv_error(priv, "GPC%d/TPC%d/TEX: 0x%08x\n", gpc, tpc, trap);
248 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x0224), 0xc0000000); 460 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x0224), 0xc0000000);
249 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x0508), 0x00000001);
250 stat &= ~0x00000001; 461 stat &= ~0x00000001;
251 } 462 }
252 463
253 if (stat & 0x00000002) { 464 if (stat & 0x00000002) {
254 u32 trap0 = nv_rd32(priv, TPC_UNIT(gpc, tpc, 0x0644)); 465 nvc0_graph_trap_mp(priv, gpc, tpc);
255 u32 trap1 = nv_rd32(priv, TPC_UNIT(gpc, tpc, 0x064c));
256 nv_error(priv, "GPC%d/TPC%d/MP: 0x%08x 0x%08x\n",
257 gpc, tpc, trap0, trap1);
258 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x0644), 0x001ffffe);
259 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x064c), 0x0000000f);
260 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x0508), 0x00000002);
261 stat &= ~0x00000002; 466 stat &= ~0x00000002;
262 } 467 }
263 468
@@ -265,7 +470,6 @@ nvc0_graph_trap_tpc(struct nvc0_graph_priv *priv, int gpc, int tpc)
265 u32 trap = nv_rd32(priv, TPC_UNIT(gpc, tpc, 0x0084)); 470 u32 trap = nv_rd32(priv, TPC_UNIT(gpc, tpc, 0x0084));
266 nv_error(priv, "GPC%d/TPC%d/POLY: 0x%08x\n", gpc, tpc, trap); 471 nv_error(priv, "GPC%d/TPC%d/POLY: 0x%08x\n", gpc, tpc, trap);
267 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x0084), 0xc0000000); 472 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x0084), 0xc0000000);
268 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x0508), 0x00000004);
269 stat &= ~0x00000004; 473 stat &= ~0x00000004;
270 } 474 }
271 475
@@ -273,13 +477,11 @@ nvc0_graph_trap_tpc(struct nvc0_graph_priv *priv, int gpc, int tpc)
273 u32 trap = nv_rd32(priv, TPC_UNIT(gpc, tpc, 0x048c)); 477 u32 trap = nv_rd32(priv, TPC_UNIT(gpc, tpc, 0x048c));
274 nv_error(priv, "GPC%d/TPC%d/L1C: 0x%08x\n", gpc, tpc, trap); 478 nv_error(priv, "GPC%d/TPC%d/L1C: 0x%08x\n", gpc, tpc, trap);
275 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x048c), 0xc0000000); 479 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x048c), 0xc0000000);
276 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x0508), 0x00000008);
277 stat &= ~0x00000008; 480 stat &= ~0x00000008;
278 } 481 }
279 482
280 if (stat) { 483 if (stat) {
281 nv_error(priv, "GPC%d/TPC%d/0x%08x: unknown\n", gpc, tpc, stat); 484 nv_error(priv, "GPC%d/TPC%d/0x%08x: unknown\n", gpc, tpc, stat);
282 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x0508), stat);
283 } 485 }
284} 486}
285 487
@@ -290,10 +492,7 @@ nvc0_graph_trap_gpc(struct nvc0_graph_priv *priv, int gpc)
290 int tpc; 492 int tpc;
291 493
292 if (stat & 0x00000001) { 494 if (stat & 0x00000001) {
293 u32 trap = nv_rd32(priv, GPC_UNIT(gpc, 0x0420)); 495 nvc0_graph_trap_gpc_rop(priv, gpc);
294 nv_error(priv, "GPC%d/PROP: 0x%08x\n", gpc, trap);
295 nv_wr32(priv, GPC_UNIT(gpc, 0x0420), 0xc0000000);
296 nv_wr32(priv, GPC_UNIT(gpc, 0x2c90), 0x00000001);
297 stat &= ~0x00000001; 496 stat &= ~0x00000001;
298 } 497 }
299 498
@@ -301,7 +500,6 @@ nvc0_graph_trap_gpc(struct nvc0_graph_priv *priv, int gpc)
301 u32 trap = nv_rd32(priv, GPC_UNIT(gpc, 0x0900)); 500 u32 trap = nv_rd32(priv, GPC_UNIT(gpc, 0x0900));
302 nv_error(priv, "GPC%d/ZCULL: 0x%08x\n", gpc, trap); 501 nv_error(priv, "GPC%d/ZCULL: 0x%08x\n", gpc, trap);
303 nv_wr32(priv, GPC_UNIT(gpc, 0x0900), 0xc0000000); 502 nv_wr32(priv, GPC_UNIT(gpc, 0x0900), 0xc0000000);
304 nv_wr32(priv, GPC_UNIT(gpc, 0x2c90), 0x00000002);
305 stat &= ~0x00000002; 503 stat &= ~0x00000002;
306 } 504 }
307 505
@@ -309,7 +507,6 @@ nvc0_graph_trap_gpc(struct nvc0_graph_priv *priv, int gpc)
309 u32 trap = nv_rd32(priv, GPC_UNIT(gpc, 0x1028)); 507 u32 trap = nv_rd32(priv, GPC_UNIT(gpc, 0x1028));
310 nv_error(priv, "GPC%d/CCACHE: 0x%08x\n", gpc, trap); 508 nv_error(priv, "GPC%d/CCACHE: 0x%08x\n", gpc, trap);
311 nv_wr32(priv, GPC_UNIT(gpc, 0x1028), 0xc0000000); 509 nv_wr32(priv, GPC_UNIT(gpc, 0x1028), 0xc0000000);
312 nv_wr32(priv, GPC_UNIT(gpc, 0x2c90), 0x00000004);
313 stat &= ~0x00000004; 510 stat &= ~0x00000004;
314 } 511 }
315 512
@@ -317,7 +514,6 @@ nvc0_graph_trap_gpc(struct nvc0_graph_priv *priv, int gpc)
317 u32 trap = nv_rd32(priv, GPC_UNIT(gpc, 0x0824)); 514 u32 trap = nv_rd32(priv, GPC_UNIT(gpc, 0x0824));
318 nv_error(priv, "GPC%d/ESETUP: 0x%08x\n", gpc, trap); 515 nv_error(priv, "GPC%d/ESETUP: 0x%08x\n", gpc, trap);
319 nv_wr32(priv, GPC_UNIT(gpc, 0x0824), 0xc0000000); 516 nv_wr32(priv, GPC_UNIT(gpc, 0x0824), 0xc0000000);
320 nv_wr32(priv, GPC_UNIT(gpc, 0x2c90), 0x00000008);
321 stat &= ~0x00000009; 517 stat &= ~0x00000009;
322 } 518 }
323 519
@@ -332,7 +528,6 @@ nvc0_graph_trap_gpc(struct nvc0_graph_priv *priv, int gpc)
332 528
333 if (stat) { 529 if (stat) {
334 nv_error(priv, "GPC%d/0x%08x: unknown\n", gpc, stat); 530 nv_error(priv, "GPC%d/0x%08x: unknown\n", gpc, stat);
335 nv_wr32(priv, GPC_UNIT(gpc, 0x2c90), stat);
336 } 531 }
337} 532}
338 533
@@ -340,7 +535,7 @@ static void
340nvc0_graph_trap_intr(struct nvc0_graph_priv *priv) 535nvc0_graph_trap_intr(struct nvc0_graph_priv *priv)
341{ 536{
342 u32 trap = nv_rd32(priv, 0x400108); 537 u32 trap = nv_rd32(priv, 0x400108);
343 int rop, gpc; 538 int rop, gpc, i;
344 539
345 if (trap & 0x00000001) { 540 if (trap & 0x00000001) {
346 u32 stat = nv_rd32(priv, 0x404000); 541 u32 stat = nv_rd32(priv, 0x404000);
@@ -390,6 +585,24 @@ nvc0_graph_trap_intr(struct nvc0_graph_priv *priv)
390 trap &= ~0x00000080; 585 trap &= ~0x00000080;
391 } 586 }
392 587
588 if (trap & 0x00000100) {
589 u32 stat = nv_rd32(priv, 0x407020);
590
591 nv_error(priv, "SKED:");
592 for (i = 0; i <= 29; ++i) {
593 if (!(stat & (1 << i)))
594 continue;
595 pr_cont(" ");
596 nouveau_enum_print(nve0_sked_error, i);
597 }
598 pr_cont("\n");
599
600 if (stat & 0x3fffffff)
601 nv_wr32(priv, 0x407020, 0x40000000);
602 nv_wr32(priv, 0x400108, 0x00000100);
603 trap &= ~0x00000100;
604 }
605
393 if (trap & 0x01000000) { 606 if (trap & 0x01000000) {
394 u32 stat = nv_rd32(priv, 0x400118); 607 u32 stat = nv_rd32(priv, 0x400118);
395 for (gpc = 0; stat && gpc < priv->gpc_nr; gpc++) { 608 for (gpc = 0; stat && gpc < priv->gpc_nr; gpc++) {
@@ -424,6 +637,46 @@ nvc0_graph_trap_intr(struct nvc0_graph_priv *priv)
424} 637}
425 638
426static void 639static void
640nvc0_graph_ctxctl_debug_unit(struct nvc0_graph_priv *priv, u32 base)
641{
642 nv_error(priv, "%06x - done 0x%08x\n", base,
643 nv_rd32(priv, base + 0x400));
644 nv_error(priv, "%06x - stat 0x%08x 0x%08x 0x%08x 0x%08x\n", base,
645 nv_rd32(priv, base + 0x800), nv_rd32(priv, base + 0x804),
646 nv_rd32(priv, base + 0x808), nv_rd32(priv, base + 0x80c));
647 nv_error(priv, "%06x - stat 0x%08x 0x%08x 0x%08x 0x%08x\n", base,
648 nv_rd32(priv, base + 0x810), nv_rd32(priv, base + 0x814),
649 nv_rd32(priv, base + 0x818), nv_rd32(priv, base + 0x81c));
650}
651
652void
653nvc0_graph_ctxctl_debug(struct nvc0_graph_priv *priv)
654{
655 u32 gpcnr = nv_rd32(priv, 0x409604) & 0xffff;
656 u32 gpc;
657
658 nvc0_graph_ctxctl_debug_unit(priv, 0x409000);
659 for (gpc = 0; gpc < gpcnr; gpc++)
660 nvc0_graph_ctxctl_debug_unit(priv, 0x502000 + (gpc * 0x8000));
661}
662
663static void
664nvc0_graph_ctxctl_isr(struct nvc0_graph_priv *priv)
665{
666 u32 ustat = nv_rd32(priv, 0x409c18);
667
668 if (ustat & 0x00000001)
669 nv_error(priv, "CTXCTL ucode error\n");
670 if (ustat & 0x00080000)
671 nv_error(priv, "CTXCTL watchdog timeout\n");
672 if (ustat & ~0x00080001)
673 nv_error(priv, "CTXCTL 0x%08x\n", ustat);
674
675 nvc0_graph_ctxctl_debug(priv);
676 nv_wr32(priv, 0x409c20, ustat);
677}
678
679static void
427nvc0_graph_intr(struct nouveau_subdev *subdev) 680nvc0_graph_intr(struct nouveau_subdev *subdev)
428{ 681{
429 struct nouveau_fifo *pfifo = nouveau_fifo(subdev); 682 struct nouveau_fifo *pfifo = nouveau_fifo(subdev);
@@ -499,290 +752,6 @@ nvc0_graph_intr(struct nouveau_subdev *subdev)
499 nouveau_engctx_put(engctx); 752 nouveau_engctx_put(engctx);
500} 753}
501 754
502int
503nvc0_graph_ctor_fw(struct nvc0_graph_priv *priv, const char *fwname,
504 struct nvc0_graph_fuc *fuc)
505{
506 struct nouveau_device *device = nv_device(priv);
507 const struct firmware *fw;
508 char f[32];
509 int ret;
510
511 snprintf(f, sizeof(f), "nouveau/nv%02x_%s", device->chipset, fwname);
512 ret = request_firmware(&fw, f, &device->pdev->dev);
513 if (ret) {
514 snprintf(f, sizeof(f), "nouveau/%s", fwname);
515 ret = request_firmware(&fw, f, &device->pdev->dev);
516 if (ret) {
517 nv_error(priv, "failed to load %s\n", fwname);
518 return ret;
519 }
520 }
521
522 fuc->size = fw->size;
523 fuc->data = kmemdup(fw->data, fuc->size, GFP_KERNEL);
524 release_firmware(fw);
525 return (fuc->data != NULL) ? 0 : -ENOMEM;
526}
527
528static int
529nvc0_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
530 struct nouveau_oclass *oclass, void *data, u32 size,
531 struct nouveau_object **pobject)
532{
533 struct nouveau_device *device = nv_device(parent);
534 struct nvc0_graph_priv *priv;
535 bool enable = device->chipset != 0xd7;
536 int ret, i;
537
538 ret = nouveau_graph_create(parent, engine, oclass, enable, &priv);
539 *pobject = nv_object(priv);
540 if (ret)
541 return ret;
542
543 nv_subdev(priv)->unit = 0x18001000;
544 nv_subdev(priv)->intr = nvc0_graph_intr;
545 nv_engine(priv)->cclass = &nvc0_graph_cclass;
546
547 priv->base.units = nvc0_graph_units;
548
549 if (nouveau_boolopt(device->cfgopt, "NvGrUseFW", false)) {
550 nv_info(priv, "using external firmware\n");
551 if (nvc0_graph_ctor_fw(priv, "fuc409c", &priv->fuc409c) ||
552 nvc0_graph_ctor_fw(priv, "fuc409d", &priv->fuc409d) ||
553 nvc0_graph_ctor_fw(priv, "fuc41ac", &priv->fuc41ac) ||
554 nvc0_graph_ctor_fw(priv, "fuc41ad", &priv->fuc41ad))
555 return -EINVAL;
556 priv->firmware = true;
557 }
558
559 switch (nvc0_graph_class(priv)) {
560 case 0x9097:
561 nv_engine(priv)->sclass = nvc0_graph_sclass;
562 break;
563 case 0x9197:
564 nv_engine(priv)->sclass = nvc1_graph_sclass;
565 break;
566 case 0x9297:
567 nv_engine(priv)->sclass = nvc8_graph_sclass;
568 break;
569 }
570
571 ret = nouveau_gpuobj_new(nv_object(priv), NULL, 0x1000, 256, 0,
572 &priv->unk4188b4);
573 if (ret)
574 return ret;
575
576 ret = nouveau_gpuobj_new(nv_object(priv), NULL, 0x1000, 256, 0,
577 &priv->unk4188b8);
578 if (ret)
579 return ret;
580
581 for (i = 0; i < 0x1000; i += 4) {
582 nv_wo32(priv->unk4188b4, i, 0x00000010);
583 nv_wo32(priv->unk4188b8, i, 0x00000010);
584 }
585
586 priv->rop_nr = (nv_rd32(priv, 0x409604) & 0x001f0000) >> 16;
587 priv->gpc_nr = nv_rd32(priv, 0x409604) & 0x0000001f;
588 for (i = 0; i < priv->gpc_nr; i++) {
589 priv->tpc_nr[i] = nv_rd32(priv, GPC_UNIT(i, 0x2608));
590 priv->tpc_total += priv->tpc_nr[i];
591 }
592
593 /*XXX: these need figuring out... though it might not even matter */
594 switch (nv_device(priv)->chipset) {
595 case 0xc0:
596 if (priv->tpc_total == 11) { /* 465, 3/4/4/0, 4 */
597 priv->magic_not_rop_nr = 0x07;
598 } else
599 if (priv->tpc_total == 14) { /* 470, 3/3/4/4, 5 */
600 priv->magic_not_rop_nr = 0x05;
601 } else
602 if (priv->tpc_total == 15) { /* 480, 3/4/4/4, 6 */
603 priv->magic_not_rop_nr = 0x06;
604 }
605 break;
606 case 0xc3: /* 450, 4/0/0/0, 2 */
607 priv->magic_not_rop_nr = 0x03;
608 break;
609 case 0xc4: /* 460, 3/4/0/0, 4 */
610 priv->magic_not_rop_nr = 0x01;
611 break;
612 case 0xc1: /* 2/0/0/0, 1 */
613 priv->magic_not_rop_nr = 0x01;
614 break;
615 case 0xc8: /* 4/4/3/4, 5 */
616 priv->magic_not_rop_nr = 0x06;
617 break;
618 case 0xce: /* 4/4/0/0, 4 */
619 priv->magic_not_rop_nr = 0x03;
620 break;
621 case 0xcf: /* 4/0/0/0, 3 */
622 priv->magic_not_rop_nr = 0x03;
623 break;
624 case 0xd9: /* 1/0/0/0, 1 */
625 priv->magic_not_rop_nr = 0x01;
626 break;
627 }
628
629 return 0;
630}
631
632static void
633nvc0_graph_dtor_fw(struct nvc0_graph_fuc *fuc)
634{
635 kfree(fuc->data);
636 fuc->data = NULL;
637}
638
639void
640nvc0_graph_dtor(struct nouveau_object *object)
641{
642 struct nvc0_graph_priv *priv = (void *)object;
643
644 kfree(priv->data);
645
646 nvc0_graph_dtor_fw(&priv->fuc409c);
647 nvc0_graph_dtor_fw(&priv->fuc409d);
648 nvc0_graph_dtor_fw(&priv->fuc41ac);
649 nvc0_graph_dtor_fw(&priv->fuc41ad);
650
651 nouveau_gpuobj_ref(NULL, &priv->unk4188b8);
652 nouveau_gpuobj_ref(NULL, &priv->unk4188b4);
653
654 nouveau_graph_destroy(&priv->base);
655}
656
657static void
658nvc0_graph_init_obj418880(struct nvc0_graph_priv *priv)
659{
660 int i;
661
662 nv_wr32(priv, GPC_BCAST(0x0880), 0x00000000);
663 nv_wr32(priv, GPC_BCAST(0x08a4), 0x00000000);
664 for (i = 0; i < 4; i++)
665 nv_wr32(priv, GPC_BCAST(0x0888) + (i * 4), 0x00000000);
666 nv_wr32(priv, GPC_BCAST(0x08b4), priv->unk4188b4->addr >> 8);
667 nv_wr32(priv, GPC_BCAST(0x08b8), priv->unk4188b8->addr >> 8);
668}
669
670static void
671nvc0_graph_init_regs(struct nvc0_graph_priv *priv)
672{
673 nv_wr32(priv, 0x400080, 0x003083c2);
674 nv_wr32(priv, 0x400088, 0x00006fe7);
675 nv_wr32(priv, 0x40008c, 0x00000000);
676 nv_wr32(priv, 0x400090, 0x00000030);
677 nv_wr32(priv, 0x40013c, 0x013901f7);
678 nv_wr32(priv, 0x400140, 0x00000100);
679 nv_wr32(priv, 0x400144, 0x00000000);
680 nv_wr32(priv, 0x400148, 0x00000110);
681 nv_wr32(priv, 0x400138, 0x00000000);
682 nv_wr32(priv, 0x400130, 0x00000000);
683 nv_wr32(priv, 0x400134, 0x00000000);
684 nv_wr32(priv, 0x400124, 0x00000002);
685}
686
687static void
688nvc0_graph_init_gpc_0(struct nvc0_graph_priv *priv)
689{
690 const u32 magicgpc918 = DIV_ROUND_UP(0x00800000, priv->tpc_total);
691 u32 data[TPC_MAX / 8];
692 u8 tpcnr[GPC_MAX];
693 int i, gpc, tpc;
694
695 nv_wr32(priv, TPC_UNIT(0, 0, 0x5c), 1); /* affects TFB offset queries */
696
697 /*
698 * TP ROP UNKVAL(magic_not_rop_nr)
699 * 450: 4/0/0/0 2 3
700 * 460: 3/4/0/0 4 1
701 * 465: 3/4/4/0 4 7
702 * 470: 3/3/4/4 5 5
703 * 480: 3/4/4/4 6 6
704 */
705
706 memset(data, 0x00, sizeof(data));
707 memcpy(tpcnr, priv->tpc_nr, sizeof(priv->tpc_nr));
708 for (i = 0, gpc = -1; i < priv->tpc_total; i++) {
709 do {
710 gpc = (gpc + 1) % priv->gpc_nr;
711 } while (!tpcnr[gpc]);
712 tpc = priv->tpc_nr[gpc] - tpcnr[gpc]--;
713
714 data[i / 8] |= tpc << ((i % 8) * 4);
715 }
716
717 nv_wr32(priv, GPC_BCAST(0x0980), data[0]);
718 nv_wr32(priv, GPC_BCAST(0x0984), data[1]);
719 nv_wr32(priv, GPC_BCAST(0x0988), data[2]);
720 nv_wr32(priv, GPC_BCAST(0x098c), data[3]);
721
722 for (gpc = 0; gpc < priv->gpc_nr; gpc++) {
723 nv_wr32(priv, GPC_UNIT(gpc, 0x0914), priv->magic_not_rop_nr << 8 |
724 priv->tpc_nr[gpc]);
725 nv_wr32(priv, GPC_UNIT(gpc, 0x0910), 0x00040000 | priv->tpc_total);
726 nv_wr32(priv, GPC_UNIT(gpc, 0x0918), magicgpc918);
727 }
728
729 nv_wr32(priv, GPC_BCAST(0x1bd4), magicgpc918);
730 nv_wr32(priv, GPC_BCAST(0x08ac), nv_rd32(priv, 0x100800));
731}
732
733static void
734nvc0_graph_init_units(struct nvc0_graph_priv *priv)
735{
736 nv_wr32(priv, 0x409c24, 0x000f0000);
737 nv_wr32(priv, 0x404000, 0xc0000000); /* DISPATCH */
738 nv_wr32(priv, 0x404600, 0xc0000000); /* M2MF */
739 nv_wr32(priv, 0x408030, 0xc0000000);
740 nv_wr32(priv, 0x40601c, 0xc0000000);
741 nv_wr32(priv, 0x404490, 0xc0000000); /* MACRO */
742 nv_wr32(priv, 0x406018, 0xc0000000);
743 nv_wr32(priv, 0x405840, 0xc0000000);
744 nv_wr32(priv, 0x405844, 0x00ffffff);
745 nv_mask(priv, 0x419cc0, 0x00000008, 0x00000008);
746 nv_mask(priv, 0x419eb4, 0x00001000, 0x00001000);
747}
748
749static void
750nvc0_graph_init_gpc_1(struct nvc0_graph_priv *priv)
751{
752 int gpc, tpc;
753
754 for (gpc = 0; gpc < priv->gpc_nr; gpc++) {
755 nv_wr32(priv, GPC_UNIT(gpc, 0x0420), 0xc0000000);
756 nv_wr32(priv, GPC_UNIT(gpc, 0x0900), 0xc0000000);
757 nv_wr32(priv, GPC_UNIT(gpc, 0x1028), 0xc0000000);
758 nv_wr32(priv, GPC_UNIT(gpc, 0x0824), 0xc0000000);
759 for (tpc = 0; tpc < priv->tpc_nr[gpc]; tpc++) {
760 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x508), 0xffffffff);
761 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x50c), 0xffffffff);
762 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x224), 0xc0000000);
763 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x48c), 0xc0000000);
764 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x084), 0xc0000000);
765 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x644), 0x001ffffe);
766 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x64c), 0x0000000f);
767 }
768 nv_wr32(priv, GPC_UNIT(gpc, 0x2c90), 0xffffffff);
769 nv_wr32(priv, GPC_UNIT(gpc, 0x2c94), 0xffffffff);
770 }
771}
772
773static void
774nvc0_graph_init_rop(struct nvc0_graph_priv *priv)
775{
776 int rop;
777
778 for (rop = 0; rop < priv->rop_nr; rop++) {
779 nv_wr32(priv, ROP_UNIT(rop, 0x144), 0xc0000000);
780 nv_wr32(priv, ROP_UNIT(rop, 0x070), 0xc0000000);
781 nv_wr32(priv, ROP_UNIT(rop, 0x204), 0xffffffff);
782 nv_wr32(priv, ROP_UNIT(rop, 0x208), 0xffffffff);
783 }
784}
785
786void 755void
787nvc0_graph_init_fw(struct nvc0_graph_priv *priv, u32 fuc_base, 756nvc0_graph_init_fw(struct nvc0_graph_priv *priv, u32 fuc_base,
788 struct nvc0_graph_fuc *code, struct nvc0_graph_fuc *data) 757 struct nvc0_graph_fuc *code, struct nvc0_graph_fuc *data)
@@ -801,9 +770,46 @@ nvc0_graph_init_fw(struct nvc0_graph_priv *priv, u32 fuc_base,
801 } 770 }
802} 771}
803 772
804static int 773static void
774nvc0_graph_init_csdata(struct nvc0_graph_priv *priv,
775 struct nvc0_graph_init *init,
776 u32 falcon, u32 starstar, u32 base)
777{
778 u32 addr = init->addr;
779 u32 next = addr;
780 u32 star, temp;
781
782 nv_wr32(priv, falcon + 0x01c0, 0x02000000 + starstar);
783 star = nv_rd32(priv, falcon + 0x01c4);
784 temp = nv_rd32(priv, falcon + 0x01c4);
785 if (temp > star)
786 star = temp;
787 nv_wr32(priv, falcon + 0x01c0, 0x01000000 + star);
788
789 do {
790 if (init->addr != next) {
791 while (addr < next) {
792 u32 nr = min((int)(next - addr) / 4, 32);
793 nv_wr32(priv, falcon + 0x01c4,
794 ((nr - 1) << 26) | (addr - base));
795 addr += nr * 4;
796 star += 4;
797 }
798 addr = next = init->addr;
799 }
800 next += init->count * 4;
801 } while ((init++)->count);
802
803 nv_wr32(priv, falcon + 0x01c0, 0x01000004 + starstar);
804 nv_wr32(priv, falcon + 0x01c4, star);
805}
806
807int
805nvc0_graph_init_ctxctl(struct nvc0_graph_priv *priv) 808nvc0_graph_init_ctxctl(struct nvc0_graph_priv *priv)
806{ 809{
810 struct nvc0_graph_oclass *oclass = (void *)nv_object(priv)->oclass;
811 struct nvc0_grctx_oclass *cclass = (void *)nv_engine(priv)->cclass;
812 struct nvc0_graph_init *init;
807 u32 r000260; 813 u32 r000260;
808 int i; 814 int i;
809 815
@@ -854,6 +860,38 @@ nvc0_graph_init_ctxctl(struct nvc0_graph_priv *priv)
854 return -EBUSY; 860 return -EBUSY;
855 } 861 }
856 862
863 if (nv_device(priv)->chipset >= 0xe0) {
864 nv_wr32(priv, 0x409800, 0x00000000);
865 nv_wr32(priv, 0x409500, 0x00000001);
866 nv_wr32(priv, 0x409504, 0x00000030);
867 if (!nv_wait_ne(priv, 0x409800, 0xffffffff, 0x00000000)) {
868 nv_error(priv, "fuc09 req 0x30 timeout\n");
869 return -EBUSY;
870 }
871
872 nv_wr32(priv, 0x409810, 0xb00095c8);
873 nv_wr32(priv, 0x409800, 0x00000000);
874 nv_wr32(priv, 0x409500, 0x00000001);
875 nv_wr32(priv, 0x409504, 0x00000031);
876 if (!nv_wait_ne(priv, 0x409800, 0xffffffff, 0x00000000)) {
877 nv_error(priv, "fuc09 req 0x31 timeout\n");
878 return -EBUSY;
879 }
880
881 nv_wr32(priv, 0x409810, 0x00080420);
882 nv_wr32(priv, 0x409800, 0x00000000);
883 nv_wr32(priv, 0x409500, 0x00000001);
884 nv_wr32(priv, 0x409504, 0x00000032);
885 if (!nv_wait_ne(priv, 0x409800, 0xffffffff, 0x00000000)) {
886 nv_error(priv, "fuc09 req 0x32 timeout\n");
887 return -EBUSY;
888 }
889
890 nv_wr32(priv, 0x409614, 0x00000070);
891 nv_wr32(priv, 0x409614, 0x00000770);
892 nv_wr32(priv, 0x40802c, 0x00000001);
893 }
894
857 if (priv->data == NULL) { 895 if (priv->data == NULL) {
858 int ret = nvc0_grctx_generate(priv); 896 int ret = nvc0_grctx_generate(priv);
859 if (ret) { 897 if (ret) {
@@ -868,31 +906,41 @@ nvc0_graph_init_ctxctl(struct nvc0_graph_priv *priv)
868 /* load HUB microcode */ 906 /* load HUB microcode */
869 r000260 = nv_mask(priv, 0x000260, 0x00000001, 0x00000000); 907 r000260 = nv_mask(priv, 0x000260, 0x00000001, 0x00000000);
870 nv_wr32(priv, 0x4091c0, 0x01000000); 908 nv_wr32(priv, 0x4091c0, 0x01000000);
871 for (i = 0; i < sizeof(nvc0_grhub_data) / 4; i++) 909 for (i = 0; i < oclass->fecs.ucode->data.size / 4; i++)
872 nv_wr32(priv, 0x4091c4, nvc0_grhub_data[i]); 910 nv_wr32(priv, 0x4091c4, oclass->fecs.ucode->data.data[i]);
873 911
874 nv_wr32(priv, 0x409180, 0x01000000); 912 nv_wr32(priv, 0x409180, 0x01000000);
875 for (i = 0; i < sizeof(nvc0_grhub_code) / 4; i++) { 913 for (i = 0; i < oclass->fecs.ucode->code.size / 4; i++) {
876 if ((i & 0x3f) == 0) 914 if ((i & 0x3f) == 0)
877 nv_wr32(priv, 0x409188, i >> 6); 915 nv_wr32(priv, 0x409188, i >> 6);
878 nv_wr32(priv, 0x409184, nvc0_grhub_code[i]); 916 nv_wr32(priv, 0x409184, oclass->fecs.ucode->code.data[i]);
917 }
918
919 for (i = 0; (init = cclass->hub[i]); i++) {
920 nvc0_graph_init_csdata(priv, init, 0x409000, 0x000, 0x000000);
879 } 921 }
880 922
881 /* load GPC microcode */ 923 /* load GPC microcode */
882 nv_wr32(priv, 0x41a1c0, 0x01000000); 924 nv_wr32(priv, 0x41a1c0, 0x01000000);
883 for (i = 0; i < sizeof(nvc0_grgpc_data) / 4; i++) 925 for (i = 0; i < oclass->gpccs.ucode->data.size / 4; i++)
884 nv_wr32(priv, 0x41a1c4, nvc0_grgpc_data[i]); 926 nv_wr32(priv, 0x41a1c4, oclass->gpccs.ucode->data.data[i]);
885 927
886 nv_wr32(priv, 0x41a180, 0x01000000); 928 nv_wr32(priv, 0x41a180, 0x01000000);
887 for (i = 0; i < sizeof(nvc0_grgpc_code) / 4; i++) { 929 for (i = 0; i < oclass->gpccs.ucode->code.size / 4; i++) {
888 if ((i & 0x3f) == 0) 930 if ((i & 0x3f) == 0)
889 nv_wr32(priv, 0x41a188, i >> 6); 931 nv_wr32(priv, 0x41a188, i >> 6);
890 nv_wr32(priv, 0x41a184, nvc0_grgpc_code[i]); 932 nv_wr32(priv, 0x41a184, oclass->gpccs.ucode->code.data[i]);
891 } 933 }
892 nv_wr32(priv, 0x000260, r000260); 934 nv_wr32(priv, 0x000260, r000260);
893 935
936 if ((init = cclass->gpc[0]))
937 nvc0_graph_init_csdata(priv, init, 0x41a000, 0x000, 0x418000);
938 if ((init = cclass->gpc[2]))
939 nvc0_graph_init_csdata(priv, init, 0x41a000, 0x004, 0x419800);
940 if ((init = cclass->gpc[3]))
941 nvc0_graph_init_csdata(priv, init, 0x41a000, 0x008, 0x41be00);
942
894 /* start HUB ucode running, it'll init the GPCs */ 943 /* start HUB ucode running, it'll init the GPCs */
895 nv_wr32(priv, 0x409800, nv_device(priv)->chipset);
896 nv_wr32(priv, 0x40910c, 0x00000000); 944 nv_wr32(priv, 0x40910c, 0x00000000);
897 nv_wr32(priv, 0x409100, 0x00000002); 945 nv_wr32(priv, 0x409100, 0x00000002);
898 if (!nv_wait(priv, 0x409800, 0x80000000, 0x80000000)) { 946 if (!nv_wait(priv, 0x409800, 0x80000000, 0x80000000)) {
@@ -913,29 +961,104 @@ nvc0_graph_init_ctxctl(struct nvc0_graph_priv *priv)
913 return 0; 961 return 0;
914} 962}
915 963
916static int 964int
917nvc0_graph_init(struct nouveau_object *object) 965nvc0_graph_init(struct nouveau_object *object)
918{ 966{
967 struct nvc0_graph_oclass *oclass = (void *)object->oclass;
919 struct nvc0_graph_priv *priv = (void *)object; 968 struct nvc0_graph_priv *priv = (void *)object;
920 int ret; 969 const u32 magicgpc918 = DIV_ROUND_UP(0x00800000, priv->tpc_total);
970 u32 data[TPC_MAX / 8] = {};
971 u8 tpcnr[GPC_MAX];
972 int gpc, tpc, rop;
973 int ret, i;
921 974
922 ret = nouveau_graph_init(&priv->base); 975 ret = nouveau_graph_init(&priv->base);
923 if (ret) 976 if (ret)
924 return ret; 977 return ret;
925 978
926 nvc0_graph_init_obj418880(priv); 979 nv_wr32(priv, GPC_BCAST(0x0880), 0x00000000);
927 nvc0_graph_init_regs(priv); 980 nv_wr32(priv, GPC_BCAST(0x08a4), 0x00000000);
928 /*nvc0_graph_init_unitplemented_magics(priv);*/ 981 nv_wr32(priv, GPC_BCAST(0x0888), 0x00000000);
929 nvc0_graph_init_gpc_0(priv); 982 nv_wr32(priv, GPC_BCAST(0x088c), 0x00000000);
930 /*nvc0_graph_init_unitplemented_c242(priv);*/ 983 nv_wr32(priv, GPC_BCAST(0x0890), 0x00000000);
984 nv_wr32(priv, GPC_BCAST(0x0894), 0x00000000);
985 nv_wr32(priv, GPC_BCAST(0x08b4), priv->unk4188b4->addr >> 8);
986 nv_wr32(priv, GPC_BCAST(0x08b8), priv->unk4188b8->addr >> 8);
987
988 for (i = 0; oclass->mmio[i]; i++)
989 nvc0_graph_mmio(priv, oclass->mmio[i]);
990
991 memcpy(tpcnr, priv->tpc_nr, sizeof(priv->tpc_nr));
992 for (i = 0, gpc = -1; i < priv->tpc_total; i++) {
993 do {
994 gpc = (gpc + 1) % priv->gpc_nr;
995 } while (!tpcnr[gpc]);
996 tpc = priv->tpc_nr[gpc] - tpcnr[gpc]--;
997
998 data[i / 8] |= tpc << ((i % 8) * 4);
999 }
1000
1001 nv_wr32(priv, GPC_BCAST(0x0980), data[0]);
1002 nv_wr32(priv, GPC_BCAST(0x0984), data[1]);
1003 nv_wr32(priv, GPC_BCAST(0x0988), data[2]);
1004 nv_wr32(priv, GPC_BCAST(0x098c), data[3]);
1005
1006 for (gpc = 0; gpc < priv->gpc_nr; gpc++) {
1007 nv_wr32(priv, GPC_UNIT(gpc, 0x0914),
1008 priv->magic_not_rop_nr << 8 | priv->tpc_nr[gpc]);
1009 nv_wr32(priv, GPC_UNIT(gpc, 0x0910), 0x00040000 |
1010 priv->tpc_total);
1011 nv_wr32(priv, GPC_UNIT(gpc, 0x0918), magicgpc918);
1012 }
1013
1014 if (nv_device(priv)->chipset != 0xd7)
1015 nv_wr32(priv, GPC_BCAST(0x1bd4), magicgpc918);
1016 else
1017 nv_wr32(priv, GPC_BCAST(0x3fd4), magicgpc918);
1018
1019 nv_wr32(priv, GPC_BCAST(0x08ac), nv_rd32(priv, 0x100800));
931 1020
932 nv_wr32(priv, 0x400500, 0x00010001); 1021 nv_wr32(priv, 0x400500, 0x00010001);
1022
933 nv_wr32(priv, 0x400100, 0xffffffff); 1023 nv_wr32(priv, 0x400100, 0xffffffff);
934 nv_wr32(priv, 0x40013c, 0xffffffff); 1024 nv_wr32(priv, 0x40013c, 0xffffffff);
935 1025
936 nvc0_graph_init_units(priv); 1026 nv_wr32(priv, 0x409c24, 0x000f0000);
937 nvc0_graph_init_gpc_1(priv); 1027 nv_wr32(priv, 0x404000, 0xc0000000);
938 nvc0_graph_init_rop(priv); 1028 nv_wr32(priv, 0x404600, 0xc0000000);
1029 nv_wr32(priv, 0x408030, 0xc0000000);
1030 nv_wr32(priv, 0x40601c, 0xc0000000);
1031 nv_wr32(priv, 0x404490, 0xc0000000);
1032 nv_wr32(priv, 0x406018, 0xc0000000);
1033 nv_wr32(priv, 0x405840, 0xc0000000);
1034 nv_wr32(priv, 0x405844, 0x00ffffff);
1035 nv_mask(priv, 0x419cc0, 0x00000008, 0x00000008);
1036 nv_mask(priv, 0x419eb4, 0x00001000, 0x00001000);
1037
1038 for (gpc = 0; gpc < priv->gpc_nr; gpc++) {
1039 nv_wr32(priv, GPC_UNIT(gpc, 0x0420), 0xc0000000);
1040 nv_wr32(priv, GPC_UNIT(gpc, 0x0900), 0xc0000000);
1041 nv_wr32(priv, GPC_UNIT(gpc, 0x1028), 0xc0000000);
1042 nv_wr32(priv, GPC_UNIT(gpc, 0x0824), 0xc0000000);
1043 for (tpc = 0; tpc < priv->tpc_nr[gpc]; tpc++) {
1044 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x508), 0xffffffff);
1045 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x50c), 0xffffffff);
1046 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x224), 0xc0000000);
1047 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x48c), 0xc0000000);
1048 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x084), 0xc0000000);
1049 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x644), 0x001ffffe);
1050 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x64c), 0x0000000f);
1051 }
1052 nv_wr32(priv, GPC_UNIT(gpc, 0x2c90), 0xffffffff);
1053 nv_wr32(priv, GPC_UNIT(gpc, 0x2c94), 0xffffffff);
1054 }
1055
1056 for (rop = 0; rop < priv->rop_nr; rop++) {
1057 nv_wr32(priv, ROP_UNIT(rop, 0x144), 0xc0000000);
1058 nv_wr32(priv, ROP_UNIT(rop, 0x070), 0xc0000000);
1059 nv_wr32(priv, ROP_UNIT(rop, 0x204), 0xffffffff);
1060 nv_wr32(priv, ROP_UNIT(rop, 0x208), 0xffffffff);
1061 }
939 1062
940 nv_wr32(priv, 0x400108, 0xffffffff); 1063 nv_wr32(priv, 0x400108, 0xffffffff);
941 nv_wr32(priv, 0x400138, 0xffffffff); 1064 nv_wr32(priv, 0x400138, 0xffffffff);
@@ -943,22 +1066,205 @@ nvc0_graph_init(struct nouveau_object *object)
943 nv_wr32(priv, 0x400130, 0xffffffff); 1066 nv_wr32(priv, 0x400130, 0xffffffff);
944 nv_wr32(priv, 0x40011c, 0xffffffff); 1067 nv_wr32(priv, 0x40011c, 0xffffffff);
945 nv_wr32(priv, 0x400134, 0xffffffff); 1068 nv_wr32(priv, 0x400134, 0xffffffff);
1069
946 nv_wr32(priv, 0x400054, 0x34ce3464); 1070 nv_wr32(priv, 0x400054, 0x34ce3464);
1071 return nvc0_graph_init_ctxctl(priv);
1072}
947 1073
948 ret = nvc0_graph_init_ctxctl(priv); 1074static void
1075nvc0_graph_dtor_fw(struct nvc0_graph_fuc *fuc)
1076{
1077 kfree(fuc->data);
1078 fuc->data = NULL;
1079}
1080
1081int
1082nvc0_graph_ctor_fw(struct nvc0_graph_priv *priv, const char *fwname,
1083 struct nvc0_graph_fuc *fuc)
1084{
1085 struct nouveau_device *device = nv_device(priv);
1086 const struct firmware *fw;
1087 char f[32];
1088 int ret;
1089
1090 snprintf(f, sizeof(f), "nouveau/nv%02x_%s", device->chipset, fwname);
1091 ret = request_firmware(&fw, f, &device->pdev->dev);
1092 if (ret) {
1093 snprintf(f, sizeof(f), "nouveau/%s", fwname);
1094 ret = request_firmware(&fw, f, &device->pdev->dev);
1095 if (ret) {
1096 nv_error(priv, "failed to load %s\n", fwname);
1097 return ret;
1098 }
1099 }
1100
1101 fuc->size = fw->size;
1102 fuc->data = kmemdup(fw->data, fuc->size, GFP_KERNEL);
1103 release_firmware(fw);
1104 return (fuc->data != NULL) ? 0 : -ENOMEM;
1105}
1106
1107void
1108nvc0_graph_dtor(struct nouveau_object *object)
1109{
1110 struct nvc0_graph_priv *priv = (void *)object;
1111
1112 kfree(priv->data);
1113
1114 nvc0_graph_dtor_fw(&priv->fuc409c);
1115 nvc0_graph_dtor_fw(&priv->fuc409d);
1116 nvc0_graph_dtor_fw(&priv->fuc41ac);
1117 nvc0_graph_dtor_fw(&priv->fuc41ad);
1118
1119 nouveau_gpuobj_ref(NULL, &priv->unk4188b8);
1120 nouveau_gpuobj_ref(NULL, &priv->unk4188b4);
1121
1122 nouveau_graph_destroy(&priv->base);
1123}
1124
1125int
1126nvc0_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
1127 struct nouveau_oclass *bclass, void *data, u32 size,
1128 struct nouveau_object **pobject)
1129{
1130 struct nvc0_graph_oclass *oclass = (void *)bclass;
1131 struct nouveau_device *device = nv_device(parent);
1132 struct nvc0_graph_priv *priv;
1133 int ret, i;
1134
1135 ret = nouveau_graph_create(parent, engine, bclass,
1136 (oclass->fecs.ucode != NULL), &priv);
1137 *pobject = nv_object(priv);
949 if (ret) 1138 if (ret)
950 return ret; 1139 return ret;
951 1140
1141 nv_subdev(priv)->unit = 0x18001000;
1142 nv_subdev(priv)->intr = nvc0_graph_intr;
1143
1144 priv->base.units = nvc0_graph_units;
1145
1146 if (nouveau_boolopt(device->cfgopt, "NvGrUseFW", false)) {
1147 nv_info(priv, "using external firmware\n");
1148 if (nvc0_graph_ctor_fw(priv, "fuc409c", &priv->fuc409c) ||
1149 nvc0_graph_ctor_fw(priv, "fuc409d", &priv->fuc409d) ||
1150 nvc0_graph_ctor_fw(priv, "fuc41ac", &priv->fuc41ac) ||
1151 nvc0_graph_ctor_fw(priv, "fuc41ad", &priv->fuc41ad))
1152 return -EINVAL;
1153 priv->firmware = true;
1154 }
1155
1156 ret = nouveau_gpuobj_new(nv_object(priv), NULL, 0x1000, 256, 0,
1157 &priv->unk4188b4);
1158 if (ret)
1159 return ret;
1160
1161 ret = nouveau_gpuobj_new(nv_object(priv), NULL, 0x1000, 256, 0,
1162 &priv->unk4188b8);
1163 if (ret)
1164 return ret;
1165
1166 for (i = 0; i < 0x1000; i += 4) {
1167 nv_wo32(priv->unk4188b4, i, 0x00000010);
1168 nv_wo32(priv->unk4188b8, i, 0x00000010);
1169 }
1170
1171 priv->rop_nr = (nv_rd32(priv, 0x409604) & 0x001f0000) >> 16;
1172 priv->gpc_nr = nv_rd32(priv, 0x409604) & 0x0000001f;
1173 for (i = 0; i < priv->gpc_nr; i++) {
1174 priv->tpc_nr[i] = nv_rd32(priv, GPC_UNIT(i, 0x2608));
1175 priv->tpc_total += priv->tpc_nr[i];
1176 }
1177
1178 /*XXX: these need figuring out... though it might not even matter */
1179 switch (nv_device(priv)->chipset) {
1180 case 0xc0:
1181 if (priv->tpc_total == 11) { /* 465, 3/4/4/0, 4 */
1182 priv->magic_not_rop_nr = 0x07;
1183 } else
1184 if (priv->tpc_total == 14) { /* 470, 3/3/4/4, 5 */
1185 priv->magic_not_rop_nr = 0x05;
1186 } else
1187 if (priv->tpc_total == 15) { /* 480, 3/4/4/4, 6 */
1188 priv->magic_not_rop_nr = 0x06;
1189 }
1190 break;
1191 case 0xc3: /* 450, 4/0/0/0, 2 */
1192 priv->magic_not_rop_nr = 0x03;
1193 break;
1194 case 0xc4: /* 460, 3/4/0/0, 4 */
1195 priv->magic_not_rop_nr = 0x01;
1196 break;
1197 case 0xc1: /* 2/0/0/0, 1 */
1198 priv->magic_not_rop_nr = 0x01;
1199 break;
1200 case 0xc8: /* 4/4/3/4, 5 */
1201 priv->magic_not_rop_nr = 0x06;
1202 break;
1203 case 0xce: /* 4/4/0/0, 4 */
1204 priv->magic_not_rop_nr = 0x03;
1205 break;
1206 case 0xcf: /* 4/0/0/0, 3 */
1207 priv->magic_not_rop_nr = 0x03;
1208 break;
1209 case 0xd7:
1210 case 0xd9: /* 1/0/0/0, 1 */
1211 priv->magic_not_rop_nr = 0x01;
1212 break;
1213 }
1214
1215 nv_engine(priv)->cclass = *oclass->cclass;
1216 nv_engine(priv)->sclass = oclass->sclass;
952 return 0; 1217 return 0;
953} 1218}
954 1219
955struct nouveau_oclass 1220struct nvc0_graph_init *
956nvc0_graph_oclass = { 1221nvc0_graph_init_mmio[] = {
957 .handle = NV_ENGINE(GR, 0xc0), 1222 nvc0_graph_init_regs,
958 .ofuncs = &(struct nouveau_ofuncs) { 1223 nvc0_graph_init_unk40xx,
1224 nvc0_graph_init_unk44xx,
1225 nvc0_graph_init_unk78xx,
1226 nvc0_graph_init_unk60xx,
1227 nvc0_graph_init_unk58xx,
1228 nvc0_graph_init_unk80xx,
1229 nvc0_graph_init_gpc,
1230 nvc0_graph_init_tpc,
1231 nvc0_graph_init_unk88xx,
1232 nvc0_graph_tpc_0,
1233 NULL
1234};
1235
1236#include "fuc/hubnvc0.fuc.h"
1237
1238struct nvc0_graph_ucode
1239nvc0_graph_fecs_ucode = {
1240 .code.data = nvc0_grhub_code,
1241 .code.size = sizeof(nvc0_grhub_code),
1242 .data.data = nvc0_grhub_data,
1243 .data.size = sizeof(nvc0_grhub_data),
1244};
1245
1246#include "fuc/gpcnvc0.fuc.h"
1247
1248struct nvc0_graph_ucode
1249nvc0_graph_gpccs_ucode = {
1250 .code.data = nvc0_grgpc_code,
1251 .code.size = sizeof(nvc0_grgpc_code),
1252 .data.data = nvc0_grgpc_data,
1253 .data.size = sizeof(nvc0_grgpc_data),
1254};
1255
1256struct nouveau_oclass *
1257nvc0_graph_oclass = &(struct nvc0_graph_oclass) {
1258 .base.handle = NV_ENGINE(GR, 0xc0),
1259 .base.ofuncs = &(struct nouveau_ofuncs) {
959 .ctor = nvc0_graph_ctor, 1260 .ctor = nvc0_graph_ctor,
960 .dtor = nvc0_graph_dtor, 1261 .dtor = nvc0_graph_dtor,
961 .init = nvc0_graph_init, 1262 .init = nvc0_graph_init,
962 .fini = _nouveau_graph_fini, 1263 .fini = _nouveau_graph_fini,
963 }, 1264 },
964}; 1265 .cclass = &nvc0_grctx_oclass,
1266 .sclass = nvc0_graph_sclass,
1267 .mmio = nvc0_graph_init_mmio,
1268 .fecs.ucode = &nvc0_graph_fecs_ucode,
1269 .gpccs.ucode = &nvc0_graph_gpccs_ucode,
1270}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h
index c870dad0f670..ea17a80ad7fc 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h
@@ -38,8 +38,8 @@
38#include <engine/fifo.h> 38#include <engine/fifo.h>
39#include <engine/graph.h> 39#include <engine/graph.h>
40 40
41#define GPC_MAX 4 41#define GPC_MAX 32
42#define TPC_MAX 32 42#define TPC_MAX (GPC_MAX * 8)
43 43
44#define ROP_BCAST(r) (0x408800 + (r)) 44#define ROP_BCAST(r) (0x408800 + (r))
45#define ROP_UNIT(u, r) (0x410000 + (u) * 0x400 + (r)) 45#define ROP_UNIT(u, r) (0x410000 + (u) * 0x400 + (r))
@@ -102,74 +102,187 @@ struct nvc0_graph_chan {
102 } data[4]; 102 } data[4];
103}; 103};
104 104
105static inline u32 105int nvc0_grctx_generate(struct nvc0_graph_priv *);
106nvc0_graph_class(void *obj) 106
107{ 107int nvc0_graph_context_ctor(struct nouveau_object *, struct nouveau_object *,
108 struct nouveau_device *device = nv_device(obj); 108 struct nouveau_oclass *, void *, u32,
109 109 struct nouveau_object **);
110 switch (device->chipset) { 110void nvc0_graph_context_dtor(struct nouveau_object *);
111 case 0xc0: 111
112 case 0xc3: 112void nvc0_graph_ctxctl_debug(struct nvc0_graph_priv *);
113 case 0xc4: 113
114 case 0xce: /* guess, mmio trace shows only 0x9097 state */ 114u64 nvc0_graph_units(struct nouveau_graph *);
115 case 0xcf: /* guess, mmio trace shows only 0x9097 state */ 115int nvc0_graph_ctor(struct nouveau_object *, struct nouveau_object *,
116 return 0x9097; 116 struct nouveau_oclass *, void *data, u32 size,
117 case 0xc1: 117 struct nouveau_object **);
118 return 0x9197; 118void nvc0_graph_dtor(struct nouveau_object *);
119 case 0xc8: 119int nvc0_graph_init(struct nouveau_object *);
120 case 0xd9: 120int nve4_graph_init(struct nouveau_object *);
121 case 0xd7: 121
122 return 0x9297; 122extern struct nouveau_oclass nvc0_graph_sclass[];
123 case 0xe4: 123
124 case 0xe7: 124extern struct nouveau_oclass nvc8_graph_sclass[];
125 case 0xe6: 125
126 return 0xa097; 126struct nvc0_graph_init {
127 default: 127 u32 addr;
128 return 0; 128 u8 count;
129 } 129 u8 pitch;
130} 130 u32 data;
131 131};
132void nv_icmd(struct nvc0_graph_priv *priv, u32 icmd, u32 data); 132
133 133struct nvc0_graph_mthd {
134static inline void 134 u16 oclass;
135nv_mthd(struct nvc0_graph_priv *priv, u32 class, u32 mthd, u32 data) 135 struct nvc0_graph_init *init;
136{ 136};
137 nv_wr32(priv, 0x40448c, data);
138 nv_wr32(priv, 0x404488, 0x80000000 | (mthd << 14) | class);
139}
140 137
141struct nvc0_grctx { 138struct nvc0_grctx {
142 struct nvc0_graph_priv *priv; 139 struct nvc0_graph_priv *priv;
143 struct nvc0_graph_data *data; 140 struct nvc0_graph_data *data;
144 struct nvc0_graph_mmio *mmio; 141 struct nvc0_graph_mmio *mmio;
145 struct nouveau_gpuobj *chan;
146 int buffer_nr; 142 int buffer_nr;
147 u64 buffer[4]; 143 u64 buffer[4];
148 u64 addr; 144 u64 addr;
149}; 145};
150 146
147struct nvc0_grctx_oclass {
148 struct nouveau_oclass base;
149 /* main context generation function */
150 void (*main)(struct nvc0_graph_priv *, struct nvc0_grctx *);
151 /* context-specific modify-on-first-load list generation function */
152 void (*mods)(struct nvc0_graph_priv *, struct nvc0_grctx *);
153 void (*unkn)(struct nvc0_graph_priv *);
154 /* mmio context data */
155 struct nvc0_graph_init **hub;
156 struct nvc0_graph_init **gpc;
157 /* indirect context data, generated with icmds/mthds */
158 struct nvc0_graph_init *icmd;
159 struct nvc0_graph_mthd *mthd;
160};
161
162struct nvc0_graph_ucode {
163 struct nvc0_graph_fuc code;
164 struct nvc0_graph_fuc data;
165};
166
167extern struct nvc0_graph_ucode nvc0_graph_fecs_ucode;
168extern struct nvc0_graph_ucode nvc0_graph_gpccs_ucode;
169
170struct nvc0_graph_oclass {
171 struct nouveau_oclass base;
172 struct nouveau_oclass **cclass;
173 struct nouveau_oclass *sclass;
174 struct nvc0_graph_init **mmio;
175 struct {
176 struct nvc0_graph_ucode *ucode;
177 } fecs;
178 struct {
179 struct nvc0_graph_ucode *ucode;
180 } gpccs;
181};
182
183void nvc0_graph_mmio(struct nvc0_graph_priv *, struct nvc0_graph_init *);
184void nvc0_graph_icmd(struct nvc0_graph_priv *, struct nvc0_graph_init *);
185void nvc0_graph_mthd(struct nvc0_graph_priv *, struct nvc0_graph_mthd *);
186int nvc0_graph_init_ctxctl(struct nvc0_graph_priv *);
187
188extern struct nvc0_graph_init nvc0_graph_init_regs[];
189extern struct nvc0_graph_init nvc0_graph_init_unk40xx[];
190extern struct nvc0_graph_init nvc0_graph_init_unk44xx[];
191extern struct nvc0_graph_init nvc0_graph_init_unk78xx[];
192extern struct nvc0_graph_init nvc0_graph_init_unk60xx[];
193extern struct nvc0_graph_init nvc0_graph_init_unk58xx[];
194extern struct nvc0_graph_init nvc0_graph_init_unk80xx[];
195extern struct nvc0_graph_init nvc0_graph_init_gpc[];
196extern struct nvc0_graph_init nvc0_graph_init_unk88xx[];
197extern struct nvc0_graph_init nvc0_graph_tpc_0[];
198
199extern struct nvc0_graph_init nvc3_graph_init_unk58xx[];
200
201extern struct nvc0_graph_init nvd9_graph_init_unk58xx[];
202extern struct nvc0_graph_init nvd9_graph_init_unk64xx[];
203
204extern struct nvc0_graph_init nve4_graph_init_regs[];
205extern struct nvc0_graph_init nve4_graph_init_unk[];
206extern struct nvc0_graph_init nve4_graph_init_unk88xx[];
207
151int nvc0_grctx_generate(struct nvc0_graph_priv *); 208int nvc0_grctx_generate(struct nvc0_graph_priv *);
152int nvc0_grctx_init(struct nvc0_graph_priv *, struct nvc0_grctx *); 209void nvc0_grctx_generate_main(struct nvc0_graph_priv *, struct nvc0_grctx *);
153void nvc0_grctx_data(struct nvc0_grctx *, u32, u32, u32); 210void nvc0_grctx_generate_mods(struct nvc0_graph_priv *, struct nvc0_grctx *);
154void nvc0_grctx_mmio(struct nvc0_grctx *, u32, u32, u32, u32); 211void nvc0_grctx_generate_unkn(struct nvc0_graph_priv *);
155int nvc0_grctx_fini(struct nvc0_grctx *); 212void nvc0_grctx_generate_tpcid(struct nvc0_graph_priv *);
213void nvc0_grctx_generate_r406028(struct nvc0_graph_priv *);
214void nvc0_grctx_generate_r4060a8(struct nvc0_graph_priv *);
215void nvc0_grctx_generate_r418bb8(struct nvc0_graph_priv *);
216void nve4_grctx_generate_r418bb8(struct nvc0_graph_priv *);
217void nvc0_grctx_generate_r406800(struct nvc0_graph_priv *);
156 218
157int nve0_grctx_generate(struct nvc0_graph_priv *); 219extern struct nouveau_oclass *nvc0_grctx_oclass;
220extern struct nvc0_graph_init *nvc0_grctx_init_hub[];
221extern struct nvc0_graph_init nvc0_grctx_init_base[];
222extern struct nvc0_graph_init nvc0_grctx_init_unk40xx[];
223extern struct nvc0_graph_init nvc0_grctx_init_unk44xx[];
224extern struct nvc0_graph_init nvc0_grctx_init_unk46xx[];
225extern struct nvc0_graph_init nvc0_grctx_init_unk47xx[];
226extern struct nvc0_graph_init nvc0_grctx_init_unk60xx[];
227extern struct nvc0_graph_init nvc0_grctx_init_unk64xx[];
228extern struct nvc0_graph_init nvc0_grctx_init_unk78xx[];
229extern struct nvc0_graph_init nvc0_grctx_init_unk80xx[];
230extern struct nvc0_graph_init nvc0_grctx_init_gpc_0[];
231extern struct nvc0_graph_init nvc0_grctx_init_gpc_1[];
232extern struct nvc0_graph_init nvc0_grctx_init_tpc[];
233extern struct nvc0_graph_init nvc0_grctx_init_icmd[];
234extern struct nvc0_graph_init nvd9_grctx_init_icmd[]; //
158 235
159#define mmio_data(s,a,p) nvc0_grctx_data(&info, (s), (a), (p)) 236extern struct nvc0_graph_mthd nvc0_grctx_init_mthd[];
160#define mmio_list(r,d,s,b) nvc0_grctx_mmio(&info, (r), (d), (s), (b)) 237extern struct nvc0_graph_init nvc0_grctx_init_902d[];
238extern struct nvc0_graph_init nvc0_grctx_init_9039[];
239extern struct nvc0_graph_init nvc0_grctx_init_90c0[];
240extern struct nvc0_graph_init nvc0_grctx_init_mthd_magic[];
161 241
162void nvc0_graph_ctxctl_debug(struct nvc0_graph_priv *); 242void nvc1_grctx_generate_mods(struct nvc0_graph_priv *, struct nvc0_grctx *);
163int nvc0_graph_ctor_fw(struct nvc0_graph_priv *, const char *, 243void nvc1_grctx_generate_unkn(struct nvc0_graph_priv *);
164 struct nvc0_graph_fuc *); 244extern struct nouveau_oclass *nvc1_grctx_oclass;
165void nvc0_graph_dtor(struct nouveau_object *); 245extern struct nvc0_graph_init nvc1_grctx_init_9097[];
166void nvc0_graph_init_fw(struct nvc0_graph_priv *, u32 base, 246
167 struct nvc0_graph_fuc *, struct nvc0_graph_fuc *); 247extern struct nouveau_oclass *nvc3_grctx_oclass;
168int nvc0_graph_context_ctor(struct nouveau_object *, struct nouveau_object *, 248
169 struct nouveau_oclass *, void *, u32, 249extern struct nouveau_oclass *nvc8_grctx_oclass;
170 struct nouveau_object **); 250extern struct nvc0_graph_init nvc8_grctx_init_9197[];
171void nvc0_graph_context_dtor(struct nouveau_object *); 251extern struct nvc0_graph_init nvc8_grctx_init_9297[];
252
253extern struct nouveau_oclass *nvd7_grctx_oclass;
254
255extern struct nouveau_oclass *nvd9_grctx_oclass;
256extern struct nvc0_graph_init nvd9_grctx_init_rop[];
257extern struct nvc0_graph_mthd nvd9_grctx_init_mthd[];
258
259void nve4_grctx_generate_main(struct nvc0_graph_priv *, struct nvc0_grctx *);
260void nve4_grctx_generate_unkn(struct nvc0_graph_priv *);
261extern struct nouveau_oclass *nve4_grctx_oclass;
262extern struct nvc0_graph_init nve4_grctx_init_unk46xx[];
263extern struct nvc0_graph_init nve4_grctx_init_unk47xx[];
264extern struct nvc0_graph_init nve4_grctx_init_unk58xx[];
265extern struct nvc0_graph_init nve4_grctx_init_unk80xx[];
266extern struct nvc0_graph_init nve4_grctx_init_unk90xx[];
267
268extern struct nouveau_oclass *nvf0_grctx_oclass;
269
270#define mmio_data(s,a,p) do { \
271 info->buffer[info->buffer_nr] = round_up(info->addr, (a)); \
272 info->addr = info->buffer[info->buffer_nr++] + (s); \
273 info->data->size = (s); \
274 info->data->align = (a); \
275 info->data->access = (p); \
276 info->data++; \
277} while(0)
172 278
173u64 nvc0_graph_units(struct nouveau_graph *); 279#define mmio_list(r,d,s,b) do { \
280 info->mmio->addr = (r); \
281 info->mmio->data = (d); \
282 info->mmio->shift = (s); \
283 info->mmio->buffer = (b); \
284 info->mmio++; \
285 nv_wr32(priv, (r), (d) | ((s) ? (info->buffer[(b)] >> (s)) : 0)); \
286} while(0)
174 287
175#endif 288#endif
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc1.c b/drivers/gpu/drm/nouveau/core/engine/graph/nvc1.c
new file mode 100644
index 000000000000..bc4a469b86cb
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc1.c
@@ -0,0 +1,144 @@
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 <bskeggs@redhat.com>
23 */
24
25#include "nvc0.h"
26
27/*******************************************************************************
28 * Graphics object classes
29 ******************************************************************************/
30
31static struct nouveau_oclass
32nvc1_graph_sclass[] = {
33 { 0x902d, &nouveau_object_ofuncs },
34 { 0x9039, &nouveau_object_ofuncs },
35 { 0x9097, &nouveau_object_ofuncs },
36 { 0x90c0, &nouveau_object_ofuncs },
37 { 0x9197, &nouveau_object_ofuncs },
38 {}
39};
40
41/*******************************************************************************
42 * PGRAPH engine/subdev functions
43 ******************************************************************************/
44
45static struct nvc0_graph_init
46nvc1_graph_init_gpc[] = {
47 { 0x4184a0, 1, 0x04, 0x00000000 },
48 { 0x418604, 1, 0x04, 0x00000000 },
49 { 0x418680, 1, 0x04, 0x00000000 },
50 { 0x418714, 1, 0x04, 0x00000000 },
51 { 0x418384, 1, 0x04, 0x00000000 },
52 { 0x418814, 3, 0x04, 0x00000000 },
53 { 0x418b04, 1, 0x04, 0x00000000 },
54 { 0x4188c8, 2, 0x04, 0x00000000 },
55 { 0x4188d0, 1, 0x04, 0x00010000 },
56 { 0x4188d4, 1, 0x04, 0x00000001 },
57 { 0x418910, 1, 0x04, 0x00010001 },
58 { 0x418914, 1, 0x04, 0x00000301 },
59 { 0x418918, 1, 0x04, 0x00800000 },
60 { 0x418980, 1, 0x04, 0x77777770 },
61 { 0x418984, 3, 0x04, 0x77777777 },
62 { 0x418c04, 1, 0x04, 0x00000000 },
63 { 0x418c88, 1, 0x04, 0x00000000 },
64 { 0x418d00, 1, 0x04, 0x00000000 },
65 { 0x418f08, 1, 0x04, 0x00000000 },
66 { 0x418e00, 1, 0x04, 0x00000003 },
67 { 0x418e08, 1, 0x04, 0x00000000 },
68 { 0x41900c, 1, 0x04, 0x00000000 },
69 { 0x419018, 1, 0x04, 0x00000000 },
70 {}
71};
72
73static struct nvc0_graph_init
74nvc1_graph_init_tpc[] = {
75 { 0x419d08, 2, 0x04, 0x00000000 },
76 { 0x419d10, 1, 0x04, 0x00000014 },
77 { 0x419ab0, 1, 0x04, 0x00000000 },
78 { 0x419ac8, 1, 0x04, 0x00000000 },
79 { 0x419ab8, 1, 0x04, 0x000000e7 },
80 { 0x419abc, 2, 0x04, 0x00000000 },
81 { 0x41980c, 2, 0x04, 0x00000000 },
82 { 0x419814, 1, 0x04, 0x00000004 },
83 { 0x419844, 1, 0x04, 0x00000000 },
84 { 0x41984c, 1, 0x04, 0x00005bc5 },
85 { 0x419850, 4, 0x04, 0x00000000 },
86 { 0x419880, 1, 0x04, 0x00000002 },
87 { 0x419c98, 1, 0x04, 0x00000000 },
88 { 0x419ca8, 1, 0x04, 0x80000000 },
89 { 0x419cb4, 1, 0x04, 0x00000000 },
90 { 0x419cb8, 1, 0x04, 0x00008bf4 },
91 { 0x419cbc, 1, 0x04, 0x28137606 },
92 { 0x419cc0, 2, 0x04, 0x00000000 },
93 { 0x419bd4, 1, 0x04, 0x00800000 },
94 { 0x419bdc, 1, 0x04, 0x00000000 },
95 { 0x419d2c, 1, 0x04, 0x00000000 },
96 { 0x419c0c, 1, 0x04, 0x00000000 },
97 { 0x419e00, 1, 0x04, 0x00000000 },
98 { 0x419ea0, 1, 0x04, 0x00000000 },
99 { 0x419ea4, 1, 0x04, 0x00000100 },
100 { 0x419ea8, 1, 0x04, 0x00001100 },
101 { 0x419eac, 1, 0x04, 0x11100702 },
102 { 0x419eb0, 1, 0x04, 0x00000003 },
103 { 0x419eb4, 4, 0x04, 0x00000000 },
104 { 0x419ec8, 1, 0x04, 0x0e063818 },
105 { 0x419ecc, 1, 0x04, 0x0e060e06 },
106 { 0x419ed0, 1, 0x04, 0x00003818 },
107 { 0x419ed4, 1, 0x04, 0x011104f1 },
108 { 0x419edc, 1, 0x04, 0x00000000 },
109 { 0x419f00, 1, 0x04, 0x00000000 },
110 { 0x419f2c, 1, 0x04, 0x00000000 },
111 {}
112};
113
114struct nvc0_graph_init *
115nvc1_graph_init_mmio[] = {
116 nvc0_graph_init_regs,
117 nvc0_graph_init_unk40xx,
118 nvc0_graph_init_unk44xx,
119 nvc0_graph_init_unk78xx,
120 nvc0_graph_init_unk60xx,
121 nvc3_graph_init_unk58xx,
122 nvc0_graph_init_unk80xx,
123 nvc1_graph_init_gpc,
124 nvc1_graph_init_tpc,
125 nvc0_graph_init_unk88xx,
126 nvc0_graph_tpc_0,
127 NULL
128};
129
130struct nouveau_oclass *
131nvc1_graph_oclass = &(struct nvc0_graph_oclass) {
132 .base.handle = NV_ENGINE(GR, 0xc1),
133 .base.ofuncs = &(struct nouveau_ofuncs) {
134 .ctor = nvc0_graph_ctor,
135 .dtor = nvc0_graph_dtor,
136 .init = nvc0_graph_init,
137 .fini = _nouveau_graph_fini,
138 },
139 .cclass = &nvc1_grctx_oclass,
140 .sclass = nvc1_graph_sclass,
141 .mmio = nvc1_graph_init_mmio,
142 .fecs.ucode = &nvc0_graph_fecs_ucode,
143 .gpccs.ucode = &nvc0_graph_gpccs_ucode,
144}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc3.c b/drivers/gpu/drm/nouveau/core/engine/graph/nvc3.c
new file mode 100644
index 000000000000..d44b3b3ee800
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc3.c
@@ -0,0 +1,110 @@
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 <bskeggs@redhat.com>
23 */
24
25#include "nvc0.h"
26
27/*******************************************************************************
28 * PGRAPH engine/subdev functions
29 ******************************************************************************/
30
31struct nvc0_graph_init
32nvc3_graph_init_unk58xx[] = {
33 { 0x405844, 1, 0x04, 0x00ffffff },
34 { 0x405850, 1, 0x04, 0x00000000 },
35 { 0x405900, 1, 0x04, 0x00002834 },
36 { 0x405908, 1, 0x04, 0x00000000 },
37 {}
38};
39
40static struct nvc0_graph_init
41nvc3_graph_init_tpc[] = {
42 { 0x419d08, 2, 0x04, 0x00000000 },
43 { 0x419d10, 1, 0x04, 0x00000014 },
44 { 0x419ab0, 1, 0x04, 0x00000000 },
45 { 0x419ac8, 1, 0x04, 0x00000000 },
46 { 0x419ab8, 1, 0x04, 0x000000e7 },
47 { 0x419abc, 2, 0x04, 0x00000000 },
48 { 0x41980c, 3, 0x04, 0x00000000 },
49 { 0x419844, 1, 0x04, 0x00000000 },
50 { 0x41984c, 1, 0x04, 0x00005bc5 },
51 { 0x419850, 4, 0x04, 0x00000000 },
52 { 0x419880, 1, 0x04, 0x00000002 },
53 { 0x419c98, 1, 0x04, 0x00000000 },
54 { 0x419ca8, 1, 0x04, 0x80000000 },
55 { 0x419cb4, 1, 0x04, 0x00000000 },
56 { 0x419cb8, 1, 0x04, 0x00008bf4 },
57 { 0x419cbc, 1, 0x04, 0x28137606 },
58 { 0x419cc0, 2, 0x04, 0x00000000 },
59 { 0x419bd4, 1, 0x04, 0x00800000 },
60 { 0x419bdc, 1, 0x04, 0x00000000 },
61 { 0x419d2c, 1, 0x04, 0x00000000 },
62 { 0x419c0c, 1, 0x04, 0x00000000 },
63 { 0x419e00, 1, 0x04, 0x00000000 },
64 { 0x419ea0, 1, 0x04, 0x00000000 },
65 { 0x419ea4, 1, 0x04, 0x00000100 },
66 { 0x419ea8, 1, 0x04, 0x00001100 },
67 { 0x419eac, 1, 0x04, 0x11100702 },
68 { 0x419eb0, 1, 0x04, 0x00000003 },
69 { 0x419eb4, 4, 0x04, 0x00000000 },
70 { 0x419ec8, 1, 0x04, 0x0e063818 },
71 { 0x419ecc, 1, 0x04, 0x0e060e06 },
72 { 0x419ed0, 1, 0x04, 0x00003818 },
73 { 0x419ed4, 1, 0x04, 0x011104f1 },
74 { 0x419edc, 1, 0x04, 0x00000000 },
75 { 0x419f00, 1, 0x04, 0x00000000 },
76 { 0x419f2c, 1, 0x04, 0x00000000 },
77 {}
78};
79
80static struct nvc0_graph_init *
81nvc3_graph_init_mmio[] = {
82 nvc0_graph_init_regs,
83 nvc0_graph_init_unk40xx,
84 nvc0_graph_init_unk44xx,
85 nvc0_graph_init_unk78xx,
86 nvc0_graph_init_unk60xx,
87 nvc3_graph_init_unk58xx,
88 nvc0_graph_init_unk80xx,
89 nvc0_graph_init_gpc,
90 nvc3_graph_init_tpc,
91 nvc0_graph_init_unk88xx,
92 nvc0_graph_tpc_0,
93 NULL
94};
95
96struct nouveau_oclass *
97nvc3_graph_oclass = &(struct nvc0_graph_oclass) {
98 .base.handle = NV_ENGINE(GR, 0xc3),
99 .base.ofuncs = &(struct nouveau_ofuncs) {
100 .ctor = nvc0_graph_ctor,
101 .dtor = nvc0_graph_dtor,
102 .init = nvc0_graph_init,
103 .fini = _nouveau_graph_fini,
104 },
105 .cclass = &nvc3_grctx_oclass,
106 .sclass = nvc0_graph_sclass,
107 .mmio = nvc3_graph_init_mmio,
108 .fecs.ucode = &nvc0_graph_fecs_ucode,
109 .gpccs.ucode = &nvc0_graph_gpccs_ucode,
110}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc8.c b/drivers/gpu/drm/nouveau/core/engine/graph/nvc8.c
new file mode 100644
index 000000000000..02845e567314
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc8.c
@@ -0,0 +1,141 @@
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 <bskeggs@redhat.com>
23 */
24
25#include "nvc0.h"
26
27/*******************************************************************************
28 * Graphics object classes
29 ******************************************************************************/
30
31struct nouveau_oclass
32nvc8_graph_sclass[] = {
33 { 0x902d, &nouveau_object_ofuncs },
34 { 0x9039, &nouveau_object_ofuncs },
35 { 0x9097, &nouveau_object_ofuncs },
36 { 0x90c0, &nouveau_object_ofuncs },
37 { 0x9197, &nouveau_object_ofuncs },
38 { 0x9297, &nouveau_object_ofuncs },
39 {}
40};
41
42/*******************************************************************************
43 * PGRAPH engine/subdev functions
44 ******************************************************************************/
45
46static struct nvc0_graph_init
47nvc8_graph_init_gpc[] = {
48 { 0x4184a0, 1, 0x04, 0x00000000 },
49 { 0x418604, 1, 0x04, 0x00000000 },
50 { 0x418680, 1, 0x04, 0x00000000 },
51 { 0x418714, 1, 0x04, 0x80000000 },
52 { 0x418384, 1, 0x04, 0x00000000 },
53 { 0x418814, 3, 0x04, 0x00000000 },
54 { 0x418b04, 1, 0x04, 0x00000000 },
55 { 0x4188c8, 2, 0x04, 0x00000000 },
56 { 0x4188d0, 1, 0x04, 0x00010000 },
57 { 0x4188d4, 1, 0x04, 0x00000001 },
58 { 0x418910, 1, 0x04, 0x00010001 },
59 { 0x418914, 1, 0x04, 0x00000301 },
60 { 0x418918, 1, 0x04, 0x00800000 },
61 { 0x418980, 1, 0x04, 0x77777770 },
62 { 0x418984, 3, 0x04, 0x77777777 },
63 { 0x418c04, 1, 0x04, 0x00000000 },
64 { 0x418c88, 1, 0x04, 0x00000000 },
65 { 0x418d00, 1, 0x04, 0x00000000 },
66 { 0x418f08, 1, 0x04, 0x00000000 },
67 { 0x418e00, 1, 0x04, 0x00000050 },
68 { 0x418e08, 1, 0x04, 0x00000000 },
69 { 0x41900c, 1, 0x04, 0x00000000 },
70 { 0x419018, 1, 0x04, 0x00000000 },
71 {}
72};
73
74static struct nvc0_graph_init
75nvc8_graph_init_tpc[] = {
76 { 0x419d08, 2, 0x04, 0x00000000 },
77 { 0x419d10, 1, 0x04, 0x00000014 },
78 { 0x419ab0, 1, 0x04, 0x00000000 },
79 { 0x419ab8, 1, 0x04, 0x000000e7 },
80 { 0x419abc, 2, 0x04, 0x00000000 },
81 { 0x41980c, 3, 0x04, 0x00000000 },
82 { 0x419844, 1, 0x04, 0x00000000 },
83 { 0x41984c, 1, 0x04, 0x00005bc5 },
84 { 0x419850, 4, 0x04, 0x00000000 },
85 { 0x419c98, 1, 0x04, 0x00000000 },
86 { 0x419ca8, 1, 0x04, 0x80000000 },
87 { 0x419cb4, 1, 0x04, 0x00000000 },
88 { 0x419cb8, 1, 0x04, 0x00008bf4 },
89 { 0x419cbc, 1, 0x04, 0x28137606 },
90 { 0x419cc0, 2, 0x04, 0x00000000 },
91 { 0x419bd4, 1, 0x04, 0x00800000 },
92 { 0x419bdc, 1, 0x04, 0x00000000 },
93 { 0x419d2c, 1, 0x04, 0x00000000 },
94 { 0x419c0c, 1, 0x04, 0x00000000 },
95 { 0x419e00, 1, 0x04, 0x00000000 },
96 { 0x419ea0, 1, 0x04, 0x00000000 },
97 { 0x419ea4, 1, 0x04, 0x00000100 },
98 { 0x419ea8, 1, 0x04, 0x00001100 },
99 { 0x419eac, 1, 0x04, 0x11100f02 },
100 { 0x419eb0, 1, 0x04, 0x00000003 },
101 { 0x419eb4, 4, 0x04, 0x00000000 },
102 { 0x419ec8, 1, 0x04, 0x06060618 },
103 { 0x419ed0, 1, 0x04, 0x0eff0e38 },
104 { 0x419ed4, 1, 0x04, 0x011104f1 },
105 { 0x419edc, 1, 0x04, 0x00000000 },
106 { 0x419f00, 1, 0x04, 0x00000000 },
107 { 0x419f2c, 1, 0x04, 0x00000000 },
108 {}
109};
110
111static struct nvc0_graph_init *
112nvc8_graph_init_mmio[] = {
113 nvc0_graph_init_regs,
114 nvc0_graph_init_unk40xx,
115 nvc0_graph_init_unk44xx,
116 nvc0_graph_init_unk78xx,
117 nvc0_graph_init_unk60xx,
118 nvc0_graph_init_unk58xx,
119 nvc0_graph_init_unk80xx,
120 nvc8_graph_init_gpc,
121 nvc8_graph_init_tpc,
122 nvc0_graph_init_unk88xx,
123 nvc0_graph_tpc_0,
124 NULL
125};
126
127struct nouveau_oclass *
128nvc8_graph_oclass = &(struct nvc0_graph_oclass) {
129 .base.handle = NV_ENGINE(GR, 0xc8),
130 .base.ofuncs = &(struct nouveau_ofuncs) {
131 .ctor = nvc0_graph_ctor,
132 .dtor = nvc0_graph_dtor,
133 .init = nvc0_graph_init,
134 .fini = _nouveau_graph_fini,
135 },
136 .cclass = &nvc8_grctx_oclass,
137 .sclass = nvc8_graph_sclass,
138 .mmio = nvc8_graph_init_mmio,
139 .fecs.ucode = &nvc0_graph_fecs_ucode,
140 .gpccs.ucode = &nvc0_graph_gpccs_ucode,
141}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvd7.c b/drivers/gpu/drm/nouveau/core/engine/graph/nvd7.c
new file mode 100644
index 000000000000..5052d7ab4d72
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvd7.c
@@ -0,0 +1,167 @@
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 <bskeggs@redhat.com>
23 */
24
25#include "nvc0.h"
26
27/*******************************************************************************
28 * PGRAPH engine/subdev functions
29 ******************************************************************************/
30
31#include "fuc/hubnvd7.fuc.h"
32
33struct nvc0_graph_ucode
34nvd7_graph_fecs_ucode = {
35 .code.data = nvd7_grhub_code,
36 .code.size = sizeof(nvd7_grhub_code),
37 .data.data = nvd7_grhub_data,
38 .data.size = sizeof(nvd7_grhub_data),
39};
40
41#include "fuc/gpcnvd7.fuc.h"
42
43struct nvc0_graph_ucode
44nvd7_graph_gpccs_ucode = {
45 .code.data = nvd7_grgpc_code,
46 .code.size = sizeof(nvd7_grgpc_code),
47 .data.data = nvd7_grgpc_data,
48 .data.size = sizeof(nvd7_grgpc_data),
49};
50
51static struct nvc0_graph_init
52nvd7_graph_init_gpc[] = {
53 { 0x418408, 1, 0x04, 0x00000000 },
54 { 0x4184a0, 1, 0x04, 0x00000000 },
55 { 0x4184a4, 2, 0x04, 0x00000000 },
56 { 0x418604, 1, 0x04, 0x00000000 },
57 { 0x418680, 1, 0x04, 0x00000000 },
58 { 0x418714, 1, 0x04, 0x00000000 },
59 { 0x418384, 1, 0x04, 0x00000000 },
60 { 0x418814, 3, 0x04, 0x00000000 },
61 { 0x418b04, 1, 0x04, 0x00000000 },
62 { 0x4188c8, 2, 0x04, 0x00000000 },
63 { 0x4188d0, 1, 0x04, 0x00010000 },
64 { 0x4188d4, 1, 0x04, 0x00000001 },
65 { 0x418910, 1, 0x04, 0x00010001 },
66 { 0x418914, 1, 0x04, 0x00000301 },
67 { 0x418918, 1, 0x04, 0x00800000 },
68 { 0x418980, 1, 0x04, 0x77777770 },
69 { 0x418984, 3, 0x04, 0x77777777 },
70 { 0x418c04, 1, 0x04, 0x00000000 },
71 { 0x418c64, 1, 0x04, 0x00000000 },
72 { 0x418c68, 1, 0x04, 0x00000000 },
73 { 0x418c88, 1, 0x04, 0x00000000 },
74 { 0x418cb4, 2, 0x04, 0x00000000 },
75 { 0x418d00, 1, 0x04, 0x00000000 },
76 { 0x418d28, 1, 0x04, 0x00000000 },
77 { 0x418f00, 1, 0x04, 0x00000000 },
78 { 0x418f08, 1, 0x04, 0x00000000 },
79 { 0x418f20, 2, 0x04, 0x00000000 },
80 { 0x418e00, 1, 0x04, 0x00000003 },
81 { 0x418e08, 1, 0x04, 0x00000000 },
82 { 0x418e1c, 1, 0x04, 0x00000000 },
83 { 0x418e20, 1, 0x04, 0x00000000 },
84 { 0x41900c, 1, 0x04, 0x00000000 },
85 { 0x419018, 1, 0x04, 0x00000000 },
86 {}
87};
88
89static struct nvc0_graph_init
90nvd7_graph_init_tpc[] = {
91 { 0x419d08, 2, 0x04, 0x00000000 },
92 { 0x419d10, 1, 0x04, 0x00000014 },
93 { 0x419ab0, 1, 0x04, 0x00000000 },
94 { 0x419ac8, 1, 0x04, 0x00000000 },
95 { 0x419ab8, 1, 0x04, 0x000000e7 },
96 { 0x419abc, 2, 0x04, 0x00000000 },
97 { 0x419ab4, 1, 0x04, 0x00000000 },
98 { 0x41980c, 1, 0x04, 0x00000010 },
99 { 0x419844, 1, 0x04, 0x00000000 },
100 { 0x41984c, 1, 0x04, 0x00005bc8 },
101 { 0x419850, 2, 0x04, 0x00000000 },
102 { 0x419c98, 1, 0x04, 0x00000000 },
103 { 0x419ca8, 1, 0x04, 0x80000000 },
104 { 0x419cb4, 1, 0x04, 0x00000000 },
105 { 0x419cb8, 1, 0x04, 0x00008bf4 },
106 { 0x419cbc, 1, 0x04, 0x28137606 },
107 { 0x419cc0, 2, 0x04, 0x00000000 },
108 { 0x419c0c, 1, 0x04, 0x00000000 },
109 { 0x419e00, 1, 0x04, 0x00000000 },
110 { 0x419ea0, 1, 0x04, 0x00000000 },
111 { 0x419ea4, 1, 0x04, 0x00000100 },
112 { 0x419ea8, 1, 0x04, 0x02001100 },
113 { 0x419eac, 1, 0x04, 0x11100702 },
114 { 0x419eb0, 1, 0x04, 0x00000003 },
115 { 0x419eb4, 4, 0x04, 0x00000000 },
116 { 0x419ec8, 1, 0x04, 0x0e063818 },
117 { 0x419ecc, 1, 0x04, 0x0e060e06 },
118 { 0x419ed0, 1, 0x04, 0x00003818 },
119 { 0x419ed4, 1, 0x04, 0x011104f1 },
120 { 0x419edc, 1, 0x04, 0x00000000 },
121 { 0x419f00, 1, 0x04, 0x00000000 },
122 { 0x419f2c, 1, 0x04, 0x00000000 },
123 {}
124};
125
126static struct nvc0_graph_init
127nvd7_graph_init_tpc_0[] = {
128 { 0x40402c, 1, 0x04, 0x00000000 },
129 { 0x4040f0, 1, 0x04, 0x00000000 },
130 { 0x404174, 1, 0x04, 0x00000000 },
131 { 0x503018, 1, 0x04, 0x00000001 },
132 {}
133};
134
135static struct nvc0_graph_init *
136nvd7_graph_init_mmio[] = {
137 nvc0_graph_init_regs,
138 nvc0_graph_init_unk40xx,
139 nvc0_graph_init_unk44xx,
140 nvc0_graph_init_unk78xx,
141 nvc0_graph_init_unk60xx,
142 nvd9_graph_init_unk64xx,
143 nvd9_graph_init_unk58xx,
144 nvc0_graph_init_unk80xx,
145 nvd7_graph_init_gpc,
146 nvd7_graph_init_tpc,
147 nve4_graph_init_unk,
148 nvc0_graph_init_unk88xx,
149 nvd7_graph_init_tpc_0,
150 NULL
151};
152
153struct nouveau_oclass *
154nvd7_graph_oclass = &(struct nvc0_graph_oclass) {
155 .base.handle = NV_ENGINE(GR, 0xd7),
156 .base.ofuncs = &(struct nouveau_ofuncs) {
157 .ctor = nvc0_graph_ctor,
158 .dtor = nvc0_graph_dtor,
159 .init = nvc0_graph_init,
160 .fini = _nouveau_graph_fini,
161 },
162 .cclass = &nvd7_grctx_oclass,
163 .sclass = nvc8_graph_sclass,
164 .mmio = nvd7_graph_init_mmio,
165 .fecs.ucode = &nvd7_graph_fecs_ucode,
166 .gpccs.ucode = &nvd7_graph_gpccs_ucode,
167}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvd9.c b/drivers/gpu/drm/nouveau/core/engine/graph/nvd9.c
new file mode 100644
index 000000000000..652098e0df3f
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvd9.c
@@ -0,0 +1,165 @@
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 <bskeggs@redhat.com>
23 */
24
25#include "nvc0.h"
26
27/*******************************************************************************
28 * PGRAPH engine/subdev functions
29 ******************************************************************************/
30
31struct nvc0_graph_init
32nvd9_graph_init_unk64xx[] = {
33 { 0x4064f0, 3, 0x04, 0x00000000 },
34 {}
35};
36
37struct nvc0_graph_init
38nvd9_graph_init_unk58xx[] = {
39 { 0x405844, 1, 0x04, 0x00ffffff },
40 { 0x405850, 1, 0x04, 0x00000000 },
41 { 0x405900, 1, 0x04, 0x00002834 },
42 { 0x405908, 1, 0x04, 0x00000000 },
43 { 0x405928, 1, 0x04, 0x00000000 },
44 { 0x40592c, 1, 0x04, 0x00000000 },
45 {}
46};
47
48static struct nvc0_graph_init
49nvd9_graph_init_gpc[] = {
50 { 0x418408, 1, 0x04, 0x00000000 },
51 { 0x4184a0, 1, 0x04, 0x00000000 },
52 { 0x4184a4, 2, 0x04, 0x00000000 },
53 { 0x418604, 1, 0x04, 0x00000000 },
54 { 0x418680, 1, 0x04, 0x00000000 },
55 { 0x418714, 1, 0x04, 0x00000000 },
56 { 0x418384, 1, 0x04, 0x00000000 },
57 { 0x418814, 3, 0x04, 0x00000000 },
58 { 0x418b04, 1, 0x04, 0x00000000 },
59 { 0x4188c8, 2, 0x04, 0x00000000 },
60 { 0x4188d0, 1, 0x04, 0x00010000 },
61 { 0x4188d4, 1, 0x04, 0x00000001 },
62 { 0x418910, 1, 0x04, 0x00010001 },
63 { 0x418914, 1, 0x04, 0x00000301 },
64 { 0x418918, 1, 0x04, 0x00800000 },
65 { 0x418980, 1, 0x04, 0x77777770 },
66 { 0x418984, 3, 0x04, 0x77777777 },
67 { 0x418c04, 1, 0x04, 0x00000000 },
68 { 0x418c64, 1, 0x04, 0x00000000 },
69 { 0x418c68, 1, 0x04, 0x00000000 },
70 { 0x418c88, 1, 0x04, 0x00000000 },
71 { 0x418cb4, 2, 0x04, 0x00000000 },
72 { 0x418d00, 1, 0x04, 0x00000000 },
73 { 0x418d28, 1, 0x04, 0x00000000 },
74 { 0x418d2c, 1, 0x04, 0x00000000 },
75 { 0x418f00, 1, 0x04, 0x00000000 },
76 { 0x418f08, 1, 0x04, 0x00000000 },
77 { 0x418f20, 2, 0x04, 0x00000000 },
78 { 0x418e00, 1, 0x04, 0x00000003 },
79 { 0x418e08, 1, 0x04, 0x00000000 },
80 { 0x418e1c, 1, 0x04, 0x00000000 },
81 { 0x418e20, 1, 0x04, 0x00000000 },
82 { 0x41900c, 1, 0x04, 0x00000000 },
83 { 0x419018, 1, 0x04, 0x00000000 },
84 {}
85};
86
87static struct nvc0_graph_init
88nvd9_graph_init_tpc[] = {
89 { 0x419d08, 2, 0x04, 0x00000000 },
90 { 0x419d10, 1, 0x04, 0x00000014 },
91 { 0x419ab0, 1, 0x04, 0x00000000 },
92 { 0x419ac8, 1, 0x04, 0x00000000 },
93 { 0x419ab8, 1, 0x04, 0x000000e7 },
94 { 0x419abc, 2, 0x04, 0x00000000 },
95 { 0x419ab4, 1, 0x04, 0x00000000 },
96 { 0x41980c, 1, 0x04, 0x00000010 },
97 { 0x419810, 1, 0x04, 0x00000000 },
98 { 0x419814, 1, 0x04, 0x00000004 },
99 { 0x419844, 1, 0x04, 0x00000000 },
100 { 0x41984c, 1, 0x04, 0x0000a918 },
101 { 0x419850, 4, 0x04, 0x00000000 },
102 { 0x419880, 1, 0x04, 0x00000002 },
103 { 0x419c98, 1, 0x04, 0x00000000 },
104 { 0x419ca8, 1, 0x04, 0x80000000 },
105 { 0x419cb4, 1, 0x04, 0x00000000 },
106 { 0x419cb8, 1, 0x04, 0x00008bf4 },
107 { 0x419cbc, 1, 0x04, 0x28137606 },
108 { 0x419cc0, 2, 0x04, 0x00000000 },
109 { 0x419bd4, 1, 0x04, 0x00800000 },
110 { 0x419bdc, 1, 0x04, 0x00000000 },
111 { 0x419bf8, 1, 0x04, 0x00000000 },
112 { 0x419bfc, 1, 0x04, 0x00000000 },
113 { 0x419d2c, 1, 0x04, 0x00000000 },
114 { 0x419d48, 1, 0x04, 0x00000000 },
115 { 0x419d4c, 1, 0x04, 0x00000000 },
116 { 0x419c0c, 1, 0x04, 0x00000000 },
117 { 0x419e00, 1, 0x04, 0x00000000 },
118 { 0x419ea0, 1, 0x04, 0x00000000 },
119 { 0x419ea4, 1, 0x04, 0x00000100 },
120 { 0x419ea8, 1, 0x04, 0x02001100 },
121 { 0x419eac, 1, 0x04, 0x11100702 },
122 { 0x419eb0, 1, 0x04, 0x00000003 },
123 { 0x419eb4, 4, 0x04, 0x00000000 },
124 { 0x419ec8, 1, 0x04, 0x0e063818 },
125 { 0x419ecc, 1, 0x04, 0x0e060e06 },
126 { 0x419ed0, 1, 0x04, 0x00003818 },
127 { 0x419ed4, 1, 0x04, 0x011104f1 },
128 { 0x419edc, 1, 0x04, 0x00000000 },
129 { 0x419f00, 1, 0x04, 0x00000000 },
130 { 0x419f2c, 1, 0x04, 0x00000000 },
131 {}
132};
133
134static struct nvc0_graph_init *
135nvd9_graph_init_mmio[] = {
136 nvc0_graph_init_regs,
137 nvc0_graph_init_unk40xx,
138 nvc0_graph_init_unk44xx,
139 nvc0_graph_init_unk78xx,
140 nvc0_graph_init_unk60xx,
141 nvd9_graph_init_unk64xx,
142 nvd9_graph_init_unk58xx,
143 nvc0_graph_init_unk80xx,
144 nvd9_graph_init_gpc,
145 nvd9_graph_init_tpc,
146 nvc0_graph_init_unk88xx,
147 nvc0_graph_tpc_0,
148 NULL
149};
150
151struct nouveau_oclass *
152nvd9_graph_oclass = &(struct nvc0_graph_oclass) {
153 .base.handle = NV_ENGINE(GR, 0xd9),
154 .base.ofuncs = &(struct nouveau_ofuncs) {
155 .ctor = nvc0_graph_ctor,
156 .dtor = nvc0_graph_dtor,
157 .init = nvc0_graph_init,
158 .fini = _nouveau_graph_fini,
159 },
160 .cclass = &nvd9_grctx_oclass,
161 .sclass = nvc8_graph_sclass,
162 .mmio = nvd9_graph_init_mmio,
163 .fecs.ucode = &nvc0_graph_fecs_ucode,
164 .gpccs.ucode = &nvc0_graph_gpccs_ucode,
165}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c b/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c
deleted file mode 100644
index 678c16f63055..000000000000
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c
+++ /dev/null
@@ -1,807 +0,0 @@
1/*
2 * Copyright 2012 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 "nvc0.h"
26#include "fuc/hubnve0.fuc.h"
27#include "fuc/gpcnve0.fuc.h"
28
29/*******************************************************************************
30 * Graphics object classes
31 ******************************************************************************/
32
33static struct nouveau_oclass
34nve0_graph_sclass[] = {
35 { 0x902d, &nouveau_object_ofuncs },
36 { 0xa040, &nouveau_object_ofuncs },
37 { 0xa097, &nouveau_object_ofuncs },
38 { 0xa0c0, &nouveau_object_ofuncs },
39 { 0xa0b5, &nouveau_object_ofuncs },
40 {}
41};
42
43/*******************************************************************************
44 * PGRAPH context
45 ******************************************************************************/
46
47static struct nouveau_oclass
48nve0_graph_cclass = {
49 .handle = NV_ENGCTX(GR, 0xe0),
50 .ofuncs = &(struct nouveau_ofuncs) {
51 .ctor = nvc0_graph_context_ctor,
52 .dtor = nvc0_graph_context_dtor,
53 .init = _nouveau_graph_context_init,
54 .fini = _nouveau_graph_context_fini,
55 .rd32 = _nouveau_graph_context_rd32,
56 .wr32 = _nouveau_graph_context_wr32,
57 },
58};
59
60/*******************************************************************************
61 * PGRAPH engine/subdev functions
62 ******************************************************************************/
63
64static void
65nve0_graph_ctxctl_isr(struct nvc0_graph_priv *priv)
66{
67 u32 ustat = nv_rd32(priv, 0x409c18);
68
69 if (ustat & 0x00000001)
70 nv_error(priv, "CTXCTRL ucode error\n");
71 if (ustat & 0x00080000)
72 nv_error(priv, "CTXCTRL watchdog timeout\n");
73 if (ustat & ~0x00080001)
74 nv_error(priv, "CTXCTRL 0x%08x\n", ustat);
75
76 nvc0_graph_ctxctl_debug(priv);
77 nv_wr32(priv, 0x409c20, ustat);
78}
79
80static const struct nouveau_enum nve0_mp_warp_error[] = {
81 { 0x00, "NO_ERROR" },
82 { 0x01, "STACK_MISMATCH" },
83 { 0x05, "MISALIGNED_PC" },
84 { 0x08, "MISALIGNED_GPR" },
85 { 0x09, "INVALID_OPCODE" },
86 { 0x0d, "GPR_OUT_OF_BOUNDS" },
87 { 0x0e, "MEM_OUT_OF_BOUNDS" },
88 { 0x0f, "UNALIGNED_MEM_ACCESS" },
89 { 0x11, "INVALID_PARAM" },
90 {}
91};
92
93static const struct nouveau_enum nve0_mp_global_error[] = {
94 { 2, "MULTIPLE_WARP_ERRORS" },
95 { 3, "OUT_OF_STACK_SPACE" },
96 {}
97};
98
99static const struct nouveau_enum nve0_gpc_rop_error[] = {
100 { 1, "RT_PITCH_OVERRUN" },
101 { 4, "RT_WIDTH_OVERRUN" },
102 { 5, "RT_HEIGHT_OVERRUN" },
103 { 7, "ZETA_STORAGE_TYPE_MISMATCH" },
104 { 8, "RT_STORAGE_TYPE_MISMATCH" },
105 { 10, "RT_LINEAR_MISMATCH" },
106 {}
107};
108
109static const struct nouveau_enum nve0_sked_error[] = {
110 { 7, "CONSTANT_BUFFER_SIZE" },
111 { 9, "LOCAL_MEMORY_SIZE_POS" },
112 { 10, "LOCAL_MEMORY_SIZE_NEG" },
113 { 11, "WARP_CSTACK_SIZE" },
114 { 12, "TOTAL_TEMP_SIZE" },
115 { 13, "REGISTER_COUNT" },
116 { 18, "TOTAL_THREADS" },
117 { 20, "PROGRAM_OFFSET" },
118 { 21, "SHARED_MEMORY_SIZE" },
119 { 25, "SHARED_CONFIG_TOO_SMALL" },
120 { 26, "TOTAL_REGISTER_COUNT" },
121 {}
122};
123
124static void
125nve0_graph_mp_trap(struct nvc0_graph_priv *priv, int gpc, int tp)
126{
127 int i;
128 u32 werr = nv_rd32(priv, TPC_UNIT(gpc, tp, 0x648));
129 u32 gerr = nv_rd32(priv, TPC_UNIT(gpc, tp, 0x650));
130
131 nv_error(priv, "GPC%i/TP%i/MP trap:", gpc, tp);
132
133 for (i = 0; i <= 31; ++i) {
134 if (!(gerr & (1 << i)))
135 continue;
136 pr_cont(" ");
137 nouveau_enum_print(nve0_mp_global_error, i);
138 }
139 if (werr) {
140 pr_cont(" ");
141 nouveau_enum_print(nve0_mp_warp_error, werr & 0xffff);
142 }
143 pr_cont("\n");
144
145 /* disable MP trap to avoid spam */
146 nv_mask(priv, TPC_UNIT(gpc, tp, 0x50c), 0x2, 0x0);
147
148 /* TODO: figure out how to resume after an MP trap */
149}
150
151static void
152nve0_graph_tp_trap(struct nvc0_graph_priv *priv, int gpc, int tp)
153{
154 u32 stat = nv_rd32(priv, TPC_UNIT(gpc, tp, 0x508));
155
156 if (stat & 0x1) {
157 u32 trap = nv_rd32(priv, TPC_UNIT(gpc, tp, 0x224));
158 nv_error(priv, "GPC%i/TP%i/TEX trap: %08x\n",
159 gpc, tp, trap);
160
161 nv_wr32(priv, TPC_UNIT(gpc, tp, 0x224), 0xc0000000);
162 stat &= ~0x1;
163 }
164
165 if (stat & 0x2) {
166 nve0_graph_mp_trap(priv, gpc, tp);
167 stat &= ~0x2;
168 }
169
170 if (stat & 0x4) {
171 u32 trap = nv_rd32(priv, TPC_UNIT(gpc, tp, 0x084));
172 nv_error(priv, "GPC%i/TP%i/POLY trap: %08x\n",
173 gpc, tp, trap);
174
175 nv_wr32(priv, TPC_UNIT(gpc, tp, 0x084), 0xc0000000);
176 stat &= ~0x4;
177 }
178
179 if (stat & 0x8) {
180 u32 trap = nv_rd32(priv, TPC_UNIT(gpc, tp, 0x48c));
181 nv_error(priv, "GPC%i/TP%i/L1C trap: %08x\n",
182 gpc, tp, trap);
183
184 nv_wr32(priv, TPC_UNIT(gpc, tp, 0x48c), 0xc0000000);
185 stat &= ~0x8;
186 }
187
188 if (stat) {
189 nv_error(priv, "GPC%i/TP%i: unknown stat %08x\n",
190 gpc, tp, stat);
191 }
192}
193
194static void
195nve0_graph_gpc_trap(struct nvc0_graph_priv *priv)
196{
197 const u32 mask = nv_rd32(priv, 0x400118);
198 int gpc;
199
200 for (gpc = 0; gpc < 4; ++gpc) {
201 u32 stat;
202 int tp;
203
204 if (!(mask & (1 << gpc)))
205 continue;
206 stat = nv_rd32(priv, GPC_UNIT(gpc, 0x2c90));
207
208 if (stat & 0x0001) {
209 u32 trap[4];
210 int i;
211
212 trap[0] = nv_rd32(priv, GPC_UNIT(gpc, 0x0420));
213 trap[1] = nv_rd32(priv, GPC_UNIT(gpc, 0x0434));
214 trap[2] = nv_rd32(priv, GPC_UNIT(gpc, 0x0438));
215 trap[3] = nv_rd32(priv, GPC_UNIT(gpc, 0x043c));
216
217 nv_error(priv, "GPC%i/PROP trap:", gpc);
218 for (i = 0; i <= 29; ++i) {
219 if (!(trap[0] & (1 << i)))
220 continue;
221 pr_cont(" ");
222 nouveau_enum_print(nve0_gpc_rop_error, i);
223 }
224 pr_cont("\n");
225
226 nv_error(priv, "x = %u, y = %u, "
227 "format = %x, storage type = %x\n",
228 trap[1] & 0xffff,
229 trap[1] >> 16,
230 (trap[2] >> 8) & 0x3f,
231 trap[3] & 0xff);
232
233 nv_wr32(priv, GPC_UNIT(gpc, 0x0420), 0xc0000000);
234 stat &= ~0x0001;
235 }
236
237 if (stat & 0x0002) {
238 u32 trap = nv_rd32(priv, GPC_UNIT(gpc, 0x0900));
239 nv_error(priv, "GPC%i/ZCULL trap: %08x\n", gpc,
240 trap);
241 nv_wr32(priv, GPC_UNIT(gpc, 0x0900), 0xc0000000);
242 stat &= ~0x0002;
243 }
244
245 if (stat & 0x0004) {
246 u32 trap = nv_rd32(priv, GPC_UNIT(gpc, 0x1028));
247 nv_error(priv, "GPC%i/CCACHE trap: %08x\n", gpc,
248 trap);
249 nv_wr32(priv, GPC_UNIT(gpc, 0x1028), 0xc0000000);
250 stat &= ~0x0004;
251 }
252
253 if (stat & 0x0008) {
254 u32 trap = nv_rd32(priv, GPC_UNIT(gpc, 0x0824));
255 nv_error(priv, "GPC%i/ESETUP trap %08x\n", gpc,
256 trap);
257 nv_wr32(priv, GPC_UNIT(gpc, 0x0824), 0xc0000000);
258 stat &= ~0x0008;
259 }
260
261 for (tp = 0; tp < 8; ++tp) {
262 if (stat & (1 << (16 + tp)))
263 nve0_graph_tp_trap(priv, gpc, tp);
264 }
265 stat &= ~0xff0000;
266
267 if (stat) {
268 nv_error(priv, "GPC%i: unknown stat %08x\n",
269 gpc, stat);
270 }
271 }
272}
273
274
275static void
276nve0_graph_trap_isr(struct nvc0_graph_priv *priv, int chid, u64 inst,
277 struct nouveau_object *engctx)
278{
279 u32 trap = nv_rd32(priv, 0x400108);
280 int i;
281 int rop;
282
283 if (trap & 0x00000001) {
284 u32 stat = nv_rd32(priv, 0x404000);
285 nv_error(priv, "DISPATCH ch %d [0x%010llx %s] 0x%08x\n",
286 chid, inst, nouveau_client_name(engctx), stat);
287 nv_wr32(priv, 0x404000, 0xc0000000);
288 nv_wr32(priv, 0x400108, 0x00000001);
289 trap &= ~0x00000001;
290 }
291
292 if (trap & 0x00000010) {
293 u32 stat = nv_rd32(priv, 0x405840);
294 nv_error(priv, "SHADER ch %d [0x%010llx %s] 0x%08x\n",
295 chid, inst, nouveau_client_name(engctx), stat);
296 nv_wr32(priv, 0x405840, 0xc0000000);
297 nv_wr32(priv, 0x400108, 0x00000010);
298 trap &= ~0x00000010;
299 }
300
301 if (trap & 0x00000100) {
302 u32 stat = nv_rd32(priv, 0x407020);
303 nv_error(priv, "SKED ch %d [0x%010llx %s]:",
304 chid, inst, nouveau_client_name(engctx));
305
306 for (i = 0; i <= 29; ++i) {
307 if (!(stat & (1 << i)))
308 continue;
309 pr_cont(" ");
310 nouveau_enum_print(nve0_sked_error, i);
311 }
312 pr_cont("\n");
313
314 if (stat & 0x3fffffff)
315 nv_wr32(priv, 0x407020, 0x40000000);
316 nv_wr32(priv, 0x400108, 0x00000100);
317 trap &= ~0x00000100;
318 }
319
320 if (trap & 0x01000000) {
321 nv_error(priv, "GPC ch %d [0x%010llx %s]:\n",
322 chid, inst, nouveau_client_name(engctx));
323 nve0_graph_gpc_trap(priv);
324 trap &= ~0x01000000;
325 }
326
327 if (trap & 0x02000000) {
328 for (rop = 0; rop < priv->rop_nr; rop++) {
329 u32 statz = nv_rd32(priv, ROP_UNIT(rop, 0x070));
330 u32 statc = nv_rd32(priv, ROP_UNIT(rop, 0x144));
331 nv_error(priv,
332 "ROP%d ch %d [0x%010llx %s] 0x%08x 0x%08x\n",
333 rop, chid, inst, nouveau_client_name(engctx),
334 statz, statc);
335 nv_wr32(priv, ROP_UNIT(rop, 0x070), 0xc0000000);
336 nv_wr32(priv, ROP_UNIT(rop, 0x144), 0xc0000000);
337 }
338 nv_wr32(priv, 0x400108, 0x02000000);
339 trap &= ~0x02000000;
340 }
341
342 if (trap) {
343 nv_error(priv, "TRAP ch %d [0x%010llx %s] 0x%08x\n",
344 chid, inst, nouveau_client_name(engctx), trap);
345 nv_wr32(priv, 0x400108, trap);
346 }
347}
348
349static void
350nve0_graph_intr(struct nouveau_subdev *subdev)
351{
352 struct nouveau_fifo *pfifo = nouveau_fifo(subdev);
353 struct nouveau_engine *engine = nv_engine(subdev);
354 struct nouveau_object *engctx;
355 struct nouveau_handle *handle;
356 struct nvc0_graph_priv *priv = (void *)subdev;
357 u64 inst = nv_rd32(priv, 0x409b00) & 0x0fffffff;
358 u32 stat = nv_rd32(priv, 0x400100);
359 u32 addr = nv_rd32(priv, 0x400704);
360 u32 mthd = (addr & 0x00003ffc);
361 u32 subc = (addr & 0x00070000) >> 16;
362 u32 data = nv_rd32(priv, 0x400708);
363 u32 code = nv_rd32(priv, 0x400110);
364 u32 class = nv_rd32(priv, 0x404200 + (subc * 4));
365 int chid;
366
367 engctx = nouveau_engctx_get(engine, inst);
368 chid = pfifo->chid(pfifo, engctx);
369
370 if (stat & 0x00000010) {
371 handle = nouveau_handle_get_class(engctx, class);
372 if (!handle || nv_call(handle->object, mthd, data)) {
373 nv_error(priv,
374 "ILLEGAL_MTHD ch %d [0x%010llx %s] subc %d class 0x%04x mthd 0x%04x data 0x%08x\n",
375 chid, inst, nouveau_client_name(engctx), subc,
376 class, mthd, data);
377 }
378 nouveau_handle_put(handle);
379 nv_wr32(priv, 0x400100, 0x00000010);
380 stat &= ~0x00000010;
381 }
382
383 if (stat & 0x00000020) {
384 nv_error(priv,
385 "ILLEGAL_CLASS ch %d [0x%010llx %s] subc %d class 0x%04x mthd 0x%04x data 0x%08x\n",
386 chid, inst, nouveau_client_name(engctx), subc, class,
387 mthd, data);
388 nv_wr32(priv, 0x400100, 0x00000020);
389 stat &= ~0x00000020;
390 }
391
392 if (stat & 0x00100000) {
393 nv_error(priv, "DATA_ERROR [");
394 nouveau_enum_print(nv50_data_error_names, code);
395 pr_cont("] ch %d [0x%010llx %s] subc %d class 0x%04x mthd 0x%04x data 0x%08x\n",
396 chid, inst, nouveau_client_name(engctx), subc, class,
397 mthd, data);
398 nv_wr32(priv, 0x400100, 0x00100000);
399 stat &= ~0x00100000;
400 }
401
402 if (stat & 0x00200000) {
403 nve0_graph_trap_isr(priv, chid, inst, engctx);
404 nv_wr32(priv, 0x400100, 0x00200000);
405 stat &= ~0x00200000;
406 }
407
408 if (stat & 0x00080000) {
409 nve0_graph_ctxctl_isr(priv);
410 nv_wr32(priv, 0x400100, 0x00080000);
411 stat &= ~0x00080000;
412 }
413
414 if (stat) {
415 nv_error(priv, "unknown stat 0x%08x\n", stat);
416 nv_wr32(priv, 0x400100, stat);
417 }
418
419 nv_wr32(priv, 0x400500, 0x00010001);
420 nouveau_engctx_put(engctx);
421}
422
423static int
424nve0_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
425 struct nouveau_oclass *oclass, void *data, u32 size,
426 struct nouveau_object **pobject)
427{
428 struct nouveau_device *device = nv_device(parent);
429 struct nvc0_graph_priv *priv;
430 int ret, i;
431
432 ret = nouveau_graph_create(parent, engine, oclass, true, &priv);
433 *pobject = nv_object(priv);
434 if (ret)
435 return ret;
436
437 nv_subdev(priv)->unit = 0x18001000;
438 nv_subdev(priv)->intr = nve0_graph_intr;
439 nv_engine(priv)->cclass = &nve0_graph_cclass;
440 nv_engine(priv)->sclass = nve0_graph_sclass;
441
442 priv->base.units = nvc0_graph_units;
443
444 if (nouveau_boolopt(device->cfgopt, "NvGrUseFW", false)) {
445 nv_info(priv, "using external firmware\n");
446 if (nvc0_graph_ctor_fw(priv, "fuc409c", &priv->fuc409c) ||
447 nvc0_graph_ctor_fw(priv, "fuc409d", &priv->fuc409d) ||
448 nvc0_graph_ctor_fw(priv, "fuc41ac", &priv->fuc41ac) ||
449 nvc0_graph_ctor_fw(priv, "fuc41ad", &priv->fuc41ad))
450 return -EINVAL;
451 priv->firmware = true;
452 }
453
454 ret = nouveau_gpuobj_new(nv_object(priv), NULL, 0x1000, 256, 0,
455 &priv->unk4188b4);
456 if (ret)
457 return ret;
458
459 ret = nouveau_gpuobj_new(nv_object(priv), NULL, 0x1000, 256, 0,
460 &priv->unk4188b8);
461 if (ret)
462 return ret;
463
464 for (i = 0; i < 0x1000; i += 4) {
465 nv_wo32(priv->unk4188b4, i, 0x00000010);
466 nv_wo32(priv->unk4188b8, i, 0x00000010);
467 }
468
469 priv->gpc_nr = nv_rd32(priv, 0x409604) & 0x0000001f;
470 priv->rop_nr = (nv_rd32(priv, 0x409604) & 0x001f0000) >> 16;
471 for (i = 0; i < priv->gpc_nr; i++) {
472 priv->tpc_nr[i] = nv_rd32(priv, GPC_UNIT(i, 0x2608));
473 priv->tpc_total += priv->tpc_nr[i];
474 }
475
476 switch (nv_device(priv)->chipset) {
477 case 0xe4:
478 if (priv->tpc_total == 8)
479 priv->magic_not_rop_nr = 3;
480 else
481 if (priv->tpc_total == 7)
482 priv->magic_not_rop_nr = 1;
483 break;
484 case 0xe7:
485 case 0xe6:
486 priv->magic_not_rop_nr = 1;
487 break;
488 default:
489 break;
490 }
491
492 return 0;
493}
494
495static void
496nve0_graph_init_obj418880(struct nvc0_graph_priv *priv)
497{
498 int i;
499
500 nv_wr32(priv, GPC_BCAST(0x0880), 0x00000000);
501 nv_wr32(priv, GPC_BCAST(0x08a4), 0x00000000);
502 for (i = 0; i < 4; i++)
503 nv_wr32(priv, GPC_BCAST(0x0888) + (i * 4), 0x00000000);
504 nv_wr32(priv, GPC_BCAST(0x08b4), priv->unk4188b4->addr >> 8);
505 nv_wr32(priv, GPC_BCAST(0x08b8), priv->unk4188b8->addr >> 8);
506}
507
508static void
509nve0_graph_init_regs(struct nvc0_graph_priv *priv)
510{
511 nv_wr32(priv, 0x400080, 0x003083c2);
512 nv_wr32(priv, 0x400088, 0x0001ffe7);
513 nv_wr32(priv, 0x40008c, 0x00000000);
514 nv_wr32(priv, 0x400090, 0x00000030);
515 nv_wr32(priv, 0x40013c, 0x003901f7);
516 nv_wr32(priv, 0x400140, 0x00000100);
517 nv_wr32(priv, 0x400144, 0x00000000);
518 nv_wr32(priv, 0x400148, 0x00000110);
519 nv_wr32(priv, 0x400138, 0x00000000);
520 nv_wr32(priv, 0x400130, 0x00000000);
521 nv_wr32(priv, 0x400134, 0x00000000);
522 nv_wr32(priv, 0x400124, 0x00000002);
523}
524
525static void
526nve0_graph_init_units(struct nvc0_graph_priv *priv)
527{
528 nv_wr32(priv, 0x409ffc, 0x00000000);
529 nv_wr32(priv, 0x409c14, 0x00003e3e);
530 nv_wr32(priv, 0x409c24, 0x000f0000);
531
532 nv_wr32(priv, 0x404000, 0xc0000000);
533 nv_wr32(priv, 0x404600, 0xc0000000);
534 nv_wr32(priv, 0x408030, 0xc0000000);
535 nv_wr32(priv, 0x404490, 0xc0000000);
536 nv_wr32(priv, 0x406018, 0xc0000000);
537 nv_wr32(priv, 0x407020, 0xc0000000);
538 nv_wr32(priv, 0x405840, 0xc0000000);
539 nv_wr32(priv, 0x405844, 0x00ffffff);
540
541 nv_mask(priv, 0x419cc0, 0x00000008, 0x00000008);
542 nv_mask(priv, 0x419eb4, 0x00001000, 0x00001000);
543
544}
545
546static void
547nve0_graph_init_gpc_0(struct nvc0_graph_priv *priv)
548{
549 const u32 magicgpc918 = DIV_ROUND_UP(0x00800000, priv->tpc_total);
550 u32 data[TPC_MAX / 8];
551 u8 tpcnr[GPC_MAX];
552 int i, gpc, tpc;
553
554 nv_wr32(priv, GPC_UNIT(0, 0x3018), 0x00000001);
555
556 memset(data, 0x00, sizeof(data));
557 memcpy(tpcnr, priv->tpc_nr, sizeof(priv->tpc_nr));
558 for (i = 0, gpc = -1; i < priv->tpc_total; i++) {
559 do {
560 gpc = (gpc + 1) % priv->gpc_nr;
561 } while (!tpcnr[gpc]);
562 tpc = priv->tpc_nr[gpc] - tpcnr[gpc]--;
563
564 data[i / 8] |= tpc << ((i % 8) * 4);
565 }
566
567 nv_wr32(priv, GPC_BCAST(0x0980), data[0]);
568 nv_wr32(priv, GPC_BCAST(0x0984), data[1]);
569 nv_wr32(priv, GPC_BCAST(0x0988), data[2]);
570 nv_wr32(priv, GPC_BCAST(0x098c), data[3]);
571
572 for (gpc = 0; gpc < priv->gpc_nr; gpc++) {
573 nv_wr32(priv, GPC_UNIT(gpc, 0x0914), priv->magic_not_rop_nr << 8 |
574 priv->tpc_nr[gpc]);
575 nv_wr32(priv, GPC_UNIT(gpc, 0x0910), 0x00040000 | priv->tpc_total);
576 nv_wr32(priv, GPC_UNIT(gpc, 0x0918), magicgpc918);
577 }
578
579 nv_wr32(priv, GPC_BCAST(0x3fd4), magicgpc918);
580 nv_wr32(priv, GPC_BCAST(0x08ac), nv_rd32(priv, 0x100800));
581}
582
583static void
584nve0_graph_init_gpc_1(struct nvc0_graph_priv *priv)
585{
586 int gpc, tpc;
587
588 for (gpc = 0; gpc < priv->gpc_nr; gpc++) {
589 nv_wr32(priv, GPC_UNIT(gpc, 0x3038), 0xc0000000);
590 nv_wr32(priv, GPC_UNIT(gpc, 0x0420), 0xc0000000);
591 nv_wr32(priv, GPC_UNIT(gpc, 0x0900), 0xc0000000);
592 nv_wr32(priv, GPC_UNIT(gpc, 0x1028), 0xc0000000);
593 nv_wr32(priv, GPC_UNIT(gpc, 0x0824), 0xc0000000);
594 for (tpc = 0; tpc < priv->tpc_nr[gpc]; tpc++) {
595 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x508), 0xffffffff);
596 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x50c), 0xffffffff);
597 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x224), 0xc0000000);
598 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x48c), 0xc0000000);
599 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x084), 0xc0000000);
600 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x644), 0x001ffffe);
601 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x64c), 0x0000000f);
602 }
603 nv_wr32(priv, GPC_UNIT(gpc, 0x2c90), 0xffffffff);
604 nv_wr32(priv, GPC_UNIT(gpc, 0x2c94), 0xffffffff);
605 }
606}
607
608static void
609nve0_graph_init_rop(struct nvc0_graph_priv *priv)
610{
611 int rop;
612
613 for (rop = 0; rop < priv->rop_nr; rop++) {
614 nv_wr32(priv, ROP_UNIT(rop, 0x144), 0xc0000000);
615 nv_wr32(priv, ROP_UNIT(rop, 0x070), 0xc0000000);
616 nv_wr32(priv, ROP_UNIT(rop, 0x204), 0xffffffff);
617 nv_wr32(priv, ROP_UNIT(rop, 0x208), 0xffffffff);
618 }
619}
620
621static int
622nve0_graph_init_ctxctl(struct nvc0_graph_priv *priv)
623{
624 u32 r000260;
625 int i;
626
627 if (priv->firmware) {
628 /* load fuc microcode */
629 r000260 = nv_mask(priv, 0x000260, 0x00000001, 0x00000000);
630 nvc0_graph_init_fw(priv, 0x409000, &priv->fuc409c, &priv->fuc409d);
631 nvc0_graph_init_fw(priv, 0x41a000, &priv->fuc41ac, &priv->fuc41ad);
632 nv_wr32(priv, 0x000260, r000260);
633
634 /* start both of them running */
635 nv_wr32(priv, 0x409840, 0xffffffff);
636 nv_wr32(priv, 0x41a10c, 0x00000000);
637 nv_wr32(priv, 0x40910c, 0x00000000);
638 nv_wr32(priv, 0x41a100, 0x00000002);
639 nv_wr32(priv, 0x409100, 0x00000002);
640 if (!nv_wait(priv, 0x409800, 0x00000001, 0x00000001))
641 nv_error(priv, "0x409800 wait failed\n");
642
643 nv_wr32(priv, 0x409840, 0xffffffff);
644 nv_wr32(priv, 0x409500, 0x7fffffff);
645 nv_wr32(priv, 0x409504, 0x00000021);
646
647 nv_wr32(priv, 0x409840, 0xffffffff);
648 nv_wr32(priv, 0x409500, 0x00000000);
649 nv_wr32(priv, 0x409504, 0x00000010);
650 if (!nv_wait_ne(priv, 0x409800, 0xffffffff, 0x00000000)) {
651 nv_error(priv, "fuc09 req 0x10 timeout\n");
652 return -EBUSY;
653 }
654 priv->size = nv_rd32(priv, 0x409800);
655
656 nv_wr32(priv, 0x409840, 0xffffffff);
657 nv_wr32(priv, 0x409500, 0x00000000);
658 nv_wr32(priv, 0x409504, 0x00000016);
659 if (!nv_wait_ne(priv, 0x409800, 0xffffffff, 0x00000000)) {
660 nv_error(priv, "fuc09 req 0x16 timeout\n");
661 return -EBUSY;
662 }
663
664 nv_wr32(priv, 0x409840, 0xffffffff);
665 nv_wr32(priv, 0x409500, 0x00000000);
666 nv_wr32(priv, 0x409504, 0x00000025);
667 if (!nv_wait_ne(priv, 0x409800, 0xffffffff, 0x00000000)) {
668 nv_error(priv, "fuc09 req 0x25 timeout\n");
669 return -EBUSY;
670 }
671
672 nv_wr32(priv, 0x409800, 0x00000000);
673 nv_wr32(priv, 0x409500, 0x00000001);
674 nv_wr32(priv, 0x409504, 0x00000030);
675 if (!nv_wait_ne(priv, 0x409800, 0xffffffff, 0x00000000)) {
676 nv_error(priv, "fuc09 req 0x30 timeout\n");
677 return -EBUSY;
678 }
679
680 nv_wr32(priv, 0x409810, 0xb00095c8);
681 nv_wr32(priv, 0x409800, 0x00000000);
682 nv_wr32(priv, 0x409500, 0x00000001);
683 nv_wr32(priv, 0x409504, 0x00000031);
684 if (!nv_wait_ne(priv, 0x409800, 0xffffffff, 0x00000000)) {
685 nv_error(priv, "fuc09 req 0x31 timeout\n");
686 return -EBUSY;
687 }
688
689 nv_wr32(priv, 0x409810, 0x00080420);
690 nv_wr32(priv, 0x409800, 0x00000000);
691 nv_wr32(priv, 0x409500, 0x00000001);
692 nv_wr32(priv, 0x409504, 0x00000032);
693 if (!nv_wait_ne(priv, 0x409800, 0xffffffff, 0x00000000)) {
694 nv_error(priv, "fuc09 req 0x32 timeout\n");
695 return -EBUSY;
696 }
697
698 nv_wr32(priv, 0x409614, 0x00000070);
699 nv_wr32(priv, 0x409614, 0x00000770);
700 nv_wr32(priv, 0x40802c, 0x00000001);
701
702 if (priv->data == NULL) {
703 int ret = nve0_grctx_generate(priv);
704 if (ret) {
705 nv_error(priv, "failed to construct context\n");
706 return ret;
707 }
708 }
709
710 return 0;
711 }
712
713 /* load HUB microcode */
714 r000260 = nv_mask(priv, 0x000260, 0x00000001, 0x00000000);
715 nv_wr32(priv, 0x4091c0, 0x01000000);
716 for (i = 0; i < sizeof(nve0_grhub_data) / 4; i++)
717 nv_wr32(priv, 0x4091c4, nve0_grhub_data[i]);
718
719 nv_wr32(priv, 0x409180, 0x01000000);
720 for (i = 0; i < sizeof(nve0_grhub_code) / 4; i++) {
721 if ((i & 0x3f) == 0)
722 nv_wr32(priv, 0x409188, i >> 6);
723 nv_wr32(priv, 0x409184, nve0_grhub_code[i]);
724 }
725
726 /* load GPC microcode */
727 nv_wr32(priv, 0x41a1c0, 0x01000000);
728 for (i = 0; i < sizeof(nve0_grgpc_data) / 4; i++)
729 nv_wr32(priv, 0x41a1c4, nve0_grgpc_data[i]);
730
731 nv_wr32(priv, 0x41a180, 0x01000000);
732 for (i = 0; i < sizeof(nve0_grgpc_code) / 4; i++) {
733 if ((i & 0x3f) == 0)
734 nv_wr32(priv, 0x41a188, i >> 6);
735 nv_wr32(priv, 0x41a184, nve0_grgpc_code[i]);
736 }
737 nv_wr32(priv, 0x000260, r000260);
738
739 /* start HUB ucode running, it'll init the GPCs */
740 nv_wr32(priv, 0x409800, nv_device(priv)->chipset);
741 nv_wr32(priv, 0x40910c, 0x00000000);
742 nv_wr32(priv, 0x409100, 0x00000002);
743 if (!nv_wait(priv, 0x409800, 0x80000000, 0x80000000)) {
744 nv_error(priv, "HUB_INIT timed out\n");
745 nvc0_graph_ctxctl_debug(priv);
746 return -EBUSY;
747 }
748
749 priv->size = nv_rd32(priv, 0x409804);
750 if (priv->data == NULL) {
751 int ret = nve0_grctx_generate(priv);
752 if (ret) {
753 nv_error(priv, "failed to construct context\n");
754 return ret;
755 }
756 }
757
758 return 0;
759}
760
761static int
762nve0_graph_init(struct nouveau_object *object)
763{
764 struct nvc0_graph_priv *priv = (void *)object;
765 int ret;
766
767 ret = nouveau_graph_init(&priv->base);
768 if (ret)
769 return ret;
770
771 nve0_graph_init_obj418880(priv);
772 nve0_graph_init_regs(priv);
773 nve0_graph_init_gpc_0(priv);
774
775 nv_wr32(priv, 0x400500, 0x00010001);
776 nv_wr32(priv, 0x400100, 0xffffffff);
777 nv_wr32(priv, 0x40013c, 0xffffffff);
778
779 nve0_graph_init_units(priv);
780 nve0_graph_init_gpc_1(priv);
781 nve0_graph_init_rop(priv);
782
783 nv_wr32(priv, 0x400108, 0xffffffff);
784 nv_wr32(priv, 0x400138, 0xffffffff);
785 nv_wr32(priv, 0x400118, 0xffffffff);
786 nv_wr32(priv, 0x400130, 0xffffffff);
787 nv_wr32(priv, 0x40011c, 0xffffffff);
788 nv_wr32(priv, 0x400134, 0xffffffff);
789 nv_wr32(priv, 0x400054, 0x34ce3464);
790
791 ret = nve0_graph_init_ctxctl(priv);
792 if (ret)
793 return ret;
794
795 return 0;
796}
797
798struct nouveau_oclass
799nve0_graph_oclass = {
800 .handle = NV_ENGINE(GR, 0xe0),
801 .ofuncs = &(struct nouveau_ofuncs) {
802 .ctor = nve0_graph_ctor,
803 .dtor = nvc0_graph_dtor,
804 .init = nve0_graph_init,
805 .fini = _nouveau_graph_fini,
806 },
807};
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nve4.c b/drivers/gpu/drm/nouveau/core/engine/graph/nve4.c
new file mode 100644
index 000000000000..05ec09c88517
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nve4.c
@@ -0,0 +1,354 @@
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 <bskeggs@redhat.com>
23 */
24
25#include "nvc0.h"
26
27/*******************************************************************************
28 * Graphics object classes
29 ******************************************************************************/
30
31static struct nouveau_oclass
32nve4_graph_sclass[] = {
33 { 0x902d, &nouveau_object_ofuncs },
34 { 0xa040, &nouveau_object_ofuncs },
35 { 0xa097, &nouveau_object_ofuncs },
36 { 0xa0c0, &nouveau_object_ofuncs },
37 {}
38};
39
40/*******************************************************************************
41 * PGRAPH engine/subdev functions
42 ******************************************************************************/
43
44struct nvc0_graph_init
45nve4_graph_init_regs[] = {
46 { 0x400080, 1, 0x04, 0x003083c2 },
47 { 0x400088, 1, 0x04, 0x0001ffe7 },
48 { 0x40008c, 1, 0x04, 0x00000000 },
49 { 0x400090, 1, 0x04, 0x00000030 },
50 { 0x40013c, 1, 0x04, 0x003901f7 },
51 { 0x400140, 1, 0x04, 0x00000100 },
52 { 0x400144, 1, 0x04, 0x00000000 },
53 { 0x400148, 1, 0x04, 0x00000110 },
54 { 0x400138, 1, 0x04, 0x00000000 },
55 { 0x400130, 2, 0x04, 0x00000000 },
56 { 0x400124, 1, 0x04, 0x00000002 },
57 {}
58};
59
60static struct nvc0_graph_init
61nve4_graph_init_unk58xx[] = {
62 { 0x405844, 1, 0x04, 0x00ffffff },
63 { 0x405850, 1, 0x04, 0x00000000 },
64 { 0x405900, 1, 0x04, 0x0000ff34 },
65 { 0x405908, 1, 0x04, 0x00000000 },
66 { 0x405928, 1, 0x04, 0x00000000 },
67 { 0x40592c, 1, 0x04, 0x00000000 },
68 {}
69};
70
71static struct nvc0_graph_init
72nve4_graph_init_unk70xx[] = {
73 { 0x407010, 1, 0x04, 0x00000000 },
74 {}
75};
76
77struct nvc0_graph_init
78nve4_graph_init_unk5bxx[] = {
79 { 0x405b50, 1, 0x04, 0x00000000 },
80 {}
81};
82
83static struct nvc0_graph_init
84nve4_graph_init_gpc[] = {
85 { 0x418408, 1, 0x04, 0x00000000 },
86 { 0x4184a0, 1, 0x04, 0x00000000 },
87 { 0x4184a4, 2, 0x04, 0x00000000 },
88 { 0x418604, 1, 0x04, 0x00000000 },
89 { 0x418680, 1, 0x04, 0x00000000 },
90 { 0x418714, 1, 0x04, 0x00000000 },
91 { 0x418384, 1, 0x04, 0x00000000 },
92 { 0x418814, 3, 0x04, 0x00000000 },
93 { 0x418b04, 1, 0x04, 0x00000000 },
94 { 0x4188c8, 2, 0x04, 0x00000000 },
95 { 0x4188d0, 1, 0x04, 0x00010000 },
96 { 0x4188d4, 1, 0x04, 0x00000001 },
97 { 0x418910, 1, 0x04, 0x00010001 },
98 { 0x418914, 1, 0x04, 0x00000301 },
99 { 0x418918, 1, 0x04, 0x00800000 },
100 { 0x418980, 1, 0x04, 0x77777770 },
101 { 0x418984, 3, 0x04, 0x77777777 },
102 { 0x418c04, 1, 0x04, 0x00000000 },
103 { 0x418c64, 1, 0x04, 0x00000000 },
104 { 0x418c68, 1, 0x04, 0x00000000 },
105 { 0x418c88, 1, 0x04, 0x00000000 },
106 { 0x418cb4, 2, 0x04, 0x00000000 },
107 { 0x418d00, 1, 0x04, 0x00000000 },
108 { 0x418d28, 1, 0x04, 0x00000000 },
109 { 0x418d2c, 1, 0x04, 0x00000000 },
110 { 0x418f00, 1, 0x04, 0x00000000 },
111 { 0x418f08, 1, 0x04, 0x00000000 },
112 { 0x418f20, 2, 0x04, 0x00000000 },
113 { 0x418e00, 1, 0x04, 0x00000060 },
114 { 0x418e08, 1, 0x04, 0x00000000 },
115 { 0x418e1c, 1, 0x04, 0x00000000 },
116 { 0x418e20, 1, 0x04, 0x00000000 },
117 { 0x41900c, 1, 0x04, 0x00000000 },
118 { 0x419018, 1, 0x04, 0x00000000 },
119 {}
120};
121
122static struct nvc0_graph_init
123nve4_graph_init_tpc[] = {
124 { 0x419d0c, 1, 0x04, 0x00000000 },
125 { 0x419d10, 1, 0x04, 0x00000014 },
126 { 0x419ab0, 1, 0x04, 0x00000000 },
127 { 0x419ac8, 1, 0x04, 0x00000000 },
128 { 0x419ab8, 1, 0x04, 0x000000e7 },
129 { 0x419abc, 2, 0x04, 0x00000000 },
130 { 0x419ab4, 1, 0x04, 0x00000000 },
131 { 0x41980c, 1, 0x04, 0x00000010 },
132 { 0x419844, 1, 0x04, 0x00000000 },
133 { 0x419850, 1, 0x04, 0x00000004 },
134 { 0x419854, 2, 0x04, 0x00000000 },
135 { 0x419c98, 1, 0x04, 0x00000000 },
136 { 0x419ca8, 1, 0x04, 0x00000000 },
137 { 0x419cb0, 1, 0x04, 0x01000000 },
138 { 0x419cb4, 1, 0x04, 0x00000000 },
139 { 0x419cb8, 1, 0x04, 0x00b08bea },
140 { 0x419c84, 1, 0x04, 0x00010384 },
141 { 0x419cbc, 1, 0x04, 0x28137646 },
142 { 0x419cc0, 2, 0x04, 0x00000000 },
143 { 0x419c80, 1, 0x04, 0x00020232 },
144 { 0x419c0c, 1, 0x04, 0x00000000 },
145 { 0x419e00, 1, 0x04, 0x00000000 },
146 { 0x419ea0, 1, 0x04, 0x00000000 },
147 { 0x419ee4, 1, 0x04, 0x00000000 },
148 { 0x419ea4, 1, 0x04, 0x00000100 },
149 { 0x419ea8, 1, 0x04, 0x00000000 },
150 { 0x419eb4, 1, 0x04, 0x00000000 },
151 { 0x419eb8, 3, 0x04, 0x00000000 },
152 { 0x419edc, 1, 0x04, 0x00000000 },
153 { 0x419f00, 1, 0x04, 0x00000000 },
154 { 0x419f74, 1, 0x04, 0x00000555 },
155 {}
156};
157
158struct nvc0_graph_init
159nve4_graph_init_unk[] = {
160 { 0x41be04, 1, 0x04, 0x00000000 },
161 { 0x41be08, 1, 0x04, 0x00000004 },
162 { 0x41be0c, 1, 0x04, 0x00000000 },
163 { 0x41be10, 1, 0x04, 0x003b8bc7 },
164 { 0x41be14, 2, 0x04, 0x00000000 },
165 { 0x41bfd4, 1, 0x04, 0x00800000 },
166 { 0x41bfdc, 1, 0x04, 0x00000000 },
167 { 0x41bff8, 1, 0x04, 0x00000000 },
168 { 0x41bffc, 1, 0x04, 0x00000000 },
169 { 0x41becc, 1, 0x04, 0x00000000 },
170 { 0x41bee8, 1, 0x04, 0x00000000 },
171 { 0x41beec, 1, 0x04, 0x00000000 },
172 {}
173};
174
175struct nvc0_graph_init
176nve4_graph_init_unk88xx[] = {
177 { 0x40880c, 1, 0x04, 0x00000000 },
178 { 0x408850, 1, 0x04, 0x00000004 },
179 { 0x408910, 9, 0x04, 0x00000000 },
180 { 0x408950, 1, 0x04, 0x00000000 },
181 { 0x408954, 1, 0x04, 0x0000ffff },
182 { 0x408958, 1, 0x04, 0x00000034 },
183 { 0x408984, 1, 0x04, 0x00000000 },
184 { 0x408988, 1, 0x04, 0x08040201 },
185 { 0x40898c, 1, 0x04, 0x80402010 },
186 {}
187};
188
189int
190nve4_graph_init(struct nouveau_object *object)
191{
192 struct nvc0_graph_oclass *oclass = (void *)object->oclass;
193 struct nvc0_graph_priv *priv = (void *)object;
194 const u32 magicgpc918 = DIV_ROUND_UP(0x00800000, priv->tpc_total);
195 u32 data[TPC_MAX / 8] = {};
196 u8 tpcnr[GPC_MAX];
197 int gpc, tpc, rop;
198 int ret, i;
199
200 ret = nouveau_graph_init(&priv->base);
201 if (ret)
202 return ret;
203
204 nv_wr32(priv, GPC_BCAST(0x0880), 0x00000000);
205 nv_wr32(priv, GPC_BCAST(0x08a4), 0x00000000);
206 nv_wr32(priv, GPC_BCAST(0x0888), 0x00000000);
207 nv_wr32(priv, GPC_BCAST(0x088c), 0x00000000);
208 nv_wr32(priv, GPC_BCAST(0x0890), 0x00000000);
209 nv_wr32(priv, GPC_BCAST(0x0894), 0x00000000);
210 nv_wr32(priv, GPC_BCAST(0x08b4), priv->unk4188b4->addr >> 8);
211 nv_wr32(priv, GPC_BCAST(0x08b8), priv->unk4188b8->addr >> 8);
212
213 for (i = 0; oclass->mmio[i]; i++)
214 nvc0_graph_mmio(priv, oclass->mmio[i]);
215
216 nv_wr32(priv, GPC_UNIT(0, 0x3018), 0x00000001);
217
218 memset(data, 0x00, sizeof(data));
219 memcpy(tpcnr, priv->tpc_nr, sizeof(priv->tpc_nr));
220 for (i = 0, gpc = -1; i < priv->tpc_total; i++) {
221 do {
222 gpc = (gpc + 1) % priv->gpc_nr;
223 } while (!tpcnr[gpc]);
224 tpc = priv->tpc_nr[gpc] - tpcnr[gpc]--;
225
226 data[i / 8] |= tpc << ((i % 8) * 4);
227 }
228
229 nv_wr32(priv, GPC_BCAST(0x0980), data[0]);
230 nv_wr32(priv, GPC_BCAST(0x0984), data[1]);
231 nv_wr32(priv, GPC_BCAST(0x0988), data[2]);
232 nv_wr32(priv, GPC_BCAST(0x098c), data[3]);
233
234 for (gpc = 0; gpc < priv->gpc_nr; gpc++) {
235 nv_wr32(priv, GPC_UNIT(gpc, 0x0914),
236 priv->magic_not_rop_nr << 8 | priv->tpc_nr[gpc]);
237 nv_wr32(priv, GPC_UNIT(gpc, 0x0910), 0x00040000 |
238 priv->tpc_total);
239 nv_wr32(priv, GPC_UNIT(gpc, 0x0918), magicgpc918);
240 }
241
242 nv_wr32(priv, GPC_BCAST(0x3fd4), magicgpc918);
243 nv_wr32(priv, GPC_BCAST(0x08ac), nv_rd32(priv, 0x100800));
244
245 nv_wr32(priv, 0x400500, 0x00010001);
246
247 nv_wr32(priv, 0x400100, 0xffffffff);
248 nv_wr32(priv, 0x40013c, 0xffffffff);
249
250 nv_wr32(priv, 0x409ffc, 0x00000000);
251 nv_wr32(priv, 0x409c14, 0x00003e3e);
252 nv_wr32(priv, 0x409c24, 0x000f0001);
253 nv_wr32(priv, 0x404000, 0xc0000000);
254 nv_wr32(priv, 0x404600, 0xc0000000);
255 nv_wr32(priv, 0x408030, 0xc0000000);
256 nv_wr32(priv, 0x404490, 0xc0000000);
257 nv_wr32(priv, 0x406018, 0xc0000000);
258 nv_wr32(priv, 0x407020, 0x40000000);
259 nv_wr32(priv, 0x405840, 0xc0000000);
260 nv_wr32(priv, 0x405844, 0x00ffffff);
261 nv_mask(priv, 0x419cc0, 0x00000008, 0x00000008);
262 nv_mask(priv, 0x419eb4, 0x00001000, 0x00001000);
263
264 for (gpc = 0; gpc < priv->gpc_nr; gpc++) {
265 nv_wr32(priv, GPC_UNIT(gpc, 0x3038), 0xc0000000);
266 nv_wr32(priv, GPC_UNIT(gpc, 0x0420), 0xc0000000);
267 nv_wr32(priv, GPC_UNIT(gpc, 0x0900), 0xc0000000);
268 nv_wr32(priv, GPC_UNIT(gpc, 0x1028), 0xc0000000);
269 nv_wr32(priv, GPC_UNIT(gpc, 0x0824), 0xc0000000);
270 for (tpc = 0; tpc < priv->tpc_nr[gpc]; tpc++) {
271 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x508), 0xffffffff);
272 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x50c), 0xffffffff);
273 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x224), 0xc0000000);
274 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x48c), 0xc0000000);
275 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x084), 0xc0000000);
276 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x644), 0x001ffffe);
277 nv_wr32(priv, TPC_UNIT(gpc, tpc, 0x64c), 0x0000000f);
278 }
279 nv_wr32(priv, GPC_UNIT(gpc, 0x2c90), 0xffffffff);
280 nv_wr32(priv, GPC_UNIT(gpc, 0x2c94), 0xffffffff);
281 }
282
283 for (rop = 0; rop < priv->rop_nr; rop++) {
284 nv_wr32(priv, ROP_UNIT(rop, 0x144), 0xc0000000);
285 nv_wr32(priv, ROP_UNIT(rop, 0x070), 0xc0000000);
286 nv_wr32(priv, ROP_UNIT(rop, 0x204), 0xffffffff);
287 nv_wr32(priv, ROP_UNIT(rop, 0x208), 0xffffffff);
288 }
289
290 nv_wr32(priv, 0x400108, 0xffffffff);
291 nv_wr32(priv, 0x400138, 0xffffffff);
292 nv_wr32(priv, 0x400118, 0xffffffff);
293 nv_wr32(priv, 0x400130, 0xffffffff);
294 nv_wr32(priv, 0x40011c, 0xffffffff);
295 nv_wr32(priv, 0x400134, 0xffffffff);
296
297 nv_wr32(priv, 0x400054, 0x34ce3464);
298 return nvc0_graph_init_ctxctl(priv);
299}
300
301static struct nvc0_graph_init *
302nve4_graph_init_mmio[] = {
303 nve4_graph_init_regs,
304 nvc0_graph_init_unk40xx,
305 nvc0_graph_init_unk44xx,
306 nvc0_graph_init_unk78xx,
307 nvc0_graph_init_unk60xx,
308 nvd9_graph_init_unk64xx,
309 nve4_graph_init_unk58xx,
310 nvc0_graph_init_unk80xx,
311 nve4_graph_init_unk70xx,
312 nve4_graph_init_unk5bxx,
313 nve4_graph_init_gpc,
314 nve4_graph_init_tpc,
315 nve4_graph_init_unk,
316 nve4_graph_init_unk88xx,
317 NULL
318};
319
320#include "fuc/hubnve0.fuc.h"
321
322static struct nvc0_graph_ucode
323nve4_graph_fecs_ucode = {
324 .code.data = nve0_grhub_code,
325 .code.size = sizeof(nve0_grhub_code),
326 .data.data = nve0_grhub_data,
327 .data.size = sizeof(nve0_grhub_data),
328};
329
330#include "fuc/gpcnve0.fuc.h"
331
332static struct nvc0_graph_ucode
333nve4_graph_gpccs_ucode = {
334 .code.data = nve0_grgpc_code,
335 .code.size = sizeof(nve0_grgpc_code),
336 .data.data = nve0_grgpc_data,
337 .data.size = sizeof(nve0_grgpc_data),
338};
339
340struct nouveau_oclass *
341nve4_graph_oclass = &(struct nvc0_graph_oclass) {
342 .base.handle = NV_ENGINE(GR, 0xe4),
343 .base.ofuncs = &(struct nouveau_ofuncs) {
344 .ctor = nvc0_graph_ctor,
345 .dtor = nvc0_graph_dtor,
346 .init = nve4_graph_init,
347 .fini = _nouveau_graph_fini,
348 },
349 .cclass = &nve4_grctx_oclass,
350 .sclass = nve4_graph_sclass,
351 .mmio = nve4_graph_init_mmio,
352 .fecs.ucode = &nve4_graph_fecs_ucode,
353 .gpccs.ucode = &nve4_graph_gpccs_ucode,
354}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvf0.c b/drivers/gpu/drm/nouveau/core/engine/graph/nvf0.c
new file mode 100644
index 000000000000..2f0ac7832234
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvf0.c
@@ -0,0 +1,248 @@
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 <bskeggs@redhat.com>
23 */
24
25#include "nvc0.h"
26
27/*******************************************************************************
28 * Graphics object classes
29 ******************************************************************************/
30
31static struct nouveau_oclass
32nvf0_graph_sclass[] = {
33 { 0x902d, &nouveau_object_ofuncs },
34 { 0xa140, &nouveau_object_ofuncs },
35 { 0xa197, &nouveau_object_ofuncs },
36 { 0xa1c0, &nouveau_object_ofuncs },
37 {}
38};
39
40/*******************************************************************************
41 * PGRAPH engine/subdev functions
42 ******************************************************************************/
43
44static struct nvc0_graph_init
45nvf0_graph_init_unk40xx[] = {
46 { 0x40415c, 1, 0x04, 0x00000000 },
47 { 0x404170, 1, 0x04, 0x00000000 },
48 { 0x4041b4, 1, 0x04, 0x00000000 },
49 {}
50};
51
52static struct nvc0_graph_init
53nvf0_graph_init_unk58xx[] = {
54 { 0x405844, 1, 0x04, 0x00ffffff },
55 { 0x405850, 1, 0x04, 0x00000000 },
56 { 0x405900, 1, 0x04, 0x0000ff00 },
57 { 0x405908, 1, 0x04, 0x00000000 },
58 { 0x405928, 1, 0x04, 0x00000000 },
59 { 0x40592c, 1, 0x04, 0x00000000 },
60 {}
61};
62
63static struct nvc0_graph_init
64nvf0_graph_init_unk70xx[] = {
65 { 0x407010, 1, 0x04, 0x00000000 },
66 { 0x407040, 1, 0x04, 0x80440424 },
67 { 0x407048, 1, 0x04, 0x0000000a },
68 {}
69};
70
71static struct nvc0_graph_init
72nvf0_graph_init_unk5bxx[] = {
73 { 0x405b44, 1, 0x04, 0x00000000 },
74 { 0x405b50, 1, 0x04, 0x00000000 },
75 {}
76};
77
78static struct nvc0_graph_init
79nvf0_graph_init_gpc[] = {
80 { 0x418408, 1, 0x04, 0x00000000 },
81 { 0x4184a0, 1, 0x04, 0x00000000 },
82 { 0x4184a4, 2, 0x04, 0x00000000 },
83 { 0x418604, 1, 0x04, 0x00000000 },
84 { 0x418680, 1, 0x04, 0x00000000 },
85 { 0x418714, 1, 0x04, 0x00000000 },
86 { 0x418384, 1, 0x04, 0x00000000 },
87 { 0x418814, 3, 0x04, 0x00000000 },
88 { 0x418b04, 1, 0x04, 0x00000000 },
89 { 0x4188c8, 2, 0x04, 0x00000000 },
90 { 0x4188d0, 1, 0x04, 0x00010000 },
91 { 0x4188d4, 1, 0x04, 0x00000001 },
92 { 0x418910, 1, 0x04, 0x00010001 },
93 { 0x418914, 1, 0x04, 0x00000301 },
94 { 0x418918, 1, 0x04, 0x00800000 },
95 { 0x418980, 1, 0x04, 0x77777770 },
96 { 0x418984, 3, 0x04, 0x77777777 },
97 { 0x418c04, 1, 0x04, 0x00000000 },
98 { 0x418c64, 1, 0x04, 0x00000000 },
99 { 0x418c68, 1, 0x04, 0x00000000 },
100 { 0x418c88, 1, 0x04, 0x00000000 },
101 { 0x418cb4, 2, 0x04, 0x00000000 },
102 { 0x418d00, 1, 0x04, 0x00000000 },
103 { 0x418d28, 1, 0x04, 0x00000000 },
104 { 0x418d2c, 1, 0x04, 0x00000000 },
105 { 0x418f00, 1, 0x04, 0x00000400 },
106 { 0x418f08, 1, 0x04, 0x00000000 },
107 { 0x418f20, 1, 0x04, 0x00000000 },
108 { 0x418f24, 1, 0x04, 0x00000000 },
109 { 0x418e00, 1, 0x04, 0x00000000 },
110 { 0x418e08, 1, 0x04, 0x00000000 },
111 { 0x418e1c, 2, 0x04, 0x00000000 },
112 { 0x41900c, 1, 0x04, 0x00000000 },
113 { 0x419018, 1, 0x04, 0x00000000 },
114 {}
115};
116
117static struct nvc0_graph_init
118nvf0_graph_init_tpc[] = {
119 { 0x419d0c, 1, 0x04, 0x00000000 },
120 { 0x419d10, 1, 0x04, 0x00000014 },
121 { 0x419ab0, 1, 0x04, 0x00000000 },
122 { 0x419ac8, 1, 0x04, 0x00000000 },
123 { 0x419ab8, 1, 0x04, 0x000000e7 },
124 { 0x419aec, 1, 0x04, 0x00000000 },
125 { 0x419abc, 2, 0x04, 0x00000000 },
126 { 0x419ab4, 1, 0x04, 0x00000000 },
127 { 0x419aa8, 2, 0x04, 0x00000000 },
128 { 0x41980c, 1, 0x04, 0x00000010 },
129 { 0x419844, 1, 0x04, 0x00000000 },
130 { 0x419850, 1, 0x04, 0x00000004 },
131 { 0x419854, 2, 0x04, 0x00000000 },
132 { 0x419c98, 1, 0x04, 0x00000000 },
133 { 0x419ca8, 1, 0x04, 0x00000000 },
134 { 0x419cb0, 1, 0x04, 0x01000000 },
135 { 0x419cb4, 1, 0x04, 0x00000000 },
136 { 0x419cb8, 1, 0x04, 0x00b08bea },
137 { 0x419c84, 1, 0x04, 0x00010384 },
138 { 0x419cbc, 1, 0x04, 0x281b3646 },
139 { 0x419cc0, 2, 0x04, 0x00000000 },
140 { 0x419c80, 1, 0x04, 0x00020230 },
141 { 0x419ccc, 2, 0x04, 0x00000000 },
142 { 0x419c0c, 1, 0x04, 0x00000000 },
143 { 0x419e00, 1, 0x04, 0x00000080 },
144 { 0x419ea0, 1, 0x04, 0x00000000 },
145 { 0x419ee4, 1, 0x04, 0x00000000 },
146 { 0x419ea4, 1, 0x04, 0x00000100 },
147 { 0x419ea8, 1, 0x04, 0x00000000 },
148 { 0x419eb4, 1, 0x04, 0x00000000 },
149 { 0x419ebc, 2, 0x04, 0x00000000 },
150 { 0x419edc, 1, 0x04, 0x00000000 },
151 { 0x419f00, 1, 0x04, 0x00000000 },
152 { 0x419ed0, 1, 0x04, 0x00003234 },
153 { 0x419f74, 1, 0x04, 0x00015555 },
154 { 0x419f80, 4, 0x04, 0x00000000 },
155 {}
156};
157
158static int
159nvf0_graph_fini(struct nouveau_object *object, bool suspend)
160{
161 struct nvc0_graph_priv *priv = (void *)object;
162 static const struct {
163 u32 addr;
164 u32 data;
165 } magic[] = {
166 { 0x020520, 0xfffffffc },
167 { 0x020524, 0xfffffffe },
168 { 0x020524, 0xfffffffc },
169 { 0x020524, 0xfffffff8 },
170 { 0x020524, 0xffffffe0 },
171 { 0x020530, 0xfffffffe },
172 { 0x02052c, 0xfffffffa },
173 { 0x02052c, 0xfffffff0 },
174 { 0x02052c, 0xffffffc0 },
175 { 0x02052c, 0xffffff00 },
176 { 0x02052c, 0xfffffc00 },
177 { 0x02052c, 0xfffcfc00 },
178 { 0x02052c, 0xfff0fc00 },
179 { 0x02052c, 0xff80fc00 },
180 { 0x020528, 0xfffffffe },
181 { 0x020528, 0xfffffffc },
182 };
183 int i;
184
185 nv_mask(priv, 0x000200, 0x08001000, 0x00000000);
186 nv_mask(priv, 0x0206b4, 0x00000000, 0x00000000);
187 for (i = 0; i < ARRAY_SIZE(magic); i++) {
188 nv_wr32(priv, magic[i].addr, magic[i].data);
189 nv_wait(priv, magic[i].addr, 0x80000000, 0x00000000);
190 }
191
192 return nouveau_graph_fini(&priv->base, suspend);
193}
194
195static struct nvc0_graph_init *
196nvf0_graph_init_mmio[] = {
197 nve4_graph_init_regs,
198 nvf0_graph_init_unk40xx,
199 nvc0_graph_init_unk44xx,
200 nvc0_graph_init_unk78xx,
201 nvc0_graph_init_unk60xx,
202 nvd9_graph_init_unk64xx,
203 nvf0_graph_init_unk58xx,
204 nvc0_graph_init_unk80xx,
205 nvf0_graph_init_unk70xx,
206 nvf0_graph_init_unk5bxx,
207 nvf0_graph_init_gpc,
208 nvf0_graph_init_tpc,
209 nve4_graph_init_unk,
210 nve4_graph_init_unk88xx,
211 NULL
212};
213
214#include "fuc/hubnvf0.fuc.h"
215
216static struct nvc0_graph_ucode
217nvf0_graph_fecs_ucode = {
218 .code.data = nvf0_grhub_code,
219 .code.size = sizeof(nvf0_grhub_code),
220 .data.data = nvf0_grhub_data,
221 .data.size = sizeof(nvf0_grhub_data),
222};
223
224#include "fuc/gpcnvf0.fuc.h"
225
226static struct nvc0_graph_ucode
227nvf0_graph_gpccs_ucode = {
228 .code.data = nvf0_grgpc_code,
229 .code.size = sizeof(nvf0_grgpc_code),
230 .data.data = nvf0_grgpc_data,
231 .data.size = sizeof(nvf0_grgpc_data),
232};
233
234struct nouveau_oclass *
235nvf0_graph_oclass = &(struct nvc0_graph_oclass) {
236 .base.handle = NV_ENGINE(GR, 0xf0),
237 .base.ofuncs = &(struct nouveau_ofuncs) {
238 .ctor = nvc0_graph_ctor,
239 .dtor = nvc0_graph_dtor,
240 .init = nve4_graph_init,
241 .fini = nvf0_graph_fini,
242 },
243 .cclass = &nvf0_grctx_oclass,
244 .sclass = nvf0_graph_sclass,
245 .mmio = nvf0_graph_init_mmio,
246 .fecs.ucode = 0 ? &nvf0_graph_fecs_ucode : NULL,
247 .gpccs.ucode = &nvf0_graph_gpccs_ucode,
248}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/mpeg/nv50.c b/drivers/gpu/drm/nouveau/core/engine/mpeg/nv50.c
index bc7d12b30fc1..37a2bd9e8078 100644
--- a/drivers/gpu/drm/nouveau/core/engine/mpeg/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/engine/mpeg/nv50.c
@@ -125,13 +125,6 @@ nv50_mpeg_cclass = {
125 * PMPEG engine/subdev functions 125 * PMPEG engine/subdev functions
126 ******************************************************************************/ 126 ******************************************************************************/
127 127
128int
129nv50_mpeg_tlb_flush(struct nouveau_engine *engine)
130{
131 nv50_vm_flush_engine(&engine->base, 0x08);
132 return 0;
133}
134
135void 128void
136nv50_mpeg_intr(struct nouveau_subdev *subdev) 129nv50_mpeg_intr(struct nouveau_subdev *subdev)
137{ 130{
@@ -191,7 +184,6 @@ nv50_mpeg_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
191 nv_subdev(priv)->intr = nv50_vpe_intr; 184 nv_subdev(priv)->intr = nv50_vpe_intr;
192 nv_engine(priv)->cclass = &nv50_mpeg_cclass; 185 nv_engine(priv)->cclass = &nv50_mpeg_cclass;
193 nv_engine(priv)->sclass = nv50_mpeg_sclass; 186 nv_engine(priv)->sclass = nv50_mpeg_sclass;
194 nv_engine(priv)->tlb_flush = nv50_mpeg_tlb_flush;
195 return 0; 187 return 0;
196} 188}
197 189
diff --git a/drivers/gpu/drm/nouveau/core/engine/mpeg/nv84.c b/drivers/gpu/drm/nouveau/core/engine/mpeg/nv84.c
index 8f805b44d59e..96f5aa92677b 100644
--- a/drivers/gpu/drm/nouveau/core/engine/mpeg/nv84.c
+++ b/drivers/gpu/drm/nouveau/core/engine/mpeg/nv84.c
@@ -88,7 +88,6 @@ nv84_mpeg_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
88 nv_subdev(priv)->intr = nv50_mpeg_intr; 88 nv_subdev(priv)->intr = nv50_mpeg_intr;
89 nv_engine(priv)->cclass = &nv84_mpeg_cclass; 89 nv_engine(priv)->cclass = &nv84_mpeg_cclass;
90 nv_engine(priv)->sclass = nv84_mpeg_sclass; 90 nv_engine(priv)->sclass = nv84_mpeg_sclass;
91 nv_engine(priv)->tlb_flush = nv50_mpeg_tlb_flush;
92 return 0; 91 return 0;
93} 92}
94 93
diff --git a/drivers/gpu/drm/nouveau/core/engine/ppp/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/ppp/nvc0.c
index ebf0d860e2dd..98072c1ff360 100644
--- a/drivers/gpu/drm/nouveau/core/engine/ppp/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/ppp/nvc0.c
@@ -22,8 +22,7 @@
22 * Authors: Maarten Lankhorst 22 * Authors: Maarten Lankhorst
23 */ 23 */
24 24
25#include <core/falcon.h> 25#include <engine/falcon.h>
26
27#include <engine/ppp.h> 26#include <engine/ppp.h>
28 27
29struct nvc0_ppp_priv { 28struct nvc0_ppp_priv {
diff --git a/drivers/gpu/drm/nouveau/core/engine/vp/nv84.c b/drivers/gpu/drm/nouveau/core/engine/vp/nv84.c
index 261cd96e6951..fd6272b8cdb2 100644
--- a/drivers/gpu/drm/nouveau/core/engine/vp/nv84.c
+++ b/drivers/gpu/drm/nouveau/core/engine/vp/nv84.c
@@ -19,24 +19,19 @@
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE. 20 * OTHER DEALINGS IN THE SOFTWARE.
21 * 21 *
22 * Authors: Ben Skeggs 22 * Authors: Ben Skeggs, Ilia Mirkin
23 */ 23 */
24 24
25#include <core/engctx.h> 25#include <engine/xtensa.h>
26#include <core/class.h>
27
28#include <engine/vp.h> 26#include <engine/vp.h>
29 27
30struct nv84_vp_priv {
31 struct nouveau_engine base;
32};
33
34/******************************************************************************* 28/*******************************************************************************
35 * VP object classes 29 * VP object classes
36 ******************************************************************************/ 30 ******************************************************************************/
37 31
38static struct nouveau_oclass 32static struct nouveau_oclass
39nv84_vp_sclass[] = { 33nv84_vp_sclass[] = {
34 { 0x7476, &nouveau_object_ofuncs },
40 {}, 35 {},
41}; 36};
42 37
@@ -48,7 +43,7 @@ static struct nouveau_oclass
48nv84_vp_cclass = { 43nv84_vp_cclass = {
49 .handle = NV_ENGCTX(VP, 0x84), 44 .handle = NV_ENGCTX(VP, 0x84),
50 .ofuncs = &(struct nouveau_ofuncs) { 45 .ofuncs = &(struct nouveau_ofuncs) {
51 .ctor = _nouveau_engctx_ctor, 46 .ctor = _nouveau_xtensa_engctx_ctor,
52 .dtor = _nouveau_engctx_dtor, 47 .dtor = _nouveau_engctx_dtor,
53 .init = _nouveau_engctx_init, 48 .init = _nouveau_engctx_init,
54 .fini = _nouveau_engctx_fini, 49 .fini = _nouveau_engctx_fini,
@@ -66,10 +61,10 @@ nv84_vp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
66 struct nouveau_oclass *oclass, void *data, u32 size, 61 struct nouveau_oclass *oclass, void *data, u32 size,
67 struct nouveau_object **pobject) 62 struct nouveau_object **pobject)
68{ 63{
69 struct nv84_vp_priv *priv; 64 struct nouveau_xtensa *priv;
70 int ret; 65 int ret;
71 66
72 ret = nouveau_engine_create(parent, engine, oclass, true, 67 ret = nouveau_xtensa_create(parent, engine, oclass, 0xf000, true,
73 "PVP", "vp", &priv); 68 "PVP", "vp", &priv);
74 *pobject = nv_object(priv); 69 *pobject = nv_object(priv);
75 if (ret) 70 if (ret)
@@ -78,6 +73,8 @@ nv84_vp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
78 nv_subdev(priv)->unit = 0x01020000; 73 nv_subdev(priv)->unit = 0x01020000;
79 nv_engine(priv)->cclass = &nv84_vp_cclass; 74 nv_engine(priv)->cclass = &nv84_vp_cclass;
80 nv_engine(priv)->sclass = nv84_vp_sclass; 75 nv_engine(priv)->sclass = nv84_vp_sclass;
76 priv->fifo_val = 0x111;
77 priv->unkd28 = 0x9c544;
81 return 0; 78 return 0;
82} 79}
83 80
@@ -86,8 +83,10 @@ nv84_vp_oclass = {
86 .handle = NV_ENGINE(VP, 0x84), 83 .handle = NV_ENGINE(VP, 0x84),
87 .ofuncs = &(struct nouveau_ofuncs) { 84 .ofuncs = &(struct nouveau_ofuncs) {
88 .ctor = nv84_vp_ctor, 85 .ctor = nv84_vp_ctor,
89 .dtor = _nouveau_engine_dtor, 86 .dtor = _nouveau_xtensa_dtor,
90 .init = _nouveau_engine_init, 87 .init = _nouveau_xtensa_init,
91 .fini = _nouveau_engine_fini, 88 .fini = _nouveau_xtensa_fini,
89 .rd32 = _nouveau_xtensa_rd32,
90 .wr32 = _nouveau_xtensa_wr32,
92 }, 91 },
93}; 92};
diff --git a/drivers/gpu/drm/nouveau/core/engine/vp/nv98.c b/drivers/gpu/drm/nouveau/core/engine/vp/nv98.c
new file mode 100644
index 000000000000..8a8236bc84de
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/vp/nv98.c
@@ -0,0 +1,93 @@
1/*
2 * Copyright 2012 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/engctx.h>
26#include <core/class.h>
27
28#include <engine/vp.h>
29
30struct nv98_vp_priv {
31 struct nouveau_engine base;
32};
33
34/*******************************************************************************
35 * VP object classes
36 ******************************************************************************/
37
38static struct nouveau_oclass
39nv98_vp_sclass[] = {
40 {},
41};
42
43/*******************************************************************************
44 * PVP context
45 ******************************************************************************/
46
47static struct nouveau_oclass
48nv98_vp_cclass = {
49 .handle = NV_ENGCTX(VP, 0x98),
50 .ofuncs = &(struct nouveau_ofuncs) {
51 .ctor = _nouveau_engctx_ctor,
52 .dtor = _nouveau_engctx_dtor,
53 .init = _nouveau_engctx_init,
54 .fini = _nouveau_engctx_fini,
55 .rd32 = _nouveau_engctx_rd32,
56 .wr32 = _nouveau_engctx_wr32,
57 },
58};
59
60/*******************************************************************************
61 * PVP engine/subdev functions
62 ******************************************************************************/
63
64static int
65nv98_vp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
66 struct nouveau_oclass *oclass, void *data, u32 size,
67 struct nouveau_object **pobject)
68{
69 struct nv98_vp_priv *priv;
70 int ret;
71
72 ret = nouveau_engine_create(parent, engine, oclass, true,
73 "PVP", "vp", &priv);
74 *pobject = nv_object(priv);
75 if (ret)
76 return ret;
77
78 nv_subdev(priv)->unit = 0x01020000;
79 nv_engine(priv)->cclass = &nv98_vp_cclass;
80 nv_engine(priv)->sclass = nv98_vp_sclass;
81 return 0;
82}
83
84struct nouveau_oclass
85nv98_vp_oclass = {
86 .handle = NV_ENGINE(VP, 0x98),
87 .ofuncs = &(struct nouveau_ofuncs) {
88 .ctor = nv98_vp_ctor,
89 .dtor = _nouveau_engine_dtor,
90 .init = _nouveau_engine_init,
91 .fini = _nouveau_engine_fini,
92 },
93};
diff --git a/drivers/gpu/drm/nouveau/core/engine/vp/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/vp/nvc0.c
index f761949d7039..1879229b60eb 100644
--- a/drivers/gpu/drm/nouveau/core/engine/vp/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/vp/nvc0.c
@@ -22,8 +22,7 @@
22 * Authors: Maarten Lankhorst 22 * Authors: Maarten Lankhorst
23 */ 23 */
24 24
25#include <core/falcon.h> 25#include <engine/falcon.h>
26
27#include <engine/vp.h> 26#include <engine/vp.h>
28 27
29struct nvc0_vp_priv { 28struct nvc0_vp_priv {
diff --git a/drivers/gpu/drm/nouveau/core/engine/vp/nve0.c b/drivers/gpu/drm/nouveau/core/engine/vp/nve0.c
index 2384ce5dbe16..d28ecbf7bc49 100644
--- a/drivers/gpu/drm/nouveau/core/engine/vp/nve0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/vp/nve0.c
@@ -22,8 +22,7 @@
22 * Authors: Ben Skeggs 22 * Authors: Ben Skeggs
23 */ 23 */
24 24
25#include <core/falcon.h> 25#include <engine/falcon.h>
26
27#include <engine/vp.h> 26#include <engine/vp.h>
28 27
29struct nve0_vp_priv { 28struct nve0_vp_priv {
diff --git a/drivers/gpu/drm/nouveau/core/engine/xtensa.c b/drivers/gpu/drm/nouveau/core/engine/xtensa.c
new file mode 100644
index 000000000000..0639bc59d0a5
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/xtensa.c
@@ -0,0 +1,170 @@
1/*
2 * Copyright 2013 Ilia Mirkin
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
23#include <engine/xtensa.h>
24
25u32
26_nouveau_xtensa_rd32(struct nouveau_object *object, u64 addr)
27{
28 struct nouveau_xtensa *xtensa = (void *)object;
29 return nv_rd32(xtensa, xtensa->addr + addr);
30}
31
32void
33_nouveau_xtensa_wr32(struct nouveau_object *object, u64 addr, u32 data)
34{
35 struct nouveau_xtensa *xtensa = (void *)object;
36 nv_wr32(xtensa, xtensa->addr + addr, data);
37}
38
39int
40_nouveau_xtensa_engctx_ctor(struct nouveau_object *parent,
41 struct nouveau_object *engine,
42 struct nouveau_oclass *oclass, void *data, u32 size,
43 struct nouveau_object **pobject)
44{
45 struct nouveau_engctx *engctx;
46 int ret;
47
48 ret = nouveau_engctx_create(parent, engine, oclass, NULL,
49 0x10000, 0x1000,
50 NVOBJ_FLAG_ZERO_ALLOC, &engctx);
51 *pobject = nv_object(engctx);
52 return ret;
53}
54
55void
56_nouveau_xtensa_intr(struct nouveau_subdev *subdev)
57{
58 struct nouveau_xtensa *xtensa = (void *)subdev;
59 u32 unk104 = nv_ro32(xtensa, 0xd04);
60 u32 intr = nv_ro32(xtensa, 0xc20);
61 u32 chan = nv_ro32(xtensa, 0xc28);
62 u32 unk10c = nv_ro32(xtensa, 0xd0c);
63
64 if (intr & 0x10)
65 nv_warn(xtensa, "Watchdog interrupt, engine hung.\n");
66 nv_wo32(xtensa, 0xc20, intr);
67 intr = nv_ro32(xtensa, 0xc20);
68 if (unk104 == 0x10001 && unk10c == 0x200 && chan && !intr) {
69 nv_debug(xtensa, "Enabling FIFO_CTRL\n");
70 nv_mask(xtensa, xtensa->addr + 0xd94, 0, xtensa->fifo_val);
71 }
72}
73
74int
75nouveau_xtensa_create_(struct nouveau_object *parent,
76 struct nouveau_object *engine,
77 struct nouveau_oclass *oclass, u32 addr, bool enable,
78 const char *iname, const char *fname,
79 int length, void **pobject)
80{
81 struct nouveau_xtensa *xtensa;
82 int ret;
83
84 ret = nouveau_engine_create_(parent, engine, oclass, enable, iname,
85 fname, length, pobject);
86 xtensa = *pobject;
87 if (ret)
88 return ret;
89
90 nv_subdev(xtensa)->intr = _nouveau_xtensa_intr;
91
92 xtensa->addr = addr;
93
94 return 0;
95}
96
97int
98_nouveau_xtensa_init(struct nouveau_object *object)
99{
100 struct nouveau_device *device = nv_device(object);
101 struct nouveau_xtensa *xtensa = (void *)object;
102 const struct firmware *fw;
103 char name[32];
104 int i, ret;
105 u32 tmp;
106
107 ret = nouveau_engine_init(&xtensa->base);
108 if (ret)
109 return ret;
110
111 if (!xtensa->gpu_fw) {
112 snprintf(name, sizeof(name), "nouveau/nv84_xuc%03x",
113 xtensa->addr >> 12);
114
115 ret = request_firmware(&fw, name, &device->pdev->dev);
116 if (ret) {
117 nv_warn(xtensa, "unable to load firmware %s\n", name);
118 return ret;
119 }
120
121 ret = nouveau_gpuobj_new(object, NULL, fw->size, 0x1000, 0,
122 &xtensa->gpu_fw);
123 if (ret) {
124 release_firmware(fw);
125 return ret;
126 }
127
128 nv_debug(xtensa, "Loading firmware to address: 0x%llx\n",
129 xtensa->gpu_fw->addr);
130
131 for (i = 0; i < fw->size / 4; i++)
132 nv_wo32(xtensa->gpu_fw, i * 4, *((u32 *)fw->data + i));
133 release_firmware(fw);
134 }
135
136 nv_wo32(xtensa, 0xd10, 0x1fffffff); /* ?? */
137 nv_wo32(xtensa, 0xd08, 0x0fffffff); /* ?? */
138
139 nv_wo32(xtensa, 0xd28, xtensa->unkd28); /* ?? */
140 nv_wo32(xtensa, 0xc20, 0x3f); /* INTR */
141 nv_wo32(xtensa, 0xd84, 0x3f); /* INTR_EN */
142
143 nv_wo32(xtensa, 0xcc0, xtensa->gpu_fw->addr >> 8); /* XT_REGION_BASE */
144 nv_wo32(xtensa, 0xcc4, 0x1c); /* XT_REGION_SETUP */
145 nv_wo32(xtensa, 0xcc8, xtensa->gpu_fw->size >> 8); /* XT_REGION_LIMIT */
146
147 tmp = nv_rd32(xtensa, 0x0);
148 nv_wo32(xtensa, 0xde0, tmp); /* SCRATCH_H2X */
149
150 nv_wo32(xtensa, 0xce8, 0xf); /* XT_REGION_SETUP */
151
152 nv_wo32(xtensa, 0xc20, 0x3f); /* INTR */
153 nv_wo32(xtensa, 0xd84, 0x3f); /* INTR_EN */
154
155 return 0;
156}
157
158int
159_nouveau_xtensa_fini(struct nouveau_object *object, bool suspend)
160{
161 struct nouveau_xtensa *xtensa = (void *)object;
162
163 nv_wo32(xtensa, 0xd84, 0); /* INTR_EN */
164 nv_wo32(xtensa, 0xd94, 0); /* FIFO_CTRL */
165
166 if (!suspend)
167 nouveau_gpuobj_ref(NULL, &xtensa->gpu_fw);
168
169 return nouveau_engine_fini(&xtensa->base, suspend);
170}
diff --git a/drivers/gpu/drm/nouveau/core/include/core/device.h b/drivers/gpu/drm/nouveau/core/include/core/device.h
index 05840f3eee98..99b6600fe80a 100644
--- a/drivers/gpu/drm/nouveau/core/include/core/device.h
+++ b/drivers/gpu/drm/nouveau/core/include/core/device.h
@@ -17,8 +17,7 @@ enum nv_subdev_type {
17 NVDEV_SUBDEV_DEVINIT, 17 NVDEV_SUBDEV_DEVINIT,
18 NVDEV_SUBDEV_GPIO, 18 NVDEV_SUBDEV_GPIO,
19 NVDEV_SUBDEV_I2C, 19 NVDEV_SUBDEV_I2C,
20 NVDEV_SUBDEV_CLOCK, 20 NVDEV_SUBDEV_DEVINIT_LAST = NVDEV_SUBDEV_I2C,
21 NVDEV_SUBDEV_DEVINIT_LAST = NVDEV_SUBDEV_CLOCK,
22 21
23 /* This grouping of subdevs are initialised right after they've 22 /* This grouping of subdevs are initialised right after they've
24 * been created, and are allowed to assume any subdevs in the 23 * been created, and are allowed to assume any subdevs in the
@@ -35,6 +34,7 @@ enum nv_subdev_type {
35 NVDEV_SUBDEV_VM, 34 NVDEV_SUBDEV_VM,
36 NVDEV_SUBDEV_BAR, 35 NVDEV_SUBDEV_BAR,
37 NVDEV_SUBDEV_VOLT, 36 NVDEV_SUBDEV_VOLT,
37 NVDEV_SUBDEV_CLOCK,
38 NVDEV_SUBDEV_THERM, 38 NVDEV_SUBDEV_THERM,
39 39
40 NVDEV_ENGINE_DMAOBJ, 40 NVDEV_ENGINE_DMAOBJ,
@@ -49,6 +49,7 @@ enum nv_subdev_type {
49 NVDEV_ENGINE_PPP, 49 NVDEV_ENGINE_PPP,
50 NVDEV_ENGINE_COPY0, 50 NVDEV_ENGINE_COPY0,
51 NVDEV_ENGINE_COPY1, 51 NVDEV_ENGINE_COPY1,
52 NVDEV_ENGINE_COPY2,
52 NVDEV_ENGINE_UNK1C1, 53 NVDEV_ENGINE_UNK1C1,
53 NVDEV_ENGINE_VENC, 54 NVDEV_ENGINE_VENC,
54 NVDEV_ENGINE_DISP, 55 NVDEV_ENGINE_DISP,
diff --git a/drivers/gpu/drm/nouveau/core/include/core/mm.h b/drivers/gpu/drm/nouveau/core/include/core/mm.h
index 2514e81ade02..2bf7d0e32261 100644
--- a/drivers/gpu/drm/nouveau/core/include/core/mm.h
+++ b/drivers/gpu/drm/nouveau/core/include/core/mm.h
@@ -15,8 +15,6 @@ struct nouveau_mm {
15 struct list_head nodes; 15 struct list_head nodes;
16 struct list_head free; 16 struct list_head free;
17 17
18 struct mutex mutex;
19
20 u32 block_size; 18 u32 block_size;
21 int heap_nodes; 19 int heap_nodes;
22}; 20};
diff --git a/drivers/gpu/drm/nouveau/core/include/engine/bsp.h b/drivers/gpu/drm/nouveau/core/include/engine/bsp.h
index 13ccdf54dfad..67662e2c4547 100644
--- a/drivers/gpu/drm/nouveau/core/include/engine/bsp.h
+++ b/drivers/gpu/drm/nouveau/core/include/engine/bsp.h
@@ -2,6 +2,7 @@
2#define __NOUVEAU_BSP_H__ 2#define __NOUVEAU_BSP_H__
3 3
4extern struct nouveau_oclass nv84_bsp_oclass; 4extern struct nouveau_oclass nv84_bsp_oclass;
5extern struct nouveau_oclass nv98_bsp_oclass;
5extern struct nouveau_oclass nvc0_bsp_oclass; 6extern struct nouveau_oclass nvc0_bsp_oclass;
6extern struct nouveau_oclass nve0_bsp_oclass; 7extern struct nouveau_oclass nve0_bsp_oclass;
7 8
diff --git a/drivers/gpu/drm/nouveau/core/include/engine/copy.h b/drivers/gpu/drm/nouveau/core/include/engine/copy.h
index 8cad2cf28cef..316a28ae5f5c 100644
--- a/drivers/gpu/drm/nouveau/core/include/engine/copy.h
+++ b/drivers/gpu/drm/nouveau/core/include/engine/copy.h
@@ -8,5 +8,6 @@ extern struct nouveau_oclass nvc0_copy0_oclass;
8extern struct nouveau_oclass nvc0_copy1_oclass; 8extern struct nouveau_oclass nvc0_copy1_oclass;
9extern struct nouveau_oclass nve0_copy0_oclass; 9extern struct nouveau_oclass nve0_copy0_oclass;
10extern struct nouveau_oclass nve0_copy1_oclass; 10extern struct nouveau_oclass nve0_copy1_oclass;
11extern struct nouveau_oclass nve0_copy2_oclass;
11 12
12#endif 13#endif
diff --git a/drivers/gpu/drm/nouveau/core/include/core/falcon.h b/drivers/gpu/drm/nouveau/core/include/engine/falcon.h
index 1edec386ab36..1edec386ab36 100644
--- a/drivers/gpu/drm/nouveau/core/include/core/falcon.h
+++ b/drivers/gpu/drm/nouveau/core/include/engine/falcon.h
diff --git a/drivers/gpu/drm/nouveau/core/include/engine/graph.h b/drivers/gpu/drm/nouveau/core/include/engine/graph.h
index 5d392439f2ac..8e1b52312ddc 100644
--- a/drivers/gpu/drm/nouveau/core/include/engine/graph.h
+++ b/drivers/gpu/drm/nouveau/core/include/engine/graph.h
@@ -61,8 +61,14 @@ extern struct nouveau_oclass nv34_graph_oclass;
61extern struct nouveau_oclass nv35_graph_oclass; 61extern struct nouveau_oclass nv35_graph_oclass;
62extern struct nouveau_oclass nv40_graph_oclass; 62extern struct nouveau_oclass nv40_graph_oclass;
63extern struct nouveau_oclass nv50_graph_oclass; 63extern struct nouveau_oclass nv50_graph_oclass;
64extern struct nouveau_oclass nvc0_graph_oclass; 64extern struct nouveau_oclass *nvc0_graph_oclass;
65extern struct nouveau_oclass nve0_graph_oclass; 65extern struct nouveau_oclass *nvc1_graph_oclass;
66extern struct nouveau_oclass *nvc3_graph_oclass;
67extern struct nouveau_oclass *nvc8_graph_oclass;
68extern struct nouveau_oclass *nvd7_graph_oclass;
69extern struct nouveau_oclass *nvd9_graph_oclass;
70extern struct nouveau_oclass *nve4_graph_oclass;
71extern struct nouveau_oclass *nvf0_graph_oclass;
66 72
67extern const struct nouveau_bitfield nv04_graph_nsource[]; 73extern const struct nouveau_bitfield nv04_graph_nsource[];
68extern struct nouveau_ofuncs nv04_graph_ofuncs; 74extern struct nouveau_ofuncs nv04_graph_ofuncs;
diff --git a/drivers/gpu/drm/nouveau/core/include/engine/mpeg.h b/drivers/gpu/drm/nouveau/core/include/engine/mpeg.h
index bbf0d4a5bbd7..1d1a89a06ee4 100644
--- a/drivers/gpu/drm/nouveau/core/include/engine/mpeg.h
+++ b/drivers/gpu/drm/nouveau/core/include/engine/mpeg.h
@@ -54,7 +54,6 @@ extern struct nouveau_ofuncs nv50_mpeg_ofuncs;
54int nv50_mpeg_context_ctor(struct nouveau_object *, struct nouveau_object *, 54int nv50_mpeg_context_ctor(struct nouveau_object *, struct nouveau_object *,
55 struct nouveau_oclass *, void *, u32, 55 struct nouveau_oclass *, void *, u32,
56 struct nouveau_object **); 56 struct nouveau_object **);
57int nv50_mpeg_tlb_flush(struct nouveau_engine *);
58void nv50_mpeg_intr(struct nouveau_subdev *); 57void nv50_mpeg_intr(struct nouveau_subdev *);
59int nv50_mpeg_init(struct nouveau_object *); 58int nv50_mpeg_init(struct nouveau_object *);
60 59
diff --git a/drivers/gpu/drm/nouveau/core/include/engine/vp.h b/drivers/gpu/drm/nouveau/core/include/engine/vp.h
index d7b287b115bf..39baebec7fbb 100644
--- a/drivers/gpu/drm/nouveau/core/include/engine/vp.h
+++ b/drivers/gpu/drm/nouveau/core/include/engine/vp.h
@@ -2,6 +2,7 @@
2#define __NOUVEAU_VP_H__ 2#define __NOUVEAU_VP_H__
3 3
4extern struct nouveau_oclass nv84_vp_oclass; 4extern struct nouveau_oclass nv84_vp_oclass;
5extern struct nouveau_oclass nv98_vp_oclass;
5extern struct nouveau_oclass nvc0_vp_oclass; 6extern struct nouveau_oclass nvc0_vp_oclass;
6extern struct nouveau_oclass nve0_vp_oclass; 7extern struct nouveau_oclass nve0_vp_oclass;
7 8
diff --git a/drivers/gpu/drm/nouveau/core/include/engine/xtensa.h b/drivers/gpu/drm/nouveau/core/include/engine/xtensa.h
new file mode 100644
index 000000000000..306100f31f02
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/include/engine/xtensa.h
@@ -0,0 +1,38 @@
1#ifndef __NOUVEAU_XTENSA_H__
2#define __NOUVEAU_XTENSA_H__
3
4#include <core/engine.h>
5#include <core/engctx.h>
6#include <core/gpuobj.h>
7
8struct nouveau_xtensa {
9 struct nouveau_engine base;
10
11 u32 addr;
12 struct nouveau_gpuobj *gpu_fw;
13 u32 fifo_val;
14 u32 unkd28;
15};
16
17#define nouveau_xtensa_create(p,e,c,b,d,i,f,r) \
18 nouveau_xtensa_create_((p), (e), (c), (b), (d), (i), (f), \
19 sizeof(**r),(void **)r)
20
21int _nouveau_xtensa_engctx_ctor(struct nouveau_object *,
22 struct nouveau_object *,
23 struct nouveau_oclass *, void *, u32,
24 struct nouveau_object **);
25
26void _nouveau_xtensa_intr(struct nouveau_subdev *);
27int nouveau_xtensa_create_(struct nouveau_object *,
28 struct nouveau_object *,
29 struct nouveau_oclass *, u32, bool,
30 const char *, const char *,
31 int, void **);
32#define _nouveau_xtensa_dtor _nouveau_engine_dtor
33int _nouveau_xtensa_init(struct nouveau_object *);
34int _nouveau_xtensa_fini(struct nouveau_object *, bool);
35u32 _nouveau_xtensa_rd32(struct nouveau_object *, u64);
36void _nouveau_xtensa_wr32(struct nouveau_object *, u64, u32);
37
38#endif
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/clock.h b/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
index 41b7a6a76f19..89ee289097a6 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
@@ -10,8 +10,6 @@ struct nvbios_pll;
10struct nouveau_clock { 10struct nouveau_clock {
11 struct nouveau_subdev base; 11 struct nouveau_subdev base;
12 12
13 int (*pll_set)(struct nouveau_clock *, u32 type, u32 freq);
14
15 /*XXX: die, these are here *only* to support the completely 13 /*XXX: die, these are here *only* to support the completely
16 * bat-shit insane what-was-nouveau_hw.c code 14 * bat-shit insane what-was-nouveau_hw.c code
17 */ 15 */
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/devinit.h b/drivers/gpu/drm/nouveau/core/include/subdev/devinit.h
index 29e4cc1f6cc0..685c9b12ee4c 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/devinit.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/devinit.h
@@ -8,6 +8,8 @@ struct nouveau_devinit {
8 struct nouveau_subdev base; 8 struct nouveau_subdev base;
9 bool post; 9 bool post;
10 void (*meminit)(struct nouveau_devinit *); 10 void (*meminit)(struct nouveau_devinit *);
11 int (*pll_set)(struct nouveau_devinit *, u32 type, u32 freq);
12
11}; 13};
12 14
13static inline struct nouveau_devinit * 15static inline struct nouveau_devinit *
@@ -20,11 +22,20 @@ nouveau_devinit(void *obj)
20 nouveau_devinit_create_((p), (e), (o), sizeof(**d), (void **)d) 22 nouveau_devinit_create_((p), (e), (o), sizeof(**d), (void **)d)
21#define nouveau_devinit_destroy(p) \ 23#define nouveau_devinit_destroy(p) \
22 nouveau_subdev_destroy(&(p)->base) 24 nouveau_subdev_destroy(&(p)->base)
25#define nouveau_devinit_init(p) ({ \
26 struct nouveau_devinit *d = (p); \
27 _nouveau_devinit_init(nv_object(d)); \
28})
29#define nouveau_devinit_fini(p,s) ({ \
30 struct nouveau_devinit *d = (p); \
31 _nouveau_devinit_fini(nv_object(d), (s)); \
32})
23 33
24int nouveau_devinit_create_(struct nouveau_object *, struct nouveau_object *, 34int nouveau_devinit_create_(struct nouveau_object *, struct nouveau_object *,
25 struct nouveau_oclass *, int, void **); 35 struct nouveau_oclass *, int, void **);
26int nouveau_devinit_init(struct nouveau_devinit *); 36#define _nouveau_devinit_dtor _nouveau_subdev_dtor
27int nouveau_devinit_fini(struct nouveau_devinit *, bool suspend); 37int _nouveau_devinit_init(struct nouveau_object *);
38int _nouveau_devinit_fini(struct nouveau_object *, bool suspend);
28 39
29extern struct nouveau_oclass nv04_devinit_oclass; 40extern struct nouveau_oclass nv04_devinit_oclass;
30extern struct nouveau_oclass nv05_devinit_oclass; 41extern struct nouveau_oclass nv05_devinit_oclass;
@@ -32,9 +43,7 @@ extern struct nouveau_oclass nv10_devinit_oclass;
32extern struct nouveau_oclass nv1a_devinit_oclass; 43extern struct nouveau_oclass nv1a_devinit_oclass;
33extern struct nouveau_oclass nv20_devinit_oclass; 44extern struct nouveau_oclass nv20_devinit_oclass;
34extern struct nouveau_oclass nv50_devinit_oclass; 45extern struct nouveau_oclass nv50_devinit_oclass;
35 46extern struct nouveau_oclass nva3_devinit_oclass;
36void nv04_devinit_dtor(struct nouveau_object *); 47extern struct nouveau_oclass nvc0_devinit_oclass;
37int nv04_devinit_init(struct nouveau_object *);
38int nv04_devinit_fini(struct nouveau_object *, bool);
39 48
40#endif 49#endif
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/fb.h b/drivers/gpu/drm/nouveau/core/include/subdev/fb.h
index da470e6851b1..2e7405084261 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/fb.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/fb.h
@@ -53,31 +53,7 @@ struct nouveau_fb {
53 53
54 bool (*memtype_valid)(struct nouveau_fb *, u32 memtype); 54 bool (*memtype_valid)(struct nouveau_fb *, u32 memtype);
55 55
56 struct { 56 struct nouveau_ram *ram;
57 enum {
58 NV_MEM_TYPE_UNKNOWN = 0,
59 NV_MEM_TYPE_STOLEN,
60 NV_MEM_TYPE_SGRAM,
61 NV_MEM_TYPE_SDRAM,
62 NV_MEM_TYPE_DDR1,
63 NV_MEM_TYPE_DDR2,
64 NV_MEM_TYPE_DDR3,
65 NV_MEM_TYPE_GDDR2,
66 NV_MEM_TYPE_GDDR3,
67 NV_MEM_TYPE_GDDR4,
68 NV_MEM_TYPE_GDDR5
69 } type;
70 u64 stolen;
71 u64 size;
72
73 int ranks;
74 int parts;
75
76 int (*init)(struct nouveau_fb *);
77 int (*get)(struct nouveau_fb *, u64 size, u32 align,
78 u32 size_nc, u32 type, struct nouveau_mem **);
79 void (*put)(struct nouveau_fb *, struct nouveau_mem **);
80 } ram;
81 57
82 struct nouveau_mm vram; 58 struct nouveau_mm vram;
83 struct nouveau_mm tags; 59 struct nouveau_mm tags;
@@ -102,18 +78,6 @@ nouveau_fb(void *obj)
102 return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_FB]; 78 return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_FB];
103} 79}
104 80
105#define nouveau_fb_create(p,e,c,d) \
106 nouveau_subdev_create((p), (e), (c), 0, "PFB", "fb", (d))
107int nouveau_fb_preinit(struct nouveau_fb *);
108void nouveau_fb_destroy(struct nouveau_fb *);
109int nouveau_fb_init(struct nouveau_fb *);
110#define nouveau_fb_fini(p,s) \
111 nouveau_subdev_fini(&(p)->base, (s))
112
113void _nouveau_fb_dtor(struct nouveau_object *);
114int _nouveau_fb_init(struct nouveau_object *);
115#define _nouveau_fb_fini _nouveau_subdev_fini
116
117extern struct nouveau_oclass nv04_fb_oclass; 81extern struct nouveau_oclass nv04_fb_oclass;
118extern struct nouveau_oclass nv10_fb_oclass; 82extern struct nouveau_oclass nv10_fb_oclass;
119extern struct nouveau_oclass nv1a_fb_oclass; 83extern struct nouveau_oclass nv1a_fb_oclass;
@@ -132,40 +96,31 @@ extern struct nouveau_oclass nv4e_fb_oclass;
132extern struct nouveau_oclass nv50_fb_oclass; 96extern struct nouveau_oclass nv50_fb_oclass;
133extern struct nouveau_oclass nvc0_fb_oclass; 97extern struct nouveau_oclass nvc0_fb_oclass;
134 98
135struct nouveau_bios; 99struct nouveau_ram {
136int nouveau_fb_bios_memtype(struct nouveau_bios *); 100 struct nouveau_object base;
137 101 enum {
138bool nv04_fb_memtype_valid(struct nouveau_fb *, u32 memtype); 102 NV_MEM_TYPE_UNKNOWN = 0,
139 103 NV_MEM_TYPE_STOLEN,
140void nv10_fb_tile_init(struct nouveau_fb *, int i, u32 addr, u32 size, 104 NV_MEM_TYPE_SGRAM,
141 u32 pitch, u32 flags, struct nouveau_fb_tile *); 105 NV_MEM_TYPE_SDRAM,
142void nv10_fb_tile_fini(struct nouveau_fb *, int i, struct nouveau_fb_tile *); 106 NV_MEM_TYPE_DDR1,
143void nv10_fb_tile_prog(struct nouveau_fb *, int, struct nouveau_fb_tile *); 107 NV_MEM_TYPE_DDR2,
144 108 NV_MEM_TYPE_DDR3,
145int nv20_fb_vram_init(struct nouveau_fb *); 109 NV_MEM_TYPE_GDDR2,
146void nv20_fb_tile_init(struct nouveau_fb *, int i, u32 addr, u32 size, 110 NV_MEM_TYPE_GDDR3,
147 u32 pitch, u32 flags, struct nouveau_fb_tile *); 111 NV_MEM_TYPE_GDDR4,
148void nv20_fb_tile_fini(struct nouveau_fb *, int i, struct nouveau_fb_tile *); 112 NV_MEM_TYPE_GDDR5
149void nv20_fb_tile_prog(struct nouveau_fb *, int, struct nouveau_fb_tile *); 113 } type;
150 114 u64 stolen;
151int nv30_fb_init(struct nouveau_object *); 115 u64 size;
152void nv30_fb_tile_init(struct nouveau_fb *, int i, u32 addr, u32 size, 116 u32 tags;
153 u32 pitch, u32 flags, struct nouveau_fb_tile *);
154
155void nv40_fb_tile_comp(struct nouveau_fb *, int i, u32 size, u32 flags,
156 struct nouveau_fb_tile *);
157
158int nv41_fb_vram_init(struct nouveau_fb *);
159int nv41_fb_init(struct nouveau_object *);
160void nv41_fb_tile_prog(struct nouveau_fb *, int, struct nouveau_fb_tile *);
161
162int nv44_fb_vram_init(struct nouveau_fb *);
163int nv44_fb_init(struct nouveau_object *);
164void nv44_fb_tile_prog(struct nouveau_fb *, int, struct nouveau_fb_tile *);
165 117
166void nv46_fb_tile_init(struct nouveau_fb *, int i, u32 addr, u32 size, 118 int ranks;
167 u32 pitch, u32 flags, struct nouveau_fb_tile *); 119 int parts;
168 120
169void nv50_fb_vram_del(struct nouveau_fb *, struct nouveau_mem **); 121 int (*get)(struct nouveau_fb *, u64 size, u32 align,
122 u32 size_nc, u32 type, struct nouveau_mem **);
123 void (*put)(struct nouveau_fb *, struct nouveau_mem **);
124};
170 125
171#endif 126#endif
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/vm.h b/drivers/gpu/drm/nouveau/core/include/subdev/vm.h
index 9d595efe667a..f2e87b105666 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/vm.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/vm.h
@@ -58,7 +58,7 @@ struct nouveau_vm {
58 int refcount; 58 int refcount;
59 59
60 struct list_head pgd_list; 60 struct list_head pgd_list;
61 atomic_t engref[64]; //NVDEV_SUBDEV_NR]; 61 atomic_t engref[NVDEV_SUBDEV_NR];
62 62
63 struct nouveau_vm_pgt *pgt; 63 struct nouveau_vm_pgt *pgt;
64 u32 fpde; 64 u32 fpde;
@@ -117,9 +117,6 @@ int nv04_vm_create(struct nouveau_vmmgr *, u64, u64, u64,
117 struct nouveau_vm **); 117 struct nouveau_vm **);
118void nv04_vmmgr_dtor(struct nouveau_object *); 118void nv04_vmmgr_dtor(struct nouveau_object *);
119 119
120void nv50_vm_flush_engine(struct nouveau_subdev *, int engine);
121void nvc0_vm_flush_engine(struct nouveau_subdev *, u64 addr, int type);
122
123/* nouveau_vm.c */ 120/* nouveau_vm.c */
124int nouveau_vm_create(struct nouveau_vmmgr *, u64 offset, u64 length, 121int nouveau_vm_create(struct nouveau_vmmgr *, u64 offset, u64 length,
125 u64 mm_offset, u32 block, struct nouveau_vm **); 122 u64 mm_offset, u32 block, struct nouveau_vm **);
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bar/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/bar/nv50.c
index 649f1ced1fe0..160d27f3c7b4 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bar/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bar/nv50.c
@@ -53,7 +53,6 @@ nv50_bar_kmap(struct nouveau_bar *bar, struct nouveau_mem *mem,
53 return ret; 53 return ret;
54 54
55 nouveau_vm_map(vma, mem); 55 nouveau_vm_map(vma, mem);
56 nv50_vm_flush_engine(nv_subdev(bar), 6);
57 return 0; 56 return 0;
58} 57}
59 58
@@ -69,7 +68,6 @@ nv50_bar_umap(struct nouveau_bar *bar, struct nouveau_mem *mem,
69 return ret; 68 return ret;
70 69
71 nouveau_vm_map(vma, mem); 70 nouveau_vm_map(vma, mem);
72 nv50_vm_flush_engine(nv_subdev(bar), 6);
73 return 0; 71 return 0;
74} 72}
75 73
@@ -77,7 +75,6 @@ static void
77nv50_bar_unmap(struct nouveau_bar *bar, struct nouveau_vma *vma) 75nv50_bar_unmap(struct nouveau_bar *bar, struct nouveau_vma *vma)
78{ 76{
79 nouveau_vm_unmap(vma); 77 nouveau_vm_unmap(vma);
80 nv50_vm_flush_engine(nv_subdev(bar), 6);
81 nouveau_vm_put(vma); 78 nouveau_vm_put(vma);
82} 79}
83 80
@@ -147,6 +144,8 @@ nv50_bar_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
147 if (ret) 144 if (ret)
148 return ret; 145 return ret;
149 146
147 atomic_inc(&vm->engref[NVDEV_SUBDEV_BAR]);
148
150 ret = nouveau_gpuobj_new(nv_object(priv), heap, 149 ret = nouveau_gpuobj_new(nv_object(priv), heap,
151 ((limit-- - start) >> 12) * 8, 0x1000, 150 ((limit-- - start) >> 12) * 8, 0x1000,
152 NVOBJ_FLAG_ZERO_ALLOC, &vm->pgt[0].obj[0]); 151 NVOBJ_FLAG_ZERO_ALLOC, &vm->pgt[0].obj[0]);
@@ -179,6 +178,8 @@ nv50_bar_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
179 if (ret) 178 if (ret)
180 return ret; 179 return ret;
181 180
181 atomic_inc(&vm->engref[NVDEV_SUBDEV_BAR]);
182
182 ret = nouveau_vm_ref(vm, &priv->bar1_vm, priv->pgd); 183 ret = nouveau_vm_ref(vm, &priv->bar1_vm, priv->pgd);
183 nouveau_vm_ref(NULL, &vm, NULL); 184 nouveau_vm_ref(NULL, &vm, NULL);
184 if (ret) 185 if (ret)
@@ -237,7 +238,11 @@ nv50_bar_init(struct nouveau_object *object)
237 238
238 nv_mask(priv, 0x000200, 0x00000100, 0x00000000); 239 nv_mask(priv, 0x000200, 0x00000100, 0x00000000);
239 nv_mask(priv, 0x000200, 0x00000100, 0x00000100); 240 nv_mask(priv, 0x000200, 0x00000100, 0x00000100);
240 nv50_vm_flush_engine(nv_subdev(priv), 6); 241 nv_wr32(priv, 0x100c80, 0x00060001);
242 if (!nv_wait(priv, 0x100c80, 0x00000001, 0x00000000)) {
243 nv_error(priv, "vm flush timeout\n");
244 return -EBUSY;
245 }
241 246
242 nv_wr32(priv, 0x001704, 0x00000000 | priv->mem->addr >> 12); 247 nv_wr32(priv, 0x001704, 0x00000000 | priv->mem->addr >> 12);
243 nv_wr32(priv, 0x001704, 0x40000000 | priv->mem->addr >> 12); 248 nv_wr32(priv, 0x001704, 0x40000000 | priv->mem->addr >> 12);
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c b/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c
index f8a44956dec1..b2ec7411eb2e 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c
@@ -51,7 +51,6 @@ nvc0_bar_kmap(struct nouveau_bar *bar, struct nouveau_mem *mem,
51 return ret; 51 return ret;
52 52
53 nouveau_vm_map(vma, mem); 53 nouveau_vm_map(vma, mem);
54 nvc0_vm_flush_engine(nv_subdev(bar), priv->bar[0].pgd->addr, 5);
55 return 0; 54 return 0;
56} 55}
57 56
@@ -68,18 +67,13 @@ nvc0_bar_umap(struct nouveau_bar *bar, struct nouveau_mem *mem,
68 return ret; 67 return ret;
69 68
70 nouveau_vm_map(vma, mem); 69 nouveau_vm_map(vma, mem);
71 nvc0_vm_flush_engine(nv_subdev(bar), priv->bar[1].pgd->addr, 5);
72 return 0; 70 return 0;
73} 71}
74 72
75static void 73static void
76nvc0_bar_unmap(struct nouveau_bar *bar, struct nouveau_vma *vma) 74nvc0_bar_unmap(struct nouveau_bar *bar, struct nouveau_vma *vma)
77{ 75{
78 struct nvc0_bar_priv *priv = (void *)bar;
79 int i = !(vma->vm == priv->bar[0].vm);
80
81 nouveau_vm_unmap(vma); 76 nouveau_vm_unmap(vma);
82 nvc0_vm_flush_engine(nv_subdev(bar), priv->bar[i].pgd->addr, 5);
83 nouveau_vm_put(vma); 77 nouveau_vm_put(vma);
84} 78}
85 79
@@ -116,6 +110,8 @@ nvc0_bar_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
116 if (ret) 110 if (ret)
117 return ret; 111 return ret;
118 112
113 atomic_inc(&vm->engref[NVDEV_SUBDEV_BAR]);
114
119 ret = nouveau_gpuobj_new(nv_object(priv), NULL, 115 ret = nouveau_gpuobj_new(nv_object(priv), NULL,
120 (pci_resource_len(pdev, 3) >> 12) * 8, 116 (pci_resource_len(pdev, 3) >> 12) * 8,
121 0x1000, NVOBJ_FLAG_ZERO_ALLOC, 117 0x1000, NVOBJ_FLAG_ZERO_ALLOC,
@@ -150,6 +146,8 @@ nvc0_bar_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
150 if (ret) 146 if (ret)
151 return ret; 147 return ret;
152 148
149 atomic_inc(&vm->engref[NVDEV_SUBDEV_BAR]);
150
153 ret = nouveau_vm_ref(vm, &priv->bar[1].vm, priv->bar[1].pgd); 151 ret = nouveau_vm_ref(vm, &priv->bar[1].vm, priv->bar[1].pgd);
154 nouveau_vm_ref(NULL, &vm, NULL); 152 nouveau_vm_ref(NULL, &vm, NULL);
155 if (ret) 153 if (ret)
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
index 0e2c1a4f1659..aa0fbbec7f08 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
@@ -85,11 +85,15 @@ static void
85nouveau_bios_shadow_pramin(struct nouveau_bios *bios) 85nouveau_bios_shadow_pramin(struct nouveau_bios *bios)
86{ 86{
87 struct nouveau_device *device = nv_device(bios); 87 struct nouveau_device *device = nv_device(bios);
88 u64 addr = 0;
88 u32 bar0 = 0; 89 u32 bar0 = 0;
89 int i; 90 int i;
90 91
91 if (device->card_type >= NV_50) { 92 if (device->card_type >= NV_50) {
92 u64 addr = (u64)(nv_rd32(bios, 0x619f04) & 0xffffff00) << 8; 93 if ( device->card_type < NV_C0 ||
94 !(nv_rd32(bios, 0x022500) & 0x00000001))
95 addr = (u64)(nv_rd32(bios, 0x619f04) & 0xffffff00) << 8;
96
93 if (!addr) { 97 if (!addr) {
94 addr = (u64)nv_rd32(bios, 0x001700) << 16; 98 addr = (u64)nv_rd32(bios, 0x001700) << 16;
95 addr += 0xf0000; 99 addr += 0xf0000;
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/init.c b/drivers/gpu/drm/nouveau/core/subdev/bios/init.c
index c434d398d16f..0687e6481438 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/init.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/init.c
@@ -10,7 +10,6 @@
10#include <subdev/bios/gpio.h> 10#include <subdev/bios/gpio.h>
11#include <subdev/bios/init.h> 11#include <subdev/bios/init.h>
12#include <subdev/devinit.h> 12#include <subdev/devinit.h>
13#include <subdev/clock.h>
14#include <subdev/i2c.h> 13#include <subdev/i2c.h>
15#include <subdev/vga.h> 14#include <subdev/vga.h>
16#include <subdev/gpio.h> 15#include <subdev/gpio.h>
@@ -300,9 +299,9 @@ init_wrauxr(struct nvbios_init *init, u32 addr, u8 data)
300static void 299static void
301init_prog_pll(struct nvbios_init *init, u32 id, u32 freq) 300init_prog_pll(struct nvbios_init *init, u32 id, u32 freq)
302{ 301{
303 struct nouveau_clock *clk = nouveau_clock(init->bios); 302 struct nouveau_devinit *devinit = nouveau_devinit(init->bios);
304 if (clk && clk->pll_set && init_exec(init)) { 303 if (devinit->pll_set && init_exec(init)) {
305 int ret = clk->pll_set(clk, id, freq); 304 int ret = devinit->pll_set(devinit, id, freq);
306 if (ret) 305 if (ret)
307 warn("failed to prog pll 0x%08x to %dkHz\n", id, freq); 306 warn("failed to prog pll 0x%08x to %dkHz\n", id, freq);
308 } 307 }
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/nv04.c b/drivers/gpu/drm/nouveau/core/subdev/clock/nv04.c
index b7fd1151166e..a14277586595 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/clock/nv04.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/clock/nv04.c
@@ -22,9 +22,10 @@
22 * Authors: Ben Skeggs 22 * Authors: Ben Skeggs
23 */ 23 */
24 24
25#include <subdev/clock.h>
26#include <subdev/bios.h> 25#include <subdev/bios.h>
27#include <subdev/bios/pll.h> 26#include <subdev/bios/pll.h>
27#include <subdev/clock.h>
28#include <subdev/devinit/priv.h>
28 29
29#include "pll.h" 30#include "pll.h"
30 31
@@ -32,272 +33,12 @@ struct nv04_clock_priv {
32 struct nouveau_clock base; 33 struct nouveau_clock base;
33}; 34};
34 35
35static int
36powerctrl_1_shift(int chip_version, int reg)
37{
38 int shift = -4;
39
40 if (chip_version < 0x17 || chip_version == 0x1a || chip_version == 0x20)
41 return shift;
42
43 switch (reg) {
44 case 0x680520:
45 shift += 4;
46 case 0x680508:
47 shift += 4;
48 case 0x680504:
49 shift += 4;
50 case 0x680500:
51 shift += 4;
52 }
53
54 /*
55 * the shift for vpll regs is only used for nv3x chips with a single
56 * stage pll
57 */
58 if (shift > 4 && (chip_version < 0x32 || chip_version == 0x35 ||
59 chip_version == 0x36 || chip_version >= 0x40))
60 shift = -4;
61
62 return shift;
63}
64
65static void
66setPLL_single(struct nv04_clock_priv *priv, u32 reg,
67 struct nouveau_pll_vals *pv)
68{
69 int chip_version = nouveau_bios(priv)->version.chip;
70 uint32_t oldpll = nv_rd32(priv, reg);
71 int oldN = (oldpll >> 8) & 0xff, oldM = oldpll & 0xff;
72 uint32_t pll = (oldpll & 0xfff80000) | pv->log2P << 16 | pv->NM1;
73 uint32_t saved_powerctrl_1 = 0;
74 int shift_powerctrl_1 = powerctrl_1_shift(chip_version, reg);
75
76 if (oldpll == pll)
77 return; /* already set */
78
79 if (shift_powerctrl_1 >= 0) {
80 saved_powerctrl_1 = nv_rd32(priv, 0x001584);
81 nv_wr32(priv, 0x001584,
82 (saved_powerctrl_1 & ~(0xf << shift_powerctrl_1)) |
83 1 << shift_powerctrl_1);
84 }
85
86 if (oldM && pv->M1 && (oldN / oldM < pv->N1 / pv->M1))
87 /* upclock -- write new post divider first */
88 nv_wr32(priv, reg, pv->log2P << 16 | (oldpll & 0xffff));
89 else
90 /* downclock -- write new NM first */
91 nv_wr32(priv, reg, (oldpll & 0xffff0000) | pv->NM1);
92
93 if (chip_version < 0x17 && chip_version != 0x11)
94 /* wait a bit on older chips */
95 msleep(64);
96 nv_rd32(priv, reg);
97
98 /* then write the other half as well */
99 nv_wr32(priv, reg, pll);
100
101 if (shift_powerctrl_1 >= 0)
102 nv_wr32(priv, 0x001584, saved_powerctrl_1);
103}
104
105static uint32_t
106new_ramdac580(uint32_t reg1, bool ss, uint32_t ramdac580)
107{
108 bool head_a = (reg1 == 0x680508);
109
110 if (ss) /* single stage pll mode */
111 ramdac580 |= head_a ? 0x00000100 : 0x10000000;
112 else
113 ramdac580 &= head_a ? 0xfffffeff : 0xefffffff;
114
115 return ramdac580;
116}
117
118static void
119setPLL_double_highregs(struct nv04_clock_priv *priv, u32 reg1,
120 struct nouveau_pll_vals *pv)
121{
122 int chip_version = nouveau_bios(priv)->version.chip;
123 bool nv3035 = chip_version == 0x30 || chip_version == 0x35;
124 uint32_t reg2 = reg1 + ((reg1 == 0x680520) ? 0x5c : 0x70);
125 uint32_t oldpll1 = nv_rd32(priv, reg1);
126 uint32_t oldpll2 = !nv3035 ? nv_rd32(priv, reg2) : 0;
127 uint32_t pll1 = (oldpll1 & 0xfff80000) | pv->log2P << 16 | pv->NM1;
128 uint32_t pll2 = (oldpll2 & 0x7fff0000) | 1 << 31 | pv->NM2;
129 uint32_t oldramdac580 = 0, ramdac580 = 0;
130 bool single_stage = !pv->NM2 || pv->N2 == pv->M2; /* nv41+ only */
131 uint32_t saved_powerctrl_1 = 0, savedc040 = 0;
132 int shift_powerctrl_1 = powerctrl_1_shift(chip_version, reg1);
133
134 /* model specific additions to generic pll1 and pll2 set up above */
135 if (nv3035) {
136 pll1 = (pll1 & 0xfcc7ffff) | (pv->N2 & 0x18) << 21 |
137 (pv->N2 & 0x7) << 19 | 8 << 4 | (pv->M2 & 7) << 4;
138 pll2 = 0;
139 }
140 if (chip_version > 0x40 && reg1 >= 0x680508) { /* !nv40 */
141 oldramdac580 = nv_rd32(priv, 0x680580);
142 ramdac580 = new_ramdac580(reg1, single_stage, oldramdac580);
143 if (oldramdac580 != ramdac580)
144 oldpll1 = ~0; /* force mismatch */
145 if (single_stage)
146 /* magic value used by nvidia in single stage mode */
147 pll2 |= 0x011f;
148 }
149 if (chip_version > 0x70)
150 /* magic bits set by the blob (but not the bios) on g71-73 */
151 pll1 = (pll1 & 0x7fffffff) | (single_stage ? 0x4 : 0xc) << 28;
152
153 if (oldpll1 == pll1 && oldpll2 == pll2)
154 return; /* already set */
155
156 if (shift_powerctrl_1 >= 0) {
157 saved_powerctrl_1 = nv_rd32(priv, 0x001584);
158 nv_wr32(priv, 0x001584,
159 (saved_powerctrl_1 & ~(0xf << shift_powerctrl_1)) |
160 1 << shift_powerctrl_1);
161 }
162
163 if (chip_version >= 0x40) {
164 int shift_c040 = 14;
165
166 switch (reg1) {
167 case 0x680504:
168 shift_c040 += 2;
169 case 0x680500:
170 shift_c040 += 2;
171 case 0x680520:
172 shift_c040 += 2;
173 case 0x680508:
174 shift_c040 += 2;
175 }
176
177 savedc040 = nv_rd32(priv, 0xc040);
178 if (shift_c040 != 14)
179 nv_wr32(priv, 0xc040, savedc040 & ~(3 << shift_c040));
180 }
181
182 if (oldramdac580 != ramdac580)
183 nv_wr32(priv, 0x680580, ramdac580);
184
185 if (!nv3035)
186 nv_wr32(priv, reg2, pll2);
187 nv_wr32(priv, reg1, pll1);
188
189 if (shift_powerctrl_1 >= 0)
190 nv_wr32(priv, 0x001584, saved_powerctrl_1);
191 if (chip_version >= 0x40)
192 nv_wr32(priv, 0xc040, savedc040);
193}
194
195static void
196setPLL_double_lowregs(struct nv04_clock_priv *priv, u32 NMNMreg,
197 struct nouveau_pll_vals *pv)
198{
199 /* When setting PLLs, there is a merry game of disabling and enabling
200 * various bits of hardware during the process. This function is a
201 * synthesis of six nv4x traces, nearly each card doing a subtly
202 * different thing. With luck all the necessary bits for each card are
203 * combined herein. Without luck it deviates from each card's formula
204 * so as to not work on any :)
205 */
206
207 uint32_t Preg = NMNMreg - 4;
208 bool mpll = Preg == 0x4020;
209 uint32_t oldPval = nv_rd32(priv, Preg);
210 uint32_t NMNM = pv->NM2 << 16 | pv->NM1;
211 uint32_t Pval = (oldPval & (mpll ? ~(0x77 << 16) : ~(7 << 16))) |
212 0xc << 28 | pv->log2P << 16;
213 uint32_t saved4600 = 0;
214 /* some cards have different maskc040s */
215 uint32_t maskc040 = ~(3 << 14), savedc040;
216 bool single_stage = !pv->NM2 || pv->N2 == pv->M2;
217
218 if (nv_rd32(priv, NMNMreg) == NMNM && (oldPval & 0xc0070000) == Pval)
219 return;
220
221 if (Preg == 0x4000)
222 maskc040 = ~0x333;
223 if (Preg == 0x4058)
224 maskc040 = ~(0xc << 24);
225
226 if (mpll) {
227 struct nvbios_pll info;
228 uint8_t Pval2;
229
230 if (nvbios_pll_parse(nouveau_bios(priv), Preg, &info))
231 return;
232
233 Pval2 = pv->log2P + info.bias_p;
234 if (Pval2 > info.max_p)
235 Pval2 = info.max_p;
236 Pval |= 1 << 28 | Pval2 << 20;
237
238 saved4600 = nv_rd32(priv, 0x4600);
239 nv_wr32(priv, 0x4600, saved4600 | 8 << 28);
240 }
241 if (single_stage)
242 Pval |= mpll ? 1 << 12 : 1 << 8;
243
244 nv_wr32(priv, Preg, oldPval | 1 << 28);
245 nv_wr32(priv, Preg, Pval & ~(4 << 28));
246 if (mpll) {
247 Pval |= 8 << 20;
248 nv_wr32(priv, 0x4020, Pval & ~(0xc << 28));
249 nv_wr32(priv, 0x4038, Pval & ~(0xc << 28));
250 }
251
252 savedc040 = nv_rd32(priv, 0xc040);
253 nv_wr32(priv, 0xc040, savedc040 & maskc040);
254
255 nv_wr32(priv, NMNMreg, NMNM);
256 if (NMNMreg == 0x4024)
257 nv_wr32(priv, 0x403c, NMNM);
258
259 nv_wr32(priv, Preg, Pval);
260 if (mpll) {
261 Pval &= ~(8 << 20);
262 nv_wr32(priv, 0x4020, Pval);
263 nv_wr32(priv, 0x4038, Pval);
264 nv_wr32(priv, 0x4600, saved4600);
265 }
266
267 nv_wr32(priv, 0xc040, savedc040);
268
269 if (mpll) {
270 nv_wr32(priv, 0x4020, Pval & ~(1 << 28));
271 nv_wr32(priv, 0x4038, Pval & ~(1 << 28));
272 }
273}
274
275int
276nv04_clock_pll_set(struct nouveau_clock *clk, u32 type, u32 freq)
277{
278 struct nv04_clock_priv *priv = (void *)clk;
279 struct nouveau_pll_vals pv;
280 struct nvbios_pll info;
281 int ret;
282
283 ret = nvbios_pll_parse(nouveau_bios(priv), type > 0x405c ?
284 type : type - 4, &info);
285 if (ret)
286 return ret;
287
288 ret = clk->pll_calc(clk, &info, freq, &pv);
289 if (!ret)
290 return ret;
291
292 return clk->pll_prog(clk, type, &pv);
293}
294
295int 36int
296nv04_clock_pll_calc(struct nouveau_clock *clock, struct nvbios_pll *info, 37nv04_clock_pll_calc(struct nouveau_clock *clock, struct nvbios_pll *info,
297 int clk, struct nouveau_pll_vals *pv) 38 int clk, struct nouveau_pll_vals *pv)
298{ 39{
299 int N1, M1, N2, M2, P; 40 int N1, M1, N2, M2, P;
300 int ret = nv04_pll_calc(clock, info, clk, &N1, &M1, &N2, &M2, &P); 41 int ret = nv04_pll_calc(nv_subdev(clock), info, clk, &N1, &M1, &N2, &M2, &P);
301 if (ret) { 42 if (ret) {
302 pv->refclk = info->refclk; 43 pv->refclk = info->refclk;
303 pv->N1 = N1; 44 pv->N1 = N1;
@@ -313,17 +54,17 @@ int
313nv04_clock_pll_prog(struct nouveau_clock *clk, u32 reg1, 54nv04_clock_pll_prog(struct nouveau_clock *clk, u32 reg1,
314 struct nouveau_pll_vals *pv) 55 struct nouveau_pll_vals *pv)
315{ 56{
316 struct nv04_clock_priv *priv = (void *)clk; 57 struct nouveau_devinit *devinit = nouveau_devinit(clk);
317 int cv = nouveau_bios(clk)->version.chip; 58 int cv = nouveau_bios(clk)->version.chip;
318 59
319 if (cv == 0x30 || cv == 0x31 || cv == 0x35 || cv == 0x36 || 60 if (cv == 0x30 || cv == 0x31 || cv == 0x35 || cv == 0x36 ||
320 cv >= 0x40) { 61 cv >= 0x40) {
321 if (reg1 > 0x405c) 62 if (reg1 > 0x405c)
322 setPLL_double_highregs(priv, reg1, pv); 63 setPLL_double_highregs(devinit, reg1, pv);
323 else 64 else
324 setPLL_double_lowregs(priv, reg1, pv); 65 setPLL_double_lowregs(devinit, reg1, pv);
325 } else 66 } else
326 setPLL_single(priv, reg1, pv); 67 setPLL_single(devinit, reg1, pv);
327 68
328 return 0; 69 return 0;
329} 70}
@@ -341,7 +82,6 @@ nv04_clock_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
341 if (ret) 82 if (ret)
342 return ret; 83 return ret;
343 84
344 priv->base.pll_set = nv04_clock_pll_set;
345 priv->base.pll_calc = nv04_clock_pll_calc; 85 priv->base.pll_calc = nv04_clock_pll_calc;
346 priv->base.pll_prog = nv04_clock_pll_prog; 86 priv->base.pll_prog = nv04_clock_pll_prog;
347 return 0; 87 return 0;
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/nv40.c b/drivers/gpu/drm/nouveau/core/subdev/clock/nv40.c
index a4b2b7ebf9af..0db5dbfd91b5 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/clock/nv40.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/clock/nv40.c
@@ -41,7 +41,6 @@ nv40_clock_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
41 if (ret) 41 if (ret)
42 return ret; 42 return ret;
43 43
44 priv->base.pll_set = nv04_clock_pll_set;
45 priv->base.pll_calc = nv04_clock_pll_calc; 44 priv->base.pll_calc = nv04_clock_pll_calc;
46 priv->base.pll_prog = nv04_clock_pll_prog; 45 priv->base.pll_prog = nv04_clock_pll_prog;
47 return 0; 46 return 0;
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/clock/nv50.c
index f4147f67eda6..d09d3e78040c 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/clock/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/clock/nv50.c
@@ -33,50 +33,6 @@ struct nv50_clock_priv {
33}; 33};
34 34
35static int 35static int
36nv50_clock_pll_set(struct nouveau_clock *clk, u32 type, u32 freq)
37{
38 struct nv50_clock_priv *priv = (void *)clk;
39 struct nouveau_bios *bios = nouveau_bios(priv);
40 struct nvbios_pll info;
41 int N1, M1, N2, M2, P;
42 int ret;
43
44 ret = nvbios_pll_parse(bios, type, &info);
45 if (ret) {
46 nv_error(clk, "failed to retrieve pll data, %d\n", ret);
47 return ret;
48 }
49
50 ret = nv04_pll_calc(clk, &info, freq, &N1, &M1, &N2, &M2, &P);
51 if (!ret) {
52 nv_error(clk, "failed pll calculation\n");
53 return ret;
54 }
55
56 switch (info.type) {
57 case PLL_VPLL0:
58 case PLL_VPLL1:
59 nv_wr32(priv, info.reg + 0, 0x10000611);
60 nv_mask(priv, info.reg + 4, 0x00ff00ff, (M1 << 16) | N1);
61 nv_mask(priv, info.reg + 8, 0x7fff00ff, (P << 28) |
62 (M2 << 16) | N2);
63 break;
64 case PLL_MEMORY:
65 nv_mask(priv, info.reg + 0, 0x01ff0000, (P << 22) |
66 (info.bias_p << 19) |
67 (P << 16));
68 nv_wr32(priv, info.reg + 4, (N1 << 8) | M1);
69 break;
70 default:
71 nv_mask(priv, info.reg + 0, 0x00070000, (P << 16));
72 nv_wr32(priv, info.reg + 4, (N1 << 8) | M1);
73 break;
74 }
75
76 return 0;
77}
78
79static int
80nv50_clock_ctor(struct nouveau_object *parent, struct nouveau_object *engine, 36nv50_clock_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
81 struct nouveau_oclass *oclass, void *data, u32 size, 37 struct nouveau_oclass *oclass, void *data, u32 size,
82 struct nouveau_object **pobject) 38 struct nouveau_object **pobject)
@@ -89,7 +45,6 @@ nv50_clock_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
89 if (ret) 45 if (ret)
90 return ret; 46 return ret;
91 47
92 priv->base.pll_set = nv50_clock_pll_set;
93 priv->base.pll_calc = nv04_clock_pll_calc; 48 priv->base.pll_calc = nv04_clock_pll_calc;
94 return 0; 49 return 0;
95} 50}
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/nva3.c b/drivers/gpu/drm/nouveau/core/subdev/clock/nva3.c
index 9068c98b96f6..f074cd20bc9c 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/clock/nva3.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/clock/nva3.c
@@ -32,47 +32,13 @@ struct nva3_clock_priv {
32 struct nouveau_clock base; 32 struct nouveau_clock base;
33}; 33};
34 34
35static int
36nva3_clock_pll_set(struct nouveau_clock *clk, u32 type, u32 freq)
37{
38 struct nva3_clock_priv *priv = (void *)clk;
39 struct nouveau_bios *bios = nouveau_bios(priv);
40 struct nvbios_pll info;
41 int N, fN, M, P;
42 int ret;
43
44 ret = nvbios_pll_parse(bios, type, &info);
45 if (ret)
46 return ret;
47
48 ret = nva3_pll_calc(clk, &info, freq, &N, &fN, &M, &P);
49 if (ret < 0)
50 return ret;
51
52 switch (info.type) {
53 case PLL_VPLL0:
54 case PLL_VPLL1:
55 nv_wr32(priv, info.reg + 0, 0x50000610);
56 nv_mask(priv, info.reg + 4, 0x003fffff,
57 (P << 16) | (M << 8) | N);
58 nv_wr32(priv, info.reg + 8, fN);
59 break;
60 default:
61 nv_warn(priv, "0x%08x/%dKhz unimplemented\n", type, freq);
62 ret = -EINVAL;
63 break;
64 }
65
66 return ret;
67}
68
69int 35int
70nva3_clock_pll_calc(struct nouveau_clock *clock, struct nvbios_pll *info, 36nva3_clock_pll_calc(struct nouveau_clock *clock, struct nvbios_pll *info,
71 int clk, struct nouveau_pll_vals *pv) 37 int clk, struct nouveau_pll_vals *pv)
72{ 38{
73 int ret, N, M, P; 39 int ret, N, M, P;
74 40
75 ret = nva3_pll_calc(clock, info, clk, &N, NULL, &M, &P); 41 ret = nva3_pll_calc(nv_subdev(clock), info, clk, &N, NULL, &M, &P);
76 42
77 if (ret > 0) { 43 if (ret > 0) {
78 pv->refclk = info->refclk; 44 pv->refclk = info->refclk;
@@ -97,7 +63,6 @@ nva3_clock_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
97 if (ret) 63 if (ret)
98 return ret; 64 return ret;
99 65
100 priv->base.pll_set = nva3_clock_pll_set;
101 priv->base.pll_calc = nva3_clock_pll_calc; 66 priv->base.pll_calc = nva3_clock_pll_calc;
102 return 0; 67 return 0;
103} 68}
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c b/drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c
index 7c9626258a46..439d81c26130 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c
@@ -33,41 +33,6 @@ struct nvc0_clock_priv {
33}; 33};
34 34
35static int 35static int
36nvc0_clock_pll_set(struct nouveau_clock *clk, u32 type, u32 freq)
37{
38 struct nvc0_clock_priv *priv = (void *)clk;
39 struct nouveau_bios *bios = nouveau_bios(priv);
40 struct nvbios_pll info;
41 int N, fN, M, P;
42 int ret;
43
44 ret = nvbios_pll_parse(bios, type, &info);
45 if (ret)
46 return ret;
47
48 ret = nva3_pll_calc(clk, &info, freq, &N, &fN, &M, &P);
49 if (ret < 0)
50 return ret;
51
52 switch (info.type) {
53 case PLL_VPLL0:
54 case PLL_VPLL1:
55 case PLL_VPLL2:
56 case PLL_VPLL3:
57 nv_mask(priv, info.reg + 0x0c, 0x00000000, 0x00000100);
58 nv_wr32(priv, info.reg + 0x04, (P << 16) | (N << 8) | M);
59 nv_wr32(priv, info.reg + 0x10, fN << 16);
60 break;
61 default:
62 nv_warn(priv, "0x%08x/%dKhz unimplemented\n", type, freq);
63 ret = -EINVAL;
64 break;
65 }
66
67 return ret;
68}
69
70static int
71nvc0_clock_ctor(struct nouveau_object *parent, struct nouveau_object *engine, 36nvc0_clock_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
72 struct nouveau_oclass *oclass, void *data, u32 size, 37 struct nouveau_oclass *oclass, void *data, u32 size,
73 struct nouveau_object **pobject) 38 struct nouveau_object **pobject)
@@ -80,7 +45,6 @@ nvc0_clock_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
80 if (ret) 45 if (ret)
81 return ret; 46 return ret;
82 47
83 priv->base.pll_set = nvc0_clock_pll_set;
84 priv->base.pll_calc = nva3_clock_pll_calc; 48 priv->base.pll_calc = nva3_clock_pll_calc;
85 return 0; 49 return 0;
86} 50}
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/pll.h b/drivers/gpu/drm/nouveau/core/subdev/clock/pll.h
index ef2c0078f337..445b14c33a98 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/clock/pll.h
+++ b/drivers/gpu/drm/nouveau/core/subdev/clock/pll.h
@@ -1,9 +1,9 @@
1#ifndef __NOUVEAU_PLL_H__ 1#ifndef __NOUVEAU_PLL_H__
2#define __NOUVEAU_PLL_H__ 2#define __NOUVEAU_PLL_H__
3 3
4int nv04_pll_calc(struct nouveau_clock *, struct nvbios_pll *, u32 freq, 4int nv04_pll_calc(struct nouveau_subdev *, struct nvbios_pll *, u32 freq,
5 int *N1, int *M1, int *N2, int *M2, int *P); 5 int *N1, int *M1, int *N2, int *M2, int *P);
6int nva3_pll_calc(struct nouveau_clock *, struct nvbios_pll *, u32 freq, 6int nva3_pll_calc(struct nouveau_subdev *, struct nvbios_pll *, u32 freq,
7 int *N, int *fN, int *M, int *P); 7 int *N, int *fN, int *M, int *P);
8 8
9#endif 9#endif
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/pllnv04.c b/drivers/gpu/drm/nouveau/core/subdev/clock/pllnv04.c
index a2ab6d051ba8..cf1ed0dc9bc9 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/clock/pllnv04.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/clock/pllnv04.c
@@ -21,14 +21,13 @@
21 * SOFTWARE. 21 * SOFTWARE.
22 */ 22 */
23 23
24#include <subdev/clock.h>
25#include <subdev/bios.h> 24#include <subdev/bios.h>
26#include <subdev/bios/pll.h> 25#include <subdev/bios/pll.h>
27 26
28#include "pll.h" 27#include "pll.h"
29 28
30static int 29static int
31getMNP_single(struct nouveau_clock *clock, struct nvbios_pll *info, int clk, 30getMNP_single(struct nouveau_subdev *subdev, struct nvbios_pll *info, int clk,
32 int *pN, int *pM, int *pP) 31 int *pN, int *pM, int *pP)
33{ 32{
34 /* Find M, N and P for a single stage PLL 33 /* Find M, N and P for a single stage PLL
@@ -39,7 +38,7 @@ getMNP_single(struct nouveau_clock *clock, struct nvbios_pll *info, int clk,
39 * "clk" parameter in kHz 38 * "clk" parameter in kHz
40 * returns calculated clock 39 * returns calculated clock
41 */ 40 */
42 int cv = nouveau_bios(clock)->version.chip; 41 int cv = nouveau_bios(subdev)->version.chip;
43 int minvco = info->vco1.min_freq, maxvco = info->vco1.max_freq; 42 int minvco = info->vco1.min_freq, maxvco = info->vco1.max_freq;
44 int minM = info->vco1.min_m, maxM = info->vco1.max_m; 43 int minM = info->vco1.min_m, maxM = info->vco1.max_m;
45 int minN = info->vco1.min_n, maxN = info->vco1.max_n; 44 int minN = info->vco1.min_n, maxN = info->vco1.max_n;
@@ -124,7 +123,7 @@ getMNP_single(struct nouveau_clock *clock, struct nvbios_pll *info, int clk,
124} 123}
125 124
126static int 125static int
127getMNP_double(struct nouveau_clock *clock, struct nvbios_pll *info, int clk, 126getMNP_double(struct nouveau_subdev *subdev, struct nvbios_pll *info, int clk,
128 int *pN1, int *pM1, int *pN2, int *pM2, int *pP) 127 int *pN1, int *pM1, int *pN2, int *pM2, int *pP)
129{ 128{
130 /* Find M, N and P for a two stage PLL 129 /* Find M, N and P for a two stage PLL
@@ -135,7 +134,7 @@ getMNP_double(struct nouveau_clock *clock, struct nvbios_pll *info, int clk,
135 * "clk" parameter in kHz 134 * "clk" parameter in kHz
136 * returns calculated clock 135 * returns calculated clock
137 */ 136 */
138 int chip_version = nouveau_bios(clock)->version.chip; 137 int chip_version = nouveau_bios(subdev)->version.chip;
139 int minvco1 = info->vco1.min_freq, maxvco1 = info->vco1.max_freq; 138 int minvco1 = info->vco1.min_freq, maxvco1 = info->vco1.max_freq;
140 int minvco2 = info->vco2.min_freq, maxvco2 = info->vco2.max_freq; 139 int minvco2 = info->vco2.min_freq, maxvco2 = info->vco2.max_freq;
141 int minU1 = info->vco1.min_inputfreq, minU2 = info->vco2.min_inputfreq; 140 int minU1 = info->vco1.min_inputfreq, minU2 = info->vco2.min_inputfreq;
@@ -223,20 +222,20 @@ getMNP_double(struct nouveau_clock *clock, struct nvbios_pll *info, int clk,
223} 222}
224 223
225int 224int
226nv04_pll_calc(struct nouveau_clock *clk, struct nvbios_pll *info, u32 freq, 225nv04_pll_calc(struct nouveau_subdev *subdev, struct nvbios_pll *info, u32 freq,
227 int *N1, int *M1, int *N2, int *M2, int *P) 226 int *N1, int *M1, int *N2, int *M2, int *P)
228{ 227{
229 int ret; 228 int ret;
230 229
231 if (!info->vco2.max_freq) { 230 if (!info->vco2.max_freq) {
232 ret = getMNP_single(clk, info, freq, N1, M1, P); 231 ret = getMNP_single(subdev, info, freq, N1, M1, P);
233 *N2 = 1; 232 *N2 = 1;
234 *M2 = 1; 233 *M2 = 1;
235 } else { 234 } else {
236 ret = getMNP_double(clk, info, freq, N1, M1, N2, M2, P); 235 ret = getMNP_double(subdev, info, freq, N1, M1, N2, M2, P);
237 } 236 }
238 237
239 if (!ret) 238 if (!ret)
240 nv_error(clk, "unable to compute acceptable pll values\n"); 239 nv_error(subdev, "unable to compute acceptable pll values\n");
241 return ret; 240 return ret;
242} 241}
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/pllnva3.c b/drivers/gpu/drm/nouveau/core/subdev/clock/pllnva3.c
index eed5c16cf610..2fe1f712eefa 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/clock/pllnva3.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/clock/pllnva3.c
@@ -29,7 +29,7 @@
29#include "pll.h" 29#include "pll.h"
30 30
31int 31int
32nva3_pll_calc(struct nouveau_clock *clock, struct nvbios_pll *info, 32nva3_pll_calc(struct nouveau_subdev *subdev, struct nvbios_pll *info,
33 u32 freq, int *pN, int *pfN, int *pM, int *P) 33 u32 freq, int *pN, int *pfN, int *pM, int *P)
34{ 34{
35 u32 best_err = ~0, err; 35 u32 best_err = ~0, err;
@@ -50,8 +50,15 @@ nva3_pll_calc(struct nouveau_clock *clock, struct nvbios_pll *info,
50 u32 tmp = freq * *P * M; 50 u32 tmp = freq * *P * M;
51 N = tmp / info->refclk; 51 N = tmp / info->refclk;
52 fN = tmp % info->refclk; 52 fN = tmp % info->refclk;
53 if (!pfN && fN >= info->refclk / 2) 53
54 N++; 54 if (!pfN) {
55 if (fN >= info->refclk / 2)
56 N++;
57 } else {
58 if (fN < info->refclk / 2)
59 N--;
60 fN = tmp - (N * info->refclk);
61 }
55 62
56 if (N < info->vco1.min_n) 63 if (N < info->vco1.min_n)
57 continue; 64 continue;
@@ -66,13 +73,14 @@ nva3_pll_calc(struct nouveau_clock *clock, struct nvbios_pll *info,
66 } 73 }
67 74
68 if (pfN) { 75 if (pfN) {
69 *pfN = (((fN << 13) / info->refclk) - 4096) & 0xffff; 76 *pfN = ((fN << 13) + info->refclk / 2) / info->refclk;
77 *pfN = (*pfN - 4096) & 0xffff;
70 return freq; 78 return freq;
71 } 79 }
72 } 80 }
73 81
74 if (unlikely(best_err == ~0)) { 82 if (unlikely(best_err == ~0)) {
75 nv_error(clock, "unable to find matching pll values\n"); 83 nv_error(subdev, "unable to find matching pll values\n");
76 return -EINVAL; 84 return -EINVAL;
77 } 85 }
78 86
diff --git a/drivers/gpu/drm/nouveau/core/subdev/devinit/base.c b/drivers/gpu/drm/nouveau/core/subdev/devinit/base.c
index 5a07a39c1735..79c81d3d9bac 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/devinit/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/devinit/base.c
@@ -29,18 +29,10 @@
29#include <subdev/bios/init.h> 29#include <subdev/bios/init.h>
30 30
31int 31int
32nouveau_devinit_init(struct nouveau_devinit *devinit) 32_nouveau_devinit_fini(struct nouveau_object *object, bool suspend)
33{ 33{
34 int ret = nouveau_subdev_init(&devinit->base); 34 struct nouveau_devinit *devinit = (void *)object;
35 if (ret)
36 return ret;
37 35
38 return nvbios_init(&devinit->base, devinit->post);
39}
40
41int
42nouveau_devinit_fini(struct nouveau_devinit *devinit, bool suspend)
43{
44 /* force full reinit on resume */ 36 /* force full reinit on resume */
45 if (suspend) 37 if (suspend)
46 devinit->post = true; 38 devinit->post = true;
@@ -49,6 +41,17 @@ nouveau_devinit_fini(struct nouveau_devinit *devinit, bool suspend)
49} 41}
50 42
51int 43int
44_nouveau_devinit_init(struct nouveau_object *object)
45{
46 struct nouveau_devinit *devinit = (void *)object;
47 int ret = nouveau_subdev_init(&devinit->base);
48 if (ret)
49 return ret;
50
51 return nvbios_init(&devinit->base, devinit->post);
52}
53
54int
52nouveau_devinit_create_(struct nouveau_object *parent, 55nouveau_devinit_create_(struct nouveau_object *parent,
53 struct nouveau_object *engine, 56 struct nouveau_object *engine,
54 struct nouveau_oclass *oclass, 57 struct nouveau_oclass *oclass,
diff --git a/drivers/gpu/drm/nouveau/core/subdev/devinit/nv04.c b/drivers/gpu/drm/nouveau/core/subdev/devinit/nv04.c
index 7a72d9394340..b22357d9b821 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/devinit/nv04.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/devinit/nv04.c
@@ -24,10 +24,10 @@
24 * 24 *
25 */ 25 */
26 26
27#include <subdev/devinit.h>
28#include <subdev/vga.h> 27#include <subdev/vga.h>
29 28
30#include "fbmem.h" 29#include "fbmem.h"
30#include "priv.h"
31 31
32struct nv04_devinit_priv { 32struct nv04_devinit_priv {
33 struct nouveau_devinit base; 33 struct nouveau_devinit base;
@@ -111,33 +111,298 @@ nv04_devinit_meminit(struct nouveau_devinit *devinit)
111} 111}
112 112
113static int 113static int
114nv04_devinit_ctor(struct nouveau_object *parent, struct nouveau_object *engine, 114powerctrl_1_shift(int chip_version, int reg)
115 struct nouveau_oclass *oclass, void *data, u32 size,
116 struct nouveau_object **pobject)
117{ 115{
118 struct nv04_devinit_priv *priv; 116 int shift = -4;
117
118 if (chip_version < 0x17 || chip_version == 0x1a || chip_version == 0x20)
119 return shift;
120
121 switch (reg) {
122 case 0x680520:
123 shift += 4;
124 case 0x680508:
125 shift += 4;
126 case 0x680504:
127 shift += 4;
128 case 0x680500:
129 shift += 4;
130 }
131
132 /*
133 * the shift for vpll regs is only used for nv3x chips with a single
134 * stage pll
135 */
136 if (shift > 4 && (chip_version < 0x32 || chip_version == 0x35 ||
137 chip_version == 0x36 || chip_version >= 0x40))
138 shift = -4;
139
140 return shift;
141}
142
143void
144setPLL_single(struct nouveau_devinit *devinit, u32 reg,
145 struct nouveau_pll_vals *pv)
146{
147 int chip_version = nouveau_bios(devinit)->version.chip;
148 uint32_t oldpll = nv_rd32(devinit, reg);
149 int oldN = (oldpll >> 8) & 0xff, oldM = oldpll & 0xff;
150 uint32_t pll = (oldpll & 0xfff80000) | pv->log2P << 16 | pv->NM1;
151 uint32_t saved_powerctrl_1 = 0;
152 int shift_powerctrl_1 = powerctrl_1_shift(chip_version, reg);
153
154 if (oldpll == pll)
155 return; /* already set */
156
157 if (shift_powerctrl_1 >= 0) {
158 saved_powerctrl_1 = nv_rd32(devinit, 0x001584);
159 nv_wr32(devinit, 0x001584,
160 (saved_powerctrl_1 & ~(0xf << shift_powerctrl_1)) |
161 1 << shift_powerctrl_1);
162 }
163
164 if (oldM && pv->M1 && (oldN / oldM < pv->N1 / pv->M1))
165 /* upclock -- write new post divider first */
166 nv_wr32(devinit, reg, pv->log2P << 16 | (oldpll & 0xffff));
167 else
168 /* downclock -- write new NM first */
169 nv_wr32(devinit, reg, (oldpll & 0xffff0000) | pv->NM1);
170
171 if (chip_version < 0x17 && chip_version != 0x11)
172 /* wait a bit on older chips */
173 msleep(64);
174 nv_rd32(devinit, reg);
175
176 /* then write the other half as well */
177 nv_wr32(devinit, reg, pll);
178
179 if (shift_powerctrl_1 >= 0)
180 nv_wr32(devinit, 0x001584, saved_powerctrl_1);
181}
182
183static uint32_t
184new_ramdac580(uint32_t reg1, bool ss, uint32_t ramdac580)
185{
186 bool head_a = (reg1 == 0x680508);
187
188 if (ss) /* single stage pll mode */
189 ramdac580 |= head_a ? 0x00000100 : 0x10000000;
190 else
191 ramdac580 &= head_a ? 0xfffffeff : 0xefffffff;
192
193 return ramdac580;
194}
195
196void
197setPLL_double_highregs(struct nouveau_devinit *devinit, u32 reg1,
198 struct nouveau_pll_vals *pv)
199{
200 int chip_version = nouveau_bios(devinit)->version.chip;
201 bool nv3035 = chip_version == 0x30 || chip_version == 0x35;
202 uint32_t reg2 = reg1 + ((reg1 == 0x680520) ? 0x5c : 0x70);
203 uint32_t oldpll1 = nv_rd32(devinit, reg1);
204 uint32_t oldpll2 = !nv3035 ? nv_rd32(devinit, reg2) : 0;
205 uint32_t pll1 = (oldpll1 & 0xfff80000) | pv->log2P << 16 | pv->NM1;
206 uint32_t pll2 = (oldpll2 & 0x7fff0000) | 1 << 31 | pv->NM2;
207 uint32_t oldramdac580 = 0, ramdac580 = 0;
208 bool single_stage = !pv->NM2 || pv->N2 == pv->M2; /* nv41+ only */
209 uint32_t saved_powerctrl_1 = 0, savedc040 = 0;
210 int shift_powerctrl_1 = powerctrl_1_shift(chip_version, reg1);
211
212 /* model specific additions to generic pll1 and pll2 set up above */
213 if (nv3035) {
214 pll1 = (pll1 & 0xfcc7ffff) | (pv->N2 & 0x18) << 21 |
215 (pv->N2 & 0x7) << 19 | 8 << 4 | (pv->M2 & 7) << 4;
216 pll2 = 0;
217 }
218 if (chip_version > 0x40 && reg1 >= 0x680508) { /* !nv40 */
219 oldramdac580 = nv_rd32(devinit, 0x680580);
220 ramdac580 = new_ramdac580(reg1, single_stage, oldramdac580);
221 if (oldramdac580 != ramdac580)
222 oldpll1 = ~0; /* force mismatch */
223 if (single_stage)
224 /* magic value used by nvidia in single stage mode */
225 pll2 |= 0x011f;
226 }
227 if (chip_version > 0x70)
228 /* magic bits set by the blob (but not the bios) on g71-73 */
229 pll1 = (pll1 & 0x7fffffff) | (single_stage ? 0x4 : 0xc) << 28;
230
231 if (oldpll1 == pll1 && oldpll2 == pll2)
232 return; /* already set */
233
234 if (shift_powerctrl_1 >= 0) {
235 saved_powerctrl_1 = nv_rd32(devinit, 0x001584);
236 nv_wr32(devinit, 0x001584,
237 (saved_powerctrl_1 & ~(0xf << shift_powerctrl_1)) |
238 1 << shift_powerctrl_1);
239 }
240
241 if (chip_version >= 0x40) {
242 int shift_c040 = 14;
243
244 switch (reg1) {
245 case 0x680504:
246 shift_c040 += 2;
247 case 0x680500:
248 shift_c040 += 2;
249 case 0x680520:
250 shift_c040 += 2;
251 case 0x680508:
252 shift_c040 += 2;
253 }
254
255 savedc040 = nv_rd32(devinit, 0xc040);
256 if (shift_c040 != 14)
257 nv_wr32(devinit, 0xc040, savedc040 & ~(3 << shift_c040));
258 }
259
260 if (oldramdac580 != ramdac580)
261 nv_wr32(devinit, 0x680580, ramdac580);
262
263 if (!nv3035)
264 nv_wr32(devinit, reg2, pll2);
265 nv_wr32(devinit, reg1, pll1);
266
267 if (shift_powerctrl_1 >= 0)
268 nv_wr32(devinit, 0x001584, saved_powerctrl_1);
269 if (chip_version >= 0x40)
270 nv_wr32(devinit, 0xc040, savedc040);
271}
272
273void
274setPLL_double_lowregs(struct nouveau_devinit *devinit, u32 NMNMreg,
275 struct nouveau_pll_vals *pv)
276{
277 /* When setting PLLs, there is a merry game of disabling and enabling
278 * various bits of hardware during the process. This function is a
279 * synthesis of six nv4x traces, nearly each card doing a subtly
280 * different thing. With luck all the necessary bits for each card are
281 * combined herein. Without luck it deviates from each card's formula
282 * so as to not work on any :)
283 */
284
285 uint32_t Preg = NMNMreg - 4;
286 bool mpll = Preg == 0x4020;
287 uint32_t oldPval = nv_rd32(devinit, Preg);
288 uint32_t NMNM = pv->NM2 << 16 | pv->NM1;
289 uint32_t Pval = (oldPval & (mpll ? ~(0x77 << 16) : ~(7 << 16))) |
290 0xc << 28 | pv->log2P << 16;
291 uint32_t saved4600 = 0;
292 /* some cards have different maskc040s */
293 uint32_t maskc040 = ~(3 << 14), savedc040;
294 bool single_stage = !pv->NM2 || pv->N2 == pv->M2;
295
296 if (nv_rd32(devinit, NMNMreg) == NMNM && (oldPval & 0xc0070000) == Pval)
297 return;
298
299 if (Preg == 0x4000)
300 maskc040 = ~0x333;
301 if (Preg == 0x4058)
302 maskc040 = ~(0xc << 24);
303
304 if (mpll) {
305 struct nvbios_pll info;
306 uint8_t Pval2;
307
308 if (nvbios_pll_parse(nouveau_bios(devinit), Preg, &info))
309 return;
310
311 Pval2 = pv->log2P + info.bias_p;
312 if (Pval2 > info.max_p)
313 Pval2 = info.max_p;
314 Pval |= 1 << 28 | Pval2 << 20;
315
316 saved4600 = nv_rd32(devinit, 0x4600);
317 nv_wr32(devinit, 0x4600, saved4600 | 8 << 28);
318 }
319 if (single_stage)
320 Pval |= mpll ? 1 << 12 : 1 << 8;
321
322 nv_wr32(devinit, Preg, oldPval | 1 << 28);
323 nv_wr32(devinit, Preg, Pval & ~(4 << 28));
324 if (mpll) {
325 Pval |= 8 << 20;
326 nv_wr32(devinit, 0x4020, Pval & ~(0xc << 28));
327 nv_wr32(devinit, 0x4038, Pval & ~(0xc << 28));
328 }
329
330 savedc040 = nv_rd32(devinit, 0xc040);
331 nv_wr32(devinit, 0xc040, savedc040 & maskc040);
332
333 nv_wr32(devinit, NMNMreg, NMNM);
334 if (NMNMreg == 0x4024)
335 nv_wr32(devinit, 0x403c, NMNM);
336
337 nv_wr32(devinit, Preg, Pval);
338 if (mpll) {
339 Pval &= ~(8 << 20);
340 nv_wr32(devinit, 0x4020, Pval);
341 nv_wr32(devinit, 0x4038, Pval);
342 nv_wr32(devinit, 0x4600, saved4600);
343 }
344
345 nv_wr32(devinit, 0xc040, savedc040);
346
347 if (mpll) {
348 nv_wr32(devinit, 0x4020, Pval & ~(1 << 28));
349 nv_wr32(devinit, 0x4038, Pval & ~(1 << 28));
350 }
351}
352
353int
354nv04_devinit_pll_set(struct nouveau_devinit *devinit, u32 type, u32 freq)
355{
356 struct nouveau_bios *bios = nouveau_bios(devinit);
357 struct nouveau_pll_vals pv;
358 struct nvbios_pll info;
359 int cv = bios->version.chip;
360 int N1, M1, N2, M2, P;
119 int ret; 361 int ret;
120 362
121 ret = nouveau_devinit_create(parent, engine, oclass, &priv); 363 ret = nvbios_pll_parse(bios, type > 0x405c ? type : type - 4, &info);
122 *pobject = nv_object(priv);
123 if (ret) 364 if (ret)
124 return ret; 365 return ret;
125 366
126 priv->base.meminit = nv04_devinit_meminit; 367 ret = nv04_pll_calc(nv_subdev(devinit), &info, freq,
127 priv->owner = -1; 368 &N1, &M1, &N2, &M2, &P);
369 if (!ret)
370 return -EINVAL;
371
372 pv.refclk = info.refclk;
373 pv.N1 = N1;
374 pv.M1 = M1;
375 pv.N2 = N2;
376 pv.M2 = M2;
377 pv.log2P = P;
378
379 if (cv == 0x30 || cv == 0x31 || cv == 0x35 || cv == 0x36 ||
380 cv >= 0x40) {
381 if (type > 0x405c)
382 setPLL_double_highregs(devinit, type, &pv);
383 else
384 setPLL_double_lowregs(devinit, type, &pv);
385 } else
386 setPLL_single(devinit, type, &pv);
387
128 return 0; 388 return 0;
129} 389}
130 390
131void 391int
132nv04_devinit_dtor(struct nouveau_object *object) 392nv04_devinit_fini(struct nouveau_object *object, bool suspend)
133{ 393{
134 struct nv04_devinit_priv *priv = (void *)object; 394 struct nv04_devinit_priv *priv = (void *)object;
135 395
136 /* restore vga owner saved at first init, and lock crtc regs */ 396 /* make i2c busses accessible */
137 nv_wrvgaowner(priv, priv->owner); 397 nv_mask(priv, 0x000200, 0x00000001, 0x00000001);
138 nv_lockvgac(priv, true);
139 398
140 nouveau_devinit_destroy(&priv->base); 399 /* unlock extended vga crtc regs, and unslave crtcs */
400 nv_lockvgac(priv, false);
401 if (priv->owner < 0)
402 priv->owner = nv_rdvgaowner(priv);
403 nv_wrvgaowner(priv, 0);
404
405 return nouveau_devinit_fini(&priv->base, suspend);
141} 406}
142 407
143int 408int
@@ -160,21 +425,35 @@ nv04_devinit_init(struct nouveau_object *object)
160 return nouveau_devinit_init(&priv->base); 425 return nouveau_devinit_init(&priv->base);
161} 426}
162 427
163int 428void
164nv04_devinit_fini(struct nouveau_object *object, bool suspend) 429nv04_devinit_dtor(struct nouveau_object *object)
165{ 430{
166 struct nv04_devinit_priv *priv = (void *)object; 431 struct nv04_devinit_priv *priv = (void *)object;
167 432
168 /* make i2c busses accessible */ 433 /* restore vga owner saved at first init, and lock crtc regs */
169 nv_mask(priv, 0x000200, 0x00000001, 0x00000001); 434 nv_wrvgaowner(priv, priv->owner);
435 nv_lockvgac(priv, true);
170 436
171 /* unlock extended vga crtc regs, and unslave crtcs */ 437 nouveau_devinit_destroy(&priv->base);
172 nv_lockvgac(priv, false); 438}
173 if (priv->owner < 0)
174 priv->owner = nv_rdvgaowner(priv);
175 nv_wrvgaowner(priv, 0);
176 439
177 return nouveau_devinit_fini(&priv->base, suspend); 440static int
441nv04_devinit_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
442 struct nouveau_oclass *oclass, void *data, u32 size,
443 struct nouveau_object **pobject)
444{
445 struct nv04_devinit_priv *priv;
446 int ret;
447
448 ret = nouveau_devinit_create(parent, engine, oclass, &priv);
449 *pobject = nv_object(priv);
450 if (ret)
451 return ret;
452
453 priv->base.meminit = nv04_devinit_meminit;
454 priv->base.pll_set = nv04_devinit_pll_set;
455 priv->owner = -1;
456 return 0;
178} 457}
179 458
180struct nouveau_oclass 459struct nouveau_oclass
diff --git a/drivers/gpu/drm/nouveau/core/subdev/devinit/nv05.c b/drivers/gpu/drm/nouveau/core/subdev/devinit/nv05.c
index 191447d0d252..b1912a8a8942 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/devinit/nv05.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/devinit/nv05.c
@@ -24,12 +24,12 @@
24 * 24 *
25 */ 25 */
26 26
27#include <subdev/devinit.h>
28#include <subdev/bios.h> 27#include <subdev/bios.h>
29#include <subdev/bios/bmp.h> 28#include <subdev/bios/bmp.h>
30#include <subdev/vga.h> 29#include <subdev/vga.h>
31 30
32#include "fbmem.h" 31#include "fbmem.h"
32#include "priv.h"
33 33
34struct nv05_devinit_priv { 34struct nv05_devinit_priv {
35 struct nouveau_devinit base; 35 struct nouveau_devinit base;
@@ -144,6 +144,7 @@ nv05_devinit_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
144 return ret; 144 return ret;
145 145
146 priv->base.meminit = nv05_devinit_meminit; 146 priv->base.meminit = nv05_devinit_meminit;
147 priv->base.pll_set = nv04_devinit_pll_set;
147 return 0; 148 return 0;
148} 149}
149 150
diff --git a/drivers/gpu/drm/nouveau/core/subdev/devinit/nv10.c b/drivers/gpu/drm/nouveau/core/subdev/devinit/nv10.c
index eb76ffab6b0c..463b08fa0968 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/devinit/nv10.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/devinit/nv10.c
@@ -24,10 +24,10 @@
24 * 24 *
25 */ 25 */
26 26
27#include <subdev/devinit.h>
28#include <subdev/vga.h> 27#include <subdev/vga.h>
29 28
30#include "fbmem.h" 29#include "fbmem.h"
30#include "priv.h"
31 31
32struct nv10_devinit_priv { 32struct nv10_devinit_priv {
33 struct nouveau_devinit base; 33 struct nouveau_devinit base;
@@ -109,6 +109,7 @@ nv10_devinit_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
109 return ret; 109 return ret;
110 110
111 priv->base.meminit = nv10_devinit_meminit; 111 priv->base.meminit = nv10_devinit_meminit;
112 priv->base.pll_set = nv04_devinit_pll_set;
112 return 0; 113 return 0;
113} 114}
114 115
diff --git a/drivers/gpu/drm/nouveau/core/subdev/devinit/nv1a.c b/drivers/gpu/drm/nouveau/core/subdev/devinit/nv1a.c
index 5b2ba630d913..e9743cdabe75 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/devinit/nv1a.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/devinit/nv1a.c
@@ -22,8 +22,7 @@
22 * Authors: Ben Skeggs 22 * Authors: Ben Skeggs
23 */ 23 */
24 24
25#include <subdev/devinit.h> 25#include "priv.h"
26#include <subdev/vga.h>
27 26
28struct nv1a_devinit_priv { 27struct nv1a_devinit_priv {
29 struct nouveau_devinit base; 28 struct nouveau_devinit base;
@@ -43,6 +42,7 @@ nv1a_devinit_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
43 if (ret) 42 if (ret)
44 return ret; 43 return ret;
45 44
45 priv->base.pll_set = nv04_devinit_pll_set;
46 return 0; 46 return 0;
47} 47}
48 48
diff --git a/drivers/gpu/drm/nouveau/core/subdev/devinit/nv20.c b/drivers/gpu/drm/nouveau/core/subdev/devinit/nv20.c
index eb32e99005e4..6cc6080d3bc0 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/devinit/nv20.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/devinit/nv20.c
@@ -24,9 +24,7 @@
24 * 24 *
25 */ 25 */
26 26
27#include <subdev/devinit.h> 27#include "priv.h"
28#include <subdev/vga.h>
29
30#include "fbmem.h" 28#include "fbmem.h"
31 29
32struct nv20_devinit_priv { 30struct nv20_devinit_priv {
@@ -81,6 +79,7 @@ nv20_devinit_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
81 return ret; 79 return ret;
82 80
83 priv->base.meminit = nv20_devinit_meminit; 81 priv->base.meminit = nv20_devinit_meminit;
82 priv->base.pll_set = nv04_devinit_pll_set;
84 return 0; 83 return 0;
85} 84}
86 85
diff --git a/drivers/gpu/drm/nouveau/core/subdev/devinit/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/devinit/nv50.c
index 4a8577838417..6df72247c477 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/devinit/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/devinit/nv50.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright 2012 Red Hat Inc. 2 * Copyright 2013 Red Hat Inc.
3 * 3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"), 5 * copy of this software and associated documentation files (the "Software"),
@@ -26,37 +26,55 @@
26#include <subdev/bios/dcb.h> 26#include <subdev/bios/dcb.h>
27#include <subdev/bios/disp.h> 27#include <subdev/bios/disp.h>
28#include <subdev/bios/init.h> 28#include <subdev/bios/init.h>
29#include <subdev/devinit.h>
30#include <subdev/vga.h> 29#include <subdev/vga.h>
31 30
32struct nv50_devinit_priv { 31#include "priv.h"
33 struct nouveau_devinit base;
34};
35 32
36static int 33static int
37nv50_devinit_ctor(struct nouveau_object *parent, struct nouveau_object *engine, 34nv50_devinit_pll_set(struct nouveau_devinit *devinit, u32 type, u32 freq)
38 struct nouveau_oclass *oclass, void *data, u32 size,
39 struct nouveau_object **pobject)
40{ 35{
41 struct nv50_devinit_priv *priv; 36 struct nv50_devinit_priv *priv = (void *)devinit;
37 struct nouveau_bios *bios = nouveau_bios(priv);
38 struct nvbios_pll info;
39 int N1, M1, N2, M2, P;
42 int ret; 40 int ret;
43 41
44 ret = nouveau_devinit_create(parent, engine, oclass, &priv); 42 ret = nvbios_pll_parse(bios, type, &info);
45 *pobject = nv_object(priv); 43 if (ret) {
46 if (ret) 44 nv_error(devinit, "failed to retrieve pll data, %d\n", ret);
47 return ret; 45 return ret;
46 }
48 47
49 return 0; 48 ret = nv04_pll_calc(nv_subdev(devinit), &info, freq, &N1, &M1, &N2, &M2, &P);
50} 49 if (!ret) {
50 nv_error(devinit, "failed pll calculation\n");
51 return ret;
52 }
51 53
52static void 54 switch (info.type) {
53nv50_devinit_dtor(struct nouveau_object *object) 55 case PLL_VPLL0:
54{ 56 case PLL_VPLL1:
55 struct nv50_devinit_priv *priv = (void *)object; 57 nv_wr32(priv, info.reg + 0, 0x10000611);
56 nouveau_devinit_destroy(&priv->base); 58 nv_mask(priv, info.reg + 4, 0x00ff00ff, (M1 << 16) | N1);
59 nv_mask(priv, info.reg + 8, 0x7fff00ff, (P << 28) |
60 (M2 << 16) | N2);
61 break;
62 case PLL_MEMORY:
63 nv_mask(priv, info.reg + 0, 0x01ff0000, (P << 22) |
64 (info.bias_p << 19) |
65 (P << 16));
66 nv_wr32(priv, info.reg + 4, (N1 << 8) | M1);
67 break;
68 default:
69 nv_mask(priv, info.reg + 0, 0x00070000, (P << 16));
70 nv_wr32(priv, info.reg + 4, (N1 << 8) | M1);
71 break;
72 }
73
74 return 0;
57} 75}
58 76
59static int 77int
60nv50_devinit_init(struct nouveau_object *object) 78nv50_devinit_init(struct nouveau_object *object)
61{ 79{
62 struct nouveau_bios *bios = nouveau_bios(object); 80 struct nouveau_bios *bios = nouveau_bios(object);
@@ -103,10 +121,20 @@ nv50_devinit_init(struct nouveau_object *object)
103} 121}
104 122
105static int 123static int
106nv50_devinit_fini(struct nouveau_object *object, bool suspend) 124nv50_devinit_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
125 struct nouveau_oclass *oclass, void *data, u32 size,
126 struct nouveau_object **pobject)
107{ 127{
108 struct nv50_devinit_priv *priv = (void *)object; 128 struct nv50_devinit_priv *priv;
109 return nouveau_devinit_fini(&priv->base, suspend); 129 int ret;
130
131 ret = nouveau_devinit_create(parent, engine, oclass, &priv);
132 *pobject = nv_object(priv);
133 if (ret)
134 return ret;
135
136 priv->base.pll_set = nv50_devinit_pll_set;
137 return 0;
110} 138}
111 139
112struct nouveau_oclass 140struct nouveau_oclass
@@ -114,8 +142,8 @@ nv50_devinit_oclass = {
114 .handle = NV_SUBDEV(DEVINIT, 0x50), 142 .handle = NV_SUBDEV(DEVINIT, 0x50),
115 .ofuncs = &(struct nouveau_ofuncs) { 143 .ofuncs = &(struct nouveau_ofuncs) {
116 .ctor = nv50_devinit_ctor, 144 .ctor = nv50_devinit_ctor,
117 .dtor = nv50_devinit_dtor, 145 .dtor = _nouveau_devinit_dtor,
118 .init = nv50_devinit_init, 146 .init = nv50_devinit_init,
119 .fini = nv50_devinit_fini, 147 .fini = _nouveau_devinit_fini,
120 }, 148 },
121}; 149};
diff --git a/drivers/gpu/drm/nouveau/core/subdev/devinit/nva3.c b/drivers/gpu/drm/nouveau/core/subdev/devinit/nva3.c
new file mode 100644
index 000000000000..76a68b290141
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/devinit/nva3.c
@@ -0,0 +1,87 @@
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 "priv.h"
26
27static int
28nva3_devinit_pll_set(struct nouveau_devinit *devinit, u32 type, u32 freq)
29{
30 struct nva3_devinit_priv *priv = (void *)devinit;
31 struct nouveau_bios *bios = nouveau_bios(priv);
32 struct nvbios_pll info;
33 int N, fN, M, P;
34 int ret;
35
36 ret = nvbios_pll_parse(bios, type, &info);
37 if (ret)
38 return ret;
39
40 ret = nva3_pll_calc(nv_subdev(devinit), &info, freq, &N, &fN, &M, &P);
41 if (ret < 0)
42 return ret;
43
44 switch (info.type) {
45 case PLL_VPLL0:
46 case PLL_VPLL1:
47 nv_wr32(priv, info.reg + 0, 0x50000610);
48 nv_mask(priv, info.reg + 4, 0x003fffff,
49 (P << 16) | (M << 8) | N);
50 nv_wr32(priv, info.reg + 8, fN);
51 break;
52 default:
53 nv_warn(priv, "0x%08x/%dKhz unimplemented\n", type, freq);
54 ret = -EINVAL;
55 break;
56 }
57
58 return ret;
59}
60
61static int
62nva3_devinit_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
63 struct nouveau_oclass *oclass, void *data, u32 size,
64 struct nouveau_object **pobject)
65{
66 struct nv50_devinit_priv *priv;
67 int ret;
68
69 ret = nouveau_devinit_create(parent, engine, oclass, &priv);
70 *pobject = nv_object(priv);
71 if (ret)
72 return ret;
73
74 priv->base.pll_set = nva3_devinit_pll_set;
75 return 0;
76}
77
78struct nouveau_oclass
79nva3_devinit_oclass = {
80 .handle = NV_SUBDEV(DEVINIT, 0xa3),
81 .ofuncs = &(struct nouveau_ofuncs) {
82 .ctor = nva3_devinit_ctor,
83 .dtor = _nouveau_devinit_dtor,
84 .init = nv50_devinit_init,
85 .fini = _nouveau_devinit_fini,
86 },
87};
diff --git a/drivers/gpu/drm/nouveau/core/subdev/devinit/nvc0.c b/drivers/gpu/drm/nouveau/core/subdev/devinit/nvc0.c
new file mode 100644
index 000000000000..19e265bf4574
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/devinit/nvc0.c
@@ -0,0 +1,90 @@
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 "priv.h"
26
27static int
28nvc0_devinit_pll_set(struct nouveau_devinit *devinit, u32 type, u32 freq)
29{
30 struct nvc0_devinit_priv *priv = (void *)devinit;
31 struct nouveau_bios *bios = nouveau_bios(priv);
32 struct nvbios_pll info;
33 int N, fN, M, P;
34 int ret;
35
36 ret = nvbios_pll_parse(bios, type, &info);
37 if (ret)
38 return ret;
39
40 ret = nva3_pll_calc(nv_subdev(devinit), &info, freq, &N, &fN, &M, &P);
41 if (ret < 0)
42 return ret;
43
44 switch (info.type) {
45 case PLL_VPLL0:
46 case PLL_VPLL1:
47 case PLL_VPLL2:
48 case PLL_VPLL3:
49 nv_mask(priv, info.reg + 0x0c, 0x00000000, 0x00000100);
50 nv_wr32(priv, info.reg + 0x04, (P << 16) | (N << 8) | M);
51 nv_wr32(priv, info.reg + 0x10, fN << 16);
52 break;
53 default:
54 nv_warn(priv, "0x%08x/%dKhz unimplemented\n", type, freq);
55 ret = -EINVAL;
56 break;
57 }
58
59 return ret;
60}
61
62static int
63nvc0_devinit_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
64 struct nouveau_oclass *oclass, void *data, u32 size,
65 struct nouveau_object **pobject)
66{
67 struct nv50_devinit_priv *priv;
68 int ret;
69
70 ret = nouveau_devinit_create(parent, engine, oclass, &priv);
71 *pobject = nv_object(priv);
72 if (ret)
73 return ret;
74
75 priv->base.pll_set = nvc0_devinit_pll_set;
76 if (nv_rd32(priv, 0x022500) & 0x00000001)
77 priv->base.post = true;
78 return 0;
79}
80
81struct nouveau_oclass
82nvc0_devinit_oclass = {
83 .handle = NV_SUBDEV(DEVINIT, 0xc0),
84 .ofuncs = &(struct nouveau_ofuncs) {
85 .ctor = nvc0_devinit_ctor,
86 .dtor = _nouveau_devinit_dtor,
87 .init = nv50_devinit_init,
88 .fini = _nouveau_devinit_fini,
89 },
90};
diff --git a/drivers/gpu/drm/nouveau/core/subdev/devinit/priv.h b/drivers/gpu/drm/nouveau/core/subdev/devinit/priv.h
new file mode 100644
index 000000000000..7d622e2b0171
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/devinit/priv.h
@@ -0,0 +1,25 @@
1#ifndef __NVKM_DEVINIT_PRIV_H__
2#define __NVKM_DEVINIT_PRIV_H__
3
4#include <subdev/bios.h>
5#include <subdev/bios/pll.h>
6#include <subdev/clock/pll.h>
7#include <subdev/devinit.h>
8
9void nv04_devinit_dtor(struct nouveau_object *);
10int nv04_devinit_init(struct nouveau_object *);
11int nv04_devinit_fini(struct nouveau_object *, bool);
12int nv04_devinit_pll_set(struct nouveau_devinit *, u32, u32);
13
14void setPLL_single(struct nouveau_devinit *, u32, struct nouveau_pll_vals *);
15void setPLL_double_highregs(struct nouveau_devinit *, u32, struct nouveau_pll_vals *);
16void setPLL_double_lowregs(struct nouveau_devinit *, u32, struct nouveau_pll_vals *);
17
18
19struct nv50_devinit_priv {
20 struct nouveau_devinit base;
21};
22
23int nv50_devinit_init(struct nouveau_object *);
24
25#endif
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/base.c b/drivers/gpu/drm/nouveau/core/subdev/fb/base.c
index d62045f454b2..821cd75b86a3 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/base.c
@@ -57,7 +57,57 @@ nouveau_fb_bios_memtype(struct nouveau_bios *bios)
57} 57}
58 58
59int 59int
60nouveau_fb_preinit(struct nouveau_fb *pfb) 60_nouveau_fb_fini(struct nouveau_object *object, bool suspend)
61{
62 struct nouveau_fb *pfb = (void *)object;
63 int ret;
64
65 ret = nv_ofuncs(pfb->ram)->fini(nv_object(pfb->ram), suspend);
66 if (ret && suspend)
67 return ret;
68
69 return nouveau_subdev_fini(&pfb->base, suspend);
70}
71
72int
73_nouveau_fb_init(struct nouveau_object *object)
74{
75 struct nouveau_fb *pfb = (void *)object;
76 int ret, i;
77
78 ret = nouveau_subdev_init(&pfb->base);
79 if (ret)
80 return ret;
81
82 ret = nv_ofuncs(pfb->ram)->init(nv_object(pfb->ram));
83 if (ret)
84 return ret;
85
86 for (i = 0; i < pfb->tile.regions; i++)
87 pfb->tile.prog(pfb, i, &pfb->tile.region[i]);
88
89 return 0;
90}
91
92void
93_nouveau_fb_dtor(struct nouveau_object *object)
94{
95 struct nouveau_fb *pfb = (void *)object;
96 int i;
97
98 for (i = 0; i < pfb->tile.regions; i++)
99 pfb->tile.fini(pfb, i, &pfb->tile.region[i]);
100 nouveau_mm_fini(&pfb->tags);
101 nouveau_mm_fini(&pfb->vram);
102
103 nouveau_object_ref(NULL, (struct nouveau_object **)&pfb->ram);
104 nouveau_subdev_destroy(&pfb->base);
105}
106
107int
108nouveau_fb_create_(struct nouveau_object *parent, struct nouveau_object *engine,
109 struct nouveau_oclass *oclass, struct nouveau_oclass *ramcls,
110 int length, void **pobject)
61{ 111{
62 static const char *name[] = { 112 static const char *name[] = {
63 [NV_MEM_TYPE_UNKNOWN] = "unknown", 113 [NV_MEM_TYPE_UNKNOWN] = "unknown",
@@ -72,69 +122,42 @@ nouveau_fb_preinit(struct nouveau_fb *pfb)
72 [NV_MEM_TYPE_GDDR4 ] = "GDDR4", 122 [NV_MEM_TYPE_GDDR4 ] = "GDDR4",
73 [NV_MEM_TYPE_GDDR5 ] = "GDDR5", 123 [NV_MEM_TYPE_GDDR5 ] = "GDDR5",
74 }; 124 };
75 int ret, tags; 125 struct nouveau_object *ram;
126 struct nouveau_fb *pfb;
127 int ret;
76 128
77 tags = pfb->ram.init(pfb); 129 ret = nouveau_subdev_create_(parent, engine, oclass, 0, "PFB", "fb",
78 if (tags < 0 || !pfb->ram.size) { 130 length, pobject);
131 pfb = *pobject;
132 if (ret)
133 return ret;
134
135 ret = nouveau_object_ctor(nv_object(pfb), nv_object(pfb),
136 ramcls, NULL, 0, &ram);
137 if (ret) {
79 nv_fatal(pfb, "error detecting memory configuration!!\n"); 138 nv_fatal(pfb, "error detecting memory configuration!!\n");
80 return (tags < 0) ? tags : -ERANGE; 139 return ret;
81 } 140 }
82 141
142 atomic_dec(&ram->parent->refcount);
143 atomic_dec(&ram->engine->refcount);
144 pfb->ram = (void *)ram;
145
83 if (!nouveau_mm_initialised(&pfb->vram)) { 146 if (!nouveau_mm_initialised(&pfb->vram)) {
84 ret = nouveau_mm_init(&pfb->vram, 0, pfb->ram.size >> 12, 1); 147 ret = nouveau_mm_init(&pfb->vram, 0, pfb->ram->size >> 12, 1);
85 if (ret) 148 if (ret)
86 return ret; 149 return ret;
87 } 150 }
88 151
89 if (!nouveau_mm_initialised(&pfb->tags)) { 152 if (!nouveau_mm_initialised(&pfb->tags)) {
90 ret = nouveau_mm_init(&pfb->tags, 0, tags ? ++tags : 0, 1); 153 ret = nouveau_mm_init(&pfb->tags, 0, pfb->ram->tags ?
154 ++pfb->ram->tags : 0, 1);
91 if (ret) 155 if (ret)
92 return ret; 156 return ret;
93 } 157 }
94 158
95 nv_info(pfb, "RAM type: %s\n", name[pfb->ram.type]); 159 nv_info(pfb, "RAM type: %s\n", name[pfb->ram->type]);
96 nv_info(pfb, "RAM size: %d MiB\n", (int)(pfb->ram.size >> 20)); 160 nv_info(pfb, "RAM size: %d MiB\n", (int)(pfb->ram->size >> 20));
97 nv_info(pfb, " ZCOMP: %d tags\n", tags); 161 nv_info(pfb, " ZCOMP: %d tags\n", pfb->ram->tags);
98 return 0; 162 return 0;
99} 163}
100
101void
102nouveau_fb_destroy(struct nouveau_fb *pfb)
103{
104 int i;
105
106 for (i = 0; i < pfb->tile.regions; i++)
107 pfb->tile.fini(pfb, i, &pfb->tile.region[i]);
108 nouveau_mm_fini(&pfb->tags);
109 nouveau_mm_fini(&pfb->vram);
110
111 nouveau_subdev_destroy(&pfb->base);
112}
113
114void
115_nouveau_fb_dtor(struct nouveau_object *object)
116{
117 struct nouveau_fb *pfb = (void *)object;
118 nouveau_fb_destroy(pfb);
119}
120int
121nouveau_fb_init(struct nouveau_fb *pfb)
122{
123 int ret, i;
124
125 ret = nouveau_subdev_init(&pfb->base);
126 if (ret)
127 return ret;
128
129 for (i = 0; i < pfb->tile.regions; i++)
130 pfb->tile.prog(pfb, i, &pfb->tile.region[i]);
131
132 return 0;
133}
134
135int
136_nouveau_fb_init(struct nouveau_object *object)
137{
138 struct nouveau_fb *pfb = (void *)object;
139 return nouveau_fb_init(pfb);
140}
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv04.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv04.c
index 6e369f85361e..1f103c7b89fa 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv04.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv04.c
@@ -22,24 +22,8 @@
22 * Authors: Ben Skeggs 22 * Authors: Ben Skeggs
23 */ 23 */
24 24
25#include <subdev/fb.h> 25#include "priv.h"
26 26
27#define NV04_PFB_BOOT_0 0x00100000
28# define NV04_PFB_BOOT_0_RAM_AMOUNT 0x00000003
29# define NV04_PFB_BOOT_0_RAM_AMOUNT_32MB 0x00000000
30# define NV04_PFB_BOOT_0_RAM_AMOUNT_4MB 0x00000001
31# define NV04_PFB_BOOT_0_RAM_AMOUNT_8MB 0x00000002
32# define NV04_PFB_BOOT_0_RAM_AMOUNT_16MB 0x00000003
33# define NV04_PFB_BOOT_0_RAM_WIDTH_128 0x00000004
34# define NV04_PFB_BOOT_0_RAM_TYPE 0x00000028
35# define NV04_PFB_BOOT_0_RAM_TYPE_SGRAM_8MBIT 0x00000000
36# define NV04_PFB_BOOT_0_RAM_TYPE_SGRAM_16MBIT 0x00000008
37# define NV04_PFB_BOOT_0_RAM_TYPE_SGRAM_16MBIT_4BANK 0x00000010
38# define NV04_PFB_BOOT_0_RAM_TYPE_SDRAM_16MBIT 0x00000018
39# define NV04_PFB_BOOT_0_RAM_TYPE_SDRAM_64MBIT 0x00000020
40# define NV04_PFB_BOOT_0_RAM_TYPE_SDRAM_64MBITX16 0x00000028
41# define NV04_PFB_BOOT_0_UMA_ENABLE 0x00000100
42# define NV04_PFB_BOOT_0_UMA_SIZE 0x0000f000
43#define NV04_PFB_CFG0 0x00100200 27#define NV04_PFB_CFG0 0x00100200
44 28
45struct nv04_fb_priv { 29struct nv04_fb_priv {
@@ -56,37 +40,6 @@ nv04_fb_memtype_valid(struct nouveau_fb *pfb, u32 tile_flags)
56} 40}
57 41
58static int 42static int
59nv04_fb_vram_init(struct nouveau_fb *pfb)
60{
61 u32 boot0 = nv_rd32(pfb, NV04_PFB_BOOT_0);
62 if (boot0 & 0x00000100) {
63 pfb->ram.size = ((boot0 >> 12) & 0xf) * 2 + 2;
64 pfb->ram.size *= 1024 * 1024;
65 } else {
66 switch (boot0 & NV04_PFB_BOOT_0_RAM_AMOUNT) {
67 case NV04_PFB_BOOT_0_RAM_AMOUNT_32MB:
68 pfb->ram.size = 32 * 1024 * 1024;
69 break;
70 case NV04_PFB_BOOT_0_RAM_AMOUNT_16MB:
71 pfb->ram.size = 16 * 1024 * 1024;
72 break;
73 case NV04_PFB_BOOT_0_RAM_AMOUNT_8MB:
74 pfb->ram.size = 8 * 1024 * 1024;
75 break;
76 case NV04_PFB_BOOT_0_RAM_AMOUNT_4MB:
77 pfb->ram.size = 4 * 1024 * 1024;
78 break;
79 }
80 }
81
82 if ((boot0 & 0x00000038) <= 0x10)
83 pfb->ram.type = NV_MEM_TYPE_SGRAM;
84 else
85 pfb->ram.type = NV_MEM_TYPE_SDRAM;
86 return 0;
87}
88
89static int
90nv04_fb_init(struct nouveau_object *object) 43nv04_fb_init(struct nouveau_object *object)
91{ 44{
92 struct nv04_fb_priv *priv = (void *)object; 45 struct nv04_fb_priv *priv = (void *)object;
@@ -112,14 +65,13 @@ nv04_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
112 struct nv04_fb_priv *priv; 65 struct nv04_fb_priv *priv;
113 int ret; 66 int ret;
114 67
115 ret = nouveau_fb_create(parent, engine, oclass, &priv); 68 ret = nouveau_fb_create(parent, engine, oclass, &nv04_ram_oclass, &priv);
116 *pobject = nv_object(priv); 69 *pobject = nv_object(priv);
117 if (ret) 70 if (ret)
118 return ret; 71 return ret;
119 72
120 priv->base.memtype_valid = nv04_fb_memtype_valid; 73 priv->base.memtype_valid = nv04_fb_memtype_valid;
121 priv->base.ram.init = nv04_fb_vram_init; 74 return 0;
122 return nouveau_fb_preinit(&priv->base);
123} 75}
124 76
125struct nouveau_oclass 77struct nouveau_oclass
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv10.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv10.c
index edbbe26e858d..be069b5306b6 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv10.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv10.c
@@ -24,25 +24,12 @@
24 * 24 *
25 */ 25 */
26 26
27#include <subdev/fb.h> 27#include "priv.h"
28 28
29struct nv10_fb_priv { 29struct nv10_fb_priv {
30 struct nouveau_fb base; 30 struct nouveau_fb base;
31}; 31};
32 32
33static int
34nv10_fb_vram_init(struct nouveau_fb *pfb)
35{
36 u32 cfg0 = nv_rd32(pfb, 0x100200);
37 if (cfg0 & 0x00000001)
38 pfb->ram.type = NV_MEM_TYPE_DDR1;
39 else
40 pfb->ram.type = NV_MEM_TYPE_SDRAM;
41
42 pfb->ram.size = nv_rd32(pfb, 0x10020c) & 0xff000000;
43 return 0;
44}
45
46void 33void
47nv10_fb_tile_init(struct nouveau_fb *pfb, int i, u32 addr, u32 size, u32 pitch, 34nv10_fb_tile_init(struct nouveau_fb *pfb, int i, u32 addr, u32 size, u32 pitch,
48 u32 flags, struct nouveau_fb_tile *tile) 35 u32 flags, struct nouveau_fb_tile *tile)
@@ -78,18 +65,17 @@ nv10_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
78 struct nv10_fb_priv *priv; 65 struct nv10_fb_priv *priv;
79 int ret; 66 int ret;
80 67
81 ret = nouveau_fb_create(parent, engine, oclass, &priv); 68 ret = nouveau_fb_create(parent, engine, oclass, &nv10_ram_oclass, &priv);
82 *pobject = nv_object(priv); 69 *pobject = nv_object(priv);
83 if (ret) 70 if (ret)
84 return ret; 71 return ret;
85 72
86 priv->base.memtype_valid = nv04_fb_memtype_valid; 73 priv->base.memtype_valid = nv04_fb_memtype_valid;
87 priv->base.ram.init = nv10_fb_vram_init;
88 priv->base.tile.regions = 8; 74 priv->base.tile.regions = 8;
89 priv->base.tile.init = nv10_fb_tile_init; 75 priv->base.tile.init = nv10_fb_tile_init;
90 priv->base.tile.fini = nv10_fb_tile_fini; 76 priv->base.tile.fini = nv10_fb_tile_fini;
91 priv->base.tile.prog = nv10_fb_tile_prog; 77 priv->base.tile.prog = nv10_fb_tile_prog;
92 return nouveau_fb_preinit(&priv->base); 78 return 0;
93} 79}
94 80
95struct nouveau_oclass 81struct nouveau_oclass
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv1a.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv1a.c
index 48366841db4a..57a2af0079b3 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv1a.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv1a.c
@@ -24,38 +24,13 @@
24 * 24 *
25 */ 25 */
26 26
27#include <subdev/fb.h> 27#include "priv.h"
28 28
29struct nv1a_fb_priv { 29struct nv1a_fb_priv {
30 struct nouveau_fb base; 30 struct nouveau_fb base;
31}; 31};
32 32
33static int 33static int
34nv1a_fb_vram_init(struct nouveau_fb *pfb)
35{
36 struct pci_dev *bridge;
37 u32 mem, mib;
38
39 bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 1));
40 if (!bridge) {
41 nv_fatal(pfb, "no bridge device\n");
42 return -ENODEV;
43 }
44
45 if (nv_device(pfb)->chipset == 0x1a) {
46 pci_read_config_dword(bridge, 0x7c, &mem);
47 mib = ((mem >> 6) & 31) + 1;
48 } else {
49 pci_read_config_dword(bridge, 0x84, &mem);
50 mib = ((mem >> 4) & 127) + 1;
51 }
52
53 pfb->ram.type = NV_MEM_TYPE_STOLEN;
54 pfb->ram.size = mib * 1024 * 1024;
55 return 0;
56}
57
58static int
59nv1a_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, 34nv1a_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
60 struct nouveau_oclass *oclass, void *data, u32 size, 35 struct nouveau_oclass *oclass, void *data, u32 size,
61 struct nouveau_object **pobject) 36 struct nouveau_object **pobject)
@@ -63,18 +38,17 @@ nv1a_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
63 struct nv1a_fb_priv *priv; 38 struct nv1a_fb_priv *priv;
64 int ret; 39 int ret;
65 40
66 ret = nouveau_fb_create(parent, engine, oclass, &priv); 41 ret = nouveau_fb_create(parent, engine, oclass, &nv1a_ram_oclass, &priv);
67 *pobject = nv_object(priv); 42 *pobject = nv_object(priv);
68 if (ret) 43 if (ret)
69 return ret; 44 return ret;
70 45
71 priv->base.memtype_valid = nv04_fb_memtype_valid; 46 priv->base.memtype_valid = nv04_fb_memtype_valid;
72 priv->base.ram.init = nv1a_fb_vram_init;
73 priv->base.tile.regions = 8; 47 priv->base.tile.regions = 8;
74 priv->base.tile.init = nv10_fb_tile_init; 48 priv->base.tile.init = nv10_fb_tile_init;
75 priv->base.tile.fini = nv10_fb_tile_fini; 49 priv->base.tile.fini = nv10_fb_tile_fini;
76 priv->base.tile.prog = nv10_fb_tile_prog; 50 priv->base.tile.prog = nv10_fb_tile_prog;
77 return nouveau_fb_preinit(&priv->base); 51 return 0;
78} 52}
79 53
80struct nouveau_oclass 54struct nouveau_oclass
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv20.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv20.c
index 5d14612a2c8e..b18c4e63bb47 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv20.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv20.c
@@ -24,29 +24,12 @@
24 * 24 *
25 */ 25 */
26 26
27#include <subdev/fb.h> 27#include "priv.h"
28 28
29struct nv20_fb_priv { 29struct nv20_fb_priv {
30 struct nouveau_fb base; 30 struct nouveau_fb base;
31}; 31};
32 32
33int
34nv20_fb_vram_init(struct nouveau_fb *pfb)
35{
36 u32 pbus1218 = nv_rd32(pfb, 0x001218);
37
38 switch (pbus1218 & 0x00000300) {
39 case 0x00000000: pfb->ram.type = NV_MEM_TYPE_SDRAM; break;
40 case 0x00000100: pfb->ram.type = NV_MEM_TYPE_DDR1; break;
41 case 0x00000200: pfb->ram.type = NV_MEM_TYPE_GDDR3; break;
42 case 0x00000300: pfb->ram.type = NV_MEM_TYPE_GDDR2; break;
43 }
44 pfb->ram.size = (nv_rd32(pfb, 0x10020c) & 0xff000000);
45 pfb->ram.parts = (nv_rd32(pfb, 0x100200) & 0x00000003) + 1;
46
47 return nv_rd32(pfb, 0x100320);
48}
49
50void 33void
51nv20_fb_tile_init(struct nouveau_fb *pfb, int i, u32 addr, u32 size, u32 pitch, 34nv20_fb_tile_init(struct nouveau_fb *pfb, int i, u32 addr, u32 size, u32 pitch,
52 u32 flags, struct nouveau_fb_tile *tile) 35 u32 flags, struct nouveau_fb_tile *tile)
@@ -65,7 +48,7 @@ nv20_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
65 struct nouveau_fb_tile *tile) 48 struct nouveau_fb_tile *tile)
66{ 49{
67 u32 tiles = DIV_ROUND_UP(size, 0x40); 50 u32 tiles = DIV_ROUND_UP(size, 0x40);
68 u32 tags = round_up(tiles / pfb->ram.parts, 0x40); 51 u32 tags = round_up(tiles / pfb->ram->parts, 0x40);
69 if (!nouveau_mm_head(&pfb->tags, 1, tags, tags, 1, &tile->tag)) { 52 if (!nouveau_mm_head(&pfb->tags, 1, tags, tags, 1, &tile->tag)) {
70 if (!(flags & 2)) tile->zcomp = 0x00000000; /* Z16 */ 53 if (!(flags & 2)) tile->zcomp = 0x00000000; /* Z16 */
71 else tile->zcomp = 0x04000000; /* Z24S8 */ 54 else tile->zcomp = 0x04000000; /* Z24S8 */
@@ -105,19 +88,18 @@ nv20_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
105 struct nv20_fb_priv *priv; 88 struct nv20_fb_priv *priv;
106 int ret; 89 int ret;
107 90
108 ret = nouveau_fb_create(parent, engine, oclass, &priv); 91 ret = nouveau_fb_create(parent, engine, oclass, &nv20_ram_oclass, &priv);
109 *pobject = nv_object(priv); 92 *pobject = nv_object(priv);
110 if (ret) 93 if (ret)
111 return ret; 94 return ret;
112 95
113 priv->base.memtype_valid = nv04_fb_memtype_valid; 96 priv->base.memtype_valid = nv04_fb_memtype_valid;
114 priv->base.ram.init = nv20_fb_vram_init;
115 priv->base.tile.regions = 8; 97 priv->base.tile.regions = 8;
116 priv->base.tile.init = nv20_fb_tile_init; 98 priv->base.tile.init = nv20_fb_tile_init;
117 priv->base.tile.comp = nv20_fb_tile_comp; 99 priv->base.tile.comp = nv20_fb_tile_comp;
118 priv->base.tile.fini = nv20_fb_tile_fini; 100 priv->base.tile.fini = nv20_fb_tile_fini;
119 priv->base.tile.prog = nv20_fb_tile_prog; 101 priv->base.tile.prog = nv20_fb_tile_prog;
120 return nouveau_fb_preinit(&priv->base); 102 return 0;
121} 103}
122 104
123struct nouveau_oclass 105struct nouveau_oclass
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv25.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv25.c
index 0042ace6bef9..32ccabf10c45 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv25.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv25.c
@@ -24,7 +24,7 @@
24 * 24 *
25 */ 25 */
26 26
27#include <subdev/fb.h> 27#include "priv.h"
28 28
29struct nv25_fb_priv { 29struct nv25_fb_priv {
30 struct nouveau_fb base; 30 struct nouveau_fb base;
@@ -35,7 +35,7 @@ nv25_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
35 struct nouveau_fb_tile *tile) 35 struct nouveau_fb_tile *tile)
36{ 36{
37 u32 tiles = DIV_ROUND_UP(size, 0x40); 37 u32 tiles = DIV_ROUND_UP(size, 0x40);
38 u32 tags = round_up(tiles / pfb->ram.parts, 0x40); 38 u32 tags = round_up(tiles / pfb->ram->parts, 0x40);
39 if (!nouveau_mm_head(&pfb->tags, 1, tags, tags, 1, &tile->tag)) { 39 if (!nouveau_mm_head(&pfb->tags, 1, tags, tags, 1, &tile->tag)) {
40 if (!(flags & 2)) tile->zcomp = 0x00100000; /* Z16 */ 40 if (!(flags & 2)) tile->zcomp = 0x00100000; /* Z16 */
41 else tile->zcomp = 0x00200000; /* Z24S8 */ 41 else tile->zcomp = 0x00200000; /* Z24S8 */
@@ -54,19 +54,18 @@ nv25_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
54 struct nv25_fb_priv *priv; 54 struct nv25_fb_priv *priv;
55 int ret; 55 int ret;
56 56
57 ret = nouveau_fb_create(parent, engine, oclass, &priv); 57 ret = nouveau_fb_create(parent, engine, oclass, &nv20_ram_oclass, &priv);
58 *pobject = nv_object(priv); 58 *pobject = nv_object(priv);
59 if (ret) 59 if (ret)
60 return ret; 60 return ret;
61 61
62 priv->base.memtype_valid = nv04_fb_memtype_valid; 62 priv->base.memtype_valid = nv04_fb_memtype_valid;
63 priv->base.ram.init = nv20_fb_vram_init;
64 priv->base.tile.regions = 8; 63 priv->base.tile.regions = 8;
65 priv->base.tile.init = nv20_fb_tile_init; 64 priv->base.tile.init = nv20_fb_tile_init;
66 priv->base.tile.comp = nv25_fb_tile_comp; 65 priv->base.tile.comp = nv25_fb_tile_comp;
67 priv->base.tile.fini = nv20_fb_tile_fini; 66 priv->base.tile.fini = nv20_fb_tile_fini;
68 priv->base.tile.prog = nv20_fb_tile_prog; 67 priv->base.tile.prog = nv20_fb_tile_prog;
69 return nouveau_fb_preinit(&priv->base); 68 return 0;
70} 69}
71 70
72struct nouveau_oclass 71struct nouveau_oclass
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv30.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv30.c
index a7ba0d048aec..bef756d43d33 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv30.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv30.c
@@ -24,7 +24,7 @@
24 * 24 *
25 */ 25 */
26 26
27#include <subdev/fb.h> 27#include "priv.h"
28 28
29struct nv30_fb_priv { 29struct nv30_fb_priv {
30 struct nouveau_fb base; 30 struct nouveau_fb base;
@@ -54,7 +54,7 @@ nv30_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
54 struct nouveau_fb_tile *tile) 54 struct nouveau_fb_tile *tile)
55{ 55{
56 u32 tiles = DIV_ROUND_UP(size, 0x40); 56 u32 tiles = DIV_ROUND_UP(size, 0x40);
57 u32 tags = round_up(tiles / pfb->ram.parts, 0x40); 57 u32 tags = round_up(tiles / pfb->ram->parts, 0x40);
58 if (!nouveau_mm_head(&pfb->tags, 1, tags, tags, 1, &tile->tag)) { 58 if (!nouveau_mm_head(&pfb->tags, 1, tags, tags, 1, &tile->tag)) {
59 if (flags & 2) tile->zcomp |= 0x01000000; /* Z16 */ 59 if (flags & 2) tile->zcomp |= 0x01000000; /* Z16 */
60 else tile->zcomp |= 0x02000000; /* Z24S8 */ 60 else tile->zcomp |= 0x02000000; /* Z24S8 */
@@ -132,19 +132,18 @@ nv30_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
132 struct nv30_fb_priv *priv; 132 struct nv30_fb_priv *priv;
133 int ret; 133 int ret;
134 134
135 ret = nouveau_fb_create(parent, engine, oclass, &priv); 135 ret = nouveau_fb_create(parent, engine, oclass, &nv20_ram_oclass, &priv);
136 *pobject = nv_object(priv); 136 *pobject = nv_object(priv);
137 if (ret) 137 if (ret)
138 return ret; 138 return ret;
139 139
140 priv->base.memtype_valid = nv04_fb_memtype_valid; 140 priv->base.memtype_valid = nv04_fb_memtype_valid;
141 priv->base.ram.init = nv20_fb_vram_init;
142 priv->base.tile.regions = 8; 141 priv->base.tile.regions = 8;
143 priv->base.tile.init = nv30_fb_tile_init; 142 priv->base.tile.init = nv30_fb_tile_init;
144 priv->base.tile.comp = nv30_fb_tile_comp; 143 priv->base.tile.comp = nv30_fb_tile_comp;
145 priv->base.tile.fini = nv20_fb_tile_fini; 144 priv->base.tile.fini = nv20_fb_tile_fini;
146 priv->base.tile.prog = nv20_fb_tile_prog; 145 priv->base.tile.prog = nv20_fb_tile_prog;
147 return nouveau_fb_preinit(&priv->base); 146 return 0;
148} 147}
149 148
150struct nouveau_oclass 149struct nouveau_oclass
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv35.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv35.c
index 092f6f4f3521..097d8e3824f2 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv35.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv35.c
@@ -24,7 +24,7 @@
24 * 24 *
25 */ 25 */
26 26
27#include <subdev/fb.h> 27#include "priv.h"
28 28
29struct nv35_fb_priv { 29struct nv35_fb_priv {
30 struct nouveau_fb base; 30 struct nouveau_fb base;
@@ -35,7 +35,7 @@ nv35_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
35 struct nouveau_fb_tile *tile) 35 struct nouveau_fb_tile *tile)
36{ 36{
37 u32 tiles = DIV_ROUND_UP(size, 0x40); 37 u32 tiles = DIV_ROUND_UP(size, 0x40);
38 u32 tags = round_up(tiles / pfb->ram.parts, 0x40); 38 u32 tags = round_up(tiles / pfb->ram->parts, 0x40);
39 if (!nouveau_mm_head(&pfb->tags, 1, tags, tags, 1, &tile->tag)) { 39 if (!nouveau_mm_head(&pfb->tags, 1, tags, tags, 1, &tile->tag)) {
40 if (flags & 2) tile->zcomp |= 0x04000000; /* Z16 */ 40 if (flags & 2) tile->zcomp |= 0x04000000; /* Z16 */
41 else tile->zcomp |= 0x08000000; /* Z24S8 */ 41 else tile->zcomp |= 0x08000000; /* Z24S8 */
@@ -55,19 +55,18 @@ nv35_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
55 struct nv35_fb_priv *priv; 55 struct nv35_fb_priv *priv;
56 int ret; 56 int ret;
57 57
58 ret = nouveau_fb_create(parent, engine, oclass, &priv); 58 ret = nouveau_fb_create(parent, engine, oclass, &nv20_ram_oclass, &priv);
59 *pobject = nv_object(priv); 59 *pobject = nv_object(priv);
60 if (ret) 60 if (ret)
61 return ret; 61 return ret;
62 62
63 priv->base.memtype_valid = nv04_fb_memtype_valid; 63 priv->base.memtype_valid = nv04_fb_memtype_valid;
64 priv->base.ram.init = nv20_fb_vram_init;
65 priv->base.tile.regions = 8; 64 priv->base.tile.regions = 8;
66 priv->base.tile.init = nv30_fb_tile_init; 65 priv->base.tile.init = nv30_fb_tile_init;
67 priv->base.tile.comp = nv35_fb_tile_comp; 66 priv->base.tile.comp = nv35_fb_tile_comp;
68 priv->base.tile.fini = nv20_fb_tile_fini; 67 priv->base.tile.fini = nv20_fb_tile_fini;
69 priv->base.tile.prog = nv20_fb_tile_prog; 68 priv->base.tile.prog = nv20_fb_tile_prog;
70 return nouveau_fb_preinit(&priv->base); 69 return 0;
71} 70}
72 71
73struct nouveau_oclass 72struct nouveau_oclass
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv36.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv36.c
index 797ab3b821b9..9d6d9df896d9 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv36.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv36.c
@@ -24,7 +24,7 @@
24 * 24 *
25 */ 25 */
26 26
27#include <subdev/fb.h> 27#include "priv.h"
28 28
29struct nv36_fb_priv { 29struct nv36_fb_priv {
30 struct nouveau_fb base; 30 struct nouveau_fb base;
@@ -35,7 +35,7 @@ nv36_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
35 struct nouveau_fb_tile *tile) 35 struct nouveau_fb_tile *tile)
36{ 36{
37 u32 tiles = DIV_ROUND_UP(size, 0x40); 37 u32 tiles = DIV_ROUND_UP(size, 0x40);
38 u32 tags = round_up(tiles / pfb->ram.parts, 0x40); 38 u32 tags = round_up(tiles / pfb->ram->parts, 0x40);
39 if (!nouveau_mm_head(&pfb->tags, 1, tags, tags, 1, &tile->tag)) { 39 if (!nouveau_mm_head(&pfb->tags, 1, tags, tags, 1, &tile->tag)) {
40 if (flags & 2) tile->zcomp |= 0x10000000; /* Z16 */ 40 if (flags & 2) tile->zcomp |= 0x10000000; /* Z16 */
41 else tile->zcomp |= 0x20000000; /* Z24S8 */ 41 else tile->zcomp |= 0x20000000; /* Z24S8 */
@@ -55,19 +55,18 @@ nv36_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
55 struct nv36_fb_priv *priv; 55 struct nv36_fb_priv *priv;
56 int ret; 56 int ret;
57 57
58 ret = nouveau_fb_create(parent, engine, oclass, &priv); 58 ret = nouveau_fb_create(parent, engine, oclass, &nv20_ram_oclass, &priv);
59 *pobject = nv_object(priv); 59 *pobject = nv_object(priv);
60 if (ret) 60 if (ret)
61 return ret; 61 return ret;
62 62
63 priv->base.memtype_valid = nv04_fb_memtype_valid; 63 priv->base.memtype_valid = nv04_fb_memtype_valid;
64 priv->base.ram.init = nv20_fb_vram_init;
65 priv->base.tile.regions = 8; 64 priv->base.tile.regions = 8;
66 priv->base.tile.init = nv30_fb_tile_init; 65 priv->base.tile.init = nv30_fb_tile_init;
67 priv->base.tile.comp = nv36_fb_tile_comp; 66 priv->base.tile.comp = nv36_fb_tile_comp;
68 priv->base.tile.fini = nv20_fb_tile_fini; 67 priv->base.tile.fini = nv20_fb_tile_fini;
69 priv->base.tile.prog = nv20_fb_tile_prog; 68 priv->base.tile.prog = nv20_fb_tile_prog;
70 return nouveau_fb_preinit(&priv->base); 69 return 0;
71} 70}
72 71
73struct nouveau_oclass 72struct nouveau_oclass
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv40.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv40.c
index 65e131b90f37..33b4393a7829 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv40.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv40.c
@@ -24,34 +24,18 @@
24 * 24 *
25 */ 25 */
26 26
27#include <subdev/fb.h> 27#include "priv.h"
28 28
29struct nv40_fb_priv { 29struct nv40_fb_priv {
30 struct nouveau_fb base; 30 struct nouveau_fb base;
31}; 31};
32 32
33static int
34nv40_fb_vram_init(struct nouveau_fb *pfb)
35{
36 u32 pbus1218 = nv_rd32(pfb, 0x001218);
37 switch (pbus1218 & 0x00000300) {
38 case 0x00000000: pfb->ram.type = NV_MEM_TYPE_SDRAM; break;
39 case 0x00000100: pfb->ram.type = NV_MEM_TYPE_DDR1; break;
40 case 0x00000200: pfb->ram.type = NV_MEM_TYPE_GDDR3; break;
41 case 0x00000300: pfb->ram.type = NV_MEM_TYPE_DDR2; break;
42 }
43
44 pfb->ram.size = nv_rd32(pfb, 0x10020c) & 0xff000000;
45 pfb->ram.parts = (nv_rd32(pfb, 0x100200) & 0x00000003) + 1;
46 return nv_rd32(pfb, 0x100320);
47}
48
49void 33void
50nv40_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags, 34nv40_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
51 struct nouveau_fb_tile *tile) 35 struct nouveau_fb_tile *tile)
52{ 36{
53 u32 tiles = DIV_ROUND_UP(size, 0x80); 37 u32 tiles = DIV_ROUND_UP(size, 0x80);
54 u32 tags = round_up(tiles / pfb->ram.parts, 0x100); 38 u32 tags = round_up(tiles / pfb->ram->parts, 0x100);
55 if ( (flags & 2) && 39 if ( (flags & 2) &&
56 !nouveau_mm_head(&pfb->tags, 1, tags, tags, 1, &tile->tag)) { 40 !nouveau_mm_head(&pfb->tags, 1, tags, tags, 1, &tile->tag)) {
57 tile->zcomp = 0x28000000; /* Z24S8_SPLIT_GRAD */ 41 tile->zcomp = 0x28000000; /* Z24S8_SPLIT_GRAD */
@@ -85,19 +69,18 @@ nv40_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
85 struct nv40_fb_priv *priv; 69 struct nv40_fb_priv *priv;
86 int ret; 70 int ret;
87 71
88 ret = nouveau_fb_create(parent, engine, oclass, &priv); 72 ret = nouveau_fb_create(parent, engine, oclass, &nv40_ram_oclass, &priv);
89 *pobject = nv_object(priv); 73 *pobject = nv_object(priv);
90 if (ret) 74 if (ret)
91 return ret; 75 return ret;
92 76
93 priv->base.memtype_valid = nv04_fb_memtype_valid; 77 priv->base.memtype_valid = nv04_fb_memtype_valid;
94 priv->base.ram.init = nv40_fb_vram_init;
95 priv->base.tile.regions = 8; 78 priv->base.tile.regions = 8;
96 priv->base.tile.init = nv30_fb_tile_init; 79 priv->base.tile.init = nv30_fb_tile_init;
97 priv->base.tile.comp = nv40_fb_tile_comp; 80 priv->base.tile.comp = nv40_fb_tile_comp;
98 priv->base.tile.fini = nv20_fb_tile_fini; 81 priv->base.tile.fini = nv20_fb_tile_fini;
99 priv->base.tile.prog = nv20_fb_tile_prog; 82 priv->base.tile.prog = nv20_fb_tile_prog;
100 return nouveau_fb_preinit(&priv->base); 83 return 0;
101} 84}
102 85
103 86
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv41.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv41.c
index e9e5a08c41a1..02cd83789cd4 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv41.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv41.c
@@ -24,28 +24,12 @@
24 * 24 *
25 */ 25 */
26 26
27#include <subdev/fb.h> 27#include "priv.h"
28 28
29struct nv41_fb_priv { 29struct nv41_fb_priv {
30 struct nouveau_fb base; 30 struct nouveau_fb base;
31}; 31};
32 32
33int
34nv41_fb_vram_init(struct nouveau_fb *pfb)
35{
36 u32 pfb474 = nv_rd32(pfb, 0x100474);
37 if (pfb474 & 0x00000004)
38 pfb->ram.type = NV_MEM_TYPE_GDDR3;
39 if (pfb474 & 0x00000002)
40 pfb->ram.type = NV_MEM_TYPE_DDR2;
41 if (pfb474 & 0x00000001)
42 pfb->ram.type = NV_MEM_TYPE_DDR1;
43
44 pfb->ram.size = nv_rd32(pfb, 0x10020c) & 0xff000000;
45 pfb->ram.parts = (nv_rd32(pfb, 0x100200) & 0x00000003) + 1;
46 return nv_rd32(pfb, 0x100320);
47}
48
49void 33void
50nv41_fb_tile_prog(struct nouveau_fb *pfb, int i, struct nouveau_fb_tile *tile) 34nv41_fb_tile_prog(struct nouveau_fb *pfb, int i, struct nouveau_fb_tile *tile)
51{ 35{
@@ -78,19 +62,18 @@ nv41_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
78 struct nv41_fb_priv *priv; 62 struct nv41_fb_priv *priv;
79 int ret; 63 int ret;
80 64
81 ret = nouveau_fb_create(parent, engine, oclass, &priv); 65 ret = nouveau_fb_create(parent, engine, oclass, &nv41_ram_oclass, &priv);
82 *pobject = nv_object(priv); 66 *pobject = nv_object(priv);
83 if (ret) 67 if (ret)
84 return ret; 68 return ret;
85 69
86 priv->base.memtype_valid = nv04_fb_memtype_valid; 70 priv->base.memtype_valid = nv04_fb_memtype_valid;
87 priv->base.ram.init = nv41_fb_vram_init;
88 priv->base.tile.regions = 12; 71 priv->base.tile.regions = 12;
89 priv->base.tile.init = nv30_fb_tile_init; 72 priv->base.tile.init = nv30_fb_tile_init;
90 priv->base.tile.comp = nv40_fb_tile_comp; 73 priv->base.tile.comp = nv40_fb_tile_comp;
91 priv->base.tile.fini = nv20_fb_tile_fini; 74 priv->base.tile.fini = nv20_fb_tile_fini;
92 priv->base.tile.prog = nv41_fb_tile_prog; 75 priv->base.tile.prog = nv41_fb_tile_prog;
93 return nouveau_fb_preinit(&priv->base); 76 return 0;
94} 77}
95 78
96 79
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv44.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv44.c
index ae89b5006f7a..c5246c29f293 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv44.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv44.c
@@ -24,27 +24,12 @@
24 * 24 *
25 */ 25 */
26 26
27#include <subdev/fb.h> 27#include "priv.h"
28 28
29struct nv44_fb_priv { 29struct nv44_fb_priv {
30 struct nouveau_fb base; 30 struct nouveau_fb base;
31}; 31};
32 32
33int
34nv44_fb_vram_init(struct nouveau_fb *pfb)
35{
36 u32 pfb474 = nv_rd32(pfb, 0x100474);
37 if (pfb474 & 0x00000004)
38 pfb->ram.type = NV_MEM_TYPE_GDDR3;
39 if (pfb474 & 0x00000002)
40 pfb->ram.type = NV_MEM_TYPE_DDR2;
41 if (pfb474 & 0x00000001)
42 pfb->ram.type = NV_MEM_TYPE_DDR1;
43
44 pfb->ram.size = nv_rd32(pfb, 0x10020c) & 0xff000000;
45 return 0;
46}
47
48static void 33static void
49nv44_fb_tile_init(struct nouveau_fb *pfb, int i, u32 addr, u32 size, u32 pitch, 34nv44_fb_tile_init(struct nouveau_fb *pfb, int i, u32 addr, u32 size, u32 pitch,
50 u32 flags, struct nouveau_fb_tile *tile) 35 u32 flags, struct nouveau_fb_tile *tile)
@@ -87,18 +72,17 @@ nv44_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
87 struct nv44_fb_priv *priv; 72 struct nv44_fb_priv *priv;
88 int ret; 73 int ret;
89 74
90 ret = nouveau_fb_create(parent, engine, oclass, &priv); 75 ret = nouveau_fb_create(parent, engine, oclass, &nv44_ram_oclass, &priv);
91 *pobject = nv_object(priv); 76 *pobject = nv_object(priv);
92 if (ret) 77 if (ret)
93 return ret; 78 return ret;
94 79
95 priv->base.memtype_valid = nv04_fb_memtype_valid; 80 priv->base.memtype_valid = nv04_fb_memtype_valid;
96 priv->base.ram.init = nv44_fb_vram_init;
97 priv->base.tile.regions = 12; 81 priv->base.tile.regions = 12;
98 priv->base.tile.init = nv44_fb_tile_init; 82 priv->base.tile.init = nv44_fb_tile_init;
99 priv->base.tile.fini = nv20_fb_tile_fini; 83 priv->base.tile.fini = nv20_fb_tile_fini;
100 priv->base.tile.prog = nv44_fb_tile_prog; 84 priv->base.tile.prog = nv44_fb_tile_prog;
101 return nouveau_fb_preinit(&priv->base); 85 return 0;
102} 86}
103 87
104 88
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv46.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv46.c
index 589b93ea2994..e2b57909bfca 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv46.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv46.c
@@ -24,7 +24,7 @@
24 * 24 *
25 */ 25 */
26 26
27#include <subdev/fb.h> 27#include "priv.h"
28 28
29struct nv46_fb_priv { 29struct nv46_fb_priv {
30 struct nouveau_fb base; 30 struct nouveau_fb base;
@@ -52,18 +52,17 @@ nv46_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
52 struct nv46_fb_priv *priv; 52 struct nv46_fb_priv *priv;
53 int ret; 53 int ret;
54 54
55 ret = nouveau_fb_create(parent, engine, oclass, &priv); 55 ret = nouveau_fb_create(parent, engine, oclass, &nv44_ram_oclass, &priv);
56 *pobject = nv_object(priv); 56 *pobject = nv_object(priv);
57 if (ret) 57 if (ret)
58 return ret; 58 return ret;
59 59
60 priv->base.memtype_valid = nv04_fb_memtype_valid; 60 priv->base.memtype_valid = nv04_fb_memtype_valid;
61 priv->base.ram.init = nv44_fb_vram_init;
62 priv->base.tile.regions = 15; 61 priv->base.tile.regions = 15;
63 priv->base.tile.init = nv46_fb_tile_init; 62 priv->base.tile.init = nv46_fb_tile_init;
64 priv->base.tile.fini = nv20_fb_tile_fini; 63 priv->base.tile.fini = nv20_fb_tile_fini;
65 priv->base.tile.prog = nv44_fb_tile_prog; 64 priv->base.tile.prog = nv44_fb_tile_prog;
66 return nouveau_fb_preinit(&priv->base); 65 return 0;
67} 66}
68 67
69 68
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv47.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv47.c
index 818bba35b368..fe6a2278621d 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv47.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv47.c
@@ -24,7 +24,7 @@
24 * 24 *
25 */ 25 */
26 26
27#include <subdev/fb.h> 27#include "priv.h"
28 28
29struct nv47_fb_priv { 29struct nv47_fb_priv {
30 struct nouveau_fb base; 30 struct nouveau_fb base;
@@ -38,19 +38,18 @@ nv47_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
38 struct nv47_fb_priv *priv; 38 struct nv47_fb_priv *priv;
39 int ret; 39 int ret;
40 40
41 ret = nouveau_fb_create(parent, engine, oclass, &priv); 41 ret = nouveau_fb_create(parent, engine, oclass, &nv41_ram_oclass, &priv);
42 *pobject = nv_object(priv); 42 *pobject = nv_object(priv);
43 if (ret) 43 if (ret)
44 return ret; 44 return ret;
45 45
46 priv->base.memtype_valid = nv04_fb_memtype_valid; 46 priv->base.memtype_valid = nv04_fb_memtype_valid;
47 priv->base.ram.init = nv41_fb_vram_init;
48 priv->base.tile.regions = 15; 47 priv->base.tile.regions = 15;
49 priv->base.tile.init = nv30_fb_tile_init; 48 priv->base.tile.init = nv30_fb_tile_init;
50 priv->base.tile.comp = nv40_fb_tile_comp; 49 priv->base.tile.comp = nv40_fb_tile_comp;
51 priv->base.tile.fini = nv20_fb_tile_fini; 50 priv->base.tile.fini = nv20_fb_tile_fini;
52 priv->base.tile.prog = nv41_fb_tile_prog; 51 priv->base.tile.prog = nv41_fb_tile_prog;
53 return nouveau_fb_preinit(&priv->base); 52 return 0;
54} 53}
55 54
56 55
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv49.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv49.c
index 84a31af16ab4..5eca99b8c7e2 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv49.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv49.c
@@ -24,30 +24,13 @@
24 * 24 *
25 */ 25 */
26 26
27#include <subdev/fb.h> 27#include "priv.h"
28 28
29struct nv49_fb_priv { 29struct nv49_fb_priv {
30 struct nouveau_fb base; 30 struct nouveau_fb base;
31}; 31};
32 32
33static int 33static int
34nv49_fb_vram_init(struct nouveau_fb *pfb)
35{
36 u32 pfb914 = nv_rd32(pfb, 0x100914);
37
38 switch (pfb914 & 0x00000003) {
39 case 0x00000000: pfb->ram.type = NV_MEM_TYPE_DDR1; break;
40 case 0x00000001: pfb->ram.type = NV_MEM_TYPE_DDR2; break;
41 case 0x00000002: pfb->ram.type = NV_MEM_TYPE_GDDR3; break;
42 case 0x00000003: break;
43 }
44
45 pfb->ram.size = nv_rd32(pfb, 0x10020c) & 0xff000000;
46 pfb->ram.parts = (nv_rd32(pfb, 0x100200) & 0x00000003) + 1;
47 return nv_rd32(pfb, 0x100320);
48}
49
50static int
51nv49_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, 34nv49_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
52 struct nouveau_oclass *oclass, void *data, u32 size, 35 struct nouveau_oclass *oclass, void *data, u32 size,
53 struct nouveau_object **pobject) 36 struct nouveau_object **pobject)
@@ -55,20 +38,18 @@ nv49_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
55 struct nv49_fb_priv *priv; 38 struct nv49_fb_priv *priv;
56 int ret; 39 int ret;
57 40
58 ret = nouveau_fb_create(parent, engine, oclass, &priv); 41 ret = nouveau_fb_create(parent, engine, oclass, &nv49_ram_oclass, &priv);
59 *pobject = nv_object(priv); 42 *pobject = nv_object(priv);
60 if (ret) 43 if (ret)
61 return ret; 44 return ret;
62 45
63 priv->base.memtype_valid = nv04_fb_memtype_valid; 46 priv->base.memtype_valid = nv04_fb_memtype_valid;
64 priv->base.ram.init = nv49_fb_vram_init;
65 priv->base.tile.regions = 15; 47 priv->base.tile.regions = 15;
66 priv->base.tile.init = nv30_fb_tile_init; 48 priv->base.tile.init = nv30_fb_tile_init;
67 priv->base.tile.comp = nv40_fb_tile_comp; 49 priv->base.tile.comp = nv40_fb_tile_comp;
68 priv->base.tile.fini = nv20_fb_tile_fini; 50 priv->base.tile.fini = nv20_fb_tile_fini;
69 priv->base.tile.prog = nv41_fb_tile_prog; 51 priv->base.tile.prog = nv41_fb_tile_prog;
70 52 return 0;
71 return nouveau_fb_preinit(&priv->base);
72} 53}
73 54
74 55
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv4e.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv4e.c
index 797fd558170b..1190b78a1e91 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv4e.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv4e.c
@@ -24,21 +24,13 @@
24 * 24 *
25 */ 25 */
26 26
27#include <subdev/fb.h> 27#include "priv.h"
28 28
29struct nv4e_fb_priv { 29struct nv4e_fb_priv {
30 struct nouveau_fb base; 30 struct nouveau_fb base;
31}; 31};
32 32
33static int 33static int
34nv4e_fb_vram_init(struct nouveau_fb *pfb)
35{
36 pfb->ram.size = nv_rd32(pfb, 0x10020c) & 0xff000000;
37 pfb->ram.type = NV_MEM_TYPE_STOLEN;
38 return 0;
39}
40
41static int
42nv4e_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, 34nv4e_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
43 struct nouveau_oclass *oclass, void *data, u32 size, 35 struct nouveau_oclass *oclass, void *data, u32 size,
44 struct nouveau_object **pobject) 36 struct nouveau_object **pobject)
@@ -46,18 +38,17 @@ nv4e_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
46 struct nv4e_fb_priv *priv; 38 struct nv4e_fb_priv *priv;
47 int ret; 39 int ret;
48 40
49 ret = nouveau_fb_create(parent, engine, oclass, &priv); 41 ret = nouveau_fb_create(parent, engine, oclass, &nv4e_ram_oclass, &priv);
50 *pobject = nv_object(priv); 42 *pobject = nv_object(priv);
51 if (ret) 43 if (ret)
52 return ret; 44 return ret;
53 45
54 priv->base.memtype_valid = nv04_fb_memtype_valid; 46 priv->base.memtype_valid = nv04_fb_memtype_valid;
55 priv->base.ram.init = nv4e_fb_vram_init;
56 priv->base.tile.regions = 12; 47 priv->base.tile.regions = 12;
57 priv->base.tile.init = nv46_fb_tile_init; 48 priv->base.tile.init = nv46_fb_tile_init;
58 priv->base.tile.fini = nv20_fb_tile_fini; 49 priv->base.tile.fini = nv20_fb_tile_fini;
59 priv->base.tile.prog = nv44_fb_tile_prog; 50 priv->base.tile.prog = nv44_fb_tile_prog;
60 return nouveau_fb_preinit(&priv->base); 51 return 0;
61} 52}
62 53
63struct nouveau_oclass 54struct nouveau_oclass
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c
index 0772ec978165..da614ec5564b 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c
@@ -27,7 +27,7 @@
27#include <core/engctx.h> 27#include <core/engctx.h>
28#include <core/object.h> 28#include <core/object.h>
29 29
30#include <subdev/fb.h> 30#include "priv.h"
31#include <subdev/bios.h> 31#include <subdev/bios.h>
32 32
33struct nv50_fb_priv { 33struct nv50_fb_priv {
@@ -36,7 +36,8 @@ struct nv50_fb_priv {
36 dma_addr_t r100c08; 36 dma_addr_t r100c08;
37}; 37};
38 38
39static int types[0x80] = { 39int
40nv50_fb_memtype[0x80] = {
40 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
41 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 42 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0,
42 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 2, 2, 2, 2, 2, 0, 43 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 2, 2, 2, 2, 2, 0,
@@ -50,192 +51,7 @@ static int types[0x80] = {
50static bool 51static bool
51nv50_fb_memtype_valid(struct nouveau_fb *pfb, u32 memtype) 52nv50_fb_memtype_valid(struct nouveau_fb *pfb, u32 memtype)
52{ 53{
53 return types[(memtype & 0xff00) >> 8] != 0; 54 return nv50_fb_memtype[(memtype & 0xff00) >> 8] != 0;
54}
55
56static u32
57nv50_fb_vram_rblock(struct nouveau_fb *pfb)
58{
59 int i, parts, colbits, rowbitsa, rowbitsb, banks;
60 u64 rowsize, predicted;
61 u32 r0, r4, rt, ru, rblock_size;
62
63 r0 = nv_rd32(pfb, 0x100200);
64 r4 = nv_rd32(pfb, 0x100204);
65 rt = nv_rd32(pfb, 0x100250);
66 ru = nv_rd32(pfb, 0x001540);
67 nv_debug(pfb, "memcfg 0x%08x 0x%08x 0x%08x 0x%08x\n", r0, r4, rt, ru);
68
69 for (i = 0, parts = 0; i < 8; i++) {
70 if (ru & (0x00010000 << i))
71 parts++;
72 }
73
74 colbits = (r4 & 0x0000f000) >> 12;
75 rowbitsa = ((r4 & 0x000f0000) >> 16) + 8;
76 rowbitsb = ((r4 & 0x00f00000) >> 20) + 8;
77 banks = 1 << (((r4 & 0x03000000) >> 24) + 2);
78
79 rowsize = parts * banks * (1 << colbits) * 8;
80 predicted = rowsize << rowbitsa;
81 if (r0 & 0x00000004)
82 predicted += rowsize << rowbitsb;
83
84 if (predicted != pfb->ram.size) {
85 nv_warn(pfb, "memory controller reports %d MiB VRAM\n",
86 (u32)(pfb->ram.size >> 20));
87 }
88
89 rblock_size = rowsize;
90 if (rt & 1)
91 rblock_size *= 3;
92
93 nv_debug(pfb, "rblock %d bytes\n", rblock_size);
94 return rblock_size;
95}
96
97static int
98nv50_fb_vram_init(struct nouveau_fb *pfb)
99{
100 struct nouveau_device *device = nv_device(pfb);
101 struct nouveau_bios *bios = nouveau_bios(device);
102 const u32 rsvd_head = ( 256 * 1024) >> 12; /* vga memory */
103 const u32 rsvd_tail = (1024 * 1024) >> 12; /* vbios etc */
104 u32 size, tags = 0;
105 int ret;
106
107 pfb->ram.size = nv_rd32(pfb, 0x10020c);
108 pfb->ram.size = (pfb->ram.size & 0xffffff00) |
109 ((pfb->ram.size & 0x000000ff) << 32);
110
111 size = (pfb->ram.size >> 12) - rsvd_head - rsvd_tail;
112 switch (device->chipset) {
113 case 0xaa:
114 case 0xac:
115 case 0xaf: /* IGPs, no reordering, no real VRAM */
116 ret = nouveau_mm_init(&pfb->vram, rsvd_head, size, 1);
117 if (ret)
118 return ret;
119
120 pfb->ram.type = NV_MEM_TYPE_STOLEN;
121 pfb->ram.stolen = (u64)nv_rd32(pfb, 0x100e10) << 12;
122 break;
123 default:
124 switch (nv_rd32(pfb, 0x100714) & 0x00000007) {
125 case 0: pfb->ram.type = NV_MEM_TYPE_DDR1; break;
126 case 1:
127 if (nouveau_fb_bios_memtype(bios) == NV_MEM_TYPE_DDR3)
128 pfb->ram.type = NV_MEM_TYPE_DDR3;
129 else
130 pfb->ram.type = NV_MEM_TYPE_DDR2;
131 break;
132 case 2: pfb->ram.type = NV_MEM_TYPE_GDDR3; break;
133 case 3: pfb->ram.type = NV_MEM_TYPE_GDDR4; break;
134 case 4: pfb->ram.type = NV_MEM_TYPE_GDDR5; break;
135 default:
136 break;
137 }
138
139 ret = nouveau_mm_init(&pfb->vram, rsvd_head, size,
140 nv50_fb_vram_rblock(pfb) >> 12);
141 if (ret)
142 return ret;
143
144 pfb->ram.ranks = (nv_rd32(pfb, 0x100200) & 0x4) ? 2 : 1;
145 tags = nv_rd32(pfb, 0x100320);
146 break;
147 }
148
149 return tags;
150}
151
152static int
153nv50_fb_vram_new(struct nouveau_fb *pfb, u64 size, u32 align, u32 ncmin,
154 u32 memtype, struct nouveau_mem **pmem)
155{
156 struct nv50_fb_priv *priv = (void *)pfb;
157 struct nouveau_mm *heap = &priv->base.vram;
158 struct nouveau_mm *tags = &priv->base.tags;
159 struct nouveau_mm_node *r;
160 struct nouveau_mem *mem;
161 int comp = (memtype & 0x300) >> 8;
162 int type = (memtype & 0x07f);
163 int back = (memtype & 0x800);
164 int min, max, ret;
165
166 max = (size >> 12);
167 min = ncmin ? (ncmin >> 12) : max;
168 align >>= 12;
169
170 mem = kzalloc(sizeof(*mem), GFP_KERNEL);
171 if (!mem)
172 return -ENOMEM;
173
174 mutex_lock(&pfb->base.mutex);
175 if (comp) {
176 if (align == 16) {
177 int n = (max >> 4) * comp;
178
179 ret = nouveau_mm_head(tags, 1, n, n, 1, &mem->tag);
180 if (ret)
181 mem->tag = NULL;
182 }
183
184 if (unlikely(!mem->tag))
185 comp = 0;
186 }
187
188 INIT_LIST_HEAD(&mem->regions);
189 mem->memtype = (comp << 7) | type;
190 mem->size = max;
191
192 type = types[type];
193 do {
194 if (back)
195 ret = nouveau_mm_tail(heap, type, max, min, align, &r);
196 else
197 ret = nouveau_mm_head(heap, type, max, min, align, &r);
198 if (ret) {
199 mutex_unlock(&pfb->base.mutex);
200 pfb->ram.put(pfb, &mem);
201 return ret;
202 }
203
204 list_add_tail(&r->rl_entry, &mem->regions);
205 max -= r->length;
206 } while (max);
207 mutex_unlock(&pfb->base.mutex);
208
209 r = list_first_entry(&mem->regions, struct nouveau_mm_node, rl_entry);
210 mem->offset = (u64)r->offset << 12;
211 *pmem = mem;
212 return 0;
213}
214
215void
216nv50_fb_vram_del(struct nouveau_fb *pfb, struct nouveau_mem **pmem)
217{
218 struct nv50_fb_priv *priv = (void *)pfb;
219 struct nouveau_mm_node *this;
220 struct nouveau_mem *mem;
221
222 mem = *pmem;
223 *pmem = NULL;
224 if (unlikely(mem == NULL))
225 return;
226
227 mutex_lock(&pfb->base.mutex);
228 while (!list_empty(&mem->regions)) {
229 this = list_first_entry(&mem->regions, typeof(*this), rl_entry);
230
231 list_del(&this->rl_entry);
232 nouveau_mm_free(&priv->base.vram, &this);
233 }
234
235 nouveau_mm_free(&priv->base.tags, &mem->tag);
236 mutex_unlock(&pfb->base.mutex);
237
238 kfree(mem);
239} 55}
240 56
241static const struct nouveau_enum vm_dispatch_subclients[] = { 57static const struct nouveau_enum vm_dispatch_subclients[] = {
@@ -432,7 +248,7 @@ nv50_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
432 struct nv50_fb_priv *priv; 248 struct nv50_fb_priv *priv;
433 int ret; 249 int ret;
434 250
435 ret = nouveau_fb_create(parent, engine, oclass, &priv); 251 ret = nouveau_fb_create(parent, engine, oclass, &nv50_ram_oclass, &priv);
436 *pobject = nv_object(priv); 252 *pobject = nv_object(priv);
437 if (ret) 253 if (ret)
438 return ret; 254 return ret;
@@ -449,11 +265,8 @@ nv50_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
449 } 265 }
450 266
451 priv->base.memtype_valid = nv50_fb_memtype_valid; 267 priv->base.memtype_valid = nv50_fb_memtype_valid;
452 priv->base.ram.init = nv50_fb_vram_init;
453 priv->base.ram.get = nv50_fb_vram_new;
454 priv->base.ram.put = nv50_fb_vram_del;
455 nv_subdev(priv)->intr = nv50_fb_intr; 268 nv_subdev(priv)->intr = nv50_fb_intr;
456 return nouveau_fb_preinit(&priv->base); 269 return 0;
457} 270}
458 271
459static void 272static void
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c
index 86ad59203c8b..f35d76fd746d 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c
@@ -22,9 +22,7 @@
22 * Authors: Ben Skeggs 22 * Authors: Ben Skeggs
23 */ 23 */
24 24
25#include <subdev/fb.h> 25#include "priv.h"
26#include <subdev/ltcg.h>
27#include <subdev/bios.h>
28 26
29struct nvc0_fb_priv { 27struct nvc0_fb_priv {
30 struct nouveau_fb base; 28 struct nouveau_fb base;
@@ -34,7 +32,6 @@ struct nvc0_fb_priv {
34 32
35extern const u8 nvc0_pte_storage_type_map[256]; 33extern const u8 nvc0_pte_storage_type_map[256];
36 34
37
38static bool 35static bool
39nvc0_fb_memtype_valid(struct nouveau_fb *pfb, u32 tile_flags) 36nvc0_fb_memtype_valid(struct nouveau_fb *pfb, u32 tile_flags)
40{ 37{
@@ -43,137 +40,6 @@ nvc0_fb_memtype_valid(struct nouveau_fb *pfb, u32 tile_flags)
43} 40}
44 41
45static int 42static int
46nvc0_fb_vram_init(struct nouveau_fb *pfb)
47{
48 struct nouveau_bios *bios = nouveau_bios(pfb);
49 const u32 rsvd_head = ( 256 * 1024) >> 12; /* vga memory */
50 const u32 rsvd_tail = (1024 * 1024) >> 12; /* vbios etc */
51 u32 parts = nv_rd32(pfb, 0x022438);
52 u32 pmask = nv_rd32(pfb, 0x022554);
53 u32 bsize = nv_rd32(pfb, 0x10f20c);
54 u32 offset, length;
55 bool uniform = true;
56 int ret, part;
57
58 nv_debug(pfb, "0x100800: 0x%08x\n", nv_rd32(pfb, 0x100800));
59 nv_debug(pfb, "parts 0x%08x mask 0x%08x\n", parts, pmask);
60
61 pfb->ram.type = nouveau_fb_bios_memtype(bios);
62 pfb->ram.ranks = (nv_rd32(pfb, 0x10f200) & 0x00000004) ? 2 : 1;
63
64 /* read amount of vram attached to each memory controller */
65 for (part = 0; part < parts; part++) {
66 if (!(pmask & (1 << part))) {
67 u32 psize = nv_rd32(pfb, 0x11020c + (part * 0x1000));
68 if (psize != bsize) {
69 if (psize < bsize)
70 bsize = psize;
71 uniform = false;
72 }
73
74 nv_debug(pfb, "%d: mem_amount 0x%08x\n", part, psize);
75 pfb->ram.size += (u64)psize << 20;
76 }
77 }
78
79 /* if all controllers have the same amount attached, there's no holes */
80 if (uniform) {
81 offset = rsvd_head;
82 length = (pfb->ram.size >> 12) - rsvd_head - rsvd_tail;
83 return nouveau_mm_init(&pfb->vram, offset, length, 1);
84 }
85
86 /* otherwise, address lowest common amount from 0GiB */
87 ret = nouveau_mm_init(&pfb->vram, rsvd_head, (bsize << 8) * parts, 1);
88 if (ret)
89 return ret;
90
91 /* and the rest starting from (8GiB + common_size) */
92 offset = (0x0200000000ULL >> 12) + (bsize << 8);
93 length = (pfb->ram.size >> 12) - (bsize << 8) - rsvd_tail;
94
95 ret = nouveau_mm_init(&pfb->vram, offset, length, 0);
96 if (ret) {
97 nouveau_mm_fini(&pfb->vram);
98 return ret;
99 }
100
101 return 0;
102}
103
104static int
105nvc0_fb_vram_new(struct nouveau_fb *pfb, u64 size, u32 align, u32 ncmin,
106 u32 memtype, struct nouveau_mem **pmem)
107{
108 struct nouveau_mm *mm = &pfb->vram;
109 struct nouveau_mm_node *r;
110 struct nouveau_mem *mem;
111 int type = (memtype & 0x0ff);
112 int back = (memtype & 0x800);
113 int ret;
114 const bool comp = nvc0_pte_storage_type_map[type] != type;
115
116 size >>= 12;
117 align >>= 12;
118 ncmin >>= 12;
119 if (!ncmin)
120 ncmin = size;
121
122 mem = kzalloc(sizeof(*mem), GFP_KERNEL);
123 if (!mem)
124 return -ENOMEM;
125
126 INIT_LIST_HEAD(&mem->regions);
127 mem->size = size;
128
129 mutex_lock(&pfb->base.mutex);
130 if (comp) {
131 struct nouveau_ltcg *ltcg = nouveau_ltcg(pfb->base.base.parent);
132
133 /* compression only works with lpages */
134 if (align == (1 << (17 - 12))) {
135 int n = size >> 5;
136 ltcg->tags_alloc(ltcg, n, &mem->tag);
137 }
138 if (unlikely(!mem->tag))
139 type = nvc0_pte_storage_type_map[type];
140 }
141 mem->memtype = type;
142
143 do {
144 if (back)
145 ret = nouveau_mm_tail(mm, 1, size, ncmin, align, &r);
146 else
147 ret = nouveau_mm_head(mm, 1, size, ncmin, align, &r);
148 if (ret) {
149 mutex_unlock(&pfb->base.mutex);
150 pfb->ram.put(pfb, &mem);
151 return ret;
152 }
153
154 list_add_tail(&r->rl_entry, &mem->regions);
155 size -= r->length;
156 } while (size);
157 mutex_unlock(&pfb->base.mutex);
158
159 r = list_first_entry(&mem->regions, struct nouveau_mm_node, rl_entry);
160 mem->offset = (u64)r->offset << 12;
161 *pmem = mem;
162 return 0;
163}
164
165static void
166nvc0_fb_vram_del(struct nouveau_fb *pfb, struct nouveau_mem **pmem)
167{
168 struct nouveau_ltcg *ltcg = nouveau_ltcg(pfb->base.base.parent);
169
170 if ((*pmem)->tag)
171 ltcg->tags_free(ltcg, &(*pmem)->tag);
172
173 nv50_fb_vram_del(pfb, pmem);
174}
175
176static int
177nvc0_fb_init(struct nouveau_object *object) 43nvc0_fb_init(struct nouveau_object *object)
178{ 44{
179 struct nvc0_fb_priv *priv = (void *)object; 45 struct nvc0_fb_priv *priv = (void *)object;
@@ -212,15 +78,12 @@ nvc0_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
212 struct nvc0_fb_priv *priv; 78 struct nvc0_fb_priv *priv;
213 int ret; 79 int ret;
214 80
215 ret = nouveau_fb_create(parent, engine, oclass, &priv); 81 ret = nouveau_fb_create(parent, engine, oclass, &nvc0_ram_oclass, &priv);
216 *pobject = nv_object(priv); 82 *pobject = nv_object(priv);
217 if (ret) 83 if (ret)
218 return ret; 84 return ret;
219 85
220 priv->base.memtype_valid = nvc0_fb_memtype_valid; 86 priv->base.memtype_valid = nvc0_fb_memtype_valid;
221 priv->base.ram.init = nvc0_fb_vram_init;
222 priv->base.ram.get = nvc0_fb_vram_new;
223 priv->base.ram.put = nvc0_fb_vram_del;
224 87
225 priv->r100c10_page = alloc_page(GFP_KERNEL | __GFP_ZERO); 88 priv->r100c10_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
226 if (priv->r100c10_page) { 89 if (priv->r100c10_page) {
@@ -231,7 +94,7 @@ nvc0_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
231 return -EFAULT; 94 return -EFAULT;
232 } 95 }
233 96
234 return nouveau_fb_preinit(&priv->base); 97 return 0;
235} 98}
236 99
237 100
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/priv.h b/drivers/gpu/drm/nouveau/core/subdev/fb/priv.h
new file mode 100644
index 000000000000..6c974dd83e8b
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/priv.h
@@ -0,0 +1,87 @@
1#ifndef __NVKM_FB_PRIV_H__
2#define __NVKM_FB_PRIV_H__
3
4#include <subdev/fb.h>
5
6#define nouveau_ram_create(p,e,o,d) \
7 nouveau_object_create_((p), (e), (o), 0, sizeof(**d), (void **)d)
8#define nouveau_ram_destroy(p) \
9 nouveau_object_destroy(&(p)->base)
10#define nouveau_ram_init(p) \
11 nouveau_object_init(&(p)->base)
12#define nouveau_ram_fini(p,s) \
13 nouveau_object_fini(&(p)->base, (s))
14
15#define _nouveau_ram_dtor nouveau_object_destroy
16#define _nouveau_ram_init nouveau_object_init
17#define _nouveau_ram_fini nouveau_object_fini
18
19extern struct nouveau_oclass nv04_ram_oclass;
20extern struct nouveau_oclass nv10_ram_oclass;
21extern struct nouveau_oclass nv1a_ram_oclass;
22extern struct nouveau_oclass nv20_ram_oclass;
23extern struct nouveau_oclass nv40_ram_oclass;
24extern struct nouveau_oclass nv41_ram_oclass;
25extern struct nouveau_oclass nv44_ram_oclass;
26extern struct nouveau_oclass nv49_ram_oclass;
27extern struct nouveau_oclass nv4e_ram_oclass;
28extern struct nouveau_oclass nv50_ram_oclass;
29extern struct nouveau_oclass nvc0_ram_oclass;
30
31#define nouveau_fb_create(p,e,c,r,d) \
32 nouveau_fb_create_((p), (e), (c), (r), sizeof(**d), (void **)d)
33#define nouveau_fb_destroy(p) ({ \
34 struct nouveau_fb *pfb = (p); \
35 _nouveau_fb_dtor(nv_object(pfb)); \
36})
37#define nouveau_fb_init(p) ({ \
38 struct nouveau_fb *pfb = (p); \
39 _nouveau_fb_init(nv_object(pfb)); \
40})
41#define nouveau_fb_fini(p,s) ({ \
42 struct nouveau_fb *pfb = (p); \
43 _nouveau_fb_fini(nv_object(pfb), (s)); \
44})
45
46int nouveau_fb_create_(struct nouveau_object *, struct nouveau_object *,
47 struct nouveau_oclass *, struct nouveau_oclass *,
48 int length, void **pobject);
49void _nouveau_fb_dtor(struct nouveau_object *);
50int _nouveau_fb_init(struct nouveau_object *);
51int _nouveau_fb_fini(struct nouveau_object *, bool);
52
53struct nouveau_bios;
54int nouveau_fb_bios_memtype(struct nouveau_bios *);
55
56bool nv04_fb_memtype_valid(struct nouveau_fb *, u32 memtype);
57
58void nv10_fb_tile_init(struct nouveau_fb *, int i, u32 addr, u32 size,
59 u32 pitch, u32 flags, struct nouveau_fb_tile *);
60void nv10_fb_tile_fini(struct nouveau_fb *, int i, struct nouveau_fb_tile *);
61void nv10_fb_tile_prog(struct nouveau_fb *, int, struct nouveau_fb_tile *);
62
63void nv20_fb_tile_init(struct nouveau_fb *, int i, u32 addr, u32 size,
64 u32 pitch, u32 flags, struct nouveau_fb_tile *);
65void nv20_fb_tile_fini(struct nouveau_fb *, int i, struct nouveau_fb_tile *);
66void nv20_fb_tile_prog(struct nouveau_fb *, int, struct nouveau_fb_tile *);
67
68int nv30_fb_init(struct nouveau_object *);
69void nv30_fb_tile_init(struct nouveau_fb *, int i, u32 addr, u32 size,
70 u32 pitch, u32 flags, struct nouveau_fb_tile *);
71
72void nv40_fb_tile_comp(struct nouveau_fb *, int i, u32 size, u32 flags,
73 struct nouveau_fb_tile *);
74
75int nv41_fb_init(struct nouveau_object *);
76void nv41_fb_tile_prog(struct nouveau_fb *, int, struct nouveau_fb_tile *);
77
78int nv44_fb_init(struct nouveau_object *);
79void nv44_fb_tile_prog(struct nouveau_fb *, int, struct nouveau_fb_tile *);
80
81void nv46_fb_tile_init(struct nouveau_fb *, int i, u32 addr, u32 size,
82 u32 pitch, u32 flags, struct nouveau_fb_tile *);
83
84void nv50_ram_put(struct nouveau_fb *, struct nouveau_mem **);
85extern int nv50_fb_memtype[0x80];
86
87#endif
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv04.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv04.c
new file mode 100644
index 000000000000..e781080d3327
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv04.c
@@ -0,0 +1,95 @@
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#define NV04_PFB_BOOT_0 0x00100000
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
42#include "priv.h"
43
44static int
45nv04_ram_create(struct nouveau_object *parent, struct nouveau_object *engine,
46 struct nouveau_oclass *oclass, void *data, u32 size,
47 struct nouveau_object **pobject)
48{
49 struct nouveau_fb *pfb = nouveau_fb(parent);
50 struct nouveau_ram *ram;
51 u32 boot0 = nv_rd32(pfb, NV04_PFB_BOOT_0);
52 int ret;
53
54 ret = nouveau_ram_create(parent, engine, oclass, &ram);
55 *pobject = nv_object(ram);
56 if (ret)
57 return ret;
58
59 if (boot0 & 0x00000100) {
60 ram->size = ((boot0 >> 12) & 0xf) * 2 + 2;
61 ram->size *= 1024 * 1024;
62 } else {
63 switch (boot0 & NV04_PFB_BOOT_0_RAM_AMOUNT) {
64 case NV04_PFB_BOOT_0_RAM_AMOUNT_32MB:
65 ram->size = 32 * 1024 * 1024;
66 break;
67 case NV04_PFB_BOOT_0_RAM_AMOUNT_16MB:
68 ram->size = 16 * 1024 * 1024;
69 break;
70 case NV04_PFB_BOOT_0_RAM_AMOUNT_8MB:
71 ram->size = 8 * 1024 * 1024;
72 break;
73 case NV04_PFB_BOOT_0_RAM_AMOUNT_4MB:
74 ram->size = 4 * 1024 * 1024;
75 break;
76 }
77 }
78
79 if ((boot0 & 0x00000038) <= 0x10)
80 ram->type = NV_MEM_TYPE_SGRAM;
81 else
82 ram->type = NV_MEM_TYPE_SDRAM;
83 return 0;
84}
85
86struct nouveau_oclass
87nv04_ram_oclass = {
88 .handle = 0,
89 .ofuncs = &(struct nouveau_ofuncs) {
90 .ctor = nv04_ram_create,
91 .dtor = _nouveau_ram_dtor,
92 .init = _nouveau_ram_init,
93 .fini = _nouveau_ram_fini,
94 }
95};
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv10.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv10.c
new file mode 100644
index 000000000000..8311f3774edf
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv10.c
@@ -0,0 +1,61 @@
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 "priv.h"
26
27static int
28nv10_ram_create(struct nouveau_object *parent, struct nouveau_object *engine,
29 struct nouveau_oclass *oclass, void *data, u32 size,
30 struct nouveau_object **pobject)
31{
32 struct nouveau_fb *pfb = nouveau_fb(parent);
33 struct nouveau_ram *ram;
34 u32 cfg0 = nv_rd32(pfb, 0x100200);
35 int ret;
36
37 ret = nouveau_ram_create(parent, engine, oclass, &ram);
38 *pobject = nv_object(ram);
39 if (ret)
40 return ret;
41
42 if (cfg0 & 0x00000001)
43 ram->type = NV_MEM_TYPE_DDR1;
44 else
45 ram->type = NV_MEM_TYPE_SDRAM;
46
47 ram->size = nv_rd32(pfb, 0x10020c) & 0xff000000;
48 return 0;
49}
50
51
52struct nouveau_oclass
53nv10_ram_oclass = {
54 .handle = 0,
55 .ofuncs = &(struct nouveau_ofuncs) {
56 .ctor = nv10_ram_create,
57 .dtor = _nouveau_ram_dtor,
58 .init = _nouveau_ram_init,
59 .fini = _nouveau_ram_fini,
60 }
61};
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv1a.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv1a.c
new file mode 100644
index 000000000000..d0caddfb9db0
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv1a.c
@@ -0,0 +1,71 @@
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 "priv.h"
26
27static int
28nv1a_ram_create(struct nouveau_object *parent, struct nouveau_object *engine,
29 struct nouveau_oclass *oclass, void *data, u32 size,
30 struct nouveau_object **pobject)
31{
32 struct nouveau_fb *pfb = nouveau_fb(parent);
33 struct nouveau_ram *ram;
34 struct pci_dev *bridge;
35 u32 mem, mib;
36 int ret;
37
38 bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 1));
39 if (!bridge) {
40 nv_fatal(pfb, "no bridge device\n");
41 return -ENODEV;
42 }
43
44 ret = nouveau_ram_create(parent, engine, oclass, &ram);
45 *pobject = nv_object(ram);
46 if (ret)
47 return ret;
48
49 if (nv_device(pfb)->chipset == 0x1a) {
50 pci_read_config_dword(bridge, 0x7c, &mem);
51 mib = ((mem >> 6) & 31) + 1;
52 } else {
53 pci_read_config_dword(bridge, 0x84, &mem);
54 mib = ((mem >> 4) & 127) + 1;
55 }
56
57 ram->type = NV_MEM_TYPE_STOLEN;
58 ram->size = mib * 1024 * 1024;
59 return 0;
60}
61
62struct nouveau_oclass
63nv1a_ram_oclass = {
64 .handle = 0,
65 .ofuncs = &(struct nouveau_ofuncs) {
66 .ctor = nv1a_ram_create,
67 .dtor = _nouveau_ram_dtor,
68 .init = _nouveau_ram_init,
69 .fini = _nouveau_ram_fini,
70 }
71};
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv20.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv20.c
new file mode 100644
index 000000000000..fdc11bba226d
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv20.c
@@ -0,0 +1,63 @@
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 "priv.h"
26
27static int
28nv20_ram_create(struct nouveau_object *parent, struct nouveau_object *engine,
29 struct nouveau_oclass *oclass, void *data, u32 size,
30 struct nouveau_object **pobject)
31{
32 struct nouveau_fb *pfb = nouveau_fb(parent);
33 struct nouveau_ram *ram;
34 u32 pbus1218 = nv_rd32(pfb, 0x001218);
35 int ret;
36
37 ret = nouveau_ram_create(parent, engine, oclass, &ram);
38 *pobject = nv_object(ram);
39 if (ret)
40 return ret;
41
42 switch (pbus1218 & 0x00000300) {
43 case 0x00000000: ram->type = NV_MEM_TYPE_SDRAM; break;
44 case 0x00000100: ram->type = NV_MEM_TYPE_DDR1; break;
45 case 0x00000200: ram->type = NV_MEM_TYPE_GDDR3; break;
46 case 0x00000300: ram->type = NV_MEM_TYPE_GDDR2; break;
47 }
48 ram->size = (nv_rd32(pfb, 0x10020c) & 0xff000000);
49 ram->parts = (nv_rd32(pfb, 0x100200) & 0x00000003) + 1;
50 ram->tags = nv_rd32(pfb, 0x100320);
51 return 0;
52}
53
54struct nouveau_oclass
55nv20_ram_oclass = {
56 .handle = 0,
57 .ofuncs = &(struct nouveau_ofuncs) {
58 .ctor = nv20_ram_create,
59 .dtor = _nouveau_ram_dtor,
60 .init = _nouveau_ram_init,
61 .fini = _nouveau_ram_fini,
62 }
63};
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv40.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv40.c
new file mode 100644
index 000000000000..ee49ac4dbdb6
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv40.c
@@ -0,0 +1,65 @@
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 "priv.h"
26
27static int
28nv40_ram_create(struct nouveau_object *parent, struct nouveau_object *engine,
29 struct nouveau_oclass *oclass, void *data, u32 size,
30 struct nouveau_object **pobject)
31{
32 struct nouveau_fb *pfb = nouveau_fb(parent);
33 struct nouveau_ram *ram;
34 u32 pbus1218 = nv_rd32(pfb, 0x001218);
35 int ret;
36
37 ret = nouveau_ram_create(parent, engine, oclass, &ram);
38 *pobject = nv_object(ram);
39 if (ret)
40 return ret;
41
42 switch (pbus1218 & 0x00000300) {
43 case 0x00000000: ram->type = NV_MEM_TYPE_SDRAM; break;
44 case 0x00000100: ram->type = NV_MEM_TYPE_DDR1; break;
45 case 0x00000200: ram->type = NV_MEM_TYPE_GDDR3; break;
46 case 0x00000300: ram->type = NV_MEM_TYPE_DDR2; break;
47 }
48
49 ram->size = nv_rd32(pfb, 0x10020c) & 0xff000000;
50 ram->parts = (nv_rd32(pfb, 0x100200) & 0x00000003) + 1;
51 ram->tags = nv_rd32(pfb, 0x100320);
52 return 0;
53}
54
55
56struct nouveau_oclass
57nv40_ram_oclass = {
58 .handle = 0,
59 .ofuncs = &(struct nouveau_ofuncs) {
60 .ctor = nv40_ram_create,
61 .dtor = _nouveau_ram_dtor,
62 .init = _nouveau_ram_init,
63 .fini = _nouveau_ram_fini,
64 }
65};
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv41.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv41.c
new file mode 100644
index 000000000000..1dab7e12abab
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv41.c
@@ -0,0 +1,64 @@
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 "priv.h"
26
27static int
28nv41_ram_create(struct nouveau_object *parent, struct nouveau_object *engine,
29 struct nouveau_oclass *oclass, void *data, u32 size,
30 struct nouveau_object **pobject)
31{
32 struct nouveau_fb *pfb = nouveau_fb(parent);
33 struct nouveau_ram *ram;
34 u32 pfb474 = nv_rd32(pfb, 0x100474);
35 int ret;
36
37 ret = nouveau_ram_create(parent, engine, oclass, &ram);
38 *pobject = nv_object(ram);
39 if (ret)
40 return ret;
41
42 if (pfb474 & 0x00000004)
43 ram->type = NV_MEM_TYPE_GDDR3;
44 if (pfb474 & 0x00000002)
45 ram->type = NV_MEM_TYPE_DDR2;
46 if (pfb474 & 0x00000001)
47 ram->type = NV_MEM_TYPE_DDR1;
48
49 ram->size = nv_rd32(pfb, 0x10020c) & 0xff000000;
50 ram->parts = (nv_rd32(pfb, 0x100200) & 0x00000003) + 1;
51 ram->tags = nv_rd32(pfb, 0x100320);
52 return 0;
53}
54
55struct nouveau_oclass
56nv41_ram_oclass = {
57 .handle = 0,
58 .ofuncs = &(struct nouveau_ofuncs) {
59 .ctor = nv41_ram_create,
60 .dtor = _nouveau_ram_dtor,
61 .init = _nouveau_ram_init,
62 .fini = _nouveau_ram_fini,
63 }
64};
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv44.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv44.c
new file mode 100644
index 000000000000..25fff842e5c1
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv44.c
@@ -0,0 +1,62 @@
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 "priv.h"
26
27static int
28nv44_ram_create(struct nouveau_object *parent, struct nouveau_object *engine,
29 struct nouveau_oclass *oclass, void *data, u32 size,
30 struct nouveau_object **pobject)
31{
32 struct nouveau_fb *pfb = nouveau_fb(parent);
33 struct nouveau_ram *ram;
34 u32 pfb474 = nv_rd32(pfb, 0x100474);
35 int ret;
36
37 ret = nouveau_ram_create(parent, engine, oclass, &ram);
38 *pobject = nv_object(ram);
39 if (ret)
40 return ret;
41
42 if (pfb474 & 0x00000004)
43 ram->type = NV_MEM_TYPE_GDDR3;
44 if (pfb474 & 0x00000002)
45 ram->type = NV_MEM_TYPE_DDR2;
46 if (pfb474 & 0x00000001)
47 ram->type = NV_MEM_TYPE_DDR1;
48
49 ram->size = nv_rd32(pfb, 0x10020c) & 0xff000000;
50 return 0;
51}
52
53struct nouveau_oclass
54nv44_ram_oclass = {
55 .handle = 0,
56 .ofuncs = &(struct nouveau_ofuncs) {
57 .ctor = nv44_ram_create,
58 .dtor = _nouveau_ram_dtor,
59 .init = _nouveau_ram_init,
60 .fini = _nouveau_ram_fini,
61 }
62};
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv49.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv49.c
new file mode 100644
index 000000000000..19e3a9a63a02
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv49.c
@@ -0,0 +1,64 @@
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 "priv.h"
26
27static int
28nv49_ram_create(struct nouveau_object *parent, struct nouveau_object *engine,
29 struct nouveau_oclass *oclass, void *data, u32 size,
30 struct nouveau_object **pobject)
31{
32 struct nouveau_fb *pfb = nouveau_fb(parent);
33 struct nouveau_ram *ram;
34 u32 pfb914 = nv_rd32(pfb, 0x100914);
35 int ret;
36
37 ret = nouveau_ram_create(parent, engine, oclass, &ram);
38 *pobject = nv_object(ram);
39 if (ret)
40 return ret;
41
42 switch (pfb914 & 0x00000003) {
43 case 0x00000000: pfb->ram->type = NV_MEM_TYPE_DDR1; break;
44 case 0x00000001: pfb->ram->type = NV_MEM_TYPE_DDR2; break;
45 case 0x00000002: pfb->ram->type = NV_MEM_TYPE_GDDR3; break;
46 case 0x00000003: break;
47 }
48
49 pfb->ram->size = nv_rd32(pfb, 0x10020c) & 0xff000000;
50 pfb->ram->parts = (nv_rd32(pfb, 0x100200) & 0x00000003) + 1;
51 pfb->ram->tags = nv_rd32(pfb, 0x100320);
52 return 0;
53}
54
55struct nouveau_oclass
56nv49_ram_oclass = {
57 .handle = 0,
58 .ofuncs = &(struct nouveau_ofuncs) {
59 .ctor = nv49_ram_create,
60 .dtor = _nouveau_ram_dtor,
61 .init = _nouveau_ram_init,
62 .fini = _nouveau_ram_fini,
63 }
64};
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv4e.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv4e.c
new file mode 100644
index 000000000000..7192aa6e5577
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv4e.c
@@ -0,0 +1,55 @@
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 "priv.h"
26
27static int
28nv4e_ram_create(struct nouveau_object *parent, struct nouveau_object *engine,
29 struct nouveau_oclass *oclass, void *data, u32 size,
30 struct nouveau_object **pobject)
31{
32 struct nouveau_fb *pfb = nouveau_fb(parent);
33 struct nouveau_ram *ram;
34 int ret;
35
36 ret = nouveau_ram_create(parent, engine, oclass, &ram);
37 *pobject = nv_object(ram);
38 if (ret)
39 return ret;
40
41 pfb->ram->size = nv_rd32(pfb, 0x10020c) & 0xff000000;
42 pfb->ram->type = NV_MEM_TYPE_STOLEN;
43 return 0;
44}
45
46struct nouveau_oclass
47nv4e_ram_oclass = {
48 .handle = 0,
49 .ofuncs = &(struct nouveau_ofuncs) {
50 .ctor = nv4e_ram_create,
51 .dtor = _nouveau_ram_dtor,
52 .init = _nouveau_ram_init,
53 .fini = _nouveau_ram_fini,
54 }
55};
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv50.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv50.c
new file mode 100644
index 000000000000..af5aa7ee8ad9
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv50.c
@@ -0,0 +1,232 @@
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 <core/mm.h>
27#include "priv.h"
28
29void
30nv50_ram_put(struct nouveau_fb *pfb, struct nouveau_mem **pmem)
31{
32 struct nouveau_mm_node *this;
33 struct nouveau_mem *mem;
34
35 mem = *pmem;
36 *pmem = NULL;
37 if (unlikely(mem == NULL))
38 return;
39
40 mutex_lock(&pfb->base.mutex);
41 while (!list_empty(&mem->regions)) {
42 this = list_first_entry(&mem->regions, typeof(*this), rl_entry);
43
44 list_del(&this->rl_entry);
45 nouveau_mm_free(&pfb->vram, &this);
46 }
47
48 nouveau_mm_free(&pfb->tags, &mem->tag);
49 mutex_unlock(&pfb->base.mutex);
50
51 kfree(mem);
52}
53
54static int
55nv50_ram_get(struct nouveau_fb *pfb, u64 size, u32 align, u32 ncmin,
56 u32 memtype, struct nouveau_mem **pmem)
57{
58 struct nouveau_mm *heap = &pfb->vram;
59 struct nouveau_mm *tags = &pfb->tags;
60 struct nouveau_mm_node *r;
61 struct nouveau_mem *mem;
62 int comp = (memtype & 0x300) >> 8;
63 int type = (memtype & 0x07f);
64 int back = (memtype & 0x800);
65 int min, max, ret;
66
67 max = (size >> 12);
68 min = ncmin ? (ncmin >> 12) : max;
69 align >>= 12;
70
71 mem = kzalloc(sizeof(*mem), GFP_KERNEL);
72 if (!mem)
73 return -ENOMEM;
74
75 mutex_lock(&pfb->base.mutex);
76 if (comp) {
77 if (align == 16) {
78 int n = (max >> 4) * comp;
79
80 ret = nouveau_mm_head(tags, 1, n, n, 1, &mem->tag);
81 if (ret)
82 mem->tag = NULL;
83 }
84
85 if (unlikely(!mem->tag))
86 comp = 0;
87 }
88
89 INIT_LIST_HEAD(&mem->regions);
90 mem->memtype = (comp << 7) | type;
91 mem->size = max;
92
93 type = nv50_fb_memtype[type];
94 do {
95 if (back)
96 ret = nouveau_mm_tail(heap, type, max, min, align, &r);
97 else
98 ret = nouveau_mm_head(heap, type, max, min, align, &r);
99 if (ret) {
100 mutex_unlock(&pfb->base.mutex);
101 pfb->ram->put(pfb, &mem);
102 return ret;
103 }
104
105 list_add_tail(&r->rl_entry, &mem->regions);
106 max -= r->length;
107 } while (max);
108 mutex_unlock(&pfb->base.mutex);
109
110 r = list_first_entry(&mem->regions, struct nouveau_mm_node, rl_entry);
111 mem->offset = (u64)r->offset << 12;
112 *pmem = mem;
113 return 0;
114}
115
116static u32
117nv50_fb_vram_rblock(struct nouveau_fb *pfb, struct nouveau_ram *ram)
118{
119 int i, parts, colbits, rowbitsa, rowbitsb, banks;
120 u64 rowsize, predicted;
121 u32 r0, r4, rt, ru, rblock_size;
122
123 r0 = nv_rd32(pfb, 0x100200);
124 r4 = nv_rd32(pfb, 0x100204);
125 rt = nv_rd32(pfb, 0x100250);
126 ru = nv_rd32(pfb, 0x001540);
127 nv_debug(pfb, "memcfg 0x%08x 0x%08x 0x%08x 0x%08x\n", r0, r4, rt, ru);
128
129 for (i = 0, parts = 0; i < 8; i++) {
130 if (ru & (0x00010000 << i))
131 parts++;
132 }
133
134 colbits = (r4 & 0x0000f000) >> 12;
135 rowbitsa = ((r4 & 0x000f0000) >> 16) + 8;
136 rowbitsb = ((r4 & 0x00f00000) >> 20) + 8;
137 banks = 1 << (((r4 & 0x03000000) >> 24) + 2);
138
139 rowsize = parts * banks * (1 << colbits) * 8;
140 predicted = rowsize << rowbitsa;
141 if (r0 & 0x00000004)
142 predicted += rowsize << rowbitsb;
143
144 if (predicted != ram->size) {
145 nv_warn(pfb, "memory controller reports %d MiB VRAM\n",
146 (u32)(ram->size >> 20));
147 }
148
149 rblock_size = rowsize;
150 if (rt & 1)
151 rblock_size *= 3;
152
153 nv_debug(pfb, "rblock %d bytes\n", rblock_size);
154 return rblock_size;
155}
156
157static int
158nv50_ram_create(struct nouveau_object *parent, struct nouveau_object *engine,
159 struct nouveau_oclass *oclass, void *data, u32 datasize,
160 struct nouveau_object **pobject)
161{
162 struct nouveau_fb *pfb = nouveau_fb(parent);
163 struct nouveau_device *device = nv_device(pfb);
164 struct nouveau_bios *bios = nouveau_bios(device);
165 struct nouveau_ram *ram;
166 const u32 rsvd_head = ( 256 * 1024) >> 12; /* vga memory */
167 const u32 rsvd_tail = (1024 * 1024) >> 12; /* vbios etc */
168 u32 size;
169 int ret;
170
171 ret = nouveau_ram_create(parent, engine, oclass, &ram);
172 *pobject = nv_object(ram);
173 if (ret)
174 return ret;
175
176 ram->size = nv_rd32(pfb, 0x10020c);
177 ram->size = (ram->size & 0xffffff00) |
178 ((ram->size & 0x000000ff) << 32);
179
180 size = (ram->size >> 12) - rsvd_head - rsvd_tail;
181 switch (device->chipset) {
182 case 0xaa:
183 case 0xac:
184 case 0xaf: /* IGPs, no reordering, no real VRAM */
185 ret = nouveau_mm_init(&pfb->vram, rsvd_head, size, 1);
186 if (ret)
187 return ret;
188
189 ram->type = NV_MEM_TYPE_STOLEN;
190 ram->stolen = (u64)nv_rd32(pfb, 0x100e10) << 12;
191 break;
192 default:
193 switch (nv_rd32(pfb, 0x100714) & 0x00000007) {
194 case 0: ram->type = NV_MEM_TYPE_DDR1; break;
195 case 1:
196 if (nouveau_fb_bios_memtype(bios) == NV_MEM_TYPE_DDR3)
197 ram->type = NV_MEM_TYPE_DDR3;
198 else
199 ram->type = NV_MEM_TYPE_DDR2;
200 break;
201 case 2: ram->type = NV_MEM_TYPE_GDDR3; break;
202 case 3: ram->type = NV_MEM_TYPE_GDDR4; break;
203 case 4: ram->type = NV_MEM_TYPE_GDDR5; break;
204 default:
205 break;
206 }
207
208 ret = nouveau_mm_init(&pfb->vram, rsvd_head, size,
209 nv50_fb_vram_rblock(pfb, ram) >> 12);
210 if (ret)
211 return ret;
212
213 ram->ranks = (nv_rd32(pfb, 0x100200) & 0x4) ? 2 : 1;
214 ram->tags = nv_rd32(pfb, 0x100320);
215 break;
216 }
217
218 ram->get = nv50_ram_get;
219 ram->put = nv50_ram_put;
220 return 0;
221}
222
223struct nouveau_oclass
224nv50_ram_oclass = {
225 .handle = 0,
226 .ofuncs = &(struct nouveau_ofuncs) {
227 .ctor = nv50_ram_create,
228 .dtor = _nouveau_ram_dtor,
229 .init = _nouveau_ram_init,
230 .fini = _nouveau_ram_fini,
231 }
232};
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c
new file mode 100644
index 000000000000..9c3634acbb9d
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c
@@ -0,0 +1,186 @@
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/ltcg.h>
27
28#include "priv.h"
29
30extern const u8 nvc0_pte_storage_type_map[256];
31
32void
33nvc0_ram_put(struct nouveau_fb *pfb, struct nouveau_mem **pmem)
34{
35 struct nouveau_ltcg *ltcg = nouveau_ltcg(pfb);
36
37 if ((*pmem)->tag)
38 ltcg->tags_free(ltcg, &(*pmem)->tag);
39
40 nv50_ram_put(pfb, pmem);
41}
42
43int
44nvc0_ram_get(struct nouveau_fb *pfb, u64 size, u32 align, u32 ncmin,
45 u32 memtype, struct nouveau_mem **pmem)
46{
47 struct nouveau_mm *mm = &pfb->vram;
48 struct nouveau_mm_node *r;
49 struct nouveau_mem *mem;
50 int type = (memtype & 0x0ff);
51 int back = (memtype & 0x800);
52 const bool comp = nvc0_pte_storage_type_map[type] != type;
53 int ret;
54
55 size >>= 12;
56 align >>= 12;
57 ncmin >>= 12;
58 if (!ncmin)
59 ncmin = size;
60
61 mem = kzalloc(sizeof(*mem), GFP_KERNEL);
62 if (!mem)
63 return -ENOMEM;
64
65 INIT_LIST_HEAD(&mem->regions);
66 mem->size = size;
67
68 mutex_lock(&pfb->base.mutex);
69 if (comp) {
70 struct nouveau_ltcg *ltcg = nouveau_ltcg(pfb);
71
72 /* compression only works with lpages */
73 if (align == (1 << (17 - 12))) {
74 int n = size >> 5;
75 ltcg->tags_alloc(ltcg, n, &mem->tag);
76 }
77
78 if (unlikely(!mem->tag))
79 type = nvc0_pte_storage_type_map[type];
80 }
81 mem->memtype = type;
82
83 do {
84 if (back)
85 ret = nouveau_mm_tail(mm, 1, size, ncmin, align, &r);
86 else
87 ret = nouveau_mm_head(mm, 1, size, ncmin, align, &r);
88 if (ret) {
89 mutex_unlock(&pfb->base.mutex);
90 pfb->ram->put(pfb, &mem);
91 return ret;
92 }
93
94 list_add_tail(&r->rl_entry, &mem->regions);
95 size -= r->length;
96 } while (size);
97 mutex_unlock(&pfb->base.mutex);
98
99 r = list_first_entry(&mem->regions, struct nouveau_mm_node, rl_entry);
100 mem->offset = (u64)r->offset << 12;
101 *pmem = mem;
102 return 0;
103}
104
105static int
106nvc0_ram_create(struct nouveau_object *parent, struct nouveau_object *engine,
107 struct nouveau_oclass *oclass, void *data, u32 size,
108 struct nouveau_object **pobject)
109{
110 struct nouveau_fb *pfb = nouveau_fb(parent);
111 struct nouveau_bios *bios = nouveau_bios(pfb);
112 struct nouveau_ram *ram;
113 const u32 rsvd_head = ( 256 * 1024) >> 12; /* vga memory */
114 const u32 rsvd_tail = (1024 * 1024) >> 12; /* vbios etc */
115 u32 parts = nv_rd32(pfb, 0x022438);
116 u32 pmask = nv_rd32(pfb, 0x022554);
117 u32 bsize = nv_rd32(pfb, 0x10f20c);
118 u32 offset, length;
119 bool uniform = true;
120 int ret, part;
121
122 ret = nouveau_ram_create(parent, engine, oclass, &ram);
123 *pobject = nv_object(ram);
124 if (ret)
125 return ret;
126
127 nv_debug(pfb, "0x100800: 0x%08x\n", nv_rd32(pfb, 0x100800));
128 nv_debug(pfb, "parts 0x%08x mask 0x%08x\n", parts, pmask);
129
130 ram->type = nouveau_fb_bios_memtype(bios);
131 ram->ranks = (nv_rd32(pfb, 0x10f200) & 0x00000004) ? 2 : 1;
132
133 /* read amount of vram attached to each memory controller */
134 for (part = 0; part < parts; part++) {
135 if (!(pmask & (1 << part))) {
136 u32 psize = nv_rd32(pfb, 0x11020c + (part * 0x1000));
137 if (psize != bsize) {
138 if (psize < bsize)
139 bsize = psize;
140 uniform = false;
141 }
142
143 nv_debug(pfb, "%d: mem_amount 0x%08x\n", part, psize);
144 ram->size += (u64)psize << 20;
145 }
146 }
147
148 /* if all controllers have the same amount attached, there's no holes */
149 if (uniform) {
150 offset = rsvd_head;
151 length = (ram->size >> 12) - rsvd_head - rsvd_tail;
152 ret = nouveau_mm_init(&pfb->vram, offset, length, 1);
153 } else {
154 /* otherwise, address lowest common amount from 0GiB */
155 ret = nouveau_mm_init(&pfb->vram, rsvd_head,
156 (bsize << 8) * parts, 1);
157 if (ret)
158 return ret;
159
160 /* and the rest starting from (8GiB + common_size) */
161 offset = (0x0200000000ULL >> 12) + (bsize << 8);
162 length = (ram->size >> 12) - (bsize << 8) - rsvd_tail;
163
164 ret = nouveau_mm_init(&pfb->vram, offset, length, 0);
165 if (ret)
166 nouveau_mm_fini(&pfb->vram);
167 }
168
169 if (ret)
170 return ret;
171
172 ram->get = nvc0_ram_get;
173 ram->put = nvc0_ram_put;
174 return 0;
175}
176
177struct nouveau_oclass
178nvc0_ram_oclass = {
179 .handle = 0,
180 .ofuncs = &(struct nouveau_ofuncs) {
181 .ctor = nvc0_ram_create,
182 .dtor = _nouveau_ram_dtor,
183 .init = _nouveau_ram_init,
184 .fini = _nouveau_ram_fini,
185 }
186};
diff --git a/drivers/gpu/drm/nouveau/core/subdev/instmem/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/instmem/nv50.c
index cfc7e31461de..97bc5dff93e7 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/instmem/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/instmem/nv50.c
@@ -56,7 +56,7 @@ nv50_instobj_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
56 if (ret) 56 if (ret)
57 return ret; 57 return ret;
58 58
59 ret = pfb->ram.get(pfb, size, align, 0, 0x800, &node->mem); 59 ret = pfb->ram->get(pfb, size, align, 0, 0x800, &node->mem);
60 if (ret) 60 if (ret)
61 return ret; 61 return ret;
62 62
@@ -71,7 +71,7 @@ nv50_instobj_dtor(struct nouveau_object *object)
71{ 71{
72 struct nv50_instobj_priv *node = (void *)object; 72 struct nv50_instobj_priv *node = (void *)object;
73 struct nouveau_fb *pfb = nouveau_fb(object); 73 struct nouveau_fb *pfb = nouveau_fb(object);
74 pfb->ram.put(pfb, &node->mem); 74 pfb->ram->put(pfb, &node->mem);
75 nouveau_instobj_destroy(&node->base); 75 nouveau_instobj_destroy(&node->base);
76} 76}
77 77
diff --git a/drivers/gpu/drm/nouveau/core/subdev/ltcg/nvc0.c b/drivers/gpu/drm/nouveau/core/subdev/ltcg/nvc0.c
index fb794e997fbc..bcca883018f4 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/ltcg/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/ltcg/nvc0.c
@@ -122,7 +122,7 @@ nvc0_ltcg_init_tag_ram(struct nouveau_fb *pfb, struct nvc0_ltcg_priv *priv)
122 nv_wr32(priv, 0x17e000, priv->part_nr); 122 nv_wr32(priv, 0x17e000, priv->part_nr);
123 123
124 /* tags for 1/4 of VRAM should be enough (8192/4 per GiB of VRAM) */ 124 /* tags for 1/4 of VRAM should be enough (8192/4 per GiB of VRAM) */
125 priv->num_tags = (pfb->ram.size >> 17) / 4; 125 priv->num_tags = (pfb->ram->size >> 17) / 4;
126 if (priv->num_tags > (1 << 17)) 126 if (priv->num_tags > (1 << 17))
127 priv->num_tags = 1 << 17; /* we have 17 bits in PTE */ 127 priv->num_tags = 1 << 17; /* we have 17 bits in PTE */
128 priv->num_tags = (priv->num_tags + 63) & ~63; /* round up to 64 */ 128 priv->num_tags = (priv->num_tags + 63) & ~63; /* round up to 64 */
diff --git a/drivers/gpu/drm/nouveau/core/subdev/mc/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/mc/nv50.c
index d796924f9930..0cb322a5e72c 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/mc/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/mc/nv50.c
@@ -35,6 +35,7 @@ nv50_mc_intr[] = {
35 { 0x00001000, NVDEV_ENGINE_GR }, 35 { 0x00001000, NVDEV_ENGINE_GR },
36 { 0x00004000, NVDEV_ENGINE_CRYPT }, /* NV84- */ 36 { 0x00004000, NVDEV_ENGINE_CRYPT }, /* NV84- */
37 { 0x00008000, NVDEV_ENGINE_BSP }, /* NV84- */ 37 { 0x00008000, NVDEV_ENGINE_BSP }, /* NV84- */
38 { 0x00020000, NVDEV_ENGINE_VP }, /* NV84- */
38 { 0x00100000, NVDEV_SUBDEV_TIMER }, 39 { 0x00100000, NVDEV_SUBDEV_TIMER },
39 { 0x00200000, NVDEV_SUBDEV_GPIO }, 40 { 0x00200000, NVDEV_SUBDEV_GPIO },
40 { 0x04000000, NVDEV_ENGINE_DISP }, 41 { 0x04000000, NVDEV_ENGINE_DISP },
diff --git a/drivers/gpu/drm/nouveau/core/subdev/mc/nvc0.c b/drivers/gpu/drm/nouveau/core/subdev/mc/nvc0.c
index 737bd4b682e1..c5da3babbc62 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/mc/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/mc/nvc0.c
@@ -33,6 +33,7 @@ nvc0_mc_intr[] = {
33 { 0x00000001, NVDEV_ENGINE_PPP }, 33 { 0x00000001, NVDEV_ENGINE_PPP },
34 { 0x00000020, NVDEV_ENGINE_COPY0 }, 34 { 0x00000020, NVDEV_ENGINE_COPY0 },
35 { 0x00000040, NVDEV_ENGINE_COPY1 }, 35 { 0x00000040, NVDEV_ENGINE_COPY1 },
36 { 0x00000080, NVDEV_ENGINE_COPY2 },
36 { 0x00000100, NVDEV_ENGINE_FIFO }, 37 { 0x00000100, NVDEV_ENGINE_FIFO },
37 { 0x00001000, NVDEV_ENGINE_GR }, 38 { 0x00001000, NVDEV_ENGINE_GR },
38 { 0x00008000, NVDEV_ENGINE_BSP }, 39 { 0x00008000, NVDEV_ENGINE_BSP },
diff --git a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
index 77c67fc970e6..67fcb6c852ac 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
@@ -236,9 +236,9 @@ nouveau_vm_unmap_pgt(struct nouveau_vm *vm, int big, u32 fpde, u32 lpde)
236 vmm->map_pgt(vpgd->obj, pde, vpgt->obj); 236 vmm->map_pgt(vpgd->obj, pde, vpgt->obj);
237 } 237 }
238 238
239 mutex_unlock(&vm->mm.mutex); 239 mutex_unlock(&nv_subdev(vmm)->mutex);
240 nouveau_gpuobj_ref(NULL, &pgt); 240 nouveau_gpuobj_ref(NULL, &pgt);
241 mutex_lock(&vm->mm.mutex); 241 mutex_lock(&nv_subdev(vmm)->mutex);
242 } 242 }
243} 243}
244 244
@@ -256,18 +256,18 @@ nouveau_vm_map_pgt(struct nouveau_vm *vm, u32 pde, u32 type)
256 pgt_size = (1 << (vmm->pgt_bits + 12)) >> type; 256 pgt_size = (1 << (vmm->pgt_bits + 12)) >> type;
257 pgt_size *= 8; 257 pgt_size *= 8;
258 258
259 mutex_unlock(&vm->mm.mutex); 259 mutex_unlock(&nv_subdev(vmm)->mutex);
260 ret = nouveau_gpuobj_new(nv_object(vm->vmm), NULL, pgt_size, 0x1000, 260 ret = nouveau_gpuobj_new(nv_object(vm->vmm), NULL, pgt_size, 0x1000,
261 NVOBJ_FLAG_ZERO_ALLOC, &pgt); 261 NVOBJ_FLAG_ZERO_ALLOC, &pgt);
262 mutex_lock(&vm->mm.mutex); 262 mutex_lock(&nv_subdev(vmm)->mutex);
263 if (unlikely(ret)) 263 if (unlikely(ret))
264 return ret; 264 return ret;
265 265
266 /* someone beat us to filling the PDE while we didn't have the lock */ 266 /* someone beat us to filling the PDE while we didn't have the lock */
267 if (unlikely(vpgt->refcount[big]++)) { 267 if (unlikely(vpgt->refcount[big]++)) {
268 mutex_unlock(&vm->mm.mutex); 268 mutex_unlock(&nv_subdev(vmm)->mutex);
269 nouveau_gpuobj_ref(NULL, &pgt); 269 nouveau_gpuobj_ref(NULL, &pgt);
270 mutex_lock(&vm->mm.mutex); 270 mutex_lock(&nv_subdev(vmm)->mutex);
271 return 0; 271 return 0;
272 } 272 }
273 273
@@ -289,11 +289,11 @@ nouveau_vm_get(struct nouveau_vm *vm, u64 size, u32 page_shift,
289 u32 fpde, lpde, pde; 289 u32 fpde, lpde, pde;
290 int ret; 290 int ret;
291 291
292 mutex_lock(&vm->mm.mutex); 292 mutex_lock(&nv_subdev(vmm)->mutex);
293 ret = nouveau_mm_head(&vm->mm, page_shift, msize, msize, align, 293 ret = nouveau_mm_head(&vm->mm, page_shift, msize, msize, align,
294 &vma->node); 294 &vma->node);
295 if (unlikely(ret != 0)) { 295 if (unlikely(ret != 0)) {
296 mutex_unlock(&vm->mm.mutex); 296 mutex_unlock(&nv_subdev(vmm)->mutex);
297 return ret; 297 return ret;
298 } 298 }
299 299
@@ -314,13 +314,14 @@ nouveau_vm_get(struct nouveau_vm *vm, u64 size, u32 page_shift,
314 if (pde != fpde) 314 if (pde != fpde)
315 nouveau_vm_unmap_pgt(vm, big, fpde, pde - 1); 315 nouveau_vm_unmap_pgt(vm, big, fpde, pde - 1);
316 nouveau_mm_free(&vm->mm, &vma->node); 316 nouveau_mm_free(&vm->mm, &vma->node);
317 mutex_unlock(&vm->mm.mutex); 317 mutex_unlock(&nv_subdev(vmm)->mutex);
318 return ret; 318 return ret;
319 } 319 }
320 } 320 }
321 mutex_unlock(&vm->mm.mutex); 321 mutex_unlock(&nv_subdev(vmm)->mutex);
322 322
323 vma->vm = vm; 323 vma->vm = NULL;
324 nouveau_vm_ref(vm, &vma->vm, NULL);
324 vma->offset = (u64)vma->node->offset << 12; 325 vma->offset = (u64)vma->node->offset << 12;
325 vma->access = access; 326 vma->access = access;
326 return 0; 327 return 0;
@@ -338,10 +339,12 @@ nouveau_vm_put(struct nouveau_vma *vma)
338 fpde = (vma->node->offset >> vmm->pgt_bits); 339 fpde = (vma->node->offset >> vmm->pgt_bits);
339 lpde = (vma->node->offset + vma->node->length - 1) >> vmm->pgt_bits; 340 lpde = (vma->node->offset + vma->node->length - 1) >> vmm->pgt_bits;
340 341
341 mutex_lock(&vm->mm.mutex); 342 mutex_lock(&nv_subdev(vmm)->mutex);
342 nouveau_vm_unmap_pgt(vm, vma->node->type != vmm->spg_shift, fpde, lpde); 343 nouveau_vm_unmap_pgt(vm, vma->node->type != vmm->spg_shift, fpde, lpde);
343 nouveau_mm_free(&vm->mm, &vma->node); 344 nouveau_mm_free(&vm->mm, &vma->node);
344 mutex_unlock(&vm->mm.mutex); 345 mutex_unlock(&nv_subdev(vmm)->mutex);
346
347 nouveau_vm_ref(NULL, &vma->vm, NULL);
345} 348}
346 349
347int 350int
@@ -362,7 +365,7 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length,
362 vm->fpde = offset >> (vmm->pgt_bits + 12); 365 vm->fpde = offset >> (vmm->pgt_bits + 12);
363 vm->lpde = (offset + length - 1) >> (vmm->pgt_bits + 12); 366 vm->lpde = (offset + length - 1) >> (vmm->pgt_bits + 12);
364 367
365 vm->pgt = kcalloc(vm->lpde - vm->fpde + 1, sizeof(*vm->pgt), GFP_KERNEL); 368 vm->pgt = vzalloc((vm->lpde - vm->fpde + 1) * sizeof(*vm->pgt));
366 if (!vm->pgt) { 369 if (!vm->pgt) {
367 kfree(vm); 370 kfree(vm);
368 return -ENOMEM; 371 return -ENOMEM;
@@ -371,7 +374,7 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length,
371 ret = nouveau_mm_init(&vm->mm, mm_offset >> 12, mm_length >> 12, 374 ret = nouveau_mm_init(&vm->mm, mm_offset >> 12, mm_length >> 12,
372 block >> 12); 375 block >> 12);
373 if (ret) { 376 if (ret) {
374 kfree(vm->pgt); 377 vfree(vm->pgt);
375 kfree(vm); 378 kfree(vm);
376 return ret; 379 return ret;
377 } 380 }
@@ -405,24 +408,25 @@ nouveau_vm_link(struct nouveau_vm *vm, struct nouveau_gpuobj *pgd)
405 408
406 nouveau_gpuobj_ref(pgd, &vpgd->obj); 409 nouveau_gpuobj_ref(pgd, &vpgd->obj);
407 410
408 mutex_lock(&vm->mm.mutex); 411 mutex_lock(&nv_subdev(vmm)->mutex);
409 for (i = vm->fpde; i <= vm->lpde; i++) 412 for (i = vm->fpde; i <= vm->lpde; i++)
410 vmm->map_pgt(pgd, i, vm->pgt[i - vm->fpde].obj); 413 vmm->map_pgt(pgd, i, vm->pgt[i - vm->fpde].obj);
411 list_add(&vpgd->head, &vm->pgd_list); 414 list_add(&vpgd->head, &vm->pgd_list);
412 mutex_unlock(&vm->mm.mutex); 415 mutex_unlock(&nv_subdev(vmm)->mutex);
413 return 0; 416 return 0;
414} 417}
415 418
416static void 419static void
417nouveau_vm_unlink(struct nouveau_vm *vm, struct nouveau_gpuobj *mpgd) 420nouveau_vm_unlink(struct nouveau_vm *vm, struct nouveau_gpuobj *mpgd)
418{ 421{
422 struct nouveau_vmmgr *vmm = vm->vmm;
419 struct nouveau_vm_pgd *vpgd, *tmp; 423 struct nouveau_vm_pgd *vpgd, *tmp;
420 struct nouveau_gpuobj *pgd = NULL; 424 struct nouveau_gpuobj *pgd = NULL;
421 425
422 if (!mpgd) 426 if (!mpgd)
423 return; 427 return;
424 428
425 mutex_lock(&vm->mm.mutex); 429 mutex_lock(&nv_subdev(vmm)->mutex);
426 list_for_each_entry_safe(vpgd, tmp, &vm->pgd_list, head) { 430 list_for_each_entry_safe(vpgd, tmp, &vm->pgd_list, head) {
427 if (vpgd->obj == mpgd) { 431 if (vpgd->obj == mpgd) {
428 pgd = vpgd->obj; 432 pgd = vpgd->obj;
@@ -431,7 +435,7 @@ nouveau_vm_unlink(struct nouveau_vm *vm, struct nouveau_gpuobj *mpgd)
431 break; 435 break;
432 } 436 }
433 } 437 }
434 mutex_unlock(&vm->mm.mutex); 438 mutex_unlock(&nv_subdev(vmm)->mutex);
435 439
436 nouveau_gpuobj_ref(NULL, &pgd); 440 nouveau_gpuobj_ref(NULL, &pgd);
437} 441}
@@ -446,7 +450,7 @@ nouveau_vm_del(struct nouveau_vm *vm)
446 } 450 }
447 451
448 nouveau_mm_fini(&vm->mm); 452 nouveau_mm_fini(&vm->mm);
449 kfree(vm->pgt); 453 vfree(vm->pgt);
450 kfree(vm); 454 kfree(vm);
451} 455}
452 456
diff --git a/drivers/gpu/drm/nouveau/core/subdev/vm/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/vm/nv50.c
index e067f81c97b3..07dd1fe2d6fb 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/vm/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/vm/nv50.c
@@ -27,11 +27,11 @@
27 27
28#include <subdev/timer.h> 28#include <subdev/timer.h>
29#include <subdev/fb.h> 29#include <subdev/fb.h>
30#include <subdev/bar.h>
30#include <subdev/vm.h> 31#include <subdev/vm.h>
31 32
32struct nv50_vmmgr_priv { 33struct nv50_vmmgr_priv {
33 struct nouveau_vmmgr base; 34 struct nouveau_vmmgr base;
34 spinlock_t lock;
35}; 35};
36 36
37static void 37static void
@@ -86,8 +86,8 @@ nv50_vm_map(struct nouveau_vma *vma, struct nouveau_gpuobj *pgt,
86 86
87 /* IGPs don't have real VRAM, re-target to stolen system memory */ 87 /* IGPs don't have real VRAM, re-target to stolen system memory */
88 target = 0; 88 target = 0;
89 if (nouveau_fb(vma->vm->vmm)->ram.stolen) { 89 if (nouveau_fb(vma->vm->vmm)->ram->stolen) {
90 phys += nouveau_fb(vma->vm->vmm)->ram.stolen; 90 phys += nouveau_fb(vma->vm->vmm)->ram->stolen;
91 target = 3; 91 target = 3;
92 } 92 }
93 93
@@ -151,29 +151,42 @@ nv50_vm_unmap(struct nouveau_gpuobj *pgt, u32 pte, u32 cnt)
151static void 151static void
152nv50_vm_flush(struct nouveau_vm *vm) 152nv50_vm_flush(struct nouveau_vm *vm)
153{ 153{
154 struct nv50_vmmgr_priv *priv = (void *)vm->vmm;
155 struct nouveau_bar *bar = nouveau_bar(priv);
154 struct nouveau_engine *engine; 156 struct nouveau_engine *engine;
155 int i; 157 int i, vme;
158
159 bar->flush(bar);
156 160
161 mutex_lock(&nv_subdev(priv)->mutex);
157 for (i = 0; i < NVDEV_SUBDEV_NR; i++) { 162 for (i = 0; i < NVDEV_SUBDEV_NR; i++) {
158 if (atomic_read(&vm->engref[i])) { 163 if (!atomic_read(&vm->engref[i]))
159 engine = nouveau_engine(vm->vmm, i); 164 continue;
160 if (engine && engine->tlb_flush) 165
161 engine->tlb_flush(engine); 166 /* unfortunate hw bug workaround... */
167 engine = nouveau_engine(priv, i);
168 if (engine && engine->tlb_flush) {
169 engine->tlb_flush(engine);
170 continue;
162 } 171 }
163 }
164}
165 172
166void 173 switch (i) {
167nv50_vm_flush_engine(struct nouveau_subdev *subdev, int engine) 174 case NVDEV_ENGINE_GR : vme = 0x00; break;
168{ 175 case NVDEV_ENGINE_VP : vme = 0x01; break;
169 struct nv50_vmmgr_priv *priv = (void *)nouveau_vmmgr(subdev); 176 case NVDEV_SUBDEV_BAR : vme = 0x06; break;
170 unsigned long flags; 177 case NVDEV_ENGINE_MPEG : vme = 0x08; break;
171 178 case NVDEV_ENGINE_BSP : vme = 0x09; break;
172 spin_lock_irqsave(&priv->lock, flags); 179 case NVDEV_ENGINE_CRYPT: vme = 0x0a; break;
173 nv_wr32(subdev, 0x100c80, (engine << 16) | 1); 180 case NVDEV_ENGINE_COPY0: vme = 0x0d; break;
174 if (!nv_wait(subdev, 0x100c80, 0x00000001, 0x00000000)) 181 default:
175 nv_error(subdev, "vm flush timeout: engine %d\n", engine); 182 continue;
176 spin_unlock_irqrestore(&priv->lock, flags); 183 }
184
185 nv_wr32(priv, 0x100c80, (vme << 16) | 1);
186 if (!nv_wait(priv, 0x100c80, 0x00000001, 0x00000000))
187 nv_error(priv, "vm flush timeout: engine %d\n", vme);
188 }
189 mutex_unlock(&nv_subdev(priv)->mutex);
177} 190}
178 191
179static int 192static int
@@ -211,7 +224,6 @@ nv50_vmmgr_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
211 priv->base.map_sg = nv50_vm_map_sg; 224 priv->base.map_sg = nv50_vm_map_sg;
212 priv->base.unmap = nv50_vm_unmap; 225 priv->base.unmap = nv50_vm_unmap;
213 priv->base.flush = nv50_vm_flush; 226 priv->base.flush = nv50_vm_flush;
214 spin_lock_init(&priv->lock);
215 return 0; 227 return 0;
216} 228}
217 229
diff --git a/drivers/gpu/drm/nouveau/core/subdev/vm/nvc0.c b/drivers/gpu/drm/nouveau/core/subdev/vm/nvc0.c
index 4c3b0a23b9d6..668cf964e4a9 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/vm/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/vm/nvc0.c
@@ -29,10 +29,10 @@
29#include <subdev/fb.h> 29#include <subdev/fb.h>
30#include <subdev/vm.h> 30#include <subdev/vm.h>
31#include <subdev/ltcg.h> 31#include <subdev/ltcg.h>
32#include <subdev/bar.h>
32 33
33struct nvc0_vmmgr_priv { 34struct nvc0_vmmgr_priv {
34 struct nouveau_vmmgr base; 35 struct nouveau_vmmgr base;
35 spinlock_t lock;
36}; 36};
37 37
38 38
@@ -160,40 +160,40 @@ nvc0_vm_unmap(struct nouveau_gpuobj *pgt, u32 pte, u32 cnt)
160 } 160 }
161} 161}
162 162
163void
164nvc0_vm_flush_engine(struct nouveau_subdev *subdev, u64 addr, int type)
165{
166 struct nvc0_vmmgr_priv *priv = (void *)nouveau_vmmgr(subdev);
167 unsigned long flags;
168
169 /* looks like maybe a "free flush slots" counter, the
170 * faster you write to 0x100cbc to more it decreases
171 */
172 spin_lock_irqsave(&priv->lock, flags);
173 if (!nv_wait_ne(subdev, 0x100c80, 0x00ff0000, 0x00000000)) {
174 nv_error(subdev, "vm timeout 0: 0x%08x %d\n",
175 nv_rd32(subdev, 0x100c80), type);
176 }
177
178 nv_wr32(subdev, 0x100cb8, addr >> 8);
179 nv_wr32(subdev, 0x100cbc, 0x80000000 | type);
180
181 /* wait for flush to be queued? */
182 if (!nv_wait(subdev, 0x100c80, 0x00008000, 0x00008000)) {
183 nv_error(subdev, "vm timeout 1: 0x%08x %d\n",
184 nv_rd32(subdev, 0x100c80), type);
185 }
186 spin_unlock_irqrestore(&priv->lock, flags);
187}
188
189static void 163static void
190nvc0_vm_flush(struct nouveau_vm *vm) 164nvc0_vm_flush(struct nouveau_vm *vm)
191{ 165{
166 struct nvc0_vmmgr_priv *priv = (void *)vm->vmm;
167 struct nouveau_bar *bar = nouveau_bar(priv);
192 struct nouveau_vm_pgd *vpgd; 168 struct nouveau_vm_pgd *vpgd;
169 u32 type;
170
171 bar->flush(bar);
172
173 type = 0x00000001; /* PAGE_ALL */
174 if (atomic_read(&vm->engref[NVDEV_SUBDEV_BAR]))
175 type |= 0x00000004; /* HUB_ONLY */
193 176
177 mutex_lock(&nv_subdev(priv)->mutex);
194 list_for_each_entry(vpgd, &vm->pgd_list, head) { 178 list_for_each_entry(vpgd, &vm->pgd_list, head) {
195 nvc0_vm_flush_engine(nv_subdev(vm->vmm), vpgd->obj->addr, 1); 179 /* looks like maybe a "free flush slots" counter, the
180 * faster you write to 0x100cbc to more it decreases
181 */
182 if (!nv_wait_ne(priv, 0x100c80, 0x00ff0000, 0x00000000)) {
183 nv_error(priv, "vm timeout 0: 0x%08x %d\n",
184 nv_rd32(priv, 0x100c80), type);
185 }
186
187 nv_wr32(priv, 0x100cb8, vpgd->obj->addr >> 8);
188 nv_wr32(priv, 0x100cbc, 0x80000000 | type);
189
190 /* wait for flush to be queued? */
191 if (!nv_wait(priv, 0x100c80, 0x00008000, 0x00008000)) {
192 nv_error(priv, "vm timeout 1: 0x%08x %d\n",
193 nv_rd32(priv, 0x100c80), type);
194 }
196 } 195 }
196 mutex_unlock(&nv_subdev(priv)->mutex);
197} 197}
198 198
199static int 199static int
@@ -227,7 +227,6 @@ nvc0_vmmgr_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
227 priv->base.map_sg = nvc0_vm_map_sg; 227 priv->base.map_sg = nvc0_vm_map_sg;
228 priv->base.unmap = nvc0_vm_unmap; 228 priv->base.unmap = nvc0_vm_unmap;
229 priv->base.flush = nvc0_vm_flush; 229 priv->base.flush = nvc0_vm_flush;
230 spin_lock_init(&priv->lock);
231 return 0; 230 return 0;
232} 231}
233 232
diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c
index 1c4c6c9161ac..8f467e7bfd19 100644
--- a/drivers/gpu/drm/nouveau/nouveau_abi16.c
+++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c
@@ -129,6 +129,7 @@ nouveau_abi16_chan_fini(struct nouveau_abi16 *abi16,
129 129
130 if (chan->ntfy) { 130 if (chan->ntfy) {
131 nouveau_bo_vma_del(chan->ntfy, &chan->ntfy_vma); 131 nouveau_bo_vma_del(chan->ntfy, &chan->ntfy_vma);
132 nouveau_bo_unpin(chan->ntfy);
132 drm_gem_object_unreference_unlocked(chan->ntfy->gem); 133 drm_gem_object_unreference_unlocked(chan->ntfy->gem);
133 } 134 }
134 135
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c
index 6aa2137e093a..3e7287675ecf 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bios.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bios.c
@@ -1878,9 +1878,6 @@ parse_dcb_table(struct drm_device *dev, struct nvbios *bios)
1878 if (dcb->version < 0x21) 1878 if (dcb->version < 0x21)
1879 merge_like_dcb_entries(dev, dcb); 1879 merge_like_dcb_entries(dev, dcb);
1880 1880
1881 if (!dcb->entries)
1882 return -ENXIO;
1883
1884 /* dump connector table entries to log, if any exist */ 1881 /* dump connector table entries to log, if any exist */
1885 idx = -1; 1882 idx = -1;
1886 while ((conn = olddcb_conn(dev, ++idx))) { 1883 while ((conn = olddcb_conn(dev, ++idx))) {
@@ -2054,19 +2051,14 @@ nouveau_bios_posted(struct drm_device *dev)
2054 struct nouveau_drm *drm = nouveau_drm(dev); 2051 struct nouveau_drm *drm = nouveau_drm(dev);
2055 unsigned htotal; 2052 unsigned htotal;
2056 2053
2057 if (nv_device(drm->device)->card_type >= NV_50) { 2054 if (nv_device(drm->device)->card_type >= NV_50)
2058 if (NVReadVgaCrtc(dev, 0, 0x00) == 0 &&
2059 NVReadVgaCrtc(dev, 0, 0x1a) == 0)
2060 return false;
2061 return true; 2055 return true;
2062 }
2063 2056
2064 htotal = NVReadVgaCrtc(dev, 0, 0x06); 2057 htotal = NVReadVgaCrtc(dev, 0, 0x06);
2065 htotal |= (NVReadVgaCrtc(dev, 0, 0x07) & 0x01) << 8; 2058 htotal |= (NVReadVgaCrtc(dev, 0, 0x07) & 0x01) << 8;
2066 htotal |= (NVReadVgaCrtc(dev, 0, 0x07) & 0x20) << 4; 2059 htotal |= (NVReadVgaCrtc(dev, 0, 0x07) & 0x20) << 4;
2067 htotal |= (NVReadVgaCrtc(dev, 0, 0x25) & 0x01) << 10; 2060 htotal |= (NVReadVgaCrtc(dev, 0, 0x25) & 0x01) << 10;
2068 htotal |= (NVReadVgaCrtc(dev, 0, 0x41) & 0x01) << 11; 2061 htotal |= (NVReadVgaCrtc(dev, 0, 0x41) & 0x01) << 11;
2069
2070 return (htotal != 0); 2062 return (htotal != 0);
2071} 2063}
2072 2064
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 7ff10711a4d0..4b1afb131380 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -255,7 +255,7 @@ set_placement_range(struct nouveau_bo *nvbo, uint32_t type)
255{ 255{
256 struct nouveau_drm *drm = nouveau_bdev(nvbo->bo.bdev); 256 struct nouveau_drm *drm = nouveau_bdev(nvbo->bo.bdev);
257 struct nouveau_fb *pfb = nouveau_fb(drm->device); 257 struct nouveau_fb *pfb = nouveau_fb(drm->device);
258 u32 vram_pages = pfb->ram.size >> PAGE_SHIFT; 258 u32 vram_pages = pfb->ram->size >> PAGE_SHIFT;
259 259
260 if (nv_device(drm->device)->card_type == NV_10 && 260 if (nv_device(drm->device)->card_type == NV_10 &&
261 nvbo->tile_mode && (type & TTM_PL_FLAG_VRAM) && 261 nvbo->tile_mode && (type & TTM_PL_FLAG_VRAM) &&
@@ -968,7 +968,7 @@ nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, bool intr,
968 bool no_wait_gpu, struct ttm_mem_reg *new_mem) 968 bool no_wait_gpu, struct ttm_mem_reg *new_mem)
969{ 969{
970 struct nouveau_drm *drm = nouveau_bdev(bo->bdev); 970 struct nouveau_drm *drm = nouveau_bdev(bo->bdev);
971 struct nouveau_channel *chan = chan = drm->channel; 971 struct nouveau_channel *chan = chan = drm->ttm.chan;
972 struct nouveau_bo *nvbo = nouveau_bo(bo); 972 struct nouveau_bo *nvbo = nouveau_bo(bo);
973 struct ttm_mem_reg *old_mem = &bo->mem; 973 struct ttm_mem_reg *old_mem = &bo->mem;
974 int ret; 974 int ret;
@@ -1052,6 +1052,7 @@ nouveau_bo_move_init(struct nouveau_drm *drm)
1052 } 1052 }
1053 1053
1054 drm->ttm.move = mthd->exec; 1054 drm->ttm.move = mthd->exec;
1055 drm->ttm.chan = chan;
1055 name = mthd->name; 1056 name = mthd->name;
1056 break; 1057 break;
1057 } 1058 }
@@ -1550,13 +1551,8 @@ void
1550nouveau_bo_vma_del(struct nouveau_bo *nvbo, struct nouveau_vma *vma) 1551nouveau_bo_vma_del(struct nouveau_bo *nvbo, struct nouveau_vma *vma)
1551{ 1552{
1552 if (vma->node) { 1553 if (vma->node) {
1553 if (nvbo->bo.mem.mem_type != TTM_PL_SYSTEM) { 1554 if (nvbo->bo.mem.mem_type != TTM_PL_SYSTEM)
1554 spin_lock(&nvbo->bo.bdev->fence_lock);
1555 ttm_bo_wait(&nvbo->bo, false, false, false);
1556 spin_unlock(&nvbo->bo.bdev->fence_lock);
1557 nouveau_vm_unmap(vma); 1555 nouveau_vm_unmap(vma);
1558 }
1559
1560 nouveau_vm_put(vma); 1556 nouveau_vm_put(vma);
1561 list_del(&vma->head); 1557 list_del(&vma->head);
1562 } 1558 }
diff --git a/drivers/gpu/drm/nouveau/nouveau_chan.c b/drivers/gpu/drm/nouveau/nouveau_chan.c
index eaa80a2b81ee..e84f4c32331b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_chan.c
+++ b/drivers/gpu/drm/nouveau/nouveau_chan.c
@@ -147,7 +147,7 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nouveau_cli *cli,
147 args.limit = client->vm->vmm->limit - 1; 147 args.limit = client->vm->vmm->limit - 1;
148 } else 148 } else
149 if (chan->push.buffer->bo.mem.mem_type == TTM_PL_VRAM) { 149 if (chan->push.buffer->bo.mem.mem_type == TTM_PL_VRAM) {
150 u64 limit = pfb->ram.size - imem->reserved - 1; 150 u64 limit = pfb->ram->size - imem->reserved - 1;
151 if (device->card_type == NV_04) { 151 if (device->card_type == NV_04) {
152 /* nv04 vram pushbuf hack, retarget to its location in 152 /* nv04 vram pushbuf hack, retarget to its location in
153 * the framebuffer bar rather than direct vram access.. 153 * the framebuffer bar rather than direct vram access..
@@ -282,7 +282,7 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart)
282 } else { 282 } else {
283 args.flags = NV_DMA_TARGET_VRAM | NV_DMA_ACCESS_RDWR; 283 args.flags = NV_DMA_TARGET_VRAM | NV_DMA_ACCESS_RDWR;
284 args.start = 0; 284 args.start = 0;
285 args.limit = pfb->ram.size - imem->reserved - 1; 285 args.limit = pfb->ram->size - imem->reserved - 1;
286 } 286 }
287 287
288 ret = nouveau_object_new(nv_object(client), chan->handle, vram, 288 ret = nouveau_object_new(nv_object(client), chan->handle, vram,
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index f17dc2ab03ec..708b2d1c0037 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -26,6 +26,7 @@
26 26
27#include <drm/drmP.h> 27#include <drm/drmP.h>
28#include <drm/drm_crtc_helper.h> 28#include <drm/drm_crtc_helper.h>
29#include <drm/ttm/ttm_execbuf_util.h>
29 30
30#include "nouveau_fbcon.h" 31#include "nouveau_fbcon.h"
31#include "dispnv04/hw.h" 32#include "dispnv04/hw.h"
@@ -332,10 +333,15 @@ nouveau_display_create(struct drm_device *dev)
332 333
333 if (nouveau_modeset == 1 || 334 if (nouveau_modeset == 1 ||
334 (nouveau_modeset < 0 && pclass == PCI_CLASS_DISPLAY_VGA)) { 335 (nouveau_modeset < 0 && pclass == PCI_CLASS_DISPLAY_VGA)) {
335 if (nv_device(drm->device)->card_type < NV_50) 336 if (drm->vbios.dcb.entries) {
336 ret = nv04_display_create(dev); 337 if (nv_device(drm->device)->card_type < NV_50)
337 else 338 ret = nv04_display_create(dev);
338 ret = nv50_display_create(dev); 339 else
340 ret = nv50_display_create(dev);
341 } else {
342 ret = 0;
343 }
344
339 if (ret) 345 if (ret)
340 goto disp_create_err; 346 goto disp_create_err;
341 347
@@ -457,51 +463,6 @@ nouveau_display_resume(struct drm_device *dev)
457} 463}
458 464
459static int 465static int
460nouveau_page_flip_reserve(struct nouveau_bo *old_bo,
461 struct nouveau_bo *new_bo)
462{
463 int ret;
464
465 ret = nouveau_bo_pin(new_bo, TTM_PL_FLAG_VRAM);
466 if (ret)
467 return ret;
468
469 ret = ttm_bo_reserve(&new_bo->bo, false, false, false, 0);
470 if (ret)
471 goto fail;
472
473 if (likely(old_bo != new_bo)) {
474 ret = ttm_bo_reserve(&old_bo->bo, false, false, false, 0);
475 if (ret)
476 goto fail_unreserve;
477 }
478
479 return 0;
480
481fail_unreserve:
482 ttm_bo_unreserve(&new_bo->bo);
483fail:
484 nouveau_bo_unpin(new_bo);
485 return ret;
486}
487
488static void
489nouveau_page_flip_unreserve(struct nouveau_bo *old_bo,
490 struct nouveau_bo *new_bo,
491 struct nouveau_fence *fence)
492{
493 nouveau_bo_fence(new_bo, fence);
494 ttm_bo_unreserve(&new_bo->bo);
495
496 if (likely(old_bo != new_bo)) {
497 nouveau_bo_fence(old_bo, fence);
498 ttm_bo_unreserve(&old_bo->bo);
499 }
500
501 nouveau_bo_unpin(old_bo);
502}
503
504static int
505nouveau_page_flip_emit(struct nouveau_channel *chan, 466nouveau_page_flip_emit(struct nouveau_channel *chan,
506 struct nouveau_bo *old_bo, 467 struct nouveau_bo *old_bo,
507 struct nouveau_bo *new_bo, 468 struct nouveau_bo *new_bo,
@@ -563,6 +524,9 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
563 struct nouveau_page_flip_state *s; 524 struct nouveau_page_flip_state *s;
564 struct nouveau_channel *chan = NULL; 525 struct nouveau_channel *chan = NULL;
565 struct nouveau_fence *fence; 526 struct nouveau_fence *fence;
527 struct list_head res;
528 struct ttm_validate_buffer res_val[2];
529 struct ww_acquire_ctx ticket;
566 int ret; 530 int ret;
567 531
568 if (!drm->channel) 532 if (!drm->channel)
@@ -572,25 +536,43 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
572 if (!s) 536 if (!s)
573 return -ENOMEM; 537 return -ENOMEM;
574 538
575 /* Don't let the buffers go away while we flip */
576 ret = nouveau_page_flip_reserve(old_bo, new_bo);
577 if (ret)
578 goto fail_free;
579
580 /* Initialize a page flip struct */
581 *s = (struct nouveau_page_flip_state)
582 { { }, event, nouveau_crtc(crtc)->index,
583 fb->bits_per_pixel, fb->pitches[0], crtc->x, crtc->y,
584 new_bo->bo.offset };
585
586 /* Choose the channel the flip will be handled in */ 539 /* Choose the channel the flip will be handled in */
540 spin_lock(&old_bo->bo.bdev->fence_lock);
587 fence = new_bo->bo.sync_obj; 541 fence = new_bo->bo.sync_obj;
588 if (fence) 542 if (fence)
589 chan = fence->channel; 543 chan = fence->channel;
590 if (!chan) 544 if (!chan)
591 chan = drm->channel; 545 chan = drm->channel;
546 spin_unlock(&old_bo->bo.bdev->fence_lock);
547
592 mutex_lock(&chan->cli->mutex); 548 mutex_lock(&chan->cli->mutex);
593 549
550 if (new_bo != old_bo) {
551 ret = nouveau_bo_pin(new_bo, TTM_PL_FLAG_VRAM);
552 if (likely(!ret)) {
553 res_val[0].bo = &old_bo->bo;
554 res_val[1].bo = &new_bo->bo;
555 INIT_LIST_HEAD(&res);
556 list_add_tail(&res_val[0].head, &res);
557 list_add_tail(&res_val[1].head, &res);
558 ret = ttm_eu_reserve_buffers(&ticket, &res);
559 if (ret)
560 nouveau_bo_unpin(new_bo);
561 }
562 } else
563 ret = ttm_bo_reserve(&new_bo->bo, false, false, false, 0);
564
565 if (ret) {
566 mutex_unlock(&chan->cli->mutex);
567 goto fail_free;
568 }
569
570 /* Initialize a page flip struct */
571 *s = (struct nouveau_page_flip_state)
572 { { }, event, nouveau_crtc(crtc)->index,
573 fb->bits_per_pixel, fb->pitches[0], crtc->x, crtc->y,
574 new_bo->bo.offset };
575
594 /* Emit a page flip */ 576 /* Emit a page flip */
595 if (nv_device(drm->device)->card_type >= NV_50) { 577 if (nv_device(drm->device)->card_type >= NV_50) {
596 ret = nv50_display_flip_next(crtc, fb, chan, 0); 578 ret = nv50_display_flip_next(crtc, fb, chan, 0);
@@ -608,12 +590,22 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
608 /* Update the crtc struct and cleanup */ 590 /* Update the crtc struct and cleanup */
609 crtc->fb = fb; 591 crtc->fb = fb;
610 592
611 nouveau_page_flip_unreserve(old_bo, new_bo, fence); 593 if (old_bo != new_bo) {
594 ttm_eu_fence_buffer_objects(&ticket, &res, fence);
595 nouveau_bo_unpin(old_bo);
596 } else {
597 nouveau_bo_fence(new_bo, fence);
598 ttm_bo_unreserve(&new_bo->bo);
599 }
612 nouveau_fence_unref(&fence); 600 nouveau_fence_unref(&fence);
613 return 0; 601 return 0;
614 602
615fail_unreserve: 603fail_unreserve:
616 nouveau_page_flip_unreserve(old_bo, new_bo, NULL); 604 if (old_bo != new_bo) {
605 ttm_eu_backoff_reservation(&ticket, &res);
606 nouveau_bo_unpin(new_bo);
607 } else
608 ttm_bo_unreserve(&new_bo->bo);
617fail_free: 609fail_free:
618 kfree(s); 610 kfree(s);
619 return ret; 611 return ret;
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 383f4e6ea9d1..218a4b522fe5 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -702,6 +702,7 @@ driver = {
702 .gem_prime_export = drm_gem_prime_export, 702 .gem_prime_export = drm_gem_prime_export,
703 .gem_prime_import = drm_gem_prime_import, 703 .gem_prime_import = drm_gem_prime_import,
704 .gem_prime_pin = nouveau_gem_prime_pin, 704 .gem_prime_pin = nouveau_gem_prime_pin,
705 .gem_prime_unpin = nouveau_gem_prime_unpin,
705 .gem_prime_get_sg_table = nouveau_gem_prime_get_sg_table, 706 .gem_prime_get_sg_table = nouveau_gem_prime_get_sg_table,
706 .gem_prime_import_sg_table = nouveau_gem_prime_import_sg_table, 707 .gem_prime_import_sg_table = nouveau_gem_prime_import_sg_table,
707 .gem_prime_vmap = nouveau_gem_prime_vmap, 708 .gem_prime_vmap = nouveau_gem_prime_vmap,
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.h b/drivers/gpu/drm/nouveau/nouveau_drm.h
index f2b30f89dee0..41ff7e0d403a 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.h
@@ -96,6 +96,7 @@ struct nouveau_drm {
96 int (*move)(struct nouveau_channel *, 96 int (*move)(struct nouveau_channel *,
97 struct ttm_buffer_object *, 97 struct ttm_buffer_object *,
98 struct ttm_mem_reg *, struct ttm_mem_reg *); 98 struct ttm_mem_reg *, struct ttm_mem_reg *);
99 struct nouveau_channel *chan;
99 int mtrr; 100 int mtrr;
100 } ttm; 101 } ttm;
101 102
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
index b03531781580..9352010030e9 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
@@ -289,16 +289,13 @@ nouveau_fbcon_create(struct drm_fb_helper *helper,
289 ret = nouveau_bo_pin(nvbo, TTM_PL_FLAG_VRAM); 289 ret = nouveau_bo_pin(nvbo, TTM_PL_FLAG_VRAM);
290 if (ret) { 290 if (ret) {
291 NV_ERROR(drm, "failed to pin fb: %d\n", ret); 291 NV_ERROR(drm, "failed to pin fb: %d\n", ret);
292 nouveau_bo_ref(NULL, &nvbo); 292 goto out_unref;
293 goto out;
294 } 293 }
295 294
296 ret = nouveau_bo_map(nvbo); 295 ret = nouveau_bo_map(nvbo);
297 if (ret) { 296 if (ret) {
298 NV_ERROR(drm, "failed to map fb: %d\n", ret); 297 NV_ERROR(drm, "failed to map fb: %d\n", ret);
299 nouveau_bo_unpin(nvbo); 298 goto out_unpin;
300 nouveau_bo_ref(NULL, &nvbo);
301 goto out;
302 } 299 }
303 300
304 chan = nouveau_nofbaccel ? NULL : drm->channel; 301 chan = nouveau_nofbaccel ? NULL : drm->channel;
@@ -316,13 +313,14 @@ nouveau_fbcon_create(struct drm_fb_helper *helper,
316 info = framebuffer_alloc(0, &pdev->dev); 313 info = framebuffer_alloc(0, &pdev->dev);
317 if (!info) { 314 if (!info) {
318 ret = -ENOMEM; 315 ret = -ENOMEM;
319 goto out_unref; 316 goto out_unlock;
320 } 317 }
321 318
322 ret = fb_alloc_cmap(&info->cmap, 256, 0); 319 ret = fb_alloc_cmap(&info->cmap, 256, 0);
323 if (ret) { 320 if (ret) {
324 ret = -ENOMEM; 321 ret = -ENOMEM;
325 goto out_unref; 322 framebuffer_release(info);
323 goto out_unlock;
326 } 324 }
327 325
328 info->par = fbcon; 326 info->par = fbcon;
@@ -337,7 +335,7 @@ nouveau_fbcon_create(struct drm_fb_helper *helper,
337 fbcon->helper.fbdev = info; 335 fbcon->helper.fbdev = info;
338 336
339 strcpy(info->fix.id, "nouveaufb"); 337 strcpy(info->fix.id, "nouveaufb");
340 if (nouveau_nofbaccel) 338 if (!chan)
341 info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_DISABLED; 339 info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_DISABLED;
342 else 340 else
343 info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_COPYAREA | 341 info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_COPYAREA |
@@ -383,8 +381,14 @@ nouveau_fbcon_create(struct drm_fb_helper *helper,
383 vga_switcheroo_client_fb_set(dev->pdev, info); 381 vga_switcheroo_client_fb_set(dev->pdev, info);
384 return 0; 382 return 0;
385 383
386out_unref: 384out_unlock:
387 mutex_unlock(&dev->struct_mutex); 385 mutex_unlock(&dev->struct_mutex);
386 if (chan)
387 nouveau_bo_vma_del(nvbo, &fbcon->nouveau_fb.vma);
388out_unpin:
389 nouveau_bo_unpin(nvbo);
390out_unref:
391 nouveau_bo_ref(NULL, &nvbo);
388out: 392out:
389 return ret; 393 return ret;
390} 394}
@@ -413,6 +417,7 @@ nouveau_fbcon_destroy(struct drm_device *dev, struct nouveau_fbdev *fbcon)
413 if (nouveau_fb->nvbo) { 417 if (nouveau_fb->nvbo) {
414 nouveau_bo_unmap(nouveau_fb->nvbo); 418 nouveau_bo_unmap(nouveau_fb->nvbo);
415 nouveau_bo_vma_del(nouveau_fb->nvbo, &nouveau_fb->vma); 419 nouveau_bo_vma_del(nouveau_fb->nvbo, &nouveau_fb->vma);
420 nouveau_bo_unpin(nouveau_fb->nvbo);
416 drm_gem_object_unreference_unlocked(nouveau_fb->nvbo->gem); 421 drm_gem_object_unreference_unlocked(nouveau_fb->nvbo->gem);
417 nouveau_fb->nvbo = NULL; 422 nouveau_fb->nvbo = NULL;
418 } 423 }
@@ -467,10 +472,10 @@ nouveau_fbcon_init(struct drm_device *dev)
467 472
468 drm_fb_helper_single_add_all_connectors(&fbcon->helper); 473 drm_fb_helper_single_add_all_connectors(&fbcon->helper);
469 474
470 if (pfb->ram.size <= 32 * 1024 * 1024) 475 if (pfb->ram->size <= 32 * 1024 * 1024)
471 preferred_bpp = 8; 476 preferred_bpp = 8;
472 else 477 else
473 if (pfb->ram.size <= 64 * 1024 * 1024) 478 if (pfb->ram->size <= 64 * 1024 * 1024)
474 preferred_bpp = 16; 479 preferred_bpp = 16;
475 else 480 else
476 preferred_bpp = 32; 481 preferred_bpp = 32;
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c
index 6c946837a0aa..1680d9187bab 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fence.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fence.c
@@ -35,15 +35,34 @@
35 35
36#include <engine/fifo.h> 36#include <engine/fifo.h>
37 37
38struct fence_work {
39 struct work_struct base;
40 struct list_head head;
41 void (*func)(void *);
42 void *data;
43};
44
45static void
46nouveau_fence_signal(struct nouveau_fence *fence)
47{
48 struct fence_work *work, *temp;
49
50 list_for_each_entry_safe(work, temp, &fence->work, head) {
51 schedule_work(&work->base);
52 list_del(&work->head);
53 }
54
55 fence->channel = NULL;
56 list_del(&fence->head);
57}
58
38void 59void
39nouveau_fence_context_del(struct nouveau_fence_chan *fctx) 60nouveau_fence_context_del(struct nouveau_fence_chan *fctx)
40{ 61{
41 struct nouveau_fence *fence, *fnext; 62 struct nouveau_fence *fence, *fnext;
42 spin_lock(&fctx->lock); 63 spin_lock(&fctx->lock);
43 list_for_each_entry_safe(fence, fnext, &fctx->pending, head) { 64 list_for_each_entry_safe(fence, fnext, &fctx->pending, head) {
44 fence->channel = NULL; 65 nouveau_fence_signal(fence);
45 list_del(&fence->head);
46 nouveau_fence_unref(&fence);
47 } 66 }
48 spin_unlock(&fctx->lock); 67 spin_unlock(&fctx->lock);
49} 68}
@@ -57,6 +76,50 @@ nouveau_fence_context_new(struct nouveau_fence_chan *fctx)
57} 76}
58 77
59static void 78static void
79nouveau_fence_work_handler(struct work_struct *kwork)
80{
81 struct fence_work *work = container_of(kwork, typeof(*work), base);
82 work->func(work->data);
83 kfree(work);
84}
85
86void
87nouveau_fence_work(struct nouveau_fence *fence,
88 void (*func)(void *), void *data)
89{
90 struct nouveau_channel *chan = fence->channel;
91 struct nouveau_fence_chan *fctx;
92 struct fence_work *work = NULL;
93
94 if (nouveau_fence_done(fence)) {
95 func(data);
96 return;
97 }
98
99 fctx = chan->fence;
100 work = kmalloc(sizeof(*work), GFP_KERNEL);
101 if (!work) {
102 WARN_ON(nouveau_fence_wait(fence, false, false));
103 func(data);
104 return;
105 }
106
107 spin_lock(&fctx->lock);
108 if (!fence->channel) {
109 spin_unlock(&fctx->lock);
110 kfree(work);
111 func(data);
112 return;
113 }
114
115 INIT_WORK(&work->base, nouveau_fence_work_handler);
116 work->func = func;
117 work->data = data;
118 list_add(&work->head, &fence->work);
119 spin_unlock(&fctx->lock);
120}
121
122static void
60nouveau_fence_update(struct nouveau_channel *chan) 123nouveau_fence_update(struct nouveau_channel *chan)
61{ 124{
62 struct nouveau_fence_chan *fctx = chan->fence; 125 struct nouveau_fence_chan *fctx = chan->fence;
@@ -67,8 +130,7 @@ nouveau_fence_update(struct nouveau_channel *chan)
67 if (fctx->read(chan) < fence->sequence) 130 if (fctx->read(chan) < fence->sequence)
68 break; 131 break;
69 132
70 fence->channel = NULL; 133 nouveau_fence_signal(fence);
71 list_del(&fence->head);
72 nouveau_fence_unref(&fence); 134 nouveau_fence_unref(&fence);
73 } 135 }
74 spin_unlock(&fctx->lock); 136 spin_unlock(&fctx->lock);
@@ -265,6 +327,7 @@ nouveau_fence_new(struct nouveau_channel *chan, bool sysmem,
265 if (!fence) 327 if (!fence)
266 return -ENOMEM; 328 return -ENOMEM;
267 329
330 INIT_LIST_HEAD(&fence->work);
268 fence->sysmem = sysmem; 331 fence->sysmem = sysmem;
269 kref_init(&fence->kref); 332 kref_init(&fence->kref);
270 333
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.h b/drivers/gpu/drm/nouveau/nouveau_fence.h
index c89943407b52..c57bb61da58c 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fence.h
+++ b/drivers/gpu/drm/nouveau/nouveau_fence.h
@@ -5,6 +5,7 @@ struct nouveau_drm;
5 5
6struct nouveau_fence { 6struct nouveau_fence {
7 struct list_head head; 7 struct list_head head;
8 struct list_head work;
8 struct kref kref; 9 struct kref kref;
9 10
10 bool sysmem; 11 bool sysmem;
@@ -22,6 +23,7 @@ void nouveau_fence_unref(struct nouveau_fence **);
22 23
23int nouveau_fence_emit(struct nouveau_fence *, struct nouveau_channel *); 24int nouveau_fence_emit(struct nouveau_fence *, struct nouveau_channel *);
24bool nouveau_fence_done(struct nouveau_fence *); 25bool nouveau_fence_done(struct nouveau_fence *);
26void nouveau_fence_work(struct nouveau_fence *, void (*)(void *), void *);
25int nouveau_fence_wait(struct nouveau_fence *, bool lazy, bool intr); 27int nouveau_fence_wait(struct nouveau_fence *, bool lazy, bool intr);
26int nouveau_fence_sync(struct nouveau_fence *, struct nouveau_channel *); 28int nouveau_fence_sync(struct nouveau_fence *, struct nouveau_channel *);
27 29
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
index b4b4d0c1f4af..e72d09c068a8 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -50,7 +50,8 @@ nouveau_gem_object_del(struct drm_gem_object *gem)
50 return; 50 return;
51 nvbo->gem = NULL; 51 nvbo->gem = NULL;
52 52
53 if (unlikely(nvbo->pin_refcnt)) { 53 /* Lockdep hates you for doing reserve with gem object lock held */
54 if (WARN_ON_ONCE(nvbo->pin_refcnt)) {
54 nvbo->pin_refcnt = 1; 55 nvbo->pin_refcnt = 1;
55 nouveau_bo_unpin(nvbo); 56 nouveau_bo_unpin(nvbo);
56 } 57 }
@@ -101,6 +102,41 @@ out:
101 return ret; 102 return ret;
102} 103}
103 104
105static void
106nouveau_gem_object_delete(void *data)
107{
108 struct nouveau_vma *vma = data;
109 nouveau_vm_unmap(vma);
110 nouveau_vm_put(vma);
111 kfree(vma);
112}
113
114static void
115nouveau_gem_object_unmap(struct nouveau_bo *nvbo, struct nouveau_vma *vma)
116{
117 const bool mapped = nvbo->bo.mem.mem_type != TTM_PL_SYSTEM;
118 struct nouveau_fence *fence = NULL;
119
120 list_del(&vma->head);
121
122 if (mapped) {
123 spin_lock(&nvbo->bo.bdev->fence_lock);
124 if (nvbo->bo.sync_obj)
125 fence = nouveau_fence_ref(nvbo->bo.sync_obj);
126 spin_unlock(&nvbo->bo.bdev->fence_lock);
127 }
128
129 if (fence) {
130 nouveau_fence_work(fence, nouveau_gem_object_delete, vma);
131 } else {
132 if (mapped)
133 nouveau_vm_unmap(vma);
134 nouveau_vm_put(vma);
135 kfree(vma);
136 }
137 nouveau_fence_unref(&fence);
138}
139
104void 140void
105nouveau_gem_object_close(struct drm_gem_object *gem, struct drm_file *file_priv) 141nouveau_gem_object_close(struct drm_gem_object *gem, struct drm_file *file_priv)
106{ 142{
@@ -118,10 +154,8 @@ nouveau_gem_object_close(struct drm_gem_object *gem, struct drm_file *file_priv)
118 154
119 vma = nouveau_bo_vma_find(nvbo, cli->base.vm); 155 vma = nouveau_bo_vma_find(nvbo, cli->base.vm);
120 if (vma) { 156 if (vma) {
121 if (--vma->refcount == 0) { 157 if (--vma->refcount == 0)
122 nouveau_bo_vma_del(nvbo, vma); 158 nouveau_gem_object_unmap(nvbo, vma);
123 kfree(vma);
124 }
125 } 159 }
126 ttm_bo_unreserve(&nvbo->bo); 160 ttm_bo_unreserve(&nvbo->bo);
127} 161}
@@ -276,10 +310,12 @@ struct validate_op {
276 struct list_head vram_list; 310 struct list_head vram_list;
277 struct list_head gart_list; 311 struct list_head gart_list;
278 struct list_head both_list; 312 struct list_head both_list;
313 struct ww_acquire_ctx ticket;
279}; 314};
280 315
281static void 316static void
282validate_fini_list(struct list_head *list, struct nouveau_fence *fence) 317validate_fini_list(struct list_head *list, struct nouveau_fence *fence,
318 struct ww_acquire_ctx *ticket)
283{ 319{
284 struct list_head *entry, *tmp; 320 struct list_head *entry, *tmp;
285 struct nouveau_bo *nvbo; 321 struct nouveau_bo *nvbo;
@@ -296,17 +332,24 @@ validate_fini_list(struct list_head *list, struct nouveau_fence *fence)
296 332
297 list_del(&nvbo->entry); 333 list_del(&nvbo->entry);
298 nvbo->reserved_by = NULL; 334 nvbo->reserved_by = NULL;
299 ttm_bo_unreserve(&nvbo->bo); 335 ttm_bo_unreserve_ticket(&nvbo->bo, ticket);
300 drm_gem_object_unreference_unlocked(nvbo->gem); 336 drm_gem_object_unreference_unlocked(nvbo->gem);
301 } 337 }
302} 338}
303 339
304static void 340static void
305validate_fini(struct validate_op *op, struct nouveau_fence* fence) 341validate_fini_no_ticket(struct validate_op *op, struct nouveau_fence *fence)
306{ 342{
307 validate_fini_list(&op->vram_list, fence); 343 validate_fini_list(&op->vram_list, fence, &op->ticket);
308 validate_fini_list(&op->gart_list, fence); 344 validate_fini_list(&op->gart_list, fence, &op->ticket);
309 validate_fini_list(&op->both_list, fence); 345 validate_fini_list(&op->both_list, fence, &op->ticket);
346}
347
348static void
349validate_fini(struct validate_op *op, struct nouveau_fence *fence)
350{
351 validate_fini_no_ticket(op, fence);
352 ww_acquire_fini(&op->ticket);
310} 353}
311 354
312static int 355static int
@@ -316,13 +359,11 @@ validate_init(struct nouveau_channel *chan, struct drm_file *file_priv,
316{ 359{
317 struct nouveau_cli *cli = nouveau_cli(file_priv); 360 struct nouveau_cli *cli = nouveau_cli(file_priv);
318 struct drm_device *dev = chan->drm->dev; 361 struct drm_device *dev = chan->drm->dev;
319 struct nouveau_drm *drm = nouveau_drm(dev);
320 uint32_t sequence;
321 int trycnt = 0; 362 int trycnt = 0;
322 int ret, i; 363 int ret, i;
323 struct nouveau_bo *res_bo = NULL; 364 struct nouveau_bo *res_bo = NULL;
324 365
325 sequence = atomic_add_return(1, &drm->ttm.validate_sequence); 366 ww_acquire_init(&op->ticket, &reservation_ww_class);
326retry: 367retry:
327 if (++trycnt > 100000) { 368 if (++trycnt > 100000) {
328 NV_ERROR(cli, "%s failed and gave up.\n", __func__); 369 NV_ERROR(cli, "%s failed and gave up.\n", __func__);
@@ -337,6 +378,7 @@ retry:
337 gem = drm_gem_object_lookup(dev, file_priv, b->handle); 378 gem = drm_gem_object_lookup(dev, file_priv, b->handle);
338 if (!gem) { 379 if (!gem) {
339 NV_ERROR(cli, "Unknown handle 0x%08x\n", b->handle); 380 NV_ERROR(cli, "Unknown handle 0x%08x\n", b->handle);
381 ww_acquire_done(&op->ticket);
340 validate_fini(op, NULL); 382 validate_fini(op, NULL);
341 return -ENOENT; 383 return -ENOENT;
342 } 384 }
@@ -351,21 +393,23 @@ retry:
351 NV_ERROR(cli, "multiple instances of buffer %d on " 393 NV_ERROR(cli, "multiple instances of buffer %d on "
352 "validation list\n", b->handle); 394 "validation list\n", b->handle);
353 drm_gem_object_unreference_unlocked(gem); 395 drm_gem_object_unreference_unlocked(gem);
396 ww_acquire_done(&op->ticket);
354 validate_fini(op, NULL); 397 validate_fini(op, NULL);
355 return -EINVAL; 398 return -EINVAL;
356 } 399 }
357 400
358 ret = ttm_bo_reserve(&nvbo->bo, true, false, true, sequence); 401 ret = ttm_bo_reserve(&nvbo->bo, true, false, true, &op->ticket);
359 if (ret) { 402 if (ret) {
360 validate_fini(op, NULL); 403 validate_fini_no_ticket(op, NULL);
361 if (unlikely(ret == -EAGAIN)) { 404 if (unlikely(ret == -EDEADLK)) {
362 sequence = atomic_add_return(1, &drm->ttm.validate_sequence);
363 ret = ttm_bo_reserve_slowpath(&nvbo->bo, true, 405 ret = ttm_bo_reserve_slowpath(&nvbo->bo, true,
364 sequence); 406 &op->ticket);
365 if (!ret) 407 if (!ret)
366 res_bo = nvbo; 408 res_bo = nvbo;
367 } 409 }
368 if (unlikely(ret)) { 410 if (unlikely(ret)) {
411 ww_acquire_done(&op->ticket);
412 ww_acquire_fini(&op->ticket);
369 drm_gem_object_unreference_unlocked(gem); 413 drm_gem_object_unreference_unlocked(gem);
370 if (ret != -ERESTARTSYS) 414 if (ret != -ERESTARTSYS)
371 NV_ERROR(cli, "fail reserve\n"); 415 NV_ERROR(cli, "fail reserve\n");
@@ -389,6 +433,7 @@ retry:
389 NV_ERROR(cli, "invalid valid domains: 0x%08x\n", 433 NV_ERROR(cli, "invalid valid domains: 0x%08x\n",
390 b->valid_domains); 434 b->valid_domains);
391 list_add_tail(&nvbo->entry, &op->both_list); 435 list_add_tail(&nvbo->entry, &op->both_list);
436 ww_acquire_done(&op->ticket);
392 validate_fini(op, NULL); 437 validate_fini(op, NULL);
393 return -EINVAL; 438 return -EINVAL;
394 } 439 }
@@ -396,6 +441,7 @@ retry:
396 goto retry; 441 goto retry;
397 } 442 }
398 443
444 ww_acquire_done(&op->ticket);
399 return 0; 445 return 0;
400} 446}
401 447
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.h b/drivers/gpu/drm/nouveau/nouveau_gem.h
index 8d7a3f0aeb86..502e4290aa8f 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.h
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.h
@@ -36,6 +36,7 @@ extern int nouveau_gem_ioctl_info(struct drm_device *, void *,
36 struct drm_file *); 36 struct drm_file *);
37 37
38extern int nouveau_gem_prime_pin(struct drm_gem_object *); 38extern int nouveau_gem_prime_pin(struct drm_gem_object *);
39extern void nouveau_gem_prime_unpin(struct drm_gem_object *);
39extern struct sg_table *nouveau_gem_prime_get_sg_table(struct drm_gem_object *); 40extern struct sg_table *nouveau_gem_prime_get_sg_table(struct drm_gem_object *);
40extern struct drm_gem_object *nouveau_gem_prime_import_sg_table( 41extern struct drm_gem_object *nouveau_gem_prime_import_sg_table(
41 struct drm_device *, size_t size, struct sg_table *); 42 struct drm_device *, size_t size, struct sg_table *);
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c
index 7e0ff10a2759..4f6a572f2258 100644
--- a/drivers/gpu/drm/nouveau/nouveau_mem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_mem.c
@@ -125,7 +125,7 @@ nv50_mem_timing_calc(struct drm_device *dev, u32 freq,
125 t->reg[7] = 0x4000202 | (e->tCL - 1) << 16; 125 t->reg[7] = 0x4000202 | (e->tCL - 1) << 16;
126 126
127 /* XXX: P.version == 1 only has DDR2 and GDDR3? */ 127 /* XXX: P.version == 1 only has DDR2 and GDDR3? */
128 if (pfb->ram.type == NV_MEM_TYPE_DDR2) { 128 if (pfb->ram->type == NV_MEM_TYPE_DDR2) {
129 t->reg[5] |= (e->tCL + 3) << 8; 129 t->reg[5] |= (e->tCL + 3) << 8;
130 t->reg[6] |= (t->tCWL - 2) << 8; 130 t->reg[6] |= (t->tCWL - 2) << 8;
131 t->reg[8] |= (e->tCL - 4); 131 t->reg[8] |= (e->tCL - 4);
@@ -428,7 +428,7 @@ nouveau_mem_timing_calc(struct drm_device *dev, u32 freq,
428 break; 428 break;
429 } 429 }
430 430
431 switch (pfb->ram.type * !ret) { 431 switch (pfb->ram->type * !ret) {
432 case NV_MEM_TYPE_GDDR3: 432 case NV_MEM_TYPE_GDDR3:
433 ret = nouveau_mem_gddr3_mr(dev, freq, e, len, boot, t); 433 ret = nouveau_mem_gddr3_mr(dev, freq, e, len, boot, t);
434 break; 434 break;
@@ -455,7 +455,7 @@ nouveau_mem_timing_calc(struct drm_device *dev, u32 freq,
455 else 455 else
456 dll_off = !!(ramcfg[2] & 0x40); 456 dll_off = !!(ramcfg[2] & 0x40);
457 457
458 switch (pfb->ram.type) { 458 switch (pfb->ram->type) {
459 case NV_MEM_TYPE_GDDR3: 459 case NV_MEM_TYPE_GDDR3:
460 t->mr[1] &= ~0x00000040; 460 t->mr[1] &= ~0x00000040;
461 t->mr[1] |= 0x00000040 * dll_off; 461 t->mr[1] |= 0x00000040 * dll_off;
@@ -522,7 +522,7 @@ nouveau_mem_timing_read(struct drm_device *dev, struct nouveau_pm_memtiming *t)
522 t->odt = 0; 522 t->odt = 0;
523 t->drive_strength = 0; 523 t->drive_strength = 0;
524 524
525 switch (pfb->ram.type) { 525 switch (pfb->ram->type) {
526 case NV_MEM_TYPE_DDR3: 526 case NV_MEM_TYPE_DDR3:
527 t->odt |= (t->mr[1] & 0x200) >> 7; 527 t->odt |= (t->mr[1] & 0x200) >> 7;
528 case NV_MEM_TYPE_DDR2: 528 case NV_MEM_TYPE_DDR2:
@@ -551,7 +551,7 @@ nouveau_mem_exec(struct nouveau_mem_exec_func *exec,
551 u32 mr[3] = { info->mr[0], info->mr[1], info->mr[2] }; 551 u32 mr[3] = { info->mr[0], info->mr[1], info->mr[2] };
552 u32 mr1_dlloff; 552 u32 mr1_dlloff;
553 553
554 switch (pfb->ram.type) { 554 switch (pfb->ram->type) {
555 case NV_MEM_TYPE_DDR2: 555 case NV_MEM_TYPE_DDR2:
556 tDLLK = 2000; 556 tDLLK = 2000;
557 mr1_dlloff = 0x00000001; 557 mr1_dlloff = 0x00000001;
@@ -572,7 +572,7 @@ nouveau_mem_exec(struct nouveau_mem_exec_func *exec,
572 } 572 }
573 573
574 /* fetch current MRs */ 574 /* fetch current MRs */
575 switch (pfb->ram.type) { 575 switch (pfb->ram->type) {
576 case NV_MEM_TYPE_GDDR3: 576 case NV_MEM_TYPE_GDDR3:
577 case NV_MEM_TYPE_DDR3: 577 case NV_MEM_TYPE_DDR3:
578 mr[2] = exec->mrg(exec, 2); 578 mr[2] = exec->mrg(exec, 2);
@@ -639,7 +639,7 @@ nouveau_mem_exec(struct nouveau_mem_exec_func *exec,
639 exec->mrs (exec, 0, info->mr[0] | 0x00000000); 639 exec->mrs (exec, 0, info->mr[0] | 0x00000000);
640 exec->wait(exec, tMRD); 640 exec->wait(exec, tMRD);
641 exec->wait(exec, tDLLK); 641 exec->wait(exec, tDLLK);
642 if (pfb->ram.type == NV_MEM_TYPE_GDDR3) 642 if (pfb->ram->type == NV_MEM_TYPE_GDDR3)
643 exec->precharge(exec); 643 exec->precharge(exec);
644 } 644 }
645 645
diff --git a/drivers/gpu/drm/nouveau/nouveau_prime.c b/drivers/gpu/drm/nouveau/nouveau_prime.c
index f53e10874cae..e90468d5e5c0 100644
--- a/drivers/gpu/drm/nouveau/nouveau_prime.c
+++ b/drivers/gpu/drm/nouveau/nouveau_prime.c
@@ -84,7 +84,7 @@ struct drm_gem_object *nouveau_gem_prime_import_sg_table(struct drm_device *dev,
84int nouveau_gem_prime_pin(struct drm_gem_object *obj) 84int nouveau_gem_prime_pin(struct drm_gem_object *obj)
85{ 85{
86 struct nouveau_bo *nvbo = nouveau_gem_object(obj); 86 struct nouveau_bo *nvbo = nouveau_gem_object(obj);
87 int ret = 0; 87 int ret;
88 88
89 /* pin buffer into GTT */ 89 /* pin buffer into GTT */
90 ret = nouveau_bo_pin(nvbo, TTM_PL_FLAG_TT); 90 ret = nouveau_bo_pin(nvbo, TTM_PL_FLAG_TT);
@@ -93,3 +93,10 @@ int nouveau_gem_prime_pin(struct drm_gem_object *obj)
93 93
94 return 0; 94 return 0;
95} 95}
96
97void nouveau_gem_prime_unpin(struct drm_gem_object *obj)
98{
99 struct nouveau_bo *nvbo = nouveau_gem_object(obj);
100
101 nouveau_bo_unpin(nvbo);
102}
diff --git a/drivers/gpu/drm/nouveau/nouveau_ttm.c b/drivers/gpu/drm/nouveau/nouveau_ttm.c
index f19a15a3bc03..19e3757291fb 100644
--- a/drivers/gpu/drm/nouveau/nouveau_ttm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_ttm.c
@@ -69,7 +69,7 @@ nouveau_vram_manager_del(struct ttm_mem_type_manager *man,
69 struct nouveau_drm *drm = nouveau_bdev(man->bdev); 69 struct nouveau_drm *drm = nouveau_bdev(man->bdev);
70 struct nouveau_fb *pfb = nouveau_fb(drm->device); 70 struct nouveau_fb *pfb = nouveau_fb(drm->device);
71 nouveau_mem_node_cleanup(mem->mm_node); 71 nouveau_mem_node_cleanup(mem->mm_node);
72 pfb->ram.put(pfb, (struct nouveau_mem **)&mem->mm_node); 72 pfb->ram->put(pfb, (struct nouveau_mem **)&mem->mm_node);
73} 73}
74 74
75static int 75static int
@@ -88,7 +88,7 @@ nouveau_vram_manager_new(struct ttm_mem_type_manager *man,
88 if (nvbo->tile_flags & NOUVEAU_GEM_TILE_NONCONTIG) 88 if (nvbo->tile_flags & NOUVEAU_GEM_TILE_NONCONTIG)
89 size_nc = 1 << nvbo->page_shift; 89 size_nc = 1 << nvbo->page_shift;
90 90
91 ret = pfb->ram.get(pfb, mem->num_pages << PAGE_SHIFT, 91 ret = pfb->ram->get(pfb, mem->num_pages << PAGE_SHIFT,
92 mem->page_alignment << PAGE_SHIFT, size_nc, 92 mem->page_alignment << PAGE_SHIFT, size_nc,
93 (nvbo->tile_flags >> 8) & 0x3ff, &node); 93 (nvbo->tile_flags >> 8) & 0x3ff, &node);
94 if (ret) { 94 if (ret) {
@@ -111,7 +111,7 @@ nouveau_vram_manager_debug(struct ttm_mem_type_manager *man, const char *prefix)
111 struct nouveau_mm_node *r; 111 struct nouveau_mm_node *r;
112 u32 total = 0, free = 0; 112 u32 total = 0, free = 0;
113 113
114 mutex_lock(&mm->mutex); 114 mutex_lock(&nv_subdev(pfb)->mutex);
115 list_for_each_entry(r, &mm->nodes, nl_entry) { 115 list_for_each_entry(r, &mm->nodes, nl_entry) {
116 printk(KERN_DEBUG "%s %d: 0x%010llx 0x%010llx\n", 116 printk(KERN_DEBUG "%s %d: 0x%010llx 0x%010llx\n",
117 prefix, r->type, ((u64)r->offset << 12), 117 prefix, r->type, ((u64)r->offset << 12),
@@ -121,7 +121,7 @@ nouveau_vram_manager_debug(struct ttm_mem_type_manager *man, const char *prefix)
121 if (!r->type) 121 if (!r->type)
122 free += r->length; 122 free += r->length;
123 } 123 }
124 mutex_unlock(&mm->mutex); 124 mutex_unlock(&nv_subdev(pfb)->mutex);
125 125
126 printk(KERN_DEBUG "%s total: 0x%010llx free: 0x%010llx\n", 126 printk(KERN_DEBUG "%s total: 0x%010llx free: 0x%010llx\n",
127 prefix, (u64)total << 12, (u64)free << 12); 127 prefix, (u64)total << 12, (u64)free << 12);
@@ -168,9 +168,6 @@ nouveau_gart_manager_new(struct ttm_mem_type_manager *man,
168 struct nouveau_bo *nvbo = nouveau_bo(bo); 168 struct nouveau_bo *nvbo = nouveau_bo(bo);
169 struct nouveau_mem *node; 169 struct nouveau_mem *node;
170 170
171 if (unlikely((mem->num_pages << PAGE_SHIFT) >= 512 * 1024 * 1024))
172 return -ENOMEM;
173
174 node = kzalloc(sizeof(*node), GFP_KERNEL); 171 node = kzalloc(sizeof(*node), GFP_KERNEL);
175 if (!node) 172 if (!node)
176 return -ENOMEM; 173 return -ENOMEM;
@@ -386,7 +383,7 @@ nouveau_ttm_init(struct nouveau_drm *drm)
386 } 383 }
387 384
388 /* VRAM init */ 385 /* VRAM init */
389 drm->gem.vram_available = nouveau_fb(drm->device)->ram.size; 386 drm->gem.vram_available = nouveau_fb(drm->device)->ram->size;
390 drm->gem.vram_available -= nouveau_instmem(drm->device)->reserved; 387 drm->gem.vram_available -= nouveau_instmem(drm->device)->reserved;
391 388
392 ret = ttm_bo_init_mm(&drm->ttm.bdev, TTM_PL_VRAM, 389 ret = ttm_bo_init_mm(&drm->ttm.bdev, TTM_PL_VRAM,
@@ -396,15 +393,12 @@ nouveau_ttm_init(struct nouveau_drm *drm)
396 return ret; 393 return ret;
397 } 394 }
398 395
399 drm->ttm.mtrr = drm_mtrr_add(pci_resource_start(dev->pdev, 1), 396 drm->ttm.mtrr = arch_phys_wc_add(pci_resource_start(dev->pdev, 1),
400 pci_resource_len(dev->pdev, 1), 397 pci_resource_len(dev->pdev, 1));
401 DRM_MTRR_WC);
402 398
403 /* GART init */ 399 /* GART init */
404 if (drm->agp.stat != ENABLED) { 400 if (drm->agp.stat != ENABLED) {
405 drm->gem.gart_available = nouveau_vmmgr(drm->device)->limit; 401 drm->gem.gart_available = nouveau_vmmgr(drm->device)->limit;
406 if (drm->gem.gart_available > 512 * 1024 * 1024)
407 drm->gem.gart_available = 512 * 1024 * 1024;
408 } else { 402 } else {
409 drm->gem.gart_available = drm->agp.size; 403 drm->gem.gart_available = drm->agp.size;
410 } 404 }
@@ -433,10 +427,6 @@ nouveau_ttm_fini(struct nouveau_drm *drm)
433 427
434 nouveau_ttm_global_release(drm); 428 nouveau_ttm_global_release(drm);
435 429
436 if (drm->ttm.mtrr >= 0) { 430 arch_phys_wc_del(drm->ttm.mtrr);
437 drm_mtrr_del(drm->ttm.mtrr, 431 drm->ttm.mtrr = 0;
438 pci_resource_start(drm->dev->pdev, 1),
439 pci_resource_len(drm->dev->pdev, 1), DRM_MTRR_WC);
440 drm->ttm.mtrr = -1;
441 }
442} 432}
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index dd5e01f89f28..54dc6355b0c2 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -159,7 +159,7 @@ nv50_dmac_create_fbdma(struct nouveau_object *core, u32 parent)
159 .flags = NV_DMA_TARGET_VRAM | 159 .flags = NV_DMA_TARGET_VRAM |
160 NV_DMA_ACCESS_RDWR, 160 NV_DMA_ACCESS_RDWR,
161 .start = 0, 161 .start = 0,
162 .limit = pfb->ram.size - 1, 162 .limit = pfb->ram->size - 1,
163 .conf0 = NV50_DMA_CONF0_ENABLE | 163 .conf0 = NV50_DMA_CONF0_ENABLE |
164 NV50_DMA_CONF0_PART_256, 164 NV50_DMA_CONF0_PART_256,
165 }, sizeof(struct nv_dma_class), &object); 165 }, sizeof(struct nv_dma_class), &object);
@@ -172,7 +172,7 @@ nv50_dmac_create_fbdma(struct nouveau_object *core, u32 parent)
172 .flags = NV_DMA_TARGET_VRAM | 172 .flags = NV_DMA_TARGET_VRAM |
173 NV_DMA_ACCESS_RDWR, 173 NV_DMA_ACCESS_RDWR,
174 .start = 0, 174 .start = 0,
175 .limit = pfb->ram.size - 1, 175 .limit = pfb->ram->size - 1,
176 .conf0 = NV50_DMA_CONF0_ENABLE | 0x70 | 176 .conf0 = NV50_DMA_CONF0_ENABLE | 0x70 |
177 NV50_DMA_CONF0_PART_256, 177 NV50_DMA_CONF0_PART_256,
178 }, sizeof(struct nv_dma_class), &object); 178 }, sizeof(struct nv_dma_class), &object);
@@ -185,7 +185,7 @@ nv50_dmac_create_fbdma(struct nouveau_object *core, u32 parent)
185 .flags = NV_DMA_TARGET_VRAM | 185 .flags = NV_DMA_TARGET_VRAM |
186 NV_DMA_ACCESS_RDWR, 186 NV_DMA_ACCESS_RDWR,
187 .start = 0, 187 .start = 0,
188 .limit = pfb->ram.size - 1, 188 .limit = pfb->ram->size - 1,
189 .conf0 = NV50_DMA_CONF0_ENABLE | 0x7a | 189 .conf0 = NV50_DMA_CONF0_ENABLE | 0x7a |
190 NV50_DMA_CONF0_PART_256, 190 NV50_DMA_CONF0_PART_256,
191 }, sizeof(struct nv_dma_class), &object); 191 }, sizeof(struct nv_dma_class), &object);
@@ -204,7 +204,7 @@ nvc0_dmac_create_fbdma(struct nouveau_object *core, u32 parent)
204 .flags = NV_DMA_TARGET_VRAM | 204 .flags = NV_DMA_TARGET_VRAM |
205 NV_DMA_ACCESS_RDWR, 205 NV_DMA_ACCESS_RDWR,
206 .start = 0, 206 .start = 0,
207 .limit = pfb->ram.size - 1, 207 .limit = pfb->ram->size - 1,
208 .conf0 = NVC0_DMA_CONF0_ENABLE, 208 .conf0 = NVC0_DMA_CONF0_ENABLE,
209 }, sizeof(struct nv_dma_class), &object); 209 }, sizeof(struct nv_dma_class), &object);
210 if (ret) 210 if (ret)
@@ -216,7 +216,7 @@ nvc0_dmac_create_fbdma(struct nouveau_object *core, u32 parent)
216 .flags = NV_DMA_TARGET_VRAM | 216 .flags = NV_DMA_TARGET_VRAM |
217 NV_DMA_ACCESS_RDWR, 217 NV_DMA_ACCESS_RDWR,
218 .start = 0, 218 .start = 0,
219 .limit = pfb->ram.size - 1, 219 .limit = pfb->ram->size - 1,
220 .conf0 = NVC0_DMA_CONF0_ENABLE | 0xfe, 220 .conf0 = NVC0_DMA_CONF0_ENABLE | 0xfe,
221 }, sizeof(struct nv_dma_class), &object); 221 }, sizeof(struct nv_dma_class), &object);
222 if (ret) 222 if (ret)
@@ -228,7 +228,7 @@ nvc0_dmac_create_fbdma(struct nouveau_object *core, u32 parent)
228 .flags = NV_DMA_TARGET_VRAM | 228 .flags = NV_DMA_TARGET_VRAM |
229 NV_DMA_ACCESS_RDWR, 229 NV_DMA_ACCESS_RDWR,
230 .start = 0, 230 .start = 0,
231 .limit = pfb->ram.size - 1, 231 .limit = pfb->ram->size - 1,
232 .conf0 = NVC0_DMA_CONF0_ENABLE | 0xfe, 232 .conf0 = NVC0_DMA_CONF0_ENABLE | 0xfe,
233 }, sizeof(struct nv_dma_class), &object); 233 }, sizeof(struct nv_dma_class), &object);
234 return ret; 234 return ret;
@@ -246,7 +246,7 @@ nvd0_dmac_create_fbdma(struct nouveau_object *core, u32 parent)
246 .flags = NV_DMA_TARGET_VRAM | 246 .flags = NV_DMA_TARGET_VRAM |
247 NV_DMA_ACCESS_RDWR, 247 NV_DMA_ACCESS_RDWR,
248 .start = 0, 248 .start = 0,
249 .limit = pfb->ram.size - 1, 249 .limit = pfb->ram->size - 1,
250 .conf0 = NVD0_DMA_CONF0_ENABLE | 250 .conf0 = NVD0_DMA_CONF0_ENABLE |
251 NVD0_DMA_CONF0_PAGE_LP, 251 NVD0_DMA_CONF0_PAGE_LP,
252 }, sizeof(struct nv_dma_class), &object); 252 }, sizeof(struct nv_dma_class), &object);
@@ -259,7 +259,7 @@ nvd0_dmac_create_fbdma(struct nouveau_object *core, u32 parent)
259 .flags = NV_DMA_TARGET_VRAM | 259 .flags = NV_DMA_TARGET_VRAM |
260 NV_DMA_ACCESS_RDWR, 260 NV_DMA_ACCESS_RDWR,
261 .start = 0, 261 .start = 0,
262 .limit = pfb->ram.size - 1, 262 .limit = pfb->ram->size - 1,
263 .conf0 = NVD0_DMA_CONF0_ENABLE | 0xfe | 263 .conf0 = NVD0_DMA_CONF0_ENABLE | 0xfe |
264 NVD0_DMA_CONF0_PAGE_LP, 264 NVD0_DMA_CONF0_PAGE_LP,
265 }, sizeof(struct nv_dma_class), &object); 265 }, sizeof(struct nv_dma_class), &object);
@@ -316,7 +316,7 @@ nv50_dmac_create(struct nouveau_object *core, u32 bclass, u8 head,
316 .flags = NV_DMA_TARGET_VRAM | 316 .flags = NV_DMA_TARGET_VRAM |
317 NV_DMA_ACCESS_RDWR, 317 NV_DMA_ACCESS_RDWR,
318 .start = 0, 318 .start = 0,
319 .limit = pfb->ram.size - 1, 319 .limit = pfb->ram->size - 1,
320 }, sizeof(struct nv_dma_class), &object); 320 }, sizeof(struct nv_dma_class), &object);
321 if (ret) 321 if (ret)
322 return ret; 322 return ret;
diff --git a/drivers/gpu/drm/nouveau/nv50_pm.c b/drivers/gpu/drm/nouveau/nv50_pm.c
index 69620e39c90c..4efc33fa73fc 100644
--- a/drivers/gpu/drm/nouveau/nv50_pm.c
+++ b/drivers/gpu/drm/nouveau/nv50_pm.c
@@ -493,12 +493,12 @@ mclk_mrs(struct nouveau_mem_exec_func *exec, int mr, u32 data)
493 struct hwsq_ucode *hwsq = &info->mclk_hwsq; 493 struct hwsq_ucode *hwsq = &info->mclk_hwsq;
494 494
495 if (mr <= 1) { 495 if (mr <= 1) {
496 if (pfb->ram.ranks > 1) 496 if (pfb->ram->ranks > 1)
497 hwsq_wr32(hwsq, 0x1002c8 + ((mr - 0) * 4), data); 497 hwsq_wr32(hwsq, 0x1002c8 + ((mr - 0) * 4), data);
498 hwsq_wr32(hwsq, 0x1002c0 + ((mr - 0) * 4), data); 498 hwsq_wr32(hwsq, 0x1002c0 + ((mr - 0) * 4), data);
499 } else 499 } else
500 if (mr <= 3) { 500 if (mr <= 3) {
501 if (pfb->ram.ranks > 1) 501 if (pfb->ram->ranks > 1)
502 hwsq_wr32(hwsq, 0x1002e8 + ((mr - 2) * 4), data); 502 hwsq_wr32(hwsq, 0x1002e8 + ((mr - 2) * 4), data);
503 hwsq_wr32(hwsq, 0x1002e0 + ((mr - 2) * 4), data); 503 hwsq_wr32(hwsq, 0x1002e0 + ((mr - 2) * 4), data);
504 } 504 }
diff --git a/drivers/gpu/drm/nouveau/nva3_pm.c b/drivers/gpu/drm/nouveau/nva3_pm.c
index 863f010fafeb..0d0ed597fea8 100644
--- a/drivers/gpu/drm/nouveau/nva3_pm.c
+++ b/drivers/gpu/drm/nouveau/nva3_pm.c
@@ -389,12 +389,12 @@ mclk_mrs(struct nouveau_mem_exec_func *exec, int mr, u32 data)
389 struct nouveau_device *device = nouveau_dev(exec->dev); 389 struct nouveau_device *device = nouveau_dev(exec->dev);
390 struct nouveau_fb *pfb = nouveau_fb(device); 390 struct nouveau_fb *pfb = nouveau_fb(device);
391 if (mr <= 1) { 391 if (mr <= 1) {
392 if (pfb->ram.ranks > 1) 392 if (pfb->ram->ranks > 1)
393 nv_wr32(device, 0x1002c8 + ((mr - 0) * 4), data); 393 nv_wr32(device, 0x1002c8 + ((mr - 0) * 4), data);
394 nv_wr32(device, 0x1002c0 + ((mr - 0) * 4), data); 394 nv_wr32(device, 0x1002c0 + ((mr - 0) * 4), data);
395 } else 395 } else
396 if (mr <= 3) { 396 if (mr <= 3) {
397 if (pfb->ram.ranks > 1) 397 if (pfb->ram->ranks > 1)
398 nv_wr32(device, 0x1002e8 + ((mr - 2) * 4), data); 398 nv_wr32(device, 0x1002e8 + ((mr - 2) * 4), data);
399 nv_wr32(device, 0x1002e0 + ((mr - 2) * 4), data); 399 nv_wr32(device, 0x1002e0 + ((mr - 2) * 4), data);
400 } 400 }
diff --git a/drivers/gpu/drm/nouveau/nvc0_pm.c b/drivers/gpu/drm/nouveau/nvc0_pm.c
index 0d34eb581179..3b7041cb013f 100644
--- a/drivers/gpu/drm/nouveau/nvc0_pm.c
+++ b/drivers/gpu/drm/nouveau/nvc0_pm.c
@@ -477,7 +477,7 @@ mclk_mrg(struct nouveau_mem_exec_func *exec, int mr)
477{ 477{
478 struct nouveau_device *device = nouveau_dev(exec->dev); 478 struct nouveau_device *device = nouveau_dev(exec->dev);
479 struct nouveau_fb *pfb = nouveau_fb(device); 479 struct nouveau_fb *pfb = nouveau_fb(device);
480 if (pfb->ram.type != NV_MEM_TYPE_GDDR5) { 480 if (pfb->ram->type != NV_MEM_TYPE_GDDR5) {
481 if (mr <= 1) 481 if (mr <= 1)
482 return nv_rd32(device, 0x10f300 + ((mr - 0) * 4)); 482 return nv_rd32(device, 0x10f300 + ((mr - 0) * 4));
483 return nv_rd32(device, 0x10f320 + ((mr - 2) * 4)); 483 return nv_rd32(device, 0x10f320 + ((mr - 2) * 4));
@@ -496,15 +496,15 @@ mclk_mrs(struct nouveau_mem_exec_func *exec, int mr, u32 data)
496{ 496{
497 struct nouveau_device *device = nouveau_dev(exec->dev); 497 struct nouveau_device *device = nouveau_dev(exec->dev);
498 struct nouveau_fb *pfb = nouveau_fb(device); 498 struct nouveau_fb *pfb = nouveau_fb(device);
499 if (pfb->ram.type != NV_MEM_TYPE_GDDR5) { 499 if (pfb->ram->type != NV_MEM_TYPE_GDDR5) {
500 if (mr <= 1) { 500 if (mr <= 1) {
501 nv_wr32(device, 0x10f300 + ((mr - 0) * 4), data); 501 nv_wr32(device, 0x10f300 + ((mr - 0) * 4), data);
502 if (pfb->ram.ranks > 1) 502 if (pfb->ram->ranks > 1)
503 nv_wr32(device, 0x10f308 + ((mr - 0) * 4), data); 503 nv_wr32(device, 0x10f308 + ((mr - 0) * 4), data);
504 } else 504 } else
505 if (mr <= 3) { 505 if (mr <= 3) {
506 nv_wr32(device, 0x10f320 + ((mr - 2) * 4), data); 506 nv_wr32(device, 0x10f320 + ((mr - 2) * 4), data);
507 if (pfb->ram.ranks > 1) 507 if (pfb->ram->ranks > 1)
508 nv_wr32(device, 0x10f328 + ((mr - 2) * 4), data); 508 nv_wr32(device, 0x10f328 + ((mr - 2) * 4), data);
509 } 509 }
510 } else { 510 } else {