Sync the latest version from R8.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4400 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff
2007-12-18 07:01:23 +00:00
parent 372787b85a
commit c4a62a12c2
26 changed files with 790 additions and 424 deletions

View File

@ -123,7 +123,8 @@ Udp4DriverBindingStart (
Status = Udp4CreateService (Udp4Service, This->DriverBindingHandle, ControllerHandle);
if (EFI_ERROR (Status)) {
goto FREE_SERVICE;
NetFreePool (Udp4Service);
return Status;
}
//
@ -136,21 +137,12 @@ Udp4DriverBindingStart (
NULL
);
if (EFI_ERROR (Status)) {
goto CLEAN_SERVICE;
Udp4CleanService (Udp4Service);
NetFreePool (Udp4Service);
} else {
Udp4SetVariableData (Udp4Service);
}
Udp4SetVariableData (Udp4Service);
return Status;
CLEAN_SERVICE:
Udp4CleanService (Udp4Service);
FREE_SERVICE:
NetFreePool (Udp4Service);
return Status;
}
@ -188,7 +180,7 @@ Udp4DriverBindingStop (
//
NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiIp4ProtocolGuid);
if (NicHandle == NULL) {
return EFI_SUCCESS;
return EFI_DEVICE_ERROR;
}
//
@ -208,35 +200,30 @@ Udp4DriverBindingStop (
Udp4Service = UDP4_SERVICE_DATA_FROM_THIS (ServiceBinding);
//
// Uninstall the UDP4 ServiceBinding Protocol.
//
Status = gBS->UninstallMultipleProtocolInterfaces (
NicHandle,
&gEfiUdp4ServiceBindingProtocolGuid,
&Udp4Service->ServiceBinding,
NULL
);
if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
if (NumberOfChildren == 0) {
gBS->UninstallMultipleProtocolInterfaces (
NicHandle,
&gEfiUdp4ServiceBindingProtocolGuid,
&Udp4Service->ServiceBinding,
NULL
);
Udp4ClearVariableData (Udp4Service);
Udp4CleanService (Udp4Service);
NetFreePool (Udp4Service);
} else {
while (!NetListIsEmpty (&Udp4Service->ChildrenList)) {
Instance = NET_LIST_HEAD (&Udp4Service->ChildrenList, UDP4_INSTANCE_DATA, Link);
ServiceBinding->DestroyChild (ServiceBinding, Instance->ChildHandle);
}
}
while (!NetListIsEmpty (&Udp4Service->ChildrenList)) {
//
// Destroy all instances.
//
Instance = NET_LIST_HEAD (&Udp4Service->ChildrenList, UDP4_INSTANCE_DATA, Link);
ServiceBinding->DestroyChild (ServiceBinding, Instance->ChildHandle);
}
Udp4ClearVariableData (Udp4Service);
Udp4CleanService (Udp4Service);
NetFreePool (Udp4Service);
return EFI_SUCCESS;
return Status;
}
@ -277,7 +264,7 @@ Udp4ServiceBindingCreateChild (
//
// Allocate the instance private data structure.
//
Instance = NetAllocatePool (sizeof (UDP4_INSTANCE_DATA));
Instance = NetAllocateZeroPool (sizeof (UDP4_INSTANCE_DATA));
if (Instance == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@ -290,7 +277,7 @@ Udp4ServiceBindingCreateChild (
Instance->IpInfo = IpIoAddIp (Udp4Service->IpIo);
if (Instance->IpInfo == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto FREE_INSTANCE;
goto ON_ERROR;
}
//
@ -303,7 +290,7 @@ Udp4ServiceBindingCreateChild (
NULL
);
if (EFI_ERROR (Status)) {
goto REMOVE_IPINFO;
goto ON_ERROR;
}
Instance->ChildHandle = *ChildHandle;
@ -320,7 +307,7 @@ Udp4ServiceBindingCreateChild (
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
);
if (EFI_ERROR (Status)) {
goto UNINSTALL_PROTOCOL;
goto ON_ERROR;
}
OldTpl = NET_RAISE_TPL (NET_TPL_LOCK);
@ -333,22 +320,22 @@ Udp4ServiceBindingCreateChild (
NET_RESTORE_TPL (OldTpl);
return Status;
return EFI_SUCCESS;
UNINSTALL_PROTOCOL:
ON_ERROR:
gBS->UninstallMultipleProtocolInterfaces (
Instance->ChildHandle,
&gEfiUdp4ProtocolGuid,
&Instance->Udp4Proto,
NULL
);
if (Instance->ChildHandle != NULL) {
gBS->UninstallMultipleProtocolInterfaces (
Instance->ChildHandle,
&gEfiUdp4ProtocolGuid,
&Instance->Udp4Proto,
NULL
);
}
REMOVE_IPINFO:
IpIoRemoveIp (Udp4Service->IpIo, Instance->IpInfo);
FREE_INSTANCE:
if (Instance->IpInfo != NULL) {
IpIoRemoveIp (Udp4Service->IpIo, Instance->IpInfo);
}
Udp4CleanInstance (Instance);