/src/u-boot/include/image-sparse.h
Line | Count | Source |
1 | | /* SPDX-License-Identifier: GPL-2.0+ */ |
2 | | /* |
3 | | * Copyright 2014 Broadcom Corporation. |
4 | | */ |
5 | | |
6 | | #include <compiler.h> |
7 | | #include <part.h> |
8 | | #include <sparse_format.h> |
9 | | |
10 | 0 | #define FASTBOOT_MAX_BLK_WRITE 16384 |
11 | | |
12 | | #define ROUNDUP(x, y) (((x) + ((y) - 1)) & ~((y) - 1)) |
13 | | |
14 | | struct sparse_storage { |
15 | | lbaint_t blksz; |
16 | | lbaint_t start; |
17 | | lbaint_t size; |
18 | | void *priv; |
19 | | |
20 | | lbaint_t (*write)(struct sparse_storage *info, |
21 | | lbaint_t blk, |
22 | | lbaint_t blkcnt, |
23 | | const void *buffer); |
24 | | |
25 | | lbaint_t (*reserve)(struct sparse_storage *info, |
26 | | lbaint_t blk, |
27 | | lbaint_t blkcnt); |
28 | | |
29 | | void (*mssg)(const char *str, char *response); |
30 | | }; |
31 | | |
32 | | static inline int is_sparse_image(void *buf) |
33 | 0 | { |
34 | 0 | sparse_header_t *s_header = (sparse_header_t *)buf; |
35 | |
|
36 | 0 | if ((le32_to_cpu(s_header->magic) == SPARSE_HEADER_MAGIC) && |
37 | 0 | (le16_to_cpu(s_header->major_version) == 1)) |
38 | 0 | return 1; |
39 | | |
40 | 0 | return 0; |
41 | 0 | } Unexecuted instantiation: mmc.c:is_sparse_image Unexecuted instantiation: fb_block.c:is_sparse_image Unexecuted instantiation: fb_mmc.c:is_sparse_image Unexecuted instantiation: image-sparse.c:is_sparse_image |
42 | | |
43 | | int write_sparse_image(struct sparse_storage *info, const char *part_name, |
44 | | void *data, char *response); |