Ronak Kanabar | 1ae366f | 2023-06-07 01:21:56 +0530 | [diff] [blame^] | 1 | /** @file |
| 2 | TdxLib definitions |
| 3 | |
| 4 | Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.<BR> |
| 5 | SPDX-License-Identifier: BSD-2-Clause-Patent |
| 6 | |
| 7 | **/ |
| 8 | |
| 9 | #ifndef TDX_LIB_H_ |
| 10 | #define TDX_LIB_H_ |
| 11 | |
| 12 | /** |
| 13 | This function accepts a pending private page, and initialize the page to |
| 14 | all-0 using the TD ephemeral private key. |
| 15 | |
| 16 | @param[in] StartAddress Guest physical address of the private page |
| 17 | to accept. [63:52] and [11:0] must be 0. |
| 18 | @param[in] NumberOfPages Number of the pages to be accepted. |
| 19 | @param[in] PageSize GPA page size. Accept 2M/4K page size. |
| 20 | |
| 21 | @return EFI_SUCCESS |
| 22 | **/ |
| 23 | EFI_STATUS |
| 24 | EFIAPI |
| 25 | TdAcceptPages ( |
| 26 | IN UINT64 StartAddress, |
| 27 | IN UINT64 NumberOfPages, |
| 28 | IN UINT32 PageSize |
| 29 | ); |
| 30 | |
| 31 | /** |
| 32 | This function extends one of the RTMR measurement register |
| 33 | in TDCS with the provided extension data in memory. |
| 34 | RTMR extending supports SHA384 which length is 48 bytes. |
| 35 | |
| 36 | @param[in] Data Point to the data to be extended |
| 37 | @param[in] DataLen Length of the data. Must be 48 |
| 38 | @param[in] Index RTMR index |
| 39 | |
| 40 | @return EFI_SUCCESS |
| 41 | @return EFI_INVALID_PARAMETER |
| 42 | @return EFI_DEVICE_ERROR |
| 43 | |
| 44 | **/ |
| 45 | EFI_STATUS |
| 46 | EFIAPI |
| 47 | TdExtendRtmr ( |
| 48 | IN UINT32 *Data, |
| 49 | IN UINT32 DataLen, |
| 50 | IN UINT8 Index |
| 51 | ); |
| 52 | |
| 53 | /** |
| 54 | This function gets the Td guest shared page mask. |
| 55 | |
| 56 | The guest indicates if a page is shared using the Guest Physical Address |
| 57 | (GPA) Shared (S) bit. If the GPA Width(GPAW) is 48, the S-bit is bit-47. |
| 58 | If the GPAW is 52, the S-bit is bit-51. |
| 59 | |
| 60 | @return Shared page bit mask |
| 61 | **/ |
| 62 | UINT64 |
| 63 | EFIAPI |
| 64 | TdSharedPageMask ( |
| 65 | VOID |
| 66 | ); |
| 67 | |
| 68 | /** |
| 69 | This function gets the maximum number of Virtual CPUs that are usable for |
| 70 | Td Guest. |
| 71 | |
| 72 | @return maximum Virtual CPUs number |
| 73 | **/ |
| 74 | UINT32 |
| 75 | EFIAPI |
| 76 | TdMaxVCpuNum ( |
| 77 | VOID |
| 78 | ); |
| 79 | |
| 80 | /** |
| 81 | This function gets the number of Virtual CPUs that are usable for Td |
| 82 | Guest. |
| 83 | |
| 84 | @return Virtual CPUs number |
| 85 | **/ |
| 86 | UINT32 |
| 87 | EFIAPI |
| 88 | TdVCpuNum ( |
| 89 | VOID |
| 90 | ); |
| 91 | |
| 92 | #endif |