]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/sys/sdi.h
aa01ece2bafec8eea3d7c985f52c6b4d83b41300
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_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. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
30 * Revision 1.1.1.1 1998/09/22 21:05:48 wsanchez
31 * Import of Mac OS X kernel (~semeria)
33 * Revision 1.1.1.1 1998/03/07 02:25:59 wsanchez
34 * Import of OSF Mach kernel (~mburg)
36 * Revision 1.1.7.1 1996/09/17 16:34:56 bruel
37 * removed size_t, already defined in types.h.
40 * Revision 1.1.4.1 1996/04/17 17:48:54 davidp
41 * Created for use with SVR4 drivers.
42 * [1996/04/11 13:19:26 davidp]
44 * Revision 1.1.1.2 1996/03/04 17:53:46 calvert
45 * Created for use with SVR4 drivers.
49 /* In vi use ":set ts=4" to edit/view this file
54 #include "scsi/scsi_endian.h"
56 typedef u_long paddr_t
;
57 typedef u_int rm_key_t
;
59 typedef long hba_clock_t
;
61 typedef u_long major_t
;
62 typedef u_long minor_t
;
64 typedef u_long hba_buf_t
; /* just to satisfy declaration */
65 typedef u_long hba_uio_t
; /* just to satisfy declaration */
83 ulong_t idata_memaddr
;
84 uchar_t idata_ctlorder
;
86 ushort_t idata_ntargets
;
89 void *idata_intrcookie
;
105 #define HBA_SVR4_2_2 2
106 #define HBA_SVR4_2MP 3
108 #define HBA_VMASK 0xffff
110 #define HBA_IDATA_EXT 0x10000
111 #define HBA_EXT_INFO 0x20000
112 #define HBA_AUTOCONF 0x40000
118 #define INQ_LEN VID_LEN+PID_LEN+1
119 #define INQ_EXLEN INQ_LEN+REV_LEN
122 BITFIELD_2( unsigned char,
125 BITFIELD_2(unsigned char,
129 BITFIELD_2(unsigned char,
134 char id_vendor
[VID_LEN
];
135 char id_prod
[PID_LEN
];
136 char id_revnum
[REV_LEN
];
139 #define SCSI_INQ_CON 0x0
140 #define SCSI_INQ_TC 0x1
141 #define SCSI_INQ_TNC 0x3
154 BITFIELD_2(unsigned char,
161 #define SDI_SA_CT(c,t) (((c) << 3) | ((t) & 0x07))
162 #define SDI_HAN(sa) (((sa)->sa_ct >> 3) & 0x07)
163 #define SDI_TCN(sa) ((sa)->sa_ct & 0x07)
165 #define SDI_ETCN(sa) ((sa)->sa_exta)
166 #define SDI_EHAN(sa) (((sa)->sa_ct >> 3) & 0x1f)
169 struct sdi_edt
*hash_p
;
173 struct owner
*curdrv
;
174 struct owner
*owner_list
;
178 char inquiry
[INQ_EXLEN
];
179 struct scsi_adr scsi_adr
;
182 struct ident edt_ident
;
187 #define F_DMA_24 F_DMA
189 #define F_SCGTH 0x004
191 #define F_DMA_32 0x010
192 #define F_HDWREA 0x020
193 #define F_RESID 0x040
195 struct mod_operations
{
196 int (*modm_install
)(void);
197 int (*modm_remove
)(void);
198 int (*modm_info
)(void);
199 int (*modm_bind
)(void);
203 struct mod_operations
*ml_ops
;
207 struct mod_type_data
{
214 int (*mw_load
)(void);
215 int (*mw_unload
)(void);
216 void (*mw_halt
)(void);
218 struct modlink
*mw_modlink
;
225 typedef struct physreq
{
227 paddr_t phys_boundary
;
228 uchar_t phys_dmasize
;
229 uchar_t phys_max_scgth
;
231 void *phys_brkup_poolp
;
236 uchar_t bcb_addrtypes
;
239 size_t bcb_granularity
;
240 physreq_t
*bcb_physreqp
;
252 long (*hba_freeblk
)(struct hbadata
*hdp
, int cntlr
);
253 struct hbadata
*(*hba_getblk
)(int flag
, int cntlr
);
254 long (*hba_icmd
)(struct hbadata
*hdp
, int flag
);
255 void (*hba_getinfo
)(struct scsi_ad
*sap
,
256 struct hbagetinfo
*hgip
);
257 long (*hba_send
)(struct hbadata
*hdp
, int flag
);
258 int (*hba_xlat
)(struct hbadata
*hdp
, int bflag
, void *procp
,
260 int (*hba_open
)(void);
261 int (*hba_close
)(void);
262 int (*hba_ioctl
)(void);
268 #define HBA_TIMEOUT 0x04
270 #define SC_EXHAN(minor) (((minor) >> 5) & 0x1f)
271 #define SC_EXTCN(minor) ((((minor) >> 2) & 0x07) | ((minor >> 7) & 0x18))
272 #define SC_EXLUN(minor) (((minor) & 0x03) | ((minor>>10) & 0x1C))
273 #define SC_BUS(minor) (((minor) >> 15) & 0x07)
275 #define SC_MKMINOR(h,t,l,b) ( \
276 (((h) & 0x1f) << 5) | \
277 (((t) & 0x07) << 2) | (((t) & 0x18) << 7) | \
278 ((l) & 0x03) | (((l) & 0x1c) << 10) | \
279 (((b) & 0x07) << 15) \
282 #define SDI_NAMESZ 49
284 #define SM_POOLSIZE 28
285 #define LG_POOLSIZE (sizeof (struct xsb))
291 #define SCB_WRITE 0x00
292 #define SCB_READ 0x01
293 #define SCB_LINK 0x02
294 #define SCB_HAAD 0x04
295 #define SCB_PARTBLK 0x08
297 #define SDI_NOALLOC 0x00000000
298 #define SDI_ASW 0x00000001
299 #define SDI_LINKF0 0x00000002
300 #define SDI_LINKF1 0x00000003
301 #define SDI_QFLUSH 0xE0000004
302 #define SDI_ABORT 0xF0000005
303 #define SDI_RESET 0xF0000006
304 #define SDI_CRESET 0xD0000007
305 #define SDI_V2PERR 0xA0000008
306 #define SDI_TIME 0xD0000009
307 #define SDI_NOTEQ 0x8000000A
308 #define SDI_HAERR 0xE000000B
309 #define SDI_MEMERR 0xA000000C
310 #define SDI_SBUSER 0xA000000D
311 #define SDI_CKSTAT 0xD000000E
312 #define SDI_SCBERR 0x8000000F
313 #define SDI_OOS 0xA0000010
314 #define SDI_NOSELE 0x90000011
315 #define SDI_MISMAT 0x90000012
316 #define SDI_PROGRES 0x00000013
317 #define SDI_UNUSED 0x00000014
318 #define SDI_ONEIC 0x80000017
319 #define SDI_SFBERR 0x80000019
320 #define SDI_TCERR 0x9000001A
322 #define SDI_ERROR 0x80000000
323 #define SDI_RETRY 0x40000000
324 #define SDI_MESS 0x20000000
325 #define SDI_SUSPEND 0x10000000
327 #define SFB_NOPF 0x00
328 #define SFB_RESETM 0x01
329 #define SFB_ABORTM 0x02
330 #define SFB_FLUSHR 0x03
331 #define SFB_RESUME 0x04
332 #define SFB_SUSPEND 0x05
333 #define SFB_ADD_DEV 0x06
334 #define SFB_RM_DEV 0x07
335 #define SFB_PAUSE 0x08
336 #define SFB_CONTINUE 0x09
338 #define SDI_386_AT 0x06
339 #define SDI_386_MCA 0x07
340 #define SDI_386_EISA 0x08
343 #define SDI_RET_ERR -1
344 #define SDI_RET_RETRY 1
346 #define SDI_SEND 0x0081
347 #define SDI_TRESET 0x0082
348 #define SDI_BRESET 0x0084
349 #define HA_VER 0x0083
350 #define SDI_RESERVE 0x0085
351 #define SDI_RELEASE 0x0086
352 #define SDI_RESTAT 0x0087
353 #define HA_GETPARMS 0x008a
354 #define IHA_GETPARMS 0x008b
355 #define HA_SETPARMS 0x008c
356 #define IHA_SETPARMS 0x008d
357 #define HA_GETPPARMS 0x008e
361 BITFIELD_2(unsigned char,
365 BITFIELD_5(unsigned char,
375 uchar_t sd_qualifier
;
377 BITFIELD_5(unsigned char,
383 uchar_t sd_field
[2];
391 struct sense sb_sense
;
394 #define sc_priv sc_extra
399 ulong_t sc_comp_code
;
401 void (*sc_int
)(struct sb
*sbp
);
406 struct scsi_ad sc_dev
;
414 hba_clock_t sc_start
;
418 ulong_t sf_comp_code
;
420 void (*sf_int
)(struct sb
*sbp
);
421 struct scsi_ad sf_dev
;
434 #define SCB sb_b.b_scb
435 #define SFB sb_b.b_sfb
439 struct hbadata
*hbadata_p
;
440 struct owner
*owner_p
;
441 struct sb_extra extra
;
457 #define KM_SLEEP SLEEP
458 #define KM_NOSLEEP NOSLEEP
461 #define KM_PHYSCONTIG 8
468 void (*di_handler
)(int vect
);
472 #define MOD_INTR_MAGIC 0xEB13
473 #define MOD_INTR_VER 1
475 struct o_mod_drvintr
{
476 struct intr_info
*drv_intrinfo
;
477 void (*ihndler
)(int vect
);
480 #define MOD_INTRVER_MASK 0xff000000
481 #define MOD_INTRVER_42 0x01000000
483 #define INTRVER(infop) ((unsigned int)((infop)->ivect_no & MOD_INTRVER_MASK))
484 #define INTRNO(infop) ((infop)->ivect_no & ~MOD_INTRVER_MASK)
500 #endif /* _SYS_SDI_H_ */