diff options
Diffstat (limited to 'MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c')
-rw-r--r-- | MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 113 |
1 files changed, 70 insertions, 43 deletions
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c index 566d3a6bc2..762da3e0a1 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c @@ -140,16 +140,27 @@ XhcReset ( ) { USB_XHCI_INSTANCE *Xhc; - EFI_STATUS Status; - EFI_TPL OldTpl; - - OldTpl = gBS->RaiseTPL (XHC_TPL); - - Xhc = XHC_FROM_THIS (This); - - switch (Attributes) { - case EFI_USB_HC_RESET_GLOBAL: - // + EFI_STATUS Status;
+ EFI_TPL OldTpl;
+
+ Xhc = XHC_FROM_THIS (This);
+
+ if (Xhc->DevicePath != NULL) {
+ //
+ // Report Status Code to indicate reset happens
+ //
+ REPORT_STATUS_CODE_WITH_DEVICE_PATH (
+ EFI_PROGRESS_CODE,
+ (EFI_IO_BUS_USB | EFI_IOB_PC_RESET),
+ Xhc->DevicePath
+ );
+ }
+
+ OldTpl = gBS->RaiseTPL (XHC_TPL);
+
+ switch (Attributes) {
+ case EFI_USB_HC_RESET_GLOBAL:
+ //
// Flow through, same behavior as Host Controller Reset // case EFI_USB_HC_RESET_HOST_CONTROLLER: @@ -1678,14 +1689,15 @@ ON_EXIT: @return The allocated and initialized USB_XHCI_INSTANCE structure if created, otherwise NULL. -**/ -USB_XHCI_INSTANCE* -XhcCreateUsbHc ( - IN EFI_PCI_IO_PROTOCOL *PciIo, - IN UINT64 OriginalPciAttributes - ) -{ - USB_XHCI_INSTANCE *Xhc; +**/
+USB_XHCI_INSTANCE*
+XhcCreateUsbHc (
+ IN EFI_PCI_IO_PROTOCOL *PciIo,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ IN UINT64 OriginalPciAttributes
+ )
+{
+ USB_XHCI_INSTANCE *Xhc;
EFI_STATUS Status; UINT32 PageSize; UINT16 ExtCapReg; @@ -1698,12 +1710,13 @@ XhcCreateUsbHc ( // // Initialize private data structure - // - Xhc->Signature = XHCI_INSTANCE_SIG; - Xhc->PciIo = PciIo; - Xhc->OriginalPciAttributes = OriginalPciAttributes; - CopyMem (&Xhc->Usb2Hc, &gXhciUsb2HcTemplate, sizeof (EFI_USB2_HC_PROTOCOL)); - + //
+ Xhc->Signature = XHCI_INSTANCE_SIG;
+ Xhc->PciIo = PciIo;
+ Xhc->DevicePath = DevicePath;
+ Xhc->OriginalPciAttributes = OriginalPciAttributes;
+ CopyMem (&Xhc->Usb2Hc, &gXhciUsb2HcTemplate, sizeof (EFI_USB2_HC_PROTOCOL));
+
InitializeListHead (&Xhc->AsyncIntTransfers); // @@ -1827,12 +1840,13 @@ XhcDriverBindingStart ( EFI_STATUS Status; EFI_PCI_IO_PROTOCOL *PciIo; UINT64 Supports; - UINT64 OriginalPciAttributes; - BOOLEAN PciAttributesSaved; - USB_XHCI_INSTANCE *Xhc; - - // - // Open the PciIo Protocol, then enable the USB host controller + UINT64 OriginalPciAttributes;
+ BOOLEAN PciAttributesSaved;
+ USB_XHCI_INSTANCE *Xhc;
+ EFI_DEVICE_PATH_PROTOCOL *HcDevicePath;
+
+ //
+ // Open the PciIo Protocol, then enable the USB host controller
// Status = gBS->OpenProtocol ( Controller, @@ -1844,12 +1858,25 @@ XhcDriverBindingStart ( ); if (EFI_ERROR (Status)) { - return Status; - } - - PciAttributesSaved = FALSE; - // - // Save original PCI attributes + return Status;
+ }
+
+ //
+ // Open Device Path Protocol for on USB host controller
+ //
+ HcDevicePath = NULL;
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **) &HcDevicePath,
+ This->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+
+ PciAttributesSaved = FALSE;
+ //
+ // Save original PCI attributes
// Status = PciIo->Attributes ( PciIo, @@ -1884,13 +1911,13 @@ XhcDriverBindingStart ( goto CLOSE_PCIIO; } - // - // Create then install USB2_HC_PROTOCOL - // - Xhc = XhcCreateUsbHc (PciIo, OriginalPciAttributes); - - if (Xhc == NULL) { - DEBUG ((EFI_D_ERROR, "XhcDriverBindingStart: failed to create USB2_HC\n")); + //
+ // Create then install USB2_HC_PROTOCOL
+ //
+ Xhc = XhcCreateUsbHc (PciIo, HcDevicePath, OriginalPciAttributes);
+
+ if (Xhc == NULL) {
+ DEBUG ((EFI_D_ERROR, "XhcDriverBindingStart: failed to create USB2_HC\n"));
return EFI_OUT_OF_RESOURCES; } |