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

Unified 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 & remove tabs 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 side-by-side diff with in-line comments
Download patch
Index: host/include/fmap.h
diff --git a/host/include/fmap.h b/host/include/fmap.h
new file mode 100644
index 0000000000000000000000000000000000000000..638b5d852d0cd0a218f4158dd89f580a25db617b
--- /dev/null
+++ b/host/include/fmap.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef __FMAP_H__
+#define __FMAP_H__
+
+#include <inttypes.h>
+#include <stddef.h>
+
+/* FMAP structs. See http://code.google.com/p/flashmap/wiki/FmapSpec */
+#define FMAP_SIGLEN 8
+#define FMAP_NAMELEN 32
+#define FMAP_SEARCH_STRIDE 4
+typedef struct _FmapHeader {
+ char fmap_signature[FMAP_SIGLEN]; /* avoiding endian issues */
+ uint8_t fmap_ver_major;
+ uint8_t fmap_ver_minor;
+ uint64_t fmap_base;
+ uint32_t fmap_size;
+ char fmap_name[FMAP_NAMELEN];
+ uint16_t fmap_nareas;
+} __attribute__((packed)) FmapHeader;
+
+typedef struct _FmapAreaHeader {
+ uint32_t area_offset;
+ uint32_t area_size;
+ char area_name[FMAP_NAMELEN];
+ uint16_t area_flags;
+} __attribute__((packed)) FmapAreaHeader;
+
+
+/* Scan firmware image, pointed by [ptr] with length [size], for fmap header.
+ * Return pointer to fmap header, or NULL if not found.
+ */
+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.
+
+/* 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.
+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
+ const char* name);
+
+#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.

Powered by Google App Engine
This is Rietveld 408576698