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
This commit is contained in:
lpleahy
2011-09-30 23:02:35 +00:00
parent df7499fcc1
commit a88c31639b
40 changed files with 8998 additions and 6826 deletions

View File

@@ -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,