These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / gpu / drm / nouveau / nvkm / subdev / fb / ramnv44.c
index f575a72..bc56fbf 100644 (file)
  *
  * Authors: Ben Skeggs
  */
-#include "nv40.h"
+#include "ramnv40.h"
 
-static int
-nv44_ram_create(struct nvkm_object *parent, struct nvkm_object *engine,
-               struct nvkm_oclass *oclass, void *data, u32 size,
-               struct nvkm_object **pobject)
+int
+nv44_ram_new(struct nvkm_fb *fb, struct nvkm_ram **pram)
 {
-       struct nvkm_fb *pfb = nvkm_fb(parent);
-       struct nv40_ram *ram;
-       u32 pfb474 = nv_rd32(pfb, 0x100474);
-       int ret;
+       struct nvkm_device *device = fb->subdev.device;
+       u32  size = nvkm_rd32(device, 0x10020c) & 0xff000000;
+       u32 fb474 = nvkm_rd32(device, 0x100474);
+       enum nvkm_ram_type type = NVKM_RAM_TYPE_UNKNOWN;
 
-       ret = nvkm_ram_create(parent, engine, oclass, &ram);
-       *pobject = nv_object(ram);
-       if (ret)
-               return ret;
+       if (fb474 & 0x00000004)
+               type = NVKM_RAM_TYPE_GDDR3;
+       if (fb474 & 0x00000002)
+               type = NVKM_RAM_TYPE_DDR2;
+       if (fb474 & 0x00000001)
+               type = NVKM_RAM_TYPE_DDR1;
 
-       if (pfb474 & 0x00000004)
-               ram->base.type = NV_MEM_TYPE_GDDR3;
-       if (pfb474 & 0x00000002)
-               ram->base.type = NV_MEM_TYPE_DDR2;
-       if (pfb474 & 0x00000001)
-               ram->base.type = NV_MEM_TYPE_DDR1;
-
-       ram->base.size = nv_rd32(pfb, 0x10020c) & 0xff000000;
-       ram->base.calc = nv40_ram_calc;
-       ram->base.prog = nv40_ram_prog;
-       ram->base.tidy = nv40_ram_tidy;
-       return 0;
+       return nv40_ram_new_(fb, type, size, 0, pram);
 }
-
-struct nvkm_oclass
-nv44_ram_oclass = {
-       .handle = 0,
-       .ofuncs = &(struct nvkm_ofuncs) {
-               .ctor = nv44_ram_create,
-               .dtor = _nvkm_ram_dtor,
-               .init = _nvkm_ram_init,
-               .fini = _nvkm_ram_fini,
-       }
-};