1b4806009SBen Skeggs /*
2b4806009SBen Skeggs * Copyright 2018 Red Hat Inc.
3b4806009SBen Skeggs *
4b4806009SBen Skeggs * Permission is hereby granted, free of charge, to any person obtaining a
5b4806009SBen Skeggs * copy of this software and associated documentation files (the "Software"),
6b4806009SBen Skeggs * to deal in the Software without restriction, including without limitation
7b4806009SBen Skeggs * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8b4806009SBen Skeggs * and/or sell copies of the Software, and to permit persons to whom the
9b4806009SBen Skeggs * Software is furnished to do so, subject to the following conditions:
10b4806009SBen Skeggs *
11b4806009SBen Skeggs * The above copyright notice and this permission notice shall be included in
12b4806009SBen Skeggs * all copies or substantial portions of the Software.
13b4806009SBen Skeggs *
14b4806009SBen Skeggs * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15b4806009SBen Skeggs * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16b4806009SBen Skeggs * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17b4806009SBen Skeggs * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18b4806009SBen Skeggs * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19b4806009SBen Skeggs * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20b4806009SBen Skeggs * OTHER DEALINGS IN THE SOFTWARE.
21b4806009SBen Skeggs */
22b4806009SBen Skeggs #include "gf100.h"
23b4806009SBen Skeggs #include "ram.h"
24b4806009SBen Skeggs
25*834a712bSBen Skeggs #include <subdev/gsp.h>
26*834a712bSBen Skeggs
27b4806009SBen Skeggs bool
tu102_fb_vpr_scrub_required(struct nvkm_fb * fb)28b4806009SBen Skeggs tu102_fb_vpr_scrub_required(struct nvkm_fb *fb)
29b4806009SBen Skeggs {
30b4806009SBen Skeggs return (nvkm_rd32(fb->subdev.device, 0x1fa80c) & 0x00000010) != 0;
31b4806009SBen Skeggs }
32b4806009SBen Skeggs
33b4806009SBen Skeggs static const struct nvkm_fb_func
34b4806009SBen Skeggs tu102_fb = {
35b4806009SBen Skeggs .dtor = gf100_fb_dtor,
361b9b4f92SBen Skeggs .oneinit = gp102_fb_oneinit,
37b4806009SBen Skeggs .init = gm200_fb_init,
38b4806009SBen Skeggs .init_page = gv100_fb_init_page,
39b4806009SBen Skeggs .init_unkn = gp100_fb_init_unkn,
40b4806009SBen Skeggs .sysmem.flush_page_init = gf100_fb_sysmem_flush_page_init,
412c0c15a2SBen Skeggs .vidmem.size = gp102_fb_vidmem_size,
42b4806009SBen Skeggs .vpr.scrub_required = tu102_fb_vpr_scrub_required,
43b4806009SBen Skeggs .vpr.scrub = gp102_fb_vpr_scrub,
442c0c15a2SBen Skeggs .ram_new = gp102_ram_new,
45b4806009SBen Skeggs .default_bigpage = 16,
46b4806009SBen Skeggs };
47b4806009SBen Skeggs
48b4806009SBen Skeggs int
tu102_fb_new(struct nvkm_device * device,enum nvkm_subdev_type type,int inst,struct nvkm_fb ** pfb)49b4806009SBen Skeggs tu102_fb_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_fb **pfb)
50b4806009SBen Skeggs {
51*834a712bSBen Skeggs if (nvkm_gsp_rm(device->gsp))
52*834a712bSBen Skeggs return r535_fb_new(&tu102_fb, device, type, inst, pfb);
53*834a712bSBen Skeggs
541b9b4f92SBen Skeggs return gf100_fb_new_(&tu102_fb, device, type, inst, pfb);
55b4806009SBen Skeggs }
56b4806009SBen Skeggs
57b4806009SBen Skeggs MODULE_FIRMWARE("nvidia/tu102/nvdec/scrubber.bin");
58b4806009SBen Skeggs MODULE_FIRMWARE("nvidia/tu104/nvdec/scrubber.bin");
59b4806009SBen Skeggs MODULE_FIRMWARE("nvidia/tu106/nvdec/scrubber.bin");
60b4806009SBen Skeggs MODULE_FIRMWARE("nvidia/tu116/nvdec/scrubber.bin");
61b4806009SBen Skeggs MODULE_FIRMWARE("nvidia/tu117/nvdec/scrubber.bin");
62