diff options
author | Zhang, Lubo <C:/Program Files (x86)/Git/o=Intel/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=Zhang, Lubob8d> | 2016-02-29 14:25:50 +0800 |
---|---|---|
committer | Jiaxin Wu <jiaxin.wu@intel.com> | 2016-03-07 09:57:09 +0800 |
commit | be6cd654eb27370bfa127dd387846ad983f4ef72 (patch) | |
tree | 2a219f73811787324d3d3a03ff96a872fd9f63e1 /NetworkPkg/Application/VConfig | |
parent | fa848a4048943251fc057fe8d6c5a82e01d2ffb6 (diff) | |
download | edk2-platforms-be6cd654eb27370bfa127dd387846ad983f4ef72.tar.xz |
NetworkPkg: Support print help information using -? command.
v2:
*Modify the logic of show SAD,SPD and PAD help info, include them in -?
instead of follow -p command.
Since Shell supports finding help information from resource section
of application image. We modify the Shell application Under NetworkPkg
to support print help information string using -? command.
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Diffstat (limited to 'NetworkPkg/Application/VConfig')
-rw-r--r-- | NetworkPkg/Application/VConfig/VConfig.c | 43 | ||||
-rw-r--r-- | NetworkPkg/Application/VConfig/VConfig.inf | 12 | ||||
-rw-r--r-- | NetworkPkg/Application/VConfig/VConfigStrings.uni | 52 |
3 files changed, 75 insertions, 32 deletions
diff --git a/NetworkPkg/Application/VConfig/VConfig.c b/NetworkPkg/Application/VConfig/VConfig.c index ba1720705c..d00a041f49 100644 --- a/NetworkPkg/Application/VConfig/VConfig.c +++ b/NetworkPkg/Application/VConfig/VConfig.c @@ -1,7 +1,7 @@ /** @file
Shell application for VLAN configuration.
- Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -23,8 +23,14 @@ #include <Library/MemoryAllocationLib.h>
#include <Library/HiiLib.h>
#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiHiiServicesLib.h>
#include <Library/NetLib.h>
+//
+// String token ID of VConfig command help message text.
+//
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringVConfigHelpTokenId = STRING_TOKEN (STR_VCONFIG_HELP);
+
#define INVALID_NIC_INDEX 0xffff
#define INVALID_VLAN_ID 0xffff
@@ -608,13 +614,39 @@ VlanConfigMain ( {
LIST_ENTRY *List;
CONST CHAR16 *Str;
+ EFI_HII_PACKAGE_LIST_HEADER *PackageList;
+ EFI_STATUS Status;
mImageHandle = ImageHandle;
+
+ //
+ // Retrieve HII package list from ImageHandle
+ //
+ Status = gBS->OpenProtocol (
+ ImageHandle,
+ &gEfiHiiPackageListProtocolGuid,
+ (VOID **) &PackageList,
+ ImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
//
- // Register our string package to HII database.
+ // Publish HII package list to HII Database.
//
- mHiiHandle = HiiAddPackages (&gEfiCallerIdGuid, ImageHandle, VConfigStrings, NULL);
+ Status = gHiiDatabase->NewPackageList (
+ gHiiDatabase,
+ PackageList,
+ NULL,
+ &mHiiHandle
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
if (mHiiHandle == NULL) {
return EFI_SUCCESS;
}
@@ -626,11 +658,6 @@ VlanConfigMain ( goto Exit;
}
- if (ShellCommandLineGetFlag (List, L"-?")) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_HELP), mHiiHandle);
- goto Exit;
- }
-
if (ShellCommandLineGetFlag (List, L"-l")) {
Str = ShellCommandLineGetValue (List, L"-l");
DisplayVlan ((CHAR16 *) Str);
diff --git a/NetworkPkg/Application/VConfig/VConfig.inf b/NetworkPkg/Application/VConfig/VConfig.inf index 7067e0cd81..771f585a71 100644 --- a/NetworkPkg/Application/VConfig/VConfig.inf +++ b/NetworkPkg/Application/VConfig/VConfig.inf @@ -3,7 +3,7 @@ #
# It is shell application which is used to get and set VLAN configuration.
#
-# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -25,6 +25,12 @@ MODULE_UNI_FILE = VConfig.uni
#
+#
+# This flag specifies whether HII resource section is generated into PE image.
+#
+ UEFI_HII_RESOURCE_SECTION = TRUE
+
+#
# VALID_ARCHITECTURES = IA32 X64 IPF
#
@@ -40,6 +46,7 @@ [LibraryClasses]
UefiApplicationEntryPoint
UefiBootServicesTableLib
+ UefiHiiServicesLib
UefiLib
ShellLib
NetLib
@@ -47,7 +54,8 @@ HiiLib
[Protocols]
- gEfiVlanConfigProtocolGuid ## CONSUMES
+ gEfiVlanConfigProtocolGuid ## CONSUMES
+ gEfiHiiPackageListProtocolGuid ## CONSUMES
[UserExtensions.TianoCore."ExtraFiles"]
VConfigExtra.uni
diff --git a/NetworkPkg/Application/VConfig/VConfigStrings.uni b/NetworkPkg/Application/VConfig/VConfigStrings.uni index 641e26e0f9..1bb66ba27e 100644 --- a/NetworkPkg/Application/VConfig/VConfigStrings.uni +++ b/NetworkPkg/Application/VConfig/VConfigStrings.uni @@ -1,7 +1,7 @@ /** @file
String definitions for VLAN configuration Shell application.
- Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -32,24 +32,32 @@ #string STR_VCONFIG_SET_SUCCESS #language en-US "VLAN device added.\n"
#string STR_VCONFIG_REMOVE_SUCCESS #language en-US "VLAN device removed.\n"
#string STR_VCONFIG_NO_ARG #language en-US "Invalid argument, try "-?" for help.\n"
-#string STR_VCONFIG_HELP #language en-US "Display or modify VLAN configuration for network interface.\n\n"
- "VCONFIG [-?] [-l [IfName]] [-a IfName VlanId [Priority]] [-d IfName.VlanId]\n"
- "\n"
- " -l Display VLAN configuration for all or specified interface.\n"
- " -a Add a VLAN device for the network interface.\n"
- " -d Delete a VLAN device.\n"
- " IfName Name of network interface, e.g. eth0, eth1.\n"
- " VlanId Unique VLAN identifier (0~4094).\n"
- " Priority 802.1Q priority level (0~7), default 0.\n"
- "\n"
- "Examples:\n"
- " * To display VLAN configuration:\n"
- " fs0:\> vconfig -l\n"
- " fs0:\> vconfig -l eth0\n"
- "\n"
- " * To add VLAN device:\n"
- " fs0:\> vconfig -a eth0 1000\n"
- " fs0:\> vconfig -a eth0 2000 7\n"
- "\n"
- " * To delete VLAN device:\n"
- " fs0:\> vconfig -d eth0.1000\n"
+
+#string STR_VCONFIG_HELP #language en-US ""
+".TH VConfig 0 "Display or modify VLAN configuration for network interface."\r\n"
+".SH NAME\r\n"
+"Display or modify VLAN configuration for network interface.\r\n"
+".SH SYNOPSIS\r\n"
+" \r\n"
+"VCONFIG [-?] [-l [IfName]] [-a IfName VlanId [Priority]] [-d IfName.VlanId]\r\n"
+".SH OPTIONS\r\n"
+" \r\n"
+" -l Display VLAN configuration for all or specified interface.\r\n"
+" -a Add a VLAN device for the network interface.\r\n"
+" -d Delete a VLAN device.\r\n"
+" IfName Name of network interface, e.g. eth0, eth1.\r\n"
+" VlanId Unique VLAN identifier (0~4094).\r\n"
+" Priority 802.1Q priority level (0~7), default 0.\r\n"
+".SH EXAMPLES\r\n"
+" \r\n"
+"Examples:\r\n"
+" * To display VLAN configuration:\r\n"
+" fs0:\> vconfig -l\r\n"
+" fs0:\> vconfig -l eth0\r\n"
+"\r\n"
+" * To add VLAN device:\r\n"
+" fs0:\> vconfig -a eth0 1000\r\n"
+" fs0:\> vconfig -a eth0 2000 7\r\n"
+"\r\n"
+" * To delete VLAN device:\r\n"
+" fs0:\> vconfig -d eth0.1000\r\n"
|