1. 20 9月, 2017 15 次提交
    • R
      efi_loader: add bootmgr · 9975fe96
      Rob Clark 提交于
      Similar to a "real" UEFI implementation, the bootmgr looks at the
      BootOrder and BootXXXX variables to try to find an EFI payload to load
      and boot.  This is added as a sub-command of bootefi.
      
      The idea is that the distro bootcmd would first try loading a payload
      via the bootmgr, and then if that fails (ie. first boot or corrupted
      EFI variables) it would fallback to loading bootaa64.efi.  (Which
      would then load fallback.efi which would look for \EFI\*\boot.csv and
      populate BootOrder and BootXXXX based on what it found.)
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      9975fe96
    • R
      efi_loader: efi variable support · ad644e7c
      Rob Clark 提交于
      Add EFI variable support, mapping to u-boot environment variables.
      Variables are pretty important for setting up boot order, among other
      things.  If the board supports saveenv, then it will be called in
      ExitBootServices() to persist variables set by the efi payload.  (For
      example, fallback.efi configuring BootOrder and BootXXXX load-option
      variables.)
      
      Variables are *not* currently exposed at runtime, post ExitBootServices.
      On boards without a dedicated device for storage, which the loaded OS
      is not trying to also use, this is rather tricky.  One idea, at least
      for boards that can persist RAM across reboot, is to keep a "journal"
      of modified variables in RAM, and then turn halt into a reboot into
      u-boot, plus store variables, plus halt.  Whatever the solution, it
      likely involves some per-board support.
      
      Mapping between EFI variables and u-boot variables:
      
        efi_$guid_$varname = {attributes}(type)value
      
      For example:
      
        efi_8be4df61-93ca-11d2-aa0d-00e098032b8c_OsIndicationsSupported=
           "{ro,boot,run}(blob)0000000000000000"
        efi_8be4df61-93ca-11d2-aa0d-00e098032b8c_BootOrder=
           "(blob)00010000"
      
      The attributes are a comma separated list of these possible
      attributes:
      
        + ro   - read-only
        + boot - boot-services access
        + run  - runtime access
      
      NOTE: with current implementation, no variables are available after
      ExitBootServices, and all are persisted (if possible).
      
      If not specified, the attributes default to "{boot}".
      
      The required type is one of:
      
        + utf8 - raw utf8 string
        + blob - arbitrary length hex string
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      ad644e7c
    • R
      efi_loader: make pool allocations cacheline aligned · 946160f3
      Rob Clark 提交于
      This avoids printf() spam about file reads (such as loading an image)
      into unaligned buffers (and the associated memcpy()).  And generally
      seems like a good idea.
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      [agraf: use __aligned]
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      946160f3
    • R
      efi_loader: support load_image() from a file-path · 838ee4b4
      Rob Clark 提交于
      Previously we only supported the case when the EFI application loaded
      the image into memory for us.  But fallback.efi does not do this.
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      838ee4b4
    • R
      efi_loader: add file/filesys support · 2a92080d
      Rob Clark 提交于
      fallback.efi (and probably other things) use UEFI's simple-file-system
      protocol and file support to search for OS's to boot.
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      [agraf: whitespace fixes, unsigned fixes]
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      2a92080d
    • R
      efi_loader: refactor boot device and loaded_image handling · 95c5553e
      Rob Clark 提交于
      Get rid of the hacky fake boot-device and duplicate device-path
      constructing (which needs to match what efi_disk and efi_net do).
      Instead convert over to use efi_device_path helpers to construct
      device-paths, and use that to look up the actual boot device.
      
      Also, extract out a helper to plug things in properly to the
      loaded_image.  In a following patch we'll want to re-use this in
      efi_load_image() to handle the case of loading an image from a
      file_path.
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      95c5553e
    • R
      efi_loader: use proper device-paths for net · e15fc335
      Rob Clark 提交于
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      e15fc335
    • R
      efi_loader: use proper device-paths for partitions · 884bcf6f
      Rob Clark 提交于
      Also, create disk objects for the disk itself, in addition to the
      partitions.  (UEFI terminology is a bit confusing, a "disk" object is
      really a partition.)  This helps grub properly identify the boot device
      since it is trying to match up partition "disk" object with it's parent
      device.
      
      Now instead of seeing devices like:
      
        /File(sdhci@07864000.blk)/EndEntire
        /File(usb_mass_storage.lun0)/EndEntire
      
      You see:
      
        /ACPI(133741d0,0)/UnknownMessaging(1d)/EndEntire
        /ACPI(133741d0,0)/UnknownMessaging(1d)/HD(0,800,64000,dd904a8c00000000,1,1)/EndEntire
        /ACPI(133741d0,0)/UnknownMessaging(1d)/HD(1,64800,200000,dd904a8c00000000,1,1)/EndEntire
        /ACPI(133741d0,0)/UnknownMessaging(1d)/HD(2,264800,19a000,dd904a8c00000000,1,1)/EndEntire
        /ACPI(133741d0,0)/USB(0,0)/USB(0,0)/USB(0,0)/EndEntire
        /ACPI(133741d0,0)/USB(0,0)/USB(0,0)/USB(0,0)/HD(0,800,60000,38ca680200000000,1,1)/EndEntire
        /ACPI(133741d0,0)/USB(0,0)/USB(0,0)/USB(0,0)/HD(1,61000,155000,38ca680200000000,1,1)/EndEntire
        /ACPI(133741d0,0)/USB(0,0)/USB(0,0)/USB(0,0)/HD(2,20fa800,1bbf8800,38ca680200000000,1,1)/EndEntire
        /ACPI(133741d0,0)/USB(0,0)/USB(0,0)/USB(0,0)/HD(3,1b6800,1f44000,38ca680200000000,1,1)/EndEntire
      
      This is on a board with single USB disk and single sd-card.  The
      UnknownMessaging(1d) node in the device-path is the MMC device,
      but grub_efi_print_device_path() hasn't been updated yet for some
      of the newer device-path sub-types.
      
      This patch is inspired by a patch originally from Peter Jones, but
      re-worked to use efi_device_path, so it doesn't much resemble the
      original.
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      [agraf: s/unsigned/unsigned int/]
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      884bcf6f
    • R
      efi_loader: flesh out device-path to text · adae4313
      Rob Clark 提交于
      It needs to handle more device-path node types, and also multiple levels
      of path hierarchy.  To simplify this, initially construct utf8 string to
      a temporary buffer, and then allocate the real utf16 buffer that is
      returned.  This should be mostly for debugging or at least not critical-
      path so an extra copy won't hurt, and is saner than the alternative.
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      adae4313
    • R
      efi_loader: drop redundant efi_device_path_protocol · 9309a1b7
      Rob Clark 提交于
      This is really the same thing as the efi_device_path struct.
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      9309a1b7
    • R
      efi_loader: add device-path utils · b66c60dd
      Rob Clark 提交于
      Helpers to construct device-paths from devices, partitions, files, and
      for parsing and manipulating device-paths.
      
      For non-legacy devices, this will use u-boot's device-model to construct
      device-paths which include bus hierarchy to construct device-paths.  For
      legacy devices we still fake it, but slightly more convincingly.
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      b66c60dd
    • P
      efi: add some more device path structures · c80214ce
      Peter Jones 提交于
      Signed-off-by: NPeter Jones <pjones@redhat.com>
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      c80214ce
    • R
      efi: add some missing __packed · a8606ef0
      Rob Clark 提交于
      All of the device-path related structures should be packed.  UEFI
      defines the device-path as a byte-aligned data structure.
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      a8606ef0
    • P
      part: extract MBR signature from partitions · ff98cb90
      Peter Jones 提交于
      EFI client programs need the signature information from the partition
      table to determine the disk a partition is on, so we need to fill that
      in here.
      Signed-off-by: NPeter Jones <pjones@redhat.com>
      [separated from efi_loader part, and fixed build-errors for non-
       CONFIG_EFI_PARTITION case]
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      ff98cb90
    • R
      part: move efi_guid_t · 0d6ab32e
      Rob Clark 提交于
      Prep work for next patch.
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      Reviewed-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      0d6ab32e
  2. 19 9月, 2017 22 次提交
  3. 17 9月, 2017 1 次提交
  4. 16 9月, 2017 2 次提交