plat/arm/sgi: Use platform specific functions to get platform ids

Add two new functions 'plat_arm_sgi_get_platform_id' and
'plat_arm_sgi_get_config_id' which will be implemented by all the
SGI platforms. These functions can be used to determine the part
number and configuration id of the SGI platforms.

In BL2, these functions are used to populate the 'system-id' node.
In BL31, these functions are used to populate the 'sgi_plat_info_t'
structure with the part number and configuration id of the platform.

Change-Id: I3bacda933527724a3b4074ad4ed5b53a81ea4689
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
diff --git a/plat/arm/css/sgi/sgi_bl31_setup.c b/plat/arm/css/sgi/sgi_bl31_setup.c
index d44f89c..a254388 100644
--- a/plat/arm/css/sgi/sgi_bl31_setup.c
+++ b/plat/arm/css/sgi/sgi_bl31_setup.c
@@ -42,53 +42,11 @@
 		panic();
 };
 
-/*******************************************************************************
- * This function sets the sgi_platform_id and sgi_config_id
- ******************************************************************************/
-int sgi_identify_platform(unsigned long hw_config)
-{
-	void *fdt;
-	int nodeoffset;
-	const unsigned int *property;
-
-	fdt = (void *)hw_config;
-
-	/* Check the validity of the fdt */
-	assert(fdt_check_header(fdt) == 0);
-
-	nodeoffset = fdt_subnode_offset(fdt, 0, "system-id");
-	if (nodeoffset < 0) {
-		ERROR("Failed to get system-id node offset\n");
-		return -1;
-	}
-
-	property = fdt_getprop(fdt, nodeoffset, "platform-id", NULL);
-	if (property == NULL) {
-		ERROR("Failed to get platform-id property\n");
-		return -1;
-	}
-
-	sgi_plat_info.platform_id = fdt32_to_cpu(*property);
-
-	property = fdt_getprop(fdt, nodeoffset, "config-id", NULL);
-	if (property == NULL) {
-		ERROR("Failed to get config-id property\n");
-		return -1;
-	}
-
-	sgi_plat_info.config_id = fdt32_to_cpu(*property);
-
-	return 0;
-}
-
 void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
 				u_register_t arg2, u_register_t arg3)
 {
-	int ret;
-
-	ret = sgi_identify_platform(arg2);
-	if (ret == -1)
-		panic();
+	sgi_plat_info.platform_id = plat_arm_sgi_get_platform_id();
+	sgi_plat_info.config_id = plat_arm_sgi_get_config_id();
 
 	arm_bl31_early_platform_setup((void *)arg0, arg1, arg2, (void *)arg3);
 }