summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/x86/mmap_boot.c4
-rw-r--r--src/arch/x86/walkcbfs.S20
2 files changed, 9 insertions, 15 deletions
diff --git a/src/arch/x86/mmap_boot.c b/src/arch/x86/mmap_boot.c
index 4dd269b772..6c98954ff2 100644
--- a/src/arch/x86/mmap_boot.c
+++ b/src/arch/x86/mmap_boot.c
@@ -53,13 +53,11 @@ int cbfs_boot_region_properties(struct cbfs_props *props)
header.magic = ntohl(header.magic);
header.romsize = ntohl(header.romsize);
header.bootblocksize = ntohl(header.bootblocksize);
- header.align = ntohl(header.align);
header.offset = ntohl(header.offset);
if (header.magic != CBFS_HEADER_MAGIC)
return -1;
- props->align = header.align;
props->offset = header.offset;
if (CONFIG_ROM_SIZE != header.romsize)
props->size = CONFIG_ROM_SIZE;
@@ -67,7 +65,7 @@ int cbfs_boot_region_properties(struct cbfs_props *props)
props->size = header.romsize;
props->size -= props->offset;
props->size -= header.bootblocksize;
- props->size = ALIGN_DOWN(props->size, props->align);
+ props->size = ALIGN_DOWN(props->size, 64);
printk(BIOS_DEBUG, "CBFS @ %zx size %zx\n", props->offset, props->size);
diff --git a/src/arch/x86/walkcbfs.S b/src/arch/x86/walkcbfs.S
index 60eb8b53b0..9c26d3c9a9 100644
--- a/src/arch/x86/walkcbfs.S
+++ b/src/arch/x86/walkcbfs.S
@@ -7,6 +7,9 @@
#define CBFS_HEADER_ALIGN (CBFS_HEADER_BOOTBLOCKSIZE + 4)
#define CBFS_HEADER_OFFSET (CBFS_HEADER_ALIGN + 4)
+/* we use this instead of CBFS_HEADER_ALIGN because the latter is retired. */
+#define CBFS_ALIGNMENT 64
+
#define CBFS_FILE_MAGIC 0
#define CBFS_FILE_LEN (CBFS_FILE_MAGIC + 8)
#define CBFS_FILE_TYPE (CBFS_FILE_LEN + 4)
@@ -74,13 +77,9 @@ tryharder:
mov CBFS_FILE_LEN(%ebx), %edi
bswap %edi
add %edi, %ecx
- mov CBFS_HEADER_PTR, %edi
- mov CBFS_HEADER_ALIGN(%edi), %edi
- bswap %edi
- sub $1, %edi
- add %edi, %ecx
- not %edi
- and %edi, %ecx
+ /* round by 64 bytes */
+ add $(CBFS_ALIGNMENT - 1), %ecx
+ and $~(CBFS_ALIGNMENT - 1), %ecx
/* if oldaddr >= addr, leave */
cmp %ebx, %ecx
@@ -106,11 +105,8 @@ out:
searchfile:
- /* if filemagic isn't found, move forward cbfs_header->align bytes */
- mov CBFS_HEADER_PTR, %edi
- mov CBFS_HEADER_ALIGN(%edi), %edi
- bswap %edi
- add %edi, %ebx
+ /* if filemagic isn't found, move forward 64 bytes */
+ add $CBFS_ALIGNMENT, %ebx
jmp check_for_exit
filemagic: