Add a new parser for the Firmware Performance Data Table (FPDT),
as per the ACPI6.5 specification.
Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
Clang complains about unused variables:
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rimt/RimtParser.c:21:60: error: variable 'mRimtNodeHeader' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
21 | STATIC EFI_ACPI_6_6_RIMT_NODE_HEADER_STRUCTURE mRimtNodeHeader;
| ^~~~~~~~~~~~~~~
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rimt/RimtParser.c:25:60: error: variable 'mRimtIdMappingNode' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
25 | STATIC EFI_ACPI_6_6_RIMT_ID_MAPPING_STRUCTURE mRimtIdMappingNode;
| ^~~~~~~~~~~~~~~~~~
28 | STATIC EFI_ACPI_6_6_RIMT_PCIE_ROOT_COMPLEX_NODE_STRUCTURE mRimtPcieRootComplexNode;
| ^~~~~~~~~~~~~~~~~~~~~~~~
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rimt/RimtParser.c:29:60: error: variable 'mRimtIommuNode' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
29 | STATIC EFI_ACPI_6_6_RIMT_IOMMU_NODE_STRUCTURE mRimtIommuNode;
| ^~~~~~~~~~~~~~
4 errors generated.
This is because these variables are only used to take the size of their
fields using the sizeof() operator, which does not support type names
directly.
So create a helper macro SIZE_OF_T () that provides the functionality we
need, and drop the unused variables.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Fix CodeQL cpp/redundant-null-check-simple warning in
ShellPkg/Library/UefiShellLevel1CommandsLib/For.c at line 571 by
removing redundant null and empty-string checks on ArgSetWalker. The
outer guard at line 570 ensures that ArgSetWalker is non-NULL and
non-empty, so the inner condition only needs
ShellIsValidForNumber(ArgSetWalker).
Signed-off-by: Mingjie Shen <shen497@purdue.edu>
- Remove redundant null check in IsValidMove() per CodeQL
cpp/redundant-null-check-simple. Specifically, drop the
"DestPathWalker != NULL" condition from the trimming loop.
Rationale: "DestPathCopy" is allocated at line 181 and checked for
NULL at lines 182–183; "DestPathWalker" is initialized from
"DestPathCopy" at line 186, so it cannot be NULL.
- Cache length once in IsValidMove() and ValidateAndMoveFiles() so the
trimming loop avoids repeated StrLen() calls.
- Guard the zero-length case before indexing the last character to
prevent out-of-bounds access.
Signed-off-by: Mingjie Shen <shen497@purdue.edu>
Remove a check against ShellStatus in MainCmdLs() as there are
two consecutive checks without any modification of ShellStatus.
Suggested-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
If RootPath is NULL, PrintLsOutput() will return an error code
of SHELL_OUT_OF_RESOURCES and not print anything:
PrintLsOutput()
\-StrnCatGrow()
if (Source == NULL) {
return (*Destination);
}
Remove paths where FullPath ends up being NULL and bail out
early.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Remove some of the success handling conditions to flatten
the MainCmdLs() function.
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
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>
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>
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().
Note:
Cd:
Return directly if ShellCommandLineParse() returned an error
Status. The initial code was ignoring the error status.
Cp:
Only check for ShellGetExecutionBreakFlag() if
ShellCommandLineParse() returned successfully. If the command
line failed to be parsed, there should be no need to check for
the execution break flag.
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
The legacy ScsiPassThruProtocol has been removed as per
the UEFI 2.10A specification.
This commit, removes references to ScsiPassThruProtocol and
transitions the implementation to only use ExtScsiPassThruProtocol,
which provides enhanced support for device enumeration,
target/LUN discovery, and broader SCSI compatibility.
Cc: Sachin Ganesh <sachinganesh@ami.com>
Signed-off-by: Gowtham M <gowthamm@ami.com>
Add prints for SMBIOS Type 2 "Number of Contained Object Handles" and
"Contained Object Handles" fields.
Signed-off-by: Cassandra Lam <Cassandra.Lam@amd.com>
1. Safe wrapper function for DumpHex that validates PCI configuration
space boundaries. This function ensures that hex dumps do not exceed
the standard 4KB PCIe configuration space boundary. If the requested
dump would exceed this boundary, it prints an error message and
truncates the dump size to remain within valid bounds.
2. Enhance DVSEC capability structure size calculation method. Size is
now obtained from the DesignatedVendorSpecificHeader1.Bits.DvsecLength
register.
Issue: https://github.com/tianocore/edk2/issues/11554
Signed-off-by: Pranav V V <pranav.v.v@intel.com>
CodeQL incorrectly flags that LoadedDriverImage might be derferenced
while NULL, but the actual code paths make that impossible.
Strip several levels of success handling to improve readability for
humans and static analyzers both.
Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
Make use the newly introduced ShellPrintDefaultEx() alias and
replace wherever it is possible:
- "ShellPrintEx (-1, -1,"
with:
- "ShellPrintDefaultEx ("
No functional change is introduced.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Make use the newly introduced ShellPrintHiiDefaultEx() alias and
replace wherever it is possible:
- "ShellPrintHiiEx (-1, -1, NULL,"
with:
- "ShellPrintHiiDefaultEx ("
No functional change is introduced.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
In an effort to simplify the code in the ShellPkg,
extract a ConnectFromEfiVariable() function to connect devices
pointed by a list of EFI variables.
No functional change is introduced.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
In an effort to simplify the code in the ShellPkg,
extract a ConnectConsoles() function to connect device consoles.
No functional change is introduced.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
In an effort to simplify the code in the ShellPkg,
simplify error handling case in ShellConnectFromDevPaths().
No functional change is introduced.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>