summaryrefslogtreecommitdiff
path: root/util/cbfstool
diff options
context:
space:
mode:
Diffstat (limited to 'util/cbfstool')
-rw-r--r--util/cbfstool/cbfs_image.c2
-rw-r--r--util/cbfstool/cbfstool.c4
-rw-r--r--util/cbfstool/common.h7
3 files changed, 9 insertions, 4 deletions
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c
index 7b8da42a6a..4249015c24 100644
--- a/util/cbfstool/cbfs_image.c
+++ b/util/cbfstool/cbfs_image.c
@@ -721,7 +721,7 @@ int cbfs_add_entry(struct cbfs_image *image, struct buffer *buffer,
assert(image);
assert(buffer);
assert(buffer->data);
- assert(!IS_TOP_ALIGNED_ADDRESS(content_offset));
+ assert(!IS_HOST_SPACE_ADDRESS(content_offset));
const char *name = header->filename;
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index d6f4e98621..f9f4e535a9 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -571,7 +571,7 @@ static int cbfs_add_component(const char *filename,
return -1;
}
- if (IS_TOP_ALIGNED_ADDRESS(offset))
+ if (IS_HOST_SPACE_ADDRESS(offset))
offset = convert_to_from_absolute_top_aligned(param.image_region, -offset);
if (cbfs_add_entry(&image, &buffer, offset, header, len_align) != 0) {
ERROR("Failed to add '%s' into ROM image.\n", filename);
@@ -657,7 +657,7 @@ static int cbfstool_convert_fsp(struct buffer *buffer,
* passed in by the caller.
*/
if (param.stage_xip) {
- if (!IS_TOP_ALIGNED_ADDRESS(address))
+ if (!IS_HOST_SPACE_ADDRESS(address))
address = -convert_to_from_absolute_top_aligned(
param.image_region, address);
} else {
diff --git a/util/cbfstool/common.h b/util/cbfstool/common.h
index f1287e299f..1c83045eee 100644
--- a/util/cbfstool/common.h
+++ b/util/cbfstool/common.h
@@ -15,7 +15,12 @@
#include "swab.h"
-#define IS_TOP_ALIGNED_ADDRESS(x) ((uint32_t)(x) > 0x80000000)
+/*
+ * There are two address spaces that this tool deals with - SPI flash address space and host
+ * address space. This macros checks if the address is greater than 2GiB under the assumption
+ * that the low MMIO lives in the top half of the 4G address space of the host.
+ */
+#define IS_HOST_SPACE_ADDRESS(addr) ((uint32_t)(addr) > 0x80000000)
#define unused __attribute__((unused))