public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/2] MdeModulePkg/PciBus: Do not enable MemWriteAndInvalidate bit for PCIE
@ 2018-05-25 10:02 Ruiyu Ni
  2018-05-25 10:02 ` [PATCH 1/2] MdeModulePkg/PciBus: Remove unnecessary PCIE detection Ruiyu Ni
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ruiyu Ni @ 2018-05-25 10:02 UTC (permalink / raw)
  To: edk2-devel

Per PCIE spec, Memory Write and Invalidate is hardwired to 0b so
PciBus driver shouldn't write 1b to it.
Patch #1 cleans up some unnecessary code.

Ruiyu Ni (2):
  MdeModulePkg/PciBus: Remove unnecessary PCIE detection
  MdeModulePkg/PciBus: Do not enable MemWriteAndInvalidate bit for PCIE

 MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c     | 17 +----------------
 MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 10 ++++++----
 2 files changed, 7 insertions(+), 20 deletions(-)

-- 
2.16.1.windows.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] MdeModulePkg/PciBus: Remove unnecessary PCIE detection
  2018-05-25 10:02 [PATCH 0/2] MdeModulePkg/PciBus: Do not enable MemWriteAndInvalidate bit for PCIE Ruiyu Ni
@ 2018-05-25 10:02 ` Ruiyu Ni
  2018-05-25 10:02 ` [PATCH 2/2] MdeModulePkg/PciBus: Do not enable MemWriteAndInvalidate bit for PCIE Ruiyu Ni
  2018-05-28  4:47 ` 答复: [PATCH 0/2] " Zeng, Star
  2 siblings, 0 replies; 5+ messages in thread
From: Ruiyu Ni @ 2018-05-25 10:02 UTC (permalink / raw)
  To: edk2-devel; +Cc: Star Zeng, Hao A Wu

CreatePciIoDevice() detects whether the PCI device is a PCI Express
device and remembers the device type in PciIoDevice->IsPciExp.

RegisterPciDevice() detects the device type again which is
unnecessary. The detection logic can be removed.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
index e76c8f0046..f69fe938da 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 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2018, 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
@@ -211,7 +211,6 @@ RegisterPciDevice (
   EFI_STATUS          Status;
   VOID                *PlatformOpRomBuffer;
   UINTN               PlatformOpRomSize;
-  UINT8               PciExpressCapRegOffset;
   EFI_PCI_IO_PROTOCOL *PciIo;
   UINT8               Data8;
   BOOLEAN             HasEfiImage;
@@ -231,20 +230,6 @@ RegisterPciDevice (
     return Status;
   }
 
-  //
-  // Detect if PCI Express Device
-  //
-  PciExpressCapRegOffset = 0;
-  Status = LocateCapabilityRegBlock (
-             PciIoDevice,
-             EFI_PCI_CAPABILITY_ID_PCIEXP,
-             &PciExpressCapRegOffset,
-             NULL
-             );
-  if (!EFI_ERROR (Status)) {
-    PciIoDevice->IsPciExp = TRUE;
-  }
-
   //
   // Force Interrupt line to "Unknown" or "No Connection"
   //
-- 
2.16.1.windows.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] MdeModulePkg/PciBus: Do not enable MemWriteAndInvalidate bit for PCIE
  2018-05-25 10:02 [PATCH 0/2] MdeModulePkg/PciBus: Do not enable MemWriteAndInvalidate bit for PCIE Ruiyu Ni
  2018-05-25 10:02 ` [PATCH 1/2] MdeModulePkg/PciBus: Remove unnecessary PCIE detection Ruiyu Ni
@ 2018-05-25 10:02 ` Ruiyu Ni
  2018-05-28  2:33   ` Chiu, Chasel
  2018-05-28  4:47 ` 答复: [PATCH 0/2] " Zeng, Star
  2 siblings, 1 reply; 5+ messages in thread
From: Ruiyu Ni @ 2018-05-25 10:02 UTC (permalink / raw)
  To: edk2-devel; +Cc: Star Zeng, Chasel Chiu

Per PCIE spec, Memory Write and Invalidate is hardwired to 0b so
PciBus driver shouldn't write 1b to it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
index 81171c82d9..6f3d1bebc6 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
@@ -1,7 +1,7 @@
 /** @file
   PCI emumeration support functions implementation for PCI Bus module.
 
-Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
 (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
@@ -1254,9 +1254,11 @@ DetermineDeviceAttribute (
     PciSetDeviceAttribute (PciIoDevice, OldCommand, OldBridgeControl, EFI_SET_ATTRIBUTES);
 
     //
-    // Enable other supported attributes but not defined in PCI_IO_PROTOCOL
-    //
-    PCI_ENABLE_COMMAND_REGISTER (PciIoDevice, EFI_PCI_COMMAND_MEMORY_WRITE_AND_INVALIDATE);
+    // Enable other PCI supported attributes but not defined in PCI_IO_PROTOCOL
+    // For PCI Express devices, Memory Write and Invalidate is hardwired to 0b so only enable it for PCI devices.
+    if (!PciIoDevice->IsPciExp) {
+      PCI_ENABLE_COMMAND_REGISTER (PciIoDevice, EFI_PCI_COMMAND_MEMORY_WRITE_AND_INVALIDATE);
+    }
   }
 
   FastB2BSupport = TRUE;
-- 
2.16.1.windows.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] MdeModulePkg/PciBus: Do not enable MemWriteAndInvalidate bit for PCIE
  2018-05-25 10:02 ` [PATCH 2/2] MdeModulePkg/PciBus: Do not enable MemWriteAndInvalidate bit for PCIE Ruiyu Ni
@ 2018-05-28  2:33   ` Chiu, Chasel
  0 siblings, 0 replies; 5+ messages in thread
From: Chiu, Chasel @ 2018-05-28  2:33 UTC (permalink / raw)
  To: Ni, Ruiyu, edk2-devel@lists.01.org; +Cc: Zeng, Star


Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>


-----Original Message-----
From: Ni, Ruiyu 
Sent: Friday, May 25, 2018 6:03 PM
To: edk2-devel@lists.01.org
Cc: Zeng, Star <star.zeng@intel.com>; Chiu, Chasel <chasel.chiu@intel.com>
Subject: [PATCH 2/2] MdeModulePkg/PciBus: Do not enable MemWriteAndInvalidate bit for PCIE

Per PCIE spec, Memory Write and Invalidate is hardwired to 0b so PciBus driver shouldn't write 1b to it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
index 81171c82d9..6f3d1bebc6 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
@@ -1,7 +1,7 @@
 /** @file
   PCI emumeration support functions implementation for PCI Bus module.
 
-Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
 (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>  This program and the accompanying materials  are licensed and made available under the terms and conditions of the BSD License @@ -1254,9 +1254,11 @@ DetermineDeviceAttribute (
     PciSetDeviceAttribute (PciIoDevice, OldCommand, OldBridgeControl, EFI_SET_ATTRIBUTES);
 
     //
-    // Enable other supported attributes but not defined in PCI_IO_PROTOCOL
-    //
-    PCI_ENABLE_COMMAND_REGISTER (PciIoDevice, EFI_PCI_COMMAND_MEMORY_WRITE_AND_INVALIDATE);
+    // Enable other PCI supported attributes but not defined in PCI_IO_PROTOCOL
+    // For PCI Express devices, Memory Write and Invalidate is hardwired to 0b so only enable it for PCI devices.
+    if (!PciIoDevice->IsPciExp) {
+      PCI_ENABLE_COMMAND_REGISTER (PciIoDevice, EFI_PCI_COMMAND_MEMORY_WRITE_AND_INVALIDATE);
+    }
   }
 
   FastB2BSupport = TRUE;
--
2.16.1.windows.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* 答复: [PATCH 0/2] MdeModulePkg/PciBus: Do not enable MemWriteAndInvalidate bit for PCIE
  2018-05-25 10:02 [PATCH 0/2] MdeModulePkg/PciBus: Do not enable MemWriteAndInvalidate bit for PCIE Ruiyu Ni
  2018-05-25 10:02 ` [PATCH 1/2] MdeModulePkg/PciBus: Remove unnecessary PCIE detection Ruiyu Ni
  2018-05-25 10:02 ` [PATCH 2/2] MdeModulePkg/PciBus: Do not enable MemWriteAndInvalidate bit for PCIE Ruiyu Ni
@ 2018-05-28  4:47 ` Zeng, Star
  2 siblings, 0 replies; 5+ messages in thread
From: Zeng, Star @ 2018-05-28  4:47 UTC (permalink / raw)
  To: Ni, Ruiyu, edk2-devel@lists.01.org; +Cc: Zeng, Star

Reviewed-by: Star Zeng star.zeng@intel.com

________________________________________
发件人: edk2-devel [edk2-devel-bounces@lists.01.org] 代表 Ruiyu Ni [ruiyu.ni@intel.com]
发送时间: 2018年5月25日 4:02
收件人: edk2-devel@lists.01.org
主题: [edk2] [PATCH 0/2] MdeModulePkg/PciBus: Do not enable MemWriteAndInvalidate bit for PCIE

Per PCIE spec, Memory Write and Invalidate is hardwired to 0b so
PciBus driver shouldn't write 1b to it.
Patch #1 cleans up some unnecessary code.

Ruiyu Ni (2):
  MdeModulePkg/PciBus: Remove unnecessary PCIE detection
  MdeModulePkg/PciBus: Do not enable MemWriteAndInvalidate bit for PCIE

 MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c     | 17 +----------------
 MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 10 ++++++----
 2 files changed, 7 insertions(+), 20 deletions(-)

--
2.16.1.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-05-28  4:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-25 10:02 [PATCH 0/2] MdeModulePkg/PciBus: Do not enable MemWriteAndInvalidate bit for PCIE Ruiyu Ni
2018-05-25 10:02 ` [PATCH 1/2] MdeModulePkg/PciBus: Remove unnecessary PCIE detection Ruiyu Ni
2018-05-25 10:02 ` [PATCH 2/2] MdeModulePkg/PciBus: Do not enable MemWriteAndInvalidate bit for PCIE Ruiyu Ni
2018-05-28  2:33   ` Chiu, Chasel
2018-05-28  4:47 ` 答复: [PATCH 0/2] " Zeng, Star

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox