u-boot/include/image-sparse.h
Simon Glass 401d1c4f5d common: Drop asm/global_data.h from common header
Move this out of the common header and include it only where needed.  In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly.   Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
2021-02-02 15:33:42 -05:00

43 lines
916 B
C

/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright 2014 Broadcom Corporation.
*/
#include <compiler.h>
#include <part.h>
#include <sparse_format.h>
#define ROUNDUP(x, y) (((x) + ((y) - 1)) & ~((y) - 1))
struct sparse_storage {
lbaint_t blksz;
lbaint_t start;
lbaint_t size;
void *priv;
lbaint_t (*write)(struct sparse_storage *info,
lbaint_t blk,
lbaint_t blkcnt,
const void *buffer);
lbaint_t (*reserve)(struct sparse_storage *info,
lbaint_t blk,
lbaint_t blkcnt);
void (*mssg)(const char *str, char *response);
};
static inline int is_sparse_image(void *buf)
{
sparse_header_t *s_header = (sparse_header_t *)buf;
if ((le32_to_cpu(s_header->magic) == SPARSE_HEADER_MAGIC) &&
(le16_to_cpu(s_header->major_version) == 1))
return 1;
return 0;
}
int write_sparse_image(struct sparse_storage *info, const char *part_name,
void *data, char *response);