Revision: 14419
http://sourceforge.net/p/edk2/code/14419
Author: jljusten
Date: 2013-06-14 07:40:59 +0000 (Fri, 14 Jun 2013)
Log Message:
-----------
OvmfPkg: VirtioNetDxe: fix some build errors emitted by Visual Studio
These were found with the gcc-4.4 option "-Wconversion" after Jordan
reported the build failure under Visual Studio. The patch was originally
posted to edk2-devel as "silence.patch":
http://thread.gmane.org/gmane.comp.bios.tianocore.devel/2804/focus=2972
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Modified Paths:
--------------
trunk/edk2/OvmfPkg/VirtioNetDxe/SnpInitialize.c
trunk/edk2/OvmfPkg/VirtioNetDxe/SnpReceive.c
Modified: trunk/edk2/OvmfPkg/VirtioNetDxe/SnpInitialize.c
===================================================================
--- trunk/edk2/OvmfPkg/VirtioNetDxe/SnpInitialize.c 2013-06-14 07:40:53 UTC
(rev 14418)
+++ trunk/edk2/OvmfPkg/VirtioNetDxe/SnpInitialize.c 2013-06-14 07:40:59 UTC
(rev 14419)
@@ -120,7 +120,8 @@
{
UINTN PktIdx;
- Dev->TxMaxPending = MIN (Dev->TxRing.QueueSize / 2, VNET_MAX_PENDING);
+ Dev->TxMaxPending = (UINT16) MIN (Dev->TxRing.QueueSize / 2,
+ VNET_MAX_PENDING);
Dev->TxCurPending = 0;
Dev->TxFreeStack = AllocatePool (Dev->TxMaxPending *
sizeof *Dev->TxFreeStack);
@@ -141,7 +142,7 @@
Dev->TxRing.Desc[DescIdx].Addr = (UINTN) &Dev->TxSharedReq;
Dev->TxRing.Desc[DescIdx].Len = sizeof Dev->TxSharedReq;
Dev->TxRing.Desc[DescIdx].Flags = VRING_DESC_F_NEXT;
- Dev->TxRing.Desc[DescIdx].Next = DescIdx + 1;
+ Dev->TxRing.Desc[DescIdx].Next = (UINT16) (DescIdx + 1);
//
// The second descriptor of each pending TX packet is updated on the fly,
@@ -221,7 +222,7 @@
// Limit the number of pending RX packets if the queue is big. The division
// by two is due to the above "two descriptors per packet" trait.
//
- RxAlwaysPending = MIN (Dev->RxRing.QueueSize / 2, VNET_MAX_PENDING);
+ RxAlwaysPending = (UINT16) MIN (Dev->RxRing.QueueSize / 2, VNET_MAX_PENDING);
Dev->RxBuf = AllocatePool (RxAlwaysPending * RxBufSize);
if (Dev->RxBuf == NULL) {
@@ -261,11 +262,12 @@
Dev->RxRing.Desc[DescIdx].Addr = (UINTN) RxPtr;
Dev->RxRing.Desc[DescIdx].Len = sizeof (VIRTIO_NET_REQ);
Dev->RxRing.Desc[DescIdx].Flags = VRING_DESC_F_WRITE | VRING_DESC_F_NEXT;
- Dev->RxRing.Desc[DescIdx].Next = DescIdx + 1;
+ Dev->RxRing.Desc[DescIdx].Next = (UINT16) (DescIdx + 1);
RxPtr += Dev->RxRing.Desc[DescIdx++].Len;
Dev->RxRing.Desc[DescIdx].Addr = (UINTN) RxPtr;
- Dev->RxRing.Desc[DescIdx].Len = RxBufSize - sizeof (VIRTIO_NET_REQ);
+ Dev->RxRing.Desc[DescIdx].Len = (UINT32) (RxBufSize -
+ sizeof (VIRTIO_NET_REQ));
Dev->RxRing.Desc[DescIdx].Flags = VRING_DESC_F_WRITE;
RxPtr += Dev->RxRing.Desc[DescIdx++].Len;
}
Modified: trunk/edk2/OvmfPkg/VirtioNetDxe/SnpReceive.c
===================================================================
--- trunk/edk2/OvmfPkg/VirtioNetDxe/SnpReceive.c 2013-06-14 07:40:53 UTC
(rev 14418)
+++ trunk/edk2/OvmfPkg/VirtioNetDxe/SnpReceive.c 2013-06-14 07:40:59 UTC
(rev 14419)
@@ -156,7 +156,7 @@
RxPtr += SIZE_OF_VNET (VhdrMac);
if (Protocol != NULL) {
- *Protocol = ((UINT16) RxPtr[0] << 8) | RxPtr[1];
+ *Protocol = (UINT16) ((RxPtr[0] << 8) | RxPtr[1]);
}
RxPtr += sizeof (UINT16);
@@ -169,7 +169,8 @@
// virtio-0.9.5, 2.4.1 Supplying Buffers to The Device
//
AvailIdx = *Dev->RxRing.Avail.Idx;
- Dev->RxRing.Avail.Ring[AvailIdx++ % Dev->RxRing.QueueSize] = DescIdx;
+ Dev->RxRing.Avail.Ring[AvailIdx++ % Dev->RxRing.QueueSize] =
+ (UINT16) DescIdx;
MemoryFence ();
*Dev->RxRing.Avail.Idx = AvailIdx;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits