summaryrefslogtreecommitdiff
path: root/OvmfPkg/VirtioNetDxe
AgeCommit message (Collapse)Author
2014-09-25OvmfPkg: Fix VS2005 build warningsJordan Justen
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16171 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-12OvmfPkg: Virtio drivers: fix incorrect casts in init functionsLaszlo Ersek
The recent patch OvmfPkg: Make the VirtIo devices use the new VIRTIO_DEVICE_PROTOCOL was fixed up at commit time, in order to silence warnings issued by the Visual Studio compiler. Differences between the posted and committed patch: > diff --git a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c b/OvmfPkg/VirtioBlkDxe/VirtioBlk.c > -index 17b9f71..96a0d9f 100644 > +index 17b9f71..f09b0d1 100644 > --- a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c > +++ b/OvmfPkg/VirtioBlkDxe/VirtioBlk.c > @@ -23,7 +23,6 @@ > @@ -994,7 +998,7 @@ > + // step 4c -- Report GPFN (guest-physical frame number) of queue. > + // > + Status = Dev->VirtIo->SetQueueAddress (Dev->VirtIo, > -+ (UINTN) Dev->Ring.Base >> EFI_PAGE_SHIFT); > ++ (UINT32)(UINTN) Dev->Ring.Base >> EFI_PAGE_SHIFT); > + if (EFI_ERROR (Status)) { > + goto ReleaseQueue; > + } > @@ -1495,7 +1499,7 @@ > goto Exit; > } > diff --git a/OvmfPkg/VirtioNetDxe/SnpInitialize.c b/OvmfPkg/VirtioNetDxe/SnpInitialize.c > -index 6cee014..8dcf9da 100644 > +index 6cee014..4203fbd 100644 > --- a/OvmfPkg/VirtioNetDxe/SnpInitialize.c > +++ b/OvmfPkg/VirtioNetDxe/SnpInitialize.c > @@ -57,14 +57,15 @@ VirtioNetInitRing ( > @@ -1539,7 +1543,7 @@ > - Status = VIRTIO_CFG_WRITE (Dev, Generic.VhdrQueueAddress, > - (UINTN) Ring->Base >> EFI_PAGE_SHIFT); > + Status = Dev->VirtIo->SetQueueAddress (Dev->VirtIo, > -+ (UINTN) Ring->Base >> EFI_PAGE_SHIFT); > ++ (UINT32)(UINTN) Ring->Base >> EFI_PAGE_SHIFT); > if (EFI_ERROR (Status)) { > - VirtioRingUninit (Ring); > + goto ReleaseQueue; > @@ -1721,7 +1725,7 @@ > Exit: > gBS->RestoreTPL (OldTpl); > diff --git a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c > -index b836fb3..bcec676 100644 > +index b836fb3..2223c9c 100644 > --- a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c > +++ b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c > @@ -38,7 +38,6 @@ > @@ -1908,7 +1912,7 @@ > + // step 4c -- Report GPFN (guest-physical frame number) of queue. > + // > + Status = Dev->VirtIo->SetQueueAddress (Dev->VirtIo, > -+ (UINTN) Dev->Ring.Base >> EFI_PAGE_SHIFT); > ++ (UINT32)(UINTN) Dev->Ring.Base >> EFI_PAGE_SHIFT); > if (EFI_ERROR (Status)) { > goto ReleaseQueue; > } These casts are incorrect -- they throw away address bits >=32 before shifting, which can break the drivers in guests with more than 4GB RAM. The bug is clearly an artifact of the edk2 coding style, which requires cast expressions to be written as (type) expression rather than the usual (type)expression The latter correctly reflects that casts have one of the strongest bindings in C. The former actively obscures that fact. Cf. (type) expr1 >> expr2 vs. (type)expr1 >> expr2 Make sure we shift before we truncate. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14970 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-11OvmfPkg/Virtio: Removed VirtioReadDevice() / VirtIoWriteDevice() functionsOlivier Martin
These functions did not provide much more than the new protocol functions VIRTIO_DEVICE_PROTOCOL.ReadDevice() / VIRTIO_DEVICE_PROTOCOL.WriteDevice(). Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin <olivier.martin@arm.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Signed-off-by: Laszlo Ersek <lersek@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14968 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-11OvmfPkg: Make the VirtIo devices use the new VIRTIO_DEVICE_PROTOCOLOlivier Martin
This change replaces the accesses to the PCI bus from the Block, Scsi and Net drivers by the use of the new VIRTIO_DEVICE_PROTOCOL protocol that abstracts the transport layer. It means these drivers can be used on PCI and MMIO transport layer. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin <olivier.martin@arm.com> v5: - VirtioFlush(): update comment block in VirtioLib.[hc]; error code is propagated from VirtIo->SetQueueNotify(). - VirtioBlkInit(): jump to Failed label if SetPageSize() fails - VirtioBlkInit(): fixup comment, and add error handling, near SetQueueNum() call - VirtioBlkDriverBindingStart(): remove redundant (always false) check for a subsystem device ID different from VIRTIO_SUBSYSTEM_BLOCK_DEVICE; VirtioBlkDriverBindingSupported() handles it already - VirtioNetGetFeatures(): update stale comment block - VirtioNetGetFeatures(): retrieve MAC address byte for byte (open-coded loop) - VirtioNetDriverBindingStart(): remove redundant (always false) check for a subsystem device ID different from VIRTIO_SUBSYSTEM_NETWORK_CARD; VirtioNetDriverBindingSupported() handles it already - VirtioNetInitRing(): call SetQueueNum() and SetQueueAlign() for proper MMIO operation - VirtioNetInitialize(): fix destination error label for when SetPageSize() fails - VirtioScsi.c: fix comment block of VIRTIO_CFG_WRITE()/VIRTIO_CFG_READ() - VirtioScsiInit(): fix destination error label for when SetPageSize() fails - VirtioScsiInit(): call SetQueueNum() and SetQueueAlign() for proper MMIO operation Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14966 6f19259b-4bc3-4df7-8a09-765794883524
2013-09-30OvmfPkg: Removed magic values for the Virtio Sub-System ID in the PCI device ↵Olivier Martin
drivers Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin <olivier.martin@arm.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14742 6f19259b-4bc3-4df7-8a09-765794883524
2013-08-23OvmfPkg: Virtio: load used ring element strictly after loading used indexLaszlo Ersek
Enforce in-order execution of these steps even on not sequentially consistent architectures, as discussed in [1]. These changes should be unnecessary on x86 (the only architecture OVMF currently supports), but they align the OVMF virtio code with the virtio specification and could be necessary for future OVMF ports. [1] http://lists.linuxfoundation.org/pipermail/virtualization/2013-June/024547.html Suggested-by: Stefan Hajnoczi <stefanha@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14601 6f19259b-4bc3-4df7-8a09-765794883524
2013-06-14OvmfPkg/VirtioNetDxe: Fix build errors on VS2012 (IA32 & X64)Jordan Justen
These changes were needed in addition to the silence.patch that Laszlo posted on May 28. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Signed-off-by: Laszlo Ersek <lersek@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14420 6f19259b-4bc3-4df7-8a09-765794883524
2013-06-14OvmfPkg: VirtioNetDxe: fix some build errors emitted by Visual StudioLaszlo Ersek
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 <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14419 6f19259b-4bc3-4df7-8a09-765794883524
2013-06-14OvmfPkg: VirtioNetDxe: complete driver with INF fileLaszlo Ersek
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14418 6f19259b-4bc3-4df7-8a09-765794883524
2013-06-14OvmfPkg: VirtioNetDxe: WaitForPacket and EXIT_BOOT_SERVICES event callbacksLaszlo Ersek
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14417 6f19259b-4bc3-4df7-8a09-765794883524
2013-06-14OvmfPkg: VirtioNetDxe: definitions of unsupported SNP member functionsLaszlo Ersek
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14416 6f19259b-4bc3-4df7-8a09-765794883524
2013-06-14OvmfPkg: VirtioNetDxe: emulate Rx filter configuration: SNP.ReceiveFiltersLaszlo Ersek
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14415 6f19259b-4bc3-4df7-8a09-765794883524
2013-06-14OvmfPkg: VirtioNetDxe: map multicast IP to MAC: SNP.McastIpToMacLaszlo Ersek
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14414 6f19259b-4bc3-4df7-8a09-765794883524
2013-06-14OvmfPkg: VirtioNetDxe: implement Tx: SNP.Transmit and SNP.GetStatusLaszlo Ersek
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14413 6f19259b-4bc3-4df7-8a09-765794883524
2013-06-14OvmfPkg: VirtioNetDxe: SNP.ReceiveLaszlo Ersek
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14412 6f19259b-4bc3-4df7-8a09-765794883524
2013-06-14OvmfPkg: VirtioNetDxe: SNP.ShutdownLaszlo Ersek
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14411 6f19259b-4bc3-4df7-8a09-765794883524
2013-06-14OvmfPkg: VirtioNetDxe: add SNP.Initialize and shared dependenciesLaszlo Ersek
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14410 6f19259b-4bc3-4df7-8a09-765794883524
2013-06-14OvmfPkg: VirtioNetDxe: Simple Network Protocol members Start and StopLaszlo Ersek
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14409 6f19259b-4bc3-4df7-8a09-765794883524
2013-06-14OvmfPkg: VirtioNetDxe: driver bindingLaszlo Ersek
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14408 6f19259b-4bc3-4df7-8a09-765794883524
2013-06-14OvmfPkg: VirtioNetDxe: Component Name Protocol implementationLaszlo Ersek
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14407 6f19259b-4bc3-4df7-8a09-765794883524
2013-06-14OvmfPkg: VirtioNetDxe: add entry pointLaszlo Ersek
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14406 6f19259b-4bc3-4df7-8a09-765794883524
2013-06-14OvmfPkg: VirtioNetDxe: declarations and macro definitionsLaszlo Ersek
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14405 6f19259b-4bc3-4df7-8a09-765794883524
2013-06-14OvmfPkg: VirtioNetDxe: add technical notesLaszlo Ersek
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14404 6f19259b-4bc3-4df7-8a09-765794883524