Commit Graph

33965 Commits

Author SHA1 Message Date
Praveen K Paladugu f2a8bb9dfb CloudHv: Disable PcdFirstTimeWakeUpAPsBySipi
Disable PcdFirstTimeWakeUpAPsBySipi to use INIT-SIPI-SIPI sequence to
wakeup APs.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
2025-01-14 12:25:56 +00:00
Longhaox Lee cbe8a09dba MdeModulePkg/HiiDatabaseDxe: Add string question load default support.
Add string question load default support.
load default data from PCD PcdNvStoreDefaultValueBuffer.

Signed-off-by: Longhao Lee <longhaox.lee@intel.com>
2025-01-14 18:00:29 +08:00
Sebastian Witt 7c1562f03c CryptoPkg: Add HMAC algorithms for signature/keymgmt
Some parts and versions of TLS require HMAC. This adds the missing HMAC
algorithms to the UEFI provider. One entry in the default signature
algorithms and one in the key management algorithms.

Source of these entries is the default OpenSSL provider, defltprov.c,
included in the OpenSSL library.

This change was required to connect to some TLS servers depending
on the used ciphers.

Signed-off-by: Sebastian Witt <sebastian.witt@siemens.com>
2025-01-14 02:44:57 +00:00
Tom Lendacky 8b87eb9dfb OvmfPkg: Use the OvmfPkg version of CcProbeLib
Currently, multiple dsc files within the OvmfPkg directory use the NULL
version of the CcProbeLib library. However, these packages have support
for confidential guests (usage of CcExitLib, MemEncrypt{Sev,Tdx}Lib, etc.)
and should be using the OvmfPkg version of the CcProbeLib.

The use of the NULL library causes the PCI option ROM to be enabled, which
can't be trusted as it originates from the hypervisor. The use of the NULL
library also causes a KVM hypervisor error when attempting to map/back the
option ROM region when running an SEV-SNP guest.

Update the various dsc files to reference the OvmfPkg version of the
CcProbeLib library and prevent usage of PCI option ROMs.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
2025-01-13 16:27:23 +00:00
Ceping Sun d51baa02a6 OvmfPkg: Update with TdxMeasurementLib
Since the tdx measurement APIs are implemented by
TdxMeasurementLib, the duplicate code are removed.

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Signed-off-by: Ceping Sun <cepingx.sun@intel.com>
2025-01-13 09:38:39 +00:00
Ceping Sun 6f73428d06 OvmfPkg: Implement TdxMeasurementLib
Add below APIs implementation that copied from TdxHelperLib.
- TdxMeasurementMapPcrToMrIndex
- TdxMeasurementHashAndExtendToRtmr
- TdxMeasurementBuildGuidHob

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Signed-off-by: Ceping Sun <cepingx.sun@intel.com>
2025-01-13 09:38:39 +00:00
Ceping Sun d97f530413 UefiCpuPkg: Add NULL TdxMeasurementLib instance
Add NULL instance of TdxMeasurementLib.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Signed-off-by: Ceping Sun <cepingx.sun@intel.com>
2025-01-13 09:38:39 +00:00
Ceping Sun 94bfc6f0cb UefiCpuPkg: Add TdxMeasurementLib.h
Add below APIs to UefiCpuPkg.
- TdxMeasurementMapPcrToMrIndex
- TdxMeasurementHashAndExtendToRtmr
- TdxMeasurementBuildGuidHob

Cc: Ray Ni <ray.ni@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Signed-off-by: Ceping Sun <cepingx.sun@intel.com>
2025-01-13 09:38:39 +00:00
Hongbin1 Zhang 8c180acf1d StandaloneMmPkg/MmIpl: Correct FV HOB check founction
When at last hob, the FV HOB check function should
exit from the loop

Signed-off-by: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
2025-01-13 06:59:28 +00:00
Michael D Kinney 3c8f47bf21 EmulatorPkg/Win/Host: Use safe function _vsnprintf_s()
Update SecPrint() to use _vsnprintf_s() instead of
_vsnprintf() that is a safe function and allows the
defines _CRT_SECURE_NO_WARNINGS and _CRT_SECURE_NO_DEPRECATE
to be removed from WinHost builds.

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2025-01-13 05:36:40 +00:00
Michael D Kinney 4218026bd6 CryptoPkg/BaseCryptLib: Fix mktime() coding style issue
Move local variable init to C statements to follow
coding standard and remove the use of field names in
structure initialization to maximize compiler compatibility.

This issue was introduced by PR #6185

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2025-01-13 04:32:46 +00:00
Crystal Lee 96390bb8a5 UefiCpuPkg: Update return status to follow spec
SplitPage may return OUT_OF_RESOURCES if no memory resource to split
page entry. ConvertMemoryPageAttributes should also return
OUT_OF_RESOURCES instead of override the status to UNSUPPORTED.
Then EfiSetMemoryAttributes and EfiClearMemoryAttributes can return
correct status of OUT_OF_RESOURCES when requested attributes cannot
be applied due to lack of system resource.

Cc: Felix Polyudov <felixp@ami.com>
Cc: David Hsieh <davidhsieh@ami.com>
Cc: James Wang <jameswang@ami.com>
Signed-off-by: Crystal Lee <crystallee@ami.com>
2025-01-13 03:08:41 +00:00
Crystal Lee efaa102d00 UefiCpuPkg: Produce EFI memory attributes protocol
Produce the protocol introduced in UEFI v2.10 that permits the caller to
manage mapping permissions in the page tables.

Cc: Felix Polyudov <felixp@ami.com>
Cc: David Hsieh <davidhsieh@ami.com>
Cc: James Wang <jameswang@ami.com>
Signed-off-by: Crystal Lee <crystallee@ami.com>
2025-01-13 03:08:41 +00:00
Mike Maslenkin aaf0846fa2 ArmPkg: remove ArmGicAcknowledgeInterrupt function.
A compiler warning was detected that 'IntId' could be used uninitialized
in the `else` branch.
Since there are no consumers of this function, it was decided to remove
this function completely.

Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2025-01-12 15:52:05 +00:00
Amy Chan 11cffd9c3f CryptoPkg/BaseCryptLibMbedTls : Add strncpy() support to SecCryptLib
Mbedtls requires the use of strncpy(), but it is currently included in
DummyOpensslSupport.c, which is not part of Mbedtls SecCryptLib.
To resolve this, move strncpy() to CrtWrapper.c, as Mbedtls SecCryptLib
not depend on OpensslLib

Signed-off-by: Amy Chan <amy.chan@intel.com>
2025-01-11 16:17:10 +00:00
Khor Swee Aun c0533b7e22 OvmfPkg/SmmCpuPlatformHookLibQemu: Define IsCpuSyncAlwaysNeeded
This patch is to implement default IsCpuSyncAlwaysNeeded definition
for SmmCpuPlatformHookLibQemu. This interface will determine whether the first
CPU Synchronization should be executed unconditionally when a SMI occurs.

If the function returns true, it indicates that there is no need to check the system
configuration and status, and the first CPU Synchronization should be executed
unconditionally.

If the function returns false, it indicates that the first CPU Synchronization is
not executed unconditionally, and the decision to synchronize should be based on
the system configuration and status.

Signed-off-by: Khor Swee Aun <swee.aun.khor@intel.com>
2025-01-10 07:45:26 +00:00
Khor Swee Aun a8363bce36 Add SmmCpuPlatformHookLib IsCpuSyncAlwaysNeeded interface
This patch adds the IsCpuSyncAlwaysNeeded interface to the SmmCpuPlatformHookLib.
This interface will determine whether the first CPU Synchronization should be
executed unconditionally when a SMI occurs.

If the function returns true, it indicates that there is no need to check the
system configuration and status, and the first CPU Synchronization should be
executed unconditionally.

If the function returns false, it indicates that the first CPU Synchronization is
not executed unconditionally, and the decision to synchronize should be based on
the system configuration and status.

Signed-off-by: Khor Swee Aun <swee.aun.khor@intel.com>
2025-01-10 07:45:26 +00:00
Oliver Smith-Denny 21cbba1bb3 StandaloneMmPkg: Call PeCoffLoaderUnloadImage When Unloading Image
Today, StandaloneMmCore calls PeCoffLoaderRelocateImage() when loading
images, which calls PeCoffLoaderRelocateImageExtraAction(). On AARCH64,
this sets the image memory protections accordingly, RO + E on code
sections, RW + NX on data sections.

However, if an image fails to start (i.e. its entry point returns a
failure) StandaloneMmCore does not call the corresponding
PeCoffLoaderUnloadImage, which calls PeCoffLoaderUnloadImageExtraAction,
which on AARCH64 undoes the memory protections on the image, setting the
whole memory region back to RW + NX. The core then frees this memory
and the next allocation attempts to use it, which results in a data
abort if a read only memory region is attempted to be written to.
Theoretically, other instances of the PeCoffExtraActionLib could take
other actions and so regardless of architecture, the contract with the
PeCoffLoader should be maintained.

This patch calls PeCoffLoaderUnloadImage when an image's entry point
returns a failure, before freeing the image memory. This meets the
contract and follows the DXE core behavior.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-01-09 12:44:46 +00:00
Oleksandr Tymoshenko 9bb11cad9d EmbeddedPkg: Remove misleading error message in FindNextMemoryNodeReg
FindNextMemoryNodeReg prints "ignoring disabled memory node" for all
top-level disabled nodes in the tree, not just the ones with the
"device_type" property set to "memory". Rework the loop to only print
the message for the relevant nodes.

Signed-off-by: Oleksandr Tymoshenko <ovt@google.com>
2025-01-09 11:35:00 +00:00
Girish Mahadevan 107981f3f0 StandaloneMmPkg: Assert if dispatcher fails memory allocation
If the Dispatcher fails to allocate memory for the driver that it is
trying to load then ASSERT, else the Dispatcher silently stops loading
subsequent drivers from the FV.

Signed-off-by: Girish Mahadevan <gmahadevan@nvidia.com>
Reviewed-by: Jeff Brasen <jbrasen@nvidia.com>
2025-01-09 09:56:35 +00:00
Yang Gang 3ac092cf72 BaseTools: Clean up os.path.normcase and os.path.normpath usage
Refer to the docs of python, `os.path.normcase(path)` function:
"Normalize the case of a pathname. On Windows, convert all characters in
the pathname to lowercase, and also convert forward slashes to backward
slashes. On other operating systems, return the path unchanged."

`os.path.normpath(path)` also convert forward slashes to backward slashes.

So call `os.path.normcase` after `os.path.normpath` just convert path to
lowercase on Windows(only).

And Windows is case-insensitive but case-preserving.

So the usage of `os.path.normcase(os.path.normpath(path))` can be
simplified to `os.path.normpath(path)`. Then we can use case-preserving
paths rather than lowercase paths in compile_commands.json file
or build log.

But this patch continue to use `os.path.normcase`
when comparing/searching paths.

Signed-off-by: Yang Gang <yanggang@byosoft.com.cn>
2025-01-09 07:25:45 +00:00
Sarah Walker 8593eca048 ShellPkg: AcpiView: TPM2 parser for Arm FF-A
Add support for the ARM FF-A Start Method Specific Parameters to the TPM2
parser

Signed-off-by: Sarah Walker <Sarah.Walker2@arm.com>
2025-01-09 12:41:19 +08:00
Sarah Walker 14f5e9b098 ShellPkg: AcpiView: TPM2 Parser
Add a new parser for the TPM2 Table as specified in the TCG ACPI
Specification v1.4

Signed-off-by: Sarah Walker <Sarah.Walker2@arm.com>
2025-01-09 12:41:19 +08:00
Sarah Walker 7216013b36 MdePkg: Tpm2Acpi.h: Add defines for TPM2 ACPI table revision 5
Signed-off-by: Sarah Walker <Sarah.Walker2@arm.com>
2025-01-09 12:41:19 +08:00
INDIA\sachinganesh 1a23fe7472 MdeModulePkg: Update AtaPassThru to UEFI 2.10A
UEFI 2.10A Specification has added a new error case to
EFI_ATA_PASS_THRU_PROTOCOL.GetNextDevice API which handles
port multiplier not being connected to the Port.

Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
2025-01-09 12:40:45 +08:00
INDIA\sachinganesh 114b54e3fb MdePkg: Update AtaPassThru header to UEFI 2.10A
UEFI 2.10A Specification has added a new error case to
EFI_ATA_PASS_THRU_PROTOCOL.GetNextDevice API which handles
port multiplier not being connected to the Port.

Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
2025-01-09 12:40:45 +08:00
INDIA\sachinganesh bb129c6a82 SignedCapsulePkg: Clarify return status of Fmp Protocol GetImage()
Clarifed the return status of EFI_FIRMWARE_MANAGEMENT_PROTOCOL.GetImage().
As intended in UEFI 2.10 Specification.

Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
2025-01-09 12:40:45 +08:00
INDIA\sachinganesh 768adcd9c1 FmpDevicePkg: Clarify return status of FMP Protocol GetImage()
Clarifed the return status of EFI_FIRMWARE_MANAGEMENT_PROTOCOL.GetImage().
As intended in UEFI 2.10 Specification.

Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
2025-01-09 12:40:45 +08:00
INDIA\sachinganesh e4d74bb592 MdePkg: Add UEFI Specification macros
Add macros for UEFI 2.9 and UEFI 2.10 Specifications

Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
2025-01-09 12:40:45 +08:00
INDIA\sachinganesh a872cc18e0 MdePkg: Clarify return status of FMP Protocol GetImage()
Clarifed the return status of EFI_FIRMWARE_MANAGEMENT_PROTOCOL.GetImage().
As intended in UEFI 2.10 Specification.

Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
2025-01-09 12:40:45 +08:00
INDIA\sachinganesh 9144bb940a MdePkg: Update Default IP TTL
Default IP TTL (Time to Live) has been updated in UEFI 2.10 A
Specification. To comply with IANA recommendations.

REF: https://www.iana.org/assignments/ip-parameters/ip-parameters.xhtml#ip-parameters-2

Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
2025-01-09 12:40:45 +08:00
Alexander Gryanko 42a141800c BaseTools: Skip directories with code extensions in the name
Currently openssl has an Open Quantum Safe provider submodule with
directories like oqs-provider/oqs-template/oqsprov/oqsprov.c or
oqs-provider/oqs-template/oqsprov/oqsprov/oqsprov_capabilities.c
that are used as templates, but DebugMacroCheck tries to read them
as a file when recursively traversing the subdirectories.

Fail message:

  File "/usr/lib/python3.10/pathlib.py", line 1119, in open
    return self._accessor.open(self, mode, buffering, encoding, errors,
  IsADirectoryError: [Errno 21] Is a directory: '/CryptoPkg/Library
/OpensslLib/openssl/oqs-provider/oqs-template/oqsprov/oqsprov.c'

Signed-off-by: Alexander Gryanko <xpahos@gmail.com>
2025-01-07 04:56:24 +00:00
Phil Noh 7e03c40659 MdePkg: Update BASE_CR macro in Base.h for a Coverity error
Coverity is a static analysis tool. It detects the macro as an error
(case to incompatible type, cert_exp39_c_violation). The update resolves
the error and supports compliance with the static analysis tool.

Signed-off-by: Phil Noh <Phil.Noh@amd.com>
2025-01-07 09:28:02 +08:00
Pedro Tôrres f6e19abd97 OvmfPkg/VirtioSerialDxe: respond CONSOLE_PORT with PORT_OPEN
The VirtIO spec states that "Upon receipt of a
VIRTIO_CONSOLE_CONSOLE_PORT message, the driver SHOULD treat the port in
a manner suitable for text console access and MUST respond with a
VIRTIO_CONSOLE_PORT_OPEN message, which MUST have value set to 1". See
https://docs.oasis-open.org/virtio/virtio/v1.3/virtio-v1.3.html#x1-3330002.

The current driver implementation, however, does not comply with that
and only sends PORT_OPEN messages upon receipt of PORT_OPEN messages.
This causes a problem in platforms like Apple's Virtualization
Framework, where PORT_OPEN messages are not sent back to the driver
after CONSOLE_PORT messages are received by the device, a behaviour that
is compliant with the VirtIO specification.

This patch addresses this issue by always responding CONSOLE_PORT
messages with PORT_OPEN messages.

Signed-off-by: Pedro Tôrres <t0rr3sp3dr0@gmail.com>
2025-01-04 15:55:02 +00:00
Nickle Wang dca265a8ca RedfishPkg/RedfishPlatformConfigDxe: check attribute max. and min. value
- For integer attribute, check and see if its value is between maximum
and minimum value defined by HII question.
- For string attribute, check and see if its string length is between
maximum string length and minimum string length defined by HII question.

Signed-off-by: Nickle Wang <nicklew@nvidia.com>
2025-01-03 01:48:57 +00:00
Joey Vagedes a7cc0014d2 FatPkg: CI: Add PrEval entry
Adds a PrEval entry to the package's ci.yaml file which is used to
verify if the package uses a particular library instance when that
library instance file (INF) is updated.

When a library instance file (INF) is updated, PrEval will review each
package's DSC as described in the ci.yaml file to determine if the
package uses said library instance. If the package does use the library
instance, it will be built and tested to ensure the package is not
broken from the change.

Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
2025-01-02 23:33:46 +00:00
Kalavakolanu, Hema Anmisha 62de957185 CryptoPkg: Add sleep() function to BaseCryptLibMbedTls
In BaseCryptLib sleep() function is defined,
apply the same sleep function to BaseCryptLibMbedTls

Signed-off-by: "Kalavakolanu, Hema Anmisha" <hema.anmisha.kalavakolanu@intel.com>
2025-01-02 12:28:51 +00:00
Bing Luo 070eadb550 NetworkPkg/UefiPxeBcDxe: Bugfix for pxe driver
Ensure the poniter is not null before free it

Signed-off-by: Bing Luo <robin.luo@jaguarmicro.com>
2024-12-31 23:26:19 +00:00
Linus Liu a2263cb201 UefiPayloadpkg Add Missing part back
Add back reg attribute of pcirootbridge

Signed-off-by: Linus Liu <linus.liu@intel.com>
2024-12-30 16:49:59 +00:00
Linus Liu 105a62d3ac UefiPayloadPkg :Update RetrieveMultiSegmentInfoFromHob
Merge the PCI root bridge with the same segment address within one.
PciSegment element.

UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentInfoLibAcpiBoardInfo.c

Signed-off-by: Linus Liu <linus.liu@intel.com>
2024-12-30 16:49:59 +00:00
Paweł Poławski fc140c5eae OvmfPkg: Enable virtio keyboard driver for Ia32x64 OVMF platform
Signed-off-by: Paweł Poławski <ppolawsk@redhat.com>
2024-12-29 19:19:59 +01:00
Paweł Poławski ce4317b4c8 OvmfPkg: Enable virtio keyboard driver for X64 OVMF platform
Signed-off-by: Paweł Poławski <ppolawsk@redhat.com>
2024-12-29 19:19:59 +01:00
Paweł Poławski 573057cb1d ArmVirtPkg: Enable virtio keyboard driver for ARM OVMF platform
Signed-off-by: Paweł Poławski <ppolawsk@redhat.com>
2024-12-29 19:19:59 +01:00
Paweł Poławski 8bc9f5a2bc OvmfPkg: Virtio based keyboard driver implementation
This is virtio based keyboard driver designed to be used on ARM platform.
The driver implements basic and extended text input interface.

UEFI shell requires only basic text input interface, but Grub needs
extended text input to work on.

Signed-off-by: Paweł Poławski <ppolawsk@redhat.com>
2024-12-29 19:19:59 +01:00
Paweł Poławski 0eea7b9c02 OvmfPkg: Add virtio keyboard device hooks
This commit adds:
- missing virtio subsystem ID for input device
- PrepareVirtioKeyboardDevicePath() handler to boot manager library

Signed-off-by: Paweł Poławski <ppolawsk@redhat.com>
2024-12-29 19:19:59 +01:00
Igor Kulchytskyy 0986082d7e Redfish/HiiUtilityLib Fix incorrect type assignment
Replaced direct assignment of 'Value = (EFI_HII_VALUE *)&Question->Value'
with the correct usage of HiiStatementValueToHiiValue function.
This resolves the issue where EFI_HII_VALUE and HII_STATEMENT_VALUE types
are incompatible, ensuring proper handling of Question->Value.

Signed-off-by: Igor Kulchytskyy <igork@ami.com>
2024-12-27 09:06:40 +00:00
Huang Yuqi 9e6537469d MdePkg: UefiDevicePathLib: Add Display Only format for Hard Drive.
Ref: UEFI Specification Version 2.1 (Errata D) (released October 2008)

Signed-off-by: Huang Yuqi <huangyq13@lenovo.com>
2024-12-25 07:11:33 +00:00
Ajan Zhong f39b121066 UefiPayloadPkg: Align base address for ACPI region
In platform which support ACPI 2.0 only, the base address of ACPI region
is not page aligned. This unalinged base address leads to failure at
BuildMemoryAllocationHob when parsing ACPI node in FdtParserLib, before
building gUniversalPayloadAcpiTableGuid GUID HOB.

Align base address of ACPI region down to EFI_PAGE_SIZE to make sure
base address always aligned.

Signed-off-by: Ajan Zhong <ajan.zhong@newfw.com>
2024-12-25 04:11:32 +00:00
Du Lin da6504e5cc IntelFsp2WrapperPkg: Save FspHobListPtr right after FspMemoryInit exits
Save FspHobList pointer to HOB right after FspMemoryInit exits so that
FspHobList pointer is available when performing platform related reset
in CallFspWrapperResetSystem(). Some platforms may consume FSP HOBs
prior to performing platform related reset.

Signed-off-by: Du Lin <du.lin@intel.com>
2024-12-25 02:56:26 +00:00
Ashraf Ali 1cc78814cd Remove dependancy on re.T
Signed-off-by: Ashraf Ali <ashraf.ali.s@intel.com>
2024-12-24 07:32:42 +00:00