mtd: Replace MTDIOC_XIPBASE with BIOC_XIPBASE

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2021-08-11 15:46:01 +08:00 committed by Alan Carvalho de Assis
parent 177e1ced3f
commit 6b6c11f0ad
13 changed files with 14 additions and 65 deletions

View file

@ -28,8 +28,6 @@ Memory Technology Device Drivers
Support other, less frequently used commands:
- ``MTDIOC_GEOMETRY``: Get MTD geometry
- ``MTDIOC_XIPBASE:``: Convert block to physical address for
eXecute-In-Place
- ``MTDIOC_BULKERASE``: Erase the entire device
is provided via a single ``ioctl`` method (see

View file

@ -349,8 +349,8 @@ static int lc823450_ioctl(FAR struct mtd_dev_s *dev, int cmd,
geo->erasesize, geo->neraseblocks);
break;
case MTDIOC_XIPBASE:
finfo("MTDIOC_XIPBASE\n");
case BIOC_XIPBASE:
finfo("BIOC_XIPBASE\n");
ppv = (FAR void**)arg;
if (ppv)
{

View file

@ -394,7 +394,7 @@ static int tiva_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
}
break;
case MTDIOC_XIPBASE:
case BIOC_XIPBASE:
{
FAR void **ppv = (FAR void**)arg;

View file

@ -506,31 +506,7 @@ static int ftl_ioctl(FAR struct inode *inode, int cmd, unsigned long arg)
dev = (struct ftl_struct_s *)inode->i_private;
/* Only one block driver ioctl command is supported by this driver (and
* that command is just passed on to the MTD driver in a slightly
* different form).
*/
if (cmd == BIOC_XIPBASE)
{
/* The argument accompanying the BIOC_XIPBASE should be non-NULL. If
* DEBUG is enabled, we will catch it here instead of in the MTD
* driver.
*/
#ifdef CONFIG_DEBUG_FEATURES
if (arg == 0)
{
ferr("ERROR: BIOC_XIPBASE argument is NULL\n");
return -EINVAL;
}
#endif
/* Change the BIOC_XIPBASE command to the MTDIOC_XIPBASE command. */
cmd = MTDIOC_XIPBASE;
}
else if (cmd == BIOC_FLUSH)
if (cmd == BIOC_FLUSH)
{
#ifdef CONFIG_FTL_WRITEBUFFER
rwb_flush(&dev->rwb);

View file

@ -432,7 +432,7 @@ static int part_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
}
break;
case MTDIOC_XIPBASE:
case BIOC_XIPBASE:
{
FAR void **ppv = (FAR void**)arg;
unsigned long base;
@ -441,7 +441,7 @@ static int part_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
{
/* Get the XIP base of the entire FLASH */
ret = priv->parent->ioctl(priv->parent, MTDIOC_XIPBASE,
ret = priv->parent->ioctl(priv->parent, BIOC_XIPBASE,
(unsigned long)((uintptr_t)&base));
if (ret == OK)
{

View file

@ -326,7 +326,7 @@ static int progmem_ioctl(FAR struct mtd_dev_s *dev, int cmd,
}
break;
case MTDIOC_XIPBASE:
case BIOC_XIPBASE:
{
FAR void **ppv = (FAR void**)arg;

View file

@ -386,7 +386,7 @@ static int ram_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
}
break;
case MTDIOC_XIPBASE:
case BIOC_XIPBASE:
{
FAR void **ppv = (FAR void**)((uintptr_t)arg);
if (ppv)

View file

@ -259,7 +259,7 @@ static int skel_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
}
break;
case MTDIOC_XIPBASE:
case BIOC_XIPBASE:
{
FAR void **ppv = (FAR void**)arg;

View file

@ -5467,27 +5467,6 @@ static int smart_ioctl(FAR struct inode *inode, int cmd, unsigned long arg)
switch (cmd)
{
case BIOC_XIPBASE:
/* The argument accompanying the BIOC_XIPBASE should be non-NULL. If
* DEBUG is enabled, we will catch it here instead of in the MTD
* driver.
*/
#ifdef CONFIG_DEBUG_FEATURES
if (arg == 0)
{
ferr("ERROR: BIOC_XIPBASE argument is NULL\n");
return -EINVAL;
}
#endif
/* Just change the BIOC_XIPBASE command to the MTDIOC_XIPBASE
* command.
*/
cmd = MTDIOC_XIPBASE;
break;
case BIOC_GETFORMAT:
/* Return the format information for the device */

View file

@ -723,7 +723,7 @@ static int sst39vf_ioctl(FAR struct mtd_dev_s *dev,
}
break;
case MTDIOC_XIPBASE:
case BIOC_XIPBASE:
{
FAR void **ppv = (FAR void **)arg;
if (ppv)

View file

@ -227,7 +227,7 @@ static int part_ioctl(FAR struct inode *inode, int cmd, unsigned long arg)
ret = parent->u.i_bops->ioctl(parent, cmd, arg);
if (ret >= 0)
{
if (cmd == BIOC_XIPBASE || cmd == MTDIOC_XIPBASE)
if (cmd == BIOC_XIPBASE)
{
FAR void **base = (FAR void **)ptr_arg;
struct geometry geo;

View file

@ -530,7 +530,7 @@ int romfs_hwconfigure(struct romfs_mountpt_s *rm)
if (INODE_IS_MTD(inode))
{
ret = MTD_IOCTL(inode->u.i_mtd, MTDIOC_XIPBASE,
ret = MTD_IOCTL(inode->u.i_mtd, BIOC_XIPBASE,
(unsigned long)&rm->rm_xipbase);
}
else if (inode->u.i_bops->ioctl != NULL)

View file

@ -41,10 +41,11 @@
/* Ioctl commands */
/* Note, the following ioctl existed in the past and was removed:
* #define MTDIOC_XIPBASE _MTDIOC(0x0002)
* #define MTDIOC_FLUSH _MTDIOC(0x0009)
* #define MTDIOC_PARTINFO _MTDIOC(0x000b)
* try to avoid adding a new ioctl with the same ioctl number and
* replace with BIOC_FLUSH and BIOC_PARTINFO instead.
* replace with BIOC_XIPBASE, BIOC_FLUSH and BIOC_PARTINFO instead.
*/
#define MTDIOC_GEOMETRY _MTDIOC(0x0001) /* IN: Pointer to write-able struct
@ -52,11 +53,6 @@
* receive geometry data (see mtd.h)
* OUT: Geometry structure is populated
* with data for the MTD */
#define MTDIOC_XIPBASE _MTDIOC(0x0002) /* IN: Pointer to pointer to void in
* which to received the XIP base.
* OUT: If media is directly accessible,
* return (void *) base address
* of device memory */
#define MTDIOC_BULKERASE _MTDIOC(0x0003) /* IN: None
* OUT: None */
#define MTDIOC_PROTECT _MTDIOC(0x0004) /* IN: Pointer to read-able struct