Commit graph

1177 commits

Author SHA1 Message Date
Mayank Kumar
c9eb3717b4 MdeModulePkg: ScsiDiskDxe: Query Write Protected State
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>
2025-10-16 12:25:52 +00:00
nick.wang
0cad130cb4 MdeModulePkg : Clear keyboard queue buffer after reading
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>
2025-10-09 08:02:51 +00:00
Yang Gang
7b971810b0 MdeModulePkg: Update to support mouse z-axis in ConSplitterDxe
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>
2025-09-29 01:10:22 +00:00
Oliver Smith-Denny
ef79d58427 MdeModulePkg: Remove ARM32 Support
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>
2025-09-25 22:04:10 +00:00
Yang Gang
fa92e9bd05 MdeModulePkg UsbMouseDxe: Correct some parameter comments
Signed-off-by: Yang Gang <yanggang@byosoft.com.cn>
2025-09-02 10:55:44 +08:00
Sherry Fan
8d984e6a57 MdeModulePkg: XhciDxe: Fix comment grammar in XhcMonitorAsyncRequests
Clarify wording of the comment before the callback in XhcMonitorAsyncRequests.

Signed-off-by: Sherry Fan <sherryfan@microsoft.com>
2025-08-11 18:15:25 +00:00
Sherry Fan
6d37ca427e MdeModulePkg: XhciDxe: Fix USB reset issue: callback / update order
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>
2025-08-11 18:15:25 +00:00
Sherry Fan
e69d7653b9 MdeModulePkg: XhciDxe: Fix USB reset issue: use after free
`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>
2025-08-11 18:15:25 +00:00
Bob Morgan
b58ce4c226 MdeModulePkg: Support conditional UFS initialization
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>
2025-08-08 09:06:56 +08:00
Ard Biesheuvel
44d88d5d0c MdeModulePkg: Remove obsolete PEI_USB_HOST_CONTROLLER_PPI
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>
2025-08-07 10:49:22 +00:00
Ard Biesheuvel
834586f316 MdeModulePkg/UsbBusPei: Drop support for obsolete host controller PPI
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>
2025-08-07 10:49:22 +00:00
Ard Biesheuvel
4e950950a4 MdeModulePkg/Usb: Remove UhciPei
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>
2025-08-07 10:49:22 +00:00
Michael Kubacki
9688712f1d MdeModulePkg: Usb cumulative codeql issues.
Running Codeql on the MdeModulePkg\Bus\Usb drivers results in
codeql errors stemming for the following two checks.

- cpp/comparison-with-wider-type
- cpp/overflow-buffer

Signed-off-by: Aaron Pop <aaronpop@microsoft.com>

Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com>
Co-authored-by: Taylor Beebe <tabeebe@microsoft.com>
Co-authored-by: pohanch <125842322+pohanch@users.noreply.github.com>
Co-authored-by: kenlautner <85201046+kenlautner@users.noreply.github.com>
Co-authored-by: Oliver Smith-Denny <osde@linux.microsoft.com>
Co-authored-by: Sean Brogan <sean.brogan@microsoft.com>
Co-authored-by: Aaron <aaronpop@microsoft>
2025-08-07 09:10:24 +00:00
Alok Kulkarni
a00ad45ea4 MdeModulePkg: UsbBusDxe Reset USB port GetPortStatus returns device error.
During USB device enumeration, issuing a hot reset on a port is skipped if
there is a reset change status already detected on the port. This can
happen when enumerating devices after a host controller soft reset (which
drives a hot reset down the ports).

However, in certain cases an attached device may not be responsive even if
the reset change and connection status bits are set. For e.g., according
to xHCI spec section 4.19.5.1 the port reset change bits can be set when
a hot reset driven on the port transitions to a warm reset and completes
with errors. For such instances it is worthwhile to force a hot reset
during enumeration to try and recover unresponsive devices.

During enumeration check whether querying port status returns
EFI_DEVICE_ERROR and try a port reset if there is a device attached to
the port.

Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
2025-07-10 09:06:35 +08:00
GuoMinJ
0fe2520aad MdeModulePkg: Remove UGA support
The Universal Graphics Adapter (UGA) is a graphic abstraction.
The UGA I/O and Draw protocols are deprecated since UEFI 2.0 was
introduced. Cf. the UEFI spec v2.9:
"Appendix L - EFI 1.10 Protocol Changes and Deprecation List"
section L.2 "Deprecated Protocols"

Remove the UGA support.

Signed-off-by: GuoMinJ <newexplorerj@gmail.com>
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2025-07-08 15:42:03 +00:00
Abdul Lateef Attar
25b1754ae5 MdeModulePkg: Correct spelling errors and typos
Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
2025-07-04 09:41:47 +08:00
Ryan Wong
5ac1dfc093 MdeModulePkg/UfsPassThruDxe: Correct size in UfsHc->FreeBuffer call
UfsHc->FreeBuffer accepts page numbers rather than bytes as its
size argument. Fix two positions where wrong size were passed.

Signed-off-by: Ryan Wong <colorfulshark@gmail.com>
2025-06-25 14:48:08 +08:00
Michael D Kinney
73ecd7d8b2 MdeModulePkg/SpiNorFlashJedecSfdp: Initialize AddressSize
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2025-06-13 15:47:59 +00:00
Gao Qihang
c4bc60b2b7 MdeModulePkg: Fix EFI_SUCCESS typos
EFI_SUCESS -> EFI_SUCCESS
EFI_SUCESSS -> EFI_SUCCESS

Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
2025-06-12 17:50:45 +00:00
Dongyan Qian
58d3345d8c MdeModulePkg/SpiBus: Free handle buffers after LocateHandleBuffer
Fix memory leaks by adding missing FreePool calls:
release SpiHcHandles in SpiBusEntry exit path.

REF: https://uefi.org/sites/default/files/resources/UEFI_Spec_Final_2.11.pdf
Chapter 7.3.15: "Services - Boot Services.LocateHandleBuffer":
It is the caller's responsibility to call the Boot Service.FreePool when
the caller no longer requires the contents of Buffer.

Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn>
2025-06-12 14:09:13 +00:00
Dongyan Qian
51a8869907 MdeModulePkg: Fix definition typos
`defintion`->`definition`

Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn>
2025-06-11 17:20:20 +00:00
Bret Barkelew
d81e4121b1 MdeModulePkg/PciBusDxe: Free descriptor buffer in GetResourcePadding()
- Updated the PciGetBusRange function signature to use IN OUT for
  the Descriptors parameter.

- Introduced a new DescriptorsBuffer variable in PciLib.c to
  temporarily hold descriptor data.

- Clean up DescriptorsBuffer and set Descriptors to NULL after use.

Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-06-05 10:05:11 +08:00
Michael Turner
3260988830 MdeModulePkg: Enable PciBus to handle CRS responses by ignoring the device.
If there is a slow device on the PCI Bus, and the HostBridge is
programmed to allow CRS, the slow device may return 0x0001 to inform the
config space reader of the Vendor Id that pci device is not ready. The
current PciBus enumerator will treat 0001 as a valid Vendor Id, but it
is not. It indicates that all other config space is invalid. This code
changes that operation to skip slow devices.

PCI EXPRESS BASE SPECIFICATION, REV. 3.1 section
2.3.1 Request Handling Rules.

Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
2025-05-28 20:44:57 +00:00
PaddyDeng
93aeaa0812 MdeModulePkg/Spi: Allow NULL WriteBuffer in FillWriteBuffer()
Fix false positive assert added in #10924
Functon `FillWriteBuffer()` should able to accept NULL WriteBuffer when
WriteBytes equals 0.

Use case:
```
  // Read Status register
  TransactionBufferLength = FillWriteBuffer (
                              Instance,
                              SPI_FLASH_RDSR,
                              SPI_FLASH_RDSR_DUMMY,
                              SPI_FLASH_RDSR_ADDR_BYTES,
                              FALSE,
                              0,
                              0, // WriteBytes = 0
                              NULL // WriteBuffer can be NULL
                              );

```

Signed-off-by: Paddy Deng <v-paddydeng@microsoft.com>
2025-05-26 05:45:37 +00:00
Page Chen
a8f0e70dbf MdeModulePkg-SdMmcPciHcDxe: Add missing defines in SD_MMC_HC_SLOT_CAP
Add missing bit defines from 2.2.26 Capabilities Register (Cat.C Offset 040h)

Signed-off-by: Page Chen <paiching_chen@apple.com>
2025-05-26 09:01:47 +08:00
Bret Barkelew
b2db39cefe MdeModulePkg: Correct Usb Mouse Z for absolute pointer.
https://www.usb.org/sites/default/files/hid1_11.pdf
Appendix B, B.2 Protocol 2 (Mouse) details the information
returned by a usb mouse HID.

bytes 3..n are specific to the device, but are used by absolute
pointer devices to return a z axis.

Prior to this change, the existing code was reusing the X value for
the Z axis, which was incorrect.

For usb devices which do not return enough data for a z axis,
this change will be a no-op.

Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
2025-05-09 16:01:42 +08:00
PaddyDeng
2cff8743ce MdeModulePkg/Spi: Solving potential null ptr deref. in SpiNorFlashJedecSfdp
The pointer `Instance->SfdpBasicFlash` can be used before initializing.

Example code flow:
- CreateSpiNorFlashSfdpInstance: Allocate pool for `Instance`
    - InitialSpiNorFlashSfdpInstance
        - ReadSfdp
            - ReadSfdpHeader
                - FillWriteBuffer: Dereferencing
`Instance->SfdpBasicFlash`
            - ReadSfdpBasicParameterTable: Allocate pool for
`Instance->SfdpBasicFlash`

Check both `Instance` and `Instance->SfdpBasicFlash` should have
a non null value before dereferencing it. Otherwise use the defaut
value 0.

Also terminate the function if `Instance` or `WriteBuffer` is NULL.

Signed-off-by: Paddy Deng <v-paddydeng@microsoft.com>
2025-05-05 14:26:16 +08:00
Jack Hsieh
e1dee2bcfa MdeModulePkg SpiBus: Use correct GUID
Fix incorrect guid in SpiBusDxe and add null checking for AllocateZeroPool in the SpiBus driver.

Signed-off-by: Jack Hsieh <v-chhsieh@microsoft.com>
2025-04-30 14:55:42 +08:00
Pohan Wu
948d4ba0be MdeModulePkg/UsbMassStorageDxe: Remove excessive logging
When a USB mass storage device is not ready (e.g., still powering up
or the hard disk has not reached the desired RPM), the ExecCommand
function fails.This failure is not a true error. Logging it as
DEBUG_ERROR will generate logs for properly functioning devices as
well, potentially flooding logs for older devices.

As mentioned in the command, proper error information retrieval
should occur in the sense request. The solution is to downgrade
the log level from DEBUG_ERROR to DEBUG_INFO.

Signed-off-by: Jack Pham <jackp@qti.qualcomm.com>
2025-04-16 01:27:39 +00:00
Pohan Wu
b917a5b7b3 MdeModulePkg/UsbMassStorageDxe: Remove Port Reset
During USB mass storage enumeration, if a USB transfer fails due to any
other reason, UsbMassStorageDxe will attempt to reset the device.
With the commit ed07a2bb11 ("MdeModulePkg/UsbBusDxe: USB issue fix when
the port reset"), UsbIoPortReset now tears down the USB device context
and reinstalls it (via DisconnectController & ConnectController).

This process is not handled by the UsbMassDriver, causing the upper
layer to access an old pointer that has been freed during the teardown,
leading to a crash.

Example:

UsbMassReadBlocks (Failed)
 -> UsbMassReset
   -> UsbBotResetDevice
     -> UsbIoPortReset (teardown + reinstall and return)
Now the UsbBot context pointer is invalidated and pointing to freed
memory.
     -> UsbBot->UsbIo->UsbControlTransfer() therefore accesses a invalid
pointer and crashes.

The fix is to ignore the ExtendedVerification, which is supposed to
perform a more exhaustive verification operation during the reset.  In
MassStorageDxe, ExtendedVerification perform the parent port reset
(UsbIoPortReset).  Ultimately, the MassStorage device should not reset
the parent port due to a transfer error.  By not performing any extended
verification, the teardown is prevented, thereby avoiding the crash.

Signed-off-by: Jack Pham <jackp@qti.qualcomm.com>
2025-04-16 01:27:39 +00:00
Jack Pham
f1a2bd2333 MdeModulePkg/XhciDxe: Adjust out-of-range bInterval values
When a USB device is enumerated it will report one or more endpoint
descriptors which contains a bInterval field which specifies the
interval a host should periodically poll for that particular endpoint
when scheduling transfers.  But the units this value is expressed in
(in whole ms, a power of 2 x 1ms, or a power of 2 x 125us) may differ
depending on the speed of the device and whether the endpoint is
isochronous or interrupt.

Some high/super-speed devices, which are supposed to report isoc/int
bInterval as a power of 2 x 125us, incorrectly report full-speed
bInterval values (that is, in whole units of ms) in their interrupt
endpoint descriptors which results in an assertion error due to being
out of range of the spec-expected values.  Rather than asserting, try
to adjust those assuming they were expressed in units of ms with an
upper limit of 128ms.

Signed-off-by: Jack Pham <jackp@qti.qualcomm.com>
2025-03-18 20:29:20 +00:00
Jack Pham
70db6510d1 MdeModulePkg/XhciDxe: Refactor endpoint interval calculation
Currently the bInterval value must be calculated differently
based on whether the endpoint type is isochronous or interrupt,
and whether the device is low, full, high or super speed.  Plus,
this is duplicated for both XhcInitializeEndpointContext() and
XhcInitializeEndpointContext64().

To reduce code complexity and duplication, and for future ease of
maintenance, factor this logic out to a separate CalculateInterval()
helper function.

Signed-off-by: Jack Pham <jackp@qti.qualcomm.com>
2025-03-18 20:29:20 +00:00
Leif Lindholm
1c96d59e71 MdeModulePkg/UhciDxe: drop unused UsbHcProtocol references
Protocol/UsbHostController.h described an ancient protocol never part of
a public specification ... and was in fact not needed. So drop the
reference.

Also drop some text from a function documentation header incorrectly
implying use of the UsbHcProtocol.

Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
2025-03-06 17:32:08 +00:00
Leif Lindholm
17a90f66d6 MdeModulePkg/UsbBusDxe: drop support for obsolete EFI_USB_HC_PROTOCOL
EFI_USB_HC_PROTOCOL was never defined in a released UEFI specification,
so drop use of it in UsbBusDxe in preparation of deleting the definitions
based on something allegedly supported in confidential EFI 1.10.

Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
2025-03-06 17:32:08 +00:00
Phil Noh
0192f2d7cb MdeModulePkg/UsbBusPei: Improve PEI USB enumeration
Unlike DXE USB enumeration that enumerates all changed ports on timer
interrupt, PEI USB Enumeration runs once at the driver entry point.
USB3.x devices initially appear in USB2.0 ports. When the USB2.0 port is
reset, the USB3.x device disappears from the USB2.0 port and appears on the
USB3.0 port. The USB3.x device won't be enumerated if the USB2.0 port
number is greater than the USB3.0 port number. Re-enumerate USB to make
sure USB3.x devices in this case.

Signed-off-by: Phil Noh <Phil.Noh@amd.com>
2025-02-19 10:21:00 +08:00
Mike Maslenkin
c58501aa1a MdeModulePkg: NvmExpressDxe: fix warning about uninitialized variable
NvmExpressMediaSanitize.c: In function 'NvmExpressMediaClear':
NvmExpressMediaSanitize.c:337:29: error: 'Status' may be used uninitialized
  in this function [-Werror=maybe-uninitialized]

   EFI_STATUS                Status;
                             ^~~~~~
cc1: all warnings being treated as errors

Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2025-01-29 17:20:57 +01:00
Dionna Glaze
f35d3a5bd3 MdeModulePkg: Make noisy log DEBUG_VERBOSE
For bootup of VMs with multiple accelerators, these logging instructions
flood the logs for a good 30 seconds.
Originally found by Gary Zibrat.

Signed-off-by: Dionna Glaze <dionnaglaze@google.com>
2025-01-15 03:02:00 +00: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
Henz, Patrick
fbbf4206c1 MdeModulePkg/XhciDxe: Non-zero start/stop values in XhcGetElapsedTicks
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4578

The implementation of XhcGetElapsedTicks did not account for
non-zero start and stop values for the performance counter
timer, potentially resulting in an incorrect elapsed tick
count getting returned to the caller. Account for non-zero
start and stop values when calculating the elapsed tick
count.

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Patrick Henz <patrick.henz@hpe.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Hao A Wu <hao.a.wu@intel.com>
Message-ID: <c3038878c4d30c54e60cce7192cf1aa60c30ad2e.1698770394.git.patrick.henz@hpe.com>

Resolve rebase conflict from commit ff4c49a5ee ("MdeModulePkg/Bus: Fix
XhciDxe Linker Issues", 2023-12-06): rename "mPerformanceCounter*" to
"mXhciPerformanceCounter*".

Signed-off-by: Laszlo Ersek <laszlo.ersek@posteo.net>
2024-12-22 22:10:54 +00:00
Christopher Zurcher
59cfc13139 MdeModulePkg/Bus/Ufs: Use IndustryStandard headers
Remove duplicate private header files and reference UFS spec definitions
from the IndustryStandard folder.

Signed-off-by: Christopher Zurcher <christopher.zurcher@microsoft.com>
2024-12-16 15:39:35 +08:00
Aniket_Surekar
333e9638ad MdeModulePkg/Bus/Pci: Fix Descriptor Misalignment in USB Config Handling
The issue with locating the expected interface and endpoint descriptors
arises because `configDesc` (USB_CONFIG_DESCRIPTOR) and `IfDesc`
(USB_INTERFACE_DESCRIPTOR) are incremented by structure size rather than
by actual descriptor length.

Specifically:
  - `configDesc` should be incremented by its actual length.
  - `IfDesc` should be incremented by its actual length.

This incorrect increment causes misalignment, preventing access to the
subsequent interface and endpoint descriptors.

[Suggested Solution]
Update the code to increment the pointers by the actual descriptor lengths,
ensuring proper access to all descriptors in the USB configuration.

Signed-off-by: Aniket Surekar <Aniket.Surekar@Dell.com>
2024-12-06 01:45:22 +00:00
Paul Chang
a9901a7748 MdeModulePkg: SataControllerSupported checks DevicePath Protocol
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4858

Ph52a PCIE to SATA card inserted on Intel MTL/ARL causes system hanged.

Root cause of this issue is because Ph52a's driver only uses DevicePath
protocol alone and EDK2 driver only uses PciIo protocol alone. Both
drivers start and try to manage SATA controller.

Signed-off-by: Paul Chang <paulchang@ami.com>
2024-11-01 01:53:53 +00:00
INDIA\kanagavels
87e2ee60d4 MdeModulePkg: Added PPI support in UFS PEI driver.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4490

Added PPI support in UFS PEI driver to link the platform specific code
as same as UFS DXE driver.

Signed-off-by: Kanagavel S <kanagavels@ami.com>
2024-10-28 05:39:52 +00:00
joe
1c0f3c3e41 MdeModulePkg/PciHostBridgeDxe: Add MemoryFence after write.
On AARCH64, there is no ordering guarantee between configuration
space (ECAM) writes and memory space reads (MMIO). ARM AMBA CHI
only guarantees ordering for reads and writes within a single address
region, however, on some systems MMIO and ECAM may be split into
separateaddress regions.

A problem may arise when an ECAM write is issued a completion before a
subsequent MMIO read is issued and receives a completion.

For example, a typical PCI software flow is the following:

1. ECAM write to device command register to enable memory space
2. MMIO read from device memory space for which access was enabled
   in step 1.

There is no guarantee that step 2. will not begin before the completion
of step 1.
on systems where ECAM/MMIO are specified as separate address regions,
even
if both spaces have the memory attributes device-nGnRnE.

- Add a barrier after the final PCI Configuration space write
in RootBridgeIoPciAccess. Configuration space reads should not have
side-efects.

- When configuration space is strongly ordered, this ensures
that program execution cannot continue until the completion
is received for the previous Cfg-Write, which may have side-effects.

- Risk of reading a "write-only" register and causing a CA which leaves
the device unresponsive. The expectation based on the PCI Base Spec
v6.1 section 7.4 is that all PCI Spec-defined registers will be readable,
however, there may exist design-specific registers that fall into
this category.

Signed-off-by: Aaron Pop <aaronpop@microsoft.com>

Co-authored-by: Ard Biesheuvel <ardb@kernel.org>
2024-10-25 06:21:28 +00:00
Oleg Ilyasov
7b3969c951 MdeModulePkg UsbNetwork: Use USB class definition from MdePkg
- Class specific types for interface and endpoint are generic
- Definitions are in IndustryStandard/Usb.h
- Remove type redefinitions
- Update references to the descriptor types

Signed-off-by: Oleg Ilyasov <olegi@ami.com>
2024-10-22 05:40:04 +00:00
Rebecca Cran
03bc4252fb XhciDxe: Fail the start of malfunctioning XHCI controllers
Add missing error checking for malfunctioning XHCI controllers.

Signed-off-by: Rebecca Cran <rebecca@os.amperecomputing.com>
2024-09-05 05:37:42 +00:00
Ray Robles
b6c4708c4d MdeModulePkg/Bus/Pci/NvmExpressDxe: Nvm Express Media Sanitize Protocol.
Implementation of MEDIA_SANITIZE_PROTOCOL for NIST
purge/clear actions with mapping to NVM Express native
commands.

Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
2024-08-29 18:51:07 +00:00
Oliver Smith-Denny
1169122c6f MdeModulePkg NonDiscoverablePciDeviceIo: MMIO Memory XP By Default
When allocating memory for a non-discoverable PCI device's IO, the
current core code removes the XP attribute, allowing code to execute
from that region. This is a security vulnerability and unneeded. This
change updates to mark the region as XP when allocating memory for the
non-discoverable PCI device.

These allocations in this function are limited to `EfiBootServicesData`
and `EfiRuntimeServicesData`, which we expect to be XP.

Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
2024-08-29 16:11:40 +00:00
Sean Brogan
9df400fd4d MdeModulePkg: NvmExpressDxe: Add Timeout Status Codes
Add Report status code events to Nvme to trigger when timeouts occur.
This improves traceability when critical errors happen.

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2024-07-31 04:09:49 +00:00
Jason1 Lin
f8f34edd9d MdeModulePkg/UfsPassThruDxe: Migrate UFS Initial Completion Timeout to PCD
- Remove the hardcoded definition (UFS_INIT_COMPLETION_TIMEOUT)
- Migrate the UFS initial completion timeout into PCD value

Signed-off-by: Jason1 Lin <jason1.lin@intel.com>
2024-07-30 20:55:09 +00:00