summaryrefslogtreecommitdiffstats
path: root/ShellPkg/Library
Commit message (Collapse)AuthorAgeFilesLines
* ShellPkg/UefiShellAcpiViewCommandLib: Change the note in uniZhichao Gao2019-03-121-1/+7
| | | | | | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1146 Add DSDT and SSDT description in the help information. Depend on the implement of UefiShellAcpiViewCommandLib, the "acpiview" command support to show all present type in the system not only support the listed type in the help information. So change the help information of this command. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/UefiShellLib: Use BaseLib api CharToUpperShenglei Zhang2019-01-311-30/+3
| | | | | | | | | | | | | | | | Substitute InternalShellCharToUpper with CharToUpper which is a public function with the same effect. Remove the implement of InternalShellCharToUpper. https://bugzilla.tianocore.org/show_bug.cgi?id=1369 Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/UefiShellAcpiViewCommandLib: Fix VS tool chain build failureDandan Bi2019-01-291-1/+1
| | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1491 This patch is to update the data type of variable "Offset" from UINT8 to UINT32 to fix following build issue. ...\Parsers\Pptt\PpttParser.c(193): error C2220: warning treated as error - no 'object' file generated ...\Parsers\Pptt\PpttParser.c(193): warning C4244: '=': conversion from 'UINT32' to 'UINT8', possible loss of data Cc: Krzysztof Koch <krzysztof.koch@arm.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ray Ni <ray.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/UefiShellAcpiViewCommandLib: Add support for PPTTKrzysztof Koch2019-01-245-4/+391
| | | | | | | | | Added the acpiview parser for the PPTT table. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/UefiShellDebug1CommandsLib: Remove the unused function CharToUpperShenglei Zhang2018-12-181-28/+0
| | | | | | | | | | | | | | | CharToUpper is an unused function, so it will be removed. https://bugzilla.tianocore.org/show_bug.cgi?id=1399 v2:Update the title. Cc: Laszlo Ersek <lersek@redhat.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* ShellPkg/ShellLib: Fix potential NULL deference issueRuiyu Ni2018-11-081-1/+5
| | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1310 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jim Dailey <jim_dailey@dell.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg-UefiShellLib: Add a function to fully-qualify pathsJim.Dailey@dell.com2018-11-051-1/+116
| | | | | | | | | | | | | | | | | | | | | | Add a function to return a clean, fully-qualified version of some path. This function handles a (possibly "dirty") input path that may or may not include a file system reference. If it does not include a file system reference, then if the input path does not begin with a forward or backward slash, then the input path is relative to the current working directory of the current file system. Otherwise, it is an absolute path within the current file system. If it does include a file system reference, it may be a reference to the current or some other file system. If the file system reference is not immediately followed by a forward or backward slash, then the input path is relative to the current working directory of the given file system. Otherwise, it is an absolute path within the given file system. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jim Dailey <jim_dailey@dell.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* ShellPkg/dmem: Only dump sizeof (EFI_SYSTEM_TABLE) bytes for gSTRuiyu Ni2018-10-241-1/+1
| | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1236 When "dmem" runs without additional arguments, it dumps the memory content of EFI_SYSTEM_TABLE. But today's implementation dumps 512 bytes. It's not correct because sizeof (EFI_SYSTEM_TABLE) is less than 512, the 512-read causes page fault exception in a heap-guard enabled environment. The patch changes the implementation to only dump sizeof (EFI_SYSTEM_TABLE) bytes for gST. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Jim Dailey <jim_dailey@.com>
* ShellPkg-Cd: Ensure all valid cd targets are handled properlyJim.Dailey@dell.com2018-10-121-4/+4
| | | | | | | | | | | | ShellPkg-Cd: Ensure all valid cd targets are handled properly Make sure that PathCleanUpDirectories() is called on all valid targets of the cd command. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jim Dailey <jim_dailey@dell.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* ShellPkg/UefiShellDebug1CommandsLib: Remove unused PCDsshenglei2018-09-301-2/+0
| | | | | | | | | | | | | | The PCDs below are unused, so they have been removed from inf. gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: shenglei <shenglei.zhang@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/UefiHandleParsingLib: Remove an unused PCDshenglei2018-09-301-1/+0
| | | | | | | | | | | | | The PCD below is unused, so it has been removed from inf. gEfiShellPkgTokenSpaceGuid.PcdShellPrintBufferSize Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: shenglei <shenglei.zhang@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg: Remove trailing white spaceFu Siyuan2018-09-101-1/+1
| | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1158 Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* ShellPkg: Update Ifconfig command to accept 32bit subnet mask.Fu Siyuan2018-09-031-0/+1
| | | | | | | | | Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/SmbiosView: Update SmbiosView for SMBIOS3.2.0Dandan Bi2018-08-304-19/+237
| | | | | | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1099 Update SmbiosView to parse the new definitions which are introduced in SMBIOS3.2.0 V2: 1. Add structure length check before dump the fileds in Type 9 and Type 17 in case some fileds are not organized and reported by drivers. 2. Dump the InterfaceTypeSpecificData in Type 42. V3: 1. Correct the structure length in Type17. 2. Remove the redundant check "if (PeerGroupCount > 0)" in Type 9. 3. Use the Uint16 filed instead of Bits field in union MEMORY_DEVICE_OPERATING_MODE_CAPABILITY to dump data. Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* ShellPkg/edit: Fix heap access out-of-boundsRuiyu Ni2018-08-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The issue was found when heap guard is turned on. PrintLib somehow receives a non-null terminated string in var-arg. When the PrintLib implementation reads the string it keeps reading because no null-terminator is met, which triggers the page fault set by the heap guard. The issue is caused by a bug in FileBufferPrintLine(). When "edit" opens a binary file, in FileBufferPrintLine(), the Line->Buffer may start with \x00 \x00, but the Line->Size is larger than MainEditor.ScreenSize.Column, it causes the PrintLine is set to an empty string by below call: StrnCpyS ( PrintLine, BufLen/sizeof(CHAR16), Buffer, MIN(Limit, MainEditor.ScreenSize.Column) ); But since Limit (equals to Line->Size) is larger than MainEditor.ScreenSize.Column, below for-loop doesn't successfully set the whole PrintLine to all-empty-space. for (; Limit < MainEditor.ScreenSize.Column; Limit++) { PrintLine[Limit] = L' '; } So after the for-loop, PrintLine is still an empty string. Later in below call, the PrintLine2 is created based on PrintLine. ShellCopySearchAndReplace ( PrintLine, PrintLine2, BufLen * 2, L"%", L"^%", FALSE, FALSE ); But due to the implementation of ShellCopySearchAndReplace(), PrintLine2 is untouched and INVALID_PARAMETER is returned. Finally an uninitialized string is passed to ShellPrintEx() which causes the #PF exception. The fix is to reset Limit to StrLen(PrintLine) before for-loop. So that PrintLine can be converted from an empty string to a string containing all spaces. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Jian Wang <jian.j.wang@intel.com>
* ShellPkg/UefiShellLib: rebase ShellOpenFileByDevicePath() to UefiLib APILaszlo Ersek2018-08-162-111/+3
| | | | | | | | | | | | | | | | | | | | | Replace the "old shell method" implementation in ShellOpenFileByDevicePath() with EfiOpenFileByDevicePath() from UefiLib, correcting the following issues: - code duplication between this module and other modules, - local variable name "EfiSimpleFileSystemProtocol" starting with "Efi" prefix, - bogus "FileHandle = NULL" assignments, - leaking "Handle1" when the device path type/subtype check or the realignment-motivated AllocateCopyPool() fails in the loop. Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1008 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* ShellPkg/UefiShellLib: drop DeviceHandle param of ShellOpenFileByDevicePath()Laszlo Ersek2018-08-162-8/+5
| | | | | | | | | | | | | | | | | | | | | The ShellOpenFileByDevicePath() API promises to set the DeviceHandle output parameter to the handle of the filesystem identified by the FilePath input parameter. However, this doesn't actually happen when the UEFI Shell 2.0 method is used (which is basically "always" nowadays). Accordingly, the only caller of ShellOpenFileByDevicePath(), namely ShellOpenFileByName(), defines a (dummy) local DeviceHandle variable just so it can call ShellOpenFileByDevicePath(). Remove the useless output parameter. Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1008 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* ShellPkg/acpi: Fix XCODE5 X64 build failureRuiyu Ni2018-08-072-2/+2
| | | | | | Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
* ShellPkg/acpi: Code cleanup to pass static code checkerRuiyu Ni2018-08-063-2/+3
| | | | | | Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Hao Wu <Hao.a.wu@intel.com>
* ShellPkg/UefiShellAcpiViewCommandLib: Fix VS2017 compilation errorsAlexeiFedorov2018-08-022-8/+8
| | | | | | | | | | | | | | This patch fixes VS2017 compilation errors for UefiShellAcpiViewCommandLib\Parsers\Gtdt\GtdtParser.c and UefiShellAcpiViewCommandLib\Parsers\Xsdt\XsdtParser.c reported in https://bugzilla.tianocore.org/show_bug.cgi?id=985 https://bugzilla.tianocore.org/show_bug.cgi?id=986 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/UefiShellAcpiViewCommandLib: Fix GCC build failureDandan Bi2018-08-012-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Fix following GCC build issues: 1. xxx/SratParser.c:127:47: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] {L"Proximity Domain [31:8]", 3, 9, L"0x%x", DumpSratApicProximity, ^ xxx/SratParser.c:127:47: note: (near initialization for 'SratApciSapicAffinityParser[6].PrintFormatter') 2. xxx\UefiShellAcpiViewCommandLib.c:66:14: error: 'Status' may be used uninitialized in this fu nction [-Werror=maybe-uninitialized] EFI_STATUS Status; ^ cc: Alexei Fedorov <Alexei.Fedorov@arm.com> cc: Ruiyu Ni <ruiyu.ni@intel.com> cc: Jaben Carsey <jaben.carsey@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/UefiShellAcpiViewCommandLib: Fix VS2012 build failureDandan Bi2018-08-014-7/+7
| | | | | | | | | | | | | | | Fix following build error: UefiShellAcpiViewCommandLib\AcpiParser.c(519) : error C2308: concatenating mismatched strings Concatenating wide "ERROR: %a: Offset Mismatch for %s" with narrow "CurrentOffset = %d FieldOffset = %d" cc: Alexei Fedorov <Alexei.Fedorov@arm.com> cc: Ruiyu Ni <ruiyu.ni@intel.com> cc: Jaben Carsey <jaben.carsey@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/UefiShellAcpiViewCommandLib: Fix VS2012 build failureDandan Bi2018-08-011-1/+1
| | | | | | | | | | | | | | | | | | | Fix following build error: xxx\AcpiParser.c(487) : error C2275: 'UINTN' : illegal use of this type as an expression xxx\ProcessorBind.h(224) : see declaration of 'UINTN' xxx\AcpiParser.c(487) : error C2146: syntax error : missing ';' before identifier 'OriginalAttribute' xxx\AcpiParser.c(487) : error C2065: 'OriginalAttribute' : undeclared identifier ...... cc: Alexei Fedorov <Alexei.Fedorov@arm.com> cc: Ruiyu Ni <ruiyu.ni@intel.com> cc: Jaben Carsey <jaben.carsey@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg: Removing ipf which is no longer supported from edk2.chenc22018-06-295-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removing rules for Ipf sources file: * Remove the source file which path with "ipf" and also listed in [Sources.IPF] section of INF file. * Remove the source file which listed in [Components.IPF] section of DSC file and not listed in any other [Components] section. * Remove the embedded Ipf code for MDE_CPU_IPF. Removing rules for Inf file: * Remove IPF from VALID_ARCHITECTURES comments. * Remove DXE_SAL_DRIVER from LIBRARY_CLASS in [Defines] section. * Remove the INF which only listed in [Components.IPF] section in DSC. * Remove statements from [BuildOptions] that provide IPF specific flags. * Remove any IPF sepcific sections. Removing rules for Dec file: * Remove [Includes.IPF] section from Dec. Removing rules for Dsc file: * Remove IPF from SUPPORTED_ARCHITECTURES in [Defines] section of DSC. * Remove any IPF specific sections. * Remove statements from [BuildOptions] that provide IPF specific flags. Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chen A Chen <chen.a.chen@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg: Clean up source filesLiming Gao2018-06-28109-1543/+1543
| | | | | | | | | | 1. Do not use tab characters 2. No trailing white space in one line 3. All files must end with CRLF Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* ShellPkg/comp: return NOT_EQUAL when compared files are differentRuiyu Ni2018-06-211-1/+2
| | | | | | | | | | | Today's implementation returns 0 even when compared files are different. The patch returns 27 (SHELL_NOT_QUAL) in such case to follow the shell spec. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC issuesDandan Bi2018-06-1114-117/+178
| | | | | | | | | | | | | | | 1. Separate variable definition and initialization. 2. Make the variable naming following Edk2 rule. V2: Remove the updates of guard macros in header files. Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Evan Lloyd <evan.lloyd@arm.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC issuesDandan Bi2018-06-1122-447/+645
| | | | | | | | | | | | Make the function comments follow EDK2 coding style. Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Evan Lloyd <evan.lloyd@arm.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* ShellPkg: Add acpiview tool to dump ACPI tablesRuiyu Ni2018-04-2324-0/+5894
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This program is provided to allow examination of ACPI table contents from the UEFI Shell. This can help with investigations, especially at that stage where the tables are not enabling an OS to boot. The program is not exhaustive, and only encapsulates detailed knowledge of a limited number of table types. Default behaviour is to display the content of all tables installed. 'Known' table types will be parsed and displayed with descriptions and field values. Where appropriate a degree of consistency checking is done and errors may be reported in the output. Other table types will be displayed as an array of Hexadecimal bytes. To facilitate debugging, the -s and -d options can be used to generate a binary file image of a table that can be copied elsewhere for investigation using tools such as those provided by acpica.org. This is especially relevant for AML type tables like DSDT and SSDT. The inspiration for this is the existing smbiosview Debug1 Shell command. Many tables are not explicitly handled, in part because no examples are available for our testing. The program is designed to be extended to new tables with minimal effort, and contributions are invited. Change-Id: Ifa23dc80ab8ab042c56e88424847e796a8122a7c Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Evan Lloyd <evan.lloyd@arm.com> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Evan Lloyd <evan.lloyd@arm.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* ShellPkg/UefiHandleParsingLib: remove TrEE reference.Jiewen Yao2018-03-163-3/+0
| | | | | | | | | | | | TrEE is deprecated. We need use Tcg2. Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Chao B Zhang <chao.b.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Chao B Zhang <chao.b.zhang@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* ShellPkg/[hex]edit: Fix mouse freeze issueRuiyu Ni2018-03-142-14/+18
| | | | | | | | | | | | | | | | | | | In edit or hexedit, the mouse cursor doesn't move when moving the mouse. The root cause is 5563281fa2b31093a1cbd415553b9264c5136e89 * ShellPkg/[hex]edit: use SimpleTextInEx to read console wrongly uses WaitForEvent() to listen keyboard input. It blocks the code execution when there is no keyboard input. While the same function also polls the mouse move status, the mouse movement cannot be reflected to the screen when there is no keyboard input. The patch fixes the issue by use CheckEvent() instead of WaitForEvent(). Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/UefiShellDebug1CommandsLib: remove I/O address limit from 'mm'Ard Biesheuvel2018-03-012-13/+0
| | | | | | | | | | | | | Neither the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL nor the EFI_CPU_IO2_PROTOCOL impose any restrictions when it comes to the range of valid I/O addresses. Even so, the 'mm' command in -IO mode refuses to perform accesses to addresses >= 0xffff. It is not up to 'mm' to impose this restriction, so remove it. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/Ping: fix loss of first packetMeenakshi Aggarwal2018-02-231-1/+4
| | | | | | | | | | | | | | | | | Issue: Reply for first ping packet was getting dropped. Cause: Sometimes reply message comes even before trasmit function returns, hence missing 1st reply Fix: Prepare the TxList before calling Transmit function. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* ShellPkg/ShellLib: Fix a bug in InternalShellIsHexOrDecimalNumberRuiyu Ni2018-02-151-8/+15
| | | | | | | | | | | | InternalShellIsHexOrDecimalNumber() wrongly treats "-" as a number. The patch fixes this issue. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=730 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/[hex]edit: Fix CTRL+<Alpha> doesn't work from hyper terminalRuiyu Ni2018-02-153-12/+18
| | | | | | | | | | | | | | | After commit 20ddbc133f679b7895dfdaf2fd58ec4c8183a1d8 * MdeModulePkg/ConSplitter: ReadKeyStrokeEx always return key state When one physical console supports to report the shift key state, the key data returned from ConSplitter driver at least carries the shift key valid bit. The patch fixes the edit/hexedit to accept Unicode (1) when the no shift key is pressed or reported. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/[hex]edit: Fix wrongly use gST->ConIn as the console handleRuiyu Ni2018-02-132-2/+2
| | | | | | Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/[hex]edit: use SimpleTextInEx to read consoleRuiyu Ni2018-02-138-161/+309
| | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=682 Edit and HexEdit commands assume that SimpleTxtIn translates Ctrl+<Alpha-Key> key combinations into Unicode control characters (0x1-0x1A). Such translation does not seem to be required by the UEFI spec. Shell should not rely on implementation specific behavior. It should instead use SimpleTextInEx to read Ctrl+<Alpha-Key> key combinations. The patch changes edit and hexedit to only consumes SimpleTextInEx so that the implementation specific behavior dependency is removed. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reported-by: Felix <felixp@mail.ru> Cc: Felix <felixp@mail.ru> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/rm: fix hang when deleting an absolutely-empty directoryRuiyu Ni2018-02-091-3/+4
| | | | | | | | | | | | | | | | An ordinary empty directory should contain "." and ".." entries. When an empty directory even doesn't contain "." or ".." entry, FileHandleFindFirstFile() may return error status and a NULL FileInfo. IsDirectoryEmpty() implementation in Rm.c doesn't consider this case and the deference of FileInfo->FileName causes page fault exception because FileInfo is NULL. The patch checks the return status of FileHandleFindFirstFile() to fix this issue. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/hexedit: Fix a read-after-free bugRuiyu Ni2018-02-092-27/+18
| | | | | | | | | | | | | HDiskImageSetDiskNameOffsetSize() and HFileImageSetFileName() may be called using the current disk name or file name. When this happens, today's implementation firstly frees the memory and then accesses the just-freed memory. The patch fixes this issue by doing nothing when the disk or file name is the current one. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/UefiShellDebug1CommandsLib: sync Compress() definition with decl.Laszlo Ersek2018-02-082-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "Compress.h" declares the Compress() function as EFIAPI, but the definition in "Compress.c" lacks EFIAPI. GCC toolchains without LTO do not catch this error because "Compress.c" does not include "Compress.h"; i.e. the declaration used by callers such as "EfiCompress.c" is not actually matched against the function definition at build time. With LTO enabled, the mismatch is found -- however, as a warning only, due to commit f8d0b9662993 ("BaseTools GCC5: disable warnings-as-errors for now", 2016-08-03). Include the header in the C file (which turns the issue into a hard build error on all GCC toolchains), plus sync the declaration from the header file to the C file. Finally, remove EFIAPI from both declaration and definition -- this was the original intent of commit c4e74e9b814c ("ShellPkg/UefiShellDebug1CommandsLib: Remove unnecessary EFIAPI", 2016-10-09), but it missed the header file. (Gary meant to address that omission in Oct 2017: [edk2] [PATCH] ShellPkg/UefiShellDebug1CommandsLib: Remove EFIAPI from Compress() http://mid.mail-archive.com/20171026065329.32311-1-glin@suse.com and Ray reviewed the patch, but then the patch was never committed.) So do the sync and drop EFIAPI now. This happens to fix the EFICOMPRESS shell command, when built with GCC for X64. Cc: Gary Lin <glin@suse.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Fixes: c4e74e9b814cfb4b51cf832f3bb218cd2aba348b Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Gary Lin <glin@suse.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/map: Fix out-of-bound read when "map fsn"Ruiyu Ni2018-02-061-6/+12
| | | | | | | | | | | | | | | The below code reads additional one CHAR16 when copying content from Specific to NewSpecific. NewSpecific = AllocateCopyPool( StrSize(Specific) + sizeof(CHAR16), Specific ); The patch fixes this issue. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com>
* ShellPkg/for: Fix potential null pointer deferenceRuiyu Ni2018-02-061-2/+4
| | | | | | | | | | | | | When "FOR %a %a IN A B C" is executed, CurrentScriptFile->CurrentCommand->Data is NULL. But the code assumes it's not NULL and tries to deference it. The patch fixes this issue. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/Level2Command: Use UnicodeCollation in StrinCmpRuiyu Ni2018-01-295-45/+49
| | | | | | Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/CommandLib: Locate proper UnicodeCollation instanceRuiyu Ni2018-01-292-12/+67
| | | | | | | | | | | | | Original code locates the first UnicodeCollation instance in DXE Core protocol database. It's not correct considering multiple UnicodeCollation instances exist in system. The patch changes logic to find the one that matches the current system language. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com.
* ShellPkg/UefiShellLevel3CommandsLib: fix string over-readJian J Wang2018-01-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | In the for-loop condition of original code, the expression *CurrentCommand != CHAR_NULL is put before expression CurrentCommand < SortedCommandList + SortedCommandListSize/sizeof(CHAR16) When CurrentCommand walks to the end of string buffer, one more character over the end of string buffer will be read and then stop. To fix this issue, just move the last expression to the first one. Because of short-circuit evaludation of and-expression, the following one *CurrentCommand != CHAR_NULL will not be evaluated if the expression before it is evaludated as FALSE. Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* ShellPkg/UefiShellLevel2CommandsLib: add missing EFIAPI call conv specLaszlo Ersek2018-01-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | UefiShellLevel2CommandsLib (somewhat questionably) calls the BaseLib-internal function InternalCharToUpper(). This function is declared in "MdePkg/Library/BaseLib/BaseLibInternals.h", which is not a public library class header. UefiShellLevel2CommandsLib therefore duplicates the function declaration, but a mistake was made: the EFIAPI calling convention is not spelled out on the duplicated declaration. Therefore calls made from UefiShellLevel2CommandsLib will not match the actual function definition in "MdePkg/Library/BaseLib/String.c", when GCC/X64 toolchains are used. One consequence of this is that cross-filesystem copies don't work in the UEFI shell (see the StrniCmp() function in "UefiShellLevel2CommandsLib.c"). From the original report: > FS0:\efi\ubuntu\> cp grubx64.efi fs1:\ > > cp: The source and destination are the same. Copy the declaration from "BaseLibInternals.h" to "UefiShellLevel2CommandsLib.c" verbatim. Reported-by: Rebecca Cran <rebecca@bluestop.org> Analyzed-by: Thomas Palmer <thomas.palmer@hpe.com> Analyzed-by: Liming Gao <liming.gao@intel.com> Ref: http://mid.mail-archive.com/47cd17d8-f022-6ca5-2f52-06a8250f8d14@cran.org.uk Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Rebecca Cran <rebecca@bluestop.org> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Thomas Palmer <thomas.palmer@hpe.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Thomas Palmer <thomas.palmer@hpe.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg: Fix a build error in Ping6 shell command.fanwang22017-12-181-1/+1
| | | | | | | | | | Last check in involved a build error, this patch is to fix this issue. Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wang Fan <fan.wang@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* ShellPkg: Update Api from NetLibDetectMedia to NetLibDetectMediaWaitTimeout.fanwang22017-12-183-12/+12
| | | | | | | | | | | | | | | | Since new Api NetLibDetectMediaWaitTimeout was involved to support connecting state handling, and it is forward compatible. So apply this Api in ShellPkg. V2: *Define time period in a macro instead of hard code. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Wu Jiaxin <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wang Fan <fan.wang@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Signed-off-by: fanwang2 <fan.wang@intel.com>
* ShellPkg/ShellLib: Fix dynamic command fails to start during bootRuiyu Ni2017-11-291-37/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous change in ShellLib: "commit 3d29f8c5e361525a0d2accfa7f5bb0a7210b8927 * ShellPkg/ShellLib: Constructor doesn't depend on ShellParameters" resolved the issue when loading dynamic command driver from Shell environment. But when dynamic command driver is built into FV and started during boot, the driver still fails to start because Shell protocol doesn't exist at that time. The patch changes ShellLib to: 1. Do not look for Shell and ShellParameters protocol when they are non-NULL in ShellLibConstructorWorker(); The two protocols are assumed to be set by DynamicCommand.Handler. When ShellInitialize() is called in DynamicCommand.Handler, this change can prevent the two protocols to be changed to NULL by the locating logic. 2. Do not reset the Shell and ShellParameters protocol to NULL in ShellLibDestructor() when CloseProtocol() fails; Dynamic command driver needs to set the PcdShellLibAutoInitialize to FALSE in order to skip the constructor. Current logic calls ShellLibDestructor() when the PCD is FALSE when ShellInitialize() is called. The change prevent the two protocols to be changed to NULL. The two changes don't impact existing usage case so they are backward compatible. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/dp: Convert from NULL class library to Dynamic CommandRuiyu Ni2017-11-2814-2682/+0
| | | | | | | | | | | | | | | | | | | | | | UEFI Shell spec defines Shell Dynamic Command protocol which is just for the purpose to extend internal command. So dp command is changed from NULL class library to be a driver producing DynamicCommand protocol. The guideline is: 1. Only use NULL class library for Shell spec defined commands. 2. New commands can be provided as not only a standalone application but also a dynamic command. So it can be used either as an internal command, but also as a standalone application. DpApp.inf is to provide a standalone application. DpDynamicCommand.inf is to provide a standalone driver producing Dynamic Command protocol. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com>