blob: 3585f0bc844cce99eba11f4bcf4b7e0402118274 [file] [log] [blame]
Patrick Georgi89f73dc2015-07-09 13:57:00 +02001/*
2 * Copyright 2010, Google Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions and the following disclaimer
13 * in the documentation and/or other materials provided with the
14 * distribution.
15 * * Neither the name of Google Inc. nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 * Alternatively, this software may be distributed under the terms of the
32 * GNU General Public License ("GPL") version 2 as published by the Free
33 * Software Foundation.
34 */
35
36#ifndef FLASHMAP_SERIALIZED_H__
37#define FLASHMAP_SERIALIZED_H__
38
39#include <stdint.h>
40
41#define FMAP_SIGNATURE "__FMAP__"
42#define FMAP_VER_MAJOR 1 /* this header's FMAP minor version */
43#define FMAP_VER_MINOR 1 /* this header's FMAP minor version */
44#define FMAP_STRLEN 32 /* maximum length for strings, */
45 /* including null-terminator */
46
47enum fmap_flags {
48 FMAP_AREA_STATIC = 1 << 0,
49 FMAP_AREA_COMPRESSED = 1 << 1,
50 FMAP_AREA_RO = 1 << 2,
51};
52
53/* Mapping of volatile and static regions in firmware binary */
54struct fmap_area {
55 uint32_t offset; /* offset relative to base */
56 uint32_t size; /* size in bytes */
57 uint8_t name[FMAP_STRLEN]; /* descriptive name */
58 uint16_t flags; /* flags for this area */
59} __attribute__((packed));
60
61struct fmap {
62 uint8_t signature[8]; /* "__FMAP__" (0x5F5F464D41505F5F) */
63 uint8_t ver_major; /* major version */
64 uint8_t ver_minor; /* minor version */
65 uint64_t base; /* address of the firmware binary */
66 uint32_t size; /* size of firmware binary in bytes */
67 uint8_t name[FMAP_STRLEN]; /* name of this firmware binary */
68 uint16_t nareas; /* number of areas described by
69 fmap_areas[] below */
70 struct fmap_area areas[];
71} __attribute__((packed));
72
73#endif /* FLASHMAP_SERIALIZED_H__ */