]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/SnpDxe/Start.c
sync comments, fix function header, rename variable name to follow coding style.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / SnpDxe / Start.c
index eaba03c57dbe657cf8c914ab6d7f2d6990843b6d..5c5daeaa6039bffdfa0b42a4fb5550aa95a3b5f0 100644 (file)
@@ -1,94 +1,90 @@
 /** @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 starting a network adapter.\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
-Module name:\r
-  start.c\r
-\r
-Abstract:\r
-\r
-Revision history:\r
-  2000-Feb-07 M(f)J   Genesis.\r
-\r
 **/\r
 \r
 #include "Snp.h"\r
 \r
 \r
 /**\r
-  this routine calls undi to start the interface and changes the snp state!\r
-\r
-  @param  snp                    pointer to snp driver structure\r
+  this routine calls undi to start the interface and changes the snp state.\r
 \r
+  @param  Snp                    pointer to snp driver structure\r
 \r
+  @retval EFI_DEVICE_ERROR       UNDI could not be started\r
+  @retval EFI_SUCCESS            UNDI is started successfully\r
+  \r
 **/\r
 EFI_STATUS\r
-pxe_start (\r
-  SNP_DRIVER *snp\r
+PxeStart (\r
+  IN SNP_DRIVER *Snp\r
   )\r
 {\r
-  PXE_CPB_START_31  *cpb_31;\r
+  PXE_CPB_START_31  *Cpb31;\r
 \r
-  cpb_31  = snp->cpb;\r
+  Cpb31  = Snp->Cpb;\r
   //\r
   // Initialize UNDI Start CDB for H/W UNDI\r
   //\r
-  snp->cdb.OpCode     = PXE_OPCODE_START;\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_START;\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
   // Make changes to H/W UNDI Start CDB if this is\r
   // a S/W UNDI.\r
   //\r
-  if (snp->is_swundi) {\r
-    snp->cdb.CPBsize  = sizeof (PXE_CPB_START_31);\r
-    snp->cdb.CPBaddr  = (UINT64)(UINTN) cpb_31;\r
+  if (Snp->IsSwUndi) {\r
+    Snp->Cdb.CPBsize  = sizeof (PXE_CPB_START_31);\r
+    Snp->Cdb.CPBaddr  = (UINT64)(UINTN) Cpb31;\r
 \r
-    cpb_31->Delay     = (UINT64)(UINTN) &snp_undi32_callback_delay;\r
-    cpb_31->Block     = (UINT64)(UINTN) &snp_undi32_callback_block;\r
+    Cpb31->Delay     = (UINT64)(UINTN) &SnpUndi32CallbackDelay;\r
+    Cpb31->Block     = (UINT64)(UINTN) &SnpUndi32CallbackBlock;\r
 \r
     //\r
     // Virtual == Physical.  This can be set to zero.\r
     //\r
-    cpb_31->Virt2Phys = (UINT64)(UINTN) 0;\r
-    cpb_31->Mem_IO    = (UINT64)(UINTN) &snp_undi32_callback_memio;\r
+    Cpb31->Virt2Phys = (UINT64)(UINTN) 0;\r
+    Cpb31->Mem_IO    = (UINT64)(UINTN) &SnpUndi32CallbackMemio;\r
 \r
-    cpb_31->Map_Mem   = (UINT64)(UINTN) &snp_undi32_callback_map;\r
-    cpb_31->UnMap_Mem = (UINT64)(UINTN) &snp_undi32_callback_unmap;\r
-    cpb_31->Sync_Mem  = (UINT64)(UINTN) &snp_undi32_callback_sync;\r
+    Cpb31->Map_Mem   = (UINT64)(UINTN) &SnpUndi32CallbackMap;\r
+    Cpb31->UnMap_Mem = (UINT64)(UINTN) &SnpUndi32CallbackUnmap;\r
+    Cpb31->Sync_Mem  = (UINT64)(UINTN) &SnpUndi32CallbackSync;\r
 \r
-    cpb_31->Unique_ID = (UINT64)(UINTN) snp;\r
+    Cpb31->Unique_ID = (UINT64)(UINTN) Snp;\r
   }\r
   //\r
   // Issue UNDI command and check result.\r
   //\r
   DEBUG ((EFI_D_NET, "\nsnp->undi.start()  "));\r
 \r
-  (*snp->issue_undi32_command) ((UINT64)(UINTN) &snp->cdb);\r
+  (*Snp->IssueUndi32Command) ((UINT64)(UINTN) &Snp->Cdb);\r
 \r
-  if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) {\r
+  if (Snp->Cdb.StatCode != PXE_STATCODE_SUCCESS) {\r
     //\r
     // UNDI could not be started. Return UNDI error.\r
     //\r
     DEBUG (\r
       (EFI_D_ERROR,\r
       "\nsnp->undi.start()  %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
@@ -96,34 +92,31 @@ pxe_start (
   //\r
   // Set simple network state to Started and return success.\r
   //\r
-  snp->mode.State = EfiSimpleNetworkStarted;\r
+  Snp->Mode.State = EfiSimpleNetworkStarted;\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
 \r
 /**\r
-  This is the SNP interface routine for starting the interface\r
-  This routine basically retrieves snp structure, checks the SNP state and\r
-  calls the pxe_start routine to actually do start undi interface\r
-\r
-  @param  This                   context pointer\r
-\r
-  @retval EFI_INVALID_PARAMETER  "This" is Null\r
-  @retval      No                SNP driver can be extracted from "This"\r
-  @retval EFI_ALREADY_STARTED    The state of SNP is EfiSimpleNetworkStarted or\r
-                                 EfiSimpleNetworkInitialized\r
-  @retval EFI_DEVICE_ERROR       The state of SNP is other than\r
-                                 EfiSimpleNetworkStarted,\r
-                                 EfiSimpleNetworkInitialized, and\r
-                                 EfiSimpleNetworkStopped\r
-  @retval EFI_SUCCESS            UNDI interface is succesfully started\r
-  @retval Other                  Error occurs while calling pxe_start function.\r
+  Changes the state of a network interface from "stopped" to "started."\r
+  \r
+  This function starts a network interface. If the network interface successfully\r
+  starts, then EFI_SUCCESS will be returned.\r
+\r
+  @param  This                   A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+\r
+  @retval EFI_SUCCESS            The network interface was started.\r
+  @retval EFI_ALREADY_STARTED    The network interface is already in the started state.\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
-snp_undi32_start (\r
+SnpUndi32Start (\r
   IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
   )\r
 {\r
@@ -140,7 +133,7 @@ snp_undi32_start (
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
-  switch (Snp->mode.State) {\r
+  switch (Snp->Mode.State) {\r
   case EfiSimpleNetworkStopped:\r
     break;\r
 \r
@@ -154,7 +147,7 @@ snp_undi32_start (
     goto ON_EXIT;\r
   }\r
 \r
-  Status = pxe_start (Snp);\r
+  Status = PxeStart (Snp);\r
   if (EFI_ERROR (Status)) {\r
     goto ON_EXIT;\r
   }\r
@@ -162,11 +155,11 @@ snp_undi32_start (
   // clear the map_list in SNP structure\r
   //\r
   for (Index = 0; Index < MAX_MAP_LENGTH; Index++) {\r
-    Snp->map_list[Index].virt       = 0;\r
-    Snp->map_list[Index].map_cookie = 0;\r
+    Snp->MapList[Index].VirtualAddress = 0;\r
+    Snp->MapList[Index].MapCookie      = 0;\r
   }\r
 \r
-  Snp->mode.MCastFilterCount = 0;\r
+  Snp->Mode.MCastFilterCount = 0;\r
 \r
 ON_EXIT:\r
   gBS->RestoreTPL (OldTpl);\r