f597fc3d | 15-Dec-2014 |
Przemyslaw Marczak <p.marczak@samsung.com> |
dfu: dfu_get_buf: check the value of env dfu_bufsiz before use
In function dfu_get_buf(), the size of allocated buffer could be defined by the env variable. The size from this variable was passed fo
dfu: dfu_get_buf: check the value of env dfu_bufsiz before use
In function dfu_get_buf(), the size of allocated buffer could be defined by the env variable. The size from this variable was passed for memalign() without checking its value. And the the memalign will return non null pointer for size 0.
This could possibly cause data abort, so now the value of var is checked before use. And if this variable is set to 0 then the default size will be used.
This commit also changes the base passed to simple_strtoul() to 0. Now decimal and hex values can be used for the variable dfu_bufsiz.
Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> [TestHW: Exynos4412-Trats2]
show more ...
|
7da6fa27 | 15-Dec-2014 |
Przemyslaw Marczak <p.marczak@samsung.com> |
dfu: mmc: check if mmc device exists in mmc_block_op()
The function mmc_block_op() is the last function before the physicall data write, but the mmc device pointer is not checked. If mmc device not
dfu: mmc: check if mmc device exists in mmc_block_op()
The function mmc_block_op() is the last function before the physicall data write, but the mmc device pointer is not checked. If mmc device not exists, then data abort will occur. To avoid this, first the mmc device pointer is checked.
Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> [TestHW: Exynos4412-Trats2]
show more ...
|
67ab0a5e | 01-Jul-2014 |
Stephen Warren <swarren@nvidia.com> |
dfu: fix readback buffer overflow test
The buffer is too small if it's < size to read, not if it's <= the size. This fixes the 1MB test case on Tegra, which has a 1MB buffer.
Signed-off-by: Stephen
dfu: fix readback buffer overflow test
The buffer is too small if it's < size to read, not if it's <= the size. This fixes the 1MB test case on Tegra, which has a 1MB buffer.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
show more ...
|
cb7bd2e0 | 11-Jun-2014 |
Stephen Warren <swarren@nvidia.com> |
dfu: add free_entity() to struct dfu_entity
This allows the backend to free any resources allocated during the relevant dfu_fill_entity_*() call. This will soon be used by the SF backend.
Signed-of
dfu: add free_entity() to struct dfu_entity
This allows the backend to free any resources allocated during the relevant dfu_fill_entity_*() call. This will soon be used by the SF backend.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
show more ...
|
7ac1b410 | 11-Jun-2014 |
Stephen Warren <swarren@nvidia.com> |
dfu: allow backend to specify a maximum buffer size
CONFIG_SYS_DFU_DATA_BUF_SIZE may be large to allow for FAT/ext layouts to transfer large files. However, this means that individual write operatio
dfu: allow backend to specify a maximum buffer size
CONFIG_SYS_DFU_DATA_BUF_SIZE may be large to allow for FAT/ext layouts to transfer large files. However, this means that individual write operations will take a long time. Allow backends to specify a maximum buffer size, so that each write operation is limited to a smaller data block. This prevents the DFU protocol from timing out when e.g. writing to SPI flash. I would guess that NAND might benefit from setting this value too, but I can't test that.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
show more ...
|
dd64827e | 11-Jun-2014 |
Stephen Warren <swarren@nvidia.com> |
dfu: defer parsing of device string to IO backend
Devices are not all identified by a single integer. To support this, defer the parsing of the device string to the IO backed, so that it can apply t
dfu: defer parsing of device string to IO backend
Devices are not all identified by a single integer. To support this, defer the parsing of the device string to the IO backed, so that it can apply the appropriate rules.
SPI devices are specified as controller:chip_select. SPI/SF support will be added soon.
MMC devices can also be specified as controller[.hwpart][:partition] in many commands, although we don't support that syntax in DFU.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
show more ...
|
3ee9593f | 11-Jun-2014 |
Stephen Warren <swarren@nvidia.com> |
dfu: add write error handling
Fix calls to dfu_write() and dfu_flush() to detect errors in the I/O itself. This could happen due to problems with the storage medium, or simply when trying to write a
dfu: add write error handling
Fix calls to dfu_write() and dfu_flush() to detect errors in the I/O itself. This could happen due to problems with the storage medium, or simply when trying to write a FAT/ext file that is larger than the buffer dfu_mmc.c maintains for this purpose.
Signal the error by switching the DFU state/status. This will be picked up by the DFU client when it sends the next DFU request. Note that errors can't simply be returned from e.g. dnload_request_complete(), since that function has no way to pass errors back to the DFU client; a call to dnload_request_complete() simply means that a USB OUT completed.
This error state/status needs to be cleared when the next DFU client connects. While there is a DFU_CLRSTATUS request, no DFU client seems to send this. Hence, clear this when selecting the USB alternate setting on the USB interface.
Finally, dfu.c relies on a call to dfu_flush() to clear up the internal state of the write transaction. Now that errors in dfu_write() are detected, dfu_flush() may no longer be called for every transaction. Separate out the cleanup code into a new function, and call it whenever dfu_write() fails, as well as from any call to dfu_flush().
Signed-off-by: Stephen Warren <swarren@nvidia.com>
show more ...
|
c8151b4a | 09-May-2014 |
Lukasz Majewski <l.majewski@samsung.com> |
dfu: mmc: Provide support for eMMC boot partition access
Before this patch it was only possible to access the default eMMC HW partition. By partition selection I mean the access to eMMC via the ext_
dfu: mmc: Provide support for eMMC boot partition access
Before this patch it was only possible to access the default eMMC HW partition. By partition selection I mean the access to eMMC via the ext_csd[179] register programming.
It sometimes happens that it is necessary to write to other partitions. This patch adds extra attribute to "raw" sub type of the dfu_alt_info environment variable (e.g. boot-mmc.bin raw 0x0 0x200 mmcpart 1;)
It saves the original boot value and restores it after storing the file.
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
show more ...
|
b7d4259a | 28-Apr-2014 |
Mateusz Zalega <m.zalega@samsung.com> |
dfu: mmc: change offset base handling
Previously offsets handled by dfu_fill_entity_mmc(), defined in boards' CONFIG_DFU_ALT were treated as hexadecimal regardless of their prefix, which sometimes l
dfu: mmc: change offset base handling
Previously offsets handled by dfu_fill_entity_mmc(), defined in boards' CONFIG_DFU_ALT were treated as hexadecimal regardless of their prefix, which sometimes led to confusion. This patch forces usage of explicit numerical base prefixes.
Signed-off-by: Mateusz Zalega <m.zalega@samsung.com> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Cc: Tom Rini <trini@ti.com> Cc: Minkyu Kang <mk7.kang@samsung.com>
show more ...
|
711b931f | 28-Apr-2014 |
Mateusz Zalega <m.zalega@samsung.com> |
dfu: mmc: raw data write fix
When user attempted to perform a raw write using DFU (vide dfu_fill_entity_mmc) with MMC interface not initialized before, get_mmc_blk_size() reported invalid (zero) blo
dfu: mmc: raw data write fix
When user attempted to perform a raw write using DFU (vide dfu_fill_entity_mmc) with MMC interface not initialized before, get_mmc_blk_size() reported invalid (zero) block size - it wasn't possible to write ie. a new u-boot image.
This commit fixes that by initializing MMC device before use in dfu_fill_entity_mmc().
While fixing initialization sequence, I had to change about half of dfu_fill_entity_mmc's body, so I refactored it on the way to make it, IMHO, considerably more comprehensible.
Being left as dead code, get_mmc_blk_size() was removed.
Tested on Samsung Goni.
Signed-off-by: Mateusz Zalega <m.zalega@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Acked-by: Tom Rini <trini@ti.com> Cc: Minkyu Kang <mk7.kang@samsung.com>
show more ...
|