17c4f87c9SBen Skeggs /*
27c4f87c9SBen Skeggs  * Copyright 2016 Red Hat Inc.
37c4f87c9SBen Skeggs  *
47c4f87c9SBen Skeggs  * Permission is hereby granted, free of charge, to any person obtaining a
57c4f87c9SBen Skeggs  * copy of this software and associated documentation files (the "Software"),
67c4f87c9SBen Skeggs  * to deal in the Software without restriction, including without limitation
77c4f87c9SBen Skeggs  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
87c4f87c9SBen Skeggs  * and/or sell copies of the Software, and to permit persons to whom the
97c4f87c9SBen Skeggs  * Software is furnished to do so, subject to the following conditions:
107c4f87c9SBen Skeggs  *
117c4f87c9SBen Skeggs  * The above copyright notice and this permission notice shall be included in
127c4f87c9SBen Skeggs  * all copies or substantial portions of the Software.
137c4f87c9SBen Skeggs  *
147c4f87c9SBen Skeggs  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
157c4f87c9SBen Skeggs  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
167c4f87c9SBen Skeggs  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
177c4f87c9SBen Skeggs  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
187c4f87c9SBen Skeggs  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
197c4f87c9SBen Skeggs  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
207c4f87c9SBen Skeggs  * OTHER DEALINGS IN THE SOFTWARE.
217c4f87c9SBen Skeggs  *
227c4f87c9SBen Skeggs  * Authors: Ben Skeggs
237c4f87c9SBen Skeggs  */
247c4f87c9SBen Skeggs #include "gk104.h"
257c4f87c9SBen Skeggs #include "changk104.h"
267c4f87c9SBen Skeggs 
270cdc3fdfSBen Skeggs const struct nvkm_enum
280cdc3fdfSBen Skeggs gm107_fifo_fault_engine[] = {
290cdc3fdfSBen Skeggs 	{ 0x01, "DISPLAY" },
300cdc3fdfSBen Skeggs 	{ 0x02, "CAPTURE" },
310cdc3fdfSBen Skeggs 	{ 0x03, "IFB", NULL, NVKM_ENGINE_IFB },
320cdc3fdfSBen Skeggs 	{ 0x04, "BAR1", NULL, NVKM_SUBDEV_BAR },
330cdc3fdfSBen Skeggs 	{ 0x05, "BAR2", NULL, NVKM_SUBDEV_INSTMEM },
340cdc3fdfSBen Skeggs 	{ 0x06, "SCHED" },
35ec884f74SBen Skeggs 	{ 0x07, "HOST0", NULL, NVKM_ENGINE_FIFO },
36ec884f74SBen Skeggs 	{ 0x08, "HOST1", NULL, NVKM_ENGINE_FIFO },
37ec884f74SBen Skeggs 	{ 0x09, "HOST2", NULL, NVKM_ENGINE_FIFO },
38ec884f74SBen Skeggs 	{ 0x0a, "HOST3", NULL, NVKM_ENGINE_FIFO },
39ec884f74SBen Skeggs 	{ 0x0b, "HOST4", NULL, NVKM_ENGINE_FIFO },
40ec884f74SBen Skeggs 	{ 0x0c, "HOST5", NULL, NVKM_ENGINE_FIFO },
41ec884f74SBen Skeggs 	{ 0x0d, "HOST6", NULL, NVKM_ENGINE_FIFO },
42ec884f74SBen Skeggs 	{ 0x0e, "HOST7", NULL, NVKM_ENGINE_FIFO },
430cdc3fdfSBen Skeggs 	{ 0x0f, "HOSTSR" },
440cdc3fdfSBen Skeggs 	{ 0x13, "PERF" },
450cdc3fdfSBen Skeggs 	{ 0x17, "PMU" },
460cdc3fdfSBen Skeggs 	{ 0x18, "PTP" },
470cdc3fdfSBen Skeggs 	{}
480cdc3fdfSBen Skeggs };
490cdc3fdfSBen Skeggs 
5098ac3f06SBen Skeggs static const struct gk104_fifo_func
517c4f87c9SBen Skeggs gm107_fifo = {
52ddc669e2SBen Skeggs 	.fault.access = gk104_fifo_fault_access,
530cdc3fdfSBen Skeggs 	.fault.engine = gm107_fifo_fault_engine,
5491419acfSBen Skeggs 	.fault.reason = gk104_fifo_fault_reason,
5591419acfSBen Skeggs 	.fault.hubclient = gk104_fifo_fault_hubclient,
5691419acfSBen Skeggs 	.fault.gpcclient = gk104_fifo_fault_gpcclient,
577c4f87c9SBen Skeggs 	.chan = {
587c4f87c9SBen Skeggs 		&gk110_fifo_gpfifo_oclass,
597c4f87c9SBen Skeggs 		NULL
607c4f87c9SBen Skeggs 	},
617c4f87c9SBen Skeggs };
627c4f87c9SBen Skeggs 
637c4f87c9SBen Skeggs int
647c4f87c9SBen Skeggs gm107_fifo_new(struct nvkm_device *device, int index, struct nvkm_fifo **pfifo)
657c4f87c9SBen Skeggs {
667c4f87c9SBen Skeggs 	return gk104_fifo_new_(&gm107_fifo, device, index, 2048, pfifo);
677c4f87c9SBen Skeggs }
68