Commit graph

1211 commits

Author SHA1 Message Date
Pierre Gondois
cb7f7262d5 ShellPkg/Mm: Remove unnecessary goto
If ShellCommandLineParse() fails, there is no need to free:
- InputStr
- Package
Remove the goto statement.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-08-04 10:35:35 +03:00
Pierre Gondois
adad73339d ShellPkg/ShellDebug1: Rationalize Package init/free
Package is sometimes initialized to NULL and only
freed if not NULL. Remove these as:
- Package is initialized in ShellCommandLineParse().
- If ShellCommandLineFreeVarList() is reached,
  Package cannot be NULL.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-08-04 10:35:35 +03:00
Pierre Gondois
c827978910 ShellPkg/LoadPciRom: Fix memory leak
Package is never freed.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-08-04 10:35:35 +03:00
Pierre Gondois
6dea226953 ShellPkg/UefiShellDebug1: Return if ShellCommandLineParse() failed (4/4)
This patch aims to help breaking down the long functions 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().

To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- SerMode.c
- SetSize.c
- SetVar.c
- SmbiosView/SmbiosView.c

No functional change should be induced by this patch.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-08-04 10:35:35 +03:00
Pierre Gondois
da181122b1 ShellPkg/UefiShellDebug1: Return if ShellCommandLineParse() failed (3/4)
This patch aims to help breaking down the long functions 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().

To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- MemMap.c
- Mm.c
- Mode.c
- Pci.c

No functional change should be induced by this patch.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-08-04 10:35:35 +03:00
Pierre Gondois
d23559e847 ShellPkg/UefiShellDebug1: Return if ShellCommandLineParse() failed (2/4)
This patch aims to help breaking down the long functions 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().

To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- Edit/Edit.c
- EfiCompress.c
- EfiDecompress.c
- HexEdit/HexEdit.c
- LoadPciRom.c

No functional change should be induced by this patch.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-08-04 10:35:35 +03:00
Pierre Gondois
7ee84dc437 ShellPkg/UefiShellDebug1: Return if ShellCommandLineParse() failed (1/4)
This patch aims to help breaking down the long functions 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().

To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- Comp.c
- Cxl.c
- Dblk.c
- Dmem.c
- DmpStore.c

No functional change should be induced by this patch.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-08-04 10:35:35 +03:00
Pierre Gondois
4e1e739338 ShellPkg/Ls: Remove double-free calls
Package is always freed in ShellCommandRunLs().
Remove calls to ShellCommandLineFreeVarList() in MainCmdLs().

This double-free was introduced in:
commit 531b0aa002 ("ShellPkg/UefiShellLevel2:
Extract MainCmdXXX() function")

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-08-04 10:35:35 +03:00
Pierre Gondois
a3da9cde61 ShellPkg/Edit: Remove unused code snippet
The commented out code snippet seems to try to create a new file
with the user input filename. FileBufferRead() seems to have replaced
this code snippet in a better wrapper:
- if the file exists, open it
- otherwise, create the file

Remove the commented-out code snippet.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-08-04 10:35:35 +03:00
Vincent Gatine
21b358b81d ShellPkg/Pci: Restore BAR informations
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-17 22:58:58 +00:00
Sami Mujawar
a70c872966 ShellPkg/AcpiView: Add parser for CCEL ACPI table
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-03 12:24:39 +00:00
Sami Mujawar
f47d5291b9 ShellPkg/Acpiview: Make reserved-field validation common
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-03 12:24:39 +00:00
Sami Mujawar
ec44a71ba7 ShellPkg/Acpiview: Increase the max supported parsers
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-03 12:24:39 +00:00
VarshitPandya
c362e91e56 ShellPkg: Add missing smbiosview Type 28 locations
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-02 07:22:54 +00:00
VarshitPandya
7bc6629f40 ShellPkg: Fix smbiosview Type 26 location/status decode
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-02 07:22:54 +00:00
Qihang Gao
8dab052c57 ShellPkg: Add null pointer checks before dereference
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-07-01 12:10:28 +00:00
VarshitPandya
4ad28a8588 ShellPkg: ShellPkg: Fix SMBIOS Type 28 probe labels
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-29 17:19:33 +00:00
VarshitPandya
39d8052bc6 ShellPkg: Fix SMBIOS Type 26 probe decoding
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-29 17:19:33 +00:00
Qihang Gao
70741a15d9 ShellPkg: Fix the issue that the UEFI Shell layout is messed up
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-21 16:49:02 +00:00
Mingjie Shen
018240c278 ShellPkg: Replace manual alignment checks with helper macros
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-09 07:20:10 +00:00
Simon Wang
2816ff0ab0 ShellPkg/Acpiview: Refactor EINJ table parser validation
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-06-03 06:16:13 +00:00
Oliver Smith-Denny
bf5ed9cc55 Global: Fix Spelling Errors in PCI/PCIe Definitions
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-08 02:15:34 +00:00
Pierre Gondois
f1f89f454c ShellPkg/UefiShellLevel3: Lower indentation level in MainCmdXXX()
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-01 12:16:07 +00:00
Pierre Gondois
8b5c970c55 ShellPkg/Help: Extract PrintMatchingHelp() function
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-01 12:16:07 +00:00
Pierre Gondois
27c785b0df ShellPkg/UefiShellLevel3: Extract ProcessFileList() function
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-01 12:16:07 +00:00
Pierre Gondois
014d8fb941 ShellPkg/UefiShellLevel3: Extract MainCmdXXX() function
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-01 12:16:07 +00:00
Pierre Gondois
49ba46ec0a ShellPkg/UefiShellLevel3: Return if ShellCommandLineParse() failed
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-01 12:16:07 +00:00
Pierre Gondois
a219f8cfc5 ShellPkg/Help: Free package on all paths
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-05-01 12:16:07 +00:00
Pierre Gondois
899b8b8550 ShellPkg/Type: Factorize character display
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-05-01 12:16:07 +00:00
Pierre Gondois
680ee2e3e9 ShellPkg/Cls: Factorize color parsing
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-05-01 12:16:07 +00:00
Oleksandr Tymoshenko
68662fd712 ShellPkg: Add 'cxl' command
Add a 'cxl' command to list and query CXL devices.

Signed-off-by: Oleksandr Tymoshenko <ovt@google.com>
2026-05-01 08:48:04 +02:00
Pierre Gondois
c801f959bb ShellPkg/UefiShellLevel1: Lower indentation level in MainCmdXXX()
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-30 12:14:33 +00:00
Pierre Gondois
c50e5fe946 ShellPkg/UefiShellLevel1: Extract MainCmdXXX() function
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-30 12:14:33 +00:00
Pierre Gondois
e8036a9fbb ShellPkg/UefiShellLevel1: Return if ShellCommandLineParse() failed
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-30 12:14:33 +00:00
Pierre Gondois
12e26dc213 ShellPkg/TimeDate: Extract GetTimeZoneFromString() helper
Extract a GetTimeZoneFromString() function to decrease the
size of MainCmdTime().

No functional change.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24 18:18:47 +00:00
Pierre Gondois
c062ff8487 ShellPkg/TimeDate: Extract PrintDaylight() helper
Extract a PrintDaylight() function to decrease the
size of MainCmdTime().

No functional change.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24 18:18:47 +00:00
Pierre Gondois
a366d6f8fe ShellPkg/TimeDate: Extract PrintTime() helper
Extract a PrintTime() function to factorize the code.

No functional change.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24 18:18:47 +00:00
Pierre Gondois
0f69afa295 ShellPkg/TimeDate: Extract GetCurrentTime() helper
Extract a GetCurrentTime() function to factorize error
messages.

No functional change.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24 18:18:47 +00:00
Pierre Gondois
be6ce32cd0 ShellPkg/Ls: Extract PrintLsOutputCurr() function
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-24 18:18:47 +00:00
Pierre Gondois
636761d3ca ShellPkg/Ls: Lower PrintLsOutputRec() indentation level
Invert some conditions in PrintLsOutputRec() to lower
the indentation level.

No functional change.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24 18:18:47 +00:00
Pierre Gondois
da54ab306a ShellPkg/Ls: Extract PrintLsOutputRec() function
Extract a PrintLsOutputRec() function to decrease
the size of PrintLsOutput().

No functional change.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24 18:18:47 +00:00
Pierre Gondois
08bc059570 ShellPkg/Ls: Remove unused TimeZone parameter
The TimeZone parameter is not used. Remove it.

No functional change.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24 18:18:47 +00:00
Pierre Gondois
78b550f43d ShellPkg/Ls: Hard-code number of files if none found
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-24 18:18:47 +00:00
Pierre Gondois
273edd9e01 ShellPkg/Ls: Extract GetCorrectedPath() function
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-24 18:18:47 +00:00
Pierre Gondois
9171edd4d4 ShellPkg/Ls: Move FileMetaArg closing logic
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-24 18:18:47 +00:00
Pierre Gondois
c45e930ad5 ShellPkg/Ls: Extract UpdateFileLocalTime() function
Extract a UpdateFileLocalTime() function to decrease
the size of PrintLsOutput().

No functional change.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24 18:18:47 +00:00
Pierre Gondois
6829285f88 ShellPkg/Rm: Extract DeleteDirectory() function
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-24 18:18:47 +00:00
Pierre Gondois
420dab0b24 ShellPkg/UefiShellLib: Add IsDotOrDotDot() function
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-24 18:18:47 +00:00
Pierre Gondois
4afe895a77 ShellPkg/SerMode: Add ValidDataBits() function
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-24 18:18:47 +00:00
Pierre Gondois
65288416df ShellPkg/SerMode: Add GetStopBits() function
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-24 18:18:47 +00:00