]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/nouveau/gr/gf100-: implement another chunk of bios-provided init
authorBen Skeggs <bskeggs@redhat.com>
Tue, 8 May 2018 10:39:46 +0000 (20:39 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 18 May 2018 05:01:22 +0000 (15:01 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.h
drivers/gpu/drm/nouveau/nvkm/engine/gr/gm107.c

index 6912eaa5a90acf53eafcf80cfa0c0a01b539fe39..01b903acde4a05cdaa5ea86652f5ebfefe51fa94 100644 (file)
@@ -1999,6 +1999,8 @@ gf100_gr_init(struct gf100_gr *gr)
        gr->func->init_num_active_ltcs(gr);
        if (gr->func->init_rop_active_fbps)
                gr->func->init_rop_active_fbps(gr);
+       if (gr->func->init_bios_2)
+               gr->func->init_bios_2(gr);
 
        nvkm_wr32(device, 0x400500, 0x00010001);
 
index 7f6aed873408fe2a5e5e8265010e7ed62be3dfdd..11cf2dff0f811f0c6a4ef715302e0842a30e3b41 100644 (file)
@@ -128,6 +128,7 @@ struct gf100_gr_func {
        void (*init_zcull)(struct gf100_gr *);
        void (*init_num_active_ltcs)(struct gf100_gr *);
        void (*init_rop_active_fbps)(struct gf100_gr *);
+       void (*init_bios_2)(struct gf100_gr *);
        void (*init_ppc_exceptions)(struct gf100_gr *);
        void (*init_swdx_pes_mask)(struct gf100_gr *);
        void (*set_hww_esr_report_mask)(struct gf100_gr *);
index bbb0a28365f54074708dd0103b9cc977ba06f9ae..c653df323f1adfce04c36feca1d7a1aa95ab0517 100644 (file)
@@ -25,6 +25,8 @@
 #include "ctxgf100.h"
 
 #include <subdev/bios.h>
+#include <subdev/bios/bit.h>
+#include <subdev/bios/init.h>
 #include <subdev/bios/P0260.h>
 #include <subdev/fb.h>
 
@@ -279,6 +281,31 @@ gm107_gr_pack_mmio[] = {
  * PGRAPH engine/subdev functions
  ******************************************************************************/
 
+static void
+gm107_gr_init_bios_2(struct gf100_gr *gr)
+{
+       struct nvkm_subdev *subdev = &gr->base.engine.subdev;
+       struct nvkm_device *device = subdev->device;
+       struct nvkm_bios *bios = device->bios;
+       struct bit_entry bit_P;
+       if (!bit_entry(bios, 'P', &bit_P) &&
+           bit_P.version == 2 && bit_P.length >= 0x2c) {
+               u32 data = nvbios_rd32(bios, bit_P.offset + 0x28);
+               if (data) {
+                       u8 ver = nvbios_rd08(bios, data + 0x00);
+                       u8 hdr = nvbios_rd08(bios, data + 0x01);
+                       if (ver == 0x20 && hdr >= 8) {
+                               data = nvbios_rd32(bios, data + 0x04);
+                               if (data) {
+                                       u32 save = nvkm_rd32(device, 0x619444);
+                                       nvbios_init(subdev, data);
+                                       nvkm_wr32(device, 0x619444, save);
+                               }
+                       }
+               }
+       }
+}
+
 void
 gm107_gr_init_bios(struct gf100_gr *gr)
 {
@@ -427,6 +454,7 @@ gm107_gr = {
        .init_zcull = gf117_gr_init_zcull,
        .init_num_active_ltcs = gf100_gr_init_num_active_ltcs,
        .init_rop_active_fbps = gk104_gr_init_rop_active_fbps,
+       .init_bios_2 = gm107_gr_init_bios_2,
        .init_ppc_exceptions = gk104_gr_init_ppc_exceptions,
        .mmio = gm107_gr_pack_mmio,
        .fecs.ucode = &gm107_gr_fecs_ucode,