]> Git Repo - u-boot.git/blobdiff - lib/crc32.c
clk: renesas: Synchronize R8A77980 V3H clock tables with Linux 6.5.3
[u-boot.git] / lib / crc32.c
index eee21f8d73988e6eb015a680af0dae37eec022da..f6fad8c15dfcde18322f5c352bf2e4e169c5c63a 100644 (file)
@@ -25,6 +25,7 @@
 #ifdef USE_HOSTCC
 #define __efi_runtime
 #define __efi_runtime_data
+#define __efi_runtime_rodata
 #endif
 
 #define tole(x) cpu_to_le32(x)
@@ -82,12 +83,12 @@ static void __efi_runtime make_crc_table(void)
   }
   crc_table_empty = 0;
 }
-#else
+#elif !defined(CONFIG_ARM64_CRC32)
 /* ========================================================================
  * Table of CRC-32's of all single-byte values (made by make_crc_table)
  */
 
-static const uint32_t __efi_runtime_data crc_table[256] = {
+static const uint32_t __efi_runtime_rodata crc_table[256] = {
 tole(0x00000000L), tole(0x77073096L), tole(0xee0e612cL), tole(0x990951baL),
 tole(0x076dc419L), tole(0x706af48fL), tole(0xe963a535L), tole(0x9e6495a3L),
 tole(0x0edb8832L), tole(0x79dcb8a4L), tole(0xe0d5e91eL), tole(0x97d2d988L),
@@ -182,6 +183,12 @@ const uint32_t * ZEXPORT get_crc_table()
  */
 uint32_t __efi_runtime crc32_no_comp(uint32_t crc, const Bytef *buf, uInt len)
 {
+#ifdef CONFIG_ARM64_CRC32
+    crc = cpu_to_le32(crc);
+    while (len--)
+        crc = __builtin_aarch64_crc32b(crc, *buf++);
+    return le32_to_cpu(crc);
+#else
     const uint32_t *tab = crc_table;
     const uint32_t *b =(const uint32_t *)buf;
     size_t rem_len;
@@ -219,6 +226,7 @@ uint32_t __efi_runtime crc32_no_comp(uint32_t crc, const Bytef *buf, uInt len)
     }
 
     return le32_to_cpu(crc);
+#endif
 }
 #undef DO_CRC
 
@@ -244,12 +252,12 @@ uint32_t crc32_wd(uint32_t crc, const unsigned char *buf, uInt len,
                chunk = end - curr;
                if (chunk > chunk_sz)
                        chunk = chunk_sz;
-               crc = crc32 (crc, curr, chunk);
+               crc = crc32(crc, curr, chunk);
                curr += chunk;
-               WATCHDOG_RESET ();
+               schedule();
        }
 #else
-       crc = crc32 (crc, buf, len);
+       crc = crc32(crc, buf, len);
 #endif
 
        return crc;
This page took 0.029365 seconds and 4 git commands to generate.