MdeModulePkg: Apply uncrustify changes
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>
This commit is contained in:
committed by
mergify[bot]
parent
7c7184e201
commit
1436aea4d5
@@ -20,13 +20,13 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
USB_ENDPOINT_DESC *
|
||||
UsbGetEndpointDesc (
|
||||
IN USB_INTERFACE *UsbIf,
|
||||
IN UINT8 EpAddr
|
||||
IN USB_INTERFACE *UsbIf,
|
||||
IN UINT8 EpAddr
|
||||
)
|
||||
{
|
||||
USB_ENDPOINT_DESC *EpDesc;
|
||||
UINT8 Index;
|
||||
UINT8 NumEndpoints;
|
||||
USB_ENDPOINT_DESC *EpDesc;
|
||||
UINT8 Index;
|
||||
UINT8 NumEndpoints;
|
||||
|
||||
NumEndpoints = UsbIf->IfSetting->Desc.NumEndpoints;
|
||||
|
||||
@@ -41,7 +41,6 @@ UsbGetEndpointDesc (
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Free the resource used by USB interface.
|
||||
|
||||
@@ -52,31 +51,34 @@ UsbGetEndpointDesc (
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbFreeInterface (
|
||||
IN USB_INTERFACE *UsbIf
|
||||
IN USB_INTERFACE *UsbIf
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
UsbCloseHostProtoByChild (UsbIf->Device->Bus, UsbIf->Handle);
|
||||
|
||||
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||
UsbIf->Handle,
|
||||
&gEfiDevicePathProtocolGuid, UsbIf->DevicePath,
|
||||
&gEfiUsbIoProtocolGuid, &UsbIf->UsbIo,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
UsbIf->DevicePath,
|
||||
&gEfiUsbIoProtocolGuid,
|
||||
&UsbIf->UsbIo,
|
||||
NULL
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
if (UsbIf->DevicePath != NULL) {
|
||||
FreePool (UsbIf->DevicePath);
|
||||
}
|
||||
|
||||
FreePool (UsbIf);
|
||||
} else {
|
||||
UsbOpenHostProtoByChild (UsbIf->Device->Bus, UsbIf->Handle);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Create an interface for the descriptor IfDesc. Each
|
||||
device's configuration can have several interfaces.
|
||||
@@ -89,14 +91,14 @@ UsbFreeInterface (
|
||||
**/
|
||||
USB_INTERFACE *
|
||||
UsbCreateInterface (
|
||||
IN USB_DEVICE *Device,
|
||||
IN USB_INTERFACE_DESC *IfDesc
|
||||
IN USB_DEVICE *Device,
|
||||
IN USB_INTERFACE_DESC *IfDesc
|
||||
)
|
||||
{
|
||||
USB_DEVICE_PATH UsbNode;
|
||||
USB_INTERFACE *UsbIf;
|
||||
USB_INTERFACE *HubIf;
|
||||
EFI_STATUS Status;
|
||||
USB_DEVICE_PATH UsbNode;
|
||||
USB_INTERFACE *UsbIf;
|
||||
USB_INTERFACE *HubIf;
|
||||
EFI_STATUS Status;
|
||||
|
||||
UsbIf = AllocateZeroPool (sizeof (USB_INTERFACE));
|
||||
|
||||
@@ -104,11 +106,11 @@ UsbCreateInterface (
|
||||
return NULL;
|
||||
}
|
||||
|
||||
UsbIf->Signature = USB_INTERFACE_SIGNATURE;
|
||||
UsbIf->Device = Device;
|
||||
UsbIf->IfDesc = IfDesc;
|
||||
UsbIf->Signature = USB_INTERFACE_SIGNATURE;
|
||||
UsbIf->Device = Device;
|
||||
UsbIf->IfDesc = IfDesc;
|
||||
ASSERT (IfDesc->ActiveIndex < USB_MAX_INTERFACE_SETTING);
|
||||
UsbIf->IfSetting = IfDesc->Settings[IfDesc->ActiveIndex];
|
||||
UsbIf->IfSetting = IfDesc->Settings[IfDesc->ActiveIndex];
|
||||
|
||||
CopyMem (
|
||||
&(UsbIf->UsbIo),
|
||||
@@ -119,10 +121,10 @@ UsbCreateInterface (
|
||||
//
|
||||
// Install protocols for USBIO and device path
|
||||
//
|
||||
UsbNode.Header.Type = MESSAGING_DEVICE_PATH;
|
||||
UsbNode.Header.SubType = MSG_USB_DP;
|
||||
UsbNode.ParentPortNumber = Device->ParentPort;
|
||||
UsbNode.InterfaceNumber = UsbIf->IfSetting->Desc.InterfaceNumber;
|
||||
UsbNode.Header.Type = MESSAGING_DEVICE_PATH;
|
||||
UsbNode.Header.SubType = MSG_USB_DP;
|
||||
UsbNode.ParentPortNumber = Device->ParentPort;
|
||||
UsbNode.InterfaceNumber = UsbIf->IfSetting->Desc.InterfaceNumber;
|
||||
|
||||
SetDevicePathNodeLength (&UsbNode.Header, sizeof (UsbNode));
|
||||
|
||||
@@ -182,7 +184,6 @@ ON_ERROR:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Free the resource used by this USB device.
|
||||
|
||||
@@ -191,7 +192,7 @@ ON_ERROR:
|
||||
**/
|
||||
VOID
|
||||
UsbFreeDevice (
|
||||
IN USB_DEVICE *Device
|
||||
IN USB_DEVICE *Device
|
||||
)
|
||||
{
|
||||
if (Device->DevDesc != NULL) {
|
||||
@@ -201,7 +202,6 @@ UsbFreeDevice (
|
||||
gBS->FreePool (Device);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Create a device which is on the parent's ParentPort port.
|
||||
|
||||
@@ -213,11 +213,11 @@ UsbFreeDevice (
|
||||
**/
|
||||
USB_DEVICE *
|
||||
UsbCreateDevice (
|
||||
IN USB_INTERFACE *ParentIf,
|
||||
IN UINT8 ParentPort
|
||||
IN USB_INTERFACE *ParentIf,
|
||||
IN UINT8 ParentPort
|
||||
)
|
||||
{
|
||||
USB_DEVICE *Device;
|
||||
USB_DEVICE *Device;
|
||||
|
||||
ASSERT (ParentIf != NULL);
|
||||
|
||||
@@ -227,16 +227,15 @@ UsbCreateDevice (
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Device->Bus = ParentIf->Device->Bus;
|
||||
Device->MaxPacket0 = 8;
|
||||
Device->ParentAddr = ParentIf->Device->Address;
|
||||
Device->ParentIf = ParentIf;
|
||||
Device->ParentPort = ParentPort;
|
||||
Device->Tier = (UINT8)(ParentIf->Device->Tier + 1);
|
||||
Device->Bus = ParentIf->Device->Bus;
|
||||
Device->MaxPacket0 = 8;
|
||||
Device->ParentAddr = ParentIf->Device->Address;
|
||||
Device->ParentIf = ParentIf;
|
||||
Device->ParentPort = ParentPort;
|
||||
Device->Tier = (UINT8)(ParentIf->Device->Tier + 1);
|
||||
return Device;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Connect the USB interface with its driver. EFI USB bus will
|
||||
create a USB interface for each separate interface descriptor.
|
||||
@@ -249,11 +248,11 @@ UsbCreateDevice (
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbConnectDriver (
|
||||
IN USB_INTERFACE *UsbIf
|
||||
IN USB_INTERFACE *UsbIf
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_TPL OldTpl;
|
||||
EFI_STATUS Status;
|
||||
EFI_TPL OldTpl;
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
@@ -264,7 +263,6 @@ UsbConnectDriver (
|
||||
if (UsbIsHubInterface (UsbIf)) {
|
||||
DEBUG ((DEBUG_INFO, "UsbConnectDriver: found a hub device\n"));
|
||||
Status = mUsbHubApi.Init (UsbIf);
|
||||
|
||||
} else {
|
||||
//
|
||||
// This function is called in both UsbIoControlTransfer and
|
||||
@@ -278,15 +276,15 @@ UsbConnectDriver (
|
||||
// Only recursively wanted usb child device
|
||||
//
|
||||
if (UsbBusIsWantedUsbIO (UsbIf->Device->Bus, UsbIf)) {
|
||||
OldTpl = UsbGetCurrentTpl ();
|
||||
OldTpl = UsbGetCurrentTpl ();
|
||||
DEBUG ((DEBUG_INFO, "UsbConnectDriver: TPL before connect is %d, %p\n", (UINT32)OldTpl, UsbIf->Handle));
|
||||
|
||||
gBS->RestoreTPL (TPL_CALLBACK);
|
||||
|
||||
Status = gBS->ConnectController (UsbIf->Handle, NULL, NULL, TRUE);
|
||||
UsbIf->IsManaged = (BOOLEAN)!EFI_ERROR (Status);
|
||||
Status = gBS->ConnectController (UsbIf->Handle, NULL, NULL, TRUE);
|
||||
UsbIf->IsManaged = (BOOLEAN) !EFI_ERROR (Status);
|
||||
|
||||
DEBUG ((DEBUG_INFO, "UsbConnectDriver: TPL after connect is %d\n", (UINT32)UsbGetCurrentTpl()));
|
||||
DEBUG ((DEBUG_INFO, "UsbConnectDriver: TPL after connect is %d\n", (UINT32)UsbGetCurrentTpl ()));
|
||||
ASSERT (UsbGetCurrentTpl () == TPL_CALLBACK);
|
||||
|
||||
gBS->RaiseTPL (OldTpl);
|
||||
@@ -296,7 +294,6 @@ UsbConnectDriver (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Select an alternate setting for the interface.
|
||||
Each interface can have several mutually exclusive
|
||||
@@ -312,12 +309,12 @@ UsbConnectDriver (
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbSelectSetting (
|
||||
IN USB_INTERFACE_DESC *IfDesc,
|
||||
IN UINT8 Alternate
|
||||
IN USB_INTERFACE_DESC *IfDesc,
|
||||
IN UINT8 Alternate
|
||||
)
|
||||
{
|
||||
USB_INTERFACE_SETTING *Setting;
|
||||
UINTN Index;
|
||||
USB_INTERFACE_SETTING *Setting;
|
||||
UINTN Index;
|
||||
|
||||
//
|
||||
// Locate the active alternate setting
|
||||
@@ -340,8 +337,12 @@ UsbSelectSetting (
|
||||
IfDesc->ActiveIndex = Index;
|
||||
|
||||
ASSERT (Setting != NULL);
|
||||
DEBUG ((DEBUG_INFO, "UsbSelectSetting: setting %d selected for interface %d\n",
|
||||
Alternate, Setting->Desc.InterfaceNumber));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"UsbSelectSetting: setting %d selected for interface %d\n",
|
||||
Alternate,
|
||||
Setting->Desc.InterfaceNumber
|
||||
));
|
||||
|
||||
//
|
||||
// Reset the endpoint toggle to zero
|
||||
@@ -353,7 +354,6 @@ UsbSelectSetting (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Select a new configuration for the device. Each
|
||||
device may support several configurations.
|
||||
@@ -368,22 +368,22 @@ UsbSelectSetting (
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbSelectConfig (
|
||||
IN USB_DEVICE *Device,
|
||||
IN UINT8 ConfigValue
|
||||
IN USB_DEVICE *Device,
|
||||
IN UINT8 ConfigValue
|
||||
)
|
||||
{
|
||||
USB_DEVICE_DESC *DevDesc;
|
||||
USB_CONFIG_DESC *ConfigDesc;
|
||||
USB_INTERFACE_DESC *IfDesc;
|
||||
USB_INTERFACE *UsbIf;
|
||||
EFI_STATUS Status;
|
||||
UINT8 Index;
|
||||
USB_DEVICE_DESC *DevDesc;
|
||||
USB_CONFIG_DESC *ConfigDesc;
|
||||
USB_INTERFACE_DESC *IfDesc;
|
||||
USB_INTERFACE *UsbIf;
|
||||
EFI_STATUS Status;
|
||||
UINT8 Index;
|
||||
|
||||
//
|
||||
// Locate the active config, then set the device's pointer
|
||||
//
|
||||
DevDesc = Device->DevDesc;
|
||||
ConfigDesc = NULL;
|
||||
DevDesc = Device->DevDesc;
|
||||
ConfigDesc = NULL;
|
||||
|
||||
for (Index = 0; Index < DevDesc->Desc.NumConfigurations; Index++) {
|
||||
ConfigDesc = DevDesc->Configs[Index];
|
||||
@@ -399,8 +399,12 @@ UsbSelectConfig (
|
||||
|
||||
Device->ActiveConfig = ConfigDesc;
|
||||
|
||||
DEBUG ((DEBUG_INFO, "UsbSelectConfig: config %d selected for device %d\n",
|
||||
ConfigValue, Device->Address));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"UsbSelectConfig: config %d selected for device %d\n",
|
||||
ConfigValue,
|
||||
Device->Address
|
||||
));
|
||||
|
||||
//
|
||||
// Create interfaces for each USB interface descriptor.
|
||||
@@ -447,7 +451,6 @@ UsbSelectConfig (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Disconnect the USB interface with its driver.
|
||||
|
||||
@@ -456,11 +459,11 @@ UsbSelectConfig (
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbDisconnectDriver (
|
||||
IN USB_INTERFACE *UsbIf
|
||||
IN USB_INTERFACE *UsbIf
|
||||
)
|
||||
{
|
||||
EFI_TPL OldTpl;
|
||||
EFI_STATUS Status;
|
||||
EFI_TPL OldTpl;
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Release the hub if it's a hub controller, otherwise
|
||||
@@ -469,7 +472,6 @@ UsbDisconnectDriver (
|
||||
Status = EFI_SUCCESS;
|
||||
if (UsbIf->IsHub) {
|
||||
Status = UsbIf->HubApi->Release (UsbIf);
|
||||
|
||||
} else if (UsbIf->IsManaged) {
|
||||
//
|
||||
// This function is called in both UsbIoControlTransfer and
|
||||
@@ -478,7 +480,7 @@ UsbDisconnectDriver (
|
||||
// twisted TPL used. It should be no problem for us to connect
|
||||
// or disconnect at CALLBACK.
|
||||
//
|
||||
OldTpl = UsbGetCurrentTpl ();
|
||||
OldTpl = UsbGetCurrentTpl ();
|
||||
DEBUG ((DEBUG_INFO, "UsbDisconnectDriver: old TPL is %d, %p\n", (UINT32)OldTpl, UsbIf->Handle));
|
||||
|
||||
gBS->RestoreTPL (TPL_CALLBACK);
|
||||
@@ -488,7 +490,7 @@ UsbDisconnectDriver (
|
||||
UsbIf->IsManaged = FALSE;
|
||||
}
|
||||
|
||||
DEBUG (( DEBUG_INFO, "UsbDisconnectDriver: TPL after disconnect is %d, %d\n", (UINT32)UsbGetCurrentTpl(), Status));
|
||||
DEBUG ((DEBUG_INFO, "UsbDisconnectDriver: TPL after disconnect is %d, %d\n", (UINT32)UsbGetCurrentTpl (), Status));
|
||||
ASSERT (UsbGetCurrentTpl () == TPL_CALLBACK);
|
||||
|
||||
gBS->RaiseTPL (OldTpl);
|
||||
@@ -497,7 +499,6 @@ UsbDisconnectDriver (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Remove the current device configuration.
|
||||
|
||||
@@ -506,13 +507,13 @@ UsbDisconnectDriver (
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbRemoveConfig (
|
||||
IN USB_DEVICE *Device
|
||||
IN USB_DEVICE *Device
|
||||
)
|
||||
{
|
||||
USB_INTERFACE *UsbIf;
|
||||
UINTN Index;
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS ReturnStatus;
|
||||
USB_INTERFACE *UsbIf;
|
||||
UINTN Index;
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS ReturnStatus;
|
||||
|
||||
//
|
||||
// Remove each interface of the device
|
||||
@@ -541,11 +542,10 @@ UsbRemoveConfig (
|
||||
}
|
||||
}
|
||||
|
||||
Device->ActiveConfig = NULL;
|
||||
Device->ActiveConfig = NULL;
|
||||
return ReturnStatus;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Remove the device and all its children from the bus.
|
||||
|
||||
@@ -556,14 +556,14 @@ UsbRemoveConfig (
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbRemoveDevice (
|
||||
IN USB_DEVICE *Device
|
||||
IN USB_DEVICE *Device
|
||||
)
|
||||
{
|
||||
USB_BUS *Bus;
|
||||
USB_DEVICE *Child;
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS ReturnStatus;
|
||||
UINTN Index;
|
||||
USB_BUS *Bus;
|
||||
USB_DEVICE *Child;
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS ReturnStatus;
|
||||
UINTN Index;
|
||||
|
||||
Bus = Device->Bus;
|
||||
|
||||
@@ -585,7 +585,7 @@ UsbRemoveDevice (
|
||||
Bus->Devices[Index] = NULL;
|
||||
} else {
|
||||
Bus->Devices[Index]->DisconnectFail = TRUE;
|
||||
ReturnStatus = Status;
|
||||
ReturnStatus = Status;
|
||||
DEBUG ((DEBUG_INFO, "UsbRemoveDevice: failed to remove child %p at parent %p\n", Child, Device));
|
||||
}
|
||||
}
|
||||
@@ -597,7 +597,7 @@ UsbRemoveDevice (
|
||||
Status = UsbRemoveConfig (Device);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
DEBUG (( DEBUG_INFO, "UsbRemoveDevice: device %d removed\n", Device->Address));
|
||||
DEBUG ((DEBUG_INFO, "UsbRemoveDevice: device %d removed\n", Device->Address));
|
||||
|
||||
ASSERT (Device->Address < Bus->MaxDevices);
|
||||
Bus->Devices[Device->Address] = NULL;
|
||||
@@ -605,10 +605,10 @@ UsbRemoveDevice (
|
||||
} else {
|
||||
Bus->Devices[Device->Address]->DisconnectFail = TRUE;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Find the child device on the hub's port.
|
||||
|
||||
@@ -620,13 +620,13 @@ UsbRemoveDevice (
|
||||
**/
|
||||
USB_DEVICE *
|
||||
UsbFindChild (
|
||||
IN USB_INTERFACE *HubIf,
|
||||
IN UINT8 Port
|
||||
IN USB_INTERFACE *HubIf,
|
||||
IN UINT8 Port
|
||||
)
|
||||
{
|
||||
USB_DEVICE *Device;
|
||||
USB_BUS *Bus;
|
||||
UINTN Index;
|
||||
USB_DEVICE *Device;
|
||||
USB_BUS *Bus;
|
||||
UINTN Index;
|
||||
|
||||
Bus = HubIf->Device->Bus;
|
||||
|
||||
@@ -637,8 +637,8 @@ UsbFindChild (
|
||||
Device = Bus->Devices[Index];
|
||||
|
||||
if ((Device != NULL) && (Device->ParentAddr == HubIf->Device->Address) &&
|
||||
(Device->ParentPort == Port)) {
|
||||
|
||||
(Device->ParentPort == Port))
|
||||
{
|
||||
return Device;
|
||||
}
|
||||
}
|
||||
@@ -646,7 +646,6 @@ UsbFindChild (
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Enumerate and configure the new device on the port of this HUB interface.
|
||||
|
||||
@@ -661,19 +660,19 @@ UsbFindChild (
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbEnumerateNewDev (
|
||||
IN USB_INTERFACE *HubIf,
|
||||
IN UINT8 Port,
|
||||
IN BOOLEAN ResetIsNeeded
|
||||
IN USB_INTERFACE *HubIf,
|
||||
IN UINT8 Port,
|
||||
IN BOOLEAN ResetIsNeeded
|
||||
)
|
||||
{
|
||||
USB_BUS *Bus;
|
||||
USB_HUB_API *HubApi;
|
||||
USB_DEVICE *Child;
|
||||
USB_DEVICE *Parent;
|
||||
EFI_USB_PORT_STATUS PortState;
|
||||
UINTN Address;
|
||||
UINT8 Config;
|
||||
EFI_STATUS Status;
|
||||
USB_BUS *Bus;
|
||||
USB_HUB_API *HubApi;
|
||||
USB_DEVICE *Child;
|
||||
USB_DEVICE *Parent;
|
||||
EFI_USB_PORT_STATUS PortState;
|
||||
UINTN Address;
|
||||
UINT8 Config;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Parent = HubIf->Device;
|
||||
Bus = Parent->Bus;
|
||||
@@ -695,9 +694,10 @@ UsbEnumerateNewDev (
|
||||
|
||||
return Status;
|
||||
}
|
||||
DEBUG (( DEBUG_INFO, "UsbEnumerateNewDev: hub port %d is reset\n", Port));
|
||||
|
||||
DEBUG ((DEBUG_INFO, "UsbEnumerateNewDev: hub port %d is reset\n", Port));
|
||||
} else {
|
||||
DEBUG (( DEBUG_INFO, "UsbEnumerateNewDev: hub port %d reset is skipped\n", Port));
|
||||
DEBUG ((DEBUG_INFO, "UsbEnumerateNewDev: hub port %d reset is skipped\n", Port));
|
||||
}
|
||||
|
||||
Child = UsbCreateDevice (HubIf, Port);
|
||||
@@ -721,7 +721,7 @@ UsbEnumerateNewDev (
|
||||
DEBUG ((DEBUG_ERROR, "UsbEnumerateNewDev: No device present at port %d\n", Port));
|
||||
Status = EFI_NOT_FOUND;
|
||||
goto ON_ERROR;
|
||||
} else if (USB_BIT_IS_SET (PortState.PortStatus, USB_PORT_STAT_SUPER_SPEED)){
|
||||
} else if (USB_BIT_IS_SET (PortState.PortStatus, USB_PORT_STAT_SUPER_SPEED)) {
|
||||
Child->Speed = EFI_USB_SPEED_SUPER;
|
||||
Child->MaxPacket0 = 512;
|
||||
} else if (USB_BIT_IS_SET (PortState.PortStatus, USB_PORT_STAT_HIGH_SPEED)) {
|
||||
@@ -735,10 +735,11 @@ UsbEnumerateNewDev (
|
||||
Child->MaxPacket0 = 8;
|
||||
}
|
||||
|
||||
DEBUG (( DEBUG_INFO, "UsbEnumerateNewDev: device is of %d speed\n", Child->Speed));
|
||||
DEBUG ((DEBUG_INFO, "UsbEnumerateNewDev: device is of %d speed\n", Child->Speed));
|
||||
|
||||
if (((Child->Speed == EFI_USB_SPEED_LOW) || (Child->Speed == EFI_USB_SPEED_FULL)) &&
|
||||
(Parent->Speed == EFI_USB_SPEED_HIGH)) {
|
||||
(Parent->Speed == EFI_USB_SPEED_HIGH))
|
||||
{
|
||||
//
|
||||
// If the child is a low or full speed device, it is necessary to
|
||||
// set the transaction translator. Port TT is 1-based.
|
||||
@@ -746,14 +747,18 @@ UsbEnumerateNewDev (
|
||||
// 1. if parent is of high speed, then parent is our translator
|
||||
// 2. otherwise use parent's translator.
|
||||
//
|
||||
Child->Translator.TranslatorHubAddress = Parent->Address;
|
||||
Child->Translator.TranslatorPortNumber = (UINT8) (Port + 1);
|
||||
Child->Translator.TranslatorHubAddress = Parent->Address;
|
||||
Child->Translator.TranslatorPortNumber = (UINT8)(Port + 1);
|
||||
} else {
|
||||
Child->Translator = Parent->Translator;
|
||||
}
|
||||
DEBUG (( DEBUG_INFO, "UsbEnumerateNewDev: device uses translator (%d, %d)\n",
|
||||
Child->Translator.TranslatorHubAddress,
|
||||
Child->Translator.TranslatorPortNumber));
|
||||
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"UsbEnumerateNewDev: device uses translator (%d, %d)\n",
|
||||
Child->Translator.TranslatorHubAddress,
|
||||
Child->Translator.TranslatorPortNumber
|
||||
));
|
||||
|
||||
//
|
||||
// After port is reset, hub establishes a signal path between
|
||||
@@ -805,7 +810,7 @@ UsbEnumerateNewDev (
|
||||
goto ON_ERROR;
|
||||
}
|
||||
|
||||
DEBUG (( DEBUG_INFO, "UsbEnumerateNewDev: max packet size for EP 0 is %d\n", Child->MaxPacket0));
|
||||
DEBUG ((DEBUG_INFO, "UsbEnumerateNewDev: max packet size for EP 0 is %d\n", Child->MaxPacket0));
|
||||
|
||||
//
|
||||
// Host learns about the device's abilities by requesting device's
|
||||
@@ -830,7 +835,7 @@ UsbEnumerateNewDev (
|
||||
goto ON_ERROR;
|
||||
}
|
||||
|
||||
DEBUG (( DEBUG_INFO, "UsbEnumerateNewDev: device %d is now in CONFIGED state\n", Address));
|
||||
DEBUG ((DEBUG_INFO, "UsbEnumerateNewDev: device %d is now in CONFIGED state\n", Address));
|
||||
|
||||
//
|
||||
// Host assigns and loads a device driver.
|
||||
@@ -870,7 +875,6 @@ ON_ERROR:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Process the events on the port.
|
||||
|
||||
@@ -884,17 +888,17 @@ ON_ERROR:
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbEnumeratePort (
|
||||
IN USB_INTERFACE *HubIf,
|
||||
IN UINT8 Port
|
||||
IN USB_INTERFACE *HubIf,
|
||||
IN UINT8 Port
|
||||
)
|
||||
{
|
||||
USB_HUB_API *HubApi;
|
||||
USB_DEVICE *Child;
|
||||
EFI_USB_PORT_STATUS PortState;
|
||||
EFI_STATUS Status;
|
||||
USB_HUB_API *HubApi;
|
||||
USB_DEVICE *Child;
|
||||
EFI_USB_PORT_STATUS PortState;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Child = NULL;
|
||||
HubApi = HubIf->HubApi;
|
||||
Child = NULL;
|
||||
HubApi = HubIf->HubApi;
|
||||
|
||||
//
|
||||
// Host learns of the new device by polling the hub for port changes.
|
||||
@@ -914,8 +918,14 @@ UsbEnumeratePort (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
DEBUG (( DEBUG_INFO, "UsbEnumeratePort: port %d state - %02x, change - %02x on %p\n",
|
||||
Port, PortState.PortStatus, PortState.PortChangeStatus, HubIf));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"UsbEnumeratePort: port %d state - %02x, change - %02x on %p\n",
|
||||
Port,
|
||||
PortState.PortStatus,
|
||||
PortState.PortChangeStatus,
|
||||
HubIf
|
||||
));
|
||||
|
||||
//
|
||||
// This driver only process two kinds of events now: over current and
|
||||
@@ -924,7 +934,6 @@ UsbEnumeratePort (
|
||||
//
|
||||
|
||||
if (USB_BIT_IS_SET (PortState.PortChangeStatus, USB_PORT_STAT_C_OVERCURRENT)) {
|
||||
|
||||
if (USB_BIT_IS_SET (PortState.PortStatus, USB_PORT_STAT_OVERCURRENT)) {
|
||||
//
|
||||
// Case1:
|
||||
@@ -932,17 +941,17 @@ UsbEnumeratePort (
|
||||
// which probably is caused by short circuit. It has to wait system hardware
|
||||
// to perform recovery.
|
||||
//
|
||||
DEBUG (( DEBUG_ERROR, "UsbEnumeratePort: Critical Over Current\n", Port));
|
||||
DEBUG ((DEBUG_ERROR, "UsbEnumeratePort: Critical Over Current\n", Port));
|
||||
return EFI_DEVICE_ERROR;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Case2:
|
||||
// Only OverCurrentChange set, means system has been recoveried from
|
||||
// over current. As a result, all ports are nearly power-off, so
|
||||
// it's necessary to detach and enumerate all ports again.
|
||||
//
|
||||
DEBUG (( DEBUG_ERROR, "UsbEnumeratePort: 2.0 device Recovery Over Current\n", Port));
|
||||
DEBUG ((DEBUG_ERROR, "UsbEnumeratePort: 2.0 device Recovery Over Current\n", Port));
|
||||
}
|
||||
|
||||
if (USB_BIT_IS_SET (PortState.PortChangeStatus, USB_PORT_STAT_C_ENABLE)) {
|
||||
@@ -952,7 +961,7 @@ UsbEnumeratePort (
|
||||
// on 2.0 roothub does. When over-current has influence on 1.1 device, the port
|
||||
// would be disabled, so it's also necessary to detach and enumerate again.
|
||||
//
|
||||
DEBUG (( DEBUG_ERROR, "UsbEnumeratePort: 1.1 device Recovery Over Current\n", Port));
|
||||
DEBUG ((DEBUG_ERROR, "UsbEnumeratePort: 1.1 device Recovery Over Current\n", Port));
|
||||
}
|
||||
|
||||
if (USB_BIT_IS_SET (PortState.PortChangeStatus, USB_PORT_STAT_C_CONNECTION)) {
|
||||
@@ -969,7 +978,7 @@ UsbEnumeratePort (
|
||||
Child = UsbFindChild (HubIf, Port);
|
||||
|
||||
if (Child != NULL) {
|
||||
DEBUG (( DEBUG_INFO, "UsbEnumeratePort: device at port %d removed from root hub %p\n", Port, HubIf));
|
||||
DEBUG ((DEBUG_INFO, "UsbEnumeratePort: device at port %d removed from root hub %p\n", Port, HubIf));
|
||||
UsbRemoveDevice (Child);
|
||||
}
|
||||
|
||||
@@ -977,22 +986,20 @@ UsbEnumeratePort (
|
||||
//
|
||||
// Now, new device connected, enumerate and configure the device
|
||||
//
|
||||
DEBUG (( DEBUG_INFO, "UsbEnumeratePort: new device connected at port %d\n", Port));
|
||||
DEBUG ((DEBUG_INFO, "UsbEnumeratePort: new device connected at port %d\n", Port));
|
||||
if (USB_BIT_IS_SET (PortState.PortChangeStatus, USB_PORT_STAT_C_RESET)) {
|
||||
Status = UsbEnumerateNewDev (HubIf, Port, FALSE);
|
||||
} else {
|
||||
Status = UsbEnumerateNewDev (HubIf, Port, TRUE);
|
||||
}
|
||||
|
||||
} else {
|
||||
DEBUG (( DEBUG_INFO, "UsbEnumeratePort: device disconnected event on port %d\n", Port));
|
||||
DEBUG ((DEBUG_INFO, "UsbEnumeratePort: device disconnected event on port %d\n", Port));
|
||||
}
|
||||
|
||||
HubApi->ClearPortChange (HubIf, Port);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Enumerate all the changed hub ports.
|
||||
|
||||
@@ -1003,37 +1010,37 @@ UsbEnumeratePort (
|
||||
VOID
|
||||
EFIAPI
|
||||
UsbHubEnumeration (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
USB_INTERFACE *HubIf;
|
||||
UINT8 Byte;
|
||||
UINT8 Bit;
|
||||
UINT8 Index;
|
||||
USB_DEVICE *Child;
|
||||
USB_INTERFACE *HubIf;
|
||||
UINT8 Byte;
|
||||
UINT8 Bit;
|
||||
UINT8 Index;
|
||||
USB_DEVICE *Child;
|
||||
|
||||
ASSERT (Context != NULL);
|
||||
|
||||
HubIf = (USB_INTERFACE *) Context;
|
||||
HubIf = (USB_INTERFACE *)Context;
|
||||
|
||||
for (Index = 0; Index < HubIf->NumOfPort; Index++) {
|
||||
Child = UsbFindChild (HubIf, Index);
|
||||
if ((Child != NULL) && (Child->DisconnectFail == TRUE)) {
|
||||
DEBUG (( DEBUG_INFO, "UsbEnumeratePort: The device disconnect fails at port %d from hub %p, try again\n", Index, HubIf));
|
||||
DEBUG ((DEBUG_INFO, "UsbEnumeratePort: The device disconnect fails at port %d from hub %p, try again\n", Index, HubIf));
|
||||
UsbRemoveDevice (Child);
|
||||
}
|
||||
}
|
||||
|
||||
if (HubIf->ChangeMap == NULL) {
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// HUB starts its port index with 1.
|
||||
//
|
||||
Byte = 0;
|
||||
Bit = 1;
|
||||
Byte = 0;
|
||||
Bit = 1;
|
||||
|
||||
for (Index = 0; Index < HubIf->NumOfPort; Index++) {
|
||||
if (USB_BIT_IS_SET (HubIf->ChangeMap[Byte], USB_BIT (Bit))) {
|
||||
@@ -1047,10 +1054,9 @@ UsbHubEnumeration (
|
||||
|
||||
gBS->FreePool (HubIf->ChangeMap);
|
||||
HubIf->ChangeMap = NULL;
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Enumerate all the changed hub ports.
|
||||
|
||||
@@ -1061,20 +1067,20 @@ UsbHubEnumeration (
|
||||
VOID
|
||||
EFIAPI
|
||||
UsbRootHubEnumeration (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
USB_INTERFACE *RootHub;
|
||||
UINT8 Index;
|
||||
USB_DEVICE *Child;
|
||||
USB_INTERFACE *RootHub;
|
||||
UINT8 Index;
|
||||
USB_DEVICE *Child;
|
||||
|
||||
RootHub = (USB_INTERFACE *) Context;
|
||||
RootHub = (USB_INTERFACE *)Context;
|
||||
|
||||
for (Index = 0; Index < RootHub->NumOfPort; Index++) {
|
||||
Child = UsbFindChild (RootHub, Index);
|
||||
if ((Child != NULL) && (Child->DisconnectFail == TRUE)) {
|
||||
DEBUG (( DEBUG_INFO, "UsbEnumeratePort: The device disconnect fails at port %d from root hub %p, try again\n", Index, RootHub));
|
||||
DEBUG ((DEBUG_INFO, "UsbEnumeratePort: The device disconnect fails at port %d from root hub %p, try again\n", Index, RootHub));
|
||||
UsbRemoveDevice (Child);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user