diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-16 16:06:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-16 16:06:27 -0400 |
commit | 49817c33433a3cd6f320b13699e6746cc39b453b (patch) | |
tree | 1eb8c4a4d585e648b0783741c02ab611149971d9 /include/linux/efi.h | |
parent | 230e51f21101e49c8d73018d414adbd0d57459a1 (diff) | |
parent | 6c5450ef66816216e574885cf8d3ddb31ef77428 (diff) |
Merge branch 'efi-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull EFI updates from Ingo Molnar:
"The main changes in this cycle were:
- Drop the unused EFI_SYSTEM_TABLES efi.flags bit and ensure the
ARM/arm64 EFI System Table mapping is read-only (Ard Biesheuvel)
- Add a comment to explain that one of the code paths in the x86/pat
code is only executed for EFI boot (Matt Fleming)
- Improve Secure Boot status checks on arm64 and handle unexpected
errors (Linn Crosetto)
- Remove the global EFI memory map variable 'memmap' as the same
information is already available in efi::memmap (Matt Fleming)
- Add EFI Memory Attribute table support for ARM/arm64 (Ard
Biesheuvel)
- Add EFI GOP framebuffer support for ARM/arm64 (Ard Biesheuvel)
- Add EFI Bootloader Control driver for storing reboot(2) data in EFI
variables for consumption by bootloaders (Jeremy Compostella)
- Add Core EFI capsule support (Matt Fleming)
- Add EFI capsule char driver (Kweh, Hock Leong)
- Unify EFI memory map code for ARM and arm64 (Ard Biesheuvel)
- Add generic EFI support for detecting when firmware corrupts CPU
status register bits (like IRQ flags) when performing EFI runtime
service calls (Mark Rutland)
... and other misc cleanups"
* 'efi-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (46 commits)
efivarfs: Make efivarfs_file_ioctl() static
efi: Merge boolean flag arguments
efi/capsule: Move 'capsule' to the stack in efi_capsule_supported()
efibc: Fix excessive stack footprint warning
efi/capsule: Make efi_capsule_pending() lockless
efi: Remove unnecessary (and buggy) .memmap initialization from the Xen EFI driver
efi/runtime-wrappers: Remove ARCH_EFI_IRQ_FLAGS_MASK #ifdef
x86/efi: Enable runtime call flag checking
arm/efi: Enable runtime call flag checking
arm64/efi: Enable runtime call flag checking
efi/runtime-wrappers: Detect firmware IRQ flag corruption
efi/runtime-wrappers: Remove redundant #ifdefs
x86/efi: Move to generic {__,}efi_call_virt()
arm/efi: Move to generic {__,}efi_call_virt()
arm64/efi: Move to generic {__,}efi_call_virt()
efi/runtime-wrappers: Add {__,}efi_call_virt() templates
efi/arm-init: Reserve rather than unmap the memory map for ARM as well
efi: Add misc char driver interface to update EFI firmware
x86/efi: Force EFI reboot to process pending capsules
efi: Add 'capsule' update support
...
Diffstat (limited to 'include/linux/efi.h')
-rw-r--r-- | include/linux/efi.h | 167 |
1 files changed, 159 insertions, 8 deletions
diff --git a/include/linux/efi.h b/include/linux/efi.h index 1626474567ac..df7acb51f3cc 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/pfn.h> | 21 | #include <linux/pfn.h> |
22 | #include <linux/pstore.h> | 22 | #include <linux/pstore.h> |
23 | #include <linux/reboot.h> | 23 | #include <linux/reboot.h> |
24 | #include <linux/screen_info.h> | ||
24 | 25 | ||
25 | #include <asm/page.h> | 26 | #include <asm/page.h> |
26 | 27 | ||
@@ -124,6 +125,13 @@ typedef struct { | |||
124 | } efi_capsule_header_t; | 125 | } efi_capsule_header_t; |
125 | 126 | ||
126 | /* | 127 | /* |
128 | * EFI capsule flags | ||
129 | */ | ||
130 | #define EFI_CAPSULE_PERSIST_ACROSS_RESET 0x00010000 | ||
131 | #define EFI_CAPSULE_POPULATE_SYSTEM_TABLE 0x00020000 | ||
132 | #define EFI_CAPSULE_INITIATE_RESET 0x00040000 | ||
133 | |||
134 | /* | ||
127 | * Allocation types for calls to boottime->allocate_pages. | 135 | * Allocation types for calls to boottime->allocate_pages. |
128 | */ | 136 | */ |
129 | #define EFI_ALLOCATE_ANY_PAGES 0 | 137 | #define EFI_ALLOCATE_ANY_PAGES 0 |
@@ -282,9 +290,10 @@ typedef struct { | |||
282 | efi_status_t (*handle_protocol)(efi_handle_t, efi_guid_t *, void **); | 290 | efi_status_t (*handle_protocol)(efi_handle_t, efi_guid_t *, void **); |
283 | void *__reserved; | 291 | void *__reserved; |
284 | void *register_protocol_notify; | 292 | void *register_protocol_notify; |
285 | void *locate_handle; | 293 | efi_status_t (*locate_handle)(int, efi_guid_t *, void *, |
294 | unsigned long *, efi_handle_t *); | ||
286 | void *locate_device_path; | 295 | void *locate_device_path; |
287 | void *install_configuration_table; | 296 | efi_status_t (*install_configuration_table)(efi_guid_t *, void *); |
288 | void *load_image; | 297 | void *load_image; |
289 | void *start_image; | 298 | void *start_image; |
290 | void *exit; | 299 | void *exit; |
@@ -623,6 +632,27 @@ void efi_native_runtime_setup(void); | |||
623 | EFI_GUID(0x3152bca5, 0xeade, 0x433d, \ | 632 | EFI_GUID(0x3152bca5, 0xeade, 0x433d, \ |
624 | 0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44) | 633 | 0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44) |
625 | 634 | ||
635 | #define EFI_MEMORY_ATTRIBUTES_TABLE_GUID \ | ||
636 | EFI_GUID(0xdcfa911d, 0x26eb, 0x469f, \ | ||
637 | 0xa2, 0x20, 0x38, 0xb7, 0xdc, 0x46, 0x12, 0x20) | ||
638 | |||
639 | #define EFI_CONSOLE_OUT_DEVICE_GUID \ | ||
640 | EFI_GUID(0xd3b36f2c, 0xd551, 0x11d4, \ | ||
641 | 0x9a, 0x46, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d) | ||
642 | |||
643 | /* | ||
644 | * This GUID is used to pass to the kernel proper the struct screen_info | ||
645 | * structure that was populated by the stub based on the GOP protocol instance | ||
646 | * associated with ConOut | ||
647 | */ | ||
648 | #define LINUX_EFI_ARM_SCREEN_INFO_TABLE_GUID \ | ||
649 | EFI_GUID(0xe03fc20a, 0x85dc, 0x406e, \ | ||
650 | 0xb9, 0xe, 0x4a, 0xb5, 0x02, 0x37, 0x1d, 0x95) | ||
651 | |||
652 | #define LINUX_EFI_LOADER_ENTRY_GUID \ | ||
653 | EFI_GUID(0x4a67b082, 0x0a4c, 0x41cf, \ | ||
654 | 0xb6, 0xc7, 0x44, 0x0b, 0x29, 0xbb, 0x8c, 0x4f) | ||
655 | |||
626 | typedef struct { | 656 | typedef struct { |
627 | efi_guid_t guid; | 657 | efi_guid_t guid; |
628 | u64 table; | 658 | u64 table; |
@@ -847,6 +877,14 @@ typedef struct { | |||
847 | 877 | ||
848 | #define EFI_INVALID_TABLE_ADDR (~0UL) | 878 | #define EFI_INVALID_TABLE_ADDR (~0UL) |
849 | 879 | ||
880 | typedef struct { | ||
881 | u32 version; | ||
882 | u32 num_entries; | ||
883 | u32 desc_size; | ||
884 | u32 reserved; | ||
885 | efi_memory_desc_t entry[0]; | ||
886 | } efi_memory_attributes_table_t; | ||
887 | |||
850 | /* | 888 | /* |
851 | * All runtime access to EFI goes through this structure: | 889 | * All runtime access to EFI goes through this structure: |
852 | */ | 890 | */ |
@@ -868,6 +906,7 @@ extern struct efi { | |||
868 | unsigned long config_table; /* config tables */ | 906 | unsigned long config_table; /* config tables */ |
869 | unsigned long esrt; /* ESRT table */ | 907 | unsigned long esrt; /* ESRT table */ |
870 | unsigned long properties_table; /* properties table */ | 908 | unsigned long properties_table; /* properties table */ |
909 | unsigned long mem_attr_table; /* memory attributes table */ | ||
871 | efi_get_time_t *get_time; | 910 | efi_get_time_t *get_time; |
872 | efi_set_time_t *set_time; | 911 | efi_set_time_t *set_time; |
873 | efi_get_wakeup_time_t *get_wakeup_time; | 912 | efi_get_wakeup_time_t *get_wakeup_time; |
@@ -883,7 +922,7 @@ extern struct efi { | |||
883 | efi_get_next_high_mono_count_t *get_next_high_mono_count; | 922 | efi_get_next_high_mono_count_t *get_next_high_mono_count; |
884 | efi_reset_system_t *reset_system; | 923 | efi_reset_system_t *reset_system; |
885 | efi_set_virtual_address_map_t *set_virtual_address_map; | 924 | efi_set_virtual_address_map_t *set_virtual_address_map; |
886 | struct efi_memory_map *memmap; | 925 | struct efi_memory_map memmap; |
887 | unsigned long flags; | 926 | unsigned long flags; |
888 | } efi; | 927 | } efi; |
889 | 928 | ||
@@ -945,7 +984,6 @@ extern void efi_initialize_iomem_resources(struct resource *code_resource, | |||
945 | extern void efi_get_time(struct timespec *now); | 984 | extern void efi_get_time(struct timespec *now); |
946 | extern void efi_reserve_boot_services(void); | 985 | extern void efi_reserve_boot_services(void); |
947 | extern int efi_get_fdt_params(struct efi_fdt_params *params); | 986 | extern int efi_get_fdt_params(struct efi_fdt_params *params); |
948 | extern struct efi_memory_map memmap; | ||
949 | extern struct kobject *efi_kobj; | 987 | extern struct kobject *efi_kobj; |
950 | 988 | ||
951 | extern int efi_reboot_quirk_mode; | 989 | extern int efi_reboot_quirk_mode; |
@@ -957,12 +995,34 @@ extern void __init efi_fake_memmap(void); | |||
957 | static inline void efi_fake_memmap(void) { } | 995 | static inline void efi_fake_memmap(void) { } |
958 | #endif | 996 | #endif |
959 | 997 | ||
998 | /* | ||
999 | * efi_memattr_perm_setter - arch specific callback function passed into | ||
1000 | * efi_memattr_apply_permissions() that updates the | ||
1001 | * mapping permissions described by the second | ||
1002 | * argument in the page tables referred to by the | ||
1003 | * first argument. | ||
1004 | */ | ||
1005 | typedef int (*efi_memattr_perm_setter)(struct mm_struct *, efi_memory_desc_t *); | ||
1006 | |||
1007 | extern int efi_memattr_init(void); | ||
1008 | extern int efi_memattr_apply_permissions(struct mm_struct *mm, | ||
1009 | efi_memattr_perm_setter fn); | ||
1010 | |||
960 | /* Iterate through an efi_memory_map */ | 1011 | /* Iterate through an efi_memory_map */ |
961 | #define for_each_efi_memory_desc(m, md) \ | 1012 | #define for_each_efi_memory_desc_in_map(m, md) \ |
962 | for ((md) = (m)->map; \ | 1013 | for ((md) = (m)->map; \ |
963 | (md) <= (efi_memory_desc_t *)((m)->map_end - (m)->desc_size); \ | 1014 | (md) <= (efi_memory_desc_t *)((m)->map_end - (m)->desc_size); \ |
964 | (md) = (void *)(md) + (m)->desc_size) | 1015 | (md) = (void *)(md) + (m)->desc_size) |
965 | 1016 | ||
1017 | /** | ||
1018 | * for_each_efi_memory_desc - iterate over descriptors in efi.memmap | ||
1019 | * @md: the efi_memory_desc_t * iterator | ||
1020 | * | ||
1021 | * Once the loop finishes @md must not be accessed. | ||
1022 | */ | ||
1023 | #define for_each_efi_memory_desc(md) \ | ||
1024 | for_each_efi_memory_desc_in_map(&efi.memmap, md) | ||
1025 | |||
966 | /* | 1026 | /* |
967 | * Format an EFI memory descriptor's type and attributes to a user-provided | 1027 | * Format an EFI memory descriptor's type and attributes to a user-provided |
968 | * character buffer, as per snprintf(), and return the buffer. | 1028 | * character buffer, as per snprintf(), and return the buffer. |
@@ -1000,7 +1060,6 @@ extern int __init efi_setup_pcdp_console(char *); | |||
1000 | * possible, remove EFI-related code altogether. | 1060 | * possible, remove EFI-related code altogether. |
1001 | */ | 1061 | */ |
1002 | #define EFI_BOOT 0 /* Were we booted from EFI? */ | 1062 | #define EFI_BOOT 0 /* Were we booted from EFI? */ |
1003 | #define EFI_SYSTEM_TABLES 1 /* Can we use EFI system tables? */ | ||
1004 | #define EFI_CONFIG_TABLES 2 /* Can we use EFI config tables? */ | 1063 | #define EFI_CONFIG_TABLES 2 /* Can we use EFI config tables? */ |
1005 | #define EFI_RUNTIME_SERVICES 3 /* Can we use runtime services? */ | 1064 | #define EFI_RUNTIME_SERVICES 3 /* Can we use runtime services? */ |
1006 | #define EFI_MEMMAP 4 /* Can we use EFI memory map? */ | 1065 | #define EFI_MEMMAP 4 /* Can we use EFI memory map? */ |
@@ -1026,8 +1085,16 @@ static inline bool efi_enabled(int feature) | |||
1026 | } | 1085 | } |
1027 | static inline void | 1086 | static inline void |
1028 | efi_reboot(enum reboot_mode reboot_mode, const char *__unused) {} | 1087 | efi_reboot(enum reboot_mode reboot_mode, const char *__unused) {} |
1088 | |||
1089 | static inline bool | ||
1090 | efi_capsule_pending(int *reset_type) | ||
1091 | { | ||
1092 | return false; | ||
1093 | } | ||
1029 | #endif | 1094 | #endif |
1030 | 1095 | ||
1096 | extern int efi_status_to_err(efi_status_t status); | ||
1097 | |||
1031 | /* | 1098 | /* |
1032 | * Variable Attributes | 1099 | * Variable Attributes |
1033 | */ | 1100 | */ |
@@ -1180,6 +1247,80 @@ struct efi_simple_text_output_protocol { | |||
1180 | void *test_string; | 1247 | void *test_string; |
1181 | }; | 1248 | }; |
1182 | 1249 | ||
1250 | #define PIXEL_RGB_RESERVED_8BIT_PER_COLOR 0 | ||
1251 | #define PIXEL_BGR_RESERVED_8BIT_PER_COLOR 1 | ||
1252 | #define PIXEL_BIT_MASK 2 | ||
1253 | #define PIXEL_BLT_ONLY 3 | ||
1254 | #define PIXEL_FORMAT_MAX 4 | ||
1255 | |||
1256 | struct efi_pixel_bitmask { | ||
1257 | u32 red_mask; | ||
1258 | u32 green_mask; | ||
1259 | u32 blue_mask; | ||
1260 | u32 reserved_mask; | ||
1261 | }; | ||
1262 | |||
1263 | struct efi_graphics_output_mode_info { | ||
1264 | u32 version; | ||
1265 | u32 horizontal_resolution; | ||
1266 | u32 vertical_resolution; | ||
1267 | int pixel_format; | ||
1268 | struct efi_pixel_bitmask pixel_information; | ||
1269 | u32 pixels_per_scan_line; | ||
1270 | } __packed; | ||
1271 | |||
1272 | struct efi_graphics_output_protocol_mode_32 { | ||
1273 | u32 max_mode; | ||
1274 | u32 mode; | ||
1275 | u32 info; | ||
1276 | u32 size_of_info; | ||
1277 | u64 frame_buffer_base; | ||
1278 | u32 frame_buffer_size; | ||
1279 | } __packed; | ||
1280 | |||
1281 | struct efi_graphics_output_protocol_mode_64 { | ||
1282 | u32 max_mode; | ||
1283 | u32 mode; | ||
1284 | u64 info; | ||
1285 | u64 size_of_info; | ||
1286 | u64 frame_buffer_base; | ||
1287 | u64 frame_buffer_size; | ||
1288 | } __packed; | ||
1289 | |||
1290 | struct efi_graphics_output_protocol_mode { | ||
1291 | u32 max_mode; | ||
1292 | u32 mode; | ||
1293 | unsigned long info; | ||
1294 | unsigned long size_of_info; | ||
1295 | u64 frame_buffer_base; | ||
1296 | unsigned long frame_buffer_size; | ||
1297 | } __packed; | ||
1298 | |||
1299 | struct efi_graphics_output_protocol_32 { | ||
1300 | u32 query_mode; | ||
1301 | u32 set_mode; | ||
1302 | u32 blt; | ||
1303 | u32 mode; | ||
1304 | }; | ||
1305 | |||
1306 | struct efi_graphics_output_protocol_64 { | ||
1307 | u64 query_mode; | ||
1308 | u64 set_mode; | ||
1309 | u64 blt; | ||
1310 | u64 mode; | ||
1311 | }; | ||
1312 | |||
1313 | struct efi_graphics_output_protocol { | ||
1314 | unsigned long query_mode; | ||
1315 | unsigned long set_mode; | ||
1316 | unsigned long blt; | ||
1317 | struct efi_graphics_output_protocol_mode *mode; | ||
1318 | }; | ||
1319 | |||
1320 | typedef efi_status_t (*efi_graphics_output_protocol_query_mode)( | ||
1321 | struct efi_graphics_output_protocol *, u32, unsigned long *, | ||
1322 | struct efi_graphics_output_mode_info **); | ||
1323 | |||
1183 | extern struct list_head efivar_sysfs_list; | 1324 | extern struct list_head efivar_sysfs_list; |
1184 | 1325 | ||
1185 | static inline void | 1326 | static inline void |
@@ -1195,8 +1336,7 @@ int efivars_unregister(struct efivars *efivars); | |||
1195 | struct kobject *efivars_kobject(void); | 1336 | struct kobject *efivars_kobject(void); |
1196 | 1337 | ||
1197 | int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *), | 1338 | int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *), |
1198 | void *data, bool atomic, bool duplicates, | 1339 | void *data, bool duplicates, struct list_head *head); |
1199 | struct list_head *head); | ||
1200 | 1340 | ||
1201 | void efivar_entry_add(struct efivar_entry *entry, struct list_head *head); | 1341 | void efivar_entry_add(struct efivar_entry *entry, struct list_head *head); |
1202 | void efivar_entry_remove(struct efivar_entry *entry); | 1342 | void efivar_entry_remove(struct efivar_entry *entry); |
@@ -1242,6 +1382,13 @@ int efivars_sysfs_init(void); | |||
1242 | #define EFIVARS_DATA_SIZE_MAX 1024 | 1382 | #define EFIVARS_DATA_SIZE_MAX 1024 |
1243 | 1383 | ||
1244 | #endif /* CONFIG_EFI_VARS */ | 1384 | #endif /* CONFIG_EFI_VARS */ |
1385 | extern bool efi_capsule_pending(int *reset_type); | ||
1386 | |||
1387 | extern int efi_capsule_supported(efi_guid_t guid, u32 flags, | ||
1388 | size_t size, int *reset); | ||
1389 | |||
1390 | extern int efi_capsule_update(efi_capsule_header_t *capsule, | ||
1391 | struct page **pages); | ||
1245 | 1392 | ||
1246 | #ifdef CONFIG_EFI_RUNTIME_MAP | 1393 | #ifdef CONFIG_EFI_RUNTIME_MAP |
1247 | int efi_runtime_map_init(struct kobject *); | 1394 | int efi_runtime_map_init(struct kobject *); |
@@ -1319,5 +1466,9 @@ efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg, | |||
1319 | 1466 | ||
1320 | efi_status_t efi_parse_options(char *cmdline); | 1467 | efi_status_t efi_parse_options(char *cmdline); |
1321 | 1468 | ||
1469 | efi_status_t efi_setup_gop(efi_system_table_t *sys_table_arg, | ||
1470 | struct screen_info *si, efi_guid_t *proto, | ||
1471 | unsigned long size); | ||
1472 | |||
1322 | bool efi_runtime_disabled(void); | 1473 | bool efi_runtime_disabled(void); |
1323 | #endif /* _LINUX_EFI_H */ | 1474 | #endif /* _LINUX_EFI_H */ |