Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1040)

Side by Side Diff: host/include/fmap.h

Issue 6465018: Add load_firmware_test utility program (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git@master
Patch Set: Code review Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « host/Makefile ('k') | host/lib/fmap.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
6
7 #ifndef __FMAP_H__
8 #define __FMAP_H__
9
10 #include <inttypes.h>
11 #include <stddef.h>
12
13 /* FMAP structs. See http://code.google.com/p/flashmap/wiki/FmapSpec */
14 #define FMAP_NAMELEN 32
15 #define FMAP_SIGNATURE "__FMAP__"
16 #define FMAP_SIGNATURE_SIZE 8
17 #define FMAP_SEARCH_STRIDE 4
18 typedef struct _FmapHeader {
19 char fmap_signature[FMAP_SIGNATURE_SIZE]; /* avoiding endian issues */
20 uint8_t fmap_ver_major;
21 uint8_t fmap_ver_minor;
22 uint64_t fmap_base;
23 uint32_t fmap_size;
24 char fmap_name[FMAP_NAMELEN];
25 uint16_t fmap_nareas;
26 } __attribute__((packed)) FmapHeader;
27
28 typedef struct _FmapAreaHeader {
29 uint32_t area_offset;
30 uint32_t area_size;
31 char area_name[FMAP_NAMELEN];
32 uint16_t area_flags;
33 } __attribute__((packed)) FmapAreaHeader;
34
35
36 /* Scan firmware image, pointed by [ptr] with length [size], for fmap header.
37 * Return pointer to fmap header, or NULL if not found.
38 */
39 const char* FmapFind(const char *ptr, size_t size);
40
41 /* Look up fmap area by name, that is, strcmp(fh->fmap_name, name) == 0.
42 * Return index of fmap area, that is, ah[returned_index],
43 * or -1 if not found. */
44 int FmapAreaIndex(const FmapHeader* fh, const FmapAreaHeader* ah,
45 const char* name);
46
47 #endif /* __FMAP_H__ */
OLDNEW
« no previous file with comments | « host/Makefile ('k') | host/lib/fmap.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698