2 EBL commands for Network Devices
4 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
5 (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
22 OUT EFI_IP_ADDRESS
*Address
25 Address
->v4
.Addr
[0] = (UINT8
)AsciiStrDecimalToUintn (String
);
26 String
= AsciiStrStr(String
, ".") + 1;
27 Address
->v4
.Addr
[1] = (UINT8
)AsciiStrDecimalToUintn (String
);
28 String
= AsciiStrStr(String
, ".") + 1;
29 Address
->v4
.Addr
[2] = (UINT8
)AsciiStrDecimalToUintn (String
);
30 String
= AsciiStrStr(String
, ".") + 1;
31 Address
->v4
.Addr
[3] = (UINT8
)AsciiStrDecimalToUintn (String
);
43 EFI_STATUS Status
= EFI_INVALID_PARAMETER
;
50 // Get current MAC address
51 Status
= EblGetCurrentMacAddress (&Mac
);
52 if (EFI_ERROR (Status
)) {
56 AsciiPrint ("MAC Address: %02x:%02x:%02x:%02x:%02x:%02x\n", Mac
.Addr
[0], Mac
.Addr
[1], Mac
.Addr
[2], Mac
.Addr
[3], Mac
.Addr
[4], Mac
.Addr
[5]);
58 // Get current IP address
59 Status
= EblGetCurrentIpAddress (&Ip
);
60 if (EFI_ERROR(Status
)) {
61 AsciiPrint("IP Address is not configured.\n");
66 AsciiPrint("IP Address: %d.%d.%d.%d\n", Ip
.v4
.Addr
[0], Ip
.v4
.Addr
[1],Ip
.v4
.Addr
[2], Ip
.v4
.Addr
[3]);
68 } else if ((Argv
[1][0] == 'r') && (Argc
== 2)) {
69 // Get new address via dhcp
70 Status
= EblPerformDHCP (TRUE
);
71 } else if ((Argv
[1][0] == 's') && (Argc
== 3)) {
73 Status
= ParseIp (Argv
[2], &Ip
);
74 if (EFI_ERROR (Status
)) {
78 Status
= EblSetStationIp (&Ip
, NULL
);
85 GLOBAL_REMOVE_IF_UNREFERENCED
const EBL_COMMAND_TABLE mCmdNetworkTemplate
[] =
89 " ; print current ip address\n\r [r]; request DHCP address\n\r [s] ipaddr; set static IP address",
97 Initialize the commands in this in this file
100 EblInitializeNetworkCmd (
104 EblAddCommands (mCmdNetworkTemplate
, sizeof (mCmdNetworkTemplate
)/sizeof (EBL_COMMAND_TABLE
));