]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.c
Add comments for functions.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Tcp4Dxe / Tcp4Driver.c
index c51962ba9ebaf172f671403139f10a0d05131ee2..921332cbe069066638f3fcd3779d6ea9f72eb933 100644 (file)
@@ -1,21 +1,14 @@
 /** @file\r
 \r
-Copyright (c) 2005 - 2007, Intel Corporation\r
+Copyright (c) 2005 - 2007, Intel Corporation<BR>\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+http://opensource.org/licenses/bsd-license.php<BR>\r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module Name:\r
-\r
-  Tcp4Driver.c\r
-\r
-Abstract:\r
-\r
-\r
 **/\r
 \r
 #include "Tcp4Main.h"\r
@@ -187,17 +180,33 @@ Tcp4DriverEntryPoint (
 \r
 \r
 /**\r
-  Test to see if this driver supports ControllerHandle.\r
-\r
-  @param  This                   Protocol instance pointer.\r
-  @param  ControllerHandle       Handle of device to test.\r
-  @param  RemainingDevicePath    Optional parameter use to pick a specific child\r
-                                 device to start.\r
-\r
-  @retval EFI_SUCCESS            This driver supports this device.\r
-  @retval EFI_ALREADY_STARTED    This driver is already running on this device.\r
-  @retval other                  This driver does not support this device.\r
-\r
+  Tests to see if this driver supports a given controller.\r
+  \r
+  If a child device is provided, it further tests to see if this driver supports \r
+  creating a handle for the specified child device.\r
+\r
+  @param  This                 A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
+  @param  ControllerHandle     The handle of the controller to test. This handle \r
+                               must support a protocol interface that supplies \r
+                               an I/O abstraction to the driver.\r
+  @param  RemainingDevicePath  A pointer to the remaining portion of a device path. \r
+                               This parameter is ignored by device drivers, and is optional for bus drivers.\r
+\r
+\r
+  @retval EFI_SUCCESS          The device specified by ControllerHandle and\r
+                               RemainingDevicePath is supported by the driver \r
+                               specified by This.\r
+  @retval EFI_ALREADY_STARTED  The device specified by ControllerHandle and\r
+                               RemainingDevicePath is already being managed by \r
+                               the driver specified by This.\r
+  @retval EFI_ACCESS_DENIED    The device specified by ControllerHandle and\r
+                               RemainingDevicePath is already being managed by a \r
+                               different driver or an application that requires \r
+                               exclusive access.\r
+  @retval EFI_UNSUPPORTED      The device specified by ControllerHandle and\r
+                               RemainingDevicePath is not supported by the driver \r
+                               specified by This.\r
+                               \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -241,17 +250,32 @@ Tcp4DriverBindingSupported (
 \r
 \r
 /**\r
-  Start this driver on ControllerHandle.\r
-\r
-  @param  This                   Protocol instance pointer.\r
-  @param  ControllerHandle       Handle of device to bind driver to.\r
-  @param  RemainingDevicePath    Optional parameter use to pick a specific child\r
-                                 device to start.\r
-\r
-  @retval EFI_SUCCESS            The driver is added to ControllerHandle.\r
-  @retval EFI_OUT_OF_RESOURCES   There are not enough resources to start the\r
-                                 driver.\r
-  @retval other                  The driver cannot be added to ControllerHandle.\r
+  Start this driver on ControllerHandle. \r
+  \r
+  The Start() function is designed to be invoked from the EFI boot service \r
+  ConnectController(). As a result, much of the error checking on the parameters \r
+  to Start() has been moved into this common boot service. It is legal to call \r
+  Start() from other locations, but the following calling restrictions must be \r
+  followed or the system behavior will not be deterministic.\r
+  1. ControllerHandle must be a valid EFI_HANDLE.\r
+  2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally \r
+     aligned EFI_DEVICE_PATH_PROTOCOL.\r
+  3. Prior to calling Start(), the Supported() function for the driver specified \r
+     by This must have been called with the same calling parameters, and Supported() \r
+     must have returned EFI_SUCCESS.\r
+\r
+  @param  This                 A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
+  @param  ControllerHandle     The handle of the controller to start. This handle \r
+                               must support a protocol interface that supplies \r
+                               an I/O abstraction to the driver.\r
+  @param  RemainingDevicePath  A pointer to the remaining portion of a device path. \r
+                               This parameter is ignored by device drivers, and is \r
+                               optional for bus drivers.\r
+\r
+  @retval EFI_SUCCESS          The device was started.\r
+  @retval EFI_ALREADY_STARTED  The device could not be started due to a device error.\r
+  @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack \r
+                               of resources.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -270,7 +294,7 @@ Tcp4DriverBindingStart (
 \r
   if (NULL == TcpServiceData) {\r
     DEBUG ((EFI_D_ERROR, "Tcp4DriverBindingStart: Have no enough"\r
-      " resource to create a Tcp Servcie Data!\n"));\r
+      " resource to create a Tcp Servcie Data\n"));\r
 \r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
@@ -282,7 +306,7 @@ Tcp4DriverBindingStart (
   if (NULL == TcpServiceData->IpIo) {\r
 \r
     DEBUG ((EFI_D_ERROR, "Tcp4DriverBindingStart: Have no enough"\r
-      " resource to create an Ip Io!\n"));\r
+      " resource to create an Ip Io\n"));\r
 \r
     Status = EFI_OUT_OF_RESOURCES;\r
     goto ON_ERROR;\r
@@ -363,15 +387,29 @@ ON_ERROR:
 \r
 /**\r
   Stop this driver on ControllerHandle.\r
+  \r
+  The Stop() function is designed to be invoked from the EFI boot service \r
+  DisconnectController(). As a result, much of the error checking on the parameters \r
+  to Stop() has been moved into this common boot service. It is legal to call Stop() \r
+  from other locations, but the following calling restrictions must be followed \r
+  or the system behavior will not be deterministic.\r
+  1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call \r
+     to this same driver's Start() function.\r
+  2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid\r
+     EFI_HANDLE. In addition, all of these handles must have been created in this \r
+     driver's Start() function, and the Start() function must have called OpenProtocol() \r
+     on ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r
+  \r
+  @param  This              A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
+  @param  ControllerHandle  A handle to the device being stopped. The handle must \r
+                            support a bus specific I/O protocol for the driver \r
+                            to use to stop the device.\r
+  @param  NumberOfChildren  The number of child device handles in ChildHandleBuffer.\r
+  @param  ChildHandleBuffer An array of child handles to be freed. May be NULL if \r
+                            NumberOfChildren is 0.\r
 \r
-  @param  This                   Protocol instance pointer.\r
-  @param  ControllerHandle       Handle of device to stop driver on.\r
-  @param  NumberOfChildren       Number of Handles in ChildHandleBuffer. If number\r
-                                 of children is zero stop the entire bus driver.\r
-  @param  ChildHandleBuffer      List of Child Handles to Stop.\r
-\r
-  @retval EFI_SUCCESS            This driver is removed from ControllerHandle.\r
-  @retval other                  This driver is not removed from ControllerHandle.\r
+  @retval EFI_SUCCESS       The device was stopped.\r
+  @retval EFI_DEVICE_ERROR  The device could not be stopped due to a device error.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -569,18 +607,23 @@ Tcp4DestroySocketCallback (
 }\r
 \r
 /**\r
-  Creates a child handle with a set of TCP4 services.\r
-\r
-  @param  This                   Protocol instance pointer.\r
-  @param  ChildHandle            Pointer to the handle of the child to create.  If\r
-                                 it is NULL, then a new handle is created. If it is\r
-                                 not NULL, then the I/O services are added to the\r
-                                 existing child handle.\r
-\r
-  @retval EFI_SUCCESS            The child handle is created.\r
-  @retval EFI_INVALID_PARAMETER  One or more parameters are invalid.\r
-  @retval EFI_OUT_OF_RESOURCES   There are not enough resources to create the\r
-                                 child.\r
+  Creates a child handle and installs a protocol.\r
+  \r
+  The CreateChild() function installs a protocol on ChildHandle. If ChildHandle \r
+  is a pointer to NULL, then a new handle is created and returned in ChildHandle. \r
+  If ChildHandle is not a pointer to NULL, then the protocol installs on the existing \r
+  ChildHandle.\r
+\r
+  @param  This        Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
+  @param  ChildHandle Pointer to the handle of the child to create. If it is NULL, then \r
+                      a new handle is created. If it is a pointer to an existing UEFI \r
+                      handle, then the protocol is added to the existing UEFI handle.\r
+\r
+  @retval EFI_SUCCES            The protocol was added to ChildHandle.\r
+  @retval EFI_INVALID_PARAMETER ChildHandle is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES  There are not enough resources availabe to create\r
+                                the child.\r
+  @retval other                 The child handle was not created.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -630,16 +673,23 @@ Tcp4ServiceBindingCreateChild (
 \r
 \r
 /**\r
-  Destroys a child handle with a set of UDP4 services.\r
-\r
-  @param  This                   Protocol instance pointer.\r
-  @param  ChildHandle            Handle of the child to be destroyed.\r
-\r
-  @retval EFI_SUCCESS            The TCP4 services are removed from  the child\r
-                                 handle.\r
-  @retval EFI_INVALID_PARAMETER  One or more parameters are invalid.\r
-  @retval other                  The child handle is not destroyed.\r
-\r
+  Destroys a child handle with a protocol installed on it.\r
+  \r
+  The DestroyChild() function does the opposite of CreateChild(). It removes a protocol \r
+  that was installed by CreateChild() from ChildHandle. If the removed protocol is the \r
+  last protocol on ChildHandle, then ChildHandle is destroyed.\r
+\r
+  @param  This         Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
+  @param  ChildHandle  Handle of the child to destroy\r
+\r
+  @retval EFI_SUCCES            The protocol was removed from ChildHandle.\r
+  @retval EFI_UNSUPPORTED       ChildHandle does not support the protocol that is \r
+                                being removed.\r
+  @retval EFI_INVALID_PARAMETER Child handle is not a valid UEFI Handle.\r
+  @retval EFI_ACCESS_DENIED     The protocol could not be removed from the ChildHandle\r
+                                because its services are being used.\r
+  @retval other                 The child handle was not destroyed.\r
+  \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r