Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Simon Glass | b7e0d73 | 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 | b7e0d73 | 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 | * |
Simon Glass | 5e0a734 | 2018-06-11 13:07:17 -0600 | [diff] [blame^] | 37 | * @param node Reference to node to read |
Simon Glass | b7e0d73 | 2017-05-18 20:09:02 -0600 | [diff] [blame] | 38 | * @param entry Place to put offset and size of this node |
| 39 | * @return 0 if ok, -ve on error |
| 40 | */ |
Simon Glass | 5e0a734 | 2018-06-11 13:07:17 -0600 | [diff] [blame^] | 41 | int ofnode_read_fmap_entry(ofnode node, struct fmap_entry *entry); |
Simon Glass | b7e0d73 | 2017-05-18 20:09:02 -0600 | [diff] [blame] | 42 | |
| 43 | #endif |