Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 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 * This is ported from the flashmap utility: http://flashmap.googlecode.com | |
| 36 */ | |
| 37 | |
| 38 #ifndef FLASHMAP_LIB_FMAP_H__ | |
| 39 #define FLASHMAP_LIB_FMAP_H__ | |
| 40 | |
| 41 #include <inttypes.h> | |
| 42 | |
| 43 #define FMAP_SIGNATURE "__FMAP__" | |
| 44 #define FMAP_VER_MAJOR 1 /* this header's FMAP minor version */ | |
| 45 #define FMAP_VER_MINOR 1 /* this header's FMAP minor version */ | |
| 46 #define FMAP_STRLEN 32 /* maximum length for strings, */ | |
| 47 /* including null-terminator */ | |
| 48 | |
| 49 enum fmap_flags { | |
| 50 FMAP_AREA_STATIC = 1 << 0, | |
| 51 FMAP_AREA_COMPRESSED = 1 << 1, | |
| 52 FMAP_AREA_RO = 1 << 2, | |
| 53 }; | |
| 54 | |
| 55 struct crypto_algo; /* forward declaration */ | |
|
Louis
2010/12/30 02:57:08
remove this until we need it?
dhendrix
2010/12/31 00:47:02
Done.
| |
| 56 | |
| 57 /* Mapping of volatile and static regions in firmware binary */ | |
| 58 struct fmap { | |
| 59 uint64_t signature; /* "__FMAP__" (0x5F5F50414D465F5F) */ | |
| 60 uint8_t ver_major; /* major version */ | |
| 61 uint8_t ver_minor; /* minor version */ | |
| 62 uint64_t base; /* address of the firmware binary */ | |
| 63 uint32_t size; /* size of firmware binary in bytes */ | |
| 64 uint8_t name[FMAP_STRLEN]; /* name of this firmware binary */ | |
| 65 uint16_t nareas; /* number of areas described by | |
| 66 fmap_areas[] below */ | |
| 67 struct fmap_area { | |
| 68 uint32_t offset; /* offset relative to base */ | |
| 69 uint32_t size; /* size in bytes */ | |
| 70 uint8_t name[FMAP_STRLEN]; /* descriptive name */ | |
| 71 uint16_t flags; /* flags for this area */ | |
| 72 } __attribute__((packed)) areas[]; | |
| 73 } __attribute__((packed)); | |
| 74 | |
| 75 /* | |
| 76 * fmap_find - find FMAP signature in a binary image | |
| 77 * | |
| 78 * @image: binary image | |
| 79 * @len: length of binary image | |
| 80 * | |
| 81 * This function does no error checking. The caller is responsible for | |
| 82 * verifying that the contents are sane. | |
| 83 * | |
| 84 * returns offset of FMAP signature to indicate success | |
| 85 * returns <0 to indicate failure | |
| 86 */ | |
| 87 extern long int fmap_find(const uint8_t *image, size_t len); | |
| 88 | |
| 89 #endif /* FLASHMAP_LIB_FMAP_H__*/ | |
| OLD | NEW |