18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci#ifndef _SCSI_I2O_H
38c2ecf20Sopenharmony_ci#define _SCSI_I2O_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci/* I2O kernel space accessible structures/APIs
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * (c) Copyright 1999, 2000 Red Hat Software
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci *************************************************************************
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci * This header file defined the I2O APIs/structures for use by
128c2ecf20Sopenharmony_ci * the I2O kernel modules.
138c2ecf20Sopenharmony_ci */
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#ifdef __KERNEL__       /* This file to be included by kernel only */
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#include <linux/i2o-dev.h>
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#include <linux/notifier.h>
208c2ecf20Sopenharmony_ci#include <linux/atomic.h>
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci/*
248c2ecf20Sopenharmony_ci *	Tunable parameters first
258c2ecf20Sopenharmony_ci */
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci/* How many different OSM's are we allowing */
288c2ecf20Sopenharmony_ci#define MAX_I2O_MODULES		64
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#define I2O_EVT_CAPABILITY_OTHER		0x01
318c2ecf20Sopenharmony_ci#define I2O_EVT_CAPABILITY_CHANGED		0x02
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#define I2O_EVT_SENSOR_STATE_CHANGED		0x01
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci//#ifdef __KERNEL__   /* ioctl stuff only thing exported to users */
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#define I2O_MAX_MANAGERS	4
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci/*
408c2ecf20Sopenharmony_ci *	I2O Interface Objects
418c2ecf20Sopenharmony_ci */
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci#include <linux/wait.h>
448c2ecf20Sopenharmony_citypedef wait_queue_head_t adpt_wait_queue_head_t;
458c2ecf20Sopenharmony_ci#define ADPT_DECLARE_WAIT_QUEUE_HEAD(wait) DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wait)
468c2ecf20Sopenharmony_citypedef wait_queue_entry_t adpt_wait_queue_entry_t;
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci/*
498c2ecf20Sopenharmony_ci * message structures
508c2ecf20Sopenharmony_ci */
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_cistruct i2o_message
538c2ecf20Sopenharmony_ci{
548c2ecf20Sopenharmony_ci	u8	version_offset;
558c2ecf20Sopenharmony_ci	u8	flags;
568c2ecf20Sopenharmony_ci	u16	size;
578c2ecf20Sopenharmony_ci	u32	target_tid:12;
588c2ecf20Sopenharmony_ci	u32	init_tid:12;
598c2ecf20Sopenharmony_ci	u32	function:8;
608c2ecf20Sopenharmony_ci	u32	initiator_context;
618c2ecf20Sopenharmony_ci	/* List follows */
628c2ecf20Sopenharmony_ci};
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_cistruct adpt_device;
658c2ecf20Sopenharmony_cistruct _adpt_hba;
668c2ecf20Sopenharmony_cistruct i2o_device
678c2ecf20Sopenharmony_ci{
688c2ecf20Sopenharmony_ci	struct i2o_device *next;	/* Chain */
698c2ecf20Sopenharmony_ci	struct i2o_device *prev;
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci	char dev_name[8];		/* linux /dev name if available */
728c2ecf20Sopenharmony_ci	i2o_lct_entry lct_data;/* Device LCT information */
738c2ecf20Sopenharmony_ci	u32 flags;
748c2ecf20Sopenharmony_ci	struct proc_dir_entry* proc_entry;	/* /proc dir */
758c2ecf20Sopenharmony_ci	struct adpt_device *owner;
768c2ecf20Sopenharmony_ci	struct _adpt_hba *controller;	/* Controlling IOP */
778c2ecf20Sopenharmony_ci};
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci/*
808c2ecf20Sopenharmony_ci *	Each I2O controller has one of these objects
818c2ecf20Sopenharmony_ci */
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_cistruct i2o_controller
848c2ecf20Sopenharmony_ci{
858c2ecf20Sopenharmony_ci	char name[16];
868c2ecf20Sopenharmony_ci	int unit;
878c2ecf20Sopenharmony_ci	int type;
888c2ecf20Sopenharmony_ci	int enabled;
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci	struct notifier_block *event_notifer;	/* Events */
918c2ecf20Sopenharmony_ci	atomic_t users;
928c2ecf20Sopenharmony_ci	struct i2o_device *devices;		/* I2O device chain */
938c2ecf20Sopenharmony_ci	struct i2o_controller *next;		/* Controller chain */
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci};
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci/*
988c2ecf20Sopenharmony_ci * I2O System table entry
998c2ecf20Sopenharmony_ci */
1008c2ecf20Sopenharmony_cistruct i2o_sys_tbl_entry
1018c2ecf20Sopenharmony_ci{
1028c2ecf20Sopenharmony_ci	u16	org_id;
1038c2ecf20Sopenharmony_ci	u16	reserved1;
1048c2ecf20Sopenharmony_ci	u32	iop_id:12;
1058c2ecf20Sopenharmony_ci	u32	reserved2:20;
1068c2ecf20Sopenharmony_ci	u16	seg_num:12;
1078c2ecf20Sopenharmony_ci	u16	i2o_version:4;
1088c2ecf20Sopenharmony_ci	u8	iop_state;
1098c2ecf20Sopenharmony_ci	u8	msg_type;
1108c2ecf20Sopenharmony_ci	u16	frame_size;
1118c2ecf20Sopenharmony_ci	u16	reserved3;
1128c2ecf20Sopenharmony_ci	u32	last_changed;
1138c2ecf20Sopenharmony_ci	u32	iop_capabilities;
1148c2ecf20Sopenharmony_ci	u32	inbound_low;
1158c2ecf20Sopenharmony_ci	u32	inbound_high;
1168c2ecf20Sopenharmony_ci};
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_cistruct i2o_sys_tbl
1198c2ecf20Sopenharmony_ci{
1208c2ecf20Sopenharmony_ci	u8	num_entries;
1218c2ecf20Sopenharmony_ci	u8	version;
1228c2ecf20Sopenharmony_ci	u16	reserved1;
1238c2ecf20Sopenharmony_ci	u32	change_ind;
1248c2ecf20Sopenharmony_ci	u32	reserved2;
1258c2ecf20Sopenharmony_ci	u32	reserved3;
1268c2ecf20Sopenharmony_ci	struct i2o_sys_tbl_entry iops[0];
1278c2ecf20Sopenharmony_ci};
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ci/*
1308c2ecf20Sopenharmony_ci *	I2O classes / subclasses
1318c2ecf20Sopenharmony_ci */
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ci/*  Class ID and Code Assignments
1348c2ecf20Sopenharmony_ci *  (LCT.ClassID.Version field)
1358c2ecf20Sopenharmony_ci */
1368c2ecf20Sopenharmony_ci#define    I2O_CLASS_VERSION_10                        0x00
1378c2ecf20Sopenharmony_ci#define    I2O_CLASS_VERSION_11                        0x01
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci/*  Class code names
1408c2ecf20Sopenharmony_ci *  (from v1.5 Table 6-1 Class Code Assignments.)
1418c2ecf20Sopenharmony_ci */
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ci#define    I2O_CLASS_EXECUTIVE                         0x000
1448c2ecf20Sopenharmony_ci#define    I2O_CLASS_DDM                               0x001
1458c2ecf20Sopenharmony_ci#define    I2O_CLASS_RANDOM_BLOCK_STORAGE              0x010
1468c2ecf20Sopenharmony_ci#define    I2O_CLASS_SEQUENTIAL_STORAGE                0x011
1478c2ecf20Sopenharmony_ci#define    I2O_CLASS_LAN                               0x020
1488c2ecf20Sopenharmony_ci#define    I2O_CLASS_WAN                               0x030
1498c2ecf20Sopenharmony_ci#define    I2O_CLASS_FIBRE_CHANNEL_PORT                0x040
1508c2ecf20Sopenharmony_ci#define    I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL          0x041
1518c2ecf20Sopenharmony_ci#define    I2O_CLASS_SCSI_PERIPHERAL                   0x051
1528c2ecf20Sopenharmony_ci#define    I2O_CLASS_ATE_PORT                          0x060
1538c2ecf20Sopenharmony_ci#define    I2O_CLASS_ATE_PERIPHERAL                    0x061
1548c2ecf20Sopenharmony_ci#define    I2O_CLASS_FLOPPY_CONTROLLER                 0x070
1558c2ecf20Sopenharmony_ci#define    I2O_CLASS_FLOPPY_DEVICE                     0x071
1568c2ecf20Sopenharmony_ci#define    I2O_CLASS_BUS_ADAPTER_PORT                  0x080
1578c2ecf20Sopenharmony_ci#define    I2O_CLASS_PEER_TRANSPORT_AGENT              0x090
1588c2ecf20Sopenharmony_ci#define    I2O_CLASS_PEER_TRANSPORT                    0x091
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_ci/*  Rest of 0x092 - 0x09f reserved for peer-to-peer classes
1618c2ecf20Sopenharmony_ci */
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci#define    I2O_CLASS_MATCH_ANYCLASS                    0xffffffff
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci/*  Subclasses
1668c2ecf20Sopenharmony_ci */
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_ci#define    I2O_SUBCLASS_i960                           0x001
1698c2ecf20Sopenharmony_ci#define    I2O_SUBCLASS_HDM                            0x020
1708c2ecf20Sopenharmony_ci#define    I2O_SUBCLASS_ISM                            0x021
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci/* Operation functions */
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_ci#define I2O_PARAMS_FIELD_GET	0x0001
1758c2ecf20Sopenharmony_ci#define I2O_PARAMS_LIST_GET	0x0002
1768c2ecf20Sopenharmony_ci#define I2O_PARAMS_MORE_GET	0x0003
1778c2ecf20Sopenharmony_ci#define I2O_PARAMS_SIZE_GET	0x0004
1788c2ecf20Sopenharmony_ci#define I2O_PARAMS_TABLE_GET	0x0005
1798c2ecf20Sopenharmony_ci#define I2O_PARAMS_FIELD_SET	0x0006
1808c2ecf20Sopenharmony_ci#define I2O_PARAMS_LIST_SET	0x0007
1818c2ecf20Sopenharmony_ci#define I2O_PARAMS_ROW_ADD	0x0008
1828c2ecf20Sopenharmony_ci#define I2O_PARAMS_ROW_DELETE	0x0009
1838c2ecf20Sopenharmony_ci#define I2O_PARAMS_TABLE_CLEAR	0x000A
1848c2ecf20Sopenharmony_ci
1858c2ecf20Sopenharmony_ci/*
1868c2ecf20Sopenharmony_ci *	I2O serial number conventions / formats
1878c2ecf20Sopenharmony_ci *	(circa v1.5)
1888c2ecf20Sopenharmony_ci */
1898c2ecf20Sopenharmony_ci
1908c2ecf20Sopenharmony_ci#define    I2O_SNFORMAT_UNKNOWN                        0
1918c2ecf20Sopenharmony_ci#define    I2O_SNFORMAT_BINARY                         1
1928c2ecf20Sopenharmony_ci#define    I2O_SNFORMAT_ASCII                          2
1938c2ecf20Sopenharmony_ci#define    I2O_SNFORMAT_UNICODE                        3
1948c2ecf20Sopenharmony_ci#define    I2O_SNFORMAT_LAN48_MAC                      4
1958c2ecf20Sopenharmony_ci#define    I2O_SNFORMAT_WAN                            5
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_ci/* Plus new in v2.0 (Yellowstone pdf doc)
1988c2ecf20Sopenharmony_ci */
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_ci#define    I2O_SNFORMAT_LAN64_MAC                      6
2018c2ecf20Sopenharmony_ci#define    I2O_SNFORMAT_DDM                            7
2028c2ecf20Sopenharmony_ci#define    I2O_SNFORMAT_IEEE_REG64                     8
2038c2ecf20Sopenharmony_ci#define    I2O_SNFORMAT_IEEE_REG128                    9
2048c2ecf20Sopenharmony_ci#define    I2O_SNFORMAT_UNKNOWN2                       0xff
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_ci/* Transaction Reply Lists (TRL) Control Word structure */
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_ci#define TRL_SINGLE_FIXED_LENGTH		0x00
2098c2ecf20Sopenharmony_ci#define TRL_SINGLE_VARIABLE_LENGTH	0x40
2108c2ecf20Sopenharmony_ci#define TRL_MULTIPLE_FIXED_LENGTH	0x80
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_ci/*
2138c2ecf20Sopenharmony_ci *	Messaging API values
2148c2ecf20Sopenharmony_ci */
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_ci#define	I2O_CMD_ADAPTER_ASSIGN		0xB3
2178c2ecf20Sopenharmony_ci#define	I2O_CMD_ADAPTER_READ		0xB2
2188c2ecf20Sopenharmony_ci#define	I2O_CMD_ADAPTER_RELEASE		0xB5
2198c2ecf20Sopenharmony_ci#define	I2O_CMD_BIOS_INFO_SET		0xA5
2208c2ecf20Sopenharmony_ci#define	I2O_CMD_BOOT_DEVICE_SET		0xA7
2218c2ecf20Sopenharmony_ci#define	I2O_CMD_CONFIG_VALIDATE		0xBB
2228c2ecf20Sopenharmony_ci#define	I2O_CMD_CONN_SETUP		0xCA
2238c2ecf20Sopenharmony_ci#define	I2O_CMD_DDM_DESTROY		0xB1
2248c2ecf20Sopenharmony_ci#define	I2O_CMD_DDM_ENABLE		0xD5
2258c2ecf20Sopenharmony_ci#define	I2O_CMD_DDM_QUIESCE		0xC7
2268c2ecf20Sopenharmony_ci#define	I2O_CMD_DDM_RESET		0xD9
2278c2ecf20Sopenharmony_ci#define	I2O_CMD_DDM_SUSPEND		0xAF
2288c2ecf20Sopenharmony_ci#define	I2O_CMD_DEVICE_ASSIGN		0xB7
2298c2ecf20Sopenharmony_ci#define	I2O_CMD_DEVICE_RELEASE		0xB9
2308c2ecf20Sopenharmony_ci#define	I2O_CMD_HRT_GET			0xA8
2318c2ecf20Sopenharmony_ci#define	I2O_CMD_ADAPTER_CLEAR		0xBE
2328c2ecf20Sopenharmony_ci#define	I2O_CMD_ADAPTER_CONNECT		0xC9
2338c2ecf20Sopenharmony_ci#define	I2O_CMD_ADAPTER_RESET		0xBD
2348c2ecf20Sopenharmony_ci#define	I2O_CMD_LCT_NOTIFY		0xA2
2358c2ecf20Sopenharmony_ci#define	I2O_CMD_OUTBOUND_INIT		0xA1
2368c2ecf20Sopenharmony_ci#define	I2O_CMD_PATH_ENABLE		0xD3
2378c2ecf20Sopenharmony_ci#define	I2O_CMD_PATH_QUIESCE		0xC5
2388c2ecf20Sopenharmony_ci#define	I2O_CMD_PATH_RESET		0xD7
2398c2ecf20Sopenharmony_ci#define	I2O_CMD_STATIC_MF_CREATE	0xDD
2408c2ecf20Sopenharmony_ci#define	I2O_CMD_STATIC_MF_RELEASE	0xDF
2418c2ecf20Sopenharmony_ci#define	I2O_CMD_STATUS_GET		0xA0
2428c2ecf20Sopenharmony_ci#define	I2O_CMD_SW_DOWNLOAD		0xA9
2438c2ecf20Sopenharmony_ci#define	I2O_CMD_SW_UPLOAD		0xAB
2448c2ecf20Sopenharmony_ci#define	I2O_CMD_SW_REMOVE		0xAD
2458c2ecf20Sopenharmony_ci#define	I2O_CMD_SYS_ENABLE		0xD1
2468c2ecf20Sopenharmony_ci#define	I2O_CMD_SYS_MODIFY		0xC1
2478c2ecf20Sopenharmony_ci#define	I2O_CMD_SYS_QUIESCE		0xC3
2488c2ecf20Sopenharmony_ci#define	I2O_CMD_SYS_TAB_SET		0xA3
2498c2ecf20Sopenharmony_ci
2508c2ecf20Sopenharmony_ci#define I2O_CMD_UTIL_NOP		0x00
2518c2ecf20Sopenharmony_ci#define I2O_CMD_UTIL_ABORT		0x01
2528c2ecf20Sopenharmony_ci#define I2O_CMD_UTIL_CLAIM		0x09
2538c2ecf20Sopenharmony_ci#define I2O_CMD_UTIL_RELEASE		0x0B
2548c2ecf20Sopenharmony_ci#define I2O_CMD_UTIL_PARAMS_GET		0x06
2558c2ecf20Sopenharmony_ci#define I2O_CMD_UTIL_PARAMS_SET		0x05
2568c2ecf20Sopenharmony_ci#define I2O_CMD_UTIL_EVT_REGISTER	0x13
2578c2ecf20Sopenharmony_ci#define I2O_CMD_UTIL_EVT_ACK		0x14
2588c2ecf20Sopenharmony_ci#define I2O_CMD_UTIL_CONFIG_DIALOG	0x10
2598c2ecf20Sopenharmony_ci#define I2O_CMD_UTIL_DEVICE_RESERVE	0x0D
2608c2ecf20Sopenharmony_ci#define I2O_CMD_UTIL_DEVICE_RELEASE	0x0F
2618c2ecf20Sopenharmony_ci#define I2O_CMD_UTIL_LOCK		0x17
2628c2ecf20Sopenharmony_ci#define I2O_CMD_UTIL_LOCK_RELEASE	0x19
2638c2ecf20Sopenharmony_ci#define I2O_CMD_UTIL_REPLY_FAULT_NOTIFY	0x15
2648c2ecf20Sopenharmony_ci
2658c2ecf20Sopenharmony_ci#define I2O_CMD_SCSI_EXEC		0x81
2668c2ecf20Sopenharmony_ci#define I2O_CMD_SCSI_ABORT		0x83
2678c2ecf20Sopenharmony_ci#define I2O_CMD_SCSI_BUSRESET		0x27
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_ci#define I2O_CMD_BLOCK_READ		0x30
2708c2ecf20Sopenharmony_ci#define I2O_CMD_BLOCK_WRITE		0x31
2718c2ecf20Sopenharmony_ci#define I2O_CMD_BLOCK_CFLUSH		0x37
2728c2ecf20Sopenharmony_ci#define I2O_CMD_BLOCK_MLOCK		0x49
2738c2ecf20Sopenharmony_ci#define I2O_CMD_BLOCK_MUNLOCK		0x4B
2748c2ecf20Sopenharmony_ci#define I2O_CMD_BLOCK_MMOUNT		0x41
2758c2ecf20Sopenharmony_ci#define I2O_CMD_BLOCK_MEJECT		0x43
2768c2ecf20Sopenharmony_ci
2778c2ecf20Sopenharmony_ci#define I2O_PRIVATE_MSG			0xFF
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_ci/*
2808c2ecf20Sopenharmony_ci *	Init Outbound Q status
2818c2ecf20Sopenharmony_ci */
2828c2ecf20Sopenharmony_ci
2838c2ecf20Sopenharmony_ci#define I2O_CMD_OUTBOUND_INIT_IN_PROGRESS	0x01
2848c2ecf20Sopenharmony_ci#define I2O_CMD_OUTBOUND_INIT_REJECTED		0x02
2858c2ecf20Sopenharmony_ci#define I2O_CMD_OUTBOUND_INIT_FAILED		0x03
2868c2ecf20Sopenharmony_ci#define I2O_CMD_OUTBOUND_INIT_COMPLETE		0x04
2878c2ecf20Sopenharmony_ci
2888c2ecf20Sopenharmony_ci/*
2898c2ecf20Sopenharmony_ci *	I2O Get Status State values
2908c2ecf20Sopenharmony_ci */
2918c2ecf20Sopenharmony_ci
2928c2ecf20Sopenharmony_ci#define	ADAPTER_STATE_INITIALIZING		0x01
2938c2ecf20Sopenharmony_ci#define	ADAPTER_STATE_RESET			0x02
2948c2ecf20Sopenharmony_ci#define	ADAPTER_STATE_HOLD			0x04
2958c2ecf20Sopenharmony_ci#define ADAPTER_STATE_READY			0x05
2968c2ecf20Sopenharmony_ci#define	ADAPTER_STATE_OPERATIONAL		0x08
2978c2ecf20Sopenharmony_ci#define	ADAPTER_STATE_FAILED			0x10
2988c2ecf20Sopenharmony_ci#define	ADAPTER_STATE_FAULTED			0x11
2998c2ecf20Sopenharmony_ci
3008c2ecf20Sopenharmony_ci/* I2O API function return values */
3018c2ecf20Sopenharmony_ci
3028c2ecf20Sopenharmony_ci#define I2O_RTN_NO_ERROR			0
3038c2ecf20Sopenharmony_ci#define I2O_RTN_NOT_INIT			1
3048c2ecf20Sopenharmony_ci#define I2O_RTN_FREE_Q_EMPTY			2
3058c2ecf20Sopenharmony_ci#define I2O_RTN_TCB_ERROR			3
3068c2ecf20Sopenharmony_ci#define I2O_RTN_TRANSACTION_ERROR		4
3078c2ecf20Sopenharmony_ci#define I2O_RTN_ADAPTER_ALREADY_INIT		5
3088c2ecf20Sopenharmony_ci#define I2O_RTN_MALLOC_ERROR			6
3098c2ecf20Sopenharmony_ci#define I2O_RTN_ADPTR_NOT_REGISTERED		7
3108c2ecf20Sopenharmony_ci#define I2O_RTN_MSG_REPLY_TIMEOUT		8
3118c2ecf20Sopenharmony_ci#define I2O_RTN_NO_STATUS			9
3128c2ecf20Sopenharmony_ci#define I2O_RTN_NO_FIRM_VER			10
3138c2ecf20Sopenharmony_ci#define	I2O_RTN_NO_LINK_SPEED			11
3148c2ecf20Sopenharmony_ci
3158c2ecf20Sopenharmony_ci/* Reply message status defines for all messages */
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_ci#define I2O_REPLY_STATUS_SUCCESS			0x00
3188c2ecf20Sopenharmony_ci#define I2O_REPLY_STATUS_ABORT_DIRTY			0x01
3198c2ecf20Sopenharmony_ci#define I2O_REPLY_STATUS_ABORT_NO_DATA_TRANSFER		0x02
3208c2ecf20Sopenharmony_ci#define	I2O_REPLY_STATUS_ABORT_PARTIAL_TRANSFER		0x03
3218c2ecf20Sopenharmony_ci#define	I2O_REPLY_STATUS_ERROR_DIRTY			0x04
3228c2ecf20Sopenharmony_ci#define	I2O_REPLY_STATUS_ERROR_NO_DATA_TRANSFER		0x05
3238c2ecf20Sopenharmony_ci#define	I2O_REPLY_STATUS_ERROR_PARTIAL_TRANSFER		0x06
3248c2ecf20Sopenharmony_ci#define	I2O_REPLY_STATUS_PROCESS_ABORT_DIRTY		0x08
3258c2ecf20Sopenharmony_ci#define	I2O_REPLY_STATUS_PROCESS_ABORT_NO_DATA_TRANSFER	0x09
3268c2ecf20Sopenharmony_ci#define	I2O_REPLY_STATUS_PROCESS_ABORT_PARTIAL_TRANSFER	0x0A
3278c2ecf20Sopenharmony_ci#define	I2O_REPLY_STATUS_TRANSACTION_ERROR		0x0B
3288c2ecf20Sopenharmony_ci#define	I2O_REPLY_STATUS_PROGRESS_REPORT		0x80
3298c2ecf20Sopenharmony_ci
3308c2ecf20Sopenharmony_ci/* Status codes and Error Information for Parameter functions */
3318c2ecf20Sopenharmony_ci
3328c2ecf20Sopenharmony_ci#define I2O_PARAMS_STATUS_SUCCESS		0x00
3338c2ecf20Sopenharmony_ci#define I2O_PARAMS_STATUS_BAD_KEY_ABORT		0x01
3348c2ecf20Sopenharmony_ci#define I2O_PARAMS_STATUS_BAD_KEY_CONTINUE	0x02
3358c2ecf20Sopenharmony_ci#define I2O_PARAMS_STATUS_BUFFER_FULL		0x03
3368c2ecf20Sopenharmony_ci#define I2O_PARAMS_STATUS_BUFFER_TOO_SMALL	0x04
3378c2ecf20Sopenharmony_ci#define I2O_PARAMS_STATUS_FIELD_UNREADABLE	0x05
3388c2ecf20Sopenharmony_ci#define I2O_PARAMS_STATUS_FIELD_UNWRITEABLE	0x06
3398c2ecf20Sopenharmony_ci#define I2O_PARAMS_STATUS_INSUFFICIENT_FIELDS	0x07
3408c2ecf20Sopenharmony_ci#define I2O_PARAMS_STATUS_INVALID_GROUP_ID	0x08
3418c2ecf20Sopenharmony_ci#define I2O_PARAMS_STATUS_INVALID_OPERATION	0x09
3428c2ecf20Sopenharmony_ci#define I2O_PARAMS_STATUS_NO_KEY_FIELD		0x0A
3438c2ecf20Sopenharmony_ci#define I2O_PARAMS_STATUS_NO_SUCH_FIELD		0x0B
3448c2ecf20Sopenharmony_ci#define I2O_PARAMS_STATUS_NON_DYNAMIC_GROUP	0x0C
3458c2ecf20Sopenharmony_ci#define I2O_PARAMS_STATUS_OPERATION_ERROR	0x0D
3468c2ecf20Sopenharmony_ci#define I2O_PARAMS_STATUS_SCALAR_ERROR		0x0E
3478c2ecf20Sopenharmony_ci#define I2O_PARAMS_STATUS_TABLE_ERROR		0x0F
3488c2ecf20Sopenharmony_ci#define I2O_PARAMS_STATUS_WRONG_GROUP_TYPE	0x10
3498c2ecf20Sopenharmony_ci
3508c2ecf20Sopenharmony_ci/* DetailedStatusCode defines for Executive, DDM, Util and Transaction error
3518c2ecf20Sopenharmony_ci * messages: Table 3-2 Detailed Status Codes.*/
3528c2ecf20Sopenharmony_ci
3538c2ecf20Sopenharmony_ci#define I2O_DSC_SUCCESS                        0x0000
3548c2ecf20Sopenharmony_ci#define I2O_DSC_BAD_KEY                        0x0002
3558c2ecf20Sopenharmony_ci#define I2O_DSC_TCL_ERROR                      0x0003
3568c2ecf20Sopenharmony_ci#define I2O_DSC_REPLY_BUFFER_FULL              0x0004
3578c2ecf20Sopenharmony_ci#define I2O_DSC_NO_SUCH_PAGE                   0x0005
3588c2ecf20Sopenharmony_ci#define I2O_DSC_INSUFFICIENT_RESOURCE_SOFT     0x0006
3598c2ecf20Sopenharmony_ci#define I2O_DSC_INSUFFICIENT_RESOURCE_HARD     0x0007
3608c2ecf20Sopenharmony_ci#define I2O_DSC_CHAIN_BUFFER_TOO_LARGE         0x0009
3618c2ecf20Sopenharmony_ci#define I2O_DSC_UNSUPPORTED_FUNCTION           0x000A
3628c2ecf20Sopenharmony_ci#define I2O_DSC_DEVICE_LOCKED                  0x000B
3638c2ecf20Sopenharmony_ci#define I2O_DSC_DEVICE_RESET                   0x000C
3648c2ecf20Sopenharmony_ci#define I2O_DSC_INAPPROPRIATE_FUNCTION         0x000D
3658c2ecf20Sopenharmony_ci#define I2O_DSC_INVALID_INITIATOR_ADDRESS      0x000E
3668c2ecf20Sopenharmony_ci#define I2O_DSC_INVALID_MESSAGE_FLAGS          0x000F
3678c2ecf20Sopenharmony_ci#define I2O_DSC_INVALID_OFFSET                 0x0010
3688c2ecf20Sopenharmony_ci#define I2O_DSC_INVALID_PARAMETER              0x0011
3698c2ecf20Sopenharmony_ci#define I2O_DSC_INVALID_REQUEST                0x0012
3708c2ecf20Sopenharmony_ci#define I2O_DSC_INVALID_TARGET_ADDRESS         0x0013
3718c2ecf20Sopenharmony_ci#define I2O_DSC_MESSAGE_TOO_LARGE              0x0014
3728c2ecf20Sopenharmony_ci#define I2O_DSC_MESSAGE_TOO_SMALL              0x0015
3738c2ecf20Sopenharmony_ci#define I2O_DSC_MISSING_PARAMETER              0x0016
3748c2ecf20Sopenharmony_ci#define I2O_DSC_TIMEOUT                        0x0017
3758c2ecf20Sopenharmony_ci#define I2O_DSC_UNKNOWN_ERROR                  0x0018
3768c2ecf20Sopenharmony_ci#define I2O_DSC_UNKNOWN_FUNCTION               0x0019
3778c2ecf20Sopenharmony_ci#define I2O_DSC_UNSUPPORTED_VERSION            0x001A
3788c2ecf20Sopenharmony_ci#define I2O_DSC_DEVICE_BUSY                    0x001B
3798c2ecf20Sopenharmony_ci#define I2O_DSC_DEVICE_NOT_AVAILABLE           0x001C
3808c2ecf20Sopenharmony_ci
3818c2ecf20Sopenharmony_ci/* Device Claim Types */
3828c2ecf20Sopenharmony_ci#define	I2O_CLAIM_PRIMARY					0x01000000
3838c2ecf20Sopenharmony_ci#define	I2O_CLAIM_MANAGEMENT					0x02000000
3848c2ecf20Sopenharmony_ci#define	I2O_CLAIM_AUTHORIZED					0x03000000
3858c2ecf20Sopenharmony_ci#define	I2O_CLAIM_SECONDARY					0x04000000
3868c2ecf20Sopenharmony_ci
3878c2ecf20Sopenharmony_ci/* Message header defines for VersionOffset */
3888c2ecf20Sopenharmony_ci#define I2OVER15	0x0001
3898c2ecf20Sopenharmony_ci#define I2OVER20	0x0002
3908c2ecf20Sopenharmony_ci/* Default is 1.5, FIXME: Need support for both 1.5 and 2.0 */
3918c2ecf20Sopenharmony_ci#define I2OVERSION	I2OVER15
3928c2ecf20Sopenharmony_ci#define SGL_OFFSET_0    I2OVERSION
3938c2ecf20Sopenharmony_ci#define SGL_OFFSET_4    (0x0040 | I2OVERSION)
3948c2ecf20Sopenharmony_ci#define SGL_OFFSET_5    (0x0050 | I2OVERSION)
3958c2ecf20Sopenharmony_ci#define SGL_OFFSET_6    (0x0060 | I2OVERSION)
3968c2ecf20Sopenharmony_ci#define SGL_OFFSET_7    (0x0070 | I2OVERSION)
3978c2ecf20Sopenharmony_ci#define SGL_OFFSET_8    (0x0080 | I2OVERSION)
3988c2ecf20Sopenharmony_ci#define SGL_OFFSET_9    (0x0090 | I2OVERSION)
3998c2ecf20Sopenharmony_ci#define SGL_OFFSET_10   (0x00A0 | I2OVERSION)
4008c2ecf20Sopenharmony_ci#define SGL_OFFSET_12   (0x00C0 | I2OVERSION)
4018c2ecf20Sopenharmony_ci
4028c2ecf20Sopenharmony_ci#define TRL_OFFSET_5    (0x0050 | I2OVERSION)
4038c2ecf20Sopenharmony_ci#define TRL_OFFSET_6    (0x0060 | I2OVERSION)
4048c2ecf20Sopenharmony_ci
4058c2ecf20Sopenharmony_ci /* msg header defines for MsgFlags */
4068c2ecf20Sopenharmony_ci#define MSG_STATIC	0x0100
4078c2ecf20Sopenharmony_ci#define MSG_64BIT_CNTXT	0x0200
4088c2ecf20Sopenharmony_ci#define MSG_MULTI_TRANS	0x1000
4098c2ecf20Sopenharmony_ci#define MSG_FAIL	0x2000
4108c2ecf20Sopenharmony_ci#define MSG_LAST	0x4000
4118c2ecf20Sopenharmony_ci#define MSG_REPLY	0x8000
4128c2ecf20Sopenharmony_ci
4138c2ecf20Sopenharmony_ci /* minimum size msg */
4148c2ecf20Sopenharmony_ci#define THREE_WORD_MSG_SIZE	0x00030000
4158c2ecf20Sopenharmony_ci#define FOUR_WORD_MSG_SIZE	0x00040000
4168c2ecf20Sopenharmony_ci#define FIVE_WORD_MSG_SIZE	0x00050000
4178c2ecf20Sopenharmony_ci#define SIX_WORD_MSG_SIZE	0x00060000
4188c2ecf20Sopenharmony_ci#define SEVEN_WORD_MSG_SIZE	0x00070000
4198c2ecf20Sopenharmony_ci#define EIGHT_WORD_MSG_SIZE	0x00080000
4208c2ecf20Sopenharmony_ci#define NINE_WORD_MSG_SIZE	0x00090000
4218c2ecf20Sopenharmony_ci#define TEN_WORD_MSG_SIZE	0x000A0000
4228c2ecf20Sopenharmony_ci#define I2O_MESSAGE_SIZE(x)	((x)<<16)
4238c2ecf20Sopenharmony_ci
4248c2ecf20Sopenharmony_ci
4258c2ecf20Sopenharmony_ci/* Special TID Assignments */
4268c2ecf20Sopenharmony_ci
4278c2ecf20Sopenharmony_ci#define ADAPTER_TID		0
4288c2ecf20Sopenharmony_ci#define HOST_TID		1
4298c2ecf20Sopenharmony_ci
4308c2ecf20Sopenharmony_ci#define MSG_FRAME_SIZE		128
4318c2ecf20Sopenharmony_ci#define NMBR_MSG_FRAMES		128
4328c2ecf20Sopenharmony_ci
4338c2ecf20Sopenharmony_ci#define MSG_POOL_SIZE		16384
4348c2ecf20Sopenharmony_ci
4358c2ecf20Sopenharmony_ci#define I2O_POST_WAIT_OK	0
4368c2ecf20Sopenharmony_ci#define I2O_POST_WAIT_TIMEOUT	-ETIMEDOUT
4378c2ecf20Sopenharmony_ci
4388c2ecf20Sopenharmony_ci
4398c2ecf20Sopenharmony_ci#endif /* __KERNEL__ */
4408c2ecf20Sopenharmony_ci
4418c2ecf20Sopenharmony_ci#endif /* _SCSI_I2O_H */
442