diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2015-08-20 06:54:21 +0200 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2015-08-28 04:40:45 +0200 |
commit | 53e60da43aee440d3f75000cdd269bd1324a8ad4 (patch) | |
tree | debcc53c945ff6ffa4ca3f886a86387e7bfeec0c /drivers/gpu/drm/nouveau/nvkm/engine/ce | |
parent | drm/nouveau/volt: convert to new-style nvkm_subdev (diff) | |
download | linux-53e60da43aee440d3f75000cdd269bd1324a8ad4.tar.xz linux-53e60da43aee440d3f75000cdd269bd1324a8ad4.zip |
drm/nouveau/falcon: convert to new-style nvkm_engine
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvkm/engine/ce')
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/engine/ce/gf100.c | 109 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/engine/ce/gt215.c | 43 |
2 files changed, 41 insertions, 111 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/ce/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gf100.c index 3abab3992e7c..e45c6d703c00 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/ce/gf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gf100.c @@ -22,30 +22,26 @@ * Authors: Ben Skeggs */ #include <engine/ce.h> -#include <engine/falcon.h> #include "fuc/gf100.fuc3.h" #include <nvif/class.h> -static int -gf100_ce_init(struct nvkm_object *object) +static void +gf100_ce_init(struct nvkm_falcon *ce) { - struct nvkm_falcon *ce = (void *)object; struct nvkm_device *device = ce->engine.subdev.device; - const int idx = nv_engidx(&ce->engine) - NVDEV_ENGINE_CE0; - u32 base = idx * 0x1000; - int ret; - - ret = nvkm_falcon_init(ce); - if (ret) - return ret; - - nvkm_wr32(device, 0x104084 + base, idx); - return 0; + const int index = ce->engine.subdev.index - NVDEV_ENGINE_CE0; + nvkm_wr32(device, ce->addr + 0x084, index); } static const struct nvkm_falcon_func -gf100_ce0_func = { +gf100_ce0 = { + .code.data = gf100_ce_code, + .code.size = sizeof(gf100_ce_code), + .data.data = gf100_ce_data, + .data.size = sizeof(gf100_ce_data), + .pmc_enable = 0x00000040, + .init = gf100_ce_init, .intr = gt215_ce_intr, .sclass = { { -1, -1, FERMI_DMA }, @@ -53,30 +49,14 @@ gf100_ce0_func = { } }; -static int -gf100_ce0_ctor(struct nvkm_object *parent, struct nvkm_object *engine, - struct nvkm_oclass *oclass, void *data, u32 size, - struct nvkm_object **pobject) -{ - struct nvkm_falcon *ce; - int ret; - - ret = nvkm_falcon_create(&gf100_ce0_func, parent, engine, oclass, - 0x104000, true, "PCE0", "ce0", &ce); - *pobject = nv_object(ce); - if (ret) - return ret; - - nv_subdev(ce)->unit = 0x00000040; - nv_falcon(ce)->code.data = gf100_ce_code; - nv_falcon(ce)->code.size = sizeof(gf100_ce_code); - nv_falcon(ce)->data.data = gf100_ce_data; - nv_falcon(ce)->data.size = sizeof(gf100_ce_data); - return 0; -} - static const struct nvkm_falcon_func -gf100_ce1_func = { +gf100_ce1 = { + .code.data = gf100_ce_code, + .code.size = sizeof(gf100_ce_code), + .data.data = gf100_ce_data, + .data.size = sizeof(gf100_ce_data), + .pmc_enable = 0x00000080, + .init = gf100_ce_init, .intr = gt215_ce_intr, .sclass = { { -1, -1, FERMI_DECOMPRESS }, @@ -84,46 +64,17 @@ gf100_ce1_func = { } }; -static int -gf100_ce1_ctor(struct nvkm_object *parent, struct nvkm_object *engine, - struct nvkm_oclass *oclass, void *data, u32 size, - struct nvkm_object **pobject) +int +gf100_ce_new(struct nvkm_device *device, int index, + struct nvkm_engine **pengine) { - struct nvkm_falcon *ce; - int ret; - - ret = nvkm_falcon_create(&gf100_ce1_func, parent, engine, oclass, - 0x105000, true, "PCE1", "ce1", &ce); - *pobject = nv_object(ce); - if (ret) - return ret; - - nv_subdev(ce)->unit = 0x00000080; - nv_falcon(ce)->code.data = gf100_ce_code; - nv_falcon(ce)->code.size = sizeof(gf100_ce_code); - nv_falcon(ce)->data.data = gf100_ce_data; - nv_falcon(ce)->data.size = sizeof(gf100_ce_data); - return 0; + if (index == NVDEV_ENGINE_CE0) { + return nvkm_falcon_new_(&gf100_ce0, device, index, true, + 0x104000, pengine); + } else + if (index == NVDEV_ENGINE_CE1) { + return nvkm_falcon_new_(&gf100_ce1, device, index, true, + 0x105000, pengine); + } + return -ENODEV; } - -struct nvkm_oclass -gf100_ce0_oclass = { - .handle = NV_ENGINE(CE0, 0xc0), - .ofuncs = &(struct nvkm_ofuncs) { - .ctor = gf100_ce0_ctor, - .dtor = _nvkm_falcon_dtor, - .init = gf100_ce_init, - .fini = _nvkm_falcon_fini, - }, -}; - -struct nvkm_oclass -gf100_ce1_oclass = { - .handle = NV_ENGINE(CE1, 0xc0), - .ofuncs = &(struct nvkm_ofuncs) { - .ctor = gf100_ce1_ctor, - .dtor = _nvkm_falcon_dtor, - .init = gf100_ce_init, - .fini = _nvkm_falcon_fini, - }, -}; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/ce/gt215.c b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gt215.c index 35e4d578b153..f8223d696598 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/ce/gt215.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gt215.c @@ -61,7 +61,12 @@ gt215_ce_intr(struct nvkm_falcon *ce, struct nvkm_fifo_chan *chan) } static const struct nvkm_falcon_func -gt215_ce_func = { +gt215_ce = { + .code.data = gt215_ce_code, + .code.size = sizeof(gt215_ce_code), + .data.data = gt215_ce_data, + .data.size = sizeof(gt215_ce_data), + .pmc_enable = 0x00802000, .intr = gt215_ce_intr, .sclass = { { -1, -1, GT212_DMA }, @@ -69,36 +74,10 @@ gt215_ce_func = { } }; -static int -gt215_ce_ctor(struct nvkm_object *parent, struct nvkm_object *engine, - struct nvkm_oclass *oclass, void *data, u32 size, - struct nvkm_object **pobject) +int +gt215_ce_new(struct nvkm_device *device, int index, + struct nvkm_engine **pengine) { - bool enable = (nv_device(parent)->chipset != 0xaf); - struct nvkm_falcon *ce; - int ret; - - ret = nvkm_falcon_create(>215_ce_func, parent, engine, oclass, - 0x104000, enable, "PCE0", "ce0", &ce); - *pobject = nv_object(ce); - if (ret) - return ret; - - nv_subdev(ce)->unit = 0x00802000; - nv_falcon(ce)->code.data = gt215_ce_code; - nv_falcon(ce)->code.size = sizeof(gt215_ce_code); - nv_falcon(ce)->data.data = gt215_ce_data; - nv_falcon(ce)->data.size = sizeof(gt215_ce_data); - return 0; + return nvkm_falcon_new_(>215_ce, device, index, + (device->chipset != 0xaf), 0x104000, pengine); } - -struct nvkm_oclass -gt215_ce_oclass = { - .handle = NV_ENGINE(CE0, 0xa3), - .ofuncs = &(struct nvkm_ofuncs) { - .ctor = gt215_ce_ctor, - .dtor = _nvkm_falcon_dtor, - .init = _nvkm_falcon_init, - .fini = _nvkm_falcon_fini, - }, -}; |