mirror of https://github.com/acidanthera/audk.git
Check Library usage and fix some typo.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7137 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
ec30be9e8c
commit
d17371e86b
|
@ -61,7 +61,7 @@ EFI_DRIVER_BINDING_PROTOCOL mUsbBusDriverBinding = {
|
||||||
@param UsbStatus USB result
|
@param UsbStatus USB result
|
||||||
|
|
||||||
@retval EFI_INVALID_PARAMETER The parameters are invalid
|
@retval EFI_INVALID_PARAMETER The parameters are invalid
|
||||||
@retval EFI_SUCCESS The control transfer succeded.
|
@retval EFI_SUCCESS The control transfer succeeded.
|
||||||
@retval Others Failed to execute the transfer
|
@retval Others Failed to execute the transfer
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -152,7 +152,7 @@ UsbIoControlTransfer (
|
||||||
// should stop use its current UsbIo after calling this driver. The old
|
// should stop use its current UsbIo after calling this driver. The old
|
||||||
// UsbIo will be uninstalled and new UsbIo be installed. We can't use
|
// UsbIo will be uninstalled and new UsbIo be installed. We can't use
|
||||||
// ReinstallProtocol since interfaces in different configuration may be
|
// ReinstallProtocol since interfaces in different configuration may be
|
||||||
// completely irrellvant.
|
// completely irrelevant.
|
||||||
//
|
//
|
||||||
if ((Request->Request == USB_REQ_SET_CONFIG) &&
|
if ((Request->Request == USB_REQ_SET_CONFIG) &&
|
||||||
(Request->RequestType == USB_REQUEST_TYPE (EfiUsbNoData, USB_REQ_TYPE_STANDARD,
|
(Request->RequestType == USB_REQUEST_TYPE (EfiUsbNoData, USB_REQ_TYPE_STANDARD,
|
||||||
|
@ -924,13 +924,13 @@ UsbBusBuildProtocol (
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
DEBUG ((EFI_D_ERROR, "UsbBusStart: Failed to open device path %r\n", Status));
|
DEBUG ((EFI_D_ERROR, "UsbBusStart: Failed to open device path %r\n", Status));
|
||||||
|
|
||||||
gBS->FreePool (UsbBus);
|
FreePool (UsbBus);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get USB_HC2/USB_HC host controller protocol (EHCI/UHCI).
|
// Get USB_HC2/USB_HC host controller protocol (EHCI/UHCI).
|
||||||
// This is for backward compatbility with EFI 1.x. In UEFI
|
// This is for backward compatibility with EFI 1.x. In UEFI
|
||||||
// 2.x, USB_HC2 replaces USB_HC. We will open both USB_HC2
|
// 2.x, USB_HC2 replaces USB_HC. We will open both USB_HC2
|
||||||
// and USB_HC because EHCI driver will install both protocols
|
// and USB_HC because EHCI driver will install both protocols
|
||||||
// (for the same reason). If we don't consume both of them,
|
// (for the same reason). If we don't consume both of them,
|
||||||
|
@ -965,7 +965,7 @@ UsbBusBuildProtocol (
|
||||||
UsbHcSetState (UsbBus, EfiUsbHcStateOperational);
|
UsbHcSetState (UsbBus, EfiUsbHcStateOperational);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Install an EFI_USB_BUS_PROTOCOL to host controler to identify it.
|
// Install an EFI_USB_BUS_PROTOCOL to host controller to identify it.
|
||||||
//
|
//
|
||||||
Status = gBS->InstallProtocolInterface (
|
Status = gBS->InstallProtocolInterface (
|
||||||
&Controller,
|
&Controller,
|
||||||
|
@ -998,7 +998,7 @@ UsbBusBuildProtocol (
|
||||||
RootIf = AllocateZeroPool (sizeof (USB_INTERFACE));
|
RootIf = AllocateZeroPool (sizeof (USB_INTERFACE));
|
||||||
|
|
||||||
if (RootIf == NULL) {
|
if (RootIf == NULL) {
|
||||||
gBS->FreePool (RootHub);
|
FreePool (RootHub);
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto FREE_ROOTHUB;
|
goto FREE_ROOTHUB;
|
||||||
}
|
}
|
||||||
|
@ -1024,10 +1024,10 @@ UsbBusBuildProtocol (
|
||||||
|
|
||||||
FREE_ROOTHUB:
|
FREE_ROOTHUB:
|
||||||
if (RootIf != NULL) {
|
if (RootIf != NULL) {
|
||||||
gBS->FreePool (RootIf);
|
FreePool (RootIf);
|
||||||
}
|
}
|
||||||
if (RootHub != NULL) {
|
if (RootHub != NULL) {
|
||||||
gBS->FreePool (RootHub);
|
FreePool (RootHub);
|
||||||
}
|
}
|
||||||
|
|
||||||
UNINSTALL_USBBUS:
|
UNINSTALL_USBBUS:
|
||||||
|
@ -1056,7 +1056,7 @@ CLOSE_HC:
|
||||||
This->DriverBindingHandle,
|
This->DriverBindingHandle,
|
||||||
Controller
|
Controller
|
||||||
);
|
);
|
||||||
gBS->FreePool (UsbBus);
|
FreePool (UsbBus);
|
||||||
|
|
||||||
DEBUG ((EFI_D_ERROR, "UsbBusStart: Failed to start bus driver %r\n", Status));
|
DEBUG ((EFI_D_ERROR, "UsbBusStart: Failed to start bus driver %r\n", Status));
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -1251,7 +1251,7 @@ UsbBusControllerDriverStart (
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
//
|
//
|
||||||
// If first start, build the bus execute enviorment and install bus protocol
|
// If first start, build the bus execute environment and install bus protocol
|
||||||
//
|
//
|
||||||
Status = UsbBusBuildProtocol (This, Controller, RemainingDevicePath);
|
Status = UsbBusBuildProtocol (This, Controller, RemainingDevicePath);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
|
|
@ -40,14 +40,14 @@ UsbFreeInterfaceDesc (
|
||||||
Ep = Setting->Endpoints[Index];
|
Ep = Setting->Endpoints[Index];
|
||||||
|
|
||||||
if (Ep != NULL) {
|
if (Ep != NULL) {
|
||||||
gBS->FreePool (Ep);
|
FreePool (Ep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gBS->FreePool (Setting->Endpoints);
|
FreePool (Setting->Endpoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
gBS->FreePool (Setting);
|
FreePool (Setting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,13 +89,13 @@ UsbFreeConfigDesc (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gBS->FreePool (Interface);
|
FreePool (Interface);
|
||||||
}
|
}
|
||||||
|
|
||||||
gBS->FreePool (Config->Interfaces);
|
FreePool (Config->Interfaces);
|
||||||
}
|
}
|
||||||
|
|
||||||
gBS->FreePool (Config);
|
FreePool (Config);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,10 +122,10 @@ UsbFreeDevDesc (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gBS->FreePool (DevDesc->Configs);
|
FreePool (DevDesc->Configs);
|
||||||
}
|
}
|
||||||
|
|
||||||
gBS->FreePool (DevDesc);
|
FreePool (DevDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ UsbFreeDevDesc (
|
||||||
Create a descriptor.
|
Create a descriptor.
|
||||||
|
|
||||||
@param DescBuf The buffer of raw descriptor.
|
@param DescBuf The buffer of raw descriptor.
|
||||||
@param Len The lenght of the raw descriptor buffer.
|
@param Len The length of the raw descriptor buffer.
|
||||||
@param Type The type of descriptor to create.
|
@param Type The type of descriptor to create.
|
||||||
@param Consumed Number of bytes consumed.
|
@param Consumed Number of bytes consumed.
|
||||||
|
|
||||||
|
@ -198,13 +198,10 @@ UsbCreateDesc (
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Desc = AllocateZeroPool (CtrlLen);
|
Desc = AllocateCopyPool(CtrlLen, Head);
|
||||||
|
|
||||||
if (Desc == NULL) {
|
if (Desc == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (Desc, Head, DescLen);
|
|
||||||
*Consumed = Offset + Head->Len;
|
*Consumed = Offset + Head->Len;
|
||||||
|
|
||||||
return Desc;
|
return Desc;
|
||||||
|
@ -212,10 +209,10 @@ UsbCreateDesc (
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Parse an interface desciptor and its endpoints.
|
Parse an interface descriptor and its endpoints.
|
||||||
|
|
||||||
@param DescBuf The buffer of raw descriptor.
|
@param DescBuf The buffer of raw descriptor.
|
||||||
@param Len The lenght of the raw descriptor buffer.
|
@param Len The length of the raw descriptor buffer.
|
||||||
@param Consumed The number of raw descriptor consumed.
|
@param Consumed The number of raw descriptor consumed.
|
||||||
|
|
||||||
@return The create interface setting or NULL if failed.
|
@return The create interface setting or NULL if failed.
|
||||||
|
@ -246,7 +243,7 @@ UsbParseInterfaceDesc (
|
||||||
Offset = Used;
|
Offset = Used;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create an arry to hold the interface's endpoints
|
// Create an array to hold the interface's endpoints
|
||||||
//
|
//
|
||||||
NumEp = Setting->Desc.NumEndpoints;
|
NumEp = Setting->Desc.NumEndpoints;
|
||||||
|
|
||||||
|
@ -293,7 +290,7 @@ ON_ERROR:
|
||||||
Parse the configuration descriptor and its interfaces.
|
Parse the configuration descriptor and its interfaces.
|
||||||
|
|
||||||
@param DescBuf The buffer of raw descriptor.
|
@param DescBuf The buffer of raw descriptor.
|
||||||
@param Len The lenght of the raw descriptor buffer.
|
@param Len The length of the raw descriptor buffer.
|
||||||
|
|
||||||
@return The created configuration descriptor.
|
@return The created configuration descriptor.
|
||||||
|
|
||||||
|
@ -631,7 +628,7 @@ UsbGetOneString (
|
||||||
);
|
);
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
gBS->FreePool (Buf);
|
FreePool (Buf);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -675,8 +672,8 @@ UsbBuildLangTable (
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
Max = (Desc->Length - 2) / 2;
|
Max = (Desc->Length - 2) / 2;
|
||||||
Max = (Max < USB_MAX_LANG_ID ? Max : USB_MAX_LANG_ID);
|
Max = MIN(Max, USB_MAX_LANG_ID);
|
||||||
|
|
||||||
Point = Desc->String;
|
Point = Desc->String;
|
||||||
for (Index = 0; Index < Max; Index++) {
|
for (Index = 0; Index < Max; Index++) {
|
||||||
UsbDev->LangId[Index] = *Point;
|
UsbDev->LangId[Index] = *Point;
|
||||||
|
@ -693,7 +690,7 @@ ON_EXIT:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieve the indexed configure for the device. USB device
|
Retrieve the indexed configure for the device. USB device
|
||||||
returns the configuration togetther with the interfaces for
|
returns the configuration together with the interfaces for
|
||||||
this configuration. Configuration descriptor is also of
|
this configuration. Configuration descriptor is also of
|
||||||
variable length.
|
variable length.
|
||||||
|
|
||||||
|
@ -739,7 +736,7 @@ UsbGetOneConfig (
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
DEBUG (( EFI_D_ERROR, "UsbGetOneConfig: failed to get full descript %r\n", Status));
|
DEBUG (( EFI_D_ERROR, "UsbGetOneConfig: failed to get full descript %r\n", Status));
|
||||||
|
|
||||||
gBS->FreePool (Buf);
|
FreePool (Buf);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -813,7 +810,7 @@ UsbBuildDescTable (
|
||||||
|
|
||||||
ConfigDesc = UsbParseConfigDesc ((UINT8 *) Config, Config->TotalLength);
|
ConfigDesc = UsbParseConfigDesc ((UINT8 *) Config, Config->TotalLength);
|
||||||
|
|
||||||
gBS->FreePool (Config);
|
FreePool (Config);
|
||||||
|
|
||||||
if (ConfigDesc == NULL) {
|
if (ConfigDesc == NULL) {
|
||||||
DEBUG (( EFI_D_ERROR, "UsbBuildDescTable: failed to parse configure (index %d)\n", Index));
|
DEBUG (( EFI_D_ERROR, "UsbBuildDescTable: failed to parse configure (index %d)\n", Index));
|
||||||
|
|
|
@ -32,9 +32,12 @@ UsbGetEndpointDesc (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
USB_ENDPOINT_DESC *EpDesc;
|
USB_ENDPOINT_DESC *EpDesc;
|
||||||
UINTN Index;
|
UINT8 Index;
|
||||||
|
UINT8 NumEndpoints;
|
||||||
for (Index = 0; Index < UsbIf->IfSetting->Desc.NumEndpoints; Index++) {
|
|
||||||
|
NumEndpoints = UsbIf->IfSetting->Desc.NumEndpoints;
|
||||||
|
|
||||||
|
for (Index = 0; Index < NumEndpoints; Index++) {
|
||||||
EpDesc = UsbIf->IfSetting->Endpoints[Index];
|
EpDesc = UsbIf->IfSetting->Endpoints[Index];
|
||||||
|
|
||||||
if (EpDesc->Desc.EndpointAddress == EpAddr) {
|
if (EpDesc->Desc.EndpointAddress == EpAddr) {
|
||||||
|
@ -71,10 +74,10 @@ UsbFreeInterface (
|
||||||
);
|
);
|
||||||
|
|
||||||
if (UsbIf->DevicePath != NULL) {
|
if (UsbIf->DevicePath != NULL) {
|
||||||
gBS->FreePool (UsbIf->DevicePath);
|
FreePool (UsbIf->DevicePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
gBS->FreePool (UsbIf);
|
FreePool (UsbIf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -175,10 +178,10 @@ UsbCreateInterface (
|
||||||
|
|
||||||
ON_ERROR:
|
ON_ERROR:
|
||||||
if (UsbIf->DevicePath != NULL) {
|
if (UsbIf->DevicePath != NULL) {
|
||||||
gBS->FreePool (UsbIf->DevicePath);
|
FreePool (UsbIf->DevicePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
gBS->FreePool (UsbIf);
|
FreePool (UsbIf);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +243,7 @@ UsbCreateDevice (
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Connect the USB interface with its driver. EFI USB bus will
|
Connect the USB interface with its driver. EFI USB bus will
|
||||||
create a USB interface for each seperate interface descriptor.
|
create a USB interface for each separate interface descriptor.
|
||||||
|
|
||||||
@param UsbIf The interface to connect driver to.
|
@param UsbIf The interface to connect driver to.
|
||||||
|
|
||||||
|
|
|
@ -252,7 +252,7 @@ UsbHubCtrlGetHubStatus (
|
||||||
@param State Variable to return the hub port state.
|
@param State Variable to return the hub port state.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The port state is returned in State.
|
@retval EFI_SUCCESS The port state is returned in State.
|
||||||
@retval Others Failed to retrive the port state.
|
@retval Others Failed to retrieve the port state.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
@ -627,6 +627,7 @@ UsbHubInit (
|
||||||
USB_DEVICE *HubDev;
|
USB_DEVICE *HubDev;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT8 Index;
|
UINT8 Index;
|
||||||
|
UINT8 NumEndpoints;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Locate the interrupt endpoint for port change map
|
// Locate the interrupt endpoint for port change map
|
||||||
|
@ -635,8 +636,9 @@ UsbHubInit (
|
||||||
Setting = HubIf->IfSetting;
|
Setting = HubIf->IfSetting;
|
||||||
HubDev = HubIf->Device;
|
HubDev = HubIf->Device;
|
||||||
EpDesc = NULL;
|
EpDesc = NULL;
|
||||||
|
NumEndpoints = Setting->Desc.NumEndpoints;
|
||||||
|
|
||||||
for (Index = 0; Index < Setting->Desc.NumEndpoints; Index++) {
|
for (Index = 0; Index < NumEndpoints; Index++) {
|
||||||
ASSERT ((Setting->Endpoints != NULL) && (Setting->Endpoints[Index] != NULL));
|
ASSERT ((Setting->Endpoints != NULL) && (Setting->Endpoints[Index] != NULL));
|
||||||
|
|
||||||
EpDesc = Setting->Endpoints[Index];
|
EpDesc = Setting->Endpoints[Index];
|
||||||
|
@ -647,7 +649,7 @@ UsbHubInit (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Index == Setting->Desc.NumEndpoints) {
|
if (Index == NumEndpoints) {
|
||||||
DEBUG (( EFI_D_ERROR, "UsbHubInit: no interrupt endpoint found for hub %d\n", HubDev->Address));
|
DEBUG (( EFI_D_ERROR, "UsbHubInit: no interrupt endpoint found for hub %d\n", HubDev->Address));
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -862,7 +864,7 @@ UsbHubClearPortFeature (
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Interface funtion to reset the port.
|
Interface function to reset the port.
|
||||||
|
|
||||||
@param HubIf The hub interface.
|
@param HubIf The hub interface.
|
||||||
@param Port The port to reset.
|
@param Port The port to reset.
|
||||||
|
@ -964,7 +966,7 @@ UsbHubRelease (
|
||||||
|
|
||||||
@param HubIf The root hub interface.
|
@param HubIf The root hub interface.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The interface is initialied for root hub.
|
@retval EFI_SUCCESS The interface is initialized for root hub.
|
||||||
@retval Others Failed to initialize the hub.
|
@retval Others Failed to initialize the hub.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -1155,7 +1157,7 @@ UsbRootHubClearPortFeature (
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Interface funtion to reset the root hub port.
|
Interface function to reset the root hub port.
|
||||||
|
|
||||||
@param RootIf The root hub interface.
|
@param RootIf The root hub interface.
|
||||||
@param Port The port to reset.
|
@param Port The port to reset.
|
||||||
|
|
Loading…
Reference in New Issue