]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/IoMmuDxe: rename DeviceAddress to PlainTextAddress in MAP_INFO
authorLaszlo Ersek <lersek@redhat.com>
Wed, 2 Aug 2017 09:26:42 +0000 (11:26 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Fri, 4 Aug 2017 23:31:52 +0000 (01:31 +0200)
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 <ard.biesheuvel@linaro.org>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Suggested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Brijesh Singh <brijesh.singh@amd.com>
OvmfPkg/IoMmuDxe/AmdSevIoMmu.c

index edef0f41eecc89b43302dafd169a4787b21ac540..fcb7bcfaecc2fed3be771bcff7a310d068ddd804 100644 (file)
@@ -25,7 +25,7 @@ typedef struct {
   UINTN                                     NumberOfBytes;\r
   UINTN                                     NumberOfPages;\r
   EFI_PHYSICAL_ADDRESS                      HostAddress;\r
-  EFI_PHYSICAL_ADDRESS                      DeviceAddress;\r
+  EFI_PHYSICAL_ADDRESS                      PlainTextAddress;\r
 } MAP_INFO;\r
 \r
 #define NO_MAPPING             (VOID *) (UINTN) -1\r
@@ -145,7 +145,7 @@ IoMmuMap (
   MapInfo->NumberOfBytes     = *NumberOfBytes;\r
   MapInfo->NumberOfPages     = EFI_SIZE_TO_PAGES (MapInfo->NumberOfBytes);\r
   MapInfo->HostAddress       = PhysicalAddress;\r
-  MapInfo->DeviceAddress     = DmaMemoryTop;\r
+  MapInfo->PlainTextAddress  = DmaMemoryTop;\r
 \r
   //\r
   // Allocate a buffer to map the transfer to.\r
@@ -154,7 +154,7 @@ IoMmuMap (
                   AllocateType,\r
                   EfiBootServicesData,\r
                   MapInfo->NumberOfPages,\r
-                  &MapInfo->DeviceAddress\r
+                  &MapInfo->PlainTextAddress\r
                   );\r
   if (EFI_ERROR (Status)) {\r
     FreePool (MapInfo);\r
@@ -167,7 +167,7 @@ IoMmuMap (
   //\r
   Status = MemEncryptSevClearPageEncMask (\r
              0,\r
-             MapInfo->DeviceAddress,\r
+             MapInfo->PlainTextAddress,\r
              MapInfo->NumberOfPages,\r
              TRUE\r
              );\r
@@ -181,7 +181,7 @@ IoMmuMap (
   if (Operation == EdkiiIoMmuOperationBusMasterRead ||\r
       Operation == EdkiiIoMmuOperationBusMasterRead64) {\r
     CopyMem (\r
-      (VOID *) (UINTN) MapInfo->DeviceAddress,\r
+      (VOID *) (UINTN) MapInfo->PlainTextAddress,\r
       (VOID *) (UINTN) MapInfo->HostAddress,\r
       MapInfo->NumberOfBytes\r
       );\r
@@ -190,7 +190,7 @@ IoMmuMap (
   //\r
   // The DeviceAddress is the address of the maped buffer below 4GB\r
   //\r
-  *DeviceAddress = MapInfo->DeviceAddress;\r
+  *DeviceAddress = MapInfo->PlainTextAddress;\r
 \r
   //\r
   // Return a pointer to the MAP_INFO structure in Mapping\r
@@ -199,9 +199,9 @@ IoMmuMap (
 \r
   DEBUG ((\r
     DEBUG_VERBOSE,\r
-    "%a Device 0x%Lx Host 0x%Lx Pages 0x%Lx Bytes 0x%Lx\n",\r
+    "%a PlainText 0x%Lx Host 0x%Lx Pages 0x%Lx Bytes 0x%Lx\n",\r
     __FUNCTION__,\r
-    MapInfo->DeviceAddress,\r
+    MapInfo->PlainTextAddress,\r
     MapInfo->HostAddress,\r
     MapInfo->NumberOfPages,\r
     MapInfo->NumberOfBytes\r
@@ -256,16 +256,16 @@ IoMmuUnmap (
       MapInfo->Operation == EdkiiIoMmuOperationBusMasterWrite64) {\r
     CopyMem (\r
       (VOID *) (UINTN) MapInfo->HostAddress,\r
-      (VOID *) (UINTN) MapInfo->DeviceAddress,\r
+      (VOID *) (UINTN) MapInfo->PlainTextAddress,\r
       MapInfo->NumberOfBytes\r
       );\r
   }\r
 \r
   DEBUG ((\r
     DEBUG_VERBOSE,\r
-    "%a Device 0x%Lx Host 0x%Lx Pages 0x%Lx Bytes 0x%Lx\n",\r
+    "%a PlainText 0x%Lx Host 0x%Lx Pages 0x%Lx Bytes 0x%Lx\n",\r
     __FUNCTION__,\r
-    MapInfo->DeviceAddress,\r
+    MapInfo->PlainTextAddress,\r
     MapInfo->HostAddress,\r
     MapInfo->NumberOfPages,\r
     MapInfo->NumberOfBytes\r
@@ -275,7 +275,7 @@ IoMmuUnmap (
   //\r
   Status = MemEncryptSevSetPageEncMask (\r
              0,\r
-             MapInfo->DeviceAddress,\r
+             MapInfo->PlainTextAddress,\r
              MapInfo->NumberOfPages,\r
              TRUE\r
              );\r
@@ -284,7 +284,7 @@ IoMmuUnmap (
   //\r
   // Free the mapped buffer and the MAP_INFO structure.\r
   //\r
-  gBS->FreePages (MapInfo->DeviceAddress, MapInfo->NumberOfPages);\r
+  gBS->FreePages (MapInfo->PlainTextAddress, MapInfo->NumberOfPages);\r
   FreePool (Mapping);\r
   return EFI_SUCCESS;\r
 }\r