public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ruiyu Ni <ruiyu.ni@intel.com>
To: edk2-devel@lists.01.org
Cc: Ruiyu Ni <Ruiyu.ni@intel.com>,
	Michael Turner <michael.turner@microsoft.com>,
	Michael D Kinney <Michael.d.kinney@intel.com>,
	Jiewen Yao <jiewen.yao@intel.com>
Subject: [PATCH 1/2] MdeModulePkg/PciBus: Revert "disable all BME when entering RT"
Date: Mon, 20 Nov 2017 11:05:31 +0800	[thread overview]
Message-ID: <20171120030532.7548-2-ruiyu.ni@intel.com> (raw)
In-Reply-To: <20171120030532.7548-1-ruiyu.ni@intel.com>

This reverts commit 050763db0730a0bb46235cec87e3716632dc532c.
  "MdeModulePkg/PciBus: Disable BME of all devices when entering RT"

We met some compatibility issues when doing Windows S4 resume.
Reverting the BME disabling patches to fix the S4 resume issue.

Signed-off-by: Ruiyu Ni <Ruiyu.ni@intel.com>
Signed-off-by: Michael Turner <michael.turner@microsoft.com>
Cc: Michael D Kinney <Michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h           |  2 -
 MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf      |  3 -
 MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c | 86 -----------------------
 3 files changed, 91 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h b/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h
index 79b5b71082..55eb3a5a80 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h
@@ -18,8 +18,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 #include <PiDxe.h>
 
-#include <Guid/EventGroup.h>
-
 #include <Protocol/LoadedImage.h>
 #include <Protocol/PciHostBridgeResourceAllocation.h>
 #include <Protocol/PciIo.h>
diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf b/MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
index d5b8fab3ca..97608bfcf2 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
@@ -80,9 +80,6 @@ [LibraryClasses]
   DebugLib
   PeCoffLib
 
-[Guids]
-  gEfiEventExitBootServicesGuid                   ## SOMETIMES_CONSUMES ## Event
-
 [Protocols]
   gEfiPciHotPlugRequestProtocolGuid               ## SOMETIMES_PRODUCES
   gEfiPciIoProtocolGuid                           ## BY_START
diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
index 004f2a3b5b..97bb971a59 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
@@ -20,72 +20,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 //
 LIST_ENTRY  mPciDevicePool;
 
-/**
- Disable Bus Master Enable bit in all devices in the list.
-
- @param Devices  A device list.
-**/
-VOID
-DisableBmeOnTree (
-  IN LIST_ENTRY      *Devices
-  )
-{
-  LIST_ENTRY      *Link;
-  PCI_IO_DEVICE   *PciIoDevice;
-  UINT16           Command;
-
-  for ( Link = GetFirstNode (Devices)
-      ; !IsNull (Devices, Link)
-      ; Link = GetNextNode (Devices, Link)
-      ) {
-    PciIoDevice = PCI_IO_DEVICE_FROM_LINK (Link);
-    //
-    // Turn off all children's Bus Master, if any
-    //
-    DisableBmeOnTree (&PciIoDevice->ChildList);
-
-    //
-    // If this is a device that supports BME, disable BME on this device.
-    //
-    if ((PciIoDevice->Supports & EFI_PCI_IO_ATTRIBUTE_BUS_MASTER) != 0) {
-      PCI_READ_COMMAND_REGISTER(PciIoDevice, &Command);
-      if ((Command & EFI_PCI_COMMAND_BUS_MASTER) != 0) {
-        Command &= ~EFI_PCI_COMMAND_BUS_MASTER;
-        PCI_SET_COMMAND_REGISTER (PciIoDevice, Command);
-        DEBUG ((
-          DEBUG_INFO,"  %02x   %02x      %02x         %04x\n",
-          PciIoDevice->BusNumber, PciIoDevice->DeviceNumber, PciIoDevice->FunctionNumber,
-          Command
-          ));
-      }
-    }
-  }
-}
-
-/**
-  Exit Boot Services Event notification handler.
-
-  Disable Bus Master on any that were enabled during BDS.
-
-  @param[in]  Event     Event whose notification function is being invoked.
-  @param[in]  Context   Pointer to the notification function's context.
-
-**/
-VOID
-EFIAPI
-OnExitBootServices (
-  IN      EFI_EVENT                 Event,
-  IN      VOID                      *Context
-  )
-{
-  DEBUG ((
-    DEBUG_INFO,
-    "PciBus: Disable Bus Master of all devices...\n"
-    "  Bus# Device# Function#  NewCommand\n"
-    ));
-  DisableBmeOnTree(&mPciDevicePool);
-}
-
 /**
   Initialize the PCI devices pool.
 
@@ -95,27 +29,7 @@ InitializePciDevicePool (
   VOID
   )
 {
-  EFI_EVENT   ExitBootServicesEvent;
-  EFI_STATUS  Status;
-
   InitializeListHead (&mPciDevicePool);
-
-  //
-  // DisableBME on ExitBootServices should be synchonized with any IOMMU ExitBootServices routine.
-  // DisableBME should be run before the IOMMU protections are disabled.
-  // One way to do this is to ensure that the IOMMU ExitBootServices callback runs at TPL_CALLBACK.
-  //
-  Status = gBS->CreateEventEx (
-                  EVT_NOTIFY_SIGNAL,
-                  TPL_NOTIFY,
-                  OnExitBootServices,
-                  NULL,
-                  &gEfiEventExitBootServicesGuid,
-                  &ExitBootServicesEvent
-                  );
-  if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "PciBus: Unable to hook ExitBootServices event - %r\n", Status));
-  }
 }
 
 /**
-- 
2.15.0.gvfs.1.preview.4



  reply	other threads:[~2017-11-20  3:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-20  3:05 [PATCH 0/2] MdeModulePkg/PciBusDxe: Revert the patch to disable BME Ruiyu Ni
2017-11-20  3:05 ` Ruiyu Ni [this message]
2017-11-22  8:15   ` [PATCH 1/2] MdeModulePkg/PciBus: Revert "disable all BME when entering RT" Yao, Jiewen
2017-11-22  8:24     ` Yao, Jiewen
2017-11-20  3:05 ` [PATCH 2/2] MdeModulePkg/PciBus: Revert "Enable BM on P2P bridges on demand" Ruiyu Ni
2017-11-22  8:15   ` Yao, Jiewen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171120030532.7548-2-ruiyu.ni@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox