blob: 3678459b4535ec66c32c6f4981475eb004bd5f2d [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * $Id: ftl.h,v 1.6 2003/01/24 13:20:04 dwmw2 Exp $
3 *
4 * Derived from (and probably identical to):
5 * ftl.h 1.7 1999/10/25 20:23:17
6 *
7 * The contents of this file are subject to the Mozilla Public License
8 * Version 1.1 (the "License"); you may not use this file except in
9 * compliance with the License. You may obtain a copy of the License
10 * at http://www.mozilla.org/MPL/
11 *
12 * Software distributed under the License is distributed on an "AS IS"
13 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 * the License for the specific language governing rights and
15 * limitations under the License.
16 *
17 * The initial developer of the original code is David A. Hinds
18 * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
19 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
20 *
21 * Alternatively, the contents of this file may be used under the
22 * terms of the GNU General Public License version 2 (the "GPL"), in
23 * which case the provisions of the GPL are applicable instead of the
24 * above. If you wish to allow the use of your version of this file
25 * only under the terms of the GPL and not to allow others to use
26 * your version of this file under the MPL, indicate your decision by
27 * deleting the provisions above and replace them with the notice and
28 * other provisions required by the GPL. If you do not delete the
29 * provisions above, a recipient may use your version of this file
30 * under either the MPL or the GPL.
31 */
32
33#ifndef _LINUX_FTL_H
34#define _LINUX_FTL_H
35
36typedef struct erase_unit_header_t {
37 u_int8_t LinkTargetTuple[5];
38 u_int8_t DataOrgTuple[10];
39 u_int8_t NumTransferUnits;
40 u_int32_t EraseCount;
41 u_int16_t LogicalEUN;
42 u_int8_t BlockSize;
43 u_int8_t EraseUnitSize;
44 u_int16_t FirstPhysicalEUN;
45 u_int16_t NumEraseUnits;
46 u_int32_t FormattedSize;
47 u_int32_t FirstVMAddress;
48 u_int16_t NumVMPages;
49 u_int8_t Flags;
50 u_int8_t Code;
51 u_int32_t SerialNumber;
52 u_int32_t AltEUHOffset;
53 u_int32_t BAMOffset;
54 u_int8_t Reserved[12];
55 u_int8_t EndTuple[2];
56} erase_unit_header_t;
57
58/* Flags in erase_unit_header_t */
59#define HIDDEN_AREA 0x01
60#define REVERSE_POLARITY 0x02
61#define DOUBLE_BAI 0x04
62
63/* Definitions for block allocation information */
64
65#define BLOCK_FREE(b) ((b) == 0xffffffff)
66#define BLOCK_DELETED(b) (((b) == 0) || ((b) == 0xfffffffe))
67
68#define BLOCK_TYPE(b) ((b) & 0x7f)
69#define BLOCK_ADDRESS(b) ((b) & ~0x7f)
70#define BLOCK_NUMBER(b) ((b) >> 9)
71#define BLOCK_CONTROL 0x30
72#define BLOCK_DATA 0x40
73#define BLOCK_REPLACEMENT 0x60
74#define BLOCK_BAD 0x70
75
76#endif /* _LINUX_FTL_H */