Add the 'asr' driver, supplied by Mark Salyzyn of Adaptec (nee DPT).

This provides support for the Adaptec SCSI RAID controller family,
as well as the DPT SmartRAID V and VI families.

The driver will be maintained by Mark and Adaptec, and any changes
should be referred to the MAINTAINER.
This commit is contained in:
Mike Smith 2000-09-01 07:51:25 +00:00
parent aebf2d1dee
commit ef137fd32f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=65312
22 changed files with 12213 additions and 3 deletions

View File

@ -101,7 +101,8 @@ device aha 1
device aic
# RAID controllers interfaced to the SCSI subsystem
device dpt # DPT Smartcache - See NOTES for options!
device asr # DPT SmartRAID V, VI and Adaptec SCSI RAID
device dpt # DPT Smartcache III, IV - See NOTES for options!
device mly # Mylex AcceleRAID/eXtremeRAID
# SCSI peripherals

View File

@ -1273,6 +1273,12 @@ options ADW_ALLOW_MEMIO
#options SYM_SETUP_MAX_LUN #-Number of LUNs supported
# default:8, range:[1..64]
# The 'asr' driver provides support for current DPT/Adaptec SCSI RAID
# controllers (SmartRAID V and VI and later).
# These controllers require the CAM infrastructure.
#
device asr
# The 'dpt' driver provides support for old DPT controllers (http://www.dpt.com/).
# These have hardware RAID-{0,1,5} support, and do multi-initiator I/O.
# The DPT controllers are commonly re-licensed under other brand-names -

View File

@ -111,6 +111,7 @@ dev/an/if_an.c optional an
dev/an/if_an_isa.c optional an isa
dev/an/if_an_pccard.c optional an card
dev/an/if_an_pci.c optional an pci
dev/asr/asr.c optional asr pci
dev/awi/am79c930.c optional awi
dev/awi/awi.c optional awi
dev/awi/awi_wep.c optional awi

4373
sys/dev/asr/asr.c Normal file

File diff suppressed because it is too large Load Diff

385
sys/dev/asr/dptalign.h Normal file
View File

@ -0,0 +1,385 @@
/* $FreeBSD$ */
/*
* Copyright (c) 1996-1999 Distributed Processing Technology Corporation
* All rights reserved.
*
* Redistribution and use in source form, with or without modification, are
* permitted provided that redistributions of source code must retain the
* above copyright notice, this list of conditions and the following disclaimer.
*
* This software is provided `as is' by Distributed Processing Technology and
* any express or implied warranties, including, but not limited to, the
* implied warranties of merchantability and fitness for a particular purpose,
* are disclaimed. In no event shall Distributed Processing Technology be
* liable for any direct, indirect, incidental, special, exemplary or
* consequential damages (including, but not limited to, procurement of
* substitute goods or services; loss of use, data, or profits; or business
* interruptions) however caused and on any theory of liability, whether in
* contract, strict liability, or tort (including negligence or otherwise)
* arising in any way out of the use of x driver software, even if advised
* of the possibility of such damage.
*
* DPT Alignment Description File
*
*/
#if (!defined(__DPTALIGN_H))
#define __DPTALIGN_H
/*
* File - DPTALIGN.H
*
* Description: This file contains basic Alignment support definitions.
*
* Copyright Distributed Processing Technology, Corp.
* 140 Candace Dr.
* Maitland, Fl. 32751 USA
* Phone: (407) 830-5522 Fax: (407) 260-5366
* All Rights Reserved
*
* Author: Mark Salyzyn
* Date: Aug 29 1996
*
*
* Fifth Gen product enhancements and additions
* Author: Ben Ghofrani
* Date: April 6 1998
*/
/*
* Description: Support macros for active alignment
* Requires:
* osdLocal2(x)
* osdLocal4(x)
* osdSwap2(x)
* osdSwap4(x)
*/
#if (!defined(__FAR__))
# if (defined(__BORLANDC__))
# define __FAR__ far
# else
# define __FAR__
# endif
#endif
#if (defined(sun)) && (!defined(_ILP32))
# define DPT_4_BYTES int /* 64 bit OS */
#else
# define DPT_4_BYTES long
#endif
#if (!defined(osdSwap2))
/*
* Name: osdSwap2(value)
* Description: Mandatory byte swapping routine for words. We allow an
* override of x routine if the OS supplies it's own byte swapping
* routine, inline or macro.
*/
# define osdSwap2(x) (((unsigned short)(x) >> 8) \
| ((unsigned short)((unsigned char)(x)) << 8))
#endif
#if (!defined(osdSwap4))
/*
* Name: osdSwap4(value)
* Description: Mandatory byte swapping routine for DPT_4_BYTES words. We allow
* an override of x routine if the OS supplies it's own byte swapping
* routine, inline or macro. The following is universal, but may be
* more optimally performed by an OS or driver processor dependant
* routine.
*/
# define osdSwap4(x) ( \
(((unsigned DPT_4_BYTES)(x)) >> 24L) \
| ((unsigned DPT_4_BYTES)(((unsigned short)((unsigned DPT_4_BYTES)(x) >> 8L)) & 0xFF00)) \
| (((unsigned DPT_4_BYTES)(((unsigned short)(x)) & 0xFF00)) << 8L) \
| (((unsigned DPT_4_BYTES)((unsigned char)(x))) << 24L))
#endif
#if (!defined(osdLocal2))
/*
* Name: osdLocal2(pointer)
* Description: Local byte order to Big Endian Format for short words.
* Could be replaced with an OS defined localization routine, macro or
* inline.
*/
# if (defined(_DPT_BIG_ENDIAN))
# define osdLocal2(x) (*((unsigned short __FAR__ *)(x)))
# if (defined(osdSwap2))
# define osdSLocal2(x) osdSwap2(osdLocal2(x))
# else
# define osdSLocal2(x) ((unsigned short)(((unsigned char __FAR__ *)(x))[1])\
+ ((unsigned int)((unsigned short)(((unsigned char __FAR__ *)(x))[0])) << 8))
# endif
# else
# define osdSLocal2(x) (*((unsigned short __FAR__ *)(x)))
# if (defined(osdSwap2))
# define osdLocal2(x) osdSwap2(osdSLocal2(x))
# else
# define osdLocal2(x) ((unsigned short)(((unsigned char __FAR__*)(x))[1]) \
+ (((unsigned short)(((unsigned char __FAR__*)(x))[0])) << 8))
# endif
# endif
#endif
#if (!defined(osdLocal3))
/*
* Name: osdLocal3(pointer)
* Description: Local byte order to Big Endian Format for DPT_4_BYTES words.
* Could be replaced with an OS defined localization routine, macro or
* inline.
*/
# if (defined(_DPT_BIG_ENDIAN))
# define osdLocal3(x) (*((unsigned DPT_4_BYTES __FAR__ *)(x)))
# else
# if (defined(osdSwap3))
# define osdLocal3(x) osdSwap3(*((unsigned DPT_4_BYTES __FAR__ *)(x)))
# else
# define osdLocal3(x) ((unsigned DPT_4_BYTES)osdLocal2(((unsigned char __FAR__ *) \
(x)+1)) + (((unsigned DPT_4_BYTES)(((unsigned char __FAR__ *)(x))[0])) << 16))
# endif
# endif
#endif
#if (!defined(osdLocal4))
/*
* Name: osdLocal4(pointer)
* Description: Local byte order to Big Endian Format for DPT_4_BYTES words.
* Could be replaced with an OS defined localization routine, macro or
* inline.
*/
# if (defined(_DPT_BIG_ENDIAN))
# define osdLocal4(x) (*(unsigned DPT_4_BYTES __FAR__ *)(x))
# if (defined(osdSwap4))
# define osdSLocal4(x) osdSwap4(osdLocal4(x))
# else
# define osdSLocal4(x) ((unsigned DPT_4_BYTES)osdSLocal2(((unsigned char __FAR__ *)\
(x)+2)) + (((unsigned DPT_4_BYTES)((unsigned char __FAR__ *)(x))[1]) << 16) \
+ (((unsigned DPT_4_BYTES)((unsigned char __FAR__ *)(x))[0]) << 24))
# endif
# else
# define osdSLocal4(x) (*(unsigned DPT_4_BYTES __FAR__ *)(x))
# if (defined(osdSwap4))
# define osdLocal4(x) osdSwap4(osdSLocal4(x))
# else
# define osdLocal4(x) ((unsigned DPT_4_BYTES)osdLocal2(((unsigned char __FAR__ *) \
(x)+2)) + (((unsigned DPT_4_BYTES)((unsigned char __FAR__ *)(x))[1]) << 16) \
+ (((unsigned DPT_4_BYTES)((unsigned char __FAR__ *)(x))[0]) << 24))
# endif
# endif
#endif
#define I2O_TID_MASK ((unsigned DPT_4_BYTES) ((1L<<I2O_TID_SZ)-1))
/*
* Now the access macros used throughout in order to methodize the
* active alignment.
*/
#define getUP1(x,y) (((unsigned char __FAR__ *)(x))+(unsigned DPT_4_BYTES)(y))
#define getU1(x,y) (*getUP1(x,y))
#define setU1(x,y,z) (*((unsigned char *)getUP1(x,y)) = (unsigned char)(z))
#define orU1(x,y,z) (*getUP1(x,y) |= (unsigned char)(z))
#define andU1(x,y,z) (*getUP1(x,y) &= (unsigned char)(z))
#define getUP2(x,y) ((unsigned short __FAR__ *)(((unsigned char __FAR__ *) \
(x))+(unsigned DPT_4_BYTES)(y)))
#define getBU2(x,y) ((unsigned short)osdLocal2((unsigned short __FAR__ *) \
getUP1(x,y)))
#define getLU2(x,y) ((unsigned short)osdSLocal2((unsigned short __FAR__ *) \
getUP1(x,y)))
/* to be deleted */
#define getU2(x,y) ((unsigned short)osdLocal2((unsigned short __FAR__ *) \
getUP1(x,y)))
#if (!defined(setU2))
# define setU2(x,y,z) { unsigned short hold = (unsigned short)(z); \
*((unsigned short __FAR__ *)getUP1(x,y)) \
= osdLocal2(&hold); \
}
#endif
#if (!defined(setBU2))
# define setBU2(x,y,z) { unsigned short hold = (unsigned short)(z); \
*((unsigned short __FAR__ *)getUP1(x,y)) \
= osdLocal2(&hold); \
}
#endif
#if (!defined(setLU2))
# define setLU2(x,y,z) { unsigned short hold = (unsigned short)(z); \
*((unsigned short __FAR__ *)getUP1(x,y)) \
= osdSLocal2(&hold); \
}
#endif
/* to be deleted */
#define getU3(x,y) ((unsigned DPT_4_BYTES)osdLocal3((unsigned DPT_4_BYTES __FAR__ *) \
getUP1(x,y)))
#if (!defined(setU3))
# if (defined(_DPT_BIG_ENDIAN))
# define setU3(x,y,z) \
{ unsigned DPT_4_BYTES hold = z; \
*(getUP1(x,y)) = (unsigned char)(hold >> 16L); \
*((unsigned short __FAR__ *)(getUP1(x,y) + 1)) \
= (unsigned short)hold; \
}
# else
# define setU3(x,y,z) \
{ unsigned DPT_4_BYTES hold = z; \
*(getUP1(x,y) + 0) = (unsigned char)(hold >> 16) ; \
*(getUP1(x,y) + 1) = (unsigned char)(hold >> 8L); \
*(getUP1(x,y) + 2) = (unsigned char)(hold); \
}
# endif
#endif
/* up to here to be deleted */
#define getBU3(x,y) ((unsigned DPT_4_BYTES)osdLocal3((unsigned DPT_4_BYTES __FAR__ *) \
getUP1(x,y)))
#if (!defined(setBU3))
# if (defined(_DPT_BIG_ENDIAN))
# define setBU3(x,y,z) \
{ unsigned DPT_4_BYTES hold = z; \
*(getUP1(x,y)) = (unsigned char)(hold >> 16L); \
*((unsigned short __FAR__ *)(getUP1(x,y) + 1)) \
= (unsigned short)hold; \
}
# else
# define setBU3(x,y,z) \
{ unsigned DPT_4_BYTES hold = z; \
*(getUP1(x,y) + 0) = (unsigned char)(hold >> 16) ; \
*(getUP1(x,y) + 1) = (unsigned char)(hold >> 8L); \
*(getUP1(x,y) + 2) = (unsigned char)(hold); \
}
# endif
#endif
#define getUP4(x,y) ((unsigned DPT_4_BYTES __FAR__ *)(((unsigned char __FAR__ *) \
(x))+(unsigned DPT_4_BYTES)(y)))
#define getBU4(x,y) ((unsigned DPT_4_BYTES)osdLocal4((unsigned DPT_4_BYTES __FAR__ *) \
getUP1(x,y)))
#define getLU4(x,y) ((unsigned DPT_4_BYTES)osdSLocal4((unsigned DPT_4_BYTES __FAR__ *) \
getUP1(x,y)))
/* to be deleted */
#define getU4(x,y) ((unsigned DPT_4_BYTES)osdSLocal4((unsigned DPT_4_BYTES __FAR__ *) \
getUP1(x,y)))
#if (!defined(setU4))
# define setU4(x,y,z) { unsigned DPT_4_BYTES hold = z; \
*((unsigned DPT_4_BYTES __FAR__ *)getUP1(x,y)) \
= osdLocal4(&hold); \
}
#endif
/* up to here */
#if (!defined(setBU4))
# define setBU4(x,y,z) { unsigned DPT_4_BYTES hold = z; \
*((unsigned DPT_4_BYTES __FAR__ *)getUP1(x,y)) \
= osdLocal4(&hold); \
}
#endif
#if (!defined(setLU4))
# define setLU4(x,y,z) { unsigned DPT_4_BYTES hold = z; \
*((unsigned DPT_4_BYTES __FAR__ *)getUP1(x,y)) \
= osdSLocal4(&hold); \
}
#endif
#define osdSwap16bit(x) ( (((unsigned short )x & 0xf000) >> 12) | \
(((unsigned short )x & 0x0f00) >> 4) | \
(((unsigned short )x & 0x00f0) << 4) | \
(((unsigned short )x & 0x000f) << 12 ) )
/*
* note that in big endian a 12 bit number (0x123) is stored as 1203
*/
#define osdSwap12bit(x) (( (((unsigned short )x & 0x0f00) >> 8) | \
((unsigned short )x & 0x00f0) | \
(((unsigned short )x & 0x000f) << 8 ) ) )
#define osdSwap8bit(x) ( (((unsigned char )x & 0x0f) << 4) | \
(((unsigned char )x &0xf0) >> 4 ) )
#define getL24bit1(w,x,y) ((unsigned DPT_4_BYTES)((unsigned char __FAR__ *)(&w->x))[0+(y)] \
+ ((((unsigned DPT_4_BYTES)((unsigned char __FAR__ *)(&w->x))[1+(y)]) << 8) & 0xFF00) \
+ ((((unsigned DPT_4_BYTES)((unsigned char __FAR__ *)(&w->x))[2+(y)]) << 16) & 0xFF0000))
#define setL24bit1(w,x,y,z) { ((unsigned char __FAR__ *)(&w->x))[0+(y)] = (z); \
((unsigned char __FAR__ *)(&w->x))[1+(y)] = ((z) >> 8) & 0xFF; \
((unsigned char __FAR__ *)(&w->x))[2+(y)] = ((z) >> 16) & 0xFF; \
}
#define getL16bit(w,x,y) ((unsigned short)((unsigned char __FAR__ *)(&w->x))[0+(y)] \
+ ((((unsigned short)((unsigned char __FAR__ *)(&w->x))[1+(y)]) << 8) & 0xFF00))
#define setL16bit(w,x,y,z) { ((unsigned char __FAR__ *)(&w->x))[0+(y)] = (z); \
((unsigned char __FAR__ *)(&w->x))[1+(y)] = ((z) >> 8) & 0xFF; \
}
#define getL16bit2(w,x,y) ((unsigned short)((unsigned char __FAR__ *)(&w->x))[2+(y)] \
+ ((((unsigned short)((unsigned char __FAR__ *)(&w->x))[3+(y)]) << 8) & 0xFF00))
#define setL16bit2(w,x,y,z) { ((unsigned char __FAR__ *)(&w->x))[2+(y)] = (z); \
((unsigned char __FAR__ *)(&w->x))[3+(y)] = ((z) >> 8) & 0xFF; \
}
/* y is the number of bytes from beg of DPT_4_BYTES to get upper 4 bit of the addressed byte */
#define getL4bit(w,x,y) \
((unsigned char)(((unsigned char __FAR__ *)(&w->x))[0+(y)] >> 4) & 0x0f)
#define setL4bit(w,x,y,z) { \
((unsigned char __FAR__ *)(&w->x))[0+(y)] &= 0xF0; \
((unsigned char __FAR__ *)(&w->x))[0+(y)] |= ((z) << 4) & 0xF0; \
}
/* y is number of bytes from beg of DPT_4_BYTES */
#define getL1bit(w,x,y) \
((unsigned char)(((unsigned char __FAR__ *)(&w->x))[0+(y)] ) & 0x01)
#define setL1bit(w,x,y,z) { \
((unsigned char __FAR__ *)(&w->x))[0+(y)] &= 0xFE; \
((unsigned char __FAR__ *)(&w->x))[0+(y)] |= (z) & 0x01; \
}
#define getL1bit1(w,x,y) \
((unsigned char)(((unsigned char __FAR__ *)(&w->x))[0+(y)] >> 1) & 0x01)
#define setL1bit1(w,x,y,z) { \
((unsigned char __FAR__ *)(&w->x))[0+(y)] &= 0xFD; \
((unsigned char __FAR__ *)(&w->x))[0+(y)] |= (z << 1) & 0x02; \
}
/* 12 bit at the first 12 bits of a DPT_4_BYTES word */
#define getL12bit(w,x,y) ((unsigned short)((unsigned char __FAR__ *)(&w->x))[0+(y)] \
+ ((((unsigned short)((unsigned char __FAR__ *)(&w->x))[1+(y)]) << 8) & 0xF00))
#define setL12bit(w,x,y,z) { ((unsigned char __FAR__ *)(&w->x))[0+(y)] = (z); \
((unsigned char __FAR__ *)(&w->x))[1+(y)] &= 0xF0; \
((unsigned char __FAR__ *)(&w->x))[1+(y)] |= ((z) >> 8) & 0xF; \
}
/* 12 bit after another 12 bit in DPT_4_BYTES word */
#define getL12bit1(w,x,y) (((unsigned short)((unsigned char __FAR__ *)(&w->x))[1+(y)]) >> 4 \
+ ((((unsigned short)((unsigned char __FAR__ *)(&w->x))[2+(y)]) << 4) ))
#define setL12bit1(w,x,y,z) { ((unsigned char __FAR__ *)(&w->x))[1+(y)] &= 0x0F; \
((unsigned char __FAR__ *)(&w->x))[1+(y)] |= ((z) & 0xF) << 4; \
((unsigned char __FAR__ *)(&w->x))[2+(y)] &= 0x00;\
((unsigned char __FAR__ *)(&w->x))[2+(y)] |= ((z) >> 8) & 0xff;\
}
/* 12 at the 3rd byte in a DPT_4_BYTES word */
#define getL12bit2(w,x,y) ((unsigned short)((unsigned char __FAR__ *)(&w->x))[2+(y)] \
+ ((((unsigned short)((unsigned char __FAR__ *)(&w->x))[3+(y)]) << 8) & 0xF00))
#define setL12bit2(w,x,y,z) { ((unsigned char __FAR__ *)(&w->x))[2+(y)] = (z); \
((unsigned char __FAR__ *)(&w->x))[3+(y)] &= 0xF0; \
((unsigned char __FAR__ *)(&w->x))[3+(y)] |= ((z) >> 8) & 0xF; \
}
#define getL8bit(w,x,y) (\
(*(((unsigned char __FAR__ *)(&((w)->x)))\
+ y)) )
#define setL8bit(w,x,y,z) {\
(*(((unsigned char __FAR__ *)(&((w)->x)))\
+ y) = (z));\
}
#endif /* __DPTALIGN_H */

412
sys/dev/asr/dptsig.h Normal file
View File

@ -0,0 +1,412 @@
/* $FreeBSD$ */
/* BSDI dptsig.h,v 1.7 1998/06/03 19:15:00 karels Exp */
/*
* Copyright (c) 1996-2000 Distributed Processing Technology Corporation
* Copyright (c) 2000 Adaptec Corporation.
* All rights reserved.
*
* Redistribution and use in source form, with or without modification, are
* permitted provided that redistributions of source code must retain the
* above copyright notice, this list of conditions and the following disclaimer.
*
* This software is provided `as is' by Distributed Processing Technology and
* any express or implied warranties, including, but not limited to, the
* implied warranties of merchantability and fitness for a particular purpose,
* are disclaimed. In no event shall Distributed Processing Technology be
* liable for any direct, indirect, incidental, special, exemplary or
* consequential damages (including, but not limited to, procurement of
* substitute goods or services; loss of use, data, or profits; or business
* interruptions) however caused and on any theory of liability, whether in
* contract, strict liability, or tort (including negligence or otherwise)
* arising in any way out of the use of this driver software, even if advised
* of the possibility of such damage.
*
*/
#ifndef __DPTSIG_H_
#define __DPTSIG_H_
#ifdef _SINIX_ADDON
#include "dpt.h"
#endif
/* DPT SIGNATURE SPEC AND HEADER FILE */
/* Signature Version 1 (sorry no 'A') */
/* to make sure we are talking the same size under all OS's */
typedef unsigned char sigBYTE;
typedef unsigned short sigWORD;
#if (defined(_MULTI_DATAMODEL) && defined(sun) && !defined(_ILP32))
typedef uint32_t sigLONG;
#else
typedef unsigned long sigLONG;
#endif
/*
* use sigWORDLittleEndian for:
* dsCapabilities
* dsDeviceSupp
* dsAdapterSupp
* dsApplication
* use sigLONGLittleEndian for:
* dsOS
* so that the sig can be standardised to Little Endian
*/
#if (defined(_DPT_BIG_ENDIAN))
# define sigWORDLittleEndian(x) ((((x)&0xFF)<<8)|(((x)>>8)&0xFF))
# define sigLONGLittleEndian(x) \
((((x)&0xFF)<<24) | \
(((x)&0xFF00)<<8) | \
(((x)&0xFF0000L)>>8) | \
(((x)&0xFF000000L)>>24))
#else
# define sigWORDLittleEndian(x) (x)
# define sigLONGLittleEndian(x) (x)
#endif
/* must make sure the structure is not word or double-word aligned */
/* --------------------------------------------------------------- */
/* Borland will ignore the following pragma: */
/* Word alignment is OFF by default. If in the, IDE make */
/* sure that Options | Compiler | Code Generation | Word Alignment */
/* is not checked. If using BCC, do not use the -a option. */
#ifndef NO_PACK
#if defined (_DPT_AIX)
#pragma options align=packed
#else
#pragma pack(1)
#endif /* aix */
#endif
/* For the Macintosh */
#if STRUCTALIGNMENTSUPPORTED
#pragma options align=mac68k
#endif
/* Current Signature Version - sigBYTE dsSigVersion; */
/* ------------------------------------------------------------------ */
#define SIG_VERSION 1
/* Processor Family - sigBYTE dsProcessorFamily; DISTINCT VALUES */
/* ------------------------------------------------------------------ */
/* What type of processor the file is meant to run on. */
/* This will let us know whether to read sigWORDs as high/low or low/high. */
#define PROC_INTEL 0x00 /* Intel 80x86 */
#define PROC_MOTOROLA 0x01 /* Motorola 68K */
#define PROC_MIPS4000 0x02 /* MIPS RISC 4000 */
#define PROC_MIPS PROC_MIPS4000 /* MIPS RISC */
#define PROC_ALPHA 0x03 /* DEC Alpha */
#define PROC_POWERPC 0x04 /* IBM Power PC */
#define PROC_i960 0x05 /* Intel i960 */
#define PROC_ULTRASPARC 0x06 /* SPARC processor */
/* Specific Minimim Processor - sigBYTE dsProcessor; FLAG BITS */
/* ------------------------------------------------------------------ */
/* Different bit definitions dependent on processor_family */
/* PROC_INTEL: */
#define PROC_8086 0x01 /* Intel 8086 */
#define PROC_286 0x02 /* Intel 80286 */
#define PROC_386 0x04 /* Intel 80386 */
#define PROC_486 0x08 /* Intel 80486 */
#define PROC_PENTIUM 0x10 /* Intel 586 aka P5 aka Pentium */
#define PROC_SEXIUM 0x20 /* Intel 686 aka P6 aka Pentium Pro or MMX */
/* PROC_i960: */
#define PROC_960RX 0x01 /* Intel 80960RP/RD */
#define PROC_960HX 0x02 /* Intel 80960HA/HD/HT */
#define PROC_960RN 0x03 /* Intel 80960RN/RM */
#define PROC_960RS 0x04 /* Intel 80960RS */
/* PROC_MOTOROLA: */
#define PROC_68000 0x01 /* Motorola 68000 */
#define PROC_68010 0x02 /* Motorola 68010 */
#define PROC_68020 0x04 /* Motorola 68020 */
#define PROC_68030 0x08 /* Motorola 68030 */
#define PROC_68040 0x10 /* Motorola 68040 */
/* PROC_POWERPC */
#define PROC_PPC601 0x01 /* PowerPC 601 */
#define PROC_PPC603 0x02 /* PowerPC 603 */
#define PROC_PPC604 0x04 /* PowerPC 604 */
/* PROC_MIPS */
#define PROC_R4000 0x01 /* MIPS R4000 */
#define PROC_RM7000 0x02 /* MIPS RM7000 */
/* Filetype - sigBYTE dsFiletype; DISTINCT VALUES */
/* ------------------------------------------------------------------ */
#define FT_EXECUTABLE 0 /* Executable Program */
#define FT_SCRIPT 1 /* Script/Batch File??? */
#define FT_HBADRVR 2 /* HBA Driver */
#define FT_OTHERDRVR 3 /* Other Driver */
#define FT_IFS 4 /* Installable Filesystem Driver */
#define FT_ENGINE 5 /* DPT Engine */
#define FT_COMPDRVR 6 /* Compressed Driver Disk */
#define FT_LANGUAGE 7 /* Foreign Language file */
#define FT_FIRMWARE 8 /* Downloadable or actual Firmware */
#define FT_COMMMODL 9 /* Communications Module */
#define FT_INT13 10 /* INT 13 style HBA Driver */
#define FT_HELPFILE 11 /* Help file */
#define FT_LOGGER 12 /* Event Logger */
#define FT_INSTALL 13 /* An Install Program */
#define FT_LIBRARY 14 /* Storage Manager Real-Mode Calls */
#define FT_RESOURCE 15 /* Storage Manager Resource File */
#define FT_MODEM_DB 16 /* Storage Manager Modem Database */
/* Filetype flags - sigBYTE dsFiletypeFlags; FLAG BITS */
/* ------------------------------------------------------------------ */
#define FTF_DLL 0x01 /* Dynamic Link Library */
#define FTF_NLM 0x02 /* Netware Loadable Module */
#define FTF_OVERLAYS 0x04 /* Uses overlays */
#define FTF_DEBUG 0x08 /* Debug version */
#define FTF_TSR 0x10 /* TSR */
#define FTF_SYS 0x20 /* DOS Loadable driver */
#define FTF_PROTECTED 0x40 /* Runs in protected mode */
#define FTF_APP_SPEC 0x80 /* Application Specific */
#define FTF_ROM (FTF_SYS|FTF_TSR) /* Special Case */
/* OEM - sigBYTE dsOEM; DISTINCT VALUES */
/* ------------------------------------------------------------------ */
#define OEM_DPT 0 /* DPT */
#define OEM_ATT 1 /* ATT */
#define OEM_NEC 2 /* NEC */
#define OEM_ALPHA 3 /* Alphatronix */
#define OEM_AST 4 /* AST */
#define OEM_OLIVETTI 5 /* Olivetti */
#define OEM_SNI 6 /* Siemens/Nixdorf */
#define OEM_SUN 7 /* SUN Microsystems */
#define OEM_ADAPTEC 8 /* Adaptec */
/* Operating System - sigLONG dsOS; FLAG BITS */
/* ------------------------------------------------------------------ */
#define OS_DOS 0x00000001 /* PC/MS-DOS */
#define OS_WINDOWS 0x00000002 /* Microsoft Windows 3.x */
#define OS_WINDOWS_NT 0x00000004 /* Microsoft Windows NT */
#define OS_OS2M 0x00000008 /* OS/2 1.2.x,MS 1.3.0,IBM 1.3.x - Monolithic */
#define OS_OS2L 0x00000010 /* Microsoft OS/2 1.301 - LADDR */
#define OS_OS22x 0x00000020 /* IBM OS/2 2.x */
#define OS_NW286 0x00000040 /* Novell NetWare 286 */
#define OS_NW386 0x00000080 /* Novell NetWare 386 */
#define OS_GEN_UNIX 0x00000100 /* Generic Unix */
#define OS_SCO_UNIX 0x00000200 /* SCO Unix */
#define OS_ATT_UNIX 0x00000400 /* ATT Unix */
#define OS_UNIXWARE 0x00000800 /* USL Unix */
#define OS_INT_UNIX 0x00001000 /* Interactive Unix */
#define OS_SOLARIS 0x00002000 /* SunSoft Solaris */
#define OS_QNX 0x00004000 /* QNX for Tom Moch */
#define OS_NEXTSTEP 0x00008000 /* NeXTSTEP/OPENSTEP/MACH */
#define OS_BANYAN 0x00010000 /* Banyan Vines */
#define OS_OLIVETTI_UNIX 0x00020000/* Olivetti Unix */
#define OS_MAC_OS 0x00040000 /* Mac OS */
#define OS_WINDOWS_95 0x00080000 /* Microsoft Windows '95 */
#define OS_NW4x 0x00100000 /* Novell Netware 4.x */
#define OS_BSDI_UNIX 0x00200000 /* BSDi Unix BSD/OS 2.0 and up */
#define OS_AIX_UNIX 0x00400000 /* AIX Unix */
#define OS_FREE_BSD 0x00800000 /* FreeBSD Unix */
#define OS_LINUX 0x01000000 /* Linux */
#define OS_DGUX_UNIX 0x02000000 /* Data General Unix */
#define OS_SINIX_N 0x04000000 /* SNI SINIX-N */
#define OS_PLAN9 0x08000000 /* ATT Plan 9 */
#define OS_TSX 0x10000000 /* SNH TSX-32 */
#define OS_WINDOWS_98 0x20000000 /* Microsoft Windows '98 */
#define OS_OTHER 0x80000000 /* Other */
/* Capabilities - sigWORD dsCapabilities; FLAG BITS */
/* ------------------------------------------------------------------ */
#define CAP_RAID0 0x0001 /* RAID-0 */
#define CAP_RAID1 0x0002 /* RAID-1 */
#define CAP_RAID3 0x0004 /* RAID-3 */
#define CAP_RAID5 0x0008 /* RAID-5 */
#define CAP_SPAN 0x0010 /* Spanning */
#define CAP_PASS 0x0020 /* Provides passthrough */
#define CAP_OVERLAP 0x0040 /* Passthrough supports overlapped commands */
#define CAP_ASPI 0x0080 /* Supports ASPI Command Requests */
#define CAP_ABOVE16MB 0x0100 /* ISA Driver supports greater than 16MB */
#define CAP_EXTEND 0x8000 /* Extended info appears after description */
#ifdef SNI_MIPS
#define CAP_CACHEMODE 0x1000 /* dpt_force_cache is set in driver */
#endif
/* Devices Supported - sigWORD dsDeviceSupp; FLAG BITS */
/* ------------------------------------------------------------------ */
#define DEV_DASD 0x0001 /* DASD (hard drives) */
#define DEV_TAPE 0x0002 /* Tape drives */
#define DEV_PRINTER 0x0004 /* Printers */
#define DEV_PROC 0x0008 /* Processors */
#define DEV_WORM 0x0010 /* WORM drives */
#define DEV_CDROM 0x0020 /* CD-ROM drives */
#define DEV_SCANNER 0x0040 /* Scanners */
#define DEV_OPTICAL 0x0080 /* Optical Drives */
#define DEV_JUKEBOX 0x0100 /* Jukebox */
#define DEV_COMM 0x0200 /* Communications Devices */
#define DEV_OTHER 0x0400 /* Other Devices */
#define DEV_ALL 0xFFFF /* All SCSI Devices */
/* Adapters Families Supported - sigWORD dsAdapterSupp; FLAG BITS */
/* ------------------------------------------------------------------ */
#define ADF_2001 0x0001 /* PM2001 */
#define ADF_2012A 0x0002 /* PM2012A */
#define ADF_PLUS_ISA 0x0004 /* PM2011,PM2021 */
#define ADF_PLUS_EISA 0x0008 /* PM2012B,PM2022 */
#define ADF_SC3_ISA 0x0010 /* PM2021 */
#define ADF_SC3_EISA 0x0020 /* PM2022,PM2122, etc */
#define ADF_SC3_PCI 0x0040 /* SmartCache III PCI */
#define ADF_SC4_ISA 0x0080 /* SmartCache IV ISA */
#define ADF_SC4_EISA 0x0100 /* SmartCache IV EISA */
#define ADF_SC4_PCI 0x0200 /* SmartCache IV PCI */
#define ADF_SC5_PCI 0x0400 /* Fifth Generation I2O products */
/*
* Combinations of products
*/
#define ADF_ALL_2000 (ADF_2001|ADF_2012A)
#define ADF_ALL_PLUS (ADF_PLUS_ISA|ADF_PLUS_EISA)
#define ADF_ALL_SC3 (ADF_SC3_ISA|ADF_SC3_EISA|ADF_SC3_PCI)
#define ADF_ALL_SC4 (ADF_SC4_ISA|ADF_SC4_EISA|ADF_SC4_PCI)
#define ADF_ALL_SC5 (ADF_SC5_PCI)
/* All EATA Cacheing Products */
#define ADF_ALL_CACHE (ADF_ALL_PLUS|ADF_ALL_SC3|ADF_ALL_SC4)
/* All EATA Bus Mastering Products */
#define ADF_ALL_MASTER (ADF_2012A|ADF_ALL_CACHE)
/* All EATA Adapter Products */
#define ADF_ALL_EATA (ADF_2001|ADF_ALL_MASTER)
#define ADF_ALL ADF_ALL_EATA
/* Application - sigWORD dsApplication; FLAG BITS */
/* ------------------------------------------------------------------ */
#define APP_DPTMGR 0x0001 /* DPT Storage Manager */
#define APP_ENGINE 0x0002 /* DPT Engine */
#define APP_SYTOS 0x0004 /* Sytron Sytos Plus */
#define APP_CHEYENNE 0x0008 /* Cheyenne ARCServe + ARCSolo */
#define APP_MSCDEX 0x0010 /* Microsoft CD-ROM extensions */
#define APP_NOVABACK 0x0020 /* NovaStor Novaback */
#define APP_AIM 0x0040 /* Archive Information Manager */
/* Requirements - sigBYTE dsRequirements; FLAG BITS */
/* ------------------------------------------------------------------ */
#define REQ_SMARTROM 0x01 /* Requires SmartROM to be present */
#define REQ_DPTDDL 0x02 /* Requires DPTDDL.SYS to be loaded */
#define REQ_HBA_DRIVER 0x04 /* Requires an HBA driver to be loaded */
#define REQ_ASPI_TRAN 0x08 /* Requires an ASPI Transport Modules */
#define REQ_ENGINE 0x10 /* Requires a DPT Engine to be loaded */
#define REQ_COMM_ENG 0x20 /* Requires a DPT Communications Engine */
/* ------------------------------------------------------------------ */
/* Requirements - sigWORD dsFirmware; FLAG BITS */
/* ------------------------------------------------------------------ */
#define dsFirmware dsApplication
#define FW_DNLDSIZE0 0x0000 /* 0..2 DownLoader Size - NONE */
#define FW_DNLDSIZE16 0x0001 /* 0..2 DownLoader Size 16K */
#define FW_DNLDSIZE32 0x0002 /* 0..2 DownLoader Size 32K */
#define FW_DNLDSIZE64 0x0004 /* 0..2 DownLoader Size 64K */
#define FW_LOAD_BTM 0x2000 /* 13 Load Offset (1=Btm, 0=Top) */
#define FW_LOAD_TOP 0x0000 /* 13 Load Offset (1=Btm, 0=Top) */
#define FW_SIG_VERSION1 0x0000 /* 15..14 Version Bits 0=Ver1 */
/*
0..2 Downloader Size (Value * 16K)
3
4
5
6
7
8
9
10
11
12
13 Load Offset (1=BTM 0=TOP)
14..15 F/W Sig Version (0=Ver1)
*/
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
/*
* You may adjust dsDescription_size with an override to a value less than
* 50 so that the structure allocates less real space.
*/
#if (!defined(dsDescription_size))
# define dsDescription_size 50
#endif
typedef struct dpt_sig {
char dsSignature[6]; /* ALWAYS "dPtSiG" */
sigBYTE dsSigVersion; /* signature version (currently 1) */
sigBYTE dsProcessorFamily; /* what type of processor */
sigBYTE dsProcessor; /* precise processor */
sigBYTE dsFiletype; /* type of file */
sigBYTE dsFiletypeFlags; /* flags to specify load type, etc. */
sigBYTE dsOEM; /* OEM file was created for */
sigLONG dsOS; /* which Operating systems */
sigWORD dsCapabilities; /* RAID levels, etc. */
sigWORD dsDeviceSupp; /* Types of SCSI devices supported */
sigWORD dsAdapterSupp; /* DPT adapter families supported */
sigWORD dsApplication; /* applications file is for */
sigBYTE dsRequirements; /* Other driver dependencies */
sigBYTE dsVersion; /* 1 */
sigBYTE dsRevision; /* 'J' */
sigBYTE dsSubRevision; /* '9' ' ' if N/A */
sigBYTE dsMonth; /* creation month */
sigBYTE dsDay; /* creation day */
sigBYTE dsYear; /* creation year since 1980 (1993=13) */
/* description (NULL terminated) */
char dsDescription[dsDescription_size];
} dpt_sig_S;
/* 32 bytes minimum - with no description. Put NULL at description[0] */
/* 81 bytes maximum - with 49 character description plus NULL. */
#if defined __bsdi__
#ifndef PACK
#define PACK __attribute__ ((packed))
#endif
typedef struct dpt_sig_Packed {
char dsSignature[6] PACK; /* ALWAYS "dPtSiG" */
sigBYTE dsSigVersion PACK; /* signature version (currently 1) */
sigBYTE dsProcessorFamily PACK; /* what type of processor */
sigBYTE dsProcessor PACK; /* precise processor */
sigBYTE dsFiletype PACK; /* type of file */
sigBYTE dsFiletypeFlags PACK; /* flags to specify load type, etc. */
sigBYTE dsOEM PACK; /* OEM file was created for */
sigLONG dsOS PACK; /* which Operating systems */
sigWORD dsCapabilities PACK; /* RAID levels, etc. */
sigWORD dsDeviceSupp PACK; /* Types of SCSI devices supported */
sigWORD dsAdapterSupp PACK; /* DPT adapter families supported */
sigWORD dsApplication PACK; /* applications file is for */
sigBYTE dsRequirements PACK; /* Other driver dependencies */
sigBYTE dsVersion PACK; /* 1 */
sigBYTE dsRevision PACK; /* 'J' */
sigBYTE dsSubRevision PACK; /* '9' ' ' if N/A */
sigBYTE dsMonth PACK; /* creation month */
sigBYTE dsDay PACK; /* creation day */
sigBYTE dsYear PACK; /* creation year since 1980 (1993=13) */
/* description (NULL terminated) */
char dsDescription[dsDescription_size] PACK;
} dpt_sig_S_Packed;
#define PACKED_SIG_SIZE sizeof(dpt_sig_S_Packed)
#endif
/* This line added at Roycroft's request */
/* Microsoft's NT compiler gets confused if you do a pack and don't */
/* restore it. */
#ifndef NO_UNPACK
#if defined (_DPT_AIX)
#pragma options align=reset
#elif defined (UNPACK_FOUR)
#pragma pack(4)
#else
#pragma pack()
#endif /* aix */
#endif
/* For the Macintosh */
#if STRUCTALIGNMENTSUPPORTED
#pragma options align=reset
#endif
#endif

402
sys/dev/asr/i2oadptr.h Normal file
View File

@ -0,0 +1,402 @@
/* $FreeBSD$ */
/****************************************************************
* Copyright (c) 1996-2000 Distributed Processing Technology Corporation
* Copyright (c) 2000 Adaptec Corproation.
* All rights reserved.
*
* Copyright 1999 I2O Special Interest Group (I2O SIG). All rights reserved.
* All rights reserved
*
* TERMS AND CONDITIONS OF USE
*
* Redistribution and use in source form, with or without modification, are
* permitted provided that redistributions of source code must retain the
* above copyright notice, this list of conditions and the following disclaimer.
*
* This software is provided `as is' by Distributed Processing Technology and
* any express or implied warranties, including, but not limited to, the
* implied warranties of merchantability and fitness for a particular purpose,
* are disclaimed. In no event shall Distributed Processing Technology be
* liable for any direct, indirect, incidental, special, exemplary or
* consequential damages (including, but not limited to, procurement of
* substitute goods or services; loss of use, data, or profits; or business
* interruptions) however caused and on any theory of liability, whether in
* contract, strict liability, or tort (including negligence or otherwise)
* arising in any way out of the use of this driver software, even if advised
* of the possibility of such damage.
*
* This header file, and any modifications of this header file, are provided
* contingent upon your agreement and adherence to the here-listed terms and
* conditions. By accepting and/or using this header file, you agree to abide
* by these terms and conditions and that these terms and conditions will be
* construed and governed in accordance with the laws of the State of California,
* without reference to conflict-of-law provisions. If you do not agree
* to these terms and conditions, please delete this file, and any copies,
* permanently, without making any use thereof.
*
* THIS HEADER FILE IS PROVIDED FREE OF CHARGE ON AN AS-IS BASIS WITHOUT
* WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
* TO IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE. I2O SIG DOES NOT WARRANT THAT THIS HEADER FILE WILL MEET THE
* USER'S REQUIREMENTS OR THAT ITS OPERATION WILL BE UNINTERRUPTED OR
* ERROR-FREE.
*
* I2O SIG DISCLAIMS ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF
* ANY PROPRIETARY RIGHTS, RELATING TO THE IMPLEMENTATION OF THE I2O
* SPECIFICATIONS. I2O SIG DOES NOT WARRANT OR REPRESENT THAT SUCH
* IMPLEMENTATIONS WILL NOT INFRINGE SUCH RIGHTS.
*
* THE USER OF THIS HEADER FILE SHALL HAVE NO RECOURSE TO I2O SIG FOR ANY
* ACTUAL OR CONSEQUENTIAL DAMAGES INCLUDING, BUT NOT LIMITED TO, LOST DATA
* OR LOST PROFITS ARISING OUT OF THE USE OR INABILITY TO USE THIS PROGRAM.
*
* I2O SIG grants the user of this header file a license to copy, distribute,
* and modify it, for any purpose, under the following terms. Any copying,
* distribution, or modification of this header file must not delete or alter
* the copyright notice of I2O SIG or any of these Terms and Conditions.
*
* Any distribution of this header file must not include a charge for the
* header file (unless such charges are strictly for the physical acts of
* copying or transferring copies). However, distribution of a product in
* which this header file is embedded may include a charge so long as any
* such charge does not include any charge for the header file itself.
*
* Any modification of this header file constitutes a derivative work based
* on this header file. Any distribution of such derivative work: (1) must
* include prominent notices that the header file has been changed from the
* original, together with the dates of any changes; (2) automatically includes
* this same license to the original header file from I2O SIG, without any
* restriction thereon from the distributing user; and (3) must include a
* grant of license of the modified file under the same terms and conditions
* as these Terms and Conditions.
*
* The I2O SIG Web site can be found at: http://www.i2osig.org
*
* The I2O SIG encourages you to deposit derivative works based on this
* header file at the I2O SIG Web site. Furthermore, to become a Registered
* Developer of the I2O SIG, sign up at the Web site or call 415.750.8352
* (United States).
****************************************************************/
#if !defined(I2O_ADPTR_HDR)
#define I2O_ADPTR_HDR
#if ((defined(KERNEL) || defined(_KERNEL)) && defined(__FreeBSD__))
# if (KERN_VERSION < 3)
# include "i386/pci/i2omsg.h"
# else
# include "dev/asr/i2omsg.h"
# endif
#else
# include "i2omsg.h" /* Include the Base Message file */
#endif
#define I2OADPTR_REV 1_5_1 /* Header file revision string */
/*****************************************************************************
*
* i2oadptr.h -- I2O Adapter Class Message defintion file
*
*
* Revision History:
*
* 1.5.d 03/06/97 - First definition for spec. draft version 1.5d.
* 1.5.1 05/02/97 - Corrections from review cycle:
* 1) Remove "SCSI" from function definition comment.
* 2) Add revision string.
* 3) Convert tabs to spaces.
* 4) New disclaimer.
*
*
*
*****************************************************************************/
/*
NOTES:
Gets, reads, receives, etc. are all even numbered functions.
Sets, writes, sends, etc. are all odd numbered functions.
Functions that both send and receive data can be either but an attempt is made
to use the function number that indicates the greater transfer amount.
Functions that do not send or receive data use odd function numbers.
Some functions are synonyms like read, receive and send, write.
All common functions will have a code of less than 0x80.
Unique functions to a class will start at 0x80.
Executive Functions start at 0xA0.
Utility Message function codes range from 0 - 0x1f
Base Message function codes range from 0x20 - 0xfe
Private Message function code is 0xff.
*/
PRAGMA_ALIGN_PUSH
PRAGMA_PACK_PUSH
/*
Bus Adapter Class specific functions
*/
#define I2O_HBA_ADAPTER_RESET 0x85
#define I2O_HBA_BUS_QUIESCE 0x8b
#define I2O_HBA_BUS_RESET 0x87
#define I2O_HBA_BUS_SCAN 0x89
/*
Detailed Status Codes for HBA operations
Note:
The 16-bit Detailed Status Code field for HBA operations is divided
into two separate 8-bit fields. The lower 8 bits are reserved. The
upper 8 bits are used to report Adapter Status information. The
definitions for these two fields, however, will be consistent with
the standard reply message frame structure declaration, which treats
this as a single 16-bit field. In addition, the values used will be
consistent with the Adapter Status codes defined for the SCSI
Peripheral class. Theses codes are based on CAM-1. In other words,
these definitions are a subset of the SCSI peripheral class codes.
Where applicable, "SCSI" has been removed from the definition.
*/
#define I2O_HBA_DSC_MASK 0xFF00
#define I2O_HBA_DSC_SUCCESS 0x0000
#define I2O_HBA_DSC_ADAPTER_BUSY 0x0500
#define I2O_HBA_DSC_COMMAND_TIMEOUT 0x0B00
#define I2O_HBA_DSC_COMPLETE_WITH_ERROR 0x0400
#define I2O_HBA_DSC_FUNCTION_UNAVAILABLE 0x3A00
#define I2O_HBA_DSC_NO_ADAPTER 0x1100
#define I2O_HBA_DSC_PARITY_ERROR_FAILURE 0x0F00
#define I2O_HBA_DSC_PATH_INVALID 0x0700
#define I2O_HBA_DSC_PROVIDE_FAILURE 0x1600
#define I2O_HBA_DSC_QUEUE_FROZEN 0x4000
#define I2O_HBA_DSC_REQUEST_ABORTED 0x0200
#define I2O_HBA_DSC_REQUEST_INVALID 0x0600
#define I2O_HBA_DSC_REQUEST_LENGTH_ERROR 0x1500
#define I2O_HBA_DSC_REQUEST_TERMINATED 0x1800
#define I2O_HBA_DSC_RESOURCE_UNAVAILABLE 0x3400
#define I2O_HBA_DSC_BUS_BUSY 0x3F00
#define I2O_HBA_DSC_BUS_RESET 0x0E00
#define I2O_HBA_DSC_ID_INVALID 0x3900
#define I2O_HBA_DSC_SEQUENCE_FAILURE 0x1400
#define I2O_HBA_DSC_UNABLE_TO_ABORT 0x0300
#define I2O_HBA_DSC_UNABLE_TO_TERMINATE 0x0900
#define I2O_HBA_DSC_UNACKNOWLEDGED_EVENT 0x3500
#define I2O_HBA_DSC_UNEXPECTED_BUS_FREE 0x1300
/****************************************************************************/
/* Bus Adapter Parameter Groups */
/****************************************************************************/
#define I2O_HBA_CONTROLLER_INFO_GROUP_NO 0x0000
#define I2O_HBA_HISTORICAL_STATS_GROUP_NO 0x0100
#define I2O_HBA_SCSI_CONTROLLER_INFO_GROUP_NO 0x0200
#define I2O_HBA_SCSI_BUS_PORT_INFO_GROUP_NO 0x0201
#define I2O_HBA_FCA_CONTROLLER_INFO_GROUP_NO 0x0300
#define I2O_HBA_FCA_PORT_INFO_GROUP_NO 0x0301
/* - 0000h - HBA Controller Information Parameter Group */
/* Bus Type */
#define I2O_HBA_BUS_TYPE_GENERIC 0x00
#define I2O_HBA_BUS_TYPE_SCSI 0x01
#define I2O_HBA_BUS_TYPE_FCA 0x10
typedef struct _I2O_HBA_CONTROLLER_INFO_SCALAR {
U8 BusType;
U8 BusState;
U16 Reserved2;
U8 BusName[12];
} I2O_HBA_CONTROLLER_INFO_SCALAR, *PI2O_HBA_CONTROLLER_INFO_SCALAR;
/* - 0100h - HBA Historical Stats Parameter Group */
typedef struct _I2O_HBA_HIST_STATS_SCALAR {
U32 TimeLastPoweredUp;
U32 TimeLastReset;
} I2O_HBA_HIST_STATS_SCALAR, *PI2O_HBA_HIST_STATS_SCALAR;
/* - 0200h - HBA SCSI Controller Information Parameter Group */
/* SCSI Type */
#define I2O_SCSI_TYPE_UNKNOWN 0x00
#define I2O_SCSI_TYPE_SCSI_1 0x01
#define I2O_SCSI_TYPE_SCSI_2 0x02
#define I2O_SCSI_TYPE_SCSI_3 0x03
/* Protection Management */
#define I2O_SCSI_PORT_PROT_OTHER 0x00
#define I2O_SCSI_PORT_PROT_UNKNOWN 0x01
#define I2O_SCSI_PORT_PROT_UNPROTECTED 0x02
#define I2O_SCSI_PORT_PROT_PROTECTED 0x03
#define I2O_SCSI_PORT_PROT_SCC 0x04
/* Settings */
#define I2O_SCSI_PORT_PARITY_FLAG 0x01
#define I2O_SCSI_PORT_PARITY_DISABLED 0x00
#define I2O_SCSI_PORT_PARITY_ENABLED 0x01
#define I2O_SCSI_PORT_SCAN_ORDER_FLAG 0x02
#define I2O_SCSI_PORT_SCAN_LOW_TO_HIGH 0x00
#define I2O_SCSI_PORT_SCAN_HIGH_TO_LOW 0x02
#define I2O_SCSI_PORT_IID_FLAG 0x04
#define I2O_SCSI_PORT_IID_DEFAULT 0x00
#define I2O_SCSI_PORT_IID_SPECIFIED 0x04
#define I2O_SCSI_PORT_SCAM_FLAG 0x08
#define I2O_SCSI_PORT_SCAM_DISABLED 0x00
#define I2O_SCSI_PORT_SCAM_ENABLED 0x08
#define I2O_SCSI_PORT_TYPE_FLAG 0x80
#define I2O_SCSI_PORT_TYPE_PARALLEL 0x00
#define I2O_SCSI_PORT_TYPE_SERIAL 0x80
typedef struct _I2O_HBA_SCSI_CONTROLLER_INFO_SCALAR {
U8 SCSIType;
U8 ProtectionManagement;
U8 Settings;
U8 Reserved1;
U32 InitiatorID;
U64 ScanLun0Only;
U16 DisableDevice;
U8 MaxOffset;
U8 MaxDataWidth;
U64 MaxSyncRate;
} I2O_HBA_SCSI_CONTROLLER_INFO_SCALAR, *PI2O_HBA_SCSI_CONTROLLER_INFO_SCALAR;
/* - 0201h - HBA SCSI Bus Port Information Parameter Group */
/* NOTE: Refer to the SCSI Peripheral Class Bus Port Information Parameter
Group field definitions for HBA SCSI Bus Port field definitions.
*/
typedef struct _I2O_HBA_SCSI_BUS_PORT_INFO_SCALAR {
U8 PhysicalInterface;
U8 ElectricalInterface;
U8 Isochronous;
U8 ConnectorType;
U8 ConnectorGender;
U8 Reserved1;
U16 Reserved2;
U32 MaxNumberDevices;
U32 DeviceIdBegin;
U32 DeviceIdEnd;
U8 LunBegin[8];
U8 LunEnd[8];
} I2O_HBA_SCSI_BUS_PORT_INFO_SCALAR, *PI2O_HBA_SCSI_BUS_PORT_INFO_SCALAR;
/* - 0300h - HBA FCA Controller Information Parameters Group defines */
/* SCSI Type */
#define I2O_FCA_TYPE_UNKNOWN 0x00
#define I2O_FCA_TYPE_FCAL 0x01
typedef struct _I2O_HBA_FCA_CONTROLLER_INFO_SCALAR {
U8 FcaType;
U8 Reserved1;
U16 Reserved2;
} I2O_HBA_FCA_CONTROLLER_INFO_SCALAR, *PI2O_HBA_FCA_CONTROLLER_INFO_SCALAR;
/* - 0301h - HBA FCA Port Information Parameters Group defines */
typedef struct _I2O_HBA_FCA_PORT_INFO_SCALAR {
U32 Reserved4;
} I2O_HBA_FCA_PORT_INFO_SCALAR, *PI2O_HBA_FCA_PORT_INFO_SCALAR;
/****************************************************************************/
/* I2O Bus Adapter Class Specific Message Definitions */
/****************************************************************************/
/****************************************************************************/
/* I2O Bus Adapter Class Reply Message Frame */
typedef struct _I2O_HBA_REPLY_MESSAGE_FRAME {
I2O_SINGLE_REPLY_MESSAGE_FRAME StdReplyFrame;
} I2O_HBA_REPLY_MESSAGE_FRAME, *PI2O_HBA_REPLY_MESSAGE_FRAME;
/****************************************************************************/
/* I2O HBA Adapter Reset Message Frame */
typedef struct _I2O_HBA_ADAPTER_RESET_MESSAGE {
I2O_MESSAGE_FRAME StdMessageFrame;
I2O_TRANSACTION_CONTEXT TransactionContext;
} I2O_HBA_ADAPTER_RESET_MESSAGE, *PI2O_HBA_ADAPTER_RESET_MESSAGE;
/****************************************************************************/
/* I2O HBA Bus Quiesce Message Frame */
typedef U32 I2O_HBQ_FLAGS;
#define I2O_HBQ_FLAG_NORMAL 0x0000
#define I2O_HBQ_FLAG_QUIESCE 0x0001
typedef struct _I2O_HBA_BUS_QUIESCE_MESSAGE {
I2O_MESSAGE_FRAME StdMessageFrame;
I2O_TRANSACTION_CONTEXT TransactionContext;
I2O_HBQ_FLAGS Flags;
} I2O_HBA_BUS_QUIESCE_MESSAGE, *PI2O_HBA_BUS_QUIESCE_MESSAGE;
/****************************************************************************/
/* I2O HBA Bus Reset Message Frame */
typedef struct _I2O_HBA_BUS_RESET_MESSAGE {
I2O_MESSAGE_FRAME StdMessageFrame;
I2O_TRANSACTION_CONTEXT TransactionContext;
} I2O_HBA_BUS_RESET_MESSAGE, *PI2O_HBA_BUS_RESET_MESSAGE;
/****************************************************************************/
/* I2O HBA Bus Scan Message Frame */
/* NOTE: SCSI-2 8-bit scalar LUN goes into offset 1 of Lun arrays */
typedef struct _I2O_HBA_BUS_SCAN_MESSAGE {
I2O_MESSAGE_FRAME StdMessageFrame;
I2O_TRANSACTION_CONTEXT TransactionContext;
} I2O_HBA_BUS_SCAN_MESSAGE, *PI2O_HBA_BUS_SCAN_MESSAGE;
PRAGMA_PACK_POP
PRAGMA_ALIGN_POP
#endif /* I2O_ADPTR_HDR */

495
sys/dev/asr/i2obscsi.h Normal file
View File

@ -0,0 +1,495 @@
/* $FreeBSD$ */
/****************************************************************
* Copyright (c) 1996-2000 Distributed Processing Technology Corporation
* Copyright (c) 2000 Adaptec Corporation.
* All rights reserved.
*
* Copyright 1999 I2O Special Interest Group (I2O SIG). All rights reserved.
* All rights reserved
*
* TERMS AND CONDITIONS OF USE
*
* Redistribution and use in source form, with or without modification, are
* permitted provided that redistributions of source code must retain the
* above copyright notice, this list of conditions and the following disclaimer.
*
* This software is provided `as is' by Distributed Processing Technology and
* any express or implied warranties, including, but not limited to, the
* implied warranties of merchantability and fitness for a particular purpose,
* are disclaimed. In no event shall Distributed Processing Technology be
* liable for any direct, indirect, incidental, special, exemplary or
* consequential damages (including, but not limited to, procurement of
* substitute goods or services; loss of use, data, or profits; or business
* interruptions) however caused and on any theory of liability, whether in
* contract, strict liability, or tort (including negligence or otherwise)
* arising in any way out of the use of this driver software, even if advised
* of the possibility of such damage.
*
* This header file, and any modifications of this header file, are provided
* contingent upon your agreement and adherence to the here-listed terms and
* conditions. By accepting and/or using this header file, you agree to abide
* by these terms and conditions and that these terms and conditions will be
* construed and governed in accordance with the laws of the State of California,
* without reference to conflict-of-law provisions. If you do not agree
* to these terms and conditions, please delete this file, and any copies,
* permanently, without making any use thereof.
*
* THIS HEADER FILE IS PROVIDED FREE OF CHARGE ON AN AS-IS BASIS WITHOUT
* WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
* TO IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE. I2O SIG DOES NOT WARRANT THAT THIS HEADER FILE WILL MEET THE
* USER'S REQUIREMENTS OR THAT ITS OPERATION WILL BE UNINTERRUPTED OR
* ERROR-FREE.
*
* I2O SIG DISCLAIMS ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF
* ANY PROPRIETARY RIGHTS, RELATING TO THE IMPLEMENTATION OF THE I2O
* SPECIFICATIONS. I2O SIG DOES NOT WARRANT OR REPRESENT THAT SUCH
* IMPLEMENTATIONS WILL NOT INFRINGE SUCH RIGHTS.
*
* THE USER OF THIS HEADER FILE SHALL HAVE NO RECOURSE TO I2O SIG FOR ANY
* ACTUAL OR CONSEQUENTIAL DAMAGES INCLUDING, BUT NOT LIMITED TO, LOST DATA
* OR LOST PROFITS ARISING OUT OF THE USE OR INABILITY TO USE THIS PROGRAM.
*
* I2O SIG grants the user of this header file a license to copy, distribute,
* and modify it, for any purpose, under the following terms. Any copying,
* distribution, or modification of this header file must not delete or alter
* the copyright notice of I2O SIG or any of these Terms and Conditions.
*
* Any distribution of this header file must not include a charge for the
* header file (unless such charges are strictly for the physical acts of
* copying or transferring copies). However, distribution of a product in
* which this header file is embedded may include a charge so long as any
* such charge does not include any charge for the header file itself.
*
* Any modification of this header file constitutes a derivative work based
* on this header file. Any distribution of such derivative work: (1) must
* include prominent notices that the header file has been changed from the
* original, together with the dates of any changes; (2) automatically includes
* this same license to the original header file from I2O SIG, without any
* restriction thereon from the distributing user; and (3) must include a
* grant of license of the modified file under the same terms and conditions
* as these Terms and Conditions.
*
* The I2O SIG Web site can be found at: http://www.i2osig.org
*
* The I2O SIG encourages you to deposit derivative works based on this
* header file at the I2O SIG Web site. Furthermore, to become a Registered
* Developer of the I2O SIG, sign up at the Web site or call 415.750.8352
* (United States).
****************************************************************/
#if !defined(I2O_BASE_SCSI_HDR)
#define I2O_BASE_SCSI_HDR
#if ((defined(KERNEL) || defined(_KERNEL)) && defined(__FreeBSD__))
# if (KERN_VERSION < 3)
# include "i386/pci/i2omsg.h" /* Include the Base Message file */
# else
# include "dev/asr/i2omsg.h"
# endif
#else
# include "i2omsg.h" /* Include the Base Message file */
#endif
#define I2OBSCSI_REV 1_5_1 /* Header file revision string */
/*****************************************************************************
*
* I2OBSCSI.h -- I2O Base SCSI Device Class Message defintion file
*
* This file contains information presented in Chapter 6, Section 6 & 7 of
* the I2O Specification.
*
* Revision History: (Revision History tracks the revision number of the I2O
* specification)
*
* .92 - First marked revsion used for Proof of Concept.
* .93 - Change to match the rev .93 of the spec.
* .95 - Updated to Rev .95 of 2/5/96.
* 1.00 - Checked and Updated against spec version 1.00 4/9/96.
* 1.xx - Updated to the 1.x version of the I2O Specification on 11/11/96.
* 1.xx - 11/14/96
* 1) Removed duplicate device type definitions.
* 2) Added "DSC" to Detailed Status Code definitions.
* 3) Changed SCSI-3 LUN fields from U64 to U8 array.
* 1.xx 11/15/96 - Added #pragma statments for i960.
* 1.xx 11/20/96 - Changed duplicate Bus Scan structure to Bus Reset.
* 1.xx 12/05/96 - Added Auto Request Sense flag definition.
* 1.5d 03/06/97 - Update for spec. draft version 1.5d.
* 1) Converted SCSI bus adapter class to generic in i2oadptr.h.
* 2) Fixed DSC reference: changed from _BUS_SCAN to _BUS_RESET.
* 1.5d 03/031/97 - Made AutoSense flag definition consistent with spec.
* 1.5d 04/11/97 - Corrections from review cycle:
* 1) Corrected typo in I2O_SCSI_PERIPHERAL_TYPE_PARALLEL.
* 2) Corrected typo in I2O_SCSI_PORT_CONN_UNSHIELDED_P_HD.
* 1.5.1 05/02/97 - Corrections from review cycle:
* 1) Remove #include for i2omstor.h.
* 2) Add revision string.
* 3) Convert tabs to spaces.
* 4) New disclaimer.
*
*****************************************************************************/
/*
NOTES:
Gets, reads, receives, etc. are all even numbered functions.
Sets, writes, sends, etc. are all odd numbered functions.
Functions that both send and receive data can be either but an attempt is made
to use the function number that indicates the greater transfer amount.
Functions that do not send or receive data use odd function numbers.
Some functions are synonyms like read, receive and send, write.
All common functions will have a code of less than 0x80.
Unique functions to a class will start at 0x80.
Executive Functions start at 0xA0.
Utility Message function codes range from 0 - 0x1f
Base Message function codes range from 0x20 - 0xfe
Private Message function code is 0xff.
*/
PRAGMA_ALIGN_PUSH
PRAGMA_PACK_PUSH
/*
SCSI Peripheral Class specific functions
Although the names are SCSI Peripheral class specific, the values
assigned are common with other classes when applicable.
*/
#define I2O_SCSI_DEVICE_RESET 0x27
#define I2O_SCSI_SCB_ABORT 0x83
#define I2O_SCSI_SCB_EXEC 0x81
/*
Detailed Status Codes for SCSI operations
The 16-bit Detailed Status Code field for SCSI operations is divided
into two separate 8-bit fields. The lower 8 bits are used to report
Device Status information. The upper 8 bits are used to report
Adapter Status information. The definitions for these two fields,
however, will be consistent with the standard reply message frame
structure declaration, which treats this as a single 16-bit field.
*/
/* SCSI Device Completion Status Codes (defined by SCSI-2/3)*/
#define I2O_SCSI_DEVICE_DSC_MASK 0x00FF
#define I2O_SCSI_DSC_SUCCESS 0x0000
#define I2O_SCSI_DSC_CHECK_CONDITION 0x0002
#define I2O_SCSI_DSC_BUSY 0x0008
#define I2O_SCSI_DSC_RESERVATION_CONFLICT 0x0018
#define I2O_SCSI_DSC_COMMAND_TERMINATED 0x0022
#define I2O_SCSI_DSC_TASK_SET_FULL 0x0028
#define I2O_SCSI_DSC_ACA_ACTIVE 0x0030
/* SCSI Adapter Status Codes (based on CAM-1) */
#define I2O_SCSI_HBA_DSC_MASK 0xFF00
#define I2O_SCSI_HBA_DSC_SUCCESS 0x0000
#define I2O_SCSI_HBA_DSC_REQUEST_ABORTED 0x0200
#define I2O_SCSI_HBA_DSC_UNABLE_TO_ABORT 0x0300
#define I2O_SCSI_HBA_DSC_COMPLETE_WITH_ERROR 0x0400
#define I2O_SCSI_HBA_DSC_ADAPTER_BUSY 0x0500
#define I2O_SCSI_HBA_DSC_REQUEST_INVALID 0x0600
#define I2O_SCSI_HBA_DSC_PATH_INVALID 0x0700
#define I2O_SCSI_HBA_DSC_DEVICE_NOT_PRESENT 0x0800
#define I2O_SCSI_HBA_DSC_UNABLE_TO_TERMINATE 0x0900
#define I2O_SCSI_HBA_DSC_SELECTION_TIMEOUT 0x0A00
#define I2O_SCSI_HBA_DSC_COMMAND_TIMEOUT 0x0B00
#define I2O_SCSI_HBA_DSC_MR_MESSAGE_RECEIVED 0x0D00
#define I2O_SCSI_HBA_DSC_SCSI_BUS_RESET 0x0E00
#define I2O_SCSI_HBA_DSC_PARITY_ERROR_FAILURE 0x0F00
#define I2O_SCSI_HBA_DSC_AUTOSENSE_FAILED 0x1000
#define I2O_SCSI_HBA_DSC_NO_ADAPTER 0x1100
#define I2O_SCSI_HBA_DSC_DATA_OVERRUN 0x1200
#define I2O_SCSI_HBA_DSC_UNEXPECTED_BUS_FREE 0x1300
#define I2O_SCSI_HBA_DSC_SEQUENCE_FAILURE 0x1400
#define I2O_SCSI_HBA_DSC_REQUEST_LENGTH_ERROR 0x1500
#define I2O_SCSI_HBA_DSC_PROVIDE_FAILURE 0x1600
#define I2O_SCSI_HBA_DSC_BDR_MESSAGE_SENT 0x1700
#define I2O_SCSI_HBA_DSC_REQUEST_TERMINATED 0x1800
#define I2O_SCSI_HBA_DSC_IDE_MESSAGE_SENT 0x3300
#define I2O_SCSI_HBA_DSC_RESOURCE_UNAVAILABLE 0x3400
#define I2O_SCSI_HBA_DSC_UNACKNOWLEDGED_EVENT 0x3500
#define I2O_SCSI_HBA_DSC_MESSAGE_RECEIVED 0x3600
#define I2O_SCSI_HBA_DSC_INVALID_CDB 0x3700
#define I2O_SCSI_HBA_DSC_LUN_INVALID 0x3800
#define I2O_SCSI_HBA_DSC_SCSI_TID_INVALID 0x3900
#define I2O_SCSI_HBA_DSC_FUNCTION_UNAVAILABLE 0x3A00
#define I2O_SCSI_HBA_DSC_NO_NEXUS 0x3B00
#define I2O_SCSI_HBA_DSC_SCSI_IID_INVALID 0x3C00
#define I2O_SCSI_HBA_DSC_CDB_RECEIVED 0x3D00
#define I2O_SCSI_HBA_DSC_LUN_ALREADY_ENABLED 0x3E00
#define I2O_SCSI_HBA_DSC_BUS_BUSY 0x3F00
#define I2O_SCSI_HBA_DSC_QUEUE_FROZEN 0x4000
/****************************************************************************/
/* SCSI Peripheral Device Parameter Groups */
/****************************************************************************/
/* SCSI Configuration and Operating Structures and Defines */
#define I2O_SCSI_DEVICE_INFO_GROUP_NO 0x0000
#define I2O_SCSI_DEVICE_BUS_PORT_INFO_GROUP_NO 0x0001
/* - 0000h - SCSI Device Information Parameters Group defines */
/* Device Type */
#define I2O_SCSI_DEVICE_TYPE_DIRECT 0x00
#define I2O_SCSI_DEVICE_TYPE_SEQUENTIAL 0x01
#define I2O_SCSI_DEVICE_TYPE_PRINTER 0x02
#define I2O_SCSI_DEVICE_TYPE_PROCESSOR 0x03
#define I2O_SCSI_DEVICE_TYPE_WORM 0x04
#define I2O_SCSI_DEVICE_TYPE_CDROM 0x05
#define I2O_SCSI_DEVICE_TYPE_SCANNER 0x06
#define I2O_SCSI_DEVICE_TYPE_OPTICAL 0x07
#define I2O_SCSI_DEVICE_TYPE_MEDIA_CHANGER 0x08
#define I2O_SCSI_DEVICE_TYPE_COMM 0x09
#define I2O_SCSI_DEVICE_GRAPHICS_1 0x0A
#define I2O_SCSI_DEVICE_GRAPHICS_2 0x0B
#define I2O_SCSI_DEVICE_TYPE_ARRAY_CONT 0x0C
#define I2O_SCSI_DEVICE_TYPE_SES 0x0D
#define I2O_SCSI_DEVICE_TYPE_UNKNOWN 0x1F
/* Flags */
#define I2O_SCSI_PERIPHERAL_TYPE_FLAG 0x01
#define I2O_SCSI_PERIPHERAL_TYPE_PARALLEL 0x00
#define I2O_SCSI_PERIPHERAL_TYPE_SERIAL 0x01
#define I2O_SCSI_RESERVED_FLAG 0x02
#define I2O_SCSI_DISCONNECT_FLAG 0x04
#define I2O_SCSI_DISABLE_DISCONNECT 0x00
#define I2O_SCSI_ENABLE_DISCONNECT 0x04
#define I2O_SCSI_MODE_MASK 0x18
#define I2O_SCSI_MODE_SET_DATA 0x00
#define I2O_SCSI_MODE_SET_DEFAULT 0x08
#define I2O_SCSI_MODE_SET_SAFEST 0x10
#define I2O_SCSI_DATA_WIDTH_MASK 0x60
#define I2O_SCSI_DATA_WIDTH_8 0x00
#define I2O_SCSI_DATA_WIDTH_16 0x20
#define I2O_SCSI_DATA_WIDTH_32 0x40
#define I2O_SCSI_SYNC_NEGOTIATION_FLAG 0x80
#define I2O_SCSI_DISABLE_SYNC_NEGOTIATION 0x00
#define I2O_SCSI_ENABLE_SYNC_NEGOTIATION 0x80
/* - 0001h - SCSI Device Bus Port Info Parameters Group defines */
/* Physical */
#define I2O_SCSI_PORT_PHYS_OTHER 0x01
#define I2O_SCSI_PORT_PHYS_UNKNOWN 0x02
#define I2O_SCSI_PORT_PHYS_PARALLEL 0x03
#define I2O_SCSI_PORT_PHYS_FIBRE_CHANNEL 0x04
#define I2O_SCSI_PORT_PHYS_SERIAL_P1394 0x05
#define I2O_SCSI_PORT_PHYS_SERIAL_SSA 0x06
/* Electrical */
#define I2O_SCSI_PORT_ELEC_OTHER 0x01
#define I2O_SCSI_PORT_ELEC_UNKNOWN 0x02
#define I2O_SCSI_PORT_ELEC_SINGLE_ENDED 0x03
#define I2O_SCSI_PORT_ELEC_DIFFERENTIAL 0x04
#define I2O_SCSI_PORT_ELEC_LOW_VOLT_DIFF 0x05
#define I2O_SCSI_PORT_ELEC_OPTICAL 0x06
/* Isochronous */
#define I2O_SCSI_PORT_ISOC_NO 0x00
#define I2O_SCSI_PORT_ISOC_YES 0x01
#define I2O_SCSI_PORT_ISOC_UNKNOWN 0x02
/* Connector Type */
#define I2O_SCSI_PORT_CONN_OTHER 0x01
#define I2O_SCSI_PORT_CONN_UNKNOWN 0x02
#define I2O_SCSI_PORT_CONN_NONE 0x03
#define I2O_SCSI_PORT_CONN_SHIELDED_A_HD 0x04
#define I2O_SCSI_PORT_CONN_UNSHIELDED_A_HD 0x05
#define I2O_SCSI_PORT_CONN_SHIELDED_A_LD 0x06
#define I2O_SCSI_PORT_CONN_UNSHIELDED_A_LD 0x07
#define I2O_SCSI_PORT_CONN_SHIELDED_P_HD 0x08
#define I2O_SCSI_PORT_CONN_UNSHIELDED_P_HD 0x09
#define I2O_SCSI_PORT_CONN_SCA_I 0x0A
#define I2O_SCSI_PORT_CONN_SCA_II 0x0B
#define I2O_SCSI_PORT_CONN_FC_DB9 0x0C
#define I2O_SCSI_PORT_CONN_FC_FIBRE 0x0D
#define I2O_SCSI_PORT_CONN_FC_SCA_II_40 0x0E
#define I2O_SCSI_PORT_CONN_FC_SCA_II_20 0x0F
#define I2O_SCSI_PORT_CONN_FC_BNC 0x10
/* Connector Gender */
#define I2O_SCSI_PORT_CONN_GENDER_OTHER 0x01
#define I2O_SCSI_PORT_CONN_GENDER_UNKOWN 0x02
#define I2O_SCSI_PORT_CONN_GENDER_FEMALE 0x03
#define I2O_SCSI_PORT_CONN_GENDER_MALE 0x04
/* SCSI Device Group 0000h - Device Information Parameter Group */
typedef struct _I2O_SCSI_DEVICE_INFO_SCALAR {
U8 DeviceType;
U8 Flags;
U16 Reserved2;
U32 Identifier;
U8 LunInfo[8]; /* SCSI-2 8-bit scalar LUN goes into offset 1 */
U32 QueueDepth;
U8 Reserved1a;
U8 NegOffset;
U8 NegDataWidth;
U8 Reserved1b;
U64 NegSyncRate;
} I2O_SCSI_DEVICE_INFO_SCALAR, *PI2O_SCSI_DEVICE_INFO_SCALAR;
/* SCSI Device Group 0001h - Bus Port Information Parameter Group */
typedef struct _I2O_SCSI_BUS_PORT_INFO_SCALAR {
U8 PhysicalInterface;
U8 ElectricalInterface;
U8 Isochronous;
U8 ConnectorType;
U8 ConnectorGender;
U8 Reserved1;
U16 Reserved2;
U32 MaxNumberDevices;
} I2O_SCSI_BUS_PORT_INFO_SCALAR, *PI2O_SCSI_BUS_PORT_INFO_SCALAR;
/****************************************************************************/
/* I2O SCSI Peripheral Event Indicator Assignment */
#define I2O_SCSI_EVENT_SCSI_SMART 0x00000010
/****************************************************************************/
/* SCSI Peripheral Class Specific Message Definitions */
/****************************************************************************/
/****************************************************************************/
/* I2O SCSI Peripheral Successful Completion Reply Message Frame */
typedef struct _I2O_SCSI_SUCCESS_REPLY_MESSAGE_FRAME {
I2O_SINGLE_REPLY_MESSAGE_FRAME StdReplyFrame;
U32 TransferCount;
} I2O_SCSI_SUCCESS_REPLY_MESSAGE_FRAME, *PI2O_SCSI_SUCCESS_REPLY_MESSAGE_FRAME;
/****************************************************************************/
/* I2O SCSI Peripheral Error Report Reply Message Frame */
#ifdef _WIN64
#define I2O_SCSI_SENSE_DATA_SZ 44
#else
#define I2O_SCSI_SENSE_DATA_SZ 40
#endif
typedef struct _I2O_SCSI_ERROR_REPLY_MESSAGE_FRAME {
I2O_SINGLE_REPLY_MESSAGE_FRAME StdReplyFrame;
U32 TransferCount;
U32 AutoSenseTransferCount;
U8 SenseData[I2O_SCSI_SENSE_DATA_SZ];
} I2O_SCSI_ERROR_REPLY_MESSAGE_FRAME, *PI2O_SCSI_ERROR_REPLY_MESSAGE_FRAME;
/****************************************************************************/
/* I2O SCSI Device Reset Message Frame */
typedef struct _I2O_SCSI_DEVICE_RESET_MESSAGE {
I2O_MESSAGE_FRAME StdMessageFrame;
I2O_TRANSACTION_CONTEXT TransactionContext;
} I2O_SCSI_DEVICE_RESET_MESSAGE, *PI2O_SCSI_DEVICE_RESET_MESSAGE;
/****************************************************************************/
/* I2O SCSI Control Block Abort Message Frame */
typedef struct _I2O_SCSI_SCB_ABORT_MESSAGE {
I2O_MESSAGE_FRAME StdMessageFrame;
I2O_TRANSACTION_CONTEXT TransactionContext;
I2O_TRANSACTION_CONTEXT TransactionContextToAbort;
} I2O_SCSI_SCB_ABORT_MESSAGE, *PI2O_SCSI_SCB_ABORT_MESSAGE;
/****************************************************************************/
/* I2O SCSI Control Block Execute Message Frame */
#define I2O_SCSI_CDB_LENGTH 16
typedef U16 I2O_SCB_FLAGS;
#define I2O_SCB_FLAG_XFER_DIR_MASK 0xC000
#define I2O_SCB_FLAG_NO_DATA_XFER 0x0000
#define I2O_SCB_FLAG_XFER_FROM_DEVICE 0x4000
#define I2O_SCB_FLAG_XFER_TO_DEVICE 0x8000
#define I2O_SCB_FLAG_ENABLE_DISCONNECT 0x2000
#define I2O_SCB_FLAG_TAG_TYPE_MASK 0x0380
#define I2O_SCB_FLAG_NO_TAG_QUEUEING 0x0000
#define I2O_SCB_FLAG_SIMPLE_QUEUE_TAG 0x0080
#define I2O_SCB_FLAG_HEAD_QUEUE_TAG 0x0100
#define I2O_SCB_FLAG_ORDERED_QUEUE_TAG 0x0180
#define I2O_SCB_FLAG_ACA_QUEUE_TAG 0x0200
#define I2O_SCB_FLAG_AUTOSENSE_MASK 0x0060
#define I2O_SCB_FLAG_DISABLE_AUTOSENSE 0x0000
#define I2O_SCB_FLAG_SENSE_DATA_IN_MESSAGE 0x0020
#define I2O_SCB_FLAG_SENSE_DATA_IN_BUFFER 0x0060
typedef struct _I2O_SCSI_SCB_EXECUTE_MESSAGE {
I2O_MESSAGE_FRAME StdMessageFrame;
I2O_TRANSACTION_CONTEXT TransactionContext;
U8 CDBLength;
U8 Reserved;
I2O_SCB_FLAGS SCBFlags;
U8 CDB[I2O_SCSI_CDB_LENGTH];
U32 ByteCount;
I2O_SG_ELEMENT SGL;
} I2O_SCSI_SCB_EXECUTE_MESSAGE, *PI2O_SCSI_SCB_EXECUTE_MESSAGE;
PRAGMA_PACK_POP
PRAGMA_ALIGN_POP
#endif /* I2O_BASE_SCSI_HDR */

1296
sys/dev/asr/i2odep.h Normal file

File diff suppressed because it is too large Load Diff

195
sys/dev/asr/i2odpt.h Normal file
View File

@ -0,0 +1,195 @@
/* $FreeBSD$ */
/****************************************************************
* Copyright (c) 1996-2000 Distributed Processing Technology Corporation
* Copyright (c) 2000 Adaptec Corporation.
* All rights reserved.
*
****************************************************************/
#if !defined(I2O_DPT_HDR)
#define I2O_DPT_HDR
#define DPT_ORGANIZATION_ID 0x1B /* For Private Messages */
/*
* PrivateMessageFrame.StdMessageFrame.Function = I2O_PRIVATE_MESSAGE
* PrivateMessageFrame.XFunctionCode = I2O_SCSI_SCB_EXEC
*/
typedef struct _PRIVATE_SCSI_SCB_EXECUTE_MESSAGE {
I2O_PRIVATE_MESSAGE_FRAME PrivateMessageFrame;
# if (defined(sparc) || defined(_DPT_BIG_ENDIAN))
U32 TID; /* Upper four bits currently are zero */
# else
BF TID:16; /* Upper four bits currently are zero */
/* Command is interpreted by the host */
BF Interpret:1;
/* if TRUE, deal with Physical Firmware Array information */
BF Physical:1;
BF Reserved1:14;
# endif
U8 CDBLength;
U8 Reserved;
I2O_SCB_FLAGS SCBFlags;
U8 CDB[ I2O_SCSI_CDB_LENGTH ];
U32 ByteCount;
I2O_SG_ELEMENT SGL;
} PRIVATE_SCSI_SCB_EXECUTE_MESSAGE, * PPRIVATE_SCSI_SCB_EXECUTE_MESSAGE;
/*
* Flash access and programming messages
* PrivateMessageFrame.StdMessageFrame.Function = I2O_PRIVATE_MESSAGE
* PrivateMessageFrame.XFunctionCode = PRIVATE_FLAGS_REGION_*
*
* SIZE returns the total size of a region of flash
* READ copies a region (or portion thereof) into the buffer specified
* by the SGL
* WRITE writes a region (or portion thereof) using the data specified
* by the SGL
*
* Flash regions
*
* 0 operational-mode firmware
* 1 software (bios/utility)
* 2 oem nvram defaults
* 3 hba serial number
* 4 boot-mode firmware
*
* Any combination of RegionOffset and ByteCount can be specified providing
* they fit within the size of the specified region.
*
* Flash messages should be targeted to the Executive TID 0x000
*/
#define PRIVATE_FLASH_REGION_SIZE 0x0100
#define PRIVATE_FLASH_REGION_READ 0x0101
#define PRIVATE_FLASH_REGION_WRITE 0x0102
#define PRIVATE_FLASH_REGION_CRC 0x0103
typedef struct _PRIVATE_FLASH_REGION_MESSAGE {
I2O_PRIVATE_MESSAGE_FRAME PrivateMessageFrame;
U32 FlashRegion;
U32 RegionOffset;
U32 ByteCount;
I2O_SG_ELEMENT SGL;
} PRIVATE_FLASH_REGION_MESSAGE, * PPRIVATE_FLASH_REGION_MESSAGE;
/* DPT Driver Printf message */
#define PRIVATE_DRIVER_PRINTF 0x0200
/* FwPrintFlags */
#define FW_FIRMWARE_FLAGS_NO_HEADER_B 0x00000001 /* Remove date header */
typedef struct _PRIVATE_DRIVER_PRINTF_MESSAGE {
I2O_PRIVATE_MESSAGE_FRAME PrivateMessageFrame;
/* total bytes in PrintBuffer, including header */
U32 PrintBufferByteCount;
/* exact data to be copied into the serial PrintBuffer */
U8 PrintBuffer[1];
} PRIVATE_DRIVER_PRINTF_MESSAGE, * PPRIVATE_DRIVER_PRINTF_MESSAGE;
/* DPT Enable Diagnostics message 0x0201 */
#define PRIVATE_DIAG_ENABLE 0x0201
typedef struct _PRIVATE_DIAG_ENABLE_MESSAGE {
I2O_PRIVATE_MESSAGE_FRAME PrivateMessageFrame;
} PRIVATE_DIAG_MESSAGE_FRAME, * PPRIVATE_DIAG_MESSAGE_FRAME;
/* DPT Driver Get/Put message */
#define PRIVATE_DRIVER_GET 0x300
#define PRIVATE_DRIVER_PUT 0x301
typedef struct _PRIVATE_DRIVER_GETPUT_MESSAGE
{
I2O_PRIVATE_MESSAGE_FRAME PrivateMessageFrame;
U32 Offset;
U32 ByteCount;
I2O_SG_ELEMENT SGL;
} PRIVATE_DRIVER_GETPUT_MESSAGE, * PPRIVATE_DRIVER_GETPUT_MESSAGE;
/****************************************************************************/
/* DPT Peripheral Device Parameter Groups */
/****************************************************************************/
/* DPT Configuration and Operating Structures and Defines */
#define I2O_DPT_DEVICE_INFO_GROUP_NO 0x8000
/* - 8000h - DPT Device Information Parameters Group defines */
/* Device Type */
#define I2O_DPT_DEVICE_TYPE_DIRECT I2O_SCSI_DEVICE_TYPE_DIRECT
#define I2O_DPT_DEVICE_TYPE_SEQUENTIAL I2O_SCSI_DEVICE_TYPE_SEQUENTIAL
#define I2O_DPT_DEVICE_TYPE_PRINTER I2O_SCSI_DEVICE_TYPE_PRINTER
#define I2O_DPT_DEVICE_TYPE_PROCESSOR I2O_SCSI_DEVICE_TYPE_PROCESSOR
#define I2O_DPT_DEVICE_TYPE_WORM I2O_SCSI_DEVICE_TYPE_WORM
#define I2O_DPT_DEVICE_TYPE_CDROM I2O_SCSI_DEVICE_TYPE_CDROM
#define I2O_DPT_DEVICE_TYPE_SCANNER I2O_SCSI_DEVICE_TYPE_SCANNER
#define I2O_DPT_DEVICE_TYPE_OPTICAL I2O_SCSI_DEVICE_TYPE_OPTICAL
#define I2O_DPT_DEVICE_TYPE_MEDIA_CHANGER I2O_SCSI_DEVICE_TYPE_MEDIA_CHANGER
#define I2O_DPT_DEVICE_TYPE_COMM I2O_SCSI_DEVICE_TYPE_COMM
#define I2O_DPT_DEVICE_GRAPHICS_1 I2O_SCSI_DEVICE_GRAPHICS_1
#define I2O_DPT_DEVICE_GRAPHICS_2 I2O_SCSI_DEVICE_GRAPHICS_2
#define I2O_DPT_DEVICE_TYPE_ARRAY_CONT I2O_SCSI_DEVICE_TYPE_ARRAY_CONT
#define I2O_DPT_DEVICE_TYPE_UNKNOWN I2O_SCSI_DEVICE_TYPE_UNKNOWN
/* Flags */
#define I2O_DPT_PERIPHERAL_TYPE_FLAG I2O_SCSI_PERIPHERAL_TYPE_FLAG
#define I2O_DPT_PERIPHERAL_TYPE_PARALLEL I2O_SCSI_PERIPHERAL_TYPE_PARALLEL
#define I2O_DPT_PERIPHERAL_TYPE_SERIAL I2O_SCSI_PERIPHERAL_TYPE_SERIAL
#define I2O_DPT_RESERVED_FLAG I2O_SCSI_RESERVED_FLAG
#define I2O_DPT_DISCONNECT_FLAG I2O_SCSI_DISCONNECT_FLAG
#define I2O_DPT_DISABLE_DISCONNECT I2O_SCSI_DISABLE_DISCONNECT
#define I2O_DPT_ENABLE_DISCONNECT I2O_SCSI_ENABLE_DISCONNECT
#define I2O_DPT_MODE_MASK I2O_SCSI_MODE_MASK
#define I2O_DPT_MODE_SET_DATA I2O_SCSI_MODE_SET_DATA
#define I2O_DPT_MODE_SET_DEFAULT I2O_SCSI_MODE_SET_DEFAULT
#define I2O_DPT_MODE_SET_SAFEST I2O_SCSI_MODE_SET_SAFEST
#define I2O_DPT_DATA_WIDTH_MASK I2O_SCSI_DATA_WIDTH_MASK
#define I2O_DPT_DATA_WIDTH_8 I2O_SCSI_DATA_WIDTH_8
#define I2O_DPT_DATA_WIDTH_16 I2O_SCSI_DATA_WIDTH_16
#define I2O_DPT_DATA_WIDTH_32 I2O_SCSI_DATA_WIDTH_32
#define I2O_DPT_SYNC_NEGOTIATION_FLAG I2O_SCSI_SYNC_NEGOTIATION_FLAG
#define I2O_DPT_DISABLE_SYNC_NEGOTIATION I2O_SCSI_DISABLE_SYNC_NEGOTIATION
#define I2O_DPT_ENABLE_SYNC_NEGOTIATION I2O_SCSI_ENABLE_SYNC_NEGOTIATION
/* DPT Device Group 8000h - Device Information Parameter Group */
typedef struct _I2O_DPT_DEVICE_INFO_SCALAR {
U8 DeviceType; /* Identical to I2O_SCSI_DEVICE_INFO SCALAR */
U8 Flags; /* Identical to I2O_SCSI_DEVICE_INFO SCALAR */
U16 Bus;
U32 Identifier;
U8 LunInfo[8]; /* SCSI-2 8-bit scalar LUN goes into offset 1 */
} I2O_DPT_DEVICE_INFO_SCALAR, *PI2O_DPT_DEVICE_INFO_SCALAR;
#define I2O_DPT_EXEC_IOP_BUFFERS_GROUP_NO 0x8000
/* DPT Exec Iop Buffers Group 8000h */
typedef struct _I2O_DPT_EXEC_IOP_BUFFERS_SCALAR {
U32 SerialOutputOffset; /* offset from base address to header */
U32 SerialOutputSize; /* size of data buffer in bytes */
U32 SerialHeaderSize; /* size of data buffer header in bytes */
U32 SerialFlagsSupported; /* Mask of debug flags supported */
} I2O_DPT_EXEC_IOP_BUFFERS_SCALAR, *PI2O_DPT_EXEC_IOP_BUFFERS_SCALAR;
#endif /* I2O_DPT_HDR */

1265
sys/dev/asr/i2oexec.h Normal file

File diff suppressed because it is too large Load Diff

1290
sys/dev/asr/i2omsg.h Normal file

File diff suppressed because it is too large Load Diff

134
sys/dev/asr/i2otypes.h Normal file
View File

@ -0,0 +1,134 @@
/* $FreeBSD$ */
/****************************************************************
* Copyright (c) 1996-2000 Distributed Processing Technology Corporation
* Copyright (c) 2000 Adaptec Corporation.
* All rights reserved.
*
* Copyright 1999 I2O Special Interest Group (I2O SIG). All rights reserved.
* All rights reserved
*
* TERMS AND CONDITIONS OF USE
*
* Redistribution and use in source form, with or without modification, are
* permitted provided that redistributions of source code must retain the
* above copyright notice, this list of conditions and the following disclaimer.
*
* This software is provided `as is' by Distributed Processing Technology and
* any express or implied warranties, including, but not limited to, the
* implied warranties of merchantability and fitness for a particular purpose,
* are disclaimed. In no event shall Distributed Processing Technology be
* liable for any direct, indirect, incidental, special, exemplary or
* consequential damages (including, but not limited to, procurement of
* substitute goods or services; loss of use, data, or profits; or business
* interruptions) however caused and on any theory of liability, whether in
* contract, strict liability, or tort (including negligence or otherwise)
* arising in any way out of the use of this driver software, even if advised
* of the possibility of such damage.
*
* This header file, and any modifications of this header file, are provided
* contingent upon your agreement and adherence to the here-listed terms and
* conditions. By accepting and/or using this header file, you agree to abide
* by these terms and conditions and that these terms and conditions will be
* construed and governed in accordance with the laws of the State of California,
* without reference to conflict-of-law provisions. If you do not agree
* to these terms and conditions, please delete this file, and any copies,
* permanently, without making any use thereof.
*
* THIS HEADER FILE IS PROVIDED FREE OF CHARGE ON AN AS-IS BASIS WITHOUT
* WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
* TO IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE. I2O SIG DOES NOT WARRANT THAT THIS HEADER FILE WILL MEET THE
* USER'S REQUIREMENTS OR THAT ITS OPERATION WILL BE UNINTERRUPTED OR
* ERROR-FREE.
*
* I2O SIG DISCLAIMS ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF
* ANY PROPRIETARY RIGHTS, RELATING TO THE IMPLEMENTATION OF THE I2O
* SPECIFICATIONS. I2O SIG DOES NOT WARRANT OR REPRESENT THAT SUCH
* IMPLEMENTATIONS WILL NOT INFRINGE SUCH RIGHTS.
*
* THE USER OF THIS HEADER FILE SHALL HAVE NO RECOURSE TO I2O SIG FOR ANY
* ACTUAL OR CONSEQUENTIAL DAMAGES INCLUDING, BUT NOT LIMITED TO, LOST DATA
* OR LOST PROFITS ARISING OUT OF THE USE OR INABILITY TO USE THIS PROGRAM.
*
* I2O SIG grants the user of this header file a license to copy, distribute,
* and modify it, for any purpose, under the following terms. Any copying,
* distribution, or modification of this header file must not delete or alter
* the copyright notice of I2O SIG or any of these Terms and Conditions.
*
* Any distribution of this header file must not include a charge for the
* header file (unless such charges are strictly for the physical acts of
* copying or transferring copies). However, distribution of a product in
* which this header file is embedded may include a charge so long as any
* such charge does not include any charge for the header file itself.
*
* Any modification of this header file constitutes a derivative work based
* on this header file. Any distribution of such derivative work: (1) must
* include prominent notices that the header file has been changed from the
* original, together with the dates of any changes; (2) automatically includes
* this same license to the original header file from I2O SIG, without any
* restriction thereon from the distributing user; and (3) must include a
* grant of license of the modified file under the same terms and conditions
* as these Terms and Conditions.
*
* The I2O SIG Web site can be found at: http://www.i2osig.org
*
* The I2O SIG encourages you to deposit derivative works based on this
* header file at the I2O SIG Web site. Furthermore, to become a Registered
* Developer of the I2O SIG, sign up at the Web site or call 415.750.8352
* (United States).
****************************************************************/
#ifndef __INCi2otypesh
#define __INCi2otypesh
#define I2OTYPES_REV 1_5_4
/* include architecture/compiler dependencies */
#if ((defined(KERNEL) || defined(_KERNEL)) && defined(__FreeBSD__))
# if (KERN_VERSION < 3)
# include "i386/pci/i2odep.h"
# else
# include "dev/asr/i2odep.h"
# endif
#else
# include "i2odep.h"
#endif
/* 64 bit defines */
typedef struct _S64 {
U32 LowPart;
S32 HighPart;
} S64;
typedef struct _U64 {
U32 LowPart;
U32 HighPart;
} U64;
/* Pointer to Basics */
typedef VOID *PVOID;
typedef S8 *PS8;
typedef S16 *PS16;
typedef S32 *PS32;
typedef S64 *PS64;
/* Pointer to Unsigned Basics */
typedef U8 *PU8;
typedef U16 *PU16;
typedef U32 *PU32;
typedef U64 *PU64;
/* misc */
typedef S32 I2O_ARG;
typedef U32 I2O_COUNT;
typedef U32 I2O_USECS;
typedef U32 I2O_ADDR32;
typedef U32 I2O_SIZE;
#endif /* __INCi2otypesh */

418
sys/dev/asr/i2outil.h Normal file
View File

@ -0,0 +1,418 @@
/* $FreeBSD$ */
/****************************************************************
* Copyright (c) 1996-2000 Distributed Processing Technology Corporation
* Copyright (c) 2000 Adaptec Corporation.
* All rights reserved.
*
* Copyright 1999 I2O Special Interest Group (I2O SIG). All rights reserved.
* All rights reserved
*
* TERMS AND CONDITIONS OF USE
*
* Redistribution and use in source form, with or without modification, are
* permitted provided that redistributions of source code must retain the
* above copyright notice, this list of conditions and the following disclaimer.
*
* This software is provided `as is' by Distributed Processing Technology and
* any express or implied warranties, including, but not limited to, the
* implied warranties of merchantability and fitness for a particular purpose,
* are disclaimed. In no event shall Distributed Processing Technology be
* liable for any direct, indirect, incidental, special, exemplary or
* consequential damages (including, but not limited to, procurement of
* substitute goods or services; loss of use, data, or profits; or business
* interruptions) however caused and on any theory of liability, whether in
* contract, strict liability, or tort (including negligence or otherwise)
* arising in any way out of the use of this driver software, even if advised
* of the possibility of such damage.
*
* This header file, and any modifications of this header file, are provided
* contingent upon your agreement and adherence to the here-listed terms and
* conditions. By accepting and/or using this header file, you agree to abide
* by these terms and conditions and that these terms and conditions will be
* construed and governed in accordance with the laws of the State of California,
* without reference to conflict-of-law provisions. If you do not agree
* to these terms and conditions, please delete this file, and any copies,
* permanently, without making any use thereof.
*
* THIS HEADER FILE IS PROVIDED FREE OF CHARGE ON AN AS-IS BASIS WITHOUT
* WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
* TO IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE. I2O SIG DOES NOT WARRANT THAT THIS HEADER FILE WILL MEET THE
* USER'S REQUIREMENTS OR THAT ITS OPERATION WILL BE UNINTERRUPTED OR
* ERROR-FREE.
*
* I2O SIG DISCLAIMS ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF
* ANY PROPRIETARY RIGHTS, RELATING TO THE IMPLEMENTATION OF THE I2O
* SPECIFICATIONS. I2O SIG DOES NOT WARRANT OR REPRESENT THAT SUCH
* IMPLEMENTATIONS WILL NOT INFRINGE SUCH RIGHTS.
*
* THE USER OF THIS HEADER FILE SHALL HAVE NO RECOURSE TO I2O SIG FOR ANY
* ACTUAL OR CONSEQUENTIAL DAMAGES INCLUDING, BUT NOT LIMITED TO, LOST DATA
* OR LOST PROFITS ARISING OUT OF THE USE OR INABILITY TO USE THIS PROGRAM.
*
* I2O SIG grants the user of this header file a license to copy, distribute,
* and modify it, for any purpose, under the following terms. Any copying,
* distribution, or modification of this header file must not delete or alter
* the copyright notice of I2O SIG or any of these Terms and Conditions.
*
* Any distribution of this header file must not include a charge for the
* header file (unless such charges are strictly for the physical acts of
* copying or transferring copies). However, distribution of a product in
* which this header file is embedded may include a charge so long as any
* such charge does not include any charge for the header file itself.
*
* Any modification of this header file constitutes a derivative work based
* on this header file. Any distribution of such derivative work: (1) must
* include prominent notices that the header file has been changed from the
* original, together with the dates of any changes; (2) automatically includes
* this same license to the original header file from I2O SIG, without any
* restriction thereon from the distributing user; and (3) must include a
* grant of license of the modified file under the same terms and conditions
* as these Terms and Conditions.
*
* The I2O SIG Web site can be found at: http://www.i2osig.org
*
* The I2O SIG encourages you to deposit derivative works based on this
* header file at the I2O SIG Web site. Furthermore, to become a Registered
* Developer of the I2O SIG, sign up at the Web site or call 415.750.8352
* (United States).
****************************************************************/
/*********************************************************************
* I2OUtil.h -- I2O Utility Class Message defintion file
*
* This file contains information presented in Chapter 6 of the I2O
* Specification.
**********************************************************************/
#if !defined(I2O_UTILITY_HDR)
#define I2O_UTILITY_HDR
#define I2OUTIL_REV 1_5_4 /* I2OUtil header file revision string */
#if ((defined(KERNEL) || defined(_KERNEL)) && defined(__FreeBSD__))
# if (KERN_VERSION < 3)
# include "i386/pci/i2omsg.h" /* Include the Base Message file */
# else
# include "dev/asr/i2omsg.h"
# endif
#else
# include "i2omsg.h" /* Include the Base Message file */
#endif
/*
NOTES:
Gets, reads, receives, etc. are all even numbered functions.
Sets, writes, sends, etc. are all odd numbered functions.
Functions that both send and receive data can be either but an attempt is made
to use the function number that indicates the greater transfer amount.
Functions that do not send or receive data use odd function numbers.
Some functions are synonyms like read, receive and send, write.
All common functions will have a code of less than 0x80.
Unique functions to a class will start at 0x80.
Executive Functions start at 0xA0.
Utility Message function codes range from 0 - 0x1f
Base Message function codes range from 0x20 - 0xfe
Private Message function code is 0xff.
*/
PRAGMA_ALIGN_PUSH
PRAGMA_PACK_PUSH
/* Utility Message class functions. */
#define I2O_UTIL_NOP 0x00
#define I2O_UTIL_ABORT 0x01
#define I2O_UTIL_CLAIM 0x09
#define I2O_UTIL_CLAIM_RELEASE 0x0B
#define I2O_UTIL_CONFIG_DIALOG 0x10
#define I2O_UTIL_DEVICE_RESERVE 0x0D
#define I2O_UTIL_DEVICE_RELEASE 0x0F
#define I2O_UTIL_EVENT_ACKNOWLEDGE 0x14
#define I2O_UTIL_EVENT_REGISTER 0x13
#define I2O_UTIL_LOCK 0x17
#define I2O_UTIL_LOCK_RELEASE 0x19
#define I2O_UTIL_PARAMS_GET 0x06
#define I2O_UTIL_PARAMS_SET 0x05
#define I2O_UTIL_REPLY_FAULT_NOTIFY 0x15
/****************************************************************************/
/* ABORT Abort type defines. */
#define I2O_ABORT_TYPE_EXACT_ABORT 0x00
#define I2O_ABORT_TYPE_FUNCTION_ABORT 0x01
#define I2O_ABORT_TYPE_TRANSACTION_ABORT 0x02
#define I2O_ABORT_TYPE_WILD_ABORT 0x03
#define I2O_ABORT_TYPE_CLEAN_EXACT_ABORT 0x04
#define I2O_ABORT_TYPE_CLEAN_FUNCTION_ABORT 0x05
#define I2O_ABORT_TYPE_CLEAN_TRANSACTION_ABORT 0x06
#define I2O_ABORT_TYPE_CLEAN_WILD_ABORT 0x07
/* UtilAbort Function Message Frame structure. */
typedef struct _I2O_UTIL_ABORT_MESSAGE {
I2O_MESSAGE_FRAME StdMessageFrame;
I2O_TRANSACTION_CONTEXT TransactionContext;
# if (defined(_DPT_BIG_ENDIAN) || defined(sparc))
U32 reserved;
# else
U16 reserved;
U8 AbortType;
U8 FunctionToAbort;
# endif
I2O_TRANSACTION_CONTEXT TransactionContextToAbort;
} I2O_UTIL_ABORT_MESSAGE, *PI2O_UTIL_ABORT_MESSAGE;
typedef struct _I2O_UTIL_ABORT_REPLY {
I2O_MESSAGE_FRAME StdMessageFrame;
I2O_TRANSACTION_CONTEXT TransactionContext;
U32 CountOfAbortedMessages;
} I2O_UTIL_ABORT_REPLY, *PI2O_UTIL_ABORT_REPLY;
/****************************************************************************/
/* Claim Flag defines */
#define I2O_CLAIM_FLAGS_EXCLUSIVE 0x0001 /* Reserved */
#define I2O_CLAIM_FLAGS_RESET_SENSITIVE 0x0002
#define I2O_CLAIM_FLAGS_STATE_SENSITIVE 0x0004
#define I2O_CLAIM_FLAGS_CAPACITY_SENSITIVE 0x0008
#define I2O_CLAIM_FLAGS_PEER_SERVICE_DISABLED 0x0010
#define I2O_CLAIM_FLAGS_MGMT_SERVICE_DISABLED 0x0020
/* Claim Type defines */
#define I2O_CLAIM_TYPE_PRIMARY_USER 0x01
#define I2O_CLAIM_TYPE_AUTHORIZED_USER 0x02
#define I2O_CLAIM_TYPE_SECONDARY_USER 0x03
#define I2O_CLAIM_TYPE_MANAGEMENT_USER 0x04
/* UtilClaim Function Message Frame structure. */
typedef struct _I2O_UTIL_CLAIM_MESSAGE {
I2O_MESSAGE_FRAME StdMessageFrame;
I2O_TRANSACTION_CONTEXT TransactionContext;
U16 ClaimFlags;
U8 reserved;
U8 ClaimType;
} I2O_UTIL_CLAIM_MESSAGE, *PI2O_UTIL_CLAIM_MESSAGE;
/****************************************************************************/
/* Claim Release Flag defines */
#define I2O_RELEASE_FLAGS_CONDITIONAL 0x0001
/* UtilClaimRelease Function Message Frame structure. */
typedef struct _I2O_UTIL_CLAIM_RELEASE_MESSAGE {
I2O_MESSAGE_FRAME StdMessageFrame;
I2O_TRANSACTION_CONTEXT TransactionContext;
U16 ReleaseFlags;
U8 reserved;
U8 ClaimType;
} I2O_UTIL_CLAIM_RELEASE_MESSAGE, *PI2O_UTIL_CLAIM_RELEASE_MESSAGE;
/****************************************************************************/
/* UtilConfigDialog Function Message Frame structure */
typedef struct _I2O_UTIL_CONFIG_DIALOG_MESSAGE {
I2O_MESSAGE_FRAME StdMessageFrame;
I2O_TRANSACTION_CONTEXT TransactionContext;
U32 PageNumber;
I2O_SG_ELEMENT SGL;
} I2O_UTIL_CONFIG_DIALOG_MESSAGE, *PI2O_UTIL_CONFIG_DIALOG_MESSAGE;
/****************************************************************************/
/* Event Acknowledge Function Message Frame structure */
typedef struct _I2O_UTIL_EVENT_ACK_MESSAGE {
I2O_MESSAGE_FRAME StdMessageFrame;
I2O_TRANSACTION_CONTEXT TransactionContext;
U32 EventIndicator;
U32 EventData[1];
} I2O_UTIL_EVENT_ACK_MESSAGE, *PI2O_UTIL_EVENT_ACK_MESSAGE;
/* Event Ack Reply structure */
typedef struct _I2O_UTIL_EVENT_ACK_REPLY {
I2O_MESSAGE_FRAME StdMessageFrame;
I2O_TRANSACTION_CONTEXT TransactionContext;
U32 EventIndicator;
U32 EventData[1];
} I2O_UTIL_EVENT_ACK_REPLY, *PI2O_UTIL_EVENT_ACK_REPLY;
/****************************************************************************/
/* Event Indicator Mask Flags */
#define I2O_EVENT_IND_STATE_CHANGE 0x80000000
#define I2O_EVENT_IND_GENERAL_WARNING 0x40000000
#define I2O_EVENT_IND_CONFIGURATION_FLAG 0x20000000
/* #define I2O_EVENT_IND_RESERVE_RELEASE 0x10000000 */
#define I2O_EVENT_IND_LOCK_RELEASE 0x10000000
#define I2O_EVENT_IND_CAPABILITY_CHANGE 0x08000000
#define I2O_EVENT_IND_DEVICE_RESET 0x04000000
#define I2O_EVENT_IND_EVENT_MASK_MODIFIED 0x02000000
#define I2O_EVENT_IND_FIELD_MODIFIED 0x01000000
#define I2O_EVENT_IND_VENDOR_EVENT 0x00800000
#define I2O_EVENT_IND_DEVICE_STATE 0x00400000
/* Event Data for generic Events */
#define I2O_EVENT_STATE_CHANGE_NORMAL 0x00
#define I2O_EVENT_STATE_CHANGE_SUSPENDED 0x01
#define I2O_EVENT_STATE_CHANGE_RESTART 0x02
#define I2O_EVENT_STATE_CHANGE_NA_RECOVER 0x03
#define I2O_EVENT_STATE_CHANGE_NA_NO_RECOVER 0x04
#define I2O_EVENT_STATE_CHANGE_QUIESCE_REQUEST 0x05
#define I2O_EVENT_STATE_CHANGE_FAILED 0x10
#define I2O_EVENT_STATE_CHANGE_FAULTED 0x11
#define I2O_EVENT_GEN_WARNING_NORMAL 0x00
#define I2O_EVENT_GEN_WARNING_ERROR_THRESHOLD 0x01
#define I2O_EVENT_GEN_WARNING_MEDIA_FAULT 0x02
#define I2O_EVENT_CAPABILITY_OTHER 0x01
#define I2O_EVENT_CAPABILITY_CHANGED 0x02
#define I2O_EVENT_SENSOR_STATE_CHANGED 0x01
/* UtilEventRegister Function Message Frame structure */
typedef struct _I2O_UTIL_EVENT_REGISTER_MESSAGE {
I2O_MESSAGE_FRAME StdMessageFrame;
I2O_TRANSACTION_CONTEXT TransactionContext;
U32 EventMask;
} I2O_UTIL_EVENT_REGISTER_MESSAGE, *PI2O_UTIL_EVENT_REGISTER_MESSAGE;
/* UtilEventRegister Reply structure */
typedef struct _I2O_UTIL_EVENT_REGISTER_REPLY {
I2O_MESSAGE_FRAME StdMessageFrame;
I2O_TRANSACTION_CONTEXT TransactionContext;
U32 EventIndicator;
U32 EventData[1];
} I2O_UTIL_EVENT_REGISTER_REPLY, *PI2O_UTIL_EVENT_REGISTER_REPLY;
/****************************************************************************/
/* UtilLock Function Message Frame structure. */
typedef struct _I2O_UTIL_LOCK_MESSAGE {
I2O_MESSAGE_FRAME StdMessageFrame;
I2O_TRANSACTION_CONTEXT TransactionContext;
} I2O_UTIL_LOCK_MESSAGE, *PI2O_UTIL_LOCK_MESSAGE;
/****************************************************************************/
/* UtilLockRelease Function Message Frame structure. */
typedef struct _I2O_UTIL_LOCK_RELEASE_MESSAGE {
I2O_MESSAGE_FRAME StdMessageFrame;
I2O_TRANSACTION_CONTEXT TransactionContext;
} I2O_UTIL_LOCK_RELEASE_MESSAGE, *PI2O_UTIL_LOCK_RELEASE_MESSAGE;
/****************************************************************************/
/* UtilNOP Function Message Frame structure. */
typedef struct _I2O_UTIL_NOP_MESSAGE {
I2O_MESSAGE_FRAME StdMessageFrame;
} I2O_UTIL_NOP_MESSAGE, *PI2O_UTIL_NOP_MESSAGE;
/****************************************************************************/
/* UtilParamsGet Message Frame structure. */
typedef struct _I2O_UTIL_PARAMS_GET_MESSAGE {
I2O_MESSAGE_FRAME StdMessageFrame;
I2O_TRANSACTION_CONTEXT TransactionContext;
U32 OperationFlags;
I2O_SG_ELEMENT SGL;
} I2O_UTIL_PARAMS_GET_MESSAGE, *PI2O_UTIL_PARAMS_GET_MESSAGE;
/****************************************************************************/
/* UtilParamsSet Message Frame structure. */
typedef struct _I2O_UTIL_PARAMS_SET_MESSAGE {
I2O_MESSAGE_FRAME StdMessageFrame;
I2O_TRANSACTION_CONTEXT TransactionContext;
U32 OperationFlags;
I2O_SG_ELEMENT SGL;
} I2O_UTIL_PARAMS_SET_MESSAGE, *PI2O_UTIL_PARAMS_SET_MESSAGE;
/****************************************************************************/
/* UtilReplyFaultNotify Message for Message Failure. */
typedef struct _I2O_UTIL_REPLY_FAULT_NOTIFY_MESSAGE {
I2O_MESSAGE_FRAME StdMessageFrame;
I2O_TRANSACTION_CONTEXT TransactionContext;
U8 LowestVersion;
U8 HighestVersion;
BF Severity:I2O_FAILCODE_SEVERITY_SZ;
BF FailureCode:I2O_FAILCODE_CODE_SZ;
BF FailingIOP_ID:I2O_IOP_ID_SZ;
BF reserved:I2O_RESERVED_4BITS;
BF FailingHostUnitID:I2O_UNIT_ID_SZ;
U32 AgeLimit;
#if I2O_64BIT_CONTEXT
PI2O_MESSAGE_FRAME OriginalMFA;
#else
PI2O_MESSAGE_FRAME OriginalMFALowPart;
U32 OriginalMFAHighPart; /* Always 0000 */
#endif
} I2O_UTIL_REPLY_FAULT_NOTIFY_MESSAGE, *PI2O_UTIL_REPLY_FAULT_NOTIFY_MESSAGE;
/****************************************************************************/
/* Device Reserve Function Message Frame structure. */
/* NOTE: This was previously called the Reserve Message */
typedef struct _I2O_UTIL_DEVICE_RESERVE_MESSAGE {
I2O_MESSAGE_FRAME StdMessageFrame;
I2O_TRANSACTION_CONTEXT TransactionContext;
} I2O_UTIL_DEVICE_RESERVE_MESSAGE, *PI2O_UTIL_DEVICE_RESERVE_MESSAGE;
/****************************************************************************/
/* Device Release Function Message Frame structure. */
/* NOTE: This was previously called the ReserveRelease Message */
typedef struct _I2O_UTIL_DEVICE_RELEASE_MESSAGE {
I2O_MESSAGE_FRAME StdMessageFrame;
I2O_TRANSACTION_CONTEXT TransactionContext;
} I2O_UTIL_DEVICE_RELEASE_MESSAGE, *PI2O_UTIL_DEVICE_RELEASE_MESSAGE;
/****************************************************************************/
PRAGMA_PACK_POP
PRAGMA_ALIGN_POP
#endif /* I2O_UTILITY_HDR */

80
sys/dev/asr/osd_defs.h Normal file
View File

@ -0,0 +1,80 @@
/* $FreeBSD$ */
/* BSDI osd_defs.h,v 1.4 1998/06/03 19:14:58 karels Exp */
/*
* Copyright (c) 1996-1999 Distributed Processing Technology Corporation
* All rights reserved.
*
* Redistribution and use in source form, with or without modification, are
* permitted provided that redistributions of source code must retain the
* above copyright notice, this list of conditions and the following disclaimer.
*
* This software is provided `as is' by Distributed Processing Technology and
* any express or implied warranties, including, but not limited to, the
* implied warranties of merchantability and fitness for a particular purpose,
* are disclaimed. In no event shall Distributed Processing Technology be
* liable for any direct, indirect, incidental, special, exemplary or
* consequential damages (including, but not limited to, procurement of
* substitute goods or services; loss of use, data, or profits; or business
* interruptions) however caused and on any theory of liability, whether in
* contract, strict liability, or tort (including negligence or otherwise)
* arising in any way out of the use of this driver software, even if advised
* of the possibility of such damage.
*
*/
#ifndef _OSD_DEFS_H
#define _OSD_DEFS_H
/*File - OSD_DEFS.H
****************************************************************************
*
*Description:
*
* This file contains the OS dependent defines. This file is included
*in osd_util.h and provides the OS specific defines for that file.
*
*Copyright Distributed Processing Technology, Corp.
* 140 Candace Dr.
* Maitland, Fl. 32751 USA
* Phone: (407) 830-5522 Fax: (407) 260-5366
* All Rights Reserved
*
*Author: Doug Anderson
*Date: 1/31/94
*
*Editors:
*
*Remarks:
*
*
*****************************************************************************/
/*Definitions - Defines & Constants ----------------------------------------- */
/* Define the operating system */
#if (defined(__linux__))
# define _DPT_LINUX
#elif (defined(__bsdi__))
# define _DPT_BSDI
#elif (defined(__FreeBSD__))
# define _DPT_FREE_BSD
#else
# define _DPT_SCO
#endif
#if defined (ZIL_CURSES)
#define _DPT_CURSES
#else
#define _DPT_MOTIF
#endif
/* Redefine 'far' to nothing - no far pointer type required in UNIX */
#define far
/* Define the mutually exclusive semaphore type */
#define SEMAPHORE_T unsigned int *
/* Define a handle to a DLL */
#define DLL_HANDLE_T unsigned int *
#endif

590
sys/dev/asr/osd_unix.h Normal file
View File

@ -0,0 +1,590 @@
/* $FreeBSD$ */
/* BSDI osd_unix.h,v 1.7 1998/06/03 19:14:58 karels Exp */
/*
* Copyright (c) 1996-1999 Distributed Processing Technology Corporation
* All rights reserved.
*
* Redistribution and use in source form, with or without modification, are
* permitted provided that redistributions of source code must retain the
* above copyright notice, this list of conditions and the following disclaimer.
*
* This software is provided `as is' by Distributed Processing Technology and
* any express or implied warranties, including, but not limited to, the
* implied warranties of merchantability and fitness for a particular purpose,
* are disclaimed. In no event shall Distributed Processing Technology be
* liable for any direct, indirect, incidental, special, exemplary or
* consequential damages (including, but not limited to, procurement of
* substitute goods or services; loss of use, data, or profits; or business
* interruptions) however caused and on any theory of liability, whether in
* contract, strict liability, or tort (including negligence or otherwise)
* arising in any way out of the use of this driver software, even if advised
* of the possibility of such damage.
*
*/
#ifndef __OSD_UNIX_H
#define __OSD_UNIX_H
/*File - OSD_UNIX.H */
/*****************************************************************************/
/* */
/*Description: */
/* */
/* This file contains definitions for the UNIX OS dependent layer of the */
/*DPT engine. */
/* */
/*Copyright Distributed Processing Technology, Corp. */
/* 140 Candace Dr. */
/* Maitland, Fl. 32751 USA */
/* Phone: (407) 830-5522 Fax: (407) 260-5366 */
/* All Rights Reserved */
/* */
/*Author: Bob Pasteur */
/*Date: 5/28/93 */
/* */
/*Editors: */
/* 3/7/96 salyzyn@dpt.com */
/* Added BSDi extensions */
/* 30/9/99 salyzyn@dpt.com */
/* Added I2ORESCANCMD */
/* 7/12/99 salyzyn@dpt.com */
/* Added I2ORESETCMD */
/* */
/*Remarks: */
/* */
/* */
/*****************************************************************************/
/* Definitions - Defines & Constants ---------------------------------------*/
#define DPT_TurnAroundKey 0x01 /* TurnAround Message Type for engine */
#define DPT_EngineKey 0x02 /* Message Que and Type for engine */
#define DPT_LoggerKey 0x03 /* Message Type For Logger */
#define DPT_CommEngineKey 0x04 /* Message Que Type Created */
#define MSG_RECEIVE 0x40000000 /* Ored Into Logger PID For Return Msg */
#define ENGMSG_ECHO 0x00 /* Turnarround Echo Engine Message */
#define ENGMSG_OPEN 0x01 /* Turnarround Open Engine Message */
#define ENGMSG_CLOSE 0x02 /* Turnarround Close Engine Message */
/* Message Que Creation Flags */
#define MSG_URD 00400
#define MSG_UWR 00200
#define MSG_GRD 00040
#define MSG_GWR 00020
#define MSG_ORD 00004
#define MSG_OWR 00002
#define MSG_ALLRD 00444
#define MSG_ALLWR 00222
/* Message Que Creation Flags */
#define SHM_URD 00400
#define SHM_UWR 00200
#define SHM_GRD 00040
#define SHM_GWR 00020
#define SHM_ORD 00004
#define SHM_OWR 00002
#define SHM_ALLRD 00444
#define SHM_ALLWR 00222
/* Program Exit Codes */
#define ExitGoodStatus 0
#define ExitBadParameter 1
#define ExitSignalFail 3
#define ExitMsqAllocFail 5
#define ExitBuffAllocFail 6
#define ExitMsgSendFail 8
#define ExitMsgReceiveFail 9
#define ExitEngOpenFail 10
#define ExitDuplicateEngine 11
#define ExitCommAllocFail 12
#define ExitDuplicateCommEng 13
#define ExitCommConnectFail 14
#ifndef MAX_HAS
#define MAX_HAS 18
#define MAX_NAME 100
#endif /* ifndef MAX_HAS */
typedef struct {
uCHAR ConfigLength[4]; /* Len in bytes after this field. */
uCHAR EATAsignature[4];
uCHAR EATAversion;
uCHAR Flags1;
uCHAR PadLength[2];
uCHAR HBA[4];
uCHAR CPlength[4]; /* Command Packet Length */
uCHAR SPlength[4]; /* Status Packet Length */
uCHAR QueueSize[2]; /* Controller Que depth */
uCHAR SG_Size[4];
uCHAR Flags2;
uCHAR Reserved0; /* Reserved Field */
uCHAR Flags3;
uCHAR ScsiValues;
uCHAR MaxLUN; /* Maximun LUN Supported */
uCHAR Flags4;
uCHAR RaidNum; /* RAID HBA Number For Stripping */
uCHAR Reserved3; /* Reserved Field */
} DptReadConfig_t;
#if defined ( _DPT_SOLARIS )
#include <sys/types.h>
#include <sys/ddidmareq.h>
#include <sys/mutex.h>
#include <sys/scsi/scsi.h>
//#define _KERNEL
#include <sys/dditypes.h>
#include <sys/ddi_impldefs.h>
#include <sys/scsi/impl/transport.h>
//#undef _KERNEL
#undef MSG_DISCONNECT
#define MSG_DISCONNECT 0x11L
#define EATAUSRCMD 1
#define DPT_SIGNATURE 2
#define DPT_NUMCTRLS 3
#define DPT_CTRLINFO 4
#define DPT_SYSINFO 5
#define DPT_BLINKLED 6
#define I2OUSRCMD 7
//#define I2ORESCANCMD 8 /* Use DPT_IO_ACCESS instead */
//#define I2ORESETCMD 9 /* Use DPT_IO_ACCESS instead */
#define DPT_MAX_DMA_SEGS 32 /* Max used Scatter/Gather seg */
struct dpt_sg {
paddr_t data_addr;
uLONG data_len;
};
typedef struct {
uSHORT NumHBAs;
uLONG IOAddrs[18];
} GetHbaInfo_t;
#elif defined(_DPT_DGUX)
#ifndef _IOWR
# define _IOWR(x,y,z) (0x0fff3900|y)
#endif
#ifndef _IOW
# define _IOW(x,y,z) (0x0fff3900|y)
#endif
#ifndef _IOR
# define _IOR(x,y,z) (0x0fff3900|y)
#endif
#ifndef _IO
# define _IO(x,y) (0x0fff3900|y)
#endif
/* EATA PassThrough Command */
#define EATAUSRCMD _IOWR('D',65,EATA_CP)
/* Get Signature Structure */
#define DPT_SIGNATURE _IOR('D',67,dpt_sig_S)
/* Get Number Of DPT Adapters */
#define DPT_NUMCTRLS _IOR('D',68,int)
/* Get Adapter Info Structure */
#define DPT_CTRLINFO _IOR('D',69,CtrlInfo)
/* Get System Info Structure */
#define DPT_SYSINFO _IOR('D',72,sysInfo_S)
/* Get Blink LED Code */
#define DPT_BLINKLED _IOR('D',75,int)
/* Get Statistical information (if available) */
#define DPT_STATS_INFO _IOR('D',80,STATS_DATA)
/* Clear the statistical information */
#define DPT_STATS_CLEAR _IO('D',81)
/* Send an I2O command */
#define I2OUSRCMD _IO('D',76)
/* Inform driver to re-acquire LCT information */
#define I2ORESCANCMD _IO('D',77)
/* Inform driver to reset adapter */
#define I2ORESETCMD _IO('D',78)
#elif defined (SNI_MIPS)
/* Unix Ioctl Command definitions */
#define EATAUSRCMD (('D'<<8)|65)
#define DPT_DEBUG (('D'<<8)|66)
#define DPT_SIGNATURE (('D'<<8)|67)
#define DPT_NUMCTRLS (('D'<<8)|68)
#define DPT_CTRLINFO (('D'<<8)|69)
#define DPT_STATINFO (('D'<<8)|70)
#define DPT_CLRSTAT (('D'<<8)|71)
#define DPT_SYSINFO (('D'<<8)|72)
/* Set Timeout Value */
#define DPT_TIMEOUT (('D'<<8)|73)
/* Get config Data */
#define DPT_CONFIG (('D'<<8)|74)
/* Get config Data */
#define DPT_BLINKLED (('D'<<8)|75)
/* Get Statistical information (if available) */
#define DPT_STATS_INFO (('D'<<8)|80)
/* Clear the statistical information */
#define DPT_STATS_CLEAR (('D'<<8)|81)
/* Send an I2O command */
#define I2OUSRCMD (('D'<<8)|76)
/* Inform driver to re-acquire LCT information */
#define I2ORESCANCMD (('D'<<8)|77)
/* Inform driver to reset adapter */
#define I2ORESETCMD (('D'<<8)|78)
#else
/* Unix Ioctl Command definitions */
#ifdef _DPT_AIX
#undef _IOWR
#undef _IOW
#undef _IOR
#undef _IO
#endif
#ifndef _IOWR
# define _IOWR(x,y,z) (((x)<<8)|y)
#endif
#ifndef _IOW
# define _IOW(x,y,z) (((x)<<8)|y)
#endif
#ifndef _IOR
# define _IOR(x,y,z) (((x)<<8)|y)
#endif
#ifndef _IO
# define _IO(x,y) (((x)<<8)|y)
#endif
/* EATA PassThrough Command */
#define EATAUSRCMD _IOWR('D',65,EATA_CP)
/* Set Debug Level If Enabled */
#define DPT_DEBUG _IOW('D',66,int)
/* Get Signature Structure */
#define DPT_SIGNATURE _IOR('D',67,dpt_sig_S)
#if defined __bsdi__
#define DPT_SIGNATURE_PACKED _IOR('D',67,dpt_sig_S_Packed)
#endif
/* Get Number Of DPT Adapters */
#define DPT_NUMCTRLS _IOR('D',68,int)
/* Get Adapter Info Structure */
#define DPT_CTRLINFO _IOR('D',69,CtrlInfo)
/* Get Statistics If Enabled */
#define DPT_STATINFO _IO('D',70)
/* Clear Stats If Enabled */
#define DPT_CLRSTAT _IO('D',71)
/* Get System Info Structure */
#define DPT_SYSINFO _IOR('D',72,sysInfo_S)
/* Set Timeout Value */
#define DPT_TIMEOUT _IO('D',73)
/* Get config Data */
#define DPT_CONFIG _IO('D',74)
/* Get Blink LED Code */
#define DPT_BLINKLED _IOR('D',75,int)
/* Get Statistical information (if available) */
#define DPT_STATS_INFO _IOR('D',80,STATS_DATA)
/* Clear the statistical information */
#define DPT_STATS_CLEAR _IO('D',81)
/* Get Performance metrics */
#define DPT_PERF_INFO _IOR('D',82,dpt_perf_t)
/* Send an I2O command */
#define I2OUSRCMD _IO('D',76)
/* Inform driver to re-acquire LCT information */
#define I2ORESCANCMD _IO('D',77)
/* Inform driver to reset adapter */
#define I2ORESETCMD _IO('D',78)
#if defined _DPT_LINUX
/* See if the target is mounted */
#define DPT_TARGET_BUSY _IOR('D',79, TARGET_BUSY_T)
#endif
#endif /* _DPT_SOLARIS else */
/* Adapter Flags Field Bit Definitions */
#define CTLR_INSTALLED 0x00000001 /* Adapter Was Installed */
#define CTLR_DMA 0x00000002 /* DMA Supported */
#define CTLR_OVERLAP 0x00000004 /* Overlapped Commands Support */
#define CTLR_SECONDARY 0x00000008 /* I/O Address Not 0x1f0 */
#define CTLR_BLINKLED 0x00000010 /* Adapter In Blink LED State */
#define CTLR_HBACI 0x00000020 /* Cache Inhibit Supported */
#define CTLR_CACHE 0x00000040 /* Adapter Has Cache */
#define CTLR_SANE 0x00000080 /* Adapter Functioning OK */
#define CTLR_BUS_QUIET 0x00000100 /* Bus Quite On This Adapter */
#define CTLR_ABOVE_16 0x00000200 /* Support For Mem. Above 16 MB */
#define CTLR_SCAT_GATH 0x00000400 /* Scatter Gather Supported */
/* Definitions - Structure & Typedef ---------------------------------------*/
typedef struct {
uLONG MsgID;
DPT_TAG_T engineTag;
DPT_TAG_T targetTag;
DPT_MSG_T engEvent;
long BufferID;
uLONG FromEngBuffOffset;
uLONG callerID;
DPT_RTN_T result;
uLONG timeOut;
} MsgHdr;
#define MsgDataSize sizeof(MsgHdr) - 4
#ifndef SNI_MIPS
/*-------------------------------------------------------------------------*/
/* EATA Command Packet definition */
/*-------------------------------------------------------------------------*/
typedef struct EATACommandPacket {
#ifdef _DPT_UNIXWARE
uCHAR EataID[4];
uINT EataCmd;
uCHAR *CmdBuffer;
#endif /* _DPT_UNIXWARE */
#ifdef _DPT_AIX
uCHAR HbaTargetID;
uCHAR HbaLUN;
#endif /* _DPT_AIX */
uCHAR cp_Flags1; /* Command Flags */
uCHAR cp_Req_Len; /* AutoRequestSense Data length. */
uCHAR cp_Resv1[3]; /* Reserved Fields */
uCHAR cp_Flags2;
uCHAR cp_Flags3;
uCHAR cp_ScsiAddr;
uCHAR cp_msg0; /* Identify and Disconnect Message. */
uCHAR cp_msg1;
uCHAR cp_msg2;
uCHAR cp_msg3;
uCHAR cp_cdb[12]; /* SCSI cdb for command. */
uLONG cp_dataLen; /* Data length in Bytes for command. */
uLONG cp_Vue; /* Vendor Unique Area */
uCHAR *cp_DataAddr; /* Data Address For The Command. */
uCHAR *cp_SpAddr; /* Status Packet Physical Address. */
uCHAR *cp_SenseAddr; /* AutoRequestSense Data Phy Address. */
#ifdef _DPT_SOLARIS
uCHAR HostStatus;
uCHAR TargetStatus;
uCHAR CdbLength;
uCHAR SG_Size;
struct scsi_arq_status ReqSenseData;
struct dpt_sg SG_List[DPT_MAX_DMA_SEGS];
union {
char *b_scratch;
struct scsi_cmd *b_ownerp;
} cc;
paddr_t ccb_paddr;
uSHORT IOAddress;
#else /* _DPT_SOLARIS */
uLONG TimeOut ;
uCHAR HostStatus;
uCHAR TargetStatus;
uCHAR Retries;
#endif /* _DPT_SOLARIS else */
} EATA_CP;
#endif // SNI_MIPS
/* Control Flags 1 Definitions */
#define SCSI_RESET 0x01 /* Cause a SCSI Bus reset on the cmd */
#define HBA_INIT 0x02 /* Cause Controller to reInitialize */
#define AUTO_REQ_SENSE 0x04 /* Do Auto Request Sense on errors */
#define SCATTER_GATHER 0x08 /* Data Ptr points to a SG Packet */
#define INTERPRET 0x20 /* Interpret the SCSI cdb of own use */
#define DATA_OUT 0x04 /* Data Out phase with command */
#define DATA_IN 0x08 /* Data In phase with command */
/* Control Flags 2 Definitions */
#define FIRMWARE_NESTED 0x01
/* Control Flags 3 Definitions */
#define PHYSICAL_UNIT 0x01 /* Send Command Directly To Target */
#define IAT 0x02 /* Inhibit Address Translation */
#define HBACI 0x04 /* Inhibit Caching */
/* Structure Returned From Get Controller Info */
typedef struct {
uCHAR state; /* Operational state */
uCHAR id; /* Host adapter SCSI id */
int vect; /* Interrupt vector number */
int base; /* Base I/O address */
int njobs; /* # of jobs sent to HA */
int qdepth; /* Controller queue depth. */
int wakebase; /* mpx wakeup base index. */
uLONG SGsize; /* Scatter/Gather list size. */
unsigned heads; /* heads for drives on cntlr. */
unsigned sectors; /* sectors for drives on cntlr. */
uCHAR do_drive32; /* Flag for Above 16 MB Ability */
uCHAR BusQuiet; /* SCSI Bus Quiet Flag */
char idPAL[4]; /* 4 Bytes Of The ID Pal */
uCHAR primary; /* 1 For Primary, 0 For Secondary */
uCHAR eataVersion; /* EATA Version */
uLONG cpLength; /* EATA Command Packet Length */
uLONG spLength; /* EATA Status Packet Length */
uCHAR drqNum; /* DRQ Index (0,5,6,7) */
uCHAR flag1; /* EATA Flags 1 (Byte 9) */
uCHAR flag2; /* EATA Flags 2 (Byte 30) */
} CtrlInfo;
#ifndef SNI_MIPS
#ifdef _DPT_UNIXWARE
typedef struct {
uINT state; /* Operational state */
uCHAR id[4]; /* Host adapter SCSI id */
uINT vect; /* Interrupt vector number */
uLONG base; /* Base I/O address */
int ha_max_jobs; /* Max number of Active Jobs */
uLONG ha_cacheParams;
int ha_nbus; /* Number Of Busses on HBA */
int ha_ntargets; /* Number Of Targets Supported */
int ha_nluns; /* Number Of LUNs Supported */
int ha_tshift; /* Shift value for target */
int ha_bshift; /* Shift value for bus */
uINT ha_npend; /* # of jobs sent to HA */
int ha_active_jobs; /* Number Of Active Jobs */
} HbaInfo;
/* SDI ioctl prefix for hba specific ioctl's */
#define SDI_IOC (('S'<<24)|('D'<<16)|('I'<<8))
#define SDI_HBANAME ((SDI_IOC)|0x14) /* Get HBA module name */
#define SDI_SEND 0x0081 /* Send a SCSI command */
#else
typedef struct {
uLONG flags; /* Operational State Flags */
uCHAR id[4]; /* Host Adapter SCSI ID */
int vect; /* Interrupt Vector Number */
int base; /* Base I/O Address */
int njobs; /* # Of CCBs Outstanding To HBA */
int qdepth; /* Controller Queue depth. */
uLONG SGsize; /* Scatter/Gather List Size. */
char idPAL[4]; /* 4 Bytes Of The ID Pal */
uCHAR eataVersion; /* EATA Version */
uLONG cpLength; /* EATA Command Packet Length */
uLONG spLength; /* EATA Status Packet Length */
uCHAR drqNum; /* DRQ Index (0,5,6,7) */
uCHAR eataflag1; /* EATA Flags 1 (Byte 9) */
uCHAR eataflag2; /* EATA Flags 2 (Byte 30) */
uCHAR maxChannel; /* Maximum Channel Number */
uCHAR maxID; /* Maximum Target ID */
uCHAR maxLUN; /* Maximum LUN */
uCHAR HbaBusType; /* HBA Bus Type, EISA, PCI, etc */
uCHAR RaidNum; /* Host Adapter RAID Number */
} HbaInfo;
#endif /* _DPT_UNIXWARE */
#endif // SNI_MIPS
#ifdef _DPT_AIX
/*
* DPT Host Adapter config information structure - this structure contains
* configuration information about an adapter. It is imbedded into the
* dpt_ctl structure.
*/
typedef struct dpt_cfg {
uchar flags; /* Operational state flags */
uchar id[4]; /* Host adapter SCSI IDs */
int vect; /* Interrupt vector number */
ulong base_addr; /* Base I/O address */
int qdepth; /* Controller queue depth. */
ulong SGsize; /* Max scatter/gather list sz */
ulong SGmax; /* Max s/g we can use per req */
uchar eataVersion; /* EATA version */
ushort cpPadLen; /* # of pad bytes sent to HA for
PIO commands */
ulong cpLength; /* EATA Command Packet length */
ulong spLength; /* EATA Status Packet length */
uchar eataflag1; /* EATA Flags 1 (Byte 9) */
uchar eataflag2; /* EATA Flags 2 (Byte 30) */
uchar maxChan; /* Maximum Channel number */
uchar maxID; /* Maximum target ID */
uchar maxLUN; /* Maximum LUN */
uchar HbaBusType; /* HBA bus type, EISA, PCI, etc */
uchar RaidNum; /* Host adapter RAID number */
} DptCfg_t;
#endif /* _DPT_AIX */
#define MAX_ELEMENT_COUNT 64
#define MAX_BUCKET_COUNT 10
/*
* DPT statistics structure definitions
*/
typedef struct IO_SIZE_STATS
{
uLONG TotalIoCount;
uLONG IoCountRead;
uLONG IoCountReadSg;
uLONG IoCountWrite;
uLONG IoCountWriteSg;
uLONG UnalignedIoAddress;
uLONG SgElementCount[MAX_ELEMENT_COUNT];
} IO_SIZE_STATS_T, *pIO_SIZE_STATS_T;
typedef struct STATS_DATA
{
uLONG TotalIoCount;
uLONG TotalUnCachedIoCount;
uLONG MaxOutstandingIoCount;
uLONG CurrentOutstandingIoCount;
uLONG OutstandingIoRunningCount;
uLONG UnalignedPktCount;
uLONG UnalignedSgCount;
uLONG NonPageListAddressSgCount;
uLONG MaxMessagesPerInterrupt;
IO_SIZE_STATS_T IoSize[MAX_BUCKET_COUNT];
} STATS_DATA_T, *pSTATS_DATA_T;
typedef struct TARGET_BUSY
{
uLONG channel;
uLONG id;
uLONG lun;
uLONG isBusy;
} TARGET_BUSY_T;
#endif /* __OSD_UNIX_H */

367
sys/dev/asr/osd_util.h Normal file
View File

@ -0,0 +1,367 @@
/* $FreeBSD$ */
/* BSDI osd_util.h,v 1.8 1998/06/03 19:14:58 karels Exp */
/*
* Copyright (c) 1996-1999 Distributed Processing Technology Corporation
* All rights reserved.
*
* Redistribution and use in source form, with or without modification, are
* permitted provided that redistributions of source code must retain the
* above copyright notice, this list of conditions and the following disclaimer.
*
* This software is provided `as is' by Distributed Processing Technology and
* any express or implied warranties, including, but not limited to, the
* implied warranties of merchantability and fitness for a particular purpose,
* are disclaimed. In no event shall Distributed Processing Technology be
* liable for any direct, indirect, incidental, special, exemplary or
* consequential damages (including, but not limited to, procurement of
* substitute goods or services; loss of use, data, or profits; or business
* interruptions) however caused and on any theory of liability, whether in
* contract, strict liability, or tort (including negligence or otherwise)
* arising in any way out of the use of this driver software, even if advised
* of the possibility of such damage.
*
*/
#ifndef __OSD_UTIL_H
#define __OSD_UTIL_H
/*File - OSD_UTIL.H
****************************************************************************
*
*Description:
*
* This file contains defines and function prototypes that are
*operating system dependent. The resources defined in this file
*are not specific to any particular application.
*
*Copyright Distributed Processing Technology, Corp.
* 140 Candace Dr.
* Maitland, Fl. 32751 USA
* Phone: (407) 830-5522 Fax: (407) 260-5366
* All Rights Reserved
*
*Author: Doug Anderson
*Date: 1/7/94
*
*Editors:
*
*Remarks:
*
*
*****************************************************************************/
/*Definitions - Defines & Constants ----------------------------------------- */
/*----------------------------- */
/* Operating system selections: */
/*----------------------------- */
/*#define _DPT_MSDOS */
/*#define _DPT_WIN_3X */
/*#define _DPT_WIN_4X */
/*#define _DPT_WIN_NT */
/*#define _DPT_NETWARE */
/*#define _DPT_OS2 */
/*#define _DPT_SCO */
/*#define _DPT_UNIXWARE */
/*#define _DPT_SOLARIS */
/*#define _DPT_NEXTSTEP */
/*#define _DPT_BANYAN */
/*-------------------------------- */
/* Include the OS specific defines */
/*-------------------------------- */
/*#define OS_SELECTION From Above List */
/*#define SEMAPHORE_T ??? */
/*#define DLL_HANDLE_T ??? */
#if (defined(KERNEL) && defined(__bsdi__))
# include "i386/isa/dpt_osd_defs.h"
#elif ((defined(KERNEL) || defined(_KERNEL)) && defined(__FreeBSD__))
# if (KERN_VERSION < 3)
# include "i386/isa/dpt_osd_defs.h"
# else
# include "dev/asr/osd_defs.h"
# endif
#else
# include "osd_defs.h"
#endif
#ifndef DPT_UNALIGNED
#define DPT_UNALIGNED
#endif
#ifndef DPT_EXPORT
#define DPT_EXPORT
#endif
#ifndef DPT_IMPORT
#define DPT_IMPORT
#endif
#ifndef DPT_RUNTIME_IMPORT
#define DPT_RUNTIME_IMPORT DPT_IMPORT
#endif
/*--------------------- */
/* OS dependent defines */
/*--------------------- */
#if defined (_DPT_MSDOS) || defined (_DPT_WIN_3X)
#define _DPT_16_BIT
#else
#define _DPT_32_BIT
#endif
#if defined (_DPT_SCO) || defined (_DPT_UNIXWARE) || defined (_DPT_SOLARIS) || defined (_DPT_AIX) || defined (SNI_MIPS) || defined (_DPT_BSDI) || defined (_DPT_FREE_BSD) || defined(_DPT_LINUX)
#define _DPT_UNIX
#endif
#if defined (_DPT_WIN_3x) || defined (_DPT_WIN_4X) || defined (_DPT_WIN_NT) \
|| defined (_DPT_OS2)
#define _DPT_DLL_SUPPORT
#endif
#if !defined (_DPT_MSDOS) && !defined (_DPT_WIN_3X) && !defined (_DPT_NETWARE)
#define _DPT_PREEMPTIVE
#endif
#if !defined (_DPT_MSDOS) && !defined (_DPT_WIN_3X)
#define _DPT_MULTI_THREADED
#endif
#if !defined (_DPT_MSDOS)
#define _DPT_MULTI_TASKING
#endif
/* These exist for platforms that */
/* chunk when accessing mis-aligned */
/* data */
#if defined (SNI_MIPS) || defined (_DPT_SOLARIS)
#if defined (_DPT_BIG_ENDIAN)
#if !defined (_DPT_STRICT_ALIGN)
#define _DPT_STRICT_ALIGN
#endif
#endif
#endif
/* Determine if in C or C++ mode */
#ifdef __cplusplus
#define _DPT_CPP
#else
#define _DPT_C
#endif
/*-------------------------------------------------------------------*/
/* Under Solaris the compiler refuses to accept code like: */
/* { {"DPT"}, 0, NULL .... }, */
/* and complains about the {"DPT"} part by saying "cannot use { } */
/* to initialize char*". */
/* */
/* By defining these ugly macros we can get around this and also */
/* not have to copy and #ifdef large sections of code. I know that */
/* these macros are *really* ugly, but they should help reduce */
/* maintenance in the long run. */
/* */
/* In the meantime, just pray that we can all move to Win32 as soon */
/* as possible... */
/*-------------------------------------------------------------------*/
#if !defined (DPTSQO)
#if defined (_DPT_SOLARIS)
#define DPTSQO
#define DPTSQC
#else
#define DPTSQO {
#define DPTSQC }
#endif /* solaris */
#endif /* DPTSQO */
/*---------------------- */
/* OS dependent typedefs */
/*---------------------- */
#if defined (_DPT_MSDOS) || defined (_DPT_SCO)
#define BYTE unsigned char
#define WORD unsigned short
#endif
#ifndef _DPT_TYPEDEFS
#define _DPT_TYPEDEFS
typedef unsigned char uCHAR;
typedef unsigned short uSHORT;
typedef unsigned int uINT;
typedef unsigned long uLONG;
typedef union {
uCHAR u8[4];
uSHORT u16[2];
uLONG u32;
} access_U;
#endif
#if !defined (NULL)
#define NULL 0
#endif
/*Prototypes - function ----------------------------------------------------- */
#ifdef __cplusplus
extern "C" { /* Declare all these functions as "C" functions */
#endif
/*------------------------ */
/* Byte reversal functions */
/*------------------------ */
/* Reverses the byte ordering of a 2 byte variable */
#if (!defined(osdSwap2))
uSHORT osdSwap2(DPT_UNALIGNED uSHORT *);
#endif // !osdSwap2
/* Reverses the byte ordering of a 4 byte variable and shifts left 8 bits */
#if (!defined(osdSwap3))
uLONG osdSwap3(DPT_UNALIGNED uLONG *);
#endif // !osdSwap3
#ifdef _DPT_NETWARE
#include "novpass.h" /* For DPT_Bswapl() prototype */
/* Inline the byte swap */
#ifdef __cplusplus
inline uLONG osdSwap4(uLONG *inLong) {
return *inLong = DPT_Bswapl(*inLong);
}
#else
#define osdSwap4(inLong) DPT_Bswapl(inLong)
#endif // cplusplus
#else
/* Reverses the byte ordering of a 4 byte variable */
# if (!defined(osdSwap4))
uLONG osdSwap4(DPT_UNALIGNED uLONG *);
# endif // !osdSwap4
/* The following functions ALWAYS swap regardless of the *
* presence of DPT_BIG_ENDIAN */
uSHORT trueSwap2(DPT_UNALIGNED uSHORT *);
uLONG trueSwap4(DPT_UNALIGNED uLONG *);
#endif // netware
/*-------------------------------------*
* Network order swap functions *
* *
* These functions/macros will be used *
* by the structure insert()/extract() *
* functions. *
*
* We will enclose all structure *
* portability modifications inside *
* #ifdefs. When we are ready, we *
* will #define DPT_PORTABLE to begin *
* using the modifications. *
*-------------------------------------*/
uLONG netSwap4(uLONG val);
#if defined (_DPT_BIG_ENDIAN)
// for big-endian we need to swap
#ifndef NET_SWAP_2
#define NET_SWAP_2(x) (((x) >> 8) | ((x) << 8))
#endif // NET_SWAP_2
#ifndef NET_SWAP_4
#define NET_SWAP_4(x) netSwap4((x))
#endif // NET_SWAP_4
#else
/* for little-endian we don't need to do anything */
#ifndef NET_SWAP_2
#define NET_SWAP_2(x) (x)
#endif // NET_SWAP_2
#ifndef NET_SWAP_4
#define NET_SWAP_4(x) (x)
#endif // NET_SWAP_4
#endif // big endian
/*----------------------------------- */
/* Run-time loadable module functions */
/*----------------------------------- */
/* Loads the specified run-time loadable DLL */
DLL_HANDLE_T osdLoadModule(uCHAR *);
/* Unloads the specified run-time loadable DLL */
uSHORT osdUnloadModule(DLL_HANDLE_T);
/* Returns a pointer to a function inside a run-time loadable DLL */
void * osdGetFnAddr(DLL_HANDLE_T,uCHAR *);
/*--------------------------------------- */
/* Mutually exclusive semaphore functions */
/*--------------------------------------- */
/* Create a named semaphore */
SEMAPHORE_T osdCreateNamedSemaphore(char *);
/* Create a mutually exlusive semaphore */
SEMAPHORE_T osdCreateSemaphore(void);
/* create an event semaphore */
SEMAPHORE_T osdCreateEventSemaphore(void);
/* create a named event semaphore */
SEMAPHORE_T osdCreateNamedEventSemaphore(char *);
/* Destroy the specified mutually exclusive semaphore object */
uSHORT osdDestroySemaphore(SEMAPHORE_T);
/* Request access to the specified mutually exclusive semaphore */
uLONG osdRequestSemaphore(SEMAPHORE_T,uLONG);
/* Release access to the specified mutually exclusive semaphore */
uSHORT osdReleaseSemaphore(SEMAPHORE_T);
/* wait for a event to happen */
uLONG osdWaitForEventSemaphore(SEMAPHORE_T, uLONG);
/* signal an event */
uLONG osdSignalEventSemaphore(SEMAPHORE_T);
/* reset the event */
uLONG osdResetEventSemaphore(SEMAPHORE_T);
/*----------------- */
/* Thread functions */
/*----------------- */
/* Releases control to the task switcher in non-preemptive */
/* multitasking operating systems. */
void osdSwitchThreads(void);
/* Starts a thread function */
uLONG osdStartThread(void *,void *);
/* what is my thread id */
uLONG osdGetThreadID(void);
/* wakes up the specifed thread */
void osdWakeThread(uLONG);
/* osd sleep for x miliseconds */
void osdSleep(uLONG);
#define DPT_THREAD_PRIORITY_LOWEST 0x00
#define DPT_THREAD_PRIORITY_NORMAL 0x01
#define DPT_THREAD_PRIORITY_HIGHEST 0x02
uCHAR osdSetThreadPriority(uLONG tid, uCHAR priority);
#ifdef __cplusplus
} /* end the xtern "C" declaration */
#endif
#endif /* osd_util_h */

484
sys/dev/asr/sys_info.h Normal file
View File

@ -0,0 +1,484 @@
/* $FreeBSD$ */
/* BSDI sys_info.h,v 1.6 1998/06/03 19:14:59 karels Exp */
/*
* Copyright (c) 1996-1999 Distributed Processing Technology Corporation
* All rights reserved.
*
* Redistribution and use in source form, with or without modification, are
* permitted provided that redistributions of source code must retain the
* above copyright notice, this list of conditions and the following disclaimer.
*
* This software is provided `as is' by Distributed Processing Technology and
* any express or implied warranties, including, but not limited to, the
* implied warranties of merchantability and fitness for a particular purpose,
* are disclaimed. In no event shall Distributed Processing Technology be
* liable for any direct, indirect, incidental, special, exemplary or
* consequential damages (including, but not limited to, procurement of
* substitute goods or services; loss of use, data, or profits; or business
* interruptions) however caused and on any theory of liability, whether in
* contract, strict liability, or tort (including negligence or otherwise)
* arising in any way out of the use of this driver software, even if advised
* of the possibility of such damage.
*
*/
#ifndef __SYS_INFO_H
#define __SYS_INFO_H
/*File - SYS_INFO.H
****************************************************************************
*
*Description:
*
* This file contains structure definitions for the OS dependent
*layer system information buffers.
*
*Copyright Distributed Processing Technology, Corp.
* 140 Candace Dr.
* Maitland, Fl. 32751 USA
* Phone: (407) 830-5522 Fax: (407) 260-5366
* All Rights Reserved
*
*Author: Don Kemper
*Date: 5/10/94
*
*Editors:
*
*Remarks:
*
*
*****************************************************************************/
/*Include Files ------------------------------------------------------------- */
#if (defined(KERNEL) && defined(__bsdi__))
# include "i386/isa/dpt_osd_util.h"
#elif ((defined(KERNEL) || defined(_KERNEL)) && defined(__FreeBSD__))
# if (KERN_VERSION < 3)
# include "i386/isa/dpt_osd_util.h"
# else
# include "dev/asr/osd_util.h"
# endif
#else
# include "osd_util.h"
#endif
#ifndef NO_PACK
#if defined (_DPT_AIX)
#pragma options align=packed
#else
#pragma pack(1)
#endif /* aix */
#endif // no unpack
/*struct - driveParam_S - start
*===========================================================================
*
*Description:
*
* This structure defines the drive parameters seen during
*booting.
*
*---------------------------------------------------------------------------*/
#ifdef __cplusplus
struct driveParam_S {
#else
typedef struct {
#endif
uSHORT cylinders; /* Upto 1024 */
uCHAR heads; /* Upto 255 */
uCHAR sectors; /* Upto 63 */
#ifdef __cplusplus
//---------- Portability Additions ----------- in sp_sinfo.cpp
#ifdef DPT_PORTABLE
uSHORT netInsert(dptBuffer_S *buffer);
uSHORT netExtract(dptBuffer_S *buffer);
#endif // DPT PORTABLE
//--------------------------------------------
};
#else
} driveParam_S;
#endif
/*driveParam_S - end */
/*struct - sysInfo_S - start
*===========================================================================
*
*Description:
*
* This structure defines the command system information that
*should be returned by every OS dependent layer.
*
*---------------------------------------------------------------------------*/
/*flags - bit definitions */
#define SI_CMOS_Valid 0x0001
#define SI_NumDrivesValid 0x0002
#define SI_ProcessorValid 0x0004
#define SI_MemorySizeValid 0x0008
#define SI_DriveParamsValid 0x0010
#define SI_SmartROMverValid 0x0020
#define SI_OSversionValid 0x0040
#define SI_OSspecificValid 0x0080 /* 1 if OS structure returned */
#define SI_BusTypeValid 0x0100
#define SI_ALL_VALID 0x0FFF /* All Std SysInfo is valid */
#define SI_NO_SmartROM 0x8000
/*busType - definitions */
#define SI_ISA_BUS 0x00
#define SI_MCA_BUS 0x01
#define SI_EISA_BUS 0x02
#define SI_PCI_BUS 0x04
#ifdef __cplusplus
struct sysInfo_S {
#else
typedef struct {
#endif
uCHAR drive0CMOS; /* CMOS Drive 0 Type */
uCHAR drive1CMOS; /* CMOS Drive 1 Type */
uCHAR numDrives; /* 0040:0075 contents */
uCHAR processorFamily; /* Same as DPTSIG's definition */
uCHAR processorType; /* Same as DPTSIG's definition */
uCHAR smartROMMajorVersion;
uCHAR smartROMMinorVersion; /* SmartROM version */
uCHAR smartROMRevision;
uSHORT flags; /* See bit definitions above */
uSHORT conventionalMemSize; /* in KB */
uLONG extendedMemSize; /* in KB */
uLONG osType; /* Same as DPTSIG's definition */
uCHAR osMajorVersion;
uCHAR osMinorVersion; /* The OS version */
uCHAR osRevision;
#ifdef _SINIX_ADDON
uCHAR busType; /* See defininitions above */
uSHORT osSubRevision;
uCHAR pad[2]; /* For alignment */
#else
uCHAR osSubRevision;
uCHAR busType; /* See defininitions above */
uCHAR pad[3]; /* For alignment */
#endif
driveParam_S drives[16]; /* SmartROM Logical Drives */
#ifdef __cplusplus
//---------- Portability Additions ----------- in sp_sinfo.cpp
#ifdef DPT_PORTABLE
uSHORT netInsert(dptBuffer_S *buffer);
uSHORT netExtract(dptBuffer_S *buffer);
#endif // DPT PORTABLE
//--------------------------------------------
};
#else
} sysInfo_S;
#endif
/*sysInfo_S - end */
/*struct - DOS_Info_S - start
*===========================================================================
*
*Description:
*
* This structure defines the system information specific to a
*DOS workstation.
*
*---------------------------------------------------------------------------*/
/*flags - bit definitions */
#define DI_DOS_HIGH 0x01 /* DOS is loaded high */
#define DI_DPMI_VALID 0x02 /* DPMI version is valid */
#ifdef __cplusplus
struct DOS_Info_S {
#else
typedef struct {
#endif
uCHAR flags; /* See bit definitions above */
uSHORT driverLocation; /* SmartROM BIOS address */
uSHORT DOS_version;
uSHORT DPMI_version;
#ifdef __cplusplus
//---------- Portability Additions ----------- in sp_sinfo.cpp
#ifdef DPT_PORTABLE
uSHORT netInsert(dptBuffer_S *buffer);
uSHORT netExtract(dptBuffer_S *buffer);
#endif // DPT PORTABLE
//--------------------------------------------
};
#else
} DOS_Info_S;
#endif
/*DOS_Info_S - end */
/*struct - Netware_Info_S - start
*===========================================================================
*
*Description:
*
* This structure defines the system information specific to a
*Netware machine.
*
*---------------------------------------------------------------------------*/
#ifdef __cplusplus
struct Netware_Info_S {
#else
typedef struct {
#endif
uCHAR driverName[13]; /* ie PM12NW31.DSK */
uCHAR serverName[48];
uCHAR netwareVersion; /* The Netware OS version */
uCHAR netwareSubVersion;
uCHAR netwareRevision;
uSHORT maxConnections; /* Probably 250 or 1000 */
uSHORT connectionsInUse;
uSHORT maxVolumes;
uCHAR unused;
uCHAR SFTlevel;
uCHAR TTSlevel;
uCHAR clibMajorVersion; /* The CLIB.NLM version */
uCHAR clibMinorVersion;
uCHAR clibRevision;
#ifdef __cplusplus
//---------- Portability Additions ----------- in sp_sinfo.cpp
#ifdef DPT_PORTABLE
uSHORT netInsert(dptBuffer_S *buffer);
uSHORT netExtract(dptBuffer_S *buffer);
#endif // DPT PORTABLE
//--------------------------------------------
};
#else
} Netware_Info_S;
#endif
/*Netware_Info_S - end */
/*struct - OS2_Info_S - start
*===========================================================================
*
*Description:
*
* This structure defines the system information specific to an
*OS/2 machine.
*
*---------------------------------------------------------------------------*/
#ifdef __cplusplus
struct OS2_Info_S {
#else
typedef struct {
#endif
uCHAR something;
#ifdef __cplusplus
//---------- Portability Additions ----------- in sp_sinfo.cpp
#ifdef DPT_PORTABLE
uSHORT netInsert(dptBuffer_S *buffer);
uSHORT netExtract(dptBuffer_S *buffer);
#endif // DPT PORTABLE
//--------------------------------------------
};
#else
} OS2_Info_S;
#endif
/*OS2_Info_S - end */
/*struct - WinNT_Info_S - start
*===========================================================================
*
*Description:
*
* This structure defines the system information specific to a
*Windows NT machine.
*
*---------------------------------------------------------------------------*/
#ifdef __cplusplus
struct WinNT_Info_S {
#else
typedef struct {
#endif
uCHAR something;
#ifdef __cplusplus
//---------- Portability Additions ----------- in sp_sinfo.cpp
#ifdef DPT_PORTABLE
uSHORT netInsert(dptBuffer_S *buffer);
uSHORT netExtract(dptBuffer_S *buffer);
#endif // DPT PORTABLE
//--------------------------------------------
};
#else
} WinNT_Info_S;
#endif
/*WinNT_Info_S - end */
/*struct - SCO_Info_S - start
*===========================================================================
*
*Description:
*
* This structure defines the system information specific to an
*SCO UNIX machine.
*
*---------------------------------------------------------------------------*/
#ifdef __cplusplus
struct SCO_Info_S {
#else
typedef struct {
#endif
uCHAR something;
#ifdef __cplusplus
//---------- Portability Additions ----------- in sp_sinfo.cpp
#ifdef DPT_PORTABLE
uSHORT netInsert(dptBuffer_S *buffer);
uSHORT netExtract(dptBuffer_S *buffer);
#endif // DPT PORTABLE
//--------------------------------------------
};
#else
} SCO_Info_S;
#endif
/*SCO_Info_S - end */
/*struct - USL_Info_S - start
*===========================================================================
*
*Description:
*
* This structure defines the system information specific to a
*USL UNIX machine.
*
*---------------------------------------------------------------------------*/
#ifdef __cplusplus
struct USL_Info_S {
#else
typedef struct {
#endif
uCHAR something;
#ifdef __cplusplus
//---------- Portability Additions ----------- in sp_sinfo.cpp
#ifdef DPT_PORTABLE
uSHORT netInsert(dptBuffer_S *buffer);
uSHORT netExtract(dptBuffer_S *buffer);
#endif // DPT PORTABLE
//--------------------------------------------
};
#else
} USL_Info_S;
#endif
/*USL_Info_S - end */
/* Restore default structure packing */
#ifndef NO_UNPACK
#if defined (_DPT_AIX)
#pragma options align=reset
#elif defined (UNPACK_FOUR)
#pragma pack(4)
#else
#pragma pack()
#endif /* aix */
#endif // no unpack
#ifdef DPT_MEASURE_PERFORMANCE
typedef struct dpt_metrics {
u_int32_t command_count[256]; /* We assume MAX 256 SCSI commands */
u_int32_t max_command_time[256];
u_int32_t min_command_time[256];
u_int32_t min_intr_time;
u_int32_t max_intr_time;
u_int32_t max_intr_gap;
u_int32_t max_ht_time;
u_int32_t aborted_interrupts;
u_int32_t spurious_interrupts;
u_int32_t aborted_requests;
u_int32_t retried_requests;
u_int32_t max_waiting_count;
u_int32_t max_submit_count;
u_int32_t max_complete_count;
u_int32_t min_waiting_time;
u_int32_t min_submit_time;
u_int32_t min_complete_time;
u_int32_t max_waiting_time;
u_int32_t max_submit_time;
u_int32_t max_complete_time;
u_int32_t command_collisions;
u_int32_t command_too_busy;
u_int32_t max_eata_tries;
u_int32_t min_eata_tries;
u_int32_t read_by_size_count[10];
u_int32_t write_by_size_count[10];
u_int32_t read_by_size_min_time[10];
u_int32_t read_by_size_max_time[10];
struct timeval read_by_size_total_time[10];
u_int32_t write_by_size_min_time[10];
u_int32_t write_by_size_max_time[10];
struct timeval write_by_size_total_time[10];
#define SIZE_512 0
#define SIZE_1K 1
#define SIZE_2K 2
#define SIZE_4K 3
#define SIZE_8K 4
#define SIZE_16K 5
#define SIZE_32K 6
#define SIZE_64K 7
#define SIZE_BIGGER 8
#define SIZE_OTHER 9
struct timeval intr_started;
} dpt_perf_t;
#endif
#endif // __SYS_INFO_H

View File

@ -101,7 +101,8 @@ device aha 1
device aic
# RAID controllers interfaced to the SCSI subsystem
device dpt # DPT Smartcache - See NOTES for options!
device asr # DPT SmartRAID V, VI and Adaptec SCSI RAID
device dpt # DPT Smartcache III, IV - See NOTES for options!
device mly # Mylex AcceleRAID/eXtremeRAID
# SCSI peripherals

View File

@ -1273,6 +1273,12 @@ options ADW_ALLOW_MEMIO
#options SYM_SETUP_MAX_LUN #-Number of LUNs supported
# default:8, range:[1..64]
# The 'asr' driver provides support for current DPT/Adaptec SCSI RAID
# controllers (SmartRAID V and VI and later).
# These controllers require the CAM infrastructure.
#
device asr
# The 'dpt' driver provides support for old DPT controllers (http://www.dpt.com/).
# These have hardware RAID-{0,1,5} support, and do multi-initiator I/O.
# The DPT controllers are commonly re-licensed under other brand-names -

View File

@ -17,7 +17,7 @@ SUBDIR= 3dfx accf_data accf_http agp aha amr an aue \
# XXX some of these can move to the general case when de-i386'ed
.if ${MACHINE_ARCH} == "i386"
SUBDIR+=bktr coff fpu gnufpu ibcs2 linprocfs linux mly splash streams \
SUBDIR+=asr bktr coff fpu gnufpu ibcs2 linprocfs linux mly splash streams \
svr4 vesa wi
.endif

9
sys/modules/asr/Makefile Normal file
View File

@ -0,0 +1,9 @@
# $FreeBSD$
.PATH: ${.CURDIR}/../../dev/asr
KMOD = asr
SRCS = asr.c
SRCS += opt_scsi.h opt_cam.h opt_asr.h
SRCS += device_if.h bus_if.h pci_if.h
.include <bsd.kmod.mk>