38 if (!
bit_table(dev,
'P', &
P) &&
P.version &&
P.version <= 2) {
46 if (bios->
type == NVBIOS_BMP) {
63 u8 *perf = nouveau_perf_table(dev, ver);
65 if (*ver >= 0x12 && *ver < 0x20 && idx < perf[2]) {
69 return perf + perf[0] + idx * perf[3];
71 if (*ver >= 0x20 && *ver < 0x40 && idx < perf[2]) {
75 return perf + perf[1] + idx * (*hdr + (*cnt * *len));
77 if (*ver >= 0x40 && *ver < 0x41 && idx < perf[5]) {
81 return perf + perf[1] + idx * (*hdr + (*cnt * *len));
98 u8 *ramcfg = rammap + rammap[1];
106 for (i = 0; i < rammap[5]; i++) {
107 if (freq >=
ROM16(ramcfg[0]) &&
108 freq <=
ROM16(ramcfg[2]))
111 ramcfg += *hdr + (*cnt * *len);
118 if (nv_device(drm->
device)->chipset == 0x49 ||
119 nv_device(drm->
device)->chipset == 0x4b)
122 while ((perf = nouveau_perf_entry(dev, i++, ver, hdr, cnt, len))) {
123 if (*ver >= 0x20 && *ver < 0x25) {
124 if (perf[0] != 0xff && freq <=
ROM16(perf[11]) * 1000)
127 if (*ver >= 0x25 && *ver < 0x40) {
128 if (perf[0] != 0xff && freq <=
ROM16(perf[12]) * 1000)
134 u8 *ramcfg = perf + *
hdr;
152 strap = (nv_rd32(device, 0x101000) & 0x0000003c) >> 2;
157 if (rammap && strap < cnt)
158 return rammap + hdr + (strap * *len);
172 if (bios->
type == NVBIOS_BMP) {
173 while ((perf = nouveau_perf_entry(dev, i++, ver, &hdr, &cnt,
174 len)) && *ver == 0x15) {
175 if (freq <=
ROM32(perf[5]) * 20) {
192 if (timing && timing[0] == 0x10) {
194 if (ramcfg && ramcfg[1] < timing[2]) {
197 return timing + timing[1] + (ramcfg[1] * timing[3]);
212 int headerlen, use_straps;
214 if (bmp[5] < 0x5 || bmp[6] < 0x14) {
215 NV_DEBUG(drm,
"BMP version too old for perf\n");
219 perf =
ROMPTR(dev, bmp[0x73]);
221 NV_DEBUG(drm,
"No memclock table pointer found.\n");
233 use_straps = perf[1] & 1;
234 headerlen = (use_straps ? 8 : 2);
237 NV_WARN(drm,
"Unknown memclock table version %x.\n", perf[0]);
241 entry = perf + headerlen;
264 if (drm->
pm->voltage.version < 0x40) {
273 if (
bit_table(dev,
'P', &
P) ||
P.version != 2 ||
P.length < 34) {
274 NV_DEBUG(drm,
"where's our volt map table ptr? %d %d\n",
275 P.version,
P.length);
279 vmap =
ROMPTR(dev,
P.data[32]);
281 NV_DEBUG(drm,
"volt map table pointer invalid\n");
286 vmap += vmap[1] + (vmap[2] *
id);
302 legacy_perf_init(dev);
306 perf = nouveau_perf_table(dev, &ver);
308 while ((perf = nouveau_perf_entry(dev, ++i, &ver, &hdr, &cnt, &len))) {
331 perflvl->
core += (
signed char)perf[8] * 1000;
332 if (nv_device(drm->
device)->chipset == 0x49 ||
333 nv_device(drm->
device)->chipset == 0x4b)
357 #define subent(n) ((ROM16(perf[hdr + (n) * len]) & 0xfff) * 1000)
360 if (nv_device(drm->
device)->card_type == NV_50) {
382 nouveau_perf_voltage(dev, perflvl);
386 NV_DEBUG(drm,
"perflvl %d, bad vid\n", i);
395 NV_DEBUG(drm,
"perflvl %d, bad timing: %d\n", i, ret);
400 "performance_level_%d", i);