drivers: video: rockchip: vcodec_dma_map_sg maybe fail
[firefly-linux-kernel-4.4.55.git] / drivers / firmware / efi / arm-init.c
index ffdd76a51929bffbc75322140bf26e8454177240..a76c35fc0b927f45782f25607032b7724dd62138 100644 (file)
@@ -57,7 +57,7 @@ static int __init uefi_init(void)
 {
        efi_char16_t *c16;
        void *config_tables;
-       u64 table_size;
+       size_t table_size;
        char vendor[100] = "unknown";
        int i, retval;
 
@@ -69,7 +69,8 @@ static int __init uefi_init(void)
        }
 
        set_bit(EFI_BOOT, &efi.flags);
-       set_bit(EFI_64BIT, &efi.flags);
+       if (IS_ENABLED(CONFIG_64BIT))
+               set_bit(EFI_64BIT, &efi.flags);
 
        /*
         * Verify the EFI Table
@@ -107,7 +108,7 @@ static int __init uefi_init(void)
                goto out;
        }
        retval = efi_config_parse_tables(config_tables, efi.systab->nr_tables,
-                                        sizeof(efi_config_table_64_t), NULL);
+                                        sizeof(efi_config_table_t), NULL);
 
        early_memunmap(config_tables, table_size);
 out:
@@ -202,7 +203,19 @@ void __init efi_init(void)
 
        reserve_regions();
        early_memunmap(memmap.map, params.mmap_size);
-       memblock_mark_nomap(params.mmap & PAGE_MASK,
-                           PAGE_ALIGN(params.mmap_size +
-                                      (params.mmap & ~PAGE_MASK)));
+
+       if (IS_ENABLED(CONFIG_ARM)) {
+               /*
+                * ARM currently does not allow ioremap_cache() to be called on
+                * memory regions that are covered by struct page. So remove the
+                * UEFI memory map from the linear mapping.
+                */
+               memblock_mark_nomap(params.mmap & PAGE_MASK,
+                                   PAGE_ALIGN(params.mmap_size +
+                                              (params.mmap & ~PAGE_MASK)));
+       } else {
+               memblock_reserve(params.mmap & PAGE_MASK,
+                                PAGE_ALIGN(params.mmap_size +
+                                           (params.mmap & ~PAGE_MASK)));
+       }
 }