summaryrefslogtreecommitdiff
path: root/ShellPkg
AgeCommit message (Collapse)AuthorFilesLines
2018-03-01ShellPkg/UefiShellDebug1CommandsLib: remove I/O address limit from 'mm'Ard Biesheuvel2-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>
2018-02-23ShellPkg/Ping: fix loss of first packetMeenakshi Aggarwal1-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>
2018-02-15ShellPkg/ShellLib: Fix a bug in InternalShellIsHexOrDecimalNumberRuiyu Ni1-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>
2018-02-15ShellPkg/[hex]edit: Fix CTRL+<Alpha> doesn't work from hyper terminalRuiyu Ni3-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>
2018-02-13ShellPkg: remove superfluous TimerLib resolutionLaszlo Ersek1-1/+0
TimerLib had to be resolved in commit 5ab97a64b51c ("ShellPkg/bcfg: Add Shell Spec 2.2 modification functionality", 2017-03-01) because: - the BCFG command started making calls to UefiBootManagerLib (EfiBootManagerVariableToLoadOption(), EfiBootManagerLoadOptionToVariable(), EfiBootManagerFreeLoadOption()), - and "MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf" depended on TimerLib. Because TimerLib is platform-specific, but "ShellPkg/ShellPkg.dsc" is meant to produce a UEFI shell binary that is platform-independent (see "ShellBinPkg/ReadMe.txt"), we resolved TimerLib to "BaseTimerLibNullTemplate.inf". (TimerLib functionality was never actually needed on UefiBootManagerLib code paths that were exercised by the shell / BCFG.) Thanks to the last patch, UefiBootManagerLib no longer depends on TimerLib, thus we can drop the TimerLib resolution entirely. Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
2018-02-13ShellPkg/[hex]edit: Fix wrongly use gST->ConIn as the console handleRuiyu Ni2-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>
2018-02-13ShellPkg/[hex]edit: use SimpleTextInEx to read consoleRuiyu Ni8-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>
2018-02-13ShellPkg/help: Fix "-?" may not show manual sometimesRuiyu Ni2-254/+73
Shell core was enhanced to find the manual string in PE resource section. But the finding algorithm is too strict: If the manual is written beginning with: .TH command 0 "descripton of command" but user types "COMMAND.efi -?". The finding algorithm uses case-sensitive compare between "command" and "COMMAND" resulting in the manual cannot be found. The patch fixes this issue by using existing ManFileFindTitleSection and ManFileFindSections which compare command case-insensitive. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
2018-02-09ShellPkg/DP: Update the error message infoDandan Bi2-2/+4
Make the error message clearer if fail to get ACPI/FPDT table. Cc: Liming Gao <liming.gao@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-09ShellPkg/Dp: Add null pointer checkBi, Dandan1-1/+1
Cc: Liming Gao <liming.gao@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-09ShellPkg/rm: fix hang when deleting an absolutely-empty directoryRuiyu Ni1-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>
2018-02-09ShellPkg/hexedit: Fix a read-after-free bugRuiyu Ni2-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>
2018-02-08ShellPkg/UefiShellDebug1CommandsLib: sync Compress() definition with decl.Laszlo Ersek2-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>
2018-02-08ShellPkg/Dp: Updated to dump perf log based on FPDT tableDandan Bi11-127/+724
Cc: Liming Gao <liming.gao@intel.com> Cc: Star Zeng <star.zeng@intel.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: Liming Gao <liming.gao@intel.com>
2018-02-06ShellPkg/map: Fix out-of-bound read when "map fsn"Ruiyu Ni1-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>
2018-02-06ShellPkg/for: Fix potential null pointer deferenceRuiyu Ni1-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>
2018-01-29ShellPkg/Level2Command: Use UnicodeCollation in StrinCmpRuiyu Ni5-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>
2018-01-29ShellPkg/CommandLib: Locate proper UnicodeCollation instanceRuiyu Ni2-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.
2018-01-26ShellPkg: Update package version from 1.01 to 1.02Ruiyu Ni2-4/+4
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: Ruiyu Ni <ruiyu.ni@intel.com>
2018-01-25ShellPkg/UefiShellLevel3CommandsLib: fix string over-readJian J Wang1-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>
2018-01-08ShellPkg/UefiShellLevel2CommandsLib: add missing EFIAPI call conv specLaszlo Ersek1-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>
2017-12-18ShellPkg: Fix a build error in Ping6 shell command.fanwang21-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>
2017-12-18ShellPkg: Update Api from NetLibDetectMedia to NetLibDetectMediaWaitTimeout.fanwang23-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>
2017-12-02ShellPkg/ShellPkg.dec: Change comments for PcdShellLibAutoInitializeRuiyu Ni1-0/+1
When Dynamic command drivers links to ShellLib, the ShellLib constructor shouldn't be called because the Shell and ShellParameters protocols don't exist when the driver starts. So it's required to set PcdShellLibAutoInitialize to FALSE for dynamic command drivers. Update the comments in DEC file to describe such requirement for this PCD. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
2017-11-29ShellPkg/tftp: Correct file comments header of Tftp.uniRuiyu Ni1-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>
2017-11-29ShellPkg/DynamicCommand: Fix bug that cannot start in bootRuiyu Ni3-1/+8
When dynamic command drivers are built into FV and start during boot, they fails. Because Shell protocol doesn't exist during boot. The patch sets Shell protocol and also set PcdShellLibAutoInitialize to FALSE to ensure that 1. Shell protocol check doesn't happen in driver's entry point. 2. Driver can get the Shell protocol in DynamicCommand.Handler(). Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
2017-11-29ShellPkg/ShellLib: Fix dynamic command fails to start during bootRuiyu Ni1-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>
2017-11-29ShellPkg: Fix the bug that handling Ctrl-C improperlyRuiyu Ni1-6/+6
Current implementation resets the CTRL-C event early when printing the shell prompt, when user types "<CTRL-C>ls<ENTER>", "ls" command is terminated immediately when starts. It's not an expected behavior from users' perspective. Correct way is to reset the CTRL-C event just before running the command, which is a bit later than current point. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
2017-11-28ShellPkg/dp: Convert from NULL class library to Dynamic CommandRuiyu Ni19-415/+605
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>
2017-11-28ShellPkg/tftp: Convert from NULL class library to Dynamic CommandRuiyu Ni9-155/+368
UEFI Shell spec defines Shell Dynamic Command protocol which is just for the purpose to extend internal command. So tftp 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. TftpApp.inf is to provide a standalone application. TftpDynamicCommand.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>
2017-11-28ShellPkg/ShellLib: Constructor doesn't depend on ShellParametersRuiyu Ni1-4/+8
When ShellLib is linked to a driver producing DynamicCommand protocol, ShellParameters protocol is set by DynamicCommand.Handler(). The driver image handle doesn't have ShellParameters protocol installed. 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>
2017-11-16ShellPkg: Add error message if failed to place receive token in ping command.Fu Siyuan4-4/+16
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com>
2017-11-15ShellPkg/Shell: Check the OpenVolume result in OpenRootByHandle()Hao Wu1-2/+7
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=779 For the API EfiShellOpenRootByHandle(): The return status of the call to SimpleFileSystem->OpenVolume should be checked. It is possible that there is a media change in the device (like CD/DVD ROM). In such case, the volume root opened and/or the device path opened previously (also within EfiShellOpenRootByHandle) may be invalid. This commit adds a check for the result of OpenVolume before subsequently calling functions like EfiShellGetMapFromDevicePath() & ConvertEfiFileProtocolToShellHandle(). Cc: Jaben Carsey <jaben.carsey@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
2017-11-14ShellPkg: Fix MSFT C4255 warningSong, BinX3-0/+4
V2: Fix MSFT C4255 warning V1: Enable MSFT C4255 warning. From MSDN: Compiler Warning (level 4) C4255 function' : no function prototype given: converting '()' to '(void)' The compiler did not find an explicit list of arguments to a function. This warning is for the C compiler only. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Bell Song <binx.song@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
2017-11-08ShellPkg: Fix misuses of AllocateCopyPoolJian J Wang2-3/+8
AllocateCopyPool(AllocationSize, *Buffer) will copy "AllocationSize" bytes of memory from old "Buffer" to new allocated one. If "AllocationSize" is bigger than size of "Buffer", heap memory overflow occurs during copy. One solution is to allocate pool first then copy the necessary bytes to new memory. Another is using ReallocatePool instead if old buffer will be freed on spot. Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Bi Dandan <dandan.bi@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>
2017-11-08ShellPkg/dh: Fix wrong output when dumping PciRootBridgeIoRuiyu Ni1-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>
2017-11-07ShellPkg/HexEdit: Fix EBC build failureRuiyu Ni1-2/+2
EfiCpuIoWidthUint8 should be used in HMemImageRead and HMemImageSave. Because CpuIo protocol is now used for memory access. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
2017-11-02ShellPkg/hexeditor: Use CpuIo for memory accessRuiyu Ni2-68/+6
The original code uses PciRootBridgeIo for memory access. It worked before MdeModulePkg/PciHostBridgeDxe driver was checked in. But MdeModulePkg/PciHostBridgeDxe adds checks to ensure the MMIO access request is in the scope of the current RootBridgeIo instance. It causes "hexeditor -m 0 2" reports error because memory address 0 surely is not in the scope of any RootBridgeIo instance. In fact only accessing the MMIO space occupied by the RootBridgeIo can work. The patch changes hexeditor to use CpuIo for memory access. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
2017-10-26Shellpkg/editor: Fix a bug that may modifies Line[-1]Ruiyu Ni1-1/+1
The original code as below intend to set the character before last column to CHAR_NULL. Line[(LastCol % (ARRAY_SIZE (Line) - 1)) - 1] = CHAR_NULL; But when LastCol % (ARRAY_SIZE (Line) - 1)) equals to 0, Line[-1] is modified. We should change to code as below: Line[(LastCol - 1) % (ARRAY_SIZE (Line) - 1)] = CHAR_NULL; 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: Hao A Wu <hao.a.wu@intel.com>
2017-10-25ShellPkg/HandleParsingLib: Remove unnecessary CatSPrint callRuiyu Ni1-3/+1
Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
2017-10-24TFTP : tftp fix for full volume caseMeenakshi Aggarwal1-1/+4
Issue : When storage media is full, tftp was resulting in ASSERT MdeModulePkg/Core/Dxe/Mem/Page.c, because number of pages was zero. Reason: While doing tftp, function call ShellWriteFile was modifying FileSize variable. In case of full disk it was coming out to be Zero. Fix: Storage the original filesize in local variable, and use this variable while freeing the pages. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Udit Kumar <udit.kumar@nxp.com> Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com> Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
2017-10-23ShellPkg/editor: Fix system hang when console max column > 200Ruiyu Ni1-12/+19
EditorClearLine() assumes the console max column is less than 200. When the max column is bigger than 200, the code incorrectly modifies the content out side of Line buffer. It may cause system hang or reset. The patch changes the function to print several times when the max column is bigger than 200. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
2017-10-20ShellPkg/alias: Fix flag parsing logicHuajing Li1-65/+145
Existing logic to parse the flags isn't complete and cannot detect some invalid combinations of flags. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
2017-10-17ShellPkg/UefiShellLib: Use a more bright blue/green colorRuiyu Ni1-2/+2
Some developers/QAs complain the color of directory or executable files is hard to see and suggest to use a more bright color. I agree with this suggestion so make this patch. The look and feel is much better now. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
2017-10-13Ifconfig : Fixed False information about Media State.Meenakshi Aggarwal1-4/+7
Issue : We were setting MediaPresent as TRUE (default) and not checking return status of NetLibDetectMedia(). NetLibDetectMedia() sets MediaPresent FLAG in case of success only and dont change flag on error. So, Media State will display as 'Media Present', in case of error also. Fix : Check return value of NetLibDetectMedia(), if error then print "Media State Unknown" Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
2017-10-10ShellPkg: Update Guid usage in ShellLib INF to match source code logicLiming Gao1-1/+1
Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
2017-09-29ShellPkg/disconnect: '-r' is not optional when disconnecting allRuiyu Ni1-1/+1
Correct the help message to match that defined in Shell spec. In 'DISCONNECT -r [-nc]' case, '-r' is not optional. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
2017-09-29ShellPkg/dh: Correct typo in helpRuiyu Ni1-2/+2
Help message of "dh" gives an example to display all handles with "Image" protocol but actually "LoadedImage" protocol should be used. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
2017-09-29ShellPkg/Dh: Refine variable naming styleDandan Bi1-3/+3
Avoid using only lower-case characters for variable name. 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: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
2017-09-29ShellPkg/dh: Add the 'dh' dump support for Partition Info protocolHao Wu3-1/+89
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=655 V2 change: Put some strings into the UNI file for localization. The dump information will include: a. The type of the partition (Mbr, Gpt or Other); b. Whether the partition is an EFI System Partition. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>