Most devices has partitions named modemst1, modemst2, fsg and fsc
backing the rmtfs. Add a new argument '-P' to get the storage
implementation to use these partitions directly instead of files.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Add a new argument '-r' to prevent writes back to the backing storage.
This is useful for experimenting with the remote storage, without having
the files overwritten.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Pass "struct rmtfd" instead of file descriptors in the interface. This
cleans up the api a little bit, but more importantly allow us to
associate additional things with the remote file descriptors.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The caller (and caller_id) are really "remote file descriptors", so
rename them based on this.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Instead of relying on an initial lseek, use pread/pwrite. This creates a
cleaner interface towards the storage.c implementation, allowing us to
provide a memory-only implementation of the backing storage.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Enable the specification of storage paths other than /boot, using
a new -o command line argument. Getoptify the command line arguments
for better processing.
Currently, in order to back the EFS storage with a regular file,
those files have to be pre-allocated, and with their correct size.
This is especially problematic when preparing a minimal FSG, since
we do not know ahead of time what size to pre-allocate.
Allow reads that go beyond the end of the backing storage to simply
read zeroes. When a write comes in, the file will be automatically
expanded to the correct size. (And should really only be written
if a full sector was pulled out of the modem). For solutions
that use partitions instead of files, this change should be a no-op.
The 'phys_address' argument of rmtfs_mem_read() and rmtfs_mem_write() is
an 'unsigned long' type value, which is then passed to the
'phys_address' argument of rmtfs_mem_ptr(), which is an 'unsigned int'
type value. This patch fixes the mismatch.
Signed-off-by: Ben Chan <benchan@chromium.org>
I see warnings like this:
sharedmem.c:89:44: warning: incompatible pointer types passing 'uint64_t *' (aka 'unsigned long long *') to parameter of type 'unsigned long *' [-Wincompatible-pointer-types]
Since 'unsigned long' might actually be smaller than 'uint64_t', we
should really upgrade to 'unsigned long long' parsing.
At the same time, the existing error handling was wrong: it should have
been looking for ULONG_MAX (per the man page). Convert that to
ULLONG_MAX to fix that bug while we're at it.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
While convenient it's easy to mess things up with the qrtr project in
the include and library path. Drop these and rely on the installed
version of the include and library files.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The message pump is cleaned up from cruft that was added to deal with
multiple services (rmtfs and rfsa) as well as ENETRESET handling.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Utilize the QMI encoder/decoder functions being part of libqrtr instead
of rolling our own.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The rfsa service is not used on any supported targets and should most
likely be implemented in the kernel driver directly, so remove any
traces of it from rmtfs.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The kernel driver exposing the shared memory was renamed, update the
path in rmtfs as well.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Attempt to open /dev/qcom_rfsa1 and use this instead of memory mapping
/dev/mem, while falling back to the old behavior. This allow us to drop
the dependency on /dev/mem access and will aid supporting multiple
memory regions.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Rather than exposing a pointer to the mmapped memory and performing IO
directly on this address pass the data through a local buffer and move
the reading and writing of memory into the sharedmem module.
This allows us to support shared memory that is not memory mapped in the
future.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Introduce a struct to pass around the parameters related to the rmtfs
memory, in preparation for supporting multiple memory regions.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The nameserver notifies all registered servers about leaving clients.
Stub the handling of these messages, so they are not confused with the
qmi messages.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
In the event that the remote crashes, or for other reasons try to open a
partition that we already have open we should reuse the caller objects,
so that we don't run out of them. This should likely be replaced by a
working mechanism for notifications when the remote is going away.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
We don't have a way to notice if the remote crashes and free the memory,
so for now don't mark it as busy and just hand out the same memory the
next time.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
GNU coding standards notably specifies:
* install files with the $(DESTDIR) to the target system image
* install files with the $(prefix), not $(PREFIX)
* the default value of $(prefix) should be /usr/local
as per
https://www.gnu.org/prep/standards/html_node/Directory-Variables.html.
Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
The rmtfs address differes from platform to platform, so fetch these
from the device-tree node in /proc instead of hard coding them.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
To support creating and parsing requests and indications as well qmic
adds an extra parameter to the tlv alloc and decode functions, so that
this can be used to generate and validate that the qmi packet header is
of the correct type.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The rmtfs tool pushlishes the two QMI services "rmtfs" and "rfsa", and
implements the necessary requests for rmtfs that's needed to boot the
modem subsystem on a Qualcomm based board.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>