summaryrefslogtreecommitdiff
path: root/ShellPkg
AgeCommit message (Collapse)AuthorFilesLines
2026-07-18ShellPkg/Pci: Restore BAR informationsVincent Gatine1-0/+16
Restore informations lost in the pci shell command. sbsa-ref Host Bridge: ``` Cache Line Size(C): 00 Latency Timer(D): 00 Header Type(0E): 00, Single function, PCI device Class: Bridge Device - Host/PCI bridge - +Base Address Registers(10): + (None) +Expansion ROM Disabled(30) + +Cardbus CIS ptr(28): 00000000 +Sub VendorID(2C): 1AF4 Subsystem ID(2E): 1100 +Capabilities Ptr(34): 00 +Interrupt Line(3C): FF Interrupt Pin(3D): 00 +Min_Gnt(3E): 00 Max_Lat(3F): 00 ``` sbsa-ref Ethernet Controller: ``` Cache Line Size(C): 00 Latency Timer(D): 00 Header Type(0E): 00, Single function, PCI device Class: Network Controller - Ethernet controller - +Base Address Registers(10): + Start_Address Type Space Prefetchable? Size Limit + -------------------------------------------------------------------------- + 81060000 Mem 32 bits No 00020000 8107FFFF + 81040000 Mem 32 bits No 00020000 8105FFFF + 0000 I/O 0020 001F + 81080000 Mem 32 bits No 00004000 81083FFF + -------------------------------------------------------------------------- +Expansion ROM Disabled(30) + +Cardbus CIS ptr(28): 00000000 +Sub VendorID(2C): 8086 Subsystem ID(2E): 0000 +Capabilities Ptr(34): C8 +Interrupt Line(3C): FF Interrupt Pin(3D): 01 +Min_Gnt(3E): 00 Max_Lat(3F): 00 Pci Express device capability structure: CapID( 0): 10 NextCap Ptr( 1): A0 ``` Signed-off-by: Vincent Gatine <vincent.gatine@sipearl.com>
2026-07-03ShellPkg/AcpiView: Add parser for CCEL ACPI tableSami Mujawar4-0/+148
The ACPI 6.5 specification introduces the CCEL (CC Event Log) table in section 5.2.34: https://uefi.org/specs/ACPI/6.5/ 05_ACPI_Software_Programming_Model.html#cc-event-log-acpi-table Extend AcpiView with a parser to decode and display CCEL table contents. This allows users to inspect CCEL tables from the UEFI Shell. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
2026-07-03ShellPkg/Acpiview: Make reserved-field validation commonSami Mujawar5-111/+83
Move the reserved-field validators from MpamParser.c into AcpiParser.c and expose them through AcpiParser.h so they can be reused by multiple Acpiview parsers. Update the AGDI, MPAM and WSMT parsers to use the common helpers for byte-length and bit-length reserved fields. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
2026-07-03ShellPkg/Acpiview: Increase the max supported parsersSami Mujawar1-1/+1
The RegisterParser() function is failing with error code EFI_OUT_OF_RESOURCES as we have run out of space for registering the ACPI table parsers in mTableParserList[]. Therefore, increase the MAX_ACPI_TABLE_PARSERS to 128. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
2026-07-02ShellPkg: Add missing smbiosview Type 28 locationsVarshitPandya1-0/+16
Add the missing SMBIOS Type 28 Temperature Probe location decode values to smbiosview. The Type 28 Location field defines values 0x0C through 0x0F for Front Panel Board, Back Panel Board, Power System Board, and Drive Back Plane, but smbiosview only decoded values up to 0x0B. Signed-off-by: VarshitPandya <varshit.pandya@arm.com>
2026-07-02ShellPkg: Fix smbiosview Type 26 location/status decodeVarshitPandya1-27/+27
The smbiosview Type 26 Voltage Probe decoder uses the low 5 bits of LocationAndStatus as the probe location and the high 3 bits as the probe status. However, the Type 26 lookup tables were swapped: VPLocationTable contained status strings and VPStatusTable contained location strings. This caused valid records to be displayed as, for example: Voltage Probe - Location: OK Voltage Probe - Status: Processor Swap the table contents so Type 26 output matches the SMBIOS LocationAndStatus bit layout. Signed-off-by: VarshitPandya <varshit.pandya@arm.com>
2026-07-01ShellPkg: Add null pointer checks before dereferenceQihang Gao1-6/+33
In AllocateMemory(), several pointers are used without prior null checks. This may lead to unexpected behavior or system crashes if any of these pointers are NULL. Add explicit null checks for these pointers to ensure safe access and prevent potential null pointer dereferences. Signed-off-by: Qihang Gao <gaoqihang@loongson.cn>
2026-06-29ShellPkg: ShellPkg: Fix SMBIOS Type 28 probe labelsVarshitPandya2-3/+5
Use a Temperature Probe specific HII string when displaying the Type 28 Location field in smbiosview. The Type 28 decoder was using the Voltage Probe location label, causing temperature probe records to be displayed with the wrong field name. Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
2026-06-29ShellPkg: Fix SMBIOS Type 26 probe decodingVarshitPandya1-3/+3
Decode the Type 26 Voltage Probe Location and Status fields according to the SMBIOS 3.9.0 specification, section 7.27, "Voltage Probe (Type 26)". Table 95, "Voltage Probe: Location and Status fields", defines bits 4:0 as the Location field and bits 7:5 as the Status field. smbiosview was decoding these fields in the opposite order, causing the displayed voltage probe location and status to be swapped. Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
2026-06-21ShellPkg: Fix the issue that the UEFI Shell layout is messed upQihang Gao1-2/+2
Fixes https://github.com/tianocore/edk2/issues/12689 When the UEFI Shell mapping table is empty (NULL), the console layout becomes corrupted in DEBUG builds. This occurs because the cursor position for the message map: No mapping found. is computed incorrectly under DEBUG mode. The presence of DEBUG output from the Shell driver causes gST->ConOut->Mode->CursorRow to no longer reflect the actual cursor position on the serial port, leading to misplacement of subsequent output. This patch replaces the existing print routine with ShellPrintHiiDefaultEx(). The new function automatically calculates the correct cursor position for the "No mapping found" line, eliminating the dependency on the stale CursorRow value. As a result, the layout remains consistent regardless of DEBUG message activity. Signed-off-by: Qihang Gao <gaoqihang@loongson.cn>
2026-06-09ShellPkg: Replace manual alignment checks with helper macrosMingjie Shen1-1/+1
Replace manual alignment checks with IS_ALIGNED() and ADDRESS_IS_ALIGNED(). Convert the following bitmask and modulo forms: - ((E & ((PowOf2Expr) - ONE)) == ZERO) - ((E & ((PowOf2Expr) - ONE)) != ZERO) - ((E % (PowOf2Expr)) == ZERO) - ((E % (PowOf2Expr)) != ZERO) to the corresponding helper macro forms: + IS_ALIGNED (E, PowOf2Expr) + !IS_ALIGNED (E, PowOf2Expr) PowOf2Expr is limited to known power-of-two expressions, including SIZE_* and BASE_* macros, EFI_PAGE_SIZE, CPU_STACK_ALIGNMENT, RUNTIME_PAGE_ALLOCATION_GRANULARITY, sizeof() of UEFI integer types (e.g. BOOLEAN, CHAR16, UINT32, UINTN) and pointer types, and 1 << E1 expressions. Address checks that cast the checked value to UINTN are written with ADDRESS_IS_ALIGNED(). The change was generated with the Coccinelle semantic patch below. ```smpl @power_of_2_expr@ expression PowOf2Expr; expression E1; typedef BOOLEAN, CHAR8, CHAR16, INT8, UINT8, INT16, UINT16, INT32, UINT32, INT64, UINT64, INTN, UINTN; type ScalarType = { BOOLEAN, CHAR8, CHAR16, INT8, UINT8, INT16, UINT16, INT32, UINT32, INT64, UINT64, INTN, UINTN }; type AnyType; type PointerType = AnyType *; idexpression ScalarType ScalarValue; idexpression PointerType PointerValue; constant SizeBase =~ "^(SIZE|BASE)_(1|2|4|8|16|32|64|128|256|512)[KMGTPE]B$"; constant NamedPowerOf2 =~ "^(EFI_PAGE_SIZE|CPU_STACK_ALIGNMENT|RUNTIME_PAGE_ALLOCATION_GRANULARITY)$"; constant ONE = {1, 1U, 1u}; @@ ( ( SizeBase | NamedPowerOf2 | ONE << E1 | sizeof (ScalarType) | sizeof (PointerType) | sizeof (ScalarValue) | sizeof (PointerValue) ) & PowOf2Expr ) @aligned depends on power_of_2_expr disable is_zero,isnt_zero@ expression E; expression power_of_2_expr.PowOf2Expr; constant ONE = {1, 1U, 1u}; constant ZERO = {0, 0U, 0u}; @@ ( ((E & (E - ONE)) == ZERO) | - ((E & ((PowOf2Expr) - ONE)) == ZERO) + IS_ALIGNED (E, PowOf2Expr) | ((E & (E - ONE)) != ZERO) | - ((E & ((PowOf2Expr) - ONE)) != ZERO) + !IS_ALIGNED (E, PowOf2Expr) | - ((E % (PowOf2Expr)) == ZERO) + IS_ALIGNED (E, PowOf2Expr) | - ((E % (PowOf2Expr)) != ZERO) + !IS_ALIGNED (E, PowOf2Expr) ) @address_is_aligned@ typedef UINTN; expression *Address; expression Alignment; @@ - IS_ALIGNED ((UINTN) Address, Alignment) + ADDRESS_IS_ALIGNED (Address, Alignment) @normalize_aligned disable paren expression@ expression E, SZ; @@ ( - (IS_ALIGNED (E, SZ)) + IS_ALIGNED (E, SZ) | - (!IS_ALIGNED (E, SZ)) + !IS_ALIGNED (E, SZ) ) @normalize_macro_args disable paren expression@ expression E, SZ; @@ ( - IS_ALIGNED ((E), SZ) + IS_ALIGNED (E, SZ) | - IS_ALIGNED (E, (SZ)) + IS_ALIGNED (E, SZ) ) ``` Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2026-06-09ShellPkg: Remove improper Depex section in UEFI_APPLICATIONQihang Gao1-3/+0
According to INF specification, UEFI_APPLICATION cannot have Depex section. So remove it. Signed-off-by: Qihang Gao <gaoqihang@loongson.cn>
2026-06-03ShellPkg/Acpiview: Refactor EINJ table parser validationSimon Wang1-1/+3
ACPI defines Injection Header Size as the length of the EINJ injection header, not necessarily the absolute offset of the instruction entries. Update parser validation to use the correct entry offset calculation and accept the layout used by Linux and existing firmware tables. Signed-off-by: Simon Wang <simowang@nvidia.com>
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>