aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2015-01-14 00:10:40 -0500
committerBen Skeggs <bskeggs@redhat.com>2015-01-21 21:17:57 -0500
commit21b137916ec25a507dbf7b6fe8b353fe9dc723c0 (patch)
tree4aa7f6194178e4a9ee6f2e174d775dce627b5ab1
parent42594600095f03244a674fecdd2b5f6da2441180 (diff)
drm/nouveau/pmu: namespace + nvidia gpu names (no binary change)
The namespace of NVKM is being changed to nvkm_ instead of nouveau_, which will be used for the DRM part of the driver. This is being done in order to make it very clear as to what part of the driver a given symbol belongs to, and as a minor step towards splitting the DRM driver out to be able to stand on its own (for virt). Because there's already a large amount of churn here anyway, this is as good a time as any to also switch to NVIDIA's device and chipset naming to ease collaboration with them. A comparison of objdump disassemblies proves no code changes. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r--drivers/gpu/drm/nouveau/include/nvkm/core/os.h4
-rw-r--r--drivers/gpu/drm/nouveau/include/nvkm/subdev/pmu.h56
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/device/gm100.c4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/device/nv50.c8
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/device/nvc0.c16
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/device/nve0.c10
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgf100.c1
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgk104.c1
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c1
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/Kbuild8
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c64
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gf100.fuc3 (renamed from drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/nvc0.fuc3)4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gf100.fuc3.h (renamed from drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/nvc0.fuc3.h)4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gf110.fuc4 (renamed from drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/nvd0.fuc4)4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gf110.fuc4.h (renamed from drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/nvd0.fuc4.h)4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gk208.fuc5 (renamed from drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/nv108.fuc5)4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gk208.fuc5.h (renamed from drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/nv108.fuc5.h)4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gt215.fuc3 (renamed from drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/nva3.fuc3)4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gt215.fuc3.h (renamed from drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/nva3.fuc3.h)4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gf100.c (renamed from drivers/gpu/drm/nouveau/nvkm/subdev/pmu/nvc0.c)25
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gf110.c (renamed from drivers/gpu/drm/nouveau/nvkm/subdev/pmu/nvd0.c)25
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk104.c22
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk208.c (renamed from drivers/gpu/drm/nouveau/nvkm/subdev/pmu/nv108.c)25
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk20a.c65
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gt215.c (renamed from drivers/gpu/drm/nouveau/nvkm/subdev/pmu/nva3.c)31
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/memx.c49
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/priv.h44
27 files changed, 239 insertions, 252 deletions
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/os.h b/drivers/gpu/drm/nouveau/include/nvkm/core/os.h
index 423086564735..625d390d4c22 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/core/os.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/core/os.h
@@ -209,6 +209,10 @@
209#define nouveau_volt nvkm_volt 209#define nouveau_volt nvkm_volt
210#define nouveau_timer nvkm_timer 210#define nouveau_timer nvkm_timer
211#define nouveau_timer_wait_eq nvkm_timer_wait_eq 211#define nouveau_timer_wait_eq nvkm_timer_wait_eq
212#define nouveau_timer_alarm nvkm_timer_alarm
213#define nouveau_alarm nvkm_alarm
214#define nouveau_timer_alarm_cancel nvkm_timer_alarm_cancel
215#define nouveau_alarm_init nvkm_alarm_init
212#define nva3_pll_calc gt215_pll_calc 216#define nva3_pll_calc gt215_pll_calc
213#define nouveau_clk nvkm_clk 217#define nouveau_clk nvkm_clk
214#define nouveau_domain nvkm_domain 218#define nouveau_domain nvkm_domain
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/pmu.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/pmu.h
index c890a4fb3cbb..7b86acc634a0 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/pmu.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/pmu.h
@@ -1,11 +1,9 @@
1#ifndef __NOUVEAU_PMU_H__ 1#ifndef __NVKM_PMU_H__
2#define __NOUVEAU_PMU_H__ 2#define __NVKM_PMU_H__
3
4#include <core/subdev.h> 3#include <core/subdev.h>
5#include <core/device.h>
6 4
7struct nouveau_pmu { 5struct nvkm_pmu {
8 struct nouveau_subdev base; 6 struct nvkm_subdev base;
9 7
10 struct { 8 struct {
11 u32 base; 9 u32 base;
@@ -23,35 +21,33 @@ struct nouveau_pmu {
23 u32 data[2]; 21 u32 data[2];
24 } recv; 22 } recv;
25 23
26 int (*message)(struct nouveau_pmu *, u32[2], u32, u32, u32, u32); 24 int (*message)(struct nvkm_pmu *, u32[2], u32, u32, u32, u32);
27 void (*pgob)(struct nouveau_pmu *, bool); 25 void (*pgob)(struct nvkm_pmu *, bool);
28}; 26};
29 27
30static inline struct nouveau_pmu * 28static inline struct nvkm_pmu *
31nouveau_pmu(void *obj) 29nvkm_pmu(void *obj)
32{ 30{
33 return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_PMU); 31 return (void *)nvkm_subdev(obj, NVDEV_SUBDEV_PMU);
34} 32}
35 33
36extern struct nouveau_oclass *nva3_pmu_oclass; 34extern struct nvkm_oclass *gt215_pmu_oclass;
37extern struct nouveau_oclass *nvc0_pmu_oclass; 35extern struct nvkm_oclass *gf100_pmu_oclass;
38extern struct nouveau_oclass *nvd0_pmu_oclass; 36extern struct nvkm_oclass *gf110_pmu_oclass;
39extern struct nouveau_oclass *gk104_pmu_oclass; 37extern struct nvkm_oclass *gk104_pmu_oclass;
40extern struct nouveau_oclass *nv108_pmu_oclass; 38extern struct nvkm_oclass *gk208_pmu_oclass;
41extern struct nouveau_oclass *gk20a_pmu_oclass; 39extern struct nvkm_oclass *gk20a_pmu_oclass;
42 40
43/* interface to MEMX process running on PMU */ 41/* interface to MEMX process running on PMU */
44struct nouveau_memx; 42struct nvkm_memx;
45int nouveau_memx_init(struct nouveau_pmu *, struct nouveau_memx **); 43int nvkm_memx_init(struct nvkm_pmu *, struct nvkm_memx **);
46int nouveau_memx_fini(struct nouveau_memx **, bool exec); 44int nvkm_memx_fini(struct nvkm_memx **, bool exec);
47void nouveau_memx_wr32(struct nouveau_memx *, u32 addr, u32 data); 45void nvkm_memx_wr32(struct nvkm_memx *, u32 addr, u32 data);
48void nouveau_memx_wait(struct nouveau_memx *, 46void nvkm_memx_wait(struct nvkm_memx *, u32 addr, u32 mask, u32 data, u32 nsec);
49 u32 addr, u32 mask, u32 data, u32 nsec); 47void nvkm_memx_nsec(struct nvkm_memx *, u32 nsec);
50void nouveau_memx_nsec(struct nouveau_memx *, u32 nsec); 48void nvkm_memx_wait_vblank(struct nvkm_memx *);
51void nouveau_memx_wait_vblank(struct nouveau_memx *); 49void nvkm_memx_train(struct nvkm_memx *);
52void nouveau_memx_train(struct nouveau_memx *); 50int nvkm_memx_train_result(struct nvkm_pmu *, u32 *, int);
53int nouveau_memx_train_result(struct nouveau_pmu *, u32 *, int); 51void nvkm_memx_block(struct nvkm_memx *);
54void nouveau_memx_block(struct nouveau_memx *); 52void nvkm_memx_unblock(struct nvkm_memx *);
55void nouveau_memx_unblock(struct nouveau_memx *);
56
57#endif 53#endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/gm100.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/gm100.c
index adf9c27a88b6..342305f8abd8 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/gm100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/gm100.c
@@ -78,7 +78,7 @@ gm100_identify(struct nouveau_device *device)
78 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass; 78 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass;
79 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass; 79 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass;
80 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass; 80 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass;
81 device->oclass[NVDEV_SUBDEV_PMU ] = nv108_pmu_oclass; 81 device->oclass[NVDEV_SUBDEV_PMU ] = gk208_pmu_oclass;
82 82
83#if 0 83#if 0
84 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass; 84 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass;
@@ -122,7 +122,7 @@ gm100_identify(struct nouveau_device *device)
122 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass; 122 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass;
123 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass; 123 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass;
124 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass; 124 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass;
125 device->oclass[NVDEV_SUBDEV_PMU ] = nv108_pmu_oclass; 125 device->oclass[NVDEV_SUBDEV_PMU ] = gk208_pmu_oclass;
126#if 0 126#if 0
127 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass; 127 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass;
128#endif 128#endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/nv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/nv50.c
index 6183cc372d17..9394962e6c7f 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/nv50.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/nv50.c
@@ -365,7 +365,7 @@ nv50_identify(struct nouveau_device *device)
365 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass; 365 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass;
366 device->oclass[NVDEV_SUBDEV_MMU ] = &nv50_mmu_oclass; 366 device->oclass[NVDEV_SUBDEV_MMU ] = &nv50_mmu_oclass;
367 device->oclass[NVDEV_SUBDEV_BAR ] = &nv50_bar_oclass; 367 device->oclass[NVDEV_SUBDEV_BAR ] = &nv50_bar_oclass;
368 device->oclass[NVDEV_SUBDEV_PMU ] = nva3_pmu_oclass; 368 device->oclass[NVDEV_SUBDEV_PMU ] = gt215_pmu_oclass;
369 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass; 369 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass;
370 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nv50_dmaeng_oclass; 370 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nv50_dmaeng_oclass;
371 device->oclass[NVDEV_ENGINE_FIFO ] = nv84_fifo_oclass; 371 device->oclass[NVDEV_ENGINE_FIFO ] = nv84_fifo_oclass;
@@ -396,7 +396,7 @@ nv50_identify(struct nouveau_device *device)
396 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass; 396 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass;
397 device->oclass[NVDEV_SUBDEV_MMU ] = &nv50_mmu_oclass; 397 device->oclass[NVDEV_SUBDEV_MMU ] = &nv50_mmu_oclass;
398 device->oclass[NVDEV_SUBDEV_BAR ] = &nv50_bar_oclass; 398 device->oclass[NVDEV_SUBDEV_BAR ] = &nv50_bar_oclass;
399 device->oclass[NVDEV_SUBDEV_PMU ] = nva3_pmu_oclass; 399 device->oclass[NVDEV_SUBDEV_PMU ] = gt215_pmu_oclass;
400 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass; 400 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass;
401 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nv50_dmaeng_oclass; 401 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nv50_dmaeng_oclass;
402 device->oclass[NVDEV_ENGINE_FIFO ] = nv84_fifo_oclass; 402 device->oclass[NVDEV_ENGINE_FIFO ] = nv84_fifo_oclass;
@@ -426,7 +426,7 @@ nv50_identify(struct nouveau_device *device)
426 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass; 426 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass;
427 device->oclass[NVDEV_SUBDEV_MMU ] = &nv50_mmu_oclass; 427 device->oclass[NVDEV_SUBDEV_MMU ] = &nv50_mmu_oclass;
428 device->oclass[NVDEV_SUBDEV_BAR ] = &nv50_bar_oclass; 428 device->oclass[NVDEV_SUBDEV_BAR ] = &nv50_bar_oclass;
429 device->oclass[NVDEV_SUBDEV_PMU ] = nva3_pmu_oclass; 429 device->oclass[NVDEV_SUBDEV_PMU ] = gt215_pmu_oclass;
430 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass; 430 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass;
431 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nv50_dmaeng_oclass; 431 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nv50_dmaeng_oclass;
432 device->oclass[NVDEV_ENGINE_FIFO ] = nv84_fifo_oclass; 432 device->oclass[NVDEV_ENGINE_FIFO ] = nv84_fifo_oclass;
@@ -456,7 +456,7 @@ nv50_identify(struct nouveau_device *device)
456 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass; 456 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass;
457 device->oclass[NVDEV_SUBDEV_MMU ] = &nv50_mmu_oclass; 457 device->oclass[NVDEV_SUBDEV_MMU ] = &nv50_mmu_oclass;
458 device->oclass[NVDEV_SUBDEV_BAR ] = &nv50_bar_oclass; 458 device->oclass[NVDEV_SUBDEV_BAR ] = &nv50_bar_oclass;
459 device->oclass[NVDEV_SUBDEV_PMU ] = nva3_pmu_oclass; 459 device->oclass[NVDEV_SUBDEV_PMU ] = gt215_pmu_oclass;
460 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass; 460 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass;
461 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nv50_dmaeng_oclass; 461 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nv50_dmaeng_oclass;
462 device->oclass[NVDEV_ENGINE_FIFO ] = nv84_fifo_oclass; 462 device->oclass[NVDEV_ENGINE_FIFO ] = nv84_fifo_oclass;
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/nvc0.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/nvc0.c
index 6cd796c33ba0..90f3fcc47c55 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/nvc0.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/nvc0.c
@@ -78,7 +78,7 @@ nvc0_identify(struct nouveau_device *device)
78 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass; 78 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass;
79 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass; 79 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass;
80 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass; 80 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass;
81 device->oclass[NVDEV_SUBDEV_PMU ] = nvc0_pmu_oclass; 81 device->oclass[NVDEV_SUBDEV_PMU ] = gf100_pmu_oclass;
82 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass; 82 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass;
83 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvc0_dmaeng_oclass; 83 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvc0_dmaeng_oclass;
84 device->oclass[NVDEV_ENGINE_FIFO ] = nvc0_fifo_oclass; 84 device->oclass[NVDEV_ENGINE_FIFO ] = nvc0_fifo_oclass;
@@ -111,7 +111,7 @@ nvc0_identify(struct nouveau_device *device)
111 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass; 111 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass;
112 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass; 112 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass;
113 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass; 113 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass;
114 device->oclass[NVDEV_SUBDEV_PMU ] = nvc0_pmu_oclass; 114 device->oclass[NVDEV_SUBDEV_PMU ] = gf100_pmu_oclass;
115 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass; 115 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass;
116 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvc0_dmaeng_oclass; 116 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvc0_dmaeng_oclass;
117 device->oclass[NVDEV_ENGINE_FIFO ] = nvc0_fifo_oclass; 117 device->oclass[NVDEV_ENGINE_FIFO ] = nvc0_fifo_oclass;
@@ -144,7 +144,7 @@ nvc0_identify(struct nouveau_device *device)
144 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass; 144 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass;
145 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass; 145 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass;
146 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass; 146 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass;
147 device->oclass[NVDEV_SUBDEV_PMU ] = nvc0_pmu_oclass; 147 device->oclass[NVDEV_SUBDEV_PMU ] = gf100_pmu_oclass;
148 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass; 148 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass;
149 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvc0_dmaeng_oclass; 149 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvc0_dmaeng_oclass;
150 device->oclass[NVDEV_ENGINE_FIFO ] = nvc0_fifo_oclass; 150 device->oclass[NVDEV_ENGINE_FIFO ] = nvc0_fifo_oclass;
@@ -176,7 +176,7 @@ nvc0_identify(struct nouveau_device *device)
176 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass; 176 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass;
177 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass; 177 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass;
178 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass; 178 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass;
179 device->oclass[NVDEV_SUBDEV_PMU ] = nvc0_pmu_oclass; 179 device->oclass[NVDEV_SUBDEV_PMU ] = gf100_pmu_oclass;
180 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass; 180 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass;
181 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvc0_dmaeng_oclass; 181 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvc0_dmaeng_oclass;
182 device->oclass[NVDEV_ENGINE_FIFO ] = nvc0_fifo_oclass; 182 device->oclass[NVDEV_ENGINE_FIFO ] = nvc0_fifo_oclass;
@@ -209,7 +209,7 @@ nvc0_identify(struct nouveau_device *device)
209 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass; 209 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass;
210 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass; 210 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass;
211 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass; 211 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass;
212 device->oclass[NVDEV_SUBDEV_PMU ] = nvc0_pmu_oclass; 212 device->oclass[NVDEV_SUBDEV_PMU ] = gf100_pmu_oclass;
213 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass; 213 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass;
214 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvc0_dmaeng_oclass; 214 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvc0_dmaeng_oclass;
215 device->oclass[NVDEV_ENGINE_FIFO ] = nvc0_fifo_oclass; 215 device->oclass[NVDEV_ENGINE_FIFO ] = nvc0_fifo_oclass;
@@ -241,7 +241,7 @@ nvc0_identify(struct nouveau_device *device)
241 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass; 241 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass;
242 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass; 242 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass;
243 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass; 243 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass;
244 device->oclass[NVDEV_SUBDEV_PMU ] = nvc0_pmu_oclass; 244 device->oclass[NVDEV_SUBDEV_PMU ] = gf100_pmu_oclass;
245 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass; 245 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass;
246 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvc0_dmaeng_oclass; 246 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvc0_dmaeng_oclass;
247 device->oclass[NVDEV_ENGINE_FIFO ] = nvc0_fifo_oclass; 247 device->oclass[NVDEV_ENGINE_FIFO ] = nvc0_fifo_oclass;
@@ -273,7 +273,7 @@ nvc0_identify(struct nouveau_device *device)
273 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass; 273 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass;
274 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass; 274 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass;
275 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass; 275 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass;
276 device->oclass[NVDEV_SUBDEV_PMU ] = nvc0_pmu_oclass; 276 device->oclass[NVDEV_SUBDEV_PMU ] = gf100_pmu_oclass;
277 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass; 277 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass;
278 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvc0_dmaeng_oclass; 278 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvc0_dmaeng_oclass;
279 device->oclass[NVDEV_ENGINE_FIFO ] = nvc0_fifo_oclass; 279 device->oclass[NVDEV_ENGINE_FIFO ] = nvc0_fifo_oclass;
@@ -306,7 +306,7 @@ nvc0_identify(struct nouveau_device *device)
306 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass; 306 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass;
307 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass; 307 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass;
308 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass; 308 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass;
309 device->oclass[NVDEV_SUBDEV_PMU ] = nvd0_pmu_oclass; 309 device->oclass[NVDEV_SUBDEV_PMU ] = gf110_pmu_oclass;
310 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass; 310 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass;
311 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvd0_dmaeng_oclass; 311 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvd0_dmaeng_oclass;
312 device->oclass[NVDEV_ENGINE_FIFO ] = nvc0_fifo_oclass; 312 device->oclass[NVDEV_ENGINE_FIFO ] = nvc0_fifo_oclass;
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/nve0.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/nve0.c
index 64aee47dee89..6b6e54828efb 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/nve0.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/nve0.c
@@ -112,7 +112,7 @@ nve0_identify(struct nouveau_device *device)
112 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass; 112 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass;
113 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass; 113 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass;
114 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass; 114 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass;
115 device->oclass[NVDEV_SUBDEV_PMU ] = nvd0_pmu_oclass; 115 device->oclass[NVDEV_SUBDEV_PMU ] = gf110_pmu_oclass;
116 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass; 116 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass;
117 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvd0_dmaeng_oclass; 117 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvd0_dmaeng_oclass;
118 device->oclass[NVDEV_ENGINE_FIFO ] = nve0_fifo_oclass; 118 device->oclass[NVDEV_ENGINE_FIFO ] = nve0_fifo_oclass;
@@ -202,7 +202,7 @@ nve0_identify(struct nouveau_device *device)
202 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass; 202 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass;
203 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass; 203 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass;
204 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass; 204 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass;
205 device->oclass[NVDEV_SUBDEV_PMU ] = nvd0_pmu_oclass; 205 device->oclass[NVDEV_SUBDEV_PMU ] = gf110_pmu_oclass;
206 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass; 206 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass;
207 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvd0_dmaeng_oclass; 207 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvd0_dmaeng_oclass;
208 device->oclass[NVDEV_ENGINE_FIFO ] = nve0_fifo_oclass; 208 device->oclass[NVDEV_ENGINE_FIFO ] = nve0_fifo_oclass;
@@ -236,7 +236,7 @@ nve0_identify(struct nouveau_device *device)
236 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass; 236 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass;
237 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass; 237 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass;
238 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass; 238 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass;
239 device->oclass[NVDEV_SUBDEV_PMU ] = nvd0_pmu_oclass; 239 device->oclass[NVDEV_SUBDEV_PMU ] = gf110_pmu_oclass;
240 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass; 240 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass;
241 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvd0_dmaeng_oclass; 241 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvd0_dmaeng_oclass;
242 device->oclass[NVDEV_ENGINE_FIFO ] = nve0_fifo_oclass; 242 device->oclass[NVDEV_ENGINE_FIFO ] = nve0_fifo_oclass;
@@ -270,7 +270,7 @@ nve0_identify(struct nouveau_device *device)
270 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass; 270 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass;
271 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass; 271 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass;
272 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass; 272 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass;
273 device->oclass[NVDEV_SUBDEV_PMU ] = nv108_pmu_oclass; 273 device->oclass[NVDEV_SUBDEV_PMU ] = gk208_pmu_oclass;
274 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass; 274 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass;
275 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvd0_dmaeng_oclass; 275 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvd0_dmaeng_oclass;
276 device->oclass[NVDEV_ENGINE_FIFO ] = nv108_fifo_oclass; 276 device->oclass[NVDEV_ENGINE_FIFO ] = nv108_fifo_oclass;
@@ -303,7 +303,7 @@ nve0_identify(struct nouveau_device *device)
303 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass; 303 device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass;
304 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass; 304 device->oclass[NVDEV_SUBDEV_MMU ] = &gf100_mmu_oclass;
305 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass; 305 device->oclass[NVDEV_SUBDEV_BAR ] = &gf100_bar_oclass;
306 device->oclass[NVDEV_SUBDEV_PMU ] = nv108_pmu_oclass; 306 device->oclass[NVDEV_SUBDEV_PMU ] = gk208_pmu_oclass;
307 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass; 307 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass;
308 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvd0_dmaeng_oclass; 308 device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvd0_dmaeng_oclass;
309 device->oclass[NVDEV_ENGINE_FIFO ] = nv108_fifo_oclass; 309 device->oclass[NVDEV_ENGINE_FIFO ] = nv108_fifo_oclass;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgf100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgf100.c
index dcb175bea84b..de9f39569943 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgf100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgf100.c
@@ -24,6 +24,7 @@
24#include "gf100.h" 24#include "gf100.h"
25#include "ramfuc.h" 25#include "ramfuc.h"
26 26
27#include <core/device.h>
27#include <core/option.h> 28#include <core/option.h>
28#include <subdev/bios.h> 29#include <subdev/bios.h>
29#include <subdev/bios/pll.h> 30#include <subdev/bios/pll.h>
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgk104.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgk104.c
index 97060ccfb80c..1ef15c3e6a81 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgk104.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgk104.c
@@ -24,6 +24,7 @@
24#include "ramfuc.h" 24#include "ramfuc.h"
25#include "gf100.h" 25#include "gf100.h"
26 26
27#include <core/device.h>
27#include <core/option.h> 28#include <core/option.h>
28#include <subdev/bios.h> 29#include <subdev/bios.h>
29#include <subdev/bios/init.h> 30#include <subdev/bios/init.h>
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c
index 692a1cc6c957..24176401b49b 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c
@@ -26,6 +26,7 @@
26#include "ramfuc.h" 26#include "ramfuc.h"
27#include "nv50.h" 27#include "nv50.h"
28 28
29#include <core/device.h>
29#include <core/option.h> 30#include <core/option.h>
30#include <subdev/bios.h> 31#include <subdev/bios.h>
31#include <subdev/bios/M0205.h> 32#include <subdev/bios/M0205.h>
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/Kbuild b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/Kbuild
index 85c8392c8ace..9a150d520225 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/Kbuild
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/Kbuild
@@ -1,8 +1,8 @@
1nvkm-y += nvkm/subdev/pmu/base.o 1nvkm-y += nvkm/subdev/pmu/base.o
2nvkm-y += nvkm/subdev/pmu/memx.o 2nvkm-y += nvkm/subdev/pmu/memx.o
3nvkm-y += nvkm/subdev/pmu/nva3.o 3nvkm-y += nvkm/subdev/pmu/gt215.o
4nvkm-y += nvkm/subdev/pmu/nvc0.o 4nvkm-y += nvkm/subdev/pmu/gf100.o
5nvkm-y += nvkm/subdev/pmu/nvd0.o 5nvkm-y += nvkm/subdev/pmu/gf110.o
6nvkm-y += nvkm/subdev/pmu/gk104.o 6nvkm-y += nvkm/subdev/pmu/gk104.o
7nvkm-y += nvkm/subdev/pmu/nv108.o 7nvkm-y += nvkm/subdev/pmu/gk208.o
8nvkm-y += nvkm/subdev/pmu/gk20a.o 8nvkm-y += nvkm/subdev/pmu/gk20a.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c
index 562ea6e16819..054b2d2eec35 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c
@@ -21,13 +21,12 @@
21 * 21 *
22 * Authors: Ben Skeggs 22 * Authors: Ben Skeggs
23 */ 23 */
24#include "priv.h"
24 25
25#include <subdev/timer.h> 26#include <subdev/timer.h>
26 27
27#include "priv.h"
28
29void 28void
30nouveau_pmu_pgob(struct nouveau_pmu *pmu, bool enable) 29nvkm_pmu_pgob(struct nvkm_pmu *pmu, bool enable)
31{ 30{
32 const struct nvkm_pmu_impl *impl = (void *)nv_oclass(pmu); 31 const struct nvkm_pmu_impl *impl = (void *)nv_oclass(pmu);
33 if (impl->pgob) 32 if (impl->pgob)
@@ -35,10 +34,10 @@ nouveau_pmu_pgob(struct nouveau_pmu *pmu, bool enable)
35} 34}
36 35
37static int 36static int
38nouveau_pmu_send(struct nouveau_pmu *pmu, u32 reply[2], 37nvkm_pmu_send(struct nvkm_pmu *pmu, u32 reply[2],
39 u32 process, u32 message, u32 data0, u32 data1) 38 u32 process, u32 message, u32 data0, u32 data1)
40{ 39{
41 struct nouveau_subdev *subdev = nv_subdev(pmu); 40 struct nvkm_subdev *subdev = nv_subdev(pmu);
42 u32 addr; 41 u32 addr;
43 42
44 /* wait for a free slot in the fifo */ 43 /* wait for a free slot in the fifo */
@@ -85,10 +84,9 @@ nouveau_pmu_send(struct nouveau_pmu *pmu, u32 reply[2],
85} 84}
86 85
87static void 86static void
88nouveau_pmu_recv(struct work_struct *work) 87nvkm_pmu_recv(struct work_struct *work)
89{ 88{
90 struct nouveau_pmu *pmu = 89 struct nvkm_pmu *pmu = container_of(work, struct nvkm_pmu, recv.work);
91 container_of(work, struct nouveau_pmu, recv.work);
92 u32 process, message, data0, data1; 90 u32 process, message, data0, data1;
93 91
94 /* nothing to do if GET == PUT */ 92 /* nothing to do if GET == PUT */
@@ -137,9 +135,9 @@ nouveau_pmu_recv(struct work_struct *work)
137} 135}
138 136
139static void 137static void
140nouveau_pmu_intr(struct nouveau_subdev *subdev) 138nvkm_pmu_intr(struct nvkm_subdev *subdev)
141{ 139{
142 struct nouveau_pmu *pmu = (void *)subdev; 140 struct nvkm_pmu *pmu = (void *)subdev;
143 u32 disp = nv_rd32(pmu, 0x10a01c); 141 u32 disp = nv_rd32(pmu, 0x10a01c);
144 u32 intr = nv_rd32(pmu, 0x10a008) & disp & ~(disp >> 16); 142 u32 intr = nv_rd32(pmu, 0x10a008) & disp & ~(disp >> 16);
145 143
@@ -161,7 +159,7 @@ nouveau_pmu_intr(struct nouveau_subdev *subdev)
161 159
162 if (intr & 0x00000080) { 160 if (intr & 0x00000080) {
163 nv_info(pmu, "wr32 0x%06x 0x%08x\n", nv_rd32(pmu, 0x10a7a0), 161 nv_info(pmu, "wr32 0x%06x 0x%08x\n", nv_rd32(pmu, 0x10a7a0),
164 nv_rd32(pmu, 0x10a7a4)); 162 nv_rd32(pmu, 0x10a7a4));
165 nv_wr32(pmu, 0x10a004, 0x00000080); 163 nv_wr32(pmu, 0x10a004, 0x00000080);
166 intr &= ~0x00000080; 164 intr &= ~0x00000080;
167 } 165 }
@@ -173,30 +171,30 @@ nouveau_pmu_intr(struct nouveau_subdev *subdev)
173} 171}
174 172
175int 173int
176_nouveau_pmu_fini(struct nouveau_object *object, bool suspend) 174_nvkm_pmu_fini(struct nvkm_object *object, bool suspend)
177{ 175{
178 struct nouveau_pmu *pmu = (void *)object; 176 struct nvkm_pmu *pmu = (void *)object;
179 177
180 nv_wr32(pmu, 0x10a014, 0x00000060); 178 nv_wr32(pmu, 0x10a014, 0x00000060);
181 flush_work(&pmu->recv.work); 179 flush_work(&pmu->recv.work);
182 180
183 return nouveau_subdev_fini(&pmu->base, suspend); 181 return nvkm_subdev_fini(&pmu->base, suspend);
184} 182}
185 183
186int 184int
187_nouveau_pmu_init(struct nouveau_object *object) 185_nvkm_pmu_init(struct nvkm_object *object)
188{ 186{
189 const struct nvkm_pmu_impl *impl = (void *)object->oclass; 187 const struct nvkm_pmu_impl *impl = (void *)object->oclass;
190 struct nouveau_pmu *pmu = (void *)object; 188 struct nvkm_pmu *pmu = (void *)object;
191 int ret, i; 189 int ret, i;
192 190
193 ret = nouveau_subdev_init(&pmu->base); 191 ret = nvkm_subdev_init(&pmu->base);
194 if (ret) 192 if (ret)
195 return ret; 193 return ret;
196 194
197 nv_subdev(pmu)->intr = nouveau_pmu_intr; 195 nv_subdev(pmu)->intr = nvkm_pmu_intr;
198 pmu->message = nouveau_pmu_send; 196 pmu->message = nvkm_pmu_send;
199 pmu->pgob = nouveau_pmu_pgob; 197 pmu->pgob = nvkm_pmu_pgob;
200 198
201 /* prevent previous ucode from running, wait for idle, reset */ 199 /* prevent previous ucode from running, wait for idle, reset */
202 nv_wr32(pmu, 0x10a014, 0x0000ffff); /* INTR_EN_CLR = ALL */ 200 nv_wr32(pmu, 0x10a014, 0x0000ffff); /* INTR_EN_CLR = ALL */
@@ -241,32 +239,30 @@ _nouveau_pmu_init(struct nouveau_object *object)
241} 239}
242 240
243int 241int
244nouveau_pmu_create_(struct nouveau_object *parent, 242nvkm_pmu_create_(struct nvkm_object *parent, struct nvkm_object *engine,
245 struct nouveau_object *engine, 243 struct nvkm_oclass *oclass, int length, void **pobject)
246 struct nouveau_oclass *oclass, int length, void **pobject)
247{ 244{
248 struct nouveau_pmu *pmu; 245 struct nvkm_pmu *pmu;
249 int ret; 246 int ret;
250 247
251 ret = nouveau_subdev_create_(parent, engine, oclass, 0, "PMU", 248 ret = nvkm_subdev_create_(parent, engine, oclass, 0, "PMU",
252 "pmu", length, pobject); 249 "pmu", length, pobject);
253 pmu = *pobject; 250 pmu = *pobject;
254 if (ret) 251 if (ret)
255 return ret; 252 return ret;
256 253
257 INIT_WORK(&pmu->recv.work, nouveau_pmu_recv); 254 INIT_WORK(&pmu->recv.work, nvkm_pmu_recv);
258 init_waitqueue_head(&pmu->recv.wait); 255 init_waitqueue_head(&pmu->recv.wait);
259 return 0; 256 return 0;
260} 257}
261 258
262int 259int
263_nouveau_pmu_ctor(struct nouveau_object *parent, 260_nvkm_pmu_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
264 struct nouveau_object *engine, 261 struct nvkm_oclass *oclass, void *data, u32 size,
265 struct nouveau_oclass *oclass, void *data, u32 size, 262 struct nvkm_object **pobject)
266 struct nouveau_object **pobject)
267{ 263{
268 struct nouveau_pmu *pmu; 264 struct nvkm_pmu *pmu;
269 int ret = nouveau_pmu_create(parent, engine, oclass, &pmu); 265 int ret = nvkm_pmu_create(parent, engine, oclass, &pmu);
270 *pobject = nv_object(pmu); 266 *pobject = nv_object(pmu);
271 return ret; 267 return ret;
272} 268}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/nvc0.fuc3 b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gf100.fuc3
index 6eee93d3c313..37e8407b7462 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/nvc0.fuc3
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gf100.fuc3
@@ -32,7 +32,7 @@
32 32
33#include "macros.fuc" 33#include "macros.fuc"
34 34
35.section #nvc0_pmu_data 35.section #gf100_pmu_data
36#define INCLUDE_PROC 36#define INCLUDE_PROC
37#include "kernel.fuc" 37#include "kernel.fuc"
38#include "arith.fuc" 38#include "arith.fuc"
@@ -56,7 +56,7 @@
56#undef INCLUDE_DATA 56#undef INCLUDE_DATA
57.align 256 57.align 256
58 58
59.section #nvc0_pmu_code 59.section #gf100_pmu_code
60#define INCLUDE_CODE 60#define INCLUDE_CODE
61#include "kernel.fuc" 61#include "kernel.fuc"
62#include "arith.fuc" 62#include "arith.fuc"
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/nvc0.fuc3.h b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gf100.fuc3.h
index 124f5c13ac0a..302557c52d03 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/nvc0.fuc3.h
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gf100.fuc3.h
@@ -1,4 +1,4 @@
1uint32_t nvc0_pmu_data[] = { 1uint32_t gf100_pmu_data[] = {
2/* 0x0000: proc_kern */ 2/* 0x0000: proc_kern */
3 0x52544e49, 3 0x52544e49,
4 0x00000000, 4 0x00000000,
@@ -916,7 +916,7 @@ uint32_t nvc0_pmu_data[] = {
916 0x00000000, 916 0x00000000,
917}; 917};
918 918
919uint32_t nvc0_pmu_code[] = { 919uint32_t gf100_pmu_code[] = {
920 0x039e0ef5, 920 0x039e0ef5,
921/* 0x0004: rd32 */ 921/* 0x0004: rd32 */
922 0x07a007f1, 922 0x07a007f1,
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/nvd0.fuc4 b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gf110.fuc4
index e11f9934d977..ae9c3f18ae01 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/nvd0.fuc4
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gf110.fuc4
@@ -32,7 +32,7 @@
32 32
33#include "macros.fuc" 33#include "macros.fuc"
34 34
35.section #nvd0_pmu_data 35.section #gf110_pmu_data
36#define INCLUDE_PROC 36#define INCLUDE_PROC
37#include "kernel.fuc" 37#include "kernel.fuc"
38#include "arith.fuc" 38#include "arith.fuc"
@@ -56,7 +56,7 @@
56#undef INCLUDE_DATA 56#undef INCLUDE_DATA
57.align 256 57.align 256
58 58
59.section #nvd0_pmu_code 59.section #gf110_pmu_code
60#define INCLUDE_CODE 60#define INCLUDE_CODE
61#include "kernel.fuc" 61#include "kernel.fuc"
62#include "arith.fuc" 62#include "arith.fuc"
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/nvd0.fuc4.h b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gf110.fuc4.h
index 6fc8c704f38b..a0c499e4543c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/nvd0.fuc4.h
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gf110.fuc4.h
@@ -1,4 +1,4 @@
1uint32_t nvd0_pmu_data[] = { 1uint32_t gf110_pmu_data[] = {
2/* 0x0000: proc_kern */ 2/* 0x0000: proc_kern */
3 0x52544e49, 3 0x52544e49,
4 0x00000000, 4 0x00000000,
@@ -915,7 +915,7 @@ uint32_t nvd0_pmu_data[] = {
915 0x00000000, 915 0x00000000,
916}; 916};
917 917
918uint32_t nvd0_pmu_code[] = { 918uint32_t gf110_pmu_code[] = {
919 0x034d0ef5, 919 0x034d0ef5,
920/* 0x0004: rd32 */ 920/* 0x0004: rd32 */
921 0x07a007f1, 921 0x07a007f1,
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/nv108.fuc5 b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gk208.fuc5
index d2214ab68f09..093dc81880f4 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/nv108.fuc5
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gk208.fuc5
@@ -32,7 +32,7 @@
32 32
33#include "macros.fuc" 33#include "macros.fuc"
34 34
35.section #nv108_pmu_data 35.section #gk208_pmu_data
36#define INCLUDE_PROC 36#define INCLUDE_PROC
37#include "kernel.fuc" 37#include "kernel.fuc"
38#include "arith.fuc" 38#include "arith.fuc"
@@ -56,7 +56,7 @@
56#undef INCLUDE_DATA 56#undef INCLUDE_DATA
57.align 256 57.align 256
58 58
59.section #nv108_pmu_code 59.section #gk208_pmu_code
60#define INCLUDE_CODE 60#define INCLUDE_CODE
61#include "kernel.fuc" 61#include "kernel.fuc"
62#include "arith.fuc" 62#include "arith.fuc"
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/nv108.fuc5.h b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gk208.fuc5.h
index c25ee1f88128..fe4f63deeaab 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/nv108.fuc5.h
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gk208.fuc5.h
@@ -1,4 +1,4 @@
1uint32_t nv108_pmu_data[] = { 1uint32_t gk208_pmu_data[] = {
2/* 0x0000: proc_kern */ 2/* 0x0000: proc_kern */
3 0x52544e49, 3 0x52544e49,
4 0x00000000, 4 0x00000000,
@@ -915,7 +915,7 @@ uint32_t nv108_pmu_data[] = {
915 0x00000000, 915 0x00000000,
916}; 916};
917 917
918uint32_t nv108_pmu_code[] = { 918uint32_t gk208_pmu_code[] = {
919 0x031c0ef5, 919 0x031c0ef5,
920/* 0x0004: rd32 */ 920/* 0x0004: rd32 */
921 0xf607a040, 921 0xf607a040,
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/nva3.fuc3 b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gt215.fuc3
index 93d76177e935..393049fc8b2d 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/nva3.fuc3
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gt215.fuc3
@@ -32,7 +32,7 @@
32 32
33#include "macros.fuc" 33#include "macros.fuc"
34 34
35.section #nva3_pmu_data 35.section #gt215_pmu_data
36#define INCLUDE_PROC 36#define INCLUDE_PROC
37#include "kernel.fuc" 37#include "kernel.fuc"
38#include "arith.fuc" 38#include "arith.fuc"
@@ -56,7 +56,7 @@
56#undef INCLUDE_DATA 56#undef INCLUDE_DATA
57.align 256 57.align 256
58 58
59.section #nva3_pmu_code 59.section #gt215_pmu_code
60#define INCLUDE_CODE 60#define INCLUDE_CODE
61#include "kernel.fuc" 61#include "kernel.fuc"
62#include "arith.fuc" 62#include "arith.fuc"
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/nva3.fuc3.h b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gt215.fuc3.h
index e8274401338c..2686f8fad0f5 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/nva3.fuc3.h
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gt215.fuc3.h
@@ -1,4 +1,4 @@
1uint32_t nva3_pmu_data[] = { 1uint32_t gt215_pmu_data[] = {
2/* 0x0000: proc_kern */ 2/* 0x0000: proc_kern */
3 0x52544e49, 3 0x52544e49,
4 0x00000000, 4 0x00000000,
@@ -916,7 +916,7 @@ uint32_t nva3_pmu_data[] = {
916 0x00000000, 916 0x00000000,
917}; 917};
918 918
919uint32_t nva3_pmu_code[] = { 919uint32_t gt215_pmu_code[] = {
920 0x039e0ef5, 920 0x039e0ef5,
921/* 0x0004: rd32 */ 921/* 0x0004: rd32 */
922 0x07a007f1, 922 0x07a007f1,
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/nvc0.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gf100.c
index a9fd1456f5b5..78a4ea0101f1 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/nvc0.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gf100.c
@@ -21,21 +21,20 @@
21 * 21 *
22 * Authors: Ben Skeggs 22 * Authors: Ben Skeggs
23 */ 23 */
24
25#include "priv.h" 24#include "priv.h"
26#include "fuc/nvc0.fuc3.h" 25#include "fuc/gf100.fuc3.h"
27 26
28struct nouveau_oclass * 27struct nvkm_oclass *
29nvc0_pmu_oclass = &(struct nvkm_pmu_impl) { 28gf100_pmu_oclass = &(struct nvkm_pmu_impl) {
30 .base.handle = NV_SUBDEV(PMU, 0xc0), 29 .base.handle = NV_SUBDEV(PMU, 0xc0),
31 .base.ofuncs = &(struct nouveau_ofuncs) { 30 .base.ofuncs = &(struct nvkm_ofuncs) {
32 .ctor = _nouveau_pmu_ctor, 31 .ctor = _nvkm_pmu_ctor,
33 .dtor = _nouveau_pmu_dtor, 32 .dtor = _nvkm_pmu_dtor,
34 .init = _nouveau_pmu_init, 33 .init = _nvkm_pmu_init,
35 .fini = _nouveau_pmu_fini, 34 .fini = _nvkm_pmu_fini,
36 }, 35 },
37 .code.data = nvc0_pmu_code, 36 .code.data = gf100_pmu_code,
38 .code.size = sizeof(nvc0_pmu_code), 37 .code.size = sizeof(gf100_pmu_code),
39 .data.data = nvc0_pmu_data, 38 .data.data = gf100_pmu_data,
40 .data.size = sizeof(nvc0_pmu_data), 39 .data.size = sizeof(gf100_pmu_data),
41}.base; 40}.base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/nvd0.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gf110.c
index a9b1d7e027a3..6b3a23839ff0 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/nvd0.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gf110.c
@@ -21,21 +21,20 @@
21 * 21 *
22 * Authors: Ben Skeggs 22 * Authors: Ben Skeggs
23 */ 23 */
24
25#include "priv.h" 24#include "priv.h"
26#include "fuc/nvd0.fuc4.h" 25#include "fuc/gf110.fuc4.h"
27 26
28struct nouveau_oclass * 27struct nvkm_oclass *
29nvd0_pmu_oclass = &(struct nvkm_pmu_impl) { 28gf110_pmu_oclass = &(struct nvkm_pmu_impl) {
30 .base.handle = NV_SUBDEV(PMU, 0xd0), 29 .base.handle = NV_SUBDEV(PMU, 0xd0),
31 .base.ofuncs = &(struct nouveau_ofuncs) { 30 .base.ofuncs = &(struct nvkm_ofuncs) {
32 .ctor = _nouveau_pmu_ctor, 31 .ctor = _nvkm_pmu_ctor,
33 .dtor = _nouveau_pmu_dtor, 32 .dtor = _nvkm_pmu_dtor,
34 .init = _nouveau_pmu_init, 33 .init = _nvkm_pmu_init,
35 .fini = _nouveau_pmu_fini, 34 .fini = _nvkm_pmu_fini,
36 }, 35 },
37 .code.data = nvd0_pmu_code, 36 .code.data = gf110_pmu_code,
38 .code.size = sizeof(nvd0_pmu_code), 37 .code.size = sizeof(gf110_pmu_code),
39 .data.data = nvd0_pmu_data, 38 .data.data = gf110_pmu_data,
40 .data.size = sizeof(nvd0_pmu_data), 39 .data.size = sizeof(gf110_pmu_data),
41}.base; 40}.base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk104.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk104.c
index 7776b4a0958e..28fdb8ea9ed8 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk104.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk104.c
@@ -21,15 +21,13 @@
21 * 21 *
22 * Authors: Ben Skeggs 22 * Authors: Ben Skeggs
23 */ 23 */
24 24#define gf110_pmu_code gk104_pmu_code
25#define gf110_pmu_data gk104_pmu_data
25#include "priv.h" 26#include "priv.h"
26 27#include "fuc/gf110.fuc4.h"
27#define nvd0_pmu_code gk104_pmu_code
28#define nvd0_pmu_data gk104_pmu_data
29#include "fuc/nvd0.fuc4.h"
30 28
31static void 29static void
32gk104_pmu_pgob(struct nouveau_pmu *pmu, bool enable) 30gk104_pmu_pgob(struct nvkm_pmu *pmu, bool enable)
33{ 31{
34 nv_mask(pmu, 0x000200, 0x00001000, 0x00000000); 32 nv_mask(pmu, 0x000200, 0x00001000, 0x00000000);
35 nv_rd32(pmu, 0x000200); 33 nv_rd32(pmu, 0x000200);
@@ -52,14 +50,14 @@ gk104_pmu_pgob(struct nouveau_pmu *pmu, bool enable)
52 nv_rd32(pmu, 0x000200); 50 nv_rd32(pmu, 0x000200);
53} 51}
54 52
55struct nouveau_oclass * 53struct nvkm_oclass *
56gk104_pmu_oclass = &(struct nvkm_pmu_impl) { 54gk104_pmu_oclass = &(struct nvkm_pmu_impl) {
57 .base.handle = NV_SUBDEV(PMU, 0xe4), 55 .base.handle = NV_SUBDEV(PMU, 0xe4),
58 .base.ofuncs = &(struct nouveau_ofuncs) { 56 .base.ofuncs = &(struct nvkm_ofuncs) {
59 .ctor = _nouveau_pmu_ctor, 57 .ctor = _nvkm_pmu_ctor,
60 .dtor = _nouveau_pmu_dtor, 58 .dtor = _nvkm_pmu_dtor,
61 .init = _nouveau_pmu_init, 59 .init = _nvkm_pmu_init,
62 .fini = _nouveau_pmu_fini, 60 .fini = _nvkm_pmu_fini,
63 }, 61 },
64 .code.data = gk104_pmu_code, 62 .code.data = gk104_pmu_code,
65 .code.size = sizeof(gk104_pmu_code), 63 .code.size = sizeof(gk104_pmu_code),
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/nv108.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk208.c
index a7db0870ed88..6f9c09af1a49 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/nv108.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk208.c
@@ -21,21 +21,20 @@
21 * 21 *
22 * Authors: Ben Skeggs 22 * Authors: Ben Skeggs
23 */ 23 */
24
25#include "priv.h" 24#include "priv.h"
26#include "fuc/nv108.fuc5.h" 25#include "fuc/gk208.fuc5.h"
27 26
28struct nouveau_oclass * 27struct nvkm_oclass *
29nv108_pmu_oclass = &(struct nvkm_pmu_impl) { 28gk208_pmu_oclass = &(struct nvkm_pmu_impl) {
30 .base.handle = NV_SUBDEV(PMU, 0x00), 29 .base.handle = NV_SUBDEV(PMU, 0x00),
31 .base.ofuncs = &(struct nouveau_ofuncs) { 30 .base.ofuncs = &(struct nvkm_ofuncs) {
32 .ctor = _nouveau_pmu_ctor, 31 .ctor = _nvkm_pmu_ctor,
33 .dtor = _nouveau_pmu_dtor, 32 .dtor = _nvkm_pmu_dtor,
34 .init = _nouveau_pmu_init, 33 .init = _nvkm_pmu_init,
35 .fini = _nouveau_pmu_fini, 34 .fini = _nvkm_pmu_fini,
36 }, 35 },
37 .code.data = nv108_pmu_code, 36 .code.data = gk208_pmu_code,
38 .code.size = sizeof(nv108_pmu_code), 37 .code.size = sizeof(gk208_pmu_code),
39 .data.data = nv108_pmu_data, 38 .data.data = gk208_pmu_data,
40 .data.size = sizeof(nv108_pmu_data), 39 .data.size = sizeof(gk208_pmu_data),
41}.base; 40}.base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk20a.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk20a.c
index 28d858a875bf..a49934bbe637 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk20a.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk20a.c
@@ -36,8 +36,8 @@ struct gk20a_pmu_dvfs_data {
36}; 36};
37 37
38struct gk20a_pmu_priv { 38struct gk20a_pmu_priv {
39 struct nouveau_pmu base; 39 struct nvkm_pmu base;
40 struct nouveau_alarm alarm; 40 struct nvkm_alarm alarm;
41 struct gk20a_pmu_dvfs_data *data; 41 struct gk20a_pmu_dvfs_data *data;
42}; 42};
43 43
@@ -50,15 +50,15 @@ struct gk20a_pmu_dvfs_dev_status {
50static int 50static int
51gk20a_pmu_dvfs_target(struct gk20a_pmu_priv *priv, int *state) 51gk20a_pmu_dvfs_target(struct gk20a_pmu_priv *priv, int *state)
52{ 52{
53 struct nouveau_clk *clk = nouveau_clk(priv); 53 struct nvkm_clk *clk = nvkm_clk(priv);
54 54
55 return nouveau_clk_astate(clk, *state, 0, false); 55 return nvkm_clk_astate(clk, *state, 0, false);
56} 56}
57 57
58static int 58static int
59gk20a_pmu_dvfs_get_cur_state(struct gk20a_pmu_priv *priv, int *state) 59gk20a_pmu_dvfs_get_cur_state(struct gk20a_pmu_priv *priv, int *state)
60{ 60{
61 struct nouveau_clk *clk = nouveau_clk(priv); 61 struct nvkm_clk *clk = nvkm_clk(priv);
62 62
63 *state = clk->pstate; 63 *state = clk->pstate;
64 return 0; 64 return 0;
@@ -66,10 +66,10 @@ gk20a_pmu_dvfs_get_cur_state(struct gk20a_pmu_priv *priv, int *state)
66 66
67static int 67static int
68gk20a_pmu_dvfs_get_target_state(struct gk20a_pmu_priv *priv, 68gk20a_pmu_dvfs_get_target_state(struct gk20a_pmu_priv *priv,
69 int *state, int load) 69 int *state, int load)
70{ 70{
71 struct gk20a_pmu_dvfs_data *data = priv->data; 71 struct gk20a_pmu_dvfs_data *data = priv->data;
72 struct nouveau_clk *clk = nouveau_clk(priv); 72 struct nvkm_clk *clk = nvkm_clk(priv);
73 int cur_level, level; 73 int cur_level, level;
74 74
75 /* For GK20A, the performance level is directly mapped to pstate */ 75 /* For GK20A, the performance level is directly mapped to pstate */
@@ -96,7 +96,7 @@ gk20a_pmu_dvfs_get_target_state(struct gk20a_pmu_priv *priv,
96 96
97static int 97static int
98gk20a_pmu_dvfs_get_dev_status(struct gk20a_pmu_priv *priv, 98gk20a_pmu_dvfs_get_dev_status(struct gk20a_pmu_priv *priv,
99 struct gk20a_pmu_dvfs_dev_status *status) 99 struct gk20a_pmu_dvfs_dev_status *status)
100{ 100{
101 status->busy = nv_rd32(priv, 0x10a508 + (BUSY_SLOT * 0x10)); 101 status->busy = nv_rd32(priv, 0x10a508 + (BUSY_SLOT * 0x10));
102 status->total= nv_rd32(priv, 0x10a508 + (CLK_SLOT * 0x10)); 102 status->total= nv_rd32(priv, 0x10a508 + (CLK_SLOT * 0x10));
@@ -111,14 +111,14 @@ gk20a_pmu_dvfs_reset_dev_status(struct gk20a_pmu_priv *priv)
111} 111}
112 112
113static void 113static void
114gk20a_pmu_dvfs_work(struct nouveau_alarm *alarm) 114gk20a_pmu_dvfs_work(struct nvkm_alarm *alarm)
115{ 115{
116 struct gk20a_pmu_priv *priv = container_of(alarm, 116 struct gk20a_pmu_priv *priv =
117 struct gk20a_pmu_priv, alarm); 117 container_of(alarm, struct gk20a_pmu_priv, alarm);
118 struct gk20a_pmu_dvfs_data *data = priv->data; 118 struct gk20a_pmu_dvfs_data *data = priv->data;
119 struct gk20a_pmu_dvfs_dev_status status; 119 struct gk20a_pmu_dvfs_dev_status status;
120 struct nouveau_clk *clk = nouveau_clk(priv); 120 struct nvkm_clk *clk = nvkm_clk(priv);
121 struct nouveau_volt *volt = nouveau_volt(priv); 121 struct nvkm_volt *volt = nvkm_volt(priv);
122 u32 utilization = 0; 122 u32 utilization = 0;
123 int state, ret; 123 int state, ret;
124 124
@@ -156,40 +156,39 @@ gk20a_pmu_dvfs_work(struct nouveau_alarm *alarm)
156 156
157resched: 157resched:
158 gk20a_pmu_dvfs_reset_dev_status(priv); 158 gk20a_pmu_dvfs_reset_dev_status(priv);
159 nouveau_timer_alarm(priv, 100000000, alarm); 159 nvkm_timer_alarm(priv, 100000000, alarm);
160} 160}
161 161
162int 162int
163gk20a_pmu_fini(struct nouveau_object *object, bool suspend) 163gk20a_pmu_fini(struct nvkm_object *object, bool suspend)
164{ 164{
165 struct nouveau_pmu *pmu = (void *)object; 165 struct nvkm_pmu *pmu = (void *)object;
166 struct gk20a_pmu_priv *priv = (void *)pmu; 166 struct gk20a_pmu_priv *priv = (void *)pmu;
167 167
168 nouveau_timer_alarm_cancel(priv, &priv->alarm); 168 nvkm_timer_alarm_cancel(priv, &priv->alarm);
169 169
170 return nouveau_subdev_fini(&pmu->base, suspend); 170 return nvkm_subdev_fini(&pmu->base, suspend);
171} 171}
172 172
173int 173int
174gk20a_pmu_init(struct nouveau_object *object) 174gk20a_pmu_init(struct nvkm_object *object)
175{ 175{
176 struct nouveau_pmu *pmu = (void *)object; 176 struct nvkm_pmu *pmu = (void *)object;
177 struct gk20a_pmu_priv *priv = (void *)pmu; 177 struct gk20a_pmu_priv *priv = (void *)pmu;
178 int ret; 178 int ret;
179 179
180 ret = nouveau_subdev_init(&pmu->base); 180 ret = nvkm_subdev_init(&pmu->base);
181 if (ret) 181 if (ret)
182 return ret; 182 return ret;
183 183
184 pmu->pgob = nouveau_pmu_pgob; 184 pmu->pgob = nvkm_pmu_pgob;
185 185
186 /* init pwr perf counter */ 186 /* init pwr perf counter */
187 nv_wr32(pmu, 0x10a504 + (BUSY_SLOT * 0x10), 0x00200001); 187 nv_wr32(pmu, 0x10a504 + (BUSY_SLOT * 0x10), 0x00200001);
188 nv_wr32(pmu, 0x10a50c + (BUSY_SLOT * 0x10), 0x00000002); 188 nv_wr32(pmu, 0x10a50c + (BUSY_SLOT * 0x10), 0x00000002);
189 nv_wr32(pmu, 0x10a50c + (CLK_SLOT * 0x10), 0x00000003); 189 nv_wr32(pmu, 0x10a50c + (CLK_SLOT * 0x10), 0x00000003);
190 190
191 nouveau_timer_alarm(pmu, 2000000000, &priv->alarm); 191 nvkm_timer_alarm(pmu, 2000000000, &priv->alarm);
192
193 return ret; 192 return ret;
194} 193}
195 194
@@ -200,32 +199,30 @@ struct gk20a_pmu_dvfs_data gk20a_dvfs_data= {
200}; 199};
201 200
202static int 201static int
203gk20a_pmu_ctor(struct nouveau_object *parent, 202gk20a_pmu_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
204 struct nouveau_object *engine, 203 struct nvkm_oclass *oclass, void *data, u32 size,
205 struct nouveau_oclass *oclass, void *data, u32 size, 204 struct nvkm_object **pobject)
206 struct nouveau_object **pobject)
207{ 205{
208 struct gk20a_pmu_priv *priv; 206 struct gk20a_pmu_priv *priv;
209 int ret; 207 int ret;
210 208
211 ret = nouveau_pmu_create(parent, engine, oclass, &priv); 209 ret = nvkm_pmu_create(parent, engine, oclass, &priv);
212 *pobject = nv_object(priv); 210 *pobject = nv_object(priv);
213 if (ret) 211 if (ret)
214 return ret; 212 return ret;
215 213
216 priv->data = &gk20a_dvfs_data; 214 priv->data = &gk20a_dvfs_data;
217 215
218 nouveau_alarm_init(&priv->alarm, gk20a_pmu_dvfs_work); 216 nvkm_alarm_init(&priv->alarm, gk20a_pmu_dvfs_work);
219
220 return 0; 217 return 0;
221} 218}
222 219
223struct nouveau_oclass * 220struct nvkm_oclass *
224gk20a_pmu_oclass = &(struct nvkm_pmu_impl) { 221gk20a_pmu_oclass = &(struct nvkm_pmu_impl) {
225 .base.handle = NV_SUBDEV(PMU, 0xea), 222 .base.handle = NV_SUBDEV(PMU, 0xea),
226 .base.ofuncs = &(struct nouveau_ofuncs) { 223 .base.ofuncs = &(struct nvkm_ofuncs) {
227 .ctor = gk20a_pmu_ctor, 224 .ctor = gk20a_pmu_ctor,
228 .dtor = _nouveau_pmu_dtor, 225 .dtor = _nvkm_pmu_dtor,
229 .init = gk20a_pmu_init, 226 .init = gk20a_pmu_init,
230 .fini = gk20a_pmu_fini, 227 .fini = gk20a_pmu_fini,
231 }, 228 },
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/nva3.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gt215.c
index 06f99283d1a9..30aaeb21de41 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/nva3.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gt215.c
@@ -21,30 +21,29 @@
21 * 21 *
22 * Authors: Ben Skeggs 22 * Authors: Ben Skeggs
23 */ 23 */
24
25#include "priv.h" 24#include "priv.h"
26#include "fuc/nva3.fuc3.h" 25#include "fuc/gt215.fuc3.h"
27 26
28static int 27static int
29nva3_pmu_init(struct nouveau_object *object) 28gt215_pmu_init(struct nvkm_object *object)
30{ 29{
31 struct nouveau_pmu *pmu = (void *)object; 30 struct nvkm_pmu *pmu = (void *)object;
32 nv_mask(pmu, 0x022210, 0x00000001, 0x00000000); 31 nv_mask(pmu, 0x022210, 0x00000001, 0x00000000);
33 nv_mask(pmu, 0x022210, 0x00000001, 0x00000001); 32 nv_mask(pmu, 0x022210, 0x00000001, 0x00000001);
34 return nouveau_pmu_init(pmu); 33 return nvkm_pmu_init(pmu);
35} 34}
36 35
37struct nouveau_oclass * 36struct nvkm_oclass *
38nva3_pmu_oclass = &(struct nvkm_pmu_impl) { 37gt215_pmu_oclass = &(struct nvkm_pmu_impl) {
39 .base.handle = NV_SUBDEV(PMU, 0xa3), 38 .base.handle = NV_SUBDEV(PMU, 0xa3),
40 .base.ofuncs = &(struct nouveau_ofuncs) { 39 .base.ofuncs = &(struct nvkm_ofuncs) {
41 .ctor = _nouveau_pmu_ctor, 40 .ctor = _nvkm_pmu_ctor,
42 .dtor = _nouveau_pmu_dtor, 41 .dtor = _nvkm_pmu_dtor,
43 .init = nva3_pmu_init, 42 .init = gt215_pmu_init,
44 .fini = _nouveau_pmu_fini, 43 .fini = _nvkm_pmu_fini,
45 }, 44 },
46 .code.data = nva3_pmu_code, 45 .code.data = gt215_pmu_code,
47 .code.size = sizeof(nva3_pmu_code), 46 .code.size = sizeof(gt215_pmu_code),
48 .data.data = nva3_pmu_data, 47 .data.data = gt215_pmu_data,
49 .data.size = sizeof(nva3_pmu_data), 48 .data.size = sizeof(gt215_pmu_data),
50}.base; 49}.base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/memx.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/memx.c
index 671c7177d3af..b75c5b885980 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/memx.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/memx.c
@@ -1,10 +1,11 @@
1#ifndef __NVKM_PMU_MEMX_H__ 1#ifndef __NVKM_PMU_MEMX_H__
2#define __NVKM_PMU_MEMX_H__ 2#define __NVKM_PMU_MEMX_H__
3
4#include "priv.h" 3#include "priv.h"
5 4
6struct nouveau_memx { 5#include <core/device.h>
7 struct nouveau_pmu *pmu; 6
7struct nvkm_memx {
8 struct nvkm_pmu *pmu;
8 u32 base; 9 u32 base;
9 u32 size; 10 u32 size;
10 struct { 11 struct {
@@ -15,9 +16,9 @@ struct nouveau_memx {
15}; 16};
16 17
17static void 18static void
18memx_out(struct nouveau_memx *memx) 19memx_out(struct nvkm_memx *memx)
19{ 20{
20 struct nouveau_pmu *pmu = memx->pmu; 21 struct nvkm_pmu *pmu = memx->pmu;
21 int i; 22 int i;
22 23
23 if (memx->c.mthd) { 24 if (memx->c.mthd) {
@@ -30,7 +31,7 @@ memx_out(struct nouveau_memx *memx)
30} 31}
31 32
32static void 33static void
33memx_cmd(struct nouveau_memx *memx, u32 mthd, u32 size, u32 data[]) 34memx_cmd(struct nvkm_memx *memx, u32 mthd, u32 size, u32 data[])
34{ 35{
35 if ((memx->c.size + size >= ARRAY_SIZE(memx->c.data)) || 36 if ((memx->c.size + size >= ARRAY_SIZE(memx->c.data)) ||
36 (memx->c.mthd && memx->c.mthd != mthd)) 37 (memx->c.mthd && memx->c.mthd != mthd))
@@ -41,14 +42,14 @@ memx_cmd(struct nouveau_memx *memx, u32 mthd, u32 size, u32 data[])
41} 42}
42 43
43int 44int
44nouveau_memx_init(struct nouveau_pmu *pmu, struct nouveau_memx **pmemx) 45nvkm_memx_init(struct nvkm_pmu *pmu, struct nvkm_memx **pmemx)
45{ 46{
46 struct nouveau_memx *memx; 47 struct nvkm_memx *memx;
47 u32 reply[2]; 48 u32 reply[2];
48 int ret; 49 int ret;
49 50
50 ret = pmu->message(pmu, reply, PROC_MEMX, MEMX_MSG_INFO, 51 ret = pmu->message(pmu, reply, PROC_MEMX, MEMX_MSG_INFO,
51 MEMX_INFO_DATA, 0); 52 MEMX_INFO_DATA, 0);
52 if (ret) 53 if (ret)
53 return ret; 54 return ret;
54 55
@@ -64,15 +65,14 @@ nouveau_memx_init(struct nouveau_pmu *pmu, struct nouveau_memx **pmemx)
64 nv_wr32(pmu, 0x10a580, 0x00000003); 65 nv_wr32(pmu, 0x10a580, 0x00000003);
65 } while (nv_rd32(pmu, 0x10a580) != 0x00000003); 66 } while (nv_rd32(pmu, 0x10a580) != 0x00000003);
66 nv_wr32(pmu, 0x10a1c0, 0x01000000 | memx->base); 67 nv_wr32(pmu, 0x10a1c0, 0x01000000 | memx->base);
67
68 return 0; 68 return 0;
69} 69}
70 70
71int 71int
72nouveau_memx_fini(struct nouveau_memx **pmemx, bool exec) 72nvkm_memx_fini(struct nvkm_memx **pmemx, bool exec)
73{ 73{
74 struct nouveau_memx *memx = *pmemx; 74 struct nvkm_memx *memx = *pmemx;
75 struct nouveau_pmu *pmu = memx->pmu; 75 struct nvkm_pmu *pmu = memx->pmu;
76 u32 finish, reply[2]; 76 u32 finish, reply[2];
77 77
78 /* flush the cache... */ 78 /* flush the cache... */
@@ -85,7 +85,7 @@ nouveau_memx_fini(struct nouveau_memx **pmemx, bool exec)
85 /* call MEMX process to execute the script, and wait for reply */ 85 /* call MEMX process to execute the script, and wait for reply */
86 if (exec) { 86 if (exec) {
87 pmu->message(pmu, reply, PROC_MEMX, MEMX_MSG_EXEC, 87 pmu->message(pmu, reply, PROC_MEMX, MEMX_MSG_EXEC,
88 memx->base, finish); 88 memx->base, finish);
89 } 89 }
90 90
91 nv_debug(memx->pmu, "Exec took %uns, PMU_IN %08x\n", 91 nv_debug(memx->pmu, "Exec took %uns, PMU_IN %08x\n",
@@ -95,14 +95,14 @@ nouveau_memx_fini(struct nouveau_memx **pmemx, bool exec)
95} 95}
96 96
97void 97void
98nouveau_memx_wr32(struct nouveau_memx *memx, u32 addr, u32 data) 98nvkm_memx_wr32(struct nvkm_memx *memx, u32 addr, u32 data)
99{ 99{
100 nv_debug(memx->pmu, "R[%06x] = 0x%08x\n", addr, data); 100 nv_debug(memx->pmu, "R[%06x] = 0x%08x\n", addr, data);
101 memx_cmd(memx, MEMX_WR32, 2, (u32[]){ addr, data }); 101 memx_cmd(memx, MEMX_WR32, 2, (u32[]){ addr, data });
102} 102}
103 103
104void 104void
105nouveau_memx_wait(struct nouveau_memx *memx, 105nvkm_memx_wait(struct nvkm_memx *memx,
106 u32 addr, u32 mask, u32 data, u32 nsec) 106 u32 addr, u32 mask, u32 data, u32 nsec)
107{ 107{
108 nv_debug(memx->pmu, "R[%06x] & 0x%08x == 0x%08x, %d us\n", 108 nv_debug(memx->pmu, "R[%06x] & 0x%08x == 0x%08x, %d us\n",
@@ -112,7 +112,7 @@ nouveau_memx_wait(struct nouveau_memx *memx,
112} 112}
113 113
114void 114void
115nouveau_memx_nsec(struct nouveau_memx *memx, u32 nsec) 115nvkm_memx_nsec(struct nvkm_memx *memx, u32 nsec)
116{ 116{
117 nv_debug(memx->pmu, " DELAY = %d ns\n", nsec); 117 nv_debug(memx->pmu, " DELAY = %d ns\n", nsec);
118 memx_cmd(memx, MEMX_DELAY, 1, (u32[]){ nsec }); 118 memx_cmd(memx, MEMX_DELAY, 1, (u32[]){ nsec });
@@ -120,9 +120,9 @@ nouveau_memx_nsec(struct nouveau_memx *memx, u32 nsec)
120} 120}
121 121
122void 122void
123nouveau_memx_wait_vblank(struct nouveau_memx *memx) 123nvkm_memx_wait_vblank(struct nvkm_memx *memx)
124{ 124{
125 struct nouveau_pmu *pmu = memx->pmu; 125 struct nvkm_pmu *pmu = memx->pmu;
126 u32 heads, x, y, px = 0; 126 u32 heads, x, y, px = 0;
127 int i, head_sync; 127 int i, head_sync;
128 128
@@ -153,20 +153,20 @@ nouveau_memx_wait_vblank(struct nouveau_memx *memx)
153} 153}
154 154
155void 155void
156nouveau_memx_train(struct nouveau_memx *memx) 156nvkm_memx_train(struct nvkm_memx *memx)
157{ 157{
158 nv_debug(memx->pmu, " MEM TRAIN\n"); 158 nv_debug(memx->pmu, " MEM TRAIN\n");
159 memx_cmd(memx, MEMX_TRAIN, 0, NULL); 159 memx_cmd(memx, MEMX_TRAIN, 0, NULL);
160} 160}
161 161
162int 162int
163nouveau_memx_train_result(struct nouveau_pmu *pmu, u32 *res, int rsize) 163nvkm_memx_train_result(struct nvkm_pmu *pmu, u32 *res, int rsize)
164{ 164{
165 u32 reply[2], base, size, i; 165 u32 reply[2], base, size, i;
166 int ret; 166 int ret;
167 167
168 ret = pmu->message(pmu, reply, PROC_MEMX, MEMX_MSG_INFO, 168 ret = pmu->message(pmu, reply, PROC_MEMX, MEMX_MSG_INFO,
169 MEMX_INFO_TRAIN, 0); 169 MEMX_INFO_TRAIN, 0);
170 if (ret) 170 if (ret)
171 return ret; 171 return ret;
172 172
@@ -185,17 +185,16 @@ nouveau_memx_train_result(struct nouveau_pmu *pmu, u32 *res, int rsize)
185} 185}
186 186
187void 187void
188nouveau_memx_block(struct nouveau_memx *memx) 188nvkm_memx_block(struct nvkm_memx *memx)
189{ 189{
190 nv_debug(memx->pmu, " HOST BLOCKED\n"); 190 nv_debug(memx->pmu, " HOST BLOCKED\n");
191 memx_cmd(memx, MEMX_ENTER, 0, NULL); 191 memx_cmd(memx, MEMX_ENTER, 0, NULL);
192} 192}
193 193
194void 194void
195nouveau_memx_unblock(struct nouveau_memx *memx) 195nvkm_memx_unblock(struct nvkm_memx *memx)
196{ 196{
197 nv_debug(memx->pmu, " HOST UNBLOCKED\n"); 197 nv_debug(memx->pmu, " HOST UNBLOCKED\n");
198 memx_cmd(memx, MEMX_LEAVE, 0, NULL); 198 memx_cmd(memx, MEMX_LEAVE, 0, NULL);
199} 199}
200
201#endif 200#endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/priv.h b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/priv.h
index eb5bd1cb3955..998410563bfd 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/priv.h
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/priv.h
@@ -1,35 +1,34 @@
1#ifndef __NVKM_PMU_PRIV_H__ 1#ifndef __NVKM_PMU_PRIV_H__
2#define __NVKM_PMU_PRIV_H__ 2#define __NVKM_PMU_PRIV_H__
3
4#include <subdev/pmu.h> 3#include <subdev/pmu.h>
5#include <subdev/pmu/fuc/os.h> 4#include <subdev/pmu/fuc/os.h>
6 5
7#define nouveau_pmu_create(p, e, o, d) \ 6#define nvkm_pmu_create(p, e, o, d) \
8 nouveau_pmu_create_((p), (e), (o), sizeof(**d), (void **)d) 7 nvkm_pmu_create_((p), (e), (o), sizeof(**d), (void **)d)
9#define nouveau_pmu_destroy(p) \ 8#define nvkm_pmu_destroy(p) \
10 nouveau_subdev_destroy(&(p)->base) 9 nvkm_subdev_destroy(&(p)->base)
11#define nouveau_pmu_init(p) ({ \ 10#define nvkm_pmu_init(p) ({ \
12 struct nouveau_pmu *_pmu = (p); \ 11 struct nvkm_pmu *_pmu = (p); \
13 _nouveau_pmu_init(nv_object(_pmu)); \ 12 _nvkm_pmu_init(nv_object(_pmu)); \
14}) 13})
15#define nouveau_pmu_fini(p,s) ({ \ 14#define nvkm_pmu_fini(p,s) ({ \
16 struct nouveau_pmu *_pmu = (p); \ 15 struct nvkm_pmu *_pmu = (p); \
17 _nouveau_pmu_fini(nv_object(_pmu), (s)); \ 16 _nvkm_pmu_fini(nv_object(_pmu), (s)); \
18}) 17})
19 18
20int nouveau_pmu_create_(struct nouveau_object *, struct nouveau_object *, 19int nvkm_pmu_create_(struct nvkm_object *, struct nvkm_object *,
21 struct nouveau_oclass *, int, void **); 20 struct nvkm_oclass *, int, void **);
22 21
23int _nouveau_pmu_ctor(struct nouveau_object *, struct nouveau_object *, 22int _nvkm_pmu_ctor(struct nvkm_object *, struct nvkm_object *,
24 struct nouveau_oclass *, void *, u32, 23 struct nvkm_oclass *, void *, u32,
25 struct nouveau_object **); 24 struct nvkm_object **);
26#define _nouveau_pmu_dtor _nouveau_subdev_dtor 25#define _nvkm_pmu_dtor _nvkm_subdev_dtor
27int _nouveau_pmu_init(struct nouveau_object *); 26int _nvkm_pmu_init(struct nvkm_object *);
28int _nouveau_pmu_fini(struct nouveau_object *, bool); 27int _nvkm_pmu_fini(struct nvkm_object *, bool);
29void nouveau_pmu_pgob(struct nouveau_pmu *pmu, bool enable); 28void nvkm_pmu_pgob(struct nvkm_pmu *pmu, bool enable);
30 29
31struct nvkm_pmu_impl { 30struct nvkm_pmu_impl {
32 struct nouveau_oclass base; 31 struct nvkm_oclass base;
33 struct { 32 struct {
34 u32 *data; 33 u32 *data;
35 u32 size; 34 u32 size;
@@ -39,7 +38,6 @@ struct nvkm_pmu_impl {
39 u32 size; 38 u32 size;
40 } data; 39 } data;
41 40
42 void (*pgob)(struct nouveau_pmu *, bool); 41 void (*pgob)(struct nvkm_pmu *, bool);
43}; 42};
44
45#endif 43#endif