diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2015-08-20 14:54:21 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2015-08-28 12:40:46 +1000 |
commit | 14d74acafb15fd3fac16eef89de7643cddd01775 (patch) | |
tree | 4e2042ae77f1db69d836af63bcb44786d76da1eb /drivers/gpu/drm/nouveau/nvkm/engine/cipher/g84.c | |
parent | e5b31ca63249f03e56529dcd4260b23196ce2c28 (diff) | |
download | linux-14d74acafb15fd3fac16eef89de7643cddd01775.tar.bz2 |
drm/nouveau/cipher: convert to new-style nvkm_engine
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvkm/engine/cipher/g84.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/engine/cipher/g84.c | 68 |
1 files changed, 20 insertions, 48 deletions
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[] = { }; static void -g84_cipher_intr(struct nvkm_subdev *subdev) +g84_cipher_intr(struct nvkm_engine *cipher) { - struct nvkm_engine *cipher = (void *)subdev; - struct nvkm_device *device = cipher->subdev.device; + struct nvkm_subdev *subdev = &cipher->subdev; + struct nvkm_device *device = subdev->device; struct nvkm_fifo *fifo = device->fifo; struct nvkm_fifo_chan *chan; u32 stat = nvkm_rd32(device, 0x102130); @@ -105,8 +105,20 @@ g84_cipher_intr(struct nvkm_subdev *subdev) nvkm_wr32(device, 0x10200c, 0x10); } +static int +g84_cipher_init(struct nvkm_engine *cipher) +{ + struct nvkm_device *device = cipher->subdev.device; + nvkm_wr32(device, 0x102130, 0xffffffff); + nvkm_wr32(device, 0x102140, 0xffffffbf); + nvkm_wr32(device, 0x10200c, 0x00000010); + return 0; +} + static const struct nvkm_engine_func g84_cipher = { + .init = g84_cipher_init, + .intr = g84_cipher_intr, .cclass = &g84_cipher_cclass, .sclass = { { -1, -1, NV74_CIPHER, &g84_cipher_oclass_func }, @@ -114,50 +126,10 @@ g84_cipher = { } }; -static int -g84_cipher_ctor(struct nvkm_object *parent, struct nvkm_object *engine, - struct nvkm_oclass *oclass, void *data, u32 size, - struct nvkm_object **pobject) +int +g84_cipher_new(struct nvkm_device *device, int index, + struct nvkm_engine **pengine) { - struct nvkm_engine *cipher; - int ret; - - ret = nvkm_engine_create(parent, engine, oclass, true, - "PCIPHER", "cipher", &cipher); - *pobject = nv_object(cipher); - if (ret) - return ret; - - cipher->func = &g84_cipher, - nv_subdev(cipher)->unit = 0x00004000; - nv_subdev(cipher)->intr = g84_cipher_intr; - return 0; + return nvkm_engine_new_(&g84_cipher, device, index, + 0x00004000, true, pengine); } - -static int -g84_cipher_init(struct nvkm_object *object) -{ - struct nvkm_engine *cipher = (void *)object; - struct nvkm_device *device = cipher->subdev.device; - int ret; - - ret = nvkm_engine_init_old(cipher); - if (ret) - return ret; - - nvkm_wr32(device, 0x102130, 0xffffffff); - nvkm_wr32(device, 0x102140, 0xffffffbf); - nvkm_wr32(device, 0x10200c, 0x00000010); - return 0; -} - -struct nvkm_oclass -g84_cipher_oclass = { - .handle = NV_ENGINE(CIPHER, 0x84), - .ofuncs = &(struct nvkm_ofuncs) { - .ctor = g84_cipher_ctor, - .dtor = _nvkm_engine_dtor, - .init = g84_cipher_init, - .fini = _nvkm_engine_fini, - }, -}; |