diff options
author | li-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-10-30 04:23:40 +0000 |
---|---|---|
committer | li-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-10-30 04:23:40 +0000 |
commit | 37623a5c029e5415fe24b86bf4f6481f8fdfad94 (patch) | |
tree | 925965b7341d07571b8bb22d51cacd39262ac0b7 /MdeModulePkg/Bus/Pci/XhciDxe | |
parent | cb38c322f037a9a5d2751a4c7e351b0ee7302e96 (diff) | |
download | edk2-platforms-37623a5c029e5415fe24b86bf4f6481f8fdfad94.tar.xz |
Add missing status code in several modules.
Signed-off-by: Li Elvin <elvin.li@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
Reviewed-by: Ni Ruiyu <ruiyu.ni@intel.com>
Reviewed-by: Gao Liming <liming.gao@intel.com>
Reviewed-by: Tian Feng <feng.tian@intel.com>
Reviewed-by: Fan Jeff <jeff.fan@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13890 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Bus/Pci/XhciDxe')
-rw-r--r-- | MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 113 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h | 1 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf | 3 |
3 files changed, 73 insertions, 44 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; } diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h index a486413086..ae56b1e6fe 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h @@ -30,6 +30,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include <Library/MemoryAllocationLib.h>
#include <Library/UefiLib.h>
#include <Library/DebugLib.h>
+#include <Library/ReportStatusCodeLib.h>
#include <IndustryStandard/Pci.h>
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf b/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf index 286f3ac321..84dea07a49 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf @@ -6,7 +6,7 @@ # It implements the interfaces of monitoring the status of all ports and transferring
# Control, Bulk, Interrupt and Isochronous requests to those attached usb LS/FS/HS/SS devices.
#
-# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2011 - 2012, 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
@@ -59,6 +59,7 @@ UefiDriverEntryPoint
BaseMemoryLib
DebugLib
+ ReportStatusCodeLib
[Guids]
gEfiEventExitBootServicesGuid ## PRODUCES ## Event
|