diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/platform/tegra/l1ss_datatypes.h | 457 | ||||
| -rw-r--r-- | include/linux/tegra_l1ss_ioctl.h | 294 | ||||
| -rw-r--r-- | include/linux/tegra_l1ss_kernel_interface.h | 7 | ||||
| -rw-r--r-- | include/linux/tegra_nv_guard_group_id.h | 2 | ||||
| -rw-r--r-- | include/linux/tegra_nv_guard_service_id.h | 2 |
5 files changed, 464 insertions, 298 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 | |||
| 301 | typedef 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 | */ | ||
| 311 | typedef 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 | */ | ||
| 321 | typedef 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 | */ | ||
| 334 | typedef 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 | */ | ||
| 343 | typedef uint32_t nv_guard_client_id_t; | ||
| 344 | |||
| 345 | /* | ||
| 346 | * Identifies a client operation | ||
| 347 | */ | ||
| 348 | typedef 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 | */ | ||
| 354 | typedef uint8_t NvGuard_ErrClass_t; | ||
| 355 | |||
| 356 | /* | ||
| 357 | * 3LSS layer where a service/group belong to. Extracted from | ||
| 358 | * service identifier/group identifier | ||
| 359 | */ | ||
| 360 | typedef uint32_t nv_guard_3lss_layer_t; | ||
| 361 | |||
| 362 | /* | ||
| 363 | * Group index extracted from group identifier | ||
| 364 | */ | ||
| 365 | typedef uint32_t NvGuard_GroupIndex_t; | ||
| 366 | |||
| 367 | /* | ||
| 368 | * Data structure to communicate error collator configuration requests | ||
| 369 | */ | ||
| 370 | typedef 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 | */ | ||
| 382 | typedef 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 | */ | ||
| 410 | typedef 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 | */ | ||
| 422 | typedef 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 | */ | ||
| 427 | typedef uint8_t nv_guard_supplementary_notification_t; | ||
| 428 | |||
| 429 | typedef 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 | */ | ||
| 435 | typedef struct { | ||
| 436 | uint8_t data[NVGUARD_USERDATA_MAXLEN]; | ||
| 437 | } nv_guard_user_msg_t; | ||
| 438 | |||
| 439 | typedef 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 | |||
| 449 | typedef 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]=========================================== */ | ||
diff --git a/include/linux/tegra_l1ss_ioctl.h b/include/linux/tegra_l1ss_ioctl.h index 847a169df..300bb1ce2 100644 --- a/include/linux/tegra_l1ss_ioctl.h +++ b/include/linux/tegra_l1ss_ioctl.h | |||
| @@ -20,299 +20,9 @@ | |||
| 20 | #include <linux/ioctl.h> | 20 | #include <linux/ioctl.h> |
| 21 | #include <linux/tegra_nv_guard_service_id.h> | 21 | #include <linux/tegra_nv_guard_service_id.h> |
| 22 | #include <linux/tegra_nv_guard_group_id.h> | 22 | #include <linux/tegra_nv_guard_group_id.h> |
| 23 | 23 | #include <linux/platform/tegra/l1ss_datatypes.h> | |
| 24 | typedef unsigned char uint8_t; | ||
| 25 | typedef unsigned int uint32_t; | ||
| 26 | typedef unsigned long long uint64_t; | ||
| 27 | |||
| 28 | typedef uint32_t nv_guard_service_id_t; | ||
| 29 | typedef uint32_t nv_guard_group_id_t; | ||
| 30 | 24 | ||
| 31 | #define L1SS_IOCTL_MAGIC 'L' | 25 | #define L1SS_IOCTL_MAGIC 'L' |
| 32 | 26 | #define L1SS_CLIENT_REQUEST _IOR(L1SS_IOCTL_MAGIC, 1, nv_guard_request_t) | |
| 33 | #define NVGUARD_ERROR_UNDETERMINED (0x00U) | ||
| 34 | /* | ||
| 35 | * Defines the error status when fault is confirmed at source, | ||
| 36 | * and is not fixed. | ||
| 37 | */ | ||
| 38 | #define NVGUARD_ERROR_DETECTED (0xAAU) | ||
| 39 | /* | ||
| 40 | * Defines the error status when the test function does not | ||
| 41 | * encounter a fault, | ||
| 42 | * or when a pre-existing fault is fixed. | ||
| 43 | */ | ||
| 44 | #define NVGUARD_NO_ERROR (0x55U) | ||
| 45 | |||
| 46 | /* | ||
| 47 | * Service Id registration status length for synchronous call | ||
| 48 | */ | ||
| 49 | #define NVGUARD_SRV_REG_LIST_LEN_SYNC (31U) | ||
| 50 | |||
| 51 | /* | ||
| 52 | * Length of service list | ||
| 53 | */ | ||
| 54 | #define NVGUARD_SRV_LIST_LEN (20U) | ||
| 55 | /* | ||
| 56 | * Number of reserved bytes in service status structure | ||
| 57 | */ | ||
| 58 | #define RESERVED_BYTES (10U) | ||
| 59 | /* | ||
| 60 | * Maximum length of error information, in bytes, in service status structure | ||
| 61 | */ | ||
| 62 | #define NVGUARD_ERRINFO_LEN (180U) | ||
| 63 | /* | ||
| 64 | * Length of group list | ||
| 65 | */ | ||
| 66 | #define NVGUARD_GRP_LIST_LEN (12U) | ||
| 67 | /* | ||
| 68 | * Number of groups in state packet structure. MUST BE GREATER THAN 0 | ||
| 69 | */ | ||
| 70 | #define NVGUARD_GROUPSTATEPKT_DATACOUNT (24U) | ||
| 71 | |||
| 72 | /* | ||
| 73 | * NvGuard service classes | ||
| 74 | */ | ||
| 75 | |||
| 76 | /* | ||
| 77 | * Denotes HSM errors | ||
| 78 | */ | ||
| 79 | #define NVGUARD_SERVICECLASS_HSM_ERROR (0U) | ||
| 80 | /* | ||
| 81 | * Denotes software errors | ||
| 82 | */ | ||
| 83 | #define NVGUARD_SERVICECLASS_SW_ERROR (1U) | ||
| 84 | /* | ||
| 85 | * Denotes diagnostic tests | ||
| 86 | */ | ||
| 87 | #define NVGUARD_SERVICECLASS_DIAG_TEST (2U) | ||
| 88 | /* | ||
| 89 | * Defines the FuSa state during initialization. | ||
| 90 | */ | ||
| 91 | #define NVGUARD_TEGRA_FUSASTATE_INIT (0U) | ||
| 92 | /* | ||
| 93 | * Defines the FuSa state when no error is reported to 3LSS | ||
| 94 | */ | ||
| 95 | #define NVGUARD_TEGRA_FUSASTATE_NOERROR (1U) | ||
| 96 | /* | ||
| 97 | * Defines the FuSa state when an error is reported to 3LSS | ||
| 98 | */ | ||
| 99 | #define NVGUARD_TEGRA_FUSASTATE_ERROR (2U) | ||
| 100 | |||
| 101 | /* Defines a change in the FuSa state. | ||
| 102 | */ | ||
| 103 | #define NVGUARD_SUPPNOTIF_FUSASTATE_CHANGE (0U) | ||
| 104 | |||
| 105 | /* | ||
| 106 | * Defines the availability of user data to be read. | ||
| 107 | */ | ||
| 108 | #define NVGUARD_SUPPNOTIF_USERMSG_READY (1U) | ||
| 109 | |||
| 110 | /* | ||
| 111 | * Defines the maximum length of user message, in bytes. | ||
| 112 | */ | ||
| 113 | #define NVGUARD_USERDATA_MAXLEN (56U) | ||
| 114 | |||
| 115 | #define NVGUARD_LAYER_3 (3U) | ||
| 116 | #define NVGUARD_LAYER_2 (2U) | ||
| 117 | #define NVGUARD_LAYER_1 (1U) | ||
| 118 | #define NVGUARD_LAYER_INVALID (0U) | ||
| 119 | |||
| 120 | #define NVGUARD_MAX_LAYERID (3U) | ||
| 121 | /* | ||
| 122 | * Attributes associated with a service identifier | ||
| 123 | */ | ||
| 124 | |||
| 125 | typedef struct { | ||
| 126 | nv_guard_service_id_t SrvId; | ||
| 127 | uint8_t isEnabled; | ||
| 128 | uint8_t isDriveOSApp; | ||
| 129 | uint8_t Reserved[2]; | ||
| 130 | } nv_guard_srv_attributes_t; | ||
| 131 | |||
| 132 | /* | ||
| 133 | * List of service identifiers | ||
| 134 | */ | ||
| 135 | typedef struct { | ||
| 136 | uint8_t num_srv; | ||
| 137 | uint8_t reserved[3]; | ||
| 138 | nv_guard_srv_attributes_t srv_list[NVGUARD_SRV_LIST_LEN]; | ||
| 139 | } nv_guard_srv_list_t; | ||
| 140 | |||
| 141 | #pragma pack(push, 1) | ||
| 142 | /* | ||
| 143 | * Status associated with a service identifier | ||
| 144 | */ | ||
| 145 | typedef struct { | ||
| 146 | nv_guard_service_id_t srv_id; | ||
| 147 | uint8_t status; | ||
| 148 | uint64_t timestamp; | ||
| 149 | uint8_t reserved[RESERVED_BYTES]; | ||
| 150 | uint8_t error_info_size; | ||
| 151 | uint8_t error_info[NVGUARD_ERRINFO_LEN]; | ||
| 152 | } nv_guard_srv_status_t; | ||
| 153 | #pragma pack(pop) | ||
| 154 | |||
| 155 | /* | ||
| 156 | * List of group identifiers | ||
| 157 | */ | ||
| 158 | typedef struct { | ||
| 159 | uint8_t num_grp; | ||
| 160 | uint8_t reserved[3]; | ||
| 161 | nv_guard_group_id_t grp_list[NVGUARD_GRP_LIST_LEN]; | ||
| 162 | } nv_guard_grp_list_t; | ||
| 163 | |||
| 164 | /* | ||
| 165 | * Identifies a client | ||
| 166 | */ | ||
| 167 | typedef uint32_t nv_guard_client_id_t; | ||
| 168 | |||
| 169 | /* | ||
| 170 | * Identifies a client operation | ||
| 171 | */ | ||
| 172 | typedef uint32_t nv_guard_cmd_t; | ||
| 173 | |||
| 174 | /* | ||
| 175 | * Error class, extracted from service identifier. | ||
| 176 | * Distinguishes HSM error, SW error and diagnostic test | ||
| 177 | */ | ||
| 178 | typedef uint8_t NvGuard_ErrClass_t; | ||
| 179 | |||
| 180 | /* | ||
| 181 | * 3LSS layer where a service/group belong to. Extracted from | ||
| 182 | * service identifier/group identifier | ||
| 183 | */ | ||
| 184 | typedef uint32_t nv_guard_3lss_layer_t; | ||
| 185 | |||
| 186 | /* | ||
| 187 | * Group index extracted from group identifier | ||
| 188 | */ | ||
| 189 | typedef uint32_t NvGuard_GroupIndex_t; | ||
| 190 | |||
| 191 | /* | ||
| 192 | * Data structure to communicate error collator configuration requests | ||
| 193 | */ | ||
| 194 | typedef struct { | ||
| 195 | nv_guard_service_id_t srv_list[NVGUARD_SRV_LIST_LEN]; | ||
| 196 | uint8_t num_services; | ||
| 197 | uint8_t value; | ||
| 198 | uint8_t reserved[2]; | ||
| 199 | } nv_guard_err_collator_cfg_t; | ||
| 200 | |||
| 201 | /* | ||
| 202 | * Defines the group state based on errors reported to NvGuard. | ||
| 203 | * The state is derived from the status of diagnostic | ||
| 204 | * tests and errors within the group. | ||
| 205 | */ | ||
| 206 | typedef enum { | ||
| 207 | /* | ||
| 208 | * Specifies the state when at least one service in the group is in | ||
| 209 | * 'NVGUARD_ERROR_UNDETERMINED' state, | ||
| 210 | * and no other error/test failure is reported from the same group. | ||
| 211 | */ | ||
| 212 | NVGUARD_GROUPSTATE_UNDETERMINED = 0, | ||
| 213 | /* | ||
| 214 | * Specifies the group state when each service within the group is in | ||
| 215 | * 'NVGUARD_NO_ERROR' state. The following are true: | ||
| 216 | * -# All HSM error lines associated with the group are enabled, | ||
| 217 | * and none are asserted. | ||
| 218 | * -# Each diagnostic test in the group has executed at least once, and is | ||
| 219 | * currently in the 'NVGUARD_NO_ERROR' state. | ||
| 220 | * -# The service owners have confirmed each SW error in the group is in the | ||
| 221 | * 'NVGUARD_NO_ERROR' state. | ||
| 222 | */ | ||
| 223 | NVGUARD_GROUPSTATE_NOERROR, | ||
| 224 | /* | ||
| 225 | * Specifies the state when at least one error/test failure | ||
| 226 | * is reported from a group. | ||
| 227 | */ | ||
| 228 | NVGUARD_GROUPSTATE_ERRORDETECTED | ||
| 229 | } nv_guard_group_state_t; | ||
| 230 | |||
| 231 | /* | ||
| 232 | * Data structure to fetch a group state | ||
| 233 | */ | ||
| 234 | typedef struct { | ||
| 235 | nv_guard_group_id_t grp_id; | ||
| 236 | nv_guard_group_state_t state; | ||
| 237 | } nv_guard_query_grp_state_t; | ||
| 238 | |||
| 239 | /* Holds Tegra FuSa state. | ||
| 240 | * | ||
| 241 | * @valuerange | ||
| 242 | * - NVGUARD_TEGRA_FUSASTATE_INIT | ||
| 243 | * - NVGUARD_TEGRA_FUSASTATE_NOERROR | ||
| 244 | * - NVGUARD_TEGRA_FUSASTATE_ERROR | ||
| 245 | */ | ||
| 246 | typedef uint8_t nv_guard_FuSa_state_t; | ||
| 247 | |||
| 248 | /* Supplementary notification of type 'nv_guard_supplementary_notification_t'. | ||
| 249 | * Argument for supplementary notification callback registered by clients | ||
| 250 | */ | ||
| 251 | typedef uint8_t nv_guard_supplementary_notification_t; | ||
| 252 | |||
| 253 | /* | ||
| 254 | * Defines the user application message transferred to 3LSS. User messages | ||
| 255 | * are transmitted between Application SW at CCPLEX to MCU. | ||
| 256 | */ | ||
| 257 | typedef struct { | ||
| 258 | uint8_t data[NVGUARD_USERDATA_MAXLEN]; | ||
| 259 | } nv_guard_user_msg_t; | ||
| 260 | |||
| 261 | typedef struct { | ||
| 262 | nv_guard_cmd_t srv_id_cmd; | ||
| 263 | union { | ||
| 264 | nv_guard_service_id_t srv_id; | ||
| 265 | nv_guard_srv_status_t srv_status; | ||
| 266 | nv_guard_user_msg_t user_msg; | ||
| 267 | }; | ||
| 268 | } nv_guard_request_t; | ||
| 269 | |||
| 270 | /* | ||
| 271 | * Identifies a client | ||
| 272 | */ | ||
| 273 | typedef uint32_t nv_guard_client_id_t; | ||
| 274 | |||
| 275 | #define NVGUARD_INVALID_CLIENTID (0U) | ||
| 276 | #define NVGUARD_MAX_CLIENT_CONNECTIONS (4U * NVGUARD_GROUPID_MAX) | ||
| 277 | |||
| 278 | #define L1SS_CLIENT_REQUEST _IOR(L1SS_IOCTL_MAGIC, 1, nv_guard_request_t) | ||
| 279 | |||
| 280 | #define NVGUARD_CONNECTION_INIT (0x10U) | ||
| 281 | #define NVGUARD_CONNECTION_DEINIT (0x20U) | ||
| 282 | #define NVGUARD_REGSITER_SERVICE NVGUARD_OPERATION_REGISTER | ||
| 283 | #define NVGUARD_DEREGSITER_SERVICE (0x30U) | ||
| 284 | #define NVGUARD_ENABLE_SERVICE NVGUARD_OPERATION_ENABLE | ||
| 285 | #define NVGUARD_DISABLE_SERVICE NVGUARD_OPERATION_DISABLE | ||
| 286 | #define NVGUARD_REPORT_STATUS NVGUARD_OPERATION_REPORT | ||
| 287 | #define NVGUARD_REGISTER_NOTIFICATION (0x40U) | ||
| 288 | #define NVGUARD_DEREGISTER_NOTIFICATION (0x50U) | ||
| 289 | #define NVGUARD_SERVICE_OVERRIDE (0x60U) | ||
| 290 | #define NVGUARD_REQUEST_SERVICE (0x05U) | ||
| 291 | #define NVGUARD_REQUEST_PHASECHANGE (0x70U) | ||
| 292 | #define NVGAURD_SEC_CONFIG (0x80U) | ||
| 293 | #ifdef NVGUARD_ENABLE_ERR_INJ | ||
| 294 | #define NVGUARD_ERROR_INJECTION (0x06U) | ||
| 295 | #endif /* NVGUARD_ENABLE_ERR_INJ endif*/ | ||
| 296 | #define NVGUARD_USER_MESG (0x07U) | ||
| 297 | #define NVGUARD_PHASE_NOTIFICATOIN (0x08U) | ||
| 298 | #define NVGUARD_FUSA_NOTIFICATION (0x09U) | ||
| 299 | #define NVGUARD_SERVICESTATUS_NOTIFICATION (0x0AU) | ||
| 300 | #define NVGUARD_GROUPSTATE_NOTIFICATION (0x0BU) | ||
| 301 | #define NVGUARD_EXECUTE_SERVICEHANDLER (0x0CU) | ||
| 302 | #define NVGUARD_READ_SERVICEHANDLERSTATUS (0x0DU) | ||
| 303 | #define NVGUARD_ASYNC_SRVSTATUS (0x0EU) | ||
| 304 | #define NVGUARD_READ_SERVICEINFO (0x90U) | ||
| 305 | #define NVGUARD_READ_TESTSTATUS (0xA0U) | ||
| 306 | #define NVGUARD_READ_DIAGPERIOD (0xB0U) | ||
| 307 | #define NVGUARD_SYNC_SRVSTATUS (0xC0U) | ||
| 308 | #define NVGUARD_REPORT_INTERNALERROR (0XFFU) | ||
| 309 | #define NVGUARD_READ_USERMSG (0x71U) | ||
| 310 | #define NVGUARD_SEND_ISTMSG (0x72U) | ||
| 311 | #define NVGUARD_NOTIFY_ISTMSG (0x73U) | ||
| 312 | #define NVGUARD_READ_ISTMSG (0x74U) | ||
| 313 | #define NVGUARD_UPDATE_MISSIONPARAM (0x75U) | ||
| 314 | #define NVGUARD_REGISTER_IST (0x76U) | ||
| 315 | #define NVGUARD_READ_SRVSTATUS (0xE1U) | ||
| 316 | #define NVGUARD_INTERNAL_ERROR (0xFFU) | ||
| 317 | 27 | ||
| 318 | #endif | 28 | #endif |
diff --git a/include/linux/tegra_l1ss_kernel_interface.h b/include/linux/tegra_l1ss_kernel_interface.h index 105f487a5..5e08a8bf2 100644 --- a/include/linux/tegra_l1ss_kernel_interface.h +++ b/include/linux/tegra_l1ss_kernel_interface.h | |||
| @@ -19,12 +19,7 @@ | |||
| 19 | 19 | ||
| 20 | #include <linux/types.h> | 20 | #include <linux/types.h> |
| 21 | #include <linux/tegra_l1ss_ioctl.h> | 21 | #include <linux/tegra_l1ss_ioctl.h> |
| 22 | 22 | #include <linux/platform/tegra/l1ss_datatypes.h> | |
| 23 | typedef enum { | ||
| 24 | L1SS_NOT_READY, | ||
| 25 | L1SS_READY, | ||
| 26 | L1SS_ALIVE_CHECK, | ||
| 27 | } l1ss_cli_callback_param; | ||
| 28 | 23 | ||
| 29 | typedef int (*client_callback)(l1ss_cli_callback_param, void *); | 24 | typedef int (*client_callback)(l1ss_cli_callback_param, void *); |
| 30 | 25 | ||
diff --git a/include/linux/tegra_nv_guard_group_id.h b/include/linux/tegra_nv_guard_group_id.h index 9e1d51e8d..06ece054f 100644 --- a/include/linux/tegra_nv_guard_group_id.h +++ b/include/linux/tegra_nv_guard_group_id.h | |||
| @@ -112,4 +112,6 @@ | |||
| 112 | #define NVGUARD_GROUPID_HV 0x458U | 112 | #define NVGUARD_GROUPID_HV 0x458U |
| 113 | #define NVGUARD_GROUPID_PLATFORM 0x459U | 113 | #define NVGUARD_GROUPID_PLATFORM 0x459U |
| 114 | #define NVGUARD_GROUPID_MAX 90U | 114 | #define NVGUARD_GROUPID_MAX 90U |
| 115 | |||
| 116 | typedef uint32_t nv_guard_group_id_t; | ||
| 115 | #endif | 117 | #endif |
diff --git a/include/linux/tegra_nv_guard_service_id.h b/include/linux/tegra_nv_guard_service_id.h index f2b1a0d58..324a7322e 100644 --- a/include/linux/tegra_nv_guard_service_id.h +++ b/include/linux/tegra_nv_guard_service_id.h | |||
| @@ -2048,4 +2048,6 @@ Global Maxima Group for Hardware = TSA | |||
| 2048 | /* NVGUARD_SERVICE_INVALID_HSMERR_RSVD_478 */ | 2048 | /* NVGUARD_SERVICE_INVALID_HSMERR_RSVD_478 */ |
| 2049 | /* NVGUARD_SERVICE_INVALID_HSMERR_RSVD_479 */ | 2049 | /* NVGUARD_SERVICE_INVALID_HSMERR_RSVD_479 */ |
| 2050 | /* NVGUARD_SERVICE_INVALID_HSMERR_RSVD_480 */ | 2050 | /* NVGUARD_SERVICE_INVALID_HSMERR_RSVD_480 */ |
| 2051 | |||
| 2052 | typedef uint32_t nv_guard_service_id_t; | ||
| 2051 | #endif | 2053 | #endif |
