mtd-abi.h revision ba8d4f460b51161eb82cf1006cb34a3cc1389f47
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>
22struct erase_info_user {
23/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
24 __u32 start;
25 __u32 length;
26};
27struct erase_info_user64 {
28/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
29 __u64 start;
30 __u64 length;
31};
32struct 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 */
39struct 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};
46enum {
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};
52struct 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_CAP_NVRAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE)
85#define MTD_NANDECC_OFF 0
86#define MTD_NANDECC_PLACE 1
87#define MTD_NANDECC_AUTOPLACE 2
88/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
89#define MTD_NANDECC_PLACEONLY 3
90#define MTD_NANDECC_AUTOPL_USR 4
91#define MTD_OTP_OFF 0
92#define MTD_OTP_FACTORY 1
93/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
94#define MTD_OTP_USER 2
95struct mtd_info_user {
96 __u8 type;
97 __u32 flags;
98/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
99 __u32 size;
100 __u32 erasesize;
101 __u32 writesize;
102 __u32 oobsize;
103/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
104 __u64 padding;
105};
106struct region_info_user {
107 __u32 offset;
108/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
109 __u32 erasesize;
110 __u32 numblocks;
111 __u32 regionindex;
112};
113/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
114struct otp_info {
115 __u32 start;
116 __u32 length;
117 __u32 locked;
118/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
119};
120#define MEMGETINFO _IOR('M', 1, struct mtd_info_user)
121#define MEMERASE _IOW('M', 2, struct erase_info_user)
122#define MEMWRITEOOB _IOWR('M', 3, struct mtd_oob_buf)
123/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
124#define MEMREADOOB _IOWR('M', 4, struct mtd_oob_buf)
125#define MEMLOCK _IOW('M', 5, struct erase_info_user)
126#define MEMUNLOCK _IOW('M', 6, struct erase_info_user)
127#define MEMGETREGIONCOUNT _IOR('M', 7, int)
128/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
129#define MEMGETREGIONINFO _IOWR('M', 8, struct region_info_user)
130#define MEMGETOOBSEL _IOR('M', 10, struct nand_oobinfo)
131#define MEMGETBADBLOCK _IOW('M', 11, __kernel_loff_t)
132#define MEMSETBADBLOCK _IOW('M', 12, __kernel_loff_t)
133/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
134#define OTPSELECT _IOR('M', 13, int)
135#define OTPGETREGIONCOUNT _IOW('M', 14, int)
136#define OTPGETREGIONINFO _IOW('M', 15, struct otp_info)
137#define OTPLOCK _IOR('M', 16, struct otp_info)
138/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
139#define ECCGETLAYOUT _IOR('M', 17, struct nand_ecclayout_user)
140#define ECCGETSTATS _IOR('M', 18, struct mtd_ecc_stats)
141#define MTDFILEMODE _IO('M', 19)
142#define MEMERASE64 _IOW('M', 20, struct erase_info_user64)
143/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
144#define MEMWRITEOOB64 _IOWR('M', 21, struct mtd_oob_buf64)
145#define MEMREADOOB64 _IOWR('M', 22, struct mtd_oob_buf64)
146#define MEMISLOCKED _IOR('M', 23, struct erase_info_user)
147#define MEMWRITE _IOWR('M', 24, struct mtd_write_req)
148/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
149struct nand_oobinfo {
150 __u32 useecc;
151 __u32 eccbytes;
152 __u32 oobfree[8][2];
153/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
154 __u32 eccpos[32];
155};
156struct nand_oobfree {
157 __u32 offset;
158/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
159 __u32 length;
160};
161#define MTD_MAX_OOBFREE_ENTRIES 8
162#define MTD_MAX_ECCPOS_ENTRIES 64
163/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
164struct nand_ecclayout_user {
165 __u32 eccbytes;
166 __u32 eccpos[MTD_MAX_ECCPOS_ENTRIES];
167 __u32 oobavail;
168/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
169 struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES];
170};
171struct mtd_ecc_stats {
172 __u32 corrected;
173/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
174 __u32 failed;
175 __u32 badblocks;
176 __u32 bbtblocks;
177};
178/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
179enum mtd_file_modes {
180 MTD_FILE_MODE_NORMAL = MTD_OTP_OFF,
181 MTD_FILE_MODE_OTP_FACTORY = MTD_OTP_FACTORY,
182 MTD_FILE_MODE_OTP_USER = MTD_OTP_USER,
183/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
184 MTD_FILE_MODE_RAW,
185};
186#endif
187