2 * Definitions for bulk memory services
4 * The contents of this file are subject to the Mozilla Public License
5 * Version 2.0 (the "License"); you may not use this file except in
6 * compliance with the License. You may obtain a copy of the License
7 * at http://www.mozilla.org/MPL/
9 * Software distributed under the License is distributed on an "AS IS"
10 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11 * the License for the specific language governing rights and
12 * limitations under the License.
14 * The initial developer of the original code is David A. Hinds
15 * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
16 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
18 * Alternatively, the contents of this file may be used under the
19 * terms of the GNU General Public License version 2 (the "GPL"), in
20 * which case the provisions of the GPL are applicable instead of the
21 * above. If you wish to allow the use of your version of this file
22 * only under the terms of the GPL and not to allow others to use
23 * your version of this file under the MPL, indicate your decision by
24 * deleting the provisions above and replace them with the notice and
25 * other provisions required by the GPL. If you do not delete the
26 * provisions above, a recipient may use your version of this file
27 * under either the MPL or the GPL.
30 #ifndef _LINUX_BULKMEM_H
31 #define _LINUX_BULKMEM_H
33 /* For GetFirstRegion and GetNextRegion */
34 typedef struct region_info_t {
41 u_char JedecMfr, JedecInfo;
45 #define REGION_TYPE 0x0001
46 #define REGION_TYPE_CM 0x0000
47 #define REGION_TYPE_AM 0x0001
48 #define REGION_PREFETCH 0x0008
49 #define REGION_CACHEABLE 0x0010
50 #define REGION_BAR_MASK 0xe000
51 #define REGION_BAR_SHIFT 13
54 typedef struct open_mem_t {
59 /* Attributes for OpenMemory */
60 #define MEMORY_TYPE 0x0001
61 #define MEMORY_TYPE_CM 0x0000
62 #define MEMORY_TYPE_AM 0x0001
63 #define MEMORY_EXCLUSIVE 0x0002
64 #define MEMORY_PREFETCH 0x0008
65 #define MEMORY_CACHEABLE 0x0010
66 #define MEMORY_BAR_MASK 0xe000
67 #define MEMORY_BAR_SHIFT 13
69 typedef struct eraseq_entry_t {
70 memory_handle_t Handle;
77 typedef struct eraseq_hdr_t {
79 eraseq_entry_t *QueueEntryArray;
82 #define ERASE_QUEUED 0x00
83 #define ERASE_IN_PROGRESS(n) (((n) > 0) && ((n) < 0x80))
84 #define ERASE_IDLE 0xff
85 #define ERASE_PASSED 0xe0
86 #define ERASE_FAILED 0xe1
88 #define ERASE_MISSING 0x80
89 #define ERASE_MEDIA_WRPROT 0x84
90 #define ERASE_NOT_ERASABLE 0x85
91 #define ERASE_BAD_OFFSET 0xc1
92 #define ERASE_BAD_TECH 0xc2
93 #define ERASE_BAD_SOCKET 0xc3
94 #define ERASE_BAD_VCC 0xc4
95 #define ERASE_BAD_VPP 0xc5
96 #define ERASE_BAD_SIZE 0xc6
99 typedef struct copy_op_t {
106 /* For ReadMemory and WriteMemory */
107 typedef struct mem_op_t {
113 #define MEM_OP_BUFFER 0x01
114 #define MEM_OP_BUFFER_USER 0x00
115 #define MEM_OP_BUFFER_KERNEL 0x01
116 #define MEM_OP_DISABLE_ERASE 0x02
117 #define MEM_OP_VERIFY 0x04
119 /* For RegisterMTD */
120 typedef struct mtd_reg_t {
127 * Definitions for MTD requests
130 typedef struct mtd_request_t {
132 u_int DestCardOffset;
133 u_int TransferLength;
140 /* Fields in MTD Function */
141 #define MTD_REQ_ACTION 0x003
142 #define MTD_REQ_ERASE 0x000
143 #define MTD_REQ_READ 0x001
144 #define MTD_REQ_WRITE 0x002
145 #define MTD_REQ_COPY 0x003
146 #define MTD_REQ_NOERASE 0x004
147 #define MTD_REQ_VERIFY 0x008
148 #define MTD_REQ_READY 0x010
149 #define MTD_REQ_TIMEOUT 0x020
150 #define MTD_REQ_LAST 0x040
151 #define MTD_REQ_FIRST 0x080
152 #define MTD_REQ_KERNEL 0x100
155 #define MTD_WAITREQ 0x00
156 #define MTD_WAITTIMER 0x01
157 #define MTD_WAITRDY 0x02
158 #define MTD_WAITPOWER 0x03
161 * Definitions for MTD helper functions
164 /* For MTDModifyWindow */
165 typedef struct mtd_mod_win_t {
172 typedef struct mtd_vpp_req_t {
177 typedef struct mtd_rdy_req_t {
182 MTDRequestWindow, MTDModifyWindow, MTDReleaseWindow,
183 MTDSetVpp, MTDRDYMask
186 #endif /* _LINUX_BULKMEM_H */