]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/sys/sdi.h
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
35 * Revision 1.1.1.1 1998/09/22 21:05:48 wsanchez
36 * Import of Mac OS X kernel (~semeria)
38 * Revision 1.1.1.1 1998/03/07 02:25:59 wsanchez
39 * Import of OSF Mach kernel (~mburg)
41 * Revision 1.1.7.1 1996/09/17 16:34:56 bruel
42 * removed size_t, already defined in types.h.
45 * Revision 1.1.4.1 1996/04/17 17:48:54 davidp
46 * Created for use with SVR4 drivers.
47 * [1996/04/11 13:19:26 davidp]
49 * Revision 1.1.1.2 1996/03/04 17:53:46 calvert
50 * Created for use with SVR4 drivers.
54 /* In vi use ":set ts=4" to edit/view this file
59 #include "scsi/scsi_endian.h"
61 typedef u_long paddr_t
;
62 typedef u_int rm_key_t
;
64 typedef long hba_clock_t
;
66 typedef u_long major_t
;
67 typedef u_long minor_t
;
69 typedef u_long hba_buf_t
; /* just to satisfy declaration */
70 typedef u_long hba_uio_t
; /* just to satisfy declaration */
88 ulong_t idata_memaddr
;
89 uchar_t idata_ctlorder
;
91 ushort_t idata_ntargets
;
94 void *idata_intrcookie
;
110 #define HBA_SVR4_2_2 2
111 #define HBA_SVR4_2MP 3
113 #define HBA_VMASK 0xffff
115 #define HBA_IDATA_EXT 0x10000
116 #define HBA_EXT_INFO 0x20000
117 #define HBA_AUTOCONF 0x40000
123 #define INQ_LEN VID_LEN+PID_LEN+1
124 #define INQ_EXLEN INQ_LEN+REV_LEN
127 BITFIELD_2( unsigned char,
130 BITFIELD_2(unsigned char,
134 BITFIELD_2(unsigned char,
139 char id_vendor
[VID_LEN
];
140 char id_prod
[PID_LEN
];
141 char id_revnum
[REV_LEN
];
144 #define SCSI_INQ_CON 0x0
145 #define SCSI_INQ_TC 0x1
146 #define SCSI_INQ_TNC 0x3
159 BITFIELD_2(unsigned char,
166 #define SDI_SA_CT(c,t) (((c) << 3) | ((t) & 0x07))
167 #define SDI_HAN(sa) (((sa)->sa_ct >> 3) & 0x07)
168 #define SDI_TCN(sa) ((sa)->sa_ct & 0x07)
170 #define SDI_ETCN(sa) ((sa)->sa_exta)
171 #define SDI_EHAN(sa) (((sa)->sa_ct >> 3) & 0x1f)
174 struct sdi_edt
*hash_p
;
178 struct owner
*curdrv
;
179 struct owner
*owner_list
;
183 char inquiry
[INQ_EXLEN
];
184 struct scsi_adr scsi_adr
;
187 struct ident edt_ident
;
192 #define F_DMA_24 F_DMA
194 #define F_SCGTH 0x004
196 #define F_DMA_32 0x010
197 #define F_HDWREA 0x020
198 #define F_RESID 0x040
200 struct mod_operations
{
201 int (*modm_install
)(void);
202 int (*modm_remove
)(void);
203 int (*modm_info
)(void);
204 int (*modm_bind
)(void);
208 struct mod_operations
*ml_ops
;
212 struct mod_type_data
{
219 int (*mw_load
)(void);
220 int (*mw_unload
)(void);
221 void (*mw_halt
)(void);
223 struct modlink
*mw_modlink
;
230 typedef struct physreq
{
232 paddr_t phys_boundary
;
233 uchar_t phys_dmasize
;
234 uchar_t phys_max_scgth
;
236 void *phys_brkup_poolp
;
241 uchar_t bcb_addrtypes
;
244 size_t bcb_granularity
;
245 physreq_t
*bcb_physreqp
;
257 long (*hba_freeblk
)(struct hbadata
*hdp
, int cntlr
);
258 struct hbadata
*(*hba_getblk
)(int flag
, int cntlr
);
259 long (*hba_icmd
)(struct hbadata
*hdp
, int flag
);
260 void (*hba_getinfo
)(struct scsi_ad
*sap
,
261 struct hbagetinfo
*hgip
);
262 long (*hba_send
)(struct hbadata
*hdp
, int flag
);
263 int (*hba_xlat
)(struct hbadata
*hdp
, int bflag
, void *procp
,
265 int (*hba_open
)(void);
266 int (*hba_close
)(void);
267 int (*hba_ioctl
)(void);
273 #define HBA_TIMEOUT 0x04
275 #define SC_EXHAN(minor) (((minor) >> 5) & 0x1f)
276 #define SC_EXTCN(minor) ((((minor) >> 2) & 0x07) | ((minor >> 7) & 0x18))
277 #define SC_EXLUN(minor) (((minor) & 0x03) | ((minor>>10) & 0x1C))
278 #define SC_BUS(minor) (((minor) >> 15) & 0x07)
280 #define SC_MKMINOR(h,t,l,b) ( \
281 (((h) & 0x1f) << 5) | \
282 (((t) & 0x07) << 2) | (((t) & 0x18) << 7) | \
283 ((l) & 0x03) | (((l) & 0x1c) << 10) | \
284 (((b) & 0x07) << 15) \
287 #define SDI_NAMESZ 49
289 #define SM_POOLSIZE 28
290 #define LG_POOLSIZE (sizeof (struct xsb))
296 #define SCB_WRITE 0x00
297 #define SCB_READ 0x01
298 #define SCB_LINK 0x02
299 #define SCB_HAAD 0x04
300 #define SCB_PARTBLK 0x08
302 #define SDI_NOALLOC 0x00000000
303 #define SDI_ASW 0x00000001
304 #define SDI_LINKF0 0x00000002
305 #define SDI_LINKF1 0x00000003
306 #define SDI_QFLUSH 0xE0000004
307 #define SDI_ABORT 0xF0000005
308 #define SDI_RESET 0xF0000006
309 #define SDI_CRESET 0xD0000007
310 #define SDI_V2PERR 0xA0000008
311 #define SDI_TIME 0xD0000009
312 #define SDI_NOTEQ 0x8000000A
313 #define SDI_HAERR 0xE000000B
314 #define SDI_MEMERR 0xA000000C
315 #define SDI_SBUSER 0xA000000D
316 #define SDI_CKSTAT 0xD000000E
317 #define SDI_SCBERR 0x8000000F
318 #define SDI_OOS 0xA0000010
319 #define SDI_NOSELE 0x90000011
320 #define SDI_MISMAT 0x90000012
321 #define SDI_PROGRES 0x00000013
322 #define SDI_UNUSED 0x00000014
323 #define SDI_ONEIC 0x80000017
324 #define SDI_SFBERR 0x80000019
325 #define SDI_TCERR 0x9000001A
327 #define SDI_ERROR 0x80000000
328 #define SDI_RETRY 0x40000000
329 #define SDI_MESS 0x20000000
330 #define SDI_SUSPEND 0x10000000
332 #define SFB_NOPF 0x00
333 #define SFB_RESETM 0x01
334 #define SFB_ABORTM 0x02
335 #define SFB_FLUSHR 0x03
336 #define SFB_RESUME 0x04
337 #define SFB_SUSPEND 0x05
338 #define SFB_ADD_DEV 0x06
339 #define SFB_RM_DEV 0x07
340 #define SFB_PAUSE 0x08
341 #define SFB_CONTINUE 0x09
343 #define SDI_386_AT 0x06
344 #define SDI_386_MCA 0x07
345 #define SDI_386_EISA 0x08
348 #define SDI_RET_ERR -1
349 #define SDI_RET_RETRY 1
351 #define SDI_SEND 0x0081
352 #define SDI_TRESET 0x0082
353 #define SDI_BRESET 0x0084
354 #define HA_VER 0x0083
355 #define SDI_RESERVE 0x0085
356 #define SDI_RELEASE 0x0086
357 #define SDI_RESTAT 0x0087
358 #define HA_GETPARMS 0x008a
359 #define IHA_GETPARMS 0x008b
360 #define HA_SETPARMS 0x008c
361 #define IHA_SETPARMS 0x008d
362 #define HA_GETPPARMS 0x008e
366 BITFIELD_2(unsigned char,
370 BITFIELD_5(unsigned char,
380 uchar_t sd_qualifier
;
382 BITFIELD_5(unsigned char,
388 uchar_t sd_field
[2];
396 struct sense sb_sense
;
399 #define sc_priv sc_extra
404 ulong_t sc_comp_code
;
406 void (*sc_int
)(struct sb
*sbp
);
411 struct scsi_ad sc_dev
;
419 hba_clock_t sc_start
;
423 ulong_t sf_comp_code
;
425 void (*sf_int
)(struct sb
*sbp
);
426 struct scsi_ad sf_dev
;
439 #define SCB sb_b.b_scb
440 #define SFB sb_b.b_sfb
444 struct hbadata
*hbadata_p
;
445 struct owner
*owner_p
;
446 struct sb_extra extra
;
462 #define KM_SLEEP SLEEP
463 #define KM_NOSLEEP NOSLEEP
466 #define KM_PHYSCONTIG 8
473 void (*di_handler
)(int vect
);
477 #define MOD_INTR_MAGIC 0xEB13
478 #define MOD_INTR_VER 1
480 struct o_mod_drvintr
{
481 struct intr_info
*drv_intrinfo
;
482 void (*ihndler
)(int vect
);
485 #define MOD_INTRVER_MASK 0xff000000
486 #define MOD_INTRVER_42 0x01000000
488 #define INTRVER(infop) ((unsigned int)((infop)->ivect_no & MOD_INTRVER_MASK))
489 #define INTRNO(infop) ((infop)->ivect_no & ~MOD_INTRVER_MASK)
505 #endif /* _SYS_SDI_H_ */