Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 #ifndef LINUX_MMC_IOCTL_H
0003 #define LINUX_MMC_IOCTL_H
0004 
0005 #include <linux/types.h>
0006 #include <linux/major.h>
0007 
0008 struct mmc_ioc_cmd {
0009     /*
0010      * Direction of data: nonzero = write, zero = read.
0011      * Bit 31 selects 'Reliable Write' for RPMB.
0012      */
0013     int write_flag;
0014 
0015     /* Application-specific command.  true = precede with CMD55 */
0016     int is_acmd;
0017 
0018     __u32 opcode;
0019     __u32 arg;
0020     __u32 response[4];  /* CMD response */
0021     unsigned int flags;
0022     unsigned int blksz;
0023     unsigned int blocks;
0024 
0025     /*
0026      * Sleep at least postsleep_min_us useconds, and at most
0027      * postsleep_max_us useconds *after* issuing command.  Needed for
0028      * some read commands for which cards have no other way of indicating
0029      * they're ready for the next command (i.e. there is no equivalent of
0030      * a "busy" indicator for read operations).
0031      */
0032     unsigned int postsleep_min_us;
0033     unsigned int postsleep_max_us;
0034 
0035     /*
0036      * Override driver-computed timeouts.  Note the difference in units!
0037      */
0038     unsigned int data_timeout_ns;
0039     unsigned int cmd_timeout_ms;
0040 
0041     /*
0042      * For 64-bit machines, the next member, ``__u64 data_ptr``, wants to
0043      * be 8-byte aligned.  Make sure this struct is the same size when
0044      * built for 32-bit.
0045      */
0046     __u32 __pad;
0047 
0048     /* DAT buffer */
0049     __u64 data_ptr;
0050 };
0051 #define mmc_ioc_cmd_set_data(ic, ptr) ic.data_ptr = (__u64)(unsigned long) ptr
0052 
0053 /**
0054  * struct mmc_ioc_multi_cmd - multi command information
0055  * @num_of_cmds: Number of commands to send. Must be equal to or less than
0056  *  MMC_IOC_MAX_CMDS.
0057  * @cmds: Array of commands with length equal to 'num_of_cmds'
0058  */
0059 struct mmc_ioc_multi_cmd {
0060     __u64 num_of_cmds;
0061     struct mmc_ioc_cmd cmds[];
0062 };
0063 
0064 #define MMC_IOC_CMD _IOWR(MMC_BLOCK_MAJOR, 0, struct mmc_ioc_cmd)
0065 /*
0066  * MMC_IOC_MULTI_CMD: Used to send an array of MMC commands described by
0067  *  the structure mmc_ioc_multi_cmd. The MMC driver will issue all
0068  *  commands in array in sequence to card.
0069  */
0070 #define MMC_IOC_MULTI_CMD _IOWR(MMC_BLOCK_MAJOR, 1, struct mmc_ioc_multi_cmd)
0071 /*
0072  * Since this ioctl is only meant to enhance (and not replace) normal access
0073  * to the mmc bus device, an upper data transfer limit of MMC_IOC_MAX_BYTES
0074  * is enforced per ioctl call.  For larger data transfers, use the normal
0075  * block device operations.
0076  */
0077 #define MMC_IOC_MAX_BYTES  (512L * 1024)
0078 #define MMC_IOC_MAX_CMDS    255
0079 #endif /* LINUX_MMC_IOCTL_H */