License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 22:07:57 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2015-01-14 13:29:43 +08:00
|
|
|
#include "nv20.h"
|
|
|
|
#include "regs.h"
|
|
|
|
|
2012-12-10 06:00:34 +08:00
|
|
|
#include <core/client.h>
|
2015-08-20 12:54:22 +08:00
|
|
|
#include <core/gpuobj.h>
|
2012-07-20 06:17:34 +08:00
|
|
|
#include <engine/fifo.h>
|
2015-08-20 12:54:19 +08:00
|
|
|
#include <engine/fifo/chan.h>
|
2015-01-14 13:29:43 +08:00
|
|
|
#include <subdev/fb.h>
|
|
|
|
#include <subdev/timer.h>
|
2012-07-20 06:17:34 +08:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* PGRAPH context
|
|
|
|
******************************************************************************/
|
2009-12-11 17:24:15 +08:00
|
|
|
|
2012-07-20 06:17:34 +08:00
|
|
|
int
|
2015-08-20 12:54:19 +08:00
|
|
|
nv20_gr_chan_init(struct nvkm_object *object)
|
2009-12-11 17:24:15 +08:00
|
|
|
{
|
2015-08-20 12:54:19 +08:00
|
|
|
struct nv20_gr_chan *chan = nv20_gr_chan(object);
|
|
|
|
struct nv20_gr *gr = chan->gr;
|
|
|
|
u32 inst = nvkm_memory_addr(chan->inst);
|
2009-12-11 17:24:15 +08:00
|
|
|
|
2015-08-20 12:54:14 +08:00
|
|
|
nvkm_kmap(gr->ctxtab);
|
2015-08-20 12:54:19 +08:00
|
|
|
nvkm_wo32(gr->ctxtab, chan->chid * 4, inst >> 4);
|
2015-08-20 12:54:14 +08:00
|
|
|
nvkm_done(gr->ctxtab);
|
2012-07-20 06:17:34 +08:00
|
|
|
return 0;
|
2009-12-11 17:24:15 +08:00
|
|
|
}
|
|
|
|
|
2012-07-20 06:17:34 +08:00
|
|
|
int
|
2015-08-20 12:54:19 +08:00
|
|
|
nv20_gr_chan_fini(struct nvkm_object *object, bool suspend)
|
2009-12-11 17:24:15 +08:00
|
|
|
{
|
2015-08-20 12:54:19 +08:00
|
|
|
struct nv20_gr_chan *chan = nv20_gr_chan(object);
|
|
|
|
struct nv20_gr *gr = chan->gr;
|
2015-08-20 12:54:10 +08:00
|
|
|
struct nvkm_device *device = gr->base.engine.subdev.device;
|
2015-08-20 12:54:19 +08:00
|
|
|
u32 inst = nvkm_memory_addr(chan->inst);
|
2012-07-20 06:17:34 +08:00
|
|
|
int chid = -1;
|
|
|
|
|
2015-08-20 12:54:10 +08:00
|
|
|
nvkm_mask(device, 0x400720, 0x00000001, 0x00000000);
|
|
|
|
if (nvkm_rd32(device, 0x400144) & 0x00010000)
|
|
|
|
chid = (nvkm_rd32(device, 0x400148) & 0x1f000000) >> 24;
|
2012-07-20 06:17:34 +08:00
|
|
|
if (chan->chid == chid) {
|
2015-08-20 12:54:19 +08:00
|
|
|
nvkm_wr32(device, 0x400784, inst >> 4);
|
2015-08-20 12:54:10 +08:00
|
|
|
nvkm_wr32(device, 0x400788, 0x00000002);
|
2015-08-20 12:54:11 +08:00
|
|
|
nvkm_msec(device, 2000,
|
|
|
|
if (!nvkm_rd32(device, 0x400700))
|
|
|
|
break;
|
|
|
|
);
|
2015-08-20 12:54:10 +08:00
|
|
|
nvkm_wr32(device, 0x400144, 0x10000000);
|
|
|
|
nvkm_mask(device, 0x400148, 0xff000000, 0x1f000000);
|
2009-12-11 17:24:15 +08:00
|
|
|
}
|
2015-08-20 12:54:10 +08:00
|
|
|
nvkm_mask(device, 0x400720, 0x00000001, 0x00000001);
|
2009-12-11 17:24:15 +08:00
|
|
|
|
2015-08-20 12:54:14 +08:00
|
|
|
nvkm_kmap(gr->ctxtab);
|
|
|
|
nvkm_wo32(gr->ctxtab, chan->chid * 4, 0x00000000);
|
|
|
|
nvkm_done(gr->ctxtab);
|
2015-08-20 12:54:19 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2015-08-20 12:54:18 +08:00
|
|
|
|
2015-08-20 12:54:19 +08:00
|
|
|
void *
|
|
|
|
nv20_gr_chan_dtor(struct nvkm_object *object)
|
|
|
|
{
|
|
|
|
struct nv20_gr_chan *chan = nv20_gr_chan(object);
|
2017-11-01 01:56:19 +08:00
|
|
|
nvkm_memory_unref(&chan->inst);
|
2015-08-20 12:54:19 +08:00
|
|
|
return chan;
|
2009-12-11 17:24:15 +08:00
|
|
|
}
|
|
|
|
|
2015-08-20 12:54:19 +08:00
|
|
|
static const struct nvkm_object_func
|
|
|
|
nv20_gr_chan = {
|
|
|
|
.dtor = nv20_gr_chan_dtor,
|
|
|
|
.init = nv20_gr_chan_init,
|
|
|
|
.fini = nv20_gr_chan_fini,
|
2012-07-20 06:17:34 +08:00
|
|
|
};
|
2009-12-11 17:24:15 +08:00
|
|
|
|
2015-08-20 12:54:19 +08:00
|
|
|
static int
|
|
|
|
nv20_gr_chan_new(struct nvkm_gr *base, struct nvkm_fifo_chan *fifoch,
|
|
|
|
const struct nvkm_oclass *oclass, struct nvkm_object **pobject)
|
|
|
|
{
|
|
|
|
struct nv20_gr *gr = nv20_gr(base);
|
|
|
|
struct nv20_gr_chan *chan;
|
|
|
|
int ret, i;
|
|
|
|
|
|
|
|
if (!(chan = kzalloc(sizeof(*chan), GFP_KERNEL)))
|
|
|
|
return -ENOMEM;
|
|
|
|
nvkm_object_ctor(&nv20_gr_chan, oclass, &chan->object);
|
|
|
|
chan->gr = gr;
|
|
|
|
chan->chid = fifoch->chid;
|
|
|
|
*pobject = &chan->object;
|
|
|
|
|
|
|
|
ret = nvkm_memory_new(gr->base.engine.subdev.device,
|
|
|
|
NVKM_MEM_TARGET_INST, 0x37f0, 16, true,
|
|
|
|
&chan->inst);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
nvkm_kmap(chan->inst);
|
|
|
|
nvkm_wo32(chan->inst, 0x0000, 0x00000001 | (chan->chid << 24));
|
|
|
|
nvkm_wo32(chan->inst, 0x033c, 0xffff0000);
|
|
|
|
nvkm_wo32(chan->inst, 0x03a0, 0x0fff0000);
|
|
|
|
nvkm_wo32(chan->inst, 0x03a4, 0x0fff0000);
|
|
|
|
nvkm_wo32(chan->inst, 0x047c, 0x00000101);
|
|
|
|
nvkm_wo32(chan->inst, 0x0490, 0x00000111);
|
|
|
|
nvkm_wo32(chan->inst, 0x04a8, 0x44400000);
|
|
|
|
for (i = 0x04d4; i <= 0x04e0; i += 4)
|
|
|
|
nvkm_wo32(chan->inst, i, 0x00030303);
|
|
|
|
for (i = 0x04f4; i <= 0x0500; i += 4)
|
|
|
|
nvkm_wo32(chan->inst, i, 0x00080000);
|
|
|
|
for (i = 0x050c; i <= 0x0518; i += 4)
|
|
|
|
nvkm_wo32(chan->inst, i, 0x01012000);
|
|
|
|
for (i = 0x051c; i <= 0x0528; i += 4)
|
|
|
|
nvkm_wo32(chan->inst, i, 0x000105b8);
|
|
|
|
for (i = 0x052c; i <= 0x0538; i += 4)
|
|
|
|
nvkm_wo32(chan->inst, i, 0x00080008);
|
|
|
|
for (i = 0x055c; i <= 0x0598; i += 4)
|
|
|
|
nvkm_wo32(chan->inst, i, 0x07ff0000);
|
|
|
|
nvkm_wo32(chan->inst, 0x05a4, 0x4b7fffff);
|
|
|
|
nvkm_wo32(chan->inst, 0x05fc, 0x00000001);
|
|
|
|
nvkm_wo32(chan->inst, 0x0604, 0x00004000);
|
|
|
|
nvkm_wo32(chan->inst, 0x0610, 0x00000001);
|
|
|
|
nvkm_wo32(chan->inst, 0x0618, 0x00040000);
|
|
|
|
nvkm_wo32(chan->inst, 0x061c, 0x00010000);
|
|
|
|
for (i = 0x1c1c; i <= 0x248c; i += 16) {
|
|
|
|
nvkm_wo32(chan->inst, (i + 0), 0x10700ff9);
|
|
|
|
nvkm_wo32(chan->inst, (i + 4), 0x0436086c);
|
|
|
|
nvkm_wo32(chan->inst, (i + 8), 0x000c001b);
|
|
|
|
}
|
|
|
|
nvkm_wo32(chan->inst, 0x281c, 0x3f800000);
|
|
|
|
nvkm_wo32(chan->inst, 0x2830, 0x3f800000);
|
|
|
|
nvkm_wo32(chan->inst, 0x285c, 0x40000000);
|
|
|
|
nvkm_wo32(chan->inst, 0x2860, 0x3f800000);
|
|
|
|
nvkm_wo32(chan->inst, 0x2864, 0x3f000000);
|
|
|
|
nvkm_wo32(chan->inst, 0x286c, 0x40000000);
|
|
|
|
nvkm_wo32(chan->inst, 0x2870, 0x3f800000);
|
|
|
|
nvkm_wo32(chan->inst, 0x2878, 0xbf800000);
|
|
|
|
nvkm_wo32(chan->inst, 0x2880, 0xbf800000);
|
|
|
|
nvkm_wo32(chan->inst, 0x34a4, 0x000fe000);
|
|
|
|
nvkm_wo32(chan->inst, 0x3530, 0x000003f8);
|
|
|
|
nvkm_wo32(chan->inst, 0x3540, 0x002fe000);
|
|
|
|
for (i = 0x355c; i <= 0x3578; i += 4)
|
|
|
|
nvkm_wo32(chan->inst, i, 0x001c527c);
|
|
|
|
nvkm_done(chan->inst);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-07-20 06:17:34 +08:00
|
|
|
/*******************************************************************************
|
|
|
|
* PGRAPH engine/subdev functions
|
|
|
|
******************************************************************************/
|
2009-12-11 17:24:15 +08:00
|
|
|
|
|
|
|
void
|
2015-08-20 12:54:22 +08:00
|
|
|
nv20_gr_tile(struct nvkm_gr *base, int i, struct nvkm_fb_tile *tile)
|
2009-12-11 17:24:15 +08:00
|
|
|
{
|
2015-08-20 12:54:22 +08:00
|
|
|
struct nv20_gr *gr = nv20_gr(base);
|
2015-08-20 12:54:10 +08:00
|
|
|
struct nvkm_device *device = gr->base.engine.subdev.device;
|
|
|
|
struct nvkm_fifo *fifo = device->fifo;
|
2010-10-18 09:53:39 +08:00
|
|
|
unsigned long flags;
|
2009-12-11 17:24:15 +08:00
|
|
|
|
2015-08-20 12:54:22 +08:00
|
|
|
nvkm_fifo_pause(fifo, &flags);
|
2015-08-20 12:54:19 +08:00
|
|
|
nv04_gr_idle(&gr->base);
|
2010-10-18 09:53:39 +08:00
|
|
|
|
2015-08-20 12:54:10 +08:00
|
|
|
nvkm_wr32(device, NV20_PGRAPH_TLIMIT(i), tile->limit);
|
|
|
|
nvkm_wr32(device, NV20_PGRAPH_TSIZE(i), tile->pitch);
|
|
|
|
nvkm_wr32(device, NV20_PGRAPH_TILE(i), tile->addr);
|
2010-10-18 09:53:39 +08:00
|
|
|
|
2015-08-20 12:54:10 +08:00
|
|
|
nvkm_wr32(device, NV10_PGRAPH_RDI_INDEX, 0x00EA0030 + 4 * i);
|
|
|
|
nvkm_wr32(device, NV10_PGRAPH_RDI_DATA, tile->limit);
|
|
|
|
nvkm_wr32(device, NV10_PGRAPH_RDI_INDEX, 0x00EA0050 + 4 * i);
|
|
|
|
nvkm_wr32(device, NV10_PGRAPH_RDI_DATA, tile->pitch);
|
|
|
|
nvkm_wr32(device, NV10_PGRAPH_RDI_INDEX, 0x00EA0010 + 4 * i);
|
|
|
|
nvkm_wr32(device, NV10_PGRAPH_RDI_DATA, tile->addr);
|
2010-10-18 09:53:39 +08:00
|
|
|
|
2015-08-20 12:54:22 +08:00
|
|
|
if (device->chipset != 0x34) {
|
2015-08-20 12:54:10 +08:00
|
|
|
nvkm_wr32(device, NV20_PGRAPH_ZCOMP(i), tile->zcomp);
|
|
|
|
nvkm_wr32(device, NV10_PGRAPH_RDI_INDEX, 0x00ea0090 + 4 * i);
|
|
|
|
nvkm_wr32(device, NV10_PGRAPH_RDI_DATA, tile->zcomp);
|
2012-07-20 06:17:34 +08:00
|
|
|
}
|
2009-12-11 17:24:15 +08:00
|
|
|
|
2015-08-20 12:54:22 +08:00
|
|
|
nvkm_fifo_start(fifo, &flags);
|
2009-12-11 17:24:15 +08:00
|
|
|
}
|
|
|
|
|
2012-07-20 06:17:34 +08:00
|
|
|
void
|
2015-08-20 12:54:22 +08:00
|
|
|
nv20_gr_intr(struct nvkm_gr *base)
|
2009-12-16 19:12:27 +08:00
|
|
|
{
|
2015-08-20 12:54:22 +08:00
|
|
|
struct nv20_gr *gr = nv20_gr(base);
|
|
|
|
struct nvkm_subdev *subdev = &gr->base.engine.subdev;
|
|
|
|
struct nvkm_device *device = subdev->device;
|
2015-08-20 12:54:18 +08:00
|
|
|
struct nvkm_fifo_chan *chan;
|
2015-08-20 12:54:10 +08:00
|
|
|
u32 stat = nvkm_rd32(device, NV03_PGRAPH_INTR);
|
|
|
|
u32 nsource = nvkm_rd32(device, NV03_PGRAPH_NSOURCE);
|
|
|
|
u32 nstatus = nvkm_rd32(device, NV03_PGRAPH_NSTATUS);
|
|
|
|
u32 addr = nvkm_rd32(device, NV04_PGRAPH_TRAPPED_ADDR);
|
2012-07-20 06:17:34 +08:00
|
|
|
u32 chid = (addr & 0x01f00000) >> 20;
|
|
|
|
u32 subc = (addr & 0x00070000) >> 16;
|
|
|
|
u32 mthd = (addr & 0x00001ffc);
|
2015-08-20 12:54:10 +08:00
|
|
|
u32 data = nvkm_rd32(device, NV04_PGRAPH_TRAPPED_DATA);
|
|
|
|
u32 class = nvkm_rd32(device, 0x400160 + subc * 4) & 0xfff;
|
2012-07-20 06:17:34 +08:00
|
|
|
u32 show = stat;
|
2015-08-20 12:54:13 +08:00
|
|
|
char msg[128], src[128], sta[128];
|
2015-08-20 12:54:18 +08:00
|
|
|
unsigned long flags;
|
2012-07-20 06:17:34 +08:00
|
|
|
|
2015-08-20 12:54:18 +08:00
|
|
|
chan = nvkm_fifo_chan_chid(device->fifo, chid, &flags);
|
2010-10-24 22:36:12 +08:00
|
|
|
|
2015-08-20 12:54:10 +08:00
|
|
|
nvkm_wr32(device, NV03_PGRAPH_INTR, stat);
|
|
|
|
nvkm_wr32(device, NV04_PGRAPH_FIFO, 0x00000001);
|
2012-07-20 06:17:34 +08:00
|
|
|
|
|
|
|
if (show) {
|
2015-08-20 12:54:13 +08:00
|
|
|
nvkm_snprintbf(msg, sizeof(msg), nv10_gr_intr_name, show);
|
|
|
|
nvkm_snprintbf(src, sizeof(src), nv04_gr_nsource, nsource);
|
|
|
|
nvkm_snprintbf(sta, sizeof(sta), nv10_gr_nstatus, nstatus);
|
|
|
|
nvkm_error(subdev, "intr %08x [%s] nsource %08x [%s] "
|
|
|
|
"nstatus %08x [%s] ch %d [%s] subc %d "
|
|
|
|
"class %04x mthd %04x data %08x\n",
|
|
|
|
show, msg, nsource, src, nstatus, sta, chid,
|
2015-08-20 12:54:19 +08:00
|
|
|
chan ? chan->object.client->name : "unknown",
|
|
|
|
subc, class, mthd, data);
|
2009-12-11 17:24:15 +08:00
|
|
|
}
|
2012-08-13 14:26:07 +08:00
|
|
|
|
2015-08-20 12:54:18 +08:00
|
|
|
nvkm_fifo_chan_put(device->fifo, flags, &chan);
|
2012-07-20 06:17:34 +08:00
|
|
|
}
|
2009-12-11 17:24:15 +08:00
|
|
|
|
2015-08-20 12:54:22 +08:00
|
|
|
int
|
|
|
|
nv20_gr_oneinit(struct nvkm_gr *base)
|
2009-12-11 17:24:15 +08:00
|
|
|
{
|
2015-08-20 12:54:22 +08:00
|
|
|
struct nv20_gr *gr = nv20_gr(base);
|
|
|
|
return nvkm_memory_new(gr->base.engine.subdev.device,
|
|
|
|
NVKM_MEM_TARGET_INST, 32 * 4, 16,
|
|
|
|
true, &gr->ctxtab);
|
2012-07-20 06:17:34 +08:00
|
|
|
}
|
2009-12-11 17:24:15 +08:00
|
|
|
|
2012-07-20 06:17:34 +08:00
|
|
|
int
|
2015-08-20 12:54:22 +08:00
|
|
|
nv20_gr_init(struct nvkm_gr *base)
|
2012-07-20 06:17:34 +08:00
|
|
|
{
|
2015-08-20 12:54:22 +08:00
|
|
|
struct nv20_gr *gr = nv20_gr(base);
|
2015-08-20 12:54:10 +08:00
|
|
|
struct nvkm_device *device = gr->base.engine.subdev.device;
|
2012-07-20 06:17:34 +08:00
|
|
|
u32 tmp, vramsz;
|
2015-08-20 12:54:22 +08:00
|
|
|
int i;
|
2009-12-11 17:24:15 +08:00
|
|
|
|
2015-08-20 12:54:17 +08:00
|
|
|
nvkm_wr32(device, NV20_PGRAPH_CHANNEL_CTX_TABLE,
|
|
|
|
nvkm_memory_addr(gr->ctxtab) >> 4);
|
2009-12-11 17:24:15 +08:00
|
|
|
|
2015-08-20 12:54:22 +08:00
|
|
|
if (device->chipset == 0x20) {
|
2015-08-20 12:54:10 +08:00
|
|
|
nvkm_wr32(device, NV10_PGRAPH_RDI_INDEX, 0x003d0000);
|
2012-07-20 06:17:34 +08:00
|
|
|
for (i = 0; i < 15; i++)
|
2015-08-20 12:54:10 +08:00
|
|
|
nvkm_wr32(device, NV10_PGRAPH_RDI_DATA, 0x00000000);
|
2015-08-20 12:54:11 +08:00
|
|
|
nvkm_msec(device, 2000,
|
|
|
|
if (!nvkm_rd32(device, 0x400700))
|
|
|
|
break;
|
|
|
|
);
|
2012-07-20 06:17:34 +08:00
|
|
|
} else {
|
2015-08-20 12:54:10 +08:00
|
|
|
nvkm_wr32(device, NV10_PGRAPH_RDI_INDEX, 0x02c80000);
|
2012-07-20 06:17:34 +08:00
|
|
|
for (i = 0; i < 32; i++)
|
2015-08-20 12:54:10 +08:00
|
|
|
nvkm_wr32(device, NV10_PGRAPH_RDI_DATA, 0x00000000);
|
2015-08-20 12:54:11 +08:00
|
|
|
nvkm_msec(device, 2000,
|
|
|
|
if (!nvkm_rd32(device, 0x400700))
|
|
|
|
break;
|
|
|
|
);
|
2009-12-11 17:24:15 +08:00
|
|
|
}
|
|
|
|
|
2015-08-20 12:54:10 +08:00
|
|
|
nvkm_wr32(device, NV03_PGRAPH_INTR , 0xFFFFFFFF);
|
|
|
|
nvkm_wr32(device, NV03_PGRAPH_INTR_EN, 0xFFFFFFFF);
|
2009-12-11 17:24:15 +08:00
|
|
|
|
2015-08-20 12:54:10 +08:00
|
|
|
nvkm_wr32(device, NV04_PGRAPH_DEBUG_0, 0xFFFFFFFF);
|
|
|
|
nvkm_wr32(device, NV04_PGRAPH_DEBUG_0, 0x00000000);
|
|
|
|
nvkm_wr32(device, NV04_PGRAPH_DEBUG_1, 0x00118700);
|
|
|
|
nvkm_wr32(device, NV04_PGRAPH_DEBUG_3, 0xF3CE0475); /* 0x4 = auto ctx switch */
|
|
|
|
nvkm_wr32(device, NV10_PGRAPH_DEBUG_4, 0x00000000);
|
|
|
|
nvkm_wr32(device, 0x40009C , 0x00000040);
|
2010-11-03 11:16:18 +08:00
|
|
|
|
2015-08-20 12:54:22 +08:00
|
|
|
if (device->chipset >= 0x25) {
|
2015-08-20 12:54:10 +08:00
|
|
|
nvkm_wr32(device, 0x400890, 0x00a8cfff);
|
|
|
|
nvkm_wr32(device, 0x400610, 0x304B1FB6);
|
|
|
|
nvkm_wr32(device, 0x400B80, 0x1cbd3883);
|
|
|
|
nvkm_wr32(device, 0x400B84, 0x44000000);
|
|
|
|
nvkm_wr32(device, 0x400098, 0x40000080);
|
|
|
|
nvkm_wr32(device, 0x400B88, 0x000000ff);
|
2010-11-03 11:16:18 +08:00
|
|
|
|
2012-07-20 06:17:34 +08:00
|
|
|
} else {
|
2015-08-20 12:54:10 +08:00
|
|
|
nvkm_wr32(device, 0x400880, 0x0008c7df);
|
|
|
|
nvkm_wr32(device, 0x400094, 0x00000005);
|
|
|
|
nvkm_wr32(device, 0x400B80, 0x45eae20e);
|
|
|
|
nvkm_wr32(device, 0x400B84, 0x24000000);
|
|
|
|
nvkm_wr32(device, 0x400098, 0x00000040);
|
|
|
|
nvkm_wr32(device, NV10_PGRAPH_RDI_INDEX, 0x00E00038);
|
|
|
|
nvkm_wr32(device, NV10_PGRAPH_RDI_DATA , 0x00000030);
|
|
|
|
nvkm_wr32(device, NV10_PGRAPH_RDI_INDEX, 0x00E10038);
|
|
|
|
nvkm_wr32(device, NV10_PGRAPH_RDI_DATA , 0x00000030);
|
2010-11-03 11:16:18 +08:00
|
|
|
}
|
2011-04-01 10:32:03 +08:00
|
|
|
|
2015-08-20 12:54:10 +08:00
|
|
|
nvkm_wr32(device, 0x4009a0, nvkm_rd32(device, 0x100324));
|
|
|
|
nvkm_wr32(device, NV10_PGRAPH_RDI_INDEX, 0x00EA000C);
|
|
|
|
nvkm_wr32(device, NV10_PGRAPH_RDI_DATA, nvkm_rd32(device, 0x100324));
|
2011-04-01 10:32:03 +08:00
|
|
|
|
2015-08-20 12:54:10 +08:00
|
|
|
nvkm_wr32(device, NV10_PGRAPH_CTX_CONTROL, 0x10000100);
|
|
|
|
nvkm_wr32(device, NV10_PGRAPH_STATE , 0xFFFFFFFF);
|
2011-04-01 10:32:03 +08:00
|
|
|
|
2015-08-20 12:54:10 +08:00
|
|
|
tmp = nvkm_rd32(device, NV10_PGRAPH_SURFACE) & 0x0007ff00;
|
|
|
|
nvkm_wr32(device, NV10_PGRAPH_SURFACE, tmp);
|
|
|
|
tmp = nvkm_rd32(device, NV10_PGRAPH_SURFACE) | 0x00020100;
|
|
|
|
nvkm_wr32(device, NV10_PGRAPH_SURFACE, tmp);
|
2011-04-01 10:32:03 +08:00
|
|
|
|
2012-07-20 06:17:34 +08:00
|
|
|
/* begin RAM config */
|
2015-08-20 12:54:23 +08:00
|
|
|
vramsz = device->func->resource_size(device, 1) - 1;
|
2015-08-20 12:54:10 +08:00
|
|
|
nvkm_wr32(device, 0x4009A4, nvkm_rd32(device, 0x100200));
|
|
|
|
nvkm_wr32(device, 0x4009A8, nvkm_rd32(device, 0x100204));
|
|
|
|
nvkm_wr32(device, NV10_PGRAPH_RDI_INDEX, 0x00EA0000);
|
|
|
|
nvkm_wr32(device, NV10_PGRAPH_RDI_DATA , nvkm_rd32(device, 0x100200));
|
|
|
|
nvkm_wr32(device, NV10_PGRAPH_RDI_INDEX, 0x00EA0004);
|
|
|
|
nvkm_wr32(device, NV10_PGRAPH_RDI_DATA , nvkm_rd32(device, 0x100204));
|
|
|
|
nvkm_wr32(device, 0x400820, 0);
|
|
|
|
nvkm_wr32(device, 0x400824, 0);
|
|
|
|
nvkm_wr32(device, 0x400864, vramsz - 1);
|
|
|
|
nvkm_wr32(device, 0x400868, vramsz - 1);
|
2011-04-01 10:32:03 +08:00
|
|
|
|
2012-07-20 06:17:34 +08:00
|
|
|
/* interesting.. the below overwrites some of the tile setup above.. */
|
2015-08-20 12:54:10 +08:00
|
|
|
nvkm_wr32(device, 0x400B20, 0x00000000);
|
|
|
|
nvkm_wr32(device, 0x400B04, 0xFFFFFFFF);
|
2011-04-01 10:32:03 +08:00
|
|
|
|
2015-08-20 12:54:10 +08:00
|
|
|
nvkm_wr32(device, NV03_PGRAPH_ABS_UCLIP_XMIN, 0);
|
|
|
|
nvkm_wr32(device, NV03_PGRAPH_ABS_UCLIP_YMIN, 0);
|
|
|
|
nvkm_wr32(device, NV03_PGRAPH_ABS_UCLIP_XMAX, 0x7fff);
|
|
|
|
nvkm_wr32(device, NV03_PGRAPH_ABS_UCLIP_YMAX, 0x7fff);
|
2011-04-01 10:32:03 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2012-07-20 06:17:34 +08:00
|
|
|
|
2015-08-20 12:54:22 +08:00
|
|
|
void *
|
|
|
|
nv20_gr_dtor(struct nvkm_gr *base)
|
|
|
|
{
|
|
|
|
struct nv20_gr *gr = nv20_gr(base);
|
2017-11-01 01:56:19 +08:00
|
|
|
nvkm_memory_unref(&gr->ctxtab);
|
2015-08-20 12:54:22 +08:00
|
|
|
return gr;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
nv20_gr_new_(const struct nvkm_gr_func *func, struct nvkm_device *device,
|
|
|
|
int index, struct nvkm_gr **pgr)
|
|
|
|
{
|
|
|
|
struct nv20_gr *gr;
|
|
|
|
|
|
|
|
if (!(gr = kzalloc(sizeof(*gr), GFP_KERNEL)))
|
|
|
|
return -ENOMEM;
|
|
|
|
*pgr = &gr->base;
|
|
|
|
|
2016-04-08 15:24:40 +08:00
|
|
|
return nvkm_gr_ctor(func, device, index, true, &gr->base);
|
2015-08-20 12:54:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static const struct nvkm_gr_func
|
|
|
|
nv20_gr = {
|
|
|
|
.dtor = nv20_gr_dtor,
|
|
|
|
.oneinit = nv20_gr_oneinit,
|
|
|
|
.init = nv20_gr_init,
|
|
|
|
.intr = nv20_gr_intr,
|
|
|
|
.tile = nv20_gr_tile,
|
|
|
|
.chan_new = nv20_gr_chan_new,
|
|
|
|
.sclass = {
|
|
|
|
{ -1, -1, 0x0012, &nv04_gr_object }, /* beta1 */
|
|
|
|
{ -1, -1, 0x0019, &nv04_gr_object }, /* clip */
|
|
|
|
{ -1, -1, 0x0030, &nv04_gr_object }, /* null */
|
|
|
|
{ -1, -1, 0x0039, &nv04_gr_object }, /* m2mf */
|
|
|
|
{ -1, -1, 0x0043, &nv04_gr_object }, /* rop */
|
|
|
|
{ -1, -1, 0x0044, &nv04_gr_object }, /* patt */
|
|
|
|
{ -1, -1, 0x004a, &nv04_gr_object }, /* gdi */
|
|
|
|
{ -1, -1, 0x0062, &nv04_gr_object }, /* surf2d */
|
|
|
|
{ -1, -1, 0x0072, &nv04_gr_object }, /* beta4 */
|
|
|
|
{ -1, -1, 0x0089, &nv04_gr_object }, /* sifm */
|
|
|
|
{ -1, -1, 0x008a, &nv04_gr_object }, /* ifc */
|
|
|
|
{ -1, -1, 0x0096, &nv04_gr_object }, /* celcius */
|
|
|
|
{ -1, -1, 0x0097, &nv04_gr_object }, /* kelvin */
|
|
|
|
{ -1, -1, 0x009e, &nv04_gr_object }, /* swzsurf */
|
|
|
|
{ -1, -1, 0x009f, &nv04_gr_object }, /* imageblit */
|
|
|
|
{}
|
|
|
|
}
|
2012-07-20 06:17:34 +08:00
|
|
|
};
|
2015-08-20 12:54:22 +08:00
|
|
|
|
|
|
|
int
|
|
|
|
nv20_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr)
|
|
|
|
{
|
|
|
|
return nv20_gr_new_(&nv20_gr, device, index, pgr);
|
|
|
|
}
|