VirtualBox

Ignore:
Timestamp:
Mar 12, 2019 12:40:12 PM (6 years ago)
Author:
vboxsync
Message:

EFI: First step in UDK2018 merge. Does not build yet.

Location:
trunk/src/VBox/Devices/EFI/FirmwareNew
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/FirmwareNew

  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c

    r58459 r77662  
    22  Help functions to access UDP service, it is used by both the DHCP and MTFTP.
    33
    4 Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>
     4Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
    55This program and the accompanying materials
    66are licensed and made available under the terms and conditions of the BSD License
     
    216216  //
    217217  if (RxToken->UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) {
     218    if (((EFI_UDP4_RECEIVE_DATA *) RxData)->DataLength == 0) {
     219      //
     220      // Discard zero length data payload packet.
     221      //
     222      goto Resume;
     223    }
    218224
    219225    Netbuf = NetbufFromExt (
     
    253259    EndPoint.RemoteAddr.Addr[0] = NTOHL (EndPoint.RemoteAddr.Addr[0]);
    254260  } else {
     261    if (((EFI_UDP6_RECEIVE_DATA *) RxData)->DataLength == 0) {
     262      //
     263      // Discard zero length data payload packet.
     264      //
     265      goto Resume;
     266    }
    255267
    256268    Netbuf = NetbufFromExt (
     
    292304
    293305  RxToken->CallBack (Netbuf, &EndPoint, EFI_SUCCESS, RxToken->Context);
     306  return;
     307
     308Resume:
     309  if (RxToken->UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) {
     310    gBS->SignalEvent (((EFI_UDP4_RECEIVE_DATA *) RxData)->RecycleSignal);
     311    RxToken->UdpIo->Protocol.Udp4->Receive (RxToken->UdpIo->Protocol.Udp4, &RxToken->Token.Udp4);
     312  } else {
     313    gBS->SignalEvent (((EFI_UDP6_RECEIVE_DATA *) RxData)->RecycleSignal);
     314    RxToken->UdpIo->Protocol.Udp6->Receive (RxToken->UdpIo->Protocol.Udp6, &RxToken->Token.Udp6);
     315  }
    294316}
    295317
     
    389411  Wrap a transmit request into a new created UDP_TX_TOKEN.
    390412
     413  If Packet is NULL, then ASSERT().
     414  If Udp version is not UDP_IO_UDP4_VERSION or UDP_IO_UDP6_VERSION, then ASSERT().
     415
    391416  @param[in]  UdpIo                 The UdpIo to send packet to.
    392417  @param[in]  Packet                The user's packet.
     
    558583  Creates a UDP_IO to access the UDP service. It creates and configures
    559584  a UDP child.
     585
     586  If Configure is NULL, then ASSERT().
     587  If Udp version is not UDP_IO_UDP4_VERSION or UDP_IO_UDP6_VERSION, then ASSERT().
    560588
    561589  It locates the UDP service binding prototype on the Controller parameter
     
    728756/**
    729757  Cancel all the sent datagram that pass the selection criteria of ToCancel.
     758
    730759  If ToCancel is NULL, all the datagrams are cancelled.
     760  If Udp version is not UDP_IO_UDP4_VERSION or UDP_IO_UDP6_VERSION, then ASSERT().
    731761
    732762  @param[in]  UdpIo                 The UDP_IO to cancel packet.
     
    743773  IN EFI_STATUS             IoStatus,
    744774  IN UDP_IO_TO_CANCEL       ToCancel,        OPTIONAL
    745   IN VOID                   *Context
     775  IN VOID                   *Context         OPTIONAL
    746776  )
    747777{
     
    770800  Free the UDP_IO and all its related resources.
    771801
     802  If Udp version is not UDP_IO_UDP4_VERSION or UDP_IO_UDP6_VERSION, then ASSERT().
     803
    772804  The function will cancel all sent datagram and receive request.
    773805
     
    775807
    776808  @retval EFI_SUCCESS           The UDP_IO is freed.
     809  @retval Others                Failed to free UDP_IO.
    777810
    778811**/
     
    783816  )
    784817{
     818  EFI_STATUS           Status;
    785819  UDP_RX_TOKEN         *RxToken;
    786820
     
    801835
    802836    if ((RxToken = UdpIo->RecvRequest) != NULL) {
    803       UdpIo->Protocol.Udp4->Cancel (UdpIo->Protocol.Udp4, &RxToken->Token.Udp4);
     837      Status = UdpIo->Protocol.Udp4->Cancel (UdpIo->Protocol.Udp4, &RxToken->Token.Udp4);
     838      if (EFI_ERROR (Status)) {
     839        return Status;
     840      }
    804841    }
    805842
     
    807844    // Close then destroy the Udp4 child
    808845    //
    809     gBS->CloseProtocol (
    810            UdpIo->UdpHandle,
    811            &gEfiUdp4ProtocolGuid,
    812            UdpIo->Image,
    813            UdpIo->Controller
    814            );
    815 
    816     NetLibDestroyServiceChild (
    817       UdpIo->Controller,
    818       UdpIo->Image,
    819       &gEfiUdp4ServiceBindingProtocolGuid,
    820       UdpIo->UdpHandle
    821       );
     846    Status = gBS->CloseProtocol (
     847                    UdpIo->UdpHandle,
     848                    &gEfiUdp4ProtocolGuid,
     849                    UdpIo->Image,
     850                    UdpIo->Controller
     851                    );
     852    if (EFI_ERROR (Status)) {
     853      return Status;
     854    }
     855
     856    Status = NetLibDestroyServiceChild (
     857               UdpIo->Controller,
     858               UdpIo->Image,
     859               &gEfiUdp4ServiceBindingProtocolGuid,
     860               UdpIo->UdpHandle
     861               );
     862    if (EFI_ERROR (Status)) {
     863      return Status;
     864    }
    822865
    823866  } else {
    824867
    825868    if ((RxToken = UdpIo->RecvRequest) != NULL) {
    826       UdpIo->Protocol.Udp6->Cancel (UdpIo->Protocol.Udp6, &RxToken->Token.Udp6);
     869      Status = UdpIo->Protocol.Udp6->Cancel (UdpIo->Protocol.Udp6, &RxToken->Token.Udp6);
     870      if (EFI_ERROR (Status)) {
     871        return Status;
     872      }
    827873    }
    828874
     
    830876    // Close then destroy the Udp6 child
    831877    //
    832     gBS->CloseProtocol (
    833            UdpIo->UdpHandle,
    834            &gEfiUdp6ProtocolGuid,
    835            UdpIo->Image,
    836            UdpIo->Controller
    837            );
    838 
    839     NetLibDestroyServiceChild (
    840       UdpIo->Controller,
    841       UdpIo->Image,
    842       &gEfiUdp6ServiceBindingProtocolGuid,
    843       UdpIo->UdpHandle
    844       );
    845     }
     878    Status = gBS->CloseProtocol (
     879               UdpIo->UdpHandle,
     880               &gEfiUdp6ProtocolGuid,
     881               UdpIo->Image,
     882               UdpIo->Controller
     883               );
     884    if (EFI_ERROR (Status)) {
     885      return Status;
     886    }
     887
     888    Status = NetLibDestroyServiceChild (
     889               UdpIo->Controller,
     890               UdpIo->Image,
     891               &gEfiUdp6ServiceBindingProtocolGuid,
     892               UdpIo->UdpHandle
     893               );
     894    if (EFI_ERROR (Status)) {
     895      return Status;
     896    }
     897  }
    846898
    847899  if (!IsListEmpty(&UdpIo->Link)) {
     
    857909  Clean up the UDP_IO without freeing it. The function is called when
    858910  user wants to re-use the UDP_IO later.
     911
     912  If Udp version is not UDP_IO_UDP4_VERSION or UDP_IO_UDP6_VERSION, then ASSERT().
    859913
    860914  It will release all the transmitted datagrams and receive request. It will
     
    898952/**
    899953  Send a packet through the UDP_IO.
     954
     955  If Udp version is not UDP_IO_UDP4_VERSION or UDP_IO_UDP6_VERSION, then ASSERT().
    900956
    901957  The packet will be wrapped in UDP_TX_TOKEN. Function Callback will be called
     
    10091065  Issue a receive request to the UDP_IO.
    10101066
     1067  If Udp version is not UDP_IO_UDP4_VERSION or UDP_IO_UDP6_VERSION, then ASSERT().
     1068
    10111069  This function is called when upper-layer needs packet from UDP for processing.
    10121070  Only one receive request is acceptable at a time so a common usage model is
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