]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add missing status code in several modules.
authorli-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 30 Oct 2012 04:23:40 +0000 (04:23 +0000)
committerli-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 30 Oct 2012 04:23:40 +0000 (04:23 +0000)
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

32 files changed:
MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.c
MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h
MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c
MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c
MdeModulePkg/Bus/Pci/EhciDxe/Ehci.h
MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf
MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c
MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c
MdeModulePkg/Bus/Pci/UhciDxe/Uhci.h
MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf
MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c
MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.h
MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c
MdeModulePkg/Bus/Usb/UsbMouseAbsolutePointerDxe/UsbMouseAbsolutePointer.c
MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouse.c
MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
MdeModulePkg/Core/Pei/Reset/Reset.c
MdeModulePkg/Core/RuntimeDxe/Runtime.c
MdeModulePkg/Include/Guid/AcpiS3Context.h
MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.c
MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c
MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.h
MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf

index 51687fe0d322ab2e066d898682fcd44009bd09d0..11e90f97a949ccfca49ca1a33c39ed71f5444b0b 100644 (file)
@@ -294,6 +294,15 @@ RegisterAtaDevice (
   InitializeListHead (&AtaDevice->AtaTaskList);\r
   InitializeListHead (&AtaDevice->AtaSubTaskList);\r
 \r
+  //\r
+  // Report Status Code to indicate the ATA device will be enabled\r
+  //\r
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+    EFI_PROGRESS_CODE,\r
+    (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_PC_ENABLE),\r
+    AtaBusDriverData->ParentDevicePath\r
+    );\r
+\r
   //\r
   // Try to identify the ATA device via the ATA pass through command.\r
   //\r
@@ -719,6 +728,15 @@ AtaBusDriverBindingStart (
     return Status;\r
   }\r
 \r
+  //\r
+  // Report Status Code to indicate ATA bus starts\r
+  //\r
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+    EFI_PROGRESS_CODE,\r
+    (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_PC_INIT),\r
+    ParentDevicePath\r
+    );\r
+\r
   Status = gBS->OpenProtocol (\r
                   Controller,\r
                   &gEfiAtaPassThruProtocolGuid,\r
@@ -771,6 +789,15 @@ AtaBusDriverBindingStart (
     }\r
   }\r
 \r
+  //\r
+  // Report Status Code to indicate detecting devices on bus\r
+  //\r
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+    EFI_PROGRESS_CODE,\r
+    (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_PC_DETECT),\r
+    ParentDevicePath\r
+    );\r
+\r
   if (RemainingDevicePath == NULL) {\r
     Port = 0xFFFF;\r
     while (TRUE) {\r
index d6b0ff8f084a90c92a9ce2e9d3c2ab0e4f9da566..4d3d9d54c7e9fd6a187cb87d86e1f02024f3fc06 100644 (file)
@@ -38,6 +38,7 @@
 #include <Library/DevicePathLib.h>\r
 #include <Library/UefiRuntimeServicesTableLib.h>\r
 #include <Library/TimerLib.h>\r
+#include <Library/ReportStatusCodeLib.h>\r
 \r
 #include <IndustryStandard/Atapi.h>\r
 \r
index 82f99e5493e3a0e54195f38be0aa732c8d5475a9..bcd96deef0875766b21da4355c50da90be3f50cc 100644 (file)
@@ -56,6 +56,7 @@
   UefiDriverEntryPoint\r
   DebugLib\r
   TimerLib\r
+  ReportStatusCodeLib\r
 \r
 [Guids]\r
   gEfiDiskInfoIdeInterfaceGuid                  # CONSUMES  ## GUID\r
index b50792438bb082c73971a087fdda26a43d579ab2..5e5cab6575e6fd3fdba094754ee481f5d74575ec 100644 (file)
@@ -185,6 +185,15 @@ ResetAtaDevice (
 \r
   AtaPassThru = AtaDevice->AtaBusDriverData->AtaPassThru;\r
 \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_ATA_ATAPI | EFI_IOB_PC_RESET),\r
+    AtaDevice->AtaBusDriverData->ParentDevicePath\r
+    );\r
+\r
   return AtaPassThru->ResetDevice (\r
                         AtaPassThru,\r
                         AtaDevice->Port,\r
index 5ff9b80560aebd1a6a63021d4812c6017a546f43..ba1fe8fcc7ed8a452f47e5ac283b8c35d548e9bc 100644 (file)
@@ -122,8 +122,20 @@ EhcReset (
   EFI_STATUS              Status;\r
   UINT32                  DbgCtrlStatus;\r
 \r
+  Ehc = EHC_FROM_THIS (This);\r
+\r
+  if (Ehc->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
+      Ehc->DevicePath\r
+      );\r
+  }\r
+\r
   OldTpl  = gBS->RaiseTPL (EHC_TPL);\r
-  Ehc     = EHC_FROM_THIS (This);\r
 \r
   switch (Attributes) {\r
   case EFI_USB_HC_RESET_GLOBAL:\r
@@ -1543,8 +1555,9 @@ EhcGetUsbDebugPortInfo (
 **/\r
 USB2_HC_DEV *\r
 EhcCreateUsb2Hc (\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
   USB2_HC_DEV             *Ehc;\r
@@ -1578,6 +1591,7 @@ EhcCreateUsb2Hc (
   Ehc->Usb2Hc.MinorRevision             = 0x0;\r
 \r
   Ehc->PciIo                 = PciIo;\r
+  Ehc->DevicePath            = DevicePath;\r
   Ehc->OriginalPciAttributes = OriginalPciAttributes;\r
 \r
   InitializeListHead (&Ehc->AsyncIntTransfers);\r
@@ -1684,6 +1698,7 @@ EhcDriverBindingStart (
   UINTN                   EhciDeviceNumber;\r
   UINTN                   EhciFunctionNumber;\r
   UINT32                  State;\r
+  EFI_DEVICE_PATH_PROTOCOL  *HcDevicePath;\r
 \r
   //\r
   // Open the PciIo Protocol, then enable the USB host controller\r
@@ -1701,6 +1716,19 @@ EhcDriverBindingStart (
     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
@@ -1842,7 +1870,7 @@ EhcDriverBindingStart (
   //\r
   // Create then install USB2_HC_PROTOCOL\r
   //\r
-  Ehc = EhcCreateUsb2Hc (PciIo, OriginalPciAttributes);\r
+  Ehc = EhcCreateUsb2Hc (PciIo, HcDevicePath, OriginalPciAttributes);\r
 \r
   if (Ehc == NULL) {\r
     DEBUG ((EFI_D_ERROR, "EhcDriverBindingStart: failed to create USB2_HC\n"));\r
index 42e4a6e6d9c7bdf7d5c632a7c98fecc0393108ab..4327f2368a3f4054ef50684b24bec7a469b848d5 100644 (file)
@@ -32,6 +32,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/BaseLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/PcdLib.h>\r
+#include <Library/ReportStatusCodeLib.h>\r
 \r
 #include <IndustryStandard/Pci.h>\r
 \r
@@ -115,6 +116,7 @@ struct _USB2_HC_DEV {
   EFI_USB2_HC_PROTOCOL      Usb2Hc;\r
 \r
   EFI_PCI_IO_PROTOCOL       *PciIo;\r
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
   UINT64                    OriginalPciAttributes;\r
   USBHC_MEM_POOL            *MemPool;\r
 \r
index 0a3830f633a647afc46e621c7986e23ab6670893..8f6f7d69e6924aa0c53b4e2f6990574b73aea3f0 100644 (file)
@@ -11,7 +11,7 @@
 #  This way avoids the control transfer on a shared port between EHCI and companion host\r
 #  controller when UHCI gets attached earlier than EHCI and a USB 2.0 device inserts.\r
 #\r
-#  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -75,6 +75,7 @@
   BaseMemoryLib\r
   DebugLib\r
   PcdLib\r
+  ReportStatusCodeLib\r
 \r
 [Guids]\r
   gEfiEventExitBootServicesGuid                 ## PRODUCES ## Event\r
index 517250abe1735a9f5fb0637f9b1790ee1fd493dc..5afbb82298e90e7a952e2a41a46d9067acc36cb9 100644 (file)
@@ -8,7 +8,7 @@
   PCI Root Bridges. So it means platform needs install PCI Root Bridge IO protocol for each\r
   PCI Root Bus and install PCI Host Bridge Resource Allocation Protocol.\r
 \r
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 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
@@ -239,7 +239,8 @@ PciBusDriverBindingStart (
   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
   )\r
 {\r
-  EFI_STATUS  Status;\r
+  EFI_STATUS                Status;\r
+  EFI_DEVICE_PATH_PROTOCOL  *ParentDevicePath;\r
 \r
   //\r
   // Check RemainingDevicePath validation\r
@@ -285,6 +286,28 @@ PciBusDriverBindingStart (
 \r
   gFullEnumeration = (BOOLEAN) ((SearchHostBridgeHandle (Controller) ? FALSE : TRUE));\r
 \r
+  //\r
+  // Open Device Path Protocol for PCI root bridge\r
+  //\r
+  Status = gBS->OpenProtocol (\r
+                  Controller,\r
+                  &gEfiDevicePathProtocolGuid,\r
+                  (VOID **) &ParentDevicePath,\r
+                  This->DriverBindingHandle,\r
+                  Controller,\r
+                  EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+                  );  \r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  //\r
+  // Report Status Code to indicate PCI bus starts\r
+  //\r
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+    EFI_PROGRESS_CODE,\r
+    (EFI_IO_BUS_PCI | EFI_IOB_PC_INIT),\r
+    ParentDevicePath\r
+    );\r
+\r
   //\r
   // Enumerate the entire host bridge\r
   // After enumeration, a database that records all the device information will be created\r
index 42065738ed6194a17b19db597b51ab203f56b620..c6fe51bf5870eb261c69738466797c5c56d4612d 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   PCI eunmeration implementation on entire PCI bus system for PCI Bus module.\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 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
@@ -2095,6 +2095,14 @@ PciHotPlugRequestNotify (
   RootBridgeHandle = Temp->Handle;\r
 \r
   if (Operation == EfiPciHotPlugRequestAdd) {\r
+    //\r
+    // Report Status Code to indicate hot plug happens\r
+    //\r
+    REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+      EFI_PROGRESS_CODE,\r
+      (EFI_IO_BUS_PCI | EFI_IOB_PC_HOTPLUG),\r
+      Temp->DevicePath\r
+      );\r
 \r
     if (NumberOfChildren != NULL) {\r
       *NumberOfChildren = 0;\r
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
index 71b7a531a1a6efa6afcd55b839435f2ed922434a..64ee6009650aef8fdaa72ea1a2d6ef416d24e172 100644 (file)
@@ -2,7 +2,7 @@
 \r
   The definition for UHCI driver model and HC protocol routines.\r
 \r
-Copyright (c) 2004 - 2010, 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
@@ -33,6 +33,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/BaseLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/PcdLib.h>\r
+#include <Library/ReportStatusCodeLib.h>\r
 \r
 #include <IndustryStandard/Pci.h>\r
 \r
@@ -112,6 +113,7 @@ struct _USB_HC_DEV {
   UINT32                    Signature;\r
   EFI_USB2_HC_PROTOCOL      Usb2Hc;\r
   EFI_PCI_IO_PROTOCOL       *PciIo;\r
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
   UINT64                    OriginalPciAttributes;\r
 \r
   //\r
index a9299ad50eae29d0804c198d99ad15acd5d16967..ca813faf26bbf1825dc4b6c6d9b2beb4466376c9 100644 (file)
@@ -6,7 +6,7 @@
 #  It implements the interfaces of monitoring the status of all ports and transferring\r
 #  Control, Bulk, Interrupt and Isochronous requests to Usb1.x device\r
 #\r
-#  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -71,6 +71,7 @@
   BaseMemoryLib\r
   DebugLib\r
   PcdLib\r
+  ReportStatusCodeLib\r
 \r
 [Guids]\r
   gEfiEventExitBootServicesGuid                 ## PRODUCES ## Event\r
index 566d3a6bc2958ec3df121e6ca2065cb4ab4fe6c8..762da3e0a13520e40c8fabb636c2665531a8ebf1 100644 (file)
@@ -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;\r
+  EFI_TPL            OldTpl;\r
+\r
+  Xhc = XHC_FROM_THIS (This);\r
+  \r
+  if (Xhc->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
+      Xhc->DevicePath\r
+      );\r
+  }  \r
+\r
+  OldTpl = gBS->RaiseTPL (XHC_TPL);\r
+\r
+  switch (Attributes) {\r
+  case EFI_USB_HC_RESET_GLOBAL:\r
+  //\r
   // 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;
+**/\r
+USB_XHCI_INSTANCE*\r
+XhcCreateUsbHc (\r
+  IN EFI_PCI_IO_PROTOCOL       *PciIo,\r
+  IN EFI_DEVICE_PATH_PROTOCOL  *DevicePath,\r
+  IN UINT64                    OriginalPciAttributes\r
+  )\r
+{\r
+  USB_XHCI_INSTANCE       *Xhc;\r
   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));
-
+  //\r
+  Xhc->Signature             = XHCI_INSTANCE_SIG;\r
+  Xhc->PciIo                 = PciIo;\r
+  Xhc->DevicePath            = DevicePath;\r
+  Xhc->OriginalPciAttributes = OriginalPciAttributes;\r
+  CopyMem (&Xhc->Usb2Hc, &gXhciUsb2HcTemplate, sizeof (EFI_USB2_HC_PROTOCOL));\r
+\r
   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;\r
+  BOOLEAN                 PciAttributesSaved;\r
+  USB_XHCI_INSTANCE       *Xhc;\r
+  EFI_DEVICE_PATH_PROTOCOL  *HcDevicePath;\r
+\r
+  //\r
+  // Open the PciIo Protocol, then enable the USB host controller\r
   //
   Status = gBS->OpenProtocol (
                   Controller,
@@ -1844,12 +1858,25 @@ XhcDriverBindingStart (
                   );
 
   if (EFI_ERROR (Status)) {
-    return Status;
-  }
-
-  PciAttributesSaved = FALSE;
-  //
-  // Save original PCI attributes
+    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
   //
   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"));
+  //\r
+  // Create then install USB2_HC_PROTOCOL\r
+  //\r
+  Xhc = XhcCreateUsbHc (PciIo, HcDevicePath, OriginalPciAttributes);\r
+\r
+  if (Xhc == NULL) {\r
+    DEBUG ((EFI_D_ERROR, "XhcDriverBindingStart: failed to create USB2_HC\n"));\r
     return EFI_OUT_OF_RESOURCES;
   }
 
index a486413086d51c18ea0f7a5fe7c1fe7c14dbe1ab..ae56b1e6fe49c06ff2ab5d7cd8bd99f20eb6bd97 100644 (file)
@@ -30,6 +30,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/UefiLib.h>\r
 #include <Library/DebugLib.h>\r
+#include <Library/ReportStatusCodeLib.h>\r
 \r
 #include <IndustryStandard/Pci.h>\r
 \r
index 286f3ac321662c6c0fee649b3c4fde21fde7d4cf..84dea07a4949e3d6db6ea3aa58c1b7113323982d 100644 (file)
@@ -6,7 +6,7 @@
 #  It implements the interfaces of monitoring the status of all ports and transferring\r
 #  Control, Bulk, Interrupt and Isochronous requests to those attached usb LS/FS/HS/SS devices.\r
 #\r
-#  Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -59,6 +59,7 @@
   UefiDriverEntryPoint\r
   BaseMemoryLib\r
   DebugLib\r
+  ReportStatusCodeLib\r
 \r
 [Guids]\r
   gEfiEventExitBootServicesGuid                 ## PRODUCES ## Event\r
index 7387a44dbedf3f1e3b52502db034234a053e6dde..a0833cfaf493d7710331bfd634b4585faa16c34d 100644 (file)
@@ -2,7 +2,7 @@
   SCSI Bus driver that layers on every SCSI Pass Thru and\r
   Extended SCSI Pass Thru protocol in the system.\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 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
@@ -341,6 +341,15 @@ SCSIBusDriverBindingStart (
     return DevicePathStatus;\r
   }\r
 \r
+  //\r
+  // Report Status Code to indicate SCSI bus starts\r
+  //\r
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+    EFI_PROGRESS_CODE,\r
+    (EFI_IO_BUS_SCSI | EFI_IOB_PC_INIT),\r
+    ParentDevicePath\r
+    );  \r
+\r
   //\r
   // To keep backward compatibility, UEFI ExtPassThru Protocol is supported as well as \r
   // EFI PassThru Protocol. From priority perspective, ExtPassThru Protocol is firstly\r
@@ -451,6 +460,15 @@ SCSIBusDriverBindingStart (
     ScsiBusDev = SCSI_BUS_CONTROLLER_DEVICE_FROM_THIS (BusIdentify);\r
   }\r
 \r
+  //\r
+  // Report Status Code to indicate detecting devices on bus\r
+  //\r
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+    EFI_PROGRESS_CODE,\r
+    (EFI_IO_BUS_SCSI | EFI_IOB_PC_DETECT),\r
+    ParentDevicePath\r
+    );\r
+\r
   Lun  = 0;\r
   if (RemainingDevicePath == NULL) {\r
     //\r
@@ -828,6 +846,15 @@ ScsiResetBus (
 \r
   ScsiIoDevice = SCSI_IO_DEV_FROM_THIS (This);\r
 \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_ATA_ATAPI | EFI_IOB_PC_RESET),\r
+    ScsiIoDevice->ScsiBusDeviceData->DevicePath\r
+    );\r
+\r
   if (ScsiIoDevice->ExtScsiSupport){\r
     return ScsiIoDevice->ExtScsiPassThru->ResetChannel (ScsiIoDevice->ExtScsiPassThru);\r
   } else {\r
@@ -857,6 +884,16 @@ ScsiResetDevice (
   UINT8        Target[TARGET_MAX_BYTES];\r
 \r
   ScsiIoDevice = SCSI_IO_DEV_FROM_THIS (This);\r
+\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_ATA_ATAPI | EFI_IOB_PC_RESET),\r
+    ScsiIoDevice->ScsiBusDeviceData->DevicePath\r
+    );\r
+  \r
   CopyMem (Target,&ScsiIoDevice->Pun, TARGET_MAX_BYTES);\r
 \r
 \r
@@ -1121,6 +1158,7 @@ ScsiScanCreateDevice (
   }\r
 \r
   ScsiIoDevice->Signature                 = SCSI_IO_DEV_SIGNATURE;\r
+  ScsiIoDevice->ScsiBusDeviceData         = ScsiBusDev;\r
   CopyMem(&ScsiIoDevice->Pun, TargetId, TARGET_MAX_BYTES);\r
   ScsiIoDevice->Lun                       = Lun;\r
 \r
@@ -1141,6 +1179,15 @@ ScsiScanCreateDevice (
   ScsiIoDevice->ScsiIo.ResetDevice        = ScsiResetDevice;\r
   ScsiIoDevice->ScsiIo.ExecuteScsiCommand = ScsiExecuteSCSICommand;\r
 \r
+  //\r
+  // Report Status Code here since the new SCSI device will be discovered\r
+  //\r
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+    EFI_PROGRESS_CODE,\r
+    (EFI_IO_BUS_SCSI | EFI_IOB_PC_ENABLE),\r
+    ScsiBusDev->DevicePath\r
+    );\r
+\r
   if (!DiscoverScsiDevice (ScsiIoDevice)) {\r
     Status = EFI_OUT_OF_RESOURCES;\r
     goto ErrorExit;\r
index 8f86444a4ce432c3d998a11ba5a77824aa026670..ed90a6d458d65e4668c0844cb9867d95f96c7a68 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Header file for SCSI Bus Driver.\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 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
@@ -33,6 +33,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/UefiScsiLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/DevicePathLib.h>\r
+#include <Library/ReportStatusCodeLib.h>\r
 \r
 #include <IndustryStandard/Scsi.h>\r
 \r
@@ -54,27 +55,10 @@ typedef struct {
    VOID   *Data2;\r
 } SCSI_EVENT_DATA;\r
 \r
-\r
-typedef struct {\r
-  UINT32                             Signature;\r
-  EFI_HANDLE                         Handle;\r
-  EFI_SCSI_IO_PROTOCOL               ScsiIo;\r
-  EFI_DEVICE_PATH_PROTOCOL           *DevicePath;\r
-  BOOLEAN                            ExtScsiSupport; \r
-  EFI_SCSI_PASS_THRU_PROTOCOL        *ScsiPassThru;\r
-  EFI_EXT_SCSI_PASS_THRU_PROTOCOL    *ExtScsiPassThru;\r
-  SCSI_TARGET_ID                     Pun;\r
-  UINT64                             Lun;\r
-  UINT8                              ScsiDeviceType;\r
-  UINT8                              ScsiVersion;\r
-  BOOLEAN                            RemovableDevice;\r
-} SCSI_IO_DEV;\r
-\r
-#define SCSI_IO_DEV_FROM_THIS(a)  CR (a, SCSI_IO_DEV, ScsiIo, SCSI_IO_DEV_SIGNATURE)\r
-\r
 //\r
 // SCSI Bus Controller device strcuture\r
 //\r
+#define SCSI_BUS_DEVICE_SIGNATURE  SIGNATURE_32 ('s', 'c', 's', 'i')\r
 \r
 //\r
 // The ScsiBusProtocol is just used to locate ScsiBusDev\r
@@ -87,9 +71,6 @@ typedef struct _EFI_SCSI_BUS_PROTOCOL {
   UINT64  Reserved;\r
 } EFI_SCSI_BUS_PROTOCOL;\r
 \r
-#define SCSI_BUS_DEVICE_SIGNATURE  SIGNATURE_32 ('s', 'c', 's', 'i')\r
-\r
-\r
 typedef struct _SCSI_BUS_DEVICE {\r
   UINTN                                 Signature;\r
   EFI_SCSI_BUS_PROTOCOL                 BusIdentify;\r
@@ -101,6 +82,24 @@ typedef struct _SCSI_BUS_DEVICE {
 \r
 #define SCSI_BUS_CONTROLLER_DEVICE_FROM_THIS(a)  CR (a, SCSI_BUS_DEVICE, BusIdentify, SCSI_BUS_DEVICE_SIGNATURE)\r
 \r
+typedef struct {\r
+  UINT32                             Signature;\r
+  EFI_HANDLE                         Handle;\r
+  EFI_SCSI_IO_PROTOCOL               ScsiIo;\r
+  EFI_DEVICE_PATH_PROTOCOL           *DevicePath;\r
+  BOOLEAN                            ExtScsiSupport; \r
+  EFI_SCSI_PASS_THRU_PROTOCOL        *ScsiPassThru;\r
+  EFI_EXT_SCSI_PASS_THRU_PROTOCOL    *ExtScsiPassThru;\r
+  SCSI_BUS_DEVICE                    *ScsiBusDeviceData;\r
+  SCSI_TARGET_ID                     Pun;\r
+  UINT64                             Lun;\r
+  UINT8                              ScsiDeviceType;\r
+  UINT8                              ScsiVersion;\r
+  BOOLEAN                            RemovableDevice;\r
+} SCSI_IO_DEV;\r
+\r
+#define SCSI_IO_DEV_FROM_THIS(a)  CR (a, SCSI_IO_DEV, ScsiIo, SCSI_IO_DEV_SIGNATURE)\r
+\r
 //\r
 // Global Variables\r
 //\r
index 99abb2f584cc6e0439239e4fc3a8cd6dac8d73c2..73665117f7cafac1131239a870703c64a9e652d9 100644 (file)
@@ -4,7 +4,7 @@
 #  each of them. After this the driver installs the Device Path Protocol and SCSI I/O Protocol on\r
 #  these handles.\r
 #  \r
-#  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2006 - 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
@@ -55,6 +55,7 @@
   UefiDriverEntryPoint\r
   DebugLib\r
   MemoryAllocationLib\r
+  ReportStatusCodeLib\r
 \r
 \r
 [Protocols]\r
index e8f9ed5018dc3c64bf110334b7eb8a9f4484fd8f..873cf2519afb501c886810547a8af3f2f513629b 100644 (file)
@@ -2,7 +2,7 @@
 \r
     Usb Bus Driver Binding and Bus IO Protocol.\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
@@ -1018,7 +1018,16 @@ UsbBusBuildProtocol (
   RootIf->Signature       = USB_INTERFACE_SIGNATURE;\r
   RootIf->Device          = RootHub;\r
   RootIf->DevicePath      = UsbBus->DevicePath;\r
-\r
+  \r
+  //\r
+  // Report Status Code here since we will enumerate the USB devices\r
+  //\r
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+    EFI_PROGRESS_CODE,\r
+    (EFI_IO_BUS_USB | EFI_IOB_PC_DETECT),\r
+    UsbBus->DevicePath\r
+    );\r
+  \r
   Status                  = mUsbRootHubApi.Init (RootIf);\r
 \r
   if (EFI_ERROR (Status)) {\r
@@ -1265,6 +1274,26 @@ UsbBusControllerDriverStart (
 {\r
   EFI_USB_BUS_PROTOCOL          *UsbBusId;\r
   EFI_STATUS                    Status;\r
+  EFI_DEVICE_PATH_PROTOCOL      *ParentDevicePath;\r
+\r
+  Status = gBS->OpenProtocol (\r
+                  Controller,\r
+                  &gEfiDevicePathProtocolGuid,\r
+                  (VOID **) &ParentDevicePath,\r
+                  This->DriverBindingHandle,\r
+                  Controller,\r
+                  EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+                  );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  //\r
+  // Report Status Code here since we will initialize the host controller\r
+  //\r
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+    EFI_PROGRESS_CODE,\r
+    (EFI_IO_BUS_USB | EFI_IOB_PC_INIT),\r
+    ParentDevicePath\r
+    );\r
 \r
   //\r
   // Locate the USB bus protocol, if it is found, USB bus\r
index 908dab18af2eba9c1a9573fd83acb44d0dd6b836..74de7d5d5069ee0cab0000ed422cbc9ed36f9503 100644 (file)
@@ -803,6 +803,14 @@ UsbEnumerateNewDev (
     goto ON_ERROR;\r
   }\r
 \r
+  //\r
+  // Report Status Code to indicate USB device has been detected by hotplug\r
+  //\r
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+    EFI_PROGRESS_CODE,\r
+    (EFI_IO_BUS_USB | EFI_IOB_PC_HOTPLUG),\r
+    Bus->DevicePath\r
+    );\r
   return EFI_SUCCESS;\r
 \r
 ON_ERROR:\r
index 5ccc71d24ac137ddee59da641b096abd40947ef4..fb7558b730705b44d6a76536447b845a4fa79f3b 100644 (file)
@@ -244,12 +244,25 @@ USBKeyboardDriverBindingStart (
 \r
   if (!Found) {\r
     //\r
+    // Report Status Code to indicate that there is no USB keyboard\r
+    //\r
+    REPORT_STATUS_CODE (\r
+      EFI_ERROR_CODE | EFI_ERROR_MINOR,\r
+      (EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_NOT_DETECTED)\r
+      );\r
+    //\r
     // No interrupt endpoint found, then return unsupported.\r
     //\r
     Status = EFI_UNSUPPORTED;\r
     goto ErrorExit;\r
   }\r
 \r
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+    EFI_PROGRESS_CODE,\r
+    (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_DETECTED),\r
+    UsbKeyboardDevice->DevicePath\r
+    );\r
+\r
   UsbKeyboardDevice->Signature                  = USB_KB_DEV_SIGNATURE;\r
   UsbKeyboardDevice->SimpleInput.Reset          = USBKeyboardReset;\r
   UsbKeyboardDevice->SimpleInput.ReadKeyStroke  = USBKeyboardReadKeyStroke;\r
index 9fc971c4fcc68b32114698b1eb3d7c1958deffd5..d955b43806dcc597e8259f973c5ccb6303984b09 100644 (file)
@@ -188,6 +188,16 @@ USBMouseAbsolutePointerDriverBindingStart (
   if (EFI_ERROR (Status)) {\r
     goto ErrorExit;\r
   }\r
+\r
+  //\r
+  // Report Status Code here since USB mouse will be detected next.\r
+  //\r
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+    EFI_PROGRESS_CODE,\r
+    (EFI_PERIPHERAL_MOUSE | EFI_P_PC_PRESENCE_DETECT),\r
+    UsbMouseDevice->DevicePath\r
+    );\r
+\r
   //\r
   // Get interface & endpoint descriptor\r
   //\r
@@ -221,12 +231,28 @@ USBMouseAbsolutePointerDriverBindingStart (
 \r
   if (!Found) {\r
     //\r
+    // Report Status Code to indicate that there is no USB mouse\r
+    //\r
+    REPORT_STATUS_CODE (\r
+      EFI_ERROR_CODE | EFI_ERROR_MINOR,,\r
+      (EFI_PERIPHERAL_MOUSE | EFI_P_EC_NOT_DETECTED)\r
+      );\r
+    //\r
     // No interrupt endpoint found, then return unsupported.\r
     //\r
     Status = EFI_UNSUPPORTED;\r
     goto ErrorExit;\r
   }\r
 \r
+  //\r
+  // Report Status Code here since USB mouse has be detected.\r
+  //\r
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+    EFI_PROGRESS_CODE,\r
+    (EFI_PERIPHERAL_MOUSE | EFI_P_PC_DETECTED),\r
+    UsbMouseDevice->DevicePath\r
+    );\r
+\r
   Status = InitializeUsbMouseDevice (UsbMouseAbsolutePointerDevice);\r
   if (EFI_ERROR (Status)) {\r
     //\r
index db5fe8ebfbdfe7e7c341a35a8d928dd3d4b9f04f..0ad5616d966113ad42b7cac7a7fda17a31789f95 100644 (file)
@@ -188,6 +188,16 @@ USBMouseDriverBindingStart (
   if (EFI_ERROR (Status)) {\r
     goto ErrorExit;\r
   }\r
+\r
+  //\r
+  // Report Status Code here since USB mouse will be detected next.\r
+  //\r
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+    EFI_PROGRESS_CODE,\r
+    (EFI_PERIPHERAL_MOUSE | EFI_P_PC_PRESENCE_DETECT),\r
+    UsbMouseDevice->DevicePath\r
+    );\r
+\r
   //\r
   // Get interface & endpoint descriptor\r
   //\r
@@ -221,12 +231,28 @@ USBMouseDriverBindingStart (
 \r
   if (!Found) {\r
     //\r
+    // Report Status Code to indicate that there is no USB mouse\r
+    //\r
+    REPORT_STATUS_CODE (\r
+      EFI_ERROR_CODE | EFI_ERROR_MINOR,\r
+      (EFI_PERIPHERAL_MOUSE | EFI_P_EC_NOT_DETECTED)\r
+      );\r
+    //\r
     // No interrupt endpoint found, then return unsupported.\r
     //\r
     Status = EFI_UNSUPPORTED;\r
     goto ErrorExit;\r
   }\r
 \r
+  //\r
+  // Report Status Code here since USB mouse has be detected.\r
+  //\r
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+    EFI_PROGRESS_CODE,\r
+    (EFI_PERIPHERAL_MOUSE | EFI_P_PC_DETECTED),\r
+    UsbMouseDevice->DevicePath\r
+    );\r
+\r
   Status = InitializeUsbMouseDevice (UsbMouseDevice);\r
   if (EFI_ERROR (Status)) {\r
     //\r
index e1ba34a0e3eec8a7d868f2e4d235482ad33e971f..ed5a3c9e177a66d744c1fac4728b49bd5a70b0c3 100644 (file)
@@ -448,7 +448,17 @@ DxeMain (
   //\r
   // Assert if the Architectural Protocols are not present.\r
   //\r
-  ASSERT_EFI_ERROR (CoreAllEfiServicesAvailable ());\r
+  Status = CoreAllEfiServicesAvailable ();\r
+  if (EFI_ERROR(Status)) {\r
+    //\r
+    // Report Status code that some Architectural Protocols are not present.\r
+    //\r
+    REPORT_STATUS_CODE (\r
+      EFI_ERROR_CODE | EFI_ERROR_MAJOR,\r
+      (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_EC_NO_ARCH)\r
+      );    \r
+  }\r
+  ASSERT_EFI_ERROR (Status);\r
 \r
   //\r
   // Report Status code before transfer control to BDS\r
index dea627e16282afc88bb9c5bb61c6c3d7468c4346..89d3a6fcffec662cac5bea835e9e7f37c316d0a4 100644 (file)
@@ -2,7 +2,7 @@
   Last PEIM.\r
   Responsibility of this module is to load the DXE Core from a Firmware Volume.\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 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
@@ -221,25 +221,49 @@ DxeLoadCore (
                NULL,\r
                (VOID **) &S3Resume\r
                );\r
+    if (EFI_ERROR (Status)) {\r
+      //\r
+      // Report Status code that S3Resume PPI can not be found\r
+      //\r
+      REPORT_STATUS_CODE (\r
+        EFI_ERROR_CODE | EFI_ERROR_MAJOR,\r
+        (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_S3_RESUME_PPI_NOT_FOUND)\r
+        );\r
+    }\r
     ASSERT_EFI_ERROR (Status);\r
     \r
     Status = S3Resume->S3RestoreConfig2 (S3Resume);\r
     ASSERT_EFI_ERROR (Status);\r
   } else if (BootMode == BOOT_IN_RECOVERY_MODE) {\r
+    REPORT_STATUS_CODE (EFI_PROGRESS_CODE, (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_RECOVERY_BEGIN));\r
     Status = PeiServicesLocatePpi (\r
                &gEfiPeiRecoveryModulePpiGuid,\r
                0,\r
                NULL,\r
                (VOID **) &PeiRecovery\r
                );\r
+    //\r
+    // Report Status code the failure of locating Recovery PPI \r
+    //\r
+    REPORT_STATUS_CODE (\r
+      EFI_ERROR_CODE | EFI_ERROR_MAJOR,\r
+      (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_RECOVERY_PPI_NOT_FOUND)\r
+      );    \r
     ASSERT_EFI_ERROR (Status);\r
-    \r
+    REPORT_STATUS_CODE (EFI_PROGRESS_CODE, (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_CAPSULE_LOAD));\r
     Status = PeiRecovery->LoadRecoveryCapsule (PeiServices, PeiRecovery);\r
     if (EFI_ERROR (Status)) {\r
       DEBUG ((DEBUG_ERROR, "Load Recovery Capsule Failed.(Status = %r)\n", Status));\r
+      //\r
+      // Report Status code that S3Resume PPI can not be found\r
+      //\r
+      REPORT_STATUS_CODE (\r
+        EFI_ERROR_CODE | EFI_ERROR_MAJOR,\r
+        (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_NO_RECOVERY_CAPSULE)\r
+        );\r
       CpuDeadLoop ();\r
     }\r
-\r
+    REPORT_STATUS_CODE (EFI_PROGRESS_CODE, (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_CAPSULE_START));\r
     //\r
     // Now should have a HOB with the DXE core\r
     //\r
index 96425fed538ef386f18a69381919db9653b1b543..793244b3916032e19f6ba441a201680b6b212136 100644 (file)
@@ -48,6 +48,13 @@ PeiResetSystem (
   if (!EFI_ERROR (Status)) {\r
     return ResetPpi->ResetSystem (PeiServices);\r
   } \r
+  //\r
+  // Report Status Code that Reset PPI is not available\r
+  //\r
+  REPORT_STATUS_CODE (\r
+    EFI_ERROR_CODE | EFI_ERROR_MINOR,\r
+    (EFI_SOFTWARE_PEI_CORE | EFI_SW_PS_EC_RESET_NOT_AVAILABLE)\r
+    );\r
   return  EFI_NOT_AVAILABLE_YET;\r
 }\r
 \r
index 26cd42b890b3d3ee0be46e018e6f282df1081929..07fc934b852a4de0b8d90018c0d796e730a40ea8 100644 (file)
@@ -35,7 +35,7 @@ Revision History:
   Table now contains an item named CalculateCrc32.\r
 \r
 \r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 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
@@ -279,6 +279,11 @@ RuntimeDriverSetVirtualAddressMap (
   //\r
   REPORT_STATUS_CODE (EFI_PROGRESS_CODE, (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_RS_PC_SET_VIRTUAL_ADDRESS_MAP));\r
 \r
+  //\r
+  // Report Status Code here since EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event will be signaled.\r
+  //\r
+  REPORT_STATUS_CODE (EFI_PROGRESS_CODE, (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_VIRTUAL_ADDRESS_CHANGE_EVENT));\r
+\r
   //\r
   // Signal all the EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE events.\r
   // All runtime events are stored in a list in Runtime AP.\r
index 80386e59f02fa1aa21cda66b8363e7295fd4d0a8..de0f87cfb51c12aab67e8fb1f88a4126ba9d2b5a 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Definitions for data structures used in S3 resume.\r
 \r
-Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>\r
 \r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
@@ -22,6 +22,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define SMM_S3_RESUME_SMM_32 SIGNATURE_64 ('S','M','M','S','3','_','3','2')\r
 #define SMM_S3_RESUME_SMM_64 SIGNATURE_64 ('S','M','M','S','3','_','6','4')\r
 \r
+#pragma pack(1)\r
+\r
 typedef struct {\r
   UINT64                Signature;\r
   EFI_PHYSICAL_ADDRESS  SmmS3ResumeEntryPoint;\r
@@ -50,12 +52,15 @@ typedef struct {
 \r
 typedef struct {\r
   UINT16                ReturnCs;\r
+  UINT64                ReturnStatus;\r
   EFI_PHYSICAL_ADDRESS  ReturnEntryPoint;\r
   EFI_PHYSICAL_ADDRESS  ReturnStackPointer;\r
   EFI_PHYSICAL_ADDRESS  AsmTransferControl;\r
   IA32_DESCRIPTOR       Idtr;\r
 } PEI_S3_RESUME_STATE;\r
 \r
+#pragma pack()\r
+\r
 #define EFI_ACPI_S3_CONTEXT_GUID \\r
   { \\r
     0xef98d3a, 0x3e33, 0x497a, {0xa4, 0x1, 0x77, 0xbe, 0x3e, 0xb7, 0x4f, 0x38} \\r
index 971e429f39c76e446318b6a0dcf5caded317ded3..3bddda131681c9f8c550bfb14601d44f1f5c1e25 100644 (file)
@@ -68,9 +68,12 @@ S3BootScriptExecutorEntryFunction (
   // for that parameter.\r
   //\r
   Status = S3BootScriptExecute ();\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
+\r
+  //\r
+  // Need report status back to S3ResumePeim. \r
+  // If boot script execution is failed, S3ResumePeim wil report the error status code.\r
+  //\r
+  PeiS3ResumeState->ReturnStatus = (UINT64)(UINTN)Status;\r
 \r
   AsmWbinvd ();\r
 \r
@@ -79,13 +82,6 @@ S3BootScriptExecutorEntryFunction (
   //\r
   Facs = (EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *) ((UINTN) (AcpiS3Context->AcpiFacsTable));\r
 \r
-  if ((Facs == NULL) ||\r
-      (Facs->Signature != EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) ||\r
-      ((Facs->FirmwareWakingVector == 0) && (Facs->XFirmwareWakingVector == 0)) ) {\r
-    CpuDeadLoop();\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
   //\r
   // We need turn back to S3Resume - install boot script done ppi and report status code on S3resume.\r
   //\r
@@ -97,12 +93,16 @@ S3BootScriptExecutorEntryFunction (
       DEBUG ((EFI_D_ERROR, "Call AsmDisablePaging64() to return to S3 Resume in PEI Phase\n"));\r
       PeiS3ResumeState->AsmTransferControl = (EFI_PHYSICAL_ADDRESS)(UINTN)AsmTransferControl32;\r
 \r
-      //\r
-      // more step needed - because relative address is handled differently between X64 and IA32.\r
-      //\r
-      AsmTransferControl16Address = (UINTN)AsmTransferControl16;\r
-      AsmFixAddress16 = (UINT32)AsmTransferControl16Address;\r
-      AsmJmpAddr32 = (UINT32)((Facs->FirmwareWakingVector & 0xF) | ((Facs->FirmwareWakingVector & 0xFFFF0) << 12));\r
+      if ((Facs != NULL) &&\r
+          (Facs->Signature == EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) &&\r
+          (Facs->FirmwareWakingVector != 0) ) {\r
+        //\r
+        // more step needed - because relative address is handled differently between X64 and IA32.\r
+        //\r
+        AsmTransferControl16Address = (UINTN)AsmTransferControl16;\r
+        AsmFixAddress16 = (UINT32)AsmTransferControl16Address;\r
+        AsmJmpAddr32 = (UINT32)((Facs->FirmwareWakingVector & 0xF) | ((Facs->FirmwareWakingVector & 0xFFFF0) << 12));\r
+      }\r
 \r
       AsmDisablePaging64 (\r
         PeiS3ResumeState->ReturnCs,\r
@@ -132,7 +132,10 @@ S3BootScriptExecutorEntryFunction (
     CpuDeadLoop();\r
     return EFI_UNSUPPORTED;\r
   }\r
-\r
+  \r
+  //\r
+  // S3ResumePeim does not provide a way to jump back to itself, so resume to OS here directly\r
+  //\r
   if (Facs->XFirmwareWakingVector != 0) {\r
     //\r
     // Switch to native waking vector\r
index 9adca0eb4271d1cf5770c1f4296bd38f107a002f..aa1ca162d6aa8e037654cb746dfe774e1130fa9f 100644 (file)
@@ -104,6 +104,11 @@ ResetSystem (
   EFI_STATUS    Status;\r
   UINTN         Size;\r
   UINTN         CapsuleDataPtr;\r
+  \r
+  //\r
+  // Indicate reset system runtime service is called.\r
+  //\r
+  REPORT_STATUS_CODE (EFI_PROGRESS_CODE, (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_RS_PC_RESET_SYSTEM));\r
 \r
   switch (ResetType) {\r
   case EfiResetWarm:\r
index 44b13df87193c40806879368a3f03273607aa78d..c3a2a7f1279a1df483c0b9958898aba7afa33735 100644 (file)
@@ -30,6 +30,7 @@
 #include <Library/UefiRuntimeLib.h>\r
 #include <Library/UefiRuntimeServicesTableLib.h>\r
 #include <Library/ResetSystemLib.h>\r
+#include <Library/ReportStatusCodeLib.h>\r
 \r
 /**\r
   The driver's entry point.\r
index 6fdd2d3f7e7a1ce9af374cbb12c4a6b5435562fa..cb17f3746be91bded307998888b1b5ca0c42ce14 100644 (file)
@@ -3,7 +3,7 @@
 #\r
 # This driver implements Reset Architectural Protocol.\r
 #\r
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
 #\r
 # This program and the accompanying materials are\r
 # licensed and made available under the terms and conditions of the BSD License\r
@@ -48,6 +48,7 @@
   UefiLib\r
   DebugLib\r
   BaseLib\r
+  ReportStatusCodeLib\r
 \r
 \r
 [Guids]\r