]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c
Add missing status code in several modules.
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / UhciDxe / Uhci.c
index a1b0cbd1211b0a7c75956884d63a9d21ffd92e5b..f41c712259f898264a81e53ed239befbd751eb81 100644 (file)
@@ -2,7 +2,7 @@
 \r
   The UHCI driver model and HC protocol routines.\r
 \r
-Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -53,7 +53,18 @@ Uhci2Reset (
     return EFI_UNSUPPORTED;\r
   }\r
 \r
-  Uhc     = UHC_FROM_USB2_HC_PROTO (This);\r
+  Uhc = UHC_FROM_USB2_HC_PROTO (This);\r
+\r
+  if (Uhc->DevicePath != NULL) {\r
+    //\r
+    // Report Status Code to indicate reset happens\r
+    //\r
+    REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+      EFI_PROGRESS_CODE,\r
+      (EFI_IO_BUS_USB | EFI_IOB_PC_RESET),\r
+      Uhc->DevicePath\r
+      );\r
+  }\r
 \r
   OldTpl  = gBS->RaiseTPL (UHCI_TPL);\r
 \r
@@ -1425,8 +1436,9 @@ ON_EXIT:
 **/\r
 USB_HC_DEV *\r
 UhciAllocateDev (\r
-  IN EFI_PCI_IO_PROTOCOL    *PciIo,\r
-  IN UINT64                 OriginalPciAttributes\r
+  IN EFI_PCI_IO_PROTOCOL       *PciIo,\r
+  IN EFI_DEVICE_PATH_PROTOCOL  *DevicePath,\r
+  IN UINT64                    OriginalPciAttributes\r
   )\r
 {\r
   USB_HC_DEV  *Uhc;\r
@@ -1460,6 +1472,7 @@ UhciAllocateDev (
   Uhc->Usb2Hc.MinorRevision             = 0x1;\r
 \r
   Uhc->PciIo                 = PciIo;\r
+  Uhc->DevicePath            = DevicePath;\r
   Uhc->OriginalPciAttributes = OriginalPciAttributes;\r
   Uhc->MemPool               = UsbHcInitMemPool (PciIo, TRUE, 0);\r
 \r
@@ -1622,6 +1635,7 @@ UhciDriverBindingStart (
   UINT64              Supports;\r
   UINT64              OriginalPciAttributes;\r
   BOOLEAN             PciAttributesSaved;\r
+  EFI_DEVICE_PATH_PROTOCOL  *HcDevicePath;\r
 \r
   //\r
   // Open PCIIO, then enable the EHC device and turn off emulation\r
@@ -1640,6 +1654,19 @@ UhciDriverBindingStart (
     return Status;\r
   }\r
 \r
+  //\r
+  // Open Device Path Protocol for on USB host controller\r
+  //\r
+  HcDevicePath = NULL;\r
+  Status = gBS->OpenProtocol (\r
+                  Controller,\r
+                  &gEfiDevicePathProtocolGuid,\r
+                  (VOID **) &HcDevicePath,\r
+                  This->DriverBindingHandle,\r
+                  Controller,\r
+                  EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+                  );\r
+\r
   PciAttributesSaved = FALSE;\r
   //\r
   // Save original PCI attributes\r
@@ -1684,7 +1711,7 @@ UhciDriverBindingStart (
     goto CLOSE_PCIIO;\r
   }\r
 \r
-  Uhc = UhciAllocateDev (PciIo, OriginalPciAttributes);\r
+  Uhc = UhciAllocateDev (PciIo, HcDevicePath, OriginalPciAttributes);\r
 \r
   if (Uhc == NULL) {\r
     Status = EFI_OUT_OF_RESOURCES;\r