1*2541626cSBen Skeggs /*
2*2541626cSBen Skeggs  * Copyright 2022 Red Hat Inc.
3*2541626cSBen Skeggs  *
4*2541626cSBen Skeggs  * Permission is hereby granted, free of charge, to any person obtaining a
5*2541626cSBen Skeggs  * copy of this software and associated documentation files (the "Software"),
6*2541626cSBen Skeggs  * to deal in the Software without restriction, including without limitation
7*2541626cSBen Skeggs  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*2541626cSBen Skeggs  * and/or sell copies of the Software, and to permit persons to whom the
9*2541626cSBen Skeggs  * Software is furnished to do so, subject to the following conditions:
10*2541626cSBen Skeggs  *
11*2541626cSBen Skeggs  * The above copyright notice and this permission notice shall be included in
12*2541626cSBen Skeggs  * all copies or substantial portions of the Software.
13*2541626cSBen Skeggs  *
14*2541626cSBen Skeggs  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15*2541626cSBen Skeggs  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16*2541626cSBen Skeggs  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17*2541626cSBen Skeggs  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18*2541626cSBen Skeggs  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19*2541626cSBen Skeggs  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20*2541626cSBen Skeggs  * OTHER DEALINGS IN THE SOFTWARE.
21*2541626cSBen Skeggs  */
22*2541626cSBen Skeggs #include "priv.h"
23*2541626cSBen Skeggs 
24*2541626cSBen Skeggs MODULE_FIRMWARE("nvidia/gv100/acr/unload_bl.bin");
25*2541626cSBen Skeggs MODULE_FIRMWARE("nvidia/gv100/acr/ucode_unload.bin");
26*2541626cSBen Skeggs 
27*2541626cSBen Skeggs static const struct nvkm_acr_hsf_fwif
28*2541626cSBen Skeggs gv100_acr_unload_fwif[] = {
29*2541626cSBen Skeggs 	{ 0, gm200_acr_hsfw_ctor, &gp108_acr_hsfw_0, NVKM_ACR_HSF_PMU, 0, 0x00000000 },
30*2541626cSBen Skeggs 	{}
31*2541626cSBen Skeggs };
32*2541626cSBen Skeggs 
33*2541626cSBen Skeggs MODULE_FIRMWARE("nvidia/gv100/acr/bl.bin");
34*2541626cSBen Skeggs MODULE_FIRMWARE("nvidia/gv100/acr/ucode_load.bin");
35*2541626cSBen Skeggs 
36*2541626cSBen Skeggs static const struct nvkm_acr_hsf_fwif
37*2541626cSBen Skeggs gv100_acr_load_fwif[] = {
38*2541626cSBen Skeggs 	{ 0, gm200_acr_hsfw_ctor, &gp108_acr_load_0, NVKM_ACR_HSF_SEC2, 0, 0x00000010 },
39*2541626cSBen Skeggs 	{}
40*2541626cSBen Skeggs };
41*2541626cSBen Skeggs 
42*2541626cSBen Skeggs static const struct nvkm_acr_func
43*2541626cSBen Skeggs gv100_acr = {
44*2541626cSBen Skeggs 	.load = gv100_acr_load_fwif,
45*2541626cSBen Skeggs 	.unload = gv100_acr_unload_fwif,
46*2541626cSBen Skeggs 	.wpr_parse = gp102_acr_wpr_parse,
47*2541626cSBen Skeggs 	.wpr_layout = gp102_acr_wpr_layout,
48*2541626cSBen Skeggs 	.wpr_alloc = gp102_acr_wpr_alloc,
49*2541626cSBen Skeggs 	.wpr_build = gp102_acr_wpr_build,
50*2541626cSBen Skeggs 	.wpr_patch = gp102_acr_wpr_patch,
51*2541626cSBen Skeggs 	.wpr_check = gm200_acr_wpr_check,
52*2541626cSBen Skeggs 	.init = gm200_acr_init,
53*2541626cSBen Skeggs };
54*2541626cSBen Skeggs 
55*2541626cSBen Skeggs static const struct nvkm_acr_fwif
56*2541626cSBen Skeggs gv100_acr_fwif[] = {
57*2541626cSBen Skeggs 	{  0, gp102_acr_load, &gv100_acr },
58*2541626cSBen Skeggs 	{ -1, gm200_acr_nofw, &gm200_acr },
59*2541626cSBen Skeggs 	{}
60*2541626cSBen Skeggs };
61*2541626cSBen Skeggs 
62*2541626cSBen Skeggs int
gv100_acr_new(struct nvkm_device * device,enum nvkm_subdev_type type,int inst,struct nvkm_acr ** pacr)63*2541626cSBen Skeggs gv100_acr_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
64*2541626cSBen Skeggs 	      struct nvkm_acr **pacr)
65*2541626cSBen Skeggs {
66*2541626cSBen Skeggs 	return nvkm_acr_new_(gv100_acr_fwif, device, type, inst, pacr);
67*2541626cSBen Skeggs }
68