]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.c
Fix the comments to follow UEFI Spec regarding how to check an EFI_HANDLE is valid...
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Tcp4Dxe / Tcp4Driver.c
index 94a1753b812f9a39e87a11598fcb6bed26c086d5..a29b6bc434b66c8a687e1dc1b140774631fa6179 100644 (file)
@@ -1,7 +1,8 @@
 /** @file\r
+  Tcp driver function.\r
 \r
-Copyright (c) 2005 - 2007, Intel Corporation<BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>\r
+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<BR>\r
@@ -37,8 +38,8 @@ EFI_TCP4_PROTOCOL mTcp4ProtocolTemplate = {
 };\r
 \r
 SOCK_INIT_DATA mTcp4DefaultSockData = {\r
-  SOCK_STREAM,\r
-  (SOCK_STATE) 0,\r
+  SockStream,\r
+  0,\r
   NULL,\r
   TCP_BACKLOG,\r
   TCP_SND_BUF_SIZE,\r
@@ -302,7 +303,11 @@ Tcp4DriverBindingStart (
   //\r
   // Create a new IP IO to Consume it\r
   //\r
-  TcpServiceData->IpIo = IpIoCreate (This->DriverBindingHandle, ControllerHandle);\r
+  TcpServiceData->IpIo = IpIoCreate (\r
+                           This->DriverBindingHandle,\r
+                           ControllerHandle,\r
+                           IP_VERSION_4\r
+                           );\r
   if (NULL == TcpServiceData->IpIo) {\r
 \r
     DEBUG ((EFI_D_ERROR, "Tcp4DriverBindingStart: Have no enough"\r
@@ -317,8 +322,13 @@ Tcp4DriverBindingStart (
   //\r
   ZeroMem (&OpenData, sizeof (IP_IO_OPEN_DATA));\r
 \r
-  CopyMem (&OpenData.IpConfigData, &mIpIoDefaultIpConfigData, sizeof (OpenData.IpConfigData));\r
-  OpenData.IpConfigData.DefaultProtocol = EFI_IP_PROTO_TCP;\r
+  CopyMem (\r
+    &OpenData.IpConfigData.Ip4CfgData,\r
+    &mIp4IoDefaultIpConfigData,\r
+    sizeof (EFI_IP4_CONFIG_DATA)\r
+    );\r
+\r
+  OpenData.IpConfigData.Ip4CfgData.DefaultProtocol = EFI_IP_PROTO_TCP;\r
 \r
   OpenData.PktRcvdNotify = Tcp4RxCallback;\r
   Status                 = IpIoOpen (TcpServiceData->IpIo, &OpenData);\r
@@ -379,7 +389,7 @@ ON_ERROR:
     IpIoDestroy (TcpServiceData->IpIo);\r
   }\r
 \r
-  gBS->FreePool (TcpServiceData);\r
+  FreePool (TcpServiceData);\r
 \r
   return Status;\r
 }\r
@@ -484,7 +494,7 @@ Tcp4DriverBindingStop (
     //\r
     // Release the TCP service data\r
     //\r
-    gBS->FreePool (TcpServiceData);\r
+    FreePool (TcpServiceData);\r
   } else {\r
 \r
     while (!IsListEmpty (&TcpServiceData->SocketList)) {\r
@@ -667,6 +677,8 @@ Tcp4ServiceBindingCreateChild (
     *ChildHandle = Sock->SockHandle;\r
   }\r
 \r
+  mTcp4DefaultSockData.ProtoData = NULL;\r
+\r
   gBS->RestoreTPL (OldTpl);\r
   return Status;\r
 }\r
@@ -685,7 +697,7 @@ Tcp4ServiceBindingCreateChild (
   @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_INVALID_PARAMETER Child handle is NULL.\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