diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-01-31 01:10:36 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-01-31 01:10:36 -0500 |
| commit | 04c2eee5b9dfcb13f3cd07a5537fb8c785f2751a (patch) | |
| tree | a70cf1df64b3715c502211233dc307abacaed7da | |
| parent | bdb0ae6a767ef2622eb282e06fc225e855341653 (diff) | |
| parent | becbd6608026c15afd88fd3d0c893dfb7b8c7845 (diff) | |
Merge branch 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 EFI fixes from Peter Anvin:
"This is a collection of fixes for the EFI support. The controversial
bit here is a set of patches which bumps the boot protocol version as
part of fixing some serious problems with the EFI handover protocol,
used when booting under EFI using a bootloader as opposed to directly
from EFI. These changes should also make it a lot saner to support
cross-mode 32/64-bit EFI booting in the future. Getting these changes
into 3.8 means we avoid presenting an inconsistent ABI to bootloaders.
Other changes are display detection and fixing efivarfs."
* 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86, efi: remove attribute check from setup_efi_pci
x86, build: Dynamically find entry points in compressed startup code
x86, efi: Fix PCI ROM handing in EFI boot stub, in 32-bit mode
x86, efi: Fix 32-bit EFI handover protocol entry point
x86, efi: Fix display detection in EFI boot stub
x86, boot: Define the 2.12 bzImage boot protocol
x86/boot: Fix minor fd leakage in tools/relocs.c
x86, efi: Set runtime_version to the EFI spec revision
x86, efi: fix 32-bit warnings in setup_efi_pci()
efivarfs: Delete dentry from dcache in efivarfs_file_write()
efivarfs: Never return ENOENT from firmware
efi, x86: Pass a proper identity mapping in efi_call_phys_prelog
efivarfs: Drop link count of the right inode
| -rw-r--r-- | Documentation/x86/boot.txt | 27 | ||||
| -rw-r--r-- | Documentation/x86/zero-page.txt | 4 | ||||
| -rw-r--r-- | arch/x86/boot/Makefile | 4 | ||||
| -rw-r--r-- | arch/x86/boot/compressed/eboot.c | 21 | ||||
| -rw-r--r-- | arch/x86/boot/compressed/head_32.S | 8 | ||||
| -rw-r--r-- | arch/x86/boot/compressed/head_64.S | 8 | ||||
| -rw-r--r-- | arch/x86/boot/header.S | 39 | ||||
| -rw-r--r-- | arch/x86/boot/setup.ld | 2 | ||||
| -rw-r--r-- | arch/x86/boot/tools/build.c | 81 | ||||
| -rw-r--r-- | arch/x86/include/uapi/asm/bootparam.h | 63 | ||||
| -rw-r--r-- | arch/x86/platform/efi/efi.c | 2 | ||||
| -rw-r--r-- | arch/x86/platform/efi/efi_64.c | 22 | ||||
| -rw-r--r-- | arch/x86/tools/relocs.c | 6 | ||||
| -rw-r--r-- | drivers/firmware/efivars.c | 5 |
14 files changed, 216 insertions, 76 deletions
diff --git a/Documentation/x86/boot.txt b/Documentation/x86/boot.txt index 406d82d5d2bb..3edb4c2887a1 100644 --- a/Documentation/x86/boot.txt +++ b/Documentation/x86/boot.txt | |||
| @@ -57,6 +57,10 @@ Protocol 2.10: (Kernel 2.6.31) Added a protocol for relaxed alignment | |||
| 57 | Protocol 2.11: (Kernel 3.6) Added a field for offset of EFI handover | 57 | Protocol 2.11: (Kernel 3.6) Added a field for offset of EFI handover |
| 58 | protocol entry point. | 58 | protocol entry point. |
| 59 | 59 | ||
| 60 | Protocol 2.12: (Kernel 3.9) Added the xloadflags field and extension fields | ||
| 61 | to struct boot_params for for loading bzImage and ramdisk | ||
| 62 | above 4G in 64bit. | ||
| 63 | |||
| 60 | **** MEMORY LAYOUT | 64 | **** MEMORY LAYOUT |
| 61 | 65 | ||
| 62 | The traditional memory map for the kernel loader, used for Image or | 66 | The traditional memory map for the kernel loader, used for Image or |
| @@ -182,7 +186,7 @@ Offset Proto Name Meaning | |||
| 182 | 0230/4 2.05+ kernel_alignment Physical addr alignment required for kernel | 186 | 0230/4 2.05+ kernel_alignment Physical addr alignment required for kernel |
| 183 | 0234/1 2.05+ relocatable_kernel Whether kernel is relocatable or not | 187 | 0234/1 2.05+ relocatable_kernel Whether kernel is relocatable or not |
| 184 | 0235/1 2.10+ min_alignment Minimum alignment, as a power of two | 188 | 0235/1 2.10+ min_alignment Minimum alignment, as a power of two |
| 185 | 0236/2 N/A pad3 Unused | 189 | 0236/2 2.12+ xloadflags Boot protocol option flags |
| 186 | 0238/4 2.06+ cmdline_size Maximum size of the kernel command line | 190 | 0238/4 2.06+ cmdline_size Maximum size of the kernel command line |
| 187 | 023C/4 2.07+ hardware_subarch Hardware subarchitecture | 191 | 023C/4 2.07+ hardware_subarch Hardware subarchitecture |
| 188 | 0240/8 2.07+ hardware_subarch_data Subarchitecture-specific data | 192 | 0240/8 2.07+ hardware_subarch_data Subarchitecture-specific data |
| @@ -582,6 +586,27 @@ Protocol: 2.10+ | |||
| 582 | misaligned kernel. Therefore, a loader should typically try each | 586 | misaligned kernel. Therefore, a loader should typically try each |
| 583 | power-of-two alignment from kernel_alignment down to this alignment. | 587 | power-of-two alignment from kernel_alignment down to this alignment. |
| 584 | 588 | ||
| 589 | Field name: xloadflags | ||
| 590 | Type: read | ||
| 591 | Offset/size: 0x236/2 | ||
| 592 | Protocol: 2.12+ | ||
| 593 | |||
| 594 | This field is a bitmask. | ||
| 595 | |||
| 596 | Bit 0 (read): XLF_KERNEL_64 | ||
| 597 | - If 1, this kernel has the legacy 64-bit entry point at 0x200. | ||
| 598 | |||
| 599 | Bit 1 (read): XLF_CAN_BE_LOADED_ABOVE_4G | ||
| 600 | - If 1, kernel/boot_params/cmdline/ramdisk can be above 4G. | ||
| 601 | |||
| 602 | Bit 2 (read): XLF_EFI_HANDOVER_32 | ||
| 603 | - If 1, the kernel supports the 32-bit EFI handoff entry point | ||
| 604 | given at handover_offset. | ||
| 605 | |||
| 606 | Bit 3 (read): XLF_EFI_HANDOVER_64 | ||
| 607 | - If 1, the kernel supports the 64-bit EFI handoff entry point | ||
| 608 | given at handover_offset + 0x200. | ||
| 609 | |||
| 585 | Field name: cmdline_size | 610 | Field name: cmdline_size |
| 586 | Type: read | 611 | Type: read |
| 587 | Offset/size: 0x238/4 | 612 | Offset/size: 0x238/4 |
diff --git a/Documentation/x86/zero-page.txt b/Documentation/x86/zero-page.txt index cf5437deda81..199f453cb4de 100644 --- a/Documentation/x86/zero-page.txt +++ b/Documentation/x86/zero-page.txt | |||
| @@ -19,6 +19,9 @@ Offset Proto Name Meaning | |||
| 19 | 090/010 ALL hd1_info hd1 disk parameter, OBSOLETE!! | 19 | 090/010 ALL hd1_info hd1 disk parameter, OBSOLETE!! |
| 20 | 0A0/010 ALL sys_desc_table System description table (struct sys_desc_table) | 20 | 0A0/010 ALL sys_desc_table System description table (struct sys_desc_table) |
| 21 | 0B0/010 ALL olpc_ofw_header OLPC's OpenFirmware CIF and friends | 21 | 0B0/010 ALL olpc_ofw_header OLPC's OpenFirmware CIF and friends |
| 22 | 0C0/004 ALL ext_ramdisk_image ramdisk_image high 32bits | ||
| 23 | 0C4/004 ALL ext_ramdisk_size ramdisk_size high 32bits | ||
| 24 | 0C8/004 ALL ext_cmd_line_ptr cmd_line_ptr high 32bits | ||
| 22 | 140/080 ALL edid_info Video mode setup (struct edid_info) | 25 | 140/080 ALL edid_info Video mode setup (struct edid_info) |
| 23 | 1C0/020 ALL efi_info EFI 32 information (struct efi_info) | 26 | 1C0/020 ALL efi_info EFI 32 information (struct efi_info) |
| 24 | 1E0/004 ALL alk_mem_k Alternative mem check, in KB | 27 | 1E0/004 ALL alk_mem_k Alternative mem check, in KB |
| @@ -27,6 +30,7 @@ Offset Proto Name Meaning | |||
| 27 | 1E9/001 ALL eddbuf_entries Number of entries in eddbuf (below) | 30 | 1E9/001 ALL eddbuf_entries Number of entries in eddbuf (below) |
| 28 | 1EA/001 ALL edd_mbr_sig_buf_entries Number of entries in edd_mbr_sig_buffer | 31 | 1EA/001 ALL edd_mbr_sig_buf_entries Number of entries in edd_mbr_sig_buffer |
| 29 | (below) | 32 | (below) |
| 33 | 1EF/001 ALL sentinel Used to detect broken bootloaders | ||
| 30 | 290/040 ALL edd_mbr_sig_buffer EDD MBR signatures | 34 | 290/040 ALL edd_mbr_sig_buffer EDD MBR signatures |
| 31 | 2D0/A00 ALL e820_map E820 memory map table | 35 | 2D0/A00 ALL e820_map E820 memory map table |
| 32 | (array of struct e820entry) | 36 | (array of struct e820entry) |
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile index ccce0ed67dde..379814bc41e3 100644 --- a/arch/x86/boot/Makefile +++ b/arch/x86/boot/Makefile | |||
| @@ -71,7 +71,7 @@ GCOV_PROFILE := n | |||
| 71 | $(obj)/bzImage: asflags-y := $(SVGA_MODE) | 71 | $(obj)/bzImage: asflags-y := $(SVGA_MODE) |
| 72 | 72 | ||
| 73 | quiet_cmd_image = BUILD $@ | 73 | quiet_cmd_image = BUILD $@ |
| 74 | cmd_image = $(obj)/tools/build $(obj)/setup.bin $(obj)/vmlinux.bin > $@ | 74 | cmd_image = $(obj)/tools/build $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/zoffset.h > $@ |
| 75 | 75 | ||
| 76 | $(obj)/bzImage: $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/tools/build FORCE | 76 | $(obj)/bzImage: $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/tools/build FORCE |
| 77 | $(call if_changed,image) | 77 | $(call if_changed,image) |
| @@ -92,7 +92,7 @@ targets += voffset.h | |||
| 92 | $(obj)/voffset.h: vmlinux FORCE | 92 | $(obj)/voffset.h: vmlinux FORCE |
| 93 | $(call if_changed,voffset) | 93 | $(call if_changed,voffset) |
| 94 | 94 | ||
| 95 | sed-zoffset := -e 's/^\([0-9a-fA-F]*\) . \(startup_32\|input_data\|_end\|z_.*\)$$/\#define ZO_\2 0x\1/p' | 95 | sed-zoffset := -e 's/^\([0-9a-fA-F]*\) . \(startup_32\|startup_64\|efi_pe_entry\|efi_stub_entry\|input_data\|_end\|z_.*\)$$/\#define ZO_\2 0x\1/p' |
| 96 | 96 | ||
| 97 | quiet_cmd_zoffset = ZOFFSET $@ | 97 | quiet_cmd_zoffset = ZOFFSET $@ |
| 98 | cmd_zoffset = $(NM) $< | sed -n $(sed-zoffset) > $@ | 98 | cmd_zoffset = $(NM) $< | sed -n $(sed-zoffset) > $@ |
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index 18e329ca108e..f8fa41190c35 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c | |||
| @@ -256,10 +256,10 @@ static efi_status_t setup_efi_pci(struct boot_params *params) | |||
| 256 | int i; | 256 | int i; |
| 257 | struct setup_data *data; | 257 | struct setup_data *data; |
| 258 | 258 | ||
| 259 | data = (struct setup_data *)params->hdr.setup_data; | 259 | data = (struct setup_data *)(unsigned long)params->hdr.setup_data; |
| 260 | 260 | ||
| 261 | while (data && data->next) | 261 | while (data && data->next) |
| 262 | data = (struct setup_data *)data->next; | 262 | data = (struct setup_data *)(unsigned long)data->next; |
| 263 | 263 | ||
| 264 | status = efi_call_phys5(sys_table->boottime->locate_handle, | 264 | status = efi_call_phys5(sys_table->boottime->locate_handle, |
| 265 | EFI_LOCATE_BY_PROTOCOL, &pci_proto, | 265 | EFI_LOCATE_BY_PROTOCOL, &pci_proto, |
| @@ -295,16 +295,18 @@ static efi_status_t setup_efi_pci(struct boot_params *params) | |||
| 295 | if (!pci) | 295 | if (!pci) |
| 296 | continue; | 296 | continue; |
| 297 | 297 | ||
| 298 | #ifdef CONFIG_X86_64 | ||
| 298 | status = efi_call_phys4(pci->attributes, pci, | 299 | status = efi_call_phys4(pci->attributes, pci, |
| 299 | EfiPciIoAttributeOperationGet, 0, | 300 | EfiPciIoAttributeOperationGet, 0, |
| 300 | &attributes); | 301 | &attributes); |
| 301 | 302 | #else | |
| 303 | status = efi_call_phys5(pci->attributes, pci, | ||
| 304 | EfiPciIoAttributeOperationGet, 0, 0, | ||
| 305 | &attributes); | ||
| 306 | #endif | ||
| 302 | if (status != EFI_SUCCESS) | 307 | if (status != EFI_SUCCESS) |
| 303 | continue; | 308 | continue; |
| 304 | 309 | ||
| 305 | if (!(attributes & EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM)) | ||
| 306 | continue; | ||
| 307 | |||
| 308 | if (!pci->romimage || !pci->romsize) | 310 | if (!pci->romimage || !pci->romsize) |
| 309 | continue; | 311 | continue; |
| 310 | 312 | ||
| @@ -345,9 +347,9 @@ static efi_status_t setup_efi_pci(struct boot_params *params) | |||
| 345 | memcpy(rom->romdata, pci->romimage, pci->romsize); | 347 | memcpy(rom->romdata, pci->romimage, pci->romsize); |
| 346 | 348 | ||
| 347 | if (data) | 349 | if (data) |
| 348 | data->next = (uint64_t)rom; | 350 | |
