4 * For conditions of distribution and use, see copyright notice in zlib.h
10 -#include <compiler.h>
11 -#include <u-boot/crc.h>
13 +#include <asm/byteorder.h>
17 -#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
18 -#include <watchdog.h>
20 -#include "u-boot/zlib.h"
23 #define ZEXPORT /* empty */
25 -#define tole(x) cpu_to_le32(x)
26 +#define tole(x) __constant_cpu_to_le32(x)
28 #ifdef DYNAMIC_CRC_TABLE
30 @@ -151,7 +146,7 @@ tole(0xb40bbe37L), tole(0xc30c8ea1L), to
33 /* =========================================================================
34 - * This function can be used by asm versions of crc32()
35 + * This function can be used by asm versions of uboot_crc32()
37 const uint32_t * ZEXPORT get_crc_table()
39 @@ -183,7 +178,7 @@ uint32_t ZEXPORT crc32_no_comp(uint32_t
43 - crc = cpu_to_le32(crc);
44 + crc = __cpu_to_le32(crc);
46 if (((long)b) & 3 && len) {
47 uint8_t *p = (uint8_t *)b;
48 @@ -212,11 +207,11 @@ uint32_t ZEXPORT crc32_no_comp(uint32_t
52 - return le32_to_cpu(crc);
53 + return __le32_to_cpu(crc);
57 -uint32_t ZEXPORT crc32 (uint32_t crc, const Bytef *p, uInt len)
58 +uint32_t ZEXPORT uboot_crc32 (uint32_t crc, const Bytef *p, uInt len)
60 return crc32_no_comp(crc ^ 0xffffffffL, p, len) ^ 0xffffffffL;
62 @@ -239,12 +234,12 @@ uint32_t ZEXPORT crc32_wd (uint32_t crc,
66 - crc = crc32 (crc, curr, chunk);
67 + crc = uboot_crc32 (crc, curr, chunk);
72 - crc = crc32 (crc, buf, len);
73 + crc = uboot_crc32 (crc, buf, len);
80 #include <sys/ioctl.h>
87 @@ -210,13 +211,14 @@ static char default_environment[] = {
88 static int flash_io (int mode);
89 static char *envmatch (char * s1, char * s2);
90 static int parse_config (void);
91 +uint32_t uboot_crc32 (uint32_t crc, const Bytef *p, uInt len);
93 #if defined(CONFIG_FILE)
94 static int get_config (char *);
96 -static inline ulong getenvsize (void)
97 +static inline uint32_t getenvsize (void)
99 - ulong rc = CONFIG_ENV_SIZE - sizeof (long);
100 + uint32_t rc = CONFIG_ENV_SIZE - sizeof (uint32_t);
104 @@ -346,7 +348,7 @@ int fw_env_close(void)
108 - *environment.crc = crc32(0, (uint8_t *) environment.data, ENV_SIZE);
109 + *environment.crc = uboot_crc32(0, (uint8_t *) environment.data, ENV_SIZE);
111 /* write environment back to flash */
112 if (flash_io(O_RDWR)) {
113 @@ -802,7 +804,7 @@ static int flash_write_buf (int dev, int
114 data = malloc (erase_len);
117 - "Cannot malloc %u bytes: %s\n",
118 + "Cannot malloc %zu bytes: %s\n",
119 erase_len, strerror (errno));
122 @@ -1107,7 +1109,7 @@ int fw_env_open(void)
123 if (flash_io (O_RDONLY))
126 - crc0 = crc32 (0, (uint8_t *) environment.data, ENV_SIZE);
127 + crc0 = uboot_crc32 (0, (uint8_t *) environment.data, ENV_SIZE);
128 crc0_ok = (crc0 == *environment.crc);
129 if (!HaveRedundEnv) {
131 @@ -1151,7 +1153,7 @@ int fw_env_open(void)
135 - crc1 = crc32 (0, (uint8_t *) redundant->data, ENV_SIZE);
136 + crc1 = uboot_crc32 (0, (uint8_t *) redundant->data, ENV_SIZE);
137 crc1_ok = (crc1 == redundant->crc);
138 flag1 = redundant->flags;