xref: /openbmc/linux/drivers/gpu/drm/nouveau/nvif/outp.c (revision 1b255f1ccc883256e23db279ea164273ea0f7462)
1*1b255f1cSBen Skeggs /*
2*1b255f1cSBen Skeggs  * Copyright 2021 Red Hat Inc.
3*1b255f1cSBen Skeggs  *
4*1b255f1cSBen Skeggs  * Permission is hereby granted, free of charge, to any person obtaining a
5*1b255f1cSBen Skeggs  * copy of this software and associated documentation files (the "Software"),
6*1b255f1cSBen Skeggs  * to deal in the Software without restriction, including without limitation
7*1b255f1cSBen Skeggs  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*1b255f1cSBen Skeggs  * and/or sell copies of the Software, and to permit persons to whom the
9*1b255f1cSBen Skeggs  * Software is furnished to do so, subject to the following conditions:
10*1b255f1cSBen Skeggs  *
11*1b255f1cSBen Skeggs  * The above copyright notice and this permission notice shall be included in
12*1b255f1cSBen Skeggs  * all copies or substantial portions of the Software.
13*1b255f1cSBen Skeggs  *
14*1b255f1cSBen Skeggs  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15*1b255f1cSBen Skeggs  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16*1b255f1cSBen Skeggs  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17*1b255f1cSBen Skeggs  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18*1b255f1cSBen Skeggs  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19*1b255f1cSBen Skeggs  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20*1b255f1cSBen Skeggs  * OTHER DEALINGS IN THE SOFTWARE.
21*1b255f1cSBen Skeggs  */
22*1b255f1cSBen Skeggs #include <nvif/outp.h>
23*1b255f1cSBen Skeggs #include <nvif/disp.h>
24*1b255f1cSBen Skeggs #include <nvif/printf.h>
25*1b255f1cSBen Skeggs 
26*1b255f1cSBen Skeggs #include <nvif/class.h>
27*1b255f1cSBen Skeggs #include <nvif/if0012.h>
28*1b255f1cSBen Skeggs 
29*1b255f1cSBen Skeggs void
30*1b255f1cSBen Skeggs nvif_outp_dtor(struct nvif_outp *outp)
31*1b255f1cSBen Skeggs {
32*1b255f1cSBen Skeggs 	nvif_object_dtor(&outp->object);
33*1b255f1cSBen Skeggs }
34*1b255f1cSBen Skeggs 
35*1b255f1cSBen Skeggs int
36*1b255f1cSBen Skeggs nvif_outp_ctor(struct nvif_disp *disp, const char *name, int id, struct nvif_outp *outp)
37*1b255f1cSBen Skeggs {
38*1b255f1cSBen Skeggs 	struct nvif_outp_v0 args;
39*1b255f1cSBen Skeggs 	int ret;
40*1b255f1cSBen Skeggs 
41*1b255f1cSBen Skeggs 	args.version = 0;
42*1b255f1cSBen Skeggs 	args.id = id;
43*1b255f1cSBen Skeggs 
44*1b255f1cSBen Skeggs 	ret = nvif_object_ctor(&disp->object, name ?: "nvifOutp", id, NVIF_CLASS_OUTP,
45*1b255f1cSBen Skeggs 			       &args, sizeof(args), &outp->object);
46*1b255f1cSBen Skeggs 	NVIF_ERRON(ret, &disp->object, "[NEW outp id:%d]", id);
47*1b255f1cSBen Skeggs 	return ret;
48*1b255f1cSBen Skeggs }
49