From c885d5c84d94cd82a80e074b2d6e6b5c04796cde Mon Sep 17 00:00:00 2001 From: Manish V Badarkhe Date: Fri, 2 Jul 2021 20:29:56 +0100 Subject: [PATCH] refactor(hw_crc32): renamed hw_crc32 to tf_crc32 Renamed hw_crc32 to tf_crc32 to make the file and function name more generic so that the same name can be used in upcoming software CRC32 implementation. Change-Id: Idff8f70c50ca700a4328a27b49d5e1f14d2095eb Signed-off-by: Manish V Badarkhe --- common/{hw_crc32.c => tf_crc32.c} | 5 +++-- drivers/fwu/fwu.c | 4 ++-- include/common/{hw_crc32.h => tf_crc32.h} | 8 ++++---- plat/arm/common/arm_common.mk | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) rename common/{hw_crc32.c => tf_crc32.c} (86%) rename include/common/{hw_crc32.h => tf_crc32.h} (62%) diff --git a/common/hw_crc32.c b/common/tf_crc32.c similarity index 86% rename from common/hw_crc32.c rename to common/tf_crc32.c index a8731da17..b33d36ea2 100644 --- a/common/hw_crc32.c +++ b/common/tf_crc32.c @@ -9,8 +9,9 @@ #include #include +#include -/* hw_crc32 - compute CRC using Arm intrinsic function +/* compute CRC using Arm intrinsic function * * This function is useful for the platforms with the CPU ARMv8.0 * (with CRC instructions supported), and onwards. @@ -23,7 +24,7 @@ * * Return calculated CRC value */ -uint32_t hw_crc32(uint32_t crc, const unsigned char *buf, size_t size) +uint32_t tf_crc32(uint32_t crc, const unsigned char *buf, size_t size) { assert(buf != NULL); diff --git a/drivers/fwu/fwu.c b/drivers/fwu/fwu.c index f155519af..7cb4c2982 100644 --- a/drivers/fwu/fwu.c +++ b/drivers/fwu/fwu.c @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include #include @@ -37,7 +37,7 @@ static int fwu_metadata_crc_check(void) { unsigned char *data = (unsigned char *)&metadata; - uint32_t calc_crc = hw_crc32(0U, data + sizeof(metadata.crc_32), + uint32_t calc_crc = tf_crc32(0U, data + sizeof(metadata.crc_32), (sizeof(metadata) - sizeof(metadata.crc_32))); diff --git a/include/common/hw_crc32.h b/include/common/tf_crc32.h similarity index 62% rename from include/common/hw_crc32.h rename to include/common/tf_crc32.h index 0d14d5739..38c56a50d 100644 --- a/include/common/hw_crc32.h +++ b/include/common/tf_crc32.h @@ -4,13 +4,13 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef HW_CRC32_H -#define HW_CRC32_H +#ifndef TF_CRC32_H +#define TF_CRC32_H #include #include /* compute CRC using Arm intrinsic function */ -uint32_t hw_crc32(uint32_t crc, const unsigned char *buf, size_t size); +uint32_t tf_crc32(uint32_t crc, const unsigned char *buf, size_t size); -#endif /* HW_CRC32_H */ +#endif /* TF_CRC32_H */ diff --git a/plat/arm/common/arm_common.mk b/plat/arm/common/arm_common.mk index 262174f77..4d5e8b4b1 100644 --- a/plat/arm/common/arm_common.mk +++ b/plat/arm/common/arm_common.mk @@ -242,7 +242,7 @@ BL2_SOURCES += drivers/delay_timer/delay_timer.c \ drivers/io/io_storage.c \ plat/arm/common/arm_bl2_setup.c \ plat/arm/common/arm_err.c \ - common/hw_crc32.c \ + common/tf_crc32.c \ ${ARM_IO_SOURCES} # Firmware Configuration Framework sources