Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright 2016 Red Hat Inc.
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice shall be included in
0012  * all copies or substantial portions of the Software.
0013  *
0014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0017  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
0018  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0020  * OTHER DEALINGS IN THE SOFTWARE.
0021  *
0022  * Authors: Ben Skeggs
0023  */
0024 #include "priv.h"
0025 
0026 void
0027 gp100_ltc_intr(struct nvkm_ltc *ltc)
0028 {
0029     struct nvkm_device *device = ltc->subdev.device;
0030     u32 mask;
0031 
0032     mask = nvkm_rd32(device, 0x0001c0);
0033     while (mask) {
0034         u32 s, c = __ffs(mask);
0035         for (s = 0; s < ltc->lts_nr; s++)
0036             gm107_ltc_intr_lts(ltc, c, s);
0037         mask &= ~(1 << c);
0038     }
0039 }
0040 
0041 int
0042 gp100_ltc_oneinit(struct nvkm_ltc *ltc)
0043 {
0044     struct nvkm_device *device = ltc->subdev.device;
0045     ltc->ltc_nr = nvkm_rd32(device, 0x12006c);
0046     ltc->lts_nr = nvkm_rd32(device, 0x17e280) >> 28;
0047     /*XXX: tagram allocation - TBD */
0048     return 0;
0049 }
0050 
0051 void
0052 gp100_ltc_init(struct nvkm_ltc *ltc)
0053 {
0054     /*XXX: PMU LS call to setup tagram address */
0055 }
0056 
0057 static const struct nvkm_ltc_func
0058 gp100_ltc = {
0059     .oneinit = gp100_ltc_oneinit,
0060     .init = gp100_ltc_init,
0061     .intr = gp100_ltc_intr,
0062     .cbc_clear = gm107_ltc_cbc_clear,
0063     .cbc_wait = gm107_ltc_cbc_wait,
0064     .zbc = 16,
0065     .zbc_clear_color = gm107_ltc_zbc_clear_color,
0066     .zbc_clear_depth = gm107_ltc_zbc_clear_depth,
0067     .invalidate = gf100_ltc_invalidate,
0068     .flush = gf100_ltc_flush,
0069 };
0070 
0071 int
0072 gp100_ltc_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
0073           struct nvkm_ltc **pltc)
0074 {
0075     return nvkm_ltc_new_(&gp100_ltc, device, type, inst, pltc);
0076 }