Chromium Code Reviews| OLD | NEW |
|---|---|
| (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_SIGLEN 8 | |
| 15 #define FMAP_NAMELEN 32 | |
| 16 #define FMAP_SEARCH_STRIDE 4 | |
| 17 typedef struct _FmapHeader { | |
| 18 char fmap_signature[FMAP_SIGLEN]; /* avoiding endian issues */ | |
| 19 uint8_t fmap_ver_major; | |
| 20 uint8_t fmap_ver_minor; | |
| 21 uint64_t fmap_base; | |
| 22 uint32_t fmap_size; | |
| 23 char fmap_name[FMAP_NAMELEN]; | |
| 24 uint16_t fmap_nareas; | |
| 25 } __attribute__((packed)) FmapHeader; | |
| 26 | |
| 27 typedef struct _FmapAreaHeader { | |
| 28 uint32_t area_offset; | |
| 29 uint32_t area_size; | |
| 30 char area_name[FMAP_NAMELEN]; | |
| 31 uint16_t area_flags; | |
| 32 } __attribute__((packed)) FmapAreaHeader; | |
| 33 | |
| 34 | |
| 35 /* Scan firmware image, pointed by [ptr] with length [size], for fmap header. | |
| 36 * Return pointer to fmap header, or NULL if not found. | |
| 37 */ | |
| 38 const char *FindFmap(const char *ptr, size_t size); | |
|
gauravsh
2011/02/10 20:02:05
char*
Randall Spangler
2011/02/11 17:26:04
FmapFind() would give it a consistent Fmap*() pref
Che-Liang Chiou
2011/02/14 02:27:53
Done.
Che-Liang Chiou
2011/02/14 02:27:53
Done.
| |
| 39 | |
| 40 /* Look up fmap area by name. Retrun index of fmap area or -1 if not found. */ | |
|
gauravsh
2011/02/10 20:02:05
Retrun->Return
return index into what?
Che-Liang Chiou
2011/02/14 02:27:53
Done.
| |
| 41 int FmapAreaIndex(const FmapHeader* fh, const FmapAreaHeader* ah, | |
|
gauravsh
2011/02/10 20:02:05
still not clear from the comment what |fh| and |ah
Che-Liang Chiou
2011/02/14 02:27:53
Done.
P.S. They are FmapHeader and FmapAreaHeader
| |
| 42 const char* name); | |
| 43 | |
| 44 #endif /*__FMAP_H__ */ | |
|
gauravsh
2011/02/10 20:02:05
2 spaces here before start of comment
Che-Liang Chiou
2011/02/14 02:27:53
Done.
| |
| OLD | NEW |