diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-03-31 15:26:05 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-03-31 15:26:05 -0400 |
| commit | 7cc3afdf43ffb703db831292f3816d909fd44767 (patch) | |
| tree | 9c9f4b9c1a880b4f8ec4fc44ef80b6568142756b /include/linux | |
| parent | ad8946fbf913fff8671cbaee776d23c3d07173fa (diff) | |
| parent | 204b0a1a4b92612c957a042df1a3be0e9cc79391 (diff) | |
Merge branch 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 EFI changes from Ingo Molnar:
"The main changes:
- Add debug code to the dump EFI pagetable - Borislav Petkov
- Make 1:1 runtime mapping robust when booting on machines with lots
of memory - Borislav Petkov
- Move the EFI facilities bits out of 'x86_efi_facility' and into
efi.flags which is the standard architecture independent place to
keep EFI state, by Matt Fleming.
- Add 'EFI mixed mode' support: this allows 64-bit kernels to be
booted from 32-bit firmware. This needs a bootloader that supports
the 'EFI handover protocol'. By Matt Fleming"
* 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (31 commits)
x86, efi: Abstract x86 efi_early calls
x86/efi: Restore 'attr' argument to query_variable_info()
x86/efi: Rip out phys_efi_get_time()
x86/efi: Preserve segment registers in mixed mode
x86/boot: Fix non-EFI build
x86, tools: Fix up compiler warnings
x86/efi: Re-disable interrupts after calling firmware services
x86/boot: Don't overwrite cr4 when enabling PAE
x86/efi: Wire up CONFIG_EFI_MIXED
x86/efi: Add mixed runtime services support
x86/efi: Firmware agnostic handover entry points
x86/efi: Split the boot stub into 32/64 code paths
x86/efi: Add early thunk code to go from 64-bit to 32-bit
x86/efi: Build our own EFI services pointer table
efi: Add separate 32-bit/64-bit definitions
x86/efi: Delete dead code when checking for non-native
x86/mm/pageattr: Always dump the right page table in an oops
x86, tools: Consolidate #ifdef code
x86/boot: Cleanup header.S by removing some #ifdefs
efi: Use NULL instead of 0 for pointer
...
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/efi.h | 268 |
1 files changed, 260 insertions, 8 deletions
diff --git a/include/linux/efi.h b/include/linux/efi.h index 0a819e7a60c9..6c100ff0cae4 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h | |||
| @@ -153,6 +153,102 @@ typedef struct { | |||
| 153 | u8 sets_to_zero; | 153 | u8 sets_to_zero; |
| 154 | } efi_time_cap_t; | 154 | } efi_time_cap_t; |
| 155 | 155 | ||
| 156 | typedef struct { | ||
| 157 | efi_table_hdr_t hdr; | ||
| 158 | u32 raise_tpl; | ||
| 159 | u32 restore_tpl; | ||
| 160 | u32 allocate_pages; | ||
| 161 | u32 free_pages; | ||
| 162 | u32 get_memory_map; | ||
| 163 | u32 allocate_pool; | ||
| 164 | u32 free_pool; | ||
| 165 | u32 create_event; | ||
| 166 | u32 set_timer; | ||
| 167 | u32 wait_for_event; | ||
| 168 | u32 signal_event; | ||
| 169 | u32 close_event; | ||
| 170 | u32 check_event; | ||
| 171 | u32 install_protocol_interface; | ||
| 172 | u32 reinstall_protocol_interface; | ||
| 173 | u32 uninstall_protocol_interface; | ||
| 174 | u32 handle_protocol; | ||
| 175 | u32 __reserved; | ||
| 176 | u32 register_protocol_notify; | ||
| 177 | u32 locate_handle; | ||
| 178 | u32 locate_device_path; | ||
| 179 | u32 install_configuration_table; | ||
| 180 | u32 load_image; | ||
| 181 | u32 start_image; | ||
| 182 | u32 exit; | ||
| 183 | u32 unload_image; | ||
| 184 | u32 exit_boot_services; | ||
| 185 | u32 get_next_monotonic_count; | ||
| 186 | u32 stall; | ||
| 187 | u32 set_watchdog_timer; | ||
| 188 | u32 connect_controller; | ||
| 189 | u32 disconnect_controller; | ||
| 190 | u32 open_protocol; | ||
| 191 | u32 close_protocol; | ||
| 192 | u32 open_protocol_information; | ||
| 193 | u32 protocols_per_handle; | ||
| 194 | u32 locate_handle_buffer; | ||
| 195 | u32 locate_protocol; | ||
| 196 | u32 install_multiple_protocol_interfaces; | ||
| 197 | u32 uninstall_multiple_protocol_interfaces; | ||
| 198 | u32 calculate_crc32; | ||
| 199 | u32 copy_mem; | ||
| 200 | u32 set_mem; | ||
| 201 | u32 create_event_ex; | ||
| 202 | } __packed efi_boot_services_32_t; | ||
| 203 | |||
| 204 | typedef struct { | ||
| 205 | efi_table_hdr_t hdr; | ||
| 206 | u64 raise_tpl; | ||
| 207 | u64 restore_tpl; | ||
| 208 | u64 allocate_pages; | ||
| 209 | u64 free_pages; | ||
| 210 | u64 get_memory_map; | ||
| 211 | u64 allocate_pool; | ||
| 212 | u64 free_pool; | ||
| 213 | u64 create_event; | ||
| 214 | u64 set_timer; | ||
| 215 | u64 wait_for_event; | ||
| 216 | u64 signal_event; | ||
| 217 | u64 close_event; | ||
| 218 | u64 check_event; | ||
| 219 | u64 install_protocol_interface; | ||
| 220 | u64 reinstall_protocol_interface; | ||
| 221 | u64 uninstall_protocol_interface; | ||
| 222 | u64 handle_protocol; | ||
| 223 | u64 __reserved; | ||
| 224 | u64 register_protocol_notify; | ||
| 225 | u64 locate_handle; | ||
| 226 | u64 locate_device_path; | ||
| 227 | u64 install_configuration_table; | ||
| 228 | u64 load_image; | ||
| 229 | u64 start_image; | ||
| 230 | u64 exit; | ||
| 231 | u64 unload_image; | ||
| 232 | u64 exit_boot_services; | ||
| 233 | u64 get_next_monotonic_count; | ||
| 234 | u64 stall; | ||
| 235 | u64 set_watchdog_timer; | ||
| 236 | u64 connect_controller; | ||
| 237 | u64 disconnect_controller; | ||
| 238 | u64 open_protocol; | ||
| 239 | u64 close_protocol; | ||
| 240 | u64 open_protocol_information; | ||
| 241 | u64 protocols_per_handle; | ||
| 242 | u64 locate_handle_buffer; | ||
| 243 | u64 locate_protocol; | ||
| 244 | u64 install_multiple_protocol_interfaces; | ||
| 245 | u64 uninstall_multiple_protocol_interfaces; | ||
| 246 | u64 calculate_crc32; | ||
| 247 | u64 copy_mem; | ||
| 248 | u64 set_mem; | ||
| 249 | u64 create_event_ex; | ||
| 250 | } __packed efi_boot_services_64_t; | ||
| 251 | |||
| 156 | /* | 252 | /* |
| 157 | * EFI Boot Services table | 253 | * EFI Boot Services table |
| 158 | */ | 254 | */ |
| @@ -231,6 +327,15 @@ typedef enum { | |||
| 231 | EfiPciIoAttributeOperationMaximum | 327 | EfiPciIoAttributeOperationMaximum |
| 232 | } EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION; | 328 | } EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION; |
| 233 | 329 | ||
| 330 | typedef struct { | ||
| 331 | u32 read; | ||
| 332 | u32 write; | ||
| 333 | } efi_pci_io_protocol_access_32_t; | ||
| 334 | |||
| 335 | typedef struct { | ||
| 336 | u64 read; | ||
| 337 | u64 write; | ||
| 338 | } efi_pci_io_protocol_access_64_t; | ||
| 234 | 339 | ||
| 235 | typedef struct { | 340 | typedef struct { |
| 236 | void *read; | 341 | void *read; |
| @@ -238,6 +343,46 @@ typedef struct { | |||
| 238 | } efi_pci_io_protocol_access_t; | 343 | } efi_pci_io_protocol_access_t; |
| 239 | 344 | ||
| 240 | typedef struct { | 345 | typedef struct { |
| 346 | u32 poll_mem; | ||
| 347 | u32 poll_io; | ||
| 348 | efi_pci_io_protocol_access_32_t mem; | ||
| 349 | efi_pci_io_protocol_access_32_t io; | ||
| 350 | efi_pci_io_protocol_access_32_t pci; | ||
| 351 | u32 copy_mem; | ||
| 352 | u32 map; | ||
| 353 | u32 unmap; | ||
| 354 | u32 allocate_buffer; | ||
| 355 | u32 free_buffer; | ||
| 356 | u32 flush; | ||
| 357 | u32 get_location; | ||
| 358 | u32 attributes; | ||
| 359 | u32 get_bar_attributes; | ||
| 360 | u32 set_bar_attributes; | ||
| 361 | uint64_t romsize; | ||
| 362 | void *romimage; | ||
| 363 | } efi_pci_io_protocol_32; | ||
| 364 | |||
| 365 | typedef struct { | ||
| 366 | u64 poll_mem; | ||
| 367 | u64 poll_io; | ||
| 368 | efi_pci_io_protocol_access_64_t mem; | ||
| 369 | efi_pci_io_protocol_access_64_t io; | ||
| 370 | efi_pci_io_protocol_access_64_t pci; | ||
| 371 | u64 copy_mem; | ||
| 372 | u64 map; | ||
| 373 | u64 unmap; | ||
| 374 | u64 allocate_buffer; | ||
| 375 | u64 free_buffer; | ||
| 376 | u64 flush; | ||
| 377 | u64 get_location; | ||
| 378 | u64 attributes; | ||
| 379 | u64 get_bar_attributes; | ||
| 380 | u64 set_bar_attributes; | ||
| 381 | uint64_t romsize; | ||
| 382 | void *romimage; | ||
| 383 | } efi_pci_io_protocol_64; | ||
| 384 | |||
| 385 | typedef struct { | ||
| 241 | void *poll_mem; | 386 | void *poll_mem; |
| 242 | void *poll_io; | 387 | void *poll_io; |
| 243 | efi_pci_io_protocol_access_t mem; | 388 | efi_pci_io_protocol_access_t mem; |
| @@ -292,6 +437,42 @@ typedef struct { | |||
| 292 | 437 | ||
| 293 | typedef struct { | 438 | typedef struct { |
| 294 | efi_table_hdr_t hdr; | 439 | efi_table_hdr_t hdr; |
| 440 | u32 get_time; | ||
| 441 | u32 set_time; | ||
| 442 | u32 get_wakeup_time; | ||
| 443 | u32 set_wakeup_time; | ||
| 444 | u32 set_virtual_address_map; | ||
| 445 | u32 convert_pointer; | ||
| 446 | u32 get_variable; | ||
| 447 | u32 get_next_variable; | ||
| 448 | u32 set_variable; | ||
| 449 | u32 get_next_high_mono_count; | ||
| 450 | u32 reset_system; | ||
| 451 | u32 update_capsule; | ||
| 452 | u32 query_capsule_caps; | ||
| 453 | u32 query_variable_info; | ||
| 454 | } efi_runtime_services_32_t; | ||
| 455 | |||
| 456 | typedef struct { | ||
| 457 | efi_table_hdr_t hdr; | ||
| 458 | u64 get_time; | ||
| 459 | u64 set_time; | ||
| 460 | u64 get_wakeup_time; | ||
| 461 | u64 set_wakeup_time; | ||
| 462 | u64 set_virtual_address_map; | ||
| 463 | u64 convert_pointer; | ||
| 464 | u64 get_variable; | ||
| 465 | u64 get_next_variable; | ||
| 466 | u64 set_variable; | ||
| 467 | u64 get_next_high_mono_count; | ||
| 468 | u64 reset_system; | ||
| 469 | u64 update_capsule; | ||
| 470 | u64 query_capsule_caps; | ||
| 471 | u64 query_variable_info; | ||
| 472 | } efi_runtime_services_64_t; | ||
| 473 | |||
| 474 | typedef struct { | ||
| 475 | efi_table_hdr_t hdr; | ||
| 295 | void *get_time; | 476 | void *get_time; |
| 296 | void *set_time; | 477 | void *set_time; |
| 297 | void *get_wakeup_time; | 478 | void *get_wakeup_time; |
| @@ -485,6 +666,38 @@ struct efi_memory_map { | |||
| 485 | 666 | ||
| 486 | typedef struct { | 667 | typedef struct { |
| 487 | u32 revision; | 668 | u32 revision; |
| 669 | u32 parent_handle; | ||
| 670 | u32 system_table; | ||
| 671 | u32 device_handle; | ||
| 672 | u32 file_path; | ||
| 673 | u32 reserved; | ||
| 674 | u32 load_options_size; | ||
| 675 | u32 load_options; | ||
| 676 | u32 image_base; | ||
| 677 | __aligned_u64 image_size; | ||
| 678 | unsigned int image_code_type; | ||
| 679 | unsigned int image_data_type; | ||
| 680 | unsigned long unload; | ||
| 681 | } efi_loaded_image_32_t; | ||
| 682 | |||
| 683 | typedef struct { | ||
| 684 | u32 revision; | ||
| 685 | u64 parent_handle; | ||
| 686 | u64 system_table; | ||
| 687 | u64 device_handle; | ||
| 688 | u64 file_path; | ||
| 689 | u64 reserved; | ||
| 690 | u32 load_options_size; | ||
| 691 | u64 load_options; | ||
| 692 | u64 image_base; | ||
| 693 | __aligned_u64 image_size; | ||
| 694 | unsigned int image_code_type; | ||
| 695 | unsigned int image_data_type; | ||
| 696 | unsigned long unload; | ||
| 697 | } efi_loaded_image_64_t; | ||
| 698 | |||
| 699 | typedef struct { | ||
| 700 | u32 revision; | ||
| 488 | void *parent_handle; | 701 | void *parent_handle; |
| 489 | efi_system_table_t *system_table; | 702 | efi_system_table_t *system_table; |
| 490 | void *device_handle; | 703 | void *device_handle; |
| @@ -511,6 +724,34 @@ typedef struct { | |||
| 511 | efi_char16_t filename[1]; | 724 | efi_char16_t filename[1]; |
| 512 | } efi_file_info_t; | 725 | } efi_file_info_t; |
| 513 | 726 | ||
| 727 | typedef struct { | ||
| 728 | u64 revision; | ||
| 729 | u32 open; | ||
| 730 | u32 close; | ||
| 731 | u32 delete; | ||
| 732 | u32 read; | ||
| 733 | u32 write; | ||
| 734 | u32 get_position; | ||
| 735 | u32 set_position; | ||
| 736 | u32 get_info; | ||
| 737 | u32 set_info; | ||
| 738 | u32 flush; | ||
| 739 | } efi_file_handle_32_t; | ||
| 740 | |||
| 741 | typedef struct { | ||
| 742 | u64 revision; | ||
| 743 | u64 open; | ||
| 744 | u64 close; | ||
| 745 | u64 delete; | ||
| 746 | u64 read; | ||
| 747 | u64 write; | ||
| 748 | u64 get_position; | ||
| 749 | u64 set_position; | ||
| 750 | u64 get_info; | ||
| 751 | u64 set_info; | ||
| 752 | u64 flush; | ||
| 753 | } efi_file_handle_64_t; | ||
| 754 | |||
| 514 | typedef struct _efi_file_handle { | 755 | typedef struct _efi_file_handle { |
| 515 | u64 revision; | 756 | u64 revision; |
| 516 | efi_status_t (*open)(struct _efi_file_handle *, | 757 | efi_status_t (*open)(struct _efi_file_handle *, |
| @@ -573,6 +814,7 @@ extern struct efi { | |||
| 573 | efi_reset_system_t *reset_system; | 814 | efi_reset_system_t *reset_system; |
| 574 | efi_set_virtual_address_map_t *set_virtual_address_map; | 815 | efi_set_virtual_address_map_t *set_virtual_address_map; |
| 575 | struct efi_memory_map *memmap; | 816 | struct efi_memory_map *memmap; |
| 817 | unsigned long flags; | ||
| 576 | } efi; | 818 | } efi; |
| 577 | 819 | ||
| 578 | static inline int | 820 | static inline int |
| @@ -659,18 +901,17 @@ extern int __init efi_setup_pcdp_console(char *); | |||
| 659 | #define EFI_ARCH_1 6 /* First arch-specific bit */ | 901 | #define EFI_ARCH_1 6 /* First arch-specific bit */ |
| 660 | 902 | ||
| 661 | #ifdef CONFIG_EFI | 903 | #ifdef CONFIG_EFI |
| 662 | # ifdef CONFIG_X86 | 904 | /* |
| 663 | extern int efi_enabled(int facility); | 905 | * Test whether the above EFI_* bits are enabled. |
| 664 | # else | 906 | */ |
| 665 | static inline int efi_enabled(int facility) | 907 | static inline bool efi_enabled(int feature) |
| 666 | { | 908 | { |
| 667 | return 1; | 909 | return test_bit(feature, &efi.flags) != 0; |
| 668 | } | 910 | } |
| 669 | # endif | ||
| 670 | #else | 911 | #else |
| 671 | static inline int efi_enabled(int facility) | 912 | static inline bool efi_enabled(int feature) |
| 672 | { | 913 | { |
| 673 | return 0; | 914 | return false; |
| 674 | } | 915 | } |
| 675 | #endif | 916 | #endif |
| 676 | 917 | ||
| @@ -809,6 +1050,17 @@ struct efivar_entry { | |||
| 809 | bool deleting; | 1050 | bool deleting; |
| 810 | }; | 1051 | }; |
| 811 | 1052 | ||
| 1053 | struct efi_simple_text_output_protocol_32 { | ||
| 1054 | u32 reset; | ||
| 1055 | u32 output_string; | ||
| 1056 | u32 test_string; | ||
| 1057 | }; | ||
| 1058 | |||
| 1059 | struct efi_simple_text_output_protocol_64 { | ||
| 1060 | u64 reset; | ||
| 1061 | u64 output_string; | ||
| 1062 | u64 test_string; | ||
| 1063 | }; | ||
| 812 | 1064 | ||
| 813 | struct efi_simple_text_output_protocol { | 1065 | struct efi_simple_text_output_protocol { |
| 814 | void *reset; | 1066 | void *reset; |
