Clear up network stack to use R9 MdeLib:

1.Use driver model APIs in UefiLib
2.Register Unload Image in INF/MSA to be included in autogen code.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3962 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8 2007-09-28 06:02:01 +00:00
parent ba7e162ec1
commit da1d02010d
26 changed files with 1284 additions and 1445 deletions

View File

@ -475,41 +475,12 @@ NetLibGetNicHandle (
IN EFI_GUID *ProtocolGuid IN EFI_GUID *ProtocolGuid
); );
typedef
EFI_STATUS
(EFIAPI *NET_LIB_DRIVER_UNLOAD) (
IN EFI_HANDLE ImageHandle
);
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
NetLibDefaultUnload ( NetLibDefaultUnload (
IN EFI_HANDLE ImageHandle IN EFI_HANDLE ImageHandle
); );
EFI_STATUS
NetLibInstallAllDriverProtocolsWithUnload (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable,
IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
IN EFI_HANDLE DriverBindingHandle,
IN EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL
IN EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL
IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics, OPTIONAL
IN NET_LIB_DRIVER_UNLOAD CustomizedUnload
);
EFI_STATUS
NetLibInstallAllDriverProtocols (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable,
IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
IN EFI_HANDLE DriverBindingHandle,
IN EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL
IN EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL
IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL
);
enum { enum {
// //
//Various signatures //Various signatures

View File

@ -1276,143 +1276,3 @@ NetLibGetNicHandle (
return Handle; return Handle;
} }
EFI_STATUS
NetLibInstallAllDriverProtocols (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable,
IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
IN EFI_HANDLE DriverBindingHandle,
IN EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL
IN EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL
IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL
)
/*++
Routine Description:
Intialize a driver by installing the Driver Binding Protocol onto the
driver's DriverBindingHandle. This is typically the same as the driver's
ImageHandle, but it can be different if the driver produces multiple
DriverBinding Protocols. This function also initializes the EFI Driver
Library that initializes the global variables gST, gBS, gRT.
Arguments:
ImageHandle - The image handle of the driver
SystemTable - The EFI System Table that was passed to the driver's
entry point
DriverBinding - A Driver Binding Protocol instance that this driver
is producing.
DriverBindingHandle - The handle that DriverBinding is to be installe onto.
If this parameter is NULL, then a new handle is created.
ComponentName - A Component Name Protocol instance that this driver is
producing.
DriverConfiguration - A Driver Configuration Protocol instance that this
driver is producing.
DriverDiagnostics - A Driver Diagnostics Protocol instance that this
driver is producing.
Returns:
EFI_SUCCESS if all the protocols were installed onto DriverBindingHandle
Otherwise, then return status from gBS->InstallProtocolInterface()
--*/
{
return NetLibInstallAllDriverProtocolsWithUnload (
ImageHandle,
SystemTable,
DriverBinding,
DriverBindingHandle,
ComponentName,
DriverConfiguration,
DriverDiagnostics,
NetLibDefaultUnload
);
}
EFI_STATUS
NetLibInstallAllDriverProtocolsWithUnload (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable,
IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
IN EFI_HANDLE DriverBindingHandle,
IN EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL
IN EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL
IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics, OPTIONAL
IN NET_LIB_DRIVER_UNLOAD Unload
)
/*++
Routine Description:
Intialize a driver by installing the Driver Binding Protocol onto the
driver's DriverBindingHandle. This is typically the same as the driver's
ImageHandle, but it can be different if the driver produces multiple
DriverBinding Protocols. This function also initializes the EFI Driver
Library that initializes the global variables gST, gBS, gRT.
Arguments:
ImageHandle - The image handle of the driver
SystemTable - The EFI System Table that was passed to the driver's
entry point
DriverBinding - A Driver Binding Protocol instance that this driver
is producing.
DriverBindingHandle - The handle that DriverBinding is to be installe onto.
If this parameter is NULL, then a new handle is created.
ComponentName - A Component Name Protocol instance that this driver is
producing.
DriverConfiguration - A Driver Configuration Protocol instance that this
driver is producing.
DriverDiagnostics - A Driver Diagnostics Protocol instance that this
driver is producing.
Unload - The customized unload to install.
Returns:
EFI_SUCCESS if all the protocols were installed onto DriverBindingHandle
Otherwise, then return status from gBS->InstallProtocolInterface()
--*/
{
EFI_STATUS Status;
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
Status = EfiLibInstallAllDriverProtocols (
ImageHandle,
SystemTable,
DriverBinding,
DriverBindingHandle,
ComponentName,
DriverConfiguration,
DriverDiagnostics
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Retrieve the Loaded Image Protocol from Image Handle
//
Status = gBS->OpenProtocol (
ImageHandle,
&gEfiLoadedImageProtocolGuid,
(VOID **) &LoadedImage,
ImageHandle,
ImageHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Fill in the Unload() service of the Loaded Image Protocol
//
LoadedImage->Unload = (Unload == NULL) ? NetLibDefaultUnload : Unload;
return EFI_SUCCESS;
}

View File

@ -749,7 +749,7 @@ Returns:
--*/ --*/
{ {
return NetLibInstallAllDriverProtocols ( return EfiLibInstallAllDriverProtocols (
ImageHandle, ImageHandle,
SystemTable, SystemTable,
&gArpDriverBinding, &gArpDriverBinding,

View File

@ -24,7 +24,7 @@
EFI_SPECIFICATION_VERSION = 0x00020000 EFI_SPECIFICATION_VERSION = 0x00020000
ENTRY_POINT = ArpDriverEntryPoint ENTRY_POINT = ArpDriverEntryPoint
UNLOAD_IMAGE = NetLibDefaultUnload
# #
# The following information is for reference only and not required by the build tools. # The following information is for reference only and not required by the build tools.
# #

View File

@ -67,6 +67,7 @@
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification> <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
<Extern> <Extern>
<ModuleEntryPoint>ArpDriverEntryPoint</ModuleEntryPoint> <ModuleEntryPoint>ArpDriverEntryPoint</ModuleEntryPoint>
<ModuleUnloadImage>NetLibDefaultUnload</ModuleUnloadImage>
</Extern> </Extern>
</Externs> </Externs>
</ModuleSurfaceArea> </ModuleSurfaceArea>

View File

@ -61,7 +61,7 @@ Returns:
--*/ --*/
{ {
return NetLibInstallAllDriverProtocols ( return EfiLibInstallAllDriverProtocols (
ImageHandle, ImageHandle,
SystemTable, SystemTable,
&gDhcp4DriverBinding, &gDhcp4DriverBinding,

View File

@ -24,7 +24,7 @@
EFI_SPECIFICATION_VERSION = 0x00020000 EFI_SPECIFICATION_VERSION = 0x00020000
ENTRY_POINT = Dhcp4DriverEntryPoint ENTRY_POINT = Dhcp4DriverEntryPoint
UNLOAD_IMAGE = NetLibDefaultUnload
# #
# The following information is for reference only and not required by the build tools. # The following information is for reference only and not required by the build tools.
# #

View File

@ -72,6 +72,7 @@
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification> <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
<Extern> <Extern>
<ModuleEntryPoint>Dhcp4DriverEntryPoint</ModuleEntryPoint> <ModuleEntryPoint>Dhcp4DriverEntryPoint</ModuleEntryPoint>
<ModuleUnloadImage>NetLibDefaultUnload</ModuleUnloadImage>
</Extern> </Extern>
</Externs> </Externs>
</ModuleSurfaceArea> </ModuleSurfaceArea>

View File

@ -85,15 +85,14 @@ Returns:
--*/ --*/
{ {
return NetLibInstallAllDriverProtocolsWithUnload ( return EfiLibInstallAllDriverProtocols (
ImageHandle, ImageHandle,
SystemTable, SystemTable,
&gIp4ConfigDriverBinding, &gIp4ConfigDriverBinding,
ImageHandle, ImageHandle,
&gIp4ConfigComponentName, &gIp4ConfigComponentName,
NULL, NULL,
NULL, NULL
EfiIp4ConfigUnload
); );
} }

View File

@ -25,7 +25,7 @@
EFI_SPECIFICATION_VERSION = 0x00020000 EFI_SPECIFICATION_VERSION = 0x00020000
ENTRY_POINT = Ip4ConfigDriverEntryPoint ENTRY_POINT = Ip4ConfigDriverEntryPoint
UNLOAD_IMAGE = EfiIp4ConfigUnload
# #
# The following information is for reference only and not required by the build tools. # The following information is for reference only and not required by the build tools.
# #

View File

@ -72,6 +72,7 @@
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification> <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
<Extern> <Extern>
<ModuleEntryPoint>Ip4ConfigDriverEntryPoint</ModuleEntryPoint> <ModuleEntryPoint>Ip4ConfigDriverEntryPoint</ModuleEntryPoint>
<ModuleUnloadImage>EfiIp4ConfigUnload</ModuleUnloadImage>
</Extern> </Extern>
</Externs> </Externs>
</ModuleSurfaceArea> </ModuleSurfaceArea>

View File

@ -56,7 +56,7 @@ Returns:
--*/ --*/
{ {
return NetLibInstallAllDriverProtocols ( return EfiLibInstallAllDriverProtocols (
ImageHandle, ImageHandle,
SystemTable, SystemTable,
&gIp4DriverBinding, &gIp4DriverBinding,

View File

@ -24,6 +24,7 @@
EFI_SPECIFICATION_VERSION = 0x00020000 EFI_SPECIFICATION_VERSION = 0x00020000
ENTRY_POINT = Ip4DriverEntryPoint ENTRY_POINT = Ip4DriverEntryPoint
UNLOAD_IMAGE = NetLibDefaultUnload
# #
# The following information is for reference only and not required by the build tools. # The following information is for reference only and not required by the build tools.

View File

@ -96,6 +96,7 @@
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification> <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
<Extern> <Extern>
<ModuleEntryPoint>Ip4DriverEntryPoint</ModuleEntryPoint> <ModuleEntryPoint>Ip4DriverEntryPoint</ModuleEntryPoint>
<ModuleUnloadImage>NetLibDefaultUnload</ModuleUnloadImage>
</Extern> </Extern>
</Externs> </Externs>
</ModuleSurfaceArea> </ModuleSurfaceArea>

View File

@ -547,13 +547,13 @@ Returns:
--*/ --*/
{ {
return NetLibInstallAllDriverProtocols ( return EfiLibInstallAllDriverProtocols (
ImageHandle, ImageHandle,
SystemTable, SystemTable,
&gMnpDriverBinding, &gMnpDriverBinding,
ImageHandle, ImageHandle,
&gMnpComponentName, &gMnpComponentName,
NULL, NULL,
NULL NULL
); );
} }

View File

@ -25,7 +25,7 @@
EFI_SPECIFICATION_VERSION = 0x00020000 EFI_SPECIFICATION_VERSION = 0x00020000
ENTRY_POINT = MnpDriverEntryPoint ENTRY_POINT = MnpDriverEntryPoint
UNLOAD_IMAGE = NetLibDefaultUnload
# #
# The following information is for reference only and not required by the build tools. # The following information is for reference only and not required by the build tools.
# #

View File

@ -65,6 +65,7 @@
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification> <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
<Extern> <Extern>
<ModuleEntryPoint>MnpDriverEntryPoint</ModuleEntryPoint> <ModuleEntryPoint>MnpDriverEntryPoint</ModuleEntryPoint>
<ModuleUnloadImage>NetLibDefaultUnload</ModuleUnloadImage>
</Extern> </Extern>
</Externs> </Externs>
</ModuleSurfaceArea> </ModuleSurfaceArea>

View File

@ -58,7 +58,7 @@ Returns:
--*/ --*/
{ {
return NetLibInstallAllDriverProtocols ( return EfiLibInstallAllDriverProtocols (
ImageHandle, ImageHandle,
SystemTable, SystemTable,
&gMtftp4DriverBinding, &gMtftp4DriverBinding,

View File

@ -24,7 +24,7 @@
EFI_SPECIFICATION_VERSION = 0x00020000 EFI_SPECIFICATION_VERSION = 0x00020000
ENTRY_POINT = Mtftp4DriverEntryPoint ENTRY_POINT = Mtftp4DriverEntryPoint
UNLOAD_IMAGE = NetLibDefaultUnload
# #
# The following information is for reference only and not required by the build tools. # The following information is for reference only and not required by the build tools.
# #

View File

@ -74,6 +74,7 @@
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification> <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
<Extern> <Extern>
<ModuleEntryPoint>Mtftp4DriverEntryPoint</ModuleEntryPoint> <ModuleEntryPoint>Mtftp4DriverEntryPoint</ModuleEntryPoint>
<ModuleUnloadImage>NetLibDefaultUnload</ModuleUnloadImage>
</Extern> </Extern>
</Externs> </Externs>
</ModuleSurfaceArea> </ModuleSurfaceArea>

View File

@ -176,7 +176,7 @@ Returns:
// //
// Install the TCP4 Driver Binding Protocol // Install the TCP4 Driver Binding Protocol
// //
Status = NetLibInstallAllDriverProtocols ( Status = EfiLibInstallAllDriverProtocols (
ImageHandle, ImageHandle,
SystemTable, SystemTable,
&mTcp4DriverBinding, &mTcp4DriverBinding,
@ -185,7 +185,7 @@ Returns:
NULL, NULL,
NULL NULL
); );
ASSERT_EFI_ERROR (Status);
// //
// Initialize ISS and random port. // Initialize ISS and random port.
// //

View File

@ -25,7 +25,7 @@
EFI_SPECIFICATION_VERSION = 0x00020000 EFI_SPECIFICATION_VERSION = 0x00020000
ENTRY_POINT = Tcp4DriverEntryPoint ENTRY_POINT = Tcp4DriverEntryPoint
UNLOAD_IMAGE = NetLibDefaultUnload
# #
# The following information is for reference only and not required by the build tools. # The following information is for reference only and not required by the build tools.
# #

View File

@ -85,6 +85,7 @@
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification> <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
<Extern> <Extern>
<ModuleEntryPoint>Tcp4DriverEntryPoint</ModuleEntryPoint> <ModuleEntryPoint>Tcp4DriverEntryPoint</ModuleEntryPoint>
<ModuleUnloadImage>NetLibDefaultUnload</ModuleUnloadImage>
</Extern> </Extern>
</Externs> </Externs>
</ModuleSurfaceArea> </ModuleSurfaceArea>

View File

@ -504,7 +504,7 @@ Returns:
// //
// Install the Udp4DriverBinding and Udp4ComponentName protocols. // Install the Udp4DriverBinding and Udp4ComponentName protocols.
// //
Status = NetLibInstallAllDriverProtocols ( Status = EfiLibInstallAllDriverProtocols (
ImageHandle, ImageHandle,
SystemTable, SystemTable,
&gUdp4DriverBinding, &gUdp4DriverBinding,

View File

@ -25,7 +25,7 @@
EFI_SPECIFICATION_VERSION = 0x00020000 EFI_SPECIFICATION_VERSION = 0x00020000
ENTRY_POINT = Udp4DriverEntryPoint ENTRY_POINT = Udp4DriverEntryPoint
UNLOAD_IMAGE = NetLibDefaultUnload
# #
# The following information is for reference only and not required by the build tools. # The following information is for reference only and not required by the build tools.
# #

View File

@ -72,6 +72,7 @@
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification> <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
<Extern> <Extern>
<ModuleEntryPoint>Udp4DriverEntryPoint</ModuleEntryPoint> <ModuleEntryPoint>Udp4DriverEntryPoint</ModuleEntryPoint>
<ModuleUnloadImage>NetLibDefaultUnload</ModuleUnloadImage>
</Extern> </Extern>
</Externs> </Externs>
</ModuleSurfaceArea> </ModuleSurfaceArea>