Commit graph

351 commits

Author SHA1 Message Date
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
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
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
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
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
Pierre Gondois
5e8b0d6de5 ShellPkg/SerMode: Lower indentation level in DisplaySettings()
Invert error handling to lower the indentation level
in DisplaySettings().

No functional change.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-04-24 18:18:47 +00:00
Pierre Gondois
a5e74cdedb ShellPkg/SerMode: Add GetParityType() function
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-24 18:18:47 +00:00
Pierre Gondois
06372c8df1 ShellPkg/SerMode: Add name conversion arrays for parity/stop bits
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-24 18:18:47 +00:00
Michael D Kinney
3657a4fc9f ShellPkg/SmbiosView: Fix clang compatibility issue
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2026-03-07 02:50:50 +00:00
Yang Gang
2bfde627ff ShellPkg/SmbiosView: Support print Protocol Records of SMBIOS type42
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-06 08:35:45 +00:00
Alexander Gryanko
27528b48db ShellPkg: fix UNI string formatting and line endings to match UNI Spec
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-02 19:32:17 +00:00
Werner Lewis
7746ec4dde ShellPkg/SmbiosView: Add Type45 entry to query table
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-25 11:05:46 +00:00
Michael Kubacki
8472271dae ShellPkg: Replace include guards with #pragma once
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-23 21:01:28 +00:00
Ren Yang (楊壹任)
96572d4d72 ShellPkg: SMBIOS type 20 Extended Starting/Ending Address print type error
Wrong structure is used to print the SMBIOS type 20 Extended
Starting/Ending Address in SmbiosView

Signed-off-by: Ren Yang <RenYang@ami.com>
2026-02-03 23:20:58 +00:00
Cassandra Lam
9e815d789b ShellPkg/SmbiosView: Display Type 44 "Referenced Handle" field
Signed-off-by: Cassandra Lam <Cassandra.Lam@amd.com>
2025-10-16 08:57:01 +00:00
Cassandra Lam
28b7a6d5ea ShellPkg/SmbiosView: Display Type 2 Contained Objects info
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>
2025-10-16 08:57:01 +00:00
“anupriyak“
a0e8b71ee5 ShellPkg: Review SMBIOS 3.9 specification
Add new structure members RackType and RackHeight in Smbios Type3.

Signed-off-by: Anupriya <anupriyak@ami.com>
2025-10-16 07:49:51 +00:00
Chasel Chiu
5cf1be671b ShellPkg/pci.c: Fix typo in source code.
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
2025-10-03 17:14:30 +00:00
Pranav V V
5550d8f0b7 ShellPkg: Add PCIe boundary check and enhance DVSEC size calculation
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>
2025-10-03 17:14:30 +00:00
Pierre Gondois
aa29d51637 ShellPkg: Use the newly introduced ShellPrintDefaultEx() alias
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>
2025-10-01 10:02:57 +02:00
Pierre Gondois
c4a8b001f3 ShellPkg: Use the newly introduced ShellPrintHiiDefaultEx() alias
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>
2025-10-01 10:02:57 +02:00
Pierre Gondois
16ffc09be1 ShellPkg/MemMap: Extract a ParseMemoryDescriptors() function
In an effort to simplify the code in the ShellPkg,
extract a ParseMemoryDescriptors() function.

No functional change is introduced.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2025-10-01 10:02:57 +02:00
Pierre Gondois
5ff8948a12 ShellPkg/MemMap: Create arrays of MemoryType configuration and Page
In an effort to simplify the code in the ShellPkg:
- create a MEMORY_TYPE_INFO struct, storing per-MemoryType configuration
  information to facilitate the operations to do for each MemoryType.
- create a MEMORY_TYPE_PAGES_INFO struct, storing per-MemoryType
  Pages and PagesSize count.
Also use these arrays to facilitate Pages accounting and remove
per-MemoryType variables.

No functional change is introduced.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2025-10-01 10:02:57 +02:00
Pierre Gondois
25daa0fcc9 ShellPkg/MemMap: Create array of MemoryType names
In an effort to simplify the code in the ShellPkg,
replace the MemoryType names that are currently stored in individual
variables by an array of names, facilitating access to these names.

No functional change is introduced.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2025-10-01 10:02:57 +02:00
Pierre Gondois
0f57fc7cf7 ShellPkg/Dmem: Remove return parameter from DisplayXXX() functions
In an effort to simplify the code in the ShellPkg,
remove the SHELL_STATUS parameter returned by:
- DisplayRtProperties()
- DisplayImageExecutionEntries()
- DisplayConformanceProfiles()

These functions are independent display functions. Thus failing to
display a configuration table should not prevent from displaying
the remaining tables.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2025-10-01 10:02:57 +02:00
Pierre Gondois
2bebeb1ad4 ShellPkg/Dmem: Remove unnecessary EfiGetSystemConfigurationTable() calls
In an effort to simplify the code in the ShellPkg,
remove EfiGetSystemConfigurationTable() calls fetching Configuration
Table addresses that have already been collected.

No functional change is introduced.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2025-10-01 10:02:57 +02:00
Pierre Gondois
482781a7f9 ShellPkg/Dmem: Simplify logic by inverting Address checks
In an effort to simplify the code in the ShellPkg,
inverse checks against the 'Address'. This also lowers the
indentation level.

No functional change is introduced.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2025-10-01 10:02:57 +02:00
Pierre Gondois
e78453fb54 ShellPkg/Dmem: Replace per-System Table variable by indexed arrays
In an effort to simplify the code in the ShellPkg,
remove the per-System Table variables by indexed arrays.

The only functional change introduced is that a non-null Smbios3
System Table:
- always replaces an Smbios System Table
- ASSERT if (Smbios3 != 0) and (Smbios != 0)
Otherwise no functional change is introduced.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2025-10-01 10:02:57 +02:00
Pierre Gondois
0235ac23c5 ShellPkg/Dmem: Remove Memory Range Capsule support
Memory Range Capsule is described in the UEFI spec 2.9
s8.5.3 Update Capsule with the following GUID:
{0DE9F0EC-88B6-428F-977A-258F1D0E5E72}

Support to print the EFI_MEMORY_RANGE_CAPSULE address in the EFI
Configuration table was added in commit: 42b0443599
("ShellPkg: UefiShellDebug1CommandsLib: Uefi Config Tables in Dmem.c")
but EFI_MEMORY_RANGE_CAPSULE type and GUID is not present in edk2.
Thus dmem always print a 0 value for this configuration table.

Remove support of EFI_MEMORY_RANGE_CAPSULE in dmem.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2025-10-01 10:02:57 +02:00
Pierre Gondois
cf67a0c78e ShellPkg/Dmem: Remove remaining of SAL System Table
The SAL System Table is unsupported and its support was
removed in commit:
f4c874c45d ("ShellPkg/UefiShellDebug1CommandsLib")

Remove remaining of SAL System Table handling.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2025-10-01 10:02:57 +02:00
Pierre Gondois
ace36ed376 ShellPkg/Dmem: Extract a DisplaySystemTable() function
In an effort to simplify the code in the ShellPkg,
extract a DisplaySystemTable().
This also lowers the indentation level.

No functional change is introduced.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2025-10-01 10:02:57 +02:00
Giri Mudusuru
406aeb5a97 ShellPkg/SmbiosView: Add decode for DSP0134 SMBIOS Spec v3.9.0
Add decode for Type17 Memory based on SMBIOS Spec v3.9.0

Signed-off-by: Giri Mudusuru <girimudusuru@microsoft.com>
2025-09-09 10:39:33 +00:00
Gowtham M
e27779e2c1 ShellPkg/Library: Deprecate EFI_DEVICE_IO_PROTOCOL
gEfiDeviceIoProtocolGuid identifies EFI_DEVICE_IO_PROTOCOL,
which provided low-level I/O and MMIO access for UEFI drivers.

It was removed in UEFI 2.10A and 2.11 due to overlapping
functionality with modern protocols like EFI_PCI_IO_PROTOCOL
and EFI_CPU_IO2_PROTOCOL. These newer protocols offer improved
modularity, abstraction, and safety, making EFI_DEVICE_IO_PROTOCOL
obsolete.

Cc: Sachin Ganesh <sachinganesh@ami.com>
Signed-off-by: Gowtham M <gowthamm@ami.com>
2025-09-05 13:50:50 +00:00
Nanjinmoorthyj
c992bffaef ShellPkg: Add support for PCIe Extended IDs
Add a support to print PTM (001F) structure.

Signed-off-by: Nanjinmoorthy <nanjinmoorthyj@ami.com>
2025-09-05 12:04:06 +00:00
Ning Feng
f718b0ffd6 ShellPkg/UefiShellDebug1CommandsLib: Add MRDIMM entry to QueryTable
Added the MRDIMM (0x08) entry to the MemoryDeviceMemoryTechnologyTable
in QueryTable.c.  This enables proper display and decoding of MRDIMM memory
technology in SMBIOS Type 17 structures.

Signed-off-by: Ning Feng <ning.feng@intel.com>
2025-09-02 17:11:24 +00:00
Prachotan Bathi
d46aa46c83 ShellPkg: Remove EmbeddedPkg dependency
Commit dcde148 introduced EmbeddedPkg as a dependency
since gFdtTableGuid was in the EmbeddedPkg, but has now
been moved to MdePkg.

Signed-off-by: Prachotan Bathi <prachotan.bathi@arm.com>
2025-08-12 17:42:44 +00:00
Revathy V
be6342d64f ShellPkg: Fixed Deadcode and Null field Coverity warnings.
Updated fixes for all Deadcode and Null field Coverity fixes in ShellPkg

Signed-off-by: Revathy <revathyv@ami.com>
2025-07-24 07:57:29 +00:00
Prachotan Reddy Bathi
01295fd25b ShellPkg: DtbTableAddress via config in dmem
DTB address can be modified through the config table. Use
this address in dmem output.
EmbeddedPkg dependency added to
ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
and ShellPkg/ShellPkg.ci.yaml

Adds to: 42b0443599
("ShellPkg: UefiShellDebug1CommandsLib: Uefi Config Tables in Dmem.c")

Signed-off-by: Prachotan Reddy Bathi <Prachotan.Bathi@arm.com>
2025-07-24 05:59:45 +00:00
Abdul Lateef Attar
f2e9785b6e ShellPkg: Correct spelling errors and typos
Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
2025-07-04 09:41:47 +08:00
Michael Kubacki
dfc8e90fdb ShellPkg: Prevent memcpy intrinsics in VS22 (17.14.2)
The latest VS2022 update replaces some code patterns with struct
assignments with `memcpy`. This change convert the code to
explicitly use `CopyMem`.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-06-08 18:07:56 +00:00
Cian Costello
defdccd4ae ShellPkg: Add PCIe extended capability
Updates PCIe shell command to display previously undefined
PCIe extended capabilities.

Signed-off-by: Cian Costello <ccostello@nvidia.com>
2025-04-30 04:11:42 +00:00
Shveta Gupta
d3b2ee2df3 ShellPkg: Updated Memory Form Factor definition per SMBIOS 3.8.0
This patch adds additional support for the new CAMM form factor
defined in SMBIOS specification 3.8.0

Signed-off-by: Shveta Gupta <shvetag@nvidia.com>
2025-04-22 17:32:39 +00:00
praveensankarn
e4140a5701 ShellPkg: Added ArmV9 processors support for SmbiosView command
Added switch case for ArmV9 processor family inside function
DisplayProcessorFamily2 in PrintInfo.c to avoid inappropriate data
shown while accessing Type 4 Smbios table. ArmV9 processor family
is added in Smbios Spec 3.8 which should be noted.

Signed-off-by: Praveen Sankar N <praveensankarn@ami.com>
2025-04-08 12:20:31 +00:00
edhay
59805c7697 ShellPkg/SmbiosView: Decode for InterfaceTypeSpecificData of SMBIOS type42
ShellPkg/SmbiosView tool changes for InterfaceTypeSpecificData decode and print
Previously, the InterfaceTypeSpecificData of SMBIOS type42 table was dumped
as hex in the SmbiosView tool output
This commit adds decode, interpretation and print as per SMBIOS spec version 3.8.0

Signed-off-by: G Edhaya Chandran <edhaya.chandran@arm.com>
2025-04-02 22:21:39 +00:00