From 5225084439bd47f2cdd210a98d6a445a2eccc9e2 Mon Sep 17 00:00:00 2001 From: Jiaxin Wu Date: Mon, 22 May 2017 09:25:57 +0800 Subject: [PATCH] MdeModulePkg/UefiPxeBcDxe: Refine the PXE boot displayed information This path is to refine the PXE boot displayed information so as to in line with NetworkPkg/UefiPxeBcDxe driver. Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin Reviewed-by: Ye Ting Reviewed-by: Fu Siyuan --- .../Network/UefiPxeBcDxe/PxeBcImpl.c | 18 +++++++++++++++ .../Network/UefiPxeBcDxe/PxeBcSupport.c | 22 ++++++++++++++++++- .../Network/UefiPxeBcDxe/PxeBcSupport.h | 16 +++++++++++++- 3 files changed, 54 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c index 259568edae..6d4f33f0db 100644 --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c @@ -338,6 +338,8 @@ EfiPxeBcStart ( return EFI_UNSUPPORTED; } + AsciiPrint ("\n>>Start PXE over IPv4"); + // // Configure the udp4 instance to let it receive data // @@ -667,6 +669,11 @@ EfiPxeBcDhcp ( // Status = PxeBcCheckSelectedOffer (Private); + AsciiPrint ("\n Station IP address is "); + + PxeBcShowIp4Addr (&Private->StationIp.v4); + AsciiPrint ("\n"); + ON_EXIT: if (EFI_ERROR (Status)) { Dhcp4->Stop (Dhcp4); @@ -2740,6 +2747,14 @@ DiscoverBootFile ( Private->FileSize = (UINTN) *BufferSize; + // + // Display all the information: boot server address, boot file name and boot file size. + // + AsciiPrint ("\n Server IP address is "); + PxeBcShowIp4Addr (&Private->ServerIp.v4); + AsciiPrint ("\n NBP filename is %a", Private->BootFileName); + AsciiPrint ("\n NBP filesize is %d Bytes", Private->FileSize); + return Status; } @@ -2855,6 +2870,7 @@ EfiPxeLoadFile ( if (sizeof (UINTN) < sizeof (UINT64) && (TmpBufSize > 0xFFFFFFFF)) { Status = EFI_DEVICE_ERROR; } else if (TmpBufSize > 0 && *BufferSize >= (UINTN) TmpBufSize && Buffer != NULL) { + AsciiPrint ("\n Downloading NBP file...\n"); *BufferSize = (UINTN) TmpBufSize; Status = PxeBc->Mtftp ( PxeBc, @@ -2879,6 +2895,7 @@ EfiPxeLoadFile ( // // Download the file. // + AsciiPrint ("\n Downloading NBP file...\n"); TmpBufSize = (UINT64) (*BufferSize); Status = PxeBc->Mtftp ( PxeBc, @@ -2913,6 +2930,7 @@ EfiPxeLoadFile ( // Check download status // if (Status == EFI_SUCCESS) { + AsciiPrint ("\n NBP file downloaded successfully.\n"); // // The DHCP4 can have only one configured child instance so we need to stop // reset the DHCP4 child before we return. Otherwise the other programs which diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c index 077905671e..c1cabca8b9 100644 --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c @@ -1,7 +1,7 @@ /** @file Support routines for PxeBc. -Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -114,6 +114,26 @@ PxeBcConfigureUdpWriteInstance ( return Status; } +/** + This function is to display the IPv4 address. + + @param[in] Ip The pointer to the IPv4 address. + +**/ +VOID +PxeBcShowIp4Addr ( + IN EFI_IPv4_ADDRESS *Ip + ) +{ + UINTN Index; + + for (Index = 0; Index < 4; Index++) { + AsciiPrint ("%d", Ip->Addr[Index]); + if (Index < 3) { + AsciiPrint ("."); + } + } +} /** Convert number to ASCII value. diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.h b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.h index 16ac05ec82..59e9b3276e 100644 --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.h +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.h @@ -1,6 +1,6 @@ /** @file Support routines for PxeBc. -Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -67,6 +67,20 @@ PxeBcConfigureUdpWriteInstance ( IN UINT8 Ttl, IN UINT8 ToS ); + + +/** + This function is to display the IPv4 address. + + @param[in] Ip The pointer to the IPv4 address. + +**/ +VOID +PxeBcShowIp4Addr ( + IN EFI_IPv4_ADDRESS *Ip + ); + + /** Convert number to ASCII value. -- 2.39.2