Commit Graph

14 Commits

Author SHA1 Message Date
Tianyi Liu
75cb81d197 sharedmem: Fix incorrect usages of strerror
`strerror` takes the `errno` directly as its argument,
negating it will result in an "Unknown error".

Signed-off-by: Tianyi Liu <i.pear@outlook.com>
2024-02-06 15:03:46 +08:00
John Stultz
0d00985e5e sharedmem: Fix pointer arithmetic warnings.
Building rmtfs on AOSP, we see a lot of the following:
  warning: arithmetic on a pointer to void is a GNU extension

Fix this by casting the void* ptrs to char* when doing pointer
arithmatic.

Signed-off-by: John Stultz <john.stultz@linaro.org>
[AmitP: Fixed cherry-pick conflicts and updated commit log]
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-09-28 10:08:11 -05:00
Amit Pundir
ad5f456c18 sharedmem: Keep /dev/qcom_rmtfs_memX fd open
/dev/qcom_rmtfs_mem0 fd is required to share the data.

Fixes: 9ef260ba6f ("ANDROID: Add Android support")
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-09-28 10:07:20 -05:00
Amit Pundir
9ef260ba6f ANDROID: Add Android support
* Add Android.bp makefile to build rmtfs for AOSP.
* libudev is not supported on AOSP so read
  /sys/class/rmtfs sysfs entries directly.

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-02-03 09:13:59 -08:00
Ben Chan
b3ea7fdf7b rmtfs: fix the type of the phys_address argument of rmtfs_mem_ptr()
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>
2018-07-05 07:10:30 -07:00
Brian Norris
577aedad06 sharedmem: use 'unsigned long long' for memory region parsing
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>
2018-07-05 07:01:36 -07:00
Joey Hewitt
a75ad5dc2a sharedmem: support uio device
Also a fix to error-reporting for opening the storage.
2018-05-21 17:05:29 -07:00
Bjorn Andersson
91f765efa8 rmtfs: Update dev node of rmtfs_mem
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>
2017-09-06 23:15:48 -07:00
Bjorn Andersson
93f9564224 rmtfs: Interface qcom_rfsa device for mem access
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>
2017-07-28 16:30:05 -07:00
Bjorn Andersson
c7822e84b1 rmtfs: Extract rmtfs mem IO operations
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>
2017-07-28 16:26:09 -07:00
Bjorn Andersson
6b7646c45f rmtfs: Move rmtfs_mem data to struct
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>
2017-07-28 16:21:15 -07:00
Bjorn Andersson
7a0bd0f561 rmtfs: Don't mark memory busy
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>
2016-07-01 17:34:12 -07:00
Bjorn Andersson
2150e2ae74 rmtfs: Fetch rmtfs address from device-tree
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>
2016-02-08 16:30:25 -08:00
Bjorn Andersson
1f12cea75b rmtfs: Initial rmtfs implementation
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>
2016-02-07 09:32:14 -08:00