Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright 2021 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 #include <nvif/conn.h>
0023 #include <nvif/disp.h>
0024 #include <nvif/printf.h>
0025 
0026 #include <nvif/class.h>
0027 #include <nvif/if0011.h>
0028 
0029 int
0030 nvif_conn_hpd_status(struct nvif_conn *conn)
0031 {
0032     struct nvif_conn_hpd_status_v0 args;
0033     int ret;
0034 
0035     args.version = 0;
0036 
0037     ret = nvif_mthd(&conn->object, NVIF_CONN_V0_HPD_STATUS, &args, sizeof(args));
0038     NVIF_ERRON(ret, &conn->object, "[HPD_STATUS] support:%d present:%d",
0039            args.support, args.present);
0040     return ret ? ret : !!args.support + !!args.present;
0041 }
0042 
0043 void
0044 nvif_conn_dtor(struct nvif_conn *conn)
0045 {
0046     nvif_object_dtor(&conn->object);
0047 }
0048 
0049 int
0050 nvif_conn_ctor(struct nvif_disp *disp, const char *name, int id, struct nvif_conn *conn)
0051 {
0052     struct nvif_conn_v0 args;
0053     int ret;
0054 
0055     args.version = 0;
0056     args.id = id;
0057 
0058     ret = nvif_object_ctor(&disp->object, name ?: "nvifConn", id, NVIF_CLASS_CONN,
0059                    &args, sizeof(args), &conn->object);
0060     NVIF_ERRON(ret, &disp->object, "[NEW conn id:%d]", id);
0061     return ret;
0062 }