blob: e1540c1fbdc3fd7df88bef518a67587fc219d69c [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Simon Glassb7e0d732017-05-18 20:09:02 -06002/*
3 * Copyright (c) 2017 Google, Inc
4 * Written by Simon Glass <sjg@chromium.org>
Simon Glassb7e0d732017-05-18 20:09:02 -06005 */
6
7#ifndef _DM_OF_EXTRA_H
8#define _DM_OF_EXTRA_H
9
10#include <dm/ofnode.h>
11
12enum fmap_compress_t {
13 FMAP_COMPRESS_NONE,
14 FMAP_COMPRESS_LZO,
15};
16
17enum 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 */
24struct 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 Glass5e0a7342018-06-11 13:07:17 -060037 * @param node Reference to node to read
Simon Glassb7e0d732017-05-18 20:09:02 -060038 * @param entry Place to put offset and size of this node
39 * @return 0 if ok, -ve on error
40 */
Simon Glass5e0a7342018-06-11 13:07:17 -060041int ofnode_read_fmap_entry(ofnode node, struct fmap_entry *entry);
Simon Glassb7e0d732017-05-18 20:09:02 -060042
43#endif