1 /* 2 * Copyright 2015 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 #include "gk104.h" 25 #include "changk104.h" 26 27 #include <nvif/class.h> 28 29 int 30 gm200_fifo_runq_nr(struct nvkm_fifo *fifo) 31 { 32 return nvkm_rd32(fifo->engine.subdev.device, 0x002004) & 0x000000ff; 33 } 34 35 int 36 gm200_fifo_chid_nr(struct nvkm_fifo *fifo) 37 { 38 return nvkm_rd32(fifo->engine.subdev.device, 0x002008); 39 } 40 41 static const struct nvkm_fifo_func 42 gm200_fifo = { 43 .dtor = gk104_fifo_dtor, 44 .oneinit = gk104_fifo_oneinit, 45 .chid_nr = gm200_fifo_chid_nr, 46 .chid_ctor = gk110_fifo_chid_ctor, 47 .runq_nr = gm200_fifo_runq_nr, 48 .runl_ctor = gk104_fifo_runl_ctor, 49 .init = gk104_fifo_init, 50 .init_pbdmas = gk104_fifo_init_pbdmas, 51 .intr = gk104_fifo_intr, 52 .intr_mmu_fault_unit = gm107_fifo_intr_mmu_fault_unit, 53 .intr_ctxsw_timeout = gf100_fifo_intr_ctxsw_timeout, 54 .mmu_fault = &gm107_fifo_mmu_fault, 55 .engine_id = gk104_fifo_engine_id, 56 .runlist = &gm107_fifo_runlist, 57 .nonstall = &gf100_fifo_nonstall, 58 .runl = &gm107_runl, 59 .runq = &gk208_runq, 60 .engn = &gk104_engn, 61 .engn_ce = &gk104_engn_ce, 62 .cgrp = {{ 0, 0, KEPLER_CHANNEL_GROUP_A }, &gk110_cgrp }, 63 .chan = {{ 0, 0, MAXWELL_CHANNEL_GPFIFO_A }, &gm107_chan, .ctor = &gk104_fifo_gpfifo_new }, 64 }; 65 66 int 67 gm200_fifo_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, 68 struct nvkm_fifo **pfifo) 69 { 70 return gk104_fifo_new_(&gm200_fifo, device, type, inst, 0, pfifo); 71 } 72