VirtualBox

Ignore:
Timestamp:
Sep 11, 2019 8:46:37 AM (5 years ago)
Author:
vboxsync
Message:

Devices/EFI/FirmwareNew: Start upgrade process to edk2-stable201908 (compiles on Windows and works to some extent), bugref:4643

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/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c

    r77662 r80721  
    22  Support functions implementation for UefiPxeBc Driver.
    33
    4   Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
    5 
    6   This program and the accompanying materials
    7   are licensed and made available under the terms and conditions of the BSD License
    8   which accompanies this distribution.  The full text of the license may be found at
    9   http://opensource.org/licenses/bsd-license.php.
    10 
    11   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
    12   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     4  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
     5
     6  SPDX-License-Identifier: BSD-2-Clause-Patent
    137
    148**/
     
    3731  EFI_PXE_BASE_CODE_MODE   *Mode;
    3832  EFI_STATUS               Status;
     33  EFI_ARP_CONFIG_DATA      ArpConfigData;
    3934
    4035  Mode   = Private->PxeBc.Mode;
    4136  Status = EFI_SUCCESS;
    42 
    43   if (Mode->UsingIpv6) {
    44 
    45     if (StationIp != NULL) {
    46       CopyMem (&Private->Udp6CfgData.StationAddress, StationIp, sizeof (EFI_IPv6_ADDRESS));
    47       CopyMem (&Private->Ip6CfgData.StationAddress, StationIp, sizeof (EFI_IPv6_ADDRESS));
    48     }
     37  ZeroMem (&ArpConfigData, sizeof (EFI_ARP_CONFIG_DATA));
     38
     39  if (Mode->UsingIpv6 && StationIp != NULL) {
     40    //
     41    // Overwrite Udp6CfgData/Ip6CfgData StationAddress.
     42    //
     43    CopyMem (&Private->Udp6CfgData.StationAddress, StationIp, sizeof (EFI_IPv6_ADDRESS));
     44    CopyMem (&Private->Ip6CfgData.StationAddress, StationIp, sizeof (EFI_IPv6_ADDRESS));
    4945
    5046    //
     
    6258  } else {
    6359    if (StationIp != NULL) {
     60      //
     61      // Reconfigure the ARP instance with station Ip address.
     62      //
     63      ArpConfigData.SwAddressType   = 0x0800;
     64      ArpConfigData.SwAddressLength = (UINT8) sizeof (EFI_IPv4_ADDRESS);
     65      ArpConfigData.StationAddress = StationIp;
     66
     67      Private->Arp->Configure (Private->Arp, NULL);
     68      Private->Arp->Configure (Private->Arp, &ArpConfigData);
     69
     70      //
     71      // Overwrite Udp4CfgData/Ip4CfgData StationAddress.
     72      //
    6473      CopyMem (&Private->Udp4CfgData.StationAddress, StationIp, sizeof (EFI_IPv4_ADDRESS));
    6574      CopyMem (&Private->Ip4CfgData.StationAddress, StationIp, sizeof (EFI_IPv4_ADDRESS));
     
    6776
    6877    if (SubnetMask != NULL) {
     78      //
     79      // Overwrite Udp4CfgData/Ip4CfgData SubnetMask.
     80      //
    6981      CopyMem (&Private->Udp4CfgData.SubnetMask, SubnetMask, sizeof (EFI_IPv4_ADDRESS));
    7082      CopyMem (&Private->Ip4CfgData.SubnetMask, SubnetMask, sizeof (EFI_IPv4_ADDRESS));
    7183    }
    7284
    73     //
    74     // Reconfigure the Ip4 instance to capture background ICMP packets with new station Ip address.
    75     //
    76     Private->Ip4->Cancel (Private->Ip4, &Private->IcmpToken);
    77     Private->Ip4->Configure (Private->Ip4, NULL);
    78 
    79     Status = Private->Ip4->Configure (Private->Ip4, &Private->Ip4CfgData);
    80     if (EFI_ERROR (Status)) {
    81       goto ON_EXIT;
    82     }
    83 
    84     Status = Private->Ip4->Receive (Private->Ip4, &Private->IcmpToken);
     85    if (StationIp != NULL && SubnetMask != NULL) {
     86      //
     87      // Updated the route table.
     88      //
     89      Mode->RouteTableEntries                = 1;
     90      Mode->RouteTable[0].IpAddr.Addr[0]     = StationIp->Addr[0] & SubnetMask->Addr[0];
     91      Mode->RouteTable[0].SubnetMask.Addr[0] = SubnetMask->Addr[0];
     92      Mode->RouteTable[0].GwAddr.Addr[0]     = 0;
     93    }
     94
     95    if (StationIp != NULL || SubnetMask != NULL) {
     96      //
     97      // Reconfigure the Ip4 instance to capture background ICMP packets with new station Ip address.
     98      //
     99      Private->Ip4->Cancel (Private->Ip4, &Private->IcmpToken);
     100      Private->Ip4->Configure (Private->Ip4, NULL);
     101
     102      Status = Private->Ip4->Configure (Private->Ip4, &Private->Ip4CfgData);
     103      if (EFI_ERROR (Status)) {
     104        goto ON_EXIT;
     105      }
     106
     107      Status = Private->Ip4->Receive (Private->Ip4, &Private->IcmpToken);
     108    }
    85109  }
    86110
     
    14811505  ZeroMem (&Time, sizeof (EFI_TIME));
    14821506  gRT->GetTime (&Time, NULL);
    1483   CurrentStamp = (UINT64)
    1484     (
    1485       ((((((Time.Year - 1900) * 360 +
    1486        (Time.Month - 1)) * 30 +
    1487        (Time.Day - 1)) * 24 + Time.Hour) * 60 +
    1488        Time.Minute) * 60 + Time.Second) * 100
    1489        + DivU64x32(Time.Nanosecond, 10000000)
    1490     );
     1507  CurrentStamp = MultU64x32 (
     1508                   ((((UINT32)(Time.Year - 1900) * 360 + (Time.Month - 1) * 30 + (Time.Day - 1)) * 24 + Time.Hour) * 60 + Time.Minute) * 60 + Time.Second,
     1509                   100
     1510                   ) +
     1511                 DivU64x32 (
     1512                   Time.Nanosecond,
     1513                   10000000
     1514                   );
    14911515
    14921516  //
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