summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2017-11-30spl: make CONFIG_OF_EMBED pass dts through fdtgrepGoldschmidt Simon1-0/+4
Building spl with CONFIG_OF_EMBED enabled results in an error message on my board: "SPL image too big". This is because the fdtgrep build step is only executed for CONFIG_OF_SEPARATE. Fix this by moving the fdtgrep build step ('cmd_fdtgreo') from scripts/Makefile.spl to dts/Makefile so that the reduced dtb is available for all kinds of spl builds. The resulting variable name for the embedded device tree blob changes, too, which is why common.h and fdtdec.c have tiny changes. Signed-off-by: Simon Goldschmidt <sgoldschmidt@de.pepperl-fuchs.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-11-28Merge git://git.denx.de/u-boot-socfpgaTom Rini1-0/+2
2017-11-27Merge git://www.denx.de/git/u-boot-imxTom Rini1-0/+3
Signed-off-by: Tom Rini <trini@konsulko.com>
2017-11-26fdt: Add compatible strings for Arria 10Tien Fong Chee1-0/+2
Add compatible strings for Intel Arria 10 SoCFPGA device. Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
2017-11-20rtc: add support for s35392aNandor Han1-0/+3
Add support for S35392A RTC. The driver supports both U-Boot driver models. Signed-off-by: Nandor Han <nandor.han@ge.com> Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk> Cc: Heiko Schocher <hs@denx.de>
2017-11-20Merge git://git.denx.de/u-boot-dmTom Rini1-2/+58
2017-11-17tpm: add more missing va_end()André Draszik1-1/+4
While commit 36d35345b1f6 ("tpm: add missing va_end") added some missing calls to va_end(), it missed a few places. Signed-off-by: André Draszik <adraszik@tycoint.com> Acked-by: Simon Glass <sjg@chromium.org>
2017-11-17tpm: add tpm_get_random()André Draszik1-0/+43
Add a function to obtain random data from the TPM. Signed-off-by: André Draszik <adraszik@tycoint.com> Added commit message, add cast to min() Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
2017-11-17lib: libfdt: wrap scripts/dtc/libfdt/* where possibleMasahiro Yamada7-1483/+24
lib/libfdt/ and scripts/dtc/libfdt have the same copies for the followings 6 files: fdt.c fdt_addresses.c fdt_empty_tree.c fdt_overlay.c fdt_strerr.c fdt_sw.c Make them a wrapper of scripts/dtc/libfdt/*. This is exactly what Linux does to sync libfdt. In order to make is possible, import <linux/libfdt.h> and <linux/libfdt_env.h> from Linux 4.14-rc5. Unfortunately, U-Boot locally modified the following 3 files: fdt_ro.c fdt_wip.c fdt_rw.c The fdt_region.c is U-Boot own file. I did not touch them in order to avoid unpredictable impact. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-11-17libfdt: change libfdt_internal.h to a wrapper of scripts/dtc/libfdt/*Masahiro Yamada1-50/+1
Fortunately, U-Boot did not modify libfdt_internal.h locally. Change it to a wrapper of scripts/dtc/libfdt/fdt.h, which will be periodically synced with the upstream DTC (or kernel). Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-11-17libfdt: change fdt.h to a wrapper of scripts/dtc/libfdt/*Masahiro Yamada1-67/+0
Fortunately, U-Boot did not modify fdt.h locally. Change it to a wrapper of scripts/dtc/libfdt/fdt.h, which will be periodically synced with the upstream DTC (or kernel). Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-11-17pylibfdt: move pylibfdt to scripts/dtc/pylibfdt and refactor makefileMasahiro Yamada2-572/+0
The pylibfdt is used by dtoc (and, indirectly by binman), but there is no reason why it must be generated in the tools/ directory. Recently, U-Boot switched over to the bundled DTC, and the directory structure under scripts/dtc/ now mirrors the upstream DTC project. So, scripts/dtc/pylibfdt is the best location. I also rewrote the Makefile in a cleaner Kbuild style. The scripts from the upstream have been moved as follows: lib/libfdt/pylibfdt/setup.py -> scripts/dtc/pylibfdt/setup.py lib/libfdt/pylibfdt/libfdt.i -> scripts/dtc/pylibfdt/libfdt.i_shipped The .i_shipped is coped to .i during building because the .i must be located in the objtree when we build it out of tree. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-11-17tpm: fix reading of permanent flagsAndré Draszik1-1/+11
The offset of the permanent flags structure is in a different place in the response compared to what the code is doing, which gives us a completely useless result. Fix by replacing hand-crafted code with generic parser infrastructure. Signed-off-by: André Draszik <adraszik@tycoint.com> Acked-by: Simon Glass <sjg@chromium.org>
2017-10-29efi_loader: Disable env_save() call on bootAlexander Graf1-4/+1
With the introduction of EFI variable support, we also wanted to persist these EFI variables. However, the way it was implemented we ended up persisting all U-Boot environment variables on every EFI boot. That could potentially lead to unexpected side effects because variables that were not supposed to be written to persisted env get written. It also means we may end up writing the environment more often than we should. For this release, let's just disable EFI variable persistence and instead implement it properly for the next one. Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Fixes: ad644e7c182 ("efi_loader: efi variable support") Signed-off-by: Alexander Graf <agraf@suse.de> Acked-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2017-10-13Merge tag 'signed-efi-next' of git://github.com/agraf/u-bootTom Rini14-222/+1559
Patch queue for efi - 2017-10-13 This is the second batch of amazing improvements for efi_loader in 2017.11: - New self tests to verify our own code - A few bug fixes - colored text support - event and SNP improvements, should get us close to iPXE working
2017-10-13efi_selftest: correctly check return valuesHeinrich Schuchardt2-2/+2
When cancelling the timer we should check the return value provided by the set_timer service. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-12efi_loader: console support for color attributesRob Clark1-2/+25
Shell.efi uses this, and supporting color attributes makes things look nicer. Map the EFI fg/bg color attributes to ANSI escape sequences. Not all colors have a perfect match, but spec just says "Devices supporting a different number of text colors are required to emulate the above colors to the best of the device’s capabilities". Signed-off-by: Rob Clark <robdclark@gmail.com> Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Alexander Graf <agraf@suse.de> [agraf: s/unsigned/unsigned int/] Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-12efi_loader: Add mem-mapped for fallbackRob Clark2-0/+33
When we don't have a real device/image path, such as 'bootefi hello', construct a mem-mapped device-path. This fixes 'bootefi hello' after devicepath refactoring. Fixes: 95c5553ea2 ("efi_loader: refactor boot device and loaded_image handling") Signed-off-by: Rob Clark <robdclark@gmail.com> Acked-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-10efi_loader: don't increment part twice per loopJonathan Gray1-1/+0
Correct a mistake in the part number handling of commit 16a73b249d138fedeb188710533902ed7aac1ddc and only increment part once per loop. Signed-off-by: Jonathan Gray <jsg@jsg.id.au> Tested-by: Peter Robinson <pbrobinson@gmail.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-10efi_loader: search all possible disk partitionsJonathan Gray1-8/+12
When searching for partitions don't stop if a partition is not present for a given partition number as there may be valid partitions after. Search for up to MAX_SEARCH_PARTITIONS matching the other callers of part_get_info(). This allows OpenBSD to boot via the efi_loader on rpi_3 again after changes made after U-Boot 2017.09. With MBR partitioning OpenBSD will by default use the fourth partition for the 0xA6 (OpenBSD) partition. Signed-off-by: Jonathan Gray <jsg@jsg.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_selftest: error handling in SNP testHeinrich Schuchardt1-1/+8
Avoid NULL pointer dereference after setup failed due to a missing network. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_loader: comments for functions add missing @returnHeinrich Schuchardt1-1/+8
For some functions the @return description is missing. Fix typo. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_loader: Fix disk dp's for pre-DM/legacy devicesRob Clark1-0/+11
This fixes an issue with OpenBSD's bootloader, and I think should also fix a similar issue with grub2 on legacy devices. In the legacy case we were creating disk objects for the partitions, but not also the parent device. Reported-by: Jonathan Gray <jsg@jsg.id.au> Signed-off-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_loader: avoid NULL dereference in efi_dp_matchHeinrich Schuchardt1-1/+2
When calling bootefi hello twice a kernel dump occurs. Neither bootefi hello nor bootefi selftest have an image device patch. So do not try to dereference the NULL value. Fixes: 95c5553ea26 efi_loader: refactor boot device and loaded_image handling Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_selftest: avoid dereferencing NULL in tpl testHeinrich Schuchardt1-1/+2
The task priority levels test uses two events one passes the notification counter as context. The other passes NULL. Both use the same notification function. So we need to check for NULL here. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_selftest: efi_st_memcmp return difference of bytesHeinrich Schuchardt1-1/+1
If the memory regions are different efi_st_memcmp currently returns the difference of the addresses. Insted the difference of the first differing byte pair should be returned. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_loader: supply EFI network testHeinrich Schuchardt3-1/+456
This patch provides an EFI application to check the correct function of the Simple Network Protocol implementation. It sends a DHCP request and analyzes the DHCP offer. Different error conditions including a 10s timeout are checked. A successful execution will look like this: => bootefi nettest Scanning disk ide.blk#0... Found 1 disks WARNING: Invalid device tree, expect boot to fail Network test DHCP Discover DHCP reply received from 192.168.76.2 (52:55:c0:a8:4c:02) as broadcast message. OK. The test was completed successfully. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_selftest: allow printing MAC addressesHeinrich Schuchardt1-1/+40
Add %pm as format string to print a MAC address. This is helpful when analyzing network problems. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_loader: fill return values in SimpleNetworkProtocolHeinrich Schuchardt1-2/+25
In the receive function all return values should be filled. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_loader: size fields in SimpleNetworkProtocolHeinrich Schuchardt1-4/+20
The size fields in the Simple Network Protocol are all UINTN in the UEFI spec. So use size_t. Provide a function description of the receive function. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_loader: fix efi_net_get_statusHeinrich Schuchardt1-3/+8
The returned interrupt status was wrong. As out transmit buffer is empty we need to always set EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT. When we have received a packet we need to set EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT. Furthermore we should call efi_timer_check() to handle events. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_loader: implement WaitForPacket eventHeinrich Schuchardt1-0/+16
The WaitForPacket event informs that a network package has been received by the SimpleNetworkProtocol. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> [agraf: Move is_signaled = true line into efi_net_push()] Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_loader: use events for efi_net_receiveHeinrich Schuchardt1-3/+50
A timer event is defined. The timer handler cares for receiving new packets. efi_timer_check is called both in efi_net_transmit and efi_net_receive to enable events during network communication. Calling efi_timer_check in efi_net_get_status is implemented in a separate patch. [agraf] This patch is needed to make efi_net_get_status() actually report incoming packets. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> [agraf: fix spelling in comment] Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_net: return EFI_UNSUPPORTED where appropriateHeinrich Schuchardt1-6/+4
U-Boot does not implement all functions of the simple network protocol. The unimplemented functions return either of EFI_SUCCESS and EFI_INVALID_PARAMETER. The UEFI spec foresees to return EFI_UNSUPPORTED in these cases. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_loader: efi_net: hwaddr_size = 6Heinrich Schuchardt1-0/+1
The length of a MAC address is 6. We have to set this length in the EFI_SIMPLE_NETWORK_MODE structure of the EFI_SIMPLE_NETWORK_PROTOCOL. Without this patch iPXE fails to initialize the network with error message SNP MAC(001e0633bcbf,0x0) has invalid hardware address length 0 Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_loader: fill simple network protocol revisionHeinrich Schuchardt1-0/+1
Provide the simple network protocol revision. This revision number could be used to identify backwards compatible enhancements of the protocol. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_loader: wrong type in wait_for_eventHeinrich Schuchardt3-3/+3
The UEFI spec defines parameter index of WaitForEvent as UINTN*. So we should use size_t here. I deliberately do not use UINTN because I hold a following patch that will eliminate UINTN because uppercase types to not match the U-Boot coding style. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_loader: pass GUIDs as const efi_guid_t *Heinrich Schuchardt1-19/+21
We need to call some boottime services internally. Our GUIDs are stored as const efi_guid_t *. The boottime services never change GUIDs. So we can define the parameters as const efi_guid_t *. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_loader: parameters of CopyMem and SetMemHeinrich Schuchardt1-5/+5
The UEFI spec defines the length parameters of CopyMem and SetMem as UINTN. We should size_t here. The source buffer of CopyMem should be marked as const. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_loader: call EFI_EXIT in efi_copy_mem, efi_set_memHeinrich Schuchardt1-0/+2
EFI_ENTRY and EFI_EXIT calls must match. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_loader: replace efi_div10 by do_divHeinrich Schuchardt1-34/+2
We should use the existing 64bit division instead of reinventing the wheel. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_loader: provide function comments for boot servicesHeinrich Schuchardt1-2/+638
Provide comments describing the boot service functions. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_selftest: make tests easier to readHeinrich Schuchardt4-100/+126
Rename counter to more illustrative names. Update notification function description. Simplify notification function. Add comment for arbitrary non-zero value. Document @return. Use constants for return values of setup, execute, teardown. Reported-by: Simon Glass <sjg@chromium.org> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_loader: use type bool for event statesHeinrich Schuchardt2-17/+17
Queued and signaled describe boolean states of events. So let's use type bool and rename the structure members to is_queued and is_signaled. Update the comments for is_queued and is_signaled. Reported-by: Simon Glass <sjg@chromium.org> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_selftest: use efi_st_error for all error messagesHeinrich Schuchardt1-12/+10
All error messages in the selftests should use efi_st_error. efi_st_error will print the file name and line number of the error. Splitting message texts due to lines being over 80 characters is avoided. This resolves the issue reported by Simon Glass in https://lists.denx.de/pipermail/u-boot/2017-September/307387.html Reported-by: Simon Glass <sjg@chromium.org> Fixes: 623b3a579765 efi_selftest: provide an EFI selftest application Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-08ARMv8: get new GD address from gd->new_gd directlyzijun_hu1-0/+2
the new GD address is calculated via board data BD currently it require the new GD area locates below BD tightly, so a strict constraint is imposed on memory layout which maybe make special platform unpleasant. fix it by getting new GD address from gd->new_gd directly. Signed-off-by: zijun_hu <zijun_hu@htc.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-10-06spl: dm: Make it possible for the SPL to pick its own DTB from a FITJean-Jacques Hiblot1-9/+78
u-boot can be embedded within a FIT image with multiple DTBs. It then selects at run-time which one is best suited for the platform. Use the same principle here for the SPL: put the DTBs in a FIT image, compress it (LZO, GZIP, or no compression) and append it at the end of the SPL. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> [trini: Move default y of SPL_MULTI_DTB_FIT_DYN_ALLOC to it being the default choice if SYS_MALLOC_F, drop spl.h include from lib/fdtdec.c it's unused.] Signed-off-by Tom Rini <trini@konsulko.com>
2017-10-06fdtdec: sort include filesJean-Jacques Hiblot1-5/+5
Sort include files in accordance to U-Boot coding style. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2017-10-06lib: allow building lzo for the SPLJean-Jacques Hiblot2-1/+7
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-10-06gzip: add a function to parse the headerJean-Jacques Hiblot1-3/+12
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>