From dc194ce36d04d3c99234f5c6e37ebe987758db4c Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Wed, 2 Aug 2017 11:26:42 +0200 Subject: [PATCH] OvmfPkg/IoMmuDxe: rename DeviceAddress to PlainTextAddress in MAP_INFO In this particular IOMMU driver, "DeviceAddress" is just as accessible to the CPU as "HostAddress", the difference is that the area pointed-to by the former is plain-text and accessible to the hypervisor. Rename "DeviceAddress" to "PlainTextAddress" in MAP_INFO. Cc: Ard Biesheuvel Cc: Brijesh Singh Cc: Jordan Justen Cc: Tom Lendacky Suggested-by: Ard Biesheuvel Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Tested-by: Brijesh Singh Reviewed-by: Brijesh Singh --- OvmfPkg/IoMmuDxe/AmdSevIoMmu.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c b/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c index edef0f41ee..fcb7bcfaec 100644 --- a/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c +++ b/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c @@ -25,7 +25,7 @@ typedef struct { UINTN NumberOfBytes; UINTN NumberOfPages; EFI_PHYSICAL_ADDRESS HostAddress; - EFI_PHYSICAL_ADDRESS DeviceAddress; + EFI_PHYSICAL_ADDRESS PlainTextAddress; } MAP_INFO; #define NO_MAPPING (VOID *) (UINTN) -1 @@ -145,7 +145,7 @@ IoMmuMap ( MapInfo->NumberOfBytes = *NumberOfBytes; MapInfo->NumberOfPages = EFI_SIZE_TO_PAGES (MapInfo->NumberOfBytes); MapInfo->HostAddress = PhysicalAddress; - MapInfo->DeviceAddress = DmaMemoryTop; + MapInfo->PlainTextAddress = DmaMemoryTop; // // Allocate a buffer to map the transfer to. @@ -154,7 +154,7 @@ IoMmuMap ( AllocateType, EfiBootServicesData, MapInfo->NumberOfPages, - &MapInfo->DeviceAddress + &MapInfo->PlainTextAddress ); if (EFI_ERROR (Status)) { FreePool (MapInfo); @@ -167,7 +167,7 @@ IoMmuMap ( // Status = MemEncryptSevClearPageEncMask ( 0, - MapInfo->DeviceAddress, + MapInfo->PlainTextAddress, MapInfo->NumberOfPages, TRUE ); @@ -181,7 +181,7 @@ IoMmuMap ( if (Operation == EdkiiIoMmuOperationBusMasterRead || Operation == EdkiiIoMmuOperationBusMasterRead64) { CopyMem ( - (VOID *) (UINTN) MapInfo->DeviceAddress, + (VOID *) (UINTN) MapInfo->PlainTextAddress, (VOID *) (UINTN) MapInfo->HostAddress, MapInfo->NumberOfBytes ); @@ -190,7 +190,7 @@ IoMmuMap ( // // The DeviceAddress is the address of the maped buffer below 4GB // - *DeviceAddress = MapInfo->DeviceAddress; + *DeviceAddress = MapInfo->PlainTextAddress; // // Return a pointer to the MAP_INFO structure in Mapping @@ -199,9 +199,9 @@ IoMmuMap ( DEBUG (( DEBUG_VERBOSE, - "%a Device 0x%Lx Host 0x%Lx Pages 0x%Lx Bytes 0x%Lx\n", + "%a PlainText 0x%Lx Host 0x%Lx Pages 0x%Lx Bytes 0x%Lx\n", __FUNCTION__, - MapInfo->DeviceAddress, + MapInfo->PlainTextAddress, MapInfo->HostAddress, MapInfo->NumberOfPages, MapInfo->NumberOfBytes @@ -256,16 +256,16 @@ IoMmuUnmap ( MapInfo->Operation == EdkiiIoMmuOperationBusMasterWrite64) { CopyMem ( (VOID *) (UINTN) MapInfo->HostAddress, - (VOID *) (UINTN) MapInfo->DeviceAddress, + (VOID *) (UINTN) MapInfo->PlainTextAddress, MapInfo->NumberOfBytes ); } DEBUG (( DEBUG_VERBOSE, - "%a Device 0x%Lx Host 0x%Lx Pages 0x%Lx Bytes 0x%Lx\n", + "%a PlainText 0x%Lx Host 0x%Lx Pages 0x%Lx Bytes 0x%Lx\n", __FUNCTION__, - MapInfo->DeviceAddress, + MapInfo->PlainTextAddress, MapInfo->HostAddress, MapInfo->NumberOfPages, MapInfo->NumberOfBytes @@ -275,7 +275,7 @@ IoMmuUnmap ( // Status = MemEncryptSevSetPageEncMask ( 0, - MapInfo->DeviceAddress, + MapInfo->PlainTextAddress, MapInfo->NumberOfPages, TRUE ); @@ -284,7 +284,7 @@ IoMmuUnmap ( // // Free the mapped buffer and the MAP_INFO structure. // - gBS->FreePages (MapInfo->DeviceAddress, MapInfo->NumberOfPages); + gBS->FreePages (MapInfo->PlainTextAddress, MapInfo->NumberOfPages); FreePool (Mapping); return EFI_SUCCESS; } -- 2.39.2