[PATCH V2 1/4] Platform/NXP: Make SoC version log in ConfigurationManager generic


Sunny Wang
 

Looks good.
Just have some comments mentioned Patch 0/4 about moving/renaming file/folder for synchronizing with NXP LSDK opensource https://source.codeaurora.org/external/qoriq/qoriq-components/edk2-platforms.

Best Regards,
Sunny Wang

-----Original Message-----
From: Vikas Singh <vikas.singh@puresoftware.com>
Sent: Friday, June 18, 2021 11:28 PM
To: devel@edk2.groups.io
Cc: Sami Mujawar <Sami.Mujawar@arm.com>; leif@nuviainc.com; Meenakshi Aggarwal (meenakshi.aggarwal@nxp.com) <meenakshi.aggarwal@nxp.com>; Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>; V Sethi (v.sethi@nxp.com) <v.sethi@nxp.com>; arokia.samy <arokia.samy@puresoftware.com>; kuldip.dwivedi@puresoftware.com; Ard Biesheuvel <Ard.Biesheuvel@arm.com>; vikas.singh@nxp.com; Sunny Wang <Sunny.Wang@arm.com>
Subject: [PATCH V2 1/4] Platform/NXP: Make SoC version log in ConfigurationManager generic

This patch replaces the logic in ConfigurationManager to print platform
name based on platform ID with a simple #define PLAT_SOC_NAME defined in
platform headers.
This also removes duplication of the SVR_LX2160A, SVR_SOC_VER, SVR_MAJOR
and SVR_MINOR macro definitions between SoC headers and platform headers.

Signed-off-by: Vikas Singh <vikas.singh@puresoftware.com>
---
Platform/NXP/ConfigurationManagerPkg/ConfigurationManagerDxe/ConfigurationManager.c | 11 ++++-------
Platform/NXP/LX2160aRdbPkg/Include/Platform.h | 8 ++------
Silicon/NXP/LX2160A/LX2160A.dsc.inc | 3 ++-
3 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/Platform/NXP/ConfigurationManagerPkg/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/NXP/ConfigurationManagerPkg/ConfigurationManagerDxe/ConfigurationManager.c
index 80ce8412c4..39376d900b 100644
--- a/Platform/NXP/ConfigurationManagerPkg/ConfigurationManagerDxe/ConfigurationManager.c
+++ b/Platform/NXP/ConfigurationManagerPkg/ConfigurationManagerDxe/ConfigurationManager.c
@@ -2,7 +2,7 @@
Configuration Manager Dxe



Copyright 2020 NXP

- Copyright 2020 Puresoftware Ltd

+ Copyright 2020-2021 Puresoftware Ltd



SPDX-License-Identifier: BSD-2-Clause-Patent



@@ -25,6 +25,7 @@
*/

#include "ConfigurationManager.h"

#include <Library/SocLib.h>

+#include <Chassis.h>



/** The platform configuration repository information.

*/

@@ -170,12 +171,8 @@ InitializePlatformRepository (
PlatformRepo = This->PlatRepoInfo;



Svr = SocGetSvr ();

- if (SVR_SOC_VER(Svr) == SVR_LX2160A) {

- PlatformRepo->FslBoardRevision = SVR_MAJOR(Svr);

- DEBUG ((DEBUG_INFO, "Fsl : SoC LX2160A Rev = 0x%x\n", PlatformRepo->FslBoardRevision));

- } else {

- DEBUG ((DEBUG_INFO, "Fsl : SoC Unknown Rev = 0x%x\n", PlatformRepo->FslBoardRevision));

- }

+ PlatformRepo->FslBoardRevision = SVR_MAJOR(Svr);

+ DEBUG ((DEBUG_INFO, "Fsl : SoC = %s Rev = 0x%x\n", PLAT_SOC_NAME, PlatformRepo->FslBoardRevision));



return EFI_SUCCESS;

}

diff --git a/Platform/NXP/LX2160aRdbPkg/Include/Platform.h b/Platform/NXP/LX2160aRdbPkg/Include/Platform.h
index 76a41d4369..f2e831f033 100644
--- a/Platform/NXP/LX2160aRdbPkg/Include/Platform.h
+++ b/Platform/NXP/LX2160aRdbPkg/Include/Platform.h
@@ -2,7 +2,7 @@
* Platform headers

*

* Copyright 2020 NXP

- * Copyright 2020 Puresoftware Ltd

+ * Copyright 2020-2021 Puresoftware Ltd

*

* SPDX-License-Identifier: BSD-2-Clause-Patent

*

@@ -15,11 +15,7 @@
#define EFI_ACPI_ARM_OEM_REVISION 0x00000000



// Soc defines

-#define SVR_SOC_VER(svr) (((svr) >> 8) & 0xFFFFFE)

-#define SVR_MAJOR(svr) (((svr) >> 4) & 0xf)

-#define SVR_MINOR(svr) (((svr) >> 0) & 0xf)

-

-#define SVR_LX2160A 0x873600

+#define PLAT_SOC_NAME "LX2160ARDB"



// PCLK

#define DCFG_BASE 0x1E00000

diff --git a/Silicon/NXP/LX2160A/LX2160A.dsc.inc b/Silicon/NXP/LX2160A/LX2160A.dsc.inc
index ea7e54fa89..15a06bea1f 100644
--- a/Silicon/NXP/LX2160A/LX2160A.dsc.inc
+++ b/Silicon/NXP/LX2160A/LX2160A.dsc.inc
@@ -2,7 +2,7 @@
# LX2160A Soc package.

#

# Copyright 2018-2020 NXP

-# Copyright 2020 Puresoftware Ltd

+# Copyright 2020-2021 Puresoftware Ltd

#

# SPDX-License-Identifier: BSD-2-Clause-Patent

#

@@ -70,6 +70,7 @@
Platform/NXP/ConfigurationManagerPkg/ConfigurationManagerDxe/ConfigurationManagerDxe.inf {

<BuildOptions>

*_*_*_PLATFORM_FLAGS = -I$(WORKSPACE)/Platform/NXP/LX2160aRdbPkg/Include

+ *_*_*_PLATFORM_FLAGS = -I$(WORKSPACE)/Silicon/NXP/Chassis3V2/Include

}

!endif



--
2.25.1

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


Vikas Singh
 

This patch replaces the logic in ConfigurationManager to print platform
name based on platform ID with a simple #define PLAT_SOC_NAME defined in
platform headers.
This also removes duplication of the SVR_LX2160A, SVR_SOC_VER, SVR_MAJOR
and SVR_MINOR macro definitions between SoC headers and platform headers.

Signed-off-by: Vikas Singh <vikas.singh@puresoftware.com>
---
Platform/NXP/ConfigurationManagerPkg/ConfigurationManagerDxe/Configuration=
Manager.c | 11 ++++-------
Platform/NXP/LX2160aRdbPkg/Include/Platform.h =
| 8 ++------
Silicon/NXP/LX2160A/LX2160A.dsc.inc =
| 3 ++-
3 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/Platform/NXP/ConfigurationManagerPkg/ConfigurationManagerDxe/C=
onfigurationManager.c b/Platform/NXP/ConfigurationManagerPkg/ConfigurationM=
anagerDxe/ConfigurationManager.c
index 80ce8412c4..39376d900b 100644
--- a/Platform/NXP/ConfigurationManagerPkg/ConfigurationManagerDxe/Configur=
ationManager.c
+++ b/Platform/NXP/ConfigurationManagerPkg/ConfigurationManagerDxe/Configur=
ationManager.c
@@ -2,7 +2,7 @@
Configuration Manager Dxe=0D
=0D
Copyright 2020 NXP=0D
- Copyright 2020 Puresoftware Ltd=0D
+ Copyright 2020-2021 Puresoftware Ltd=0D
=0D
SPDX-License-Identifier: BSD-2-Clause-Patent=0D
=0D
@@ -25,6 +25,7 @@
*/=0D
#include "ConfigurationManager.h"=0D
#include <Library/SocLib.h>=0D
+#include <Chassis.h>=0D
=0D
/** The platform configuration repository information.=0D
*/=0D
@@ -170,12 +171,8 @@ InitializePlatformRepository (
PlatformRepo =3D This->PlatRepoInfo;=0D
=0D
Svr =3D SocGetSvr ();=0D
- if (SVR_SOC_VER(Svr) =3D=3D SVR_LX2160A) {=0D
- PlatformRepo->FslBoardRevision =3D SVR_MAJOR(Svr);=0D
- DEBUG ((DEBUG_INFO, "Fsl : SoC LX2160A Rev =3D 0x%x\n", PlatformRepo->=
FslBoardRevision));=0D
- } else {=0D
- DEBUG ((DEBUG_INFO, "Fsl : SoC Unknown Rev =3D 0x%x\n", PlatformRepo->=
FslBoardRevision));=0D
- }=0D
+ PlatformRepo->FslBoardRevision =3D SVR_MAJOR(Svr);=0D
+ DEBUG ((DEBUG_INFO, "Fsl : SoC =3D %s Rev =3D 0x%x\n", PLAT_SOC_NAME, Pl=
atformRepo->FslBoardRevision));=0D
=0D
return EFI_SUCCESS;=0D
}=0D
diff --git a/Platform/NXP/LX2160aRdbPkg/Include/Platform.h b/Platform/NXP/L=
X2160aRdbPkg/Include/Platform.h
index 76a41d4369..f2e831f033 100644
--- a/Platform/NXP/LX2160aRdbPkg/Include/Platform.h
+++ b/Platform/NXP/LX2160aRdbPkg/Include/Platform.h
@@ -2,7 +2,7 @@
* Platform headers=0D
*=0D
* Copyright 2020 NXP=0D
- * Copyright 2020 Puresoftware Ltd=0D
+ * Copyright 2020-2021 Puresoftware Ltd=0D
*=0D
* SPDX-License-Identifier: BSD-2-Clause-Patent=0D
*=0D
@@ -15,11 +15,7 @@
#define EFI_ACPI_ARM_OEM_REVISION 0x00000000=0D
=0D
// Soc defines=0D
-#define SVR_SOC_VER(svr) (((svr) >> 8) & 0xFFFFFE)=0D
-#define SVR_MAJOR(svr) (((svr) >> 4) & 0xf)=0D
-#define SVR_MINOR(svr) (((svr) >> 0) & 0xf)=0D
-=0D
-#define SVR_LX2160A 0x873600=0D
+#define PLAT_SOC_NAME "LX2160ARDB"=0D
=0D
// PCLK=0D
#define DCFG_BASE 0x1E00000=0D
diff --git a/Silicon/NXP/LX2160A/LX2160A.dsc.inc b/Silicon/NXP/LX2160A/LX21=
60A.dsc.inc
index ea7e54fa89..15a06bea1f 100644
--- a/Silicon/NXP/LX2160A/LX2160A.dsc.inc
+++ b/Silicon/NXP/LX2160A/LX2160A.dsc.inc
@@ -2,7 +2,7 @@
# LX2160A Soc package.=0D
#=0D
# Copyright 2018-2020 NXP=0D
-# Copyright 2020 Puresoftware Ltd=0D
+# Copyright 2020-2021 Puresoftware Ltd=0D
#=0D
# SPDX-License-Identifier: BSD-2-Clause-Patent=0D
#=0D
@@ -70,6 +70,7 @@
Platform/NXP/ConfigurationManagerPkg/ConfigurationManagerDxe/Configurati=
onManagerDxe.inf {=0D
<BuildOptions>=0D
*_*_*_PLATFORM_FLAGS =3D -I$(WORKSPACE)/Platform/NXP/LX2160aRdbPkg/I=
nclude=0D
+ *_*_*_PLATFORM_FLAGS =3D -I$(WORKSPACE)/Silicon/NXP/Chassis3V2/Inclu=
de=0D
}=0D
!endif=0D
=0D
--=20
2.25.1