diff options
author | Manish V Badarkhe <Manish.Badarkhe@arm.com> | 2021-04-22 14:41:27 +0100 |
---|---|---|
committer | Manish V Badarkhe <Manish.Badarkhe@arm.com> | 2021-05-19 19:34:34 +0100 |
commit | a1cedadf73863ff103fecd64fa188334e1541337 (patch) | |
tree | 4e8b51fdf8bab46f4f4d8d488cbfef1e45d330ff /include | |
parent | 1e13c500a0351ac4b55d09a63f7008e2438550f8 (diff) | |
download | trusted-firmware-a-a1cedadf73863ff103fecd64fa188334e1541337.tar.gz |
feat(hw_crc): add support for HW computed CRC
Added support for HW computed CRC using Arm ACLE intrinsics.
These are built-in intrinsics available for ARMv8.1-A, and
onwards.
These intrinsics are enabled via '-march=armv8-a+crc' compile
switch for ARMv8-A (supports CRC instructions optionally).
HW CRC support is enabled unconditionally in BL2 for all Arm
platforms.
HW CRC calculation is verified offline to ensure a similar
result as its respective ZLib utility function.
HW CRC calculation support will be used in the upcoming
firmware update patches.
Change-Id: Ia2ae801f62d2003e89a9c3e6d77469b5312614b3
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/common/hw_crc32.h | 16 | ||||
-rw-r--r-- | include/lib/libc/arm_acle.h | 2 |
2 files changed, 18 insertions, 0 deletions
diff --git a/include/common/hw_crc32.h b/include/common/hw_crc32.h new file mode 100644 index 0000000000..0d14d57392 --- /dev/null +++ b/include/common/hw_crc32.h @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2021, Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef HW_CRC32_H +#define HW_CRC32_H + +#include <stddef.h> +#include <stdint.h> + +/* compute CRC using Arm intrinsic function */ +uint32_t hw_crc32(uint32_t crc, const unsigned char *buf, size_t size); + +#endif /* HW_CRC32_H */ diff --git a/include/lib/libc/arm_acle.h b/include/lib/libc/arm_acle.h index 953933f1d7..eb08552db7 100644 --- a/include/lib/libc/arm_acle.h +++ b/include/lib/libc/arm_acle.h @@ -14,8 +14,10 @@ #define ARM_ACLE_H #if !defined(__aarch64__) || defined(__clang__) +# define __crc32b __builtin_arm_crc32b # define __crc32w __builtin_arm_crc32w #else +# define __crc32b __builtin_aarch64_crc32b # define __crc32w __builtin_aarch64_crc32w #endif |