diff options
author | Michael Kubacki <michael.kubacki@microsoft.com> | 2021-12-05 14:54:02 -0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2021-12-07 17:24:28 +0000 |
commit | 1436aea4d5707e672672a11bda72be2c63c936c3 (patch) | |
tree | 370c9d5bd8823aa8ea7bce71a0f29bff71feff67 /MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c | |
parent | 7c7184e201a90a1d2376e615e55e3f4074731468 (diff) | |
download | edk2-1436aea4d5707e672672a11bda72be2c63c936c3.tar.gz edk2-1436aea4d5707e672672a11bda72be2c63c936c3.tar.bz2 edk2-1436aea4d5707e672672a11bda72be2c63c936c3.zip |
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>
Diffstat (limited to 'MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c')
-rw-r--r-- | MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c | 541 |
1 files changed, 275 insertions, 266 deletions
diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c index 7e48a2882c..6a3ac63c3a 100644 --- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c +++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c @@ -9,7 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include "UsbBus.h"
-EFI_USB_IO_PROTOCOL mUsbIoProtocol = {
+EFI_USB_IO_PROTOCOL mUsbIoProtocol = {
UsbIoControlTransfer,
UsbIoBulkTransfer,
UsbIoAsyncInterruptTransfer,
@@ -25,7 +25,7 @@ EFI_USB_IO_PROTOCOL mUsbIoProtocol = { UsbIoPortReset
};
-EFI_DRIVER_BINDING_PROTOCOL mUsbBusDriverBinding = {
+EFI_DRIVER_BINDING_PROTOCOL mUsbBusDriverBinding = {
UsbBusControllerDriverSupported,
UsbBusControllerDriverStart,
UsbBusControllerDriverStop,
@@ -65,12 +65,12 @@ UsbIoControlTransfer ( OUT UINT32 *UsbStatus
)
{
- USB_DEVICE *Dev;
- USB_INTERFACE *UsbIf;
- USB_ENDPOINT_DESC *EpDesc;
- EFI_TPL OldTpl;
- EFI_STATUS Status;
- UINTN RequestedDataLength;
+ USB_DEVICE *Dev;
+ USB_INTERFACE *UsbIf;
+ USB_ENDPOINT_DESC *EpDesc;
+ EFI_TPL OldTpl;
+ EFI_STATUS Status;
+ UINTN RequestedDataLength;
if (UsbStatus == NULL) {
return EFI_INVALID_PARAMETER;
@@ -78,23 +78,23 @@ UsbIoControlTransfer ( OldTpl = gBS->RaiseTPL (USB_BUS_TPL);
- UsbIf = USB_INTERFACE_FROM_USBIO (This);
- Dev = UsbIf->Device;
+ UsbIf = USB_INTERFACE_FROM_USBIO (This);
+ Dev = UsbIf->Device;
RequestedDataLength = DataLength;
- Status = UsbHcControlTransfer (
- Dev->Bus,
- Dev->Address,
- Dev->Speed,
- Dev->MaxPacket0,
- Request,
- Direction,
- Data,
- &DataLength,
- (UINTN) Timeout,
- &Dev->Translator,
- UsbStatus
- );
+ Status = UsbHcControlTransfer (
+ Dev->Bus,
+ Dev->Address,
+ Dev->Speed,
+ Dev->MaxPacket0,
+ Request,
+ Direction,
+ Data,
+ &DataLength,
+ (UINTN)Timeout,
+ &Dev->Translator,
+ UsbStatus
+ );
//
// If the request completed successfully and the Direction of the request is
// EfiUsbDataIn or EfiUsbDataOut, then make sure the actual number of bytes
@@ -102,7 +102,7 @@ UsbIoControlTransfer ( // number of bytes were transferred, then return EFI_DEVICE_ERROR.
//
if (!EFI_ERROR (Status)) {
- if (Direction != EfiUsbNoData && DataLength != RequestedDataLength) {
+ if ((Direction != EfiUsbNoData) && (DataLength != RequestedDataLength)) {
Status = EFI_DEVICE_ERROR;
goto ON_EXIT;
}
@@ -139,11 +139,14 @@ UsbIoControlTransfer ( // Reset the endpoint toggle when endpoint stall is cleared
//
if ((Request->Request == USB_REQ_CLEAR_FEATURE) &&
- (Request->RequestType == USB_REQUEST_TYPE (EfiUsbNoData, USB_REQ_TYPE_STANDARD,
- USB_TARGET_ENDPOINT)) &&
- (Request->Value == USB_FEATURE_ENDPOINT_HALT)) {
-
- EpDesc = UsbGetEndpointDesc (UsbIf, (UINT8) Request->Index);
+ (Request->RequestType == USB_REQUEST_TYPE (
+ EfiUsbNoData,
+ USB_REQ_TYPE_STANDARD,
+ USB_TARGET_ENDPOINT
+ )) &&
+ (Request->Value == USB_FEATURE_ENDPOINT_HALT))
+ {
+ EpDesc = UsbGetEndpointDesc (UsbIf, (UINT8)Request->Index);
if (EpDesc != NULL) {
EpDesc->Toggle = 0;
@@ -158,16 +161,21 @@ UsbIoControlTransfer ( // completely irrelevant.
//
if ((Request->Request == USB_REQ_SET_CONFIG) &&
- (Request->RequestType == USB_REQUEST_TYPE (EfiUsbNoData, USB_REQ_TYPE_STANDARD,
- USB_TARGET_DEVICE))) {
+ (Request->RequestType == USB_REQUEST_TYPE (
+ EfiUsbNoData,
+ USB_REQ_TYPE_STANDARD,
+ USB_TARGET_DEVICE
+ )))
+ {
//
// Don't re-create the USB interfaces if configuration isn't changed.
//
if ((Dev->ActiveConfig != NULL) &&
- (Request->Value == Dev->ActiveConfig->Desc.ConfigurationValue)) {
-
+ (Request->Value == Dev->ActiveConfig->Desc.ConfigurationValue))
+ {
goto ON_EXIT;
}
+
DEBUG ((DEBUG_INFO, "UsbIoControlTransfer: configure changed!!! Do NOT use old UsbIo!!!\n"));
if (Dev->ActiveConfig != NULL) {
@@ -175,7 +183,7 @@ UsbIoControlTransfer ( }
if (Request->Value != 0) {
- Status = UsbSelectConfig (Dev, (UINT8) Request->Value);
+ Status = UsbSelectConfig (Dev, (UINT8)Request->Value);
}
//
@@ -191,11 +199,14 @@ UsbIoControlTransfer ( // should remains the same.
//
if ((Request->Request == USB_REQ_SET_INTERFACE) &&
- (Request->RequestType == USB_REQUEST_TYPE (EfiUsbNoData, USB_REQ_TYPE_STANDARD,
- USB_TARGET_INTERFACE)) &&
- (Request->Index == UsbIf->IfSetting->Desc.InterfaceNumber)) {
-
- Status = UsbSelectSetting (UsbIf->IfDesc, (UINT8) Request->Value);
+ (Request->RequestType == USB_REQUEST_TYPE (
+ EfiUsbNoData,
+ USB_REQ_TYPE_STANDARD,
+ USB_TARGET_INTERFACE
+ )) &&
+ (Request->Index == UsbIf->IfSetting->Desc.InterfaceNumber))
+ {
+ Status = UsbSelectSetting (UsbIf->IfDesc, (UINT8)Request->Value);
if (!EFI_ERROR (Status)) {
ASSERT (UsbIf->IfDesc->ActiveIndex < USB_MAX_INTERFACE_SETTING);
@@ -208,7 +219,6 @@ ON_EXIT: return Status;
}
-
/**
Execute a bulk transfer to the device endpoint.
@@ -228,56 +238,56 @@ ON_EXIT: EFI_STATUS
EFIAPI
UsbIoBulkTransfer (
- IN EFI_USB_IO_PROTOCOL *This,
- IN UINT8 Endpoint,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN UINTN Timeout,
- OUT UINT32 *UsbStatus
+ IN EFI_USB_IO_PROTOCOL *This,
+ IN UINT8 Endpoint,
+ IN OUT VOID *Data,
+ IN OUT UINTN *DataLength,
+ IN UINTN Timeout,
+ OUT UINT32 *UsbStatus
)
{
- USB_DEVICE *Dev;
- USB_INTERFACE *UsbIf;
- USB_ENDPOINT_DESC *EpDesc;
- UINT8 BufNum;
- UINT8 Toggle;
- EFI_TPL OldTpl;
- EFI_STATUS Status;
-
- if ((USB_ENDPOINT_ADDR (Endpoint) == 0) || (USB_ENDPOINT_ADDR(Endpoint) > 15) ||
- (UsbStatus == NULL)) {
-
+ USB_DEVICE *Dev;
+ USB_INTERFACE *UsbIf;
+ USB_ENDPOINT_DESC *EpDesc;
+ UINT8 BufNum;
+ UINT8 Toggle;
+ EFI_TPL OldTpl;
+ EFI_STATUS Status;
+
+ if ((USB_ENDPOINT_ADDR (Endpoint) == 0) || (USB_ENDPOINT_ADDR (Endpoint) > 15) ||
+ (UsbStatus == NULL))
+ {
return EFI_INVALID_PARAMETER;
}
- OldTpl = gBS->RaiseTPL (USB_BUS_TPL);
+ OldTpl = gBS->RaiseTPL (USB_BUS_TPL);
- UsbIf = USB_INTERFACE_FROM_USBIO (This);
- Dev = UsbIf->Device;
+ UsbIf = USB_INTERFACE_FROM_USBIO (This);
+ Dev = UsbIf->Device;
- EpDesc = UsbGetEndpointDesc (UsbIf, Endpoint);
+ EpDesc = UsbGetEndpointDesc (UsbIf, Endpoint);
if ((EpDesc == NULL) || (USB_ENDPOINT_TYPE (&EpDesc->Desc) != USB_ENDPOINT_BULK)) {
Status = EFI_INVALID_PARAMETER;
goto ON_EXIT;
}
- BufNum = 1;
- Toggle = EpDesc->Toggle;
- Status = UsbHcBulkTransfer (
- Dev->Bus,
- Dev->Address,
- Endpoint,
- Dev->Speed,
- EpDesc->Desc.MaxPacketSize,
- BufNum,
- &Data,
- DataLength,
- &Toggle,
- Timeout,
- &Dev->Translator,
- UsbStatus
- );
+ BufNum = 1;
+ Toggle = EpDesc->Toggle;
+ Status = UsbHcBulkTransfer (
+ Dev->Bus,
+ Dev->Address,
+ Endpoint,
+ Dev->Speed,
+ EpDesc->Desc.MaxPacketSize,
+ BufNum,
+ &Data,
+ DataLength,
+ &Toggle,
+ Timeout,
+ &Dev->Translator,
+ UsbStatus
+ );
EpDesc->Toggle = Toggle;
@@ -303,7 +313,6 @@ ON_EXIT: return Status;
}
-
/**
Execute a synchronous interrupt transfer.
@@ -323,33 +332,33 @@ ON_EXIT: EFI_STATUS
EFIAPI
UsbIoSyncInterruptTransfer (
- IN EFI_USB_IO_PROTOCOL *This,
- IN UINT8 Endpoint,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN UINTN Timeout,
- OUT UINT32 *UsbStatus
+ IN EFI_USB_IO_PROTOCOL *This,
+ IN UINT8 Endpoint,
+ IN OUT VOID *Data,
+ IN OUT UINTN *DataLength,
+ IN UINTN Timeout,
+ OUT UINT32 *UsbStatus
)
{
- USB_DEVICE *Dev;
- USB_INTERFACE *UsbIf;
- USB_ENDPOINT_DESC *EpDesc;
- EFI_TPL OldTpl;
- UINT8 Toggle;
- EFI_STATUS Status;
-
- if ((USB_ENDPOINT_ADDR (Endpoint) == 0) || (USB_ENDPOINT_ADDR(Endpoint) > 15) ||
- (UsbStatus == NULL)) {
-
+ USB_DEVICE *Dev;
+ USB_INTERFACE *UsbIf;
+ USB_ENDPOINT_DESC *EpDesc;
+ EFI_TPL OldTpl;
+ UINT8 Toggle;
+ EFI_STATUS Status;
+
+ if ((USB_ENDPOINT_ADDR (Endpoint) == 0) || (USB_ENDPOINT_ADDR (Endpoint) > 15) ||
+ (UsbStatus == NULL))
+ {
return EFI_INVALID_PARAMETER;
}
- OldTpl = gBS->RaiseTPL (USB_BUS_TPL);
+ OldTpl = gBS->RaiseTPL (USB_BUS_TPL);
- UsbIf = USB_INTERFACE_FROM_USBIO (This);
- Dev = UsbIf->Device;
+ UsbIf = USB_INTERFACE_FROM_USBIO (This);
+ Dev = UsbIf->Device;
- EpDesc = UsbGetEndpointDesc (UsbIf, Endpoint);
+ EpDesc = UsbGetEndpointDesc (UsbIf, Endpoint);
if ((EpDesc == NULL) || (USB_ENDPOINT_TYPE (&EpDesc->Desc) != USB_ENDPOINT_INTERRUPT)) {
Status = EFI_INVALID_PARAMETER;
@@ -378,7 +387,6 @@ ON_EXIT: return Status;
}
-
/**
Queue a new asynchronous interrupt transfer, or remove the old
request if (IsNewTransfer == FALSE).
@@ -411,43 +419,43 @@ UsbIoAsyncInterruptTransfer ( IN VOID *Context OPTIONAL
)
{
- USB_DEVICE *Dev;
- USB_INTERFACE *UsbIf;
- USB_ENDPOINT_DESC *EpDesc;
- EFI_TPL OldTpl;
- UINT8 Toggle;
- EFI_STATUS Status;
+ USB_DEVICE *Dev;
+ USB_INTERFACE *UsbIf;
+ USB_ENDPOINT_DESC *EpDesc;
+ EFI_TPL OldTpl;
+ UINT8 Toggle;
+ EFI_STATUS Status;
if ((USB_ENDPOINT_ADDR (Endpoint) == 0) || (USB_ENDPOINT_ADDR (Endpoint) > 15)) {
return EFI_INVALID_PARAMETER;
}
- OldTpl = gBS->RaiseTPL (USB_BUS_TPL);
- UsbIf = USB_INTERFACE_FROM_USBIO (This);
- Dev = UsbIf->Device;
+ OldTpl = gBS->RaiseTPL (USB_BUS_TPL);
+ UsbIf = USB_INTERFACE_FROM_USBIO (This);
+ Dev = UsbIf->Device;
- EpDesc = UsbGetEndpointDesc (UsbIf, Endpoint);
+ EpDesc = UsbGetEndpointDesc (UsbIf, Endpoint);
if ((EpDesc == NULL) || (USB_ENDPOINT_TYPE (&EpDesc->Desc) != USB_ENDPOINT_INTERRUPT)) {
Status = EFI_INVALID_PARAMETER;
goto ON_EXIT;
}
- Toggle = EpDesc->Toggle;
- Status = UsbHcAsyncInterruptTransfer (
- Dev->Bus,
- Dev->Address,
- Endpoint,
- Dev->Speed,
- EpDesc->Desc.MaxPacketSize,
- IsNewTransfer,
- &Toggle,
- PollInterval,
- DataLength,
- &Dev->Translator,
- Callback,
- Context
- );
+ Toggle = EpDesc->Toggle;
+ Status = UsbHcAsyncInterruptTransfer (
+ Dev->Bus,
+ Dev->Address,
+ Endpoint,
+ Dev->Speed,
+ EpDesc->Desc.MaxPacketSize,
+ IsNewTransfer,
+ &Toggle,
+ PollInterval,
+ DataLength,
+ &Dev->Translator,
+ Callback,
+ Context
+ );
EpDesc->Toggle = Toggle;
@@ -456,7 +464,6 @@ ON_EXIT: return Status;
}
-
/**
Execute a synchronous isochronous transfer.
@@ -472,17 +479,16 @@ ON_EXIT: EFI_STATUS
EFIAPI
UsbIoIsochronousTransfer (
- IN EFI_USB_IO_PROTOCOL *This,
- IN UINT8 DeviceEndpoint,
- IN OUT VOID *Data,
- IN UINTN DataLength,
- OUT UINT32 *Status
+ IN EFI_USB_IO_PROTOCOL *This,
+ IN UINT8 DeviceEndpoint,
+ IN OUT VOID *Data,
+ IN UINTN DataLength,
+ OUT UINT32 *Status
)
{
return EFI_UNSUPPORTED;
}
-
/**
Queue an asynchronous isochronous transfer.
@@ -511,7 +517,6 @@ UsbIoAsyncIsochronousTransfer ( return EFI_UNSUPPORTED;
}
-
/**
Retrieve the device descriptor of the device.
@@ -525,13 +530,13 @@ UsbIoAsyncIsochronousTransfer ( EFI_STATUS
EFIAPI
UsbIoGetDeviceDescriptor (
- IN EFI_USB_IO_PROTOCOL *This,
- OUT EFI_USB_DEVICE_DESCRIPTOR *Descriptor
+ IN EFI_USB_IO_PROTOCOL *This,
+ OUT EFI_USB_DEVICE_DESCRIPTOR *Descriptor
)
{
- USB_DEVICE *Dev;
- USB_INTERFACE *UsbIf;
- EFI_TPL OldTpl;
+ USB_DEVICE *Dev;
+ USB_INTERFACE *UsbIf;
+ EFI_TPL OldTpl;
if (Descriptor == NULL) {
return EFI_INVALID_PARAMETER;
@@ -539,8 +544,8 @@ UsbIoGetDeviceDescriptor ( OldTpl = gBS->RaiseTPL (USB_BUS_TPL);
- UsbIf = USB_INTERFACE_FROM_USBIO (This);
- Dev = UsbIf->Device;
+ UsbIf = USB_INTERFACE_FROM_USBIO (This);
+ Dev = UsbIf->Device;
CopyMem (Descriptor, &Dev->DevDesc->Desc, sizeof (EFI_USB_DEVICE_DESCRIPTOR));
@@ -548,7 +553,6 @@ UsbIoGetDeviceDescriptor ( return EFI_SUCCESS;
}
-
/**
Return the configuration descriptor of the current active configuration.
@@ -563,14 +567,14 @@ UsbIoGetDeviceDescriptor ( EFI_STATUS
EFIAPI
UsbIoGetActiveConfigDescriptor (
- IN EFI_USB_IO_PROTOCOL *This,
- OUT EFI_USB_CONFIG_DESCRIPTOR *Descriptor
+ IN EFI_USB_IO_PROTOCOL *This,
+ OUT EFI_USB_CONFIG_DESCRIPTOR *Descriptor
)
{
- USB_DEVICE *Dev;
- USB_INTERFACE *UsbIf;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
+ USB_DEVICE *Dev;
+ USB_INTERFACE *UsbIf;
+ EFI_STATUS Status;
+ EFI_TPL OldTpl;
if (Descriptor == NULL) {
return EFI_INVALID_PARAMETER;
@@ -579,8 +583,8 @@ UsbIoGetActiveConfigDescriptor ( Status = EFI_SUCCESS;
OldTpl = gBS->RaiseTPL (USB_BUS_TPL);
- UsbIf = USB_INTERFACE_FROM_USBIO (This);
- Dev = UsbIf->Device;
+ UsbIf = USB_INTERFACE_FROM_USBIO (This);
+ Dev = UsbIf->Device;
if (Dev->ActiveConfig == NULL) {
Status = EFI_NOT_FOUND;
@@ -594,7 +598,6 @@ ON_EXIT: return Status;
}
-
/**
Retrieve the active interface setting descriptor for this USB IO instance.
@@ -612,8 +615,8 @@ UsbIoGetInterfaceDescriptor ( OUT EFI_USB_INTERFACE_DESCRIPTOR *Descriptor
)
{
- USB_INTERFACE *UsbIf;
- EFI_TPL OldTpl;
+ USB_INTERFACE *UsbIf;
+ EFI_TPL OldTpl;
if (Descriptor == NULL) {
return EFI_INVALID_PARAMETER;
@@ -621,14 +624,13 @@ UsbIoGetInterfaceDescriptor ( OldTpl = gBS->RaiseTPL (USB_BUS_TPL);
- UsbIf = USB_INTERFACE_FROM_USBIO (This);
+ UsbIf = USB_INTERFACE_FROM_USBIO (This);
CopyMem (Descriptor, &(UsbIf->IfSetting->Desc), sizeof (EFI_USB_INTERFACE_DESCRIPTOR));
gBS->RestoreTPL (OldTpl);
return EFI_SUCCESS;
}
-
/**
Retrieve the endpoint descriptor from this interface setting.
@@ -644,17 +646,17 @@ UsbIoGetInterfaceDescriptor ( EFI_STATUS
EFIAPI
UsbIoGetEndpointDescriptor (
- IN EFI_USB_IO_PROTOCOL *This,
- IN UINT8 Index,
- OUT EFI_USB_ENDPOINT_DESCRIPTOR *Descriptor
+ IN EFI_USB_IO_PROTOCOL *This,
+ IN UINT8 Index,
+ OUT EFI_USB_ENDPOINT_DESCRIPTOR *Descriptor
)
{
- USB_INTERFACE *UsbIf;
- EFI_TPL OldTpl;
+ USB_INTERFACE *UsbIf;
+ EFI_TPL OldTpl;
OldTpl = gBS->RaiseTPL (USB_BUS_TPL);
- UsbIf = USB_INTERFACE_FROM_USBIO (This);
+ UsbIf = USB_INTERFACE_FROM_USBIO (This);
if ((Descriptor == NULL) || (Index > 15)) {
gBS->RestoreTPL (OldTpl);
@@ -676,7 +678,6 @@ UsbIoGetEndpointDescriptor ( return EFI_SUCCESS;
}
-
/**
Retrieve the supported language ID table from the device.
@@ -690,28 +691,27 @@ UsbIoGetEndpointDescriptor ( EFI_STATUS
EFIAPI
UsbIoGetSupportedLanguages (
- IN EFI_USB_IO_PROTOCOL *This,
- OUT UINT16 **LangIDTable,
- OUT UINT16 *TableSize
+ IN EFI_USB_IO_PROTOCOL *This,
+ OUT UINT16 **LangIDTable,
+ OUT UINT16 *TableSize
)
{
- USB_DEVICE *Dev;
- USB_INTERFACE *UsbIf;
- EFI_TPL OldTpl;
+ USB_DEVICE *Dev;
+ USB_INTERFACE *UsbIf;
+ EFI_TPL OldTpl;
- OldTpl = gBS->RaiseTPL (USB_BUS_TPL);
+ OldTpl = gBS->RaiseTPL (USB_BUS_TPL);
- UsbIf = USB_INTERFACE_FROM_USBIO (This);
- Dev = UsbIf->Device;
+ UsbIf = USB_INTERFACE_FROM_USBIO (This);
+ Dev = UsbIf->Device;
- *LangIDTable = Dev->LangId;
- *TableSize = (UINT16) (Dev->TotalLangId * sizeof (UINT16));
+ *LangIDTable = Dev->LangId;
+ *TableSize = (UINT16)(Dev->TotalLangId * sizeof (UINT16));
gBS->RestoreTPL (OldTpl);
return EFI_SUCCESS;
}
-
/**
Retrieve an indexed string in the language of LangID.
@@ -727,19 +727,19 @@ UsbIoGetSupportedLanguages ( EFI_STATUS
EFIAPI
UsbIoGetStringDescriptor (
- IN EFI_USB_IO_PROTOCOL *This,
- IN UINT16 LangID,
- IN UINT8 StringIndex,
- OUT CHAR16 **String
+ IN EFI_USB_IO_PROTOCOL *This,
+ IN UINT16 LangID,
+ IN UINT8 StringIndex,
+ OUT CHAR16 **String
)
{
- USB_DEVICE *Dev;
- USB_INTERFACE *UsbIf;
- EFI_USB_STRING_DESCRIPTOR *StrDesc;
- EFI_TPL OldTpl;
- UINT8 *Buf;
- UINT8 Index;
- EFI_STATUS Status;
+ USB_DEVICE *Dev;
+ USB_INTERFACE *UsbIf;
+ EFI_USB_STRING_DESCRIPTOR *StrDesc;
+ EFI_TPL OldTpl;
+ UINT8 *Buf;
+ UINT8 Index;
+ EFI_STATUS Status;
if ((StringIndex == 0) || (LangID == 0)) {
return EFI_NOT_FOUND;
@@ -747,8 +747,8 @@ UsbIoGetStringDescriptor ( OldTpl = gBS->RaiseTPL (USB_BUS_TPL);
- UsbIf = USB_INTERFACE_FROM_USBIO (This);
- Dev = UsbIf->Device;
+ UsbIf = USB_INTERFACE_FROM_USBIO (This);
+ Dev = UsbIf->Device;
//
// Check whether language ID is supported
@@ -788,7 +788,7 @@ UsbIoGetStringDescriptor ( }
CopyMem (Buf, StrDesc->String, StrDesc->Length - 2);
- *String = (CHAR16 *) Buf;
+ *String = (CHAR16 *)Buf;
Status = EFI_SUCCESS;
FREE_STR:
@@ -799,7 +799,6 @@ ON_EXIT: return Status;
}
-
/**
Reset the device, then if that succeeds, reconfigure the
device with its address and current active configuration.
@@ -816,17 +815,17 @@ UsbIoPortReset ( IN EFI_USB_IO_PROTOCOL *This
)
{
- USB_INTERFACE *UsbIf;
- USB_INTERFACE *HubIf;
- USB_DEVICE *Dev;
- EFI_TPL OldTpl;
- EFI_STATUS Status;
- UINT8 DevAddress;
+ USB_INTERFACE *UsbIf;
+ USB_INTERFACE *HubIf;
+ USB_DEVICE *Dev;
+ EFI_TPL OldTpl;
+ EFI_STATUS Status;
+ UINT8 DevAddress;
OldTpl = gBS->RaiseTPL (USB_BUS_TPL);
- UsbIf = USB_INTERFACE_FROM_USBIO (This);
- Dev = UsbIf->Device;
+ UsbIf = USB_INTERFACE_FROM_USBIO (This);
+ Dev = UsbIf->Device;
if (UsbIf->IsHub) {
Status = EFI_INVALID_PARAMETER;
@@ -837,8 +836,13 @@ UsbIoPortReset ( Status = HubIf->HubApi->ResetPort (HubIf, Dev->ParentPort);
if (EFI_ERROR (Status)) {
- DEBUG (( DEBUG_ERROR, "UsbIoPortReset: failed to reset hub port %d@hub %d, %r \n",
- Dev->ParentPort, Dev->ParentAddr, Status));
+ DEBUG ((
+ DEBUG_ERROR,
+ "UsbIoPortReset: failed to reset hub port %d@hub %d, %r \n",
+ Dev->ParentPort,
+ Dev->ParentAddr,
+ Status
+ ));
goto ON_EXIT;
}
@@ -852,7 +856,7 @@ UsbIoPortReset ( //
DevAddress = Dev->Address;
Dev->Address = 0;
- Status = UsbSetAddress (Dev, DevAddress);
+ Status = UsbSetAddress (Dev, DevAddress);
Dev->Address = DevAddress;
gBS->Stall (USB_SET_DEVICE_ADDRESS_STALL);
@@ -861,13 +865,17 @@ UsbIoPortReset ( //
// It may fail due to device disconnection or other reasons.
//
- DEBUG (( DEBUG_ERROR, "UsbIoPortReset: failed to set address for device %d - %r\n",
- Dev->Address, Status));
+ DEBUG ((
+ DEBUG_ERROR,
+ "UsbIoPortReset: failed to set address for device %d - %r\n",
+ Dev->Address,
+ Status
+ ));
goto ON_EXIT;
}
- DEBUG (( DEBUG_INFO, "UsbIoPortReset: device is now ADDRESSED at %d\n", Dev->Address));
+ DEBUG ((DEBUG_INFO, "UsbIoPortReset: device is now ADDRESSED at %d\n", Dev->Address));
//
// Reset the current active configure, after this device
@@ -877,8 +885,12 @@ UsbIoPortReset ( Status = UsbSetConfig (Dev, Dev->ActiveConfig->Desc.ConfigurationValue);
if (EFI_ERROR (Status)) {
- DEBUG (( DEBUG_ERROR, "UsbIoPortReset: failed to set configure for device %d - %r\n",
- Dev->Address, Status));
+ DEBUG ((
+ DEBUG_ERROR,
+ "UsbIoPortReset: failed to set configure for device %d - %r\n",
+ Dev->Address,
+ Status
+ ));
}
}
@@ -887,7 +899,6 @@ ON_EXIT: return Status;
}
-
/**
Install Usb Bus Protocol on host controller, and start the Usb bus.
@@ -908,11 +919,11 @@ UsbBusBuildProtocol ( IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
- USB_BUS *UsbBus;
- USB_DEVICE *RootHub;
- USB_INTERFACE *RootIf;
- EFI_STATUS Status;
- EFI_STATUS Status2;
+ USB_BUS *UsbBus;
+ USB_DEVICE *RootHub;
+ USB_INTERFACE *RootIf;
+ EFI_STATUS Status;
+ EFI_STATUS Status2;
UsbBus = AllocateZeroPool (sizeof (USB_BUS));
@@ -927,7 +938,7 @@ UsbBusBuildProtocol ( Status = gBS->OpenProtocol (
Controller,
&gEfiDevicePathProtocolGuid,
- (VOID **) &UsbBus->DevicePath,
+ (VOID **)&UsbBus->DevicePath,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -951,7 +962,7 @@ UsbBusBuildProtocol ( Status = gBS->OpenProtocol (
Controller,
&gEfiUsb2HcProtocolGuid,
- (VOID **) &(UsbBus->Usb2Hc),
+ (VOID **)&(UsbBus->Usb2Hc),
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -960,7 +971,7 @@ UsbBusBuildProtocol ( Status2 = gBS->OpenProtocol (
Controller,
&gEfiUsbHcProtocolGuid,
- (VOID **) &(UsbBus->UsbHc),
+ (VOID **)&(UsbBus->UsbHc),
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -1040,7 +1051,7 @@ UsbBusBuildProtocol ( UsbBus->DevicePath
);
- Status = mUsbRootHubApi.Init (RootIf);
+ Status = mUsbRootHubApi.Init (RootIf);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "UsbBusStart: Failed to init root hub %r\n", Status));
@@ -1056,6 +1067,7 @@ FREE_ROOTHUB: if (RootIf != NULL) {
FreePool (RootIf);
}
+
if (RootHub != NULL) {
FreePool (RootHub);
}
@@ -1066,20 +1078,22 @@ UNINSTALL_USBBUS: CLOSE_HC:
if (UsbBus->Usb2Hc != NULL) {
gBS->CloseProtocol (
- Controller,
- &gEfiUsb2HcProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
+ Controller,
+ &gEfiUsb2HcProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
}
+
if (UsbBus->UsbHc != NULL) {
gBS->CloseProtocol (
- Controller,
- &gEfiUsbHcProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
+ Controller,
+ &gEfiUsbHcProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
}
+
gBS->CloseProtocol (
Controller,
&gEfiDevicePathProtocolGuid,
@@ -1092,7 +1106,6 @@ CLOSE_HC: return Status;
}
-
/**
The USB bus driver entry pointer.
@@ -1106,8 +1119,8 @@ CLOSE_HC: EFI_STATUS
EFIAPI
UsbBusDriverEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
return EfiLibInstallDriverBindingComponentName2 (
@@ -1120,7 +1133,6 @@ UsbBusDriverEntryPoint ( );
}
-
/**
Check whether USB bus driver support this device.
@@ -1162,11 +1174,11 @@ UsbBusControllerDriverSupported ( DevicePathNode.DevPath = RemainingDevicePath;
if ((DevicePathNode.DevPath->Type != MESSAGING_DEVICE_PATH) ||
- (DevicePathNode.DevPath->SubType != MSG_USB_DP &&
- DevicePathNode.DevPath->SubType != MSG_USB_CLASS_DP
- && DevicePathNode.DevPath->SubType != MSG_USB_WWID_DP
- )) {
-
+ ( (DevicePathNode.DevPath->SubType != MSG_USB_DP) &&
+ (DevicePathNode.DevPath->SubType != MSG_USB_CLASS_DP)
+ && (DevicePathNode.DevPath->SubType != MSG_USB_WWID_DP)
+ ))
+ {
return EFI_UNSUPPORTED;
}
}
@@ -1178,7 +1190,7 @@ UsbBusControllerDriverSupported ( Status = gBS->OpenProtocol (
Controller,
&gEfiUsb2HcProtocolGuid,
- (VOID **) &Usb2Hc,
+ (VOID **)&Usb2Hc,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -1194,7 +1206,7 @@ UsbBusControllerDriverSupported ( Status = gBS->OpenProtocol (
Controller,
&gEfiUsbHcProtocolGuid,
- (VOID **) &UsbHc,
+ (VOID **)&UsbHc,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -1211,14 +1223,12 @@ UsbBusControllerDriverSupported ( // Close the USB_HC used to perform the supported test
//
gBS->CloseProtocol (
- Controller,
- &gEfiUsbHcProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
+ Controller,
+ &gEfiUsbHcProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
} else {
-
//
// Close the USB_HC2 used to perform the supported test
//
@@ -1236,7 +1246,7 @@ UsbBusControllerDriverSupported ( Status = gBS->OpenProtocol (
Controller,
&gEfiDevicePathProtocolGuid,
- (VOID **) &ParentDevicePath,
+ (VOID **)&ParentDevicePath,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -1250,11 +1260,11 @@ UsbBusControllerDriverSupported ( // Close protocol, don't use device path protocol in the Support() function
//
gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
+ Controller,
+ &gEfiDevicePathProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
return EFI_SUCCESS;
}
@@ -1262,7 +1272,6 @@ UsbBusControllerDriverSupported ( return Status;
}
-
/**
Start to process the controller.
@@ -1284,14 +1293,14 @@ UsbBusControllerDriverStart ( IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
- EFI_USB_BUS_PROTOCOL *UsbBusId;
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
+ EFI_USB_BUS_PROTOCOL *UsbBusId;
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
Status = gBS->OpenProtocol (
Controller,
&gEfiDevicePathProtocolGuid,
- (VOID **) &ParentDevicePath,
+ (VOID **)&ParentDevicePath,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -1314,7 +1323,7 @@ UsbBusControllerDriverStart ( Status = gBS->OpenProtocol (
Controller,
&gEfiCallerIdGuid,
- (VOID **) &UsbBusId,
+ (VOID **)&UsbBusId,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -1329,13 +1338,14 @@ UsbBusControllerDriverStart ( if (EFI_ERROR (Status)) {
return Status;
}
+
//
// Try get the Usb Bus protocol interface again
//
Status = gBS->OpenProtocol (
Controller,
&gEfiCallerIdGuid,
- (VOID **) &UsbBusId,
+ (VOID **)&UsbBusId,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -1370,11 +1380,9 @@ UsbBusControllerDriverStart ( ASSERT (!EFI_ERROR (Status));
}
-
return EFI_SUCCESS;
}
-
/**
Stop handle the controller by this USB bus driver.
@@ -1409,20 +1417,20 @@ UsbBusControllerDriverStop ( EFI_STATUS Status;
EFI_STATUS ReturnStatus;
- Status = EFI_SUCCESS;
+ Status = EFI_SUCCESS;
if (NumberOfChildren > 0) {
//
// BugBug: Raise TPL to callback level instead of USB_BUS_TPL to avoid TPL conflict
//
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
+ OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
ReturnStatus = EFI_SUCCESS;
for (Index = 0; Index < NumberOfChildren; Index++) {
Status = gBS->OpenProtocol (
ChildHandleBuffer[Index],
&gEfiUsbIoProtocolGuid,
- (VOID **) &UsbIo,
+ (VOID **)&UsbIo,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -1438,8 +1446,8 @@ UsbBusControllerDriverStop ( continue;
}
- UsbIf = USB_INTERFACE_FROM_USBIO (UsbIo);
- UsbDev = UsbIf->Device;
+ UsbIf = USB_INTERFACE_FROM_USBIO (UsbIo);
+ UsbDev = UsbIf->Device;
ReturnStatus = UsbRemoveDevice (UsbDev);
}
@@ -1448,7 +1456,7 @@ UsbBusControllerDriverStop ( return ReturnStatus;
}
- DEBUG (( DEBUG_INFO, "UsbBusStop: usb bus stopped on %p\n", Controller));
+ DEBUG ((DEBUG_INFO, "UsbBusStop: usb bus stopped on %p\n", Controller));
//
// Locate USB_BUS for the current host controller
@@ -1456,7 +1464,7 @@ UsbBusControllerDriverStop ( Status = gBS->OpenProtocol (
Controller,
&gEfiCallerIdGuid,
- (VOID **) &BusId,
+ (VOID **)&BusId,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -1473,7 +1481,7 @@ UsbBusControllerDriverStop ( //
// BugBug: Raise TPL to callback level instead of USB_BUS_TPL to avoid TPL conflict
//
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
+ OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
RootHub = Bus->Devices[0];
RootIf = RootHub->Interfaces[0];
@@ -1493,8 +1501,8 @@ UsbBusControllerDriverStop ( if (!EFI_ERROR (ReturnStatus)) {
mUsbRootHubApi.Release (RootIf);
- gBS->FreePool (RootIf);
- gBS->FreePool (RootHub);
+ gBS->FreePool (RootIf);
+ gBS->FreePool (RootHub);
Status = UsbBusFreeUsbDPList (&Bus->WantedUsbIoDPList);
ASSERT (!EFI_ERROR (Status));
@@ -1533,5 +1541,6 @@ UsbBusControllerDriverStop ( gBS->FreePool (Bus);
}
}
+
return Status;
}
|