Hi,
I send v5 of PciEmulation, which base on NonDiscoverablePciDeviceDxe driver: [PATCH v3 0/5] MdeModulePkg: add support for non-discoverable devices
This version addresses all comments from previous one, details can be found in the changelog.
Code is also available in the github: https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/opp-...
Tested on XHCI and SDHCI. New board should be available for us on Monday.
I'm looking forward to your review.
Best regards, Marcin
Changelog v4 -> v5 * Fix gMarvellTokenSpaceGuid.PcdPciEXhci * Add comments in the driver and remove outdated one * Add DEV_ENABLED macro * Replace PCI_E with PCIE prefix * Add 'm' prefix to A70x0PlatDescTemplate * Improve printing on errors
v3 -> v4 * Remove Pcd string parsing * Add HW description structure * Rewrite driver * Adjust documentation
v2 -> v3
* Use static globals for PCD-related variables * Check with 'if' in runtime if they are correct * Return error on each kind of failure * Don't use arrays of DmaTypes/DevTypes for registering NonDiscoverableDevices * Remove redundant protocols, includes, libraries * Add reviewed-by in patches 2-6
v1 -> v2
* Move to NonDiscoverablePciDeviceDxe
Jan Dąbroś (3): Platforms/Marvell: Enable PciEmulation driver for Armada70x0 platform Platforms/Marvell: Enable USB stack for Armada70x0 platform Platforms/Marvell: Enable SATA stack for Armada70x0 platform
Marcin Wojtas (3): Platforms/Marvell: Add PciEmulation driver Platforms/Marvell: Enable two xHCI ports for Armada70x0 board Platforms/Marvell: Enable SATA port for Armada70x0 board
.../Marvell/PortingGuide/PciEmulation.txt | 31 +++ Platforms/Marvell/Armada/Armada.dsc.inc | 19 ++ Platforms/Marvell/Armada/Armada70x0.dsc | 7 + Platforms/Marvell/Armada/Armada70x0.fdf | 18 ++ Platforms/Marvell/Marvell.dec | 5 + Platforms/Marvell/PciEmulation/PciEmulation.c | 230 +++++++++++++++++++++ Platforms/Marvell/PciEmulation/PciEmulation.inf | 61 ++++++ 7 files changed, 371 insertions(+) create mode 100644 Documentation/Marvell/PortingGuide/PciEmulation.txt create mode 100644 Platforms/Marvell/PciEmulation/PciEmulation.c create mode 100644 Platforms/Marvell/PciEmulation/PciEmulation.inf
In order to use numerous UEFI drivers based on PCI bus, PciEmulation driver is implemented. It enables proper registration of platform devices as NonDiscoverableDevices and use generic EDK2 PciEmulation solution.
Used devices are enabled basing on PCD's and Armada 70x0 hardware description in a dedicated structure.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Marcin Wojtas mw@semihalf.com Signed-off-by: Jan Dabros jsd@semihalf.com --- .../Marvell/PortingGuide/PciEmulation.txt | 31 +++ Platforms/Marvell/Marvell.dec | 5 + Platforms/Marvell/PciEmulation/PciEmulation.c | 230 +++++++++++++++++++++ Platforms/Marvell/PciEmulation/PciEmulation.inf | 61 ++++++ 4 files changed, 327 insertions(+) create mode 100644 Documentation/Marvell/PortingGuide/PciEmulation.txt create mode 100644 Platforms/Marvell/PciEmulation/PciEmulation.c create mode 100644 Platforms/Marvell/PciEmulation/PciEmulation.inf
diff --git a/Documentation/Marvell/PortingGuide/PciEmulation.txt b/Documentation/Marvell/PortingGuide/PciEmulation.txt new file mode 100644 index 0000000..ec1afbc --- /dev/null +++ b/Documentation/Marvell/PortingGuide/PciEmulation.txt @@ -0,0 +1,31 @@ +PciEmulation configuration +-------------------------- +Installation of various NonDiscoverable devices via PciEmulation driver is performed +via set of PCDs. Following are available: + + gMarvellTokenSpaceGuid.PcdPciEXhci + +Indicates, which Xhci devices are used. + + gMarvellTokenSpaceGuid.PcdPciEAhci + +Indicates, which Ahci devices are used. + + gMarvellTokenSpaceGuid.PcdPciESdhci + +Indicates, which Sdhci devices are used. + +All above PCD's correspond to hardware description in a dedicated structure: + +STATIC PCI_E_PLATFORM_DESC A70x0PlatDescTemplate + +in Platforms/Marvell/PciEmulation/PciEmulation.c file. It comprises device +count, base addresses, register region size and DMA-coherency type. + +Examples +-------- +Assuming we want to enable second XHCI port and one SDHCI port on Armada +70x0 board, following needs to be declared: + + gMarvellTokenSpaceGuid.PcdPciEXhci|{ 0x0 0x1 } + gMarvellTokenSpaceGuid.PcdPciESdhci|{ 0x1 } diff --git a/Platforms/Marvell/Marvell.dec b/Platforms/Marvell/Marvell.dec index db99230..f1d2def 100644 --- a/Platforms/Marvell/Marvell.dec +++ b/Platforms/Marvell/Marvell.dec @@ -209,6 +209,11 @@ gMarvellTokenSpaceGuid.PcdPp2XlgBaseAddress|0|UINT64|0x3000031 gMarvellTokenSpaceGuid.PcdPp2XlgDevSize|0|UINT32|0x3000032
+#PciEmulation + gMarvellTokenSpaceGuid.PcdPciEXhci|{ 0x0 }|VOID*|0x3000033 + gMarvellTokenSpaceGuid.PcdPciEAhci|{ 0x0 }|VOID*|0x3000034 + gMarvellTokenSpaceGuid.PcdPciESdhci|{ 0x0 }|VOID*|0x3000035 + #ResetLib gMarvellTokenSpaceGuid.PcdResetRegAddress|0|UINT64|0x40000050 gMarvellTokenSpaceGuid.PcdResetRegMask|0|UINT32|0x4000051 diff --git a/Platforms/Marvell/PciEmulation/PciEmulation.c b/Platforms/Marvell/PciEmulation/PciEmulation.c new file mode 100644 index 0000000..f0203f8 --- /dev/null +++ b/Platforms/Marvell/PciEmulation/PciEmulation.c @@ -0,0 +1,230 @@ +/******************************************************************************** +Copyright (C) 2016 Marvell International Ltd. + +Marvell BSD License Option + +If you received this File from Marvell, you may opt to use, redistribute and/or +modify this File under the following licensing terms. +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Marvell nor the names of its contributors may be + used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*******************************************************************************/ + +#include <PiDxe.h> + +#include <Library/DebugLib.h> +#include <Library/NonDiscoverableDeviceRegistrationLib.h> +#include <Library/UefiBootServicesTableLib.h> + +#include <Protocol/EmbeddedExternalDevice.h> + +// +// Platform description +// +typedef struct { + // XHCI + UINT8 XhciDevCount; + UINTN XhciBaseAddresses[4]; + UINTN XhciMemSize[4]; + NON_DISCOVERABLE_DEVICE_DMA_TYPE XhciDmaType[4]; + // AHCI + UINT8 AhciDevCount; + UINTN AhciBaseAddresses[4]; + UINTN AhciMemSize[4]; + NON_DISCOVERABLE_DEVICE_DMA_TYPE AhciDmaType[4]; + // SDHCI + UINT8 SdhciDevCount; + UINTN SdhciBaseAddresses[4]; + UINTN SdhciMemSize[4]; + NON_DISCOVERABLE_DEVICE_DMA_TYPE SdhciDmaType[4]; +} PCIE_PLATFORM_DESC; + +STATIC PCIE_PLATFORM_DESC mA70x0PlatDescTemplate = { + 2, // XHCI + { 0xF2500000, 0xF2510000 }, + { SIZE_16KB, SIZE_16KB }, + { NonDiscoverableDeviceDmaTypeCoherent, NonDiscoverableDeviceDmaTypeCoherent }, + 1, // AHCI + { 0xF2540000 }, + { SIZE_8KB }, + { NonDiscoverableDeviceDmaTypeCoherent }, + 1, // SDHCI + { 0xF06E0000 }, + { SIZE_1KB }, + { NonDiscoverableDeviceDmaTypeCoherent } +}; + +// +// Tables with used devices +// +STATIC UINT8 * CONST XhciDeviceTable = FixedPcdGetPtr (PcdPciEXhci); +STATIC UINT8 * CONST AhciDeviceTable = FixedPcdGetPtr (PcdPciEAhci); +STATIC UINT8 * CONST SdhciDeviceTable = FixedPcdGetPtr (PcdPciESdhci); + +#define DEV_ENABLED(type, index) (type ## DeviceTable[index]) + +// +// NonDiscoverable devices registration +// +STATIC +EFI_STATUS +PciEmulationInitXhci ( + ) +{ + PCIE_PLATFORM_DESC *Desc = &mA70x0PlatDescTemplate; + EFI_STATUS Status; + UINT8 i; + + if (PcdGetSize (PcdPciEXhci) < Desc->XhciDevCount) { + DEBUG((DEBUG_ERROR, "PciEmulation: Wrong PcdPciEXhci format\n")); + return EFI_INVALID_PARAMETER; + } + + for (i = 0; i < Desc->XhciDevCount; i++) { + if (!DEV_ENABLED(Xhci, i)) { + continue; + } + + Status = RegisterNonDiscoverableMmioDevice ( + NonDiscoverableDeviceTypeXhci, + Desc->XhciDmaType[i], + NULL, + NULL, + 1, + Desc->XhciBaseAddresses[i], Desc->XhciMemSize[i] + ); + + if (EFI_ERROR(Status)) { + DEBUG((DEBUG_ERROR, "PciEmulation: Cannot install Xhci device %d\n", i)); + return Status; + } + } + + return EFI_SUCCESS; +} + +STATIC +EFI_STATUS +PciEmulationInitAhci ( + ) +{ + PCIE_PLATFORM_DESC *Desc = &mA70x0PlatDescTemplate; + EFI_STATUS Status; + UINT8 i; + + if (PcdGetSize (PcdPciEAhci) < Desc->AhciDevCount) { + DEBUG((DEBUG_ERROR, "PciEmulation: Wrong PcdPciEAhci format\n")); + return EFI_INVALID_PARAMETER; + } + + for (i = 0; i < Desc->AhciDevCount; i++) { + if (!DEV_ENABLED(Ahci, i)) { + continue; + } + + Status = RegisterNonDiscoverableMmioDevice ( + NonDiscoverableDeviceTypeAhci, + Desc->AhciDmaType[i], + NULL, + NULL, + 1, + Desc->AhciBaseAddresses[i], Desc->AhciMemSize[i] + ); + + if (EFI_ERROR(Status)) { + DEBUG((DEBUG_ERROR, "PciEmulation: Cannot install Ahci device %d\n", i)); + return Status; + } + } + + return EFI_SUCCESS; +} + +STATIC +EFI_STATUS +PciEmulationInitSdhci ( + ) +{ + PCIE_PLATFORM_DESC *Desc = &mA70x0PlatDescTemplate; + EFI_STATUS Status; + UINT8 i; + + if (PcdGetSize (PcdPciESdhci) < Desc->SdhciDevCount) { + DEBUG((DEBUG_ERROR, "PciEmulation: Wrong PcdPciESdhci format\n")); + return EFI_INVALID_PARAMETER; + } + + for (i = 0; i < Desc->SdhciDevCount; i++) { + if (!DEV_ENABLED(Sdhci, i)) { + continue; + } + + Status = RegisterNonDiscoverableMmioDevice ( + NonDiscoverableDeviceTypeSdhci, + Desc->SdhciDmaType[i], + NULL, + NULL, + 1, + Desc->SdhciBaseAddresses[i], Desc->SdhciMemSize[i] + ); + + if (EFI_ERROR(Status)) { + DEBUG((DEBUG_ERROR, "PciEmulation: Cannot install Sdhci device %d\n", i)); + return Status; + } + } + + return EFI_SUCCESS; +} + +// +// Entry point +// +EFI_STATUS +EFIAPI +PciEmulationEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + Status = PciEmulationInitXhci(); + if (EFI_ERROR(Status)) { + return Status; + } + + Status = PciEmulationInitAhci(); + if (EFI_ERROR(Status)) { + return Status; + } + + Status = PciEmulationInitSdhci(); + if (EFI_ERROR(Status)) { + return Status; + } + + return EFI_SUCCESS; +} diff --git a/Platforms/Marvell/PciEmulation/PciEmulation.inf b/Platforms/Marvell/PciEmulation/PciEmulation.inf new file mode 100644 index 0000000..5d569b9 --- /dev/null +++ b/Platforms/Marvell/PciEmulation/PciEmulation.inf @@ -0,0 +1,61 @@ +# Copyright (C) 2016 Marvell International Ltd. +# +# Marvell BSD License Option +# +# If you received this File from Marvell, you may opt to use, redistribute and/or +# modify this File under the following licensing terms. +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Marvell nor the names of its contributors may be +# used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +[Defines] + INF_VERSION = 0x00010019 + BASE_NAME = PciEmulation + FILE_GUID = 3dfa08da-923b-4841-9435-c77a604d7493 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + + ENTRY_POINT = PciEmulationEntryPoint + +[Sources.common] + PciEmulation.c + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + OpenPlatformPkg/Platforms/Marvell/Marvell.dec + +[LibraryClasses] + NonDiscoverableDeviceRegistrationLib + UefiDriverEntryPoint + +[Pcd] + gMarvellTokenSpaceGuid.PcdPciEXhci + gMarvellTokenSpaceGuid.PcdPciEAhci + gMarvellTokenSpaceGuid.PcdPciESdhci + +[Depex] + TRUE
From: Jan Dąbroś jsd@semihalf.com
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jan Dabros jsd@semihalf.com Signed-off-by: Marcin Wojtas mw@semihalf.com Reviewed-by: Ard Biesheuvel ard.biesheuvel@linaro.org Reviewed-by: Leif Lindholm leif.lindholm@linaro.org --- Platforms/Marvell/Armada/Armada.dsc.inc | 4 ++++ Platforms/Marvell/Armada/Armada70x0.fdf | 4 ++++ 2 files changed, 8 insertions(+)
diff --git a/Platforms/Marvell/Armada/Armada.dsc.inc b/Platforms/Marvell/Armada/Armada.dsc.inc index 76c5d6d..3ebee0d 100644 --- a/Platforms/Marvell/Armada/Armada.dsc.inc +++ b/Platforms/Marvell/Armada/Armada.dsc.inc @@ -170,6 +170,7 @@ SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + NonDiscoverableDeviceRegistrationLib|MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/NonDiscoverableDeviceRegistrationLib.inf
[LibraryClasses.common.UEFI_APPLICATION] UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf @@ -417,6 +418,9 @@ EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
+ OpenPlatformPkg/Platforms/Marvell/PciEmulation/PciEmulation.inf + MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceDxe.inf + # Console packages MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf diff --git a/Platforms/Marvell/Armada/Armada70x0.fdf b/Platforms/Marvell/Armada/Armada70x0.fdf index 64c3440..2403b71 100644 --- a/Platforms/Marvell/Armada/Armada70x0.fdf +++ b/Platforms/Marvell/Armada/Armada70x0.fdf @@ -123,6 +123,10 @@ FvNameGuid = 5eda4200-2c5f-43cb-9da3-0baf74b1b30c INF OpenPlatformPkg/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.inf INF OpenPlatformPkg/Drivers/Net/Pp2Dxe/Pp2Dxe.inf
+ # PciEmulation + INF OpenPlatformPkg/Platforms/Marvell/PciEmulation/PciEmulation.inf + INF MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceDxe.inf + # Multiple Console IO support INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
From: Jan Dąbroś jsd@semihalf.com
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jan Dabros jsd@semihalf.com Signed-off-by: Marcin Wojtas mw@semihalf.com Reviewed-by: Ard Biesheuvel ard.biesheuvel@linaro.org Reviewed-by: Leif Lindholm leif.lindholm@linaro.org --- Platforms/Marvell/Armada/Armada.dsc.inc | 5 +++++ Platforms/Marvell/Armada/Armada70x0.fdf | 5 +++++ 2 files changed, 10 insertions(+)
diff --git a/Platforms/Marvell/Armada/Armada.dsc.inc b/Platforms/Marvell/Armada/Armada.dsc.inc index 3ebee0d..470cf81 100644 --- a/Platforms/Marvell/Armada/Armada.dsc.inc +++ b/Platforms/Marvell/Armada/Armada.dsc.inc @@ -421,6 +421,11 @@ OpenPlatformPkg/Platforms/Marvell/PciEmulation/PciEmulation.inf MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceDxe.inf
+ # USB + MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf + MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf + MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf + # Console packages MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf diff --git a/Platforms/Marvell/Armada/Armada70x0.fdf b/Platforms/Marvell/Armada/Armada70x0.fdf index 2403b71..2c4f833 100644 --- a/Platforms/Marvell/Armada/Armada70x0.fdf +++ b/Platforms/Marvell/Armada/Armada70x0.fdf @@ -127,6 +127,11 @@ FvNameGuid = 5eda4200-2c5f-43cb-9da3-0baf74b1b30c INF OpenPlatformPkg/Platforms/Marvell/PciEmulation/PciEmulation.inf INF MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceDxe.inf
+ # USB + INF MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf + INF MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf + INF MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf + # Multiple Console IO support INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
Add a Pcd entry to make NonDiscoverable platform library register two Armada 70x0 XHCI ports to work with MdeModulePkg/Bus/Pci/XhciDxe driver.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Marcin Wojtas mw@semihalf.com --- Platforms/Marvell/Armada/Armada70x0.dsc | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/Platforms/Marvell/Armada/Armada70x0.dsc b/Platforms/Marvell/Armada/Armada70x0.dsc index 2f2b278..06231b9 100644 --- a/Platforms/Marvell/Armada/Armada70x0.dsc +++ b/Platforms/Marvell/Armada/Armada70x0.dsc @@ -139,6 +139,9 @@ gMarvellTokenSpaceGuid.PcdPp2XlgBaseAddress|0xf2130f00 gMarvellTokenSpaceGuid.PcdPp2XlgDevSize|0x1000
+ #PciEmulation + gMarvellTokenSpaceGuid.PcdPciEXhci|{ 0x1, 0x1 } + #ResetLib gMarvellTokenSpaceGuid.PcdResetRegAddress|0xf06f0084 gMarvellTokenSpaceGuid.PcdResetRegMask|0x1
From: Jan Dąbroś jsd@semihalf.com
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jan Dabros jsd@semihalf.com Signed-off-by: Marcin Wojtas mw@semihalf.com Reviewed-by: Ard Biesheuvel ard.biesheuvel@linaro.org Reviewed-by: Leif Lindholm leif.lindholm@linaro.org --- Platforms/Marvell/Armada/Armada.dsc.inc | 10 ++++++++++ Platforms/Marvell/Armada/Armada70x0.fdf | 9 +++++++++ 2 files changed, 19 insertions(+)
diff --git a/Platforms/Marvell/Armada/Armada.dsc.inc b/Platforms/Marvell/Armada/Armada.dsc.inc index 470cf81..0b1c50d 100644 --- a/Platforms/Marvell/Armada/Armada.dsc.inc +++ b/Platforms/Marvell/Armada/Armada.dsc.inc @@ -82,6 +82,7 @@ ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf + UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
# Serial port libraries SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf @@ -421,6 +422,15 @@ OpenPlatformPkg/Platforms/Marvell/PciEmulation/PciEmulation.inf MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceDxe.inf
+ # SCSI + MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf + MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf + + # SATA + MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf + MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf + OvmfPkg/SataControllerDxe/SataControllerDxe.inf + # USB MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf diff --git a/Platforms/Marvell/Armada/Armada70x0.fdf b/Platforms/Marvell/Armada/Armada70x0.fdf index 2c4f833..b420153 100644 --- a/Platforms/Marvell/Armada/Armada70x0.fdf +++ b/Platforms/Marvell/Armada/Armada70x0.fdf @@ -127,6 +127,15 @@ FvNameGuid = 5eda4200-2c5f-43cb-9da3-0baf74b1b30c INF OpenPlatformPkg/Platforms/Marvell/PciEmulation/PciEmulation.inf INF MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceDxe.inf
+ # SCSI + INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf + INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf + + # SATA + INF MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf + INF MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf + INF OvmfPkg/SataControllerDxe/SataControllerDxe.inf + # USB INF MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf INF MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
Add a Pcd entry to make NonDiscoverable platform library register single Armada 70x0 AHCI port to work with MdeModulePkg/Bus/Ata/AtaBusDxe driver.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Marcin Wojtas mw@semihalf.com --- Platforms/Marvell/Armada/Armada70x0.dsc | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/Platforms/Marvell/Armada/Armada70x0.dsc b/Platforms/Marvell/Armada/Armada70x0.dsc index 06231b9..3c0cbad 100644 --- a/Platforms/Marvell/Armada/Armada70x0.dsc +++ b/Platforms/Marvell/Armada/Armada70x0.dsc @@ -141,7 +141,11 @@
#PciEmulation gMarvellTokenSpaceGuid.PcdPciEXhci|{ 0x1, 0x1 } + gMarvellTokenSpaceGuid.PcdPciEAhci|{ 0x1 }
#ResetLib gMarvellTokenSpaceGuid.PcdResetRegAddress|0xf06f0084 gMarvellTokenSpaceGuid.PcdResetRegMask|0x1 + + #SATA + gMarvellTokenSpaceGuid.PcdSataBaseAddress|0xF2540000
For the series, and pending any rework required based on changes to the NonDiscoverablePciDeviceDxe driver before it gets merged:
Reviewed-by: Leif Lindholm leif.lindholm@linaro.org
On Fri, Nov 18, 2016 at 02:09:09PM +0100, Marcin Wojtas wrote:
Hi,
I send v5 of PciEmulation, which base on NonDiscoverablePciDeviceDxe driver: [PATCH v3 0/5] MdeModulePkg: add support for non-discoverable devices
This version addresses all comments from previous one, details can be found in the changelog.
Code is also available in the github: https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/opp-...
Tested on XHCI and SDHCI. New board should be available for us on Monday.
I'm looking forward to your review.
Best regards, Marcin
Changelog v4 -> v5
- Fix gMarvellTokenSpaceGuid.PcdPciEXhci
- Add comments in the driver and remove outdated one
- Add DEV_ENABLED macro
- Replace PCI_E with PCIE prefix
- Add 'm' prefix to A70x0PlatDescTemplate
- Improve printing on errors
v3 -> v4
- Remove Pcd string parsing
- Add HW description structure
- Rewrite driver
- Adjust documentation
v2 -> v3
- Use static globals for PCD-related variables
- Check with 'if' in runtime if they are correct
- Return error on each kind of failure
- Don't use arrays of DmaTypes/DevTypes for registering NonDiscoverableDevices
- Remove redundant protocols, includes, libraries
- Add reviewed-by in patches 2-6
v1 -> v2
- Move to NonDiscoverablePciDeviceDxe
Jan Dąbroś (3): Platforms/Marvell: Enable PciEmulation driver for Armada70x0 platform Platforms/Marvell: Enable USB stack for Armada70x0 platform Platforms/Marvell: Enable SATA stack for Armada70x0 platform
Marcin Wojtas (3): Platforms/Marvell: Add PciEmulation driver Platforms/Marvell: Enable two xHCI ports for Armada70x0 board Platforms/Marvell: Enable SATA port for Armada70x0 board
.../Marvell/PortingGuide/PciEmulation.txt | 31 +++ Platforms/Marvell/Armada/Armada.dsc.inc | 19 ++ Platforms/Marvell/Armada/Armada70x0.dsc | 7 + Platforms/Marvell/Armada/Armada70x0.fdf | 18 ++ Platforms/Marvell/Marvell.dec | 5 + Platforms/Marvell/PciEmulation/PciEmulation.c | 230 +++++++++++++++++++++ Platforms/Marvell/PciEmulation/PciEmulation.inf | 61 ++++++ 7 files changed, 371 insertions(+) create mode 100644 Documentation/Marvell/PortingGuide/PciEmulation.txt create mode 100644 Platforms/Marvell/PciEmulation/PciEmulation.c create mode 100644 Platforms/Marvell/PciEmulation/PciEmulation.inf
-- 1.8.3.1
Thanks a lot!
Marcin
2016-11-18 17:16 GMT+01:00 Leif Lindholm leif.lindholm@linaro.org:
For the series, and pending any rework required based on changes to the NonDiscoverablePciDeviceDxe driver before it gets merged:
Reviewed-by: Leif Lindholm leif.lindholm@linaro.org
On Fri, Nov 18, 2016 at 02:09:09PM +0100, Marcin Wojtas wrote:
Hi,
I send v5 of PciEmulation, which base on NonDiscoverablePciDeviceDxe driver: [PATCH v3 0/5] MdeModulePkg: add support for non-discoverable devices
This version addresses all comments from previous one, details can be found in the changelog.
Code is also available in the github: https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/opp-...
Tested on XHCI and SDHCI. New board should be available for us on Monday.
I'm looking forward to your review.
Best regards, Marcin
Changelog v4 -> v5
- Fix gMarvellTokenSpaceGuid.PcdPciEXhci
- Add comments in the driver and remove outdated one
- Add DEV_ENABLED macro
- Replace PCI_E with PCIE prefix
- Add 'm' prefix to A70x0PlatDescTemplate
- Improve printing on errors
v3 -> v4
- Remove Pcd string parsing
- Add HW description structure
- Rewrite driver
- Adjust documentation
v2 -> v3
- Use static globals for PCD-related variables
- Check with 'if' in runtime if they are correct
- Return error on each kind of failure
- Don't use arrays of DmaTypes/DevTypes for registering NonDiscoverableDevices
- Remove redundant protocols, includes, libraries
- Add reviewed-by in patches 2-6
v1 -> v2
- Move to NonDiscoverablePciDeviceDxe
Jan Dąbroś (3): Platforms/Marvell: Enable PciEmulation driver for Armada70x0 platform Platforms/Marvell: Enable USB stack for Armada70x0 platform Platforms/Marvell: Enable SATA stack for Armada70x0 platform
Marcin Wojtas (3): Platforms/Marvell: Add PciEmulation driver Platforms/Marvell: Enable two xHCI ports for Armada70x0 board Platforms/Marvell: Enable SATA port for Armada70x0 board
.../Marvell/PortingGuide/PciEmulation.txt | 31 +++ Platforms/Marvell/Armada/Armada.dsc.inc | 19 ++ Platforms/Marvell/Armada/Armada70x0.dsc | 7 + Platforms/Marvell/Armada/Armada70x0.fdf | 18 ++ Platforms/Marvell/Marvell.dec | 5 + Platforms/Marvell/PciEmulation/PciEmulation.c | 230 +++++++++++++++++++++ Platforms/Marvell/PciEmulation/PciEmulation.inf | 61 ++++++ 7 files changed, 371 insertions(+) create mode 100644 Documentation/Marvell/PortingGuide/PciEmulation.txt create mode 100644 Platforms/Marvell/PciEmulation/PciEmulation.c create mode 100644 Platforms/Marvell/PciEmulation/PciEmulation.inf
-- 1.8.3.1