feat(plat/sgi): introduce platform variant build option

Neoverse reference design platforms can have two or more variants that
differ in core count, cluster count or other peripherals. To allow reuse
of platform code across all the variants of a platform, introduce build
option CSS_SGI_PLATFORM_VARIANT for Arm Neoverse reference design
platforms. The range of allowed values for the build option is platform
specific.

Signed-off-by: Shriram K <shriram.k@arm.com>
Change-Id: I4559527987ee87f0f75a84f905746b1e430a2a53
diff --git a/plat/arm/rdinfra/rdn1edge/platform.mk b/plat/arm/rdinfra/rdn1edge/platform.mk
index 3e25a04..d44e5a0 100644
--- a/plat/arm/rdinfra/rdn1edge/platform.mk
+++ b/plat/arm/rdinfra/rdn1edge/platform.mk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2019, Arm Limited. All rights reserved.
+# Copyright (c) 2019-2022, Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -11,3 +11,8 @@
 PLAT_SOURCES		+=	plat/arm/rdinfra/rdn1edge/topology.c
 
 PLAT_TESTS_SKIP_LIST	:=	plat/arm/rdinfra/rdn1edge/tests_to_skip.txt
+
+ifdef CSS_SGI_PLATFORM_VARIANT
+$(error "CSS_SGI_PLATFORM_VARIANT should not be set for RD-N1-Edge, \
+    currently set to ${CSS_SGI_PLATFORM_VARIANT}.")
+endif
diff --git a/plat/arm/sgi/common/sgi_common.mk b/plat/arm/sgi/common/sgi_common.mk
index f19445f..45d8485 100644
--- a/plat/arm/sgi/common/sgi_common.mk
+++ b/plat/arm/sgi/common/sgi_common.mk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2018, Arm Limited. All rights reserved.
+# Copyright (c) 2018-2022, Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -22,3 +22,6 @@
 ifeq (${USE_NVM},1)
 $(error "USE_NVM is not supported on SGI platforms")
 endif
+
+# Pass CSS_SGI_PLATFORM_VARIANT flag to the build system
+$(eval $(call add_define,TFTF_DEFINES,CSS_SGI_PLATFORM_VARIANT))
diff --git a/plat/arm/sgi/sgi575/platform.mk b/plat/arm/sgi/sgi575/platform.mk
index 8472d7e..7c8194f 100644
--- a/plat/arm/sgi/sgi575/platform.mk
+++ b/plat/arm/sgi/sgi575/platform.mk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2018, Arm Limited. All rights reserved.
+# Copyright (c) 2018-2022, Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -11,3 +11,8 @@
 PLAT_SOURCES		+=	plat/arm/sgi/sgi575/sgi575_topology.c
 
 PLAT_TESTS_SKIP_LIST	:=	plat/arm/sgi/sgi575/tests_to_skip.txt
+
+ifdef CSS_SGI_PLATFORM_VARIANT
+$(error "CSS_SGI_PLATFORM_VARIANT should not be set for SGI-575, \
+    currently set to ${CSS_SGI_PLATFORM_VARIANT}.")
+endif