summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/boardobj/boardobj.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/boardobj/boardobj.h')
-rw-r--r--drivers/gpu/nvgpu/boardobj/boardobj.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/boardobj/boardobj.h b/drivers/gpu/nvgpu/boardobj/boardobj.h
new file mode 100644
index 00000000..3d437a82
--- /dev/null
+++ b/drivers/gpu/nvgpu/boardobj/boardobj.h
@@ -0,0 +1,83 @@
1/*
2* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3*
4* This program is free software; you can redistribute it and/or modify it
5* under the terms and conditions of the GNU General Public License,
6* version 2, as published by the Free Software Foundation.
7*
8* This program is distributed in the hope it will be useful, but WITHOUT
9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11* more details.
12*/
13
14#ifndef _BOARDOBJ_H_
15#define _BOARDOBJ_H_
16
17struct boardobj;
18
19#include <linux/nvgpu.h>
20#include "gk20a/gk20a.h"
21#include "gk20a/pmu_gk20a.h"
22#include "ctrl/ctrlboardobj.h"
23#include "pmuif/gpmuifboardobj.h"
24
25/*
26* check whether the specified BOARDOBJ object implements the queried
27* type/class enumeration.
28*/
29typedef bool boardobj_implements(struct gk20a *g, struct boardobj *pboardobj,
30 u8 type);
31
32/*
33* Fills out the appropriate the nv_pmu_xxxx_device_desc_<xyz> driver->PMU
34* description structure, describing this BOARDOBJ board device to the PMU.
35*
36*/
37typedef u32 boardobj_pmudatainit(struct gk20a *g, struct boardobj *pboardobj,
38 struct nv_pmu_boardobj *pmudata);
39
40/*
41* Constructor for the base Board Object. Called by each device-specific
42* implementation of the BOARDOBJ interface to initialize the board object.
43*/
44typedef u32 boardobj_construct(struct gk20a *g, struct boardobj **pboardobj,
45 u16 size, void *args);
46
47/*
48* Destructor for the base board object. Called by each device-Specific
49* implementation of the BOARDOBJ interface to destroy the board object.
50* This has to be explicitly set by each device that extends from the
51* board object.
52*/
53typedef u32 boardobj_destruct(struct boardobj *pboardobj);
54
55/*
56* Base Class for all physical or logical device on the PCB.
57* Contains fields common to all devices on the board. Specific types of
58* devices may extend this object adding any details specific to that
59* device or device-type.
60*/
61
62struct boardobj {
63 u8 type; /*type of the device*/
64 u8 idx; /*index of boardobj within in its group*/
65 u32 type_mask; /*mask of types this boardobjimplements*/
66 boardobj_implements *implements;
67 boardobj_destruct *destruct;
68 /*
69 * Access interface apis which will be overridden by the devices
70 * that inherit from BOARDOBJ
71 */
72 boardobj_pmudatainit *pmudatainit;
73};
74
75boardobj_construct boardobj_construct_super;
76boardobj_destruct boardobj_destruct_super;
77boardobj_implements boardobj_implements_super;
78boardobj_pmudatainit boardobj_pmudatainit_super;
79
80#define BOARDOBJ_GET_TYPE(pobj) (((struct boardobj *)(pobj))->type)
81#define BOARDOBJ_GET_IDX(pobj) (((struct boardobj *)(pobj))->idx)
82
83#endif