1253a03f0SBen Skeggs /*
2253a03f0SBen Skeggs  * Copyright 2016 Red Hat Inc.
3253a03f0SBen Skeggs  *
4253a03f0SBen Skeggs  * Permission is hereby granted, free of charge, to any person obtaining a
5253a03f0SBen Skeggs  * copy of this software and associated documentation files (the "Software"),
6253a03f0SBen Skeggs  * to deal in the Software without restriction, including without limitation
7253a03f0SBen Skeggs  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8253a03f0SBen Skeggs  * and/or sell copies of the Software, and to permit persons to whom the
9253a03f0SBen Skeggs  * Software is furnished to do so, subject to the following conditions:
10253a03f0SBen Skeggs  *
11253a03f0SBen Skeggs  * The above copyright notice and this permission notice shall be included in
12253a03f0SBen Skeggs  * all copies or substantial portions of the Software.
13253a03f0SBen Skeggs  *
14253a03f0SBen Skeggs  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15253a03f0SBen Skeggs  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16253a03f0SBen Skeggs  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17253a03f0SBen Skeggs  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18253a03f0SBen Skeggs  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19253a03f0SBen Skeggs  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20253a03f0SBen Skeggs  * OTHER DEALINGS IN THE SOFTWARE.
21253a03f0SBen Skeggs  *
22253a03f0SBen Skeggs  * Authors: Ben Skeggs
23253a03f0SBen Skeggs  */
24253a03f0SBen Skeggs #include "priv.h"
25253a03f0SBen Skeggs 
26253a03f0SBen Skeggs #include <nvif/class.h>
27253a03f0SBen Skeggs 
28253a03f0SBen Skeggs static const struct nvkm_engine_func
29253a03f0SBen Skeggs gm107_ce = {
30253a03f0SBen Skeggs 	.intr = gk104_ce_intr,
31253a03f0SBen Skeggs 	.sclass = {
32253a03f0SBen Skeggs 		{ -1, -1, KEPLER_DMA_COPY_A },
33253a03f0SBen Skeggs 		{ -1, -1, MAXWELL_DMA_COPY_A },
34253a03f0SBen Skeggs 		{}
35253a03f0SBen Skeggs 	}
36253a03f0SBen Skeggs };
37253a03f0SBen Skeggs 
38253a03f0SBen Skeggs int
39253a03f0SBen Skeggs gm107_ce_new(struct nvkm_device *device, int index,
40253a03f0SBen Skeggs 	     struct nvkm_engine **pengine)
41253a03f0SBen Skeggs {
42253a03f0SBen Skeggs 	if (index == NVKM_ENGINE_CE0) {
43253a03f0SBen Skeggs 		return nvkm_engine_new_(&gm107_ce, device, index,
44253a03f0SBen Skeggs 					0x00000040, true, pengine);
45253a03f0SBen Skeggs 	} else
46253a03f0SBen Skeggs 	if (index == NVKM_ENGINE_CE1) {
47253a03f0SBen Skeggs 		return nvkm_engine_new_(&gm107_ce, device, index,
48253a03f0SBen Skeggs 					0x00000080, true, pengine);
49253a03f0SBen Skeggs 	} else
50253a03f0SBen Skeggs 	if (index == NVKM_ENGINE_CE2) {
51253a03f0SBen Skeggs 		return nvkm_engine_new_(&gm107_ce, device, index,
52253a03f0SBen Skeggs 					0x00200000, true, pengine);
53253a03f0SBen Skeggs 	}
54253a03f0SBen Skeggs 	return -ENODEV;
55253a03f0SBen Skeggs }
56