1 #define NVOC_CRASHCAT_REPORT_H_PRIVATE_ACCESS_ALLOWED
2 #include "nvoc/runtime.h"
3 #include "nvoc/rtti.h"
4 #include "nvtypes.h"
5 #include "nvport/nvport.h"
6 #include "nvport/inline/util_valist.h"
7 #include "utils/nvassert.h"
8 #include "g_crashcat_report_nvoc.h"
9 
10 void __nvoc_init_halspec_CrashCatReportHal(CrashCatReportHal *pCrashCatReportHal, NV_CRASHCAT_PACKET_FORMAT_VERSION version, CrashCatImplementer implementer)
11 {
12     // V1_GENERIC
13     if(version == 0x1 && implementer == 0x0)
14     {
15         pCrashCatReportHal->__nvoc_HalVarIdx = 0;
16     }
17     // V1_LIBOS2
18     else if(version == 0x1 && implementer == 0x4C49424F53322E30)
19     {
20         pCrashCatReportHal->__nvoc_HalVarIdx = 1;
21     }
22     // V1_LIBOS3
23     else if(version == 0x1 && implementer == 0x4C49424F53332E31)
24     {
25         pCrashCatReportHal->__nvoc_HalVarIdx = 2;
26     }
27 }
28 
29 #ifdef DEBUG
30 char __nvoc_class_id_uniqueness_check_0xde4777 = 1;
31 #endif
32 
33 extern const struct NVOC_CLASS_DEF __nvoc_class_def_CrashCatReport;
34 
35 extern const struct NVOC_CLASS_DEF __nvoc_class_def_Object;
36 
37 void __nvoc_init_CrashCatReport(CrashCatReport*,
38         NV_CRASHCAT_PACKET_FORMAT_VERSION CrashCatReportHal_version, CrashCatImplementer CrashCatReportHal_implementer);
39 void __nvoc_init_funcTable_CrashCatReport(CrashCatReport*);
40 NV_STATUS __nvoc_ctor_CrashCatReport(CrashCatReport*, void ** arg_ppReportBytes, NvLength arg_bytesRemaining);
41 void __nvoc_init_dataField_CrashCatReport(CrashCatReport*);
42 void __nvoc_dtor_CrashCatReport(CrashCatReport*);
43 extern const struct NVOC_EXPORT_INFO __nvoc_export_info_CrashCatReport;
44 
45 static const struct NVOC_RTTI __nvoc_rtti_CrashCatReport_CrashCatReport = {
46     /*pClassDef=*/          &__nvoc_class_def_CrashCatReport,
47     /*dtor=*/               (NVOC_DYNAMIC_DTOR) &__nvoc_dtor_CrashCatReport,
48     /*offset=*/             0,
49 };
50 
51 static const struct NVOC_RTTI __nvoc_rtti_CrashCatReport_Object = {
52     /*pClassDef=*/          &__nvoc_class_def_Object,
53     /*dtor=*/               &__nvoc_destructFromBase,
54     /*offset=*/             NV_OFFSETOF(CrashCatReport, __nvoc_base_Object),
55 };
56 
57 static const struct NVOC_CASTINFO __nvoc_castinfo_CrashCatReport = {
58     /*numRelatives=*/       2,
59     /*relatives=*/ {
60         &__nvoc_rtti_CrashCatReport_CrashCatReport,
61         &__nvoc_rtti_CrashCatReport_Object,
62     },
63 };
64 
65 const struct NVOC_CLASS_DEF __nvoc_class_def_CrashCatReport =
66 {
67     /*classInfo=*/ {
68         /*size=*/               sizeof(CrashCatReport),
69         /*classId=*/            classId(CrashCatReport),
70         /*providerId=*/         &__nvoc_rtti_provider,
71 #if NV_PRINTF_STRINGS_ALLOWED
72         /*name=*/               "CrashCatReport",
73 #endif
74     },
75     /*objCreatefn=*/        (NVOC_DYNAMIC_OBJ_CREATE) &__nvoc_objCreateDynamic_CrashCatReport,
76     /*pCastInfo=*/          &__nvoc_castinfo_CrashCatReport,
77     /*pExportInfo=*/        &__nvoc_export_info_CrashCatReport
78 };
79 
80 const struct NVOC_EXPORT_INFO __nvoc_export_info_CrashCatReport =
81 {
82     /*numEntries=*/     0,
83     /*pExportEntries=*/  0
84 };
85 
86 void __nvoc_dtor_Object(Object*);
87 void __nvoc_dtor_CrashCatReport(CrashCatReport *pThis) {
88     __nvoc_crashcatReportDestruct(pThis);
89     __nvoc_dtor_Object(&pThis->__nvoc_base_Object);
90     PORT_UNREFERENCED_VARIABLE(pThis);
91 }
92 
93 void __nvoc_init_dataField_CrashCatReport(CrashCatReport *pThis) {
94     CrashCatReportHal *reportHal = &pThis->reportHal;
95     const unsigned long reportHal_HalVarIdx = (unsigned long)reportHal->__nvoc_HalVarIdx;
96     PORT_UNREFERENCED_VARIABLE(pThis);
97     PORT_UNREFERENCED_VARIABLE(reportHal);
98     PORT_UNREFERENCED_VARIABLE(reportHal_HalVarIdx);
99 }
100 
101 NV_STATUS __nvoc_ctor_Object(Object* );
102 NV_STATUS __nvoc_ctor_CrashCatReport(CrashCatReport *pThis, void ** arg_ppReportBytes, NvLength arg_bytesRemaining) {
103     NV_STATUS status = NV_OK;
104     status = __nvoc_ctor_Object(&pThis->__nvoc_base_Object);
105     if (status != NV_OK) goto __nvoc_ctor_CrashCatReport_fail_Object;
106     __nvoc_init_dataField_CrashCatReport(pThis);
107 
108     status = __nvoc_crashcatReportConstruct(pThis, arg_ppReportBytes, arg_bytesRemaining);
109     if (status != NV_OK) goto __nvoc_ctor_CrashCatReport_fail__init;
110     goto __nvoc_ctor_CrashCatReport_exit; // Success
111 
112 __nvoc_ctor_CrashCatReport_fail__init:
113     __nvoc_dtor_Object(&pThis->__nvoc_base_Object);
114 __nvoc_ctor_CrashCatReport_fail_Object:
115 __nvoc_ctor_CrashCatReport_exit:
116 
117     return status;
118 }
119 
120 static void __nvoc_init_funcTable_CrashCatReport_1(CrashCatReport *pThis) {
121     CrashCatReportHal *reportHal = &pThis->reportHal;
122     const unsigned long reportHal_HalVarIdx = (unsigned long)reportHal->__nvoc_HalVarIdx;
123     PORT_UNREFERENCED_VARIABLE(pThis);
124     PORT_UNREFERENCED_VARIABLE(reportHal);
125     PORT_UNREFERENCED_VARIABLE(reportHal_HalVarIdx);
126 
127     // Hal function -- crashcatReportLogReporter
128     if (( ((reportHal_HalVarIdx >> 5) == 0UL) && ((1UL << (reportHal_HalVarIdx & 0x1f)) & 0x00000002UL) )) /* CrashCatReportHal: V1_LIBOS2 */
129     {
130         pThis->__crashcatReportLogReporter__ = &crashcatReportLogReporter_V1_LIBOS2;
131     }
132     else if (( ((reportHal_HalVarIdx >> 5) == 0UL) && ((1UL << (reportHal_HalVarIdx & 0x1f)) & 0x00000004UL) )) /* CrashCatReportHal: V1_LIBOS3 */
133     {
134         pThis->__crashcatReportLogReporter__ = &crashcatReportLogReporter_V1_LIBOS3;
135     }
136     else
137     {
138         pThis->__crashcatReportLogReporter__ = &crashcatReportLogReporter_V1_GENERIC;
139     }
140 
141     // Hal function -- crashcatReportLogSource
142     if (( ((reportHal_HalVarIdx >> 5) == 0UL) && ((1UL << (reportHal_HalVarIdx & 0x1f)) & 0x00000002UL) )) /* CrashCatReportHal: V1_LIBOS2 */
143     {
144         pThis->__crashcatReportLogSource__ = &crashcatReportLogSource_V1_LIBOS2;
145     }
146     else if (( ((reportHal_HalVarIdx >> 5) == 0UL) && ((1UL << (reportHal_HalVarIdx & 0x1f)) & 0x00000004UL) )) /* CrashCatReportHal: V1_LIBOS3 */
147     {
148         pThis->__crashcatReportLogSource__ = &crashcatReportLogSource_V1_LIBOS3;
149     }
150     else
151     {
152         pThis->__crashcatReportLogSource__ = &crashcatReportLogSource_V1_GENERIC;
153     }
154 }
155 
156 void __nvoc_init_funcTable_CrashCatReport(CrashCatReport *pThis) {
157     __nvoc_init_funcTable_CrashCatReport_1(pThis);
158 }
159 
160 void __nvoc_init_Object(Object*);
161 void __nvoc_init_CrashCatReport(CrashCatReport *pThis,
162         NV_CRASHCAT_PACKET_FORMAT_VERSION CrashCatReportHal_version, CrashCatImplementer CrashCatReportHal_implementer) {
163     pThis->__nvoc_pbase_CrashCatReport = pThis;
164     pThis->__nvoc_pbase_Object = &pThis->__nvoc_base_Object;
165     __nvoc_init_Object(&pThis->__nvoc_base_Object);
166     __nvoc_init_halspec_CrashCatReportHal(&pThis->reportHal, CrashCatReportHal_version, CrashCatReportHal_implementer);
167     __nvoc_init_funcTable_CrashCatReport(pThis);
168 }
169 
170 NV_STATUS __nvoc_objCreate_CrashCatReport(CrashCatReport **ppThis, Dynamic *pParent, NvU32 createFlags,
171         NV_CRASHCAT_PACKET_FORMAT_VERSION CrashCatReportHal_version, CrashCatImplementer CrashCatReportHal_implementer, void ** arg_ppReportBytes, NvLength arg_bytesRemaining)
172 {
173     NV_STATUS status;
174     Object *pParentObj = NULL;
175     CrashCatReport *pThis;
176 
177     // Assign `pThis`, allocating memory unless suppressed by flag.
178     status = __nvoc_handleObjCreateMemAlloc(createFlags, sizeof(CrashCatReport), (void**)&pThis, (void**)ppThis);
179     if (status != NV_OK)
180         return status;
181 
182     // Zero is the initial value for everything.
183     portMemSet(pThis, 0, sizeof(CrashCatReport));
184 
185     // Initialize runtime type information.
186     __nvoc_initRtti(staticCast(pThis, Dynamic), &__nvoc_class_def_CrashCatReport);
187 
188     pThis->__nvoc_base_Object.createFlags = createFlags;
189 
190     // Link the child into the parent if there is one unless flagged not to do so.
191     if (pParent != NULL && !(createFlags & NVOC_OBJ_CREATE_FLAGS_PARENT_HALSPEC_ONLY))
192     {
193         pParentObj = dynamicCast(pParent, Object);
194         objAddChild(pParentObj, &pThis->__nvoc_base_Object);
195     }
196     else
197     {
198         pThis->__nvoc_base_Object.pParent = NULL;
199     }
200 
201     __nvoc_init_CrashCatReport(pThis, CrashCatReportHal_version, CrashCatReportHal_implementer);
202     status = __nvoc_ctor_CrashCatReport(pThis, arg_ppReportBytes, arg_bytesRemaining);
203     if (status != NV_OK) goto __nvoc_objCreate_CrashCatReport_cleanup;
204 
205     // Assignment has no effect if NVOC_OBJ_CREATE_FLAGS_IN_PLACE_CONSTRUCT is set.
206     *ppThis = pThis;
207 
208     return NV_OK;
209 
210 __nvoc_objCreate_CrashCatReport_cleanup:
211 
212     // Unlink the child from the parent if it was linked above.
213     if (pParentObj != NULL)
214         objRemoveChild(pParentObj, &pThis->__nvoc_base_Object);
215 
216     // Do not call destructors here since the constructor already called them.
217     if (createFlags & NVOC_OBJ_CREATE_FLAGS_IN_PLACE_CONSTRUCT)
218         portMemSet(pThis, 0, sizeof(CrashCatReport));
219     else
220     {
221         portMemFree(pThis);
222         *ppThis = NULL;
223     }
224 
225     // coverity[leaked_storage:FALSE]
226     return status;
227 }
228 
229 NV_STATUS __nvoc_objCreateDynamic_CrashCatReport(CrashCatReport **ppThis, Dynamic *pParent, NvU32 createFlags, va_list args) {
230     NV_STATUS status;
231     NV_CRASHCAT_PACKET_FORMAT_VERSION CrashCatReportHal_version = va_arg(args, NV_CRASHCAT_PACKET_FORMAT_VERSION);
232     CrashCatImplementer CrashCatReportHal_implementer = va_arg(args, CrashCatImplementer);
233     void ** arg_ppReportBytes = va_arg(args, void **);
234     NvLength arg_bytesRemaining = va_arg(args, NvLength);
235 
236     status = __nvoc_objCreate_CrashCatReport(ppThis, pParent, createFlags, CrashCatReportHal_version, CrashCatReportHal_implementer, arg_ppReportBytes, arg_bytesRemaining);
237 
238     return status;
239 }
240 
241