Home | History | Annotate | Line # | Download | only in ic
aacreg.h revision 1.8
      1  1.8  briggs /*	$NetBSD: aacreg.h,v 1.8 2007/05/26 12:45:08 briggs Exp $	*/
      2  1.1      ad 
      3  1.1      ad /*-
      4  1.6  briggs  * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
      5  1.1      ad  * All rights reserved.
      6  1.1      ad  *
      7  1.1      ad  * This code is derived from software contributed to The NetBSD Foundation
      8  1.1      ad  * by Andrew Doran.
      9  1.1      ad  *
     10  1.1      ad  * Redistribution and use in source and binary forms, with or without
     11  1.1      ad  * modification, are permitted provided that the following conditions
     12  1.1      ad  * are met:
     13  1.1      ad  * 1. Redistributions of source code must retain the above copyright
     14  1.1      ad  *    notice, this list of conditions and the following disclaimer.
     15  1.1      ad  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1      ad  *    notice, this list of conditions and the following disclaimer in the
     17  1.1      ad  *    documentation and/or other materials provided with the distribution.
     18  1.1      ad  * 3. All advertising materials mentioning features or use of this software
     19  1.1      ad  *    must display the following acknowledgement:
     20  1.1      ad  *        This product includes software developed by the NetBSD
     21  1.1      ad  *        Foundation, Inc. and its contributors.
     22  1.1      ad  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.1      ad  *    contributors may be used to endorse or promote products derived
     24  1.1      ad  *    from this software without specific prior written permission.
     25  1.1      ad  *
     26  1.1      ad  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.1      ad  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.1      ad  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.1      ad  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.1      ad  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.1      ad  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.1      ad  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.1      ad  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.1      ad  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.1      ad  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.1      ad  * POSSIBILITY OF SUCH DAMAGE.
     37  1.1      ad  */
     38  1.1      ad 
     39  1.1      ad /*-
     40  1.1      ad  * Copyright (c) 2000 Michael Smith
     41  1.6  briggs  * Copyright (c) 2000-2001 Scott Long
     42  1.1      ad  * Copyright (c) 2000 BSDi
     43  1.1      ad  * Copyright (c) 2000 Niklas Hallqvist
     44  1.1      ad  * All rights reserved.
     45  1.1      ad  *
     46  1.1      ad  * Redistribution and use in source and binary forms, with or without
     47  1.1      ad  * modification, are permitted provided that the following conditions
     48  1.1      ad  * are met:
     49  1.1      ad  * 1. Redistributions of source code must retain the above copyright
     50  1.1      ad  *    notice, this list of conditions and the following disclaimer.
     51  1.1      ad  * 2. Redistributions in binary form must reproduce the above copyright
     52  1.1      ad  *    notice, this list of conditions and the following disclaimer in the
     53  1.1      ad  *    documentation and/or other materials provided with the distribution.
     54  1.1      ad  *
     55  1.1      ad  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     56  1.1      ad  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     57  1.1      ad  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     58  1.1      ad  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     59  1.1      ad  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     60  1.1      ad  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     61  1.1      ad  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     62  1.1      ad  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     63  1.1      ad  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     64  1.1      ad  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     65  1.1      ad  * SUCH DAMAGE.
     66  1.1      ad  *
     67  1.1      ad  * from FreeBSD: aacreg.h,v 1.1 2000/09/13 03:20:34 msmith Exp
     68  1.1      ad  * via OpenBSD: aacreg.h,v 1.3 2001/06/12 15:40:29 niklas Exp
     69  1.6  briggs  * incorporating some of: aacreg.h,v 1.23 2005/10/14 16:22:45 scottl Exp
     70  1.1      ad  */
     71  1.1      ad 
     72  1.1      ad /*
     73  1.1      ad  * Data structures defining the interface between the driver and the Adaptec
     74  1.1      ad  * 'FSA' adapters.  Note that many field names and comments here are taken
     75  1.1      ad  * verbatim from the Adaptec driver source in order to make comparing the
     76  1.1      ad  * two slightly easier.
     77  1.1      ad  */
     78  1.1      ad 
     79  1.1      ad #ifndef _PCI_AACREG_H_
     80  1.1      ad #define	_PCI_AACREG_H_
     81  1.1      ad 
     82  1.1      ad /*
     83  1.1      ad  * Misc. magic numbers.
     84  1.1      ad  */
     85  1.1      ad #define	AAC_MAX_CONTAINERS	64
     86  1.1      ad #define	AAC_BLOCK_SIZE		512
     87  1.1      ad 
     88  1.1      ad /*
     89  1.1      ad  * Communications interface.
     90  1.1      ad  *
     91  1.1      ad  * Where datastructure layouts are closely parallel to the Adaptec sample code,
     92  1.1      ad  * retain their naming conventions (for now) to aid in cross-referencing.
     93  1.1      ad  */
     94  1.1      ad 
     95  1.1      ad /*
     96  1.1      ad  * We establish 4 command queues and matching response queues.  Queues must
     97  1.1      ad  * be 16-byte aligned, and are sized as follows:
     98  1.1      ad  */
     99  1.1      ad #define	AAC_HOST_NORM_CMD_ENTRIES	8	/* cmd adapter->host, normal pri */
    100  1.1      ad #define	AAC_HOST_HIGH_CMD_ENTRIES	4	/* cmd adapter->host, high pri */
    101  1.1      ad #define	AAC_ADAP_NORM_CMD_ENTRIES	512	/* cmd host->adapter, normal pri */
    102  1.1      ad #define	AAC_ADAP_HIGH_CMD_ENTRIES	4	/* cmd host->adapter, high pri */
    103  1.1      ad #define	AAC_HOST_NORM_RESP_ENTRIES	512	/* resp, adapter->host, normal pri */
    104  1.1      ad #define	AAC_HOST_HIGH_RESP_ENTRIES	4	/* resp, adapter->host, high pri */
    105  1.1      ad #define	AAC_ADAP_NORM_RESP_ENTRIES	8	/* resp, host->adapter, normal pri */
    106  1.1      ad #define	AAC_ADAP_HIGH_RESP_ENTRIES	4	/* resp, host->adapter, high pri */
    107  1.1      ad 
    108  1.1      ad #define	AAC_TOTALQ_LENGTH \
    109  1.1      ad     (AAC_HOST_HIGH_CMD_ENTRIES + AAC_HOST_NORM_CMD_ENTRIES + \
    110  1.1      ad     AAC_ADAP_HIGH_CMD_ENTRIES +	AAC_ADAP_NORM_CMD_ENTRIES + \
    111  1.1      ad     AAC_HOST_HIGH_RESP_ENTRIES + AAC_HOST_NORM_RESP_ENTRIES + \
    112  1.1      ad     AAC_ADAP_HIGH_RESP_ENTRIES + AAC_ADAP_NORM_RESP_ENTRIES)
    113  1.1      ad 
    114  1.1      ad #define	AAC_QUEUE_COUNT		8
    115  1.1      ad #define	AAC_QUEUE_ALIGN		16
    116  1.1      ad 
    117  1.1      ad struct aac_queue_entry {
    118  1.1      ad 	u_int32_t aq_fib_size;		/* FIB size in bytes */
    119  1.1      ad 	u_int32_t aq_fib_addr;		/* receiver-space address of the FIB */
    120  1.1      ad } __attribute__ ((__packed__));
    121  1.1      ad 
    122  1.1      ad #define	AAC_PRODUCER_INDEX	0
    123  1.1      ad #define	AAC_CONSUMER_INDEX	1
    124  1.1      ad 
    125  1.1      ad /*
    126  1.1      ad  * Table of queue indices and queues used to communicate with the
    127  1.1      ad  * controller.  This structure must be aligned to AAC_QUEUE_ALIGN
    128  1.1      ad  */
    129  1.1      ad struct aac_queue_table {
    130  1.1      ad 	/* queue consumer/producer indexes (layout mandated by adapter) */
    131  1.1      ad 	u_int32_t qt_qindex[AAC_QUEUE_COUNT][2];
    132  1.1      ad 
    133  1.1      ad 	/* queue entry structures (layout mandated by adapter) */
    134  1.1      ad 	struct aac_queue_entry qt_HostNormCmdQueue[AAC_HOST_NORM_CMD_ENTRIES];
    135  1.1      ad 	struct aac_queue_entry qt_HostHighCmdQueue[AAC_HOST_HIGH_CMD_ENTRIES];
    136  1.1      ad 	struct aac_queue_entry qt_AdapNormCmdQueue[AAC_ADAP_NORM_CMD_ENTRIES];
    137  1.1      ad 	struct aac_queue_entry qt_AdapHighCmdQueue[AAC_ADAP_HIGH_CMD_ENTRIES];
    138  1.1      ad 	struct aac_queue_entry
    139  1.1      ad 	    qt_HostNormRespQueue[AAC_HOST_NORM_RESP_ENTRIES];
    140  1.1      ad 	struct aac_queue_entry
    141  1.1      ad 	    qt_HostHighRespQueue[AAC_HOST_HIGH_RESP_ENTRIES];
    142  1.1      ad 	struct aac_queue_entry
    143  1.1      ad 	    qt_AdapNormRespQueue[AAC_ADAP_NORM_RESP_ENTRIES];
    144  1.1      ad 	struct aac_queue_entry
    145  1.1      ad 	    qt_AdapHighRespQueue[AAC_ADAP_HIGH_RESP_ENTRIES];
    146  1.1      ad } __attribute__ ((__packed__));
    147  1.1      ad 
    148  1.1      ad /*
    149  1.3   perry  * Adapter Init Structure: this is passed to the adapter with the
    150  1.1      ad  * AAC_MONKER_INITSTRUCT command to point it at our control structures.
    151  1.1      ad  */
    152  1.1      ad struct aac_adapter_init {
    153  1.1      ad 	u_int32_t InitStructRevision;
    154  1.1      ad 	u_int32_t MiniPortRevision;
    155  1.1      ad 	u_int32_t FilesystemRevision;
    156  1.1      ad 	u_int32_t CommHeaderAddress;
    157  1.1      ad 	u_int32_t FastIoCommAreaAddress;
    158  1.1      ad 	u_int32_t AdapterFibsPhysicalAddress;
    159  1.7  briggs 	u_int32_t AdapterFibsVirtualAddress;
    160  1.1      ad 	u_int32_t AdapterFibsSize;
    161  1.1      ad 	u_int32_t AdapterFibAlign;
    162  1.1      ad 	u_int32_t PrintfBufferAddress;
    163  1.1      ad 	u_int32_t PrintfBufferSize;
    164  1.1      ad 	u_int32_t HostPhysMemPages;
    165  1.1      ad 	u_int32_t HostElapsedSeconds;
    166  1.7  briggs 	/* ADAPTER_INIT_STRUCT_REVISION_4 begins here */
    167  1.7  briggs 	u_int32_t InitFlags;		/* flags for supported features */
    168  1.7  briggs 	u_int32_t MaxIoCommands;	/* max outstanding commands */
    169  1.7  briggs 	u_int32_t MaxIoSize;		/* largest I/O command */
    170  1.7  briggs 	u_int32_t MaxFibSize;		/* largest FIB to adapter */
    171  1.1      ad } __attribute__((__packed__));
    172  1.1      ad 
    173  1.8  briggs #define	AAC_INIT_STRUCT_REVISION		3
    174  1.8  briggs #define	AAC_INIT_STRUCT_REVISION_4		4
    175  1.8  briggs #define	AAC_INIT_STRUCT_MINIPORT_REVISION	1
    176  1.8  briggs #define AAC_INITFLAGS_NEW_COMM_SUPPORTED	1
    177  1.8  briggs #define AAC_PAGE_SIZE		4096	/* Used to set HostPhysMemPages */
    178  1.8  briggs 
    179  1.1      ad /*
    180  1.1      ad  * Shared data types
    181  1.1      ad  */
    182  1.1      ad 
    183  1.1      ad /*
    184  1.1      ad  * Container types
    185  1.1      ad  */
    186  1.1      ad #define	CT_NONE			0
    187  1.1      ad #define	CT_VOLUME		1
    188  1.1      ad #define	CT_MIRROR		2
    189  1.1      ad #define	CT_STRIPE		3
    190  1.1      ad #define	CT_RAID5		4
    191  1.1      ad #define	CT_SSRW			5
    192  1.1      ad #define	CT_SSRO			6
    193  1.1      ad #define	CT_MORPH		7
    194  1.1      ad #define	CT_PASSTHRU		8
    195  1.1      ad #define	CT_RAID4		9
    196  1.1      ad #define	CT_RAID10		10	/* stripe of mirror */
    197  1.1      ad #define	CT_RAID00		11	/* stripe of stripe */
    198  1.1      ad #define	CT_VOLUME_OF_MIRRORS	12	/* volume of mirror */
    199  1.1      ad #define	CT_PSEUDO_RAID3		13	/* really raid4 */
    200  1.1      ad 
    201  1.1      ad /*
    202  1.1      ad  * Host-addressable object types
    203  1.1      ad  */
    204  1.1      ad #define	FT_REG			1	/* regular file */
    205  1.1      ad #define	FT_DIR			2	/* directory */
    206  1.1      ad #define	FT_BLK			3	/* "block" device - reserved */
    207  1.1      ad #define	FT_CHR			4	/* "character special" device - reserved */
    208  1.1      ad #define	FT_LNK			5	/* symbolic link */
    209  1.1      ad #define	FT_SOCK			6	/* socket */
    210  1.1      ad #define	FT_FIFO			7	/* fifo */
    211  1.1      ad #define	FT_FILESYS		8	/* ADAPTEC's "FSA"(tm) filesystem */
    212  1.1      ad #define	FT_DRIVE		9	/* phys disk - addressable in scsi by bus/target/lun */
    213  1.1      ad #define	FT_SLICE		10	/* virtual disk - raw volume - slice */
    214  1.1      ad #define	FT_PARTITION		11	/* FSA part, inside slice, container building block */
    215  1.1      ad #define	FT_VOLUME		12	/* Container - Volume Set */
    216  1.1      ad #define	FT_STRIPE		13	/* Container - Stripe Set */
    217  1.1      ad #define	FT_MIRROR		14	/* Container - Mirror Set */
    218  1.1      ad #define	FT_RAID5		15	/* Container - Raid 5 Set */
    219  1.1      ad #define	FT_DATABASE		16	/* Storage object with "foreign" content manager */
    220  1.1      ad 
    221  1.1      ad /*
    222  1.1      ad  * Host-side scatter/gather list for 32-bit commands.
    223  1.1      ad  */
    224  1.1      ad struct aac_sg_entry {
    225  1.1      ad 	u_int32_t SgAddress;
    226  1.1      ad 	u_int32_t SgByteCount;
    227  1.1      ad } __attribute__ ((__packed__));
    228  1.1      ad 
    229  1.1      ad struct aac_sg_table {
    230  1.1      ad 	u_int32_t SgCount;
    231  1.1      ad 	struct aac_sg_entry SgEntry[0];	/* XXX */
    232  1.1      ad } __attribute__ ((__packed__));
    233  1.1      ad 
    234  1.1      ad /*
    235  1.1      ad  * Host-side scatter/gather list for 64-bit commands.
    236  1.1      ad  */
    237  1.1      ad struct aac_sg_table64 {
    238  1.1      ad 	u_int8_t SgCount;
    239  1.1      ad 	u_int8_t SgSectorsPerPage;
    240  1.1      ad 	u_int16_t SgByteOffset;
    241  1.1      ad 	u_int64_t SgEntry[0];
    242  1.1      ad } __attribute__ ((__packed__));
    243  1.1      ad 
    244  1.1      ad /*
    245  1.1      ad  * Container creation data
    246  1.1      ad  */
    247  1.1      ad struct aac_container_creation {
    248  1.1      ad 	u_int8_t ViaBuildNumber;
    249  1.1      ad 	u_int8_t MicroSecond;
    250  1.1      ad 	u_int8_t Via;			/* 1 = FSU, 2 = API, etc. */
    251  1.1      ad 	u_int8_t YearsSince1900;
    252  1.1      ad 	u_int32_t Month:4;		/* 1-12 */
    253  1.1      ad 	u_int32_t Day:6;		/* 1-32 */
    254  1.1      ad 	u_int32_t Hour:6;		/* 0-23 */
    255  1.1      ad 	u_int32_t Minute:6;		/* 0-59 */
    256  1.1      ad 	u_int32_t Second:6;		/* 0-59 */
    257  1.1      ad 	u_int64_t ViaAdapterSerialNumber;
    258  1.1      ad } __attribute__ ((__packed__));
    259  1.1      ad 
    260  1.1      ad struct FsaRevision {
    261  1.1      ad 	union {
    262  1.1      ad         	struct {
    263  1.1      ad 			u_int8_t dash;
    264  1.1      ad 			u_int8_t type;
    265  1.1      ad 			u_int8_t minor;
    266  1.1      ad 			u_int8_t major;
    267  1.1      ad 	        } comp;
    268  1.1      ad 	        u_int32_t ul;
    269  1.1      ad 	} external;
    270  1.1      ad 	u_int32_t buildNumber;
    271  1.1      ad } __attribute__((__packed__));
    272  1.1      ad 
    273  1.1      ad /*
    274  1.1      ad  * Adapter Information
    275  1.1      ad  */
    276  1.1      ad 
    277  1.1      ad #define	CPU_NTSIM		1
    278  1.1      ad #define	CPU_I960		2
    279  1.1      ad #define	CPU_ARM			3
    280  1.1      ad #define	CPU_SPARC		4
    281  1.1      ad #define	CPU_POWERPC		5
    282  1.1      ad #define	CPU_ALPHA		6
    283  1.1      ad #define	CPU_P7			7
    284  1.1      ad #define	CPU_I960_RX		8
    285  1.1      ad #define	CPU__last		9
    286  1.1      ad 
    287  1.1      ad #define	CPUI960_JX		1
    288  1.1      ad #define	CPUI960_CX		2
    289  1.1      ad #define	CPUI960_HX		3
    290  1.1      ad #define	CPUI960_RX		4
    291  1.1      ad #define	CPUARM_SA110		5
    292  1.1      ad #define	CPUARM_xxx		6
    293  1.1      ad #define	CPUPPC_603e		7
    294  1.1      ad #define	CPUPPC_xxx		8
    295  1.2  briggs #define	CPUI80303		9
    296  1.2  briggs #define	CPUSUBTYPE__last	10
    297  1.1      ad 
    298  1.1      ad #define	PLAT_NTSIM		1
    299  1.1      ad #define	PLAT_V3ADU		2
    300  1.1      ad #define	PLAT_CYCLONE		3
    301  1.1      ad #define	PLAT_CYCLONE_HD		4
    302  1.1      ad #define	PLAT_BATBOARD		5
    303  1.1      ad #define	PLAT_BATBOARD_HD	6
    304  1.1      ad #define	PLAT_YOLO		7
    305  1.1      ad #define	PLAT_COBRA		8
    306  1.1      ad #define	PLAT_ANAHEIM		9
    307  1.1      ad #define	PLAT_JALAPENO		10
    308  1.1      ad #define	PLAT_QUEENS		11
    309  1.1      ad #define	PLAT_JALAPENO_DELL	12
    310  1.1      ad #define	PLAT_POBLANO		13
    311  1.1      ad #define	PLAT_POBLANO_OPAL	14
    312  1.1      ad #define	PLAT_POBLANO_SL0	15
    313  1.1      ad #define	PLAT_POBLANO_SL1	16
    314  1.1      ad #define	PLAT_POBLANO_SL2	17
    315  1.1      ad #define	PLAT_POBLANO_XXX	18
    316  1.1      ad #define	PLAT_JALAPENO_P2	19
    317  1.1      ad #define	PLAT_HABANERO		20
    318  1.1      ad #define	PLAT__last		21
    319  1.1      ad 
    320  1.1      ad #define	OEM_FLAVOR_ADAPTEC	1
    321  1.1      ad #define	OEM_FLAVOR_DELL		2
    322  1.1      ad #define	OEM_FLAVOR_HP		3
    323  1.1      ad #define	OEM_FLAVOR_IBM		4
    324  1.1      ad #define	OEM_FLAVOR_CPQ		5
    325  1.1      ad #define	OEM_FLAVOR_BRAND_X	6
    326  1.1      ad #define	OEM_FLAVOR_BRAND_Y	7
    327  1.1      ad #define	OEM_FLAVOR_BRAND_Z	8
    328  1.1      ad #define	OEM_FLAVOR__last	9
    329  1.1      ad 
    330  1.1      ad /*
    331  1.1      ad  * XXX the aac-2622 with no battery present reports PLATFORM_BAT_OPT_PRESENT
    332  1.1      ad  */
    333  1.1      ad #define	PLATFORM_BAT_REQ_PRESENT	1	/* BATTERY REQUIRED AND PRESENT */
    334  1.1      ad #define	PLATFORM_BAT_REQ_NOTPRESENT	2	/* BATTERY REQUIRED AND NOT PRESENT */
    335  1.1      ad #define	PLATFORM_BAT_OPT_PRESENT	3	/* BATTERY OPTIONAL AND PRESENT */
    336  1.1      ad #define	PLATFORM_BAT_OPT_NOTPRESENT	4	/* BATTERY OPTIONAL AND NOT PRESENT */
    337  1.1      ad #define	PLATFORM_BAT_NOT_SUPPORTED	5	/* BATTERY NOT SUPPORTED */
    338  1.1      ad 
    339  1.3   perry /*
    340  1.1      ad  * Structure used to respond to a RequestAdapterInfo fib.
    341  1.1      ad  */
    342  1.1      ad struct aac_adapter_info {
    343  1.1      ad 	u_int32_t PlatformBase;		/* adapter type */
    344  1.1      ad 	u_int32_t CpuArchitecture;	/* adapter CPU type */
    345  1.1      ad 	u_int32_t CpuVariant;		/* adapter CPU subtype */
    346  1.1      ad 	u_int32_t ClockSpeed;		/* adapter CPU clockspeed */
    347  1.1      ad 	u_int32_t ExecutionMem;		/* adapter Execution Memory size */
    348  1.1      ad 	u_int32_t BufferMem;		/* adapter Data Memory */
    349  1.1      ad 	u_int32_t TotalMem;		/* adapter Total Memory */
    350  1.1      ad 	struct FsaRevision KernelRevision; /* adapter Kernel SW Revision */
    351  1.1      ad 	struct FsaRevision MonitorRevision; /* adapter Monitor/Diag SW Rev */
    352  1.1      ad 	struct FsaRevision HardwareRevision; /* TDB */
    353  1.1      ad 	struct FsaRevision BIOSRevision; /* adapter BIOS Revision */
    354  1.1      ad 	u_int32_t ClusteringEnabled;
    355  1.1      ad 	u_int32_t ClusterChannelMask;
    356  1.1      ad 	u_int64_t SerialNumber;
    357  1.1      ad 	u_int32_t batteryPlatform;
    358  1.1      ad 	u_int32_t SupportedOptions;	/* supported features of this ctrlr */
    359  1.1      ad 	u_int32_t OemVariant;
    360  1.1      ad } __attribute__((__packed__));
    361  1.1      ad 
    362  1.1      ad /*
    363  1.1      ad  * Monitor/Kernel interface.
    364  1.1      ad  */
    365  1.1      ad 
    366  1.1      ad /*
    367  1.1      ad  * Synchronous commands to the monitor/kernel.
    368  1.1      ad  */
    369  1.1      ad #define	AAC_MONKER_INITSTRUCT	0x05
    370  1.1      ad #define	AAC_MONKER_SYNCFIB	0x0c
    371  1.1      ad #define	AAC_MONKER_GETKERNVER	0x11
    372  1.4  briggs #define	AAC_MONKER_GETINFO	0x19
    373  1.1      ad 
    374  1.1      ad /*
    375  1.1      ad  * Command status values
    376  1.1      ad  */
    377  1.1      ad #define	ST_OK			0
    378  1.1      ad #define	ST_PERM			1
    379  1.1      ad #define	ST_NOENT		2
    380  1.1      ad #define	ST_IO			5
    381  1.1      ad #define	ST_NXIO			6
    382  1.1      ad #define	ST_E2BIG		7
    383  1.1      ad #define	ST_ACCES		13
    384  1.1      ad #define	ST_EXIST		17
    385  1.1      ad #define	ST_XDEV			18
    386  1.1      ad #define	ST_NODEV		19
    387  1.1      ad #define	ST_NOTDIR		20
    388  1.1      ad #define	ST_ISDIR		21
    389  1.1      ad #define	ST_INVAL		22
    390  1.1      ad #define	ST_FBIG			27
    391  1.1      ad #define	ST_NOSPC		28
    392  1.1      ad #define	ST_ROFS			30
    393  1.1      ad #define	ST_MLINK		31
    394  1.1      ad #define	ST_WOULDBLOCK		35
    395  1.1      ad #define	ST_NAMETOOLONG		63
    396  1.1      ad #define	ST_NOTEMPTY		66
    397  1.1      ad #define	ST_DQUOT		69
    398  1.1      ad #define	ST_STALE		70
    399  1.1      ad #define	ST_REMOTE		71
    400  1.1      ad #define	ST_BADHANDLE		10001
    401  1.1      ad #define	ST_NOT_SYNC		10002
    402  1.1      ad #define	ST_BAD_COOKIE		10003
    403  1.1      ad #define	ST_NOTSUPP		10004
    404  1.1      ad #define	ST_TOOSMALL		10005
    405  1.1      ad #define	ST_SERVERFAULT		10006
    406  1.1      ad #define	ST_BADTYPE		10007
    407  1.1      ad #define	ST_JUKEBOX		10008
    408  1.1      ad #define	ST_NOTMOUNTED		10009
    409  1.1      ad #define	ST_MAINTMODE		10010
    410  1.1      ad #define	ST_STALEACL		10011
    411  1.1      ad 
    412  1.1      ad /*
    413  1.1      ad  * Volume manager commands
    414  1.1      ad  */
    415  1.1      ad #define	VM_Null			0
    416  1.1      ad #define	VM_NameServe		1
    417  1.1      ad #define	VM_ContainerConfig	2
    418  1.1      ad #define	VM_Ioctl		3
    419  1.1      ad #define	VM_FilesystemIoctl	4
    420  1.1      ad #define	VM_CloseAll		5
    421  1.1      ad #define	VM_CtBlockRead		6
    422  1.1      ad #define	VM_CtBlockWrite		7
    423  1.1      ad #define	VM_SliceBlockRead	8	/* raw access to configured "storage objects" */
    424  1.1      ad #define	VM_SliceBlockWrite	9
    425  1.1      ad #define	VM_DriveBlockRead	10	/* raw access to physical devices */
    426  1.1      ad #define	VM_DriveBlockWrite	11
    427  1.1      ad #define	VM_EnclosureMgt		12	/* enclosure management */
    428  1.1      ad #define	VM_Unused		13	/* used to be diskset management */
    429  1.1      ad #define	VM_CtBlockVerify	14
    430  1.1      ad #define	VM_CtPerf		15	/* performance test */
    431  1.1      ad #define	VM_CtBlockRead64	16
    432  1.1      ad #define	VM_CtBlockWrite64	17
    433  1.1      ad #define	VM_CtBlockVerify64	18
    434  1.1      ad 
    435  1.1      ad /*
    436  1.1      ad  * "Mountable object"
    437  1.1      ad  */
    438  1.1      ad struct aac_mntobj {
    439  1.1      ad 	u_int32_t ObjectId;
    440  1.1      ad 	char	FileSystemName[16];
    441  1.1      ad 	struct aac_container_creation CreateInfo;
    442  1.1      ad 	u_int32_t Capacity;
    443  1.1      ad 	u_int32_t VolType;
    444  1.1      ad 	u_int32_t ObjType;
    445  1.1      ad 	u_int32_t ContentState;
    446  1.1      ad #define	AAC_FSCS_READONLY 0x0002 /* XXX need more information than this */
    447  1.1      ad 	union {
    448  1.1      ad 		u_int32_t pad[8];
    449  1.1      ad 	} ObjExtension;
    450  1.1      ad 	u_int32_t AlterEgoId;
    451  1.1      ad } __attribute__ ((__packed__));
    452  1.1      ad 
    453  1.1      ad struct aac_mntinfo {
    454  1.1      ad 	u_int32_t Command;
    455  1.1      ad 	u_int32_t MntType;
    456  1.1      ad 	u_int32_t MntCount;
    457  1.1      ad } __attribute__ ((__packed__));
    458  1.1      ad 
    459  1.1      ad struct aac_mntinforesponse {
    460  1.1      ad 	u_int32_t Status;
    461  1.1      ad 	u_int32_t MntType;
    462  1.1      ad 	u_int32_t MntRespCount;
    463  1.1      ad 	struct aac_mntobj MntTable[1];
    464  1.1      ad } __attribute__ ((__packed__));
    465  1.1      ad 
    466  1.1      ad /*
    467  1.1      ad  * Write 'stability' options.
    468  1.1      ad  */
    469  1.1      ad #define	CSTABLE			1
    470  1.1      ad #define	CUNSTABLE		2
    471  1.1      ad 
    472  1.1      ad /*
    473  1.1      ad  * Commit level response for a write request.
    474  1.1      ad  */
    475  1.1      ad #define	CMFILE_SYNC_NVRAM	1
    476  1.1      ad #define	CMDATA_SYNC_NVRAM	2
    477  1.1      ad #define	CMFILE_SYNC		3
    478  1.1      ad #define	CMDATA_SYNC		4
    479  1.1      ad #define	CMUNSTABLE		5
    480  1.1      ad 
    481  1.1      ad /*
    482  1.1      ad  * Block read/write operations.  These structures are packed into the 'data'
    483  1.1      ad  * area in the FIB.
    484  1.1      ad  */
    485  1.1      ad struct aac_blockread {
    486  1.1      ad 	u_int32_t Command;		/* not FSACommand! */
    487  1.1      ad 	u_int32_t ContainerId;
    488  1.1      ad 	u_int32_t BlockNumber;
    489  1.1      ad 	u_int32_t ByteCount;
    490  1.1      ad 	struct aac_sg_table SgMap;	/* variable size */
    491  1.1      ad } __attribute__ ((__packed__));
    492  1.1      ad 
    493  1.1      ad struct aac_blockread_response {
    494  1.1      ad 	u_int32_t Status;
    495  1.1      ad 	u_int32_t ByteCount;
    496  1.1      ad } __attribute__ ((__packed__));
    497  1.1      ad 
    498  1.1      ad struct aac_blockwrite {
    499  1.1      ad 	u_int32_t Command;	/* not FSACommand! */
    500  1.1      ad 	u_int32_t ContainerId;
    501  1.1      ad 	u_int32_t BlockNumber;
    502  1.1      ad 	u_int32_t ByteCount;
    503  1.1      ad 	u_int32_t Stable;
    504  1.1      ad 	struct aac_sg_table SgMap;	/* variable size */
    505  1.1      ad } __attribute__ ((__packed__));
    506  1.1      ad 
    507  1.1      ad struct aac_blockwrite_response {
    508  1.1      ad 	u_int32_t Status;
    509  1.1      ad 	u_int32_t ByteCount;
    510  1.1      ad 	u_int32_t Committed;
    511  1.1      ad } __attribute__ ((__packed__));
    512  1.1      ad 
    513  1.1      ad struct aac_close_command {
    514  1.1      ad 	u_int32_t	Command;
    515  1.1      ad 	u_int32_t	ContainerId;
    516  1.1      ad } __attribute__ ((__packed__));
    517  1.1      ad 
    518  1.1      ad /*
    519  1.1      ad  * Register definitions for the Adaptec AAC-364 'Jalapeno I/II' adapters, based
    520  1.1      ad  * on the SA110 'StrongArm'.
    521  1.1      ad  */
    522  1.1      ad 
    523  1.1      ad #define	AAC_REGSIZE		0x100
    524  1.1      ad 
    525  1.1      ad /* doorbell 0 (adapter->host) */
    526  1.1      ad #define	AAC_SA_DOORBELL0_CLEAR	0x98
    527  1.1      ad #define	AAC_SA_DOORBELL0_SET	0x9c
    528  1.1      ad #define	AAC_SA_DOORBELL0	0x9c
    529  1.1      ad #define	AAC_SA_MASK0_CLEAR	0xa0
    530  1.1      ad #define	AAC_SA_MASK0_SET	0xa4
    531  1.1      ad 
    532  1.1      ad /* doorbell 1 (host->adapter) */
    533  1.1      ad #define	AAC_SA_DOORBELL1_CLEAR	0x9a
    534  1.1      ad #define	AAC_SA_DOORBELL1_SET	0x9e
    535  1.1      ad #define	AAC_SA_MASK1_CLEAR	0xa2
    536  1.1      ad #define	AAC_SA_MASK1_SET	0xa6
    537  1.1      ad 
    538  1.1      ad /* mailbox (20 bytes) */
    539  1.1      ad #define	AAC_SA_MAILBOX		0xa8
    540  1.1      ad #define	AAC_SA_FWSTATUS		0xc4
    541  1.1      ad 
    542  1.1      ad /*
    543  1.1      ad  * Register definitions for the Adaptec 'Pablano' adapters, based on the
    544  1.1      ad  * i960Rx, and other related adapters.
    545  1.1      ad  */
    546  1.1      ad 
    547  1.1      ad #define	AAC_RX_IDBR		0x20	/* inbound doorbell */
    548  1.1      ad #define	AAC_RX_IISR		0x24	/* inbound interrupt status */
    549  1.1      ad #define	AAC_RX_IIMR		0x28	/* inbound interrupt mask */
    550  1.1      ad #define	AAC_RX_ODBR		0x2c	/* outbound doorbell */
    551  1.1      ad #define	AAC_RX_OISR		0x30	/* outbound interrupt status */
    552  1.1      ad #define	AAC_RX_OIMR		0x34	/* outbound interrupt mask */
    553  1.1      ad 
    554  1.1      ad #define	AAC_RX_MAILBOX		0x50	/* mailbox (20 bytes) */
    555  1.1      ad #define	AAC_RX_FWSTATUS		0x6c
    556  1.1      ad 
    557  1.1      ad /*
    558  1.1      ad  * Common bit definitions for the doorbell registers.
    559  1.1      ad  */
    560  1.1      ad 
    561  1.1      ad /*
    562  1.1      ad  * Status bits in the doorbell registers.
    563  1.1      ad  */
    564  1.1      ad #define	AAC_DB_SYNC_COMMAND	(1<<0)	/* send/completed synchronous FIB */
    565  1.1      ad #define	AAC_DB_COMMAND_READY	(1<<1)	/* posted one or more commands */
    566  1.1      ad #define	AAC_DB_RESPONSE_READY	(1<<2)	/* one or more commands complete */
    567  1.1      ad #define	AAC_DB_COMMAND_NOT_FULL	(1<<3)	/* command queue not full */
    568  1.1      ad #define	AAC_DB_RESPONSE_NOT_FULL (1<<4)	/* response queue not full */
    569  1.1      ad 
    570  1.1      ad /*
    571  1.1      ad  * The adapter can request the host print a message by setting the
    572  1.1      ad  * DB_PRINTF flag in DOORBELL0.  The driver responds by collecting the
    573  1.3   perry  * message from the printf buffer, clearing the DB_PRINTF flag in
    574  1.1      ad  * DOORBELL0 and setting it in DOORBELL1.
    575  1.1      ad  * (ODBR and IDBR respectively for the i960Rx adapters)
    576  1.1      ad  */
    577  1.1      ad #define	AAC_DB_PRINTF		(1<<5)
    578  1.1      ad 
    579  1.1      ad /*
    580  1.1      ad  * Mask containing the interrupt bits we care about.  We don't anticipate
    581  1.1      ad  * (or want) interrupts not in this mask.
    582  1.1      ad  */
    583  1.1      ad #define	AAC_DB_INTERRUPTS \
    584  1.1      ad 	(AAC_DB_COMMAND_READY | AAC_DB_RESPONSE_READY | AAC_DB_PRINTF)
    585  1.1      ad 
    586  1.1      ad /*
    587  1.1      ad  * Queue names
    588  1.1      ad  *
    589  1.1      ad  * Note that we base these at 0 in order to use them as array indices.  Adaptec
    590  1.1      ad  * used base 1 for some unknown reason, and sorted them in a different order.
    591  1.1      ad  */
    592  1.1      ad #define	AAC_HOST_NORM_CMD_QUEUE		0
    593  1.1      ad #define	AAC_HOST_HIGH_CMD_QUEUE		1
    594  1.1      ad #define	AAC_ADAP_NORM_CMD_QUEUE		2
    595  1.1      ad #define	AAC_ADAP_HIGH_CMD_QUEUE		3
    596  1.1      ad #define	AAC_HOST_NORM_RESP_QUEUE	4
    597  1.1      ad #define	AAC_HOST_HIGH_RESP_QUEUE	5
    598  1.1      ad #define	AAC_ADAP_NORM_RESP_QUEUE	6
    599  1.1      ad #define	AAC_ADAP_HIGH_RESP_QUEUE	7
    600  1.1      ad 
    601  1.1      ad /*
    602  1.1      ad  * List structure used to chain FIBs (used by the adapter - we hang FIBs off
    603  1.1      ad  * our private command structure and don't touch these)
    604  1.1      ad  */
    605  1.1      ad struct aac_fib_list_entry {
    606  1.7  briggs 	u_int32_t	Flink;
    607  1.7  briggs 	u_int32_t	Blink;
    608  1.1      ad } __attribute__((__packed__));
    609  1.1      ad 
    610  1.1      ad /*
    611  1.1      ad  * FIB (FSA Interface Block?); this is the datastructure passed between the
    612  1.1      ad  * host and adapter.
    613  1.1      ad  */
    614  1.1      ad struct aac_fib_header {
    615  1.1      ad 	u_int32_t XferState;
    616  1.1      ad 	u_int16_t Command;
    617  1.1      ad 	u_int8_t StructType;
    618  1.1      ad 	u_int8_t Flags;
    619  1.1      ad 	u_int16_t Size;
    620  1.1      ad 	u_int16_t SenderSize;
    621  1.1      ad 	u_int32_t SenderFibAddress;
    622  1.1      ad 	u_int32_t ReceiverFibAddress;
    623  1.1      ad 	u_int32_t SenderData;
    624  1.1      ad 	union {
    625  1.1      ad 		struct {
    626  1.1      ad 			u_int32_t ReceiverTimeStart;
    627  1.1      ad 			u_int32_t ReceiverTimeDone;
    628  1.1      ad 		} _s;
    629  1.1      ad 		struct aac_fib_list_entry FibLinks;
    630  1.1      ad 	} _u;
    631  1.1      ad } __attribute__((__packed__));
    632  1.1      ad 
    633  1.1      ad #define	AAC_FIB_DATASIZE (512 - sizeof(struct aac_fib_header))
    634  1.1      ad 
    635  1.1      ad struct aac_fib {
    636  1.1      ad 	struct aac_fib_header Header;
    637  1.1      ad 	u_int8_t data[AAC_FIB_DATASIZE];
    638  1.1      ad } __attribute__((__packed__));
    639  1.1      ad 
    640  1.1      ad /*
    641  1.1      ad  * FIB commands
    642  1.1      ad  */
    643  1.1      ad #define	TestCommandResponse		1
    644  1.1      ad #define	TestAdapterCommand		2
    645  1.1      ad 
    646  1.1      ad /* Lowlevel and comm commands */
    647  1.1      ad #define	LastTestCommand			100
    648  1.1      ad #define	ReinitHostNormCommandQueue	101
    649  1.1      ad #define	ReinitHostHighCommandQueue	102
    650  1.1      ad #define	ReinitHostHighRespQueue		103
    651  1.1      ad #define	ReinitHostNormRespQueue		104
    652  1.1      ad #define	ReinitAdapNormCommandQueue	105
    653  1.1      ad #define	ReinitAdapHighCommandQueue	107
    654  1.1      ad #define	ReinitAdapHighRespQueue		108
    655  1.1      ad #define	ReinitAdapNormRespQueue		109
    656  1.1      ad #define	InterfaceShutdown		110
    657  1.1      ad #define	DmaCommandFib			120
    658  1.1      ad #define	StartProfile			121
    659  1.1      ad #define	TermProfile			122
    660  1.1      ad #define	SpeedTest			123
    661  1.1      ad #define	TakeABreakPt			124
    662  1.1      ad #define	RequestPerfData			125
    663  1.1      ad #define	SetInterruptDefTimer		126
    664  1.1      ad #define	SetInterruptDefCount		127
    665  1.1      ad #define	GetInterruptDefStatus		128
    666  1.1      ad #define	LastCommCommand			129
    667  1.1      ad 
    668  1.1      ad /* filesystem commands */
    669  1.1      ad #define	NuFileSystem			300
    670  1.1      ad #define	UFS				301
    671  1.1      ad #define	HostFileSystem			302
    672  1.1      ad #define	LastFileSystemCommand		303
    673  1.1      ad 
    674  1.1      ad /* Container Commands */
    675  1.1      ad #define	ContainerCommand		500
    676  1.1      ad #define	ContainerCommand64		501
    677  1.1      ad 
    678  1.1      ad /* Cluster Commands */
    679  1.1      ad #define	ClusterCommand			550
    680  1.1      ad 
    681  1.1      ad /* Scsi Port commands (scsi passthrough) */
    682  1.1      ad #define	ScsiPortCommand			600
    683  1.1      ad 
    684  1.1      ad /* Misc house keeping and generic adapter initiated commands */
    685  1.1      ad #define	AifRequest			700
    686  1.1      ad #define	CheckRevision			701
    687  1.1      ad #define	FsaHostShutdown			702
    688  1.1      ad #define	RequestAdapterInfo		703
    689  1.1      ad #define	IsAdapterPaused			704
    690  1.1      ad #define	SendHostTime			705
    691  1.1      ad #define	LastMiscCommand			706
    692  1.1      ad 
    693  1.1      ad /*
    694  1.1      ad  * FIB types
    695  1.1      ad  */
    696  1.1      ad #define	AAC_FIBTYPE_TFIB		1
    697  1.1      ad #define	AAC_FIBTYPE_TQE			2
    698  1.1      ad #define	AAC_FIBTYPE_TCTPERF		3
    699  1.1      ad 
    700  1.1      ad /*
    701  1.1      ad  * FIB transfer state
    702  1.1      ad  */
    703  1.1      ad #define	AAC_FIBSTATE_HOSTOWNED		(1<<0)	/* owned by the host */
    704  1.1      ad #define	AAC_FIBSTATE_ADAPTEROWNED	(1<<1)	/* owned by the adapter */
    705  1.1      ad #define	AAC_FIBSTATE_INITIALISED	(1<<2)	/* initialised */
    706  1.1      ad #define	AAC_FIBSTATE_EMPTY		(1<<3)	/* empty */
    707  1.1      ad #define	AAC_FIBSTATE_FROMPOOL		(1<<4)	/* allocated from pool */
    708  1.1      ad #define	AAC_FIBSTATE_FROMHOST		(1<<5)	/* sent from the host */
    709  1.1      ad #define	AAC_FIBSTATE_FROMADAP		(1<<6)	/* sent from the adapter */
    710  1.1      ad #define	AAC_FIBSTATE_REXPECTED		(1<<7)	/* response is expected */
    711  1.1      ad #define	AAC_FIBSTATE_RNOTEXPECTED	(1<<8)	/* response is not expected */
    712  1.1      ad #define	AAC_FIBSTATE_DONEADAP		(1<<9)	/* processed by the adapter */
    713  1.1      ad #define	AAC_FIBSTATE_DONEHOST		(1<<10)	/* processed by the host */
    714  1.1      ad #define	AAC_FIBSTATE_HIGH		(1<<11)	/* high priority */
    715  1.1      ad #define	AAC_FIBSTATE_NORM		(1<<12)	/* normal priority */
    716  1.1      ad #define	AAC_FIBSTATE_ASYNC		(1<<13)
    717  1.1      ad #define	AAC_FIBSTATE_ASYNCIO		(1<<13)	/* to be removed */
    718  1.1      ad #define	AAC_FIBSTATE_PAGEFILEIO		(1<<14)	/* to be removed */
    719  1.1      ad #define	AAC_FIBSTATE_SHUTDOWN		(1<<15)
    720  1.1      ad #define	AAC_FIBSTATE_LAZYWRITE		(1<<16)	/* to be removed */
    721  1.1      ad #define	AAC_FIBSTATE_ADAPMICROFIB	(1<<17)
    722  1.1      ad #define	AAC_FIBSTATE_BIOSFIB		(1<<18)
    723  1.1      ad #define	AAC_FIBSTATE_FAST_RESPONSE	(1<<19)	/* fast response capable */
    724  1.1      ad #define	AAC_FIBSTATE_APIFIB		(1<<20)
    725  1.1      ad 
    726  1.1      ad /*
    727  1.1      ad  * FIB error values
    728  1.1      ad  */
    729  1.1      ad #define	AAC_ERROR_NORMAL			0x00
    730  1.1      ad #define	AAC_ERROR_PENDING			0x01
    731  1.1      ad #define	AAC_ERROR_FATAL				0x02
    732  1.1      ad #define	AAC_ERROR_INVALID_QUEUE			0x03
    733  1.1      ad #define	AAC_ERROR_NOENTRIES			0x04
    734  1.1      ad #define	AAC_ERROR_SENDFAILED			0x05
    735  1.1      ad #define	AAC_ERROR_INVALID_QUEUE_PRIORITY	0x06
    736  1.1      ad #define	AAC_ERROR_FIB_ALLOCATION_FAILED		0x07
    737  1.1      ad #define	AAC_ERROR_FIB_DEALLOCATION_FAILED	0x08
    738  1.1      ad 
    739  1.1      ad /*
    740  1.1      ad  *  Adapter Status Register
    741  1.1      ad  *
    742  1.1      ad  *  Phase Staus mailbox is 32bits:
    743  1.1      ad  *  <31:16> = Phase Status
    744  1.1      ad  *  <15:0>  = Phase
    745  1.1      ad  *
    746  1.1      ad  *  The adapter reports its present state through the phase.  Only
    747  1.1      ad  *  a single phase should be ever be set.  Each phase can have multiple
    748  1.1      ad  *  phase status bits to provide more detailed information about the
    749  1.1      ad  *  state of the adapter.
    750  1.1      ad  */
    751  1.1      ad #define	AAC_SELF_TEST_FAILED	0x00000004
    752  1.1      ad #define	AAC_UP_AND_RUNNING	0x00000080
    753  1.1      ad #define	AAC_KERNEL_PANIC	0x00000100
    754  1.1      ad 
    755  1.6  briggs /*
    756  1.6  briggs  * Data types relating to control and monitoring of the NVRAM/WriteCache
    757  1.6  briggs  * subsystem.
    758  1.6  briggs  */
    759  1.6  briggs 
    760  1.6  briggs #define AAC_NFILESYS	24	/* maximum number of filesystems */
    761  1.6  briggs 
    762  1.6  briggs /*
    763  1.6  briggs  * NVRAM/Write Cache subsystem states
    764  1.6  briggs  */
    765  1.6  briggs typedef enum {
    766  1.6  briggs 	NVSTATUS_DISABLED = 0,	/* present, clean, not being used */
    767  1.6  briggs 	NVSTATUS_ENABLED,	/* present, possibly dirty, ready for use */
    768  1.6  briggs 	NVSTATUS_ERROR,		/* present, dirty, contains dirty data */
    769  1.6  briggs 	NVSTATUS_BATTERY,	/* present, bad or low battery, may contain
    770  1.6  briggs 				 * dirty data */
    771  1.6  briggs 	NVSTATUS_UNKNOWN	/* for bad/missing device */
    772  1.6  briggs } AAC_NVSTATUS;
    773  1.6  briggs 
    774  1.6  briggs /*
    775  1.6  briggs  * NVRAM/Write Cache subsystem battery component states
    776  1.6  briggs  *
    777  1.6  briggs  */
    778  1.6  briggs typedef enum {
    779  1.6  briggs 	NVBATTSTATUS_NONE = 0,	/* battery has no power or is not present */
    780  1.6  briggs 	NVBATTSTATUS_LOW,	/* battery is low on power */
    781  1.6  briggs 	NVBATTSTATUS_OK,	/* battery is okay - normal operation possible
    782  1.6  briggs 				 * only in this state */
    783  1.6  briggs 	NVBATTSTATUS_RECONDITIONING	/* no battery present - reconditioning
    784  1.6  briggs 					 * in process */
    785  1.6  briggs } AAC_NVBATTSTATUS;
    786  1.6  briggs 
    787  1.6  briggs /*
    788  1.6  briggs  * Battery transition type
    789  1.6  briggs  */
    790  1.6  briggs typedef enum {
    791  1.6  briggs 	NVBATT_TRANSITION_NONE = 0,	/* battery now has no power or is not
    792  1.6  briggs 					 * present */
    793  1.6  briggs 	NVBATT_TRANSITION_LOW,		/* battery is now low on power */
    794  1.6  briggs 	NVBATT_TRANSITION_OK		/* battery is now okay - normal
    795  1.6  briggs 					 * operation possible only in this
    796  1.6  briggs 					 * state */
    797  1.6  briggs } AAC_NVBATT_TRANSITION;
    798  1.6  briggs 
    799  1.6  briggs /*
    800  1.6  briggs  * NVRAM Info structure returned for NVRAM_GetInfo call
    801  1.6  briggs  */
    802  1.6  briggs struct aac_nvramdevinfo {
    803  1.6  briggs 	u_int32_t	NV_Enabled;	/* write caching enabled */
    804  1.6  briggs 	u_int32_t	NV_Error;	/* device in error state */
    805  1.6  briggs 	u_int32_t	NV_NDirty;	/* count of dirty NVRAM buffers */
    806  1.6  briggs 	u_int32_t	NV_NActive;	/* count of NVRAM buffers being
    807  1.6  briggs 					 * written */
    808  1.6  briggs } __packed;
    809  1.6  briggs 
    810  1.6  briggs struct aac_nvraminfo {
    811  1.6  briggs 	AAC_NVSTATUS		NV_Status;	/* nvram subsystem status */
    812  1.6  briggs 	AAC_NVBATTSTATUS	NV_BattStatus;	/* battery status */
    813  1.6  briggs 	u_int32_t		NV_Size;	/* size of WriteCache NVRAM in
    814  1.6  briggs 						 * bytes */
    815  1.6  briggs 	u_int32_t		NV_BufSize;	/* size of NVRAM buffers in
    816  1.6  briggs 						 * bytes */
    817  1.6  briggs 	u_int32_t		NV_NBufs;	/* number of NVRAM buffers */
    818  1.6  briggs 	u_int32_t		NV_NDirty;	/* Num dirty NVRAM buffers */
    819  1.6  briggs 	u_int32_t		NV_NClean;	/* Num clean NVRAM buffers */
    820  1.6  briggs 	u_int32_t		NV_NActive;	/* Num NVRAM buffers being
    821  1.6  briggs 						 * written */
    822  1.6  briggs 	u_int32_t		NV_NBrokered;	/* Num brokered NVRAM buffers */
    823  1.6  briggs 	struct aac_nvramdevinfo	NV_DevInfo[AAC_NFILESYS];	/* per device
    824  1.6  briggs 								 * info */
    825  1.6  briggs 	u_int32_t		NV_BattNeedsReconditioning;	/* boolean */
    826  1.6  briggs 	u_int32_t		NV_TotalSize;	/* size of all non-volatile
    827  1.6  briggs 						 * memories in bytes */
    828  1.6  briggs } __packed;
    829  1.6  briggs 
    830  1.6  briggs /*
    831  1.6  briggs  * Data types relating to adapter-initiated FIBs
    832  1.6  briggs  *
    833  1.6  briggs  * Based on types and structures in <aifstruc.h>
    834  1.6  briggs  */
    835  1.6  briggs 
    836  1.6  briggs /*
    837  1.6  briggs  * Progress Reports
    838  1.6  briggs  */
    839  1.6  briggs typedef enum {
    840  1.6  briggs 	AifJobStsSuccess = 1,
    841  1.6  briggs 	AifJobStsFinished,
    842  1.6  briggs 	AifJobStsAborted,
    843  1.6  briggs 	AifJobStsFailed,
    844  1.6  briggs 	AifJobStsLastReportMarker = 100,	/* All prior mean last report */
    845  1.6  briggs 	AifJobStsSuspended,
    846  1.6  briggs 	AifJobStsRunning
    847  1.6  briggs } AAC_AifJobStatus;
    848  1.6  briggs 
    849  1.6  briggs typedef enum {
    850  1.6  briggs 	AifJobScsiMin = 1,		/* Minimum value for Scsi operation */
    851  1.6  briggs 	AifJobScsiZero,			/* SCSI device clear operation */
    852  1.6  briggs 	AifJobScsiVerify,		/* SCSI device Verify operation NO
    853  1.6  briggs 					 * REPAIR */
    854  1.6  briggs 	AifJobScsiExercise,		/* SCSI device Exercise operation */
    855  1.6  briggs 	AifJobScsiVerifyRepair,		/* SCSI device Verify operation WITH
    856  1.6  briggs 					 * repair */
    857  1.6  briggs 	AifJobScsiWritePattern,		/* write pattern */
    858  1.6  briggs 	AifJobScsiMax = 99,		/* Max Scsi value */
    859  1.6  briggs 	AifJobCtrMin,			/* Min Ctr op value */
    860  1.6  briggs 	AifJobCtrZero,			/* Container clear operation */
    861  1.6  briggs 	AifJobCtrCopy,			/* Container copy operation */
    862  1.6  briggs 	AifJobCtrCreateMirror,		/* Container Create Mirror operation */
    863  1.6  briggs 	AifJobCtrMergeMirror,		/* Container Merge Mirror operation */
    864  1.6  briggs 	AifJobCtrScrubMirror,		/* Container Scrub Mirror operation */
    865  1.6  briggs 	AifJobCtrRebuildRaid5,		/* Container Rebuild Raid5 operation */
    866  1.6  briggs 	AifJobCtrScrubRaid5,		/* Container Scrub Raid5 operation */
    867  1.6  briggs 	AifJobCtrMorph,			/* Container morph operation */
    868  1.6  briggs 	AifJobCtrPartCopy,		/* Container Partition copy operation */
    869  1.6  briggs 	AifJobCtrRebuildMirror,		/* Container Rebuild Mirror operation */
    870  1.6  briggs 	AifJobCtrCrazyCache,		/* crazy cache */
    871  1.6  briggs 	AifJobCtrCopyback,		/* Container Copyback operation */
    872  1.6  briggs 	AifJobCtrCompactRaid5D,		/* Container Compaction operation */
    873  1.6  briggs 	AifJobCtrExpandRaid5D,		/* Container Expansion operation */
    874  1.6  briggs 	AifJobCtrRebuildRaid6,		/* Container Rebuild Raid6 operation */
    875  1.6  briggs 	AifJobCtrScrubRaid6,		/* Container Scrub Raid6 operation */
    876  1.6  briggs 	AifJobCtrSSBackup,		/* Container snapshot backup task */
    877  1.6  briggs 	AifJobCtrMax = 199,		/* Max Ctr type operation */
    878  1.6  briggs 	AifJobFsMin,			/* Min Fs type operation */
    879  1.6  briggs 	AifJobFsCreate,			/* File System Create operation */
    880  1.6  briggs 	AifJobFsVerify,			/* File System Verify operation */
    881  1.6  briggs 	AifJobFsExtend,			/* File System Extend operation */
    882  1.6  briggs 	AifJobFsMax = 299,		/* Max Fs type operation */
    883  1.6  briggs 	AifJobApiFormatNTFS,		/* Format a drive to NTFS */
    884  1.6  briggs 	AifJobApiFormatFAT,		/* Format a drive to FAT */
    885  1.6  briggs 	AifJobApiUpdateSnapshot,	/* update the read/write half of a
    886  1.6  briggs 					 * snapshot */
    887  1.6  briggs 	AifJobApiFormatFAT32,		/* Format a drive to FAT32 */
    888  1.6  briggs 	AifJobApiMax = 399,		/* Max API type operation */
    889  1.6  briggs 	AifJobCtlContinuousCtrVerify,	/* Adapter operation */
    890  1.6  briggs 	AifJobCtlMax = 499		/* Max Adapter type operation */
    891  1.6  briggs } AAC_AifJobType;
    892  1.6  briggs 
    893  1.6  briggs struct aac_AifContainers {
    894  1.6  briggs 	u_int32_t	src;		/* from/master */
    895  1.6  briggs 	u_int32_t	dst;		/* to/slave */
    896  1.6  briggs } __packed;
    897  1.6  briggs 
    898  1.6  briggs union aac_AifJobClient {
    899  1.6  briggs 	struct aac_AifContainers	container;	/* For Container and
    900  1.6  briggs 							 * filesystem progress
    901  1.6  briggs 							 * ops; */
    902  1.6  briggs 	int32_t				scsi_dh;	/* For SCSI progress
    903  1.6  briggs 							 * ops */
    904  1.6  briggs };
    905  1.6  briggs 
    906  1.6  briggs struct aac_AifJobDesc {
    907  1.6  briggs 	u_int32_t		jobID;		/* DO NOT FILL IN! Will be
    908  1.6  briggs 						 * filled in by AIF */
    909  1.6  briggs 	AAC_AifJobType		type;		/* Operation that is being
    910  1.6  briggs 						 * performed */
    911  1.6  briggs 	union aac_AifJobClient	client;		/* Details */
    912  1.6  briggs } __packed;
    913  1.6  briggs 
    914  1.6  briggs struct aac_AifJobProgressReport {
    915  1.6  briggs 	struct aac_AifJobDesc	jd;
    916  1.6  briggs 	AAC_AifJobStatus	status;
    917  1.6  briggs 	u_int32_t		finalTick;
    918  1.6  briggs 	u_int32_t		currentTick;
    919  1.6  briggs 	u_int32_t		jobSpecificData1;
    920  1.6  briggs 	u_int32_t		jobSpecificData2;
    921  1.6  briggs } __packed;
    922  1.6  briggs 
    923  1.6  briggs /*
    924  1.6  briggs  * Event Notification
    925  1.6  briggs  */
    926  1.6  briggs typedef enum {
    927  1.6  briggs 	/* General application notifies start here */
    928  1.6  briggs 	AifEnGeneric = 1,		/* Generic notification */
    929  1.6  briggs 	AifEnTaskComplete,		/* Task has completed */
    930  1.6  briggs 	AifEnConfigChange,		/* Adapter config change occurred */
    931  1.6  briggs 	AifEnContainerChange,		/* Adapter specific container
    932  1.6  briggs 					 * configuration change */
    933  1.6  briggs 	AifEnDeviceFailure,		/* SCSI device failed */
    934  1.6  briggs 	AifEnMirrorFailover,		/* Mirror failover started */
    935  1.6  briggs 	AifEnContainerEvent,		/* Significant container event */
    936  1.6  briggs 	AifEnFileSystemChange,		/* File system changed */
    937  1.6  briggs 	AifEnConfigPause,		/* Container pause event */
    938  1.6  briggs 	AifEnConfigResume,		/* Container resume event */
    939  1.6  briggs 	AifEnFailoverChange,		/* Failover space assignment changed */
    940  1.6  briggs 	AifEnRAID5RebuildDone,		/* RAID5 rebuild finished */
    941  1.6  briggs 	AifEnEnclosureManagement,	/* Enclosure management event */
    942  1.6  briggs 	AifEnBatteryEvent,		/* Significant NV battery event */
    943  1.6  briggs 	AifEnAddContainer,		/* A new container was created. */
    944  1.6  briggs 	AifEnDeleteContainer,		/* A container was deleted. */
    945  1.6  briggs 	AifEnSMARTEvent, 	       	/* SMART Event */
    946  1.6  briggs 	AifEnBatteryNeedsRecond,	/* The battery needs reconditioning */
    947  1.6  briggs 	AifEnClusterEvent,		/* Some cluster event */
    948  1.6  briggs 	AifEnDiskSetEvent,		/* A disk set event occured. */
    949  1.6  briggs 	AifDriverNotifyStart=199,	/* Notifies for host driver go here */
    950  1.6  briggs 	/* Host driver notifications start here */
    951  1.6  briggs 	AifDenMorphComplete, 		/* A morph operation completed */
    952  1.6  briggs 	AifDenVolumeExtendComplete 	/* Volume expand operation completed */
    953  1.6  briggs } AAC_AifEventNotifyType;
    954  1.6  briggs 
    955  1.6  briggs struct aac_AifEnsGeneric {
    956  1.6  briggs 	char	text[132];		/* Generic text */
    957  1.6  briggs } __packed;
    958  1.6  briggs 
    959  1.6  briggs struct aac_AifEnsDeviceFailure {
    960  1.6  briggs 	u_int32_t	deviceHandle;	/* SCSI device handle */
    961  1.6  briggs } __packed;
    962  1.6  briggs 
    963  1.6  briggs struct aac_AifEnsMirrorFailover {
    964  1.6  briggs 	u_int32_t	container;	/* Container with failed element */
    965  1.6  briggs 	u_int32_t	failedSlice;	/* Old slice which failed */
    966  1.6  briggs 	u_int32_t	creatingSlice;	/* New slice used for auto-create */
    967  1.6  briggs } __packed;
    968  1.6  briggs 
    969  1.6  briggs struct aac_AifEnsContainerChange {
    970  1.6  briggs 	u_int32_t	container[2];	/* container that changed, -1 if no
    971  1.6  briggs 					 * container */
    972  1.6  briggs } __packed;
    973  1.6  briggs 
    974  1.6  briggs struct aac_AifEnsContainerEvent {
    975  1.6  briggs 	u_int32_t	container;	/* container number  */
    976  1.6  briggs 	u_int32_t	eventType;	/* event type */
    977  1.6  briggs } __packed;
    978  1.6  briggs 
    979  1.6  briggs struct aac_AifEnsEnclosureEvent {
    980  1.6  briggs 	u_int32_t	empID;		/* enclosure management proc number  */
    981  1.6  briggs 	u_int32_t	unitID;		/* unitId, fan id, power supply id,
    982  1.6  briggs 					 * slot id, tempsensor id.  */
    983  1.6  briggs 	u_int32_t	eventType;	/* event type */
    984  1.6  briggs } __packed;
    985  1.6  briggs 
    986  1.6  briggs struct aac_AifEnsBatteryEvent {
    987  1.6  briggs 	AAC_NVBATT_TRANSITION	transition_type;	/* eg from low to ok */
    988  1.6  briggs 	AAC_NVBATTSTATUS	current_state;		/* current batt state */
    989  1.6  briggs 	AAC_NVBATTSTATUS	prior_state;		/* prev batt state */
    990  1.6  briggs } __packed;
    991  1.6  briggs 
    992  1.6  briggs struct aac_AifEnsDiskSetEvent {
    993  1.6  briggs 	u_int32_t	eventType;
    994  1.6  briggs 	u_int64_t	DsNum;
    995  1.6  briggs 	u_int64_t	CreatorId;
    996  1.6  briggs } __packed;
    997  1.6  briggs 
    998  1.6  briggs typedef enum {
    999  1.6  briggs 	CLUSTER_NULL_EVENT = 0,
   1000  1.6  briggs 	CLUSTER_PARTNER_NAME_EVENT,	/* change in partner hostname or
   1001  1.6  briggs 					 * adaptername from NULL to non-NULL */
   1002  1.6  briggs 	/* (partner's agent may be up) */
   1003  1.6  briggs 	CLUSTER_PARTNER_NULL_NAME_EVENT	/* change in partner hostname or
   1004  1.6  briggs 					 * adaptername from non-null to NULL */
   1005  1.6  briggs 	/* (partner has rebooted) */
   1006  1.6  briggs } AAC_ClusterAifEvent;
   1007  1.6  briggs 
   1008  1.6  briggs struct aac_AifEnsClusterEvent {
   1009  1.6  briggs 	AAC_ClusterAifEvent	eventType;
   1010  1.6  briggs } __packed;
   1011  1.6  briggs 
   1012  1.6  briggs struct aac_AifEventNotify {
   1013  1.6  briggs 	AAC_AifEventNotifyType	type;
   1014  1.6  briggs 	union {
   1015  1.6  briggs 		struct aac_AifEnsGeneric		EG;
   1016  1.6  briggs 		struct aac_AifEnsDeviceFailure		EDF;
   1017  1.6  briggs 		struct aac_AifEnsMirrorFailover		EMF;
   1018  1.6  briggs 		struct aac_AifEnsContainerChange	ECC;
   1019  1.6  briggs 		struct aac_AifEnsContainerEvent		ECE;
   1020  1.6  briggs 		struct aac_AifEnsEnclosureEvent		EEE;
   1021  1.6  briggs 		struct aac_AifEnsBatteryEvent		EBE;
   1022  1.6  briggs 		struct aac_AifEnsDiskSetEvent		EDS;
   1023  1.6  briggs /*		struct aac_AifEnsSMARTEvent		ES;*/
   1024  1.6  briggs 		struct aac_AifEnsClusterEvent		ECLE;
   1025  1.6  briggs 	} data;
   1026  1.6  briggs } __packed;
   1027  1.6  briggs 
   1028  1.6  briggs /*
   1029  1.6  briggs  * Adapter Initiated FIB command structures. Start with the adapter
   1030  1.6  briggs  * initiated FIBs that really come from the adapter, and get responded
   1031  1.6  briggs  * to by the host.
   1032  1.6  briggs  */
   1033  1.6  briggs #define AAC_AIF_REPORT_MAX_SIZE 64
   1034  1.6  briggs 
   1035  1.6  briggs typedef enum {
   1036  1.6  briggs 	AifCmdEventNotify = 1,	/* Notify of event */
   1037  1.6  briggs 	AifCmdJobProgress,	/* Progress report */
   1038  1.6  briggs 	AifCmdAPIReport,	/* Report from other user of API */
   1039  1.6  briggs 	AifCmdDriverNotify,	/* Notify host driver of event */
   1040  1.6  briggs 	AifReqJobList = 100,	/* Gets back complete job list */
   1041  1.6  briggs 	AifReqJobsForCtr,	/* Gets back jobs for specific container */
   1042  1.6  briggs 	AifReqJobsForScsi,	/* Gets back jobs for specific SCSI device */
   1043  1.6  briggs 	AifReqJobReport,	/* Gets back a specific job report or list */
   1044  1.6  briggs 	AifReqTerminateJob,	/* Terminates job */
   1045  1.6  briggs 	AifReqSuspendJob,	/* Suspends a job */
   1046  1.6  briggs 	AifReqResumeJob,	/* Resumes a job */
   1047  1.6  briggs 	AifReqSendAPIReport,	/* API generic report requests */
   1048  1.6  briggs 	AifReqAPIJobStart,	/* Start a job from the API */
   1049  1.6  briggs 	AifReqAPIJobUpdate,	/* Update a job report from the API */
   1050  1.6  briggs 	AifReqAPIJobFinish	/* Finish a job from the API */
   1051  1.6  briggs } AAC_AifCommand;
   1052  1.6  briggs 
   1053  1.6  briggs struct aac_aif_command {
   1054  1.6  briggs 	AAC_AifCommand	command;	/* Tell host what type of
   1055  1.6  briggs 					 * notify this is */
   1056  1.6  briggs 	u_int32_t	seqNumber;	/* To allow ordering of
   1057  1.6  briggs 					 * reports (if necessary) */
   1058  1.6  briggs 	union {
   1059  1.6  briggs 		struct aac_AifEventNotify	EN;	/* Event notify */
   1060  1.6  briggs 		struct aac_AifJobProgressReport	PR[1];	/* Progress report */
   1061  1.6  briggs 		u_int8_t			AR[AAC_AIF_REPORT_MAX_SIZE];
   1062  1.6  briggs 		u_int8_t			data[AAC_FIB_DATASIZE - 8];
   1063  1.6  briggs 	} data;
   1064  1.6  briggs } __packed;
   1065  1.6  briggs 
   1066  1.1      ad #endif	/* !_PCI_AACREG_H_ */
   1067