summaryrefslogtreecommitdiff
path: root/util/cbfstool/flashmap
diff options
context:
space:
mode:
authorSol Boucher <solb@chromium.org>2015-05-07 16:41:46 -0700
committerPatrick Georgi <pgeorgi@google.com>2015-05-08 19:45:55 +0200
commitfa7a45524f7504646557902bff2c431bc26119ab (patch)
tree3a1e545dec692dd01bfb699af9593ea2aab9f16c /util/cbfstool/flashmap
parent65d9520e15d6ade6b80778536937af5cdb8dfb6d (diff)
downloadcoreboot-fa7a45524f7504646557902bff2c431bc26119ab.tar.xz
cbfstool: Fix strange flashmap whitespace
This is being fixed in a separate commit so we can diff against the library as it existed in its own repo. Change-Id: Id87cd8f4e015a5ed7dd8a19302cc22ab744fefe8 Signed-off-by: Sol Boucher <solb@chromium.org> Reviewed-on: http://review.coreboot.org/10141 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'util/cbfstool/flashmap')
-rw-r--r--util/cbfstool/flashmap/fmap.c38
-rw-r--r--util/cbfstool/flashmap/fmap.h16
-rw-r--r--util/cbfstool/flashmap/kv_pair.c12
-rw-r--r--util/cbfstool/flashmap/kv_pair.h62
-rw-r--r--util/cbfstool/flashmap/valstr.c2
-rw-r--r--util/cbfstool/flashmap/valstr.h16
6 files changed, 73 insertions, 73 deletions
diff --git a/util/cbfstool/flashmap/fmap.c b/util/cbfstool/flashmap/fmap.c
index 8850a925f1..68c7d8352f 100644
--- a/util/cbfstool/flashmap/fmap.c
+++ b/util/cbfstool/flashmap/fmap.c
@@ -76,8 +76,8 @@ static long int fmap_lsearch(const uint8_t *image, size_t len)
for (offset = 0; offset < len - strlen(FMAP_SIGNATURE); offset++) {
if (!memcmp(&image[offset],
- FMAP_SIGNATURE,
- strlen(FMAP_SIGNATURE))) {
+ FMAP_SIGNATURE,
+ strlen(FMAP_SIGNATURE))) {
fmap_found = 1;
break;
}
@@ -114,8 +114,8 @@ static long int fmap_bsearch(const uint8_t *image, size_t len)
if ((offset % (stride * 2) == 0) && (offset != 0))
continue;
if (!memcmp(&image[offset],
- FMAP_SIGNATURE,
- strlen(FMAP_SIGNATURE))) {
+ FMAP_SIGNATURE,
+ strlen(FMAP_SIGNATURE))) {
fmap_found = 1;
break;
}
@@ -163,19 +163,19 @@ int fmap_print(const struct fmap *fmap)
struct kv_pair *kv = NULL;
const uint8_t *tmp;
- kv = kv_pair_new();
+ kv = kv_pair_new();
if (!kv)
return -1;
tmp = fmap->signature;
kv_pair_fmt(kv, "fmap_signature",
- "0x%02x%02x%02x%02x%02x%02x%02x%02x",
+ "0x%02x%02x%02x%02x%02x%02x%02x%02x",
tmp[0], tmp[1], tmp[2], tmp[3],
tmp[4], tmp[5], tmp[6], tmp[7]);
kv_pair_fmt(kv, "fmap_ver_major", "%d", fmap->ver_major);
kv_pair_fmt(kv, "fmap_ver_minor","%d", fmap->ver_minor);
kv_pair_fmt(kv, "fmap_base", "0x%016llx",
- (unsigned long long)fmap->base);
+ (unsigned long long)fmap->base);
kv_pair_fmt(kv, "fmap_size", "0x%04x", fmap->size);
kv_pair_fmt(kv, "fmap_name", "%s", fmap->name);
kv_pair_fmt(kv, "fmap_nareas", "%d", fmap->nareas);
@@ -241,14 +241,14 @@ int fmap_get_csum(const uint8_t *image, unsigned int image_len, uint8_t **digest
/* sanity check the offset */
if (fmap->areas[i].size + fmap->areas[i].offset > image_len) {
fprintf(stderr,
- "(%s) invalid parameter detected in area %d\n",
- __func__, i);
+ "(%s) invalid parameter detected in area %d\n",
+ __func__, i);
return -1;
}
SHA_update(&ctx,
- image + fmap->areas[i].offset,
- fmap->areas[i].size);
+ image + fmap->areas[i].offset,
+ fmap->areas[i].size);
}
SHA_final(&ctx);
@@ -278,7 +278,7 @@ char *fmap_flags_to_string(uint16_t flags)
total_size += strlen(tmp);
str = realloc(str, total_size);
strcat(str, tmp);
-
+
flags &= ~(1 << i);
if (flags) {
total_size++;
@@ -318,8 +318,8 @@ void fmap_destroy(struct fmap *fmap) {
/* append area to existing structure, return new total size if successful */
int fmap_append_area(struct fmap **fmap,
- uint32_t offset, uint32_t size,
- const uint8_t *name, uint16_t flags)
+ uint32_t offset, uint32_t size,
+ const uint8_t *name, uint16_t flags)
{
struct fmap_area *area;
int orig_size, new_size;
@@ -513,10 +513,10 @@ static int fmap_append_area_test(struct fmap **fmap)
total_size = sizeof(**fmap) + sizeof(test_area);
if (fmap_append_area(fmap,
- test_area.offset,
- test_area.size,
- test_area.name,
- test_area.flags
+ test_area.offset,
+ test_area.size,
+ test_area.name,
+ test_area.flags
) != total_size) {
printf("failed to append area\n");
goto fmap_append_area_test_exit;
@@ -618,7 +618,7 @@ static int fmap_find_test(struct fmap *fmap)
status = fail;
/*
- * Note: In these tests, we'll use fmap_find() and control usage of
+ * Note: In these tests, we'll use fmap_find() and control usage of
* lsearch and bsearch by using a power-of-2 total_size. For lsearch,
* use total_size - 1. For bsearch, use total_size.
*/
diff --git a/util/cbfstool/flashmap/fmap.h b/util/cbfstool/flashmap/fmap.h
index 9cea22d37a..677576ab7d 100644
--- a/util/cbfstool/flashmap/fmap.h
+++ b/util/cbfstool/flashmap/fmap.h
@@ -54,10 +54,10 @@ enum fmap_flags {
/* Mapping of volatile and static regions in firmware binary */
struct fmap_area {
- uint32_t offset; /* offset relative to base */
- uint32_t size; /* size in bytes */
- uint8_t name[FMAP_STRLEN]; /* descriptive name */
- uint16_t flags; /* flags for this area */
+ uint32_t offset; /* offset relative to base */
+ uint32_t size; /* size in bytes */
+ uint8_t name[FMAP_STRLEN]; /* descriptive name */
+ uint16_t flags; /* flags for this area */
} __attribute__((packed));
struct fmap {
@@ -111,7 +111,7 @@ extern int fmap_print(const struct fmap *map);
* returns <0 to indicate error
*/
extern int fmap_get_csum(const uint8_t *image,
- unsigned int image_len, uint8_t **digest);
+ unsigned int image_len, uint8_t **digest);
/*
@@ -144,7 +144,7 @@ char *fmap_flags_to_string(uint16_t flags);
* returns NULL to indicate failure
*/
extern struct fmap *fmap_create(uint64_t base,
- uint32_t size, uint8_t *name);
+ uint32_t size, uint8_t *name);
/* free memory used by an fmap structure */
extern void fmap_destroy(struct fmap *fmap);
@@ -172,8 +172,8 @@ extern int fmap_size(struct fmap *fmap);
* returns <0 to indicate failure
*/
extern int fmap_append_area(struct fmap **fmap,
- uint32_t offset, uint32_t size,
- const uint8_t *name, uint16_t flags);
+ uint32_t offset, uint32_t size,
+ const uint8_t *name, uint16_t flags);
/*
* fmap_find_area - find an fmap_area entry (by name) and return pointer to it
diff --git a/util/cbfstool/flashmap/kv_pair.c b/util/cbfstool/flashmap/kv_pair.c
index 2572c642f8..f163c13eaa 100644
--- a/util/cbfstool/flashmap/kv_pair.c
+++ b/util/cbfstool/flashmap/kv_pair.c
@@ -76,7 +76,7 @@ struct kv_pair **kv_pair_new_array(size_t size)
}
struct kv_pair *kv_pair_add(struct kv_pair *kv_list,
- const char *key, const char *value)
+ const char *key, const char *value)
{
struct kv_pair *kv_new;
struct kv_pair *kv_ptr;
@@ -117,7 +117,7 @@ kv_pair_add_failed:
}
struct kv_pair *kv_pair_add_bool(struct kv_pair *kv_list,
- const char *key, int value)
+ const char *key, int value)
{
const char *str;
@@ -130,7 +130,7 @@ struct kv_pair *kv_pair_add_bool(struct kv_pair *kv_list,
}
struct kv_pair *kv_pair_fmt(struct kv_pair *kv_list,
- const char *kv_key, const char *format, ...)
+ const char *kv_key, const char *format, ...)
{
char kv_value[KV_PAIR_MAX_VALUE_LEN];
va_list vptr;
@@ -173,7 +173,7 @@ void kv_pair_free_array(struct kv_pair **kv_array, size_t size)
}
void kv_pair_print_to_file(FILE* fp, struct kv_pair *kv_list,
- enum kv_pair_style style)
+ enum kv_pair_style style)
{
struct kv_pair *kv_ptr;
@@ -182,7 +182,7 @@ void kv_pair_print_to_file(FILE* fp, struct kv_pair *kv_list,
for (kv_ptr = kv_list; kv_ptr != NULL; kv_ptr = kv_ptr->next) {
if (kv_ptr->key && kv_ptr->value) {
fprintf(fp, "%s=\"%s\" ",
- kv_ptr->key, kv_ptr->value);
+ kv_ptr->key, kv_ptr->value);
}
}
break;
@@ -201,7 +201,7 @@ void kv_pair_print_to_file(FILE* fp, struct kv_pair *kv_list,
for (kv_ptr = kv_list; kv_ptr != NULL; kv_ptr = kv_ptr->next) {
if (kv_ptr->key && kv_ptr->value)
fprintf(fp, "%-20s | %s\n",
- kv_ptr->key, kv_ptr->value);
+ kv_ptr->key, kv_ptr->value);
}
break;
}
diff --git a/util/cbfstool/flashmap/kv_pair.h b/util/cbfstool/flashmap/kv_pair.h
index b573530c43..9257a26f34 100644
--- a/util/cbfstool/flashmap/kv_pair.h
+++ b/util/cbfstool/flashmap/kv_pair.h
@@ -41,13 +41,13 @@
#include <string.h>
/* key=value string pair list */
-#define KV_PAIR_MAX_VALUE_LEN 1024
+#define KV_PAIR_MAX_VALUE_LEN 1024
enum kv_pair_style {
KV_STYLE_PAIR, /* key1="value1" key2="value2" */
KV_STYLE_VALUE, /* | value1 | value2 | */
- KV_STYLE_LONG, /* key1 | value1 */
- /* key2 | value2 */
+ KV_STYLE_LONG, /* key1 | value1 */
+ /* key2 | value2 */
};
struct kv_pair {
@@ -61,7 +61,7 @@ extern enum kv_pair_style kv_pair_get_style();
extern void kv_pair_set_style(enum kv_pair_style style);
/*
- * kv_pair_new - create new key=value pair
+ * kv_pair_new - create new key=value pair
*
* returns pointer to new key=value pair
* returns NULL to indicate error
@@ -69,67 +69,67 @@ extern void kv_pair_set_style(enum kv_pair_style style);
extern struct kv_pair *kv_pair_new(void);
/*
- * kv_pair_add - add new key=value pair to list
+ * kv_pair_add - add new key=value pair to list
*
- * @kv_list: key=value pair list
- * @key: key string
- * @value: value string
+ * @kv_list: key=value pair list
+ * @key: key string
+ * @value: value string
*
* returns pointer to new key=value pair
* returns NULL to indicate error
*/
extern struct kv_pair *kv_pair_add(struct kv_pair *kv_list,
- const char *key, const char *value);
+ const char *key, const char *value);
/*
- * kv_pair_add_bool - add new boolean kvpair to list
+ * kv_pair_add_bool - add new boolean kvpair to list
*
- * @kv_list: key=value pair list
- * @key: key string
- * @value: value
+ * @kv_list: key=value pair list
+ * @key: key string
+ * @value: value
*
* returns pointer to new key=value pair
* returns NULL to indicate error
*/
extern struct kv_pair *kv_pair_add_bool(struct kv_pair *kv_list,
- const char *key, int value);
+ const char *key, int value);
/*
- * kv_pair_fmt - add key=value pair based on printf format
- * NOTE: uses variable argument list
+ * kv_pair_fmt - add key=value pair based on printf format
+ * NOTE: uses variable argument list
*
- * @kv_list: list of key=value pairs
- * @kv_key: key string
- * @format: printf-style format for value input
- * @...: arguments to format
+ * @kv_list: list of key=value pairs
+ * @kv_key: key string
+ * @format: printf-style format for value input
+ * @...: arguments to format
*
* returns pointer to new key=value pair
* returns NULL to indicate error
*/
extern struct kv_pair *kv_pair_fmt(struct kv_pair *kv_list,
- const char *kv_key, const char *format, ...)
- __attribute__((format(printf, 3, 4)));
+ const char *kv_key, const char *format, ...)
+ __attribute__((format(printf, 3, 4)));
/*
* kv_pair_free - clean a key=value pair list
*
- * @kv_list: pointer to key=value list
+ * @kv_list: pointer to key=value list
*/
extern void kv_pair_free(struct kv_pair *kv_list);
/*
* kv_pair_print - print a key=value pair list
*
- * @kv_list: pointer to key=value list
- * @style: print style
+ * @kv_list: pointer to key=value list
+ * @style: print style
*/
extern void kv_pair_print_to_file(FILE* fp, struct kv_pair *kv_list,
- enum kv_pair_style style);
+ enum kv_pair_style style);
/*
* kv_pair_print - print a key=value pair list to gsys output
*
- * @kv_list: pointer to key=value list
+ * @kv_list: pointer to key=value list
*/
extern void kv_pair_print(struct kv_pair *kv_list);
@@ -137,16 +137,16 @@ extern void kv_pair_print(struct kv_pair *kv_list);
/*
* kv_pair_get_value - return first value with key match
*
- * @kv_list: pointer to key=value list
- * @kv_key: key string
+ * @kv_list: pointer to key=value list
+ * @kv_key: key string
*/
extern const char *kv_pair_get_value(struct kv_pair *kv_list,
- const char *kv_key);
+ const char *kv_key);
/*
* kv_pair_size - return number of kv pairs in the chain
*
- * @kv_list: pointer to key=value list
+ * @kv_list: pointer to key=value list
*/
extern int kv_pair_size(struct kv_pair *kv_list);
diff --git a/util/cbfstool/flashmap/valstr.c b/util/cbfstool/flashmap/valstr.c
index fa9ed82c03..8155c949d8 100644
--- a/util/cbfstool/flashmap/valstr.c
+++ b/util/cbfstool/flashmap/valstr.c
@@ -35,7 +35,7 @@
#include <valstr.h>
const char *val2str_default(uint32_t val, const struct valstr *vs,
- const char *def_str)
+ const char *def_str)
{
int i;
diff --git a/util/cbfstool/flashmap/valstr.h b/util/cbfstool/flashmap/valstr.h
index 3885ef75f1..9b57d58cfd 100644
--- a/util/cbfstool/flashmap/valstr.h
+++ b/util/cbfstool/flashmap/valstr.h
@@ -43,21 +43,21 @@ struct valstr {
/*
* val2str_default - convert value to string
*
- * @val: value to convert
- * @vs: value-string data
- * @def_str: default string to return if no matching value found
+ * @val: value to convert
+ * @vs: value-string data
+ * @def_str: default string to return if no matching value found
*
* returns pointer to string
* returns def_str if no matching value found
*/
const char *val2str_default(uint32_t val, const struct valstr *vs,
- const char *def_str);
+ const char *def_str);
/*
* val2str - convert value to string
*
- * @val: value to convert
- * @vs: value-string data
+ * @val: value to convert
+ * @vs: value-string data
*
* returns pointer to string
* returns pointer to "unknown" static string if not found
@@ -67,8 +67,8 @@ const char *val2str(uint32_t val, const struct valstr *vs);
/*
* str2val - convert string to value
*
- * @str: string to convert
- * @vs: value-string data
+ * @str: string to convert
+ * @vs: value-string data
*
* returns value for string
* returns value for last entry in value-string data if not found