]> git.ipfire.org Git - people/ms/u-boot.git/blame - include/dm/of_extra.h
dfu: Fix up the Kconfig mess
[people/ms/u-boot.git] / include / dm / of_extra.h
CommitLineData
b7e0d73b
SG
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
13enum fmap_compress_t {
14 FMAP_COMPRESS_NONE,
15 FMAP_COMPRESS_LZO,
16};
17
18enum 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 */
25struct 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 */
43int of_read_fmap_entry(ofnode node, const char *name,
44 struct fmap_entry *entry);
45
46#endif