Lucian Paul-Trifu | 3519afe | 2022-03-08 15:02:31 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2021 Arm Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * |
| 6 | * DRTM service |
| 7 | * |
| 8 | * Authors: |
| 9 | * Lucian Paul-Trifu <lucian.paultrifu@gmail.com> |
| 10 | * Brian Nezvadovitz |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | #ifndef ARM_DRTM_SVC_H |
| 15 | #define ARM_DRTM_SVC_H |
| 16 | |
| 17 | /* |
| 18 | * SMC function IDs for DRTM Service |
| 19 | * Upper word bits set: Fast call, SMC64, Standard Secure Svc. Call (OEN = 4) |
| 20 | */ |
| 21 | |
| 22 | #define ARM_DRTM_SVC_VERSION 0xC4000110u |
| 23 | #define ARM_DRTM_SVC_FEATURES 0xC4000111u |
| 24 | #define ARM_DRTM_SVC_UNPROTECT_MEM 0xC4000113u |
| 25 | #define ARM_DRTM_SVC_DYNAMIC_LAUNCH 0xC4000114u |
| 26 | #define ARM_DRTM_SVC_CLOSE_LOCALITY 0xC4000115u |
| 27 | #define ARM_DRTM_SVC_GET_ERROR 0xC4000116u |
| 28 | #define ARM_DRTM_SVC_SET_ERROR 0xC4000117u |
| 29 | #define ARM_DRTM_SVC_SET_TCB_HASH 0xC4000118u |
| 30 | #define ARM_DRTM_SVC_LOCK_TCB_HASHES 0xC4000119u |
| 31 | |
| 32 | #define ARM_DRTM_FEATURES_TPM 0x1u |
| 33 | #define ARM_DRTM_FEATURES_MEM_REQ 0x2u |
| 34 | #define ARM_DRTM_FEATURES_DMA_PROT 0x3u |
| 35 | #define ARM_DRTM_FEATURES_BOOT_PE_ID 0x4u |
| 36 | #define ARM_DRTM_FEATURES_TCB_HASHES 0x5u |
| 37 | |
| 38 | #define is_drtm_fid(_fid) \ |
| 39 | (((_fid) >= ARM_DRTM_SVC_VERSION) && ((_fid) <= ARM_DRTM_SVC_SET_ERROR)) |
| 40 | |
| 41 | /* ARM DRTM Service Calls version numbers */ |
| 42 | #define ARM_DRTM_VERSION_MAJOR 0x0000u |
| 43 | #define ARM_DRTM_VERSION_MINOR 0x0001u |
| 44 | #define ARM_DRTM_VERSION \ |
| 45 | ((ARM_DRTM_VERSION_MAJOR << 16) | ARM_DRTM_VERSION_MINOR) |
| 46 | |
| 47 | /* Initialization routine for the DRTM service */ |
| 48 | int drtm_setup(void); |
| 49 | |
| 50 | /* Handler to be called to handle DRTM SMC calls */ |
| 51 | uint64_t drtm_smc_handler(uint32_t smc_fid, |
| 52 | uint64_t x1, |
| 53 | uint64_t x2, |
| 54 | uint64_t x3, |
| 55 | uint64_t x4, |
| 56 | void *cookie, |
| 57 | void *handle, |
| 58 | uint64_t flags); |
| 59 | |
| 60 | |
| 61 | #endif /* ARM_DRTM_SVC_H */ |