LF-15348: firmware: imx: Add ioctl flag

Add ioctl flag to reset the shared memory position.

Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
Reviewed-by: Pankaj Gupta <pankaj.gupta@nxp.com>
This commit is contained in:
Meenakshi Aggarwal 2025-05-21 08:06:32 +02:00
parent 19ce6042dd
commit 296c64f096
2 changed files with 10 additions and 1 deletions

View File

@ -1384,6 +1384,14 @@ static int se_ioctl_setup_iobuf_handler(struct se_if_device_ctx *dev_ctx,
dev_err(dev_ctx->priv->dev,
"%s: Not enough space in shared memory\n",
dev_ctx->devname);
if (io.flags & SE_IO_BUF_FLAGS_RESET_ON_ERROR) {
if (shared_mem->pos)
memset_io(shared_mem->ptr, 0, shared_mem->pos);
else
memset(shared_mem->ptr, 0, shared_mem->pos);
shared_mem->pos = 0;
}
err = -ENOMEM;
goto exit;
}

View File

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause*/
/*
* Copyright 2024 NXP
* Copyright 2024-2025 NXP
*/
#ifndef SE_IOCTL_H
@ -92,6 +92,7 @@ struct se_time_frame {
#define SE_IO_BUF_FLAGS_USE_SHORT_ADDR (0x04u)
#define SE_IO_BUF_FLAGS_USE_MU_BUF (0x08u)
#define SE_IO_BUF_FLAGS_IS_IN_OUT (0x10u)
#define SE_IO_BUF_FLAGS_RESET_ON_ERROR (0x20u)
/* IOCTLS */
#define SE_IOCTL 0x0A /* like MISC_MAJOR. */