1*91f16700SchasingluluArm SiP Services 2*91f16700Schasinglulu================ 3*91f16700Schasinglulu 4*91f16700SchasingluluThis document enumerates and describes the Arm SiP (Silicon Provider) services. 5*91f16700Schasinglulu 6*91f16700SchasingluluSiP services are non-standard, platform-specific services offered by the silicon 7*91f16700Schasingluluimplementer or platform provider. They are accessed via ``SMC`` ("SMC calls") 8*91f16700Schasingluluinstruction executed from Exception Levels below EL3. SMC calls for SiP 9*91f16700Schasingluluservices: 10*91f16700Schasinglulu 11*91f16700Schasinglulu- Follow `SMC Calling Convention`_; 12*91f16700Schasinglulu- Use SMC function IDs that fall in the SiP range, which are ``0xc2000000`` - 13*91f16700Schasinglulu ``0xc200ffff`` for 64-bit calls, and ``0x82000000`` - ``0x8200ffff`` for 32-bit 14*91f16700Schasinglulu calls. 15*91f16700Schasinglulu 16*91f16700SchasingluluThe Arm SiP implementation offers the following services: 17*91f16700Schasinglulu 18*91f16700Schasinglulu- Performance Measurement Framework (PMF) 19*91f16700Schasinglulu- Execution State Switching service 20*91f16700Schasinglulu- DebugFS interface 21*91f16700Schasinglulu 22*91f16700SchasingluluSource definitions for Arm SiP service are located in the ``arm_sip_svc.h`` header 23*91f16700Schasinglulufile. 24*91f16700Schasinglulu 25*91f16700SchasingluluPerformance Measurement Framework (PMF) 26*91f16700Schasinglulu--------------------------------------- 27*91f16700Schasinglulu 28*91f16700SchasingluluThe :ref:`Performance Measurement Framework <firmware_design_pmf>` 29*91f16700Schasingluluallows callers to retrieve timestamps captured at various paths in TF-A 30*91f16700Schasingluluexecution. 31*91f16700Schasinglulu 32*91f16700SchasingluluExecution State Switching service 33*91f16700Schasinglulu--------------------------------- 34*91f16700Schasinglulu 35*91f16700SchasingluluExecution State Switching service provides a mechanism for a non-secure lower 36*91f16700SchasingluluException Level (either EL2, or NS EL1 if EL2 isn't implemented) to request to 37*91f16700Schasingluluswitch its execution state (a.k.a. Register Width), either from AArch64 to 38*91f16700SchasingluluAArch32, or from AArch32 to AArch64, for the calling CPU. This service is only 39*91f16700Schasingluluavailable when Trusted Firmware-A (TF-A) is built for AArch64 (i.e. when build 40*91f16700Schasingluluoption ``ARCH`` is set to ``aarch64``). 41*91f16700Schasinglulu 42*91f16700Schasinglulu``ARM_SIP_SVC_EXE_STATE_SWITCH`` 43*91f16700Schasinglulu~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 44*91f16700Schasinglulu 45*91f16700Schasinglulu:: 46*91f16700Schasinglulu 47*91f16700Schasinglulu Arguments: 48*91f16700Schasinglulu uint32_t Function ID 49*91f16700Schasinglulu uint32_t PC hi 50*91f16700Schasinglulu uint32_t PC lo 51*91f16700Schasinglulu uint32_t Cookie hi 52*91f16700Schasinglulu uint32_t Cookie lo 53*91f16700Schasinglulu 54*91f16700Schasinglulu Return: 55*91f16700Schasinglulu uint32_t 56*91f16700Schasinglulu 57*91f16700SchasingluluThe function ID parameter must be ``0x82000020``. It uniquely identifies the 58*91f16700SchasingluluExecution State Switching service being requested. 59*91f16700Schasinglulu 60*91f16700SchasingluluThe parameters *PC hi* and *PC lo* defines upper and lower words, respectively, 61*91f16700Schasingluluof the entry point (physical address) at which execution should start, after 62*91f16700SchasingluluExecution State has been switched. When calling from AArch64, *PC hi* must be 0. 63*91f16700Schasinglulu 64*91f16700SchasingluluWhen execution starts at the supplied entry point after Execution State has been 65*91f16700Schasingluluswitched, the parameters *Cookie hi* and *Cookie lo* are passed in CPU registers 66*91f16700Schasinglulu0 and 1, respectively. When calling from AArch64, *Cookie hi* must be 0. 67*91f16700Schasinglulu 68*91f16700SchasingluluThis call can only be made on the primary CPU, before any secondaries were 69*91f16700Schasinglulubrought up with ``CPU_ON`` PSCI call. Otherwise, the call will always fail. 70*91f16700Schasinglulu 71*91f16700SchasingluluThe effect of switching execution state is as if the Exception Level were 72*91f16700Schasingluluentered for the first time, following power on. This means CPU registers that 73*91f16700Schasingluluhave a defined reset value by the Architecture will assume that value. Other 74*91f16700Schasingluluregisters should not be expected to hold their values before the call was made. 75*91f16700SchasingluluCPU endianness, however, is preserved from the previous execution state. Note 76*91f16700Schasingluluthat this switches the execution state of the calling CPU only. This is not a 77*91f16700Schasinglulusubstitute for PSCI ``SYSTEM_RESET``. 78*91f16700Schasinglulu 79*91f16700SchasingluluThe service may return the following error codes: 80*91f16700Schasinglulu 81*91f16700Schasinglulu- ``STATE_SW_E_PARAM``: If any of the parameters were deemed invalid for 82*91f16700Schasinglulu a specific request. 83*91f16700Schasinglulu- ``STATE_SW_E_DENIED``: If the call is not successful, or when TF-A is 84*91f16700Schasinglulu built for AArch32. 85*91f16700Schasinglulu 86*91f16700SchasingluluIf the call is successful, the caller wouldn't observe the SMC returning. 87*91f16700SchasingluluInstead, execution starts at the supplied entry point, with the CPU registers 0 88*91f16700Schasingluluand 1 populated with the supplied *Cookie hi* and *Cookie lo* values, 89*91f16700Schasinglulurespectively. 90*91f16700Schasinglulu 91*91f16700SchasingluluDebugFS interface 92*91f16700Schasinglulu----------------- 93*91f16700Schasinglulu 94*91f16700SchasingluluThe optional DebugFS interface is accessed through an SMC SiP service. Refer 95*91f16700Schasingluluto the component documentation for details. 96*91f16700Schasinglulu 97*91f16700SchasingluluString parameters are passed through a shared buffer using a specific union: 98*91f16700Schasinglulu 99*91f16700Schasinglulu.. code:: c 100*91f16700Schasinglulu 101*91f16700Schasinglulu union debugfs_parms { 102*91f16700Schasinglulu struct { 103*91f16700Schasinglulu char fname[MAX_PATH_LEN]; 104*91f16700Schasinglulu } open; 105*91f16700Schasinglulu 106*91f16700Schasinglulu struct mount { 107*91f16700Schasinglulu char srv[MAX_PATH_LEN]; 108*91f16700Schasinglulu char where[MAX_PATH_LEN]; 109*91f16700Schasinglulu char spec[MAX_PATH_LEN]; 110*91f16700Schasinglulu } mount; 111*91f16700Schasinglulu 112*91f16700Schasinglulu struct { 113*91f16700Schasinglulu char path[MAX_PATH_LEN]; 114*91f16700Schasinglulu dir_t dir; 115*91f16700Schasinglulu } stat; 116*91f16700Schasinglulu 117*91f16700Schasinglulu struct { 118*91f16700Schasinglulu char oldpath[MAX_PATH_LEN]; 119*91f16700Schasinglulu char newpath[MAX_PATH_LEN]; 120*91f16700Schasinglulu } bind; 121*91f16700Schasinglulu }; 122*91f16700Schasinglulu 123*91f16700SchasingluluFormat of the dir_t structure as such: 124*91f16700Schasinglulu 125*91f16700Schasinglulu.. code:: c 126*91f16700Schasinglulu 127*91f16700Schasinglulu typedef struct { 128*91f16700Schasinglulu char name[NAMELEN]; 129*91f16700Schasinglulu long length; 130*91f16700Schasinglulu unsigned char mode; 131*91f16700Schasinglulu unsigned char index; 132*91f16700Schasinglulu unsigned char dev; 133*91f16700Schasinglulu qid_t qid; 134*91f16700Schasinglulu } dir_t; 135*91f16700Schasinglulu 136*91f16700Schasinglulu 137*91f16700Schasinglulu* Identifiers 138*91f16700Schasinglulu 139*91f16700Schasinglulu======================== ============================================= 140*91f16700SchasingluluSMC_OK 0 141*91f16700SchasingluluSMC_UNK -1 142*91f16700SchasingluluDEBUGFS_E_INVALID_PARAMS -2 143*91f16700Schasinglulu======================== ============================================= 144*91f16700Schasinglulu 145*91f16700Schasinglulu======================== ============================================= 146*91f16700SchasingluluMOUNT 0 147*91f16700SchasingluluCREATE 1 148*91f16700SchasingluluOPEN 2 149*91f16700SchasingluluCLOSE 3 150*91f16700SchasingluluREAD 4 151*91f16700SchasingluluWRITE 5 152*91f16700SchasingluluSEEK 6 153*91f16700SchasingluluBIND 7 154*91f16700SchasingluluSTAT 8 155*91f16700SchasingluluINIT 10 156*91f16700SchasingluluVERSION 11 157*91f16700Schasinglulu======================== ============================================= 158*91f16700Schasinglulu 159*91f16700SchasingluluMOUNT 160*91f16700Schasinglulu~~~~~ 161*91f16700Schasinglulu 162*91f16700SchasingluluDescription 163*91f16700Schasinglulu^^^^^^^^^^^ 164*91f16700SchasingluluThis operation mounts a blob of data pointed to by path stored in `src`, at 165*91f16700Schasinglulufilesystem location pointed to by path stored in `where`, using driver pointed 166*91f16700Schasingluluto by path in `spec`. 167*91f16700Schasinglulu 168*91f16700SchasingluluParameters 169*91f16700Schasinglulu^^^^^^^^^^ 170*91f16700Schasinglulu======== ============================================================ 171*91f16700Schasingluluuint32_t FunctionID (0x82000030 / 0xC2000030) 172*91f16700Schasingluluuint32_t ``MOUNT`` 173*91f16700Schasinglulu======== ============================================================ 174*91f16700Schasinglulu 175*91f16700SchasingluluReturn values 176*91f16700Schasinglulu^^^^^^^^^^^^^ 177*91f16700Schasinglulu 178*91f16700Schasinglulu=============== ========================================================== 179*91f16700Schasingluluint32_t w0 == SMC_OK on success 180*91f16700Schasinglulu 181*91f16700Schasinglulu w0 == DEBUGFS_E_INVALID_PARAMS if mount operation failed 182*91f16700Schasinglulu=============== ========================================================== 183*91f16700Schasinglulu 184*91f16700SchasingluluOPEN 185*91f16700Schasinglulu~~~~ 186*91f16700Schasinglulu 187*91f16700SchasingluluDescription 188*91f16700Schasinglulu^^^^^^^^^^^ 189*91f16700SchasingluluThis operation opens the file path pointed to by `fname`. 190*91f16700Schasinglulu 191*91f16700SchasingluluParameters 192*91f16700Schasinglulu^^^^^^^^^^ 193*91f16700Schasinglulu 194*91f16700Schasinglulu======== ============================================================ 195*91f16700Schasingluluuint32_t FunctionID (0x82000030 / 0xC2000030) 196*91f16700Schasingluluuint32_t ``OPEN`` 197*91f16700Schasingluluuint32_t mode 198*91f16700Schasinglulu======== ============================================================ 199*91f16700Schasinglulu 200*91f16700Schasinglulumode can be one of: 201*91f16700Schasinglulu 202*91f16700Schasinglulu.. code:: c 203*91f16700Schasinglulu 204*91f16700Schasinglulu enum mode { 205*91f16700Schasinglulu O_READ = 1 << 0, 206*91f16700Schasinglulu O_WRITE = 1 << 1, 207*91f16700Schasinglulu O_RDWR = 1 << 2, 208*91f16700Schasinglulu O_BIND = 1 << 3, 209*91f16700Schasinglulu O_DIR = 1 << 4, 210*91f16700Schasinglulu O_STAT = 1 << 5 211*91f16700Schasinglulu }; 212*91f16700Schasinglulu 213*91f16700SchasingluluReturn values 214*91f16700Schasinglulu^^^^^^^^^^^^^ 215*91f16700Schasinglulu 216*91f16700Schasinglulu=============== ========================================================== 217*91f16700Schasingluluint32_t w0 == SMC_OK on success 218*91f16700Schasinglulu 219*91f16700Schasinglulu w0 == DEBUGFS_E_INVALID_PARAMS if open operation failed 220*91f16700Schasinglulu 221*91f16700Schasingluluuint32_t w1: file descriptor id on success. 222*91f16700Schasinglulu=============== ========================================================== 223*91f16700Schasinglulu 224*91f16700SchasingluluCLOSE 225*91f16700Schasinglulu~~~~~ 226*91f16700Schasinglulu 227*91f16700SchasingluluDescription 228*91f16700Schasinglulu^^^^^^^^^^^ 229*91f16700Schasinglulu 230*91f16700SchasingluluThis operation closes a file described by a file descriptor obtained by a 231*91f16700Schasingluluprevious call to OPEN. 232*91f16700Schasinglulu 233*91f16700SchasingluluParameters 234*91f16700Schasinglulu^^^^^^^^^^ 235*91f16700Schasinglulu 236*91f16700Schasinglulu======== ============================================================ 237*91f16700Schasingluluuint32_t FunctionID (0x82000030 / 0xC2000030) 238*91f16700Schasingluluuint32_t ``CLOSE`` 239*91f16700Schasingluluuint32_t File descriptor id returned by OPEN 240*91f16700Schasinglulu======== ============================================================ 241*91f16700Schasinglulu 242*91f16700SchasingluluReturn values 243*91f16700Schasinglulu^^^^^^^^^^^^^ 244*91f16700Schasinglulu=============== ========================================================== 245*91f16700Schasingluluint32_t w0 == SMC_OK on success 246*91f16700Schasinglulu 247*91f16700Schasinglulu w0 == DEBUGFS_E_INVALID_PARAMS if close operation failed 248*91f16700Schasinglulu=============== ========================================================== 249*91f16700Schasinglulu 250*91f16700SchasingluluREAD 251*91f16700Schasinglulu~~~~ 252*91f16700Schasinglulu 253*91f16700SchasingluluDescription 254*91f16700Schasinglulu^^^^^^^^^^^ 255*91f16700Schasinglulu 256*91f16700SchasingluluThis operation reads a number of bytes from a file descriptor obtained by 257*91f16700Schasinglulua previous call to OPEN. 258*91f16700Schasinglulu 259*91f16700SchasingluluParameters 260*91f16700Schasinglulu^^^^^^^^^^ 261*91f16700Schasinglulu 262*91f16700Schasinglulu======== ============================================================ 263*91f16700Schasingluluuint32_t FunctionID (0x82000030 / 0xC2000030) 264*91f16700Schasingluluuint32_t ``READ`` 265*91f16700Schasingluluuint32_t File descriptor id returned by OPEN 266*91f16700Schasingluluuint32_t Number of bytes to read 267*91f16700Schasinglulu======== ============================================================ 268*91f16700Schasinglulu 269*91f16700SchasingluluReturn values 270*91f16700Schasinglulu^^^^^^^^^^^^^ 271*91f16700Schasinglulu 272*91f16700SchasingluluOn success, the read data is retrieved from the shared buffer after the 273*91f16700Schasingluluoperation. 274*91f16700Schasinglulu 275*91f16700Schasinglulu=============== ========================================================== 276*91f16700Schasingluluint32_t w0 == SMC_OK on success 277*91f16700Schasinglulu 278*91f16700Schasinglulu w0 == DEBUGFS_E_INVALID_PARAMS if read operation failed 279*91f16700Schasinglulu 280*91f16700Schasingluluuint32_t w1: number of bytes read on success. 281*91f16700Schasinglulu=============== ========================================================== 282*91f16700Schasinglulu 283*91f16700SchasingluluSEEK 284*91f16700Schasinglulu~~~~ 285*91f16700Schasinglulu 286*91f16700SchasingluluDescription 287*91f16700Schasinglulu^^^^^^^^^^^ 288*91f16700Schasinglulu 289*91f16700SchasingluluMove file pointer for file described by given `file descriptor` of given 290*91f16700Schasinglulu`offset` related to `whence`. 291*91f16700Schasinglulu 292*91f16700SchasingluluParameters 293*91f16700Schasinglulu^^^^^^^^^^ 294*91f16700Schasinglulu 295*91f16700Schasinglulu======== ============================================================ 296*91f16700Schasingluluuint32_t FunctionID (0x82000030 / 0xC2000030) 297*91f16700Schasingluluuint32_t ``SEEK`` 298*91f16700Schasingluluuint32_t File descriptor id returned by OPEN 299*91f16700Schasinglulusint32_t offset in the file relative to whence 300*91f16700Schasingluluuint32_t whence 301*91f16700Schasinglulu======== ============================================================ 302*91f16700Schasinglulu 303*91f16700Schasingluluwhence can be one of: 304*91f16700Schasinglulu 305*91f16700Schasinglulu========= ============================================================ 306*91f16700SchasingluluKSEEK_SET 0 307*91f16700SchasingluluKSEEK_CUR 1 308*91f16700SchasingluluKSEEK_END 2 309*91f16700Schasinglulu========= ============================================================ 310*91f16700Schasinglulu 311*91f16700SchasingluluReturn values 312*91f16700Schasinglulu^^^^^^^^^^^^^ 313*91f16700Schasinglulu 314*91f16700Schasinglulu=============== ========================================================== 315*91f16700Schasingluluint32_t w0 == SMC_OK on success 316*91f16700Schasinglulu 317*91f16700Schasinglulu w0 == DEBUGFS_E_INVALID_PARAMS if seek operation failed 318*91f16700Schasinglulu=============== ========================================================== 319*91f16700Schasinglulu 320*91f16700SchasingluluBIND 321*91f16700Schasinglulu~~~~ 322*91f16700Schasinglulu 323*91f16700SchasingluluDescription 324*91f16700Schasinglulu^^^^^^^^^^^ 325*91f16700Schasinglulu 326*91f16700SchasingluluCreate a link from `oldpath` to `newpath`. 327*91f16700Schasinglulu 328*91f16700SchasingluluParameters 329*91f16700Schasinglulu^^^^^^^^^^ 330*91f16700Schasinglulu 331*91f16700Schasinglulu======== ============================================================ 332*91f16700Schasingluluuint32_t FunctionID (0x82000030 / 0xC2000030) 333*91f16700Schasingluluuint32_t ``BIND`` 334*91f16700Schasinglulu======== ============================================================ 335*91f16700Schasinglulu 336*91f16700SchasingluluReturn values 337*91f16700Schasinglulu^^^^^^^^^^^^^ 338*91f16700Schasinglulu 339*91f16700Schasinglulu=============== ========================================================== 340*91f16700Schasingluluint32_t w0 == SMC_OK on success 341*91f16700Schasinglulu 342*91f16700Schasinglulu w0 == DEBUGFS_E_INVALID_PARAMS if bind operation failed 343*91f16700Schasinglulu=============== ========================================================== 344*91f16700Schasinglulu 345*91f16700SchasingluluSTAT 346*91f16700Schasinglulu~~~~ 347*91f16700Schasinglulu 348*91f16700SchasingluluDescription 349*91f16700Schasinglulu^^^^^^^^^^^ 350*91f16700Schasinglulu 351*91f16700SchasingluluPerform a stat operation on provided file `name` and returns the directory 352*91f16700Schasingluluentry statistics into `dir`. 353*91f16700Schasinglulu 354*91f16700SchasingluluParameters 355*91f16700Schasinglulu^^^^^^^^^^ 356*91f16700Schasinglulu 357*91f16700Schasinglulu======== ============================================================ 358*91f16700Schasingluluuint32_t FunctionID (0x82000030 / 0xC2000030) 359*91f16700Schasingluluuint32_t ``STAT`` 360*91f16700Schasinglulu======== ============================================================ 361*91f16700Schasinglulu 362*91f16700SchasingluluReturn values 363*91f16700Schasinglulu^^^^^^^^^^^^^ 364*91f16700Schasinglulu 365*91f16700Schasinglulu=============== ========================================================== 366*91f16700Schasingluluint32_t w0 == SMC_OK on success 367*91f16700Schasinglulu 368*91f16700Schasinglulu w0 == DEBUGFS_E_INVALID_PARAMS if stat operation failed 369*91f16700Schasinglulu=============== ========================================================== 370*91f16700Schasinglulu 371*91f16700SchasingluluINIT 372*91f16700Schasinglulu~~~~ 373*91f16700Schasinglulu 374*91f16700SchasingluluDescription 375*91f16700Schasinglulu^^^^^^^^^^^ 376*91f16700SchasingluluInitial call to setup the shared exchange buffer. Notice if successful once, 377*91f16700Schasinglulusubsequent calls fail after a first initialization. The caller maps the same 378*91f16700Schasinglulupage frame in its virtual space and uses this buffer to exchange string 379*91f16700Schasingluluparameters with filesystem primitives. 380*91f16700Schasinglulu 381*91f16700SchasingluluParameters 382*91f16700Schasinglulu^^^^^^^^^^ 383*91f16700Schasinglulu 384*91f16700Schasinglulu======== ============================================================ 385*91f16700Schasingluluuint32_t FunctionID (0x82000030 / 0xC2000030) 386*91f16700Schasingluluuint32_t ``INIT`` 387*91f16700Schasingluluuint64_t Physical address of the shared buffer. 388*91f16700Schasinglulu======== ============================================================ 389*91f16700Schasinglulu 390*91f16700SchasingluluReturn values 391*91f16700Schasinglulu^^^^^^^^^^^^^ 392*91f16700Schasinglulu 393*91f16700Schasinglulu=============== ====================================================== 394*91f16700Schasingluluint32_t w0 == SMC_OK on success 395*91f16700Schasinglulu 396*91f16700Schasinglulu w0 == DEBUGFS_E_INVALID_PARAMS if already initialized, 397*91f16700Schasinglulu or internal error occurred. 398*91f16700Schasinglulu=============== ====================================================== 399*91f16700Schasinglulu 400*91f16700SchasingluluVERSION 401*91f16700Schasinglulu~~~~~~~ 402*91f16700Schasinglulu 403*91f16700SchasingluluDescription 404*91f16700Schasinglulu^^^^^^^^^^^ 405*91f16700SchasingluluReturns the debugfs interface version if implemented in TF-A. 406*91f16700Schasinglulu 407*91f16700SchasingluluParameters 408*91f16700Schasinglulu^^^^^^^^^^ 409*91f16700Schasinglulu 410*91f16700Schasinglulu======== ============================================================ 411*91f16700Schasingluluuint32_t FunctionID (0x82000030 / 0xC2000030) 412*91f16700Schasingluluuint32_t ``VERSION`` 413*91f16700Schasinglulu======== ============================================================ 414*91f16700Schasinglulu 415*91f16700SchasingluluReturn values 416*91f16700Schasinglulu^^^^^^^^^^^^^ 417*91f16700Schasinglulu 418*91f16700Schasinglulu=============== ====================================================== 419*91f16700Schasingluluint32_t w0 == SMC_OK on success 420*91f16700Schasinglulu 421*91f16700Schasinglulu w0 == SMC_UNK if interface is not implemented 422*91f16700Schasinglulu 423*91f16700Schasingluluuint32_t w1: On success, debugfs interface version, 32 bits 424*91f16700Schasinglulu value with major version number in upper 16 bits and 425*91f16700Schasinglulu minor version in lower 16 bits. 426*91f16700Schasinglulu=============== ====================================================== 427*91f16700Schasinglulu 428*91f16700Schasinglulu* CREATE(1) and WRITE (5) command identifiers are unimplemented and 429*91f16700Schasinglulu return `SMC_UNK`. 430*91f16700Schasinglulu 431*91f16700Schasinglulu-------------- 432*91f16700Schasinglulu 433*91f16700Schasinglulu*Copyright (c) 2017-2020, Arm Limited and Contributors. All rights reserved.* 434*91f16700Schasinglulu 435*91f16700Schasinglulu.. _SMC Calling Convention: https://developer.arm.com/docs/den0028/latest 436