pst-iop.h revision 103870
1101100Ssos/*- 2101100Ssos * Copyright (c) 2001,2002 S�ren Schmidt <sos@FreeBSD.org> 3101100Ssos * All rights reserved. 4101100Ssos * 5101100Ssos * Redistribution and use in source and binary forms, with or without 6101100Ssos * modification, are permitted provided that the following conditions 7101100Ssos * are met: 8101100Ssos * 1. Redistributions of source code must retain the above copyright 9101100Ssos * notice, this list of conditions and the following disclaimer, 10101100Ssos * without modification, immediately at the beginning of the file. 11101100Ssos * 2. Redistributions in binary form must reproduce the above copyright 12101100Ssos * notice, this list of conditions and the following disclaimer in the 13101100Ssos * documentation and/or other materials provided with the distribution. 14101100Ssos * 3. The name of the author may not be used to endorse or promote products 15101100Ssos * derived from this software without specific prior written permission. 16101100Ssos * 17101100Ssos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18101100Ssos * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19101100Ssos * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20101100Ssos * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21101100Ssos * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22101100Ssos * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23101100Ssos * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24101100Ssos * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25101100Ssos * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26101100Ssos * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27101100Ssos * 28101100Ssos * $FreeBSD: head/sys/dev/pst/pst-iop.h 103870 2002-09-23 18:54:32Z alfred $ 29101100Ssos */ 30101100Ssos 31101100Ssos/* misc defines */ 32101100SsosMALLOC_DECLARE(M_PSTIOP); 33101100Ssos#define I2O_IOP_OUTBOUND_FRAME_COUNT 32 34101100Ssos#define I2O_IOP_OUTBOUND_FRAME_SIZE 0x20 35101100Ssos 36101100Ssos/* structure defs */ 37101100Ssosstruct out_mfa_buf { 38101100Ssos u_int32_t buf[I2O_IOP_OUTBOUND_FRAME_SIZE]; 39101100Ssos}; 40101100Ssos 41101100Ssosstruct iop_softc { 42102058Ssos struct resource *r_mem; 43102058Ssos struct resource *r_irq; 44102058Ssos caddr_t ibase; 45102058Ssos u_int32_t phys_ibase; 46102058Ssos caddr_t obase; 47102058Ssos u_int32_t phys_obase; 48102058Ssos struct i2o_registers *reg; 49102058Ssos struct i2o_status_get_reply *status; 50102058Ssos int lct_count; 51102058Ssos struct i2o_lct_entry *lct; 52102058Ssos device_t dev; 53102058Ssos void *handle; 54102058Ssos struct intr_config_hook *iop_delayed_attach; 55101100Ssos}; 56101100Ssos 57101100Ssos/* structure at start of IOP shared mem */ 58101100Ssosstruct i2o_registers { 59101100Ssos volatile u_int32_t apic_select; 60101100Ssos volatile u_int32_t reserved0; 61101100Ssos volatile u_int32_t apic_winreg; 62101100Ssos volatile u_int32_t reserved1; 63101100Ssos volatile u_int32_t iqueue_reg0; 64101100Ssos volatile u_int32_t iqueue_reg1; 65101100Ssos volatile u_int32_t oqueue_reg0; 66101100Ssos volatile u_int32_t oqueue_reg1; 67101100Ssos volatile u_int32_t iqueue_event; 68101100Ssos volatile u_int32_t iqueue_intr_status; 69101100Ssos volatile u_int32_t iqueue_intr_mask; 70101100Ssos volatile u_int32_t oqueue_event; 71101100Ssos volatile u_int32_t oqueue_intr_status; 72101100Ssos volatile u_int32_t oqueue_intr_mask; 73102058Ssos#define I2O_OUT_INTR_QUEUE 0x08 74102058Ssos#define I2O_OUT_INTR_BELL 0x04 75102058Ssos#define I2O_OUT_INTR_MSG1 0x02 76102058Ssos#define I2O_OUT_INTR_MSG0 0x01 77101100Ssos 78101100Ssos volatile u_int64_t reserved2; 79101100Ssos volatile u_int32_t iqueue; 80101100Ssos volatile u_int32_t oqueue; 81101100Ssos volatile u_int64_t reserved3; 82101100Ssos volatile u_int64_t mac_addr; 83101100Ssos volatile u_int32_t ip_addr; 84101100Ssos volatile u_int32_t ip_mask; 85101100Ssos}; 86101100Ssos 87101100Ssos/* Scatter/Gather List management */ 88101100Ssosstruct i2o_sgl { 89102058Ssos u_int32_t count:24; 90102058Ssos#define I2O_SGL_CNT_MASK 0xffffff 91101100Ssos 92102058Ssos u_int32_t flags:8; 93102058Ssos#define I2O_SGL_SIMPLE 0x10 94102058Ssos#define I2O_SGL_PAGELIST 0x20 95102058Ssos#define I2O_SGL_CHAIN 0x30 96102058Ssos#define I2O_SGL_ATTRIBUTE 0x7c 97102058Ssos#define I2O_SGL_BC0 0x01 98102058Ssos#define I2O_SGL_BC1 0x02 99102058Ssos#define I2O_SGL_DIR 0x04 100102058Ssos#define I2O_SGL_LA 0x08 101102058Ssos#define I2O_SGL_EOB 0x40 102102058Ssos#define I2O_SGL_END 0x80 103101100Ssos 104102058Ssos u_int32_t phys_addr[1]; 105103870Salfred} __packed; 106101100Ssos 107101100Ssos#define I2O_SGL_MAX_SEGS ((I2O_IOP_OUTBOUND_FRAME_SIZE - (8 + 2)) + 1) 108101100Ssos 109101100Ssos/* i2o command codes */ 110102058Ssos#define I2O_UTIL_NOP 0x00 111102058Ssos#define I2O_UTIL_PARAMS_GET 0x06 112102058Ssos#define I2O_UTIL_CLAIM 0x09 113102058Ssos#define I2O_UTIL_CONFIG_DIALOG 0x10 114102058Ssos#define I2O_UTIL_EVENT_REGISTER 0x13 115102058Ssos#define I2O_BSA_BLOCK_READ 0x30 116102058Ssos#define I2O_BSA_BLOCK_WRITE 0x31 117102058Ssos#define I2O_BSA_CACHE_FLUSH 0x37 118102058Ssos#define I2O_EXEC_STATUS_GET 0xa0 119102058Ssos#define I2O_EXEC_OUTBOUND_INIT 0xa1 120102058Ssos#define I2O_EXEC_LCT_NOTIFY 0xa2 121102058Ssos#define I2O_EXEC_SYSTAB_SET 0xa3 122102058Ssos#define I2O_EXEC_IOP_RESET 0xbd 123102058Ssos#define I2O_EXEC_SYS_ENABLE 0xd1 124101100Ssos 125101100Ssos/* basic message layout */ 126101100Ssosstruct i2o_basic_message { 127101100Ssos u_int8_t version:4; 128101100Ssos u_int8_t offset:4; 129101100Ssos u_int8_t message_flags; 130101100Ssos u_int16_t message_size; 131101100Ssos u_int32_t target_address:12; 132101100Ssos u_int32_t initiator_address:12; 133101100Ssos u_int32_t function:8; 134101100Ssos u_int32_t initiator_context; 135102058Ssos u_int32_t transaction_context; 136103870Salfred} __packed; 137101100Ssos 138101100Ssos/* basic reply layout */ 139101100Ssosstruct i2o_single_reply { 140101100Ssos u_int8_t version_offset; 141101100Ssos u_int8_t message_flags; 142101100Ssos#define I2O_MESSAGE_FLAGS_STATIC 0x01 143101100Ssos#define I2O_MESSAGE_FLAGS_64BIT 0x02 144101100Ssos#define I2O_MESSAGE_FLAGS_MULTIPLE 0x10 145101100Ssos#define I2O_MESSAGE_FLAGS_FAIL 0x20 146101100Ssos#define I2O_MESSAGE_FLAGS_LAST 0x40 147101100Ssos#define I2O_MESSAGE_FLAGS_REPLY 0x80 148101100Ssos 149101100Ssos u_int16_t message_size; 150101100Ssos u_int32_t target_address:12; 151101100Ssos u_int32_t initiator_address:12; 152101100Ssos u_int32_t function:8; 153101100Ssos u_int32_t initiator_context; 154101100Ssos u_int32_t transaction_context; 155101100Ssos u_int16_t detailed_status; 156101100Ssos#define I2O_DETAIL_STATUS_SUCCESS 0x0000 157101100Ssos#define I2O_DETAIL_STATUS_BAD_KEY 0x0002 158101100Ssos#define I2O_DETAIL_STATUS_TCL_ERROR 0x0003 159101100Ssos#define I2O_DETAIL_STATUS_REPLY_BUFFER_FULL 0x0004 160101100Ssos#define I2O_DETAIL_STATUS_NO_SUCH_PAGE 0x0005 161101100Ssos#define I2O_DETAIL_STATUS_INSUFFICIENT_RESOURCE_SOFT 0x0006 162101100Ssos#define I2O_DETAIL_STATUS_INSUFFICIENT_RESOURCE_HARD 0x0007 163101100Ssos#define I2O_DETAIL_STATUS_CHAIN_BUFFER_TOO_LARGE 0x0009 164101100Ssos#define I2O_DETAIL_STATUS_UNSUPPORTED_FUNCTION 0x000a 165101100Ssos#define I2O_DETAIL_STATUS_DEVICE_LOCKED 0x000b 166101100Ssos#define I2O_DETAIL_STATUS_DEVICE_RESET 0x000c 167101100Ssos#define I2O_DETAIL_STATUS_INAPPROPRIATE_FUNCTION 0x000d 168101100Ssos#define I2O_DETAIL_STATUS_INVALID_INITIATOR_ADDRESS 0x000e 169101100Ssos#define I2O_DETAIL_STATUS_INVALID_MESSAGE_FLAGS 0x000f 170101100Ssos#define I2O_DETAIL_STATUS_INVALID_OFFSET 0x0010 171101100Ssos#define I2O_DETAIL_STATUS_INVALID_PARAMETER 0x0011 172101100Ssos#define I2O_DETAIL_STATUS_INVALID_REQUEST 0x0012 173101100Ssos#define I2O_DETAIL_STATUS_INVALID_TARGET_ADDRESS 0x0013 174101100Ssos#define I2O_DETAIL_STATUS_MESSAGE_TOO_LARGE 0x0014 175101100Ssos#define I2O_DETAIL_STATUS_MESSAGE_TOO_SMALL 0x0015 176101100Ssos#define I2O_DETAIL_STATUS_MISSING_PARAMETER 0x0016 177101100Ssos#define I2O_DETAIL_STATUS_TIMEOUT 0x0017 178101100Ssos#define I2O_DETAIL_STATUS_UNKNOWN_ERROR 0x0018 179101100Ssos#define I2O_DETAIL_STATUS_UNKNOWN_FUNCTION 0x0019 180101100Ssos#define I2O_DETAIL_STATUS_UNSUPPORTED_VERSION 0x001a 181101100Ssos#define I2O_DETAIL_STATUS_DEVICE_BUSY 0x001b 182101100Ssos#define I2O_DETAIL_STATUS_DEVICE_NOT_AVAILABLE 0x001c 183101100Ssos 184101100Ssos u_int8_t retry_count; 185101100Ssos u_int8_t status; 186101100Ssos#define I2O_REPLY_STATUS_SUCCESS 0x00 187101100Ssos#define I2O_REPLY_STATUS_ABORT_DIRTY 0x01 188101100Ssos#define I2O_REPLY_STATUS_ABORT_NO_DATA_TRANSFER 0x02 189101100Ssos#define I2O_REPLY_STATUS_ABORT_PARTIAL_TRANSFER 0x03 190101100Ssos#define I2O_REPLY_STATUS_ERROR_DIRTY 0x04 191101100Ssos#define I2O_REPLY_STATUS_ERROR_NO_DATA_TRANSFER 0x05 192101100Ssos#define I2O_REPLY_STATUS_ERROR_PARTIAL_TRANSFER 0x06 193101100Ssos#define I2O_REPLY_STATUS_PROCESS_ABORT_DIRTY 0x08 194101100Ssos#define I2O_REPLY_STATUS_PROCESS_ABORT_NO_DATA_TRANSFER 0x09 195101100Ssos#define I2O_REPLY_STATUS_PROCESS_ABORT_PARTIAL_TRANSFER 0x0a 196101100Ssos#define I2O_REPLY_STATUS_TRANSACTION_ERROR 0x0b 197101100Ssos#define I2O_REPLY_STATUS_PROGRESS_REPORT 0x80 198101100Ssos 199101100Ssos u_int32_t donecount; 200103870Salfred} __packed; 201101100Ssos 202101100Ssosstruct i2o_fault_reply { 203101100Ssos u_int8_t version_offset; 204101100Ssos u_int8_t message_flags; 205101100Ssos u_int16_t message_size; 206101100Ssos u_int32_t target_address:12; 207101100Ssos u_int32_t initiator_address:12; 208101100Ssos u_int32_t function:8; 209101100Ssos u_int32_t initiator_context; 210101100Ssos u_int32_t transaction_context; 211101100Ssos u_int8_t lowest_version; 212101100Ssos u_int8_t highest_version; 213101100Ssos u_int8_t severity; 214101100Ssos#define I2O_SEVERITY_FORMAT_ERROR 0x01 215101100Ssos#define I2O_SEVERITY_PATH_ERROR 0x02 216101100Ssos#define I2O_SEVERITY_PATH_STATE 0x04 217101100Ssos#define I2O_SEVERITY_CONGESTION 0x08 218101100Ssos 219101100Ssos u_int8_t failure_code; 220101100Ssos#define I2O_FAILURE_CODE_TRANSPORT_SERVICE_SUSPENDED 0x81 221101100Ssos#define I2O_FAILURE_CODE_TRANSPORT_SERVICE_TERMINATED 0x82 222101100Ssos#define I2O_FAILURE_CODE_TRANSPORT_CONGESTION 0x83 223101100Ssos#define I2O_FAILURE_CODE_TRANSPORT_FAIL 0x84 224101100Ssos#define I2O_FAILURE_CODE_TRANSPORT_STATE_ERROR 0x85 225101100Ssos#define I2O_FAILURE_CODE_TRANSPORT_TIME_OUT 0x86 226101100Ssos#define I2O_FAILURE_CODE_TRANSPORT_ROUTING_FAILURE 0x87 227101100Ssos#define I2O_FAILURE_CODE_TRANSPORT_INVALID_VERSION 0x88 228101100Ssos#define I2O_FAILURE_CODE_TRANSPORT_INVALID_OFFSET 0x89 229101100Ssos#define I2O_FAILURE_CODE_TRANSPORT_INVALID_MSG_FLAGS 0x8A 230101100Ssos#define I2O_FAILURE_CODE_TRANSPORT_FRAME_TOO_SMALL 0x8B 231101100Ssos#define I2O_FAILURE_CODE_TRANSPORT_FRAME_TOO_LARGE 0x8C 232101100Ssos#define I2O_FAILURE_CODE_TRANSPORT_INVALID_TARGET_ID 0x8D 233101100Ssos#define I2O_FAILURE_CODE_TRANSPORT_INVALID_INITIATOR_ID 0x8E 234101100Ssos#define I2O_FAILURE_CODE_TRANSPORT_INVALID_INITIATOR_CONTEXT 0x8F 235101100Ssos#define I2O_FAILURE_CODE_TRANSPORT_UNKNOWN_FAILURE 0xFF 236101100Ssos 237101100Ssos u_int32_t failing_iop_id:12; 238101100Ssos u_int32_t reserved:4; 239101100Ssos u_int32_t failing_host_unit_id:16; 240101100Ssos u_int32_t age_limit; 241101100Ssos u_int64_t preserved_mfa; 242103870Salfred} __packed; 243101100Ssos 244101100Ssosstruct i2o_exec_iop_reset_message { 245101100Ssos u_int8_t version_offset; 246101100Ssos u_int8_t message_flags; 247101100Ssos u_int16_t message_size; 248101100Ssos u_int32_t target_address:12; 249101100Ssos u_int32_t initiator_address:12; 250101100Ssos u_int32_t function:8; 251101100Ssos u_int8_t reserved[16]; 252101100Ssos u_int32_t status_word_low_addr; 253101100Ssos u_int32_t status_word_high_addr; 254103870Salfred} __packed; 255101100Ssos 256101100Ssosstruct i2o_exec_status_get_message { 257101100Ssos u_int8_t version_offset; 258101100Ssos u_int8_t message_flags; 259101100Ssos u_int16_t message_size; 260101100Ssos u_int32_t target_address:12; 261101100Ssos u_int32_t initiator_address:12; 262101100Ssos u_int32_t function:8; 263101100Ssos u_int8_t reserved[16]; 264101100Ssos u_int32_t reply_buf_low_addr; 265101100Ssos u_int32_t reply_buf_high_addr; 266101100Ssos u_int32_t reply_buf_length; 267103870Salfred} __packed; 268101100Ssos 269101100Ssosstruct i2o_status_get_reply { 270101100Ssos u_int16_t organization_id; 271101100Ssos u_int16_t reserved; 272101100Ssos u_int32_t iop_id:12; 273101100Ssos u_int32_t reserved1:4; 274101100Ssos u_int32_t host_unit_id:16; 275101100Ssos u_int32_t segment_number:12; 276101100Ssos u_int32_t i2o_version:4; 277101100Ssos u_int32_t iop_state:8; 278101100Ssos#define I2O_IOP_STATE_INITIALIZING 0x01 279101100Ssos#define I2O_IOP_STATE_RESET 0x02 280101100Ssos#define I2O_IOP_STATE_HOLD 0x04 281101100Ssos#define I2O_IOP_STATE_READY 0x05 282101100Ssos#define I2O_IOP_STATE_OPERATIONAL 0x08 283101100Ssos#define I2O_IOP_STATE_FAILED 0x10 284101100Ssos#define I2O_IOP_STATE_FAULTED 0x11 285101100Ssos 286101100Ssos u_int32_t messenger_type:8; 287101100Ssos u_int16_t inbound_mframe_size; 288101100Ssos u_int8_t init_code; 289101100Ssos u_int8_t reserved2; 290101100Ssos u_int32_t max_inbound_mframes; 291101100Ssos u_int32_t current_ibound_mframes; 292101100Ssos u_int32_t max_outbound_mframes; 293101100Ssos u_int8_t product_idstring[24]; 294101100Ssos u_int32_t expected_lct_size; 295101100Ssos u_int32_t iop_capabilities; 296101100Ssos u_int32_t desired_private_memsize; 297101100Ssos u_int32_t current_private_memsize; 298101100Ssos u_int32_t current_private_membase; 299101100Ssos u_int32_t desired_private_iosize; 300101100Ssos u_int32_t current_private_iosize; 301101100Ssos u_int32_t current_private_iobase; 302101100Ssos u_int8_t reserved3[3]; 303101100Ssos u_int8_t sync_byte; 304103870Salfred} __packed; 305101100Ssos 306101100Ssosstruct i2o_exec_init_outqueue_message { 307101100Ssos u_int8_t version_offset; 308101100Ssos u_int8_t message_flags; 309101100Ssos u_int16_t message_size; 310101100Ssos u_int32_t target_address:12; 311101100Ssos u_int32_t initiator_address:12; 312101100Ssos u_int32_t function:8; 313101100Ssos u_int32_t initiator_context; 314101100Ssos u_int32_t transaction_context; 315101100Ssos u_int32_t host_pagesize; 316101100Ssos u_int8_t init_code; 317101100Ssos u_int8_t reserved; 318101100Ssos u_int16_t queue_framesize; 319101100Ssos struct i2o_sgl sgl[2]; 320103870Salfred} __packed; 321101100Ssos 322101100Ssos#define I2O_EXEC_OUTBOUND_INIT_IN_PROGRESS 0x01 323101100Ssos#define I2O_EXEC_OUTBOUND_INIT_REJECTED 0x02 324101100Ssos#define I2O_EXEC_OUTBOUND_INIT_FAILED 0x03 325101100Ssos#define I2O_EXEC_OUTBOUND_INIT_COMPLETE 0x04 326101100Ssos 327101100Ssosstruct i2o_exec_systab_set_message { 328101100Ssos u_int8_t version_offset; 329101100Ssos u_int8_t message_flags; 330101100Ssos u_int16_t message_size; 331101100Ssos u_int32_t target_address:12; 332101100Ssos u_int32_t initiator_address:12; 333101100Ssos u_int32_t function:8; 334101100Ssos u_int32_t initiator_context; 335101100Ssos u_int32_t transaction_context; 336101100Ssos u_int32_t iop_id:12; 337101100Ssos#define I2O_EXEC_SYS_TAB_IOP_ID_LOCAL_IOP 0x000 338101100Ssos#define I2O_EXEC_SYS_TAB_IOP_ID_LOCAL_HOST 0x001 339101100Ssos#define I2O_EXEC_SYS_TAB_IOP_ID_UNKNOWN_IOP 0xfff 340101100Ssos 341101100Ssos u_int32_t reserved1:4; 342101100Ssos u_int32_t host_unit_id:16; 343101100Ssos#define I2O_EXEC_SYS_TAB_HOST_UNIT_ID_LOCAL_UNIT 0x0000 344101100Ssos#define I2O_EXEC_SYS_TAB_HOST_UNIT_ID_UNKNOWN_UNIT 0xffff 345101100Ssos 346101100Ssos u_int32_t segment_number:12; 347101100Ssos#define I2O_EXEC_SYS_TAB_SEG_NUMBER_LOCAL_SEGMENT 0x000 348101100Ssos#define I2O_EXEC_SYS_TAB_SEG_NUMBER_UNKNOWN_SEGMENT 0xfff 349101100Ssos 350101100Ssos u_int32_t reserved2:4; 351101100Ssos u_int32_t reserved3:8; 352101100Ssos struct i2o_sgl sgl[3]; 353103870Salfred} __packed; 354101100Ssos 355101100Ssosstruct i2o_exec_systab { 356101100Ssos u_int8_t entries; 357101100Ssos u_int8_t version; 358101100Ssos#define I2O_RESOURCE_MANAGER_VERSION 0 359101100Ssos 360101100Ssos u_int16_t reserved1; 361101100Ssos u_int32_t change_id; 362101100Ssos u_int64_t reserved2; 363101100Ssos u_int16_t organization_id; 364101100Ssos u_int16_t reserved3; 365101100Ssos u_int32_t iop_id:12; 366101100Ssos u_int32_t reserved4:20; 367101100Ssos u_int32_t segment_number:12; 368101100Ssos u_int32_t i2o_version:4; 369101100Ssos u_int32_t iop_state:8; 370101100Ssos u_int32_t messenger_type:8; 371101100Ssos u_int16_t inbound_mframe_size; 372101100Ssos u_int16_t reserved5; 373101100Ssos u_int32_t last_changed; 374101100Ssos u_int32_t iop_capabilities; 375101100Ssos u_int64_t messenger_info; 376103870Salfred} __packed; 377101100Ssos 378101100Ssosstruct i2o_exec_get_lct_message { 379101100Ssos u_int8_t version_offset; 380101100Ssos u_int8_t message_flags; 381101100Ssos u_int16_t message_size; 382101100Ssos u_int32_t target_address:12; 383101100Ssos u_int32_t initiator_address:12; 384101100Ssos u_int32_t function:8; 385101100Ssos u_int32_t initiator_context; 386101100Ssos u_int32_t transaction_context; 387101100Ssos u_int32_t class; 388101100Ssos u_int32_t last_change_id; 389101100Ssos struct i2o_sgl sgl; 390103870Salfred} __packed; 391101100Ssos 392101100Ssos#define I2O_TID_IOP 0x000 393101100Ssos#define I2O_TID_HOST 0x001 394101100Ssos#define I2O_TID_NONE 0xfff 395101100Ssos 396101100Ssosstruct i2o_lct_entry { 397101100Ssos u_int32_t entry_size:16; 398101100Ssos u_int32_t local_tid:12; 399101100Ssos u_int32_t reserved:4; 400101100Ssos u_int32_t change_id; 401101100Ssos u_int32_t device_flags; 402101100Ssos u_int32_t class:12; 403101100Ssos#define I2O_CLASS_EXECUTIVE 0x000 404101100Ssos#define I2O_CLASS_DDM 0x001 405101100Ssos#define I2O_CLASS_RANDOM_BLOCK_STORAGE 0x010 406101100Ssos#define I2O_CLASS_SEQUENTIAL_STORAGE 0x011 407101100Ssos#define I2O_CLASS_LAN 0x020 408101100Ssos#define I2O_CLASS_WAN 0x030 409101100Ssos#define I2O_CLASS_FIBRE_CHANNEL_PORT 0x040 410101100Ssos#define I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL 0x041 411101100Ssos#define I2O_CLASS_SCSI_PERIPHERAL 0x051 412101100Ssos#define I2O_CLASS_ATE_PORT 0x060 413101100Ssos#define I2O_CLASS_ATE_PERIPHERAL 0x061 414101100Ssos#define I2O_CLASS_FLOPPY_CONTROLLER 0x070 415101100Ssos#define I2O_CLASS_FLOPPY_DEVICE 0x071 416101100Ssos#define I2O_CLASS_BUS_ADAPTER_PORT 0x080 417101100Ssos#define I2O_CLASS_MATCH_ANYCLASS 0xffffffff 418101100Ssos 419101100Ssos u_int32_t class_version:4; 420101100Ssos u_int32_t class_org:16; 421101100Ssos u_int32_t sub_class; 422101100Ssos#define I2O_SUBCLASS_i960 0x001 423101100Ssos#define I2O_SUBCLASS_HDM 0x020 424101100Ssos#define I2O_SUBCLASS_ISM 0x021 425101100Ssos 426101100Ssos u_int32_t user_tid:12; 427101100Ssos u_int32_t parent_tid:12; 428101100Ssos u_int32_t bios_info:8; 429101100Ssos u_int8_t identity_tag[8]; 430101100Ssos u_int32_t event_capabilities; 431103870Salfred} __packed; 432101100Ssos 433101100Ssos#define I2O_LCT_ENTRYSIZE (sizeof(struct i2o_lct_entry)/sizeof(u_int32_t)) 434101100Ssos 435101100Ssosstruct i2o_get_lct_reply { 436101100Ssos u_int32_t table_size:16; 437101100Ssos u_int32_t boot_device:12; 438101100Ssos u_int32_t lct_version:4; 439101100Ssos u_int32_t iop_flags; 440101100Ssos u_int32_t current_change_id; 441101100Ssos struct i2o_lct_entry entry[1]; 442103870Salfred} __packed; 443101100Ssos 444101100Ssosstruct i2o_util_get_param_message { 445101100Ssos u_int8_t version_offset; 446101100Ssos u_int8_t message_flags; 447101100Ssos u_int16_t message_size; 448101100Ssos u_int32_t target_address:12; 449101100Ssos u_int32_t initiator_address:12; 450101100Ssos u_int32_t function:8; 451101100Ssos u_int32_t initiator_context; 452101100Ssos u_int32_t transaction_context; 453101100Ssos u_int32_t operation_flags; 454101100Ssos struct i2o_sgl sgl[2]; 455103870Salfred} __packed; 456101100Ssos 457101100Ssosstruct i2o_get_param_template { 458101100Ssos u_int16_t operation; 459101100Ssos#define I2O_PARAMS_OPERATION_FIELD_GET 0x0001 460101100Ssos#define I2O_PARAMS_OPERATION_LIST_GET 0x0002 461101100Ssos#define I2O_PARAMS_OPERATION_MORE_GET 0x0003 462101100Ssos#define I2O_PARAMS_OPERATION_SIZE_GET 0x0004 463101100Ssos#define I2O_PARAMS_OPERATION_TABLE_GET 0x0005 464101100Ssos#define I2O_PARAMS_OPERATION_FIELD_SET 0x0006 465101100Ssos#define I2O_PARAMS_OPERATION_LIST_SET 0x0007 466101100Ssos#define I2O_PARAMS_OPERATION_ROW_ADD 0x0008 467101100Ssos#define I2O_PARAMS_OPERATION_ROW_DELETE 0x0009 468101100Ssos#define I2O_PARAMS_OPERATION_TABLE_CLEAR 0x000A 469101100Ssos 470101100Ssos u_int16_t group; 471101100Ssos#define I2O_BSA_DEVICE_INFO_GROUP_NO 0x0000 472101100Ssos#define I2O_BSA_OPERATIONAL_CONTROL_GROUP_NO 0x0001 473101100Ssos#define I2O_BSA_POWER_CONTROL_GROUP_NO 0x0002 474101100Ssos#define I2O_BSA_CACHE_CONTROL_GROUP_NO 0x0003 475101100Ssos#define I2O_BSA_MEDIA_INFO_GROUP_NO 0x0004 476101100Ssos#define I2O_BSA_ERROR_LOG_GROUP_NO 0x0005 477101100Ssos 478101100Ssos#define I2O_UTIL_PARAMS_DESCRIPTOR_GROUP_NO 0xF000 479101100Ssos#define I2O_UTIL_PHYSICAL_DEVICE_TABLE_GROUP_NO 0xF001 480101100Ssos#define I2O_UTIL_CLAIMED_TABLE_GROUP_NO 0xF002 481101100Ssos#define I2O_UTIL_USER_TABLE_GROUP_NO 0xF003 482101100Ssos#define I2O_UTIL_PRIVATE_MESSAGE_EXTENSIONS_GROUP_NO 0xF005 483101100Ssos#define I2O_UTIL_AUTHORIZED_USER_TABLE_GROUP_NO 0xF006 484101100Ssos#define I2O_UTIL_DEVICE_IDENTITY_GROUP_NO 0xF100 485101100Ssos#define I2O_UTIL_DDM_IDENTITY_GROUP_NO 0xF101 486101100Ssos#define I2O_UTIL_USER_INFORMATION_GROUP_NO 0xF102 487101100Ssos#define I2O_UTIL_SGL_OPERATING_LIMITS_GROUP_NO 0xF103 488101100Ssos#define I2O_UTIL_SENSORS_GROUP_NO 0xF200 489101100Ssos 490101100Ssos u_int16_t field_count; 491101100Ssos u_int16_t pad; 492103870Salfred} __packed; 493101100Ssos 494101100Ssosstruct i2o_get_param_operation { 495101100Ssos u_int16_t operation_count; 496101100Ssos u_int16_t reserved; 497101100Ssos struct i2o_get_param_template operation[1]; 498103870Salfred} __packed; 499101100Ssos 500101100Ssosstruct i2o_get_param_reply { 501101100Ssos u_int16_t result_count;; 502101100Ssos u_int16_t reserved; 503101100Ssos u_int16_t block_size; 504101100Ssos u_int8_t block_status; 505101100Ssos u_int8_t error_info_size; 506101100Ssos u_int32_t result[1]; 507103870Salfred} __packed; 508101100Ssos 509101100Ssosstruct i2o_device_identity { 510101100Ssos u_int32_t class; 511101100Ssos u_int16_t owner; 512101100Ssos u_int16_t parent; 513101100Ssos u_int8_t vendor[16]; 514101100Ssos u_int8_t product[16]; 515101100Ssos u_int8_t description[16]; 516101100Ssos u_int8_t revision[8]; 517101100Ssos u_int8_t sn_format; 518101100Ssos u_int8_t serial[256]; 519103870Salfred} __packed; 520101100Ssos 521101100Ssosstruct i2o_bsa_device { 522101100Ssos u_int8_t device_type; 523101100Ssos u_int8_t path_count; 524101100Ssos u_int16_t power_state; 525101100Ssos u_int32_t block_size; 526101100Ssos u_int64_t capacity; 527101100Ssos u_int32_t capabilities; 528101100Ssos u_int32_t state; 529103870Salfred} __packed; 530101100Ssos 531101100Ssosstruct i2o_util_claim_message { 532101100Ssos u_int8_t version_offset; 533101100Ssos u_int8_t message_flags; 534101100Ssos u_int16_t message_size; 535101100Ssos u_int32_t target_address:12; 536101100Ssos u_int32_t initiator_address:12; 537101100Ssos u_int32_t function:8; 538101100Ssos u_int32_t initiator_context; 539101100Ssos u_int32_t transaction_context; 540101100Ssos u_int16_t claim_flags; 541101100Ssos u_int8_t reserved; 542101100Ssos u_int8_t claim_type; 543103870Salfred} __packed; 544101100Ssos 545101100Ssosstruct i2o_util_event_register_message { 546101100Ssos u_int8_t version_offset; 547101100Ssos u_int8_t message_flags; 548101100Ssos u_int16_t message_size; 549101100Ssos u_int32_t target_address:12; 550101100Ssos u_int32_t initiator_address:12; 551101100Ssos u_int32_t function:8; 552101100Ssos u_int32_t initiator_context; 553101100Ssos u_int32_t transaction_context; 554101100Ssos u_int32_t event_mask; 555103870Salfred} __packed; 556101100Ssos 557101100Ssosstruct i2o_util_event_reply_message { 558101100Ssos u_int8_t version_offset; 559101100Ssos u_int8_t message_flags; 560101100Ssos u_int16_t message_size; 561101100Ssos u_int32_t target_address:12; 562101100Ssos u_int32_t initiator_address:12; 563101100Ssos u_int32_t function:8; 564101100Ssos u_int32_t initiator_context; 565101100Ssos u_int32_t transaction_context; 566101100Ssos u_int32_t event_mask; 567101100Ssos u_int32_t event_data[1]; 568103870Salfred} __packed; 569101100Ssos 570101100Ssosstruct i2o_util_config_dialog_message { 571101100Ssos u_int8_t version_offset; 572101100Ssos u_int8_t message_flags; 573101100Ssos u_int16_t message_size; 574101100Ssos u_int32_t target_address:12; 575101100Ssos u_int32_t initiator_address:12; 576101100Ssos u_int32_t function:8; 577101100Ssos u_int32_t initiator_context; 578101100Ssos u_int32_t transaction_context; 579101100Ssos u_int32_t page_number; 580101100Ssos struct i2o_sgl sgl[2]; 581103870Salfred} __packed; 582101100Ssos 583101100Ssosstruct i2o_bsa_rw_block_message { 584101100Ssos u_int8_t version_offset; 585101100Ssos u_int8_t message_flags; 586101100Ssos u_int16_t message_size; 587101100Ssos u_int32_t target_address:12; 588101100Ssos u_int32_t initiator_address:12; 589101100Ssos u_int32_t function:8; 590101100Ssos u_int32_t initiator_context; 591101100Ssos u_int32_t transaction_context; 592101100Ssos u_int16_t control_flags; 593101100Ssos u_int8_t time_multiplier; 594101100Ssos u_int8_t fetch_ahead; 595101100Ssos u_int32_t bytecount; 596101100Ssos u_int64_t lba; 597101100Ssos struct i2o_sgl sgl; 598103870Salfred} __packed; 599101100Ssos 600101100Ssosstruct i2o_bsa_cache_flush_message { 601101100Ssos u_int8_t version_offset; 602101100Ssos u_int8_t message_flags; 603101100Ssos u_int16_t message_size; 604101100Ssos u_int32_t target_address:12; 605101100Ssos u_int32_t initiator_address:12; 606101100Ssos u_int32_t function:8; 607101100Ssos u_int32_t initiator_context; 608101100Ssos u_int32_t transaction_context; 609101100Ssos u_int16_t control_flags; 610101100Ssos u_int8_t time_multiplier; 611101100Ssos u_int8_t reserved; 612103870Salfred} __packed; 613101100Ssos 614101100Ssos/* prototypes */ 615101100Ssosint iop_init(struct iop_softc *); 616101100Ssosvoid iop_attach(struct iop_softc *); 617101100Ssosvoid iop_intr(void *); 618101100Ssosint iop_reset(struct iop_softc *); 619101100Ssosint iop_init_outqueue(struct iop_softc *); 620101100Ssosint iop_get_lct(struct iop_softc *); 621101100Ssosstruct i2o_get_param_reply *iop_get_util_params(struct iop_softc *,int,int,int); 622101100Ssosu_int32_t iop_get_mfa(struct iop_softc *); 623101100Ssosvoid iop_free_mfa(struct iop_softc *, int); 624101100Ssosint iop_queue_wait_msg(struct iop_softc *, int, struct i2o_basic_message *); 625101100Ssosint iop_create_sgl(struct i2o_basic_message *, caddr_t, int, int); 626101100Ssos 627101100Ssos/* global prototypes */ 628101100Ssosint pst_add_raid(struct iop_softc *, struct i2o_lct_entry *); 629