17ff51f82SBen Skeggs /* 27ff51f82SBen Skeggs * Copyright 2016 Red Hat Inc. 37ff51f82SBen Skeggs * 47ff51f82SBen Skeggs * Permission is hereby granted, free of charge, to any person obtaining a 57ff51f82SBen Skeggs * copy of this software and associated documentation files (the "Software"), 67ff51f82SBen Skeggs * to deal in the Software without restriction, including without limitation 77ff51f82SBen Skeggs * the rights to use, copy, modify, merge, publish, distribute, sublicense, 87ff51f82SBen Skeggs * and/or sell copies of the Software, and to permit persons to whom the 97ff51f82SBen Skeggs * Software is furnished to do so, subject to the following conditions: 107ff51f82SBen Skeggs * 117ff51f82SBen Skeggs * The above copyright notice and this permission notice shall be included in 127ff51f82SBen Skeggs * all copies or substantial portions of the Software. 137ff51f82SBen Skeggs * 147ff51f82SBen Skeggs * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 157ff51f82SBen Skeggs * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 167ff51f82SBen Skeggs * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 177ff51f82SBen Skeggs * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 187ff51f82SBen Skeggs * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 197ff51f82SBen Skeggs * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 207ff51f82SBen Skeggs * OTHER DEALINGS IN THE SOFTWARE. 217ff51f82SBen Skeggs * 227ff51f82SBen Skeggs * Authors: Ben Skeggs <bskeggs@redhat.com> 237ff51f82SBen Skeggs */ 247ff51f82SBen Skeggs #include "gf100.h" 257ff51f82SBen Skeggs #include "ram.h" 267ff51f82SBen Skeggs 277ff51f82SBen Skeggs #include <core/memory.h> 287ff51f82SBen Skeggs 297ff51f82SBen Skeggs static void 307ff51f82SBen Skeggs gp100_fb_init_unkn(struct nvkm_fb *base) 317ff51f82SBen Skeggs { 327ff51f82SBen Skeggs struct nvkm_device *device = gf100_fb(base)->base.subdev.device; 337ff51f82SBen Skeggs nvkm_wr32(device, 0x1fac80, nvkm_rd32(device, 0x100c80)); 347ff51f82SBen Skeggs nvkm_wr32(device, 0x1facc4, nvkm_rd32(device, 0x100cc4)); 357ff51f82SBen Skeggs nvkm_wr32(device, 0x1facc8, nvkm_rd32(device, 0x100cc8)); 367ff51f82SBen Skeggs nvkm_wr32(device, 0x1faccc, nvkm_rd32(device, 0x100ccc)); 377ff51f82SBen Skeggs } 387ff51f82SBen Skeggs 396258cd43SBen Skeggs void 407ff51f82SBen Skeggs gp100_fb_init(struct nvkm_fb *base) 417ff51f82SBen Skeggs { 427ff51f82SBen Skeggs struct gf100_fb *fb = gf100_fb(base); 437ff51f82SBen Skeggs struct nvkm_device *device = fb->base.subdev.device; 447ff51f82SBen Skeggs 457ff51f82SBen Skeggs if (fb->r100c10_page) 467ff51f82SBen Skeggs nvkm_wr32(device, 0x100c10, fb->r100c10 >> 8); 477ff51f82SBen Skeggs 487ff51f82SBen Skeggs nvkm_wr32(device, 0x100cc8, nvkm_memory_addr(fb->base.mmu_wr) >> 8); 497ff51f82SBen Skeggs nvkm_wr32(device, 0x100ccc, nvkm_memory_addr(fb->base.mmu_rd) >> 8); 507ff51f82SBen Skeggs nvkm_mask(device, 0x100cc4, 0x00060000, 51d1ea77abSBen Skeggs min(nvkm_memory_size(fb->base.mmu_rd) >> 16, (u64)2) << 17); 527ff51f82SBen Skeggs } 537ff51f82SBen Skeggs 547ff51f82SBen Skeggs static const struct nvkm_fb_func 557ff51f82SBen Skeggs gp100_fb = { 567ff51f82SBen Skeggs .dtor = gf100_fb_dtor, 577ff51f82SBen Skeggs .oneinit = gf100_fb_oneinit, 587ff51f82SBen Skeggs .init = gp100_fb_init, 597ff51f82SBen Skeggs .init_page = gm200_fb_init_page, 607ff51f82SBen Skeggs .init_unkn = gp100_fb_init_unkn, 617ff51f82SBen Skeggs .ram_new = gp100_ram_new, 627ff51f82SBen Skeggs }; 637ff51f82SBen Skeggs 647ff51f82SBen Skeggs int 657ff51f82SBen Skeggs gp100_fb_new(struct nvkm_device *device, int index, struct nvkm_fb **pfb) 667ff51f82SBen Skeggs { 677ff51f82SBen Skeggs return gf100_fb_new_(&gp100_fb, device, index, pfb); 687ff51f82SBen Skeggs } 69