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);

View File

@@ -153,6 +153,8 @@ Udp4CreateService (
EFI_STATUS Status;
IP_IO_OPEN_DATA OpenData;
NetZeroMem (Udp4Service, sizeof (UDP4_SERVICE_DATA));
Udp4Service->Signature = UDP4_SERVICE_DATA_SIGNATURE;
Udp4Service->ServiceBinding = mUdp4ServiceBinding;
Udp4Service->ImageHandle = ImageHandle;
@@ -184,7 +186,7 @@ Udp4CreateService (
//
Status = IpIoOpen (Udp4Service->IpIo, &OpenData);
if (EFI_ERROR (Status)) {
goto RELEASE_IPIO;
goto ON_ERROR;
}
//
@@ -198,7 +200,7 @@ Udp4CreateService (
&Udp4Service->TimeoutEvent
);
if (EFI_ERROR (Status)) {
goto RELEASE_IPIO;
goto ON_ERROR;
}
//
@@ -210,18 +212,16 @@ Udp4CreateService (
UDP4_TIMEOUT_INTERVAL
);
if (EFI_ERROR (Status)) {
goto RELEASE_ALL;
goto ON_ERROR;
}
Udp4Service->MacString = NULL;
return EFI_SUCCESS;
RELEASE_ALL:
ON_ERROR:
gBS->CloseEvent (Udp4Service->TimeoutEvent);
RELEASE_IPIO:
if (Udp4Service->TimeoutEvent != NULL) {
gBS->CloseEvent (Udp4Service->TimeoutEvent);
}
IpIoDestroy (Udp4Service->IpIo);

View File

@@ -291,7 +291,7 @@ Udp4Configure (
//
Udp4FlushRcvdDgram (Instance);
////bugbug ASSERT (NetListIsEmpty (&Instance->DeliveredDgramQue));
ASSERT (NetListIsEmpty (&Instance->DeliveredDgramQue));
}
Udp4SetVariableData (Instance->Udp4Service);