diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2015-08-20 00:54:21 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2015-08-27 22:40:46 -0400 |
commit | 14d74acafb15fd3fac16eef89de7643cddd01775 (patch) | |
tree | 4e2042ae77f1db69d836af63bcb44786d76da1eb | |
parent | e5b31ca63249f03e56529dcd4260b23196ce2c28 (diff) |
drm/nouveau/cipher: convert to new-style nvkm_engine
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 files changed, 27 insertions, 61 deletions
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/engine/cipher.h b/drivers/gpu/drm/nouveau/include/nvkm/engine/cipher.h index 57c29e91bad5..03fa57a7c30a 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/engine/cipher.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/engine/cipher.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef __NVKM_CIPHER_H__ | 1 | #ifndef __NVKM_CIPHER_H__ |
2 | #define __NVKM_CIPHER_H__ | 2 | #define __NVKM_CIPHER_H__ |
3 | #include <core/engine.h> | 3 | #include <core/engine.h> |
4 | extern struct nvkm_oclass g84_cipher_oclass; | 4 | int g84_cipher_new(struct nvkm_device *, int, struct nvkm_engine **); |
5 | #endif | 5 | #endif |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/cipher/g84.c b/drivers/gpu/drm/nouveau/nvkm/engine/cipher/g84.c index ae371ca64146..d3a35db85fba 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/cipher/g84.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/cipher/g84.c | |||
@@ -77,10 +77,10 @@ g84_cipher_intr_mask[] = { | |||
77 | }; | 77 | }; |
78 | 78 | ||
79 | static void | 79 | static void |
80 | g84_cipher_intr(struct nvkm_subdev *subdev) | 80 | g84_cipher_intr(struct nvkm_engine *cipher) |
81 | { | 81 | { |
82 | struct nvkm_engine *cipher = (void *)subdev; | 82 | struct nvkm_subdev *subdev = &cipher->subdev; |
83 | struct nvkm_device *device = cipher->subdev.device; | 83 | struct nvkm_device *device = subdev->device; |
84 | struct nvkm_fifo *fifo = device->fifo; | 84 | struct nvkm_fifo *fifo = device->fifo; |
85 | struct nvkm_fifo_chan *chan; | 85 | struct nvkm_fifo_chan *chan; |
86 | u32 stat = nvkm_rd32(device, 0x102130); | 86 | u32 stat = nvkm_rd32(device, 0x102130); |
@@ -105,8 +105,20 @@ g84_cipher_intr(struct nvkm_subdev *subdev) | |||
105 | nvkm_wr32(device, 0x10200c, 0x10); | 105 | nvkm_wr32(device, 0x10200c, 0x10); |
106 | } | 106 | } |
107 | 107 | ||
108 | static int | ||
109 | g84_cipher_init(struct nvkm_engine *cipher) | ||
110 | { | ||
111 | struct nvkm_device *device = cipher->subdev.device; | ||
112 | nvkm_wr32(device, 0x102130, 0xffffffff); | ||
113 | nvkm_wr32(device, 0x102140, 0xffffffbf); | ||
114 | nvkm_wr32(device, 0x10200c, 0x00000010); | ||
115 | return 0; | ||
116 | } | ||
117 | |||
108 | static const struct nvkm_engine_func | 118 | static const struct nvkm_engine_func |
109 | g84_cipher = { | 119 | g84_cipher = { |
120 | .init = g84_cipher_init, | ||
121 | .intr = g84_cipher_intr, | ||
110 | .cclass = &g84_cipher_cclass, | 122 | .cclass = &g84_cipher_cclass, |
111 | .sclass = { | 123 | .sclass = { |
112 | { -1, -1, NV74_CIPHER, &g84_cipher_oclass_func }, | 124 | { -1, -1, NV74_CIPHER, &g84_cipher_oclass_func }, |
@@ -114,50 +126,10 @@ g84_cipher = { | |||
114 | } | 126 | } |
115 | }; | 127 | }; |
116 | 128 | ||
117 | static int | 129 | int |
118 | g84_cipher_ctor(struct nvkm_object *parent, struct nvkm_object *engine, | 130 | g84_cipher_new(struct nvkm_device *device, int index, |
119 | struct nvkm_oclass *oclass, void *data, u32 size, | 131 | struct nvkm_engine **pengine) |
120 | struct nvkm_object **pobject) | ||
121 | { | 132 | { |
122 | struct nvkm_engine *cipher; | 133 | return nvkm_engine_new_(&g84_cipher, device, index, |
123 | int ret; | 134 | 0x00004000, true, pengine); |
124 | |||
125 | ret = nvkm_engine_create(parent, engine, oclass, true, | ||
126 | "PCIPHER", "cipher", &cipher); | ||
127 | *pobject = nv_object(cipher); | ||
128 | if (ret) | ||
129 | return ret; | ||
130 | |||
131 | cipher->func = &g84_cipher, | ||
132 | nv_subdev(cipher)->unit = 0x00004000; | ||
133 | nv_subdev(cipher)->intr = g84_cipher_intr; | ||
134 | return 0; | ||
135 | } | 135 | } |
136 | |||
137 | static int | ||
138 | g84_cipher_init(struct nvkm_object *object) | ||
139 | { | ||
140 | struct nvkm_engine *cipher = (void *)object; | ||
141 | struct nvkm_device *device = cipher->subdev.device; | ||
142 | int ret; | ||
143 | |||
144 | ret = nvkm_engine_init_old(cipher); | ||
145 | if (ret) | ||
146 | return ret; | ||
147 | |||
148 | nvkm_wr32(device, 0x102130, 0xffffffff); | ||
149 | nvkm_wr32(device, 0x102140, 0xffffffbf); | ||
150 | nvkm_wr32(device, 0x10200c, 0x00000010); | ||
151 | return 0; | ||
152 | } | ||
153 | |||
154 | struct nvkm_oclass | ||
155 | g84_cipher_oclass = { | ||
156 | .handle = NV_ENGINE(CIPHER, 0x84), | ||
157 | .ofuncs = &(struct nvkm_ofuncs) { | ||
158 | .ctor = g84_cipher_ctor, | ||
159 | .dtor = _nvkm_engine_dtor, | ||
160 | .init = g84_cipher_init, | ||
161 | .fini = _nvkm_engine_fini, | ||
162 | }, | ||
163 | }; | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c index 926e07fe0912..e9ed83563028 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c | |||
@@ -898,7 +898,7 @@ nv84_chipset = { | |||
898 | .timer = nv41_timer_new, | 898 | .timer = nv41_timer_new, |
899 | .volt = nv40_volt_new, | 899 | .volt = nv40_volt_new, |
900 | .bsp = g84_bsp_new, | 900 | .bsp = g84_bsp_new, |
901 | // .cipher = g84_cipher_new, | 901 | .cipher = g84_cipher_new, |
902 | // .disp = g84_disp_new, | 902 | // .disp = g84_disp_new, |
903 | // .dma = nv50_dma_new, | 903 | // .dma = nv50_dma_new, |
904 | // .fifo = g84_fifo_new, | 904 | // .fifo = g84_fifo_new, |
@@ -929,7 +929,7 @@ nv86_chipset = { | |||
929 | .timer = nv41_timer_new, | 929 | .timer = nv41_timer_new, |
930 | .volt = nv40_volt_new, | 930 | .volt = nv40_volt_new, |
931 | .bsp = g84_bsp_new, | 931 | .bsp = g84_bsp_new, |
932 | // .cipher = g84_cipher_new, | 932 | .cipher = g84_cipher_new, |
933 | // .disp = g84_disp_new, | 933 | // .disp = g84_disp_new, |
934 | // .dma = nv50_dma_new, | 934 | // .dma = nv50_dma_new, |
935 | // .fifo = g84_fifo_new, | 935 | // .fifo = g84_fifo_new, |
@@ -960,7 +960,7 @@ nv92_chipset = { | |||
960 | .timer = nv41_timer_new, | 960 | .timer = nv41_timer_new, |
961 | .volt = nv40_volt_new, | 961 | .volt = nv40_volt_new, |
962 | .bsp = g84_bsp_new, | 962 | .bsp = g84_bsp_new, |
963 | // .cipher = g84_cipher_new, | 963 | .cipher = g84_cipher_new, |
964 | // .disp = g84_disp_new, | 964 | // .disp = g84_disp_new, |
965 | // .dma = nv50_dma_new, | 965 | // .dma = nv50_dma_new, |
966 | // .fifo = g84_fifo_new, | 966 | // .fifo = g84_fifo_new, |
@@ -991,7 +991,7 @@ nv94_chipset = { | |||
991 | .timer = nv41_timer_new, | 991 | .timer = nv41_timer_new, |
992 | .volt = nv40_volt_new, | 992 | .volt = nv40_volt_new, |
993 | .bsp = g84_bsp_new, | 993 | .bsp = g84_bsp_new, |
994 | // .cipher = g84_cipher_new, | 994 | .cipher = g84_cipher_new, |
995 | // .disp = g94_disp_new, | 995 | // .disp = g94_disp_new, |
996 | // .dma = nv50_dma_new, | 996 | // .dma = nv50_dma_new, |
997 | // .fifo = g84_fifo_new, | 997 | // .fifo = g84_fifo_new, |
@@ -1027,7 +1027,7 @@ nv96_chipset = { | |||
1027 | // .gr = nv50_gr_new, | 1027 | // .gr = nv50_gr_new, |
1028 | // .mpeg = g84_mpeg_new, | 1028 | // .mpeg = g84_mpeg_new, |
1029 | .vp = g84_vp_new, | 1029 | .vp = g84_vp_new, |
1030 | // .cipher = g84_cipher_new, | 1030 | .cipher = g84_cipher_new, |
1031 | .bsp = g84_bsp_new, | 1031 | .bsp = g84_bsp_new, |
1032 | // .disp = g94_disp_new, | 1032 | // .disp = g94_disp_new, |
1033 | // .pm = g84_pm_new, | 1033 | // .pm = g84_pm_new, |
@@ -1084,7 +1084,7 @@ nva0_chipset = { | |||
1084 | .timer = nv41_timer_new, | 1084 | .timer = nv41_timer_new, |
1085 | .volt = nv40_volt_new, | 1085 | .volt = nv40_volt_new, |
1086 | .bsp = g84_bsp_new, | 1086 | .bsp = g84_bsp_new, |
1087 | // .cipher = g84_cipher_new, | 1087 | .cipher = g84_cipher_new, |
1088 | // .disp = gt200_disp_new, | 1088 | // .disp = gt200_disp_new, |
1089 | // .dma = nv50_dma_new, | 1089 | // .dma = nv50_dma_new, |
1090 | // .fifo = g84_fifo_new, | 1090 | // .fifo = g84_fifo_new, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/nv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/nv50.c index 35cc167e7b06..087edc8d412c 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/nv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/nv50.c | |||
@@ -42,7 +42,6 @@ nv50_identify(struct nvkm_device *device) | |||
42 | device->oclass[NVDEV_ENGINE_SW ] = nv50_sw_oclass; | 42 | device->oclass[NVDEV_ENGINE_SW ] = nv50_sw_oclass; |
43 | device->oclass[NVDEV_ENGINE_GR ] = &nv50_gr_oclass; | 43 | device->oclass[NVDEV_ENGINE_GR ] = &nv50_gr_oclass; |
44 | device->oclass[NVDEV_ENGINE_MPEG ] = &g84_mpeg_oclass; | 44 | device->oclass[NVDEV_ENGINE_MPEG ] = &g84_mpeg_oclass; |
45 | device->oclass[NVDEV_ENGINE_CIPHER ] = &g84_cipher_oclass; | ||
46 | device->oclass[NVDEV_ENGINE_DISP ] = g84_disp_oclass; | 45 | device->oclass[NVDEV_ENGINE_DISP ] = g84_disp_oclass; |
47 | device->oclass[NVDEV_ENGINE_PM ] = g84_pm_oclass; | 46 | device->oclass[NVDEV_ENGINE_PM ] = g84_pm_oclass; |
48 | break; | 47 | break; |
@@ -52,7 +51,6 @@ nv50_identify(struct nvkm_device *device) | |||
52 | device->oclass[NVDEV_ENGINE_SW ] = nv50_sw_oclass; | 51 | device->oclass[NVDEV_ENGINE_SW ] = nv50_sw_oclass; |
53 | device->oclass[NVDEV_ENGINE_GR ] = &nv50_gr_oclass; | 52 | device->oclass[NVDEV_ENGINE_GR ] = &nv50_gr_oclass; |
54 | device->oclass[NVDEV_ENGINE_MPEG ] = &g84_mpeg_oclass; | 53 | device->oclass[NVDEV_ENGINE_MPEG ] = &g84_mpeg_oclass; |
55 | device->oclass[NVDEV_ENGINE_CIPHER ] = &g84_cipher_oclass; | ||
56 | device->oclass[NVDEV_ENGINE_DISP ] = g84_disp_oclass; | 54 | device->oclass[NVDEV_ENGINE_DISP ] = g84_disp_oclass; |
57 | device->oclass[NVDEV_ENGINE_PM ] = g84_pm_oclass; | 55 | device->oclass[NVDEV_ENGINE_PM ] = g84_pm_oclass; |
58 | break; | 56 | break; |
@@ -62,7 +60,6 @@ nv50_identify(struct nvkm_device *device) | |||
62 | device->oclass[NVDEV_ENGINE_SW ] = nv50_sw_oclass; | 60 | device->oclass[NVDEV_ENGINE_SW ] = nv50_sw_oclass; |
63 | device->oclass[NVDEV_ENGINE_GR ] = &nv50_gr_oclass; | 61 | device->oclass[NVDEV_ENGINE_GR ] = &nv50_gr_oclass; |
64 | device->oclass[NVDEV_ENGINE_MPEG ] = &g84_mpeg_oclass; | 62 | device->oclass[NVDEV_ENGINE_MPEG ] = &g84_mpeg_oclass; |
65 | device->oclass[NVDEV_ENGINE_CIPHER ] = &g84_cipher_oclass; | ||
66 | device->oclass[NVDEV_ENGINE_DISP ] = g84_disp_oclass; | 63 | device->oclass[NVDEV_ENGINE_DISP ] = g84_disp_oclass; |
67 | device->oclass[NVDEV_ENGINE_PM ] = g84_pm_oclass; | 64 | device->oclass[NVDEV_ENGINE_PM ] = g84_pm_oclass; |
68 | break; | 65 | break; |
@@ -72,7 +69,6 @@ nv50_identify(struct nvkm_device *device) | |||
72 | device->oclass[NVDEV_ENGINE_SW ] = nv50_sw_oclass; | 69 | device->oclass[NVDEV_ENGINE_SW ] = nv50_sw_oclass; |
73 | device->oclass[NVDEV_ENGINE_GR ] = &nv50_gr_oclass; | 70 | device->oclass[NVDEV_ENGINE_GR ] = &nv50_gr_oclass; |
74 | device->oclass[NVDEV_ENGINE_MPEG ] = &g84_mpeg_oclass; | 71 | device->oclass[NVDEV_ENGINE_MPEG ] = &g84_mpeg_oclass; |
75 | device->oclass[NVDEV_ENGINE_CIPHER ] = &g84_cipher_oclass; | ||
76 | device->oclass[NVDEV_ENGINE_DISP ] = g94_disp_oclass; | 72 | device->oclass[NVDEV_ENGINE_DISP ] = g94_disp_oclass; |
77 | device->oclass[NVDEV_ENGINE_PM ] = g84_pm_oclass; | 73 | device->oclass[NVDEV_ENGINE_PM ] = g84_pm_oclass; |
78 | break; | 74 | break; |
@@ -82,7 +78,6 @@ nv50_identify(struct nvkm_device *device) | |||
82 | device->oclass[NVDEV_ENGINE_SW ] = nv50_sw_oclass; | 78 | device->oclass[NVDEV_ENGINE_SW ] = nv50_sw_oclass; |
83 | device->oclass[NVDEV_ENGINE_GR ] = &nv50_gr_oclass; | 79 | device->oclass[NVDEV_ENGINE_GR ] = &nv50_gr_oclass; |
84 | device->oclass[NVDEV_ENGINE_MPEG ] = &g84_mpeg_oclass; | 80 | device->oclass[NVDEV_ENGINE_MPEG ] = &g84_mpeg_oclass; |
85 | device->oclass[NVDEV_ENGINE_CIPHER ] = &g84_cipher_oclass; | ||
86 | device->oclass[NVDEV_ENGINE_DISP ] = g94_disp_oclass; | 81 | device->oclass[NVDEV_ENGINE_DISP ] = g94_disp_oclass; |
87 | device->oclass[NVDEV_ENGINE_PM ] = g84_pm_oclass; | 82 | device->oclass[NVDEV_ENGINE_PM ] = g84_pm_oclass; |
88 | break; | 83 | break; |
@@ -100,7 +95,6 @@ nv50_identify(struct nvkm_device *device) | |||
100 | device->oclass[NVDEV_ENGINE_SW ] = nv50_sw_oclass; | 95 | device->oclass[NVDEV_ENGINE_SW ] = nv50_sw_oclass; |
101 | device->oclass[NVDEV_ENGINE_GR ] = &nv50_gr_oclass; | 96 | device->oclass[NVDEV_ENGINE_GR ] = &nv50_gr_oclass; |
102 | device->oclass[NVDEV_ENGINE_MPEG ] = &g84_mpeg_oclass; | 97 | device->oclass[NVDEV_ENGINE_MPEG ] = &g84_mpeg_oclass; |
103 | device->oclass[NVDEV_ENGINE_CIPHER ] = &g84_cipher_oclass; | ||
104 | device->oclass[NVDEV_ENGINE_DISP ] = gt200_disp_oclass; | 98 | device->oclass[NVDEV_ENGINE_DISP ] = gt200_disp_oclass; |
105 | device->oclass[NVDEV_ENGINE_PM ] = gt200_pm_oclass; | 99 | device->oclass[NVDEV_ENGINE_PM ] = gt200_pm_oclass; |
106 | break; | 100 | break; |