drm/nouveau/flcn: fetch PRI address from TOP if not provided by constructor
authorBen Skeggs <bskeggs@redhat.com>
Tue, 14 Jan 2020 20:34:21 +0000 (06:34 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 15 Jan 2020 00:50:26 +0000 (10:50 +1000)
Shortcut to avoid each subdev having to do this itself.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/falcon/base.c

index 3ed421058b08243b5685c1febe27fa6779cbedf8..8f4c3aca2233ccc21fc32238aa9ff880d9fe790f 100644 (file)
@@ -22,6 +22,7 @@
 #include "priv.h"
 
 #include <subdev/mc.h>
+#include <subdev/top.h>
 
 void
 nvkm_falcon_load_imem(struct nvkm_falcon *falcon, void *data, u32 start,
@@ -141,6 +142,12 @@ nvkm_falcon_oneinit(struct nvkm_falcon *falcon)
        u32 debug_reg;
        u32 reg;
 
+       if (!falcon->addr) {
+               falcon->addr = nvkm_top_addr(subdev->device, subdev->index);
+               if (WARN_ON(!falcon->addr))
+                       return -ENODEV;
+       }
+
        reg = nvkm_falcon_rd32(falcon, 0x12c);
        falcon->version = reg & 0xf;
        falcon->secret = (reg >> 4) & 0x3;