Remove the ACPI_AML_STA_PROC_SUPPORTED macro to make use
of the new MdePkg macro: ACPI_AML_STA_BASE_SUPPORTED.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Make use of the previously introduced StaToken field to
generate a _STA method describing the status of a processor
or processor container.
staSupp
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Add a new StaToken field to CM_ARCH_COMMON_PROC_HIERARCHY_INFO
CmObj, allowing to describe the ASL "_STA" value the processor
or processor container should return.
CM_X64_LOCAL_APIC_X2APIC_INFO.StaToken already allows to reference
a StaToken from a X2APIC CmObj. If ProcHierarchy objects are used,
the SSDT CPU topology table will be generated using the X2APIC
objects, so the new field should not collide with the new one.
Add a note to CM_X64_LOCAL_APIC_X2APIC_INFO.StaToken
to handle this case.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
The current instance does not support host based test on AArch64 host
system due to its dependency on hardware UART library.
This change created a new instance that does not initialize the serial
port for host based test applications.
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
When edk2 runs as a kvmtool guest with nested virtualization enabled,
the Arm architectural timer DT node contains five interrupt specifiers.
The fifth interrupt describes the EL2 virtual timer.
ArmGenericTimerParser currently expects exactly four timer interrupts.
It therefore asserts when parsing the timer node generated for a nested
virtualization guest.
Determine the number of interrupt specifiers present in the DT and
populate each architectural timer entry only when it is available.
Add support for the EL2 virtual timer and use it to populate the
VirtualPL2Timer fields in the generated GTDT information.
Tested as a KVM guest at EL1 and EL2, with both E2H==0 and E2H==1.
Signed-off-by: Marc Zyngier <maz@kernel.org>
[Varshit Pandya: Rewrite commit message for clarity.]
Ref: https://edk2.groups.io/g/devel/message/122008
Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
In AmlCodeGenRdInterrupt(), the IRQ list was copied directly into an
EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR structure allocated on the stack.
Since the structure only contains storage for the first interrupt entry,
copying multiple IRQs would write beyond the allocated buffer and corrupt
the stack.
Fix this issue by allocating the descriptor dynamically with sufficient
space to accommodate the entire IRQ list. This ensures all interrupt entries
are copied safely without overwriting adjacent stack memory.
Signed-off-by: Tuan Phan <tuan.phan@oss.qualcomm.com>
Add support for generating AML methods that return a buffer through the
new AmlCodeGenMethodRetBuffer() API.
Signed-off-by: Tuan Phan <tuan.phan@oss.qualcomm.com>
There is currently no API available for generating AML methods without
a return value. This change exports the AmlCodeGenMethod API so it can
be used to create non-returning methods when required.
Signed-off-by: Tuan Phan <tuan.phan@oss.qualcomm.com>
Update SmbiosSmcLib to use ArmSmcccSocIdLib for retrieving the JEP106
identification code and SoC revision.
Remove the duplicated SMCCC feature detection and SoC ID calls while
retaining the SMBIOS-specific formatting of the Type 4 Processor ID.
Signed-off-by: Varshit Pandya <Varshit.Pandya@arm.com>
Add a DynamicTables SMBIOS generator for the Additional Information
(Type 40) structure.
SMBIOS Type 40 provides additional information for fields in other
SMBIOS structures. Each Type 40 entry references an existing SMBIOS
record by handle and offset, provides an optional entry string, and
carries a supplemental field value.
The generator consumes one or more top-level CM objects, each referencing
a list of Additional Information entries. Each entry provides:
- the CM object token of the referenced SMBIOS structure,
- the referenced table generator ID,
- the offset of the referenced field,
- an optional entry string,
- a token to a typed Additional Information Value object.
Example platform CM object layout:
CM_ARCH_COMMON_ADDITIONAL_INFORMATION AdditionalInformation[] = {
{
REFERENCE_TOKEN (AdditionalInformation[0]),
REFERENCE_TOKEN (AdditionalInformationEntry[0])
}
};
CM_ARCH_COMMON_ADDITIONAL_INFORMATION_ENTRY
AdditionalInformationEntry[] = {
{
REFERENCE_TOKEN (MemoryDeviceInfo[0]),
CREATE_STD_SMBIOS_TABLE_GEN_ID (EStdSmbiosTableIdType17),
OFFSET_OF (SMBIOS_TABLE_TYPE17, MemoryType),
"DIMM0 memory type",
REFERENCE_TOKEN (AdditionalInformationValue[0])
}
};
CM_ARCH_COMMON_ADDITIONAL_INFORMATION_VALUE
AdditionalInformationValue[] = {
{
sizeof (UINT8),
{
MemoryTypeDram
}
}
};
The generator resolves referenced SMBIOS handles using CM object tokens
and table generator IDs. It validates the typed value objects, individual
entry lengths, and aggregate formatted record size. The maximum accepted
value length is controlled by PcdMaxAdditionalInformationValue.
Build the variable-length Type 40 formatted area and append the entry
strings to the SMBIOS string area.
Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
Add the Configuration Manager objects required to describe SMBIOS
Additional Information (Type 40) structures.
The top-level object references a list of Additional Information entries.
Each entry identifies a field in an existing SMBIOS structure and
references a typed value object containing the additional data.
Define the maximum value buffer size from the SMBIOS Type 40 formatted
length limit and add parsers for the new CM objects.
Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
The IsaStringInfoParser() routine currently sets the ISA string length
to PropSize + 1 and used AsciiStrCpyS() with PropSize + 1 as the
destination size. This could lead to incorrect length handling and
potential buffer issues.
Update the code to:
- Set IsaStringInfo.Length to PropSize (actual property size).
- Use MAX_ISA_STRING_LENGTH as the destination buffer size when
copying the ISA string.
- Check the return status of AsciiStrCpyS() and abort with an error
message if the copy fails.
This ensures safe string handling and prevents buffer overflow or
truncation when parsing ISA strings.
Reported-by: Zhenyu Liu <lzy00419@outlook.com>
Signed-off-by: Sunil V L <sunilvl@oss.qualcomm.com>
Generator for Smbios System Information table (Type 1).
Co-authored-by: Dat Mach <dmach@nvidia.com>
Signed-off-by: Girish Mahadevan <gmahadevan@nvidia.com>
Add EArchCommonObjSystemInfo to ArchCommonNameSpaceObjects.h and a
corresponding parser entry in ConfigurationManagerObjectParser.c.
Signed-off-by: Girish Mahadevan <gmahadevan@nvidia.com>
Moving the standalone SMBIOS generators to the common component section
adds them to the X64 build. VS2022 reports narrowing warnings for native-
width, wide, or enum values converted to fixed-width SMBIOS fields. These
warnings are treated as errors under /WX.
Use UINTN for the Type 7 table-list count and index. Add bounds checks for
the Type 4 processor counts and Type 7 cache level where CM-derived values
could exceed the corresponding SMBIOS fields, and make the remaining
intended conversions explicit in the Type 4, Type 7, Type 16, Type 17,
Type 19, and Type 44 generators.
This rejects out-of-range processor counts and cache levels instead of
silently truncating them, while preserving the existing behavior for valid
configuration data.
Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn>
The SMBIOS_TABLE_GENERATOR_BUILD_TABLEEX and
SMBIOS_TABLE_GENERATOR_FREE_TABLEEX callback types do not specify EFIAPI.
The Type 37 implementations specify it, while the other extended callback
implementations follow the omission in the shared types.
For X64 GCC builds, BaseTools/Conf/tools_def.template adds
-DEFIAPI=__attribute__((ms_abi)). Therefore, callbacks marked with EFIAPI
use the Microsoft x64 ABI, while unannotated callback types use the
compiler default ABI. If the two sides differ, the caller and callee use
different argument registers, and GCC rejects the function pointer
assignment.
This mismatch remained hidden while the standalone Type 37 generator was
built only for AARCH64. Moving the SMBIOS generators to the common
component section adds X64 build coverage and exposes it.
Add EFIAPI to the extended callback types and all matching implementations.
This follows the ACPI generator callback convention and provides the ABI
prerequisite for expanding the SMBIOS standalone build coverage.
Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn>
Some combination of fields of Rd Address Space descriptors
are not valid. Check them when updating a Rd Address Space
descriptor.
Cf. ACPI 6.4 Table 6.44:
"Valid Combination of Address Space Descriptor Fields"
Also check that the input length is not 0 to avoid
potential integer underflow.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This is preparatory patch for SMBIOS Type 44 record.
SMBIOS Type 44 record have a reference handle of SMBIOS Type 4 record.
Therefore, register SMBIOS Type 4 record into SmbiosHandleMap
with the Socket Processor Hieararchy token.
Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
Add support for generating SMBIOS Type 37 Memory Channel structures from
Configuration Manager data.
Introduce the Memory Channel CM object and the associated Memory Channel
Device CM object. The channel object describes the Type 37 fixed fields,
including channel type, maximum channel load, memory device count, and the
token for the device-list object. The device-list object describes each
memory device attached to the channel using a device load and a Type 17
Memory Device CM token.
Add parser entries for both CM objects and register the Type 37 generator in
the DynamicTablesPkg DSC so it is available through the SMBIOS table factory.
The Type 37 generator builds one SMBIOS record per Memory Channel CM object.
For each channel, it retrieves the referenced Memory Channel Device list,
validates the channel type, maximum channel load, device count, device load,
and device tokens, resolves each referenced Type 17 CM token to an SMBIOS
handle, and emits the variable-length MemoryDevice array in the Type 37
record.
This allows platforms to describe memory channels and link them to generated
Type 17 Memory Device records through CM tokens instead of hard-coded SMBIOS
handles.
Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
Add an SMBIOS Type 20 generator for Memory Device Mapped Address
structures.
The generator builds one Type 20 table per Memory Device Mapped Address
CM object, validates the address range, encodes extended addresses when
the 32-bit address fields cannot represent the range, and maps optional
Type 17 and Type 19 CM object references to SMBIOS handles. If either
reference token is CM_NULL_TOKEN, the corresponding SMBIOS handle is set
to SMBIOS_HANDLE_INVALID.
Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
Add a Configuration Manager object and parser for SMBIOS Type 23
System Reset information.
Add a Type 23 SMBIOS generator that creates the System Reset structure
from the System Reset CM object. The generator expects a single CM
object, fills the system reset capabilities and watchdog reset fields,
and registers the generated table with the SMBIOS table factory.
Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
Add a Configuration Manager object and parser for SMBIOS Type 29
Electrical Current Probe information.
Add a Type 29 SMBIOS generator that creates one Electrical Current Probe
structure for each Electrical Current Probe CM object. The generator
validates the probe location and status fields, publishes the optional
description string, and registers the generated table with the SMBIOS
table factory.
Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
Add a Configuration Manager object and parser for SMBIOS Type 26
Voltage Probe information.
Add a Type 26 SMBIOS generator that creates one Voltage Probe
structure for each Voltage Probe CM object. The generator validates
the probe location and status fields, publishes the optional
description string, and registers the generated table with the
SMBIOS table factory.
Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
Use the TemperatureProbeToken in the Cooling Device CM object to resolve
the SMBIOS handle of the corresponding Type 28 Temperature Probe record.
Set the Type 27 TemperatureProbeHandle field to 0xFFFF when no
temperature probe token is provided. Return an error if a non-null token
does not resolve to a generated Type 28 record.
Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
Introduce a CM_ARCH_COMMON_TEMPERATURE_PROBE_INFO object to describe
temperature probes provided by the platform. The generator creates one
SMBIOS Type 28 record for each temperature probe object and populates
the description, location/status, probe limits, resolution, tolerance,
accuracy, OEM-defined data, and nominal value.
Add the CM object parser entry and wire the generator into the
DynamicTablesPkg build.
Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
Introduce a CM_ARCH_COMMON_COOLING_DEVICE_INFO object to describe
cooling devices provided by the platform. The generator creates one
SMBIOS Type 27 record for each cooling device object and populates the
device type/status, cooling unit group, OEM-defined data, nominal speed,
and optional description string.
The temperature probe handle is set to 0xFFFF for now because SMBIOS
Type 28 Temperature Probe generation is not currently available. Reject
non-null temperature probe tokens until Type 28 handle resolution can be
added.
Add the CM object parser entry and wire the generator into the
DynamicTablesPkg build.
Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
CmArmDmc620PmuRegInfoParser only parses the interrupt field
without parsing the interrupt flags. Fix it.
Also make CmArmCmn600InfoParser use the common interrupt
parser instead of separately printing the interrupt number
and flag.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Dmc620 have been added at an incorrect index in the
ArmNamespaceObjectParser array. Fix the order.
Also, rename:
- CmArmObjDmc620PmuSocketInfoParser
to:
- CmArmDmc620PmuSocketInfoParser
to follow the other conventional names.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
The following objects are missing some fields in the
CmObjParser:
- CM_ARCH_COMMON_PROC_HIERARCHY_INFO
- CM_ARCH_COMMON_CACHE_INFO
Add them.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Always set the ProcessorArm64SocId bit for arm64 build
and conditionally set the Processor64BitCapable bits for
64-bits architectures.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Move the ACPI table helper macros from EmbeddedPkg's AcpiLib.h to
MdeModulePkg's AcpiHelperMacros.h.
These macros describe ACPI data initializers and do not depend on the
AcpiLib library interface. Keeping them in AcpiLib.h forces users that
only need the macros to include the AcpiLib library header unnecessarily.
Place the macros in a common MdeModulePkg public header so ACPI table
producers can include the macro definitions directly without implying
use of AcpiLib.
The companion edk2-platforms change is:
"Global: Include AcpiHelperMacros.h for ACPI helper macros"
Tested:
DynamicTablesPkg: X64/AARCH64 DEBUG/RELEASE/NOOPT
MdeModulePkg: X64/AARCH64 DEBUG/RELEASE/NOOPT
EmbeddedPkg: X64/AARCH64 DEBUG/RELEASE/NOOPT
Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
Add EArchCommonObjMemoryArrayMappedAddress to ArchCommonNameSpaceObjects.h
and a corresponding parser entry in ConfigurationManagerObjectParser.c.
Signed-off-by: Girish Mahadevan <gmahadevan@nvidia.com>
Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
Add EArchCommonObjMemoryDeviceInfo to ArchCommonNameSpaceObjects.h
and a corresponding parser entry in ConfigurationManagerObjectParser.c.
Signed-off-by: Girish Mahadevan <gmahadevan@nvidia.com>
Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
Add EArchCommonObjPhysicalMemoryArray to ArchCommonNameSpaceObjects.h
and a corresponding parser entry in ConfigurationManagerObjectParser.c.
Signed-off-by: Girish Mahadevan <gmahadevan@nvidia.com>
Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>