VirtualBox

Ignore:
Timestamp:
Oct 28, 2015 8:17:18 PM (9 years ago)
Author:
vboxsync
Message:

EFI/Firmware: 'svn merge /vendor/edk2/UDK2010.SR1 /vendor/edk2/current .', reverting and removing files+dirs listed in ReadMe.vbox, resolving conflicts with help from ../UDK2014.SP1/. This is a raw untested merge.

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

Legend:

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

  • trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe/Ip6Driver.c

    r48674 r58459  
    22  The driver binding and service binding protocol for IP6 driver.
    33
    4   Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
    55
    66  This program and the accompanying materials
     
    9595  the resource allocated by the instance. The instance may be
    9696  partly initialized, or partly destroyed. If a resource is
    97   destroyed, it is marked as that in case the destory failed and
     97  destroyed, it is marked as that in case the destroy failed and
    9898  being called again later.
    9999
     
    115115  Ip6ConfigCleanInstance (&IpSb->Ip6ConfigInstance);
    116116
    117   //
    118   // Leave link-scope all-nodes multicast address (FF02::1)
    119   //
    120   Ip6SetToAllNodeMulticast (FALSE, IP6_LINK_LOCAL_SCOPE, &AllNodes);
    121 
    122   Status = Ip6LeaveGroup (IpSb, &AllNodes);
    123   if (EFI_ERROR (Status)) {
    124     return Status;
     117  if (!IpSb->LinkLocalDadFail) {
     118    //
     119    // Leave link-scope all-nodes multicast address (FF02::1)
     120    //
     121    Ip6SetToAllNodeMulticast (FALSE, IP6_LINK_LOCAL_SCOPE, &AllNodes);
     122
     123    Status = Ip6LeaveGroup (IpSb, &AllNodes);
     124    if (EFI_ERROR (Status)) {
     125      return Status;
     126    } 
    125127  }
    126128
     
    245247  IpSb->ServiceBinding.DestroyChild = Ip6ServiceBindingDestroyChild;
    246248  IpSb->State                       = IP6_SERVICE_UNSTARTED;
    247   IpSb->InDestroy                   = FALSE;
    248249
    249250  IpSb->NumChildren                 = 0;
     
    412413  }
    413414
    414   //
    415   // The timer expires every 100 (IP6_TIMER_INTERVAL_IN_MS) milliseconds.
    416   //
    417   Status = gBS->SetTimer (IpSb->FasterTimer, TimerPeriodic, TICKS_PER_MS * IP6_TIMER_INTERVAL_IN_MS);
    418   if (EFI_ERROR (Status)) {
    419     goto ON_ERROR;
    420   }
    421 
    422   //
    423   // The timer expires every 1000 (IP6_ONE_SECOND_IN_MS) milliseconds.
    424   //
    425   Status = gBS->SetTimer (IpSb->Timer, TimerPeriodic, TICKS_PER_MS * IP6_ONE_SECOND_IN_MS);
    426   if (EFI_ERROR (Status)) {
    427     goto ON_ERROR;
    428   }
    429 
     415  Status = NetLibGetMacString (IpSb->Controller, IpSb->Image, &IpSb->MacString);
     416  if (EFI_ERROR (Status)) {
     417    goto ON_ERROR;
     418  }
     419
     420  Status = Ip6ConfigInitInstance (&IpSb->Ip6ConfigInstance);
     421  if (EFI_ERROR (Status)) {
     422    goto ON_ERROR;
     423  }
     424
     425  IpSb->DefaultInterface = Ip6CreateInterface (IpSb, TRUE);
     426  if (IpSb->DefaultInterface == NULL) {
     427    Status = EFI_DEVICE_ERROR;
     428    goto ON_ERROR;
     429  }
    430430
    431431  Status = gBS->CreateEvent (
     
    440440  }
    441441
    442   Status = Ip6ReceiveFrame (Ip6AcceptFrame, IpSb);
    443   if (EFI_ERROR (Status)) {
    444     goto ON_ERROR;
    445   }
    446 
    447   Status = NetLibGetMacString (IpSb->Controller, IpSb->Image, &IpSb->MacString);
    448   if (EFI_ERROR (Status)) {
    449     goto ON_ERROR;
    450   }
    451 
    452   Status = Ip6ConfigInitInstance (&IpSb->Ip6ConfigInstance);
    453   if (EFI_ERROR (Status)) {
    454     goto ON_ERROR;
    455   }
    456 
    457   IpSb->DefaultInterface = Ip6CreateInterface (IpSb, TRUE);
    458   if (IpSb->DefaultInterface == NULL) {
    459     Status = EFI_DEVICE_ERROR;
    460     goto ON_ERROR;
    461   }
    462 
    463442  //
    464443  // If there is any manual address, set it.
    465444  //
    466445  DataItem = &IpSb->Ip6ConfigInstance.DataItem[Ip6ConfigDataTypeManualAddress];
     446  if (DataItem->Data.Ptr != NULL) {
     447    DataItem->SetData (
     448                &IpSb->Ip6ConfigInstance,
     449                DataItem->DataSize,
     450                DataItem->Data.Ptr
     451                );
     452  }
     453
     454  //
     455  // If there is any gateway address, set it.
     456  //
     457  DataItem = &IpSb->Ip6ConfigInstance.DataItem[Ip6ConfigDataTypeGateway];
    467458  if (DataItem->Data.Ptr != NULL) {
    468459    DataItem->SetData (
     
    545536                  );
    546537
    547   if (EFI_ERROR (Status)) {
    548 
    549     Ip6CleanService (IpSb);
    550     FreePool (IpSb);
    551   } else {
     538  if (!EFI_ERROR (Status)) {
     539    //
     540    // ready to go: start the receiving and timer
     541    //
     542    Status = Ip6ReceiveFrame (Ip6AcceptFrame, IpSb);
     543    if (EFI_ERROR (Status)) {
     544      goto ON_ERROR;
     545    }
     546
     547    //
     548    // The timer expires every 100 (IP6_TIMER_INTERVAL_IN_MS) milliseconds.
     549    //
     550    Status = gBS->SetTimer (
     551                    IpSb->FasterTimer,
     552                    TimerPeriodic,
     553                    TICKS_PER_MS * IP6_TIMER_INTERVAL_IN_MS
     554                    );
     555    if (EFI_ERROR (Status)) {
     556      goto ON_ERROR;
     557    }
     558
     559    //
     560    // The timer expires every 1000 (IP6_ONE_SECOND_IN_MS) milliseconds.
     561    //
     562    Status = gBS->SetTimer (
     563                    IpSb->Timer,
     564                    TimerPeriodic,
     565                    TICKS_PER_MS * IP6_ONE_SECOND_IN_MS
     566                    );
     567    if (EFI_ERROR (Status)) {
     568      goto ON_ERROR;
     569    }   
     570
    552571    //
    553572    // Initialize the IP6 ID
     
    555574    mIp6Id = NET_RANDOM (NetRandomInitSeed ());
    556575
    557     Ip6SetVariableData (IpSb);
    558   }
    559 
     576    return EFI_SUCCESS;
     577  }
     578
     579ON_ERROR:
     580  Ip6CleanService (IpSb);
     581  FreePool (IpSb);
    560582  return Status;
     583}
     584
     585/**
     586  Callback function which provided by user to remove one node in NetDestroyLinkList process.
     587 
     588  @param[in]    Entry           The entry to be removed.
     589  @param[in]    Context         Pointer to the callback context corresponds to the Context in NetDestroyLinkList.
     590
     591  @retval EFI_SUCCESS           The entry has been removed successfully.
     592  @retval Others                Fail to remove the entry.
     593
     594**/
     595EFI_STATUS
     596EFIAPI
     597Ip6DestroyChildEntryInHandleBuffer (
     598  IN LIST_ENTRY         *Entry,
     599  IN VOID               *Context
     600  )
     601{
     602  IP6_PROTOCOL                  *IpInstance;
     603  EFI_SERVICE_BINDING_PROTOCOL  *ServiceBinding;
     604  UINTN                         NumberOfChildren;
     605  EFI_HANDLE                    *ChildHandleBuffer;
     606
     607  if (Entry == NULL || Context == NULL) {
     608    return EFI_INVALID_PARAMETER;
     609  }
     610
     611  IpInstance = NET_LIST_USER_STRUCT_S (Entry, IP6_PROTOCOL, Link, IP6_PROTOCOL_SIGNATURE);
     612  ServiceBinding    = ((IP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ServiceBinding;
     613  NumberOfChildren  = ((IP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->NumberOfChildren;
     614  ChildHandleBuffer = ((IP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ChildHandleBuffer;
     615
     616  if (!NetIsInHandleBuffer (IpInstance->Handle, NumberOfChildren, ChildHandleBuffer)) {
     617    return EFI_SUCCESS;
     618  }
     619
     620  return ServiceBinding->DestroyChild (ServiceBinding, IpInstance->Handle);
    561621}
    562622
     
    584644  )
    585645{
    586   EFI_SERVICE_BINDING_PROTOCOL  *ServiceBinding;
    587   IP6_SERVICE                   *IpSb;
    588   IP6_PROTOCOL                  *IpInstance;
    589   EFI_HANDLE                    NicHandle;
    590   EFI_STATUS                    Status;
    591   BOOLEAN                       IsDhcp6;
    592   EFI_TPL                       OldTpl;
    593   INTN                          State;
     646  EFI_SERVICE_BINDING_PROTOCOL            *ServiceBinding;
     647  IP6_SERVICE                             *IpSb;
     648  EFI_HANDLE                              NicHandle;
     649  EFI_STATUS                              Status;
     650  LIST_ENTRY                              *List;
     651  INTN                                    State;
     652  BOOLEAN                                 IsDhcp6;
     653  IP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT Context;
    594654
    595655  IsDhcp6   = FALSE;
    596   NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiDhcp6ProtocolGuid);
    597 
    598   if (NicHandle != NULL) {
    599     //
    600     // DriverBindingStop is triggered by the uninstallation of the EFI DHCPv6
    601     // Protocol used by Ip6Config.
    602     //
    603     IsDhcp6 = TRUE;
    604   } else {
    605 
    606     NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiManagedNetworkProtocolGuid);
    607 
    608     if (NicHandle == NULL) {
    609       return EFI_DEVICE_ERROR;
     656  NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiManagedNetworkProtocolGuid);
     657  if (NicHandle == NULL) {
     658    NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiDhcp6ProtocolGuid);
     659    if (NicHandle != NULL) {
     660      IsDhcp6 = TRUE;
     661    } else {
     662      return EFI_SUCCESS;
    610663    }
    611664  }
     
    625678  IpSb = IP6_SERVICE_FROM_PROTOCOL (ServiceBinding);
    626679
    627   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
    628 
    629   if (IpSb->InDestroy) {
    630     Status = EFI_SUCCESS;
    631     goto Exit;
    632   }
    633 
    634680  if (IsDhcp6) {
    635 
    636681    Status = Ip6ConfigDestroyDhcp6 (&IpSb->Ip6ConfigInstance);
    637682    gBS->CloseEvent (IpSb->Ip6ConfigInstance.Dhcp6Event);
    638683    IpSb->Ip6ConfigInstance.Dhcp6Event = NULL;
    639   } else if (NumberOfChildren == 0) {
    640 
    641     IpSb->InDestroy = TRUE;
     684  } else if (NumberOfChildren != 0) {
     685    //
     686    // NumberOfChildren is not zero, destroy the IP6 children instances in ChildHandleBuffer.
     687    //
     688    List = &IpSb->Children;
     689    Context.ServiceBinding    = ServiceBinding;
     690    Context.NumberOfChildren  = NumberOfChildren;
     691    Context.ChildHandleBuffer = ChildHandleBuffer;
     692    Status = NetDestroyLinkList (
     693               List,
     694               Ip6DestroyChildEntryInHandleBuffer,
     695               &Context,
     696               NULL
     697               );
     698  } else if (IsListEmpty (&IpSb->Children)) {
    642699    State           = IpSb->State;
    643700    IpSb->State     = IP6_SERVICE_DESTROY;
    644 
    645     //
    646     // Clear the variable data.
    647     //
    648     Ip6ClearVariableData (IpSb);
    649701
    650702    Status = Ip6CleanService (IpSb);
     
    664716    ASSERT_EFI_ERROR (Status);
    665717    FreePool (IpSb);
    666   } else {
    667     //
    668     // NumberOfChildren is not zero, destroy all IP6 children instances.
    669     //
    670     while (!IsListEmpty (&IpSb->Children)) {
    671       IpInstance = NET_LIST_HEAD (&IpSb->Children, IP6_PROTOCOL, Link);
    672       ServiceBinding->DestroyChild (ServiceBinding, IpInstance->Handle);
    673     }
    674 
    675     if (IpSb->NumChildren != 0) {
    676       Status = EFI_DEVICE_ERROR;
    677     }
    678   }
    679 
     718    Status = EFI_SUCCESS;
     719  }
     720 
    680721Exit:
    681 
    682   gBS->RestoreTPL (OldTpl);
    683 
    684722  return Status;
    685723}
     
    819857  EFI_IP6_PROTOCOL          *Ip6;
    820858  EFI_TPL                   OldTpl;
    821   INTN                      State;
    822859
    823860  if ((This == NULL) || (ChildHandle == NULL)) {
     
    853890  //
    854891  // A child can be destroyed more than once. For example,
    855   // Ip6DriverBindingStop will destory all of its children.
    856   // when UDP driver is being stopped, it will destory all
     892  // Ip6DriverBindingStop will destroy all of its children.
     893  // when UDP driver is being stopped, it will destroy all
    857894  // the IP child it opens.
    858895  //
    859   if (IpInstance->State == IP6_STATE_DESTROY) {
     896  if (IpInstance->InDestroy) {
    860897    gBS->RestoreTPL (OldTpl);
    861898    return EFI_SUCCESS;
    862899  }
    863900
    864   State             = IpInstance->State;
    865   IpInstance->State = IP6_STATE_DESTROY;
     901  IpInstance->InDestroy = TRUE;
    866902
    867903  //
     
    889925  // that means there is a resource leak.
    890926  //
     927  gBS->RestoreTPL (OldTpl);
    891928  Status = gBS->UninstallProtocolInterface (
    892929                  ChildHandle,
     
    894931                  &IpInstance->Ip6Proto
    895932                  );
    896 
     933  OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
    897934  if (EFI_ERROR (Status)) {
    898935    goto ON_ERROR;
     
    900937
    901938  Status = Ip6CleanProtocol (IpInstance);
    902 
    903   Ip6SetVariableData (IpSb);
    904 
    905939  if (EFI_ERROR (Status)) {
    906940    gBS->InstallMultipleProtocolInterfaces (
     
    924958
    925959ON_ERROR:
    926   IpInstance->State = State;
    927960  gBS->RestoreTPL (OldTpl);
    928961
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