X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=IntelSiliconPkg%2FFeature%2FVTd%2FIntelVTdPmrPei%2FIntelVTdPmrPei.h;h=499119d3ff19b21d3252fdeae05aa5c02fd0b974;hp=720f5d42c35f2073e24dcc9ed41ac625b912d9d5;hb=a1e7cd0b020ac024015095068b02e03a68edd96c;hpb=e5d847476ab6386bef4e3c70e76f5d26c606ed5e;ds=inline diff --git a/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.h b/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.h index 720f5d42c3..499119d3ff 100644 --- a/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.h +++ b/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.h @@ -16,6 +16,8 @@ #define __DMA_ACCESS_LIB_H__ typedef struct { + EFI_ACPI_DMAR_HEADER *AcpiDmarTable; + UINT64 EngineMask; UINT8 HostAddressWidth; UINTN VTdEngineCount; UINT64 VTdEngineAddress[1]; @@ -24,6 +26,7 @@ typedef struct { /** Set DMA protected region. + @param VTdInfo The VTd engine context information. @param EngineMask The mask of the VTd engine to be accessed. @param LowMemoryBase The protected low memory region base. @param LowMemoryLength The protected low memory region length. @@ -35,6 +38,7 @@ typedef struct { **/ EFI_STATUS SetDmaProtectedRange ( + IN VTD_INFO *VTdInfo, IN UINT64 EngineMask, IN UINT32 LowMemoryBase, IN UINT32 LowMemoryLength, @@ -45,38 +49,127 @@ SetDmaProtectedRange ( /** Diable DMA protection. + @param VTdInfo The VTd engine context information. @param EngineMask The mask of the VTd engine to be accessed. @retval DMA protection is disabled. **/ EFI_STATUS DisableDmaProtection ( + IN VTD_INFO *VTdInfo, + IN UINT64 EngineMask + ); + +/** + Return if the DMA protection is enabled. + + @param VTdInfo The VTd engine context information. + @param EngineMask The mask of the VTd engine to be accessed. + + @retval TRUE DMA protection is enabled in at least one VTd engine. + @retval FALSE DMA protection is disabled in all VTd engines. +**/ +UINT64 +GetDmaProtectionEnabledEngineMask ( + IN VTD_INFO *VTdInfo, IN UINT64 EngineMask ); /** Get protected low memory alignment. + @param VTdInfo The VTd engine context information. @param EngineMask The mask of the VTd engine to be accessed. @return protected low memory alignment. **/ UINT32 GetLowMemoryAlignment ( + IN VTD_INFO *VTdInfo, IN UINT64 EngineMask ); /** Get protected high memory alignment. + @param VTdInfo The VTd engine context information. @param EngineMask The mask of the VTd engine to be accessed. @return protected high memory alignment. **/ UINT64 GetHighMemoryAlignment ( + IN VTD_INFO *VTdInfo, + IN UINT64 EngineMask + ); + +/** + Enable VTd translation table protection. + + @param VTdInfo The VTd engine context information. + @param EngineMask The mask of the VTd engine to be accessed. +**/ +VOID +EnableVTdTranslationProtection ( + IN VTD_INFO *VTdInfo, + IN UINT64 EngineMask + ); + +/** + Disable VTd translation table protection. + + @param VTdInfo The VTd engine context information. + @param EngineMask The mask of the VTd engine to be accessed. +**/ +VOID +DisableVTdTranslationProtection ( + IN VTD_INFO *VTdInfo, IN UINT64 EngineMask ); +/** + Parse DMAR DRHD table. + + @param[in] AcpiDmarTable DMAR ACPI table + + @return EFI_SUCCESS The DMAR DRHD table is parsed. +**/ +EFI_STATUS +ParseDmarAcpiTableDrhd ( + IN EFI_ACPI_DMAR_HEADER *AcpiDmarTable + ); + +/** + Parse DMAR DRHD table. + + @param VTdInfo The VTd engine context information. +**/ +VOID +ParseDmarAcpiTableRmrr ( + IN VTD_INFO *VTdInfo + ); + +/** + Dump DMAR ACPI table. + + @param[in] Dmar DMAR ACPI table +**/ +VOID +DumpAcpiDMAR ( + IN EFI_ACPI_DMAR_HEADER *Dmar + ); + +/** + Get the highest memory. + + @return the highest memory. +**/ +UINT64 +GetTopMemory ( + VOID + ); + +extern EFI_GUID mVTdInfoGuid; + #endif