1 /* 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * SPDX-FileCopyrightText: Copyright TF-RMM Contributors. 5 */ 6 7 #ifndef SMC_RMI_H 8 #define SMC_RMI_H 9 10 #include <smc.h> 11 12 /* 13 * This file describes the Realm Management Interface (RMI) Application Binary 14 * Interface (ABI) for SMC calls made from Non-secure state to the RMM and 15 * serviced by the RMM. 16 */ 17 18 #define MAKE_RMI_REVISION(_major, _minor) (((_major) << UL(16)) | (_minor)) 19 #define RMI_ABI_VERSION_GET_MAJOR(_version) ((_version) >> UL(16)) 20 #define RMI_ABI_VERSION_GET_MINOR(_version) ((_version) & UL(0xFFFF)) 21 22 #define SMC64_RMI_FID(_offset) SMC64_STD_FID(RMI, _offset) 23 24 #define IS_SMC64_RMI_FID(_fid) IS_SMC64_STD_FAST_IN_RANGE(RMI, _fid) 25 26 /* Command completed successfully. index is zero. */ 27 #define RMI_SUCCESS U(0) 28 29 /* 30 * The value of a command input value caused the command to fail. 31 * Index is zero. 32 */ 33 #define RMI_ERROR_INPUT U(1) 34 35 /* 36 * An attribute of a Realm does not match the expected value. 37 * index varies between usages. 38 */ 39 #define RMI_ERROR_REALM U(2) 40 41 /* 42 * An attribute of a REC does not match the expected value. 43 * Index is zero. 44 */ 45 #define RMI_ERROR_REC U(3) 46 47 /* 48 * An RTT walk terminated before reaching the target RTT level, or reached 49 * an RTTE with an unexpected value. index: RTT level at which the walk 50 * terminated 51 */ 52 #define RMI_ERROR_RTT U(4) 53 54 /* The command is not supported */ 55 #define RMI_ERROR_NOT_SUPPORTED U(5) 56 57 /* An attribute of a device does not match the expected value */ 58 #define RMI_ERROR_DEVICE U(6) 59 60 /* RTTE in an auxiliary RTT contained an unexpected value */ 61 #define RMI_ERROR_RTT_AUX U(7) 62 63 /* Max number of RMI Status Errors. */ 64 #define RMI_ERROR_COUNT_MAX U(8) 65 66 /* 67 * The number of GPRs (starting from X0) that are 68 * configured by the host when a REC is created. 69 */ 70 #define REC_CREATE_NR_GPRS U(8) 71 72 #define REC_PARAMS_FLAG_RUNNABLE (UL(1) << 0) 73 74 /* 75 * The number of GPRs (starting from X0) per voluntary exit context. 76 * Per SMCCC. 77 */ 78 #define REC_EXIT_NR_GPRS U(31) 79 80 /* RmiHashAlgorithm type */ 81 #define RMI_HASH_SHA_256 0U 82 #define RMI_HASH_SHA_512 1U 83 84 /* Maximum number of Interrupt Controller List Registers */ 85 #define REC_GIC_NUM_LRS U(16) 86 87 #ifndef CBMC 88 /* Maximum number of auxiliary granules required for a REC */ 89 #define MAX_REC_AUX_GRANULES U(16) 90 #else /* CBMC */ 91 #define MAX_REC_AUX_GRANULES U(1) 92 #endif /* CBMC */ 93 94 /* Whether Host has completed emulation for an Emulatable Data Abort */ 95 #define REC_ENTRY_FLAG_EMUL_MMIO (UL(1) << 0) 96 97 /* Whether to inject a Synchronous External Abort into Realm */ 98 #define REC_ENTRY_FLAG_INJECT_SEA (UL(1) << 1) 99 100 /* Whether to trap WFI/WFE execution by Realm */ 101 #define REC_ENTRY_FLAG_TRAP_WFI (UL(1) << 2) 102 #define REC_ENTRY_FLAG_TRAP_WFE (UL(1) << 3) 103 104 /* Host response to RIPAS change request */ 105 #define REC_ENTRY_FLAG_RIPAS_RESPONSE (UL(1) << 4) 106 107 /* Host response to S2AP change request */ 108 #define REC_ENTRY_FLAG_S2AP_RESPONSE (UL(1) << 5) 109 110 /* Host response to device memory mapping validation request */ 111 #define REC_ENTRY_FLAG_DEV_MEM_RESPONSE (UL(1) << 6) 112 113 /* Whether to force control to return Plane 0 */ 114 #define REC_ENTRY_FLAG_FORCE_P0 (UL(1) << 7) 115 116 /* 117 * RmiRecExitReason represents the reason for a REC exit. 118 * This is returned to NS hosts via RMI_REC_ENTER::run_ptr. 119 */ 120 #define RMI_EXIT_SYNC U(0) 121 #define RMI_EXIT_IRQ U(1) 122 #define RMI_EXIT_FIQ U(2) 123 #define RMI_EXIT_PSCI U(3) 124 #define RMI_EXIT_RIPAS_CHANGE U(4) 125 #define RMI_EXIT_HOST_CALL U(5) 126 #define RMI_EXIT_SERROR U(6) 127 #define RMI_EXIT_S2AP_CHANGE U(7) 128 #define RMI_EXIT_VDEV_REQUEST U(8) 129 #define RMI_EXIT_VDEV_COMM U(9) 130 #define RMI_EXIT_DEV_MEM_MAP U(10) 131 132 /* RmiRttEntryState represents the state of an RTTE */ 133 #define RMI_UNASSIGNED UL(0) 134 #define RMI_ASSIGNED UL(1) 135 #define RMI_TABLE UL(2) 136 #define RMI_ASSIGNED_DEV UL(3) 137 138 /* RmiFeature enumerations */ 139 #define RMI_FEATURE_FALSE UL(0) 140 #define RMI_FEATURE_TRUE UL(1) 141 142 /* RmiFeatureRegister0 format */ 143 #define RMI_FEATURE_REGISTER_0_INDEX UL(0) 144 145 #define RMI_FEATURE_REGISTER_0_S2SZ_SHIFT UL(0) 146 #define RMI_FEATURE_REGISTER_0_S2SZ_WIDTH UL(8) 147 148 #define RMI_FEATURE_REGISTER_0_LPA2_SHIFT UL(8) 149 #define RMI_FEATURE_REGISTER_0_LPA2_WIDTH UL(1) 150 151 #define RMI_FEATURE_REGISTER_0_SVE_EN_SHIFT UL(9) 152 #define RMI_FEATURE_REGISTER_0_SVE_EN_WIDTH UL(1) 153 154 #define RMI_FEATURE_REGISTER_0_SVE_VL_SHIFT UL(10) 155 #define RMI_FEATURE_REGISTER_0_SVE_VL_WIDTH UL(4) 156 157 #define RMI_FEATURE_REGISTER_0_NUM_BPS_SHIFT UL(14) 158 #define RMI_FEATURE_REGISTER_0_NUM_BPS_WIDTH UL(6) 159 160 #define RMI_FEATURE_REGISTER_0_NUM_WPS_SHIFT UL(20) 161 #define RMI_FEATURE_REGISTER_0_NUM_WPS_WIDTH UL(6) 162 163 #define RMI_FEATURE_REGISTER_0_PMU_EN_SHIFT UL(26) 164 #define RMI_FEATURE_REGISTER_0_PMU_EN_WIDTH UL(1) 165 166 #define RMI_FEATURE_REGISTER_0_PMU_NUM_CTRS_SHIFT UL(27) 167 #define RMI_FEATURE_REGISTER_0_PMU_NUM_CTRS_WIDTH UL(5) 168 169 #define RMI_FEATURE_REGISTER_0_HASH_SHA_256_SHIFT UL(32) 170 #define RMI_FEATURE_REGISTER_0_HASH_SHA_256_WIDTH UL(1) 171 172 #define RMI_FEATURE_REGISTER_0_HASH_SHA_512_SHIFT UL(33) 173 #define RMI_FEATURE_REGISTER_0_HASH_SHA_512_WIDTH UL(1) 174 175 #define RMI_FEATURE_REGISTER_0_GICV3_NUM_LRS_SHIFT UL(34) 176 #define RMI_FEATURE_REGISTER_0_GICV3_NUM_LRS_WIDTH UL(4) 177 178 #define RMI_FEATURE_REGISTER_0_MAX_RECS_ORDER_SHIFT UL(38) 179 #define RMI_FEATURE_REGISTER_0_MAX_RECS_ORDER_WIDTH UL(4) 180 181 #define RMI_FEATURE_REGISTER_0_DA_EN_SHIFT UL(42) 182 #define RMI_FEATURE_REGISTER_0_DA_EN_WIDTH UL(1) 183 184 #define RMI_FEATURE_REGISTER_0_PLANE_RTT_SHIFT UL(43) 185 #define RMI_FEATURE_REGISTER_0_PLANE_RTT_WIDTH UL(2) 186 187 #define RMI_FEATURE_REGISTER_0_MAX_NUM_AUX_PLANES_SHIFT UL(45) 188 #define RMI_FEATURE_REGISTER_0_MAX_NUM_AUX_PLANES_WIDTH UL(4) 189 190 /* The RmiRipas enumeration represents realm IPA state */ 191 192 /* Address where no Realm resources are mapped */ 193 #define RMI_EMPTY UL(0) 194 195 /* Address where private code or data owned by the Realm is mapped */ 196 #define RMI_RAM UL(1) 197 198 /* Address which is inaccessible to the Realm due to an action taken by the Host */ 199 #define RMI_DESTROYED UL(2) 200 201 /* Address where memory of an assigned Realm device is mapped */ 202 #define RMI_DEV UL(3) 203 204 /* RmiPmuOverflowStatus enumeration representing PMU overflow status */ 205 #define RMI_PMU_OVERFLOW_NOT_ACTIVE U(0) 206 #define RMI_PMU_OVERFLOW_ACTIVE U(1) 207 208 /* 209 * RmiResponse enumeration represents whether the Host accepted 210 * or rejected a Realm request 211 */ 212 #define RMI_ACCEPT 0U 213 #define RMI_REJECT 1U 214 215 /* 216 * FID: 0xC4000150 217 * 218 * arg0: Requested interface version 219 * 220 * ret0: Command return status 221 * ret1: Lower implemented interface revision 222 * ret2: Higher implemented interface revision 223 */ 224 #define SMC_RMI_VERSION SMC64_RMI_FID(U(0x0)) 225 226 /* 227 * FID: 0xC4000151 228 * 229 * arg0 == target granule address 230 */ 231 #define SMC_RMI_GRANULE_DELEGATE SMC64_RMI_FID(U(0x1)) 232 233 /* 234 * FID: 0xC4000152 235 * 236 * arg0 == target granule address 237 */ 238 #define SMC_RMI_GRANULE_UNDELEGATE SMC64_RMI_FID(U(0x2)) 239 240 /* RmiDataMeasureContent type */ 241 #define RMI_NO_MEASURE_CONTENT U(0) 242 #define RMI_MEASURE_CONTENT U(1) 243 244 /* 245 * FID: 0xC4000153 246 * 247 * arg0 == RD address 248 * arg1 == data address 249 * arg2 == map address 250 * arg3 == SRC address 251 * arg4 == flags 252 */ 253 #define SMC_RMI_DATA_CREATE SMC64_RMI_FID(U(0x3)) 254 255 /* 256 * FID: 0xC4000154 257 * 258 * arg0 == RD address 259 * arg1 == data address 260 * arg2 == map address 261 */ 262 #define SMC_RMI_DATA_CREATE_UNKNOWN SMC64_RMI_FID(U(0x4)) 263 264 /* 265 * FID: 0xC4000155 266 * 267 * arg0 == RD address 268 * arg1 == map address 269 * 270 * ret1 == Address(PA) of the DATA granule, if ret0 == RMI_SUCCESS. 271 * Otherwise, undefined. 272 * ret2 == Top of the non-live address region. Only valid 273 * if ret0 == RMI_SUCCESS or ret0 == (RMI_ERROR_RTT, x) 274 */ 275 #define SMC_RMI_DATA_DESTROY SMC64_RMI_FID(U(0x5)) 276 277 /* 278 * FID: 0xC4000156 279 */ 280 #define SMC_RMI_PDEV_AUX_COUNT SMC64_RMI_FID(U(0x6)) 281 282 /* 283 * FID: 0xC4000157 284 * 285 * arg0 == RD address 286 */ 287 #define SMC_RMI_REALM_ACTIVATE SMC64_RMI_FID(U(0x7)) 288 289 /* 290 * FID: 0xC4000158 291 * 292 * arg0 == RD address 293 * arg1 == struct rmi_realm_params address 294 */ 295 #define SMC_RMI_REALM_CREATE SMC64_RMI_FID(U(0x8)) 296 297 /* 298 * FID: 0xC4000159 299 * 300 * arg0 == RD address 301 */ 302 #define SMC_RMI_REALM_DESTROY SMC64_RMI_FID(U(0x9)) 303 304 /* 305 * FID: 0xC400015A 306 * 307 * arg0 == RD address 308 * arg1 == REC address 309 * arg2 == struct rmm_rec address 310 */ 311 #define SMC_RMI_REC_CREATE SMC64_RMI_FID(U(0xA)) 312 313 /* 314 * FID: 0xC400015B 315 * 316 * arg0 == REC address 317 */ 318 #define SMC_RMI_REC_DESTROY SMC64_RMI_FID(U(0xB)) 319 320 /* 321 * FID: 0xC400015C 322 * 323 * arg0 == rec address 324 * arg1 == struct rec_run address 325 */ 326 #define SMC_RMI_REC_ENTER SMC64_RMI_FID(U(0xC)) 327 328 /* 329 * FID: 0xC400015D 330 * 331 * arg0 == RD address 332 * arg1 == RTT address 333 * arg2 == map address 334 * arg3 == level 335 */ 336 #define SMC_RMI_RTT_CREATE SMC64_RMI_FID(U(0xD)) 337 338 /* 339 * FID: 0xC400015E 340 * 341 * arg0 == RD address 342 * arg1 == map address 343 * arg2 == level 344 * 345 * ret1 == Address (PA) of the RTT, if ret0 == RMI_SUCCESS 346 * Otherwise, undefined. 347 * ret2 == Top of the non-live address region. Only valid 348 * if ret0 == RMI_SUCCESS or ret0 == (RMI_ERROR_RTT, x) 349 */ 350 #define SMC_RMI_RTT_DESTROY SMC64_RMI_FID(U(0xE)) 351 352 /* 353 * FID: 0xC400015F 354 * 355 * arg0 == RD address 356 * arg1 == map address 357 * arg2 == level 358 * arg3 == s2tte 359 */ 360 #define SMC_RMI_RTT_MAP_UNPROTECTED SMC64_RMI_FID(U(0xF)) 361 362 /* 363 * FID: 0xC4000160 364 */ 365 #define SMC_RMI_VDEV_AUX_COUNT SMC64_RMI_FID(U(0x10)) 366 367 /* 368 * FID: 0xC4000161 369 * 370 * arg0 == RD address 371 * arg1 == map address 372 * arg2 == level 373 * 374 * ret1 == level 375 * ret2 == s2tte type 376 * ret3 == s2tte 377 * ret4 == ripas 378 * if ret0 == RMI_SUCCESS, otherwise, undefined. 379 */ 380 #define SMC_RMI_RTT_READ_ENTRY SMC64_RMI_FID(U(0x11)) 381 382 /* 383 * FID: 0xC4000162 384 * 385 * arg0 == RD address 386 * arg1 == map address 387 * arg2 == level 388 * 389 * ret1 == Top of the non-live address region. Only valid 390 * if ret0 == RMI_SUCCESS or ret0 == (RMI_ERROR_RTT, x) 391 */ 392 #define SMC_RMI_RTT_UNMAP_UNPROTECTED SMC64_RMI_FID(U(0x12)) 393 394 /* 395 * FID: 0xC4000163 396 * 397 * arg0 == RD address 398 * arg1 == PA of the RD for the target Realm 399 * arg2 == PA of the target REC 400 * arg3 == Base of target IPA region 401 * arg4 == Top of target IPA region 402 */ 403 #define SMC_RMI_RTT_DEV_MEM_VALIDATE SMC64_RMI_FID(U(0x13)) 404 405 /* 406 * FID: 0xC4000164 407 * 408 * arg0 == calling rec address 409 * arg1 == target rec address 410 */ 411 #define SMC_RMI_PSCI_COMPLETE SMC64_RMI_FID(U(0x14)) 412 413 /* 414 * FID: 0xC4000165 415 * 416 * arg0 == Feature register index 417 */ 418 #define SMC_RMI_FEATURES SMC64_RMI_FID(U(0x15)) 419 420 /* 421 * FID: 0xC4000166 422 * 423 * arg0 == RD address 424 * arg1 == map address 425 * arg2 == level 426 * 427 * ret1 == Address(PA) of the RTT folded, if ret0 == RMI_SUCCESS 428 */ 429 #define SMC_RMI_RTT_FOLD SMC64_RMI_FID(U(0x16)) 430 431 /* 432 * FID: 0xC4000167 433 * 434 * arg0 == RD address 435 */ 436 #define SMC_RMI_REC_AUX_COUNT SMC64_RMI_FID(U(0x17)) 437 438 /* 439 * FID: 0xC4000168 440 * 441 * arg0 == RD address 442 * arg1 == start address 443 * arg2 == end address 444 * 445 * ret1 == Top of the address range where the RIPAS was updated, 446 * if ret0 == RMI_SUCCESS 447 */ 448 #define SMC_RMI_RTT_INIT_RIPAS SMC64_RMI_FID(U(0x18)) 449 450 /* 451 * FID: 0xC4000169 452 * 453 * arg0 == RD address 454 * arg1 == REC address 455 * arg2 == start address 456 * arg3 == end address 457 * 458 * ret1 == Top of the address range where the RIPAS was updated, 459 * if ret0 == RMI_SUCCESS 460 */ 461 #define SMC_RMI_RTT_SET_RIPAS SMC64_RMI_FID(U(0x19)) 462 463 /* 464 * TODO: Update the documentation of new FIDs once the 1.1 spec has stabilized. 465 */ 466 467 /* 468 * FID: 0xC400016A 469 */ 470 #define SMC_RMI_VSMMU_CREATE SMC64_RMI_FID(U(0x1A)) 471 472 /* 473 * FID: 0xC400016B 474 */ 475 #define SMC_RMI_VSMMU_DESTROY SMC64_RMI_FID(U(0x1B)) 476 477 /* 478 * FID: 0xC400016C 479 */ 480 #define SMC_RMI_VSMMU_MAP SMC64_RMI_FID(U(0x1C)) 481 482 /* 483 * FID: 0xC400016D 484 */ 485 #define SMC_RMI_VSMMU_UNMAP SMC64_RMI_FID(U(0x1D)) 486 487 /* 488 * FID: 0xC400016E 489 */ 490 #define SMC_RMI_PSMMU_MSI_CONFIG SMC64_RMI_FID(U(0x1E)) 491 492 /* 493 * FID: 0xC400016F 494 */ 495 #define SMC_RMI_PSMMU_IRQ_NOTIFY SMC64_RMI_FID(U(0x1F)) 496 497 /* 498 * FID: 0xC4000170 and 0xC4000171 are not used. 499 */ 500 501 /* 502 * FID: 0xC4000172 503 * 504 * arg0 == RD address 505 * arg1 == map address 506 * arg2 == level 507 * arg3 == PA of the target device memory 508 */ 509 #define SMC_RMI_DEV_MEM_MAP SMC64_RMI_FID(U(0x22)) 510 511 /* 512 * FID: 0xC4000173 513 * 514 * arg0 == RD address 515 * arg1 == map address 516 * arg2 == level 517 * 518 * ret1 == Address (PA) of the device memory granule, if ret0 == RMI_SUCCESS 519 * Otherwise, undefined. 520 * ret2 == Top of the non-live address region. Only valid 521 * if ret0 == RMI_SUCCESS or ret0 == (RMI_ERROR_RTT, x) 522 */ 523 #define SMC_RMI_DEV_MEM_UNMAP SMC64_RMI_FID(U(0x23)) 524 525 /* 526 * FID: 0xC4000174 527 */ 528 #define SMC_RMI_PDEV_ABORT SMC64_RMI_FID(U(0x24)) 529 530 /* 531 * FID: 0xC4000175 532 */ 533 #define SMC_RMI_PDEV_COMMUNICATE SMC64_RMI_FID(U(0x25)) 534 535 /* 536 * FID: 0xC4000176 537 */ 538 #define SMC_RMI_PDEV_CREATE SMC64_RMI_FID(U(0x26)) 539 540 /* 541 * FID: 0xC4000177 542 */ 543 #define SMC_RMI_PDEV_DESTROY SMC64_RMI_FID(U(0x27)) 544 545 /* 546 * FID: 0xC4000178 547 */ 548 #define SMC_RMI_PDEV_GET_STATE SMC64_RMI_FID(U(0x28)) 549 550 /* 551 * FID: 0xC4000179 552 */ 553 #define SMC_RMI_PDEV_IDE_RESET SMC64_RMI_FID(U(0x29)) 554 555 /* 556 * FID: 0xC400017A 557 */ 558 #define SMC_RMI_PDEV_NOTIFY SMC64_RMI_FID(U(0x2A)) 559 560 /* 561 * FID: 0xC400017B 562 */ 563 #define SMC_RMI_PDEV_SET_PUBKEY SMC64_RMI_FID(U(0x2B)) 564 565 /* 566 * FID: 0xC400017C 567 */ 568 #define SMC_RMI_PDEV_STOP SMC64_RMI_FID(U(0x2C)) 569 570 /* 571 * FID: 0xC400017D 572 */ 573 #define SMC_RMI_RTT_AUX_CREATE SMC64_RMI_FID(U(0x2D)) 574 575 /* 576 * FID: 0xC400017E 577 */ 578 #define SMC_RMI_RTT_AUX_DESTROY SMC64_RMI_FID(U(0x2E)) 579 580 /* 581 * FID: 0xC400017F 582 */ 583 #define SMC_RMI_RTT_AUX_FOLD SMC64_RMI_FID(U(0x2F)) 584 585 /* 586 * FID: 0xC4000180 587 */ 588 #define SMC_RMI_RTT_AUX_MAP_PROTECTED SMC64_RMI_FID(U(0x30)) 589 590 /* 591 * FID: 0xC4000181 592 */ 593 #define SMC_RMI_RTT_AUX_MAP_UNPROTECTED SMC64_RMI_FID(U(0x31)) 594 595 /* 596 * FID: 0xC4000182 is not used. 597 */ 598 599 /* 600 * FID: 0xC4000183 601 */ 602 #define SMC_RMI_RTT_AUX_UNMAP_PROTECTED SMC64_RMI_FID(U(0x33)) 603 604 /* 605 * FID: 0xC4000184 606 */ 607 #define SMC_RMI_RTT_AUX_UNMAP_UNPROTECTED SMC64_RMI_FID(U(0x34)) 608 609 /* 610 * FID: 0xC4000185 611 */ 612 #define SMC_RMI_VDEV_ABORT SMC64_RMI_FID(U(0x35)) 613 614 /* 615 * FID: 0xC4000186 616 */ 617 #define SMC_RMI_VDEV_COMMUNICATE SMC64_RMI_FID(U(0x36)) 618 619 /* 620 * FID: 0xC4000187 621 */ 622 #define SMC_RMI_VDEV_CREATE SMC64_RMI_FID(U(0x37)) 623 624 /* 625 * FID: 0xC4000188 626 */ 627 #define SMC_RMI_VDEV_DESTROY SMC64_RMI_FID(U(0x38)) 628 629 /* 630 * FID: 0xC4000189 631 */ 632 #define SMC_RMI_VDEV_GET_STATE SMC64_RMI_FID(U(0x39)) 633 634 /* 635 * FID: 0xC400018A 636 */ 637 #define SMC_RMI_VDEV_STOP SMC64_RMI_FID(U(0x3A)) 638 639 /* 640 * FID: 0xC400018B 641 */ 642 #define SMC_RMI_RTT_SET_S2AP SMC64_RMI_FID(U(0x3B)) 643 644 /* 645 * FID: 0xC400018C 646 */ 647 #define SMC_RMI_MEC_SET_SHARED SMC64_RMI_FID(U(0x3C)) 648 649 /* 650 * FID: 0xC400018D 651 */ 652 #define SMC_RMI_MEC_SET_PRIVATE SMC64_RMI_FID(U(0x3D)) 653 654 /* 655 * FID: 0xC400018E 656 */ 657 #define SMC_RMI_VDEV_COMPLETE SMC64_RMI_FID(U(0x3E)) 658 659 /* 660 * FID: 0xC400018F is not used. 661 */ 662 663 /* 664 * Revised 64-bit Arm CCA function ID range reservation is 665 * 0xC400_0150 - 0xC400_02CF 666 * 667 * Within this range RMI FIDs allocation is split in two ranges: 668 * 669 * 0xC4000150 - 0xC400018F - RMI FID range1 670 * 0xC4000190 - 0xC40001BF - RSI FID range 671 * 0xC40001C0 - 0xC40001C3 - RMI FID range2 672 * 673 * TODO: Currently RMM do not support RMI commands in FID range2. And also this 674 * FID allocation conflicts with RMM EL3 interface FIDs. Once RMM supports RMI 675 * commands in range2 (mainly P2P device communication) the RMI FID range2 will 676 * be enabled along with changes to RMM EL3 interface FIDs. 677 */ 678 679 /* 680 * FID: 0xC40001C0 681 */ 682 #define SMC_RMI_P2P_STREAM_ADD SMC64_RMI_FID(U(0x70)) 683 684 /* 685 * FID: 0xC40001C1 686 */ 687 #define SMC_RMI_P2P_STREAM_CREATE SMC64_RMI_FID(U(0x71)) 688 689 /* 690 * FID: 0xC40001C2 691 */ 692 #define SMC_RMI_STREAM_DESTROY SMC64_RMI_FID(U(0x72)) 693 694 /* 695 * FID: 0xC40001C3 696 */ 697 #define SMC_RMI_STREAM_REMOVE SMC64_RMI_FID(U(0x73)) 698 699 /* Size of Realm Personalization Value */ 700 #ifndef CBMC 701 #define RPV_SIZE 64 702 #else 703 /* 704 * Small RPV size so that `struct rd` fits in the reduced sized granule defined 705 * for CBMC 706 */ 707 #define RPV_SIZE 1 708 #endif 709 710 /* RmiRealmFlags format */ 711 #define RMI_REALM_FLAGS0_LPA2_SHIFT UL(0) 712 #define RMI_REALM_FLAGS0_LPA2_WIDTH UL(1) 713 714 #define RMI_REALM_FLAGS0_SVE_SHIFT UL(1) 715 #define RMI_REALM_FLAGS0_SVE_WIDTH UL(1) 716 717 #define RMI_REALM_FLAGS0_PMU_SHIFT UL(2) 718 #define RMI_REALM_FLAGS0_PMU_WIDTH UL(1) 719 720 #define RMI_REALM_FLAGS0_DA_SHIFT UL(3) 721 #define RMI_REALM_FLAGS0_DA_WIDTH UL(1) 722 723 #ifndef __ASSEMBLER__ 724 /* 725 * Defines member of structure and reserves space 726 * for the next member with specified offset. 727 */ 728 #define SET_MEMBER_RMI SET_MEMBER 729 730 /* 731 * The Realm attribute parameters are shared by the Host via 732 * RMI_REALM_CREATE::params_ptr. The values can be observed or modified 733 * either by the Host or by the Realm. 734 */ 735 struct rmi_realm_params { 736 /* RmiRealmFlags0 */ 737 SET_MEMBER_RMI(unsigned long flags0, 0, 0x8); 738 /* Requested IPA width */ 739 SET_MEMBER_RMI(unsigned int s2sz, 0x8, 0x10); 740 /* Requested SVE vector length */ 741 SET_MEMBER_RMI(unsigned int sve_vl, 0x10, 0x18); 742 /* Requested number of breakpoints */ 743 SET_MEMBER_RMI(unsigned int num_bps, 0x18, 0x20); 744 /* Requested number of watchpoints */ 745 SET_MEMBER_RMI(unsigned int num_wps, 0x20, 0x28); 746 /* Requested number of PMU counters */ 747 SET_MEMBER_RMI(unsigned int pmu_num_ctrs, 0x28, 0x30); 748 /* Measurement algorithm */ 749 SET_MEMBER_RMI(unsigned char algorithm, 0x30, 0x38); 750 /* Number of auxiliary Planes */ 751 SET_MEMBER_RMI(unsigned long num_aux_planes, 0x38, 0x400); 752 753 /* Realm Personalization Value */ 754 SET_MEMBER_RMI(unsigned char rpv[RPV_SIZE], 0x400, 0x440); 755 /* 756 * If ATS is enabled, determines the stage 2 translation used by devices 757 * assigned to the Realm. 758 */ 759 SET_MEMBER_RMI(unsigned long ats_plane, 0x440, 0x800); 760 761 /* Primary Virtual Machine Identifier */ 762 SET_MEMBER_RMI(unsigned short vmid, 0x800, 0x808); 763 /* Base address of primary RTT */ 764 SET_MEMBER_RMI(unsigned long rtt_base, 0x808, 0x810); 765 /* RTT starting level */ 766 SET_MEMBER_RMI(long rtt_level_start, 0x810, 0x818); 767 /* Number of starting level RTTs */ 768 SET_MEMBER_RMI(unsigned int rtt_num_start, 0x818, 0x820); 769 /* RmiRealmFlags1 */ 770 SET_MEMBER_RMI(unsigned long flags1, 0x820, 0x828); 771 /* MECID */ 772 SET_MEMBER_RMI(unsigned long mecid, 0x828, 0xf00); 773 774 /* Auxiliary Virtual Machine Identifiers */ 775 SET_MEMBER_RMI(unsigned short aux_vmid[3], 0xf00, 0xf80); 776 /* Base address of auxiliary RTTs */ 777 SET_MEMBER_RMI(unsigned short aux_rtt_base[3], 0xf80, 0x1000); 778 }; 779 780 /* 781 * The REC attribute parameters are shared by the Host via 782 * RMI_REC_CREATE::params_ptr. The values can be observed or modified 783 * either by the Host or by the Realm which owns the REC. 784 */ 785 struct rmi_rec_params { 786 /* Flags */ 787 SET_MEMBER_RMI(unsigned long flags, 0, 0x100); /* Offset 0 */ 788 /* MPIDR of the REC */ 789 SET_MEMBER_RMI(unsigned long mpidr, 0x100, 0x200); /* 0x100 */ 790 /* Program counter */ 791 SET_MEMBER_RMI(unsigned long pc, 0x200, 0x300); /* 0x200 */ 792 /* General-purpose registers */ 793 SET_MEMBER_RMI(unsigned long gprs[REC_CREATE_NR_GPRS], 0x300, 0x800); /* 0x300 */ 794 SET_MEMBER_RMI(struct { 795 /* Number of auxiliary Granules */ 796 unsigned long num_aux; /* 0x800 */ 797 /* Addresses of auxiliary Granules */ 798 unsigned long aux[MAX_REC_AUX_GRANULES];/* 0x808 */ 799 }, 0x800, 0x1000); 800 }; 801 802 /* 803 * Structure contains data passed from the Host to the RMM on REC entry 804 */ 805 struct rmi_rec_enter { 806 /* Flags */ 807 SET_MEMBER_RMI(unsigned long flags, 0, 0x200); /* Offset 0 */ 808 /* General-purpose registers */ 809 SET_MEMBER_RMI(unsigned long gprs[REC_EXIT_NR_GPRS], 0x200, 0x300); /* 0x200 */ 810 SET_MEMBER_RMI(struct { 811 /* GICv3 Hypervisor Control Register */ 812 unsigned long gicv3_hcr; /* 0x300 */ 813 /* GICv3 List Registers */ 814 unsigned long gicv3_lrs[REC_GIC_NUM_LRS]; /* 0x308 */ 815 }, 0x300, 0x800); 816 }; 817 818 /* 819 * RmiVdevAction 820 * Represents realm action which triggered REC exit due to device communication. 821 * Width: 8 bits 822 */ 823 #define RMI_VDEV_ACTION_GET_INTERFACE_REPORT U(0) 824 #define RMI_VDEV_ACTION_GET_MEASUREMENTS U(1) 825 #define RMI_VDEV_ACTION_LOCK U(2) 826 #define RMI_VDEV_ACTION_START U(3) 827 #define RMI_VDEV_ACTION_STOP U(4) 828 829 /* 830 * RmiRecExitFlags 831 * Fieldset contains flags provided by the RMM during REC exit. 832 * Width: 64 bits 833 */ 834 #define RMI_REC_EXIT_FLAGS_RIPAS_DEV_SHARED_SHIFT U(0) 835 #define RMI_REC_EXIT_FLAGS_RIPAS_DEV_SHARED_WIDTH U(1) 836 837 /* 838 * Structure contains data passed from the RMM to the Host on REC exit 839 */ 840 struct rmi_rec_exit { 841 /* Exit reason */ 842 SET_MEMBER_RMI(unsigned long exit_reason, 0, 0x8);/* Offset 0 */ 843 /* RmiRecExitFlags: Flags */ 844 SET_MEMBER_RMI(unsigned long flags, 0x8, 0x100);/* 0x8 */ 845 SET_MEMBER_RMI(struct { 846 /* Exception Syndrome Register */ 847 unsigned long esr; /* 0x100 */ 848 /* Fault Address Register */ 849 unsigned long far; /* 0x108 */ 850 /* Hypervisor IPA Fault Address register */ 851 unsigned long hpfar; /* 0x110 */ 852 }, 0x100, 0x200); 853 /* General-purpose registers */ 854 SET_MEMBER_RMI(unsigned long gprs[REC_EXIT_NR_GPRS], 0x200, 0x300); /* 0x200 */ 855 SET_MEMBER_RMI(struct { 856 /* GICv3 Hypervisor Control Register */ 857 unsigned long gicv3_hcr; /* 0x300 */ 858 /* GICv3 List Registers */ 859 unsigned long gicv3_lrs[REC_GIC_NUM_LRS]; /* 0x308 */ 860 /* GICv3 Maintenance Interrupt State Register */ 861 unsigned long gicv3_misr; /* 0x388 */ 862 /* GICv3 Virtual Machine Control Register */ 863 unsigned long gicv3_vmcr; /* 0x390 */ 864 }, 0x300, 0x400); 865 SET_MEMBER_RMI(struct { 866 /* Counter-timer Physical Timer Control Register */ 867 unsigned long cntp_ctl; /* 0x400 */ 868 /* Counter-timer Physical Timer CompareValue Register */ 869 unsigned long cntp_cval; /* 0x408 */ 870 /* Counter-timer Virtual Timer Control Register */ 871 unsigned long cntv_ctl; /* 0x410 */ 872 /* Counter-timer Virtual Timer CompareValue Register */ 873 unsigned long cntv_cval; /* 0x418 */ 874 }, 0x400, 0x500); 875 SET_MEMBER_RMI(struct { 876 /* Base address of pending RIPAS change */ 877 unsigned long ripas_base; /* 0x500 */ 878 /* Size of pending RIPAS change */ 879 unsigned long ripas_top; /* 0x508 */ 880 /* RIPAS value of pending RIPAS change */ 881 unsigned char ripas_value; /* 0x510 */ 882 /* Base addr of target region for pending S2AP change */ 883 unsigned long s2ap_base; /* 0x520 */ 884 /* Top addr of target region for pending S2AP change */ 885 unsigned long s2ap_top; /* 0x528 */ 886 /* Virtual device ID */ 887 unsigned long vdev_id; /* 0x530 */ 888 }, 0x500, 0x600); 889 890 /* Host call immediate value */ 891 SET_MEMBER_RMI(unsigned int imm, 0x600, 0x608); 892 /* UInt64: Plane Index */ 893 SET_MEMBER_RMI(unsigned long plane, 0x608, 0x610); 894 /* Address: VDEV which triggered REC exit due to device communication */ 895 SET_MEMBER_RMI(unsigned long vdev, 0x610, 0x618); 896 /* RmiVdevAction: Action which triggered REC exit due to device comm */ 897 SET_MEMBER_RMI(unsigned char vdev_action, 0x618, 0x620); 898 /* Bits64: Base IPA of target region for device mem mapping validation */ 899 SET_MEMBER_RMI(unsigned long dev_mem_base, 0x620, 0x628); 900 /* Bits64: Top IPA of target region for device mem mapping validation */ 901 SET_MEMBER_RMI(unsigned long dev_mem_top, 0x628, 0x630); 902 /* Address: Base PA of device memory region */ 903 SET_MEMBER_RMI(unsigned long dev_mem_pa, 0x630, 0x700); 904 905 /* PMU overflow status */ 906 SET_MEMBER_RMI(unsigned long pmu_ovf_status, 0x700, 0x800); 907 }; 908 909 /* 910 * Structure contains shared information between RMM and Host 911 * during REC entry and REC exit. 912 */ 913 struct rmi_rec_run { 914 /* Entry information */ 915 SET_MEMBER_RMI(struct rmi_rec_enter enter, 0, 0x800); /* Offset 0 */ 916 /* Exit information */ 917 SET_MEMBER_RMI(struct rmi_rec_exit exit, 0x800, 0x1000);/* 0x800 */ 918 }; 919 920 /* 921 * RmiPdevSpdm 922 * Represents whether communication with the device uses SPDM. 923 * Width: 1 bit 924 */ 925 #define RMI_PDEV_SPDM_FALSE U(0) 926 #define RMI_PDEV_SPDM_TRUE U(1) 927 928 /* 929 * RmiPdevIde 930 * Represents whether the link to the device is protected using IDE. 931 * Width: 1 bit 932 */ 933 #define RMI_PDEV_IDE_FALSE U(0) 934 #define RMI_PDEV_IDE_TRUE U(1) 935 936 /* 937 * RmiPdevCoherent 938 * Represents the device access is non-coherent or coherent 939 * Width: 1 bit 940 */ 941 #define RMI_PDEV_COHERENT_FALSE U(0) 942 #define RMI_PDEV_COHERENT_TRUE U(1) 943 944 /* 945 * RmiPdevFlags 946 * Fieldset contains flags provided by the Host during PDEV creation 947 * Width: 64 bits 948 */ 949 /* RmiPdevSpdm: Bit 0 */ 950 #define RMI_PDEV_FLAGS_SPDM_SHIFT UL(0) 951 #define RMI_PDEV_FLAGS_SPDM_WIDTH UL(1) 952 /* RmiPdevIde: Bit 1 */ 953 #define RMI_PDEV_FLAGS_IDE_SHIFT UL(1) 954 #define RMI_PDEV_FLAGS_IDE_WIDTH UL(1) 955 /* RmiPdevCoherent: Bit 2 */ 956 #define RMI_PDEV_FLAGS_COHERENT_SHIFT UL(2) 957 #define RMI_PDEV_FLAGS_COHERENT_WIDTH UL(1) 958 /* RmiFeature: Bit 3 */ 959 #define RMI_PDEV_FLAGS_P2P_SHIFT UL(3) 960 #define RMI_PDEV_FLAGS_P2P_WIDTH UL(1) 961 962 /* 963 * RmiPdevEvent 964 * Represents physical device event. 965 * Width: 8 bits 966 */ 967 #define RMI_PDEV_EVENT_IDE_KEY_REFRESH U(0) 968 969 /* 970 * RmiPdevState 971 * Represents the state of a PDEV 972 * Width: 8 bits 973 */ 974 #define RMI_PDEV_STATE_NEW U(0) 975 #define RMI_PDEV_STATE_NEEDS_KEY U(1) 976 #define RMI_PDEV_STATE_HAS_KEY U(2) 977 #define RMI_PDEV_STATE_READY U(3) 978 #define RMI_PDEV_STATE_IDE_RESETTING U(4) 979 #define RMI_PDEV_STATE_COMMUNICATING U(5) 980 #define RMI_PDEV_STATE_STOPPING U(6) 981 #define RMI_PDEV_STATE_STOPPED U(7) 982 #define RMI_PDEV_STATE_ERROR U(8) 983 984 /* 985 * RmiSignatureAlgorithm 986 * Represents signature algorithm used in PDEV set key RMI call. 987 * Width: 8 bits 988 */ 989 #define RMI_SIGNATURE_ALGORITHM_RSASSA_3072 U(0) 990 #define RMI_SIGNATURE_ALGORITHM_ECDSA_P256 U(1) 991 #define RMI_SIGNATURE_ALGORITHM_ECDSA_P384 U(2) 992 993 /* 994 * RmiDevCommEnterStatus (Name in Spec RmiDevCommStatus) 995 * Represents status passed from the Host to the RMM during device communication. 996 * Width: 8 bits 997 */ 998 #define RMI_DEV_COMM_ENTER_STATUS_NONE U(0) 999 #define RMI_DEV_COMM_ENTER_STATUS_RESPONSE U(1) 1000 #define RMI_DEV_COMM_ENTER_STATUS_ERROR U(2) 1001 1002 /* 1003 * RmiDevCommEnter 1004 * This structure contains data passed from the Host to the RMM during device 1005 * communication. 1006 * Width: 256 (0x100) bytes 1007 */ 1008 struct rmi_dev_comm_enter { 1009 /* RmiDevCommEnterStatus: Status of device transaction */ 1010 SET_MEMBER_RMI(unsigned char status, 0, 0x8); 1011 /* Address: Address of request buffer */ 1012 SET_MEMBER_RMI(unsigned long req_addr, 0x8, 0x10); 1013 /* Address: Address of response buffer */ 1014 SET_MEMBER_RMI(unsigned long resp_addr, 0x10, 0x18); 1015 /* UInt64: Amount of valid data in response buffer in bytes */ 1016 SET_MEMBER_RMI(unsigned long resp_len, 0x18, 0x100); 1017 }; 1018 1019 /* 1020 * RmiDevCommExitFlags 1021 * Fieldset contains flags provided by the RMM during a device transaction. 1022 * Width: 64 bits 1023 */ 1024 #define RMI_DEV_COMM_EXIT_FLAGS_CACHE_REQ_BIT UL(1) << 0 1025 #define RMI_DEV_COMM_EXIT_FLAGS_CACHE_RSP_BIT UL(1) << 1 1026 #define RMI_DEV_COMM_EXIT_FLAGS_SEND_BIT UL(1) << 2 1027 #define RMI_DEV_COMM_EXIT_FLAGS_WAIT_BIT UL(1) << 3 1028 #define RMI_DEV_COMM_EXIT_FLAGS_MULTI_BIT UL(1) << 4 1029 1030 /* 1031 * RmiDevCommObject 1032 * This represents identifier of a device communication object which the Host is 1033 * requested to cache. 1034 * Width: 8 bits 1035 */ 1036 #define RMI_DEV_COMM_OBJECT_VCA U(0) 1037 #define RMI_DEV_COMM_OBJECT_CERTIFICATE U(1) 1038 #define RMI_DEV_COMM_OBJECT_MEASUREMENTS U(2) 1039 #define RMI_DEV_COMM_OBJECT_INTERFACE_REPORT U(3) 1040 1041 /* 1042 * RmiDevCommProtocol 1043 * Represents the protocol used for device communication. 1044 * Width: 8 bits 1045 */ 1046 #define RMI_DEV_COMM_PROTOCOL_SPDM U(0) 1047 #define RMI_DEV_COMM_PROTOCOL_SECURE_SPDM U(1) 1048 1049 /* 1050 * RmiDevCommExit 1051 * This structure contains data passed from the RMM to the Host during device 1052 * communication. 1053 * Width: 256 (0x100) bytes. 1054 */ 1055 struct rmi_dev_comm_exit { 1056 /* 1057 * RmiDevCommExitFlags: Flags indicating the actions the host is 1058 * requested to perform 1059 */ 1060 SET_MEMBER_RMI(unsigned long flags, 0, 0x8); 1061 /* 1062 * UInt64: If flags.cache_req is true, offset in the device request 1063 * buffer to the start of data to be cached, in bytes 1064 */ 1065 SET_MEMBER_RMI(unsigned long cache_req_offset, 0x8, 0x10); 1066 /* 1067 * UInt64: If flags.cache_req is true, amount of device request data to 1068 * be cached, in bytes 1069 */ 1070 SET_MEMBER_RMI(unsigned long cache_req_len, 0x10, 0x18); 1071 /* 1072 * UInt64: If flags.cache_rsp is true, offset in the device response 1073 * buffer to the start of data to be cached, in bytes 1074 */ 1075 SET_MEMBER_RMI(unsigned long cache_rsp_offset, 0x18, 0x20); 1076 /* 1077 * UInt64: If flags.cache_rsp is true, amount of device response data to 1078 * be cached, in bytes. 1079 */ 1080 SET_MEMBER_RMI(unsigned long cache_rsp_len, 0x20, 0x28); 1081 /* 1082 * RmiDevCommObject: If flags.cache_req is true and / or flags.cache_rsp 1083 * is true, identifier for the object to be cachedIf flags.cache_rsp is 1084 * true, amount of device response data to be cached, in bytes. 1085 */ 1086 SET_MEMBER_RMI(unsigned char cache_obj_id, 0x28, 0x30); 1087 /* RmiDevCommProtocol: If flags.send is true, type of request */ 1088 SET_MEMBER_RMI(unsigned char protocol, 0x30, 0x38); 1089 /* 1090 * UInt64: If flags.send is true, amount of valid data in request buffer 1091 * in bytes 1092 */ 1093 SET_MEMBER_RMI(unsigned long req_len, 0x38, 0x40); 1094 /* 1095 * UInt64: If flags.wait is true, amount of time to wait for device 1096 * response in milliseconds 1097 */ 1098 SET_MEMBER_RMI(unsigned long timeout, 0x40, 0x100); 1099 }; 1100 1101 /* 1102 * RmiDevCommData 1103 * This structure contains data structure shared between Host and RMM for 1104 * device communication. 1105 * Width: 4096 (0x1000) bytes. 1106 */ 1107 #define RMI_DEV_COMM_ENTER_OFFSET 0x0 1108 #define RMI_DEV_COMM_EXIT_OFFSET 0x800 1109 #define RMI_DEV_COMM_DATA_SIZE 0x1000 1110 struct rmi_dev_comm_data { 1111 /* RmiDevCommEnter: Entry information */ 1112 SET_MEMBER_RMI(struct rmi_dev_comm_enter enter, 1113 RMI_DEV_COMM_ENTER_OFFSET, RMI_DEV_COMM_EXIT_OFFSET); 1114 /* RmiDevCommExit: Exit information */ 1115 SET_MEMBER_RMI(struct rmi_dev_comm_exit exit, 1116 RMI_DEV_COMM_EXIT_OFFSET, RMI_DEV_COMM_DATA_SIZE); 1117 }; 1118 1119 /* 1120 * RmiAddressRange 1121 * This structure contains base and top value of an address range. 1122 * Width: 16 (0x10) bytes. 1123 */ 1124 struct rmi_address_range { 1125 /* Address: Base of the address range (inclusive) */ 1126 SET_MEMBER_RMI(unsigned long base, 0, 0x8); 1127 /* Address: Top of the address range (exclusive) */ 1128 SET_MEMBER_RMI(unsigned long top, 0x8, 0x10); 1129 }; 1130 1131 /* 1132 * Maximum number of aux granules paramenter passed in rmi_pdev_params during 1133 * PDEV createto PDEV create 1134 */ 1135 #define PDEV_PARAM_AUX_GRANULES_MAX U(32) 1136 1137 #ifdef CBMC 1138 #define PDEV_PARAM_NCOH_ADDR_RANGE_MAX U(1) 1139 #else /* CBMC */ 1140 /* 1141 * Maximum number of device non-coherent RmiAddressRange parameter passed in 1142 * rmi_pdev_params during PDEV create 1143 */ 1144 #define PDEV_PARAM_NCOH_ADDR_RANGE_MAX U(16) 1145 #endif /* CBMC */ 1146 1147 /* 1148 * Maximum number of device coherent RmiAddressRange parameter passed in 1149 * rmi_pdev_params during PDEV create 1150 */ 1151 #define PDEV_PARAM_COH_ADDR_RANGE_MAX U(4) 1152 1153 /* 1154 * RmiPdevParams 1155 * This structure contains parameters provided by Host during PDEV creation. 1156 * Width: 4096 (0x1000) bytes. 1157 */ 1158 struct rmi_pdev_params { 1159 /* RmiPdevFlags: Flags */ 1160 SET_MEMBER_RMI(unsigned long flags, 0, 0x8); 1161 /* Bits64: Physical device identifier */ 1162 SET_MEMBER_RMI(unsigned long pdev_id, 0x8, 0x10); 1163 /* Bits8: Segment ID */ 1164 SET_MEMBER_RMI(unsigned char segment_id, 0x10, 0x18); 1165 /* Address: ECAM base address of the PCIe configuration space */ 1166 SET_MEMBER_RMI(unsigned long ecam_addr, 0x18, 0x20); 1167 /* Bits16: Root Port identifier */ 1168 SET_MEMBER_RMI(unsigned short root_id, 0x20, 0x28); 1169 /* UInt64: Certificate identifier */ 1170 SET_MEMBER_RMI(unsigned long cert_id, 0x28, 0x30); 1171 /* UInt16: Base requester ID range (inclusive) */ 1172 SET_MEMBER_RMI(unsigned short rid_base, 0x30, 0x38); 1173 /* UInt16: Top of requester ID range (exclusive) */ 1174 SET_MEMBER_RMI(unsigned short rid_top, 0x38, 0x40); 1175 /* RmiHashAlgorithm: Algorithm used to generate device digests */ 1176 SET_MEMBER_RMI(unsigned char hash_algo, 0x40, 0x48); 1177 /* UInt64: Number of auxiliary granules */ 1178 SET_MEMBER_RMI(unsigned long num_aux, 0x48, 0x50); 1179 /* UInt64: IDE stream identifier */ 1180 SET_MEMBER_RMI(unsigned long ide_sid, 0x50, 0x58); 1181 /* UInt64: Number of device non-coherent address ranges */ 1182 SET_MEMBER_RMI(unsigned long ncoh_num_addr_range, 0x58, 0x60); 1183 /* UInt64: Number of device coherent address ranges */ 1184 SET_MEMBER_RMI(unsigned long coh_num_addr_range, 0x60, 0x100); 1185 /* Address: Addresses of auxiliary granules */ 1186 SET_MEMBER_RMI(unsigned long aux[PDEV_PARAM_AUX_GRANULES_MAX], 0x100, 1187 0x200); 1188 /* RmiAddressRange: Device non-coherent address range */ 1189 SET_MEMBER_RMI(struct rmi_address_range 1190 ncoh_addr_range[PDEV_PARAM_NCOH_ADDR_RANGE_MAX], 1191 0x200, 0x300); 1192 /* RmiAddressRange: Device coherent address range */ 1193 SET_MEMBER_RMI(struct rmi_address_range 1194 coh_addr_range[PDEV_PARAM_COH_ADDR_RANGE_MAX], 1195 0x300, 0x1000); 1196 }; 1197 1198 /* Max length of public key data passed in rmi_public_key_params */ 1199 #define PUBKEY_PARAM_KEY_LEN_MAX U(1024) 1200 1201 /* Max length of public key metadata passed in rmi_public_key_params */ 1202 #define PUBKEY_PARAM_METADATA_LEN_MAX U(1024) 1203 1204 /* 1205 * RmiPublicKeyParams 1206 * This structure contains public key parameters. 1207 * Width: 4096 (0x1000) bytes. 1208 */ 1209 struct rmi_public_key_params { 1210 /* Bits8: Key data */ 1211 SET_MEMBER_RMI(unsigned char key[PUBKEY_PARAM_KEY_LEN_MAX], 0x0, 0x400); 1212 /* Bits8: Key metadata */ 1213 SET_MEMBER_RMI(unsigned char metadata[PUBKEY_PARAM_METADATA_LEN_MAX], 1214 0x400, 0x800); 1215 /* UInt64: Length of key data in bytes */ 1216 SET_MEMBER_RMI(unsigned long key_len, 0x800, 0x808); 1217 /* UInt64: Length of metadata in bytes */ 1218 SET_MEMBER_RMI(unsigned long metadata_len, 0x808, 0x810); 1219 /* RmiSignatureAlgorithm: Signature algorithm */ 1220 SET_MEMBER_RMI(unsigned char algo, 0x810, 0x1000); 1221 }; 1222 1223 /* 1224 * RmiVdevFlags 1225 * Fieldset contains flags provided by the Host during VDEV creation. 1226 * Width: 64 bits 1227 */ 1228 #define RMI_VDEV_FLAGS_RES0_SHIFT UL(0) 1229 #define RMI_VDEV_FLAGS_RES0_WIDTH UL(63) 1230 1231 /* 1232 * RmiVdevState 1233 * Represents the state of the VDEV 1234 * Width: 8 bits 1235 */ 1236 #define RMI_VDEV_STATE_READY U(0) 1237 #define RMI_VDEV_STATE_COMMUNICATING U(1) 1238 #define RMI_VDEV_STATE_STOPPING U(2) 1239 #define RMI_VDEV_STATE_STOPPED U(3) 1240 #define RMI_VDEV_STATE_ERROR U(4) 1241 1242 /* Maximum number of aux granules paramenter passed to VDEV create */ 1243 #define VDEV_PARAM_AUX_GRANULES_MAX U(32) 1244 1245 /* 1246 * RmiVdevParams 1247 * The RmiVdevParams structure contains parameters provided by the Host during 1248 * VDEV creation. 1249 * Width: 4096 (0x1000) bytes. 1250 */ 1251 struct rmi_vdev_params { 1252 /* RmiVdevFlags: Flags */ 1253 SET_MEMBER_RMI(unsigned long flags, 0, 0x8); 1254 /* Bits64: Virtual device identifier */ 1255 SET_MEMBER_RMI(unsigned long vdev_id, 0x8, 0x10); 1256 /* Bits64: TDI identifier */ 1257 SET_MEMBER_RMI(unsigned long tdi_id, 0x10, 0x18); 1258 /* UInt64: Number of auxiliary granules */ 1259 SET_MEMBER_RMI(unsigned long num_aux, 0x18, 0x100); 1260 1261 /* Address: Addresses of auxiliary granules */ 1262 SET_MEMBER_RMI(unsigned long aux[VDEV_PARAM_AUX_GRANULES_MAX], 0x100, 1263 0x1000); 1264 }; 1265 1266 /* Returns the higher supported RMI ABI revision */ 1267 unsigned long rmi_get_highest_supported_version(void); 1268 #endif /* __ASSEMBLER__ */ 1269 1270 #endif /* SMC_RMI_H */ 1271