payloads,src: Replace ALIGN(x, a) by ALIGN_UP(x, a) for clarity
Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I80f3d2c90c58daa62651f6fd635c043b1ce38b84 Reviewed-on: https://review.coreboot.org/c/coreboot/+/68255 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
This commit is contained in:
@@ -228,7 +228,7 @@ void *bootmem_allocate_buffer(size_t size)
|
||||
}
|
||||
|
||||
/* 4KiB alignment. */
|
||||
size = ALIGN(size, 4096);
|
||||
size = ALIGN_UP(size, 4096);
|
||||
region = NULL;
|
||||
memranges_each_entry(r, &bootmem) {
|
||||
if (range_entry_base(r) >= max_addr)
|
||||
|
@@ -37,7 +37,7 @@ static FILE *fopen(const char *path, const char *mode)
|
||||
} else {
|
||||
previous_file = current_file;
|
||||
current_file =
|
||||
(FILE *)(ALIGN(((unsigned long)previous_file->data
|
||||
(FILE *)(ALIGN_UP(((unsigned long)previous_file->data
|
||||
+ previous_file->len), 16));
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ static FILE *fopen(const char *path, const char *mode)
|
||||
current_file->filename = (char *)¤t_file[1];
|
||||
strcpy(current_file->filename, path);
|
||||
current_file->data =
|
||||
(char *)ALIGN(((unsigned long)current_file->filename
|
||||
(char *)ALIGN_UP(((unsigned long)current_file->filename
|
||||
+ strlen(path) + 1), 16);
|
||||
current_file->offset = 0;
|
||||
current_file->len = 0;
|
||||
|
@@ -26,7 +26,7 @@ void *memalign(size_t boundary, size_t size)
|
||||
MALLOCDBG("%s Enter, boundary %zu, size %zu, free_mem_ptr %p\n",
|
||||
__func__, boundary, size, free_mem_ptr);
|
||||
|
||||
free_mem_ptr = (void *)ALIGN((unsigned long)free_mem_ptr, boundary);
|
||||
free_mem_ptr = (void *)ALIGN_UP((unsigned long)free_mem_ptr, boundary);
|
||||
|
||||
p = free_mem_ptr;
|
||||
free_mem_ptr += size;
|
||||
|
@@ -222,7 +222,7 @@ static void *rmodule_cbfs_allocator(void *rsl_arg, size_t unused,
|
||||
* to place the rmodule so that the program falls on the aligned
|
||||
* address with the header just before it. Therefore, we need at least
|
||||
* a page to account for the size of the header. */
|
||||
size_t region_size = ALIGN(memlen + region_alignment, 4096);
|
||||
size_t region_size = ALIGN_UP(memlen + region_alignment, 4096);
|
||||
/* The program starts immediately after the header. However,
|
||||
* it needs to be aligned to a 4KiB boundary. Therefore, adjust the
|
||||
* program location so that the program lands on a page boundary. The
|
||||
|
Reference in New Issue
Block a user