1. 11 6月, 2013 1 次提交
  2. 30 4月, 2013 1 次提交
  3. 17 4月, 2013 4 次提交
    • T
      efi: split efisubsystem from efivars · a9499fa7
      Tom Gundersen 提交于
      This registers /sys/firmware/efi/{,systab,efivars/} whenever EFI is enabled
      and the system is booted with EFI.
      
      This allows
       *) userspace to check for the existence of /sys/firmware/efi as a way
          to determine whether or it is running on an EFI system.
       *) 'mount -t efivarfs none /sys/firmware/efi/efivars' without manually
          loading any modules.
      
      [ Also, move the efivar API into vars.c and unconditionally compile it.
        This allows us to move efivars.c, which now only contains the sysfs
        variable code, into the firmware/efi directory. Note that the efivars.c
        filename is kept to maintain backwards compatability with the old
        efivars.ko module. With this patch it is now possible for efivarfs
        to be built without CONFIG_EFI_VARS - Matt ]
      
      Cc: Seiji Aguchi <seiji.aguchi@hds.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Mike Waychison <mikew@google.com>
      Cc: Kay Sievers <kay@vrfy.org>
      Cc: Jeremy Kerr <jk@ozlabs.org>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Cc: Chun-Yi Lee <jlee@suse.com>
      Cc: Andy Whitcroft <apw@canonical.com>
      Cc: Tobias Powalowski <tpowa@archlinux.org>
      Signed-off-by: NTom Gundersen <teg@jklm.no>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      a9499fa7
    • M
      efivars: Move pstore code into the new EFI directory · 04851772
      Matt Fleming 提交于
      efivars.c has grown far too large and needs to be divided up. Create a
      new directory and move the persistence storage code to efi-pstore.c now
      that it uses the new efivar API. This helps us to greatly reduce the
      size of efivars.c and paves the way for moving other code out of
      efivars.c.
      
      Note that because CONFIG_EFI_VARS can be built as a module efi-pstore
      must also include support for building as a module.
      Reviewed-by: NTom Gundersen <teg@jklm.no>
      Tested-by: NTom Gundersen <teg@jklm.no>
      Cc: Seiji Aguchi <seiji.aguchi@hds.com>
      Cc: Anton Vorontsov <cbouatmailru@gmail.com>
      Cc: Colin Cross <ccross@android.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Cc: Tony Luck <tony.luck@intel.com>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      04851772
    • M
      efivars: efivar_entry API · e14ab23d
      Matt Fleming 提交于
      There isn't really a formal interface for dealing with EFI variables
      or struct efivar_entry. Historically, this has led to various bits of
      code directly accessing the generic EFI variable ops, which inherently
      ties it to specific EFI variable operations instead of indirectly
      using whatever ops were registered with register_efivars(). This lead
      to the efivarfs code only working with the generic EFI variable ops
      and not CONFIG_GOOGLE_SMI.
      
      Encapsulate everything that needs to access '__efivars' inside an
      efivar_entry_* API and use the new API in the pstore, sysfs and
      efivarfs code.
      
      Much of the efivars code had to be rewritten to use this new API. For
      instance, it is now up to the users of the API to build the initial
      list of EFI variables in their efivar_init() callback function. The
      variable list needs to be passed to efivar_init() which allows us to
      keep work arounds for things like implementation bugs in
      GetNextVariable() in a central location.
      
      Allowing users of the API to use a callback function to build the list
      greatly benefits the efivarfs code which needs to allocate inodes and
      dentries for every variable.  It previously did this in a racy way
      because the code ran without holding the variable spinlock. Both the
      sysfs and efivarfs code maintain their own lists which means the two
      interfaces can be running simultaneously without interference, though
      it should be noted that because no synchronisation is performed it is
      very easy to create inconsistencies. efibootmgr doesn't currently use
      efivarfs and users are likely to also require the old sysfs interface,
      so it makes sense to allow both to be built.
      Reviewed-by: NTom Gundersen <teg@jklm.no>
      Tested-by: NTom Gundersen <teg@jklm.no>
      Cc: Seiji Aguchi <seiji.aguchi@hds.com>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Cc: Jeremy Kerr <jk@ozlabs.org>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Mike Waychison <mikew@google.com>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      e14ab23d
    • M
      efi: move utf16 string functions to efi.h · d5abc7c1
      Matt Fleming 提交于
      There are currently two implementations of the utf16 string functions.
      Somewhat confusingly, they've got different names.
      
      Centralise the functions in efi.h.
      Reviewed-by: NTom Gundersen <teg@jklm.no>
      Tested-by: NTom Gundersen <teg@jklm.no>
      Reviewed-by: NMike Waychison <mikew@google.com>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      d5abc7c1
  4. 09 4月, 2013 1 次提交
    • M
      x86, efivars: firmware bug workarounds should be in platform code · a6e4d5a0
      Matt Fleming 提交于
      Let's not burden ia64 with checks in the common efivars code that we're not
      writing too much data to the variable store. That kind of thing is an x86
      firmware bug, plain and simple.
      
      efi_query_variable_store() provides platforms with a wrapper in which they can
      perform checks and workarounds for EFI variable storage bugs.
      
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      a6e4d5a0
  5. 13 2月, 2013 1 次提交
    • S
      efi_pstore: Introducing workqueue updating sysfs · a93bc0c6
      Seiji Aguchi 提交于
      [Problem]
      efi_pstore creates sysfs entries, which enable users to access to NVRAM,
      in a write callback. If a kernel panic happens in an interrupt context,
      it may fail because it could sleep due to dynamic memory allocations during
      creating sysfs entries.
      
      [Patch Description]
      This patch removes sysfs operations from a write callback by introducing
      a workqueue updating sysfs entries which is scheduled after the write
      callback is called.
      
      Also, the workqueue is kicked in a just oops case.
      A system will go down in other cases such as panic, clean shutdown and emergency
      restart. And we don't need to create sysfs entries because there is no chance for
      users to access to them.
      
      efi_pstore will be robust against a kernel panic in an interrupt context with this patch.
      Signed-off-by: NSeiji Aguchi <seiji.aguchi@hds.com>
      Acked-by: NMatt Fleming <matt.fleming@intel.com>
      Signed-off-by: NTony Luck <tony.luck@intel.com>
      a93bc0c6
  6. 31 1月, 2013 1 次提交
    • M
      efi: Make 'efi_enabled' a function to query EFI facilities · 83e68189
      Matt Fleming 提交于
      Originally 'efi_enabled' indicated whether a kernel was booted from
      EFI firmware. Over time its semantics have changed, and it now
      indicates whether or not we are booted on an EFI machine with
      bit-native firmware, e.g. 64-bit kernel with 64-bit firmware.
      
      The immediate motivation for this patch is the bug report at,
      
          https://bugs.launchpad.net/ubuntu-cdimage/+bug/1040557
      
      which details how running a platform driver on an EFI machine that is
      designed to run under BIOS can cause the machine to become
      bricked. Also, the following report,
      
          https://bugzilla.kernel.org/show_bug.cgi?id=47121
      
      details how running said driver can also cause Machine Check
      Exceptions. Drivers need a new means of detecting whether they're
      running on an EFI machine, as sadly the expression,
      
          if (!efi_enabled)
      
      hasn't been a sufficient condition for quite some time.
      
      Users actually want to query 'efi_enabled' for different reasons -
      what they really want access to is the list of available EFI
      facilities.
      
      For instance, the x86 reboot code needs to know whether it can invoke
      the ResetSystem() function provided by the EFI runtime services, while
      the ACPI OSL code wants to know whether the EFI config tables were
      mapped successfully. There are also checks in some of the platform
      driver code to simply see if they're running on an EFI machine (which
      would make it a bad idea to do BIOS-y things).
      
      This patch is a prereq for the samsung-laptop fix patch.
      
      Cc: David Airlie <airlied@linux.ie>
      Cc: Corentin Chary <corentincj@iksaif.net>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Cc: Dave Jiang <dave.jiang@intel.com>
      Cc: Olof Johansson <olof@lixom.net>
      Cc: Peter Jones <pjones@redhat.com>
      Cc: Colin Ian King <colin.king@canonical.com>
      Cc: Steve Langasek <steve.langasek@canonical.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Konrad Rzeszutek Wilk <konrad@kernel.org>
      Cc: Rafael J. Wysocki <rjw@sisk.pl>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      83e68189
  7. 16 12月, 2012 1 次提交
  8. 06 12月, 2012 1 次提交
  9. 27 11月, 2012 1 次提交
  10. 13 11月, 2012 1 次提交
  11. 30 10月, 2012 3 次提交
    • J
      x86-64/efi: Use EFI to deal with platform wall clock (again) · bd52276f
      Jan Beulich 提交于
      Other than ix86, x86-64 on EFI so far didn't set the
      {g,s}et_wallclock accessors to the EFI routines, thus
      incorrectly using raw RTC accesses instead.
      
      Simply removing the #ifdef around the respective code isn't
      enough, however: While so far early get-time calls were done in
      physical mode, this doesn't work properly for x86-64, as virtual
      addresses would still need to be set up for all runtime regions
      (which wasn't the case on the system I have access to), so
      instead the patch moves the call to efi_enter_virtual_mode()
      ahead (which in turn allows to drop all code related to calling
      efi-get-time in physical mode).
      
      Additionally the earlier calling of efi_set_executable()
      requires the CPA code to cope, i.e. during early boot it must be
      avoided to call cpa_flush_array(), as the first thing this
      function does is a BUG_ON(irqs_disabled()).
      
      Also make the two EFI functions in question here static -
      they're not being referenced elsewhere.
      
      History:
      
          This commit was originally merged as bacef661 ("x86-64/efi:
          Use EFI to deal with platform wall clock") but it resulted in some
          ASUS machines no longer booting due to a firmware bug, and so was
          reverted in f026cfa8. A pre-emptive fix for the buggy ASUS
          firmware was merged in 03a1c254975e ("x86, efi: 1:1 pagetable
          mapping for virtual EFI calls") so now this patch can be
          reapplied.
      Signed-off-by: NJan Beulich <jbeulich@suse.com>
      Tested-by: NMatt Fleming <matt.fleming@intel.com>
      Acked-by: NMatthew Garrett <mjg@redhat.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Signed-off-by: Matt Fleming <matt.fleming@intel.com> [added commit history]
      bd52276f
    • L
      efi: add efivars kobject to efi sysfs folder · 605e70c7
      Lee, Chun-Yi 提交于
      UEFI variable filesystem need a new mount point, so this patch add
      efivars kobject to efi_kobj for create a /sys/firmware/efi/efivars
      folder.
      
      Cc: Matthew Garrett <mjg@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Signed-off-by: NLee, Chun-Yi <jlee@suse.com>
      Signed-off-by: NJeremy Kerr <jeremy.kerr@canonical.com>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      605e70c7
    • M
      efi: Add support for a UEFI variable filesystem · 5d9db883
      Matthew Garrett 提交于
      The existing EFI variables code only supports variables of up to 1024
      bytes. This limitation existed in version 0.99 of the EFI specification,
      but was removed before any full releases. Since variables can now be
      larger than a single page, sysfs isn't the best interface for this. So,
      instead, let's add a filesystem. Variables can be read, written and
      created, with the first 4 bytes of each variable representing its UEFI
      attributes. The create() method doesn't actually commit to flash since
      zero-length variables can't exist per-spec.
      
      Updates from Jeremy Kerr <jeremy.kerr@canonical.com>.
      Signed-off-by: NMatthew Garrett <mjg@redhat.com>
      Signed-off-by: NJeremy Kerr <jeremy.kerr@canonical.com>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      5d9db883
  12. 30 9月, 2012 3 次提交
  13. 15 8月, 2012 1 次提交
  14. 06 6月, 2012 1 次提交
    • J
      x86-64/efi: Use EFI to deal with platform wall clock · bacef661
      Jan Beulich 提交于
      Other than ix86, x86-64 on EFI so far didn't set the
      {g,s}et_wallclock accessors to the EFI routines, thus
      incorrectly using raw RTC accesses instead.
      
      Simply removing the #ifdef around the respective code isn't
      enough, however: While so far early get-time calls were done in
      physical mode, this doesn't work properly for x86-64, as virtual
      addresses would still need to be set up for all runtime regions
      (which wasn't the case on the system I have access to), so
      instead the patch moves the call to efi_enter_virtual_mode()
      ahead (which in turn allows to drop all code related to calling
      efi-get-time in physical mode).
      
      Additionally the earlier calling of efi_set_executable()
      requires the CPA code to cope, i.e. during early boot it must be
      avoided to call cpa_flush_array(), as the first thing this
      function does is a BUG_ON(irqs_disabled()).
      
      Also make the two EFI functions in question here static -
      they're not being referenced elsewhere.
      Signed-off-by: NJan Beulich <jbeulich@suse.com>
      Tested-by: NMatt Fleming <matt.fleming@intel.com>
      Acked-by: NMatthew Garrett <mjg@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/4FBFBF5F020000780008637F@nat28.tlf.novell.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      bacef661
  15. 01 5月, 2012 1 次提交
  16. 29 3月, 2012 1 次提交
  17. 24 2月, 2012 1 次提交
    • O
      x86, efi: Allow basic init with mixed 32/64-bit efi/kernel · 1adbfa35
      Olof Johansson 提交于
      Traditionally the kernel has refused to setup EFI at all if there's been
      a mismatch in 32/64-bit mode between EFI and the kernel.
      
      On some platforms that boot natively through EFI (Chrome OS being one),
      we still need to get at least some of the static data such as memory
      configuration out of EFI. Runtime services aren't as critical, and
      it's a significant amount of work to implement switching between the
      operating modes to call between kernel and firmware for thise cases. So
      I'm ignoring it for now.
      
      v5:
      * Fixed some printk strings based on feedback
      * Renamed 32/64-bit specific types to not have _ prefix
      * Fixed bug in printout of efi runtime disablement
      
      v4:
      * Some of the earlier cleanup was accidentally reverted by this patch, fixed.
      * Reworded some messages to not have to line wrap printk strings
      
      v3:
      * Reorganized to a series of patches to make it easier to review, and
        do some of the cleanups I had left out before.
      
      v2:
      * Added graceful error handling for 32-bit kernel that gets passed
        EFI data above 4GB.
      * Removed some warnings that were missed in first version.
      Signed-off-by: NOlof Johansson <olof@lixom.net>
      Link: http://lkml.kernel.org/r/1329081869-20779-6-git-send-email-olof@lixom.netSigned-off-by: NH. Peter Anvin <hpa@zytor.com>
      1adbfa35
  18. 10 12月, 2011 6 次提交
  19. 23 7月, 2011 1 次提交
  20. 07 6月, 2011 2 次提交
  21. 26 5月, 2011 1 次提交
    • M
      x86, efi: Retain boot service code until after switching to virtual mode · 916f676f
      Matthew Garrett 提交于
      UEFI stands for "Unified Extensible Firmware Interface", where "Firmware"
      is an ancient African word meaning "Why do something right when you can
      do it so wrong that children will weep and brave adults will cower before
      you", and "UEI" is Celtic for "We missed DOS so we burned it into your
      ROMs". The UEFI specification provides for runtime services (ie, another
      way for the operating system to be forced to depend on the firmware) and
      we rely on these for certain trivial tasks such as setting up the
      bootloader. But some hardware fails to work if we attempt to use these
      runtime services from physical mode, and so we have to switch into virtual
      mode. So far so dreadful.
      
      The specification makes it clear that the operating system is free to do
      whatever it wants with boot services code after ExitBootServices() has been
      called. SetVirtualAddressMap() can't be called until ExitBootServices() has
      been. So, obviously, a whole bunch of EFI implementations call into boot
      services code when we do that. Since we've been charmingly naive and
      trusted that the specification may be somehow relevant to the real world,
      we've already stuffed a picture of a penguin or something in that address
      space. And just to make things more entertaining, we've also marked it
      non-executable.
      
      This patch allocates the boot services regions during EFI init and makes
      sure that they're executable. Then, after SetVirtualAddressMap(), it
      discards them and everyone lives happily ever after. Except for the ones
      who have to work on EFI, who live sad lives haunted by the knowledge that
      someone's eventually going to write yet another firmware specification.
      
      [ hpa: adding this to urgent with a stable tag since it fixes currently-broken
        hardware.  However, I do not know what the dependencies are and so I do
        not know which -stable versions this may be a candidate for. ]
      Signed-off-by: NMatthew Garrett <mjg@redhat.com>
      Link: http://lkml.kernel.org/r/1306331593-28715-1-git-send-email-mjg@redhat.comSigned-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: <stable@kernel.org>
      916f676f
  22. 14 3月, 2011 1 次提交
  23. 16 12月, 2009 1 次提交
  24. 18 6月, 2009 1 次提交
    • M
      [IA64] Convert ia64 to use int-ll64.h · e088a4ad
      Matthew Wilcox 提交于
      It is generally agreed that it would be beneficial for u64 to be an
      unsigned long long on all architectures.  ia64 (in common with several
      other 64-bit architectures) currently uses unsigned long.  Migrating
      piecemeal is too painful; this giant patch fixes all compilation warnings
      and errors that come as a result of switching to use int-ll64.h.
      
      Note that userspace will still see __u64 defined as unsigned long.  This
      is important as it affects C++ name mangling.
      
      [Updated by Tony Luck to change efi.h:efi_freemem_callback_t to use
       u64 for start/end rather than unsigned long]
      Signed-off-by: NMatthew Wilcox <willy@linux.intel.com>
      Signed-off-by: NTony Luck <tony.luck@intel.com>
      e088a4ad
  25. 16 10月, 2008 1 次提交
  26. 25 5月, 2008 1 次提交
  27. 20 4月, 2008 1 次提交