summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeLines
* tiny-printf: Support assert()Simon Glass2016-07-14-0/+9
| | | | | | | | | | At present assert() is not supported with tiny-printf, so when DEBUG is enabled a build error is generated for each assert(). Add an __assert_fail() function to correct this. It prints a message and then hangs. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: Add a more efficient libfdt librarySimon Glass2016-07-14-0/+141
| | | | | | | | Add a Python version of the libfdt library which contains enough features to support the dtoc tool. This is only a very bare-bones implementation. It requires the 'swig' to build. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: Don't include fdtdec functions when of-platdata is enabledSimon Glass2016-07-14-3/+2
| | | | | | | We cannot access the device tree in this case, so avoid compiling in the various device-tree helper functions. Signed-off-by: Simon Glass <sjg@chromium.org>
* sandbox: Find keyboard driver using driver modelSimon Glass2016-07-11-1/+0
| | | | | | | | The cros-ec keyboard is always a child of the cros-ec node. Rather than searching the device tree, looking at the children. Remove the compat string which is now unused. Signed-off-by: Simon Glass <sjg@chromium.org>
* fdt: x86: Tidy up a few COMPAT string definitionsSimon Glass2016-07-11-3/+3
| | | | | | | | The 'COMPAT_' part should appear only once so drop the duplicate part. It is ignored anyway, but let's keep things consistent. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* fdt: Add a note to avoid adding new compatible stringsSimon Glass2016-07-11-0/+5
| | | | | | | | The list is shrinking and we should avoid adding new things. Instead, a proper driver should be created with driver model. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* fdt: Drop unused exynos compatible stringsSimon Glass2016-07-11-2/+0
| | | | | | | A few drivers have moved to driver model, so we can drop these strings. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
* x86: fdt: Drop the unused compatible strings in fdtdecSimon Glass2016-07-11-5/+0
| | | | | | | | We have drivers for several more devices now, so drop the strings which are no-longer used. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* SPL: tiny-printf: avoid any BSS usageAndre Przywara2016-07-08-3/+8
| | | | | | | | | | As printf calls may be executed quite early, we should avoid using any BSS stored variables, since some boards put BSS in DRAM, which may not have been initialised yet. Explicitly mark those "static global" variables as belonging to the .data section, to keep tiny-printf clear of any BSS usage. Signed-off-by: Andre Przywara <andre.przywara@arm.com>
* fdt: Drop some unused compatible stringsSimon Glass2016-07-05-4/+0
| | | | | | We have driver-model drivers for some of these now, so drop them. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
* lib/lzo: bugfix when input data is not compressedJoris Lijssens2016-06-24-9/+16
| | | | | | | | When the input data is not compressed at all, lzo1x_decompress_safe will fail, so call memcpy() instead. Signed-off-by: Joris Lijssens <joris.lijssens@gmail.com>
* tinyprintf: Add vprintf implementationHans de Goede2016-06-20-0/+5
| | | | | | | | | vprintf is used by panic() which is used in various SPL paths on some boards. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Ian Campbell <ijc@hellion.org.uk> Reviewed-by: Simon Glass <sjg@chromium.org>
* lib/libfdt/: General aesthetic/style fixes.Robert P. J. Day2016-06-19-97/+109
| | | | | | | | | | | | | A number of style fixes across the files in this directory, including: * Correct invalid kernel-doc content. * Tidy up massive comment in fdt_region.c. * Use correct spelling of "U-Boot". * Replace tests of "! <var>" with "!<var>". * Replace "libfdt_env.h" with <libfdt_env.h>. Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca> Acked-by: Simon Glass <sjg@chromium.org>
* Merge branch 'master' of git://git.denx.de/u-boot-atmelTom Rini2016-06-13-1/+1
|\
| * fdt: Correct return value in fdtdec_decode_display_timing()Simon Glass2016-06-12-1/+1
| | | | | | | | | | | | | | | | This should return a non-zero value if there is a missing property. Update the return value accordingly. The only expected error is -FDT_ERR_NOTFOUND. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Andreas Bießmann <andreas@biessmann.org>
* | verified-boot: Minimal support for booting U-Boot proper from SPLTeddy Reed2016-06-12-6/+9
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | This allows a board to configure verified boot within the SPL using a FIT or FIT with external data. It also allows the SPL to perform signature verification without needing relocation. The board configuration will need to add the following feature defines: CONFIG_SPL_CRYPTO_SUPPORT CONFIG_SPL_HASH_SUPPORT CONFIG_SPL_SHA256 In this example, SHA256 is the only selected hashing algorithm. And the following booleans: CONFIG_SPL=y CONFIG_SPL_DM=y CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_FIT=y CONFIG_SPL_OF_CONTROL=y CONFIG_SPL_OF_LIBFDT=y CONFIG_SPL_FIT_SIGNATURE=y Signed-off-by: Teddy Reed <teddy.reed@gmail.com> Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Andreas Dannenberg <dannenberg@ti.com> Acked-by: Sumit Garg <sumit.garg@nxp.com>
* tiny-printf: Correct the snprintf() implementationSimon Glass2016-06-09-1/+3
| | | | | | | | | | | | This current code passes the variable arguments list to sprintf(). This is not correct. Fix it by calling _vprintf() directly. This makes firefly-rk3288 boot again. Fixes: abeb272 ("tiny-printf: Support snprintf()") Reviewed-by: Stefan Roese <sr@denx.de> Acked-by: Marek Vasut <marex@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>
* Merge http://git.denx.de/u-boot-samsungTom Rini2016-06-06-0/+2
|\ | | | | | | | | | | | | | | Signed-off-by: Tom Rini <trini@konsulko.com> Conflicts: configs/peach-pi_defconfig configs/peach-pit_defconfig
| * exynos: Allow tizen to be built without an LCDSimon Glass2016-05-25-0/+2
| | | | | | | | | | | | | | This file currently requires an LCD. Adjust it to work without one. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
* | lib: make strmhz available in SPLChris Packham2016-06-06-3/+2
| | | | | | | | | | | | | | | | | | | | When setting up a DDR controller it is useful to be able to display frequencies in a readable form. Make the strmhz() function available in SPL builds provided there is full vsprintf available. Reviewed-by: Tony O'Brien <tony.obrien@alliedtelesis.co.nz> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Chris Packham <judge.packham@gmail.com>
* | Remove unneeded remnants of bcopy().Robert P. J. Day2016-06-06-24/+0
| | | | | | | | | | | | | | Since bcopy() is no longer used, delete all remaining references to it. Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
* | efi_loader: Add DM_VIDEO supportAlexander Graf2016-06-06-7/+50
| | | | | | | | | | | | | | | | | | | | | | | | Some systems are starting to shift to support DM_VIDEO which exposes the frame buffer through a slightly different interface. This is a poor man's effort to support the dm video interface instead of the lcd one. We still only support a single display device. Signed-off-by: Alexander Graf <agraf@suse.de> [trini: Remove fb_size / fb_base as they were not used] Signed-off-by: Tom Rini <trini@konsulko.com>
* | efi_loader: Don't allocate from memory holesAlexander Graf2016-06-06-10/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When a payload calls our memory allocator with the exact address hint, we happily allocate memory from completely unpopulated regions. Payloads however expect this to only succeed if they would be allocating from free conventional memory. This patch makes the logic behind those checks a bit more obvious and ensures that we always allocate from known good free conventional memory regions if we want to allocate ram. Reported-by: Jonathan Gray <jsg@jsg.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
* | efi_loader: Move to normal debug infrastructureAlexander Graf2016-06-06-25/+8
| | | | | | | | | | | | | | | | | | | | | | | | We introduced special "DEBUG_EFI" defines when the efi loader support was new. After giving it a bit of thought, turns out we really didn't have to - the normal #define DEBUG infrastructure works well enough for efi loader as well. So this patch switches to the common debug() and #define DEBUG way of printing debug information. Signed-off-by: Alexander Graf <agraf@suse.de>
* | efi_loader: Add exit supportAlexander Graf2016-06-06-5/+16
| | | | | | | | | | | | | | | | | | | | | | Some times you may want to exit an EFI payload again, for example to default boot into a PXE installation and decide that you would rather want to boot from the local disk instead. This patch adds exit functionality to the EFI implementation, allowing EFI payloads to exit. Signed-off-by: Alexander Graf <agraf@suse.de>
* | Merge branch 'master' of git://git.denx.de/u-boot-tegraTom Rini2016-06-03-0/+1
|\ \
| * | mmc: tegra: add basic Tegra186 supportStephen Warren2016-05-31-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tegra186's MMC controller needs to be explicitly identified. Add another compatible value for it. Tegra186 will use an entirely different clock/reset control mechanism to existing chips, and will use standard clock/reset APIs rather than the existing Tegra-specific custom APIs. The driver support for that isn't ready yet, so simply disable all clock/reset usage if compiling for Tegra186. This must happen at compile time rather than run-time since the custom APIs won't even be compiled in on Tegra186. In the long term, the plan would be to convert the existing custom APIs to standard APIs and get rid of the ifdefs completely. The system's main eMMC will work without any clock/reset support, since the firmware will have already initialized the controller in order to load U-Boot. Hence the driver is useful even in this apparently crippled state. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Tom Warren <twarren@nvidia.com>
* | | lib: Enable private libgcc by defaultMarek Vasut2016-06-02-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch decouples U-Boot binary from the toolchain on systems where private libgcc is available. Instead of pulling in functions provided by the libgcc from the toolchain, U-Boot will use it's own set of libgcc functions. These functions are usually imported from Linux kernel, which also uses it's own libgcc functions instead of the ones provided by the toolchain. This patch solves a rather common problem. The toolchain can usually generate code for many variants of target architecture and often even different endianness. The libgcc on the other hand is usually compiled for one particular configuration and the functions provided by it may or may not be suited for use in U-Boot. This can manifest in two ways, either the U-Boot fails to compile altogether and linker will complain or, in the much worse case, the resulting U-Boot will build, but will misbehave in very subtle and hard to debug ways. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Albert Aribaud <albert.u.boot@aribaud.net> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* | | tiny-printf: Support sprintf()Marek Vasut2016-06-02-2/+14
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | Add a simple version of this function for SPL. It does not check the buffer size as this would add to the code size. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Stefan Roese <sr@denx.de> Cc: Tom Rini <trini@konsulko.com> Cc: lesne@alse-fr.com Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Sylvain Lesne <lesne@alse-fr.com> Tested-by: Sylvain Lesne <lesne@alse-fr.com>
* | Merge git://git.denx.de/u-boot-dmTom Rini2016-05-27-28/+81
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For odroid-c2 (arch-meson) for now disable designware eth as meson now needs to do some harder GPIO work. Signed-off-by: Tom Rini <trini@konsulko.com> Conflicts: lib/efi_loader/efi_disk.c Modified: configs/odroid-c2_defconfig
| * | dm: efi: Update for CONFIG_BLKSimon Glass2016-05-27-15/+46
| | | | | | | | | | | | | | | | | | | | | | | | This code does not currently build with driver model enabled for block devices. Update it to correct this. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alexander Graf <agraf@suse.de>
| * | tiny-printf: Support snprintf()Simon Glass2016-05-26-2/+25
| | | | | | | | | | | | | | | | | | | | | | | | Add a simple version of this function for SPL. It does not check the buffer size as this would add to the code size. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Roese <sr@denx.de>
| * | tiny-printf: Tidy up a few nitsSimon Glass2016-05-26-8/+8
| |/ | | | | | | | | | | | | | | | | - Rename 'w' to 'width' to make it more obvious what it is used for - Use bool and int types instead of char to avoid register-masking on 32-bit machines Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Roese <sr@denx.de>
* | efi_loader: gop: Don't expose fb addressAlexander Graf2016-05-27-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recently Linux is gaining support for efifb on AArch64 and that support actually tries to make use of the frame buffer address we expose to it via gop. While this wouldn't be bad in theory, in practice it means a few bad things 1) We expose 16bit frame buffers as 32bit today 2) Linux can't deal with overlapping non-PCI regions between efifb and a different frame buffer driver For now, let's just disable exposure of the frame buffer address. Most OSs that get booted will have a native driver for the GPU anyway. Signed-off-by: Alexander Graf <agraf@suse.de> [trini: Remove line_len entirely] Signed-off-by: Tom Rini <trini@konsulko.com>
* | efi_loader: Clean up system table on exitAlexander Graf2016-05-27-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | We put the system table into our runtime services data section so that payloads may still access it after exit_boot_services. However, most fields in it are quite useless once we're in that state, so let's just patch them out. With this patch we don't get spurious warnings when running EFI binaries anymore. Signed-off-by: Alexander Graf <agraf@suse.de>
* | efi_loader: Add bounce buffer supportAlexander Graf2016-05-27-9/+86
| | | | | | | | | | | | | | | | | | | | | | | | Some hardware that is supported by U-Boot can not handle DMA above 32bits. For these systems, we need to come up with a way to expose the disk interface in a safe way. This patch implements EFI specific bounce buffers. For non-EFI cases, this apparently was no issue so far, since we can just define our environment variables conveniently. Signed-off-by: Alexander Graf <agraf@suse.de>
* | efi_loader: Add network access supportAlexander Graf2016-05-27-0/+292
|/ | | | | | | | | | | | | We can now successfully boot EFI applications from disk, but users may want to also run them from a PXE setup. This patch implements rudimentary network support, allowing a payload to send and receive network packets. With this patch, I was able to successfully run grub2 with network access inside of QEMU's -M xlnx-ep108. Signed-off-by: Alexander Graf <agraf@suse.de>
* dm: part: Drop the block_drvr tableSimon Glass2016-05-17-11/+16
| | | | | | | This is not needed since we can use the functions provided by the legacy block device support. Signed-off-by: Simon Glass <sjg@chromium.org>
* Change my mailaddressAndreas Bießmann2016-05-02-1/+1
| | | | | | I'll switch my mails to my own server, so drop all gmail references. Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
* efi_loader: Handle memory overflowsAndreas Färber2016-04-18-4/+4
| | | | | | | | | | jetson-tk1 has 2 GB of RAM at 0x80000000, causing gd->ram_top to be zero. Handle this by either avoiding ram_top or by using the same type as ram_top to reverse the overflow effect. Cc: Alexander Graf <agraf@suse.de> Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Alexander Graf <agraf@suse.de>
* gunzip.c: use block layer for writesEric Nelson2016-04-18-3/+2
| | | | | | | | Call blk_dwrite to ensure that the block cache is notified if enabled and remove build breakage when CONFIG_BLK is enabled. Signed-off-by: Eric Nelson <eric@nelint.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>
* efi_loader: Expose ascending efi memory mapAlexander Graf2016-04-18-2/+7
| | | | | | | | | | | | The EFI memory map does not need to be in a strict order, but 32bit grub2 does expect it to be ascending. If it's not, it may try to allocate memory inside the U-Boot data memory region. We already sort the memory map in descending order, so let's just reverse it when we pass it to a payload. Signed-off-by: Alexander Graf <agraf@suse.de> Tested-by: Andreas Färber <afaerber@suse.de>
* efi_loader: Always flush in cache line size granularityAlexander Graf2016-04-18-1/+9
| | | | | | | | | | | | The cache line flush helpers only work properly when they get aligned start and end addresses. Round our flush range to cache line size. It's safe because we're guaranteed to flush within a single page which has the same cache attributes. Reported-by: Marek Vasut <marex@denx.de> Signed-off-by: Alexander Graf <agraf@suse.de> Reviewed-by: Andreas Färber <afaerber@suse.de> Tested-by: Andreas Färber <afaerber@suse.de>
* efi_loader: Increase path string to 32 charactersAlexander Graf2016-04-18-2/+2
| | | | | | | | | | | | Whenever we want to tell our payload about a path, we limit ourselves to a reasonable amount of characters. So far we only passed in device names - exceeding 16 chars was unlikely there. However by now we also pass real file path information, so let's increase the limit to 32 characters. That way common paths like "boot/efi/bootaa64.efi" fit just fine. Signed-off-by: Alexander Graf <agraf@suse.de>
* efi_loader: Add el torito supportAlexander Graf2016-04-18-0/+35
| | | | | | | | | | When loading an el torito image, uEFI exposes said image as a raw block device to the payload. Let's do the same by creating new block devices with added offsets for the respective el torito partitions. Signed-off-by: Alexander Graf <agraf@suse.de>
* efi_loader: Split drive add into functionAlexander Graf2016-04-18-37/+47
| | | | | | | | The snippet of code to add a drive to our drive list needs to get called from 2 places in the future. Split it into a separate function. Signed-off-by: Alexander Graf <agraf@suse.de>
* lib/crc8: Add crc start valueStefan Roese2016-04-11-13/+20
| | | | | | | | | | | | | | | | | | To make the usage of this function more flexible, lets add the CRC start value as parameter to this function. This way it can be used by other functions requiring different start values than 0 as well. For non-zero CRC start values to work, I've reworked the function a bit. The new implementation is copied from the Linux version in drivers/i2c/i2c-core.c / i2c_smbus_pec(). Which supports non-zero CRC stating values. I've double-checked that the results for zero starting values are identical to the results from the original version of this function. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* efi_loader: Always allocate the highest available addressAlexander Graf2016-04-01-0/+29
| | | | | | | | | | | | Some EFI applications (grub2) expect that an allocation always returns the highest available memory address for the given size. Without this, we may run into situations where the initrd gets allocated at a lower address than the kernel. This patch fixes booting in such situations for me. Signed-off-by: Alexander Graf <agraf@suse.de>
* lib/physmem.c: Switch to __weak for arch_phys_memsetTom Rini2016-04-01-4/+2
| | | | | | | We normally use __weak rather than calling it out directly as an alias. Update this function to the normal method. Signed-off-by: Tom Rini <trini@konsulko.com>
* cosmetic: Fix typos "privide"Masahiro Yamada2016-04-01-1/+1
| | | | Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>