]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Universal/Network/Snp32_64/Dxe/snp.c
1. Removed #ifdef SNP_DEBUG and used debug lib to output information
[mirror_edk2.git] / EdkModulePkg / Universal / Network / Snp32_64 / Dxe / snp.c
index 7146e462c7ae6c0ecfbe2b88ded5bbb1d2a0c2a5..4b6cda9b1e5c43ba896521f84f4a75f9a33f11a2 100644 (file)
@@ -1,12 +1,12 @@
 /*++\r
-Copyright (c) 2006, 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
-                                                                                          \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
+Copyright (c) 2006, 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
+\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
     snp.c\r
@@ -41,10 +41,8 @@ Returns:
 \r
 --*/\r
 {\r
-#if SNP_DEBUG\r
-  Aprint ("\nissue_hwundi_command() - This should not be called!");\r
-  snp_wait_for_key ();\r
-#endif\r
+  DEBUG ((EFI_D_ERROR, "\nissue_hwundi_command() - This should not be called!"));\r
+\r
   if (cdb == 0) {\r
     return EFI_INVALID_PARAMETER;\r
 \r
@@ -65,7 +63,7 @@ calc_8bit_cksum (
 \r
 Routine Description:\r
  Compute 8-bit checksum of a buffer.\r
\r
+\r
 Arguments:\r
  ptr - Pointer to buffer.\r
  len - Length of buffer in bytes.\r
@@ -147,19 +145,13 @@ SimpleNetworkDriverSupported (
                   );\r
   if (Status == EFI_ALREADY_STARTED)\r
   {\r
-#if SNP_DEBUG\r
-    Aprint ("Support(): Already Started. on handle %x\n", Controller);\r
-#endif\r
+    DEBUG ((EFI_D_INFO, "Support(): Already Started. on handle %x\n", Controller));\r
     return EFI_ALREADY_STARTED;\r
   }\r
 \r
   if (!EFI_ERROR (Status))\r
   {\r
-\r
-#if SNP_DEBUG\r
-    Aprint ("Support(): UNDI3.1 found on handle %x\n", Controller);\r
-    snp_wait_for_key ();\r
-#endif\r
+    DEBUG ((EFI_D_INFO, "Support(): UNDI3.1 found on handle %x\n", Controller));\r
     IsUndi31 = TRUE;\r
   } else {\r
     //\r
@@ -177,10 +169,7 @@ SimpleNetworkDriverSupported (
       return Status;\r
     }\r
 \r
-#if SNP_DEBUG\r
-    Aprint ("Support(): UNDI3.0 found on handle %x\n", Controller);\r
-    snp_wait_for_key ();\r
-#endif\r
+    DEBUG ((EFI_D_INFO, "Support(): UNDI3.0 found on handle %x\n", Controller));\r
   }\r
   //\r
   // check the version, we don't want to connect to the undi16\r
@@ -244,10 +233,7 @@ SimpleNetworkDriverSupported (
   }\r
 \r
   Status = EFI_SUCCESS;\r
-#if SNP_DEBUG\r
-  Aprint ("Support(): supported on %x\n", Controller);\r
-  snp_wait_for_key ();\r
-#endif\r
+  DEBUG ((EFI_D_INFO, "Support(): supported on %x\n", Controller));\r
 \r
 Done:\r
   if (IsUndi31) {\r
@@ -374,10 +360,8 @@ Arguments:
     // probably not a 3.1 UNDI\r
     //\r
     UndiNew = TRUE;\r
-#if SNP_DEBUG\r
-    Aprint ("Start(): UNDI3.1 found\n");\r
-    snp_wait_for_key ();\r
-#endif\r
+    DEBUG ((EFI_D_INFO, "Start(): UNDI3.1 found\n"));\r
+\r
   } else {\r
     UndiNew = FALSE;\r
     Status = gBS->OpenProtocol (\r
@@ -399,10 +383,7 @@ Arguments:
       return Status;\r
     }\r
 \r
-#if SNP_DEBUG\r
-    Aprint ("Start(): UNDI3.0 found\n");\r
-    snp_wait_for_key ();\r
-#endif\r
+    DEBUG ((EFI_D_INFO, "Start(): UNDI3.0 found\n"));\r
   }\r
 \r
   pxe = (PXE_UNDI *) (UINTN) (Nii->ID);\r
@@ -996,7 +977,7 @@ Returns:
                     Controller\r
                     );\r
   }\r
-  \r
+\r
   Status = gBS->CloseProtocol (\r
                   Controller,\r
                   &gEfiDevicePathProtocolGuid,\r
@@ -1077,7 +1058,7 @@ add_v2p (
 \r
 Routine Description:\r
  This routine maps the given CPU address to a Device address. It creates a\r
- an entry in the map list with the virtual and physical addresses and the \r
+ an entry in the map list with the virtual and physical addresses and the\r
  un map cookie.\r
 \r
 Arguments:\r
@@ -1138,7 +1119,7 @@ find_v2p (
 /*++\r
 \r
 Routine Description:\r
- This routine searches the linked list of mapped address nodes (for undi3.0 \r
+ This routine searches the linked list of mapped address nodes (for undi3.0\r
  interface) to find the node that corresponds to the given virtual address and\r
  returns a pointer to that node.\r
 \r
@@ -1176,9 +1157,9 @@ del_v2p (
 /*++\r
 \r
 Routine Description:\r
- This routine unmaps the given virtual address and frees the memory allocated \r
+ This routine unmaps the given virtual address and frees the memory allocated\r
  for the map list node corresponding to that address.\r
\r
+\r
 Arguments:\r
  vaddr - virtual address (or CPU address) to be unmapped\r
 \r
@@ -1210,11 +1191,9 @@ Returns:
 \r
     gBS->FreePool (v);\r
 \r
-#if SNP_DEBUG\r
     if (Status) {\r
-      Print (L"Unmap failed with status = %x\n", Status);\r
+      DEBUG ((EFI_D_ERROR, "Unmap failed with status = %x\n", Status));\r
     }\r
-#endif\r
     return Status;\r
   }\r
 \r
@@ -1223,42 +1202,13 @@ Returns:
       v->next = t->next;\r
       Status  = mPciIoFncs->Unmap (mPciIoFncs, t->unmap);\r
       gBS->FreePool (t);\r
-#if SNP_DEBUG\r
+\r
       if (Status) {\r
-        Print (L"Unmap failed with status = %x\n", Status);\r
+        DEBUG ((EFI_D_ERROR, "Unmap failed with status = %x\n", Status));\r
       }\r
-#endif\r
       return Status;\r
     }\r
   }\r
 \r
   return EFI_NOT_FOUND;\r
 }\r
-\r
-#if SNP_DEBUG\r
-VOID\r
-snp_wait_for_key (\r
-  VOID\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
- Wait for a key stroke, used for debugging purposes\r
-\r
-Arguments:\r
- none\r
-\r
-Returns:\r
- none\r
-\r
---*/\r
-{\r
-  EFI_INPUT_KEY key;\r
-\r
-  Aprint ("\nPress any key to continue\n");\r
-\r
-  while (gST->ConIn->ReadKeyStroke (gST->ConIn, &key) == EFI_NOT_READY) {\r
-    ;\r
-  }\r
-}\r
-#endif\r