aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/nouveau/Makefile1
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/device/nve0.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/fifo/nv108.c37
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c112
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/fifo/nve0.h17
-rw-r--r--drivers/gpu/drm/nouveau/core/include/engine/fifo.h1
6 files changed, 115 insertions, 55 deletions
diff --git a/drivers/gpu/drm/nouveau/Makefile b/drivers/gpu/drm/nouveau/Makefile
index b3fa1ba191b7..a8804254bb31 100644
--- a/drivers/gpu/drm/nouveau/Makefile
+++ b/drivers/gpu/drm/nouveau/Makefile
@@ -232,6 +232,7 @@ nouveau-y += core/engine/fifo/nv50.o
232nouveau-y += core/engine/fifo/nv84.o 232nouveau-y += core/engine/fifo/nv84.o
233nouveau-y += core/engine/fifo/nvc0.o 233nouveau-y += core/engine/fifo/nvc0.o
234nouveau-y += core/engine/fifo/nve0.o 234nouveau-y += core/engine/fifo/nve0.o
235nouveau-y += core/engine/fifo/nv108.o
235nouveau-y += core/engine/graph/ctxnv40.o 236nouveau-y += core/engine/graph/ctxnv40.o
236nouveau-y += core/engine/graph/ctxnv50.o 237nouveau-y += core/engine/graph/ctxnv50.o
237nouveau-y += core/engine/graph/ctxnvc0.o 238nouveau-y += core/engine/graph/ctxnvc0.o
diff --git a/drivers/gpu/drm/nouveau/core/engine/device/nve0.c b/drivers/gpu/drm/nouveau/core/engine/device/nve0.c
index 3900104976fc..0fc93472f02f 100644
--- a/drivers/gpu/drm/nouveau/core/engine/device/nve0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/device/nve0.c
@@ -212,8 +212,8 @@ nve0_identify(struct nouveau_device *device)
212 device->oclass[NVDEV_SUBDEV_PWR ] = &nv108_pwr_oclass; 212 device->oclass[NVDEV_SUBDEV_PWR ] = &nv108_pwr_oclass;
213 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass; 213 device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass;
214 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvd0_dmaeng_oclass; 214 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvd0_dmaeng_oclass;
215 device->oclass[NVDEV_ENGINE_FIFO ] = nv108_fifo_oclass;
215#if 0 216#if 0
216 device->oclass[NVDEV_ENGINE_FIFO ] = nve0_fifo_oclass;
217 device->oclass[NVDEV_ENGINE_SW ] = nvc0_software_oclass; 217 device->oclass[NVDEV_ENGINE_SW ] = nvc0_software_oclass;
218 device->oclass[NVDEV_ENGINE_GR ] = nvf0_graph_oclass; 218 device->oclass[NVDEV_ENGINE_GR ] = nvf0_graph_oclass;
219#endif 219#endif
diff --git a/drivers/gpu/drm/nouveau/core/engine/fifo/nv108.c b/drivers/gpu/drm/nouveau/core/engine/fifo/nv108.c
new file mode 100644
index 000000000000..09362a51ba57
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/fifo/nv108.c
@@ -0,0 +1,37 @@
1/*
2 * Copyright 2013 Red Hat Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: Ben Skeggs
23 */
24
25#include "nve0.h"
26
27struct nouveau_oclass *
28nv108_fifo_oclass = &(struct nve0_fifo_impl) {
29 .base.handle = NV_ENGINE(FIFO, 0x08),
30 .base.ofuncs = &(struct nouveau_ofuncs) {
31 .ctor = nve0_fifo_ctor,
32 .dtor = nve0_fifo_dtor,
33 .init = nve0_fifo_init,
34 .fini = _nouveau_fifo_fini,
35 },
36 .channels = 1024,
37}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c b/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c
index 04f412922d2d..4af3f406896b 100644
--- a/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c
@@ -36,7 +36,8 @@
36#include <subdev/vm.h> 36#include <subdev/vm.h>
37 37
38#include <engine/dmaobj.h> 38#include <engine/dmaobj.h>
39#include <engine/fifo.h> 39
40#include "nve0.h"
40 41
41#define _(a,b) { (a), ((1ULL << (a)) | (b)) } 42#define _(a,b) { (a), ((1ULL << (a)) | (b)) }
42static const struct { 43static const struct {
@@ -575,15 +576,64 @@ nve0_fifo_uevent_disable(struct nouveau_event *event, int index)
575 nv_mask(priv, 0x002140, 0x80000000, 0x00000000); 576 nv_mask(priv, 0x002140, 0x80000000, 0x00000000);
576} 577}
577 578
578static int 579int
580nve0_fifo_init(struct nouveau_object *object)
581{
582 struct nve0_fifo_priv *priv = (void *)object;
583 int ret, i;
584
585 ret = nouveau_fifo_init(&priv->base);
586 if (ret)
587 return ret;
588
589 /* enable all available PSUBFIFOs */
590 nv_wr32(priv, 0x000204, 0xffffffff);
591 priv->spoon_nr = hweight32(nv_rd32(priv, 0x000204));
592 nv_debug(priv, "%d subfifo(s)\n", priv->spoon_nr);
593
594 /* PSUBFIFO[n] */
595 for (i = 0; i < priv->spoon_nr; i++) {
596 nv_mask(priv, 0x04013c + (i * 0x2000), 0x10000100, 0x00000000);
597 nv_wr32(priv, 0x040108 + (i * 0x2000), 0xffffffff); /* INTR */
598 nv_wr32(priv, 0x04010c + (i * 0x2000), 0xfffffeff); /* INTREN */
599 }
600
601 nv_wr32(priv, 0x002254, 0x10000000 | priv->user.bar.offset >> 12);
602
603 nv_wr32(priv, 0x002a00, 0xffffffff);
604 nv_wr32(priv, 0x002100, 0xffffffff);
605 nv_wr32(priv, 0x002140, 0x3fffffff);
606 return 0;
607}
608
609void
610nve0_fifo_dtor(struct nouveau_object *object)
611{
612 struct nve0_fifo_priv *priv = (void *)object;
613 int i;
614
615 nouveau_gpuobj_unmap(&priv->user.bar);
616 nouveau_gpuobj_ref(NULL, &priv->user.mem);
617
618 for (i = 0; i < FIFO_ENGINE_NR; i++) {
619 nouveau_gpuobj_ref(NULL, &priv->engine[i].playlist[1]);
620 nouveau_gpuobj_ref(NULL, &priv->engine[i].playlist[0]);
621 }
622
623 nouveau_fifo_destroy(&priv->base);
624}
625
626int
579nve0_fifo_ctor(struct nouveau_object *parent, struct nouveau_object *engine, 627nve0_fifo_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
580 struct nouveau_oclass *oclass, void *data, u32 size, 628 struct nouveau_oclass *oclass, void *data, u32 size,
581 struct nouveau_object **pobject) 629 struct nouveau_object **pobject)
582{ 630{
631 struct nve0_fifo_impl *impl = (void *)oclass;
583 struct nve0_fifo_priv *priv; 632 struct nve0_fifo_priv *priv;
584 int ret, i; 633 int ret, i;
585 634
586 ret = nouveau_fifo_create(parent, engine, oclass, 0, 4095, &priv); 635 ret = nouveau_fifo_create(parent, engine, oclass, 0,
636 impl->channels - 1, &priv);
587 *pobject = nv_object(priv); 637 *pobject = nv_object(priv);
588 if (ret) 638 if (ret)
589 return ret; 639 return ret;
@@ -621,60 +671,14 @@ nve0_fifo_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
621 return 0; 671 return 0;
622} 672}
623 673
624static void
625nve0_fifo_dtor(struct nouveau_object *object)
626{
627 struct nve0_fifo_priv *priv = (void *)object;
628 int i;
629
630 nouveau_gpuobj_unmap(&priv->user.bar);
631 nouveau_gpuobj_ref(NULL, &priv->user.mem);
632
633 for (i = 0; i < FIFO_ENGINE_NR; i++) {
634 nouveau_gpuobj_ref(NULL, &priv->engine[i].playlist[1]);
635 nouveau_gpuobj_ref(NULL, &priv->engine[i].playlist[0]);
636 }
637
638 nouveau_fifo_destroy(&priv->base);
639}
640
641static int
642nve0_fifo_init(struct nouveau_object *object)
643{
644 struct nve0_fifo_priv *priv = (void *)object;
645 int ret, i;
646
647 ret = nouveau_fifo_init(&priv->base);
648 if (ret)
649 return ret;
650
651 /* enable all available PSUBFIFOs */
652 nv_wr32(priv, 0x000204, 0xffffffff);
653 priv->spoon_nr = hweight32(nv_rd32(priv, 0x000204));
654 nv_debug(priv, "%d subfifo(s)\n", priv->spoon_nr);
655
656 /* PSUBFIFO[n] */
657 for (i = 0; i < priv->spoon_nr; i++) {
658 nv_mask(priv, 0x04013c + (i * 0x2000), 0x10000100, 0x00000000);
659 nv_wr32(priv, 0x040108 + (i * 0x2000), 0xffffffff); /* INTR */
660 nv_wr32(priv, 0x04010c + (i * 0x2000), 0xfffffeff); /* INTREN */
661 }
662
663 nv_wr32(priv, 0x002254, 0x10000000 | priv->user.bar.offset >> 12);
664
665 nv_wr32(priv, 0x002a00, 0xffffffff);
666 nv_wr32(priv, 0x002100, 0xffffffff);
667 nv_wr32(priv, 0x002140, 0x3fffffff);
668 return 0;
669}
670
671struct nouveau_oclass * 674struct nouveau_oclass *
672nve0_fifo_oclass = &(struct nouveau_oclass) { 675nve0_fifo_oclass = &(struct nve0_fifo_impl) {
673 .handle = NV_ENGINE(FIFO, 0xe0), 676 .base.handle = NV_ENGINE(FIFO, 0xe0),
674 .ofuncs = &(struct nouveau_ofuncs) { 677 .base.ofuncs = &(struct nouveau_ofuncs) {
675 .ctor = nve0_fifo_ctor, 678 .ctor = nve0_fifo_ctor,
676 .dtor = nve0_fifo_dtor, 679 .dtor = nve0_fifo_dtor,
677 .init = nve0_fifo_init, 680 .init = nve0_fifo_init,
678 .fini = _nouveau_fifo_fini, 681 .fini = _nouveau_fifo_fini,
679 }, 682 },
680}; 683 .channels = 4096,
684}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.h b/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.h
new file mode 100644
index 000000000000..014344ebee66
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.h
@@ -0,0 +1,17 @@
1#ifndef __NVKM_FIFO_NVE0_H__
2#define __NVKM_FIFO_NVE0_H__
3
4#include <engine/fifo.h>
5
6int nve0_fifo_ctor(struct nouveau_object *, struct nouveau_object *,
7 struct nouveau_oclass *, void *, u32,
8 struct nouveau_object **);
9void nve0_fifo_dtor(struct nouveau_object *);
10int nve0_fifo_init(struct nouveau_object *);
11
12struct nve0_fifo_impl {
13 struct nouveau_oclass base;
14 u32 channels;
15};
16
17#endif
diff --git a/drivers/gpu/drm/nouveau/core/include/engine/fifo.h b/drivers/gpu/drm/nouveau/core/include/engine/fifo.h
index 8c32cf4d83c7..26b6b2bb1112 100644
--- a/drivers/gpu/drm/nouveau/core/include/engine/fifo.h
+++ b/drivers/gpu/drm/nouveau/core/include/engine/fifo.h
@@ -109,6 +109,7 @@ extern struct nouveau_oclass *nv50_fifo_oclass;
109extern struct nouveau_oclass *nv84_fifo_oclass; 109extern struct nouveau_oclass *nv84_fifo_oclass;
110extern struct nouveau_oclass *nvc0_fifo_oclass; 110extern struct nouveau_oclass *nvc0_fifo_oclass;
111extern struct nouveau_oclass *nve0_fifo_oclass; 111extern struct nouveau_oclass *nve0_fifo_oclass;
112extern struct nouveau_oclass *nv108_fifo_oclass;
112 113
113void nv04_fifo_intr(struct nouveau_subdev *); 114void nv04_fifo_intr(struct nouveau_subdev *);
114int nv04_fifo_context_attach(struct nouveau_object *, struct nouveau_object *); 115int nv04_fifo_context_attach(struct nouveau_object *, struct nouveau_object *);