static int nv41_ram_create(struct nouveau_object *parent, struct nouveau_object *engine, struct nouveau_oclass *oclass, void *data, u32 size, struct nouveau_object **pobject) { struct nouveau_fb *pfb = nouveau_fb(parent); struct nouveau_ram *ram; u32 pfb474 = nv_rd32(pfb, 0x100474); int ret; ret = nouveau_ram_create(parent, engine, oclass, &ram); *pobject = nv_object(ram); if (ret) return ret; if (pfb474 & 0x00000004) ram->type = NV_MEM_TYPE_GDDR3; if (pfb474 & 0x00000002) ram->type = NV_MEM_TYPE_DDR2; if (pfb474 & 0x00000001) ram->type = NV_MEM_TYPE_DDR1; ram->size = nv_rd32(pfb, 0x10020c) & 0xff000000; ram->parts = (nv_rd32(pfb, 0x100200) & 0x00000003) + 1; ram->tags = nv_rd32(pfb, 0x100320); return 0; }
static int nv49_ram_create(struct nouveau_object *parent, struct nouveau_object *engine, struct nouveau_oclass *oclass, void *data, u32 size, struct nouveau_object **pobject) { struct nouveau_fb *pfb = nouveau_fb(parent); struct nv40_ram *ram; u32 pfb914 = nv_rd32(pfb, 0x100914); int ret; ret = nouveau_ram_create(parent, engine, oclass, &ram); *pobject = nv_object(ram); if (ret) return ret; switch (pfb914 & 0x00000003) { case 0x00000000: ram->base.type = NV_MEM_TYPE_DDR1; break; case 0x00000001: ram->base.type = NV_MEM_TYPE_DDR2; break; case 0x00000002: ram->base.type = NV_MEM_TYPE_GDDR3; break; case 0x00000003: break; } ram->base.size = nv_rd32(pfb, 0x10020c) & 0xff000000; ram->base.parts = (nv_rd32(pfb, 0x100200) & 0x00000003) + 1; ram->base.tags = nv_rd32(pfb, 0x100320); ram->base.calc = nv40_ram_calc; ram->base.prog = nv40_ram_prog; ram->base.tidy = nv40_ram_tidy; return 0; }
static int nvaa_ram_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nouveau_oclass *oclass, void *data, u32 datasize, struct nouveau_object **pobject) { const u32 rsvd_head = ( 256 * 1024) >> 12; /* vga memory */ const u32 rsvd_tail = (1024 * 1024) >> 12; /* vbios etc */ struct nouveau_fb *pfb = nouveau_fb(parent); struct nouveau_ram *ram; int ret; ret = nouveau_ram_create(parent, engine, oclass, &ram); *pobject = nv_object(ram); if (ret) return ret; ram->size = nv_rd32(pfb, 0x10020c); ram->size = (ram->size & 0xffffff00) | ((ram->size & 0x000000ff) << 32); ret = nouveau_mm_init(&pfb->vram, rsvd_head, (ram->size >> 12) - (rsvd_head + rsvd_tail), 1); if (ret) return ret; ram->type = NV_MEM_TYPE_STOLEN; ram->stolen = (u64)nv_rd32(pfb, 0x100e10) << 12; ram->get = nv50_ram_get; ram->put = nv50_ram_put; return 0; }
static int nv4e_ram_create(struct nouveau_object *parent, struct nouveau_object *engine, struct nouveau_oclass *oclass, void *data, u32 size, struct nouveau_object **pobject) { struct nouveau_fb *pfb = nouveau_fb(parent); struct nouveau_ram *ram; int ret; ret = nouveau_ram_create(parent, engine, oclass, &ram); *pobject = nv_object(ram); if (ret) return ret; ram->size = nv_rd32(pfb, 0x10020c) & 0xff000000; ram->type = NV_MEM_TYPE_STOLEN; return 0; }
static int nv04_ram_create(struct nouveau_object *parent, struct nouveau_object *engine, struct nouveau_oclass *oclass, void *data, u32 size, struct nouveau_object **pobject) { struct nouveau_fb *pfb = nouveau_fb(parent); struct nouveau_ram *ram; u32 boot0 = nv_rd32(pfb, NV04_PFB_BOOT_0); int ret; ret = nouveau_ram_create(parent, engine, oclass, &ram); *pobject = nv_object(ram); if (ret) return ret; if (boot0 & 0x00000100) { ram->size = ((boot0 >> 12) & 0xf) * 2 + 2; ram->size *= 1024 * 1024; } else {
static int gk20a_ram_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nouveau_oclass *oclass, void *data, u32 datasize, struct nouveau_object **pobject) { struct nouveau_ram *ram; int ret; ret = nouveau_ram_create(parent, engine, oclass, &ram); *pobject = nv_object(ram); if (ret) return ret; ram->type = NV_MEM_TYPE_STOLEN; ram->size = get_num_physpages() << PAGE_SHIFT; ram->get = gk20a_ram_get; ram->put = gk20a_ram_put; return 0; }
static int nv10_ram_create(struct nouveau_object *parent, struct nouveau_object *engine, struct nouveau_oclass *oclass, void *data, u32 size, struct nouveau_object **pobject) { struct nouveau_fb *pfb = nouveau_fb(parent); struct nouveau_ram *ram; u32 cfg0 = nv_rd32(pfb, 0x100200); int ret; ret = nouveau_ram_create(parent, engine, oclass, &ram); *pobject = nv_object(ram); if (ret) return ret; if (cfg0 & 0x00000001) ram->type = NV_MEM_TYPE_DDR1; else ram->type = NV_MEM_TYPE_SDRAM; ram->size = nv_rd32(pfb, 0x10020c) & 0xff000000; return 0; }