diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-01 18:51:46 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-01 18:51:46 -0400 |
| commit | b9394d8a657cd3c064fa432aa0905c1b58b38fe9 (patch) | |
| tree | 5a0c98370f313fa11693ab72eea0dc809fd6567d /include/linux | |
| parent | 126de6b20bfb82cc19012d5048f11f339ae5a021 (diff) | |
| parent | 7b2dd6d2c4db3912771bfcfd7ac7264011a3c831 (diff) | |
Merge branch 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86/efi changes from Peter Anvin:
"The bulk of these changes are cleaning up the efivars handling and
breaking it up into a tree of files. There are a number of fixes as
well.
The entire changeset is pretty big, but most of it is code movement.
Several of these commits are quite new; the history got very messed up
due to a mismerge with the urgent changes for rc8 which completely
broke IA64, and so Ingo requested that we rebase it to straighten it
out."
* 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
efi: remove "kfree(NULL)"
efi: locking fix in efivar_entry_set_safe()
efi, pstore: Read data from variable store before memcpy()
efi, pstore: Remove entry from list when erasing
efi, pstore: Initialise 'entry' before iterating
efi: split efisubsystem from efivars
efivarfs: Move to fs/efivarfs
efivars: Move pstore code into the new EFI directory
efivars: efivar_entry API
efivars: Keep a private global pointer to efivars
efi: move utf16 string functions to efi.h
x86, efi: Make efi_memblock_x86_reserve_range more readable
efivarfs: convert to use simple_open()
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/efi.h | 90 |
1 files changed, 82 insertions, 8 deletions
diff --git a/include/linux/efi.h b/include/linux/efi.h index 3d7df3d32c66..2bc0ad78d058 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h | |||
| @@ -670,6 +670,12 @@ static inline int efi_enabled(int facility) | |||
| 670 | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | \ | 670 | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | \ |
| 671 | EFI_VARIABLE_APPEND_WRITE) | 671 | EFI_VARIABLE_APPEND_WRITE) |
| 672 | /* | 672 | /* |
| 673 | * Length of a GUID string (strlen("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")) | ||
| 674 | * not including trailing NUL | ||
| 675 | */ | ||
| 676 | #define EFI_VARIABLE_GUID_LEN 36 | ||
| 677 | |||
| 678 | /* | ||
| 673 | * The type of search to perform when calling boottime->locate_handle | 679 | * The type of search to perform when calling boottime->locate_handle |
| 674 | */ | 680 | */ |
| 675 | #define EFI_LOCATE_ALL_HANDLES 0 | 681 | #define EFI_LOCATE_ALL_HANDLES 0 |
| @@ -726,7 +732,6 @@ static inline void memrange_efi_to_native(u64 *addr, u64 *npages) | |||
| 726 | *addr &= PAGE_MASK; | 732 | *addr &= PAGE_MASK; |
| 727 | } | 733 | } |
| 728 | 734 | ||
| 729 | #if defined(CONFIG_EFI_VARS) || defined(CONFIG_EFI_VARS_MODULE) | ||
| 730 | /* | 735 | /* |
| 731 | * EFI Variable support. | 736 | * EFI Variable support. |
| 732 | * | 737 | * |
| @@ -752,19 +757,88 @@ struct efivars { | |||
| 752 | * which is protected by the BKL, so that path is safe. | 757 | * which is protected by the BKL, so that path is safe. |
| 753 | */ | 758 | */ |
| 754 | spinlock_t lock; | 759 | spinlock_t lock; |
| 755 | struct list_head list; | ||
| 756 | struct kset *kset; | 760 | struct kset *kset; |
| 757 | struct kobject *kobject; | 761 | struct kobject *kobject; |
| 758 | struct bin_attribute *new_var, *del_var; | ||
| 759 | const struct efivar_operations *ops; | 762 | const struct efivar_operations *ops; |
| 760 | struct efivar_entry *walk_entry; | ||
| 761 | struct pstore_info efi_pstore_info; | ||
| 762 | }; | 763 | }; |
| 763 | 764 | ||
| 764 | int register_efivars(struct efivars *efivars, | 765 | /* |
| 766 | * The maximum size of VariableName + Data = 1024 | ||
| 767 | * Therefore, it's reasonable to save that much | ||
| 768 | * space in each part of the structure, | ||
| 769 | * and we use a page for reading/writing. | ||
| 770 | */ | ||
| 771 | |||
| 772 | struct efi_variable { | ||
| 773 | efi_char16_t VariableName[1024/sizeof(efi_char16_t)]; | ||
| 774 | efi_guid_t VendorGuid; | ||
| 775 | unsigned long DataSize; | ||
| 776 | __u8 Data[1024]; | ||
| 777 | efi_status_t Status; | ||
| 778 | __u32 Attributes; | ||
| 779 | } __attribute__((packed)); | ||
| 780 | |||
| 781 | struct efivar_entry { | ||
| 782 | struct efi_variable var; | ||
| 783 | struct list_head list; | ||
| 784 | struct kobject kobj; | ||
| 785 | }; | ||
| 786 | |||
| 787 | extern struct list_head efivar_sysfs_list; | ||
| 788 | |||
| 789 | static inline void | ||
| 790 | efivar_unregister(struct efivar_entry *var) | ||
| 791 | { | ||
| 792 | kobject_put(&var->kobj); | ||
| 793 | } | ||
| 794 | |||
| 795 | int efivars_register(struct efivars *efivars, | ||
| 765 | const struct efivar_operations *ops, | 796 | const struct efivar_operations *ops, |
| 766 | struct kobject *parent_kobj); | 797 | struct kobject *kobject); |
| 767 | void unregister_efivars(struct efivars *efivars); | 798 | int efivars_unregister(struct efivars *efivars); |
| 799 | struct kobject *efivars_kobject(void); | ||
| 800 | |||
| 801 | int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *), | ||
| 802 | void *data, bool atomic, bool duplicates, | ||
| 803 | struct list_head *head); | ||
| 804 | |||
| 805 | void efivar_entry_add(struct efivar_entry *entry, struct list_head *head); | ||
| 806 | void efivar_entry_remove(struct efivar_entry *entry); | ||
| 807 | |||
| 808 | int __efivar_entry_delete(struct efivar_entry *entry); | ||
| 809 | int efivar_entry_delete(struct efivar_entry *entry); | ||
| 810 | |||
| 811 | int efivar_entry_size(struct efivar_entry *entry, unsigned long *size); | ||
| 812 | int __efivar_entry_get(struct efivar_entry *entry, u32 *attributes, | ||
| 813 | unsigned long *size, void *data); | ||
| 814 | int efivar_entry_get(struct efivar_entry *entry, u32 *attributes, | ||
| 815 | unsigned long *size, void *data); | ||
| 816 | int efivar_entry_set(struct efivar_entry *entry, u32 attributes, | ||
| 817 | unsigned long size, void *data, struct list_head *head); | ||
| 818 | int efivar_entry_set_get_size(struct efivar_entry *entry, u32 attributes, | ||
| 819 | unsigned long *size, void *data, bool *set); | ||
| 820 | int efivar_entry_set_safe(efi_char16_t *name, efi_guid_t vendor, u32 attributes, | ||
| 821 | bool block, unsigned long size, void *data); | ||
| 822 | |||
| 823 | void efivar_entry_iter_begin(void); | ||
| 824 | void efivar_entry_iter_end(void); | ||
| 825 | |||
| 826 | int __efivar_entry_iter(int (*func)(struct efivar_entry *, void *), | ||
| 827 | struct list_head *head, void *data, | ||
| 828 | struct efivar_entry **prev); | ||
| 829 | int efivar_entry_iter(int (*func)(struct efivar_entry *, void *), | ||
| 830 | struct list_head *head, void *data); | ||
| 831 | |||
| 832 | struct efivar_entry *efivar_entry_find(efi_char16_t *name, efi_guid_t guid, | ||
| 833 | struct list_head *head, bool remove); | ||
| 834 | |||
| 835 | bool efivar_validate(struct efi_variable *var, u8 *data, unsigned long len); | ||
| 836 | |||
| 837 | extern struct work_struct efivar_work; | ||
| 838 | void efivar_run_worker(void); | ||
| 839 | |||
| 840 | #if defined(CONFIG_EFI_VARS) || defined(CONFIG_EFI_VARS_MODULE) | ||
| 841 | int efivars_sysfs_init(void); | ||
| 768 | 842 | ||
| 769 | #endif /* CONFIG_EFI_VARS */ | 843 | #endif /* CONFIG_EFI_VARS */ |
| 770 | 844 | ||
