]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_loadfile.c
1. UINTN & INTN issue for EBC architecture:
[mirror_edk2.git] / EdkModulePkg / Universal / Network / PxeBc / Dxe / pxe_loadfile.c
index 315c95a9f588269c640dd1aa358317a8cecb65ae..182462c02f1c5a33fdf7714f49708b59cd0d784d 100644 (file)
@@ -1456,15 +1456,12 @@ Returns:
                   (VOID *) &LoadfilePtr->Private->CallbackProtocolPtr\r
                   );\r
 \r
-  switch (Status) {\r
-  case EFI_SUCCESS:\r
+  if (Status == EFI_SUCCESS) {\r
     //\r
     // There is already a callback routine.  Do nothing.\r
     //\r
     DEBUG ((EFI_D_WARN, "\nLoadFile()  BC callback exists."));\r
-    break;\r
-\r
-  case EFI_UNSUPPORTED:\r
+  } else if (Status == EFI_UNSUPPORTED) {\r
     //\r
     // No BaseCode Callback protocol found.  Add our own.\r
     //\r
@@ -1490,10 +1487,7 @@ Returns:
                                     &NewMakeCallback\r
                                     );\r
     }\r
-\r
-    break;\r
-\r
-  default:\r
+  } else {\r
     DEBUG ((EFI_D_WARN, "\nLoadFile()  Callback check status == %xh", Status));\r
   }\r
   //\r
@@ -1578,11 +1572,11 @@ Returns:
 \r
   DEBUG ((EFI_D_WARN, "\nBC.Loadfile()  Status == %xh\n", Status));\r
 \r
-  switch (Status) {\r
-  case EFI_SUCCESS:           /* 0 */\r
+  if (Status == EFI_SUCCESS) {\r
+    /* 0 */\r
     return EFI_SUCCESS;\r
-\r
-  case EFI_BUFFER_TOO_SMALL:  /* 5 */\r
+  } else if (Status == EFI_BUFFER_TOO_SMALL) {\r
+    /* 5 */\r
     //\r
     // Error is only displayed when we are actually trying to\r
     // download the boot image.\r
@@ -1590,104 +1584,81 @@ Returns:
     if (Buffer == NULL) {\r
       return EFI_BUFFER_TOO_SMALL;\r
     }\r
-\r
     AsciiPrint ("\nPXE-E05: Download buffer is smaller than requested file.\n");\r
-    break;\r
-\r
-  case EFI_DEVICE_ERROR:      /* 7 */\r
+  } else if (Status == EFI_DEVICE_ERROR) {\r
+    /* 7 */\r
     AsciiPrint ("\nPXE-E07: Network device error.  Check network connection.\n");\r
-    break;\r
-\r
-  case EFI_OUT_OF_RESOURCES:  /* 9 */\r
+  } else if (Status == EFI_OUT_OF_RESOURCES) {\r
+    /* 9 */\r
     AsciiPrint ("\nPXE-E09: Could not allocate I/O buffers.\n");\r
-    break;\r
-\r
-  case EFI_NO_MEDIA:          /* 12 */\r
+  } else if (Status == EFI_NO_MEDIA) {\r
+    /* 12 */\r
     AsciiPrint ("\nPXE-E12: Could not detect network connection.  Check cable.\n");\r
-    break;\r
-\r
-  case EFI_NO_RESPONSE:       /* 16 */\r
+  } else if (Status == EFI_NO_RESPONSE) {\r
+    /* 16 */\r
     AsciiPrint ("\nPXE-E16: Valid PXE offer not received.\n");\r
-    break;\r
-\r
-  case EFI_TIMEOUT:           /* 18 */\r
+  } else if (Status == EFI_TIMEOUT) {\r
+    /* 18 */\r
     AsciiPrint ("\nPXE-E18: Timeout.  Server did not respond.\n");\r
-    break;\r
-\r
-  case EFI_ABORTED:           /* 21 */\r
+  } else if (Status == EFI_ABORTED) {\r
+    /* 21 */\r
     AsciiPrint ("\nPXE-E21: Remote boot cancelled.\n");\r
-    break;\r
-\r
-  case EFI_ICMP_ERROR:        /* 22 */\r
+  } else if (Status == EFI_ICMP_ERROR) {\r
+    /* 22 */\r
     AsciiPrint ("\nPXE-E22: Client received ICMP error from server.\n");\r
 \r
-    if (LoadfilePtr->Private->EfiBc.Mode == NULL) {\r
-      break;\r
-    }\r
-\r
-    if (!LoadfilePtr->Private->EfiBc.Mode->IcmpErrorReceived) {\r
-      break;\r
-    }\r
+    if ((LoadfilePtr->Private->EfiBc.Mode != NULL) && LoadfilePtr->Private->EfiBc.Mode->IcmpErrorReceived) {\r
+      AsciiPrint (\r
+        "PXE-E98: Type: %xh  Code: %xh  ",\r
+        LoadfilePtr->Private->EfiBc.Mode->IcmpError.Type,\r
+        LoadfilePtr->Private->EfiBc.Mode->IcmpError.Code\r
+        );\r
 \r
-    AsciiPrint (\r
-      "PXE-E98: Type: %xh  Code: %xh  ",\r
-      LoadfilePtr->Private->EfiBc.Mode->IcmpError.Type,\r
-      LoadfilePtr->Private->EfiBc.Mode->IcmpError.Code\r
-      );\r
+      switch (LoadfilePtr->Private->EfiBc.Mode->IcmpError.Type) {\r
+      case 0x03:\r
+        switch (LoadfilePtr->Private->EfiBc.Mode->IcmpError.Code) {\r
+        case 0x00:              /* net unreachable */\r
+          AsciiPrint ("Net unreachable");\r
+          break;\r
 \r
-    switch (LoadfilePtr->Private->EfiBc.Mode->IcmpError.Type) {\r
-    case 0x03:\r
-      switch (LoadfilePtr->Private->EfiBc.Mode->IcmpError.Code) {\r
-      case 0x00:              /* net unreachable */\r
-        AsciiPrint ("Net unreachable");\r
-        break;\r
+        case 0x01:              /* host unreachable */\r
+          AsciiPrint ("Host unreachable");\r
+          break;\r
 \r
-      case 0x01:              /* host unreachable */\r
-        AsciiPrint ("Host unreachable");\r
-        break;\r
+        case 0x02:              /* protocol unreachable */\r
+          AsciiPrint ("Protocol unreachable");\r
+          break;\r
 \r
-      case 0x02:              /* protocol unreachable */\r
-        AsciiPrint ("Protocol unreachable");\r
-        break;\r
+        case 0x03:              /* port unreachable */\r
+          AsciiPrint ("Port unreachable");\r
+          break;\r
 \r
-      case 0x03:              /* port unreachable */\r
-        AsciiPrint ("Port unreachable");\r
-        break;\r
+        case 0x04:              /* Fragmentation needed */\r
+          AsciiPrint ("Fragmentation needed");\r
+          break;\r
 \r
-      case 0x04:              /* Fragmentation needed */\r
-        AsciiPrint ("Fragmentation needed");\r
-        break;\r
+        case 0x05:              /* Source route failed */\r
+          AsciiPrint ("Source route failed");\r
+          break;\r
+        }\r
 \r
-      case 0x05:              /* Source route failed */\r
-        AsciiPrint ("Source route failed");\r
         break;\r
       }\r
 \r
-      break;\r
+      AsciiPrint ("\n");\r
     }\r
-\r
-    AsciiPrint ("\n");\r
-\r
-    break;\r
-\r
-  case EFI_TFTP_ERROR:        /* 23 */\r
+  } else if (Status == EFI_TFTP_ERROR) {\r
+    /* 23 */\r
     AsciiPrint ("\nPXE-E23: Client received TFTP error from server.\n");\r
 \r
-    if (LoadfilePtr->Private->EfiBc.Mode == NULL) {\r
-      break;\r
-    }\r
-\r
-    if (LoadfilePtr->Private->EfiBc.Mode->TftpErrorReceived) {\r
+    if ((LoadfilePtr->Private->EfiBc.Mode != NULL) && (LoadfilePtr->Private->EfiBc.Mode->TftpErrorReceived)) {\r
       AsciiPrint (\r
         "PXE-E98: Code: %xh  %a\n",\r
         LoadfilePtr->Private->EfiBc.Mode->TftpError.ErrorCode,\r
         LoadfilePtr->Private->EfiBc.Mode->TftpError.ErrorString\r
         );\r
     }\r
-\r
-    break;\r
-\r
-  default:\r
+  } else {\r
     AsciiPrint ("\nPXE-E99: Unexpected network error: %xh\n", Status);\r
   }\r
 \r