summaryrefslogtreecommitdiffstats
path: root/include/linux/platform/tegra
diff options
context:
space:
mode:
authorMantravadi Karthik <mkarthik@nvidia.com>2021-06-10 04:44:50 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2021-07-01 18:54:13 -0400
commit4f6bc7b5a7fe5ceb1a7200e5752746a63eb0bb31 (patch)
treed46cbd9dfc53c9c9c1e97fb6b7f787955be0f137 /include/linux/platform/tegra
parent975d3589b81ea7704447e6e74a8e1aa64dd55729 (diff)
tegra: safety: Phase notification command
Why? SCE HB working starts with Init done phase notification from CCPLEX. How? The init done phase notification is scheduled at the end of safety-ivc drver probe as all the necessary items for l1ss are initialized by then. Bug 200700400 Change-Id: I18cb66b2cbe6c3184c9c23c9b7ee6f6c53f62c06 Signed-off-by: Mantravadi Karthik <mkarthik@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2542621 Reviewed-by: Preetham Chandru <pchandru@nvidia.com> Reviewed-by: Bibek Basu <bbasu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'include/linux/platform/tegra')
-rw-r--r--include/linux/platform/tegra/l1ss_datatypes.h457
1 files changed, 457 insertions, 0 deletions
diff --git a/include/linux/platform/tegra/l1ss_datatypes.h b/include/linux/platform/tegra/l1ss_datatypes.h
new file mode 100644
index 000000000..feb786331
--- /dev/null
+++ b/include/linux/platform/tegra/l1ss_datatypes.h
@@ -0,0 +1,457 @@
1/*
2 * Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved.
3 *
4 * NVIDIA CORPORATION and its licensors retain all intellectual property
5 * and proprietary rights in and to this software, related documentation
6 * and any modifications thereto. Any use, reproduction, disclosure or
7 * distribution of this software and related documentation without an express
8 * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 */
10
11/**
12 * @file NvGuard_InterfaceDataTypes.h
13 * @brief <b> NvGuard interface data types header file </b>
14 *
15 * Application/driver interface with L0SS
16 */
17
18#ifndef NVGUARD_INTERFACEDATATYPES_H
19#define NVGUARD_INTERFACEDATATYPES_H
20
21/* ==================[inclusions]============================================ */
22
23/**
24 * <!-- Doxygen Group - DO NOT REMOVE -->
25 * @defgroup nvguard_interface_datatypes NvGuard Interface Data Types
26 *
27 * Defines data types for NvGuard interface.
28 *
29 * @ingroup nvguard_api_top
30 * @{
31 */
32
33/* ==================[macros]================================================ */
34/* Error status values of type 'NvGuard_ErrStatus_t' */
35/** Defines the default error status when test for fault is not executed.
36 */
37#define NVGUARD_ERROR_UNDETERMINED (0x00U)
38/** Defines the error status when fault is confirmed at source, and is not fixed.
39 */
40#define NVGUARD_ERROR_DETECTED (0xAAU)
41/** Defines the error status when the test function does not encounter a fault,
42 * or when a pre-existing fault is fixed.
43 */
44#define NVGUARD_NO_ERROR (0x55U)
45
46/* NvGuard operation identifiers.
47 * Error code for service error callback(ErrCallbackPtr) function
48 * to indicate failed operation
49 */
50/** Defines a register operation.
51 */
52#define NVGUARD_OPERATION_REGISTER (0U)
53/** Defines an enable operation.
54 */
55#define NVGUARD_OPERATION_ENABLE (1U)
56/** Defines a disable operation.
57 */
58#define NVGUARD_OPERATION_DISABLE (2U)
59/** Defines an error/service status report operation.
60 */
61#define NVGUARD_OPERATION_REPORT (3U)
62
63/* 3LSS error messages of type 'NvGuard_3LSSError_t'.
64 * Argument for 'InternalError_Notification' callback
65 * in 3LSS notification config structure
66 */
67/** Denotes 3LSS internal error.
68 */
69#define NVGUARD_3LSSERR_3LSSINTERNAL (0U)
70
71/* Tegra phase values of type 'NvGuard_TegraPhase_t'.
72 * Argument for 'Phase_Notification' callback in 3LSS notification config
73 * structure. 3LSS framework maintains and synchronizes execution phases
74 * to orchestrate safe startup and safe shutdown across different layers.
75 * A client will receive notification for all phase transitions if
76 * callback is configured using 'NvGuard_Register3LSSNotification' API
77 */
78/** Defines Tegra phase during 3LSS initialization.
79 */
80#define NVGUARD_TEGRA_PHASE_INIT (0U)
81/** Defines Tegra phase when 3LSS initialization is completed.
82 */
83#define NVGUARD_TEGRA_PHASE_INITDONE (2U)
84/** Defines Tegra phase in which periodic tests are triggered.
85 */
86#define NVGUARD_TEGRA_PHASE_RUN (4U)
87/** Defines Tegra phase when 3LSS de-registers all clients.
88 */
89#define NVGUARD_TEGRA_PHASE_PRESHUTDOWN (6U)
90/** Defines Tegra phase after Tegra shutdown request to system manager.
91 */
92#define NVGUARD_TEGRA_PHASE_SHUTDOWN (8U)
93
94/* Tegra FuSa state values of type 'NvGuard_FuSaState_t'.
95 * FuSa(Functional Safety) state indicates health of the SOC with respect to
96 * safety critical errors
97 */
98/** Defines the FuSa state during initialization.
99 */
100#define NVGUARD_TEGRA_FUSASTATE_INIT (0U)
101/** Defines the FuSa state when no error is reported to 3LSS.
102 */
103#define NVGUARD_TEGRA_FUSASTATE_NOERROR (1U)
104/** Defines the FuSa state when an error is reported to 3LSS.
105 */
106#define NVGUARD_TEGRA_FUSASTATE_ERROR (2U)
107
108/* Supplementary notification of type 'NvGuard_SupplementaryNotification_t'.
109 * Argument for supplementary notification callback registered by Drive OS user
110 */
111/** Defines a change in the FuSa state.
112 */
113#define NVGUARD_SUPPNOTIF_FUSASTATE_CHANGE (0U)
114/** Defines the availability of user data to be read.
115 */
116#define NVGUARD_SUPPNOTIF_USERMSG_READY (1U)
117
118/** Defines the maximum length of user message, in bytes.
119 */
120#define NVGUARD_USERDATA_MAXLEN (56U)
121
122/** Defines the Service Id registration length for the asynchronous call.
123 */
124#define NVGUARD_SRV_REG_LIST_LEN_ASYNC (29U)
125
126/* =================NvGuard_LibDataTypes.h Macros =========================== */
127
128/** Service Id registration status length for synchronous call
129 */
130#define NVGUARD_SRV_REG_LIST_LEN_SYNC (31U)
131
132/** Length of service list
133 */
134#define NVGUARD_SRV_LIST_LEN (20U)
135/** Number of reserved bytes in service status structure
136 */
137#define RESERVED_BYTES (10U)
138/** Maximum lenght of error information, in bytes, in service status structure
139 */
140#define NVGUARD_ERRINFO_LEN (180U)
141/** Length of group list
142 */
143#define NVGUARD_GRP_LIST_LEN (12U)
144/** Number of groups in state packet structure. MUST BE GREATER THAN 0
145 */
146#define NVGUARD_GROUPSTATEPKT_DATACOUNT (24U)
147
148
149/** NvGuard service classes
150 */
151/** Denotes HSM errors
152 */
153#define NVGUARD_SERVICECLASS_HSM_ERROR (0U)
154/** Denotes software errors
155 */
156#define NVGUARD_SERVICECLASS_SW_ERROR (1U)
157/** Denotes diagnostic tests
158 */
159#define NVGUARD_SERVICECLASS_DIAG_TEST (2U)
160
161
162/* Masks and shift values to extract relevant information from a service identifier
163 */
164/** Bit mask to extract group index from service identifier
165 */
166#define NVGUARD_SRVID_GROUPINDEX_MASK (0xFFC00U)
167/** Bit position of group index in service identifier
168 */
169#define NVGUARD_SRVID_GROUPINDEX_SHIFT (10U)
170/** Bit mask to extract error index from service identifier
171 */
172#define NVGUARD_SRVID_INDEX_MASK (0x1FFU)
173/** Bit position of error index in service identifier
174 */
175#define NVGUARD_SRVID_INDEX_SHIFT (0U)
176/** Bit mask to extract error collator access bit from service identifier
177 */
178#define NVGUARD_SRVID_ECACCESS_MASK (0x200U)
179/** Bit position of error collator access bit in service identifier
180 */
181#define NVGUARD_SRVID_ECACCESS_SHIFT (9U)
182/** Bit mask to extract error class from service identifier
183 */
184#define NVGUARD_SRVID_CLASS_MASK (0xF00000U)
185/** Bit position of error class in service identifier
186 */
187#define NVGUARD_SRVID_CLASS_SHIFT (20U)
188/** Bit mask to extract layer from service identifier
189 */
190#define NVGUARD_SRVID_LAYER_MASK (0x0F000000U)
191/** Bit position of layer in service identifier
192 */
193#define NVGUARD_SRVID_LAYER_SHIFT (24U)
194
195
196/* Masks and shift values to extract relevant information from a 32 bit client message
197 */
198/** Bit mask to extract service identifier from client message
199 */
200#define NVGUARD_CLIENTMSG_SRVID_MASK (0xFFFFFFFU)
201/** Bit position of service identifier in client message
202 */
203#define NVGUARD_CLIENTMSG_SRVID_SHIFT (0U)
204/** Bit mask to extract service command from client message
205 */
206#define NVGUARD_CLIENTMSG_SRVCMD_MASK (0xF0000000U)
207/** Bit position of service command in client message
208 */
209#define NVGUARD_CLIENTMSG_SRVCMD_SHIFT (28U)
210/** Bit mask to extract notification parameter from error ID
211 */
212#define NVGUARD_CLIENTMSG_NOTIFICATION_MASK (0xFFU)
213/** Bit position of notification parameter in error ID
214 */
215#define NVGUARD_CLIENTMSG_NOTIFICATION_SHIFT (0U)
216
217
218/* Masks and shift values to extract relevant information from a group identifier
219 */
220/** Bit mask to extract group index from group identifier
221 */
222#define NVGUARD_GRPID_INDEX_MASK (0x3FFU)
223/** Bit position of group index in group identifier
224 */
225#define NVGUARD_GRPID_INDEX_SHIFT (0U)
226/** Bit mask to extract layer from group identifier
227 */
228#define NVGUARD_GRPID_LAYER_MASK (0x3C00U)
229/** Bit position of layer in group identifier
230 */
231#define NVGUARD_GRPID_LAYER_SHIFT (10U)
232
233/** Client operation values
234 */
235#define NVGUARD_CONNECTION_INIT (0x10U)
236#define NVGUARD_CONNECTION_DEINIT (0x20U)
237#define NVGUARD_REGSITER_SERVICE NVGUARD_OPERATION_REGISTER
238#define NVGUARD_DEREGSITER_SERVICE (0x30U)
239#define NVGUARD_ENABLE_SERVICE NVGUARD_OPERATION_ENABLE
240#define NVGUARD_DISABLE_SERVICE NVGUARD_OPERATION_DISABLE
241#define NVGUARD_REPORT_STATUS NVGUARD_OPERATION_REPORT
242#define NVGUARD_REGISTER_NOTIFICATION (0x40U)
243#define NVGUARD_DEREGISTER_NOTIFICATION (0x50U)
244#define NVGUARD_SERVICE_OVERRIDE (0x60U)
245#define NVGUARD_REQUEST_SERVICE (0x05U)
246#define NVGUARD_REQUEST_PHASECHANGE (0x70U)
247#define NVGAURD_SEC_CONFIG (0x80U)
248#ifdef NVGUARD_ENABLE_ERR_INJ
249#define NVGUARD_ERROR_INJECTION (0x06U)
250#endif /* NVGUARD_ENABLE_ERR_INJ endif*/
251#define NVGUARD_USER_MESG (0x07U)
252#define NVGUARD_PHASE_NOTIFICATION (0x08U)
253#define NVGUARD_FUSA_NOTIFICATION (0x09U)
254#define NVGUARD_SERVICESTATUS_NOTIFICATION (0x0AU)
255#define NVGUARD_GROUPSTATE_NOTIFICATION (0x0BU)
256#define NVGUARD_EXECUTE_SERVICEHANDLER (0x0CU)
257#define NVGUARD_READ_SERVICEHANDLERSTATUS (0x0DU)
258#define NVGUARD_ASYNC_SRVSTATUS (0x0EU)
259#define NVGUARD_READ_SERVICEINFO (0x90U)
260#define NVGUARD_READ_TESTSTATUS (0xA0U)
261#define NVGUARD_READ_DIAGPERIOD (0xB0U)
262#define NVGUARD_SYNC_SRVSTATUS (0xC0U)
263#define NVGUARD_REPORT_INTERNALERROR (0XFFU)
264#define NVGUARD_READ_USERMSG (0x71U)
265#define NVGUARD_SEND_ISTMSG (0x72U)
266#define NVGUARD_NOTIFY_ISTMSG (0x73U)
267#define NVGUARD_READ_ISTMSG (0x74U)
268#define NVGUARD_UPDATE_MISSIONPARAM (0x75U)
269#define NVGUARD_REGISTER_IST (0x76U)
270#define NVGUARD_READ_SRVSTATUS (0xE1U)
271#define NVGUARD_INTERNAL_ERROR (0xFFU)
272
273/* ================ NvGuard_Global.h Macros ================================= */
274#define NVGUARD_LAYER_0_RM_SERVER (11U)
275#define NVGUARD_LAYER_0_VSC (10U)
276#define NVGUARD_LAYER_0_OTA (9U)
277#define NVGUARD_LAYER_0_SECURITY (8U)
278#define NVGUARD_LAYER_0_COMMS (7U)
279#define NVGUARD_LAYER_0_IX_SERVCICE (6U)
280#define NVGUARD_LAYER_0_GOS (5U)
281#define NVGUARD_LAYER_0_SAFETY_SRV (4U)
282#define NVGUARD_LAYER_3 (3U)
283#define NVGUARD_LAYER_2 (2U)
284#define NVGUARD_LAYER_1 (1U)
285#define NVGUARD_LAYER_INVALID (0U)
286
287#define GUESTOS_LAYERID_BASE (4U)
288
289#define NVGUARD_MAX_LAYERID (11U)
290
291/** Enable/disable test application
292 */
293#define NVGUARD_TESTAPP_EN 0x00
294
295
296/* =================[type definitions]======================================= */
297/*
298 * Attributes associated with a service identifier
299 */
300
301typedef struct {
302 nv_guard_service_id_t SrvId;
303 uint8_t isEnabled;
304 uint8_t isDriveOSApp;
305 uint8_t Reserved[2];
306} nv_guard_srv_attributes_t;
307
308/*
309 * List of service identifiers
310 */
311typedef struct {
312 uint8_t num_srv;
313 uint8_t reserved[3];
314 nv_guard_srv_attributes_t srv_list[NVGUARD_SRV_LIST_LEN];
315} nv_guard_srv_list_t;
316
317#pragma pack(push, 1)
318/*
319 * Status associated with a service identifier
320 */
321typedef struct {
322 nv_guard_service_id_t srv_id;
323 uint8_t status;
324 uint64_t timestamp;
325 uint8_t reserved[RESERVED_BYTES];
326 uint8_t error_info_size;
327 uint8_t error_info[NVGUARD_ERRINFO_LEN];
328} nv_guard_srv_status_t;
329#pragma pack(pop)
330
331/*
332 * List of group identifiers
333 */
334typedef struct {
335 uint8_t num_grp;
336 uint8_t reserved[3];
337 nv_guard_group_id_t grp_list[NVGUARD_GRP_LIST_LEN];
338} nv_guard_grp_list_t;
339
340/*
341 * Identifies a client
342 */
343typedef uint32_t nv_guard_client_id_t;
344
345/*
346 * Identifies a client operation
347 */
348typedef uint32_t nv_guard_cmd_t;
349
350/*
351 * Error class, extracted from service identifier.
352 * Distinguishes HSM error, SW error and diagnostic test
353 */
354typedef uint8_t NvGuard_ErrClass_t;
355
356/*
357 * 3LSS layer where a service/group belong to. Extracted from
358 * service identifier/group identifier
359 */
360typedef uint32_t nv_guard_3lss_layer_t;
361
362/*
363 * Group index extracted from group identifier
364 */
365typedef uint32_t NvGuard_GroupIndex_t;
366
367/*
368 * Data structure to communicate error collator configuration requests
369 */
370typedef struct {
371 nv_guard_service_id_t srv_list[NVGUARD_SRV_LIST_LEN];
372 uint8_t num_services;
373 uint8_t value;
374 uint8_t reserved[2];
375} nv_guard_err_collator_cfg_t;
376
377/*
378 * Defines the group state based on errors reported to NvGuard.
379 * The state is derived from the status of diagnostic
380 * tests and errors within the group.
381 */
382typedef enum {
383 /*
384 * Specifies the state when at least one service in the group is in
385 * 'NVGUARD_ERROR_UNDETERMINED' state,
386 * and no other error/test failure is reported from the same group.
387 */
388 NVGUARD_GROUPSTATE_UNDETERMINED = 0,
389 /*
390 * Specifies the group state when each service within the group is in
391 * 'NVGUARD_NO_ERROR' state. The following are true:
392 * -# All HSM error lines associated with the group are enabled,
393 * and none are asserted.
394 * -# Each diagnostic test in the group has executed at least once, and is
395 * currently in the 'NVGUARD_NO_ERROR' state.
396 * -# The service owners have confirmed each SW error in the group is in the
397 * 'NVGUARD_NO_ERROR' state.
398 */
399 NVGUARD_GROUPSTATE_NOERROR,
400 /*
401 * Specifies the state when at least one error/test failure
402 * is reported from a group.
403 */
404 NVGUARD_GROUPSTATE_ERRORDETECTED
405} nv_guard_group_state_t;
406
407/*
408 * Data structure to fetch a group state
409 */
410typedef struct {
411 nv_guard_group_id_t grp_id;
412 nv_guard_group_state_t state;
413} nv_guard_query_grp_state_t;
414
415/* Holds Tegra FuSa state.
416 *
417 * @valuerange
418 * - NVGUARD_TEGRA_FUSASTATE_INIT
419 * - NVGUARD_TEGRA_FUSASTATE_NOERROR
420 * - NVGUARD_TEGRA_FUSASTATE_ERROR
421 */
422typedef uint8_t nv_guard_FuSa_state_t;
423
424/* Supplementary notification of type 'nv_guard_supplementary_notification_t'.
425 * Argument for supplementary notification callback registered by clients
426 */
427typedef uint8_t nv_guard_supplementary_notification_t;
428
429typedef uint8_t nv_guard_tegraphase_t;
430
431/*
432 * Defines the user application message transferred to 3LSS. User messages
433 * are transmitted between Application SW at CCPLEX to MCU.
434 */
435typedef struct {
436 uint8_t data[NVGUARD_USERDATA_MAXLEN];
437} nv_guard_user_msg_t;
438
439typedef struct {
440 nv_guard_cmd_t srv_id_cmd;
441 union {
442 nv_guard_service_id_t srv_id;
443 nv_guard_srv_status_t srv_status;
444 nv_guard_user_msg_t user_msg;
445 nv_guard_tegraphase_t phase;
446 };
447} nv_guard_request_t;
448
449typedef enum {
450 L1SS_NOT_READY,
451 L1SS_READY,
452 L1SS_ALIVE_CHECK,
453} l1ss_cli_callback_param;
454
455#endif /* ifndef NVGUARD_INTERFACEDATATYPES_H */
456
457/* ==================[end of file]=========================================== */