81 Status =
gBS->OpenProtocol (
83 &gEfiUdp6ServiceBindingProtocolGuid,
85 This->DriverBindingHandle,
87 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
89 if (!EFI_ERROR (Status)) {
90 return EFI_ALREADY_STARTED;
96 Status =
gBS->OpenProtocol (
98 &gEfiIp6ServiceBindingProtocolGuid,
100 This->DriverBindingHandle,
102 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
142 if (Udp6Service ==
NULL) {
143 Status = EFI_OUT_OF_RESOURCES;
147 Status =
Udp6CreateService (Udp6Service, This->DriverBindingHandle, ControllerHandle);
148 if (EFI_ERROR (Status)) {
155 Status =
gBS->InstallMultipleProtocolInterfaces (
157 &gEfiUdp6ServiceBindingProtocolGuid,
158 &Udp6Service->ServiceBinding,
161 if (EFI_ERROR (Status)) {
166 if (EFI_ERROR (Status)) {
167 if (Udp6Service !=
NULL) {
195 UINTN NumberOfChildren;
198 if ((Entry ==
NULL) || (Context ==
NULL)) {
199 return EFI_INVALID_PARAMETER;
202 Instance = NET_LIST_USER_STRUCT_S (Entry,
UDP6_INSTANCE_DATA, Link, UDP6_INSTANCE_DATA_SIGNATURE);
211 return ServiceBinding->DestroyChild (ServiceBinding, Instance->ChildHandle);
254 if (NicHandle ==
NULL) {
261 Status =
gBS->OpenProtocol (
263 &gEfiUdp6ServiceBindingProtocolGuid,
264 (VOID **)&ServiceBinding,
265 This->DriverBindingHandle,
267 EFI_OPEN_PROTOCOL_GET_PROTOCOL
269 if (EFI_ERROR (Status)) {
270 return EFI_DEVICE_ERROR;
273 Udp6Service = UDP6_SERVICE_DATA_FROM_THIS (ServiceBinding);
275 if (NumberOfChildren != 0) {
279 List = &Udp6Service->ChildrenList;
280 Context.ServiceBinding = ServiceBinding;
281 Context.NumberOfChildren = NumberOfChildren;
282 Context.ChildHandleBuffer = ChildHandleBuffer;
289 }
else if (
IsListEmpty (&Udp6Service->ChildrenList)) {
290 Status =
gBS->UninstallMultipleProtocolInterfaces (
292 &gEfiUdp6ServiceBindingProtocolGuid,
293 &Udp6Service->ServiceBinding,
336 if ((This ==
NULL) || (ChildHandle ==
NULL)) {
337 return EFI_INVALID_PARAMETER;
340 Udp6Service = UDP6_SERVICE_DATA_FROM_THIS (This);
346 if (Instance ==
NULL) {
347 return EFI_OUT_OF_RESOURCES;
355 Instance->IpInfo =
IpIoAddIp (Udp6Service->IpIo);
356 if (Instance->IpInfo ==
NULL) {
357 Status = EFI_OUT_OF_RESOURCES;
364 Status =
gBS->InstallMultipleProtocolInterfaces (
366 &gEfiUdp6ProtocolGuid,
367 &Instance->Udp6Proto,
370 if (EFI_ERROR (Status)) {
374 Instance->ChildHandle = *ChildHandle;
379 Status =
gBS->OpenProtocol (
380 Udp6Service->IpIo->ChildHandle,
381 &gEfiIp6ProtocolGuid,
384 Instance->ChildHandle,
385 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
387 if (EFI_ERROR (Status)) {
394 Status =
gBS->OpenProtocol (
395 Instance->IpInfo->ChildHandle,
396 &gEfiIp6ProtocolGuid,
399 Instance->ChildHandle,
400 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
402 if (EFI_ERROR (Status)) {
406 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
412 Udp6Service->ChildrenNumber++;
414 gBS->RestoreTPL (OldTpl);
420 if (Instance->ChildHandle !=
NULL) {
421 gBS->UninstallMultipleProtocolInterfaces (
422 Instance->ChildHandle,
423 &gEfiUdp6ProtocolGuid,
424 &Instance->Udp6Proto,
429 if (Instance->IpInfo !=
NULL) {
472 if ((This ==
NULL) || (ChildHandle ==
NULL)) {
473 return EFI_INVALID_PARAMETER;
476 Udp6Service = UDP6_SERVICE_DATA_FROM_THIS (This);
481 Status =
gBS->OpenProtocol (
483 &gEfiUdp6ProtocolGuid,
487 EFI_OPEN_PROTOCOL_GET_PROTOCOL
489 if (EFI_ERROR (Status)) {
490 return EFI_UNSUPPORTED;
493 Instance = UDP6_INSTANCE_DATA_FROM_THIS (Udp6Proto);
495 if (Instance->InDestroy) {
502 Instance->InDestroy =
TRUE;
507 Status =
gBS->CloseProtocol (
508 Udp6Service->IpIo->ChildHandle,
509 &gEfiIp6ProtocolGuid,
511 Instance->ChildHandle
513 if (EFI_ERROR (Status)) {
514 Instance->InDestroy =
FALSE;
521 Status =
gBS->CloseProtocol (
522 Instance->IpInfo->ChildHandle,
523 &gEfiIp6ProtocolGuid,
525 Instance->ChildHandle
527 if (EFI_ERROR (Status)) {
528 Instance->InDestroy =
FALSE;
535 Status =
gBS->UninstallMultipleProtocolInterfaces (
537 &gEfiUdp6ProtocolGuid,
538 (VOID *)&Instance->Udp6Proto,
541 if (EFI_ERROR (Status)) {
542 Instance->InDestroy =
FALSE;
549 Udp6Proto->Configure (Udp6Proto,
NULL);
556 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
562 Udp6Service->ChildrenNumber--;
569 gBS->RestoreTPL (OldTpl);
602 if (EFI_ERROR (Status)) {
603 DEBUG ((DEBUG_ERROR,
"%a failed to generate random number: %r\n", __func__, Status));
619 if (!EFI_ERROR (Status)) {
623 mUdp6RandomPort = (UINT16)(
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID EFIAPI IpIoRemoveIp(IN IP_IO *IpIo, IN IP_IO_IP_INFO *IpInfo)
IP_IO_IP_INFO *EFIAPI IpIoAddIp(IN OUT IP_IO *IpIo)
#define DEBUG(Expression)
BOOLEAN EFIAPI NetIsInHandleBuffer(IN EFI_HANDLE Handle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer OPTIONAL)
EFI_STATUS EFIAPI PseudoRandomU32(OUT UINT32 *Output)
EFI_HANDLE EFIAPI NetLibGetNicHandle(IN EFI_HANDLE Controller, IN EFI_GUID *ProtocolGuid)
EFI_STATUS EFIAPI NetDestroyLinkList(IN LIST_ENTRY *List, IN NET_DESTROY_LINK_LIST_CALLBACK CallBack, IN VOID *Context OPTIONAL, OUT UINTN *ListLength OPTIONAL)
EFI_STATUS EFIAPI Udp6ServiceBindingCreateChild(IN EFI_SERVICE_BINDING_PROTOCOL *This, IN OUT EFI_HANDLE *ChildHandle)
EFI_STATUS EFIAPI Udp6DriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
EFI_STATUS EFIAPI Udp6ServiceBindingDestroyChild(IN EFI_SERVICE_BINDING_PROTOCOL *This, IN EFI_HANDLE ChildHandle)
EFI_STATUS EFIAPI Udp6DriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS EFIAPI Udp6DriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
EFI_STATUS EFIAPI Udp6DestroyChildEntryInHandleBuffer(IN LIST_ENTRY *Entry, IN VOID *Context)
EFI_STATUS EFIAPI Udp6DriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer OPTIONAL)
EFI_STATUS Udp6CreateService(IN UDP6_SERVICE_DATA *Udp6Service, IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ControllerHandle)
VOID Udp6CleanInstance(IN OUT UDP6_INSTANCE_DATA *Instance)
VOID Udp6InitInstance(IN UDP6_SERVICE_DATA *Udp6Service, IN OUT UDP6_INSTANCE_DATA *Instance)
VOID Udp6CleanService(IN OUT UDP6_SERVICE_DATA *Udp6Service)
EFI_STATUS EFIAPI EfiLibInstallDriverBindingComponentName2(IN CONST EFI_HANDLE ImageHandle, IN CONST EFI_SYSTEM_TABLE *SystemTable, IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, IN EFI_HANDLE DriverBindingHandle, IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName OPTIONAL, IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL)
EFI_HANDLE DriverBindingHandle