drm/nouveau/pmu: instanciate the falcon in PMU device
authorAlexandre Courbot <acourbot@nvidia.com>
Tue, 13 Dec 2016 08:11:20 +0000 (17:11 +0900)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 17 Feb 2017 05:14:30 +0000 (15:14 +1000)
Have an instance of nvkm_falcon in the PMU structure, ready to be used
by other subdevs (i.e. secboot).

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/include/nvkm/subdev/pmu.h
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c

index f37538eb1fe5126c56fad52a72aead5509a38b5b..6514d46bf924bb034ed151f57bb3fa5a90f4a84e 100644 (file)
@@ -1,10 +1,12 @@
 #ifndef __NVKM_PMU_H__
 #define __NVKM_PMU_H__
 #include <core/subdev.h>
+#include <engine/falcon.h>
 
 struct nvkm_pmu {
        const struct nvkm_pmu_func *func;
        struct nvkm_subdev subdev;
+       struct nvkm_falcon *falcon;
 
        struct {
                u32 base;
index b7edde42789c7d994503d8ad84460edd035c50f2..a73f690eb4b576d88302d6c096de05870677dc22 100644 (file)
@@ -116,6 +116,8 @@ nvkm_pmu_init(struct nvkm_subdev *subdev)
 static void *
 nvkm_pmu_dtor(struct nvkm_subdev *subdev)
 {
+       struct nvkm_pmu *pmu = nvkm_pmu(subdev);
+       nvkm_falcon_del(&pmu->falcon);
        return nvkm_pmu(subdev);
 }
 
@@ -136,7 +138,7 @@ nvkm_pmu_ctor(const struct nvkm_pmu_func *func, struct nvkm_device *device,
        pmu->func = func;
        INIT_WORK(&pmu->recv.work, nvkm_pmu_recv);
        init_waitqueue_head(&pmu->recv.wait);
-       return 0;
+       return nvkm_falcon_v1_new(&pmu->subdev, "PMU", 0x10a000, &pmu->falcon);
 }
 
 int