aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_abi16.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_abi16.c')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_abi16.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c
index 3b6dc883e150..1c4c6c9161ac 100644
--- a/drivers/gpu/drm/nouveau/nouveau_abi16.c
+++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c
@@ -30,6 +30,7 @@
30#include <subdev/fb.h> 30#include <subdev/fb.h>
31#include <subdev/timer.h> 31#include <subdev/timer.h>
32#include <subdev/instmem.h> 32#include <subdev/instmem.h>
33#include <engine/graph.h>
33 34
34#include "nouveau_drm.h" 35#include "nouveau_drm.h"
35#include "nouveau_dma.h" 36#include "nouveau_dma.h"
@@ -168,6 +169,7 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS)
168 struct nouveau_drm *drm = nouveau_drm(dev); 169 struct nouveau_drm *drm = nouveau_drm(dev);
169 struct nouveau_device *device = nv_device(drm->device); 170 struct nouveau_device *device = nv_device(drm->device);
170 struct nouveau_timer *ptimer = nouveau_timer(device); 171 struct nouveau_timer *ptimer = nouveau_timer(device);
172 struct nouveau_graph *graph = (void *)nouveau_engine(device, NVDEV_ENGINE_GR);
171 struct drm_nouveau_getparam *getparam = data; 173 struct drm_nouveau_getparam *getparam = data;
172 174
173 switch (getparam->param) { 175 switch (getparam->param) {
@@ -208,14 +210,8 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS)
208 getparam->value = 1; 210 getparam->value = 1;
209 break; 211 break;
210 case NOUVEAU_GETPARAM_GRAPH_UNITS: 212 case NOUVEAU_GETPARAM_GRAPH_UNITS:
211 /* NV40 and NV50 versions are quite different, but register 213 getparam->value = graph->units ? graph->units(graph) : 0;
212 * address is the same. User is supposed to know the card 214 break;
213 * family anyway... */
214 if (device->chipset >= 0x40) {
215 getparam->value = nv_rd32(device, 0x001540);
216 break;
217 }
218 /* FALLTHRU */
219 default: 215 default:
220 nv_debug(device, "unknown parameter %lld\n", getparam->param); 216 nv_debug(device, "unknown parameter %lld\n", getparam->param);
221 return -EINVAL; 217 return -EINVAL;
@@ -391,7 +387,7 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS)
391 struct nouveau_drm *drm = nouveau_drm(dev); 387 struct nouveau_drm *drm = nouveau_drm(dev);
392 struct nouveau_device *device = nv_device(drm->device); 388 struct nouveau_device *device = nv_device(drm->device);
393 struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev); 389 struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev);
394 struct nouveau_abi16_chan *chan, *temp; 390 struct nouveau_abi16_chan *chan = NULL, *temp;
395 struct nouveau_abi16_ntfy *ntfy; 391 struct nouveau_abi16_ntfy *ntfy;
396 struct nouveau_object *object; 392 struct nouveau_object *object;
397 struct nv_dma_class args = {}; 393 struct nv_dma_class args = {};
@@ -404,10 +400,11 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS)
404 if (unlikely(nv_device(abi16->device)->card_type >= NV_C0)) 400 if (unlikely(nv_device(abi16->device)->card_type >= NV_C0))
405 return nouveau_abi16_put(abi16, -EINVAL); 401 return nouveau_abi16_put(abi16, -EINVAL);
406 402
407 list_for_each_entry_safe(chan, temp, &abi16->channels, head) { 403 list_for_each_entry(temp, &abi16->channels, head) {
408 if (chan->chan->handle == (NVDRM_CHAN | info->channel)) 404 if (temp->chan->handle == (NVDRM_CHAN | info->channel)) {
405 chan = temp;
409 break; 406 break;
410 chan = NULL; 407 }
411 } 408 }
412 409
413 if (!chan) 410 if (!chan)
@@ -459,17 +456,18 @@ nouveau_abi16_ioctl_gpuobj_free(ABI16_IOCTL_ARGS)
459{ 456{
460 struct drm_nouveau_gpuobj_free *fini = data; 457 struct drm_nouveau_gpuobj_free *fini = data;
461 struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev); 458 struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev);
462 struct nouveau_abi16_chan *chan, *temp; 459 struct nouveau_abi16_chan *chan = NULL, *temp;
463 struct nouveau_abi16_ntfy *ntfy; 460 struct nouveau_abi16_ntfy *ntfy;
464 int ret; 461 int ret;
465 462
466 if (unlikely(!abi16)) 463 if (unlikely(!abi16))
467 return -ENOMEM; 464 return -ENOMEM;
468 465
469 list_for_each_entry_safe(chan, temp, &abi16->channels, head) { 466 list_for_each_entry(temp, &abi16->channels, head) {
470 if (chan->chan->handle == (NVDRM_CHAN | fini->channel)) 467 if (temp->chan->handle == (NVDRM_CHAN | fini->channel)) {
468 chan = temp;
471 break; 469 break;
472 chan = NULL; 470 }
473 } 471 }
474 472
475 if (!chan) 473 if (!chan)