OvmfPkg/VirtioMmioDeviceLib: implement IOMMU-like member functions
[mirror_edk2.git] / OvmfPkg / Library / VirtioMmioDeviceLib / VirtioMmioDeviceFunctions.c
index 9142d4a162c06f43659aa57b649afe7e0226ed84..644ec65e1788b1e319d1f6c7bcf4ee33295cda17 100644 (file)
@@ -293,3 +293,60 @@ VirtioMmioDeviceRead (
 \r
   return EFI_SUCCESS;\r
 }\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+VirtioMmioAllocateSharedPages (\r
+  IN  VIRTIO_DEVICE_PROTOCOL  *This,\r
+  IN  UINTN                   NumPages,\r
+  OUT VOID                    **HostAddress\r
+  )\r
+{\r
+  VOID        *Buffer;\r
+\r
+  Buffer = AllocatePages (NumPages);\r
+  if (Buffer == NULL) {\r
+    return EFI_OUT_OF_RESOURCES;\r
+  }\r
+\r
+  *HostAddress = Buffer;\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+VirtioMmioFreeSharedPages (\r
+  IN  VIRTIO_DEVICE_PROTOCOL  *This,\r
+  IN  UINTN                   NumPages,\r
+  IN  VOID                    *HostAddress\r
+  )\r
+{\r
+  FreePages (HostAddress, NumPages);\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+VirtioMmioMapSharedBuffer (\r
+  IN      VIRTIO_DEVICE_PROTOCOL  *This,\r
+  IN      VIRTIO_MAP_OPERATION    Operation,\r
+  IN      VOID                    *HostAddress,\r
+  IN OUT  UINTN                   *NumberOfBytes,\r
+  OUT     EFI_PHYSICAL_ADDRESS    *DeviceAddress,\r
+  OUT     VOID                    **Mapping\r
+  )\r
+{\r
+  *DeviceAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) HostAddress;\r
+  *Mapping = NULL;\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+VirtioMmioUnmapSharedBuffer (\r
+  IN VIRTIO_DEVICE_PROTOCOL    *This,\r
+  IN VOID                      *Mapping\r
+  )\r
+{\r
+  return EFI_SUCCESS;\r
+}\r