Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Simon Glass | 0fbf66b | 2017-05-18 20:09:02 -0600 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2017 Google, Inc |
| 4 | * Written by Simon Glass <sjg@chromium.org> |
Simon Glass | 0fbf66b | 2017-05-18 20:09:02 -0600 | [diff] [blame] | 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 name Name of node being read |
| 39 | * @param entry Place to put offset and size of this node |
| 40 | * @return 0 if ok, -ve on error |
| 41 | */ |
| 42 | int of_read_fmap_entry(ofnode node, const char *name, |
| 43 | struct fmap_entry *entry); |
| 44 | |
| 45 | #endif |