The returned max payload size is no longer passed back through the
return value of the response parser, resulting in us configuring a max
payload size of 0 (success). Update the logic to use the new calling
scheme.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Move the USB functions to a separate file, so that we can build the
nbdkit plugin without including qdl.c.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Add generic block read and write functions, to allow implementing the
block level access needed in the nbdkit plugin.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Move the call to set_bootable out of firehose_run(), with the goal of
removing firehose_run()
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
By extracting the initial parts of firehose_run() we get closer to being
able to reuse the firehose code in the upcoming nbdkit plugin.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Expose firehose_reset() and call this from the main() function instead,
allowing the code to be reused between qdl and the nbdkit plugin.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Implement a function to query the storage information, to allow the
nbdkit plugin to query the size of each storage device.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
With the move the USBFS firehose_read() can be simplified and allow us
to implement the parser for the LOG lines carrying the response of the
getStorageInfo request.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The downstream tool has a 3 second delay to allow the firehose payload
to boot. Adding the same makes db820c successfully enter firehose mode.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Upon booting the firehose payload some platforms will issue log messages
others won't. Rather than waiting for 10 seconds on the ones that
doesn't wait only for a second.
Hopefully this is long enough, but the firmware synchronization and
handling of incoming log messages should be reviewed further.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
On db410c the target sends log entries after the response and refuse to
serve any subsequent requests until these are consumed, so continue
reading log entries until we get a timeout.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The nop was added to mitigate the fact that there's a rather long delay
in the response when sending out the first command. Increasing the write
timeout removes this problem and it's possible to just send the
configure as the first command without issues.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
It was assumed that we should send all the data following a "program"
request to the device, before sending a ZLP. But on SDM845 it's seen
that not sending a ZLP after each chunk sometimes causes the
communication to stall.
Given that the "program" request already carries the information about
how much data will be transferred there should be no issues with sending
additional ZLPs, so do this.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
On some newer platforms the device ignore the configure request to
disable ZLP, causing the Firehose program request to stall, when the
device is waiting for a ZLP to end a transfer.
Mitigate this by circumventing the qcserial driver and drive the USB
traffic directly using USBFS. The tool will attempt to detach qcserial
from the device, in case it's already attached, so no changes are needed
in the kernel or system configuration.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Added qdl support for emmc storage on platforms with UFS support. Use
option --s emmc or ufs as a argument to qdl command, if not specified
any option the default storage would be ufs
Tested-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
Signed-off-by: Laxman <itsmelaxman91@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This assignment is superfluous, since the same assignment is performed
in the for loop's initializer.
Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
printf uses z modifier to print size_t.
Also change d modifier to u, since size_t is unsigned.
(ssize_t is the signed version.)
Fixes build warning on 32-bit systems, e.g. ARMv7.
Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Let the programmer search for files beyond the current folder. When --include is
used , the programmmer will first look for files in the specified folder, and it
will then fallback to looking at the current folder.
Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Each xmlNewDoc should have a matching xmlFreeDoc call in order to avoid
memory leaks.
Signed-off-by: Kirill Kapranov <kkapra@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Some program entries has num_partition_sectors=0 but still specifies a
file, don't truncate the size of the file in this case.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Follow the behavior of the other flash tools and skip partitions with no
filename, instead of filling them with zeros. This reduces the flash
time considerably for some set of xml files.
Also clean up firehose_program() as we no longer need to support calling
this function with an invalid fd.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>