diff options
Diffstat (limited to 'drivers/gpu/drm/nouveau')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_perf.c | 47 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_pm.c | 10 |
2 files changed, 53 insertions, 4 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_perf.c b/drivers/gpu/drm/nouveau/nouveau_perf.c index a397420e46c6..00f8243c6c73 100644 --- a/drivers/gpu/drm/nouveau/nouveau_perf.c +++ b/drivers/gpu/drm/nouveau/nouveau_perf.c | |||
@@ -27,6 +27,51 @@ | |||
27 | #include "nouveau_drv.h" | 27 | #include "nouveau_drv.h" |
28 | #include "nouveau_pm.h" | 28 | #include "nouveau_pm.h" |
29 | 29 | ||
30 | static void | ||
31 | legacy_perf_init(struct drm_device *dev) | ||
32 | { | ||
33 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
34 | struct nvbios *bios = &dev_priv->vbios; | ||
35 | struct nouveau_pm_engine *pm = &dev_priv->engine.pm; | ||
36 | char *perf, *entry, *bmp = &bios->data[bios->offset]; | ||
37 | int headerlen, use_straps; | ||
38 | |||
39 | if (bmp[5] < 0x5 || bmp[6] < 0x14) { | ||
40 | NV_DEBUG(dev, "BMP version too old for perf\n"); | ||
41 | return; | ||
42 | } | ||
43 | |||
44 | perf = ROMPTR(bios, bmp[0x73]); | ||
45 | if (!perf) { | ||
46 | NV_DEBUG(dev, "No memclock table pointer found.\n"); | ||
47 | return; | ||
48 | } | ||
49 | |||
50 | switch (perf[0]) { | ||
51 | case 0x12: | ||
52 | case 0x14: | ||
53 | case 0x18: | ||
54 | use_straps = 0; | ||
55 | headerlen = 1; | ||
56 | break; | ||
57 | case 0x01: | ||
58 | use_straps = perf[1] & 1; | ||
59 | headerlen = (use_straps ? 8 : 2); | ||
60 | break; | ||
61 | default: | ||
62 | NV_WARN(dev, "Unknown memclock table version %x.\n", perf[0]); | ||
63 | return; | ||
64 | } | ||
65 | |||
66 | entry = perf + headerlen; | ||
67 | if (use_straps) | ||
68 | entry += (nv_rd32(dev, NV_PEXTDEV_BOOT_0) & 0x3c) >> 1; | ||
69 | |||
70 | sprintf(pm->perflvl[0].name, "performance_level_0"); | ||
71 | pm->perflvl[0].memory = ROM16(entry[0]) * 20; | ||
72 | pm->nr_perflvl = 1; | ||
73 | } | ||
74 | |||
30 | void | 75 | void |
31 | nouveau_perf_init(struct drm_device *dev) | 76 | nouveau_perf_init(struct drm_device *dev) |
32 | { | 77 | { |
@@ -59,7 +104,7 @@ nouveau_perf_init(struct drm_device *dev) | |||
59 | } | 104 | } |
60 | } else { | 105 | } else { |
61 | if (bios->data[bios->offset + 6] < 0x27) { | 106 | if (bios->data[bios->offset + 6] < 0x27) { |
62 | NV_DEBUG(dev, "BMP version too old for perf\n"); | 107 | legacy_perf_init(dev); |
63 | return; | 108 | return; |
64 | } | 109 | } |
65 | 110 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c b/drivers/gpu/drm/nouveau/nouveau_pm.c index 4e92d215f05d..a07f27447cf9 100644 --- a/drivers/gpu/drm/nouveau/nouveau_pm.c +++ b/drivers/gpu/drm/nouveau/nouveau_pm.c | |||
@@ -148,7 +148,11 @@ nouveau_pm_perflvl_get(struct drm_device *dev, struct nouveau_pm_level *perflvl) | |||
148 | static void | 148 | static void |
149 | nouveau_pm_perflvl_info(struct nouveau_pm_level *perflvl, char *ptr, int len) | 149 | nouveau_pm_perflvl_info(struct nouveau_pm_level *perflvl, char *ptr, int len) |
150 | { | 150 | { |
151 | char s[16], v[16], f[16]; | 151 | char c[16], s[16], v[16], f[16]; |
152 | |||
153 | c[0] = '\0'; | ||
154 | if (perflvl->core) | ||
155 | snprintf(c, sizeof(c), " core %dMHz", perflvl->core / 1000); | ||
152 | 156 | ||
153 | s[0] = '\0'; | 157 | s[0] = '\0'; |
154 | if (perflvl->shader) | 158 | if (perflvl->shader) |
@@ -162,8 +166,8 @@ nouveau_pm_perflvl_info(struct nouveau_pm_level *perflvl, char *ptr, int len) | |||
162 | if (perflvl->fanspeed) | 166 | if (perflvl->fanspeed) |
163 | snprintf(f, sizeof(f), " fanspeed %d%%", perflvl->fanspeed); | 167 | snprintf(f, sizeof(f), " fanspeed %d%%", perflvl->fanspeed); |
164 | 168 | ||
165 | snprintf(ptr, len, "core %dMHz memory %dMHz%s%s%s\n", | 169 | snprintf(ptr, len, "memory %dMHz%s%s%s%s\n", perflvl->memory / 1000, |
166 | perflvl->core / 1000, perflvl->memory / 1000, s, v, f); | 170 | c, s, v, f); |
167 | } | 171 | } |
168 | 172 | ||
169 | static ssize_t | 173 | static ssize_t |