Skip to content
Snippets Groups Projects
  1. Jul 02, 2021
    • Ilias Apalodimas's avatar
      efi_loader: Allow capsule update on-disk without checking OsIndications · 0fa5020c
      Ilias Apalodimas authored and Heinrich Schuchardt's avatar Heinrich Schuchardt committed
      
      Although U-Boot supports capsule update on-disk, it's lack of support for
      SetVariable at runtime prevents applications like fwupd from using it.
      
      In order to perform the capsule update on-disk the spec says that the OS
      must copy the capsule to the \EFI\UpdateCapsule directory and set a bit in
      the OsIndications variable.  The firmware then checks for the
      EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED bit in OsIndications
      variable, which is set by the submitter to trigger processing of the
      capsule on the next reboot.
      
      Let's add a config option which ignores the bit and just relies on the
      capsule being present. Since U-Boot deletes the capsule while processing
      it, we won't end up applying it multiple times.
      
      Note that this is allowed for all capsules. In the future, once
      authenticated capsules are fully supported, we can limit the functionality
      to those only.
      
      Signed-off-by: default avatarapalos <ilias.apalodimas@linaro.org>
      
      Reword Kconfig description.
      Reviewed-by: Heinrich Schuchardt's avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
      
      Signed-off-by: Heinrich Schuchardt's avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
      0fa5020c
    • Heinrich Schuchardt's avatar
      efi_loader: clear OsIndications · 149108a3
      Heinrich Schuchardt authored
      
      After each reboot we must clear flag
      EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED in variable
      OsIndications.
      
      Signed-off-by: Heinrich Schuchardt's avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
      149108a3
    • Masami Hiramatsu's avatar
      efi_loader: Improve the parameter check for QueryVariableInfo() · 417a3c24
      Masami Hiramatsu authored and Heinrich Schuchardt's avatar Heinrich Schuchardt committed
      
      Improve efi_query_variable_info() to check the parameter settings and
      return correct error code according to the UEFI Specification 2.9,
      and the Self Certification Test (SCT) II Case Specification, June
      2017, chapter 4.1.4 QueryVariableInfo().
      
      Reported-by: default avatarKazuhiko Sakamoto <sakamoto.kazuhiko@socionext.com>
      Signed-off-by: default avatarMasami Hiramatsu <masami.hiramatsu@linaro.org>
      Reviewed-by: Heinrich Schuchardt's avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
      417a3c24
    • Heinrich Schuchardt's avatar
      efi_loader: missing parentheses in query_console_size · abd62e4d
      Heinrich Schuchardt authored
      
      After if we should use parentheses to keep the code readable.
      
      Fixes: a95f4c88 ("efi_loader: NULL dereference in EFI console")
      Signed-off-by: Heinrich Schuchardt's avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
      abd62e4d
    • Ilias Apalodimas's avatar
      efi_loader: Always install FMPs · 6e0184b8
      Ilias Apalodimas authored and Heinrich Schuchardt's avatar Heinrich Schuchardt committed
      
      We only install FMPs if a CapsuleUpdate is requested.  Since we now have an
      ESRT table which relies on FMPs to build the required information, it
      makes more sense to unconditionally install them. This will allow userspace
      applications (e.g fwupd) to make use of the ERST and provide us with files
      we can use to run CapsuleUpdate on-disk
      
      Signed-off-by: default avatarIlias Apalodimas <ilias.apalodimas@linaro.org>
      Reviewed-by: Heinrich Schuchardt's avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
      6e0184b8
    • Ilias Apalodimas's avatar
      efi_loader: Force a single FMP instance per hardware store · b891ff18
      Ilias Apalodimas authored and Heinrich Schuchardt's avatar Heinrich Schuchardt committed
      
      Chapter 23 of the EFI spec (rev 2.9) says:
      "A specific updatable hardware firmware store must be represented by
      exactly one FMP instance".
      This is not the case for us, since both of our FMP protocols can be
      installed at the same time because they are controlled by a single
      'dfu_alt_info' env variable.
      So make the config options depend on each other and allow the user to
      install one of them at any given time.  If we fix the meta-data provided
      by the 'dfu_alt_info' in the future,  to hint about the capsule type
      (fit or raw) we can revise this and enable both FMPs to be installed, as
      long as they target different firmware hardware stores
      
      Note that we are not using a Kconfig 'choice' on purpose, since we
      want to allow both of those to be installed and tested in sandbox
      
      Signed-off-by: default avatarIlias Apalodimas <ilias.apalodimas@linaro.org>
      Reviewed-by: Heinrich Schuchardt's avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
      b891ff18
    • Masami Hiramatsu's avatar
      efi: Fix to use null handle to create new handle for efi_fmp_raw · 3ef77223
      Masami Hiramatsu authored and Heinrich Schuchardt's avatar Heinrich Schuchardt committed
      
      When running the efidebug capsule disk-update command, the efi_fmp_raw
      protocol installation fails with 2 (EFI_INVALID_PARAMETER) as below.
      This is because the code passes efi_root instead of the handle local var.
      
      => efidebug capsule disk-update
      EFI: Call: efi_install_multiple_protocol_interfaces( &handle, &efi_guid_firmware_management_protocol, &efi_fmp_fit, NULL)
        EFI: Entry efi_install_multiple_protocol_interfaces(00000000fbaf5988)
          EFI: Call: efi_install_protocol_interface( handle, protocol, EFI_NATIVE_INTERFACE, protocol_interface)
            EFI: Entry efi_install_protocol_interface(00000000fbaf5988, 86c77a67-0b97-4633-a187-49104d0685c7, 0, 00000000fbfa6ee8)
              EFI: new handle 00000000fbb37520
            EFI: Exit: efi_install_protocol_interface: 0
          EFI: 0 returned by efi_install_protocol_interface( handle, protocol, EFI_NATIVE_INTERFACE, protocol_interface)
        EFI: Exit: efi_install_multiple_protocol_interfaces: 0
      EFI: 0 returned by efi_install_multiple_protocol_interfaces( &handle, &efi_guid_firmware_management_protocol, &efi_fmp_fit, NULL)
      EFI: Call: efi_install_multiple_protocol_interfaces( &efi_root, &efi_guid_firmware_management_protocol, &efi_fmp_raw, NULL)
        EFI: Entry efi_install_multiple_protocol_interfaces(00000000fbfec648)
          EFI: Call: efi_install_protocol_interface( handle, protocol, EFI_NATIVE_INTERFACE, protocol_interface)
            EFI: Entry efi_install_protocol_interface(00000000fbfec648, 86c77a67-0b97-4633-a187-49104d0685c7, 0, 00000000fbfa6f18)
              EFI: handle 00000000fbaf8520
            EFI: Exit: efi_install_protocol_interface: 2
          EFI: 2 returned by efi_install_protocol_interface( handle, protocol, EFI_NATIVE_INTERFACE, protocol_interface)
        EFI: Exit: efi_install_multiple_protocol_interfaces: 2
      EFI: 2 returned by efi_install_multiple_protocol_interfaces( &efi_root, &efi_guid_firmware_management_protocol, &efi_fmp_raw, NULL)
      Command failed, result=1
      
      To fix this issue, pass the handle local var which is set NULL right
      before installing efi_fmp_raw as same as the installing efi_fmp_fit.
      (In both cases, the local reference to the handle will be just discarded)
      
      Signed-off-by: default avatarMasami Hiramatsu <masami.hiramatsu@linaro.org>
      Signed-off-by: default avatarIlias Apalodimas <ilias.apalodimas@linaro.org>
      Reviewed-by: Heinrich Schuchardt's avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
      3ef77223
  2. Jun 28, 2021
    • Kunihiko Hayashi's avatar
      arm64: Fix relocation of env_addr if POSITION_INDEPENDENT=y · 534f0fbd
      Kunihiko Hayashi authored and Tom Rini's avatar Tom Rini committed
      
      If both POSITION_INDEPENDENT and SYS_RELOC_GD_ENV_ADDR are enabled,
      wherever original env is placed anywhere, it should be relocated to
      the right address.
      
      Relocation offset gd->reloc_off is calculated with SYS_TEXT_BASE in
      setup_reloc() and env address gd->env_addr is relocated by the offset in
      initr_reloc_global_data().
      
      gd->env_addr
        = (orig env) + gd->reloc_off
        = (orig env) + (gd->relocaddr - SYS_TEXT_BASE)
      
      However, SYS_TEXT_BASE isn't always runtime base address when
      POSITION_INDEPENDENT is enabled. So the relocated env_addr might point to
      wrong address. For example, if SYS_TEXT_BASE is zero, gd->env_addr is
      out of memory location and memory exception will occur.
      
      There is a difference between linked address such as SYS_TEXT_BASE and
      runtime base address. In _main, the difference is calculated as
      "run-vs-link" offset. The env_addr should also be added to the offset
      to fix the address.
      
      gd->env_addr
        = (orig env) + ("run-vs-link" offset)   + gd->reloc_off
        = (orig env) + (SYS_TEXT_BASE - _start) + (gd->relocaddr - SYS_TEXT_BASE)
        = (orig env) + (gd->relocaddr - _start)
      
      Cc: Marek Vasut <marex@denx.de>
      Signed-off-by: default avatarKunihiko Hayashi <hayashi.kunihiko@socionext.com>
      Acked-by: default avatarMarek Vasut <marex@denx.de>
      Tested-by: default avatarMarek Vasut <marex@denx.de>
      534f0fbd
    • Ilias Apalodimas's avatar
      smbios: Fix SMBIOS tables · 70e80666
      Ilias Apalodimas authored and Heinrich Schuchardt's avatar Heinrich Schuchardt committed
      
      Commit e4f8e543("smbios: Drop the unused Kconfig options")
      break SMBIOS tables.  The reason is that the patch drops the Kconfig
      options *after* removing the code using them,  but that changes the semantics
      of the code completely.  Prior to the change a non NULL value was used in
      the 'product' and 'manufacturer ' fields.
      
      Chapter 6.2 of the DMTF spec requires Manufacturer and Product Name to be
      non-null on some of the tables. So let's add sane defaults for Type1/2/3.
      
      * Before the patchset:
      
      <snip>
      Handle 0x0002, DMI type 2, 14 bytes
      Base Board Information
              Manufacturer: Not Specified
              Product Name: Not Specified
              Version: Not Specified
              Serial Number: Not Specified
              Asset Tag: Not Specified
              Features:
                      Board is a hosting board
              Location In Chassis: Not Specified
              Chassis Handle: 0x0000
              Type: Motherboard
      
      Invalid entry length (0). DMI table is broken! Stop.
      
      * After the patchset:
      
      <snip>
      Handle 0x0005, DMI type 32, 11 bytes
      System Boot Information
              Status: No errors detected
      
      Handle 0x0006, DMI type 127, 4 bytes
      End Of Table
      
      Fixes: e4f8e543 ("smbios: Drop the unused Kconfig options")
      Signed-off-by: default avatarIlias Apalodimas <ilias.apalodimas@linaro.org>
      70e80666
    • Ilias Apalodimas's avatar
      smbios: Fix BIOS Characteristics Extension Byte 2 · ff192304
      Ilias Apalodimas authored and Heinrich Schuchardt's avatar Heinrich Schuchardt committed
      
      We currently define the EFI support of an SMBIOS table as the third bit of
      "BIOS Characteristics Extension Byte 1". The latest DMTF spec defines it
      on "BIOS Characteristics Extension Byte 2".
      
      Signed-off-by: default avatarIlias Apalodimas <ilias.apalodimas@linaro.org>
      
      Remove superfluous assignment.
      Signed-off-by: Heinrich Schuchardt's avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
      ff192304
    • Heinrich Schuchardt's avatar
      smbios: convert function descriptions to Sphinx style · 8c6532d7
      Heinrich Schuchardt authored
      
      Use 'Return:' instead of '@return:'.
      
      Signed-off-by: Heinrich Schuchardt's avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
      8c6532d7
    • Heinrich Schuchardt's avatar
      efi_loader: TPL_HIGH_LEVEL not allowed for CreateEvent · 7891fe67
      Heinrich Schuchardt authored
      
      According to chapter 7.1 "Event, Timer, and Task Priority Services"
      TPL_HIGH_LEVEL should not be exposed to applications and drivers.
      
      According to the discussion with EDK II contributors this implies that
      CreateEvent() shall not allow to create events with TPL_HIGH_LEVEL.
      
      Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
      Signed-off-by: Heinrich Schuchardt's avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
      Acked-by: default avatarSamer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
      7891fe67
  3. Jun 11, 2021
  4. Jun 09, 2021
  5. Jun 08, 2021
  6. Jun 07, 2021
    • Patrick Delaunay's avatar
      lmb: add lmb_dump_region() function · 358c7789
      Patrick Delaunay authored and Tom Rini's avatar Tom Rini committed
      
      Add lmb_dump_region() function, to simplify lmb_dump_all_force().
      This patch is based on Linux memblock dump function.
      
      An example of bdinfo output is:
      
      .....
      fdt_size    = 0x000146a0
      FB base     = 0xfdd00000
      lmb_dump_all:
       memory.cnt  = 0x1
       memory[0]	[0xc0000000-0xffffffff], 0x40000000 bytes flags: 0
       reserved.cnt  = 0x6
       reserved[0]	[0x10000000-0x10045fff], 0x00046000 bytes flags: 4
       reserved[1]	[0x30000000-0x3003ffff], 0x00040000 bytes flags: 4
       reserved[2]	[0x38000000-0x3800ffff], 0x00010000 bytes flags: 4
       reserved[3]	[0xe8000000-0xefffffff], 0x08000000 bytes flags: 4
       reserved[4]	[0xfbaea344-0xfdffffff], 0x02515cbc bytes flags: 0
       reserved[5]	[0xfe000000-0xffffffff], 0x02000000 bytes flags: 4
      arch_number = 0x00000000
      TLB addr    = 0xfdff0000
      ....
      
      Signed-off-by: Patrick Delaunay's avatarPatrick Delaunay <patrick.delaunay@foss.st.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      358c7789
    • Patrick Delaunay's avatar
      lmb: add lmb_is_reserved_flags · e359a4a5
      Patrick Delaunay authored and Tom Rini's avatar Tom Rini committed
      
      Add a new function lmb_is_reserved_flags to check if
      an address is reserved with a specific flags.
      
      This function can be used to check if an address was
      reserved with no-map flags with:
      
      lmb_is_reserved_flags(lmb, addr, LMB_NOMAP);
      
      Signed-off-by: Patrick Delaunay's avatarPatrick Delaunay <patrick.delaunay@foss.st.com>
      e359a4a5
    • Patrick Delaunay's avatar
      lmb: Add support of flags for no-map properties · 59c0ea5d
      Patrick Delaunay authored and Tom Rini's avatar Tom Rini committed
      
      Add "flags" in lmb_property to save the "no-map" property of
      reserved region and a new function lmb_reserve_flags() to check
      this flag.
      
      The default allocation use flags = LMB_NONE.
      
      The adjacent reserved memory region are merged only when they have
      the same flags value.
      
      This patch is partially based on flags support done in Linux kernel
      mm/memblock .c (previously lmb.c); it is why LMB_NOMAP = 0x4, it is
      aligned with MEMBLOCK_NOMAP value.
      
      Signed-off-by: Patrick Delaunay's avatarPatrick Delaunay <patrick.delaunay@foss.st.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      59c0ea5d
  7. Jun 01, 2021
  8. May 28, 2021
  9. May 25, 2021
  10. May 24, 2021
  11. May 19, 2021
Loading