1139749Simp/*- 2139749Simp **************************************************************** 365312Smsmith * Copyright (c) 1996-2000 Distributed Processing Technology Corporation 465312Smsmith * Copyright (c) 2000 Adaptec Corproation. 565312Smsmith * All rights reserved. 696554Sobrien * 796554Sobrien * Copyright 1999 I2O Special Interest Group (I2O SIG). All rights reserved. 865312Smsmith * All rights reserved 996554Sobrien * 1065312Smsmith * TERMS AND CONDITIONS OF USE 1196554Sobrien * 1265312Smsmith * Redistribution and use in source form, with or without modification, are 1365312Smsmith * permitted provided that redistributions of source code must retain the 1465312Smsmith * above copyright notice, this list of conditions and the following disclaimer. 1596554Sobrien * 1665312Smsmith * This software is provided `as is' by Distributed Processing Technology and 1765312Smsmith * any express or implied warranties, including, but not limited to, the 1865312Smsmith * implied warranties of merchantability and fitness for a particular purpose, 1965312Smsmith * are disclaimed. In no event shall Distributed Processing Technology be 2065312Smsmith * liable for any direct, indirect, incidental, special, exemplary or 2165312Smsmith * consequential damages (including, but not limited to, procurement of 2265312Smsmith * substitute goods or services; loss of use, data, or profits; or business 2365312Smsmith * interruptions) however caused and on any theory of liability, whether in 2465312Smsmith * contract, strict liability, or tort (including negligence or otherwise) 2565312Smsmith * arising in any way out of the use of this driver software, even if advised 2665312Smsmith * of the possibility of such damage. 2796554Sobrien * 2865312Smsmith * This header file, and any modifications of this header file, are provided 2965312Smsmith * contingent upon your agreement and adherence to the here-listed terms and 3096554Sobrien * conditions. By accepting and/or using this header file, you agree to abide 3165312Smsmith * by these terms and conditions and that these terms and conditions will be 3265312Smsmith * construed and governed in accordance with the laws of the State of California, 3365312Smsmith * without reference to conflict-of-law provisions. If you do not agree 3465312Smsmith * to these terms and conditions, please delete this file, and any copies, 3565312Smsmith * permanently, without making any use thereof. 3696554Sobrien * 3765312Smsmith * THIS HEADER FILE IS PROVIDED FREE OF CHARGE ON AN AS-IS BASIS WITHOUT 3865312Smsmith * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 3965312Smsmith * TO IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 4065312Smsmith * PURPOSE. I2O SIG DOES NOT WARRANT THAT THIS HEADER FILE WILL MEET THE 4165312Smsmith * USER'S REQUIREMENTS OR THAT ITS OPERATION WILL BE UNINTERRUPTED OR 4265312Smsmith * ERROR-FREE. 4396554Sobrien * 4465312Smsmith * I2O SIG DISCLAIMS ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF 4565312Smsmith * ANY PROPRIETARY RIGHTS, RELATING TO THE IMPLEMENTATION OF THE I2O 4665312Smsmith * SPECIFICATIONS. I2O SIG DOES NOT WARRANT OR REPRESENT THAT SUCH 4765312Smsmith * IMPLEMENTATIONS WILL NOT INFRINGE SUCH RIGHTS. 4896554Sobrien * 4965312Smsmith * THE USER OF THIS HEADER FILE SHALL HAVE NO RECOURSE TO I2O SIG FOR ANY 5065312Smsmith * ACTUAL OR CONSEQUENTIAL DAMAGES INCLUDING, BUT NOT LIMITED TO, LOST DATA 5165312Smsmith * OR LOST PROFITS ARISING OUT OF THE USE OR INABILITY TO USE THIS PROGRAM. 5296554Sobrien * 5365312Smsmith * I2O SIG grants the user of this header file a license to copy, distribute, 5465312Smsmith * and modify it, for any purpose, under the following terms. Any copying, 5565312Smsmith * distribution, or modification of this header file must not delete or alter 5665312Smsmith * the copyright notice of I2O SIG or any of these Terms and Conditions. 5796554Sobrien * 5865312Smsmith * Any distribution of this header file must not include a charge for the 5965312Smsmith * header file (unless such charges are strictly for the physical acts of 6065312Smsmith * copying or transferring copies). However, distribution of a product in 6165312Smsmith * which this header file is embedded may include a charge so long as any 6265312Smsmith * such charge does not include any charge for the header file itself. 6396554Sobrien * 6465312Smsmith * Any modification of this header file constitutes a derivative work based 6596554Sobrien * on this header file. Any distribution of such derivative work: (1) must 6665312Smsmith * include prominent notices that the header file has been changed from the 6796554Sobrien * original, together with the dates of any changes; (2) automatically includes 6865312Smsmith * this same license to the original header file from I2O SIG, without any 6965312Smsmith * restriction thereon from the distributing user; and (3) must include a 7065312Smsmith * grant of license of the modified file under the same terms and conditions 7165312Smsmith * as these Terms and Conditions. 7296554Sobrien * 7365312Smsmith * The I2O SIG Web site can be found at: http://www.i2osig.org 7496554Sobrien * 7565312Smsmith * The I2O SIG encourages you to deposit derivative works based on this 7696554Sobrien * header file at the I2O SIG Web site. Furthermore, to become a Registered 7765312Smsmith * Developer of the I2O SIG, sign up at the Web site or call 415.750.8352 7865312Smsmith * (United States). 7987826Sobrien * 8087826Sobrien * $FreeBSD$ 8187826Sobrien * 8265312Smsmith ****************************************************************/ 8365312Smsmith 8465312Smsmith#if !defined(I2O_ADPTR_HDR) 8596615Sobrien#define I2O_ADPTR_HDR 8665312Smsmith 8765312Smsmith#if ((defined(KERNEL) || defined(_KERNEL)) && defined(__FreeBSD__)) 8865312Smsmith# if (KERN_VERSION < 3) 8965312Smsmith# include "i386/pci/i2omsg.h" 9065312Smsmith# else 9165312Smsmith# include "dev/asr/i2omsg.h" 9265312Smsmith# endif 9365312Smsmith#else 9496554Sobrien# include "i2omsg.h" /* Include the Base Message file */ 9565312Smsmith#endif 9665312Smsmith 9765312Smsmith 9896615Sobrien#define I2OADPTR_REV 1_5_1 /* Header file revision string */ 9965312Smsmith 10065312Smsmith 10165312Smsmith/***************************************************************************** 10265312Smsmith * 10365312Smsmith * i2oadptr.h -- I2O Adapter Class Message defintion file 10465312Smsmith * 10565312Smsmith * 10665312Smsmith * Revision History: 10765312Smsmith * 10865312Smsmith * 1.5.d 03/06/97 - First definition for spec. draft version 1.5d. 10965312Smsmith * 1.5.1 05/02/97 - Corrections from review cycle: 11096554Sobrien * 1) Remove "SCSI" from function definition comment. 11196554Sobrien * 2) Add revision string. 11296554Sobrien * 3) Convert tabs to spaces. 11396554Sobrien * 4) New disclaimer. 11465312Smsmith * 11565312Smsmith * 11696554Sobrien * 11765312Smsmith *****************************************************************************/ 11865312Smsmith 11965312Smsmith/* 12065312Smsmith NOTES: 12196554Sobrien 12265312Smsmith Gets, reads, receives, etc. are all even numbered functions. 12365312Smsmith Sets, writes, sends, etc. are all odd numbered functions. 12465312Smsmith Functions that both send and receive data can be either but an attempt is made 12565312Smsmith to use the function number that indicates the greater transfer amount. 12665312Smsmith Functions that do not send or receive data use odd function numbers. 12765312Smsmith 12865312Smsmith Some functions are synonyms like read, receive and send, write. 12996554Sobrien 13065312Smsmith All common functions will have a code of less than 0x80. 13165312Smsmith Unique functions to a class will start at 0x80. 13265312Smsmith Executive Functions start at 0xA0. 13396554Sobrien 13465312Smsmith Utility Message function codes range from 0 - 0x1f 13565312Smsmith Base Message function codes range from 0x20 - 0xfe 13665312Smsmith Private Message function code is 0xff. 13765312Smsmith*/ 13865312Smsmith 13965312Smsmith 14065312SmsmithPRAGMA_ALIGN_PUSH 14165312Smsmith 14265312SmsmithPRAGMA_PACK_PUSH 14365312Smsmith 14465312Smsmith/* 14565312Smsmith Bus Adapter Class specific functions 14665312Smsmith*/ 14765312Smsmith 14896615Sobrien#define I2O_HBA_ADAPTER_RESET 0x85 14996615Sobrien#define I2O_HBA_BUS_QUIESCE 0x8b 15096615Sobrien#define I2O_HBA_BUS_RESET 0x87 15196615Sobrien#define I2O_HBA_BUS_SCAN 0x89 15265312Smsmith 15365312Smsmith 15465312Smsmith/* 15565312Smsmith Detailed Status Codes for HBA operations 15665312Smsmith 15765312Smsmith Note: 15896554Sobrien The 16-bit Detailed Status Code field for HBA operations is divided 15996554Sobrien into two separate 8-bit fields. The lower 8 bits are reserved. The 16096554Sobrien upper 8 bits are used to report Adapter Status information. The 16196554Sobrien definitions for these two fields, however, will be consistent with 16296554Sobrien the standard reply message frame structure declaration, which treats 16365312Smsmith this as a single 16-bit field. In addition, the values used will be 16496554Sobrien consistent with the Adapter Status codes defined for the SCSI 16596554Sobrien Peripheral class. Theses codes are based on CAM-1. In other words, 16665312Smsmith these definitions are a subset of the SCSI peripheral class codes. 16765312Smsmith Where applicable, "SCSI" has been removed from the definition. 16896554Sobrien*/ 16965312Smsmith 17065312Smsmith 17196615Sobrien#define I2O_HBA_DSC_MASK 0xFF00 17265312Smsmith 17396615Sobrien#define I2O_HBA_DSC_SUCCESS 0x0000 17496615Sobrien#define I2O_HBA_DSC_ADAPTER_BUSY 0x0500 17596615Sobrien#define I2O_HBA_DSC_COMMAND_TIMEOUT 0x0B00 17696615Sobrien#define I2O_HBA_DSC_COMPLETE_WITH_ERROR 0x0400 17796615Sobrien#define I2O_HBA_DSC_FUNCTION_UNAVAILABLE 0x3A00 17896615Sobrien#define I2O_HBA_DSC_NO_ADAPTER 0x1100 17996615Sobrien#define I2O_HBA_DSC_PARITY_ERROR_FAILURE 0x0F00 18096615Sobrien#define I2O_HBA_DSC_PATH_INVALID 0x0700 18196615Sobrien#define I2O_HBA_DSC_PROVIDE_FAILURE 0x1600 18296615Sobrien#define I2O_HBA_DSC_QUEUE_FROZEN 0x4000 18396615Sobrien#define I2O_HBA_DSC_REQUEST_ABORTED 0x0200 18496615Sobrien#define I2O_HBA_DSC_REQUEST_INVALID 0x0600 18596615Sobrien#define I2O_HBA_DSC_REQUEST_LENGTH_ERROR 0x1500 18696615Sobrien#define I2O_HBA_DSC_REQUEST_TERMINATED 0x1800 18796615Sobrien#define I2O_HBA_DSC_RESOURCE_UNAVAILABLE 0x3400 18896615Sobrien#define I2O_HBA_DSC_BUS_BUSY 0x3F00 18996615Sobrien#define I2O_HBA_DSC_BUS_RESET 0x0E00 19096615Sobrien#define I2O_HBA_DSC_ID_INVALID 0x3900 19196615Sobrien#define I2O_HBA_DSC_SEQUENCE_FAILURE 0x1400 19296615Sobrien#define I2O_HBA_DSC_UNABLE_TO_ABORT 0x0300 19396615Sobrien#define I2O_HBA_DSC_UNABLE_TO_TERMINATE 0x0900 19496615Sobrien#define I2O_HBA_DSC_UNACKNOWLEDGED_EVENT 0x3500 19596615Sobrien#define I2O_HBA_DSC_UNEXPECTED_BUS_FREE 0x1300 19665312Smsmith 19765312Smsmith 19865312Smsmith 19965312Smsmith/****************************************************************************/ 20065312Smsmith 20165312Smsmith/* Bus Adapter Parameter Groups */ 20265312Smsmith 20365312Smsmith/****************************************************************************/ 20465312Smsmith 20565312Smsmith 20696554Sobrien#define I2O_HBA_CONTROLLER_INFO_GROUP_NO 0x0000 20796554Sobrien#define I2O_HBA_HISTORICAL_STATS_GROUP_NO 0x0100 20896554Sobrien#define I2O_HBA_SCSI_CONTROLLER_INFO_GROUP_NO 0x0200 20996554Sobrien#define I2O_HBA_SCSI_BUS_PORT_INFO_GROUP_NO 0x0201 21096554Sobrien#define I2O_HBA_FCA_CONTROLLER_INFO_GROUP_NO 0x0300 21196554Sobrien#define I2O_HBA_FCA_PORT_INFO_GROUP_NO 0x0301 21265312Smsmith 21365312Smsmith 21465312Smsmith/* - 0000h - HBA Controller Information Parameter Group */ 21565312Smsmith 21665312Smsmith/* Bus Type */ 21765312Smsmith 21896554Sobrien#define I2O_HBA_BUS_TYPE_GENERIC 0x00 21996554Sobrien#define I2O_HBA_BUS_TYPE_SCSI 0x01 22096554Sobrien#define I2O_HBA_BUS_TYPE_FCA 0x10 22165312Smsmith 22265312Smsmith 22365312Smsmithtypedef struct _I2O_HBA_CONTROLLER_INFO_SCALAR { 22496554Sobrien U8 BusType; 22596554Sobrien U8 BusState; 22696554Sobrien U16 Reserved2; 22796554Sobrien U8 BusName[12]; 22865312Smsmith} I2O_HBA_CONTROLLER_INFO_SCALAR, *PI2O_HBA_CONTROLLER_INFO_SCALAR; 22965312Smsmith 23065312Smsmith 23165312Smsmith/* - 0100h - HBA Historical Stats Parameter Group */ 23265312Smsmith 23365312Smsmithtypedef struct _I2O_HBA_HIST_STATS_SCALAR { 23496554Sobrien U32 TimeLastPoweredUp; 23596554Sobrien U32 TimeLastReset; 23665312Smsmith} I2O_HBA_HIST_STATS_SCALAR, *PI2O_HBA_HIST_STATS_SCALAR; 23765312Smsmith 23865312Smsmith 23965312Smsmith/* - 0200h - HBA SCSI Controller Information Parameter Group */ 24065312Smsmith 24165312Smsmith/* SCSI Type */ 24265312Smsmith 24396615Sobrien#define I2O_SCSI_TYPE_UNKNOWN 0x00 24496615Sobrien#define I2O_SCSI_TYPE_SCSI_1 0x01 24596615Sobrien#define I2O_SCSI_TYPE_SCSI_2 0x02 24696615Sobrien#define I2O_SCSI_TYPE_SCSI_3 0x03 24765312Smsmith 24865312Smsmith/* Protection Management */ 24965312Smsmith 25096554Sobrien#define I2O_SCSI_PORT_PROT_OTHER 0x00 25196554Sobrien#define I2O_SCSI_PORT_PROT_UNKNOWN 0x01 25296551Sobrien#define I2O_SCSI_PORT_PROT_UNPROTECTED 0x02 25396551Sobrien#define I2O_SCSI_PORT_PROT_PROTECTED 0x03 25496554Sobrien#define I2O_SCSI_PORT_PROT_SCC 0x04 25565312Smsmith 25665312Smsmith/* Settings */ 25765312Smsmith 25896554Sobrien#define I2O_SCSI_PORT_PARITY_FLAG 0x01 25996551Sobrien#define I2O_SCSI_PORT_PARITY_DISABLED 0x00 26096551Sobrien#define I2O_SCSI_PORT_PARITY_ENABLED 0x01 26165312Smsmith 26296551Sobrien#define I2O_SCSI_PORT_SCAN_ORDER_FLAG 0x02 26396551Sobrien#define I2O_SCSI_PORT_SCAN_LOW_TO_HIGH 0x00 26496551Sobrien#define I2O_SCSI_PORT_SCAN_HIGH_TO_LOW 0x02 26565312Smsmith 26696554Sobrien#define I2O_SCSI_PORT_IID_FLAG 0x04 26796554Sobrien#define I2O_SCSI_PORT_IID_DEFAULT 0x00 26896554Sobrien#define I2O_SCSI_PORT_IID_SPECIFIED 0x04 26965312Smsmith 27096554Sobrien#define I2O_SCSI_PORT_SCAM_FLAG 0x08 27196554Sobrien#define I2O_SCSI_PORT_SCAM_DISABLED 0x00 27296554Sobrien#define I2O_SCSI_PORT_SCAM_ENABLED 0x08 27365312Smsmith 27496554Sobrien#define I2O_SCSI_PORT_TYPE_FLAG 0x80 27596554Sobrien#define I2O_SCSI_PORT_TYPE_PARALLEL 0x00 27696554Sobrien#define I2O_SCSI_PORT_TYPE_SERIAL 0x80 27765312Smsmith 27865312Smsmithtypedef struct _I2O_HBA_SCSI_CONTROLLER_INFO_SCALAR { 27996554Sobrien U8 SCSIType; 28096554Sobrien U8 ProtectionManagement; 28196554Sobrien U8 Settings; 28296554Sobrien U8 Reserved1; 28396554Sobrien U32 InitiatorID; 28496554Sobrien U64 ScanLun0Only; 28596554Sobrien U16 DisableDevice; 28696554Sobrien U8 MaxOffset; 28796554Sobrien U8 MaxDataWidth; 28896554Sobrien U64 MaxSyncRate; 28965312Smsmith} I2O_HBA_SCSI_CONTROLLER_INFO_SCALAR, *PI2O_HBA_SCSI_CONTROLLER_INFO_SCALAR; 29065312Smsmith 29165312Smsmith 29265312Smsmith/* - 0201h - HBA SCSI Bus Port Information Parameter Group */ 29365312Smsmith 29465312Smsmith/* NOTE: Refer to the SCSI Peripheral Class Bus Port Information Parameter 29596554Sobrien Group field definitions for HBA SCSI Bus Port field definitions. 29665312Smsmith */ 29765312Smsmith 29865312Smsmithtypedef struct _I2O_HBA_SCSI_BUS_PORT_INFO_SCALAR { 29996554Sobrien U8 PhysicalInterface; 30096554Sobrien U8 ElectricalInterface; 30196554Sobrien U8 Isochronous; 30296554Sobrien U8 ConnectorType; 30396554Sobrien U8 ConnectorGender; 30496554Sobrien U8 Reserved1; 30596554Sobrien U16 Reserved2; 30696554Sobrien U32 MaxNumberDevices; 30796554Sobrien U32 DeviceIdBegin; 30896554Sobrien U32 DeviceIdEnd; 30996554Sobrien U8 LunBegin[8]; 31096554Sobrien U8 LunEnd[8]; 31165312Smsmith} I2O_HBA_SCSI_BUS_PORT_INFO_SCALAR, *PI2O_HBA_SCSI_BUS_PORT_INFO_SCALAR; 31265312Smsmith 31365312Smsmith 31465312Smsmith/* - 0300h - HBA FCA Controller Information Parameters Group defines */ 31565312Smsmith 31665312Smsmith/* SCSI Type */ 31765312Smsmith 31896615Sobrien#define I2O_FCA_TYPE_UNKNOWN 0x00 31996615Sobrien#define I2O_FCA_TYPE_FCAL 0x01 32065312Smsmith 32165312Smsmithtypedef struct _I2O_HBA_FCA_CONTROLLER_INFO_SCALAR { 32296554Sobrien U8 FcaType; 32396554Sobrien U8 Reserved1; 32496554Sobrien U16 Reserved2; 32565312Smsmith} I2O_HBA_FCA_CONTROLLER_INFO_SCALAR, *PI2O_HBA_FCA_CONTROLLER_INFO_SCALAR; 32665312Smsmith 32765312Smsmith 32865312Smsmith/* - 0301h - HBA FCA Port Information Parameters Group defines */ 32965312Smsmith 33065312Smsmithtypedef struct _I2O_HBA_FCA_PORT_INFO_SCALAR { 33196554Sobrien U32 Reserved4; 33265312Smsmith} I2O_HBA_FCA_PORT_INFO_SCALAR, *PI2O_HBA_FCA_PORT_INFO_SCALAR; 33365312Smsmith 33465312Smsmith 33565312Smsmith/****************************************************************************/ 33665312Smsmith 33765312Smsmith/* I2O Bus Adapter Class Specific Message Definitions */ 33865312Smsmith 33965312Smsmith/****************************************************************************/ 34065312Smsmith 34165312Smsmith 34265312Smsmith/****************************************************************************/ 34365312Smsmith 34465312Smsmith/* I2O Bus Adapter Class Reply Message Frame */ 34565312Smsmith 34665312Smsmithtypedef struct _I2O_HBA_REPLY_MESSAGE_FRAME { 34765312Smsmith I2O_SINGLE_REPLY_MESSAGE_FRAME StdReplyFrame; 34865312Smsmith} I2O_HBA_REPLY_MESSAGE_FRAME, *PI2O_HBA_REPLY_MESSAGE_FRAME; 34965312Smsmith 35065312Smsmith 35165312Smsmith/****************************************************************************/ 35265312Smsmith 35365312Smsmith/* I2O HBA Adapter Reset Message Frame */ 35465312Smsmith 35565312Smsmithtypedef struct _I2O_HBA_ADAPTER_RESET_MESSAGE { 35696554Sobrien I2O_MESSAGE_FRAME StdMessageFrame; 35765312Smsmith I2O_TRANSACTION_CONTEXT TransactionContext; 35865312Smsmith} I2O_HBA_ADAPTER_RESET_MESSAGE, *PI2O_HBA_ADAPTER_RESET_MESSAGE; 35965312Smsmith 36065312Smsmith 36165312Smsmith/****************************************************************************/ 36265312Smsmith 36365312Smsmith/* I2O HBA Bus Quiesce Message Frame */ 36465312Smsmith 36596554Sobrientypedef U32 I2O_HBQ_FLAGS; 36665312Smsmith 36796615Sobrien#define I2O_HBQ_FLAG_NORMAL 0x0000 36896615Sobrien#define I2O_HBQ_FLAG_QUIESCE 0x0001 36965312Smsmith 37065312Smsmithtypedef struct _I2O_HBA_BUS_QUIESCE_MESSAGE { 37196554Sobrien I2O_MESSAGE_FRAME StdMessageFrame; 37265312Smsmith I2O_TRANSACTION_CONTEXT TransactionContext; 37396554Sobrien I2O_HBQ_FLAGS Flags; 37465312Smsmith} I2O_HBA_BUS_QUIESCE_MESSAGE, *PI2O_HBA_BUS_QUIESCE_MESSAGE; 37565312Smsmith 37665312Smsmith 37765312Smsmith/****************************************************************************/ 37865312Smsmith 37965312Smsmith/* I2O HBA Bus Reset Message Frame */ 38065312Smsmith 38165312Smsmithtypedef struct _I2O_HBA_BUS_RESET_MESSAGE { 38296554Sobrien I2O_MESSAGE_FRAME StdMessageFrame; 38365312Smsmith I2O_TRANSACTION_CONTEXT TransactionContext; 38465312Smsmith} I2O_HBA_BUS_RESET_MESSAGE, *PI2O_HBA_BUS_RESET_MESSAGE; 38565312Smsmith 38665312Smsmith 38765312Smsmith/****************************************************************************/ 38865312Smsmith 38965312Smsmith/* I2O HBA Bus Scan Message Frame */ 39065312Smsmith 39165312Smsmith/* NOTE: SCSI-2 8-bit scalar LUN goes into offset 1 of Lun arrays */ 39265312Smsmith 39365312Smsmithtypedef struct _I2O_HBA_BUS_SCAN_MESSAGE { 39496554Sobrien I2O_MESSAGE_FRAME StdMessageFrame; 39565312Smsmith I2O_TRANSACTION_CONTEXT TransactionContext; 39665312Smsmith} I2O_HBA_BUS_SCAN_MESSAGE, *PI2O_HBA_BUS_SCAN_MESSAGE; 39765312Smsmith 39865312Smsmith 39965312SmsmithPRAGMA_PACK_POP 40065312Smsmith 40165312SmsmithPRAGMA_ALIGN_POP 40265312Smsmith 40396554Sobrien#endif /* I2O_ADPTR_HDR */ 40465312Smsmith 40565312Smsmith 406