summaryrefslogtreecommitdiff
path: root/StdLib/SocketDxe
diff options
context:
space:
mode:
authorlpleahy <lpleahy@6f19259b-4bc3-4df7-8a09-765794883524>2011-09-30 23:02:35 +0000
committerlpleahy <lpleahy@6f19259b-4bc3-4df7-8a09-765794883524>2011-09-30 23:02:35 +0000
commita88c31639bb24c73383a4528a5b77066e805148b (patch)
tree058801cd8687b0a0c6f82459b56b2ad3beb43bf4 /StdLib/SocketDxe
parentdf7499fcc1fbd6c825cabf19bbed379688416125 (diff)
downloadedk2-platforms-a88c31639bb24c73383a4528a5b77066e805148b.tar.xz
Update the sockets library code
* Passes conformance and functional tests. * Builds with GCC 4.4 compiler. Signed-off by: lpleahy git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12497 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'StdLib/SocketDxe')
-rw-r--r--StdLib/SocketDxe/ComponentName.c6
-rw-r--r--StdLib/SocketDxe/DriverBinding.c71
-rw-r--r--StdLib/SocketDxe/EntryUnload.c63
-rw-r--r--StdLib/SocketDxe/Socket.h6
4 files changed, 110 insertions, 36 deletions
diff --git a/StdLib/SocketDxe/ComponentName.c b/StdLib/SocketDxe/ComponentName.c
index 7fe9c711ee..ff1f101516 100644
--- a/StdLib/SocketDxe/ComponentName.c
+++ b/StdLib/SocketDxe/ComponentName.c
@@ -17,7 +17,7 @@
/**
EFI Component Name Protocol declaration
**/
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gComponentName = {
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL mComponentName = {
GetDriverName,
GetControllerName,
"eng"
@@ -26,7 +26,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gComponentName = {
/**
EFI Component Name 2 Protocol declaration
**/
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gComponentName2 = {
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL mComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) GetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) GetControllerName,
"en"
@@ -91,7 +91,7 @@ GetDriverName (
pThis->SupportedLanguages,
mDriverNameTable,
ppDriverName,
- (BOOLEAN)(pThis == &gComponentName)
+ (BOOLEAN)(pThis == &mComponentName)
);
return Status;
}
diff --git a/StdLib/SocketDxe/DriverBinding.c b/StdLib/SocketDxe/DriverBinding.c
index 7de7f62a35..4d68f37be2 100644
--- a/StdLib/SocketDxe/DriverBinding.c
+++ b/StdLib/SocketDxe/DriverBinding.c
@@ -10,6 +10,31 @@
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+ \section NetworkAdapterManagement Network Adapter Management
+ Network adapters may come and go over the life if a system running
+ UEFI. The SocketDxe driver uses the driver binding API to manage
+ the connections to network adapters.
+
+ The ::DriverSupported routine selects network adapters that the
+ socket layer is not using. This determination by the lack of the
+ tag GUID associated with the network protocol in the
+ ::cEslSocketBinding array. The selected network adapters are
+ passed to the ::DriverStart routine.
+
+ The ::DriverStart routine calls the ::EslServiceConnect routine
+ to create an ::ESL_SERVICE structure to manage the network adapter
+ for the socket layer. EslServiceConnect also installs the tag
+ GUID on the network adapter to prevent future calls from
+ ::DriverSupported. EslService also calls the network specific
+ initialization routine listed in ESL_SOCKET_BINDING::pfnInitialize
+ field of the ::cEslSocketBinding entry.
+
+ The ::DriverStop routine calls the ::EslServiceDisconnect routine
+ to undo the work done by ::DriverStart. The socket layer must break
+ the active network connections, then remove the tag GUIDs from the
+ controller handle and free ::ESL_SERVICE structure.
+
**/
#include "Socket.h"
@@ -17,10 +42,17 @@
/**
Verify the controller type
- Determine if any of the network service binding protocols exist on
- the controller handle. If so, verify that these protocols are not
- already in use. Call ::DriverStart for any network service binding
- protocol that is not in use.
+ This routine walks the cEslSocketBinding array to determines if
+ the controller is a network adapter by supporting any of the
+ network protocols required by the sockets layer. If so, the
+ routine verifies that the socket layer is not already using the
+ support by looking for the tag GUID listed in the corresponding
+ array entry. The controller handle is passed to the ::DriverStart
+ routine if sockets can use the network adapter.
+ See the \ref NetworkAdapterManagement section.
+
+ This routine is called by the UEFI driver framework during connect
+ processing.
@param [in] pThis Protocol instance pointer.
@param [in] Controller Handle of device to test.
@@ -38,9 +70,9 @@ DriverSupported (
IN EFI_DEVICE_PATH_PROTOCOL * pRemainingDevicePath
)
{
- CONST DT_SOCKET_BINDING * pEnd;
+ CONST ESL_SOCKET_BINDING * pEnd;
VOID * pInterface;
- CONST DT_SOCKET_BINDING * pSocketBinding;
+ CONST ESL_SOCKET_BINDING * pSocketBinding;
EFI_STATUS Status;
//
@@ -104,11 +136,14 @@ DriverSupported (
/**
- Connect to the network service bindings
+ Connect to a network adapter
- Walk the network service protocols on the controller handle and
- locate any that are not in use. Create service structures to
- manage the service binding for the socket driver.
+ This routine calls ::EslServiceConnect to connect the socket
+ layer to the network adapters. See the \ref NetworkAdapterManagement
+ section.
+
+ This routine is called by the UEFI driver framework during connect
+ processing if the controller passes the tests in ::DriverSupported.
@param [in] pThis Protocol instance pointer.
@param [in] Controller Handle of device to work with.
@@ -145,9 +180,17 @@ DriverStart (
/**
- Stop this driver on Controller by removing NetworkInterfaceIdentifier protocol and
- closing the DevicePath and PciIo protocols on Controller.
+ Disconnect from a network adapter
+
+ This routine calls ::EslServiceDisconnect to disconnect the socket
+ layer from the network adapters. See the \ref NetworkAdapterManagement
+ section.
+ This routine is called by ::DriverUnload when the socket layer
+ is being unloaded. This routine should also called by the UEFI
+ driver framework when a network adapter is being unloaded from
+ the system.
+
@param [in] pThis Protocol instance pointer.
@param [in] Controller Handle of device to stop driver on.
@param [in] NumberOfChildren How many children need to be stopped.
@@ -186,9 +229,9 @@ DriverStop (
/**
- Driver binding protocol definition
+ Driver binding protocol for the SocketDxe driver.
**/
-EFI_DRIVER_BINDING_PROTOCOL gDriverBinding = {
+EFI_DRIVER_BINDING_PROTOCOL mDriverBinding = {
DriverSupported,
DriverStart,
DriverStop,
diff --git a/StdLib/SocketDxe/EntryUnload.c b/StdLib/SocketDxe/EntryUnload.c
index 6afd8e6b48..1f550c95b3 100644
--- a/StdLib/SocketDxe/EntryUnload.c
+++ b/StdLib/SocketDxe/EntryUnload.c
@@ -15,14 +15,31 @@
#include "Socket.h"
-CONST EFI_GUID mEslRawServiceGuid = {
- 0xf9f5d280, 0x8a4b, 0x48e2, { 0x96, 0x28, 0xda, 0xfa, 0xa7, 0x70, 0x54, 0x5d }
+/**
+ The following GUID values are only used by the SocketDxe driver. An
+ alternative set of values exists in EfiSocketLib\UseEfiSocketLib.c
+ which an application uses when it links against EfiSocketLib. These
+ two sets of values allow the SocketDxe driver to coexist with socket
+ applications.
+
+ Tag GUID - IPv4 in use by SocketDxe
+**/
+CONST EFI_GUID mEslIp4ServiceGuid = {
+ 0x4e3a82e6, 0xe43f, 0x460a, { 0x86, 0x6e, 0x9b, 0x5a, 0xab, 0x80, 0x44, 0x48 }
};
+
+/**
+ Tag GUID - TCPv4 in use by SocketDxe
+**/
CONST EFI_GUID mEslTcp4ServiceGuid = {
0x4dcaab0a, 0x1990, 0x4352, { 0x8d, 0x2f, 0x2d, 0x8f, 0x13, 0x55, 0x98, 0xa5 }
};
+
+/**
+ Tag GUID - UDPv4 in use by SocketDxe
+**/
CONST EFI_GUID mEslUdp4ServiceGuid = {
0x43a110ce, 0x9ccd, 0x402b, { 0x8c, 0x29, 0x4a, 0x6d, 0x8a, 0xf7, 0x79, 0x90 }
};
@@ -98,7 +115,7 @@ DriverUnload (
//
Max = BufferSize / sizeof ( pHandle[ 0 ]);
for ( Index = 0; Max > Index; Index++ ) {
- Status = DriverStop ( &gDriverBinding,
+ Status = DriverStop ( &mDriverBinding,
pHandle[ Index ],
0,
NULL );
@@ -131,7 +148,7 @@ DriverUnload (
// Done with the socket layer
//
if ( !EFI_ERROR ( Status )) {
- Status = EslServiceUninstall ( ImageHandle );
+ Status = EslDxeUninstall ( ImageHandle );
if ( !EFI_ERROR ( Status )) {
//
// Remove the protocols installed by the EntryPoint routine.
@@ -139,11 +156,11 @@ DriverUnload (
Status = gBS->UninstallMultipleProtocolInterfaces (
ImageHandle,
&gEfiDriverBindingProtocolGuid,
- &gDriverBinding,
+ &mDriverBinding,
&gEfiComponentNameProtocolGuid,
- &gComponentName,
+ &mComponentName,
&gEfiComponentName2ProtocolGuid,
- &gComponentName2,
+ &mComponentName2,
NULL
);
if ( !EFI_ERROR ( Status )) {
@@ -225,10 +242,10 @@ EntryPoint (
Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
pSystemTable,
- &gDriverBinding,
+ &mDriverBinding,
ImageHandle,
- &gComponentName,
- &gComponentName2
+ &mComponentName,
+ &mComponentName2
);
if ( !EFI_ERROR ( Status )) {
DEBUG (( DEBUG_POOL | DEBUG_INIT | DEBUG_INFO,
@@ -250,7 +267,7 @@ EntryPoint (
// Make the socket serivces available to other drivers
// and applications
//
- Status = EslServiceInstall ( &ImageHandle );
+ Status = EslDxeInstall ( &ImageHandle );
if ( EFI_ERROR ( Status )) {
//
// Disconnect from the network
@@ -263,11 +280,11 @@ EntryPoint (
gBS->UninstallMultipleProtocolInterfaces (
ImageHandle,
&gEfiDriverBindingProtocolGuid,
- &gDriverBinding,
+ &mDriverBinding,
&gEfiComponentNameProtocolGuid,
- &gComponentName,
+ &mComponentName,
&gEfiComponentName2ProtocolGuid,
- &gComponentName2,
+ &mComponentName2,
NULL
);
DEBUG (( DEBUG_POOL | DEBUG_INIT | DEBUG_INFO,
@@ -292,5 +309,19 @@ EntryPoint (
}
-PFN_ESL_xSTRUCTOR mpfnEslConstructor = NULL;
-PFN_ESL_xSTRUCTOR mpfnEslDestructor = NULL;
+/**
+ Socket layer's service binding protocol delcaration.
+**/
+CONST EFI_SERVICE_BINDING_PROTOCOL mEfiServiceBinding = {
+ EslDxeCreateChild,
+ EslDxeDestroyChild
+};
+
+
+/**
+ The following entries disable the constructor and destructor
+ for the SocketDxe driver. Note that socket applications linking
+ against EfiSocketLib use different redirection.
+**/
+PFN_ESL_xSTRUCTOR mpfnEslConstructor = NULL; ///< No EfiSocketLib constructor needed for SocketDxe
+PFN_ESL_xSTRUCTOR mpfnEslDestructor = NULL; ///< No EfiSocketLib destructor needed for SocketDxe
diff --git a/StdLib/SocketDxe/Socket.h b/StdLib/SocketDxe/Socket.h
index dfa4dad51b..7d8334c4a6 100644
--- a/StdLib/SocketDxe/Socket.h
+++ b/StdLib/SocketDxe/Socket.h
@@ -23,9 +23,9 @@
// Protocol Declarations
//------------------------------------------------------------------------------
-extern EFI_COMPONENT_NAME_PROTOCOL gComponentName; ///< Component name protocol declaration
-extern EFI_COMPONENT_NAME2_PROTOCOL gComponentName2; ///< Component name 2 protocol declaration
-extern EFI_DRIVER_BINDING_PROTOCOL gDriverBinding; ///< Driver binding protocol declaration
+extern EFI_COMPONENT_NAME_PROTOCOL mComponentName; ///< Component name protocol declaration
+extern EFI_COMPONENT_NAME2_PROTOCOL mComponentName2; ///< Component name 2 protocol declaration
+extern EFI_DRIVER_BINDING_PROTOCOL mDriverBinding; ///< Driver binding protocol declaration
extern EFI_SERVICE_BINDING_PROTOCOL mServiceBinding; ///< Service binding protocol delcaration
//------------------------------------------------------------------------------