Add support for using the Armv8-A CRC32 feature

The Armv8-A architecture specifies a CRC32 hardware feature, it can be
used through an intrinsic specified by ACLE. However, the HW feature is
mandatory only starting from v8.1, so for v8.0 CPUs we have to check its
availability. This commit implements a mechanism to do this check for
both Linux and SP environments, and override the default software CRC32
implementation when the HW feature is present.

Signed-off-by: Balint Dobszay <balint.dobszay@arm.com>
Change-Id: Ia15fe1db9890b8aa076deec44c71639a4382cb35
diff --git a/deployments/block-storage/env/commonsp/block_storage_sp.c b/deployments/block-storage/env/commonsp/block_storage_sp.c
index ccefaaa..012250c 100644
--- a/deployments/block-storage/env/commonsp/block_storage_sp.c
+++ b/deployments/block-storage/env/commonsp/block_storage_sp.c
@@ -3,6 +3,7 @@
  * Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
  */
 
+#include "common/crc32/crc32.h"
 #include "rpc/ffarpc/endpoint/ffarpc_call_ep.h"
 #include "protocols/rpc/common/packed-c/status.h"
 #include "config/ramstore/config_ramstore.h"
@@ -43,6 +44,8 @@
 		goto fatal_error;
 	}
 
+	crc32_init();
+
 	/* Initialise the service provider and backend block store */
 	backend = block_store_factory_create();
 	if (!backend) {
diff --git a/deployments/block-storage/env/commonsp/block_storage_sp.cmake b/deployments/block-storage/env/commonsp/block_storage_sp.cmake
index 0dea2a8..d55474c 100644
--- a/deployments/block-storage/env/commonsp/block_storage_sp.cmake
+++ b/deployments/block-storage/env/commonsp/block_storage_sp.cmake
@@ -14,6 +14,7 @@
 add_components(TARGET "block-storage"
 	BASE_DIR ${TS_ROOT}
 	COMPONENTS
+		"components/common/crc32"
 		"components/common/fdt"
 		"components/common/trace"
 		"components/common/utils"
diff --git a/deployments/block-storage/infra/semihosted.cmake b/deployments/block-storage/infra/semihosted.cmake
index ec10a0e..e9637ad 100644
--- a/deployments/block-storage/infra/semihosted.cmake
+++ b/deployments/block-storage/infra/semihosted.cmake
@@ -25,11 +25,10 @@
 		"components/media/volume/index"
 		"components/media/volume/base_io_dev"
 		"components/media/volume/block_volume"
-		"components/common/crc32/native"
 )
 
 #-------------------------------------------------------------------------------
 #  This infrastructure depends on platform specific drivers
 #
 #-------------------------------------------------------------------------------
-add_platform(TARGET "block-storage")
\ No newline at end of file
+add_platform(TARGET "block-storage")
diff --git a/deployments/component-test/component-test.cmake b/deployments/component-test/component-test.cmake
index 88e28b1..2724ccf 100644
--- a/deployments/component-test/component-test.cmake
+++ b/deployments/component-test/component-test.cmake
@@ -36,7 +36,7 @@
 		"components/common/trace"
 		"components/common/endian"
 		"components/common/endian/test"
-		"components/common/crc32/native"
+		"components/common/crc32"
 		"components/common/crc32/test"
 		"components/config/ramstore"
 		"components/config/ramstore/test"
diff --git a/deployments/fwu/env/commonsp/fwu_sp.c b/deployments/fwu/env/commonsp/fwu_sp.c
index bf7cbe8..0dce92e 100644
--- a/deployments/fwu/env/commonsp/fwu_sp.c
+++ b/deployments/fwu/env/commonsp/fwu_sp.c
@@ -5,6 +5,7 @@
 
 #include <stddef.h>
 
+#include "common/crc32/crc32.h"
 #include "config/loader/sp/sp_config_loader.h"
 #include "config/ramstore/config_ramstore.h"
 #include "media/volume/factory/volume_factory.h"
@@ -65,6 +66,8 @@
 		goto fatal_error;
 	}
 
+	crc32_init();
+
 	/* Configuration - discovers required volumes and installers */
 	if (!configure_for_platform()) {
 		EMSG("Failed to configure for platform");
diff --git a/deployments/fwu/env/commonsp/fwu_sp.cmake b/deployments/fwu/env/commonsp/fwu_sp.cmake
index 20d62b8..875af62 100644
--- a/deployments/fwu/env/commonsp/fwu_sp.cmake
+++ b/deployments/fwu/env/commonsp/fwu_sp.cmake
@@ -17,7 +17,7 @@
 		"components/common/fdt"
 		"components/common/trace"
 		"components/common/utils"
-		"components/common/crc32/native"
+		"components/common/crc32"
 		"components/config/ramstore"
 		"components/config/loader/sp"
 		"components/messaging/ffa/libsp"
diff --git a/deployments/libts/linux-pc/CMakeLists.txt b/deployments/libts/linux-pc/CMakeLists.txt
index a9dd75c..3db5585 100644
--- a/deployments/libts/linux-pc/CMakeLists.txt
+++ b/deployments/libts/linux-pc/CMakeLists.txt
@@ -54,7 +54,7 @@
 		"components/common/endian"
 		"components/common/utils"
 		"components/common/trace"
-		"components/common/crc32/native"
+		"components/common/crc32"
 		"components/config/ramstore"
 		"components/service/common/include"
 		"components/service/common/client"
diff --git a/deployments/ts-service-test/linux-pc/CMakeLists.txt b/deployments/ts-service-test/linux-pc/CMakeLists.txt
index c69437f..60db229 100644
--- a/deployments/ts-service-test/linux-pc/CMakeLists.txt
+++ b/deployments/ts-service-test/linux-pc/CMakeLists.txt
@@ -84,8 +84,8 @@
 add_components(
 	TARGET "ts-service-test"
 	BASE_DIR ${TS_ROOT}
-    COMPONENTS
-		"components/common/crc32/native"
+	COMPONENTS
+		"components/common/crc32"
 		"components/service/test_runner/client/cpp"
 		"components/service/test_runner/test/service"
 		"components/service/smm_variable/client/cpp"