]> git.sur5r.net Git - u-boot/blob - include/dm/of_extra.h
e1540c1fbdc3fd7df88bef518a67587fc219d69c
[u-boot] / include / dm / of_extra.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (c) 2017 Google, Inc
4  * Written by Simon Glass <sjg@chromium.org>
5  */
6
7 #ifndef _DM_OF_EXTRA_H
8 #define _DM_OF_EXTRA_H
9
10 #include <dm/ofnode.h>
11
12 enum fmap_compress_t {
13         FMAP_COMPRESS_NONE,
14         FMAP_COMPRESS_LZO,
15 };
16
17 enum fmap_hash_t {
18         FMAP_HASH_NONE,
19         FMAP_HASH_SHA1,
20         FMAP_HASH_SHA256,
21 };
22
23 /* A flash map entry, containing an offset and length */
24 struct fmap_entry {
25         uint32_t offset;
26         uint32_t length;
27         uint32_t used;                  /* Number of bytes used in region */
28         enum fmap_compress_t compress_algo;     /* Compression type */
29         enum fmap_hash_t hash_algo;             /* Hash algorithm */
30         const uint8_t *hash;                    /* Hash value */
31         int hash_size;                          /* Hash size */
32 };
33
34 /**
35  * Read a flash entry from the fdt
36  *
37  * @param node          Reference to node to read
38  * @param entry         Place to put offset and size of this node
39  * @return 0 if ok, -ve on error
40  */
41 int ofnode_read_fmap_entry(ofnode node, struct fmap_entry *entry);
42
43 #endif