Memory Attributes Table needs to be updated to contain executable
permissions for UEFI runtime drivers loaded after EndOfDxe.
Fixes a regression introduced by bb248a9.
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
Following the APs now always initializing separate exception
stacks, this commit always initializes a separate exception
stack for the BSP as well. Previously, this was only enabled
when PcdCpuStackGuard was set.
However, even when a stack guard page is not present,
stack overflows can still occur and corrupt the stack; if an
exception is taken here, it is still valuable to have a separate
exception stack for sanity.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
Currently, CpuExceptionHandlerLibNull returns EFI_UNSUPPORTED for
InitializeSeparateExceptionStacks. However, CpuMpPei, CpuDxe, and
DXE Core are all moving to call this function unconditionally and
expect it returns success. As such, the null lib is updated to
return success.
This fixes a hang on EmulatorPkg where DXE Core asserts if this
function returns an error.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
Added "PublishTables()" and "SdtNotifyAcpiList()" for completing
AddTableToList behavior in the InstallAcpiTableFromAcpiSiliconHob().
Signed-off-by: George Liao <george.liao@intel.com>
Clearing wrong memory content after allocated memory for XSDT,
which caused AcpiSdtProtocol cannot be installed and
unexpected behavior.
According to the UEFI spec and commit message of "PCD switch to
avoid using ACPI reclaim memory", so need to add this support in the
InstallAcpiTableFromAcpiSiliconHob().
1. Fixed memory corruption issue in the
InstallAcpiTableFromAcpiSiliconHob().
2. Added "PCD switch to avoid using ACPI reclaim memory" support in
the InstallAcpiTableFromAcpiSiliconHob().
Signed-off-by: George Liao <george.liao@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>
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, 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>
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>
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>
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>
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>
If `AbsoluteMaxZ`/`ResolutionZ` is 0, it means z-axis is not supported.
When getting AbsolutePointer/SimplePointer Protocol Interface and mouse
state from `gST->ConsoleInHandle`, `AbsoluteMaxZ`/`ResolutionZ` is checked,
so AbsState.CurrentZ/SimpleState.RelativeMovementZ is always 0.
Assign a valid value to `AbsoluteMaxZ`/`ResolutionZ` to indicate
z-axis support.
Signed-off-by: Yang Gang <yanggang@byosoft.com.cn>
edk2 is dropping support for the ARM32 architecture. This
commit removes ARM32 support from MdeModulePkg. This also
drops irrelevant VALID_ARCHITECTURE comments from infs that
are not arch specific.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
Adjust AnsiTestString to be compatible with wide/narrow string in
TerminalDxe driver. If WIDE_CHAR or NARROW_CHAR is hit, the string
is still valid since OutputString function will correctly handle it.
Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
Add four newly added terminal types in TerminalConOutTestString, although
this function is rarely used. This patch is a supplement to previous patch
8a53ea9d9f.
Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
The current fixed value of 8 for `DELAYED_DISPATCH_MAX_ENTRIES` is
not large enough to accommodate platform usage. This change replaces
the macro with a PCD that can be configured by platforms.
In the case the default PCD value is too small, an error message
explaining that the PCD should be updated will be printed followed
by an assert.
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Fix mimatched macro name of include guard in
MockSecurityManagementLib.h. This was found with unit test
build using CLANGDWARF.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Remove default from checkbox statement that is not part
of the checkbox statement syntax to remove VFR compiler
warning.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Build failed with the below error:
error: variable 'Status' is used uninitialized when
PcdUnicodeCollation2Support is FALSE.
Fixing this issue by initializing Status unconditionally.
This is a regression issue caused by below Edk2 commit
a46697f735
Signed-off-by: HemaAnmisha <hema.anmisha.kalavakolanu@intel.com>
There are a lot of notify callback events for Event Groups. Usually they
are not reported unless there is a debug code in the callback itself.
The debug message helps to check which/when the callback is registered and
executed in POST. Also helps to notice the callback sequence. It depends
on DEBUG_EVENT flag enabled by PcdFixedDebugPrintErrorLevel PCD token.
Signed-off-by: Phil Noh <Phil.Noh@amd.com>
ArmFfaRxTxMap.c is built by both ArmFfaPeiLib and ArmFfaDxeLib.
ArmFfaSecRxTxMap.c is built by ArmFfaSecLib.
ArmFfaStandaloneMmRxTxMap.c is built by ArmFfaStandaloneMm*Lib.
The files depend on `MemoryAllocationLib` APIs such as
`AllocateAlignedPages()`. This change adds `MemoryAllocationLib` to
those library INF files.
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
ArmFfaCommon.c is built by both ArmFfaStandaloneMmCoreLib and
ArmFfaStandaloneMmLib. It links against HobLiib APIs such as
`GetFirstHob()`. Right now, the symbols fail to link:
```
lld-link: error: undefined symbol: GetFirstHob
ArmFfaStandaloneMmCoreLib.lib(ArmFfaCommon.obj)
```
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
commit b534cabbda ("ArmFfaLib: Add Rx/Tx support for Stmm secure partition")
makes ArmFfaStandlaoneMm(Core)Lib map Rx/Tx buffer in its constructor.
This makes a failure of loading StandaloneMm in legacy platform
which doesn't implements Rx/Tx buffer related API since it doesn't need to.
StandaloneMm could be only service provider not cosumer in some platform
where doesn't need to map RxTx buffer.
Therefore, Considier EFI_UNSUPPORTED return in ArmFfaStandaloneMmLib's
constructor.
Fixes: b534cabbda ("ArmFfaLib: Add Rx/Tx support for Stmm secure partition")
Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
When ArmFfaLibDirectMsgReq(2) is preempted, caller of these functions
should resume it works via ArmFfaLibRun() and the secure partition
will be return with FFA_DIRECT_MSG_RESP(2) with return arguments.
However, since ArmFfaLibRun() gets its return in its stack variable,
So caller of ArmFfaLibRun() doesn't get the return arguments from
secure partition.
To resolve this, add output parameter to ArmFfaLibRun() to
receive return arguments.
Continuous-integration-options: PatchCheck.ignore-multi-package
Fixes: 5d1b38dd07 ("ArmPkg: Add ArmFfaLib used in Dxe driver")
Reported-by: Mariam Elshakfy <Mariam.Elshakfy@arm.com>
Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
RealTimeClockLib is an architectural implementation that is not
restricted to the embedded segment or any platform in particular.
So the header has been moved to MdeModulePkg.
And the package has been added to the relevant INF files.
Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
Adding to the previous commit deprecating
EFI_UNICODE_COLLATION_PROTOCOL_GUID in MdeModulePkg.
Cc: Sachin Ganesh <sachinganesh@ami.com>
Signed-off-by: Gowtham M <gowthamm@ami.com>
Commit 9224a2b917
adds support for larger terminal dimensions; however, the ANSI control
sequences to manipulate the terminal cursor are not built to accomodate
terminal dimensions that are three digits long.
For example, suppose we want to move the cursor 163 columns to the
right. The required control sequence would be `^[[163C`; however, the
existing code will create a control sequence of `^[[@3C` due to trying
to add 16 to the character '0' instead of either 1 or 6.
This fix adds a third digit to the sequence templates for moving the
cursor forward, moving it backwards, and setting the cursor position.
Signed-off-by: Jack Little <jack.tay.little@hpe.com>
When set to TRUE, bit EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED of
OsIndications is set.
At the moment EDK never sets this bit (there is only definition with no
uses), maybe nothing actually checks its value. Whatever the reason is,
it seems like a good idea to make setting it possible.
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
When a BIOS implementation splits the PEIMs in multiple firmware volumes and
the FVs are reported to PEI Core by different PEIMs at different time,
it is hard to conclude the exact FV dispatch order.
The change updates the existing PEI dispatch logic to print the GUID of the
firmware volume and the FFS file which contains a nested FV.
It helps developers to match the FV being dispatched to the FV defined in
FDF file.
Signed-off-by: Ray Ni <ray.ni@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Fix TestString() to be compatible with wide/narrow string in
GraphicsConsole driver. If WIDE_CHAR or NARROW_CHAR is hit in
TestString function, ignore it since OutputString function will
correctly handle it.
Fix OutputString() to skip wide/narrow char in TerminalDxe. Because
they are not displayable in terminal emulation tool, ingore to
output if they are hit in OutputString function.
Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
According to UEFI Spec, only Bit0...6 is valid in mode attribute, other
bits are undefined and must be 0. So attribute with EFI_WIDE_ATTRIBUTE
is unacceptable as EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetAttribute() input
parameter. In current PrintInternal function, wide character removed
WIDE_CHAR, and is used as EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString()
input parameter. So, wide character is mistakenly be treated as narrow
character.
Because EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString() can handle unicode
string with NARROW_CHAR and WIDE_CHAR, we can directly invoke
OutputString() with whole unicode string in PrintInternal function instead
of separated wide/narrow string. And then, the logic of computing unicode
string width is also simplified.
Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
If string default is set to zero in vfr file and VfrCompile may not
found the invalid operation, assert is trigged. This patch will check
whether StringId is 0 to avoid assert.
Cc: Chao Li <lichao@loongson.cn>
Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
As noted in the comment above the callback invocation,
the URB's callback may free the URB, so any
operations, including updates, must occur before the callback.
Signed-off-by: Sherry Fan <sherryfan@microsoft.com>
`XhcFreeUrb` attempts to unmap `Urb->DataMap` after
`FreePool(Urb->Data)` has already been called in some cases, causing a
use after free. Change the ordering so `Data` is freed after `Unmap`and
only freed when appropriate.
Signed-off-by: Sherry Fan <sherryfan@microsoft.com>
Add SkipHceReenable and SkipLinkStartup flags to
the EDKII_UFS_HC_PLATFORM_PROTOCOL to support
using a UFS controller that has already been
initialized.
Signed-off-by: Bob Morgan <bobm@nvidia.com>
This PPI is no longer used - the EHCI and XHCI host controller PEIMs
expose PEI_USB2_HOST_CONTROLLER_PPI instead.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
There are two versions of the USB host controller PPI, and only the
newer one, called PEI_USB2_HOST_CONTROLLER_PPI, is actually produced by
the EHCI and XHCI host controller PEIMs in EDK2. (The other PPI was only
produced by UhciPei which has been removed)
So remove all the conditionally executed code based on the distinction
between the two PPIs, and only support the newer one.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Remove the UHCI PEI module, which is unused (in edk2-platforms) and
obsolete. It also implements an older version of the USB host controller
PPI, which can be dropped from EDK2 entirely once this driver is gone.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
The ramdisk is modelled as an NVDIMM which have a naturally higher
alignment than 4K. Operating systems may wish to map NVDIMMs using large
pages, so force the allocation alignment to 2MB.
This change was tested using HTTP ramdisk boot, targeting a flat windows
image.
Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
Move PcdSerialRegisterBase from [PcdsFixedAtBuild, PcdsPatchableInModule]
section to [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic,
PcdsDynamicEx] section to enable dynamic configuration.
Signed-off-by: Pranav V V <pranav.v.v@intel.com>
The various cores all attempt to print the EfiFileName when
loading/dispatching drivers, but they are not unified on
approach. This commit ensures they are using the same buffer
size and the loop parsing variables are unsigned, as we should
not have a negative index.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>