23 #define MAX_TO_IOP_MESSAGES (255)
24 #define MAX_FROM_IOP_MESSAGES (255)
36 static int adpt_slave_configure(
struct scsi_device *);
38 static const char *adpt_info(
struct Scsi_Host *pSHost);
50 #define DPT_DRIVER_NAME "Adaptec I2O RAID"
55 #include <linux/wait.h>
59 #define DPT_I2O_VERSION "2.4 Build 5go"
61 #define DPT_REVISION '4'
62 #define DPT_SUBREVISION '5'
66 #define DPT_YEAR (2001-1980)
68 #define DPT_DRIVER "dpt_i2o"
69 #define DPTI_I2O_MAJOR (151)
70 #define DPT_ORGANIZATION_ID (0x1B)
71 #define DPTI_MAX_HBA (16)
72 #define MAX_CHANNEL (5) // Maximum Channel # Supported
73 #define MAX_ID (128) // Maximum Target ID Supported
76 #define REPLY_FRAME_SIZE (17)
77 #define MAX_MESSAGE_SIZE (128)
78 #define SG_LIST_ELEMENTS (56)
80 #define EMPTY_QUEUE 0xffffffff
81 #define I2O_INTERRUPT_PENDING_B (0x08)
83 #define PCI_DPT_VENDOR_ID (0x1044) // DPT PCI Vendor ID
84 #define PCI_DPT_DEVICE_ID (0xA501) // DPT PCI I2O Device ID
85 #define PCI_DPT_RAPTOR_DEVICE_ID (0xA511)
91 # define PDEBUG(fmt, args...) printk(KERN_DEBUG "dpti: " fmt, ##args)
92 # define PDEBUGV(fmt, args...) printk(KERN_DEBUG "dpti: " fmt, ##args)
94 # define PDEBUG(fmt, args...)
95 # define PDEBUGV(fmt, args...)
98 #define PERROR(fmt, args...) printk(KERN_ERR fmt, ##args)
99 #define PWARN(fmt, args...) printk(KERN_WARNING fmt, ##args)
100 #define PINFO(fmt, args...) printk(KERN_INFO fmt, ##args)
101 #define PCRIT(fmt, args...) printk(KERN_CRIT fmt, ##args)
103 #define SHUTDOWN_SIGS (sigmask(SIGKILL)|sigmask(SIGINT)|sigmask(SIGTERM))
107 #define TMOUT_INQUIRY (20)
108 #define TMOUT_FLUSH (360/45)
109 #define TMOUT_ABORT (30)
110 #define TMOUT_SCSI (300)
111 #define TMOUT_IOPRESET (360)
112 #define TMOUT_GETSTATUS (15)
113 #define TMOUT_INITOUTBOUND (15)
114 #define TMOUT_LCT (360)
117 #define I2O_SCSI_DEVICE_DSC_MASK 0x00FF
119 #define I2O_DETAIL_STATUS_UNSUPPORTED_FUNCTION 0x000A
121 #define I2O_SCSI_DSC_MASK 0xFF00
122 #define I2O_SCSI_DSC_SUCCESS 0x0000
123 #define I2O_SCSI_DSC_REQUEST_ABORTED 0x0200
124 #define I2O_SCSI_DSC_UNABLE_TO_ABORT 0x0300
125 #define I2O_SCSI_DSC_COMPLETE_WITH_ERROR 0x0400
126 #define I2O_SCSI_DSC_ADAPTER_BUSY 0x0500
127 #define I2O_SCSI_DSC_REQUEST_INVALID 0x0600
128 #define I2O_SCSI_DSC_PATH_INVALID 0x0700
129 #define I2O_SCSI_DSC_DEVICE_NOT_PRESENT 0x0800
130 #define I2O_SCSI_DSC_UNABLE_TO_TERMINATE 0x0900
131 #define I2O_SCSI_DSC_SELECTION_TIMEOUT 0x0A00
132 #define I2O_SCSI_DSC_COMMAND_TIMEOUT 0x0B00
133 #define I2O_SCSI_DSC_MR_MESSAGE_RECEIVED 0x0D00
134 #define I2O_SCSI_DSC_SCSI_BUS_RESET 0x0E00
135 #define I2O_SCSI_DSC_PARITY_ERROR_FAILURE 0x0F00
136 #define I2O_SCSI_DSC_AUTOSENSE_FAILED 0x1000
137 #define I2O_SCSI_DSC_NO_ADAPTER 0x1100
138 #define I2O_SCSI_DSC_DATA_OVERRUN 0x1200
139 #define I2O_SCSI_DSC_UNEXPECTED_BUS_FREE 0x1300
140 #define I2O_SCSI_DSC_SEQUENCE_FAILURE 0x1400
141 #define I2O_SCSI_DSC_REQUEST_LENGTH_ERROR 0x1500
142 #define I2O_SCSI_DSC_PROVIDE_FAILURE 0x1600
143 #define I2O_SCSI_DSC_BDR_MESSAGE_SENT 0x1700
144 #define I2O_SCSI_DSC_REQUEST_TERMINATED 0x1800
145 #define I2O_SCSI_DSC_IDE_MESSAGE_SENT 0x3300
146 #define I2O_SCSI_DSC_RESOURCE_UNAVAILABLE 0x3400
147 #define I2O_SCSI_DSC_UNACKNOWLEDGED_EVENT 0x3500
148 #define I2O_SCSI_DSC_MESSAGE_RECEIVED 0x3600
149 #define I2O_SCSI_DSC_INVALID_CDB 0x3700
150 #define I2O_SCSI_DSC_LUN_INVALID 0x3800
151 #define I2O_SCSI_DSC_SCSI_TID_INVALID 0x3900
152 #define I2O_SCSI_DSC_FUNCTION_UNAVAILABLE 0x3A00
153 #define I2O_SCSI_DSC_NO_NEXUS 0x3B00
154 #define I2O_SCSI_DSC_SCSI_IID_INVALID 0x3C00
155 #define I2O_SCSI_DSC_CDB_RECEIVED 0x3D00
156 #define I2O_SCSI_DSC_LUN_ALREADY_ENABLED 0x3E00
157 #define I2O_SCSI_DSC_BUS_BUSY 0x3F00
158 #define I2O_SCSI_DSC_QUEUE_FROZEN 0x4000
166 #define HBA_FLAGS_INSTALLED_B 0x00000001 // Adapter Was Installed
167 #define HBA_FLAGS_BLINKLED_B 0x00000002 // Adapter In Blink LED State
168 #define HBA_FLAGS_IN_RESET 0x00000040
169 #define HBA_HOSTRESET_FAILED 0x00000080
173 #define DPTI_DEV_ONLINE 0x00
174 #define DPTI_DEV_UNSCANNED 0x01
175 #define DPTI_DEV_RESET 0x02
176 #define DPTI_DEV_OFFLINE 0x04
204 #define DPTI_STATE_RESET (0x01)
205 #define DPTI_STATE_IOCTL (0x02)
268 static void adpt_i2o_sys_shutdown(
void);
269 static int adpt_init(
void);
270 static int adpt_i2o_build_sys_table(
void);
274 static int adpt_i2o_query_scalar(
adpt_hba* pHba,
int tid,
277 static const char *adpt_i2o_get_class_name(
int class);
279 static int adpt_i2o_issue_params(
int cmd,
adpt_hba* pHba,
int tid,
281 void *resblk,
dma_addr_t resblk_pa,
int reslen);
282 static int adpt_i2o_post_wait(
adpt_hba* pHba,
u32*
msg,
int len,
int timeout);
283 static int adpt_i2o_lct_get(
adpt_hba* pHba);
284 static int adpt_i2o_parse_lct(
adpt_hba* pHba);
285 static int adpt_i2o_activate_hba(
adpt_hba* pHba);
286 static int adpt_i2o_enable_hba(
adpt_hba* pHba);
291 static s32 adpt_i2o_init_outbound_q(
adpt_hba* pHba);
301 static void adpt_i2o_delete_hba(
adpt_hba* pHba);
302 static void adpt_inquiry(
adpt_hba* pHba);
303 static void adpt_fail_posted_scbs(
adpt_hba* pHba);
306 static int adpt_i2o_online_hba(
adpt_hba* pHba);
307 static void adpt_i2o_post_wait_complete(
u32,
int);
308 static int adpt_i2o_systab_send(
adpt_hba* pHba);
316 static void adpt_delay(
int millisec);
319 #define PRINT_BUFFER_SIZE 512
321 #define HBA_FLAGS_DBG_FLAGS_MASK 0xffff0000 // Mask for debug flags
322 #define HBA_FLAGS_DBG_KERNEL_PRINT_B 0x00010000 // Kernel Debugger Print
323 #define HBA_FLAGS_DBG_FW_PRINT_B 0x00020000 // Firmware Debugger Print
324 #define HBA_FLAGS_DBG_FUNCTION_ENTRY_B 0x00040000 // Function Entry Point
325 #define HBA_FLAGS_DBG_FUNCTION_EXIT_B 0x00080000 // Function Exit
326 #define HBA_FLAGS_DBG_ERROR_B 0x00100000 // Error Conditions
327 #define HBA_FLAGS_DBG_INIT_B 0x00200000 // Init Prints
328 #define HBA_FLAGS_DBG_OS_COMMANDS_B 0x00400000 // OS Command Info
329 #define HBA_FLAGS_DBG_SCAN_B 0x00800000 // Device Scan
331 #define FW_DEBUG_STR_LENGTH_OFFSET 0
332 #define FW_DEBUG_FLAGS_OFFSET 4
333 #define FW_DEBUG_BLED_OFFSET 8
335 #define FW_DEBUG_FLAGS_NO_HEADERS_B 0x01