1 /*
2 * Mach Operating System
3 * Copyright (c) 1991 Carnegie Mellon University
4 * Copyright (c) 1991 IBM Corporation
5 * All Rights Reserved.
6 *
7 * Permission to use, copy, modify and distribute this software and its
8 * documentation is hereby granted, provided that both the copyright
9 * notice and this permission notice appear in all copies of the
10 * software, derivative works or modified versions, and any portions
11 * thereof, and that both notices appear in supporting documentation,
12 * and that the name IBM not be used in advertising or publicity
13 * pertaining to distribution of the software without specific, written
14 * prior permission.
15 *
16 * CARNEGIE MELLON AND IBM ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS"
17 * CONDITION. CARNEGIE MELLON AND IBM DISCLAIM ANY LIABILITY OF ANY KIND FOR
18 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19 *
20 * Carnegie Mellon requests users of this software to return to
21 *
22 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
23 * School of Computer Science
24 * Carnegie Mellon University
25 * Pittsburgh PA 15213-3890
26 *
27 * any improvements or extensions that they make and grant Carnegie Mellon
28 * the rights to redistribute these changes.
29 */
30
31 /* @(#)62 1.1 mk/src/latest/kernel/i386/PS2/fd_abios.h, MACH 4/4/91 10:22:05 */
32 /*
33 * COMPONENT_NAME: SYSXFD floppy diskette driver
34 *
35 * FUNCTIONS:
36 *
37 * ORIGINS: 27
38 */
39
40 /*
41 * HISTORY
42 * $Log: fd_abios.h,v $
43 * Revision 2.3 93/03/11 14:09:04 danner
44 * u_long -> u_int
45 * [93/03/09 danner]
46 *
47 * Revision 2.2 93/02/04 07:59:35 danner
48 * Integrate PS2 code from IBM.
49 * [93/01/18 prithvi]
50 *
51 */
52
53 #ifndef _H_FDABIOS
54 #define _H_FDABIOS
55
56 /* ABIOS diskette specific function codes.
57 ** - see <sys/abios.h> for generic ABIOS request defines
58 */
59 #define ABIOS_FD_VERIFY_SECTOR 0x0b
60 #define ABIOS_FD_READ_MEDIA_TYPE 0x0c
61 #define ABIOS_FD_SET_MEDIA_TYPE 0x0d
62 #define ABIOS_FD_CHANGE_SIGNAL_STATUS 0x0e
63 #define ABIOS_FD_TURN_OFF_MOTOR 0x0f
64 #define ABIOS_FD_INTERRUPT_STATUS 0x10
65
66 /* ABIOS diskette specific return codes.
67 */
68 #define ABIOS_FD_RC_TIMEOUT 0xfffe
69 #define ABIOS_FD_RC_DONE 0x0000
70
71
72 /* Set up fd ABIOS request block, assuming request block length
73 ** of FD_REQUEST_BLOCK_LEN+0x10 bytes. This should be sufficient.
74 ** The real value can be found by issuing ABIOS_LOGICAL_PARAMETER
75 ** function.
76 */
77 #define FD_REQUEST_BLOCK_LEN 128
78 struct Fd_request {
79 struct Request_header request_header; /* 0x00-0x0f abios.h */
80 union {
81 struct Logical_id_params logical_id_params;
82 u_char uc[FD_REQUEST_BLOCK_LEN];
83 } un;
84 int state;
85 int sleep_on_intr; /* for syncronous requests */
86 int req_errno; /* for syncronous errors */
87 };
88
89 /* Possible States an ABIOS request block
90 */
91 #define FD_RB_IDLE 0 /* don't use BIT0 */
92 #define FD_RB_STARTED BIT1
93 #define FD_RB_STAGING BIT2
94 #define FD_RB_SLEEPING BIT3
95 #define FD_RB_SYNC BIT4
96 #define FD_RB_RESET BIT5
97
98
99 /* ABIOS_LOGICAL_PARAMETER (0x01)
100 ** - Always returns 0.
101 ** - Does not interrupt.
102 ** INPUT: see fd_cmd.c
103 ** OUTPUT: see <sys/abios.h>
104 */
105 #define FD_SET_RESERVED_ABIOS_LOGICAL_PARAMETER(rb) \
106 *( (u_short *) &((rb)->un.uc[0x0a]) ) = 0; \
107 *( (u_short *) &((rb)->un.uc[0x0c]) ) = 0; \
108 *( (u_short *) &((rb)->un.uc[0x0e]) ) = 0;
109
110
111 /* ABIOS_READ_PARAMETER (0x03)
112 ** - function which returns info specific to the selected drive.
113 ** - only returns 0
114 ** - does not interrupt
115 ** INPUT: drive number
116 **
117 */
118 #define FD_SET_RESERVED_ABIOS_READ_PARAMETER(rb) \
119 *( (u_short *) &((rb)->un.uc[0x08]) ) = 0;
120
121 /* OUTPUT */
122 #define fd_sectors_per_track(rb) *( (u_short *) &((rb)->un.uc[0x00]) )
123 #define fd_bytes_per_sector(rb) *( (u_short *) &((rb)->un.uc[0x02]) )
124 #define FD_256_BYTE_PER_SECTOR 0x0001
125 #define FD_512_BYTE_PER_SECTOR 0x0002
126 #define fd_dev_ctrl_flag(rb) *( (u_short *) &((rb)->un.uc[0x04]) )
127 #define FD_CHANGE_SIGNAL_AVAIL 0x0001 /* bit 0 */
128 #define FD_SUPPORT_FORMAT_CMD 0x0002 /* bit 1 */
129 #define FD_SUPPORT_CONCURRENT 0x0004 /* bit 2 */
130 #define FD_RECALIBRATE_REQUIRED 0x0008 /* bit 3 */
131 #define FD_ABIOS_PROVIDES_GAP_LEN 0x0020 /* bit 6 */
132 #define fd_drive_type(rb) *( (u_short *) &((rb)->un.uc[0x06]) )
133 #define FD_NO_DRIVE 0
134 #define FD_360_KB_DRIVE 1
135 #define FD_1440_KB_DRIVE 4
136 #define fd_motor_off_delay_time(rb) *( (u_int *) &((rb)->un.uc[0x0c]) )
137 #define fd_motor_start_delay_time(rb) *( (u_int *) &((rb)->un.uc[0x10]) )
138 #define fd_num_of_cylinders(rb) *( (u_short *) &((rb)->un.uc[0x16]) )
139 #define fd_num_of_heads(rb) *( (u_char *) &((rb)->un.uc[0x1a]) )
140 #define fd_retry_count(rb) *( (u_char *) &((rb)->un.uc[0x1b]) )
141 #define fd_format_fill_byte(rb) *( (u_char *) &((rb)->un.uc[0x1c]) )
142 #define fd_head_settle_time(rb) *( (u_int *) &((rb)->un.uc[0x1d]) )
143 #define fd_rwv_gap_len(rb) *( (u_char *) &((rb)->un.uc[0x21]) )
144 #define fd_format_gap_len(rb) *( (u_char *) &((rb)->un.uc[0x22]) )
145 #define fd_data_len(rb) *( (u_char *) &((rb)->un.uc[0x23]) )
146
147
148 /* For ABIOS_WRITE_PARAMETER (0x04)
149 ** - Set device parameters
150 ** INPUT: this ABIOS service is currently unused
151 ** OUTPUT: none
152 */
153 #define FD_SET_RESERVED_ABIOS_WRITE_PARAMETER(rb) \
154 *((u_short *)&(rb)->un.uc[0x00]) = 0;
155
156
157 /* For ABIOS_RESET (0x05)
158 ** - resets the diskette system to an initial state
159 ** INPUT: none
160 ** OUTPUT: none
161 */
162 #define FD_SET_RESERVED_ABIOS_RESET(rb) \
163 *( (u_short *) &((rb)->un.uc[0x00]) ) = 0;
164
165
166 /* For ABIOS_DISABLE_INTR (0x07)
167 ** - this ABIOS service is currently unused
168 ** INPUT: none
169 ** OUTPUT: none
170 */
171 #define FD_SET_RESERVED_ABIOS_DISABLE_INTR(rb) \
172 *((u_short *)&(rb)->un.uc[0x08]) = 0;
173
174
175 /* ABIOS_READ (0x08)
176 ** - Read data from the diskette
177 ** INPUT (of special note):
178 ** data_ptr_1 - Virtual address (not supported as of 1/90)
179 ** data_ptr_2 - Physical address
180 */
181 #define FD_SET_RESERVED_ABIOS_READ(rb) \
182 *( (u_short *) &((rb)->un.uc[0x00]) ) = 0; \
183 *( (u_short *) &((rb)->un.uc[0x06]) ) = 0; \
184 *( (u_short *) &((rb)->un.uc[0x08]) ) = 0; \
185 *( (u_short *) &((rb)->un.uc[0x0e]) ) = 0;
186
187 #define FD_TIME_TO_WAIT(rb) *( (u_int *) &((rb)->un.uc[0x10]) )
188 #define fd_data_ptr_1(rb) *( (u_int *) &((rb)->un.uc[0x02]) )
189 #define fd_data_ptr_2(rb) *( (u_int *) &((rb)->un.uc[0x0a]) )
190 #define fd_num_sector_rw(rb) *( (u_short *) &((rb)->un.uc[0x14]) )
191 #define fd_cylinder_num(rb) *( (u_short *) &((rb)->un.uc[0x16]) )
192 #define fd_head_num(rb) *( (u_char *) &((rb)->un.uc[0x1a]) )
193 #define fd_sector_num(rb) *( (u_short *) &((rb)->un.uc[0x21]) )
194 #define fd_xfer_sub_function(rb) *( (u_short *) &((rb)->un.uc[0x14]) )
195 #define FD_XFER_SUB_FORMAT 0
196
197 /* OUTPUT: */
198 #define fd_wait_time(rb) *( (u_int *) &((rb)->un.uc[0x10]) )
199 #define fd_sectors_moved(rb) *( (u_short *) &((rb)->un.uc[0x14]) )
200
201
202 /* ABIOS_WRITE (0x09)
203 ** - Write data to the diskette
204 ** INPUT/OUTPUT: see ABIOS_READ
205 */
206 #define FD_SET_RESERVED_ABIOS_WRITE(rb) FD_SET_RESERVED_ABIOS_READ(rb)
207
208
209 /* ABIOS_ADDITIONAL_XFER (0x0a)
210 ** - When the FD_XFER_SUB_FORMAT is set this formats a track
211 ** INPUT/OUTPUT: see ABIOS_READ
212 */
213 #define FD_SET_RESERVED_ABIOS_ADDITIONAL_XFER(rb) \
214 FD_SET_RESERVED_ABIOS_READ(rb)
215
216
217 /* ABIOS_FD_VERIFY_SECTOR (0x0b)
218 ** - Verify data on the diskette
219 ** - This ABIOS service is currently not used
220 **
221 ** INPUT: almost the same as ABIOS_READ
222 ** OUTPUT: see ABIOS_READ
223 */
224 #define FD_SET_RESERVED_ABIOS_FD_VERIFY_SECTOR(rb) \
225 *( (u_short *) &((rb)->un.uc[0x06]) ) = 0; \
226 *( (u_short *) &((rb)->un.uc[0x0e]) ) = 0;
227
228
229 /* ABIOS_FD_READ_MEDIA_TYPE (0x0c)
230 ** - reports the media type used on the last read/write/format
231 ** INPUT: none.
232 ** OUTPUT: see ABIOS_READ_PARAMETER
233 */
234 #define FD_SET_RESERVED_ABIOS_FD_READ_MEDIA_TYPE(rb) \
235 *( (u_short *) &((rb)->un.uc[0x06]) ) = 0;
236
237
238 /* ABIOS_FD_SET_MEDIA_TYPE (0x0d)
239 ** - sets the media type for a format
240 ** INPUT: see output of ABIOS_FD_READ_MEDIA_TYPE
241 ** OUTPUT: see READ_DATA
242 */
243 #define FD_SET_RESERVED_ABIOS_FD_SET_MEDIA_TYPE(rb) \
244 FD_SET_RESERVED_ABIOS_FD_READ_MEDIA_TYPE(rb)
245
246
247 /* ABIOS_FD_CHANGE_SIGNAL_STATUS (0x0e)
248 ** - reports if the diskette change signal is on
249 ** INPUT: none
250 ** OUTPUT: change signal status
251 */
252 #define FD_SET_RESERVED_ABIOS_FD_CHANGE_SIGNAL_STATUS(rb) \
253 FD_SET_RESERVED_ABIOS_FD_READ_MEDIA_TYPE(rb)
254
255 #define fd_change_signal_status(rb) *((u_char *)&((rb)->un.uc[0x00]))
256 #define FD_CHANGE_SIGNAL_INACTIVE 0
257 #define FD_CHANGE_SIGNAL_ACTIVE 6
258
259
260 /* ABIOS_FD_TURN_OFF_MOTOR (0x0f)
261 ** - turn the motor (and the light off)
262 ** INPUT/OUTPUT: none.
263 */
264 #define FD_SET_RESERVED_ABIOS_FD_TURN_OFF_MOTOR(rb) \
265 FD_SET_RESERVED_ABIOS_FD_READ_MEDIA_TYPE(rb)
266
267
268 /* For ABIOS_FD_INTERRUPT_STATUS (0x10)
269 ** - returns the diskette interrupt pending status
270 ** INPUT: none
271 ** OUTPUT: status of interrrupt
272 */
273 #define FD_SET_RESERVED_ABIOS_FD_INTERRUPT_STATUS(rb) \
274 FD_SET_RESERVED_ABIOS_FD_READ_MEDIA_TYPE(rb)
275
276 #define fd_interrupt_status(rb) *((u_char *)&(rb).un.uc[0x00])
277 #define FD_INTERRUPT_PENNDING(rb) 1
278
279
280 /* Diskette specific ABIOS error codes:
281 */
282 #define FDABIOS_WRITEPROTECTED 0x8003
283 #define FDABIOS_MEDIACHANGED 0x8006
284 #define FDABIOS_MEDIANOTPRESENT 0x800d
285 #define FDABIOS_DMAOVERRUN 0x9108
286 #define FDABIOS_BADCRC 0x9110
287 #define FDABIOS_CONTFAIL 0x9120
288 #define FDABIOS_SEEKFAIL 0x9140
289 #define FDABIOS_GENERALERROR 0x9180
290
291 #endif /* _H_FDABIOS */
Cache object: 52e4796e5321188ec6e39bdce529c1a4
|