1 /**************************************************************************** 2 **************************************************************************** 3 *** 4 *** This header was automatically generated from a Linux kernel header 5 *** of the same name, to make information necessary for userspace to 6 *** call into the kernel available to libc. It contains only constants, 7 *** structures, and macros generated from the original header, and thus, 8 *** contains no copyrightable information. 9 *** 10 *** To edit the content of this header, modify the corresponding 11 *** source file (e.g. under external/kernel-headers/original/) then 12 *** run bionic/libc/kernel/tools/update_all.py 13 *** 14 *** Any manual change here will be lost the next time this script will 15 *** be run. You've been warned! 16 *** 17 **************************************************************************** 18 ****************************************************************************/ 19 #ifndef __MTD_ABI_H__ 20 #define __MTD_ABI_H__ 21 #include <linux/types.h> 22 struct erase_info_user { 23 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 24 __u32 start; 25 __u32 length; 26 }; 27 struct erase_info_user64 { 28 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 29 __u64 start; 30 __u64 length; 31 }; 32 struct mtd_oob_buf { 33 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 34 __u32 start; 35 __u32 length; 36 unsigned char __user *ptr; 37 }; 38 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 39 struct mtd_oob_buf64 { 40 __u64 start; 41 __u32 pad; 42 __u32 length; 43 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 44 __u64 usr_ptr; 45 }; 46 enum { 47 MTD_OPS_PLACE_OOB = 0, 48 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 49 MTD_OPS_AUTO_OOB = 1, 50 MTD_OPS_RAW = 2, 51 }; 52 struct mtd_write_req { 53 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 54 __u64 start; 55 __u64 len; 56 __u64 ooblen; 57 __u64 usr_data; 58 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 59 __u64 usr_oob; 60 __u8 mode; 61 __u8 padding[7]; 62 }; 63 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 64 #define MTD_ABSENT 0 65 #define MTD_RAM 1 66 #define MTD_ROM 2 67 #define MTD_NORFLASH 3 68 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 69 #define MTD_NANDFLASH 4 70 #define MTD_DATAFLASH 6 71 #define MTD_UBIVOLUME 7 72 #define MTD_MLCNANDFLASH 8 73 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 74 #define MTD_WRITEABLE 0x400 75 #define MTD_BIT_WRITEABLE 0x800 76 #define MTD_NO_ERASE 0x1000 77 #define MTD_POWERUP_LOCK 0x2000 78 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 79 #define MTD_CAP_ROM 0 80 #define MTD_CAP_RAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE) 81 #define MTD_CAP_NORFLASH (MTD_WRITEABLE | MTD_BIT_WRITEABLE) 82 #define MTD_CAP_NANDFLASH (MTD_WRITEABLE) 83 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 84 #define MTD_NANDECC_OFF 0 85 #define MTD_NANDECC_PLACE 1 86 #define MTD_NANDECC_AUTOPLACE 2 87 #define MTD_NANDECC_PLACEONLY 3 88 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 89 #define MTD_NANDECC_AUTOPL_USR 4 90 #define MTD_OTP_OFF 0 91 #define MTD_OTP_FACTORY 1 92 #define MTD_OTP_USER 2 93 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 94 struct mtd_info_user { 95 __u8 type; 96 __u32 flags; 97 __u32 size; 98 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 99 __u32 erasesize; 100 __u32 writesize; 101 __u32 oobsize; 102 __u64 padding; 103 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 104 }; 105 struct region_info_user { 106 __u32 offset; 107 __u32 erasesize; 108 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 109 __u32 numblocks; 110 __u32 regionindex; 111 }; 112 struct otp_info { 113 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 114 __u32 start; 115 __u32 length; 116 __u32 locked; 117 }; 118 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 119 #define MEMGETINFO _IOR('M', 1, struct mtd_info_user) 120 #define MEMERASE _IOW('M', 2, struct erase_info_user) 121 #define MEMWRITEOOB _IOWR('M', 3, struct mtd_oob_buf) 122 #define MEMREADOOB _IOWR('M', 4, struct mtd_oob_buf) 123 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 124 #define MEMLOCK _IOW('M', 5, struct erase_info_user) 125 #define MEMUNLOCK _IOW('M', 6, struct erase_info_user) 126 #define MEMGETREGIONCOUNT _IOR('M', 7, int) 127 #define MEMGETREGIONINFO _IOWR('M', 8, struct region_info_user) 128 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 129 #define MEMGETOOBSEL _IOR('M', 10, struct nand_oobinfo) 130 #define MEMGETBADBLOCK _IOW('M', 11, __kernel_loff_t) 131 #define MEMSETBADBLOCK _IOW('M', 12, __kernel_loff_t) 132 #define OTPSELECT _IOR('M', 13, int) 133 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 134 #define OTPGETREGIONCOUNT _IOW('M', 14, int) 135 #define OTPGETREGIONINFO _IOW('M', 15, struct otp_info) 136 #define OTPLOCK _IOR('M', 16, struct otp_info) 137 #define ECCGETLAYOUT _IOR('M', 17, struct nand_ecclayout_user) 138 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 139 #define ECCGETSTATS _IOR('M', 18, struct mtd_ecc_stats) 140 #define MTDFILEMODE _IO('M', 19) 141 #define MEMERASE64 _IOW('M', 20, struct erase_info_user64) 142 #define MEMWRITEOOB64 _IOWR('M', 21, struct mtd_oob_buf64) 143 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 144 #define MEMREADOOB64 _IOWR('M', 22, struct mtd_oob_buf64) 145 #define MEMISLOCKED _IOR('M', 23, struct erase_info_user) 146 #define MEMWRITE _IOWR('M', 24, struct mtd_write_req) 147 struct nand_oobinfo { 148 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 149 __u32 useecc; 150 __u32 eccbytes; 151 __u32 oobfree[8][2]; 152 __u32 eccpos[32]; 153 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 154 }; 155 struct nand_oobfree { 156 __u32 offset; 157 __u32 length; 158 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 159 }; 160 #define MTD_MAX_OOBFREE_ENTRIES 8 161 #define MTD_MAX_ECCPOS_ENTRIES 64 162 struct nand_ecclayout_user { 163 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 164 __u32 eccbytes; 165 __u32 eccpos[MTD_MAX_ECCPOS_ENTRIES]; 166 __u32 oobavail; 167 struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES]; 168 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 169 }; 170 struct mtd_ecc_stats { 171 __u32 corrected; 172 __u32 failed; 173 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 174 __u32 badblocks; 175 __u32 bbtblocks; 176 }; 177 enum mtd_file_modes { 178 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 179 MTD_FILE_MODE_NORMAL = MTD_OTP_OFF, 180 MTD_FILE_MODE_OTP_FACTORY = MTD_OTP_FACTORY, 181 MTD_FILE_MODE_OTP_USER = MTD_OTP_USER, 182 MTD_FILE_MODE_RAW, 183 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 184 }; 185 #endif 186