summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Bus/Usb
AgeCommit message (Collapse)AuthorFilesLines
8 daysMdeModulePkg/UsbBusDxe: Raise TPL to CALLBACK for wanted UsbIo connectMarlboro_Chuang1-0/+9
Raise TPL to TPL_CALLBACK around the ConnectController() call in UsbBusRecursivelyConnectWantedUsbIo() and restore the original TPL afterward. UsbBusRecursivelyConnectWantedUsbIo() is normally reached through the DriverBinding Start routine invoked by gBS->ConnectController(), which runs at TPL_APPLICATION. While the wanted UsbIo handle is being connected, the USB device can be removed. The device removal polling event in UsbBus runs at TPL_CALLBACK. If the connect runs at TPL_APPLICATION, that event can preempt the connection and cause commands to be sent to a stale or non-existent USB device address, producing a lot of timeout transfers. This differs from UsbConnectDriver(), which is called from the enumeration polling event (XHCI async event) and is usually already at TPL_CALLBACK or TPL_NOTIFY. That function uses RestoreTPL()/ RaiseTPL() to ensure ConnectController() runs at TPL_CALLBACK. Signed-off-by: Marlboro_Chuang <marlboro.chuang@dell.com>
8 daysMdeModulePkg/UsbBusDxe: Handle a quirk in Interface descriptorMarlboro_Chuang2-2/+29
Some specific device requires a quirk in the Interface descriptor for InterfaceNumber to work properly [Suggested Solution] Implement the mechanism to ensure the first InterfaceNumber not equal to zero. Signed-off-by: Marlboro_Chuang <marlboro.chuang@dell.com>
2026-07-31MdeModulePkg/UsbBusDxe: Fix UsbPortReset might run into recursive loopJared Pan1-19/+24
UsbSelectConfig will introduce the UsbConnectDriver call. If this UsbPortReset is happened in the Usb device driver Start() routine and the device FW can not be recovered by PortReset, the UsbSelectConfig will introduce the recursive loop. [Suggested solution] Since UsbPortReset should not change the Bus Topology, the Reset flow should only SetAddress and reconfigure the device. Signed-off-by: Marlboro Chuang <marlboro.chuang@dell.com> Signed-off-by: Jared Pan <jared.pan@dell.com>
2026-07-22MdeModulePkg/UsbBusDxe: BOS Descriptor Check for SS DevicesJared Pan5-0/+145
Some SuperSpeed-capable devices may fall back to High-Speed mode and cause subsequent commands to fail. [Suggested Solution] Check the BOS descriptor to verify SuperSpeed support and trigger a port reset if needed to re-enumerate the device properly. Signed-off-by: Marlboro Chuang <marlboro.chuang@dell.com> Signed-off-by: Jared Pan <jared.pan@dell.com>
2026-07-21MdeModulePkg/UsbBusPei: Use dynamic buffer for USB configuration dataDC-Damien2-12/+11
USB devices whose configuration descriptor TotalLength exceeds 1024 bytes (e.g. IR cameras with large descriptor tables) previously hit an EFI_DEVICE_ERROR hard-limit and failed to enumerate in PEI. Replace the fixed array with a UINT8 * pointer and dynamically allocate the exact amount of memory required via PeiServicesAllocatePool() after the TotalLength is learned from the initial 4-byte descriptor probe. Signed-off-by: Damien Chen <damien.chen@dell.com>
2026-06-30MdeModulePkg/UsbBusDxe: Manufacturer String Descriptor CachingJared Pan3-25/+142
Certain devices require immediate follow-up commands after reading the LANGID string to fetch Manufacturer, Product, or SerialNumber strings. [Suggested Solution] These strings are now cached after initial retrieval to allow UsbIoGetStringDescriptor() to return them directly, improving efficiency and stability. Signed-off-by: Marlboro Chuang <marlboro.chuang@dell.com> Signed-off-by: Jared Pan <jared.pan@dell.com>
2026-06-30MdeModulePkg/UsbBusDxe: Improve USB enumerating processJared Pan3-16/+121
The patch enhances the USB enumeration process in EDK2 to improve compatibility with non-standards-compliant devices that may fail during standard enumeration sequences. The suggested solution is based on USB specifications and references implementations from both Linux and Windows environments. [Suggested solution] - Integrated a retry mechanism to sequentially execute enumeration scripts, inspired by the enumeration flows of Windows, Linux, and EDK2. This improves robustness when handling corner-case devices. - Do sanity check while the device report the device descriptor. - AMD XHCI might need to wait for more time while sending the CLEAR_FEATURE reuqest. Signed-off-by: Marlboro Chuang <marlboro.chuang@dell.com> Signed-off-by: Jared Pan <jared.pan@dell.com>
2026-06-24MdeModulePkg: UsbNetwork: Fix uninitialized variable warningsTuan Phan1-1/+2
In NetworkCommonDriverStart(), if gPxe is not NULL, TmpPxePointer should be initialized as it is referenced later in the clean up code. Signed-off-by: Tuan Phan <tuan.phan@oss.qualcomm.com>
2026-06-09MdeModulePkg: Remove Depex section in UEFI_DRIVER and UEFI_APPLICATIONQihang Gao4-12/+0
According to INF specification, UEFI_DRIVER and UEFI_APPLICATION cannot have Depex section. So remove it. Signed-off-by: Qihang Gao <gaoqihang@loongson.cn>
2026-05-08MdePkg,MdeModulePkg: Fix Spelling Errors in Atapi DefinitionsOliver Smith-Denny1-2/+2
Fix spelling errors in definitions in Atapi.h. Update consumers in MdeModulePkg. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2026-04-21MdeModulePkg/NetworkCommon: Add PCD for USB network periodic timerAbdul Lateef Attar3-6/+14
Replace the hardcoded NETWORK_COMMON_POLLING_INTERVAL (0x10 = 16ms) with a new PCD PcdUsbNetworkPeriodicalTimer, allowing platforms to configure the asynchronous transfer interval for USB network devices. The default value of 16ms preserves existing behaviour. EFI_USB_IO_PROTOCOL.UsbAsyncInterruptTransfer(), the PollingInterval parameter must be between 1 and 255 milliseconds; a value of 0 returns EFI_INVALID_PARAMETER. The PCD is declared with a @ValidRange of 1-255 and an ASSERT guards against a zero value at runtime. Co-authored-by: Abner Chang <abner.chang@amd.com> Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
2026-02-24MdeModulePkg: Replace include guards with #pragma onceMichael Kubacki26-103/+27
Replace traditional `#ifndef`/`#define`/`#endif` include guards with `#pragma` once. `#pragma once` is a widely supported preprocessor directive that prevents header files from being included multiple times. It is supported by all toolchains used to build edk2: GCC, Clang/LLVM, and MSVC. Compared to macro-based include guards, `#pragma once`: - Eliminates the risk of macro name collisions or copy/paste errors where two headers inadvertently use the same guard macro. - Eliminate inconsistency in the way include guard macros are named (e.g., some files use `__FILE_H__`, others use `FILE_H_`, etc.). - Reduces boilerplate (three lines replaced by one). - Avoids polluting the macro namespace with guard symbols. - Can improve build times as the preprocessor can skip re-opening the file entirely, rather than re-reading it to find the matching `#endif` ("multiple-include optimization"). - Note that some compilers may already optimize traditional include guards, by recognzining the idiomatic pattern. This change is made acknowledging that overall portability of the code will technically be reduced, as `#pragma once` is not part of the C/C++ standards. However, this is considered acceptable given: 1. edk2 already defines a subset of supported compilers in BaseTools/Conf/tools_def.template, all of which have supported `#pragma once` for over two decades. 2. There have been concerns raised to the project about inconsistent include guard naming and potential macro collisions. Approximate compiler support dates: - MSVC: Supported since Visual C++ 4.2 (1996) - GCC: Supported since 3.4 (2004) (http://gnu.ist.utl.pt/software/gcc/gcc-3.4/changes.html) - Clang (LLVM based): Since initial release in 2007 Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2026-01-30MdeModulePkg/UsbMassStorageDxe: Add retry mechanism to UsbMassReadBlocksPaul Grimes1-49/+68
Add a retry mechanism to UsbMassReadBlocks() to improve robustness when reading from USB mass storage devices. Some USB devices may experience transient failures during read operations that can be recovered by resetting the device and retrying. The implementation: - Saves original buffer parameters (Buffer, Lba, BufferSize) - Attempts the read operation up to 4 times (initial + 3 retries) - Resets the device via UsbMassReset() before each retry - Restores buffer parameters before each retry attempt This change is compliant with USB Mass Storage Class Bulk-Only Transport Spec Rev 1.0: - Section 5.3.4: Defines Reset Recovery procedure - Section 3.1: States device is ready for next CBW after reset Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Jacek Kolakowski <jacek.kolakowski@intel.com> Signed-off-by: Paul Grimes <Paul.Grimes@amd.com>
2025-11-22MdeModulePkg: Remove extraneous parenthesesMike Beaton1-1/+1
XCODE5 toolchain finds these, with errors such as: PxeFunction.c:763:27: error: equality comparison with extraneous parentheses Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2025-10-09MdeModulePkg : Clear keyboard queue buffer after readingnick.wang1-1/+1
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-09-29MdeModulePkg: Update to support mouse z-axis in ConSplitterDxeYang Gang2-2/+2
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-26MdeModulePkg: Remove ARM32 SupportOliver Smith-Denny2-20/+0
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-02MdeModulePkg UsbMouseDxe: Correct some parameter commentsYang Gang2-2/+2
Signed-off-by: Yang Gang <yanggang@byosoft.com.cn>
2025-08-07MdeModulePkg: Remove obsolete PEI_USB_HOST_CONTROLLER_PPIArd Biesheuvel2-2/+0
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-07MdeModulePkg/UsbBusPei: Drop support for obsolete host controller PPIArd Biesheuvel4-348/+132
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-07MdeModulePkg: Usb cumulative codeql issues.Michael Kubacki6-21/+39
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-07-10MdeModulePkg: UsbBusDxe Reset USB port GetPortStatus returns device error.Alok Kulkarni1-2/+9
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-05-09MdeModulePkg: Correct Usb Mouse Z for absolute pointer.Bret Barkelew1-1/+1
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-04-16MdeModulePkg/UsbMassStorageDxe: Remove excessive loggingPohan Wu1-1/+1
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-16MdeModulePkg/UsbMassStorageDxe: Remove Port ResetPohan Wu1-12/+1
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-03-06MdeModulePkg/UsbBusDxe: drop support for obsolete EFI_USB_HC_PROTOCOLLeif Lindholm4-259/+93
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-02-19MdeModulePkg/UsbBusPei: Improve PEI USB enumerationPhil Noh1-161/+170
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>
2024-10-22MdeModulePkg UsbNetwork: Use USB class definition from MdePkgOleg Ilyasov3-3/+3
- 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-07-03MdeModulePkg/UsbBusDxe: USB issue fix when the port resetBritton Chesley1-1/+26
BZ #4456 Fixed a bug which led to an ASSERT due to the USB device context being maintained after a port reset, but the underlying XHCI context was uninitialized. Specifically, Xhc->UsbDevContext is freed after a reset and only re-allocates the default [0] enpoint transfer ring. In order to avoid a memory leak, device enumeration is performed after freeing the necessary buffers. This allocates the Xhc->UsbDevContext for all endpoints of the USB device. Signed-off-by: Britton Chesley <Brit.Chesley@amd.com>
2024-04-03MdeModulePkg: Update the comments of ReadKeyStroke and ReadKeyStrokeExQingyu2-0/+4
Refer to Uefi spec 2.10 section 12.3.3, Add a new retval EFI_UNSUPPORTED to EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.ReadKeyStrokeEx and EFI_SIMPLE_TEXT_INPUT_PROTOCOL.ReadKeyStroke(). Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Qingyu <qingyu.shang@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2024-02-26MdeModulePkg/Bus/Usb/UsbNetwork: Check array index range before accessMichael Kubacki3-3/+3
Checks that an offset used to access array elements is within the expected range before accessing the array item. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Ray Ni <ray.ni@intel.com> Cc: Rebecca Cran <rebecca@bsdio.com> Cc: Richard Ho <richardho@ami.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2023-10-17MdeModulePkg: UsbRndis: get rid of magic valuesMike Maslenkin1-21/+21
Replace magic values used for checking Base Class, SubClass and Protocol fields of USB Interface Descriptor. Add definitions for Base Class EFh (Miscellaneous) and RNDIS subclass. These definitions were taken from https://www.usb.org/defined-class-codes Cc: Richard Ho <richardho@ami.com> Cc: Rebecca Cran <rebecca@bsdio.com> Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2023-10-17MdeModulePkg: UsbNetwork: fix Ethernet functional descriptor processingMike Maslenkin4-5/+5
This patch fixes wrong condition because of UINT16 value to integer promotion. NumberMcFilters is UINT16 value, so when bitwise shift operator applied to small integer type, the operation is preceded by integral promotion. This is described in MISRA-C:2004 guideline as Rule 10.5: "If the bitwise operators ~ and << are applied to an operand of underlying type unsigned char or unsigned short, the result shall be immediately cast to the underlying type of the operand." A simple fix for this issue would be the following: if ((UINT16)(UsbEthFunDescriptor.NumberMcFilters << 1) == 0) But this patch proposes to use bitwise AND operation with a proper bit mask rather than shifting to prevent similar mistakes in future. Cc: Richard Ho <richardho@ami.com> Cc: Rebecca Cran <rebecca@bsdio.com> Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2023-07-13MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm: Add USB Cdc NCM devices supportRichard Ho5-0/+1929
This driver provides UEFI driver for USB CDC NCM device Signed-off-by: Richard Ho <richardho@ami.com> Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Michael Kubacki <mikuback@linux.microsoft.com> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Tested-by: Tinh Nguyen <tinhnguyen@os.amperecomputing.com> Acked-by: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Rebecca Cran <rebecca@bsdio.com> Reviewed-by: Tony Lo <tonylo@ami.com>
2023-07-13MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm: Add USB Cdc ECM devices supportRichard Ho5-0/+1805
This driver provides UEFI driver for USB CDC ECM device Signed-off-by: Richard Ho <richardho@ami.com> Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Michael Kubacki <mikuback@linux.microsoft.com> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Tested-by: Tinh Nguyen <tinhnguyen@os.amperecomputing.com> Acked-by: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Rebecca Cran <rebecca@bsdio.com> Reviewed-by: Tony Lo <tonylo@ami.com>
2023-07-13MdeModulePkg/Bus/Usb/UsbNetwork/UsbRndis: Add USB RNDIS devices supportRichard Ho10-0/+6384
This driver provides UEFI driver for USB RNDIS device Signed-off-by: Richard Ho <richardho@ami.com> Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Michael Kubacki <mikuback@linux.microsoft.com> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Tested-by: Tinh Nguyen <tinhnguyen@os.amperecomputing.com> Acked-by: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Rebecca Cran <rebecca@bsdio.com> Reviewed-by: Tony Lo <tonylo@ami.com>
2023-03-07MdeModulePkg: Improve formatting of DEBUG messages in UsbBusDxeRebecca Cran4-11/+11
Improve the formatting of DEBUG messages in UsbBusDxe by adding a hyphen to separate the EFI_STATUS code. Signed-off-by: Rebecca Cran <rebecca@bsdio.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2023-01-16MdeModulePkg/Usb: Read a large number of blocksAbner Chang1-13/+12
Changes to allow reading blocks that greater than 65535 sectors. Signed-off-by: Jiangang He <jiangang.he@amd.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Garrett Kirkendall <garrett.kirkendall@amd.com> Cc: Abner Chang <abner.chang@amd.com> Cc: Kuei-Hung Lin <Kuei-Hung.Lin@amd.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2022-09-09MdeModulePkg: Fix imbalanced debug macrosMichael Kubacki1-4/+4
Updates debug macros in the package that have an imbalanced number of print specifiers to arguments. These changes try to preserve what was likely intended by the author. In cases information was missing due to the bug, the specifier may be removed since it was not previously accurately printing the expected value. Cc: Dandan Bi <dandan.bi@intel.com> Cc: Guomin Jiang <guomin.jiang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2022-03-03MdeModulePkg/Usb/Keyboard.c: Don't request protocol before settingSean Rhodes1-13/+5
No need to check the interface protocol then conditionally setting, just set it to BOOT_PROTOCOL and check for error. This is what Linux does for HID devices as some don't follow the USB spec. One example is the Aspeed BMC HID keyboard device, which adds a massive boot delay without this patch as it doesn't respond to 'GetProtocolRequest'. Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Signed-off-by: Sean Rhodes <sean@starlabs.systems> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2021-12-23MdeModulePkg/UsbBusDxe: fix NOOPT build errorGerd Hoffmann2-2/+2
gcc-11 (fedora 35): /home/kraxel/projects/edk2/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c: In function ?UsbIoBulkTransfer?: /home/kraxel/projects/edk2/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c:277:12: error: ?UsbHcBulkTransfer? accessing 80 bytes in a region of size 8 [-Werror=stringop-overflow=] Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2021-12-07MdeModulePkg: Apply uncrustify changesMichael Kubacki51-4781/+4739
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the MdeModulePkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-12-07MdeModulePkg: Change OPTIONAL keyword usage styleMichael D Kinney4-12/+12
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3760 Update all use of ', OPTIONAL' to ' OPTIONAL,' for function params. Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-12-07MdeModulePkg: Change use of EFI_D_* to DEBUG_*Michael D Kinney13-151/+147
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3739 Update all use of EFI_D_* defines in DEBUG() macros to DEBUG_* defines. Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2020-02-11MdeModulePkg/Usb: Fix various typosAntoine Coeur8-17/+17
Fix various typos in comments and documentation. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Antoine Coeur <coeur@gmx.fr> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> Acked-by: Liming Gao <liming.gao@intel.com> Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com> Message-Id: <20200207010831.9046-23-philmd@redhat.com>
2020-02-11MdeModulePkg/UsbBus: Fix various typosAntoine Coeur12-27/+27
Fix various typos in comments and documentation. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Antoine Coeur <coeur@gmx.fr> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> Acked-by: Liming Gao <liming.gao@intel.com> Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com> Message-Id: <20200207010831.9046-22-philmd@redhat.com>
2020-02-11MdeModulePkg/UsbMouse: Fix few typosAntoine Coeur6-6/+6
Fix few typos in comments and documentation. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Antoine Coeur <coeur@gmx.fr> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> Acked-by: Liming Gao <liming.gao@intel.com> Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com> Message-Id: <20200207010831.9046-21-philmd@redhat.com>
2020-02-11MdeModulePkg/UsbMass: Fix various typosAntoine Coeur8-14/+14
Fix various typos in comments and documentation. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Antoine Coeur <coeur@gmx.fr> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> Acked-by: Liming Gao <liming.gao@intel.com> Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com> Message-Id: <20200207010831.9046-20-philmd@redhat.com>
2020-02-11MdeModulePkg/UsbBusDxe: Fix a typoPhilippe Mathieu-Daudé1-1/+1
Correctly write 'malformatted'. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Acked-by: Liming Gao <liming.gao@intel.com> Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com> Message-Id: <20200207010831.9046-19-philmd@redhat.com> [lersek@redhat.com: replace EFI_D_xxx w/ DEBUG_xxx to shut up PatchCheck]
2020-01-06MdeModulePkg/UsbMouseAbsolutePointer: Fix endpoint selectionMrChromebox1-2/+3
The endpoint selected by the driver needs to not only be an interrupt type, but have direction IN as required to set up an asynchronous interrupt transfer. Currently, the driver assumes that the first INT endpoint will be of type IN, but that is not true of all devices, and will silently fail on devices which have the OUT endpoint before the IN. Adjust the endpoint selection loop to explictly check for direction IN. Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>