[Issue] : There is no DLINK_FLAGS definition for CLANGPDB,
leading to potential discrepancies in build alignments
[Resolution] : This change adds a CLANGPDB line for DLINK_FLAGS.
Maintaining the alignment with existing standards in place for
other compiler packages.
Signed-off-by: Deepak5x <deepakx.singh@intel.com>
[Issue] : There is no DLINK_FLAGS definition for CLANGPDB,
leading to potential discrepancies in build alignments
[Resolution] : This change adds a CLANGPDB line for DLINK_FLAGS.
Maintaining the alignment with existing standards in place for
other compiler packages.
Signed-off-by: Deepak5x <deepakx.singh@intel.com>
Commit 43e306806e added
EFIGcdMemoryTypeUnaccepted (as it was later renamed) to be
returned in the EFI_MEMORY_MAP. However, it did not add it
to the number of entries calculation, so if any
EfiGcdMemoryTypeUnaccepted entries exist in the GCD they will
overflow the EFI_MEMORY_MAP buffer provided by the bootloader.
This resolves that by accounting for unaccepted entries in
the number of entries calculation.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
* Remove redundant /DLL option from MSFT
* Use VERSION_STRING from [Defines] section to set
the PE/COFF optional header image version fields.
The use of the MSFT linker /VERSION option is
removed and replaced with the GenFw --image-version
option to use same method for all tool chains and
provide better error checking.
* Add CLANGPDB tool chain family support that matches
MSFT settings.
* Add GCC family tool chain support that overrides
OBJCOPY_STRIPFLAGS to nothing to prevent symbols
from being stripped from PRM Modules so the
PRM Export Descriptor Structure can be found by
GENFW when the --prm option is used.
* Remove all -Wl, options that are not compatible
across all support tool chains. This also removes
the need to list the PRM Export Descriptor Structure
and PRM Handler APIs in the INF file and instead
depend in GENFW with --prm option to find these
symbols and generate the PE/COFF DLL export section.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Use _MSC_EXTENSIONS instead of _MSC_VER when MSC specific
extensions are required such as __declspec(dllexport).
CLANGPDB builds do not set _MSC_VER but CLANGPDB builds
in Windows and Linux do support use of MSC specific
extensions.
Add PRM_EXPORT_DESCRIPTOR macro that provides attributes
required to make sure the PRM Export Descriptor Structure
is not optimized away by the compiler/linker.
PRM_EXPORT_API can not be used for this because the
attributes for code and data may be different with
different tool chains.
For GCC/CLANGDWARF tool chains, PRM_EXPORT_DESCRIPTOR
sets the 'used' and 'section(.prmexportdescriptor)'
attributes and depends on the GCC linker script
to make sure the `.prmexportdescriptor` section is
preserved.
Fix incorrect location of ; in PRM_MODULE_EXPORT()
macro that was found by CLANG.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Update GCC linker script to always keep .prmexportdescriptor
sections and merge them into the .data section.
The .prmexportdescriptor section is only used by PRM modules
for the PRM Export Descriptor Structure that must be kept
in the final image to support adding the PRM Export
Descriptor Structure and its associated PRM Handlers APIs
to a PE/COFF DLL Export section.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Add --image-version option that takes a version value
of the form MMMM.mmmm where MMMM and mmmm are decimal
values < 65536. The MMMM and mmmm values are used to
set the PE/COFF optional header fields MajorImageVersion
and MinorImageVersion.
If MMMM or mmmm are larger than 65535, then generate
Error() condition.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
When --prm is specified, a search for the symbol with the
name PRM_MODULE_EXPORT_DESCRIPTOR_NAME is performed. If
the symbol is not found, then GENFW generates an exception
due to a loop with a terminal count of -1.
Update logic to not search for PRM Handler symbols if the
PRM_MODULE_EXPORT_DESCRIPTOR_NAME was not found and add
an Error() message when --prm is specified and
PRM_MODULE_EXPORT_DESCRIPTOR_NAME was not found.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
edk2 commit 3bd5c994c8 added usage
of EFI_MEMORY_ATTRIBUTE_MASK to edk2. However, it applied it
incorrectly to some places that should instead use
EFI_MEMORY_ACCESS_MASK. EFI_MEMORY_ACCESS_MASK contains the actual
HW page table access attributes (read protect, read only, no-execute),
whereas EFI_MEMORY_ATTRIBUTE_MASK contains the access attributes in
addition to some virtual attributes (special purpose and cpu crypto).
The GCD has a behavior where if SetMemorySpaceAttributes() is called
with only virtual attributes set, it will not call into CpuDxe to
change the attributes; 0 is a valid page table attribute set (it means
RWX). However, after the above change, this behavior was altered so
that if EFI_MEMORY_SP or EFI_MEMORY_CPU_CRYPTO is applied, in attempt
to just update these virtual attributes, the GCD will call into CpuDxe
and apply RWX instead, which is not the intention of the caller.
One other place this was done incorrectly was in CoreGetMemoryMap,
but that was fixed in f1567720b1.
SetUefiImageMemoryAttributes() is also updated here because that
logic was copied from the check the GCD has about whether to call
CpuDxe or not. Now that the GCD has been corrected, this also
needs to be corrected.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
Currently the FMMT tool supports CRC32 GUID section (Ref. GuidTools.py).
But it is found that there are errors for the FV with CRC32 section.
For example, the errors are checked on the following commands.
--v : Show FV information except for the FV
--a : Show "Target Fv not found!!!" when adding an FFS file to the FV
--d : Show "Target Ffs not found!!!" when deleting an FFS file in the FV
They are caused by the mismatch for CRC32 section data between the FMMT
and GenCrc32 tools. The FMMT tool returns CRC32 section data without CRC
checksum field (4 bytes). The GenCrc32 tool (with -d option, verify CRC32
value for the input file) requires CRC32 section data including CRC
checksum field (4 bytes).
Fix the issue through adjusting the section data to include CRC checksum
field. Currently DataOffset field for CRC32 GUID section is reported as
0x1C differently (GUID Section header length: 0x18 + Checksum field: 0x4).
Instead of DataOffset field that includes CRC checksum field, configure
the section data based on the offset from section header length (0x18)
that was previously calculated. This update enables GUID sections to use
the same offset consistently.
Signed-off-by: Phil Noh <Phil.Noh@amd.com>
Currently, only SCSI attached CDROMs are marked as read only
SCSI devices. Write failures have been seen to occur when a
read only disk is attached as a SCSI device, because the device
is never queried for its write protected state and the disk is
listed as writeable.
This adds a new mode sense query to determine if a SCSI disk is
write protected. If so, the proper BlockIO media property is set
to read only, to ensure that all layers know this is a read only
disk.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
ATA_CMD_MODE_SENSE6 is used to query certain properties of
an ATA device, including its write protection state. This
definition will be used in the next commit of this series to
query if a SCSI disk is write protected.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
Change VirtualRealTimeClockLib.inf to use SOURCE_DATE_EPOCH
instead of Linux only shell command. This allows this library
to be used in Windows build environments.
Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
Set BUILD_TIME_EPOCH to the current UTC timestamp if not already present
in the environment.
Use the resulting value to print the "Build start time:" message.
Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
The function CheckEnvVariable in fact checks several environment
variables. And the comment at its invocation enumerates a specific set of
variables, which defeats half the point of abstracting it out into a
helper function.
Rename the function to the plural form and turn the comment into a list
of examples.
Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.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>
The IoMmu keeps a pool of pre-allocated shared buffers in various sizes
to serve requests. Usage is tracked in a bitmap.
The bitmap masks for the 1M and 2M buffer pools are incorrect, causing
the same buffers getting handed out repeatedly, causing corrupted device
accesses.
The masks needs to be kept in sync with mReservedMemRanges below.
This sets the correct values for:
- RESERVED_MEM_BITMAP_1M_MASK = (1 << 14) = 0x4000
- RESERVED_MEM_BITMAP_2M_MASK = (1 << 15) | (1 << 16) = 0x18000
Signed-off-by: Oliver Steffen <osteffen@redhat.com>
Linux/GCC host-based unit test application builds use a
default stack size of 8MB. Windows/VS20xx and Windows/CLANGPDB
host-based unit test application builds use a default stack size
of 1MB. This can allow Linux unit tests to pass and Windows unit
tests to fail with stack overflow if large local variables are
used. ASAN increases stack usage, so this condition can occur
more frequently when ASAN enabled.
Update MSFT and CLANGPDB for host-based unit tests to use a
default stack size of 8MB so all tool chains use the same
default stack size for host-based unit tests.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Currently, there is no mechanism for platforms to enable or disable
support for EmbeddedDrivers in capsule updates. This patch introduces
a new PCD, PcdEmbeddedDriverSupport, allowing platforms to explicitly
control whether capsules containing EmbeddedDrivers are supported.
This ensures capsules with embedded drivers are rejected on platforms
that do not support them.
This is a breaking change.By default, PcdEmbeddedDriverSupport
is set to FALSE which disables embedded driver support in capsule updates
across all platforms unless explicitly enabled.
Platforms must opt-in by setting the PcdEmbeddedDriverSupport to TRUE
in order to enable support for capsules containing embedded drivers.
Signed-off-by: Pavithra Gurulingappa <gpavithr@qti.qualcomm.com>
Previously, the implementation restricted usage to TPM instances with the
DTPM ID, which worked only if the system supported TPM over FFA but still
set the instance ID to DTPM. However, Tpm2InstanceLibFfa requires the
`PcdTpmInstanceGuid` to be set to `gTpm2ServiceFfaGuid`.
This update expands support by allowing the `PcdTpmInstanceGuid` to
include the TPM-over-FFA instance GUID, enabling proper registration of
the PPI.
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
The current implementation checks `PcdTpmInstanceGuid` and enforces the
use of the DTPM instance GUID. However, for FFA-specific modules, the
correct value should be `gTpm2ServiceFfaGuid`.
This update fixes the validation logic to support routing through
Tpm2DeviceLibRouter* with the appropriate instance library, which
requires the instance ID to be set to `gTpm2ServiceFfaGuid`.
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
Commit 84c0261 removed support for ARM32 and inadvertently removed the
EFI_GENERIC_ERROR_PROC_TYPE_ARM macro which remains valid for AARCH64.
The macro refers to the ARM CPU architecture, not specifically the ARM32
instruction set.
Restore the macro to maintain compatibility with downstream modules that
rely on Cper.h for AARCH64 platforms.
Signed-off-by: Vishal Oliyil Kunnil <vishalo@qti.qualcomm.com>
PR #11380 that removed the Unicode Collation Protocol
introduced a logic bug in the use of GetBestLanguage().
Iso639Language would always be computed to TRUE when it
should always be passed to GetBestLanguage() as FALSE
once Unicode Collation Protocol is removed.
Update InitializeUnicodeCollationSupportWorker() to
remove the local variable Iso639Language and always
call GetBestLanguage() with the Iso639Language parameter
set to FALSE.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
PR #11380 that removed the Unicode Collation Protocol
introduced a logic bug in the use of GetBestLanguage().
Iso639Language would always be computed to TRUE when it
should always be passed to GetBestLanguage() as FALSE
once Unicode Collation Protocol is removed.
Update InitializeUnicodeCollationSupportWorker() to
remove the local variable Iso639Language and always
call GetBestLanguage() with the Iso639Language parameter
set to FALSE.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Implement function to add a CmObj with a token provided by the caller. This
is intended to be used with abstract tokens, the value of which is generated
by the caller.
Signed-off-by: Sarah Walker <Sarah.Walker2@arm.com>
The current Arm GICC parser only supports one PMU IRQ shared between all
cores. Newer systems use a unique PMU IRQ per core.
Signed-off-by: Sarah Walker <Sarah.Walker2@arm.com>
TempBuffer variable is only dynamically allocated when the opcode is
EFI_IFR_STRING_OP and the string value is not 0, so it should be freed
under the same condition. Otherwise, the variable may be unexpected
freed.
Signed-off-by: Qihang Gao <gaoqihang@loongson.cn>
Fixes build failures caused by __USE_MINGW_ANSI_STDIO not being defined when
building with CLANG.
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
Remove /FILEALIGN, /SUBSYSTEM, /EXPORT and /BASE options
that are not required for UEFI Shell applications.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
With SEV or SEV-ES being active uninitialized memory is random cipher
text instead of being zero-initialized. So checking against zero to
figure whenever igvm parameters are present or not is not sufficient.
Apply more strict sanity checks.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
There is a possibility to retrieve user input keystroke data stored in the
queue buffer via the EFI_SIMPLE_TEXT_INPUT_PROTOCOL pointer. To prevent
exposure of the password string, clear the queue buffer by filling it
with zeros after reading.
Signed-off-by: Nick Wang <nick.wang@insyde.com>
There is a possibility to retrieve user input keystroke data stored in the
queue buffer via the EFI_SIMPLE_TEXT_INPUT_PROTOCOL pointer. To prevent
exposure of the password string, clear the queue buffer by filling it
with zeros after reading.
Signed-off-by: Nick Wang <nick.wang@insyde.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>
Since PRM modules are DXE_RUNTIME_DRIVER images, this change sets
the linker flags to the expected section alignment values for
runtime code images. This serves as an example for platforms but
also results in PRM sample modules in the package having correct
section alignment.
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
By edk2 convention, a NULL library should be called *LibNull.
This library did not follow this convention, so rename i.
Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
By edk2 convention, a NULL library should be called *LibNull.
These libraries did not follow this convention, so rename them.
Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
By edk2 convention, a NULL library should be called *LibNull.
ArmMtlNullLib did not follow this convention, so rename it
ArmMtlLibNull.
Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>