]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/VirtioScsiDxe/VirtioScsi.c
OvmfPkg/Virtio: Fix few typos
[mirror_edk2.git] / OvmfPkg / VirtioScsiDxe / VirtioScsi.c
index aa22f85be83a9ec3988ab65ab42207689c41a456..935d15439579dbececfaac87875d3b70d46e2983 100644 (file)
     unreasonable for now.\r
 \r
   Copyright (C) 2012, Red Hat, Inc.\r
-  Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>\r
   Copyright (c) 2017, AMD Inc, All rights reserved.<BR>\r
 \r
-  This program and the accompanying materials are licensed and made available\r
-  under the terms and conditions of the BSD License which accompanies this\r
-  distribution. The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT\r
-  WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -455,6 +449,15 @@ VirtioScsiPassThru (
   UINTN                     InDataNumPages;\r
   BOOLEAN                   OutDataBufferIsMapped;\r
 \r
+  //\r
+  // Set InDataMapping,OutDataMapping,InDataDeviceAddress and OutDataDeviceAddress to\r
+  // suppress incorrect compiler/analyzer warnings.\r
+  //\r
+  InDataMapping        = NULL;\r
+  OutDataMapping       = NULL;\r
+  InDataDeviceAddress  = 0;\r
+  OutDataDeviceAddress = 0;\r
+\r
   ZeroMem ((VOID*) &Request, sizeof (Request));\r
 \r
   Dev = VIRTIO_SCSI_FROM_PASS_THRU (This);\r
@@ -494,7 +497,7 @@ VirtioScsiPassThru (
     //  * we perform the request fine\r
     //  * but we fail to unmap the "InDataMapping"\r
     //\r
-    // In that case simply returing the EFI_DEVICE_ERROR is not sufficient. In\r
+    // In that case simply returning the EFI_DEVICE_ERROR is not sufficient. In\r
     // addition to the error code we also need to update Packet fields\r
     // accordingly so that we report the full loss of the incoming transfer.\r
     //\r
@@ -1016,7 +1019,8 @@ VirtioScsiInit (
     goto Failed;\r
   }\r
 \r
-  Features &= VIRTIO_SCSI_F_INOUT | VIRTIO_F_VERSION_1;\r
+  Features &= VIRTIO_SCSI_F_INOUT | VIRTIO_F_VERSION_1 |\r
+              VIRTIO_F_IOMMU_PLATFORM;\r
 \r
   //\r
   // In virtio-1.0, feature negotiation is expected to complete before queue\r
@@ -1096,7 +1100,7 @@ VirtioScsiInit (
   // step 5 -- Report understood features and guest-tuneables.\r
   //\r
   if (Dev->VirtIo->Revision < VIRTIO_SPEC_REVISION (1, 0, 0)) {\r
-    Features &= ~(UINT64)VIRTIO_F_VERSION_1;\r
+    Features &= ~(UINT64)(VIRTIO_F_VERSION_1 | VIRTIO_F_IOMMU_PLATFORM);\r
     Status = Dev->VirtIo->SetGuestFeatures (Dev->VirtIo, Features);\r
     if (EFI_ERROR (Status)) {\r
       goto UnmapQueue;\r
@@ -1222,6 +1226,7 @@ VirtioScsiExitBoot (
 {\r
   VSCSI_DEV *Dev;\r
 \r
+  DEBUG ((DEBUG_VERBOSE, "%a: Context=0x%p\n", __FUNCTION__, Context));\r
   //\r
   // Reset the device. This causes the hypervisor to forget about the virtio\r
   // ring.\r
@@ -1231,12 +1236,6 @@ VirtioScsiExitBoot (
   //\r
   Dev = Context;\r
   Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0);\r
-\r
-  //\r
-  // Unmap the ring buffer so that hypervisor will not be able to get\r
-  // readable data after device reset.\r
-  //\r
-  Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Dev->RingMap);\r
 }\r
 \r
 \r