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_MTD_H__ 20 #define __MTD_MTD_H__ 21 #error This is a kernel header. Perhaps include mtd-user.h instead? 22 #include <linux/types.h> 23 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 24 #include <linux/module.h> 25 #include <linux/uio.h> 26 #include <linux/notifier.h> 27 #include <linux/mtd/compatmac.h> 28 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 29 #include <mtd/mtd-abi.h> 30 #define MTD_CHAR_MAJOR 90 31 #define MTD_BLOCK_MAJOR 31 32 #define MAX_MTD_DEVICES 16 33 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 34 #define MTD_ERASE_PENDING 0x01 35 #define MTD_ERASING 0x02 36 #define MTD_ERASE_SUSPEND 0x04 37 #define MTD_ERASE_DONE 0x08 38 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 39 #define MTD_ERASE_FAILED 0x10 40 struct erase_info { 41 struct mtd_info *mtd; 42 u_int32_t addr; 43 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 44 u_int32_t len; 45 u_int32_t fail_addr; 46 u_long time; 47 u_long retries; 48 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 49 u_int dev; 50 u_int cell; 51 void (*callback) (struct erase_info *self); 52 u_long priv; 53 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 54 u_char state; 55 struct erase_info *next; 56 }; 57 struct mtd_erase_region_info { 58 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 59 u_int32_t offset; 60 u_int32_t erasesize; 61 u_int32_t numblocks; 62 }; 63 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 64 typedef enum { 65 MTD_OOB_PLACE, 66 MTD_OOB_AUTO, 67 MTD_OOB_RAW, 68 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 69 } mtd_oob_mode_t; 70 struct mtd_oob_ops { 71 mtd_oob_mode_t mode; 72 size_t len; 73 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 74 size_t retlen; 75 size_t ooblen; 76 uint32_t ooboffs; 77 uint8_t *datbuf; 78 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 79 uint8_t *oobbuf; 80 }; 81 struct mtd_info { 82 u_char type; 83 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 84 u_int32_t flags; 85 u_int32_t size; 86 u_int32_t erasesize; 87 u_int32_t writesize; 88 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 89 u_int32_t oobsize; 90 u_int32_t ecctype; 91 u_int32_t eccsize; 92 #define MTD_PROGREGION_CTRLMODE_VALID(mtd) (mtd)->oobsize 93 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 94 #define MTD_PROGREGION_CTRLMODE_INVALID(mtd) (mtd)->ecctype 95 char *name; 96 int index; 97 struct nand_ecclayout *ecclayout; 98 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 99 int numeraseregions; 100 struct mtd_erase_region_info *eraseregions; 101 u_int32_t bank_size; 102 int (*erase) (struct mtd_info *mtd, struct erase_info *instr); 103 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 104 int (*point) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf); 105 void (*unpoint) (struct mtd_info *mtd, u_char * addr, loff_t from, size_t len); 106 int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); 107 int (*write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); 108 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 109 int (*read_oob) (struct mtd_info *mtd, loff_t from, 110 struct mtd_oob_ops *ops); 111 int (*write_oob) (struct mtd_info *mtd, loff_t to, 112 struct mtd_oob_ops *ops); 113 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 114 int (*get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len); 115 int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); 116 int (*get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len); 117 int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); 118 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 119 int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); 120 int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len); 121 int (*writev) (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to, size_t *retlen); 122 void (*sync) (struct mtd_info *mtd); 123 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 124 int (*lock) (struct mtd_info *mtd, loff_t ofs, size_t len); 125 int (*unlock) (struct mtd_info *mtd, loff_t ofs, size_t len); 126 int (*suspend) (struct mtd_info *mtd); 127 void (*resume) (struct mtd_info *mtd); 128 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 129 int (*block_isbad) (struct mtd_info *mtd, loff_t ofs); 130 int (*block_markbad) (struct mtd_info *mtd, loff_t ofs); 131 struct notifier_block reboot_notifier; 132 struct mtd_ecc_stats ecc_stats; 133 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 134 void *priv; 135 struct module *owner; 136 int usecount; 137 }; 138 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 139 struct mtd_notifier { 140 void (*add)(struct mtd_info *mtd); 141 void (*remove)(struct mtd_info *mtd); 142 struct list_head list; 143 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 144 }; 145 #define MTD_DEBUG_LEVEL0 (0) 146 #define MTD_DEBUG_LEVEL1 (1) 147 #define MTD_DEBUG_LEVEL2 (2) 148 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 149 #define MTD_DEBUG_LEVEL3 (3) 150 #define DEBUG(n, args...) do { } while(0) 151 #endif 152