TianoCore EDK2 master
Loading...
Searching...
No Matches
TdxDxe.c File Reference

Go to the source code of this file.

Macros

#define ALIGNED_2MB_MASK   0x1fffff
 
#define INIT_PCDSET(NAME, RES)
 

Functions

EFI_STATUS EFIAPI TdxMemoryAccept (IN EDKII_MEMORY_ACCEPT_PROTOCOL *This, IN EFI_PHYSICAL_ADDRESS StartAddress, IN UINTN Size)
 
VOID SetPcdSettings (EFI_HOB_PLATFORM_INFO *PlatformInfoHob)
 
STATIC EFI_HOB_RESOURCE_DESCRIPTORGetResourceDescriptor (EFI_RESOURCE_TYPE Type, EFI_PHYSICAL_ADDRESS Start, EFI_PHYSICAL_ADDRESS End)
 
STATIC EFI_HOB_RESOURCE_DESCRIPTORGetHighestResourceDescriptor (EFI_RESOURCE_TYPE Type, EFI_PHYSICAL_ADDRESS End)
 
EFI_STATUS SetMmioSharedBit (VOID)
 
EFI_STATUS EFIAPI TdxDxeEntryPoint (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

EFI_HANDLE mTdxDxeHandle = NULL
 
EDKII_MEMORY_ACCEPT_PROTOCOL mMemoryAcceptProtocol
 

Detailed Description

TDX Dxe driver. This driver is dispatched early in DXE, due to being list in APRIORI.

This module is responsible for:

  • Sets max logical cpus based on TDINFO
  • Sets PCI PCDs based on resource hobs
  • Alter MATD table to record address of Mailbox

Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file TdxDxe.c.

Macro Definition Documentation

◆ ALIGNED_2MB_MASK

#define ALIGNED_2MB_MASK   0x1fffff

Definition at line 36 of file TdxDxe.c.

◆ INIT_PCDSET

#define INIT_PCDSET (   NAME,
  RES 
)
Value:
do {\
PcdStatus = PcdSet64S (NAME##Base, (RES)->PhysicalStart); \
ASSERT_RETURN_ERROR (PcdStatus); \
PcdStatus = PcdSet64S (NAME##Size, (RES)->ResourceLength); \
ASSERT_RETURN_ERROR (PcdStatus); \
} while(0)
#define PcdSet64S(TokenName, Value)
Definition: PcdLib.h:511

Function Documentation

◆ GetHighestResourceDescriptor()

STATIC EFI_HOB_RESOURCE_DESCRIPTOR * GetHighestResourceDescriptor ( EFI_RESOURCE_TYPE  Type,
EFI_PHYSICAL_ADDRESS  End 
)

Location of resource hob matching type and highest address below end

Parameters
[in]TypeThe type of resource hob to locate.
[in]EndThe resource hob return is the closest to the End address
Return values
pointerto resource Return pointer to a resource hob that matches or NULL.

Definition at line 237 of file TdxDxe.c.

◆ GetResourceDescriptor()

Location of resource hob matching type and starting address

Parameters
[in]TypeThe type of resource hob to locate.
[in]StartThe resource hob must at least begin at address.
Return values
pointerto resource Return pointer to a resource hob that matches or NULL.

Definition at line 190 of file TdxDxe.c.

◆ SetMmioSharedBit()

EFI_STATUS SetMmioSharedBit ( VOID  )

Set the shared bit for mmio region in Tdx guest.

In Tdx guest there are 2 ways to access mmio, TdVmcall or direct access. For direct access, the shared bit of the PageTableEntry should be set. The mmio region information is retrieved from hob list.

Return values
EFI_SUCCESSThe shared bit is set successfully.
EFI_UNSUPPORTEDSetting the shared bit of memory region is not supported

Definition at line 276 of file TdxDxe.c.

◆ SetPcdSettings()

VOID SetPcdSettings ( EFI_HOB_PLATFORM_INFO PlatformInfoHob)

Definition at line 126 of file TdxDxe.c.

◆ TdxDxeEntryPoint()

EFI_STATUS EFIAPI TdxDxeEntryPoint ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Definition at line 306 of file TdxDxe.c.

◆ TdxMemoryAccept()

EFI_STATUS EFIAPI TdxMemoryAccept ( IN EDKII_MEMORY_ACCEPT_PROTOCOL This,
IN EFI_PHYSICAL_ADDRESS  StartAddress,
IN UINTN  Size 
)

Definition at line 41 of file TdxDxe.c.

Variable Documentation

◆ mMemoryAcceptProtocol

EDKII_MEMORY_ACCEPT_PROTOCOL mMemoryAcceptProtocol
Initial value:
= {
TdxMemoryAccept
}

Definition at line 121 of file TdxDxe.c.

◆ mTdxDxeHandle

EFI_HANDLE mTdxDxeHandle = NULL

Definition at line 37 of file TdxDxe.c.