1 #ifndef _G_INTR_SERVICE_NVOC_H_
2 #define _G_INTR_SERVICE_NVOC_H_
3 #include "nvoc/runtime.h"
4 
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8 
9 /*
10  * SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
11  * SPDX-License-Identifier: MIT
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a
14  * copy of this software and associated documentation files (the "Software"),
15  * to deal in the Software without restriction, including without limitation
16  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17  * and/or sell copies of the Software, and to permit persons to whom the
18  * Software is furnished to do so, subject to the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be included in
21  * all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29  * DEALINGS IN THE SOFTWARE.
30  */
31 
32 #include "g_intr_service_nvoc.h"
33 
34 #ifndef INTR_SERVICE_H
35 #define INTR_SERVICE_H
36 
37 /*!
38  * @brief  Provides definitions for IntrService class,
39  * which is an interface for classes which can handle interrupts.
40  */
41 
42 #include "core/core.h"
43 #include "core/thread_state.h"
44 #include "gpu/gpu.h"
45 #include "kernel/gpu/intr/engine_idx.h"
46 
47 struct IntrService;
48 
49 #ifndef __NVOC_CLASS_IntrService_TYPEDEF__
50 #define __NVOC_CLASS_IntrService_TYPEDEF__
51 typedef struct IntrService IntrService;
52 #endif /* __NVOC_CLASS_IntrService_TYPEDEF__ */
53 
54 #ifndef __nvoc_class_id_IntrService
55 #define __nvoc_class_id_IntrService 0x2271cc
56 #endif /* __nvoc_class_id_IntrService */
57 
58 
59 
60 typedef struct {
61     struct IntrService *pInterruptService;
62     struct IntrService *pNotificationService;
63     NvBool bFifoWaiveNotify;
64 } IntrServiceRecord;
65 
66 typedef struct {
67     NvU16 engineIdx;
68 } IntrServiceClearInterruptArguments;
69 
70 typedef struct {
71     NvU16 engineIdx;
72 } IntrServiceServiceInterruptArguments;
73 
74 typedef struct {
75     THREAD_STATE_NODE *pThreadState;
76     NvU16              engineIdx;
77 } IntrServiceServiceNotificationInterruptArguments;
78 
79 #ifdef NVOC_INTR_SERVICE_H_PRIVATE_ACCESS_ALLOWED
80 #define PRIVATE_FIELD(x) x
81 #else
82 #define PRIVATE_FIELD(x) NVOC_PRIVATE_FIELD(x)
83 #endif
84 struct IntrService {
85     const struct NVOC_RTTI *__nvoc_rtti;
86     struct IntrService *__nvoc_pbase_IntrService;
87     void (*__intrservRegisterIntrService__)(struct OBJGPU *, struct IntrService *, IntrServiceRecord *);
88     NvBool (*__intrservClearInterrupt__)(struct OBJGPU *, struct IntrService *, IntrServiceClearInterruptArguments *);
89     NvU32 (*__intrservServiceInterrupt__)(struct OBJGPU *, struct IntrService *, IntrServiceServiceInterruptArguments *);
90     NV_STATUS (*__intrservServiceNotificationInterrupt__)(struct OBJGPU *, struct IntrService *, IntrServiceServiceNotificationInterruptArguments *);
91 };
92 
93 #ifndef __NVOC_CLASS_IntrService_TYPEDEF__
94 #define __NVOC_CLASS_IntrService_TYPEDEF__
95 typedef struct IntrService IntrService;
96 #endif /* __NVOC_CLASS_IntrService_TYPEDEF__ */
97 
98 #ifndef __nvoc_class_id_IntrService
99 #define __nvoc_class_id_IntrService 0x2271cc
100 #endif /* __nvoc_class_id_IntrService */
101 
102 extern const struct NVOC_CLASS_DEF __nvoc_class_def_IntrService;
103 
104 #define __staticCast_IntrService(pThis) \
105     ((pThis)->__nvoc_pbase_IntrService)
106 
107 #ifdef __nvoc_intr_service_h_disabled
108 #define __dynamicCast_IntrService(pThis) ((IntrService*)NULL)
109 #else //__nvoc_intr_service_h_disabled
110 #define __dynamicCast_IntrService(pThis) \
111     ((IntrService*)__nvoc_dynamicCast(staticCast((pThis), Dynamic), classInfo(IntrService)))
112 #endif //__nvoc_intr_service_h_disabled
113 
114 
115 NV_STATUS __nvoc_objCreateDynamic_IntrService(IntrService**, Dynamic*, NvU32, va_list);
116 
117 NV_STATUS __nvoc_objCreate_IntrService(IntrService**, Dynamic*, NvU32);
118 #define __objCreate_IntrService(ppNewObj, pParent, createFlags) \
119     __nvoc_objCreate_IntrService((ppNewObj), staticCast((pParent), Dynamic), (createFlags))
120 
121 #define intrservRegisterIntrService(pGpu, pIntrService, pRecords) intrservRegisterIntrService_DISPATCH(pGpu, pIntrService, pRecords)
122 #define intrservClearInterrupt(pGpu, pIntrService, pParams) intrservClearInterrupt_DISPATCH(pGpu, pIntrService, pParams)
123 #define intrservServiceInterrupt(pGpu, pIntrService, pParams) intrservServiceInterrupt_DISPATCH(pGpu, pIntrService, pParams)
124 #define intrservServiceNotificationInterrupt(pGpu, pIntrService, pParams) intrservServiceNotificationInterrupt_DISPATCH(pGpu, pIntrService, pParams)
125 void intrservRegisterIntrService_IMPL(struct OBJGPU *pGpu, struct IntrService *pIntrService, IntrServiceRecord pRecords[166]);
126 
127 static inline void intrservRegisterIntrService_DISPATCH(struct OBJGPU *pGpu, struct IntrService *pIntrService, IntrServiceRecord pRecords[166]) {
128     pIntrService->__intrservRegisterIntrService__(pGpu, pIntrService, pRecords);
129 }
130 
131 NvBool intrservClearInterrupt_IMPL(struct OBJGPU *pGpu, struct IntrService *pIntrService, IntrServiceClearInterruptArguments *pParams);
132 
133 static inline NvBool intrservClearInterrupt_DISPATCH(struct OBJGPU *pGpu, struct IntrService *pIntrService, IntrServiceClearInterruptArguments *pParams) {
134     return pIntrService->__intrservClearInterrupt__(pGpu, pIntrService, pParams);
135 }
136 
137 NvU32 intrservServiceInterrupt_IMPL(struct OBJGPU *pGpu, struct IntrService *pIntrService, IntrServiceServiceInterruptArguments *pParams);
138 
139 static inline NvU32 intrservServiceInterrupt_DISPATCH(struct OBJGPU *pGpu, struct IntrService *pIntrService, IntrServiceServiceInterruptArguments *pParams) {
140     return pIntrService->__intrservServiceInterrupt__(pGpu, pIntrService, pParams);
141 }
142 
143 NV_STATUS intrservServiceNotificationInterrupt_IMPL(struct OBJGPU *pGpu, struct IntrService *pIntrService, IntrServiceServiceNotificationInterruptArguments *pParams);
144 
145 static inline NV_STATUS intrservServiceNotificationInterrupt_DISPATCH(struct OBJGPU *pGpu, struct IntrService *pIntrService, IntrServiceServiceNotificationInterruptArguments *pParams) {
146     return pIntrService->__intrservServiceNotificationInterrupt__(pGpu, pIntrService, pParams);
147 }
148 
149 #undef PRIVATE_FIELD
150 
151 
152 #endif // INTR_SERVICE_H
153 
154 #ifdef __cplusplus
155 } // extern "C"
156 #endif
157 #endif // _G_INTR_SERVICE_NVOC_H_
158