summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/common.h29
-rw-r--r--include/configs/sandbox.h9
-rw-r--r--include/hash.h13
-rw-r--r--include/os.h10
-rw-r--r--include/u-boot/crc.h11
5 files changed, 64 insertions, 8 deletions
diff --git a/include/common.h b/include/common.h
index 4ad17ea..6d52924 100644
--- a/include/common.h
+++ b/include/common.h
@@ -270,7 +270,8 @@ int cpu_init(void);
phys_size_t initdram (int);
int display_options (void);
void print_size(unsigned long long, const char *);
-int print_buffer (ulong addr, void* data, uint width, uint count, uint linelen);
+int print_buffer(ulong addr, const void *data, uint width, uint count,
+ uint linelen);
/* common/main.c */
void main_loop (void);
@@ -357,7 +358,19 @@ int getenv_yesno(const char *var);
int saveenv (void);
int setenv (const char *, const char *);
int setenv_ulong(const char *varname, ulong value);
-int setenv_addr(const char *varname, const void *addr);
+int setenv_hex(const char *varname, ulong value);
+/**
+ * setenv_addr - Set an environment variable to an address in hex
+ *
+ * @varname: Environmet variable to set
+ * @addr: Value to set it to
+ * @return 0 if ok, 1 on error
+ */
+static inline int setenv_addr(const char *varname, const void *addr)
+{
+ return setenv_hex(varname, (ulong)addr);
+}
+
#ifdef CONFIG_ARM
# include <asm/mach-types.h>
# include <asm/setup.h>
@@ -869,6 +882,18 @@ int cpu_disable(int nr);
int cpu_release(int nr, int argc, char * const argv[]);
#endif
+/* Define a null map_sysmem() if the architecture doesn't use it */
+# ifndef CONFIG_ARCH_MAP_SYSMEM
+static inline void *map_sysmem(phys_addr_t paddr, unsigned long len)
+{
+ return (void *)(uintptr_t)paddr;
+}
+
+static inline void unmap_sysmem(const void *vaddr)
+{
+}
+# endif
+
#endif /* __ASSEMBLY__ */
#ifdef CONFIG_PPC
diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index 9c431bf..9f51a0b 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -63,8 +63,8 @@
#define CONFIG_SYS_HZ 1000
/* Memory things - we don't really want a memory test */
-#define CONFIG_SYS_LOAD_ADDR 0x10000000
-#define CONFIG_SYS_MEMTEST_START 0x10000000
+#define CONFIG_SYS_LOAD_ADDR 0x00000000
+#define CONFIG_SYS_MEMTEST_START 0x00100000
#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + 0x1000)
#define CONFIG_PHYS_64BIT
@@ -85,6 +85,11 @@
#undef CONFIG_CMD_NET
#undef CONFIG_CMD_NFS
+#define CONFIG_CMD_HASH
+#define CONFIG_HASH_VERIFY
+#define CONFIG_SHA1
+#define CONFIG_SHA256
+
#define CONFIG_BOOTARGS ""
#define CONFIG_EXTRA_ENV_SETTINGS "stdin=serial\0" \
diff --git a/include/hash.h b/include/hash.h
index 34ba558..2dbbd9b 100644
--- a/include/hash.h
+++ b/include/hash.h
@@ -22,7 +22,7 @@
#ifndef _HASH_H
#define _HASH_H
-#ifdef CONFIG_SHA1SUM_VERIFY
+#if defined(CONFIG_SHA1SUM_VERIFY) || defined(CONFIG_CRC32_VERIFY)
#define CONFIG_HASH_VERIFY
#endif
@@ -51,19 +51,24 @@ struct hash_algo {
*/
#define HASH_MAX_DIGEST_SIZE 32
+enum {
+ HASH_FLAG_VERIFY = 1 << 0, /* Enable verify mode */
+ HASH_FLAG_ENV = 1 << 1, /* Allow env vars */
+};
+
/**
* hash_command: Process a hash command for a particular algorithm
*
* This common function is used to implement specific hash commands.
*
- * @algo_name: Hash algorithm being used
- * @verify: Non-zero to enable verify mode
+ * @algo_name: Hash algorithm being used (lower case!)
+ * @flags: Flags value (HASH_FLAG_...)
* @cmdtp: Pointer to command table entry
* @flag: Some flags normally 0 (see CMD_FLAG_.. above)
* @argc: Number of arguments (arg 0 must be the command text)
* @argv: Arguments
*/
-int hash_command(const char *algo_name, int verify, cmd_tbl_t *cmdtp, int flag,
+int hash_command(const char *algo_name, int flags, cmd_tbl_t *cmdtp, int flag,
int argc, char * const argv[]);
#endif
diff --git a/include/os.h b/include/os.h
index 699682a..c452d1b 100644
--- a/include/os.h
+++ b/include/os.h
@@ -40,6 +40,16 @@ struct sandbox_state;
ssize_t os_read(int fd, void *buf, size_t count);
/**
+ * Access to the OS read() system call with non-blocking access
+ *
+ * \param fd File descriptor as returned by os_open()
+ * \param buf Buffer to place data
+ * \param count Number of bytes to read
+ * \return number of bytes read, or -1 on error
+ */
+ssize_t os_read_no_block(int fd, void *buf, size_t count);
+
+/**
* Access to the OS write() system call
*
* \param fd File descriptor as returned by os_open()
diff --git a/include/u-boot/crc.h b/include/u-boot/crc.h
index 07badbf..08e509e 100644
--- a/include/u-boot/crc.h
+++ b/include/u-boot/crc.h
@@ -30,4 +30,15 @@ uint32_t crc32 (uint32_t, const unsigned char *, uint);
uint32_t crc32_wd (uint32_t, const unsigned char *, uint, uint);
uint32_t crc32_no_comp (uint32_t, const unsigned char *, uint);
+/**
+ * crc32_wd_buf - Perform CRC32 on a buffer and return result in buffer
+ *
+ * @input: Input buffer
+ * @ilen: Input buffer length
+ * @output: Place to put checksum result (4 bytes)
+ * @chunk_sz: Trigger watchdog after processing this many bytes
+ */
+void crc32_wd_buf(const unsigned char *input, uint ilen,
+ unsigned char *output, uint chunk_sz);
+
#endif /* _UBOOT_CRC_H */