1 // SPDX-License-Identifier: MIT
2 #include "ram.h"
3 
4 #include <subdev/bios.h>
5 
6 static const struct nvkm_ram_func
7 gp102_ram = {
8 };
9 
10 int
11 gp102_ram_new(struct nvkm_fb *fb, struct nvkm_ram **pram)
12 {
13 	enum nvkm_ram_type type = nvkm_fb_bios_memtype(fb->subdev.device->bios);
14 	const u32 rsvd_head = ( 256 * 1024); /* vga memory */
15 	const u32 rsvd_tail = (1024 * 1024); /* vbios etc */
16 	u64 size = fb->func->vidmem.size(fb);
17 	int ret;
18 
19 	ret = nvkm_ram_new_(&gp102_ram, fb, type, size, pram);
20 	if (ret)
21 		return ret;
22 
23 	nvkm_mm_fini(&(*pram)->vram);
24 
25 	return nvkm_mm_init(&(*pram)->vram, NVKM_RAM_MM_NORMAL,
26 			    rsvd_head >> NVKM_RAM_MM_SHIFT,
27 			    (size - rsvd_head - rsvd_tail) >> NVKM_RAM_MM_SHIFT,
28 			    1);
29 
30 }
31