VirtualBox

Ignore:
Timestamp:
Apr 14, 2023 3:17:44 PM (22 months ago)
Author:
vboxsync
Message:

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, 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/ArpDxe/ArpImpl.c

    r85718 r99404  
    2222};
    2323
    24 
    2524/**
    2625  Initialize the instance context data.
     
    5251}
    5352
    54 
    5553/**
    5654  Process the Arp packets received from Mnp, the procedure conforms to RFC826.
     
    6563EFIAPI
    6664ArpOnFrameRcvdDpc (
    67   IN VOID       *Context
     65  IN VOID  *Context
    6866  )
    6967{
     
    120118  // Convert the byte order of the multi-byte fields.
    121119  //
    122   Head   = (ARP_HEAD *) RxData->PacketData;
     120  Head            = (ARP_HEAD *)RxData->PacketData;
    123121  Head->HwType    = NTOHS (Head->HwType);
    124122  Head->ProtoType = NTOHS (Head->ProtoType);
     
    130128
    131129  if ((Head->HwType != ArpService->SnpMode.IfType) ||
    132     (Head->HwAddrLen != ArpService->SnpMode.HwAddressSize) ||
    133     (RxData->ProtocolType != ARP_ETHER_PROTO_TYPE)) {
     130      (Head->HwAddrLen != ArpService->SnpMode.HwAddressSize) ||
     131      (RxData->ProtocolType != ARP_ETHER_PROTO_TYPE))
     132  {
    134133    //
    135134    // The hardware type or the hardware address length doesn't match.
     
    183182
    184183    if ((Instance->Configured) &&
    185       (Head->ProtoType == ConfigData->SwAddressType) &&
    186       (Head->ProtoAddrLen == ConfigData->SwAddressLength)) {
     184        (Head->ProtoType == ConfigData->SwAddressType) &&
     185        (Head->ProtoAddrLen == ConfigData->SwAddressLength))
     186    {
    187187      //
    188188      // The protocol type is matched for the received arp packet.
     
    193193                 ConfigData->StationAddress,
    194194                 ConfigData->SwAddressLength
    195                  )) {
     195                 ))
     196      {
    196197        //
    197198        // The arp driver has the target address required by the received arp packet.
     
    227228    ArpFillAddressInCacheEntry (CacheEntry, &SenderAddress[Hardware], NULL);
    228229    CacheEntry->DecayTime = CacheEntry->DefaultDecayTime;
    229     MergeFlag = TRUE;
     230    MergeFlag             = TRUE;
    230231  }
    231232
     
    305306  Status = ArpService->Mnp->Receive (ArpService->Mnp, RxToken);
    306307
    307   DEBUG_CODE (
    308     if (EFI_ERROR (Status)) {
    309       DEBUG ((EFI_D_ERROR, "ArpOnFrameRcvd: ArpService->Mnp->Receive "
    310         "failed, %r\n.", Status));
    311     }
    312   );
     308  DEBUG_CODE_BEGIN ();
     309  if (EFI_ERROR (Status)) {
     310    DEBUG ((
     311      DEBUG_ERROR,
     312      "ArpOnFrameRcvd: ArpService->Mnp->Receive "
     313      "failed, %r\n.",
     314      Status
     315      ));
     316  }
     317
     318  DEBUG_CODE_END ();
    313319}
    314320
     
    348354EFIAPI
    349355ArpOnFrameSentDpc (
    350   IN VOID       *Context
     356  IN VOID  *Context
    351357  )
    352358{
     
    359365  TxData  = TxToken->Packet.TxData;
    360366
    361   DEBUG_CODE (
    362     if (EFI_ERROR (TxToken->Status)) {
    363       DEBUG ((EFI_D_ERROR, "ArpOnFrameSent: TxToken->Status, %r.\n", TxToken->Status));
    364     }
    365   );
     367  DEBUG_CODE_BEGIN ();
     368  if (EFI_ERROR (TxToken->Status)) {
     369    DEBUG ((DEBUG_ERROR, "ArpOnFrameSent: TxToken->Status, %r.\n", TxToken->Status));
     370  }
     371
     372  DEBUG_CODE_END ();
    366373
    367374  //
     
    396403  QueueDpc (TPL_CALLBACK, ArpOnFrameSentDpc, Context);
    397404}
    398 
    399405
    400406/**
     
    450456        // resend the ARP request.
    451457        //
    452         ASSERT (!IsListEmpty(&CacheEntry->UserRequestList));
     458        ASSERT (!IsListEmpty (&CacheEntry->UserRequestList));
    453459
    454460        ContextEntry   = CacheEntry->UserRequestList.ForwardLink;
     
    525531}
    526532
    527 
    528533/**
    529534  Match the two NET_ARP_ADDRESSes.
     
    544549
    545550  if ((AddressOne->Type != AddressTwo->Type) ||
    546     (AddressOne->Length != AddressTwo->Length)) {
     551      (AddressOne->Length != AddressTwo->Length))
     552  {
    547553    //
    548554    // Either Type or Length doesn't match.
     
    552558
    553559  if ((AddressOne->AddressPtr != NULL) &&
    554     (CompareMem (
    555       AddressOne->AddressPtr,
    556       AddressTwo->AddressPtr,
    557       AddressOne->Length
    558       ) != 0)) {
     560      (CompareMem (
     561         AddressOne->AddressPtr,
     562         AddressTwo->AddressPtr,
     563         AddressOne->Length
     564         ) != 0))
     565  {
    559566    //
    560567    // The address is not the same.
     
    565572  return TRUE;
    566573}
    567 
    568574
    569575/**
     
    582588ARP_CACHE_ENTRY *
    583589ArpFindNextCacheEntryInTable (
    584   IN LIST_ENTRY        *CacheTable,
    585   IN LIST_ENTRY        *StartEntry,
    586   IN FIND_OPTYPE       FindOpType,
    587   IN NET_ARP_ADDRESS   *ProtocolAddress OPTIONAL,
    588   IN NET_ARP_ADDRESS   *HardwareAddress OPTIONAL
     590  IN LIST_ENTRY       *CacheTable,
     591  IN LIST_ENTRY       *StartEntry,
     592  IN FIND_OPTYPE      FindOpType,
     593  IN NET_ARP_ADDRESS  *ProtocolAddress OPTIONAL,
     594  IN NET_ARP_ADDRESS  *HardwareAddress OPTIONAL
    589595  )
    590596{
     
    637643  return NULL;
    638644}
    639 
    640645
    641646/**
     
    699704}
    700705
    701 
    702706/**
    703707  Allocate a cache entry and initialize it.
     
    735739    // Init the address pointers to point to the concrete buffer.
    736740    //
    737     Address = &CacheEntry->Addresses[Index];
     741    Address             = &CacheEntry->Addresses[Index];
    738742    Address->AddressPtr = Address->Buffer.ProtoAddress;
    739743  }
     
    766770}
    767771
    768 
    769772/**
    770773  Turn the CacheEntry into the resolved status.
     
    798801
    799802    if (((Instance == NULL) || (Context->Instance == Instance)) &&
    800       ((UserEvent == NULL) || (Context->UserRequestEvent == UserEvent))) {
     803        ((UserEvent == NULL) || (Context->UserRequestEvent == UserEvent)))
     804    {
    801805      //
    802806      // Copy the address to the user-provided buffer and notify the user.
     
    827831}
    828832
    829 
    830833/**
    831834  Fill the addresses in the CacheEntry using the information passed in by
     
    881884  }
    882885}
    883 
    884886
    885887/**
     
    913915
    914916  if (ConfigData != NULL) {
    915 
    916917    if (Instance->Configured) {
    917918      //
     
    919920      //
    920921      if ((OldConfigData->SwAddressType != ConfigData->SwAddressType) ||
    921         (OldConfigData->SwAddressLength != ConfigData->SwAddressLength) ||
    922         (CompareMem (
    923            OldConfigData->StationAddress,
    924            ConfigData->StationAddress,
    925            OldConfigData->SwAddressLength
    926            ) != 0)) {
     922          (OldConfigData->SwAddressLength != ConfigData->SwAddressLength) ||
     923          (CompareMem (
     924             OldConfigData->StationAddress,
     925             ConfigData->StationAddress,
     926             OldConfigData->SwAddressLength
     927             ) != 0))
     928      {
    927929        //
    928930        // Deny the unallowed changes.
     
    953955      OldConfigData->StationAddress = AllocatePool (OldConfigData->SwAddressLength);
    954956      if (OldConfigData->StationAddress == NULL) {
    955         DEBUG ((EFI_D_ERROR, "ArpConfigInstance: AllocatePool for the StationAddress "
    956           "failed.\n"));
     957        DEBUG ((
     958          DEBUG_ERROR,
     959          "ArpConfigInstance: AllocatePool for the StationAddress "
     960          "failed.\n"
     961          ));
    957962        return EFI_OUT_OF_RESOURCES;
    958963      }
     
    977982    //
    978983    OldConfigData->EntryTimeOut = (ConfigData->EntryTimeOut == 0) ?
    979       ARP_DEFAULT_TIMEOUT_VALUE : ConfigData->EntryTimeOut;
    980 
    981     OldConfigData->RetryCount   = (ConfigData->RetryCount == 0) ?
    982       ARP_DEFAULT_RETRY_COUNT : ConfigData->RetryCount;
     984                                  ARP_DEFAULT_TIMEOUT_VALUE : ConfigData->EntryTimeOut;
     985
     986    OldConfigData->RetryCount = (ConfigData->RetryCount == 0) ?
     987                                ARP_DEFAULT_RETRY_COUNT : ConfigData->RetryCount;
    983988
    984989    OldConfigData->RetryTimeOut = (ConfigData->RetryTimeOut == 0) ?
    985       ARP_DEFAULT_RETRY_INTERVAL : ConfigData->RetryTimeOut;
     990                                  ARP_DEFAULT_RETRY_INTERVAL : ConfigData->RetryTimeOut;
    986991  } else {
    987992    //
     
    10061011  return EFI_SUCCESS;
    10071012}
    1008 
    10091013
    10101014/**
     
    10431047  // Allocate memory for the TxToken.
    10441048  //
    1045   TxToken = AllocatePool (sizeof(EFI_MANAGED_NETWORK_COMPLETION_TOKEN));
     1049  TxToken = AllocatePool (sizeof (EFI_MANAGED_NETWORK_COMPLETION_TOKEN));
    10461050  if (TxToken == NULL) {
    1047     DEBUG ((EFI_D_ERROR, "ArpSendFrame: Allocate memory for TxToken failed.\n"));
     1051    DEBUG ((DEBUG_ERROR, "ArpSendFrame: Allocate memory for TxToken failed.\n"));
    10481052    return;
    10491053  }
     
    10641068                  );
    10651069  if (EFI_ERROR (Status)) {
    1066     DEBUG ((EFI_D_ERROR, "ArpSendFrame: CreateEvent failed for TxToken->Event.\n"));
     1070    DEBUG ((DEBUG_ERROR, "ArpSendFrame: CreateEvent failed for TxToken->Event.\n"));
    10671071    goto CLEAN_EXIT;
    10681072  }
     
    10711075  // Allocate memory for the TxData used in the TxToken.
    10721076  //
    1073   TxData = AllocatePool (sizeof(EFI_MANAGED_NETWORK_TRANSMIT_DATA));
     1077  TxData = AllocatePool (sizeof (EFI_MANAGED_NETWORK_TRANSMIT_DATA));
    10741078  if (TxData == NULL) {
    1075     DEBUG ((EFI_D_ERROR, "ArpSendFrame: Allocate memory for TxData failed.\n"));
     1079    DEBUG ((DEBUG_ERROR, "ArpSendFrame: Allocate memory for TxData failed.\n"));
    10761080    goto CLEAN_EXIT;
    10771081  }
     
    10921096  Packet = AllocatePool (TotalLength);
    10931097  if (Packet == NULL) {
    1094     DEBUG ((EFI_D_ERROR, "ArpSendFrame: Allocate memory for Packet failed.\n"));
     1098    DEBUG ((DEBUG_ERROR, "ArpSendFrame: Allocate memory for Packet failed.\n"));
    10951099    ASSERT (Packet != NULL);
    10961100  }
     
    11101114      );
    11111115  }
     1116
    11121117  TmpPtr += SnpMode->HwAddressSize;
    11131118
     
    11221127  //
    11231128  *(UINT16 *)TmpPtr = HTONS (ARP_ETHER_PROTO_TYPE);
    1124   TmpPtr            += 2;
     1129  TmpPtr           += 2;
    11251130
    11261131  //
    11271132  // The ARP Head.
    11281133  //
    1129   ArpHead               = (ARP_HEAD *) TmpPtr;
     1134  ArpHead               = (ARP_HEAD *)TmpPtr;
    11301135  ArpHead->HwType       = HTONS ((UINT16)SnpMode->IfType);
    11311136  ArpHead->ProtoType    = HTONS (ConfigData->SwAddressType);
     
    11331138  ArpHead->ProtoAddrLen = ConfigData->SwAddressLength;
    11341139  ArpHead->OpCode       = HTONS (ArpOpCode);
    1135   TmpPtr                += sizeof (ARP_HEAD);
     1140  TmpPtr               += sizeof (ARP_HEAD);
    11361141
    11371142  //
     
    11731178  TxData->ProtocolType       = 0;
    11741179  TxData->DataLength         = TotalLength - SnpMode->MediaHeaderSize;
    1175   TxData->HeaderLength       = (UINT16) SnpMode->MediaHeaderSize;
     1180  TxData->HeaderLength       = (UINT16)SnpMode->MediaHeaderSize;
    11761181  TxData->FragmentCount      = 1;
    11771182
     
    11901195  Status = ArpService->Mnp->Transmit (ArpService->Mnp, TxToken);
    11911196  if (EFI_ERROR (Status)) {
    1192     DEBUG ((EFI_D_ERROR, "Mnp->Transmit failed, %r.\n", Status));
     1197    DEBUG ((DEBUG_ERROR, "Mnp->Transmit failed, %r.\n", Status));
    11931198    goto CLEAN_EXIT;
    11941199  }
     
    12121217  FreePool (TxToken);
    12131218}
    1214 
    12151219
    12161220/**
     
    12321236UINTN
    12331237ArpDeleteCacheEntryInTable (
    1234   IN LIST_ENTRY      *CacheTable,
    1235   IN BOOLEAN         BySwAddress,
    1236   IN UINT16          SwAddressType,
    1237   IN UINT8           *AddressBuffer OPTIONAL,
    1238   IN BOOLEAN         Force
     1238  IN LIST_ENTRY  *CacheTable,
     1239  IN BOOLEAN     BySwAddress,
     1240  IN UINT16      SwAddressType,
     1241  IN UINT8       *AddressBuffer OPTIONAL,
     1242  IN BOOLEAN     Force
    12391243  )
    12401244{
     
    12621266        //
    12631267        if ((AddressBuffer == NULL) ||
    1264           (CompareMem (
    1265              AddressBuffer,
    1266              CacheEntry->Addresses[Protocol].AddressPtr,
    1267              CacheEntry->Addresses[Protocol].Length
    1268              ) == 0)) {
     1268            (CompareMem (
     1269               AddressBuffer,
     1270               CacheEntry->Addresses[Protocol].AddressPtr,
     1271               CacheEntry->Addresses[Protocol].Length
     1272               ) == 0))
     1273        {
    12691274          //
    12701275          // Address matched.
     
    12751280    } else {
    12761281      if ((AddressBuffer == NULL) ||
    1277         (CompareMem (
    1278            AddressBuffer,
    1279            CacheEntry->Addresses[Hardware].AddressPtr,
    1280            CacheEntry->Addresses[Hardware].Length
    1281            ) == 0)) {
     1282          (CompareMem (
     1283             AddressBuffer,
     1284             CacheEntry->Addresses[Hardware].AddressPtr,
     1285             CacheEntry->Addresses[Hardware].Length
     1286             ) == 0))
     1287      {
    12821288        //
    12831289        // Address matched.
     
    13031309  return Count;
    13041310}
    1305 
    13061311
    13071312/**
     
    13581363}
    13591364
    1360 
    13611365/**
    13621366  Cancel the arp request.
     
    13931397
    13941398    if ((TargetSwAddress == NULL) ||
    1395       (CompareMem (
    1396          TargetSwAddress,
    1397          CacheEntry->Addresses[Protocol].AddressPtr,
    1398          CacheEntry->Addresses[Protocol].Length
    1399          ) == 0)) {
     1399        (CompareMem (
     1400           TargetSwAddress,
     1401           CacheEntry->Addresses[Protocol].AddressPtr,
     1402           CacheEntry->Addresses[Protocol].Length
     1403           ) == 0))
     1404    {
    14001405      //
    14011406      // This request entry matches the TargetSwAddress or all requests are to be
     
    14161421  return Count;
    14171422}
    1418 
    14191423
    14201424/**
     
    15731577  Status = EFI_SUCCESS;
    15741578
    1575   FoundCount = (UINT32) NetMapGetCount (&FoundEntries);
     1579  FoundCount = (UINT32)NetMapGetCount (&FoundEntries);
    15761580  if (FoundCount == 0) {
    15771581    Status = EFI_NOT_FOUND;
     
    15831587  //
    15841588  FoundEntryLength = (((sizeof (EFI_ARP_FIND_DATA) + Instance->ConfigData.SwAddressLength +
    1585                        ArpService->SnpMode.HwAddressSize) + 3) & ~(0x3));
     1589                        ArpService->SnpMode.HwAddressSize) + 3) & ~(0x3));
    15861590
    15871591  if (EntryLength != NULL) {
     
    16051609  FindData = AllocatePool (FoundCount * FoundEntryLength);
    16061610  if (FindData == NULL) {
    1607     DEBUG ((EFI_D_ERROR, "ArpFindCacheEntry: Failed to allocate memory.\n"));
     1611    DEBUG ((DEBUG_ERROR, "ArpFindCacheEntry: Failed to allocate memory.\n"));
    16081612    Status = EFI_OUT_OF_RESOURCES;
    16091613    goto CLEAN_EXIT;
     
    16651669  return Status;
    16661670}
    1667 
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