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