aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nvkm/core/subdev.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2020-12-06 12:14:13 +1000
committerBen Skeggs <bskeggs@redhat.com>2021-02-11 11:49:48 +1000
commitf483253f3486f2e7c669e841aceb2ac95cbb9318 (patch)
tree244da877e5afd4e9c5e6aea63e436655085311d8 /drivers/gpu/drm/nouveau/nvkm/core/subdev.c
parentdrm/nouveau/device: pass instance id when looking up a subdev/engine (diff)
downloadlinux-dev-f483253f3486f2e7c669e841aceb2ac95cbb9318.tar.xz
linux-dev-f483253f3486f2e7c669e841aceb2ac95cbb9318.zip
drm/nouveau/nvkm: add macros for subdev layout
Rather than having to add new engines / engine instances to multiple places, define everything in include/nvkm/core/layout.h and use macros to generate the required plumbing. Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Reviewed-by: Lyude Paul <lyude@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvkm/core/subdev.c')
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/core/subdev.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/core/subdev.c b/drivers/gpu/drm/nouveau/nvkm/core/subdev.c
index 12a13d634a70..acfa3ba5880d 100644
--- a/drivers/gpu/drm/nouveau/nvkm/core/subdev.c
+++ b/drivers/gpu/drm/nouveau/nvkm/core/subdev.c
@@ -28,6 +28,11 @@
const char *
nvkm_subdev_type[NVKM_SUBDEV_NR] = {
+#define NVKM_LAYOUT_ONCE(type,data,ptr,...) [type] = #ptr,
+#define NVKM_LAYOUT_INST(A...) NVKM_LAYOUT_ONCE(A)
+#include <core/layout.h>
+#undef NVKM_LAYOUT_ONCE
+#undef NVKM_LAYOUT_INST
[NVKM_SUBDEV_ACR ] = "acr",
[NVKM_SUBDEV_BAR ] = "bar",
[NVKM_SUBDEV_VBIOS ] = "bios",
@@ -208,6 +213,19 @@ nvkm_subdev_del(struct nvkm_subdev **psubdev)
}
void
+nvkm_subdev_disable(struct nvkm_device *device, enum nvkm_subdev_type type, int inst)
+{
+ struct nvkm_subdev *subdev;
+ list_for_each_entry(subdev, &device->subdev, head) {
+ if (subdev->type == type && subdev->inst == inst) {
+ *subdev->pself = NULL;
+ nvkm_subdev_del(&subdev);
+ break;
+ }
+ }
+}
+
+void
nvkm_subdev_ctor_(const struct nvkm_subdev_func *func, bool old,
struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_subdev *subdev)