summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeLines
* efi_loader: disk: Sanitize exposed devicesAlexander Graf2016-08-08-1/+5
| | | | | | | | | | | | When a target device is 0 bytes long, there's no point in exposing it to the user. Let's just skip them. Also, when an offset is passed into the efi disk creation, we should remove this offset from the total number of sectors we can handle. This patch fixes both things. Signed-off-by: Alexander Graf <agraf@suse.de>
* efi_loader: disk: Fix CONFIG_BLK breakageAlexander Graf2016-08-08-7/+11
| | | | | | | | | | | | | | | When using CONFIG_BLK, there were 2 issues: 1) The name we generate the device with has to match the name we set in efi_set_bootdev() 2) The device we pass into our block functions was wrong, we should not rediscover it but just use the already known pointer. This patch fixes both issues. Signed-off-by: Alexander Graf <agraf@suse.de>
* tiny-printf: Adjust to avoid using data sectionSimon Glass2016-08-08-44/+58
| | | | | | | | | | | | | | | | | We can pass all the variables down to the functions that need them, and then everything is on the stack. This is safer than using the data section. At least on firefly-rk3288, the code size is the same and the data size is 12 bytes smaller: before: 18865 2636 40 21541 5425 b/firefly-rk3288/spl/u-boot-spl after: 18865 2624 40 21529 5419 b/firefly-rk3288/spl/u-boot-spl Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Stefan Roese <sr@denx.de>
* Merge git://git.denx.de/u-boot-nand-flashTom Rini2016-07-25-0/+1
|\
| * mtd: nand: Add the sunxi NAND controller driverBoris Brezillon2016-07-24-0/+1
| | | | | | | | | | | | | | | | | | | | | | We already have an SPL driver for the sunxi NAND controller, now add the normal/standard one. The source has been copied from Linux 4.6 with a few changes to make it work in u-boot. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Acked-by: Hans de Goede <hdegoede@redhat.com>
* | hashtable: Fix compiler warning on 32-bit sandboxSimon Glass2016-07-25-5/+5
| | | | | | | | | | | | | | This fixes a mismatch between the %zu format and the type used on sandbox. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* | tools, rsa: Further minor cleanups on top of c236ebd and 2b9ec7mario.six@gdsys.cc2016-07-25-2/+4
|/ | | | | | | | | | | | | | | [NOTE: I took v1 of these patches in, and then v2 came out, this commit is squashing the minor deltas from v1 -> v2 of updates to c236ebd and 2b9ec76 into this commit - trini] - Added an additional NULL check, as suggested by Simon Glass to fit_image_process_sig - Re-formatted the comment blocks Signed-off-by: Mario Six <mario.six@gdsys.cc> Reviewed-by: Simon Glass <sjg@chromium.org> [For merging the chnages from v2 back onto v1] Signed-off-by: Tom Rini <trini@konsulko.com>
* rsa: Fix return value and masked errormario.six@gdsys.cc2016-07-22-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | When signing images, we repeatedly call fit_add_file_data() with successively increasing size values to include the keys in the DTB. Unfortunately, if large keys are used (such as 4096 bit RSA keys), this process fails sometimes, and mkimage needs to be called repeatedly to integrate the keys into the DTB. This is because fit_add_file_data actually returns the wrong error code, and the loop terminates prematurely, instead of trying again with a larger size value. This patch corrects the return value by fixing the return value of fdt_add_bignum, fixes a case where an error is masked by a unconditional setting of a return value variable, and also removes a error message, which is misleading, since we actually allow the function to fail. A (hopefully helpful) comment is also added to explain the lack of error message. This is probably related to 1152a05 ("tools: Correct error handling in fit_image_process_hash()") and the corresponding error reported here: https://www.mail-archive.com/u-boot@lists.denx.de/msg217417.html Signed-off-by: Mario Six <mario.six@gdsys.cc>
* efi_loader: Add debug output for efi_add_memory_map()Andreas Färber2016-07-22-0/+3
| | | | | | | | Tracing the arguments has been helpful for pinpointing overflows. Cc: Alexander Graf <agraf@suse.de> Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Alexander Graf <agraf@suse.de>
* Various, unrelated tree-wide typo fixes.Robert P. J. Day2016-07-16-1/+1
| | | | | | | | | | | | | | | | | | | Fix a number of typos, including: * "compatble" -> "compatible" * "eanbeld" -> "enabled" * "envrionment" -> "environment" * "FTD" -> "FDT" (for "flattened device tree") * "ommitted" -> "omitted" * "overriden" -> "overridden" * "partiton" -> "partition" * "propogate" -> "propagate" * "resourse" -> "resource" * "rest in piece" -> "rest in peace" * "suport" -> "support" * "varible" -> "variable" Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
* 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>