]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/SnpDxe/Stop.c
sync comments, fix function header, rename variable name to follow coding style.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / SnpDxe / Stop.c
index 63725237b7c465916812e44e2675185af27d6cad..2eedfcd72617f880d4b7f91a5270a3daeb4110b3 100644 (file)
@@ -1,62 +1,60 @@
 /** @file\r
 /** @file\r
-Copyright (c) 2004 - 2007, Intel Corporation\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
+    Implementation of stopping a network interface.\r
\r
+Copyright (c) 2004 - 2007, Intel Corporation. <BR> \r
+All rights reserved. This program and the accompanying materials are licensed \r
+and made available under the terms and conditions of the BSD License which \r
+accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \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
 \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
-  stop.c\r
-\r
-Abstract:\r
-\r
-Revision history:\r
-  2000-Feb-09 M(f)J   Genesis.\r
-\r
 **/\r
 \r
 #include "Snp.h"\r
 \r
 \r
 /**\r
 **/\r
 \r
 #include "Snp.h"\r
 \r
 \r
 /**\r
-  this routine calls undi to stop the interface and changes the snp state\r
+  this routine calls undi to stop the interface and changes the snp state.\r
 \r
 \r
-  @param  snp   pointer to snp driver structure\r
+  @param  Snp   pointer to snp driver structure\r
 \r
 \r
+  @retval EFI_INVALID_PARAMETER  invalid parameter\r
+  @retval EFI_NOT_STARTED        SNP is not started\r
+  @retval EFI_DEVICE_ERROR       SNP is not initialized\r
+  @retval EFI_UNSUPPORTED        operation unsupported\r
 \r
 **/\r
 EFI_STATUS\r
 \r
 **/\r
 EFI_STATUS\r
-pxe_stop (\r
-  SNP_DRIVER *snp\r
+PxeStop (\r
+  SNP_DRIVER *Snp\r
   )\r
 {\r
   )\r
 {\r
-  snp->cdb.OpCode     = PXE_OPCODE_STOP;\r
-  snp->cdb.OpFlags    = PXE_OPFLAGS_NOT_USED;\r
-  snp->cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
-  snp->cdb.DBsize     = PXE_DBSIZE_NOT_USED;\r
-  snp->cdb.CPBaddr    = PXE_CPBADDR_NOT_USED;\r
-  snp->cdb.DBaddr     = PXE_DBADDR_NOT_USED;\r
-  snp->cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
-  snp->cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
-  snp->cdb.IFnum      = snp->if_num;\r
-  snp->cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
+  Snp->Cdb.OpCode     = PXE_OPCODE_STOP;\r
+  Snp->Cdb.OpFlags    = PXE_OPFLAGS_NOT_USED;\r
+  Snp->Cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
+  Snp->Cdb.DBsize     = PXE_DBSIZE_NOT_USED;\r
+  Snp->Cdb.CPBaddr    = PXE_CPBADDR_NOT_USED;\r
+  Snp->Cdb.DBaddr     = PXE_DBADDR_NOT_USED;\r
+  Snp->Cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
+  Snp->Cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
+  Snp->Cdb.IFnum      = Snp->IfNum;\r
+  Snp->Cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
 \r
   //\r
   // Issue UNDI command\r
   //\r
   DEBUG ((EFI_D_NET, "\nsnp->undi.stop()  "));\r
 \r
 \r
   //\r
   // Issue UNDI command\r
   //\r
   DEBUG ((EFI_D_NET, "\nsnp->undi.stop()  "));\r
 \r
-  (*snp->issue_undi32_command) ((UINT64)(UINTN) &snp->cdb);\r
+  (*Snp->IssueUndi32Command) ((UINT64)(UINTN) &Snp->Cdb);\r
 \r
 \r
-  if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) {\r
+  if (Snp->Cdb.StatCode != PXE_STATCODE_SUCCESS) {\r
     DEBUG (\r
       (EFI_D_WARN,\r
       "\nsnp->undi.stop()  %xh:%xh\n",\r
     DEBUG (\r
       (EFI_D_WARN,\r
       "\nsnp->undi.stop()  %xh:%xh\n",\r
-      snp->cdb.StatCode,\r
-      snp->cdb.StatFlags)\r
+      Snp->Cdb.StatCode,\r
+      Snp->Cdb.StatFlags)\r
       );\r
 \r
     return EFI_DEVICE_ERROR;\r
       );\r
 \r
     return EFI_DEVICE_ERROR;\r
@@ -64,39 +62,48 @@ pxe_stop (
   //\r
   // Set simple network state to Started and return success.\r
   //\r
   //\r
   // Set simple network state to Started and return success.\r
   //\r
-  snp->mode.State = EfiSimpleNetworkStopped;\r
+  Snp->Mode.State = EfiSimpleNetworkStopped;\r
   return EFI_SUCCESS;\r
 }\r
 \r
 \r
 /**\r
   return EFI_SUCCESS;\r
 }\r
 \r
 \r
 /**\r
-  This is the SNP interface routine for stopping the interface.\r
-  This routine basically retrieves snp structure, checks the SNP state and\r
-  calls the pxe_stop routine to actually stop the undi interface\r
-\r
-  @param  this  context pointer\r
-\r
+  Changes the state of a network interface from "started" to "stopped."\r
+  \r
+  This function stops a network interface. This call is only valid if the network\r
+  interface is in the started state. If the network interface was successfully\r
+  stopped, then EFI_SUCCESS will be returned.\r
+  \r
+  @param  This                    A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+  \r
+  \r
+  @retval EFI_SUCCESS             The network interface was stopped.\r
+  @retval EFI_NOT_STARTED         The network interface has not been started.\r
+  @retval EFI_INVALID_PARAMETER   This parameter was NULL or did not point to a valid \r
+                                  EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
+  @retval EFI_DEVICE_ERROR        The command could not be sent to the network interface.\r
+  @retval EFI_UNSUPPORTED         This function is not supported by the network interface.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-snp_undi32_stop (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL *this\r
+SnpUndi32Stop (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
   )\r
 {\r
   )\r
 {\r
-  SNP_DRIVER  *snp;\r
+  SNP_DRIVER  *Snp;\r
   EFI_TPL     OldTpl;\r
   EFI_STATUS  Status;\r
 \r
   EFI_TPL     OldTpl;\r
   EFI_STATUS  Status;\r
 \r
-  if (this == NULL) {\r
+  if (This == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);\r
+  Snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This);\r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
-  switch (snp->mode.State) {\r
+  switch (Snp->Mode.State) {\r
   case EfiSimpleNetworkStarted:\r
     break;\r
 \r
   case EfiSimpleNetworkStarted:\r
     break;\r
 \r
@@ -109,7 +116,7 @@ snp_undi32_stop (
     goto ON_EXIT;\r
   }\r
 \r
     goto ON_EXIT;\r
   }\r
 \r
-  Status = pxe_stop (snp);\r
+  Status = PxeStop (Snp);\r
 \r
 ON_EXIT:\r
   gBS->RestoreTPL (OldTpl);\r
 \r
 ON_EXIT:\r
   gBS->RestoreTPL (OldTpl);\r