aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2016-03-13 20:49:40 -0400
committerDave Airlie <airlied@redhat.com>2016-03-13 20:49:40 -0400
commitf2c488212b511f7eadef78c564f1bff8f64db231 (patch)
tree0c4cf14f0040458e0ca9b850f906c832563729a1
parent67d1c0a25c05e2105d12abd9c0172d2d5c0e7654 (diff)
parent52829d4fabaf71748f16126d421dbefbfcf1319a (diff)
Merge branch 'linux-4.6' of git://github.com/skeggsb/linux into drm-next
- GM20x secure boot support (hence, acceleration, finally \o/) - GM200 support - GM20B clock driver - Support for power sensors on some GPUs - Various other fixes all over the place * 'linux-4.6' of git://github.com/skeggsb/linux: (95 commits) drm/nouveau/clk/gm20b: add basic driver drm/nouveau/clk/gk20a: share reusable structures/functions drm/nouveau/clk/gk20a: set lowest frequency during init() drm/nouveau/clk/gk20a: split gk20a_clk_new() drm/nouveau/clk/gk20a: abstract pl_to_div drm/nouveau/clk/gk20a: put mnp values into their own struct drm/nouveau/clk/gk20a: emit parent rate as debug message drm/nouveau/clk/gk20a: only restore divider to 1:1 if needed drm/nouveau/clk/gk20a: only compute n_lo if needed drm/nouveau/clk/gk20a: fix VCO bit mask drm/nouveau/clk/gk20a: rename enable/disable functions drm/nouveau/clk/gk20a: reorganize variables in gk20a_pllg_calc_mnp() drm/nouveau/clk/gk20a: convert parameters to Khz drm/nouveau/volt: add GM20B driver drm/nouveau/volt/gk20a: split constructor drm/nouveau/volt/gk20a: share reusable members & functions drm/nouveau/ce/gm107: expose MaxwellDmaCopyA drm/nouveau/fifo/gm107: KeplerChannelGpfifoB, and 2048 channels drm/nouveau/fifo/gk110: expose KeplerChannelGpfifoB drm/nouveau/fifo/gk104: submit NOP after all PBDMA_INTR_0, not just DEVICE ...
-rw-r--r--drivers/gpu/drm/nouveau/include/nvif/cla06f.h26
-rw-r--r--drivers/gpu/drm/nouveau/include/nvif/class.h5
-rw-r--r--drivers/gpu/drm/nouveau/include/nvif/device.h1
-rw-r--r--drivers/gpu/drm/nouveau/include/nvkm/core/device.h127
-rw-r--r--drivers/gpu/drm/nouveau/include/nvkm/core/firmware.h11
-rw-r--r--drivers/gpu/drm/nouveau/include/nvkm/core/gpuobj.h4
-rw-r--r--drivers/gpu/drm/nouveau/include/nvkm/engine/ce.h3
-rw-r--r--drivers/gpu/drm/nouveau/include/nvkm/engine/disp.h2
-rw-r--r--drivers/gpu/drm/nouveau/include/nvkm/engine/fifo.h4
-rw-r--r--drivers/gpu/drm/nouveau/include/nvkm/engine/gr.h3
-rw-r--r--drivers/gpu/drm/nouveau/include/nvkm/engine/msenc.h4
-rw-r--r--drivers/gpu/drm/nouveau/include/nvkm/engine/nvdec.h4
-rw-r--r--drivers/gpu/drm/nouveau/include/nvkm/engine/nvenc.h4
-rw-r--r--drivers/gpu/drm/nouveau/include/nvkm/engine/vic.h4
-rw-r--r--drivers/gpu/drm/nouveau/include/nvkm/subdev/bios/extdev.h3
-rw-r--r--drivers/gpu/drm/nouveau/include/nvkm/subdev/bios/iccsense.h16
-rw-r--r--drivers/gpu/drm/nouveau/include/nvkm/subdev/clk.h1
-rw-r--r--drivers/gpu/drm/nouveau/include/nvkm/subdev/devinit.h2
-rw-r--r--drivers/gpu/drm/nouveau/include/nvkm/subdev/i2c.h33
-rw-r--r--drivers/gpu/drm/nouveau/include/nvkm/subdev/ibus.h2
-rw-r--r--drivers/gpu/drm/nouveau/include/nvkm/subdev/iccsense.h17
-rw-r--r--drivers/gpu/drm/nouveau/include/nvkm/subdev/ltc.h2
-rw-r--r--drivers/gpu/drm/nouveau/include/nvkm/subdev/secboot.h59
-rw-r--r--drivers/gpu/drm/nouveau/include/nvkm/subdev/volt.h1
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_abi16.c18
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bo.c4
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_chan.c3
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_display.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drm.c9
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_hwmon.c77
-rw-r--r--drivers/gpu/drm/nouveau/nv50_display.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/core/Kbuild1
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/core/firmware.c61
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/core/gpuobj.c20
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/core/ramht.c6
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/core/subdev.c87
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/Kbuild4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/ce/Kbuild3
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/ce/gm107.c (renamed from drivers/gpu/drm/nouveau/nvkm/engine/gr/gm206.c)39
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/ce/gm200.c (renamed from drivers/gpu/drm/nouveau/nvkm/engine/ce/gm204.c)10
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/device/base.c288
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h5
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c10
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild8
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/disp/coregm200.c (renamed from drivers/gpu/drm/nouveau/nvkm/engine/disp/coregm204.c)4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/disp/dmacnv50.h2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/disp/gm200.c (renamed from drivers/gpu/drm/nouveau/nvkm/engine/disp/gm204.c)12
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.h2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/disp/outpdp.h2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgm200.c (renamed from drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgm204.c)14
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.h2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c (renamed from drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm204.c)40
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/fifo/Kbuild7
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/fifo/changk104.h5
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c54
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.h9
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c270
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.h55
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk110.c46
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm107.c46
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm200.c (renamed from drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm204.c)8
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm20b.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogk104.c186
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogk110.c34
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogm200.c (renamed from drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogm204.c)2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/Kbuild6
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.h24
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm200.c147
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm204.c1049
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm206.c74
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm20b.c4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpc.fuc2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgf100.fuc3.h80
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgf117.fuc3.h82
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk104.fuc3.h82
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk110.fuc3.h82
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk208.fuc5.h68
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgm107.fuc5.h70
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hub.fuc2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgf100.fuc3.h252
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgf117.fuc3.h252
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk104.fuc3.h238
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk110.fuc3.h238
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk208.fuc5.h210
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgm107.fuc5.h210
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c83
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.h20
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c181
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/gm200.c207
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/gm204.c373
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/gr/gm20b.c12
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/msenc/Kbuild1
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/nvdec/Kbuild1
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/nvenc/Kbuild1
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/vic/Kbuild1
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/Kbuild2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bios/Kbuild1
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bios/extdev.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bios/iccsense.c100
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c13
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/clk/Kbuild1
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk20a.c292
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk20a.h65
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/clk/gm20b.c198
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/devinit/Kbuild2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c14
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm107.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm200.c (renamed from drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm204.c)12
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.c13
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.h1
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/Kbuild6
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.h2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c (renamed from drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm204.c)28
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gm200.c (renamed from drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gm204.c)8
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.h4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padgm200.c (renamed from drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padgm204.c)20
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/ibus/Kbuild2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gm200.c (renamed from drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gm204.c)6
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/Kbuild2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c232
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/gf100.c31
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/priv.h16
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/ltc/Kbuild2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gf100.c8
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gm107.c8
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gm200.c (renamed from drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gm204.c)14
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gf100.fuc3.h1598
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gf119.fuc4.h1494
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gk208.fuc5.h1420
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gt215.fuc3.h1746
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/host.fuc3
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/kernel.fuc26
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/macros.fuc6
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/test.fuc3
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/secboot/Kbuild3
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/secboot/base.c288
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm200.c1489
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c233
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/secboot/priv.h226
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/volt/Kbuild1
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk20a.c57
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk20a.h49
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/volt/gm20b.c56
145 files changed, 9146 insertions, 6512 deletions
diff --git a/drivers/gpu/drm/nouveau/include/nvif/cla06f.h b/drivers/gpu/drm/nouveau/include/nvif/cla06f.h
index 85b7827eb782..46301ec018ce 100644
--- a/drivers/gpu/drm/nouveau/include/nvif/cla06f.h
+++ b/drivers/gpu/drm/nouveau/include/nvif/cla06f.h
@@ -3,19 +3,27 @@
3 3
4struct kepler_channel_gpfifo_a_v0 { 4struct kepler_channel_gpfifo_a_v0 {
5 __u8 version; 5 __u8 version;
6#define KEPLER_CHANNEL_GPFIFO_A_V0_ENGINE_GR 0x01 6 __u8 pad01[5];
7#define KEPLER_CHANNEL_GPFIFO_A_V0_ENGINE_MSPDEC 0x02
8#define KEPLER_CHANNEL_GPFIFO_A_V0_ENGINE_MSPPP 0x04
9#define KEPLER_CHANNEL_GPFIFO_A_V0_ENGINE_MSVLD 0x08
10#define KEPLER_CHANNEL_GPFIFO_A_V0_ENGINE_CE0 0x10
11#define KEPLER_CHANNEL_GPFIFO_A_V0_ENGINE_CE1 0x20
12#define KEPLER_CHANNEL_GPFIFO_A_V0_ENGINE_ENC 0x40
13 __u8 engine;
14 __u16 chid; 7 __u16 chid;
8#define NVA06F_V0_ENGINE_SW 0x00000001
9#define NVA06F_V0_ENGINE_GR 0x00000002
10#define NVA06F_V0_ENGINE_SEC 0x00000004
11#define NVA06F_V0_ENGINE_MSVLD 0x00000010
12#define NVA06F_V0_ENGINE_MSPDEC 0x00000020
13#define NVA06F_V0_ENGINE_MSPPP 0x00000040
14#define NVA06F_V0_ENGINE_MSENC 0x00000080
15#define NVA06F_V0_ENGINE_VIC 0x00000100
16#define NVA06F_V0_ENGINE_NVDEC 0x00000200
17#define NVA06F_V0_ENGINE_NVENC0 0x00000400
18#define NVA06F_V0_ENGINE_NVENC1 0x00000800
19#define NVA06F_V0_ENGINE_CE0 0x00010000
20#define NVA06F_V0_ENGINE_CE1 0x00020000
21#define NVA06F_V0_ENGINE_CE2 0x00040000
22 __u32 engines;
15 __u32 ilength; 23 __u32 ilength;
16 __u64 ioffset; 24 __u64 ioffset;
17 __u64 vm; 25 __u64 vm;
18}; 26};
19 27
20#define KEPLER_CHANNEL_GPFIFO_A_V0_NTFY_UEVENT 0x00 28#define NVA06F_V0_NTFY_UEVENT 0x00
21#endif 29#endif
diff --git a/drivers/gpu/drm/nouveau/include/nvif/class.h b/drivers/gpu/drm/nouveau/include/nvif/class.h
index 4179cd65ac0a..982aad8fa645 100644
--- a/drivers/gpu/drm/nouveau/include/nvif/class.h
+++ b/drivers/gpu/drm/nouveau/include/nvif/class.h
@@ -37,6 +37,7 @@
37#define G82_CHANNEL_GPFIFO /* cl826f.h */ 0x0000826f 37#define G82_CHANNEL_GPFIFO /* cl826f.h */ 0x0000826f
38#define FERMI_CHANNEL_GPFIFO /* cl906f.h */ 0x0000906f 38#define FERMI_CHANNEL_GPFIFO /* cl906f.h */ 0x0000906f
39#define KEPLER_CHANNEL_GPFIFO_A /* cla06f.h */ 0x0000a06f 39#define KEPLER_CHANNEL_GPFIFO_A /* cla06f.h */ 0x0000a06f
40#define KEPLER_CHANNEL_GPFIFO_B /* cla06f.h */ 0x0000a16f
40#define MAXWELL_CHANNEL_GPFIFO_A /* cla06f.h */ 0x0000b06f 41#define MAXWELL_CHANNEL_GPFIFO_A /* cla06f.h */ 0x0000b06f
41 42
42#define NV50_DISP /* cl5070.h */ 0x00005070 43#define NV50_DISP /* cl5070.h */ 0x00005070
@@ -48,7 +49,7 @@
48#define GK104_DISP /* cl5070.h */ 0x00009170 49#define GK104_DISP /* cl5070.h */ 0x00009170
49#define GK110_DISP /* cl5070.h */ 0x00009270 50#define GK110_DISP /* cl5070.h */ 0x00009270
50#define GM107_DISP /* cl5070.h */ 0x00009470 51#define GM107_DISP /* cl5070.h */ 0x00009470
51#define GM204_DISP /* cl5070.h */ 0x00009570 52#define GM200_DISP /* cl5070.h */ 0x00009570
52 53
53#define NV31_MPEG 0x00003174 54#define NV31_MPEG 0x00003174
54#define G82_MPEG 0x00008274 55#define G82_MPEG 0x00008274
@@ -84,7 +85,7 @@
84#define GK104_DISP_CORE_CHANNEL_DMA /* cl507d.h */ 0x0000917d 85#define GK104_DISP_CORE_CHANNEL_DMA /* cl507d.h */ 0x0000917d
85#define GK110_DISP_CORE_CHANNEL_DMA /* cl507d.h */ 0x0000927d 86#define GK110_DISP_CORE_CHANNEL_DMA /* cl507d.h */ 0x0000927d
86#define GM107_DISP_CORE_CHANNEL_DMA /* cl507d.h */ 0x0000947d 87#define GM107_DISP_CORE_CHANNEL_DMA /* cl507d.h */ 0x0000947d
87#define GM204_DISP_CORE_CHANNEL_DMA /* cl507d.h */ 0x0000957d 88#define GM200_DISP_CORE_CHANNEL_DMA /* cl507d.h */ 0x0000957d
88 89
89#define NV50_DISP_OVERLAY_CHANNEL_DMA /* cl507e.h */ 0x0000507e 90#define NV50_DISP_OVERLAY_CHANNEL_DMA /* cl507e.h */ 0x0000507e
90#define G82_DISP_OVERLAY_CHANNEL_DMA /* cl507e.h */ 0x0000827e 91#define G82_DISP_OVERLAY_CHANNEL_DMA /* cl507e.h */ 0x0000827e
diff --git a/drivers/gpu/drm/nouveau/include/nvif/device.h b/drivers/gpu/drm/nouveau/include/nvif/device.h
index e0ed2f4b2f43..bcb981711617 100644
--- a/drivers/gpu/drm/nouveau/include/nvif/device.h
+++ b/drivers/gpu/drm/nouveau/include/nvif/device.h
@@ -62,6 +62,7 @@ u64 nvif_device_time(struct nvif_device *);
62#define nvxx_gpio(a) nvxx_device(a)->gpio 62#define nvxx_gpio(a) nvxx_device(a)->gpio
63#define nvxx_clk(a) nvxx_device(a)->clk 63#define nvxx_clk(a) nvxx_device(a)->clk
64#define nvxx_i2c(a) nvxx_device(a)->i2c 64#define nvxx_i2c(a) nvxx_device(a)->i2c
65#define nvxx_iccsense(a) nvxx_device(a)->iccsense
65#define nvxx_therm(a) nvxx_device(a)->therm 66#define nvxx_therm(a) nvxx_device(a)->therm
66#define nvxx_volt(a) nvxx_device(a)->volt 67#define nvxx_volt(a) nvxx_device(a)->volt
67 68
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/device.h b/drivers/gpu/drm/nouveau/include/nvkm/core/device.h
index 913192c94876..4993a863adb9 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/core/device.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/core/device.h
@@ -22,30 +22,41 @@ enum nvkm_devidx {
22 NVKM_SUBDEV_BAR, 22 NVKM_SUBDEV_BAR,
23 NVKM_SUBDEV_PMU, 23 NVKM_SUBDEV_PMU,
24 NVKM_SUBDEV_VOLT, 24 NVKM_SUBDEV_VOLT,
25 NVKM_SUBDEV_ICCSENSE,
25 NVKM_SUBDEV_THERM, 26 NVKM_SUBDEV_THERM,
26 NVKM_SUBDEV_CLK, 27 NVKM_SUBDEV_CLK,
28 NVKM_SUBDEV_SECBOOT,
27 29
28 NVKM_ENGINE_DMAOBJ,
29 NVKM_ENGINE_IFB,
30 NVKM_ENGINE_FIFO,
31 NVKM_ENGINE_SW,
32 NVKM_ENGINE_GR,
33 NVKM_ENGINE_MPEG,
34 NVKM_ENGINE_ME,
35 NVKM_ENGINE_VP,
36 NVKM_ENGINE_CIPHER,
37 NVKM_ENGINE_BSP, 30 NVKM_ENGINE_BSP,
38 NVKM_ENGINE_MSPPP, 31
39 NVKM_ENGINE_CE0, 32 NVKM_ENGINE_CE0,
40 NVKM_ENGINE_CE1, 33 NVKM_ENGINE_CE1,
41 NVKM_ENGINE_CE2, 34 NVKM_ENGINE_CE2,
42 NVKM_ENGINE_VIC, 35 NVKM_ENGINE_CE_LAST = NVKM_ENGINE_CE2,
43 NVKM_ENGINE_MSENC, 36
37 NVKM_ENGINE_CIPHER,
44 NVKM_ENGINE_DISP, 38 NVKM_ENGINE_DISP,
45 NVKM_ENGINE_PM, 39 NVKM_ENGINE_DMAOBJ,
40 NVKM_ENGINE_FIFO,
41 NVKM_ENGINE_GR,
42 NVKM_ENGINE_IFB,
43 NVKM_ENGINE_ME,
44 NVKM_ENGINE_MPEG,
45 NVKM_ENGINE_MSENC,
46 NVKM_ENGINE_MSPDEC,
47 NVKM_ENGINE_MSPPP,
46 NVKM_ENGINE_MSVLD, 48 NVKM_ENGINE_MSVLD,
49
50 NVKM_ENGINE_NVENC0,
51 NVKM_ENGINE_NVENC1,
52 NVKM_ENGINE_NVENC_LAST = NVKM_ENGINE_NVENC1,
53
54 NVKM_ENGINE_NVDEC,
55 NVKM_ENGINE_PM,
47 NVKM_ENGINE_SEC, 56 NVKM_ENGINE_SEC,
48 NVKM_ENGINE_MSPDEC, 57 NVKM_ENGINE_SW,
58 NVKM_ENGINE_VIC,
59 NVKM_ENGINE_VP,
49 60
50 NVKM_SUBDEV_NR 61 NVKM_SUBDEV_NR
51}; 62};
@@ -109,6 +120,7 @@ struct nvkm_device {
109 struct nvkm_gpio *gpio; 120 struct nvkm_gpio *gpio;
110 struct nvkm_i2c *i2c; 121 struct nvkm_i2c *i2c;
111 struct nvkm_subdev *ibus; 122 struct nvkm_subdev *ibus;
123 struct nvkm_iccsense *iccsense;
112 struct nvkm_instmem *imem; 124 struct nvkm_instmem *imem;
113 struct nvkm_ltc *ltc; 125 struct nvkm_ltc *ltc;
114 struct nvkm_mc *mc; 126 struct nvkm_mc *mc;
@@ -116,6 +128,7 @@ struct nvkm_device {
116 struct nvkm_subdev *mxm; 128 struct nvkm_subdev *mxm;
117 struct nvkm_pci *pci; 129 struct nvkm_pci *pci;
118 struct nvkm_pmu *pmu; 130 struct nvkm_pmu *pmu;
131 struct nvkm_secboot *secboot;
119 struct nvkm_therm *therm; 132 struct nvkm_therm *therm;
120 struct nvkm_timer *timer; 133 struct nvkm_timer *timer;
121 struct nvkm_volt *volt; 134 struct nvkm_volt *volt;
@@ -134,6 +147,8 @@ struct nvkm_device {
134 struct nvkm_engine *mspdec; 147 struct nvkm_engine *mspdec;
135 struct nvkm_engine *msppp; 148 struct nvkm_engine *msppp;
136 struct nvkm_engine *msvld; 149 struct nvkm_engine *msvld;
150 struct nvkm_engine *nvenc[2];
151 struct nvkm_engine *nvdec;
137 struct nvkm_pm *pm; 152 struct nvkm_pm *pm;
138 struct nvkm_engine *sec; 153 struct nvkm_engine *sec;
139 struct nvkm_sw *sw; 154 struct nvkm_sw *sw;
@@ -164,46 +179,50 @@ struct nvkm_device_quirk {
164struct nvkm_device_chip { 179struct nvkm_device_chip {
165 const char *name; 180 const char *name;
166 181
167 int (*bar )(struct nvkm_device *, int idx, struct nvkm_bar **); 182 int (*bar )(struct nvkm_device *, int idx, struct nvkm_bar **);
168 int (*bios )(struct nvkm_device *, int idx, struct nvkm_bios **); 183 int (*bios )(struct nvkm_device *, int idx, struct nvkm_bios **);
169 int (*bus )(struct nvkm_device *, int idx, struct nvkm_bus **); 184 int (*bus )(struct nvkm_device *, int idx, struct nvkm_bus **);
170 int (*clk )(struct nvkm_device *, int idx, struct nvkm_clk **); 185 int (*clk )(struct nvkm_device *, int idx, struct nvkm_clk **);
171 int (*devinit)(struct nvkm_device *, int idx, struct nvkm_devinit **); 186 int (*devinit )(struct nvkm_device *, int idx, struct nvkm_devinit **);
172 int (*fb )(struct nvkm_device *, int idx, struct nvkm_fb **); 187 int (*fb )(struct nvkm_device *, int idx, struct nvkm_fb **);
173 int (*fuse )(struct nvkm_device *, int idx, struct nvkm_fuse **); 188 int (*fuse )(struct nvkm_device *, int idx, struct nvkm_fuse **);
174 int (*gpio )(struct nvkm_device *, int idx, struct nvkm_gpio **); 189 int (*gpio )(struct nvkm_device *, int idx, struct nvkm_gpio **);
175 int (*i2c )(struct nvkm_device *, int idx, struct nvkm_i2c **); 190 int (*i2c )(struct nvkm_device *, int idx, struct nvkm_i2c **);
176 int (*ibus )(struct nvkm_device *, int idx, struct nvkm_subdev **); 191 int (*ibus )(struct nvkm_device *, int idx, struct nvkm_subdev **);
177 int (*imem )(struct nvkm_device *, int idx, struct nvkm_instmem **); 192 int (*iccsense)(struct nvkm_device *, int idx, struct nvkm_iccsense **);
178 int (*ltc )(struct nvkm_device *, int idx, struct nvkm_ltc **); 193 int (*imem )(struct nvkm_device *, int idx, struct nvkm_instmem **);
179 int (*mc )(struct nvkm_device *, int idx, struct nvkm_mc **); 194 int (*ltc )(struct nvkm_device *, int idx, struct nvkm_ltc **);
180 int (*mmu )(struct nvkm_device *, int idx, struct nvkm_mmu **); 195 int (*mc )(struct nvkm_device *, int idx, struct nvkm_mc **);
181 int (*mxm )(struct nvkm_device *, int idx, struct nvkm_subdev **); 196 int (*mmu )(struct nvkm_device *, int idx, struct nvkm_mmu **);
182 int (*pci )(struct nvkm_device *, int idx, struct nvkm_pci **); 197 int (*mxm )(struct nvkm_device *, int idx, struct nvkm_subdev **);
183 int (*pmu )(struct nvkm_device *, int idx, struct nvkm_pmu **); 198 int (*pci )(struct nvkm_device *, int idx, struct nvkm_pci **);
184 int (*therm )(struct nvkm_device *, int idx, struct nvkm_therm **); 199 int (*pmu )(struct nvkm_device *, int idx, struct nvkm_pmu **);
185 int (*timer )(struct nvkm_device *, int idx, struct nvkm_timer **); 200 int (*secboot )(struct nvkm_device *, int idx, struct nvkm_secboot **);
186 int (*volt )(struct nvkm_device *, int idx, struct nvkm_volt **); 201 int (*therm )(struct nvkm_device *, int idx, struct nvkm_therm **);
187 202 int (*timer )(struct nvkm_device *, int idx, struct nvkm_timer **);
188 int (*bsp )(struct nvkm_device *, int idx, struct nvkm_engine **); 203 int (*volt )(struct nvkm_device *, int idx, struct nvkm_volt **);
189 int (*ce[3] )(struct nvkm_device *, int idx, struct nvkm_engine **); 204
190 int (*cipher )(struct nvkm_device *, int idx, struct nvkm_engine **); 205 int (*bsp )(struct nvkm_device *, int idx, struct nvkm_engine **);
191 int (*disp )(struct nvkm_device *, int idx, struct nvkm_disp **); 206 int (*ce[3] )(struct nvkm_device *, int idx, struct nvkm_engine **);
192 int (*dma )(struct nvkm_device *, int idx, struct nvkm_dma **); 207 int (*cipher )(struct nvkm_device *, int idx, struct nvkm_engine **);
193 int (*fifo )(struct nvkm_device *, int idx, struct nvkm_fifo **); 208 int (*disp )(struct nvkm_device *, int idx, struct nvkm_disp **);
194 int (*gr )(struct nvkm_device *, int idx, struct nvkm_gr **); 209 int (*dma )(struct nvkm_device *, int idx, struct nvkm_dma **);
195 int (*ifb )(struct nvkm_device *, int idx, struct nvkm_engine **); 210 int (*fifo )(struct nvkm_device *, int idx, struct nvkm_fifo **);
196 int (*me )(struct nvkm_device *, int idx, struct nvkm_engine **); 211 int (*gr )(struct nvkm_device *, int idx, struct nvkm_gr **);
197 int (*mpeg )(struct nvkm_device *, int idx, struct nvkm_engine **); 212 int (*ifb )(struct nvkm_device *, int idx, struct nvkm_engine **);
198 int (*msenc )(struct nvkm_device *, int idx, struct nvkm_engine **); 213 int (*me )(struct nvkm_device *, int idx, struct nvkm_engine **);
199 int (*mspdec )(struct nvkm_device *, int idx, struct nvkm_engine **); 214 int (*mpeg )(struct nvkm_device *, int idx, struct nvkm_engine **);
200 int (*msppp )(struct nvkm_device *, int idx, struct nvkm_engine **); 215 int (*msenc )(struct nvkm_device *, int idx, struct nvkm_engine **);
201 int (*msvld )(struct nvkm_device *, int idx, struct nvkm_engine **); 216 int (*mspdec )(struct nvkm_device *, int idx, struct nvkm_engine **);
202 int (*pm )(struct nvkm_device *, int idx, struct nvkm_pm **); 217 int (*msppp )(struct nvkm_device *, int idx, struct nvkm_engine **);
203 int (*sec )(struct nvkm_device *, int idx, struct nvkm_engine **); 218 int (*msvld )(struct nvkm_device *, int idx, struct nvkm_engine **);
204 int (*sw )(struct nvkm_device *, int idx, struct nvkm_sw **); 219 int (*nvenc[2])(struct nvkm_device *, int idx, struct nvkm_engine **);
205 int (*vic )(struct nvkm_device *, int idx, struct nvkm_engine **); 220 int (*nvdec )(struct nvkm_device *, int idx, struct nvkm_engine **);
206 int (*vp )(struct nvkm_device *, int idx, struct nvkm_engine **); 221 int (*pm )(struct nvkm_device *, int idx, struct nvkm_pm **);
222 int (*sec )(struct nvkm_device *, int idx, struct nvkm_engine **);
223 int (*sw )(struct nvkm_device *, int idx, struct nvkm_sw **);
224 int (*vic )(struct nvkm_device *, int idx, struct nvkm_engine **);
225 int (*vp )(struct nvkm_device *, int idx, struct nvkm_engine **);
207}; 226};
208 227
209struct nvkm_device *nvkm_device_find(u64 name); 228struct nvkm_device *nvkm_device_find(u64 name);
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/firmware.h b/drivers/gpu/drm/nouveau/include/nvkm/core/firmware.h
new file mode 100644
index 000000000000..a626ce378f04
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/include/nvkm/core/firmware.h
@@ -0,0 +1,11 @@
1#ifndef __NVKM_FIRMWARE_H__
2#define __NVKM_FIRMWARE_H__
3
4#include <core/device.h>
5
6int nvkm_firmware_get(struct nvkm_device *device, const char *fwname,
7 const struct firmware **fw);
8
9void nvkm_firmware_put(const struct firmware *fw);
10
11#endif
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/gpuobj.h b/drivers/gpu/drm/nouveau/include/nvkm/core/gpuobj.h
index d4f56eafb073..c23da4f05929 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/core/gpuobj.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/core/gpuobj.h
@@ -37,4 +37,8 @@ int nvkm_gpuobj_wrap(struct nvkm_memory *, struct nvkm_gpuobj **);
37int nvkm_gpuobj_map(struct nvkm_gpuobj *, struct nvkm_vm *, u32 access, 37int nvkm_gpuobj_map(struct nvkm_gpuobj *, struct nvkm_vm *, u32 access,
38 struct nvkm_vma *); 38 struct nvkm_vma *);
39void nvkm_gpuobj_unmap(struct nvkm_vma *); 39void nvkm_gpuobj_unmap(struct nvkm_vma *);
40void nvkm_gpuobj_memcpy_to(struct nvkm_gpuobj *dst, u32 dstoffset, void *src,
41 u32 length);
42void nvkm_gpuobj_memcpy_from(void *dst, struct nvkm_gpuobj *src, u32 srcoffset,
43 u32 length);
40#endif 44#endif
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/engine/ce.h b/drivers/gpu/drm/nouveau/include/nvkm/engine/ce.h
index e2e22cd5305b..594d719ba41e 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/engine/ce.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/engine/ce.h
@@ -5,5 +5,6 @@
5int gt215_ce_new(struct nvkm_device *, int, struct nvkm_engine **); 5int gt215_ce_new(struct nvkm_device *, int, struct nvkm_engine **);
6int gf100_ce_new(struct nvkm_device *, int, struct nvkm_engine **); 6int gf100_ce_new(struct nvkm_device *, int, struct nvkm_engine **);
7int gk104_ce_new(struct nvkm_device *, int, struct nvkm_engine **); 7int gk104_ce_new(struct nvkm_device *, int, struct nvkm_engine **);
8int gm204_ce_new(struct nvkm_device *, int, struct nvkm_engine **); 8int gm107_ce_new(struct nvkm_device *, int, struct nvkm_engine **);
9int gm200_ce_new(struct nvkm_device *, int, struct nvkm_engine **);
9#endif 10#endif
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/engine/disp.h b/drivers/gpu/drm/nouveau/include/nvkm/engine/disp.h
index efc74d03346b..d4fdce27b297 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/engine/disp.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/engine/disp.h
@@ -31,5 +31,5 @@ int gf119_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
31int gk104_disp_new(struct nvkm_device *, int, struct nvkm_disp **); 31int gk104_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
32int gk110_disp_new(struct nvkm_device *, int, struct nvkm_disp **); 32int gk110_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
33int gm107_disp_new(struct nvkm_device *, int, struct nvkm_disp **); 33int gm107_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
34int gm204_disp_new(struct nvkm_device *, int, struct nvkm_disp **); 34int gm200_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
35#endif 35#endif
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/engine/fifo.h b/drivers/gpu/drm/nouveau/include/nvkm/engine/fifo.h
index 9e6644955d19..15ddfcf5e8db 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/engine/fifo.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/engine/fifo.h
@@ -60,8 +60,10 @@ int nv50_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
60int g84_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **); 60int g84_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
61int gf100_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **); 61int gf100_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
62int gk104_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **); 62int gk104_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
63int gk110_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
63int gk208_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **); 64int gk208_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
64int gk20a_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **); 65int gk20a_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
65int gm204_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **); 66int gm107_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
67int gm200_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
66int gm20b_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **); 68int gm20b_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);
67#endif 69#endif
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/engine/gr.h b/drivers/gpu/drm/nouveau/include/nvkm/engine/gr.h
index f126e54d2e30..6515f5810a26 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/engine/gr.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/engine/gr.h
@@ -40,7 +40,6 @@ int gk110b_gr_new(struct nvkm_device *, int, struct nvkm_gr **);
40int gk208_gr_new(struct nvkm_device *, int, struct nvkm_gr **); 40int gk208_gr_new(struct nvkm_device *, int, struct nvkm_gr **);
41int gk20a_gr_new(struct nvkm_device *, int, struct nvkm_gr **); 41int gk20a_gr_new(struct nvkm_device *, int, struct nvkm_gr **);
42int gm107_gr_new(struct nvkm_device *, int, struct nvkm_gr **); 42int gm107_gr_new(struct nvkm_device *, int, struct nvkm_gr **);
43int gm204_gr_new(struct nvkm_device *, int, struct nvkm_gr **); 43int gm200_gr_new(struct nvkm_device *, int, struct nvkm_gr **);
44int gm206_gr_new(struct nvkm_device *, int, struct nvkm_gr **);
45int gm20b_gr_new(struct nvkm_device *, int, struct nvkm_gr **); 44int gm20b_gr_new(struct nvkm_device *, int, struct nvkm_gr **);
46#endif 45#endif
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/engine/msenc.h b/drivers/gpu/drm/nouveau/include/nvkm/engine/msenc.h
new file mode 100644
index 000000000000..748ea9b7e559
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/include/nvkm/engine/msenc.h
@@ -0,0 +1,4 @@
1#ifndef __NVKM_MSENC_H__
2#define __NVKM_MSENC_H__
3#include <core/engine.h>
4#endif
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/engine/nvdec.h b/drivers/gpu/drm/nouveau/include/nvkm/engine/nvdec.h
new file mode 100644
index 000000000000..30b76d13fdcb
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/include/nvkm/engine/nvdec.h
@@ -0,0 +1,4 @@
1#ifndef __NVKM_NVDEC_H__
2#define __NVKM_NVDEC_H__
3#include <core/engine.h>
4#endif
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/engine/nvenc.h b/drivers/gpu/drm/nouveau/include/nvkm/engine/nvenc.h
new file mode 100644
index 000000000000..8a819328059b
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/include/nvkm/engine/nvenc.h
@@ -0,0 +1,4 @@
1#ifndef __NVKM_NVENC_H__
2#define __NVKM_NVENC_H__
3#include <core/engine.h>
4#endif
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/engine/vic.h b/drivers/gpu/drm/nouveau/include/nvkm/engine/vic.h
new file mode 100644
index 000000000000..2b0dc4c695c2
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/include/nvkm/engine/vic.h
@@ -0,0 +1,4 @@
1#ifndef __NVKM_VIC_H__
2#define __NVKM_VIC_H__
3#include <core/engine.h>
4#endif
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/bios/extdev.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/bios/extdev.h
index 6d3bedc633b3..bb49bd5f879e 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/bios/extdev.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/bios/extdev.h
@@ -5,6 +5,9 @@ enum nvbios_extdev_type {
5 NVBIOS_EXTDEV_VT1103M = 0x40, 5 NVBIOS_EXTDEV_VT1103M = 0x40,
6 NVBIOS_EXTDEV_PX3540 = 0x41, 6 NVBIOS_EXTDEV_PX3540 = 0x41,
7 NVBIOS_EXTDEV_VT1105M = 0x42, /* or close enough... */ 7 NVBIOS_EXTDEV_VT1105M = 0x42, /* or close enough... */
8 NVBIOS_EXTDEV_INA219 = 0x4c,
9 NVBIOS_EXTDEV_INA209 = 0x4d,
10 NVBIOS_EXTDEV_INA3221 = 0x4e,
8 NVBIOS_EXTDEV_ADT7473 = 0x70, /* can also be a LM64 */ 11 NVBIOS_EXTDEV_ADT7473 = 0x70, /* can also be a LM64 */
9 NVBIOS_EXTDEV_HDCP_EEPROM = 0x90, 12 NVBIOS_EXTDEV_HDCP_EEPROM = 0x90,
10 NVBIOS_EXTDEV_NONE = 0xff, 13 NVBIOS_EXTDEV_NONE = 0xff,
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/bios/iccsense.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/bios/iccsense.h
new file mode 100644
index 000000000000..9cb97477248b
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/bios/iccsense.h
@@ -0,0 +1,16 @@
1#ifndef __NVBIOS_ICCSENSE_H__
2#define __NVBIOS_ICCSENSE_H__
3struct pwr_rail_t {
4 u8 mode;
5 u8 extdev_id;
6 u8 resistor_mohm;
7 u8 rail;
8};
9
10struct nvbios_iccsense {
11 int nr_entry;
12 struct pwr_rail_t *rail;
13};
14
15int nvbios_iccsense_parse(struct nvkm_bios *, struct nvbios_iccsense *);
16#endif
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/clk.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/clk.h
index 6b33bc058924..fb54417bc458 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/clk.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/clk.h
@@ -121,4 +121,5 @@ int gt215_clk_new(struct nvkm_device *, int, struct nvkm_clk **);
121int gf100_clk_new(struct nvkm_device *, int, struct nvkm_clk **); 121int gf100_clk_new(struct nvkm_device *, int, struct nvkm_clk **);
122int gk104_clk_new(struct nvkm_device *, int, struct nvkm_clk **); 122int gk104_clk_new(struct nvkm_device *, int, struct nvkm_clk **);
123int gk20a_clk_new(struct nvkm_device *, int, struct nvkm_clk **); 123int gk20a_clk_new(struct nvkm_device *, int, struct nvkm_clk **);
124int gm20b_clk_new(struct nvkm_device *, int, struct nvkm_clk **);
124#endif 125#endif
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/devinit.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/devinit.h
index 6c1407fd317b..193626c69517 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/devinit.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/devinit.h
@@ -27,5 +27,5 @@ int gt215_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
27int mcp89_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **); 27int mcp89_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
28int gf100_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **); 28int gf100_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
29int gm107_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **); 29int gm107_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
30int gm204_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **); 30int gm200_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
31#endif 31#endif
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/i2c.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/i2c.h
index 6b6224dbd5bb..a63c5ac69f66 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/i2c.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/i2c.h
@@ -89,7 +89,7 @@ int g94_i2c_new(struct nvkm_device *, int, struct nvkm_i2c **);
89int gf117_i2c_new(struct nvkm_device *, int, struct nvkm_i2c **); 89int gf117_i2c_new(struct nvkm_device *, int, struct nvkm_i2c **);
90int gf119_i2c_new(struct nvkm_device *, int, struct nvkm_i2c **); 90int gf119_i2c_new(struct nvkm_device *, int, struct nvkm_i2c **);
91int gk104_i2c_new(struct nvkm_device *, int, struct nvkm_i2c **); 91int gk104_i2c_new(struct nvkm_device *, int, struct nvkm_i2c **);
92int gm204_i2c_new(struct nvkm_device *, int, struct nvkm_i2c **); 92int gm200_i2c_new(struct nvkm_device *, int, struct nvkm_i2c **);
93 93
94static inline int 94static inline int
95nvkm_rdi2cr(struct i2c_adapter *adap, u8 addr, u8 reg) 95nvkm_rdi2cr(struct i2c_adapter *adap, u8 addr, u8 reg)
@@ -108,6 +108,22 @@ nvkm_rdi2cr(struct i2c_adapter *adap, u8 addr, u8 reg)
108} 108}
109 109
110static inline int 110static inline int
111nv_rd16i2cr(struct i2c_adapter *adap, u8 addr, u8 reg)
112{
113 u8 val[2];
114 struct i2c_msg msgs[] = {
115 { .addr = addr, .flags = 0, .len = 1, .buf = &reg },
116 { .addr = addr, .flags = I2C_M_RD, .len = 2, .buf = val },
117 };
118
119 int ret = i2c_transfer(adap, msgs, ARRAY_SIZE(msgs));
120 if (ret != 2)
121 return -EIO;
122
123 return val[0] << 8 | val[1];
124}
125
126static inline int
111nvkm_wri2cr(struct i2c_adapter *adap, u8 addr, u8 reg, u8 val) 127nvkm_wri2cr(struct i2c_adapter *adap, u8 addr, u8 reg, u8 val)
112{ 128{
113 u8 buf[2] = { reg, val }; 129 u8 buf[2] = { reg, val };
@@ -122,6 +138,21 @@ nvkm_wri2cr(struct i2c_adapter *adap, u8 addr, u8 reg, u8 val)
122 return 0; 138 return 0;
123} 139}
124 140
141static inline int
142nv_wr16i2cr(struct i2c_adapter *adap, u8 addr, u8 reg, u16 val)
143{
144 u8 buf[3] = { reg, val >> 8, val & 0xff};
145 struct i2c_msg msgs[] = {
146 { .addr = addr, .flags = 0, .len = 3, .buf = buf },
147 };
148
149 int ret = i2c_transfer(adap, msgs, ARRAY_SIZE(msgs));
150 if (ret != 1)
151 return -EIO;
152
153 return 0;
154}
155
125static inline bool 156static inline bool
126nvkm_probe_i2c(struct i2c_adapter *adap, u8 addr) 157nvkm_probe_i2c(struct i2c_adapter *adap, u8 addr)
127{ 158{
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/ibus.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/ibus.h
index ea23e24a246c..c4ecf255ff39 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/ibus.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/ibus.h
@@ -6,5 +6,5 @@ int gf100_ibus_new(struct nvkm_device *, int, struct nvkm_subdev **);
6int gf117_ibus_new(struct nvkm_device *, int, struct nvkm_subdev **); 6int gf117_ibus_new(struct nvkm_device *, int, struct nvkm_subdev **);
7int gk104_ibus_new(struct nvkm_device *, int, struct nvkm_subdev **); 7int gk104_ibus_new(struct nvkm_device *, int, struct nvkm_subdev **);
8int gk20a_ibus_new(struct nvkm_device *, int, struct nvkm_subdev **); 8int gk20a_ibus_new(struct nvkm_device *, int, struct nvkm_subdev **);
9int gm204_ibus_new(struct nvkm_device *, int, struct nvkm_subdev **); 9int gm200_ibus_new(struct nvkm_device *, int, struct nvkm_subdev **);
10#endif 10#endif
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/iccsense.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/iccsense.h
new file mode 100644
index 000000000000..530c6215fe4f
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/iccsense.h
@@ -0,0 +1,17 @@
1#ifndef __NVKM_ICCSENSE_H__
2#define __NVKM_ICCSENSE_H__
3
4#include <core/subdev.h>
5
6struct nkvm_iccsense_rail;
7struct nvkm_iccsense {
8 struct nvkm_subdev subdev;
9 u8 rail_count;
10 bool data_valid;
11 struct nvkm_iccsense_rail *rails;
12};
13
14int gf100_iccsense_new(struct nvkm_device *, int index, struct nvkm_iccsense **);
15int nvkm_iccsense_read(struct nvkm_iccsense *iccsense, u8 idx);
16int nvkm_iccsense_read_all(struct nvkm_iccsense *iccsense);
17#endif
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/ltc.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/ltc.h
index 0ffa2ec106d6..c6b90b6543b3 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/ltc.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/ltc.h
@@ -37,5 +37,5 @@ int gf100_ltc_new(struct nvkm_device *, int, struct nvkm_ltc **);
37int gk104_ltc_new(struct nvkm_device *, int, struct nvkm_ltc **); 37int gk104_ltc_new(struct nvkm_device *, int, struct nvkm_ltc **);
38int gk20a_ltc_new(struct nvkm_device *, int, struct nvkm_ltc **); 38int gk20a_ltc_new(struct nvkm_device *, int, struct nvkm_ltc **);
39int gm107_ltc_new(struct nvkm_device *, int, struct nvkm_ltc **); 39int gm107_ltc_new(struct nvkm_device *, int, struct nvkm_ltc **);
40int gm204_ltc_new(struct nvkm_device *, int, struct nvkm_ltc **); 40int gm200_ltc_new(struct nvkm_device *, int, struct nvkm_ltc **);
41#endif 41#endif
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/secboot.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/secboot.h
new file mode 100644
index 000000000000..c6edd95a5b69
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/secboot.h
@@ -0,0 +1,59 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef __NVKM_SECURE_BOOT_H__
24#define __NVKM_SECURE_BOOT_H__
25
26#include <core/subdev.h>
27
28enum nvkm_secboot_falcon {
29 NVKM_SECBOOT_FALCON_PMU = 0,
30 NVKM_SECBOOT_FALCON_RESERVED = 1,
31 NVKM_SECBOOT_FALCON_FECS = 2,
32 NVKM_SECBOOT_FALCON_GPCCS = 3,
33 NVKM_SECBOOT_FALCON_END = 4,
34 NVKM_SECBOOT_FALCON_INVALID = 0xffffffff,
35};
36
37/**
38 * @base: base IO address of the falcon performing secure boot
39 * @irq_mask: IRQ mask of the falcon performing secure boot
40 * @enable_mask: enable mask of the falcon performing secure boot
41*/
42struct nvkm_secboot {
43 const struct nvkm_secboot_func *func;
44 struct nvkm_subdev subdev;
45
46 u32 base;
47 u32 irq_mask;
48 u32 enable_mask;
49};
50#define nvkm_secboot(p) container_of((p), struct nvkm_secboot, subdev)
51
52bool nvkm_secboot_is_managed(struct nvkm_secboot *, enum nvkm_secboot_falcon);
53int nvkm_secboot_reset(struct nvkm_secboot *, u32 falcon);
54int nvkm_secboot_start(struct nvkm_secboot *, u32 falcon);
55
56int gm200_secboot_new(struct nvkm_device *, int, struct nvkm_secboot **);
57int gm20b_secboot_new(struct nvkm_device *, int, struct nvkm_secboot **);
58
59#endif
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/volt.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/volt.h
index b458d046dba7..feff55cff05b 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/volt.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/volt.h
@@ -20,4 +20,5 @@ int nvkm_volt_set_id(struct nvkm_volt *, u8 id, int condition);
20int nv40_volt_new(struct nvkm_device *, int, struct nvkm_volt **); 20int nv40_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
21int gk104_volt_new(struct nvkm_device *, int, struct nvkm_volt **); 21int gk104_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
22int gk20a_volt_new(struct nvkm_device *, int, struct nvkm_volt **); 22int gk20a_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
23int gm20b_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
23#endif 24#endif
diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c
index 50f52ffe5b0c..a59e524c028c 100644
--- a/drivers/gpu/drm/nouveau/nouveau_abi16.c
+++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c
@@ -263,13 +263,23 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS)
263 /* hack to allow channel engine type specification on kepler */ 263 /* hack to allow channel engine type specification on kepler */
264 if (device->info.family >= NV_DEVICE_INFO_V0_KEPLER) { 264 if (device->info.family >= NV_DEVICE_INFO_V0_KEPLER) {
265 if (init->fb_ctxdma_handle != ~0) 265 if (init->fb_ctxdma_handle != ~0)
266 init->fb_ctxdma_handle = KEPLER_CHANNEL_GPFIFO_A_V0_ENGINE_GR; 266 init->fb_ctxdma_handle = NVA06F_V0_ENGINE_GR;
267 else 267 else {
268 init->fb_ctxdma_handle = init->tt_ctxdma_handle; 268 init->fb_ctxdma_handle = 0;
269#define _(A,B) if (init->tt_ctxdma_handle & (A)) init->fb_ctxdma_handle |= (B)
270 _(0x01, NVA06F_V0_ENGINE_GR);
271 _(0x02, NVA06F_V0_ENGINE_MSPDEC);
272 _(0x04, NVA06F_V0_ENGINE_MSPPP);
273 _(0x08, NVA06F_V0_ENGINE_MSVLD);
274 _(0x10, NVA06F_V0_ENGINE_CE0);
275 _(0x20, NVA06F_V0_ENGINE_CE1);
276 _(0x40, NVA06F_V0_ENGINE_MSENC);
277#undef _
278 }
269 279
270 /* allow flips to be executed if this is a graphics channel */ 280 /* allow flips to be executed if this is a graphics channel */
271 init->tt_ctxdma_handle = 0; 281 init->tt_ctxdma_handle = 0;
272 if (init->fb_ctxdma_handle == KEPLER_CHANNEL_GPFIFO_A_V0_ENGINE_GR) 282 if (init->fb_ctxdma_handle == NVA06F_V0_ENGINE_GR)
273 init->tt_ctxdma_handle = 1; 283 init->tt_ctxdma_handle = 1;
274 } 284 }
275 285
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index e3acc35e3805..2cdaea58678d 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -1502,7 +1502,7 @@ nouveau_ttm_tt_populate(struct ttm_tt *ttm)
1502 } 1502 }
1503#endif 1503#endif
1504 1504
1505#ifdef CONFIG_SWIOTLB 1505#if IS_ENABLED(CONFIG_SWIOTLB) && IS_ENABLED(CONFIG_X86)
1506 if (swiotlb_nr_tbl()) { 1506 if (swiotlb_nr_tbl()) {
1507 return ttm_dma_populate((void *)ttm, dev->dev); 1507 return ttm_dma_populate((void *)ttm, dev->dev);
1508 } 1508 }
@@ -1570,7 +1570,7 @@ nouveau_ttm_tt_unpopulate(struct ttm_tt *ttm)
1570 } 1570 }
1571#endif 1571#endif
1572 1572
1573#ifdef CONFIG_SWIOTLB 1573#if IS_ENABLED(CONFIG_SWIOTLB) && IS_ENABLED(CONFIG_X86)
1574 if (swiotlb_nr_tbl()) { 1574 if (swiotlb_nr_tbl()) {
1575 ttm_dma_unpopulate((void *)ttm, dev->dev); 1575 ttm_dma_unpopulate((void *)ttm, dev->dev);
1576 return; 1576 return;
diff --git a/drivers/gpu/drm/nouveau/nouveau_chan.c b/drivers/gpu/drm/nouveau/nouveau_chan.c
index 3f804a8c590c..879655c03ae9 100644
--- a/drivers/gpu/drm/nouveau/nouveau_chan.c
+++ b/drivers/gpu/drm/nouveau/nouveau_chan.c
@@ -192,6 +192,7 @@ nouveau_channel_ind(struct nouveau_drm *drm, struct nvif_device *device,
192 u32 engine, struct nouveau_channel **pchan) 192 u32 engine, struct nouveau_channel **pchan)
193{ 193{
194 static const u16 oclasses[] = { MAXWELL_CHANNEL_GPFIFO_A, 194 static const u16 oclasses[] = { MAXWELL_CHANNEL_GPFIFO_A,
195 KEPLER_CHANNEL_GPFIFO_B,
195 KEPLER_CHANNEL_GPFIFO_A, 196 KEPLER_CHANNEL_GPFIFO_A,
196 FERMI_CHANNEL_GPFIFO, 197 FERMI_CHANNEL_GPFIFO,
197 G82_CHANNEL_GPFIFO, 198 G82_CHANNEL_GPFIFO,
@@ -217,7 +218,7 @@ nouveau_channel_ind(struct nouveau_drm *drm, struct nvif_device *device,
217 do { 218 do {
218 if (oclass[0] >= KEPLER_CHANNEL_GPFIFO_A) { 219 if (oclass[0] >= KEPLER_CHANNEL_GPFIFO_A) {
219 args.kepler.version = 0; 220 args.kepler.version = 0;
220 args.kepler.engine = engine; 221 args.kepler.engines = engine;
221 args.kepler.ilength = 0x02000; 222 args.kepler.ilength = 0x02000;
222 args.kepler.ioffset = 0x10000 + chan->push.vma.offset; 223 args.kepler.ioffset = 0x10000 + chan->push.vma.offset;
223 args.kepler.vm = 0; 224 args.kepler.vm = 0;
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 20935eb2a09e..7ce7fa5cb5e6 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -495,7 +495,7 @@ nouveau_display_create(struct drm_device *dev)
495 495
496 if (nouveau_modeset != 2 && drm->vbios.dcb.entries) { 496 if (nouveau_modeset != 2 && drm->vbios.dcb.entries) {
497 static const u16 oclass[] = { 497 static const u16 oclass[] = {
498 GM204_DISP, 498 GM200_DISP,
499 GM107_DISP, 499 GM107_DISP,
500 GK110_DISP, 500 GK110_DISP,
501 GK104_DISP, 501 GK104_DISP,
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index bb8498c9b13e..d06877d9c1ed 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -198,6 +198,7 @@ nouveau_accel_init(struct nouveau_drm *drm)
198 break; 198 break;
199 case FERMI_CHANNEL_GPFIFO: 199 case FERMI_CHANNEL_GPFIFO:
200 case KEPLER_CHANNEL_GPFIFO_A: 200 case KEPLER_CHANNEL_GPFIFO_A:
201 case KEPLER_CHANNEL_GPFIFO_B:
201 case MAXWELL_CHANNEL_GPFIFO_A: 202 case MAXWELL_CHANNEL_GPFIFO_A:
202 ret = nvc0_fence_create(drm); 203 ret = nvc0_fence_create(drm);
203 break; 204 break;
@@ -215,13 +216,13 @@ nouveau_accel_init(struct nouveau_drm *drm)
215 216
216 if (device->info.family >= NV_DEVICE_INFO_V0_KEPLER) { 217 if (device->info.family >= NV_DEVICE_INFO_V0_KEPLER) {
217 ret = nouveau_channel_new(drm, &drm->device, 218 ret = nouveau_channel_new(drm, &drm->device,
218 KEPLER_CHANNEL_GPFIFO_A_V0_ENGINE_CE0| 219 NVA06F_V0_ENGINE_CE0 |
219 KEPLER_CHANNEL_GPFIFO_A_V0_ENGINE_CE1, 220 NVA06F_V0_ENGINE_CE1,
220 0, &drm->cechan); 221 0, &drm->cechan);
221 if (ret) 222 if (ret)
222 NV_ERROR(drm, "failed to create ce channel, %d\n", ret); 223 NV_ERROR(drm, "failed to create ce channel, %d\n", ret);
223 224
224 arg0 = KEPLER_CHANNEL_GPFIFO_A_V0_ENGINE_GR; 225 arg0 = NVA06F_V0_ENGINE_GR;
225 arg1 = 1; 226 arg1 = 1;
226 } else 227 } else
227 if (device->info.chipset >= 0xa3 && 228 if (device->info.chipset >= 0xa3 &&
@@ -375,7 +376,7 @@ nouveau_get_hdmi_dev(struct nouveau_drm *drm)
375 struct pci_dev *pdev = drm->dev->pdev; 376 struct pci_dev *pdev = drm->dev->pdev;
376 377
377 if (!pdev) { 378 if (!pdev) {
378 DRM_INFO("not a PCI device; no HDMI\n"); 379 NV_DEBUG(drm, "not a PCI device; no HDMI\n");
379 drm->hdmi_device = NULL; 380 drm->hdmi_device = NULL;
380 return; 381 return;
381 } 382 }
diff --git a/drivers/gpu/drm/nouveau/nouveau_hwmon.c b/drivers/gpu/drm/nouveau/nouveau_hwmon.c
index 8e13467d0ddb..67edd2f5b71a 100644
--- a/drivers/gpu/drm/nouveau/nouveau_hwmon.c
+++ b/drivers/gpu/drm/nouveau/nouveau_hwmon.c
@@ -34,6 +34,7 @@
34#include "nouveau_drm.h" 34#include "nouveau_drm.h"
35#include "nouveau_hwmon.h" 35#include "nouveau_hwmon.h"
36 36
37#include <nvkm/subdev/iccsense.h>
37#include <nvkm/subdev/volt.h> 38#include <nvkm/subdev/volt.h>
38 39
39#if defined(CONFIG_HWMON) || (defined(MODULE) && defined(CONFIG_HWMON_MODULE)) 40#if defined(CONFIG_HWMON) || (defined(MODULE) && defined(CONFIG_HWMON_MODULE))
@@ -543,6 +544,24 @@ nouveau_hwmon_get_in0_label(struct device *d,
543static SENSOR_DEVICE_ATTR(in0_label, S_IRUGO, 544static SENSOR_DEVICE_ATTR(in0_label, S_IRUGO,
544 nouveau_hwmon_get_in0_label, NULL, 0); 545 nouveau_hwmon_get_in0_label, NULL, 0);
545 546
547static ssize_t
548nouveau_hwmon_get_power1_input(struct device *d, struct device_attribute *a,
549 char *buf)
550{
551 struct drm_device *dev = dev_get_drvdata(d);
552 struct nouveau_drm *drm = nouveau_drm(dev);
553 struct nvkm_iccsense *iccsense = nvxx_iccsense(&drm->device);
554 int result = nvkm_iccsense_read_all(iccsense);
555
556 if (result < 0)
557 return result;
558
559 return sprintf(buf, "%i\n", result);
560}
561
562static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO,
563 nouveau_hwmon_get_power1_input, NULL, 0);
564
546static struct attribute *hwmon_default_attributes[] = { 565static struct attribute *hwmon_default_attributes[] = {
547 &sensor_dev_attr_name.dev_attr.attr, 566 &sensor_dev_attr_name.dev_attr.attr,
548 &sensor_dev_attr_update_rate.dev_attr.attr, 567 &sensor_dev_attr_update_rate.dev_attr.attr,
@@ -579,6 +598,11 @@ static struct attribute *hwmon_in0_attributes[] = {
579 NULL 598 NULL
580}; 599};
581 600
601static struct attribute *hwmon_power_attributes[] = {
602 &sensor_dev_attr_power1_input.dev_attr.attr,
603 NULL
604};
605
582static const struct attribute_group hwmon_default_attrgroup = { 606static const struct attribute_group hwmon_default_attrgroup = {
583 .attrs = hwmon_default_attributes, 607 .attrs = hwmon_default_attributes,
584}; 608};
@@ -594,6 +618,9 @@ static const struct attribute_group hwmon_pwm_fan_attrgroup = {
594static const struct attribute_group hwmon_in0_attrgroup = { 618static const struct attribute_group hwmon_in0_attrgroup = {
595 .attrs = hwmon_in0_attributes, 619 .attrs = hwmon_in0_attributes,
596}; 620};
621static const struct attribute_group hwmon_power_attrgroup = {
622 .attrs = hwmon_power_attributes,
623};
597#endif 624#endif
598 625
599int 626int
@@ -603,6 +630,7 @@ nouveau_hwmon_init(struct drm_device *dev)
603 struct nouveau_drm *drm = nouveau_drm(dev); 630 struct nouveau_drm *drm = nouveau_drm(dev);
604 struct nvkm_therm *therm = nvxx_therm(&drm->device); 631 struct nvkm_therm *therm = nvxx_therm(&drm->device);
605 struct nvkm_volt *volt = nvxx_volt(&drm->device); 632 struct nvkm_volt *volt = nvxx_volt(&drm->device);
633 struct nvkm_iccsense *iccsense = nvxx_iccsense(&drm->device);
606 struct nouveau_hwmon *hwmon; 634 struct nouveau_hwmon *hwmon;
607 struct device *hwmon_dev; 635 struct device *hwmon_dev;
608 int ret = 0; 636 int ret = 0;
@@ -612,10 +640,7 @@ nouveau_hwmon_init(struct drm_device *dev)
612 return -ENOMEM; 640 return -ENOMEM;
613 hwmon->dev = dev; 641 hwmon->dev = dev;
614 642
615 if (!therm || !therm->attr_get || !therm->attr_set) 643 hwmon_dev = hwmon_device_register(dev->dev);
616 return -ENODEV;
617
618 hwmon_dev = hwmon_device_register(&dev->pdev->dev);
619 if (IS_ERR(hwmon_dev)) { 644 if (IS_ERR(hwmon_dev)) {
620 ret = PTR_ERR(hwmon_dev); 645 ret = PTR_ERR(hwmon_dev);
621 NV_ERROR(drm, "Unable to register hwmon device: %d\n", ret); 646 NV_ERROR(drm, "Unable to register hwmon device: %d\n", ret);
@@ -628,26 +653,28 @@ nouveau_hwmon_init(struct drm_device *dev)
628 if (ret) 653 if (ret)
629 goto error; 654 goto error;
630 655
631 /* if the card has a working thermal sensor */ 656 if (therm && therm->attr_get && therm->attr_set) {
632 if (nvkm_therm_temp_get(therm) >= 0) { 657 /* if the card has a working thermal sensor */
633 ret = sysfs_create_group(&hwmon_dev->kobj, &hwmon_temp_attrgroup); 658 if (nvkm_therm_temp_get(therm) >= 0) {
634 if (ret) 659 ret = sysfs_create_group(&hwmon_dev->kobj, &hwmon_temp_attrgroup);
635 goto error; 660 if (ret)
636 } 661 goto error;
637 662 }
638 /* if the card has a pwm fan */ 663
639 /*XXX: incorrect, need better detection for this, some boards have 664 /* if the card has a pwm fan */
640 * the gpio entries for pwm fan control even when there's no 665 /*XXX: incorrect, need better detection for this, some boards have
641 * actual fan connected to it... therm table? */ 666 * the gpio entries for pwm fan control even when there's no
642 if (therm->fan_get && therm->fan_get(therm) >= 0) { 667 * actual fan connected to it... therm table? */
643 ret = sysfs_create_group(&hwmon_dev->kobj, 668 if (therm->fan_get && therm->fan_get(therm) >= 0) {
644 &hwmon_pwm_fan_attrgroup); 669 ret = sysfs_create_group(&hwmon_dev->kobj,
645 if (ret) 670 &hwmon_pwm_fan_attrgroup);
646 goto error; 671 if (ret)
672 goto error;
673 }
647 } 674 }
648 675
649 /* if the card can read the fan rpm */ 676 /* if the card can read the fan rpm */
650 if (nvkm_therm_fan_sense(therm) >= 0) { 677 if (therm && nvkm_therm_fan_sense(therm) >= 0) {
651 ret = sysfs_create_group(&hwmon_dev->kobj, 678 ret = sysfs_create_group(&hwmon_dev->kobj,
652 &hwmon_fan_rpm_attrgroup); 679 &hwmon_fan_rpm_attrgroup);
653 if (ret) 680 if (ret)
@@ -662,6 +689,13 @@ nouveau_hwmon_init(struct drm_device *dev)
662 goto error; 689 goto error;
663 } 690 }
664 691
692 if (iccsense && iccsense->data_valid && iccsense->rail_count) {
693 ret = sysfs_create_group(&hwmon_dev->kobj,
694 &hwmon_power_attrgroup);
695 if (ret)
696 goto error;
697 }
698
665 hwmon->hwmon = hwmon_dev; 699 hwmon->hwmon = hwmon_dev;
666 700
667 return 0; 701 return 0;
@@ -688,6 +722,7 @@ nouveau_hwmon_fini(struct drm_device *dev)
688 sysfs_remove_group(&hwmon->hwmon->kobj, &hwmon_pwm_fan_attrgroup); 722 sysfs_remove_group(&hwmon->hwmon->kobj, &hwmon_pwm_fan_attrgroup);
689 sysfs_remove_group(&hwmon->hwmon->kobj, &hwmon_fan_rpm_attrgroup); 723 sysfs_remove_group(&hwmon->hwmon->kobj, &hwmon_fan_rpm_attrgroup);
690 sysfs_remove_group(&hwmon->hwmon->kobj, &hwmon_in0_attrgroup); 724 sysfs_remove_group(&hwmon->hwmon->kobj, &hwmon_in0_attrgroup);
725 sysfs_remove_group(&hwmon->hwmon->kobj, &hwmon_power_attrgroup);
691 726
692 hwmon_device_unregister(hwmon->hwmon); 727 hwmon_device_unregister(hwmon->hwmon);
693 } 728 }
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index ea3921652449..a43445caae60 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -297,7 +297,7 @@ nv50_core_create(struct nvif_device *device, struct nvif_object *disp,
297 .pushbuf = 0xb0007d00, 297 .pushbuf = 0xb0007d00,
298 }; 298 };
299 static const s32 oclass[] = { 299 static const s32 oclass[] = {
300 GM204_DISP_CORE_CHANNEL_DMA, 300 GM200_DISP_CORE_CHANNEL_DMA,
301 GM107_DISP_CORE_CHANNEL_DMA, 301 GM107_DISP_CORE_CHANNEL_DMA,
302 GK110_DISP_CORE_CHANNEL_DMA, 302 GK110_DISP_CORE_CHANNEL_DMA,
303 GK104_DISP_CORE_CHANNEL_DMA, 303 GK104_DISP_CORE_CHANNEL_DMA,
diff --git a/drivers/gpu/drm/nouveau/nvkm/core/Kbuild b/drivers/gpu/drm/nouveau/nvkm/core/Kbuild
index 7f66963f305c..86a31a8e1e51 100644
--- a/drivers/gpu/drm/nouveau/nvkm/core/Kbuild
+++ b/drivers/gpu/drm/nouveau/nvkm/core/Kbuild
@@ -2,6 +2,7 @@ nvkm-y := nvkm/core/client.o
2nvkm-y += nvkm/core/engine.o 2nvkm-y += nvkm/core/engine.o
3nvkm-y += nvkm/core/enum.o 3nvkm-y += nvkm/core/enum.o
4nvkm-y += nvkm/core/event.o 4nvkm-y += nvkm/core/event.o
5nvkm-y += nvkm/core/firmware.o
5nvkm-y += nvkm/core/gpuobj.o 6nvkm-y += nvkm/core/gpuobj.o
6nvkm-y += nvkm/core/ioctl.o 7nvkm-y += nvkm/core/ioctl.o
7nvkm-y += nvkm/core/memory.o 8nvkm-y += nvkm/core/memory.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/core/firmware.c b/drivers/gpu/drm/nouveau/nvkm/core/firmware.c
new file mode 100644
index 000000000000..34ecd4a7e0c1
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/core/firmware.c
@@ -0,0 +1,61 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22#include <core/device.h>
23
24/**
25 * nvkm_firmware_get - load firmware from the official nvidia/chip/ directory
26 * @device device that will use that firmware
27 * @fwname name of firmware file to load
28 * @fw firmware structure to load to
29 *
30 * Use this function to load firmware files in the form nvidia/chip/fwname.bin.
31 * Firmware files released by NVIDIA will always follow this format.
32 */
33int
34nvkm_firmware_get(struct nvkm_device *device, const char *fwname,
35 const struct firmware **fw)
36{
37 char f[64];
38 char cname[16];
39 int i;
40
41 /* Convert device name to lowercase */
42 strncpy(cname, device->chip->name, sizeof(cname));
43 cname[sizeof(cname) - 1] = '\0';
44 i = strlen(cname);
45 while (i) {
46 --i;
47 cname[i] = tolower(cname[i]);
48 }
49
50 snprintf(f, sizeof(f), "nvidia/%s/%s.bin", cname, fwname);
51 return request_firmware(fw, f, device->dev);
52}
53
54/**
55 * nvkm_firmware_put - release firmware loaded with nvkm_firmware_get
56 */
57void
58nvkm_firmware_put(const struct firmware *fw)
59{
60 release_firmware(fw);
61}
diff --git a/drivers/gpu/drm/nouveau/nvkm/core/gpuobj.c b/drivers/gpu/drm/nouveau/nvkm/core/gpuobj.c
index c3a790eb8d6a..a7bd22706b2a 100644
--- a/drivers/gpu/drm/nouveau/nvkm/core/gpuobj.c
+++ b/drivers/gpu/drm/nouveau/nvkm/core/gpuobj.c
@@ -253,3 +253,23 @@ nvkm_gpuobj_wrap(struct nvkm_memory *memory, struct nvkm_gpuobj **pgpuobj)
253 (*pgpuobj)->size = nvkm_memory_size(memory); 253 (*pgpuobj)->size = nvkm_memory_size(memory);
254 return 0; 254 return 0;
255} 255}
256
257void
258nvkm_gpuobj_memcpy_to(struct nvkm_gpuobj *dst, u32 dstoffset, void *src,
259 u32 length)
260{
261 int i;
262
263 for (i = 0; i < length; i += 4)
264 nvkm_wo32(dst, dstoffset + i, *(u32 *)(src + i));
265}
266
267void
268nvkm_gpuobj_memcpy_from(void *dst, struct nvkm_gpuobj *src, u32 srcoffset,
269 u32 length)
270{
271 int i;
272
273 for (i = 0; i < length; i += 4)
274 ((u32 *)src)[i / 4] = nvkm_ro32(src, srcoffset + i);
275}
diff --git a/drivers/gpu/drm/nouveau/nvkm/core/ramht.c b/drivers/gpu/drm/nouveau/nvkm/core/ramht.c
index 3216e157a8a0..89da47234016 100644
--- a/drivers/gpu/drm/nouveau/nvkm/core/ramht.c
+++ b/drivers/gpu/drm/nouveau/nvkm/core/ramht.c
@@ -131,7 +131,7 @@ nvkm_ramht_del(struct nvkm_ramht **pramht)
131 struct nvkm_ramht *ramht = *pramht; 131 struct nvkm_ramht *ramht = *pramht;
132 if (ramht) { 132 if (ramht) {
133 nvkm_gpuobj_del(&ramht->gpuobj); 133 nvkm_gpuobj_del(&ramht->gpuobj);
134 kfree(*pramht); 134 vfree(*pramht);
135 *pramht = NULL; 135 *pramht = NULL;
136 } 136 }
137} 137}
@@ -143,8 +143,8 @@ nvkm_ramht_new(struct nvkm_device *device, u32 size, u32 align,
143 struct nvkm_ramht *ramht; 143 struct nvkm_ramht *ramht;
144 int ret, i; 144 int ret, i;
145 145
146 if (!(ramht = *pramht = kzalloc(sizeof(*ramht) + (size >> 3) * 146 if (!(ramht = *pramht = vzalloc(sizeof(*ramht) +
147 sizeof(*ramht->data), GFP_KERNEL))) 147 (size >> 3) * sizeof(*ramht->data))))
148 return -ENOMEM; 148 return -ENOMEM;
149 149
150 ramht->device = device; 150 ramht->device = device;
diff --git a/drivers/gpu/drm/nouveau/nvkm/core/subdev.c b/drivers/gpu/drm/nouveau/nvkm/core/subdev.c
index 7de98470a2a0..3bf08cb1a289 100644
--- a/drivers/gpu/drm/nouveau/nvkm/core/subdev.c
+++ b/drivers/gpu/drm/nouveau/nvkm/core/subdev.c
@@ -29,47 +29,52 @@ static struct lock_class_key nvkm_subdev_lock_class[NVKM_SUBDEV_NR];
29 29
30const char * 30const char *
31nvkm_subdev_name[NVKM_SUBDEV_NR] = { 31nvkm_subdev_name[NVKM_SUBDEV_NR] = {
32 [NVKM_SUBDEV_BAR ] = "bar", 32 [NVKM_SUBDEV_BAR ] = "bar",
33 [NVKM_SUBDEV_VBIOS ] = "bios", 33 [NVKM_SUBDEV_VBIOS ] = "bios",
34 [NVKM_SUBDEV_BUS ] = "bus", 34 [NVKM_SUBDEV_BUS ] = "bus",
35 [NVKM_SUBDEV_CLK ] = "clk", 35 [NVKM_SUBDEV_CLK ] = "clk",
36 [NVKM_SUBDEV_DEVINIT] = "devinit", 36 [NVKM_SUBDEV_DEVINIT ] = "devinit",
37 [NVKM_SUBDEV_FB ] = "fb", 37 [NVKM_SUBDEV_FB ] = "fb",
38 [NVKM_SUBDEV_FUSE ] = "fuse", 38 [NVKM_SUBDEV_FUSE ] = "fuse",
39 [NVKM_SUBDEV_GPIO ] = "gpio", 39 [NVKM_SUBDEV_GPIO ] = "gpio",
40 [NVKM_SUBDEV_I2C ] = "i2c", 40 [NVKM_SUBDEV_I2C ] = "i2c",
41 [NVKM_SUBDEV_IBUS ] = "priv", 41 [NVKM_SUBDEV_IBUS ] = "priv",
42 [NVKM_SUBDEV_INSTMEM] = "imem", 42 [NVKM_SUBDEV_ICCSENSE] = "iccsense",
43 [NVKM_SUBDEV_LTC ] = "ltc", 43 [NVKM_SUBDEV_INSTMEM ] = "imem",
44 [NVKM_SUBDEV_MC ] = "mc", 44 [NVKM_SUBDEV_LTC ] = "ltc",
45 [NVKM_SUBDEV_MMU ] = "mmu", 45 [NVKM_SUBDEV_MC ] = "mc",
46 [NVKM_SUBDEV_MXM ] = "mxm", 46 [NVKM_SUBDEV_MMU ] = "mmu",
47 [NVKM_SUBDEV_PCI ] = "pci", 47 [NVKM_SUBDEV_MXM ] = "mxm",
48 [NVKM_SUBDEV_PMU ] = "pmu", 48 [NVKM_SUBDEV_PCI ] = "pci",
49 [NVKM_SUBDEV_THERM ] = "therm", 49 [NVKM_SUBDEV_PMU ] = "pmu",
50 [NVKM_SUBDEV_TIMER ] = "tmr", 50 [NVKM_SUBDEV_SECBOOT ] = "secboot",
51 [NVKM_SUBDEV_VOLT ] = "volt", 51 [NVKM_SUBDEV_THERM ] = "therm",
52 [NVKM_ENGINE_BSP ] = "bsp", 52 [NVKM_SUBDEV_TIMER ] = "tmr",
53 [NVKM_ENGINE_CE0 ] = "ce0", 53 [NVKM_SUBDEV_VOLT ] = "volt",
54 [NVKM_ENGINE_CE1 ] = "ce1", 54 [NVKM_ENGINE_BSP ] = "bsp",
55 [NVKM_ENGINE_CE2 ] = "ce2", 55 [NVKM_ENGINE_CE0 ] = "ce0",
56 [NVKM_ENGINE_CIPHER ] = "cipher", 56 [NVKM_ENGINE_CE1 ] = "ce1",
57 [NVKM_ENGINE_DISP ] = "disp", 57 [NVKM_ENGINE_CE2 ] = "ce2",
58 [NVKM_ENGINE_DMAOBJ ] = "dma", 58 [NVKM_ENGINE_CIPHER ] = "cipher",
59 [NVKM_ENGINE_FIFO ] = "fifo", 59 [NVKM_ENGINE_DISP ] = "disp",
60 [NVKM_ENGINE_GR ] = "gr", 60 [NVKM_ENGINE_DMAOBJ ] = "dma",
61 [NVKM_ENGINE_IFB ] = "ifb", 61 [NVKM_ENGINE_FIFO ] = "fifo",
62 [NVKM_ENGINE_ME ] = "me", 62 [NVKM_ENGINE_GR ] = "gr",
63 [NVKM_ENGINE_MPEG ] = "mpeg", 63 [NVKM_ENGINE_IFB ] = "ifb",
64 [NVKM_ENGINE_MSENC ] = "msenc", 64 [NVKM_ENGINE_ME ] = "me",
65 [NVKM_ENGINE_MSPDEC ] = "mspdec", 65 [NVKM_ENGINE_MPEG ] = "mpeg",
66 [NVKM_ENGINE_MSPPP ] = "msppp", 66 [NVKM_ENGINE_MSENC ] = "msenc",
67 [NVKM_ENGINE_MSVLD ] = "msvld", 67 [NVKM_ENGINE_MSPDEC ] = "mspdec",
68 [NVKM_ENGINE_PM ] = "pm", 68 [NVKM_ENGINE_MSPPP ] = "msppp",
69 [NVKM_ENGINE_SEC ] = "sec", 69 [NVKM_ENGINE_MSVLD ] = "msvld",
70 [NVKM_ENGINE_SW ] = "sw", 70 [NVKM_ENGINE_NVENC0 ] = "nvenc0",
71 [NVKM_ENGINE_VIC ] = "vic", 71 [NVKM_ENGINE_NVENC1 ] = "nvenc1",
72 [NVKM_ENGINE_VP ] = "vp", 72 [NVKM_ENGINE_NVDEC ] = "nvdec",
73 [NVKM_ENGINE_PM ] = "pm",
74 [NVKM_ENGINE_SEC ] = "sec",
75 [NVKM_ENGINE_SW ] = "sw",
76 [NVKM_ENGINE_VIC ] = "vic",
77 [NVKM_ENGINE_VP ] = "vp",
73}; 78};
74 79
75void 80void
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/Kbuild b/drivers/gpu/drm/nouveau/nvkm/engine/Kbuild
index 36f724763fde..c2c8d2ac01b8 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/Kbuild
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/Kbuild
@@ -10,10 +10,14 @@ include $(src)/nvkm/engine/dma/Kbuild
10include $(src)/nvkm/engine/fifo/Kbuild 10include $(src)/nvkm/engine/fifo/Kbuild
11include $(src)/nvkm/engine/gr/Kbuild 11include $(src)/nvkm/engine/gr/Kbuild
12include $(src)/nvkm/engine/mpeg/Kbuild 12include $(src)/nvkm/engine/mpeg/Kbuild
13include $(src)/nvkm/engine/msenc/Kbuild
13include $(src)/nvkm/engine/mspdec/Kbuild 14include $(src)/nvkm/engine/mspdec/Kbuild
14include $(src)/nvkm/engine/msppp/Kbuild 15include $(src)/nvkm/engine/msppp/Kbuild
15include $(src)/nvkm/engine/msvld/Kbuild 16include $(src)/nvkm/engine/msvld/Kbuild
17include $(src)/nvkm/engine/nvenc/Kbuild
18include $(src)/nvkm/engine/nvdec/Kbuild
16include $(src)/nvkm/engine/pm/Kbuild 19include $(src)/nvkm/engine/pm/Kbuild
17include $(src)/nvkm/engine/sec/Kbuild 20include $(src)/nvkm/engine/sec/Kbuild
18include $(src)/nvkm/engine/sw/Kbuild 21include $(src)/nvkm/engine/sw/Kbuild
22include $(src)/nvkm/engine/vic/Kbuild
19include $(src)/nvkm/engine/vp/Kbuild 23include $(src)/nvkm/engine/vp/Kbuild
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/ce/Kbuild b/drivers/gpu/drm/nouveau/nvkm/engine/ce/Kbuild
index fa8cda7058cd..9c19d59b47df 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/ce/Kbuild
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/ce/Kbuild
@@ -1,4 +1,5 @@
1nvkm-y += nvkm/engine/ce/gt215.o 1nvkm-y += nvkm/engine/ce/gt215.o
2nvkm-y += nvkm/engine/ce/gf100.o 2nvkm-y += nvkm/engine/ce/gf100.o
3nvkm-y += nvkm/engine/ce/gk104.o 3nvkm-y += nvkm/engine/ce/gk104.o
4nvkm-y += nvkm/engine/ce/gm204.o 4nvkm-y += nvkm/engine/ce/gm107.o
5nvkm-y += nvkm/engine/ce/gm200.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm206.c b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gm107.c
index 341dc560acbb..4c2f42919c1f 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm206.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gm107.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright 2015 Red Hat Inc. 2 * Copyright 2016 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"),
@@ -19,30 +19,37 @@
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 <bskeggs@redhat.com> 22 * Authors: Ben Skeggs
23 */ 23 */
24#include "gf100.h" 24#include "priv.h"
25#include "ctxgf100.h"
26 25
27#include <nvif/class.h> 26#include <nvif/class.h>
28 27
29static const struct gf100_gr_func 28static const struct nvkm_engine_func
30gm206_gr = { 29gm107_ce = {
31 .init = gm204_gr_init, 30 .intr = gk104_ce_intr,
32 .mmio = gm204_gr_pack_mmio,
33 .ppc_nr = 2,
34 .grctx = &gm206_grctx,
35 .sclass = { 31 .sclass = {
36 { -1, -1, FERMI_TWOD_A }, 32 { -1, -1, KEPLER_DMA_COPY_A },
37 { -1, -1, KEPLER_INLINE_TO_MEMORY_B }, 33 { -1, -1, MAXWELL_DMA_COPY_A },
38 { -1, -1, MAXWELL_B, &gf100_fermi },
39 { -1, -1, MAXWELL_COMPUTE_B },
40 {} 34 {}
41 } 35 }
42}; 36};
43 37
44int 38int
45gm206_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr) 39gm107_ce_new(struct nvkm_device *device, int index,
40 struct nvkm_engine **pengine)
46{ 41{
47 return gf100_gr_new_(&gm206_gr, device, index, pgr); 42 if (index == NVKM_ENGINE_CE0) {
43 return nvkm_engine_new_(&gm107_ce, device, index,
44 0x00000040, true, pengine);
45 } else
46 if (index == NVKM_ENGINE_CE1) {
47 return nvkm_engine_new_(&gm107_ce, device, index,
48 0x00000080, true, pengine);
49 } else
50 if (index == NVKM_ENGINE_CE2) {
51 return nvkm_engine_new_(&gm107_ce, device, index,
52 0x00200000, true, pengine);
53 }
54 return -ENODEV;
48} 55}
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/ce/gm204.c b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gm200.c
index 8eaa72a59f40..13f07b32cd9c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/ce/gm204.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gm200.c
@@ -26,7 +26,7 @@
26#include <nvif/class.h> 26#include <nvif/class.h>
27 27
28static const struct nvkm_engine_func 28static const struct nvkm_engine_func
29gm204_ce = { 29gm200_ce = {
30 .intr = gk104_ce_intr, 30 .intr = gk104_ce_intr,
31 .sclass = { 31 .sclass = {
32 { -1, -1, MAXWELL_DMA_COPY_A }, 32 { -1, -1, MAXWELL_DMA_COPY_A },
@@ -35,19 +35,19 @@ gm204_ce = {
35}; 35};
36 36
37int 37int
38gm204_ce_new(struct nvkm_device *device, int index, 38gm200_ce_new(struct nvkm_device *device, int index,
39 struct nvkm_engine **pengine) 39 struct nvkm_engine **pengine)
40{ 40{
41 if (index == NVKM_ENGINE_CE0) { 41 if (index == NVKM_ENGINE_CE0) {
42 return nvkm_engine_new_(&gm204_ce, device, index, 42 return nvkm_engine_new_(&gm200_ce, device, index,
43 0x00000040, true, pengine); 43 0x00000040, true, pengine);
44 } else 44 } else
45 if (index == NVKM_ENGINE_CE1) { 45 if (index == NVKM_ENGINE_CE1) {
46 return nvkm_engine_new_(&gm204_ce, device, index, 46 return nvkm_engine_new_(&gm200_ce, device, index,
47 0x00000080, true, pengine); 47 0x00000080, true, pengine);
48 } else 48 } else
49 if (index == NVKM_ENGINE_CE2) { 49 if (index == NVKM_ENGINE_CE2) {
50 return nvkm_engine_new_(&gm204_ce, device, index, 50 return nvkm_engine_new_(&gm200_ce, device, index,
51 0x00200000, true, pengine); 51 0x00200000, true, pengine);
52 } 52 }
53 return -ENODEV; 53 return -ENODEV;
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
index b1ba1c782a2b..9f32c8739254 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
@@ -1347,6 +1347,7 @@ nvc0_chipset = {
1347 .gpio = g94_gpio_new, 1347 .gpio = g94_gpio_new,
1348 .i2c = g94_i2c_new, 1348 .i2c = g94_i2c_new,
1349 .ibus = gf100_ibus_new, 1349 .ibus = gf100_ibus_new,
1350 .iccsense = gf100_iccsense_new,
1350 .imem = nv50_instmem_new, 1351 .imem = nv50_instmem_new,
1351 .ltc = gf100_ltc_new, 1352 .ltc = gf100_ltc_new,
1352 .mc = gf100_mc_new, 1353 .mc = gf100_mc_new,
@@ -1383,6 +1384,7 @@ nvc1_chipset = {
1383 .gpio = g94_gpio_new, 1384 .gpio = g94_gpio_new,
1384 .i2c = g94_i2c_new, 1385 .i2c = g94_i2c_new,
1385 .ibus = gf100_ibus_new, 1386 .ibus = gf100_ibus_new,
1387 .iccsense = gf100_iccsense_new,
1386 .imem = nv50_instmem_new, 1388 .imem = nv50_instmem_new,
1387 .ltc = gf100_ltc_new, 1389 .ltc = gf100_ltc_new,
1388 .mc = gf100_mc_new, 1390 .mc = gf100_mc_new,
@@ -1418,6 +1420,7 @@ nvc3_chipset = {
1418 .gpio = g94_gpio_new, 1420 .gpio = g94_gpio_new,
1419 .i2c = g94_i2c_new, 1421 .i2c = g94_i2c_new,
1420 .ibus = gf100_ibus_new, 1422 .ibus = gf100_ibus_new,
1423 .iccsense = gf100_iccsense_new,
1421 .imem = nv50_instmem_new, 1424 .imem = nv50_instmem_new,
1422 .ltc = gf100_ltc_new, 1425 .ltc = gf100_ltc_new,
1423 .mc = gf100_mc_new, 1426 .mc = gf100_mc_new,
@@ -1453,6 +1456,7 @@ nvc4_chipset = {
1453 .gpio = g94_gpio_new, 1456 .gpio = g94_gpio_new,
1454 .i2c = g94_i2c_new, 1457 .i2c = g94_i2c_new,
1455 .ibus = gf100_ibus_new, 1458 .ibus = gf100_ibus_new,
1459 .iccsense = gf100_iccsense_new,
1456 .imem = nv50_instmem_new, 1460 .imem = nv50_instmem_new,
1457 .ltc = gf100_ltc_new, 1461 .ltc = gf100_ltc_new,
1458 .mc = gf100_mc_new, 1462 .mc = gf100_mc_new,
@@ -1489,6 +1493,7 @@ nvc8_chipset = {
1489 .gpio = g94_gpio_new, 1493 .gpio = g94_gpio_new,
1490 .i2c = g94_i2c_new, 1494 .i2c = g94_i2c_new,
1491 .ibus = gf100_ibus_new, 1495 .ibus = gf100_ibus_new,
1496 .iccsense = gf100_iccsense_new,
1492 .imem = nv50_instmem_new, 1497 .imem = nv50_instmem_new,
1493 .ltc = gf100_ltc_new, 1498 .ltc = gf100_ltc_new,
1494 .mc = gf100_mc_new, 1499 .mc = gf100_mc_new,
@@ -1525,6 +1530,7 @@ nvce_chipset = {
1525 .gpio = g94_gpio_new, 1530 .gpio = g94_gpio_new,
1526 .i2c = g94_i2c_new, 1531 .i2c = g94_i2c_new,
1527 .ibus = gf100_ibus_new, 1532 .ibus = gf100_ibus_new,
1533 .iccsense = gf100_iccsense_new,
1528 .imem = nv50_instmem_new, 1534 .imem = nv50_instmem_new,
1529 .ltc = gf100_ltc_new, 1535 .ltc = gf100_ltc_new,
1530 .mc = gf100_mc_new, 1536 .mc = gf100_mc_new,
@@ -1561,6 +1567,7 @@ nvcf_chipset = {
1561 .gpio = g94_gpio_new, 1567 .gpio = g94_gpio_new,
1562 .i2c = g94_i2c_new, 1568 .i2c = g94_i2c_new,
1563 .ibus = gf100_ibus_new, 1569 .ibus = gf100_ibus_new,
1570 .iccsense = gf100_iccsense_new,
1564 .imem = nv50_instmem_new, 1571 .imem = nv50_instmem_new,
1565 .ltc = gf100_ltc_new, 1572 .ltc = gf100_ltc_new,
1566 .mc = gf100_mc_new, 1573 .mc = gf100_mc_new,
@@ -1596,6 +1603,7 @@ nvd7_chipset = {
1596 .gpio = gf119_gpio_new, 1603 .gpio = gf119_gpio_new,
1597 .i2c = gf117_i2c_new, 1604 .i2c = gf117_i2c_new,
1598 .ibus = gf117_ibus_new, 1605 .ibus = gf117_ibus_new,
1606 .iccsense = gf100_iccsense_new,
1599 .imem = nv50_instmem_new, 1607 .imem = nv50_instmem_new,
1600 .ltc = gf100_ltc_new, 1608 .ltc = gf100_ltc_new,
1601 .mc = gf100_mc_new, 1609 .mc = gf100_mc_new,
@@ -1629,6 +1637,7 @@ nvd9_chipset = {
1629 .gpio = gf119_gpio_new, 1637 .gpio = gf119_gpio_new,
1630 .i2c = gf119_i2c_new, 1638 .i2c = gf119_i2c_new,
1631 .ibus = gf117_ibus_new, 1639 .ibus = gf117_ibus_new,
1640 .iccsense = gf100_iccsense_new,
1632 .imem = nv50_instmem_new, 1641 .imem = nv50_instmem_new,
1633 .ltc = gf100_ltc_new, 1642 .ltc = gf100_ltc_new,
1634 .mc = gf100_mc_new, 1643 .mc = gf100_mc_new,
@@ -1664,6 +1673,7 @@ nve4_chipset = {
1664 .gpio = gk104_gpio_new, 1673 .gpio = gk104_gpio_new,
1665 .i2c = gk104_i2c_new, 1674 .i2c = gk104_i2c_new,
1666 .ibus = gk104_ibus_new, 1675 .ibus = gk104_ibus_new,
1676 .iccsense = gf100_iccsense_new,
1667 .imem = nv50_instmem_new, 1677 .imem = nv50_instmem_new,
1668 .ltc = gk104_ltc_new, 1678 .ltc = gk104_ltc_new,
1669 .mc = gf100_mc_new, 1679 .mc = gf100_mc_new,
@@ -1701,6 +1711,7 @@ nve6_chipset = {
1701 .gpio = gk104_gpio_new, 1711 .gpio = gk104_gpio_new,
1702 .i2c = gk104_i2c_new, 1712 .i2c = gk104_i2c_new,
1703 .ibus = gk104_ibus_new, 1713 .ibus = gk104_ibus_new,
1714 .iccsense = gf100_iccsense_new,
1704 .imem = nv50_instmem_new, 1715 .imem = nv50_instmem_new,
1705 .ltc = gk104_ltc_new, 1716 .ltc = gk104_ltc_new,
1706 .mc = gf100_mc_new, 1717 .mc = gf100_mc_new,
@@ -1738,6 +1749,7 @@ nve7_chipset = {
1738 .gpio = gk104_gpio_new, 1749 .gpio = gk104_gpio_new,
1739 .i2c = gk104_i2c_new, 1750 .i2c = gk104_i2c_new,
1740 .ibus = gk104_ibus_new, 1751 .ibus = gk104_ibus_new,
1752 .iccsense = gf100_iccsense_new,
1741 .imem = nv50_instmem_new, 1753 .imem = nv50_instmem_new,
1742 .ltc = gk104_ltc_new, 1754 .ltc = gk104_ltc_new,
1743 .mc = gf100_mc_new, 1755 .mc = gf100_mc_new,
@@ -1799,6 +1811,7 @@ nvf0_chipset = {
1799 .gpio = gk104_gpio_new, 1811 .gpio = gk104_gpio_new,
1800 .i2c = gk104_i2c_new, 1812 .i2c = gk104_i2c_new,
1801 .ibus = gk104_ibus_new, 1813 .ibus = gk104_ibus_new,
1814 .iccsense = gf100_iccsense_new,
1802 .imem = nv50_instmem_new, 1815 .imem = nv50_instmem_new,
1803 .ltc = gk104_ltc_new, 1816 .ltc = gk104_ltc_new,
1804 .mc = gf100_mc_new, 1817 .mc = gf100_mc_new,
@@ -1814,7 +1827,7 @@ nvf0_chipset = {
1814 .ce[2] = gk104_ce_new, 1827 .ce[2] = gk104_ce_new,
1815 .disp = gk110_disp_new, 1828 .disp = gk110_disp_new,
1816 .dma = gf119_dma_new, 1829 .dma = gf119_dma_new,
1817 .fifo = gk104_fifo_new, 1830 .fifo = gk110_fifo_new,
1818 .gr = gk110_gr_new, 1831 .gr = gk110_gr_new,
1819 .mspdec = gk104_mspdec_new, 1832 .mspdec = gk104_mspdec_new,
1820 .msppp = gf100_msppp_new, 1833 .msppp = gf100_msppp_new,
@@ -1835,6 +1848,7 @@ nvf1_chipset = {
1835 .gpio = gk104_gpio_new, 1848 .gpio = gk104_gpio_new,
1836 .i2c = gf119_i2c_new, 1849 .i2c = gf119_i2c_new,
1837 .ibus = gk104_ibus_new, 1850 .ibus = gk104_ibus_new,
1851 .iccsense = gf100_iccsense_new,
1838 .imem = nv50_instmem_new, 1852 .imem = nv50_instmem_new,
1839 .ltc = gk104_ltc_new, 1853 .ltc = gk104_ltc_new,
1840 .mc = gf100_mc_new, 1854 .mc = gf100_mc_new,
@@ -1850,7 +1864,7 @@ nvf1_chipset = {
1850 .ce[2] = gk104_ce_new, 1864 .ce[2] = gk104_ce_new,
1851 .disp = gk110_disp_new, 1865 .disp = gk110_disp_new,
1852 .dma = gf119_dma_new, 1866 .dma = gf119_dma_new,
1853 .fifo = gk104_fifo_new, 1867 .fifo = gk110_fifo_new,
1854 .gr = gk110b_gr_new, 1868 .gr = gk110b_gr_new,
1855 .mspdec = gk104_mspdec_new, 1869 .mspdec = gk104_mspdec_new,
1856 .msppp = gf100_msppp_new, 1870 .msppp = gf100_msppp_new,
@@ -1871,6 +1885,7 @@ nv106_chipset = {
1871 .gpio = gk104_gpio_new, 1885 .gpio = gk104_gpio_new,
1872 .i2c = gk104_i2c_new, 1886 .i2c = gk104_i2c_new,
1873 .ibus = gk104_ibus_new, 1887 .ibus = gk104_ibus_new,
1888 .iccsense = gf100_iccsense_new,
1874 .imem = nv50_instmem_new, 1889 .imem = nv50_instmem_new,
1875 .ltc = gk104_ltc_new, 1890 .ltc = gk104_ltc_new,
1876 .mc = gk20a_mc_new, 1891 .mc = gk20a_mc_new,
@@ -1907,6 +1922,7 @@ nv108_chipset = {
1907 .gpio = gk104_gpio_new, 1922 .gpio = gk104_gpio_new,
1908 .i2c = gk104_i2c_new, 1923 .i2c = gk104_i2c_new,
1909 .ibus = gk104_ibus_new, 1924 .ibus = gk104_ibus_new,
1925 .iccsense = gf100_iccsense_new,
1910 .imem = nv50_instmem_new, 1926 .imem = nv50_instmem_new,
1911 .ltc = gk104_ltc_new, 1927 .ltc = gk104_ltc_new,
1912 .mc = gk20a_mc_new, 1928 .mc = gk20a_mc_new,
@@ -1943,6 +1959,7 @@ nv117_chipset = {
1943 .gpio = gk104_gpio_new, 1959 .gpio = gk104_gpio_new,
1944 .i2c = gf119_i2c_new, 1960 .i2c = gf119_i2c_new,
1945 .ibus = gk104_ibus_new, 1961 .ibus = gk104_ibus_new,
1962 .iccsense = gf100_iccsense_new,
1946 .imem = nv50_instmem_new, 1963 .imem = nv50_instmem_new,
1947 .ltc = gm107_ltc_new, 1964 .ltc = gm107_ltc_new,
1948 .mc = gk20a_mc_new, 1965 .mc = gk20a_mc_new,
@@ -1953,43 +1970,78 @@ nv117_chipset = {
1953 .therm = gm107_therm_new, 1970 .therm = gm107_therm_new,
1954 .timer = gk20a_timer_new, 1971 .timer = gk20a_timer_new,
1955 .volt = gk104_volt_new, 1972 .volt = gk104_volt_new,
1956 .ce[0] = gk104_ce_new, 1973 .ce[0] = gm107_ce_new,
1957 .ce[2] = gk104_ce_new, 1974 .ce[2] = gm107_ce_new,
1958 .disp = gm107_disp_new, 1975 .disp = gm107_disp_new,
1959 .dma = gf119_dma_new, 1976 .dma = gf119_dma_new,
1960 .fifo = gk208_fifo_new, 1977 .fifo = gm107_fifo_new,
1961 .gr = gm107_gr_new, 1978 .gr = gm107_gr_new,
1962 .sw = gf100_sw_new, 1979 .sw = gf100_sw_new,
1963}; 1980};
1964 1981
1965static const struct nvkm_device_chip 1982static const struct nvkm_device_chip
1983nv120_chipset = {
1984 .name = "GM200",
1985 .bar = gf100_bar_new,
1986 .bios = nvkm_bios_new,
1987 .bus = gf100_bus_new,
1988 .devinit = gm200_devinit_new,
1989 .fb = gm107_fb_new,
1990 .fuse = gm107_fuse_new,
1991 .gpio = gk104_gpio_new,
1992 .i2c = gm200_i2c_new,
1993 .ibus = gm200_ibus_new,
1994 .iccsense = gf100_iccsense_new,
1995 .imem = nv50_instmem_new,
1996 .ltc = gm200_ltc_new,
1997 .mc = gk20a_mc_new,
1998 .mmu = gf100_mmu_new,
1999 .mxm = nv50_mxm_new,
2000 .pci = gk104_pci_new,
2001 .pmu = gm107_pmu_new,
2002 .secboot = gm200_secboot_new,
2003 .timer = gk20a_timer_new,
2004 .volt = gk104_volt_new,
2005 .ce[0] = gm200_ce_new,
2006 .ce[1] = gm200_ce_new,
2007 .ce[2] = gm200_ce_new,
2008 .disp = gm200_disp_new,
2009 .dma = gf119_dma_new,
2010 .fifo = gm200_fifo_new,
2011 .gr = gm200_gr_new,
2012 .sw = gf100_sw_new,
2013};
2014
2015static const struct nvkm_device_chip
1966nv124_chipset = { 2016nv124_chipset = {
1967 .name = "GM204", 2017 .name = "GM204",
1968 .bar = gf100_bar_new, 2018 .bar = gf100_bar_new,
1969 .bios = nvkm_bios_new, 2019 .bios = nvkm_bios_new,
1970 .bus = gf100_bus_new, 2020 .bus = gf100_bus_new,
1971 .devinit = gm204_devinit_new, 2021 .devinit = gm200_devinit_new,
1972 .fb = gm107_fb_new, 2022 .fb = gm107_fb_new,
1973 .fuse = gm107_fuse_new, 2023 .fuse = gm107_fuse_new,
1974 .gpio = gk104_gpio_new, 2024 .gpio = gk104_gpio_new,
1975 .i2c = gm204_i2c_new, 2025 .i2c = gm200_i2c_new,
1976 .ibus = gm204_ibus_new, 2026 .ibus = gm200_ibus_new,
2027 .iccsense = gf100_iccsense_new,
1977 .imem = nv50_instmem_new, 2028 .imem = nv50_instmem_new,
1978 .ltc = gm204_ltc_new, 2029 .ltc = gm200_ltc_new,
1979 .mc = gk20a_mc_new, 2030 .mc = gk20a_mc_new,
1980 .mmu = gf100_mmu_new, 2031 .mmu = gf100_mmu_new,
1981 .mxm = nv50_mxm_new, 2032 .mxm = nv50_mxm_new,
1982 .pci = gk104_pci_new, 2033 .pci = gk104_pci_new,
1983 .pmu = gm107_pmu_new, 2034 .pmu = gm107_pmu_new,
2035 .secboot = gm200_secboot_new,
1984 .timer = gk20a_timer_new, 2036 .timer = gk20a_timer_new,
1985 .volt = gk104_volt_new, 2037 .volt = gk104_volt_new,
1986 .ce[0] = gm204_ce_new, 2038 .ce[0] = gm200_ce_new,
1987 .ce[1] = gm204_ce_new, 2039 .ce[1] = gm200_ce_new,
1988 .ce[2] = gm204_ce_new, 2040 .ce[2] = gm200_ce_new,
1989 .disp = gm204_disp_new, 2041 .disp = gm200_disp_new,
1990 .dma = gf119_dma_new, 2042 .dma = gf119_dma_new,
1991 .fifo = gm204_fifo_new, 2043 .fifo = gm200_fifo_new,
1992 .gr = gm204_gr_new, 2044 .gr = gm200_gr_new,
1993 .sw = gf100_sw_new, 2045 .sw = gf100_sw_new,
1994}; 2046};
1995 2047
@@ -1999,28 +2051,30 @@ nv126_chipset = {
1999 .bar = gf100_bar_new, 2051 .bar = gf100_bar_new,
2000 .bios = nvkm_bios_new, 2052 .bios = nvkm_bios_new,
2001 .bus = gf100_bus_new, 2053 .bus = gf100_bus_new,
2002 .devinit = gm204_devinit_new, 2054 .devinit = gm200_devinit_new,
2003 .fb = gm107_fb_new, 2055 .fb = gm107_fb_new,
2004 .fuse = gm107_fuse_new, 2056 .fuse = gm107_fuse_new,
2005 .gpio = gk104_gpio_new, 2057 .gpio = gk104_gpio_new,
2006 .i2c = gm204_i2c_new, 2058 .i2c = gm200_i2c_new,
2007 .ibus = gm204_ibus_new, 2059 .ibus = gm200_ibus_new,
2060 .iccsense = gf100_iccsense_new,
2008 .imem = nv50_instmem_new, 2061 .imem = nv50_instmem_new,
2009 .ltc = gm204_ltc_new, 2062 .ltc = gm200_ltc_new,
2010 .mc = gk20a_mc_new, 2063 .mc = gk20a_mc_new,
2011 .mmu = gf100_mmu_new, 2064 .mmu = gf100_mmu_new,
2012 .mxm = nv50_mxm_new, 2065 .mxm = nv50_mxm_new,
2013 .pci = gk104_pci_new, 2066 .pci = gk104_pci_new,
2014 .pmu = gm107_pmu_new, 2067 .pmu = gm107_pmu_new,
2068 .secboot = gm200_secboot_new,
2015 .timer = gk20a_timer_new, 2069 .timer = gk20a_timer_new,
2016 .volt = gk104_volt_new, 2070 .volt = gk104_volt_new,
2017 .ce[0] = gm204_ce_new, 2071 .ce[0] = gm200_ce_new,
2018 .ce[1] = gm204_ce_new, 2072 .ce[1] = gm200_ce_new,
2019 .ce[2] = gm204_ce_new, 2073 .ce[2] = gm200_ce_new,
2020 .disp = gm204_disp_new, 2074 .disp = gm200_disp_new,
2021 .dma = gf119_dma_new, 2075 .dma = gf119_dma_new,
2022 .fifo = gm204_fifo_new, 2076 .fifo = gm200_fifo_new,
2023 .gr = gm206_gr_new, 2077 .gr = gm200_gr_new,
2024 .sw = gf100_sw_new, 2078 .sw = gf100_sw_new,
2025}; 2079};
2026 2080
@@ -2029,15 +2083,18 @@ nv12b_chipset = {
2029 .name = "GM20B", 2083 .name = "GM20B",
2030 .bar = gk20a_bar_new, 2084 .bar = gk20a_bar_new,
2031 .bus = gf100_bus_new, 2085 .bus = gf100_bus_new,
2086 .clk = gm20b_clk_new,
2032 .fb = gk20a_fb_new, 2087 .fb = gk20a_fb_new,
2033 .fuse = gm107_fuse_new, 2088 .fuse = gm107_fuse_new,
2034 .ibus = gk20a_ibus_new, 2089 .ibus = gk20a_ibus_new,
2035 .imem = gk20a_instmem_new, 2090 .imem = gk20a_instmem_new,
2036 .ltc = gm204_ltc_new, 2091 .ltc = gm200_ltc_new,
2037 .mc = gk20a_mc_new, 2092 .mc = gk20a_mc_new,
2038 .mmu = gf100_mmu_new, 2093 .mmu = gf100_mmu_new,
2094 .secboot = gm20b_secboot_new,
2039 .timer = gk20a_timer_new, 2095 .timer = gk20a_timer_new,
2040 .ce[2] = gm204_ce_new, 2096 .ce[2] = gm200_ce_new,
2097 .volt = gm20b_volt_new,
2041 .dma = gf119_dma_new, 2098 .dma = gf119_dma_new,
2042 .fifo = gm20b_fifo_new, 2099 .fifo = gm20b_fifo_new,
2043 .gr = gm20b_gr_new, 2100 .gr = gm20b_gr_new,
@@ -2072,26 +2129,28 @@ nvkm_device_subdev(struct nvkm_device *device, int index)
2072 2129
2073 switch (index) { 2130 switch (index) {
2074#define _(n,p,m) case NVKM_SUBDEV_##n: if (p) return (m); break 2131#define _(n,p,m) case NVKM_SUBDEV_##n: if (p) return (m); break
2075 _(BAR , device->bar , &device->bar->subdev); 2132 _(BAR , device->bar , &device->bar->subdev);
2076 _(VBIOS , device->bios , &device->bios->subdev); 2133 _(VBIOS , device->bios , &device->bios->subdev);
2077 _(BUS , device->bus , &device->bus->subdev); 2134 _(BUS , device->bus , &device->bus->subdev);
2078 _(CLK , device->clk , &device->clk->subdev); 2135 _(CLK , device->clk , &device->clk->subdev);
2079 _(DEVINIT, device->devinit, &device->devinit->subdev); 2136 _(DEVINIT , device->devinit , &device->devinit->subdev);
2080 _(FB , device->fb , &device->fb->subdev); 2137 _(FB , device->fb , &device->fb->subdev);
2081 _(FUSE , device->fuse , &device->fuse->subdev); 2138 _(FUSE , device->fuse , &device->fuse->subdev);
2082 _(GPIO , device->gpio , &device->gpio->subdev); 2139 _(GPIO , device->gpio , &device->gpio->subdev);
2083 _(I2C , device->i2c , &device->i2c->subdev); 2140 _(I2C , device->i2c , &device->i2c->subdev);
2084 _(IBUS , device->ibus , device->ibus); 2141 _(IBUS , device->ibus , device->ibus);
2085 _(INSTMEM, device->imem , &device->imem->subdev); 2142 _(ICCSENSE, device->iccsense, &device->iccsense->subdev);
2086 _(LTC , device->ltc , &device->ltc->subdev); 2143 _(INSTMEM , device->imem , &device->imem->subdev);
2087 _(MC , device->mc , &device->mc->subdev); 2144 _(LTC , device->ltc , &device->ltc->subdev);
2088 _(MMU , device->mmu , &device->mmu->subdev); 2145 _(MC , device->mc , &device->mc->subdev);
2089 _(MXM , device->mxm , device->mxm); 2146 _(MMU , device->mmu , &device->mmu->subdev);
2090 _(PCI , device->pci , &device->pci->subdev); 2147 _(MXM , device->mxm , device->mxm);
2091 _(PMU , device->pmu , &device->pmu->subdev); 2148 _(PCI , device->pci , &device->pci->subdev);
2092 _(THERM , device->therm , &device->therm->subdev); 2149 _(PMU , device->pmu , &device->pmu->subdev);
2093 _(TIMER , device->timer , &device->timer->subdev); 2150 _(SECBOOT , device->secboot , &device->secboot->subdev);
2094 _(VOLT , device->volt , &device->volt->subdev); 2151 _(THERM , device->therm , &device->therm->subdev);
2152 _(TIMER , device->timer , &device->timer->subdev);
2153 _(VOLT , device->volt , &device->volt->subdev);
2095#undef _ 2154#undef _
2096 default: 2155 default:
2097 engine = nvkm_device_engine(device, index); 2156 engine = nvkm_device_engine(device, index);
@@ -2110,27 +2169,30 @@ nvkm_device_engine(struct nvkm_device *device, int index)
2110 2169
2111 switch (index) { 2170 switch (index) {
2112#define _(n,p,m) case NVKM_ENGINE_##n: if (p) return (m); break 2171#define _(n,p,m) case NVKM_ENGINE_##n: if (p) return (m); break
2113 _(BSP , device->bsp , device->bsp); 2172 _(BSP , device->bsp , device->bsp);
2114 _(CE0 , device->ce[0] , device->ce[0]); 2173 _(CE0 , device->ce[0] , device->ce[0]);
2115 _(CE1 , device->ce[1] , device->ce[1]); 2174 _(CE1 , device->ce[1] , device->ce[1]);
2116 _(CE2 , device->ce[2] , device->ce[2]); 2175 _(CE2 , device->ce[2] , device->ce[2]);
2117 _(CIPHER , device->cipher , device->cipher); 2176 _(CIPHER , device->cipher , device->cipher);
2118 _(DISP , device->disp , &device->disp->engine); 2177 _(DISP , device->disp , &device->disp->engine);
2119 _(DMAOBJ , device->dma , &device->dma->engine); 2178 _(DMAOBJ , device->dma , &device->dma->engine);
2120 _(FIFO , device->fifo , &device->fifo->engine); 2179 _(FIFO , device->fifo , &device->fifo->engine);
2121 _(GR , device->gr , &device->gr->engine); 2180 _(GR , device->gr , &device->gr->engine);
2122 _(IFB , device->ifb , device->ifb); 2181 _(IFB , device->ifb , device->ifb);
2123 _(ME , device->me , device->me); 2182 _(ME , device->me , device->me);
2124 _(MPEG , device->mpeg , device->mpeg); 2183 _(MPEG , device->mpeg , device->mpeg);
2125 _(MSENC , device->msenc , device->msenc); 2184 _(MSENC , device->msenc , device->msenc);
2126 _(MSPDEC , device->mspdec , device->mspdec); 2185 _(MSPDEC , device->mspdec , device->mspdec);
2127 _(MSPPP , device->msppp , device->msppp); 2186 _(MSPPP , device->msppp , device->msppp);
2128 _(MSVLD , device->msvld , device->msvld); 2187 _(MSVLD , device->msvld , device->msvld);
2129 _(PM , device->pm , &device->pm->engine); 2188 _(NVENC0 , device->nvenc[0], device->nvenc[0]);
2130 _(SEC , device->sec , device->sec); 2189 _(NVENC1 , device->nvenc[1], device->nvenc[1]);
2131 _(SW , device->sw , &device->sw->engine); 2190 _(NVDEC , device->nvdec , device->nvdec);
2132 _(VIC , device->vic , device->vic); 2191 _(PM , device->pm , &device->pm->engine);
2133 _(VP , device->vp , device->vp); 2192 _(SEC , device->sec , device->sec);
2193 _(SW , device->sw , &device->sw->engine);
2194 _(VIC , device->vic , device->vic);
2195 _(VP , device->vp , device->vp);
2134#undef _ 2196#undef _
2135 default: 2197 default:
2136 WARN_ON(1); 2198 WARN_ON(1);
@@ -2261,6 +2323,8 @@ fail_subdev:
2261 } while (--i >= 0); 2323 } while (--i >= 0);
2262 2324
2263fail: 2325fail:
2326 nvkm_device_fini(device, false);
2327
2264 nvdev_error(device, "init failed with %d\n", ret); 2328 nvdev_error(device, "init failed with %d\n", ret);
2265 return ret; 2329 return ret;
2266} 2330}
@@ -2459,6 +2523,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
2459 case 0x106: device->chip = &nv106_chipset; break; 2523 case 0x106: device->chip = &nv106_chipset; break;
2460 case 0x108: device->chip = &nv108_chipset; break; 2524 case 0x108: device->chip = &nv108_chipset; break;
2461 case 0x117: device->chip = &nv117_chipset; break; 2525 case 0x117: device->chip = &nv117_chipset; break;
2526 case 0x120: device->chip = &nv120_chipset; break;
2462 case 0x124: device->chip = &nv124_chipset; break; 2527 case 0x124: device->chip = &nv124_chipset; break;
2463 case 0x126: device->chip = &nv126_chipset; break; 2528 case 0x126: device->chip = &nv126_chipset; break;
2464 case 0x12b: device->chip = &nv12b_chipset; break; 2529 case 0x12b: device->chip = &nv12b_chipset; break;
@@ -2518,47 +2583,52 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
2518 } \ 2583 } \
2519 break 2584 break
2520 switch (i) { 2585 switch (i) {
2521 _(NVKM_SUBDEV_BAR , bar); 2586 _(NVKM_SUBDEV_BAR , bar);
2522 _(NVKM_SUBDEV_VBIOS , bios); 2587 _(NVKM_SUBDEV_VBIOS , bios);
2523 _(NVKM_SUBDEV_BUS , bus); 2588 _(NVKM_SUBDEV_BUS , bus);
2524 _(NVKM_SUBDEV_CLK , clk); 2589 _(NVKM_SUBDEV_CLK , clk);
2525 _(NVKM_SUBDEV_DEVINIT, devinit); 2590 _(NVKM_SUBDEV_DEVINIT , devinit);
2526 _(NVKM_SUBDEV_FB , fb); 2591 _(NVKM_SUBDEV_FB , fb);
2527 _(NVKM_SUBDEV_FUSE , fuse); 2592 _(NVKM_SUBDEV_FUSE , fuse);
2528 _(NVKM_SUBDEV_GPIO , gpio); 2593 _(NVKM_SUBDEV_GPIO , gpio);
2529 _(NVKM_SUBDEV_I2C , i2c); 2594 _(NVKM_SUBDEV_I2C , i2c);
2530 _(NVKM_SUBDEV_IBUS , ibus); 2595 _(NVKM_SUBDEV_IBUS , ibus);
2531 _(NVKM_SUBDEV_INSTMEM, imem); 2596 _(NVKM_SUBDEV_ICCSENSE, iccsense);
2532 _(NVKM_SUBDEV_LTC , ltc); 2597 _(NVKM_SUBDEV_INSTMEM , imem);
2533 _(NVKM_SUBDEV_MC , mc); 2598 _(NVKM_SUBDEV_LTC , ltc);
2534 _(NVKM_SUBDEV_MMU , mmu); 2599 _(NVKM_SUBDEV_MC , mc);
2535 _(NVKM_SUBDEV_MXM , mxm); 2600 _(NVKM_SUBDEV_MMU , mmu);
2536 _(NVKM_SUBDEV_PCI , pci); 2601 _(NVKM_SUBDEV_MXM , mxm);
2537 _(NVKM_SUBDEV_PMU , pmu); 2602 _(NVKM_SUBDEV_PCI , pci);
2538 _(NVKM_SUBDEV_THERM , therm); 2603 _(NVKM_SUBDEV_PMU , pmu);
2539 _(NVKM_SUBDEV_TIMER , timer); 2604 _(NVKM_SUBDEV_SECBOOT , secboot);
2540 _(NVKM_SUBDEV_VOLT , volt); 2605 _(NVKM_SUBDEV_THERM , therm);
2541 _(NVKM_ENGINE_BSP , bsp); 2606 _(NVKM_SUBDEV_TIMER , timer);
2542 _(NVKM_ENGINE_CE0 , ce[0]); 2607 _(NVKM_SUBDEV_VOLT , volt);
2543 _(NVKM_ENGINE_CE1 , ce[1]); 2608 _(NVKM_ENGINE_BSP , bsp);
2544 _(NVKM_ENGINE_CE2 , ce[2]); 2609 _(NVKM_ENGINE_CE0 , ce[0]);
2545 _(NVKM_ENGINE_CIPHER , cipher); 2610 _(NVKM_ENGINE_CE1 , ce[1]);
2546 _(NVKM_ENGINE_DISP , disp); 2611 _(NVKM_ENGINE_CE2 , ce[2]);
2547 _(NVKM_ENGINE_DMAOBJ , dma); 2612 _(NVKM_ENGINE_CIPHER , cipher);
2548 _(NVKM_ENGINE_FIFO , fifo); 2613 _(NVKM_ENGINE_DISP , disp);
2549 _(NVKM_ENGINE_GR , gr); 2614 _(NVKM_ENGINE_DMAOBJ , dma);
2550 _(NVKM_ENGINE_IFB , ifb); 2615 _(NVKM_ENGINE_FIFO , fifo);
2551 _(NVKM_ENGINE_ME , me); 2616 _(NVKM_ENGINE_GR , gr);
2552 _(NVKM_ENGINE_MPEG , mpeg); 2617 _(NVKM_ENGINE_IFB , ifb);
2553 _(NVKM_ENGINE_MSENC , msenc); 2618 _(NVKM_ENGINE_ME , me);
2554 _(NVKM_ENGINE_MSPDEC , mspdec); 2619 _(NVKM_ENGINE_MPEG , mpeg);
2555 _(NVKM_ENGINE_MSPPP , msppp); 2620 _(NVKM_ENGINE_MSENC , msenc);
2556 _(NVKM_ENGINE_MSVLD , msvld); 2621 _(NVKM_ENGINE_MSPDEC , mspdec);
2557 _(NVKM_ENGINE_PM , pm); 2622 _(NVKM_ENGINE_MSPPP , msppp);
2558 _(NVKM_ENGINE_SEC , sec); 2623 _(NVKM_ENGINE_MSVLD , msvld);
2559 _(NVKM_ENGINE_SW , sw); 2624 _(NVKM_ENGINE_NVENC0 , nvenc[0]);
2560 _(NVKM_ENGINE_VIC , vic); 2625 _(NVKM_ENGINE_NVENC1 , nvenc[1]);
2561 _(NVKM_ENGINE_VP , vp); 2626 _(NVKM_ENGINE_NVDEC , nvdec);
2627 _(NVKM_ENGINE_PM , pm);
2628 _(NVKM_ENGINE_SEC , sec);
2629 _(NVKM_ENGINE_SW , sw);
2630 _(NVKM_ENGINE_VIC , vic);
2631 _(NVKM_ENGINE_VP , vp);
2562 default: 2632 default:
2563 WARN_ON(1); 2633 WARN_ON(1);
2564 continue; 2634 continue;
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c
index 62ad0300cfa5..18fab3973ce5 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c
@@ -1614,7 +1614,7 @@ nvkm_device_pci_func = {
1614 .fini = nvkm_device_pci_fini, 1614 .fini = nvkm_device_pci_fini,
1615 .resource_addr = nvkm_device_pci_resource_addr, 1615 .resource_addr = nvkm_device_pci_resource_addr,
1616 .resource_size = nvkm_device_pci_resource_size, 1616 .resource_size = nvkm_device_pci_resource_size,
1617 .cpu_coherent = !IS_ENABLED(CONFIG_ARM), 1617 .cpu_coherent = !IS_ENABLED(CONFIG_ARM) && !IS_ENABLED(CONFIG_ARM64),
1618}; 1618};
1619 1619
1620int 1620int
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h
index ed3ad2c30e17..e80f6ab1c415 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h
@@ -12,6 +12,7 @@
12#include <subdev/gpio.h> 12#include <subdev/gpio.h>
13#include <subdev/i2c.h> 13#include <subdev/i2c.h>
14#include <subdev/ibus.h> 14#include <subdev/ibus.h>
15#include <subdev/iccsense.h>
15#include <subdev/instmem.h> 16#include <subdev/instmem.h>
16#include <subdev/ltc.h> 17#include <subdev/ltc.h>
17#include <subdev/mc.h> 18#include <subdev/mc.h>
@@ -22,6 +23,7 @@
22#include <subdev/therm.h> 23#include <subdev/therm.h>
23#include <subdev/timer.h> 24#include <subdev/timer.h>
24#include <subdev/volt.h> 25#include <subdev/volt.h>
26#include <subdev/secboot.h>
25 27
26#include <engine/bsp.h> 28#include <engine/bsp.h>
27#include <engine/ce.h> 29#include <engine/ce.h>
@@ -34,9 +36,12 @@
34#include <engine/mspdec.h> 36#include <engine/mspdec.h>
35#include <engine/msppp.h> 37#include <engine/msppp.h>
36#include <engine/msvld.h> 38#include <engine/msvld.h>
39#include <engine/nvenc.h>
40#include <engine/nvdec.h>
37#include <engine/pm.h> 41#include <engine/pm.h>
38#include <engine/sec.h> 42#include <engine/sec.h>
39#include <engine/sw.h> 43#include <engine/sw.h>
44#include <engine/vic.h>
40#include <engine/vp.h> 45#include <engine/vp.h>
41 46
42int nvkm_device_ctor(const struct nvkm_device_func *, 47int nvkm_device_ctor(const struct nvkm_device_func *,
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
index e7e581d6a8ff..9afa5f3e3c1c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
@@ -255,7 +255,6 @@ nvkm_device_tegra_new(const struct nvkm_device_tegra_func *func,
255 255
256 tdev->func = func; 256 tdev->func = func;
257 tdev->pdev = pdev; 257 tdev->pdev = pdev;
258 tdev->irq = -1;
259 258
260 tdev->vdd = devm_regulator_get(&pdev->dev, "vdd"); 259 tdev->vdd = devm_regulator_get(&pdev->dev, "vdd");
261 if (IS_ERR(tdev->vdd)) { 260 if (IS_ERR(tdev->vdd)) {
@@ -281,6 +280,15 @@ nvkm_device_tegra_new(const struct nvkm_device_tegra_func *func,
281 goto free; 280 goto free;
282 } 281 }
283 282
283 /**
284 * The IOMMU bit defines the upper limit of the GPU-addressable space.
285 * This will be refined in nouveau_ttm_init but we need to do it early
286 * for instmem to behave properly
287 */
288 ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(tdev->func->iommu_bit));
289 if (ret)
290 goto free;
291
284 nvkm_device_tegra_probe_iommu(tdev); 292 nvkm_device_tegra_probe_iommu(tdev);
285 293
286 ret = nvkm_device_tegra_power_up(tdev); 294 ret = nvkm_device_tegra_power_up(tdev);
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild b/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild
index 04f60452011e..a74c5dd27dc0 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild
@@ -9,7 +9,7 @@ nvkm-y += nvkm/engine/disp/gf119.o
9nvkm-y += nvkm/engine/disp/gk104.o 9nvkm-y += nvkm/engine/disp/gk104.o
10nvkm-y += nvkm/engine/disp/gk110.o 10nvkm-y += nvkm/engine/disp/gk110.o
11nvkm-y += nvkm/engine/disp/gm107.o 11nvkm-y += nvkm/engine/disp/gm107.o
12nvkm-y += nvkm/engine/disp/gm204.o 12nvkm-y += nvkm/engine/disp/gm200.o
13 13
14nvkm-y += nvkm/engine/disp/outp.o 14nvkm-y += nvkm/engine/disp/outp.o
15nvkm-y += nvkm/engine/disp/outpdp.o 15nvkm-y += nvkm/engine/disp/outpdp.o
@@ -18,7 +18,7 @@ nvkm-y += nvkm/engine/disp/piornv50.o
18nvkm-y += nvkm/engine/disp/sornv50.o 18nvkm-y += nvkm/engine/disp/sornv50.o
19nvkm-y += nvkm/engine/disp/sorg94.o 19nvkm-y += nvkm/engine/disp/sorg94.o
20nvkm-y += nvkm/engine/disp/sorgf119.o 20nvkm-y += nvkm/engine/disp/sorgf119.o
21nvkm-y += nvkm/engine/disp/sorgm204.o 21nvkm-y += nvkm/engine/disp/sorgm200.o
22nvkm-y += nvkm/engine/disp/dport.o 22nvkm-y += nvkm/engine/disp/dport.o
23 23
24nvkm-y += nvkm/engine/disp/conn.o 24nvkm-y += nvkm/engine/disp/conn.o
@@ -43,7 +43,7 @@ nvkm-y += nvkm/engine/disp/rootgf119.o
43nvkm-y += nvkm/engine/disp/rootgk104.o 43nvkm-y += nvkm/engine/disp/rootgk104.o
44nvkm-y += nvkm/engine/disp/rootgk110.o 44nvkm-y += nvkm/engine/disp/rootgk110.o
45nvkm-y += nvkm/engine/disp/rootgm107.o 45nvkm-y += nvkm/engine/disp/rootgm107.o
46nvkm-y += nvkm/engine/disp/rootgm204.o 46nvkm-y += nvkm/engine/disp/rootgm200.o
47 47
48nvkm-y += nvkm/engine/disp/channv50.o 48nvkm-y += nvkm/engine/disp/channv50.o
49nvkm-y += nvkm/engine/disp/changf119.o 49nvkm-y += nvkm/engine/disp/changf119.o
@@ -68,7 +68,7 @@ nvkm-y += nvkm/engine/disp/coregf119.o
68nvkm-y += nvkm/engine/disp/coregk104.o 68nvkm-y += nvkm/engine/disp/coregk104.o
69nvkm-y += nvkm/engine/disp/coregk110.o 69nvkm-y += nvkm/engine/disp/coregk110.o
70nvkm-y += nvkm/engine/disp/coregm107.o 70nvkm-y += nvkm/engine/disp/coregm107.o
71nvkm-y += nvkm/engine/disp/coregm204.o 71nvkm-y += nvkm/engine/disp/coregm200.o
72 72
73nvkm-y += nvkm/engine/disp/ovlynv50.o 73nvkm-y += nvkm/engine/disp/ovlynv50.o
74nvkm-y += nvkm/engine/disp/ovlyg84.o 74nvkm-y += nvkm/engine/disp/ovlyg84.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/coregm204.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/coregm200.c
index 222f4a822f4d..bb23a8658ac0 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/coregm204.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/coregm200.c
@@ -27,8 +27,8 @@
27#include <nvif/class.h> 27#include <nvif/class.h>
28 28
29const struct nv50_disp_dmac_oclass 29const struct nv50_disp_dmac_oclass
30gm204_disp_core_oclass = { 30gm200_disp_core_oclass = {
31 .base.oclass = GM204_DISP_CORE_CHANNEL_DMA, 31 .base.oclass = GM200_DISP_CORE_CHANNEL_DMA,
32 .base.minver = 0, 32 .base.minver = 0,
33 .base.maxver = 0, 33 .base.maxver = 0,
34 .ctor = nv50_disp_core_new, 34 .ctor = nv50_disp_core_new,
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/dmacnv50.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/dmacnv50.h
index c748ca23ab70..fc84eb8b5c45 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/dmacnv50.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/dmacnv50.h
@@ -87,5 +87,5 @@ extern const struct nv50_disp_dmac_oclass gk110_disp_base_oclass;
87 87
88extern const struct nv50_disp_dmac_oclass gm107_disp_core_oclass; 88extern const struct nv50_disp_dmac_oclass gm107_disp_core_oclass;
89 89
90extern const struct nv50_disp_dmac_oclass gm204_disp_core_oclass; 90extern const struct nv50_disp_dmac_oclass gm200_disp_core_oclass;
91#endif 91#endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gm204.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gm200.c
index 30f1987b5b40..67eec8620719 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gm204.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gm200.c
@@ -25,18 +25,18 @@
25#include "rootnv50.h" 25#include "rootnv50.h"
26 26
27static const struct nv50_disp_func 27static const struct nv50_disp_func
28gm204_disp = { 28gm200_disp = {
29 .intr = gf119_disp_intr, 29 .intr = gf119_disp_intr,
30 .uevent = &gf119_disp_chan_uevent, 30 .uevent = &gf119_disp_chan_uevent,
31 .super = gf119_disp_intr_supervisor, 31 .super = gf119_disp_intr_supervisor,
32 .root = &gm204_disp_root_oclass, 32 .root = &gm200_disp_root_oclass,
33 .head.vblank_init = gf119_disp_vblank_init, 33 .head.vblank_init = gf119_disp_vblank_init,
34 .head.vblank_fini = gf119_disp_vblank_fini, 34 .head.vblank_fini = gf119_disp_vblank_fini,
35 .head.scanoutpos = gf119_disp_root_scanoutpos, 35 .head.scanoutpos = gf119_disp_root_scanoutpos,
36 .outp.internal.crt = nv50_dac_output_new, 36 .outp.internal.crt = nv50_dac_output_new,
37 .outp.internal.tmds = nv50_sor_output_new, 37 .outp.internal.tmds = nv50_sor_output_new,
38 .outp.internal.lvds = nv50_sor_output_new, 38 .outp.internal.lvds = nv50_sor_output_new,
39 .outp.internal.dp = gm204_sor_dp_new, 39 .outp.internal.dp = gm200_sor_dp_new,
40 .dac.nr = 3, 40 .dac.nr = 3,
41 .dac.power = nv50_dac_power, 41 .dac.power = nv50_dac_power,
42 .dac.sense = nv50_dac_sense, 42 .dac.sense = nv50_dac_sense,
@@ -44,11 +44,11 @@ gm204_disp = {
44 .sor.power = nv50_sor_power, 44 .sor.power = nv50_sor_power,
45 .sor.hda_eld = gf119_hda_eld, 45 .sor.hda_eld = gf119_hda_eld,
46 .sor.hdmi = gk104_hdmi_ctrl, 46 .sor.hdmi = gk104_hdmi_ctrl,
47 .sor.magic = gm204_sor_magic, 47 .sor.magic = gm200_sor_magic,
48}; 48};
49 49
50int 50int
51gm204_disp_new(struct nvkm_device *device, int index, struct nvkm_disp **pdisp) 51gm200_disp_new(struct nvkm_device *device, int index, struct nvkm_disp **pdisp)
52{ 52{
53 return gf119_disp_new_(&gm204_disp, device, index, pdisp); 53 return gf119_disp_new_(&gm200_disp, device, index, pdisp);
54} 54}
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.h
index 2590fec67ca9..07727198d7ce 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.h
@@ -42,7 +42,7 @@ int nv50_pior_output_new(struct nvkm_disp *, int, struct dcb_output *,
42 42
43u32 g94_sor_dp_lane_map(struct nvkm_device *, u8 lane); 43u32 g94_sor_dp_lane_map(struct nvkm_device *, u8 lane);
44 44
45void gm204_sor_magic(struct nvkm_output *outp); 45void gm200_sor_magic(struct nvkm_output *outp);
46 46
47#define OUTP_MSG(o,l,f,a...) do { \ 47#define OUTP_MSG(o,l,f,a...) do { \
48 struct nvkm_output *_outp = (o); \ 48 struct nvkm_output *_outp = (o); \
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/outpdp.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/outpdp.h
index 731136d660b7..e9067ba4e179 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/outpdp.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/outpdp.h
@@ -63,6 +63,6 @@ int gf119_sor_dp_new(struct nvkm_disp *, int, struct dcb_output *,
63 struct nvkm_output **); 63 struct nvkm_output **);
64int gf119_sor_dp_lnk_ctl(struct nvkm_output_dp *, int, int, bool); 64int gf119_sor_dp_lnk_ctl(struct nvkm_output_dp *, int, int, bool);
65 65
66int gm204_sor_dp_new(struct nvkm_disp *, int, struct dcb_output *, 66int gm200_sor_dp_new(struct nvkm_disp *, int, struct dcb_output *,
67 struct nvkm_output **); 67 struct nvkm_output **);
68#endif 68#endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgm204.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgm200.c
index 168bffe0643c..38f5ee1dfc58 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgm204.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgm200.c
@@ -27,11 +27,11 @@
27#include <nvif/class.h> 27#include <nvif/class.h>
28 28
29static const struct nv50_disp_root_func 29static const struct nv50_disp_root_func
30gm204_disp_root = { 30gm200_disp_root = {
31 .init = gf119_disp_root_init, 31 .init = gf119_disp_root_init,
32 .fini = gf119_disp_root_fini, 32 .fini = gf119_disp_root_fini,
33 .dmac = { 33 .dmac = {
34 &gm204_disp_core_oclass, 34 &gm200_disp_core_oclass,
35 &gk110_disp_base_oclass, 35 &gk110_disp_base_oclass,
36 &gk104_disp_ovly_oclass, 36 &gk104_disp_ovly_oclass,
37 }, 37 },
@@ -42,17 +42,17 @@ gm204_disp_root = {
42}; 42};
43 43
44static int 44static int
45gm204_disp_root_new(struct nvkm_disp *disp, const struct nvkm_oclass *oclass, 45gm200_disp_root_new(struct nvkm_disp *disp, const struct nvkm_oclass *oclass,
46 void *data, u32 size, struct nvkm_object **pobject) 46 void *data, u32 size, struct nvkm_object **pobject)
47{ 47{
48 return nv50_disp_root_new_(&gm204_disp_root, disp, oclass, 48 return nv50_disp_root_new_(&gm200_disp_root, disp, oclass,
49 data, size, pobject); 49 data, size, pobject);
50} 50}
51 51
52const struct nvkm_disp_oclass 52const struct nvkm_disp_oclass
53gm204_disp_root_oclass = { 53gm200_disp_root_oclass = {
54 .base.oclass = GM204_DISP, 54 .base.oclass = GM200_DISP,
55 .base.minver = -1, 55 .base.minver = -1,
56 .base.maxver = -1, 56 .base.maxver = -1,
57 .ctor = gm204_disp_root_new, 57 .ctor = gm200_disp_root_new,
58}; 58};
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.h
index 5b2c903ce9ee..cb449ed8d92c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.h
@@ -39,5 +39,5 @@ extern const struct nvkm_disp_oclass gf119_disp_root_oclass;
39extern const struct nvkm_disp_oclass gk104_disp_root_oclass; 39extern const struct nvkm_disp_oclass gk104_disp_root_oclass;
40extern const struct nvkm_disp_oclass gk110_disp_root_oclass; 40extern const struct nvkm_disp_oclass gk110_disp_root_oclass;
41extern const struct nvkm_disp_oclass gm107_disp_root_oclass; 41extern const struct nvkm_disp_oclass gm107_disp_root_oclass;
42extern const struct nvkm_disp_oclass gm204_disp_root_oclass; 42extern const struct nvkm_disp_oclass gm200_disp_root_oclass;
43#endif 43#endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm204.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c
index 029e5f16c2a8..2cfbef9c344f 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm204.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c
@@ -27,19 +27,19 @@
27#include <subdev/timer.h> 27#include <subdev/timer.h>
28 28
29static inline u32 29static inline u32
30gm204_sor_soff(struct nvkm_output_dp *outp) 30gm200_sor_soff(struct nvkm_output_dp *outp)
31{ 31{
32 return (ffs(outp->base.info.or) - 1) * 0x800; 32 return (ffs(outp->base.info.or) - 1) * 0x800;
33} 33}
34 34
35static inline u32 35static inline u32
36gm204_sor_loff(struct nvkm_output_dp *outp) 36gm200_sor_loff(struct nvkm_output_dp *outp)
37{ 37{
38 return gm204_sor_soff(outp) + !(outp->base.info.sorconf.link & 1) * 0x80; 38 return gm200_sor_soff(outp) + !(outp->base.info.sorconf.link & 1) * 0x80;
39} 39}
40 40
41void 41void
42gm204_sor_magic(struct nvkm_output *outp) 42gm200_sor_magic(struct nvkm_output *outp)
43{ 43{
44 struct nvkm_device *device = outp->disp->engine.subdev.device; 44 struct nvkm_device *device = outp->disp->engine.subdev.device;
45 const u32 soff = outp->or * 0x100; 45 const u32 soff = outp->or * 0x100;
@@ -51,16 +51,16 @@ gm204_sor_magic(struct nvkm_output *outp)
51} 51}
52 52
53static inline u32 53static inline u32
54gm204_sor_dp_lane_map(struct nvkm_device *device, u8 lane) 54gm200_sor_dp_lane_map(struct nvkm_device *device, u8 lane)
55{ 55{
56 return lane * 0x08; 56 return lane * 0x08;
57} 57}
58 58
59static int 59static int
60gm204_sor_dp_pattern(struct nvkm_output_dp *outp, int pattern) 60gm200_sor_dp_pattern(struct nvkm_output_dp *outp, int pattern)
61{ 61{
62 struct nvkm_device *device = outp->base.disp->engine.subdev.device; 62 struct nvkm_device *device = outp->base.disp->engine.subdev.device;
63 const u32 soff = gm204_sor_soff(outp); 63 const u32 soff = gm200_sor_soff(outp);
64 const u32 data = 0x01010101 * pattern; 64 const u32 data = 0x01010101 * pattern;
65 if (outp->base.info.sorconf.link & 1) 65 if (outp->base.info.sorconf.link & 1)
66 nvkm_mask(device, 0x61c110 + soff, 0x0f0f0f0f, data); 66 nvkm_mask(device, 0x61c110 + soff, 0x0f0f0f0f, data);
@@ -70,15 +70,15 @@ gm204_sor_dp_pattern(struct nvkm_output_dp *outp, int pattern)
70} 70}
71 71
72static int 72static int
73gm204_sor_dp_lnk_pwr(struct nvkm_output_dp *outp, int nr) 73gm200_sor_dp_lnk_pwr(struct nvkm_output_dp *outp, int nr)
74{ 74{
75 struct nvkm_device *device = outp->base.disp->engine.subdev.device; 75 struct nvkm_device *device = outp->base.disp->engine.subdev.device;
76 const u32 soff = gm204_sor_soff(outp); 76 const u32 soff = gm200_sor_soff(outp);
77 const u32 loff = gm204_sor_loff(outp); 77 const u32 loff = gm200_sor_loff(outp);
78 u32 mask = 0, i; 78 u32 mask = 0, i;
79 79
80 for (i = 0; i < nr; i++) 80 for (i = 0; i < nr; i++)
81 mask |= 1 << (gm204_sor_dp_lane_map(device, i) >> 3); 81 mask |= 1 << (gm200_sor_dp_lane_map(device, i) >> 3);
82 82
83 nvkm_mask(device, 0x61c130 + loff, 0x0000000f, mask); 83 nvkm_mask(device, 0x61c130 + loff, 0x0000000f, mask);
84 nvkm_mask(device, 0x61c034 + soff, 0x80000000, 0x80000000); 84 nvkm_mask(device, 0x61c034 + soff, 0x80000000, 0x80000000);
@@ -90,13 +90,13 @@ gm204_sor_dp_lnk_pwr(struct nvkm_output_dp *outp, int nr)
90} 90}
91 91
92static int 92static int
93gm204_sor_dp_drv_ctl(struct nvkm_output_dp *outp, 93gm200_sor_dp_drv_ctl(struct nvkm_output_dp *outp,
94 int ln, int vs, int pe, int pc) 94 int ln, int vs, int pe, int pc)
95{ 95{
96 struct nvkm_device *device = outp->base.disp->engine.subdev.device; 96 struct nvkm_device *device = outp->base.disp->engine.subdev.device;
97 struct nvkm_bios *bios = device->bios; 97 struct nvkm_bios *bios = device->bios;
98 const u32 shift = gm204_sor_dp_lane_map(device, ln); 98 const u32 shift = gm200_sor_dp_lane_map(device, ln);
99 const u32 loff = gm204_sor_loff(outp); 99 const u32 loff = gm200_sor_loff(outp);
100 u32 addr, data[4]; 100 u32 addr, data[4];
101 u8 ver, hdr, cnt, len; 101 u8 ver, hdr, cnt, len;
102 struct nvbios_dpout info; 102 struct nvbios_dpout info;
@@ -128,16 +128,16 @@ gm204_sor_dp_drv_ctl(struct nvkm_output_dp *outp,
128} 128}
129 129
130static const struct nvkm_output_dp_func 130static const struct nvkm_output_dp_func
131gm204_sor_dp_func = { 131gm200_sor_dp_func = {
132 .pattern = gm204_sor_dp_pattern, 132 .pattern = gm200_sor_dp_pattern,
133 .lnk_pwr = gm204_sor_dp_lnk_pwr, 133 .lnk_pwr = gm200_sor_dp_lnk_pwr,
134 .lnk_ctl = gf119_sor_dp_lnk_ctl, 134 .lnk_ctl = gf119_sor_dp_lnk_ctl,
135 .drv_ctl = gm204_sor_dp_drv_ctl, 135 .drv_ctl = gm200_sor_dp_drv_ctl,
136}; 136};
137 137
138int 138int
139gm204_sor_dp_new(struct nvkm_disp *disp, int index, struct dcb_output *dcbE, 139gm200_sor_dp_new(struct nvkm_disp *disp, int index, struct dcb_output *dcbE,
140 struct nvkm_output **poutp) 140 struct nvkm_output **poutp)
141{ 141{
142 return nvkm_output_dp_new_(&gm204_sor_dp_func, disp, index, dcbE, poutp); 142 return nvkm_output_dp_new_(&gm200_sor_dp_func, disp, index, dcbE, poutp);
143} 143}
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/Kbuild b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/Kbuild
index 74993c144a84..65e5d291ecda 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/Kbuild
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/Kbuild
@@ -7,9 +7,11 @@ nvkm-y += nvkm/engine/fifo/nv50.o
7nvkm-y += nvkm/engine/fifo/g84.o 7nvkm-y += nvkm/engine/fifo/g84.o
8nvkm-y += nvkm/engine/fifo/gf100.o 8nvkm-y += nvkm/engine/fifo/gf100.o
9nvkm-y += nvkm/engine/fifo/gk104.o 9nvkm-y += nvkm/engine/fifo/gk104.o
10nvkm-y += nvkm/engine/fifo/gk110.o
10nvkm-y += nvkm/engine/fifo/gk208.o 11nvkm-y += nvkm/engine/fifo/gk208.o
11nvkm-y += nvkm/engine/fifo/gk20a.o 12nvkm-y += nvkm/engine/fifo/gk20a.o
12nvkm-y += nvkm/engine/fifo/gm204.o 13nvkm-y += nvkm/engine/fifo/gm107.o
14nvkm-y += nvkm/engine/fifo/gm200.o
13nvkm-y += nvkm/engine/fifo/gm20b.o 15nvkm-y += nvkm/engine/fifo/gm20b.o
14 16
15nvkm-y += nvkm/engine/fifo/chan.o 17nvkm-y += nvkm/engine/fifo/chan.o
@@ -27,4 +29,5 @@ nvkm-y += nvkm/engine/fifo/gpfifonv50.o
27nvkm-y += nvkm/engine/fifo/gpfifog84.o 29nvkm-y += nvkm/engine/fifo/gpfifog84.o
28nvkm-y += nvkm/engine/fifo/gpfifogf100.o 30nvkm-y += nvkm/engine/fifo/gpfifogf100.o
29nvkm-y += nvkm/engine/fifo/gpfifogk104.o 31nvkm-y += nvkm/engine/fifo/gpfifogk104.o
30nvkm-y += nvkm/engine/fifo/gpfifogm204.o 32nvkm-y += nvkm/engine/fifo/gpfifogk110.o
33nvkm-y += nvkm/engine/fifo/gpfifogm200.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/changk104.h b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/changk104.h
index 97bdddb7644a..e06f4d46f802 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/changk104.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/changk104.h
@@ -7,7 +7,7 @@
7struct gk104_fifo_chan { 7struct gk104_fifo_chan {
8 struct nvkm_fifo_chan base; 8 struct nvkm_fifo_chan base;
9 struct gk104_fifo *fifo; 9 struct gk104_fifo *fifo;
10 int engine; 10 int runl;
11 11
12 struct list_head head; 12 struct list_head head;
13 bool killed; 13 bool killed;
@@ -25,5 +25,6 @@ int gk104_fifo_gpfifo_new(struct nvkm_fifo *, const struct nvkm_oclass *,
25 void *data, u32 size, struct nvkm_object **); 25 void *data, u32 size, struct nvkm_object **);
26 26
27extern const struct nvkm_fifo_chan_oclass gk104_fifo_gpfifo_oclass; 27extern const struct nvkm_fifo_chan_oclass gk104_fifo_gpfifo_oclass;
28extern const struct nvkm_fifo_chan_oclass gm204_fifo_gpfifo_oclass; 28extern const struct nvkm_fifo_chan_oclass gk110_fifo_gpfifo_oclass;
29extern const struct nvkm_fifo_chan_oclass gm200_fifo_gpfifo_oclass;
29#endif 30#endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c
index 36a39c7fd8d2..352a0baec84d 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c
@@ -54,6 +54,7 @@ gf100_fifo_runlist_commit(struct gf100_fifo *fifo)
54 struct nvkm_device *device = subdev->device; 54 struct nvkm_device *device = subdev->device;
55 struct nvkm_memory *cur; 55 struct nvkm_memory *cur;
56 int nr = 0; 56 int nr = 0;
57 int target;
57 58
58 mutex_lock(&subdev->mutex); 59 mutex_lock(&subdev->mutex);
59 cur = fifo->runlist.mem[fifo->runlist.active]; 60 cur = fifo->runlist.mem[fifo->runlist.active];
@@ -67,7 +68,10 @@ gf100_fifo_runlist_commit(struct gf100_fifo *fifo)
67 } 68 }
68 nvkm_done(cur); 69 nvkm_done(cur);
69 70
70 nvkm_wr32(device, 0x002270, nvkm_memory_addr(cur) >> 12); 71 target = (nvkm_memory_target(cur) == NVKM_MEM_TARGET_HOST) ? 0x3 : 0x0;
72
73 nvkm_wr32(device, 0x002270, (nvkm_memory_addr(cur) >> 12) |
74 (target << 28));
71 nvkm_wr32(device, 0x002274, 0x01f00000 | nr); 75 nvkm_wr32(device, 0x002274, 0x01f00000 | nr);
72 76
73 if (wait_event_timeout(fifo->runlist.wait, 77 if (wait_event_timeout(fifo->runlist.wait,
@@ -130,9 +134,9 @@ gf100_fifo_engine(struct gf100_fifo *fifo, u32 engn)
130} 134}
131 135
132static void 136static void
133gf100_fifo_recover_work(struct work_struct *work) 137gf100_fifo_recover_work(struct work_struct *w)
134{ 138{
135 struct gf100_fifo *fifo = container_of(work, typeof(*fifo), fault); 139 struct gf100_fifo *fifo = container_of(w, typeof(*fifo), recover.work);
136 struct nvkm_device *device = fifo->base.engine.subdev.device; 140 struct nvkm_device *device = fifo->base.engine.subdev.device;
137 struct nvkm_engine *engine; 141 struct nvkm_engine *engine;
138 unsigned long flags; 142 unsigned long flags;
@@ -140,15 +144,15 @@ gf100_fifo_recover_work(struct work_struct *work)
140 u64 mask, todo; 144 u64 mask, todo;
141 145
142 spin_lock_irqsave(&fifo->base.lock, flags); 146 spin_lock_irqsave(&fifo->base.lock, flags);
143 mask = fifo->mask; 147 mask = fifo->recover.mask;
144 fifo->mask = 0ULL; 148 fifo->recover.mask = 0ULL;
145 spin_unlock_irqrestore(&fifo->base.lock, flags); 149 spin_unlock_irqrestore(&fifo->base.lock, flags);
146 150
147 for (todo = mask; engn = __ffs64(todo), todo; todo &= ~(1 << engn)) 151 for (todo = mask; engn = __ffs64(todo), todo; todo &= ~BIT_ULL(engn))
148 engm |= 1 << gf100_fifo_engidx(fifo, engn); 152 engm |= 1 << gf100_fifo_engidx(fifo, engn);
149 nvkm_mask(device, 0x002630, engm, engm); 153 nvkm_mask(device, 0x002630, engm, engm);
150 154
151 for (todo = mask; engn = __ffs64(todo), todo; todo &= ~(1 << engn)) { 155 for (todo = mask; engn = __ffs64(todo), todo; todo &= ~BIT_ULL(engn)) {
152 if ((engine = nvkm_device_engine(device, engn))) { 156 if ((engine = nvkm_device_engine(device, engn))) {
153 nvkm_subdev_fini(&engine->subdev, false); 157 nvkm_subdev_fini(&engine->subdev, false);
154 WARN_ON(nvkm_subdev_init(&engine->subdev)); 158 WARN_ON(nvkm_subdev_init(&engine->subdev));
@@ -176,8 +180,8 @@ gf100_fifo_recover(struct gf100_fifo *fifo, struct nvkm_engine *engine,
176 list_del_init(&chan->head); 180 list_del_init(&chan->head);
177 chan->killed = true; 181 chan->killed = true;
178 182
179 fifo->mask |= 1ULL << engine->subdev.index; 183 fifo->recover.mask |= 1ULL << engine->subdev.index;
180 schedule_work(&fifo->fault); 184 schedule_work(&fifo->recover.work);
181} 185}
182 186
183static const struct nvkm_enum 187static const struct nvkm_enum
@@ -330,7 +334,7 @@ gf100_fifo_intr_fault(struct gf100_fifo *fifo, int unit)
330 snprintf(gpcid, sizeof(gpcid), "GPC%d/", gpc); 334 snprintf(gpcid, sizeof(gpcid), "GPC%d/", gpc);
331 } 335 }
332 336
333 if (eu) { 337 if (eu && eu->data2) {
334 switch (eu->data2) { 338 switch (eu->data2) {
335 case NVKM_SUBDEV_BAR: 339 case NVKM_SUBDEV_BAR:
336 nvkm_mask(device, 0x001704, 0x00000000, 0x00000000); 340 nvkm_mask(device, 0x001704, 0x00000000, 0x00000000);
@@ -544,9 +548,16 @@ static int
544gf100_fifo_oneinit(struct nvkm_fifo *base) 548gf100_fifo_oneinit(struct nvkm_fifo *base)
545{ 549{
546 struct gf100_fifo *fifo = gf100_fifo(base); 550 struct gf100_fifo *fifo = gf100_fifo(base);
547 struct nvkm_device *device = fifo->base.engine.subdev.device; 551 struct nvkm_subdev *subdev = &fifo->base.engine.subdev;
552 struct nvkm_device *device = subdev->device;
548 int ret; 553 int ret;
549 554
555 /* Determine number of PBDMAs by checking valid enable bits. */
556 nvkm_wr32(device, 0x002204, 0xffffffff);
557 fifo->pbdma_nr = hweight32(nvkm_rd32(device, 0x002204));
558 nvkm_debug(subdev, "%d PBDMA(s)\n", fifo->pbdma_nr);
559
560
550 ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST, 0x1000, 0x1000, 561 ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST, 0x1000, 0x1000,
551 false, &fifo->runlist.mem[0]); 562 false, &fifo->runlist.mem[0]);
552 if (ret) 563 if (ret)
@@ -576,25 +587,22 @@ static void
576gf100_fifo_fini(struct nvkm_fifo *base) 587gf100_fifo_fini(struct nvkm_fifo *base)
577{ 588{
578 struct gf100_fifo *fifo = gf100_fifo(base); 589 struct gf100_fifo *fifo = gf100_fifo(base);
579 flush_work(&fifo->fault); 590 flush_work(&fifo->recover.work);
580} 591}
581 592
582static void 593static void
583gf100_fifo_init(struct nvkm_fifo *base) 594gf100_fifo_init(struct nvkm_fifo *base)
584{ 595{
585 struct gf100_fifo *fifo = gf100_fifo(base); 596 struct gf100_fifo *fifo = gf100_fifo(base);
586 struct nvkm_subdev *subdev = &fifo->base.engine.subdev; 597 struct nvkm_device *device = fifo->base.engine.subdev.device;
587 struct nvkm_device *device = subdev->device;
588 int i; 598 int i;
589 599
590 nvkm_wr32(device, 0x000204, 0xffffffff); 600 /* Enable PBDMAs. */
591 nvkm_wr32(device, 0x002204, 0xffffffff); 601 nvkm_wr32(device, 0x000204, (1 << fifo->pbdma_nr) - 1);
592 602 nvkm_wr32(device, 0x002204, (1 << fifo->pbdma_nr) - 1);
593 fifo->spoon_nr = hweight32(nvkm_rd32(device, 0x002204));
594 nvkm_debug(subdev, "%d PBDMA unit(s)\n", fifo->spoon_nr);
595 603
596 /* assign engines to PBDMAs */ 604 /* Assign engines to PBDMAs. */
597 if (fifo->spoon_nr >= 3) { 605 if (fifo->pbdma_nr >= 3) {
598 nvkm_wr32(device, 0x002208, ~(1 << 0)); /* PGRAPH */ 606 nvkm_wr32(device, 0x002208, ~(1 << 0)); /* PGRAPH */
599 nvkm_wr32(device, 0x00220c, ~(1 << 1)); /* PVP */ 607 nvkm_wr32(device, 0x00220c, ~(1 << 1)); /* PVP */
600 nvkm_wr32(device, 0x002210, ~(1 << 1)); /* PMSPP */ 608 nvkm_wr32(device, 0x002210, ~(1 << 1)); /* PMSPP */
@@ -604,7 +612,7 @@ gf100_fifo_init(struct nvkm_fifo *base)
604 } 612 }
605 613
606 /* PBDMA[n] */ 614 /* PBDMA[n] */
607 for (i = 0; i < fifo->spoon_nr; i++) { 615 for (i = 0; i < fifo->pbdma_nr; i++) {
608 nvkm_mask(device, 0x04013c + (i * 0x2000), 0x10000100, 0x00000000); 616 nvkm_mask(device, 0x04013c + (i * 0x2000), 0x10000100, 0x00000000);
609 nvkm_wr32(device, 0x040108 + (i * 0x2000), 0xffffffff); /* INTR */ 617 nvkm_wr32(device, 0x040108 + (i * 0x2000), 0xffffffff); /* INTR */
610 nvkm_wr32(device, 0x04010c + (i * 0x2000), 0xfffffeff); /* INTREN */ 618 nvkm_wr32(device, 0x04010c + (i * 0x2000), 0xfffffeff); /* INTREN */
@@ -652,7 +660,7 @@ gf100_fifo_new(struct nvkm_device *device, int index, struct nvkm_fifo **pfifo)
652 if (!(fifo = kzalloc(sizeof(*fifo), GFP_KERNEL))) 660 if (!(fifo = kzalloc(sizeof(*fifo), GFP_KERNEL)))
653 return -ENOMEM; 661 return -ENOMEM;
654 INIT_LIST_HEAD(&fifo->chan); 662 INIT_LIST_HEAD(&fifo->chan);
655 INIT_WORK(&fifo->fault, gf100_fifo_recover_work); 663 INIT_WORK(&fifo->recover.work, gf100_fifo_recover_work);
656 *pfifo = &fifo->base; 664 *pfifo = &fifo->base;
657 665
658 return nvkm_fifo_ctor(&gf100_fifo, device, index, 128, &fifo->base); 666 return nvkm_fifo_ctor(&gf100_fifo, device, index, 128, &fifo->base);
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.h b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.h
index 08c33c3ceaf7..70db58eab9c3 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.h
@@ -11,8 +11,12 @@ struct gf100_fifo {
11 11
12 struct list_head chan; 12 struct list_head chan;
13 13
14 struct work_struct fault; 14 struct {
15 u64 mask; 15 struct work_struct work;
16 u64 mask;
17 } recover;
18
19 int pbdma_nr;
16 20
17 struct { 21 struct {
18 struct nvkm_memory *mem[2]; 22 struct nvkm_memory *mem[2];
@@ -24,7 +28,6 @@ struct gf100_fifo {
24 struct nvkm_memory *mem; 28 struct nvkm_memory *mem;
25 struct nvkm_vma bar; 29 struct nvkm_vma bar;
26 } user; 30 } user;
27 int spoon_nr;
28}; 31};
29 32
30void gf100_fifo_intr_engine(struct gf100_fifo *); 33void gf100_fifo_intr_engine(struct gf100_fifo *);
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c
index 4fcd147d43c8..68acb36b3e6d 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c
@@ -47,34 +47,41 @@ gk104_fifo_uevent_init(struct nvkm_fifo *fifo)
47} 47}
48 48
49void 49void
50gk104_fifo_runlist_commit(struct gk104_fifo *fifo, u32 engine) 50gk104_fifo_runlist_commit(struct gk104_fifo *fifo, int runl)
51{ 51{
52 struct gk104_fifo_engn *engn = &fifo->engine[engine];
53 struct gk104_fifo_chan *chan; 52 struct gk104_fifo_chan *chan;
54 struct nvkm_subdev *subdev = &fifo->base.engine.subdev; 53 struct nvkm_subdev *subdev = &fifo->base.engine.subdev;
55 struct nvkm_device *device = subdev->device; 54 struct nvkm_device *device = subdev->device;
56 struct nvkm_memory *cur; 55 struct nvkm_memory *mem;
57 int nr = 0; 56 int nr = 0;
57 int target;
58 58
59 mutex_lock(&subdev->mutex); 59 mutex_lock(&subdev->mutex);
60 cur = engn->runlist[engn->cur_runlist]; 60 mem = fifo->runlist[runl].mem[fifo->runlist[runl].next];
61 engn->cur_runlist = !engn->cur_runlist; 61 fifo->runlist[runl].next = !fifo->runlist[runl].next;
62 62
63 nvkm_kmap(cur); 63 nvkm_kmap(mem);
64 list_for_each_entry(chan, &engn->chan, head) { 64 list_for_each_entry(chan, &fifo->runlist[runl].chan, head) {
65 nvkm_wo32(cur, (nr * 8) + 0, chan->base.chid); 65 nvkm_wo32(mem, (nr * 8) + 0, chan->base.chid);
66 nvkm_wo32(cur, (nr * 8) + 4, 0x00000000); 66 nvkm_wo32(mem, (nr * 8) + 4, 0x00000000);
67 nr++; 67 nr++;
68 } 68 }
69 nvkm_done(cur); 69 nvkm_done(mem);
70 70
71 nvkm_wr32(device, 0x002270, nvkm_memory_addr(cur) >> 12); 71 if (nvkm_memory_target(mem) == NVKM_MEM_TARGET_VRAM)
72 nvkm_wr32(device, 0x002274, (engine << 20) | nr); 72 target = 0;
73 73 else
74 if (wait_event_timeout(engn->wait, !(nvkm_rd32(device, 0x002284 + 74 target = 3;
75 (engine * 0x08)) & 0x00100000), 75
76 msecs_to_jiffies(2000)) == 0) 76 nvkm_wr32(device, 0x002270, (nvkm_memory_addr(mem) >> 12) |
77 nvkm_error(subdev, "runlist %d update timeout\n", engine); 77 (target << 28));
78 nvkm_wr32(device, 0x002274, (runl << 20) | nr);
79
80 if (wait_event_timeout(fifo->runlist[runl].wait,
81 !(nvkm_rd32(device, 0x002284 + (runl * 0x08))
82 & 0x00100000),
83 msecs_to_jiffies(2000)) == 0)
84 nvkm_error(subdev, "runlist %d update timeout\n", runl);
78 mutex_unlock(&subdev->mutex); 85 mutex_unlock(&subdev->mutex);
79} 86}
80 87
@@ -90,58 +97,51 @@ void
90gk104_fifo_runlist_insert(struct gk104_fifo *fifo, struct gk104_fifo_chan *chan) 97gk104_fifo_runlist_insert(struct gk104_fifo *fifo, struct gk104_fifo_chan *chan)
91{ 98{
92 mutex_lock(&fifo->base.engine.subdev.mutex); 99 mutex_lock(&fifo->base.engine.subdev.mutex);
93 list_add_tail(&chan->head, &fifo->engine[chan->engine].chan); 100 list_add_tail(&chan->head, &fifo->runlist[chan->runl].chan);
94 mutex_unlock(&fifo->base.engine.subdev.mutex); 101 mutex_unlock(&fifo->base.engine.subdev.mutex);
95} 102}
96 103
97static inline struct nvkm_engine *
98gk104_fifo_engine(struct gk104_fifo *fifo, u32 engn)
99{
100 struct nvkm_device *device = fifo->base.engine.subdev.device;
101 u64 subdevs = gk104_fifo_engine_subdev(engn);
102 if (subdevs)
103 return nvkm_device_engine(device, __ffs(subdevs));
104 return NULL;
105}
106
107static void 104static void
108gk104_fifo_recover_work(struct work_struct *work) 105gk104_fifo_recover_work(struct work_struct *w)
109{ 106{
110 struct gk104_fifo *fifo = container_of(work, typeof(*fifo), fault); 107 struct gk104_fifo *fifo = container_of(w, typeof(*fifo), recover.work);
111 struct nvkm_device *device = fifo->base.engine.subdev.device; 108 struct nvkm_device *device = fifo->base.engine.subdev.device;
112 struct nvkm_engine *engine; 109 struct nvkm_engine *engine;
113 unsigned long flags; 110 unsigned long flags;
114 u32 engn, engm = 0; 111 u32 engm, runm, todo;
115 u64 mask, todo; 112 int engn, runl;
116 113
117 spin_lock_irqsave(&fifo->base.lock, flags); 114 spin_lock_irqsave(&fifo->base.lock, flags);
118 mask = fifo->mask; 115 runm = fifo->recover.runm;
119 fifo->mask = 0ULL; 116 engm = fifo->recover.engm;
117 fifo->recover.engm = 0;
118 fifo->recover.runm = 0;
120 spin_unlock_irqrestore(&fifo->base.lock, flags); 119 spin_unlock_irqrestore(&fifo->base.lock, flags);
121 120
122 for (todo = mask; engn = __ffs64(todo), todo; todo &= ~(1 << engn)) 121 nvkm_mask(device, 0x002630, runm, runm);
123 engm |= 1 << gk104_fifo_subdev_engine(engn);
124 nvkm_mask(device, 0x002630, engm, engm);
125 122
126 for (todo = mask; engn = __ffs64(todo), todo; todo &= ~(1 << engn)) { 123 for (todo = engm; engn = __ffs(todo), todo; todo &= ~BIT(engn)) {
127 if ((engine = nvkm_device_engine(device, engn))) { 124 if ((engine = fifo->engine[engn].engine)) {
128 nvkm_subdev_fini(&engine->subdev, false); 125 nvkm_subdev_fini(&engine->subdev, false);
129 WARN_ON(nvkm_subdev_init(&engine->subdev)); 126 WARN_ON(nvkm_subdev_init(&engine->subdev));
130 } 127 }
131 gk104_fifo_runlist_commit(fifo, gk104_fifo_subdev_engine(engn));
132 } 128 }
133 129
134 nvkm_wr32(device, 0x00262c, engm); 130 for (todo = runm; runl = __ffs(todo), todo; todo &= ~BIT(runl))
135 nvkm_mask(device, 0x002630, engm, 0x00000000); 131 gk104_fifo_runlist_commit(fifo, runl);
132
133 nvkm_wr32(device, 0x00262c, runm);
134 nvkm_mask(device, 0x002630, runm, 0x00000000);
136} 135}
137 136
138static void 137static void
139gk104_fifo_recover(struct gk104_fifo *fifo, struct nvkm_engine *engine, 138gk104_fifo_recover(struct gk104_fifo *fifo, struct nvkm_engine *engine,
140 struct gk104_fifo_chan *chan) 139 struct gk104_fifo_chan *chan)
141{ 140{
142 struct nvkm_subdev *subdev = &fifo->base.engine.subdev; 141 struct nvkm_subdev *subdev = &fifo->base.engine.subdev;
143 struct nvkm_device *device = subdev->device; 142 struct nvkm_device *device = subdev->device;
144 u32 chid = chan->base.chid; 143 u32 chid = chan->base.chid;
144 int engn;
145 145
146 nvkm_error(subdev, "%s engine fault on channel %d, recovering...\n", 146 nvkm_error(subdev, "%s engine fault on channel %d, recovering...\n",
147 nvkm_subdev_name[engine->subdev.index], chid); 147 nvkm_subdev_name[engine->subdev.index], chid);
@@ -151,8 +151,15 @@ gk104_fifo_recover(struct gk104_fifo *fifo, struct nvkm_engine *engine,
151 list_del_init(&chan->head); 151 list_del_init(&chan->head);
152 chan->killed = true; 152 chan->killed = true;
153 153
154 fifo->mask |= 1ULL << engine->subdev.index; 154 for (engn = 0; engn < fifo->engine_nr; engn++) {
155 schedule_work(&fifo->fault); 155 if (fifo->engine[engn].engine == engine) {
156 fifo->recover.engm |= BIT(engn);
157 break;
158 }
159 }
160
161 fifo->recover.runm |= BIT(chan->runl);
162 schedule_work(&fifo->recover.work);
156} 163}
157 164
158static const struct nvkm_enum 165static const struct nvkm_enum
@@ -189,32 +196,31 @@ static void
189gk104_fifo_intr_sched_ctxsw(struct gk104_fifo *fifo) 196gk104_fifo_intr_sched_ctxsw(struct gk104_fifo *fifo)
190{ 197{
191 struct nvkm_device *device = fifo->base.engine.subdev.device; 198 struct nvkm_device *device = fifo->base.engine.subdev.device;
192 struct nvkm_engine *engine;
193 struct gk104_fifo_chan *chan; 199 struct gk104_fifo_chan *chan;
194 unsigned long flags; 200 unsigned long flags;
195 u32 engn; 201 u32 engn;
196 202
197 spin_lock_irqsave(&fifo->base.lock, flags); 203 spin_lock_irqsave(&fifo->base.lock, flags);
198 for (engn = 0; engn < ARRAY_SIZE(fifo->engine); engn++) { 204 for (engn = 0; engn < fifo->engine_nr; engn++) {
205 struct nvkm_engine *engine = fifo->engine[engn].engine;
206 int runl = fifo->engine[engn].runl;
199 u32 stat = nvkm_rd32(device, 0x002640 + (engn * 0x08)); 207 u32 stat = nvkm_rd32(device, 0x002640 + (engn * 0x08));
200 u32 busy = (stat & 0x80000000); 208 u32 busy = (stat & 0x80000000);
201 u32 next = (stat & 0x07ff0000) >> 16; 209 u32 next = (stat & 0x0fff0000) >> 16;
202 u32 chsw = (stat & 0x00008000); 210 u32 chsw = (stat & 0x00008000);
203 u32 save = (stat & 0x00004000); 211 u32 save = (stat & 0x00004000);
204 u32 load = (stat & 0x00002000); 212 u32 load = (stat & 0x00002000);
205 u32 prev = (stat & 0x000007ff); 213 u32 prev = (stat & 0x00000fff);
206 u32 chid = load ? next : prev; 214 u32 chid = load ? next : prev;
207 (void)save; 215 (void)save;
208 216
209 if (busy && chsw) { 217 if (!busy || !chsw)
210 list_for_each_entry(chan, &fifo->engine[engn].chan, head) { 218 continue;
211 if (chan->base.chid == chid) { 219
212 engine = gk104_fifo_engine(fifo, engn); 220 list_for_each_entry(chan, &fifo->runlist[runl].chan, head) {
213 if (!engine) 221 if (chan->base.chid == chid && engine) {
214 break; 222 gk104_fifo_recover(fifo, engine, chan);
215 gk104_fifo_recover(fifo, engine, chan); 223 break;
216 break;
217 }
218 } 224 }
219 } 225 }
220 } 226 }
@@ -395,7 +401,7 @@ gk104_fifo_intr_fault(struct gk104_fifo *fifo, int unit)
395 snprintf(gpcid, sizeof(gpcid), "GPC%d/", gpc); 401 snprintf(gpcid, sizeof(gpcid), "GPC%d/", gpc);
396 } 402 }
397 403
398 if (eu) { 404 if (eu && eu->data2) {
399 switch (eu->data2) { 405 switch (eu->data2) {
400 case NVKM_SUBDEV_BAR: 406 case NVKM_SUBDEV_BAR:
401 nvkm_mask(device, 0x001704, 0x00000000, 0x00000000); 407 nvkm_mask(device, 0x001704, 0x00000000, 0x00000000);
@@ -484,9 +490,10 @@ gk104_fifo_intr_pbdma_0(struct gk104_fifo *fifo, int unit)
484 if (nvkm_sw_mthd(device->sw, chid, subc, mthd, data)) 490 if (nvkm_sw_mthd(device->sw, chid, subc, mthd, data))
485 show &= ~0x00800000; 491 show &= ~0x00800000;
486 } 492 }
487 nvkm_wr32(device, 0x0400c0 + (unit * 0x2000), 0x80600008);
488 } 493 }
489 494
495 nvkm_wr32(device, 0x0400c0 + (unit * 0x2000), 0x80600008);
496
490 if (show) { 497 if (show) {
491 nvkm_snprintbf(msg, sizeof(msg), gk104_fifo_pbdma_intr_0, show); 498 nvkm_snprintbf(msg, sizeof(msg), gk104_fifo_pbdma_intr_0, show);
492 chan = nvkm_fifo_chan_chid(&fifo->base, chid, &flags); 499 chan = nvkm_fifo_chan_chid(&fifo->base, chid, &flags);
@@ -537,10 +544,10 @@ gk104_fifo_intr_runlist(struct gk104_fifo *fifo)
537 struct nvkm_device *device = fifo->base.engine.subdev.device; 544 struct nvkm_device *device = fifo->base.engine.subdev.device;
538 u32 mask = nvkm_rd32(device, 0x002a00); 545 u32 mask = nvkm_rd32(device, 0x002a00);
539 while (mask) { 546 while (mask) {
540 u32 engn = __ffs(mask); 547 int runl = __ffs(mask);
541 wake_up(&fifo->engine[engn].wait); 548 wake_up(&fifo->runlist[runl].wait);
542 nvkm_wr32(device, 0x002a00, 1 << engn); 549 nvkm_wr32(device, 0x002a00, 1 << runl);
543 mask &= ~(1 << engn); 550 mask &= ~(1 << runl);
544 } 551 }
545} 552}
546 553
@@ -647,7 +654,7 @@ gk104_fifo_fini(struct nvkm_fifo *base)
647{ 654{
648 struct gk104_fifo *fifo = gk104_fifo(base); 655 struct gk104_fifo *fifo = gk104_fifo(base);
649 struct nvkm_device *device = fifo->base.engine.subdev.device; 656 struct nvkm_device *device = fifo->base.engine.subdev.device;
650 flush_work(&fifo->fault); 657 flush_work(&fifo->recover.work);
651 /* allow mmu fault interrupts, even when we're not using fifo */ 658 /* allow mmu fault interrupts, even when we're not using fifo */
652 nvkm_mask(device, 0x002140, 0x10000000, 0x10000000); 659 nvkm_mask(device, 0x002140, 0x10000000, 0x10000000);
653} 660}
@@ -656,24 +663,122 @@ int
656gk104_fifo_oneinit(struct nvkm_fifo *base) 663gk104_fifo_oneinit(struct nvkm_fifo *base)
657{ 664{
658 struct gk104_fifo *fifo = gk104_fifo(base); 665 struct gk104_fifo *fifo = gk104_fifo(base);
659 struct nvkm_device *device = fifo->base.engine.subdev.device; 666 struct nvkm_subdev *subdev = &fifo->base.engine.subdev;
667 struct nvkm_device *device = subdev->device;
660 int ret, i; 668 int ret, i;
669 u32 *map;
670
671 /* Determine number of PBDMAs by checking valid enable bits. */
672 nvkm_wr32(device, 0x000204, 0xffffffff);
673 fifo->pbdma_nr = hweight32(nvkm_rd32(device, 0x000204));
674 nvkm_debug(subdev, "%d PBDMA(s)\n", fifo->pbdma_nr);
675
676 /* Read PBDMA->runlist(s) mapping from HW. */
677 if (!(map = kzalloc(sizeof(*map) * fifo->pbdma_nr, GFP_KERNEL)))
678 return -ENOMEM;
679
680 for (i = 0; i < fifo->pbdma_nr; i++)
681 map[i] = nvkm_rd32(device, 0x002390 + (i * 0x04));
682
683 /* Read device topology from HW. */
684 for (i = 0; i < 64; i++) {
685 int type = -1, pbid = -1, engidx = -1;
686 int engn = -1, runl = -1, intr = -1, mcen = -1;
687 int fault = -1, j;
688 u32 data, addr = 0;
689
690 do {
691 data = nvkm_rd32(device, 0x022700 + (i * 0x04));
692 nvkm_trace(subdev, "%02x: %08x\n", i, data);
693 switch (data & 0x00000003) {
694 case 0x00000000: /* NOT_VALID */
695 continue;
696 case 0x00000001: /* DATA */
697 addr = (data & 0x00fff000);
698 fault = (data & 0x000000f8) >> 3;
699 break;
700 case 0x00000002: /* ENUM */
701 if (data & 0x00000020)
702 engn = (data & 0x3c000000) >> 26;
703 if (data & 0x00000010)
704 runl = (data & 0x01e00000) >> 21;
705 if (data & 0x00000008)
706 intr = (data & 0x000f8000) >> 15;
707 if (data & 0x00000004)
708 mcen = (data & 0x00003e00) >> 9;
709 break;
710 case 0x00000003: /* ENGINE_TYPE */
711 type = (data & 0x7ffffffc) >> 2;
712 break;
713 }
714 } while ((data & 0x80000000) && ++i < 64);
715
716 if (!data)
717 continue;
718
719 /* Determine which PBDMA handles requests for this engine. */
720 for (j = 0; runl >= 0 && j < fifo->pbdma_nr; j++) {
721 if (map[j] & (1 << runl)) {
722 pbid = j;
723 break;
724 }
725 }
726
727 /* Translate engine type to NVKM engine identifier. */
728 switch (type) {
729 case 0x00000000: engidx = NVKM_ENGINE_GR; break;
730 case 0x00000001: engidx = NVKM_ENGINE_CE0; break;
731 case 0x00000002: engidx = NVKM_ENGINE_CE1; break;
732 case 0x00000003: engidx = NVKM_ENGINE_CE2; break;
733 case 0x00000008: engidx = NVKM_ENGINE_MSPDEC; break;
734 case 0x00000009: engidx = NVKM_ENGINE_MSPPP; break;
735 case 0x0000000a: engidx = NVKM_ENGINE_MSVLD; break;
736 case 0x0000000b: engidx = NVKM_ENGINE_MSENC; break;
737 case 0x0000000c: engidx = NVKM_ENGINE_VIC; break;
738 case 0x0000000d: engidx = NVKM_ENGINE_SEC; break;
739 case 0x0000000e: engidx = NVKM_ENGINE_NVENC0; break;
740 case 0x0000000f: engidx = NVKM_ENGINE_NVENC1; break;
741 case 0x00000010: engidx = NVKM_ENGINE_NVDEC; break;
742 break;
743 default:
744 break;
745 }
746
747 nvkm_debug(subdev, "%02x (%8s): engine %2d runlist %2d "
748 "pbdma %2d intr %2d reset %2d "
749 "fault %2d addr %06x\n", type,
750 engidx < 0 ? NULL : nvkm_subdev_name[engidx],
751 engn, runl, pbid, intr, mcen, fault, addr);
752
753 /* Mark the engine as supported if everything checks out. */
754 if (engn >= 0 && runl >= 0) {
755 fifo->engine[engn].engine = engidx < 0 ? NULL :
756 nvkm_device_engine(device, engidx);
757 fifo->engine[engn].runl = runl;
758 fifo->engine[engn].pbid = pbid;
759 fifo->engine_nr = max(fifo->engine_nr, engn + 1);
760 fifo->runlist[runl].engm |= 1 << engn;
761 fifo->runlist_nr = max(fifo->runlist_nr, runl + 1);
762 }
763 }
661 764
662 for (i = 0; i < ARRAY_SIZE(fifo->engine); i++) { 765 kfree(map);
766
767 for (i = 0; i < fifo->runlist_nr; i++) {
663 ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST, 768 ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST,
664 0x8000, 0x1000, false, 769 0x8000, 0x1000, false,
665 &fifo->engine[i].runlist[0]); 770 &fifo->runlist[i].mem[0]);
666 if (ret) 771 if (ret)
667 return ret; 772 return ret;
668 773
669 ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST, 774 ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST,
670 0x8000, 0x1000, false, 775 0x8000, 0x1000, false,
671 &fifo->engine[i].runlist[1]); 776 &fifo->runlist[i].mem[1]);
672 if (ret) 777 if (ret)
673 return ret; 778 return ret;
674 779
675 init_waitqueue_head(&fifo->engine[i].wait); 780 init_waitqueue_head(&fifo->runlist[i].wait);
676 INIT_LIST_HEAD(&fifo->engine[i].chan); 781 INIT_LIST_HEAD(&fifo->runlist[i].chan);
677 } 782 }
678 783
679 ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST, 784 ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST,
@@ -695,24 +800,21 @@ void
695gk104_fifo_init(struct nvkm_fifo *base) 800gk104_fifo_init(struct nvkm_fifo *base)
696{ 801{
697 struct gk104_fifo *fifo = gk104_fifo(base); 802 struct gk104_fifo *fifo = gk104_fifo(base);
698 struct nvkm_subdev *subdev = &fifo->base.engine.subdev; 803 struct nvkm_device *device = fifo->base.engine.subdev.device;
699 struct nvkm_device *device = subdev->device;
700 int i; 804 int i;
701 805
702 /* enable all available PBDMA units */ 806 /* Enable PBDMAs. */
703 nvkm_wr32(device, 0x000204, 0xffffffff); 807 nvkm_wr32(device, 0x000204, (1 << fifo->pbdma_nr) - 1);
704 fifo->spoon_nr = hweight32(nvkm_rd32(device, 0x000204));
705 nvkm_debug(subdev, "%d PBDMA unit(s)\n", fifo->spoon_nr);
706 808
707 /* PBDMA[n] */ 809 /* PBDMA[n] */
708 for (i = 0; i < fifo->spoon_nr; i++) { 810 for (i = 0; i < fifo->pbdma_nr; i++) {
709 nvkm_mask(device, 0x04013c + (i * 0x2000), 0x10000100, 0x00000000); 811 nvkm_mask(device, 0x04013c + (i * 0x2000), 0x10000100, 0x00000000);
710 nvkm_wr32(device, 0x040108 + (i * 0x2000), 0xffffffff); /* INTR */ 812 nvkm_wr32(device, 0x040108 + (i * 0x2000), 0xffffffff); /* INTR */
711 nvkm_wr32(device, 0x04010c + (i * 0x2000), 0xfffffeff); /* INTREN */ 813 nvkm_wr32(device, 0x04010c + (i * 0x2000), 0xfffffeff); /* INTREN */
712 } 814 }
713 815
714 /* PBDMA[n].HCE */ 816 /* PBDMA[n].HCE */
715 for (i = 0; i < fifo->spoon_nr; i++) { 817 for (i = 0; i < fifo->pbdma_nr; i++) {
716 nvkm_wr32(device, 0x040148 + (i * 0x2000), 0xffffffff); /* INTR */ 818 nvkm_wr32(device, 0x040148 + (i * 0x2000), 0xffffffff); /* INTR */
717 nvkm_wr32(device, 0x04014c + (i * 0x2000), 0xffffffff); /* INTREN */ 819 nvkm_wr32(device, 0x04014c + (i * 0x2000), 0xffffffff); /* INTREN */
718 } 820 }
@@ -732,9 +834,9 @@ gk104_fifo_dtor(struct nvkm_fifo *base)
732 nvkm_vm_put(&fifo->user.bar); 834 nvkm_vm_put(&fifo->user.bar);
733 nvkm_memory_del(&fifo->user.mem); 835 nvkm_memory_del(&fifo->user.mem);
734 836
735 for (i = 0; i < ARRAY_SIZE(fifo->engine); i++) { 837 for (i = 0; i < fifo->runlist_nr; i++) {
736 nvkm_memory_del(&fifo->engine[i].runlist[1]); 838 nvkm_memory_del(&fifo->runlist[i].mem[1]);
737 nvkm_memory_del(&fifo->engine[i].runlist[0]); 839 nvkm_memory_del(&fifo->runlist[i].mem[0]);
738 } 840 }
739 841
740 return fifo; 842 return fifo;
@@ -748,7 +850,7 @@ gk104_fifo_new_(const struct nvkm_fifo_func *func, struct nvkm_device *device,
748 850
749 if (!(fifo = kzalloc(sizeof(*fifo), GFP_KERNEL))) 851 if (!(fifo = kzalloc(sizeof(*fifo), GFP_KERNEL)))
750 return -ENOMEM; 852 return -ENOMEM;
751 INIT_WORK(&fifo->fault, gk104_fifo_recover_work); 853 INIT_WORK(&fifo->recover.work, gk104_fifo_recover_work);
752 *pfifo = &fifo->base; 854 *pfifo = &fifo->base;
753 855
754 return nvkm_fifo_ctor(func, device, index, nr, &fifo->base); 856 return nvkm_fifo_ctor(func, device, index, nr, &fifo->base);
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.h b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.h
index bec519d8f91e..9e5d00ba34a2 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.h
@@ -6,25 +6,37 @@
6#include <subdev/mmu.h> 6#include <subdev/mmu.h>
7 7
8struct gk104_fifo_chan; 8struct gk104_fifo_chan;
9struct gk104_fifo_engn {
10 struct nvkm_memory *runlist[2];
11 int cur_runlist;
12 wait_queue_head_t wait;
13 struct list_head chan;
14};
15
16struct gk104_fifo { 9struct gk104_fifo {
17 struct nvkm_fifo base; 10 struct nvkm_fifo base;
18 11
19 struct work_struct fault; 12 struct {
20 u64 mask; 13 struct work_struct work;
14 u32 engm;
15 u32 runm;
16 } recover;
17
18 int pbdma_nr;
19
20 struct {
21 struct nvkm_engine *engine;
22 int runl;
23 int pbid;
24 } engine[16];
25 int engine_nr;
26
27 struct {
28 struct nvkm_memory *mem[2];
29 int next;
30 wait_queue_head_t wait;
31 struct list_head chan;
32 u32 engm;
33 } runlist[16];
34 int runlist_nr;
21 35
22 struct gk104_fifo_engn engine[7];
23 struct { 36 struct {
24 struct nvkm_memory *mem; 37 struct nvkm_memory *mem;
25 struct nvkm_vma bar; 38 struct nvkm_vma bar;
26 } user; 39 } user;
27 int spoon_nr;
28}; 40};
29 41
30int gk104_fifo_new_(const struct nvkm_fifo_func *, struct nvkm_device *, 42int gk104_fifo_new_(const struct nvkm_fifo_func *, struct nvkm_device *,
@@ -38,7 +50,7 @@ void gk104_fifo_uevent_init(struct nvkm_fifo *);
38void gk104_fifo_uevent_fini(struct nvkm_fifo *); 50void gk104_fifo_uevent_fini(struct nvkm_fifo *);
39void gk104_fifo_runlist_insert(struct gk104_fifo *, struct gk104_fifo_chan *); 51void gk104_fifo_runlist_insert(struct gk104_fifo *, struct gk104_fifo_chan *);
40void gk104_fifo_runlist_remove(struct gk104_fifo *, struct gk104_fifo_chan *); 52void gk104_fifo_runlist_remove(struct gk104_fifo *, struct gk104_fifo_chan *);
41void gk104_fifo_runlist_commit(struct gk104_fifo *, u32 engine); 53void gk104_fifo_runlist_commit(struct gk104_fifo *, int runl);
42 54
43static inline u64 55static inline u64
44gk104_fifo_engine_subdev(int engine) 56gk104_fifo_engine_subdev(int engine)
@@ -58,23 +70,4 @@ gk104_fifo_engine_subdev(int engine)
58 return 0; 70 return 0;
59 } 71 }
60} 72}
61
62static inline int
63gk104_fifo_subdev_engine(int subdev)
64{
65 switch (subdev) {
66 case NVKM_ENGINE_GR:
67 case NVKM_ENGINE_SW:
68 case NVKM_ENGINE_CE2 : return 0;
69 case NVKM_ENGINE_MSPDEC: return 1;
70 case NVKM_ENGINE_MSPPP : return 2;
71 case NVKM_ENGINE_MSVLD : return 3;
72 case NVKM_ENGINE_CE0 : return 4;
73 case NVKM_ENGINE_CE1 : return 5;
74 case NVKM_ENGINE_MSENC : return 6;
75 default:
76 WARN_ON(1);
77 return 0;
78 }
79}
80#endif 73#endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk110.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk110.c
new file mode 100644
index 000000000000..41307fcd4bb3
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk110.c
@@ -0,0 +1,46 @@
1/*
2 * Copyright 2016 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#include "gk104.h"
25#include "changk104.h"
26
27static const struct nvkm_fifo_func
28gk110_fifo = {
29 .dtor = gk104_fifo_dtor,
30 .oneinit = gk104_fifo_oneinit,
31 .init = gk104_fifo_init,
32 .fini = gk104_fifo_fini,
33 .intr = gk104_fifo_intr,
34 .uevent_init = gk104_fifo_uevent_init,
35 .uevent_fini = gk104_fifo_uevent_fini,
36 .chan = {
37 &gk110_fifo_gpfifo_oclass,
38 NULL
39 },
40};
41
42int
43gk110_fifo_new(struct nvkm_device *device, int index, struct nvkm_fifo **pfifo)
44{
45 return gk104_fifo_new_(&gk110_fifo, device, index, 4096, pfifo);
46}
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm107.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm107.c
new file mode 100644
index 000000000000..6d59d65794a1
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm107.c
@@ -0,0 +1,46 @@
1/*
2 * Copyright 2016 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#include "gk104.h"
25#include "changk104.h"
26
27static const struct nvkm_fifo_func
28gm107_fifo = {
29 .dtor = gk104_fifo_dtor,
30 .oneinit = gk104_fifo_oneinit,
31 .init = gk104_fifo_init,
32 .fini = gk104_fifo_fini,
33 .intr = gk104_fifo_intr,
34 .uevent_init = gk104_fifo_uevent_init,
35 .uevent_fini = gk104_fifo_uevent_fini,
36 .chan = {
37 &gk110_fifo_gpfifo_oclass,
38 NULL
39 },
40};
41
42int
43gm107_fifo_new(struct nvkm_device *device, int index, struct nvkm_fifo **pfifo)
44{
45 return gk104_fifo_new_(&gm107_fifo, device, index, 2048, pfifo);
46}
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm204.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm200.c
index 2db629f1bf7e..4bdd43078df9 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm204.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm200.c
@@ -25,7 +25,7 @@
25#include "changk104.h" 25#include "changk104.h"
26 26
27static const struct nvkm_fifo_func 27static const struct nvkm_fifo_func
28gm204_fifo = { 28gm200_fifo = {
29 .dtor = gk104_fifo_dtor, 29 .dtor = gk104_fifo_dtor,
30 .oneinit = gk104_fifo_oneinit, 30 .oneinit = gk104_fifo_oneinit,
31 .init = gk104_fifo_init, 31 .init = gk104_fifo_init,
@@ -34,13 +34,13 @@ gm204_fifo = {
34 .uevent_init = gk104_fifo_uevent_init, 34 .uevent_init = gk104_fifo_uevent_init,
35 .uevent_fini = gk104_fifo_uevent_fini, 35 .uevent_fini = gk104_fifo_uevent_fini,
36 .chan = { 36 .chan = {
37 &gm204_fifo_gpfifo_oclass, 37 &gm200_fifo_gpfifo_oclass,
38 NULL 38 NULL
39 }, 39 },
40}; 40};
41 41
42int 42int
43gm204_fifo_new(struct nvkm_device *device, int index, struct nvkm_fifo **pfifo) 43gm200_fifo_new(struct nvkm_device *device, int index, struct nvkm_fifo **pfifo)
44{ 44{
45 return gk104_fifo_new_(&gm204_fifo, device, index, 4096, pfifo); 45 return gk104_fifo_new_(&gm200_fifo, device, index, 4096, pfifo);
46} 46}
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm20b.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm20b.c
index ae6375d9760f..4c91d4aa1e9e 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm20b.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm20b.c
@@ -32,7 +32,7 @@ gm20b_fifo = {
32 .uevent_init = gk104_fifo_uevent_init, 32 .uevent_init = gk104_fifo_uevent_init,
33 .uevent_fini = gk104_fifo_uevent_fini, 33 .uevent_fini = gk104_fifo_uevent_fini,
34 .chan = { 34 .chan = {
35 &gm204_fifo_gpfifo_oclass, 35 &gm200_fifo_gpfifo_oclass,
36 NULL 36 NULL
37 }, 37 },
38}; 38};
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogk104.c
index 2e1df01bd928..ed4351032ed6 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogk104.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogk104.c
@@ -63,9 +63,15 @@ gk104_fifo_gpfifo_engine_addr(struct nvkm_engine *engine)
63 case NVKM_ENGINE_CE1 : 63 case NVKM_ENGINE_CE1 :
64 case NVKM_ENGINE_CE2 : return 0x0000; 64 case NVKM_ENGINE_CE2 : return 0x0000;
65 case NVKM_ENGINE_GR : return 0x0210; 65 case NVKM_ENGINE_GR : return 0x0210;
66 case NVKM_ENGINE_SEC : return 0x0220;
66 case NVKM_ENGINE_MSPDEC: return 0x0250; 67 case NVKM_ENGINE_MSPDEC: return 0x0250;
67 case NVKM_ENGINE_MSPPP : return 0x0260; 68 case NVKM_ENGINE_MSPPP : return 0x0260;
68 case NVKM_ENGINE_MSVLD : return 0x0270; 69 case NVKM_ENGINE_MSVLD : return 0x0270;
70 case NVKM_ENGINE_VIC : return 0x0280;
71 case NVKM_ENGINE_MSENC : return 0x0290;
72 case NVKM_ENGINE_NVDEC : return 0x02100270;
73 case NVKM_ENGINE_NVENC0: return 0x02100290;
74 case NVKM_ENGINE_NVENC1: return 0x0210;
69 default: 75 default:
70 WARN_ON(1); 76 WARN_ON(1);
71 return 0; 77 return 0;
@@ -76,9 +82,9 @@ static int
76gk104_fifo_gpfifo_engine_fini(struct nvkm_fifo_chan *base, 82gk104_fifo_gpfifo_engine_fini(struct nvkm_fifo_chan *base,
77 struct nvkm_engine *engine, bool suspend) 83 struct nvkm_engine *engine, bool suspend)
78{ 84{
79 const u32 offset = gk104_fifo_gpfifo_engine_addr(engine);
80 struct gk104_fifo_chan *chan = gk104_fifo_chan(base); 85 struct gk104_fifo_chan *chan = gk104_fifo_chan(base);
81 struct nvkm_gpuobj *inst = chan->base.inst; 86 struct nvkm_gpuobj *inst = chan->base.inst;
87 u32 offset = gk104_fifo_gpfifo_engine_addr(engine);
82 int ret; 88 int ret;
83 89
84 ret = gk104_fifo_gpfifo_kick(chan); 90 ret = gk104_fifo_gpfifo_kick(chan);
@@ -87,8 +93,12 @@ gk104_fifo_gpfifo_engine_fini(struct nvkm_fifo_chan *base,
87 93
88 if (offset) { 94 if (offset) {
89 nvkm_kmap(inst); 95 nvkm_kmap(inst);
90 nvkm_wo32(inst, offset + 0x00, 0x00000000); 96 nvkm_wo32(inst, (offset & 0xffff) + 0x00, 0x00000000);
91 nvkm_wo32(inst, offset + 0x04, 0x00000000); 97 nvkm_wo32(inst, (offset & 0xffff) + 0x04, 0x00000000);
98 if ((offset >>= 16)) {
99 nvkm_wo32(inst, offset + 0x00, 0x00000000);
100 nvkm_wo32(inst, offset + 0x04, 0x00000000);
101 }
92 nvkm_done(inst); 102 nvkm_done(inst);
93 } 103 }
94 104
@@ -99,15 +109,21 @@ static int
99gk104_fifo_gpfifo_engine_init(struct nvkm_fifo_chan *base, 109gk104_fifo_gpfifo_engine_init(struct nvkm_fifo_chan *base,
100 struct nvkm_engine *engine) 110 struct nvkm_engine *engine)
101{ 111{
102 const u32 offset = gk104_fifo_gpfifo_engine_addr(engine);
103 struct gk104_fifo_chan *chan = gk104_fifo_chan(base); 112 struct gk104_fifo_chan *chan = gk104_fifo_chan(base);
104 struct nvkm_gpuobj *inst = chan->base.inst; 113 struct nvkm_gpuobj *inst = chan->base.inst;
114 u32 offset = gk104_fifo_gpfifo_engine_addr(engine);
105 115
106 if (offset) { 116 if (offset) {
107 u64 addr = chan->engn[engine->subdev.index].vma.offset; 117 u64 addr = chan->engn[engine->subdev.index].vma.offset;
118 u32 datalo = lower_32_bits(addr) | 0x00000004;
119 u32 datahi = upper_32_bits(addr);
108 nvkm_kmap(inst); 120 nvkm_kmap(inst);
109 nvkm_wo32(inst, offset + 0x00, lower_32_bits(addr) | 4); 121 nvkm_wo32(inst, (offset & 0xffff) + 0x00, datalo);
110 nvkm_wo32(inst, offset + 0x04, upper_32_bits(addr)); 122 nvkm_wo32(inst, (offset & 0xffff) + 0x04, datahi);
123 if ((offset >>= 16)) {
124 nvkm_wo32(inst, offset + 0x00, datalo);
125 nvkm_wo32(inst, offset + 0x04, datahi);
126 }
111 nvkm_done(inst); 127 nvkm_done(inst);
112 } 128 }
113 129
@@ -154,7 +170,8 @@ gk104_fifo_gpfifo_fini(struct nvkm_fifo_chan *base)
154 if (!list_empty(&chan->head)) { 170 if (!list_empty(&chan->head)) {
155 gk104_fifo_runlist_remove(fifo, chan); 171 gk104_fifo_runlist_remove(fifo, chan);
156 nvkm_mask(device, 0x800004 + coff, 0x00000800, 0x00000800); 172 nvkm_mask(device, 0x800004 + coff, 0x00000800, 0x00000800);
157 gk104_fifo_runlist_commit(fifo, chan->engine); 173 gk104_fifo_gpfifo_kick(chan);
174 gk104_fifo_runlist_commit(fifo, chan->runl);
158 } 175 }
159 176
160 nvkm_wr32(device, 0x800000 + coff, 0x00000000); 177 nvkm_wr32(device, 0x800000 + coff, 0x00000000);
@@ -169,13 +186,13 @@ gk104_fifo_gpfifo_init(struct nvkm_fifo_chan *base)
169 u32 addr = chan->base.inst->addr >> 12; 186 u32 addr = chan->base.inst->addr >> 12;
170 u32 coff = chan->base.chid * 8; 187 u32 coff = chan->base.chid * 8;
171 188
172 nvkm_mask(device, 0x800004 + coff, 0x000f0000, chan->engine << 16); 189 nvkm_mask(device, 0x800004 + coff, 0x000f0000, chan->runl << 16);
173 nvkm_wr32(device, 0x800000 + coff, 0x80000000 | addr); 190 nvkm_wr32(device, 0x800000 + coff, 0x80000000 | addr);
174 191
175 if (list_empty(&chan->head) && !chan->killed) { 192 if (list_empty(&chan->head) && !chan->killed) {
176 gk104_fifo_runlist_insert(fifo, chan); 193 gk104_fifo_runlist_insert(fifo, chan);
177 nvkm_mask(device, 0x800004 + coff, 0x00000400, 0x00000400); 194 nvkm_mask(device, 0x800004 + coff, 0x00000400, 0x00000400);
178 gk104_fifo_runlist_commit(fifo, chan->engine); 195 gk104_fifo_runlist_commit(fifo, chan->runl);
179 nvkm_mask(device, 0x800004 + coff, 0x00000400, 0x00000400); 196 nvkm_mask(device, 0x800004 + coff, 0x00000400, 0x00000400);
180 } 197 }
181} 198}
@@ -201,73 +218,79 @@ gk104_fifo_gpfifo_func = {
201 .engine_fini = gk104_fifo_gpfifo_engine_fini, 218 .engine_fini = gk104_fifo_gpfifo_engine_fini,
202}; 219};
203 220
204int 221struct gk104_fifo_chan_func {
205gk104_fifo_gpfifo_new(struct nvkm_fifo *base, const struct nvkm_oclass *oclass, 222 u32 engine;
206 void *data, u32 size, struct nvkm_object **pobject) 223 u64 subdev;
224};
225
226static int
227gk104_fifo_gpfifo_new_(const struct gk104_fifo_chan_func *func,
228 struct gk104_fifo *fifo, u32 *engmask, u16 *chid,
229 u64 vm, u64 ioffset, u64 ilength,
230 const struct nvkm_oclass *oclass,
231 struct nvkm_object **pobject)
207{ 232{
208 union {
209 struct kepler_channel_gpfifo_a_v0 v0;
210 } *args = data;
211 struct gk104_fifo *fifo = gk104_fifo(base);
212 struct nvkm_device *device = fifo->base.engine.subdev.device; 233 struct nvkm_device *device = fifo->base.engine.subdev.device;
213 struct nvkm_object *parent = oclass->parent;
214 struct gk104_fifo_chan *chan; 234 struct gk104_fifo_chan *chan;
215 u64 usermem, ioffset, ilength; 235 int runlist = -1, ret = -ENOSYS, i, j;
216 u32 engines; 236 u32 engines = 0, present = 0;
217 int ret = -ENOSYS, i; 237 u64 subdevs = 0;
218 238 u64 usermem;
219 nvif_ioctl(parent, "create channel gpfifo size %d\n", size); 239
220 if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { 240 /* Determine which downstream engines are present */
221 nvif_ioctl(parent, "create channel gpfifo vers %d vm %llx " 241 for (i = 0; i < fifo->engine_nr; i++) {
222 "ioffset %016llx ilength %08x engine %08x\n", 242 struct nvkm_engine *engine = fifo->engine[i].engine;
223 args->v0.version, args->v0.vm, args->v0.ioffset, 243 if (engine) {
224 args->v0.ilength, args->v0.engine); 244 u64 submask = BIT_ULL(engine->subdev.index);
225 } else 245 for (j = 0; func[j].subdev; j++) {
226 return ret; 246 if (func[j].subdev & submask) {
227 247 present |= func[j].engine;
228 /* determine which downstream engines are present */ 248 break;
229 for (i = 0, engines = 0; i < ARRAY_SIZE(fifo->engine); i++) { 249 }
230 u64 subdevs = gk104_fifo_engine_subdev(i); 250 }
231 if (!nvkm_device_engine(device, __ffs64(subdevs))) 251
232 continue; 252 if (!func[j].subdev)
233 engines |= (1 << i); 253 continue;
254
255 if (runlist < 0 && (*engmask & present))
256 runlist = fifo->engine[i].runl;
257 if (runlist == fifo->engine[i].runl) {
258 engines |= func[j].engine;
259 subdevs |= func[j].subdev;
260 }
261 }
234 } 262 }
235 263
236 /* if this is an engine mask query, we're done */ 264 /* Just an engine mask query? All done here! */
237 if (!args->v0.engine) { 265 if (!*engmask) {
238 args->v0.engine = engines; 266 *engmask = present;
239 return nvkm_object_new(oclass, NULL, 0, pobject); 267 return nvkm_object_new(oclass, NULL, 0, pobject);
240 } 268 }
241 269
242 /* check that we support a requested engine - note that the user 270 /* No runlist? No supported engines. */
243 * argument is a mask in order to allow the user to request (for 271 *engmask = present;
244 * example) *any* copy engine, but doesn't matter which. 272 if (runlist < 0)
245 */
246 args->v0.engine &= engines;
247 if (!args->v0.engine) {
248 nvif_ioctl(parent, "no supported engine\n");
249 return -ENODEV; 273 return -ENODEV;
250 } 274 *engmask = engines;
251 275
252 /* allocate the channel */ 276 /* Allocate the channel. */
253 if (!(chan = kzalloc(sizeof(*chan), GFP_KERNEL))) 277 if (!(chan = kzalloc(sizeof(*chan), GFP_KERNEL)))
254 return -ENOMEM; 278 return -ENOMEM;
255 *pobject = &chan->base.object; 279 *pobject = &chan->base.object;
256 chan->fifo = fifo; 280 chan->fifo = fifo;
257 chan->engine = __ffs(args->v0.engine); 281 chan->runl = runlist;
258 INIT_LIST_HEAD(&chan->head); 282 INIT_LIST_HEAD(&chan->head);
259 283
260 ret = nvkm_fifo_chan_ctor(&gk104_fifo_gpfifo_func, &fifo->base, 284 ret = nvkm_fifo_chan_ctor(&gk104_fifo_gpfifo_func, &fifo->base,
261 0x1000, 0x1000, true, args->v0.vm, 0, 285 0x1000, 0x1000, true, vm, 0, subdevs,
262 gk104_fifo_engine_subdev(chan->engine),
263 1, fifo->user.bar.offset, 0x200, 286 1, fifo->user.bar.offset, 0x200,
264 oclass, &chan->base); 287 oclass, &chan->base);
265 if (ret) 288 if (ret)
266 return ret; 289 return ret;
267 290
268 args->v0.chid = chan->base.chid; 291 *chid = chan->base.chid;
269 292
270 /* page directory */ 293 /* Page directory. */
271 ret = nvkm_gpuobj_new(device, 0x10000, 0x1000, false, NULL, &chan->pgd); 294 ret = nvkm_gpuobj_new(device, 0x10000, 0x1000, false, NULL, &chan->pgd);
272 if (ret) 295 if (ret)
273 return ret; 296 return ret;
@@ -283,10 +306,9 @@ gk104_fifo_gpfifo_new(struct nvkm_fifo *base, const struct nvkm_oclass *oclass,
283 if (ret) 306 if (ret)
284 return ret; 307 return ret;
285 308
286 /* clear channel control registers */ 309 /* Clear channel control registers. */
287 usermem = chan->base.chid * 0x200; 310 usermem = chan->base.chid * 0x200;
288 ioffset = args->v0.ioffset; 311 ilength = order_base_2(ilength / 8);
289 ilength = order_base_2(args->v0.ilength / 8);
290 312
291 nvkm_kmap(fifo->user.mem); 313 nvkm_kmap(fifo->user.mem);
292 for (i = 0; i < 0x200; i += 4) 314 for (i = 0; i < 0x200; i += 4)
@@ -315,6 +337,56 @@ gk104_fifo_gpfifo_new(struct nvkm_fifo *base, const struct nvkm_oclass *oclass,
315 return 0; 337 return 0;
316} 338}
317 339
340static const struct gk104_fifo_chan_func
341gk104_fifo_gpfifo[] = {
342 { NVA06F_V0_ENGINE_SW | NVA06F_V0_ENGINE_GR,
343 BIT_ULL(NVKM_ENGINE_SW) | BIT_ULL(NVKM_ENGINE_GR)
344 },
345 { NVA06F_V0_ENGINE_SEC , BIT_ULL(NVKM_ENGINE_SEC ) },
346 { NVA06F_V0_ENGINE_MSVLD , BIT_ULL(NVKM_ENGINE_MSVLD ) },
347 { NVA06F_V0_ENGINE_MSPDEC, BIT_ULL(NVKM_ENGINE_MSPDEC) },
348 { NVA06F_V0_ENGINE_MSPPP , BIT_ULL(NVKM_ENGINE_MSPPP ) },
349 { NVA06F_V0_ENGINE_MSENC , BIT_ULL(NVKM_ENGINE_MSENC ) },
350 { NVA06F_V0_ENGINE_VIC , BIT_ULL(NVKM_ENGINE_VIC ) },
351 { NVA06F_V0_ENGINE_NVDEC , BIT_ULL(NVKM_ENGINE_NVDEC ) },
352 { NVA06F_V0_ENGINE_NVENC0, BIT_ULL(NVKM_ENGINE_NVENC0) },
353 { NVA06F_V0_ENGINE_NVENC1, BIT_ULL(NVKM_ENGINE_NVENC1) },
354 { NVA06F_V0_ENGINE_CE0 , BIT_ULL(NVKM_ENGINE_CE0 ) },
355 { NVA06F_V0_ENGINE_CE1 , BIT_ULL(NVKM_ENGINE_CE1 ) },
356 { NVA06F_V0_ENGINE_CE2 , BIT_ULL(NVKM_ENGINE_CE2 ) },
357 {}
358};
359
360int
361gk104_fifo_gpfifo_new(struct nvkm_fifo *base, const struct nvkm_oclass *oclass,
362 void *data, u32 size, struct nvkm_object **pobject)
363{
364 struct nvkm_object *parent = oclass->parent;
365 union {
366 struct kepler_channel_gpfifo_a_v0 v0;
367 } *args = data;
368 struct gk104_fifo *fifo = gk104_fifo(base);
369 int ret = -ENOSYS;
370
371 nvif_ioctl(parent, "create channel gpfifo size %d\n", size);
372 if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
373 nvif_ioctl(parent, "create channel gpfifo vers %d vm %llx "
374 "ioffset %016llx ilength %08x engine %08x\n",
375 args->v0.version, args->v0.vm, args->v0.ioffset,
376 args->v0.ilength, args->v0.engines);
377 return gk104_fifo_gpfifo_new_(gk104_fifo_gpfifo, fifo,
378 &args->v0.engines,
379 &args->v0.chid,
380 args->v0.vm,
381 args->v0.ioffset,
382 args->v0.ilength,
383 oclass, pobject);
384
385 }
386
387 return ret;
388}
389
318const struct nvkm_fifo_chan_oclass 390const struct nvkm_fifo_chan_oclass
319gk104_fifo_gpfifo_oclass = { 391gk104_fifo_gpfifo_oclass = {
320 .base.oclass = KEPLER_CHANNEL_GPFIFO_A, 392 .base.oclass = KEPLER_CHANNEL_GPFIFO_A,
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogk110.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogk110.c
new file mode 100644
index 000000000000..a9aa69c82e8e
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogk110.c
@@ -0,0 +1,34 @@
1/*
2 * Copyright 2016 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#include "changk104.h"
25
26#include <nvif/class.h>
27
28const struct nvkm_fifo_chan_oclass
29gk110_fifo_gpfifo_oclass = {
30 .base.oclass = KEPLER_CHANNEL_GPFIFO_B,
31 .base.minver = 0,
32 .base.maxver = 0,
33 .ctor = gk104_fifo_gpfifo_new,
34};
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogm204.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogm200.c
index 6511d6e21ecc..a13315147391 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogm204.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogm200.c
@@ -26,7 +26,7 @@
26#include <nvif/class.h> 26#include <nvif/class.h>
27 27
28const struct nvkm_fifo_chan_oclass 28const struct nvkm_fifo_chan_oclass
29gm204_fifo_gpfifo_oclass = { 29gm200_fifo_gpfifo_oclass = {
30 .base.oclass = MAXWELL_CHANNEL_GPFIFO_A, 30 .base.oclass = MAXWELL_CHANNEL_GPFIFO_A,
31 .base.minver = 0, 31 .base.minver = 0,
32 .base.maxver = 0, 32 .base.maxver = 0,
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/Kbuild b/drivers/gpu/drm/nouveau/nvkm/engine/gr/Kbuild
index 9ad0d0e78a96..290ed0db8047 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/Kbuild
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/Kbuild
@@ -29,8 +29,7 @@ nvkm-y += nvkm/engine/gr/gk110b.o
29nvkm-y += nvkm/engine/gr/gk208.o 29nvkm-y += nvkm/engine/gr/gk208.o
30nvkm-y += nvkm/engine/gr/gk20a.o 30nvkm-y += nvkm/engine/gr/gk20a.o
31nvkm-y += nvkm/engine/gr/gm107.o 31nvkm-y += nvkm/engine/gr/gm107.o
32nvkm-y += nvkm/engine/gr/gm204.o 32nvkm-y += nvkm/engine/gr/gm200.o
33nvkm-y += nvkm/engine/gr/gm206.o
34nvkm-y += nvkm/engine/gr/gm20b.o 33nvkm-y += nvkm/engine/gr/gm20b.o
35 34
36nvkm-y += nvkm/engine/gr/ctxnv40.o 35nvkm-y += nvkm/engine/gr/ctxnv40.o
@@ -47,6 +46,5 @@ nvkm-y += nvkm/engine/gr/ctxgk110b.o
47nvkm-y += nvkm/engine/gr/ctxgk208.o 46nvkm-y += nvkm/engine/gr/ctxgk208.o
48nvkm-y += nvkm/engine/gr/ctxgk20a.o 47nvkm-y += nvkm/engine/gr/ctxgk20a.o
49nvkm-y += nvkm/engine/gr/ctxgm107.o 48nvkm-y += nvkm/engine/gr/ctxgm107.o
50nvkm-y += nvkm/engine/gr/ctxgm204.o 49nvkm-y += nvkm/engine/gr/ctxgm200.o
51nvkm-y += nvkm/engine/gr/ctxgm206.o
52nvkm-y += nvkm/engine/gr/ctxgm20b.o 50nvkm-y += nvkm/engine/gr/ctxgm20b.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.h
index 3c64040ec5a2..3c8673958f22 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.h
@@ -97,12 +97,11 @@ void gm107_grctx_generate_bundle(struct gf100_grctx *);
97void gm107_grctx_generate_pagepool(struct gf100_grctx *); 97void gm107_grctx_generate_pagepool(struct gf100_grctx *);
98void gm107_grctx_generate_attrib(struct gf100_grctx *); 98void gm107_grctx_generate_attrib(struct gf100_grctx *);
99 99
100extern const struct gf100_grctx_func gm204_grctx; 100extern const struct gf100_grctx_func gm200_grctx;
101void gm204_grctx_generate_main(struct gf100_gr *, struct gf100_grctx *); 101void gm200_grctx_generate_main(struct gf100_gr *, struct gf100_grctx *);
102void gm204_grctx_generate_tpcid(struct gf100_gr *); 102void gm200_grctx_generate_tpcid(struct gf100_gr *);
103void gm204_grctx_generate_405b60(struct gf100_gr *); 103void gm200_grctx_generate_405b60(struct gf100_gr *);
104 104
105extern const struct gf100_grctx_func gm206_grctx;
106extern const struct gf100_grctx_func gm20b_grctx; 105extern const struct gf100_grctx_func gm20b_grctx;
107 106
108/* context init value lists */ 107/* context init value lists */
@@ -210,19 +209,4 @@ extern const struct gf100_gr_init gk208_grctx_init_crstr_0[];
210 209
211extern const struct gf100_gr_init gm107_grctx_init_gpc_unk_0[]; 210extern const struct gf100_gr_init gm107_grctx_init_gpc_unk_0[];
212extern const struct gf100_gr_init gm107_grctx_init_wwdx_0[]; 211extern const struct gf100_gr_init gm107_grctx_init_wwdx_0[];
213
214extern const struct gf100_gr_pack gm204_grctx_pack_icmd[];
215
216extern const struct gf100_gr_pack gm204_grctx_pack_mthd[];
217
218extern const struct gf100_gr_pack gm204_grctx_pack_hub[];
219
220extern const struct gf100_gr_init gm204_grctx_init_prop_0[];
221extern const struct gf100_gr_init gm204_grctx_init_setup_0[];
222extern const struct gf100_gr_init gm204_grctx_init_gpm_0[];
223extern const struct gf100_gr_init gm204_grctx_init_gpc_unk_2[];
224
225extern const struct gf100_gr_pack gm204_grctx_pack_tpc[];
226
227extern const struct gf100_gr_pack gm204_grctx_pack_ppc[];
228#endif 212#endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm200.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm200.c
new file mode 100644
index 000000000000..e586699fc43f
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm200.c
@@ -0,0 +1,147 @@
1/*
2 * Copyright 2015 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#include "ctxgf100.h"
25
26/*******************************************************************************
27 * PGRAPH context implementation
28 ******************************************************************************/
29
30void
31gm200_grctx_generate_tpcid(struct gf100_gr *gr)
32{
33 struct nvkm_device *device = gr->base.engine.subdev.device;
34 int gpc, tpc, id;
35
36 for (tpc = 0, id = 0; tpc < 4; tpc++) {
37 for (gpc = 0; gpc < gr->gpc_nr; gpc++) {
38 if (tpc < gr->tpc_nr[gpc]) {
39 nvkm_wr32(device, TPC_UNIT(gpc, tpc, 0x698), id);
40 nvkm_wr32(device, GPC_UNIT(gpc, 0x0c10 + tpc * 4), id);
41 nvkm_wr32(device, TPC_UNIT(gpc, tpc, 0x088), id);
42 id++;
43 }
44 }
45 }
46}
47
48static void
49gm200_grctx_generate_rop_active_fbps(struct gf100_gr *gr)
50{
51 struct nvkm_device *device = gr->base.engine.subdev.device;
52 const u32 fbp_count = nvkm_rd32(device, 0x12006c);
53 nvkm_mask(device, 0x408850, 0x0000000f, fbp_count); /* zrop */
54 nvkm_mask(device, 0x408958, 0x0000000f, fbp_count); /* crop */
55}
56
57void
58gm200_grctx_generate_405b60(struct gf100_gr *gr)
59{
60 struct nvkm_device *device = gr->base.engine.subdev.device;
61 const u32 dist_nr = DIV_ROUND_UP(gr->tpc_total, 4);
62 u32 dist[TPC_MAX / 4] = {};
63 u32 gpcs[GPC_MAX] = {};
64 u8 tpcnr[GPC_MAX];
65 int tpc, gpc, i;
66
67 memcpy(tpcnr, gr->tpc_nr, sizeof(gr->tpc_nr));
68
69 /* won't result in the same distribution as the binary driver where
70 * some of the gpcs have more tpcs than others, but this shall do
71 * for the moment. the code for earlier gpus has this issue too.
72 */
73 for (gpc = -1, i = 0; i < gr->tpc_total; i++) {
74 do {
75 gpc = (gpc + 1) % gr->gpc_nr;
76 } while(!tpcnr[gpc]);
77 tpc = gr->tpc_nr[gpc] - tpcnr[gpc]--;
78
79 dist[i / 4] |= ((gpc << 4) | tpc) << ((i % 4) * 8);
80 gpcs[gpc] |= i << (tpc * 8);
81 }
82
83 for (i = 0; i < dist_nr; i++)
84 nvkm_wr32(device, 0x405b60 + (i * 4), dist[i]);
85 for (i = 0; i < gr->gpc_nr; i++)
86 nvkm_wr32(device, 0x405ba0 + (i * 4), gpcs[i]);
87}
88
89void
90gm200_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info)
91{
92 struct nvkm_device *device = gr->base.engine.subdev.device;
93 const struct gf100_grctx_func *grctx = gr->func->grctx;
94 u32 tmp;
95 int i;
96
97 gf100_gr_mmio(gr, gr->fuc_sw_ctx);
98
99 nvkm_wr32(device, 0x404154, 0x00000000);
100
101 grctx->bundle(info);
102 grctx->pagepool(info);
103 grctx->attrib(info);
104 grctx->unkn(gr);
105
106 gm200_grctx_generate_tpcid(gr);
107 gf100_grctx_generate_r406028(gr);
108 gk104_grctx_generate_r418bb8(gr);
109
110 for (i = 0; i < 8; i++)
111 nvkm_wr32(device, 0x4064d0 + (i * 0x04), 0x00000000);
112 nvkm_wr32(device, 0x406500, 0x00000000);
113
114 nvkm_wr32(device, 0x405b00, (gr->tpc_total << 8) | gr->gpc_nr);
115
116 gm200_grctx_generate_rop_active_fbps(gr);
117
118 for (tmp = 0, i = 0; i < gr->gpc_nr; i++)
119 tmp |= ((1 << gr->tpc_nr[i]) - 1) << (i * 4);
120 nvkm_wr32(device, 0x4041c4, tmp);
121
122 gm200_grctx_generate_405b60(gr);
123
124 gf100_gr_icmd(gr, gr->fuc_bundle);
125 nvkm_wr32(device, 0x404154, 0x00000800);
126 gf100_gr_mthd(gr, gr->fuc_method);
127
128 nvkm_mask(device, 0x418e94, 0xffffffff, 0xc4230000);
129 nvkm_mask(device, 0x418e4c, 0xffffffff, 0x70000000);
130}
131
132const struct gf100_grctx_func
133gm200_grctx = {
134 .main = gm200_grctx_generate_main,
135 .unkn = gk104_grctx_generate_unkn,
136 .bundle = gm107_grctx_generate_bundle,
137 .bundle_size = 0x3000,
138 .bundle_min_gpm_fifo_depth = 0x180,
139 .bundle_token_limit = 0x780,
140 .pagepool = gm107_grctx_generate_pagepool,
141 .pagepool_size = 0x20000,
142 .attrib = gm107_grctx_generate_attrib,
143 .attrib_nr_max = 0x600,
144 .attrib_nr = 0x400,
145 .alpha_nr_max = 0x1800,
146 .alpha_nr = 0x1000,
147};
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm204.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm204.c
deleted file mode 100644
index 170cbfdbe1ae..000000000000
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm204.c
+++ /dev/null
@@ -1,1049 +0,0 @@
1/*
2 * Copyright 2015 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#include "ctxgf100.h"
25
26/*******************************************************************************
27 * PGRAPH context register lists
28 ******************************************************************************/
29
30static const struct gf100_gr_init
31gm204_grctx_init_icmd_0[] = {
32 { 0x001000, 1, 0x01, 0x00000002 },
33 { 0x0006aa, 1, 0x01, 0x00000001 },
34 { 0x0006ad, 2, 0x01, 0x00000100 },
35 { 0x0006b1, 1, 0x01, 0x00000011 },
36 { 0x00078c, 1, 0x01, 0x00000008 },
37 { 0x000792, 1, 0x01, 0x00000001 },
38 { 0x000794, 3, 0x01, 0x00000001 },
39 { 0x000797, 1, 0x01, 0x000000cf },
40 { 0x00079a, 1, 0x01, 0x00000002 },
41 { 0x0007a1, 1, 0x01, 0x00000001 },
42 { 0x0007a3, 3, 0x01, 0x00000001 },
43 { 0x000831, 1, 0x01, 0x00000004 },
44 { 0x01e100, 1, 0x01, 0x00000001 },
45 { 0x001000, 1, 0x01, 0x00000008 },
46 { 0x000039, 3, 0x01, 0x00000000 },
47 { 0x000380, 1, 0x01, 0x00000001 },
48 { 0x000366, 2, 0x01, 0x00000000 },
49 { 0x000368, 1, 0x01, 0x00000fff },
50 { 0x000370, 2, 0x01, 0x00000000 },
51 { 0x000372, 1, 0x01, 0x000fffff },
52 { 0x000374, 1, 0x01, 0x00000100 },
53 { 0x000818, 8, 0x01, 0x00000000 },
54 { 0x000848, 16, 0x01, 0x00000000 },
55 { 0x000738, 1, 0x01, 0x00000000 },
56 { 0x000b07, 1, 0x01, 0x00000002 },
57 { 0x000b08, 2, 0x01, 0x00000100 },
58 { 0x000b0a, 1, 0x01, 0x00000001 },
59 { 0x000a04, 1, 0x01, 0x000000ff },
60 { 0x000a0b, 1, 0x01, 0x00000040 },
61 { 0x00097f, 1, 0x01, 0x00000100 },
62 { 0x000a02, 1, 0x01, 0x00000001 },
63 { 0x000809, 1, 0x01, 0x00000007 },
64 { 0x00c221, 1, 0x01, 0x00000040 },
65 { 0x00c401, 1, 0x01, 0x00000001 },
66 { 0x00c402, 1, 0x01, 0x00010001 },
67 { 0x00c403, 2, 0x01, 0x00000001 },
68 { 0x00c40e, 1, 0x01, 0x00000020 },
69 { 0x01e100, 1, 0x01, 0x00000001 },
70 { 0x001000, 1, 0x01, 0x00000001 },
71 { 0x000b07, 1, 0x01, 0x00000002 },
72 { 0x000b08, 2, 0x01, 0x00000100 },
73 { 0x000b0a, 1, 0x01, 0x00000001 },
74 { 0x01e100, 1, 0x01, 0x00000001 },
75 { 0x001000, 1, 0x01, 0x00000004 },
76 { 0x000039, 3, 0x01, 0x00000000 },
77 { 0x0000a9, 1, 0x01, 0x0000ffff },
78 { 0x000038, 1, 0x01, 0x0fac6881 },
79 { 0x00003d, 1, 0x01, 0x00000001 },
80 { 0x0000e8, 8, 0x01, 0x00000400 },
81 { 0x000078, 8, 0x01, 0x00000300 },
82 { 0x000050, 1, 0x01, 0x00000011 },
83 { 0x000058, 8, 0x01, 0x00000008 },
84 { 0x000208, 8, 0x01, 0x00000001 },
85 { 0x000081, 1, 0x01, 0x00000001 },
86 { 0x000085, 1, 0x01, 0x00000004 },
87 { 0x000088, 1, 0x01, 0x00000400 },
88 { 0x000090, 1, 0x01, 0x00000300 },
89 { 0x000098, 1, 0x01, 0x00001001 },
90 { 0x0000e3, 1, 0x01, 0x00000001 },
91 { 0x0000da, 1, 0x01, 0x00000001 },
92 { 0x0000b4, 4, 0x01, 0x88888888 },
93 { 0x0000f8, 1, 0x01, 0x00000003 },
94 { 0x0000fa, 1, 0x01, 0x00000001 },
95 { 0x0000b1, 2, 0x01, 0x00000001 },
96 { 0x00009f, 4, 0x01, 0x0000ffff },
97 { 0x0000a8, 1, 0x01, 0x0000ffff },
98 { 0x0000ad, 1, 0x01, 0x0000013e },
99 { 0x0000e1, 1, 0x01, 0x00000010 },
100 { 0x000290, 16, 0x01, 0x00000000 },
101 { 0x0003b0, 16, 0x01, 0x00000000 },
102 { 0x0002a0, 16, 0x01, 0x00000000 },
103 { 0x000420, 16, 0x01, 0x00000000 },
104 { 0x0002b0, 16, 0x01, 0x00000000 },
105 { 0x000430, 16, 0x01, 0x00000000 },
106 { 0x0002c0, 16, 0x01, 0x00000000 },
107 { 0x0004d0, 16, 0x01, 0x00000000 },
108 { 0x000720, 16, 0x01, 0x00000000 },
109 { 0x0008c0, 16, 0x01, 0x00000000 },
110 { 0x000890, 16, 0x01, 0x00000000 },
111 { 0x0008e0, 16, 0x01, 0x00000000 },
112 { 0x0008a0, 16, 0x01, 0x00000000 },
113 { 0x0008f0, 16, 0x01, 0x00000000 },
114 { 0x00094c, 1, 0x01, 0x000000ff },
115 { 0x00094d, 1, 0x01, 0xffffffff },
116 { 0x00094e, 1, 0x01, 0x00000002 },
117 { 0x0002f2, 2, 0x01, 0x00000001 },
118 { 0x0002f5, 1, 0x01, 0x00000001 },
119 { 0x0002f7, 1, 0x01, 0x00000001 },
120 { 0x000303, 1, 0x01, 0x00000001 },
121 { 0x0002e6, 1, 0x01, 0x00000001 },
122 { 0x000466, 1, 0x01, 0x00000052 },
123 { 0x000301, 1, 0x01, 0x3f800000 },
124 { 0x000304, 1, 0x01, 0x30201000 },
125 { 0x000305, 1, 0x01, 0x70605040 },
126 { 0x000306, 1, 0x01, 0xb8a89888 },
127 { 0x000307, 1, 0x01, 0xf8e8d8c8 },
128 { 0x00030a, 1, 0x01, 0x00ffff00 },
129 { 0x00030b, 1, 0x01, 0x0000001a },
130 { 0x00030c, 1, 0x01, 0x00000001 },
131 { 0x000318, 1, 0x01, 0x00000001 },
132 { 0x000340, 1, 0x01, 0x00000000 },
133 { 0x00037d, 1, 0x01, 0x00000006 },
134 { 0x0003a0, 1, 0x01, 0x00000002 },
135 { 0x0003aa, 1, 0x01, 0x00000001 },
136 { 0x0003a9, 1, 0x01, 0x00000001 },
137 { 0x000380, 1, 0x01, 0x00000001 },
138 { 0x000383, 1, 0x01, 0x00000011 },
139 { 0x000360, 1, 0x01, 0x00000040 },
140 { 0x000366, 2, 0x01, 0x00000000 },
141 { 0x000368, 1, 0x01, 0x00000fff },
142 { 0x000370, 2, 0x01, 0x00000000 },
143 { 0x000372, 1, 0x01, 0x000fffff },
144 { 0x000374, 1, 0x01, 0x00000100 },
145 { 0x00037a, 1, 0x01, 0x00000012 },
146 { 0x000619, 1, 0x01, 0x00000003 },
147 { 0x000811, 1, 0x01, 0x00000003 },
148 { 0x000812, 1, 0x01, 0x00000004 },
149 { 0x000813, 1, 0x01, 0x00000006 },
150 { 0x000814, 1, 0x01, 0x00000008 },
151 { 0x000815, 1, 0x01, 0x0000000b },
152 { 0x000800, 6, 0x01, 0x00000001 },
153 { 0x000632, 1, 0x01, 0x00000001 },
154 { 0x000633, 1, 0x01, 0x00000002 },
155 { 0x000634, 1, 0x01, 0x00000003 },
156 { 0x000635, 1, 0x01, 0x00000004 },
157 { 0x000654, 1, 0x01, 0x3f800000 },
158 { 0x000657, 1, 0x01, 0x3f800000 },
159 { 0x000655, 2, 0x01, 0x3f800000 },
160 { 0x0006cd, 1, 0x01, 0x3f800000 },
161 { 0x0007f5, 1, 0x01, 0x3f800000 },
162 { 0x0007dc, 1, 0x01, 0x39291909 },
163 { 0x0007dd, 1, 0x01, 0x79695949 },
164 { 0x0007de, 1, 0x01, 0xb9a99989 },
165 { 0x0007df, 1, 0x01, 0xf9e9d9c9 },
166 { 0x0007e8, 1, 0x01, 0x00003210 },
167 { 0x0007e9, 1, 0x01, 0x00007654 },
168 { 0x0007ea, 1, 0x01, 0x00000098 },
169 { 0x0007ec, 1, 0x01, 0x39291909 },
170 { 0x0007ed, 1, 0x01, 0x79695949 },
171 { 0x0007ee, 1, 0x01, 0xb9a99989 },
172 { 0x0007ef, 1, 0x01, 0xf9e9d9c9 },
173 { 0x0007f0, 1, 0x01, 0x00003210 },
174 { 0x0007f1, 1, 0x01, 0x00007654 },
175 { 0x0007f2, 1, 0x01, 0x00000098 },
176 { 0x0005a5, 1, 0x01, 0x00000001 },
177 { 0x0005aa, 1, 0x01, 0x00000002 },
178 { 0x0005cb, 1, 0x01, 0x00000004 },
179 { 0x0005d0, 1, 0x01, 0x20181008 },
180 { 0x0005d1, 1, 0x01, 0x40383028 },
181 { 0x0005d2, 1, 0x01, 0x60585048 },
182 { 0x0005d3, 1, 0x01, 0x80787068 },
183 { 0x000980, 128, 0x01, 0x00000000 },
184 { 0x000468, 1, 0x01, 0x00000004 },
185 { 0x00046c, 1, 0x01, 0x00000001 },
186 { 0x000470, 96, 0x01, 0x00000000 },
187 { 0x0005e0, 16, 0x01, 0x00000d10 },
188 { 0x000510, 16, 0x01, 0x3f800000 },
189 { 0x000520, 1, 0x01, 0x000002b6 },
190 { 0x000529, 1, 0x01, 0x00000001 },
191 { 0x000530, 16, 0x01, 0xffff0000 },
192 { 0x000550, 32, 0x01, 0xffff0000 },
193 { 0x000585, 1, 0x01, 0x0000003f },
194 { 0x000576, 1, 0x01, 0x00000003 },
195 { 0x00057b, 1, 0x01, 0x00000059 },
196 { 0x000586, 1, 0x01, 0x00000040 },
197 { 0x000582, 2, 0x01, 0x00000080 },
198 { 0x000595, 1, 0x01, 0x00400040 },
199 { 0x000596, 1, 0x01, 0x00000492 },
200 { 0x000597, 1, 0x01, 0x08080203 },
201 { 0x0005ad, 1, 0x01, 0x00000008 },
202 { 0x000598, 1, 0x01, 0x00020001 },
203 { 0x0005d4, 1, 0x01, 0x00000001 },
204 { 0x0005c2, 1, 0x01, 0x00000001 },
205 { 0x000638, 2, 0x01, 0x00000001 },
206 { 0x00063a, 1, 0x01, 0x00000002 },
207 { 0x00063b, 2, 0x01, 0x00000001 },
208 { 0x00063d, 1, 0x01, 0x00000002 },
209 { 0x00063e, 1, 0x01, 0x00000001 },
210 { 0x0008b8, 8, 0x01, 0x00000001 },
211 { 0x000900, 8, 0x01, 0x00000001 },
212 { 0x000908, 8, 0x01, 0x00000002 },
213 { 0x000910, 16, 0x01, 0x00000001 },
214 { 0x000920, 8, 0x01, 0x00000002 },
215 { 0x000928, 8, 0x01, 0x00000001 },
216 { 0x000662, 1, 0x01, 0x00000001 },
217 { 0x000648, 9, 0x01, 0x00000001 },
218 { 0x000674, 1, 0x01, 0x00000001 },
219 { 0x000658, 1, 0x01, 0x0000000f },
220 { 0x0007ff, 1, 0x01, 0x0000000a },
221 { 0x00066a, 1, 0x01, 0x40000000 },
222 { 0x00066b, 1, 0x01, 0x10000000 },
223 { 0x00066c, 2, 0x01, 0xffff0000 },
224 { 0x0007af, 2, 0x01, 0x00000008 },
225 { 0x0007f6, 1, 0x01, 0x00000001 },
226 { 0x0006b2, 1, 0x01, 0x00000055 },
227 { 0x0007ad, 1, 0x01, 0x00000003 },
228 { 0x000971, 1, 0x01, 0x00000008 },
229 { 0x000972, 1, 0x01, 0x00000040 },
230 { 0x000973, 1, 0x01, 0x0000012c },
231 { 0x00097c, 1, 0x01, 0x00000040 },
232 { 0x000975, 1, 0x01, 0x00000020 },
233 { 0x000976, 1, 0x01, 0x00000001 },
234 { 0x000977, 1, 0x01, 0x00000020 },
235 { 0x000978, 1, 0x01, 0x00000001 },
236 { 0x000957, 1, 0x01, 0x00000003 },
237 { 0x00095e, 1, 0x01, 0x20164010 },
238 { 0x00095f, 1, 0x01, 0x00000020 },
239 { 0x000a0d, 1, 0x01, 0x00000006 },
240 { 0x00097d, 1, 0x01, 0x0000000c },
241 { 0x000683, 1, 0x01, 0x00000006 },
242 { 0x000687, 1, 0x01, 0x003fffff },
243 { 0x0006a0, 1, 0x01, 0x00000005 },
244 { 0x000840, 1, 0x01, 0x00400008 },
245 { 0x000841, 1, 0x01, 0x08000080 },
246 { 0x000842, 1, 0x01, 0x00400008 },
247 { 0x000843, 1, 0x01, 0x08000080 },
248 { 0x000818, 8, 0x01, 0x00000000 },
249 { 0x000848, 16, 0x01, 0x00000000 },
250 { 0x000738, 1, 0x01, 0x00000000 },
251 { 0x0006aa, 1, 0x01, 0x00000001 },
252 { 0x0006ab, 1, 0x01, 0x00000002 },
253 { 0x0006ac, 1, 0x01, 0x00000080 },
254 { 0x0006ad, 2, 0x01, 0x00000100 },
255 { 0x0006b1, 1, 0x01, 0x00000011 },
256 { 0x0006bb, 1, 0x01, 0x000000cf },
257 { 0x0006ce, 1, 0x01, 0x2a712488 },
258 { 0x000739, 1, 0x01, 0x4085c000 },
259 { 0x00073a, 1, 0x01, 0x00000080 },
260 { 0x000786, 1, 0x01, 0x80000100 },
261 { 0x00073c, 1, 0x01, 0x00010100 },
262 { 0x00073d, 1, 0x01, 0x02800000 },
263 { 0x000787, 1, 0x01, 0x000000cf },
264 { 0x00078c, 1, 0x01, 0x00000008 },
265 { 0x000792, 1, 0x01, 0x00000001 },
266 { 0x000794, 3, 0x01, 0x00000001 },
267 { 0x000797, 1, 0x01, 0x000000cf },
268 { 0x000836, 1, 0x01, 0x00000001 },
269 { 0x00079a, 1, 0x01, 0x00000002 },
270 { 0x000833, 1, 0x01, 0x04444480 },
271 { 0x0007a1, 1, 0x01, 0x00000001 },
272 { 0x0007a3, 3, 0x01, 0x00000001 },
273 { 0x000831, 1, 0x01, 0x00000004 },
274 { 0x000b07, 1, 0x01, 0x00000002 },
275 { 0x000b08, 2, 0x01, 0x00000100 },
276 { 0x000b0a, 1, 0x01, 0x00000001 },
277 { 0x000a04, 1, 0x01, 0x000000ff },
278 { 0x000a0b, 1, 0x01, 0x00000040 },
279 { 0x00097f, 1, 0x01, 0x00000100 },
280 { 0x000a02, 1, 0x01, 0x00000001 },
281 { 0x000809, 1, 0x01, 0x00000007 },
282 { 0x00c221, 1, 0x01, 0x00000040 },
283 { 0x00c1b0, 8, 0x01, 0x0000000f },
284 { 0x00c1b8, 1, 0x01, 0x0fac6881 },
285 { 0x00c1b9, 1, 0x01, 0x00fac688 },
286 { 0x00c401, 1, 0x01, 0x00000001 },
287 { 0x00c402, 1, 0x01, 0x00010001 },
288 { 0x00c403, 2, 0x01, 0x00000001 },
289 { 0x00c40e, 1, 0x01, 0x00000020 },
290 { 0x00c413, 4, 0x01, 0x88888888 },
291 { 0x00c423, 1, 0x01, 0x0000ff00 },
292 { 0x00c420, 1, 0x01, 0x00880101 },
293 { 0x01e100, 1, 0x01, 0x00000001 },
294 {}
295};
296
297const struct gf100_gr_pack
298gm204_grctx_pack_icmd[] = {
299 { gm204_grctx_init_icmd_0 },
300 {}
301};
302
303static const struct gf100_gr_init
304gm204_grctx_init_b197_0[] = {
305 { 0x000800, 8, 0x40, 0x00000000 },
306 { 0x000804, 8, 0x40, 0x00000000 },
307 { 0x000808, 8, 0x40, 0x00000400 },
308 { 0x00080c, 8, 0x40, 0x00000300 },
309 { 0x000810, 1, 0x04, 0x000000cf },
310 { 0x000850, 7, 0x40, 0x00000000 },
311 { 0x000814, 8, 0x40, 0x00000040 },
312 { 0x000818, 8, 0x40, 0x00000001 },
313 { 0x00081c, 8, 0x40, 0x00000000 },
314 { 0x000820, 8, 0x40, 0x00000000 },
315 { 0x001c00, 16, 0x10, 0x00000000 },
316 { 0x001c04, 16, 0x10, 0x00000000 },
317 { 0x001c08, 16, 0x10, 0x00000000 },
318 { 0x001c0c, 16, 0x10, 0x00000000 },
319 { 0x001d00, 16, 0x10, 0x00000000 },
320 { 0x001d04, 16, 0x10, 0x00000000 },
321 { 0x001d08, 16, 0x10, 0x00000000 },
322 { 0x001d0c, 16, 0x10, 0x00000000 },
323 { 0x001f00, 16, 0x08, 0x00000000 },
324 { 0x001f04, 16, 0x08, 0x00000000 },
325 { 0x001f80, 16, 0x08, 0x00000000 },
326 { 0x001f84, 16, 0x08, 0x00000000 },
327 { 0x002000, 1, 0x04, 0x00000000 },
328 { 0x002040, 1, 0x04, 0x00000011 },
329 { 0x002080, 1, 0x04, 0x00000020 },
330 { 0x0020c0, 1, 0x04, 0x00000030 },
331 { 0x002100, 1, 0x04, 0x00000040 },
332 { 0x002140, 1, 0x04, 0x00000051 },
333 { 0x00200c, 6, 0x40, 0x00000001 },
334 { 0x002010, 1, 0x04, 0x00000000 },
335 { 0x002050, 1, 0x04, 0x00000000 },
336 { 0x002090, 1, 0x04, 0x00000001 },
337 { 0x0020d0, 1, 0x04, 0x00000002 },
338 { 0x002110, 1, 0x04, 0x00000003 },
339 { 0x002150, 1, 0x04, 0x00000004 },
340 { 0x000380, 4, 0x20, 0x00000000 },
341 { 0x000384, 4, 0x20, 0x00000000 },
342 { 0x000388, 4, 0x20, 0x00000000 },
343 { 0x00038c, 4, 0x20, 0x00000000 },
344 { 0x000700, 4, 0x10, 0x00000000 },
345 { 0x000704, 4, 0x10, 0x00000000 },
346 { 0x000708, 4, 0x10, 0x00000000 },
347 { 0x002800, 128, 0x04, 0x00000000 },
348 { 0x000a00, 16, 0x20, 0x00000000 },
349 { 0x000a04, 16, 0x20, 0x00000000 },
350 { 0x000a08, 16, 0x20, 0x00000000 },
351 { 0x000a0c, 16, 0x20, 0x00000000 },
352 { 0x000a10, 16, 0x20, 0x00000000 },
353 { 0x000a14, 16, 0x20, 0x00000000 },
354 { 0x000a18, 16, 0x20, 0x00006420 },
355 { 0x000a1c, 16, 0x20, 0x00000000 },
356 { 0x000c00, 16, 0x10, 0x00000000 },
357 { 0x000c04, 16, 0x10, 0x00000000 },
358 { 0x000c08, 16, 0x10, 0x00000000 },
359 { 0x000c0c, 16, 0x10, 0x3f800000 },
360 { 0x000d00, 8, 0x08, 0xffff0000 },
361 { 0x000d04, 8, 0x08, 0xffff0000 },
362 { 0x000e00, 16, 0x10, 0x00000000 },
363 { 0x000e04, 16, 0x10, 0xffff0000 },
364 { 0x000e08, 16, 0x10, 0xffff0000 },
365 { 0x000d40, 4, 0x08, 0x00000000 },
366 { 0x000d44, 4, 0x08, 0x00000000 },
367 { 0x001e00, 8, 0x20, 0x00000001 },
368 { 0x001e04, 8, 0x20, 0x00000001 },
369 { 0x001e08, 8, 0x20, 0x00000002 },
370 { 0x001e0c, 8, 0x20, 0x00000001 },
371 { 0x001e10, 8, 0x20, 0x00000001 },
372 { 0x001e14, 8, 0x20, 0x00000002 },
373 { 0x001e18, 8, 0x20, 0x00000001 },
374 { 0x001480, 8, 0x10, 0x00000000 },
375 { 0x001484, 8, 0x10, 0x00000000 },
376 { 0x001488, 8, 0x10, 0x00000000 },
377 { 0x003400, 128, 0x04, 0x00000000 },
378 { 0x00030c, 1, 0x04, 0x00000001 },
379 { 0x001944, 1, 0x04, 0x00000000 },
380 { 0x001514, 1, 0x04, 0x00000000 },
381 { 0x000d68, 1, 0x04, 0x0000ffff },
382 { 0x00121c, 1, 0x04, 0x0fac6881 },
383 { 0x000fac, 1, 0x04, 0x00000001 },
384 { 0x001538, 1, 0x04, 0x00000001 },
385 { 0x000fe0, 2, 0x04, 0x00000000 },
386 { 0x000fe8, 1, 0x04, 0x00000014 },
387 { 0x000fec, 1, 0x04, 0x00000040 },
388 { 0x000ff0, 1, 0x04, 0x00000000 },
389 { 0x00179c, 1, 0x04, 0x00000000 },
390 { 0x001228, 1, 0x04, 0x00000400 },
391 { 0x00122c, 1, 0x04, 0x00000300 },
392 { 0x001230, 1, 0x04, 0x00010001 },
393 { 0x0007f8, 1, 0x04, 0x00000000 },
394 { 0x001208, 1, 0x04, 0x00000000 },
395 { 0x0015b4, 1, 0x04, 0x00000001 },
396 { 0x0015cc, 1, 0x04, 0x00000000 },
397 { 0x001534, 1, 0x04, 0x00000000 },
398 { 0x000754, 1, 0x04, 0x00000001 },
399 { 0x000fb0, 1, 0x04, 0x00000000 },
400 { 0x0015d0, 1, 0x04, 0x00000000 },
401 { 0x0011e0, 4, 0x04, 0x88888888 },
402 { 0x00153c, 1, 0x04, 0x00000000 },
403 { 0x0016b4, 1, 0x04, 0x00000003 },
404 { 0x000fa4, 1, 0x04, 0x00000001 },
405 { 0x000fbc, 4, 0x04, 0x0000ffff },
406 { 0x000fa8, 1, 0x04, 0x0000ffff },
407 { 0x000df8, 2, 0x04, 0x00000000 },
408 { 0x001948, 1, 0x04, 0x00000000 },
409 { 0x001970, 1, 0x04, 0x00000001 },
410 { 0x00161c, 1, 0x04, 0x000009f0 },
411 { 0x000dcc, 1, 0x04, 0x00000010 },
412 { 0x0015e4, 1, 0x04, 0x00000000 },
413 { 0x001160, 32, 0x04, 0x25e00040 },
414 { 0x001880, 32, 0x04, 0x00000000 },
415 { 0x000f84, 2, 0x04, 0x00000000 },
416 { 0x0017c8, 2, 0x04, 0x00000000 },
417 { 0x0017d0, 1, 0x04, 0x000000ff },
418 { 0x0017d4, 1, 0x04, 0xffffffff },
419 { 0x0017d8, 1, 0x04, 0x00000002 },
420 { 0x0017dc, 1, 0x04, 0x00000000 },
421 { 0x0015f4, 2, 0x04, 0x00000000 },
422 { 0x001434, 2, 0x04, 0x00000000 },
423 { 0x000d74, 1, 0x04, 0x00000000 },
424 { 0x0013a4, 1, 0x04, 0x00000000 },
425 { 0x001318, 1, 0x04, 0x00000001 },
426 { 0x001080, 2, 0x04, 0x00000000 },
427 { 0x001088, 2, 0x04, 0x00000001 },
428 { 0x001090, 1, 0x04, 0x00000000 },
429 { 0x001094, 1, 0x04, 0x00000001 },
430 { 0x001098, 1, 0x04, 0x00000000 },
431 { 0x00109c, 1, 0x04, 0x00000001 },
432 { 0x0010a0, 2, 0x04, 0x00000000 },
433 { 0x001644, 1, 0x04, 0x00000000 },
434 { 0x000748, 1, 0x04, 0x00000000 },
435 { 0x000de8, 1, 0x04, 0x00000000 },
436 { 0x001648, 1, 0x04, 0x00000000 },
437 { 0x0012a4, 1, 0x04, 0x00000000 },
438 { 0x001120, 4, 0x04, 0x00000000 },
439 { 0x001118, 1, 0x04, 0x00000000 },
440 { 0x00164c, 1, 0x04, 0x00000000 },
441 { 0x001658, 1, 0x04, 0x00000000 },
442 { 0x001910, 1, 0x04, 0x00000290 },
443 { 0x001518, 1, 0x04, 0x00000000 },
444 { 0x00165c, 1, 0x04, 0x00000001 },
445 { 0x001520, 1, 0x04, 0x00000000 },
446 { 0x001604, 1, 0x04, 0x00000000 },
447 { 0x001570, 1, 0x04, 0x00000000 },
448 { 0x0013b0, 2, 0x04, 0x3f800000 },
449 { 0x00020c, 1, 0x04, 0x00000000 },
450 { 0x001670, 1, 0x04, 0x30201000 },
451 { 0x001674, 1, 0x04, 0x70605040 },
452 { 0x001678, 1, 0x04, 0xb8a89888 },
453 { 0x00167c, 1, 0x04, 0xf8e8d8c8 },
454 { 0x00166c, 1, 0x04, 0x00000000 },
455 { 0x001680, 1, 0x04, 0x00ffff00 },
456 { 0x0012d0, 1, 0x04, 0x00000003 },
457 { 0x00113c, 1, 0x04, 0x00000000 },
458 { 0x0012d4, 1, 0x04, 0x00000002 },
459 { 0x001684, 2, 0x04, 0x00000000 },
460 { 0x000dac, 2, 0x04, 0x00001b02 },
461 { 0x000db4, 1, 0x04, 0x00000000 },
462 { 0x00168c, 1, 0x04, 0x00000000 },
463 { 0x0015bc, 1, 0x04, 0x00000000 },
464 { 0x00156c, 1, 0x04, 0x00000000 },
465 { 0x00187c, 1, 0x04, 0x00000000 },
466 { 0x001110, 1, 0x04, 0x00000001 },
467 { 0x000dc0, 3, 0x04, 0x00000000 },
468 { 0x000f40, 5, 0x04, 0x00000000 },
469 { 0x001234, 1, 0x04, 0x00000000 },
470 { 0x001690, 1, 0x04, 0x00000000 },
471 { 0x000790, 5, 0x04, 0x00000000 },
472 { 0x00077c, 1, 0x04, 0x00000000 },
473 { 0x001000, 1, 0x04, 0x00000010 },
474 { 0x0010fc, 1, 0x04, 0x00000000 },
475 { 0x001290, 1, 0x04, 0x00000000 },
476 { 0x000218, 1, 0x04, 0x00000010 },
477 { 0x0012d8, 1, 0x04, 0x00000000 },
478 { 0x0012dc, 1, 0x04, 0x00000010 },
479 { 0x000d94, 1, 0x04, 0x00000001 },
480 { 0x00155c, 2, 0x04, 0x00000000 },
481 { 0x001564, 1, 0x04, 0x00000fff },
482 { 0x001574, 2, 0x04, 0x00000000 },
483 { 0x00157c, 1, 0x04, 0x000fffff },
484 { 0x001354, 1, 0x04, 0x00000000 },
485 { 0x001610, 1, 0x04, 0x00000012 },
486 { 0x001608, 2, 0x04, 0x00000000 },
487 { 0x00260c, 1, 0x04, 0x00000000 },
488 { 0x0007ac, 1, 0x04, 0x00000000 },
489 { 0x00162c, 1, 0x04, 0x00000003 },
490 { 0x000210, 1, 0x04, 0x00000000 },
491 { 0x000320, 1, 0x04, 0x00000000 },
492 { 0x000324, 6, 0x04, 0x3f800000 },
493 { 0x000750, 1, 0x04, 0x00000000 },
494 { 0x000760, 1, 0x04, 0x39291909 },
495 { 0x000764, 1, 0x04, 0x79695949 },
496 { 0x000768, 1, 0x04, 0xb9a99989 },
497 { 0x00076c, 1, 0x04, 0xf9e9d9c9 },
498 { 0x000770, 1, 0x04, 0x30201000 },
499 { 0x000774, 1, 0x04, 0x70605040 },
500 { 0x000778, 1, 0x04, 0x00009080 },
501 { 0x000780, 1, 0x04, 0x39291909 },
502 { 0x000784, 1, 0x04, 0x79695949 },
503 { 0x000788, 1, 0x04, 0xb9a99989 },
504 { 0x00078c, 1, 0x04, 0xf9e9d9c9 },
505 { 0x0007d0, 1, 0x04, 0x30201000 },
506 { 0x0007d4, 1, 0x04, 0x70605040 },
507 { 0x0007d8, 1, 0x04, 0x00009080 },
508 { 0x001004, 1, 0x04, 0x00000000 },
509 { 0x001240, 8, 0x04, 0x00000000 },
510 { 0x00037c, 1, 0x04, 0x00000001 },
511 { 0x000740, 1, 0x04, 0x00000000 },
512 { 0x001148, 1, 0x04, 0x00000000 },
513 { 0x000fb4, 1, 0x04, 0x00000000 },
514 { 0x000fb8, 1, 0x04, 0x00000002 },
515 { 0x001130, 1, 0x04, 0x00000002 },
516 { 0x000fd4, 2, 0x04, 0x00000000 },
517 { 0x001030, 1, 0x04, 0x20181008 },
518 { 0x001034, 1, 0x04, 0x40383028 },
519 { 0x001038, 1, 0x04, 0x60585048 },
520 { 0x00103c, 1, 0x04, 0x80787068 },
521 { 0x000744, 1, 0x04, 0x00000000 },
522 { 0x002600, 1, 0x04, 0x00000000 },
523 { 0x001918, 1, 0x04, 0x00000000 },
524 { 0x00191c, 1, 0x04, 0x00000900 },
525 { 0x001920, 1, 0x04, 0x00000405 },
526 { 0x001308, 1, 0x04, 0x00000001 },
527 { 0x001924, 1, 0x04, 0x00000000 },
528 { 0x0013ac, 1, 0x04, 0x00000000 },
529 { 0x00192c, 1, 0x04, 0x00000001 },
530 { 0x00193c, 1, 0x04, 0x00002c1c },
531 { 0x000d7c, 1, 0x04, 0x00000000 },
532 { 0x000f8c, 1, 0x04, 0x00000000 },
533 { 0x0002c0, 1, 0x04, 0x00000001 },
534 { 0x001510, 1, 0x04, 0x00000000 },
535 { 0x001940, 1, 0x04, 0x00000000 },
536 { 0x000ff4, 2, 0x04, 0x00000000 },
537 { 0x00194c, 2, 0x04, 0x00000000 },
538 { 0x001968, 1, 0x04, 0x00000000 },
539 { 0x001590, 1, 0x04, 0x0000003f },
540 { 0x0007e8, 4, 0x04, 0x00000000 },
541 { 0x00196c, 1, 0x04, 0x00000011 },
542 { 0x0002e4, 1, 0x04, 0x0000b001 },
543 { 0x00036c, 2, 0x04, 0x00000000 },
544 { 0x00197c, 1, 0x04, 0x00000000 },
545 { 0x000fcc, 2, 0x04, 0x00000000 },
546 { 0x0002d8, 1, 0x04, 0x00000040 },
547 { 0x001980, 1, 0x04, 0x00000080 },
548 { 0x001504, 1, 0x04, 0x00000080 },
549 { 0x001984, 1, 0x04, 0x00000000 },
550 { 0x000f60, 1, 0x04, 0x00000000 },
551 { 0x000f64, 1, 0x04, 0x00400040 },
552 { 0x000f68, 1, 0x04, 0x00002212 },
553 { 0x000f6c, 1, 0x04, 0x08080203 },
554 { 0x001108, 1, 0x04, 0x00000008 },
555 { 0x000f70, 1, 0x04, 0x00080001 },
556 { 0x000ffc, 1, 0x04, 0x00000000 },
557 { 0x001134, 1, 0x04, 0x00000000 },
558 { 0x000f1c, 1, 0x04, 0x00000000 },
559 { 0x0011f8, 1, 0x04, 0x00000000 },
560 { 0x001138, 1, 0x04, 0x00000001 },
561 { 0x000300, 1, 0x04, 0x00000001 },
562 { 0x0013a8, 1, 0x04, 0x00000000 },
563 { 0x001224, 1, 0x04, 0x00000000 },
564 { 0x0012ec, 1, 0x04, 0x00000000 },
565 { 0x001310, 1, 0x04, 0x00000000 },
566 { 0x001314, 1, 0x04, 0x00000001 },
567 { 0x001380, 1, 0x04, 0x00000000 },
568 { 0x001384, 4, 0x04, 0x00000001 },
569 { 0x001394, 1, 0x04, 0x00000000 },
570 { 0x00139c, 1, 0x04, 0x00000000 },
571 { 0x001398, 1, 0x04, 0x00000000 },
572 { 0x001594, 1, 0x04, 0x00000000 },
573 { 0x001598, 4, 0x04, 0x00000001 },
574 { 0x000f54, 3, 0x04, 0x00000000 },
575 { 0x0019bc, 1, 0x04, 0x00000000 },
576 { 0x000f9c, 2, 0x04, 0x00000000 },
577 { 0x0012cc, 1, 0x04, 0x00000000 },
578 { 0x0012e8, 1, 0x04, 0x00000000 },
579 { 0x00130c, 1, 0x04, 0x00000001 },
580 { 0x001360, 8, 0x04, 0x00000000 },
581 { 0x00133c, 2, 0x04, 0x00000001 },
582 { 0x001344, 1, 0x04, 0x00000002 },
583 { 0x001348, 2, 0x04, 0x00000001 },
584 { 0x001350, 1, 0x04, 0x00000002 },
585 { 0x001358, 1, 0x04, 0x00000001 },
586 { 0x0012e4, 1, 0x04, 0x00000000 },
587 { 0x00131c, 4, 0x04, 0x00000000 },
588 { 0x0019c0, 1, 0x04, 0x00000000 },
589 { 0x001140, 1, 0x04, 0x00000000 },
590 { 0x000dd0, 1, 0x04, 0x00000000 },
591 { 0x000dd4, 1, 0x04, 0x00000001 },
592 { 0x0002f4, 1, 0x04, 0x00000000 },
593 { 0x0019c4, 1, 0x04, 0x00000000 },
594 { 0x0019c8, 1, 0x04, 0x00001500 },
595 { 0x00135c, 1, 0x04, 0x00000000 },
596 { 0x000f90, 1, 0x04, 0x00000000 },
597 { 0x0019e0, 8, 0x04, 0x00000001 },
598 { 0x0019cc, 1, 0x04, 0x00000001 },
599 { 0x00111c, 1, 0x04, 0x00000001 },
600 { 0x0015b8, 1, 0x04, 0x00000000 },
601 { 0x001a00, 1, 0x04, 0x00001111 },
602 { 0x001a04, 7, 0x04, 0x00000000 },
603 { 0x000d6c, 2, 0x04, 0xffff0000 },
604 { 0x0010f8, 1, 0x04, 0x00001010 },
605 { 0x000d80, 5, 0x04, 0x00000000 },
606 { 0x000da0, 1, 0x04, 0x00000000 },
607 { 0x0007a4, 2, 0x04, 0x00000000 },
608 { 0x001508, 1, 0x04, 0x80000000 },
609 { 0x00150c, 1, 0x04, 0x40000000 },
610 { 0x001668, 1, 0x04, 0x00000000 },
611 { 0x000318, 2, 0x04, 0x00000008 },
612 { 0x000d9c, 1, 0x04, 0x00000001 },
613 { 0x000f14, 1, 0x04, 0x00000000 },
614 { 0x000374, 1, 0x04, 0x00000000 },
615 { 0x000378, 1, 0x04, 0x0000000c },
616 { 0x0007dc, 1, 0x04, 0x00000000 },
617 { 0x00074c, 1, 0x04, 0x00000055 },
618 { 0x001420, 1, 0x04, 0x00000003 },
619 { 0x001008, 1, 0x04, 0x00000008 },
620 { 0x00100c, 1, 0x04, 0x00000040 },
621 { 0x001010, 1, 0x04, 0x0000012c },
622 { 0x000d60, 1, 0x04, 0x00000040 },
623 { 0x001018, 1, 0x04, 0x00000020 },
624 { 0x00101c, 1, 0x04, 0x00000001 },
625 { 0x001020, 1, 0x04, 0x00000020 },
626 { 0x001024, 1, 0x04, 0x00000001 },
627 { 0x001444, 3, 0x04, 0x00000000 },
628 { 0x000360, 1, 0x04, 0x20164010 },
629 { 0x000364, 1, 0x04, 0x00000020 },
630 { 0x000368, 1, 0x04, 0x00000000 },
631 { 0x000da8, 1, 0x04, 0x00000030 },
632 { 0x000de4, 1, 0x04, 0x00000000 },
633 { 0x000204, 1, 0x04, 0x00000006 },
634 { 0x0002d0, 1, 0x04, 0x003fffff },
635 { 0x001220, 1, 0x04, 0x00000005 },
636 { 0x000fdc, 1, 0x04, 0x00000000 },
637 { 0x000f98, 1, 0x04, 0x00400008 },
638 { 0x001284, 1, 0x04, 0x08000080 },
639 { 0x001450, 1, 0x04, 0x00400008 },
640 { 0x001454, 1, 0x04, 0x08000080 },
641 { 0x000214, 1, 0x04, 0x00000000 },
642 {}
643};
644
645const struct gf100_gr_pack
646gm204_grctx_pack_mthd[] = {
647 { gm204_grctx_init_b197_0, 0xb197 },
648 { gf100_grctx_init_902d_0, 0x902d },
649 {}
650};
651
652static const struct gf100_gr_init
653gm204_grctx_init_fe_0[] = {
654 { 0x404004, 8, 0x04, 0x00000000 },
655 { 0x404024, 1, 0x04, 0x0000e000 },
656 { 0x404028, 8, 0x04, 0x00000000 },
657 { 0x4040a8, 8, 0x04, 0x00000000 },
658 { 0x4040c8, 1, 0x04, 0xf801008f },
659 { 0x4040d0, 6, 0x04, 0x00000000 },
660 { 0x4040f8, 1, 0x04, 0x00000000 },
661 { 0x404100, 10, 0x04, 0x00000000 },
662 { 0x404130, 2, 0x04, 0x00000000 },
663 { 0x404150, 1, 0x04, 0x0000002e },
664 { 0x404154, 2, 0x04, 0x00000800 },
665 { 0x404164, 1, 0x04, 0x00000045 },
666 { 0x40417c, 2, 0x04, 0x00000000 },
667 { 0x404194, 1, 0x04, 0x33000700 },
668 { 0x4041a0, 4, 0x04, 0x00000000 },
669 { 0x4041c4, 2, 0x04, 0x00000000 },
670 {}
671};
672
673static const struct gf100_gr_init
674gm204_grctx_init_ds_0[] = {
675 { 0x405800, 1, 0x04, 0x8f8001bf },
676 { 0x405830, 1, 0x04, 0x04001000 },
677 { 0x405834, 1, 0x04, 0x08000000 },
678 { 0x405838, 1, 0x04, 0x00010000 },
679 { 0x405854, 1, 0x04, 0x00000000 },
680 { 0x405870, 4, 0x04, 0x00000001 },
681 { 0x405a00, 2, 0x04, 0x00000000 },
682 { 0x405a18, 1, 0x04, 0x00000000 },
683 { 0x405a1c, 1, 0x04, 0x000000ff },
684 {}
685};
686
687static const struct gf100_gr_init
688gm204_grctx_init_cwd_0[] = {
689 { 0x405b00, 1, 0x04, 0x00000000 },
690 { 0x405b10, 1, 0x04, 0x00001000 },
691 { 0x405b20, 1, 0x04, 0x04000000 },
692 { 0x405b60, 6, 0x04, 0x00000000 },
693 { 0x405ba0, 6, 0x04, 0x00000000 },
694 {}
695};
696
697static const struct gf100_gr_init
698gm204_grctx_init_pd_0[] = {
699 { 0x406020, 1, 0x04, 0x17410001 },
700 { 0x406028, 4, 0x04, 0x00000001 },
701 { 0x4064a8, 1, 0x04, 0x00000000 },
702 { 0x4064ac, 1, 0x04, 0x00003fff },
703 { 0x4064b0, 3, 0x04, 0x00000000 },
704 { 0x4064c0, 1, 0x04, 0x80400280 },
705 { 0x4064c4, 1, 0x04, 0x0400ffff },
706 { 0x4064c8, 1, 0x04, 0x01800780 },
707 { 0x4064cc, 9, 0x04, 0x00000000 },
708 { 0x4064fc, 1, 0x04, 0x0000022a },
709 { 0x406500, 1, 0x04, 0x00000000 },
710 {}
711};
712
713static const struct gf100_gr_init
714gm204_grctx_init_be_0[] = {
715 { 0x408800, 1, 0x04, 0x32882a3c },
716 { 0x408804, 1, 0x04, 0x00000040 },
717 { 0x408808, 1, 0x04, 0x1003e005 },
718 { 0x408840, 1, 0x04, 0x00000e0b },
719 { 0x408900, 1, 0x04, 0xb080b801 },
720 { 0x408904, 1, 0x04, 0x63038001 },
721 { 0x408908, 1, 0x04, 0x12c8502f },
722 { 0x408980, 1, 0x04, 0x0000011d },
723 {}
724};
725
726const struct gf100_gr_pack
727gm204_grctx_pack_hub[] = {
728 { gf100_grctx_init_main_0 },
729 { gm204_grctx_init_fe_0 },
730 { gk110_grctx_init_pri_0 },
731 { gk104_grctx_init_memfmt_0 },
732 { gm204_grctx_init_ds_0 },
733 { gm204_grctx_init_cwd_0 },
734 { gm204_grctx_init_pd_0 },
735 { gk208_grctx_init_rstr2d_0 },
736 { gk104_grctx_init_scc_0 },
737 { gm204_grctx_init_be_0 },
738 {}
739};
740
741const struct gf100_gr_init
742gm204_grctx_init_prop_0[] = {
743 { 0x418400, 1, 0x04, 0x38e01e00 },
744 { 0x418404, 1, 0x04, 0x70001fff },
745 { 0x41840c, 1, 0x04, 0x20001008 },
746 { 0x418410, 2, 0x04, 0x0fff0fff },
747 { 0x418418, 1, 0x04, 0x07ff07ff },
748 { 0x41841c, 1, 0x04, 0x3feffbff },
749 { 0x418450, 6, 0x04, 0x00000000 },
750 { 0x418468, 1, 0x04, 0x00000001 },
751 { 0x41846c, 2, 0x04, 0x00000000 },
752 {}
753};
754
755static const struct gf100_gr_init
756gm204_grctx_init_gpc_unk_1[] = {
757 { 0x418600, 1, 0x04, 0x0000007f },
758 { 0x418684, 1, 0x04, 0x0000001f },
759 { 0x418700, 1, 0x04, 0x00000002 },
760 { 0x418704, 1, 0x04, 0x00000080 },
761 { 0x418708, 1, 0x04, 0x40000000 },
762 { 0x41870c, 2, 0x04, 0x00000000 },
763 { 0x418728, 1, 0x04, 0x00010000 },
764 {}
765};
766
767const struct gf100_gr_init
768gm204_grctx_init_setup_0[] = {
769 { 0x418800, 1, 0x04, 0x7006863a },
770 { 0x418808, 1, 0x04, 0x00000000 },
771 { 0x418810, 1, 0x04, 0x00000000 },
772 { 0x418828, 1, 0x04, 0x00000044 },
773 { 0x418830, 1, 0x04, 0x10000001 },
774 { 0x4188d8, 1, 0x04, 0x00000008 },
775 { 0x4188e0, 1, 0x04, 0x01000000 },
776 { 0x4188e8, 5, 0x04, 0x00000000 },
777 { 0x4188fc, 1, 0x04, 0x20100058 },
778 {}
779};
780
781const struct gf100_gr_init
782gm204_grctx_init_gpm_0[] = {
783 { 0x418c10, 8, 0x04, 0x00000000 },
784 { 0x418c40, 1, 0x04, 0xffffffff },
785 { 0x418c6c, 1, 0x04, 0x00000001 },
786 { 0x418c80, 1, 0x04, 0x20200000 },
787 {}
788};
789
790const struct gf100_gr_init
791gm204_grctx_init_gpc_unk_2[] = {
792 { 0x418e00, 1, 0x04, 0x90040000 },
793 { 0x418e24, 1, 0x04, 0x00000000 },
794 { 0x418e28, 1, 0x04, 0x00000030 },
795 { 0x418e2c, 1, 0x04, 0x00000100 },
796 { 0x418e30, 3, 0x04, 0x00000000 },
797 { 0x418e40, 22, 0x04, 0x00000000 },
798 { 0x418ea0, 12, 0x04, 0x00000000 },
799 {}
800};
801
802static const struct gf100_gr_pack
803gm204_grctx_pack_gpc[] = {
804 { gm107_grctx_init_gpc_unk_0 },
805 { gm204_grctx_init_prop_0 },
806 { gm204_grctx_init_gpc_unk_1 },
807 { gm204_grctx_init_setup_0 },
808 { gf100_grctx_init_zcull_0 },
809 { gk208_grctx_init_crstr_0 },
810 { gm204_grctx_init_gpm_0 },
811 { gm204_grctx_init_gpc_unk_2 },
812 { gf100_grctx_init_gcc_0 },
813 {}
814};
815
816static const struct gf100_gr_init
817gm204_grctx_init_pe_0[] = {
818 { 0x419848, 1, 0x04, 0x00000000 },
819 { 0x419864, 1, 0x04, 0x00000029 },
820 { 0x419888, 1, 0x04, 0x00000000 },
821 {}
822};
823
824static const struct gf100_gr_init
825gm204_grctx_init_tex_0[] = {
826 { 0x419a00, 1, 0x04, 0x000100f0 },
827 { 0x419a04, 1, 0x04, 0x00000005 },
828 { 0x419a08, 1, 0x04, 0x00000621 },
829 { 0x419a0c, 1, 0x04, 0x00320000 },
830 { 0x419a10, 1, 0x04, 0x00000000 },
831 { 0x419a14, 1, 0x04, 0x00000200 },
832 { 0x419a1c, 1, 0x04, 0x0010c000 },
833 { 0x419a20, 1, 0x04, 0x20008a00 },
834 { 0x419a30, 1, 0x04, 0x00000001 },
835 { 0x419a3c, 1, 0x04, 0x0000181e },
836 { 0x419ac4, 1, 0x04, 0x00000000 },
837 {}
838};
839
840static const struct gf100_gr_init
841gm204_grctx_init_mpc_0[] = {
842 { 0x419c00, 1, 0x04, 0x0000009a },
843 { 0x419c04, 1, 0x04, 0x80000bd6 },
844 { 0x419c08, 1, 0x04, 0x00000002 },
845 { 0x419c20, 1, 0x04, 0x00000000 },
846 { 0x419c24, 1, 0x04, 0x00084210 },
847 { 0x419c28, 1, 0x04, 0x3efbefbe },
848 { 0x419c2c, 1, 0x04, 0x00000000 },
849 { 0x419c34, 1, 0x04, 0x71ff1ff3 },
850 { 0x419c3c, 1, 0x04, 0x00001919 },
851 { 0x419c50, 1, 0x04, 0x00000005 },
852 {}
853};
854
855static const struct gf100_gr_init
856gm204_grctx_init_l1c_0[] = {
857 { 0x419c84, 1, 0x04, 0x0000003e },
858 { 0x419c90, 1, 0x04, 0x0000000a },
859 {}
860};
861
862static const struct gf100_gr_init
863gm204_grctx_init_sm_0[] = {
864 { 0x419e04, 3, 0x04, 0x00000000 },
865 { 0x419e10, 1, 0x04, 0x00001c02 },
866 { 0x419e44, 1, 0x04, 0x00d3eff2 },
867 { 0x419e48, 1, 0x04, 0x00000000 },
868 { 0x419e4c, 1, 0x04, 0x0000007f },
869 { 0x419e50, 1, 0x04, 0x00000000 },
870 { 0x419e58, 6, 0x04, 0x00000000 },
871 { 0x419e74, 10, 0x04, 0x00000000 },
872 { 0x419eac, 1, 0x04, 0x0001cf8b },
873 { 0x419eb0, 1, 0x04, 0x00030300 },
874 { 0x419eb8, 1, 0x04, 0x40000000 },
875 { 0x419ef0, 24, 0x04, 0x00000000 },
876 { 0x419f68, 2, 0x04, 0x00000000 },
877 { 0x419f70, 1, 0x04, 0x00000020 },
878 { 0x419f78, 1, 0x04, 0x00010beb },
879 { 0x419f7c, 1, 0x04, 0x00000000 },
880 {}
881};
882
883const struct gf100_gr_pack
884gm204_grctx_pack_tpc[] = {
885 { gm204_grctx_init_pe_0 },
886 { gm204_grctx_init_tex_0 },
887 { gm204_grctx_init_mpc_0 },
888 { gm204_grctx_init_l1c_0 },
889 { gm204_grctx_init_sm_0 },
890 {}
891};
892
893static const struct gf100_gr_init
894gm204_grctx_init_pes_0[] = {
895 { 0x41be24, 1, 0x04, 0x0000000e },
896 {}
897};
898
899static const struct gf100_gr_init
900gm204_grctx_init_cbm_0[] = {
901 { 0x41bec0, 1, 0x04, 0x00000000 },
902 { 0x41bec4, 1, 0x04, 0x01030000 },
903 { 0x41bee4, 1, 0x04, 0x00000000 },
904 { 0x41bef0, 1, 0x04, 0x000003ff },
905 { 0x41bef4, 2, 0x04, 0x00000000 },
906 {}
907};
908
909const struct gf100_gr_pack
910gm204_grctx_pack_ppc[] = {
911 { gm204_grctx_init_pes_0 },
912 { gm204_grctx_init_cbm_0 },
913 { gm107_grctx_init_wwdx_0 },
914 {}
915};
916
917/*******************************************************************************
918 * PGRAPH context implementation
919 ******************************************************************************/
920
921void
922gm204_grctx_generate_tpcid(struct gf100_gr *gr)
923{
924 struct nvkm_device *device = gr->base.engine.subdev.device;
925 int gpc, tpc, id;
926
927 for (tpc = 0, id = 0; tpc < 4; tpc++) {
928 for (gpc = 0; gpc < gr->gpc_nr; gpc++) {
929 if (tpc < gr->tpc_nr[gpc]) {
930 nvkm_wr32(device, TPC_UNIT(gpc, tpc, 0x698), id);
931 nvkm_wr32(device, GPC_UNIT(gpc, 0x0c10 + tpc * 4), id);
932 nvkm_wr32(device, TPC_UNIT(gpc, tpc, 0x088), id);
933 id++;
934 }
935 }
936 }
937}
938
939static void
940gm204_grctx_generate_rop_active_fbps(struct gf100_gr *gr)
941{
942 struct nvkm_device *device = gr->base.engine.subdev.device;
943 const u32 fbp_count = nvkm_rd32(device, 0x12006c);
944 nvkm_mask(device, 0x408850, 0x0000000f, fbp_count); /* zrop */
945 nvkm_mask(device, 0x408958, 0x0000000f, fbp_count); /* crop */
946}
947
948void
949gm204_grctx_generate_405b60(struct gf100_gr *gr)
950{
951 struct nvkm_device *device = gr->base.engine.subdev.device;
952 const u32 dist_nr = DIV_ROUND_UP(gr->tpc_total, 4);
953 u32 dist[TPC_MAX / 4] = {};
954 u32 gpcs[GPC_MAX] = {};
955 u8 tpcnr[GPC_MAX];
956 int tpc, gpc, i;
957
958 memcpy(tpcnr, gr->tpc_nr, sizeof(gr->tpc_nr));
959
960 /* won't result in the same distribution as the binary driver where
961 * some of the gpcs have more tpcs than others, but this shall do
962 * for the moment. the code for earlier gpus has this issue too.
963 */
964 for (gpc = -1, i = 0; i < gr->tpc_total; i++) {
965 do {
966 gpc = (gpc + 1) % gr->gpc_nr;
967 } while(!tpcnr[gpc]);
968 tpc = gr->tpc_nr[gpc] - tpcnr[gpc]--;
969
970 dist[i / 4] |= ((gpc << 4) | tpc) << ((i % 4) * 8);
971 gpcs[gpc] |= i << (tpc * 8);
972 }
973
974 for (i = 0; i < dist_nr; i++)
975 nvkm_wr32(device, 0x405b60 + (i * 4), dist[i]);
976 for (i = 0; i < gr->gpc_nr; i++)
977 nvkm_wr32(device, 0x405ba0 + (i * 4), gpcs[i]);
978}
979
980void
981gm204_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info)
982{
983 struct nvkm_device *device = gr->base.engine.subdev.device;
984 const struct gf100_grctx_func *grctx = gr->func->grctx;
985 u32 tmp;
986 int i;
987
988 gf100_gr_mmio(gr, grctx->hub);
989 gf100_gr_mmio(gr, grctx->gpc);
990 gf100_gr_mmio(gr, grctx->zcull);
991 gf100_gr_mmio(gr, grctx->tpc);
992 gf100_gr_mmio(gr, grctx->ppc);
993
994 nvkm_wr32(device, 0x404154, 0x00000000);
995
996 grctx->bundle(info);
997 grctx->pagepool(info);
998 grctx->attrib(info);
999 grctx->unkn(gr);
1000
1001 gm204_grctx_generate_tpcid(gr);
1002 gf100_grctx_generate_r406028(gr);
1003 gk104_grctx_generate_r418bb8(gr);
1004
1005 for (i = 0; i < 8; i++)
1006 nvkm_wr32(device, 0x4064d0 + (i * 0x04), 0x00000000);
1007 nvkm_wr32(device, 0x406500, 0x00000000);
1008
1009 nvkm_wr32(device, 0x405b00, (gr->tpc_total << 8) | gr->gpc_nr);
1010
1011 gm204_grctx_generate_rop_active_fbps(gr);
1012
1013 for (tmp = 0, i = 0; i < gr->gpc_nr; i++)
1014 tmp |= ((1 << gr->tpc_nr[i]) - 1) << (i * 4);
1015 nvkm_wr32(device, 0x4041c4, tmp);
1016
1017 gm204_grctx_generate_405b60(gr);
1018
1019 gf100_gr_icmd(gr, grctx->icmd);
1020 nvkm_wr32(device, 0x404154, 0x00000800);
1021 gf100_gr_mthd(gr, grctx->mthd);
1022
1023 nvkm_mask(device, 0x418e94, 0xffffffff, 0xc4230000);
1024 nvkm_mask(device, 0x418e4c, 0xffffffff, 0x70000000);
1025}
1026
1027const struct gf100_grctx_func
1028gm204_grctx = {
1029 .main = gm204_grctx_generate_main,
1030 .unkn = gk104_grctx_generate_unkn,
1031 .hub = gm204_grctx_pack_hub,
1032 .gpc = gm204_grctx_pack_gpc,
1033 .zcull = gf100_grctx_pack_zcull,
1034 .tpc = gm204_grctx_pack_tpc,
1035 .ppc = gm204_grctx_pack_ppc,
1036 .icmd = gm204_grctx_pack_icmd,
1037 .mthd = gm204_grctx_pack_mthd,
1038 .bundle = gm107_grctx_generate_bundle,
1039 .bundle_size = 0x3000,
1040 .bundle_min_gpm_fifo_depth = 0x180,
1041 .bundle_token_limit = 0x780,
1042 .pagepool = gm107_grctx_generate_pagepool,
1043 .pagepool_size = 0x20000,
1044 .attrib = gm107_grctx_generate_attrib,
1045 .attrib_nr_max = 0x600,
1046 .attrib_nr = 0x400,
1047 .alpha_nr_max = 0x1800,
1048 .alpha_nr = 0x1000,
1049};
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm206.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm206.c
deleted file mode 100644
index d6be6034c2c2..000000000000
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm206.c
+++ /dev/null
@@ -1,74 +0,0 @@
1/*
2 * Copyright 2015 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#include "ctxgf100.h"
25
26static const struct gf100_gr_init
27gm206_grctx_init_gpc_unk_1[] = {
28 { 0x418600, 1, 0x04, 0x0000007f },
29 { 0x418684, 1, 0x04, 0x0000001f },
30 { 0x418700, 1, 0x04, 0x00000002 },
31 { 0x418704, 1, 0x04, 0x00000080 },
32 { 0x418708, 1, 0x04, 0x40000000 },
33 { 0x41870c, 2, 0x04, 0x00000000 },
34 { 0x418728, 1, 0x04, 0x00300020 },
35 {}
36};
37
38static const struct gf100_gr_pack
39gm206_grctx_pack_gpc[] = {
40 { gm107_grctx_init_gpc_unk_0 },
41 { gm204_grctx_init_prop_0 },
42 { gm206_grctx_init_gpc_unk_1 },
43 { gm204_grctx_init_setup_0 },
44 { gf100_grctx_init_zcull_0 },
45 { gk208_grctx_init_crstr_0 },
46 { gm204_grctx_init_gpm_0 },
47 { gm204_grctx_init_gpc_unk_2 },
48 { gf100_grctx_init_gcc_0 },
49 {}
50};
51
52const struct gf100_grctx_func
53gm206_grctx = {
54 .main = gm204_grctx_generate_main,
55 .unkn = gk104_grctx_generate_unkn,
56 .hub = gm204_grctx_pack_hub,
57 .gpc = gm206_grctx_pack_gpc,
58 .zcull = gf100_grctx_pack_zcull,
59 .tpc = gm204_grctx_pack_tpc,
60 .ppc = gm204_grctx_pack_ppc,
61 .icmd = gm204_grctx_pack_icmd,
62 .mthd = gm204_grctx_pack_mthd,
63 .bundle = gm107_grctx_generate_bundle,
64 .bundle_size = 0x3000,
65 .bundle_min_gpm_fifo_depth = 0x180,
66 .bundle_token_limit = 0x780,
67 .pagepool = gm107_grctx_generate_pagepool,
68 .pagepool_size = 0x20000,
69 .attrib = gm107_grctx_generate_attrib,
70 .attrib_nr_max = 0x600,
71 .attrib_nr = 0x400,
72 .alpha_nr_max = 0x1800,
73 .alpha_nr = 0x1000,
74};
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm20b.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm20b.c
index 670260402538..a8827efa90ae 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm20b.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm20b.c
@@ -54,7 +54,7 @@ gm20b_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info)
54 54
55 grctx->unkn(gr); 55 grctx->unkn(gr);
56 56
57 gm204_grctx_generate_tpcid(gr); 57 gm200_grctx_generate_tpcid(gr);
58 gm20b_grctx_generate_r406028(gr); 58 gm20b_grctx_generate_r406028(gr);
59 gk104_grctx_generate_r418bb8(gr); 59 gk104_grctx_generate_r418bb8(gr);
60 60
@@ -70,7 +70,7 @@ gm20b_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info)
70 tmp |= ((1 << gr->tpc_nr[i]) - 1) << (i * 4); 70 tmp |= ((1 << gr->tpc_nr[i]) - 1) << (i * 4);
71 nvkm_wr32(device, 0x4041c4, tmp); 71 nvkm_wr32(device, 0x4041c4, tmp);
72 72
73 gm204_grctx_generate_405b60(gr); 73 gm200_grctx_generate_405b60(gr);
74 74
75 gf100_gr_wait_idle(gr); 75 gf100_gr_wait_idle(gr);
76 76
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpc.fuc b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpc.fuc
index e168b83a10c9..dc60509f76f7 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpc.fuc
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpc.fuc
@@ -322,6 +322,7 @@ main:
322 322
323// interrupt handler 323// interrupt handler
324ih: 324ih:
325 push $r0
325 push $r8 326 push $r8
326 mov $r8 $flags 327 mov $r8 $flags
327 push $r8 328 push $r8
@@ -358,6 +359,7 @@ ih:
358 pop $r8 359 pop $r8
359 mov $flags $r8 360 mov $flags $r8
360 pop $r8 361 pop $r8
362 pop $r0
361 bclr $flags $p0 363 bclr $flags $p0
362 iret 364 iret
363 365
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgf100.fuc3.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgf100.fuc3.h
index 231f696d1e0a..5f4ddfee48a2 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgf100.fuc3.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgf100.fuc3.h
@@ -382,56 +382,57 @@ uint32_t gf100_grgpc_code[] = {
382 0xb60412fd, 382 0xb60412fd,
383 0x1efd01e4, 383 0x1efd01e4,
384 0x0018fe05, 384 0x0018fe05,
385 0x05b021f5, 385 0x05b421f5,
386/* 0x04eb: main_not_ctx_xfer */ 386/* 0x04eb: main_not_ctx_xfer */
387 0x94d30ef4, 387 0x94d30ef4,
388 0xf5f010ef, 388 0xf5f010ef,
389 0x7e21f501, 389 0x7e21f501,
390 0xc60ef403, 390 0xc60ef403,
391/* 0x04f8: ih */ 391/* 0x04f8: ih */
392 0x88fe80f9, 392 0x80f900f9,
393 0xf980f901, 393 0xf90188fe,
394 0xf9a0f990, 394 0xf990f980,
395 0xf9d0f9b0, 395 0xf9b0f9a0,
396 0xbdf0f9e0, 396 0xf9e0f9d0,
397 0x00a7f104, 397 0xf104bdf0,
398 0x00a3f002, 398 0xf00200a7,
399 0xc400aacf, 399 0xaacf00a3,
400 0x0bf404ab, 400 0x04abc400,
401 0x1cd7f02c, 401 0xf02c0bf4,
402 0x1a00e7f1, 402 0xe7f11cd7,
403 0xcf00e3f0, 403 0xe3f01a00,
404 0xf7f100ee, 404 0x00eecf00,
405 0xf3f01900, 405 0x1900f7f1,
406 0x00ffcf00, 406 0xcf00f3f0,
407 0xf00421f4, 407 0x21f400ff,
408 0x07f101e7, 408 0x01e7f004,
409 0x03f01d00, 409 0x1d0007f1,
410 0x000ed000, 410 0xd00003f0,
411/* 0x0546: ih_no_fifo */ 411 0x04bd000e,
412 0x07f104bd, 412/* 0x0548: ih_no_fifo */
413 0x03f00100, 413 0x010007f1,
414 0x000ad000, 414 0xd00003f0,
415 0xf0fc04bd, 415 0x04bd000a,
416 0xd0fce0fc, 416 0xe0fcf0fc,
417 0xa0fcb0fc, 417 0xb0fcd0fc,
418 0x80fc90fc, 418 0x90fca0fc,
419 0xfc0088fe, 419 0x88fe80fc,
420 0x0032f480, 420 0xfc80fc00,
421/* 0x056a: hub_barrier_done */ 421 0x0032f400,
422/* 0x056e: hub_barrier_done */
422 0xf7f001f8, 423 0xf7f001f8,
423 0x040e9801, 424 0x040e9801,
424 0xb904febb, 425 0xb904febb,
425 0xe7f102ff, 426 0xe7f102ff,
426 0xe3f09418, 427 0xe3f09418,
427 0x9d21f440, 428 0x9d21f440,
428/* 0x0582: ctx_redswitch */ 429/* 0x0586: ctx_redswitch */
429 0xf7f000f8, 430 0xf7f000f8,
430 0x0007f120, 431 0x0007f120,
431 0x0103f085, 432 0x0103f085,
432 0xbd000fd0, 433 0xbd000fd0,
433 0x08e7f004, 434 0x08e7f004,
434/* 0x0594: ctx_redswitch_delay */ 435/* 0x0598: ctx_redswitch_delay */
435 0xf401e2b6, 436 0xf401e2b6,
436 0xf5f1fd1b, 437 0xf5f1fd1b,
437 0xf5f10800, 438 0xf5f10800,
@@ -439,13 +440,13 @@ uint32_t gf100_grgpc_code[] = {
439 0x03f08500, 440 0x03f08500,
440 0x000fd001, 441 0x000fd001,
441 0x00f804bd, 442 0x00f804bd,
442/* 0x05b0: ctx_xfer */ 443/* 0x05b4: ctx_xfer */
443 0x810007f1, 444 0x810007f1,
444 0xd00203f0, 445 0xd00203f0,
445 0x04bd000f, 446 0x04bd000f,
446 0xf50711f4, 447 0xf50711f4,
447/* 0x05c3: ctx_xfer_not_load */ 448/* 0x05c7: ctx_xfer_not_load */
448 0xf5058221, 449 0xf5058621,
449 0xbd026a21, 450 0xbd026a21,
450 0xfc07f124, 451 0xfc07f124,
451 0x0203f047, 452 0x0203f047,
@@ -475,12 +476,11 @@ uint32_t gf100_grgpc_code[] = {
475 0x6f21f508, 476 0x6f21f508,
476 0x5e21f501, 477 0x5e21f501,
477 0x0601f402, 478 0x0601f402,
478/* 0x063b: ctx_xfer_post */ 479/* 0x063f: ctx_xfer_post */
479 0xf50712f4, 480 0xf50712f4,
480/* 0x063f: ctx_xfer_done */ 481/* 0x0643: ctx_xfer_done */
481 0xf5027f21, 482 0xf5027f21,
482 0xf8056a21, 483 0xf8056e21,
483 0x00000000,
484 0x00000000, 484 0x00000000,
485 0x00000000, 485 0x00000000,
486 0x00000000, 486 0x00000000,
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgf117.fuc3.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgf117.fuc3.h
index bb820ff28621..03381b163cfc 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgf117.fuc3.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgf117.fuc3.h
@@ -408,56 +408,57 @@ uint32_t gf117_grgpc_code[] = {
408 0x0412fd20, 408 0x0412fd20,
409 0xfd01e4b6, 409 0xfd01e4b6,
410 0x18fe051e, 410 0x18fe051e,
411 0xfd21f500, 411 0x0121f500,
412 0xd30ef405, 412 0xd30ef406,
413/* 0x0538: main_not_ctx_xfer */ 413/* 0x0538: main_not_ctx_xfer */
414 0xf010ef94, 414 0xf010ef94,
415 0x21f501f5, 415 0x21f501f5,
416 0x0ef4037e, 416 0x0ef4037e,
417/* 0x0545: ih */ 417/* 0x0545: ih */
418 0xfe80f9c6, 418 0xf900f9c6,
419 0x80f90188, 419 0x0188fe80,
420 0xa0f990f9, 420 0x90f980f9,
421 0xd0f9b0f9, 421 0xb0f9a0f9,
422 0xf0f9e0f9, 422 0xe0f9d0f9,
423 0xa7f104bd, 423 0x04bdf0f9,
424 0xa3f00200, 424 0x0200a7f1,
425 0x00aacf00, 425 0xcf00a3f0,
426 0xf404abc4, 426 0xabc400aa,
427 0xd7f02c0b, 427 0x2c0bf404,
428 0x00e7f124, 428 0xf124d7f0,
429 0x00e3f01a, 429 0xf01a00e7,
430 0xf100eecf, 430 0xeecf00e3,
431 0xf01900f7, 431 0x00f7f100,
432 0xffcf00f3, 432 0x00f3f019,
433 0x0421f400, 433 0xf400ffcf,
434 0xf101e7f0, 434 0xe7f00421,
435 0xf01d0007, 435 0x0007f101,
436 0x0ed00003, 436 0x0003f01d,
437/* 0x0593: ih_no_fifo */ 437 0xbd000ed0,
438 0xf104bd00, 438/* 0x0595: ih_no_fifo */
439 0xf0010007, 439 0x0007f104,
440 0x0ad00003, 440 0x0003f001,
441 0xfc04bd00, 441 0xbd000ad0,
442 0xfce0fcf0, 442 0xfcf0fc04,
443 0xfcb0fcd0, 443 0xfcd0fce0,
444 0xfc90fca0, 444 0xfca0fcb0,
445 0x0088fe80, 445 0xfe80fc90,
446 0x32f480fc, 446 0x80fc0088,
447/* 0x05b7: hub_barrier_done */ 447 0x32f400fc,
448/* 0x05bb: hub_barrier_done */
448 0xf001f800, 449 0xf001f800,
449 0x0e9801f7, 450 0x0e9801f7,
450 0x04febb04, 451 0x04febb04,
451 0xf102ffb9, 452 0xf102ffb9,
452 0xf09418e7, 453 0xf09418e7,
453 0x21f440e3, 454 0x21f440e3,
454/* 0x05cf: ctx_redswitch */ 455/* 0x05d3: ctx_redswitch */
455 0xf000f89d, 456 0xf000f89d,
456 0x07f120f7, 457 0x07f120f7,
457 0x03f08500, 458 0x03f08500,
458 0x000fd001, 459 0x000fd001,
459 0xe7f004bd, 460 0xe7f004bd,
460/* 0x05e1: ctx_redswitch_delay */ 461/* 0x05e5: ctx_redswitch_delay */
461 0x01e2b608, 462 0x01e2b608,
462 0xf1fd1bf4, 463 0xf1fd1bf4,
463 0xf10800f5, 464 0xf10800f5,
@@ -465,13 +466,13 @@ uint32_t gf117_grgpc_code[] = {
465 0xf0850007, 466 0xf0850007,
466 0x0fd00103, 467 0x0fd00103,
467 0xf804bd00, 468 0xf804bd00,
468/* 0x05fd: ctx_xfer */ 469/* 0x0601: ctx_xfer */
469 0x0007f100, 470 0x0007f100,
470 0x0203f081, 471 0x0203f081,
471 0xbd000fd0, 472 0xbd000fd0,
472 0x0711f404, 473 0x0711f404,
473 0x05cf21f5, 474 0x05d321f5,
474/* 0x0610: ctx_xfer_not_load */ 475/* 0x0614: ctx_xfer_not_load */
475 0x026a21f5, 476 0x026a21f5,
476 0x07f124bd, 477 0x07f124bd,
477 0x03f047fc, 478 0x03f047fc,
@@ -511,10 +512,10 @@ uint32_t gf117_grgpc_code[] = {
511 0x21f5016f, 512 0x21f5016f,
512 0x01f4025e, 513 0x01f4025e,
513 0x0712f406, 514 0x0712f406,
514/* 0x06ac: ctx_xfer_post */ 515/* 0x06b0: ctx_xfer_post */
515 0x027f21f5, 516 0x027f21f5,
516/* 0x06b0: ctx_xfer_done */ 517/* 0x06b4: ctx_xfer_done */
517 0x05b721f5, 518 0x05bb21f5,
518 0x000000f8, 519 0x000000f8,
519 0x00000000, 520 0x00000000,
520 0x00000000, 521 0x00000000,
@@ -533,5 +534,4 @@ uint32_t gf117_grgpc_code[] = {
533 0x00000000, 534 0x00000000,
534 0x00000000, 535 0x00000000,
535 0x00000000, 536 0x00000000,
536 0x00000000,
537}; 537};
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk104.fuc3.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk104.fuc3.h
index 911976d20940..99d9b48a3b50 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk104.fuc3.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk104.fuc3.h
@@ -408,56 +408,57 @@ uint32_t gk104_grgpc_code[] = {
408 0x0412fd20, 408 0x0412fd20,
409 0xfd01e4b6, 409 0xfd01e4b6,
410 0x18fe051e, 410 0x18fe051e,
411 0xfd21f500, 411 0x0121f500,
412 0xd30ef405, 412 0xd30ef406,
413/* 0x0538: main_not_ctx_xfer */ 413/* 0x0538: main_not_ctx_xfer */
414 0xf010ef94, 414 0xf010ef94,
415 0x21f501f5, 415 0x21f501f5,
416 0x0ef4037e, 416 0x0ef4037e,
417/* 0x0545: ih */ 417/* 0x0545: ih */
418 0xfe80f9c6, 418 0xf900f9c6,
419 0x80f90188, 419 0x0188fe80,
420 0xa0f990f9, 420 0x90f980f9,
421 0xd0f9b0f9, 421 0xb0f9a0f9,
422 0xf0f9e0f9, 422 0xe0f9d0f9,
423 0xa7f104bd, 423 0x04bdf0f9,
424 0xa3f00200, 424 0x0200a7f1,
425 0x00aacf00, 425 0xcf00a3f0,
426 0xf404abc4, 426 0xabc400aa,
427 0xd7f02c0b, 427 0x2c0bf404,
428 0x00e7f124, 428 0xf124d7f0,
429 0x00e3f01a, 429 0xf01a00e7,
430 0xf100eecf, 430 0xeecf00e3,
431 0xf01900f7, 431 0x00f7f100,
432 0xffcf00f3, 432 0x00f3f019,
433 0x0421f400, 433 0xf400ffcf,
434 0xf101e7f0, 434 0xe7f00421,
435 0xf01d0007, 435 0x0007f101,
436 0x0ed00003, 436 0x0003f01d,
437/* 0x0593: ih_no_fifo */ 437 0xbd000ed0,
438 0xf104bd00, 438/* 0x0595: ih_no_fifo */
439 0xf0010007, 439 0x0007f104,
440 0x0ad00003, 440 0x0003f001,
441 0xfc04bd00, 441 0xbd000ad0,
442 0xfce0fcf0, 442 0xfcf0fc04,
443 0xfcb0fcd0, 443 0xfcd0fce0,
444 0xfc90fca0, 444 0xfca0fcb0,
445 0x0088fe80, 445 0xfe80fc90,
446 0x32f480fc, 446 0x80fc0088,
447/* 0x05b7: hub_barrier_done */ 447 0x32f400fc,
448/* 0x05bb: hub_barrier_done */
448 0xf001f800, 449 0xf001f800,
449 0x0e9801f7, 450 0x0e9801f7,
450 0x04febb04, 451 0x04febb04,
451 0xf102ffb9, 452 0xf102ffb9,
452 0xf09418e7, 453 0xf09418e7,
453 0x21f440e3, 454 0x21f440e3,
454/* 0x05cf: ctx_redswitch */ 455/* 0x05d3: ctx_redswitch */
455 0xf000f89d, 456 0xf000f89d,
456 0x07f120f7, 457 0x07f120f7,
457 0x03f08500, 458 0x03f08500,
458 0x000fd001, 459 0x000fd001,
459 0xe7f004bd, 460 0xe7f004bd,
460/* 0x05e1: ctx_redswitch_delay */ 461/* 0x05e5: ctx_redswitch_delay */
461 0x01e2b608, 462 0x01e2b608,
462 0xf1fd1bf4, 463 0xf1fd1bf4,
463 0xf10800f5, 464 0xf10800f5,
@@ -465,13 +466,13 @@ uint32_t gk104_grgpc_code[] = {
465 0xf0850007, 466 0xf0850007,
466 0x0fd00103, 467 0x0fd00103,
467 0xf804bd00, 468 0xf804bd00,
468/* 0x05fd: ctx_xfer */ 469/* 0x0601: ctx_xfer */
469 0x0007f100, 470 0x0007f100,
470 0x0203f081, 471 0x0203f081,
471 0xbd000fd0, 472 0xbd000fd0,
472 0x0711f404, 473 0x0711f404,
473 0x05cf21f5, 474 0x05d321f5,
474/* 0x0610: ctx_xfer_not_load */ 475/* 0x0614: ctx_xfer_not_load */
475 0x026a21f5, 476 0x026a21f5,
476 0x07f124bd, 477 0x07f124bd,
477 0x03f047fc, 478 0x03f047fc,
@@ -511,10 +512,10 @@ uint32_t gk104_grgpc_code[] = {
511 0x21f5016f, 512 0x21f5016f,
512 0x01f4025e, 513 0x01f4025e,
513 0x0712f406, 514 0x0712f406,
514/* 0x06ac: ctx_xfer_post */ 515/* 0x06b0: ctx_xfer_post */
515 0x027f21f5, 516 0x027f21f5,
516/* 0x06b0: ctx_xfer_done */ 517/* 0x06b4: ctx_xfer_done */
517 0x05b721f5, 518 0x05bb21f5,
518 0x000000f8, 519 0x000000f8,
519 0x00000000, 520 0x00000000,
520 0x00000000, 521 0x00000000,
@@ -533,5 +534,4 @@ uint32_t gk104_grgpc_code[] = {
533 0x00000000, 534 0x00000000,
534 0x00000000, 535 0x00000000,
535 0x00000000, 536 0x00000000,
536 0x00000000,
537}; 537};
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk110.fuc3.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk110.fuc3.h
index 1c6e11b05df2..f7267696cbfd 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk110.fuc3.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk110.fuc3.h
@@ -408,56 +408,57 @@ uint32_t gk110_grgpc_code[] = {
408 0x0412fd20, 408 0x0412fd20,
409 0xfd01e4b6, 409 0xfd01e4b6,
410 0x18fe051e, 410 0x18fe051e,
411 0xfd21f500, 411 0x0121f500,
412 0xd30ef405, 412 0xd30ef406,
413/* 0x0538: main_not_ctx_xfer */ 413/* 0x0538: main_not_ctx_xfer */
414 0xf010ef94, 414 0xf010ef94,
415 0x21f501f5, 415 0x21f501f5,
416 0x0ef4037e, 416 0x0ef4037e,
417/* 0x0545: ih */ 417/* 0x0545: ih */
418 0xfe80f9c6, 418 0xf900f9c6,
419 0x80f90188, 419 0x0188fe80,
420 0xa0f990f9, 420 0x90f980f9,
421 0xd0f9b0f9, 421 0xb0f9a0f9,
422 0xf0f9e0f9, 422 0xe0f9d0f9,
423 0xa7f104bd, 423 0x04bdf0f9,
424 0xa3f00200, 424 0x0200a7f1,
425 0x00aacf00, 425 0xcf00a3f0,
426 0xf404abc4, 426 0xabc400aa,
427 0xd7f02c0b, 427 0x2c0bf404,
428 0x00e7f124, 428 0xf124d7f0,
429 0x00e3f01a, 429 0xf01a00e7,
430 0xf100eecf, 430 0xeecf00e3,
431 0xf01900f7, 431 0x00f7f100,
432 0xffcf00f3, 432 0x00f3f019,
433 0x0421f400, 433 0xf400ffcf,
434 0xf101e7f0, 434 0xe7f00421,
435 0xf01d0007, 435 0x0007f101,
436 0x0ed00003, 436 0x0003f01d,
437/* 0x0593: ih_no_fifo */ 437 0xbd000ed0,
438 0xf104bd00, 438/* 0x0595: ih_no_fifo */
439 0xf0010007, 439 0x0007f104,
440 0x0ad00003, 440 0x0003f001,
441 0xfc04bd00, 441 0xbd000ad0,
442 0xfce0fcf0, 442 0xfcf0fc04,
443 0xfcb0fcd0, 443 0xfcd0fce0,
444 0xfc90fca0, 444 0xfca0fcb0,
445 0x0088fe80, 445 0xfe80fc90,
446 0x32f480fc, 446 0x80fc0088,
447/* 0x05b7: hub_barrier_done */ 447 0x32f400fc,
448/* 0x05bb: hub_barrier_done */
448 0xf001f800, 449 0xf001f800,
449 0x0e9801f7, 450 0x0e9801f7,
450 0x04febb04, 451 0x04febb04,
451 0xf102ffb9, 452 0xf102ffb9,
452 0xf09418e7, 453 0xf09418e7,
453 0x21f440e3, 454 0x21f440e3,
454/* 0x05cf: ctx_redswitch */ 455/* 0x05d3: ctx_redswitch */
455 0xf000f89d, 456 0xf000f89d,
456 0x07f120f7, 457 0x07f120f7,
457 0x03f08500, 458 0x03f08500,
458 0x000fd001, 459 0x000fd001,
459 0xe7f004bd, 460 0xe7f004bd,
460/* 0x05e1: ctx_redswitch_delay */ 461/* 0x05e5: ctx_redswitch_delay */
461 0x01e2b608, 462 0x01e2b608,
462 0xf1fd1bf4, 463 0xf1fd1bf4,
463 0xf10800f5, 464 0xf10800f5,
@@ -465,13 +466,13 @@ uint32_t gk110_grgpc_code[] = {
465 0xf0850007, 466 0xf0850007,
466 0x0fd00103, 467 0x0fd00103,
467 0xf804bd00, 468 0xf804bd00,
468/* 0x05fd: ctx_xfer */ 469/* 0x0601: ctx_xfer */
469 0x0007f100, 470 0x0007f100,
470 0x0203f081, 471 0x0203f081,
471 0xbd000fd0, 472 0xbd000fd0,
472 0x0711f404, 473 0x0711f404,
473 0x05cf21f5, 474 0x05d321f5,
474/* 0x0610: ctx_xfer_not_load */ 475/* 0x0614: ctx_xfer_not_load */
475 0x026a21f5, 476 0x026a21f5,
476 0x07f124bd, 477 0x07f124bd,
477 0x03f047fc, 478 0x03f047fc,
@@ -511,10 +512,10 @@ uint32_t gk110_grgpc_code[] = {
511 0x21f5016f, 512 0x21f5016f,
512 0x01f4025e, 513 0x01f4025e,
513 0x0712f406, 514 0x0712f406,
514/* 0x06ac: ctx_xfer_post */ 515/* 0x06b0: ctx_xfer_post */
515 0x027f21f5, 516 0x027f21f5,
516/* 0x06b0: ctx_xfer_done */ 517/* 0x06b4: ctx_xfer_done */
517 0x05b721f5, 518 0x05bb21f5,
518 0x000000f8, 519 0x000000f8,
519 0x00000000, 520 0x00000000,
520 0x00000000, 521 0x00000000,
@@ -533,5 +534,4 @@ uint32_t gk110_grgpc_code[] = {
533 0x00000000, 534 0x00000000,
534 0x00000000, 535 0x00000000,
535 0x00000000, 536 0x00000000,
536 0x00000000,
537}; 537};
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk208.fuc5.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk208.fuc5.h
index 84af7ec6a78e..387d1fa3e231 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk208.fuc5.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk208.fuc5.h
@@ -360,61 +360,62 @@ uint32_t gk208_grgpc_code[] = {
360 0xb60412fd, 360 0xb60412fd,
361 0x1efd01e4, 361 0x1efd01e4,
362 0x0018fe05, 362 0x0018fe05,
363 0x00051b7e, 363 0x00051f7e,
364/* 0x0477: main_not_ctx_xfer */ 364/* 0x0477: main_not_ctx_xfer */
365 0x94d40ef4, 365 0x94d40ef4,
366 0xf5f010ef, 366 0xf5f010ef,
367 0x02f87e01, 367 0x02f87e01,
368 0xc70ef400, 368 0xc70ef400,
369/* 0x0484: ih */ 369/* 0x0484: ih */
370 0x88fe80f9, 370 0x80f900f9,
371 0xf980f901, 371 0xf90188fe,
372 0xf9a0f990, 372 0xf990f980,
373 0xf9d0f9b0, 373 0xf9b0f9a0,
374 0xbdf0f9e0, 374 0xf9e0f9d0,
375 0x02004a04, 375 0x4a04bdf0,
376 0xc400aacf, 376 0xaacf0200,
377 0x0bf404ab, 377 0x04abc400,
378 0x4e240d1f, 378 0x0d1f0bf4,
379 0xeecf1a00, 379 0x1a004e24,
380 0x19004f00, 380 0x4f00eecf,
381 0x7e00ffcf, 381 0xffcf1900,
382 0x0e000004, 382 0x00047e00,
383 0x1d004001, 383 0x40010e00,
384 0xbd000ef6, 384 0x0ef61d00,
385/* 0x04c1: ih_no_fifo */ 385/* 0x04c3: ih_no_fifo */
386 0x01004004, 386 0x4004bd00,
387 0xbd000af6, 387 0x0af60100,
388 0xfcf0fc04, 388 0xfc04bd00,
389 0xfcd0fce0, 389 0xfce0fcf0,
390 0xfca0fcb0, 390 0xfcb0fcd0,
391 0xfe80fc90, 391 0xfc90fca0,
392 0x80fc0088, 392 0x0088fe80,
393 0x00fc80fc,
393 0xf80032f4, 394 0xf80032f4,
394/* 0x04e1: hub_barrier_done */ 395/* 0x04e5: hub_barrier_done */
395 0x98010f01, 396 0x98010f01,
396 0xfebb040e, 397 0xfebb040e,
397 0x8effb204, 398 0x8effb204,
398 0x7e409418, 399 0x7e409418,
399 0xf800008f, 400 0xf800008f,
400/* 0x04f5: ctx_redswitch */ 401/* 0x04f9: ctx_redswitch */
401 0x80200f00, 402 0x80200f00,
402 0xf6018500, 403 0xf6018500,
403 0x04bd000f, 404 0x04bd000f,
404/* 0x0502: ctx_redswitch_delay */ 405/* 0x0506: ctx_redswitch_delay */
405 0xe2b6080e, 406 0xe2b6080e,
406 0xfd1bf401, 407 0xfd1bf401,
407 0x0800f5f1, 408 0x0800f5f1,
408 0x0200f5f1, 409 0x0200f5f1,
409 0x01850080, 410 0x01850080,
410 0xbd000ff6, 411 0xbd000ff6,
411/* 0x051b: ctx_xfer */ 412/* 0x051f: ctx_xfer */
412 0x8000f804, 413 0x8000f804,
413 0xf6028100, 414 0xf6028100,
414 0x04bd000f, 415 0x04bd000f,
415 0x7e0711f4, 416 0x7e0711f4,
416/* 0x052b: ctx_xfer_not_load */ 417/* 0x052f: ctx_xfer_not_load */
417 0x7e0004f5, 418 0x7e0004f9,
418 0xbd000216, 419 0xbd000216,
419 0x47fc8024, 420 0x47fc8024,
420 0x0002f602, 421 0x0002f602,
@@ -449,10 +450,10 @@ uint32_t gk208_grgpc_code[] = {
449 0x7e00013d, 450 0x7e00013d,
450 0xf400020a, 451 0xf400020a,
451 0x12f40601, 452 0x12f40601,
452/* 0x05b5: ctx_xfer_post */ 453/* 0x05b9: ctx_xfer_post */
453 0x02277e07, 454 0x02277e07,
454/* 0x05b9: ctx_xfer_done */ 455/* 0x05bd: ctx_xfer_done */
455 0x04e17e00, 456 0x04e57e00,
456 0x0000f800, 457 0x0000f800,
457 0x00000000, 458 0x00000000,
458 0x00000000, 459 0x00000000,
@@ -469,5 +470,4 @@ uint32_t gk208_grgpc_code[] = {
469 0x00000000, 470 0x00000000,
470 0x00000000, 471 0x00000000,
471 0x00000000, 472 0x00000000,
472 0x00000000,
473}; 473};
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgm107.fuc5.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgm107.fuc5.h
index 5136f9161706..fa9f3c0c5994 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgm107.fuc5.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgm107.fuc5.h
@@ -438,48 +438,49 @@ uint32_t gm107_grgpc_code[] = {
438 0x0412fd20, 438 0x0412fd20,
439 0xfd01e4b6, 439 0xfd01e4b6,
440 0x18fe051e, 440 0x18fe051e,
441 0x06447e00, 441 0x06487e00,
442 0xd40ef400, 442 0xd40ef400,
443/* 0x05a0: main_not_ctx_xfer */ 443/* 0x05a0: main_not_ctx_xfer */
444 0xf010ef94, 444 0xf010ef94,
445 0xf87e01f5, 445 0xf87e01f5,
446 0x0ef40002, 446 0x0ef40002,
447/* 0x05ad: ih */ 447/* 0x05ad: ih */
448 0xfe80f9c7, 448 0xf900f9c7,
449 0x80f90188, 449 0x0188fe80,
450 0xa0f990f9, 450 0x90f980f9,
451 0xd0f9b0f9, 451 0xb0f9a0f9,
452 0xf0f9e0f9, 452 0xe0f9d0f9,
453 0x004a04bd, 453 0x04bdf0f9,
454 0x00aacf02, 454 0xcf02004a,
455 0xf404abc4, 455 0xabc400aa,
456 0x240d1f0b, 456 0x1f0bf404,
457 0xcf1a004e, 457 0x004e240d,
458 0x004f00ee, 458 0x00eecf1a,
459 0x00ffcf19, 459 0xcf19004f,
460 0x0000047e, 460 0x047e00ff,
461 0x0040010e, 461 0x010e0000,
462 0x000ef61d, 462 0xf61d0040,
463/* 0x05ea: ih_no_fifo */ 463 0x04bd000e,
464 0x004004bd, 464/* 0x05ec: ih_no_fifo */
465 0x000af601, 465 0xf6010040,
466 0xf0fc04bd, 466 0x04bd000a,
467 0xd0fce0fc, 467 0xe0fcf0fc,
468 0xa0fcb0fc, 468 0xb0fcd0fc,
469 0x80fc90fc, 469 0x90fca0fc,
470 0xfc0088fe, 470 0x88fe80fc,
471 0x0032f480, 471 0xfc80fc00,
472/* 0x060a: hub_barrier_done */ 472 0x0032f400,
473/* 0x060e: hub_barrier_done */
473 0x010f01f8, 474 0x010f01f8,
474 0xbb040e98, 475 0xbb040e98,
475 0xffb204fe, 476 0xffb204fe,
476 0x4094188e, 477 0x4094188e,
477 0x00008f7e, 478 0x00008f7e,
478/* 0x061e: ctx_redswitch */ 479/* 0x0622: ctx_redswitch */
479 0x200f00f8, 480 0x200f00f8,
480 0x01850080, 481 0x01850080,
481 0xbd000ff6, 482 0xbd000ff6,
482/* 0x062b: ctx_redswitch_delay */ 483/* 0x062f: ctx_redswitch_delay */
483 0xb6080e04, 484 0xb6080e04,
484 0x1bf401e2, 485 0x1bf401e2,
485 0x00f5f1fd, 486 0x00f5f1fd,
@@ -487,15 +488,15 @@ uint32_t gm107_grgpc_code[] = {
487 0x85008002, 488 0x85008002,
488 0x000ff601, 489 0x000ff601,
489 0x00f804bd, 490 0x00f804bd,
490/* 0x0644: ctx_xfer */ 491/* 0x0648: ctx_xfer */
491 0x02810080, 492 0x02810080,
492 0xbd000ff6, 493 0xbd000ff6,
493 0x1dc48e04, 494 0x1dc48e04,
494 0x01e5f050, 495 0x01e5f050,
495 0x8f7effb2, 496 0x8f7effb2,
496 0x11f40000, 497 0x11f40000,
497 0x061e7e07, 498 0x06227e07,
498/* 0x0661: ctx_xfer_not_load */ 499/* 0x0665: ctx_xfer_not_load */
499 0x02167e00, 500 0x02167e00,
500 0x8024bd00, 501 0x8024bd00,
501 0xf60247fc, 502 0xf60247fc,
@@ -550,15 +551,15 @@ uint32_t gm107_grgpc_code[] = {
550 0x7e00020a, 551 0x7e00020a,
551 0xf4000314, 552 0xf4000314,
552 0x12f40601, 553 0x12f40601,
553/* 0x0739: ctx_xfer_post */ 554/* 0x073d: ctx_xfer_post */
554 0x02277e1a, 555 0x02277e1a,
555 0x8e0d0f00, 556 0x8e0d0f00,
556 0xf0501da8, 557 0xf0501da8,
557 0xffb201e5, 558 0xffb201e5,
558 0x00008f7e, 559 0x00008f7e,
559 0x0003147e, 560 0x0003147e,
560/* 0x0750: ctx_xfer_done */ 561/* 0x0754: ctx_xfer_done */
561 0x00060a7e, 562 0x00060e7e,
562 0x000000f8, 563 0x000000f8,
563 0x00000000, 564 0x00000000,
564 0x00000000, 565 0x00000000,
@@ -601,5 +602,4 @@ uint32_t gm107_grgpc_code[] = {
601 0x00000000, 602 0x00000000,
602 0x00000000, 603 0x00000000,
603 0x00000000, 604 0x00000000,
604 0x00000000,
605}; 605};
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hub.fuc b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hub.fuc
index 87f99e38acbf..e3a2fb308271 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hub.fuc
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hub.fuc
@@ -306,6 +306,7 @@ main:
306 306
307// interrupt handler 307// interrupt handler
308ih: 308ih:
309 push $r0
309 push $r8 310 push $r8
310 mov $r8 $flags 311 mov $r8 $flags
311 push $r8 312 push $r8
@@ -380,6 +381,7 @@ ih:
380 pop $r8 381 pop $r8
381 mov $flags $r8 382 mov $flags $r8
382 pop $r8 383 pop $r8
384 pop $r0
383 bclr $flags $p0 385 bclr $flags $p0
384 iret 386 iret
385 387
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgf100.fuc3.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgf100.fuc3.h
index f6acda505677..397921a9a46c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgf100.fuc3.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgf100.fuc3.h
@@ -528,10 +528,10 @@ uint32_t gf100_grhub_code[] = {
528 0x0001d001, 528 0x0001d001,
529 0x17f104bd, 529 0x17f104bd,
530 0xf7f00100, 530 0xf7f00100,
531 0x0d21f502, 531 0x1121f502,
532 0x1f21f508, 532 0x2321f508,
533 0x10f7f008, 533 0x10f7f008,
534 0x086c21f5, 534 0x087021f5,
535 0x98000e98, 535 0x98000e98,
536 0x21f5010f, 536 0x21f5010f,
537 0x14950150, 537 0x14950150,
@@ -574,9 +574,9 @@ uint32_t gf100_grhub_code[] = {
574 0xb6800040, 574 0xb6800040,
575 0x1bf40132, 575 0x1bf40132,
576 0x00f7f0be, 576 0x00f7f0be,
577 0x086c21f5, 577 0x087021f5,
578 0xf500f7f0, 578 0xf500f7f0,
579 0xf1080d21, 579 0xf1081121,
580 0xf0010007, 580 0xf0010007,
581 0x01d00203, 581 0x01d00203,
582 0xbd04bd00, 582 0xbd04bd00,
@@ -610,7 +610,7 @@ uint32_t gf100_grhub_code[] = {
610 0x09d00203, 610 0x09d00203,
611 0xf404bd00, 611 0xf404bd00,
612 0x31f40132, 612 0x31f40132,
613 0x4021f502, 613 0x4421f502,
614 0xf094bd0a, 614 0xf094bd0a,
615 0x07f10799, 615 0x07f10799,
616 0x03f01700, 616 0x03f01700,
@@ -621,7 +621,7 @@ uint32_t gf100_grhub_code[] = {
621 0x0203f00f, 621 0x0203f00f,
622 0xbd0009d0, 622 0xbd0009d0,
623 0x0131f404, 623 0x0131f404,
624 0x0a4021f5, 624 0x0a4421f5,
625 0x99f094bd, 625 0x99f094bd,
626 0x0007f106, 626 0x0007f106,
627 0x0203f017, 627 0x0203f017,
@@ -631,7 +631,7 @@ uint32_t gf100_grhub_code[] = {
631 0x12b920f9, 631 0x12b920f9,
632 0x0132f402, 632 0x0132f402,
633 0xf50232f4, 633 0xf50232f4,
634 0xfc0a4021, 634 0xfc0a4421,
635 0x0007f120, 635 0x0007f120,
636 0x0203f0c0, 636 0x0203f0c0,
637 0xbd0002d0, 637 0xbd0002d0,
@@ -640,7 +640,7 @@ uint32_t gf100_grhub_code[] = {
640 0xf41f23c8, 640 0xf41f23c8,
641 0x31f40d0b, 641 0x31f40d0b,
642 0x0232f401, 642 0x0232f401,
643 0x0a4021f5, 643 0x0a4421f5,
644/* 0x063c: chsw_done */ 644/* 0x063c: chsw_done */
645 0xf10127f0, 645 0xf10127f0,
646 0xf0c30007, 646 0xf0c30007,
@@ -654,7 +654,7 @@ uint32_t gf100_grhub_code[] = {
654/* 0x0660: main_not_ctx_switch */ 654/* 0x0660: main_not_ctx_switch */
655 0xf401e4b0, 655 0xf401e4b0,
656 0xf2b90d1b, 656 0xf2b90d1b,
657 0xd021f502, 657 0xd421f502,
658 0x460ef409, 658 0x460ef409,
659/* 0x0670: main_not_ctx_chan */ 659/* 0x0670: main_not_ctx_chan */
660 0xf402e4b0, 660 0xf402e4b0,
@@ -664,7 +664,7 @@ uint32_t gf100_grhub_code[] = {
664 0x09d00203, 664 0x09d00203,
665 0xf404bd00, 665 0xf404bd00,
666 0x32f40132, 666 0x32f40132,
667 0x4021f502, 667 0x4421f502,
668 0xf094bd0a, 668 0xf094bd0a,
669 0x07f10799, 669 0x07f10799,
670 0x03f01700, 670 0x03f01700,
@@ -682,107 +682,108 @@ uint32_t gf100_grhub_code[] = {
682 0x04bd0002, 682 0x04bd0002,
683 0xfea00ef5, 683 0xfea00ef5,
684/* 0x06c8: ih */ 684/* 0x06c8: ih */
685 0x88fe80f9, 685 0x80f900f9,
686 0xf980f901, 686 0xf90188fe,
687 0xf9a0f990, 687 0xf990f980,
688 0xf9d0f9b0, 688 0xf9b0f9a0,
689 0xbdf0f9e0, 689 0xf9e0f9d0,
690 0x00a7f104, 690 0xf104bdf0,
691 0x00a3f002, 691 0xf00200a7,
692 0xc400aacf, 692 0xaacf00a3,
693 0x0bf404ab, 693 0x04abc400,
694 0x10d7f030, 694 0xf0300bf4,
695 0x1a00e7f1, 695 0xe7f110d7,
696 0xcf00e3f0, 696 0xe3f01a00,
697 0xf7f100ee, 697 0x00eecf00,
698 0xf3f01900, 698 0x1900f7f1,
699 0x00ffcf00, 699 0xcf00f3f0,
700 0xb70421f4, 700 0x21f400ff,
701 0xf00400b0, 701 0x00b0b704,
702 0x07f101e7, 702 0x01e7f004,
703 0x03f01d00, 703 0x1d0007f1,
704 0x000ed000, 704 0xd00003f0,
705/* 0x071a: ih_no_fifo */ 705 0x04bd000e,
706 0xabe404bd, 706/* 0x071c: ih_no_fifo */
707 0x0bf40100, 707 0x0100abe4,
708 0x10d7f00d, 708 0xf00d0bf4,
709 0x4001e7f1, 709 0xe7f110d7,
710/* 0x072b: ih_no_ctxsw */ 710 0x21f44001,
711 0xe40421f4, 711/* 0x072d: ih_no_ctxsw */
712 0xf40400ab, 712 0x00abe404,
713 0xe7f16c0b, 713 0x6c0bf404,
714 0xe3f00708, 714 0x0708e7f1,
715 0x6821f440, 715 0xf440e3f0,
716 0xf102ffb9, 716 0xffb96821,
717 0xf0040007, 717 0x0007f102,
718 0x0fd00203, 718 0x0203f004,
719 0xf104bd00, 719 0xbd000fd0,
720 0xf00704e7, 720 0x04e7f104,
721 0x40e3f007,
722 0xb96821f4,
723 0x07f102ff,
724 0x03f00300,
725 0x000fd002,
726 0xfec704bd,
727 0x02ee9450,
728 0x0700f7f1,
729 0xbb40f3f0,
730 0x21f400ef,
731 0x0007f168,
732 0x0203f002,
733 0xbd000fd0,
734 0x03f7f004,
735 0x037e21f5,
736 0x0100b7f1,
737 0xf102bfb9,
738 0xf00144e7,
721 0x21f440e3, 739 0x21f440e3,
722 0x02ffb968, 740/* 0x079d: ih_no_fwmthd */
723 0x030007f1, 741 0x04b7f19d,
724 0xd00203f0, 742 0xffb0bd05,
725 0x04bd000f, 743 0x0bf4b4ab,
726 0x9450fec7, 744 0x0007f10f,
727 0xf7f102ee, 745 0x0303f007,
728 0xf3f00700, 746 0xbd000bd0,
729 0x00efbb40, 747/* 0x07b5: ih_no_other */
730 0xf16821f4, 748 0x0007f104,
731 0xf0020007, 749 0x0003f001,
732 0x0fd00203, 750 0xbd000ad0,
733 0xf004bd00, 751 0xfcf0fc04,
734 0x21f503f7, 752 0xfcd0fce0,
735 0xb7f1037e, 753 0xfca0fcb0,
736 0xbfb90100, 754 0xfe80fc90,
737 0x44e7f102, 755 0x80fc0088,
738 0x40e3f001, 756 0x32f400fc,
739/* 0x079b: ih_no_fwmthd */ 757/* 0x07db: ctx_4160s */
740 0xf19d21f4,
741 0xbd0504b7,
742 0xb4abffb0,
743 0xf10f0bf4,
744 0xf0070007,
745 0x0bd00303,
746/* 0x07b3: ih_no_other */
747 0xf104bd00,
748 0xf0010007,
749 0x0ad00003,
750 0xfc04bd00,
751 0xfce0fcf0,
752 0xfcb0fcd0,
753 0xfc90fca0,
754 0x0088fe80,
755 0x32f480fc,
756/* 0x07d7: ctx_4160s */
757 0xf001f800, 758 0xf001f800,
758 0xffb901f7, 759 0xffb901f7,
759 0x60e7f102, 760 0x60e7f102,
760 0x40e3f041, 761 0x40e3f041,
761/* 0x07e7: ctx_4160s_wait */ 762/* 0x07eb: ctx_4160s_wait */
762 0xf19d21f4, 763 0xf19d21f4,
763 0xf04160e7, 764 0xf04160e7,
764 0x21f440e3, 765 0x21f440e3,
765 0x02ffb968, 766 0x02ffb968,
766 0xf404ffc8, 767 0xf404ffc8,
767 0x00f8f00b, 768 0x00f8f00b,
768/* 0x07fc: ctx_4160c */ 769/* 0x0800: ctx_4160c */
769 0xffb9f4bd, 770 0xffb9f4bd,
770 0x60e7f102, 771 0x60e7f102,
771 0x40e3f041, 772 0x40e3f041,
772 0xf89d21f4, 773 0xf89d21f4,
773/* 0x080d: ctx_4170s */ 774/* 0x0811: ctx_4170s */
774 0x10f5f000, 775 0x10f5f000,
775 0xf102ffb9, 776 0xf102ffb9,
776 0xf04170e7, 777 0xf04170e7,
777 0x21f440e3, 778 0x21f440e3,
778/* 0x081f: ctx_4170w */ 779/* 0x0823: ctx_4170w */
779 0xf100f89d, 780 0xf100f89d,
780 0xf04170e7, 781 0xf04170e7,
781 0x21f440e3, 782 0x21f440e3,
782 0x02ffb968, 783 0x02ffb968,
783 0xf410f4f0, 784 0xf410f4f0,
784 0x00f8f01b, 785 0x00f8f01b,
785/* 0x0834: ctx_redswitch */ 786/* 0x0838: ctx_redswitch */
786 0x0200e7f1, 787 0x0200e7f1,
787 0xf040e5f0, 788 0xf040e5f0,
788 0xe5f020e5, 789 0xe5f020e5,
@@ -790,7 +791,7 @@ uint32_t gf100_grhub_code[] = {
790 0x0103f085, 791 0x0103f085,
791 0xbd000ed0, 792 0xbd000ed0,
792 0x08f7f004, 793 0x08f7f004,
793/* 0x0850: ctx_redswitch_delay */ 794/* 0x0854: ctx_redswitch_delay */
794 0xf401f2b6, 795 0xf401f2b6,
795 0xe5f1fd1b, 796 0xe5f1fd1b,
796 0xe5f10400, 797 0xe5f10400,
@@ -798,7 +799,7 @@ uint32_t gf100_grhub_code[] = {
798 0x03f08500, 799 0x03f08500,
799 0x000ed001, 800 0x000ed001,
800 0x00f804bd, 801 0x00f804bd,
801/* 0x086c: ctx_86c */ 802/* 0x0870: ctx_86c */
802 0x1b0007f1, 803 0x1b0007f1,
803 0xd00203f0, 804 0xd00203f0,
804 0x04bd000f, 805 0x04bd000f,
@@ -809,16 +810,16 @@ uint32_t gf100_grhub_code[] = {
809 0xa86ce7f1, 810 0xa86ce7f1,
810 0xf441e3f0, 811 0xf441e3f0,
811 0x00f89d21, 812 0x00f89d21,
812/* 0x0894: ctx_mem */ 813/* 0x0898: ctx_mem */
813 0x840007f1, 814 0x840007f1,
814 0xd00203f0, 815 0xd00203f0,
815 0x04bd000f, 816 0x04bd000f,
816/* 0x08a0: ctx_mem_wait */ 817/* 0x08a4: ctx_mem_wait */
817 0x8400f7f1, 818 0x8400f7f1,
818 0xcf02f3f0, 819 0xcf02f3f0,
819 0xfffd00ff, 820 0xfffd00ff,
820 0xf31bf405, 821 0xf31bf405,
821/* 0x08b2: ctx_load */ 822/* 0x08b6: ctx_load */
822 0x94bd00f8, 823 0x94bd00f8,
823 0xf10599f0, 824 0xf10599f0,
824 0xf00f0007, 825 0xf00f0007,
@@ -836,7 +837,7 @@ uint32_t gf100_grhub_code[] = {
836 0x02d00203, 837 0x02d00203,
837 0xf004bd00, 838 0xf004bd00,
838 0x21f507f7, 839 0x21f507f7,
839 0x07f10894, 840 0x07f10898,
840 0x03f0c000, 841 0x03f0c000,
841 0x0002d002, 842 0x0002d002,
842 0x0bfe04bd, 843 0x0bfe04bd,
@@ -891,31 +892,31 @@ uint32_t gf100_grhub_code[] = {
891 0x03f01700, 892 0x03f01700,
892 0x0009d002, 893 0x0009d002,
893 0x00f804bd, 894 0x00f804bd,
894/* 0x09d0: ctx_chan */ 895/* 0x09d4: ctx_chan */
895 0x07d721f5, 896 0x07db21f5,
896 0x08b221f5, 897 0x08b621f5,
897 0xf40ca7f0, 898 0xf40ca7f0,
898 0xf7f0d021, 899 0xf7f0d021,
899 0x9421f505, 900 0x9821f505,
900 0xfc21f508, 901 0x0021f508,
901/* 0x09eb: ctx_mmio_exec */ 902/* 0x09ef: ctx_mmio_exec */
902 0x9800f807, 903 0x9800f808,
903 0x07f14103, 904 0x07f14103,
904 0x03f08100, 905 0x03f08100,
905 0x0003d002, 906 0x0003d002,
906 0x34bd04bd, 907 0x34bd04bd,
907/* 0x09fc: ctx_mmio_loop */ 908/* 0x0a00: ctx_mmio_loop */
908 0xf4ff34c4, 909 0xf4ff34c4,
909 0x57f10f1b, 910 0x57f10f1b,
910 0x53f00200, 911 0x53f00200,
911 0x0535fa06, 912 0x0535fa06,
912/* 0x0a0e: ctx_mmio_pull */ 913/* 0x0a12: ctx_mmio_pull */
913 0x4e9803f8, 914 0x4e9803f8,
914 0x814f9880, 915 0x814f9880,
915 0xb69d21f4, 916 0xb69d21f4,
916 0x12b60830, 917 0x12b60830,
917 0xdf1bf401, 918 0xdf1bf401,
918/* 0x0a20: ctx_mmio_done */ 919/* 0x0a24: ctx_mmio_done */
919 0xf1160398, 920 0xf1160398,
920 0xf0810007, 921 0xf0810007,
921 0x03d00203, 922 0x03d00203,
@@ -924,30 +925,30 @@ uint32_t gf100_grhub_code[] = {
924 0x13f00100, 925 0x13f00100,
925 0x0601fa06, 926 0x0601fa06,
926 0x00f803f8, 927 0x00f803f8,
927/* 0x0a40: ctx_xfer */ 928/* 0x0a44: ctx_xfer */
928 0xf104e7f0, 929 0xf104e7f0,
929 0xf0020007, 930 0xf0020007,
930 0x0ed00303, 931 0x0ed00303,
931/* 0x0a4f: ctx_xfer_idle */ 932/* 0x0a53: ctx_xfer_idle */
932 0xf104bd00, 933 0xf104bd00,
933 0xf00000e7, 934 0xf00000e7,
934 0xeecf03e3, 935 0xeecf03e3,
935 0x00e4f100, 936 0x00e4f100,
936 0xf21bf420, 937 0xf21bf420,
937 0xf40611f4, 938 0xf40611f4,
938/* 0x0a66: ctx_xfer_pre */ 939/* 0x0a6a: ctx_xfer_pre */
939 0xf7f01102, 940 0xf7f01102,
940 0x6c21f510, 941 0x7021f510,
941 0xd721f508, 942 0xdb21f508,
942 0x1c11f407, 943 0x1c11f407,
943/* 0x0a74: ctx_xfer_pre_load */ 944/* 0x0a78: ctx_xfer_pre_load */
944 0xf502f7f0, 945 0xf502f7f0,
945 0xf5080d21, 946 0xf5081121,
946 0xf5081f21, 947 0xf5082321,
947 0xbd083421, 948 0xbd083821,
948 0x0d21f5f4, 949 0x1121f5f4,
949 0xb221f508, 950 0xb621f508,
950/* 0x0a8d: ctx_xfer_exec */ 951/* 0x0a91: ctx_xfer_exec */
951 0x16019808, 952 0x16019808,
952 0x07f124bd, 953 0x07f124bd,
953 0x03f00500, 954 0x03f00500,
@@ -982,24 +983,23 @@ uint32_t gf100_grhub_code[] = {
982 0x1301f402, 983 0x1301f402,
983 0xf40ca7f0, 984 0xf40ca7f0,
984 0xf7f0d021, 985 0xf7f0d021,
985 0x9421f505, 986 0x9821f505,
986 0x3202f408, 987 0x3202f408,
987/* 0x0b1c: ctx_xfer_post */ 988/* 0x0b20: ctx_xfer_post */
988 0xf502f7f0, 989 0xf502f7f0,
989 0xbd080d21, 990 0xbd081121,
990 0x6c21f5f4, 991 0x7021f5f4,
991 0x7f21f508, 992 0x7f21f508,
992 0x1f21f502, 993 0x2321f502,
993 0xf5f4bd08, 994 0xf5f4bd08,
994 0xf4080d21, 995 0xf4081121,
995 0x01981011, 996 0x01981011,
996 0x0511fd40, 997 0x0511fd40,
997 0xf5070bf4, 998 0xf5070bf4,
998/* 0x0b47: ctx_xfer_no_post_mmio */ 999/* 0x0b4b: ctx_xfer_no_post_mmio */
999 0xf509eb21, 1000 0xf509ef21,
1000/* 0x0b4b: ctx_xfer_done */ 1001/* 0x0b4f: ctx_xfer_done */
1001 0xf807fc21, 1002 0xf8080021,
1002 0x00000000,
1003 0x00000000, 1003 0x00000000,
1004 0x00000000, 1004 0x00000000,
1005 0x00000000, 1005 0x00000000,
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgf117.fuc3.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgf117.fuc3.h
index 7cb14e59dea1..50c97163dcdb 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgf117.fuc3.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgf117.fuc3.h
@@ -528,10 +528,10 @@ uint32_t gf117_grhub_code[] = {
528 0x0001d001, 528 0x0001d001,
529 0x17f104bd, 529 0x17f104bd,
530 0xf7f00100, 530 0xf7f00100,
531 0x0d21f502, 531 0x1121f502,
532 0x1f21f508, 532 0x2321f508,
533 0x10f7f008, 533 0x10f7f008,
534 0x086c21f5, 534 0x087021f5,
535 0x98000e98, 535 0x98000e98,
536 0x21f5010f, 536 0x21f5010f,
537 0x14950150, 537 0x14950150,
@@ -574,9 +574,9 @@ uint32_t gf117_grhub_code[] = {
574 0xb6800040, 574 0xb6800040,
575 0x1bf40132, 575 0x1bf40132,
576 0x00f7f0be, 576 0x00f7f0be,
577 0x086c21f5, 577 0x087021f5,
578 0xf500f7f0, 578 0xf500f7f0,
579 0xf1080d21, 579 0xf1081121,
580 0xf0010007, 580 0xf0010007,
581 0x01d00203, 581 0x01d00203,
582 0xbd04bd00, 582 0xbd04bd00,
@@ -610,7 +610,7 @@ uint32_t gf117_grhub_code[] = {
610 0x09d00203, 610 0x09d00203,
611 0xf404bd00, 611 0xf404bd00,
612 0x31f40132, 612 0x31f40132,
613 0x4021f502, 613 0x4421f502,
614 0xf094bd0a, 614 0xf094bd0a,
615 0x07f10799, 615 0x07f10799,
616 0x03f01700, 616 0x03f01700,
@@ -621,7 +621,7 @@ uint32_t gf117_grhub_code[] = {
621 0x0203f00f, 621 0x0203f00f,
622 0xbd0009d0, 622 0xbd0009d0,
623 0x0131f404, 623 0x0131f404,
624 0x0a4021f5, 624 0x0a4421f5,
625 0x99f094bd, 625 0x99f094bd,
626 0x0007f106, 626 0x0007f106,
627 0x0203f017, 627 0x0203f017,
@@ -631,7 +631,7 @@ uint32_t gf117_grhub_code[] = {
631 0x12b920f9, 631 0x12b920f9,
632 0x0132f402, 632 0x0132f402,
633 0xf50232f4, 633 0xf50232f4,
634 0xfc0a4021, 634 0xfc0a4421,
635 0x0007f120, 635 0x0007f120,
636 0x0203f0c0, 636 0x0203f0c0,
637 0xbd0002d0, 637 0xbd0002d0,
@@ -640,7 +640,7 @@ uint32_t gf117_grhub_code[] = {
640 0xf41f23c8, 640 0xf41f23c8,
641 0x31f40d0b, 641 0x31f40d0b,
642 0x0232f401, 642 0x0232f401,
643 0x0a4021f5, 643 0x0a4421f5,
644/* 0x063c: chsw_done */ 644/* 0x063c: chsw_done */
645 0xf10127f0, 645 0xf10127f0,
646 0xf0c30007, 646 0xf0c30007,
@@ -654,7 +654,7 @@ uint32_t gf117_grhub_code[] = {
654/* 0x0660: main_not_ctx_switch */ 654/* 0x0660: main_not_ctx_switch */
655 0xf401e4b0, 655 0xf401e4b0,
656 0xf2b90d1b, 656 0xf2b90d1b,
657 0xd021f502, 657 0xd421f502,
658 0x460ef409, 658 0x460ef409,
659/* 0x0670: main_not_ctx_chan */ 659/* 0x0670: main_not_ctx_chan */
660 0xf402e4b0, 660 0xf402e4b0,
@@ -664,7 +664,7 @@ uint32_t gf117_grhub_code[] = {
664 0x09d00203, 664 0x09d00203,
665 0xf404bd00, 665 0xf404bd00,
666 0x32f40132, 666 0x32f40132,
667 0x4021f502, 667 0x4421f502,
668 0xf094bd0a, 668 0xf094bd0a,
669 0x07f10799, 669 0x07f10799,
670 0x03f01700, 670 0x03f01700,
@@ -682,107 +682,108 @@ uint32_t gf117_grhub_code[] = {
682 0x04bd0002, 682 0x04bd0002,
683 0xfea00ef5, 683 0xfea00ef5,
684/* 0x06c8: ih */ 684/* 0x06c8: ih */
685 0x88fe80f9, 685 0x80f900f9,
686 0xf980f901, 686 0xf90188fe,
687 0xf9a0f990, 687 0xf990f980,
688 0xf9d0f9b0, 688 0xf9b0f9a0,
689 0xbdf0f9e0, 689 0xf9e0f9d0,
690 0x00a7f104, 690 0xf104bdf0,
691 0x00a3f002, 691 0xf00200a7,
692 0xc400aacf, 692 0xaacf00a3,
693 0x0bf404ab, 693 0x04abc400,
694 0x10d7f030, 694 0xf0300bf4,
695 0x1a00e7f1, 695 0xe7f110d7,
696 0xcf00e3f0, 696 0xe3f01a00,
697 0xf7f100ee, 697 0x00eecf00,
698 0xf3f01900, 698 0x1900f7f1,
699 0x00ffcf00, 699 0xcf00f3f0,
700 0xb70421f4, 700 0x21f400ff,
701 0xf00400b0, 701 0x00b0b704,
702 0x07f101e7, 702 0x01e7f004,
703 0x03f01d00, 703 0x1d0007f1,
704 0x000ed000, 704 0xd00003f0,
705/* 0x071a: ih_no_fifo */ 705 0x04bd000e,
706 0xabe404bd, 706/* 0x071c: ih_no_fifo */
707 0x0bf40100, 707 0x0100abe4,
708 0x10d7f00d, 708 0xf00d0bf4,
709 0x4001e7f1, 709 0xe7f110d7,
710/* 0x072b: ih_no_ctxsw */ 710 0x21f44001,
711 0xe40421f4, 711/* 0x072d: ih_no_ctxsw */
712 0xf40400ab, 712 0x00abe404,
713 0xe7f16c0b, 713 0x6c0bf404,
714 0xe3f00708, 714 0x0708e7f1,
715 0x6821f440, 715 0xf440e3f0,
716 0xf102ffb9, 716 0xffb96821,
717 0xf0040007, 717 0x0007f102,
718 0x0fd00203, 718 0x0203f004,
719 0xf104bd00, 719 0xbd000fd0,
720 0xf00704e7, 720 0x04e7f104,
721 0x40e3f007,
722 0xb96821f4,
723 0x07f102ff,
724 0x03f00300,
725 0x000fd002,
726 0xfec704bd,
727 0x02ee9450,
728 0x0700f7f1,
729 0xbb40f3f0,
730 0x21f400ef,
731 0x0007f168,
732 0x0203f002,
733 0xbd000fd0,
734 0x03f7f004,
735 0x037e21f5,
736 0x0100b7f1,
737 0xf102bfb9,
738 0xf00144e7,
721 0x21f440e3, 739 0x21f440e3,
722 0x02ffb968, 740/* 0x079d: ih_no_fwmthd */
723 0x030007f1, 741 0x04b7f19d,
724 0xd00203f0, 742 0xffb0bd05,
725 0x04bd000f, 743 0x0bf4b4ab,
726 0x9450fec7, 744 0x0007f10f,
727 0xf7f102ee, 745 0x0303f007,
728 0xf3f00700, 746 0xbd000bd0,
729 0x00efbb40, 747/* 0x07b5: ih_no_other */
730 0xf16821f4, 748 0x0007f104,
731 0xf0020007, 749 0x0003f001,
732 0x0fd00203, 750 0xbd000ad0,
733 0xf004bd00, 751 0xfcf0fc04,
734 0x21f503f7, 752 0xfcd0fce0,
735 0xb7f1037e, 753 0xfca0fcb0,
736 0xbfb90100, 754 0xfe80fc90,
737 0x44e7f102, 755 0x80fc0088,
738 0x40e3f001, 756 0x32f400fc,
739/* 0x079b: ih_no_fwmthd */ 757/* 0x07db: ctx_4160s */
740 0xf19d21f4,
741 0xbd0504b7,
742 0xb4abffb0,
743 0xf10f0bf4,
744 0xf0070007,
745 0x0bd00303,
746/* 0x07b3: ih_no_other */
747 0xf104bd00,
748 0xf0010007,
749 0x0ad00003,
750 0xfc04bd00,
751 0xfce0fcf0,
752 0xfcb0fcd0,
753 0xfc90fca0,
754 0x0088fe80,
755 0x32f480fc,
756/* 0x07d7: ctx_4160s */
757 0xf001f800, 758 0xf001f800,
758 0xffb901f7, 759 0xffb901f7,
759 0x60e7f102, 760 0x60e7f102,
760 0x40e3f041, 761 0x40e3f041,
761/* 0x07e7: ctx_4160s_wait */ 762/* 0x07eb: ctx_4160s_wait */
762 0xf19d21f4, 763 0xf19d21f4,
763 0xf04160e7, 764 0xf04160e7,
764 0x21f440e3, 765 0x21f440e3,
765 0x02ffb968, 766 0x02ffb968,
766 0xf404ffc8, 767 0xf404ffc8,
767 0x00f8f00b, 768 0x00f8f00b,
768/* 0x07fc: ctx_4160c */ 769/* 0x0800: ctx_4160c */
769 0xffb9f4bd, 770 0xffb9f4bd,
770 0x60e7f102, 771 0x60e7f102,
771 0x40e3f041, 772 0x40e3f041,
772 0xf89d21f4, 773 0xf89d21f4,
773/* 0x080d: ctx_4170s */ 774/* 0x0811: ctx_4170s */
774 0x10f5f000, 775 0x10f5f000,
775 0xf102ffb9, 776 0xf102ffb9,
776 0xf04170e7, 777 0xf04170e7,
777 0x21f440e3, 778 0x21f440e3,
778/* 0x081f: ctx_4170w */ 779/* 0x0823: ctx_4170w */
779 0xf100f89d, 780 0xf100f89d,
780 0xf04170e7, 781 0xf04170e7,
781 0x21f440e3, 782 0x21f440e3,
782 0x02ffb968, 783 0x02ffb968,
783 0xf410f4f0, 784 0xf410f4f0,
784 0x00f8f01b, 785 0x00f8f01b,
785/* 0x0834: ctx_redswitch */ 786/* 0x0838: ctx_redswitch */
786 0x0200e7f1, 787 0x0200e7f1,
787 0xf040e5f0, 788 0xf040e5f0,
788 0xe5f020e5, 789 0xe5f020e5,
@@ -790,7 +791,7 @@ uint32_t gf117_grhub_code[] = {
790 0x0103f085, 791 0x0103f085,
791 0xbd000ed0, 792 0xbd000ed0,
792 0x08f7f004, 793 0x08f7f004,
793/* 0x0850: ctx_redswitch_delay */ 794/* 0x0854: ctx_redswitch_delay */
794 0xf401f2b6, 795 0xf401f2b6,
795 0xe5f1fd1b, 796 0xe5f1fd1b,
796 0xe5f10400, 797 0xe5f10400,
@@ -798,7 +799,7 @@ uint32_t gf117_grhub_code[] = {
798 0x03f08500, 799 0x03f08500,
799 0x000ed001, 800 0x000ed001,
800 0x00f804bd, 801 0x00f804bd,
801/* 0x086c: ctx_86c */ 802/* 0x0870: ctx_86c */
802 0x1b0007f1, 803 0x1b0007f1,
803 0xd00203f0, 804 0xd00203f0,
804 0x04bd000f, 805 0x04bd000f,
@@ -809,16 +810,16 @@ uint32_t gf117_grhub_code[] = {
809 0xa86ce7f1, 810 0xa86ce7f1,
810 0xf441e3f0, 811 0xf441e3f0,
811 0x00f89d21, 812 0x00f89d21,
812/* 0x0894: ctx_mem */ 813/* 0x0898: ctx_mem */
813 0x840007f1, 814 0x840007f1,
814 0xd00203f0, 815 0xd00203f0,
815 0x04bd000f, 816 0x04bd000f,
816/* 0x08a0: ctx_mem_wait */ 817/* 0x08a4: ctx_mem_wait */
817 0x8400f7f1, 818 0x8400f7f1,
818 0xcf02f3f0, 819 0xcf02f3f0,
819 0xfffd00ff, 820 0xfffd00ff,
820 0xf31bf405, 821 0xf31bf405,
821/* 0x08b2: ctx_load */ 822/* 0x08b6: ctx_load */
822 0x94bd00f8, 823 0x94bd00f8,
823 0xf10599f0, 824 0xf10599f0,
824 0xf00f0007, 825 0xf00f0007,
@@ -836,7 +837,7 @@ uint32_t gf117_grhub_code[] = {
836 0x02d00203, 837 0x02d00203,
837 0xf004bd00, 838 0xf004bd00,
838 0x21f507f7, 839 0x21f507f7,
839 0x07f10894, 840 0x07f10898,
840 0x03f0c000, 841 0x03f0c000,
841 0x0002d002, 842 0x0002d002,
842 0x0bfe04bd, 843 0x0bfe04bd,
@@ -891,31 +892,31 @@ uint32_t gf117_grhub_code[] = {
891 0x03f01700, 892 0x03f01700,
892 0x0009d002, 893 0x0009d002,
893 0x00f804bd, 894 0x00f804bd,
894/* 0x09d0: ctx_chan */ 895/* 0x09d4: ctx_chan */
895 0x07d721f5, 896 0x07db21f5,
896 0x08b221f5, 897 0x08b621f5,
897 0xf40ca7f0, 898 0xf40ca7f0,
898 0xf7f0d021, 899 0xf7f0d021,
899 0x9421f505, 900 0x9821f505,
900 0xfc21f508, 901 0x0021f508,
901/* 0x09eb: ctx_mmio_exec */ 902/* 0x09ef: ctx_mmio_exec */
902 0x9800f807, 903 0x9800f808,
903 0x07f14103, 904 0x07f14103,
904 0x03f08100, 905 0x03f08100,
905 0x0003d002, 906 0x0003d002,
906 0x34bd04bd, 907 0x34bd04bd,
907/* 0x09fc: ctx_mmio_loop */ 908/* 0x0a00: ctx_mmio_loop */
908 0xf4ff34c4, 909 0xf4ff34c4,
909 0x57f10f1b, 910 0x57f10f1b,
910 0x53f00200, 911 0x53f00200,
911 0x0535fa06, 912 0x0535fa06,
912/* 0x0a0e: ctx_mmio_pull */ 913/* 0x0a12: ctx_mmio_pull */
913 0x4e9803f8, 914 0x4e9803f8,
914 0x814f9880, 915 0x814f9880,
915 0xb69d21f4, 916 0xb69d21f4,
916 0x12b60830, 917 0x12b60830,
917 0xdf1bf401, 918 0xdf1bf401,
918/* 0x0a20: ctx_mmio_done */ 919/* 0x0a24: ctx_mmio_done */
919 0xf1160398, 920 0xf1160398,
920 0xf0810007, 921 0xf0810007,
921 0x03d00203, 922 0x03d00203,
@@ -924,30 +925,30 @@ uint32_t gf117_grhub_code[] = {
924 0x13f00100, 925 0x13f00100,
925 0x0601fa06, 926 0x0601fa06,
926 0x00f803f8, 927 0x00f803f8,
927/* 0x0a40: ctx_xfer */ 928/* 0x0a44: ctx_xfer */
928 0xf104e7f0, 929 0xf104e7f0,
929 0xf0020007, 930 0xf0020007,
930 0x0ed00303, 931 0x0ed00303,
931/* 0x0a4f: ctx_xfer_idle */ 932/* 0x0a53: ctx_xfer_idle */
932 0xf104bd00, 933 0xf104bd00,
933 0xf00000e7, 934 0xf00000e7,
934 0xeecf03e3, 935 0xeecf03e3,
935 0x00e4f100, 936 0x00e4f100,
936 0xf21bf420, 937 0xf21bf420,
937 0xf40611f4, 938 0xf40611f4,
938/* 0x0a66: ctx_xfer_pre */ 939/* 0x0a6a: ctx_xfer_pre */
939 0xf7f01102, 940 0xf7f01102,
940 0x6c21f510, 941 0x7021f510,
941 0xd721f508, 942 0xdb21f508,
942 0x1c11f407, 943 0x1c11f407,
943/* 0x0a74: ctx_xfer_pre_load */ 944/* 0x0a78: ctx_xfer_pre_load */
944 0xf502f7f0, 945 0xf502f7f0,
945 0xf5080d21, 946 0xf5081121,
946 0xf5081f21, 947 0xf5082321,
947 0xbd083421, 948 0xbd083821,
948 0x0d21f5f4, 949 0x1121f5f4,
949 0xb221f508, 950 0xb621f508,
950/* 0x0a8d: ctx_xfer_exec */ 951/* 0x0a91: ctx_xfer_exec */
951 0x16019808, 952 0x16019808,
952 0x07f124bd, 953 0x07f124bd,
953 0x03f00500, 954 0x03f00500,
@@ -982,24 +983,23 @@ uint32_t gf117_grhub_code[] = {
982 0x1301f402, 983 0x1301f402,
983 0xf40ca7f0, 984 0xf40ca7f0,
984 0xf7f0d021, 985 0xf7f0d021,
985 0x9421f505, 986 0x9821f505,
986 0x3202f408, 987 0x3202f408,
987/* 0x0b1c: ctx_xfer_post */ 988/* 0x0b20: ctx_xfer_post */
988 0xf502f7f0, 989 0xf502f7f0,
989 0xbd080d21, 990 0xbd081121,
990 0x6c21f5f4, 991 0x7021f5f4,
991 0x7f21f508, 992 0x7f21f508,
992 0x1f21f502, 993 0x2321f502,
993 0xf5f4bd08, 994 0xf5f4bd08,
994 0xf4080d21, 995 0xf4081121,
995 0x01981011, 996 0x01981011,
996 0x0511fd40, 997 0x0511fd40,
997 0xf5070bf4, 998 0xf5070bf4,
998/* 0x0b47: ctx_xfer_no_post_mmio */ 999/* 0x0b4b: ctx_xfer_no_post_mmio */
999 0xf509eb21, 1000 0xf509ef21,
1000/* 0x0b4b: ctx_xfer_done */ 1001/* 0x0b4f: ctx_xfer_done */
1001 0xf807fc21, 1002 0xf8080021,
1002 0x00000000,
1003 0x00000000, 1003 0x00000000,
1004 0x00000000, 1004 0x00000000,
1005 0x00000000, 1005 0x00000000,
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk104.fuc3.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk104.fuc3.h
index 95ac15110049..125824b394bb 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk104.fuc3.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk104.fuc3.h
@@ -528,10 +528,10 @@ uint32_t gk104_grhub_code[] = {
528 0x0001d001, 528 0x0001d001,
529 0x17f104bd, 529 0x17f104bd,
530 0xf7f00100, 530 0xf7f00100,
531 0xd721f502, 531 0xdb21f502,
532 0xe921f507, 532 0xed21f507,
533 0x10f7f007, 533 0x10f7f007,
534 0x083621f5, 534 0x083a21f5,
535 0x98000e98, 535 0x98000e98,
536 0x21f5010f, 536 0x21f5010f,
537 0x14950150, 537 0x14950150,
@@ -574,9 +574,9 @@ uint32_t gk104_grhub_code[] = {
574 0xb6800040, 574 0xb6800040,
575 0x1bf40132, 575 0x1bf40132,
576 0x00f7f0be, 576 0x00f7f0be,
577 0x083621f5, 577 0x083a21f5,
578 0xf500f7f0, 578 0xf500f7f0,
579 0xf107d721, 579 0xf107db21,
580 0xf0010007, 580 0xf0010007,
581 0x01d00203, 581 0x01d00203,
582 0xbd04bd00, 582 0xbd04bd00,
@@ -610,7 +610,7 @@ uint32_t gk104_grhub_code[] = {
610 0x09d00203, 610 0x09d00203,
611 0xf404bd00, 611 0xf404bd00,
612 0x31f40132, 612 0x31f40132,
613 0x0221f502, 613 0x0621f502,
614 0xf094bd0a, 614 0xf094bd0a,
615 0x07f10799, 615 0x07f10799,
616 0x03f01700, 616 0x03f01700,
@@ -621,7 +621,7 @@ uint32_t gk104_grhub_code[] = {
621 0x0203f00f, 621 0x0203f00f,
622 0xbd0009d0, 622 0xbd0009d0,
623 0x0131f404, 623 0x0131f404,
624 0x0a0221f5, 624 0x0a0621f5,
625 0x99f094bd, 625 0x99f094bd,
626 0x0007f106, 626 0x0007f106,
627 0x0203f017, 627 0x0203f017,
@@ -631,7 +631,7 @@ uint32_t gk104_grhub_code[] = {
631 0x12b920f9, 631 0x12b920f9,
632 0x0132f402, 632 0x0132f402,
633 0xf50232f4, 633 0xf50232f4,
634 0xfc0a0221, 634 0xfc0a0621,
635 0x0007f120, 635 0x0007f120,
636 0x0203f0c0, 636 0x0203f0c0,
637 0xbd0002d0, 637 0xbd0002d0,
@@ -640,7 +640,7 @@ uint32_t gk104_grhub_code[] = {
640 0xf41f23c8, 640 0xf41f23c8,
641 0x31f40d0b, 641 0x31f40d0b,
642 0x0232f401, 642 0x0232f401,
643 0x0a0221f5, 643 0x0a0621f5,
644/* 0x063c: chsw_done */ 644/* 0x063c: chsw_done */
645 0xf10127f0, 645 0xf10127f0,
646 0xf0c30007, 646 0xf0c30007,
@@ -654,7 +654,7 @@ uint32_t gk104_grhub_code[] = {
654/* 0x0660: main_not_ctx_switch */ 654/* 0x0660: main_not_ctx_switch */
655 0xf401e4b0, 655 0xf401e4b0,
656 0xf2b90d1b, 656 0xf2b90d1b,
657 0x9a21f502, 657 0x9e21f502,
658 0x460ef409, 658 0x460ef409,
659/* 0x0670: main_not_ctx_chan */ 659/* 0x0670: main_not_ctx_chan */
660 0xf402e4b0, 660 0xf402e4b0,
@@ -664,7 +664,7 @@ uint32_t gk104_grhub_code[] = {
664 0x09d00203, 664 0x09d00203,
665 0xf404bd00, 665 0xf404bd00,
666 0x32f40132, 666 0x32f40132,
667 0x0221f502, 667 0x0621f502,
668 0xf094bd0a, 668 0xf094bd0a,
669 0x07f10799, 669 0x07f10799,
670 0x03f01700, 670 0x03f01700,
@@ -682,90 +682,91 @@ uint32_t gk104_grhub_code[] = {
682 0x04bd0002, 682 0x04bd0002,
683 0xfea00ef5, 683 0xfea00ef5,
684/* 0x06c8: ih */ 684/* 0x06c8: ih */
685 0x88fe80f9, 685 0x80f900f9,
686 0xf980f901, 686 0xf90188fe,
687 0xf9a0f990, 687 0xf990f980,
688 0xf9d0f9b0, 688 0xf9b0f9a0,
689 0xbdf0f9e0, 689 0xf9e0f9d0,
690 0x00a7f104, 690 0xf104bdf0,
691 0x00a3f002, 691 0xf00200a7,
692 0xc400aacf, 692 0xaacf00a3,
693 0x0bf404ab, 693 0x04abc400,
694 0x10d7f030, 694 0xf0300bf4,
695 0x1a00e7f1, 695 0xe7f110d7,
696 0xcf00e3f0, 696 0xe3f01a00,
697 0xf7f100ee, 697 0x00eecf00,
698 0xf3f01900, 698 0x1900f7f1,
699 0x00ffcf00, 699 0xcf00f3f0,
700 0xb70421f4, 700 0x21f400ff,
701 0xf00400b0, 701 0x00b0b704,
702 0x07f101e7, 702 0x01e7f004,
703 0x03f01d00, 703 0x1d0007f1,
704 0x000ed000, 704 0xd00003f0,
705/* 0x071a: ih_no_fifo */ 705 0x04bd000e,
706 0xabe404bd, 706/* 0x071c: ih_no_fifo */
707 0x0bf40100, 707 0x0100abe4,
708 0x10d7f00d, 708 0xf00d0bf4,
709 0x4001e7f1, 709 0xe7f110d7,
710/* 0x072b: ih_no_ctxsw */ 710 0x21f44001,
711 0xe40421f4, 711/* 0x072d: ih_no_ctxsw */
712 0xf40400ab, 712 0x00abe404,
713 0xe7f16c0b, 713 0x6c0bf404,
714 0xe3f00708, 714 0x0708e7f1,
715 0x6821f440, 715 0xf440e3f0,
716 0xf102ffb9, 716 0xffb96821,
717 0xf0040007, 717 0x0007f102,
718 0x0fd00203, 718 0x0203f004,
719 0xf104bd00, 719 0xbd000fd0,
720 0xf00704e7, 720 0x04e7f104,
721 0x40e3f007,
722 0xb96821f4,
723 0x07f102ff,
724 0x03f00300,
725 0x000fd002,
726 0xfec704bd,
727 0x02ee9450,
728 0x0700f7f1,
729 0xbb40f3f0,
730 0x21f400ef,
731 0x0007f168,
732 0x0203f002,
733 0xbd000fd0,
734 0x03f7f004,
735 0x037e21f5,
736 0x0100b7f1,
737 0xf102bfb9,
738 0xf00144e7,
721 0x21f440e3, 739 0x21f440e3,
722 0x02ffb968, 740/* 0x079d: ih_no_fwmthd */
723 0x030007f1, 741 0x04b7f19d,
724 0xd00203f0, 742 0xffb0bd05,
725 0x04bd000f, 743 0x0bf4b4ab,
726 0x9450fec7, 744 0x0007f10f,
727 0xf7f102ee, 745 0x0303f007,
728 0xf3f00700, 746 0xbd000bd0,
729 0x00efbb40, 747/* 0x07b5: ih_no_other */
730 0xf16821f4, 748 0x0007f104,
731 0xf0020007, 749 0x0003f001,
732 0x0fd00203, 750 0xbd000ad0,
733 0xf004bd00, 751 0xfcf0fc04,
734 0x21f503f7, 752 0xfcd0fce0,
735 0xb7f1037e, 753 0xfca0fcb0,
736 0xbfb90100, 754 0xfe80fc90,
737 0x44e7f102, 755 0x80fc0088,
738 0x40e3f001, 756 0x32f400fc,
739/* 0x079b: ih_no_fwmthd */ 757/* 0x07db: ctx_4170s */
740 0xf19d21f4,
741 0xbd0504b7,
742 0xb4abffb0,
743 0xf10f0bf4,
744 0xf0070007,
745 0x0bd00303,
746/* 0x07b3: ih_no_other */
747 0xf104bd00,
748 0xf0010007,
749 0x0ad00003,
750 0xfc04bd00,
751 0xfce0fcf0,
752 0xfcb0fcd0,
753 0xfc90fca0,
754 0x0088fe80,
755 0x32f480fc,
756/* 0x07d7: ctx_4170s */
757 0xf001f800, 758 0xf001f800,
758 0xffb910f5, 759 0xffb910f5,
759 0x70e7f102, 760 0x70e7f102,
760 0x40e3f041, 761 0x40e3f041,
761 0xf89d21f4, 762 0xf89d21f4,
762/* 0x07e9: ctx_4170w */ 763/* 0x07ed: ctx_4170w */
763 0x70e7f100, 764 0x70e7f100,
764 0x40e3f041, 765 0x40e3f041,
765 0xb96821f4, 766 0xb96821f4,
766 0xf4f002ff, 767 0xf4f002ff,
767 0xf01bf410, 768 0xf01bf410,
768/* 0x07fe: ctx_redswitch */ 769/* 0x0802: ctx_redswitch */
769 0xe7f100f8, 770 0xe7f100f8,
770 0xe5f00200, 771 0xe5f00200,
771 0x20e5f040, 772 0x20e5f040,
@@ -773,7 +774,7 @@ uint32_t gk104_grhub_code[] = {
773 0xf0850007, 774 0xf0850007,
774 0x0ed00103, 775 0x0ed00103,
775 0xf004bd00, 776 0xf004bd00,
776/* 0x081a: ctx_redswitch_delay */ 777/* 0x081e: ctx_redswitch_delay */
777 0xf2b608f7, 778 0xf2b608f7,
778 0xfd1bf401, 779 0xfd1bf401,
779 0x0400e5f1, 780 0x0400e5f1,
@@ -781,7 +782,7 @@ uint32_t gk104_grhub_code[] = {
781 0x850007f1, 782 0x850007f1,
782 0xd00103f0, 783 0xd00103f0,
783 0x04bd000e, 784 0x04bd000e,
784/* 0x0836: ctx_86c */ 785/* 0x083a: ctx_86c */
785 0x07f100f8, 786 0x07f100f8,
786 0x03f01b00, 787 0x03f01b00,
787 0x000fd002, 788 0x000fd002,
@@ -792,17 +793,17 @@ uint32_t gk104_grhub_code[] = {
792 0xe7f102ff, 793 0xe7f102ff,
793 0xe3f0a86c, 794 0xe3f0a86c,
794 0x9d21f441, 795 0x9d21f441,
795/* 0x085e: ctx_mem */ 796/* 0x0862: ctx_mem */
796 0x07f100f8, 797 0x07f100f8,
797 0x03f08400, 798 0x03f08400,
798 0x000fd002, 799 0x000fd002,
799/* 0x086a: ctx_mem_wait */ 800/* 0x086e: ctx_mem_wait */
800 0xf7f104bd, 801 0xf7f104bd,
801 0xf3f08400, 802 0xf3f08400,
802 0x00ffcf02, 803 0x00ffcf02,
803 0xf405fffd, 804 0xf405fffd,
804 0x00f8f31b, 805 0x00f8f31b,
805/* 0x087c: ctx_load */ 806/* 0x0880: ctx_load */
806 0x99f094bd, 807 0x99f094bd,
807 0x0007f105, 808 0x0007f105,
808 0x0203f00f, 809 0x0203f00f,
@@ -819,7 +820,7 @@ uint32_t gk104_grhub_code[] = {
819 0x0203f083, 820 0x0203f083,
820 0xbd0002d0, 821 0xbd0002d0,
821 0x07f7f004, 822 0x07f7f004,
822 0x085e21f5, 823 0x086221f5,
823 0xc00007f1, 824 0xc00007f1,
824 0xd00203f0, 825 0xd00203f0,
825 0x04bd0002, 826 0x04bd0002,
@@ -874,29 +875,29 @@ uint32_t gk104_grhub_code[] = {
874 0x170007f1, 875 0x170007f1,
875 0xd00203f0, 876 0xd00203f0,
876 0x04bd0009, 877 0x04bd0009,
877/* 0x099a: ctx_chan */ 878/* 0x099e: ctx_chan */
878 0x21f500f8, 879 0x21f500f8,
879 0xa7f0087c, 880 0xa7f00880,
880 0xd021f40c, 881 0xd021f40c,
881 0xf505f7f0, 882 0xf505f7f0,
882 0xf8085e21, 883 0xf8086221,
883/* 0x09ad: ctx_mmio_exec */ 884/* 0x09b1: ctx_mmio_exec */
884 0x41039800, 885 0x41039800,
885 0x810007f1, 886 0x810007f1,
886 0xd00203f0, 887 0xd00203f0,
887 0x04bd0003, 888 0x04bd0003,
888/* 0x09be: ctx_mmio_loop */ 889/* 0x09c2: ctx_mmio_loop */
889 0x34c434bd, 890 0x34c434bd,
890 0x0f1bf4ff, 891 0x0f1bf4ff,
891 0x020057f1, 892 0x020057f1,
892 0xfa0653f0, 893 0xfa0653f0,
893 0x03f80535, 894 0x03f80535,
894/* 0x09d0: ctx_mmio_pull */ 895/* 0x09d4: ctx_mmio_pull */
895 0x98804e98, 896 0x98804e98,
896 0x21f4814f, 897 0x21f4814f,
897 0x0830b69d, 898 0x0830b69d,
898 0xf40112b6, 899 0xf40112b6,
899/* 0x09e2: ctx_mmio_done */ 900/* 0x09e6: ctx_mmio_done */
900 0x0398df1b, 901 0x0398df1b,
901 0x0007f116, 902 0x0007f116,
902 0x0203f081, 903 0x0203f081,
@@ -905,30 +906,30 @@ uint32_t gk104_grhub_code[] = {
905 0x010017f1, 906 0x010017f1,
906 0xfa0613f0, 907 0xfa0613f0,
907 0x03f80601, 908 0x03f80601,
908/* 0x0a02: ctx_xfer */ 909/* 0x0a06: ctx_xfer */
909 0xe7f000f8, 910 0xe7f000f8,
910 0x0007f104, 911 0x0007f104,
911 0x0303f002, 912 0x0303f002,
912 0xbd000ed0, 913 0xbd000ed0,
913/* 0x0a11: ctx_xfer_idle */ 914/* 0x0a15: ctx_xfer_idle */
914 0x00e7f104, 915 0x00e7f104,
915 0x03e3f000, 916 0x03e3f000,
916 0xf100eecf, 917 0xf100eecf,
917 0xf42000e4, 918 0xf42000e4,
918 0x11f4f21b, 919 0x11f4f21b,
919 0x0d02f406, 920 0x0d02f406,
920/* 0x0a28: ctx_xfer_pre */ 921/* 0x0a2c: ctx_xfer_pre */
921 0xf510f7f0, 922 0xf510f7f0,
922 0xf4083621, 923 0xf4083a21,
923/* 0x0a32: ctx_xfer_pre_load */ 924/* 0x0a36: ctx_xfer_pre_load */
924 0xf7f01c11, 925 0xf7f01c11,
925 0xd721f502, 926 0xdb21f502,
926 0xe921f507, 927 0xed21f507,
927 0xfe21f507, 928 0x0221f507,
928 0xf5f4bd07, 929 0xf5f4bd08,
929 0xf507d721, 930 0xf507db21,
930/* 0x0a4b: ctx_xfer_exec */ 931/* 0x0a4f: ctx_xfer_exec */
931 0x98087c21, 932 0x98088021,
932 0x24bd1601, 933 0x24bd1601,
933 0x050007f1, 934 0x050007f1,
934 0xd00103f0, 935 0xd00103f0,
@@ -963,21 +964,21 @@ uint32_t gk104_grhub_code[] = {
963 0xa7f01301, 964 0xa7f01301,
964 0xd021f40c, 965 0xd021f40c,
965 0xf505f7f0, 966 0xf505f7f0,
966 0xf4085e21, 967 0xf4086221,
967/* 0x0ada: ctx_xfer_post */ 968/* 0x0ade: ctx_xfer_post */
968 0xf7f02e02, 969 0xf7f02e02,
969 0xd721f502, 970 0xdb21f502,
970 0xf5f4bd07, 971 0xf5f4bd07,
971 0xf5083621, 972 0xf5083a21,
972 0xf5027f21, 973 0xf5027f21,
973 0xbd07e921, 974 0xbd07ed21,
974 0xd721f5f4, 975 0xdb21f5f4,
975 0x1011f407, 976 0x1011f407,
976 0xfd400198, 977 0xfd400198,
977 0x0bf40511, 978 0x0bf40511,
978 0xad21f507, 979 0xb121f507,
979/* 0x0b05: ctx_xfer_no_post_mmio */ 980/* 0x0b09: ctx_xfer_no_post_mmio */
980/* 0x0b05: ctx_xfer_done */ 981/* 0x0b09: ctx_xfer_done */
981 0x0000f809, 982 0x0000f809,
982 0x00000000, 983 0x00000000,
983 0x00000000, 984 0x00000000,
@@ -1040,5 +1041,4 @@ uint32_t gk104_grhub_code[] = {
1040 0x00000000, 1041 0x00000000,
1041 0x00000000, 1042 0x00000000,
1042 0x00000000, 1043 0x00000000,
1043 0x00000000,
1044}; 1044};
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk110.fuc3.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk110.fuc3.h
index 89986878480f..0a1b8c0b8b82 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk110.fuc3.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk110.fuc3.h
@@ -528,10 +528,10 @@ uint32_t gk110_grhub_code[] = {
528 0x0001d001, 528 0x0001d001,
529 0x17f104bd, 529 0x17f104bd,
530 0xf7f00100, 530 0xf7f00100,
531 0xd721f502, 531 0xdb21f502,
532 0xe921f507, 532 0xed21f507,
533 0x10f7f007, 533 0x10f7f007,
534 0x083621f5, 534 0x083a21f5,
535 0x98000e98, 535 0x98000e98,
536 0x21f5010f, 536 0x21f5010f,
537 0x14950150, 537 0x14950150,
@@ -574,9 +574,9 @@ uint32_t gk110_grhub_code[] = {
574 0xb6800040, 574 0xb6800040,
575 0x1bf40132, 575 0x1bf40132,
576 0x00f7f0be, 576 0x00f7f0be,
577 0x083621f5, 577 0x083a21f5,
578 0xf500f7f0, 578 0xf500f7f0,
579 0xf107d721, 579 0xf107db21,
580 0xf0010007, 580 0xf0010007,
581 0x01d00203, 581 0x01d00203,
582 0xbd04bd00, 582 0xbd04bd00,
@@ -610,7 +610,7 @@ uint32_t gk110_grhub_code[] = {
610 0x09d00203, 610 0x09d00203,
611 0xf404bd00, 611 0xf404bd00,
612 0x31f40132, 612 0x31f40132,
613 0x0221f502, 613 0x0621f502,
614 0xf094bd0a, 614 0xf094bd0a,
615 0x07f10799, 615 0x07f10799,
616 0x03f01700, 616 0x03f01700,
@@ -621,7 +621,7 @@ uint32_t gk110_grhub_code[] = {
621 0x0203f037, 621 0x0203f037,
622 0xbd0009d0, 622 0xbd0009d0,
623 0x0131f404, 623 0x0131f404,
624 0x0a0221f5, 624 0x0a0621f5,
625 0x99f094bd, 625 0x99f094bd,
626 0x0007f106, 626 0x0007f106,
627 0x0203f017, 627 0x0203f017,
@@ -631,7 +631,7 @@ uint32_t gk110_grhub_code[] = {
631 0x12b920f9, 631 0x12b920f9,
632 0x0132f402, 632 0x0132f402,
633 0xf50232f4, 633 0xf50232f4,
634 0xfc0a0221, 634 0xfc0a0621,
635 0x0007f120, 635 0x0007f120,
636 0x0203f0c0, 636 0x0203f0c0,
637 0xbd0002d0, 637 0xbd0002d0,
@@ -640,7 +640,7 @@ uint32_t gk110_grhub_code[] = {
640 0xf41f23c8, 640 0xf41f23c8,
641 0x31f40d0b, 641 0x31f40d0b,
642 0x0232f401, 642 0x0232f401,
643 0x0a0221f5, 643 0x0a0621f5,
644/* 0x063c: chsw_done */ 644/* 0x063c: chsw_done */
645 0xf10127f0, 645 0xf10127f0,
646 0xf0c30007, 646 0xf0c30007,
@@ -654,7 +654,7 @@ uint32_t gk110_grhub_code[] = {
654/* 0x0660: main_not_ctx_switch */ 654/* 0x0660: main_not_ctx_switch */
655 0xf401e4b0, 655 0xf401e4b0,
656 0xf2b90d1b, 656 0xf2b90d1b,
657 0x9a21f502, 657 0x9e21f502,
658 0x460ef409, 658 0x460ef409,
659/* 0x0670: main_not_ctx_chan */ 659/* 0x0670: main_not_ctx_chan */
660 0xf402e4b0, 660 0xf402e4b0,
@@ -664,7 +664,7 @@ uint32_t gk110_grhub_code[] = {
664 0x09d00203, 664 0x09d00203,
665 0xf404bd00, 665 0xf404bd00,
666 0x32f40132, 666 0x32f40132,
667 0x0221f502, 667 0x0621f502,
668 0xf094bd0a, 668 0xf094bd0a,
669 0x07f10799, 669 0x07f10799,
670 0x03f01700, 670 0x03f01700,
@@ -682,90 +682,91 @@ uint32_t gk110_grhub_code[] = {
682 0x04bd0002, 682 0x04bd0002,
683 0xfea00ef5, 683 0xfea00ef5,
684/* 0x06c8: ih */ 684/* 0x06c8: ih */
685 0x88fe80f9, 685 0x80f900f9,
686 0xf980f901, 686 0xf90188fe,
687 0xf9a0f990, 687 0xf990f980,
688 0xf9d0f9b0, 688 0xf9b0f9a0,
689 0xbdf0f9e0, 689 0xf9e0f9d0,
690 0x00a7f104, 690 0xf104bdf0,
691 0x00a3f002, 691 0xf00200a7,
692 0xc400aacf, 692 0xaacf00a3,
693 0x0bf404ab, 693 0x04abc400,
694 0x10d7f030, 694 0xf0300bf4,
695 0x1a00e7f1, 695 0xe7f110d7,
696 0xcf00e3f0, 696 0xe3f01a00,
697 0xf7f100ee, 697 0x00eecf00,
698 0xf3f01900, 698 0x1900f7f1,
699 0x00ffcf00, 699 0xcf00f3f0,
700 0xb70421f4, 700 0x21f400ff,
701 0xf00400b0, 701 0x00b0b704,
702 0x07f101e7, 702 0x01e7f004,
703 0x03f01d00, 703 0x1d0007f1,
704 0x000ed000, 704 0xd00003f0,
705/* 0x071a: ih_no_fifo */ 705 0x04bd000e,
706 0xabe404bd, 706/* 0x071c: ih_no_fifo */
707 0x0bf40100, 707 0x0100abe4,
708 0x10d7f00d, 708 0xf00d0bf4,
709 0x4001e7f1, 709 0xe7f110d7,
710/* 0x072b: ih_no_ctxsw */ 710 0x21f44001,
711 0xe40421f4, 711/* 0x072d: ih_no_ctxsw */
712 0xf40400ab, 712 0x00abe404,
713 0xe7f16c0b, 713 0x6c0bf404,
714 0xe3f00708, 714 0x0708e7f1,
715 0x6821f440, 715 0xf440e3f0,
716 0xf102ffb9, 716 0xffb96821,
717 0xf0040007, 717 0x0007f102,
718 0x0fd00203, 718 0x0203f004,
719 0xf104bd00, 719 0xbd000fd0,
720 0xf00704e7, 720 0x04e7f104,
721 0x40e3f007,
722 0xb96821f4,
723 0x07f102ff,
724 0x03f00300,
725 0x000fd002,
726 0xfec704bd,
727 0x02ee9450,
728 0x0700f7f1,
729 0xbb40f3f0,
730 0x21f400ef,
731 0x0007f168,
732 0x0203f002,
733 0xbd000fd0,
734 0x03f7f004,
735 0x037e21f5,
736 0x0100b7f1,
737 0xf102bfb9,
738 0xf00144e7,
721 0x21f440e3, 739 0x21f440e3,
722 0x02ffb968, 740/* 0x079d: ih_no_fwmthd */
723 0x030007f1, 741 0x04b7f19d,
724 0xd00203f0, 742 0xffb0bd05,
725 0x04bd000f, 743 0x0bf4b4ab,
726 0x9450fec7, 744 0x0007f10f,
727 0xf7f102ee, 745 0x0303f007,
728 0xf3f00700, 746 0xbd000bd0,
729 0x00efbb40, 747/* 0x07b5: ih_no_other */
730 0xf16821f4, 748 0x0007f104,
731 0xf0020007, 749 0x0003f001,
732 0x0fd00203, 750 0xbd000ad0,
733 0xf004bd00, 751 0xfcf0fc04,
734 0x21f503f7, 752 0xfcd0fce0,
735 0xb7f1037e, 753 0xfca0fcb0,
736 0xbfb90100, 754 0xfe80fc90,
737 0x44e7f102, 755 0x80fc0088,
738 0x40e3f001, 756 0x32f400fc,
739/* 0x079b: ih_no_fwmthd */ 757/* 0x07db: ctx_4170s */
740 0xf19d21f4,
741 0xbd0504b7,
742 0xb4abffb0,
743 0xf10f0bf4,
744 0xf0070007,
745 0x0bd00303,
746/* 0x07b3: ih_no_other */
747 0xf104bd00,
748 0xf0010007,
749 0x0ad00003,
750 0xfc04bd00,
751 0xfce0fcf0,
752 0xfcb0fcd0,
753 0xfc90fca0,
754 0x0088fe80,
755 0x32f480fc,
756/* 0x07d7: ctx_4170s */
757 0xf001f800, 758 0xf001f800,
758 0xffb910f5, 759 0xffb910f5,
759 0x70e7f102, 760 0x70e7f102,
760 0x40e3f041, 761 0x40e3f041,
761 0xf89d21f4, 762 0xf89d21f4,
762/* 0x07e9: ctx_4170w */ 763/* 0x07ed: ctx_4170w */
763 0x70e7f100, 764 0x70e7f100,
764 0x40e3f041, 765 0x40e3f041,
765 0xb96821f4, 766 0xb96821f4,
766 0xf4f002ff, 767 0xf4f002ff,
767 0xf01bf410, 768 0xf01bf410,
768/* 0x07fe: ctx_redswitch */ 769/* 0x0802: ctx_redswitch */
769 0xe7f100f8, 770 0xe7f100f8,
770 0xe5f00200, 771 0xe5f00200,
771 0x20e5f040, 772 0x20e5f040,
@@ -773,7 +774,7 @@ uint32_t gk110_grhub_code[] = {
773 0xf0850007, 774 0xf0850007,
774 0x0ed00103, 775 0x0ed00103,
775 0xf004bd00, 776 0xf004bd00,
776/* 0x081a: ctx_redswitch_delay */ 777/* 0x081e: ctx_redswitch_delay */
777 0xf2b608f7, 778 0xf2b608f7,
778 0xfd1bf401, 779 0xfd1bf401,
779 0x0400e5f1, 780 0x0400e5f1,
@@ -781,7 +782,7 @@ uint32_t gk110_grhub_code[] = {
781 0x850007f1, 782 0x850007f1,
782 0xd00103f0, 783 0xd00103f0,
783 0x04bd000e, 784 0x04bd000e,
784/* 0x0836: ctx_86c */ 785/* 0x083a: ctx_86c */
785 0x07f100f8, 786 0x07f100f8,
786 0x03f02300, 787 0x03f02300,
787 0x000fd002, 788 0x000fd002,
@@ -792,17 +793,17 @@ uint32_t gk110_grhub_code[] = {
792 0xe7f102ff, 793 0xe7f102ff,
793 0xe3f0a88c, 794 0xe3f0a88c,
794 0x9d21f441, 795 0x9d21f441,
795/* 0x085e: ctx_mem */ 796/* 0x0862: ctx_mem */
796 0x07f100f8, 797 0x07f100f8,
797 0x03f08400, 798 0x03f08400,
798 0x000fd002, 799 0x000fd002,
799/* 0x086a: ctx_mem_wait */ 800/* 0x086e: ctx_mem_wait */
800 0xf7f104bd, 801 0xf7f104bd,
801 0xf3f08400, 802 0xf3f08400,
802 0x00ffcf02, 803 0x00ffcf02,
803 0xf405fffd, 804 0xf405fffd,
804 0x00f8f31b, 805 0x00f8f31b,
805/* 0x087c: ctx_load */ 806/* 0x0880: ctx_load */
806 0x99f094bd, 807 0x99f094bd,
807 0x0007f105, 808 0x0007f105,
808 0x0203f037, 809 0x0203f037,
@@ -819,7 +820,7 @@ uint32_t gk110_grhub_code[] = {
819 0x0203f083, 820 0x0203f083,
820 0xbd0002d0, 821 0xbd0002d0,
821 0x07f7f004, 822 0x07f7f004,
822 0x085e21f5, 823 0x086221f5,
823 0xc00007f1, 824 0xc00007f1,
824 0xd00203f0, 825 0xd00203f0,
825 0x04bd0002, 826 0x04bd0002,
@@ -874,29 +875,29 @@ uint32_t gk110_grhub_code[] = {
874 0x170007f1, 875 0x170007f1,
875 0xd00203f0, 876 0xd00203f0,
876 0x04bd0009, 877 0x04bd0009,
877/* 0x099a: ctx_chan */ 878/* 0x099e: ctx_chan */
878 0x21f500f8, 879 0x21f500f8,
879 0xa7f0087c, 880 0xa7f00880,
880 0xd021f40c, 881 0xd021f40c,
881 0xf505f7f0, 882 0xf505f7f0,
882 0xf8085e21, 883 0xf8086221,
883/* 0x09ad: ctx_mmio_exec */ 884/* 0x09b1: ctx_mmio_exec */
884 0x41039800, 885 0x41039800,
885 0x810007f1, 886 0x810007f1,
886 0xd00203f0, 887 0xd00203f0,
887 0x04bd0003, 888 0x04bd0003,
888/* 0x09be: ctx_mmio_loop */ 889/* 0x09c2: ctx_mmio_loop */
889 0x34c434bd, 890 0x34c434bd,
890 0x0f1bf4ff, 891 0x0f1bf4ff,
891 0x020057f1, 892 0x020057f1,
892 0xfa0653f0, 893 0xfa0653f0,
893 0x03f80535, 894 0x03f80535,
894/* 0x09d0: ctx_mmio_pull */ 895/* 0x09d4: ctx_mmio_pull */
895 0x98804e98, 896 0x98804e98,
896 0x21f4814f, 897 0x21f4814f,
897 0x0830b69d, 898 0x0830b69d,
898 0xf40112b6, 899 0xf40112b6,
899/* 0x09e2: ctx_mmio_done */ 900/* 0x09e6: ctx_mmio_done */
900 0x0398df1b, 901 0x0398df1b,
901 0x0007f116, 902 0x0007f116,
902 0x0203f081, 903 0x0203f081,
@@ -905,30 +906,30 @@ uint32_t gk110_grhub_code[] = {
905 0x010017f1, 906 0x010017f1,
906 0xfa0613f0, 907 0xfa0613f0,
907 0x03f80601, 908 0x03f80601,
908/* 0x0a02: ctx_xfer */ 909/* 0x0a06: ctx_xfer */
909 0xe7f000f8, 910 0xe7f000f8,
910 0x0007f104, 911 0x0007f104,
911 0x0303f002, 912 0x0303f002,
912 0xbd000ed0, 913 0xbd000ed0,
913/* 0x0a11: ctx_xfer_idle */ 914/* 0x0a15: ctx_xfer_idle */
914 0x00e7f104, 915 0x00e7f104,
915 0x03e3f000, 916 0x03e3f000,
916 0xf100eecf, 917 0xf100eecf,
917 0xf42000e4, 918 0xf42000e4,
918 0x11f4f21b, 919 0x11f4f21b,
919 0x0d02f406, 920 0x0d02f406,
920/* 0x0a28: ctx_xfer_pre */ 921/* 0x0a2c: ctx_xfer_pre */
921 0xf510f7f0, 922 0xf510f7f0,
922 0xf4083621, 923 0xf4083a21,
923/* 0x0a32: ctx_xfer_pre_load */ 924/* 0x0a36: ctx_xfer_pre_load */
924 0xf7f01c11, 925 0xf7f01c11,
925 0xd721f502, 926 0xdb21f502,
926 0xe921f507, 927 0xed21f507,
927 0xfe21f507, 928 0x0221f507,
928 0xf5f4bd07, 929 0xf5f4bd08,
929 0xf507d721, 930 0xf507db21,
930/* 0x0a4b: ctx_xfer_exec */ 931/* 0x0a4f: ctx_xfer_exec */
931 0x98087c21, 932 0x98088021,
932 0x24bd1601, 933 0x24bd1601,
933 0x050007f1, 934 0x050007f1,
934 0xd00103f0, 935 0xd00103f0,
@@ -963,21 +964,21 @@ uint32_t gk110_grhub_code[] = {
963 0xa7f01301, 964 0xa7f01301,
964 0xd021f40c, 965 0xd021f40c,
965 0xf505f7f0, 966 0xf505f7f0,
966 0xf4085e21, 967 0xf4086221,
967/* 0x0ada: ctx_xfer_post */ 968/* 0x0ade: ctx_xfer_post */
968 0xf7f02e02, 969 0xf7f02e02,
969 0xd721f502, 970 0xdb21f502,
970 0xf5f4bd07, 971 0xf5f4bd07,
971 0xf5083621, 972 0xf5083a21,
972 0xf5027f21, 973 0xf5027f21,
973 0xbd07e921, 974 0xbd07ed21,
974 0xd721f5f4, 975 0xdb21f5f4,
975 0x1011f407, 976 0x1011f407,
976 0xfd400198, 977 0xfd400198,
977 0x0bf40511, 978 0x0bf40511,
978 0xad21f507, 979 0xb121f507,
979/* 0x0b05: ctx_xfer_no_post_mmio */ 980/* 0x0b09: ctx_xfer_no_post_mmio */
980/* 0x0b05: ctx_xfer_done */ 981/* 0x0b09: ctx_xfer_done */
981 0x0000f809, 982 0x0000f809,
982 0x00000000, 983 0x00000000,
983 0x00000000, 984 0x00000000,
@@ -1040,5 +1041,4 @@ uint32_t gk110_grhub_code[] = {
1040 0x00000000, 1041 0x00000000,
1041 0x00000000, 1042 0x00000000,
1042 0x00000000, 1043 0x00000000,
1043 0x00000000,
1044}; 1044};
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk208.fuc5.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk208.fuc5.h
index 0e98fa4a386e..16869d0b109b 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk208.fuc5.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk208.fuc5.h
@@ -478,10 +478,10 @@ uint32_t gk208_grhub_code[] = {
478 0x01040080, 478 0x01040080,
479 0xbd0001f6, 479 0xbd0001f6,
480 0x01004104, 480 0x01004104,
481 0xa87e020f, 481 0xac7e020f,
482 0xb77e0006, 482 0xbb7e0006,
483 0x100f0006, 483 0x100f0006,
484 0x0006f97e, 484 0x0006fd7e,
485 0x98000e98, 485 0x98000e98,
486 0x207e010f, 486 0x207e010f,
487 0x14950001, 487 0x14950001,
@@ -523,8 +523,8 @@ uint32_t gk208_grhub_code[] = {
523 0x800040b7, 523 0x800040b7,
524 0xf40132b6, 524 0xf40132b6,
525 0x000fb41b, 525 0x000fb41b,
526 0x0006f97e, 526 0x0006fd7e,
527 0xa87e000f, 527 0xac7e000f,
528 0x00800006, 528 0x00800006,
529 0x01f60201, 529 0x01f60201,
530 0xbd04bd00, 530 0xbd04bd00,
@@ -554,7 +554,7 @@ uint32_t gk208_grhub_code[] = {
554 0x0009f602, 554 0x0009f602,
555 0x32f404bd, 555 0x32f404bd,
556 0x0231f401, 556 0x0231f401,
557 0x00087c7e, 557 0x0008807e,
558 0x99f094bd, 558 0x99f094bd,
559 0x17008007, 559 0x17008007,
560 0x0009f602, 560 0x0009f602,
@@ -563,7 +563,7 @@ uint32_t gk208_grhub_code[] = {
563 0x37008006, 563 0x37008006,
564 0x0009f602, 564 0x0009f602,
565 0x31f404bd, 565 0x31f404bd,
566 0x087c7e01, 566 0x08807e01,
567 0xf094bd00, 567 0xf094bd00,
568 0x00800699, 568 0x00800699,
569 0x09f60217, 569 0x09f60217,
@@ -572,7 +572,7 @@ uint32_t gk208_grhub_code[] = {
572 0x20f92f0e, 572 0x20f92f0e,
573 0x32f412b2, 573 0x32f412b2,
574 0x0232f401, 574 0x0232f401,
575 0x00087c7e, 575 0x0008807e,
576 0x008020fc, 576 0x008020fc,
577 0x02f602c0, 577 0x02f602c0,
578 0xf404bd00, 578 0xf404bd00,
@@ -580,7 +580,7 @@ uint32_t gk208_grhub_code[] = {
580 0x23c8130e, 580 0x23c8130e,
581 0x0d0bf41f, 581 0x0d0bf41f,
582 0xf40131f4, 582 0xf40131f4,
583 0x7c7e0232, 583 0x807e0232,
584/* 0x054e: chsw_done */ 584/* 0x054e: chsw_done */
585 0x01020008, 585 0x01020008,
586 0x02c30080, 586 0x02c30080,
@@ -593,7 +593,7 @@ uint32_t gk208_grhub_code[] = {
593 0xb0ff2a0e, 593 0xb0ff2a0e,
594 0x1bf401e4, 594 0x1bf401e4,
595 0x7ef2b20c, 595 0x7ef2b20c,
596 0xf400081c, 596 0xf4000820,
597/* 0x057a: main_not_ctx_chan */ 597/* 0x057a: main_not_ctx_chan */
598 0xe4b0400e, 598 0xe4b0400e,
599 0x2c1bf402, 599 0x2c1bf402,
@@ -602,7 +602,7 @@ uint32_t gk208_grhub_code[] = {
602 0x0009f602, 602 0x0009f602,
603 0x32f404bd, 603 0x32f404bd,
604 0x0232f401, 604 0x0232f401,
605 0x00087c7e, 605 0x0008807e,
606 0x99f094bd, 606 0x99f094bd,
607 0x17008007, 607 0x17008007,
608 0x0009f602, 608 0x0009f602,
@@ -618,91 +618,92 @@ uint32_t gk208_grhub_code[] = {
618 0xbd0002f6, 618 0xbd0002f6,
619 0xcc0ef504, 619 0xcc0ef504,
620/* 0x05c9: ih */ 620/* 0x05c9: ih */
621 0xfe80f9fe, 621 0xf900f9fe,
622 0x80f90188, 622 0x0188fe80,
623 0xa0f990f9, 623 0x90f980f9,
624 0xd0f9b0f9, 624 0xb0f9a0f9,
625 0xf0f9e0f9, 625 0xe0f9d0f9,
626 0x004a04bd, 626 0x04bdf0f9,
627 0x00aacf02, 627 0xcf02004a,
628 0xf404abc4, 628 0xabc400aa,
629 0x100d230b, 629 0x230bf404,
630 0xcf1a004e, 630 0x004e100d,
631 0x004f00ee, 631 0x00eecf1a,
632 0x00ffcf19, 632 0xcf19004f,
633 0x047e00ff,
634 0xb0b70000,
635 0x010e0400,
636 0xf61d0040,
637 0x04bd000e,
638/* 0x060c: ih_no_fifo */
639 0x0100abe4,
640 0x0d0c0bf4,
641 0x40014e10,
633 0x0000047e, 642 0x0000047e,
634 0x0400b0b7, 643/* 0x061c: ih_no_ctxsw */
635 0x0040010e, 644 0x0400abe4,
636 0x000ef61d, 645 0x8e560bf4,
637/* 0x060a: ih_no_fifo */ 646 0x7e400708,
638 0xabe404bd, 647 0xb2000065,
639 0x0bf40100, 648 0x040080ff,
640 0x4e100d0c, 649 0x000ff602,
641 0x047e4001, 650 0x048e04bd,
642/* 0x061a: ih_no_ctxsw */ 651 0x657e4007,
643 0xabe40000, 652 0xffb20000,
644 0x0bf40400, 653 0x02030080,
645 0x07088e56,
646 0x00657e40,
647 0x80ffb200,
648 0xf6020400,
649 0x04bd000f,
650 0x4007048e,
651 0x0000657e,
652 0x0080ffb2,
653 0x0ff60203,
654 0xc704bd00,
655 0xee9450fe,
656 0x07008f02,
657 0x00efbb40,
658 0x0000657e,
659 0x02020080,
660 0xbd000ff6, 654 0xbd000ff6,
661 0x7e030f04, 655 0x50fec704,
662 0x4b0002f8, 656 0x8f02ee94,
663 0xbfb20100, 657 0xbb400700,
664 0x4001448e, 658 0x657e00ef,
665 0x00008f7e, 659 0x00800000,
666/* 0x0674: ih_no_fwmthd */ 660 0x0ff60202,
667 0xbd05044b, 661 0x0f04bd00,
668 0xb4abffb0, 662 0x02f87e03,
669 0x800c0bf4, 663 0x01004b00,
670 0xf6030700, 664 0x448ebfb2,
671 0x04bd000b, 665 0x8f7e4001,
672/* 0x0688: ih_no_other */ 666/* 0x0676: ih_no_fwmthd */
673 0xf6010040, 667 0x044b0000,
674 0x04bd000a, 668 0xffb0bd05,
675 0xe0fcf0fc, 669 0x0bf4b4ab,
676 0xb0fcd0fc, 670 0x0700800c,
677 0x90fca0fc, 671 0x000bf603,
678 0x88fe80fc, 672/* 0x068a: ih_no_other */
679 0xf480fc00, 673 0x004004bd,
674 0x000af601,
675 0xf0fc04bd,
676 0xd0fce0fc,
677 0xa0fcb0fc,
678 0x80fc90fc,
679 0xfc0088fe,
680 0xf400fc80,
680 0x01f80032, 681 0x01f80032,
681/* 0x06a8: ctx_4170s */ 682/* 0x06ac: ctx_4170s */
682 0xb210f5f0, 683 0xb210f5f0,
683 0x41708eff, 684 0x41708eff,
684 0x008f7e40, 685 0x008f7e40,
685/* 0x06b7: ctx_4170w */ 686/* 0x06bb: ctx_4170w */
686 0x8e00f800, 687 0x8e00f800,
687 0x7e404170, 688 0x7e404170,
688 0xb2000065, 689 0xb2000065,
689 0x10f4f0ff, 690 0x10f4f0ff,
690 0xf8f31bf4, 691 0xf8f31bf4,
691/* 0x06c9: ctx_redswitch */ 692/* 0x06cd: ctx_redswitch */
692 0x02004e00, 693 0x02004e00,
693 0xf040e5f0, 694 0xf040e5f0,
694 0xe5f020e5, 695 0xe5f020e5,
695 0x85008010, 696 0x85008010,
696 0x000ef601, 697 0x000ef601,
697 0x080f04bd, 698 0x080f04bd,
698/* 0x06e0: ctx_redswitch_delay */ 699/* 0x06e4: ctx_redswitch_delay */
699 0xf401f2b6, 700 0xf401f2b6,
700 0xe5f1fd1b, 701 0xe5f1fd1b,
701 0xe5f10400, 702 0xe5f10400,
702 0x00800100, 703 0x00800100,
703 0x0ef60185, 704 0x0ef60185,
704 0xf804bd00, 705 0xf804bd00,
705/* 0x06f9: ctx_86c */ 706/* 0x06fd: ctx_86c */
706 0x23008000, 707 0x23008000,
707 0x000ff602, 708 0x000ff602,
708 0xffb204bd, 709 0xffb204bd,
@@ -711,15 +712,15 @@ uint32_t gk208_grhub_code[] = {
711 0x8c8effb2, 712 0x8c8effb2,
712 0x8f7e41a8, 713 0x8f7e41a8,
713 0x00f80000, 714 0x00f80000,
714/* 0x0718: ctx_mem */ 715/* 0x071c: ctx_mem */
715 0x02840080, 716 0x02840080,
716 0xbd000ff6, 717 0xbd000ff6,
717/* 0x0721: ctx_mem_wait */ 718/* 0x0725: ctx_mem_wait */
718 0x84008f04, 719 0x84008f04,
719 0x00ffcf02, 720 0x00ffcf02,
720 0xf405fffd, 721 0xf405fffd,
721 0x00f8f61b, 722 0x00f8f61b,
722/* 0x0730: ctx_load */ 723/* 0x0734: ctx_load */
723 0x99f094bd, 724 0x99f094bd,
724 0x37008005, 725 0x37008005,
725 0x0009f602, 726 0x0009f602,
@@ -733,7 +734,7 @@ uint32_t gk208_grhub_code[] = {
733 0x02830080, 734 0x02830080,
734 0xbd0002f6, 735 0xbd0002f6,
735 0x7e070f04, 736 0x7e070f04,
736 0x80000718, 737 0x8000071c,
737 0xf602c000, 738 0xf602c000,
738 0x04bd0002, 739 0x04bd0002,
739 0xf0000bfe, 740 0xf0000bfe,
@@ -779,28 +780,28 @@ uint32_t gk208_grhub_code[] = {
779 0x17008005, 780 0x17008005,
780 0x0009f602, 781 0x0009f602,
781 0x00f804bd, 782 0x00f804bd,
782/* 0x081c: ctx_chan */ 783/* 0x0820: ctx_chan */
783 0x0007307e, 784 0x0007347e,
784 0xb87e0c0a, 785 0xb87e0c0a,
785 0x050f0000, 786 0x050f0000,
786 0x0007187e, 787 0x00071c7e,
787/* 0x082e: ctx_mmio_exec */ 788/* 0x0832: ctx_mmio_exec */
788 0x039800f8, 789 0x039800f8,
789 0x81008041, 790 0x81008041,
790 0x0003f602, 791 0x0003f602,
791 0x34bd04bd, 792 0x34bd04bd,
792/* 0x083c: ctx_mmio_loop */ 793/* 0x0840: ctx_mmio_loop */
793 0xf4ff34c4, 794 0xf4ff34c4,
794 0x00450e1b, 795 0x00450e1b,
795 0x0653f002, 796 0x0653f002,
796 0xf80535fa, 797 0xf80535fa,
797/* 0x084d: ctx_mmio_pull */ 798/* 0x0851: ctx_mmio_pull */
798 0x804e9803, 799 0x804e9803,
799 0x7e814f98, 800 0x7e814f98,
800 0xb600008f, 801 0xb600008f,
801 0x12b60830, 802 0x12b60830,
802 0xdf1bf401, 803 0xdf1bf401,
803/* 0x0860: ctx_mmio_done */ 804/* 0x0864: ctx_mmio_done */
804 0x80160398, 805 0x80160398,
805 0xf6028100, 806 0xf6028100,
806 0x04bd0003, 807 0x04bd0003,
@@ -808,27 +809,27 @@ uint32_t gk208_grhub_code[] = {
808 0x13f00100, 809 0x13f00100,
809 0x0601fa06, 810 0x0601fa06,
810 0x00f803f8, 811 0x00f803f8,
811/* 0x087c: ctx_xfer */ 812/* 0x0880: ctx_xfer */
812 0x0080040e, 813 0x0080040e,
813 0x0ef60302, 814 0x0ef60302,
814/* 0x0887: ctx_xfer_idle */ 815/* 0x088b: ctx_xfer_idle */
815 0x8e04bd00, 816 0x8e04bd00,
816 0xcf030000, 817 0xcf030000,
817 0xe4f100ee, 818 0xe4f100ee,
818 0x1bf42000, 819 0x1bf42000,
819 0x0611f4f5, 820 0x0611f4f5,
820/* 0x089b: ctx_xfer_pre */ 821/* 0x089f: ctx_xfer_pre */
821 0x0f0c02f4, 822 0x0f0c02f4,
822 0x06f97e10, 823 0x06fd7e10,
823 0x1b11f400, 824 0x1b11f400,
824/* 0x08a4: ctx_xfer_pre_load */ 825/* 0x08a8: ctx_xfer_pre_load */
825 0xa87e020f, 826 0xac7e020f,
826 0xb77e0006, 827 0xbb7e0006,
827 0xc97e0006, 828 0xcd7e0006,
828 0xf4bd0006, 829 0xf4bd0006,
829 0x0006a87e, 830 0x0006ac7e,
830 0x0007307e, 831 0x0007347e,
831/* 0x08bc: ctx_xfer_exec */ 832/* 0x08c0: ctx_xfer_exec */
832 0xbd160198, 833 0xbd160198,
833 0x05008024, 834 0x05008024,
834 0x0002f601, 835 0x0002f601,
@@ -858,21 +859,21 @@ uint32_t gk208_grhub_code[] = {
858 0x01f40002, 859 0x01f40002,
859 0x7e0c0a12, 860 0x7e0c0a12,
860 0x0f0000b8, 861 0x0f0000b8,
861 0x07187e05, 862 0x071c7e05,
862 0x2d02f400, 863 0x2d02f400,
863/* 0x0938: ctx_xfer_post */ 864/* 0x093c: ctx_xfer_post */
864 0xa87e020f, 865 0xac7e020f,
865 0xf4bd0006, 866 0xf4bd0006,
866 0x0006f97e, 867 0x0006fd7e,
867 0x0002277e, 868 0x0002277e,
868 0x0006b77e, 869 0x0006bb7e,
869 0xa87ef4bd, 870 0xac7ef4bd,
870 0x11f40006, 871 0x11f40006,
871 0x40019810, 872 0x40019810,
872 0xf40511fd, 873 0xf40511fd,
873 0x2e7e070b, 874 0x327e070b,
874/* 0x0962: ctx_xfer_no_post_mmio */ 875/* 0x0966: ctx_xfer_no_post_mmio */
875/* 0x0962: ctx_xfer_done */ 876/* 0x0966: ctx_xfer_done */
876 0x00f80008, 877 0x00f80008,
877 0x00000000, 878 0x00000000,
878 0x00000000, 879 0x00000000,
@@ -912,5 +913,4 @@ uint32_t gk208_grhub_code[] = {
912 0x00000000, 913 0x00000000,
913 0x00000000, 914 0x00000000,
914 0x00000000, 915 0x00000000,
915 0x00000000,
916}; 916};
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgm107.fuc5.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgm107.fuc5.h
index 5f953c5c20b7..d6343d2a614c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgm107.fuc5.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgm107.fuc5.h
@@ -478,10 +478,10 @@ uint32_t gm107_grhub_code[] = {
478 0x01040080, 478 0x01040080,
479 0xbd0001f6, 479 0xbd0001f6,
480 0x01004104, 480 0x01004104,
481 0xa87e020f, 481 0xac7e020f,
482 0xb77e0006, 482 0xbb7e0006,
483 0x100f0006, 483 0x100f0006,
484 0x0006f97e, 484 0x0006fd7e,
485 0x98000e98, 485 0x98000e98,
486 0x207e010f, 486 0x207e010f,
487 0x14950001, 487 0x14950001,
@@ -523,8 +523,8 @@ uint32_t gm107_grhub_code[] = {
523 0x800040b7, 523 0x800040b7,
524 0xf40132b6, 524 0xf40132b6,
525 0x000fb41b, 525 0x000fb41b,
526 0x0006f97e, 526 0x0006fd7e,
527 0xa87e000f, 527 0xac7e000f,
528 0x00800006, 528 0x00800006,
529 0x01f60201, 529 0x01f60201,
530 0xbd04bd00, 530 0xbd04bd00,
@@ -554,7 +554,7 @@ uint32_t gm107_grhub_code[] = {
554 0x0009f602, 554 0x0009f602,
555 0x32f404bd, 555 0x32f404bd,
556 0x0231f401, 556 0x0231f401,
557 0x00087c7e, 557 0x0008807e,
558 0x99f094bd, 558 0x99f094bd,
559 0x17008007, 559 0x17008007,
560 0x0009f602, 560 0x0009f602,
@@ -563,7 +563,7 @@ uint32_t gm107_grhub_code[] = {
563 0x37008006, 563 0x37008006,
564 0x0009f602, 564 0x0009f602,
565 0x31f404bd, 565 0x31f404bd,
566 0x087c7e01, 566 0x08807e01,
567 0xf094bd00, 567 0xf094bd00,
568 0x00800699, 568 0x00800699,
569 0x09f60217, 569 0x09f60217,
@@ -572,7 +572,7 @@ uint32_t gm107_grhub_code[] = {
572 0x20f92f0e, 572 0x20f92f0e,
573 0x32f412b2, 573 0x32f412b2,
574 0x0232f401, 574 0x0232f401,
575 0x00087c7e, 575 0x0008807e,
576 0x008020fc, 576 0x008020fc,
577 0x02f602c0, 577 0x02f602c0,
578 0xf404bd00, 578 0xf404bd00,
@@ -580,7 +580,7 @@ uint32_t gm107_grhub_code[] = {
580 0x23c8130e, 580 0x23c8130e,
581 0x0d0bf41f, 581 0x0d0bf41f,
582 0xf40131f4, 582 0xf40131f4,
583 0x7c7e0232, 583 0x807e0232,
584/* 0x054e: chsw_done */ 584/* 0x054e: chsw_done */
585 0x01020008, 585 0x01020008,
586 0x02c30080, 586 0x02c30080,
@@ -593,7 +593,7 @@ uint32_t gm107_grhub_code[] = {
593 0xb0ff2a0e, 593 0xb0ff2a0e,
594 0x1bf401e4, 594 0x1bf401e4,
595 0x7ef2b20c, 595 0x7ef2b20c,
596 0xf400081c, 596 0xf4000820,
597/* 0x057a: main_not_ctx_chan */ 597/* 0x057a: main_not_ctx_chan */
598 0xe4b0400e, 598 0xe4b0400e,
599 0x2c1bf402, 599 0x2c1bf402,
@@ -602,7 +602,7 @@ uint32_t gm107_grhub_code[] = {
602 0x0009f602, 602 0x0009f602,
603 0x32f404bd, 603 0x32f404bd,
604 0x0232f401, 604 0x0232f401,
605 0x00087c7e, 605 0x0008807e,
606 0x99f094bd, 606 0x99f094bd,
607 0x17008007, 607 0x17008007,
608 0x0009f602, 608 0x0009f602,
@@ -618,91 +618,92 @@ uint32_t gm107_grhub_code[] = {
618 0xbd0002f6, 618 0xbd0002f6,
619 0xcc0ef504, 619 0xcc0ef504,
620/* 0x05c9: ih */ 620/* 0x05c9: ih */
621 0xfe80f9fe, 621 0xf900f9fe,
622 0x80f90188, 622 0x0188fe80,
623 0xa0f990f9, 623 0x90f980f9,
624 0xd0f9b0f9, 624 0xb0f9a0f9,
625 0xf0f9e0f9, 625 0xe0f9d0f9,
626 0x004a04bd, 626 0x04bdf0f9,
627 0x00aacf02, 627 0xcf02004a,
628 0xf404abc4, 628 0xabc400aa,
629 0x100d230b, 629 0x230bf404,
630 0xcf1a004e, 630 0x004e100d,
631 0x004f00ee, 631 0x00eecf1a,
632 0x00ffcf19, 632 0xcf19004f,
633 0x047e00ff,
634 0xb0b70000,
635 0x010e0400,
636 0xf61d0040,
637 0x04bd000e,
638/* 0x060c: ih_no_fifo */
639 0x0100abe4,
640 0x0d0c0bf4,
641 0x40014e10,
633 0x0000047e, 642 0x0000047e,
634 0x0400b0b7, 643/* 0x061c: ih_no_ctxsw */
635 0x0040010e, 644 0x0400abe4,
636 0x000ef61d, 645 0x8e560bf4,
637/* 0x060a: ih_no_fifo */ 646 0x7e400708,
638 0xabe404bd, 647 0xb2000065,
639 0x0bf40100, 648 0x040080ff,
640 0x4e100d0c, 649 0x000ff602,
641 0x047e4001, 650 0x048e04bd,
642/* 0x061a: ih_no_ctxsw */ 651 0x657e4007,
643 0xabe40000, 652 0xffb20000,
644 0x0bf40400, 653 0x02030080,
645 0x07088e56,
646 0x00657e40,
647 0x80ffb200,
648 0xf6020400,
649 0x04bd000f,
650 0x4007048e,
651 0x0000657e,
652 0x0080ffb2,
653 0x0ff60203,
654 0xc704bd00,
655 0xee9450fe,
656 0x07008f02,
657 0x00efbb40,
658 0x0000657e,
659 0x02020080,
660 0xbd000ff6, 654 0xbd000ff6,
661 0x7e030f04, 655 0x50fec704,
662 0x4b0002f8, 656 0x8f02ee94,
663 0xbfb20100, 657 0xbb400700,
664 0x4001448e, 658 0x657e00ef,
665 0x00008f7e, 659 0x00800000,
666/* 0x0674: ih_no_fwmthd */ 660 0x0ff60202,
667 0xbd05044b, 661 0x0f04bd00,
668 0xb4abffb0, 662 0x02f87e03,
669 0x800c0bf4, 663 0x01004b00,
670 0xf6030700, 664 0x448ebfb2,
671 0x04bd000b, 665 0x8f7e4001,
672/* 0x0688: ih_no_other */ 666/* 0x0676: ih_no_fwmthd */
673 0xf6010040, 667 0x044b0000,
674 0x04bd000a, 668 0xffb0bd05,
675 0xe0fcf0fc, 669 0x0bf4b4ab,
676 0xb0fcd0fc, 670 0x0700800c,
677 0x90fca0fc, 671 0x000bf603,
678 0x88fe80fc, 672/* 0x068a: ih_no_other */
679 0xf480fc00, 673 0x004004bd,
674 0x000af601,
675 0xf0fc04bd,
676 0xd0fce0fc,
677 0xa0fcb0fc,
678 0x80fc90fc,
679 0xfc0088fe,
680 0xf400fc80,
680 0x01f80032, 681 0x01f80032,
681/* 0x06a8: ctx_4170s */ 682/* 0x06ac: ctx_4170s */
682 0xb210f5f0, 683 0xb210f5f0,
683 0x41708eff, 684 0x41708eff,
684 0x008f7e40, 685 0x008f7e40,
685/* 0x06b7: ctx_4170w */ 686/* 0x06bb: ctx_4170w */
686 0x8e00f800, 687 0x8e00f800,
687 0x7e404170, 688 0x7e404170,
688 0xb2000065, 689 0xb2000065,
689 0x10f4f0ff, 690 0x10f4f0ff,
690 0xf8f31bf4, 691 0xf8f31bf4,
691/* 0x06c9: ctx_redswitch */ 692/* 0x06cd: ctx_redswitch */
692 0x02004e00, 693 0x02004e00,
693 0xf040e5f0, 694 0xf040e5f0,
694 0xe5f020e5, 695 0xe5f020e5,
695 0x85008010, 696 0x85008010,
696 0x000ef601, 697 0x000ef601,
697 0x080f04bd, 698 0x080f04bd,
698/* 0x06e0: ctx_redswitch_delay */ 699/* 0x06e4: ctx_redswitch_delay */
699 0xf401f2b6, 700 0xf401f2b6,
700 0xe5f1fd1b, 701 0xe5f1fd1b,
701 0xe5f10400, 702 0xe5f10400,
702 0x00800100, 703 0x00800100,
703 0x0ef60185, 704 0x0ef60185,
704 0xf804bd00, 705 0xf804bd00,
705/* 0x06f9: ctx_86c */ 706/* 0x06fd: ctx_86c */
706 0x23008000, 707 0x23008000,
707 0x000ff602, 708 0x000ff602,
708 0xffb204bd, 709 0xffb204bd,
@@ -711,15 +712,15 @@ uint32_t gm107_grhub_code[] = {
711 0x8c8effb2, 712 0x8c8effb2,
712 0x8f7e41a8, 713 0x8f7e41a8,
713 0x00f80000, 714 0x00f80000,
714/* 0x0718: ctx_mem */ 715/* 0x071c: ctx_mem */
715 0x02840080, 716 0x02840080,
716 0xbd000ff6, 717 0xbd000ff6,
717/* 0x0721: ctx_mem_wait */ 718/* 0x0725: ctx_mem_wait */
718 0x84008f04, 719 0x84008f04,
719 0x00ffcf02, 720 0x00ffcf02,
720 0xf405fffd, 721 0xf405fffd,
721 0x00f8f61b, 722 0x00f8f61b,
722/* 0x0730: ctx_load */ 723/* 0x0734: ctx_load */
723 0x99f094bd, 724 0x99f094bd,
724 0x37008005, 725 0x37008005,
725 0x0009f602, 726 0x0009f602,
@@ -733,7 +734,7 @@ uint32_t gm107_grhub_code[] = {
733 0x02830080, 734 0x02830080,
734 0xbd0002f6, 735 0xbd0002f6,
735 0x7e070f04, 736 0x7e070f04,
736 0x80000718, 737 0x8000071c,
737 0xf602c000, 738 0xf602c000,
738 0x04bd0002, 739 0x04bd0002,
739 0xf0000bfe, 740 0xf0000bfe,
@@ -779,28 +780,28 @@ uint32_t gm107_grhub_code[] = {
779 0x17008005, 780 0x17008005,
780 0x0009f602, 781 0x0009f602,
781 0x00f804bd, 782 0x00f804bd,
782/* 0x081c: ctx_chan */ 783/* 0x0820: ctx_chan */
783 0x0007307e, 784 0x0007347e,
784 0xb87e0c0a, 785 0xb87e0c0a,
785 0x050f0000, 786 0x050f0000,
786 0x0007187e, 787 0x00071c7e,
787/* 0x082e: ctx_mmio_exec */ 788/* 0x0832: ctx_mmio_exec */
788 0x039800f8, 789 0x039800f8,
789 0x81008041, 790 0x81008041,
790 0x0003f602, 791 0x0003f602,
791 0x34bd04bd, 792 0x34bd04bd,
792/* 0x083c: ctx_mmio_loop */ 793/* 0x0840: ctx_mmio_loop */
793 0xf4ff34c4, 794 0xf4ff34c4,
794 0x00450e1b, 795 0x00450e1b,
795 0x0653f002, 796 0x0653f002,
796 0xf80535fa, 797 0xf80535fa,
797/* 0x084d: ctx_mmio_pull */ 798/* 0x0851: ctx_mmio_pull */
798 0x804e9803, 799 0x804e9803,
799 0x7e814f98, 800 0x7e814f98,
800 0xb600008f, 801 0xb600008f,
801 0x12b60830, 802 0x12b60830,
802 0xdf1bf401, 803 0xdf1bf401,
803/* 0x0860: ctx_mmio_done */ 804/* 0x0864: ctx_mmio_done */
804 0x80160398, 805 0x80160398,
805 0xf6028100, 806 0xf6028100,
806 0x04bd0003, 807 0x04bd0003,
@@ -808,27 +809,27 @@ uint32_t gm107_grhub_code[] = {
808 0x13f00100, 809 0x13f00100,
809 0x0601fa06, 810 0x0601fa06,
810 0x00f803f8, 811 0x00f803f8,
811/* 0x087c: ctx_xfer */ 812/* 0x0880: ctx_xfer */
812 0x0080040e, 813 0x0080040e,
813 0x0ef60302, 814 0x0ef60302,
814/* 0x0887: ctx_xfer_idle */ 815/* 0x088b: ctx_xfer_idle */
815 0x8e04bd00, 816 0x8e04bd00,
816 0xcf030000, 817 0xcf030000,
817 0xe4f100ee, 818 0xe4f100ee,
818 0x1bf42000, 819 0x1bf42000,
819 0x0611f4f5, 820 0x0611f4f5,
820/* 0x089b: ctx_xfer_pre */ 821/* 0x089f: ctx_xfer_pre */
821 0x0f0c02f4, 822 0x0f0c02f4,
822 0x06f97e10, 823 0x06fd7e10,
823 0x1b11f400, 824 0x1b11f400,
824/* 0x08a4: ctx_xfer_pre_load */ 825/* 0x08a8: ctx_xfer_pre_load */
825 0xa87e020f, 826 0xac7e020f,
826 0xb77e0006, 827 0xbb7e0006,
827 0xc97e0006, 828 0xcd7e0006,
828 0xf4bd0006, 829 0xf4bd0006,
829 0x0006a87e, 830 0x0006ac7e,
830 0x0007307e, 831 0x0007347e,
831/* 0x08bc: ctx_xfer_exec */ 832/* 0x08c0: ctx_xfer_exec */
832 0xbd160198, 833 0xbd160198,
833 0x05008024, 834 0x05008024,
834 0x0002f601, 835 0x0002f601,
@@ -858,21 +859,21 @@ uint32_t gm107_grhub_code[] = {
858 0x01f40002, 859 0x01f40002,
859 0x7e0c0a12, 860 0x7e0c0a12,
860 0x0f0000b8, 861 0x0f0000b8,
861 0x07187e05, 862 0x071c7e05,
862 0x2d02f400, 863 0x2d02f400,
863/* 0x0938: ctx_xfer_post */ 864/* 0x093c: ctx_xfer_post */
864 0xa87e020f, 865 0xac7e020f,
865 0xf4bd0006, 866 0xf4bd0006,
866 0x0006f97e, 867 0x0006fd7e,
867 0x0002277e, 868 0x0002277e,
868 0x0006b77e, 869 0x0006bb7e,
869 0xa87ef4bd, 870 0xac7ef4bd,
870 0x11f40006, 871 0x11f40006,
871 0x40019810, 872 0x40019810,
872 0xf40511fd, 873 0xf40511fd,
873 0x2e7e070b, 874 0x327e070b,
874/* 0x0962: ctx_xfer_no_post_mmio */ 875/* 0x0966: ctx_xfer_no_post_mmio */
875/* 0x0962: ctx_xfer_done */ 876/* 0x0966: ctx_xfer_done */
876 0x00f80008, 877 0x00f80008,
877 0x00000000, 878 0x00000000,
878 0x00000000, 879 0x00000000,
@@ -912,5 +913,4 @@ uint32_t gm107_grhub_code[] = {
912 0x00000000, 913 0x00000000,
913 0x00000000, 914 0x00000000,
914 0x00000000, 915 0x00000000,
915 0x00000000,
916}; 916};
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c
index 1f81069edc58..c56a886229f1 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c
@@ -27,6 +27,8 @@
27 27
28#include <core/client.h> 28#include <core/client.h>
29#include <core/option.h> 29#include <core/option.h>
30#include <core/firmware.h>
31#include <subdev/secboot.h>
30#include <subdev/fb.h> 32#include <subdev/fb.h>
31#include <subdev/mc.h> 33#include <subdev/mc.h>
32#include <subdev/pmu.h> 34#include <subdev/pmu.h>
@@ -1427,21 +1429,40 @@ gf100_gr_init_ctxctl(struct gf100_gr *gr)
1427 const struct gf100_grctx_func *grctx = gr->func->grctx; 1429 const struct gf100_grctx_func *grctx = gr->func->grctx;
1428 struct nvkm_subdev *subdev = &gr->base.engine.subdev; 1430 struct nvkm_subdev *subdev = &gr->base.engine.subdev;
1429 struct nvkm_device *device = subdev->device; 1431 struct nvkm_device *device = subdev->device;
1432 struct nvkm_secboot *sb = device->secboot;
1430 int i; 1433 int i;
1431 1434
1432 if (gr->firmware) { 1435 if (gr->firmware) {
1433 /* load fuc microcode */ 1436 /* load fuc microcode */
1434 nvkm_mc_unk260(device->mc, 0); 1437 nvkm_mc_unk260(device->mc, 0);
1435 gf100_gr_init_fw(gr, 0x409000, &gr->fuc409c, &gr->fuc409d); 1438
1436 gf100_gr_init_fw(gr, 0x41a000, &gr->fuc41ac, &gr->fuc41ad); 1439 /* securely-managed falcons must be reset using secure boot */
1440 if (nvkm_secboot_is_managed(sb, NVKM_SECBOOT_FALCON_FECS))
1441 nvkm_secboot_reset(sb, NVKM_SECBOOT_FALCON_FECS);
1442 else
1443 gf100_gr_init_fw(gr, 0x409000, &gr->fuc409c,
1444 &gr->fuc409d);
1445 if (nvkm_secboot_is_managed(sb, NVKM_SECBOOT_FALCON_GPCCS))
1446 nvkm_secboot_reset(sb, NVKM_SECBOOT_FALCON_GPCCS);
1447 else
1448 gf100_gr_init_fw(gr, 0x41a000, &gr->fuc41ac,
1449 &gr->fuc41ad);
1450
1437 nvkm_mc_unk260(device->mc, 1); 1451 nvkm_mc_unk260(device->mc, 1);
1438 1452
1439 /* start both of them running */ 1453 /* start both of them running */
1440 nvkm_wr32(device, 0x409840, 0xffffffff); 1454 nvkm_wr32(device, 0x409840, 0xffffffff);
1441 nvkm_wr32(device, 0x41a10c, 0x00000000); 1455 nvkm_wr32(device, 0x41a10c, 0x00000000);
1442 nvkm_wr32(device, 0x40910c, 0x00000000); 1456 nvkm_wr32(device, 0x40910c, 0x00000000);
1443 nvkm_wr32(device, 0x41a100, 0x00000002); 1457
1444 nvkm_wr32(device, 0x409100, 0x00000002); 1458 if (nvkm_secboot_is_managed(sb, NVKM_SECBOOT_FALCON_GPCCS))
1459 nvkm_secboot_start(sb, NVKM_SECBOOT_FALCON_GPCCS);
1460 else
1461 nvkm_wr32(device, 0x41a100, 0x00000002);
1462 if (nvkm_secboot_is_managed(sb, NVKM_SECBOOT_FALCON_FECS))
1463 nvkm_secboot_start(sb, NVKM_SECBOOT_FALCON_FECS);
1464 else
1465 nvkm_wr32(device, 0x409100, 0x00000002);
1445 if (nvkm_msec(device, 2000, 1466 if (nvkm_msec(device, 2000,
1446 if (nvkm_rd32(device, 0x409800) & 0x00000001) 1467 if (nvkm_rd32(device, 0x409800) & 0x00000001)
1447 break; 1468 break;
@@ -1683,6 +1704,12 @@ gf100_gr_dtor_fw(struct gf100_gr_fuc *fuc)
1683 fuc->data = NULL; 1704 fuc->data = NULL;
1684} 1705}
1685 1706
1707static void
1708gf100_gr_dtor_init(struct gf100_gr_pack *pack)
1709{
1710 vfree(pack);
1711}
1712
1686void * 1713void *
1687gf100_gr_dtor(struct nvkm_gr *base) 1714gf100_gr_dtor(struct nvkm_gr *base)
1688{ 1715{
@@ -1697,6 +1724,11 @@ gf100_gr_dtor(struct nvkm_gr *base)
1697 gf100_gr_dtor_fw(&gr->fuc41ac); 1724 gf100_gr_dtor_fw(&gr->fuc41ac);
1698 gf100_gr_dtor_fw(&gr->fuc41ad); 1725 gf100_gr_dtor_fw(&gr->fuc41ad);
1699 1726
1727 gf100_gr_dtor_init(gr->fuc_bundle);
1728 gf100_gr_dtor_init(gr->fuc_method);
1729 gf100_gr_dtor_init(gr->fuc_sw_ctx);
1730 gf100_gr_dtor_init(gr->fuc_sw_nonctx);
1731
1700 nvkm_memory_del(&gr->unk4188b8); 1732 nvkm_memory_del(&gr->unk4188b8);
1701 nvkm_memory_del(&gr->unk4188b4); 1733 nvkm_memory_del(&gr->unk4188b4);
1702 return gr; 1734 return gr;
@@ -1720,22 +1752,9 @@ gf100_gr_ctor_fw(struct gf100_gr *gr, const char *fwname,
1720 struct nvkm_subdev *subdev = &gr->base.engine.subdev; 1752 struct nvkm_subdev *subdev = &gr->base.engine.subdev;
1721 struct nvkm_device *device = subdev->device; 1753 struct nvkm_device *device = subdev->device;
1722 const struct firmware *fw; 1754 const struct firmware *fw;
1723 char f[64];
1724 char cname[16];
1725 int ret; 1755 int ret;
1726 int i;
1727 1756
1728 /* Convert device name to lowercase */ 1757 ret = nvkm_firmware_get(device, fwname, &fw);
1729 strncpy(cname, device->chip->name, sizeof(cname));
1730 cname[sizeof(cname) - 1] = '\0';
1731 i = strlen(cname);
1732 while (i) {
1733 --i;
1734 cname[i] = tolower(cname[i]);
1735 }
1736
1737 snprintf(f, sizeof(f), "nvidia/%s/%s.bin", cname, fwname);
1738 ret = request_firmware(&fw, f, device->dev);
1739 if (ret) { 1758 if (ret) {
1740 nvkm_error(subdev, "failed to load %s\n", fwname); 1759 nvkm_error(subdev, "failed to load %s\n", fwname);
1741 return ret; 1760 return ret;
@@ -1743,7 +1762,7 @@ gf100_gr_ctor_fw(struct gf100_gr *gr, const char *fwname,
1743 1762
1744 fuc->size = fw->size; 1763 fuc->size = fw->size;
1745 fuc->data = kmemdup(fw->data, fuc->size, GFP_KERNEL); 1764 fuc->data = kmemdup(fw->data, fuc->size, GFP_KERNEL);
1746 release_firmware(fw); 1765 nvkm_firmware_put(fw);
1747 return (fuc->data != NULL) ? 0 : -ENOMEM; 1766 return (fuc->data != NULL) ? 0 : -ENOMEM;
1748} 1767}
1749 1768
@@ -1763,15 +1782,6 @@ gf100_gr_ctor(const struct gf100_gr_func *func, struct nvkm_device *device,
1763 if (ret) 1782 if (ret)
1764 return ret; 1783 return ret;
1765 1784
1766 if (gr->firmware) {
1767 nvkm_info(&gr->base.engine.subdev, "using external firmware\n");
1768 if (gf100_gr_ctor_fw(gr, "fecs_inst", &gr->fuc409c) ||
1769 gf100_gr_ctor_fw(gr, "fecs_data", &gr->fuc409d) ||
1770 gf100_gr_ctor_fw(gr, "gpccs_inst", &gr->fuc41ac) ||
1771 gf100_gr_ctor_fw(gr, "gpccs_data", &gr->fuc41ad))
1772 return -ENODEV;
1773 }
1774
1775 return 0; 1785 return 0;
1776} 1786}
1777 1787
@@ -1780,10 +1790,25 @@ gf100_gr_new_(const struct gf100_gr_func *func, struct nvkm_device *device,
1780 int index, struct nvkm_gr **pgr) 1790 int index, struct nvkm_gr **pgr)
1781{ 1791{
1782 struct gf100_gr *gr; 1792 struct gf100_gr *gr;
1793 int ret;
1794
1783 if (!(gr = kzalloc(sizeof(*gr), GFP_KERNEL))) 1795 if (!(gr = kzalloc(sizeof(*gr), GFP_KERNEL)))
1784 return -ENOMEM; 1796 return -ENOMEM;
1785 *pgr = &gr->base; 1797 *pgr = &gr->base;
1786 return gf100_gr_ctor(func, device, index, gr); 1798
1799 ret = gf100_gr_ctor(func, device, index, gr);
1800 if (ret)
1801 return ret;
1802
1803 if (gr->firmware) {
1804 if (gf100_gr_ctor_fw(gr, "fecs_inst", &gr->fuc409c) ||
1805 gf100_gr_ctor_fw(gr, "fecs_data", &gr->fuc409d) ||
1806 gf100_gr_ctor_fw(gr, "gpccs_inst", &gr->fuc41ac) ||
1807 gf100_gr_ctor_fw(gr, "gpccs_data", &gr->fuc41ad))
1808 return -ENODEV;
1809 }
1810
1811 return 0;
1787} 1812}
1788 1813
1789int 1814int
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.h
index 02e78b8d93f6..f0c6acb0f8fd 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.h
@@ -82,7 +82,7 @@ struct gf100_gr {
82 82
83 /* 83 /*
84 * Used if the register packs are loaded from NVIDIA fw instead of 84 * Used if the register packs are loaded from NVIDIA fw instead of
85 * using hardcoded arrays. 85 * using hardcoded arrays. To be allocated with vzalloc().
86 */ 86 */
87 struct gf100_gr_pack *fuc_sw_nonctx; 87 struct gf100_gr_pack *fuc_sw_nonctx;
88 struct gf100_gr_pack *fuc_sw_ctx; 88 struct gf100_gr_pack *fuc_sw_ctx;
@@ -138,12 +138,9 @@ int gf100_gr_init(struct gf100_gr *);
138 138
139int gk104_gr_init(struct gf100_gr *); 139int gk104_gr_init(struct gf100_gr *);
140 140
141int gk20a_gr_new_(const struct gf100_gr_func *, struct nvkm_device *,
142 int, struct nvkm_gr **);
143void gk20a_gr_dtor(struct gf100_gr *);
144int gk20a_gr_init(struct gf100_gr *); 141int gk20a_gr_init(struct gf100_gr *);
145 142
146int gm204_gr_init(struct gf100_gr *); 143int gm200_gr_init(struct gf100_gr *);
147 144
148#define gf100_gr_chan(p) container_of((p), struct gf100_gr_chan, object) 145#define gf100_gr_chan(p) container_of((p), struct gf100_gr_chan, object)
149 146
@@ -204,6 +201,17 @@ void gf100_gr_icmd(struct gf100_gr *, const struct gf100_gr_pack *);
204void gf100_gr_mthd(struct gf100_gr *, const struct gf100_gr_pack *); 201void gf100_gr_mthd(struct gf100_gr *, const struct gf100_gr_pack *);
205int gf100_gr_init_ctxctl(struct gf100_gr *); 202int gf100_gr_init_ctxctl(struct gf100_gr *);
206 203
204/* external bundles loading functions */
205int gk20a_gr_av_to_init(struct gf100_gr *, const char *,
206 struct gf100_gr_pack **);
207int gk20a_gr_aiv_to_init(struct gf100_gr *, const char *,
208 struct gf100_gr_pack **);
209int gk20a_gr_av_to_method(struct gf100_gr *, const char *,
210 struct gf100_gr_pack **);
211
212int gm200_gr_new_(const struct gf100_gr_func *, struct nvkm_device *, int,
213 struct nvkm_gr **);
214
207/* register init value lists */ 215/* register init value lists */
208 216
209extern const struct gf100_gr_init gf100_gr_init_main_0[]; 217extern const struct gf100_gr_init gf100_gr_init_main_0[];
@@ -279,6 +287,4 @@ extern const struct gf100_gr_init gm107_gr_init_l1c_0[];
279extern const struct gf100_gr_init gm107_gr_init_wwdx_0[]; 287extern const struct gf100_gr_init gm107_gr_init_wwdx_0[];
280extern const struct gf100_gr_init gm107_gr_init_cbm_0[]; 288extern const struct gf100_gr_init gm107_gr_init_cbm_0[];
281void gm107_gr_init_bios(struct gf100_gr *); 289void gm107_gr_init_bios(struct gf100_gr *);
282
283extern const struct gf100_gr_pack gm204_gr_pack_mmio[];
284#endif 290#endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c
index b8758d3b8b51..7ffb8a626196 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c
@@ -26,37 +26,40 @@
26 26
27#include <nvif/class.h> 27#include <nvif/class.h>
28 28
29static void
30gk20a_gr_init_dtor(struct gf100_gr_pack *pack)
31{
32 vfree(pack);
33}
34
35struct gk20a_fw_av 29struct gk20a_fw_av
36{ 30{
37 u32 addr; 31 u32 addr;
38 u32 data; 32 u32 data;
39}; 33};
40 34
41static struct gf100_gr_pack * 35int
42gk20a_gr_av_to_init(struct gf100_gr_fuc *fuc) 36gk20a_gr_av_to_init(struct gf100_gr *gr, const char *fw_name,
37 struct gf100_gr_pack **ppack)
43{ 38{
39 struct gf100_gr_fuc fuc;
44 struct gf100_gr_init *init; 40 struct gf100_gr_init *init;
45 struct gf100_gr_pack *pack; 41 struct gf100_gr_pack *pack;
46 const int nent = (fuc->size / sizeof(struct gk20a_fw_av)); 42 int nent;
43 int ret;
47 int i; 44 int i;
48 45
46 ret = gf100_gr_ctor_fw(gr, fw_name, &fuc);
47 if (ret)
48 return ret;
49
50 nent = (fuc.size / sizeof(struct gk20a_fw_av));
49 pack = vzalloc((sizeof(*pack) * 2) + (sizeof(*init) * (nent + 1))); 51 pack = vzalloc((sizeof(*pack) * 2) + (sizeof(*init) * (nent + 1)));
50 if (!pack) 52 if (!pack) {
51 return ERR_PTR(-ENOMEM); 53 ret = -ENOMEM;
54 goto end;
55 }
52 56
53 init = (void *)(pack + 2); 57 init = (void *)(pack + 2);
54
55 pack[0].init = init; 58 pack[0].init = init;
56 59
57 for (i = 0; i < nent; i++) { 60 for (i = 0; i < nent; i++) {
58 struct gf100_gr_init *ent = &init[i]; 61 struct gf100_gr_init *ent = &init[i];
59 struct gk20a_fw_av *av = &((struct gk20a_fw_av *)fuc->data)[i]; 62 struct gk20a_fw_av *av = &((struct gk20a_fw_av *)fuc.data)[i];
60 63
61 ent->addr = av->addr; 64 ent->addr = av->addr;
62 ent->data = av->data; 65 ent->data = av->data;
@@ -64,7 +67,11 @@ gk20a_gr_av_to_init(struct gf100_gr_fuc *fuc)
64 ent->pitch = 1; 67 ent->pitch = 1;
65 } 68 }
66 69
67 return pack; 70 *ppack = pack;
71
72end:
73 gf100_gr_dtor_fw(&fuc);
74 return ret;
68} 75}
69 76
70struct gk20a_fw_aiv 77struct gk20a_fw_aiv
@@ -74,25 +81,34 @@ struct gk20a_fw_aiv
74 u32 data; 81 u32 data;
75}; 82};
76 83
77static struct gf100_gr_pack * 84int
78gk20a_gr_aiv_to_init(struct gf100_gr_fuc *fuc) 85gk20a_gr_aiv_to_init(struct gf100_gr *gr, const char *fw_name,
86 struct gf100_gr_pack **ppack)
79{ 87{
88 struct gf100_gr_fuc fuc;
80 struct gf100_gr_init *init; 89 struct gf100_gr_init *init;
81 struct gf100_gr_pack *pack; 90 struct gf100_gr_pack *pack;
82 const int nent = (fuc->size / sizeof(struct gk20a_fw_aiv)); 91 int nent;
92 int ret;
83 int i; 93 int i;
84 94
95 ret = gf100_gr_ctor_fw(gr, fw_name, &fuc);
96 if (ret)
97 return ret;
98
99 nent = (fuc.size / sizeof(struct gk20a_fw_aiv));
85 pack = vzalloc((sizeof(*pack) * 2) + (sizeof(*init) * (nent + 1))); 100 pack = vzalloc((sizeof(*pack) * 2) + (sizeof(*init) * (nent + 1)));
86 if (!pack) 101 if (!pack) {
87 return ERR_PTR(-ENOMEM); 102 ret = -ENOMEM;
103 goto end;
104 }
88 105
89 init = (void *)(pack + 2); 106 init = (void *)(pack + 2);
90
91 pack[0].init = init; 107 pack[0].init = init;
92 108
93 for (i = 0; i < nent; i++) { 109 for (i = 0; i < nent; i++) {
94 struct gf100_gr_init *ent = &init[i]; 110 struct gf100_gr_init *ent = &init[i];
95 struct gk20a_fw_aiv *av = &((struct gk20a_fw_aiv *)fuc->data)[i]; 111 struct gk20a_fw_aiv *av = &((struct gk20a_fw_aiv *)fuc.data)[i];
96 112
97 ent->addr = av->addr; 113 ent->addr = av->addr;
98 ent->data = av->data; 114 ent->data = av->data;
@@ -100,30 +116,45 @@ gk20a_gr_aiv_to_init(struct gf100_gr_fuc *fuc)
100 ent->pitch = 1; 116 ent->pitch = 1;
101 } 117 }
102 118
103 return pack; 119 *ppack = pack;
120
121end:
122 gf100_gr_dtor_fw(&fuc);
123 return ret;
104} 124}
105 125
106static struct gf100_gr_pack * 126int
107gk20a_gr_av_to_method(struct gf100_gr_fuc *fuc) 127gk20a_gr_av_to_method(struct gf100_gr *gr, const char *fw_name,
128 struct gf100_gr_pack **ppack)
108{ 129{
130 struct gf100_gr_fuc fuc;
109 struct gf100_gr_init *init; 131 struct gf100_gr_init *init;
110 struct gf100_gr_pack *pack; 132 struct gf100_gr_pack *pack;
111 /* We don't suppose we will initialize more than 16 classes here... */ 133 /* We don't suppose we will initialize more than 16 classes here... */
112 static const unsigned int max_classes = 16; 134 static const unsigned int max_classes = 16;
113 const int nent = (fuc->size / sizeof(struct gk20a_fw_av)); 135 u32 classidx = 0, prevclass = 0;
114 int i, classidx = 0; 136 int nent;
115 u32 prevclass = 0; 137 int ret;
138 int i;
139
140 ret = gf100_gr_ctor_fw(gr, fw_name, &fuc);
141 if (ret)
142 return ret;
143
144 nent = (fuc.size / sizeof(struct gk20a_fw_av));
116 145
117 pack = vzalloc((sizeof(*pack) * max_classes) + 146 pack = vzalloc((sizeof(*pack) * max_classes) +
118 (sizeof(*init) * (nent + 1))); 147 (sizeof(*init) * (nent + 1)));
119 if (!pack) 148 if (!pack) {
120 return ERR_PTR(-ENOMEM); 149 ret = -ENOMEM;
150 goto end;
151 }
121 152
122 init = (void *)(pack + max_classes); 153 init = (void *)(pack + max_classes);
123 154
124 for (i = 0; i < nent; i++) { 155 for (i = 0; i < nent; i++) {
125 struct gf100_gr_init *ent = &init[i]; 156 struct gf100_gr_init *ent = &init[i];
126 struct gk20a_fw_av *av = &((struct gk20a_fw_av *)fuc->data)[i]; 157 struct gk20a_fw_av *av = &((struct gk20a_fw_av *)fuc.data)[i];
127 u32 class = av->addr & 0xffff; 158 u32 class = av->addr & 0xffff;
128 u32 addr = (av->addr & 0xffff0000) >> 14; 159 u32 addr = (av->addr & 0xffff0000) >> 14;
129 160
@@ -133,7 +164,8 @@ gk20a_gr_av_to_method(struct gf100_gr_fuc *fuc)
133 prevclass = class; 164 prevclass = class;
134 if (++classidx >= max_classes) { 165 if (++classidx >= max_classes) {
135 vfree(pack); 166 vfree(pack);
136 return ERR_PTR(-ENOSPC); 167 ret = -ENOSPC;
168 goto end;
137 } 169 }
138 } 170 }
139 171
@@ -143,7 +175,11 @@ gk20a_gr_av_to_method(struct gf100_gr_fuc *fuc)
143 ent->pitch = 1; 175 ent->pitch = 1;
144 } 176 }
145 177
146 return pack; 178 *ppack = pack;
179
180end:
181 gf100_gr_dtor_fw(&fuc);
182 return ret;
147} 183}
148 184
149static int 185static int
@@ -273,20 +309,24 @@ gk20a_gr_init(struct gf100_gr *gr)
273 return gf100_gr_init_ctxctl(gr); 309 return gf100_gr_init_ctxctl(gr);
274} 310}
275 311
276void 312static const struct gf100_gr_func
277gk20a_gr_dtor(struct gf100_gr *gr) 313gk20a_gr = {
278{ 314 .init = gk20a_gr_init,
279 gk20a_gr_init_dtor(gr->fuc_method); 315 .set_hww_esr_report_mask = gk20a_gr_set_hww_esr_report_mask,
280 gk20a_gr_init_dtor(gr->fuc_bundle); 316 .ppc_nr = 1,
281 gk20a_gr_init_dtor(gr->fuc_sw_ctx); 317 .grctx = &gk20a_grctx,
282 gk20a_gr_init_dtor(gr->fuc_sw_nonctx); 318 .sclass = {
283} 319 { -1, -1, FERMI_TWOD_A },
320 { -1, -1, KEPLER_INLINE_TO_MEMORY_A },
321 { -1, -1, KEPLER_C, &gf100_fermi },
322 { -1, -1, KEPLER_COMPUTE_A },
323 {}
324 }
325};
284 326
285int 327int
286gk20a_gr_new_(const struct gf100_gr_func *func, struct nvkm_device *device, 328gk20a_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr)
287 int index, struct nvkm_gr **pgr)
288{ 329{
289 struct gf100_gr_fuc fuc;
290 struct gf100_gr *gr; 330 struct gf100_gr *gr;
291 int ret; 331 int ret;
292 332
@@ -294,63 +334,32 @@ gk20a_gr_new_(const struct gf100_gr_func *func, struct nvkm_device *device,
294 return -ENOMEM; 334 return -ENOMEM;
295 *pgr = &gr->base; 335 *pgr = &gr->base;
296 336
297 ret = gf100_gr_ctor(func, device, index, gr); 337 ret = gf100_gr_ctor(&gk20a_gr, device, index, gr);
298 if (ret) 338 if (ret)
299 return ret; 339 return ret;
300 340
301 ret = gf100_gr_ctor_fw(gr, "sw_nonctx", &fuc); 341 if (gf100_gr_ctor_fw(gr, "fecs_inst", &gr->fuc409c) ||
342 gf100_gr_ctor_fw(gr, "fecs_data", &gr->fuc409d) ||
343 gf100_gr_ctor_fw(gr, "gpccs_inst", &gr->fuc41ac) ||
344 gf100_gr_ctor_fw(gr, "gpccs_data", &gr->fuc41ad))
345 return -ENODEV;
346
347 ret = gk20a_gr_av_to_init(gr, "sw_nonctx", &gr->fuc_sw_nonctx);
302 if (ret) 348 if (ret)
303 return ret; 349 return ret;
304 gr->fuc_sw_nonctx = gk20a_gr_av_to_init(&fuc);
305 gf100_gr_dtor_fw(&fuc);
306 if (IS_ERR(gr->fuc_sw_nonctx))
307 return PTR_ERR(gr->fuc_sw_nonctx);
308 350
309 ret = gf100_gr_ctor_fw(gr, "sw_ctx", &fuc); 351 ret = gk20a_gr_aiv_to_init(gr, "sw_ctx", &gr->fuc_sw_ctx);
310 if (ret) 352 if (ret)
311 return ret; 353 return ret;
312 gr->fuc_sw_ctx = gk20a_gr_aiv_to_init(&fuc);
313 gf100_gr_dtor_fw(&fuc);
314 if (IS_ERR(gr->fuc_sw_ctx))
315 return PTR_ERR(gr->fuc_sw_ctx);
316 354
317 ret = gf100_gr_ctor_fw(gr, "sw_bundle_init", &fuc); 355 ret = gk20a_gr_av_to_init(gr, "sw_bundle_init", &gr->fuc_bundle);
318 if (ret) 356 if (ret)
319 return ret; 357 return ret;
320 gr->fuc_bundle = gk20a_gr_av_to_init(&fuc);
321 gf100_gr_dtor_fw(&fuc);
322 if (IS_ERR(gr->fuc_bundle))
323 return PTR_ERR(gr->fuc_bundle);
324 358
325 ret = gf100_gr_ctor_fw(gr, "sw_method_init", &fuc); 359 ret = gk20a_gr_av_to_method(gr, "sw_method_init", &gr->fuc_method);
326 if (ret) 360 if (ret)
327 return ret; 361 return ret;
328 gr->fuc_method = gk20a_gr_av_to_method(&fuc);
329 gf100_gr_dtor_fw(&fuc);
330 if (IS_ERR(gr->fuc_method))
331 return PTR_ERR(gr->fuc_method);
332 362
333 return 0;
334}
335 363
336static const struct gf100_gr_func 364 return 0;
337gk20a_gr = {
338 .dtor = gk20a_gr_dtor,
339 .init = gk20a_gr_init,
340 .set_hww_esr_report_mask = gk20a_gr_set_hww_esr_report_mask,
341 .ppc_nr = 1,
342 .grctx = &gk20a_grctx,
343 .sclass = {
344 { -1, -1, FERMI_TWOD_A },
345 { -1, -1, KEPLER_INLINE_TO_MEMORY_A },
346 { -1, -1, KEPLER_C, &gf100_fermi },
347 { -1, -1, KEPLER_COMPUTE_A },
348 {}
349 }
350};
351
352int
353gk20a_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr)
354{
355 return gk20a_gr_new_(&gk20a_gr, device, index, pgr);
356} 365}
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm200.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm200.c
new file mode 100644
index 000000000000..058fc1d22c09
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm200.c
@@ -0,0 +1,207 @@
1/*
2 * Copyright 2015 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#include "gf100.h"
25#include "ctxgf100.h"
26
27#include <subdev/secboot.h>
28
29#include <nvif/class.h>
30
31/*******************************************************************************
32 * PGRAPH engine/subdev functions
33 ******************************************************************************/
34
35int
36gm200_gr_init(struct gf100_gr *gr)
37{
38 struct nvkm_device *device = gr->base.engine.subdev.device;
39 const u32 magicgpc918 = DIV_ROUND_UP(0x00800000, gr->tpc_total);
40 u32 data[TPC_MAX / 8] = {}, tmp;
41 u8 tpcnr[GPC_MAX];
42 int gpc, tpc, ppc, rop;
43 int i;
44
45 tmp = nvkm_rd32(device, 0x100c80); /*XXX: mask? */
46 nvkm_wr32(device, 0x418880, 0x00001000 | (tmp & 0x00000fff));
47 nvkm_wr32(device, 0x418890, 0x00000000);
48 nvkm_wr32(device, 0x418894, 0x00000000);
49 nvkm_wr32(device, 0x4188b4, nvkm_memory_addr(gr->unk4188b4) >> 8);
50 nvkm_wr32(device, 0x4188b8, nvkm_memory_addr(gr->unk4188b8) >> 8);
51 nvkm_mask(device, 0x4188b0, 0x00040000, 0x00040000);
52
53 /*XXX: belongs in fb */
54 nvkm_wr32(device, 0x100cc8, nvkm_memory_addr(gr->unk4188b4) >> 8);
55 nvkm_wr32(device, 0x100ccc, nvkm_memory_addr(gr->unk4188b8) >> 8);
56 nvkm_mask(device, 0x100cc4, 0x00040000, 0x00040000);
57
58 gf100_gr_mmio(gr, gr->fuc_sw_nonctx);
59
60 gm107_gr_init_bios(gr);
61
62 nvkm_wr32(device, GPC_UNIT(0, 0x3018), 0x00000001);
63
64 memset(data, 0x00, sizeof(data));
65 memcpy(tpcnr, gr->tpc_nr, sizeof(gr->tpc_nr));
66 for (i = 0, gpc = -1; i < gr->tpc_total; i++) {
67 do {
68 gpc = (gpc + 1) % gr->gpc_nr;
69 } while (!tpcnr[gpc]);
70 tpc = gr->tpc_nr[gpc] - tpcnr[gpc]--;
71
72 data[i / 8] |= tpc << ((i % 8) * 4);
73 }
74
75 nvkm_wr32(device, GPC_BCAST(0x0980), data[0]);
76 nvkm_wr32(device, GPC_BCAST(0x0984), data[1]);
77 nvkm_wr32(device, GPC_BCAST(0x0988), data[2]);
78 nvkm_wr32(device, GPC_BCAST(0x098c), data[3]);
79
80 for (gpc = 0; gpc < gr->gpc_nr; gpc++) {
81 nvkm_wr32(device, GPC_UNIT(gpc, 0x0914),
82 gr->magic_not_rop_nr << 8 | gr->tpc_nr[gpc]);
83 nvkm_wr32(device, GPC_UNIT(gpc, 0x0910), 0x00040000 |
84 gr->tpc_total);
85 nvkm_wr32(device, GPC_UNIT(gpc, 0x0918), magicgpc918);
86 }
87
88 nvkm_wr32(device, GPC_BCAST(0x3fd4), magicgpc918);
89 nvkm_wr32(device, GPC_BCAST(0x08ac), nvkm_rd32(device, 0x100800));
90 nvkm_wr32(device, GPC_BCAST(0x033c), nvkm_rd32(device, 0x100804));
91
92 nvkm_wr32(device, 0x400500, 0x00010001);
93 nvkm_wr32(device, 0x400100, 0xffffffff);
94 nvkm_wr32(device, 0x40013c, 0xffffffff);
95 nvkm_wr32(device, 0x400124, 0x00000002);
96 nvkm_wr32(device, 0x409c24, 0x000e0000);
97 nvkm_wr32(device, 0x405848, 0xc0000000);
98 nvkm_wr32(device, 0x40584c, 0x00000001);
99 nvkm_wr32(device, 0x404000, 0xc0000000);
100 nvkm_wr32(device, 0x404600, 0xc0000000);
101 nvkm_wr32(device, 0x408030, 0xc0000000);
102 nvkm_wr32(device, 0x404490, 0xc0000000);
103 nvkm_wr32(device, 0x406018, 0xc0000000);
104 nvkm_wr32(device, 0x407020, 0x40000000);
105 nvkm_wr32(device, 0x405840, 0xc0000000);
106 nvkm_wr32(device, 0x405844, 0x00ffffff);
107 nvkm_mask(device, 0x419cc0, 0x00000008, 0x00000008);
108
109 for (gpc = 0; gpc < gr->gpc_nr; gpc++) {
110 for (ppc = 0; ppc < gr->ppc_nr[gpc]; ppc++)
111 nvkm_wr32(device, PPC_UNIT(gpc, ppc, 0x038), 0xc0000000);
112 nvkm_wr32(device, GPC_UNIT(gpc, 0x0420), 0xc0000000);
113 nvkm_wr32(device, GPC_UNIT(gpc, 0x0900), 0xc0000000);
114 nvkm_wr32(device, GPC_UNIT(gpc, 0x1028), 0xc0000000);
115 nvkm_wr32(device, GPC_UNIT(gpc, 0x0824), 0xc0000000);
116 for (tpc = 0; tpc < gr->tpc_nr[gpc]; tpc++) {
117 nvkm_wr32(device, TPC_UNIT(gpc, tpc, 0x508), 0xffffffff);
118 nvkm_wr32(device, TPC_UNIT(gpc, tpc, 0x50c), 0xffffffff);
119 nvkm_wr32(device, TPC_UNIT(gpc, tpc, 0x224), 0xc0000000);
120 nvkm_wr32(device, TPC_UNIT(gpc, tpc, 0x48c), 0xc0000000);
121 nvkm_wr32(device, TPC_UNIT(gpc, tpc, 0x084), 0xc0000000);
122 nvkm_wr32(device, TPC_UNIT(gpc, tpc, 0x430), 0xc0000000);
123 nvkm_wr32(device, TPC_UNIT(gpc, tpc, 0x644), 0x00dffffe);
124 nvkm_wr32(device, TPC_UNIT(gpc, tpc, 0x64c), 0x00000005);
125 }
126 nvkm_wr32(device, GPC_UNIT(gpc, 0x2c90), 0xffffffff);
127 nvkm_wr32(device, GPC_UNIT(gpc, 0x2c94), 0xffffffff);
128 }
129
130 for (rop = 0; rop < gr->rop_nr; rop++) {
131 nvkm_wr32(device, ROP_UNIT(rop, 0x144), 0x40000000);
132 nvkm_wr32(device, ROP_UNIT(rop, 0x070), 0x40000000);
133 nvkm_wr32(device, ROP_UNIT(rop, 0x204), 0xffffffff);
134 nvkm_wr32(device, ROP_UNIT(rop, 0x208), 0xffffffff);
135 }
136
137 nvkm_wr32(device, 0x400108, 0xffffffff);
138 nvkm_wr32(device, 0x400138, 0xffffffff);
139 nvkm_wr32(device, 0x400118, 0xffffffff);
140 nvkm_wr32(device, 0x400130, 0xffffffff);
141 nvkm_wr32(device, 0x40011c, 0xffffffff);
142 nvkm_wr32(device, 0x400134, 0xffffffff);
143
144 nvkm_wr32(device, 0x400054, 0x2c350f63);
145
146 gf100_gr_zbc_init(gr);
147
148 return gf100_gr_init_ctxctl(gr);
149}
150
151int
152gm200_gr_new_(const struct gf100_gr_func *func, struct nvkm_device *device,
153 int index, struct nvkm_gr **pgr)
154{
155 struct gf100_gr *gr;
156 int ret;
157
158 if (!(gr = kzalloc(sizeof(*gr), GFP_KERNEL)))
159 return -ENOMEM;
160 *pgr = &gr->base;
161
162 ret = gf100_gr_ctor(func, device, index, gr);
163 if (ret)
164 return ret;
165
166 /* Load firmwares for non-secure falcons */
167 if (!nvkm_secboot_is_managed(device->secboot,
168 NVKM_SECBOOT_FALCON_FECS)) {
169 if ((ret = gf100_gr_ctor_fw(gr, "gr/fecs_inst", &gr->fuc409c)) ||
170 (ret = gf100_gr_ctor_fw(gr, "gr/fecs_data", &gr->fuc409d)))
171 return ret;
172 }
173 if (!nvkm_secboot_is_managed(device->secboot,
174 NVKM_SECBOOT_FALCON_GPCCS)) {
175 if ((ret = gf100_gr_ctor_fw(gr, "gr/gpccs_inst", &gr->fuc41ac)) ||
176 (ret = gf100_gr_ctor_fw(gr, "gr/gpccs_data", &gr->fuc41ad)))
177 return ret;
178 }
179
180 if ((ret = gk20a_gr_av_to_init(gr, "gr/sw_nonctx", &gr->fuc_sw_nonctx)) ||
181 (ret = gk20a_gr_aiv_to_init(gr, "gr/sw_ctx", &gr->fuc_sw_ctx)) ||
182 (ret = gk20a_gr_av_to_init(gr, "gr/sw_bundle_init", &gr->fuc_bundle)) ||
183 (ret = gk20a_gr_av_to_method(gr, "gr/sw_method_init", &gr->fuc_method)))
184 return ret;
185
186 return 0;
187}
188
189static const struct gf100_gr_func
190gm200_gr = {
191 .init = gm200_gr_init,
192 .ppc_nr = 2,
193 .grctx = &gm200_grctx,
194 .sclass = {
195 { -1, -1, FERMI_TWOD_A },
196 { -1, -1, KEPLER_INLINE_TO_MEMORY_B },
197 { -1, -1, MAXWELL_B, &gf100_fermi },
198 { -1, -1, MAXWELL_COMPUTE_B },
199 {}
200 }
201};
202
203int
204gm200_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr)
205{
206 return gm200_gr_new_(&gm200_gr, device, index, pgr);
207}
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm204.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm204.c
deleted file mode 100644
index 90381dde451a..000000000000
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm204.c
+++ /dev/null
@@ -1,373 +0,0 @@
1/*
2 * Copyright 2015 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#include "gf100.h"
25#include "ctxgf100.h"
26
27#include <nvif/class.h>
28
29/*******************************************************************************
30 * PGRAPH register lists
31 ******************************************************************************/
32
33static const struct gf100_gr_init
34gm204_gr_init_main_0[] = {
35 { 0x400080, 1, 0x04, 0x003003e2 },
36 { 0x400088, 1, 0x04, 0xe007bfe7 },
37 { 0x40008c, 1, 0x04, 0x00060000 },
38 { 0x400090, 1, 0x04, 0x00000030 },
39 { 0x40013c, 1, 0x04, 0x003901f3 },
40 { 0x400140, 1, 0x04, 0x00000100 },
41 { 0x400144, 1, 0x04, 0x00000000 },
42 { 0x400148, 1, 0x04, 0x00000110 },
43 { 0x400138, 1, 0x04, 0x00000000 },
44 { 0x400130, 2, 0x04, 0x00000000 },
45 { 0x400124, 1, 0x04, 0x00000002 },
46 {}
47};
48
49static const struct gf100_gr_init
50gm204_gr_init_fe_0[] = {
51 { 0x40415c, 1, 0x04, 0x00000000 },
52 { 0x404170, 1, 0x04, 0x00000000 },
53 { 0x4041b4, 1, 0x04, 0x00000000 },
54 { 0x4041b8, 1, 0x04, 0x00000010 },
55 {}
56};
57
58static const struct gf100_gr_init
59gm204_gr_init_ds_0[] = {
60 { 0x40583c, 1, 0x04, 0x00000000 },
61 { 0x405844, 1, 0x04, 0x00ffffff },
62 { 0x40584c, 1, 0x04, 0x00000001 },
63 { 0x405850, 1, 0x04, 0x00000000 },
64 { 0x405900, 1, 0x04, 0x00000000 },
65 { 0x405908, 1, 0x04, 0x00000000 },
66 {}
67};
68
69static const struct gf100_gr_init
70gm204_gr_init_sked_0[] = {
71 { 0x407010, 1, 0x04, 0x00000000 },
72 { 0x407040, 1, 0x04, 0x80440434 },
73 { 0x407048, 1, 0x04, 0x00000008 },
74 {}
75};
76
77static const struct gf100_gr_init
78gm204_gr_init_tpccs_0[] = {
79 { 0x419d60, 1, 0x04, 0x0000003f },
80 { 0x419d88, 3, 0x04, 0x00000000 },
81 { 0x419dc4, 1, 0x04, 0x00000000 },
82 { 0x419dc8, 1, 0x04, 0x00000501 },
83 { 0x419dd0, 1, 0x04, 0x00000000 },
84 { 0x419dd4, 1, 0x04, 0x00000100 },
85 { 0x419dd8, 1, 0x04, 0x00000001 },
86 { 0x419ddc, 1, 0x04, 0x00000002 },
87 { 0x419de0, 1, 0x04, 0x00000001 },
88 { 0x419de8, 1, 0x04, 0x000000cc },
89 { 0x419dec, 1, 0x04, 0x00000000 },
90 { 0x419df0, 1, 0x04, 0x000000cc },
91 { 0x419df4, 1, 0x04, 0x00000000 },
92 { 0x419d0c, 1, 0x04, 0x00000000 },
93 { 0x419d10, 1, 0x04, 0x00000014 },
94 {}
95};
96
97static const struct gf100_gr_init
98gm204_gr_init_pe_0[] = {
99 { 0x419900, 1, 0x04, 0x000000ff },
100 { 0x419810, 1, 0x04, 0x00000000 },
101 { 0x41980c, 1, 0x04, 0x00000010 },
102 { 0x419844, 1, 0x04, 0x00000000 },
103 { 0x419838, 1, 0x04, 0x000000ff },
104 { 0x419850, 1, 0x04, 0x00000004 },
105 { 0x419854, 2, 0x04, 0x00000000 },
106 { 0x419894, 3, 0x04, 0x00100401 },
107 {}
108};
109
110static const struct gf100_gr_init
111gm204_gr_init_sm_0[] = {
112 { 0x419e30, 1, 0x04, 0x000000ff },
113 { 0x419e00, 1, 0x04, 0x00000000 },
114 { 0x419ea0, 1, 0x04, 0x00000000 },
115 { 0x419ee4, 1, 0x04, 0x00000000 },
116 { 0x419ea4, 1, 0x04, 0x00000100 },
117 { 0x419ea8, 1, 0x04, 0x00000000 },
118 { 0x419ee8, 1, 0x04, 0x00000091 },
119 { 0x419eb4, 1, 0x04, 0x00000000 },
120 { 0x419ebc, 2, 0x04, 0x00000000 },
121 { 0x419edc, 1, 0x04, 0x000c1810 },
122 { 0x419ed8, 1, 0x04, 0x00000000 },
123 { 0x419ee0, 1, 0x04, 0x00000000 },
124 {}
125};
126
127static const struct gf100_gr_init
128gm204_gr_init_l1c_1[] = {
129 { 0x419cf8, 2, 0x04, 0x00000000 },
130 {}
131};
132
133static const struct gf100_gr_init
134gm204_gr_init_sm_1[] = {
135 { 0x419f74, 1, 0x04, 0x00055155 },
136 { 0x419f80, 4, 0x04, 0x00000000 },
137 {}
138};
139
140static const struct gf100_gr_init
141gm204_gr_init_l1c_2[] = {
142 { 0x419ccc, 2, 0x04, 0x00000000 },
143 { 0x419c80, 1, 0x04, 0x3f006022 },
144 { 0x419c88, 1, 0x04, 0x00210000 },
145 {}
146};
147
148static const struct gf100_gr_init
149gm204_gr_init_pes_0[] = {
150 { 0x41be50, 1, 0x04, 0x000000ff },
151 { 0x41be04, 1, 0x04, 0x00000000 },
152 { 0x41be08, 1, 0x04, 0x00000004 },
153 { 0x41be0c, 1, 0x04, 0x00000008 },
154 { 0x41be10, 1, 0x04, 0x2e3b8bc7 },
155 { 0x41be14, 2, 0x04, 0x00000000 },
156 { 0x41be3c, 5, 0x04, 0x00100401 },
157 {}
158};
159
160static const struct gf100_gr_init
161gm204_gr_init_be_0[] = {
162 { 0x408890, 1, 0x04, 0x000000ff },
163 { 0x40880c, 1, 0x04, 0x00000000 },
164 { 0x408850, 1, 0x04, 0x00000004 },
165 { 0x408878, 1, 0x04, 0x01b4201c },
166 { 0x40887c, 1, 0x04, 0x80004c55 },
167 { 0x408880, 1, 0x04, 0x0018c258 },
168 { 0x408884, 1, 0x04, 0x0000160f },
169 { 0x408974, 1, 0x04, 0x000000ff },
170 { 0x408910, 9, 0x04, 0x00000000 },
171 { 0x408950, 1, 0x04, 0x00000000 },
172 { 0x408954, 1, 0x04, 0x0000ffff },
173 { 0x408958, 1, 0x04, 0x00000034 },
174 { 0x40895c, 1, 0x04, 0x84b17403 },
175 { 0x408960, 1, 0x04, 0x04c1884f },
176 { 0x408964, 1, 0x04, 0x04714445 },
177 { 0x408968, 1, 0x04, 0x0280802f },
178 { 0x40896c, 1, 0x04, 0x04304856 },
179 { 0x408970, 1, 0x04, 0x00012800 },
180 { 0x408984, 1, 0x04, 0x00000000 },
181 { 0x408988, 1, 0x04, 0x08040201 },
182 { 0x40898c, 1, 0x04, 0x80402010 },
183 {}
184};
185
186const struct gf100_gr_pack
187gm204_gr_pack_mmio[] = {
188 { gm204_gr_init_main_0 },
189 { gm204_gr_init_fe_0 },
190 { gf100_gr_init_pri_0 },
191 { gf100_gr_init_rstr2d_0 },
192 { gf100_gr_init_pd_0 },
193 { gm204_gr_init_ds_0 },
194 { gm107_gr_init_scc_0 },
195 { gm204_gr_init_sked_0 },
196 { gk110_gr_init_cwd_0 },
197 { gm107_gr_init_prop_0 },
198 { gk208_gr_init_gpc_unk_0 },
199 { gf100_gr_init_setup_0 },
200 { gf100_gr_init_crstr_0 },
201 { gm107_gr_init_setup_1 },
202 { gm107_gr_init_zcull_0 },
203 { gf100_gr_init_gpm_0 },
204 { gm107_gr_init_gpc_unk_1 },
205 { gf100_gr_init_gcc_0 },
206 { gm204_gr_init_tpccs_0 },
207 { gm107_gr_init_tex_0 },
208 { gm204_gr_init_pe_0 },
209 { gm107_gr_init_l1c_0 },
210 { gf100_gr_init_mpc_0 },
211 { gm204_gr_init_sm_0 },
212 { gm204_gr_init_l1c_1 },
213 { gm204_gr_init_sm_1 },
214 { gm204_gr_init_l1c_2 },
215 { gm204_gr_init_pes_0 },
216 { gm107_gr_init_wwdx_0 },
217 { gm107_gr_init_cbm_0 },
218 { gm204_gr_init_be_0 },
219 {}
220};
221
222const struct gf100_gr_pack *
223gm204_gr_data[] = {
224 gm204_gr_pack_mmio,
225 NULL
226};
227
228/*******************************************************************************
229 * PGRAPH engine/subdev functions
230 ******************************************************************************/
231
232static int
233gm204_gr_init_ctxctl(struct gf100_gr *gr)
234{
235 return 0;
236}
237
238int
239gm204_gr_init(struct gf100_gr *gr)
240{
241 struct nvkm_device *device = gr->base.engine.subdev.device;
242 const u32 magicgpc918 = DIV_ROUND_UP(0x00800000, gr->tpc_total);
243 u32 data[TPC_MAX / 8] = {}, tmp;
244 u8 tpcnr[GPC_MAX];
245 int gpc, tpc, ppc, rop;
246 int i;
247
248 tmp = nvkm_rd32(device, 0x100c80); /*XXX: mask? */
249 nvkm_wr32(device, 0x418880, 0x00001000 | (tmp & 0x00000fff));
250 nvkm_wr32(device, 0x418890, 0x00000000);
251 nvkm_wr32(device, 0x418894, 0x00000000);
252 nvkm_wr32(device, 0x4188b4, nvkm_memory_addr(gr->unk4188b4) >> 8);
253 nvkm_wr32(device, 0x4188b8, nvkm_memory_addr(gr->unk4188b8) >> 8);
254 nvkm_mask(device, 0x4188b0, 0x00040000, 0x00040000);
255
256 /*XXX: belongs in fb */
257 nvkm_wr32(device, 0x100cc8, nvkm_memory_addr(gr->unk4188b4) >> 8);
258 nvkm_wr32(device, 0x100ccc, nvkm_memory_addr(gr->unk4188b8) >> 8);
259 nvkm_mask(device, 0x100cc4, 0x00040000, 0x00040000);
260
261 gf100_gr_mmio(gr, gr->func->mmio);
262
263 gm107_gr_init_bios(gr);
264
265 nvkm_wr32(device, GPC_UNIT(0, 0x3018), 0x00000001);
266
267 memset(data, 0x00, sizeof(data));
268 memcpy(tpcnr, gr->tpc_nr, sizeof(gr->tpc_nr));
269 for (i = 0, gpc = -1; i < gr->tpc_total; i++) {
270 do {
271 gpc = (gpc + 1) % gr->gpc_nr;
272 } while (!tpcnr[gpc]);
273 tpc = gr->tpc_nr[gpc] - tpcnr[gpc]--;
274
275 data[i / 8] |= tpc << ((i % 8) * 4);
276 }
277
278 nvkm_wr32(device, GPC_BCAST(0x0980), data[0]);
279 nvkm_wr32(device, GPC_BCAST(0x0984), data[1]);
280 nvkm_wr32(device, GPC_BCAST(0x0988), data[2]);
281 nvkm_wr32(device, GPC_BCAST(0x098c), data[3]);
282
283 for (gpc = 0; gpc < gr->gpc_nr; gpc++) {
284 nvkm_wr32(device, GPC_UNIT(gpc, 0x0914),
285 gr->magic_not_rop_nr << 8 | gr->tpc_nr[gpc]);
286 nvkm_wr32(device, GPC_UNIT(gpc, 0x0910), 0x00040000 |
287 gr->tpc_total);
288 nvkm_wr32(device, GPC_UNIT(gpc, 0x0918), magicgpc918);
289 }
290
291 nvkm_wr32(device, GPC_BCAST(0x3fd4), magicgpc918);
292 nvkm_wr32(device, GPC_BCAST(0x08ac), nvkm_rd32(device, 0x100800));
293 nvkm_wr32(device, GPC_BCAST(0x033c), nvkm_rd32(device, 0x100804));
294
295 nvkm_wr32(device, 0x400500, 0x00010001);
296 nvkm_wr32(device, 0x400100, 0xffffffff);
297 nvkm_wr32(device, 0x40013c, 0xffffffff);
298 nvkm_wr32(device, 0x400124, 0x00000002);
299 nvkm_wr32(device, 0x409c24, 0x000e0000);
300 nvkm_wr32(device, 0x405848, 0xc0000000);
301 nvkm_wr32(device, 0x40584c, 0x00000001);
302 nvkm_wr32(device, 0x404000, 0xc0000000);
303 nvkm_wr32(device, 0x404600, 0xc0000000);
304 nvkm_wr32(device, 0x408030, 0xc0000000);
305 nvkm_wr32(device, 0x404490, 0xc0000000);
306 nvkm_wr32(device, 0x406018, 0xc0000000);
307 nvkm_wr32(device, 0x407020, 0x40000000);
308 nvkm_wr32(device, 0x405840, 0xc0000000);
309 nvkm_wr32(device, 0x405844, 0x00ffffff);
310 nvkm_mask(device, 0x419cc0, 0x00000008, 0x00000008);
311
312 for (gpc = 0; gpc < gr->gpc_nr; gpc++) {
313 for (ppc = 0; ppc < gr->ppc_nr[gpc]; ppc++)
314 nvkm_wr32(device, PPC_UNIT(gpc, ppc, 0x038), 0xc0000000);
315 nvkm_wr32(device, GPC_UNIT(gpc, 0x0420), 0xc0000000);
316 nvkm_wr32(device, GPC_UNIT(gpc, 0x0900), 0xc0000000);
317 nvkm_wr32(device, GPC_UNIT(gpc, 0x1028), 0xc0000000);
318 nvkm_wr32(device, GPC_UNIT(gpc, 0x0824), 0xc0000000);
319 for (tpc = 0; tpc < gr->tpc_nr[gpc]; tpc++) {
320 nvkm_wr32(device, TPC_UNIT(gpc, tpc, 0x508), 0xffffffff);
321 nvkm_wr32(device, TPC_UNIT(gpc, tpc, 0x50c), 0xffffffff);
322 nvkm_wr32(device, TPC_UNIT(gpc, tpc, 0x224), 0xc0000000);
323 nvkm_wr32(device, TPC_UNIT(gpc, tpc, 0x48c), 0xc0000000);
324 nvkm_wr32(device, TPC_UNIT(gpc, tpc, 0x084), 0xc0000000);
325 nvkm_wr32(device, TPC_UNIT(gpc, tpc, 0x430), 0xc0000000);
326 nvkm_wr32(device, TPC_UNIT(gpc, tpc, 0x644), 0x00dffffe);
327 nvkm_wr32(device, TPC_UNIT(gpc, tpc, 0x64c), 0x00000005);
328 }
329 nvkm_wr32(device, GPC_UNIT(gpc, 0x2c90), 0xffffffff);
330 nvkm_wr32(device, GPC_UNIT(gpc, 0x2c94), 0xffffffff);
331 }
332
333 for (rop = 0; rop < gr->rop_nr; rop++) {
334 nvkm_wr32(device, ROP_UNIT(rop, 0x144), 0x40000000);
335 nvkm_wr32(device, ROP_UNIT(rop, 0x070), 0x40000000);
336 nvkm_wr32(device, ROP_UNIT(rop, 0x204), 0xffffffff);
337 nvkm_wr32(device, ROP_UNIT(rop, 0x208), 0xffffffff);
338 }
339
340 nvkm_wr32(device, 0x400108, 0xffffffff);
341 nvkm_wr32(device, 0x400138, 0xffffffff);
342 nvkm_wr32(device, 0x400118, 0xffffffff);
343 nvkm_wr32(device, 0x400130, 0xffffffff);
344 nvkm_wr32(device, 0x40011c, 0xffffffff);
345 nvkm_wr32(device, 0x400134, 0xffffffff);
346
347 nvkm_wr32(device, 0x400054, 0x2c350f63);
348
349 gf100_gr_zbc_init(gr);
350
351 return gm204_gr_init_ctxctl(gr);
352}
353
354static const struct gf100_gr_func
355gm204_gr = {
356 .init = gm204_gr_init,
357 .mmio = gm204_gr_pack_mmio,
358 .ppc_nr = 2,
359 .grctx = &gm204_grctx,
360 .sclass = {
361 { -1, -1, FERMI_TWOD_A },
362 { -1, -1, KEPLER_INLINE_TO_MEMORY_B },
363 { -1, -1, MAXWELL_B, &gf100_fermi },
364 { -1, -1, MAXWELL_COMPUTE_B },
365 {}
366 }
367};
368
369int
370gm204_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr)
371{
372 return gf100_gr_new_(&gm204_gr, device, index, pgr);
373}
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm20b.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm20b.c
index 65b6e3d1e90d..29732bc14415 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm20b.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm20b.c
@@ -32,12 +32,15 @@ gm20b_gr_init_gpc_mmu(struct gf100_gr *gr)
32 struct nvkm_device *device = gr->base.engine.subdev.device; 32 struct nvkm_device *device = gr->base.engine.subdev.device;
33 u32 val; 33 u32 val;
34 34
35 /* TODO this needs to be removed once secure boot works */ 35 /* Bypass MMU check for non-secure boot */
36 if (1) { 36 if (!device->secboot) {
37 nvkm_wr32(device, 0x100ce4, 0xffffffff); 37 nvkm_wr32(device, 0x100ce4, 0xffffffff);
38
39 if (nvkm_rd32(device, 0x100ce4) != 0xffffffff)
40 nvdev_warn(device,
41 "cannot bypass secure boot - expect failure soon!\n");
38 } 42 }
39 43
40 /* TODO update once secure boot works */
41 val = nvkm_rd32(device, 0x100c80); 44 val = nvkm_rd32(device, 0x100c80);
42 val &= 0xf000087f; 45 val &= 0xf000087f;
43 nvkm_wr32(device, 0x418880, val); 46 nvkm_wr32(device, 0x418880, val);
@@ -61,7 +64,6 @@ gm20b_gr_set_hww_esr_report_mask(struct gf100_gr *gr)
61 64
62static const struct gf100_gr_func 65static const struct gf100_gr_func
63gm20b_gr = { 66gm20b_gr = {
64 .dtor = gk20a_gr_dtor,
65 .init = gk20a_gr_init, 67 .init = gk20a_gr_init,
66 .init_gpc_mmu = gm20b_gr_init_gpc_mmu, 68 .init_gpc_mmu = gm20b_gr_init_gpc_mmu,
67 .set_hww_esr_report_mask = gm20b_gr_set_hww_esr_report_mask, 69 .set_hww_esr_report_mask = gm20b_gr_set_hww_esr_report_mask,
@@ -79,5 +81,5 @@ gm20b_gr = {
79int 81int
80gm20b_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr) 82gm20b_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr)
81{ 83{
82 return gk20a_gr_new_(&gm20b_gr, device, index, pgr); 84 return gm200_gr_new_(&gm20b_gr, device, index, pgr);
83} 85}
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/msenc/Kbuild b/drivers/gpu/drm/nouveau/nvkm/engine/msenc/Kbuild
new file mode 100644
index 000000000000..b5119564f608
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/msenc/Kbuild
@@ -0,0 +1 @@
#nvkm-y += nvkm/engine/msenc/base.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/nvdec/Kbuild b/drivers/gpu/drm/nouveau/nvkm/engine/nvdec/Kbuild
new file mode 100644
index 000000000000..13b7c71ff900
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/nvdec/Kbuild
@@ -0,0 +1 @@
#nvkm-y += nvkm/engine/nvdec/base.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/nvenc/Kbuild b/drivers/gpu/drm/nouveau/nvkm/engine/nvenc/Kbuild
new file mode 100644
index 000000000000..ad8f1820fa53
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/nvenc/Kbuild
@@ -0,0 +1 @@
#nvkm-y += nvkm/engine/nvenc/base.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/vic/Kbuild b/drivers/gpu/drm/nouveau/nvkm/engine/vic/Kbuild
new file mode 100644
index 000000000000..ed4fb6488013
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/vic/Kbuild
@@ -0,0 +1 @@
#nvkm-y += nvkm/engine/vic/base.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/Kbuild b/drivers/gpu/drm/nouveau/nvkm/subdev/Kbuild
index ee2c38f50ef5..642d27dc99a3 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/Kbuild
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/Kbuild
@@ -8,6 +8,7 @@ include $(src)/nvkm/subdev/fuse/Kbuild
8include $(src)/nvkm/subdev/gpio/Kbuild 8include $(src)/nvkm/subdev/gpio/Kbuild
9include $(src)/nvkm/subdev/i2c/Kbuild 9include $(src)/nvkm/subdev/i2c/Kbuild
10include $(src)/nvkm/subdev/ibus/Kbuild 10include $(src)/nvkm/subdev/ibus/Kbuild
11include $(src)/nvkm/subdev/iccsense/Kbuild
11include $(src)/nvkm/subdev/instmem/Kbuild 12include $(src)/nvkm/subdev/instmem/Kbuild
12include $(src)/nvkm/subdev/ltc/Kbuild 13include $(src)/nvkm/subdev/ltc/Kbuild
13include $(src)/nvkm/subdev/mc/Kbuild 14include $(src)/nvkm/subdev/mc/Kbuild
@@ -15,6 +16,7 @@ include $(src)/nvkm/subdev/mmu/Kbuild
15include $(src)/nvkm/subdev/mxm/Kbuild 16include $(src)/nvkm/subdev/mxm/Kbuild
16include $(src)/nvkm/subdev/pci/Kbuild 17include $(src)/nvkm/subdev/pci/Kbuild
17include $(src)/nvkm/subdev/pmu/Kbuild 18include $(src)/nvkm/subdev/pmu/Kbuild
19include $(src)/nvkm/subdev/secboot/Kbuild
18include $(src)/nvkm/subdev/therm/Kbuild 20include $(src)/nvkm/subdev/therm/Kbuild
19include $(src)/nvkm/subdev/timer/Kbuild 21include $(src)/nvkm/subdev/timer/Kbuild
20include $(src)/nvkm/subdev/volt/Kbuild 22include $(src)/nvkm/subdev/volt/Kbuild
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/Kbuild b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/Kbuild
index 64730d5e9351..dbcb0ef21587 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/Kbuild
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/Kbuild
@@ -10,6 +10,7 @@ nvkm-y += nvkm/subdev/bios/extdev.o
10nvkm-y += nvkm/subdev/bios/fan.o 10nvkm-y += nvkm/subdev/bios/fan.o
11nvkm-y += nvkm/subdev/bios/gpio.o 11nvkm-y += nvkm/subdev/bios/gpio.o
12nvkm-y += nvkm/subdev/bios/i2c.o 12nvkm-y += nvkm/subdev/bios/i2c.o
13nvkm-y += nvkm/subdev/bios/iccsense.o
13nvkm-y += nvkm/subdev/bios/image.o 14nvkm-y += nvkm/subdev/bios/image.o
14nvkm-y += nvkm/subdev/bios/init.o 15nvkm-y += nvkm/subdev/bios/init.o
15nvkm-y += nvkm/subdev/bios/mxm.o 16nvkm-y += nvkm/subdev/bios/mxm.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/extdev.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/extdev.c
index c9e6f6ff7c50..b8578359e61b 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/extdev.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/extdev.c
@@ -32,7 +32,7 @@ extdev_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *len, u8 *cnt)
32 u16 dcb, extdev = 0; 32 u16 dcb, extdev = 0;
33 33
34 dcb = dcb_table(bios, &dcb_ver, &dcb_hdr, &dcb_cnt, &dcb_len); 34 dcb = dcb_table(bios, &dcb_ver, &dcb_hdr, &dcb_cnt, &dcb_len);
35 if (!dcb || (dcb_ver != 0x30 && dcb_ver != 0x40)) 35 if (!dcb || (dcb_ver != 0x30 && dcb_ver != 0x40 && dcb_ver != 0x41))
36 return 0x0000; 36 return 0x0000;
37 37
38 extdev = nvbios_rd16(bios, dcb + 18); 38 extdev = nvbios_rd16(bios, dcb + 18);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/iccsense.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/iccsense.c
new file mode 100644
index 000000000000..084328028af1
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/iccsense.c
@@ -0,0 +1,100 @@
1/*
2 * Copyright 2015 Martin Peres
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: Martin Peres
23 */
24#include <subdev/bios.h>
25#include <subdev/bios/bit.h>
26#include <subdev/bios/iccsense.h>
27
28static u16
29nvbios_iccsense_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt,
30 u8 *len)
31{
32 struct bit_entry bit_P;
33 u16 iccsense;
34
35 if (bit_entry(bios, 'P', &bit_P) || bit_P.version != 2 ||
36 bit_P.length < 0x2c)
37 return 0;
38
39 iccsense = nvbios_rd16(bios, bit_P.offset + 0x28);
40 if (!iccsense)
41 return 0;
42
43 *ver = nvbios_rd08(bios, iccsense + 0);
44 switch (*ver) {
45 case 0x10:
46 case 0x20:
47 *hdr = nvbios_rd08(bios, iccsense + 1);
48 *len = nvbios_rd08(bios, iccsense + 2);
49 *cnt = nvbios_rd08(bios, iccsense + 3);
50 return iccsense;
51 default:
52 break;
53 }
54
55 return 0;
56}
57
58int
59nvbios_iccsense_parse(struct nvkm_bios *bios, struct nvbios_iccsense *iccsense)
60{
61 struct nvkm_subdev *subdev = &bios->subdev;
62 u8 ver, hdr, cnt, len, i;
63 u16 table, entry;
64
65 table = nvbios_iccsense_table(bios, &ver, &hdr, &cnt, &len);
66 if (!table || !cnt)
67 return -EINVAL;
68
69 if (ver != 0x10 && ver != 0x20) {
70 nvkm_error(subdev, "ICCSENSE version 0x%02x unknown\n", ver);
71 return -EINVAL;
72 }
73
74 iccsense->nr_entry = cnt;
75 iccsense->rail = kmalloc(sizeof(struct pwr_rail_t) * cnt, GFP_KERNEL);
76 if (!iccsense->rail)
77 return -ENOMEM;
78
79 for (i = 0; i < cnt; ++i) {
80 struct pwr_rail_t *rail = &iccsense->rail[i];
81 entry = table + hdr + i * len;
82
83 switch(ver) {
84 case 0x10:
85 rail->mode = nvbios_rd08(bios, entry + 0x1);
86 rail->extdev_id = nvbios_rd08(bios, entry + 0x2);
87 rail->resistor_mohm = nvbios_rd08(bios, entry + 0x3);
88 rail->rail = nvbios_rd08(bios, entry + 0x4);
89 break;
90 case 0x20:
91 rail->mode = nvbios_rd08(bios, entry);
92 rail->extdev_id = nvbios_rd08(bios, entry + 0x1);
93 rail->resistor_mohm = nvbios_rd08(bios, entry + 0x5);
94 rail->rail = nvbios_rd08(bios, entry + 0x6);
95 break;
96 };
97 }
98
99 return 0;
100}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c
index a7d69ce7abc1..38ed09fd3d2f 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c
@@ -786,20 +786,20 @@ init_io_flag_condition(struct nvbios_init *init)
786} 786}
787 787
788/** 788/**
789 * INIT_DP_CONDITION - opcode 0x3a 789 * INIT_GENERIC_CONDITION - opcode 0x3a
790 * 790 *
791 */ 791 */
792static void 792static void
793init_dp_condition(struct nvbios_init *init) 793init_generic_condition(struct nvbios_init *init)
794{ 794{
795 struct nvkm_bios *bios = init->bios; 795 struct nvkm_bios *bios = init->bios;
796 struct nvbios_dpout info; 796 struct nvbios_dpout info;
797 u8 cond = nvbios_rd08(bios, init->offset + 1); 797 u8 cond = nvbios_rd08(bios, init->offset + 1);
798 u8 unkn = nvbios_rd08(bios, init->offset + 2); 798 u8 size = nvbios_rd08(bios, init->offset + 2);
799 u8 ver, hdr, cnt, len; 799 u8 ver, hdr, cnt, len;
800 u16 data; 800 u16 data;
801 801
802 trace("DP_CONDITION\t0x%02x 0x%02x\n", cond, unkn); 802 trace("GENERIC_CONDITION\t0x%02x 0x%02x\n", cond, size);
803 init->offset += 3; 803 init->offset += 3;
804 804
805 switch (cond) { 805 switch (cond) {
@@ -828,7 +828,8 @@ init_dp_condition(struct nvbios_init *init)
828 init_exec_set(init, false); 828 init_exec_set(init, false);
829 break; 829 break;
830 default: 830 default:
831 warn("unknown dp condition 0x%02x\n", cond); 831 warn("INIT_GENERIC_CONDITON: unknown 0x%02x\n", cond);
832 init->offset += size;
832 break; 833 break;
833 } 834 }
834} 835}
@@ -2205,7 +2206,7 @@ static struct nvbios_init_opcode {
2205 [0x37] = { init_copy }, 2206 [0x37] = { init_copy },
2206 [0x38] = { init_not }, 2207 [0x38] = { init_not },
2207 [0x39] = { init_io_flag_condition }, 2208 [0x39] = { init_io_flag_condition },
2208 [0x3a] = { init_dp_condition }, 2209 [0x3a] = { init_generic_condition },
2209 [0x3b] = { init_io_mask_or }, 2210 [0x3b] = { init_io_mask_or },
2210 [0x3c] = { init_io_or }, 2211 [0x3c] = { init_io_or },
2211 [0x47] = { init_andn_reg }, 2212 [0x47] = { init_andn_reg },
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/Kbuild b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/Kbuild
index ed7717bcc3a1..87d94883f790 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/Kbuild
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/Kbuild
@@ -8,6 +8,7 @@ nvkm-y += nvkm/subdev/clk/mcp77.o
8nvkm-y += nvkm/subdev/clk/gf100.o 8nvkm-y += nvkm/subdev/clk/gf100.o
9nvkm-y += nvkm/subdev/clk/gk104.o 9nvkm-y += nvkm/subdev/clk/gk104.o
10nvkm-y += nvkm/subdev/clk/gk20a.o 10nvkm-y += nvkm/subdev/clk/gk20a.o
11nvkm-y += nvkm/subdev/clk/gm20b.o
11 12
12nvkm-y += nvkm/subdev/clk/pllnv04.o 13nvkm-y += nvkm/subdev/clk/pllnv04.o
13nvkm-y += nvkm/subdev/clk/pllgt215.o 14nvkm-y += nvkm/subdev/clk/pllgt215.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk20a.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk20a.c
index 5da2aa8cc333..5f0ee24e31b8 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk20a.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk20a.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
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"),
@@ -22,19 +22,17 @@
22 * Shamelessly ripped off from ChromeOS's gk20a/clk_pllg.c 22 * Shamelessly ripped off from ChromeOS's gk20a/clk_pllg.c
23 * 23 *
24 */ 24 */
25#define gk20a_clk(p) container_of((p), struct gk20a_clk, base)
26#include "priv.h" 25#include "priv.h"
26#include "gk20a.h"
27 27
28#include <core/tegra.h> 28#include <core/tegra.h>
29#include <subdev/timer.h> 29#include <subdev/timer.h>
30 30
31#define MHZ (1000 * 1000) 31#define KHZ (1000)
32#define MHZ (KHZ * 1000)
32 33
33#define MASK(w) ((1 << w) - 1) 34#define MASK(w) ((1 << w) - 1)
34 35
35#define SYS_GPCPLL_CFG_BASE 0x00137000
36#define GPC_BCASE_GPCPLL_CFG_BASE 0x00132800
37
38#define GPCPLL_CFG (SYS_GPCPLL_CFG_BASE + 0) 36#define GPCPLL_CFG (SYS_GPCPLL_CFG_BASE + 0)
39#define GPCPLL_CFG_ENABLE BIT(0) 37#define GPCPLL_CFG_ENABLE BIT(0)
40#define GPCPLL_CFG_IDDQ BIT(1) 38#define GPCPLL_CFG_IDDQ BIT(1)
@@ -56,6 +54,7 @@
56#define GPCPLL_CFG3 (SYS_GPCPLL_CFG_BASE + 0x18) 54#define GPCPLL_CFG3 (SYS_GPCPLL_CFG_BASE + 0x18)
57#define GPCPLL_CFG3_PLL_STEPB_SHIFT 16 55#define GPCPLL_CFG3_PLL_STEPB_SHIFT 16
58 56
57#define GPC_BCASE_GPCPLL_CFG_BASE 0x00132800
59#define GPCPLL_NDIV_SLOWDOWN (SYS_GPCPLL_CFG_BASE + 0x1c) 58#define GPCPLL_NDIV_SLOWDOWN (SYS_GPCPLL_CFG_BASE + 0x1c)
60#define GPCPLL_NDIV_SLOWDOWN_NDIV_LO_SHIFT 0 59#define GPCPLL_NDIV_SLOWDOWN_NDIV_LO_SHIFT 0
61#define GPCPLL_NDIV_SLOWDOWN_NDIV_MID_SHIFT 8 60#define GPCPLL_NDIV_SLOWDOWN_NDIV_MID_SHIFT 8
@@ -75,7 +74,7 @@
75#define GPC2CLK_OUT_VCODIV1 0 74#define GPC2CLK_OUT_VCODIV1 0
76#define GPC2CLK_OUT_VCODIV_MASK (MASK(GPC2CLK_OUT_VCODIV_WIDTH) << \ 75#define GPC2CLK_OUT_VCODIV_MASK (MASK(GPC2CLK_OUT_VCODIV_WIDTH) << \
77 GPC2CLK_OUT_VCODIV_SHIFT) 76 GPC2CLK_OUT_VCODIV_SHIFT)
78#define GPC2CLK_OUT_BYPDIV_WIDTH 6 77#define GPC2CLK_OUT_BYPDIV_WIDTH 6
79#define GPC2CLK_OUT_BYPDIV_SHIFT 0 78#define GPC2CLK_OUT_BYPDIV_SHIFT 0
80#define GPC2CLK_OUT_BYPDIV31 0x3c 79#define GPC2CLK_OUT_BYPDIV31 0x3c
81#define GPC2CLK_OUT_INIT_MASK ((MASK(GPC2CLK_OUT_SDIV14_INDIV4_WIDTH) << \ 80#define GPC2CLK_OUT_INIT_MASK ((MASK(GPC2CLK_OUT_SDIV14_INDIV4_WIDTH) << \
@@ -92,45 +91,49 @@
92#define GPC_BCAST_NDIV_SLOWDOWN_DEBUG_PLL_DYNRAMP_DONE_SYNCED_MASK \ 91#define GPC_BCAST_NDIV_SLOWDOWN_DEBUG_PLL_DYNRAMP_DONE_SYNCED_MASK \
93 (0x1 << GPC_BCAST_NDIV_SLOWDOWN_DEBUG_PLL_DYNRAMP_DONE_SYNCED_SHIFT) 92 (0x1 << GPC_BCAST_NDIV_SLOWDOWN_DEBUG_PLL_DYNRAMP_DONE_SYNCED_SHIFT)
94 93
95static const u8 pl_to_div[] = { 94static const u8 _pl_to_div[] = {
96/* PL: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 */ 95/* PL: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 */
97/* p: */ 1, 2, 3, 4, 5, 6, 8, 10, 12, 16, 12, 16, 20, 24, 32, 96/* p: */ 1, 2, 3, 4, 5, 6, 8, 10, 12, 16, 12, 16, 20, 24, 32,
98}; 97};
99 98
100/* All frequencies in Mhz */ 99static u32 pl_to_div(u32 pl)
101struct gk20a_clk_pllg_params { 100{
102 u32 min_vco, max_vco; 101 if (pl >= ARRAY_SIZE(_pl_to_div))
103 u32 min_u, max_u; 102 return 1;
104 u32 min_m, max_m; 103
105 u32 min_n, max_n; 104 return _pl_to_div[pl];
106 u32 min_pl, max_pl; 105}
107}; 106
107static u32 div_to_pl(u32 div)
108{
109 u32 pl;
110
111 for (pl = 0; pl < ARRAY_SIZE(_pl_to_div) - 1; pl++) {
112 if (_pl_to_div[pl] >= div)
113 return pl;
114 }
115
116 return ARRAY_SIZE(_pl_to_div) - 1;
117}
108 118
109static const struct gk20a_clk_pllg_params gk20a_pllg_params = { 119static const struct gk20a_clk_pllg_params gk20a_pllg_params = {
110 .min_vco = 1000, .max_vco = 2064, 120 .min_vco = 1000000, .max_vco = 2064000,
111 .min_u = 12, .max_u = 38, 121 .min_u = 12000, .max_u = 38000,
112 .min_m = 1, .max_m = 255, 122 .min_m = 1, .max_m = 255,
113 .min_n = 8, .max_n = 255, 123 .min_n = 8, .max_n = 255,
114 .min_pl = 1, .max_pl = 32, 124 .min_pl = 1, .max_pl = 32,
115}; 125};
116 126
117struct gk20a_clk {
118 struct nvkm_clk base;
119 const struct gk20a_clk_pllg_params *params;
120 u32 m, n, pl;
121 u32 parent_rate;
122};
123
124static void 127static void
125gk20a_pllg_read_mnp(struct gk20a_clk *clk) 128gk20a_pllg_read_mnp(struct gk20a_clk *clk, struct gk20a_pll *pll)
126{ 129{
127 struct nvkm_device *device = clk->base.subdev.device; 130 struct nvkm_device *device = clk->base.subdev.device;
128 u32 val; 131 u32 val;
129 132
130 val = nvkm_rd32(device, GPCPLL_COEFF); 133 val = nvkm_rd32(device, GPCPLL_COEFF);
131 clk->m = (val >> GPCPLL_COEFF_M_SHIFT) & MASK(GPCPLL_COEFF_M_WIDTH); 134 pll->m = (val >> GPCPLL_COEFF_M_SHIFT) & MASK(GPCPLL_COEFF_M_WIDTH);
132 clk->n = (val >> GPCPLL_COEFF_N_SHIFT) & MASK(GPCPLL_COEFF_N_WIDTH); 135 pll->n = (val >> GPCPLL_COEFF_N_SHIFT) & MASK(GPCPLL_COEFF_N_WIDTH);
133 clk->pl = (val >> GPCPLL_COEFF_P_SHIFT) & MASK(GPCPLL_COEFF_P_WIDTH); 136 pll->pl = (val >> GPCPLL_COEFF_P_SHIFT) & MASK(GPCPLL_COEFF_P_WIDTH);
134} 137}
135 138
136static u32 139static u32
@@ -139,8 +142,8 @@ gk20a_pllg_calc_rate(struct gk20a_clk *clk)
139 u32 rate; 142 u32 rate;
140 u32 divider; 143 u32 divider;
141 144
142 rate = clk->parent_rate * clk->n; 145 rate = clk->parent_rate * clk->pll.n;
143 divider = clk->m * pl_to_div[clk->pl]; 146 divider = clk->pll.m * clk->pl_to_div(clk->pll.pl);
144 147
145 return rate / divider / 2; 148 return rate / divider / 2;
146} 149}
@@ -152,15 +155,13 @@ gk20a_pllg_calc_mnp(struct gk20a_clk *clk, unsigned long rate)
152 u32 target_clk_f, ref_clk_f, target_freq; 155 u32 target_clk_f, ref_clk_f, target_freq;
153 u32 min_vco_f, max_vco_f; 156 u32 min_vco_f, max_vco_f;
154 u32 low_pl, high_pl, best_pl; 157 u32 low_pl, high_pl, best_pl;
155 u32 target_vco_f, vco_f; 158 u32 target_vco_f;
156 u32 best_m, best_n; 159 u32 best_m, best_n;
157 u32 u_f; 160 u32 best_delta = ~0;
158 u32 m, n, n2;
159 u32 delta, lwv, best_delta = ~0;
160 u32 pl; 161 u32 pl;
161 162
162 target_clk_f = rate * 2 / MHZ; 163 target_clk_f = rate * 2 / KHZ;
163 ref_clk_f = clk->parent_rate / MHZ; 164 ref_clk_f = clk->parent_rate / KHZ;
164 165
165 max_vco_f = clk->params->max_vco; 166 max_vco_f = clk->params->max_vco;
166 min_vco_f = clk->params->min_vco; 167 min_vco_f = clk->params->min_vco;
@@ -176,33 +177,26 @@ gk20a_pllg_calc_mnp(struct gk20a_clk *clk, unsigned long rate)
176 high_pl = (max_vco_f + target_vco_f - 1) / target_vco_f; 177 high_pl = (max_vco_f + target_vco_f - 1) / target_vco_f;
177 high_pl = min(high_pl, clk->params->max_pl); 178 high_pl = min(high_pl, clk->params->max_pl);
178 high_pl = max(high_pl, clk->params->min_pl); 179 high_pl = max(high_pl, clk->params->min_pl);
180 high_pl = clk->div_to_pl(high_pl);
179 181
180 /* min_pl <= low_pl <= max_pl */ 182 /* min_pl <= low_pl <= max_pl */
181 low_pl = min_vco_f / target_vco_f; 183 low_pl = min_vco_f / target_vco_f;
182 low_pl = min(low_pl, clk->params->max_pl); 184 low_pl = min(low_pl, clk->params->max_pl);
183 low_pl = max(low_pl, clk->params->min_pl); 185 low_pl = max(low_pl, clk->params->min_pl);
184 186 low_pl = clk->div_to_pl(low_pl);
185 /* Find Indices of high_pl and low_pl */
186 for (pl = 0; pl < ARRAY_SIZE(pl_to_div) - 1; pl++) {
187 if (pl_to_div[pl] >= low_pl) {
188 low_pl = pl;
189 break;
190 }
191 }
192 for (pl = 0; pl < ARRAY_SIZE(pl_to_div) - 1; pl++) {
193 if (pl_to_div[pl] >= high_pl) {
194 high_pl = pl;
195 break;
196 }
197 }
198 187
199 nvkm_debug(subdev, "low_PL %d(div%d), high_PL %d(div%d)", low_pl, 188 nvkm_debug(subdev, "low_PL %d(div%d), high_PL %d(div%d)", low_pl,
200 pl_to_div[low_pl], high_pl, pl_to_div[high_pl]); 189 clk->pl_to_div(low_pl), high_pl, clk->pl_to_div(high_pl));
201 190
202 /* Select lowest possible VCO */ 191 /* Select lowest possible VCO */
203 for (pl = low_pl; pl <= high_pl; pl++) { 192 for (pl = low_pl; pl <= high_pl; pl++) {
204 target_vco_f = target_clk_f * pl_to_div[pl]; 193 u32 m, n, n2;
194
195 target_vco_f = target_clk_f * clk->pl_to_div(pl);
196
205 for (m = clk->params->min_m; m <= clk->params->max_m; m++) { 197 for (m = clk->params->min_m; m <= clk->params->max_m; m++) {
198 u32 u_f, vco_f;
199
206 u_f = ref_clk_f / m; 200 u_f = ref_clk_f / m;
207 201
208 if (u_f < clk->params->min_u) 202 if (u_f < clk->params->min_u)
@@ -225,8 +219,10 @@ gk20a_pllg_calc_mnp(struct gk20a_clk *clk, unsigned long rate)
225 vco_f = ref_clk_f * n / m; 219 vco_f = ref_clk_f * n / m;
226 220
227 if (vco_f >= min_vco_f && vco_f <= max_vco_f) { 221 if (vco_f >= min_vco_f && vco_f <= max_vco_f) {
228 lwv = (vco_f + (pl_to_div[pl] / 2)) 222 u32 delta, lwv;
229 / pl_to_div[pl]; 223
224 lwv = (vco_f + (clk->pl_to_div(pl) / 2))
225 / clk->pl_to_div(pl);
230 delta = abs(lwv - target_clk_f); 226 delta = abs(lwv - target_clk_f);
231 227
232 if (delta < best_delta) { 228 if (delta < best_delta) {
@@ -249,17 +245,18 @@ found_match:
249 if (best_delta != 0) 245 if (best_delta != 0)
250 nvkm_debug(subdev, 246 nvkm_debug(subdev,
251 "no best match for target @ %dMHz on gpc_pll", 247 "no best match for target @ %dMHz on gpc_pll",
252 target_clk_f); 248 target_clk_f / KHZ);
253 249
254 clk->m = best_m; 250 clk->pll.m = best_m;
255 clk->n = best_n; 251 clk->pll.n = best_n;
256 clk->pl = best_pl; 252 clk->pll.pl = best_pl;
257 253
258 target_freq = gk20a_pllg_calc_rate(clk) / MHZ; 254 target_freq = gk20a_pllg_calc_rate(clk);
259 255
260 nvkm_debug(subdev, 256 nvkm_debug(subdev,
261 "actual target freq %d MHz, M %d, N %d, PL %d(div%d)\n", 257 "actual target freq %d MHz, M %d, N %d, PL %d(div%d)\n",
262 target_freq, clk->m, clk->n, clk->pl, pl_to_div[clk->pl]); 258 target_freq / MHZ, clk->pll.m, clk->pll.n, clk->pll.pl,
259 clk->pl_to_div(clk->pll.pl));
263 return 0; 260 return 0;
264} 261}
265 262
@@ -323,17 +320,19 @@ gk20a_pllg_slide(struct gk20a_clk *clk, u32 n)
323} 320}
324 321
325static void 322static void
326_gk20a_pllg_enable(struct gk20a_clk *clk) 323gk20a_pllg_enable(struct gk20a_clk *clk)
327{ 324{
328 struct nvkm_device *device = clk->base.subdev.device; 325 struct nvkm_device *device = clk->base.subdev.device;
326
329 nvkm_mask(device, GPCPLL_CFG, GPCPLL_CFG_ENABLE, GPCPLL_CFG_ENABLE); 327 nvkm_mask(device, GPCPLL_CFG, GPCPLL_CFG_ENABLE, GPCPLL_CFG_ENABLE);
330 nvkm_rd32(device, GPCPLL_CFG); 328 nvkm_rd32(device, GPCPLL_CFG);
331} 329}
332 330
333static void 331static void
334_gk20a_pllg_disable(struct gk20a_clk *clk) 332gk20a_pllg_disable(struct gk20a_clk *clk)
335{ 333{
336 struct nvkm_device *device = clk->base.subdev.device; 334 struct nvkm_device *device = clk->base.subdev.device;
335
337 nvkm_mask(device, GPCPLL_CFG, GPCPLL_CFG_ENABLE, 0); 336 nvkm_mask(device, GPCPLL_CFG, GPCPLL_CFG_ENABLE, 0);
338 nvkm_rd32(device, GPCPLL_CFG); 337 nvkm_rd32(device, GPCPLL_CFG);
339} 338}
@@ -344,25 +343,26 @@ _gk20a_pllg_program_mnp(struct gk20a_clk *clk, bool allow_slide)
344 struct nvkm_subdev *subdev = &clk->base.subdev; 343 struct nvkm_subdev *subdev = &clk->base.subdev;
345 struct nvkm_device *device = subdev->device; 344 struct nvkm_device *device = subdev->device;
346 u32 val, cfg; 345 u32 val, cfg;
347 u32 m_old, pl_old, n_lo; 346 struct gk20a_pll old_pll;
347 u32 n_lo;
348 348
349 /* get old coefficients */ 349 /* get old coefficients */
350 val = nvkm_rd32(device, GPCPLL_COEFF); 350 gk20a_pllg_read_mnp(clk, &old_pll);
351 m_old = (val >> GPCPLL_COEFF_M_SHIFT) & MASK(GPCPLL_COEFF_M_WIDTH);
352 pl_old = (val >> GPCPLL_COEFF_P_SHIFT) & MASK(GPCPLL_COEFF_P_WIDTH);
353 351
354 /* do NDIV slide if there is no change in M and PL */ 352 /* do NDIV slide if there is no change in M and PL */
355 cfg = nvkm_rd32(device, GPCPLL_CFG); 353 cfg = nvkm_rd32(device, GPCPLL_CFG);
356 if (allow_slide && clk->m == m_old && clk->pl == pl_old && 354 if (allow_slide && clk->pll.m == old_pll.m &&
357 (cfg & GPCPLL_CFG_ENABLE)) { 355 clk->pll.pl == old_pll.pl && (cfg & GPCPLL_CFG_ENABLE)) {
358 return gk20a_pllg_slide(clk, clk->n); 356 return gk20a_pllg_slide(clk, clk->pll.n);
359 } 357 }
360 358
361 /* slide down to NDIV_LO */ 359 /* slide down to NDIV_LO */
362 n_lo = DIV_ROUND_UP(m_old * clk->params->min_vco,
363 clk->parent_rate / MHZ);
364 if (allow_slide && (cfg & GPCPLL_CFG_ENABLE)) { 360 if (allow_slide && (cfg & GPCPLL_CFG_ENABLE)) {
365 int ret = gk20a_pllg_slide(clk, n_lo); 361 int ret;
362
363 n_lo = DIV_ROUND_UP(old_pll.m * clk->params->min_vco,
364 clk->parent_rate / KHZ);
365 ret = gk20a_pllg_slide(clk, n_lo);
366 366
367 if (ret) 367 if (ret)
368 return ret; 368 return ret;
@@ -387,19 +387,19 @@ _gk20a_pllg_program_mnp(struct gk20a_clk *clk, bool allow_slide)
387 udelay(2); 387 udelay(2);
388 } 388 }
389 389
390 _gk20a_pllg_disable(clk); 390 gk20a_pllg_disable(clk);
391 391
392 nvkm_debug(subdev, "%s: m=%d n=%d pl=%d\n", __func__, 392 nvkm_debug(subdev, "%s: m=%d n=%d pl=%d\n", __func__,
393 clk->m, clk->n, clk->pl); 393 clk->pll.m, clk->pll.n, clk->pll.pl);
394 394
395 n_lo = DIV_ROUND_UP(clk->m * clk->params->min_vco, 395 n_lo = DIV_ROUND_UP(clk->pll.m * clk->params->min_vco,
396 clk->parent_rate / MHZ); 396 clk->parent_rate / KHZ);
397 val = clk->m << GPCPLL_COEFF_M_SHIFT; 397 val = clk->pll.m << GPCPLL_COEFF_M_SHIFT;
398 val |= (allow_slide ? n_lo : clk->n) << GPCPLL_COEFF_N_SHIFT; 398 val |= (allow_slide ? n_lo : clk->pll.n) << GPCPLL_COEFF_N_SHIFT;
399 val |= clk->pl << GPCPLL_COEFF_P_SHIFT; 399 val |= clk->pll.pl << GPCPLL_COEFF_P_SHIFT;
400 nvkm_wr32(device, GPCPLL_COEFF, val); 400 nvkm_wr32(device, GPCPLL_COEFF, val);
401 401
402 _gk20a_pllg_enable(clk); 402 gk20a_pllg_enable(clk);
403 403
404 val = nvkm_rd32(device, GPCPLL_CFG); 404 val = nvkm_rd32(device, GPCPLL_CFG);
405 if (val & GPCPLL_CFG_LOCK_DET_OFF) { 405 if (val & GPCPLL_CFG_LOCK_DET_OFF) {
@@ -414,16 +414,24 @@ _gk20a_pllg_program_mnp(struct gk20a_clk *clk, bool allow_slide)
414 return -ETIMEDOUT; 414 return -ETIMEDOUT;
415 415
416 /* switch to VCO mode */ 416 /* switch to VCO mode */
417 nvkm_mask(device, SEL_VCO, 0, BIT(SEL_VCO_GPC2CLK_OUT_SHIFT)); 417 nvkm_mask(device, SEL_VCO, BIT(SEL_VCO_GPC2CLK_OUT_SHIFT),
418 BIT(SEL_VCO_GPC2CLK_OUT_SHIFT));
418 419
419 /* restore out divider 1:1 */ 420 /* restore out divider 1:1 */
420 val = nvkm_rd32(device, GPC2CLK_OUT); 421 val = nvkm_rd32(device, GPC2CLK_OUT);
421 val &= ~GPC2CLK_OUT_VCODIV_MASK; 422 if ((val & GPC2CLK_OUT_VCODIV_MASK) !=
422 udelay(2); 423 (GPC2CLK_OUT_VCODIV1 << GPC2CLK_OUT_VCODIV_SHIFT)) {
423 nvkm_wr32(device, GPC2CLK_OUT, val); 424 val &= ~GPC2CLK_OUT_VCODIV_MASK;
425 val |= GPC2CLK_OUT_VCODIV1 << GPC2CLK_OUT_VCODIV_SHIFT;
426 udelay(2);
427 nvkm_wr32(device, GPC2CLK_OUT, val);
428 /* Intentional 2nd write to assure linear divider operation */
429 nvkm_wr32(device, GPC2CLK_OUT, val);
430 nvkm_rd32(device, GPC2CLK_OUT);
431 }
424 432
425 /* slide up to new NDIV */ 433 /* slide up to new NDIV */
426 return allow_slide ? gk20a_pllg_slide(clk, clk->n) : 0; 434 return allow_slide ? gk20a_pllg_slide(clk, clk->pll.n) : 0;
427} 435}
428 436
429static int 437static int
@@ -438,32 +446,6 @@ gk20a_pllg_program_mnp(struct gk20a_clk *clk)
438 return err; 446 return err;
439} 447}
440 448
441static void
442gk20a_pllg_disable(struct gk20a_clk *clk)
443{
444 struct nvkm_device *device = clk->base.subdev.device;
445 u32 val;
446
447 /* slide to VCO min */
448 val = nvkm_rd32(device, GPCPLL_CFG);
449 if (val & GPCPLL_CFG_ENABLE) {
450 u32 coeff, m, n_lo;
451
452 coeff = nvkm_rd32(device, GPCPLL_COEFF);
453 m = (coeff >> GPCPLL_COEFF_M_SHIFT) & MASK(GPCPLL_COEFF_M_WIDTH);
454 n_lo = DIV_ROUND_UP(m * clk->params->min_vco,
455 clk->parent_rate / MHZ);
456 gk20a_pllg_slide(clk, n_lo);
457 }
458
459 /* put PLL in bypass before disabling it */
460 nvkm_mask(device, SEL_VCO, BIT(SEL_VCO_GPC2CLK_OUT_SHIFT), 0);
461
462 _gk20a_pllg_disable(clk);
463}
464
465#define GK20A_CLK_GPC_MDIV 1000
466
467static struct nvkm_pstate 449static struct nvkm_pstate
468gk20a_pstates[] = { 450gk20a_pstates[] = {
469 { 451 {
@@ -558,7 +540,7 @@ gk20a_pstates[] = {
558 }, 540 },
559}; 541};
560 542
561static int 543int
562gk20a_clk_read(struct nvkm_clk *base, enum nv_clk_src src) 544gk20a_clk_read(struct nvkm_clk *base, enum nv_clk_src src)
563{ 545{
564 struct gk20a_clk *clk = gk20a_clk(base); 546 struct gk20a_clk *clk = gk20a_clk(base);
@@ -569,7 +551,7 @@ gk20a_clk_read(struct nvkm_clk *base, enum nv_clk_src src)
569 case nv_clk_src_crystal: 551 case nv_clk_src_crystal:
570 return device->crystal; 552 return device->crystal;
571 case nv_clk_src_gpc: 553 case nv_clk_src_gpc:
572 gk20a_pllg_read_mnp(clk); 554 gk20a_pllg_read_mnp(clk, &clk->pll);
573 return gk20a_pllg_calc_rate(clk) / GK20A_CLK_GPC_MDIV; 555 return gk20a_pllg_calc_rate(clk) / GK20A_CLK_GPC_MDIV;
574 default: 556 default:
575 nvkm_error(subdev, "invalid clock source %d\n", src); 557 nvkm_error(subdev, "invalid clock source %d\n", src);
@@ -577,7 +559,7 @@ gk20a_clk_read(struct nvkm_clk *base, enum nv_clk_src src)
577 } 559 }
578} 560}
579 561
580static int 562int
581gk20a_clk_calc(struct nvkm_clk *base, struct nvkm_cstate *cstate) 563gk20a_clk_calc(struct nvkm_clk *base, struct nvkm_cstate *cstate)
582{ 564{
583 struct gk20a_clk *clk = gk20a_clk(base); 565 struct gk20a_clk *clk = gk20a_clk(base);
@@ -586,7 +568,7 @@ gk20a_clk_calc(struct nvkm_clk *base, struct nvkm_cstate *cstate)
586 GK20A_CLK_GPC_MDIV); 568 GK20A_CLK_GPC_MDIV);
587} 569}
588 570
589static int 571int
590gk20a_clk_prog(struct nvkm_clk *base) 572gk20a_clk_prog(struct nvkm_clk *base)
591{ 573{
592 struct gk20a_clk *clk = gk20a_clk(base); 574 struct gk20a_clk *clk = gk20a_clk(base);
@@ -594,15 +576,33 @@ gk20a_clk_prog(struct nvkm_clk *base)
594 return gk20a_pllg_program_mnp(clk); 576 return gk20a_pllg_program_mnp(clk);
595} 577}
596 578
597static void 579void
598gk20a_clk_tidy(struct nvkm_clk *base) 580gk20a_clk_tidy(struct nvkm_clk *base)
599{ 581{
600} 582}
601 583
602static void 584void
603gk20a_clk_fini(struct nvkm_clk *base) 585gk20a_clk_fini(struct nvkm_clk *base)
604{ 586{
587 struct nvkm_device *device = base->subdev.device;
605 struct gk20a_clk *clk = gk20a_clk(base); 588 struct gk20a_clk *clk = gk20a_clk(base);
589 u32 val;
590
591 /* slide to VCO min */
592 val = nvkm_rd32(device, GPCPLL_CFG);
593 if (val & GPCPLL_CFG_ENABLE) {
594 struct gk20a_pll pll;
595 u32 n_lo;
596
597 gk20a_pllg_read_mnp(clk, &pll);
598 n_lo = DIV_ROUND_UP(pll.m * clk->params->min_vco,
599 clk->parent_rate / KHZ);
600 gk20a_pllg_slide(clk, n_lo);
601 }
602
603 /* put PLL in bypass before disabling it */
604 nvkm_mask(device, SEL_VCO, BIT(SEL_VCO_GPC2CLK_OUT_SHIFT), 0);
605
606 gk20a_pllg_disable(clk); 606 gk20a_pllg_disable(clk);
607} 607}
608 608
@@ -614,9 +614,12 @@ gk20a_clk_init(struct nvkm_clk *base)
614 struct nvkm_device *device = subdev->device; 614 struct nvkm_device *device = subdev->device;
615 int ret; 615 int ret;
616 616
617 nvkm_mask(device, GPC2CLK_OUT, GPC2CLK_OUT_INIT_MASK, GPC2CLK_OUT_INIT_VAL); 617 nvkm_mask(device, GPC2CLK_OUT, GPC2CLK_OUT_INIT_MASK,
618 GPC2CLK_OUT_INIT_VAL);
618 619
619 ret = gk20a_clk_prog(&clk->base); 620 /* Start with lowest frequency */
621 base->func->calc(base, &base->func->pstates[0].base);
622 ret = base->func->prog(&clk->base);
620 if (ret) { 623 if (ret) {
621 nvkm_error(subdev, "cannot initialize clock\n"); 624 nvkm_error(subdev, "cannot initialize clock\n");
622 return ret; 625 return ret;
@@ -643,27 +646,50 @@ gk20a_clk = {
643}; 646};
644 647
645int 648int
646gk20a_clk_new(struct nvkm_device *device, int index, struct nvkm_clk **pclk) 649_gk20a_clk_ctor(struct nvkm_device *device, int index,
650 const struct nvkm_clk_func *func,
651 const struct gk20a_clk_pllg_params *params,
652 struct gk20a_clk *clk)
647{ 653{
648 struct nvkm_device_tegra *tdev = device->func->tegra(device); 654 struct nvkm_device_tegra *tdev = device->func->tegra(device);
655 int ret;
656 int i;
657
658 /* Finish initializing the pstates */
659 for (i = 0; i < func->nr_pstates; i++) {
660 INIT_LIST_HEAD(&func->pstates[i].list);
661 func->pstates[i].pstate = i + 1;
662 }
663
664 clk->params = params;
665 clk->parent_rate = clk_get_rate(tdev->clk);
666
667 ret = nvkm_clk_ctor(func, device, index, true, &clk->base);
668 if (ret)
669 return ret;
670
671 nvkm_debug(&clk->base.subdev, "parent clock rate: %d Khz\n",
672 clk->parent_rate / KHZ);
673
674 return 0;
675}
676
677int
678gk20a_clk_new(struct nvkm_device *device, int index, struct nvkm_clk **pclk)
679{
649 struct gk20a_clk *clk; 680 struct gk20a_clk *clk;
650 int ret, i; 681 int ret;
651 682
652 if (!(clk = kzalloc(sizeof(*clk), GFP_KERNEL))) 683 clk = kzalloc(sizeof(*clk), GFP_KERNEL);
684 if (!clk)
653 return -ENOMEM; 685 return -ENOMEM;
654 *pclk = &clk->base; 686 *pclk = &clk->base;
655 687
656 /* Finish initializing the pstates */ 688 ret = _gk20a_clk_ctor(device, index, &gk20a_clk, &gk20a_pllg_params,
657 for (i = 0; i < ARRAY_SIZE(gk20a_pstates); i++) { 689 clk);
658 INIT_LIST_HEAD(&gk20a_pstates[i].list);
659 gk20a_pstates[i].pstate = i + 1;
660 }
661 690
662 clk->params = &gk20a_pllg_params; 691 clk->pl_to_div = pl_to_div;
663 clk->parent_rate = clk_get_rate(tdev->clk); 692 clk->div_to_pl = div_to_pl;
664 693
665 ret = nvkm_clk_ctor(&gk20a_clk, device, index, true, &clk->base);
666 nvkm_info(&clk->base.subdev, "parent clock rate: %d Mhz\n",
667 clk->parent_rate / MHZ);
668 return ret; 694 return ret;
669} 695}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk20a.h b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk20a.h
new file mode 100644
index 000000000000..13c46740197d
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk20a.h
@@ -0,0 +1,65 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 *
22 */
23
24#ifndef __NVKM_CLK_GK20A_H__
25#define __NVKM_CLK_GK20A_H__
26
27#define GK20A_CLK_GPC_MDIV 1000
28
29#define SYS_GPCPLL_CFG_BASE 0x00137000
30
31/* All frequencies in Khz */
32struct gk20a_clk_pllg_params {
33 u32 min_vco, max_vco;
34 u32 min_u, max_u;
35 u32 min_m, max_m;
36 u32 min_n, max_n;
37 u32 min_pl, max_pl;
38};
39
40struct gk20a_pll {
41 u32 m;
42 u32 n;
43 u32 pl;
44};
45
46struct gk20a_clk {
47 struct nvkm_clk base;
48 const struct gk20a_clk_pllg_params *params;
49 struct gk20a_pll pll;
50 u32 parent_rate;
51
52 u32 (*div_to_pl)(u32);
53 u32 (*pl_to_div)(u32);
54};
55#define gk20a_clk(p) container_of((p), struct gk20a_clk, base)
56
57int _gk20a_clk_ctor(struct nvkm_device *, int, const struct nvkm_clk_func *,
58 const struct gk20a_clk_pllg_params *, struct gk20a_clk *);
59void gk20a_clk_fini(struct nvkm_clk *);
60int gk20a_clk_read(struct nvkm_clk *, enum nv_clk_src);
61int gk20a_clk_calc(struct nvkm_clk *, struct nvkm_cstate *);
62int gk20a_clk_prog(struct nvkm_clk *);
63void gk20a_clk_tidy(struct nvkm_clk *);
64
65#endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gm20b.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gm20b.c
new file mode 100644
index 000000000000..71b2bbb61973
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gm20b.c
@@ -0,0 +1,198 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#include <subdev/clk.h>
24#include <core/device.h>
25
26#include "priv.h"
27#include "gk20a.h"
28
29#define KHZ (1000)
30#define MHZ (KHZ * 1000)
31
32#define MASK(w) ((1 << w) - 1)
33
34#define BYPASSCTRL_SYS (SYS_GPCPLL_CFG_BASE + 0x340)
35#define BYPASSCTRL_SYS_GPCPLL_SHIFT 0
36#define BYPASSCTRL_SYS_GPCPLL_WIDTH 1
37
38static u32 pl_to_div(u32 pl)
39{
40 return pl;
41}
42
43static u32 div_to_pl(u32 div)
44{
45 return div;
46}
47
48static const struct gk20a_clk_pllg_params gm20b_pllg_params = {
49 .min_vco = 1300000, .max_vco = 2600000,
50 .min_u = 12000, .max_u = 38400,
51 .min_m = 1, .max_m = 255,
52 .min_n = 8, .max_n = 255,
53 .min_pl = 1, .max_pl = 31,
54};
55
56static struct nvkm_pstate
57gm20b_pstates[] = {
58 {
59 .base = {
60 .domain[nv_clk_src_gpc] = 76800,
61 .voltage = 0,
62 },
63 },
64 {
65 .base = {
66 .domain[nv_clk_src_gpc] = 153600,
67 .voltage = 1,
68 },
69 },
70 {
71 .base = {
72 .domain[nv_clk_src_gpc] = 230400,
73 .voltage = 2,
74 },
75 },
76 {
77 .base = {
78 .domain[nv_clk_src_gpc] = 307200,
79 .voltage = 3,
80 },
81 },
82 {
83 .base = {
84 .domain[nv_clk_src_gpc] = 384000,
85 .voltage = 4,
86 },
87 },
88 {
89 .base = {
90 .domain[nv_clk_src_gpc] = 460800,
91 .voltage = 5,
92 },
93 },
94 {
95 .base = {
96 .domain[nv_clk_src_gpc] = 537600,
97 .voltage = 6,
98 },
99 },
100 {
101 .base = {
102 .domain[nv_clk_src_gpc] = 614400,
103 .voltage = 7,
104 },
105 },
106 {
107 .base = {
108 .domain[nv_clk_src_gpc] = 691200,
109 .voltage = 8,
110 },
111 },
112 {
113 .base = {
114 .domain[nv_clk_src_gpc] = 768000,
115 .voltage = 9,
116 },
117 },
118 {
119 .base = {
120 .domain[nv_clk_src_gpc] = 844800,
121 .voltage = 10,
122 },
123 },
124 {
125 .base = {
126 .domain[nv_clk_src_gpc] = 921600,
127 .voltage = 11,
128 },
129 },
130 {
131 .base = {
132 .domain[nv_clk_src_gpc] = 998400,
133 .voltage = 12,
134 },
135 },
136
137};
138
139static int
140gm20b_clk_init(struct nvkm_clk *base)
141{
142 struct gk20a_clk *clk = gk20a_clk(base);
143 struct nvkm_subdev *subdev = &clk->base.subdev;
144 struct nvkm_device *device = subdev->device;
145 int ret;
146
147 /* Set the global bypass control to VCO */
148 nvkm_mask(device, BYPASSCTRL_SYS,
149 MASK(BYPASSCTRL_SYS_GPCPLL_WIDTH) << BYPASSCTRL_SYS_GPCPLL_SHIFT,
150 0);
151
152 /* Start with lowest frequency */
153 base->func->calc(base, &base->func->pstates[0].base);
154 ret = base->func->prog(&clk->base);
155 if (ret) {
156 nvkm_error(subdev, "cannot initialize clock\n");
157 return ret;
158 }
159
160 return 0;
161}
162
163static const struct nvkm_clk_func
164gm20b_clk_speedo0 = {
165 .init = gm20b_clk_init,
166 .fini = gk20a_clk_fini,
167 .read = gk20a_clk_read,
168 .calc = gk20a_clk_calc,
169 .prog = gk20a_clk_prog,
170 .tidy = gk20a_clk_tidy,
171 .pstates = gm20b_pstates,
172 .nr_pstates = ARRAY_SIZE(gm20b_pstates) - 1,
173 .domains = {
174 { nv_clk_src_crystal, 0xff },
175 { nv_clk_src_gpc, 0xff, 0, "core", GK20A_CLK_GPC_MDIV },
176 { nv_clk_src_max },
177 },
178};
179
180int
181gm20b_clk_new(struct nvkm_device *device, int index, struct nvkm_clk **pclk)
182{
183 struct gk20a_clk *clk;
184 int ret;
185
186 clk = kzalloc(sizeof(*clk), GFP_KERNEL);
187 if (!clk)
188 return -ENOMEM;
189 *pclk = &clk->base;
190
191 ret = _gk20a_clk_ctor(device, index, &gm20b_clk_speedo0,
192 &gm20b_pllg_params, clk);
193
194 clk->pl_to_div = pl_to_div;
195 clk->div_to_pl = div_to_pl;
196
197 return ret;
198}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/Kbuild b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/Kbuild
index 793e73d16dac..eac88e3dc6e5 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/Kbuild
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/Kbuild
@@ -11,4 +11,4 @@ nvkm-y += nvkm/subdev/devinit/gt215.o
11nvkm-y += nvkm/subdev/devinit/mcp89.o 11nvkm-y += nvkm/subdev/devinit/mcp89.o
12nvkm-y += nvkm/subdev/devinit/gf100.o 12nvkm-y += nvkm/subdev/devinit/gf100.o
13nvkm-y += nvkm/subdev/devinit/gm107.o 13nvkm-y += nvkm/subdev/devinit/gm107.o
14nvkm-y += nvkm/subdev/devinit/gm204.o 14nvkm-y += nvkm/subdev/devinit/gm200.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c
index 22b0140e28c6..2923598b5fe9 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c
@@ -90,9 +90,21 @@ gf100_devinit_disable(struct nvkm_devinit *init)
90 return disable; 90 return disable;
91} 91}
92 92
93void
94gf100_devinit_preinit(struct nvkm_devinit *base)
95{
96 struct nv50_devinit *init = nv50_devinit(base);
97 struct nvkm_subdev *subdev = &init->base.subdev;
98 struct nvkm_device *device = subdev->device;
99
100 /* This bit is set by devinit, and flips back to 0 on suspend */
101 if (!base->post)
102 base->post = ((nvkm_rd32(device, 0x2240c) & BIT(1)) == 0);
103}
104
93static const struct nvkm_devinit_func 105static const struct nvkm_devinit_func
94gf100_devinit = { 106gf100_devinit = {
95 .preinit = nv50_devinit_preinit, 107 .preinit = gf100_devinit_preinit,
96 .init = nv50_devinit_init, 108 .init = nv50_devinit_init,
97 .post = nv04_devinit_post, 109 .post = nv04_devinit_post,
98 .pll_set = gf100_devinit_pll_set, 110 .pll_set = gf100_devinit_pll_set,
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm107.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm107.c
index 2be98bd78214..28ca01be3d38 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm107.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm107.c
@@ -46,7 +46,7 @@ gm107_devinit_disable(struct nvkm_devinit *init)
46 46
47static const struct nvkm_devinit_func 47static const struct nvkm_devinit_func
48gm107_devinit = { 48gm107_devinit = {
49 .preinit = nv50_devinit_preinit, 49 .preinit = gf100_devinit_preinit,
50 .init = nv50_devinit_init, 50 .init = nv50_devinit_init,
51 .post = nv04_devinit_post, 51 .post = nv04_devinit_post,
52 .pll_set = gf100_devinit_pll_set, 52 .pll_set = gf100_devinit_pll_set,
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm204.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm200.c
index 2b9c3f11b7a8..a410c0db8a08 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm204.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm200.c
@@ -107,7 +107,7 @@ pmu_load(struct nv50_devinit *init, u8 type, bool post,
107} 107}
108 108
109static int 109static int
110gm204_devinit_post(struct nvkm_devinit *base, bool post) 110gm200_devinit_post(struct nvkm_devinit *base, bool post)
111{ 111{
112 struct nv50_devinit *init = nv50_devinit(base); 112 struct nv50_devinit *init = nv50_devinit(base);
113 struct nvkm_subdev *subdev = &init->base.subdev; 113 struct nvkm_subdev *subdev = &init->base.subdev;
@@ -165,17 +165,17 @@ gm204_devinit_post(struct nvkm_devinit *base, bool post)
165} 165}
166 166
167static const struct nvkm_devinit_func 167static const struct nvkm_devinit_func
168gm204_devinit = { 168gm200_devinit = {
169 .preinit = nv50_devinit_preinit, 169 .preinit = gf100_devinit_preinit,
170 .init = nv50_devinit_init, 170 .init = nv50_devinit_init,
171 .post = gm204_devinit_post, 171 .post = gm200_devinit_post,
172 .pll_set = gf100_devinit_pll_set, 172 .pll_set = gf100_devinit_pll_set,
173 .disable = gm107_devinit_disable, 173 .disable = gm107_devinit_disable,
174}; 174};
175 175
176int 176int
177gm204_devinit_new(struct nvkm_device *device, int index, 177gm200_devinit_new(struct nvkm_device *device, int index,
178 struct nvkm_devinit **pinit) 178 struct nvkm_devinit **pinit)
179{ 179{
180 return nv50_devinit_new_(&gm204_devinit, device, index, pinit); 180 return nv50_devinit_new_(&gm200_devinit, device, index, pinit);
181} 181}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.c
index 337c2c692dc7..c714b097719c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.c
@@ -93,28 +93,27 @@ nv50_devinit_disable(struct nvkm_devinit *init)
93void 93void
94nv50_devinit_preinit(struct nvkm_devinit *base) 94nv50_devinit_preinit(struct nvkm_devinit *base)
95{ 95{
96 struct nv50_devinit *init = nv50_devinit(base); 96 struct nvkm_subdev *subdev = &base->subdev;
97 struct nvkm_subdev *subdev = &init->base.subdev;
98 struct nvkm_device *device = subdev->device; 97 struct nvkm_device *device = subdev->device;
99 98
100 /* our heuristics can't detect whether the board has had its 99 /* our heuristics can't detect whether the board has had its
101 * devinit scripts executed or not if the display engine is 100 * devinit scripts executed or not if the display engine is
102 * missing, assume it's a secondary gpu which requires post 101 * missing, assume it's a secondary gpu which requires post
103 */ 102 */
104 if (!init->base.post) { 103 if (!base->post) {
105 u64 disable = nvkm_devinit_disable(&init->base); 104 u64 disable = nvkm_devinit_disable(base);
106 if (disable & (1ULL << NVKM_ENGINE_DISP)) 105 if (disable & (1ULL << NVKM_ENGINE_DISP))
107 init->base.post = true; 106 base->post = true;
108 } 107 }
109 108
110 /* magic to detect whether or not x86 vbios code has executed 109 /* magic to detect whether or not x86 vbios code has executed
111 * the devinit scripts to initialise the board 110 * the devinit scripts to initialise the board
112 */ 111 */
113 if (!init->base.post) { 112 if (!base->post) {
114 if (!nvkm_rdvgac(device, 0, 0x00) && 113 if (!nvkm_rdvgac(device, 0, 0x00) &&
115 !nvkm_rdvgac(device, 0, 0x1a)) { 114 !nvkm_rdvgac(device, 0, 0x1a)) {
116 nvkm_debug(subdev, "adaptor not initialised\n"); 115 nvkm_debug(subdev, "adaptor not initialised\n");
117 init->base.post = true; 116 base->post = true;
118 } 117 }
119 } 118 }
120} 119}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.h b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.h
index 5de70a8486b4..25d2ae3af1c6 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.h
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.h
@@ -20,6 +20,7 @@ int gf100_devinit_ctor(struct nvkm_object *, struct nvkm_object *,
20 struct nvkm_oclass *, void *, u32, 20 struct nvkm_oclass *, void *, u32,
21 struct nvkm_object **); 21 struct nvkm_object **);
22int gf100_devinit_pll_set(struct nvkm_devinit *, u32, u32); 22int gf100_devinit_pll_set(struct nvkm_devinit *, u32, u32);
23void gf100_devinit_preinit(struct nvkm_devinit *);
23 24
24u64 gm107_devinit_disable(struct nvkm_devinit *); 25u64 gm107_devinit_disable(struct nvkm_devinit *);
25#endif 26#endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/Kbuild b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/Kbuild
index 1f730613c237..48f01e40b8fc 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/Kbuild
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/Kbuild
@@ -6,7 +6,7 @@ nvkm-y += nvkm/subdev/i2c/g94.o
6nvkm-y += nvkm/subdev/i2c/gf117.o 6nvkm-y += nvkm/subdev/i2c/gf117.o
7nvkm-y += nvkm/subdev/i2c/gf119.o 7nvkm-y += nvkm/subdev/i2c/gf119.o
8nvkm-y += nvkm/subdev/i2c/gk104.o 8nvkm-y += nvkm/subdev/i2c/gk104.o
9nvkm-y += nvkm/subdev/i2c/gm204.o 9nvkm-y += nvkm/subdev/i2c/gm200.o
10 10
11nvkm-y += nvkm/subdev/i2c/pad.o 11nvkm-y += nvkm/subdev/i2c/pad.o
12nvkm-y += nvkm/subdev/i2c/padnv04.o 12nvkm-y += nvkm/subdev/i2c/padnv04.o
@@ -14,7 +14,7 @@ nvkm-y += nvkm/subdev/i2c/padnv4e.o
14nvkm-y += nvkm/subdev/i2c/padnv50.o 14nvkm-y += nvkm/subdev/i2c/padnv50.o
15nvkm-y += nvkm/subdev/i2c/padg94.o 15nvkm-y += nvkm/subdev/i2c/padg94.o
16nvkm-y += nvkm/subdev/i2c/padgf119.o 16nvkm-y += nvkm/subdev/i2c/padgf119.o
17nvkm-y += nvkm/subdev/i2c/padgm204.o 17nvkm-y += nvkm/subdev/i2c/padgm200.o
18 18
19nvkm-y += nvkm/subdev/i2c/bus.o 19nvkm-y += nvkm/subdev/i2c/bus.o
20nvkm-y += nvkm/subdev/i2c/busnv04.o 20nvkm-y += nvkm/subdev/i2c/busnv04.o
@@ -25,6 +25,6 @@ nvkm-y += nvkm/subdev/i2c/bit.o
25 25
26nvkm-y += nvkm/subdev/i2c/aux.o 26nvkm-y += nvkm/subdev/i2c/aux.o
27nvkm-y += nvkm/subdev/i2c/auxg94.o 27nvkm-y += nvkm/subdev/i2c/auxg94.o
28nvkm-y += nvkm/subdev/i2c/auxgm204.o 28nvkm-y += nvkm/subdev/i2c/auxgm200.o
29 29
30nvkm-y += nvkm/subdev/i2c/anx9805.o 30nvkm-y += nvkm/subdev/i2c/anx9805.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.h b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.h
index 35a892e4a4c3..fc6b162fa0b1 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.h
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.h
@@ -18,7 +18,7 @@ int nvkm_i2c_aux_xfer(struct nvkm_i2c_aux *, bool retry, u8 type,
18 u32 addr, u8 *data, u8 size); 18 u32 addr, u8 *data, u8 size);
19 19
20int g94_i2c_aux_new(struct nvkm_i2c_pad *, int, u8, struct nvkm_i2c_aux **); 20int g94_i2c_aux_new(struct nvkm_i2c_pad *, int, u8, struct nvkm_i2c_aux **);
21int gm204_i2c_aux_new(struct nvkm_i2c_pad *, int, u8, struct nvkm_i2c_aux **); 21int gm200_i2c_aux_new(struct nvkm_i2c_pad *, int, u8, struct nvkm_i2c_aux **);
22 22
23#define AUX_MSG(b,l,f,a...) do { \ 23#define AUX_MSG(b,l,f,a...) do { \
24 struct nvkm_i2c_aux *_aux = (b); \ 24 struct nvkm_i2c_aux *_aux = (b); \
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm204.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c
index bed231b56dbd..61d729b82c69 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm204.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c
@@ -21,23 +21,23 @@
21 * 21 *
22 * Authors: Ben Skeggs <bskeggs@redhat.com> 22 * Authors: Ben Skeggs <bskeggs@redhat.com>
23 */ 23 */
24#define gm204_i2c_aux(p) container_of((p), struct gm204_i2c_aux, base) 24#define gm200_i2c_aux(p) container_of((p), struct gm200_i2c_aux, base)
25#include "aux.h" 25#include "aux.h"
26 26
27struct gm204_i2c_aux { 27struct gm200_i2c_aux {
28 struct nvkm_i2c_aux base; 28 struct nvkm_i2c_aux base;
29 int ch; 29 int ch;
30}; 30};
31 31
32static void 32static void
33gm204_i2c_aux_fini(struct gm204_i2c_aux *aux) 33gm200_i2c_aux_fini(struct gm200_i2c_aux *aux)
34{ 34{
35 struct nvkm_device *device = aux->base.pad->i2c->subdev.device; 35 struct nvkm_device *device = aux->base.pad->i2c->subdev.device;
36 nvkm_mask(device, 0x00d954 + (aux->ch * 0x50), 0x00310000, 0x00000000); 36 nvkm_mask(device, 0x00d954 + (aux->ch * 0x50), 0x00310000, 0x00000000);
37} 37}
38 38
39static int 39static int
40gm204_i2c_aux_init(struct gm204_i2c_aux *aux) 40gm200_i2c_aux_init(struct gm200_i2c_aux *aux)
41{ 41{
42 struct nvkm_device *device = aux->base.pad->i2c->subdev.device; 42 struct nvkm_device *device = aux->base.pad->i2c->subdev.device;
43 const u32 unksel = 1; /* nfi which to use, or if it matters.. */ 43 const u32 unksel = 1; /* nfi which to use, or if it matters.. */
@@ -64,7 +64,7 @@ gm204_i2c_aux_init(struct gm204_i2c_aux *aux)
64 udelay(1); 64 udelay(1);
65 if (!timeout--) { 65 if (!timeout--) {
66 AUX_ERR(&aux->base, "magic wait %08x", ctrl); 66 AUX_ERR(&aux->base, "magic wait %08x", ctrl);
67 gm204_i2c_aux_fini(aux); 67 gm200_i2c_aux_fini(aux);
68 return -EBUSY; 68 return -EBUSY;
69 } 69 }
70 } while ((ctrl & 0x03000000) != urep); 70 } while ((ctrl & 0x03000000) != urep);
@@ -73,10 +73,10 @@ gm204_i2c_aux_init(struct gm204_i2c_aux *aux)
73} 73}
74 74
75static int 75static int
76gm204_i2c_aux_xfer(struct nvkm_i2c_aux *obj, bool retry, 76gm200_i2c_aux_xfer(struct nvkm_i2c_aux *obj, bool retry,
77 u8 type, u32 addr, u8 *data, u8 size) 77 u8 type, u32 addr, u8 *data, u8 size)
78{ 78{
79 struct gm204_i2c_aux *aux = gm204_i2c_aux(obj); 79 struct gm200_i2c_aux *aux = gm200_i2c_aux(obj);
80 struct nvkm_device *device = aux->base.pad->i2c->subdev.device; 80 struct nvkm_device *device = aux->base.pad->i2c->subdev.device;
81 const u32 base = aux->ch * 0x50; 81 const u32 base = aux->ch * 0x50;
82 u32 ctrl, stat, timeout, retries; 82 u32 ctrl, stat, timeout, retries;
@@ -85,7 +85,7 @@ gm204_i2c_aux_xfer(struct nvkm_i2c_aux *obj, bool retry,
85 85
86 AUX_TRACE(&aux->base, "%d: %08x %d", type, addr, size); 86 AUX_TRACE(&aux->base, "%d: %08x %d", type, addr, size);
87 87
88 ret = gm204_i2c_aux_init(aux); 88 ret = gm200_i2c_aux_init(aux);
89 if (ret < 0) 89 if (ret < 0)
90 goto out; 90 goto out;
91 91
@@ -155,26 +155,26 @@ gm204_i2c_aux_xfer(struct nvkm_i2c_aux *obj, bool retry,
155 } 155 }
156 156
157out: 157out:
158 gm204_i2c_aux_fini(aux); 158 gm200_i2c_aux_fini(aux);
159 return ret < 0 ? ret : (stat & 0x000f0000) >> 16; 159 return ret < 0 ? ret : (stat & 0x000f0000) >> 16;
160} 160}
161 161
162static const struct nvkm_i2c_aux_func 162static const struct nvkm_i2c_aux_func
163gm204_i2c_aux_func = { 163gm200_i2c_aux_func = {
164 .xfer = gm204_i2c_aux_xfer, 164 .xfer = gm200_i2c_aux_xfer,
165}; 165};
166 166
167int 167int
168gm204_i2c_aux_new(struct nvkm_i2c_pad *pad, int index, u8 drive, 168gm200_i2c_aux_new(struct nvkm_i2c_pad *pad, int index, u8 drive,
169 struct nvkm_i2c_aux **paux) 169 struct nvkm_i2c_aux **paux)
170{ 170{
171 struct gm204_i2c_aux *aux; 171 struct gm200_i2c_aux *aux;
172 172
173 if (!(aux = kzalloc(sizeof(*aux), GFP_KERNEL))) 173 if (!(aux = kzalloc(sizeof(*aux), GFP_KERNEL)))
174 return -ENOMEM; 174 return -ENOMEM;
175 *paux = &aux->base; 175 *paux = &aux->base;
176 176
177 nvkm_i2c_aux_ctor(&gm204_i2c_aux_func, pad, index, &aux->base); 177 nvkm_i2c_aux_ctor(&gm200_i2c_aux_func, pad, index, &aux->base);
178 aux->ch = drive; 178 aux->ch = drive;
179 aux->base.intr = 1 << aux->ch; 179 aux->base.intr = 1 << aux->ch;
180 return 0; 180 return 0;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gm204.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gm200.c
index ff9f7d62f6be..a23c5f315221 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gm204.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gm200.c
@@ -25,16 +25,16 @@
25#include "pad.h" 25#include "pad.h"
26 26
27static const struct nvkm_i2c_func 27static const struct nvkm_i2c_func
28gm204_i2c = { 28gm200_i2c = {
29 .pad_x_new = gf119_i2c_pad_x_new, 29 .pad_x_new = gf119_i2c_pad_x_new,
30 .pad_s_new = gm204_i2c_pad_s_new, 30 .pad_s_new = gm200_i2c_pad_s_new,
31 .aux = 8, 31 .aux = 8,
32 .aux_stat = gk104_aux_stat, 32 .aux_stat = gk104_aux_stat,
33 .aux_mask = gk104_aux_mask, 33 .aux_mask = gk104_aux_mask,
34}; 34};
35 35
36int 36int
37gm204_i2c_new(struct nvkm_device *device, int index, struct nvkm_i2c **pi2c) 37gm200_i2c_new(struct nvkm_device *device, int index, struct nvkm_i2c **pi2c)
38{ 38{
39 return nvkm_i2c_new_(&gm204_i2c, device, index, pi2c); 39 return nvkm_i2c_new_(&gm200_i2c, device, index, pi2c);
40} 40}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.h b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.h
index 9eeb992944c6..316c4536f29a 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.h
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.h
@@ -49,11 +49,11 @@ int nv4e_i2c_pad_new(struct nvkm_i2c *, int, struct nvkm_i2c_pad **);
49int nv50_i2c_pad_new(struct nvkm_i2c *, int, struct nvkm_i2c_pad **); 49int nv50_i2c_pad_new(struct nvkm_i2c *, int, struct nvkm_i2c_pad **);
50int g94_i2c_pad_x_new(struct nvkm_i2c *, int, struct nvkm_i2c_pad **); 50int g94_i2c_pad_x_new(struct nvkm_i2c *, int, struct nvkm_i2c_pad **);
51int gf119_i2c_pad_x_new(struct nvkm_i2c *, int, struct nvkm_i2c_pad **); 51int gf119_i2c_pad_x_new(struct nvkm_i2c *, int, struct nvkm_i2c_pad **);
52int gm204_i2c_pad_x_new(struct nvkm_i2c *, int, struct nvkm_i2c_pad **); 52int gm200_i2c_pad_x_new(struct nvkm_i2c *, int, struct nvkm_i2c_pad **);
53 53
54int g94_i2c_pad_s_new(struct nvkm_i2c *, int, struct nvkm_i2c_pad **); 54int g94_i2c_pad_s_new(struct nvkm_i2c *, int, struct nvkm_i2c_pad **);
55int gf119_i2c_pad_s_new(struct nvkm_i2c *, int, struct nvkm_i2c_pad **); 55int gf119_i2c_pad_s_new(struct nvkm_i2c *, int, struct nvkm_i2c_pad **);
56int gm204_i2c_pad_s_new(struct nvkm_i2c *, int, struct nvkm_i2c_pad **); 56int gm200_i2c_pad_s_new(struct nvkm_i2c *, int, struct nvkm_i2c_pad **);
57 57
58int anx9805_pad_new(struct nvkm_i2c_bus *, int, u8, struct nvkm_i2c_pad **); 58int anx9805_pad_new(struct nvkm_i2c_bus *, int, u8, struct nvkm_i2c_pad **);
59 59
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padgm204.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padgm200.c
index 24a4d760c67b..7d417f6a816e 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padgm204.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padgm200.c
@@ -26,7 +26,7 @@
26#include "bus.h" 26#include "bus.h"
27 27
28static void 28static void
29gm204_i2c_pad_mode(struct nvkm_i2c_pad *pad, enum nvkm_i2c_pad_mode mode) 29gm200_i2c_pad_mode(struct nvkm_i2c_pad *pad, enum nvkm_i2c_pad_mode mode)
30{ 30{
31 struct nvkm_subdev *subdev = &pad->i2c->subdev; 31 struct nvkm_subdev *subdev = &pad->i2c->subdev;
32 struct nvkm_device *device = subdev->device; 32 struct nvkm_device *device = subdev->device;
@@ -51,26 +51,26 @@ gm204_i2c_pad_mode(struct nvkm_i2c_pad *pad, enum nvkm_i2c_pad_mode mode)
51} 51}
52 52
53static const struct nvkm_i2c_pad_func 53static const struct nvkm_i2c_pad_func
54gm204_i2c_pad_s_func = { 54gm200_i2c_pad_s_func = {
55 .bus_new_4 = gf119_i2c_bus_new, 55 .bus_new_4 = gf119_i2c_bus_new,
56 .aux_new_6 = gm204_i2c_aux_new, 56 .aux_new_6 = gm200_i2c_aux_new,
57 .mode = gm204_i2c_pad_mode, 57 .mode = gm200_i2c_pad_mode,
58}; 58};
59 59
60int 60int
61gm204_i2c_pad_s_new(struct nvkm_i2c *i2c, int id, struct nvkm_i2c_pad **ppad) 61gm200_i2c_pad_s_new(struct nvkm_i2c *i2c, int id, struct nvkm_i2c_pad **ppad)
62{ 62{
63 return nvkm_i2c_pad_new_(&gm204_i2c_pad_s_func, i2c, id, ppad); 63 return nvkm_i2c_pad_new_(&gm200_i2c_pad_s_func, i2c, id, ppad);
64} 64}
65 65
66static const struct nvkm_i2c_pad_func 66static const struct nvkm_i2c_pad_func
67gm204_i2c_pad_x_func = { 67gm200_i2c_pad_x_func = {
68 .bus_new_4 = gf119_i2c_bus_new, 68 .bus_new_4 = gf119_i2c_bus_new,
69 .aux_new_6 = gm204_i2c_aux_new, 69 .aux_new_6 = gm200_i2c_aux_new,
70}; 70};
71 71
72int 72int
73gm204_i2c_pad_x_new(struct nvkm_i2c *i2c, int id, struct nvkm_i2c_pad **ppad) 73gm200_i2c_pad_x_new(struct nvkm_i2c *i2c, int id, struct nvkm_i2c_pad **ppad)
74{ 74{
75 return nvkm_i2c_pad_new_(&gm204_i2c_pad_x_func, i2c, id, ppad); 75 return nvkm_i2c_pad_new_(&gm200_i2c_pad_x_func, i2c, id, ppad);
76} 76}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/Kbuild b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/Kbuild
index 7e77a7466992..ad572d3b5466 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/Kbuild
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/Kbuild
@@ -2,4 +2,4 @@ nvkm-y += nvkm/subdev/ibus/gf100.o
2nvkm-y += nvkm/subdev/ibus/gf117.o 2nvkm-y += nvkm/subdev/ibus/gf117.o
3nvkm-y += nvkm/subdev/ibus/gk104.o 3nvkm-y += nvkm/subdev/ibus/gk104.o
4nvkm-y += nvkm/subdev/ibus/gk20a.o 4nvkm-y += nvkm/subdev/ibus/gk20a.o
5nvkm-y += nvkm/subdev/ibus/gm204.o 5nvkm-y += nvkm/subdev/ibus/gm200.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gm204.c b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gm200.c
index b3839dc254ee..ef0b7f3b1128 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gm204.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gm200.c
@@ -24,17 +24,17 @@
24#include "priv.h" 24#include "priv.h"
25 25
26static const struct nvkm_subdev_func 26static const struct nvkm_subdev_func
27gm204_ibus = { 27gm200_ibus = {
28 .intr = gk104_ibus_intr, 28 .intr = gk104_ibus_intr,
29}; 29};
30 30
31int 31int
32gm204_ibus_new(struct nvkm_device *device, int index, 32gm200_ibus_new(struct nvkm_device *device, int index,
33 struct nvkm_subdev **pibus) 33 struct nvkm_subdev **pibus)
34{ 34{
35 struct nvkm_subdev *ibus; 35 struct nvkm_subdev *ibus;
36 if (!(ibus = *pibus = kzalloc(sizeof(*ibus), GFP_KERNEL))) 36 if (!(ibus = *pibus = kzalloc(sizeof(*ibus), GFP_KERNEL)))
37 return -ENOMEM; 37 return -ENOMEM;
38 nvkm_subdev_ctor(&gm204_ibus, device, index, 0, ibus); 38 nvkm_subdev_ctor(&gm200_ibus, device, index, 0, ibus);
39 return 0; 39 return 0;
40} 40}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/Kbuild b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/Kbuild
new file mode 100644
index 000000000000..98a4bd3e98ed
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/Kbuild
@@ -0,0 +1,2 @@
1nvkm-y += nvkm/subdev/iccsense/base.o
2nvkm-y += nvkm/subdev/iccsense/gf100.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c
new file mode 100644
index 000000000000..c44a85228074
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c
@@ -0,0 +1,232 @@
1/*
2 * Copyright 2015 Martin Peres
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: Martin Peres
23 */
24#include "priv.h"
25
26#include <subdev/bios.h>
27#include <subdev/bios/extdev.h>
28#include <subdev/bios/iccsense.h>
29#include <subdev/i2c.h>
30
31static bool
32nvkm_iccsense_validate_device(struct i2c_adapter *i2c, u8 addr,
33 enum nvbios_extdev_type type, u8 rail)
34{
35 switch (type) {
36 case NVBIOS_EXTDEV_INA209:
37 case NVBIOS_EXTDEV_INA219:
38 return rail == 0 && nv_rd16i2cr(i2c, addr, 0x0) >= 0;
39 case NVBIOS_EXTDEV_INA3221:
40 return rail <= 3 &&
41 nv_rd16i2cr(i2c, addr, 0xff) == 0x3220 &&
42 nv_rd16i2cr(i2c, addr, 0xfe) == 0x5449;
43 default:
44 return false;
45 }
46}
47
48static int
49nvkm_iccsense_poll_lane(struct i2c_adapter *i2c, u8 addr, u8 shunt_reg,
50 u8 shunt_shift, u8 bus_reg, u8 bus_shift, u8 shunt,
51 u16 lsb)
52{
53 int vshunt = nv_rd16i2cr(i2c, addr, shunt_reg);
54 int vbus = nv_rd16i2cr(i2c, addr, bus_reg);
55
56 if (vshunt < 0 || vbus < 0)
57 return -EINVAL;
58
59 vshunt >>= shunt_shift;
60 vbus >>= bus_shift;
61
62 return vbus * vshunt * lsb / shunt;
63}
64
65static int
66nvkm_iccsense_ina2x9_read(struct nvkm_iccsense *iccsense,
67 struct nvkm_iccsense_rail *rail,
68 u8 shunt_reg, u8 bus_reg)
69{
70 return nvkm_iccsense_poll_lane(rail->i2c, rail->addr, shunt_reg, 0,
71 bus_reg, 3, rail->mohm, 10 * 4);
72}
73
74static int
75nvkm_iccsense_ina209_read(struct nvkm_iccsense *iccsense,
76 struct nvkm_iccsense_rail *rail)
77{
78 return nvkm_iccsense_ina2x9_read(iccsense, rail, 3, 4);
79}
80
81static int
82nvkm_iccsense_ina219_read(struct nvkm_iccsense *iccsense,
83 struct nvkm_iccsense_rail *rail)
84{
85 return nvkm_iccsense_ina2x9_read(iccsense, rail, 1, 2);
86}
87
88static int
89nvkm_iccsense_ina3221_read(struct nvkm_iccsense *iccsense,
90 struct nvkm_iccsense_rail *rail)
91{
92 return nvkm_iccsense_poll_lane(rail->i2c, rail->addr,
93 1 + (rail->rail * 2), 3,
94 2 + (rail->rail * 2), 3, rail->mohm,
95 40 * 8);
96}
97
98int
99nvkm_iccsense_read(struct nvkm_iccsense *iccsense, u8 idx)
100{
101 struct nvkm_iccsense_rail *rail;
102
103 if (!iccsense || idx >= iccsense->rail_count)
104 return -EINVAL;
105
106 rail = &iccsense->rails[idx];
107 if (!rail->read)
108 return -ENODEV;
109
110 return rail->read(iccsense, rail);
111}
112
113int
114nvkm_iccsense_read_all(struct nvkm_iccsense *iccsense)
115{
116 int result = 0, i;
117 for (i = 0; i < iccsense->rail_count; ++i) {
118 int res = nvkm_iccsense_read(iccsense, i);
119 if (res >= 0)
120 result += res;
121 else
122 return res;
123 }
124 return result;
125}
126
127static void *
128nvkm_iccsense_dtor(struct nvkm_subdev *subdev)
129{
130 struct nvkm_iccsense *iccsense = nvkm_iccsense(subdev);
131
132 if (iccsense->rails)
133 kfree(iccsense->rails);
134
135 return iccsense;
136}
137
138static int
139nvkm_iccsense_oneinit(struct nvkm_subdev *subdev)
140{
141 struct nvkm_iccsense *iccsense = nvkm_iccsense(subdev);
142 struct nvkm_bios *bios = subdev->device->bios;
143 struct nvkm_i2c *i2c = subdev->device->i2c;
144 struct nvbios_iccsense stbl;
145 int i;
146
147 if (!i2c || !bios || nvbios_iccsense_parse(bios, &stbl)
148 || !stbl.nr_entry)
149 return 0;
150
151 iccsense->rails = kmalloc(sizeof(*iccsense->rails) * stbl.nr_entry,
152 GFP_KERNEL);
153 if (!iccsense->rails)
154 return -ENOMEM;
155
156 iccsense->data_valid = true;
157 for (i = 0; i < stbl.nr_entry; ++i) {
158 struct pwr_rail_t *r = &stbl.rail[i];
159 struct nvbios_extdev_func extdev;
160 struct nvkm_iccsense_rail *rail;
161 struct nvkm_i2c_bus *i2c_bus;
162 u8 addr;
163
164 if (!r->mode || r->resistor_mohm == 0)
165 continue;
166
167 if (nvbios_extdev_parse(bios, r->extdev_id, &extdev))
168 continue;
169
170 if (extdev.type == 0xff)
171 continue;
172
173 if (extdev.bus)
174 i2c_bus = nvkm_i2c_bus_find(i2c, NVKM_I2C_BUS_SEC);
175 else
176 i2c_bus = nvkm_i2c_bus_find(i2c, NVKM_I2C_BUS_PRI);
177 if (!i2c_bus)
178 continue;
179
180 addr = extdev.addr >> 1;
181 if (!nvkm_iccsense_validate_device(&i2c_bus->i2c, addr,
182 extdev.type, r->rail)) {
183 iccsense->data_valid = false;
184 nvkm_warn(subdev, "found unknown or invalid rail entry"
185 " type 0x%x rail %i, power reading might be"
186 " invalid\n", extdev.type, r->rail);
187 continue;
188 }
189
190 rail = &iccsense->rails[iccsense->rail_count];
191 switch (extdev.type) {
192 case NVBIOS_EXTDEV_INA209:
193 rail->read = nvkm_iccsense_ina209_read;
194 break;
195 case NVBIOS_EXTDEV_INA219:
196 rail->read = nvkm_iccsense_ina219_read;
197 break;
198 case NVBIOS_EXTDEV_INA3221:
199 rail->read = nvkm_iccsense_ina3221_read;
200 break;
201 }
202
203 rail->addr = addr;
204 rail->rail = r->rail;
205 rail->mohm = r->resistor_mohm;
206 rail->i2c = &i2c_bus->i2c;
207 ++iccsense->rail_count;
208 }
209 return 0;
210}
211
212struct nvkm_subdev_func iccsense_func = {
213 .oneinit = nvkm_iccsense_oneinit,
214 .dtor = nvkm_iccsense_dtor,
215};
216
217void
218nvkm_iccsense_ctor(struct nvkm_device *device, int index,
219 struct nvkm_iccsense *iccsense)
220{
221 nvkm_subdev_ctor(&iccsense_func, device, index, 0, &iccsense->subdev);
222}
223
224int
225nvkm_iccsense_new_(struct nvkm_device *device, int index,
226 struct nvkm_iccsense **iccsense)
227{
228 if (!(*iccsense = kzalloc(sizeof(**iccsense), GFP_KERNEL)))
229 return -ENOMEM;
230 nvkm_iccsense_ctor(device, index, *iccsense);
231 return 0;
232}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/gf100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/gf100.c
new file mode 100644
index 000000000000..cccff1c8a409
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/gf100.c
@@ -0,0 +1,31 @@
1/*
2 * Copyright 2015 Karol Herbst
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: Karol Herbst
23 */
24#include "priv.h"
25
26int
27gf100_iccsense_new(struct nvkm_device *device, int index,
28 struct nvkm_iccsense **piccsense)
29{
30 return nvkm_iccsense_new_(device, index, piccsense);
31}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/priv.h b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/priv.h
new file mode 100644
index 000000000000..ed398b81e86e
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/priv.h
@@ -0,0 +1,16 @@
1#ifndef __NVKM_ICCSENSE_PRIV_H__
2#define __NVKM_ICCSENSE_PRIV_H__
3#define nvkm_iccsense(p) container_of((p), struct nvkm_iccsense, subdev)
4#include <subdev/iccsense.h>
5
6struct nvkm_iccsense_rail {
7 int (*read)(struct nvkm_iccsense *, struct nvkm_iccsense_rail *);
8 struct i2c_adapter *i2c;
9 u8 addr;
10 u8 rail;
11 u8 mohm;
12};
13
14void nvkm_iccsense_ctor(struct nvkm_device *, int, struct nvkm_iccsense *);
15int nvkm_iccsense_new_(struct nvkm_device *, int, struct nvkm_iccsense **);
16#endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c
index 4c20fec64d96..6b8f2a19b2d9 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c
@@ -228,6 +228,8 @@ gk20a_instobj_release_dma(struct nvkm_memory *memory)
228 struct gk20a_instmem *imem = node->imem; 228 struct gk20a_instmem *imem = node->imem;
229 struct nvkm_ltc *ltc = imem->base.subdev.device->ltc; 229 struct nvkm_ltc *ltc = imem->base.subdev.device->ltc;
230 230
231 /* in case we got a write-combined mapping */
232 wmb();
231 nvkm_ltc_invalidate(ltc); 233 nvkm_ltc_invalidate(ltc);
232} 234}
233 235
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/ltc/Kbuild b/drivers/gpu/drm/nouveau/nvkm/subdev/ltc/Kbuild
index f8108df3cb38..932b366598aa 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/ltc/Kbuild
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/ltc/Kbuild
@@ -2,4 +2,4 @@ nvkm-y += nvkm/subdev/ltc/base.o
2nvkm-y += nvkm/subdev/ltc/gf100.o 2nvkm-y += nvkm/subdev/ltc/gf100.o
3nvkm-y += nvkm/subdev/ltc/gk104.o 3nvkm-y += nvkm/subdev/ltc/gk104.o
4nvkm-y += nvkm/subdev/ltc/gm107.o 4nvkm-y += nvkm/subdev/ltc/gm107.o
5nvkm-y += nvkm/subdev/ltc/gm204.o 5nvkm-y += nvkm/subdev/ltc/gm200.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gf100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gf100.c
index fb0de83da13c..c9eb677967a8 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gf100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gf100.c
@@ -129,9 +129,7 @@ gf100_ltc_invalidate(struct nvkm_ltc *ltc)
129 s64 taken; 129 s64 taken;
130 130
131 nvkm_wr32(device, 0x70004, 0x00000001); 131 nvkm_wr32(device, 0x70004, 0x00000001);
132 taken = nvkm_wait_msec(device, 2, 0x70004, 0x00000003, 0x00000000); 132 taken = nvkm_wait_msec(device, 2000, 0x70004, 0x00000003, 0x00000000);
133 if (taken < 0)
134 nvkm_warn(&ltc->subdev, "LTC invalidate timeout\n");
135 133
136 if (taken > 0) 134 if (taken > 0)
137 nvkm_debug(&ltc->subdev, "LTC invalidate took %lld ns\n", taken); 135 nvkm_debug(&ltc->subdev, "LTC invalidate took %lld ns\n", taken);
@@ -144,9 +142,7 @@ gf100_ltc_flush(struct nvkm_ltc *ltc)
144 s64 taken; 142 s64 taken;
145 143
146 nvkm_wr32(device, 0x70010, 0x00000001); 144 nvkm_wr32(device, 0x70010, 0x00000001);
147 taken = nvkm_wait_msec(device, 2, 0x70010, 0x00000003, 0x00000000); 145 taken = nvkm_wait_msec(device, 2000, 0x70010, 0x00000003, 0x00000000);
148 if (taken < 0)
149 nvkm_warn(&ltc->subdev, "LTC flush timeout\n");
150 146
151 if (taken > 0) 147 if (taken > 0)
152 nvkm_debug(&ltc->subdev, "LTC flush took %lld ns\n", taken); 148 nvkm_debug(&ltc->subdev, "LTC flush took %lld ns\n", taken);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gm107.c b/drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gm107.c
index 2af1f9e100fc..e292f5679418 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gm107.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gm107.c
@@ -43,10 +43,8 @@ gm107_ltc_cbc_wait(struct nvkm_ltc *ltc)
43 for (c = 0; c < ltc->ltc_nr; c++) { 43 for (c = 0; c < ltc->ltc_nr; c++) {
44 for (s = 0; s < ltc->lts_nr; s++) { 44 for (s = 0; s < ltc->lts_nr; s++) {
45 const u32 addr = 0x14046c + (c * 0x2000) + (s * 0x200); 45 const u32 addr = 0x14046c + (c * 0x2000) + (s * 0x200);
46 nvkm_msec(device, 2000, 46 nvkm_wait_msec(device, 2000, addr,
47 if (!nvkm_rd32(device, addr)) 47 0x00000004, 0x00000000);
48 break;
49 );
50 } 48 }
51 } 49 }
52} 50}
@@ -75,7 +73,7 @@ gm107_ltc_lts_isr(struct nvkm_ltc *ltc, int c, int s)
75{ 73{
76 struct nvkm_subdev *subdev = &ltc->subdev; 74 struct nvkm_subdev *subdev = &ltc->subdev;
77 struct nvkm_device *device = subdev->device; 75 struct nvkm_device *device = subdev->device;
78 u32 base = 0x140000 + (c * 0x2000) + (s * 0x400); 76 u32 base = 0x140000 + (c * 0x2000) + (s * 0x200);
79 u32 stat = nvkm_rd32(device, base + 0x00c); 77 u32 stat = nvkm_rd32(device, base + 0x00c);
80 78
81 if (stat) { 79 if (stat) {
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gm204.c b/drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gm200.c
index 5ad6fb9d022d..2a29bfd5125a 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gm204.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gm200.c
@@ -27,7 +27,7 @@
27#include <subdev/timer.h> 27#include <subdev/timer.h>
28 28
29static int 29static int
30gm204_ltc_oneinit(struct nvkm_ltc *ltc) 30gm200_ltc_oneinit(struct nvkm_ltc *ltc)
31{ 31{
32 struct nvkm_device *device = ltc->subdev.device; 32 struct nvkm_device *device = ltc->subdev.device;
33 33
@@ -37,15 +37,15 @@ gm204_ltc_oneinit(struct nvkm_ltc *ltc)
37 return gf100_ltc_oneinit_tag_ram(ltc); 37 return gf100_ltc_oneinit_tag_ram(ltc);
38} 38}
39static void 39static void
40gm204_ltc_init(struct nvkm_ltc *ltc) 40gm200_ltc_init(struct nvkm_ltc *ltc)
41{ 41{
42 nvkm_wr32(ltc->subdev.device, 0x17e278, ltc->tag_base); 42 nvkm_wr32(ltc->subdev.device, 0x17e278, ltc->tag_base);
43} 43}
44 44
45static const struct nvkm_ltc_func 45static const struct nvkm_ltc_func
46gm204_ltc = { 46gm200_ltc = {
47 .oneinit = gm204_ltc_oneinit, 47 .oneinit = gm200_ltc_oneinit,
48 .init = gm204_ltc_init, 48 .init = gm200_ltc_init,
49 .intr = gm107_ltc_intr, /*XXX: not validated */ 49 .intr = gm107_ltc_intr, /*XXX: not validated */
50 .cbc_clear = gm107_ltc_cbc_clear, 50 .cbc_clear = gm107_ltc_cbc_clear,
51 .cbc_wait = gm107_ltc_cbc_wait, 51 .cbc_wait = gm107_ltc_cbc_wait,
@@ -57,7 +57,7 @@ gm204_ltc = {
57}; 57};
58 58
59int 59int
60gm204_ltc_new(struct nvkm_device *device, int index, struct nvkm_ltc **pltc) 60gm200_ltc_new(struct nvkm_device *device, int index, struct nvkm_ltc **pltc)
61{ 61{
62 return nvkm_ltc_new_(&gm204_ltc, device, index, pltc); 62 return nvkm_ltc_new_(&gm200_ltc, device, index, pltc);
63} 63}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gf100.fuc3.h b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gf100.fuc3.h
index 770294457274..e2faccffee6f 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gf100.fuc3.h
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gf100.fuc3.h
@@ -24,8 +24,8 @@ uint32_t gf100_pmu_data[] = {
24 0x00000000, 24 0x00000000,
25/* 0x0058: proc_list_head */ 25/* 0x0058: proc_list_head */
26 0x54534f48, 26 0x54534f48,
27 0x00000507, 27 0x0000050a,
28 0x000004a4, 28 0x000004a7,
29 0x00000000, 29 0x00000000,
30 0x00000000, 30 0x00000000,
31 0x00000000, 31 0x00000000,
@@ -46,8 +46,8 @@ uint32_t gf100_pmu_data[] = {
46 0x00000000, 46 0x00000000,
47 0x00000000, 47 0x00000000,
48 0x584d454d, 48 0x584d454d,
49 0x00000753, 49 0x00000756,
50 0x00000745, 50 0x00000748,
51 0x00000000, 51 0x00000000,
52 0x00000000, 52 0x00000000,
53 0x00000000, 53 0x00000000,
@@ -68,8 +68,8 @@ uint32_t gf100_pmu_data[] = {
68 0x00000000, 68 0x00000000,
69 0x00000000, 69 0x00000000,
70 0x46524550, 70 0x46524550,
71 0x00000757, 71 0x0000075a,
72 0x00000755, 72 0x00000758,
73 0x00000000, 73 0x00000000,
74 0x00000000, 74 0x00000000,
75 0x00000000, 75 0x00000000,
@@ -90,8 +90,8 @@ uint32_t gf100_pmu_data[] = {
90 0x00000000, 90 0x00000000,
91 0x00000000, 91 0x00000000,
92 0x5f433249, 92 0x5f433249,
93 0x00000b87, 93 0x00000b8a,
94 0x00000a2a, 94 0x00000a2d,
95 0x00000000, 95 0x00000000,
96 0x00000000, 96 0x00000000,
97 0x00000000, 97 0x00000000,
@@ -112,8 +112,8 @@ uint32_t gf100_pmu_data[] = {
112 0x00000000, 112 0x00000000,
113 0x00000000, 113 0x00000000,
114 0x54534554, 114 0x54534554,
115 0x00000bb0, 115 0x00000bb3,
116 0x00000b89, 116 0x00000b8c,
117 0x00000000, 117 0x00000000,
118 0x00000000, 118 0x00000000,
119 0x00000000, 119 0x00000000,
@@ -134,8 +134,8 @@ uint32_t gf100_pmu_data[] = {
134 0x00000000, 134 0x00000000,
135 0x00000000, 135 0x00000000,
136 0x454c4449, 136 0x454c4449,
137 0x00000bbc, 137 0x00000bbf,
138 0x00000bba, 138 0x00000bbd,
139 0x00000000, 139 0x00000000,
140 0x00000000, 140 0x00000000,
141 0x00000000, 141 0x00000000,
@@ -229,26 +229,26 @@ uint32_t gf100_pmu_data[] = {
229/* 0x0370: memx_func_head */ 229/* 0x0370: memx_func_head */
230 0x00000001, 230 0x00000001,
231 0x00000000, 231 0x00000000,
232 0x00000546, 232 0x00000549,
233/* 0x037c: memx_func_next */ 233/* 0x037c: memx_func_next */
234 0x00000002, 234 0x00000002,
235 0x00000000, 235 0x00000000,
236 0x000005d0, 236 0x000005d3,
237 0x00000003, 237 0x00000003,
238 0x00000002, 238 0x00000002,
239 0x0000069a, 239 0x0000069d,
240 0x00040004, 240 0x00040004,
241 0x00000000, 241 0x00000000,
242 0x000006b6, 242 0x000006b9,
243 0x00010005, 243 0x00010005,
244 0x00000000, 244 0x00000000,
245 0x000006d3, 245 0x000006d6,
246 0x00010006, 246 0x00010006,
247 0x00000000, 247 0x00000000,
248 0x00000658, 248 0x0000065b,
249 0x00000007, 249 0x00000007,
250 0x00000000, 250 0x00000000,
251 0x000006de, 251 0x000006e1,
252/* 0x03c4: memx_func_tail */ 252/* 0x03c4: memx_func_tail */
253/* 0x03c4: memx_ts_start */ 253/* 0x03c4: memx_ts_start */
254 0x00000000, 254 0x00000000,
@@ -917,887 +917,887 @@ uint32_t gf100_pmu_data[] = {
917}; 917};
918 918
919uint32_t gf100_pmu_code[] = { 919uint32_t gf100_pmu_code[] = {
920 0x03930ef5, 920 0x03920ef5,
921/* 0x0004: rd32 */ 921/* 0x0004: rd32 */
922 0x07a007f1, 922 0x07a007f1,
923 0xd00604b6, 923 0xd00604b6,
924 0x04bd000e, 924 0x04bd000e,
925 0xf001d7f0, 925 0x0001d7f1,
926 0x07f101d3, 926 0xf101d3f0,
927 0x04b607ac, 927 0xb607ac07,
928 0x000dd006,
929/* 0x0022: rd32_wait */
930 0xd7f104bd,
931 0xd4b607ac,
932 0x00ddcf06,
933 0x7000d4f1,
934 0xf1f21bf4,
935 0xb607a4d7,
936 0xddcf06d4,
937/* 0x003f: wr32 */
938 0xf100f800,
939 0xb607a007,
940 0x0ed00604,
941 0xf104bd00,
942 0xb607a407,
943 0x0dd00604, 928 0x0dd00604,
944 0xf004bd00, 929/* 0x0023: rd32_wait */
945 0xd5f002d7, 930 0xf104bd00,
946 0x01d3f0f0, 931 0xb607acd7,
947 0x07ac07f1, 932 0xddcf06d4,
933 0x00d4f100,
934 0xf21bf470,
935 0x07a4d7f1,
936 0xcf06d4b6,
937 0x00f800dd,
938/* 0x0040: wr32 */
939 0x07a007f1,
940 0xd00604b6,
941 0x04bd000e,
942 0x07a407f1,
948 0xd00604b6, 943 0xd00604b6,
949 0x04bd000d, 944 0x04bd000d,
950/* 0x006c: wr32_wait */ 945 0x00f2d7f1,
951 0x07acd7f1, 946 0xf101d3f0,
952 0xcf06d4b6, 947 0xb607ac07,
953 0xd4f100dd, 948 0x0dd00604,
954 0x1bf47000, 949/* 0x006b: wr32_wait */
955/* 0x007f: nsec */ 950 0xf104bd00,
956 0xf900f8f2, 951 0xb607acd7,
957 0xf080f990, 952 0xddcf06d4,
958 0x84b62c87, 953 0x00d4f100,
959 0x0088cf06, 954 0xf21bf470,
960/* 0x008c: nsec_loop */ 955/* 0x007e: nsec */
961 0xb62c97f0, 956 0x90f900f8,
962 0x99cf0694, 957 0x87f080f9,
963 0x0298bb00, 958 0x0684b62c,
964 0xf4069eb8, 959/* 0x008b: nsec_loop */
965 0x80fcf11e, 960 0xf00088cf,
966 0x00f890fc,
967/* 0x00a4: wait */
968 0x80f990f9,
969 0xb62c87f0,
970 0x88cf0684,
971/* 0x00b1: wait_loop */
972 0x02eeb900,
973 0xb90421f4,
974 0xadfd02da,
975 0x06acb804,
976 0xf0150bf4,
977 0x94b62c97, 961 0x94b62c97,
978 0x0099cf06, 962 0x0099cf06,
979 0xb80298bb, 963 0xb80298bb,
980 0x1ef4069b, 964 0x1ef4069e,
981/* 0x00d5: wait_done */ 965 0xfc80fcf1,
982 0xfc80fcdf, 966/* 0x00a3: wait */
983/* 0x00db: intr_watchdog */ 967 0xf900f890,
984 0x9800f890, 968 0xf080f990,
985 0x96b003e9, 969 0x84b62c87,
986 0x2a0bf400,
987 0xbb9a0a98,
988 0x1cf4029a,
989 0x01d7f00f,
990 0x02d221f5,
991 0x0ef494bd,
992/* 0x00f9: intr_watchdog_next_time */
993 0x9b0a9815,
994 0xf400a6b0,
995 0x9ab8090b,
996 0x061cf406,
997/* 0x0108: intr_watchdog_next_time_set */
998/* 0x010b: intr_watchdog_next_proc */
999 0x809b0980,
1000 0xe0b603e9,
1001 0x68e6b158,
1002 0xc61bf402,
1003/* 0x011a: intr */
1004 0x00f900f8,
1005 0x80f904bd,
1006 0xa0f990f9,
1007 0xc0f9b0f9,
1008 0xe0f9d0f9,
1009 0xf7f0f0f9,
1010 0x0188fe00,
1011 0x87f180f9,
1012 0x84b605d0,
1013 0x0088cf06, 970 0x0088cf06,
1014 0xf10180b6, 971/* 0x00b0: wait_loop */
1015 0xb605d007, 972 0xf402eeb9,
973 0xdab90421,
974 0x04adfd02,
975 0xf406acb8,
976 0x97f0150b,
977 0x0694b62c,
978 0xbb0099cf,
979 0x9bb80298,
980 0xdf1ef406,
981/* 0x00d4: wait_done */
982 0x90fc80fc,
983/* 0x00da: intr_watchdog */
984 0xe99800f8,
985 0x0096b003,
986 0x982a0bf4,
987 0x9abb9a0a,
988 0x0f1cf402,
989 0xf501d7f0,
990 0xbd02d121,
991 0x150ef494,
992/* 0x00f8: intr_watchdog_next_time */
993 0xb09b0a98,
994 0x0bf400a6,
995 0x069ab809,
996/* 0x0107: intr_watchdog_next_time_set */
997 0x80061cf4,
998/* 0x010a: intr_watchdog_next_proc */
999 0xe9809b09,
1000 0x58e0b603,
1001 0x0268e6b1,
1002 0xf8c61bf4,
1003/* 0x0119: intr */
1004 0xbd00f900,
1005 0xf980f904,
1006 0xf9a0f990,
1007 0xf9c0f9b0,
1008 0xf9e0f9d0,
1009 0x00f7f0f0,
1010 0xf90188fe,
1011 0xd087f180,
1012 0x0684b605,
1013 0xb60088cf,
1014 0x07f10180,
1015 0x04b605d0,
1016 0x0008d006,
1017 0x87f004bd,
1018 0x0684b608,
1019 0xc40088cf,
1020 0x0bf40289,
1021 0x9b008023,
1022 0xf458e7f0,
1023 0x0998da21,
1024 0x0096b09b,
1025 0xf0110bf4,
1026 0x04b63407,
1027 0x0009d006,
1028 0x098004bd,
1029/* 0x017d: intr_skip_watchdog */
1030 0x0089e49a,
1031 0x480bf408,
1032 0x068897f1,
1033 0xcf0694b6,
1034 0x9ac40099,
1035 0x2c0bf402,
1036 0x04c0c7f1,
1037 0xcf06c4b6,
1038 0xc0f900cc,
1039 0x4f48e7f1,
1040 0x5453e3f1,
1041 0xf500d7f0,
1042 0xfc033621,
1043 0xc007f1c0,
1044 0x0604b604,
1045 0xbd000cd0,
1046/* 0x01bd: intr_subintr_skip_fifo */
1047 0x8807f104,
1048 0x0604b606,
1049 0xbd0009d0,
1050/* 0x01c9: intr_skip_subintr */
1051 0xe097f104,
1052 0xfd90bd00,
1053 0x07f00489,
1054 0x0604b604,
1055 0xbd0008d0,
1056 0xfe80fc04,
1057 0xf0fc0088,
1058 0xd0fce0fc,
1059 0xb0fcc0fc,
1060 0x90fca0fc,
1061 0x00fc80fc,
1062 0xf80032f4,
1063/* 0x01f9: ticks_from_ns */
1064 0xf9c0f901,
1065 0xcbd7f1b0,
1066 0x00d3f000,
1067 0x040b21f5,
1068 0x03e8ccec,
1069 0xf400b4b0,
1070 0xeeec120b,
1071 0xd7f103e8,
1072 0xd3f000cb,
1073 0x0b21f500,
1074/* 0x0221: ticks_from_ns_quit */
1075 0x02ceb904,
1076 0xc0fcb0fc,
1077/* 0x022a: ticks_from_us */
1078 0xc0f900f8,
1079 0xd7f1b0f9,
1080 0xd3f000cb,
1081 0x0b21f500,
1082 0x02ceb904,
1083 0xf400b4b0,
1084 0xe4bd050b,
1085/* 0x0244: ticks_from_us_quit */
1086 0xc0fcb0fc,
1087/* 0x024a: ticks_to_us */
1088 0xd7f100f8,
1089 0xd3f000cb,
1090 0xecedff00,
1091/* 0x0256: timer */
1092 0x90f900f8,
1093 0x32f480f9,
1094 0x03f89810,
1095 0xf40086b0,
1096 0x84bd651c,
1097 0xb63807f0,
1016 0x08d00604, 1098 0x08d00604,
1017 0xf004bd00, 1099 0xf004bd00,
1018 0x84b60887, 1100 0x84b63487,
1019 0x0088cf06, 1101 0x0088cf06,
1020 0xf40289c4, 1102 0xbb9a0998,
1021 0x0080230b, 1103 0xe9bb0298,
1022 0x58e7f09b, 1104 0x03fe8000,
1023 0x98db21f4, 1105 0xb60887f0,
1024 0x96b09b09, 1106 0x88cf0684,
1025 0x110bf400, 1107 0x0284f000,
1108 0xf0261bf4,
1109 0x84b63487,
1110 0x0088cf06,
1111 0xf406e0b8,
1112 0xe8b8090b,
1113 0x111cf406,
1114/* 0x02ac: timer_reset */
1026 0xb63407f0, 1115 0xb63407f0,
1027 0x09d00604, 1116 0x0ed00604,
1028 0x8004bd00, 1117 0x8004bd00,
1029/* 0x017e: intr_skip_watchdog */ 1118/* 0x02ba: timer_enable */
1030 0x89e49a09, 1119 0x87f09a0e,
1031 0x0bf40800, 1120 0x3807f001,
1032 0x8897f148,
1033 0x0694b606,
1034 0xc40099cf,
1035 0x0bf4029a,
1036 0xc0c7f12c,
1037 0x06c4b604,
1038 0xf900cccf,
1039 0x48e7f1c0,
1040 0x53e3f14f,
1041 0x00d7f054,
1042 0x033721f5,
1043 0x07f1c0fc,
1044 0x04b604c0,
1045 0x000cd006,
1046/* 0x01be: intr_subintr_skip_fifo */
1047 0x07f104bd,
1048 0x04b60688,
1049 0x0009d006,
1050/* 0x01ca: intr_skip_subintr */
1051 0x97f104bd,
1052 0x90bd00e0,
1053 0xf00489fd,
1054 0x04b60407,
1055 0x0008d006,
1056 0x80fc04bd,
1057 0xfc0088fe,
1058 0xfce0fcf0,
1059 0xfcc0fcd0,
1060 0xfca0fcb0,
1061 0xfc80fc90,
1062 0x0032f400,
1063/* 0x01fa: ticks_from_ns */
1064 0xc0f901f8,
1065 0xd7f1b0f9,
1066 0xd3f000cb,
1067 0x0821f500,
1068 0xe8ccec04,
1069 0x00b4b003,
1070 0xec120bf4,
1071 0xf103e8ee,
1072 0xf000cbd7,
1073 0x21f500d3,
1074/* 0x0222: ticks_from_ns_quit */
1075 0xceb90408,
1076 0xfcb0fc02,
1077/* 0x022b: ticks_from_us */
1078 0xf900f8c0,
1079 0xf1b0f9c0,
1080 0xf000cbd7,
1081 0x21f500d3,
1082 0xceb90408,
1083 0x00b4b002,
1084 0xbd050bf4,
1085/* 0x0245: ticks_from_us_quit */
1086 0xfcb0fce4,
1087/* 0x024b: ticks_to_us */
1088 0xf100f8c0,
1089 0xf000cbd7,
1090 0xedff00d3,
1091/* 0x0257: timer */
1092 0xf900f8ec,
1093 0xf480f990,
1094 0xf8981032,
1095 0x0086b003,
1096 0xbd651cf4,
1097 0x3807f084,
1098 0xd00604b6, 1121 0xd00604b6,
1099 0x04bd0008, 1122 0x04bd0008,
1100 0xb63487f0, 1123/* 0x02c8: timer_done */
1101 0x88cf0684, 1124 0xfc1031f4,
1102 0x9a099800, 1125 0xf890fc80,
1103 0xbb0298bb, 1126/* 0x02d1: send_proc */
1104 0xfe8000e9, 1127 0xf980f900,
1105 0x0887f003, 1128 0x05e89890,
1106 0xcf0684b6, 1129 0xf004e998,
1107 0x84f00088, 1130 0x89b80486,
1108 0x261bf402, 1131 0x2a0bf406,
1109 0xb63487f0, 1132 0x940398c4,
1110 0x88cf0684, 1133 0x80b60488,
1111 0x06e0b800, 1134 0x008ebb18,
1112 0xb8090bf4, 1135 0x8000fa98,
1113 0x1cf406e8, 1136 0x8d80008a,
1114/* 0x02ad: timer_reset */ 1137 0x028c8001,
1115 0x3407f011, 1138 0xb6038b80,
1116 0xd00604b6, 1139 0x94f00190,
1117 0x04bd000e, 1140 0x04e98007,
1118/* 0x02bb: timer_enable */ 1141/* 0x030b: send_done */
1119 0xf09a0e80, 1142 0xfc0231f4,
1120 0x07f00187, 1143 0xf880fc90,
1121 0x0604b638, 1144/* 0x0311: find */
1122 0xbd0008d0, 1145 0xf080f900,
1123/* 0x02c9: timer_done */ 1146 0x31f45887,
1124 0x1031f404, 1147/* 0x0319: find_loop */
1148 0x008a9801,
1149 0xf406aeb8,
1150 0x80b6100b,
1151 0x6886b158,
1152 0xf01bf402,
1153/* 0x032f: find_done */
1154 0xb90132f4,
1155 0x80fc028e,
1156/* 0x0336: send */
1157 0x21f500f8,
1158 0x01f40311,
1159/* 0x033f: recv */
1160 0xf900f897,
1161 0x9880f990,
1162 0xe99805e8,
1163 0x0132f404,
1164 0xf40689b8,
1165 0x89c43d0b,
1166 0x0180b603,
1167 0x800784f0,
1168 0xea9805e8,
1169 0xfef0f902,
1170 0xf0f9018f,
1171 0x9402efb9,
1172 0xe9bb0499,
1173 0x18e0b600,
1174 0x9803eb98,
1175 0xed9802ec,
1176 0x00ee9801,
1177 0xf0fca5f9,
1178 0xf400f8fe,
1179 0xf0fc0131,
1180/* 0x038c: recv_done */
1125 0x90fc80fc, 1181 0x90fc80fc,
1126/* 0x02d2: send_proc */ 1182/* 0x0392: init */
1127 0x80f900f8, 1183 0x17f100f8,
1128 0xe89890f9, 1184 0x14b60108,
1129 0x04e99805, 1185 0x0011cf06,
1130 0xb80486f0, 1186 0x010911e7,
1131 0x0bf40689, 1187 0xfe0814b6,
1132 0x0398c42a, 1188 0x17f10014,
1133 0xb6048894, 1189 0x13f000e0,
1134 0x8ebb1880, 1190 0x1c07f000,
1135 0x00fa9800, 1191 0xd00604b6,
1136 0x80008a80, 1192 0x04bd0001,
1137 0x8c80018d, 1193 0xf0ff17f0,
1138 0x038b8002, 1194 0x04b61407,
1139 0xf00190b6, 1195 0x0001d006,
1140 0xe9800794, 1196 0x17f004bd,
1141 0x0231f404, 1197 0x0015f102,
1142/* 0x030c: send_done */ 1198 0x1007f008,
1143 0x80fc90fc,
1144/* 0x0312: find */
1145 0x80f900f8,
1146 0xf45887f0,
1147/* 0x031a: find_loop */
1148 0x8a980131,
1149 0x06aeb800,
1150 0xb6100bf4,
1151 0x86b15880,
1152 0x1bf40268,
1153 0x0132f4f0,
1154/* 0x0330: find_done */
1155 0xfc028eb9,
1156/* 0x0337: send */
1157 0xf500f880,
1158 0xf4031221,
1159 0x00f89701,
1160/* 0x0340: recv */
1161 0x80f990f9,
1162 0x9805e898,
1163 0x32f404e9,
1164 0x0689b801,
1165 0xc43d0bf4,
1166 0x80b60389,
1167 0x0784f001,
1168 0x9805e880,
1169 0xf0f902ea,
1170 0xf9018ffe,
1171 0x02efb9f0,
1172 0xbb049994,
1173 0xe0b600e9,
1174 0x03eb9818,
1175 0x9802ec98,
1176 0xee9801ed,
1177 0xfca5f900,
1178 0x00f8fef0,
1179 0xfc0131f4,
1180/* 0x038d: recv_done */
1181 0xfc80fcf0,
1182/* 0x0393: init */
1183 0xf100f890,
1184 0xb6010817,
1185 0x11cf0614,
1186 0x0911e700,
1187 0x0814b601,
1188 0xf10014fe,
1189 0xf000e017,
1190 0x07f00013,
1191 0x0604b61c,
1192 0xbd0001d0,
1193 0xff17f004,
1194 0xb61407f0,
1195 0x01d00604,
1196 0xf004bd00,
1197 0x15f10217,
1198 0x07f00800,
1199 0x0604b610,
1200 0xbd0001d0,
1201 0x1a17f104,
1202 0x0013f001,
1203 0xf40010fe,
1204 0x17f01031,
1205 0x3807f001,
1206 0xd00604b6, 1199 0xd00604b6,
1207 0x04bd0001, 1200 0x04bd0001,
1208/* 0x03f7: init_proc */ 1201 0x011917f1,
1209 0x9858f7f0, 1202 0xf10013f0,
1210 0x16b001f1, 1203 0xfeffff14,
1211 0xfa0bf400, 1204 0x31f40010,
1212 0xf0b615f9, 1205 0x0117f010,
1213 0xf20ef458, 1206 0xb63807f0,
1214/* 0x0408: mulu32_32_64 */ 1207 0x01d00604,
1215 0x20f910f9, 1208 0xf004bd00,
1216 0x40f930f9, 1209/* 0x03fa: init_proc */
1217 0x9510e195, 1210 0xf19858f7,
1218 0xc4bd10d2, 1211 0x0016b001,
1219 0xedffb4bd, 1212 0xf9fa0bf4,
1220 0x301dffc0, 1213 0x58f0b615,
1221 0xf10234b9, 1214/* 0x040b: mulu32_32_64 */
1222 0xb6ffff34, 1215 0xf9f20ef4,
1223 0x45b61034, 1216 0xf920f910,
1224 0x00c3bb10, 1217 0x9540f930,
1225 0xff01b4bb, 1218 0xd29510e1,
1226 0x34b930e2, 1219 0xbdc4bd10,
1227 0xff34f102, 1220 0xc0edffb4,
1228 0x1034b6ff, 1221 0xb9301dff,
1229 0xbb1045b6, 1222 0x34f10234,
1230 0xb4bb00c3, 1223 0x34b6ffff,
1231 0x3012ff01, 1224 0x1045b610,
1232 0xfc00b3bb, 1225 0xbb00c3bb,
1233 0xfc30fc40, 1226 0xe2ff01b4,
1234 0xf810fc20, 1227 0x0234b930,
1235/* 0x0459: host_send */ 1228 0xffff34f1,
1236 0xb017f100, 1229 0xb61034b6,
1230 0xc3bb1045,
1231 0x01b4bb00,
1232 0xbb3012ff,
1233 0x40fc00b3,
1234 0x20fc30fc,
1235 0x00f810fc,
1236/* 0x045c: host_send */
1237 0x04b017f1,
1238 0xcf0614b6,
1239 0x27f10011,
1240 0x24b604a0,
1241 0x0022cf06,
1242 0xf40612b8,
1243 0x1ec4320b,
1244 0x04ee9407,
1245 0x0270e0b7,
1246 0x9803eb98,
1247 0xed9802ec,
1248 0x00ee9801,
1249 0x033621f5,
1250 0xc40110b6,
1251 0x07f10f1e,
1252 0x04b604b0,
1253 0x000ed006,
1254 0x0ef404bd,
1255/* 0x04a5: host_send_done */
1256/* 0x04a7: host_recv */
1257 0xf100f8ba,
1258 0xf14e4917,
1259 0xb8525413,
1260 0x0bf406e1,
1261/* 0x04b5: host_recv_wait */
1262 0xcc17f1aa,
1237 0x0614b604, 1263 0x0614b604,
1238 0xf10011cf, 1264 0xf10011cf,
1239 0xb604a027, 1265 0xb604c827,
1240 0x22cf0624, 1266 0x22cf0624,
1241 0x0612b800, 1267 0x0816f000,
1242 0xc4320bf4, 1268 0xf40612b8,
1243 0xee94071e, 1269 0x23c4e60b,
1244 0x70e0b704, 1270 0x0434b607,
1245 0x03eb9802, 1271 0x02f030b7,
1246 0x9802ec98, 1272 0x80033b80,
1247 0xee9801ed, 1273 0x3d80023c,
1248 0x3721f500, 1274 0x003e8001,
1249 0x0110b603, 1275 0xf00120b6,
1250 0xf10f1ec4, 1276 0x07f10f24,
1251 0xb604b007, 1277 0x04b604c8,
1252 0x0ed00604, 1278 0x0002d006,
1253 0xf404bd00, 1279 0x27f004bd,
1254/* 0x04a2: host_send_done */ 1280 0x0007f040,
1255 0x00f8ba0e, 1281 0xd00604b6,
1256/* 0x04a4: host_recv */ 1282 0x04bd0002,
1257 0x4e4917f1, 1283/* 0x050a: host_init */
1258 0x525413f1, 1284 0x17f100f8,
1259 0xf406e1b8,
1260/* 0x04b2: host_recv_wait */
1261 0x17f1aa0b,
1262 0x14b604cc,
1263 0x0011cf06,
1264 0x04c827f1,
1265 0xcf0624b6,
1266 0x16f00022,
1267 0x0612b808,
1268 0xc4e60bf4,
1269 0x34b60723,
1270 0xf030b704,
1271 0x033b8002,
1272 0x80023c80,
1273 0x3e80013d,
1274 0x0120b600,
1275 0xf10f24f0,
1276 0xb604c807,
1277 0x02d00604,
1278 0xf004bd00,
1279 0x07f04027,
1280 0x0604b600,
1281 0xbd0002d0,
1282/* 0x0507: host_init */
1283 0xf100f804,
1284 0xb6008017,
1285 0x15f11014,
1286 0x07f10270,
1287 0x04b604d0,
1288 0x0001d006,
1289 0x17f104bd,
1290 0x14b60080, 1285 0x14b60080,
1291 0xf015f110, 1286 0x7015f110,
1292 0xdc07f102, 1287 0xd007f102,
1293 0x0604b604, 1288 0x0604b604,
1294 0xbd0001d0, 1289 0xbd0001d0,
1295 0x0117f004, 1290 0x8017f104,
1296 0x04c407f1, 1291 0x1014b600,
1292 0x02f015f1,
1293 0x04dc07f1,
1297 0xd00604b6, 1294 0xd00604b6,
1298 0x04bd0001, 1295 0x04bd0001,
1299/* 0x0546: memx_func_enter */ 1296 0xf10117f0,
1300 0x67f100f8, 1297 0xb604c407,
1301 0x77f11620, 1298 0x01d00604,
1302 0x73f1f55d, 1299 0xf804bd00,
1303 0x6eb9ffff, 1300/* 0x0549: memx_func_enter */
1304 0x0421f402, 1301 0x2067f100,
1305 0xfd02d8b9, 1302 0x5d77f116,
1306 0x60f90487, 1303 0xff73f1f5,
1307 0xd0fc80f9,
1308 0x21f4e0fc,
1309 0xfe77f13f,
1310 0xff73f1ff,
1311 0x026eb9ff, 1304 0x026eb9ff,
1312 0xb90421f4, 1305 0xb90421f4,
1313 0x87fd02d8, 1306 0x87fd02d8,
1314 0xf960f904, 1307 0xf960f904,
1315 0xfcd0fc80, 1308 0xfcd0fc80,
1316 0x3f21f4e0, 1309 0x4021f4e0,
1317 0x26f067f1, 1310 0xfffe77f1,
1311 0xffff73f1,
1318 0xf4026eb9, 1312 0xf4026eb9,
1319 0xd8b90421, 1313 0xd8b90421,
1320 0x0487fd02, 1314 0x0487fd02,
1321 0x80f960f9, 1315 0x80f960f9,
1322 0xe0fcd0fc, 1316 0xe0fcd0fc,
1323 0xf03f21f4, 1317 0xf14021f4,
1318 0xb926f067,
1319 0x21f4026e,
1320 0x02d8b904,
1321 0xf90487fd,
1322 0xfc80f960,
1323 0xf4e0fcd0,
1324 0x67f04021,
1325 0xe007f104,
1326 0x0604b607,
1327 0xbd0006d0,
1328/* 0x05b5: memx_func_enter_wait */
1329 0xc067f104,
1330 0x0664b607,
1331 0xf00066cf,
1332 0x0bf40464,
1333 0x2c67f0f3,
1334 0xcf0664b6,
1335 0x06800066,
1336/* 0x05d3: memx_func_leave */
1337 0xf000f8f1,
1338 0x64b62c67,
1339 0x0066cf06,
1340 0xf0f20680,
1324 0x07f10467, 1341 0x07f10467,
1325 0x04b607e0, 1342 0x04b607e4,
1326 0x0006d006, 1343 0x0006d006,
1327/* 0x05b2: memx_func_enter_wait */ 1344/* 0x05ee: memx_func_leave_wait */
1328 0x67f104bd, 1345 0x67f104bd,
1329 0x64b607c0, 1346 0x64b607c0,
1330 0x0066cf06, 1347 0x0066cf06,
1331 0xf40464f0, 1348 0xf40464f0,
1332 0x67f0f30b, 1349 0x67f1f31b,
1333 0x0664b62c, 1350 0x77f126f0,
1334 0x800066cf, 1351 0x73f00001,
1335 0x00f8f106, 1352 0x026eb900,
1336/* 0x05d0: memx_func_leave */ 1353 0xb90421f4,
1337 0xb62c67f0, 1354 0x87fd02d8,
1338 0x66cf0664, 1355 0xf960f905,
1339 0xf2068000, 1356 0xfcd0fc80,
1340 0xf10467f0, 1357 0x4021f4e0,
1341 0xb607e407, 1358 0x162067f1,
1342 0x06d00604, 1359 0xf4026eb9,
1343/* 0x05eb: memx_func_leave_wait */ 1360 0xd8b90421,
1344 0xf104bd00, 1361 0x0587fd02,
1345 0xb607c067, 1362 0x80f960f9,
1346 0x66cf0664, 1363 0xe0fcd0fc,
1347 0x0464f000, 1364 0xf14021f4,
1348 0xf1f31bf4, 1365 0xf00aa277,
1349 0xf126f067,
1350 0xf0000177,
1351 0x6eb90073, 1366 0x6eb90073,
1352 0x0421f402, 1367 0x0421f402,
1353 0xfd02d8b9, 1368 0xfd02d8b9,
1354 0x60f90587, 1369 0x60f90587,
1355 0xd0fc80f9, 1370 0xd0fc80f9,
1356 0x21f4e0fc, 1371 0x21f4e0fc,
1357 0x2067f13f, 1372/* 0x065b: memx_func_wait_vblank */
1358 0x026eb916, 1373 0x9800f840,
1359 0xb90421f4, 1374 0x66b00016,
1360 0x87fd02d8, 1375 0x130bf400,
1361 0xf960f905, 1376 0xf40166b0,
1362 0xfcd0fc80, 1377 0x0ef4060b,
1363 0x3f21f4e0, 1378/* 0x066d: memx_func_wait_vblank_head1 */
1364 0x0aa277f1, 1379 0x2077f12e,
1365 0xb90073f0, 1380 0x070ef400,
1366 0x21f4026e, 1381/* 0x0674: memx_func_wait_vblank_head0 */
1367 0x02d8b904, 1382 0x000877f1,
1368 0xf90587fd, 1383/* 0x0678: memx_func_wait_vblank_0 */
1369 0xfc80f960, 1384 0x07c467f1,
1370 0xf4e0fcd0, 1385 0xcf0664b6,
1371 0x00f83f21, 1386 0x67fd0066,
1372/* 0x0658: memx_func_wait_vblank */ 1387 0xf31bf404,
1373 0xb0001698, 1388/* 0x0688: memx_func_wait_vblank_1 */
1374 0x0bf40066, 1389 0x07c467f1,
1375 0x0166b013, 1390 0xcf0664b6,
1376 0xf4060bf4, 1391 0x67fd0066,
1377/* 0x066a: memx_func_wait_vblank_head1 */ 1392 0xf30bf404,
1378 0x77f12e0e, 1393/* 0x0698: memx_func_wait_vblank_fini */
1379 0x0ef40020, 1394 0xf80410b6,
1380/* 0x0671: memx_func_wait_vblank_head0 */ 1395/* 0x069d: memx_func_wr32 */
1381 0x0877f107, 1396 0x00169800,
1382/* 0x0675: memx_func_wait_vblank_0 */ 1397 0xb6011598,
1383 0xc467f100, 1398 0x60f90810,
1384 0x0664b607, 1399 0xd0fc50f9,
1385 0xfd0066cf, 1400 0x21f4e0fc,
1386 0x1bf40467, 1401 0x0242b640,
1387/* 0x0685: memx_func_wait_vblank_1 */ 1402 0xf8e91bf4,
1388 0xc467f1f3, 1403/* 0x06b9: memx_func_wait */
1389 0x0664b607, 1404 0x2c87f000,
1390 0xfd0066cf, 1405 0xcf0684b6,
1391 0x0bf40467, 1406 0x1e980088,
1392/* 0x0695: memx_func_wait_vblank_fini */ 1407 0x011d9800,
1393 0x0410b6f3, 1408 0x98021c98,
1394/* 0x069a: memx_func_wr32 */ 1409 0x10b6031b,
1395 0x169800f8, 1410 0xa321f410,
1396 0x01159800, 1411/* 0x06d6: memx_func_delay */
1397 0xf90810b6, 1412 0x1e9800f8,
1398 0xfc50f960,
1399 0xf4e0fcd0,
1400 0x42b63f21,
1401 0xe91bf402,
1402/* 0x06b6: memx_func_wait */
1403 0x87f000f8,
1404 0x0684b62c,
1405 0x980088cf,
1406 0x1d98001e,
1407 0x021c9801,
1408 0xb6031b98,
1409 0x21f41010,
1410/* 0x06d3: memx_func_delay */
1411 0x9800f8a4,
1412 0x10b6001e,
1413 0x7f21f404,
1414/* 0x06de: memx_func_train */
1415 0x00f800f8,
1416/* 0x06e0: memx_exec */
1417 0xd0f9e0f9,
1418 0xb902c1b9,
1419/* 0x06ea: memx_exec_next */
1420 0x139802b2,
1421 0x0410b600, 1413 0x0410b600,
1422 0x01f034e7, 1414 0xf87e21f4,
1423 0x01e033e7, 1415/* 0x06e1: memx_func_train */
1424 0xf00132b6, 1416/* 0x06e3: memx_exec */
1425 0x35980c30, 1417 0xf900f800,
1426 0xb855f9de, 1418 0xb9d0f9e0,
1427 0x1ef40612, 1419 0xb2b902c1,
1428 0xf10b98e4, 1420/* 0x06ed: memx_exec_next */
1429 0xbbf20c98, 1421 0x00139802,
1430 0xb7f102cb, 1422 0xe70410b6,
1431 0xb4b607c4, 1423 0xe701f034,
1432 0x00bbcf06, 1424 0xb601e033,
1433 0xe0fcd0fc, 1425 0x30f00132,
1434 0x033721f5, 1426 0xde35980c,
1435/* 0x0726: memx_info */ 1427 0x12b855f9,
1436 0xc67000f8, 1428 0xe41ef406,
1437 0x0e0bf401, 1429 0x98f10b98,
1438/* 0x072c: memx_info_data */ 1430 0xcbbbf20c,
1439 0x03ccc7f1, 1431 0xc4b7f102,
1440 0x0800b7f1, 1432 0x06b4b607,
1441/* 0x0737: memx_info_train */ 1433 0xfc00bbcf,
1442 0xf10b0ef4, 1434 0xf5e0fcd0,
1443 0xf10bccc7, 1435 0xf8033621,
1444/* 0x073f: memx_info_send */ 1436/* 0x0729: memx_info */
1445 0xf50100b7, 1437 0x01c67000,
1446 0xf8033721, 1438/* 0x072f: memx_info_data */
1447/* 0x0745: memx_recv */ 1439 0xf10e0bf4,
1448 0x01d6b000, 1440 0xf103ccc7,
1449 0xb0980bf4, 1441 0xf40800b7,
1450 0x0bf400d6, 1442/* 0x073a: memx_info_train */
1451/* 0x0753: memx_init */ 1443 0xc7f10b0e,
1452 0xf800f8d8, 1444 0xb7f10bcc,
1453/* 0x0755: perf_recv */ 1445/* 0x0742: memx_info_send */
1454/* 0x0757: perf_init */ 1446 0x21f50100,
1455 0xf800f800, 1447 0x00f80336,
1456/* 0x0759: i2c_drive_scl */ 1448/* 0x0748: memx_recv */
1457 0x0036b000, 1449 0xf401d6b0,
1458 0xf1110bf4, 1450 0xd6b0980b,
1459 0xb607e007, 1451 0xd80bf400,
1460 0x01d00604, 1452/* 0x0756: memx_init */
1461 0xf804bd00, 1453 0x00f800f8,
1462/* 0x076d: i2c_drive_scl_lo */ 1454/* 0x0758: perf_recv */
1463 0xe407f100, 1455/* 0x075a: perf_init */
1464 0x0604b607, 1456 0x00f800f8,
1465 0xbd0001d0, 1457/* 0x075c: i2c_drive_scl */
1466/* 0x077b: i2c_drive_sda */ 1458 0xf40036b0,
1467 0xb000f804, 1459 0x07f1110b,
1468 0x0bf40036, 1460 0x04b607e0,
1469 0xe007f111, 1461 0x0001d006,
1470 0x0604b607, 1462 0x00f804bd,
1471 0xbd0002d0, 1463/* 0x0770: i2c_drive_scl_lo */
1472/* 0x078f: i2c_drive_sda_lo */ 1464 0x07e407f1,
1473 0xf100f804, 1465 0xd00604b6,
1474 0xb607e407, 1466 0x04bd0001,
1475 0x02d00604, 1467/* 0x077e: i2c_drive_sda */
1476 0xf804bd00, 1468 0x36b000f8,
1477/* 0x079d: i2c_sense_scl */ 1469 0x110bf400,
1478 0x0132f400, 1470 0x07e007f1,
1479 0x07c437f1, 1471 0xd00604b6,
1480 0xcf0634b6, 1472 0x04bd0002,
1481 0x31fd0033, 1473/* 0x0792: i2c_drive_sda_lo */
1482 0x060bf404, 1474 0x07f100f8,
1483/* 0x07b3: i2c_sense_scl_done */ 1475 0x04b607e4,
1484 0xf80131f4, 1476 0x0002d006,
1485/* 0x07b5: i2c_sense_sda */ 1477 0x00f804bd,
1486 0x0132f400, 1478/* 0x07a0: i2c_sense_scl */
1487 0x07c437f1, 1479 0xf10132f4,
1488 0xcf0634b6, 1480 0xb607c437,
1489 0x32fd0033, 1481 0x33cf0634,
1490 0x060bf404, 1482 0x0431fd00,
1491/* 0x07cb: i2c_sense_sda_done */ 1483 0xf4060bf4,
1492 0xf80131f4, 1484/* 0x07b6: i2c_sense_scl_done */
1493/* 0x07cd: i2c_raise_scl */ 1485 0x00f80131,
1494 0xf140f900, 1486/* 0x07b8: i2c_sense_sda */
1495 0xf0089847, 1487 0xf10132f4,
1496 0x21f50137, 1488 0xb607c437,
1497/* 0x07da: i2c_raise_scl_wait */ 1489 0x33cf0634,
1498 0xe7f10759, 1490 0x0432fd00,
1499 0x21f403e8, 1491 0xf4060bf4,
1500 0x9d21f57f, 1492/* 0x07ce: i2c_sense_sda_done */
1501 0x0901f407, 1493 0x00f80131,
1502 0xf40142b6, 1494/* 0x07d0: i2c_raise_scl */
1503/* 0x07ee: i2c_raise_scl_done */ 1495 0x47f140f9,
1504 0x40fcef1b, 1496 0x37f00898,
1505/* 0x07f2: i2c_start */ 1497 0x5c21f501,
1506 0x21f500f8, 1498/* 0x07dd: i2c_raise_scl_wait */
1507 0x11f4079d,
1508 0xb521f50d,
1509 0x0611f407,
1510/* 0x0803: i2c_start_rep */
1511 0xf0300ef4,
1512 0x21f50037,
1513 0x37f00759,
1514 0x7b21f501,
1515 0x0076bb07,
1516 0xf90465b6,
1517 0x04659450,
1518 0xbd0256bb,
1519 0x0475fd50,
1520 0x21f550fc,
1521 0x64b607cd,
1522 0x1f11f404,
1523/* 0x0830: i2c_start_send */
1524 0xf50037f0,
1525 0xf1077b21,
1526 0xf41388e7,
1527 0x37f07f21,
1528 0x5921f500,
1529 0x88e7f107,
1530 0x7f21f413,
1531/* 0x084c: i2c_start_out */
1532/* 0x084e: i2c_stop */
1533 0x37f000f8,
1534 0x5921f500,
1535 0x0037f007,
1536 0x077b21f5,
1537 0x03e8e7f1,
1538 0xf07f21f4,
1539 0x21f50137,
1540 0xe7f10759,
1541 0x21f41388,
1542 0x0137f07f,
1543 0x077b21f5,
1544 0x1388e7f1,
1545 0xf87f21f4,
1546/* 0x0881: i2c_bitw */
1547 0x7b21f500,
1548 0xe8e7f107,
1549 0x7f21f403,
1550 0xb60076bb,
1551 0x50f90465,
1552 0xbb046594,
1553 0x50bd0256,
1554 0xfc0475fd,
1555 0xcd21f550,
1556 0x0464b607,
1557 0xf11811f4,
1558 0xf41388e7,
1559 0x37f07f21,
1560 0x5921f500,
1561 0x88e7f107,
1562 0x7f21f413,
1563/* 0x08c0: i2c_bitw_out */
1564/* 0x08c2: i2c_bitr */
1565 0x37f000f8,
1566 0x7b21f501,
1567 0xe8e7f107, 1499 0xe8e7f107,
1568 0x7f21f403, 1500 0x7e21f403,
1501 0x07a021f5,
1502 0xb60901f4,
1503 0x1bf40142,
1504/* 0x07f1: i2c_raise_scl_done */
1505 0xf840fcef,
1506/* 0x07f5: i2c_start */
1507 0xa021f500,
1508 0x0d11f407,
1509 0x07b821f5,
1510 0xf40611f4,
1511/* 0x0806: i2c_start_rep */
1512 0x37f0300e,
1513 0x5c21f500,
1514 0x0137f007,
1515 0x077e21f5,
1569 0xb60076bb, 1516 0xb60076bb,
1570 0x50f90465, 1517 0x50f90465,
1571 0xbb046594, 1518 0xbb046594,
1572 0x50bd0256, 1519 0x50bd0256,
1573 0xfc0475fd, 1520 0xfc0475fd,
1574 0xcd21f550, 1521 0xd021f550,
1575 0x0464b607, 1522 0x0464b607,
1576 0xf51b11f4, 1523/* 0x0833: i2c_start_send */
1577 0xf007b521, 1524 0xf01f11f4,
1578 0x21f50037, 1525 0x21f50037,
1579 0xe7f10759, 1526 0xe7f1077e,
1580 0x21f41388, 1527 0x21f41388,
1581 0x013cf07f, 1528 0x0037f07e,
1582/* 0x0907: i2c_bitr_done */ 1529 0x075c21f5,
1583 0xf80131f4, 1530 0x1388e7f1,
1584/* 0x0909: i2c_get_byte */ 1531/* 0x084f: i2c_start_out */
1585 0x0057f000, 1532 0xf87e21f4,
1586/* 0x090f: i2c_get_byte_next */ 1533/* 0x0851: i2c_stop */
1587 0xb60847f0, 1534 0x0037f000,
1588 0x76bb0154, 1535 0x075c21f5,
1589 0x0465b600, 1536 0xf50037f0,
1590 0x659450f9, 1537 0xf1077e21,
1591 0x0256bb04, 1538 0xf403e8e7,
1592 0x75fd50bd, 1539 0x37f07e21,
1593 0xf550fc04, 1540 0x5c21f501,
1594 0xb608c221, 1541 0x88e7f107,
1595 0x11f40464, 1542 0x7e21f413,
1596 0x0553fd2b, 1543 0xf50137f0,
1597 0xf40142b6, 1544 0xf1077e21,
1598 0x37f0d81b, 1545 0xf41388e7,
1546 0x00f87e21,
1547/* 0x0884: i2c_bitw */
1548 0x077e21f5,
1549 0x03e8e7f1,
1550 0xbb7e21f4,
1551 0x65b60076,
1552 0x9450f904,
1553 0x56bb0465,
1554 0xfd50bd02,
1555 0x50fc0475,
1556 0x07d021f5,
1557 0xf40464b6,
1558 0xe7f11811,
1559 0x21f41388,
1560 0x0037f07e,
1561 0x075c21f5,
1562 0x1388e7f1,
1563/* 0x08c3: i2c_bitw_out */
1564 0xf87e21f4,
1565/* 0x08c5: i2c_bitr */
1566 0x0137f000,
1567 0x077e21f5,
1568 0x03e8e7f1,
1569 0xbb7e21f4,
1570 0x65b60076,
1571 0x9450f904,
1572 0x56bb0465,
1573 0xfd50bd02,
1574 0x50fc0475,
1575 0x07d021f5,
1576 0xf40464b6,
1577 0x21f51b11,
1578 0x37f007b8,
1579 0x5c21f500,
1580 0x88e7f107,
1581 0x7e21f413,
1582 0xf4013cf0,
1583/* 0x090a: i2c_bitr_done */
1584 0x00f80131,
1585/* 0x090c: i2c_get_byte */
1586 0xf00057f0,
1587/* 0x0912: i2c_get_byte_next */
1588 0x54b60847,
1599 0x0076bb01, 1589 0x0076bb01,
1600 0xf90465b6, 1590 0xf90465b6,
1601 0x04659450, 1591 0x04659450,
1602 0xbd0256bb, 1592 0xbd0256bb,
1603 0x0475fd50, 1593 0x0475fd50,
1604 0x21f550fc, 1594 0x21f550fc,
1605 0x64b60881, 1595 0x64b608c5,
1606/* 0x0959: i2c_get_byte_done */ 1596 0x2b11f404,
1607/* 0x095b: i2c_put_byte */ 1597 0xb60553fd,
1608 0xf000f804, 1598 0x1bf40142,
1609/* 0x095e: i2c_put_byte_next */ 1599 0x0137f0d8,
1610 0x42b60847, 1600 0xb60076bb,
1611 0x3854ff01, 1601 0x50f90465,
1602 0xbb046594,
1603 0x50bd0256,
1604 0xfc0475fd,
1605 0x8421f550,
1606 0x0464b608,
1607/* 0x095c: i2c_get_byte_done */
1608/* 0x095e: i2c_put_byte */
1609 0x47f000f8,
1610/* 0x0961: i2c_put_byte_next */
1611 0x0142b608,
1612 0xbb3854ff,
1613 0x65b60076,
1614 0x9450f904,
1615 0x56bb0465,
1616 0xfd50bd02,
1617 0x50fc0475,
1618 0x088421f5,
1619 0xf40464b6,
1620 0x46b03411,
1621 0xd81bf400,
1612 0xb60076bb, 1622 0xb60076bb,
1613 0x50f90465, 1623 0x50f90465,
1614 0xbb046594, 1624 0xbb046594,
1615 0x50bd0256, 1625 0x50bd0256,
1616 0xfc0475fd, 1626 0xfc0475fd,
1617 0x8121f550, 1627 0xc521f550,
1618 0x0464b608, 1628 0x0464b608,
1619 0xb03411f4, 1629 0xbb0f11f4,
1620 0x1bf40046, 1630 0x36b00076,
1621 0x0076bbd8, 1631 0x061bf401,
1632/* 0x09b7: i2c_put_byte_done */
1633 0xf80132f4,
1634/* 0x09b9: i2c_addr */
1635 0x0076bb00,
1622 0xf90465b6, 1636 0xf90465b6,
1623 0x04659450, 1637 0x04659450,
1624 0xbd0256bb, 1638 0xbd0256bb,
1625 0x0475fd50, 1639 0x0475fd50,
1626 0x21f550fc, 1640 0x21f550fc,
1627 0x64b608c2, 1641 0x64b607f5,
1628 0x0f11f404, 1642 0x2911f404,
1629 0xb00076bb, 1643 0x012ec3e7,
1630 0x1bf40136, 1644 0xfd0134b6,
1631 0x0132f406, 1645 0x76bb0553,
1632/* 0x09b4: i2c_put_byte_done */
1633/* 0x09b6: i2c_addr */
1634 0x76bb00f8,
1635 0x0465b600, 1646 0x0465b600,
1636 0x659450f9, 1647 0x659450f9,
1637 0x0256bb04, 1648 0x0256bb04,
1638 0x75fd50bd, 1649 0x75fd50bd,
1639 0xf550fc04, 1650 0xf550fc04,
1640 0xb607f221, 1651 0xb6095e21,
1641 0x11f40464, 1652/* 0x09fe: i2c_addr_done */
1642 0x2ec3e729, 1653 0x00f80464,
1643 0x0134b601, 1654/* 0x0a00: i2c_acquire_addr */
1644 0xbb0553fd, 1655 0xb6f8cec7,
1656 0xe0b702e4,
1657 0xee980d1c,
1658/* 0x0a0f: i2c_acquire */
1659 0xf500f800,
1660 0xf40a0021,
1661 0xd9f00421,
1662 0x4021f403,
1663/* 0x0a1e: i2c_release */
1664 0x21f500f8,
1665 0x21f40a00,
1666 0x03daf004,
1667 0xf84021f4,
1668/* 0x0a2d: i2c_recv */
1669 0x0132f400,
1670 0xb6f8c1c7,
1671 0x16b00214,
1672 0x3a1ff528,
1673 0xf413a001,
1674 0x0032980c,
1675 0x0ccc13a0,
1676 0xf4003198,
1677 0xd0f90231,
1678 0xd0f9e0f9,
1679 0x000067f1,
1680 0x100063f1,
1681 0xbb016792,
1645 0x65b60076, 1682 0x65b60076,
1646 0x9450f904, 1683 0x9450f904,
1647 0x56bb0465, 1684 0x56bb0465,
1648 0xfd50bd02, 1685 0xfd50bd02,
1649 0x50fc0475, 1686 0x50fc0475,
1650 0x095b21f5, 1687 0x0a0f21f5,
1651/* 0x09fb: i2c_addr_done */ 1688 0xfc0464b6,
1652 0xf80464b6, 1689 0x00d6b0d0,
1653/* 0x09fd: i2c_acquire_addr */ 1690 0x00b31bf5,
1654 0xf8cec700, 1691 0xbb0057f0,
1655 0xb702e4b6,
1656 0x980d1ce0,
1657 0x00f800ee,
1658/* 0x0a0c: i2c_acquire */
1659 0x09fd21f5,
1660 0xf00421f4,
1661 0x21f403d9,
1662/* 0x0a1b: i2c_release */
1663 0xf500f83f,
1664 0xf409fd21,
1665 0xdaf00421,
1666 0x3f21f403,
1667/* 0x0a2a: i2c_recv */
1668 0x32f400f8,
1669 0xf8c1c701,
1670 0xb00214b6,
1671 0x1ff52816,
1672 0x13a0013a,
1673 0x32980cf4,
1674 0xcc13a000,
1675 0x0031980c,
1676 0xf90231f4,
1677 0xf9e0f9d0,
1678 0x0067f1d0,
1679 0x0063f100,
1680 0x01679210,
1681 0xb60076bb,
1682 0x50f90465,
1683 0xbb046594,
1684 0x50bd0256,
1685 0xfc0475fd,
1686 0x0c21f550,
1687 0x0464b60a,
1688 0xd6b0d0fc,
1689 0xb31bf500,
1690 0x0057f000,
1691 0xb60076bb,
1692 0x50f90465,
1693 0xbb046594,
1694 0x50bd0256,
1695 0xfc0475fd,
1696 0xb621f550,
1697 0x0464b609,
1698 0x00d011f5,
1699 0xbbe0c5c7,
1700 0x65b60076, 1692 0x65b60076,
1701 0x9450f904, 1693 0x9450f904,
1702 0x56bb0465, 1694 0x56bb0465,
1703 0xfd50bd02, 1695 0xfd50bd02,
1704 0x50fc0475, 1696 0x50fc0475,
1705 0x095b21f5, 1697 0x09b921f5,
1706 0xf50464b6, 1698 0xf50464b6,
1707 0xf000ad11, 1699 0xc700d011,
1708 0x76bb0157, 1700 0x76bbe0c5,
1709 0x0465b600, 1701 0x0465b600,
1710 0x659450f9, 1702 0x659450f9,
1711 0x0256bb04, 1703 0x0256bb04,
1712 0x75fd50bd, 1704 0x75fd50bd,
1713 0xf550fc04, 1705 0xf550fc04,
1714 0xb609b621, 1706 0xb6095e21,
1715 0x11f50464, 1707 0x11f50464,
1716 0x76bb008a, 1708 0x57f000ad,
1717 0x0465b600, 1709 0x0076bb01,
1718 0x659450f9, 1710 0xf90465b6,
1719 0x0256bb04, 1711 0x04659450,
1720 0x75fd50bd, 1712 0xbd0256bb,
1721 0xf550fc04, 1713 0x0475fd50,
1722 0xb6090921, 1714 0x21f550fc,
1723 0x11f40464, 1715 0x64b609b9,
1724 0xe05bcb6a, 1716 0x8a11f504,
1725 0xb60076bb, 1717 0x0076bb00,
1726 0x50f90465, 1718 0xf90465b6,
1727 0xbb046594, 1719 0x04659450,
1728 0x50bd0256, 1720 0xbd0256bb,
1729 0xfc0475fd, 1721 0x0475fd50,
1730 0x4e21f550, 1722 0x21f550fc,
1731 0x0464b608, 1723 0x64b6090c,
1732 0xbd025bb9, 1724 0x6a11f404,
1733 0x430ef474, 1725 0xbbe05bcb,
1734/* 0x0b30: i2c_recv_not_rd08 */ 1726 0x65b60076,
1735 0xf401d6b0, 1727 0x9450f904,
1736 0x57f03d1b, 1728 0x56bb0465,
1737 0xb621f500, 1729 0xfd50bd02,
1738 0x3311f409, 1730 0x50fc0475,
1739 0xf5e0c5c7, 1731 0x085121f5,
1740 0xf4095b21, 1732 0xb90464b6,
1741 0x57f02911, 1733 0x74bd025b,
1742 0xb621f500, 1734/* 0x0b33: i2c_recv_not_rd08 */
1743 0x1f11f409, 1735 0xb0430ef4,
1744 0xf5e0b5c7, 1736 0x1bf401d6,
1745 0xf4095b21, 1737 0x0057f03d,
1746 0x21f51511, 1738 0x09b921f5,
1747 0x74bd084e, 1739 0xc73311f4,
1748 0xf408c5c7, 1740 0x21f5e0c5,
1749 0x32f4091b, 1741 0x11f4095e,
1750 0x030ef402, 1742 0x0057f029,
1751/* 0x0b70: i2c_recv_not_wr08 */ 1743 0x09b921f5,
1752/* 0x0b70: i2c_recv_done */ 1744 0xc71f11f4,
1753 0xf5f8cec7, 1745 0x21f5e0b5,
1754 0xfc0a1b21, 1746 0x11f4095e,
1755 0xf4d0fce0, 1747 0x5121f515,
1756 0x7cb90a12, 1748 0xc774bd08,
1757 0x3721f502, 1749 0x1bf408c5,
1758/* 0x0b85: i2c_recv_exit */ 1750 0x0232f409,
1759/* 0x0b87: i2c_init */ 1751/* 0x0b73: i2c_recv_not_wr08 */
1760 0xf800f803, 1752/* 0x0b73: i2c_recv_done */
1761/* 0x0b89: test_recv */ 1753 0xc7030ef4,
1762 0xd817f100, 1754 0x21f5f8ce,
1763 0x0614b605, 1755 0xe0fc0a1e,
1764 0xb60011cf, 1756 0x12f4d0fc,
1765 0x07f10110, 1757 0x027cb90a,
1766 0x04b605d8, 1758 0x033621f5,
1767 0x0001d006, 1759/* 0x0b88: i2c_recv_exit */
1768 0xe7f104bd, 1760/* 0x0b8a: i2c_init */
1769 0xe3f1d900,
1770 0x21f5134f,
1771 0x00f80257,
1772/* 0x0bb0: test_init */
1773 0x0800e7f1,
1774 0x025721f5,
1775/* 0x0bba: idle_recv */
1776 0x00f800f8, 1761 0x00f800f8,
1777/* 0x0bbc: idle */ 1762/* 0x0b8c: test_recv */
1778 0xf10031f4, 1763 0x05d817f1,
1779 0xb605d417, 1764 0xcf0614b6,
1780 0x11cf0614, 1765 0x10b60011,
1781 0x0110b600, 1766 0xd807f101,
1782 0x05d407f1, 1767 0x0604b605,
1783 0xd00604b6, 1768 0xbd0001d0,
1784 0x04bd0001, 1769 0x00e7f104,
1785/* 0x0bd8: idle_loop */ 1770 0x4fe3f1d9,
1786 0xf45817f0, 1771 0x5621f513,
1787/* 0x0bde: idle_proc */ 1772/* 0x0bb3: test_init */
1788/* 0x0bde: idle_proc_exec */ 1773 0xf100f802,
1789 0x10f90232, 1774 0xf50800e7,
1790 0xf5021eb9, 1775 0xf8025621,
1791 0xfc034021, 1776/* 0x0bbd: idle_recv */
1792 0x0911f410, 1777/* 0x0bbf: idle */
1793 0xf40231f4, 1778 0xf400f800,
1794/* 0x0bf2: idle_proc_next */ 1779 0x17f10031,
1795 0x10b6ef0e, 1780 0x14b605d4,
1796 0x061fb858, 1781 0x0011cf06,
1797 0xf4e61bf4, 1782 0xf10110b6,
1798 0x28f4dd02, 1783 0xb605d407,
1799 0xbb0ef400, 1784 0x01d00604,
1800 0x00000000, 1785/* 0x0bdb: idle_loop */
1786 0xf004bd00,
1787 0x32f45817,
1788/* 0x0be1: idle_proc */
1789/* 0x0be1: idle_proc_exec */
1790 0xb910f902,
1791 0x21f5021e,
1792 0x10fc033f,
1793 0xf40911f4,
1794 0x0ef40231,
1795/* 0x0bf5: idle_proc_next */
1796 0x5810b6ef,
1797 0xf4061fb8,
1798 0x02f4e61b,
1799 0x0028f4dd,
1800 0x00bb0ef4,
1801 0x00000000, 1801 0x00000000,
1802 0x00000000, 1802 0x00000000,
1803 0x00000000, 1803 0x00000000,
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gf119.fuc4.h b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gf119.fuc4.h
index 7bf6b39ed205..2d5bdc539697 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gf119.fuc4.h
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gf119.fuc4.h
@@ -24,8 +24,8 @@ uint32_t gf119_pmu_data[] = {
24 0x00000000, 24 0x00000000,
25/* 0x0058: proc_list_head */ 25/* 0x0058: proc_list_head */
26 0x54534f48, 26 0x54534f48,
27 0x00000492, 27 0x00000495,
28 0x0000043b, 28 0x0000043e,
29 0x00000000, 29 0x00000000,
30 0x00000000, 30 0x00000000,
31 0x00000000, 31 0x00000000,
@@ -46,8 +46,8 @@ uint32_t gf119_pmu_data[] = {
46 0x00000000, 46 0x00000000,
47 0x00000000, 47 0x00000000,
48 0x584d454d, 48 0x584d454d,
49 0x00000680, 49 0x00000683,
50 0x00000672, 50 0x00000675,
51 0x00000000, 51 0x00000000,
52 0x00000000, 52 0x00000000,
53 0x00000000, 53 0x00000000,
@@ -68,8 +68,8 @@ uint32_t gf119_pmu_data[] = {
68 0x00000000, 68 0x00000000,
69 0x00000000, 69 0x00000000,
70 0x46524550, 70 0x46524550,
71 0x00000684, 71 0x00000687,
72 0x00000682, 72 0x00000685,
73 0x00000000, 73 0x00000000,
74 0x00000000, 74 0x00000000,
75 0x00000000, 75 0x00000000,
@@ -90,8 +90,8 @@ uint32_t gf119_pmu_data[] = {
90 0x00000000, 90 0x00000000,
91 0x00000000, 91 0x00000000,
92 0x5f433249, 92 0x5f433249,
93 0x00000a9f, 93 0x00000aa2,
94 0x00000942, 94 0x00000945,
95 0x00000000, 95 0x00000000,
96 0x00000000, 96 0x00000000,
97 0x00000000, 97 0x00000000,
@@ -112,8 +112,8 @@ uint32_t gf119_pmu_data[] = {
112 0x00000000, 112 0x00000000,
113 0x00000000, 113 0x00000000,
114 0x54534554, 114 0x54534554,
115 0x00000ac2, 115 0x00000ac5,
116 0x00000aa1, 116 0x00000aa4,
117 0x00000000, 117 0x00000000,
118 0x00000000, 118 0x00000000,
119 0x00000000, 119 0x00000000,
@@ -134,8 +134,8 @@ uint32_t gf119_pmu_data[] = {
134 0x00000000, 134 0x00000000,
135 0x00000000, 135 0x00000000,
136 0x454c4449, 136 0x454c4449,
137 0x00000ace, 137 0x00000ad1,
138 0x00000acc, 138 0x00000acf,
139 0x00000000, 139 0x00000000,
140 0x00000000, 140 0x00000000,
141 0x00000000, 141 0x00000000,
@@ -229,26 +229,26 @@ uint32_t gf119_pmu_data[] = {
229/* 0x0370: memx_func_head */ 229/* 0x0370: memx_func_head */
230 0x00000001, 230 0x00000001,
231 0x00000000, 231 0x00000000,
232 0x000004c8, 232 0x000004cb,
233/* 0x037c: memx_func_next */ 233/* 0x037c: memx_func_next */
234 0x00000002, 234 0x00000002,
235 0x00000000, 235 0x00000000,
236 0x00000549, 236 0x0000054c,
237 0x00000003, 237 0x00000003,
238 0x00000002, 238 0x00000002,
239 0x000005cd, 239 0x000005d0,
240 0x00040004, 240 0x00040004,
241 0x00000000, 241 0x00000000,
242 0x000005e9, 242 0x000005ec,
243 0x00010005, 243 0x00010005,
244 0x00000000, 244 0x00000000,
245 0x00000603, 245 0x00000606,
246 0x00010006, 246 0x00010006,
247 0x00000000, 247 0x00000000,
248 0x000005c8, 248 0x000005cb,
249 0x00000007, 249 0x00000007,
250 0x00000000, 250 0x00000000,
251 0x0000060e, 251 0x00000611,
252/* 0x03c4: memx_func_tail */ 252/* 0x03c4: memx_func_tail */
253/* 0x03c4: memx_ts_start */ 253/* 0x03c4: memx_ts_start */
254 0x00000000, 254 0x00000000,
@@ -916,821 +916,821 @@ uint32_t gf119_pmu_data[] = {
916}; 916};
917 917
918uint32_t gf119_pmu_code[] = { 918uint32_t gf119_pmu_code[] = {
919 0x03420ef5, 919 0x03410ef5,
920/* 0x0004: rd32 */ 920/* 0x0004: rd32 */
921 0x07a007f1, 921 0x07a007f1,
922 0xbd000ed0, 922 0xbd000ed0,
923 0x01d7f004, 923 0x01d7f104,
924 0xf101d3f0, 924 0x01d3f000,
925 0xd007ac07, 925 0x07ac07f1,
926 0x04bd000d,
927/* 0x001c: rd32_wait */
928 0x07acd7f1,
929 0xf100ddcf,
930 0xf47000d4,
931 0xd7f1f51b,
932 0xddcf07a4,
933/* 0x0033: wr32 */
934 0xf100f800,
935 0xd007a007,
936 0x04bd000e,
937 0x07a407f1,
938 0xbd000dd0, 926 0xbd000dd0,
939 0x02d7f004, 927/* 0x001d: rd32_wait */
940 0xf0f0d5f0, 928 0xacd7f104,
941 0x07f101d3, 929 0x00ddcf07,
942 0x0dd007ac, 930 0x7000d4f1,
943/* 0x0057: wr32_wait */ 931 0xf1f51bf4,
944 0xf104bd00, 932 0xcf07a4d7,
945 0xcf07acd7, 933 0x00f800dd,
946 0xd4f100dd, 934/* 0x0034: wr32 */
947 0x1bf47000, 935 0x07a007f1,
948/* 0x0067: nsec */ 936 0xbd000ed0,
949 0xf900f8f5, 937 0xa407f104,
950 0xf080f990, 938 0x000dd007,
951 0x88cf2c87, 939 0xd7f104bd,
952/* 0x0071: nsec_loop */ 940 0xd3f000f2,
953 0x2c97f000, 941 0xac07f101,
954 0xbb0099cf, 942 0x000dd007,
955 0x9eb80298, 943/* 0x0056: wr32_wait */
956 0xf41ef406, 944 0xd7f104bd,
957 0x90fc80fc, 945 0xddcf07ac,
958/* 0x0086: wait */ 946 0x00d4f100,
947 0xf51bf470,
948/* 0x0066: nsec */
959 0x90f900f8, 949 0x90f900f8,
960 0x87f080f9, 950 0x87f080f9,
961 0x0088cf2c, 951 0x0088cf2c,
962/* 0x0090: wait_loop */ 952/* 0x0070: nsec_loop */
963 0xf402eeb9, 953 0xcf2c97f0,
964 0xdab90421, 954 0x98bb0099,
965 0x04adfd02, 955 0x069eb802,
966 0xf406acb8, 956 0xfcf41ef4,
967 0x97f0120b, 957 0xf890fc80,
968 0x0099cf2c, 958/* 0x0085: wait */
969 0xb80298bb, 959 0xf990f900,
970 0x1ef4069b, 960 0x2c87f080,
971/* 0x00b1: wait_done */ 961/* 0x008f: wait_loop */
972 0xfc80fce2, 962 0xb90088cf,
973/* 0x00b7: intr_watchdog */ 963 0x21f402ee,
974 0x9800f890, 964 0x02dab904,
975 0x96b003e9, 965 0xb804adfd,
976 0x2a0bf400, 966 0x0bf406ac,
977 0xbb9a0a98, 967 0x2c97f012,
978 0x1cf4029a, 968 0xbb0099cf,
979 0x01d7f00f, 969 0x9bb80298,
980 0x028121f5, 970 0xe21ef406,
981 0x0ef494bd, 971/* 0x00b0: wait_done */
982/* 0x00d5: intr_watchdog_next_time */ 972 0x90fc80fc,
983 0x9b0a9815, 973/* 0x00b6: intr_watchdog */
984 0xf400a6b0, 974 0xe99800f8,
985 0x9ab8090b, 975 0x0096b003,
986 0x061cf406, 976 0x982a0bf4,
987/* 0x00e4: intr_watchdog_next_time_set */ 977 0x9abb9a0a,
988/* 0x00e7: intr_watchdog_next_proc */ 978 0x0f1cf402,
989 0x809b0980, 979 0xf501d7f0,
990 0xe0b603e9, 980 0xbd028021,
991 0x68e6b158, 981 0x150ef494,
992 0xc61bf402, 982/* 0x00d4: intr_watchdog_next_time */
993/* 0x00f6: intr */ 983 0xb09b0a98,
994 0x00f900f8, 984 0x0bf400a6,
995 0x80f904bd, 985 0x069ab809,
996 0xa0f990f9, 986/* 0x00e3: intr_watchdog_next_time_set */
997 0xc0f9b0f9, 987 0x80061cf4,
998 0xe0f9d0f9, 988/* 0x00e6: intr_watchdog_next_proc */
999 0xf7f0f0f9, 989 0xe9809b09,
1000 0x0188fe00, 990 0x58e0b603,
1001 0x87f180f9, 991 0x0268e6b1,
1002 0x88cf05d0, 992 0xf8c61bf4,
1003 0x0180b600, 993/* 0x00f5: intr */
1004 0x05d007f1, 994 0xbd00f900,
1005 0xbd0008d0, 995 0xf980f904,
1006 0x0887f004, 996 0xf9a0f990,
1007 0xc40088cf, 997 0xf9c0f9b0,
1008 0x0bf40289, 998 0xf9e0f9d0,
1009 0x9b008020, 999 0x00f7f0f0,
1010 0xf458e7f0, 1000 0xf90188fe,
1011 0x0998b721, 1001 0xd087f180,
1012 0x0096b09b, 1002 0x0088cf05,
1013 0xf00e0bf4, 1003 0xf10180b6,
1014 0x09d03407, 1004 0xd005d007,
1015 0x8004bd00, 1005 0x04bd0008,
1016/* 0x014e: intr_skip_watchdog */ 1006 0xcf0887f0,
1017 0x89e49a09, 1007 0x89c40088,
1018 0x0bf40800, 1008 0x200bf402,
1019 0x8897f13c, 1009 0xf09b0080,
1020 0x0099cf06, 1010 0x21f458e7,
1021 0xf4029ac4, 1011 0x9b0998b6,
1022 0xc7f1260b, 1012 0xf40096b0,
1023 0xcccf04c0, 1013 0x07f00e0b,
1024 0xf1c0f900, 1014 0x0009d034,
1025 0xf14f48e7, 1015 0x098004bd,
1026 0xf05453e3, 1016/* 0x014d: intr_skip_watchdog */
1027 0x21f500d7, 1017 0x0089e49a,
1028 0xc0fc02e6, 1018 0x3c0bf408,
1029 0x04c007f1, 1019 0x068897f1,
1030 0xbd000cd0, 1020 0xc40099cf,
1031/* 0x0185: intr_subintr_skip_fifo */ 1021 0x0bf4029a,
1032 0x8807f104, 1022 0xc0c7f126,
1033 0x0009d006, 1023 0x00cccf04,
1034/* 0x018e: intr_skip_subintr */ 1024 0xe7f1c0f9,
1035 0x97f104bd, 1025 0xe3f14f48,
1036 0x90bd00e0, 1026 0xd7f05453,
1037 0xf00489fd, 1027 0xe521f500,
1038 0x08d00407, 1028 0xf1c0fc02,
1039 0xfc04bd00, 1029 0xd004c007,
1040 0x0088fe80, 1030 0x04bd000c,
1041 0xe0fcf0fc, 1031/* 0x0184: intr_subintr_skip_fifo */
1042 0xc0fcd0fc, 1032 0x068807f1,
1043 0xa0fcb0fc, 1033 0xbd0009d0,
1044 0x80fc90fc, 1034/* 0x018d: intr_skip_subintr */
1045 0x32f400fc, 1035 0xe097f104,
1046/* 0x01bb: ticks_from_ns */ 1036 0xfd90bd00,
1047 0xf901f800, 1037 0x07f00489,
1038 0x0008d004,
1039 0x80fc04bd,
1040 0xfc0088fe,
1041 0xfce0fcf0,
1042 0xfcc0fcd0,
1043 0xfca0fcb0,
1044 0xfc80fc90,
1045 0x0032f400,
1046/* 0x01ba: ticks_from_ns */
1047 0xc0f901f8,
1048 0xd7f1b0f9,
1049 0xd3f00144,
1050 0xab21f500,
1051 0xe8ccec03,
1052 0x00b4b003,
1053 0xec120bf4,
1054 0xf103e8ee,
1055 0xf00144d7,
1056 0x21f500d3,
1057/* 0x01e2: ticks_from_ns_quit */
1058 0xceb903ab,
1059 0xfcb0fc02,
1060/* 0x01eb: ticks_from_us */
1061 0xf900f8c0,
1048 0xf1b0f9c0, 1062 0xf1b0f9c0,
1049 0xf00144d7, 1063 0xf00144d7,
1050 0x21f500d3, 1064 0x21f500d3,
1051 0xccec03a8, 1065 0xceb903ab,
1052 0xb4b003e8, 1066 0x00b4b002,
1053 0x120bf400, 1067 0xbd050bf4,
1054 0x03e8eeec, 1068/* 0x0205: ticks_from_us_quit */
1055 0x0144d7f1, 1069 0xfcb0fce4,
1056 0xf500d3f0, 1070/* 0x020b: ticks_to_us */
1057/* 0x01e3: ticks_from_ns_quit */ 1071 0xf100f8c0,
1058 0xb903a821, 1072 0xf00144d7,
1059 0xb0fc02ce, 1073 0xedff00d3,
1060 0x00f8c0fc, 1074/* 0x0217: timer */
1061/* 0x01ec: ticks_from_us */ 1075 0xf900f8ec,
1062 0xb0f9c0f9, 1076 0xf480f990,
1063 0x0144d7f1, 1077 0xf8981032,
1064 0xf500d3f0, 1078 0x0086b003,
1065 0xb903a821, 1079 0xbd531cf4,
1066 0xb4b002ce, 1080 0x3807f084,
1067 0x050bf400, 1081 0xbd0008d0,
1068/* 0x0206: ticks_from_us_quit */ 1082 0x3487f004,
1069 0xb0fce4bd, 1083 0x980088cf,
1070 0x00f8c0fc, 1084 0x98bb9a09,
1071/* 0x020c: ticks_to_us */ 1085 0x00e9bb02,
1072 0x0144d7f1, 1086 0xf003fe80,
1073 0xff00d3f0, 1087 0x88cf0887,
1074 0x00f8eced, 1088 0x0284f000,
1075/* 0x0218: timer */ 1089 0xf0201bf4,
1076 0x80f990f9, 1090 0x88cf3487,
1077 0x981032f4, 1091 0x06e0b800,
1078 0x86b003f8, 1092 0xb8090bf4,
1079 0x531cf400, 1093 0x1cf406e8,
1080 0x07f084bd, 1094/* 0x0261: timer_reset */
1081 0x0008d038, 1095 0x3407f00e,
1082 0x87f004bd, 1096 0xbd000ed0,
1083 0x0088cf34, 1097 0x9a0e8004,
1084 0xbb9a0998, 1098/* 0x026c: timer_enable */
1085 0xe9bb0298, 1099 0xf00187f0,
1086 0x03fe8000, 1100 0x08d03807,
1087 0xcf0887f0, 1101/* 0x0277: timer_done */
1088 0x84f00088, 1102 0xf404bd00,
1089 0x201bf402, 1103 0x80fc1031,
1090 0xcf3487f0, 1104 0x00f890fc,
1091 0xe0b80088, 1105/* 0x0280: send_proc */
1092 0x090bf406, 1106 0x90f980f9,
1093 0xf406e8b8, 1107 0x9805e898,
1094/* 0x0262: timer_reset */ 1108 0x86f004e9,
1095 0x07f00e1c, 1109 0x0689b804,
1096 0x000ed034, 1110 0xc42a0bf4,
1097 0x0e8004bd, 1111 0x88940398,
1098/* 0x026d: timer_enable */ 1112 0x1880b604,
1099 0x0187f09a, 1113 0x98008ebb,
1100 0xd03807f0, 1114 0x8a8000fa,
1101 0x04bd0008, 1115 0x018d8000,
1102/* 0x0278: timer_done */ 1116 0x80028c80,
1103 0xfc1031f4, 1117 0x90b6038b,
1118 0x0794f001,
1119 0xf404e980,
1120/* 0x02ba: send_done */
1121 0x90fc0231,
1122 0x00f880fc,
1123/* 0x02c0: find */
1124 0x87f080f9,
1125 0x0131f458,
1126/* 0x02c8: find_loop */
1127 0xb8008a98,
1128 0x0bf406ae,
1129 0x5880b610,
1130 0x026886b1,
1131 0xf4f01bf4,
1132/* 0x02de: find_done */
1133 0x8eb90132,
1134 0xf880fc02,
1135/* 0x02e5: send */
1136 0xc021f500,
1137 0x9701f402,
1138/* 0x02ee: recv */
1139 0x90f900f8,
1140 0xe89880f9,
1141 0x04e99805,
1142 0xb80132f4,
1143 0x0bf40689,
1144 0x0389c43d,
1145 0xf00180b6,
1146 0xe8800784,
1147 0x02ea9805,
1148 0x8ffef0f9,
1149 0xb9f0f901,
1150 0x999402ef,
1151 0x00e9bb04,
1152 0x9818e0b6,
1153 0xec9803eb,
1154 0x01ed9802,
1155 0xf900ee98,
1156 0xfef0fca5,
1157 0x31f400f8,
1158/* 0x033b: recv_done */
1159 0xfcf0fc01,
1104 0xf890fc80, 1160 0xf890fc80,
1105/* 0x0281: send_proc */ 1161/* 0x0341: init */
1106 0xf980f900, 1162 0x0817f100,
1107 0x05e89890, 1163 0x0011cf01,
1108 0xf004e998, 1164 0x010911e7,
1109 0x89b80486, 1165 0xfe0814b6,
1110 0x2a0bf406, 1166 0x17f10014,
1111 0x940398c4, 1167 0x13f000e0,
1112 0x80b60488, 1168 0x1c07f000,
1113 0x008ebb18,
1114 0x8000fa98,
1115 0x8d80008a,
1116 0x028c8001,
1117 0xb6038b80,
1118 0x94f00190,
1119 0x04e98007,
1120/* 0x02bb: send_done */
1121 0xfc0231f4,
1122 0xf880fc90,
1123/* 0x02c1: find */
1124 0xf080f900,
1125 0x31f45887,
1126/* 0x02c9: find_loop */
1127 0x008a9801,
1128 0xf406aeb8,
1129 0x80b6100b,
1130 0x6886b158,
1131 0xf01bf402,
1132/* 0x02df: find_done */
1133 0xb90132f4,
1134 0x80fc028e,
1135/* 0x02e6: send */
1136 0x21f500f8,
1137 0x01f402c1,
1138/* 0x02ef: recv */
1139 0xf900f897,
1140 0x9880f990,
1141 0xe99805e8,
1142 0x0132f404,
1143 0xf40689b8,
1144 0x89c43d0b,
1145 0x0180b603,
1146 0x800784f0,
1147 0xea9805e8,
1148 0xfef0f902,
1149 0xf0f9018f,
1150 0x9402efb9,
1151 0xe9bb0499,
1152 0x18e0b600,
1153 0x9803eb98,
1154 0xed9802ec,
1155 0x00ee9801,
1156 0xf0fca5f9,
1157 0xf400f8fe,
1158 0xf0fc0131,
1159/* 0x033c: recv_done */
1160 0x90fc80fc,
1161/* 0x0342: init */
1162 0x17f100f8,
1163 0x11cf0108,
1164 0x0911e700,
1165 0x0814b601,
1166 0xf10014fe,
1167 0xf000e017,
1168 0x07f00013,
1169 0x0001d01c,
1170 0x17f004bd,
1171 0x1407f0ff,
1172 0xbd0001d0, 1169 0xbd0001d0,
1173 0x0217f004, 1170 0xff17f004,
1174 0x080015f1, 1171 0xd01407f0,
1175 0xd01007f0,
1176 0x04bd0001,
1177 0x00f617f1,
1178 0xfe0013f0,
1179 0x31f40010,
1180 0x0117f010,
1181 0xd03807f0,
1182 0x04bd0001, 1172 0x04bd0001,
1183/* 0x0397: init_proc */ 1173 0xf10217f0,
1184 0x9858f7f0, 1174 0xf0080015,
1185 0x16b001f1, 1175 0x01d01007,
1186 0xfa0bf400, 1176 0xf104bd00,
1187 0xf0b615f9, 1177 0xf000f517,
1188 0xf20ef458, 1178 0x14f10013,
1189/* 0x03a8: mulu32_32_64 */ 1179 0x10feffff,
1190 0x20f910f9, 1180 0x1031f400,
1191 0x40f930f9, 1181 0xf00117f0,
1192 0x9510e195, 1182 0x01d03807,
1193 0xc4bd10d2, 1183 0xf004bd00,
1194 0xedffb4bd, 1184/* 0x039a: init_proc */
1195 0x301dffc0, 1185 0xf19858f7,
1196 0xf10234b9, 1186 0x0016b001,
1197 0xb6ffff34, 1187 0xf9fa0bf4,
1198 0x45b61034, 1188 0x58f0b615,
1199 0x00c3bb10, 1189/* 0x03ab: mulu32_32_64 */
1200 0xff01b4bb, 1190 0xf9f20ef4,
1201 0x34b930e2, 1191 0xf920f910,
1202 0xff34f102, 1192 0x9540f930,
1203 0x1034b6ff, 1193 0xd29510e1,
1204 0xbb1045b6, 1194 0xbdc4bd10,
1205 0xb4bb00c3, 1195 0xc0edffb4,
1206 0x3012ff01, 1196 0xb9301dff,
1207 0xfc00b3bb, 1197 0x34f10234,
1208 0xfc30fc40, 1198 0x34b6ffff,
1209 0xf810fc20, 1199 0x1045b610,
1210/* 0x03f9: host_send */ 1200 0xbb00c3bb,
1211 0xb017f100, 1201 0xe2ff01b4,
1212 0x0011cf04, 1202 0x0234b930,
1213 0x04a027f1, 1203 0xffff34f1,
1214 0xb80022cf, 1204 0xb61034b6,
1215 0x0bf40612, 1205 0xc3bb1045,
1216 0x071ec42f, 1206 0x01b4bb00,
1217 0xb704ee94, 1207 0xbb3012ff,
1218 0x980270e0, 1208 0x40fc00b3,
1219 0xec9803eb, 1209 0x20fc30fc,
1220 0x01ed9802, 1210 0x00f810fc,
1221 0xf500ee98, 1211/* 0x03fc: host_send */
1222 0xb602e621, 1212 0x04b017f1,
1223 0x1ec40110, 1213 0xf10011cf,
1224 0xb007f10f, 1214 0xcf04a027,
1225 0x000ed004, 1215 0x12b80022,
1226 0x0ef404bd, 1216 0x2f0bf406,
1227/* 0x0439: host_send_done */ 1217 0x94071ec4,
1228/* 0x043b: host_recv */ 1218 0xe0b704ee,
1229 0xf100f8c3, 1219 0xeb980270,
1230 0xf14e4917, 1220 0x02ec9803,
1231 0xb8525413, 1221 0x9801ed98,
1232 0x0bf406e1, 1222 0x21f500ee,
1233/* 0x0449: host_recv_wait */ 1223 0x10b602e5,
1234 0xcc17f1b3, 1224 0x0f1ec401,
1235 0x0011cf04, 1225 0x04b007f1,
1236 0x04c827f1, 1226 0xbd000ed0,
1237 0xf00022cf, 1227 0xc30ef404,
1238 0x12b80816, 1228/* 0x043c: host_send_done */
1239 0xec0bf406, 1229/* 0x043e: host_recv */
1240 0xb60723c4,
1241 0x30b70434,
1242 0x3b8002f0,
1243 0x023c8003,
1244 0x80013d80,
1245 0x20b6003e,
1246 0x0f24f001,
1247 0x04c807f1,
1248 0xbd0002d0,
1249 0x4027f004,
1250 0xd00007f0,
1251 0x04bd0002,
1252/* 0x0492: host_init */
1253 0x17f100f8, 1230 0x17f100f8,
1254 0x14b60080, 1231 0x13f14e49,
1255 0x7015f110, 1232 0xe1b85254,
1256 0xd007f102, 1233 0xb30bf406,
1257 0x0001d004, 1234/* 0x044c: host_recv_wait */
1258 0x17f104bd, 1235 0x04cc17f1,
1259 0x14b60080, 1236 0xf10011cf,
1260 0xf015f110, 1237 0xcf04c827,
1261 0xdc07f102, 1238 0x16f00022,
1262 0x0001d004, 1239 0x0612b808,
1263 0x17f004bd, 1240 0xc4ec0bf4,
1264 0xc407f101, 1241 0x34b60723,
1265 0x0001d004, 1242 0xf030b704,
1266 0x00f804bd, 1243 0x033b8002,
1267/* 0x04c8: memx_func_enter */ 1244 0x80023c80,
1268 0x162067f1, 1245 0x3e80013d,
1269 0xf55d77f1, 1246 0x0120b600,
1270 0xffff73f1, 1247 0xf10f24f0,
1271 0xf4026eb9, 1248 0xd004c807,
1272 0xd8b90421, 1249 0x04bd0002,
1273 0x0487fd02, 1250 0xf04027f0,
1274 0x80f960f9, 1251 0x02d00007,
1275 0xe0fcd0fc, 1252 0xf804bd00,
1276 0xf13321f4, 1253/* 0x0495: host_init */
1277 0xf1fffe77, 1254 0x8017f100,
1255 0x1014b600,
1256 0x027015f1,
1257 0x04d007f1,
1258 0xbd0001d0,
1259 0x8017f104,
1260 0x1014b600,
1261 0x02f015f1,
1262 0x04dc07f1,
1263 0xbd0001d0,
1264 0x0117f004,
1265 0x04c407f1,
1266 0xbd0001d0,
1267/* 0x04cb: memx_func_enter */
1268 0xf100f804,
1269 0xf1162067,
1270 0xf1f55d77,
1278 0xb9ffff73, 1271 0xb9ffff73,
1279 0x21f4026e, 1272 0x21f4026e,
1280 0x02d8b904, 1273 0x02d8b904,
1281 0xf90487fd, 1274 0xf90487fd,
1282 0xfc80f960, 1275 0xfc80f960,
1283 0xf4e0fcd0, 1276 0xf4e0fcd0,
1284 0x67f13321, 1277 0x77f13421,
1285 0x6eb926f0, 1278 0x73f1fffe,
1279 0x6eb9ffff,
1286 0x0421f402, 1280 0x0421f402,
1287 0xfd02d8b9, 1281 0xfd02d8b9,
1288 0x60f90487, 1282 0x60f90487,
1289 0xd0fc80f9, 1283 0xd0fc80f9,
1290 0x21f4e0fc, 1284 0x21f4e0fc,
1291 0x0467f033, 1285 0xf067f134,
1292 0x07e007f1, 1286 0x026eb926,
1287 0xb90421f4,
1288 0x87fd02d8,
1289 0xf960f904,
1290 0xfcd0fc80,
1291 0x3421f4e0,
1292 0xf10467f0,
1293 0xd007e007,
1294 0x04bd0006,
1295/* 0x0534: memx_func_enter_wait */
1296 0x07c067f1,
1297 0xf00066cf,
1298 0x0bf40464,
1299 0x2c67f0f6,
1300 0x800066cf,
1301 0x00f8f106,
1302/* 0x054c: memx_func_leave */
1303 0xcf2c67f0,
1304 0x06800066,
1305 0x0467f0f2,
1306 0x07e407f1,
1293 0xbd0006d0, 1307 0xbd0006d0,
1294/* 0x0531: memx_func_enter_wait */ 1308/* 0x0561: memx_func_leave_wait */
1295 0xc067f104, 1309 0xc067f104,
1296 0x0066cf07, 1310 0x0066cf07,
1297 0xf40464f0, 1311 0xf40464f0,
1298 0x67f0f60b, 1312 0x67f1f61b,
1299 0x0066cf2c, 1313 0x77f126f0,
1300 0xf8f10680, 1314 0x73f00001,
1301/* 0x0549: memx_func_leave */ 1315 0x026eb900,
1302 0x2c67f000, 1316 0xb90421f4,
1303 0x800066cf, 1317 0x87fd02d8,
1304 0x67f0f206, 1318 0xf960f905,
1305 0xe407f104, 1319 0xfcd0fc80,
1306 0x0006d007, 1320 0x3421f4e0,
1307/* 0x055e: memx_func_leave_wait */ 1321 0x162067f1,
1308 0x67f104bd, 1322 0xf4026eb9,
1309 0x66cf07c0, 1323 0xd8b90421,
1310 0x0464f000, 1324 0x0587fd02,
1311 0xf1f61bf4, 1325 0x80f960f9,
1312 0xf126f067, 1326 0xe0fcd0fc,
1313 0xf0000177, 1327 0xf13421f4,
1328 0xf00aa277,
1314 0x6eb90073, 1329 0x6eb90073,
1315 0x0421f402, 1330 0x0421f402,
1316 0xfd02d8b9, 1331 0xfd02d8b9,
1317 0x60f90587, 1332 0x60f90587,
1318 0xd0fc80f9, 1333 0xd0fc80f9,
1319 0x21f4e0fc, 1334 0x21f4e0fc,
1320 0x2067f133, 1335/* 0x05cb: memx_func_wait_vblank */
1321 0x026eb916, 1336 0xb600f834,
1322 0xb90421f4, 1337 0x00f80410,
1323 0x87fd02d8, 1338/* 0x05d0: memx_func_wr32 */
1324 0xf960f905, 1339 0x98001698,
1325 0xfcd0fc80, 1340 0x10b60115,
1326 0x3321f4e0, 1341 0xf960f908,
1327 0x0aa277f1, 1342 0xfcd0fc50,
1328 0xb90073f0, 1343 0x3421f4e0,
1329 0x21f4026e, 1344 0xf40242b6,
1330 0x02d8b904, 1345 0x00f8e91b,
1331 0xf90587fd, 1346/* 0x05ec: memx_func_wait */
1332 0xfc80f960, 1347 0xcf2c87f0,
1333 0xf4e0fcd0, 1348 0x1e980088,
1334 0x00f83321, 1349 0x011d9800,
1335/* 0x05c8: memx_func_wait_vblank */ 1350 0x98021c98,
1336 0xf80410b6, 1351 0x10b6031b,
1337/* 0x05cd: memx_func_wr32 */ 1352 0x8521f410,
1338 0x00169800, 1353/* 0x0606: memx_func_delay */
1339 0xb6011598, 1354 0x1e9800f8,
1340 0x60f90810,
1341 0xd0fc50f9,
1342 0x21f4e0fc,
1343 0x0242b633,
1344 0xf8e91bf4,
1345/* 0x05e9: memx_func_wait */
1346 0x2c87f000,
1347 0x980088cf,
1348 0x1d98001e,
1349 0x021c9801,
1350 0xb6031b98,
1351 0x21f41010,
1352/* 0x0603: memx_func_delay */
1353 0x9800f886,
1354 0x10b6001e,
1355 0x6721f404,
1356/* 0x060e: memx_func_train */
1357 0x00f800f8,
1358/* 0x0610: memx_exec */
1359 0xd0f9e0f9,
1360 0xb902c1b9,
1361/* 0x061a: memx_exec_next */
1362 0x139802b2,
1363 0x0410b600, 1355 0x0410b600,
1364 0x01f034e7, 1356 0xf86621f4,
1365 0x01e033e7, 1357/* 0x0611: memx_func_train */
1366 0xf00132b6, 1358/* 0x0613: memx_exec */
1367 0x35980c30, 1359 0xf900f800,
1368 0xb855f9de, 1360 0xb9d0f9e0,
1369 0x1ef40612, 1361 0xb2b902c1,
1370 0xf10b98e4, 1362/* 0x061d: memx_exec_next */
1371 0xbbf20c98, 1363 0x00139802,
1372 0xb7f102cb, 1364 0xe70410b6,
1373 0xbbcf07c4, 1365 0xe701f034,
1374 0xfcd0fc00, 1366 0xb601e033,
1375 0xe621f5e0, 1367 0x30f00132,
1376/* 0x0653: memx_info */ 1368 0xde35980c,
1377 0x7000f802, 1369 0x12b855f9,
1378 0x0bf401c6, 1370 0xe41ef406,
1379/* 0x0659: memx_info_data */ 1371 0x98f10b98,
1380 0xccc7f10e, 1372 0xcbbbf20c,
1381 0x00b7f103, 1373 0xc4b7f102,
1382 0x0b0ef408, 1374 0x00bbcf07,
1383/* 0x0664: memx_info_train */ 1375 0xe0fcd0fc,
1384 0x0bccc7f1, 1376 0x02e521f5,
1385 0x0100b7f1, 1377/* 0x0656: memx_info */
1386/* 0x066c: memx_info_send */ 1378 0xc67000f8,
1387 0x02e621f5, 1379 0x0e0bf401,
1388/* 0x0672: memx_recv */ 1380/* 0x065c: memx_info_data */
1389 0xd6b000f8, 1381 0x03ccc7f1,
1390 0x9b0bf401, 1382 0x0800b7f1,
1391 0xf400d6b0, 1383/* 0x0667: memx_info_train */
1392 0x00f8d80b, 1384 0xf10b0ef4,
1393/* 0x0680: memx_init */ 1385 0xf10bccc7,
1394/* 0x0682: perf_recv */ 1386/* 0x066f: memx_info_send */
1395 0x00f800f8, 1387 0xf50100b7,
1396/* 0x0684: perf_init */ 1388 0xf802e521,
1397/* 0x0686: i2c_drive_scl */ 1389/* 0x0675: memx_recv */
1398 0x36b000f8, 1390 0x01d6b000,
1399 0x0e0bf400, 1391 0xb09b0bf4,
1400 0x07e007f1, 1392 0x0bf400d6,
1401 0xbd0001d0, 1393/* 0x0683: memx_init */
1402/* 0x0697: i2c_drive_scl_lo */ 1394 0xf800f8d8,
1403 0xf100f804, 1395/* 0x0685: perf_recv */
1404 0xd007e407, 1396/* 0x0687: perf_init */
1397 0xf800f800,
1398/* 0x0689: i2c_drive_scl */
1399 0x0036b000,
1400 0xf10e0bf4,
1401 0xd007e007,
1405 0x04bd0001, 1402 0x04bd0001,
1406/* 0x06a2: i2c_drive_sda */ 1403/* 0x069a: i2c_drive_scl_lo */
1407 0x36b000f8, 1404 0x07f100f8,
1408 0x0e0bf400, 1405 0x01d007e4,
1409 0x07e007f1, 1406 0xf804bd00,
1410 0xbd0002d0, 1407/* 0x06a5: i2c_drive_sda */
1411/* 0x06b3: i2c_drive_sda_lo */ 1408 0x0036b000,
1412 0xf100f804, 1409 0xf10e0bf4,
1413 0xd007e407, 1410 0xd007e007,
1414 0x04bd0002, 1411 0x04bd0002,
1415/* 0x06be: i2c_sense_scl */ 1412/* 0x06b6: i2c_drive_sda_lo */
1413 0x07f100f8,
1414 0x02d007e4,
1415 0xf804bd00,
1416/* 0x06c1: i2c_sense_scl */
1417 0x0132f400,
1418 0x07c437f1,
1419 0xfd0033cf,
1420 0x0bf40431,
1421 0x0131f406,
1422/* 0x06d4: i2c_sense_scl_done */
1423/* 0x06d6: i2c_sense_sda */
1416 0x32f400f8, 1424 0x32f400f8,
1417 0xc437f101, 1425 0xc437f101,
1418 0x0033cf07, 1426 0x0033cf07,
1419 0xf40431fd, 1427 0xf40432fd,
1420 0x31f4060b, 1428 0x31f4060b,
1421/* 0x06d1: i2c_sense_scl_done */ 1429/* 0x06e9: i2c_sense_sda_done */
1422/* 0x06d3: i2c_sense_sda */ 1430/* 0x06eb: i2c_raise_scl */
1423 0xf400f801, 1431 0xf900f801,
1424 0x37f10132, 1432 0x9847f140,
1425 0x33cf07c4, 1433 0x0137f008,
1426 0x0432fd00, 1434 0x068921f5,
1427 0xf4060bf4, 1435/* 0x06f8: i2c_raise_scl_wait */
1428/* 0x06e6: i2c_sense_sda_done */
1429 0x00f80131,
1430/* 0x06e8: i2c_raise_scl */
1431 0x47f140f9,
1432 0x37f00898,
1433 0x8621f501,
1434/* 0x06f5: i2c_raise_scl_wait */
1435 0xe8e7f106,
1436 0x6721f403,
1437 0x06be21f5,
1438 0xb60901f4,
1439 0x1bf40142,
1440/* 0x0709: i2c_raise_scl_done */
1441 0xf840fcef,
1442/* 0x070d: i2c_start */
1443 0xbe21f500,
1444 0x0d11f406,
1445 0x06d321f5,
1446 0xf40611f4,
1447/* 0x071e: i2c_start_rep */
1448 0x37f0300e,
1449 0x8621f500,
1450 0x0137f006,
1451 0x06a221f5,
1452 0xb60076bb,
1453 0x50f90465,
1454 0xbb046594,
1455 0x50bd0256,
1456 0xfc0475fd,
1457 0xe821f550,
1458 0x0464b606,
1459/* 0x074b: i2c_start_send */
1460 0xf01f11f4,
1461 0x21f50037,
1462 0xe7f106a2,
1463 0x21f41388,
1464 0x0037f067,
1465 0x068621f5,
1466 0x1388e7f1,
1467/* 0x0767: i2c_start_out */
1468 0xf86721f4,
1469/* 0x0769: i2c_stop */
1470 0x0037f000,
1471 0x068621f5,
1472 0xf50037f0,
1473 0xf106a221,
1474 0xf403e8e7,
1475 0x37f06721,
1476 0x8621f501,
1477 0x88e7f106,
1478 0x6721f413,
1479 0xf50137f0,
1480 0xf106a221,
1481 0xf41388e7,
1482 0x00f86721,
1483/* 0x079c: i2c_bitw */
1484 0x06a221f5,
1485 0x03e8e7f1, 1436 0x03e8e7f1,
1486 0xbb6721f4, 1437 0xf56621f4,
1438 0xf406c121,
1439 0x42b60901,
1440 0xef1bf401,
1441/* 0x070c: i2c_raise_scl_done */
1442 0x00f840fc,
1443/* 0x0710: i2c_start */
1444 0x06c121f5,
1445 0xf50d11f4,
1446 0xf406d621,
1447 0x0ef40611,
1448/* 0x0721: i2c_start_rep */
1449 0x0037f030,
1450 0x068921f5,
1451 0xf50137f0,
1452 0xbb06a521,
1487 0x65b60076, 1453 0x65b60076,
1488 0x9450f904, 1454 0x9450f904,
1489 0x56bb0465, 1455 0x56bb0465,
1490 0xfd50bd02, 1456 0xfd50bd02,
1491 0x50fc0475, 1457 0x50fc0475,
1492 0x06e821f5, 1458 0x06eb21f5,
1493 0xf40464b6, 1459 0xf40464b6,
1494 0xe7f11811, 1460/* 0x074e: i2c_start_send */
1461 0x37f01f11,
1462 0xa521f500,
1463 0x88e7f106,
1464 0x6621f413,
1465 0xf50037f0,
1466 0xf1068921,
1467 0xf41388e7,
1468/* 0x076a: i2c_start_out */
1469 0x00f86621,
1470/* 0x076c: i2c_stop */
1471 0xf50037f0,
1472 0xf0068921,
1473 0x21f50037,
1474 0xe7f106a5,
1475 0x21f403e8,
1476 0x0137f066,
1477 0x068921f5,
1478 0x1388e7f1,
1479 0xf06621f4,
1480 0x21f50137,
1481 0xe7f106a5,
1495 0x21f41388, 1482 0x21f41388,
1496 0x0037f067, 1483/* 0x079f: i2c_bitw */
1497 0x068621f5, 1484 0xf500f866,
1485 0xf106a521,
1486 0xf403e8e7,
1487 0x76bb6621,
1488 0x0465b600,
1489 0x659450f9,
1490 0x0256bb04,
1491 0x75fd50bd,
1492 0xf550fc04,
1493 0xb606eb21,
1494 0x11f40464,
1495 0x88e7f118,
1496 0x6621f413,
1497 0xf50037f0,
1498 0xf1068921,
1499 0xf41388e7,
1500/* 0x07de: i2c_bitw_out */
1501 0x00f86621,
1502/* 0x07e0: i2c_bitr */
1503 0xf50137f0,
1504 0xf106a521,
1505 0xf403e8e7,
1506 0x76bb6621,
1507 0x0465b600,
1508 0x659450f9,
1509 0x0256bb04,
1510 0x75fd50bd,
1511 0xf550fc04,
1512 0xb606eb21,
1513 0x11f40464,
1514 0xd621f51b,
1515 0x0037f006,
1516 0x068921f5,
1498 0x1388e7f1, 1517 0x1388e7f1,
1499/* 0x07db: i2c_bitw_out */ 1518 0xf06621f4,
1500 0xf86721f4, 1519 0x31f4013c,
1501/* 0x07dd: i2c_bitr */ 1520/* 0x0825: i2c_bitr_done */
1502 0x0137f000, 1521/* 0x0827: i2c_get_byte */
1503 0x06a221f5, 1522 0xf000f801,
1504 0x03e8e7f1, 1523 0x47f00057,
1505 0xbb6721f4, 1524/* 0x082d: i2c_get_byte_next */
1506 0x65b60076, 1525 0x0154b608,
1507 0x9450f904,
1508 0x56bb0465,
1509 0xfd50bd02,
1510 0x50fc0475,
1511 0x06e821f5,
1512 0xf40464b6,
1513 0x21f51b11,
1514 0x37f006d3,
1515 0x8621f500,
1516 0x88e7f106,
1517 0x6721f413,
1518 0xf4013cf0,
1519/* 0x0822: i2c_bitr_done */
1520 0x00f80131,
1521/* 0x0824: i2c_get_byte */
1522 0xf00057f0,
1523/* 0x082a: i2c_get_byte_next */
1524 0x54b60847,
1525 0x0076bb01,
1526 0xf90465b6,
1527 0x04659450,
1528 0xbd0256bb,
1529 0x0475fd50,
1530 0x21f550fc,
1531 0x64b607dd,
1532 0x2b11f404,
1533 0xb60553fd,
1534 0x1bf40142,
1535 0x0137f0d8,
1536 0xb60076bb, 1526 0xb60076bb,
1537 0x50f90465, 1527 0x50f90465,
1538 0xbb046594, 1528 0xbb046594,
1539 0x50bd0256, 1529 0x50bd0256,
1540 0xfc0475fd, 1530 0xfc0475fd,
1541 0x9c21f550, 1531 0xe021f550,
1542 0x0464b607, 1532 0x0464b607,
1543/* 0x0874: i2c_get_byte_done */ 1533 0xfd2b11f4,
1544/* 0x0876: i2c_put_byte */ 1534 0x42b60553,
1545 0x47f000f8, 1535 0xd81bf401,
1546/* 0x0879: i2c_put_byte_next */ 1536 0xbb0137f0,
1547 0x0142b608, 1537 0x65b60076,
1548 0xbb3854ff, 1538 0x9450f904,
1539 0x56bb0465,
1540 0xfd50bd02,
1541 0x50fc0475,
1542 0x079f21f5,
1543/* 0x0877: i2c_get_byte_done */
1544 0xf80464b6,
1545/* 0x0879: i2c_put_byte */
1546 0x0847f000,
1547/* 0x087c: i2c_put_byte_next */
1548 0xff0142b6,
1549 0x76bb3854,
1550 0x0465b600,
1551 0x659450f9,
1552 0x0256bb04,
1553 0x75fd50bd,
1554 0xf550fc04,
1555 0xb6079f21,
1556 0x11f40464,
1557 0x0046b034,
1558 0xbbd81bf4,
1549 0x65b60076, 1559 0x65b60076,
1550 0x9450f904, 1560 0x9450f904,
1551 0x56bb0465, 1561 0x56bb0465,
1552 0xfd50bd02, 1562 0xfd50bd02,
1553 0x50fc0475, 1563 0x50fc0475,
1554 0x079c21f5, 1564 0x07e021f5,
1555 0xf40464b6, 1565 0xf40464b6,
1556 0x46b03411, 1566 0x76bb0f11,
1557 0xd81bf400, 1567 0x0136b000,
1568 0xf4061bf4,
1569/* 0x08d2: i2c_put_byte_done */
1570 0x00f80132,
1571/* 0x08d4: i2c_addr */
1558 0xb60076bb, 1572 0xb60076bb,
1559 0x50f90465, 1573 0x50f90465,
1560 0xbb046594, 1574 0xbb046594,
1561 0x50bd0256, 1575 0x50bd0256,
1562 0xfc0475fd, 1576 0xfc0475fd,
1563 0xdd21f550, 1577 0x1021f550,
1564 0x0464b607, 1578 0x0464b607,
1565 0xbb0f11f4, 1579 0xe72911f4,
1566 0x36b00076, 1580 0xb6012ec3,
1567 0x061bf401, 1581 0x53fd0134,
1568/* 0x08cf: i2c_put_byte_done */ 1582 0x0076bb05,
1569 0xf80132f4,
1570/* 0x08d1: i2c_addr */
1571 0x0076bb00,
1572 0xf90465b6, 1583 0xf90465b6,
1573 0x04659450, 1584 0x04659450,
1574 0xbd0256bb, 1585 0xbd0256bb,
1575 0x0475fd50, 1586 0x0475fd50,
1576 0x21f550fc, 1587 0x21f550fc,
1577 0x64b6070d, 1588 0x64b60879,
1578 0x2911f404, 1589/* 0x0919: i2c_addr_done */
1579 0x012ec3e7, 1590/* 0x091b: i2c_acquire_addr */
1580 0xfd0134b6, 1591 0xc700f804,
1581 0x76bb0553, 1592 0xe4b6f8ce,
1582 0x0465b600, 1593 0x14e0b705,
1583 0x659450f9, 1594/* 0x0927: i2c_acquire */
1584 0x0256bb04, 1595 0xf500f8d0,
1585 0x75fd50bd, 1596 0xf4091b21,
1586 0xf550fc04, 1597 0xd9f00421,
1587 0xb6087621, 1598 0x3421f403,
1588/* 0x0916: i2c_addr_done */ 1599/* 0x0936: i2c_release */
1589 0x00f80464, 1600 0x21f500f8,
1590/* 0x0918: i2c_acquire_addr */ 1601 0x21f4091b,
1591 0xb6f8cec7, 1602 0x03daf004,
1592 0xe0b705e4, 1603 0xf83421f4,
1593 0x00f8d014, 1604/* 0x0945: i2c_recv */
1594/* 0x0924: i2c_acquire */ 1605 0x0132f400,
1595 0x091821f5, 1606 0xb6f8c1c7,
1596 0xf00421f4, 1607 0x16b00214,
1597 0x21f403d9, 1608 0x3a1ff528,
1598/* 0x0933: i2c_release */ 1609 0xf413a001,
1599 0xf500f833, 1610 0x0032980c,
1600 0xf4091821, 1611 0x0ccc13a0,
1601 0xdaf00421, 1612 0xf4003198,
1602 0x3321f403, 1613 0xd0f90231,
1603/* 0x0942: i2c_recv */ 1614 0xd0f9e0f9,
1604 0x32f400f8, 1615 0x000067f1,
1605 0xf8c1c701, 1616 0x100063f1,
1606 0xb00214b6, 1617 0xbb016792,
1607 0x1ff52816,
1608 0x13a0013a,
1609 0x32980cf4,
1610 0xcc13a000,
1611 0x0031980c,
1612 0xf90231f4,
1613 0xf9e0f9d0,
1614 0x0067f1d0,
1615 0x0063f100,
1616 0x01679210,
1617 0xb60076bb,
1618 0x50f90465,
1619 0xbb046594,
1620 0x50bd0256,
1621 0xfc0475fd,
1622 0x2421f550,
1623 0x0464b609,
1624 0xd6b0d0fc,
1625 0xb31bf500,
1626 0x0057f000,
1627 0xb60076bb,
1628 0x50f90465,
1629 0xbb046594,
1630 0x50bd0256,
1631 0xfc0475fd,
1632 0xd121f550,
1633 0x0464b608,
1634 0x00d011f5,
1635 0xbbe0c5c7,
1636 0x65b60076, 1618 0x65b60076,
1637 0x9450f904, 1619 0x9450f904,
1638 0x56bb0465, 1620 0x56bb0465,
1639 0xfd50bd02, 1621 0xfd50bd02,
1640 0x50fc0475, 1622 0x50fc0475,
1641 0x087621f5, 1623 0x092721f5,
1624 0xfc0464b6,
1625 0x00d6b0d0,
1626 0x00b31bf5,
1627 0xbb0057f0,
1628 0x65b60076,
1629 0x9450f904,
1630 0x56bb0465,
1631 0xfd50bd02,
1632 0x50fc0475,
1633 0x08d421f5,
1642 0xf50464b6, 1634 0xf50464b6,
1643 0xf000ad11, 1635 0xc700d011,
1644 0x76bb0157, 1636 0x76bbe0c5,
1645 0x0465b600, 1637 0x0465b600,
1646 0x659450f9, 1638 0x659450f9,
1647 0x0256bb04, 1639 0x0256bb04,
1648 0x75fd50bd, 1640 0x75fd50bd,
1649 0xf550fc04, 1641 0xf550fc04,
1650 0xb608d121, 1642 0xb6087921,
1651 0x11f50464, 1643 0x11f50464,
1652 0x76bb008a, 1644 0x57f000ad,
1653 0x0465b600, 1645 0x0076bb01,
1654 0x659450f9, 1646 0xf90465b6,
1655 0x0256bb04, 1647 0x04659450,
1656 0x75fd50bd, 1648 0xbd0256bb,
1657 0xf550fc04, 1649 0x0475fd50,
1658 0xb6082421, 1650 0x21f550fc,
1659 0x11f40464, 1651 0x64b608d4,
1660 0xe05bcb6a, 1652 0x8a11f504,
1661 0xb60076bb, 1653 0x0076bb00,
1662 0x50f90465, 1654 0xf90465b6,
1663 0xbb046594, 1655 0x04659450,
1664 0x50bd0256, 1656 0xbd0256bb,
1665 0xfc0475fd, 1657 0x0475fd50,
1666 0x6921f550, 1658 0x21f550fc,
1667 0x0464b607, 1659 0x64b60827,
1668 0xbd025bb9, 1660 0x6a11f404,
1669 0x430ef474, 1661 0xbbe05bcb,
1670/* 0x0a48: i2c_recv_not_rd08 */ 1662 0x65b60076,
1671 0xf401d6b0, 1663 0x9450f904,
1672 0x57f03d1b, 1664 0x56bb0465,
1673 0xd121f500, 1665 0xfd50bd02,
1674 0x3311f408, 1666 0x50fc0475,
1675 0xf5e0c5c7, 1667 0x076c21f5,
1676 0xf4087621, 1668 0xb90464b6,
1677 0x57f02911, 1669 0x74bd025b,
1678 0xd121f500, 1670/* 0x0a4b: i2c_recv_not_rd08 */
1679 0x1f11f408, 1671 0xb0430ef4,
1680 0xf5e0b5c7, 1672 0x1bf401d6,
1681 0xf4087621, 1673 0x0057f03d,
1682 0x21f51511, 1674 0x08d421f5,
1683 0x74bd0769, 1675 0xc73311f4,
1684 0xf408c5c7, 1676 0x21f5e0c5,
1685 0x32f4091b, 1677 0x11f40879,
1686 0x030ef402, 1678 0x0057f029,
1687/* 0x0a88: i2c_recv_not_wr08 */ 1679 0x08d421f5,
1688/* 0x0a88: i2c_recv_done */ 1680 0xc71f11f4,
1689 0xf5f8cec7, 1681 0x21f5e0b5,
1690 0xfc093321, 1682 0x11f40879,
1691 0xf4d0fce0, 1683 0x6c21f515,
1692 0x7cb90a12, 1684 0xc774bd07,
1693 0xe621f502, 1685 0x1bf408c5,
1694/* 0x0a9d: i2c_recv_exit */ 1686 0x0232f409,
1695/* 0x0a9f: i2c_init */ 1687/* 0x0a8b: i2c_recv_not_wr08 */
1688/* 0x0a8b: i2c_recv_done */
1689 0xc7030ef4,
1690 0x21f5f8ce,
1691 0xe0fc0936,
1692 0x12f4d0fc,
1693 0x027cb90a,
1694 0x02e521f5,
1695/* 0x0aa0: i2c_recv_exit */
1696/* 0x0aa2: i2c_init */
1697 0x00f800f8,
1698/* 0x0aa4: test_recv */
1699 0x05d817f1,
1700 0xb60011cf,
1701 0x07f10110,
1702 0x01d005d8,
1703 0xf104bd00,
1704 0xf1d900e7,
1705 0xf5134fe3,
1706 0xf8021721,
1707/* 0x0ac5: test_init */
1708 0x00e7f100,
1709 0x1721f508,
1710/* 0x0acf: idle_recv */
1696 0xf800f802, 1711 0xf800f802,
1697/* 0x0aa1: test_recv */ 1712/* 0x0ad1: idle */
1698 0xd817f100, 1713 0x0031f400,
1699 0x0011cf05, 1714 0x05d417f1,
1700 0xf10110b6, 1715 0xb60011cf,
1701 0xd005d807, 1716 0x07f10110,
1702 0x04bd0001, 1717 0x01d005d4,
1703 0xd900e7f1, 1718/* 0x0ae7: idle_loop */
1704 0x134fe3f1, 1719 0xf004bd00,
1705 0x021821f5, 1720 0x32f45817,
1706/* 0x0ac2: test_init */ 1721/* 0x0aed: idle_proc */
1707 0xe7f100f8, 1722/* 0x0aed: idle_proc_exec */
1708 0x21f50800, 1723 0xb910f902,
1709 0x00f80218, 1724 0x21f5021e,
1710/* 0x0acc: idle_recv */ 1725 0x10fc02ee,
1711/* 0x0ace: idle */ 1726 0xf40911f4,
1712 0x31f400f8, 1727 0x0ef40231,
1713 0xd417f100, 1728/* 0x0b01: idle_proc_next */
1714 0x0011cf05, 1729 0x5810b6ef,
1715 0xf10110b6, 1730 0xf4061fb8,
1716 0xd005d407, 1731 0x02f4e61b,
1717 0x04bd0001, 1732 0x0028f4dd,
1718/* 0x0ae4: idle_loop */ 1733 0x00c10ef4,
1719 0xf45817f0,
1720/* 0x0aea: idle_proc */
1721/* 0x0aea: idle_proc_exec */
1722 0x10f90232,
1723 0xf5021eb9,
1724 0xfc02ef21,
1725 0x0911f410,
1726 0xf40231f4,
1727/* 0x0afe: idle_proc_next */
1728 0x10b6ef0e,
1729 0x061fb858,
1730 0xf4e61bf4,
1731 0x28f4dd02,
1732 0xc10ef400,
1733 0x00000000,
1734 0x00000000, 1734 0x00000000,
1735 0x00000000, 1735 0x00000000,
1736 0x00000000, 1736 0x00000000,
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gk208.fuc5.h b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gk208.fuc5.h
index 8a2b628642ac..3c731ff12871 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gk208.fuc5.h
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gk208.fuc5.h
@@ -24,8 +24,8 @@ uint32_t gk208_pmu_data[] = {
24 0x00000000, 24 0x00000000,
25/* 0x0058: proc_list_head */ 25/* 0x0058: proc_list_head */
26 0x54534f48, 26 0x54534f48,
27 0x00000447, 27 0x0000042c,
28 0x000003f8, 28 0x000003df,
29 0x00000000, 29 0x00000000,
30 0x00000000, 30 0x00000000,
31 0x00000000, 31 0x00000000,
@@ -46,8 +46,8 @@ uint32_t gk208_pmu_data[] = {
46 0x00000000, 46 0x00000000,
47 0x00000000, 47 0x00000000,
48 0x584d454d, 48 0x584d454d,
49 0x00000621, 49 0x000005f3,
50 0x00000613, 50 0x000005e5,
51 0x00000000, 51 0x00000000,
52 0x00000000, 52 0x00000000,
53 0x00000000, 53 0x00000000,
@@ -68,8 +68,8 @@ uint32_t gk208_pmu_data[] = {
68 0x00000000, 68 0x00000000,
69 0x00000000, 69 0x00000000,
70 0x46524550, 70 0x46524550,
71 0x00000625, 71 0x000005f7,
72 0x00000623, 72 0x000005f5,
73 0x00000000, 73 0x00000000,
74 0x00000000, 74 0x00000000,
75 0x00000000, 75 0x00000000,
@@ -90,8 +90,8 @@ uint32_t gk208_pmu_data[] = {
90 0x00000000, 90 0x00000000,
91 0x00000000, 91 0x00000000,
92 0x5f433249, 92 0x5f433249,
93 0x00000a29, 93 0x000009f8,
94 0x000008d0, 94 0x000008a2,
95 0x00000000, 95 0x00000000,
96 0x00000000, 96 0x00000000,
97 0x00000000, 97 0x00000000,
@@ -112,8 +112,8 @@ uint32_t gk208_pmu_data[] = {
112 0x00000000, 112 0x00000000,
113 0x00000000, 113 0x00000000,
114 0x54534554, 114 0x54534554,
115 0x00000a4a, 115 0x00000a16,
116 0x00000a2b, 116 0x000009fa,
117 0x00000000, 117 0x00000000,
118 0x00000000, 118 0x00000000,
119 0x00000000, 119 0x00000000,
@@ -134,8 +134,8 @@ uint32_t gk208_pmu_data[] = {
134 0x00000000, 134 0x00000000,
135 0x00000000, 135 0x00000000,
136 0x454c4449, 136 0x454c4449,
137 0x00000a55, 137 0x00000a21,
138 0x00000a53, 138 0x00000a1f,
139 0x00000000, 139 0x00000000,
140 0x00000000, 140 0x00000000,
141 0x00000000, 141 0x00000000,
@@ -229,26 +229,26 @@ uint32_t gk208_pmu_data[] = {
229/* 0x0370: memx_func_head */ 229/* 0x0370: memx_func_head */
230 0x00000001, 230 0x00000001,
231 0x00000000, 231 0x00000000,
232 0x00000477, 232 0x0000045c,
233/* 0x037c: memx_func_next */ 233/* 0x037c: memx_func_next */
234 0x00000002, 234 0x00000002,
235 0x00000000, 235 0x00000000,
236 0x000004f4, 236 0x000004cf,
237 0x00000003, 237 0x00000003,
238 0x00000002, 238 0x00000002,
239 0x00000574, 239 0x00000546,
240 0x00040004, 240 0x00040004,
241 0x00000000, 241 0x00000000,
242 0x00000591, 242 0x00000563,
243 0x00010005, 243 0x00010005,
244 0x00000000, 244 0x00000000,
245 0x000005ab, 245 0x0000057d,
246 0x00010006, 246 0x00010006,
247 0x00000000, 247 0x00000000,
248 0x0000056f, 248 0x00000541,
249 0x00000007, 249 0x00000007,
250 0x00000000, 250 0x00000000,
251 0x000005b7, 251 0x00000589,
252/* 0x03c4: memx_func_tail */ 252/* 0x03c4: memx_func_tail */
253/* 0x03c4: memx_ts_start */ 253/* 0x03c4: memx_ts_start */
254 0x00000000, 254 0x00000000,
@@ -916,784 +916,771 @@ uint32_t gk208_pmu_data[] = {
916}; 916};
917 917
918uint32_t gk208_pmu_code[] = { 918uint32_t gk208_pmu_code[] = {
919 0x03100ef5, 919 0x02f90ef5,
920/* 0x0004: rd32 */ 920/* 0x0004: rd32 */
921 0xf607a040, 921 0xf607a040,
922 0x04bd000e, 922 0x04bd000e,
923 0xd3f0010d, 923 0x0100018d,
924 0xf607ac40,
925 0x04bd000d,
926/* 0x0018: rd32_wait */
927 0xcf07ac4d,
928 0xd4f100dd,
929 0x1bf47000,
930 0x07a44df6,
931 0xf800ddcf,
932/* 0x002d: wr32 */
933 0x07a04000,
934 0xbd000ef6,
935 0x07a44004,
936 0xbd000df6,
937 0x00f28d04,
924 0x07ac4001, 938 0x07ac4001,
925 0xbd000df6, 939 0xbd000df6,
926/* 0x0019: rd32_wait */ 940/* 0x0049: wr32_wait */
927 0x07ac4d04, 941 0x07ac4d04,
928 0xf100ddcf, 942 0xf100ddcf,
929 0xf47000d4, 943 0xf47000d4,
930 0xa44df61b, 944 0x00f8f61b,
931 0x00ddcf07, 945/* 0x0058: nsec */
932/* 0x002e: wr32 */ 946 0x80f990f9,
933 0xa04000f8, 947 0x88cf2c08,
934 0x000ef607, 948/* 0x0061: nsec_loop */
935 0xa44004bd, 949 0xcf2c0900,
936 0x000df607, 950 0x98bb0099,
937 0x020d04bd, 951 0xf49ea602,
938 0xf0f0d5f0, 952 0x80fcf61e,
939 0xac4001d3, 953 0x00f890fc,
940 0x000df607, 954/* 0x0074: wait */
941/* 0x004e: wr32_wait */ 955 0x80f990f9,
942 0xac4d04bd, 956 0x88cf2c08,
943 0x00ddcf07, 957/* 0x007d: wait_loop */
944 0x7000d4f1, 958 0x7eeeb200,
945 0xf8f61bf4, 959 0xb2000004,
946/* 0x005d: nsec */ 960 0x04adfdda,
947 0xf990f900, 961 0x0bf4aca6,
948 0xcf2c0880, 962 0xcf2c0910,
949/* 0x0066: nsec_loop */ 963 0x98bb0099,
950 0x2c090088, 964 0xf49ba602,
951 0xbb0099cf, 965/* 0x009a: wait_done */
952 0x9ea60298, 966 0x80fce61e,
953 0xfcf61ef4, 967 0x00f890fc,
954 0xf890fc80, 968/* 0x00a0: intr_watchdog */
955/* 0x0079: wait */ 969 0xb003e998,
956 0xf990f900, 970 0x0bf40096,
957 0xcf2c0880, 971 0x9a0a9828,
958/* 0x0082: wait_loop */ 972 0xf4029abb,
959 0xeeb20088, 973 0x010d0e1c,
960 0x0000047e, 974 0x00023e7e,
961 0xadfddab2, 975 0x0ef494bd,
962 0xf4aca604, 976/* 0x00bd: intr_watchdog_next_time */
963 0x2c09100b, 977 0x9b0a9814,
964 0xbb0099cf, 978 0xf400a6b0,
965 0x9ba60298, 979 0x9aa6080b,
966/* 0x009f: wait_done */ 980/* 0x00cb: intr_watchdog_next_time_set */
967 0xfce61ef4, 981 0xb5061cf4,
968 0xf890fc80, 982/* 0x00ce: intr_watchdog_next_proc */
969/* 0x00a5: intr_watchdog */ 983 0xe9b59b09,
970 0x03e99800, 984 0x58e0b603,
985 0x0268e6b1,
986 0xf8c81bf4,
987/* 0x00dd: intr */
988 0xbd00f900,
989 0xf980f904,
990 0xf9a0f990,
991 0xf9c0f9b0,
992 0xf9e0f9d0,
993 0xfe000ff0,
994 0x80f90188,
995 0xcf045048,
996 0x80b60088,
997 0x04504001,
998 0xbd0008f6,
999 0xcf080804,
1000 0x89c40088,
1001 0x1f0bf402,
1002 0x0e9b00b5,
1003 0x00a07e58,
1004 0x9b099800,
971 0xf40096b0, 1005 0xf40096b0,
972 0x0a98280b, 1006 0x34000d0b,
973 0x029abb9a, 1007 0xbd0009f6,
974 0x0d0e1cf4, 1008 0x9a09b504,
975 0x02557e01, 1009/* 0x0130: intr_skip_watchdog */
976 0xf494bd00, 1010 0x080089e4,
977/* 0x00c2: intr_watchdog_next_time */ 1011 0x49340bf4,
978 0x0a98140e, 1012 0x99cf0688,
979 0x00a6b09b, 1013 0x029ac400,
980 0xa6080bf4, 1014 0x4c200bf4,
981 0x061cf49a, 1015 0xcccf04c0,
982/* 0x00d0: intr_watchdog_next_time_set */ 1016 0xdec0f900,
983/* 0x00d3: intr_watchdog_next_proc */ 1017 0x54534f48,
984 0xb59b09b5, 1018 0x9f7e000d,
985 0xe0b603e9, 1019 0xc0fc0002,
986 0x68e6b158, 1020 0xf604c040,
987 0xc81bf402, 1021 0x04bd000c,
988/* 0x00e2: intr */ 1022/* 0x0160: intr_subintr_skip_fifo */
989 0x00f900f8, 1023 0xf6068840,
990 0x80f904bd, 1024 0x04bd0009,
991 0xa0f990f9, 1025/* 0x0168: intr_skip_subintr */
992 0xc0f9b0f9, 1026 0xbd00e049,
993 0xe0f9d0f9, 1027 0x0489fd90,
994 0x000ff0f9, 1028 0x08f60400,
995 0xf90188fe, 1029 0xfc04bd00,
996 0x04504880, 1030 0x0088fe80,
997 0xb60088cf, 1031 0xe0fcf0fc,
998 0x50400180, 1032 0xc0fcd0fc,
999 0x0008f604, 1033 0xa0fcb0fc,
1000 0x080804bd, 1034 0x80fc90fc,
1001 0xc40088cf, 1035 0x32f400fc,
1002 0x0bf40289, 1036/* 0x0193: ticks_from_ns */
1003 0x9b00b51f, 1037 0xf901f800,
1004 0xa57e580e, 1038 0x4db0f9c0,
1005 0x09980000, 1039 0x527e0144,
1006 0x0096b09b, 1040 0xccec0003,
1007 0x000d0bf4, 1041 0xb4b003e8,
1008 0x0009f634, 1042 0x0e0bf400,
1009 0x09b504bd, 1043 0x03e8eeec,
1010/* 0x0135: intr_skip_watchdog */ 1044 0x7e01444d,
1011 0x0089e49a, 1045/* 0x01b3: ticks_from_ns_quit */
1012 0x360bf408, 1046 0xb2000352,
1013 0xcf068849, 1047 0xfcb0fcce,
1014 0x9ac40099, 1048/* 0x01bb: ticks_from_us */
1015 0x220bf402, 1049 0xf900f8c0,
1016 0xcf04c04c, 1050 0x4db0f9c0,
1017 0xc0f900cc, 1051 0x527e0144,
1018 0xf14f484e, 1052 0xceb20003,
1019 0x0d5453e3, 1053 0xf400b4b0,
1020 0x02b67e00, 1054 0xe4bd050b,
1021 0x40c0fc00, 1055/* 0x01d0: ticks_from_us_quit */
1022 0x0cf604c0,
1023/* 0x0167: intr_subintr_skip_fifo */
1024 0x4004bd00,
1025 0x09f60688,
1026/* 0x016f: intr_skip_subintr */
1027 0x4904bd00,
1028 0x90bd00e0,
1029 0x000489fd,
1030 0x0008f604,
1031 0x80fc04bd,
1032 0xfc0088fe,
1033 0xfce0fcf0,
1034 0xfcc0fcd0,
1035 0xfca0fcb0,
1036 0xfc80fc90,
1037 0x0032f400,
1038/* 0x019a: ticks_from_ns */
1039 0xc0f901f8,
1040 0xd7f1b0f9,
1041 0xd3f00144,
1042 0x6b21f500,
1043 0xe8ccec03,
1044 0x00b4b003,
1045 0xec120bf4,
1046 0xf103e8ee,
1047 0xf00144d7,
1048 0x21f500d3,
1049/* 0x01c2: ticks_from_ns_quit */
1050 0xceb2036b,
1051 0xc0fcb0fc, 1056 0xc0fcb0fc,
1052/* 0x01ca: ticks_from_us */ 1057/* 0x01d6: ticks_to_us */
1053 0xc0f900f8, 1058 0x444d00f8,
1054 0xd7f1b0f9, 1059 0xecedff01,
1055 0xd3f00144, 1060/* 0x01de: timer */
1056 0x6b21f500, 1061 0x90f900f8,
1057 0xb0ceb203, 1062 0x32f480f9,
1058 0x0bf400b4, 1063 0x03f89810,
1059/* 0x01e3: ticks_from_us_quit */ 1064 0xf40086b0,
1060 0xfce4bd05, 1065 0x84bd4a1c,
1061 0xf8c0fcb0, 1066 0x08f63800,
1062/* 0x01e9: ticks_to_us */ 1067 0x0804bd00,
1063 0x44d7f100, 1068 0x0088cf34,
1064 0x00d3f001, 1069 0xbb9a0998,
1065 0xf8ecedff, 1070 0xe9bb0298,
1066/* 0x01f5: timer */ 1071 0x03feb500,
1067 0xf990f900, 1072 0x88cf0808,
1068 0x1032f480, 1073 0x0284f000,
1069 0xb003f898, 1074 0x081c1bf4,
1070 0x1cf40086, 1075 0x0088cf34,
1071 0x0084bd4a, 1076 0x0bf4e0a6,
1072 0x0008f638, 1077 0xf4e8a608,
1073 0x340804bd, 1078/* 0x0222: timer_reset */
1074 0x980088cf, 1079 0x34000d1c,
1075 0x98bb9a09, 1080 0xbd000ef6,
1076 0x00e9bb02, 1081 0x9a0eb504,
1077 0x0803feb5, 1082/* 0x022c: timer_enable */
1078 0x0088cf08, 1083 0x38000108,
1079 0xf40284f0, 1084 0xbd0008f6,
1080 0x34081c1b, 1085/* 0x0235: timer_done */
1081 0xa60088cf, 1086 0x1031f404,
1082 0x080bf4e0, 1087 0x90fc80fc,
1083 0x1cf4e8a6, 1088/* 0x023e: send_proc */
1084/* 0x0239: timer_reset */ 1089 0x80f900f8,
1085 0xf634000d, 1090 0xe89890f9,
1086 0x04bd000e, 1091 0x04e99805,
1087/* 0x0243: timer_enable */ 1092 0xa60486f0,
1088 0x089a0eb5, 1093 0x2a0bf489,
1089 0xf6380001, 1094 0x940398c4,
1090 0x04bd0008, 1095 0x80b60488,
1091/* 0x024c: timer_done */ 1096 0x008ebb18,
1092 0xfc1031f4, 1097 0xb500fa98,
1098 0x8db5008a,
1099 0x028cb501,
1100 0xb6038bb5,
1101 0x94f00190,
1102 0x04e9b507,
1103/* 0x0277: send_done */
1104 0xfc0231f4,
1105 0xf880fc90,
1106/* 0x027d: find */
1107 0x0880f900,
1108 0x0131f458,
1109/* 0x0284: find_loop */
1110 0xa6008a98,
1111 0x100bf4ae,
1112 0xb15880b6,
1113 0xf4026886,
1114 0x32f4f11b,
1115/* 0x0299: find_done */
1116 0xfc8eb201,
1117/* 0x029f: send */
1118 0x7e00f880,
1119 0xf400027d,
1120 0x00f89b01,
1121/* 0x02a8: recv */
1122 0x80f990f9,
1123 0x9805e898,
1124 0x32f404e9,
1125 0xf489a601,
1126 0x89c43c0b,
1127 0x0180b603,
1128 0xb50784f0,
1129 0xea9805e8,
1130 0xfef0f902,
1131 0xf0f9018f,
1132 0x9994efb2,
1133 0x00e9bb04,
1134 0x9818e0b6,
1135 0xec9803eb,
1136 0x01ed9802,
1137 0xf900ee98,
1138 0xfef0fca5,
1139 0x31f400f8,
1140/* 0x02f3: recv_done */
1141 0xfcf0fc01,
1093 0xf890fc80, 1142 0xf890fc80,
1094/* 0x0255: send_proc */ 1143/* 0x02f9: init */
1095 0xf980f900, 1144 0x01084100,
1096 0x05e89890, 1145 0xe70011cf,
1097 0xf004e998, 1146 0xb6010911,
1098 0x89a60486, 1147 0x14fe0814,
1099 0xc42a0bf4, 1148 0x00e04100,
1100 0x88940398, 1149 0x01f61c00,
1101 0x1880b604, 1150 0x0104bd00,
1102 0x98008ebb, 1151 0xf61400ff,
1103 0x8ab500fa,
1104 0x018db500,
1105 0xb5028cb5,
1106 0x90b6038b,
1107 0x0794f001,
1108 0xf404e9b5,
1109/* 0x028e: send_done */
1110 0x90fc0231,
1111 0x00f880fc,
1112/* 0x0294: find */
1113 0x580880f9,
1114/* 0x029b: find_loop */
1115 0x980131f4,
1116 0xaea6008a,
1117 0xb6100bf4,
1118 0x86b15880,
1119 0x1bf40268,
1120 0x0132f4f1,
1121/* 0x02b0: find_done */
1122 0x80fc8eb2,
1123/* 0x02b6: send */
1124 0x947e00f8,
1125 0x01f40002,
1126/* 0x02bf: recv */
1127 0xf900f89b,
1128 0x9880f990,
1129 0xe99805e8,
1130 0x0132f404,
1131 0x0bf489a6,
1132 0x0389c43c,
1133 0xf00180b6,
1134 0xe8b50784,
1135 0x02ea9805,
1136 0x8ffef0f9,
1137 0xb2f0f901,
1138 0x049994ef,
1139 0xb600e9bb,
1140 0xeb9818e0,
1141 0x02ec9803,
1142 0x9801ed98,
1143 0xa5f900ee,
1144 0xf8fef0fc,
1145 0x0131f400,
1146/* 0x030a: recv_done */
1147 0x80fcf0fc,
1148 0x00f890fc,
1149/* 0x0310: init */
1150 0xcf010841,
1151 0x11e70011,
1152 0x14b60109,
1153 0x0014fe08,
1154 0xf000e041,
1155 0x1c000013,
1156 0xbd0001f6,
1157 0x00ff0104,
1158 0x0001f614,
1159 0x020104bd,
1160 0x080015f1,
1161 0x01f61000,
1162 0x4104bd00,
1163 0x13f000e2,
1164 0x0010fe00,
1165 0x011031f4,
1166 0xf6380001,
1167 0x04bd0001, 1152 0x04bd0001,
1168/* 0x035a: init_proc */ 1153 0x15f10201,
1169 0xf198580f, 1154 0x10000800,
1170 0x0016b001, 1155 0xbd0001f6,
1171 0xf9fa0bf4, 1156 0x00dd4104,
1172 0x58f0b615, 1157 0xffff14f1,
1173/* 0x036b: mulu32_32_64 */ 1158 0xf40010fe,
1174 0xf9f20ef4, 1159 0x01011031,
1175 0xf920f910, 1160 0x01f63800,
1176 0x9540f930, 1161 0x0f04bd00,
1177 0xd29510e1, 1162/* 0x0341: init_proc */
1178 0xbdc4bd10, 1163 0x01f19858,
1179 0xc0edffb4, 1164 0xf40016b0,
1180 0xb2301dff, 1165 0x15f9fa0b,
1166 0xf458f0b6,
1167/* 0x0352: mulu32_32_64 */
1168 0x10f9f20e,
1169 0x30f920f9,
1170 0xe19540f9,
1171 0x10d29510,
1172 0xb4bdc4bd,
1173 0xffc0edff,
1174 0x34b2301d,
1175 0xffff34f1,
1176 0xb61034b6,
1177 0xc3bb1045,
1178 0x01b4bb00,
1179 0xb230e2ff,
1181 0xff34f134, 1180 0xff34f134,
1182 0x1034b6ff, 1181 0x1034b6ff,
1183 0xbb1045b6, 1182 0xbb1045b6,
1184 0xb4bb00c3, 1183 0xb4bb00c3,
1185 0x30e2ff01, 1184 0x3012ff01,
1186 0x34f134b2, 1185 0xfc00b3bb,
1187 0x34b6ffff, 1186 0xfc30fc40,
1188 0x1045b610, 1187 0xf810fc20,
1189 0xbb00c3bb, 1188/* 0x03a1: host_send */
1190 0x12ff01b4, 1189 0x04b04100,
1191 0x00b3bb30, 1190 0x420011cf,
1192 0x30fc40fc, 1191 0x22cf04a0,
1193 0x10fc20fc, 1192 0xf412a600,
1194/* 0x03ba: host_send */ 1193 0x1ec42e0b,
1195 0xb04100f8, 1194 0x04ee9407,
1196 0x0011cf04, 1195 0x0270e0b7,
1197 0xcf04a042, 1196 0x9803eb98,
1198 0x12a60022, 1197 0xed9802ec,
1199 0xc42e0bf4, 1198 0x00ee9801,
1200 0xee94071e, 1199 0x00029f7e,
1201 0x70e0b704, 1200 0xc40110b6,
1202 0x03eb9802, 1201 0xb0400f1e,
1203 0x9802ec98, 1202 0x000ef604,
1204 0xee9801ed, 1203 0x0ef404bd,
1205 0x02b67e00, 1204/* 0x03dd: host_send_done */
1206 0x0110b600, 1205/* 0x03df: host_recv */
1207 0x400f1ec4, 1206 0xd100f8c7,
1208 0x0ef604b0, 1207 0x52544e49,
1209 0xf404bd00, 1208 0x0bf4e1a6,
1210/* 0x03f6: host_send_done */ 1209/* 0x03e9: host_recv_wait */
1211 0x00f8c70e, 1210 0x04cc41bb,
1212/* 0x03f8: host_recv */ 1211 0x420011cf,
1213 0xf14e4941, 1212 0x22cf04c8,
1214 0xa6525413, 1213 0x0816f000,
1215 0xb90bf4e1, 1214 0x0bf412a6,
1216/* 0x0404: host_recv_wait */ 1215 0x0723c4ef,
1217 0xcf04cc41, 1216 0xb70434b6,
1218 0xc8420011, 1217 0xb502f030,
1219 0x0022cf04, 1218 0x3cb5033b,
1220 0xa60816f0, 1219 0x013db502,
1221 0xef0bf412, 1220 0xb6003eb5,
1222 0xb60723c4, 1221 0x24f00120,
1223 0x30b70434, 1222 0x04c8400f,
1224 0x3bb502f0,
1225 0x023cb503,
1226 0xb5013db5,
1227 0x20b6003e,
1228 0x0f24f001,
1229 0xf604c840,
1230 0x04bd0002,
1231 0x00004002,
1232 0xbd0002f6, 1223 0xbd0002f6,
1233/* 0x0447: host_init */ 1224 0x00400204,
1234 0x4100f804, 1225 0x0002f600,
1235 0x14b60080, 1226 0x00f804bd,
1236 0x7015f110, 1227/* 0x042c: host_init */
1237 0x04d04002, 1228 0xb6008041,
1238 0xbd0001f6, 1229 0x15f11014,
1239 0x00804104, 1230 0xd0400270,
1240 0xf11014b6, 1231 0x0001f604,
1241 0x4002f015, 1232 0x804104bd,
1242 0x01f604dc, 1233 0x1014b600,
1243 0x0104bd00, 1234 0x02f015f1,
1244 0x04c44001, 1235 0xf604dc40,
1245 0xbd0001f6, 1236 0x04bd0001,
1246/* 0x0477: memx_func_enter */ 1237 0xc4400101,
1247 0xf100f804, 1238 0x0001f604,
1248 0xf1162067, 1239 0x00f804bd,
1249 0xf1f55d77, 1240/* 0x045c: memx_func_enter */
1250 0xb2ffff73, 1241 0x162067f1,
1251 0x00047e6e, 1242 0xf55d77f1,
1252 0xfdd8b200, 1243 0x047e6eb2,
1253 0x60f90487, 1244 0xd8b20000,
1254 0xd0fc80f9, 1245 0xf90487fd,
1255 0x2e7ee0fc, 1246 0xfc80f960,
1256 0x77f10000, 1247 0x7ee0fcd0,
1257 0x73f1fffe, 1248 0x0700002d,
1258 0x6eb2ffff, 1249 0x7e6eb2fe,
1259 0x0000047e,
1260 0x87fdd8b2,
1261 0xf960f904,
1262 0xfcd0fc80,
1263 0x002e7ee0,
1264 0xf067f100,
1265 0x7e6eb226,
1266 0xb2000004, 1250 0xb2000004,
1267 0x0487fdd8, 1251 0x0487fdd8,
1268 0x80f960f9, 1252 0x80f960f9,
1269 0xe0fcd0fc, 1253 0xe0fcd0fc,
1270 0x00002e7e, 1254 0x00002d7e,
1271 0xe0400406, 1255 0x26f067f1,
1272 0x0006f607,
1273/* 0x04de: memx_func_enter_wait */
1274 0xc04604bd,
1275 0x0066cf07,
1276 0xf40464f0,
1277 0x2c06f70b,
1278 0xb50066cf,
1279 0x00f8f106,
1280/* 0x04f4: memx_func_leave */
1281 0x66cf2c06,
1282 0xf206b500,
1283 0xe4400406,
1284 0x0006f607,
1285/* 0x0506: memx_func_leave_wait */
1286 0xc04604bd,
1287 0x0066cf07,
1288 0xf40464f0,
1289 0x67f1f71b,
1290 0x77f126f0,
1291 0x73f00001,
1292 0x7e6eb200,
1293 0xb2000004,
1294 0x0587fdd8,
1295 0x80f960f9,
1296 0xe0fcd0fc,
1297 0x00002e7e,
1298 0x162067f1,
1299 0x047e6eb2, 1256 0x047e6eb2,
1300 0xd8b20000, 1257 0xd8b20000,
1301 0xf90587fd, 1258 0xf90487fd,
1302 0xfc80f960, 1259 0xfc80f960,
1303 0x7ee0fcd0, 1260 0x7ee0fcd0,
1304 0xf100002e, 1261 0x0600002d,
1305 0xf00aa277, 1262 0x07e04004,
1306 0x6eb20073, 1263 0xbd0006f6,
1264/* 0x04b9: memx_func_enter_wait */
1265 0x07c04604,
1266 0xf00066cf,
1267 0x0bf40464,
1268 0xcf2c06f7,
1269 0x06b50066,
1270/* 0x04cf: memx_func_leave */
1271 0x0600f8f1,
1272 0x0066cf2c,
1273 0x06f206b5,
1274 0x07e44004,
1275 0xbd0006f6,
1276/* 0x04e1: memx_func_leave_wait */
1277 0x07c04604,
1278 0xf00066cf,
1279 0x1bf40464,
1280 0xf067f1f7,
1281 0xb2010726,
1282 0x00047e6e,
1283 0xfdd8b200,
1284 0x60f90587,
1285 0xd0fc80f9,
1286 0x2d7ee0fc,
1287 0x67f10000,
1288 0x6eb21620,
1307 0x0000047e, 1289 0x0000047e,
1308 0x87fdd8b2, 1290 0x87fdd8b2,
1309 0xf960f905, 1291 0xf960f905,
1310 0xfcd0fc80, 1292 0xfcd0fc80,
1311 0x002e7ee0, 1293 0x002d7ee0,
1312/* 0x056f: memx_func_wait_vblank */ 1294 0x0aa24700,
1313 0xb600f800, 1295 0x047e6eb2,
1314 0x00f80410, 1296 0xd8b20000,
1315/* 0x0574: memx_func_wr32 */ 1297 0xf90587fd,
1316 0x98001698, 1298 0xfc80f960,
1317 0x10b60115, 1299 0x7ee0fcd0,
1318 0xf960f908, 1300 0xf800002d,
1319 0xfcd0fc50, 1301/* 0x0541: memx_func_wait_vblank */
1320 0x002e7ee0, 1302 0x0410b600,
1321 0x0242b600, 1303/* 0x0546: memx_func_wr32 */
1322 0xf8e81bf4, 1304 0x169800f8,
1323/* 0x0591: memx_func_wait */ 1305 0x01159800,
1324 0xcf2c0800, 1306 0xf90810b6,
1325 0x1e980088, 1307 0xfc50f960,
1326 0x011d9800, 1308 0x7ee0fcd0,
1327 0x98021c98, 1309 0xb600002d,
1328 0x10b6031b, 1310 0x1bf40242,
1329 0x00797e10, 1311/* 0x0563: memx_func_wait */
1330/* 0x05ab: memx_func_delay */ 1312 0x0800f8e8,
1331 0x9800f800, 1313 0x0088cf2c,
1332 0x10b6001e, 1314 0x98001e98,
1333 0x005d7e04, 1315 0x1c98011d,
1334/* 0x05b7: memx_func_train */ 1316 0x031b9802,
1335 0xf800f800, 1317 0x7e1010b6,
1336/* 0x05b9: memx_exec */ 1318 0xf8000074,
1337 0xf9e0f900, 1319/* 0x057d: memx_func_delay */
1338 0xb2c1b2d0, 1320 0x001e9800,
1339/* 0x05c1: memx_exec_next */ 1321 0x7e0410b6,
1340 0x001398b2, 1322 0xf8000058,
1341 0xe70410b6, 1323/* 0x0589: memx_func_train */
1342 0xe701f034, 1324/* 0x058b: memx_exec */
1343 0xb601e033, 1325 0xf900f800,
1344 0x30f00132, 1326 0xb2d0f9e0,
1345 0xde35980c, 1327/* 0x0593: memx_exec_next */
1346 0x12a655f9, 1328 0x98b2b2c1,
1347 0x98e51ef4, 1329 0x10b60013,
1348 0x0c98f10b, 1330 0xf034e704,
1349 0x02cbbbf2, 1331 0xe033e701,
1350 0xcf07c44b, 1332 0x0132b601,
1351 0xd0fc00bb, 1333 0x980c30f0,
1352 0xb67ee0fc, 1334 0x55f9de35,
1353 0x00f80002, 1335 0x1ef412a6,
1354/* 0x05f8: memx_info */ 1336 0xf10b98e5,
1355 0xf401c670, 1337 0xbbf20c98,
1356/* 0x05fe: memx_info_data */ 1338 0xc44b02cb,
1357 0xcc4c0c0b, 1339 0x00bbcf07,
1358 0x08004b03, 1340 0xe0fcd0fc,
1359/* 0x0607: memx_info_train */ 1341 0x00029f7e,
1360 0x4c090ef4, 1342/* 0x05ca: memx_info */
1361 0x004b0bcc, 1343 0xc67000f8,
1362/* 0x060d: memx_info_send */ 1344 0x0c0bf401,
1363 0x02b67e01, 1345/* 0x05d0: memx_info_data */
1364/* 0x0613: memx_recv */ 1346 0x4b03cc4c,
1365 0xb000f800, 1347 0x0ef40800,
1366 0x0bf401d6, 1348/* 0x05d9: memx_info_train */
1367 0x00d6b0a3, 1349 0x0bcc4c09,
1368 0xf8dc0bf4, 1350/* 0x05df: memx_info_send */
1369/* 0x0621: memx_init */ 1351 0x7e01004b,
1370/* 0x0623: perf_recv */ 1352 0xf800029f,
1353/* 0x05e5: memx_recv */
1354 0x01d6b000,
1355 0xb0a30bf4,
1356 0x0bf400d6,
1357/* 0x05f3: memx_init */
1358 0xf800f8dc,
1359/* 0x05f5: perf_recv */
1360/* 0x05f7: perf_init */
1371 0xf800f800, 1361 0xf800f800,
1372/* 0x0625: perf_init */ 1362/* 0x05f9: i2c_drive_scl */
1373/* 0x0627: i2c_drive_scl */
1374 0xb000f800,
1375 0x0bf40036,
1376 0x07e0400d,
1377 0xbd0001f6,
1378/* 0x0637: i2c_drive_scl_lo */
1379 0x4000f804,
1380 0x01f607e4,
1381 0xf804bd00,
1382/* 0x0641: i2c_drive_sda */
1383 0x0036b000, 1363 0x0036b000,
1384 0x400d0bf4, 1364 0x400d0bf4,
1385 0x02f607e0, 1365 0x01f607e0,
1386 0xf804bd00, 1366 0xf804bd00,
1387/* 0x0651: i2c_drive_sda_lo */ 1367/* 0x0609: i2c_drive_scl_lo */
1388 0x07e44000, 1368 0x07e44000,
1369 0xbd0001f6,
1370/* 0x0613: i2c_drive_sda */
1371 0xb000f804,
1372 0x0bf40036,
1373 0x07e0400d,
1389 0xbd0002f6, 1374 0xbd0002f6,
1390/* 0x065b: i2c_sense_scl */ 1375/* 0x0623: i2c_drive_sda_lo */
1391 0xf400f804, 1376 0x4000f804,
1392 0xc4430132, 1377 0x02f607e4,
1393 0x0033cf07, 1378 0xf804bd00,
1394 0xf40431fd, 1379/* 0x062d: i2c_sense_scl */
1395 0x31f4060b, 1380 0x0132f400,
1396/* 0x066d: i2c_sense_scl_done */ 1381 0xcf07c443,
1397/* 0x066f: i2c_sense_sda */ 1382 0x31fd0033,
1398 0xf400f801, 1383 0x060bf404,
1399 0xc4430132, 1384/* 0x063f: i2c_sense_scl_done */
1400 0x0033cf07, 1385 0xf80131f4,
1401 0xf40432fd, 1386/* 0x0641: i2c_sense_sda */
1402 0x31f4060b, 1387 0x0132f400,
1403/* 0x0681: i2c_sense_sda_done */ 1388 0xcf07c443,
1404/* 0x0683: i2c_raise_scl */ 1389 0x32fd0033,
1405 0xf900f801, 1390 0x060bf404,
1406 0x08984440, 1391/* 0x0653: i2c_sense_sda_done */
1407 0x277e0103, 1392 0xf80131f4,
1408/* 0x068e: i2c_raise_scl_wait */ 1393/* 0x0655: i2c_raise_scl */
1409 0xe84e0006, 1394 0x4440f900,
1410 0x005d7e03, 1395 0x01030898,
1411 0x065b7e00, 1396 0x0005f97e,
1412 0x0901f400, 1397/* 0x0660: i2c_raise_scl_wait */
1413 0xf40142b6, 1398 0x7e03e84e,
1414/* 0x06a2: i2c_raise_scl_done */ 1399 0x7e000058,
1415 0x40fcef1b, 1400 0xf400062d,
1416/* 0x06a6: i2c_start */ 1401 0x42b60901,
1417 0x5b7e00f8, 1402 0xef1bf401,
1418 0x11f40006, 1403/* 0x0674: i2c_raise_scl_done */
1419 0x066f7e0d, 1404 0x00f840fc,
1420 0x0611f400, 1405/* 0x0678: i2c_start */
1421/* 0x06b7: i2c_start_rep */ 1406 0x00062d7e,
1422 0x032e0ef4, 1407 0x7e0d11f4,
1423 0x06277e00, 1408 0xf4000641,
1424 0x7e010300, 1409 0x0ef40611,
1425 0xbb000641, 1410/* 0x0689: i2c_start_rep */
1426 0x65b60076, 1411 0x7e00032e,
1427 0x9450f904, 1412 0x030005f9,
1428 0x56bb0465, 1413 0x06137e01,
1429 0xfd50bd02, 1414 0x0076bb00,
1430 0x50fc0475, 1415 0xf90465b6,
1431 0x0006837e, 1416 0x04659450,
1432 0xf40464b6, 1417 0xbd0256bb,
1433/* 0x06e2: i2c_start_send */ 1418 0x0475fd50,
1434 0x00031d11, 1419 0x557e50fc,
1435 0x0006417e, 1420 0x64b60006,
1436 0x7e13884e, 1421 0x1d11f404,
1437 0x0300005d, 1422/* 0x06b4: i2c_start_send */
1438 0x06277e00, 1423 0x137e0003,
1424 0x884e0006,
1425 0x00587e13,
1426 0x7e000300,
1427 0x4e0005f9,
1428 0x587e1388,
1429/* 0x06ce: i2c_start_out */
1430 0x00f80000,
1431/* 0x06d0: i2c_stop */
1432 0xf97e0003,
1433 0x00030005,
1434 0x0006137e,
1435 0x7e03e84e,
1436 0x03000058,
1437 0x05f97e01,
1439 0x13884e00, 1438 0x13884e00,
1440 0x00005d7e, 1439 0x0000587e,
1441/* 0x06fc: i2c_start_out */ 1440 0x137e0103,
1442/* 0x06fe: i2c_stop */ 1441 0x884e0006,
1443 0x000300f8, 1442 0x00587e13,
1444 0x0006277e, 1443/* 0x06ff: i2c_bitw */
1445 0x417e0003, 1444 0x7e00f800,
1446 0xe84e0006, 1445 0x4e000613,
1447 0x005d7e03, 1446 0x587e03e8,
1448 0x7e010300,
1449 0x4e000627,
1450 0x5d7e1388,
1451 0x01030000,
1452 0x0006417e,
1453 0x7e13884e,
1454 0xf800005d,
1455/* 0x072d: i2c_bitw */
1456 0x06417e00,
1457 0x03e84e00,
1458 0x00005d7e,
1459 0xb60076bb,
1460 0x50f90465,
1461 0xbb046594,
1462 0x50bd0256,
1463 0xfc0475fd,
1464 0x06837e50,
1465 0x0464b600,
1466 0x4e1711f4,
1467 0x5d7e1388,
1468 0x00030000,
1469 0x0006277e,
1470 0x7e13884e,
1471/* 0x076b: i2c_bitw_out */
1472 0xf800005d,
1473/* 0x076d: i2c_bitr */
1474 0x7e010300,
1475 0x4e000641,
1476 0x5d7e03e8,
1477 0x76bb0000, 1447 0x76bb0000,
1478 0x0465b600, 1448 0x0465b600,
1479 0x659450f9, 1449 0x659450f9,
1480 0x0256bb04, 1450 0x0256bb04,
1481 0x75fd50bd, 1451 0x75fd50bd,
1482 0x7e50fc04, 1452 0x7e50fc04,
1483 0xb6000683, 1453 0xb6000655,
1484 0x11f40464, 1454 0x11f40464,
1485 0x066f7e1a, 1455 0x13884e17,
1486 0x7e000300, 1456 0x0000587e,
1487 0x4e000627, 1457 0xf97e0003,
1488 0x5d7e1388, 1458 0x884e0005,
1489 0x3cf00000, 1459 0x00587e13,
1490 0x0131f401, 1460/* 0x073d: i2c_bitw_out */
1491/* 0x07b0: i2c_bitr_done */ 1461/* 0x073f: i2c_bitr */
1492/* 0x07b2: i2c_get_byte */ 1462 0x0300f800,
1493 0x000500f8, 1463 0x06137e01,
1494/* 0x07b6: i2c_get_byte_next */ 1464 0x03e84e00,
1495 0x54b60804, 1465 0x0000587e,
1496 0x0076bb01, 1466 0xb60076bb,
1497 0xf90465b6, 1467 0x50f90465,
1498 0x04659450, 1468 0xbb046594,
1499 0xbd0256bb, 1469 0x50bd0256,
1500 0x0475fd50, 1470 0xfc0475fd,
1501 0x6d7e50fc, 1471 0x06557e50,
1502 0x64b60007, 1472 0x0464b600,
1503 0x2a11f404, 1473 0x7e1a11f4,
1504 0xb60553fd, 1474 0x03000641,
1505 0x1bf40142, 1475 0x05f97e00,
1506 0xbb0103d8, 1476 0x13884e00,
1477 0x0000587e,
1478 0xf4013cf0,
1479/* 0x0782: i2c_bitr_done */
1480 0x00f80131,
1481/* 0x0784: i2c_get_byte */
1482 0x08040005,
1483/* 0x0788: i2c_get_byte_next */
1484 0xbb0154b6,
1507 0x65b60076, 1485 0x65b60076,
1508 0x9450f904, 1486 0x9450f904,
1509 0x56bb0465, 1487 0x56bb0465,
1510 0xfd50bd02, 1488 0xfd50bd02,
1511 0x50fc0475, 1489 0x50fc0475,
1512 0x00072d7e, 1490 0x00073f7e,
1513/* 0x07ff: i2c_get_byte_done */ 1491 0xf40464b6,
1514 0xf80464b6, 1492 0x53fd2a11,
1515/* 0x0801: i2c_put_byte */ 1493 0x0142b605,
1516/* 0x0803: i2c_put_byte_next */ 1494 0x03d81bf4,
1517 0xb6080400, 1495 0x0076bb01,
1518 0x54ff0142,
1519 0x0076bb38,
1520 0xf90465b6, 1496 0xf90465b6,
1521 0x04659450, 1497 0x04659450,
1522 0xbd0256bb, 1498 0xbd0256bb,
1523 0x0475fd50, 1499 0x0475fd50,
1524 0x2d7e50fc, 1500 0xff7e50fc,
1525 0x64b60007, 1501 0x64b60006,
1526 0x3411f404, 1502/* 0x07d1: i2c_get_byte_done */
1527 0xf40046b0, 1503/* 0x07d3: i2c_put_byte */
1528 0x76bbd81b, 1504 0x0400f804,
1529 0x0465b600, 1505/* 0x07d5: i2c_put_byte_next */
1530 0x659450f9, 1506 0x0142b608,
1531 0x0256bb04, 1507 0xbb3854ff,
1532 0x75fd50bd,
1533 0x7e50fc04,
1534 0xb600076d,
1535 0x11f40464,
1536 0x0076bb0f,
1537 0xf40136b0,
1538 0x32f4061b,
1539/* 0x0859: i2c_put_byte_done */
1540/* 0x085b: i2c_addr */
1541 0xbb00f801,
1542 0x65b60076, 1508 0x65b60076,
1543 0x9450f904, 1509 0x9450f904,
1544 0x56bb0465, 1510 0x56bb0465,
1545 0xfd50bd02, 1511 0xfd50bd02,
1546 0x50fc0475, 1512 0x50fc0475,
1547 0x0006a67e, 1513 0x0006ff7e,
1548 0xf40464b6, 1514 0xf40464b6,
1549 0xc3e72911, 1515 0x46b03411,
1550 0x34b6012e, 1516 0xd81bf400,
1551 0x0553fd01,
1552 0xb60076bb,
1553 0x50f90465,
1554 0xbb046594,
1555 0x50bd0256,
1556 0xfc0475fd,
1557 0x08017e50,
1558 0x0464b600,
1559/* 0x08a0: i2c_addr_done */
1560/* 0x08a2: i2c_acquire_addr */
1561 0xcec700f8,
1562 0x05e4b6f8,
1563 0xd014e0b7,
1564/* 0x08ae: i2c_acquire */
1565 0xa27e00f8,
1566 0x047e0008,
1567 0xd9f00000,
1568 0x002e7e03,
1569/* 0x08bf: i2c_release */
1570 0x7e00f800,
1571 0x7e0008a2,
1572 0xf0000004,
1573 0x2e7e03da,
1574 0x00f80000,
1575/* 0x08d0: i2c_recv */
1576 0xc70132f4,
1577 0x14b6f8c1,
1578 0x2816b002,
1579 0x01371ff5,
1580 0x0cf413b8,
1581 0x00329800,
1582 0x0ccc13b8,
1583 0x00319800,
1584 0xf90231f4,
1585 0xf9e0f9d0,
1586 0x0067f1d0,
1587 0x0063f100,
1588 0x01679210,
1589 0xb60076bb, 1517 0xb60076bb,
1590 0x50f90465, 1518 0x50f90465,
1591 0xbb046594, 1519 0xbb046594,
1592 0x50bd0256, 1520 0x50bd0256,
1593 0xfc0475fd, 1521 0xfc0475fd,
1594 0x08ae7e50, 1522 0x073f7e50,
1595 0x0464b600, 1523 0x0464b600,
1596 0xd6b0d0fc, 1524 0xbb0f11f4,
1597 0xb01bf500, 1525 0x36b00076,
1598 0xbb000500, 1526 0x061bf401,
1527/* 0x082b: i2c_put_byte_done */
1528 0xf80132f4,
1529/* 0x082d: i2c_addr */
1530 0x0076bb00,
1531 0xf90465b6,
1532 0x04659450,
1533 0xbd0256bb,
1534 0x0475fd50,
1535 0x787e50fc,
1536 0x64b60006,
1537 0x2911f404,
1538 0x012ec3e7,
1539 0xfd0134b6,
1540 0x76bb0553,
1541 0x0465b600,
1542 0x659450f9,
1543 0x0256bb04,
1544 0x75fd50bd,
1545 0x7e50fc04,
1546 0xb60007d3,
1547/* 0x0872: i2c_addr_done */
1548 0x00f80464,
1549/* 0x0874: i2c_acquire_addr */
1550 0xb6f8cec7,
1551 0xe0b705e4,
1552 0x00f8d014,
1553/* 0x0880: i2c_acquire */
1554 0x0008747e,
1555 0x0000047e,
1556 0x7e03d9f0,
1557 0xf800002d,
1558/* 0x0891: i2c_release */
1559 0x08747e00,
1560 0x00047e00,
1561 0x03daf000,
1562 0x00002d7e,
1563/* 0x08a2: i2c_recv */
1564 0x32f400f8,
1565 0xf8c1c701,
1566 0xb00214b6,
1567 0x1ff52816,
1568 0x13b80134,
1569 0x98000cf4,
1570 0x13b80032,
1571 0x98000ccc,
1572 0x31f40031,
1573 0xf9d0f902,
1574 0xd6d0f9e0,
1575 0x10000000,
1576 0xbb016792,
1599 0x65b60076, 1577 0x65b60076,
1600 0x9450f904, 1578 0x9450f904,
1601 0x56bb0465, 1579 0x56bb0465,
1602 0xfd50bd02, 1580 0xfd50bd02,
1603 0x50fc0475, 1581 0x50fc0475,
1604 0x00085b7e, 1582 0x0008807e,
1605 0xf50464b6, 1583 0xfc0464b6,
1606 0xc700cc11, 1584 0x00d6b0d0,
1607 0x76bbe0c5, 1585 0x00b01bf5,
1586 0x76bb0005,
1608 0x0465b600, 1587 0x0465b600,
1609 0x659450f9, 1588 0x659450f9,
1610 0x0256bb04, 1589 0x0256bb04,
1611 0x75fd50bd, 1590 0x75fd50bd,
1612 0x7e50fc04, 1591 0x7e50fc04,
1613 0xb6000801, 1592 0xb600082d,
1614 0x11f50464, 1593 0x11f50464,
1615 0x010500a9, 1594 0xc5c700cc,
1616 0xb60076bb, 1595 0x0076bbe0,
1617 0x50f90465, 1596 0xf90465b6,
1618 0xbb046594, 1597 0x04659450,
1619 0x50bd0256, 1598 0xbd0256bb,
1620 0xfc0475fd, 1599 0x0475fd50,
1621 0x085b7e50, 1600 0xd37e50fc,
1622 0x0464b600, 1601 0x64b60007,
1623 0x008711f5, 1602 0xa911f504,
1624 0xb60076bb, 1603 0xbb010500,
1625 0x50f90465, 1604 0x65b60076,
1626 0xbb046594, 1605 0x9450f904,
1627 0x50bd0256, 1606 0x56bb0465,
1628 0xfc0475fd, 1607 0xfd50bd02,
1629 0x07b27e50, 1608 0x50fc0475,
1630 0x0464b600, 1609 0x00082d7e,
1631 0xcb6711f4, 1610 0xf50464b6,
1632 0x76bbe05b, 1611 0xbb008711,
1633 0x0465b600, 1612 0x65b60076,
1634 0x659450f9, 1613 0x9450f904,
1635 0x0256bb04, 1614 0x56bb0465,
1636 0x75fd50bd, 1615 0xfd50bd02,
1637 0x7e50fc04, 1616 0x50fc0475,
1638 0xb60006fe, 1617 0x0007847e,
1639 0x5bb20464, 1618 0xf40464b6,
1640 0x0ef474bd, 1619 0x5bcb6711,
1641/* 0x09d5: i2c_recv_not_rd08 */ 1620 0x0076bbe0,
1642 0x01d6b041, 1621 0xf90465b6,
1643 0x053b1bf4, 1622 0x04659450,
1644 0x085b7e00, 1623 0xbd0256bb,
1645 0x3211f400, 1624 0x0475fd50,
1646 0x7ee0c5c7, 1625 0xd07e50fc,
1647 0xf4000801, 1626 0x64b60006,
1648 0x00052811, 1627 0xbd5bb204,
1649 0x00085b7e, 1628 0x410ef474,
1650 0xc71f11f4, 1629/* 0x09a4: i2c_recv_not_rd08 */
1651 0x017ee0b5, 1630 0xf401d6b0,
1652 0x11f40008, 1631 0x00053b1b,
1653 0x06fe7e15, 1632 0x00082d7e,
1654 0xc774bd00, 1633 0xc73211f4,
1655 0x1bf408c5, 1634 0xd37ee0c5,
1656 0x0232f409, 1635 0x11f40007,
1657/* 0x0a13: i2c_recv_not_wr08 */ 1636 0x7e000528,
1658/* 0x0a13: i2c_recv_done */ 1637 0xf400082d,
1659 0xc7030ef4, 1638 0xb5c71f11,
1660 0xbf7ef8ce, 1639 0x07d37ee0,
1661 0xe0fc0008, 1640 0x1511f400,
1662 0x12f4d0fc, 1641 0x0006d07e,
1663 0x7e7cb209, 1642 0xc5c774bd,
1664/* 0x0a27: i2c_recv_exit */ 1643 0x091bf408,
1665 0xf80002b6, 1644 0xf40232f4,
1666/* 0x0a29: i2c_init */ 1645/* 0x09e2: i2c_recv_not_wr08 */
1667/* 0x0a2b: test_recv */ 1646/* 0x09e2: i2c_recv_done */
1668 0x4100f800, 1647 0xcec7030e,
1669 0x11cf0458, 1648 0x08917ef8,
1670 0x0110b600, 1649 0xfce0fc00,
1671 0xf6045840, 1650 0x0912f4d0,
1672 0x04bd0001, 1651 0x9f7e7cb2,
1673 0xd900e7f1, 1652/* 0x09f6: i2c_recv_exit */
1674 0x134fe3f1, 1653 0x00f80002,
1675 0x0001f57e, 1654/* 0x09f8: i2c_init */
1676/* 0x0a4a: test_init */ 1655/* 0x09fa: test_recv */
1656 0x584100f8,
1657 0x0011cf04,
1658 0x400110b6,
1659 0x01f60458,
1660 0xde04bd00,
1661 0x134fd900,
1662 0x0001de7e,
1663/* 0x0a16: test_init */
1677 0x004e00f8, 1664 0x004e00f8,
1678 0x01f57e08, 1665 0x01de7e08,
1679/* 0x0a53: idle_recv */ 1666/* 0x0a1f: idle_recv */
1680 0xf800f800, 1667 0xf800f800,
1681/* 0x0a55: idle */ 1668/* 0x0a21: idle */
1682 0x0031f400, 1669 0x0031f400,
1683 0xcf045441, 1670 0xcf045441,
1684 0x10b60011, 1671 0x10b60011,
1685 0x04544001, 1672 0x04544001,
1686 0xbd0001f6, 1673 0xbd0001f6,
1687/* 0x0a69: idle_loop */ 1674/* 0x0a35: idle_loop */
1688 0xf4580104, 1675 0xf4580104,
1689/* 0x0a6e: idle_proc */ 1676/* 0x0a3a: idle_proc */
1690/* 0x0a6e: idle_proc_exec */ 1677/* 0x0a3a: idle_proc_exec */
1691 0x10f90232, 1678 0x10f90232,
1692 0xbf7e1eb2, 1679 0xa87e1eb2,
1693 0x10fc0002, 1680 0x10fc0002,
1694 0xf40911f4, 1681 0xf40911f4,
1695 0x0ef40231, 1682 0x0ef40231,
1696/* 0x0a81: idle_proc_next */ 1683/* 0x0a4d: idle_proc_next */
1697 0x5810b6f0, 1684 0x5810b6f0,
1698 0x1bf41fa6, 1685 0x1bf41fa6,
1699 0xe002f4e8, 1686 0xe002f4e8,
@@ -1726,4 +1713,17 @@ uint32_t gk208_pmu_code[] = {
1726 0x00000000, 1713 0x00000000,
1727 0x00000000, 1714 0x00000000,
1728 0x00000000, 1715 0x00000000,
1716 0x00000000,
1717 0x00000000,
1718 0x00000000,
1719 0x00000000,
1720 0x00000000,
1721 0x00000000,
1722 0x00000000,
1723 0x00000000,
1724 0x00000000,
1725 0x00000000,
1726 0x00000000,
1727 0x00000000,
1728 0x00000000,
1729}; 1729};
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gt215.fuc3.h b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gt215.fuc3.h
index 516569270bac..e83341815ec6 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gt215.fuc3.h
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gt215.fuc3.h
@@ -24,8 +24,8 @@ uint32_t gt215_pmu_data[] = {
24 0x00000000, 24 0x00000000,
25/* 0x0058: proc_list_head */ 25/* 0x0058: proc_list_head */
26 0x54534f48, 26 0x54534f48,
27 0x00000507, 27 0x0000050a,
28 0x000004a4, 28 0x000004a7,
29 0x00000000, 29 0x00000000,
30 0x00000000, 30 0x00000000,
31 0x00000000, 31 0x00000000,
@@ -46,8 +46,8 @@ uint32_t gt215_pmu_data[] = {
46 0x00000000, 46 0x00000000,
47 0x00000000, 47 0x00000000,
48 0x584d454d, 48 0x584d454d,
49 0x00000837, 49 0x0000083a,
50 0x00000829, 50 0x0000082c,
51 0x00000000, 51 0x00000000,
52 0x00000000, 52 0x00000000,
53 0x00000000, 53 0x00000000,
@@ -68,8 +68,8 @@ uint32_t gt215_pmu_data[] = {
68 0x00000000, 68 0x00000000,
69 0x00000000, 69 0x00000000,
70 0x46524550, 70 0x46524550,
71 0x0000083b, 71 0x0000083e,
72 0x00000839, 72 0x0000083c,
73 0x00000000, 73 0x00000000,
74 0x00000000, 74 0x00000000,
75 0x00000000, 75 0x00000000,
@@ -90,8 +90,8 @@ uint32_t gt215_pmu_data[] = {
90 0x00000000, 90 0x00000000,
91 0x00000000, 91 0x00000000,
92 0x5f433249, 92 0x5f433249,
93 0x00000c6b, 93 0x00000c6e,
94 0x00000b0e, 94 0x00000b11,
95 0x00000000, 95 0x00000000,
96 0x00000000, 96 0x00000000,
97 0x00000000, 97 0x00000000,
@@ -112,8 +112,8 @@ uint32_t gt215_pmu_data[] = {
112 0x00000000, 112 0x00000000,
113 0x00000000, 113 0x00000000,
114 0x54534554, 114 0x54534554,
115 0x00000c94, 115 0x00000c97,
116 0x00000c6d, 116 0x00000c70,
117 0x00000000, 117 0x00000000,
118 0x00000000, 118 0x00000000,
119 0x00000000, 119 0x00000000,
@@ -134,8 +134,8 @@ uint32_t gt215_pmu_data[] = {
134 0x00000000, 134 0x00000000,
135 0x00000000, 135 0x00000000,
136 0x454c4449, 136 0x454c4449,
137 0x00000ca0, 137 0x00000ca3,
138 0x00000c9e, 138 0x00000ca1,
139 0x00000000, 139 0x00000000,
140 0x00000000, 140 0x00000000,
141 0x00000000, 141 0x00000000,
@@ -229,26 +229,26 @@ uint32_t gt215_pmu_data[] = {
229/* 0x0370: memx_func_head */ 229/* 0x0370: memx_func_head */
230 0x00000001, 230 0x00000001,
231 0x00000000, 231 0x00000000,
232 0x00000546, 232 0x00000549,
233/* 0x037c: memx_func_next */ 233/* 0x037c: memx_func_next */
234 0x00000002, 234 0x00000002,
235 0x00000000, 235 0x00000000,
236 0x0000059d, 236 0x000005a0,
237 0x00000003, 237 0x00000003,
238 0x00000002, 238 0x00000002,
239 0x0000062f, 239 0x00000632,
240 0x00040004, 240 0x00040004,
241 0x00000000, 241 0x00000000,
242 0x0000064b, 242 0x0000064e,
243 0x00010005, 243 0x00010005,
244 0x00000000, 244 0x00000000,
245 0x00000668, 245 0x0000066b,
246 0x00010006, 246 0x00010006,
247 0x00000000, 247 0x00000000,
248 0x000005ed, 248 0x000005f0,
249 0x00000007, 249 0x00000007,
250 0x00000000, 250 0x00000000,
251 0x00000673, 251 0x00000676,
252/* 0x03c4: memx_func_tail */ 252/* 0x03c4: memx_func_tail */
253/* 0x03c4: memx_ts_start */ 253/* 0x03c4: memx_ts_start */
254 0x00000000, 254 0x00000000,
@@ -917,947 +917,947 @@ uint32_t gt215_pmu_data[] = {
917}; 917};
918 918
919uint32_t gt215_pmu_code[] = { 919uint32_t gt215_pmu_code[] = {
920 0x03930ef5, 920 0x03920ef5,
921/* 0x0004: rd32 */ 921/* 0x0004: rd32 */
922 0x07a007f1, 922 0x07a007f1,
923 0xd00604b6, 923 0xd00604b6,
924 0x04bd000e, 924 0x04bd000e,
925 0xf001d7f0, 925 0x0001d7f1,
926 0x07f101d3, 926 0xf101d3f0,
927 0x04b607ac, 927 0xb607ac07,
928 0x000dd006,
929/* 0x0022: rd32_wait */
930 0xd7f104bd,
931 0xd4b607ac,
932 0x00ddcf06,
933 0x7000d4f1,
934 0xf1f21bf4,
935 0xb607a4d7,
936 0xddcf06d4,
937/* 0x003f: wr32 */
938 0xf100f800,
939 0xb607a007,
940 0x0ed00604,
941 0xf104bd00,
942 0xb607a407,
943 0x0dd00604, 928 0x0dd00604,
944 0xf004bd00, 929/* 0x0023: rd32_wait */
945 0xd5f002d7, 930 0xf104bd00,
946 0x01d3f0f0, 931 0xb607acd7,
947 0x07ac07f1, 932 0xddcf06d4,
933 0x00d4f100,
934 0xf21bf470,
935 0x07a4d7f1,
936 0xcf06d4b6,
937 0x00f800dd,
938/* 0x0040: wr32 */
939 0x07a007f1,
940 0xd00604b6,
941 0x04bd000e,
942 0x07a407f1,
948 0xd00604b6, 943 0xd00604b6,
949 0x04bd000d, 944 0x04bd000d,
950/* 0x006c: wr32_wait */ 945 0x00f2d7f1,
951 0x07acd7f1, 946 0xf101d3f0,
952 0xcf06d4b6, 947 0xb607ac07,
953 0xd4f100dd, 948 0x0dd00604,
954 0x1bf47000, 949/* 0x006b: wr32_wait */
955/* 0x007f: nsec */ 950 0xf104bd00,
956 0xf900f8f2, 951 0xb607acd7,
957 0xf080f990, 952 0xddcf06d4,
958 0x84b62c87, 953 0x00d4f100,
959 0x0088cf06, 954 0xf21bf470,
960/* 0x008c: nsec_loop */ 955/* 0x007e: nsec */
961 0xb62c97f0, 956 0x90f900f8,
962 0x99cf0694, 957 0x87f080f9,
963 0x0298bb00, 958 0x0684b62c,
964 0xf4069eb8, 959/* 0x008b: nsec_loop */
965 0x80fcf11e, 960 0xf00088cf,
966 0x00f890fc,
967/* 0x00a4: wait */
968 0x80f990f9,
969 0xb62c87f0,
970 0x88cf0684,
971/* 0x00b1: wait_loop */
972 0x02eeb900,
973 0xb90421f4,
974 0xadfd02da,
975 0x06acb804,
976 0xf0150bf4,
977 0x94b62c97, 961 0x94b62c97,
978 0x0099cf06, 962 0x0099cf06,
979 0xb80298bb, 963 0xb80298bb,
980 0x1ef4069b, 964 0x1ef4069e,
981/* 0x00d5: wait_done */ 965 0xfc80fcf1,
982 0xfc80fcdf, 966/* 0x00a3: wait */
983/* 0x00db: intr_watchdog */ 967 0xf900f890,
984 0x9800f890, 968 0xf080f990,
985 0x96b003e9, 969 0x84b62c87,
986 0x2a0bf400,
987 0xbb9a0a98,
988 0x1cf4029a,
989 0x01d7f00f,
990 0x02d221f5,
991 0x0ef494bd,
992/* 0x00f9: intr_watchdog_next_time */
993 0x9b0a9815,
994 0xf400a6b0,
995 0x9ab8090b,
996 0x061cf406,
997/* 0x0108: intr_watchdog_next_time_set */
998/* 0x010b: intr_watchdog_next_proc */
999 0x809b0980,
1000 0xe0b603e9,
1001 0x68e6b158,
1002 0xc61bf402,
1003/* 0x011a: intr */
1004 0x00f900f8,
1005 0x80f904bd,
1006 0xa0f990f9,
1007 0xc0f9b0f9,
1008 0xe0f9d0f9,
1009 0xf7f0f0f9,
1010 0x0188fe00,
1011 0x87f180f9,
1012 0x84b605d0,
1013 0x0088cf06, 970 0x0088cf06,
1014 0xf10180b6, 971/* 0x00b0: wait_loop */
1015 0xb605d007, 972 0xf402eeb9,
973 0xdab90421,
974 0x04adfd02,
975 0xf406acb8,
976 0x97f0150b,
977 0x0694b62c,
978 0xbb0099cf,
979 0x9bb80298,
980 0xdf1ef406,
981/* 0x00d4: wait_done */
982 0x90fc80fc,
983/* 0x00da: intr_watchdog */
984 0xe99800f8,
985 0x0096b003,
986 0x982a0bf4,
987 0x9abb9a0a,
988 0x0f1cf402,
989 0xf501d7f0,
990 0xbd02d121,
991 0x150ef494,
992/* 0x00f8: intr_watchdog_next_time */
993 0xb09b0a98,
994 0x0bf400a6,
995 0x069ab809,
996/* 0x0107: intr_watchdog_next_time_set */
997 0x80061cf4,
998/* 0x010a: intr_watchdog_next_proc */
999 0xe9809b09,
1000 0x58e0b603,
1001 0x0268e6b1,
1002 0xf8c61bf4,
1003/* 0x0119: intr */
1004 0xbd00f900,
1005 0xf980f904,
1006 0xf9a0f990,
1007 0xf9c0f9b0,
1008 0xf9e0f9d0,
1009 0x00f7f0f0,
1010 0xf90188fe,
1011 0xd087f180,
1012 0x0684b605,
1013 0xb60088cf,
1014 0x07f10180,
1015 0x04b605d0,
1016 0x0008d006,
1017 0x87f004bd,
1018 0x0684b608,
1019 0xc40088cf,
1020 0x0bf40289,
1021 0x9b008023,
1022 0xf458e7f0,
1023 0x0998da21,
1024 0x0096b09b,
1025 0xf0110bf4,
1026 0x04b63407,
1027 0x0009d006,
1028 0x098004bd,
1029/* 0x017d: intr_skip_watchdog */
1030 0x0089e49a,
1031 0x480bf408,
1032 0x068897f1,
1033 0xcf0694b6,
1034 0x9ac40099,
1035 0x2c0bf402,
1036 0x04c0c7f1,
1037 0xcf06c4b6,
1038 0xc0f900cc,
1039 0x4f48e7f1,
1040 0x5453e3f1,
1041 0xf500d7f0,
1042 0xfc033621,
1043 0xc007f1c0,
1044 0x0604b604,
1045 0xbd000cd0,
1046/* 0x01bd: intr_subintr_skip_fifo */
1047 0x8807f104,
1048 0x0604b606,
1049 0xbd0009d0,
1050/* 0x01c9: intr_skip_subintr */
1051 0xe097f104,
1052 0xfd90bd00,
1053 0x07f00489,
1054 0x0604b604,
1055 0xbd0008d0,
1056 0xfe80fc04,
1057 0xf0fc0088,
1058 0xd0fce0fc,
1059 0xb0fcc0fc,
1060 0x90fca0fc,
1061 0x00fc80fc,
1062 0xf80032f4,
1063/* 0x01f9: ticks_from_ns */
1064 0xf9c0f901,
1065 0xcbd7f1b0,
1066 0x00d3f000,
1067 0x040b21f5,
1068 0x03e8ccec,
1069 0xf400b4b0,
1070 0xeeec120b,
1071 0xd7f103e8,
1072 0xd3f000cb,
1073 0x0b21f500,
1074/* 0x0221: ticks_from_ns_quit */
1075 0x02ceb904,
1076 0xc0fcb0fc,
1077/* 0x022a: ticks_from_us */
1078 0xc0f900f8,
1079 0xd7f1b0f9,
1080 0xd3f000cb,
1081 0x0b21f500,
1082 0x02ceb904,
1083 0xf400b4b0,
1084 0xe4bd050b,
1085/* 0x0244: ticks_from_us_quit */
1086 0xc0fcb0fc,
1087/* 0x024a: ticks_to_us */
1088 0xd7f100f8,
1089 0xd3f000cb,
1090 0xecedff00,
1091/* 0x0256: timer */
1092 0x90f900f8,
1093 0x32f480f9,
1094 0x03f89810,
1095 0xf40086b0,
1096 0x84bd651c,
1097 0xb63807f0,
1016 0x08d00604, 1098 0x08d00604,
1017 0xf004bd00, 1099 0xf004bd00,
1018 0x84b60887, 1100 0x84b63487,
1019 0x0088cf06, 1101 0x0088cf06,
1020 0xf40289c4, 1102 0xbb9a0998,
1021 0x0080230b, 1103 0xe9bb0298,
1022 0x58e7f09b, 1104 0x03fe8000,
1023 0x98db21f4, 1105 0xb60887f0,
1024 0x96b09b09, 1106 0x88cf0684,
1025 0x110bf400, 1107 0x0284f000,
1108 0xf0261bf4,
1109 0x84b63487,
1110 0x0088cf06,
1111 0xf406e0b8,
1112 0xe8b8090b,
1113 0x111cf406,
1114/* 0x02ac: timer_reset */
1026 0xb63407f0, 1115 0xb63407f0,
1027 0x09d00604, 1116 0x0ed00604,
1028 0x8004bd00, 1117 0x8004bd00,
1029/* 0x017e: intr_skip_watchdog */ 1118/* 0x02ba: timer_enable */
1030 0x89e49a09, 1119 0x87f09a0e,
1031 0x0bf40800, 1120 0x3807f001,
1032 0x8897f148,
1033 0x0694b606,
1034 0xc40099cf,
1035 0x0bf4029a,
1036 0xc0c7f12c,
1037 0x06c4b604,
1038 0xf900cccf,
1039 0x48e7f1c0,
1040 0x53e3f14f,
1041 0x00d7f054,
1042 0x033721f5,
1043 0x07f1c0fc,
1044 0x04b604c0,
1045 0x000cd006,
1046/* 0x01be: intr_subintr_skip_fifo */
1047 0x07f104bd,
1048 0x04b60688,
1049 0x0009d006,
1050/* 0x01ca: intr_skip_subintr */
1051 0x97f104bd,
1052 0x90bd00e0,
1053 0xf00489fd,
1054 0x04b60407,
1055 0x0008d006,
1056 0x80fc04bd,
1057 0xfc0088fe,
1058 0xfce0fcf0,
1059 0xfcc0fcd0,
1060 0xfca0fcb0,
1061 0xfc80fc90,
1062 0x0032f400,
1063/* 0x01fa: ticks_from_ns */
1064 0xc0f901f8,
1065 0xd7f1b0f9,
1066 0xd3f000cb,
1067 0x0821f500,
1068 0xe8ccec04,
1069 0x00b4b003,
1070 0xec120bf4,
1071 0xf103e8ee,
1072 0xf000cbd7,
1073 0x21f500d3,
1074/* 0x0222: ticks_from_ns_quit */
1075 0xceb90408,
1076 0xfcb0fc02,
1077/* 0x022b: ticks_from_us */
1078 0xf900f8c0,
1079 0xf1b0f9c0,
1080 0xf000cbd7,
1081 0x21f500d3,
1082 0xceb90408,
1083 0x00b4b002,
1084 0xbd050bf4,
1085/* 0x0245: ticks_from_us_quit */
1086 0xfcb0fce4,
1087/* 0x024b: ticks_to_us */
1088 0xf100f8c0,
1089 0xf000cbd7,
1090 0xedff00d3,
1091/* 0x0257: timer */
1092 0xf900f8ec,
1093 0xf480f990,
1094 0xf8981032,
1095 0x0086b003,
1096 0xbd651cf4,
1097 0x3807f084,
1098 0xd00604b6, 1121 0xd00604b6,
1099 0x04bd0008, 1122 0x04bd0008,
1100 0xb63487f0, 1123/* 0x02c8: timer_done */
1101 0x88cf0684, 1124 0xfc1031f4,
1102 0x9a099800, 1125 0xf890fc80,
1103 0xbb0298bb, 1126/* 0x02d1: send_proc */
1104 0xfe8000e9, 1127 0xf980f900,
1105 0x0887f003, 1128 0x05e89890,
1106 0xcf0684b6, 1129 0xf004e998,
1107 0x84f00088, 1130 0x89b80486,
1108 0x261bf402, 1131 0x2a0bf406,
1109 0xb63487f0, 1132 0x940398c4,
1110 0x88cf0684, 1133 0x80b60488,
1111 0x06e0b800, 1134 0x008ebb18,
1112 0xb8090bf4, 1135 0x8000fa98,
1113 0x1cf406e8, 1136 0x8d80008a,
1114/* 0x02ad: timer_reset */ 1137 0x028c8001,
1115 0x3407f011, 1138 0xb6038b80,
1116 0xd00604b6, 1139 0x94f00190,
1117 0x04bd000e, 1140 0x04e98007,
1118/* 0x02bb: timer_enable */ 1141/* 0x030b: send_done */
1119 0xf09a0e80, 1142 0xfc0231f4,
1120 0x07f00187, 1143 0xf880fc90,
1121 0x0604b638, 1144/* 0x0311: find */
1122 0xbd0008d0, 1145 0xf080f900,
1123/* 0x02c9: timer_done */ 1146 0x31f45887,
1124 0x1031f404, 1147/* 0x0319: find_loop */
1148 0x008a9801,
1149 0xf406aeb8,
1150 0x80b6100b,
1151 0x6886b158,
1152 0xf01bf402,
1153/* 0x032f: find_done */
1154 0xb90132f4,
1155 0x80fc028e,
1156/* 0x0336: send */
1157 0x21f500f8,
1158 0x01f40311,
1159/* 0x033f: recv */
1160 0xf900f897,
1161 0x9880f990,
1162 0xe99805e8,
1163 0x0132f404,
1164 0xf40689b8,
1165 0x89c43d0b,
1166 0x0180b603,
1167 0x800784f0,
1168 0xea9805e8,
1169 0xfef0f902,
1170 0xf0f9018f,
1171 0x9402efb9,
1172 0xe9bb0499,
1173 0x18e0b600,
1174 0x9803eb98,
1175 0xed9802ec,
1176 0x00ee9801,
1177 0xf0fca5f9,
1178 0xf400f8fe,
1179 0xf0fc0131,
1180/* 0x038c: recv_done */
1125 0x90fc80fc, 1181 0x90fc80fc,
1126/* 0x02d2: send_proc */ 1182/* 0x0392: init */
1127 0x80f900f8, 1183 0x17f100f8,
1128 0xe89890f9, 1184 0x14b60108,
1129 0x04e99805, 1185 0x0011cf06,
1130 0xb80486f0, 1186 0x010911e7,
1131 0x0bf40689, 1187 0xfe0814b6,
1132 0x0398c42a, 1188 0x17f10014,
1133 0xb6048894, 1189 0x13f000e0,
1134 0x8ebb1880, 1190 0x1c07f000,
1135 0x00fa9800, 1191 0xd00604b6,
1136 0x80008a80, 1192 0x04bd0001,
1137 0x8c80018d, 1193 0xf0ff17f0,
1138 0x038b8002, 1194 0x04b61407,
1139 0xf00190b6, 1195 0x0001d006,
1140 0xe9800794, 1196 0x17f004bd,
1141 0x0231f404, 1197 0x0015f102,
1142/* 0x030c: send_done */ 1198 0x1007f008,
1143 0x80fc90fc,
1144/* 0x0312: find */
1145 0x80f900f8,
1146 0xf45887f0,
1147/* 0x031a: find_loop */
1148 0x8a980131,
1149 0x06aeb800,
1150 0xb6100bf4,
1151 0x86b15880,
1152 0x1bf40268,
1153 0x0132f4f0,
1154/* 0x0330: find_done */
1155 0xfc028eb9,
1156/* 0x0337: send */
1157 0xf500f880,
1158 0xf4031221,
1159 0x00f89701,
1160/* 0x0340: recv */
1161 0x80f990f9,
1162 0x9805e898,
1163 0x32f404e9,
1164 0x0689b801,
1165 0xc43d0bf4,
1166 0x80b60389,
1167 0x0784f001,
1168 0x9805e880,
1169 0xf0f902ea,
1170 0xf9018ffe,
1171 0x02efb9f0,
1172 0xbb049994,
1173 0xe0b600e9,
1174 0x03eb9818,
1175 0x9802ec98,
1176 0xee9801ed,
1177 0xfca5f900,
1178 0x00f8fef0,
1179 0xfc0131f4,
1180/* 0x038d: recv_done */
1181 0xfc80fcf0,
1182/* 0x0393: init */
1183 0xf100f890,
1184 0xb6010817,
1185 0x11cf0614,
1186 0x0911e700,
1187 0x0814b601,
1188 0xf10014fe,
1189 0xf000e017,
1190 0x07f00013,
1191 0x0604b61c,
1192 0xbd0001d0,
1193 0xff17f004,
1194 0xb61407f0,
1195 0x01d00604,
1196 0xf004bd00,
1197 0x15f10217,
1198 0x07f00800,
1199 0x0604b610,
1200 0xbd0001d0,
1201 0x1a17f104,
1202 0x0013f001,
1203 0xf40010fe,
1204 0x17f01031,
1205 0x3807f001,
1206 0xd00604b6, 1199 0xd00604b6,
1207 0x04bd0001, 1200 0x04bd0001,
1208/* 0x03f7: init_proc */ 1201 0x011917f1,
1209 0x9858f7f0, 1202 0xf10013f0,
1210 0x16b001f1, 1203 0xfeffff14,
1211 0xfa0bf400, 1204 0x31f40010,
1212 0xf0b615f9, 1205 0x0117f010,
1213 0xf20ef458, 1206 0xb63807f0,
1214/* 0x0408: mulu32_32_64 */ 1207 0x01d00604,
1215 0x20f910f9, 1208 0xf004bd00,
1216 0x40f930f9, 1209/* 0x03fa: init_proc */
1217 0x9510e195, 1210 0xf19858f7,
1218 0xc4bd10d2, 1211 0x0016b001,
1219 0xedffb4bd, 1212 0xf9fa0bf4,
1220 0x301dffc0, 1213 0x58f0b615,
1221 0xf10234b9, 1214/* 0x040b: mulu32_32_64 */
1222 0xb6ffff34, 1215 0xf9f20ef4,
1223 0x45b61034, 1216 0xf920f910,
1224 0x00c3bb10, 1217 0x9540f930,
1225 0xff01b4bb, 1218 0xd29510e1,
1226 0x34b930e2, 1219 0xbdc4bd10,
1227 0xff34f102, 1220 0xc0edffb4,
1228 0x1034b6ff, 1221 0xb9301dff,
1229 0xbb1045b6, 1222 0x34f10234,
1230 0xb4bb00c3, 1223 0x34b6ffff,
1231 0x3012ff01, 1224 0x1045b610,
1232 0xfc00b3bb, 1225 0xbb00c3bb,
1233 0xfc30fc40, 1226 0xe2ff01b4,
1234 0xf810fc20, 1227 0x0234b930,
1235/* 0x0459: host_send */ 1228 0xffff34f1,
1236 0xb017f100, 1229 0xb61034b6,
1230 0xc3bb1045,
1231 0x01b4bb00,
1232 0xbb3012ff,
1233 0x40fc00b3,
1234 0x20fc30fc,
1235 0x00f810fc,
1236/* 0x045c: host_send */
1237 0x04b017f1,
1238 0xcf0614b6,
1239 0x27f10011,
1240 0x24b604a0,
1241 0x0022cf06,
1242 0xf40612b8,
1243 0x1ec4320b,
1244 0x04ee9407,
1245 0x0270e0b7,
1246 0x9803eb98,
1247 0xed9802ec,
1248 0x00ee9801,
1249 0x033621f5,
1250 0xc40110b6,
1251 0x07f10f1e,
1252 0x04b604b0,
1253 0x000ed006,
1254 0x0ef404bd,
1255/* 0x04a5: host_send_done */
1256/* 0x04a7: host_recv */
1257 0xf100f8ba,
1258 0xf14e4917,
1259 0xb8525413,
1260 0x0bf406e1,
1261/* 0x04b5: host_recv_wait */
1262 0xcc17f1aa,
1237 0x0614b604, 1263 0x0614b604,
1238 0xf10011cf, 1264 0xf10011cf,
1239 0xb604a027, 1265 0xb604c827,
1240 0x22cf0624, 1266 0x22cf0624,
1241 0x0612b800, 1267 0x0816f000,
1242 0xc4320bf4, 1268 0xf40612b8,
1243 0xee94071e, 1269 0x23c4e60b,
1244 0x70e0b704, 1270 0x0434b607,
1245 0x03eb9802, 1271 0x02f030b7,
1246 0x9802ec98, 1272 0x80033b80,
1247 0xee9801ed, 1273 0x3d80023c,
1248 0x3721f500, 1274 0x003e8001,
1249 0x0110b603, 1275 0xf00120b6,
1250 0xf10f1ec4, 1276 0x07f10f24,
1251 0xb604b007, 1277 0x04b604c8,
1252 0x0ed00604, 1278 0x0002d006,
1253 0xf404bd00, 1279 0x27f004bd,
1254/* 0x04a2: host_send_done */ 1280 0x0007f040,
1255 0x00f8ba0e, 1281 0xd00604b6,
1256/* 0x04a4: host_recv */ 1282 0x04bd0002,
1257 0x4e4917f1, 1283/* 0x050a: host_init */
1258 0x525413f1, 1284 0x17f100f8,
1259 0xf406e1b8,
1260/* 0x04b2: host_recv_wait */
1261 0x17f1aa0b,
1262 0x14b604cc,
1263 0x0011cf06,
1264 0x04c827f1,
1265 0xcf0624b6,
1266 0x16f00022,
1267 0x0612b808,
1268 0xc4e60bf4,
1269 0x34b60723,
1270 0xf030b704,
1271 0x033b8002,
1272 0x80023c80,
1273 0x3e80013d,
1274 0x0120b600,
1275 0xf10f24f0,
1276 0xb604c807,
1277 0x02d00604,
1278 0xf004bd00,
1279 0x07f04027,
1280 0x0604b600,
1281 0xbd0002d0,
1282/* 0x0507: host_init */
1283 0xf100f804,
1284 0xb6008017,
1285 0x15f11014,
1286 0x07f10270,
1287 0x04b604d0,
1288 0x0001d006,
1289 0x17f104bd,
1290 0x14b60080, 1285 0x14b60080,
1291 0xf015f110, 1286 0x7015f110,
1292 0xdc07f102, 1287 0xd007f102,
1293 0x0604b604, 1288 0x0604b604,
1294 0xbd0001d0, 1289 0xbd0001d0,
1295 0x0117f004, 1290 0x8017f104,
1296 0x04c407f1, 1291 0x1014b600,
1292 0x02f015f1,
1293 0x04dc07f1,
1297 0xd00604b6, 1294 0xd00604b6,
1298 0x04bd0001, 1295 0x04bd0001,
1299/* 0x0546: memx_func_enter */ 1296 0xf10117f0,
1300 0x87f100f8, 1297 0xb604c407,
1301 0x8eb91610, 1298 0x01d00604,
1302 0x0421f402, 1299 0xf804bd00,
1303 0xf102d7b9, 1300/* 0x0549: memx_func_enter */
1304 0xf1fffc67, 1301 0x1087f100,
1305 0xfdffff63, 1302 0x028eb916,
1306 0x67f10476, 1303 0xb90421f4,
1307 0x76fd0002, 1304 0x67f102d7,
1308 0xf980f905, 1305 0x63f1fffc,
1309 0xfcd0fc70, 1306 0x76fdffff,
1310 0x3f21f4e0, 1307 0x0267f104,
1308 0x0576fd00,
1309 0x70f980f9,
1310 0xe0fcd0fc,
1311 0xf04021f4,
1312 0x07f10467,
1313 0x04b607e0,
1314 0x0006d006,
1315/* 0x0582: memx_func_enter_wait */
1316 0x67f104bd,
1317 0x64b607c0,
1318 0x0066cf06,
1319 0xf40464f0,
1320 0x67f0f30b,
1321 0x0664b62c,
1322 0x800066cf,
1323 0x00f8f106,
1324/* 0x05a0: memx_func_leave */
1325 0xb62c67f0,
1326 0x66cf0664,
1327 0xf2068000,
1311 0xf10467f0, 1328 0xf10467f0,
1312 0xb607e007, 1329 0xb607e407,
1313 0x06d00604, 1330 0x06d00604,
1314/* 0x057f: memx_func_enter_wait */ 1331/* 0x05bb: memx_func_leave_wait */
1315 0xf104bd00, 1332 0xf104bd00,
1316 0xb607c067, 1333 0xb607c067,
1317 0x66cf0664, 1334 0x66cf0664,
1318 0x0464f000, 1335 0x0464f000,
1319 0xf0f30bf4, 1336 0xf1f31bf4,
1320 0x64b62c67, 1337 0xb9161087,
1321 0x0066cf06, 1338 0x21f4028e,
1322 0xf8f10680, 1339 0x02d7b904,
1323/* 0x059d: memx_func_leave */ 1340 0xffcc67f1,
1324 0x2c67f000, 1341 0xffff63f1,
1325 0xcf0664b6, 1342 0xf90476fd,
1326 0x06800066, 1343 0xfc70f980,
1327 0x0467f0f2, 1344 0xf4e0fcd0,
1328 0x07e407f1, 1345 0x00f84021,
1329 0xd00604b6, 1346/* 0x05f0: memx_func_wait_vblank */
1330 0x04bd0006, 1347 0xb0001698,
1331/* 0x05b8: memx_func_leave_wait */ 1348 0x0bf40066,
1332 0x07c067f1, 1349 0x0166b013,
1333 0xcf0664b6, 1350 0xf4060bf4,
1334 0x64f00066, 1351/* 0x0602: memx_func_wait_vblank_head1 */
1335 0xf31bf404, 1352 0x77f12e0e,
1336 0x161087f1, 1353 0x0ef40020,
1337 0xf4028eb9, 1354/* 0x0609: memx_func_wait_vblank_head0 */
1338 0xd7b90421, 1355 0x0877f107,
1339 0xcc67f102, 1356/* 0x060d: memx_func_wait_vblank_0 */
1340 0xff63f1ff, 1357 0xc467f100,
1341 0x0476fdff, 1358 0x0664b607,
1342 0x70f980f9, 1359 0xfd0066cf,
1343 0xe0fcd0fc, 1360 0x1bf40467,
1344 0xf83f21f4, 1361/* 0x061d: memx_func_wait_vblank_1 */
1345/* 0x05ed: memx_func_wait_vblank */ 1362 0xc467f1f3,
1346 0x00169800, 1363 0x0664b607,
1347 0xf40066b0, 1364 0xfd0066cf,
1348 0x66b0130b, 1365 0x0bf40467,
1349 0x060bf401, 1366/* 0x062d: memx_func_wait_vblank_fini */
1350/* 0x05ff: memx_func_wait_vblank_head1 */ 1367 0x0410b6f3,
1351 0xf12e0ef4, 1368/* 0x0632: memx_func_wr32 */
1352 0xf4002077, 1369 0x169800f8,
1353/* 0x0606: memx_func_wait_vblank_head0 */ 1370 0x01159800,
1354 0x77f1070e, 1371 0xf90810b6,
1355/* 0x060a: memx_func_wait_vblank_0 */ 1372 0xfc50f960,
1356 0x67f10008, 1373 0xf4e0fcd0,
1357 0x64b607c4, 1374 0x42b64021,
1358 0x0066cf06, 1375 0xe91bf402,
1359 0xf40467fd, 1376/* 0x064e: memx_func_wait */
1360/* 0x061a: memx_func_wait_vblank_1 */ 1377 0x87f000f8,
1361 0x67f1f31b, 1378 0x0684b62c,
1362 0x64b607c4, 1379 0x980088cf,
1363 0x0066cf06, 1380 0x1d98001e,
1364 0xf40467fd, 1381 0x021c9801,
1365/* 0x062a: memx_func_wait_vblank_fini */ 1382 0xb6031b98,
1366 0x10b6f30b, 1383 0x21f41010,
1367/* 0x062f: memx_func_wr32 */ 1384/* 0x066b: memx_func_delay */
1368 0x9800f804, 1385 0x9800f8a3,
1369 0x15980016, 1386 0x10b6001e,
1370 0x0810b601, 1387 0x7e21f404,
1371 0x50f960f9, 1388/* 0x0676: memx_func_train */
1372 0xe0fcd0fc, 1389 0x57f100f8,
1373 0xb63f21f4, 1390 0x77f10003,
1374 0x1bf40242, 1391 0x97f10000,
1375/* 0x064b: memx_func_wait */ 1392 0x93f00000,
1376 0xf000f8e9, 1393 0x029eb970,
1377 0x84b62c87, 1394 0xb90421f4,
1378 0x0088cf06, 1395 0xe7f102d8,
1379 0x98001e98, 1396 0x21f42710,
1380 0x1c98011d, 1397/* 0x0695: memx_func_train_loop_outer */
1381 0x031b9802, 1398 0x0158e07e,
1382 0xf41010b6, 1399 0x0083f101,
1383 0x00f8a421, 1400 0xe097f102,
1384/* 0x0668: memx_func_delay */ 1401 0x1193f011,
1385 0xb6001e98,
1386 0x21f40410,
1387/* 0x0673: memx_func_train */
1388 0xf100f87f,
1389 0xf1000357,
1390 0xf1000077,
1391 0xf0000097,
1392 0x9eb97093,
1393 0x0421f402,
1394 0xf102d8b9,
1395 0xf42710e7,
1396/* 0x0692: memx_func_train_loop_outer */
1397 0x58e07f21,
1398 0x83f10101,
1399 0x97f10200,
1400 0x93f011e0,
1401 0xf990f911,
1402 0xfcd0fc80,
1403 0x3f21f4e0,
1404 0x67f150f9,
1405/* 0x06b2: memx_func_train_loop_inner */
1406 0x87f10000,
1407 0x68ff1111,
1408 0x10989490,
1409 0xf10589fd,
1410 0xf0072097,
1411 0x90f91093,
1412 0xd0fc80f9,
1413 0x21f4e0fc,
1414 0x8097f13f,
1415 0x1093f000,
1416 0xf4029eb9,
1417 0xd8b90421,
1418 0x2088c502,
1419 0x80f990f9, 1402 0x80f990f9,
1420 0xe0fcd0fc, 1403 0xe0fcd0fc,
1421 0xf13f21f4, 1404 0xf94021f4,
1422 0xf0053c97, 1405 0x0067f150,
1423 0x87f11093, 1406/* 0x06b5: memx_func_train_loop_inner */
1424 0x83f13002, 1407 0x1187f100,
1425 0x90f98000, 1408 0x9068ff11,
1426 0xd0fc80f9, 1409 0xfd109894,
1427 0x21f4e0fc, 1410 0x97f10589,
1428 0x60e7f13f, 1411 0x93f00720,
1429 0x10e3f005, 1412 0xf990f910,
1430 0x0000d7f1, 1413 0xfcd0fc80,
1431 0x8000d3f1, 1414 0x4021f4e0,
1432 0xf100dc90, 1415 0x008097f1,
1433 0xf08480b7, 1416 0xb91093f0,
1434 0x21f41eb3, 1417 0x21f4029e,
1435 0x0057f1a4, 1418 0x02d8b904,
1436 0xff97f100, 1419 0xf92088c5,
1437 0x0093f1ff, 1420 0xfc80f990,
1438/* 0x0731: memx_func_train_loop_4x */ 1421 0xf4e0fcd0,
1439 0x80a7f183, 1422 0x97f14021,
1440 0x10a3f000, 1423 0x93f0053c,
1441 0xf402aeb9, 1424 0x0287f110,
1442 0xd8b90421, 1425 0x0083f130,
1443 0xdfb7f102, 1426 0xf990f980,
1444 0xffb3f1ff, 1427 0xfcd0fc80,
1445 0x048bfdff, 1428 0x4021f4e0,
1446 0x80f9a0f9, 1429 0x0560e7f1,
1447 0xe0fcd0fc, 1430 0xf110e3f0,
1448 0xf13f21f4, 1431 0xf10000d7,
1449 0xf0053ca7, 1432 0x908000d3,
1450 0x87f110a3, 1433 0xb7f100dc,
1451 0x83f13002, 1434 0xb3f08480,
1452 0xa0f98000, 1435 0xa321f41e,
1453 0xd0fc80f9, 1436 0x000057f1,
1454 0x21f4e0fc, 1437 0xffff97f1,
1455 0x60e7f13f, 1438 0x830093f1,
1456 0x10e3f005, 1439/* 0x0734: memx_func_train_loop_4x */
1457 0x0000d7f1, 1440 0x0080a7f1,
1458 0x8000d3f1, 1441 0xb910a3f0,
1459 0xf102dcb9, 1442 0x21f402ae,
1460 0xf02710b7, 1443 0x02d8b904,
1461 0x21f400b3, 1444 0xffdfb7f1,
1462 0x02eeb9a4, 1445 0xffffb3f1,
1463 0xb90421f4, 1446 0xf9048bfd,
1464 0x9dff02dd, 1447 0xfc80f9a0,
1465 0x0150b694, 1448 0xf4e0fcd0,
1466 0xf4045670, 1449 0xa7f14021,
1467 0x7aa0921e, 1450 0xa3f0053c,
1468 0xa9800bcc, 1451 0x0287f110,
1469 0x0160b600, 1452 0x0083f130,
1470 0x700470b6, 1453 0xf9a0f980,
1471 0x1ef51066, 1454 0xfcd0fc80,
1472 0x50fcff00, 1455 0x4021f4e0,
1456 0x0560e7f1,
1457 0xf110e3f0,
1458 0xf10000d7,
1459 0xb98000d3,
1460 0xb7f102dc,
1461 0xb3f02710,
1462 0xa321f400,
1463 0xf402eeb9,
1464 0xddb90421,
1465 0x949dff02,
1473 0x700150b6, 1466 0x700150b6,
1474 0x1ef50756, 1467 0x1ef40456,
1475 0x00f8fed4, 1468 0xcc7aa092,
1476/* 0x07c4: memx_exec */ 1469 0x00a9800b,
1477 0xd0f9e0f9, 1470 0xb60160b6,
1478 0xb902c1b9, 1471 0x66700470,
1479/* 0x07ce: memx_exec_next */ 1472 0x001ef510,
1480 0x139802b2, 1473 0xb650fcff,
1481 0x0410b600, 1474 0x56700150,
1482 0x01f034e7, 1475 0xd41ef507,
1483 0x01e033e7, 1476/* 0x07c7: memx_exec */
1484 0xf00132b6, 1477 0xf900f8fe,
1485 0x35980c30, 1478 0xb9d0f9e0,
1486 0xb855f9de, 1479 0xb2b902c1,
1487 0x1ef40612, 1480/* 0x07d1: memx_exec_next */
1488 0xf10b98e4, 1481 0x00139802,
1489 0xbbf20c98, 1482 0xe70410b6,
1490 0xb7f102cb, 1483 0xe701f034,
1491 0xb4b607c4, 1484 0xb601e033,
1492 0x00bbcf06, 1485 0x30f00132,
1493 0xe0fcd0fc, 1486 0xde35980c,
1494 0x033721f5, 1487 0x12b855f9,
1495/* 0x080a: memx_info */ 1488 0xe41ef406,
1496 0xc67000f8, 1489 0x98f10b98,
1497 0x0e0bf401, 1490 0xcbbbf20c,
1498/* 0x0810: memx_info_data */ 1491 0xc4b7f102,
1499 0x03ccc7f1, 1492 0x06b4b607,
1500 0x0800b7f1, 1493 0xfc00bbcf,
1501/* 0x081b: memx_info_train */ 1494 0xf5e0fcd0,
1502 0xf10b0ef4, 1495 0xf8033621,
1503 0xf10bccc7, 1496/* 0x080d: memx_info */
1504/* 0x0823: memx_info_send */ 1497 0x01c67000,
1505 0xf50100b7, 1498/* 0x0813: memx_info_data */
1506 0xf8033721, 1499 0xf10e0bf4,
1507/* 0x0829: memx_recv */ 1500 0xf103ccc7,
1508 0x01d6b000, 1501 0xf40800b7,
1509 0xb0980bf4, 1502/* 0x081e: memx_info_train */
1510 0x0bf400d6, 1503 0xc7f10b0e,
1511/* 0x0837: memx_init */ 1504 0xb7f10bcc,
1512 0xf800f8d8, 1505/* 0x0826: memx_info_send */
1513/* 0x0839: perf_recv */ 1506 0x21f50100,
1514/* 0x083b: perf_init */ 1507 0x00f80336,
1515 0xf800f800, 1508/* 0x082c: memx_recv */
1516/* 0x083d: i2c_drive_scl */ 1509 0xf401d6b0,
1517 0x0036b000, 1510 0xd6b0980b,
1518 0xf1110bf4, 1511 0xd80bf400,
1519 0xb607e007, 1512/* 0x083a: memx_init */
1520 0x01d00604, 1513 0x00f800f8,
1521 0xf804bd00, 1514/* 0x083c: perf_recv */
1522/* 0x0851: i2c_drive_scl_lo */ 1515/* 0x083e: perf_init */
1523 0xe407f100, 1516 0x00f800f8,
1524 0x0604b607, 1517/* 0x0840: i2c_drive_scl */
1525 0xbd0001d0, 1518 0xf40036b0,
1526/* 0x085f: i2c_drive_sda */ 1519 0x07f1110b,
1527 0xb000f804, 1520 0x04b607e0,
1528 0x0bf40036, 1521 0x0001d006,
1529 0xe007f111, 1522 0x00f804bd,
1530 0x0604b607, 1523/* 0x0854: i2c_drive_scl_lo */
1531 0xbd0002d0, 1524 0x07e407f1,
1532/* 0x0873: i2c_drive_sda_lo */ 1525 0xd00604b6,
1533 0xf100f804, 1526 0x04bd0001,
1534 0xb607e407, 1527/* 0x0862: i2c_drive_sda */
1535 0x02d00604, 1528 0x36b000f8,
1536 0xf804bd00, 1529 0x110bf400,
1537/* 0x0881: i2c_sense_scl */ 1530 0x07e007f1,
1538 0x0132f400, 1531 0xd00604b6,
1539 0x07c437f1, 1532 0x04bd0002,
1540 0xcf0634b6, 1533/* 0x0876: i2c_drive_sda_lo */
1541 0x31fd0033, 1534 0x07f100f8,
1542 0x060bf404, 1535 0x04b607e4,
1543/* 0x0897: i2c_sense_scl_done */ 1536 0x0002d006,
1544 0xf80131f4, 1537 0x00f804bd,
1545/* 0x0899: i2c_sense_sda */ 1538/* 0x0884: i2c_sense_scl */
1546 0x0132f400, 1539 0xf10132f4,
1547 0x07c437f1, 1540 0xb607c437,
1548 0xcf0634b6, 1541 0x33cf0634,
1549 0x32fd0033, 1542 0x0431fd00,
1550 0x060bf404, 1543 0xf4060bf4,
1551/* 0x08af: i2c_sense_sda_done */ 1544/* 0x089a: i2c_sense_scl_done */
1552 0xf80131f4, 1545 0x00f80131,
1553/* 0x08b1: i2c_raise_scl */ 1546/* 0x089c: i2c_sense_sda */
1554 0xf140f900, 1547 0xf10132f4,
1555 0xf0089847, 1548 0xb607c437,
1556 0x21f50137, 1549 0x33cf0634,
1557/* 0x08be: i2c_raise_scl_wait */ 1550 0x0432fd00,
1558 0xe7f1083d, 1551 0xf4060bf4,
1559 0x21f403e8, 1552/* 0x08b2: i2c_sense_sda_done */
1560 0x8121f57f, 1553 0x00f80131,
1561 0x0901f408, 1554/* 0x08b4: i2c_raise_scl */
1562 0xf40142b6, 1555 0x47f140f9,
1563/* 0x08d2: i2c_raise_scl_done */ 1556 0x37f00898,
1564 0x40fcef1b, 1557 0x4021f501,
1565/* 0x08d6: i2c_start */ 1558/* 0x08c1: i2c_raise_scl_wait */
1566 0x21f500f8,
1567 0x11f40881,
1568 0x9921f50d,
1569 0x0611f408,
1570/* 0x08e7: i2c_start_rep */
1571 0xf0300ef4,
1572 0x21f50037,
1573 0x37f0083d,
1574 0x5f21f501,
1575 0x0076bb08,
1576 0xf90465b6,
1577 0x04659450,
1578 0xbd0256bb,
1579 0x0475fd50,
1580 0x21f550fc,
1581 0x64b608b1,
1582 0x1f11f404,
1583/* 0x0914: i2c_start_send */
1584 0xf50037f0,
1585 0xf1085f21,
1586 0xf41388e7,
1587 0x37f07f21,
1588 0x3d21f500,
1589 0x88e7f108,
1590 0x7f21f413,
1591/* 0x0930: i2c_start_out */
1592/* 0x0932: i2c_stop */
1593 0x37f000f8,
1594 0x3d21f500,
1595 0x0037f008,
1596 0x085f21f5,
1597 0x03e8e7f1,
1598 0xf07f21f4,
1599 0x21f50137,
1600 0xe7f1083d,
1601 0x21f41388,
1602 0x0137f07f,
1603 0x085f21f5,
1604 0x1388e7f1,
1605 0xf87f21f4,
1606/* 0x0965: i2c_bitw */
1607 0x5f21f500,
1608 0xe8e7f108,
1609 0x7f21f403,
1610 0xb60076bb,
1611 0x50f90465,
1612 0xbb046594,
1613 0x50bd0256,
1614 0xfc0475fd,
1615 0xb121f550,
1616 0x0464b608,
1617 0xf11811f4,
1618 0xf41388e7,
1619 0x37f07f21,
1620 0x3d21f500,
1621 0x88e7f108,
1622 0x7f21f413,
1623/* 0x09a4: i2c_bitw_out */
1624/* 0x09a6: i2c_bitr */
1625 0x37f000f8,
1626 0x5f21f501,
1627 0xe8e7f108, 1559 0xe8e7f108,
1628 0x7f21f403, 1560 0x7e21f403,
1561 0x088421f5,
1562 0xb60901f4,
1563 0x1bf40142,
1564/* 0x08d5: i2c_raise_scl_done */
1565 0xf840fcef,
1566/* 0x08d9: i2c_start */
1567 0x8421f500,
1568 0x0d11f408,
1569 0x089c21f5,
1570 0xf40611f4,
1571/* 0x08ea: i2c_start_rep */
1572 0x37f0300e,
1573 0x4021f500,
1574 0x0137f008,
1575 0x086221f5,
1629 0xb60076bb, 1576 0xb60076bb,
1630 0x50f90465, 1577 0x50f90465,
1631 0xbb046594, 1578 0xbb046594,
1632 0x50bd0256, 1579 0x50bd0256,
1633 0xfc0475fd, 1580 0xfc0475fd,
1634 0xb121f550, 1581 0xb421f550,
1635 0x0464b608, 1582 0x0464b608,
1636 0xf51b11f4, 1583/* 0x0917: i2c_start_send */
1637 0xf0089921, 1584 0xf01f11f4,
1638 0x21f50037, 1585 0x21f50037,
1639 0xe7f1083d, 1586 0xe7f10862,
1640 0x21f41388, 1587 0x21f41388,
1641 0x013cf07f, 1588 0x0037f07e,
1642/* 0x09eb: i2c_bitr_done */ 1589 0x084021f5,
1643 0xf80131f4, 1590 0x1388e7f1,
1644/* 0x09ed: i2c_get_byte */ 1591/* 0x0933: i2c_start_out */
1645 0x0057f000, 1592 0xf87e21f4,
1646/* 0x09f3: i2c_get_byte_next */ 1593/* 0x0935: i2c_stop */
1647 0xb60847f0, 1594 0x0037f000,
1648 0x76bb0154, 1595 0x084021f5,
1649 0x0465b600, 1596 0xf50037f0,
1650 0x659450f9, 1597 0xf1086221,
1651 0x0256bb04, 1598 0xf403e8e7,
1652 0x75fd50bd, 1599 0x37f07e21,
1653 0xf550fc04, 1600 0x4021f501,
1654 0xb609a621, 1601 0x88e7f108,
1655 0x11f40464, 1602 0x7e21f413,
1656 0x0553fd2b, 1603 0xf50137f0,
1657 0xf40142b6, 1604 0xf1086221,
1658 0x37f0d81b, 1605 0xf41388e7,
1606 0x00f87e21,
1607/* 0x0968: i2c_bitw */
1608 0x086221f5,
1609 0x03e8e7f1,
1610 0xbb7e21f4,
1611 0x65b60076,
1612 0x9450f904,
1613 0x56bb0465,
1614 0xfd50bd02,
1615 0x50fc0475,
1616 0x08b421f5,
1617 0xf40464b6,
1618 0xe7f11811,
1619 0x21f41388,
1620 0x0037f07e,
1621 0x084021f5,
1622 0x1388e7f1,
1623/* 0x09a7: i2c_bitw_out */
1624 0xf87e21f4,
1625/* 0x09a9: i2c_bitr */
1626 0x0137f000,
1627 0x086221f5,
1628 0x03e8e7f1,
1629 0xbb7e21f4,
1630 0x65b60076,
1631 0x9450f904,
1632 0x56bb0465,
1633 0xfd50bd02,
1634 0x50fc0475,
1635 0x08b421f5,
1636 0xf40464b6,
1637 0x21f51b11,
1638 0x37f0089c,
1639 0x4021f500,
1640 0x88e7f108,
1641 0x7e21f413,
1642 0xf4013cf0,
1643/* 0x09ee: i2c_bitr_done */
1644 0x00f80131,
1645/* 0x09f0: i2c_get_byte */
1646 0xf00057f0,
1647/* 0x09f6: i2c_get_byte_next */
1648 0x54b60847,
1659 0x0076bb01, 1649 0x0076bb01,
1660 0xf90465b6, 1650 0xf90465b6,
1661 0x04659450, 1651 0x04659450,
1662 0xbd0256bb, 1652 0xbd0256bb,
1663 0x0475fd50, 1653 0x0475fd50,
1664 0x21f550fc, 1654 0x21f550fc,
1665 0x64b60965, 1655 0x64b609a9,
1666/* 0x0a3d: i2c_get_byte_done */ 1656 0x2b11f404,
1667/* 0x0a3f: i2c_put_byte */ 1657 0xb60553fd,
1668 0xf000f804, 1658 0x1bf40142,
1669/* 0x0a42: i2c_put_byte_next */ 1659 0x0137f0d8,
1670 0x42b60847,
1671 0x3854ff01,
1672 0xb60076bb, 1660 0xb60076bb,
1673 0x50f90465, 1661 0x50f90465,
1674 0xbb046594, 1662 0xbb046594,
1675 0x50bd0256, 1663 0x50bd0256,
1676 0xfc0475fd, 1664 0xfc0475fd,
1677 0x6521f550, 1665 0x6821f550,
1678 0x0464b609, 1666 0x0464b609,
1679 0xb03411f4, 1667/* 0x0a40: i2c_get_byte_done */
1680 0x1bf40046, 1668/* 0x0a42: i2c_put_byte */
1681 0x0076bbd8, 1669 0x47f000f8,
1670/* 0x0a45: i2c_put_byte_next */
1671 0x0142b608,
1672 0xbb3854ff,
1673 0x65b60076,
1674 0x9450f904,
1675 0x56bb0465,
1676 0xfd50bd02,
1677 0x50fc0475,
1678 0x096821f5,
1679 0xf40464b6,
1680 0x46b03411,
1681 0xd81bf400,
1682 0xb60076bb,
1683 0x50f90465,
1684 0xbb046594,
1685 0x50bd0256,
1686 0xfc0475fd,
1687 0xa921f550,
1688 0x0464b609,
1689 0xbb0f11f4,
1690 0x36b00076,
1691 0x061bf401,
1692/* 0x0a9b: i2c_put_byte_done */
1693 0xf80132f4,
1694/* 0x0a9d: i2c_addr */
1695 0x0076bb00,
1682 0xf90465b6, 1696 0xf90465b6,
1683 0x04659450, 1697 0x04659450,
1684 0xbd0256bb, 1698 0xbd0256bb,
1685 0x0475fd50, 1699 0x0475fd50,
1686 0x21f550fc, 1700 0x21f550fc,
1687 0x64b609a6, 1701 0x64b608d9,
1688 0x0f11f404, 1702 0x2911f404,
1689 0xb00076bb, 1703 0x012ec3e7,
1690 0x1bf40136, 1704 0xfd0134b6,
1691 0x0132f406, 1705 0x76bb0553,
1692/* 0x0a98: i2c_put_byte_done */
1693/* 0x0a9a: i2c_addr */
1694 0x76bb00f8,
1695 0x0465b600, 1706 0x0465b600,
1696 0x659450f9, 1707 0x659450f9,
1697 0x0256bb04, 1708 0x0256bb04,
1698 0x75fd50bd, 1709 0x75fd50bd,
1699 0xf550fc04, 1710 0xf550fc04,
1700 0xb608d621, 1711 0xb60a4221,
1701 0x11f40464, 1712/* 0x0ae2: i2c_addr_done */
1702 0x2ec3e729, 1713 0x00f80464,
1703 0x0134b601, 1714/* 0x0ae4: i2c_acquire_addr */
1704 0xbb0553fd, 1715 0xb6f8cec7,
1716 0xe0b702e4,
1717 0xee980d1c,
1718/* 0x0af3: i2c_acquire */
1719 0xf500f800,
1720 0xf40ae421,
1721 0xd9f00421,
1722 0x4021f403,
1723/* 0x0b02: i2c_release */
1724 0x21f500f8,
1725 0x21f40ae4,
1726 0x03daf004,
1727 0xf84021f4,
1728/* 0x0b11: i2c_recv */
1729 0x0132f400,
1730 0xb6f8c1c7,
1731 0x16b00214,
1732 0x3a1ff528,
1733 0xf413a001,
1734 0x0032980c,
1735 0x0ccc13a0,
1736 0xf4003198,
1737 0xd0f90231,
1738 0xd0f9e0f9,
1739 0x000067f1,
1740 0x100063f1,
1741 0xbb016792,
1705 0x65b60076, 1742 0x65b60076,
1706 0x9450f904, 1743 0x9450f904,
1707 0x56bb0465, 1744 0x56bb0465,
1708 0xfd50bd02, 1745 0xfd50bd02,
1709 0x50fc0475, 1746 0x50fc0475,
1710 0x0a3f21f5, 1747 0x0af321f5,
1711/* 0x0adf: i2c_addr_done */ 1748 0xfc0464b6,
1712 0xf80464b6, 1749 0x00d6b0d0,
1713/* 0x0ae1: i2c_acquire_addr */ 1750 0x00b31bf5,
1714 0xf8cec700, 1751 0xbb0057f0,
1715 0xb702e4b6,
1716 0x980d1ce0,
1717 0x00f800ee,
1718/* 0x0af0: i2c_acquire */
1719 0x0ae121f5,
1720 0xf00421f4,
1721 0x21f403d9,
1722/* 0x0aff: i2c_release */
1723 0xf500f83f,
1724 0xf40ae121,
1725 0xdaf00421,
1726 0x3f21f403,
1727/* 0x0b0e: i2c_recv */
1728 0x32f400f8,
1729 0xf8c1c701,
1730 0xb00214b6,
1731 0x1ff52816,
1732 0x13a0013a,
1733 0x32980cf4,
1734 0xcc13a000,
1735 0x0031980c,
1736 0xf90231f4,
1737 0xf9e0f9d0,
1738 0x0067f1d0,
1739 0x0063f100,
1740 0x01679210,
1741 0xb60076bb,
1742 0x50f90465,
1743 0xbb046594,
1744 0x50bd0256,
1745 0xfc0475fd,
1746 0xf021f550,
1747 0x0464b60a,
1748 0xd6b0d0fc,
1749 0xb31bf500,
1750 0x0057f000,
1751 0xb60076bb,
1752 0x50f90465,
1753 0xbb046594,
1754 0x50bd0256,
1755 0xfc0475fd,
1756 0x9a21f550,
1757 0x0464b60a,
1758 0x00d011f5,
1759 0xbbe0c5c7,
1760 0x65b60076, 1752 0x65b60076,
1761 0x9450f904, 1753 0x9450f904,
1762 0x56bb0465, 1754 0x56bb0465,
1763 0xfd50bd02, 1755 0xfd50bd02,
1764 0x50fc0475, 1756 0x50fc0475,
1765 0x0a3f21f5, 1757 0x0a9d21f5,
1766 0xf50464b6, 1758 0xf50464b6,
1767 0xf000ad11, 1759 0xc700d011,
1768 0x76bb0157, 1760 0x76bbe0c5,
1769 0x0465b600, 1761 0x0465b600,
1770 0x659450f9, 1762 0x659450f9,
1771 0x0256bb04, 1763 0x0256bb04,
1772 0x75fd50bd, 1764 0x75fd50bd,
1773 0xf550fc04, 1765 0xf550fc04,
1774 0xb60a9a21, 1766 0xb60a4221,
1775 0x11f50464, 1767 0x11f50464,
1776 0x76bb008a, 1768 0x57f000ad,
1777 0x0465b600, 1769 0x0076bb01,
1778 0x659450f9, 1770 0xf90465b6,
1779 0x0256bb04, 1771 0x04659450,
1780 0x75fd50bd, 1772 0xbd0256bb,
1781 0xf550fc04, 1773 0x0475fd50,
1782 0xb609ed21, 1774 0x21f550fc,
1783 0x11f40464, 1775 0x64b60a9d,
1784 0xe05bcb6a, 1776 0x8a11f504,
1785 0xb60076bb, 1777 0x0076bb00,
1786 0x50f90465, 1778 0xf90465b6,
1787 0xbb046594, 1779 0x04659450,
1788 0x50bd0256, 1780 0xbd0256bb,
1789 0xfc0475fd, 1781 0x0475fd50,
1790 0x3221f550, 1782 0x21f550fc,
1791 0x0464b609, 1783 0x64b609f0,
1792 0xbd025bb9, 1784 0x6a11f404,
1793 0x430ef474, 1785 0xbbe05bcb,
1794/* 0x0c14: i2c_recv_not_rd08 */ 1786 0x65b60076,
1795 0xf401d6b0, 1787 0x9450f904,
1796 0x57f03d1b, 1788 0x56bb0465,
1797 0x9a21f500, 1789 0xfd50bd02,
1798 0x3311f40a, 1790 0x50fc0475,
1799 0xf5e0c5c7, 1791 0x093521f5,
1800 0xf40a3f21, 1792 0xb90464b6,
1801 0x57f02911, 1793 0x74bd025b,
1802 0x9a21f500, 1794/* 0x0c17: i2c_recv_not_rd08 */
1803 0x1f11f40a, 1795 0xb0430ef4,
1804 0xf5e0b5c7, 1796 0x1bf401d6,
1805 0xf40a3f21, 1797 0x0057f03d,
1806 0x21f51511, 1798 0x0a9d21f5,
1807 0x74bd0932, 1799 0xc73311f4,
1808 0xf408c5c7, 1800 0x21f5e0c5,
1809 0x32f4091b, 1801 0x11f40a42,
1810 0x030ef402, 1802 0x0057f029,
1811/* 0x0c54: i2c_recv_not_wr08 */ 1803 0x0a9d21f5,
1812/* 0x0c54: i2c_recv_done */ 1804 0xc71f11f4,
1813 0xf5f8cec7, 1805 0x21f5e0b5,
1814 0xfc0aff21, 1806 0x11f40a42,
1815 0xf4d0fce0, 1807 0x3521f515,
1816 0x7cb90a12, 1808 0xc774bd09,
1817 0x3721f502, 1809 0x1bf408c5,
1818/* 0x0c69: i2c_recv_exit */ 1810 0x0232f409,
1819/* 0x0c6b: i2c_init */ 1811/* 0x0c57: i2c_recv_not_wr08 */
1820 0xf800f803, 1812/* 0x0c57: i2c_recv_done */
1821/* 0x0c6d: test_recv */ 1813 0xc7030ef4,
1822 0xd817f100, 1814 0x21f5f8ce,
1823 0x0614b605, 1815 0xe0fc0b02,
1824 0xb60011cf, 1816 0x12f4d0fc,
1825 0x07f10110, 1817 0x027cb90a,
1826 0x04b605d8, 1818 0x033621f5,
1827 0x0001d006, 1819/* 0x0c6c: i2c_recv_exit */
1828 0xe7f104bd, 1820/* 0x0c6e: i2c_init */
1829 0xe3f1d900,
1830 0x21f5134f,
1831 0x00f80257,
1832/* 0x0c94: test_init */
1833 0x0800e7f1,
1834 0x025721f5,
1835/* 0x0c9e: idle_recv */
1836 0x00f800f8, 1821 0x00f800f8,
1837/* 0x0ca0: idle */ 1822/* 0x0c70: test_recv */
1838 0xf10031f4, 1823 0x05d817f1,
1839 0xb605d417, 1824 0xcf0614b6,
1840 0x11cf0614, 1825 0x10b60011,
1841 0x0110b600, 1826 0xd807f101,
1842 0x05d407f1, 1827 0x0604b605,
1843 0xd00604b6, 1828 0xbd0001d0,
1844 0x04bd0001, 1829 0x00e7f104,
1845/* 0x0cbc: idle_loop */ 1830 0x4fe3f1d9,
1846 0xf45817f0, 1831 0x5621f513,
1847/* 0x0cc2: idle_proc */ 1832/* 0x0c97: test_init */
1848/* 0x0cc2: idle_proc_exec */ 1833 0xf100f802,
1849 0x10f90232, 1834 0xf50800e7,
1850 0xf5021eb9, 1835 0xf8025621,
1851 0xfc034021, 1836/* 0x0ca1: idle_recv */
1852 0x0911f410, 1837/* 0x0ca3: idle */
1853 0xf40231f4, 1838 0xf400f800,
1854/* 0x0cd6: idle_proc_next */ 1839 0x17f10031,
1855 0x10b6ef0e, 1840 0x14b605d4,
1856 0x061fb858, 1841 0x0011cf06,
1857 0xf4e61bf4, 1842 0xf10110b6,
1858 0x28f4dd02, 1843 0xb605d407,
1859 0xbb0ef400, 1844 0x01d00604,
1860 0x00000000, 1845/* 0x0cbf: idle_loop */
1846 0xf004bd00,
1847 0x32f45817,
1848/* 0x0cc5: idle_proc */
1849/* 0x0cc5: idle_proc_exec */
1850 0xb910f902,
1851 0x21f5021e,
1852 0x10fc033f,
1853 0xf40911f4,
1854 0x0ef40231,
1855/* 0x0cd9: idle_proc_next */
1856 0x5810b6ef,
1857 0xf4061fb8,
1858 0x02f4e61b,
1859 0x0028f4dd,
1860 0x00bb0ef4,
1861 0x00000000, 1861 0x00000000,
1862 0x00000000, 1862 0x00000000,
1863 0x00000000, 1863 0x00000000,
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/host.fuc b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/host.fuc
index c2bb616a8da5..f2420a37f45b 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/host.fuc
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/host.fuc
@@ -98,8 +98,7 @@ host_send:
98// $r0 - zero 98// $r0 - zero
99host_recv: 99host_recv:
100 // message from intr handler == HOST->PWR comms pending 100 // message from intr handler == HOST->PWR comms pending
101 mov $r1 (PROC_KERN & 0x0000ffff) 101 imm32($r1, PROC_KERN)
102 sethi $r1 (PROC_KERN & 0xffff0000)
103 cmp b32 $r14 $r1 102 cmp b32 $r14 $r1
104 bra e #host_send 103 bra e #host_send
105 104
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/kernel.fuc b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/kernel.fuc
index ad35fa57be94..c20a3bd33775 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/kernel.fuc
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/kernel.fuc
@@ -51,8 +51,7 @@ time_next: .b32 0
51// $r0 - zero 51// $r0 - zero
52rd32: 52rd32:
53 nv_iowr(NV_PPWR_MMIO_ADDR, $r14) 53 nv_iowr(NV_PPWR_MMIO_ADDR, $r14)
54 mov $r13 NV_PPWR_MMIO_CTRL_OP_RD 54 imm32($r13, NV_PPWR_MMIO_CTRL_OP_RD | NV_PPWR_MMIO_CTRL_TRIGGER)
55 sethi $r13 NV_PPWR_MMIO_CTRL_TRIGGER
56 nv_iowr(NV_PPWR_MMIO_CTRL, $r13) 55 nv_iowr(NV_PPWR_MMIO_CTRL, $r13)
57 rd32_wait: 56 rd32_wait:
58 nv_iord($r13, NV_PPWR_MMIO_CTRL) 57 nv_iord($r13, NV_PPWR_MMIO_CTRL)
@@ -70,9 +69,7 @@ rd32:
70wr32: 69wr32:
71 nv_iowr(NV_PPWR_MMIO_ADDR, $r14) 70 nv_iowr(NV_PPWR_MMIO_ADDR, $r14)
72 nv_iowr(NV_PPWR_MMIO_DATA, $r13) 71 nv_iowr(NV_PPWR_MMIO_DATA, $r13)
73 mov $r13 NV_PPWR_MMIO_CTRL_OP_WR 72 imm32($r13, NV_PPWR_MMIO_CTRL_OP_WR | NV_PPWR_MMIO_CTRL_MASK_B32_0 | NV_PPWR_MMIO_CTRL_TRIGGER)
74 or $r13 NV_PPWR_MMIO_CTRL_MASK_B32_0
75 sethi $r13 NV_PPWR_MMIO_CTRL_TRIGGER
76 73
77#ifdef NVKM_FALCON_MMIO_TRAP 74#ifdef NVKM_FALCON_MMIO_TRAP
78 push $r13 75 push $r13
@@ -215,8 +212,7 @@ intr:
215 bra z #intr_subintr_skip_fifo 212 bra z #intr_subintr_skip_fifo
216 nv_iord($r12, NV_PPWR_FIFO_INTR) 213 nv_iord($r12, NV_PPWR_FIFO_INTR)
217 push $r12 214 push $r12
218 mov $r14 (PROC_HOST & 0x0000ffff) 215 imm32($r14, PROC_HOST)
219 sethi $r14 (PROC_HOST & 0xffff0000)
220 mov $r13 KMSG_FIFO 216 mov $r13 KMSG_FIFO
221 call(send) 217 call(send)
222 pop $r12 218 pop $r12
@@ -256,7 +252,7 @@ ticks_from_ns:
256 252
257 /* try not losing precision (multiply then divide) */ 253 /* try not losing precision (multiply then divide) */
258 imm32($r13, HW_TICKS_PER_US) 254 imm32($r13, HW_TICKS_PER_US)
259 call #mulu32_32_64 255 call(mulu32_32_64)
260 256
261 /* use an immeditate, it's ok because HW_TICKS_PER_US < 16 bits */ 257 /* use an immeditate, it's ok because HW_TICKS_PER_US < 16 bits */
262 div $r12 $r12 1000 258 div $r12 $r12 1000
@@ -268,7 +264,7 @@ ticks_from_ns:
268 /* let's divide then multiply, too bad for the precision! */ 264 /* let's divide then multiply, too bad for the precision! */
269 div $r14 $r14 1000 265 div $r14 $r14 1000
270 imm32($r13, HW_TICKS_PER_US) 266 imm32($r13, HW_TICKS_PER_US)
271 call #mulu32_32_64 267 call(mulu32_32_64)
272 268
273 /* this cannot overflow as long as HW_TICKS_PER_US < 1000 */ 269 /* this cannot overflow as long as HW_TICKS_PER_US < 1000 */
274 270
@@ -290,7 +286,7 @@ ticks_from_us:
290 286
291 /* simply multiply $us by HW_TICKS_PER_US */ 287 /* simply multiply $us by HW_TICKS_PER_US */
292 imm32($r13, HW_TICKS_PER_US) 288 imm32($r13, HW_TICKS_PER_US)
293 call #mulu32_32_64 289 call(mulu32_32_64)
294 mov b32 $r14 $r12 290 mov b32 $r14 $r12
295 291
296 /* check if there wasn't any overflow */ 292 /* check if there wasn't any overflow */
@@ -511,14 +507,12 @@ init:
511#ifdef NVKM_FALCON_MMIO_UAS 507#ifdef NVKM_FALCON_MMIO_UAS
512 // somehow allows the magic "access mmio via D[]" stuff that's 508 // somehow allows the magic "access mmio via D[]" stuff that's
513 // used by the nv_rd32/nv_wr32 macros to work 509 // used by the nv_rd32/nv_wr32 macros to work
514 mov $r1 0x0010 510 imm32($r1, 0x10 | NV_PPWR_UAS_CONFIG_ENABLE)
515 sethi $r1 NV_PPWR_UAS_CONFIG_ENABLE
516 nv_iowrs(NV_PPWR_UAS_CONFIG, $r1) 511 nv_iowrs(NV_PPWR_UAS_CONFIG, $r1)
517#endif 512#endif
518 513
519 // route all interrupts except user0/1 and pause to fuc 514 // route all interrupts except user0/1 and pause to fuc
520 mov $r1 0x00e0 515 imm32($r1, 0xe0)
521 sethi $r1 0x00000000
522 nv_iowr(NV_PPWR_INTR_ROUTE, $r1) 516 nv_iowr(NV_PPWR_INTR_ROUTE, $r1)
523 517
524 // enable watchdog and subintr intrs 518 // enable watchdog and subintr intrs
@@ -529,8 +523,8 @@ init:
529 nv_iowr(NV_PPWR_INTR_EN_SET, $r1) 523 nv_iowr(NV_PPWR_INTR_EN_SET, $r1)
530 524
531 // enable interrupts globally 525 // enable interrupts globally
532 mov $r1 #intr 526 imm32($r1, #intr)
533 sethi $r1 0x00000000 527 and $r1 0xffff
534 mov $iv0 $r1 528 mov $iv0 $r1
535 bset $flags ie0 529 bset $flags ie0
536 530
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/macros.fuc b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/macros.fuc
index 96fc984dafdc..3737bd27f74e 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/macros.fuc
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/macros.fuc
@@ -169,7 +169,7 @@
169*/ .b32 0 /* 169*/ .b32 0 /*
170*/ .skip 64 170*/ .skip 64
171 171
172#if NV_PPWR_CHIPSET < GK208 172#if NVKM_PPWR_CHIPSET < GK208
173#define imm32(reg,val) /* 173#define imm32(reg,val) /*
174*/ movw reg ((val) & 0x0000ffff) /* 174*/ movw reg ((val) & 0x0000ffff) /*
175*/ sethi reg ((val) & 0xffff0000) 175*/ sethi reg ((val) & 0xffff0000)
@@ -252,12 +252,12 @@
252#endif 252#endif
253 253
254#define st(size, addr, reg) /* 254#define st(size, addr, reg) /*
255*/ movw $r0 addr /* 255*/ imm32($r0, addr) /*
256*/ st size D[$r0] reg /* 256*/ st size D[$r0] reg /*
257*/ clear b32 $r0 257*/ clear b32 $r0
258 258
259#define ld(size, reg, addr) /* 259#define ld(size, reg, addr) /*
260*/ movw $r0 addr /* 260*/ imm32($r0, addr) /*
261*/ ld size reg D[$r0] /* 261*/ ld size reg D[$r0] /*
262*/ clear b32 $r0 262*/ clear b32 $r0
263 263
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/test.fuc b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/test.fuc
index 0c3a71bf5459..9e3f4e690dd1 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/test.fuc
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/test.fuc
@@ -48,8 +48,7 @@ test_recv:
48 nv_iord($r1, NV_PPWR_DSCRATCH(2)) 48 nv_iord($r1, NV_PPWR_DSCRATCH(2))
49 add b32 $r1 1 49 add b32 $r1 1
50 nv_iowr(NV_PPWR_DSCRATCH(2), $r1) 50 nv_iowr(NV_PPWR_DSCRATCH(2), $r1)
51 mov $r14 -0x2700 /* 0xd900, envyas grrr! */ 51 imm32($r14, 0x134fd900)
52 sethi $r14 0x134f0000
53 call(timer) 52 call(timer)
54 ret 53 ret
55 54
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/Kbuild b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/Kbuild
new file mode 100644
index 000000000000..b02b868a6589
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/Kbuild
@@ -0,0 +1,3 @@
1nvkm-y += nvkm/subdev/secboot/base.o
2nvkm-y += nvkm/subdev/secboot/gm200.o
3nvkm-y += nvkm/subdev/secboot/gm20b.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/base.c
new file mode 100644
index 000000000000..520facf9bc07
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/base.c
@@ -0,0 +1,288 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#include "priv.h"
24#include <subdev/timer.h>
25
26static const char *
27managed_falcons_names[] = {
28 [NVKM_SECBOOT_FALCON_PMU] = "PMU",
29 [NVKM_SECBOOT_FALCON_RESERVED] = "<reserved>",
30 [NVKM_SECBOOT_FALCON_FECS] = "FECS",
31 [NVKM_SECBOOT_FALCON_GPCCS] = "GPCCS",
32 [NVKM_SECBOOT_FALCON_END] = "<invalid>",
33};
34
35/*
36 * Helper falcon functions
37 */
38
39static int
40falcon_clear_halt_interrupt(struct nvkm_device *device, u32 base)
41{
42 int ret;
43
44 /* clear halt interrupt */
45 nvkm_mask(device, base + 0x004, 0x10, 0x10);
46 /* wait until halt interrupt is cleared */
47 ret = nvkm_wait_msec(device, 10, base + 0x008, 0x10, 0x0);
48 if (ret < 0)
49 return ret;
50
51 return 0;
52}
53
54static int
55falcon_wait_idle(struct nvkm_device *device, u32 base)
56{
57 int ret;
58
59 ret = nvkm_wait_msec(device, 10, base + 0x04c, 0xffff, 0x0);
60 if (ret < 0)
61 return ret;
62
63 return 0;
64}
65
66static int
67nvkm_secboot_falcon_enable(struct nvkm_secboot *sb)
68{
69 struct nvkm_device *device = sb->subdev.device;
70 int ret;
71
72 /* enable engine */
73 nvkm_mask(device, 0x200, sb->enable_mask, sb->enable_mask);
74 nvkm_rd32(device, 0x200);
75 ret = nvkm_wait_msec(device, 10, sb->base + 0x10c, 0x6, 0x0);
76 if (ret < 0) {
77 nvkm_mask(device, 0x200, sb->enable_mask, 0x0);
78 nvkm_error(&sb->subdev, "Falcon mem scrubbing timeout\n");
79 return ret;
80 }
81
82 ret = falcon_wait_idle(device, sb->base);
83 if (ret)
84 return ret;
85
86 /* enable IRQs */
87 nvkm_wr32(device, sb->base + 0x010, 0xff);
88 nvkm_mask(device, 0x640, sb->irq_mask, sb->irq_mask);
89 nvkm_mask(device, 0x644, sb->irq_mask, sb->irq_mask);
90
91 return 0;
92}
93
94static int
95nvkm_secboot_falcon_disable(struct nvkm_secboot *sb)
96{
97 struct nvkm_device *device = sb->subdev.device;
98
99 /* disable IRQs and wait for any previous code to complete */
100 nvkm_mask(device, 0x644, sb->irq_mask, 0x0);
101 nvkm_mask(device, 0x640, sb->irq_mask, 0x0);
102 nvkm_wr32(device, sb->base + 0x014, 0xff);
103
104 falcon_wait_idle(device, sb->base);
105
106 /* disable engine */
107 nvkm_mask(device, 0x200, sb->enable_mask, 0x0);
108
109 return 0;
110}
111
112int
113nvkm_secboot_falcon_reset(struct nvkm_secboot *sb)
114{
115 int ret;
116
117 ret = nvkm_secboot_falcon_disable(sb);
118 if (ret)
119 return ret;
120
121 ret = nvkm_secboot_falcon_enable(sb);
122 if (ret)
123 return ret;
124
125 return 0;
126}
127
128/**
129 * nvkm_secboot_falcon_run - run the falcon that will perform secure boot
130 *
131 * This function is to be called after all chip-specific preparations have
132 * been completed. It will start the falcon to perform secure boot, wait for
133 * it to halt, and report if an error occurred.
134 */
135int
136nvkm_secboot_falcon_run(struct nvkm_secboot *sb)
137{
138 struct nvkm_device *device = sb->subdev.device;
139 int ret;
140
141 /* Start falcon */
142 nvkm_wr32(device, sb->base + 0x100, 0x2);
143
144 /* Wait for falcon halt */
145 ret = nvkm_wait_msec(device, 100, sb->base + 0x100, 0x10, 0x10);
146 if (ret < 0)
147 return ret;
148
149 /* If mailbox register contains an error code, then ACR has failed */
150 ret = nvkm_rd32(device, sb->base + 0x040);
151 if (ret) {
152 nvkm_error(&sb->subdev, "ACR boot failed, ret 0x%08x", ret);
153 falcon_clear_halt_interrupt(device, sb->base);
154 return -EINVAL;
155 }
156
157 return 0;
158}
159
160
161/**
162 * nvkm_secboot_reset() - reset specified falcon
163 */
164int
165nvkm_secboot_reset(struct nvkm_secboot *sb, u32 falcon)
166{
167 /* Unmanaged falcon? */
168 if (!(BIT(falcon) & sb->func->managed_falcons)) {
169 nvkm_error(&sb->subdev, "cannot reset unmanaged falcon!\n");
170 return -EINVAL;
171 }
172
173 return sb->func->reset(sb, falcon);
174}
175
176/**
177 * nvkm_secboot_start() - start specified falcon
178 */
179int
180nvkm_secboot_start(struct nvkm_secboot *sb, u32 falcon)
181{
182 /* Unmanaged falcon? */
183 if (!(BIT(falcon) & sb->func->managed_falcons)) {
184 nvkm_error(&sb->subdev, "cannot start unmanaged falcon!\n");
185 return -EINVAL;
186 }
187
188 return sb->func->start(sb, falcon);
189}
190
191/**
192 * nvkm_secboot_is_managed() - check whether a given falcon is securely-managed
193 */
194bool
195nvkm_secboot_is_managed(struct nvkm_secboot *secboot,
196 enum nvkm_secboot_falcon fid)
197{
198 if (!secboot)
199 return false;
200
201 return secboot->func->managed_falcons & BIT(fid);
202}
203
204static int
205nvkm_secboot_oneinit(struct nvkm_subdev *subdev)
206{
207 struct nvkm_secboot *sb = nvkm_secboot(subdev);
208 int ret = 0;
209
210 /* Call chip-specific init function */
211 if (sb->func->init)
212 ret = sb->func->init(sb);
213 if (ret) {
214 nvkm_error(subdev, "Secure Boot initialization failed: %d\n",
215 ret);
216 return ret;
217 }
218
219 /*
220 * Build all blobs - the same blobs can be used to perform secure boot
221 * multiple times
222 */
223 if (sb->func->prepare_blobs)
224 ret = sb->func->prepare_blobs(sb);
225
226 return ret;
227}
228
229static int
230nvkm_secboot_fini(struct nvkm_subdev *subdev, bool suspend)
231{
232 struct nvkm_secboot *sb = nvkm_secboot(subdev);
233 int ret = 0;
234
235 if (sb->func->fini)
236 ret = sb->func->fini(sb, suspend);
237
238 return ret;
239}
240
241static void *
242nvkm_secboot_dtor(struct nvkm_subdev *subdev)
243{
244 struct nvkm_secboot *sb = nvkm_secboot(subdev);
245 void *ret = NULL;
246
247 if (sb->func->dtor)
248 ret = sb->func->dtor(sb);
249
250 return ret;
251}
252
253static const struct nvkm_subdev_func
254nvkm_secboot = {
255 .oneinit = nvkm_secboot_oneinit,
256 .fini = nvkm_secboot_fini,
257 .dtor = nvkm_secboot_dtor,
258};
259
260int
261nvkm_secboot_ctor(const struct nvkm_secboot_func *func,
262 struct nvkm_device *device, int index,
263 struct nvkm_secboot *sb)
264{
265 unsigned long fid;
266
267 nvkm_subdev_ctor(&nvkm_secboot, device, index, 0, &sb->subdev);
268 sb->func = func;
269
270 /* setup the performing falcon's base address and masks */
271 switch (func->boot_falcon) {
272 case NVKM_SECBOOT_FALCON_PMU:
273 sb->base = 0x10a000;
274 sb->irq_mask = 0x1000000;
275 sb->enable_mask = 0x2000;
276 break;
277 default:
278 nvkm_error(&sb->subdev, "invalid secure boot falcon\n");
279 return -EINVAL;
280 };
281
282 nvkm_debug(&sb->subdev, "securely managed falcons:\n");
283 for_each_set_bit(fid, &sb->func->managed_falcons,
284 NVKM_SECBOOT_FALCON_END)
285 nvkm_debug(&sb->subdev, "- %s\n", managed_falcons_names[fid]);
286
287 return 0;
288}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm200.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm200.c
new file mode 100644
index 000000000000..cc100dc940ea
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm200.c
@@ -0,0 +1,1489 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23/*
24 * Secure boot is the process by which NVIDIA-signed firmware is loaded into
25 * some of the falcons of a GPU. For production devices this is the only way
26 * for the firmware to access useful (but sensitive) registers.
27 *
28 * A Falcon microprocessor supporting advanced security modes can run in one of
29 * three modes:
30 *
31 * - Non-secure (NS). In this mode, functionality is similar to Falcon
32 * architectures before security modes were introduced (pre-Maxwell), but
33 * capability is restricted. In particular, certain registers may be
34 * inaccessible for reads and/or writes, and physical memory access may be
35 * disabled (on certain Falcon instances). This is the only possible mode that
36 * can be used if you don't have microcode cryptographically signed by NVIDIA.
37 *
38 * - Heavy Secure (HS). In this mode, the microprocessor is a black box - it's
39 * not possible to read or write any Falcon internal state or Falcon registers
40 * from outside the Falcon (for example, from the host system). The only way
41 * to enable this mode is by loading microcode that has been signed by NVIDIA.
42 * (The loading process involves tagging the IMEM block as secure, writing the
43 * signature into a Falcon register, and starting execution. The hardware will
44 * validate the signature, and if valid, grant HS privileges.)
45 *
46 * - Light Secure (LS). In this mode, the microprocessor has more privileges
47 * than NS but fewer than HS. Some of the microprocessor state is visible to
48 * host software to ease debugging. The only way to enable this mode is by HS
49 * microcode enabling LS mode. Some privileges available to HS mode are not
50 * available here. LS mode is introduced in GM20x.
51 *
52 * Secure boot consists in temporarily switching a HS-capable falcon (typically
53 * PMU) into HS mode in order to validate the LS firmwares of managed falcons,
54 * load them, and switch managed falcons into LS mode. Once secure boot
55 * completes, no falcon remains in HS mode.
56 *
57 * Secure boot requires a write-protected memory region (WPR) which can only be
58 * written by the secure falcon. On dGPU, the driver sets up the WPR region in
59 * video memory. On Tegra, it is set up by the bootloader and its location and
60 * size written into memory controller registers.
61 *
62 * The secure boot process takes place as follows:
63 *
64 * 1) A LS blob is constructed that contains all the LS firmwares we want to
65 * load, along with their signatures and bootloaders.
66 *
67 * 2) A HS blob (also called ACR) is created that contains the signed HS
68 * firmware in charge of loading the LS firmwares into their respective
69 * falcons.
70 *
71 * 3) The HS blob is loaded (via its own bootloader) and executed on the
72 * HS-capable falcon. It authenticates itself, switches the secure falcon to
73 * HS mode and setup the WPR region around the LS blob (dGPU) or copies the
74 * LS blob into the WPR region (Tegra).
75 *
76 * 4) The LS blob is now secure from all external tampering. The HS falcon
77 * checks the signatures of the LS firmwares and, if valid, switches the
78 * managed falcons to LS mode and makes them ready to run the LS firmware.
79 *
80 * 5) The managed falcons remain in LS mode and can be started.
81 *
82 */
83
84#include "priv.h"
85
86#include <core/gpuobj.h>
87#include <core/firmware.h>
88#include <subdev/fb.h>
89
90enum {
91 FALCON_DMAIDX_UCODE = 0,
92 FALCON_DMAIDX_VIRT = 1,
93 FALCON_DMAIDX_PHYS_VID = 2,
94 FALCON_DMAIDX_PHYS_SYS_COH = 3,
95 FALCON_DMAIDX_PHYS_SYS_NCOH = 4,
96};
97
98/**
99 * struct fw_bin_header - header of firmware files
100 * @bin_magic: always 0x3b1d14f0
101 * @bin_ver: version of the bin format
102 * @bin_size: entire image size including this header
103 * @header_offset: offset of the firmware/bootloader header in the file
104 * @data_offset: offset of the firmware/bootloader payload in the file
105 * @data_size: size of the payload
106 *
107 * This header is located at the beginning of the HS firmware and HS bootloader
108 * files, to describe where the headers and data can be found.
109 */
110struct fw_bin_header {
111 u32 bin_magic;
112 u32 bin_ver;
113 u32 bin_size;
114 u32 header_offset;
115 u32 data_offset;
116 u32 data_size;
117};
118
119/**
120 * struct fw_bl_desc - firmware bootloader descriptor
121 * @start_tag: starting tag of bootloader
122 * @desc_dmem_load_off: DMEM offset of flcn_bl_dmem_desc
123 * @code_off: offset of code section
124 * @code_size: size of code section
125 * @data_off: offset of data section
126 * @data_size: size of data section
127 *
128 * This structure is embedded in bootloader firmware files at to describe the
129 * IMEM and DMEM layout expected by the bootloader.
130 */
131struct fw_bl_desc {
132 u32 start_tag;
133 u32 dmem_load_off;
134 u32 code_off;
135 u32 code_size;
136 u32 data_off;
137 u32 data_size;
138};
139
140
141/*
142 *
143 * LS blob structures
144 *
145 */
146
147/**
148 * struct lsf_ucode_desc - LS falcon signatures
149 * @prd_keys: signature to use when the GPU is in production mode
150 * @dgb_keys: signature to use when the GPU is in debug mode
151 * @b_prd_present: whether the production key is present
152 * @b_dgb_present: whether the debug key is present
153 * @falcon_id: ID of the falcon the ucode applies to
154 *
155 * Directly loaded from a signature file.
156 */
157struct lsf_ucode_desc {
158 u8 prd_keys[2][16];
159 u8 dbg_keys[2][16];
160 u32 b_prd_present;
161 u32 b_dbg_present;
162 u32 falcon_id;
163};
164
165/**
166 * struct lsf_lsb_header - LS firmware header
167 * @signature: signature to verify the firmware against
168 * @ucode_off: offset of the ucode blob in the WPR region. The ucode
169 * blob contains the bootloader, code and data of the
170 * LS falcon
171 * @ucode_size: size of the ucode blob, including bootloader
172 * @data_size: size of the ucode blob data
173 * @bl_code_size: size of the bootloader code
174 * @bl_imem_off: offset in imem of the bootloader
175 * @bl_data_off: offset of the bootloader data in WPR region
176 * @bl_data_size: size of the bootloader data
177 * @app_code_off: offset of the app code relative to ucode_off
178 * @app_code_size: size of the app code
179 * @app_data_off: offset of the app data relative to ucode_off
180 * @app_data_size: size of the app data
181 * @flags: flags for the secure bootloader
182 *
183 * This structure is written into the WPR region for each managed falcon. Each
184 * instance is referenced by the lsb_offset member of the corresponding
185 * lsf_wpr_header.
186 */
187struct lsf_lsb_header {
188 struct lsf_ucode_desc signature;
189 u32 ucode_off;
190 u32 ucode_size;
191 u32 data_size;
192 u32 bl_code_size;
193 u32 bl_imem_off;
194 u32 bl_data_off;
195 u32 bl_data_size;
196 u32 app_code_off;
197 u32 app_code_size;
198 u32 app_data_off;
199 u32 app_data_size;
200 u32 flags;
201#define LSF_FLAG_LOAD_CODE_AT_0 1
202#define LSF_FLAG_DMACTL_REQ_CTX 4
203#define LSF_FLAG_FORCE_PRIV_LOAD 8
204};
205
206/**
207 * struct lsf_wpr_header - LS blob WPR Header
208 * @falcon_id: LS falcon ID
209 * @lsb_offset: offset of the lsb_lsf_header in the WPR region
210 * @bootstrap_owner: secure falcon reponsible for bootstrapping the LS falcon
211 * @lazy_bootstrap: skip bootstrapping by ACR
212 * @status: bootstrapping status
213 *
214 * An array of these is written at the beginning of the WPR region, one for
215 * each managed falcon. The array is terminated by an instance which falcon_id
216 * is LSF_FALCON_ID_INVALID.
217 */
218struct lsf_wpr_header {
219 u32 falcon_id;
220 u32 lsb_offset;
221 u32 bootstrap_owner;
222 u32 lazy_bootstrap;
223 u32 status;
224#define LSF_IMAGE_STATUS_NONE 0
225#define LSF_IMAGE_STATUS_COPY 1
226#define LSF_IMAGE_STATUS_VALIDATION_CODE_FAILED 2
227#define LSF_IMAGE_STATUS_VALIDATION_DATA_FAILED 3
228#define LSF_IMAGE_STATUS_VALIDATION_DONE 4
229#define LSF_IMAGE_STATUS_VALIDATION_SKIPPED 5
230#define LSF_IMAGE_STATUS_BOOTSTRAP_READY 6
231};
232
233
234/**
235 * struct ls_ucode_img_desc - descriptor of firmware image
236 * @descriptor_size: size of this descriptor
237 * @image_size: size of the whole image
238 * @bootloader_start_offset: start offset of the bootloader in ucode image
239 * @bootloader_size: size of the bootloader
240 * @bootloader_imem_offset: start off set of the bootloader in IMEM
241 * @bootloader_entry_point: entry point of the bootloader in IMEM
242 * @app_start_offset: start offset of the LS firmware
243 * @app_size: size of the LS firmware's code and data
244 * @app_imem_offset: offset of the app in IMEM
245 * @app_imem_entry: entry point of the app in IMEM
246 * @app_dmem_offset: offset of the data in DMEM
247 * @app_resident_code_offset: offset of app code from app_start_offset
248 * @app_resident_code_size: size of the code
249 * @app_resident_data_offset: offset of data from app_start_offset
250 * @app_resident_data_size: size of data
251 *
252 * A firmware image contains the code, data, and bootloader of a given LS
253 * falcon in a single blob. This structure describes where everything is.
254 *
255 * This can be generated from a (bootloader, code, data) set if they have
256 * been loaded separately, or come directly from a file.
257 */
258struct ls_ucode_img_desc {
259 u32 descriptor_size;
260 u32 image_size;
261 u32 tools_version;
262 u32 app_version;
263 char date[64];
264 u32 bootloader_start_offset;
265 u32 bootloader_size;
266 u32 bootloader_imem_offset;
267 u32 bootloader_entry_point;
268 u32 app_start_offset;
269 u32 app_size;
270 u32 app_imem_offset;
271 u32 app_imem_entry;
272 u32 app_dmem_offset;
273 u32 app_resident_code_offset;
274 u32 app_resident_code_size;
275 u32 app_resident_data_offset;
276 u32 app_resident_data_size;
277 u32 nb_overlays;
278 struct {u32 start; u32 size; } load_ovl[64];
279 u32 compressed;
280};
281
282/**
283 * struct ls_ucode_img - temporary storage for loaded LS firmwares
284 * @node: to link within lsf_ucode_mgr
285 * @falcon_id: ID of the falcon this LS firmware is for
286 * @ucode_desc: loaded or generated map of ucode_data
287 * @ucode_header: header of the firmware
288 * @ucode_data: firmware payload (code and data)
289 * @ucode_size: size in bytes of data in ucode_data
290 * @wpr_header: WPR header to be written to the LS blob
291 * @lsb_header: LSB header to be written to the LS blob
292 *
293 * Preparing the WPR LS blob requires information about all the LS firmwares
294 * (size, etc) to be known. This structure contains all the data of one LS
295 * firmware.
296 */
297struct ls_ucode_img {
298 struct list_head node;
299 enum nvkm_secboot_falcon falcon_id;
300
301 struct ls_ucode_img_desc ucode_desc;
302 u32 *ucode_header;
303 u8 *ucode_data;
304 u32 ucode_size;
305
306 struct lsf_wpr_header wpr_header;
307 struct lsf_lsb_header lsb_header;
308};
309
310/**
311 * struct ls_ucode_mgr - manager for all LS falcon firmwares
312 * @count: number of managed LS falcons
313 * @wpr_size: size of the required WPR region in bytes
314 * @img_list: linked list of lsf_ucode_img
315 */
316struct ls_ucode_mgr {
317 u16 count;
318 u32 wpr_size;
319 struct list_head img_list;
320};
321
322
323/*
324 *
325 * HS blob structures
326 *
327 */
328
329/**
330 * struct hsf_fw_header - HS firmware descriptor
331 * @sig_dbg_offset: offset of the debug signature
332 * @sig_dbg_size: size of the debug signature
333 * @sig_prod_offset: offset of the production signature
334 * @sig_prod_size: size of the production signature
335 * @patch_loc: offset of the offset (sic) of where the signature is
336 * @patch_sig: offset of the offset (sic) to add to sig_*_offset
337 * @hdr_offset: offset of the load header (see struct hs_load_header)
338 * @hdr_size: size of above header
339 *
340 * This structure is embedded in the HS firmware image at
341 * hs_bin_hdr.header_offset.
342 */
343struct hsf_fw_header {
344 u32 sig_dbg_offset;
345 u32 sig_dbg_size;
346 u32 sig_prod_offset;
347 u32 sig_prod_size;
348 u32 patch_loc;
349 u32 patch_sig;
350 u32 hdr_offset;
351 u32 hdr_size;
352};
353
354/**
355 * struct hsf_load_header - HS firmware load header
356 */
357struct hsf_load_header {
358 u32 non_sec_code_off;
359 u32 non_sec_code_size;
360 u32 data_dma_base;
361 u32 data_size;
362 u32 num_apps;
363 struct {
364 u32 sec_code_off;
365 u32 sec_code_size;
366 } app[0];
367};
368
369/**
370 * Convenience function to duplicate a firmware file in memory and check that
371 * it has the required minimum size.
372 */
373static void *
374gm200_secboot_load_firmware(struct nvkm_subdev *subdev, const char *name,
375 size_t min_size)
376{
377 const struct firmware *fw;
378 void *blob;
379 int ret;
380
381 ret = nvkm_firmware_get(subdev->device, name, &fw);
382 if (ret)
383 return ERR_PTR(ret);
384 if (fw->size < min_size) {
385 nvkm_error(subdev, "%s is smaller than expected size %zu\n",
386 name, min_size);
387 nvkm_firmware_put(fw);
388 return ERR_PTR(-EINVAL);
389 }
390 blob = kmemdup(fw->data, fw->size, GFP_KERNEL);
391 nvkm_firmware_put(fw);
392 if (!blob)
393 return ERR_PTR(-ENOMEM);
394
395 return blob;
396}
397
398
399/*
400 * Low-secure blob creation
401 */
402
403#define BL_DESC_BLK_SIZE 256
404/**
405 * Build a ucode image and descriptor from provided bootloader, code and data.
406 *
407 * @bl: bootloader image, including 16-bytes descriptor
408 * @code: LS firmware code segment
409 * @data: LS firmware data segment
410 * @desc: ucode descriptor to be written
411 *
412 * Return: allocated ucode image with corresponding descriptor information. desc
413 * is also updated to contain the right offsets within returned image.
414 */
415static void *
416ls_ucode_img_build(const struct firmware *bl, const struct firmware *code,
417 const struct firmware *data, struct ls_ucode_img_desc *desc)
418{
419 struct fw_bin_header *bin_hdr = (void *)bl->data;
420 struct fw_bl_desc *bl_desc = (void *)bl->data + bin_hdr->header_offset;
421 void *bl_data = (void *)bl->data + bin_hdr->data_offset;
422 u32 pos = 0;
423 void *image;
424
425 desc->bootloader_start_offset = pos;
426 desc->bootloader_size = ALIGN(bl_desc->code_size, sizeof(u32));
427 desc->bootloader_imem_offset = bl_desc->start_tag * 256;
428 desc->bootloader_entry_point = bl_desc->start_tag * 256;
429
430 pos = ALIGN(pos + desc->bootloader_size, BL_DESC_BLK_SIZE);
431 desc->app_start_offset = pos;
432 desc->app_size = ALIGN(code->size, BL_DESC_BLK_SIZE) +
433 ALIGN(data->size, BL_DESC_BLK_SIZE);
434 desc->app_imem_offset = 0;
435 desc->app_imem_entry = 0;
436 desc->app_dmem_offset = 0;
437 desc->app_resident_code_offset = 0;
438 desc->app_resident_code_size = ALIGN(code->size, BL_DESC_BLK_SIZE);
439
440 pos = ALIGN(pos + desc->app_resident_code_size, BL_DESC_BLK_SIZE);
441 desc->app_resident_data_offset = pos - desc->app_start_offset;
442 desc->app_resident_data_size = ALIGN(data->size, BL_DESC_BLK_SIZE);
443
444 desc->image_size = ALIGN(bl_desc->code_size, BL_DESC_BLK_SIZE) +
445 desc->app_size;
446
447 image = kzalloc(desc->image_size, GFP_KERNEL);
448 if (!image)
449 return ERR_PTR(-ENOMEM);
450
451 memcpy(image + desc->bootloader_start_offset, bl_data,
452 bl_desc->code_size);
453 memcpy(image + desc->app_start_offset, code->data, code->size);
454 memcpy(image + desc->app_start_offset + desc->app_resident_data_offset,
455 data->data, data->size);
456
457 return image;
458}
459
460/**
461 * ls_ucode_img_load_generic() - load and prepare a LS ucode image
462 *
463 * Load the LS microcode, bootloader and signature and pack them into a single
464 * blob. Also generate the corresponding ucode descriptor.
465 */
466static int
467ls_ucode_img_load_generic(struct nvkm_subdev *subdev,
468 struct ls_ucode_img *img, const char *falcon_name,
469 const u32 falcon_id)
470{
471 const struct firmware *bl, *code, *data;
472 struct lsf_ucode_desc *lsf_desc;
473 char f[64];
474 int ret;
475
476 img->ucode_header = NULL;
477
478 snprintf(f, sizeof(f), "gr/%s_bl", falcon_name);
479 ret = nvkm_firmware_get(subdev->device, f, &bl);
480 if (ret)
481 goto error;
482
483 snprintf(f, sizeof(f), "gr/%s_inst", falcon_name);
484 ret = nvkm_firmware_get(subdev->device, f, &code);
485 if (ret)
486 goto free_bl;
487
488 snprintf(f, sizeof(f), "gr/%s_data", falcon_name);
489 ret = nvkm_firmware_get(subdev->device, f, &data);
490 if (ret)
491 goto free_inst;
492
493 img->ucode_data = ls_ucode_img_build(bl, code, data,
494 &img->ucode_desc);
495 if (IS_ERR(img->ucode_data)) {
496 ret = PTR_ERR(img->ucode_data);
497 goto free_data;
498 }
499 img->ucode_size = img->ucode_desc.image_size;
500
501 snprintf(f, sizeof(f), "gr/%s_sig", falcon_name);
502 lsf_desc = gm200_secboot_load_firmware(subdev, f, sizeof(*lsf_desc));
503 if (IS_ERR(lsf_desc)) {
504 ret = PTR_ERR(lsf_desc);
505 goto free_image;
506 }
507 /* not needed? the signature should already have the right value */
508 lsf_desc->falcon_id = falcon_id;
509 memcpy(&img->lsb_header.signature, lsf_desc, sizeof(*lsf_desc));
510 img->falcon_id = lsf_desc->falcon_id;
511 kfree(lsf_desc);
512
513 /* success path - only free requested firmware files */
514 goto free_data;
515
516free_image:
517 kfree(img->ucode_data);
518free_data:
519 nvkm_firmware_put(data);
520free_inst:
521 nvkm_firmware_put(code);
522free_bl:
523 nvkm_firmware_put(bl);
524error:
525 return ret;
526}
527
528typedef int (*lsf_load_func)(struct nvkm_subdev *, struct ls_ucode_img *);
529
530static int
531ls_ucode_img_load_fecs(struct nvkm_subdev *subdev, struct ls_ucode_img *img)
532{
533 return ls_ucode_img_load_generic(subdev, img, "fecs",
534 NVKM_SECBOOT_FALCON_FECS);
535}
536
537static int
538ls_ucode_img_load_gpccs(struct nvkm_subdev *subdev, struct ls_ucode_img *img)
539{
540 return ls_ucode_img_load_generic(subdev, img, "gpccs",
541 NVKM_SECBOOT_FALCON_GPCCS);
542}
543
544/**
545 * ls_ucode_img_load() - create a lsf_ucode_img and load it
546 */
547static struct ls_ucode_img *
548ls_ucode_img_load(struct nvkm_subdev *subdev, lsf_load_func load_func)
549{
550 struct ls_ucode_img *img;
551 int ret;
552
553 img = kzalloc(sizeof(*img), GFP_KERNEL);
554 if (!img)
555 return ERR_PTR(-ENOMEM);
556
557 ret = load_func(subdev, img);
558 if (ret) {
559 kfree(img);
560 return ERR_PTR(ret);
561 }
562
563 return img;
564}
565
566static const lsf_load_func lsf_load_funcs[] = {
567 [NVKM_SECBOOT_FALCON_END] = NULL, /* reserve enough space */
568 [NVKM_SECBOOT_FALCON_FECS] = ls_ucode_img_load_fecs,
569 [NVKM_SECBOOT_FALCON_GPCCS] = ls_ucode_img_load_gpccs,
570};
571
572/**
573 * ls_ucode_img_populate_bl_desc() - populate a DMEM BL descriptor for LS image
574 * @img: ucode image to generate against
575 * @desc: descriptor to populate
576 * @sb: secure boot state to use for base addresses
577 *
578 * Populate the DMEM BL descriptor with the information contained in a
579 * ls_ucode_desc.
580 *
581 */
582static void
583ls_ucode_img_populate_bl_desc(struct ls_ucode_img *img, u64 wpr_addr,
584 struct gm200_flcn_bl_desc *desc)
585{
586 struct ls_ucode_img_desc *pdesc = &img->ucode_desc;
587 u64 addr_base;
588
589 addr_base = wpr_addr + img->lsb_header.ucode_off +
590 pdesc->app_start_offset;
591
592 memset(desc, 0, sizeof(*desc));
593 desc->ctx_dma = FALCON_DMAIDX_UCODE;
594 desc->code_dma_base.lo = lower_32_bits(
595 (addr_base + pdesc->app_resident_code_offset));
596 desc->code_dma_base.hi = upper_32_bits(
597 (addr_base + pdesc->app_resident_code_offset));
598 desc->non_sec_code_size = pdesc->app_resident_code_size;
599 desc->data_dma_base.lo = lower_32_bits(
600 (addr_base + pdesc->app_resident_data_offset));
601 desc->data_dma_base.hi = upper_32_bits(
602 (addr_base + pdesc->app_resident_data_offset));
603 desc->data_size = pdesc->app_resident_data_size;
604 desc->code_entry_point = pdesc->app_imem_entry;
605}
606
607#define LSF_LSB_HEADER_ALIGN 256
608#define LSF_BL_DATA_ALIGN 256
609#define LSF_BL_DATA_SIZE_ALIGN 256
610#define LSF_BL_CODE_SIZE_ALIGN 256
611#define LSF_UCODE_DATA_ALIGN 4096
612
613/**
614 * ls_ucode_img_fill_headers - fill the WPR and LSB headers of an image
615 * @gsb: secure boot device used
616 * @img: image to generate for
617 * @offset: offset in the WPR region where this image starts
618 *
619 * Allocate space in the WPR area from offset and write the WPR and LSB headers
620 * accordingly.
621 *
622 * Return: offset at the end of this image.
623 */
624static u32
625ls_ucode_img_fill_headers(struct gm200_secboot *gsb, struct ls_ucode_img *img,
626 u32 offset)
627{
628 struct lsf_wpr_header *whdr = &img->wpr_header;
629 struct lsf_lsb_header *lhdr = &img->lsb_header;
630 struct ls_ucode_img_desc *desc = &img->ucode_desc;
631
632 if (img->ucode_header) {
633 nvkm_fatal(&gsb->base.subdev,
634 "images withough loader are not supported yet!\n");
635 return offset;
636 }
637
638 /* Fill WPR header */
639 whdr->falcon_id = img->falcon_id;
640 whdr->bootstrap_owner = gsb->base.func->boot_falcon;
641 whdr->status = LSF_IMAGE_STATUS_COPY;
642
643 /* Align, save off, and include an LSB header size */
644 offset = ALIGN(offset, LSF_LSB_HEADER_ALIGN);
645 whdr->lsb_offset = offset;
646 offset += sizeof(struct lsf_lsb_header);
647
648 /*
649 * Align, save off, and include the original (static) ucode
650 * image size
651 */
652 offset = ALIGN(offset, LSF_UCODE_DATA_ALIGN);
653 lhdr->ucode_off = offset;
654 offset += img->ucode_size;
655
656 /*
657 * For falcons that use a boot loader (BL), we append a loader
658 * desc structure on the end of the ucode image and consider
659 * this the boot loader data. The host will then copy the loader
660 * desc args to this space within the WPR region (before locking
661 * down) and the HS bin will then copy them to DMEM 0 for the
662 * loader.
663 */
664 lhdr->bl_code_size = ALIGN(desc->bootloader_size,
665 LSF_BL_CODE_SIZE_ALIGN);
666 lhdr->ucode_size = ALIGN(desc->app_resident_data_offset,
667 LSF_BL_CODE_SIZE_ALIGN) + lhdr->bl_code_size;
668 lhdr->data_size = ALIGN(desc->app_size, LSF_BL_CODE_SIZE_ALIGN) +
669 lhdr->bl_code_size - lhdr->ucode_size;
670 /*
671 * Though the BL is located at 0th offset of the image, the VA
672 * is different to make sure that it doesn't collide the actual
673 * OS VA range
674 */
675 lhdr->bl_imem_off = desc->bootloader_imem_offset;
676 lhdr->app_code_off = desc->app_start_offset +
677 desc->app_resident_code_offset;
678 lhdr->app_code_size = desc->app_resident_code_size;
679 lhdr->app_data_off = desc->app_start_offset +
680 desc->app_resident_data_offset;
681 lhdr->app_data_size = desc->app_resident_data_size;
682
683 lhdr->flags = 0;
684 if (img->falcon_id == gsb->base.func->boot_falcon)
685 lhdr->flags = LSF_FLAG_DMACTL_REQ_CTX;
686
687 /* GPCCS will be loaded using PRI */
688 if (img->falcon_id == NVKM_SECBOOT_FALCON_GPCCS)
689 lhdr->flags |= LSF_FLAG_FORCE_PRIV_LOAD;
690
691 /* Align (size bloat) and save off BL descriptor size */
692 lhdr->bl_data_size = ALIGN(sizeof(struct gm200_flcn_bl_desc),
693 LSF_BL_DATA_SIZE_ALIGN);
694 /*
695 * Align, save off, and include the additional BL data
696 */
697 offset = ALIGN(offset, LSF_BL_DATA_ALIGN);
698 lhdr->bl_data_off = offset;
699 offset += lhdr->bl_data_size;
700
701 return offset;
702}
703
704static void
705ls_ucode_mgr_init(struct ls_ucode_mgr *mgr)
706{
707 memset(mgr, 0, sizeof(*mgr));
708 INIT_LIST_HEAD(&mgr->img_list);
709}
710
711static void
712ls_ucode_mgr_cleanup(struct ls_ucode_mgr *mgr)
713{
714 struct ls_ucode_img *img, *t;
715
716 list_for_each_entry_safe(img, t, &mgr->img_list, node) {
717 kfree(img->ucode_data);
718 kfree(img->ucode_header);
719 kfree(img);
720 }
721}
722
723static void
724ls_ucode_mgr_add_img(struct ls_ucode_mgr *mgr, struct ls_ucode_img *img)
725{
726 mgr->count++;
727 list_add_tail(&img->node, &mgr->img_list);
728}
729
730/**
731 * ls_ucode_mgr_fill_headers - fill WPR and LSB headers of all managed images
732 */
733static void
734ls_ucode_mgr_fill_headers(struct gm200_secboot *gsb, struct ls_ucode_mgr *mgr)
735{
736 struct ls_ucode_img *img;
737 u32 offset;
738
739 /*
740 * Start with an array of WPR headers at the base of the WPR.
741 * The expectation here is that the secure falcon will do a single DMA
742 * read of this array and cache it internally so it's ok to pack these.
743 * Also, we add 1 to the falcon count to indicate the end of the array.
744 */
745 offset = sizeof(struct lsf_wpr_header) * (mgr->count + 1);
746
747 /*
748 * Walk the managed falcons, accounting for the LSB structs
749 * as well as the ucode images.
750 */
751 list_for_each_entry(img, &mgr->img_list, node) {
752 offset = ls_ucode_img_fill_headers(gsb, img, offset);
753 }
754
755 mgr->wpr_size = offset;
756}
757
758/**
759 * ls_ucode_mgr_write_wpr - write the WPR blob contents
760 */
761static int
762ls_ucode_mgr_write_wpr(struct gm200_secboot *gsb, struct ls_ucode_mgr *mgr,
763 struct nvkm_gpuobj *wpr_blob)
764{
765 struct ls_ucode_img *img;
766 u32 pos = 0;
767
768 nvkm_kmap(wpr_blob);
769
770 list_for_each_entry(img, &mgr->img_list, node) {
771 nvkm_gpuobj_memcpy_to(wpr_blob, pos, &img->wpr_header,
772 sizeof(img->wpr_header));
773
774 nvkm_gpuobj_memcpy_to(wpr_blob, img->wpr_header.lsb_offset,
775 &img->lsb_header, sizeof(img->lsb_header));
776
777 /* Generate and write BL descriptor */
778 if (!img->ucode_header) {
779 u8 desc[gsb->func->bl_desc_size];
780 struct gm200_flcn_bl_desc gdesc;
781
782 ls_ucode_img_populate_bl_desc(img, gsb->wpr_addr,
783 &gdesc);
784 gsb->func->fixup_bl_desc(&gdesc, &desc);
785 nvkm_gpuobj_memcpy_to(wpr_blob,
786 img->lsb_header.bl_data_off,
787 &desc, gsb->func->bl_desc_size);
788 }
789
790 /* Copy ucode */
791 nvkm_gpuobj_memcpy_to(wpr_blob, img->lsb_header.ucode_off,
792 img->ucode_data, img->ucode_size);
793
794 pos += sizeof(img->wpr_header);
795 }
796
797 nvkm_wo32(wpr_blob, pos, NVKM_SECBOOT_FALCON_INVALID);
798
799 nvkm_done(wpr_blob);
800
801 return 0;
802}
803
804/* Both size and address of WPR need to be 128K-aligned */
805#define WPR_ALIGNMENT 0x20000
806/**
807 * gm200_secboot_prepare_ls_blob() - prepare the LS blob
808 *
809 * For each securely managed falcon, load the FW, signatures and bootloaders and
810 * prepare a ucode blob. Then, compute the offsets in the WPR region for each
811 * blob, and finally write the headers and ucode blobs into a GPU object that
812 * will be copied into the WPR region by the HS firmware.
813 */
814static int
815gm200_secboot_prepare_ls_blob(struct gm200_secboot *gsb)
816{
817 struct nvkm_secboot *sb = &gsb->base;
818 struct nvkm_device *device = sb->subdev.device;
819 struct ls_ucode_mgr mgr;
820 int falcon_id;
821 int ret;
822
823 ls_ucode_mgr_init(&mgr);
824
825 /* Load all LS blobs */
826 for_each_set_bit(falcon_id, &gsb->base.func->managed_falcons,
827 NVKM_SECBOOT_FALCON_END) {
828 struct ls_ucode_img *img;
829
830 img = ls_ucode_img_load(&sb->subdev, lsf_load_funcs[falcon_id]);
831
832 if (IS_ERR(img)) {
833 ret = PTR_ERR(img);
834 goto cleanup;
835 }
836 ls_ucode_mgr_add_img(&mgr, img);
837 }
838
839 /*
840 * Fill the WPR and LSF headers with the right offsets and compute
841 * required WPR size
842 */
843 ls_ucode_mgr_fill_headers(gsb, &mgr);
844 mgr.wpr_size = ALIGN(mgr.wpr_size, WPR_ALIGNMENT);
845
846 /* Allocate GPU object that will contain the WPR region */
847 ret = nvkm_gpuobj_new(device, mgr.wpr_size, WPR_ALIGNMENT, false, NULL,
848 &gsb->ls_blob);
849 if (ret)
850 goto cleanup;
851
852 nvkm_debug(&sb->subdev, "%d managed LS falcons, WPR size is %d bytes\n",
853 mgr.count, mgr.wpr_size);
854
855 /* If WPR address and size are not fixed, set them to fit the LS blob */
856 if (!gsb->wpr_size) {
857 gsb->wpr_addr = gsb->ls_blob->addr;
858 gsb->wpr_size = gsb->ls_blob->size;
859 }
860
861 /* Write LS blob */
862 ret = ls_ucode_mgr_write_wpr(gsb, &mgr, gsb->ls_blob);
863
864cleanup:
865 ls_ucode_mgr_cleanup(&mgr);
866
867 return ret;
868}
869
870/*
871 * High-secure blob creation
872 */
873
874/**
875 * gm200_secboot_hsf_patch_signature() - patch HS blob with correct signature
876 */
877static void
878gm200_secboot_hsf_patch_signature(struct gm200_secboot *gsb, void *acr_image)
879{
880 struct nvkm_secboot *sb = &gsb->base;
881 struct fw_bin_header *hsbin_hdr = acr_image;
882 struct hsf_fw_header *fw_hdr = acr_image + hsbin_hdr->header_offset;
883 void *hs_data = acr_image + hsbin_hdr->data_offset;
884 void *sig;
885 u32 sig_size;
886
887 /* Falcon in debug or production mode? */
888 if ((nvkm_rd32(sb->subdev.device, sb->base + 0xc08) >> 20) & 0x1) {
889 sig = acr_image + fw_hdr->sig_dbg_offset;
890 sig_size = fw_hdr->sig_dbg_size;
891 } else {
892 sig = acr_image + fw_hdr->sig_prod_offset;
893 sig_size = fw_hdr->sig_prod_size;
894 }
895
896 /* Patch signature */
897 memcpy(hs_data + fw_hdr->patch_loc, sig + fw_hdr->patch_sig, sig_size);
898}
899
900/**
901 * gm200_secboot_populate_hsf_bl_desc() - populate BL descriptor for HS image
902 */
903static void
904gm200_secboot_populate_hsf_bl_desc(void *acr_image,
905 struct gm200_flcn_bl_desc *bl_desc)
906{
907 struct fw_bin_header *hsbin_hdr = acr_image;
908 struct hsf_fw_header *fw_hdr = acr_image + hsbin_hdr->header_offset;
909 struct hsf_load_header *load_hdr = acr_image + fw_hdr->hdr_offset;
910
911 /*
912 * Descriptor for the bootloader that will load the ACR image into
913 * IMEM/DMEM memory.
914 */
915 fw_hdr = acr_image + hsbin_hdr->header_offset;
916 load_hdr = acr_image + fw_hdr->hdr_offset;
917 memset(bl_desc, 0, sizeof(*bl_desc));
918 bl_desc->ctx_dma = FALCON_DMAIDX_VIRT;
919 bl_desc->non_sec_code_off = load_hdr->non_sec_code_off;
920 bl_desc->non_sec_code_size = load_hdr->non_sec_code_size;
921 bl_desc->sec_code_off = load_hdr->app[0].sec_code_off;
922 bl_desc->sec_code_size = load_hdr->app[0].sec_code_size;
923 bl_desc->code_entry_point = 0;
924 /*
925 * We need to set code_dma_base to the virtual address of the acr_blob,
926 * and add this address to data_dma_base before writing it into DMEM
927 */
928 bl_desc->code_dma_base.lo = 0;
929 bl_desc->data_dma_base.lo = load_hdr->data_dma_base;
930 bl_desc->data_size = load_hdr->data_size;
931}
932
933/**
934 * gm200_secboot_prepare_hs_blob - load and prepare a HS blob and BL descriptor
935 *
936 * @gsb secure boot instance to prepare for
937 * @fw name of the HS firmware to load
938 * @blob pointer to gpuobj that will be allocated to receive the HS FW payload
939 * @bl_desc pointer to the BL descriptor to write for this firmware
940 * @patch whether we should patch the HS descriptor (only for HS loaders)
941 */
942static int
943gm200_secboot_prepare_hs_blob(struct gm200_secboot *gsb, const char *fw,
944 struct nvkm_gpuobj **blob,
945 struct gm200_flcn_bl_desc *bl_desc, bool patch)
946{
947 struct nvkm_subdev *subdev = &gsb->base.subdev;
948 void *acr_image;
949 struct fw_bin_header *hsbin_hdr;
950 struct hsf_fw_header *fw_hdr;
951 void *acr_data;
952 struct hsf_load_header *load_hdr;
953 struct hsflcn_acr_desc *desc;
954 int ret;
955
956 acr_image = gm200_secboot_load_firmware(subdev, fw, 0);
957 if (IS_ERR(acr_image))
958 return PTR_ERR(acr_image);
959 hsbin_hdr = acr_image;
960
961 /* Patch signature */
962 gm200_secboot_hsf_patch_signature(gsb, acr_image);
963
964 acr_data = acr_image + hsbin_hdr->data_offset;
965
966 /* Patch descriptor? */
967 if (patch) {
968 fw_hdr = acr_image + hsbin_hdr->header_offset;
969 load_hdr = acr_image + fw_hdr->hdr_offset;
970 desc = acr_data + load_hdr->data_dma_base;
971 gsb->func->fixup_hs_desc(gsb, desc);
972 }
973
974 /* Generate HS BL descriptor */
975 gm200_secboot_populate_hsf_bl_desc(acr_image, bl_desc);
976
977 /* Create ACR blob and copy HS data to it */
978 ret = nvkm_gpuobj_new(subdev->device, ALIGN(hsbin_hdr->data_size, 256),
979 0x1000, false, NULL, blob);
980 if (ret)
981 goto cleanup;
982
983 nvkm_kmap(*blob);
984 nvkm_gpuobj_memcpy_to(*blob, 0, acr_data, hsbin_hdr->data_size);
985 nvkm_done(*blob);
986
987cleanup:
988 kfree(acr_image);
989
990 return ret;
991}
992
993/*
994 * High-secure bootloader blob creation
995 */
996
997static int
998gm200_secboot_prepare_hsbl_blob(struct gm200_secboot *gsb)
999{
1000 struct nvkm_subdev *subdev = &gsb->base.subdev;
1001
1002 gsb->hsbl_blob = gm200_secboot_load_firmware(subdev, "acr/bl", 0);
1003 if (IS_ERR(gsb->hsbl_blob)) {
1004 int ret = PTR_ERR(gsb->hsbl_blob);
1005
1006 gsb->hsbl_blob = NULL;
1007 return ret;
1008 }
1009
1010 return 0;
1011}
1012
1013/**
1014 * gm20x_secboot_prepare_blobs - load blobs common to all GM20X GPUs.
1015 *
1016 * This includes the LS blob, HS ucode loading blob, and HS bootloader.
1017 *
1018 * The HS ucode unload blob is only used on dGPU.
1019 */
1020int
1021gm20x_secboot_prepare_blobs(struct gm200_secboot *gsb)
1022{
1023 int ret;
1024
1025 /* Load and prepare the managed falcon's firmwares */
1026 ret = gm200_secboot_prepare_ls_blob(gsb);
1027 if (ret)
1028 return ret;
1029
1030 /* Load the HS firmware that will load the LS firmwares */
1031 ret = gm200_secboot_prepare_hs_blob(gsb, "acr/ucode_load",
1032 &gsb->acr_load_blob,
1033 &gsb->acr_load_bl_desc, true);
1034 if (ret)
1035 return ret;
1036
1037 /* Load the HS firmware bootloader */
1038 ret = gm200_secboot_prepare_hsbl_blob(gsb);
1039 if (ret)
1040 return ret;
1041
1042 return 0;
1043}
1044
1045static int
1046gm200_secboot_prepare_blobs(struct nvkm_secboot *sb)
1047{
1048 struct gm200_secboot *gsb = gm200_secboot(sb);
1049 int ret;
1050
1051 ret = gm20x_secboot_prepare_blobs(gsb);
1052 if (ret)
1053 return ret;
1054
1055 /* dGPU only: load the HS firmware that unprotects the WPR region */
1056 ret = gm200_secboot_prepare_hs_blob(gsb, "acr/ucode_unload",
1057 &gsb->acr_unload_blob,
1058 &gsb->acr_unload_bl_desc, false);
1059 if (ret)
1060 return ret;
1061
1062 return 0;
1063}
1064
1065
1066
1067/*
1068 * Secure Boot Execution
1069 */
1070
1071/**
1072 * gm200_secboot_load_hs_bl() - load HS bootloader into DMEM and IMEM
1073 */
1074static void
1075gm200_secboot_load_hs_bl(struct gm200_secboot *gsb, void *data, u32 data_size)
1076{
1077 struct nvkm_device *device = gsb->base.subdev.device;
1078 struct fw_bin_header *hdr = gsb->hsbl_blob;
1079 struct fw_bl_desc *hsbl_desc = gsb->hsbl_blob + hdr->header_offset;
1080 void *blob_data = gsb->hsbl_blob + hdr->data_offset;
1081 void *hsbl_code = blob_data + hsbl_desc->code_off;
1082 void *hsbl_data = blob_data + hsbl_desc->data_off;
1083 u32 code_size = ALIGN(hsbl_desc->code_size, 256);
1084 const u32 base = gsb->base.base;
1085 u32 blk;
1086 u32 tag;
1087 int i;
1088
1089 /*
1090 * Copy HS bootloader data
1091 */
1092 nvkm_wr32(device, base + 0x1c0, (0x00000000 | (0x1 << 24)));
1093 for (i = 0; i < hsbl_desc->data_size / 4; i++)
1094 nvkm_wr32(device, base + 0x1c4, ((u32 *)hsbl_data)[i]);
1095
1096 /*
1097 * Copy HS bootloader interface structure where the HS descriptor
1098 * expects it to be
1099 */
1100 nvkm_wr32(device, base + 0x1c0,
1101 (hsbl_desc->dmem_load_off | (0x1 << 24)));
1102 for (i = 0; i < data_size / 4; i++)
1103 nvkm_wr32(device, base + 0x1c4, ((u32 *)data)[i]);
1104
1105 /* Copy HS bootloader code to end of IMEM */
1106 blk = (nvkm_rd32(device, base + 0x108) & 0x1ff) - (code_size >> 8);
1107 tag = hsbl_desc->start_tag;
1108 nvkm_wr32(device, base + 0x180, ((blk & 0xff) << 8) | (0x1 << 24));
1109 for (i = 0; i < code_size / 4; i++) {
1110 /* write new tag every 256B */
1111 if ((i & 0x3f) == 0) {
1112 nvkm_wr32(device, base + 0x188, tag & 0xffff);
1113 tag++;
1114 }
1115 nvkm_wr32(device, base + 0x184, ((u32 *)hsbl_code)[i]);
1116 }
1117 nvkm_wr32(device, base + 0x188, 0);
1118}
1119
1120/**
1121 * gm200_secboot_setup_falcon() - set up the secure falcon for secure boot
1122 */
1123static int
1124gm200_secboot_setup_falcon(struct gm200_secboot *gsb)
1125{
1126 struct nvkm_device *device = gsb->base.subdev.device;
1127 struct fw_bin_header *hdr = gsb->hsbl_blob;
1128 struct fw_bl_desc *hsbl_desc = gsb->hsbl_blob + hdr->header_offset;
1129 /* virtual start address for boot vector */
1130 u32 virt_addr = hsbl_desc->start_tag << 8;
1131 const u32 base = gsb->base.base;
1132 const u32 reg_base = base + 0xe00;
1133 u32 inst_loc;
1134 int ret;
1135
1136 ret = nvkm_secboot_falcon_reset(&gsb->base);
1137 if (ret)
1138 return ret;
1139
1140 /* setup apertures - virtual */
1141 nvkm_wr32(device, reg_base + 4 * (FALCON_DMAIDX_UCODE), 0x4);
1142 nvkm_wr32(device, reg_base + 4 * (FALCON_DMAIDX_VIRT), 0x0);
1143 /* setup apertures - physical */
1144 nvkm_wr32(device, reg_base + 4 * (FALCON_DMAIDX_PHYS_VID), 0x4);
1145 nvkm_wr32(device, reg_base + 4 * (FALCON_DMAIDX_PHYS_SYS_COH),
1146 0x4 | 0x1);
1147 nvkm_wr32(device, reg_base + 4 * (FALCON_DMAIDX_PHYS_SYS_NCOH),
1148 0x4 | 0x2);
1149
1150 /* Set context */
1151 if (nvkm_memory_target(gsb->inst->memory) == NVKM_MEM_TARGET_VRAM)
1152 inst_loc = 0x0; /* FB */
1153 else
1154 inst_loc = 0x3; /* Non-coherent sysmem */
1155
1156 nvkm_mask(device, base + 0x048, 0x1, 0x1);
1157 nvkm_wr32(device, base + 0x480,
1158 ((gsb->inst->addr >> 12) & 0xfffffff) |
1159 (inst_loc << 28) | (1 << 30));
1160
1161 /* Set boot vector to code's starting virtual address */
1162 nvkm_wr32(device, base + 0x104, virt_addr);
1163
1164 return 0;
1165}
1166
1167/**
1168 * gm200_secboot_run_hs_blob() - run the given high-secure blob
1169 */
1170static int
1171gm200_secboot_run_hs_blob(struct gm200_secboot *gsb, struct nvkm_gpuobj *blob,
1172 struct gm200_flcn_bl_desc *desc)
1173{
1174 struct nvkm_vma vma;
1175 u64 vma_addr;
1176 const u32 bl_desc_size = gsb->func->bl_desc_size;
1177 u8 bl_desc[bl_desc_size];
1178 int ret;
1179
1180 /* Map the HS firmware so the HS bootloader can see it */
1181 ret = nvkm_gpuobj_map(blob, gsb->vm, NV_MEM_ACCESS_RW, &vma);
1182 if (ret)
1183 return ret;
1184
1185 /* Add the mapping address to the DMA bases */
1186 vma_addr = flcn64_to_u64(desc->code_dma_base) + vma.offset;
1187 desc->code_dma_base.lo = lower_32_bits(vma_addr);
1188 desc->code_dma_base.hi = upper_32_bits(vma_addr);
1189 vma_addr = flcn64_to_u64(desc->data_dma_base) + vma.offset;
1190 desc->data_dma_base.lo = lower_32_bits(vma_addr);
1191 desc->data_dma_base.hi = upper_32_bits(vma_addr);
1192
1193 /* Fixup the BL header */
1194 gsb->func->fixup_bl_desc(desc, &bl_desc);
1195
1196 /* Reset the falcon and make it ready to run the HS bootloader */
1197 ret = gm200_secboot_setup_falcon(gsb);
1198 if (ret)
1199 goto done;
1200
1201 /* Load the HS bootloader into the falcon's IMEM/DMEM */
1202 gm200_secboot_load_hs_bl(gsb, &bl_desc, bl_desc_size);
1203
1204 /* Start the HS bootloader */
1205 ret = nvkm_secboot_falcon_run(&gsb->base);
1206 if (ret)
1207 goto done;
1208
1209done:
1210 /* Restore the original DMA addresses */
1211 vma_addr = flcn64_to_u64(desc->code_dma_base) - vma.offset;
1212 desc->code_dma_base.lo = lower_32_bits(vma_addr);
1213 desc->code_dma_base.hi = upper_32_bits(vma_addr);
1214 vma_addr = flcn64_to_u64(desc->data_dma_base) - vma.offset;
1215 desc->data_dma_base.lo = lower_32_bits(vma_addr);
1216 desc->data_dma_base.hi = upper_32_bits(vma_addr);
1217
1218 /* We don't need the ACR firmware anymore */
1219 nvkm_gpuobj_unmap(&vma);
1220
1221 return ret;
1222}
1223
1224/*
1225 * gm200_secboot_reset() - execute secure boot from the prepared state
1226 *
1227 * Load the HS bootloader and ask the falcon to run it. This will in turn
1228 * load the HS firmware and run it, so once the falcon stops all the managed
1229 * falcons should have their LS firmware loaded and be ready to run.
1230 */
1231int
1232gm200_secboot_reset(struct nvkm_secboot *sb, enum nvkm_secboot_falcon falcon)
1233{
1234 struct gm200_secboot *gsb = gm200_secboot(sb);
1235 int ret;
1236
1237 /*
1238 * Dummy GM200 implementation: perform secure boot each time we are
1239 * called on FECS. Since only FECS and GPCCS are managed and started
1240 * together, this ought to be safe.
1241 *
1242 * Once we have proper PMU firmware and support, this will be changed
1243 * to a proper call to the PMU method.
1244 */
1245 if (falcon != NVKM_SECBOOT_FALCON_FECS)
1246 goto end;
1247
1248 /* If WPR is set and we have an unload blob, run it to unlock WPR */
1249 if (gsb->acr_unload_blob &&
1250 gsb->falcon_state[NVKM_SECBOOT_FALCON_FECS] != NON_SECURE) {
1251 ret = gm200_secboot_run_hs_blob(gsb, gsb->acr_unload_blob,
1252 &gsb->acr_unload_bl_desc);
1253 if (ret)
1254 return ret;
1255 }
1256
1257 /* Reload all managed falcons */
1258 ret = gm200_secboot_run_hs_blob(gsb, gsb->acr_load_blob,
1259 &gsb->acr_load_bl_desc);
1260 if (ret)
1261 return ret;
1262
1263end:
1264 gsb->falcon_state[falcon] = RESET;
1265 return 0;
1266}
1267
1268int
1269gm200_secboot_start(struct nvkm_secboot *sb, enum nvkm_secboot_falcon falcon)
1270{
1271 struct gm200_secboot *gsb = gm200_secboot(sb);
1272 int base;
1273
1274 switch (falcon) {
1275 case NVKM_SECBOOT_FALCON_FECS:
1276 base = 0x409000;
1277 break;
1278 case NVKM_SECBOOT_FALCON_GPCCS:
1279 base = 0x41a000;
1280 break;
1281 default:
1282 nvkm_error(&sb->subdev, "cannot start unhandled falcon!\n");
1283 return -EINVAL;
1284 }
1285
1286 nvkm_wr32(sb->subdev.device, base + 0x130, 0x00000002);
1287 gsb->falcon_state[falcon] = RUNNING;
1288
1289 return 0;
1290}
1291
1292
1293
1294int
1295gm200_secboot_init(struct nvkm_secboot *sb)
1296{
1297 struct gm200_secboot *gsb = gm200_secboot(sb);
1298 struct nvkm_device *device = sb->subdev.device;
1299 struct nvkm_vm *vm;
1300 const u64 vm_area_len = 600 * 1024;
1301 int ret;
1302
1303 /* Allocate instance block and VM */
1304 ret = nvkm_gpuobj_new(device, 0x1000, 0, true, NULL, &gsb->inst);
1305 if (ret)
1306 return ret;
1307
1308 ret = nvkm_gpuobj_new(device, 0x8000, 0, true, NULL, &gsb->pgd);
1309 if (ret)
1310 return ret;
1311
1312 ret = nvkm_vm_new(device, 0, vm_area_len, 0, NULL, &vm);
1313 if (ret)
1314 return ret;
1315
1316 atomic_inc(&vm->engref[NVKM_SUBDEV_PMU]);
1317
1318 ret = nvkm_vm_ref(vm, &gsb->vm, gsb->pgd);
1319 nvkm_vm_ref(NULL, &vm, NULL);
1320 if (ret)
1321 return ret;
1322
1323 nvkm_kmap(gsb->inst);
1324 nvkm_wo32(gsb->inst, 0x200, lower_32_bits(gsb->pgd->addr));
1325 nvkm_wo32(gsb->inst, 0x204, upper_32_bits(gsb->pgd->addr));
1326 nvkm_wo32(gsb->inst, 0x208, lower_32_bits(vm_area_len - 1));
1327 nvkm_wo32(gsb->inst, 0x20c, upper_32_bits(vm_area_len - 1));
1328 nvkm_done(gsb->inst);
1329
1330 return 0;
1331}
1332
1333int
1334gm200_secboot_fini(struct nvkm_secboot *sb, bool suspend)
1335{
1336 struct gm200_secboot *gsb = gm200_secboot(sb);
1337 int ret = 0;
1338 int i;
1339
1340 /* Run the unload blob to unprotect the WPR region */
1341 if (gsb->acr_unload_blob &&
1342 gsb->falcon_state[NVKM_SECBOOT_FALCON_FECS] != NON_SECURE)
1343 ret = gm200_secboot_run_hs_blob(gsb, gsb->acr_unload_blob,
1344 &gsb->acr_unload_bl_desc);
1345
1346 for (i = 0; i < NVKM_SECBOOT_FALCON_END; i++)
1347 gsb->falcon_state[i] = NON_SECURE;
1348
1349 return ret;
1350}
1351
1352void *
1353gm200_secboot_dtor(struct nvkm_secboot *sb)
1354{
1355 struct gm200_secboot *gsb = gm200_secboot(sb);
1356
1357 nvkm_gpuobj_del(&gsb->acr_unload_blob);
1358
1359 kfree(gsb->hsbl_blob);
1360 nvkm_gpuobj_del(&gsb->acr_load_blob);
1361 nvkm_gpuobj_del(&gsb->ls_blob);
1362
1363 nvkm_vm_ref(NULL, &gsb->vm, gsb->pgd);
1364 nvkm_gpuobj_del(&gsb->pgd);
1365 nvkm_gpuobj_del(&gsb->inst);
1366
1367 return gsb;
1368}
1369
1370
1371static const struct nvkm_secboot_func
1372gm200_secboot = {
1373 .dtor = gm200_secboot_dtor,
1374 .init = gm200_secboot_init,
1375 .fini = gm200_secboot_fini,
1376 .prepare_blobs = gm200_secboot_prepare_blobs,
1377 .reset = gm200_secboot_reset,
1378 .start = gm200_secboot_start,
1379 .managed_falcons = BIT(NVKM_SECBOOT_FALCON_FECS) |
1380 BIT(NVKM_SECBOOT_FALCON_GPCCS),
1381 .boot_falcon = NVKM_SECBOOT_FALCON_PMU,
1382};
1383
1384/**
1385 * gm200_fixup_bl_desc - just copy the BL descriptor
1386 *
1387 * Use the GM200 descriptor format by default.
1388 */
1389static void
1390gm200_secboot_fixup_bl_desc(const struct gm200_flcn_bl_desc *desc, void *ret)
1391{
1392 memcpy(ret, desc, sizeof(*desc));
1393}
1394
1395static void
1396gm200_secboot_fixup_hs_desc(struct gm200_secboot *gsb,
1397 struct hsflcn_acr_desc *desc)
1398{
1399 desc->ucode_blob_base = gsb->ls_blob->addr;
1400 desc->ucode_blob_size = gsb->ls_blob->size;
1401
1402 desc->wpr_offset = 0;
1403
1404 /* WPR region information for the HS binary to set up */
1405 desc->wpr_region_id = 1;
1406 desc->regions.no_regions = 1;
1407 desc->regions.region_props[0].region_id = 1;
1408 desc->regions.region_props[0].start_addr = gsb->wpr_addr >> 8;
1409 desc->regions.region_props[0].end_addr =
1410 (gsb->wpr_addr + gsb->wpr_size) >> 8;
1411}
1412
1413static const struct gm200_secboot_func
1414gm200_secboot_func = {
1415 .bl_desc_size = sizeof(struct gm200_flcn_bl_desc),
1416 .fixup_bl_desc = gm200_secboot_fixup_bl_desc,
1417 .fixup_hs_desc = gm200_secboot_fixup_hs_desc,
1418};
1419
1420int
1421gm200_secboot_new(struct nvkm_device *device, int index,
1422 struct nvkm_secboot **psb)
1423{
1424 int ret;
1425 struct gm200_secboot *gsb;
1426
1427 gsb = kzalloc(sizeof(*gsb), GFP_KERNEL);
1428 if (!gsb) {
1429 psb = NULL;
1430 return -ENOMEM;
1431 }
1432 *psb = &gsb->base;
1433
1434 ret = nvkm_secboot_ctor(&gm200_secboot, device, index, &gsb->base);
1435 if (ret)
1436 return ret;
1437
1438 gsb->func = &gm200_secboot_func;
1439
1440 return 0;
1441}
1442
1443MODULE_FIRMWARE("nvidia/gm200/acr/bl.bin");
1444MODULE_FIRMWARE("nvidia/gm200/acr/ucode_load.bin");
1445MODULE_FIRMWARE("nvidia/gm200/acr/ucode_unload.bin");
1446MODULE_FIRMWARE("nvidia/gm200/gr/fecs_bl.bin");
1447MODULE_FIRMWARE("nvidia/gm200/gr/fecs_inst.bin");
1448MODULE_FIRMWARE("nvidia/gm200/gr/fecs_data.bin");
1449MODULE_FIRMWARE("nvidia/gm200/gr/fecs_sig.bin");
1450MODULE_FIRMWARE("nvidia/gm200/gr/gpccs_bl.bin");
1451MODULE_FIRMWARE("nvidia/gm200/gr/gpccs_inst.bin");
1452MODULE_FIRMWARE("nvidia/gm200/gr/gpccs_data.bin");
1453MODULE_FIRMWARE("nvidia/gm200/gr/gpccs_sig.bin");
1454MODULE_FIRMWARE("nvidia/gm200/gr/sw_ctx.bin");
1455MODULE_FIRMWARE("nvidia/gm200/gr/sw_nonctx.bin");
1456MODULE_FIRMWARE("nvidia/gm200/gr/sw_bundle_init.bin");
1457MODULE_FIRMWARE("nvidia/gm200/gr/sw_method_init.bin");
1458
1459MODULE_FIRMWARE("nvidia/gm204/acr/bl.bin");
1460MODULE_FIRMWARE("nvidia/gm204/acr/ucode_load.bin");
1461MODULE_FIRMWARE("nvidia/gm204/acr/ucode_unload.bin");
1462MODULE_FIRMWARE("nvidia/gm204/gr/fecs_bl.bin");
1463MODULE_FIRMWARE("nvidia/gm204/gr/fecs_inst.bin");
1464MODULE_FIRMWARE("nvidia/gm204/gr/fecs_data.bin");
1465MODULE_FIRMWARE("nvidia/gm204/gr/fecs_sig.bin");
1466MODULE_FIRMWARE("nvidia/gm204/gr/gpccs_bl.bin");
1467MODULE_FIRMWARE("nvidia/gm204/gr/gpccs_inst.bin");
1468MODULE_FIRMWARE("nvidia/gm204/gr/gpccs_data.bin");
1469MODULE_FIRMWARE("nvidia/gm204/gr/gpccs_sig.bin");
1470MODULE_FIRMWARE("nvidia/gm204/gr/sw_ctx.bin");
1471MODULE_FIRMWARE("nvidia/gm204/gr/sw_nonctx.bin");
1472MODULE_FIRMWARE("nvidia/gm204/gr/sw_bundle_init.bin");
1473MODULE_FIRMWARE("nvidia/gm204/gr/sw_method_init.bin");
1474
1475MODULE_FIRMWARE("nvidia/gm206/acr/bl.bin");
1476MODULE_FIRMWARE("nvidia/gm206/acr/ucode_load.bin");
1477MODULE_FIRMWARE("nvidia/gm206/acr/ucode_unload.bin");
1478MODULE_FIRMWARE("nvidia/gm206/gr/fecs_bl.bin");
1479MODULE_FIRMWARE("nvidia/gm206/gr/fecs_inst.bin");
1480MODULE_FIRMWARE("nvidia/gm206/gr/fecs_data.bin");
1481MODULE_FIRMWARE("nvidia/gm206/gr/fecs_sig.bin");
1482MODULE_FIRMWARE("nvidia/gm206/gr/gpccs_bl.bin");
1483MODULE_FIRMWARE("nvidia/gm206/gr/gpccs_inst.bin");
1484MODULE_FIRMWARE("nvidia/gm206/gr/gpccs_data.bin");
1485MODULE_FIRMWARE("nvidia/gm206/gr/gpccs_sig.bin");
1486MODULE_FIRMWARE("nvidia/gm206/gr/sw_ctx.bin");
1487MODULE_FIRMWARE("nvidia/gm206/gr/sw_nonctx.bin");
1488MODULE_FIRMWARE("nvidia/gm206/gr/sw_bundle_init.bin");
1489MODULE_FIRMWARE("nvidia/gm206/gr/sw_method_init.bin");
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
new file mode 100644
index 000000000000..684320484b70
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
@@ -0,0 +1,233 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#include "priv.h"
24
25#include <core/gpuobj.h>
26
27/*
28 * The BL header format used by GM20B's firmware is slightly different
29 * from the one of GM200. Fix the differences here.
30 */
31struct gm20b_flcn_bl_desc {
32 u32 reserved[4];
33 u32 signature[4];
34 u32 ctx_dma;
35 u32 code_dma_base;
36 u32 non_sec_code_off;
37 u32 non_sec_code_size;
38 u32 sec_code_off;
39 u32 sec_code_size;
40 u32 code_entry_point;
41 u32 data_dma_base;
42 u32 data_size;
43};
44
45/**
46 * gm20b_secboot_fixup_bl_desc - adapt BL descriptor to format used by GM20B FW
47 *
48 * There is only a slight format difference (DMA addresses being 32-bits and
49 * 256B-aligned) to address.
50 */
51static void
52gm20b_secboot_fixup_bl_desc(const struct gm200_flcn_bl_desc *desc, void *ret)
53{
54 struct gm20b_flcn_bl_desc *gdesc = ret;
55 u64 addr;
56
57 memcpy(gdesc->reserved, desc->reserved, sizeof(gdesc->reserved));
58 memcpy(gdesc->signature, desc->signature, sizeof(gdesc->signature));
59 gdesc->ctx_dma = desc->ctx_dma;
60 addr = desc->code_dma_base.hi;
61 addr <<= 32;
62 addr |= desc->code_dma_base.lo;
63 gdesc->code_dma_base = lower_32_bits(addr >> 8);
64 gdesc->non_sec_code_off = desc->non_sec_code_off;
65 gdesc->non_sec_code_size = desc->non_sec_code_size;
66 gdesc->sec_code_off = desc->sec_code_off;
67 gdesc->sec_code_size = desc->sec_code_size;
68 gdesc->code_entry_point = desc->code_entry_point;
69 addr = desc->data_dma_base.hi;
70 addr <<= 32;
71 addr |= desc->data_dma_base.lo;
72 gdesc->data_dma_base = lower_32_bits(addr >> 8);
73 gdesc->data_size = desc->data_size;
74}
75
76static void
77gm20b_secboot_fixup_hs_desc(struct gm200_secboot *gsb,
78 struct hsflcn_acr_desc *desc)
79{
80 desc->ucode_blob_base = gsb->ls_blob->addr;
81 desc->ucode_blob_size = gsb->ls_blob->size;
82
83 desc->wpr_offset = 0;
84}
85
86static const struct gm200_secboot_func
87gm20b_secboot_func = {
88 .bl_desc_size = sizeof(struct gm20b_flcn_bl_desc),
89 .fixup_bl_desc = gm20b_secboot_fixup_bl_desc,
90 .fixup_hs_desc = gm20b_secboot_fixup_hs_desc,
91};
92
93
94#ifdef CONFIG_ARCH_TEGRA
95#define TEGRA_MC_BASE 0x70019000
96#define MC_SECURITY_CARVEOUT2_CFG0 0xc58
97#define MC_SECURITY_CARVEOUT2_BOM_0 0xc5c
98#define MC_SECURITY_CARVEOUT2_BOM_HI_0 0xc60
99#define MC_SECURITY_CARVEOUT2_SIZE_128K 0xc64
100#define TEGRA_MC_SECURITY_CARVEOUT_CFG_LOCKED (1 << 1)
101/**
102 * sb_tegra_read_wpr() - read the WPR registers on Tegra
103 *
104 * On dGPU, we can manage the WPR region ourselves, but on Tegra the WPR region
105 * is reserved from system memory by the bootloader and irreversibly locked.
106 * This function reads the address and size of the pre-configured WPR region.
107 */
108static int
109gm20b_tegra_read_wpr(struct gm200_secboot *gsb)
110{
111 struct nvkm_secboot *sb = &gsb->base;
112 void __iomem *mc;
113 u32 cfg;
114
115 mc = ioremap(TEGRA_MC_BASE, 0xd00);
116 if (!mc) {
117 nvkm_error(&sb->subdev, "Cannot map Tegra MC registers\n");
118 return PTR_ERR(mc);
119 }
120 gsb->wpr_addr = ioread32_native(mc + MC_SECURITY_CARVEOUT2_BOM_0) |
121 ((u64)ioread32_native(mc + MC_SECURITY_CARVEOUT2_BOM_HI_0) << 32);
122 gsb->wpr_size = ioread32_native(mc + MC_SECURITY_CARVEOUT2_SIZE_128K)
123 << 17;
124 cfg = ioread32_native(mc + MC_SECURITY_CARVEOUT2_CFG0);
125 iounmap(mc);
126
127 /* Check that WPR settings are valid */
128 if (gsb->wpr_size == 0) {
129 nvkm_error(&sb->subdev, "WPR region is empty\n");
130 return -EINVAL;
131 }
132
133 if (!(cfg & TEGRA_MC_SECURITY_CARVEOUT_CFG_LOCKED)) {
134 nvkm_error(&sb->subdev, "WPR region not locked\n");
135 return -EINVAL;
136 }
137
138 return 0;
139}
140#else
141static int
142gm20b_tegra_read_wpr(struct gm200_secboot *gsb)
143{
144 nvkm_error(&gsb->base.subdev, "Tegra support not compiled in\n");
145 return -EINVAL;
146}
147#endif
148
149static int
150gm20b_secboot_prepare_blobs(struct nvkm_secboot *sb)
151{
152 struct gm200_secboot *gsb = gm200_secboot(sb);
153 int acr_size;
154 int ret;
155
156 ret = gm20x_secboot_prepare_blobs(gsb);
157 if (ret)
158 return ret;
159
160 acr_size = gsb->acr_load_blob->size;
161 /*
162 * On Tegra the WPR region is set by the bootloader. It is illegal for
163 * the HS blob to be larger than this region.
164 */
165 if (acr_size > gsb->wpr_size) {
166 nvkm_error(&sb->subdev, "WPR region too small for FW blob!\n");
167 nvkm_error(&sb->subdev, "required: %dB\n", acr_size);
168 nvkm_error(&sb->subdev, "WPR size: %dB\n", gsb->wpr_size);
169 return -ENOSPC;
170 }
171
172 return 0;
173}
174
175static int
176gm20b_secboot_init(struct nvkm_secboot *sb)
177{
178 struct gm200_secboot *gsb = gm200_secboot(sb);
179 int ret;
180
181 ret = gm20b_tegra_read_wpr(gsb);
182 if (ret)
183 return ret;
184
185 return gm200_secboot_init(sb);
186}
187
188static const struct nvkm_secboot_func
189gm20b_secboot = {
190 .dtor = gm200_secboot_dtor,
191 .init = gm20b_secboot_init,
192 .prepare_blobs = gm20b_secboot_prepare_blobs,
193 .reset = gm200_secboot_reset,
194 .start = gm200_secboot_start,
195 .managed_falcons = BIT(NVKM_SECBOOT_FALCON_FECS),
196 .boot_falcon = NVKM_SECBOOT_FALCON_PMU,
197};
198
199int
200gm20b_secboot_new(struct nvkm_device *device, int index,
201 struct nvkm_secboot **psb)
202{
203 int ret;
204 struct gm200_secboot *gsb;
205
206 gsb = kzalloc(sizeof(*gsb), GFP_KERNEL);
207 if (!gsb) {
208 psb = NULL;
209 return -ENOMEM;
210 }
211 *psb = &gsb->base;
212
213 ret = nvkm_secboot_ctor(&gm20b_secboot, device, index, &gsb->base);
214 if (ret)
215 return ret;
216
217 gsb->func = &gm20b_secboot_func;
218
219 return 0;
220}
221
222MODULE_FIRMWARE("nvidia/gm20b/acr/bl.bin");
223MODULE_FIRMWARE("nvidia/gm20b/acr/ucode_load.bin");
224MODULE_FIRMWARE("nvidia/gm20b/gr/fecs_bl.bin");
225MODULE_FIRMWARE("nvidia/gm20b/gr/fecs_inst.bin");
226MODULE_FIRMWARE("nvidia/gm20b/gr/fecs_data.bin");
227MODULE_FIRMWARE("nvidia/gm20b/gr/fecs_sig.bin");
228MODULE_FIRMWARE("nvidia/gm20b/gr/gpccs_inst.bin");
229MODULE_FIRMWARE("nvidia/gm20b/gr/gpccs_data.bin");
230MODULE_FIRMWARE("nvidia/gm20b/gr/sw_ctx.bin");
231MODULE_FIRMWARE("nvidia/gm20b/gr/sw_nonctx.bin");
232MODULE_FIRMWARE("nvidia/gm20b/gr/sw_bundle_init.bin");
233MODULE_FIRMWARE("nvidia/gm20b/gr/sw_method_init.bin");
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/priv.h b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/priv.h
new file mode 100644
index 000000000000..f2b09dee7c5d
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/priv.h
@@ -0,0 +1,226 @@
1/*
2 * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved.
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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef __NVKM_SECBOOT_PRIV_H__
24#define __NVKM_SECBOOT_PRIV_H__
25
26#include <subdev/secboot.h>
27#include <subdev/mmu.h>
28
29struct nvkm_secboot_func {
30 int (*init)(struct nvkm_secboot *);
31 int (*fini)(struct nvkm_secboot *, bool suspend);
32 void *(*dtor)(struct nvkm_secboot *);
33 int (*prepare_blobs)(struct nvkm_secboot *);
34 int (*reset)(struct nvkm_secboot *, enum nvkm_secboot_falcon);
35 int (*start)(struct nvkm_secboot *, enum nvkm_secboot_falcon);
36
37 /* ID of the falcon that will perform secure boot */
38 enum nvkm_secboot_falcon boot_falcon;
39 /* Bit-mask of IDs of managed falcons */
40 unsigned long managed_falcons;
41};
42
43int nvkm_secboot_ctor(const struct nvkm_secboot_func *, struct nvkm_device *,
44 int index, struct nvkm_secboot *);
45int nvkm_secboot_falcon_reset(struct nvkm_secboot *);
46int nvkm_secboot_falcon_run(struct nvkm_secboot *);
47
48struct flcn_u64 {
49 u32 lo;
50 u32 hi;
51};
52static inline u64 flcn64_to_u64(const struct flcn_u64 f)
53{
54 return ((u64)f.hi) << 32 | f.lo;
55}
56
57/**
58 * struct gm200_flcn_bl_desc - DMEM bootloader descriptor
59 * @signature: 16B signature for secure code. 0s if no secure code
60 * @ctx_dma: DMA context to be used by BL while loading code/data
61 * @code_dma_base: 256B-aligned Physical FB Address where code is located
62 * (falcon's $xcbase register)
63 * @non_sec_code_off: offset from code_dma_base where the non-secure code is
64 * located. The offset must be multiple of 256 to help perf
65 * @non_sec_code_size: the size of the nonSecure code part.
66 * @sec_code_off: offset from code_dma_base where the secure code is
67 * located. The offset must be multiple of 256 to help perf
68 * @sec_code_size: offset from code_dma_base where the secure code is
69 * located. The offset must be multiple of 256 to help perf
70 * @code_entry_point: code entry point which will be invoked by BL after
71 * code is loaded.
72 * @data_dma_base: 256B aligned Physical FB Address where data is located.
73 * (falcon's $xdbase register)
74 * @data_size: size of data block. Should be multiple of 256B
75 *
76 * Structure used by the bootloader to load the rest of the code. This has
77 * to be filled by host and copied into DMEM at offset provided in the
78 * hsflcn_bl_desc.bl_desc_dmem_load_off.
79 */
80struct gm200_flcn_bl_desc {
81 u32 reserved[4];
82 u32 signature[4];
83 u32 ctx_dma;
84 struct flcn_u64 code_dma_base;
85 u32 non_sec_code_off;
86 u32 non_sec_code_size;
87 u32 sec_code_off;
88 u32 sec_code_size;
89 u32 code_entry_point;
90 struct flcn_u64 data_dma_base;
91 u32 data_size;
92};
93
94/**
95 * struct hsflcn_acr_desc - data section of the HS firmware
96 *
97 * This header is to be copied at the beginning of DMEM by the HS bootloader.
98 *
99 * @signature: signature of ACR ucode
100 * @wpr_region_id: region ID holding the WPR header and its details
101 * @wpr_offset: offset from the WPR region holding the wpr header
102 * @regions: region descriptors
103 * @nonwpr_ucode_blob_size: size of LS blob
104 * @nonwpr_ucode_blob_start: FB location of LS blob is
105 */
106struct hsflcn_acr_desc {
107 union {
108 u8 reserved_dmem[0x200];
109 u32 signatures[4];
110 } ucode_reserved_space;
111 u32 wpr_region_id;
112 u32 wpr_offset;
113 u32 mmu_mem_range;
114#define FLCN_ACR_MAX_REGIONS 2
115 struct {
116 u32 no_regions;
117 struct {
118 u32 start_addr;
119 u32 end_addr;
120 u32 region_id;
121 u32 read_mask;
122 u32 write_mask;
123 u32 client_mask;
124 } region_props[FLCN_ACR_MAX_REGIONS];
125 } regions;
126 u32 ucode_blob_size;
127 u64 ucode_blob_base __aligned(8);
128 struct {
129 u32 vpr_enabled;
130 u32 vpr_start;
131 u32 vpr_end;
132 u32 hdcp_policies;
133 } vpr_desc;
134};
135
136/**
137 * Contains the whole secure boot state, allowing it to be performed as needed
138 * @wpr_addr: physical address of the WPR region
139 * @wpr_size: size in bytes of the WPR region
140 * @ls_blob: LS blob of all the LS firmwares, signatures, bootloaders
141 * @ls_blob_size: size of the LS blob
142 * @ls_blob_nb_regions: number of LS firmwares that will be loaded
143 * @acr_blob: HS blob
144 * @acr_blob_vma: mapping of the HS blob into the secure falcon's VM
145 * @acr_bl_desc: bootloader descriptor of the HS blob
146 * @hsbl_blob: HS blob bootloader
147 * @inst: instance block for HS falcon
148 * @pgd: page directory for the HS falcon
149 * @vm: address space used by the HS falcon
150 * @bl_desc_size: size of the BL descriptor used by this chip.
151 * @fixup_bl_desc: hook that generates the proper BL descriptor format from
152 * the generic GM200 format into a data array of size
153 * bl_desc_size
154 */
155struct gm200_secboot {
156 struct nvkm_secboot base;
157 const struct gm200_secboot_func *func;
158
159 /*
160 * Address and size of the WPR region. On dGPU this will be the
161 * address of the LS blob. On Tegra this is a fixed region set by the
162 * bootloader
163 */
164 u64 wpr_addr;
165 u32 wpr_size;
166
167 /*
168 * HS FW - lock WPR region (dGPU only) and load LS FWs
169 * on Tegra the HS FW copies the LS blob into the fixed WPR instead
170 */
171 struct nvkm_gpuobj *acr_load_blob;
172 struct gm200_flcn_bl_desc acr_load_bl_desc;
173
174 /* HS FW - unlock WPR region (dGPU only) */
175 struct nvkm_gpuobj *acr_unload_blob;
176 struct gm200_flcn_bl_desc acr_unload_bl_desc;
177
178 /* HS bootloader */
179 void *hsbl_blob;
180
181 /* LS FWs, to be loaded by the HS ACR */
182 struct nvkm_gpuobj *ls_blob;
183
184 /* Instance block & address space used for HS FW execution */
185 struct nvkm_gpuobj *inst;
186 struct nvkm_gpuobj *pgd;
187 struct nvkm_vm *vm;
188
189 /* To keep track of the state of all managed falcons */
190 enum {
191 /* In non-secure state, no firmware loaded, no privileges*/
192 NON_SECURE = 0,
193 /* In low-secure mode and ready to be started */
194 RESET,
195 /* In low-secure mode and running */
196 RUNNING,
197 } falcon_state[NVKM_SECBOOT_FALCON_END];
198
199};
200#define gm200_secboot(sb) container_of(sb, struct gm200_secboot, base)
201
202struct gm200_secboot_func {
203 /*
204 * Size of the bootloader descriptor for this chip. A block of this
205 * size is allocated before booting a falcon and the fixup_bl_desc
206 * callback is called on it
207 */
208 u32 bl_desc_size;
209 void (*fixup_bl_desc)(const struct gm200_flcn_bl_desc *, void *);
210
211 /*
212 * Chip-specific modifications of the HS descriptor can be done here.
213 * On dGPU this is used to fill the information about the WPR region
214 * we want the HS FW to set up.
215 */
216 void (*fixup_hs_desc)(struct gm200_secboot *, struct hsflcn_acr_desc *);
217};
218
219int gm200_secboot_init(struct nvkm_secboot *);
220void *gm200_secboot_dtor(struct nvkm_secboot *);
221int gm200_secboot_reset(struct nvkm_secboot *, u32);
222int gm200_secboot_start(struct nvkm_secboot *, u32);
223
224int gm20x_secboot_prepare_blobs(struct gm200_secboot *);
225
226#endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/volt/Kbuild b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/Kbuild
index b035c6e28be8..c34076223b7b 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/volt/Kbuild
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/Kbuild
@@ -3,3 +3,4 @@ nvkm-y += nvkm/subdev/volt/gpio.o
3nvkm-y += nvkm/subdev/volt/nv40.o 3nvkm-y += nvkm/subdev/volt/nv40.o
4nvkm-y += nvkm/subdev/volt/gk104.o 4nvkm-y += nvkm/subdev/volt/gk104.o
5nvkm-y += nvkm/subdev/volt/gk20a.o 5nvkm-y += nvkm/subdev/volt/gk20a.o
6nvkm-y += nvkm/subdev/volt/gm20b.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk20a.c b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk20a.c
index fd56c6476064..d554455326da 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk20a.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk20a.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
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"),
@@ -24,21 +24,9 @@
24 24
25#include <core/tegra.h> 25#include <core/tegra.h>
26 26
27struct cvb_coef { 27#include "gk20a.h"
28 int c0;
29 int c1;
30 int c2;
31 int c3;
32 int c4;
33 int c5;
34};
35
36struct gk20a_volt {
37 struct nvkm_volt base;
38 struct regulator *vdd;
39};
40 28
41const struct cvb_coef gk20a_cvb_coef[] = { 29static const struct cvb_coef gk20a_cvb_coef[] = {
42 /* MHz, c0, c1, c2, c3, c4, c5 */ 30 /* MHz, c0, c1, c2, c3, c4, c5 */
43 /* 72 */ { 1209886, -36468, 515, 417, -13123, 203}, 31 /* 72 */ { 1209886, -36468, 515, 417, -13123, 203},
44 /* 108 */ { 1130804, -27659, 296, 298, -10834, 221}, 32 /* 108 */ { 1130804, -27659, 296, 298, -10834, 221},
@@ -89,7 +77,7 @@ gk20a_volt_get_cvb_t_voltage(int speedo, int temp, int s_scale, int t_scale,
89 return mv; 77 return mv;
90} 78}
91 79
92static int 80int
93gk20a_volt_calc_voltage(const struct cvb_coef *coef, int speedo) 81gk20a_volt_calc_voltage(const struct cvb_coef *coef, int speedo)
94{ 82{
95 int mv; 83 int mv;
@@ -100,7 +88,7 @@ gk20a_volt_calc_voltage(const struct cvb_coef *coef, int speedo)
100 return mv * 1000; 88 return mv * 1000;
101} 89}
102 90
103static int 91int
104gk20a_volt_vid_get(struct nvkm_volt *base) 92gk20a_volt_vid_get(struct nvkm_volt *base)
105{ 93{
106 struct gk20a_volt *volt = gk20a_volt(base); 94 struct gk20a_volt *volt = gk20a_volt(base);
@@ -115,7 +103,7 @@ gk20a_volt_vid_get(struct nvkm_volt *base)
115 return -EINVAL; 103 return -EINVAL;
116} 104}
117 105
118static int 106int
119gk20a_volt_vid_set(struct nvkm_volt *base, u8 vid) 107gk20a_volt_vid_set(struct nvkm_volt *base, u8 vid)
120{ 108{
121 struct gk20a_volt *volt = gk20a_volt(base); 109 struct gk20a_volt *volt = gk20a_volt(base);
@@ -125,7 +113,7 @@ gk20a_volt_vid_set(struct nvkm_volt *base, u8 vid)
125 return regulator_set_voltage(volt->vdd, volt->base.vid[vid].uv, 1200000); 113 return regulator_set_voltage(volt->vdd, volt->base.vid[vid].uv, 1200000);
126} 114}
127 115
128static int 116int
129gk20a_volt_set_id(struct nvkm_volt *base, u8 id, int condition) 117gk20a_volt_set_id(struct nvkm_volt *base, u8 id, int condition)
130{ 118{
131 struct gk20a_volt *volt = gk20a_volt(base); 119 struct gk20a_volt *volt = gk20a_volt(base);
@@ -155,30 +143,25 @@ gk20a_volt = {
155}; 143};
156 144
157int 145int
158gk20a_volt_new(struct nvkm_device *device, int index, struct nvkm_volt **pvolt) 146_gk20a_volt_ctor(struct nvkm_device *device, int index,
147 const struct cvb_coef *coefs, int nb_coefs,
148 struct gk20a_volt *volt)
159{ 149{
160 struct nvkm_device_tegra *tdev = device->func->tegra(device); 150 struct nvkm_device_tegra *tdev = device->func->tegra(device);
161 struct gk20a_volt *volt;
162 int i, uv; 151 int i, uv;
163 152
164 if (!(volt = kzalloc(sizeof(*volt), GFP_KERNEL)))
165 return -ENOMEM;
166
167 nvkm_volt_ctor(&gk20a_volt, device, index, &volt->base); 153 nvkm_volt_ctor(&gk20a_volt, device, index, &volt->base);
168 *pvolt = &volt->base;
169 154
170 uv = regulator_get_voltage(tdev->vdd); 155 uv = regulator_get_voltage(tdev->vdd);
171 nvkm_info(&volt->base.subdev, "The default voltage is %duV\n", uv); 156 nvkm_debug(&volt->base.subdev, "the default voltage is %duV\n", uv);
172 157
173 volt->vdd = tdev->vdd; 158 volt->vdd = tdev->vdd;
174 159
175 volt->base.vid_nr = ARRAY_SIZE(gk20a_cvb_coef); 160 volt->base.vid_nr = nb_coefs;
176 nvkm_debug(&volt->base.subdev, "%s - vid_nr = %d\n", __func__,
177 volt->base.vid_nr);
178 for (i = 0; i < volt->base.vid_nr; i++) { 161 for (i = 0; i < volt->base.vid_nr; i++) {
179 volt->base.vid[i].vid = i; 162 volt->base.vid[i].vid = i;
180 volt->base.vid[i].uv = 163 volt->base.vid[i].uv =
181 gk20a_volt_calc_voltage(&gk20a_cvb_coef[i], 164 gk20a_volt_calc_voltage(&coefs[i],
182 tdev->gpu_speedo); 165 tdev->gpu_speedo);
183 nvkm_debug(&volt->base.subdev, "%2d: vid=%d, uv=%d\n", i, 166 nvkm_debug(&volt->base.subdev, "%2d: vid=%d, uv=%d\n", i,
184 volt->base.vid[i].vid, volt->base.vid[i].uv); 167 volt->base.vid[i].vid, volt->base.vid[i].uv);
@@ -186,3 +169,17 @@ gk20a_volt_new(struct nvkm_device *device, int index, struct nvkm_volt **pvolt)
186 169
187 return 0; 170 return 0;
188} 171}
172
173int
174gk20a_volt_new(struct nvkm_device *device, int index, struct nvkm_volt **pvolt)
175{
176 struct gk20a_volt *volt;
177
178 volt = kzalloc(sizeof(*volt), GFP_KERNEL);
179 if (!volt)
180 return -ENOMEM;
181 *pvolt = &volt->base;
182
183 return _gk20a_volt_ctor(device, index, gk20a_cvb_coef,
184 ARRAY_SIZE(gk20a_cvb_coef), volt);
185}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk20a.h b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk20a.h
new file mode 100644
index 000000000000..0fa3b502bcf8
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk20a.h
@@ -0,0 +1,49 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef __GK20A_VOLT_H__
24#define __GK20A_VOLT_H__
25
26struct cvb_coef {
27 int c0;
28 int c1;
29 int c2;
30 int c3;
31 int c4;
32 int c5;
33};
34
35struct gk20a_volt {
36 struct nvkm_volt base;
37 struct regulator *vdd;
38};
39
40int _gk20a_volt_ctor(struct nvkm_device *device, int index,
41 const struct cvb_coef *coefs, int nb_coefs,
42 struct gk20a_volt *volt);
43
44int gk20a_volt_calc_voltage(const struct cvb_coef *coef, int speedo);
45int gk20a_volt_vid_get(struct nvkm_volt *volt);
46int gk20a_volt_vid_set(struct nvkm_volt *volt, u8 vid);
47int gk20a_volt_set_id(struct nvkm_volt *volt, u8 id, int condition);
48
49#endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gm20b.c b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gm20b.c
new file mode 100644
index 000000000000..49b5ecb701e4
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gm20b.c
@@ -0,0 +1,56 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#include "priv.h"
24#include "gk20a.h"
25
26#include <core/tegra.h>
27
28const struct cvb_coef gm20b_cvb_coef[] = {
29 /* KHz, c0, c1, c2 */
30 /* 76800 */ { 1786666, -85625, 1632 },
31 /* 153600 */ { 1846729, -87525, 1632 },
32 /* 230400 */ { 1910480, -89425, 1632 },
33 /* 307200 */ { 1977920, -91325, 1632 },
34 /* 384000 */ { 2049049, -93215, 1632 },
35 /* 460800 */ { 2122872, -95095, 1632 },
36 /* 537600 */ { 2201331, -96985, 1632 },
37 /* 614400 */ { 2283479, -98885, 1632 },
38 /* 691200 */ { 2369315, -100785, 1632 },
39 /* 768000 */ { 2458841, -102685, 1632 },
40 /* 844800 */ { 2550821, -104555, 1632 },
41 /* 921600 */ { 2647676, -106455, 1632 },
42};
43
44int
45gm20b_volt_new(struct nvkm_device *device, int index, struct nvkm_volt **pvolt)
46{
47 struct gk20a_volt *volt;
48
49 volt = kzalloc(sizeof(*volt), GFP_KERNEL);
50 if (!volt)
51 return -ENOMEM;
52 *pvolt = &volt->base;
53
54 return _gk20a_volt_ctor(device, index, gm20b_cvb_coef,
55 ARRAY_SIZE(gm20b_cvb_coef), volt);
56}