1e3c71eb2SBen Skeggs /* 2e3c71eb2SBen Skeggs * Copyright 2010 Red Hat Inc. 3e3c71eb2SBen Skeggs * 4e3c71eb2SBen Skeggs * Permission is hereby granted, free of charge, to any person obtaining a 5e3c71eb2SBen Skeggs * copy of this software and associated documentation files (the "Software"), 6e3c71eb2SBen Skeggs * to deal in the Software without restriction, including without limitation 7e3c71eb2SBen Skeggs * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8e3c71eb2SBen Skeggs * and/or sell copies of the Software, and to permit persons to whom the 9e3c71eb2SBen Skeggs * Software is furnished to do so, subject to the following conditions: 10e3c71eb2SBen Skeggs * 11e3c71eb2SBen Skeggs * The above copyright notice and this permission notice shall be included in 12e3c71eb2SBen Skeggs * all copies or substantial portions of the Software. 13e3c71eb2SBen Skeggs * 14e3c71eb2SBen Skeggs * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15e3c71eb2SBen Skeggs * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16e3c71eb2SBen Skeggs * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17e3c71eb2SBen Skeggs * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18e3c71eb2SBen Skeggs * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19e3c71eb2SBen Skeggs * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20e3c71eb2SBen Skeggs * OTHER DEALINGS IN THE SOFTWARE. 21e3c71eb2SBen Skeggs * 22e3c71eb2SBen Skeggs * Authors: Ben Skeggs 23e3c71eb2SBen Skeggs */ 24c85ee6caSBen Skeggs #ifndef __GF100_GR_H__ 25c85ee6caSBen Skeggs #define __GF100_GR_H__ 2627f3d6cfSBen Skeggs #define gf100_gr(p) container_of((p), struct gf100_gr, base) 2727f3d6cfSBen Skeggs #include "priv.h" 28e3c71eb2SBen Skeggs 2927f3d6cfSBen Skeggs #include <core/gpuobj.h> 30e3c71eb2SBen Skeggs #include <subdev/ltc.h> 3127f3d6cfSBen Skeggs #include <subdev/mmu.h> 3289cd6e20SAlexandre Courbot #include <engine/falcon.h> 33e3c71eb2SBen Skeggs 3422dcda45SBen Skeggs struct nvkm_acr_lsfw; 3522dcda45SBen Skeggs 36e3c71eb2SBen Skeggs #define GPC_MAX 32 3706d4f26cSBen Skeggs #define TPC_MAX_PER_GPC 8 3806d4f26cSBen Skeggs #define TPC_MAX (GPC_MAX * TPC_MAX_PER_GPC) 39e3c71eb2SBen Skeggs 40e3c71eb2SBen Skeggs #define ROP_BCAST(r) (0x408800 + (r)) 41e3c71eb2SBen Skeggs #define ROP_UNIT(u, r) (0x410000 + (u) * 0x400 + (r)) 42e3c71eb2SBen Skeggs #define GPC_BCAST(r) (0x418000 + (r)) 43e3c71eb2SBen Skeggs #define GPC_UNIT(t, r) (0x500000 + (t) * 0x8000 + (r)) 44e3c71eb2SBen Skeggs #define PPC_UNIT(t, m, r) (0x503000 + (t) * 0x8000 + (m) * 0x200 + (r)) 45e3c71eb2SBen Skeggs #define TPC_UNIT(t, m, r) (0x504000 + (t) * 0x8000 + (m) * 0x800 + (r)) 46e3c71eb2SBen Skeggs 47e3c71eb2SBen Skeggs struct gf100_gr_zbc_color { 48e3c71eb2SBen Skeggs u32 format; 49e3c71eb2SBen Skeggs u32 ds[4]; 50e3c71eb2SBen Skeggs u32 l2[4]; 51e3c71eb2SBen Skeggs }; 52e3c71eb2SBen Skeggs 53e3c71eb2SBen Skeggs struct gf100_gr_zbc_depth { 54e3c71eb2SBen Skeggs u32 format; 55e3c71eb2SBen Skeggs u32 ds; 56e3c71eb2SBen Skeggs u32 l2; 57e3c71eb2SBen Skeggs }; 58e3c71eb2SBen Skeggs 594b2c71edSBen Skeggs struct gf100_gr_zbc_stencil { 604b2c71edSBen Skeggs u32 format; 614b2c71edSBen Skeggs u32 ds; 624b2c71edSBen Skeggs u32 l2; 634b2c71edSBen Skeggs }; 644b2c71edSBen Skeggs 65bfee3f3dSBen Skeggs struct gf100_gr { 6627f3d6cfSBen Skeggs const struct gf100_gr_func *func; 67c85ee6caSBen Skeggs struct nvkm_gr base; 68e3c71eb2SBen Skeggs 698e44b987SBen Skeggs struct { 704f556362SBen Skeggs struct nvkm_falcon falcon; 7100e1b5dcSBen Skeggs struct nvkm_blob inst; 7200e1b5dcSBen Skeggs struct nvkm_blob data; 7300e1b5dcSBen Skeggs 74169f30b3SBen Skeggs struct mutex mutex; 75169f30b3SBen Skeggs u32 disable; 768e44b987SBen Skeggs } fecs; 778e44b987SBen Skeggs 788e44b987SBen Skeggs struct { 794f556362SBen Skeggs struct nvkm_falcon falcon; 8000e1b5dcSBen Skeggs struct nvkm_blob inst; 8100e1b5dcSBen Skeggs struct nvkm_blob data; 828e44b987SBen Skeggs } gpccs; 838e44b987SBen Skeggs 84e3c71eb2SBen Skeggs bool firmware; 85e3c71eb2SBen Skeggs 86c4d0f8f6SAlexandre Courbot /* 87c4d0f8f6SAlexandre Courbot * Used if the register packs are loaded from NVIDIA fw instead of 88336c4652SAlexandre Courbot * using hardcoded arrays. To be allocated with vzalloc(). 89c4d0f8f6SAlexandre Courbot */ 900033f15bSBen Skeggs struct gf100_gr_pack *sw_nonctx; 91c4bdac75SBen Skeggs struct gf100_gr_pack *sw_nonctx1; 92c4bdac75SBen Skeggs struct gf100_gr_pack *sw_nonctx2; 93c4bdac75SBen Skeggs struct gf100_gr_pack *sw_nonctx3; 94c4bdac75SBen Skeggs struct gf100_gr_pack *sw_nonctx4; 950033f15bSBen Skeggs struct gf100_gr_pack *sw_ctx; 960033f15bSBen Skeggs struct gf100_gr_pack *bundle; 971cd97b54SBen Skeggs struct gf100_gr_pack *bundle_veid; 98c4d66f7dSBen Skeggs struct gf100_gr_pack *bundle64; 990033f15bSBen Skeggs struct gf100_gr_pack *method; 100c4d0f8f6SAlexandre Courbot 1014500031fSBen Skeggs struct gf100_gr_zbc_color zbc_color[NVKM_LTC_MAX_ZBC_COLOR_CNT]; 1024500031fSBen Skeggs struct gf100_gr_zbc_depth zbc_depth[NVKM_LTC_MAX_ZBC_DEPTH_CNT]; 1034500031fSBen Skeggs struct gf100_gr_zbc_stencil zbc_stencil[NVKM_LTC_MAX_ZBC_DEPTH_CNT]; 104e3c71eb2SBen Skeggs 105e3c71eb2SBen Skeggs u8 rop_nr; 106e3c71eb2SBen Skeggs u8 gpc_nr; 107e3c71eb2SBen Skeggs u8 tpc_nr[GPC_MAX]; 108fc740f54SBen Skeggs u8 tpc_max; 109e3c71eb2SBen Skeggs u8 tpc_total; 110e3c71eb2SBen Skeggs u8 ppc_nr[GPC_MAX]; 1112fb2b3c6SBen Skeggs u8 ppc_mask[GPC_MAX]; 11243952c6fSBen Skeggs u8 ppc_tpc_mask[GPC_MAX][4]; 113e3c71eb2SBen Skeggs u8 ppc_tpc_nr[GPC_MAX][4]; 11460770fa2SBen Skeggs u8 ppc_tpc_min; 1157a058a90SBen Skeggs u8 ppc_tpc_max; 1163ffa6f32SBen Skeggs u8 ppc_total; 117e3c71eb2SBen Skeggs 118d05095b5SBen Skeggs struct nvkm_memory *pagepool; 11995f78acdSBen Skeggs struct nvkm_memory *bundle_cb; 12078a43c7eSBen Skeggs struct nvkm_memory *attrib_cb; 1215eee9fddSBen Skeggs struct nvkm_memory *unknown; 122d05095b5SBen Skeggs 1235f6474a4SBen Skeggs u8 screen_tile_row_offset; 1245f6474a4SBen Skeggs u8 tile[TPC_MAX]; 1255f6474a4SBen Skeggs 126068cae74SBen Skeggs struct { 127068cae74SBen Skeggs u8 gpc; 128068cae74SBen Skeggs u8 tpc; 129068cae74SBen Skeggs } sm[TPC_MAX]; 130068cae74SBen Skeggs u8 sm_nr; 131068cae74SBen Skeggs 132e3c71eb2SBen Skeggs u32 size; 133e3c71eb2SBen Skeggs u32 *data; 1347d3f0688SBen Skeggs u32 size_zcull; 1358bf2d348SBen Skeggs u32 size_pm; 136e3c71eb2SBen Skeggs }; 137e3c71eb2SBen Skeggs 138b7f713b8SBen Skeggs int gf100_gr_fecs_bind_pointer(struct gf100_gr *, u32 inst); 1396762510bSBen Skeggs int gf100_gr_fecs_wfi_golden_save(struct gf100_gr *, u32 inst); 140b7f713b8SBen Skeggs 141e9d03335SBen Skeggs struct gf100_gr_func_zbc { 142e9d03335SBen Skeggs void (*clear_color)(struct gf100_gr *, int zbc); 143e9d03335SBen Skeggs void (*clear_depth)(struct gf100_gr *, int zbc); 1444b2c71edSBen Skeggs int (*stencil_get)(struct gf100_gr *, int format, 1454b2c71edSBen Skeggs const u32 ds, const u32 l2); 1464b2c71edSBen Skeggs void (*clear_stencil)(struct gf100_gr *, int zbc); 147e9d03335SBen Skeggs }; 148e9d03335SBen Skeggs 14927f3d6cfSBen Skeggs struct gf100_gr_func { 15055e1a599SBen Skeggs int (*nonstall)(struct gf100_gr *); 151c4bdac75SBen Skeggs struct nvkm_intr *(*oneinit_intr)(struct gf100_gr *, enum nvkm_intr_type *); 1525f6474a4SBen Skeggs void (*oneinit_tiles)(struct gf100_gr *); 1533ffa6f32SBen Skeggs int (*oneinit_sm_id)(struct gf100_gr *); 154c85ee6caSBen Skeggs int (*init)(struct gf100_gr *); 155d521097fSBen Skeggs void (*init_419bd8)(struct gf100_gr *); 156c85ee6caSBen Skeggs void (*init_gpc_mmu)(struct gf100_gr *); 1578b058ca5SBen Skeggs void (*init_r405a14)(struct gf100_gr *); 158a37279e9SBen Skeggs void (*init_bios)(struct gf100_gr *); 1592fe5ff63SBen Skeggs void (*init_vsc_stream_master)(struct gf100_gr *); 16002917aa3SBen Skeggs void (*init_zcull)(struct gf100_gr *); 161bfd27f39SBen Skeggs void (*init_num_active_ltcs)(struct gf100_gr *); 16287ac331eSBen Skeggs void (*init_rop_active_fbps)(struct gf100_gr *); 1630f78acc8SBen Skeggs void (*init_bios_2)(struct gf100_gr *); 164424321beSBen Skeggs void (*init_swdx_pes_mask)(struct gf100_gr *); 165afa3b96bSBen Skeggs void (*init_fs)(struct gf100_gr *); 1662585a1b1SBen Skeggs void (*init_fecs_exceptions)(struct gf100_gr *); 167c4bdac75SBen Skeggs void (*init_40a790)(struct gf100_gr *); 1683ac72e98SBen Skeggs void (*init_ds_hww_esr_2)(struct gf100_gr *); 1692b297b0dSBen Skeggs void (*init_40601c)(struct gf100_gr *); 1700a5b9730SBen Skeggs void (*init_sked_hww_esr)(struct gf100_gr *); 1710feab025SBen Skeggs void (*init_419cc0)(struct gf100_gr *); 1720a84a513SBen Skeggs void (*init_419eb4)(struct gf100_gr *); 173778f18c6SBen Skeggs void (*init_419c9c)(struct gf100_gr *); 174dff30dbdSBen Skeggs void (*init_ppc_exceptions)(struct gf100_gr *); 175f3ef80c0SBen Skeggs void (*init_tex_hww_esr)(struct gf100_gr *, int gpc, int tpc); 176ab4d49a3SBen Skeggs void (*init_504430)(struct gf100_gr *, int gpc, int tpc); 1774615e9b4SBen Skeggs void (*init_shader_exceptions)(struct gf100_gr *, int gpc, int tpc); 178b6d93fa7SBen Skeggs void (*init_rop_exceptions)(struct gf100_gr *); 1791a344688SBen Skeggs void (*init_exception2)(struct gf100_gr *); 18004547482SBen Skeggs void (*init_400054)(struct gf100_gr *); 181d521097fSBen Skeggs void (*init_4188a4)(struct gf100_gr *); 1825c05a589SBen Skeggs void (*trap_mp)(struct gf100_gr *, int gpc, int tpc); 183c85ee6caSBen Skeggs void (*set_hww_esr_report_mask)(struct gf100_gr *); 184c85ee6caSBen Skeggs const struct gf100_gr_pack *mmio; 185c85ee6caSBen Skeggs struct { 186c85ee6caSBen Skeggs struct gf100_gr_ucode *ucode; 187be99d041SBen Skeggs void (*reset)(struct gf100_gr *); 188c85ee6caSBen Skeggs } fecs; 189c85ee6caSBen Skeggs struct { 190c85ee6caSBen Skeggs struct gf100_gr_ucode *ucode; 191c4bdac75SBen Skeggs void (*reset)(struct gf100_gr *); 192c85ee6caSBen Skeggs } gpccs; 19364cb5a31SBen Skeggs int (*rops)(struct gf100_gr *); 194fc360764SBen Skeggs int gpc_nr; 195fc360764SBen Skeggs int tpc_nr; 196c85ee6caSBen Skeggs int ppc_nr; 19727f3d6cfSBen Skeggs const struct gf100_grctx_func *grctx; 1981bab09acSLyude Paul const struct nvkm_therm_clkgate_pack *clkgate_pack; 199e9d03335SBen Skeggs const struct gf100_gr_func_zbc *zbc; 20027f3d6cfSBen Skeggs struct nvkm_sclass sclass[]; 20127f3d6cfSBen Skeggs }; 20227f3d6cfSBen Skeggs 20364cb5a31SBen Skeggs int gf100_gr_rops(struct gf100_gr *); 2045f6474a4SBen Skeggs void gf100_gr_oneinit_tiles(struct gf100_gr *); 2053ffa6f32SBen Skeggs int gf100_gr_oneinit_sm_id(struct gf100_gr *); 2062fe5ff63SBen Skeggs int gf100_gr_init(struct gf100_gr *); 2072fe5ff63SBen Skeggs void gf100_gr_init_vsc_stream_master(struct gf100_gr *); 20802917aa3SBen Skeggs void gf100_gr_init_zcull(struct gf100_gr *); 209bfd27f39SBen Skeggs void gf100_gr_init_num_active_ltcs(struct gf100_gr *); 2102585a1b1SBen Skeggs void gf100_gr_init_fecs_exceptions(struct gf100_gr *); 2112b297b0dSBen Skeggs void gf100_gr_init_40601c(struct gf100_gr *); 2120feab025SBen Skeggs void gf100_gr_init_419cc0(struct gf100_gr *); 2130a84a513SBen Skeggs void gf100_gr_init_419eb4(struct gf100_gr *); 214f3ef80c0SBen Skeggs void gf100_gr_init_tex_hww_esr(struct gf100_gr *, int, int); 2154615e9b4SBen Skeggs void gf100_gr_init_shader_exceptions(struct gf100_gr *, int, int); 216b6d93fa7SBen Skeggs void gf100_gr_init_rop_exceptions(struct gf100_gr *); 2171a344688SBen Skeggs void gf100_gr_init_exception2(struct gf100_gr *); 21804547482SBen Skeggs void gf100_gr_init_400054(struct gf100_gr *); 2193c47e381SBen Skeggs void gf100_gr_init_num_tpc_per_gpc(struct gf100_gr *, bool, bool); 220e9d03335SBen Skeggs extern const struct gf100_gr_func_zbc gf100_gr_zbc; 221be99d041SBen Skeggs void gf100_gr_fecs_reset(struct gf100_gr *); 22202917aa3SBen Skeggs 22302917aa3SBen Skeggs void gf117_gr_init_zcull(struct gf100_gr *); 224c85ee6caSBen Skeggs 2252fe5ff63SBen Skeggs void gk104_gr_init_vsc_stream_master(struct gf100_gr *); 22687ac331eSBen Skeggs void gk104_gr_init_rop_active_fbps(struct gf100_gr *); 227a00ecf22SBen Skeggs void gk104_gr_init_ppc_exceptions(struct gf100_gr *); 2280a5b9730SBen Skeggs void gk104_gr_init_sked_hww_esr(struct gf100_gr *); 229c85ee6caSBen Skeggs 2300a84a513SBen Skeggs void gk110_gr_init_419eb4(struct gf100_gr *); 2310a84a513SBen Skeggs 232ab4d49a3SBen Skeggs void gm107_gr_init_504430(struct gf100_gr *, int, int); 2334615e9b4SBen Skeggs void gm107_gr_init_shader_exceptions(struct gf100_gr *, int, int); 23404547482SBen Skeggs void gm107_gr_init_400054(struct gf100_gr *); 235ab4d49a3SBen Skeggs 236c85ee6caSBen Skeggs int gk20a_gr_init(struct gf100_gr *); 2371cd97b54SBen Skeggs int gk20a_gr_av_to_init_(struct nvkm_blob *, u8 count, u32 pitch, struct gf100_gr_pack **); 238de8be616SBen Skeggs int gk20a_gr_av_to_init(struct nvkm_blob *, struct gf100_gr_pack **); 239de8be616SBen Skeggs int gk20a_gr_aiv_to_init(struct nvkm_blob *, struct gf100_gr_pack **); 240de8be616SBen Skeggs int gk20a_gr_av_to_method(struct nvkm_blob *, struct gf100_gr_pack **); 241c85ee6caSBen Skeggs 2425f6474a4SBen Skeggs void gm200_gr_oneinit_tiles(struct gf100_gr *); 2433ffa6f32SBen Skeggs int gm200_gr_oneinit_sm_id(struct gf100_gr *); 244734a0aa6SBen Skeggs int gm200_gr_rops(struct gf100_gr *); 245bfd27f39SBen Skeggs void gm200_gr_init_num_active_ltcs(struct gf100_gr *); 2463ac72e98SBen Skeggs void gm200_gr_init_ds_hww_esr_2(struct gf100_gr *); 247c85ee6caSBen Skeggs 248424321beSBen Skeggs void gp100_gr_init_rop_active_fbps(struct gf100_gr *); 2492585a1b1SBen Skeggs void gp100_gr_init_fecs_exceptions(struct gf100_gr *); 2504615e9b4SBen Skeggs void gp100_gr_init_shader_exceptions(struct gf100_gr *, int, int); 251e9d03335SBen Skeggs void gp100_gr_zbc_clear_color(struct gf100_gr *, int); 252e9d03335SBen Skeggs void gp100_gr_zbc_clear_depth(struct gf100_gr *, int); 25390e2e96eSThierry Reding extern const struct gf100_gr_func_zbc gp100_gr_zbc; 254424321beSBen Skeggs 255dff30dbdSBen Skeggs void gp102_gr_init_swdx_pes_mask(struct gf100_gr *); 2564b2c71edSBen Skeggs extern const struct gf100_gr_func_zbc gp102_gr_zbc; 257c4bdac75SBen Skeggs int gp102_gr_zbc_stencil_get(struct gf100_gr *, int, const u32, const u32); 258c4bdac75SBen Skeggs void gp102_gr_zbc_clear_stencil(struct gf100_gr *, int); 259dff30dbdSBen Skeggs 260a096ff19SBen Skeggs extern const struct gf100_gr_func gp107_gr; 261a096ff19SBen Skeggs 2623ffa6f32SBen Skeggs int gv100_gr_oneinit_sm_id(struct gf100_gr *); 2633ffa6f32SBen Skeggs u32 gv100_gr_nonpes_aware_tpc(struct gf100_gr *gr, u32 gpc, u32 tpc); 264afa3b96bSBen Skeggs void gv100_gr_init_419bd8(struct gf100_gr *); 265afa3b96bSBen Skeggs void gv100_gr_init_504430(struct gf100_gr *, int, int); 266afa3b96bSBen Skeggs void gv100_gr_init_shader_exceptions(struct gf100_gr *, int, int); 2676a2b09e7SBen Skeggs void gv100_gr_init_4188a4(struct gf100_gr *); 268afa3b96bSBen Skeggs void gv100_gr_trap_mp(struct gf100_gr *, int, int); 269afa3b96bSBen Skeggs 2701cd97b54SBen Skeggs int tu102_gr_av_to_init_veid(struct nvkm_blob *, struct gf100_gr_pack **); 271c4bdac75SBen Skeggs void tu102_gr_init_zcull(struct gf100_gr *); 272c4bdac75SBen Skeggs void tu102_gr_init_fs(struct gf100_gr *); 273c4bdac75SBen Skeggs void tu102_gr_init_fecs_exceptions(struct gf100_gr *); 2741cd97b54SBen Skeggs 27527f3d6cfSBen Skeggs #define gf100_gr_chan(p) container_of((p), struct gf100_gr_chan, object) 2764246b92cSBen Skeggs #include <core/object.h> 27727f3d6cfSBen Skeggs 278e3c71eb2SBen Skeggs struct gf100_gr_chan { 27927f3d6cfSBen Skeggs struct nvkm_object object; 28027f3d6cfSBen Skeggs struct gf100_gr *gr; 281019e4d76SBen Skeggs struct nvkm_vmm *vmm; 282e3c71eb2SBen Skeggs 283d05095b5SBen Skeggs struct nvkm_vma *pagepool; 28495f78acdSBen Skeggs struct nvkm_vma *bundle_cb; 28578a43c7eSBen Skeggs struct nvkm_vma *attrib_cb; 2865eee9fddSBen Skeggs struct nvkm_vma *unknown; 287d05095b5SBen Skeggs 288227c95d9SBen Skeggs struct nvkm_memory *mmio; 289019e4d76SBen Skeggs struct nvkm_vma *mmio_vma; 290e3c71eb2SBen Skeggs int mmio_nr; 291e3c71eb2SBen Skeggs }; 292e3c71eb2SBen Skeggs 293bfee3f3dSBen Skeggs void gf100_gr_ctxctl_debug(struct gf100_gr *); 294e3c71eb2SBen Skeggs 295e3c71eb2SBen Skeggs u64 gf100_gr_units(struct nvkm_gr *); 296bfee3f3dSBen Skeggs void gf100_gr_zbc_init(struct gf100_gr *); 297e3c71eb2SBen Skeggs 29827f3d6cfSBen Skeggs extern const struct nvkm_object_func gf100_fermi; 299e3c71eb2SBen Skeggs 300e3c71eb2SBen Skeggs struct gf100_gr_init { 301e3c71eb2SBen Skeggs u32 addr; 302e3c71eb2SBen Skeggs u8 count; 303d521097fSBen Skeggs u32 pitch; 304c4d66f7dSBen Skeggs u64 data; 305e3c71eb2SBen Skeggs }; 306e3c71eb2SBen Skeggs 307e3c71eb2SBen Skeggs struct gf100_gr_pack { 308e3c71eb2SBen Skeggs const struct gf100_gr_init *init; 309e3c71eb2SBen Skeggs u32 type; 310e3c71eb2SBen Skeggs }; 311e3c71eb2SBen Skeggs 312e3c71eb2SBen Skeggs #define pack_for_each_init(init, pack, head) \ 313e3c71eb2SBen Skeggs for (pack = head; pack && pack->init; pack++) \ 314e3c71eb2SBen Skeggs for (init = pack->init; init && init->count; init++) 315e3c71eb2SBen Skeggs 316e3c71eb2SBen Skeggs struct gf100_gr_ucode { 3176f0add0aSBen Skeggs struct nvkm_blob code; 3186f0add0aSBen Skeggs struct nvkm_blob data; 319e3c71eb2SBen Skeggs }; 320e3c71eb2SBen Skeggs 321e3c71eb2SBen Skeggs extern struct gf100_gr_ucode gf100_gr_fecs_ucode; 322e3c71eb2SBen Skeggs extern struct gf100_gr_ucode gf100_gr_gpccs_ucode; 323e3c71eb2SBen Skeggs 324e3c71eb2SBen Skeggs extern struct gf100_gr_ucode gk110_gr_fecs_ucode; 325e3c71eb2SBen Skeggs extern struct gf100_gr_ucode gk110_gr_gpccs_ucode; 326e3c71eb2SBen Skeggs 327bfee3f3dSBen Skeggs int gf100_gr_wait_idle(struct gf100_gr *); 328bfee3f3dSBen Skeggs void gf100_gr_mmio(struct gf100_gr *, const struct gf100_gr_pack *); 329bfee3f3dSBen Skeggs void gf100_gr_icmd(struct gf100_gr *, const struct gf100_gr_pack *); 330bfee3f3dSBen Skeggs void gf100_gr_mthd(struct gf100_gr *, const struct gf100_gr_pack *); 331bfee3f3dSBen Skeggs int gf100_gr_init_ctxctl(struct gf100_gr *); 332e3c71eb2SBen Skeggs 333e3c71eb2SBen Skeggs /* register init value lists */ 334e3c71eb2SBen Skeggs 335e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf100_gr_init_main_0[]; 336e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf100_gr_init_fe_0[]; 337e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf100_gr_init_pri_0[]; 338e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf100_gr_init_rstr2d_0[]; 339e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf100_gr_init_pd_0[]; 340e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf100_gr_init_ds_0[]; 341e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf100_gr_init_scc_0[]; 342e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf100_gr_init_prop_0[]; 343e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf100_gr_init_gpc_unk_0[]; 344e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf100_gr_init_setup_0[]; 345e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf100_gr_init_crstr_0[]; 346e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf100_gr_init_setup_1[]; 347e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf100_gr_init_zcull_0[]; 348e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf100_gr_init_gpm_0[]; 349e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf100_gr_init_gpc_unk_1[]; 350e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf100_gr_init_gcc_0[]; 351e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf100_gr_init_tpccs_0[]; 352e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf100_gr_init_tex_0[]; 353e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf100_gr_init_pe_0[]; 354e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf100_gr_init_l1c_0[]; 355e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf100_gr_init_wwdx_0[]; 356e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf100_gr_init_tpccs_1[]; 357e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf100_gr_init_mpc_0[]; 358e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf100_gr_init_be_0[]; 359e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf100_gr_init_fe_1[]; 360e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf100_gr_init_pe_1[]; 361223eaf4bSBen Skeggs void gf100_gr_init_gpc_mmu(struct gf100_gr *); 3625c05a589SBen Skeggs void gf100_gr_trap_mp(struct gf100_gr *, int, int); 363d521097fSBen Skeggs extern const struct nvkm_bitfield gf100_mp_global_error[]; 364d521097fSBen Skeggs extern const struct nvkm_enum gf100_mp_warp_error[]; 365e3c71eb2SBen Skeggs 366e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf104_gr_init_ds_0[]; 367e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf104_gr_init_tex_0[]; 368e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf104_gr_init_sm_0[]; 369e3c71eb2SBen Skeggs 370e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf108_gr_init_gpc_unk_0[]; 371e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf108_gr_init_setup_1[]; 372e3c71eb2SBen Skeggs 373e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf119_gr_init_pd_0[]; 374e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf119_gr_init_ds_0[]; 375e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf119_gr_init_prop_0[]; 376e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf119_gr_init_gpm_0[]; 377e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf119_gr_init_gpc_unk_1[]; 378e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf119_gr_init_tex_0[]; 379e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf119_gr_init_sm_0[]; 380e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf119_gr_init_fe_1[]; 381e3c71eb2SBen Skeggs 382e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf117_gr_init_pes_0[]; 383e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf117_gr_init_wwdx_0[]; 384e3c71eb2SBen Skeggs extern const struct gf100_gr_init gf117_gr_init_cbm_0[]; 385e3c71eb2SBen Skeggs 386e3c71eb2SBen Skeggs extern const struct gf100_gr_init gk104_gr_init_main_0[]; 387191e3232SBen Skeggs extern const struct gf100_gr_init gk104_gr_init_gpc_unk_2[]; 388e3c71eb2SBen Skeggs extern const struct gf100_gr_init gk104_gr_init_tpccs_0[]; 389e3c71eb2SBen Skeggs extern const struct gf100_gr_init gk104_gr_init_pe_0[]; 390e3c71eb2SBen Skeggs extern const struct gf100_gr_init gk104_gr_init_be_0[]; 391e3c71eb2SBen Skeggs extern const struct gf100_gr_pack gk104_gr_pack_mmio[]; 392e3c71eb2SBen Skeggs 393e3c71eb2SBen Skeggs extern const struct gf100_gr_init gk110_gr_init_fe_0[]; 394e3c71eb2SBen Skeggs extern const struct gf100_gr_init gk110_gr_init_ds_0[]; 395e3c71eb2SBen Skeggs extern const struct gf100_gr_init gk110_gr_init_sked_0[]; 396e3c71eb2SBen Skeggs extern const struct gf100_gr_init gk110_gr_init_cwd_0[]; 397e3c71eb2SBen Skeggs extern const struct gf100_gr_init gk110_gr_init_gpc_unk_1[]; 398e3c71eb2SBen Skeggs extern const struct gf100_gr_init gk110_gr_init_tex_0[]; 399e3c71eb2SBen Skeggs extern const struct gf100_gr_init gk110_gr_init_sm_0[]; 400e3c71eb2SBen Skeggs 401e3c71eb2SBen Skeggs extern const struct gf100_gr_init gk208_gr_init_gpc_unk_0[]; 4023fed3ea9SBen Skeggs 4033fed3ea9SBen Skeggs extern const struct gf100_gr_init gm107_gr_init_scc_0[]; 4043fed3ea9SBen Skeggs extern const struct gf100_gr_init gm107_gr_init_prop_0[]; 4053fed3ea9SBen Skeggs extern const struct gf100_gr_init gm107_gr_init_setup_1[]; 4063fed3ea9SBen Skeggs extern const struct gf100_gr_init gm107_gr_init_zcull_0[]; 4073fed3ea9SBen Skeggs extern const struct gf100_gr_init gm107_gr_init_gpc_unk_1[]; 4083fed3ea9SBen Skeggs extern const struct gf100_gr_init gm107_gr_init_tex_0[]; 4093fed3ea9SBen Skeggs extern const struct gf100_gr_init gm107_gr_init_l1c_0[]; 4103fed3ea9SBen Skeggs extern const struct gf100_gr_init gm107_gr_init_wwdx_0[]; 4113fed3ea9SBen Skeggs extern const struct gf100_gr_init gm107_gr_init_cbm_0[]; 412bfee3f3dSBen Skeggs void gm107_gr_init_bios(struct gf100_gr *); 41352fa0866SBen Skeggs 41452fa0866SBen Skeggs void gm200_gr_init_gpc_mmu(struct gf100_gr *); 415ef16dc27SBen Skeggs 416ef16dc27SBen Skeggs struct gf100_gr_fwif { 417ef16dc27SBen Skeggs int version; 418ef16dc27SBen Skeggs int (*load)(struct gf100_gr *, int ver, const struct gf100_gr_fwif *); 419ef16dc27SBen Skeggs const struct gf100_gr_func *func; 420ef16dc27SBen Skeggs const struct nvkm_acr_lsf_func *fecs; 421ef16dc27SBen Skeggs const struct nvkm_acr_lsf_func *gpccs; 422ef16dc27SBen Skeggs }; 423ef16dc27SBen Skeggs 424ef16dc27SBen Skeggs int gf100_gr_load(struct gf100_gr *, int, const struct gf100_gr_fwif *); 425ef16dc27SBen Skeggs int gf100_gr_nofw(struct gf100_gr *, int, const struct gf100_gr_fwif *); 426ef16dc27SBen Skeggs 427ef16dc27SBen Skeggs int gk20a_gr_load_sw(struct gf100_gr *, const char *path, int ver); 428de8be616SBen Skeggs int gk20a_gr_load_net(struct gf100_gr *, const char *, const char *, int, 429de8be616SBen Skeggs int (*)(struct nvkm_blob *, struct gf100_gr_pack **), 430de8be616SBen Skeggs struct gf100_gr_pack **); 431ef16dc27SBen Skeggs 432b9c246adSBen Skeggs int gm200_gr_nofw(struct gf100_gr *, int, const struct gf100_gr_fwif *); 433ef16dc27SBen Skeggs int gm200_gr_load(struct gf100_gr *, int, const struct gf100_gr_fwif *); 434ef16dc27SBen Skeggs extern const struct nvkm_acr_lsf_func gm200_gr_gpccs_acr; 435ef16dc27SBen Skeggs extern const struct nvkm_acr_lsf_func gm200_gr_fecs_acr; 436ef16dc27SBen Skeggs 437ef16dc27SBen Skeggs extern const struct nvkm_acr_lsf_func gm20b_gr_fecs_acr; 43822dcda45SBen Skeggs void gm20b_gr_acr_bld_write(struct nvkm_acr *, u32, struct nvkm_acr_lsfw *); 43922dcda45SBen Skeggs void gm20b_gr_acr_bld_patch(struct nvkm_acr *, u32, s64); 440ef16dc27SBen Skeggs 441ef16dc27SBen Skeggs extern const struct nvkm_acr_lsf_func gp108_gr_gpccs_acr; 442ef16dc27SBen Skeggs extern const struct nvkm_acr_lsf_func gp108_gr_fecs_acr; 443c4bdac75SBen Skeggs void gp108_gr_acr_bld_write(struct nvkm_acr *, u32, struct nvkm_acr_lsfw *); 444c4bdac75SBen Skeggs void gp108_gr_acr_bld_patch(struct nvkm_acr *, u32, s64); 445ef16dc27SBen Skeggs 446864d37c3SBen Skeggs int gf100_gr_new_(const struct gf100_gr_fwif *, struct nvkm_device *, enum nvkm_subdev_type, int, 447ef16dc27SBen Skeggs struct nvkm_gr **); 448*361c3cd8SBen Skeggs int r535_gr_new(const struct gf100_gr_func *, struct nvkm_device *, enum nvkm_subdev_type, int, 449*361c3cd8SBen Skeggs struct nvkm_gr **); 450e3c71eb2SBen Skeggs #endif 451