xref: /netbsd-src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mc/nouveau_nvkm_subdev_mc_gp10b.c (revision 7649e88fcfe6a7c92de68bd5e592dec3e35224fb)
1 /*	$NetBSD: nouveau_nvkm_subdev_mc_gp10b.c,v 1.3 2021/12/19 10:51:58 riastradh Exp $	*/
2 
3 /*
4  * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
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  */
25 
26 #include <sys/cdefs.h>
27 __KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_mc_gp10b.c,v 1.3 2021/12/19 10:51:58 riastradh Exp $");
28 
29 #include "priv.h"
30 
31 static void
gp10b_mc_init(struct nvkm_mc * mc)32 gp10b_mc_init(struct nvkm_mc *mc)
33 {
34 	struct nvkm_device *device = mc->subdev.device;
35 	nvkm_wr32(device, 0x000200, 0xffffffff); /* everything on */
36 	nvkm_wr32(device, 0x00020c, 0xffffffff); /* everything out of ELPG */
37 }
38 
39 static const struct nvkm_mc_func
40 gp10b_mc = {
41 	.init = gp10b_mc_init,
42 	.intr = gp100_mc_intr,
43 	.intr_unarm = gp100_mc_intr_unarm,
44 	.intr_rearm = gp100_mc_intr_rearm,
45 	.intr_mask = gp100_mc_intr_mask,
46 	.intr_stat = gf100_mc_intr_stat,
47 	.reset = gk104_mc_reset,
48 };
49 
50 int
gp10b_mc_new(struct nvkm_device * device,int index,struct nvkm_mc ** pmc)51 gp10b_mc_new(struct nvkm_device *device, int index, struct nvkm_mc **pmc)
52 {
53 	return gp100_mc_new_(&gp10b_mc, device, index, pmc);
54 }
55