Revision: 13890
          http://edk2.svn.sourceforge.net/edk2/?rev=13890&view=rev
Author:   li-elvin
Date:     2012-10-30 04:23:40 +0000 (Tue, 30 Oct 2012)
Log Message:
-----------
Add missing status code in several modules.

Signed-off-by: Li Elvin <elvin...@intel.com>
Reviewed-by: Yao Jiewen <jiewen....@intel.com>
Reviewed-by: Ni Ruiyu <ruiyu...@intel.com>
Reviewed-by: Gao Liming <liming....@intel.com>
Reviewed-by: Tian Feng <feng.t...@intel.com>
Reviewed-by: Fan Jeff <jeff....@intel.com>

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

Modified: trunk/edk2/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.c
===================================================================
--- trunk/edk2/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.c  2012-10-30 04:19:03 UTC 
(rev 13889)
+++ trunk/edk2/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.c  2012-10-30 04:23:40 UTC 
(rev 13890)
@@ -295,6 +295,15 @@
   InitializeListHead (&AtaDevice->AtaSubTaskList);
 
   //
+  // Report Status Code to indicate the ATA device will be enabled
+  //
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (
+    EFI_PROGRESS_CODE,
+    (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_PC_ENABLE),
+    AtaBusDriverData->ParentDevicePath
+    );
+
+  //
   // Try to identify the ATA device via the ATA pass through command.
   //
   Status = DiscoverAtaDevice (AtaDevice);
@@ -719,6 +728,15 @@
     return Status;
   }
 
+  //
+  // Report Status Code to indicate ATA bus starts
+  //
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (
+    EFI_PROGRESS_CODE,
+    (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_PC_INIT),
+    ParentDevicePath
+    );
+
   Status = gBS->OpenProtocol (
                   Controller,
                   &gEfiAtaPassThruProtocolGuid,
@@ -771,6 +789,15 @@
     }
   }
 
+  //
+  // Report Status Code to indicate detecting devices on bus
+  //
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (
+    EFI_PROGRESS_CODE,
+    (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_PC_DETECT),
+    ParentDevicePath
+    );
+
   if (RemainingDevicePath == NULL) {
     Port = 0xFFFF;
     while (TRUE) {

Modified: trunk/edk2/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h
===================================================================
--- trunk/edk2/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h  2012-10-30 04:19:03 UTC 
(rev 13889)
+++ trunk/edk2/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h  2012-10-30 04:23:40 UTC 
(rev 13890)
@@ -38,6 +38,7 @@
 #include <Library/DevicePathLib.h>
 #include <Library/UefiRuntimeServicesTableLib.h>
 #include <Library/TimerLib.h>
+#include <Library/ReportStatusCodeLib.h>
 
 #include <IndustryStandard/Atapi.h>
 

Modified: trunk/edk2/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
===================================================================
--- trunk/edk2/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf     2012-10-30 
04:19:03 UTC (rev 13889)
+++ trunk/edk2/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf     2012-10-30 
04:23:40 UTC (rev 13890)
@@ -56,6 +56,7 @@
   UefiDriverEntryPoint
   DebugLib
   TimerLib
+  ReportStatusCodeLib
 
 [Guids]
   gEfiDiskInfoIdeInterfaceGuid                  # CONSUMES  ## GUID

Modified: trunk/edk2/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c
===================================================================
--- trunk/edk2/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c      
2012-10-30 04:19:03 UTC (rev 13889)
+++ trunk/edk2/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c      
2012-10-30 04:23:40 UTC (rev 13890)
@@ -185,6 +185,15 @@
 
   AtaPassThru = AtaDevice->AtaBusDriverData->AtaPassThru;
 
+  //
+  // Report Status Code to indicate reset happens
+  //
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (
+    EFI_PROGRESS_CODE,
+    (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_PC_RESET),
+    AtaDevice->AtaBusDriverData->ParentDevicePath
+    );
+
   return AtaPassThru->ResetDevice (
                         AtaPassThru,
                         AtaDevice->Port,

Modified: trunk/edk2/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c
===================================================================
--- trunk/edk2/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c      2012-10-30 04:19:03 UTC 
(rev 13889)
+++ trunk/edk2/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c      2012-10-30 04:23:40 UTC 
(rev 13890)
@@ -122,8 +122,20 @@
   EFI_STATUS              Status;
   UINT32                  DbgCtrlStatus;
 
+  Ehc = EHC_FROM_THIS (This);
+
+  if (Ehc->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),
+      Ehc->DevicePath
+      );
+  }
+
   OldTpl  = gBS->RaiseTPL (EHC_TPL);
-  Ehc     = EHC_FROM_THIS (This);
 
   switch (Attributes) {
   case EFI_USB_HC_RESET_GLOBAL:
@@ -1543,8 +1555,9 @@
 **/
 USB2_HC_DEV *
 EhcCreateUsb2Hc (
-  IN EFI_PCI_IO_PROTOCOL  *PciIo,
-  IN UINT64               OriginalPciAttributes
+  IN EFI_PCI_IO_PROTOCOL       *PciIo,
+  IN EFI_DEVICE_PATH_PROTOCOL  *DevicePath,
+  IN UINT64                    OriginalPciAttributes
   )
 {
   USB2_HC_DEV             *Ehc;
@@ -1578,6 +1591,7 @@
   Ehc->Usb2Hc.MinorRevision             = 0x0;
 
   Ehc->PciIo                 = PciIo;
+  Ehc->DevicePath            = DevicePath;
   Ehc->OriginalPciAttributes = OriginalPciAttributes;
 
   InitializeListHead (&Ehc->AsyncIntTransfers);
@@ -1684,6 +1698,7 @@
   UINTN                   EhciDeviceNumber;
   UINTN                   EhciFunctionNumber;
   UINT32                  State;
+  EFI_DEVICE_PATH_PROTOCOL  *HcDevicePath;
 
   //
   // Open the PciIo Protocol, then enable the USB host controller
@@ -1701,6 +1716,19 @@
     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
@@ -1842,7 +1870,7 @@
   //
   // Create then install USB2_HC_PROTOCOL
   //
-  Ehc = EhcCreateUsb2Hc (PciIo, OriginalPciAttributes);
+  Ehc = EhcCreateUsb2Hc (PciIo, HcDevicePath, OriginalPciAttributes);
 
   if (Ehc == NULL) {
     DEBUG ((EFI_D_ERROR, "EhcDriverBindingStart: failed to create USB2_HC\n"));

Modified: trunk/edk2/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.h
===================================================================
--- trunk/edk2/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.h      2012-10-30 04:19:03 UTC 
(rev 13889)
+++ trunk/edk2/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.h      2012-10-30 04:23:40 UTC 
(rev 13890)
@@ -32,6 +32,7 @@
 #include <Library/BaseLib.h>
 #include <Library/MemoryAllocationLib.h>
 #include <Library/PcdLib.h>
+#include <Library/ReportStatusCodeLib.h>
 
 #include <IndustryStandard/Pci.h>
 
@@ -115,6 +116,7 @@
   EFI_USB2_HC_PROTOCOL      Usb2Hc;
 
   EFI_PCI_IO_PROTOCOL       *PciIo;
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
   UINT64                    OriginalPciAttributes;
   USBHC_MEM_POOL            *MemPool;
 

Modified: trunk/edk2/MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf
===================================================================
--- trunk/edk2/MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf 2012-10-30 04:19:03 UTC 
(rev 13889)
+++ trunk/edk2/MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf 2012-10-30 04:23:40 UTC 
(rev 13890)
@@ -11,7 +11,7 @@
 #  This way avoids the control transfer on a shared port between EHCI and 
companion host
 #  controller when UHCI gets attached earlier than EHCI and a USB 2.0 device 
inserts.
 #
-#  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2006 - 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
@@ -75,6 +75,7 @@
   BaseMemoryLib
   DebugLib
   PcdLib
+  ReportStatusCodeLib
 
 [Guids]
   gEfiEventExitBootServicesGuid                 ## PRODUCES ## Event

Modified: trunk/edk2/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c
===================================================================
--- trunk/edk2/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c  2012-10-30 04:19:03 UTC 
(rev 13889)
+++ trunk/edk2/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c  2012-10-30 04:23:40 UTC 
(rev 13890)
@@ -8,7 +8,7 @@
   PCI Root Bridges. So it means platform needs install PCI Root Bridge IO 
protocol for each
   PCI Root Bus and install PCI Host Bridge Resource Allocation Protocol.
 
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 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
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -239,7 +239,8 @@
   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath
   )
 {
-  EFI_STATUS  Status;
+  EFI_STATUS                Status;
+  EFI_DEVICE_PATH_PROTOCOL  *ParentDevicePath;
 
   //
   // Check RemainingDevicePath validation
@@ -286,6 +287,28 @@
   gFullEnumeration = (BOOLEAN) ((SearchHostBridgeHandle (Controller) ? FALSE : 
TRUE));
 
   //
+  // Open Device Path Protocol for PCI root bridge
+  //
+  Status = gBS->OpenProtocol (
+                  Controller,
+                  &gEfiDevicePathProtocolGuid,
+                  (VOID **) &ParentDevicePath,
+                  This->DriverBindingHandle,
+                  Controller,
+                  EFI_OPEN_PROTOCOL_GET_PROTOCOL
+                  );  
+  ASSERT_EFI_ERROR (Status);
+
+  //
+  // Report Status Code to indicate PCI bus starts
+  //
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (
+    EFI_PROGRESS_CODE,
+    (EFI_IO_BUS_PCI | EFI_IOB_PC_INIT),
+    ParentDevicePath
+    );
+
+  //
   // Enumerate the entire host bridge
   // After enumeration, a database that records all the device information 
will be created
   //

Modified: trunk/edk2/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
===================================================================
--- trunk/edk2/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c   2012-10-30 
04:19:03 UTC (rev 13889)
+++ trunk/edk2/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c   2012-10-30 
04:23:40 UTC (rev 13890)
@@ -1,7 +1,7 @@
 /** @file
   PCI eunmeration implementation on entire PCI bus system for PCI Bus module.
 
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 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
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -2095,6 +2095,14 @@
   RootBridgeHandle = Temp->Handle;
 
   if (Operation == EfiPciHotPlugRequestAdd) {
+    //
+    // Report Status Code to indicate hot plug happens
+    //
+    REPORT_STATUS_CODE_WITH_DEVICE_PATH (
+      EFI_PROGRESS_CODE,
+      (EFI_IO_BUS_PCI | EFI_IOB_PC_HOTPLUG),
+      Temp->DevicePath
+      );
 
     if (NumberOfChildren != NULL) {
       *NumberOfChildren = 0;

Modified: trunk/edk2/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c
===================================================================
--- trunk/edk2/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c      2012-10-30 04:19:03 UTC 
(rev 13889)
+++ trunk/edk2/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c      2012-10-30 04:23:40 UTC 
(rev 13890)
@@ -2,7 +2,7 @@
 
   The UHCI driver model and HC protocol routines.
 
-Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 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
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -53,8 +53,19 @@
     return EFI_UNSUPPORTED;
   }
 
-  Uhc     = UHC_FROM_USB2_HC_PROTO (This);
+  Uhc = UHC_FROM_USB2_HC_PROTO (This);
 
+  if (Uhc->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),
+      Uhc->DevicePath
+      );
+  }
+
   OldTpl  = gBS->RaiseTPL (UHCI_TPL);
 
   switch (Attributes) {
@@ -1425,8 +1436,9 @@
 **/
 USB_HC_DEV *
 UhciAllocateDev (
-  IN EFI_PCI_IO_PROTOCOL    *PciIo,
-  IN UINT64                 OriginalPciAttributes
+  IN EFI_PCI_IO_PROTOCOL       *PciIo,
+  IN EFI_DEVICE_PATH_PROTOCOL  *DevicePath,
+  IN UINT64                    OriginalPciAttributes
   )
 {
   USB_HC_DEV  *Uhc;
@@ -1460,6 +1472,7 @@
   Uhc->Usb2Hc.MinorRevision             = 0x1;
 
   Uhc->PciIo                 = PciIo;
+  Uhc->DevicePath            = DevicePath;
   Uhc->OriginalPciAttributes = OriginalPciAttributes;
   Uhc->MemPool               = UsbHcInitMemPool (PciIo, TRUE, 0);
 
@@ -1622,6 +1635,7 @@
   UINT64              Supports;
   UINT64              OriginalPciAttributes;
   BOOLEAN             PciAttributesSaved;
+  EFI_DEVICE_PATH_PROTOCOL  *HcDevicePath;
 
   //
   // Open PCIIO, then enable the EHC device and turn off emulation
@@ -1640,6 +1654,19 @@
     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
@@ -1684,7 +1711,7 @@
     goto CLOSE_PCIIO;
   }
 
-  Uhc = UhciAllocateDev (PciIo, OriginalPciAttributes);
+  Uhc = UhciAllocateDev (PciIo, HcDevicePath, OriginalPciAttributes);
 
   if (Uhc == NULL) {
     Status = EFI_OUT_OF_RESOURCES;

Modified: trunk/edk2/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.h
===================================================================
--- trunk/edk2/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.h      2012-10-30 04:19:03 UTC 
(rev 13889)
+++ trunk/edk2/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.h      2012-10-30 04:23:40 UTC 
(rev 13890)
@@ -2,7 +2,7 @@
 
   The definition for UHCI driver model and HC protocol routines.
 
-Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 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
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -33,6 +33,7 @@
 #include <Library/BaseLib.h>
 #include <Library/MemoryAllocationLib.h>
 #include <Library/PcdLib.h>
+#include <Library/ReportStatusCodeLib.h>
 
 #include <IndustryStandard/Pci.h>
 
@@ -112,6 +113,7 @@
   UINT32                    Signature;
   EFI_USB2_HC_PROTOCOL      Usb2Hc;
   EFI_PCI_IO_PROTOCOL       *PciIo;
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
   UINT64                    OriginalPciAttributes;
 
   //

Modified: trunk/edk2/MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf
===================================================================
--- trunk/edk2/MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf 2012-10-30 04:19:03 UTC 
(rev 13889)
+++ trunk/edk2/MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf 2012-10-30 04:23:40 UTC 
(rev 13890)
@@ -6,7 +6,7 @@
 #  It implements the interfaces of monitoring the status of all ports and 
transferring
 #  Control, Bulk, Interrupt and Isochronous requests to Usb1.x device
 #
-#  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2006 - 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
@@ -71,6 +71,7 @@
   BaseMemoryLib
   DebugLib
   PcdLib
+  ReportStatusCodeLib
 
 [Guids]
   gEfiEventExitBootServicesGuid                 ## PRODUCES ## Event

Modified: trunk/edk2/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
===================================================================
--- trunk/edk2/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c      2012-10-30 04:19:03 UTC 
(rev 13889)
+++ trunk/edk2/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c      2012-10-30 04:23:40 UTC 
(rev 13890)
@@ -140,16 +140,27 @@
   )
 {
   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 @@
   @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 @@
 
   //
   // 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,13 +1840,14 @@
   EFI_STATUS              Status;
   EFI_PCI_IO_PROTOCOL     *PciIo;
   UINT64                  Supports;
-  UINT64                  OriginalPciAttributes;
-  BOOLEAN                 PciAttributesSaved;
-  USB_XHCI_INSTANCE       *Xhc;
-
+  UINT64                  OriginalPciAttributes;
+  BOOLEAN                 PciAttributesSaved;
+  USB_XHCI_INSTANCE       *Xhc;
+  EFI_DEVICE_PATH_PROTOCOL  *HcDevicePath;
+
+  //
+  // Open the PciIo Protocol, then enable the USB host controller
   //
-  // Open the PciIo Protocol, then enable the USB host controller
-  //
   Status = gBS->OpenProtocol (
                   Controller,
                   &gEfiPciIoProtocolGuid,
@@ -1844,13 +1858,26 @@
                   );
 
   if (EFI_ERROR (Status)) {
-    return Status;
-  }
-
-  PciAttributesSaved = FALSE;
+    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
   //
-  // Save original PCI attributes
-  //
   Status = PciIo->Attributes (
                     PciIo,
                     EfiPciIoAttributeOperationGet,
@@ -1884,13 +1911,13 @@
     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;
   }
 

Modified: trunk/edk2/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
===================================================================
--- trunk/edk2/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h      2012-10-30 04:19:03 UTC 
(rev 13889)
+++ trunk/edk2/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h      2012-10-30 04:23:40 UTC 
(rev 13890)
@@ -30,6 +30,7 @@
 #include <Library/MemoryAllocationLib.h>
 #include <Library/UefiLib.h>
 #include <Library/DebugLib.h>
+#include <Library/ReportStatusCodeLib.h>
 
 #include <IndustryStandard/Pci.h>
 

Modified: trunk/edk2/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
===================================================================
--- trunk/edk2/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf 2012-10-30 04:19:03 UTC 
(rev 13889)
+++ trunk/edk2/MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf 2012-10-30 04:23:40 UTC 
(rev 13890)
@@ -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

Modified: trunk/edk2/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c
===================================================================
--- trunk/edk2/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c       2012-10-30 
04:19:03 UTC (rev 13889)
+++ trunk/edk2/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c       2012-10-30 
04:23:40 UTC (rev 13890)
@@ -2,7 +2,7 @@
   SCSI Bus driver that layers on every SCSI Pass Thru and
   Extended SCSI Pass Thru protocol in the system.
 
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 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
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -342,6 +342,15 @@
   }
 
   //
+  // Report Status Code to indicate SCSI bus starts
+  //
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (
+    EFI_PROGRESS_CODE,
+    (EFI_IO_BUS_SCSI | EFI_IOB_PC_INIT),
+    ParentDevicePath
+    );  
+
+  //
   // To keep backward compatibility, UEFI ExtPassThru Protocol is supported as 
well as 
   // EFI PassThru Protocol. From priority perspective, ExtPassThru Protocol is 
firstly
   // tried to open on host controller handle. If fails, then PassThru Protocol 
is tried instead.
@@ -451,6 +460,15 @@
     ScsiBusDev = SCSI_BUS_CONTROLLER_DEVICE_FROM_THIS (BusIdentify);
   }
 
+  //
+  // Report Status Code to indicate detecting devices on bus
+  //
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (
+    EFI_PROGRESS_CODE,
+    (EFI_IO_BUS_SCSI | EFI_IOB_PC_DETECT),
+    ParentDevicePath
+    );
+
   Lun  = 0;
   if (RemainingDevicePath == NULL) {
     //
@@ -828,6 +846,15 @@
 
   ScsiIoDevice = SCSI_IO_DEV_FROM_THIS (This);
 
+  //
+  // Report Status Code to indicate reset happens
+  //
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (
+    EFI_PROGRESS_CODE,
+    (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_PC_RESET),
+    ScsiIoDevice->ScsiBusDeviceData->DevicePath
+    );
+
   if (ScsiIoDevice->ExtScsiSupport){
     return ScsiIoDevice->ExtScsiPassThru->ResetChannel 
(ScsiIoDevice->ExtScsiPassThru);
   } else {
@@ -857,6 +884,16 @@
   UINT8        Target[TARGET_MAX_BYTES];
 
   ScsiIoDevice = SCSI_IO_DEV_FROM_THIS (This);
+
+  //
+  // Report Status Code to indicate reset happens
+  //
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (
+    EFI_PROGRESS_CODE,
+    (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_PC_RESET),
+    ScsiIoDevice->ScsiBusDeviceData->DevicePath
+    );
+  
   CopyMem (Target,&ScsiIoDevice->Pun, TARGET_MAX_BYTES);
 
 
@@ -1121,6 +1158,7 @@
   }
 
   ScsiIoDevice->Signature                 = SCSI_IO_DEV_SIGNATURE;
+  ScsiIoDevice->ScsiBusDeviceData         = ScsiBusDev;
   CopyMem(&ScsiIoDevice->Pun, TargetId, TARGET_MAX_BYTES);
   ScsiIoDevice->Lun                       = Lun;
 
@@ -1141,6 +1179,15 @@
   ScsiIoDevice->ScsiIo.ResetDevice        = ScsiResetDevice;
   ScsiIoDevice->ScsiIo.ExecuteScsiCommand = ScsiExecuteSCSICommand;
 
+  //
+  // Report Status Code here since the new SCSI device will be discovered
+  //
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (
+    EFI_PROGRESS_CODE,
+    (EFI_IO_BUS_SCSI | EFI_IOB_PC_ENABLE),
+    ScsiBusDev->DevicePath
+    );
+
   if (!DiscoverScsiDevice (ScsiIoDevice)) {
     Status = EFI_OUT_OF_RESOURCES;
     goto ErrorExit;

Modified: trunk/edk2/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.h
===================================================================
--- trunk/edk2/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.h       2012-10-30 
04:19:03 UTC (rev 13889)
+++ trunk/edk2/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.h       2012-10-30 
04:23:40 UTC (rev 13890)
@@ -1,7 +1,7 @@
 /** @file
   Header file for SCSI Bus Driver.
 
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 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
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -33,6 +33,7 @@
 #include <Library/UefiScsiLib.h>
 #include <Library/UefiBootServicesTableLib.h>
 #include <Library/DevicePathLib.h>
+#include <Library/ReportStatusCodeLib.h>
 
 #include <IndustryStandard/Scsi.h>
 
@@ -54,27 +55,10 @@
    VOID   *Data2;
 } SCSI_EVENT_DATA;
 
-
-typedef struct {
-  UINT32                             Signature;
-  EFI_HANDLE                         Handle;
-  EFI_SCSI_IO_PROTOCOL               ScsiIo;
-  EFI_DEVICE_PATH_PROTOCOL           *DevicePath;
-  BOOLEAN                            ExtScsiSupport; 
-  EFI_SCSI_PASS_THRU_PROTOCOL        *ScsiPassThru;
-  EFI_EXT_SCSI_PASS_THRU_PROTOCOL    *ExtScsiPassThru;
-  SCSI_TARGET_ID                     Pun;
-  UINT64                             Lun;
-  UINT8                              ScsiDeviceType;
-  UINT8                              ScsiVersion;
-  BOOLEAN                            RemovableDevice;
-} SCSI_IO_DEV;
-
-#define SCSI_IO_DEV_FROM_THIS(a)  CR (a, SCSI_IO_DEV, ScsiIo, 
SCSI_IO_DEV_SIGNATURE)
-
 //
 // SCSI Bus Controller device strcuture
 //
+#define SCSI_BUS_DEVICE_SIGNATURE  SIGNATURE_32 ('s', 'c', 's', 'i')
 
 //
 // The ScsiBusProtocol is just used to locate ScsiBusDev
@@ -87,9 +71,6 @@
   UINT64  Reserved;
 } EFI_SCSI_BUS_PROTOCOL;
 
-#define SCSI_BUS_DEVICE_SIGNATURE  SIGNATURE_32 ('s', 'c', 's', 'i')
-
-
 typedef struct _SCSI_BUS_DEVICE {
   UINTN                                 Signature;
   EFI_SCSI_BUS_PROTOCOL                 BusIdentify;
@@ -101,6 +82,24 @@
 
 #define SCSI_BUS_CONTROLLER_DEVICE_FROM_THIS(a)  CR (a, SCSI_BUS_DEVICE, 
BusIdentify, SCSI_BUS_DEVICE_SIGNATURE)
 
+typedef struct {
+  UINT32                             Signature;
+  EFI_HANDLE                         Handle;
+  EFI_SCSI_IO_PROTOCOL               ScsiIo;
+  EFI_DEVICE_PATH_PROTOCOL           *DevicePath;
+  BOOLEAN                            ExtScsiSupport; 
+  EFI_SCSI_PASS_THRU_PROTOCOL        *ScsiPassThru;
+  EFI_EXT_SCSI_PASS_THRU_PROTOCOL    *ExtScsiPassThru;
+  SCSI_BUS_DEVICE                    *ScsiBusDeviceData;
+  SCSI_TARGET_ID                     Pun;
+  UINT64                             Lun;
+  UINT8                              ScsiDeviceType;
+  UINT8                              ScsiVersion;
+  BOOLEAN                            RemovableDevice;
+} SCSI_IO_DEV;
+
+#define SCSI_IO_DEV_FROM_THIS(a)  CR (a, SCSI_IO_DEV, ScsiIo, 
SCSI_IO_DEV_SIGNATURE)
+
 //
 // Global Variables
 //

Modified: trunk/edk2/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
===================================================================
--- trunk/edk2/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf  2012-10-30 
04:19:03 UTC (rev 13889)
+++ trunk/edk2/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf  2012-10-30 
04:23:40 UTC (rev 13890)
@@ -4,7 +4,7 @@
 #  each of them. After this the driver installs the Device Path Protocol and 
SCSI I/O Protocol on
 #  these handles.
 #  
-#  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2006 - 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
 #  which accompanies this distribution.  The full text of the license may be 
found at
@@ -55,6 +55,7 @@
   UefiDriverEntryPoint
   DebugLib
   MemoryAllocationLib
+  ReportStatusCodeLib
 
 
 [Protocols]

Modified: trunk/edk2/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
===================================================================
--- trunk/edk2/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c  2012-10-30 04:19:03 UTC 
(rev 13889)
+++ trunk/edk2/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c  2012-10-30 04:23:40 UTC 
(rev 13890)
@@ -2,7 +2,7 @@
 
     Usb Bus Driver Binding and Bus IO Protocol.
 
-Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 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
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -1018,7 +1018,16 @@
   RootIf->Signature       = USB_INTERFACE_SIGNATURE;
   RootIf->Device          = RootHub;
   RootIf->DevicePath      = UsbBus->DevicePath;
-
+  
+  //
+  // Report Status Code here since we will enumerate the USB devices
+  //
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (
+    EFI_PROGRESS_CODE,
+    (EFI_IO_BUS_USB | EFI_IOB_PC_DETECT),
+    UsbBus->DevicePath
+    );
+  
   Status                  = mUsbRootHubApi.Init (RootIf);
 
   if (EFI_ERROR (Status)) {
@@ -1265,8 +1274,28 @@
 {
   EFI_USB_BUS_PROTOCOL          *UsbBusId;
   EFI_STATUS                    Status;
+  EFI_DEVICE_PATH_PROTOCOL      *ParentDevicePath;
 
+  Status = gBS->OpenProtocol (
+                  Controller,
+                  &gEfiDevicePathProtocolGuid,
+                  (VOID **) &ParentDevicePath,
+                  This->DriverBindingHandle,
+                  Controller,
+                  EFI_OPEN_PROTOCOL_GET_PROTOCOL
+                  );
+  ASSERT_EFI_ERROR (Status);
+
   //
+  // Report Status Code here since we will initialize the host controller
+  //
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (
+    EFI_PROGRESS_CODE,
+    (EFI_IO_BUS_USB | EFI_IOB_PC_INIT),
+    ParentDevicePath
+    );
+
+  //
   // Locate the USB bus protocol, if it is found, USB bus
   // is already started on this controller.
   //

Modified: trunk/edk2/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
===================================================================
--- trunk/edk2/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c       2012-10-30 
04:19:03 UTC (rev 13889)
+++ trunk/edk2/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c       2012-10-30 
04:23:40 UTC (rev 13890)
@@ -803,6 +803,14 @@
     goto ON_ERROR;
   }
 
+  //
+  // Report Status Code to indicate USB device has been detected by hotplug
+  //
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (
+    EFI_PROGRESS_CODE,
+    (EFI_IO_BUS_USB | EFI_IOB_PC_HOTPLUG),
+    Bus->DevicePath
+    );
   return EFI_SUCCESS;
 
 ON_ERROR:

Modified: trunk/edk2/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c
===================================================================
--- trunk/edk2/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c   2012-10-30 04:19:03 UTC 
(rev 13889)
+++ trunk/edk2/MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c   2012-10-30 04:23:40 UTC 
(rev 13890)
@@ -244,12 +244,25 @@
 
   if (!Found) {
     //
+    // Report Status Code to indicate that there is no USB keyboard
+    //
+    REPORT_STATUS_CODE (
+      EFI_ERROR_CODE | EFI_ERROR_MINOR,
+      (EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_NOT_DETECTED)
+      );
+    //
     // No interrupt endpoint found, then return unsupported.
     //
     Status = EFI_UNSUPPORTED;
     goto ErrorExit;
   }
 
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (
+    EFI_PROGRESS_CODE,
+    (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_DETECTED),
+    UsbKeyboardDevice->DevicePath
+    );
+
   UsbKeyboardDevice->Signature                  = USB_KB_DEV_SIGNATURE;
   UsbKeyboardDevice->SimpleInput.Reset          = USBKeyboardReset;
   UsbKeyboardDevice->SimpleInput.ReadKeyStroke  = USBKeyboardReadKeyStroke;

Modified: 
trunk/edk2/MdeModulePkg/Bus/Usb/UsbMouseAbsolutePointerDxe/UsbMouseAbsolutePointer.c
===================================================================
--- 
trunk/edk2/MdeModulePkg/Bus/Usb/UsbMouseAbsolutePointerDxe/UsbMouseAbsolutePointer.c
        2012-10-30 04:19:03 UTC (rev 13889)
+++ 
trunk/edk2/MdeModulePkg/Bus/Usb/UsbMouseAbsolutePointerDxe/UsbMouseAbsolutePointer.c
        2012-10-30 04:23:40 UTC (rev 13890)
@@ -188,7 +188,17 @@
   if (EFI_ERROR (Status)) {
     goto ErrorExit;
   }
+
   //
+  // Report Status Code here since USB mouse will be detected next.
+  //
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (
+    EFI_PROGRESS_CODE,
+    (EFI_PERIPHERAL_MOUSE | EFI_P_PC_PRESENCE_DETECT),
+    UsbMouseDevice->DevicePath
+    );
+
+  //
   // Get interface & endpoint descriptor
   //
   UsbIo->UsbGetInterfaceDescriptor (
@@ -221,12 +231,28 @@
 
   if (!Found) {
     //
+    // Report Status Code to indicate that there is no USB mouse
+    //
+    REPORT_STATUS_CODE (
+      EFI_ERROR_CODE | EFI_ERROR_MINOR,,
+      (EFI_PERIPHERAL_MOUSE | EFI_P_EC_NOT_DETECTED)
+      );
+    //
     // No interrupt endpoint found, then return unsupported.
     //
     Status = EFI_UNSUPPORTED;
     goto ErrorExit;
   }
 
+  //
+  // Report Status Code here since USB mouse has be detected.
+  //
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (
+    EFI_PROGRESS_CODE,
+    (EFI_PERIPHERAL_MOUSE | EFI_P_PC_DETECTED),
+    UsbMouseDevice->DevicePath
+    );
+
   Status = InitializeUsbMouseDevice (UsbMouseAbsolutePointerDevice);
   if (EFI_ERROR (Status)) {
     //

Modified: trunk/edk2/MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouse.c
===================================================================
--- trunk/edk2/MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouse.c      2012-10-30 
04:19:03 UTC (rev 13889)
+++ trunk/edk2/MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouse.c      2012-10-30 
04:23:40 UTC (rev 13890)
@@ -188,7 +188,17 @@
   if (EFI_ERROR (Status)) {
     goto ErrorExit;
   }
+
   //
+  // Report Status Code here since USB mouse will be detected next.
+  //
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (
+    EFI_PROGRESS_CODE,
+    (EFI_PERIPHERAL_MOUSE | EFI_P_PC_PRESENCE_DETECT),
+    UsbMouseDevice->DevicePath
+    );
+
+  //
   // Get interface & endpoint descriptor
   //
   UsbIo->UsbGetInterfaceDescriptor (
@@ -221,12 +231,28 @@
 
   if (!Found) {
     //
+    // Report Status Code to indicate that there is no USB mouse
+    //
+    REPORT_STATUS_CODE (
+      EFI_ERROR_CODE | EFI_ERROR_MINOR,
+      (EFI_PERIPHERAL_MOUSE | EFI_P_EC_NOT_DETECTED)
+      );
+    //
     // No interrupt endpoint found, then return unsupported.
     //
     Status = EFI_UNSUPPORTED;
     goto ErrorExit;
   }
 
+  //
+  // Report Status Code here since USB mouse has be detected.
+  //
+  REPORT_STATUS_CODE_WITH_DEVICE_PATH (
+    EFI_PROGRESS_CODE,
+    (EFI_PERIPHERAL_MOUSE | EFI_P_PC_DETECTED),
+    UsbMouseDevice->DevicePath
+    );
+
   Status = InitializeUsbMouseDevice (UsbMouseDevice);
   if (EFI_ERROR (Status)) {
     //

Modified: trunk/edk2/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
===================================================================
--- trunk/edk2/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c  2012-10-30 04:19:03 UTC 
(rev 13889)
+++ trunk/edk2/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c  2012-10-30 04:23:40 UTC 
(rev 13890)
@@ -448,7 +448,17 @@
   //
   // Assert if the Architectural Protocols are not present.
   //
-  ASSERT_EFI_ERROR (CoreAllEfiServicesAvailable ());
+  Status = CoreAllEfiServicesAvailable ();
+  if (EFI_ERROR(Status)) {
+    //
+    // Report Status code that some Architectural Protocols are not present.
+    //
+    REPORT_STATUS_CODE (
+      EFI_ERROR_CODE | EFI_ERROR_MAJOR,
+      (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_EC_NO_ARCH)
+      );    
+  }
+  ASSERT_EFI_ERROR (Status);
 
   //
   // Report Status code before transfer control to BDS

Modified: trunk/edk2/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
===================================================================
--- trunk/edk2/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c   2012-10-30 04:19:03 UTC 
(rev 13889)
+++ trunk/edk2/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c   2012-10-30 04:23:40 UTC 
(rev 13890)
@@ -2,7 +2,7 @@
   Last PEIM.
   Responsibility of this module is to load the DXE Core from a Firmware Volume.
 
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 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
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -221,25 +221,49 @@
                NULL,
                (VOID **) &S3Resume
                );
+    if (EFI_ERROR (Status)) {
+      //
+      // Report Status code that S3Resume PPI can not be found
+      //
+      REPORT_STATUS_CODE (
+        EFI_ERROR_CODE | EFI_ERROR_MAJOR,
+        (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_S3_RESUME_PPI_NOT_FOUND)
+        );
+    }
     ASSERT_EFI_ERROR (Status);
     
     Status = S3Resume->S3RestoreConfig2 (S3Resume);
     ASSERT_EFI_ERROR (Status);
   } else if (BootMode == BOOT_IN_RECOVERY_MODE) {
+    REPORT_STATUS_CODE (EFI_PROGRESS_CODE, (EFI_SOFTWARE_PEI_MODULE | 
EFI_SW_PEI_PC_RECOVERY_BEGIN));
     Status = PeiServicesLocatePpi (
                &gEfiPeiRecoveryModulePpiGuid,
                0,
                NULL,
                (VOID **) &PeiRecovery
                );
+    //
+    // Report Status code the failure of locating Recovery PPI 
+    //
+    REPORT_STATUS_CODE (
+      EFI_ERROR_CODE | EFI_ERROR_MAJOR,
+      (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_RECOVERY_PPI_NOT_FOUND)
+      );    
     ASSERT_EFI_ERROR (Status);
-    
+    REPORT_STATUS_CODE (EFI_PROGRESS_CODE, (EFI_SOFTWARE_PEI_MODULE | 
EFI_SW_PEI_PC_CAPSULE_LOAD));
     Status = PeiRecovery->LoadRecoveryCapsule (PeiServices, PeiRecovery);
     if (EFI_ERROR (Status)) {
       DEBUG ((DEBUG_ERROR, "Load Recovery Capsule Failed.(Status = %r)\n", 
Status));
+      //
+      // Report Status code that S3Resume PPI can not be found
+      //
+      REPORT_STATUS_CODE (
+        EFI_ERROR_CODE | EFI_ERROR_MAJOR,
+        (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_NO_RECOVERY_CAPSULE)
+        );
       CpuDeadLoop ();
     }
-
+    REPORT_STATUS_CODE (EFI_PROGRESS_CODE, (EFI_SOFTWARE_PEI_MODULE | 
EFI_SW_PEI_PC_CAPSULE_START));
     //
     // Now should have a HOB with the DXE core
     //

Modified: trunk/edk2/MdeModulePkg/Core/Pei/Reset/Reset.c
===================================================================
--- trunk/edk2/MdeModulePkg/Core/Pei/Reset/Reset.c      2012-10-30 04:19:03 UTC 
(rev 13889)
+++ trunk/edk2/MdeModulePkg/Core/Pei/Reset/Reset.c      2012-10-30 04:23:40 UTC 
(rev 13890)
@@ -48,6 +48,13 @@
   if (!EFI_ERROR (Status)) {
     return ResetPpi->ResetSystem (PeiServices);
   } 
+  //
+  // Report Status Code that Reset PPI is not available
+  //
+  REPORT_STATUS_CODE (
+    EFI_ERROR_CODE | EFI_ERROR_MINOR,
+    (EFI_SOFTWARE_PEI_CORE | EFI_SW_PS_EC_RESET_NOT_AVAILABLE)
+    );
   return  EFI_NOT_AVAILABLE_YET;
 }
 

Modified: trunk/edk2/MdeModulePkg/Core/RuntimeDxe/Runtime.c
===================================================================
--- trunk/edk2/MdeModulePkg/Core/RuntimeDxe/Runtime.c   2012-10-30 04:19:03 UTC 
(rev 13889)
+++ trunk/edk2/MdeModulePkg/Core/RuntimeDxe/Runtime.c   2012-10-30 04:23:40 UTC 
(rev 13890)
@@ -35,7 +35,7 @@
   Table now contains an item named CalculateCrc32.
 
 
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 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
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -280,6 +280,11 @@
   REPORT_STATUS_CODE (EFI_PROGRESS_CODE, (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | 
EFI_SW_RS_PC_SET_VIRTUAL_ADDRESS_MAP));
 
   //
+  // Report Status Code here since EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event 
will be signaled.
+  //
+  REPORT_STATUS_CODE (EFI_PROGRESS_CODE, (EFI_SOFTWARE_DXE_BS_DRIVER | 
EFI_SW_DXE_BS_PC_VIRTUAL_ADDRESS_CHANGE_EVENT));
+
+  //
   // Signal all the EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE events.
   // All runtime events are stored in a list in Runtime AP.
   //

Modified: trunk/edk2/MdeModulePkg/Include/Guid/AcpiS3Context.h
===================================================================
--- trunk/edk2/MdeModulePkg/Include/Guid/AcpiS3Context.h        2012-10-30 
04:19:03 UTC (rev 13889)
+++ trunk/edk2/MdeModulePkg/Include/Guid/AcpiS3Context.h        2012-10-30 
04:23:40 UTC (rev 13890)
@@ -1,7 +1,7 @@
 /** @file
   Definitions for data structures used in S3 resume.
 
-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
@@ -22,6 +22,8 @@
 #define SMM_S3_RESUME_SMM_32 SIGNATURE_64 ('S','M','M','S','3','_','3','2')
 #define SMM_S3_RESUME_SMM_64 SIGNATURE_64 ('S','M','M','S','3','_','6','4')
 
+#pragma pack(1)
+
 typedef struct {
   UINT64                Signature;
   EFI_PHYSICAL_ADDRESS  SmmS3ResumeEntryPoint;
@@ -50,12 +52,15 @@
 
 typedef struct {
   UINT16                ReturnCs;
+  UINT64                ReturnStatus;
   EFI_PHYSICAL_ADDRESS  ReturnEntryPoint;
   EFI_PHYSICAL_ADDRESS  ReturnStackPointer;
   EFI_PHYSICAL_ADDRESS  AsmTransferControl;
   IA32_DESCRIPTOR       Idtr;
 } PEI_S3_RESUME_STATE;
 
+#pragma pack()
+
 #define EFI_ACPI_S3_CONTEXT_GUID \
   { \
     0xef98d3a, 0x3e33, 0x497a, {0xa4, 0x1, 0x77, 0xbe, 0x3e, 0xb7, 0x4f, 0x38} 
\

Modified: 
trunk/edk2/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.c
===================================================================
--- 
trunk/edk2/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.c    
    2012-10-30 04:19:03 UTC (rev 13889)
+++ 
trunk/edk2/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.c    
    2012-10-30 04:23:40 UTC (rev 13890)
@@ -68,10 +68,13 @@
   // for that parameter.
   //
   Status = S3BootScriptExecute ();
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
 
+  //
+  // Need report status back to S3ResumePeim. 
+  // If boot script execution is failed, S3ResumePeim wil report the error 
status code.
+  //
+  PeiS3ResumeState->ReturnStatus = (UINT64)(UINTN)Status;
+
   AsmWbinvd ();
 
   //
@@ -79,13 +82,6 @@
   //
   Facs = (EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *) ((UINTN) 
(AcpiS3Context->AcpiFacsTable));
 
-  if ((Facs == NULL) ||
-      (Facs->Signature != 
EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) ||
-      ((Facs->FirmwareWakingVector == 0) && (Facs->XFirmwareWakingVector == 
0)) ) {
-    CpuDeadLoop();
-    return EFI_INVALID_PARAMETER;
-  }
-
   //
   // We need turn back to S3Resume - install boot script done ppi and report 
status code on S3resume.
   //
@@ -97,12 +93,16 @@
       DEBUG ((EFI_D_ERROR, "Call AsmDisablePaging64() to return to S3 Resume 
in PEI Phase\n"));
       PeiS3ResumeState->AsmTransferControl = 
(EFI_PHYSICAL_ADDRESS)(UINTN)AsmTransferControl32;
 
-      //
-      // more step needed - because relative address is handled differently 
between X64 and IA32.
-      //
-      AsmTransferControl16Address = (UINTN)AsmTransferControl16;
-      AsmFixAddress16 = (UINT32)AsmTransferControl16Address;
-      AsmJmpAddr32 = (UINT32)((Facs->FirmwareWakingVector & 0xF) | 
((Facs->FirmwareWakingVector & 0xFFFF0) << 12));
+      if ((Facs != NULL) &&
+          (Facs->Signature == 
EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) &&
+          (Facs->FirmwareWakingVector != 0) ) {
+        //
+        // more step needed - because relative address is handled differently 
between X64 and IA32.
+        //
+        AsmTransferControl16Address = (UINTN)AsmTransferControl16;
+        AsmFixAddress16 = (UINT32)AsmTransferControl16Address;
+        AsmJmpAddr32 = (UINT32)((Facs->FirmwareWakingVector & 0xF) | 
((Facs->FirmwareWakingVector & 0xFFFF0) << 12));
+      }
 
       AsmDisablePaging64 (
         PeiS3ResumeState->ReturnCs,
@@ -132,7 +132,10 @@
     CpuDeadLoop();
     return EFI_UNSUPPORTED;
   }
-
+  
+  //
+  // S3ResumePeim does not provide a way to jump back to itself, so resume to 
OS here directly
+  //
   if (Facs->XFirmwareWakingVector != 0) {
     //
     // Switch to native waking vector

Modified: trunk/edk2/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c
===================================================================
--- trunk/edk2/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c       
2012-10-30 04:19:03 UTC (rev 13889)
+++ trunk/edk2/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c       
2012-10-30 04:23:40 UTC (rev 13890)
@@ -104,6 +104,11 @@
   EFI_STATUS    Status;
   UINTN         Size;
   UINTN         CapsuleDataPtr;
+  
+  //
+  // Indicate reset system runtime service is called.
+  //
+  REPORT_STATUS_CODE (EFI_PROGRESS_CODE, (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | 
EFI_SW_RS_PC_RESET_SYSTEM));
 
   switch (ResetType) {
   case EfiResetWarm:

Modified: trunk/edk2/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.h
===================================================================
--- trunk/edk2/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.h       
2012-10-30 04:19:03 UTC (rev 13889)
+++ trunk/edk2/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.h       
2012-10-30 04:23:40 UTC (rev 13890)
@@ -30,6 +30,7 @@
 #include <Library/UefiRuntimeLib.h>
 #include <Library/UefiRuntimeServicesTableLib.h>
 #include <Library/ResetSystemLib.h>
+#include <Library/ReportStatusCodeLib.h>
 
 /**
   The driver's entry point.

Modified: 
trunk/edk2/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
===================================================================
--- 
trunk/edk2/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
   2012-10-30 04:19:03 UTC (rev 13889)
+++ 
trunk/edk2/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
   2012-10-30 04:23:40 UTC (rev 13890)
@@ -3,7 +3,7 @@
 #
 # This driver implements Reset Architectural Protocol.
 #
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 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
@@ -48,6 +48,7 @@
   UefiLib
   DebugLib
   BaseLib
+  ReportStatusCodeLib
 
 
 [Guids]

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
edk2-commits mailing list
edk2-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to