46 ASSERT (ArpService !=
NULL);
48 ArpService->Signature = ARP_SERVICE_DATA_SIGNATURE;
67 ArpService->ImageHandle = ImageHandle;
68 ArpService->ControllerHandle = ControllerHandle;
76 &gEfiManagedNetworkServiceBindingProtocolGuid,
77 &ArpService->MnpChildHandle
79 if (EFI_ERROR (Status)) {
86 Status =
gBS->OpenProtocol (
87 ArpService->MnpChildHandle,
88 &gEfiManagedNetworkProtocolGuid,
89 (VOID **)&ArpService->Mnp,
92 EFI_OPEN_PROTOCOL_BY_DRIVER
94 if (EFI_ERROR (Status)) {
101 Status = ArpService->Mnp->GetModeData (ArpService->Mnp,
NULL, &ArpService->SnpMode);
102 if ((Status != EFI_NOT_STARTED) && EFI_ERROR (Status)) {
106 if (ArpService->SnpMode.IfType != NET_IFTYPE_ETHERNET) {
110 Status = EFI_UNSUPPORTED;
117 ArpService->MnpConfigData.ReceivedQueueTimeoutValue = 0;
118 ArpService->MnpConfigData.TransmitQueueTimeoutValue = 0;
119 ArpService->MnpConfigData.ProtocolTypeFilter = ARP_ETHER_PROTO_TYPE;
120 ArpService->MnpConfigData.EnableUnicastReceive =
TRUE;
121 ArpService->MnpConfigData.EnableMulticastReceive =
FALSE;
122 ArpService->MnpConfigData.EnableBroadcastReceive =
TRUE;
123 ArpService->MnpConfigData.EnablePromiscuousReceive =
FALSE;
124 ArpService->MnpConfigData.FlushQueuesOnReset =
TRUE;
125 ArpService->MnpConfigData.EnableReceiveTimestamps =
FALSE;
126 ArpService->MnpConfigData.DisableBackgroundPolling =
FALSE;
131 Status = ArpService->Mnp->Configure (ArpService->Mnp, &ArpService->MnpConfigData);
132 if (EFI_ERROR (Status)) {
139 Status =
gBS->CreateEvent (
144 &ArpService->RxToken.Event
146 if (EFI_ERROR (Status)) {
153 Status =
gBS->CreateEvent (
154 EVT_NOTIFY_SIGNAL | EVT_TIMER,
158 &ArpService->PeriodicTimer
160 if (EFI_ERROR (Status)) {
167 Status =
gBS->SetTimer (
168 ArpService->PeriodicTimer,
170 ARP_PERIODIC_TIMER_INTERVAL
192 NET_CHECK_SIGNATURE (ArpService, ARP_SERVICE_DATA_SIGNATURE);
194 if (ArpService->PeriodicTimer !=
NULL) {
199 gBS->CloseEvent (ArpService->PeriodicTimer);
202 if (ArpService->RxToken.Event !=
NULL) {
206 ArpService->Mnp->Cancel (ArpService->Mnp,
NULL);
207 gBS->CloseEvent (ArpService->RxToken.Event);
210 if (ArpService->Mnp !=
NULL) {
214 ArpService->Mnp->Configure (ArpService->Mnp,
NULL);
216 ArpService->MnpChildHandle,
217 &gEfiManagedNetworkProtocolGuid,
218 ArpService->ImageHandle,
219 ArpService->ControllerHandle
223 if (ArpService->MnpChildHandle !=
NULL) {
228 ArpService->ControllerHandle,
229 ArpService->ImageHandle,
230 &gEfiManagedNetworkServiceBindingProtocolGuid,
231 ArpService->MnpChildHandle
256 if ((Entry ==
NULL) || (Context ==
NULL)) {
257 return EFI_INVALID_PARAMETER;
260 Instance = NET_LIST_USER_STRUCT_S (Entry,
ARP_INSTANCE_DATA, List, ARP_INSTANCE_DATA_SIGNATURE);
263 return ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle);
308 Status =
gBS->OpenProtocol (
310 &gEfiArpServiceBindingProtocolGuid,
312 This->DriverBindingHandle,
314 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
317 return EFI_ALREADY_STARTED;
323 Status =
gBS->OpenProtocol (
325 &gEfiManagedNetworkServiceBindingProtocolGuid,
327 This->DriverBindingHandle,
329 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
381 if (ArpService ==
NULL) {
382 return EFI_OUT_OF_RESOURCES;
388 Status =
ArpCreateService (This->DriverBindingHandle, ControllerHandle, ArpService);
389 if (EFI_ERROR (Status)) {
396 Status =
gBS->InstallMultipleProtocolInterfaces (
398 &gEfiArpServiceBindingProtocolGuid,
399 &ArpService->ServiceBinding,
402 if (EFI_ERROR (Status)) {
409 Status = ArpService->Mnp->Receive (ArpService->Mnp, &ArpService->RxToken);
410 if (EFI_ERROR (Status)) {
475 if (NicHandle ==
NULL) {
482 Status =
gBS->OpenProtocol (
484 &gEfiArpServiceBindingProtocolGuid,
485 (VOID **)&ServiceBinding,
486 This->DriverBindingHandle,
488 EFI_OPEN_PROTOCOL_GET_PROTOCOL
490 if (EFI_ERROR (Status)) {
491 DEBUG ((DEBUG_ERROR,
"ArpDriverBindingStop: Open ArpSb failed, %r.\n", Status));
492 return EFI_DEVICE_ERROR;
497 if (NumberOfChildren != 0) {
501 List = &ArpService->ChildrenList;
508 ASSERT (
IsListEmpty (&ArpService->PendingRequestTable));
509 ASSERT (
IsListEmpty (&ArpService->DeniedCacheTable));
510 ASSERT (
IsListEmpty (&ArpService->ResolvedCacheTable));
511 }
else if (
IsListEmpty (&ArpService->ChildrenList)) {
515 gBS->UninstallMultipleProtocolInterfaces (
517 &gEfiArpServiceBindingProtocolGuid,
518 &ArpService->ServiceBinding,
566 if ((This ==
NULL) || (ChildHandle ==
NULL)) {
567 return EFI_INVALID_PARAMETER;
576 if (Instance ==
NULL) {
577 DEBUG ((DEBUG_ERROR,
"ArpSBCreateChild: Failed to allocate memory for Instance.\n"));
579 return EFI_OUT_OF_RESOURCES;
590 Status =
gBS->InstallMultipleProtocolInterfaces (
592 &gEfiArpProtocolGuid,
593 (VOID *)&Instance->ArpProto,
596 if (EFI_ERROR (Status)) {
597 DEBUG ((DEBUG_ERROR,
"ArpSBCreateChild: failed to install ARP protocol, %r.\n", Status));
606 Instance->Handle = *ChildHandle;
611 Status =
gBS->OpenProtocol (
612 ArpService->MnpChildHandle,
613 &gEfiManagedNetworkProtocolGuid,
617 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
619 if (EFI_ERROR (Status)) {
623 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
629 ArpService->ChildrenNumber++;
631 gBS->RestoreTPL (OldTpl);
635 if (EFI_ERROR (Status)) {
637 ArpService->MnpChildHandle,
638 &gEfiManagedNetworkProtocolGuid,
643 gBS->UninstallMultipleProtocolInterfaces (
645 &gEfiArpProtocolGuid,
691 if ((This ==
NULL) || (ChildHandle ==
NULL)) {
692 return EFI_INVALID_PARAMETER;
700 Status =
gBS->OpenProtocol (
702 &gEfiArpProtocolGuid,
704 ArpService->ImageHandle,
706 EFI_OPEN_PROTOCOL_GET_PROTOCOL
708 if (EFI_ERROR (Status)) {
709 return EFI_UNSUPPORTED;
714 if (Instance->InDestroy) {
721 Instance->InDestroy =
TRUE;
727 ArpService->MnpChildHandle,
728 &gEfiManagedNetworkProtocolGuid,
736 Status =
gBS->UninstallMultipleProtocolInterfaces (
738 &gEfiArpProtocolGuid,
742 if (EFI_ERROR (Status)) {
745 "ArpSBDestroyChild: Failed to uninstall the arp protocol, %r.\n",
749 Instance->InDestroy =
FALSE;
753 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
755 if (Instance->Configured) {
771 ArpService->ChildrenNumber--;
773 gBS->RestoreTPL (OldTpl);
EFI_STATUS ArpCreateService(IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ControllerHandle, IN OUT ARP_SERVICE_DATA *ArpService)
EFI_STATUS EFIAPI ArpDriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
VOID ArpCleanService(IN OUT ARP_SERVICE_DATA *ArpService)
EFI_STATUS EFIAPI ArpServiceBindingCreateChild(IN EFI_SERVICE_BINDING_PROTOCOL *This, IN EFI_HANDLE *ChildHandle)
EFI_STATUS EFIAPI ArpServiceBindingDestroyChild(IN EFI_SERVICE_BINDING_PROTOCOL *This, IN EFI_HANDLE ChildHandle)
EFI_STATUS EFIAPI ArpDriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
EFI_STATUS EFIAPI ArpDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
EFI_STATUS EFIAPI ArpDriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS EFIAPI ArpDestroyChildEntryInHandleBuffer(IN LIST_ENTRY *Entry, IN VOID *Context)
EFI_STATUS ArpConfigureInstance(IN ARP_INSTANCE_DATA *Instance, IN EFI_ARP_CONFIG_DATA *ConfigData OPTIONAL)
UINTN ArpDeleteCacheEntry(IN ARP_INSTANCE_DATA *Instance, IN BOOLEAN BySwAddress, IN UINT8 *AddressBuffer OPTIONAL, IN BOOLEAN Force)
VOID EFIAPI ArpOnFrameRcvd(IN EFI_EVENT Event, IN VOID *Context)
VOID EFIAPI ArpTimerHandler(IN EFI_EVENT Event, IN VOID *Context)
VOID ArpInitInstance(IN ARP_SERVICE_DATA *ArpService, OUT ARP_INSTANCE_DATA *Instance)
#define ARP_INSTANCE_DATA_FROM_THIS(a)
#define ARP_SERVICE_DATA_FROM_THIS(a)
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
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)
#define DEBUG(Expression)
EFI_STATUS EFIAPI NetLibCreateServiceChild(IN EFI_HANDLE Controller, IN EFI_HANDLE Image, IN EFI_GUID *ServiceBindingGuid, IN OUT EFI_HANDLE *ChildHandle)
EFI_STATUS EFIAPI NetLibDestroyServiceChild(IN EFI_HANDLE Controller, IN EFI_HANDLE Image, IN EFI_GUID *ServiceBindingGuid, IN EFI_HANDLE ChildHandle)
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 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