diff options
author | Mike Waychison <mikew@google.com> | 2011-03-11 20:43:27 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-03-14 11:40:51 -0400 |
commit | 4fc756bd9dbf6b84fbf751e3bf495277849c5db7 (patch) | |
tree | d7f71d68344385ecf2449994f1eda13fa7a5fbab /include/linux/efi.h | |
parent | 3295814d83c55e629abc6c2a31af1d504febb229 (diff) |
efivars: Expose efivars functionality to external drivers.
Signed-off-by: Mike Waychison <mikew@google.com>
Cc: Matt Domsch <Matt_Domsch@dell.com>,
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/efi.h')
-rw-r--r-- | include/linux/efi.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/include/linux/efi.h b/include/linux/efi.h index fb737bc19a8c..33fa1203024e 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h | |||
@@ -397,4 +397,41 @@ static inline void memrange_efi_to_native(u64 *addr, u64 *npages) | |||
397 | *addr &= PAGE_MASK; | 397 | *addr &= PAGE_MASK; |
398 | } | 398 | } |
399 | 399 | ||
400 | #if defined(CONFIG_EFI_VARS) || defined(CONFIG_EFI_VARS_MODULE) | ||
401 | /* | ||
402 | * EFI Variable support. | ||
403 | * | ||
404 | * Different firmware drivers can expose their EFI-like variables using | ||
405 | * the following. | ||
406 | */ | ||
407 | |||
408 | struct efivar_operations { | ||
409 | efi_get_variable_t *get_variable; | ||
410 | efi_get_next_variable_t *get_next_variable; | ||
411 | efi_set_variable_t *set_variable; | ||
412 | }; | ||
413 | |||
414 | struct efivars { | ||
415 | /* | ||
416 | * ->lock protects two things: | ||
417 | * 1) ->list - adds, removals, reads, writes | ||
418 | * 2) ops.[gs]et_variable() calls. | ||
419 | * It must not be held when creating sysfs entries or calling kmalloc. | ||
420 | * ops.get_next_variable() is only called from register_efivars(), | ||
421 | * which is protected by the BKL, so that path is safe. | ||
422 | */ | ||
423 | spinlock_t lock; | ||
424 | struct list_head list; | ||
425 | struct kset *kset; | ||
426 | struct bin_attribute *new_var, *del_var; | ||
427 | const struct efivar_operations *ops; | ||
428 | }; | ||
429 | |||
430 | int register_efivars(struct efivars *efivars, | ||
431 | const struct efivar_operations *ops, | ||
432 | struct kobject *parent_kobj); | ||
433 | void unregister_efivars(struct efivars *efivars); | ||
434 | |||
435 | #endif /* CONFIG_EFI_VARS */ | ||
436 | |||
400 | #endif /* _LINUX_EFI_H */ | 437 | #endif /* _LINUX_EFI_H */ |