summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* bbu: fix exporting i.MX NAND bbu handler over fastbootHEADmasterAhmad Fatoum13 hours1-19/+18
| | | | | | | | | | | | | | | | | handler->devicefile for i.MX NAND is nand0.barebox, which lacks a /dev/ prefix. This is ok for detection, as device_detect_by_name expects the cdev name and devpath_to_name() will strip a /dev/ if available. For stat() however, we need to add back /dev/, otherwise the file can't be found. Rework the code to do that. This fixes an issue where usbgadget -A '' -b would not export a i.MX NAND barebox update handler. Fixes: 726a802456bc ("common: bbu: only add available handlers") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220928085622.2677478-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: bcm2835: reset host controller on barebox shutdownAhmad Fatoum13 hours1-0/+12
| | | | | | | | | | | | | | | | | We don't usually disable MMC controllers on barebox shutdown, because they don't DMA on their own, unlike e.g. network controllers. Booting Linux v5.17.0 on a Raspberry Pi 4 in 32-bit mode still has the MMC host controller driver complain: [ 22.464887] mmc1: Got data interrupt 0x00000002 even though no data operation was in progress. Fix this by resetting the SDHCI once barebox is done with it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220930111940.1323140-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Revert "lib: zstd: sync with Linux"Sascha Hauer13 hours44-12118/+7771
| | | | | | | | | | | | | | | | | This was part of a larger series that made it possible to use other compression algos than LZO for device tree and to use zstd more widely for barebox and kernel compression. The latter zstd-related parts needed rework and were not merged, but the zstd update was applied. It broken in turn the UBIFS zstd support. As we get nothing out of the update without the not applied commits that need rework anyway, revert this commit. This reverts commit b4a9782d4f56333e897dccc35c2c27e2605f6b93. Reported-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220929102537.1767458-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* gpio: Fix gpio commands called without -d optionSascha Hauer2 days1-2/+2
| | | | | | | | | 04443dc5fc breaks the calculation of arguments needed which effectively makes the -d option mandatory. Fix this. Fixes: 04443dc5fc ("commands: gpio: add -d argument to set/get commands") Reported-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* gpiolib: Fix gpioinfo without argsSascha Hauer2 days1-1/+1
| | | | | | | | | | Since a30ae2921a the gpioinfo command crashes when called without arguments. Fix it by using argv[1] when it actually exists, not when it doesn't exist. Fixes: a30ae2921a ("gpiolib: gpioinfo: add optional CONTROLLER command line argument") Reported-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* zstd: fix assert() logicEnrico Scholz3 days1-1/+1
| | | | | | | | It should warn when condition does **not** hold Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Link: https://lore.barebox.org/20220927172217.662321-1-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* arm: rk3568 boards: call setup_c() before accessing global pointersSascha Hauer10 days2-24/+28
| | | | | | | | | | | Global pointers may only be accessed after setup_c() has been called. In pine-quartz64 and the Radxa Rock3 board the device tree pointer has been initialized earlier. As a result the pointer points to the address the device tree would be placed when the binary would run from 0x0. For some reason it nevertheless seemed to work though. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'hcl-dr-bugfix/issue13'Sascha Hauer12 days1-0/+2
|\
| * Merge branch 'bugfix/issue13' of https://github.com/hcl-dr/barebox-imx8mp ↵Sascha Hauer12 days1-0/+2
| |\ |/ / | | | | into hcl-dr-bugfix/issue13
| * usb: dwc3: support snps,dis-u2-freeclk-exists-quirk for i.MX8MPHans Christian Lonstad14 days1-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The driver currently configures the Synopsis USB 3.0/2.0 PHY to unconditionally provide a free-running PHY clock. This must be disabled on the i.MX8MP as well as RK3328 and RK3399 SoC, because the clock control input is inactive. The upstream Linux binding specifies a boolean DT property snps,dis-u2-freeclk-exists-quirk to disable the free-running PHY clock and the property is already used in the i.MX8MP DT, that barebox imports from upstream. Thus implement the binding for barebox. This fixes barebox USB host support on the i.MX8MP, which previously triggered a BUG() when enumerating[1]. Link: https://github.com/saschahauer/barebox/issues/13 [1] Fixes: e213627bbe1d ("usb: dwc3: of-simple: add i.MX8MP compatible") Signed-off-by: Hans Christian Lønstad <hcl@datarespons.no> Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
* | net: Use dma_alloc to allocate net packetSascha Hauer2022-09-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | network packets are often DMAed by the network drivers, so allocate them with dma_alloc() rather than assuming that an arbitrarily chosen alignment is sufficient This fixes network transfers on a Rockchip RK3568 board which occasionally sent out packets with corrupt data. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Documentation/conf.py: fix copyright yearsAntony Pavlov2022-09-161-1/+1
| | | | | | | | | | | | | | | | N.B. N-dash is used! Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Link: https://lore.barebox.org/20220912084627.84575-1-antonynpavlov@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/tftp'Sascha Hauer2022-09-147-102/+846
|\ \
| * | ARM: imx_v7_defconfig: Limit TFTP window sizeSascha Hauer2022-09-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The FEC ethernet controller is too slow to catch up with a gigabit link. This hasn't been a problem until now, because the protocols we use in barebox only have a single packet in flight. With TFTP window size support and a gigabit link though we get receive buffer overruns resulting in messages like: WARNING: eth0: error frame: 0x2feca098 0x00000806 The resulting speed is slower than without TFTP windowsize support due to the necessary retransmits. Limit the window size to a value that seems to be working on i.MX6 boards. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | tftp: make read() fail in error caseEnrico Scholz2022-09-131-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when tftp transfer goes in error state e.g. due to error packets sent from the server or (unexpected) internal problems, let the read() fail instead of ignoring these errors silently and corrupting the output. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Tested-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220905085658.3854939-4-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | tftp: add some documentation about windowsize supportEnrico Scholz2022-09-131-0/+40
| | | | | | | | | | | | | | | | | | Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Link: https://lore.barebox.org/20220830073816.2694734-22-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | tftp: accept OACK + DATA datagrams only in certain statesEnrico Scholz2022-09-121-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These packets are valid in certain points of the transfer only and accepting them too early or too late can corrupt internal states. Reject them when they are unexpected. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Link: https://lore.barebox.org/20220830073816.2694734-21-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | tftp: add selftestEnrico Scholz2022-09-123-1/+168
| | | | | | | | | | | | | | | | | | | | | | | | Unittest for window cache functions. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Link: https://lore.barebox.org/20220830073816.2694734-20-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | tftp: reorder tftp packetsEnrico Scholz2022-09-122-6/+323
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the tftp "windowsize" option, reordering of udp datagrams becomes an issue. Depending on the network topology, this reordering occurs several times with large tftp transfers and will heavily reduce the transfer speed. This patch adds a packet cache so that datagrams can be reassembled in the correct order. Because it increases memory usage and barebox binary size, it is an Kconfig option. bloat-o-meter reports with a non-zero FS_TFTP_REORDER_CACHE_SIZE | add/remove: 3/0 grow/shrink: 4/0 up/down: 916/0 (916) | Function old new delta | tftp_handler 920 1244 +324 | tftp_put_data - 184 +184 | tftp_window_cache_remove - 124 +124 | tftp_window_cache_get_pos - 120 +120 | tftp_allocate_transfer 104 188 +84 | tftp_do_close 260 312 +52 | tftp_send 384 412 +28 | Total: Before=630104, After=631020, chg +0.15% After setting FS_TFTP_REORDER_CACHE_SIZE Kconfig option to 0, numbers are going down to | add/remove: 0/0 grow/shrink: 3/0 up/down: 152/0 (152) | Function old new delta | tftp_handler 920 1012 +92 | tftp_allocate_transfer 104 136 +32 | tftp_send 384 412 +28 | Total: Before=630104, After=630256, chg +0.02% Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Link: https://lore.barebox.org/20220830073816.2694734-19-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | tftp: do not use 'priv->block' for RRQEnrico Scholz2022-09-121-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | attribute is not used outside tftp_recv() for RRQ. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Link: https://lore.barebox.org/20220830073816.2694734-18-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | tftp: implement 'windowsize' (RFC 7440) supportEnrico Scholz2022-09-122-13/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Results (with the reorder patch; numbers in bytes/s) on an iMX8MP are: | windowsize | VPN | 1 Gb/s | 100 Mb/s | |------------|-----------|------------|------------| | 128 | 3.869.284 | 98.643.085 | 11.434.852 | | 64 | 3.863.581 | 98.550.375 | 11.434.852 | | 48 | 3.431.580 | 94.211.680 | 11.275.010 | | 32 | 2.835.129 | 85.250.081 | 10.985.605 | | 24 | 2.344.858 | 77.787.537 | 10.765.667 | | 16 | 1.734.186 | 67.519.381 | 10.210.087 | | 12 | 1.403.340 | 61.972.576 | 9.915.612 | | 8 | 1.002.462 | 50.852.376 | 9.016.130 | | 6 | 775.573 | 42.781.558 | 8.422.297 | | 4 | 547.845 | 32.066.544 | 6.835.567 | | 3 | 412.987 | 26.526.081 | 6.322.435 | | 2 | 280.987 | 19.120.641 | 5.494.241 | | 1 | 141.699 | 10.431.516 | 2.967.224 | (VPN = OpenVPN on ADSL 50 Mb/s). The window size can be configured at runtime. This commit increases barebox size by | add/remove: 1/0 grow/shrink: 4/1 up/down: 148/-16 (132) | Function old new delta | tftp_send 336 384 +48 | tftp_handler 880 928 +48 | tftp_init 16 60 +44 | tftp_allocate_transfer 100 104 +4 | g_tftp_window_size - 4 +4 | tftp_poll 180 164 -16 | Total: Before=629980, After=630112, chg +0.02% Setting FS_TFTP_MAX_WINDOW_SIZE to zero reduces it to | add/remove: 1/0 grow/shrink: 3/2 up/down: 96/-52 (44) | Function old new delta | tftp_init 16 60 +44 | tftp_handler 880 924 +44 | tftp_allocate_transfer 100 104 +4 | g_tftp_window_size - 4 +4 | tftp_poll 180 164 -16 | tftp_send 336 300 -36 | Total: Before=629980, After=630024, chg +0.01% Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Link: https://lore.barebox.org/20220830073816.2694734-17-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | tftp: detect out-of-memory situationsEnrico Scholz2022-09-121-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | it should never happen due to the program logic; but detect a failed kfifo_put() just in case... Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Link: https://lore.barebox.org/20220830073816.2694734-16-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | tftp: refactor data processingEnrico Scholz2022-08-311-16/+21
| | | | | | | | | | | | | | | | | | | | | | | | move block handling into dedicated function Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Link: https://lore.barebox.org/20220830073816.2694734-15-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | tftp: reduce block size on lookup requestsEnrico Scholz2022-08-311-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Save some bytes on network traffic by reducing the server response for lookup requests. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Link: https://lore.barebox.org/20220830073816.2694734-14-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | tftp: record whether tftp file is opened for lookup operation onlyEnrico Scholz2022-08-311-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Opening a tftp is done in two steps: at first `tftp_lookup()` is called to get the filesize and then it is opened again and data are read. The `tftp_lookup()` call sends only a RRQ/WRQ, reads then the "tsize" from the response and closes the transfer by sending an error datagram. The tftp server will send a full data window. To prevent unneeded traffic, later patches set parameters to reduce the size of the server response. We need knowledge about type of operation which is recorded in an "is_getattr" attribute. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Link: https://lore.barebox.org/20220830073816.2694734-13-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | tftp: add sanity check for OACK responseEnrico Scholz2022-08-311-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | Catch bad 'blocksize' or 'windowsize' responses from the server. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Link: https://lore.barebox.org/20220830073816.2694734-12-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | tftp: allocate buffers and fifo dynamicallyEnrico Scholz2022-08-311-50/+144
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the actual blocksize for allocating buffers instead of assuming an hardcoded value. This requires to add an additional 'START' state which is entered after receiving (RRQ) or sending (WRQ) the OACK. Without it, the next state would be entered and the (not allocated yet) fifo be used. For non-rfc 2347 servers (which do not understand OACK and start with data transfer immediately after RRQ/WRQ), additional transitions in the state machine were implemented. Code adds some sanity checks in the new code paths. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Link: https://lore.barebox.org/20220830073816.2694734-11-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | tftp: add debug_assert() macroEnrico Scholz2022-08-311-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Is a noop in normal cases (when compiler sees that the condition can be evaluated without sideeffects) but allows optimizations based on the condition. E.g. in | void foo(int a) | { | debug_assert(a == 23); | | if (a == 23) | return; | | bar(); | } the call to 'bar()' will be optimized away. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Link: https://lore.barebox.org/20220830073816.2694734-10-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | tftp: remove sanity check of first blockEnrico Scholz2022-08-311-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With tftp window size support in the next patches, the first received block might be !=1 (e.g. when it was reordered or dropped). There could be checked whether it is in the first window, but the corresponding sanity check can be dropped completely: - OACK logic verifies that we speak with a tftp server (which always sends block #1 as the first one). Diagnostic will help only with non rfc 2743 servers (which are probably very rare resp. non existing nowadays) - the code some lines later handles this case already Remove the check and simplify things. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Link: https://lore.barebox.org/20220830073816.2694734-9-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | tftp: replace hardcoded blksize by global constantEnrico Scholz2022-08-311-2/+4
| | | | | | | | | | | | | | | | | | Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Link: https://lore.barebox.org/20220830073816.2694734-8-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | tftp: minor refactoring of RRQ/WRQ packet generation codeEnrico Scholz2022-08-311-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Having 11 printf arguments with lot of them being 0, makes it difficulty to read and extend. Add some comments and use '\0' for %c. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Link: https://lore.barebox.org/20220830073816.2694734-7-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | tftp: assign 'priv->block' later in WRQEnrico Scholz2022-08-311-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | Some refactoring; makes next patches cleaner. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Link: https://lore.barebox.org/20220830073816.2694734-6-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | tftp: do not set 'tsize' in WRQ requestsEnrico Scholz2022-08-311-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The filesize is not known for push requests and barebox always sent '0'. Server might reject data because it will always exceed this length. Send this option only for RRQ requests. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Link: https://lore.barebox.org/20220830073816.2694734-5-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | cmd:tftp: add '-P' option to set tftp server port numberEnrico Scholz2022-08-311-3/+19
| | | | | | | | | | | | | | | | | | Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Link: https://lore.barebox.org/20220830073816.2694734-4-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | tftp: allow to change tftp portEnrico Scholz2022-08-311-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a 'port=<port>' mount option for tftp filesystems. Useful e.g. when working with a local, non-privileged tftp server Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Link: https://lore.barebox.org/20220830073816.2694734-3-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | tftp: add some 'const' annotationsEnrico Scholz2022-08-311-1/+1
| | | | | | | | | | | | | | | | | | Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Link: https://lore.barebox.org/20220830073816.2694734-2-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/socfpga'Sascha Hauer2022-09-145-2/+28
|\ \ \
| * | | ARM: Socfpga: Achilles: Enable ARM errataSteffen Trumtrar2022-08-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Link: https://lore.barebox.org/20220826064956.507125-4-s.trumtrar@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | ARM: socfpga: Enclustra AA1: enable ARM errataSteffen Trumtrar2022-08-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Link: https://lore.barebox.org/20220826064956.507125-3-s.trumtrar@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | ARM: socfpga: add Arria10-specific errata initSteffen Trumtrar2022-08-304-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Cortex A9 on the Arria10 has multiple known errata. Enable at least the currently supported ones in barebox. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Link: https://lore.barebox.org/20220826064956.507125-2-s.trumtrar@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | ARM: socfpga: achilles: fix entry_function usageSteffen Trumtrar2022-08-301-2/+0
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit 3e62b38ff641f263df2f6c9e3ebda3c7c62f310b we use ENTRY_FUNCTION_WITHSTACK in the bringup barebox. The patch should have removed the arm_setup_stack line as it is already done in the ENTRY_FUNCTION_WITHSTACK macro. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Link: https://lore.barebox.org/20220826064956.507125-1-s.trumtrar@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/sha256'Sascha Hauer2022-09-1414-30/+100
|\ \ \
| * | | pbl: replace __piggydata_end with __image_endAhmad Fatoum2022-08-226-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | __piggydata_end and __image_end used to be synonyms before the addition of external firmware. Now that external firmware is located after __piggydata_end, code using it needs to be revisited. There's no reason to have code reference __piggydata_end. Either they want all the rest of the image, so they should use __image_end instead or they want just the piggy data, in which case they can read the data size embedded into the piggydata itself. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220818050447.2072932-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | firmware: add external firmware PBL supportAhmad Fatoum2022-08-223-10/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Normally, barebox embds firmware into the binary referencing it, which means that device tree blobs, RAM training code and e.g. TF-A for i.MX8M end up in the prebootloader, while, e.g. Freescale FMan microcode ends up in barebox proper. The only exception so far was barebox proper: When only the PBL fits in on-chip SRAM, barebox proper is chainloaded from the boot medium. To avoid TOCTOU attack, it's read fully into DRAM after setup and then a SHA256 is calculated and compared against the hash embedded in barebox PBL, which in a secure boot system would be trusted by virtue of the PBL as a whole being verified beforehand by the BootROM. Reuse this mechanism to support arbitrary firmware, which is now termed external firmware. Such firmware is placed beyond the piggydata (barebox proper) and only offset and hash are included in the prebootloader image. The new get_builtin_firmware_ext() is used to retrieve this external firmware after integrity verification with SHA256. This enables referencing firmware blobs from PBL that would bloat the size of the PBL beyond what can fit into on-chip SRAM, e.g. very big OP-TEE binaries. As users of get_builtin_firmware() didn't have to worry about TOCTOU so far, we panic when a firmware verification fails to ensure that we never load an OP-TEE that has been modified in-transit We can't include the OP-TEE binary in barebox proper, because we need to install it in EL3, but barebox proper on the i.MX8M runs as BL33 in a lower exception level. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220818050447.2072932-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | pbl: export pbl_barebox_verifyAhmad Fatoum2022-08-224-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's no downside to always build the digest verification code in PBL and export pbl_barebox_verify to access it. This allows board code to use the function for verifying other firmware blobs and CONFIG_PBL_VERIFY_PIGGY=y will remain to enable the verification at barebox proper extraction time. Code not using it will have the function sections garbage collected by the linker, so no functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220818050447.2072932-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | kbuild: make sha256sum command available generallyAhmad Fatoum2022-08-192-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently use the command only for generation a SHA256 sum of the barebox proper binary. In preparation for using it in othe Makefiles as well, move it to a central location and use the occasion to give it a short comment. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220818050447.2072932-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | Merge branch 'for-next/rpi'Sascha Hauer2022-09-144-0/+630
|\ \ \ \
| * | | | ARM: rpi: enable bcmgenet driverSascha Hauer2022-09-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20220909073749.3260556-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | | net: Add driver for bcmgenetSascha Hauer2022-09-123-0/+629
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a network driver for the bcmgenet core as found on the Raspberry Pi4. The driver is derived from the U-Boot driver which in turn is derived from the Linux driver. The driver has undergone the usual barebox adjustments and has been tested on the Rpi4. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20220909073749.3260556-1-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | | Merge branch 'for-next/rockchip'Sascha Hauer2022-09-142-523/+4
|\ \ \ \ \