Hi,
I resend only single patch (4/5), which had some remaining remarks. Please let know if it's sufficient.
Best regards, Marcin
Changelog v2->v3: * Add missing STATIC to LibResetSystemVirtualNotifyEvent * Add comment about lack of power-off support * Use local variable for setting alignments
Changelog v1->v2:
* Change ResetSystem driver to implementation of EfiResetSystemLibrary - Use EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf - Adjust naming properly - Replace 4K in size and 4K aligned memory allocation to 64K in size and 64K aligned * Sort #include entries and PCDs * Change ResetLib documentation and UTMI-related files format to DOS (remove CheckPatch errors) * UTMI - Remove debug info prints improperly marked as "DEBUG_ERROR" - Break up long prints (over 80 characters), but unbreak format strings * Rebase on top of the newest opp baseline
Bartosz Szczepanek (2): Platforms/Marvell: Add MvResetSystemLib Platforms/Marvell: Enable MvResetSystemLib for A70x0 platform
Jan Dąbroś (3): Drivers/I2c: Fix enumaration of I2c devices Platforms/Marvell: Add UtmiPhyLib Platforms/Marvell: Enable UtmiPhyLib for Armada70x0 Platforms
Documentation/Marvell/PortingGuide/Reset.txt | 7 + Documentation/Marvell/PortingGuide/Utmi.txt | 35 ++ Drivers/I2c/MvI2cDxe/MvI2cDxe.c | 13 +- Platforms/Marvell/Armada/Armada.dsc.inc | 3 +- Platforms/Marvell/Armada/Armada70x0.dsc | 11 + .../Armada/Library/Armada70x0Lib/Armada70x0Lib.c | 2 + .../Armada/Library/Armada70x0Lib/Armada70x0Lib.inf | 1 + Platforms/Marvell/Include/Library/UtmiPhyLib.h | 43 +++ .../Library/ResetSystemLib/MvResetSystemLib.c | 159 ++++++++++ .../Library/ResetSystemLib/MvResetSystemLib.inf | 58 ++++ Platforms/Marvell/Library/UtmiPhyLib/UtmiPhyLib.c | 353 +++++++++++++++++++++ Platforms/Marvell/Library/UtmiPhyLib/UtmiPhyLib.h | 110 +++++++ .../Marvell/Library/UtmiPhyLib/UtmiPhyLib.inf | 64 ++++ Platforms/Marvell/Marvell.dec | 11 + 14 files changed, 863 insertions(+), 7 deletions(-) create mode 100644 Documentation/Marvell/PortingGuide/Reset.txt create mode 100644 Documentation/Marvell/PortingGuide/Utmi.txt create mode 100644 Platforms/Marvell/Include/Library/UtmiPhyLib.h create mode 100644 Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.c create mode 100644 Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf create mode 100644 Platforms/Marvell/Library/UtmiPhyLib/UtmiPhyLib.c create mode 100644 Platforms/Marvell/Library/UtmiPhyLib/UtmiPhyLib.h create mode 100644 Platforms/Marvell/Library/UtmiPhyLib/UtmiPhyLib.inf
From: Bartosz Szczepanek bsz@semihalf.com
MvResetSystemLib implements functionality required to restart the platform. This approach implements Reset in a way that is compatible with ResetSystem runtime service.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Bartosz Szczepanek bsz@semihalf.com Signed-off-by: Jan Dabros jsd@semihalf.com Signed-off-by: Marcin Wojtas mw@semihalf.com --- Documentation/Marvell/PortingGuide/Reset.txt | 7 + .../Library/ResetSystemLib/MvResetSystemLib.c | 159 +++++++++++++++++++++ .../Library/ResetSystemLib/MvResetSystemLib.inf | 58 ++++++++ Platforms/Marvell/Marvell.dec | 4 + 4 files changed, 228 insertions(+) create mode 100644 Documentation/Marvell/PortingGuide/Reset.txt create mode 100644 Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.c create mode 100644 Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf
diff --git a/Documentation/Marvell/PortingGuide/Reset.txt b/Documentation/Marvell/PortingGuide/Reset.txt new file mode 100644 index 0000000..30dec86 --- /dev/null +++ b/Documentation/Marvell/PortingGuide/Reset.txt @@ -0,0 +1,7 @@ +MarvellResetSystemLib configuration +----------------------------------- +This simple library allows to mask given bits in given reg at UEFI 'reset' +command call. These variables are configurable through PCDs: + + gMarvellTokenSpaceGuid.PcdResetRegAddress + gMarvellTokenSpaceGuid.PcdResetRegMask diff --git a/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.c b/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.c new file mode 100644 index 0000000..46e07ae --- /dev/null +++ b/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.c @@ -0,0 +1,159 @@ +/******************************************************************************** +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 <Uefi.h> + +#include <Library/BaseLib.h> +#include <Library/DebugLib.h> +#include <Library/DxeServicesTableLib.h> +#include <Library/IoLib.h> +#include <Library/UefiLib.h> +#include <Library/UefiBootServicesTableLib.h> +#include <Library/UefiRuntimeLib.h> +#include <Library/UefiRuntimeServicesTableLib.h> + +#include <Guid/EventGroup.h> + +STATIC EFI_EVENT mResetSystemVirtualAddrChangeEvent; +STATIC UINT64 mAddress; + +STATIC +VOID +EFIAPI +LibResetSystemVirtualNotifyEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + // + // Convert physical address to virtual address. + // + EfiConvertPointer (0x0, (VOID**)&mAddress); + return; +} + +/** + Resets the entire platform. + + @param ResetType The type of reset to perform. + @param ResetStatus The status code for the reset. + @param DataSize The size, in bytes, of WatchdogData. + @param ResetData For a ResetType of EfiResetCold, EfiResetWarm, + or EfiResetShutdown the data buffer starts with + a Null-terminated Unicode string, optionally + followed by additional binary data. +**/ +EFI_STATUS +EFIAPI +LibResetSystem ( + IN EFI_RESET_TYPE ResetType, + IN EFI_STATUS ResetStatus, + IN UINTN DataSize, + IN VOID *ResetData OPTIONAL + ) +{ + UINT32 Data; + + switch (ResetType) { + case EfiResetCold: + case EfiResetWarm: + Data = MmioRead32 (mAddress); + Data &= ~PcdGet32 (PcdResetRegMask); + MmioWrite32 (mAddress, Data); + break; + case EfiResetShutdown: + // + // Currently there is no support for power-off platform + // + break; + default: + break; + } + + return EFI_DEVICE_ERROR; +} + +EFI_STATUS +EFIAPI +LibInitializeResetSystem ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + UINT64 Alignment; + EFI_STATUS Status; + + mAddress = PcdGet64 (PcdResetRegAddress); + + Alignment = ~(SIZE_64KB - 1); + // + // Add 64KB aligned and 64KB long memory space + // + Status = gDS->AddMemorySpace ( + EfiGcdMemoryTypeMemoryMappedIo, + mAddress & Alignment, SIZE_64KB, + EFI_MEMORY_UC | EFI_MEMORY_RUNTIME + ); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + return Status; + } + + // + // Mark 64KB aligned and 64KB long memory space as runtime + // + Status = gDS->SetMemorySpaceAttributes (mAddress & Alignment, SIZE_64KB, + EFI_MEMORY_UC | EFI_MEMORY_RUNTIME); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + return Status; + } + + // + // Register for the virtual address change event + // + Status = gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, + LibResetSystemVirtualNotifyEvent, + NULL, + &gEfiEventVirtualAddressChangeGuid, + &mResetSystemVirtualAddrChangeEvent + ); + ASSERT_EFI_ERROR (Status); + + return Status; +} diff --git a/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf b/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf new file mode 100644 index 0000000..87fff57 --- /dev/null +++ b/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf @@ -0,0 +1,58 @@ +# 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 = Reset + FILE_GUID = 9d1373c0-6fac-432c-88e7-818744dc45d9 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = EfiResetSystemLib + +[Sources.common] + MvResetSystemLib.c + +[Packages] + MdePkg/MdePkg.dec + OpenPlatformPkg/Platforms/Marvell/Marvell.dec + +[LibraryClasses] + DebugLib + DxeServicesTableLib + IoLib + UefiBootServicesTableLib + UefiLib + UefiRuntimeLib + +[Pcd] + gMarvellTokenSpaceGuid.PcdResetRegAddress + gMarvellTokenSpaceGuid.PcdResetRegMask diff --git a/Platforms/Marvell/Marvell.dec b/Platforms/Marvell/Marvell.dec index 31236a3..0044da0 100644 --- a/Platforms/Marvell/Marvell.dec +++ b/Platforms/Marvell/Marvell.dec @@ -193,6 +193,10 @@ gMarvellTokenSpaceGuid.PcdPhyDeviceIds|{ 0 }|VOID*|0x3000095 gMarvellTokenSpaceGuid.PcdPhyStartupAutoneg|FALSE|BOOLEAN|0x3000070
+#ResetLib + gMarvellTokenSpaceGuid.PcdResetRegAddress|0|UINT64|0x40000050 + gMarvellTokenSpaceGuid.PcdResetRegMask|0|UINT32|0x4000051 + [Protocols] gMarvellEepromProtocolGuid = { 0xcd728a1f, 0x45b5, 0x4feb, { 0x98, 0xc8, 0x31, 0x3d, 0xa8, 0x11, 0x74, 0x62 }} gMarvellMdioProtocolGuid = { 0x0d728a1f, 0x45b5, 0x4feb, { 0x98, 0xc8, 0x31, 0x3d, 0xa8, 0x11, 0x74, 0x62 }}
On Mon, Oct 17, 2016 at 12:28:01PM +0200, Marcin Wojtas wrote:
From: Bartosz Szczepanek bsz@semihalf.com
MvResetSystemLib implements functionality required to restart the platform. This approach implements Reset in a way that is compatible with ResetSystem runtime service.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Bartosz Szczepanek bsz@semihalf.com Signed-off-by: Jan Dabros jsd@semihalf.com Signed-off-by: Marcin Wojtas mw@semihalf.com
Documentation/Marvell/PortingGuide/Reset.txt | 7 + .../Library/ResetSystemLib/MvResetSystemLib.c | 159 +++++++++++++++++++++ .../Library/ResetSystemLib/MvResetSystemLib.inf | 58 ++++++++ Platforms/Marvell/Marvell.dec | 4 + 4 files changed, 228 insertions(+) create mode 100644 Documentation/Marvell/PortingGuide/Reset.txt create mode 100644 Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.c create mode 100644 Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf
diff --git a/Documentation/Marvell/PortingGuide/Reset.txt b/Documentation/Marvell/PortingGuide/Reset.txt new file mode 100644 index 0000000..30dec86 --- /dev/null +++ b/Documentation/Marvell/PortingGuide/Reset.txt @@ -0,0 +1,7 @@ +MarvellResetSystemLib configuration +----------------------------------- +This simple library allows to mask given bits in given reg at UEFI 'reset' +command call. These variables are configurable through PCDs:
- gMarvellTokenSpaceGuid.PcdResetRegAddress
- gMarvellTokenSpaceGuid.PcdResetRegMask
Happy with the patch on the whole, but this jumped out at me on this pass of reading through: What bits are we masking here, and why are we expecting them to change between different platforms using the same driver?
/ Leif
diff --git a/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.c b/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.c new file mode 100644 index 0000000..46e07ae --- /dev/null +++ b/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.c @@ -0,0 +1,159 @@ +/******************************************************************************** +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 <Uefi.h>
+#include <Library/BaseLib.h> +#include <Library/DebugLib.h> +#include <Library/DxeServicesTableLib.h> +#include <Library/IoLib.h> +#include <Library/UefiLib.h> +#include <Library/UefiBootServicesTableLib.h> +#include <Library/UefiRuntimeLib.h> +#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Guid/EventGroup.h>
+STATIC EFI_EVENT mResetSystemVirtualAddrChangeEvent; +STATIC UINT64 mAddress;
+STATIC +VOID +EFIAPI +LibResetSystemVirtualNotifyEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
+{
- //
- // Convert physical address to virtual address.
- //
- EfiConvertPointer (0x0, (VOID**)&mAddress);
- return;
+}
+/**
- Resets the entire platform.
- @param ResetType The type of reset to perform.
- @param ResetStatus The status code for the reset.
- @param DataSize The size, in bytes, of WatchdogData.
- @param ResetData For a ResetType of EfiResetCold, EfiResetWarm,
or EfiResetShutdown the data buffer starts with
a Null-terminated Unicode string, optionally
followed by additional binary data.
+**/ +EFI_STATUS +EFIAPI +LibResetSystem (
- IN EFI_RESET_TYPE ResetType,
- IN EFI_STATUS ResetStatus,
- IN UINTN DataSize,
- IN VOID *ResetData OPTIONAL
- )
+{
- UINT32 Data;
- switch (ResetType) {
- case EfiResetCold:
- case EfiResetWarm:
- Data = MmioRead32 (mAddress);
- Data &= ~PcdGet32 (PcdResetRegMask);
- MmioWrite32 (mAddress, Data);
- break;
- case EfiResetShutdown:
- //
- // Currently there is no support for power-off platform
- //
- break;
- default:
- break;
- }
- return EFI_DEVICE_ERROR;
+}
+EFI_STATUS +EFIAPI +LibInitializeResetSystem (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
+{
- UINT64 Alignment;
- EFI_STATUS Status;
- mAddress = PcdGet64 (PcdResetRegAddress);
- Alignment = ~(SIZE_64KB - 1);
- //
- // Add 64KB aligned and 64KB long memory space
- //
- Status = gDS->AddMemorySpace (
EfiGcdMemoryTypeMemoryMappedIo,
mAddress & Alignment, SIZE_64KB,
EFI_MEMORY_UC | EFI_MEMORY_RUNTIME
);
- if (EFI_ERROR (Status)) {
- ASSERT_EFI_ERROR (Status);
- return Status;
- }
- //
- // Mark 64KB aligned and 64KB long memory space as runtime
- //
- Status = gDS->SetMemorySpaceAttributes (mAddress & Alignment, SIZE_64KB,
- EFI_MEMORY_UC | EFI_MEMORY_RUNTIME);
- if (EFI_ERROR (Status)) {
- ASSERT_EFI_ERROR (Status);
- return Status;
- }
- //
- // Register for the virtual address change event
- //
- Status = gBS->CreateEventEx (
EVT_NOTIFY_SIGNAL,
TPL_NOTIFY,
LibResetSystemVirtualNotifyEvent,
NULL,
&gEfiEventVirtualAddressChangeGuid,
&mResetSystemVirtualAddrChangeEvent
);
- ASSERT_EFI_ERROR (Status);
- return Status;
+} diff --git a/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf b/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf new file mode 100644 index 0000000..87fff57 --- /dev/null +++ b/Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf @@ -0,0 +1,58 @@ +# 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 = Reset
- FILE_GUID = 9d1373c0-6fac-432c-88e7-818744dc45d9
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = EfiResetSystemLib
+[Sources.common]
- MvResetSystemLib.c
+[Packages]
- MdePkg/MdePkg.dec
- OpenPlatformPkg/Platforms/Marvell/Marvell.dec
+[LibraryClasses]
- DebugLib
- DxeServicesTableLib
- IoLib
- UefiBootServicesTableLib
- UefiLib
- UefiRuntimeLib
+[Pcd]
- gMarvellTokenSpaceGuid.PcdResetRegAddress
- gMarvellTokenSpaceGuid.PcdResetRegMask
diff --git a/Platforms/Marvell/Marvell.dec b/Platforms/Marvell/Marvell.dec index 31236a3..0044da0 100644 --- a/Platforms/Marvell/Marvell.dec +++ b/Platforms/Marvell/Marvell.dec @@ -193,6 +193,10 @@ gMarvellTokenSpaceGuid.PcdPhyDeviceIds|{ 0 }|VOID*|0x3000095 gMarvellTokenSpaceGuid.PcdPhyStartupAutoneg|FALSE|BOOLEAN|0x3000070 +#ResetLib
- gMarvellTokenSpaceGuid.PcdResetRegAddress|0|UINT64|0x40000050
- gMarvellTokenSpaceGuid.PcdResetRegMask|0|UINT32|0x4000051
[Protocols] gMarvellEepromProtocolGuid = { 0xcd728a1f, 0x45b5, 0x4feb, { 0x98, 0xc8, 0x31, 0x3d, 0xa8, 0x11, 0x74, 0x62 }} gMarvellMdioProtocolGuid = { 0x0d728a1f, 0x45b5, 0x4feb, { 0x98, 0xc8, 0x31, 0x3d, 0xa8, 0x11, 0x74, 0x62 }} -- 1.8.3.1
Hi Leif,
2016-10-17 18:02 GMT+02:00 Leif Lindholm leif.lindholm@linaro.org:
On Mon, Oct 17, 2016 at 12:28:01PM +0200, Marcin Wojtas wrote:
From: Bartosz Szczepanek bsz@semihalf.com
MvResetSystemLib implements functionality required to restart the platform. This approach implements Reset in a way that is compatible with ResetSystem runtime service.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Bartosz Szczepanek bsz@semihalf.com Signed-off-by: Jan Dabros jsd@semihalf.com Signed-off-by: Marcin Wojtas mw@semihalf.com
Documentation/Marvell/PortingGuide/Reset.txt | 7 + .../Library/ResetSystemLib/MvResetSystemLib.c | 159 +++++++++++++++++++++ .../Library/ResetSystemLib/MvResetSystemLib.inf | 58 ++++++++ Platforms/Marvell/Marvell.dec | 4 + 4 files changed, 228 insertions(+) create mode 100644 Documentation/Marvell/PortingGuide/Reset.txt create mode 100644 Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.c create mode 100644 Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf
diff --git a/Documentation/Marvell/PortingGuide/Reset.txt b/Documentation/Marvell/PortingGuide/Reset.txt new file mode 100644 index 0000000..30dec86 --- /dev/null +++ b/Documentation/Marvell/PortingGuide/Reset.txt @@ -0,0 +1,7 @@ +MarvellResetSystemLib configuration +----------------------------------- +This simple library allows to mask given bits in given reg at UEFI 'reset' +command call. These variables are configurable through PCDs:
- gMarvellTokenSpaceGuid.PcdResetRegAddress
- gMarvellTokenSpaceGuid.PcdResetRegMask
Happy with the patch on the whole, but this jumped out at me on this pass of reading through: What bits are we masking here, and why are we expecting them to change between different platforms using the same driver?
These are platform specific bits in reset register. They differ between various Marvell SoC's, so it's safer to keep it this way for future use.
Best regards, Marcin
Thanks, series pushed.
/ Leif
On Mon, Oct 17, 2016 at 06:16:09PM +0200, Marcin Wojtas wrote:
Hi Leif,
2016-10-17 18:02 GMT+02:00 Leif Lindholm leif.lindholm@linaro.org:
On Mon, Oct 17, 2016 at 12:28:01PM +0200, Marcin Wojtas wrote:
From: Bartosz Szczepanek bsz@semihalf.com
MvResetSystemLib implements functionality required to restart the platform. This approach implements Reset in a way that is compatible with ResetSystem runtime service.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Bartosz Szczepanek bsz@semihalf.com Signed-off-by: Jan Dabros jsd@semihalf.com Signed-off-by: Marcin Wojtas mw@semihalf.com
Documentation/Marvell/PortingGuide/Reset.txt | 7 + .../Library/ResetSystemLib/MvResetSystemLib.c | 159 +++++++++++++++++++++ .../Library/ResetSystemLib/MvResetSystemLib.inf | 58 ++++++++ Platforms/Marvell/Marvell.dec | 4 + 4 files changed, 228 insertions(+) create mode 100644 Documentation/Marvell/PortingGuide/Reset.txt create mode 100644 Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.c create mode 100644 Platforms/Marvell/Library/ResetSystemLib/MvResetSystemLib.inf
diff --git a/Documentation/Marvell/PortingGuide/Reset.txt b/Documentation/Marvell/PortingGuide/Reset.txt new file mode 100644 index 0000000..30dec86 --- /dev/null +++ b/Documentation/Marvell/PortingGuide/Reset.txt @@ -0,0 +1,7 @@ +MarvellResetSystemLib configuration +----------------------------------- +This simple library allows to mask given bits in given reg at UEFI 'reset' +command call. These variables are configurable through PCDs:
- gMarvellTokenSpaceGuid.PcdResetRegAddress
- gMarvellTokenSpaceGuid.PcdResetRegMask
Happy with the patch on the whole, but this jumped out at me on this pass of reading through: What bits are we masking here, and why are we expecting them to change between different platforms using the same driver?
These are platform specific bits in reset register. They differ between various Marvell SoC's, so it's safer to keep it this way for future use.
Best regards, Marcin