19 Oct, 2016

10 commits

  • 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
     

18 Oct, 2016

12 commits

  • 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
     
  • We currently handle efi_allocate_pool() in our boot time service
    file. In the following patch, pool allocation will receive additional
    internal semantics that we should preserve inside efi_memory.c instead.

    As foundation for those changes, split the function into an externally
    facing efi_allocate_pool_ext() for use by payloads and an internal helper
    efi_allocate_pool() in efi_memory.c that handles the actual allocation.

    While at it, change the magic 0xfff / 12 constants to the more obvious
    EFI_PAGE_MASK/SHIFT defines.

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

    Stefan Brüns
     
  • A type mismatch in the efi_allocate_pool boot service flow causes
    hazardous memory scribbling on 32-bit systems.

    This is efi_allocate_pool's prototype:

    static efi_status_t EFIAPI efi_allocate_pool(int pool_type,
    unsigned long size,
    void **buffer);

    Internally, it invokes efi_allocate_pages as follows:

    efi_allocate_pages(0, pool_type, (size + 0xfff) >> 12,
    (void*)buffer);

    This is efi_allocate_pages' prototype:

    efi_status_t efi_allocate_pages(int type, int memory_type,
    unsigned long pages,
    uint64_t *memory);

    The problem: efi_allocate_pages does this internally:

    *memory = addr;

    This fix in efi_allocate_pool uses a transitional uintptr_t cast to
    ensure the correct outcome, irrespective of the system's native word
    size.

    This was observed when bootefi'ing the EFI instance of FreeBSD's first
    stage bootstrap (boot1.efi) on a 32-bit ARM platform (Qemu VExpress +
    Cortex-a9).

    Signed-off-by: Robin Randhawa
    Signed-off-by: Alexander Graf

    Robin Randhawa
     
  • The current efi_get_memory_map() function overwrites the map_size
    property before reading its value. That way the sanity check whether our
    memory map fits into the given array always succeeds, potentially
    overwriting arbitrary payload memory.

    This patch moves the property update write after its sanity check, so
    that the check actually verifies the correct value.

    So far this has not triggered any known bugs, but we're better off safe
    than sorry.

    If the buffer is to small, the returned memory_map_size indicates the
    required size to the caller.

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

    Stefan Brüns
     
  • In 74c16acce30bb882ad5951829d8dafef8eea564c the return values where
    changed, but the description was kept.

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

    Stefan Brüns
     
  • Signed-off-by: Tom Rini

    Tom Rini
     

16 Oct, 2016

1 commit


15 Oct, 2016

8 commits


14 Oct, 2016

9 commits

  • Tom Rini
     
  • The fdt_path_offset() function is not inlined in upstream libfdt. Adjust
    U-Boot's version to match.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • The signature for this macro has changed. Bring in the upstream version and
    adjust U-Boot's usages to suit.

    Signed-off-by: Simon Glass
    Update to drivers/power/pmic/palmas.c:
    Signed-off-by: Keerthy

    Change-Id: I6cc9021339bfe686f9df21d61a1095ca2b3776e8

    Simon Glass
     
  • These have now landed upstream. The naming is different and in one case the
    function signature has changed. Update the code to match.

    This applies the following upstream commits by
    Thierry Reding :

    604e61e fdt: Add functions to retrieve strings
    8702bd1 fdt: Add a function to get the index of a string
    2218387 fdt: Add a function to count strings

    Signed-off-by: Simon Glass

    Simon Glass
     
  • This includes small changes to the following functions, from upstream
    commit 6d1832c:

    - fdt_get_max_phandle() (upstream commit 84e0e134)
    - fdt_node_check_compatible (upstream commit 53bf130b)
    - fdt_setprop_inplace_namelen_partial() to remove useless brackets and
    use idx instead of index
    - _fdt_resize_property() to use idx instead of index
    - _fdt_splice() (upstream commit d4c7c25c)

    It also includes various typo fixes in libfdt.h

    Signed-off-by: Simon Glass

    Simon Glass
     
  • Using pointer arithmetic to generate a pointer outside a known object is,
    technically, undefined behaviour in C. Unfortunately, we were using that
    in fdt_offset_ptr() to detect overflows.

    To fix this we need to do our bounds / overflow checking on the offsets
    before constructing pointers from them.

    Reported-by: David Binderman
    Signed-off-by: David Gibson
    Signed-off-by: Simon Glass

    David Gibson
     
  • Sometimes devicetree nodes and or properties are added out of the u-boot
    console, maybe through some script or manual interaction.

    The devicetree as loaded or embedded is quite small, so the devicetree
    has to be resized to take up those new nodes/properties.

    In original the devicetree was only extended by effective
    4 * add_mem_rsv.

    With this commit we can add an argument to the "fdt resize" command,
    which takes the extrasize to be added.

    Signed-off-by: Hannes Schmelzer

    Signed-off-by: Hannes Schmelzer
    Acked-by: Simon Glass

    Hannes Schmelzer
     
  • Tom Rini
     
  • eth-uclass.c expects DM-capable Ethernet adapters to implement ops->
    read_rom_hwaddr(), or for some other mechanism to set pdata->enetaddr, or
    for the user to set environment variable $usbethaddr. Without any of
    these, it will refuse to initialize the device since no valid MAC address
    is known. Implement this function for the smsc95xx driver.

    With this feature implemented, there is no point smsc95xx_init_common()
    re-reading the MAC address from ROM, so ifdef out this code when DM_ETH
    is enabled.

    This allows (at least) the built-in Ethernet on the NVIDIA Harmony board
    to operate again.

    Fixes: 0990fcb77219 ("net: smsc95xx: Add driver-model support")
    Signed-off-by: Stephen Warren
    Acked-by: Joe Hershberger

    Stephen Warren