]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdePkg/PciExpress: Add macro PCI_ECAM_ADDRESS
authorRuiyu Ni <ruiyu.ni@intel.com>
Fri, 4 Aug 2017 05:02:14 +0000 (13:02 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Mon, 28 Aug 2017 08:47:03 +0000 (16:47 +0800)
The patch adds new macro PCI_ECAM_ADDRESS into PciExpress21.h,
to align to the PCIE spec, and also update PciExpressLib.h to
redirect PCI_EXPRESS_LIB_ADDRESS to the new macro.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
MdePkg/Include/IndustryStandard/PciExpress21.h
MdePkg/Include/Library/PciExpressLib.h

index 175c82c88ee0e06ee163135574a5a773a0428a79..ce9c06a7c6d71d2c3252852dd5913d7d61bfebe2 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Support for the latest PCI standard.\r
 \r
-  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
   (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>  \r
   This program and the accompanying materials                          \r
   are licensed and made available under the terms and conditions of the BSD License         \r
 \r
 #include <IndustryStandard/Pci30.h>\r
 \r
+/**\r
+  Macro that converts PCI Bus, PCI Device, PCI Function and PCI Register to an\r
+  ECAM (Enhanced Configuration Access Mechanism) address. The unused upper bits\r
+  of Bus, Device, Function and Register are stripped prior to the generation of\r
+  the address.\r
+\r
+  @param  Bus       PCI Bus number. Range 0..255.\r
+  @param  Device    PCI Device number. Range 0..31.\r
+  @param  Function  PCI Function number. Range 0..7.\r
+  @param  Register  PCI Register number. Range 0..4095.\r
+\r
+  @return The encode ECAM address.\r
+\r
+**/\r
+#define PCI_ECAM_ADDRESS(Bus,Device,Function,Offset) \\r
+  (((Offset) & 0xfff) | (((Function) & 0x07) << 12) | (((Device) & 0x1f) << 15) | (((Bus) & 0xff) << 20))\r
+\r
 #pragma pack(1)\r
 ///\r
 /// PCI Express Capability Structure\r
index e312d575285783e73c5601998728559376fc5a86..f65b44384f8b15e4ab98230601faccae6aee1b08 100644 (file)
@@ -5,7 +5,7 @@
   configuration cycles must be through the 256 MB PCI Express MMIO window whose base address\r
   is defined by PcdPciExpressBaseAddress.\r
 \r
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -35,8 +35,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   @return The encode PCI address.\r
 \r
 **/\r
-#define PCI_EXPRESS_LIB_ADDRESS(Bus,Device,Function,Offset) \\r
-  (((Offset) & 0xfff) | (((Function) & 0x07) << 12) | (((Device) & 0x1f) << 15) | (((Bus) & 0xff) << 20))\r
+#define PCI_EXPRESS_LIB_ADDRESS(Bus,Device,Function,Offset) PCI_ECAM_ADDRESS ((Bus), (Device), (Function), (Offset))\r
 \r
 /**\r
   Registers a PCI device so PCI configuration registers may be accessed after \r