Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MdeModulePkg|UsbBusDxe: support USB Interface Association #10558

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

olegilyasov
Copy link
Contributor

Description

USB Interface Association is a group of UsbIo that implement a USB function. UEFI device driver manages multiple UsbIo instances. Examples of such devices are: USB camera, USB serial, USB network, etc.

Current approach for supporting these devices is to respond on UsbIo installation and analyze if the current UsbIo belongs to the USB association. This algorithm is based on assumptions that may not be correct for different device configurations. Having USB association protocol that reports its associates (UsbIo) simplifies the USB device driver.

For the USB configurations that implement USB association the UsbDxeBus driver:

  • creates USB association device

  • installs device path

  • installs USB association IO protocol

  • Breaking change?

    • Breaking change - Does this PR cause a break in build or boot behavior?
    • Examples: Does it add a new library class or move a module to a different repo.
  • Impacts security?

    • Security - Does this PR have a direct security impact?
    • Examples: Crypto algorithm change or buffer overflow fix.
  • Includes tests?

    • Tests - Does this PR include any explicit test code?
    • Examples: Unit tests or integration tests.

How This Was Tested

<Describe the test(s) that were run to verify the changes.>

Integration Instructions

<Describe how these changes should be integrated. Use N/A if nothing is required.>

@olegilyasov olegilyasov force-pushed the usb_iad branch 3 times, most recently from 94494ae to 4c2d6f1 Compare December 21, 2024 03:17
USB_INTERFACE_SETTING *Setting;
USB_INTERFACE_DESC *Interface;
UINTN Index;
UINTN NumIf;

Check failure

Code scanning / CodeQL

Comparison of narrow type with wide type in loop condition High

Comparison between
Index
of type UINT8 and
... + ...
of wider type int.
@@ -752,6 +779,7 @@ UsbBusControllerDriverStop (
);

extern EFI_USB_IO_PROTOCOL mUsbIoProtocol;
extern EDKII_USB_IA_PROTOCOL mUsbIaProtocol;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expand "IA" to full words.

@retval EFI_INVALID_PARAMETER Descriptor is NULL.

**/
typedef
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can these be library services instead of a new protocol? If it is a new protocol, then USB Device Drivers will depends on EDK II specific protocols instead of just UEFI Protocols.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this PR we create USB Association handle and install DP and Association protocols on it. This handle is essential If USB Device Driver follows UEFI driver model, it can not be implemented using the library.
If this EDKII protocol is successful, it can be adopted by UEFI specification.
USB Association is a part of USB specification and this PR is an attempt to implement its functionality.
If there is any other way of advertising the new protocol, please advise.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the intent is to add to UEFI Spec, then there is a process for that and the doc and code updates would be done in edk2-staging repo.

https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Code-First-Process

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, will move it to edk2-staging. The document above talks about creating a bugzilla issue, I understand bugzilla function has been replaced with github issue. Should the issue be created in edk2 repo or edk2-staging repo?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good question. Please create in edk2 repo because that is the location the feature will be added once it is available in published spec.

USB Interface Association is a group of UsbIo instances that implement
a USB function.
UEFI device driver manages multiple UsbIo instances.
Examples of such devices are: USB camera, USB serial, USB network, etc.

Current approach for supporting these devices is to respond on UsbIo
installation and analyze if current UsbIo belongs to the USB association.
This algorithm is based on assumptions that may not be correct for
different device configurations. Having USB association protocol that
reports its associates (UsbIo) simplifies the USB device driver.

For the USB configurations that implement USB association the
UsbDxeBus driver:
- creates USB association device
- installs device path
- installs USB association IO protocol

Signed-off-by: Oleg Ilyasov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants