efi_loader: avoid anonymous constants for AllocatePages
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Sat, 26 May 2018 08:32:27 +0000 (10:32 +0200)
committerAlexander Graf <agraf@suse.de>
Sun, 3 Jun 2018 13:27:21 +0000 (15:27 +0200)
Do not use anonymous constants when calling efi_allocage_pages.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
cmd/bootefi.c
lib/efi_loader/efi_memory.c

index 806339823ffaa73d6cb7f995fb995868fc6f0029..707d159baca8c6e565fb8199486b921bed6d26f3 100644 (file)
@@ -143,11 +143,13 @@ static void *copy_fdt(void *fdt)
 
        /* Safe fdt location is at 128MB */
        new_fdt_addr = fdt_ram_start + (128 * 1024 * 1024) + fdt_size;
-       if (efi_allocate_pages(1, EFI_RUNTIME_SERVICES_DATA, fdt_pages,
+       if (efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS,
+                              EFI_RUNTIME_SERVICES_DATA, fdt_pages,
                               &new_fdt_addr) != EFI_SUCCESS) {
                /* If we can't put it there, put it somewhere */
                new_fdt_addr = (ulong)memalign(EFI_PAGE_SIZE, fdt_size);
-               if (efi_allocate_pages(1, EFI_RUNTIME_SERVICES_DATA, fdt_pages,
+               if (efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS,
+                                      EFI_RUNTIME_SERVICES_DATA, fdt_pages,
                                       &new_fdt_addr) != EFI_SUCCESS) {
                        printf("ERROR: Failed to reserve space for FDT\n");
                        return NULL;
index d3302b664989422a5a27d2ce0bfc204ea7182ac9..a4515c89812d183197dd6cec5af18c1292906af7 100644 (file)
@@ -337,7 +337,8 @@ void *efi_alloc(uint64_t len, int memory_type)
        uint64_t pages = (len + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT;
        efi_status_t r;
 
-       r = efi_allocate_pages(0, memory_type, pages, &ret);
+       r = efi_allocate_pages(EFI_ALLOCATE_ANY_PAGES, memory_type, pages,
+                              &ret);
        if (r == EFI_SUCCESS)
                return (void*)(uintptr_t)ret;
 
@@ -384,7 +385,8 @@ efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size, void **buffer)
                return EFI_SUCCESS;
        }
 
-       r = efi_allocate_pages(0, pool_type, num_pages, &t);
+       r = efi_allocate_pages(EFI_ALLOCATE_ANY_PAGES, pool_type, num_pages,
+                              &t);
 
        if (r == EFI_SUCCESS) {
                struct efi_pool_allocation *alloc = (void *)(uintptr_t)t;
@@ -515,7 +517,7 @@ int efi_memory_init(void)
        /* Request a 32bit 64MB bounce buffer region */
        uint64_t efi_bounce_buffer_addr = 0xffffffff;
 
-       if (efi_allocate_pages(1, EFI_LOADER_DATA,
+       if (efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS, EFI_LOADER_DATA,
                               (64 * 1024 * 1024) >> EFI_PAGE_SHIFT,
                               &efi_bounce_buffer_addr) != EFI_SUCCESS)
                return -1;