util/cbfstool: Rename IS_TOP_ALIGNED_ADDRESS to IS_HOST_SPACE_ADDRESS

This change renames the macro `IS_TOP_ALIGNED_ADDRESS` to
`IS_HOST_SPACE_ADDRESS` to make it clear that the macro checks if
given address is an address in the host space as opposed to the SPI
flash space.

BUG=b:171534504

Change-Id: I84bb505df62ac41f1d364a662be145603c0bd5fa
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/47830
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Furquan Shaikh 2020-11-20 22:50:26 -08:00
parent 6b6e9b503d
commit 19ba95f799
3 changed files with 9 additions and 4 deletions

View File

@ -721,7 +721,7 @@ int cbfs_add_entry(struct cbfs_image *image, struct buffer *buffer,
assert(image); assert(image);
assert(buffer); assert(buffer);
assert(buffer->data); assert(buffer->data);
assert(!IS_TOP_ALIGNED_ADDRESS(content_offset)); assert(!IS_HOST_SPACE_ADDRESS(content_offset));
const char *name = header->filename; const char *name = header->filename;

View File

@ -571,7 +571,7 @@ static int cbfs_add_component(const char *filename,
return -1; 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); offset = convert_to_from_absolute_top_aligned(param.image_region, -offset);
if (cbfs_add_entry(&image, &buffer, offset, header, len_align) != 0) { if (cbfs_add_entry(&image, &buffer, offset, header, len_align) != 0) {
ERROR("Failed to add '%s' into ROM image.\n", filename); 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. * passed in by the caller.
*/ */
if (param.stage_xip) { if (param.stage_xip) {
if (!IS_TOP_ALIGNED_ADDRESS(address)) if (!IS_HOST_SPACE_ADDRESS(address))
address = -convert_to_from_absolute_top_aligned( address = -convert_to_from_absolute_top_aligned(
param.image_region, address); param.image_region, address);
} else { } else {

View File

@ -15,7 +15,12 @@
#include "swab.h" #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)) #define unused __attribute__((unused))