Home | History | Annotate | Line # | Download | only in fifo
      1 /*	$NetBSD: nouveau_nvkm_engine_fifo_gm200.c,v 1.2 2021/12/18 23:45:35 riastradh Exp $	*/
      2 
      3 /*
      4  * Copyright 2015 Red Hat Inc.
      5  *
      6  * Permission is hereby granted, free of charge, to any person obtaining a
      7  * copy of this software and associated documentation files (the "Software"),
      8  * to deal in the Software without restriction, including without limitation
      9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     10  * and/or sell copies of the Software, and to permit persons to whom the
     11  * Software is furnished to do so, subject to the following conditions:
     12  *
     13  * The above copyright notice and this permission notice shall be included in
     14  * all copies or substantial portions of the Software.
     15  *
     16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     19  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
     20  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     22  * OTHER DEALINGS IN THE SOFTWARE.
     23  *
     24  * Authors: Ben Skeggs
     25  */
     26 #include <sys/cdefs.h>
     27 __KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_engine_fifo_gm200.c,v 1.2 2021/12/18 23:45:35 riastradh Exp $");
     28 
     29 #include "gk104.h"
     30 #include "changk104.h"
     31 
     32 #include <nvif/class.h>
     33 
     34 int
     35 gm200_fifo_pbdma_nr(struct gk104_fifo *fifo)
     36 {
     37 	struct nvkm_device *device = fifo->base.engine.subdev.device;
     38 	return nvkm_rd32(device, 0x002004) & 0x000000ff;
     39 }
     40 
     41 const struct gk104_fifo_pbdma_func
     42 gm200_fifo_pbdma = {
     43 	.nr = gm200_fifo_pbdma_nr,
     44 	.init = gk104_fifo_pbdma_init,
     45 	.init_timeout = gk208_fifo_pbdma_init_timeout,
     46 };
     47 
     48 static const struct gk104_fifo_func
     49 gm200_fifo = {
     50 	.intr.fault = gm107_fifo_intr_fault,
     51 	.pbdma = &gm200_fifo_pbdma,
     52 	.fault.access = gk104_fifo_fault_access,
     53 	.fault.engine = gm107_fifo_fault_engine,
     54 	.fault.reason = gk104_fifo_fault_reason,
     55 	.fault.hubclient = gk104_fifo_fault_hubclient,
     56 	.fault.gpcclient = gk104_fifo_fault_gpcclient,
     57 	.runlist = &gm107_fifo_runlist,
     58 	.chan = {{0,0,MAXWELL_CHANNEL_GPFIFO_A}, gk104_fifo_gpfifo_new },
     59 };
     60 
     61 int
     62 gm200_fifo_new(struct nvkm_device *device, int index, struct nvkm_fifo **pfifo)
     63 {
     64 	return gk104_fifo_new_(&gm200_fifo, device, index, 4096, pfifo);
     65 }
     66