These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / gpu / drm / nouveau / nvkm / subdev / bios / shadowrom.c
index 6ec3b23..ffa4b39 100644 (file)
  */
 #include "priv.h"
 
-#include <core/device.h>
+#include <subdev/pci.h>
 
 static u32
 prom_read(void *data, u32 offset, u32 length, struct nvkm_bios *bios)
 {
+       struct nvkm_device *device = data;
        u32 i;
        if (offset + length <= 0x00100000) {
                for (i = offset; i < offset + length; i += 4)
-                       *(u32 *)&bios->data[i] = nv_rd32(bios, 0x300000 + i);
+                       *(u32 *)&bios->data[i] = nvkm_rd32(device, 0x300000 + i);
                return length;
        }
        return 0;
@@ -39,25 +40,18 @@ prom_read(void *data, u32 offset, u32 length, struct nvkm_bios *bios)
 static void
 prom_fini(void *data)
 {
-       struct nvkm_bios *bios = data;
-       if (nv_device(bios)->card_type < NV_50)
-               nv_mask(bios, 0x001850, 0x00000001, 0x00000001);
-       else
-               nv_mask(bios, 0x088050, 0x00000001, 0x00000001);
+       struct nvkm_device *device = data;
+       nvkm_pci_rom_shadow(device->pci, true);
 }
 
 static void *
 prom_init(struct nvkm_bios *bios, const char *name)
 {
-       if (nv_device(bios)->card_type < NV_50) {
-               if (nv_device(bios)->card_type == NV_40 &&
-                   nv_device(bios)->chipset >= 0x4c)
-                       return ERR_PTR(-ENODEV);
-               nv_mask(bios, 0x001850, 0x00000001, 0x00000000);
-       } else {
-               nv_mask(bios, 0x088050, 0x00000001, 0x00000000);
-       }
-       return bios;
+       struct nvkm_device *device = bios->subdev.device;
+       if (device->card_type == NV_40 && device->chipset >= 0x4c)
+               return ERR_PTR(-ENODEV);
+       nvkm_pci_rom_shadow(device->pci, false);
+       return device;
 }
 
 const struct nvbios_source