summaryrefslogtreecommitdiff
path: root/EdkModulePkg/Universal/Network
diff options
context:
space:
mode:
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2006-06-22 06:08:00 +0000
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2006-06-22 06:08:00 +0000
commit4ba61e5e2a1b3cec7faaad36c252738f6f57f8a6 (patch)
treeee885b41f6738849dbe28aa291c2e4df0d1fb98f /EdkModulePkg/Universal/Network
parentf7c3054530a4603d3d611e7433ed8768a6076909 (diff)
downloadedk2-4ba61e5e2a1b3cec7faaad36c252738f6f57f8a6.zip
edk2-4ba61e5e2a1b3cec7faaad36c252738f6f57f8a6.tar.gz
edk2-4ba61e5e2a1b3cec7faaad36c252738f6f57f8a6.tar.bz2
1. UINTN & INTN issue for EBC architecture:
The MAX_BIT of EBC will no longer be fixed to bit 63. It is defined as (1ULL << (sizeof (INTN) * 8 - 1)). Make EdkModulePkg & MdePkg EBC compiler clean: treat all EFI_STATUS error code as variable. 2. PrintLib Complete all missing ASSERT()s. Fix “\n” & “%\n” issue thanks to the clarification of MWG 0.56d. Adjust StatusString array to support EBC build. 3. BaseMemoryLib Adjust ASSERT () & function header of ComparaMem, SetMemXX, ScanMemXX to synchronize with MWG 0.56d. 4.SmbusLib Change Pec bit to bit 22 SmBusAddress to synchronize MWG 0.56d. Add ASSERT()s to check if length is illegal for SmBusBlockWrite() & SmBusProcessBlock() since it is 6 bit now. 5. PerformanceLib Rename “EdkDxePerformanceLib” & “EdkPeiPerformanceLib” to “DxePerformanceLib” & “PeiPerformanceLib” respectively. Synchronize the function header of GetPerformanceMeasurement() with MWG 0.56d. 6. BasePeCoffLoaderLib. Make PeCoffLoaderLoadImage () Assert() if ImageContext is NULL> Make PeCoffLoaderLoadImage () return RETURN_INVALID_PARAMETER if the ImageAddress in ImageContext is 0. Adjust some coding style. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@593 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkModulePkg/Universal/Network')
-rw-r--r--EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_udp.c7
-rw-r--r--EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_loadfile.c137
-rw-r--r--EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4Run.c11
3 files changed, 58 insertions, 97 deletions
diff --git a/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_udp.c b/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_udp.c
index 7d78295..32768c0 100644
--- a/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_udp.c
+++ b/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_udp.c
@@ -463,12 +463,7 @@ Returns:
}
}
- switch (StatCode) {
- case EFI_SUCCESS:
- case EFI_TIMEOUT:
- break;
-
- default:
+ if ((StatCode != EFI_SUCCESS) && (StatCode != EFI_TIMEOUT)) {
DEBUG (
(EFI_D_INFO,
"\nUdpRead() Exit #3 %Xh %r",
diff --git a/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_loadfile.c b/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_loadfile.c
index 315c95a..182462c 100644
--- a/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_loadfile.c
+++ b/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_loadfile.c
@@ -1456,15 +1456,12 @@ Returns:
(VOID *) &LoadfilePtr->Private->CallbackProtocolPtr
);
- switch (Status) {
- case EFI_SUCCESS:
+ if (Status == EFI_SUCCESS) {
//
// There is already a callback routine. Do nothing.
//
DEBUG ((EFI_D_WARN, "\nLoadFile() BC callback exists."));
- break;
-
- case EFI_UNSUPPORTED:
+ } else if (Status == EFI_UNSUPPORTED) {
//
// No BaseCode Callback protocol found. Add our own.
//
@@ -1490,10 +1487,7 @@ Returns:
&NewMakeCallback
);
}
-
- break;
-
- default:
+ } else {
DEBUG ((EFI_D_WARN, "\nLoadFile() Callback check status == %xh", Status));
}
//
@@ -1578,11 +1572,11 @@ Returns:
DEBUG ((EFI_D_WARN, "\nBC.Loadfile() Status == %xh\n", Status));
- switch (Status) {
- case EFI_SUCCESS: /* 0 */
+ if (Status == EFI_SUCCESS) {
+ /* 0 */
return EFI_SUCCESS;
-
- case EFI_BUFFER_TOO_SMALL: /* 5 */
+ } else if (Status == EFI_BUFFER_TOO_SMALL) {
+ /* 5 */
//
// Error is only displayed when we are actually trying to
// download the boot image.
@@ -1590,104 +1584,81 @@ Returns:
if (Buffer == NULL) {
return EFI_BUFFER_TOO_SMALL;
}
-
AsciiPrint ("\nPXE-E05: Download buffer is smaller than requested file.\n");
- break;
-
- case EFI_DEVICE_ERROR: /* 7 */
+ } else if (Status == EFI_DEVICE_ERROR) {
+ /* 7 */
AsciiPrint ("\nPXE-E07: Network device error. Check network connection.\n");
- break;
-
- case EFI_OUT_OF_RESOURCES: /* 9 */
+ } else if (Status == EFI_OUT_OF_RESOURCES) {
+ /* 9 */
AsciiPrint ("\nPXE-E09: Could not allocate I/O buffers.\n");
- break;
-
- case EFI_NO_MEDIA: /* 12 */
+ } else if (Status == EFI_NO_MEDIA) {
+ /* 12 */
AsciiPrint ("\nPXE-E12: Could not detect network connection. Check cable.\n");
- break;
-
- case EFI_NO_RESPONSE: /* 16 */
+ } else if (Status == EFI_NO_RESPONSE) {
+ /* 16 */
AsciiPrint ("\nPXE-E16: Valid PXE offer not received.\n");
- break;
-
- case EFI_TIMEOUT: /* 18 */
+ } else if (Status == EFI_TIMEOUT) {
+ /* 18 */
AsciiPrint ("\nPXE-E18: Timeout. Server did not respond.\n");
- break;
-
- case EFI_ABORTED: /* 21 */
+ } else if (Status == EFI_ABORTED) {
+ /* 21 */
AsciiPrint ("\nPXE-E21: Remote boot cancelled.\n");
- break;
-
- case EFI_ICMP_ERROR: /* 22 */
+ } else if (Status == EFI_ICMP_ERROR) {
+ /* 22 */
AsciiPrint ("\nPXE-E22: Client received ICMP error from server.\n");
- if (LoadfilePtr->Private->EfiBc.Mode == NULL) {
- break;
- }
-
- if (!LoadfilePtr->Private->EfiBc.Mode->IcmpErrorReceived) {
- break;
- }
+ if ((LoadfilePtr->Private->EfiBc.Mode != NULL) && LoadfilePtr->Private->EfiBc.Mode->IcmpErrorReceived) {
+ AsciiPrint (
+ "PXE-E98: Type: %xh Code: %xh ",
+ LoadfilePtr->Private->EfiBc.Mode->IcmpError.Type,
+ LoadfilePtr->Private->EfiBc.Mode->IcmpError.Code
+ );
- AsciiPrint (
- "PXE-E98: Type: %xh Code: %xh ",
- LoadfilePtr->Private->EfiBc.Mode->IcmpError.Type,
- LoadfilePtr->Private->EfiBc.Mode->IcmpError.Code
- );
+ switch (LoadfilePtr->Private->EfiBc.Mode->IcmpError.Type) {
+ case 0x03:
+ switch (LoadfilePtr->Private->EfiBc.Mode->IcmpError.Code) {
+ case 0x00: /* net unreachable */
+ AsciiPrint ("Net unreachable");
+ break;
- switch (LoadfilePtr->Private->EfiBc.Mode->IcmpError.Type) {
- case 0x03:
- switch (LoadfilePtr->Private->EfiBc.Mode->IcmpError.Code) {
- case 0x00: /* net unreachable */
- AsciiPrint ("Net unreachable");
- break;
+ case 0x01: /* host unreachable */
+ AsciiPrint ("Host unreachable");
+ break;
- case 0x01: /* host unreachable */
- AsciiPrint ("Host unreachable");
- break;
+ case 0x02: /* protocol unreachable */
+ AsciiPrint ("Protocol unreachable");
+ break;
- case 0x02: /* protocol unreachable */
- AsciiPrint ("Protocol unreachable");
- break;
+ case 0x03: /* port unreachable */
+ AsciiPrint ("Port unreachable");
+ break;
- case 0x03: /* port unreachable */
- AsciiPrint ("Port unreachable");
- break;
+ case 0x04: /* Fragmentation needed */
+ AsciiPrint ("Fragmentation needed");
+ break;
- case 0x04: /* Fragmentation needed */
- AsciiPrint ("Fragmentation needed");
- break;
+ case 0x05: /* Source route failed */
+ AsciiPrint ("Source route failed");
+ break;
+ }
- case 0x05: /* Source route failed */
- AsciiPrint ("Source route failed");
break;
}
- break;
+ AsciiPrint ("\n");
}
-
- AsciiPrint ("\n");
-
- break;
-
- case EFI_TFTP_ERROR: /* 23 */
+ } else if (Status == EFI_TFTP_ERROR) {
+ /* 23 */
AsciiPrint ("\nPXE-E23: Client received TFTP error from server.\n");
- if (LoadfilePtr->Private->EfiBc.Mode == NULL) {
- break;
- }
-
- if (LoadfilePtr->Private->EfiBc.Mode->TftpErrorReceived) {
+ if ((LoadfilePtr->Private->EfiBc.Mode != NULL) && (LoadfilePtr->Private->EfiBc.Mode->TftpErrorReceived)) {
AsciiPrint (
"PXE-E98: Code: %xh %a\n",
LoadfilePtr->Private->EfiBc.Mode->TftpError.ErrorCode,
LoadfilePtr->Private->EfiBc.Mode->TftpError.ErrorString
);
}
-
- break;
-
- default:
+ } else {
AsciiPrint ("\nPXE-E99: Unexpected network error: %xh\n", Status);
}
diff --git a/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4Run.c b/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4Run.c
index 50f97a8..8e015b2 100644
--- a/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4Run.c
+++ b/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4Run.c
@@ -126,14 +126,9 @@ PxeDhcp4Run (
//
efi_status = PxeDhcp4Init (This, timeout, &offers, &offer_list);
- switch (efi_status) {
- case EFI_NO_RESPONSE:
- case EFI_TIMEOUT:
- case EFI_SUCCESS:
- break;
-
- case EFI_ABORTED:
- default:
+ if ((efi_status != EFI_NO_RESPONSE) &&
+ (efi_status != EFI_TIMEOUT) &&
+ (efi_status != EFI_SUCCESS)) {
return efi_status;
}
//