of_extra.h 1018 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. #ifndef _DM_OF_EXTRA_H
  8. #define _DM_OF_EXTRA_H
  9. #include <dm/ofnode.h>
  10. enum fmap_compress_t {
  11. FMAP_COMPRESS_NONE,
  12. FMAP_COMPRESS_LZO,
  13. };
  14. enum fmap_hash_t {
  15. FMAP_HASH_NONE,
  16. FMAP_HASH_SHA1,
  17. FMAP_HASH_SHA256,
  18. };
  19. /* A flash map entry, containing an offset and length */
  20. struct fmap_entry {
  21. uint32_t offset;
  22. uint32_t length;
  23. uint32_t used; /* Number of bytes used in region */
  24. enum fmap_compress_t compress_algo; /* Compression type */
  25. enum fmap_hash_t hash_algo; /* Hash algorithm */
  26. const uint8_t *hash; /* Hash value */
  27. int hash_size; /* Hash size */
  28. };
  29. /**
  30. * Read a flash entry from the fdt
  31. *
  32. * @param node Reference to node to read
  33. * @param name Name of node being read
  34. * @param entry Place to put offset and size of this node
  35. * @return 0 if ok, -ve on error
  36. */
  37. int of_read_fmap_entry(ofnode node, const char *name,
  38. struct fmap_entry *entry);
  39. #endif