]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/VirtioNetDxe/SnpTransmit.c
OvmfPkg/EnrollDefaultKeys: enroll PK/KEK1 from the Type 11 SMBIOS table
[mirror_edk2.git] / OvmfPkg / VirtioNetDxe / SnpTransmit.c
index 7ca40d5d06504b75e870aeab68c33cf3d9f047fc..2218139b33bd979fc2f2fe3236e9efd0a39b36c4 100644 (file)
@@ -5,13 +5,7 @@
   Copyright (C) 2013, Red Hat, Inc.\r
   Copyright (c) 2006 - 2013, Intel Corporation. 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
@@ -73,11 +67,12 @@ VirtioNetTransmit (
   IN UINT16                      *Protocol OPTIONAL\r
   )\r
 {\r
-  VNET_DEV   *Dev;\r
-  EFI_TPL    OldTpl;\r
-  EFI_STATUS Status;\r
-  UINT16     DescIdx;\r
-  UINT16     AvailIdx;\r
+  VNET_DEV              *Dev;\r
+  EFI_TPL               OldTpl;\r
+  EFI_STATUS            Status;\r
+  UINT16                DescIdx;\r
+  UINT16                AvailIdx;\r
+  EFI_PHYSICAL_ADDRESS  DeviceAddress;\r
 \r
   if (This == NULL || BufferSize == 0 || Buffer == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
@@ -143,11 +138,25 @@ VirtioNetTransmit (
     ASSERT ((UINTN) (Ptr - (UINT8 *) Buffer) == Dev->Snm.MediaHeaderSize);\r
   }\r
 \r
+  //\r
+  // Map the transmit buffer system physical address to device address.\r
+  //\r
+  Status = VirtioNetMapTxBuf (\r
+             Dev,\r
+             Buffer,\r
+             BufferSize,\r
+             &DeviceAddress\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    Status = EFI_DEVICE_ERROR;\r
+    goto Exit;\r
+  }\r
+\r
   //\r
   // virtio-0.9.5, 2.4.1 Supplying Buffers to The Device\r
   //\r
   DescIdx = Dev->TxFreeStack[Dev->TxCurPending++];\r
-  Dev->TxRing.Desc[DescIdx + 1].Addr  = (UINTN) Buffer;\r
+  Dev->TxRing.Desc[DescIdx + 1].Addr  = DeviceAddress;\r
   Dev->TxRing.Desc[DescIdx + 1].Len   = (UINT32) BufferSize;\r
 \r
   //\r