Commit Graph

1155 Commits

Author SHA1 Message Date
Michał Żygowski 0961f9f31f Add PCDs to control quiet and fast boot in the project
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
2025-03-10 20:16:34 +02:00
Michał Żygowski 3ff728ca15 MdeModulePkg/Bus/Isa/Ps2KeyboardDxe: Reduce PS/2 KBD init to minimum
For NVC laptops it is required to issue KBEN command only to get
the keyboard working on coldboot paths with Windows. This commmit
will be squashed with previous commits once it is verified to work
on MSI desktops.

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
2025-03-10 20:16:33 +02:00
Michał Żygowski e9697ba87b MdeModulePkg/Bus/Isa/Ps2KeyboardDxe: Issue KBEN command after KBC init
After the minimal KBC initialization is	done on	fast boot path,	we still
need to	issue KBEN command. This is a workaround for NVC EC implementation
of KBC which enables keyboard scanning on KBEN command. It has been
verified that Windows does not issue this command, os it is required to get
the keyboard working on	cold boot paths	on NovaCustom laptops. Verfied that
this command did not need to be issued on MSI desktops.

TEST=Boot NovaCustom V560TNX after shutdown from Windows without AC
connected and confirm the internal keyboard still works.

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
2025-03-10 20:16:33 +02:00
Michał Żygowski e1cab3dc1c MdeModulePkg/Bus/Isa/Ps2KeyboardDxe: Lower the PS/2 KBD detection timeout
One seconds seems a bit too excessive to detect the keyboard. Lower the
detection timeout to half a second.

TEST=Verify PS/2 keyboard is initialized properly on MSI Z690-A DDR4 with
Media-Tech MT122K PS/2 keyboard and NovaCustom V540TND.

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
2025-03-10 20:16:33 +02:00
Michał Żygowski e9a661c3a9 MdeModulePkg/Bus/Isa/Ps2KeyboardDxe: Perform minimal i8042 controller init
On fast boot path the i8042 controller was not being initialized at all if
Windows was being booted. This resulted in the keyboard not working after
shutdown and even after reset from Windows. It only worked when the keyboard
was initialized earlier properly and no shutdown occurred. On Linux boot
path, GRUB was calling ReadKeyStroke which triggered connecting consoles and
performing a full PS/2 initialization.

On fast boot path, add minimal i8042 controller initialization without
actual keyboard initialization and extended verification. It is sufficient
for both Linux and Windows to set up the PS/2 keyboard properly.

Also move setting the FastPs2Detection PCD to the Ps2KeyboardDxe, as it
caused most of the i8042 controller initialization to be skipped. Once the
controller is initialized on module start, the extra initialization may be
skipped later on fast boot path.

TEST=PS/2 keyboard works in both Ubuntu Linux and Windows after shutdown and
restart on NovaCustom V540TND.

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
2025-03-10 20:16:33 +02:00
Michał Żygowski 983f91c9be MdeModulePkg/Bus/Isa/Ps2KeyboardDxe: Don't do extended verification on fast boot
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
2025-03-10 20:16:32 +02:00
Benjamin Doron ea1748b4e4 [DNM] MdeModulePkg: PciBusDxe: Drop RemoveRejectedPciDevices()
There is an assumption in `IsPciDeviceRejected()` (at least for I/O)
that a BAR with all read-write bits set is invalid. However, this is not
the case: when a resource is size-aligned down from the top, this may
also be the case.

This code causes the rejection of the iGPU (and therefore, display) in
some cases with the DasharoPayloadPkg, when the coreboot
ESOURCE_ALLOCATION_TOP_DOWN config is enabled. It remains to be seen
whether this code addresses some other issue.

Signed-off-by: Benjamin Doron <benjamin.doron@9elements.com>
2025-03-10 20:16:28 +02:00
Michał Żygowski 73af2c3669 DasharoPayloadPkg,MdeModulePkg: improve detection of PS/2 keyboard
MdeModulePkg:
 * add defines
 * add PcdDetectPs2KbOnCmdAck

DasharoPayloadPkg:
 * detect PS/2 keyboard by sending it an "echo" command if
   Dasharo/Ps2Controller is enabled or doesn't exist
 * remove PS/2 from ConIn if the variable exists and the keyboard is not
   connected or is disabled
2025-03-10 20:16:19 +02:00
Michał Żygowski b44878f872 MdeModulePkg/Bus/Isa/Ps2: add depex for Dasharo PS2 policy
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
2025-03-10 20:16:19 +02:00
Michał Żygowski 85cd85721f MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h: reduce timeout to 2 seconds
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
2025-03-10 20:16:19 +02:00
Michał Żygowski 88f41ad100 MdeModulePkg: Add depex for USB modules
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
2025-03-10 20:16:16 +02:00
Patrick Rudolph d0ad865769 MdeModulePkg: Fix OptionROM scanning
The Option ROM scanner can't work as enumeration was done by the
first stage bootloader. Running it will disable the ability of the
PCIPlatform code to scan for ROMs.

Required for the following patch that enables custom Option ROM
scanning using gPciPlatformProtocol.

Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
2025-03-09 19:52:17 +02: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