• Matt Fleming's avatar
    efivars: Keep a private global pointer to efivars · 4423d779
    Matt Fleming authored
    Some machines have an EFI variable interface that does not conform to
    the UEFI specification, e.g. CONFIG_GOOGLE_SMI. Add the necessary code
    so that it's only possible to use one implementation of EFI variable
    operations at runtime. This allows us to keep a single (file-scope)
    global pointer 'struct efivars', which simplifies access. This will
    hopefully dissuade developers from accessing the generic operations
    struct directly in the future, as was done in the efivarfs and pstore
    code, thereby allowing future code to work with both the generic efivar
    ops and the google SMI ops.
    
    This may seem like a step backwards in terms of modularity, but we don't
    need to track more than one 'struct efivars' at one time. There is no
    synchronisation done between multiple EFI variable operations, and
    according to Mike no one is using both the generic EFI var ops and
    CONFIG_GOOGLE_SMI simultaneously, though a single kernel build _does_
    need to able to support both. It also helps to clearly highlight which
    functions form the core of the efivars interface - those that require
    access to __efivars.
    Reviewed-by: default avatarTom Gundersen <teg@jklm.no>
    Tested-by: default avatarTom Gundersen <teg@jklm.no>
    Acked-by: default avatarMike Waychison <mikew@google.com>
    Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
    4423d779
efivars.c 53.4 KB