]>
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 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
29 * Revision 1.1.1.1 1998/09/22 21:05:48 wsanchez
30 * Import of Mac OS X kernel (~semeria)
32 * Revision 1.1.1.1 1998/03/07 02:25:59 wsanchez
33 * Import of OSF Mach kernel (~mburg)
35 * Revision 1.1.7.1 1996/09/17 16:34:56 bruel
36 * removed size_t, already defined in types.h.
39 * Revision 1.1.4.1 1996/04/17 17:48:54 davidp
40 * Created for use with SVR4 drivers.
41 * [1996/04/11 13:19:26 davidp]
43 * Revision 1.1.1.2 1996/03/04 17:53:46 calvert
44 * Created for use with SVR4 drivers.
48 /* In vi use ":set ts=4" to edit/view this file
53 #include "scsi/scsi_endian.h"
55 typedef u_long paddr_t
;
56 typedef u_int rm_key_t
;
58 typedef long hba_clock_t
;
60 typedef u_long major_t
;
61 typedef u_long minor_t
;
63 typedef u_long hba_buf_t
; /* just to satisfy declaration */
64 typedef u_long hba_uio_t
; /* just to satisfy declaration */
82 ulong_t idata_memaddr
;
83 uchar_t idata_ctlorder
;
85 ushort_t idata_ntargets
;
88 void *idata_intrcookie
;
104 #define HBA_SVR4_2_2 2
105 #define HBA_SVR4_2MP 3
107 #define HBA_VMASK 0xffff
109 #define HBA_IDATA_EXT 0x10000
110 #define HBA_EXT_INFO 0x20000
111 #define HBA_AUTOCONF 0x40000
117 #define INQ_LEN VID_LEN+PID_LEN+1
118 #define INQ_EXLEN INQ_LEN+REV_LEN
121 BITFIELD_2( unsigned char,
124 BITFIELD_2(unsigned char,
128 BITFIELD_2(unsigned char,
133 char id_vendor
[VID_LEN
];
134 char id_prod
[PID_LEN
];
135 char id_revnum
[REV_LEN
];
138 #define SCSI_INQ_CON 0x0
139 #define SCSI_INQ_TC 0x1
140 #define SCSI_INQ_TNC 0x3
153 BITFIELD_2(unsigned char,
160 #define SDI_SA_CT(c,t) (((c) << 3) | ((t) & 0x07))
161 #define SDI_HAN(sa) (((sa)->sa_ct >> 3) & 0x07)
162 #define SDI_TCN(sa) ((sa)->sa_ct & 0x07)
164 #define SDI_ETCN(sa) ((sa)->sa_exta)
165 #define SDI_EHAN(sa) (((sa)->sa_ct >> 3) & 0x1f)
168 struct sdi_edt
*hash_p
;
172 struct owner
*curdrv
;
173 struct owner
*owner_list
;
177 char inquiry
[INQ_EXLEN
];
178 struct scsi_adr scsi_adr
;
181 struct ident edt_ident
;
186 #define F_DMA_24 F_DMA
188 #define F_SCGTH 0x004
190 #define F_DMA_32 0x010
191 #define F_HDWREA 0x020
192 #define F_RESID 0x040
194 struct mod_operations
{
195 int (*modm_install
)(void);
196 int (*modm_remove
)(void);
197 int (*modm_info
)(void);
198 int (*modm_bind
)(void);
202 struct mod_operations
*ml_ops
;
206 struct mod_type_data
{
213 int (*mw_load
)(void);
214 int (*mw_unload
)(void);
215 void (*mw_halt
)(void);
217 struct modlink
*mw_modlink
;
224 typedef struct physreq
{
226 paddr_t phys_boundary
;
227 uchar_t phys_dmasize
;
228 uchar_t phys_max_scgth
;
230 void *phys_brkup_poolp
;
235 uchar_t bcb_addrtypes
;
238 size_t bcb_granularity
;
239 physreq_t
*bcb_physreqp
;
251 long (*hba_freeblk
)(struct hbadata
*hdp
, int cntlr
);
252 struct hbadata
*(*hba_getblk
)(int flag
, int cntlr
);
253 long (*hba_icmd
)(struct hbadata
*hdp
, int flag
);
254 void (*hba_getinfo
)(struct scsi_ad
*sap
,
255 struct hbagetinfo
*hgip
);
256 long (*hba_send
)(struct hbadata
*hdp
, int flag
);
257 int (*hba_xlat
)(struct hbadata
*hdp
, int bflag
, void *procp
,
259 int (*hba_open
)(void);
260 int (*hba_close
)(void);
261 int (*hba_ioctl
)(void);
267 #define HBA_TIMEOUT 0x04
269 #define SC_EXHAN(minor) (((minor) >> 5) & 0x1f)
270 #define SC_EXTCN(minor) ((((minor) >> 2) & 0x07) | ((minor >> 7) & 0x18))
271 #define SC_EXLUN(minor) (((minor) & 0x03) | ((minor>>10) & 0x1C))
272 #define SC_BUS(minor) (((minor) >> 15) & 0x07)
274 #define SC_MKMINOR(h,t,l,b) ( \
275 (((h) & 0x1f) << 5) | \
276 (((t) & 0x07) << 2) | (((t) & 0x18) << 7) | \
277 ((l) & 0x03) | (((l) & 0x1c) << 10) | \
278 (((b) & 0x07) << 15) \
281 #define SDI_NAMESZ 49
283 #define SM_POOLSIZE 28
284 #define LG_POOLSIZE (sizeof (struct xsb))
290 #define SCB_WRITE 0x00
291 #define SCB_READ 0x01
292 #define SCB_LINK 0x02
293 #define SCB_HAAD 0x04
294 #define SCB_PARTBLK 0x08
296 #define SDI_NOALLOC 0x00000000
297 #define SDI_ASW 0x00000001
298 #define SDI_LINKF0 0x00000002
299 #define SDI_LINKF1 0x00000003
300 #define SDI_QFLUSH 0xE0000004
301 #define SDI_ABORT 0xF0000005
302 #define SDI_RESET 0xF0000006
303 #define SDI_CRESET 0xD0000007
304 #define SDI_V2PERR 0xA0000008
305 #define SDI_TIME 0xD0000009
306 #define SDI_NOTEQ 0x8000000A
307 #define SDI_HAERR 0xE000000B
308 #define SDI_MEMERR 0xA000000C
309 #define SDI_SBUSER 0xA000000D
310 #define SDI_CKSTAT 0xD000000E
311 #define SDI_SCBERR 0x8000000F
312 #define SDI_OOS 0xA0000010
313 #define SDI_NOSELE 0x90000011
314 #define SDI_MISMAT 0x90000012
315 #define SDI_PROGRES 0x00000013
316 #define SDI_UNUSED 0x00000014
317 #define SDI_ONEIC 0x80000017
318 #define SDI_SFBERR 0x80000019
319 #define SDI_TCERR 0x9000001A
321 #define SDI_ERROR 0x80000000
322 #define SDI_RETRY 0x40000000
323 #define SDI_MESS 0x20000000
324 #define SDI_SUSPEND 0x10000000
326 #define SFB_NOPF 0x00
327 #define SFB_RESETM 0x01
328 #define SFB_ABORTM 0x02
329 #define SFB_FLUSHR 0x03
330 #define SFB_RESUME 0x04
331 #define SFB_SUSPEND 0x05
332 #define SFB_ADD_DEV 0x06
333 #define SFB_RM_DEV 0x07
334 #define SFB_PAUSE 0x08
335 #define SFB_CONTINUE 0x09
337 #define SDI_386_AT 0x06
338 #define SDI_386_MCA 0x07
339 #define SDI_386_EISA 0x08
342 #define SDI_RET_ERR -1
343 #define SDI_RET_RETRY 1
345 #define SDI_SEND 0x0081
346 #define SDI_TRESET 0x0082
347 #define SDI_BRESET 0x0084
348 #define HA_VER 0x0083
349 #define SDI_RESERVE 0x0085
350 #define SDI_RELEASE 0x0086
351 #define SDI_RESTAT 0x0087
352 #define HA_GETPARMS 0x008a
353 #define IHA_GETPARMS 0x008b
354 #define HA_SETPARMS 0x008c
355 #define IHA_SETPARMS 0x008d
356 #define HA_GETPPARMS 0x008e
360 BITFIELD_2(unsigned char,
364 BITFIELD_5(unsigned char,
374 uchar_t sd_qualifier
;
376 BITFIELD_5(unsigned char,
382 uchar_t sd_field
[2];
390 struct sense sb_sense
;
393 #define sc_priv sc_extra
398 ulong_t sc_comp_code
;
400 void (*sc_int
)(struct sb
*sbp
);
405 struct scsi_ad sc_dev
;
413 hba_clock_t sc_start
;
417 ulong_t sf_comp_code
;
419 void (*sf_int
)(struct sb
*sbp
);
420 struct scsi_ad sf_dev
;
433 #define SCB sb_b.b_scb
434 #define SFB sb_b.b_sfb
438 struct hbadata
*hbadata_p
;
439 struct owner
*owner_p
;
440 struct sb_extra extra
;
456 #define KM_SLEEP SLEEP
457 #define KM_NOSLEEP NOSLEEP
460 #define KM_PHYSCONTIG 8
467 void (*di_handler
)(int vect
);
471 #define MOD_INTR_MAGIC 0xEB13
472 #define MOD_INTR_VER 1
474 struct o_mod_drvintr
{
475 struct intr_info
*drv_intrinfo
;
476 void (*ihndler
)(int vect
);
479 #define MOD_INTRVER_MASK 0xff000000
480 #define MOD_INTRVER_42 0x01000000
482 #define INTRVER(infop) ((unsigned int)((infop)->ivect_no & MOD_INTRVER_MASK))
483 #define INTRNO(infop) ((infop)->ivect_no & ~MOD_INTRVER_MASK)
499 #endif /* _SYS_SDI_H_ */