VirtualBox

Changeset 89503 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Jun 4, 2021 10:38:21 AM (4 years ago)
Author:
vboxsync
Message:

EFI/E1kNetDxe: Updates, the basic receive and transmit operations are functional and PXE booting seems to work with the limited testing done, include the driver in our image

Location:
trunk/src/VBox/Devices/EFI/Firmware
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/OvmfPkgIa32.dsc

    r85801 r89503  
    991991!endif
    992992  OvmfPkg/VirtioNetDxe/VirtioNet.inf
     993!ifdef $(VBOX)
     994  VBoxPkg/E1kNetDxe/E1kNet.inf
     995!endif
    993996
    994997  #
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/OvmfPkgIa32.fdf

    r85801 r89503  
    326326!include NetworkPkg/Network.fdf.inc
    327327  INF  OvmfPkg/VirtioNetDxe/VirtioNet.inf
     328!ifdef $(VBOX)
     329  INF  VBoxPkg/E1kNetDxe/E1kNet.inf
     330!endif
    328331
    329332#
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/OvmfPkgX64.dsc

    r85801 r89503  
    994994!endif
    995995  OvmfPkg/VirtioNetDxe/VirtioNet.inf
     996!ifdef $(VBOX)
     997  VBoxPkg/E1kNetDxe/E1kNet.inf
     998!endif
    996999
    9971000  #
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/OvmfPkgX64.fdf

    r85801 r89503  
    332332!include NetworkPkg/Network.fdf.inc
    333333  INF  OvmfPkg/VirtioNetDxe/VirtioNet.inf
     334!ifdef $(VBOX)
     335  INF  VBoxPkg/E1kNetDxe/E1kNet.inf
     336!endif
    334337
    335338#
  • trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/E1kNetDxe/Events.c

    r89462 r89503  
    4545  //
    4646  E1K_NET_DEV *Dev;
    47   //UINT16      RxCurUsed;
     47  UINT32      RdhCur;
    4848
    4949  Dev = Context;
     
    5252  }
    5353
    54 #if 0
    55   //
    56   // virtio-0.9.5, 2.4.2 Receiving Used Buffers From the Device
    57   //
    58   MemoryFence ();
    59   RxCurUsed = *Dev->RxRing.Used.Idx;
    60   MemoryFence ();
     54  E1kNetRegRead32(Dev, E1K_REG_RDH, &RdhCur);
    6155
    62   if (Dev->RxLastUsed != RxCurUsed) {
     56  if (Dev->RdhLastSeen != RdhCur) {
    6357    gBS->SignalEvent (Dev->Snp.WaitForPacket);
    6458  }
    65 #endif
    6659}
    6760
  • trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/E1kNetDxe/SnpInitialize.c

    r89462 r89503  
    44  any.
    55
     6  Copyright (c) 2021, Oracle and/or its affiliates.
     7  Copyright (c) 2017, AMD Inc, All rights reserved.
    68  Copyright (C) 2013, Red Hat, Inc.
    79  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
    8   Copyright (c) 2017, AMD Inc, All rights reserved.<BR>
    910
    1011  SPDX-License-Identifier: BSD-2-Clause-Patent
     
    146147  EFI_STATUS            Status;
    147148  UINTN                 RxBufSize;
    148   UINT16                RxAlwaysPending;
    149149  UINTN                 PktIdx;
    150150  UINTN                 NumBytes;
     
    161161
    162162  //
    163   // Limit the number of pending RX packets if the queue is big. The division
    164   // by two is due to the above "two descriptors per packet" trait.
    165   //
    166   RxAlwaysPending = E1K_NET_MAX_PENDING;
    167 
    168   //
    169163  // The RxBuf is shared between guest and hypervisor, use
    170164  // AllocateSharedPages() to allocate this memory region and map it with
     
    172166  // hypervisor.
    173167  //
    174   NumBytes = RxAlwaysPending * RxBufSize;
     168  NumBytes = E1K_NET_MAX_PENDING * RxBufSize;
    175169  Dev->RxBufNrPages = EFI_SIZE_TO_PAGES (NumBytes);
    176170  Status = Dev->PciIo->AllocateBuffer (
     
    201195
    202196  Dev->RxRing = RxBuffer;
    203   Dev->RxBuf  = (UINT8 *)RxBuffer + sizeof(*Dev->RxRing) * RxAlwaysPending;
     197  Dev->RxBuf  = (UINT8 *)RxBuffer + sizeof(*Dev->RxRing) * E1K_NET_MAX_PENDING;
    204198  Dev->RdhLastSeen = 0;
    205199
    206200  // Set up the RX descriptors.
    207   Dev->RxBufDeviceBase = Dev->RxDeviceBase + sizeof(*Dev->RxRing) * RxAlwaysPending;
     201  Dev->RxBufDeviceBase = Dev->RxDeviceBase + sizeof(*Dev->RxRing) * E1K_NET_MAX_PENDING;
    208202  RxBufDeviceAddress = Dev->RxBufDeviceBase;
    209   for (PktIdx = 0; PktIdx < RxAlwaysPending; ++PktIdx) {
     203  for (PktIdx = 0; PktIdx < E1K_NET_MAX_PENDING; ++PktIdx) {
    210204    Dev->RxRing[PktIdx].AddrBufferLow  = (UINT32)RxBufDeviceAddress;
    211205    Dev->RxRing[PktIdx].AddrBufferHigh = (UINT32)RShiftU64(RxBufDeviceAddress, 32);
     
    278272  EFI_STATUS  Status;
    279273
     274  DEBUG((DEBUG_INFO, "E1kNetInitialize:\n"));
     275
    280276  if (This == NULL) {
    281277    return EFI_INVALID_PARAMETER;
  • trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/E1kNetDxe/SnpReceive.c

    r89462 r89503  
    7676  UINT8       *RxPtr;
    7777  UINTN       RxBufOffset;
     78
     79  DEBUG((DEBUG_INFO, "E1kNetReceive: HeaderSize=%p BufferSize=%u Buffer=%p\n",
     80         HeaderSize, *BufferSize, Buffer));
    7881
    7982  if (This == NULL || BufferSize == NULL || Buffer == NULL) {
  • trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/E1kNetDxe/SnpSharedHelpers.c

    r89462 r89503  
    8686  Map Caller-supplied TxBuf buffer to the device-mapped address
    8787
    88   @param[in]    Dev               The VNET_DEV driver instance which wants to
     88  @param[in]    Dev               The E1K_NET_DEV driver instance which wants to
    8989                                  map the Tx packet.
    9090  @param[in]    Buffer            The system physical address of TxBuf
     
    177177  physical address
    178178
    179   @param[in]    Dev               The VNET_DEV driver instance which wants to
     179  @param[in]    Dev               The E1K_NET_DEV driver instance which wants to
    180180                                  reverse- and unmap the Tx packet.
    181181  @param[out]   Buffer            The system physical address of TxBuf
  • trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/E1kNetDxe/SnpShutdown.c

    r89462 r89503  
    4343  EFI_STATUS  Status;
    4444
     45  DEBUG((DEBUG_INFO, "E1kNetShutdown:\n"));
     46
    4547  if (This == NULL) {
    4648    return EFI_INVALID_PARAMETER;
     
    6062  }
    6163
    62 #if 0
    63   Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0);
    64   VirtioNetShutdownRx (Dev);
    65   VirtioNetShutdownTx (Dev);
    66   VirtioNetUninitRing (Dev, &Dev->TxRing, Dev->TxRingMap);
    67   VirtioNetUninitRing (Dev, &Dev->RxRing, Dev->RxRingMap);
    68 #endif
     64  E1kNetDevReset(Dev);
     65  E1kNetShutdownRx (Dev);
     66  E1kNetShutdownTx (Dev);
    6967
    7068  Dev->Snm.State = EfiSimpleNetworkStarted;
  • trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/E1kNetDxe/SnpTransmit.c

    r89462 r89503  
    7373  EFI_STATUS            Status;
    7474  EFI_PHYSICAL_ADDRESS  DeviceAddress;
     75
     76  DEBUG((DEBUG_INFO, "E1kNetTransmit: HeaderSize=%u BufferSize=%u Buffer=%p\n",
     77         HeaderSize, BufferSize, Buffer));
    7578
    7679  if (This == NULL || BufferSize == 0 || Buffer == NULL) {
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette