Merge branch 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 12 Jan 2012 03:12:33 +0000 (19:12 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 12 Jan 2012 03:12:33 +0000 (19:12 -0800)
* 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86, efi: Break up large initrd reads
  x86, efi: EFI boot stub support
  efi: Add EFI file I/O data types
  efi.h: Add boottime->locate_handle search types
  efi.h: Add graphics protocol guids
  efi.h: Add allocation types for boottime->allocate_pages()
  efi.h: Add efi_image_loaded_t
  efi.h: Add struct definition for boot time services
  x86: Don't use magic strings for EFI loader signature
  x86: Add missing bzImage fields to struct setup_header

1  2 
arch/x86/Kconfig
arch/x86/include/asm/efi.h
arch/x86/kernel/setup.c

diff --combined arch/x86/Kconfig
index 1a31254ceb839348de42bd0473e20c2da21e3eb0,d71b656bcb977d7eb5933e446f07d0090f6822f6..2513da0e6b67d838715b49c101157d1611bcb445
@@@ -26,8 -26,6 +26,8 @@@ config X8
        select HAVE_IOREMAP_PROT
        select HAVE_KPROBES
        select HAVE_MEMBLOCK
 +      select HAVE_MEMBLOCK_NODE_MAP
 +      select ARCH_DISCARD_MEMBLOCK
        select ARCH_WANT_OPTIONAL_GPIOLIB
        select ARCH_WANT_FRAME_POINTERS
        select HAVE_DMA_ATTRS
@@@ -62,7 -60,6 +62,7 @@@
        select ANON_INODES
        select HAVE_ARCH_KMEMCHECK
        select HAVE_USER_RETURN_NOTIFIER
 +      select ARCH_BINFMT_ELF_RANDOMIZE_PIE
        select HAVE_ARCH_JUMP_LABEL
        select HAVE_TEXT_POKE_SMP
        select HAVE_GENERIC_HARDIRQS
@@@ -78,7 -75,6 +78,7 @@@
        select HAVE_BPF_JIT if (X86_64 && NET)
        select CLKEVT_I8253
        select ARCH_HAVE_NMI_SAFE_CMPXCHG
 +      select GENERIC_IOMAP
  
  config INSTRUCTION_DECODER
        def_bool (KPROBES || PERF_EVENTS)
@@@ -144,6 -140,9 +144,6 @@@ config NEED_SG_DMA_LENGT
  config GENERIC_ISA_DMA
        def_bool ISA_DMA_API
  
 -config GENERIC_IOMAP
 -      def_bool y
 -
  config GENERIC_BUG
        def_bool y
        depends on BUG
@@@ -205,6 -204,9 +205,6 @@@ config ZONE_DMA3
        bool
        default X86_64
  
 -config ARCH_POPULATES_NODE_MAP
 -      def_bool y
 -
  config AUDIT_ARCH
        bool
        default X86_64
@@@ -341,7 -343,6 +341,7 @@@ config X86_EXTENDED_PLATFOR
  
          If you enable this option then you'll be able to select support
          for the following (non-PC) 64 bit x86 platforms:
 +              Numascale NumaChip
                ScaleMP vSMP
                SGI Ultraviolet
  
  endif
  # This is an alphabetically sorted list of 64 bit extended platforms
  # Please maintain the alphabetic order if and when there are additions
 +config X86_NUMACHIP
 +      bool "Numascale NumaChip"
 +      depends on X86_64
 +      depends on X86_EXTENDED_PLATFORM
 +      depends on NUMA
 +      depends on SMP
 +      depends on X86_X2APIC
 +      depends on !EDAC_AMD64
 +      ---help---
 +        Adds support for Numascale NumaChip large-SMP systems. Needed to
 +        enable more than ~168 cores.
 +        If you don't have one of these, you should say N here.
  
  config X86_VSMP
        bool "ScaleMP vSMP"
@@@ -1489,6 -1478,13 +1489,13 @@@ config EF
          resultant kernel should continue to boot on existing non-EFI
          platforms.
  
+ config EFI_STUB
+        bool "EFI stub support"
+        depends on EFI
+        ---help---
+           This kernel feature allows a bzImage to be loaded directly
+         by EFI firmware without the use of a bootloader.
  config SECCOMP
        def_bool y
        prompt "Enable seccomp to safely compute untrusted bytecode"
@@@ -1741,7 -1737,7 +1748,7 @@@ source "drivers/sfi/Kconfig
  
  config X86_APM_BOOT
        def_bool y
 -      depends on APM || APM_MODULE
 +      depends on APM
  
  menuconfig APM
        tristate "APM (Advanced Power Management) BIOS support"
index 7093e4a6a0bc6dd5644b2b14cbef9ef5f4085eef,26d8c18d5faa046b42253be74e798f64f4157e7a..844f735fd63aa5763804e51710b7ed45ddf10e76
@@@ -3,6 -3,8 +3,8 @@@
  
  #ifdef CONFIG_X86_32
  
+ #define EFI_LOADER_SIGNATURE  "EL32"
  extern unsigned long asmlinkage efi_call_phys(void *, ...);
  
  #define efi_call_phys0(f)             efi_call_phys(f)
  #define efi_call_virt6(f, a1, a2, a3, a4, a5, a6)     \
        efi_call_virt(f, a1, a2, a3, a4, a5, a6)
  
 +#define efi_ioremap(addr, size, type)         ioremap_cache(addr, size)
 +
  #else /* !CONFIG_X86_32 */
  
+ #define EFI_LOADER_SIGNATURE  "EL64"
  extern u64 efi_call0(void *fp);
  extern u64 efi_call1(void *fp, u64 arg1);
  extern u64 efi_call2(void *fp, u64 arg1, u64 arg2);
@@@ -84,9 -86,6 +88,9 @@@ extern u64 efi_call6(void *fp, u64 arg1
        efi_call6((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
                  (u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6))
  
 +extern void __iomem *efi_ioremap(unsigned long addr, unsigned long size,
 +                               u32 type);
 +
  #endif /* CONFIG_X86_32 */
  
  extern int add_efi_memmap;
diff --combined arch/x86/kernel/setup.c
index d05444ac2aea59378d1aac95e53c44f0a7a19a4e,4d5243c31ac45a0f6552e2cd318643ba957cde03..d7d5099fe8746f4ea795bd58e8f1d42d511a6ca8
@@@ -306,8 -306,7 +306,8 @@@ static void __init cleanup_highmap(void
  static void __init reserve_brk(void)
  {
        if (_brk_end > _brk_start)
 -              memblock_x86_reserve_range(__pa(_brk_start), __pa(_brk_end), "BRK");
 +              memblock_reserve(__pa(_brk_start),
 +                               __pa(_brk_end) - __pa(_brk_start));
  
        /* Mark brk area as locked down and no longer taking any
           new allocations */
@@@ -332,13 -331,13 +332,13 @@@ static void __init relocate_initrd(void
        ramdisk_here = memblock_find_in_range(0, end_of_lowmem, area_size,
                                         PAGE_SIZE);
  
 -      if (ramdisk_here == MEMBLOCK_ERROR)
 +      if (!ramdisk_here)
                panic("Cannot find place for new RAMDISK of size %lld\n",
                         ramdisk_size);
  
        /* Note: this includes all the lowmem currently occupied by
           the initrd, we rely on that fact to keep the data intact. */
 -      memblock_x86_reserve_range(ramdisk_here, ramdisk_here + area_size, "NEW RAMDISK");
 +      memblock_reserve(ramdisk_here, area_size);
        initrd_start = ramdisk_here + PAGE_OFFSET;
        initrd_end   = initrd_start + ramdisk_size;
        printk(KERN_INFO "Allocated new RAMDISK: %08llx - %08llx\n",
@@@ -394,7 -393,7 +394,7 @@@ static void __init reserve_initrd(void
        initrd_start = 0;
  
        if (ramdisk_size >= (end_of_lowmem>>1)) {
 -              memblock_x86_free_range(ramdisk_image, ramdisk_end);
 +              memblock_free(ramdisk_image, ramdisk_end - ramdisk_image);
                printk(KERN_ERR "initrd too large to handle, "
                       "disabling initrd\n");
                return;
  
        relocate_initrd();
  
 -      memblock_x86_free_range(ramdisk_image, ramdisk_end);
 +      memblock_free(ramdisk_image, ramdisk_end - ramdisk_image);
  }
  #else
  static void __init reserve_initrd(void)
@@@ -491,13 -490,15 +491,13 @@@ static void __init memblock_x86_reserve
  {
        struct setup_data *data;
        u64 pa_data;
 -      char buf[32];
  
        if (boot_params.hdr.version < 0x0209)
                return;
        pa_data = boot_params.hdr.setup_data;
        while (pa_data) {
                data = early_memremap(pa_data, sizeof(*data));
 -              sprintf(buf, "setup data %x", data->type);
 -              memblock_x86_reserve_range(pa_data, pa_data+sizeof(*data)+data->len, buf);
 +              memblock_reserve(pa_data, sizeof(*data) + data->len);
                pa_data = data->next;
                early_iounmap(data, sizeof(*data));
        }
@@@ -553,7 -554,7 +553,7 @@@ static void __init reserve_crashkernel(
                crash_base = memblock_find_in_range(alignment,
                               CRASH_KERNEL_ADDR_MAX, crash_size, alignment);
  
 -              if (crash_base == MEMBLOCK_ERROR) {
 +              if (!crash_base) {
                        pr_info("crashkernel reservation failed - No suitable area found.\n");
                        return;
                }
                        return;
                }
        }
 -      memblock_x86_reserve_range(crash_base, crash_base + crash_size, "CRASH KERNEL");
 +      memblock_reserve(crash_base, crash_size);
  
        printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
                        "for crashkernel (System RAM: %ldMB)\n",
@@@ -625,7 -626,7 +625,7 @@@ static __init void reserve_ibft_region(
        addr = find_ibft_region(&size);
  
        if (size)
 -              memblock_x86_reserve_range(addr, addr + size, "* ibft");
 +              memblock_reserve(addr, size);
  }
  
  static unsigned reserve_low = CONFIG_X86_RESERVE_LOW << 10;
@@@ -690,6 -691,8 +690,6 @@@ early_param("reservelow", parse_reserve
  
  void __init setup_arch(char **cmdline_p)
  {
 -      unsigned long end_pfn;
 -
  #ifdef CONFIG_X86_32
        memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data));
        visws_early_detect();
  #endif
  #ifdef CONFIG_EFI
        if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
- #ifdef CONFIG_X86_32
-                    "EL32",
- #else
-                    "EL64",
- #endif
-        4)) {
+                    EFI_LOADER_SIGNATURE, 4)) {
                efi_enabled = 1;
                efi_memblock_x86_reserve_range();
        }
        init_gbpages();
  
        /* max_pfn_mapped is updated here */
 -      end_pfn = max_low_pfn;
 -
 -#ifdef CONFIG_X86_64
 -      /*
 -       * There may be regions after the last E820_RAM region that we
 -       * want to include in the kernel direct mapping, such as
 -       * EFI_RUNTIME_SERVICES_DATA.
 -       */
 -      if (efi_enabled) {
 -              unsigned long efi_end;
 -
 -              efi_end = e820_end_pfn(MAXMEM>>PAGE_SHIFT, E820_RESERVED_EFI);
 -              if (efi_end > max_low_pfn)
 -                      end_pfn = efi_end;
 -      }
 -#endif
 -
 -      max_low_pfn_mapped = init_memory_mapping(0, end_pfn << PAGE_SHIFT);
 +      max_low_pfn_mapped = init_memory_mapping(0, max_low_pfn<<PAGE_SHIFT);
        max_pfn_mapped = max_low_pfn_mapped;
  
  #ifdef CONFIG_X86_64