1139749Simp/*-
2139749Simp *****************************************************************
365312Smsmith * Copyright (c) 1996-2000 Distributed Processing Technology Corporation
465312Smsmith * Copyright (c) 2000 Adaptec Corporation.
565312Smsmith * All rights reserved.
665312Smsmith *
787826Sobrien * $FreeBSD: releng/10.2/sys/dev/asr/i2odpt.h 139749 2005-01-06 01:43:34Z imp $
887826Sobrien *
965312Smsmith ****************************************************************/
1065312Smsmith
1165312Smsmith#if !defined(I2O_DPT_HDR)
1296615Sobrien#define	I2O_DPT_HDR
1365312Smsmith
1496615Sobrien#define	DPT_ORGANIZATION_ID 0x1B	/* For Private Messages */
1565312Smsmith
1665312Smsmith/*
1796554Sobrien *	PrivateMessageFrame.StdMessageFrame.Function = I2O_PRIVATE_MESSAGE
1896554Sobrien *	PrivateMessageFrame.XFunctionCode = I2O_SCSI_SCB_EXEC
1965312Smsmith */
2065312Smsmith
2165312Smsmithtypedef struct _PRIVATE_SCSI_SCB_EXECUTE_MESSAGE {
2265312Smsmith    I2O_PRIVATE_MESSAGE_FRAME PrivateMessageFrame;
2365312Smsmith#   if (defined(sparc) || defined(_DPT_BIG_ENDIAN))
2496554Sobrien	U32		      TID; /* Upper four bits currently are zero */
2565312Smsmith#   else
2696554Sobrien	BF		      TID:16; /* Upper four bits currently are zero */
2796554Sobrien	/* Command is interpreted by the host */
2896554Sobrien	BF		      Interpret:1;
2996554Sobrien	/* if TRUE, deal with Physical Firmware Array information */
3096554Sobrien	BF		      Physical:1;
3196554Sobrien	BF		      Reserved1:14;
3265312Smsmith#   endif
3396554Sobrien    U8			      CDBLength;
3496554Sobrien    U8			      Reserved;
3596554Sobrien    I2O_SCB_FLAGS	      SCBFlags;
3696554Sobrien    U8			      CDB[  I2O_SCSI_CDB_LENGTH	 ];
3796554Sobrien    U32			      ByteCount;
3896554Sobrien    I2O_SG_ELEMENT	      SGL;
3965312Smsmith} PRIVATE_SCSI_SCB_EXECUTE_MESSAGE, * PPRIVATE_SCSI_SCB_EXECUTE_MESSAGE;
4065312Smsmith
4165312Smsmith/*
4265312Smsmith * Flash access and programming messages
4396554Sobrien *	PrivateMessageFrame.StdMessageFrame.Function = I2O_PRIVATE_MESSAGE
4496554Sobrien *	PrivateMessageFrame.XFunctionCode = PRIVATE_FLAGS_REGION_*
4565312Smsmith *
4696554Sobrien *	SIZE	returns the total size of a region of flash
4796554Sobrien *	READ	copies a region (or portion thereof) into the buffer specified
4896554Sobrien *		by the SGL
4996554Sobrien *	WRITE	writes a region (or portion thereof) using the data specified
5096554Sobrien *		by the SGL
5165312Smsmith *
5265312Smsmith * Flash regions
5365312Smsmith *
5496554Sobrien *	0		operational-mode firmware
5596554Sobrien *	1		software (bios/utility)
5696554Sobrien *	2		oem nvram defaults
5796554Sobrien *	3		hba serial number
5896554Sobrien *	4		boot-mode firmware
5965312Smsmith *
6065312Smsmith * Any combination of RegionOffset and ByteCount can be specified providing
6165312Smsmith * they fit within the size of the specified region.
6265312Smsmith *
6365312Smsmith * Flash messages should be targeted to the Executive TID 0x000
6465312Smsmith */
6565312Smsmith
6696615Sobrien#define	PRIVATE_FLASH_REGION_SIZE	0x0100
6796615Sobrien#define	PRIVATE_FLASH_REGION_READ	0x0101
6896615Sobrien#define	PRIVATE_FLASH_REGION_WRITE	0x0102
6996615Sobrien#define	PRIVATE_FLASH_REGION_CRC	0x0103
7065312Smsmith
7165312Smsmithtypedef struct _PRIVATE_FLASH_REGION_MESSAGE {
7265312Smsmith    I2O_PRIVATE_MESSAGE_FRAME PrivateMessageFrame;
7396554Sobrien    U32			      FlashRegion;
7496554Sobrien    U32			      RegionOffset;
7596554Sobrien    U32			      ByteCount;
7696554Sobrien    I2O_SG_ELEMENT	      SGL;
7765312Smsmith} PRIVATE_FLASH_REGION_MESSAGE, * PPRIVATE_FLASH_REGION_MESSAGE;
7865312Smsmith
7965312Smsmith/* DPT Driver Printf message */
8065312Smsmith
8196615Sobrien#define	PRIVATE_DRIVER_PRINTF 0x0200
8265312Smsmith
8365312Smsmith/* FwPrintFlags */
8496615Sobrien#define	FW_FIRMWARE_FLAGS_NO_HEADER_B	0x00000001 /* Remove date header */
8565312Smsmith
8665312Smsmithtypedef struct _PRIVATE_DRIVER_PRINTF_MESSAGE {
8765312Smsmith
8896554Sobrien    I2O_PRIVATE_MESSAGE_FRAME	PrivateMessageFrame;
8965312Smsmith
9065312Smsmith    /* total bytes in PrintBuffer, including header */
9196554Sobrien    U32			PrintBufferByteCount;
9265312Smsmith    /* exact data to be copied into the serial PrintBuffer */
9396554Sobrien    U8			PrintBuffer[1];
9465312Smsmith
9565312Smsmith} PRIVATE_DRIVER_PRINTF_MESSAGE, * PPRIVATE_DRIVER_PRINTF_MESSAGE;
9665312Smsmith
9765312Smsmith/* DPT Enable Diagnostics message 0x0201 */
9865312Smsmith
9996615Sobrien#define	PRIVATE_DIAG_ENABLE 0x0201
10065312Smsmith
10165312Smsmithtypedef struct _PRIVATE_DIAG_ENABLE_MESSAGE {
10296554Sobrien	I2O_PRIVATE_MESSAGE_FRAME	PrivateMessageFrame;
10365312Smsmith} PRIVATE_DIAG_MESSAGE_FRAME, * PPRIVATE_DIAG_MESSAGE_FRAME;
10465312Smsmith
10565312Smsmith/* DPT Driver Get/Put message */
10665312Smsmith
10796615Sobrien#define	PRIVATE_DRIVER_GET	0x300
10896615Sobrien#define	PRIVATE_DRIVER_PUT	0x301
10965312Smsmith
11065312Smsmithtypedef struct _PRIVATE_DRIVER_GETPUT_MESSAGE
11165312Smsmith{
11296554Sobrien	I2O_PRIVATE_MESSAGE_FRAME	PrivateMessageFrame;
11396554Sobrien	U32				Offset;
11496554Sobrien	U32				ByteCount;
11596554Sobrien	I2O_SG_ELEMENT			SGL;
11665312Smsmith} PRIVATE_DRIVER_GETPUT_MESSAGE, * PPRIVATE_DRIVER_GETPUT_MESSAGE;
11765312Smsmith
11865312Smsmith/****************************************************************************/
11965312Smsmith
12065312Smsmith/* DPT Peripheral Device Parameter Groups */
12165312Smsmith
12265312Smsmith/****************************************************************************/
12365312Smsmith
12465312Smsmith/* DPT Configuration and Operating Structures and Defines */
12565312Smsmith
12696554Sobrien#define	    I2O_DPT_DEVICE_INFO_GROUP_NO	       0x8000
12765312Smsmith
12865312Smsmith/* - 8000h - DPT Device Information Parameters Group defines */
12965312Smsmith
13065312Smsmith/* Device Type */
13165312Smsmith
13296615Sobrien#define	I2O_DPT_DEVICE_TYPE_DIRECT	  I2O_SCSI_DEVICE_TYPE_DIRECT
13396615Sobrien#define	I2O_DPT_DEVICE_TYPE_SEQUENTIAL	  I2O_SCSI_DEVICE_TYPE_SEQUENTIAL
13496615Sobrien#define	I2O_DPT_DEVICE_TYPE_PRINTER	  I2O_SCSI_DEVICE_TYPE_PRINTER
13596615Sobrien#define	I2O_DPT_DEVICE_TYPE_PROCESSOR	  I2O_SCSI_DEVICE_TYPE_PROCESSOR
13696615Sobrien#define	I2O_DPT_DEVICE_TYPE_WORM	  I2O_SCSI_DEVICE_TYPE_WORM
13796615Sobrien#define	I2O_DPT_DEVICE_TYPE_CDROM	  I2O_SCSI_DEVICE_TYPE_CDROM
13896615Sobrien#define	I2O_DPT_DEVICE_TYPE_SCANNER	  I2O_SCSI_DEVICE_TYPE_SCANNER
13996615Sobrien#define	I2O_DPT_DEVICE_TYPE_OPTICAL	  I2O_SCSI_DEVICE_TYPE_OPTICAL
14096615Sobrien#define	I2O_DPT_DEVICE_TYPE_MEDIA_CHANGER I2O_SCSI_DEVICE_TYPE_MEDIA_CHANGER
14196615Sobrien#define	I2O_DPT_DEVICE_TYPE_COMM	  I2O_SCSI_DEVICE_TYPE_COMM
14296615Sobrien#define	I2O_DPT_DEVICE_GRAPHICS_1	  I2O_SCSI_DEVICE_GRAPHICS_1
14396615Sobrien#define	I2O_DPT_DEVICE_GRAPHICS_2	  I2O_SCSI_DEVICE_GRAPHICS_2
14496615Sobrien#define	I2O_DPT_DEVICE_TYPE_ARRAY_CONT	  I2O_SCSI_DEVICE_TYPE_ARRAY_CONT
14596615Sobrien#define	I2O_DPT_DEVICE_TYPE_UNKNOWN	  I2O_SCSI_DEVICE_TYPE_UNKNOWN
14665312Smsmith
14765312Smsmith/* Flags */
14865312Smsmith
14996615Sobrien#define	I2O_DPT_PERIPHERAL_TYPE_FLAG	  I2O_SCSI_PERIPHERAL_TYPE_FLAG
15096615Sobrien#define	I2O_DPT_PERIPHERAL_TYPE_PARALLEL  I2O_SCSI_PERIPHERAL_TYPE_PARALLEL
15196615Sobrien#define	I2O_DPT_PERIPHERAL_TYPE_SERIAL	  I2O_SCSI_PERIPHERAL_TYPE_SERIAL
15265312Smsmith
15396615Sobrien#define	I2O_DPT_RESERVED_FLAG		  I2O_SCSI_RESERVED_FLAG
15465312Smsmith
15596615Sobrien#define	I2O_DPT_DISCONNECT_FLAG		  I2O_SCSI_DISCONNECT_FLAG
15696615Sobrien#define	I2O_DPT_DISABLE_DISCONNECT	  I2O_SCSI_DISABLE_DISCONNECT
15796615Sobrien#define	I2O_DPT_ENABLE_DISCONNECT	  I2O_SCSI_ENABLE_DISCONNECT
15865312Smsmith
15996615Sobrien#define	I2O_DPT_MODE_MASK		  I2O_SCSI_MODE_MASK
16096615Sobrien#define	I2O_DPT_MODE_SET_DATA		  I2O_SCSI_MODE_SET_DATA
16196615Sobrien#define	I2O_DPT_MODE_SET_DEFAULT	  I2O_SCSI_MODE_SET_DEFAULT
16296615Sobrien#define	I2O_DPT_MODE_SET_SAFEST		  I2O_SCSI_MODE_SET_SAFEST
16365312Smsmith
16496615Sobrien#define	I2O_DPT_DATA_WIDTH_MASK		  I2O_SCSI_DATA_WIDTH_MASK
16596615Sobrien#define	I2O_DPT_DATA_WIDTH_8		  I2O_SCSI_DATA_WIDTH_8
16696615Sobrien#define	I2O_DPT_DATA_WIDTH_16		  I2O_SCSI_DATA_WIDTH_16
16796615Sobrien#define	I2O_DPT_DATA_WIDTH_32		  I2O_SCSI_DATA_WIDTH_32
16865312Smsmith
16996615Sobrien#define	I2O_DPT_SYNC_NEGOTIATION_FLAG	  I2O_SCSI_SYNC_NEGOTIATION_FLAG
17096615Sobrien#define	I2O_DPT_DISABLE_SYNC_NEGOTIATION  I2O_SCSI_DISABLE_SYNC_NEGOTIATION
17196615Sobrien#define	I2O_DPT_ENABLE_SYNC_NEGOTIATION	  I2O_SCSI_ENABLE_SYNC_NEGOTIATION
17265312Smsmith
17365312Smsmith/* DPT Device Group 8000h - Device Information Parameter Group */
17465312Smsmith
17565312Smsmithtypedef struct _I2O_DPT_DEVICE_INFO_SCALAR {
17696554Sobrien    U8		DeviceType;	/* Identical to I2O_SCSI_DEVICE_INFO SCALAR */
17796554Sobrien    U8		Flags;		/* Identical to I2O_SCSI_DEVICE_INFO SCALAR */
17896554Sobrien    U16		Bus;
17996554Sobrien    U32		Identifier;
18096554Sobrien    U8		LunInfo[8]; /* SCSI-2 8-bit scalar LUN goes into offset 1 */
18165312Smsmith
18265312Smsmith} I2O_DPT_DEVICE_INFO_SCALAR, *PI2O_DPT_DEVICE_INFO_SCALAR;
18365312Smsmith
18496615Sobrien#define	I2O_DPT_EXEC_IOP_BUFFERS_GROUP_NO    0x8000
18565312Smsmith
18665312Smsmith/* DPT Exec Iop Buffers Group 8000h */
18765312Smsmith
18865312Smsmithtypedef struct _I2O_DPT_EXEC_IOP_BUFFERS_SCALAR {
18996554Sobrien    U32	     SerialOutputOffset;    /* offset from base address to header   */
19096554Sobrien    U32	     SerialOutputSize;	    /* size of data buffer in bytes	    */
19196554Sobrien    U32	     SerialHeaderSize;	    /* size of data buffer header in bytes  */
19296554Sobrien    U32	     SerialFlagsSupported;  /* Mask of debug flags supported	    */
19365312Smsmith
19465312Smsmith} I2O_DPT_EXEC_IOP_BUFFERS_SCALAR, *PI2O_DPT_EXEC_IOP_BUFFERS_SCALAR;
19565312Smsmith
19665312Smsmith
19765312Smsmith#endif /* I2O_DPT_HDR */
198