]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/VirtioNetDxe/SnpInitialize.c
OvmfPkg: VirtioNetDxe: fix some build errors emitted by Visual Studio
[mirror_edk2.git] / OvmfPkg / VirtioNetDxe / SnpInitialize.c
index 39282d9a4ac3c09bc4236356d4da625c9450e008..6cee014072e7ccd1121e9f5ad587151568b88afc 100644 (file)
@@ -120,7 +120,8 @@ VirtioNetInitTx (
 {\r
   UINTN PktIdx;\r
 \r
-  Dev->TxMaxPending = MIN (Dev->TxRing.QueueSize / 2, VNET_MAX_PENDING);\r
+  Dev->TxMaxPending = (UINT16) MIN (Dev->TxRing.QueueSize / 2,\r
+                                 VNET_MAX_PENDING);\r
   Dev->TxCurPending = 0;\r
   Dev->TxFreeStack  = AllocatePool (Dev->TxMaxPending *\r
                         sizeof *Dev->TxFreeStack);\r
@@ -141,7 +142,7 @@ VirtioNetInitTx (
     Dev->TxRing.Desc[DescIdx].Addr  = (UINTN) &Dev->TxSharedReq;\r
     Dev->TxRing.Desc[DescIdx].Len   = sizeof Dev->TxSharedReq;\r
     Dev->TxRing.Desc[DescIdx].Flags = VRING_DESC_F_NEXT;\r
-    Dev->TxRing.Desc[DescIdx].Next  = DescIdx + 1;\r
+    Dev->TxRing.Desc[DescIdx].Next  = (UINT16) (DescIdx + 1);\r
 \r
     //\r
     // The second descriptor of each pending TX packet is updated on the fly,\r
@@ -221,7 +222,7 @@ VirtioNetInitRx (
   // Limit the number of pending RX packets if the queue is big. The division\r
   // by two is due to the above "two descriptors per packet" trait.\r
   //\r
-  RxAlwaysPending = MIN (Dev->RxRing.QueueSize / 2, VNET_MAX_PENDING);\r
+  RxAlwaysPending = (UINT16) MIN (Dev->RxRing.QueueSize / 2, VNET_MAX_PENDING);\r
 \r
   Dev->RxBuf = AllocatePool (RxAlwaysPending * RxBufSize);\r
   if (Dev->RxBuf == NULL) {\r
@@ -261,11 +262,12 @@ VirtioNetInitRx (
     Dev->RxRing.Desc[DescIdx].Addr  = (UINTN) RxPtr;\r
     Dev->RxRing.Desc[DescIdx].Len   = sizeof (VIRTIO_NET_REQ);\r
     Dev->RxRing.Desc[DescIdx].Flags = VRING_DESC_F_WRITE | VRING_DESC_F_NEXT;\r
-    Dev->RxRing.Desc[DescIdx].Next  = DescIdx + 1;\r
+    Dev->RxRing.Desc[DescIdx].Next  = (UINT16) (DescIdx + 1);\r
     RxPtr += Dev->RxRing.Desc[DescIdx++].Len;\r
 \r
     Dev->RxRing.Desc[DescIdx].Addr  = (UINTN) RxPtr;\r
-    Dev->RxRing.Desc[DescIdx].Len   = RxBufSize - sizeof (VIRTIO_NET_REQ);\r
+    Dev->RxRing.Desc[DescIdx].Len   = (UINT32) (RxBufSize -\r
+                                                sizeof (VIRTIO_NET_REQ));\r
     Dev->RxRing.Desc[DescIdx].Flags = VRING_DESC_F_WRITE;\r
     RxPtr += Dev->RxRing.Desc[DescIdx++].Len;\r
   }\r