From cb33842e8a21547d6f695aec0cf3173ddd6a13cc Mon Sep 17 00:00:00 2001
From: lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Date: Tue, 16 Oct 2007 09:58:55 +0000
Subject: [PATCH] Add back the trick logic on EFI_PCI_DEVICE_ENABLE in PciBus
 driver so that some old vendor drivers can still work well.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4131 6f19259b-4bc3-4df7-8a09-765794883524
---
 .../Bus/Pci/IdeBusDxe/ata.c                   |  4 ++-
 .../Bus/Pci/PciBusDxe/PciHotPlugSupport.c     |  3 ---
 .../Bus/Pci/PciBusDxe/PciIo.c                 | 25 ++++++++++---------
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/ata.c b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/ata.c
index 3a7271ec47..a315953e3c 100644
--- a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/ata.c
+++ b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/ata.c
@@ -191,6 +191,8 @@ ATAIdentify (
   the capacity is below 120G, 48bit addressing is not needed
 
   @retval  EFI_DEVICE_ERROR The identify data in IdeDev is incorrect
+  
+  @retval  EFI_INVALID_PARAMETER The identify data in IdeDev is NULL.
 
   @note
   This function must be called after DEVICE_IDENTITY command has been
@@ -208,7 +210,7 @@ AtaAtapi6Identify (
   EFI_IDENTIFY_DATA *Atapi6IdentifyStruct;
 
   if (IdeDev->pIdData == NULL) {
-    return EFI_UNSUPPORTED;
+    return EFI_INVALID_PARAMETER;
   }
 
   Atapi6IdentifyStruct = IdeDev->pIdData;
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciHotPlugSupport.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciHotPlugSupport.c
index 8593c52689..6128542111 100644
--- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciHotPlugSupport.c
+++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciHotPlugSupport.c
@@ -275,9 +275,6 @@ Returns:
   EFI_TIMEOUT - Time out
 
 --*/
-// TODO:    TimeoutInMilliSeconds - add argument and description to function comment
-// TODO:    EFI_SUCCESS - add return value to function comment
-// TODO:    EFI_TIMEOUT - add return value to function comment
 {
   UINT32  Delay;
   UINTN   Index;
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciIo.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciIo.c
index 63ab8e551a..765cf4c87a 100644
--- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciIo.c
+++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciIo.c
@@ -1464,19 +1464,20 @@ Returns:
   // Just a trick for ENABLE attribute
   // EFI_PCI_DEVICE_ENABLE is not defined in UEFI spec, which is the internal usage.
   // So, this logic doesn't confrom to UEFI spec, which should be removed.
+  // But this trick logic is still kept for some binary drivers that depend on it.
   //
-  //  if ((Attributes & EFI_PCI_DEVICE_ENABLE) == EFI_PCI_DEVICE_ENABLE) {
-  //    Attributes &= (PciIoDevice->Supports);
-  //
-  //    //
-  //    // Raise the EFI_P_PC_ENABLE Status code
-  //    //
-  //    REPORT_STATUS_CODE_WITH_DEVICE_PATH (
-  //      EFI_PROGRESS_CODE,
-  //      EFI_IO_BUS_PCI | EFI_P_PC_ENABLE,
-  //      PciIoDevice->DevicePath
-  //      );
-  //  }
+  if ((Attributes & EFI_PCI_DEVICE_ENABLE) == EFI_PCI_DEVICE_ENABLE) {
+    Attributes &= (PciIoDevice->Supports);
+
+    //
+    // Raise the EFI_P_PC_ENABLE Status code
+    //
+    REPORT_STATUS_CODE_WITH_DEVICE_PATH (
+      EFI_PROGRESS_CODE,
+      EFI_IO_BUS_PCI | EFI_P_PC_ENABLE,
+      PciIoDevice->DevicePath
+      );
+  }
 
   //
   // If no attributes can be supported, then return.