1. 26 3月, 2021 19 次提交
    • I
      efi_loader: Add an S-CRTM even for firmware version · f69a2016
      Ilias Apalodimas 提交于
      TCG PC Client Platform Firmware Profile Spec mandates that an S-CRTM
      event for the version identifier using the event type EV_S_CRTM_VERSION
      must be measured.
      
      So since we are trying to add more conformance into U-Boot, let's add
      the event using U_BOOT_VERSION_STRING, extend PCR[0] accordingly and log
      it in the EventLog
      Signed-off-by: NIlias Apalodimas <ilias.apalodimas@linaro.org>
      f69a2016
    • I
      efi_loader: EFI TCG2 free efi memory on protocol failure · d8cf113f
      Ilias Apalodimas 提交于
      Current code doesn't free the efi allocated memory in case the protocol
      failed to install
      
      Fixes: c8d0fd58 ("efi_loader: Introduce eventlog support for TCG2_PROTOCOL")
      Signed-off-by: NIlias Apalodimas <ilias.apalodimas@linaro.org>
      d8cf113f
    • J
      test: test the ESRT creation · de489d82
      Jose Marinho 提交于
      This commit slightly extends test_efi_capsule_fw3.
      
       In order to run the test the following must be added to
       sandbox_defconfig:
        +CONFIG_CMD_SF=y
        +CONFIG_CMD_MEMORY=y
        +CONFIG_CMD_FAT=y
        +CONFIG_DFU=y
      
       The ESRT is printed in the u-boot shell by calling efidebug esrt.
       The test ensures that, after the capsule is installed, the  ESRT
       contains entries with the GUIDs:
        - EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID;
        - EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID;
      
      test invocation:
       sudo ./test/py/test.py --bd sandbox -k capsule_fw3 -l --build
      
      CC: Heinrich Schuchardt	<xypron.glpk@gmx.de>
      CC: Sughosh Ganu <sughosh.ganu@linaro.org>
      CC: AKASHI Takahiro <takahiro.akashi@linaro.org>
      CC: Ilias Apalodimas <ilias.apalodimas@linaro.org>
      CC: Andre Przywara <andre.przywara@arm.com>
      CC: Alexander Graf <agraf@csgraf.de>
      CC: nd@arm.com
      Signed-off-by: NJose Marinho <jose.marinho@arm.com>
      Reviewed-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
      de489d82
    • J
      efi: ESRT creation tests · 4ac6041c
      Jose Marinho 提交于
      This commmit exercises the ESRT creation in a EFI selftest.
      
       A fake FMP, with TEST_ESRT_NUM_ENTRIES FW images, is installed in the
       system leading to the corresponding ESRT entries being populated.
       The ESRT entries are checked against the datastructure used to
       initialize the FMP.
      
      Invocation from the sandbox platform:
      add to sandbox_defconfig:
        +CONFIG_CMD_BOOTEFI_SELFTEST=y
      
       make sandbox_capsule_defconfig all
       ./u-boot -d arch/sandbox/dts/test.dtb
       bootefi selftest
      
      CC: Heinrich Schuchardt	<xypron.glpk@gmx.de>
      CC: Sughosh Ganu <sughosh.ganu@linaro.org>
      CC: AKASHI Takahiro <takahiro.akashi@linaro.org>
      CC: Ilias Apalodimas <ilias.apalodimas@linaro.org>
      CC: Andre Przywara <andre.przywara@arm.com>
      CC: Alexander Graf <agraf@csgraf.de>
      CC: nd@arm.com
      Signed-off-by: NJose Marinho <jose.marinho@arm.com>
      Signed-off-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
      4ac6041c
    • J
      cmd: efi: ESRT table debug print · aa31a87d
      Jose Marinho 提交于
      This commit enables the ESRT printing from the u-boot shell by invoking:
      - efidebug capsule esrt
      
      CC: Heinrich Schuchardt	<xypron.glpk@gmx.de>
      CC: Sughosh Ganu <sughosh.ganu@linaro.org>
      CC: AKASHI Takahiro <takahiro.akashi@linaro.org>
      CC: Ilias Apalodimas <ilias.apalodimas@linaro.org>
      CC: Andre Przywara <andre.przywara@arm.com>
      CC: Alexander Graf <agraf@csgraf.de>
      CC: nd@arm.com
      Signed-off-by: NJose Marinho <jose.marinho@arm.com>
      Reviwed-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
      aa31a87d
    • J
      efi: Add ESRT to the EFI system table · 64a8aae1
      Jose Marinho 提交于
      The ESRT is initialised during efi_init_objlist after
      efi_initialize_system_table().
      
      The ESRT is recreated from scratch at the following events:
      - successful UpdateCapsule;
      - FMP instance install.
      
      The code ensures that every ESRT entry has a unique fw_class value.
      
      Limitations:
      - The ESRT is not updated if an FMP instance is uninstalled;
      - the fields image_type and flags are in the current implementation left
      undefined. Setting these values will require a per-platform function
      that returns the image_type/flags as a function of the image fw_class.
      
      CC: Heinrich Schuchardt	<xypron.glpk@gmx.de>
      CC: Sughosh Ganu <sughosh.ganu@linaro.org>
      CC: AKASHI Takahiro <takahiro.akashi@linaro.org>
      CC: Ilias Apalodimas <ilias.apalodimas@linaro.org>
      CC: Andre Przywara <andre.przywara@arm.com>
      CC: Alexander Graf <agraf@csgraf.de>
      CC: nd@arm.com
      Signed-off-by: NJose Marinho <jose.marinho@arm.com>
      
      Remove two EFI_CALL() indirections.
      Move ESRT GUID in efidebug's list of GUIDs.
      Reviewed-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
      64a8aae1
    • H
      dfu: dfu_sf: avoid double free of SPI device · 57cba225
      Heinrich Schuchardt 提交于
      Multiple DFU entities may share the same SPI device. We must make sure that
      the SPI device is only freed once.
      
      When using the driver model it is not necessary to free the SPI device.
      Signed-off-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
      Acked-by: NLukasz Majewski <lukma@denx.de>
      57cba225
    • I
      efidebug: add multiple device path instances on Boot#### · cbea241e
      Ilias Apalodimas 提交于
      The UEFI spec allows a packed array of UEFI device paths in the
      FilePathList[] of an EFI_LOAD_OPTION. The first file path must
      describe the loaded image but the rest are OS specific.
      
      Previous patches parse the device path and try to use the second
      member of the array as an initrd. So let's modify efidebug slightly
      and install the second file described in the command line as the
      initrd device path.
      Signed-off-by: NIlias Apalodimas <ilias.apalodimas@linaro.org>
      cbea241e
    • I
      efi_loader: Replace config option for initrd loading · 53f6a5aa
      Ilias Apalodimas 提交于
      Up to now we install EFI_LOAD_FILE2_PROTOCOL to load an initrd
      unconditionally. Although we correctly return various EFI exit codes
      depending on the file status (i.e EFI_NO_MEDIA, EFI_NOT_FOUND etc), the
      kernel loader, only falls back to the cmdline interpreted initrd if the
      protocol is not installed.
      
      This creates a problem for EFI installers, since they won't be able to
      load their own initrd and continue the installation. It also makes the
      feature hard to use, since we can either have a single initrd or we have
      to recompile u-boot if the filename changes.
      
      So let's introduce a different logic that will decouple the initrd
      path from the config option we currently have.
      When defining a UEFI BootXXXX we can use the filepathlist and store
      a file path pointing to our initrd. Specifically the EFI spec describes:
      
      "The first element of the array is a device path that describes the device
      and location of the Image for this load option. Other device paths may
      optionally exist in the FilePathList, but their usage is OSV specific"
      
      When the EFI application is launched through the bootmgr, we'll try to
      interpret the extra device path. If that points to a file that exists on
      our disk, we'll now install the load_file2 and the efi-stub will be able
      to use it.
      
      This opens up another path using U-Boot and defines a new boot flow.
      A user will be able to control the kernel/initrd pairs without explicit
      cmdline args or GRUB.
      Signed-off-by: NIlias Apalodimas <ilias.apalodimas@linaro.org>
      Reviewed-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
      53f6a5aa
    • I
      efi_loader: Add helper functions for EFI · 37c3ca5c
      Ilias Apalodimas 提交于
      A following patch introduces a different logic for loading initrd's
      based on the EFI_LOAD_FILE2_PROTOCOL.
      Since similar logic can be applied in the future for other system files
      (i.e DTBs), let's add some helper functions which will retrieve and
      parse file paths stored in EFI variables.
      Signed-off-by: NIlias Apalodimas <ilias.apalodimas@linaro.org>
      37c3ca5c
    • I
      efi_loader: Add device path related functions for initrd via Boot#### · 76e8acce
      Ilias Apalodimas 提交于
      On the following patches we allow for an initrd path to be stored in
      Boot#### variables.  Specifically we encode in the FIlePathList[] of
      the EFI_LOAD_OPTIONS for each Boot#### variable.
      
      The FilePathList[] array looks like this:
      kernel - 0xff - VenMedia(initrd GUID) - initrd1 - 0x01 initrd2 - 0xff
      So let's add the relevant functions to concatenate and retrieve a device
      path based on a Vendor GUID.
      Signed-off-by: NIlias Apalodimas <ilias.apalodimas@linaro.org>
      Reformat function descriptions.
      Reviewed-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
      76e8acce
    • H
      cmd/load: support uploading EFI binary via UART · 7dbd7dd3
      Heinrich Schuchardt 提交于
      When uploading an EFI binary via the UART we have to call
      efi_set_bootdev() or we won't be able to execute it.
      
      Put the includes into alphabetic order.
      
      Fixes: 5f59518a ("efi_loader: setting boot device")
      Signed-off-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
      7dbd7dd3
    • H
      efi_loader: Uart device path · f027222a
      Heinrich Schuchardt 提交于
      When uploading an EFI binary via the UART we need to assign a device path.
      
      * Provide devicepath node to text conversion for Uart() node.
      * Provide function to create Uart() device path.
      * Add UART support to efi_dp_from_name().
      Signed-off-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
      f027222a
    • H
      efi_loader: NULL dereference in EFI console · 134d3387
      Heinrich Schuchardt 提交于
      Even if CONFIG_DM_VIDEO=y and stdout="vidconsole", a video device may not
      be available. Check the return values of the relevant functions.
      
      If no video output device is available, assume that the serial console is
      in use.
      Signed-off-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
      134d3387
    • S
      efi: Fix compiler warnings · df7d89a6
      Simon Glass 提交于
      This occur when building on Raspberry Pi 400 (32-bit ARM). Fix them.
      
      Examples:
      
      cmd/efidebug.c: In function ‘do_efi_capsule_update’:
      cmd/efidebug.c:75:49: warning: cast from pointer to integer of different
      	size [-Wpointer-to-int-cast]
        ret = EFI_CALL(RT->update_capsule(&capsule, 1, (u64)NULL));
                                                       ^
      include/efi_loader.h:104:9: note: in definition of macro ‘EFI_CALL’
        typeof(exp) _r = exp; \
               ^~~
      cmd/efidebug.c:75:49: warning: cast from pointer to integer of different
      	size [-Wpointer-to-int-cast]
        ret = EFI_CALL(RT->update_capsule(&capsule, 1, (u64)NULL));
                                                       ^
      include/efi_loader.h:104:19: note: in definition of macro ‘EFI_CALL’
        typeof(exp) _r = exp; \
                         ^~~
      
      In file included from include/common.h:20,
                       from lib/efi_loader/efi_capsule.c:9:
      lib/efi_loader/efi_capsule.c: In function ‘efi_update_capsule’:
      include/efi_loader.h:83:8: warning: format ‘%lu’ expects argument of type
      	‘long unsigned int’, but argument 10 has type ‘size_t’
      	{aka ‘unsigned int’} [-Wformat=]
        debug("%sEFI: Entry %s(" format ")\n", __efi_nesting_inc(), \
              ^~~~~~~~~~~~~~~~~~
      include/linux/printk.h:37:21: note: in definition of macro ‘pr_fmt’
       #define pr_fmt(fmt) fmt
                           ^~~
      include/log.h:229:2: note: in expansion of macro ‘log’
        log(LOG_CATEGORY, LOGL_DEBUG, fmt, ##args); \
        ^~~
      include/log.h:249:2: note: in expansion of macro ‘debug_cond’
        debug_cond(_DEBUG, fmt, ##args)
        ^~~~~~~~~~
      include/efi_loader.h:83:2: note: in expansion of macro ‘debug’
        debug("%sEFI: Entry %s(" format ")\n", __efi_nesting_inc(), \
        ^~~~~
      lib/efi_loader/efi_capsule.c:444:2: note: in expansion of macro ‘EFI_ENTRY’
        EFI_ENTRY("%p, %lu, %llu\n", capsule_header_array, capsule_count,
        ^~~~~~~~~
      lib/efi_loader/efi_capsule.c:444:19: note: format string is defined here
        EFI_ENTRY("%p, %lu, %llu\n", capsule_header_array, capsule_count,
                       ~~^
                       %u
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      Replace (uintptr_t)NULL by 0.
      Reviewed-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
      df7d89a6
    • I
      efi_selftest: Remove loadfile2 for initrd selftests · 6f908991
      Ilias Apalodimas 提交于
      We are redefining how u-boot locates the initrd to load via the kernel
      LoadFile2 protocol.  This selftest is not relevant any more, so remove
      it. A new one will be added later
      Signed-off-by: NIlias Apalodimas <ilias.apalodimas@linaro.org>
      Reviewed-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
      Signed-off-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
      6f908991
    • H
      efi_selftest: illegal cast to pointer in initrddump · a81978ef
      Heinrich Schuchardt 提交于
      On 32bit systems u64 cannot directly be cast to void *.
      Signed-off-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
      a81978ef
    • M
      efi_loader: fix memory type for memory reservation block · 073e5db6
      Mark Kettenis 提交于
      The (yet unreleased version of the) devicetree specification clearly
      states that:
      
        As with the /reserved-memory node, when booting via UEFI
        entries in the Memory Reservation Block must also be listed
        in the system memory map obtained via the GetMemoryMap() toi
        protect against allocations by UEFI applications. The memory
        reservation block entries should be listed with type
        EfiReservedMemoryType.
      
      This restores the behaviour that was changed by commit 4cbb2930
      ("efi_loader: consider no-map property of reserved memory").
      
      Fixes: 4cbb2930 ("efi_loader: consider no-map property of reserved memory")
      Signed-off-by: NMark Kettenis <kettenis@openbsd.org>
      Reviewed-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
      073e5db6
    • H
      efi_loader: disable GRUB_ARM32_WORKAROUND on ARCH_SUNXI · 4bad14ae
      Heinrich Schuchardt 提交于
      GRUB_ARM32_WORKAROUND can be disabled on ARCH_SUNXI as the Allwinner SoCs
      only have a level 2 cache controlled via CP15 and not an architecturally
      defined cache. Having the cache available speeds up booting Linux.
      
      On ARCH_BCM283X it is already disabled via rpi_2_defconfig. But let's move
      this setting to Kconfig.
      Signed-off-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
      4bad14ae
  2. 21 3月, 2021 16 次提交
  3. 19 3月, 2021 1 次提交
  4. 17 3月, 2021 4 次提交