leodrive.h
15.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
/*
* F i l e N a m e : l e o d r i v e . h
*
****************************************************************************
* (C) Copyright ALPS Electric Co., Ltd. 1995-1996
****************************************************************************
* Version
*
* ver Date
* ---- --------
* 1.12 '97-11-18 Add ASIC_RD_PROGRAM_VERSION definition .
* 1.11 '97-03-03 Add VERIFY_MODE definition for rw_flags.
* 1.10 '97-02-20 Add intenal use command definition.
* 1.09 '97-01-10 Add all retry definitions.
* 1.08 '96-12-24 Move Micro-Sequencer definitions in leomseq_tbl.c
* Add LONG_RW,FIXSIZE flag.
* 1.07 '96-09-17 Add ASIC_LED_BLINK_RATE definition .
* 1.06 '96-09-10 Change support defect number per zone . ( 4 -> 4 or 12 )
* Change LEOsys_data structure.
* 1.05 '96-08-27 Remove KAIHATU definition.
* 1.04 '96-08-26 Add DISK_ID_LBA1 & DISK_ID_LBA2.
* 1.04 '96-08-21 Add loadptr in leo_sys_form.
* 1.03 '96-06-11 Add blk_bytes,sec_bytes in tgt_param_form structure.
* Add SEC_SIZE_SYSTEM definition.
* 1.02 '96-04-05 Change zone track number & Drive max lba .
* Add drive total capacity bytes definition.
* 1.01 '96-02-27 Change file name drive.h to leodrive.h .
* Add ASIC_STAT Register bit definition.
* 1.00 '95-12-20 Initial revision .
****************************************************************************
*/
/*-----------------------------------*/
/* union for 4-2-1 bytes ram type */
/*-----------------------------------*/
union data_trans_form {
u8 u8_data[4];
u16 u16_data[2];
u32 u32_data;
};
/*-----------------------------------*/
/* R/W MODE */
/*-----------------------------------*/
#define R_MODE 0
#define W_MODE 1
/*-----------------------------------*/
/* rw_flags BIT definition */
/*-----------------------------------*/
#define WRITE_MODE 0x8000 /* write mode */
#define LOCK_C2_PARAM 0x4000 /* c2 correction parameter is locked (never change) */
#define SECTOR_READ 0x2000 /* target is only 1 sector (not block) */
#define NO_RETRY 0x1000 /* no retry done at read */
#define LONG_RW 0x0800
#define FIXSIZE 0x0400
#define VERIFY_MODE 0x0200 /* verify mode(for b084) */
/*-----------------------*/
/* disk access parameter */
/*-----------------------*/
struct block_param_form {
u8 *pntr; /* ram address */
u8 *c2buff_e; /* c2 buffer last_addr+1 */
u8 err_pos[4]; /* c1 error sector address */
u8 err_num; /* c1 error sector counter */
u8 bytes; /* bytes per sector */
u16 blkbytes; /* bytes per block */
};
/*-----------------------------------*/
/* ECC definition */
/*-----------------------------------*/
#define C1_ERROR_LIMIT 4 /* MAX C1 ERR SECTORS */
/*------------------------------------------*/
/* DISK PHYSICAL ADDRESS PARAMETER */
/*------------------------------------------*/
struct tgt_param_form {
u16 lba; /* save start_lba */
u16 cylinder; /* Cylinder number to seek */
u16 blk_bytes; /* block bytes */
u8 sec_bytes; /* sector bytes */
u8 head; /* Head number to seek */
u8 zone; /* Zone number of cylinder */
u8 rdwr_blocks; /* blocks can be access */
u8 start_block; /* start block number */
};
/*-----------------------------------*/
/* Formats */
/*-----------------------------------*/
#define DISK_TYPES 7 /* disk-type is 0 - 6 */
#define ZONES_PER_DRV 9 /* zone is HD0:0¡Á7 / HD1:1¡Á8 */
#define HEADS_PER_DRV 2 /* Heads per drive */
#define VZONES_PER_DRV ((ZONES_PER_DRV - 1) * HEADS_PER_DRV)
#define ALT_TK_PER_ZONE 12 /* alternate tracks per zone */
#define BLK_P_TRK 2 /* Blocks per Track */
#define SYSTEM_LBAS 24 /* Total blocks in system area */
/*------------------------------*/
/* system data block address */
/*------------------------------*/
#define SYS_DATA_LBA1 0 /* lba for system info */
#define SYS_DATA_LBA2 1 /* lba for system info */
#define SYS_DATA_LBA3 8 /* lba for system info */
#define SYS_DATA_LBA4 9 /* lba for system info */
#define SYS_LBA_DEV_OFFSET 2 /* difference of system info lba for master and developer */
#define SYS_UNCORR_LBA 12 /* Err ECC block */
#define DISK_ID_LBA1 14 /* lba for disk Id */
#define DISK_ID_LBA2 15 /* lba for disk Id */
/*-------------------------------------------------------------------------*/
#define RD_BYTES_PER_DRV 0x03d78f40UL
#define MAX_P_LBA 0x10dbUL
#define MAX_L_LBA (MAX_P_LBA - SYSTEM_LBAS)
#define USR_SECS_PER_BLK 85
#define C2_SECS_PER_BLK 4
#define GAP_SECS_PER_BLK 1
#define HALF_SECS_U16 0x5900 /* (USR_SECS_PER_BLK+C2_SECS_PER_BLK)<<16 */
#define C1_LENGTH 7 /* C1 bytes */
#define SEC_SIZE_ZONE0 232 /* bytes/sector in zone-0 */
#define SEC_SIZE_ZONE1 216 /* bytes/sector in zone-1 */
#define SEC_SIZE_ZONE2 208 /* bytes/sector in zone-2 */
#define SEC_SIZE_ZONE3 192 /* bytes/sector in zone-3 */
#define SEC_SIZE_ZONE4 176 /* bytes/sector in zone-4 */
#define SEC_SIZE_ZONE5 160 /* bytes/sector in zone-5 */
#define SEC_SIZE_ZONE6 144 /* bytes/sector in zone-6 */
#define SEC_SIZE_ZONE7 128 /* bytes/sector in zone-7 */
#define SEC_SIZE_ZONE8 112 /* bytes/sector in zone-8 */
#define SEC_SIZE_SYSTEM SEC_SIZE_ZONE3 /* bytes/sector in system info */
#define ALL_SECS_PER_BLK (USR_SECS_PER_BLK + C2_SECS_PER_BLK + GAP_SECS_PER_BLK)
#define GAP_BYTES_ZONE0 4
#define TK_PER_ZONE0_HD0 158 /* tracks in hd0 zone0 with alt-tk */
#define TK_PER_ZONE1_HD0 158 /* tracks in hd0 zone1 with alt-tk */
#define TK_PER_ZONE2_HD0 149 /* tracks in hd0 zone2 with alt-tk*/
#define TK_PER_ZONE3_HD0 149 /* tracks in hd0 zone3 with alt-tk*/
#define TK_PER_ZONE4_HD0 149 /* tracks in hd0 zone4 with alt-tk*/
#define TK_PER_ZONE5_HD0 149 /* tracks in hd0 zone5 with alt-tk*/
#define TK_PER_ZONE6_HD0 149 /* tracks in hd0 zone6 with alt-tk*/
#define TK_PER_ZONE7_HD0 114 /* tracks in hd0 zone7 with alt-tk*/
#define TK_PER_ZONE1_HD1 158 /* tracks in hd1 zone1 with alt-tk*/
#define TK_PER_ZONE2_HD1 158 /* tracks in hd1 zone2 with alt-tk*/
#define TK_PER_ZONE3_HD1 149 /* tracks in hd1 zone3 with alt-tk*/
#define TK_PER_ZONE4_HD1 149 /* tracks in hd1 zone4 with alt-tk*/
#define TK_PER_ZONE5_HD1 149 /* tracks in hd1 zone5 with alt-tk*/
#define TK_PER_ZONE6_HD1 149 /* tracks in hd1 zone6 with alt-tk*/
#define TK_PER_ZONE7_HD1 149 /* tracks in hd1 zone7 with alt-tk*/
#define TK_PER_ZONE8_HD1 114 /* tracks in hd1 zone8 with alt-tk*/
/*-----------------------------------*/
/* Format for system information */
/*-----------------------------------*/
union leo_sys_form {
struct {
u32 country;
u8 fmt_type;
u8 disk_type;
u16 ipl_load_len;
u8 defect_num[20];
void *loadptr;
u8 defect_data[192];
u16 rom_end_lba;
u16 ram_start_lba;
u16 ram_end_lba;
} param;
u64 u64_data[SEC_SIZE_ZONE0/8];
};
/*-------------------------------------------------*/
/* Mecha command of Drive */
/* xxxxxxx0 : No Needs disk to execute command */
/* xxxxxxx1 : Needs disk to execute command */
/*-------------------------------------------------*/
#define ASIC_NO_OPERATION 0x00000000
#define ASIC_RD_SEEK 0x00010001
#define ASIC_WR_SEEK 0x00020001
#define ASIC_RECAL 0x00030001
#define ASIC_SLEEP 0x00040000
#define ASIC_START 0x00050001
#define ASIC_SET_STBY 0x00060000
#define ASIC_SET_SLEEP 0x00070000
#define ASIC_CLR_CHGFLG 0x00080000
#define ASIC_CLR_RSTFLG 0x00090000
#define ASIC_RD_VERSION 0x000a0000
#define ASIC_SET_DTYPE 0x000b0001
#define ASIC_REQ_STATUS 0x000c0000
#define ASIC_STANDBY 0x000d0000
#define ASIC_INDEX_LOCK_RETRY 0x000e0001
#define ASIC_SET_TIMER_YEAR 0x000f0000
#define ASIC_SET_TIMER_DATE 0x00100000
#define ASIC_SET_TIMER_MINUTE 0x00110000
#define ASIC_READ_TIMER_YEAR 0x00120000
#define ASIC_READ_TIMER_DATE 0x00130000
#define ASIC_READ_TIMER_MINUTE 0x00140000
#define ASIC_LED_BLINK_RATE 0x00150000
#define ASIC_RD_PROGRAM_VERSION 0x001b0000
#define ASIC_NEED_DISK_IN 0x00000001
#define ASIC_DUMMY_DATA 0x00000000
/*-------------------------------------------------------*/
/* Result data bit definition for REQUIRE_STATUS command */
/*-------------------------------------------------------*/
#define MC_ERR_DIAGNOSTIC 0x00010000 /* Diag err */
#define MC_ERR_SERVO_DATA 0x00020000 /* Servo err */
#define MC_ERR_INDEX 0x00040000 /* Index err */
#define MC_ERR_SETRING_TIMEOUT 0x00080000 /* Seek timeout */
#define MC_ERR_UNDEFINE_CMD 0x00100000 /* Undefined cmd */
#define MC_INVALID_PARAM 0x00200000 /* Invalid parameter(data) */
/*************************************/
/* ASIC regiseter definitions */
/*************************************/
#define ASIC_IO_BASE 0x05000000
#define ASIC_C2_BUFF (ASIC_IO_BASE+0x0000) /* C2 buffer address */
#define ASIC_SECTOR_BUFF (ASIC_IO_BASE+0x0400) /* Data buffer address */
#define MSEQ_RAM_ADDR (ASIC_IO_BASE+0x0580) /* Micro Sequencer address */
#define ASIC_DATA (ASIC_IO_BASE+0x0500) /* W / R */
#define ASIC_MISC_REG (ASIC_IO_BASE+0x0504) /* R */
#define ASIC_STATUS (ASIC_IO_BASE+0x0508) /* R */
#define ASIC_CMD (ASIC_IO_BASE+0x0508) /* W */
#define ASIC_CUR_TK (ASIC_IO_BASE+0x050c) /* R */
#define ASIC_BM_STATUS (ASIC_IO_BASE+0x0510) /* R */
#define ASIC_BM_CTL (ASIC_IO_BASE+0x0510) /* W */
#define ASIC_ERR_SECTOR (ASIC_IO_BASE+0x0514) /* R */
#define ASIC_SEQ_STATUS (ASIC_IO_BASE+0x0518) /* R */
#define ASIC_SEQ_CTL (ASIC_IO_BASE+0x0518) /* W */
#define ASIC_CUR_SECTOR (ASIC_IO_BASE+0x051c) /* R */
#define ASIC_HARD_RESET (ASIC_IO_BASE+0x0520) /* W */
#define ASIC_C1_S0 (ASIC_IO_BASE+0x0524) /* R */
#define ASIC_HOST_SECBYTE (ASIC_IO_BASE+0x0528) /* W / R */
#define ASIC_C1_S2 (ASIC_IO_BASE+0x052c) /* R */
#define ASIC_SEC_BYTE (ASIC_IO_BASE+0x0530) /* W / R */
#define ASIC_C1_S4 (ASIC_IO_BASE+0x0534) /* R */
#define ASIC_C1_S6 (ASIC_IO_BASE+0x0538) /* R */
#define ASIC_CUR_ADDR (ASIC_IO_BASE+0x053c) /* R */
#define ASIC_ID_REG (ASIC_IO_BASE+0x0540) /* R */
#define ASIC_TEST_REG (ASIC_IO_BASE+0x0544) /* R */
#define ASIC_TEST_PIN_SEL (ASIC_IO_BASE+0x0548) /* W */
/*--------------------------------------------*/
/* ASIC Status regiseter bits(R) */
/*--------------------------------------------*/
#define LEO_STAT_DATA_REQ 0x40000000
#define LEO_STAT_C2_XFER 0x10000000
#define LEO_STAT_BM_ERROR 0x08000000
#define LEO_STAT_BM_INT 0x04000000
#define LEO_STAT_MECHA_INT 0x02000000
#define LEO_STAT_DISK 0x01000000
#define LEO_STAT_BUSY 0x00800000
#define LEO_STAT_RESET 0x00400000
#define LEO_STAT_SPM_OFF 0x00100000
#define LEO_STAT_HEAD_RETRACT 0x00080000
#define LEO_STAT_WPROTECT_ERR 0x00040000
#define LEO_STAT_MECHA_ERROR 0x00020000
#define LEO_STAT_DISK_CHANGE 0x00010000
#define LEO_STAT_MASK 0xffff0000
#define LEO_STAT_NC_CHK 0x0000ffff
#define LEO_STAT_WRITE_END 0x00000000
/*----------------------------------------------*/
/* ASIC BM-Status register bits(R) */
/*----------------------------------------------*/
#define LEO_BMST_RUNNING 0x80000000 /* bit 15 */
#define LEO_BMST_ERROR 0x04000000 /* bit 10 */
#define LEO_BMST_MICRO_STATUS 0x02000000 /* bit 9 */
#define LEO_BMST_BLOCKS 0x01000000 /* bit 8 */
#define LEO_BMST_C1_CORRECT 0x00800000 /* bit 7 */
#define LEO_BMST_C1_DOUBLE 0x00400000 /* bit 6 */
#define LEO_BMST_C1_SINGLE 0x00200000 /* bit 5 */
#define LEO_BMST_C1_ERROR 0x00010000 /* bit 0 */
/*--------------------------------------*/
/* ASIC BM-Control register bits(W) */
/*--------------------------------------*/
#define START_BM 0x80000000
#define BM_MODE 0x40000000
#define BM_INT_MASK 0x20000000
#define BM_RESET 0x10000000
#define BM_DISABLE_OR_CHK 0x08000000
#define BM_DISABLE_C1 0x04000000
#define BM_XFERBLKS 0x02000000
#define BM_MECHA_INT_RESET 0x01000000
/*----------------------------------------*/
/* ASIC ERROR/SECTOR register bits(W) */
/*----------------------------------------*/
#define BIT_AM_FAIL 0x80000000
#define BIT_MICRO_FAIL 0x40000000
#define BIT_SPINDLE_FAIL 0x20000000
#define BIT_OVER_RUN 0x10000000
#define BIT_OFFTRACK 0x08000000
#define BIT_NO_DISK 0x04000000
#define BIT_CLOCK_UNLOCK 0x02000000
#define BIT_SELF_STOP 0x01000000
/*------------------------------------------*/
/* ASIC SEQENCER-CONTROL REGISTER BITS(W) */
/*------------------------------------------*/
#define MICRO_INT_MASK 0x80000000
#define MICRO_PC_ENABLE 0x40000000
/*-----------------------------------------*/
/* ASIC CURRENT_TRACK Register bits(R) */
/*-----------------------------------------*/
#define BIT_INDEX_LOCK 0x60000000
/*-----------------------------------------*/
/* ASIC HARD RESET register data */
/*-----------------------------------------*/
#define ASIC_RESET_CODE 0xaaaa0000
/*-----------------------------------------*/
/* Drive retrys */
/*-----------------------------------------*/
#define MAX_RETRY 64 /* for R/W */
#define leoChk_recal(a) ((a & 0x07) == 0) /* check if recal should be exe */
#define MAX_MOTOR_RETRY 8 /* for Start/Stop */
#define MAX_REZERO_RETRY 8 /* for rezero */
#define MAX_SEEK_RETRY 20 /* for seek */
/*-----------------------------------------*/
/* Intenal Use Command */
/*-----------------------------------------*/
#define LEO_COMMAND_RESETCLEAR 0x0f