'PciEmulation' is not a proper naming for a driver, which uses NonDiscoverableDeviceRegistrationLib for handling the devices attached via internal bus of the SoC. Rename it to MvNonDiscoverableDxe and move under Silicon/Marvell/Drivers directory.
Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas <m...@semihalf.com> --- Platform/Marvell/Armada70x0Db/Armada70x0Db.fdf | 4 +- Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc | 4 +- Silicon/Marvell/Drivers/NonDiscoverableDevices/MvNonDiscoverableDxe.c | 195 ++++++++++++++++++++ Silicon/Marvell/Drivers/NonDiscoverableDevices/MvNonDiscoverableDxe.inf | 61 ++++++ Silicon/Marvell/PciEmulation/PciEmulation.c | 195 -------------------- Silicon/Marvell/PciEmulation/PciEmulation.inf | 61 ------ 6 files changed, 260 insertions(+), 260 deletions(-) diff --git a/Platform/Marvell/Armada70x0Db/Armada70x0Db.fdf b/Platform/Marvell/Armada70x0Db/Armada70x0Db.fdf index 6d57b9a..2bf409e 100644 --- a/Platform/Marvell/Armada70x0Db/Armada70x0Db.fdf +++ b/Platform/Marvell/Armada70x0Db/Armada70x0Db.fdf @@ -135,8 +135,8 @@ FvNameGuid = 5eda4200-2c5f-43cb-9da3-0baf74b1b30c INF Silicon/Marvell/Drivers/Net/Phy/MvPhyDxe/MvPhyDxe.inf INF Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.inf - # PciEmulation - INF Silicon/Marvell/PciEmulation/PciEmulation.inf + # NonDiscoverableDevices + INF Silicon/Marvell/Drivers/NonDiscoverableDevices/MvNonDiscoverableDxe.inf INF MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceDxe.inf # SCSI diff --git a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc index 0eb3ef3..598810e 100644 --- a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc +++ b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc @@ -440,8 +440,8 @@ EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf - # PciEmulation - Silicon/Marvell/PciEmulation/PciEmulation.inf + # NonDiscoverableDevices + Silicon/Marvell/Drivers/NonDiscoverableDevices/MvNonDiscoverableDxe.inf MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceDxe.inf # SCSI diff --git a/Silicon/Marvell/Drivers/NonDiscoverableDevices/MvNonDiscoverableDxe.c b/Silicon/Marvell/Drivers/NonDiscoverableDevices/MvNonDiscoverableDxe.c new file mode 100644 index 0000000..abb2940 --- /dev/null +++ b/Silicon/Marvell/Drivers/NonDiscoverableDevices/MvNonDiscoverableDxe.c @@ -0,0 +1,195 @@ +/******************************************************************************** +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/MvHwDescLib.h> +#include <Library/NonDiscoverableDeviceRegistrationLib.h> +#include <Library/UefiBootServicesTableLib.h> + +#include <Protocol/EmbeddedExternalDevice.h> + +DECLARE_A7K8K_NONDISCOVERABLE_TEMPLATE; + +// +// Tables with used devices +// +STATIC UINT8 * CONST XhciDeviceTable = FixedPcdGetPtr (PcdPciEXhci); +STATIC UINT8 * CONST AhciDeviceTable = FixedPcdGetPtr (PcdPciEAhci); +STATIC UINT8 * CONST SdhciDeviceTable = FixedPcdGetPtr (PcdPciESdhci); + +// +// NonDiscoverable devices registration +// +STATIC +EFI_STATUS +MvNonDiscoverableInitXhci ( + ) +{ + MVHW_NONDISCOVERABLE_DESC *Desc = &mA7k8kNonDiscoverableDescTemplate; + EFI_STATUS Status; + UINT8 i; + + if (PcdGetSize (PcdPciEXhci) < Desc->XhciDevCount) { + DEBUG((DEBUG_ERROR, "MvNonDiscoverable: Wrong PcdPciEXhci format\n")); + return EFI_INVALID_PARAMETER; + } + + for (i = 0; i < Desc->XhciDevCount; i++) { + if (!MVHW_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, "MvNonDiscoverable: Cannot install Xhci device %d\n", i)); + return Status; + } + } + + return EFI_SUCCESS; +} + +STATIC +EFI_STATUS +MvNonDiscoverableInitAhci ( + ) +{ + MVHW_NONDISCOVERABLE_DESC *Desc = &mA7k8kNonDiscoverableDescTemplate; + EFI_STATUS Status; + UINT8 i; + + if (PcdGetSize (PcdPciEAhci) < Desc->AhciDevCount) { + DEBUG((DEBUG_ERROR, "MvNonDiscoverable: Wrong PcdPciEAhci format\n")); + return EFI_INVALID_PARAMETER; + } + + for (i = 0; i < Desc->AhciDevCount; i++) { + if (!MVHW_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, "MvNonDiscoverable: Cannot install Ahci device %d\n", i)); + return Status; + } + } + + return EFI_SUCCESS; +} + +STATIC +EFI_STATUS +MvNonDiscoverableInitSdhci ( + ) +{ + MVHW_NONDISCOVERABLE_DESC *Desc = &mA7k8kNonDiscoverableDescTemplate; + EFI_STATUS Status; + UINT8 i; + + if (PcdGetSize (PcdPciESdhci) < Desc->SdhciDevCount) { + DEBUG((DEBUG_ERROR, "MvNonDiscoverable: Wrong PcdPciESdhci format\n")); + return EFI_INVALID_PARAMETER; + } + + for (i = 0; i < Desc->SdhciDevCount; i++) { + if (!MVHW_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, "MvNonDiscoverable: Cannot install Sdhci device %d\n", i)); + return Status; + } + } + + return EFI_SUCCESS; +} + +// +// Entry point +// +EFI_STATUS +EFIAPI +MvNonDiscoverableEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + Status = MvNonDiscoverableInitXhci(); + if (EFI_ERROR(Status)) { + return Status; + } + + Status = MvNonDiscoverableInitAhci(); + if (EFI_ERROR(Status)) { + return Status; + } + + Status = MvNonDiscoverableInitSdhci(); + if (EFI_ERROR(Status)) { + return Status; + } + + return EFI_SUCCESS; +} diff --git a/Silicon/Marvell/Drivers/NonDiscoverableDevices/MvNonDiscoverableDxe.inf b/Silicon/Marvell/Drivers/NonDiscoverableDevices/MvNonDiscoverableDxe.inf new file mode 100644 index 0000000..3f94c32 --- /dev/null +++ b/Silicon/Marvell/Drivers/NonDiscoverableDevices/MvNonDiscoverableDxe.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 = MvNonDiscoverableDxe + FILE_GUID = 3dfa08da-923b-4841-9435-c77a604d7493 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + + ENTRY_POINT = MvNonDiscoverableEntryPoint + +[Sources.common] + MvNonDiscoverableDxe.c + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Marvell/Marvell.dec + +[LibraryClasses] + NonDiscoverableDeviceRegistrationLib + UefiDriverEntryPoint + +[Pcd] + gMarvellTokenSpaceGuid.PcdPciEAhci + gMarvellTokenSpaceGuid.PcdPciESdhci + gMarvellTokenSpaceGuid.PcdPciEXhci + +[Depex] + TRUE diff --git a/Silicon/Marvell/PciEmulation/PciEmulation.c b/Silicon/Marvell/PciEmulation/PciEmulation.c deleted file mode 100644 index 35f1a87..0000000 --- a/Silicon/Marvell/PciEmulation/PciEmulation.c +++ /dev/null @@ -1,195 +0,0 @@ -/******************************************************************************** -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/MvHwDescLib.h> -#include <Library/NonDiscoverableDeviceRegistrationLib.h> -#include <Library/UefiBootServicesTableLib.h> - -#include <Protocol/EmbeddedExternalDevice.h> - -DECLARE_A7K8K_NONDISCOVERABLE_TEMPLATE; - -// -// Tables with used devices -// -STATIC UINT8 * CONST XhciDeviceTable = FixedPcdGetPtr (PcdPciEXhci); -STATIC UINT8 * CONST AhciDeviceTable = FixedPcdGetPtr (PcdPciEAhci); -STATIC UINT8 * CONST SdhciDeviceTable = FixedPcdGetPtr (PcdPciESdhci); - -// -// NonDiscoverable devices registration -// -STATIC -EFI_STATUS -PciEmulationInitXhci ( - ) -{ - MVHW_NONDISCOVERABLE_DESC *Desc = &mA7k8kNonDiscoverableDescTemplate; - 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 (!MVHW_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 ( - ) -{ - MVHW_NONDISCOVERABLE_DESC *Desc = &mA7k8kNonDiscoverableDescTemplate; - 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 (!MVHW_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 ( - ) -{ - MVHW_NONDISCOVERABLE_DESC *Desc = &mA7k8kNonDiscoverableDescTemplate; - 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 (!MVHW_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/Silicon/Marvell/PciEmulation/PciEmulation.inf b/Silicon/Marvell/PciEmulation/PciEmulation.inf deleted file mode 100644 index c6a3c99..0000000 --- a/Silicon/Marvell/PciEmulation/PciEmulation.inf +++ /dev/null @@ -1,61 +0,0 @@ -# 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 - Silicon/Marvell/Marvell.dec - -[LibraryClasses] - NonDiscoverableDeviceRegistrationLib - UefiDriverEntryPoint - -[Pcd] - gMarvellTokenSpaceGuid.PcdPciEXhci - gMarvellTokenSpaceGuid.PcdPciEAhci - gMarvellTokenSpaceGuid.PcdPciESdhci - -[Depex] - TRUE -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel