FreeBSD/Linux Kernel Cross Reference
sys/i386ps2/gdabios.h
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 #ifndef _H_GDABIOS
32 #define _H_GDABIOS
33 /*
34 * COMPONENT: SYSXGD
35 *
36 * ORIGINS: 27
37 *
38 */
39
40 /*
41 * HISTORY
42 * $Log: gdabios.h,v $
43 * Revision 2.3 93/03/11 14:09:15 danner
44 * u_long -> u_int
45 * [93/03/09 danner]
46 *
47 * Revision 2.2 93/02/04 07:59:49 danner
48 * Integrate PS2 code from IBM.
49 * [93/01/18 prithvi]
50 *
51 */
52
53 #ifdef notdef
54 #include "abios.h"
55 #else
56 #include <i386ps2/abios.h>
57 #endif
58
59 /*
60 * ABIOS generic disk specific function codes.
61 */
62 #define ABIOS_GD_WRITE_VERIFY 0x0a
63 #define ABIOS_GD_VERIFY_BLOCK 0x0b
64 #define ABIOS_GD_INTERRUPT_STATUS 0x0c
65 #define ABIOS_GD_ENABLE_INTEL_BUFFER 0x0d
66 #define ABIOS_GD_DISABLE_INTEL_BUFFER 0x0e
67 #define ABIOS_GD_RETURN_INTEL_BUF_STAT 0x0f
68 #define ABIOS_GD_SET_DMA_PACING_FACTOR 0x10
69 #define ABIOS_GD_RET_DMA_PACING_FACTOR 0x11
70 #define ABIOS_GD_TRANSFER_SCB 0x12
71 #define ABIOS_GD_DEALLOCATE 0x14
72
73 /*
74 * Set up gd ABIOS request block, assuming request block length
75 * of GD_REQUEST_BLOCK_LEN+0x10 bytes. This should be sufficient.
76 * The real value can be found by issuing ABIOS_LOGICAL_PARAMETER
77 * function.
78 */
79 #define GD_REQUEST_BLOCK_LEN 160
80 struct Gd_request {
81 struct Request_header request_header; /* 0x00-0x0f abios.h */
82 union {
83 struct Logical_id_params logical_id_params;
84 u_char uc[GD_REQUEST_BLOCK_LEN];
85 } un;
86 };
87
88 /*
89 * For ABIOS_LOGICAL_PARAMETER (0x01)
90 * rc = 0 only. NO interrupt.
91 */
92 /* INPUT */
93 #define GD_SET_RESERVED_ABIOS_LOGICAL_PARAMETER(rb) \
94 { \
95 *((u_short *)&(rb).un.uc[0x0a]) = 0; \
96 *((u_short *)&(rb).un.uc[0x0c]) = 0; \
97 *((u_short *)&(rb).un.uc[0x0e]) = 0; \
98 }
99 /* OUTPUT */
100 /* defined in abios.h */
101
102 /*
103 * For ABIOS_READ_PARAMETER (0x03) function which returns info
104 * specific to the current DRIVE.
105 */
106 /* INPUT */
107 #define GD_SET_RESERVED_ABIOS_READ_PARAMETER(rb) \
108 { \
109 *((u_short *)&(rb).un.uc[0x08]) = 0; \
110 }
111 /* OUTPUT */
112 #define gd_sector_per_track(rb) *((u_short *)&(rb).un.uc[0x00])
113 #define gd_byte_per_sector(rb) *((u_short *)&(rb).un.uc[0x02])
114 #define GD_512_BYTE_PER_SECTOR 0x0002
115 #define gd_dev_ctrl_flag(rb) *((u_short *)&(rb).un.uc[0x04])
116 #define GD_PARAMS_INVALID 0x0001 /* bit 0 */
117 #define GD_POWER_OFF 0x0002 /* bit 1 */
118 #define GD_CHANGE_SIGNAL_AVAIL 0x0004 /* bit 2 */
119 #define GD_WRITE_MANY 0x0008 /* bit 3 */
120 #define GD_SUPPORT_CACHING 0x0010 /* bit 4 */
121 #define GD_READABLE 0x0020 /* bit 5 */
122 #define GD_LOCKABLE 0x0040 /* bit 6 */
123 #define GD_SEQUENTIAL 0x0080 /* bit 7 */
124 #define GD_EJECTABLE 0x0100 /* bit 8 */
125 #define GD_CONCURRENT 0x0200 /* bit 9 */
126 #define GD_ST506 0x0400 /* bit 10 */
127 #define GD_NO_FORMAT 0x0000 /* bits 11&12 */
128 #define GD_TRACK_FORMAT 0x0800 /* bits 11&12 */
129 #define GD_UNIT_FORMAT 0x1000 /* bits 11&12 */
130 #define GD_BOTH_FORMAT 0x1800 /* bits 11&12 */
131 #define GD_FORMAT_SUPPORT 0x1800
132 #define GD_SCSI_DEVICE 0x4000 /* bit 14 */
133 #define GD_SCB_TRANSFER_SUPPORT 0x8000 /* bit 15 */
134 #define gd_number_cylinders(rb) *((u_int *)&(rb).un.uc[0x08])
135 #define gd_number_heads(rb) *((u_char *)&(rb).un.uc[0x0c])
136 #define gd_max_retries(rb) *((u_char *)&(rb).un.uc[0x0d])
137 #define gd_max_block_number(rb) *((u_int *)&(rb).un.uc[0x10])
138 #define gd_max_transfer(rb) *((u_short *)&(rb).un.uc[0x1c])
139
140 /*
141 * For ABIOS_WRITE_PARAMETER (0x04)
142 */
143 /* Reserved for disk devices */
144 /* INPUT */
145 /* none */
146 /* OUTPUT */
147 /* none */
148
149 /*
150 * For ABIOS_RESET (0x05)
151 */
152 /* INPUT */
153 #define GD_SET_RESERVED_ABIOS_RESET(rb) \
154 { \
155 *((u_short *)&(rb).un.uc[0x00]) = 0; \
156 }
157 /* OUTPUT */
158 #define gd_wait_time(rb) *((u_int *)&(rb).un.uc[0x18])
159
160 /*
161 * For ABIOS_ENABLE_INTR (0x06)
162 */
163 /* Reserved for disk devices */
164 /* INPUT */
165 /* none */
166 /* OUTPUT */
167 /* none */
168
169 /*
170 * For ABIOS_DISABLE_INTR (0x07)
171 */
172 /* INPUT */
173 /* none */
174 /* OUTPUT */
175 /* none */
176
177 /*
178 * For ABIOS_READ (0x08)
179 * For ABIOS_WRITE (0x09)
180 * For ABIOS_GD_WRITE_VERIFY (0x0a)
181 * For ABIOS_GD_VERIFY_BLOCK (0x0b)
182 */
183 /* INPUT */
184 #define GD_SET_RESERVED_ABIOS_GD_VERIFY_BLOCK(rb) \
185 { \
186 *((u_short *)&(rb).un.uc[0x00]) = 0; \
187 *((u_short *)&(rb).un.uc[0x06]) = 0; \
188 *((u_short *)&(rb).un.uc[0x08]) = 0; \
189 *((u_short *)&(rb).un.uc[0x0e]) = 0; \
190 *((u_int *)&(rb).un.uc[0x14]) = 0; \
191 }
192 #define GD_SET_RESERVED_CACHING \
193 { \
194 *((u_char *)&(rb).un.uc[0x1e]) = 0; \
195 }
196 #define GD_SET_RESERVED_ABIOS_READ(rb) \
197 { \
198 *((u_short *)&(rb).un.uc[0x00]) = 0; \
199 *((u_short *)&(rb).un.uc[0x06]) = 0; \
200 *((u_short *)&(rb).un.uc[0x08]) = 0; \
201 *((u_short *)&(rb).un.uc[0x0e]) = 0; \
202 *((u_int *)&(rb).un.uc[0x14]) = 0; \
203 *((u_char *)&(rb).un.uc[0x1e]) = 0; \
204 }
205 #define GD_SET_RESERVED_ABIOS_WRITE(rb) \
206 { \
207 *((u_short *)&(rb).un.uc[0x00]) = 0; \
208 *((u_short *)&(rb).un.uc[0x06]) = 0; \
209 *((u_short *)&(rb).un.uc[0x08]) = 0; \
210 *((u_short *)&(rb).un.uc[0x0e]) = 0; \
211 *((u_int *)&(rb).un.uc[0x14]) = 0; \
212 *((u_char *)&(rb).un.uc[0x1e]) = 0; \
213 }
214 #define GD_SET_RESERVED_ABIOS_GD_WRITE_VERIFY(rb) \
215 { \
216 *((u_short *)&(rb).un.uc[0x00]) = 0; \
217 *((u_short *)&(rb).un.uc[0x06]) = 0; \
218 *((u_short *)&(rb).un.uc[0x08]) = 0; \
219 *((u_short *)&(rb).un.uc[0x0e]) = 0; \
220 *((u_int *)&(rb).un.uc[0x14]) = 0; \
221 *((u_char *)&(rb).un.uc[0x1e]) = 0; \
222 }
223
224 #define gd_logical_ptr(rb) *((u_int *)&(rb).un.uc[0x02])
225 #define gd_physical_ptr(rb) *((u_int *)&(rb).un.uc[0x0a])
226 #define gd_relative_block_address(rb) *((u_int *)&(rb).un.uc[0x10])
227 #define gd_blocks_to_read(rb) *((u_short *)&(rb).un.uc[0x1c])
228 #define gd_blocks_to_write(rb) *((u_short *)&(rb).un.uc[0x1c])
229 #define gd_caching_ok(rb) *((u_char *)&(rb).un.uc[0x1e])
230 #define GD_DONT_CACHE 0x01
231
232 /* OUTPUT */
233 /* gd_wait_time is the same as Reset/Initialize */
234 #define gd_blocks_read(rb) *((u_short *)&(rb).un.uc[0x1c])
235 #define gd_blocks_written(rb) *((u_short *)&(rb).un.uc[0x1c])
236 #define gd_soft_error(rb) *((u_short *)&(rb).un.uc[0x1f])
237 #define GD_NO_SOFT_ERROR 0x0000
238 #define gd_interrupt_status(rb) *((u_char *)&(rb).un.uc[0x00])
239 #define GD_NO_INTERRUPT_PENDING 0x00
240 #define GD_INTERRUPT_PENDING 0x01
241
242
243
244
245 /*
246 * For ABIOS_GD_ENABLE_INTEL_BUFFER (0x0d)
247 * For ABIOS_GD_DISABLE_INTEL_BUFFER (0x0e)
248 * For ABIOS_GD_RETURN_INTEL_BUF_STAT (0x0f)
249
250 */
251 /* INPUT */
252 #define GD_SET_RESERVED_ABIOS_GD_ENABLE_INTEL_BUFFER(rb) \
253 { \
254 *((u_short *)&(rb).un.uc[0x06]) = 0; \
255 }
256 #define GD_SET_RESERVED_ABIOS_GD_DISABLE_INTEL_BUFFER(rb) \
257 GD_SET_RESERVED_ABIOS_GD_ENABLE_INTEL_BUFFER(rb)
258 #define GD_SET_RESERVED_ABIOS_GD_RETURN_INTEL_BUF_STAT(rb) \
259 GD_SET_RESERVED_ABIOS_GD_ENABLE_INTEL_BUFFER(rb)
260 /* OUTPUT */
261 /* gd_wait_time is the same as Reset/Initialize */
262 #define gd_intel_buffer_status(rb) *((u_char *)&(rb).un.uc[0x00])
263 #define GD_INTEL_BUFFER_DISABLED 0x01
264 /*
265 * For ABIOS_GD_SET_DMA_PACING_FACTOR (0x10)
266 * For ABIOS_GD_RET_DMA_PACING_FACTOR (0x11)
267 */
268 /* INPUT */
269 #define GD_SET_RESERVED_ABIOS_GD_SET_DMA_PACING_FACTOR \
270 D_SET_RESERVED_ABIOS_GD_ENABLE_INTEL_BUFFER(rb)
271 #define GD_SET_RESERVED_ABIOS_GD_RET_DMA_PACING_FACTOR \
272 D_SET_RESERVED_ABIOS_GD_ENABLE_INTEL_BUFFER(rb)
273 #define gd_pacing_value(rb) *((u_char *)&(rb).un.uc[0x00])
274
275 /* OUTPUT */
276 /* gd_wait_time is the same as Reset/Initialize */
277 #define gd_return_pacing_value(rb) *((u_char *)&(rb).un.uc[0x00])
278
279 /*
280 * For ABIOS_GD_TRANSFER_SCB (0x12)
281 */
282 /* INPUT */
283 #define GD_SET_RESERVED_ABIOS_GD_TRANSFER_SCB(rb) \
284 { \
285 *((u_short *)&(rb).un.uc[0x04]) = 0; \
286 *((u_short *)&(rb).un.uc[0x0c]) = 0; \
287 *((u_short *)&(rb).un.uc[0x16]) = 0; \
288 *((u_short *)&(rb).un.uc[0x1c]) = 0; \
289 *((u_char *)&(rb).un.uc[0x1e]) = 0; \
290 }
291 #define gd_set_flags(rb) *((u_char *)&(rb).un.uc[0x1e])
292 #define GD_LONG_SCB 0x01
293
294 /* OUTPUT */
295 #define gd_last_scb(rb) *((u_int *)&(rb).un.uc[0x0e])
296 /* gd_wait_time is the same as Reset/Initialize */
297 /* gd_soft_errors is the same as Abios Read */
298
299 /*
300 * For ABIOS_GD_DEALLOCATE (0x14)
301 *
302 /* INPUT */
303 #define GD_SET_RESERVED_ABIOS_GD_DEALLOCATE(rb) \
304 { \
305 *((u_short *)&(rb).un.uc[0x06]) = 0; \
306 }
307 /* OUTPUT */
308 #define gd_scsi_disk_number(rb) *((u_short *)&(rb).un.uc[0x02])
309
310 struct hdsoft {
311 u_short status;
312 #define IDLE 0
313 #define IN_TRANSFER 1
314 #define BAD_BLOCK_RECOVER 2
315 #define PIO_TRANSFER 3
316 #define GET_PARAMETERS 4
317 #define GET_BAD_BLOCK 5
318 u_short retries;
319 u_short max_retry;
320 u_short max_transfer;
321 u_short blocks_left;
322 u_short hdtimeout;
323 u_short byte_per_block;
324 u_int last_block;
325 u_char irq;
326 };
327 #endif /* _H_GDABIOS */
Cache object: 2577208384e78ede7011d7ee15346524
|