diff options
-rw-r--r-- | ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc | 7 | ||||
-rw-r--r-- | ArmPlatformPkg/ArmPlatformPkg.dsc | 7 | ||||
-rw-r--r-- | ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc | 9 | ||||
-rw-r--r-- | ArmPlatformPkg/Bds/Bds.inf | 1 | ||||
-rw-r--r-- | ArmPlatformPkg/Bds/BdsHelper.c | 91 | ||||
-rw-r--r-- | ArmPlatformPkg/Bds/BdsInternal.h | 6 | ||||
-rw-r--r-- | BeagleBoardPkg/BeagleBoardPkg.dsc | 1 |
7 files changed, 92 insertions, 30 deletions
diff --git a/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc b/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc index 264099c7b4..22d98882dc 100644 --- a/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc +++ b/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc @@ -86,12 +86,15 @@ EfiResetSystemLib|EmbeddedPkg/Library/TemplateResetSystemLib/TemplateResetSystemLib.inf
RealTimeClockLib|EmbeddedPkg/Library/TemplateRealTimeClockLib/TemplateRealTimeClockLib.inf
- # EBL Related Libraries
+ # Networking Requirements for ArmPlatformPkg/Bds
+ NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
+
+ # EBL Related Libraries
EblCmdLib|ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf
EfiFileLib|EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf
EblAddExternalCommandLib|EmbeddedPkg/Library/EblAddExternalCommandLib/EblAddExternalCommandLib.inf
EblNetworkLib|EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.inf
-
+
#
# Uncomment (and comment out the next line) For RealView Debugger. The Standard IO window
# in the debugger will show load and unload commands for symbols. You can cut and paste this
diff --git a/ArmPlatformPkg/ArmPlatformPkg.dsc b/ArmPlatformPkg/ArmPlatformPkg.dsc index ce31abcdcc..a12040b6b2 100644 --- a/ArmPlatformPkg/ArmPlatformPkg.dsc +++ b/ArmPlatformPkg/ArmPlatformPkg.dsc @@ -85,12 +85,15 @@ EfiResetSystemLib|EmbeddedPkg/Library/TemplateResetSystemLib/TemplateResetSystemLib.inf
RealTimeClockLib|EmbeddedPkg/Library/TemplateRealTimeClockLib/TemplateRealTimeClockLib.inf
- # EBL Related Libraries
+ # Networking Requirements for ArmPlatformPkg/Bds
+ NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
+
+ # EBL Related Libraries
EblCmdLib|ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf
EfiFileLib|EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf
EblAddExternalCommandLib|EmbeddedPkg/Library/EblAddExternalCommandLib/EblAddExternalCommandLib.inf
EblNetworkLib|EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.inf
-
+
#
# Uncomment (and comment out the next line) For RealView Debugger. The Standard IO window
# in the debugger will show load and unload commands for symbols. You can cut and paste this
diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc index 5ceeebdf13..06c7b05a47 100644 --- a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc +++ b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc @@ -68,14 +68,17 @@ RealTimeClockLib|ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf
SerialPortLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
SerialPortExtLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortExtLib.inf
- TimerLib|ArmPlatformPkg/Library/SP804TimerLib/SP804TimerLib.inf
+ TimerLib|ArmPlatformPkg/Library/SP804TimerLib/SP804TimerLib.inf
# ARM PL011 UART Driver
PL011UartLib|ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.inf
NorFlashPlatformLib|ArmPlatformPkg/ArmRealViewEbPkg/Library/NorFlashArmRealViewEbLib/NorFlashArmRealViewEbLib.inf
- LcdPlatformLib|ArmPlatformPkg/ArmRealViewEbPkg/Library/PL111LcdArmRealViewEbLib/PL111LcdArmRealViewEbLib.inf
+ LcdPlatformLib|ArmPlatformPkg/ArmRealViewEbPkg/Library/PL111LcdArmRealViewEbLib/PL111LcdArmRealViewEbLib.inf
ArmPlatformSysConfigLib|ArmPlatformPkg/ArmRealViewEbPkg/Library/SysConfigArmRealViewEbLib/SysConfigArmRealViewEbLib.inf
- # EBL Related Libraries
+ # Networking Requirements for ArmPlatformPkg/Bds
+ NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
+
+ # EBL Related Libraries
EblCmdLib|ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf
EfiFileLib|EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf
EblAddExternalCommandLib|EmbeddedPkg/Library/EblAddExternalCommandLib/EblAddExternalCommandLib.inf
diff --git a/ArmPlatformPkg/Bds/Bds.inf b/ArmPlatformPkg/Bds/Bds.inf index 5faa4b2ee7..2a6b07b4bb 100644 --- a/ArmPlatformPkg/Bds/Bds.inf +++ b/ArmPlatformPkg/Bds/Bds.inf @@ -47,6 +47,7 @@ DebugLib
PrintLib
BaseLib
+ NetLib
[Guids]
gEfiFileSystemInfoGuid
diff --git a/ArmPlatformPkg/Bds/BdsHelper.c b/ArmPlatformPkg/Bds/BdsHelper.c index 152061d0f7..8553577cf1 100644 --- a/ArmPlatformPkg/Bds/BdsHelper.c +++ b/ArmPlatformPkg/Bds/BdsHelper.c @@ -12,6 +12,7 @@ *
**/
+#include <Library/NetLib.h>
#include "BdsInternal.h"
EFI_STATUS
@@ -137,43 +138,87 @@ GetHIInputInteger ( return Status;
}
+/**
+ Get an IPv4 address
+
+ The function asks the user for an IPv4 address. If the input
+ string defines a valid IPv4 address, the four bytes of the
+ corresponding IPv4 address are extracted from the string and returned by
+ the function.
+
+ @param[out] EFI_IP_ADDRESS OutIpAddr Returned IPv4 address. Valid if
+ and only if the returned value
+ is equal to EFI_SUCCESS
+ + @retval EFI_SUCCESS Input completed
+ @retval EFI_ABORTED Editing aborted by the user
+ @retval EFI_INVALID_PARAMETER The string returned by the user is
+ mal-formated
+ @retval EFI_OUT_OF_RESOURCES Fail to perform the operation due to
+ lack of resource
+**/
EFI_STATUS
GetHIInputIP (
- OUT EFI_IP_ADDRESS *Ip
+ OUT EFI_IP_ADDRESS *OutIpAddr
)
{
- CHAR16 CmdLine[255];
- CHAR16 *Str;
EFI_STATUS Status;
+ CHAR16 CmdLine[48];
CmdLine[0] = '\0';
- Status = EditHIInputStr (CmdLine,255);
- if (!EFI_ERROR(Status)) {
- Str = CmdLine;
- Ip->v4.Addr[0] = (UINT8)StrDecimalToUintn (Str);
-
- Str = StrStr (Str, L".");
- if (Str == NULL) {
- return EFI_INVALID_PARAMETER;
- }
+ Status = EditHIInputStr (CmdLine, 48);
+ if (EFI_ERROR (Status)) {
+ return EFI_ABORTED;
+ }
- Ip->v4.Addr[1] = (UINT8)StrDecimalToUintn (++Str);
+ Status = NetLibStrToIp4 (CmdLine, &OutIpAddr->v4);
- Str = StrStr (Str, L".");
- if (Str == NULL) {
- return EFI_INVALID_PARAMETER;
- }
+ return Status;
+}
- Ip->v4.Addr[2] = (UINT8)StrDecimalToUintn (++Str);
+/**
+ Edit an IPv4 address
+
+ The function displays as a string following the "%d.%d.%d.%d" format the
+ IPv4 address that is passed in and asks the user to modify it. If the
+ resulting string defines a valid IPv4 address, the four bytes of the
+ corresponding IPv4 address are extracted from the string and returned by
+ the function.
+
+ @param[in ] EFI_IP_ADDRESS InIpAddr Input IPv4 address
+ @param[out] EFI_IP_ADDRESS OutIpAddr Returned IPv4 address. Valid if
+ and only if the returned value
+ is equal to EFI_SUCCESS
+ + @retval EFI_SUCCESS Update completed
+ @retval EFI_ABORTED Editing aborted by the user
+ @retval EFI_INVALID_PARAMETER The string returned by the user is
+ mal-formated
+ @retval EFI_OUT_OF_RESOURCES Fail to perform the operation due to
+ lack of resource
+**/
+EFI_STATUS
+EditHIInputIP (
+ IN EFI_IP_ADDRESS *InIpAddr,
+ OUT EFI_IP_ADDRESS *OutIpAddr
+ )
+{
+ EFI_STATUS Status;
+ CHAR16 CmdLine[48];
- Str = StrStr (Str, L".");
- if (Str == NULL) {
- return EFI_INVALID_PARAMETER;
- }
+ UnicodeSPrint ( + CmdLine, 48, L"%d.%d.%d.%d",
+ InIpAddr->v4.Addr[0], InIpAddr->v4.Addr[1],
+ InIpAddr->v4.Addr[2], InIpAddr->v4.Addr[3]
+ );
- Ip->v4.Addr[3] = (UINT8)StrDecimalToUintn (++Str);
+ Status = EditHIInputStr (CmdLine, 48);
+ if (EFI_ERROR (Status)) {
+ return EFI_ABORTED;
}
+ Status = NetLibStrToIp4 (CmdLine, &OutIpAddr->v4);
+
return Status;
}
diff --git a/ArmPlatformPkg/Bds/BdsInternal.h b/ArmPlatformPkg/Bds/BdsInternal.h index 447b8c9cd1..d5b1b79c38 100644 --- a/ArmPlatformPkg/Bds/BdsInternal.h +++ b/ArmPlatformPkg/Bds/BdsInternal.h @@ -161,6 +161,12 @@ GetHIInputIP ( );
EFI_STATUS
+EditHIInputIP (
+ IN EFI_IP_ADDRESS *InIpAddr,
+ OUT EFI_IP_ADDRESS *OutIpAddr
+ );
+
+EFI_STATUS
GetHIInputBoolean (
OUT BOOLEAN *Value
);
diff --git a/BeagleBoardPkg/BeagleBoardPkg.dsc b/BeagleBoardPkg/BeagleBoardPkg.dsc index 07b8c47198..d24a1bca18 100644 --- a/BeagleBoardPkg/BeagleBoardPkg.dsc +++ b/BeagleBoardPkg/BeagleBoardPkg.dsc @@ -122,6 +122,7 @@ DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
DmaLib|ArmPkg/Library/ArmDmaLib/ArmDmaLib.inf
+ NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
BdsLib|ArmPkg/Library/BdsLib/BdsLib.inf
FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
|