Home | History | Annotate | Line # | Download | only in pm
      1 /*	$NetBSD: nouveau_nvkm_engine_pm_gk104.c,v 1.3 2021/12/18 23:45:37 riastradh Exp $	*/
      2 
      3 /*
      4  * Copyright 2013 Red Hat Inc.
      5  *
      6  * Permission is hereby granted, free of charge, to any person obtaining a
      7  * copy of this software and associated documentation files (the "Software"),
      8  * to deal in the Software without restriction, including without limitation
      9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     10  * and/or sell copies of the Software, and to permit persons to whom the
     11  * Software is furnished to do so, subject to the following conditions:
     12  *
     13  * The above copyright notice and this permission notice shall be included in
     14  * all copies or substantial portions of the Software.
     15  *
     16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     19  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
     20  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     22  * OTHER DEALINGS IN THE SOFTWARE.
     23  *
     24  * Authors: Ben Skeggs
     25  */
     26 #include <sys/cdefs.h>
     27 __KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_engine_pm_gk104.c,v 1.3 2021/12/18 23:45:37 riastradh Exp $");
     28 
     29 #include "gf100.h"
     30 
     31 static const struct nvkm_specsrc
     32 gk104_pmfb_sources[] = {
     33 	{ 0x140028, (const struct nvkm_specmux[]) {
     34 			{ 0x3fff, 0, "unk0" },
     35 			{ 0x7, 16, "unk16" },
     36 			{ 0x3, 24, "unk24" },
     37 			{ 0x2, 28, "unk28" },
     38 			{}
     39 		}, "pmfb0_pm_unk28" },
     40 	{ 0x14125c, (const struct nvkm_specmux[]) {
     41 			{ 0x3fff, 0, "unk0" },
     42 			{}
     43 		}, "pmfb0_subp0_pm_unk25c" },
     44 	{ 0x14165c, (const struct nvkm_specmux[]) {
     45 			{ 0x3fff, 0, "unk0" },
     46 			{}
     47 		}, "pmfb0_subp1_pm_unk25c" },
     48 	{ 0x141a5c, (const struct nvkm_specmux[]) {
     49 			{ 0x3fff, 0, "unk0" },
     50 			{}
     51 		}, "pmfb0_subp2_pm_unk25c" },
     52 	{ 0x141e5c, (const struct nvkm_specmux[]) {
     53 			{ 0x3fff, 0, "unk0" },
     54 			{}
     55 		}, "pmfb0_subp3_pm_unk25c" },
     56 	{}
     57 };
     58 
     59 static const struct nvkm_specsrc
     60 gk104_tex_sources[] = {
     61 	{ 0x5042c0, (const struct nvkm_specmux[]) {
     62 			{ 0xf, 0, "sel0", true },
     63 			{ 0x7, 8, "sel1", true },
     64 			{}
     65 		}, "pgraph_gpc0_tpc0_tex_pm_mux_c_d" },
     66 	{ 0x5042c8, (const struct nvkm_specmux[]) {
     67 			{ 0x1f, 0, "sel", true },
     68 			{}
     69 		}, "pgraph_gpc0_tpc0_tex_pm_unkc8" },
     70 	{ 0x5042b8, (const struct nvkm_specmux[]) {
     71 			{ 0xff, 0, "sel", true },
     72 			{}
     73 		}, "pgraph_gpc0_tpc0_tex_pm_unkb8" },
     74 	{}
     75 };
     76 
     77 static const struct nvkm_specdom
     78 gk104_pm_hub[] = {
     79 	{ 0x60, (const struct nvkm_specsig[]) {
     80 			{ 0x47, "hub00_user_0" },
     81 			{}
     82 		}, &gf100_perfctr_func },
     83 	{ 0x40, (const struct nvkm_specsig[]) {
     84 			{ 0x27, "hub01_user_0" },
     85 			{}
     86 		}, &gf100_perfctr_func },
     87 	{ 0x60, (const struct nvkm_specsig[]) {
     88 			{ 0x47, "hub02_user_0" },
     89 			{}
     90 		}, &gf100_perfctr_func },
     91 	{ 0x60, (const struct nvkm_specsig[]) {
     92 			{ 0x47, "hub03_user_0" },
     93 			{}
     94 		}, &gf100_perfctr_func },
     95 	{ 0x40, (const struct nvkm_specsig[]) {
     96 			{ 0x03, "host_mmio_rd" },
     97 			{ 0x27, "hub04_user_0" },
     98 			{}
     99 		}, &gf100_perfctr_func },
    100 	{ 0x60, (const struct nvkm_specsig[]) {
    101 			{ 0x47, "hub05_user_0" },
    102 			{}
    103 		}, &gf100_perfctr_func },
    104 	{ 0xc0, (const struct nvkm_specsig[]) {
    105 			{ 0x74, "host_fb_rd3x" },
    106 			{ 0x75, "host_fb_rd3x_2" },
    107 			{ 0xa7, "hub06_user_0" },
    108 			{}
    109 		}, &gf100_perfctr_func },
    110 	{ 0x60, (const struct nvkm_specsig[]) {
    111 			{ 0x47, "hub07_user_0" },
    112 			{}
    113 		}, &gf100_perfctr_func },
    114 	{}
    115 };
    116 
    117 static const struct nvkm_specdom
    118 gk104_pm_gpc[] = {
    119 	{ 0xe0, (const struct nvkm_specsig[]) {
    120 			{ 0xc7, "gpc00_user_0" },
    121 			{}
    122 		}, &gf100_perfctr_func },
    123 	{ 0x20, (const struct nvkm_specsig[]) {
    124 			{}
    125 		}, &gf100_perfctr_func },
    126 	{ 0x20, (const struct nvkm_specsig[]) {
    127 			{ 0x00, "gpc02_tex_00", gk104_tex_sources },
    128 			{ 0x01, "gpc02_tex_01", gk104_tex_sources },
    129 			{ 0x02, "gpc02_tex_02", gk104_tex_sources },
    130 			{ 0x03, "gpc02_tex_03", gk104_tex_sources },
    131 			{ 0x04, "gpc02_tex_04", gk104_tex_sources },
    132 			{ 0x05, "gpc02_tex_05", gk104_tex_sources },
    133 			{ 0x06, "gpc02_tex_06", gk104_tex_sources },
    134 			{ 0x07, "gpc02_tex_07", gk104_tex_sources },
    135 			{ 0x08, "gpc02_tex_08", gk104_tex_sources },
    136 			{ 0x0a, "gpc02_tex_0a", gk104_tex_sources },
    137 			{ 0x0b, "gpc02_tex_0b", gk104_tex_sources },
    138 			{ 0x0d, "gpc02_tex_0c", gk104_tex_sources },
    139 			{ 0x0c, "gpc02_tex_0d", gk104_tex_sources },
    140 			{ 0x0e, "gpc02_tex_0e", gk104_tex_sources },
    141 			{ 0x0f, "gpc02_tex_0f", gk104_tex_sources },
    142 			{ 0x10, "gpc02_tex_10", gk104_tex_sources },
    143 			{ 0x11, "gpc02_tex_11", gk104_tex_sources },
    144 			{ 0x12, "gpc02_tex_12", gk104_tex_sources },
    145 			{}
    146 		}, &gf100_perfctr_func },
    147 	{}
    148 };
    149 
    150 static const struct nvkm_specdom
    151 gk104_pm_part[] = {
    152 	{ 0x60, (const struct nvkm_specsig[]) {
    153 			{ 0x00, "part00_pbfb_00", gf100_pbfb_sources },
    154 			{ 0x01, "part00_pbfb_01", gf100_pbfb_sources },
    155 			{ 0x0c, "part00_pmfb_00", gk104_pmfb_sources },
    156 			{ 0x0d, "part00_pmfb_01", gk104_pmfb_sources },
    157 			{ 0x0e, "part00_pmfb_02", gk104_pmfb_sources },
    158 			{ 0x0f, "part00_pmfb_03", gk104_pmfb_sources },
    159 			{ 0x10, "part00_pmfb_04", gk104_pmfb_sources },
    160 			{ 0x12, "part00_pmfb_05", gk104_pmfb_sources },
    161 			{ 0x15, "part00_pmfb_06", gk104_pmfb_sources },
    162 			{ 0x16, "part00_pmfb_07", gk104_pmfb_sources },
    163 			{ 0x18, "part00_pmfb_08", gk104_pmfb_sources },
    164 			{ 0x21, "part00_pmfb_09", gk104_pmfb_sources },
    165 			{ 0x25, "part00_pmfb_0a", gk104_pmfb_sources },
    166 			{ 0x26, "part00_pmfb_0b", gk104_pmfb_sources },
    167 			{ 0x27, "part00_pmfb_0c", gk104_pmfb_sources },
    168 			{ 0x47, "part00_user_0" },
    169 			{}
    170 		}, &gf100_perfctr_func },
    171 	{ 0x60, (const struct nvkm_specsig[]) {
    172 			{ 0x47, "part01_user_0" },
    173 			{}
    174 		}, &gf100_perfctr_func },
    175 	{}
    176 };
    177 
    178 static const struct gf100_pm_func
    179 gk104_pm = {
    180 	.doms_gpc = gk104_pm_gpc,
    181 	.doms_hub = gk104_pm_hub,
    182 	.doms_part = gk104_pm_part,
    183 };
    184 
    185 int
    186 gk104_pm_new(struct nvkm_device *device, int index, struct nvkm_pm **ppm)
    187 {
    188 	return gf100_pm_new_(&gk104_pm, device, index, ppm);
    189 }
    190