Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
0002 /*
0003  * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
0004  *
0005  * This program is free software; you can redistribute it and/or modify
0006  * it under the terms of the GNU General Public License as published by
0007  * the Free Software Foundation; either version 2 of the License, or
0008  * (at your option) any later version.
0009  *
0010  * This program is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013  * GNU General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU General Public License
0016  * along with this program; if not, write to the Free Software
0017  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
0018  *
0019  */
0020 
0021 #ifndef __MTD_NFTL_USER_H__
0022 #define __MTD_NFTL_USER_H__
0023 
0024 #include <linux/types.h>
0025 
0026 /* Block Control Information */
0027 
0028 struct nftl_bci {
0029     unsigned char ECCSig[6];
0030     __u8 Status;
0031     __u8 Status1;
0032 }__attribute__((packed));
0033 
0034 /* Unit Control Information */
0035 
0036 struct nftl_uci0 {
0037     __u16 VirtUnitNum;
0038     __u16 ReplUnitNum;
0039     __u16 SpareVirtUnitNum;
0040     __u16 SpareReplUnitNum;
0041 } __attribute__((packed));
0042 
0043 struct nftl_uci1 {
0044     __u32 WearInfo;
0045     __u16 EraseMark;
0046     __u16 EraseMark1;
0047 } __attribute__((packed));
0048 
0049 struct nftl_uci2 {
0050         __u16 FoldMark;
0051         __u16 FoldMark1;
0052     __u32 unused;
0053 } __attribute__((packed));
0054 
0055 union nftl_uci {
0056     struct nftl_uci0 a;
0057     struct nftl_uci1 b;
0058     struct nftl_uci2 c;
0059 };
0060 
0061 struct nftl_oob {
0062     struct nftl_bci b;
0063     union nftl_uci u;
0064 };
0065 
0066 /* NFTL Media Header */
0067 
0068 struct NFTLMediaHeader {
0069     char DataOrgID[6];
0070     __u16 NumEraseUnits;
0071     __u16 FirstPhysicalEUN;
0072     __u32 FormattedSize;
0073     unsigned char UnitSizeFactor;
0074 } __attribute__((packed));
0075 
0076 #define MAX_ERASE_ZONES (8192 - 512)
0077 
0078 #define ERASE_MARK 0x3c69
0079 #define SECTOR_FREE 0xff
0080 #define SECTOR_USED 0x55
0081 #define SECTOR_IGNORE 0x11
0082 #define SECTOR_DELETED 0x00
0083 
0084 #define FOLD_MARK_IN_PROGRESS 0x5555
0085 
0086 #define ZONE_GOOD 0xff
0087 #define ZONE_BAD_ORIGINAL 0
0088 #define ZONE_BAD_MARKED 7
0089 
0090 
0091 #endif /* __MTD_NFTL_USER_H__ */