* [PATCH 0/2] MdeModulePkg/PciBusDxe: Revert the patch to disable BME @ 2017-11-20 3:05 Ruiyu Ni 2017-11-20 3:05 ` [PATCH 1/2] MdeModulePkg/PciBus: Revert "disable all BME when entering RT" Ruiyu Ni 2017-11-20 3:05 ` [PATCH 2/2] MdeModulePkg/PciBus: Revert "Enable BM on P2P bridges on demand" Ruiyu Ni 0 siblings, 2 replies; 6+ messages in thread From: Ruiyu Ni @ 2017-11-20 3:05 UTC (permalink / raw) To: edk2-devel We met some compatibility issues when doing Windows S4 resume. Reverting the BME disabling patches to fix the S4 resume issue. Ruiyu Ni (2): MdeModulePkg/PciBus: Revert "disable all BME when entering RT" MdeModulePkg/PciBus: Revert "Enable BM on P2P bridges on demand" MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h | 2 - MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf | 3 - MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c | 102 +-------------------- .../Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 18 +--- MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c | 8 +- 5 files changed, 10 insertions(+), 123 deletions(-) -- 2.15.0.gvfs.1.preview.4 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] MdeModulePkg/PciBus: Revert "disable all BME when entering RT" 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 2017-11-22 8:15 ` Yao, Jiewen 2017-11-20 3:05 ` [PATCH 2/2] MdeModulePkg/PciBus: Revert "Enable BM on P2P bridges on demand" Ruiyu Ni 1 sibling, 1 reply; 6+ messages in thread From: Ruiyu Ni @ 2017-11-20 3:05 UTC (permalink / raw) To: edk2-devel; +Cc: Ruiyu Ni, Michael Turner, Michael D Kinney, Jiewen Yao 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 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] MdeModulePkg/PciBus: Revert "disable all BME when entering RT" 2017-11-20 3:05 ` [PATCH 1/2] MdeModulePkg/PciBus: Revert "disable all BME when entering RT" Ruiyu Ni @ 2017-11-22 8:15 ` Yao, Jiewen 2017-11-22 8:24 ` Yao, Jiewen 0 siblings, 1 reply; 6+ messages in thread From: Yao, Jiewen @ 2017-11-22 8:15 UTC (permalink / raw) To: Ni, Ruiyu, edk2-devel@lists.01.org; +Cc: Michael Turner, Kinney, Michael D Reviewed-by: Jiewen.yao@intel.com > -----Original Message----- > From: Ni, Ruiyu > Sent: Monday, November 20, 2017 11:06 AM > To: edk2-devel@lists.01.org > Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Michael Turner > <michael.turner@microsoft.com>; Kinney, Michael D > <michael.d.kinney@intel.com>; Yao, Jiewen <jiewen.yao@intel.com> > Subject: [PATCH 1/2] MdeModulePkg/PciBus: Revert "disable all BME when > entering RT" > > 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] MdeModulePkg/PciBus: Revert "disable all BME when entering RT" 2017-11-22 8:15 ` Yao, Jiewen @ 2017-11-22 8:24 ` Yao, Jiewen 0 siblings, 0 replies; 6+ messages in thread From: Yao, Jiewen @ 2017-11-22 8:24 UTC (permalink / raw) To: Yao, Jiewen, Ni, Ruiyu, edk2-devel@lists.01.org Cc: Kinney, Michael D, Michael Turner BTW: I notice that we have exit boot service callback in ATA bus driver, which may also clear some command register. I think we need validate that too. Thank you Yao Jiewen > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Yao, > Jiewen > Sent: Wednesday, November 22, 2017 4:15 PM > To: Ni, Ruiyu <ruiyu.ni@intel.com>; edk2-devel@lists.01.org > Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Michael Turner > <michael.turner@microsoft.com> > Subject: Re: [edk2] [PATCH 1/2] MdeModulePkg/PciBus: Revert "disable all BME > when entering RT" > > Reviewed-by: Jiewen.yao@intel.com > > > -----Original Message----- > > From: Ni, Ruiyu > > Sent: Monday, November 20, 2017 11:06 AM > > To: edk2-devel@lists.01.org > > Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Michael Turner > > <michael.turner@microsoft.com>; Kinney, Michael D > > <michael.d.kinney@intel.com>; Yao, Jiewen <jiewen.yao@intel.com> > > Subject: [PATCH 1/2] MdeModulePkg/PciBus: Revert "disable all BME when > > entering RT" > > > > 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 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] MdeModulePkg/PciBus: Revert "Enable BM on P2P bridges on demand" 2017-11-20 3:05 [PATCH 0/2] MdeModulePkg/PciBusDxe: Revert the patch to disable BME Ruiyu Ni 2017-11-20 3:05 ` [PATCH 1/2] MdeModulePkg/PciBus: Revert "disable all BME when entering RT" Ruiyu Ni @ 2017-11-20 3:05 ` Ruiyu Ni 2017-11-22 8:15 ` Yao, Jiewen 1 sibling, 1 reply; 6+ messages in thread From: Ruiyu Ni @ 2017-11-20 3:05 UTC (permalink / raw) To: edk2-devel; +Cc: Ruiyu Ni, Michael Turner, Michael D Kinney, Jiewen Yao This reverts commit 5db417ed2522367290c365831f9d6628d31c346c. "MdeModulePkg/PciBusDxe: Enable Bus Master on P2P bridges on demand" 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/PciDeviceSupport.c | 16 +++------------- MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 18 +++--------------- MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c | 8 ++++---- 3 files changed, 10 insertions(+), 32 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c index 97bb971a59..e76c8f0046 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c @@ -1,7 +1,7 @@ /** @file Supporting functions implementaion for PCI devices management. -Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2006 - 2015, 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 @@ -711,12 +711,7 @@ StartPciDevicesOnBridge ( 0, &Supports ); - // - // By default every bridge's IO and MMIO spaces are enabled. - // Bridge's Bus Master will be enabled when any device behind it requests - // to enable Bus Master. - // - Supports &= (UINT64) (EFI_PCI_IO_ATTRIBUTE_IO | EFI_PCI_IO_ATTRIBUTE_MEMORY); + Supports &= (UINT64)EFI_PCI_DEVICE_ENABLE; PciIoDevice->PciIo.Attributes ( &(PciIoDevice->PciIo), EfiPciIoAttributeOperationEnable, @@ -768,12 +763,7 @@ StartPciDevicesOnBridge ( 0, &Supports ); - // - // By default every bridge's IO and MMIO spaces are enabled. - // Bridge's Bus Master will be enabled when any device behind it requests - // to enable Bus Master. - // - Supports &= (UINT64) (EFI_PCI_IO_ATTRIBUTE_IO | EFI_PCI_IO_ATTRIBUTE_MEMORY); + Supports &= (UINT64)EFI_PCI_DEVICE_ENABLE; PciIoDevice->PciIo.Attributes ( &(PciIoDevice->PciIo), EfiPciIoAttributeOperationEnable, diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c index f73756a31e..81171c82d9 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c @@ -1218,12 +1218,11 @@ DetermineDeviceAttribute ( return Status; } // - // Assume the PCI Root Bridge supports DAC and Bus Master. + // Assume the PCI Root Bridge supports DAC // PciIoDevice->Supports |= (UINT64)(EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE | EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM | - EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE | - EFI_PCI_IO_ATTRIBUTE_BUS_MASTER); + EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE); } else { @@ -1234,16 +1233,9 @@ DetermineDeviceAttribute ( // Command = EFI_PCI_COMMAND_IO_SPACE | EFI_PCI_COMMAND_MEMORY_SPACE | + EFI_PCI_COMMAND_BUS_MASTER | EFI_PCI_COMMAND_VGA_PALETTE_SNOOP; - // - // Per PCI-to-PCI Bridge Architecture all PCI-to-PCI bridges are Bus Master capable. - // So only test the Bus Master capability for PCI devices. - // - if (!IS_PCI_BRIDGE(&PciIoDevice->Pci)) { - Command |= EFI_PCI_COMMAND_BUS_MASTER; - } - BridgeControl = EFI_PCI_BRIDGE_CONTROL_ISA | EFI_PCI_BRIDGE_CONTROL_VGA | EFI_PCI_BRIDGE_CONTROL_VGA_16; // @@ -1253,11 +1245,7 @@ DetermineDeviceAttribute ( // // Set the supported attributes for specified PCI device - // Per PCI-to-PCI Bridge Architecture all PCI-to-PCI bridges are Bus Master capable. // - if (IS_PCI_BRIDGE(&PciIoDevice->Pci)) { - Command |= EFI_PCI_COMMAND_BUS_MASTER; - } PciSetDeviceAttribute (PciIoDevice, Command, BridgeControl, EFI_SET_SUPPORTS); // diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c index 659f480d71..cc7125e4fc 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c @@ -1348,8 +1348,7 @@ ModifyRootBridgeAttributes ( // Attributes &= ~(UINT64)(EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE | EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM | - EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE | - EFI_PCI_IO_ATTRIBUTE_BUS_MASTER); + EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE); // // Record the new attribute of the Root Bridge @@ -1727,11 +1726,12 @@ PciIoAttributes ( } // // The upstream bridge should be also set to revelant attribute - // expect for IO and Mem + // expect for IO, Mem and BusMaster // UpStreamAttributes = Attributes & (~(EFI_PCI_IO_ATTRIBUTE_IO | - EFI_PCI_IO_ATTRIBUTE_MEMORY + EFI_PCI_IO_ATTRIBUTE_MEMORY | + EFI_PCI_IO_ATTRIBUTE_BUS_MASTER ) ); UpStreamBridge = PciIoDevice->Parent; -- 2.15.0.gvfs.1.preview.4 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] MdeModulePkg/PciBus: Revert "Enable BM on P2P bridges on demand" 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 0 siblings, 0 replies; 6+ messages in thread From: Yao, Jiewen @ 2017-11-22 8:15 UTC (permalink / raw) To: Ni, Ruiyu, edk2-devel@lists.01.org; +Cc: Michael Turner, Kinney, Michael D Reviewed-by: Jiewen.yao@intel.com > -----Original Message----- > From: Ni, Ruiyu > Sent: Monday, November 20, 2017 11:06 AM > To: edk2-devel@lists.01.org > Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Michael Turner > <michael.turner@microsoft.com>; Kinney, Michael D > <michael.d.kinney@intel.com>; Yao, Jiewen <jiewen.yao@intel.com> > Subject: [PATCH 2/2] MdeModulePkg/PciBus: Revert "Enable BM on P2P bridges > on demand" > > This reverts commit 5db417ed2522367290c365831f9d6628d31c346c. > "MdeModulePkg/PciBusDxe: Enable Bus Master on P2P bridges on demand" > > 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/PciDeviceSupport.c | 16 > +++------------- > MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 18 > +++--------------- > MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c | 8 ++++---- > 3 files changed, 10 insertions(+), 32 deletions(-) > > diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c > b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c > index 97bb971a59..e76c8f0046 100644 > --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c > +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c > @@ -1,7 +1,7 @@ > /** @file > Supporting functions implementaion for PCI devices management. > > -Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR> > +Copyright (c) 2006 - 2015, 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 > @@ -711,12 +711,7 @@ StartPciDevicesOnBridge ( > 0, > &Supports > ); > - // > - // By default every bridge's IO and MMIO spaces are enabled. > - // Bridge's Bus Master will be enabled when any device behind it > requests > - // to enable Bus Master. > - // > - Supports &= (UINT64) (EFI_PCI_IO_ATTRIBUTE_IO | > EFI_PCI_IO_ATTRIBUTE_MEMORY); > + Supports &= (UINT64)EFI_PCI_DEVICE_ENABLE; > PciIoDevice->PciIo.Attributes ( > &(PciIoDevice->PciIo), > EfiPciIoAttributeOperationEnable, > @@ -768,12 +763,7 @@ StartPciDevicesOnBridge ( > 0, > &Supports > ); > - // > - // By default every bridge's IO and MMIO spaces are enabled. > - // Bridge's Bus Master will be enabled when any device behind it > requests > - // to enable Bus Master. > - // > - Supports &= (UINT64) (EFI_PCI_IO_ATTRIBUTE_IO | > EFI_PCI_IO_ATTRIBUTE_MEMORY); > + Supports &= (UINT64)EFI_PCI_DEVICE_ENABLE; > PciIoDevice->PciIo.Attributes ( > &(PciIoDevice->PciIo), > EfiPciIoAttributeOperationEnable, > diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c > b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c > index f73756a31e..81171c82d9 100644 > --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c > +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c > @@ -1218,12 +1218,11 @@ DetermineDeviceAttribute ( > return Status; > } > // > - // Assume the PCI Root Bridge supports DAC and Bus Master. > + // Assume the PCI Root Bridge supports DAC > // > PciIoDevice->Supports |= > (UINT64)(EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE | > EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM | > - > EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE | > - EFI_PCI_IO_ATTRIBUTE_BUS_MASTER); > + > EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE); > > } else { > > @@ -1234,16 +1233,9 @@ DetermineDeviceAttribute ( > // > Command = EFI_PCI_COMMAND_IO_SPACE | > EFI_PCI_COMMAND_MEMORY_SPACE | > + EFI_PCI_COMMAND_BUS_MASTER | > EFI_PCI_COMMAND_VGA_PALETTE_SNOOP; > > - // > - // Per PCI-to-PCI Bridge Architecture all PCI-to-PCI bridges are Bus Master > capable. > - // So only test the Bus Master capability for PCI devices. > - // > - if (!IS_PCI_BRIDGE(&PciIoDevice->Pci)) { > - Command |= EFI_PCI_COMMAND_BUS_MASTER; > - } > - > BridgeControl = EFI_PCI_BRIDGE_CONTROL_ISA | > EFI_PCI_BRIDGE_CONTROL_VGA | EFI_PCI_BRIDGE_CONTROL_VGA_16; > > // > @@ -1253,11 +1245,7 @@ DetermineDeviceAttribute ( > > // > // Set the supported attributes for specified PCI device > - // Per PCI-to-PCI Bridge Architecture all PCI-to-PCI bridges are Bus Master > capable. > // > - if (IS_PCI_BRIDGE(&PciIoDevice->Pci)) { > - Command |= EFI_PCI_COMMAND_BUS_MASTER; > - } > PciSetDeviceAttribute (PciIoDevice, Command, BridgeControl, > EFI_SET_SUPPORTS); > > // > diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c > b/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c > index 659f480d71..cc7125e4fc 100644 > --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c > +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c > @@ -1348,8 +1348,7 @@ ModifyRootBridgeAttributes ( > // > Attributes &= ~(UINT64)(EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE | > EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM | > - EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE | > - EFI_PCI_IO_ATTRIBUTE_BUS_MASTER); > + EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE); > > // > // Record the new attribute of the Root Bridge > @@ -1727,11 +1726,12 @@ PciIoAttributes ( > } > // > // The upstream bridge should be also set to revelant attribute > - // expect for IO and Mem > + // expect for IO, Mem and BusMaster > // > UpStreamAttributes = Attributes & > (~(EFI_PCI_IO_ATTRIBUTE_IO | > - EFI_PCI_IO_ATTRIBUTE_MEMORY > + EFI_PCI_IO_ATTRIBUTE_MEMORY | > + EFI_PCI_IO_ATTRIBUTE_BUS_MASTER > ) > ); > UpStreamBridge = PciIoDevice->Parent; > -- > 2.15.0.gvfs.1.preview.4 ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-11-22 8:19 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-11-20 3:05 [PATCH 0/2] MdeModulePkg/PciBusDxe: Revert the patch to disable BME Ruiyu Ni 2017-11-20 3:05 ` [PATCH 1/2] MdeModulePkg/PciBus: Revert "disable all BME when entering RT" Ruiyu Ni 2017-11-22 8:15 ` 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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox