24 Oct, 2016

9 commits


19 Oct, 2016

21 commits

  • Patch queue for efi - 2016-10-19

    Highlights this time around:

    - Add run time service (power control) support for PSCI (fixed in v3)
    - Add efi gop pointer exposure
    - SMBIOS support for EFI (on ARM)
    - efi pool memory unmap support (needed for 4.8)
    - initial x86 efi payload support (fixed up in v2)
    - various bug fixes

    Signed-off-by: Tom Rini

    Conflicts:
    include/tables_csum.h

    Tom Rini
     
  • When you boot an efi payload from network, then exit that payload
    and load another payload from disk afterwords, the disk payload will
    currently see the network device as its boot path.

    This breaks grub2 for example which tries to find its modules based
    on the path it was loaded from.

    This patch fixes that issue by always reverting to disk paths if we're
    not in the network boot. That way the data structures after a network
    boot look the same as before.

    Signed-off-by: Alexander Graf

    Alexander Graf
     
  • Compiler attributes are more commonly __foo style tags rather than big
    upper case eye sores like EFI_RUNTIME_TEXT.

    Simon Glass felt quite strongly about this, so this patch converts our
    existing defines over to more eye friendly ones.

    Signed-off-by: Alexander Graf
    Reviewed-by: Simon Glass

    Alexander Graf
     
  • Add the required pieces to support the EFI loader on x86.

    Since U-Boot only builds for 32-bit on x86, only a 32-bit EFI application
    is supported. If a 64-bit kernel must be booted, U-Boot supports this
    directly using FIT (see doc/uImage.FIT/kernel.its). U-Boot can act as a
    payload for both 32-bit and 64-bit EFI.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng
    Signed-off-by: Alexander Graf

    Simon Glass
     
  • These are missing in some functions. Add them to keep things consistent.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng
    Reviewed-by: Alexander Graf
    Signed-off-by: Alexander Graf

    Simon Glass
     
  • This is required for x86 and is also correct for ARM (since it is empty).

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng
    Signed-off-by: Alexander Graf

    Simon Glass
     
  • If the system has a valid "serial#" environment variable set (which boards that
    can find it out programatically set automatically), use that as input for the
    serial number and UUID fields in the SMBIOS tables.

    Signed-off-by: Alexander Graf
    Reviewed-by: Bin Meng
    Reviewed-by: Simon Glass

    Alexander Graf
     
  • So far we were only installing the FDT table and didn't have space
    to store any other. Hence nobody realized that our efi table allocation
    was broken in that it didn't set the indicator for the number of tables
    plus one.

    This patch fixes it, allowing code to allocate new efi tables.

    Signed-off-by: Alexander Graf
    Reviewed-by: Simon Glass

    Alexander Graf
     
  • We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
    patch adds enablement for that case.

    While at it, we also enable SMBIOS generation for ARM systems, since they support
    EFI_LOADER.

    Signed-off-by: Alexander Graf
    Reviewed-by: Bin Meng
    Reviewed-by: Simon Glass

    Alexander Graf
     
  • The type 4 table generation code is very x86 centric today. Refactor things
    out into the device model cpu class to allow the tables to get generated for
    other architectures as well.

    Signed-off-by: Alexander Graf
    Reviewed-by: Simon Glass
    Reviewed-by: Bin Meng

    Alexander Graf
     
  • The CPU udevice already has a few callbacks to retreive information
    about the currently running CPUs. This patch adds a new get_vendor()
    call that returns the vendor of the main CPUs.

    Signed-off-by: Alexander Graf
    Reviewed-by: Simon Glass
    Reviewed-by: Bin Meng

    Alexander Graf
     
  • For SMBIOS tables we need to know the CPU family as well as CPU IDs. This
    patches allocates some space for them in the cpu device and populates it
    on x86.

    Signed-off-by: Alexander Graf
    Reviewed-by: Simon Glass
    Reviewed-by: Bin Meng

    Alexander Graf
     
  • The SMBIOS generation code passes pointers as u32. That causes the compiler
    to warn on casts to pointers. This patch moves all address pointers to
    uintptr_t instead.

    Technically u32 would be enough for the current SMBIOS2 style tables, but
    we may want to extend the code to SMBIOS3 in the future which is 64bit
    address capable.

    Signed-off-by: Alexander Graf
    Reviewed-by: Bin Meng
    Reviewed-by: Simon Glass

    Alexander Graf
     
  • We want to be able to add configuration table entries from our own code as
    well as from EFI payload code. Export the boot service function internally
    too, so that we can reuse it.

    Signed-off-by: Alexander Graf
    Reviewed-by: Simon Glass

    Alexander Graf
     
  • We will need the SMBIOS generation function on ARM as well going forward,
    so let's move it into a non arch specific location.

    Signed-off-by: Alexander Graf
    Reviewed-by: Bin Meng
    Reviewed-by: Simon Glass

    Alexander Graf
     
  • We need the checksum function without all the other table functionality
    soon, so let's split it out into its own C file.

    Signed-off-by: Alexander Graf
    Reviewed-by: Simon Glass
    Reviewed-by: Bin Meng

    Alexander Graf
     
  • When we're running in 32bpp mode, expose the frame buffer address
    to our payloads so that Linux efifb can pick it up.

    Signed-off-by: Alexander Graf

    Alexander Graf
     
  • So far bounce buffers were only used for disk I/O, but network I/O
    may suffer from the same problem.

    On platforms that have problems doing DMA on high addresses, let's
    also bounce outgoing network packets. Incoming ones always already
    get bounced.

    This patch fixes EFI PXE boot on ZynqMP for me.

    Signed-off-by: Alexander Graf

    Alexander Graf
     
  • Now that we have generic PSCI reset and shutdown support in place, we can
    advertise those as EFI Run Time Services, allowing efi applications and
    OSs to reset and shut down systems.

    Signed-off-by: Alexander Graf
    Reviewed-by: Simon Glass

    Alexander Graf
     
  • Most armv8 systems have PSCI support enabled in EL3, either through
    ARM Trusted Firmware or other firmware.

    On these systems, we do not need to implement system reset manually,
    but can instead rely on higher level firmware to deal with it.

    The exclude list seems excessive right now, but NXP is working on
    providing an in-tree PSCI implementation, so that all NXP systems
    can eventually use PSCI as well.

    Signed-off-by: Alexander Graf
    [agraf: fix meson]
    Reviewed-by: Simon Glass

    Alexander Graf
     
  • Tom Rini
     

18 Oct, 2016

10 commits

  • Tom Rini
     
  • Bring in these functions from Linux v4.4. They will be needed for EFI loader
    support.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng

    Simon Glass
     
  • We need the checksum function without all the other table functionality
    soon, so let's split it out into its own header file.

    Signed-off-by: Alexander Graf
    Reviewed-by: Bin Meng
    Reviewed-by: Simon Glass

    Alexander Graf
     
  • Using PSCI you can not only reset the system, you can also shut it down!
    This patch exposes a function to do exactly that to whatever code wants
    to make use of it.

    Signed-off-by: Alexander Graf
    Reviewed-by: Simon Glass

    Alexander Graf
     
  • All systems that are running on armv8 are running bare metal with firmware
    that implements PSCI running in EL3. That means we don't really need to expose
    the hypercall variants of them.

    This patch leaves the code in, but makes the code explicit enough to have the
    compiler optimize it out. With this we don't need to worry about hvc vs smc
    calling convention when calling psci helper functions.

    Signed-off-by: Alexander Graf
    Reviewed-by: Simon Glass

    Alexander Graf
     
  • EFI allows an OS to leverage firmware drivers while the OS is running. In the
    generic code we so far had to stub those implementations out, because we would
    need board specific knowledge about MMIO setups for it.

    However, boards can easily implement those themselves. This patch provides the
    framework so that a board can implement its own versions of get_time and
    reset_system which would actually do something useful.

    While at it we also introduce a simple way for code to reserve MMIO pointers
    as runtime available.

    Signed-off-by: Alexander Graf

    Alexander Graf
     
  • As soon as a mapping is unlinked from the list, there are no further
    references to it, so it should be freed. If it not unlinked,
    update the start address and length.

    Signed-off-by: Stefan Brüns
    Reviewed-by: Alexander Graf
    Signed-off-by: Alexander Graf

    Stefan Brüns
     
  • The code assumes sorted mappings in descending address order. When
    splitting a mapping, insert the new part next to the current mapping.

    Signed-off-by: Stefan Brüns
    Reviewed-by: Alexander Graf
    Signed-off-by: Alexander Graf

    Stefan Brüns
     
  • Currently each allocation creates a new mapping. Readding the mapping
    as free memory (EFI_CONVENTIONAL_MEMORY) potentially allows to hand out
    an existing mapping, thus limiting the number of mapping descriptors in
    the memory map.

    Mitigates a problem with current (4.8rc7) linux kernels when doing an
    efi_get_memory map, resulting in an infinite loop. Space for the memory
    map is reserved with allocate_pool (implicitly creating a new mapping) and
    filled. If there is insufficient slack space (8 entries) in the map, the
    space is freed and a new round is started, with space for one more entry.
    As each round increases requirement and allocation by exactly one, there
    is never enough slack space. (At least 32 entries are allocated, so as
    long as there are less than 24 entries, there is enough slack).
    Earlier kernels reserved no slack, and did less allocations, so this
    problem was not visible.

    Signed-off-by: Stefan Brüns
    Reviewed-by: Alexander Graf
    Signed-off-by: Alexander Graf

    Stefan Brüns
     
  • We need a functional free_pool implementation, as otherwise each
    allocate_pool causes growth of the memory descriptor table.

    Different to free_pages, free_pool does not provide the size for the
    to be freed allocation, thus we have to track the size ourselves.

    As the only EFI requirement for pool allocation is an alignment of
    8 bytes, we can keep allocating a range using the page allocator,
    reserve the first 8 bytes for our bookkeeping and hand out the
    remainder to the caller. This saves us from having to use any
    independent data structures for tracking.

    To simplify the conversion between pool allocations and the corresponding
    page allocation, we create an auxiliary struct efi_pool_allocation.

    Given the allocation size free_pool size can handoff freeing the page
    range, which was indirectly allocated by a call to allocate_pool,
    to free_pages.

    Signed-off-by: Stefan Brüns
    Reviewed-by: Alexander Graf
    Signed-off-by: Alexander Graf

    Stefan Brüns