172dec079SMarius Strobl /*- 272dec079SMarius Strobl * Copyright (c) 2017 Marius Strobl <marius@FreeBSD.org> 372dec079SMarius Strobl * All rights reserved. 472dec079SMarius Strobl * 572dec079SMarius Strobl * Redistribution and use in source and binary forms, with or without 672dec079SMarius Strobl * modification, are permitted provided that the following conditions 772dec079SMarius Strobl * are met: 872dec079SMarius Strobl * 1. Redistributions of source code must retain the above copyright 972dec079SMarius Strobl * notice, this list of conditions and the following disclaimer. 1072dec079SMarius Strobl * 2. Redistributions in binary form must reproduce the above copyright 1172dec079SMarius Strobl * notice, this list of conditions and the following disclaimer in the 1272dec079SMarius Strobl * documentation and/or other materials provided with the distribution. 1372dec079SMarius Strobl * 1472dec079SMarius Strobl * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1572dec079SMarius Strobl * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1672dec079SMarius Strobl * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1772dec079SMarius Strobl * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1872dec079SMarius Strobl * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1972dec079SMarius Strobl * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2072dec079SMarius Strobl * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2172dec079SMarius Strobl * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2272dec079SMarius Strobl * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2372dec079SMarius Strobl * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2472dec079SMarius Strobl * SUCH DAMAGE. 2572dec079SMarius Strobl */ 2672dec079SMarius Strobl 2772dec079SMarius Strobl #ifndef _DEV_MMC_MMC_IOCTL_H_ 2872dec079SMarius Strobl #define _DEV_MMC_MMC_IOCTL_H_ 2972dec079SMarius Strobl 3072dec079SMarius Strobl struct mmc_ioc_cmd { 3172dec079SMarius Strobl int write_flag; /* 0: RD, 1: WR, (1 << 31): reliable WR */ 3272dec079SMarius Strobl int is_acmd; /* 0: normal, 1: use CMD55 */ 3372dec079SMarius Strobl uint32_t opcode; 3472dec079SMarius Strobl uint32_t arg; 3572dec079SMarius Strobl uint32_t response[4]; 3672dec079SMarius Strobl u_int flags; 3772dec079SMarius Strobl u_int blksz; 3872dec079SMarius Strobl u_int blocks; 3972dec079SMarius Strobl u_int __spare[4]; 4072dec079SMarius Strobl uint32_t __pad; 4172dec079SMarius Strobl uint64_t data_ptr; 4272dec079SMarius Strobl }; 4372dec079SMarius Strobl 4472dec079SMarius Strobl #define mmc_ioc_cmd_set_data(mic, ptr) \ 4572dec079SMarius Strobl (mic).data_ptr = (uint64_t)(uintptr_t)(ptr) 4672dec079SMarius Strobl 4772dec079SMarius Strobl struct mmc_ioc_multi_cmd { 4872dec079SMarius Strobl uint64_t num_of_cmds; 4972dec079SMarius Strobl struct mmc_ioc_cmd cmds[0]; 5072dec079SMarius Strobl }; 5172dec079SMarius Strobl 5272dec079SMarius Strobl #define MMC_IOC_BASE 'M' 5372dec079SMarius Strobl 5472dec079SMarius Strobl #define MMC_IOC_CMD _IOWR(MMC_IOC_BASE, 0, struct mmc_ioc_cmd) 55*aca38eabSMarius Strobl #define MMC_IOC_MULTI_CMD _IOWR(MMC_IOC_BASE, 1, struct mmc_ioc_multi_cmd) 5672dec079SMarius Strobl 5772dec079SMarius Strobl /* Maximum accepted data transfer size */ 5872dec079SMarius Strobl #define MMC_IOC_MAX_BYTES (512 * 256) 5972dec079SMarius Strobl /* Maximum accepted number of commands */ 6072dec079SMarius Strobl #define MMC_IOC_MAX_CMDS 255 6172dec079SMarius Strobl 6272dec079SMarius Strobl #endif /* _DEV_MMC_MMC_IOCTL_H_ */ 63