122851890Sopenharmony_ci/****************************************************************************
222851890Sopenharmony_ci ****************************************************************************
322851890Sopenharmony_ci ***
422851890Sopenharmony_ci ***   This header was automatically generated from a Linux kernel header
522851890Sopenharmony_ci ***   of the same name, to make information necessary for userspace to
622851890Sopenharmony_ci ***   call into the kernel available to libc.  It contains only constants,
722851890Sopenharmony_ci ***   structures, and macros generated from the original header, and thus,
822851890Sopenharmony_ci ***   contains no copyrightable information.
922851890Sopenharmony_ci ***
1022851890Sopenharmony_ci ***   To edit the content of this header, modify the corresponding
1122851890Sopenharmony_ci ***   source file (e.g. under external/kernel-headers/original/) then
1222851890Sopenharmony_ci ***   run bionic/libc/kernel/tools/update_all.py
1322851890Sopenharmony_ci ***
1422851890Sopenharmony_ci ***   Any manual change here will be lost the next time this script will
1522851890Sopenharmony_ci ***   be run. You've been warned!
1622851890Sopenharmony_ci ***
1722851890Sopenharmony_ci ****************************************************************************
1822851890Sopenharmony_ci ****************************************************************************/
1922851890Sopenharmony_ci#ifndef __MTD_ABI_H__
2022851890Sopenharmony_ci#define __MTD_ABI_H__
2122851890Sopenharmony_ci#include <linux/types.h>
2222851890Sopenharmony_cistruct erase_info_user {
2322851890Sopenharmony_ci  __u32 start;
2422851890Sopenharmony_ci  __u32 length;
2522851890Sopenharmony_ci};
2622851890Sopenharmony_cistruct erase_info_user64 {
2722851890Sopenharmony_ci  __u64 start;
2822851890Sopenharmony_ci  __u64 length;
2922851890Sopenharmony_ci};
3022851890Sopenharmony_cistruct mtd_oob_buf {
3122851890Sopenharmony_ci  __u32 start;
3222851890Sopenharmony_ci  __u32 length;
3322851890Sopenharmony_ci  unsigned char __user * ptr;
3422851890Sopenharmony_ci};
3522851890Sopenharmony_cistruct mtd_oob_buf64 {
3622851890Sopenharmony_ci  __u64 start;
3722851890Sopenharmony_ci  __u32 pad;
3822851890Sopenharmony_ci  __u32 length;
3922851890Sopenharmony_ci  __u64 usr_ptr;
4022851890Sopenharmony_ci};
4122851890Sopenharmony_cienum {
4222851890Sopenharmony_ci  MTD_OPS_PLACE_OOB = 0,
4322851890Sopenharmony_ci  MTD_OPS_AUTO_OOB = 1,
4422851890Sopenharmony_ci  MTD_OPS_RAW = 2,
4522851890Sopenharmony_ci};
4622851890Sopenharmony_cistruct mtd_write_req {
4722851890Sopenharmony_ci  __u64 start;
4822851890Sopenharmony_ci  __u64 len;
4922851890Sopenharmony_ci  __u64 ooblen;
5022851890Sopenharmony_ci  __u64 usr_data;
5122851890Sopenharmony_ci  __u64 usr_oob;
5222851890Sopenharmony_ci  __u8 mode;
5322851890Sopenharmony_ci  __u8 padding[7];
5422851890Sopenharmony_ci};
5522851890Sopenharmony_ci#define MTD_ABSENT 0
5622851890Sopenharmony_ci#define MTD_RAM 1
5722851890Sopenharmony_ci#define MTD_ROM 2
5822851890Sopenharmony_ci#define MTD_NORFLASH 3
5922851890Sopenharmony_ci#define MTD_NANDFLASH 4
6022851890Sopenharmony_ci#define MTD_DATAFLASH 6
6122851890Sopenharmony_ci#define MTD_UBIVOLUME 7
6222851890Sopenharmony_ci#define MTD_MLCNANDFLASH 8
6322851890Sopenharmony_ci#define MTD_WRITEABLE 0x400
6422851890Sopenharmony_ci#define MTD_BIT_WRITEABLE 0x800
6522851890Sopenharmony_ci#define MTD_NO_ERASE 0x1000
6622851890Sopenharmony_ci#define MTD_POWERUP_LOCK 0x2000
6722851890Sopenharmony_ci#define MTD_SLC_ON_MLC_EMULATION 0x4000
6822851890Sopenharmony_ci#define MTD_CAP_ROM 0
6922851890Sopenharmony_ci#define MTD_CAP_RAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE)
7022851890Sopenharmony_ci#define MTD_CAP_NORFLASH (MTD_WRITEABLE | MTD_BIT_WRITEABLE)
7122851890Sopenharmony_ci#define MTD_CAP_NANDFLASH (MTD_WRITEABLE)
7222851890Sopenharmony_ci#define MTD_CAP_NVRAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE)
7322851890Sopenharmony_ci#define MTD_NANDECC_OFF 0
7422851890Sopenharmony_ci#define MTD_NANDECC_PLACE 1
7522851890Sopenharmony_ci#define MTD_NANDECC_AUTOPLACE 2
7622851890Sopenharmony_ci#define MTD_NANDECC_PLACEONLY 3
7722851890Sopenharmony_ci#define MTD_NANDECC_AUTOPL_USR 4
7822851890Sopenharmony_ci#define MTD_OTP_OFF 0
7922851890Sopenharmony_ci#define MTD_OTP_FACTORY 1
8022851890Sopenharmony_ci#define MTD_OTP_USER 2
8122851890Sopenharmony_cistruct mtd_info_user {
8222851890Sopenharmony_ci  __u8 type;
8322851890Sopenharmony_ci  __u32 flags;
8422851890Sopenharmony_ci  __u32 size;
8522851890Sopenharmony_ci  __u32 erasesize;
8622851890Sopenharmony_ci  __u32 writesize;
8722851890Sopenharmony_ci  __u32 oobsize;
8822851890Sopenharmony_ci  __u64 padding;
8922851890Sopenharmony_ci};
9022851890Sopenharmony_cistruct region_info_user {
9122851890Sopenharmony_ci  __u32 offset;
9222851890Sopenharmony_ci  __u32 erasesize;
9322851890Sopenharmony_ci  __u32 numblocks;
9422851890Sopenharmony_ci  __u32 regionindex;
9522851890Sopenharmony_ci};
9622851890Sopenharmony_cistruct otp_info {
9722851890Sopenharmony_ci  __u32 start;
9822851890Sopenharmony_ci  __u32 length;
9922851890Sopenharmony_ci  __u32 locked;
10022851890Sopenharmony_ci};
10122851890Sopenharmony_ci#define MEMGETINFO _IOR('M', 1, struct mtd_info_user)
10222851890Sopenharmony_ci#define MEMERASE _IOW('M', 2, struct erase_info_user)
10322851890Sopenharmony_ci#define MEMWRITEOOB _IOWR('M', 3, struct mtd_oob_buf)
10422851890Sopenharmony_ci#define MEMREADOOB _IOWR('M', 4, struct mtd_oob_buf)
10522851890Sopenharmony_ci#define MEMLOCK _IOW('M', 5, struct erase_info_user)
10622851890Sopenharmony_ci#define MEMUNLOCK _IOW('M', 6, struct erase_info_user)
10722851890Sopenharmony_ci#define MEMGETREGIONCOUNT _IOR('M', 7, int)
10822851890Sopenharmony_ci#define MEMGETREGIONINFO _IOWR('M', 8, struct region_info_user)
10922851890Sopenharmony_ci#define MEMGETOOBSEL _IOR('M', 10, struct nand_oobinfo)
11022851890Sopenharmony_ci#define MEMGETBADBLOCK _IOW('M', 11, __kernel_loff_t)
11122851890Sopenharmony_ci#define MEMSETBADBLOCK _IOW('M', 12, __kernel_loff_t)
11222851890Sopenharmony_ci#define OTPSELECT _IOR('M', 13, int)
11322851890Sopenharmony_ci#define OTPGETREGIONCOUNT _IOW('M', 14, int)
11422851890Sopenharmony_ci#define OTPGETREGIONINFO _IOW('M', 15, struct otp_info)
11522851890Sopenharmony_ci#define OTPLOCK _IOR('M', 16, struct otp_info)
11622851890Sopenharmony_ci#define ECCGETLAYOUT _IOR('M', 17, struct nand_ecclayout_user)
11722851890Sopenharmony_ci#define ECCGETSTATS _IOR('M', 18, struct mtd_ecc_stats)
11822851890Sopenharmony_ci#define MTDFILEMODE _IO('M', 19)
11922851890Sopenharmony_ci#define MEMERASE64 _IOW('M', 20, struct erase_info_user64)
12022851890Sopenharmony_ci#define MEMWRITEOOB64 _IOWR('M', 21, struct mtd_oob_buf64)
12122851890Sopenharmony_ci#define MEMREADOOB64 _IOWR('M', 22, struct mtd_oob_buf64)
12222851890Sopenharmony_ci#define MEMISLOCKED _IOR('M', 23, struct erase_info_user)
12322851890Sopenharmony_ci#define MEMWRITE _IOWR('M', 24, struct mtd_write_req)
12422851890Sopenharmony_cistruct nand_oobinfo {
12522851890Sopenharmony_ci  __u32 useecc;
12622851890Sopenharmony_ci  __u32 eccbytes;
12722851890Sopenharmony_ci  __u32 oobfree[8][2];
12822851890Sopenharmony_ci  __u32 eccpos[32];
12922851890Sopenharmony_ci};
13022851890Sopenharmony_cistruct nand_oobfree {
13122851890Sopenharmony_ci  __u32 offset;
13222851890Sopenharmony_ci  __u32 length;
13322851890Sopenharmony_ci};
13422851890Sopenharmony_ci#define MTD_MAX_OOBFREE_ENTRIES 8
13522851890Sopenharmony_ci#define MTD_MAX_ECCPOS_ENTRIES 64
13622851890Sopenharmony_cistruct nand_ecclayout_user {
13722851890Sopenharmony_ci  __u32 eccbytes;
13822851890Sopenharmony_ci  __u32 eccpos[MTD_MAX_ECCPOS_ENTRIES];
13922851890Sopenharmony_ci  __u32 oobavail;
14022851890Sopenharmony_ci  struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES];
14122851890Sopenharmony_ci};
14222851890Sopenharmony_cistruct mtd_ecc_stats {
14322851890Sopenharmony_ci  __u32 corrected;
14422851890Sopenharmony_ci  __u32 failed;
14522851890Sopenharmony_ci  __u32 badblocks;
14622851890Sopenharmony_ci  __u32 bbtblocks;
14722851890Sopenharmony_ci};
14822851890Sopenharmony_cienum mtd_file_modes {
14922851890Sopenharmony_ci  MTD_FILE_MODE_NORMAL = MTD_OTP_OFF,
15022851890Sopenharmony_ci  MTD_FILE_MODE_OTP_FACTORY = MTD_OTP_FACTORY,
15122851890Sopenharmony_ci  MTD_FILE_MODE_OTP_USER = MTD_OTP_USER,
15222851890Sopenharmony_ci  MTD_FILE_MODE_RAW,
15322851890Sopenharmony_ci};
15422851890Sopenharmony_ci#endif
155