1 /*- 2 * Copyright (c) 2001,2002 S�ren Schmidt <sos@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer, 10 * without modification, immediately at the beginning of the file. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * $FreeBSD$ 29 */ 30 31 /* misc defines */ 32 MALLOC_DECLARE(M_PSTIOP); 33 #define I2O_IOP_OUTBOUND_FRAME_COUNT 32 34 #define I2O_IOP_OUTBOUND_FRAME_SIZE 0x20 35 36 /* structure defs */ 37 struct out_mfa_buf { 38 u_int32_t buf[I2O_IOP_OUTBOUND_FRAME_SIZE]; 39 }; 40 41 struct iop_softc { 42 struct resource *r_mem; 43 struct resource *r_irq; 44 caddr_t ibase; 45 u_int32_t phys_ibase; 46 caddr_t obase; 47 u_int32_t phys_obase; 48 struct i2o_registers *reg; 49 struct i2o_status_get_reply *status; 50 int lct_count; 51 struct i2o_lct_entry *lct; 52 device_t dev; 53 void *handle; 54 struct intr_config_hook *iop_delayed_attach; 55 }; 56 57 /* structure at start of IOP shared mem */ 58 struct i2o_registers { 59 volatile u_int32_t apic_select; 60 volatile u_int32_t reserved0; 61 volatile u_int32_t apic_winreg; 62 volatile u_int32_t reserved1; 63 volatile u_int32_t iqueue_reg0; 64 volatile u_int32_t iqueue_reg1; 65 volatile u_int32_t oqueue_reg0; 66 volatile u_int32_t oqueue_reg1; 67 volatile u_int32_t iqueue_event; 68 volatile u_int32_t iqueue_intr_status; 69 volatile u_int32_t iqueue_intr_mask; 70 volatile u_int32_t oqueue_event; 71 volatile u_int32_t oqueue_intr_status; 72 volatile u_int32_t oqueue_intr_mask; 73 #define I2O_OUT_INTR_QUEUE 0x08 74 #define I2O_OUT_INTR_BELL 0x04 75 #define I2O_OUT_INTR_MSG1 0x02 76 #define I2O_OUT_INTR_MSG0 0x01 77 78 volatile u_int64_t reserved2; 79 volatile u_int32_t iqueue; 80 volatile u_int32_t oqueue; 81 volatile u_int64_t reserved3; 82 volatile u_int64_t mac_addr; 83 volatile u_int32_t ip_addr; 84 volatile u_int32_t ip_mask; 85 }; 86 87 /* Scatter/Gather List management */ 88 struct i2o_sgl { 89 u_int32_t count:24; 90 #define I2O_SGL_CNT_MASK 0xffffff 91 92 u_int32_t flags:8; 93 #define I2O_SGL_SIMPLE 0x10 94 #define I2O_SGL_PAGELIST 0x20 95 #define I2O_SGL_CHAIN 0x30 96 #define I2O_SGL_ATTRIBUTE 0x7c 97 #define I2O_SGL_BC0 0x01 98 #define I2O_SGL_BC1 0x02 99 #define I2O_SGL_DIR 0x04 100 #define I2O_SGL_LA 0x08 101 #define I2O_SGL_EOB 0x40 102 #define I2O_SGL_END 0x80 103 104 u_int32_t phys_addr[1]; 105 } __attribute__((packed)); 106 107 #define I2O_SGL_MAX_SEGS ((I2O_IOP_OUTBOUND_FRAME_SIZE - (8 + 2)) + 1) 108 109 /* i2o command codes */ 110 #define I2O_UTIL_NOP 0x00 111 #define I2O_UTIL_PARAMS_GET 0x06 112 #define I2O_UTIL_CLAIM 0x09 113 #define I2O_UTIL_CONFIG_DIALOG 0x10 114 #define I2O_UTIL_EVENT_REGISTER 0x13 115 #define I2O_BSA_BLOCK_READ 0x30 116 #define I2O_BSA_BLOCK_WRITE 0x31 117 #define I2O_BSA_CACHE_FLUSH 0x37 118 #define I2O_EXEC_STATUS_GET 0xa0 119 #define I2O_EXEC_OUTBOUND_INIT 0xa1 120 #define I2O_EXEC_LCT_NOTIFY 0xa2 121 #define I2O_EXEC_SYSTAB_SET 0xa3 122 #define I2O_EXEC_IOP_RESET 0xbd 123 #define I2O_EXEC_SYS_ENABLE 0xd1 124 125 /* basic message layout */ 126 struct i2o_basic_message { 127 u_int8_t version:4; 128 u_int8_t offset:4; 129 u_int8_t message_flags; 130 u_int16_t message_size; 131 u_int32_t target_address:12; 132 u_int32_t initiator_address:12; 133 u_int32_t function:8; 134 u_int32_t initiator_context; 135 } __attribute__((packed)); 136 137 /* basic reply layout */ 138 struct i2o_single_reply { 139 u_int8_t version_offset; 140 u_int8_t message_flags; 141 #define I2O_MESSAGE_FLAGS_STATIC 0x01 142 #define I2O_MESSAGE_FLAGS_64BIT 0x02 143 #define I2O_MESSAGE_FLAGS_MULTIPLE 0x10 144 #define I2O_MESSAGE_FLAGS_FAIL 0x20 145 #define I2O_MESSAGE_FLAGS_LAST 0x40 146 #define I2O_MESSAGE_FLAGS_REPLY 0x80 147 148 u_int16_t message_size; 149 u_int32_t target_address:12; 150 u_int32_t initiator_address:12; 151 u_int32_t function:8; 152 u_int32_t initiator_context; 153 u_int32_t transaction_context; 154 u_int16_t detailed_status; 155 #define I2O_DETAIL_STATUS_SUCCESS 0x0000 156 #define I2O_DETAIL_STATUS_BAD_KEY 0x0002 157 #define I2O_DETAIL_STATUS_TCL_ERROR 0x0003 158 #define I2O_DETAIL_STATUS_REPLY_BUFFER_FULL 0x0004 159 #define I2O_DETAIL_STATUS_NO_SUCH_PAGE 0x0005 160 #define I2O_DETAIL_STATUS_INSUFFICIENT_RESOURCE_SOFT 0x0006 161 #define I2O_DETAIL_STATUS_INSUFFICIENT_RESOURCE_HARD 0x0007 162 #define I2O_DETAIL_STATUS_CHAIN_BUFFER_TOO_LARGE 0x0009 163 #define I2O_DETAIL_STATUS_UNSUPPORTED_FUNCTION 0x000a 164 #define I2O_DETAIL_STATUS_DEVICE_LOCKED 0x000b 165 #define I2O_DETAIL_STATUS_DEVICE_RESET 0x000c 166 #define I2O_DETAIL_STATUS_INAPPROPRIATE_FUNCTION 0x000d 167 #define I2O_DETAIL_STATUS_INVALID_INITIATOR_ADDRESS 0x000e 168 #define I2O_DETAIL_STATUS_INVALID_MESSAGE_FLAGS 0x000f 169 #define I2O_DETAIL_STATUS_INVALID_OFFSET 0x0010 170 #define I2O_DETAIL_STATUS_INVALID_PARAMETER 0x0011 171 #define I2O_DETAIL_STATUS_INVALID_REQUEST 0x0012 172 #define I2O_DETAIL_STATUS_INVALID_TARGET_ADDRESS 0x0013 173 #define I2O_DETAIL_STATUS_MESSAGE_TOO_LARGE 0x0014 174 #define I2O_DETAIL_STATUS_MESSAGE_TOO_SMALL 0x0015 175 #define I2O_DETAIL_STATUS_MISSING_PARAMETER 0x0016 176 #define I2O_DETAIL_STATUS_TIMEOUT 0x0017 177 #define I2O_DETAIL_STATUS_UNKNOWN_ERROR 0x0018 178 #define I2O_DETAIL_STATUS_UNKNOWN_FUNCTION 0x0019 179 #define I2O_DETAIL_STATUS_UNSUPPORTED_VERSION 0x001a 180 #define I2O_DETAIL_STATUS_DEVICE_BUSY 0x001b 181 #define I2O_DETAIL_STATUS_DEVICE_NOT_AVAILABLE 0x001c 182 183 u_int8_t retry_count; 184 u_int8_t status; 185 #define I2O_REPLY_STATUS_SUCCESS 0x00 186 #define I2O_REPLY_STATUS_ABORT_DIRTY 0x01 187 #define I2O_REPLY_STATUS_ABORT_NO_DATA_TRANSFER 0x02 188 #define I2O_REPLY_STATUS_ABORT_PARTIAL_TRANSFER 0x03 189 #define I2O_REPLY_STATUS_ERROR_DIRTY 0x04 190 #define I2O_REPLY_STATUS_ERROR_NO_DATA_TRANSFER 0x05 191 #define I2O_REPLY_STATUS_ERROR_PARTIAL_TRANSFER 0x06 192 #define I2O_REPLY_STATUS_PROCESS_ABORT_DIRTY 0x08 193 #define I2O_REPLY_STATUS_PROCESS_ABORT_NO_DATA_TRANSFER 0x09 194 #define I2O_REPLY_STATUS_PROCESS_ABORT_PARTIAL_TRANSFER 0x0a 195 #define I2O_REPLY_STATUS_TRANSACTION_ERROR 0x0b 196 #define I2O_REPLY_STATUS_PROGRESS_REPORT 0x80 197 198 u_int32_t donecount; 199 } __attribute__((packed)); 200 201 struct i2o_fault_reply { 202 u_int8_t version_offset; 203 u_int8_t message_flags; 204 u_int16_t message_size; 205 u_int32_t target_address:12; 206 u_int32_t initiator_address:12; 207 u_int32_t function:8; 208 u_int32_t initiator_context; 209 u_int32_t transaction_context; 210 u_int8_t lowest_version; 211 u_int8_t highest_version; 212 u_int8_t severity; 213 #define I2O_SEVERITY_FORMAT_ERROR 0x01 214 #define I2O_SEVERITY_PATH_ERROR 0x02 215 #define I2O_SEVERITY_PATH_STATE 0x04 216 #define I2O_SEVERITY_CONGESTION 0x08 217 218 u_int8_t failure_code; 219 #define I2O_FAILURE_CODE_TRANSPORT_SERVICE_SUSPENDED 0x81 220 #define I2O_FAILURE_CODE_TRANSPORT_SERVICE_TERMINATED 0x82 221 #define I2O_FAILURE_CODE_TRANSPORT_CONGESTION 0x83 222 #define I2O_FAILURE_CODE_TRANSPORT_FAIL 0x84 223 #define I2O_FAILURE_CODE_TRANSPORT_STATE_ERROR 0x85 224 #define I2O_FAILURE_CODE_TRANSPORT_TIME_OUT 0x86 225 #define I2O_FAILURE_CODE_TRANSPORT_ROUTING_FAILURE 0x87 226 #define I2O_FAILURE_CODE_TRANSPORT_INVALID_VERSION 0x88 227 #define I2O_FAILURE_CODE_TRANSPORT_INVALID_OFFSET 0x89 228 #define I2O_FAILURE_CODE_TRANSPORT_INVALID_MSG_FLAGS 0x8A 229 #define I2O_FAILURE_CODE_TRANSPORT_FRAME_TOO_SMALL 0x8B 230 #define I2O_FAILURE_CODE_TRANSPORT_FRAME_TOO_LARGE 0x8C 231 #define I2O_FAILURE_CODE_TRANSPORT_INVALID_TARGET_ID 0x8D 232 #define I2O_FAILURE_CODE_TRANSPORT_INVALID_INITIATOR_ID 0x8E 233 #define I2O_FAILURE_CODE_TRANSPORT_INVALID_INITIATOR_CONTEXT 0x8F 234 #define I2O_FAILURE_CODE_TRANSPORT_UNKNOWN_FAILURE 0xFF 235 236 u_int32_t failing_iop_id:12; 237 u_int32_t reserved:4; 238 u_int32_t failing_host_unit_id:16; 239 u_int32_t age_limit; 240 u_int64_t preserved_mfa; 241 } __attribute__((packed)); 242 243 struct i2o_exec_iop_reset_message { 244 u_int8_t version_offset; 245 u_int8_t message_flags; 246 u_int16_t message_size; 247 u_int32_t target_address:12; 248 u_int32_t initiator_address:12; 249 u_int32_t function:8; 250 u_int8_t reserved[16]; 251 u_int32_t status_word_low_addr; 252 u_int32_t status_word_high_addr; 253 } __attribute__((packed)); 254 255 struct i2o_exec_status_get_message { 256 u_int8_t version_offset; 257 u_int8_t message_flags; 258 u_int16_t message_size; 259 u_int32_t target_address:12; 260 u_int32_t initiator_address:12; 261 u_int32_t function:8; 262 u_int8_t reserved[16]; 263 u_int32_t reply_buf_low_addr; 264 u_int32_t reply_buf_high_addr; 265 u_int32_t reply_buf_length; 266 } __attribute__((packed)); 267 268 struct i2o_status_get_reply { 269 u_int16_t organization_id; 270 u_int16_t reserved; 271 u_int32_t iop_id:12; 272 u_int32_t reserved1:4; 273 u_int32_t host_unit_id:16; 274 u_int32_t segment_number:12; 275 u_int32_t i2o_version:4; 276 u_int32_t iop_state:8; 277 #define I2O_IOP_STATE_INITIALIZING 0x01 278 #define I2O_IOP_STATE_RESET 0x02 279 #define I2O_IOP_STATE_HOLD 0x04 280 #define I2O_IOP_STATE_READY 0x05 281 #define I2O_IOP_STATE_OPERATIONAL 0x08 282 #define I2O_IOP_STATE_FAILED 0x10 283 #define I2O_IOP_STATE_FAULTED 0x11 284 285 u_int32_t messenger_type:8; 286 u_int16_t inbound_mframe_size; 287 u_int8_t init_code; 288 u_int8_t reserved2; 289 u_int32_t max_inbound_mframes; 290 u_int32_t current_ibound_mframes; 291 u_int32_t max_outbound_mframes; 292 u_int8_t product_idstring[24]; 293 u_int32_t expected_lct_size; 294 u_int32_t iop_capabilities; 295 u_int32_t desired_private_memsize; 296 u_int32_t current_private_memsize; 297 u_int32_t current_private_membase; 298 u_int32_t desired_private_iosize; 299 u_int32_t current_private_iosize; 300 u_int32_t current_private_iobase; 301 u_int8_t reserved3[3]; 302 u_int8_t sync_byte; 303 } __attribute__((packed)); 304 305 struct i2o_exec_init_outqueue_message { 306 u_int8_t version_offset; 307 u_int8_t message_flags; 308 u_int16_t message_size; 309 u_int32_t target_address:12; 310 u_int32_t initiator_address:12; 311 u_int32_t function:8; 312 u_int32_t initiator_context; 313 u_int32_t transaction_context; 314 u_int32_t host_pagesize; 315 u_int8_t init_code; 316 u_int8_t reserved; 317 u_int16_t queue_framesize; 318 struct i2o_sgl sgl[2]; 319 } __attribute__((packed)); 320 321 #define I2O_EXEC_OUTBOUND_INIT_IN_PROGRESS 0x01 322 #define I2O_EXEC_OUTBOUND_INIT_REJECTED 0x02 323 #define I2O_EXEC_OUTBOUND_INIT_FAILED 0x03 324 #define I2O_EXEC_OUTBOUND_INIT_COMPLETE 0x04 325 326 struct i2o_exec_systab_set_message { 327 u_int8_t version_offset; 328 u_int8_t message_flags; 329 u_int16_t message_size; 330 u_int32_t target_address:12; 331 u_int32_t initiator_address:12; 332 u_int32_t function:8; 333 u_int32_t initiator_context; 334 u_int32_t transaction_context; 335 u_int32_t iop_id:12; 336 #define I2O_EXEC_SYS_TAB_IOP_ID_LOCAL_IOP 0x000 337 #define I2O_EXEC_SYS_TAB_IOP_ID_LOCAL_HOST 0x001 338 #define I2O_EXEC_SYS_TAB_IOP_ID_UNKNOWN_IOP 0xfff 339 340 u_int32_t reserved1:4; 341 u_int32_t host_unit_id:16; 342 #define I2O_EXEC_SYS_TAB_HOST_UNIT_ID_LOCAL_UNIT 0x0000 343 #define I2O_EXEC_SYS_TAB_HOST_UNIT_ID_UNKNOWN_UNIT 0xffff 344 345 u_int32_t segment_number:12; 346 #define I2O_EXEC_SYS_TAB_SEG_NUMBER_LOCAL_SEGMENT 0x000 347 #define I2O_EXEC_SYS_TAB_SEG_NUMBER_UNKNOWN_SEGMENT 0xfff 348 349 u_int32_t reserved2:4; 350 u_int32_t reserved3:8; 351 struct i2o_sgl sgl[3]; 352 } __attribute__((packed)); 353 354 struct i2o_exec_systab { 355 u_int8_t entries; 356 u_int8_t version; 357 #define I2O_RESOURCE_MANAGER_VERSION 0 358 359 u_int16_t reserved1; 360 u_int32_t change_id; 361 u_int64_t reserved2; 362 u_int16_t organization_id; 363 u_int16_t reserved3; 364 u_int32_t iop_id:12; 365 u_int32_t reserved4:20; 366 u_int32_t segment_number:12; 367 u_int32_t i2o_version:4; 368 u_int32_t iop_state:8; 369 u_int32_t messenger_type:8; 370 u_int16_t inbound_mframe_size; 371 u_int16_t reserved5; 372 u_int32_t last_changed; 373 u_int32_t iop_capabilities; 374 u_int64_t messenger_info; 375 } __attribute__((packed)); 376 377 struct i2o_exec_get_lct_message { 378 u_int8_t version_offset; 379 u_int8_t message_flags; 380 u_int16_t message_size; 381 u_int32_t target_address:12; 382 u_int32_t initiator_address:12; 383 u_int32_t function:8; 384 u_int32_t initiator_context; 385 u_int32_t transaction_context; 386 u_int32_t class; 387 u_int32_t last_change_id; 388 struct i2o_sgl sgl; 389 } __attribute__((packed)); 390 391 #define I2O_TID_IOP 0x000 392 #define I2O_TID_HOST 0x001 393 #define I2O_TID_NONE 0xfff 394 395 struct i2o_lct_entry { 396 u_int32_t entry_size:16; 397 u_int32_t local_tid:12; 398 u_int32_t reserved:4; 399 u_int32_t change_id; 400 u_int32_t device_flags; 401 u_int32_t class:12; 402 #define I2O_CLASS_EXECUTIVE 0x000 403 #define I2O_CLASS_DDM 0x001 404 #define I2O_CLASS_RANDOM_BLOCK_STORAGE 0x010 405 #define I2O_CLASS_SEQUENTIAL_STORAGE 0x011 406 #define I2O_CLASS_LAN 0x020 407 #define I2O_CLASS_WAN 0x030 408 #define I2O_CLASS_FIBRE_CHANNEL_PORT 0x040 409 #define I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL 0x041 410 #define I2O_CLASS_SCSI_PERIPHERAL 0x051 411 #define I2O_CLASS_ATE_PORT 0x060 412 #define I2O_CLASS_ATE_PERIPHERAL 0x061 413 #define I2O_CLASS_FLOPPY_CONTROLLER 0x070 414 #define I2O_CLASS_FLOPPY_DEVICE 0x071 415 #define I2O_CLASS_BUS_ADAPTER_PORT 0x080 416 #define I2O_CLASS_MATCH_ANYCLASS 0xffffffff 417 418 u_int32_t class_version:4; 419 u_int32_t class_org:16; 420 u_int32_t sub_class; 421 #define I2O_SUBCLASS_i960 0x001 422 #define I2O_SUBCLASS_HDM 0x020 423 #define I2O_SUBCLASS_ISM 0x021 424 425 u_int32_t user_tid:12; 426 u_int32_t parent_tid:12; 427 u_int32_t bios_info:8; 428 u_int8_t identity_tag[8]; 429 u_int32_t event_capabilities; 430 } __attribute__((packed)); 431 432 #define I2O_LCT_ENTRYSIZE (sizeof(struct i2o_lct_entry)/sizeof(u_int32_t)) 433 434 struct i2o_get_lct_reply { 435 u_int32_t table_size:16; 436 u_int32_t boot_device:12; 437 u_int32_t lct_version:4; 438 u_int32_t iop_flags; 439 u_int32_t current_change_id; 440 struct i2o_lct_entry entry[1]; 441 } __attribute__((packed)); 442 443 struct i2o_util_get_param_message { 444 u_int8_t version_offset; 445 u_int8_t message_flags; 446 u_int16_t message_size; 447 u_int32_t target_address:12; 448 u_int32_t initiator_address:12; 449 u_int32_t function:8; 450 u_int32_t initiator_context; 451 u_int32_t transaction_context; 452 u_int32_t operation_flags; 453 struct i2o_sgl sgl[2]; 454 } __attribute__((packed)); 455 456 struct i2o_get_param_template { 457 u_int16_t operation; 458 #define I2O_PARAMS_OPERATION_FIELD_GET 0x0001 459 #define I2O_PARAMS_OPERATION_LIST_GET 0x0002 460 #define I2O_PARAMS_OPERATION_MORE_GET 0x0003 461 #define I2O_PARAMS_OPERATION_SIZE_GET 0x0004 462 #define I2O_PARAMS_OPERATION_TABLE_GET 0x0005 463 #define I2O_PARAMS_OPERATION_FIELD_SET 0x0006 464 #define I2O_PARAMS_OPERATION_LIST_SET 0x0007 465 #define I2O_PARAMS_OPERATION_ROW_ADD 0x0008 466 #define I2O_PARAMS_OPERATION_ROW_DELETE 0x0009 467 #define I2O_PARAMS_OPERATION_TABLE_CLEAR 0x000A 468 469 u_int16_t group; 470 #define I2O_BSA_DEVICE_INFO_GROUP_NO 0x0000 471 #define I2O_BSA_OPERATIONAL_CONTROL_GROUP_NO 0x0001 472 #define I2O_BSA_POWER_CONTROL_GROUP_NO 0x0002 473 #define I2O_BSA_CACHE_CONTROL_GROUP_NO 0x0003 474 #define I2O_BSA_MEDIA_INFO_GROUP_NO 0x0004 475 #define I2O_BSA_ERROR_LOG_GROUP_NO 0x0005 476 477 #define I2O_UTIL_PARAMS_DESCRIPTOR_GROUP_NO 0xF000 478 #define I2O_UTIL_PHYSICAL_DEVICE_TABLE_GROUP_NO 0xF001 479 #define I2O_UTIL_CLAIMED_TABLE_GROUP_NO 0xF002 480 #define I2O_UTIL_USER_TABLE_GROUP_NO 0xF003 481 #define I2O_UTIL_PRIVATE_MESSAGE_EXTENSIONS_GROUP_NO 0xF005 482 #define I2O_UTIL_AUTHORIZED_USER_TABLE_GROUP_NO 0xF006 483 #define I2O_UTIL_DEVICE_IDENTITY_GROUP_NO 0xF100 484 #define I2O_UTIL_DDM_IDENTITY_GROUP_NO 0xF101 485 #define I2O_UTIL_USER_INFORMATION_GROUP_NO 0xF102 486 #define I2O_UTIL_SGL_OPERATING_LIMITS_GROUP_NO 0xF103 487 #define I2O_UTIL_SENSORS_GROUP_NO 0xF200 488 489 u_int16_t field_count; 490 u_int16_t pad; 491 } __attribute__((packed)); 492 493 struct i2o_get_param_operation { 494 u_int16_t operation_count; 495 u_int16_t reserved; 496 struct i2o_get_param_template operation[1]; 497 } __attribute__((packed)); 498 499 struct i2o_get_param_reply { 500 u_int16_t result_count;; 501 u_int16_t reserved; 502 u_int16_t block_size; 503 u_int8_t block_status; 504 u_int8_t error_info_size; 505 u_int32_t result[1]; 506 } __attribute__((packed)); 507 508 struct i2o_device_identity { 509 u_int32_t class; 510 u_int16_t owner; 511 u_int16_t parent; 512 u_int8_t vendor[16]; 513 u_int8_t product[16]; 514 u_int8_t description[16]; 515 u_int8_t revision[8]; 516 u_int8_t sn_format; 517 u_int8_t serial[256]; 518 } __attribute__((packed)); 519 520 struct i2o_bsa_device { 521 u_int8_t device_type; 522 u_int8_t path_count; 523 u_int16_t power_state; 524 u_int32_t block_size; 525 u_int64_t capacity; 526 u_int32_t capabilities; 527 u_int32_t state; 528 } __attribute__((packed)); 529 530 struct i2o_util_claim_message { 531 u_int8_t version_offset; 532 u_int8_t message_flags; 533 u_int16_t message_size; 534 u_int32_t target_address:12; 535 u_int32_t initiator_address:12; 536 u_int32_t function:8; 537 u_int32_t initiator_context; 538 u_int32_t transaction_context; 539 u_int16_t claim_flags; 540 u_int8_t reserved; 541 u_int8_t claim_type; 542 } __attribute__((packed)); 543 544 struct i2o_util_event_register_message { 545 u_int8_t version_offset; 546 u_int8_t message_flags; 547 u_int16_t message_size; 548 u_int32_t target_address:12; 549 u_int32_t initiator_address:12; 550 u_int32_t function:8; 551 u_int32_t initiator_context; 552 u_int32_t transaction_context; 553 u_int32_t event_mask; 554 } __attribute__((packed)); 555 556 struct i2o_util_event_reply_message { 557 u_int8_t version_offset; 558 u_int8_t message_flags; 559 u_int16_t message_size; 560 u_int32_t target_address:12; 561 u_int32_t initiator_address:12; 562 u_int32_t function:8; 563 u_int32_t initiator_context; 564 u_int32_t transaction_context; 565 u_int32_t event_mask; 566 u_int32_t event_data[1]; 567 } __attribute__((packed)); 568 569 struct i2o_util_config_dialog_message { 570 u_int8_t version_offset; 571 u_int8_t message_flags; 572 u_int16_t message_size; 573 u_int32_t target_address:12; 574 u_int32_t initiator_address:12; 575 u_int32_t function:8; 576 u_int32_t initiator_context; 577 u_int32_t transaction_context; 578 u_int32_t page_number; 579 struct i2o_sgl sgl[2]; 580 } __attribute__((packed)); 581 582 struct i2o_bsa_rw_block_message { 583 u_int8_t version_offset; 584 u_int8_t message_flags; 585 u_int16_t message_size; 586 u_int32_t target_address:12; 587 u_int32_t initiator_address:12; 588 u_int32_t function:8; 589 u_int32_t initiator_context; 590 u_int32_t transaction_context; 591 u_int16_t control_flags; 592 u_int8_t time_multiplier; 593 u_int8_t fetch_ahead; 594 u_int32_t bytecount; 595 u_int64_t lba; 596 struct i2o_sgl sgl; 597 } __attribute__((packed)); 598 599 struct i2o_bsa_cache_flush_message { 600 u_int8_t version_offset; 601 u_int8_t message_flags; 602 u_int16_t message_size; 603 u_int32_t target_address:12; 604 u_int32_t initiator_address:12; 605 u_int32_t function:8; 606 u_int32_t initiator_context; 607 u_int32_t transaction_context; 608 u_int16_t control_flags; 609 u_int8_t time_multiplier; 610 u_int8_t reserved; 611 } __attribute__((packed)); 612 613 /* prototypes */ 614 int iop_init(struct iop_softc *); 615 void iop_attach(struct iop_softc *); 616 void iop_intr(void *); 617 int iop_reset(struct iop_softc *); 618 int iop_init_outqueue(struct iop_softc *); 619 int iop_get_lct(struct iop_softc *); 620 struct i2o_get_param_reply *iop_get_util_params(struct iop_softc *,int,int,int); 621 u_int32_t iop_get_mfa(struct iop_softc *); 622 void iop_free_mfa(struct iop_softc *, int); 623 int iop_queue_wait_msg(struct iop_softc *, int, struct i2o_basic_message *); 624 int iop_create_sgl(struct i2o_basic_message *, caddr_t, int, int); 625 626 /* global prototypes */ 627 int pst_add_raid(struct iop_softc *, struct i2o_lct_entry *); 628