Commit graph

6707 commits

Author SHA1 Message Date
wangyongrong
8e799ff823 rpmsg: upgrade API passing on parameters with the upgrade of OpenAMP
All the rpmsg transport layer and rpmsg services sync the API
with new OpenAMP

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-10-09 23:32:58 +08:00
buxiasen
264252497c pm: fix pm_wakelock_uninit api block, wd api need irq not disabled
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-10-09 23:31:49 +08:00
dongjiuzhu1
a005f4bff1 drivers/power: using baterr/batinfo to avoid frequency log output
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-10-09 23:31:49 +08:00
zhangshengchao
e26a01d9a6 regulator:add bypass logic when registering
do not control regulators when set bypass flag

Signed-off-by: zhangshengchao <zhangshengchao@xiaomi.com>
2024-10-09 23:31:49 +08:00
wanggang26
955a3838f7 mmcsd: refine emmc capacity calculate
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-10-09 22:24:18 +08:00
yinshengkai
3271142b87 note: print without relying on format strings
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-09 22:23:29 +08:00
yinshengkai
b5cf4310cb gote: implement asynchronous printf formatting
Do not format immediately when calling sched_note_printf, but delay formatting until dump trace.
After turning on SYSTEM_NOTE, similar asynchronous syslog functions can be achieved.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-09 22:23:29 +08:00
liwenxiang1
fa48d9e972 drivers/timers:Arch_alarm and arch_timer add up_ndelay interface
Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2024-10-09 22:11:03 +08:00
Bowen Wang
6ea3dcace4 misc/rpmsgdev: fix block mode read/write bug in rpmsgdev
Rpmsg dev server always open the real char device with nonblock mode,
so let client try to read/wrtie the read device every read/write
operation.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-09 19:53:28 +08:00
liwenxiang1
0647b49990 drivers/battery: Fix Goldfish Battery x64 unresponsive interrupt issue
Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2024-10-09 18:32:29 +08:00
anjiahao
fa59adde40 Simplify BOARD_MEMORY_RANGE initialization logic
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-09 15:41:48 +08:00
yangsong8
81d704cd82 gdbstub: support the use of recvbuf and sendbuf
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-10-09 15:41:48 +08:00
anjiahao
e007ace00d gdbstub:support only use gdbstub when panic
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-09 15:41:48 +08:00
lipengfei28
15126945cd qemu_epc_get_msi: flag should use msi enable flag
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-10-09 15:07:37 +08:00
yangsong8
954e84c82a usb: If usb3.0, set the ep0 sssize to cfgdescsize
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-10-09 14:19:16 +08:00
wanggang26
ecc2d473e3 mmcsd: add multi partitions prototype implementation
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-10-09 13:57:07 +08:00
lipengfei28
42041a428c include/nuttx.h: add common align definitions for nuttx
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-10-09 13:52:01 +08:00
lipengfei28
4ebf830bbd userspace: Exclude nuttx/arch.h
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-10-09 13:52:01 +08:00
Bowen Wang
acbe19d744 pci_drivers: move qemu edu and test device header content to pci_drivers.h
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-09 13:52:01 +08:00
lipengfei28
1ce6ec7c65 declare pci_dev_register
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-10-09 13:52:01 +08:00
lipengfei28
bc6cd326b8 pci test drv is pci rc drv not pci ep drv
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-10-09 13:52:01 +08:00
Bowen Wang
23b40818cb misc/dev_mem: fix compile error in aarch64
misc/dev_mem.c:203:24: error: comparison between two arrays [-Werror=array-compare]
  203 |   bool merge = (_edata == _sbss);
      |                        ^~
misc/dev_mem.c:203:24: note: use '&_edata[0] == &_sbss[0]' to compare the addresses

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-09 12:11:20 +08:00
Xiang Xiao
b068e2357a circbuf: Move from mm/circbuf to libs/libc/misc
so that it can be used by userspace program.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-09 08:41:49 +08:00
xuxingliang
5dffc61097 sched/note: add wdog note for segger sysview
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-09 08:39:58 +08:00
xuxingliang
bc5a337a58 sched/note: add note for wdog module
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-09 08:39:58 +08:00
chenzhijia
5f2bd4c655 drivers/coresight:Add TRFCR_EL1 initialization
Add TRFCR_EL1 initialization in ETM4 driver

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-10-09 08:37:48 +08:00
chenzhijia
6f8501e564 nuttx/drivers:Fix coresight compilation error
CC:  coresight/coresight_etm4.c coresight/coresight_etb.c: In function 'etb_open':
coresight/coresight_etb.c:334:19: error: implicit declaration of function 'enter_critical_section' [-Werror=implicit-function-declaration]
  334 |           flags = enter_critical_section();
      |                   ^~~~~~~~~~~~~~~~~~~~~~
coresight/coresight_etb.c:346:11: error: implicit declaration of function 'leave_critical_section' [-Werror=implicit-function-declaration]
  346 |           leave_critical_section(flags);
      |           ^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-10-09 08:37:48 +08:00
chenzhijia
a443a37390 drivers/coresight:ETM4 setup
Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-10-09 08:37:48 +08:00
chenzhijia
48a5419005 drivers/coresight:Add caps member to coresight_desc_s for etr
Add caps member to coresight_desc_s for etr and fix etr compilation error

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-10-09 08:37:48 +08:00
chenzhijia
49ad5e05d5 drivers/coresight:Fix coresight_replicator.c compilation error
Fix coresight_replicator.c compilation error, ret is not initialized

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-10-09 08:37:48 +08:00
ligd
6dc08ee681 pci: fix compile failed, fdt_get_reg_base() need 3 args
goldfish: fix compile failed, fdt_get_irq_by_path() need 4 args

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-09 02:18:49 +08:00
Bowen Wang
ba18f87a9e devicetree/fdt: fix fdt_get_reg_size() get wrong size
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-09 02:18:49 +08:00
zhengyu9
323e2518d9 drivers/devicetree/fdt: get 'reg' property
Original code can only deal with single 'address & size' cell
Add function dealing with multiple 'address & size' cell
Add function getting 'bankwidth' property, for cfi-flash device

Signed-off-by: zhengyu9 <zhengyu9@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-09 02:18:49 +08:00
likun17
a9c1684a1e usensor.c:fix container_of member error.
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-10-09 01:33:19 +08:00
wangmingrong1
1fdb3f5107 notesnap_driver.c: modify struct notesnap_s member type
clang atomic no support other type:
modify .index type size_t --- atomic_int
modify .dumping type bool --- atomic_bool

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-08 23:48:32 +08:00
yezhonghui
c90b654598 release msi/msix irq clean capability struct
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2024-10-08 23:47:45 +08:00
wangshaoxin
6feec8e4c5 rpmsg_port.c:add rpmsg_port_dump function
[01/01 00:02:48] [187] [ EMERG] [ap] Remote: wit
[01/01 00:02:48] [187] [ EMERG] [ap] ept NS
[01/01 00:02:48] [187] [ EMERG] [ap] ept rpmsg-sensor
[01/01 00:02:48] [187] [ EMERG] [ap] ept rpmsg-ping
[01/01 00:02:48] [187] [ EMERG] [ap] rpmsg_port queue RX: {used: 0, avail: 5}
[01/01 00:02:48] [187] [ EMERG] [ap] rpmsg buffer list:
[01/01 00:02:48] [187] [ EMERG] [ap] rpmsg_port queue TX: {used: 4, avail: 0}
[01/01 00:02:48] [187] [ EMERG] [ap] rpmsg buffer list:
[01/01 00:02:48] [187] [ EMERG] [ap]  TX buffer 0x619b84a8 hold by rpmsg-ping
[01/01 00:02:48] [187] [ EMERG] [ap]  TX buffer 0x619b86a8 hold by rpmsg-ping
[01/01 00:02:48] [187] [ EMERG] [ap]  TX buffer 0x619b88a8 hold by rpmsg-ping
[01/01 00:02:48] [187] [ EMERG] [ap]  TX buffer 0x619b8aa8 hold by rpmsg-ping

Signed-off-by: wangshaoxin <wangshaoxin@xiaomi.com>
2024-10-08 23:34:50 +08:00
Xu Xingliang
f51a9d5ac5 drivers/fb: use ENOTTY to replace assert
Some drivers may not implement certain ioctls, but applications
may still call these ioctl functions for consistency.
In this case, to avoid an assertion, return ENOTTY.

Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
2024-10-08 23:23:26 +08:00
jianglianfang
7db5e6bdb0 driver: add GOLDFISH_GPU_FB_PRIORITY for goldfish_gpu_fb_vsync_thread
We need to configure the priority of FB Vsync thread to prevent nxcamera from preempting scheduling without sleep, which currently causes issues with Goldfish x86_64's default FIFO scheduling.

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2024-10-08 23:23:08 +08:00
Jouni Ukkonen
b4de080b1f usbdev/cdcacm: Fix read queue counter in shutdown
nrdq is already set 0 in resetconfig.

Signed-off-by: Jouni Ukkonen <jouni.ukkonen@unikie.com>
2024-10-08 22:28:51 +08:00
zhanghongyu
948d51cd67 e1000: add polling mode support for tx/rx
In scenarios that require high time accuracy, we do not want an
interrupt from the NIC to interrupt the current task, so add support
for polling mode.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-10-08 13:15:31 +02:00
Bowen Wang
064eb5fd35 rpmsg services: should release the tx buffer when rpmsg_send_nocopy failed
Otherwise, the tx buffer will be discarded and can no longer be obtained

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-08 18:26:39 +08:00
lipengfei28
fa5fef2b95 pci: msi and msix irq need release irq
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-10-08 18:04:13 +08:00
buxiasen
a6b12eb29c goldfinsh: fix timer compile issue
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-10-08 15:27:33 +08:00
ligd
39bfdb95e1 timers: add goldfish timer support
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-08 15:27:33 +08:00
Xiang Xiao
4e5a963443 drivers/net: Register "/dev/net/tun" as tun node too
to compatible with Linux convention

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-08 11:16:01 +08:00
Xiang Xiao
77821fb7eb net: Remove IFF_DOWN flag to compatible with Linux/*BSD
turn off interface by checking IFF_UP flag isn't set:
https://github.com/apache/nuttx/issues/1838

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-08 10:15:16 +08:00
ligd
aff700f8ca timer: set g_timer.lower after TIMER_START()
in case of up_perf_gettime() get non-start value

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-08 08:59:39 +08:00
zhangwenjian
869271f5b8 drivers/note: suport rpmsg transfer channel for note,some note api
need to adapte for rpmsg.

We can transfer note content through rpmsg

Signed-off-by: zhangwenjian <zhangwenjian@xiaomi.com>
2024-10-08 08:58:43 +08:00
Bowen Wang
e8467a9bd5 fdt_virtio_mmio: bug fix, should not return when ret == -ENODEV
-ENODEV is a normal error code for function virtio_register_mmio_device()
because the virtio device is not must be in the mmio register address

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-08 08:15:00 +08:00
Bowen Wang
e83c7aba1c devicetree/fdt_virtio_mmio: implement the fdt_virtio_mmio_devices_register()
So the borad level do not need implement the
register_virtio_devices_from_fdt() again and again.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-08 08:15:00 +08:00
Bowen Wang
79be76a22c serial/uart_rpmsg: should init the lock before call rpmsg_register_callback
To avoid init the lock after this lock has been used.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-07 20:42:44 +08:00
Bowen Wang
262ccbb068 drivers/uart_rpmsg: add recv lock when received the data from peer
The recv buffer is used both in user thread and rpmsg ept->callback
thread, so add recv lock to protect the recv buffer.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-07 20:42:44 +08:00
yintao
a1dc6dc7fc driver/uart_rpmsg: clear transmit buffer when remote exception occurred
Make uart rpmsg work normally when restart the remote core

Signed-off-by: yintao <yintao@xiaomi.com>
2024-10-07 20:42:44 +08:00
ligd
5ff332f936 math: remove is_power_of_2() keep IS_POWER_OF_2()
Caused it may conflict with other platfrom

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-07 18:39:27 +08:00
xuxingliang
18d5ae20f5 drivers/segger: add heap data plot
Add heap current used to note.
Plot it in segger sysview data plot.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-07 17:34:59 +08:00
Neo Xu
b3cc564910 drivers/segger: upgrade segger to v356
From V3.5.6 on, data plot is supported.

Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-07 17:34:59 +08:00
xuxingliang
3bfb40f299 drivers/segger: add heap note support
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-07 17:34:59 +08:00
xuxingliang
ee11d6ca0a drivers/noteram: fix compile error
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-07 17:34:59 +08:00
xuxingliang
eac6a8597f sched/note: add note when mm add new region
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-07 17:34:59 +08:00
xuxingliang
0663ac1483 sched/note: specify note event for heap instrumentation
1. Add NOTE_HEAP_ prefix for heap note event.
2. Use note type as heap instrumentation parameter.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-07 17:34:59 +08:00
yinshengkai
79eab8783f note: add memory tracing event support
Record all memory allocation and release, save to ram, used to analyze memory allocation rate and memory usage
Its absolute value is not trustworthy because the memory will be allocated in thread A and released in thread B

 netinit-5   [0]   0.105984392: tracing_mark_write: C|5|Heap Usage|96|free: heap: 0x606000000020 size:24, address: 0x603000000370
 netinit-5   [0]   0.105996874: tracing_mark_write: C|5|Heap Usage|24|free: heap: 0x606000000020 size:72, address: 0x6070000008e0
nsh_main-4   [0]   3.825169408: tracing_mark_write: C|4|Heap Usage|2177665|free: heap: 0x606000000020 size:424, address: 0x614000000840
nsh_main-4   [0]   3.825228525: tracing_mark_write: C|4|Heap Usage|14977|free: heap: 0x606000000020 size:2162688, address: 0x7f80a639f800
nsh_main-4   [0]   3.825298789: tracing_mark_write: C|4|Heap Usage|15189|malloc: heap: 0x606000000020 size:20, address: 0x6030000003a0

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-07 17:34:59 +08:00
ligd
553cf84a7b audio: update audio null driver
fix nxplayer can't start
support capture

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-07 13:33:34 +08:00
yuanyongjian
6869a05368 syslog/syslog_rpmsg.c: the last log may be lost when it crashes
At line 236, we may set the null terminate to the priv->buffer,
when flushing the priv->buffer, we should use up_putc() instead up_nputs()
to ensure all the data has been output, because up_nputs() will check
the null terminate but up_putc() not.

Signed-off-by: yuanyongjian <yuanyongjian@xiaomi.com>
2024-10-07 12:18:10 +08:00
yuanyongjian
9e1750d22c syslog/syslog_rpmsg.c: out of memory
Signed-off-by: yuanyongjian <yuanyongjian@xiaomi.com>
2024-10-07 12:18:10 +08:00
ligd
7567e429b6 syslog_rpmsg: fix coding style
Follow the nxstyle

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-07 12:18:10 +08:00
yuanyongjian
8713638687 syslog/syslog_rpmsg.c: improve syslog_rpmsg performance
use copy buffer instead of single assignment

Signed-off-by: yuanyongjian <yuanyongjian@xiaomi.com>
2024-10-07 12:18:10 +08:00
Yongrong Wang
365fed554e rpmsgblk.c: fix compile warning
misc/rpmsgblk.c:616:29: warning: implicit declaration of function ‘rpmsg_virtio_get_buffer_size’; did you mean ‘rpmsg_get_rx_buffer_size’? [-Wimplicit-function-declaration]
  616 |   if (MAX(msglen, rsplen) > rpmsg_virtio_get_buffer_size(priv->ept.rdev))
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                             rpmsg_get_rx_buffer_size

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-10-07 04:18:18 +08:00
Xiang Xiao
7c839d7a09 rptun: Remove include/nuttx/rptun/openamp.h
and use include/nuttx/rpmsg/rpmsg.h instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-07 00:44:28 +08:00
Yongrong Wang
26ac220810 virtio devices: update virtqueue operate buffer add lock API
1. Use the virtqueue_xxx_lock() api;
2. Add spinlock for some virtio and vhost drivers that do not
   use spinlock to protect the virtqueues;

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-10-06 08:37:53 +08:00
Bowen Wang
fd9efb600c virtio/virtio-net: add spinlock for the virtqueue
virtqueues are used in irq and thread, so add spinlock to protect
them.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-06 08:37:53 +08:00
Bowen Wang
c0edb0f402 virtio/virtio-net: calculate the correct buffer number
Avoid exceed the virtqueue length limit when adding buffer to the
virtqueue.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-06 08:37:53 +08:00
wangyongrong
377f184019 virtio-rpmb.c: add spin lock for virtqueue add/get buffer
Virtqueeus are used in both user thread and interrupt, so add spinlock
to proetect them.

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-10-06 08:37:53 +08:00
wangyongrong
e8a8052a8a virtio-serial.c: add spin lock for virtqueue add/get buffer
Virtqueeus are used in both user thread and interrupt, so add spinlock
to proetect them.

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-10-06 08:37:53 +08:00
wangyongrong
67ceba3cd6 virtio-blk.c: add spin lock to fix get/add virtqueue buffer at the same time err
Virtqueues are used in both user thread and interrupt, so add spinlock to protect
them.

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-10-06 08:37:53 +08:00
wangyongrong
58aca26b1b virtio-blk.c: change virtio blk req and resp to local variables
So we can remove the mutex lock to improve the virtio-block driver
performance

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-10-06 08:37:53 +08:00
wangyongrong
735dc6e2bf virtio-rng.c: add spin lock to fix get/add virtqueue buffer at the same time err
the virtqueue should be protected by the spinlock, because the virtqueues are used
both in worker and interrupt.

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-10-06 08:37:53 +08:00
wangyongrong
f6f151a8e1 virtio-blk: add VIRTIO_BLK_F_BLK_SIZE feature
Support configure the virtio block device block size to other value
(default value is 512)

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-10-06 08:37:53 +08:00
wangyongrong
ef58c71582 virtio-blk: add VIRTIO_BLK_F_RO feature
When feature VIRTIO_BLK_F_RO is set, virtio-blk only support read
operation.

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-10-06 08:37:53 +08:00
wangyongrong
7ec167392c virtio-blk: add VIRTIO_BLK_F_FLUSH features
Should support the flush command only when virtio device support
feature VIRTIO_BLK_F_FLUSH

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-10-06 08:37:53 +08:00
Bowen Wang
7eda1700c2 virtio/virtio-rng: make virtio-rng work for remoteproc transport layer
For remoteproc transport layer, the virtio drivers can not use the malloced
memory from the default system heap to communicate with the virtio devices,
the buffers placed in virtqueue should be in the share memory region
(mallcoed virtio_alloc_buf()).

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-06 08:37:53 +08:00
Bowen Wang
106040df6c virtio-serial: support custom the virtio serial device name
By setting config CONFIG_DRIVERS_VIRTIO_SERIAL_NAME to "ttyXX0;ttyXX1;..."
to customize the virtio serial name.

For example:
If CONFIG_DRIVERS_VIRTIO_SERIAL_NAME="ttyBT;ttyTest0;ttyTest1",
virtio-serial will register three uart devices with names:
"/dev/ttyBT", "/dev/ttyTest0", "/dev/ttyTest1" to the VFS.

nsh> ls dev
/dev:
 console
 null
 telnet
 ttyBT
 ttyS0
 ttyTest0
 ttyTest1
 zero

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-06 08:37:53 +08:00
Bowen Wang
84d2aae63b virtio-mmio: add secure virtio mmio device register api
In secure state, call virtio_register_mmio_device_secure() to
register the secure virtio mmio device;
In non-secure state, call virtio_register_mmio_device() to
register the non-secure virtio mmio device;
Board should ensure not mixed use the secure and non-seucre mmio
device.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-06 08:37:53 +08:00
shipei
551b9b1626 audio:add getlatency for virtio snd driver
add getlatency in virtio snd driver

Signed-off-by: shipei <shipei@xiaomi.com>
2024-10-06 08:37:53 +08:00
raiden00pl
e3bbd0cfd8 drivers/serial/CMakeLists.txt: add missing files
add missing files: uart_bth5.c and uart_ram.c
2024-10-05 23:40:11 +08:00
Xiang Xiao
1195ec03f7 driver/vhost: Call metal_init in vhost_register_drivers
since libmetal come from OpenAMP need be initialized before working

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-05 12:05:13 -03:00
Xiang Xiao
f914bc8ef2 driver/vhost: Check driver is NULL before calling probe
to avoid the same device bind to multiple drivers at the same time

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-05 12:05:13 -03:00
Xiang Xiao
1e823a077c driver/vhost: vhost_register_device should set priv before inovking probe
align the behavior with vhost_register_driver

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-05 12:05:13 -03:00
Xiang Xiao
347c2dae29 driver/virtio: Check driver isn't NULL before calling remove
since the device mayn't bind to the driver yet

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-05 12:05:13 -03:00
Xiang Xiao
bad1627759 driver/vhost: Check driver isn't NULL before calling remove
since the device mayn't bind to the driver yet

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-05 12:05:13 -03:00
Xiang Xiao
0f918c8d4d pci/ivshmem: Check drv isn't NULL before calling remove
since the device mayn't bind to the driver yet

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-05 12:05:13 -03:00
Xiang Xiao
2aaaa7632f rpmsg/ivshmem: Skip unregistering ivshmem driver
since ivshmem device may insert again

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-05 12:05:13 -03:00
Xiang Xiao
6685fb5434 pci/ivshmem: Skip unregistering ivshmem driver
since ivshmem device may insert again

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-05 12:05:13 -03:00
wanggang26
e16c785e8c mmcsd: move block driver register to probe stage in order to read ext_csd reg
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-10-05 09:17:25 +08:00
Bowen Wang
51d6e8f49e virtio/vhost: assign the virtio/vhost_drvier to device->priv before probe
So the driver can get the driver pointer by vdev/hdev->priv,
and later vdev/hdev->priv can be used to store other data such as the
virtio/vhost drivers' private data.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-03 17:37:40 +08:00
Bowen Wang
c42576e87b drivers/vhost-rng: add vhost rng driver support for NuttX
vhost-rng is a simple virtio device implementation, it receives
the buffer receviced from the virtio-rng driver and fill the random
number to this buffer and return to virtio-rng.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-03 17:37:40 +08:00
Bowen Wang
7afbcc1a62 drivers/vhost: add vhost framework for NuttX
virtio is a framework to implement the virtio drivers
vhost (Virtual Host) is a framework to implement the virtio devices
With the virtio and vhost framework, we can use the virtio drivers
and vhost drivers to implement the cross-core communication.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-03 17:37:40 +08:00
Yongrong Wang
d0e4c4436e rpmsg_virtio: move rpmsg virtio cmd definition before the resource table
use reserved[2] in struct resource_table as the command, avoid the
resource table format do not follow the standard.

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-10-03 09:37:24 +08:00
Bowen Wang
af6eb7226e drivers/rptun: add cmake support for rptun_secure
1. Add cmake support for rptun_serure;
2. Move rptun_secure.c before rptun_ivshmem.c in Make.defs to follow
   the order in Kconfig.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-03 08:57:46 +08:00
Jukka Laitinen
a88693f519 drivers/usbdev/cdcacm.c: Fix compilation issues
Add #ifdef CONFIG_SERIAL_TXDMA/RXDMA in g_uartops init

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-10-03 08:55:13 +08:00
Jukka Laitinen
5d4d2cbbc8 drivers/usbdev/pl2303.c: Don't let maximum number of bytes in request exceed CONFIG_PL2303_BULKIN_REQLEN
The request length may not exceed CONFIG_PL2303_BULKIN_REQLEN, otherwise buffer overflow will occur

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-10-03 08:55:13 +08:00
Jukka Laitinen
18526d78eb drivers/usbdev/cdcacm.c: Set reqlen properly according to ep->maxpacket and CONFIG_CDCACM_BULKIN/OUT_REQLEN
The request length may not exceed CONFIG_CDCACM_BULKIN_ lenghts, otherwise buffer overflow will occur

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-10-03 08:55:13 +08:00
zhaohaiyang1
534114395e char driver CAN: add tx_confirm function in upperCAN driver.
add tx_confirm function in upperCAN driver1

Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
2024-10-02 21:22:07 +08:00
Neo Xu
b6d2dc6c54 lcd/st7735: add option to invert display color
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-02 20:52:55 +08:00
zhaohaiyang1
2ebfdf737c add the ability that control CAN transceiver state.
add the ability that control CAN transceiver state in nuttx.

Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
2024-10-01 21:48:50 +08:00
zhaohaiyang1
32b25849fe chardriver upperCAN: support to independent set TX/RX FIFO size.
support to independent set TX/RX FIFO size.

Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
2024-10-01 20:38:31 +08:00
xuxingliang
7044b10c88 task: use get_task_name where possible
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-01 20:38:06 +08:00
Xiang Xiao
73f0c7c51d drivers/mmcsd: Rename mmcsd_read_csd to mmcsd_read_extcsd
since it really read extcsd register not csd register
and remove the temp buffer inside it.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-09-30 21:17:27 +08:00
yangsong8
09030b5d67 cdcacm: config to enable or disable interrupt endpoint
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-09-30 20:32:47 +08:00
buxiasen
731af5b42f drivers/pm: pm_smp remove sched_lock
all os-api those have post/wait feature will not allowed in pm_callbacks
and pm_handler, until we support by cpu/tcb sched_lock and add
sched_lock/unlock back here. Then should revert this commit.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-30 20:23:11 +08:00
buxiasen
46d555e5d4 pm_idle: fix when prepare failed, possible relax error
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-30 20:23:11 +08:00
buxiasen
43176bbade pm: pm_idle add support for SMP
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-30 20:23:11 +08:00
Jukka Laitinen
6f7477ab63 drivers/timers/arch_alarm.c: Clean-up oneshot_callback for non-tickless build
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-09-30 19:23:01 +08:00
xuxingliang
1ec3623b6b serial: add message for FORCE_PANIC
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-09-30 18:21:05 +08:00
dongjiuzhu1
58d233cb42 drivers/sensors/gnss: check invalid nmea statement to avoid parsebuffer overflow
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-30 17:00:23 +08:00
dongjiuzhu1
9599302f10 drivers/sensors/gnss: using new buffer lock avoid deadlock
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-30 17:00:23 +08:00
dongjiuzhu1
58fbe31c28 drivers/sensors/gnss: notify user when new data ready
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-30 17:00:23 +08:00
liaoao
e8f9ef022f reset: fix build warning when CONFIG_RESET_RPMSG is not set
Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-30 16:43:02 +08:00
Xiang Xiao
8aa42eba20 can: Add more critical section to fix the race condition.
since routines called by IRQ need to be protected in SMP too.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-09-30 16:29:00 +08:00
yangsong8
6290e70212 cdcacm: remove the duplicate code with serial
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-09-30 16:27:21 +08:00
yangsong8
6c71276359 cdcacm: support polling mode in order to work normally in interrupt
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-09-30 16:27:21 +08:00
yangsong8
6161b1ea84 cdcacm: use DMA to rx and tx
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-09-30 16:27:21 +08:00
yangsong8
e3fcabaec2 cdcacm: use serial public APIs
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-09-30 16:27:21 +08:00
yangsong8
b319c27f03 serial: Added APIs for receiving and sending multiple chars
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-09-30 16:27:21 +08:00
zhangkai25
323b6bdea9 Check if the lower half is initialized for af_channel and af_data
Signed-off-by: zhangkai25 <zhangkai25@xiaomi.com>
2024-09-30 15:46:58 +08:00
zhangkai25
e73c32b848 Fix the situation where af_channel is still being read after it is released
Signed-off-by: zhangkai25 <zhangkai25@xiaomi.com>
2024-09-30 15:46:58 +08:00
zhangkai25
bf50899637 Allocate fifosize on demand to optimize memory
Signed-off-by: zhangkai25 <zhangkai25@xiaomi.com>
2024-09-30 15:46:58 +08:00
yezhonghui
85591fc360 pci alloc mis irq support new interface
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2024-09-30 15:41:28 +08:00
dongjiuzhu1
aa03182bab drivers/usbdev/: don't send setconfig response for xxxx_setup with composite
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-30 14:06:35 +08:00
dulibo1
f1fc53d7da gpio:add feature for gpio wakeup
1.add pin type to cfg gpio as wake up source
2.add IOEXPANDER_OPTION_WAKEUPCFG for set wake up option

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-30 08:45:37 +08:00
yezhonghui
6b3f51986d pci ep support msi/msi-x test
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2024-09-29 22:50:59 +02:00
yintao
f45eaa608d rpmsgdev: devpath may exceed RPMSG_NAME_SIZE
Signed-off-by: yintao <yintao@xiaomi.com>
2024-09-28 19:09:54 +08:00
dongjiuzhu1
190fdd18e2 misc/rpmsgdev: get battery info by rpmsgdev
read battery info register by other core

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 19:09:54 +08:00
dongjiuzhu1
22c4a82fa3 rpmsgdev:add support FIOC_FILEPATH for rpmsgdev_ioctl
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 19:09:54 +08:00
chenxiaoyi
065046b2a2 serial: use hostfs read/write on stdio as uart
This is used to implement serial console on instruction set simulator (ISS).

Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2024-09-28 13:53:06 +08:00
dongjiuzhu1
0fb1dc2b93 drivers/pipes: using rmutex to protect pipe and avoid deadlock
nxsem_wait
nuttx/sched/semaphore/sem_wait.c:176
nxmutex_lock
nuttx/libs/libc/misc/lib_mutex.c:204 (discriminator 2)
pipecommon_write
nuttx/drivers/pipes/pipe_common.c:538 (discriminator 2)
file_write
nuttx/fs/vfs/fs_write.c:91
write
nuttx/include/unistd.h:523 (discriminator 2)
nxsig_deliver
nuttx/sched/signal/sig_deliver.c:170 (discriminator 4)
arm_sigdeliver
nuttx/arch/arm/src/armv7-a/arm_sigdeliver.c:107
irq_waitlock
nuttx/sched/irq/irq_csection.c:204
nxsem_post
nuttx/sched/semaphore/sem_post.c:86 (discriminator 2)
nxmutex_unlock
nuttx/libs/libc/misc/lib_mutex.c:339 (discriminator 2)
pipecommon_poll
nuttx/drivers/pipes/pipe_common.c:769
file_poll
nuttx/fs/vfs/fs_poll.c:321
poll_fdsetup
nuttx/fs/vfs/fs_poll.c:194
poll
nuttx/include/sys/poll.h:164
uv_run
apps/system/libuv/libuv/src/unix/core.c:449
adb_hal_run
apps/system/adb/microADB/hal/hal_uv.c:76
adbd_main
apps/system/adb/adb_main.c:157
nxtask_startup
nuttx/libs/libc/sched/task_startup.c:70 (discriminator 2)
nxtask_start
nuttx/sched/task/task_start.c:134

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 13:50:21 +08:00
yezhonghui
786dabfb13 QemuEPC multi function verify for pci
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2024-09-28 13:39:50 +08:00
yezhonghui
db19d00e64 QemuEPC support multi function for pci device
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2024-09-28 13:39:50 +08:00
lipengfei28
39ec3291ee armv7a pci irq support
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-28 13:34:33 +08:00
Bowen Wang
6d4cab62fd pci/pci_ecam: add read_io/write_io for pci ecam
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-28 13:34:33 +08:00
yezhonghui
f6db814804 pci: add pci endpoint test driver
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2024-09-28 13:13:37 +08:00
yangguangcai
9a84484df5 capture:add multiple register.
Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2024-09-28 13:11:52 +08:00
yangguangcai
fd47add2a3 capture:add CAPIOC_ALL for ioctl.
When monitoring multiple capture channels, the `ioctl` function
is called three times, leading to significant overhead mainly due
to VFS and `nxmutex_lock/unlock`. Adding a new interface can save
the overhead of two `ioctl` calls.

Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2024-09-28 13:11:52 +08:00
Bowen Wang
23a4a23397 devicetree/fdt_pci: implement the fdt_pci_ecam_register()
So the borad level do not need implement the
pci_ecam_register_from_fdt() again and again.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-28 11:51:33 +08:00
nuttxs
c0403ed768 1.xtensa/esp32s3: configure the number of universal management
(IEEE) MAC addresses when there are multipleinterfaces.
2.Optimize Lan9250 to adapt to ESP32S3 universalMAC address.
2024-09-28 11:47:24 +08:00
dongjiuzhu1
b5713fd7f4 drivers/sensor: remove frequent logs
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 11:39:54 +08:00
dongjiuzhu1
d88e0eac02 drivers/sensors: Fixed the overflow problem of uint32_t subtracting large from small.
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-28 11:39:54 +08:00
dongjiuzhu1
a5729a81e3 driver/sensors: add flags O_DIRECT to watch sensor state to avoid rpmsg work
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 11:39:54 +08:00
dongjiuzhu1
05f5517f4f drivers/sensors: clear pollpri events after get events
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 11:39:54 +08:00
dongjiuzhu1
49b650e9db drivers/sensors: avoid using sre lock between rptun thread and hpwrok
When the system cannot obtain buffers for a long time, hpwork will hold
a lot of buffers. However, due to a deadlock between the rptun thread
and hpwork, hpwork cannot send the buffers in time, causing the system
to crash.

so, avoid hold sre lock in rptun thread.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 11:39:54 +08:00
dongjiuzhu1
6b6666ee50 drivers/sensors: update nbuffer after initialization
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 11:39:54 +08:00
yintao
ef9a02f51c sensors/sensor_rpmsg.c: fix list_delete node is NULL
if remote not set CONFIG_SENSOR_RPMSG, local can't receive NS_ACK
so sensor_rpmsg_device_ns_bound won't be called, not add sre->node
when local stop remote, rpmsg_deinit_vdev will call sensor_rpmsg_ns_unbind_cb
if (ept && ept->ns_unbind_cb)
	ept->ns_unbind_cb(ept);
list_delete node is NULL at sensor_rpmsg_ns_unbind_cb

Signed-off-by: yintao <yintao@xiaomi.com>
2024-09-28 11:39:54 +08:00
dongjiuzhu1
d72d9049e9 drivers/sensors: fix minor issue about sensor driver
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 11:39:54 +08:00
dongjiuzhu1
7a8d58bf1b drivers/sensors: release rpmsg resource when register_driver failed
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 11:39:54 +08:00
dongjiuzhu1
fcf2eb8fcb drivers/sesnros: fix crash because ipc buffer pointer used after free
When the ipc buffer is obtained for the first time due to insufficient space,
it waits due to insufficient ipc buffer.
At this time, if rptun recursively operates the next ipc request, the ipc buffer
will be reused, but it has been released at this time.

0  file_read (filep=filep@entry=0x20596738, buf=buf@entry=0x205d4358, nbytes=1560) at vfs/fs_read.c:86
1  sensor_rpmsg_push_event_one (dev=0x20558f70, dev@entry=0x2058fc80, stub=stub@entry=0x20596720) at sensors/sensor_rpmsg.c:799
2  sensor_rpmsg_alloc_stub (dev=dev@entry=0x2058fc80, ept=ept@entry=0x20558f08, cookie=<optimized out>) at sensors/sensor_rpmsg.c:552
3  sensor_rpmsg_sub_handler (ept=0x20558f08, data=0x204849c0, len=51, src=<optimized out>, priv=0x20558f00) at sensors/sensor_rpmsg.c:993
4  sensor_rpmsg_ept_cb (ept=<optimized out>, data=<optimized out>, len=<optimized out>, src=<optimized out>, priv=0x20558f00) at sensors/sensor_rpmsg.c:1186
5  rpmsg_virtio_rx_callback (vq=<optimized out>) at open-amp/lib/rpmsg/rpmsg_virtio.c:605
6  virtqueue_notification (vq=<optimized out>) at open-amp/lib/virtio/virtqueue.c:711
7  rproc_virtio_notified (vdev=vdev@entry=0x20558c98, notifyid=notifyid@entry=4294967295) at open-amp/lib/remoteproc/remoteproc_virtio.c:433
8  remoteproc_get_notification (rproc=rproc@entry=0x2054ff34, notifyid=notifyid@entry=4294967295) at open-amp/lib/remoteproc/remoteproc.c:1002
9  rptun_worker (arg=0x2054ff30) at rptun/rptun.c:339
10 rptun_notify_wait (rproc=<optimized out>, id=<optimized out>) at rptun/rptun.c:543
11 remoteproc_virtio_notify_wait (priv=<optimized out>, id=<optimized out>) at open-amp/lib/remoteproc/remoteproc.c:907
12 rproc_virtio_notify_wait (vdev=<optimized out>, vq=<optimized out>) at open-amp/lib/remoteproc/remoteproc_virtio.c:176
13 rpmsg_virtio_notify_wait (vq=<optimized out>, rvdev=0x2054ff78) at nuttx/include/openamp/rpmsg_virtio.h:162
14 rpmsg_virtio_get_tx_payload_buffer (rdev=0x2054ff78, len=0x20558f90, wait=<optimized out>) at open-amp/lib/rpmsg/rpmsg_virtio.c:404
15 rpmsg_get_tx_payload_buffer (ept=ept@entry=0x20558f08, len=len@entry=0x20558f90, wait=wait@entry=1) at open-amp/lib/rpmsg/rpmsg.c:207
16 sensor_rpmsg_push_event_one (dev=0x0, dev@entry=0x20590d60, stub=stub@entry=0x20596720) at sensors/sensor_rpmsg.c:783
17 sensor_rpmsg_alloc_stub (dev=dev@entry=0x20590d60, ept=ept@entry=0x20558f08, cookie=<optimized out>) at sensors/sensor_rpmsg.c:552
18 sensor_rpmsg_sub_handler (ept=0x20558f08, data=0x20483700, len=49, src=<optimized out>, priv=0x20558f00) at sensors/sensor_rpmsg.c:993
19 sensor_rpmsg_ept_cb (ept=<optimized out>, data=<optimized out>, len=<optimized out>, src=<optimized out>, priv=0x20558f00) at sensors/sensor_rpmsg.c:1186
20 rpmsg_virtio_rx_callback (vq=<optimized out>) at open-amp/lib/rpmsg/rpmsg_virtio.c:605
21 virtqueue_notification (vq=<optimized out>) at open-amp/lib/virtio/virtqueue.c:711
22 rproc_virtio_notified (vdev=vdev@entry=0x20558c98, notifyid=notifyid@entry=4294967295) at open-amp/lib/remoteproc/remoteproc_virtio.c:433
23 remoteproc_get_notification (rproc=0x2054ff34, rproc, notifyid=notifyid@entry=4294967295)
24 rptun_worker (arg=0x2054ff30) at rptun/rptun.c:339
25 rptun_thread (argc=<optimized out>, argv=<optimized out>) at rptun/rptun.c:375

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 11:39:54 +08:00
liangdongdong
5238f2c200 feature: charge: Add battery operate
Signed-off-by: liangdongdong<liangdongdong@xiaomi.com>
2024-09-28 11:25:17 +08:00
dulibo1
5a796dfbff power: fix BQ27426 driver compile error
power/battery/bq27426.c:331:17: error: ‘BATTERY_UNKNOWN’ undeclared (first use in this function)
  331 |       *status = BATTERY_UNKNOWN;
      |                 ^~~~~~~~~~~~~~~
power/battery/bq27426.c:331:17: note: each undeclared identifier is reported only once for each function it appears in
Makefile:108: recipe for target 'bq27426.o' failed

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-28 11:25:17 +08:00
dulibo1
797df22802 power:add default protocol for the driver which not impl get_protocol
add default protocol for the driver which not impl get_protocol

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-28 11:25:17 +08:00
dulibo1
b29d103ad3 ramlog:flush should reset the tail of the reader
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-28 11:08:39 +08:00
dulibo1
c055fc2f85 noteram:read noteram may cause crash
noteram_get may cause _read = ni_bufsize cause assert crash

[ 1493.627200] [79] [ EMERG] [ap] _assert: Assertion failed : at file: note/noteram_driver.c:370 task: trace process: trace 0x446f238a
[ 1493.627400] [79] [ EMERG] [ap] backtrace:
[ 1493.627500] [79] [ EMERG] [ap] [79] [<0xf7933c9d>] _fini+0xae0720b9/0xb673e41b
[ 1493.628400] [79] [ EMERG] [ap] [79] [<0x498b1b0c>] host_backtrace+0x42/0x72
[ 1493.629300] [79] [ EMERG] [ap] [79] [<0x48bef3d1>] up_backtrace+0x127/0x2d2
[ 1493.630200] [79] [ EMERG] [ap] [79] [<0x48b86bed>] sched_backtrace+0x71/0x8a
[ 1493.631100] [79] [ EMERG] [ap] [79] [<0x44676273>] sched_dumpstack+0xed/0x486
[ 1493.631600] [79] [ EMERG] [ap] [79] [<0x445c61ff>] _assert+0x9f0/0xb38
[ 1493.632200] [79] [ EMERG] [ap] [79] [<0x4420dd07>] __assert+0x3f/0x4c
[ 1493.632800] [79] [ EMERG] [ap] [79] [<0x44151648>] noteram_get+0x1b0/0x5fe
[ 1493.633600] [79] [ EMERG] [ap] [79] [<0x44152370>] noteram_read+0x331/0x4f7
[ 1493.634200] [79] [ EMERG] [ap] [79] [<0x444c66f9>] file_read+0x38b/0x3c0
[ 1493.634700] [79] [ EMERG] [ap] [79] [<0x444c6840>] nx_read+0x112/0x170
[ 1493.635300] [79] [ EMERG] [ap] [79] [<0x444c68e5>] NXread+0x47/0xfa
[ 1493.635800] [79] [ EMERG] [ap] [79] [<0x446f2c70>] trace_dump+0x148/0x2f4
[ 1493.636400] [79] [ EMERG] [ap] [79] [<0x446f110b>] trace_cmd_dump+0x41b/0x4b9
[ 1493.636900] [79] [ EMERG] [ap] [79] [<0x446f2723>] trace_main+0x399/0x6e2
[ 1493.637500] [79] [ EMERG] [ap] [79] [<0x44217fc9>] nxtask_startup+0x69/0x7c
[ 1493.638000] [79] [ EMERG] [ap] [79] [<0x440f9b78>] nxtask_start+0x8a5/0x8b8

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-28 11:08:39 +08:00
yinshengkai
d888df9673 note: add ringbuffer aligned access handle
Fix ubsan warning that writes need to be aligned to memory boundaries when writing data

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-28 11:08:39 +08:00
dulibo1
98482d429b noteram:overflow may discard all the trace message
noteram_add may cause head = tail when remain == NOTE_ALIGN(notelen)
log:
nsh_main-14  [0]   2.132127493: tracing_mark_write: B|14|trace dump -c

nsh_main-14  [0]   2.143322780: tracing_mark_write: E|14|trace dump -c

nsh_main-14  [0]   2.513023895: tracing_mark_write: B|14|trace dump -c

nsh_main-14  [0]   2.524060048: tracing_mark_write: E|14|trace dump -c

nsh_main-14  [0]   2.897055341: tracing_mark_write: B|14|trace dump -c

ap> trace dump -c
nsh_main-14  [0]   3.270037241: tracing_mark_write: B|14|trace dump -c

ap> trace dump -c

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-28 11:08:39 +08:00
dulibo1
b4b07ce6bd PM:use CONFIG_SERIAL_PM_ACTIVITY_PRIORITY == 0 disable pm_activity which need by bl616
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-28 11:03:48 +08:00
dulibo1
5a57aa0af8 pm:CMakeLists update for pm runtime
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-28 11:03:48 +08:00
dulibo1
347154c01e clk:optimized the clk_set_rate for mux
clk_mux_determine_rate->clk_get_parent_by_index

this path consume time too much

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-28 10:38:55 +08:00
dulibo1
a6cf57dbac clk:change lock to recursive lock
case:
clk_set_rate ->
clk->ops->round_rate ->
divider_round_rate ->
clk_divider_bestdiv->
clk_round_rate

this path casue  recursive clk_list_lock

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-28 10:38:55 +08:00
dulibo1
d5fdeffd06 clk:add critical protection for api
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-28 10:38:55 +08:00
dulibo1
15833a3cbd regualtor: use regulator_enable in idle task may casue assert
if regulator_get the supply which call kmm_zalloc

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-28 10:38:55 +08:00
dulibo1
f53ae757b8 regualtor:adjust the critical area protected
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-28 10:38:55 +08:00
Bowen Wang
e706805c8b drivers/pci: one pci device should only associate with one driver
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-27 17:12:09 +08:00
Bowen Wang
d6f4d0a20a drivers/pci: change all devfn type to unsigned int
Now all the type of devfn in pci framework are unsigned int

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-27 17:12:09 +08:00
Yongrong Wang
2756045b07 pci.c: fix compile warning
pci/pci.c:1128:15: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
 1128 |       pciinfo("Limit MME to %x, num to %d\n", mmc, num);
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~
      |                                               |
      |                                               uint32_t {aka long unsigned int}
pci/pci.c:1128:30: note: format string is defined here
 1128 |       pciinfo("Limit MME to %x, num to %d\n", mmc, num);
      |                             ~^
      |                              |
      |                              unsigned int
      |                             %lx

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-09-27 17:12:09 +08:00
p-szafonimateusz
860bd3ad6f drivers/pci_qemu_test.c: fix compiler warning
pci/pci_qemu_test.c:218:6: warning: ‘ops’ may be used uninitialized [-Wmaybe-uninitialized]
  218 |   ops->write(dev->bus, &hdr->test, num, sizeof(num));
      |   ~~~^~~~~~~
pci/pci_qemu_test.c: In function ‘pci_qemu_test_probe’:
pci/pci_qemu_test.c:286:41: note: ‘ops’ was declared here
  286 |   FAR const struct pci_qemu_test_ops_s *ops;
      |

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-27 17:12:09 +08:00
wangyongrong
e4be747cf5 pci.c: fix pci 32bit warning
pci/pci.c:863:66: warning: right shift count >= width of type [-Wshift-count-overflow]
  863 |       pci_write_config_dword(dev, msi + PCI_MSI_ADDRESS_HI, (mar >> 32));

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-09-27 17:12:09 +08:00
Bowen Wang
0f3feefa85 drivers/pci/pci.c: fix warning when CONFIG_PCI_ASSIGN_ALL_BUSES=n
pci/pci.c:415:34: warning: variable ‘res’ set but not used [-Wunused-but-set-variable]
  415 |       FAR struct pci_resource_s *res;
      |                                  ^~~
pci/pci.c: In function ‘pci_scan_bus’:
pci/pci.c:663:32: warning: unused variable ‘ctrl’ [-Wunused-variable]
  663 |   FAR struct pci_controller_s *ctrl = bus->ctrl;

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-27 17:12:09 +08:00
zhangkai25
8829f38bee Initialize af_channel to ensure no out-of-bounds situations occur
Signed-off-by: zhangkai25 <zhangkai25@xiaomi.com>
2024-09-27 14:42:45 +08:00
zhangkai25
63249f71d1 memcpy data directly without channel at msglen is 4
Signed-off-by: zhangkai25 <zhangkai25@xiaomi.com>
2024-09-27 14:42:45 +08:00
zhangkai25
bfd6185f4a add adc_receive_all just for adc_dma
Description: No longer transmitting data to fifo in a loop, complete transmission in one go

Signed-off-by: zhangkai25 <zhangkai25@xiaomi.com>
2024-09-27 14:42:45 +08:00
Bowen Wang
fd182dad64 drivers/pci: add error handle for pci_alloc_bus/device()
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-27 14:12:11 +08:00
wangyongrong
e8f6b1e695 pci.c: fix judge err in pci_connect_irq
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-09-27 14:12:11 +08:00
wangyongrong
6cec175c9d pci.c:fix ops not implement after calling panic err
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-09-27 14:12:11 +08:00
likun17
329d121d50 sensor: Added 6dof motion and gesture related types.
For details, see: https://developer.android.com/reference/android/hardware/SensorEvent#values

Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-27 13:59:41 +08:00
dongjiuzhu1
899eeb3c35 nuttx/uorb.h: align sensor_type value with aosp
refs:0e67aa0cae:include_all/hardware/sensors-base.h

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-27 13:59:41 +08:00
lipengfei28
8e3c024bdb msi_set:Message Control Register for MSI:bit3:bit1 used for
Multiple Message Capable

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-27 10:37:31 +08:00
lipengfei28
9d425eb521 pci epc mem use virtual mem
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-27 10:37:31 +08:00
lipengfei28
aa3568f353 pci epf use epc_node link to epc
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-27 10:37:31 +08:00
lipengfei28
06a5103838 pci_epf_device_s and pci_epc_ctrl_s add priv data
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-27 10:37:31 +08:00
wanggang26
ce1d047845 mmcsd: fix cmd6 timeout error when repeat calling
If CMD6 is sent again before last transmission is complete, a timeout
error will be encountered.

Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-09-27 10:25:51 +08:00
Xiang Xiao
e105773f7e can: Merge cd_error and rx_overflow into rx_error
so the error could dispath to each client without interference

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-09-27 09:01:06 +08:00
lipengfei28
c552d39d41 qemu epc add misx support
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-27 08:52:59 +08:00
lipengfei28
57d736b149 add epf test drv
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-27 08:52:59 +08:00
lipengfei28
c4e1c7334f get_msi:should return Message Control Register:bit6:bit4
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-27 08:52:59 +08:00
lipengfei28
2a7cf549a1 pci: add qemu epc
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-27 08:52:59 +08:00
wangjianyu3
521b3bb500 drivers/bch: ioctl() - BIOC_FLUSH: Add calling ioctl() of block driver
Passing `BIOC_FLUSH` to block driver to ensure that changes transfers ("flushes") to the block device

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-27 00:12:43 +08:00
lipengfei28
56f57e5f9b add pci irq interface
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-27 00:10:19 +08:00
lipengfei28
1eb151bef6 add pci_bus_map_region and pci_map_region macro
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-26 16:23:18 +08:00
wangyongrong
3b09de844f pci.h: add pci_map_bar_region support
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-09-26 16:23:18 +08:00
chao an
a04e44ea75 syslog/channel: move syslog channel map into rodata
add SYSLOG_REGISTER to support disable syslog channel register

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-26 16:10:29 +08:00
chao an
9abe737ef3 syslog/channel: add constant attribute if SYSLOG_IOCTL is not enabled
move all private channel define from data to rodata

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-26 16:10:29 +08:00
chao an
4195851845 drivers/rpmsg: replace metal_list_for_each to safety version
replace metal_list_for_each to safety version to avoid invalid access to deleted node in destory flow

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-26 08:36:14 +08:00
mazhuang
4fa1c460d3 rptun/rptun_ivshmem:add restart cmd to reboot slave
Master can send restart command to slave to reboot the slave core

Signed-off-by: mazhuang <mazhuang@xiaomi.com>
Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-09-26 00:04:05 +08:00
xuxingliang
75b87a85dd rptun: fix memleak on failure
Leak backtrace:
    1 14 2096 9886 0x4318d768 [0x040320744] <romfs_fileconfigure+184> romfs/fs_romfsutil.c:1039
                                                 [0x04031fd3e] <romfs_open+378> romfs/fs_romfs.c:281
                                                 [0x04027fa9e] <file_open+446> vfs/fs_open.c:244
                                                 [0x0402ab986] <rptun_store_open+26> rptun/rptun.c:955
                                                 [0x04034cc88] <remoteproc_load+120> open-amp/lib/remoteproc/remoteproc.c:452
                                                 [0x0402ac8ac] <rptun_dev_start+176> rptun/rptun.c:748
                                                 [0x0402ad038] <rptun_ioctl+416> rptun/rptun.c:618

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-09-26 00:04:05 +08:00
Bowen Wang
dbe43b0ae9 rptun: move rptun cmd definition before the resource table
Because locate the command at the end the resource table is unfriendly
when we want to support multi virtio devices instead only one virtio
rpmsg device.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-26 00:04:05 +08:00
Yongrong Wang
10e8b6c9f6 rptun/rpmsg_virtio: remove chip cmd and reuse the common ones
Add more common command for rptun and rpmsg_virtio frameworks,
also modify the rptun and rpmsg_virtio driver to use the common
commands.

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-09-26 00:04:05 +08:00
Yongrong Wang
7c7d08d13a rptun.c/rpmsg_virtio.c: move panic logic from chip to rptun/rpmsg_virtio
Move the panic logic in common places, later we can move more logic to
the framework instead of having the drivers implement it repeatedly.

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-26 00:04:05 +08:00
wangyongrong
42ce76c6bf rptun_ivshmem.c: Replace work queue with wdog
wdog has better performance than work queue

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-09-26 00:04:05 +08:00
Bowen Wang
b5ebb8c06d drivers/rptun/rptun.c: move headrx out of CONFIG_RPTUN_PM
headrx is very convient to check weather current core miss interrupt
by comparing the headrx with the rx vring avail.idx for slave side or
rx vring used.idx for master side.

So move headrx out of the CONFIG_RPTUN_PM range.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-26 00:04:05 +08:00
Bowen Wang
1a97fa73f0 rptun: rptun pm and rptun dump support cacheable memory
Should invalidate the memory when the data is located in shared
memory and write by remote core.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-26 00:04:05 +08:00
Xiang Xiao
3ea02c5992 rptun: Rename rptun_panic_ to rptun_panic
The function name rptun_panic_ is not consistent with other functions

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-09-26 00:04:05 +08:00
ligd
46713eaf16 rptun: add timeout to wait_tx_buffer callback
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-26 00:04:05 +08:00
Bowen Wang
46e5e576e1 rptun/rptun_dump: remove unused rptun_dump.c
rptun_dump related code has been moved to rptun.c from rptun_dump.c,
but file rptun_dump.c is not deleted in PR:
https://github.com/apache/nuttx/pull/11712

So delete this file.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-26 00:04:05 +08:00
Bowen Wang
d320dfd20f rptun: BUG fix, should not destory the semaphore twice
This BUG is introduced in PR: https://github.com/apache/nuttx/pull/13172

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-26 00:04:05 +08:00
ligd
c76dfde744 rptun: use detail name for pm wakelock
So we can distinguish the pm wakelock

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-26 00:04:05 +08:00
Bowen Wang
7243616402 drivers/rptun: flush the image memory when read from the file system
Flush the image memory to make sure the remote core access the correct
image.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-26 00:04:05 +08:00
ligd
7f3dce5bbb rptun: add RPTUN_PM_AUTORELAX method.
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-26 00:04:05 +08:00
ligd
f569c065f6 rptun/pm: use pm_wakelock
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-26 00:04:05 +08:00
ligd
3468f5cec8 rptun/pm: add check to rptun_pm_callback() incase of start early
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-26 00:04:05 +08:00
ligd
0ce6bd546d rptun: use local rx virtqueue idx to resolve remote low power
Store the rx virtqueue idx to the local headrx index, and only
process the data when the rx virtqueue has data to avoid access
the ram in low power mode.

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-26 00:04:05 +08:00
yanghuatao
520bb6544e nuttx/dirvers: Add secure rptun file
rptun secure is a rptun driver used for the rpmsg communication
between (Non-Secure) REE and (Secure) TEE environments.

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-26 00:04:05 +08:00
Jukka Laitinen
5238c3bb25 drivers/mmcsd/mmcsd_sdio.c: Fix setting SDIO_WIDEBUS for SD cards
This corrects the setting widebus for SD cards, which was recently broken in 4f7f751d2a.

The if checking the priv->caps, priv->buswidth and IS_MMC has been wrong for
some time. The proper logic is that for MMC only the priv->caps is checked.
For SD card, both priv->caps and priv->buswidth need to be checked.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-09-25 21:10:26 +08:00
wangjianyu3
73b7128fb6 drivers/rpmsg: Fix a typo error of rpmsg_device_destory()
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-25 01:51:18 +08:00
wangjianyu3
b8029d28a3 drivers/rpmsg: Using safe list iterating in rpmsg_device_created()
To fix list access after delete error

Test:
  /* Export */
  rpmsgdev_export("SERVER", "/dev/DEVNAME");

  /* Register */
  rpmsgdev_register("CLIENT", "/dev/DEVNAME", "/dev/server-DEVNAME", 0);

Log:
  [ap] kasan_report: kasan detected a read access error, address at 0x40b7ae78,size is 8, return address: 0x402a3c50
  [ap] kasan_show_memory: Shadow bytes around the buggy address:
  [ap] kasan_show_memory:   0x40b7ae20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  [ap] kasan_show_memory:   0x40b7ae30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  [ap] kasan_show_memory:   0x40b7ae40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  [ap] kasan_show_memory:   0x40b7ae50: 20 af b7 40 00 00 00 00 c0 17 2a 40 00 00 00 00
  [ap] kasan_show_memory:   0x40b7ae60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  [ap] kasan_show_memory:   0x40b7ae70: 00 00 00 00 00 00 00 00[b0 f7 b3 40 00 00 00 00]
  [ap] kasan_show_memory:   0x40b7ae80: c8 48 b8 40 00 00 00 00 00 00 00 00 00 00 00 00
  [ap] kasan_show_memory:   0x40b7ae90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  [ap] kasan_show_memory:   0x40b7aea0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  [ap] kasan_show_memory:   0x40b7aeb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

  $ addr2line -fe nuttx/nuttx 0x402a3c50
  rpmsg_device_created
  /workspace/nuttx/drivers/rpmsg/rpmsg.c:395 (discriminator 2)

Reported by rongyichang@xiaomi.com

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-25 01:51:18 +08:00
dongjiuzhu1
4960f290c8 drivers/i3c: avoid return error when i3c_master_register without i3c/i2c device
1. if i3c_mater_register without i3c/i2c device, rstdaa/clearevents/do_daa could be failed
2. board code/driver code need to actively i3c_master_do_daa when device power on.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-24 23:36:50 +08:00
dongjiuzhu1
694750e8af drivers/i3c: remove extra i3c_dev_register, do_daa has created them
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-24 23:36:50 +08:00
yangshuyong
cffcccafc2 driver/i3c: Fixed i3c pointer format to check null
Signed-off-by: yangshuyong <yangshuyong@xiaomi.com>
2024-09-24 23:36:50 +08:00
yangshuyong
7a48469e70 I3C: fixed the return value error in send ccc cmd api
Signed-off-by: yangshuyong <yangshuyong@xiaomi.com>
2024-09-24 23:36:50 +08:00
yangshuyong
9d566d4a9d I3C: fixed the send ccc cmd check condition error
Only affect the send ccc cmd in 3th driver

Signed-off-by: yangshuyong <yangshuyong@xiaomi.com>
2024-09-24 23:36:50 +08:00
yangshuyong
9790c3d316 Added the common interface sending ccc cmd in I3C driver
Signed-off-by: yangshuyong <yangshuyong@xiaomi.com>
2024-09-24 23:36:50 +08:00
dongjiuzhu1
5b48dea4f5 drivers/i3c: support i3c driver model
Reference to: https://github.com/torvalds/linux/tree/master/drivers/i3c

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-24 23:36:50 +08:00
SPRESENSE
1e103bd41f drivers/modem/alt1250: Fix issue where the program would get stuck
Fix issue where the program would get stuck
if an unsupported ALTCOM packet was sent.
2024-09-24 20:00:21 +08:00
chao an
a5251161c6 syslog/channel: rename syslog_channel() to syslog_channel_register()
Change syslog API naming more reasonable:

1. rename syslog_channel() to syslog_channel_register()
2. rename syslog_channel_remove() to syslog_channel_unregister()

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-24 19:28:49 +08:00
wangjianyu3
a5b85fcd96 misc/rpmsgdev: Fix invalid pointer error when there are more than one remotes
Test: (see tests/testcases/rpmsgdev for details)
  # 1. Register dummy device
  testdev -d 0 -r "/dev/ttyGNSS0"
  # 2. Call rpmsgdev_export() to export the device to remote
  testdev -d 2 -c "droid" -l "/dev/ttyGNSS0"

Log:
  [ap] arm_busfault: PANIC!!! Bus Fault:
  [ap] arm_busfault:        IRQ: 5 regs: 0x3c434e44
  [ap] arm_busfault:        BASEPRI: 00000000 PRIMASK: 00000000 IPSR: 00000005 CONTROL: 00000004
  [ap] arm_busfault:        CFSR: 00008200 HFSR: 00000000 DFSR: 00000000 BFAR: 00000000 AFSR: 00040000
  [ap] arm_busfault: Bus Fault Reason:
  [ap] arm_busfault:        Precise data bus error
  [ap] dump_assert_info: Current Version: NuttX ****** ***** *** 12.3.0 ********** Sep 23 2024 18:35:50 arm
  [ap] dump_assert_info: Assertion failed panic: at file: armv8-m/arm_busfault.c:113 task: testdev process: testdev 0x2c86ca75

Backtrace:
  backtrace_unwind
  /workspace/nuttx/arch/arm/src/common/arm_backtrace_unwind.c:632
  sched_backtrace
  /workspace/nuttx/sched/sched/sched_backtrace.c:105
  sched_dumpstack
  /workspace/nuttx/libs/libc/sched/sched_dumpstack.c:69
  dump_running_task
  /workspace/nuttx/sched/misc/assert.c:629
  arm_busfault
  /workspace/nuttx/arch/arm/src/armv8-m/arm_busfault.c:113
  irq_dispatch
  /workspace/nuttx/sched/irq/irq_dispatch.c:142
  arm_doirq
  /workspace/nuttx/arch/arm/src/armv8-m/arm_doirq.c:95
  strcmp
  /workspace/nuttx/libs/libc/machine/arm/armv8-m/gnu/arch_strcmp.S:107
  rpmsgdev_server_created
  /workspace/nuttx/drivers/misc/rpmsgdev_server.c:520 (discriminator 1)
  rpmsg_register_callback
  /workspace/nuttx/drivers/rpmsg/rpmsg.c:245
  rpmsgdev_export
  /workspace/nuttx/drivers/misc/rpmsgdev_server.c:552
  _register_driver
  /workspace/tests/testcases/rpmsgdev/testdev.c:216
  nxtask_startup
  /workspace/nuttx/libs/libc/sched/task_startup.c:70
  nxtask_start
  /workspace/nuttx/sched/task/task_start.c:114

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 23:59:12 +02:00
yangshuyong
a537ecdd0f Support nuttx pci endpoint driver framework
Signed-off-by: yangshuyong <yangshuyong@xiaomi.com>
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-23 10:03:54 +02:00
lipengfei28
ca39dc2e74 math: Optimize the implementation of log2ceil and log2floor
and move common math funtions to math32.h:
div_round_up
div_round_closest
is_power_of_2
roundup_pow_of_two
rounddown_pow_of_two

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-23 10:03:54 +02:00
lipengfei28
b18262d78f bits:rename __set_bit to set_bit __clear_bit to clear_bit
This used for add pci ep drver framework

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-23 10:03:54 +02:00
chao an
db5320fd9f drivers/syslog: compile syslog_device.c if console/char/file channel enabled
Add conditional compilation to syslog_device.c

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-23 14:36:40 +08:00
chenrun1
4cec713dbf fs_inode:Change the type of i_crefs to atomic_int
Summary:
  1.Modified the i_crefs from int16_t to atomic_int
  2.Modified the i_crefs add, delete, read, and initialize interfaces to atomic operations
The purpose of this change is to avoid deadlock in cross-core scenarios, where A Core blocks B Core’s request for a write operation to A Core when A Core requests a read operation to B Core.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-09-23 14:07:03 +08:00
wangjianyu3
a73ee73c78 Thermal/dummy: Fix depends error
1. cpufreq.h not found if cpufreq is not supported on some branches.
./thermal/thermal_dummy.c:25:10: fatal error: nuttx/cpufreq.h: No such file or directory
   25 | #include <nuttx/cpufreq.h>
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.

2. debug.h is included by including <nuttx/cpufreq.h>, should not.
CC:  thermal/thermal_dummy.c thermal/thermal_dummy.c: In function ‘thermal_dummy_init’:
thermal/thermal_dummy.c:338:7: warning: implicit declaration of function ‘therr’ [-Wimplicit-function-declaration]
  338 |       therr("Register cooling device fan0 failed!\n");
      |

https://github.com/apache/nuttx/pull/12824
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3
efd7e31b3a Thermal/procfs: Remove unnecessary nxmutex_unlock
https://github.com/apache/nuttx/pull/12824
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3
88cc4b1120 Thermal/procfs: Disabled immediately after enabling.
When exec "echo 1 > /proc/thermal/cpu-thermal", procfs get "\n" after "1", treat as disable:
```
 #1  0x000000000040f452 in thermal_procfs_write (filep=0x7ffff3d241e8, buffer=0x7ffff3d344fc "\n", buflen=1) at thermal/thermal_procfs.c:179
```

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3
d5ffed635b Thermal/dummy: Get cpufreq_driver from cpufreq_policy.
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3
e8758eb974 Thermal/step_wise: Increase cooling state in case of "stable" trend and "hot" trip.
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3
68d5516c90 Thermal/dummy: Fix warning
```
CID 1159822: (#1 of 2): 宏将无符号值与 0 做了比较 (NO_EFFECT)
unsigned_compare: 不带符号值的此 greater-than-or-equal-to-zero 比较总是为 true。index >= 0U。
```
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3
515c3978dd Thermal: Check trip type in thermal_zone_device_register().
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3
f96d3798a1 Thermal: remove assert of thermal_zone_device_update()
Called by both of lpwork and Idle_Task:

[    0.000000] [ 0] [  INFO] [ap] thermal_zone_device_register: Registered zone device cpu-thermal
[    0.000000] [ 0] [ EMERG] [ap] _assert: Current Version: NuttX ap 0.0.0  Dec 11 2023 20:59:20 sim
[    0.000000] [ 0] [ EMERG] [ap] _assert: Assertion failed : at file: thermal/thermal_core.c:820 task: Idle_Task process: Kernel 0x32ade29

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3
d43f0272e5 Thermal: Add dummy driver
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3
b30f866f80 Thermal: Add procfs file nodes
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3
520e4042ce Thermal: Register pm suspend notifier
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3
2f285a04f9 Thermal: Support cpufreq cooling device
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3
338b5d7415 Thermal: Support step_wise governor
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00