6159 Commits

Author SHA1 Message Date
Marvin Häuser
fd7f3b94b1 BaseTools: Introduce new HII section design 2023-05-10 10:22:23 +03:00
Marvin Häuser
5c75aaa8a7 Remove hacks related to former lack of XCODE5 .hii support 2023-05-10 10:22:22 +03:00
Marvin Häuser
1c6925aaa2 Drop support for the TE format 2023-04-12 19:56:18 +03:00
Marvin Häuser
c3f671eff1 BaseTools/Common: Fix aligned page alloc functions 2023-04-11 09:51:04 +02:00
Marvin Häuser
cd0e8aa6ad MdeModulePkg/ExtendedFirmwarePerformance: Fix FPDT struct alignment 2023-04-10 17:39:25 +02:00
Marvin Häuser
a07a2ce546 MdeModulePkg/DxeCore: Fix MAT generation 2023-04-10 10:31:53 +02:00
Mikhail Krichanov
d477fd49b1 MdeModulePkg/DxeCore: Use correct type for alignment mask
The page allocator code in CoreFindFreePagesI() uses a mask derived from
    its UINTN Alignment argument to align the descriptor end address of a
    MEMORY_MAP entry to the requested alignment, in order to check whether
    the descriptor covers enough sufficiently aligned area to satisfy the
    request.

    However, on 32-bit architectures, 'Alignment' is a 32-bit type, whereas
    DescEnd is a 64-bit type, and so the resulting operation performed on
    the end address comes down to masking with 0xfffff000 instead of the
    intended 0xffffffff_fffff000. Given the -1 at the end of the expression,
    the resulting address is 0xffffffff_fffffffff for any descriptor that
    ends on a 4G aligned boundary, and this is certainly not what was
    intended.

    So cast Alignment to UINT64 to ensure that the mask has the right size.

    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Reported-by: Nathan Chancellor <nathan@kernel.org>
    Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-04-09 17:33:52 +02:00
Marvin Häuser
35731d9829 UefiImageLib: Ensure consistently passing the full buffer size 2023-04-02 00:04:47 +02:00
Marvin Häuser
e15d23ca81 MdeModulePkg/RegularExpressionDxe: Fix XCODE5 build 2023-04-02 00:04:46 +02:00
Marvin Häuser
eea8ba4030 MdePkg/UefiImageLib: Require callers to allocate aligned memory 2023-03-30 17:15:14 +02:00
Marvin Häuser
227871ad94 MdePkg/MemoryAllocationLib: Add Allocate(Aligned)CodePages 2023-03-30 16:18:09 +02:00
Marvin Häuser
b5b858f990 MdePkg: Introduce CommonMemoryAllocationLib 2023-03-30 16:18:09 +02:00
Marvin Häuser
cc4427d20c MdeModulePkg: Manage MemoryProfileLib separately 2023-03-30 16:18:09 +02:00
Marvin Häuser
dff189ca49 MdeModulePkg/DxeCore: Remove orphaned CoreReadImageFile() 2023-03-30 00:18:28 +02:00
Marvin Häuser
059e6ecef9 MdeModulePkg/CorePei: Remove unused ShadowedImageRead member 2023-03-30 00:18:28 +02:00
Marvin Häuser
2428dcb8c9 MdeModulePkg/DxeCore: Fix RelocationData type 2023-03-29 21:37:14 +02:00
Marvin Häuser
f5fe05bccc EmulatorPkg: Fix some image loader related issues 2023-03-29 19:57:33 +02:00
Marvin Häuser
fbb0bac451 MdeModulePkg/PiSmmCore: Fix fixed address loading 2023-03-28 15:55:57 +02:00
Mikhail Krichanov
26a4d6faf2 MdeModulePkg: Removed ASSERT to facilitate boot of AARCH64 firmware. 2023-03-16 15:33:03 +03:00
Mikhail Krichanov
be0b5fc5da MdeModulePkg: Fixed code style. 2023-03-16 15:33:03 +03:00
Mikhail Krichanov
30d425b06f MdePkg: Included BaseLib.h in DebugLib.h as it's needed for CpuBreakpoint(). Reverted minor changes. 2023-03-16 12:20:13 +03:00
Mikhail Krichanov
adfdda5fca Build: Removed unnecessary !include MdePkg/MdeBuildOptions.dsc.inc. 2023-03-16 12:20:13 +03:00
Mikhail Krichanov
6117177c2e BaseTools: Added MDEPKG_REDUCE_FW_SIZE and MDEPKG_MERGE_RODATA_INTO_TEXT build options. 2023-03-16 12:20:13 +03:00
vit9696
0dfb926bb5 MdeModulePkg/Core: Fix DxeCore entry not being added to DebugTable
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
2023-02-12 11:23:14 +03:00
Savva Mitrofanov
ff658eb1a2
MdeModulePkg/BrotliCustomDecompressLib: Disable C4559 MSVC warning
Disables redefinition warning due to win 10 sdk to fix build using MSVC
toolchain

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2023-02-06 16:20:09 +06:00
Savva Mitrofanov
d004754540
MdeModulePkg: Update brotli submodule
Update the brotli submodule to the latest commit (ed1995b6bda1)
so that the build isn't broken in GCC 12 compilers.

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2023-02-06 16:20:07 +06:00
Savva Mitrofanov
7f5dbfa5f9
MdeModulePkg/DebugSupportDxe: Corrects MSVC build
Fixes 6c974ab21e212c1867c871f989f6f1df5786e99e by supressing type cast
warning for MSVC

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2023-01-18 16:19:36 +06:00
Mikhail Krichanov
ef68b89fbc SecurePE: Replaced old PE loader with Secure one. 2022-12-28 17:08:53 +03:00
Savva Mitrofanov
f625249b1e
MdeModulePkg/CapsuleApp: Add missing EFIAPI modifier in CapsuleDump
Fixes calling conventions by defining CompareFileNameInAlphabet with
ms_abi

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-28 13:12:09 +06:00
Savva Mitrofanov
6c974ab21e
MdeModulePkg/DebugSupportDxe: Adds callback function prototypes in
caller

Adds EFI_EXCEPTION_CALLBACK and EFI_PERIODIC_CALLBACK casts to
RegisteredCallback call in InterruptDistributionHub to suppress
deprecated non-prototype LLVM 15 warning

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-28 13:12:03 +06:00
Savva Mitrofanov
d9a6e6736c
MdeModulePkg/CapsuleOnDiskLoadPei: Removes unused Index variable
Removes unused Index local variable in RetrieveRelocatedCapsule to
suppress compiler warning in LLVM 15

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-28 13:11:52 +06:00
Savva Mitrofanov
25ce5524c9
MdeModulePkg/RegularExpressionDxe: Corrects onigurama build with LLVM 15
Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-26 16:37:58 +06:00
Savva Mitrofanov
2b7d183551
MdeModulePkg/VarCheckHiiLib: Remove unused variable FfsIndex
Corrects compiler warning due to unused variable in VarCheckHiiGenFromFv

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-26 16:34:27 +06:00
Savva Mitrofanov
a18c196866
MdeModulePkg/SmbiosMeasurementDxe: Removes unused local variable
Removes unused local variable Size in GetSmbiosStringById

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-23 22:53:26 +06:00
Savva Mitrofanov
bc19befe04
MdeModulePkg/BrotliCustomDecompressLib: Correct BrotliDecompress
We need to pass DestSize as pointer, because we assign this output var
to TotalOut value inside BrotliDecompress routine

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-23 22:53:25 +06:00
Vitaly Cheptsov
3e7b9f1471
ShellPkg: Add support for input with separately reported modifiers
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2510

Some firmwares:
- Report Shift modifier even when they report upper-case unicode letter.
- Report Ctrl modifier with "shifted" UniChar (i.e. X - 'A' + 1).

This change provides support for these firmwares preserving the compatibility
with the previous input handling.

Signed-off-by: Michael Belyaev <usrsse2@icloud.com>
Reviewed-by: Vitaly Cheptsov <vit9696@protonmail.com>
2022-12-05 15:56:49 +06:00
Sivaparvathi C
ee3da09bb2 MdeModulePkg/Ufs :Coverity scan flags multiple issues in edk2-stable202205
BugZilla ID:https://bugzilla.tianocore.org/show_bug.cgi?id=3989

Added changes to resolve the Coverity Issues in UFS driver

Cc: Vasudevan Sambandan <vasudevans@ami.com>
Cc: Sundaresan Selvaraj <sundaresans@ami.com>
Signed-off-by: Sivaparvathi Chellaiah <sivaparvathic@ami.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2022-11-04 03:59:20 +00:00
Sivaparvathi C
eae9e51d98 MdeModulePkg/scsi :Coverity scan flags multiple issues in edk2-stable202205
Added changes to resolve the SCSI driver Coverity issues.

Cc: Vasudevan Sambandan <vasudevans@ami.com>
Cc: Sundaresan Selvaraj <sundaresans@ami.com>
Signed-off-by: Sivaparvathi chellaiah <sivaparvathic@ami.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2022-11-04 03:59:20 +00:00
Miki Demeter
cab1f02565 MdeModulePkg/PiSmmCore: SmmEntryPoint underflow (CVE-2021-38578)
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3387

Added use of SafeIntLib to validate values are not causing overflows or
underflows in user controlled values when calculating buffer sizes.

Signed-off-by: Miki Demeter <miki.demeter@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2022-11-04 01:58:20 +00:00
Min M Xu
43e306806e MdeModulePkg: Update Dxe to handle unaccepted memory type
RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3937

Unaccepted memory is a kind of new memory type,
CoreInitializeGcdServices() and CoreGetMemoryMap() are updated to handle
the unaccepted memory type.

Ref: microsoft/mu_basecore@97e9c31

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Min Xu <min.m.xu@intel.com>
2022-11-01 10:08:10 +00:00
Min M Xu
502c01c502 MdePkg: Add UEFI Unaccepted memory definition
RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3937

Plase refer to:
  UEFI Spec v2.9 Table 7-5 Memory Type Usage before ExitBootServices()

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Min Xu <min.m.xu@intel.com>
2022-11-01 10:08:10 +00:00
Min M Xu
00bbb1e584 MdeModulePkg: Add PrePiHob.h
RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3937

BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED is defined for unaccepted memory.
But this defitinion has not been officially in the PI spec. Base
on the code-first we define BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED at
MdeModulePkg/Include/Pi/PrePiHob.h.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Min Xu <min.m.xu@intel.com>
2022-11-01 10:08:10 +00:00
Cheripally Gopi
52199bf532 MdeModulePkg/ScsiDiskDxe: Update proper device name for ScsiDisk drive
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4100

ScsiDiskDxe driver updates ControllerNameTable with common string
"SCSI Disk Device" for all SCSI disks. Due to this, when multiple
SCSI disk devices connected, facing difficulty in identifying correct SCSI
disk device. As per SCSI spec, standard Inquiry Data is having the fields
to know Vendor and Product information. Updated "ControllerNameTable" with
Vendor and Product information. So that, device specific name can be
retrieved using ComponentName protocol.

Cc: Vasudevan Sambandan <vasudevans@ami.com>
Cc: Sundaresan Selvaraj <sundaresans@ami.com>
Signed-off-by: Cheripally Gopi <gopic@ami.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2022-10-31 02:46:52 +00:00
Nate DeSimone
7464db4474 MdeModulePkg: Fix spelling error in PciSioSerialDxe
gSerialDevTempate should be gSerialDevTemplate

Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2022-10-25 22:30:33 +00:00
Matt DeVillier
db2c22633f Ps2KbdCtrller: Make wait for SUCCESS after BAT non-fatal
Recent model Chromebooks only return ACK, but not
BAT_SUCCESS, which causes hanging and failed ps2k init.
To mitigate this, make the absence of BAT_SUCCESS reply
non-fatal, and reduce the no-reply timeout from 4s to 1s.

Tested on google/dracia and purism/librem_14

Acked-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
2022-10-25 15:58:27 +08:00
jdzhang
c6720db5dd MdeModulePkg/XhciDxe: Add boundary check for TRB ring allocation
According the Xhci Spec, TRB Rings may be larger than a Page, however they
shall not cross a 64K byte boundary, so add a parameter to indicate
whether the memory allocation is for TRB Rings or not. It will ensure the
allocation not crossing 64K boundary in UsbHcAllocMemFromBlock if the
memory is allocated for TRB Rings.

Signed-off-by: jdzhang <jdzhang@kunluntech.com.cn>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2022-10-20 03:23:51 +00:00
Foster Nong
8fc06b6e19 Fix bug on SRIOV ReservedBusNum when ARI enable.
If a device which support both features SR-IOV/ARI  has multi
functions, which maybe support 8-255. After enable ARI forwarding in
the root port and ARI Capable Hierarchy in the SR-IOV PF0.
The device will support and expose multi functions(0-255) with ARI ID routing.
In next device loop in below for() code, actually it still be in the
same SR-IOV device, and just some PF which is over 8 or higher
one(n*8), PciAllocateBusNumber() will allocate bus
number(ReservedBusNum - TempReservedBusNum)) for this PF. if reset
TempReservedBusNum as 0 in this case,it will allocate wrong bus number
for this PF because TempReservedBusNum should be total previous PF's
reserved bus numbers.

code:
  for (Device = 0; Device <= PCI_MAX_DEVICE; Device++) {
    TempReservedBusNum = 0;
    for (Func = 0; Func <= PCI_MAX_FUNC; Func++) {
    //
    // Check to see whether a pci device is present
    //
    Status = PciDevicePresent (
                 PciRootBridgeIo,
                 &Pci,
                 StartBusNumber,
                 Device,
                 Func
                 );
    ...
    Status = PciAllocateBusNumber (PciDevice, *SubBusNumber,
    (UINT8)(PciDevice->ReservedBusNum - TempReservedBusNum), SubBusNumber);

The solution is add a new flag IsAriEnabled to help handle this case.
if ARI is enabled, then TempReservedBusNum will not be reset again
during all functions(1-255) scan with checking flag IsAriEnabled.

Signed-off-by: Foster Nong <foster.nong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
2022-10-14 07:07:01 +00:00
Foster Nong
4aa7e66c06 MdeModulePkg: Fixed extra 1 SR-IOV reserved bus
Below code will calculate the reserved bus number for the each PF.

Based on the VF routing ID algorithm, PFRid and LastVF in below code
already sure that "All VFs and PFs must have distinct Routing IDs".
PF will be assigned Routing ID based on secBusNumber, ReservedBusNum
will add into SubBusNumber directly. So the SR-IOV device will be
assigned bus range as SecBusNumber ~ (SubBusNumber=(SecBusNumber +
ReservedBusNum)).
Thus "+1" in below code will cause extra 1 bus, and introduce a bus hole.

 PFRid  = EFI_PCI_RID (Bus, Device, Func);
 LastVF = PFRid + FirstVFOffset + (PciIoDevice->InitialVFs - 1) * VFStride;
 PciIoDevice->ReservedBusNum = (UINT16)(EFI_PCI_BUS_OF_RID (LastVF) -
 Bus + 1);

In SR-IOV spec, there is a note in section 2.1.2:
Note: Bus Numbers are a constrained resource. Devices are strongly
encouraged to avoid leaving ?holes? in their Bus Number usage to avoid
wasting Bus Numbers

So the issue can be fixed with below code change.
  PciIoDevice->ReservedBusNum = (UINT16)(EFI_PCI_BUS_OF_RID (LastVF) -
  Bus);

https://bugzilla.tianocore.org/show_bug.cgi?id=4069

Signed-off-by: Foster Nong <foster.nong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
2022-10-14 07:07:01 +00:00
Chao Li
2ce4bfb843 MdeModulePkg/DxeIplPeim : LoongArch DxeIPL implementation.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4053

Implement LoongArch DxeIPL instance.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Guomin Jiang <guomin.jiang@intel.com>

Signed-off-by: Chao Li <lichao@loongson.cn>
Co-authored-by: Baoqi Zhang <zhangbaoqi@loongson.cn>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2022-10-14 02:16:33 +00:00
Chao Li
380821a949 MdeModulePkg/CapsuleRuntimeDxe: Add LoongArch64 architecture.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4053

Add LoongArch in INF for building CapsuleRuntimeDxe LoongArch64 image.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Guomin Jiang <guomin.jiang@intel.com>

Signed-off-by: Chao Li <lichao@loongson.cn>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2022-10-14 02:16:33 +00:00