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: Update USB descriptor information #6265

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
Copyright (c) Microsoft Corporation.
Flickdm marked this conversation as resolved.
Show resolved Hide resolved
SPDX-License-Identifier: BSD-2-Clause-Patent

**/
Expand Down Expand Up @@ -879,6 +880,11 @@ UsbIoPortReset (

DEBUG ((DEBUG_INFO, "UsbIoPortReset: device is now ADDRESSED at %d\n", Dev->Address));

//
// Endpoint descriptor state needs to be updated following a reset.
//
UsbUpdateDescriptors (Dev);

//
// Reset the current active configure, after this device
// is in CONFIGURED state.
Expand Down
23 changes: 23 additions & 0 deletions MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Manage Usb Descriptor List

Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent

**/
Expand Down Expand Up @@ -1009,3 +1010,25 @@ UsbIoClearFeature (

return Status;
}

/**
Update the device's descriptor information.
@param UsbDev The Usb device.
**/
VOID
UsbUpdateDescriptors (
IN USB_DEVICE *UsbDev
)
{
EFI_USB_CONFIG_DESCRIPTOR *ConfDesc;
EFI_USB_DEVICE_DESCRIPTOR DevDesc;
UINT8 Index;

UsbCtrlGetDesc (UsbDev, USB_DESC_TYPE_DEVICE, 0, 0, &DevDesc, sizeof (EFI_USB_DEVICE_DESCRIPTOR));
for (Index = 0; Index < DevDesc.NumConfigurations; Index++) {
ConfDesc = UsbGetOneConfig (UsbDev, Index);
FreePool (ConfDesc);
}

return;
}
10 changes: 10 additions & 0 deletions MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Manage Usb Descriptor List

Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent

**/
Expand Down Expand Up @@ -224,4 +225,13 @@ UsbIoClearFeature (
IN UINT16 Index
);

/**
Usb UsbIo interface to update descriptor information.
@param UsbDev The Usb device.
**/
VOID
UsbUpdateDescriptors (
IN USB_DEVICE *UsbDev
);

#endif
Loading