mirror of https://github.com/acidanthera/audk.git
MdeModulePkg XhciDxe: XHCI multiple interface alternate setting support.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15617 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
8acb3f7b54
commit
e1f2dfec34
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
The XHCI controller driver.
|
||||
|
||||
Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -968,6 +968,10 @@ XhcControlTransfer (
|
|||
ASSERT (Index < Xhc->UsbDevContext[SlotId].DevDesc.NumConfigurations);
|
||||
Xhc->UsbDevContext[SlotId].ConfDesc[Index] = AllocateZeroPool(*DataLength);
|
||||
CopyMem (Xhc->UsbDevContext[SlotId].ConfDesc[Index], Data, *DataLength);
|
||||
//
|
||||
// Default to use AlternateSetting 0 for all interfaces.
|
||||
//
|
||||
Xhc->UsbDevContext[SlotId].ActiveAlternateSetting = AllocateZeroPool (Xhc->UsbDevContext[SlotId].ConfDesc[Index]->NumInterfaces * sizeof (UINT8));
|
||||
}
|
||||
} else if (((DescriptorType == USB_DESC_TYPE_HUB) ||
|
||||
(DescriptorType == USB_DESC_TYPE_HUB_SUPER_SPEED)) && (*DataLength > 2)) {
|
||||
|
@ -1009,6 +1013,20 @@ XhcControlTransfer (
|
|||
break;
|
||||
}
|
||||
}
|
||||
} else if ((Request->Request == USB_REQ_SET_INTERFACE) &&
|
||||
(Request->RequestType == USB_REQUEST_TYPE (EfiUsbNoData, USB_REQ_TYPE_STANDARD, USB_TARGET_INTERFACE))) {
|
||||
//
|
||||
// Hook Set_Interface request from UsbBus as we need configure interface setting.
|
||||
// Request->Value indicates AlterlateSetting to set
|
||||
// Request->Index indicates Interface to set
|
||||
//
|
||||
if (Xhc->UsbDevContext[SlotId].ActiveAlternateSetting[(UINT8) Request->Index] != (UINT8) Request->Value) {
|
||||
if (Xhc->HcCParams.Data.Csz == 0) {
|
||||
Status = XhcSetInterface (Xhc, SlotId, DeviceSpeed, Xhc->UsbDevContext[SlotId].ConfDesc[Xhc->UsbDevContext[SlotId].ActiveConfiguration - 1], Request);
|
||||
} else {
|
||||
Status = XhcSetInterface64 (Xhc, SlotId, DeviceSpeed, Xhc->UsbDevContext[SlotId].ConfDesc[Xhc->UsbDevContext[SlotId].ActiveConfiguration - 1], Request);
|
||||
}
|
||||
}
|
||||
} else if ((Request->Request == USB_REQ_GET_STATUS) &&
|
||||
(Request->RequestType == USB_REQUEST_TYPE (EfiUsbDataIn, USB_REQ_TYPE_CLASS, USB_TARGET_OTHER))) {
|
||||
ASSERT (Data != NULL);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Provides some data structure definitions used by the XHCI host controller driver.
|
||||
|
||||
Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -196,6 +196,14 @@ struct _USB_DEV_CONTEXT {
|
|||
// These information is used to support XHCI's Config_Endpoint cmd.
|
||||
//
|
||||
EFI_USB_CONFIG_DESCRIPTOR **ConfDesc;
|
||||
//
|
||||
// A device has an active Configuration.
|
||||
//
|
||||
UINT8 ActiveConfiguration;
|
||||
//
|
||||
// Every interface has an active AlternateSetting.
|
||||
//
|
||||
UINT8 *ActiveAlternateSetting;
|
||||
};
|
||||
|
||||
struct _USB_XHCI_INSTANCE {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,7 @@
|
|||
|
||||
This file contains the definition for XHCI host controller schedule routines.
|
||||
|
||||
Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -1041,6 +1041,49 @@ XhcSetConfigCmd64 (
|
|||
IN USB_CONFIG_DESCRIPTOR *ConfigDesc
|
||||
);
|
||||
|
||||
/**
|
||||
Set interface through XHCI's Configure_Endpoint cmd.
|
||||
|
||||
@param Xhc The XHCI Instance.
|
||||
@param SlotId The slot id to be configured.
|
||||
@param DeviceSpeed The device's speed.
|
||||
@param ConfigDesc The pointer to the usb device configuration descriptor.
|
||||
@param Request USB device request to send.
|
||||
|
||||
@retval EFI_SUCCESS Successfully set interface.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
XhcSetInterface (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT8 SlotId,
|
||||
IN UINT8 DeviceSpeed,
|
||||
IN USB_CONFIG_DESCRIPTOR *ConfigDesc,
|
||||
IN EFI_USB_DEVICE_REQUEST *Request
|
||||
);
|
||||
|
||||
/**
|
||||
Set interface through XHCI's Configure_Endpoint cmd.
|
||||
|
||||
@param Xhc The XHCI Instance.
|
||||
@param SlotId The slot id to be configured.
|
||||
@param DeviceSpeed The device's speed.
|
||||
@param ConfigDesc The pointer to the usb device configuration descriptor.
|
||||
@param Request USB device request to send.
|
||||
|
||||
@retval EFI_SUCCESS Successfully set interface.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
XhcSetInterface64 (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT8 SlotId,
|
||||
IN UINT8 DeviceSpeed,
|
||||
IN USB_CONFIG_DESCRIPTOR *ConfigDesc,
|
||||
IN EFI_USB_DEVICE_REQUEST *Request
|
||||
);
|
||||
|
||||
/**
|
||||
Find out the actual device address according to the requested device address from UsbBus.
|
||||
|
|
Loading…
Reference in New Issue