]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/sys/sdi.h
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
32 * Revision 1.1.1.1 1998/09/22 21:05:48 wsanchez
33 * Import of Mac OS X kernel (~semeria)
35 * Revision 1.1.1.1 1998/03/07 02:25:59 wsanchez
36 * Import of OSF Mach kernel (~mburg)
38 * Revision 1.1.7.1 1996/09/17 16:34:56 bruel
39 * removed size_t, already defined in types.h.
42 * Revision 1.1.4.1 1996/04/17 17:48:54 davidp
43 * Created for use with SVR4 drivers.
44 * [1996/04/11 13:19:26 davidp]
46 * Revision 1.1.1.2 1996/03/04 17:53:46 calvert
47 * Created for use with SVR4 drivers.
51 /* In vi use ":set ts=4" to edit/view this file
56 #include "scsi/scsi_endian.h"
58 typedef u_long paddr_t
;
59 typedef u_int rm_key_t
;
61 typedef long hba_clock_t
;
63 typedef u_long major_t
;
64 typedef u_long minor_t
;
66 typedef u_long hba_buf_t
; /* just to satisfy declaration */
67 typedef u_long hba_uio_t
; /* just to satisfy declaration */
85 ulong_t idata_memaddr
;
86 uchar_t idata_ctlorder
;
88 ushort_t idata_ntargets
;
91 void *idata_intrcookie
;
107 #define HBA_SVR4_2_2 2
108 #define HBA_SVR4_2MP 3
110 #define HBA_VMASK 0xffff
112 #define HBA_IDATA_EXT 0x10000
113 #define HBA_EXT_INFO 0x20000
114 #define HBA_AUTOCONF 0x40000
120 #define INQ_LEN VID_LEN+PID_LEN+1
121 #define INQ_EXLEN INQ_LEN+REV_LEN
124 BITFIELD_2( unsigned char,
127 BITFIELD_2(unsigned char,
131 BITFIELD_2(unsigned char,
136 char id_vendor
[VID_LEN
];
137 char id_prod
[PID_LEN
];
138 char id_revnum
[REV_LEN
];
141 #define SCSI_INQ_CON 0x0
142 #define SCSI_INQ_TC 0x1
143 #define SCSI_INQ_TNC 0x3
156 BITFIELD_2(unsigned char,
163 #define SDI_SA_CT(c,t) (((c) << 3) | ((t) & 0x07))
164 #define SDI_HAN(sa) (((sa)->sa_ct >> 3) & 0x07)
165 #define SDI_TCN(sa) ((sa)->sa_ct & 0x07)
167 #define SDI_ETCN(sa) ((sa)->sa_exta)
168 #define SDI_EHAN(sa) (((sa)->sa_ct >> 3) & 0x1f)
171 struct sdi_edt
*hash_p
;
175 struct owner
*curdrv
;
176 struct owner
*owner_list
;
180 char inquiry
[INQ_EXLEN
];
181 struct scsi_adr scsi_adr
;
184 struct ident edt_ident
;
189 #define F_DMA_24 F_DMA
191 #define F_SCGTH 0x004
193 #define F_DMA_32 0x010
194 #define F_HDWREA 0x020
195 #define F_RESID 0x040
197 struct mod_operations
{
198 int (*modm_install
)(void);
199 int (*modm_remove
)(void);
200 int (*modm_info
)(void);
201 int (*modm_bind
)(void);
205 struct mod_operations
*ml_ops
;
209 struct mod_type_data
{
216 int (*mw_load
)(void);
217 int (*mw_unload
)(void);
218 void (*mw_halt
)(void);
220 struct modlink
*mw_modlink
;
227 typedef struct physreq
{
229 paddr_t phys_boundary
;
230 uchar_t phys_dmasize
;
231 uchar_t phys_max_scgth
;
233 void *phys_brkup_poolp
;
238 uchar_t bcb_addrtypes
;
241 size_t bcb_granularity
;
242 physreq_t
*bcb_physreqp
;
254 long (*hba_freeblk
)(struct hbadata
*hdp
, int cntlr
);
255 struct hbadata
*(*hba_getblk
)(int flag
, int cntlr
);
256 long (*hba_icmd
)(struct hbadata
*hdp
, int flag
);
257 void (*hba_getinfo
)(struct scsi_ad
*sap
,
258 struct hbagetinfo
*hgip
);
259 long (*hba_send
)(struct hbadata
*hdp
, int flag
);
260 int (*hba_xlat
)(struct hbadata
*hdp
, int bflag
, void *procp
,
262 int (*hba_open
)(void);
263 int (*hba_close
)(void);
264 int (*hba_ioctl
)(void);
270 #define HBA_TIMEOUT 0x04
272 #define SC_EXHAN(minor) (((minor) >> 5) & 0x1f)
273 #define SC_EXTCN(minor) ((((minor) >> 2) & 0x07) | ((minor >> 7) & 0x18))
274 #define SC_EXLUN(minor) (((minor) & 0x03) | ((minor>>10) & 0x1C))
275 #define SC_BUS(minor) (((minor) >> 15) & 0x07)
277 #define SC_MKMINOR(h,t,l,b) ( \
278 (((h) & 0x1f) << 5) | \
279 (((t) & 0x07) << 2) | (((t) & 0x18) << 7) | \
280 ((l) & 0x03) | (((l) & 0x1c) << 10) | \
281 (((b) & 0x07) << 15) \
284 #define SDI_NAMESZ 49
286 #define SM_POOLSIZE 28
287 #define LG_POOLSIZE (sizeof (struct xsb))
293 #define SCB_WRITE 0x00
294 #define SCB_READ 0x01
295 #define SCB_LINK 0x02
296 #define SCB_HAAD 0x04
297 #define SCB_PARTBLK 0x08
299 #define SDI_NOALLOC 0x00000000
300 #define SDI_ASW 0x00000001
301 #define SDI_LINKF0 0x00000002
302 #define SDI_LINKF1 0x00000003
303 #define SDI_QFLUSH 0xE0000004
304 #define SDI_ABORT 0xF0000005
305 #define SDI_RESET 0xF0000006
306 #define SDI_CRESET 0xD0000007
307 #define SDI_V2PERR 0xA0000008
308 #define SDI_TIME 0xD0000009
309 #define SDI_NOTEQ 0x8000000A
310 #define SDI_HAERR 0xE000000B
311 #define SDI_MEMERR 0xA000000C
312 #define SDI_SBUSER 0xA000000D
313 #define SDI_CKSTAT 0xD000000E
314 #define SDI_SCBERR 0x8000000F
315 #define SDI_OOS 0xA0000010
316 #define SDI_NOSELE 0x90000011
317 #define SDI_MISMAT 0x90000012
318 #define SDI_PROGRES 0x00000013
319 #define SDI_UNUSED 0x00000014
320 #define SDI_ONEIC 0x80000017
321 #define SDI_SFBERR 0x80000019
322 #define SDI_TCERR 0x9000001A
324 #define SDI_ERROR 0x80000000
325 #define SDI_RETRY 0x40000000
326 #define SDI_MESS 0x20000000
327 #define SDI_SUSPEND 0x10000000
329 #define SFB_NOPF 0x00
330 #define SFB_RESETM 0x01
331 #define SFB_ABORTM 0x02
332 #define SFB_FLUSHR 0x03
333 #define SFB_RESUME 0x04
334 #define SFB_SUSPEND 0x05
335 #define SFB_ADD_DEV 0x06
336 #define SFB_RM_DEV 0x07
337 #define SFB_PAUSE 0x08
338 #define SFB_CONTINUE 0x09
340 #define SDI_386_AT 0x06
341 #define SDI_386_MCA 0x07
342 #define SDI_386_EISA 0x08
345 #define SDI_RET_ERR -1
346 #define SDI_RET_RETRY 1
348 #define SDI_SEND 0x0081
349 #define SDI_TRESET 0x0082
350 #define SDI_BRESET 0x0084
351 #define HA_VER 0x0083
352 #define SDI_RESERVE 0x0085
353 #define SDI_RELEASE 0x0086
354 #define SDI_RESTAT 0x0087
355 #define HA_GETPARMS 0x008a
356 #define IHA_GETPARMS 0x008b
357 #define HA_SETPARMS 0x008c
358 #define IHA_SETPARMS 0x008d
359 #define HA_GETPPARMS 0x008e
363 BITFIELD_2(unsigned char,
367 BITFIELD_5(unsigned char,
377 uchar_t sd_qualifier
;
379 BITFIELD_5(unsigned char,
385 uchar_t sd_field
[2];
393 struct sense sb_sense
;
396 #define sc_priv sc_extra
401 ulong_t sc_comp_code
;
403 void (*sc_int
)(struct sb
*sbp
);
408 struct scsi_ad sc_dev
;
416 hba_clock_t sc_start
;
420 ulong_t sf_comp_code
;
422 void (*sf_int
)(struct sb
*sbp
);
423 struct scsi_ad sf_dev
;
436 #define SCB sb_b.b_scb
437 #define SFB sb_b.b_sfb
441 struct hbadata
*hbadata_p
;
442 struct owner
*owner_p
;
443 struct sb_extra extra
;
459 #define KM_SLEEP SLEEP
460 #define KM_NOSLEEP NOSLEEP
463 #define KM_PHYSCONTIG 8
470 void (*di_handler
)(int vect
);
474 #define MOD_INTR_MAGIC 0xEB13
475 #define MOD_INTR_VER 1
477 struct o_mod_drvintr
{
478 struct intr_info
*drv_intrinfo
;
479 void (*ihndler
)(int vect
);
482 #define MOD_INTRVER_MASK 0xff000000
483 #define MOD_INTRVER_42 0x01000000
485 #define INTRVER(infop) ((unsigned int)((infop)->ivect_no & MOD_INTRVER_MASK))
486 #define INTRNO(infop) ((infop)->ivect_no & ~MOD_INTRVER_MASK)
502 #endif /* _SYS_SDI_H_ */