Re: [edk2-devel] [edk2-platforms: PATCH 06/14] Marvell/Armada7k8k: Add PciExpressLib implementation
czw., 16 maj 2019 o 16:02 Ard Biesheuvel napisał(a): > > On Thu, 9 May 2019 at 11:54, Marcin Wojtas wrote: > > > > From: Ard Biesheuvel > > > > Implement a special version of PciExpressLib that takes the quirky > > nature of the Synopsys Designware PCIe IP into account. In particular, > > we need to ignores config space accesses to all devices on the first > > ignore > > > > bus except device 0, because the broadcast nature of type 0 configuration > > cycles will result in whatever device is in the slot to appear at each > > of the 32 device positions. > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Marcin Wojtas > > --- > > > > Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.inf > > | 42 + > > Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.c > > | 1529 > > 2 files changed, 1571 insertions(+) > > create mode 100644 > > Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.inf > > create mode 100644 > > Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.c > > > > diff --git > > a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.inf > > > > b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.inf > > new file mode 100644 > > index 000..8f09820 > > --- /dev/null > > +++ > > b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.inf > > @@ -0,0 +1,42 @@ > > +## @file > > +# > > +# Copyright (c) 2017, Linaro, Ltd. All rights reserved. > > +# Copyright (c) 2019 Marvell International Ltd. All rights reserved. > > +# > > +# 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 > > +# http://opensource.org/licenses/bsd-license.php. > > +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > > +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR > > IMPLIED. > > +# > > +# > > +## > > + > > +[Defines] > > + INF_VERSION= 0x0001001B > > + BASE_NAME = Armada7k8kPciExpressLib > > + FILE_GUID = f0926204-3061-40ed-8261-2aeccc7914c9 > > + MODULE_TYPE= BASE > > + VERSION_STRING = 1.0 > > + LIBRARY_CLASS = PciExpressLib > > + > > +[Sources] > > + PciExpressLib.c > > + > > +[Packages] > > + ArmPkg/ArmPkg.dec > > + MdePkg/MdePkg.dec > > + > > +[LibraryClasses] > > + BaseLib > > + DebugLib > > + IoLib > > + PcdLib > > + > > +[Pcd] > > + gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress ## CONSUMES > > + > > +[FixedPcd] > > + gArmTokenSpaceGuid.PcdPciBusMin > > + gArmTokenSpaceGuid.PcdPciBusMax > > diff --git > > a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.c > > > > b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.c > > new file mode 100644 > > index 000..8fa2eb6 > > --- /dev/null > > +++ > > b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.c > > @@ -0,0 +1,1529 @@ > > +/** @file > > + > > + Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved. > > + Copyright (c) 2019 Marvell International Ltd. All rights reserved. > > + > > + 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 > > + http://opensource.org/licenses/bsd-license.php. > > + > > + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > > + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR > > IMPLIED. > > + > > +**/ > > + > > + > > +#include > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +/** > > + Assert the validity of a PCI address. A valid PCI address should contain > > 1's > > + only in the low 28 bits. > > + > > + @param A The address to validate. > > + > > +**/ > > +#define ASSERT_INVALID_PCI_ADDRESS(A) \ > > + ASSERT (((A) & ~0xfff) == 0) > > + > > +/** > > + Registers a PCI device so PCI configuration registers may be accessed > > after > > + SetVirtualAddressMap(). > > + > > + Registers the PCI device specified by Address so all the PCI > > configuration > > + registers associated with that PCI device may be accessed after > > SetVirtualAddressMap() > > + is called. > > + > > + If Address > 0x0FFF, then ASSERT(). > > + > > + @param Address The address that encodes the PCI Bus, Device, Function > > and > > + Register. > > + > > + @retval RETURN_SUCCESS The PCI device was registered for > > runtime access. > > + @retval RETURN_UNSUPPORTED An
Re: [edk2-devel] [edk2-platforms: PATCH 06/14] Marvell/Armada7k8k: Add PciExpressLib implementation
On Thu, 9 May 2019 at 11:54, Marcin Wojtas wrote: > > From: Ard Biesheuvel > > Implement a special version of PciExpressLib that takes the quirky > nature of the Synopsys Designware PCIe IP into account. In particular, > we need to ignores config space accesses to all devices on the first ignore > bus except device 0, because the broadcast nature of type 0 configuration > cycles will result in whatever device is in the slot to appear at each > of the 32 device positions. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Marcin Wojtas > --- > Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.inf > | 42 + > Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.c > | 1529 > 2 files changed, 1571 insertions(+) > create mode 100644 > Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.inf > create mode 100644 > Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.c > > diff --git > a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.inf > > b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.inf > new file mode 100644 > index 000..8f09820 > --- /dev/null > +++ > b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.inf > @@ -0,0 +1,42 @@ > +## @file > +# > +# Copyright (c) 2017, Linaro, Ltd. All rights reserved. > +# Copyright (c) 2019 Marvell International Ltd. All rights reserved. > +# > +# 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 > +# http://opensource.org/licenses/bsd-license.php. > +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR > IMPLIED. > +# > +# > +## > + > +[Defines] > + INF_VERSION= 0x0001001B > + BASE_NAME = Armada7k8kPciExpressLib > + FILE_GUID = f0926204-3061-40ed-8261-2aeccc7914c9 > + MODULE_TYPE= BASE > + VERSION_STRING = 1.0 > + LIBRARY_CLASS = PciExpressLib > + > +[Sources] > + PciExpressLib.c > + > +[Packages] > + ArmPkg/ArmPkg.dec > + MdePkg/MdePkg.dec > + > +[LibraryClasses] > + BaseLib > + DebugLib > + IoLib > + PcdLib > + > +[Pcd] > + gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress ## CONSUMES > + > +[FixedPcd] > + gArmTokenSpaceGuid.PcdPciBusMin > + gArmTokenSpaceGuid.PcdPciBusMax > diff --git > a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.c > b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.c > new file mode 100644 > index 000..8fa2eb6 > --- /dev/null > +++ > b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.c > @@ -0,0 +1,1529 @@ > +/** @file > + > + Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved. > + Copyright (c) 2019 Marvell International Ltd. All rights reserved. > + > + 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 > + http://opensource.org/licenses/bsd-license.php. > + > + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR > IMPLIED. > + > +**/ > + > + > +#include > + > +#include > +#include > +#include > +#include > +#include > + > +/** > + Assert the validity of a PCI address. A valid PCI address should contain > 1's > + only in the low 28 bits. > + > + @param A The address to validate. > + > +**/ > +#define ASSERT_INVALID_PCI_ADDRESS(A) \ > + ASSERT (((A) & ~0xfff) == 0) > + > +/** > + Registers a PCI device so PCI configuration registers may be accessed after > + SetVirtualAddressMap(). > + > + Registers the PCI device specified by Address so all the PCI configuration > + registers associated with that PCI device may be accessed after > SetVirtualAddressMap() > + is called. > + > + If Address > 0x0FFF, then ASSERT(). > + > + @param Address The address that encodes the PCI Bus, Device, Function and > + Register. > + > + @retval RETURN_SUCCESS The PCI device was registered for runtime > access. > + @retval RETURN_UNSUPPORTED An attempt was made to call this function > + after ExitBootServices(). > + @retval RETURN_UNSUPPORTED The resources required to access the PCI > device > + at runtime could not be mapped. > + @retval RETURN_OUT_OF_RESOURCES There are not enough resources available > to > +
Re: [edk2-devel] [edk2-platforms: PATCH 06/14] Marvell/Armada7k8k: Add PciExpressLib implementation
Hi Leif, pt., 10 maj 2019 o 17:25 Leif Lindholm napisał(a): > > On Thu, May 09, 2019 at 11:53:34AM +0200, Marcin Wojtas wrote: > > From: Ard Biesheuvel > > > > Implement a special version of PciExpressLib that takes the quirky > > nature of the Synopsys Designware PCIe IP into account. In particular, > > we need to ignores config space accesses to all devices on the first > > bus except device 0, because the broadcast nature of type 0 configuration > > cycles will result in whatever device is in the slot to appear at each > > of the 32 device positions. > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Marcin Wojtas > > --- > > > > Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.inf > > | 42 + > > Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.c > > | 1529 > > 2 files changed, 1571 insertions(+) > > create mode 100644 > > Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.inf > > create mode 100644 > > Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.c > > > > diff --git > > a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.inf > > > > b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.inf > > new file mode 100644 > > index 000..8f09820 > > --- /dev/null > > +++ > > b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.inf > > @@ -0,0 +1,42 @@ > > +## @file > > +# > > +# Copyright (c) 2017, Linaro, Ltd. All rights reserved. > > +# Copyright (c) 2019 Marvell International Ltd. All rights reserved. > > +# > > +# 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 > > +# http://opensource.org/licenses/bsd-license.php. > > +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > > +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR > > IMPLIED. > > +# > > +# > > +## > > + > > +[Defines] > > + INF_VERSION= 0x0001001B > > + BASE_NAME = Armada7k8kPciExpressLib > > + FILE_GUID = f0926204-3061-40ed-8261-2aeccc7914c9 > > + MODULE_TYPE= BASE > > + VERSION_STRING = 1.0 > > + LIBRARY_CLASS = PciExpressLib > > + > > +[Sources] > > + PciExpressLib.c > > + > > +[Packages] > > + ArmPkg/ArmPkg.dec > > + MdePkg/MdePkg.dec > > + > > +[LibraryClasses] > > + BaseLib > > + DebugLib > > + IoLib > > + PcdLib > > + > > +[Pcd] > > + gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress ## CONSUMES > > + > > +[FixedPcd] > > + gArmTokenSpaceGuid.PcdPciBusMin > > + gArmTokenSpaceGuid.PcdPciBusMax > > diff --git > > a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.c > > > > b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.c > > new file mode 100644 > > index 000..8fa2eb6 > > --- /dev/null > > +++ > > b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.c > > @@ -0,0 +1,1529 @@ > > +/** @file > > + > > + Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved. > > + Copyright (c) 2019 Marvell International Ltd. All rights reserved. > > If Ard is the author of this patch, should there not be Linaro > copyright here as well? > > > + > > + 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 > > + http://opensource.org/licenses/bsd-license.php. > > + > > + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > > + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR > > IMPLIED. > > + > > +**/ > > + > > + > > +#include > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +/** > > + Assert the validity of a PCI address. A valid PCI address should contain > > 1's > > + only in the low 28 bits. > > + > > + @param A The address to validate. > > + > > +**/ > > +#define ASSERT_INVALID_PCI_ADDRESS(A) \ > > + ASSERT (((A) & ~0xfff) == 0) > > + > > +/** > > + Registers a PCI device so PCI configuration registers may be accessed > > after > > + SetVirtualAddressMap(). > > + > > + Registers the PCI device specified by Address so all the PCI > > configuration > > + registers associated with that PCI device may be accessed after > > SetVirtualAddressMap() > > + is called. > > + > > + If Address > 0x0FFF, then ASSERT(). > > + > > + @param Address The address that encodes the PCI Bus, Device, Function > > and > > + Register. > > + > > + @retval RETURN_SUCCESS The PCI
Re: [edk2-devel] [edk2-platforms: PATCH 06/14] Marvell/Armada7k8k: Add PciExpressLib implementation
On Thu, May 09, 2019 at 11:53:34AM +0200, Marcin Wojtas wrote: > From: Ard Biesheuvel > > Implement a special version of PciExpressLib that takes the quirky > nature of the Synopsys Designware PCIe IP into account. In particular, > we need to ignores config space accesses to all devices on the first > bus except device 0, because the broadcast nature of type 0 configuration > cycles will result in whatever device is in the slot to appear at each > of the 32 device positions. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Marcin Wojtas > --- > Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.inf > | 42 + > Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.c > | 1529 > 2 files changed, 1571 insertions(+) > create mode 100644 > Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.inf > create mode 100644 > Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.c > > diff --git > a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.inf > > b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.inf > new file mode 100644 > index 000..8f09820 > --- /dev/null > +++ > b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.inf > @@ -0,0 +1,42 @@ > +## @file > +# > +# Copyright (c) 2017, Linaro, Ltd. All rights reserved. > +# Copyright (c) 2019 Marvell International Ltd. All rights reserved. > +# > +# 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 > +# http://opensource.org/licenses/bsd-license.php. > +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR > IMPLIED. > +# > +# > +## > + > +[Defines] > + INF_VERSION= 0x0001001B > + BASE_NAME = Armada7k8kPciExpressLib > + FILE_GUID = f0926204-3061-40ed-8261-2aeccc7914c9 > + MODULE_TYPE= BASE > + VERSION_STRING = 1.0 > + LIBRARY_CLASS = PciExpressLib > + > +[Sources] > + PciExpressLib.c > + > +[Packages] > + ArmPkg/ArmPkg.dec > + MdePkg/MdePkg.dec > + > +[LibraryClasses] > + BaseLib > + DebugLib > + IoLib > + PcdLib > + > +[Pcd] > + gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress ## CONSUMES > + > +[FixedPcd] > + gArmTokenSpaceGuid.PcdPciBusMin > + gArmTokenSpaceGuid.PcdPciBusMax > diff --git > a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.c > b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.c > new file mode 100644 > index 000..8fa2eb6 > --- /dev/null > +++ > b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kPciExpressLib/PciExpressLib.c > @@ -0,0 +1,1529 @@ > +/** @file > + > + Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved. > + Copyright (c) 2019 Marvell International Ltd. All rights reserved. If Ard is the author of this patch, should there not be Linaro copyright here as well? > + > + 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 > + http://opensource.org/licenses/bsd-license.php. > + > + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR > IMPLIED. > + > +**/ > + > + > +#include > + > +#include > +#include > +#include > +#include > +#include > + > +/** > + Assert the validity of a PCI address. A valid PCI address should contain > 1's > + only in the low 28 bits. > + > + @param A The address to validate. > + > +**/ > +#define ASSERT_INVALID_PCI_ADDRESS(A) \ > + ASSERT (((A) & ~0xfff) == 0) > + > +/** > + Registers a PCI device so PCI configuration registers may be accessed after > + SetVirtualAddressMap(). > + > + Registers the PCI device specified by Address so all the PCI configuration > + registers associated with that PCI device may be accessed after > SetVirtualAddressMap() > + is called. > + > + If Address > 0x0FFF, then ASSERT(). > + > + @param Address The address that encodes the PCI Bus, Device, Function and > + Register. > + > + @retval RETURN_SUCCESS The PCI device was registered for runtime > access. > + @retval RETURN_UNSUPPORTED An attempt was made to call this function > + after ExitBootServices(). > + @retval RETURN_UNSUPPORTED The resources required to access the PCI > device > + at runtime could not be mapped. > + @retval