Commit Graph

7170 Commits

Author SHA1 Message Date
Xiang Xiao 908cd1b10a misc/goldfish_pipe: Refine the implementation
1.Merge goldfish_pipe_qemu.h into goldfish_pipe.c
2.Change all enum to macro

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-09-15 19:28:55 +08:00
zhanghu5 2ce2844480 drivers/misc: support nuttx goldfish_pipe
Signed-off-by: zhanghu5 <zhanghu5@xiaomi.com>
2024-09-15 19:28:55 +08:00
dongjiuzhu1 1bad603fe7 drivers/gpio: save memory if dont support signal
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-15 11:29:55 +08:00
dongjiuzhu1 28815fb7c5 drivers/gpio: add poll function for gpio device
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-15 11:29:55 +08:00
wangjianyu3 f2ca3753dd rpmsgdev_server: Support exporting devices
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-15 10:18:08 +08:00
p-szafonimateusz 51909ed59f drivers: fix gcc14 errors for PCI
fix gcc14 errors for PCI

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-15 03:37:58 +08:00
p-szafonimateusz 8ab0785d71 drivers: add UART 16550 compatible PCI device support
add support for UART 16550 compatible PCI device.
For now we support qemu serial PCI devices and AX99100 based cards.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-15 03:37:58 +08:00
p-szafonimateusz ceb2921d79 drivers: prepare 16550 UART driver to support PCI
prepare 16550 UART driver to support PCI:

- [breaking change] change argument of uart_ioctl() from `struct file *filep` to `FAR struct u16550_s *priv`
  Also fix moxart_16550.c build related to this change

- [breaking change] change argument of uart_getreg() and uart_putreg from `uart_addrwidth_t base` to `FAR struct u16550_s *priv`
  Also fix arch/x86/src/qemu/qemu_serial.c and arch/x86_64/src/intel64/intel64_serial.c related to this change

- [breaking change] change argument of uart_dmachan() from `uart_addrwidth_t base` to `FAR struct u16550_s *priv`

- move `struct u16550_s` to public header

- generalize UART_XXX_OFFSET so we can use it with any register increment

- make u16550_bind(), u16550_interrupt(), u16550_interrupt() public

- remove arch/or1k/src/common/or1k_uart.c and use common 16550 MIMO interfacve

- change irq type in `struct u16550_s` from uint8_t to int to match MSI API

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-15 03:37:58 +08:00
Xiang Xiao 1d586c3bee pci: Add driver_data to pci_device_id_s
so driver writer could save the private data here
and get it back in the probe function.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-09-15 03:37:58 +08:00
wangyongrong 877e462990 vitrio-pci.c: add virtio-pci transport support for Nuttx
1. only support pci modern device;
2. need the pci controller support MSI/MSI-X;
It has been verified based on virtio-rng and virtio-net.

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-15 02:22:16 +08:00
ligd ff1b54bff3 pthread_cleanup: move clenup down to tls
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-14 20:15:12 +08:00
yintao 38af7001b6 drivers/rpmsg: fix the race condtion about rpmsg_device_created
xxx_rpmsg_device_created may be called repeatedly.

rptun thread				app thread

rptun_dev_start				xxx_rpmsg_init

...					rpmsg_register_callback
priv->...= rpmsg_ns_unbind;
priv->..= rptun_notify_wait;
					if (ns_unbind_cb)
(switch app thread)				device_created()
						xxx_rpmsg_device_created

					metal_list_add_tail(g_cb);
...
rpmsg_device_created();
	cb->device_created
	xxx_rpmsg_device_created;

Signed-off-by: yintao <yintao@xiaomi.com>
2024-09-14 17:34:52 +08:00
Yongrong Wang 67e41d0e32 rpmsg/rpmsg_virtio_ivshmem: add rpmsg virtio ivshmem support
rpmsg_virtio_ivshmem is a ivshmem based rpmsg virtio driver,
with this driver, we can use the rpmsg virtio in qemu platfrom

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-14 17:34:52 +08:00
Yongrong Wang af0bde8bca rpmsg virtio: add rpmsg virtio wrapper support
Rpmsg VirtIO is a virtio transport implementation for Rpmsg, and
it's different to the rptun framework.

rpmsg_virtio.c implements the rpmsg virtio transport layer by itself
to avoid use the remoteproc implementation in OpenAMP to save code
size, so it can be treated as a lightweight version of rptun.
Therefore, rpmsg_virtio.c only support the communication feature and
do not support contoll the life cycle of the remote core.
But benefit by it's small footprint, it can be used in the chips with
small flash.

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-14 17:34:52 +08:00
fangpeina 401a06fb17 input/ff: modify FF_MAX to support 64-bit machine
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2024-09-14 13:44:49 +08:00
ouyangxiangzhen dd88c7fcfa sys/mman: Add dummy implementations of shm_open and shm_unlink
This patch added dummy implementations of shm_open and shm_unlink.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-09-13 16:08:25 +08:00
ouyangxiangzhen 020dbe51e3 sched/pthread: Add dummy pthread_setaffinity_np
This patch added dummy pthread_setaffinity_np implementation if CONFIG_SMP is disabled.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-09-13 16:08:25 +08:00
ouyangxiangzhen 28d943b226 sys/resource: Add RLIMIT_RTPRIO and RLIMIT_RTTIME definition
This commit add the definition of RLIMIT_RTPRIO and RLIMIT_RTTIME.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-09-13 16:08:25 +08:00
liaoao 40e34b5b58 spi_slave: keep consistent with the parameter of the spi_slave_receive function declaration
Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-13 12:27:31 +08:00
p-szafonimateusz db6d0bd356 drivers/pci: add MSI/MSI-X support
Add support for MSI and MSI-X in PCI framework

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-13 09:42:08 +08:00
rongyichang 83c2a7f54e drivers/fb: add panbuffer clear ioctl
Some devices need to clear the fb panbuf when waking up from sleep
to avoid outputting residual buffers from before sleeping

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2024-09-13 09:15:38 +08:00
chao an 2b4ab6cd29 stream/syslograw: remove support for iob buffer in syslog
IOB buffer participates in the calculation of the congestion strategy
in the protocol stack, if the iob buffer is exhausted or there are
too many syslog printing tasks, the behavior of the protocol stack
and log printing will unable to determined, this PR will remove support
for iob buffer in syslog

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-13 09:14:56 +08:00
ouyangxiangzhen 0451ead2c5 fs/mmap: Ensure anonymous pages are initialized to zero
According to the mmap(2) specification, anonymous pages should be initialized to zero unless the MAP_UNINITIALIZED is specified.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-09-13 09:10:21 +08:00
ouyangxiangzhen 53c7612faf fs/mmap: Add MADV_HUGEPAGE definitions
This commit add MADV_HUGEPAGE and MADV_NOHUGEPAGE definitions for madvise. Notice that none of these flags have been implemented yet.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-09-13 09:10:04 +08:00
liaoao 6f770fb4b1 coresight: disable device before unregister
coresight_claim_device will fail when unregister device
which has been enabled. device should be the init state when
it is unregistered.

Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-13 09:09:19 +08:00
liaoao 8a57dafdcf coresight: add clk control for coresight system
Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-13 09:09:19 +08:00
liaoao df33c392ae coresight:add tmc device support
Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-13 09:09:19 +08:00
liaoao 79af05c4ae coresight:add etb device support
Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-13 09:09:19 +08:00
liaoao 71e4267a7a coresight: add etm3 device support
Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-13 09:09:19 +08:00
liaoao e3e23f7eaf coresight:add stm device
Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-13 09:09:19 +08:00
liaoao c0e40fc19f coresight:add tpiu device support
Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-13 09:09:19 +08:00
liaoao 5324f69b58 coresight:add link coresight device support
Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-13 09:09:19 +08:00
liaoao 8cc0c24318 coresight:add common api for coresight system
Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-13 09:09:19 +08:00
liaoao 24050ba59f coresight: add coresight_core
Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-13 09:09:19 +08:00
ligd 8b4b66ef73 clock: fix clock_timespec_subtract() error when use TIME32
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
zhangyuan29 fc5e37e57b math32: Integer overflow occurs in arithmetic on constant operands
https://coverity.pt.xiaomi.com/#/project-view/10098/10010?selectedIssue=1266083

Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd 7fc03e0084 lib: generic optimization for constant divisor on 32-bit machines
64-by-32-bit divisions are prominent in the NuttX, even on 32-bit
machines.  Luckily, many of them use a constant divisor that allows
for a much faster multiplication by the divisor's reciprocal.

The compiler already performs this optimization when compiling a 32-by-32
division with a constant divisor. Unfortunately, on 32-bit machines, gcc
does not optimize 64-by-32 divisions in that case, except for constant
divisors that happen to be a power of 2.

Let's avoid the slow path whenever the divisor is constant by manually
computing the reciprocal ourselves and performing the multiplication
inline.  In most cases, this improves performance of 64-by-32 divisions
by about two orders of magnitude compared to the __div64_32() fallback,
especially on architectures lacking a native div instruction.

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd 849b2e8c10 clock.h: use roundup to handle clock_time2ticks()
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd f0d3c8ab2b usleep: use div_const to optimize the usleep
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
yinshengkai 62047aa3d0 time: fix 32-bit integer truncation warning
CID 1266677: (#2 of 2): Use 32-bit time_t (Y2K38_SAFETY)
1. declaration_with_small_time_t: Declare use of time_t, which is defined as 32 bits wide on this platform, while the minimum safe width is 64.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
zhangyuan29 f4a650a1c0 clock: Incorrect use of unsigned number
https: //coverity.pt.xiaomi.com/#/project-view/10098/10010?selectedIssue=1275849

Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd a4ffa84974 clock: use div_const() to optimize the div speed
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd cce5280ebf clock: use div_const() to optimize the div speed
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd 48f2a07ce7 clock: generic optimization for constant divisor on 32-bit machines
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd 76e807560e clock: take clock_abstime2ticks() as MACRO
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd 07a4233d1d clock: refactor clock_gettime clock_settime
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd 6a2c03732f clock: Replace all ts and tick conversion functions
Using the ts/tick conversion functions provided in clock.h

Do this caused we want speed up the time calculation, so change:
clock_time2ticks, clock_ticks2time, clock_timespec_add,
clock_timespec_compare, clock_timespec_subtract... to MACRO

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
ligd f2a77bbcea clock: take clock_timespec_compare/add/subtract() as MACRO
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
wangyingdong 1fe0542711 Expose IPTOS_xxx to the application layer
Signed-off-by: wangyingdong <wangyingdong@xiaomi.com>
2024-09-12 17:15:31 +08:00
wangjianyu3 4fe1458a43 usbdev: Add fastboot boardctl
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-10 23:35:58 +08:00