summaryrefslogtreecommitdiff
path: root/ShellPkg
AgeCommit message (Collapse)AuthorFilesLines
2026-05-08Global: Fix Spelling Errors in PCI/PCIe DefinitionsOliver Smith-Denny1-2/+2
Fix spelling errors in definitions in Pci22.h. Update consumers in MdeModulePkg, OvmfPkg, ShellPkg, and SourceLevelDebugPkg. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2026-05-01ShellPkg/UefiShellLevel3: Lower indentation level in MainCmdXXX()Pierre Gondois8-261/+248
This patch aims to help breaking down the long function present in the ShellPkg and reduce complexity/nested code and conditions. Lower the indentation level in the newly created MainCmdXXX() functions. Some ASSERT() are removed in Help.c as they check variables which were initialized a few lines above. No functional change should be induced by this patch. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-05-01ShellPkg/Help: Extract PrintMatchingHelp() functionPierre Gondois1-76/+99
Extract a PrintMatchingHelp() function in the Help command to help splitting the logic MainCmdHelp() function. No functional change should be induced by this patch. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-05-01ShellPkg/UefiShellLevel3: Extract ProcessFileList() functionPierre Gondois2-66/+121
Extract a ProcessFileList() in: - Touch.c - Type.c to lower the indentation level and simplify the logic. No functional change should be induced by this patch. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-05-01ShellPkg/UefiShellLevel3: Extract MainCmdXXX() functionPierre Gondois9-360/+539
This patch aims to help breaking down the long function present in the ShellPkg and reduce complexity/nested code and conditions. Extract a MainCmdXXX() function for each shell command. This command contains the possible operations the command aims to operate. The ShellCommandRunXXX() function from which it is extracted is only responsible of: - initializing the shell/command environment - parsing the command parameter and creating a Package - freeing the Package No functional change should be induced by this patch. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-05-01ShellPkg/UefiShellLevel3: Return if ShellCommandLineParse() failedPierre Gondois9-525/+543
This patch aims to help breaking down the long function present in the ShellPkg and reduce complexity/nested code and conditions. Return directly if ShellCommandLineParse() returned an error Status. In such case, the "Package" that should be allocated by ShellCommandLineParse() is already freed in: ShellCommandLineParse() \-ShellCommandLineParseEx() \-InternalCommandLineParse() so there is no need to free it with ShellCommandLineFreeVarList(). No functional change should be induced by this patch. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-05-01ShellPkg/Help: Free package on all pathsPierre Gondois1-5/+5
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-05-01ShellPkg/Type: Factorize character displayPierre Gondois1-62/+55
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-05-01ShellPkg/Cls: Factorize color parsingPierre Gondois1-80/+71
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-05-01ShellPkg: Add 'cxl' commandOleksandr Tymoshenko5-0/+613
Add a 'cxl' command to list and query CXL devices. Signed-off-by: Oleksandr Tymoshenko <ovt@google.com>
2026-04-30ShellPkg/UefiShellLevel1: Lower indentation level in MainCmdXXX()Pierre Gondois3-73/+60
This patch aims to help breaking down the long function present in the ShellPkg and reduce complexity/nested code and conditions. Lower the indentation level in the newly created MainCmdXXX() functions. Remove the ShellStatus variable which is not necessary. No functional change should be induced by this patch. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-30ShellPkg/UefiShellLevel1: Extract MainCmdXXX() functionPierre Gondois3-86/+144
This patch aims to help breaking down the long function present in the ShellPkg and reduce complexity/nested code and conditions. Extract a MainCmdXXX() function for each shell command. This command contains the possible operations the command aims to operate. The ShellCommandRunXXX() function from which it is extracted is only responsible of: - initializing the shell/command environment - parsing the command parameter and creating a Package - freeing the Package No functional change should be induced by this patch. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-30ShellPkg/UefiShellLevel1: Return if ShellCommandLineParse() failedPierre Gondois3-72/+78
This patch aims to help breaking down the long function present in the ShellPkg and reduce complexity/nested code and conditions. Return directly if ShellCommandLineParse() returned an error Status. In such case, the "Package" that should be allocated by ShellCommandLineParse() is already freed in: ShellCommandLineParse() \-ShellCommandLineParseEx() \-InternalCommandLineParse() so there is no need to free it with ShellCommandLineFreeVarList(). No functional change should be induced by this patch. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-29ShellPkg/Shell: Remove duplicate Guid in INF fileQihang Gao1-1/+0
In Shell driver, gShellAliasGuid appears twice in [Guids] section, so remove the duplicate one. Signed-off-by: Qihang Gao <gaoqihang@loongson.cn>
2026-04-24ShellPkg/TimeDate: Extract GetTimeZoneFromString() helperPierre Gondois1-39/+57
Extract a GetTimeZoneFromString() function to decrease the size of MainCmdTime(). No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/TimeDate: Extract PrintDaylight() helperPierre Gondois1-16/+31
Extract a PrintDaylight() function to decrease the size of MainCmdTime(). No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/TimeDate: Extract PrintTime() helperPierre Gondois1-51/+39
Extract a PrintTime() function to factorize the code. No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/TimeDate: Extract GetCurrentTime() helperPierre Gondois1-14/+34
Extract a GetCurrentTime() function to factorize error messages. No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/Ls: Extract PrintLsOutputCurr() functionPierre Gondois1-107/+154
Extract a PrintLsOutputCurr() function to decrease the size of PrintLsOutput(). The patch also rationalize the usage of the Found parameter: - Found is updated only when a valid MetaFile is found - a IsRecursive variable is created to distinguish the first PrintLsOutput() call from the other recursive ones. No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/Ls: Lower PrintLsOutputRec() indentation levelPierre Gondois1-32/+36
Invert some conditions in PrintLsOutputRec() to lower the indentation level. No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/Ls: Extract PrintLsOutputRec() functionPierre Gondois1-51/+125
Extract a PrintLsOutputRec() function to decrease the size of PrintLsOutput(). No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/Ls: Remove unused TimeZone parameterPierre Gondois1-13/+0
The TimeZone parameter is not used. Remove it. No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/Ls: Hard-code number of files if none foundPierre Gondois1-1/+1
If no file/directory has been found, the number of files/directories must be 0. Hard-code these values to avoid depending on the FileCount/FileSize/DirCount variables. No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/Ls: Extract GetCorrectedPath() functionPierre Gondois1-39/+56
Extract a GetCorrectedPath() function to decrease the size of PrintLsOutput(). Also free the CorrectedPath in PrintLsOutput() before re-allocating it to prepare for follow-up factorization. No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/Ls: Move FileMetaArg closing logicPierre Gondois1-2/+4
Move ShellCloseFileMetaArg() calls to close the MetaArg whenever its usage is not needed anymore. This prepares for follow-up factorization. No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/Ls: Extract UpdateFileLocalTime() functionPierre Gondois1-24/+41
Extract a UpdateFileLocalTime() function to decrease the size of PrintLsOutput(). No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/Rm: Extract DeleteDirectory() functionPierre Gondois1-76/+107
Extract a DeleteDirectory() function to decrease the size of CascadeDelete(). The extracted logic is slighly modified to lower the indendation level. No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/UefiShellLib: Add IsDotOrDotDot() functionPierre Gondois10-19/+38
Replace existing checks against L"." and L".." by a named function. No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/SerMode: Add ValidDataBits() functionPierre Gondois1-9/+20
Add a ValidDataBits() utility function to check the Data Bits are valid. No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/SerMode: Add GetStopBits() functionPierre Gondois1-24/+51
Add a GetStopBits() utility function to convert the StopBits to the EFI_STOP_BITS_TYPE type. No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/SerMode: Lower indentation level in DisplaySettings()Pierre Gondois1-28/+24
Invert error handling to lower the indentation level in DisplaySettings(). No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/SerMode: Add GetParityType() functionPierre Gondois1-29/+62
Add a GetParityType() utility function to convert the Parity to the EFI_PARITY_TYPE type. No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24ShellPkg/SerMode: Add name conversion arrays for parity/stop bitsPierre Gondois1-61/+36
Add name conversion arrays: - ParityBitName - StopBitsName to seamlessly convert parity/stop bits to a matching name. No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-20ShellPkg/AcpiView: Update MPAM table "MMIO size" field checkAndre Przywara1-2/+2
The "ACPI for Memory System Resource Partitioning and Monitoring" spec (Arm DEN0065, [1]) in version 2.0 described the "MMIO size" field in the "MPAM MSC node" subtable as being always 0 if the the "PCC" interface type is used for that MSC. Version 3.0 of the spec changes that field to convey the enablement status of that MSC: "If set to 1, this MSC is accessible ... If set to 0, this MSC is non-functional...." Relax the strict check for this value being 0 in the acpiview validation checks, to also allow the new value of "1". [1] https://developer.arm.com/documentation/den0065/3-0/ Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2026-04-09ShellPkg/UefiShellDriver1: Remove unused StatusPierre Gondois2-9/+8
Status is set but never used. Remove the variable. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-09ShellPkg/UefiShellDriver1: Flatten some functionsPierre Gondois3-104/+119
Flatten the following functions to make them easier to read: - TraverseHandleDatabase() - GetDeviceHandleInfo() - DoDecodeByProtocol() No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-09ShellPkg/UefiShellDriver1/Drivers: Fix memory leaksPierre Gondois1-0/+3
Free Language/FormatString before exiting the function. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-09ShellPkg/UefiShellDriver1: Lower indentation level in MainCmdXXX()Pierre Gondois6-350/+357
This patch aims to help breaking down the long function present in the ShellPkg and reduce complexity/nested code and conditions. Lower the indentation level in the newly created MainCmdXXX() functions. No functional change should be induced by this patch. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-09ShellPkg/UefiShellDriver1: Extract MainCmdXXX() functionPierre Gondois10-397/+580
This patch aims to help breaking down the long function present in the ShellPkg and reduce complexity/nested code and conditions. Extract a MainCmdXXX() function for each shell command. This command contains the possible operations the command aims to operate. The ShellCommandRunXXX() function from which it is extracted is only responsible of: - initializing the shell/command environment - parsing the command parameter and creating a Package - freeing the Package No functional change should be induced by this patch. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-09ShellPkg/UefiShellDriver1: Return if ShellCommandLineParse() failedPierre Gondois11-823/+837
This patch aims to help breaking down the long function present in the ShellPkg and reduce complexity/nested code and conditions. Return directly if ShellCommandLineParse() returned an error Status. In such case, the "Package" that should be allocated by ShellCommandLineParse() is already freed in: ShellCommandLineParse() \-ShellCommandLineParseEx() \-InternalCommandLineParse() so there is no need to free it with ShellCommandLineFreeVarList(). No functional change should be induced by this patch. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-09ShellPkg/UefiShellDriver1: Fix memory leaksPierre Gondois3-0/+6
Package must be freed before exiting. Free the pointer. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-09ShellPkg/AcpiView: Avoid mutating HEST hardware bank count during parseGaurav Pandya1-5/+4
Remove post-parse write to mHestIA32HardwareBankCount. Keep HEST parsing read-only. *mHestIA32HardwareBankCount = 0, line in code corrupts the ACPI HEST table data Hardware bank count to zero. mHestIA32HardwareBankCount points into the parsed HEST table data (input buffer). Writing through it modifies ACPI table contents during parsing, which should be read-only behavior. Signed-off-by: Gaurav Pandya <Gaurav.Pandya@amd.com>
2026-03-26ShellPkg/UefiHandleParsingLib: support handle list growthBob Morgan1-33/+31
Refactor GetHandleListByProtocol() to support additions to the handle list during its execution. Replace LocateHandle() with LocateHandleBuffer() to avoid the possibility that the buffer allocated for LocateHandle() is too small if additional handles are added during GetHandleListByProtocol() execution. Note that the previous implementation did not detect the handle list growth and would cause memory corruption when writing the terminating NULL handle to the allocated buffer. Signed-off-by: Bob Morgan <bobm@nvidia.com>
2026-03-07ShellPkg/SmbiosView: Fix clang compatibility issueMichael D Kinney1-0/+2
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2026-03-06ShellPkg/SmbiosView: Support print Protocol Records of SMBIOS type42Yang Gang1-0/+39
SmbiosView tool changes for Protocol Records info decode and print. This commit adds the following decoding functionality: First, it prints the `MCHostInterfaceProtocol Number`, then print the `ProtocolType` with the prefix #x(0 based index), and finally dump `ProtocolTypeData` as hex. Signed-off-by: Yang Gang <yanggang@byosoft.com.cn>
2026-03-02ShellPkg: fix UNI string formatting and line endings to match UNI SpecAlexander Gryanko2-7/+7
Changes include: * Added missing \r\n line endings inside string literals * Fixed inconsistent indentation in multi-line string entries * Removed duplicated #language en-US directive * Aligned string formatting to match the UNI specification Updated files: ShellPkg/DynamicCommand/HttpDynamicCommand/Http.uni ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni The issues were identified during testing of the parser https://github.com/xpahos/edk2-idea. Signed-off-by: Alexander Gryanko <xpahos@gmail.com>
2026-03-02ShellPkg: align UNI file headers with UNI Spec standardAlexander Gryanko1-16/+16
The Uni file standard specifies that comments begin with the characters "//". The following files contained incorrectly formatted C-style comments and have been updated: ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.uni The problems were identified during testing of the parser https://github.com/xpahos/edk2-idea. Signed-off-by: Alexander Gryanko <xpahos@gmail.com>
2026-02-25ShellPkg/SmbiosView: Add Type45 entry to query tableWerner Lewis1-0/+5
The type field for Smbios tables in smbiosview is set from values in this query table. An entry is added to correctly display the Type 45 table name rather than "Undefined Value" in smbiosview output. Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
2026-02-24ShellPkg: Replace include guards with #pragma onceMichael Kubacki74-296/+74
Replace traditional `#ifndef`/`#define`/`#endif` include guards with `#pragma` once. `#pragma once` is a widely supported preprocessor directive that prevents header files from being included multiple times. It is supported by all toolchains used to build edk2: GCC, Clang/LLVM, and MSVC. Compared to macro-based include guards, `#pragma once`: - Eliminates the risk of macro name collisions or copy/paste errors where two headers inadvertently use the same guard macro. - Eliminate inconsistency in the way include guard macros are named (e.g., some files use `__FILE_H__`, others use `FILE_H_`, etc.). - Reduces boilerplate (three lines replaced by one). - Avoids polluting the macro namespace with guard symbols. - Can improve build times as the preprocessor can skip re-opening the file entirely, rather than re-reading it to find the matching `#endif` ("multiple-include optimization"). - Note that some compilers may already optimize traditional include guards, by recognzining the idiomatic pattern. This change is made acknowledging that overall portability of the code will technically be reduced, as `#pragma once` is not part of the C/C++ standards. However, this is considered acceptable given: 1. edk2 already defines a subset of supported compilers in BaseTools/Conf/tools_def.template, all of which have supported `#pragma once` for over two decades. 2. There have been concerns raised to the project about inconsistent include guard naming and potential macro collisions. Approximate compiler support dates: - MSVC: Supported since Visual C++ 4.2 (1996) - GCC: Supported since 3.4 (2004) (http://gnu.ist.utl.pt/software/gcc/gcc-3.4/changes.html) - Clang (LLVM based): Since initial release in 2007 Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2026-02-04ShellPkg: SMBIOS type 20 Extended Starting/Ending Address print type errorRen Yang (楊壹任)1-2/+2
Wrong structure is used to print the SMBIOS type 20 Extended Starting/Ending Address in SmbiosView Signed-off-by: Ren Yang <RenYang@ami.com>