diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2013-11-04 14:07:17 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2013-11-04 14:07:17 +0000 |
commit | 00085f61a4aa40196fa3d6688d34cfbe25c235a9 (patch) | |
tree | caf982d5f425ed6d82671c82e4060050029f9814 /sys/dev | |
parent | bc5c88ea41636668a7bea1a31e36afd2e87322fb (diff) |
remove iop(4) driver. it is entirely unmaintained and supports something
which basically doesn't exist at all.
reminded about it by brad
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/i2o/files.i2o | 14 | ||||
-rw-r--r-- | sys/dev/i2o/i2o.h | 1230 | ||||
-rw-r--r-- | sys/dev/i2o/iop.c | 2475 | ||||
-rw-r--r-- | sys/dev/i2o/iopio.h | 72 | ||||
-rw-r--r-- | sys/dev/i2o/ioprbs.c | 853 | ||||
-rw-r--r-- | sys/dev/i2o/ioprbsvar.h | 90 | ||||
-rw-r--r-- | sys/dev/i2o/iopreg.h | 44 | ||||
-rw-r--r-- | sys/dev/i2o/iopsp.c | 629 | ||||
-rw-r--r-- | sys/dev/i2o/iopspvar.h | 67 | ||||
-rw-r--r-- | sys/dev/i2o/iopvar.h | 190 | ||||
-rw-r--r-- | sys/dev/pci/files.pci | 6 | ||||
-rw-r--r-- | sys/dev/pci/iop_pci.c | 171 |
12 files changed, 1 insertions, 5840 deletions
diff --git a/sys/dev/i2o/files.i2o b/sys/dev/i2o/files.i2o deleted file mode 100644 index 2f734b83d1b..00000000000 --- a/sys/dev/i2o/files.i2o +++ /dev/null @@ -1,14 +0,0 @@ -# $OpenBSD: files.i2o,v 1.8 2011/06/29 19:48:21 matthew Exp $ - -device iop {[tid = -1]} -file dev/i2o/iop.c iop & iop_pci needs-flag - -# SCSI peripheral -device iopsp: scsi -attach iopsp at iop -file dev/i2o/iopsp.c iopsp - -# Random block storage -device ioprbs: scsi -attach ioprbs at iop -file dev/i2o/ioprbs.c ioprbs diff --git a/sys/dev/i2o/i2o.h b/sys/dev/i2o/i2o.h deleted file mode 100644 index 81d7cb2ab62..00000000000 --- a/sys/dev/i2o/i2o.h +++ /dev/null @@ -1,1230 +0,0 @@ -/* $OpenBSD: i2o.h,v 1.9 2008/06/26 05:42:14 ray Exp $ */ -/* $NetBSD: i2o.h,v 1.3 2001/03/20 13:01:48 ad Exp $ */ - -/*- - * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Andrew Doran. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Structures and constants, as presented by the I2O specification revision - * 1.5 (obtainable from http://www.intelligent-io.com/). Currently, only - * what's useful to us is defined in this file. - */ - -#ifndef _I2O_I2O_H_ -#define _I2O_I2O_H_ - -/* - * ================= Miscellaneous definitions ================= - */ - -/* Organisation IDs */ -#define I2O_ORG_DPT 0x001b -#define I2O_ORG_INTEL 0x0028 -#define I2O_ORG_AMI 0x1000 - -/* Macros to assist in building message headers */ -#define I2O_MSGFLAGS(s) (I2O_VERSION_11 | (sizeof(struct s) << 14)) -#define I2O_MSGFUNC(t, f) ((t) | (I2O_TID_HOST << 12) | ((f) << 24)) - -/* Common message function codes with no payload or an undefined payload */ -#define I2O_UTIL_NOP 0x00 -#define I2O_EXEC_IOP_CLEAR 0xbe -#define I2O_EXEC_SYS_QUIESCE 0xc3 -#define I2O_EXEC_SYS_ENABLE 0xd1 -#define I2O_PRIVATE_MESSAGE 0xff - -/* Device class codes */ -#define I2O_CLASS_EXECUTIVE 0x00 -#define I2O_CLASS_DDM 0x01 -#define I2O_CLASS_RANDOM_BLOCK_STORAGE 0x10 -#define I2O_CLASS_SEQUENTIAL_STORAGE 0x11 -#define I2O_CLASS_LAN 0x20 -#define I2O_CLASS_WAN 0x30 -#define I2O_CLASS_FIBRE_CHANNEL_PORT 0x40 -#define I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL 0x41 -#define I2O_CLASS_SCSI_PERIPHERAL 0x51 -#define I2O_CLASS_ATE_PORT 0x60 -#define I2O_CLASS_ATE_PERIPHERAL 0x61 -#define I2O_CLASS_FLOPPY_CONTROLLER 0x70 -#define I2O_CLASS_FLOPPY_DEVICE 0x71 -#define I2O_CLASS_BUS_ADAPTER_PORT 0x80 -#define I2O_CLASS_MASK 0xfff - -#define I2O_CLASS_ANY 0xffffffff - -/* Reply status codes */ -#define I2O_STATUS_SUCCESS 0x00 -#define I2O_STATUS_ABORT_DIRTY 0x01 -#define I2O_STATUS_ABORT_NO_DATA_XFER 0x02 -#define I2O_STATUS_ABORT_PARTIAL_XFER 0x03 -#define I2O_STATUS_ERROR_DIRTY 0x04 -#define I2O_STATUS_ERROR_NO_DATA_XFER 0x05 -#define I2O_STATUS_ERROR_PARTIAL_XFER 0x06 -#define I2O_STATUS_PROCESS_ABORT_DIRTY 0x08 -#define I2O_STATUS_PROCESS_ABORT_NO_DATA_XFER 0x09 -#define I2O_STATUS_PROCESS_ABORT_PARTIAL_XFER 0x0a -#define I2O_STATUS_TRANSACTION_ERROR 0x0b -#define I2O_STATUS_PROGRESS_REPORT 0x80 - -/* Detailed status codes */ -#define I2O_DSC_SUCCESS 0x00 -#define I2O_DSC_BAD_KEY 0x02 -#define I2O_DSC_TCL_ERROR 0x03 -#define I2O_DSC_REPLY_BUFFER_FULL 0x04 -#define I2O_DSC_NO_SUCH_PAGE 0x05 -#define I2O_DSC_INSUFFICIENT_RESOURCE_SOFT 0x06 -#define I2O_DSC_INSUFFICIENT_RESOURCE_HARD 0x07 -#define I2O_DSC_CHAIN_BUFFER_TOO_LARGE 0x09 -#define I2O_DSC_UNSUPPORTED_FUNCTION 0x0a -#define I2O_DSC_DEVICE_LOCKED 0x0b -#define I2O_DSC_DEVICE_RESET 0x0c -#define I2O_DSC_INAPPROPRIATE_FUNCTION 0x0d -#define I2O_DSC_INVALID_INITIATOR_ADDRESS 0x0e -#define I2O_DSC_INVALID_MESSAGE_FLAGS 0x0f -#define I2O_DSC_INVALID_OFFSET 0x10 -#define I2O_DSC_INVALID_PARAMETER 0x11 -#define I2O_DSC_INVALID_REQUEST 0x12 -#define I2O_DSC_INVALID_TARGET_ADDRESS 0x13 -#define I2O_DSC_MESSAGE_TOO_LARGE 0x14 -#define I2O_DSC_MESSAGE_TOO_SMALL 0x15 -#define I2O_DSC_MISSING_PARAMETER 0x16 -#define I2O_DSC_TIMEOUT 0x17 -#define I2O_DSC_UNKNOWN_ERROR 0x18 -#define I2O_DSC_UNKNOWN_FUNCTION 0x19 -#define I2O_DSC_UNSUPPORTED_VERSION 0x1a -#define I2O_DSC_DEVICE_BUSY 0x1b -#define I2O_DSC_DEVICE_NOT_AVAILABLE 0x1c - -/* Message versions */ -#define I2O_VERSION_10 0x00 -#define I2O_VERSION_11 0x01 -#define I2O_VERSION_20 0x02 - -/* Commonly used TIDs */ -#define I2O_TID_IOP 0 -#define I2O_TID_HOST 1 -#define I2O_TID_NONE 4095 - -/* SGL flags. This list covers only a fraction of the possibilities. */ -#define I2O_SGL_IGNORE 0x00000000 -#define I2O_SGL_SIMPLE 0x10000000 -#define I2O_SGL_PAGE_LIST 0x20000000 - -#define I2O_SGL_BC_32BIT 0x01000000 -#define I2O_SGL_BC_64BIT 0x02000000 -#define I2O_SGL_BC_96BIT 0x03000000 -#define I2O_SGL_DATA_OUT 0x04000000 -#define I2O_SGL_END_BUFFER 0x40000000 -#define I2O_SGL_END 0x80000000 - -/* Serial number formats */ -#define I2O_SNFMT_UNKNOWN 0 -#define I2O_SNFMT_BINARY 1 -#define I2O_SNFMT_ASCII 2 -#define I2O_SNFMT_UNICODE 3 -#define I2O_SNFMT_LAN_MAC 4 -#define I2O_SNFMT_WAN_MAC 5 - -/* - * ================= Common structures ================= - */ - -/* - * Standard I2O message frame. All message frames begin with this. - * - * Bits Field Meaning - * ---- ------------- ---------------------------------------------------- - * 0-2 msgflags Message header version. Must be 001 (little endian). - * 3 msgflags Reserved. - * 4-7 msgflags Offset to SGLs expressed as # of 32-bit words. - * 8-15 msgflags Control flags. - * 16-31 msgflags Message frame size expressed as # of 32-bit words. - * 0-11 msgfunc TID of target. - * 12-23 msgfunc TID of initiator. - * 24-31 msgfunc Function (i.e., type of message). - */ -struct i2o_msg { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; /* Initiator context */ - u_int32_t msgtctx; /* Transaction context */ - - /* Message payload */ - -} __packed; - -#define I2O_MSGFLAGS_STATICMF 0x0100 -#define I2O_MSGFLAGS_64BIT 0x0200 -#define I2O_MSGFLAGS_MULTI 0x1000 -#define I2O_MSGFLAGS_FAIL 0x2000 -#define I2O_MSGFLAGS_LAST_REPLY 0x4000 -#define I2O_MSGFLAGS_REPLY 0x8000 - -/* - * Standard reply frame. msgflags, msgfunc, msgictx and msgtctx have the - * same meaning as in `struct i2o_msg'. - */ -struct i2o_reply { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; - u_int16_t detail; /* Detailed status code */ - u_int8_t reserved; - u_int8_t reqstatus; /* Request status code */ - - /* Reply payload */ - -} __packed; - -/* - * Fault notification reply, returned when a message frame can not be - * processed (i.e I2O_MSGFLAGS_FAIL is set in the reply). - */ -struct i2o_fault_notify { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; /* Not valid! */ - u_int8_t lowestver; - u_int8_t highestver; - u_int8_t severity; - u_int8_t failurecode; - u_int16_t failingiop; /* Bits 0-12 only */ - u_int16_t failinghostunit; - u_int32_t agelimit; - u_int32_t lowmfa; - u_int32_t highmfa; -}; - -/* - * Hardware resource table. Not documented here. - */ -struct i2o_hrt_entry { - u_int32_t adapterid; - u_int16_t controllingtid; - u_int8_t busnumber; - u_int8_t bustype; - u_int8_t businfo[8]; -} __packed; - -struct i2o_hrt { - u_int16_t numentries; - u_int8_t entrysize; - u_int8_t hrtversion; - u_int32_t changeindicator; - struct i2o_hrt_entry entry[1]; -} __packed; - -/* - * Logical configuration table entry. Bitfields are broken down as follows: - * - * Bits Field Meaning - * ----- -------------- --------------------------------------------------- - * 0-11 classid Class ID. - * 12-15 classid Class version. - * 0-11 usertid User TID - * 12-23 usertid Parent TID. - * 24-31 usertid BIOS info. - */ -struct i2o_lct_entry { - u_int16_t entrysize; - u_int16_t localtid; /* Bits 0-12 only */ -#define I2O_LCT_ENTRY_TID_MASK 0xfff - u_int32_t changeindicator; - u_int32_t deviceflags; - u_int16_t classid; - u_int16_t orgid; - u_int32_t subclassinfo; - u_int32_t usertid; - u_int8_t identitytag[8]; - u_int32_t eventcaps; -} __packed; - -/* - * Logical configuration table header. - */ -struct i2o_lct { - u_int16_t tablesize; - u_int16_t flags; - u_int32_t iopflags; - u_int32_t changeindicator; - struct i2o_lct_entry entry[1]; -} __packed; - -/* - * IOP system table. Bitfields are broken down as follows: - * - * Bits Field Meaning - * ----- -------------- --------------------------------------------------- - * 0-11 iopid IOP ID. - * 12-31 iopid Reserved. - * 0-11 segnumber Segment number. - * 12-15 segnumber I2O version. - * 16-23 segnumber IOP state. - * 24-31 segnumber Messenger type. - */ -struct i2o_systab_entry { - u_int16_t orgid; - u_int16_t reserved0; - u_int32_t iopid; - u_int32_t segnumber; - u_int16_t inboundmsgframesize; - u_int16_t reserved1; - u_int32_t lastchanged; - u_int32_t iopcaps; - u_int32_t inboundmsgportaddresslow; - u_int32_t inboundmsgportaddresshigh; -} __packed; - -struct i2o_systab { - u_int8_t numentries; - u_int8_t version; - u_int16_t reserved0; - u_int32_t changeindicator; - u_int32_t reserved1[2]; - struct i2o_systab_entry entry[1]; -} __packed; - -/* - * IOP status record. Bitfields are broken down as follows: - * - * Bits Field Meaning - * ----- -------------- --------------------------------------------------- - * 0-11 iopid IOP ID. - * 12-15 iopid Reserved. - * 16-31 iopid Host unit ID. - * 0-11 segnumber Segment number. - * 12-15 segnumber I2O version. - * 16-23 segnumber IOP state. - * 24-31 segnumber Messenger type. - */ -struct i2o_status { - u_int16_t orgid; - u_int16_t reserved0; - u_int32_t iopid; - u_int32_t segnumber; - u_int16_t inboundmframesize; - u_int8_t initcode; - u_int8_t reserved1; - u_int32_t maxinboundmframes; - u_int32_t currentinboundmframes; - u_int32_t maxoutboundmframes; - u_int8_t productid[24]; - u_int32_t expectedlctsize; - u_int32_t iopcaps; - u_int32_t desiredprivmemsize; - u_int32_t currentprivmemsize; - u_int32_t currentprivmembase; - u_int32_t desiredpriviosize; - u_int32_t currentpriviosize; - u_int32_t currentpriviobase; - u_int8_t reserved2[3]; - u_int8_t syncbyte; -} __packed; - -#define I2O_IOP_STATE_INITIALIZING 0x01 -#define I2O_IOP_STATE_RESET 0x02 -#define I2O_IOP_STATE_HOLD 0x04 -#define I2O_IOP_STATE_READY 0x05 -#define I2O_IOP_STATE_OPERATIONAL 0x08 -#define I2O_IOP_STATE_FAILED 0x10 -#define I2O_IOP_STATE_FAULTED 0x11 - -/* - * ================= Executive class messages ================= - */ - -#define I2O_EXEC_STATUS_GET 0xa0 -struct i2o_exec_status_get { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t reserved[4]; - u_int32_t addrlow; - u_int32_t addrhigh; - u_int32_t length; -} __packed; - -#define I2O_EXEC_OUTBOUND_INIT 0xa1 -struct i2o_exec_outbound_init { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; - u_int32_t pagesize; - u_int32_t flags; /* init code, outbound msg size */ -} __packed; - -#define I2O_EXEC_OUTBOUND_INIT_IN_PROGRESS 1 -#define I2O_EXEC_OUTBOUND_INIT_REJECTED 2 -#define I2O_EXEC_OUTBOUND_INIT_FAILED 3 -#define I2O_EXEC_OUTBOUND_INIT_COMPLETE 4 - -#define I2O_EXEC_LCT_NOTIFY 0xa2 -struct i2o_exec_lct_notify { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; - u_int32_t classid; - u_int32_t changeindicator; -} __packed; - -#define I2O_EXEC_SYS_TAB_SET 0xa3 -struct i2o_exec_sys_tab_set { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; - u_int32_t iopid; - u_int32_t segnumber; -} __packed; - -#define I2O_EXEC_HRT_GET 0xa8 -struct i2o_exec_hrt_get { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; -} __packed; - -#define I2O_EXEC_IOP_RESET 0xbd -struct i2o_exec_iop_reset { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t reserved[4]; - u_int32_t statuslow; - u_int32_t statushigh; -} __packed; - -#define I2O_RESET_IN_PROGRESS 0x01 -#define I2O_RESET_REJECTED 0x02 - -/* - * ================= Executive class parameter groups ================= - */ - -#define I2O_PARAM_EXEC_LCT_SCALAR 0x0101 -#define I2O_PARAM_EXEC_LCT_TABLE 0x0102 - -/* - * ================= HBA class messages ================= - */ - -#define I2O_HBA_BUS_SCAN 0x89 -struct i2o_hba_bus_scan { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; -} __packed; - -/* - * ================= HBA class parameter groups ================= - */ - -#define I2O_PARAM_HBA_CTLR_INFO 0x0000 -struct i2o_param_hba_ctlr_info { - u_int8_t bustype; - u_int8_t busstate; - u_int16_t reserved; - u_int8_t busname[12]; -} __packed; - -#define I2O_HBA_BUS_GENERIC 0x00 -#define I2O_HBA_BUS_SCSI 0x01 -#define I2O_HBA_BUS_FCA 0x10 - -#define I2O_PARAM_HBA_SCSI_PORT_INFO 0x0001 -struct i2o_param_hba_scsi_port_info { - u_int8_t physicalif; -#define I2O_PARAM_HBA_SCSI_PORT_GENERIC 0x01 -#define I2O_PARAM_HBA_SCSI_PORT_UNKNOWN 0x02 -#define I2O_PARAM_HBA_SCSI_PORT_PARINTF 0x03 -#define I2O_PARAM_HBA_SCSI_PORT_FCL 0x04 -#define I2O_PARAM_HBA_SCSI_PORT_1394 0x05 -#define I2O_PARAM_HBA_SCSI_PORT_SSA 0x06 - u_int8_t electricalif; -#define I2O_PARAM_HBA_SCSI_PORT_SE 0x03 -#define I2O_PARAM_HBA_SCSI_PORT_DIFF 0x04 -#define I2O_PARAM_HBA_SCSI_PORT_LVD 0x05 -#define I2O_PARAM_HBA_SCSI_PORT_OPTCL 0x06 - u_int8_t isosynchonrous; - u_int8_t connectortype; -#define I2O_PARAM_HBA_SCSI_PORT_HDBS50 0x04 -#define I2O_PARAM_HBA_SCSI_PORT_HDBU50 0x05 -#define I2O_PARAM_HBA_SCSI_PORT_DBS50 0x06 -#define I2O_PARAM_HBA_SCSI_PORT_DBU50 0x07 -#define I2O_PARAM_HBA_SCSI_PORT_HDBS68 0x08 -#define I2O_PARAM_HBA_SCSI_PORT_HDBU68 0x09 -#define I2O_PARAM_HBA_SCSI_PORT_SCA1 0x0a -#define I2O_PARAM_HBA_SCSI_PORT_SCA2 0x0b -#define I2O_PARAM_HBA_SCSI_PORT_FCDB9 0x0c -#define I2O_PARAM_HBA_SCSI_PORT_FC 0x0d -#define I2O_PARAM_HBA_SCSI_PORT_FCSCA40 0x0e -#define I2O_PARAM_HBA_SCSI_PORT_FCSCA20 0x0f -#define I2O_PARAM_HBA_SCSI_PORT_FCBNC 0x10 - u_int8_t connectorgender; -#define I2O_PARAM_HBA_SCSI_PORT_FEMALE 0x03 -#define I2O_PARAM_HBA_SCSI_PORT_MALE 0x04 - u_int8_t reserved1; - u_int16_t reserved2; - u_int32_t maxnumberofdevices; -} __packed; - -#define I2O_PARAM_HBA_SCSI_CTLR_INFO 0x0200 -struct i2o_param_hba_scsi_ctlr_info { - u_int8_t scsitype; -#define I2O_PARAM_HBA_SCSI_CTRL_SCSI0 0x00 -#define I2O_PARAM_HBA_SCSI_CTRL_SCSI1 0x01 -#define I2O_PARAM_HBA_SCSI_CTRL_SCSI2 0x02 -#define I2O_PARAM_HBA_SCSI_CTRL_SCSI3 0x03 - u_int8_t protection; - u_int8_t settings; - u_int8_t reserved; - u_int32_t initiatorid; - u_int64_t scanlun0only; - u_int16_t disabledevice; - u_int8_t maxoffset; - u_int8_t maxdatawidth; - u_int64_t maxsyncrate; -} __packed; - - -/* - * ================= Utility messages ================= - */ - -#define I2O_UTIL_ABORT 0x01 -struct i2o_util_abort { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; - u_int32_t flags; /* abort type and function type */ - u_int32_t tctxabort; -} __packed; - -#define I2O_UTIL_ABORT_EXACT 0x00000000 -#define I2O_UTIL_ABORT_FUNCTION 0x00010000 -#define I2O_UTIL_ABORT_TRANSACTION 0x00020000 -#define I2O_UTIL_ABORT_WILD 0x00030000 - -#define I2O_UTIL_ABORT_CLEAN 0x00040000 - -struct i2o_util_abort_reply { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; - u_int32_t count; -} __packed; - -#define I2O_UTIL_PARAMS_SET 0x05 -#define I2O_UTIL_PARAMS_GET 0x06 -struct i2o_util_params_op { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; - u_int32_t flags; -} __packed; - -#define I2O_PARAMS_OP_FIELD_GET 1 -#define I2O_PARAMS_OP_LIST_GET 2 -#define I2O_PARAMS_OP_MORE_GET 3 -#define I2O_PARAMS_OP_SIZE_GET 4 -#define I2O_PARAMS_OP_TABLE_GET 5 -#define I2O_PARAMS_OP_FIELD_SET 6 -#define I2O_PARAMS_OP_LIST_SET 7 -#define I2O_PARAMS_OP_ROW_ADD 8 -#define I2O_PARAMS_OP_ROW_DELETE 9 -#define I2O_PARAMS_OP_TABLE_CLEAR 10 - -struct i2o_param_op_list_header { - u_int16_t count; - u_int16_t reserved; -} __packed; - -struct i2o_param_op_all_template { - u_int16_t operation; - u_int16_t group; - u_int16_t fieldcount; - u_int16_t fields[1]; -} __packed; - -struct i2o_param_op_results { - u_int16_t count; - u_int16_t reserved; -} __packed; - -struct i2o_param_read_results { - u_int16_t blocksize; - u_int8_t blockstatus; - u_int8_t errorinfosize; -} __packed; - -struct i2o_param_table_results { - u_int16_t blocksize; - u_int8_t blockstatus; - u_int8_t errorinfosize; - u_int16_t rowcount; - u_int16_t moreflag; -} __packed; - -#define I2O_UTIL_CLAIM 0x09 -struct i2o_util_claim { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; - u_int32_t flags; -} __packed; - -#define I2O_UTIL_CLAIM_RESET_SENSITIVE 0x00000002 -#define I2O_UTIL_CLAIM_STATE_SENSITIVE 0x00000004 -#define I2O_UTIL_CLAIM_CAPACITY_SENSITIVE 0x00000008 -#define I2O_UTIL_CLAIM_NO_PEER_SERVICE 0x00000010 -#define I2O_UTIL_CLAIM_NO_MANAGEMENT_SERVICE 0x00000020 - -#define I2O_UTIL_CLAIM_PRIMARY_USER 0x01000000 -#define I2O_UTIL_CLAIM_AUTHORIZED_USER 0x02000000 -#define I2O_UTIL_CLAIM_SECONDARY_USER 0x03000000 -#define I2O_UTIL_CLAIM_MANAGEMENT_USER 0x04000000 - -#define I2O_UTIL_CLAIM_RELEASE 0x0b -struct i2o_util_claim_release { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; - u_int32_t flags; /* User flags as per I2O_UTIL_CLAIM */ -} __packed; - -#define I2O_UTIL_CLAIM_RELEASE_CONDITIONAL 0x00000001 - -#define I2O_UTIL_CONFIG_DIALOG 0x10 -struct i2o_util_config_dialog { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; - u_int32_t pageno; -} __packed; - -#define I2O_UTIL_EVENT_REGISTER 0x13 -struct i2o_util_event_register { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; - u_int32_t eventmask; -} __packed; - -struct i2o_util_event_register_reply { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; - u_int32_t event; - u_int32_t eventdata[1]; -} __packed; - -/* Generic events. */ -#define I2O_EVENT_GEN_DEVICE_STATE 0x00400000 -#define I2O_EVENT_GEN_VENDOR_EVENT 0x00800000 -#define I2O_EVENT_GEN_FIELD_MODIFIED 0x01000000 -#define I2O_EVENT_GEN_EVENT_MASK_MODIFIED 0x02000000 -#define I2O_EVENT_GEN_DEVICE_RESET 0x04000000 -#define I2O_EVENT_GEN_CAPABILITY_CHANGE 0x08000000 -#define I2O_EVENT_GEN_LOCK_RELEASE 0x10000000 -#define I2O_EVENT_GEN_NEED_CONFIGURATION 0x20000000 -#define I2O_EVENT_GEN_GENERAL_WARNING 0x40000000 -#define I2O_EVENT_GEN_STATE_CHANGE 0x80000000 - -/* Executive class events. */ -#define I2O_EVENT_EXEC_RESOURCE_LIMITS 0x00000001 -#define I2O_EVENT_EXEC_CONNECTION_FAIL 0x00000002 -#define I2O_EVENT_EXEC_ADAPTER_FAULT 0x00000004 -#define I2O_EVENT_EXEC_POWER_FAIL 0x00000008 -#define I2O_EVENT_EXEC_RESET_PENDING 0x00000010 -#define I2O_EVENT_EXEC_RESET_IMMINENT 0x00000020 -#define I2O_EVENT_EXEC_HARDWARE_FAIL 0x00000040 -#define I2O_EVENT_EXEC_XCT_CHANGE 0x00000080 -#define I2O_EVENT_EXEC_NEW_LCT_ENTRY 0x00000100 -#define I2O_EVENT_EXEC_MODIFIED_LCT 0x00000200 -#define I2O_EVENT_EXEC_DDM_AVAILIBILITY 0x00000400 - -/* LAN class events. */ -#define I2O_EVENT_LAN_LINK_DOWN 0x00000001 -#define I2O_EVENT_LAN_LINK_UP 0x00000002 -#define I2O_EVENT_LAN_MEDIA_CHANGE 0x00000004 - -/* - * ================= Utility parameter groups ================= - */ - -#define I2O_PARAM_DEVICE_IDENTITY 0xf100 -struct i2o_param_device_identity { - u_int32_t classid; - u_int16_t ownertid; - u_int16_t parenttid; - u_int8_t vendorinfo[16]; - u_int8_t productinfo[16]; - u_int8_t description[16]; - u_int8_t revlevel[8]; - u_int8_t snformat; - u_int8_t serialnumber[1]; -} __packed; - -#define I2O_PARAM_DDM_IDENTITY 0xf101 -struct i2o_param_ddm_identity { - u_int16_t ddmtid; - u_int8_t name[24]; - u_int8_t revlevel[8]; - u_int8_t snformat; - u_int8_t serialnumber[12]; -} __packed; - -/* - * ================= Block storage class messages ================= - */ - -#define I2O_RBS_BLOCK_READ 0x30 -struct i2o_rbs_block_read { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; - u_int32_t flags; /* flags, time multipler, read ahead */ - u_int32_t datasize; - u_int32_t lowoffset; - u_int32_t highoffset; -} __packed; - -#define I2O_RBS_BLOCK_READ_NO_RETRY 0x01 -#define I2O_RBS_BLOCK_READ_SOLO 0x02 -#define I2O_RBS_BLOCK_READ_CACHE_READ 0x04 -#define I2O_RBS_BLOCK_READ_PREFETCH 0x08 -#define I2O_RBS_BLOCK_READ_CACHE_ONLY 0x10 - -#define I2O_RBS_BLOCK_WRITE 0x31 -struct i2o_rbs_block_write { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; - u_int32_t flags; /* flags, time multipler */ - u_int32_t datasize; - u_int32_t lowoffset; - u_int32_t highoffset; -} __packed; - -#define I2O_RBS_BLOCK_WRITE_NO_RETRY 0x01 -#define I2O_RBS_BLOCK_WRITE_SOLO 0x02 -#define I2O_RBS_BLOCK_WRITE_CACHE_NONE 0x04 -#define I2O_RBS_BLOCK_WRITE_CACHE_WT 0x08 -#define I2O_RBS_BLOCK_WRITE_CACHE_WB 0x10 - -#define I2O_RBS_CACHE_FLUSH 0x37 -struct i2o_rbs_cache_flush { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; - u_int32_t flags; /* flags, time multipler */ -} __packed; - -#define I2O_RBS_MEDIA_MOUNT 0x41 -struct i2o_rbs_media_mount { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; - u_int32_t mediaid; - u_int32_t loadflags; -} __packed; - -#define I2O_RBS_MEDIA_EJECT 0x43 -struct i2o_rbs_media_eject { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; - u_int32_t mediaid; -} __packed; - -#define I2O_RBS_MEDIA_LOCK 0x49 -struct i2o_rbs_media_lock { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; - u_int32_t mediaid; -} __packed; - -#define I2O_RBS_MEDIA_UNLOCK 0x4b -struct i2o_rbs_media_unlock { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; - u_int32_t mediaid; -} __packed; - -/* Standard RBS reply frame. */ -struct i2o_rbs_reply { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; - u_int16_t detail; - u_int8_t retrycount; - u_int8_t reqstatus; - u_int32_t transfercount; - u_int64_t offset; /* Error replies only */ -} __packed; - -/* - * ================= Block storage class parameter groups ================= - */ - -#define I2O_PARAM_RBS_DEVICE_INFO 0x0000 -struct i2o_param_rbs_device_info { - u_int8_t type; - u_int8_t npaths; - u_int16_t powerstate; - u_int32_t blocksize; - u_int64_t capacity; - u_int32_t capabilities; - u_int32_t state; -} __packed; - -#define I2O_RBS_TYPE_DIRECT 0x00 -#define I2O_RBS_TYPE_WORM 0x04 -#define I2O_RBS_TYPE_CDROM 0x05 -#define I2O_RBS_TYPE_OPTICAL 0x07 - -#define I2O_RBS_CAP_CACHING 0x00000001 -#define I2O_RBS_CAP_MULTI_PATH 0x00000002 -#define I2O_RBS_CAP_DYNAMIC_CAPACITY 0x00000004 -#define I2O_RBS_CAP_REMOVABLE_MEDIA 0x00000008 -#define I2O_RBS_CAP_REMOVABLE_DEVICE 0x00000010 -#define I2O_RBS_CAP_READ_ONLY 0x00000020 -#define I2O_RBS_CAP_LOCKOUT 0x00000040 -#define I2O_RBS_CAP_BOOT_BYPASS 0x00000080 -#define I2O_RBS_CAP_COMPRESSION 0x00000100 -#define I2O_RBS_CAP_DATA_SECURITY 0x00000200 -#define I2O_RBS_CAP_RAID 0x00000400 - -#define I2O_RBS_STATE_CACHING 0x00000001 -#define I2O_RBS_STATE_POWERED_ON 0x00000002 -#define I2O_RBS_STATE_READY 0x00000004 -#define I2O_RBS_STATE_MEDIA_LOADED 0x00000008 -#define I2O_RBS_STATE_DEVICE_LOADED 0x00000010 -#define I2O_RBS_STATE_READ_ONLY 0x00000020 -#define I2O_RBS_STATE_LOCKOUT 0x00000040 -#define I2O_RBS_STATE_BOOT_BYPASS 0x00000080 -#define I2O_RBS_STATE_COMPRESSION 0x00000100 -#define I2O_RBS_STATE_DATA_SECURITY 0x00000200 -#define I2O_RBS_STATE_RAID 0x00000400 - -#define I2O_PARAM_RBS_OPERATION 0x0001 -struct i2o_param_rbs_operation { - u_int8_t autoreass; - u_int8_t reasstolerance; - u_int8_t numretries; - u_int8_t reserved0; - u_int32_t reasssize; - u_int32_t expectedtimeout; - u_int32_t rwvtimeout; - u_int32_t rwvtimeoutbase; - u_int32_t timeoutbase; - u_int32_t orderedreqdepth; - u_int32_t atomicwritesize; -} __packed; - -#define I2O_PARAM_RBS_CACHE_CONTROL 0x0003 -struct i2o_param_rbs_cache_control { - u_int32_t totalcachesize; - u_int32_t readcachesize; - u_int32_t writecachesize; - u_int8_t writepolicy; - u_int8_t readpolicy; - u_int8_t errorcorrection; - u_int8_t reserved; -} __packed; - -/* - * ================= SCSI peripheral class messages ================= - */ - -#define I2O_SCSI_DEVICE_RESET 0x27 -struct i2o_scsi_device_reset { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; -} __packed; - -#define I2O_SCSI_SCB_EXEC 0x81 -struct i2o_scsi_scb_exec { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; - u_int32_t flags; /* CDB length and flags */ - u_int8_t cdb[16]; - u_int32_t datalen; -} __packed; - -#define I2O_SCB_FLAG_SENSE_DATA_IN_MESSAGE 0x00200000 -#define I2O_SCB_FLAG_SENSE_DATA_IN_BUFFER 0x00600000 -#define I2O_SCB_FLAG_SIMPLE_QUEUE_TAG 0x00800000 -#define I2O_SCB_FLAG_HEAD_QUEUE_TAG 0x01000000 -#define I2O_SCB_FLAG_ORDERED_QUEUE_TAG 0x01800000 -#define I2O_SCB_FLAG_ACA_QUEUE_TAG 0x02000000 -#define I2O_SCB_FLAG_ENABLE_DISCONNECT 0x20000000 -#define I2O_SCB_FLAG_XFER_FROM_DEVICE 0x40000000 -#define I2O_SCB_FLAG_XFER_TO_DEVICE 0x80000000 - -#define I2O_SCSI_SCB_ABORT 0x83 -struct i2o_scsi_scb_abort { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; - u_int32_t tctxabort; -} __packed; - -struct i2o_scsi_reply { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t msgtctx; - u_int8_t scsistatus; - u_int8_t hbastatus; - u_int8_t reserved; - u_int8_t reqstatus; - u_int32_t datalen; - u_int32_t senselen; - u_int8_t sense[40]; -} __packed; - -#define I2O_SCSI_DSC_SUCCESS 0x00 -#define I2O_SCSI_DSC_REQUEST_ABORTED 0x02 -#define I2O_SCSI_DSC_UNABLE_TO_ABORT 0x03 -#define I2O_SCSI_DSC_COMPLETE_WITH_ERROR 0x04 -#define I2O_SCSI_DSC_ADAPTER_BUSY 0x05 -#define I2O_SCSI_DSC_REQUEST_INVALID 0x06 -#define I2O_SCSI_DSC_PATH_INVALID 0x07 -#define I2O_SCSI_DSC_DEVICE_NOT_PRESENT 0x08 -#define I2O_SCSI_DSC_UNABLE_TO_TERMINATE 0x09 -#define I2O_SCSI_DSC_SELECTION_TIMEOUT 0x0a -#define I2O_SCSI_DSC_COMMAND_TIMEOUT 0x0b -#define I2O_SCSI_DSC_MR_MESSAGE_RECEIVED 0x0d -#define I2O_SCSI_DSC_SCSI_BUS_RESET 0x0e -#define I2O_SCSI_DSC_PARITY_ERROR_FAILURE 0x0f -#define I2O_SCSI_DSC_AUTOSENSE_FAILED 0x10 -#define I2O_SCSI_DSC_NO_ADAPTER 0x11 -#define I2O_SCSI_DSC_DATA_OVERRUN 0x12 -#define I2O_SCSI_DSC_UNEXPECTED_BUS_FREE 0x13 -#define I2O_SCSI_DSC_SEQUENCE_FAILURE 0x14 -#define I2O_SCSI_DSC_REQUEST_LENGTH_ERROR 0x15 -#define I2O_SCSI_DSC_PROVIDE_FAILURE 0x16 -#define I2O_SCSI_DSC_BDR_MESSAGE_SENT 0x17 -#define I2O_SCSI_DSC_REQUEST_TERMINATED 0x18 -#define I2O_SCSI_DSC_IDE_MESSAGE_SENT 0x33 -#define I2O_SCSI_DSC_RESOURCE_UNAVAILABLE 0x34 -#define I2O_SCSI_DSC_UNACKNOWLEDGED_EVENT 0x35 -#define I2O_SCSI_DSC_MESSAGE_RECEIVED 0x36 -#define I2O_SCSI_DSC_INVALID_CDB 0x37 -#define I2O_SCSI_DSC_LUN_INVALID 0x38 -#define I2O_SCSI_DSC_SCSI_TID_INVALID 0x39 -#define I2O_SCSI_DSC_FUNCTION_UNAVAILABLE 0x3a -#define I2O_SCSI_DSC_NO_NEXUS 0x3b -#define I2O_SCSI_DSC_SCSI_IID_INVALID 0x3c -#define I2O_SCSI_DSC_CDB_RECEIVED 0x3d -#define I2O_SCSI_DSC_LUN_ALREADY_ENABLED 0x3e -#define I2O_SCSI_DSC_BUS_BUSY 0x3f -#define I2O_SCSI_DSC_QUEUE_FROZEN 0x40 - -/* - * ================= SCSI peripheral class parameter groups ================= - */ - -#define I2O_PARAM_SCSI_DEVICE_INFO 0x0000 -struct i2o_param_scsi_device_info { - u_int8_t devicetype; - u_int8_t flags; - u_int16_t reserved0; - u_int32_t identifier; - u_int8_t luninfo[8]; - u_int32_t queuedepth; - u_int8_t reserved1; - u_int8_t negoffset; - u_int8_t negdatawidth; - u_int8_t reserved2; - u_int64_t negsyncrate; -} __packed; - -/* - * ================= LAN class messages ================= - */ - -#define I2O_LAN_PACKET_SEND 0x3b -struct i2o_lan_packet_send { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t tcw; - - /* SGL follows */ -}; - -#define I2O_LAN_TCW_ACCESS_PRI_MASK 0x00000007 -#define I2O_LAN_TCW_SUPPRESS_CRC 0x00000008 -#define I2O_LAN_TCW_SUPPRESS_LOOPBACK 0x00000010 -#define I2O_LAN_TCW_CKSUM_NETWORK 0x00000020 -#define I2O_LAN_TCW_CKSUM_TRANSPORT 0x00000040 -#define I2O_LAN_TCW_REPLY_BATCH 0x00000000 -#define I2O_LAN_TCW_REPLY_IMMEDIATELY 0x40000000 -#define I2O_LAN_TCW_REPLY_UNSUCCESSFUL 0x80000000 -#define I2O_LAN_TCW_REPLY_NONE 0xc0000000 - -#define I2O_LAN_SDU_SEND 0x3d -struct i2o_lan_sdu_send { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t tcw; /* As per PACKET_SEND. */ - - /* SGL follows */ -}; - -struct i2o_lan_send_reply { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t trl; - u_int16_t detail; - u_int8_t reserved; - u_int8_t reqstatus; - u_int32_t tctx[1]; -}; - -#define I2O_LAN_RECEIVE_POST 0x3e -struct i2o_lan_receive_post { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int32_t bktcnt; - - /* SGL follows */ -}; - -struct i2o_lan_pdb { - u_int32_t bctx; - u_int32_t pktoff; - u_int32_t pktlen; -}; - -#define I2O_LAN_FRAG_VALID 0x00 -#define I2O_LAN_FRAG_VALID_MASK foo - -struct i2o_lan_receive_reply { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int8_t trlcount; - u_int8_t trlesize; - u_int8_t reserved; - u_int8_t trlflags; - u_int32_t bucketsleft; - struct i2o_lan_pdb pdb[1]; -}; - -#define I2O_LAN_RESET 0x35 -struct i2o_lan_reset { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int16_t reserved; - u_int16_t resrcflags; -}; - -#define I2O_LAN_RESRC_RETURN_BUCKETS 0x0001 -#define I2O_LAN_RESRC_RETURN_XMITS 0x0002 - -#define I2O_LAN_SUSPEND 0x37 -struct i2o_lan_suspend { - u_int32_t msgflags; - u_int32_t msgfunc; - u_int32_t msgictx; - u_int16_t reserved; - u_int16_t resrcflags; /* As per RESET. */ -}; - -#define I2O_LAN_DSC_SUCCESS 0x00 -#define I2O_LAN_DSC_DEVICE_FAILURE 0x01 -#define I2O_LAN_DSC_DESTINATION_NOT_FOUND 0x02 -#define I2O_LAN_DSC_TRANSMIT_ERROR 0x03 -#define I2O_LAN_DSC_TRANSMIT_ABORTED 0x04 -#define I2O_LAN_DSC_RECEIVE_ERROR 0x05 -#define I2O_LAN_DSC_RECEIVE_ABORTED 0x06 -#define I2O_LAN_DSC_DMA_ERROR 0x07 -#define I2O_LAN_DSC_BAD_PACKET_DETECTED 0x08 -#define I2O_LAN_DSC_OUT_OF_MEMORY 0x09 -#define I2O_LAN_DSC_BUCKET_OVERRUN 0x0a -#define I2O_LAN_DSC_IOP_INTERNAL_ERROR 0x0b -#define I2O_LAN_DSC_CANCELED 0x0c -#define I2O_LAN_DSC_INVALID_TRANSACTION_CONTEXT 0x0d -#define I2O_LAN_DSC_DEST_ADDRESS_DETECTED 0x0e -#define I2O_LAN_DSC_DEST_ADDRESS_OMITTED 0x0f -#define I2O_LAN_DSC_PARTIAL_PACKET_RETURNED 0x10 -#define I2O_LAN_DSC_TEMP_SUSPENDED_STATE 0x11 - -/* - * ================= LAN class parameter groups ================= - */ - -#define I2O_PARAM_LAN_DEVICE_INFO 0x0000 -struct i2o_param_lan_device_info { - u_int16_t lantype; - u_int16_t flags; - u_int8_t addrfmt; - u_int8_t reserved1; - u_int16_t reserved2; - u_int32_t minpktsize; - u_int32_t maxpktsize; - u_int8_t hwaddr[8]; - u_int64_t maxtxbps; - u_int64_t maxrxbps; -}; - -#define I2O_LAN_TYPE_ETHERNET 0x0030 -#define I2O_LAN_TYPE_100BASEVG 0x0040 -#define I2O_LAN_TYPE_TOKEN_RING 0x0050 -#define I2O_LAN_TYPE_FDDI 0x0060 -#define I2O_LAN_TYPE_FIBRECHANNEL 0x0070 - -#define I2O_PARAM_LAN_MAC_ADDRESS 0x0001 -struct i2o_param_lan_mac_address { - u_int8_t activeaddr[8]; - u_int8_t localaddr[8]; - u_int8_t addrmask[8]; - u_int8_t filtermask[4]; - u_int8_t hwfiltermask[4]; - u_int32_t maxmcastaddr; - u_int32_t maxfilterperfect; - u_int32_t maxfilterimperfect; -}; - -#define I2O_PARAM_LAN_MCAST_MAC_ADDRESS 0x0002 -/* - * This one's a table, not a scalar. - */ - -#define I2O_PARAM_LAN_BATCH_CONTROL 0x0003 -struct i2o_param_lan_batch_control { - u_int32_t batchflags; - u_int32_t risingloaddly; - u_int32_t risingloadthresh; - u_int32_t fallingloaddly; - u_int32_t fallingloadthresh; - u_int32_t maxbatchcount; - u_int32_t maxbatchdelay; - u_int32_t transcompdelay; -}; - -#define I2O_PARAM_LAN_OPERATION 0x0004 -struct i2o_param_lan_operation { - u_int32_t pktprepad; - u_int32_t userflags; - u_int32_t pktorphanlimit; -}; - -#define I2O_PARAM_LAN_MEDIA_OPERATION 0x0005 -struct i2o_param_lan_media_operation { - u_int32_t connectortype; - u_int32_t connectiontype; - u_int32_t curtxbps; - u_int32_t currxbps; - u_int8_t fullduplex; - u_int8_t linkstatus; - u_int8_t badpkthandling; -}; - -#define I2O_LAN_CONNECTOR_OTHER 0x00 -#define I2O_LAN_CONNECTOR_UNKNOWN 0x01 -#define I2O_LAN_CONNECTOR_AUI 0x02 -#define I2O_LAN_CONNECTOR_UTP 0x03 -#define I2O_LAN_CONNECTOR_BNC 0x04 -#define I2O_LAN_CONNECTOR_RJ45 0x05 -#define I2O_LAN_CONNECTOR_STP_DB9 0x06 -#define I2O_LAN_CONNECTOR_FIBER_MIC 0x07 -#define I2O_LAN_CONNECTOR_APPLE_AUI 0x08 -#define I2O_LAN_CONNECTOR_MII 0x09 -#define I2O_LAN_CONNECTOR_COPPER_DB9 0x0a -#define I2O_LAN_CONNECTOR_COPPER_AW 0x0b -#define I2O_LAN_CONNECTOR_OPTICAL_LW 0x0c -#define I2O_LAN_CONNECTOR_SIP 0x0d -#define I2O_LAN_CONNECTOR_OPTICAL_SW 0x0e - -#define I2O_LAN_CONNECTION_UNKNOWN 0x0000 - -#define I2O_LAN_CONNECTION_ETHERNET_AUI 0x0301 -#define I2O_LAN_CONNECTION_ETHERNET_10BASE5 0x0302 -#define I2O_LAN_CONNECTION_ETHERNET_FOIRL 0x0303 -#define I2O_LAN_CONNECTION_ETHERNET_10BASE2 0x0304 -#define I2O_LAN_CONNECTION_ETHERNET_10BROAD36 0x0305 -#define I2O_LAN_CONNECTION_ETHERNET_10BASET 0x0306 -#define I2O_LAN_CONNECTION_ETHERNET_10BASEFP 0x0307 -#define I2O_LAN_CONNECTION_ETHERNET_10BASEFB 0x0308 -#define I2O_LAN_CONNECTION_ETHERNET_10BASEFL 0x0309 -#define I2O_LAN_CONNECTION_ETHERNET_100BASETX 0x030a -#define I2O_LAN_CONNECTION_ETHERNET_100BASEFX 0x030b -#define I2O_LAN_CONNECTION_ETHERNET_100BASET4 0x030c - -#define I2O_LAN_CONNECTION_100BASEVG_100BASEVG 0x0401 - -#define I2O_LAN_CONNECTION_TOKEN_RING_4MBIT 0x0501 -#define I2O_LAN_CONNECTION_TOKEN_RING_16MBIT 0x0502 - -#define I2O_LAN_CONNECTION_FDDI_125MBIT 0x0601 - -#define I2O_LAN_CONNECTION_FIBRECHANNEL_P2P 0x0701 -#define I2O_LAN_CONNECTION_FIBRECHANNEL_AL 0x0702 -#define I2O_LAN_CONNECTION_FIBRECHANNEL_PL 0x0703 -#define I2O_LAN_CONNECTION_FIBRECHANNEL_F 0x0704 - -#define I2O_LAN_CONNECTION_OTHER_EMULATED 0x0f00 -#define I2O_LAN_CONNECTION_OTHER_OTHER 0x0f01 - -#endif /* !defined _I2O_I2O_H_ */ diff --git a/sys/dev/i2o/iop.c b/sys/dev/i2o/iop.c deleted file mode 100644 index 1b00a6720a7..00000000000 --- a/sys/dev/i2o/iop.c +++ /dev/null @@ -1,2475 +0,0 @@ -/* $OpenBSD: iop.c,v 1.38 2013/05/30 16:15:02 deraadt Exp $ */ -/* $NetBSD: iop.c,v 1.12 2001/03/21 14:27:05 ad Exp $ */ - -/*- - * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Andrew Doran. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Support for I2O IOPs (intelligent I/O processors). - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/device.h> -#include <sys/queue.h> -#include <sys/proc.h> -#include <sys/malloc.h> -#include <sys/ioctl.h> -#include <sys/endian.h> -#include <sys/conf.h> -#include <sys/kthread.h> - -#include <uvm/uvm_extern.h> - -#include <machine/bus.h> - -#include <dev/i2o/i2o.h> -#include <dev/i2o/iopio.h> -#include <dev/i2o/iopreg.h> -#include <dev/i2o/iopvar.h> - -#define POLL(ms, cond) \ -do { \ - int i; \ - for (i = (ms) * 10; i; i--) { \ - if (cond) \ - break; \ - DELAY(100); \ - } \ -} while (/* CONSTCOND */0); - -#ifdef I2ODEBUG -#define DPRINTF(x) printf x -#else -#define DPRINTF(x) -#endif - -#ifdef I2OVERBOSE -#define IFVERBOSE(x) x -#define COMMENT(x) NULL -#else -#define IFVERBOSE(x) -#define COMMENT(x) -#endif - -#define IOP_ICTXHASH_NBUCKETS 16 -#define IOP_ICTXHASH(ictx) (&iop_ictxhashtbl[(ictx) & iop_ictxhash]) - -#define IOP_MAX_SEGS (((IOP_MAX_XFER + PAGE_SIZE - 1) / PAGE_SIZE) + 1) - -#define IOP_TCTX_SHIFT 12 -#define IOP_TCTX_MASK ((1 << IOP_TCTX_SHIFT) - 1) - -LIST_HEAD(, iop_initiator) *iop_ictxhashtbl; -u_long iop_ictxhash; -void *iop_sdh; -struct i2o_systab *iop_systab; -int iop_systab_size; - -struct cfdriver iop_cd = { - NULL, "iop", DV_DULL -}; - -#define IC_CONFIGURE 0x01 -#define IC_PRIORITY 0x02 - -struct iop_class { - u_short ic_class; - u_short ic_flags; -#ifdef I2OVERBOSE - const char *ic_caption; -#endif -} static const iop_class[] = { - { - I2O_CLASS_EXECUTIVE, - 0, - COMMENT("executive") - }, - { - I2O_CLASS_DDM, - 0, - COMMENT("device driver module") - }, - { - I2O_CLASS_RANDOM_BLOCK_STORAGE, - IC_CONFIGURE | IC_PRIORITY, - IFVERBOSE("random block storage") - }, - { - I2O_CLASS_SEQUENTIAL_STORAGE, - IC_CONFIGURE | IC_PRIORITY, - IFVERBOSE("sequential storage") - }, - { - I2O_CLASS_LAN, - IC_CONFIGURE | IC_PRIORITY, - IFVERBOSE("LAN port") - }, - { - I2O_CLASS_WAN, - IC_CONFIGURE | IC_PRIORITY, - IFVERBOSE("WAN port") - }, - { - I2O_CLASS_FIBRE_CHANNEL_PORT, - IC_CONFIGURE, - IFVERBOSE("fibrechannel port") - }, - { - I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL, - 0, - COMMENT("fibrechannel peripheral") - }, - { - I2O_CLASS_SCSI_PERIPHERAL, - 0, - COMMENT("SCSI peripheral") - }, - { - I2O_CLASS_ATE_PORT, - IC_CONFIGURE, - IFVERBOSE("ATE port") - }, - { - I2O_CLASS_ATE_PERIPHERAL, - 0, - COMMENT("ATE peripheral") - }, - { - I2O_CLASS_FLOPPY_CONTROLLER, - IC_CONFIGURE, - IFVERBOSE("floppy controller") - }, - { - I2O_CLASS_FLOPPY_DEVICE, - 0, - COMMENT("floppy device") - }, - { - I2O_CLASS_BUS_ADAPTER_PORT, - IC_CONFIGURE, - IFVERBOSE("bus adapter port" ) - }, -}; - -#if defined(I2ODEBUG) && defined(I2OVERBOSE) -static const char * const iop_status[] = { - "success", - "abort (dirty)", - "abort (no data transfer)", - "abort (partial transfer)", - "error (dirty)", - "error (no data transfer)", - "error (partial transfer)", - "undefined error code", - "process abort (dirty)", - "process abort (no data transfer)", - "process abort (partial transfer)", - "transaction error", -}; -#endif - -static inline u_int32_t iop_inl(struct iop_softc *, int); -static inline void iop_outl(struct iop_softc *, int, u_int32_t); - -void iop_config_interrupts(struct device *); -void iop_configure_devices(struct iop_softc *, int, int); -void iop_devinfo(int, char *, size_t); -int iop_print(void *, const char *); -int iop_reconfigure(struct iop_softc *, u_int); -int iop_submatch(struct device *, void *, void *); -#ifdef notyet -int iop_vendor_print(void *, const char *); -#endif - -void iop_adjqparam(struct iop_softc *, int); -void iop_create_reconf_thread(void *); -int iop_handle_reply(struct iop_softc *, u_int32_t); -int iop_hrt_get(struct iop_softc *); -int iop_hrt_get0(struct iop_softc *, struct i2o_hrt *, size_t); -void iop_intr_event(struct device *, struct iop_msg *, void *); -int iop_lct_get0(struct iop_softc *, struct i2o_lct *, size_t, u_int32_t); -void iop_msg_poll(struct iop_softc *, struct iop_msg *, int); -void iop_msg_wait(struct iop_softc *, struct iop_msg *, int); -int iop_ofifo_init(struct iop_softc *); -int iop_passthrough(struct iop_softc *, struct ioppt *); -int iop_post(struct iop_softc *, u_int32_t *); -void iop_reconf_thread(void *); -void iop_release_mfa(struct iop_softc *, u_int32_t); -int iop_reset(struct iop_softc *); -int iop_status_get(struct iop_softc *, int); -int iop_systab_set(struct iop_softc *); -void iop_tfn_print(struct iop_softc *, struct i2o_fault_notify *); - -#ifdef I2ODEBUG -void iop_reply_print(struct iop_softc *, struct i2o_reply *); -#endif - -cdev_decl(iop); - -static inline u_int32_t -iop_inl(struct iop_softc *sc, int off) -{ - - bus_space_barrier(sc->sc_iot, sc->sc_ioh, off, 4, - BUS_SPACE_BARRIER_WRITE | BUS_SPACE_BARRIER_READ); - return (bus_space_read_4(sc->sc_iot, sc->sc_ioh, off)); -} - -static inline void -iop_outl(struct iop_softc *sc, int off, u_int32_t val) -{ - - bus_space_write_4(sc->sc_iot, sc->sc_ioh, off, val); - bus_space_barrier(sc->sc_iot, sc->sc_ioh, off, 4, - BUS_SPACE_BARRIER_WRITE); -} - -/* - * Initialise the IOP and our interface. - */ -void -iop_init(struct iop_softc *sc, const char *intrstr) -{ - struct iop_msg *im; - u_int32_t mask; - char ident[64]; - int rv, i, nsegs; - int state = 0; - - if (iop_ictxhashtbl == NULL) { - iop_ictxhashtbl = hashinit(IOP_ICTXHASH_NBUCKETS, M_DEVBUF, - M_NOWAIT, &iop_ictxhash); - if (iop_ictxhashtbl == NULL) { - printf(": cannot allocate hashtable\n"); - return; - } - } - - /* Reset the IOP and request status. */ - - /* Allocate a scratch DMA map for small miscellaneous shared data. */ - if (bus_dmamap_create(sc->sc_dmat, PAGE_SIZE, 1, PAGE_SIZE, 0, - BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &sc->sc_scr_dmamap) != 0) { - printf(": cannot create scratch dmamap\n"); - return; - } - state++; - - if (bus_dmamem_alloc(sc->sc_dmat, PAGE_SIZE, PAGE_SIZE, 0, - sc->sc_scr_seg, 1, &nsegs, BUS_DMA_NOWAIT) != 0) { - printf(": cannot alloc scratch dmamem\n"); - goto bail_out; - } - state++; - - if (bus_dmamem_map(sc->sc_dmat, sc->sc_scr_seg, nsegs, PAGE_SIZE, - &sc->sc_scr, 0)) { - printf(": cannot map scratch dmamem\n"); - goto bail_out; - } - state++; - - if (bus_dmamap_load(sc->sc_dmat, sc->sc_scr_dmamap, sc->sc_scr, - PAGE_SIZE, NULL, BUS_DMA_NOWAIT)) { - printf(": cannot load scratch dmamap\n"); - goto bail_out; - } - state++; - - if ((rv = iop_reset(sc)) != 0) { - printf(": not responding (reset)\n"); - goto bail_out; - } - if ((rv = iop_status_get(sc, 1)) != 0) { - printf(": not responding (get status)\n"); - goto bail_out; - } - sc->sc_flags |= IOP_HAVESTATUS; - iop_strvis(sc, sc->sc_status.productid, - sizeof(sc->sc_status.productid), ident, sizeof(ident)); - printf(": <%s>", ident); - if (intrstr != NULL) - printf(", %s", intrstr); - printf("\n"); - -#ifdef I2ODEBUG - printf("%s: orgid=0x%04x version=%d\n", sc->sc_dv.dv_xname, - letoh16(sc->sc_status.orgid), - (letoh32(sc->sc_status.segnumber) >> 12) & 15); - printf("%s: type want have cbase\n", sc->sc_dv.dv_xname); - printf("%s: mem %04x %04x %08x\n", sc->sc_dv.dv_xname, - letoh32(sc->sc_status.desiredprivmemsize), - letoh32(sc->sc_status.currentprivmemsize), - letoh32(sc->sc_status.currentprivmembase)); - printf("%s: i/o %04x %04x %08x\n", sc->sc_dv.dv_xname, - letoh32(sc->sc_status.desiredpriviosize), - letoh32(sc->sc_status.currentpriviosize), - letoh32(sc->sc_status.currentpriviobase)); -#endif - - sc->sc_maxob = letoh32(sc->sc_status.maxoutboundmframes); - if (sc->sc_maxob > IOP_MAX_OUTBOUND) - sc->sc_maxob = IOP_MAX_OUTBOUND; - sc->sc_maxib = letoh32(sc->sc_status.maxinboundmframes); - if (sc->sc_maxib > IOP_MAX_INBOUND) - sc->sc_maxib = IOP_MAX_INBOUND; - - /* Allocate message wrappers. */ - im = malloc(sizeof(*im) * sc->sc_maxib, M_DEVBUF, M_NOWAIT | M_ZERO); - if (!im) { - printf("%s: couldn't allocate message", sc->sc_dv.dv_xname); - goto bail_out; - } - state++; - - sc->sc_ims = im; - SLIST_INIT(&sc->sc_im_freelist); - - for (i = 0; i < sc->sc_maxib; i++, im++) { - rv = bus_dmamap_create(sc->sc_dmat, IOP_MAX_XFER, - IOP_MAX_SEGS, IOP_MAX_XFER, 0, - BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, - &im->im_xfer[0].ix_map); - if (rv != 0) { - printf("%s: couldn't create dmamap (%d)", - sc->sc_dv.dv_xname, rv); - goto bail_out; - } - - im->im_tctx = i; - SLIST_INSERT_HEAD(&sc->sc_im_freelist, im, im_chain); - } - - /* Initialize the IOP's outbound FIFO. */ - if (iop_ofifo_init(sc) != 0) { - printf("%s: unable to init outbound FIFO\n", - sc->sc_dv.dv_xname); - goto bail_out; - } - - /* Ensure interrupts are enabled at the IOP. */ - mask = iop_inl(sc, IOP_REG_INTR_MASK); - iop_outl(sc, IOP_REG_INTR_MASK, mask & ~IOP_INTR_OFIFO); - -#ifdef I2ODEBUG - printf("%s: queue depths: inbound %d/%d, outbound %d/%d\n", - sc->sc_dv.dv_xname, sc->sc_maxib, - letoh32(sc->sc_status.maxinboundmframes), - sc->sc_maxob, letoh32(sc->sc_status.maxoutboundmframes)); -#endif - - rw_init(&sc->sc_conflock, "iopconf"); - - startuphook_establish((void (*)(void *))iop_config_interrupts, sc); - return; - - bail_out: - if (state > 4) - free(im, M_DEVBUF); - if (state > 3) - bus_dmamap_unload(sc->sc_dmat, sc->sc_scr_dmamap); - if (state > 2) - bus_dmamem_unmap(sc->sc_dmat, sc->sc_scr, PAGE_SIZE); - if (state > 1) - bus_dmamem_free(sc->sc_dmat, sc->sc_scr_seg, nsegs); - if (state > 0) - bus_dmamap_destroy(sc->sc_dmat, sc->sc_scr_dmamap); -} - -/* - * Perform autoconfiguration tasks. - */ -void -iop_config_interrupts(struct device *self) -{ - struct iop_softc *sc, *iop; - struct i2o_systab_entry *ste; - int rv, i, niop; - - sc = (struct iop_softc *)self; - LIST_INIT(&sc->sc_iilist); - - printf("%s: configuring...\n", sc->sc_dv.dv_xname); - - if (iop_hrt_get(sc) != 0) { - printf("%s: unable to retrieve HRT\n", sc->sc_dv.dv_xname); - return; - } - - /* - * Build the system table. - */ - if (iop_systab == NULL) { - for (i = 0, niop = 0; i < iop_cd.cd_ndevs; i++) { - iop = (struct iop_softc *)device_lookup(&iop_cd, i); - if (iop == NULL) - continue; - if ((iop->sc_flags & IOP_HAVESTATUS) == 0) - continue; - if (iop_status_get(iop, 1) != 0) { - printf("%s: unable to retrieve status\n", - sc->sc_dv.dv_xname); - iop->sc_flags &= ~IOP_HAVESTATUS; - continue; - } - niop++; - } - if (niop == 0) - return; - - i = sizeof(struct i2o_systab_entry) * (niop - 1) + - sizeof(struct i2o_systab); - iop_systab_size = i; - iop_systab = malloc(i, M_DEVBUF, M_NOWAIT | M_ZERO); - if (!iop_systab) - return; - - iop_systab->numentries = niop; - iop_systab->version = I2O_VERSION_11; - - for (i = 0, ste = iop_systab->entry; i < iop_cd.cd_ndevs; i++) - { - iop = (struct iop_softc *)device_lookup(&iop_cd, i); - if (iop == NULL) - continue; - if ((iop->sc_flags & IOP_HAVESTATUS) == 0) - continue; - - ste->orgid = iop->sc_status.orgid; - ste->iopid = iop->sc_dv.dv_unit + 2; - ste->segnumber = - htole32(letoh32(iop->sc_status.segnumber) & ~4095); - ste->iopcaps = iop->sc_status.iopcaps; - ste->inboundmsgframesize = - iop->sc_status.inboundmframesize; - ste->inboundmsgportaddresslow = - htole32(iop->sc_memaddr + IOP_REG_IFIFO); - ste++; - } - } - - /* - * Post the system table to the IOP and bring it to the OPERATIONAL - * state. - */ - if (iop_systab_set(sc) != 0) { - printf("%s: unable to set system table\n", sc->sc_dv.dv_xname); - return; - } - if (iop_simple_cmd(sc, I2O_TID_IOP, I2O_EXEC_SYS_ENABLE, IOP_ICTX, 1, - 30000) != 0) { - printf("%s: unable to enable system\n", sc->sc_dv.dv_xname); - return; - } - - /* - * Set up an event handler for this IOP. - */ - sc->sc_eventii.ii_dv = self; - sc->sc_eventii.ii_intr = iop_intr_event; - sc->sc_eventii.ii_flags = II_DISCARD | II_UTILITY; - sc->sc_eventii.ii_tid = I2O_TID_IOP; - iop_initiator_register(sc, &sc->sc_eventii); - - rv = iop_util_eventreg(sc, &sc->sc_eventii, - I2O_EVENT_EXEC_RESOURCE_LIMITS | - I2O_EVENT_EXEC_CONNECTION_FAIL | - I2O_EVENT_EXEC_ADAPTER_FAULT | - I2O_EVENT_EXEC_POWER_FAIL | - I2O_EVENT_EXEC_RESET_PENDING | - I2O_EVENT_EXEC_RESET_IMMINENT | - I2O_EVENT_EXEC_HARDWARE_FAIL | - I2O_EVENT_EXEC_XCT_CHANGE | - I2O_EVENT_EXEC_DDM_AVAILIBILITY | - I2O_EVENT_GEN_DEVICE_RESET | - I2O_EVENT_GEN_STATE_CHANGE | - I2O_EVENT_GEN_GENERAL_WARNING); - if (rv != 0) { - printf("%s: unable to register for events", - sc->sc_dv.dv_xname); - return; - } - -#ifdef notyet - /* Attempt to match and attach a product-specific extension. */ - ia.ia_class = I2O_CLASS_ANY; - ia.ia_tid = I2O_TID_IOP; - config_found_sm(self, &ia, iop_vendor_print, iop_submatch); -#endif - - rw_enter_write(&sc->sc_conflock); - rv = iop_reconfigure(sc, 0); - rw_exit_write(&sc->sc_conflock); - if (rv == -1) { - printf("%s: configure failed (%d)\n", sc->sc_dv.dv_xname, rv); - return; - } - kthread_create_deferred(iop_create_reconf_thread, sc); -} - -/* - * Create the reconfiguration thread. Called after the standard kernel - * threads have been created. - */ -void -iop_create_reconf_thread(void *cookie) -{ - struct iop_softc *sc; - int rv; - - sc = cookie; - sc->sc_flags |= IOP_ONLINE; - - rv = kthread_create(iop_reconf_thread, sc, &sc->sc_reconf_proc, - "%s", sc->sc_dv.dv_xname); - if (rv != 0) { - printf("%s: unable to create reconfiguration thread (%d)", - sc->sc_dv.dv_xname, rv); - return; - } -} - -/* - * Reconfiguration thread; listens for LCT change notification, and - * initiates re-configuration if received. - */ -void -iop_reconf_thread(void *cookie) -{ - struct iop_softc *sc = cookie; - struct i2o_lct lct; - u_int32_t chgind; - int rv; - - chgind = sc->sc_chgind + 1; - - for (;;) { - DPRINTF(("%s: async reconfig: requested 0x%08x\n", - sc->sc_dv.dv_xname, chgind)); - - rv = iop_lct_get0(sc, &lct, sizeof(lct), chgind); - - DPRINTF(("%s: async reconfig: notified (0x%08x, %d)\n", - sc->sc_dv.dv_xname, letoh32(lct.changeindicator), rv)); - - if (rv == 0) { - rw_enter_write(&sc->sc_conflock); - iop_reconfigure(sc, letoh32(lct.changeindicator)); - chgind = sc->sc_chgind + 1; - rw_exit_write(&sc->sc_conflock); - } - - tsleep(iop_reconf_thread, PWAIT, "iopzzz", hz * 5); - } -} - -/* - * Reconfigure: find new and removed devices. - */ -int -iop_reconfigure(struct iop_softc *sc, u_int chgind) -{ - struct iop_msg *im; - struct i2o_hba_bus_scan mf; - struct i2o_lct_entry *le; - struct iop_initiator *ii, *nextii; - int rv, tid, i; - - /* - * If the reconfiguration request isn't the result of LCT change - * notification, then be more thorough: ask all bus ports to scan - * their busses. Wait up to 5 minutes for each bus port to complete - * the request. - */ - if (chgind == 0) { - if ((rv = iop_lct_get(sc)) != 0) { - DPRINTF(("iop_reconfigure: unable to read LCT\n")); - return (rv); - } - - le = sc->sc_lct->entry; - for (i = 0; i < sc->sc_nlctent; i++, le++) { - if ((letoh16(le->classid) & I2O_CLASS_MASK) != - I2O_CLASS_BUS_ADAPTER_PORT) - continue; - tid = letoh16(le->localtid) & I2O_CLASS_MASK; - - im = iop_msg_alloc(sc, NULL, IM_WAIT); - - mf.msgflags = I2O_MSGFLAGS(i2o_hba_bus_scan); - mf.msgfunc = I2O_MSGFUNC(tid, I2O_HBA_BUS_SCAN); - mf.msgictx = IOP_ICTX; - mf.msgtctx = im->im_tctx; - - DPRINTF(("%s: scanning bus %d\n", sc->sc_dv.dv_xname, - tid)); - - rv = iop_msg_post(sc, im, &mf, 5*60*1000); - iop_msg_free(sc, im); -#ifdef I2ODEBUG - if (rv != 0) - printf("%s: bus scan failed, status =%d\n", - sc->sc_dv.dv_xname, rv); -#endif - } - } else if (chgind <= sc->sc_chgind) { - DPRINTF(("%s: LCT unchanged (async)\n", sc->sc_dv.dv_xname)); - return (0); - } - - /* Re-read the LCT and determine if it has changed. */ - if ((rv = iop_lct_get(sc)) != 0) { - DPRINTF(("iop_reconfigure: unable to re-read LCT\n")); - return (rv); - } - DPRINTF(("%s: %d LCT entries\n", sc->sc_dv.dv_xname, sc->sc_nlctent)); - - chgind = letoh32(sc->sc_lct->changeindicator); - if (chgind == sc->sc_chgind) { - DPRINTF(("%s: LCT unchanged\n", sc->sc_dv.dv_xname)); - return (0); - } - DPRINTF(("%s: LCT changed\n", sc->sc_dv.dv_xname)); - sc->sc_chgind = chgind; - - if (sc->sc_tidmap != NULL) - free(sc->sc_tidmap, M_DEVBUF); - sc->sc_tidmap = malloc(sc->sc_nlctent * sizeof(struct iop_tidmap), - M_DEVBUF, M_NOWAIT | M_ZERO); - if (!sc->sc_tidmap) { - DPRINTF(("iop_reconfigure: out of memory\n")); - return (ENOMEM); - } - - /* Allow 1 queued command per device while we're configuring. */ - iop_adjqparam(sc, 1); - - /* - * Match and attach child devices. We configure high-level devices - * first so that any claims will propagate throughout the LCT, - * hopefully masking off aliased devices as a result. - * - * Re-reading the LCT at this point is a little dangerous, but we'll - * trust the IOP (and the operator) to behave itself... - */ - iop_configure_devices(sc, IC_CONFIGURE | IC_PRIORITY, - IC_CONFIGURE | IC_PRIORITY); - if ((rv = iop_lct_get(sc)) != 0) - DPRINTF(("iop_reconfigure: unable to re-read LCT\n")); - iop_configure_devices(sc, IC_CONFIGURE | IC_PRIORITY, - IC_CONFIGURE); - - for (ii = LIST_FIRST(&sc->sc_iilist); ii != NULL; ii = nextii) { - nextii = LIST_NEXT(ii, ii_list); - - /* Detach devices that were configured, but are now gone. */ - for (i = 0; i < sc->sc_nlctent; i++) - if (ii->ii_tid == sc->sc_tidmap[i].it_tid) - break; - if (i == sc->sc_nlctent || - (sc->sc_tidmap[i].it_flags & IT_CONFIGURED) == 0) - config_detach(ii->ii_dv, DETACH_FORCE); - - /* - * Tell initiators that existed before the re-configuration - * to re-configure. - */ - if (ii->ii_reconfig == NULL) - continue; - if ((rv = (*ii->ii_reconfig)(ii->ii_dv)) != 0) - printf("%s: %s failed reconfigure (%d)\n", - sc->sc_dv.dv_xname, ii->ii_dv->dv_xname, rv); - } - - /* Re-adjust queue parameters and return. */ - if (sc->sc_nii != 0) - iop_adjqparam(sc, (sc->sc_maxib - sc->sc_nuii - IOP_MF_RESERVE) - / sc->sc_nii); - - return (0); -} - -/* - * Configure I2O devices into the system. - */ -void -iop_configure_devices(struct iop_softc *sc, int mask, int maskval) -{ - struct iop_attach_args ia; - struct iop_initiator *ii; - const struct i2o_lct_entry *le; - struct device *dv; - int i, j, nent; - u_int usertid; - - nent = sc->sc_nlctent; - for (i = 0, le = sc->sc_lct->entry; i < nent; i++, le++) { - sc->sc_tidmap[i].it_tid = - letoh16(le->localtid) & I2O_LCT_ENTRY_TID_MASK; - - /* Ignore the device if it's in use. */ - usertid = letoh32(le->usertid) & I2O_LCT_ENTRY_TID_MASK; - if (usertid != I2O_TID_NONE && usertid != I2O_TID_HOST) - continue; - - ia.ia_class = letoh16(le->classid) & I2O_CLASS_MASK; - ia.ia_tid = sc->sc_tidmap[i].it_tid; - - /* Ignore uninteresting devices. */ - for (j = 0; j < sizeof(iop_class) / sizeof(iop_class[0]); j++) - if (iop_class[j].ic_class == ia.ia_class) - break; - if (j < sizeof(iop_class) / sizeof(iop_class[0]) && - (iop_class[j].ic_flags & mask) != maskval) - continue; - - /* - * Try to configure the device only if it's not already - * configured. - */ - LIST_FOREACH(ii, &sc->sc_iilist, ii_list) { - if (ia.ia_tid == ii->ii_tid) { - sc->sc_tidmap[i].it_flags |= IT_CONFIGURED; - strlcpy(sc->sc_tidmap[i].it_dvname, - ii->ii_dv->dv_xname, - sizeof sc->sc_tidmap[i].it_dvname); - break; - } - } - if (ii != NULL) - continue; - dv = config_found_sm(&sc->sc_dv, &ia, iop_print, iop_submatch); - if (dv != NULL) { - sc->sc_tidmap[i].it_flags |= IT_CONFIGURED; - strlcpy(sc->sc_tidmap[i].it_dvname, dv->dv_xname, - sizeof sc->sc_tidmap[i].it_dvname); - } - } -} - -/* - * Adjust queue parameters for all child devices. - */ -void -iop_adjqparam(struct iop_softc *sc, int mpi) -{ - struct iop_initiator *ii; - - LIST_FOREACH(ii, &sc->sc_iilist, ii_list) - if (ii->ii_adjqparam != NULL) - (*ii->ii_adjqparam)(ii->ii_dv, mpi); -} - -void -iop_devinfo(int class, char *devinfo, size_t di_len) -{ -#ifdef I2OVERBOSE - int i; - - for (i = 0; i < sizeof(iop_class) / sizeof(iop_class[0]); i++) - if (class == iop_class[i].ic_class) - break; - - if (i == sizeof(iop_class) / sizeof(iop_class[0])) - snprintf(devinfo, di_len, "device (class 0x%x)", class); - else - strlcpy(devinfo, iop_class[i].ic_caption, di_len); -#else - - snprintf(devinfo, di_len, "device (class 0x%x)", class); -#endif -} - -int -iop_print(void *aux, const char *pnp) -{ - struct iop_attach_args *ia; - char devinfo[256]; - - ia = aux; - - if (pnp != NULL) { - iop_devinfo(ia->ia_class, devinfo, sizeof devinfo); - printf("%s at %s", devinfo, pnp); - } - printf(" tid %d", ia->ia_tid); - return (UNCONF); -} - -#ifdef notyet -int -iop_vendor_print(void *aux, const char *pnp) -{ - - if (pnp != NULL) - printf("vendor specific extension at %s", pnp); - return (UNCONF); -} -#endif - -int -iop_submatch(struct device *parent, void *vcf, void *aux) -{ - struct cfdata *cf = vcf; - struct iop_attach_args *ia; - - ia = aux; - - if (cf->iopcf_tid != IOPCF_TID_DEFAULT && cf->iopcf_tid != ia->ia_tid) - return (0); - - return ((*cf->cf_attach->ca_match)(parent, cf, aux)); -} - -/* - * Shut down all configured IOPs. - */ -void -iop_shutdown(void *v) -{ - struct iop_softc *sc = v; - - if ((sc->sc_flags & IOP_ONLINE) == 0) - return; - - iop_simple_cmd(sc, I2O_TID_IOP, I2O_EXEC_SYS_QUIESCE, IOP_ICTX, - 0, 5000); - - if (letoh16(sc->sc_status.orgid) != I2O_ORG_AMI) { - /* - * Some AMI firmware revisions will go to sleep and - * never come back after this. - */ - iop_simple_cmd(sc, I2O_TID_IOP, I2O_EXEC_IOP_CLEAR, - IOP_ICTX, 0, 1000); - } - - /* Wait. Some boards could still be flushing, stupidly enough. */ - delay(5000*1000); -} - -/* - * Retrieve IOP status. - */ -int -iop_status_get(struct iop_softc *sc, int nosleep) -{ - struct i2o_exec_status_get mf; - paddr_t pa = sc->sc_scr_seg->ds_addr; - struct i2o_status *st = (struct i2o_status *)sc->sc_scr; - int rv; - - mf.msgflags = I2O_MSGFLAGS(i2o_exec_status_get); - mf.msgfunc = I2O_MSGFUNC(I2O_TID_IOP, I2O_EXEC_STATUS_GET); - mf.reserved[0] = 0; - mf.reserved[1] = 0; - mf.reserved[2] = 0; - mf.reserved[3] = 0; - mf.addrlow = pa & ~(u_int32_t)0; - mf.addrhigh = sizeof pa > sizeof mf.addrlow ? pa >> 32 : 0; - mf.length = sizeof(*st); - - bzero(st, sizeof(*st)); - bus_dmamap_sync(sc->sc_dmat, sc->sc_scr_dmamap, 0, sizeof(*st), - BUS_DMASYNC_PREREAD); - - if ((rv = iop_post(sc, (u_int32_t *)&mf))) - return (rv); - - /* XXX */ - POLL(2500, - (bus_dmamap_sync(sc->sc_dmat, sc->sc_scr_dmamap, 0, - sizeof(*st), BUS_DMASYNC_POSTREAD), st->syncbyte == 0xff)); - - if (st->syncbyte != 0xff) - return (EIO); - - bcopy(st, &sc->sc_status, sizeof(sc->sc_status)); - return (0); -} - -/* - * Initialize and populate the IOP's outbound FIFO. - */ -int -iop_ofifo_init(struct iop_softc *sc) -{ - bus_addr_t addr; - bus_dma_segment_t seg; - struct i2o_exec_outbound_init *mf; - u_int32_t mb[IOP_MAX_MSG_SIZE / sizeof(u_int32_t)]; - u_int32_t *sw = (u_int32_t *)sc->sc_scr; - int i, rseg, rv; - - mf = (struct i2o_exec_outbound_init *)mb; - mf->msgflags = I2O_MSGFLAGS(i2o_exec_outbound_init); - mf->msgfunc = I2O_MSGFUNC(I2O_TID_IOP, I2O_EXEC_OUTBOUND_INIT); - mf->msgictx = IOP_ICTX; - mf->msgtctx = 0; - mf->pagesize = PAGE_SIZE; - mf->flags = IOP_INIT_CODE | ((IOP_MAX_MSG_SIZE >> 2) << 16); - mb[sizeof(*mf) / sizeof(u_int32_t) + 0] = sizeof(*sw) | - I2O_SGL_SIMPLE | I2O_SGL_END_BUFFER | I2O_SGL_END; - mb[sizeof(*mf) / sizeof(u_int32_t) + 1] = sc->sc_scr_seg->ds_addr; - mb[0] += 2 << 16; - - *sw = 0; - bus_dmamap_sync(sc->sc_dmat, sc->sc_scr_dmamap, 0, sizeof(*sw), - BUS_DMASYNC_PREREAD); - - /* - * The I2O spec says that there are two SGLs: one for the status - * word, and one for a list of discarded MFAs. It continues to say - * that if you don't want to get the list of MFAs, an IGNORE SGL is - * necessary; this isn't the case (and is in fact a bad thing). - */ - if ((rv = iop_post(sc, mb))) - return (rv); - - /* XXX */ - POLL(5000, - (bus_dmamap_sync(sc->sc_dmat, sc->sc_scr_dmamap, 0, sizeof(*sw), - BUS_DMASYNC_POSTREAD), - *sw == htole32(I2O_EXEC_OUTBOUND_INIT_COMPLETE))); - if (*sw != htole32(I2O_EXEC_OUTBOUND_INIT_COMPLETE)) { - printf("%s: outbound FIFO init failed (%d)\n", - sc->sc_dv.dv_xname, letoh32(*sw)); - return (EIO); - } - - /* Allocate DMA safe memory for the reply frames. */ - if (sc->sc_rep_phys == 0) { - sc->sc_rep_size = sc->sc_maxob * IOP_MAX_MSG_SIZE; - - rv = bus_dmamem_alloc(sc->sc_dmat, sc->sc_rep_size, PAGE_SIZE, - 0, &seg, 1, &rseg, BUS_DMA_NOWAIT); - if (rv != 0) { - printf("%s: dma alloc = %d\n", sc->sc_dv.dv_xname, - rv); - return (rv); - } - - rv = bus_dmamem_map(sc->sc_dmat, &seg, rseg, sc->sc_rep_size, - &sc->sc_rep, BUS_DMA_NOWAIT | BUS_DMA_COHERENT); - if (rv != 0) { - printf("%s: dma map = %d\n", sc->sc_dv.dv_xname, rv); - return (rv); - } - - rv = bus_dmamap_create(sc->sc_dmat, sc->sc_rep_size, 1, - sc->sc_rep_size, 0, BUS_DMA_NOWAIT, &sc->sc_rep_dmamap); - if (rv != 0) { - printf("%s: dma create = %d\n", sc->sc_dv.dv_xname, - rv); - return (rv); - } - - rv = bus_dmamap_load(sc->sc_dmat, sc->sc_rep_dmamap, - sc->sc_rep, sc->sc_rep_size, NULL, BUS_DMA_NOWAIT); - if (rv != 0) { - printf("%s: dma load = %d\n", sc->sc_dv.dv_xname, rv); - return (rv); - } - - sc->sc_rep_phys = sc->sc_rep_dmamap->dm_segs[0].ds_addr; - } - - /* Populate the outbound FIFO. */ - for (i = sc->sc_maxob, addr = sc->sc_rep_phys; i != 0; i--) { - iop_outl(sc, IOP_REG_OFIFO, (u_int32_t)addr); - addr += IOP_MAX_MSG_SIZE; - } - - return (0); -} - -/* - * Read the specified number of bytes from the IOP's hardware resource table. - */ -int -iop_hrt_get0(struct iop_softc *sc, struct i2o_hrt *hrt, size_t size) -{ - struct iop_msg *im; - struct i2o_exec_hrt_get *mf; - u_int32_t mb[IOP_MAX_MSG_SIZE / sizeof(u_int32_t)]; - int rv; - - im = iop_msg_alloc(sc, NULL, IM_WAIT); - mf = (struct i2o_exec_hrt_get *)mb; - mf->msgflags = I2O_MSGFLAGS(i2o_exec_hrt_get); - mf->msgfunc = I2O_MSGFUNC(I2O_TID_IOP, I2O_EXEC_HRT_GET); - mf->msgictx = IOP_ICTX; - mf->msgtctx = im->im_tctx; - - iop_msg_map(sc, im, mb, hrt, size, 0); - rv = iop_msg_post(sc, im, mb, 30000); - iop_msg_unmap(sc, im); - iop_msg_free(sc, im); - return (rv); -} - -/* - * Read the IOP's hardware resource table. - */ -int -iop_hrt_get(struct iop_softc *sc) -{ - struct i2o_hrt hrthdr, *hrt; - size_t size; - int rv; - - rv = iop_hrt_get0(sc, &hrthdr, sizeof(hrthdr)); - if (rv != 0) - return (rv); - - DPRINTF(("%s: %d hrt entries\n", sc->sc_dv.dv_xname, - letoh16(hrthdr.numentries))); - - size = sizeof(struct i2o_hrt) + - (letoh16(hrthdr.numentries) - 1) * sizeof(struct i2o_hrt_entry); - hrt = (struct i2o_hrt *)malloc(size, M_DEVBUF, M_NOWAIT); - if (!hrt) - return (ENOMEM); - - if ((rv = iop_hrt_get0(sc, hrt, size)) != 0) { - free(hrt, M_DEVBUF); - return (rv); - } - - if (sc->sc_hrt != NULL) - free(sc->sc_hrt, M_DEVBUF); - sc->sc_hrt = hrt; - return (0); -} - -/* - * Request the specified number of bytes from the IOP's logical - * configuration table. If a change indicator is specified, this - * is a verbatim notification request, so the caller is prepared - * to wait indefinitely. - */ -int -iop_lct_get0(struct iop_softc *sc, struct i2o_lct *lct, size_t size, - u_int32_t chgind) -{ - struct iop_msg *im; - struct i2o_exec_lct_notify *mf; - int rv; - u_int32_t mb[IOP_MAX_MSG_SIZE / sizeof(u_int32_t)]; - - im = iop_msg_alloc(sc, NULL, IM_WAIT); - memset(lct, 0, size); - - mf = (struct i2o_exec_lct_notify *)mb; - mf->msgflags = I2O_MSGFLAGS(i2o_exec_lct_notify); - mf->msgfunc = I2O_MSGFUNC(I2O_TID_IOP, I2O_EXEC_LCT_NOTIFY); - mf->msgictx = IOP_ICTX; - mf->msgtctx = im->im_tctx; - mf->classid = I2O_CLASS_ANY; - mf->changeindicator = chgind; - -#ifdef I2ODEBUG - printf("iop_lct_get0: reading LCT"); - if (chgind != 0) - printf(" (async)"); - printf("\n"); -#endif - - iop_msg_map(sc, im, mb, lct, size, 0); - rv = iop_msg_post(sc, im, mb, (chgind == 0 ? 120*1000 : 0)); - iop_msg_unmap(sc, im); - iop_msg_free(sc, im); - return (rv); -} - -/* - * Read the IOP's logical configuration table. - */ -int -iop_lct_get(struct iop_softc *sc) -{ - size_t esize, size; - int rv; - struct i2o_lct *lct; - - esize = letoh32(sc->sc_status.expectedlctsize); - lct = malloc(esize, M_DEVBUF, M_WAITOK | M_CANFAIL); - if (lct == NULL) - return (ENOMEM); - - if ((rv = iop_lct_get0(sc, lct, esize, 0)) != 0) { - free(lct, M_DEVBUF); - return (rv); - } - - size = letoh16(lct->tablesize) << 2; - if (esize != size) { - free(lct, M_DEVBUF); - lct = malloc(size, M_DEVBUF, M_WAITOK | M_CANFAIL); - if (lct == NULL) - return (ENOMEM); - - if ((rv = iop_lct_get0(sc, lct, size, 0)) != 0) { - free(lct, M_DEVBUF); - return (rv); - } - } - - /* Swap in the new LCT. */ - if (sc->sc_lct != NULL) - free(sc->sc_lct, M_DEVBUF); - sc->sc_lct = lct; - sc->sc_nlctent = ((letoh16(sc->sc_lct->tablesize) << 2) - - sizeof(struct i2o_lct) + sizeof(struct i2o_lct_entry)) / - sizeof(struct i2o_lct_entry); - return (0); -} - -/* - * Request the specified parameter group from the target. If an initiator - * is specified (a) don't wait for the operation to complete, but instead - * let the initiator's interrupt handler deal with the reply and (b) place a - * pointer to the parameter group op in the wrapper's `im_dvcontext' field. - */ -int -iop_param_op(struct iop_softc *sc, int tid, struct iop_initiator *ii, - int write, int group, void *buf, size_t size) -{ - struct iop_msg *im; - struct i2o_util_params_op *mf; - struct i2o_reply *rf; - int rv, func, op; - struct iop_pgop *pgop; - u_int32_t mb[IOP_MAX_MSG_SIZE / sizeof(u_int32_t)]; - - im = iop_msg_alloc(sc, ii, (ii == NULL ? IM_WAIT : 0) | IM_NOSTATUS); - pgop = malloc(sizeof(*pgop), M_DEVBUF, M_WAITOK | M_CANFAIL); - if (pgop == NULL) { - iop_msg_free(sc, im); - return (ENOMEM); - } - rf = malloc(sizeof(*rf), M_DEVBUF, M_WAITOK | M_CANFAIL); - if (rf == NULL) { - iop_msg_free(sc, im); - free(pgop, M_DEVBUF); - return (ENOMEM); - } - im->im_dvcontext = pgop; - im->im_rb = rf; - - if (write) { - func = I2O_UTIL_PARAMS_SET; - op = I2O_PARAMS_OP_FIELD_SET; - } else { - func = I2O_UTIL_PARAMS_GET; - op = I2O_PARAMS_OP_FIELD_GET; - } - - mf = (struct i2o_util_params_op *)mb; - mf->msgflags = I2O_MSGFLAGS(i2o_util_params_op); - mf->msgfunc = I2O_MSGFUNC(tid, func); - mf->msgictx = IOP_ICTX; - mf->msgtctx = im->im_tctx; - mf->flags = 0; - - pgop->olh.count = htole16(1); - pgop->olh.reserved = htole16(0); - pgop->oat.operation = htole16(op); - pgop->oat.fieldcount = htole16(0xffff); - pgop->oat.group = htole16(group); - - memset(buf, 0, size); - iop_msg_map(sc, im, mb, pgop, sizeof(*pgop), 1); - iop_msg_map(sc, im, mb, buf, size, write); - rv = iop_msg_post(sc, im, mb, (ii == NULL ? 30000 : 0)); - - /* Detect errors; let partial transfers to count as success. */ - if (ii == NULL && rv == 0) { - if (rf->reqstatus == I2O_STATUS_ERROR_PARTIAL_XFER && - rf->detail == htole16(I2O_DSC_UNKNOWN_ERROR)) - rv = 0; - else - rv = (rf->reqstatus != 0 ? EIO : 0); - } - - if (ii == NULL || rv != 0) { - iop_msg_unmap(sc, im); - iop_msg_free(sc, im); - free(pgop, M_DEVBUF); - free(rf, M_DEVBUF); - } - - return (rv); -} - -/* - * Execute a simple command (no parameters). - */ -int -iop_simple_cmd(struct iop_softc *sc, int tid, int function, int ictx, - int async, int timo) -{ - struct iop_msg *im; - struct i2o_msg mf; - int rv, fl; - - fl = (async != 0 ? IM_WAIT : IM_POLL); - im = iop_msg_alloc(sc, NULL, fl); - - mf.msgflags = I2O_MSGFLAGS(i2o_msg); - mf.msgfunc = I2O_MSGFUNC(tid, function); - mf.msgictx = ictx; - mf.msgtctx = im->im_tctx; - - rv = iop_msg_post(sc, im, &mf, timo); - iop_msg_free(sc, im); - return (rv); -} - -/* - * Post the system table to the IOP. - */ -int -iop_systab_set(struct iop_softc *sc) -{ - struct i2o_exec_sys_tab_set *mf; - struct iop_msg *im; - bus_space_handle_t bsh; - bus_addr_t boo; - u_int32_t mema[2], ioa[2]; - int rv; - u_int32_t mb[IOP_MAX_MSG_SIZE / sizeof(u_int32_t)]; - - im = iop_msg_alloc(sc, NULL, IM_WAIT); - - mf = (struct i2o_exec_sys_tab_set *)mb; - mf->msgflags = I2O_MSGFLAGS(i2o_exec_sys_tab_set); - mf->msgfunc = I2O_MSGFUNC(I2O_TID_IOP, I2O_EXEC_SYS_TAB_SET); - mf->msgictx = IOP_ICTX; - mf->msgtctx = im->im_tctx; - mf->iopid = (sc->sc_dv.dv_unit + 2) << 12; - mf->segnumber = 0; - - mema[1] = sc->sc_status.desiredprivmemsize; - ioa[1] = sc->sc_status.desiredpriviosize; - - if (mema[1] != 0) { - /* - * XXX This will waste virtual memory. We need a flag to tell - * bus_space_alloc to just reserve, not actually map the area. - */ - rv = bus_space_alloc(sc->sc_bus_memt, 0, 0xffffffff, - letoh32(mema[1]), PAGE_SIZE, 0, 0, &boo, &bsh); - mema[0] = htole32(boo); - if (rv != 0) { - printf("%s: can't alloc priv mem space, err = %d\n", - sc->sc_dv.dv_xname, rv); - mema[0] = 0; - mema[1] = 0; - } - } - - if (ioa[1] != 0) { - /* - * XXX This will potentially waste virtual memory. We - * need a flag to tell bus_space_alloc to just - * reserve, not actually map the area. - */ - rv = bus_space_alloc(sc->sc_bus_iot, 0, 0xffff, - letoh32(ioa[1]), 0, 0, 0, &boo, &bsh); - ioa[0] = htole32(boo); - if (rv != 0) { - printf("%s: can't alloc priv i/o space, err = %d\n", - sc->sc_dv.dv_xname, rv); - ioa[0] = 0; - ioa[1] = 0; - } - } - - iop_msg_map(sc, im, mb, iop_systab, iop_systab_size, 1); - iop_msg_map(sc, im, mb, mema, sizeof(mema), 1); - iop_msg_map(sc, im, mb, ioa, sizeof(ioa), 1); - rv = iop_msg_post(sc, im, mb, 5000); - iop_msg_unmap(sc, im); - iop_msg_free(sc, im); - return (rv); -} - -/* - * Reset the IOP. Must be called with interrupts disabled. - */ -int -iop_reset(struct iop_softc *sc) -{ - struct i2o_exec_iop_reset mf; - paddr_t pa = sc->sc_scr_seg->ds_addr; - u_int32_t *sw = (u_int32_t *)sc->sc_scr; - u_int32_t mfa; - int rv = 0; - - mf.msgflags = I2O_MSGFLAGS(i2o_exec_iop_reset); - mf.msgfunc = I2O_MSGFUNC(I2O_TID_IOP, I2O_EXEC_IOP_RESET); - mf.reserved[0] = 0; - mf.reserved[1] = 0; - mf.reserved[2] = 0; - mf.reserved[3] = 0; - mf.statuslow = pa & ~(u_int32_t)0; - mf.statushigh = sizeof pa > sizeof mf.statuslow ? pa >> 32 : 0; - - *sw = htole32(0); - bus_dmamap_sync(sc->sc_dmat, sc->sc_scr_dmamap, 0, sizeof(*sw), - BUS_DMASYNC_PREREAD); - - if ((rv = iop_post(sc, (u_int32_t *)&mf))) - return (rv); - - /* XXX */ - POLL(2500, - (bus_dmamap_sync(sc->sc_dmat, sc->sc_scr_dmamap, 0, sizeof(*sw), - BUS_DMASYNC_POSTREAD), *sw != htole32(0))); - if (*sw != htole32(I2O_RESET_IN_PROGRESS)) { - printf("%s: reset rejected, status 0x%x\n", - sc->sc_dv.dv_xname, letoh32(*sw)); - return (EIO); - } - - /* - * IOP is now in the INIT state. Wait no more than 10 seconds for - * the inbound queue to become responsive. - */ - POLL(10000, (mfa = iop_inl(sc, IOP_REG_IFIFO)) != IOP_MFA_EMPTY); - if (mfa == IOP_MFA_EMPTY) { - printf("%s: reset failed\n", sc->sc_dv.dv_xname); - return (EIO); - } - - iop_release_mfa(sc, mfa); - - return (0); -} - -/* - * Register a new initiator. Must be called with the configuration lock - * held. - */ -void -iop_initiator_register(struct iop_softc *sc, struct iop_initiator *ii) -{ - static int ictxgen; - int s; - - /* 0 is reserved (by us) for system messages. */ - ii->ii_ictx = ++ictxgen; - - /* - * `Utility initiators' don't make it onto the per-IOP initiator list - * (which is used only for configuration), but do get one slot on - * the inbound queue. - */ - if ((ii->ii_flags & II_UTILITY) == 0) { - LIST_INSERT_HEAD(&sc->sc_iilist, ii, ii_list); - sc->sc_nii++; - } else - sc->sc_nuii++; - - s = splbio(); - LIST_INSERT_HEAD(IOP_ICTXHASH(ii->ii_ictx), ii, ii_hash); - splx(s); -} - -/* - * Unregister an initiator. Must be called with the configuration lock - * held. - */ -void -iop_initiator_unregister(struct iop_softc *sc, struct iop_initiator *ii) -{ - int s; - - if ((ii->ii_flags & II_UTILITY) == 0) { - LIST_REMOVE(ii, ii_list); - sc->sc_nii--; - } else - sc->sc_nuii--; - - s = splbio(); - LIST_REMOVE(ii, ii_hash); - splx(s); -} - -/* - * Handle a reply frame from the IOP. - */ -int -iop_handle_reply(struct iop_softc *sc, u_int32_t rmfa) -{ - struct iop_msg *im; - struct i2o_reply *rb; - struct i2o_fault_notify *fn; - struct iop_initiator *ii; - u_int off, ictx, tctx, status, size; - - off = (int)(rmfa - sc->sc_rep_phys); - rb = (struct i2o_reply *)(sc->sc_rep + off); - - /* Perform reply queue DMA synchronisation. XXX This is rubbish. */ - bus_dmamap_sync(sc->sc_dmat, sc->sc_rep_dmamap, off, - sc->sc_rep_dmamap->dm_mapsize, BUS_DMASYNC_POSTREAD); - if (--sc->sc_curib != 0) - bus_dmamap_sync(sc->sc_dmat, sc->sc_rep_dmamap, 0, - sc->sc_rep_size, BUS_DMASYNC_PREREAD); - -#ifdef I2ODEBUG - if ((letoh32(rb->msgflags) & I2O_MSGFLAGS_64BIT) != 0) - panic("iop_handle_reply: 64-bit reply"); -#endif - /* - * Find the initiator. - */ - ictx = letoh32(rb->msgictx); - if (ictx == IOP_ICTX) - ii = NULL; - else { - ii = LIST_FIRST(IOP_ICTXHASH(ictx)); - for (; ii != NULL; ii = LIST_NEXT(ii, ii_hash)) - if (ii->ii_ictx == ictx) - break; - if (ii == NULL) { -#ifdef I2ODEBUG - iop_reply_print(sc, rb); -#endif - printf("%s: WARNING: bad ictx returned (%x)\n", - sc->sc_dv.dv_xname, ictx); - return (-1); - } - } - - /* - * If we received a transport failure notice, we've got to dig the - * transaction context (if any) out of the original message frame, - * and then release the original MFA back to the inbound FIFO. - */ - if ((rb->msgflags & I2O_MSGFLAGS_FAIL) != 0) { - status = I2O_STATUS_SUCCESS; - - fn = (struct i2o_fault_notify *)rb; - tctx = iop_inl(sc, fn->lowmfa + 12); /* XXX */ - iop_release_mfa(sc, fn->lowmfa); - iop_tfn_print(sc, fn); - } else { - status = rb->reqstatus; - tctx = letoh32(rb->msgtctx); - } - - if (ii == NULL || (ii->ii_flags & II_DISCARD) == 0) { - /* - * This initiator tracks state using message wrappers. - * - * Find the originating message wrapper, and if requested - * notify the initiator. - */ - im = sc->sc_ims + (tctx & IOP_TCTX_MASK); - if ((tctx & IOP_TCTX_MASK) > sc->sc_maxib || - (im->im_flags & IM_ALLOCED) == 0 || - tctx != im->im_tctx) { - printf("%s: WARNING: bad tctx returned (0x%08x, %p)\n", - sc->sc_dv.dv_xname, tctx, im); - if (im != NULL) - printf("%s: flags=0x%08x tctx=0x%08x\n", - sc->sc_dv.dv_xname, im->im_flags, - im->im_tctx); -#ifdef I2ODEBUG - if ((rb->msgflags & I2O_MSGFLAGS_FAIL) == 0) - iop_reply_print(sc, rb); -#endif - return (-1); - } - - if ((rb->msgflags & I2O_MSGFLAGS_FAIL) != 0) - im->im_flags |= IM_FAIL; - -#ifdef I2ODEBUG - if ((im->im_flags & IM_REPLIED) != 0) - panic("%s: dup reply", sc->sc_dv.dv_xname); -#endif - im->im_flags |= IM_REPLIED; - -#ifdef I2ODEBUG - if (status != I2O_STATUS_SUCCESS) - iop_reply_print(sc, rb); -#endif - im->im_reqstatus = status; - - /* Copy the reply frame, if requested. */ - if (im->im_rb != NULL) { - size = (letoh32(rb->msgflags) >> 14) & ~3; -#ifdef I2ODEBUG - if (size > IOP_MAX_MSG_SIZE) - panic("iop_handle_reply: reply too large"); -#endif - memcpy(im->im_rb, rb, size); - } - - /* Notify the initiator. */ - if ((im->im_flags & IM_WAIT) != 0) - wakeup(im); - else if ((im->im_flags & (IM_POLL | IM_POLL_INTR)) != IM_POLL) - (*ii->ii_intr)(ii->ii_dv, im, rb); - } else { - /* - * This initiator discards message wrappers. - * - * Simply pass the reply frame to the initiator. - */ - (*ii->ii_intr)(ii->ii_dv, NULL, rb); - } - - return (status); -} - -/* - * Handle an interrupt from the IOP. - */ -int -iop_intr(void *arg) -{ - struct iop_softc *sc; - u_int32_t rmfa; - - sc = arg; - - if ((iop_inl(sc, IOP_REG_INTR_STATUS) & IOP_INTR_OFIFO) == 0) - return (0); - - for (;;) { - /* Double read to account for IOP bug. */ - if ((rmfa = iop_inl(sc, IOP_REG_OFIFO)) == IOP_MFA_EMPTY) { - rmfa = iop_inl(sc, IOP_REG_OFIFO); - if (rmfa == IOP_MFA_EMPTY) - break; - } - iop_handle_reply(sc, rmfa); - iop_outl(sc, IOP_REG_OFIFO, rmfa); - } - - return (1); -} - -/* - * Handle an event signalled by the executive. - */ -void -iop_intr_event(struct device *dv, struct iop_msg *im, void *reply) -{ - struct i2o_util_event_register_reply *rb; - u_int event; - - rb = reply; - - if ((rb->msgflags & I2O_MSGFLAGS_FAIL) != 0) - return; - - event = letoh32(rb->event); - printf("%s: event 0x%08x received\n", dv->dv_xname, event); -} - -/* - * Allocate a message wrapper. - */ -struct iop_msg * -iop_msg_alloc(struct iop_softc *sc, struct iop_initiator *ii, int flags) -{ - struct iop_msg *im; - static u_int tctxgen; - int s, i; - -#ifdef I2ODEBUG - if ((flags & IM_SYSMASK) != 0) - panic("iop_msg_alloc: system flags specified"); -#endif - - s = splbio(); /* XXX */ - im = SLIST_FIRST(&sc->sc_im_freelist); -#if defined(DIAGNOSTIC) || defined(I2ODEBUG) - if (im == NULL) - panic("iop_msg_alloc: no free wrappers"); -#endif - SLIST_REMOVE_HEAD(&sc->sc_im_freelist, im_chain); - splx(s); - - if (ii != NULL && (ii->ii_flags & II_DISCARD) != 0) - flags |= IM_DISCARD; - - im->im_tctx = (im->im_tctx & IOP_TCTX_MASK) | tctxgen; - tctxgen += (1 << IOP_TCTX_SHIFT); - im->im_flags = flags | IM_ALLOCED; - im->im_rb = NULL; - i = 0; - do { - im->im_xfer[i++].ix_size = 0; - } while (i < IOP_MAX_MSG_XFERS); - - return (im); -} - -/* - * Free a message wrapper. - */ -void -iop_msg_free(struct iop_softc *sc, struct iop_msg *im) -{ - int s; - -#ifdef I2ODEBUG - if ((im->im_flags & IM_ALLOCED) == 0) - panic("iop_msg_free: wrapper not allocated"); -#endif - - im->im_flags = 0; - s = splbio(); - SLIST_INSERT_HEAD(&sc->sc_im_freelist, im, im_chain); - splx(s); -} - -/* - * Map a data transfer. Write a scatter-gather list into the message frame. - */ -int -iop_msg_map(struct iop_softc *sc, struct iop_msg *im, u_int32_t *mb, - void *xferaddr, size_t xfersize, int out) -{ - bus_dmamap_t dm; - bus_dma_segment_t *ds; - struct iop_xfer *ix; - u_int rv, i, nsegs, flg, off, xn; - u_int32_t *p; - - for (xn = 0, ix = im->im_xfer; xn < IOP_MAX_MSG_XFERS; xn++, ix++) - if (ix->ix_size == 0) - break; - -#ifdef I2ODEBUG - if (xfersize == 0) - panic("iop_msg_map: null transfer"); - if (xfersize > IOP_MAX_XFER) - panic("iop_msg_map: transfer too large"); - if (xn == IOP_MAX_MSG_XFERS) - panic("iop_msg_map: too many xfers"); -#endif - - /* - * Only the first DMA map is static. - */ - if (xn != 0) { - rv = bus_dmamap_create(sc->sc_dmat, IOP_MAX_XFER, - IOP_MAX_SEGS, IOP_MAX_XFER, 0, - BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &ix->ix_map); - if (rv != 0) - return (rv); - } - - dm = ix->ix_map; - rv = bus_dmamap_load(sc->sc_dmat, dm, xferaddr, xfersize, NULL, 0); - if (rv != 0) - goto bad; - - /* - * How many SIMPLE SG elements can we fit in this message? - */ - off = mb[0] >> 16; - p = mb + off; - nsegs = ((IOP_MAX_MSG_SIZE / sizeof *mb) - off) >> 1; - - if (dm->dm_nsegs > nsegs) { - bus_dmamap_unload(sc->sc_dmat, ix->ix_map); - rv = EFBIG; - DPRINTF(("iop_msg_map: too many segs\n")); - goto bad; - } - - nsegs = dm->dm_nsegs; - xfersize = 0; - - /* - * Write out the SG list. - */ - if (out) - flg = I2O_SGL_SIMPLE | I2O_SGL_DATA_OUT; - else - flg = I2O_SGL_SIMPLE; - - for (i = nsegs, ds = dm->dm_segs; i > 1; i--, p += 2, ds++) { - p[0] = (u_int32_t)ds->ds_len | flg; - p[1] = (u_int32_t)ds->ds_addr; - xfersize += ds->ds_len; - } - - p[0] = (u_int32_t)ds->ds_len | flg | I2O_SGL_END_BUFFER; - p[1] = (u_int32_t)ds->ds_addr; - xfersize += ds->ds_len; - - /* Fix up the transfer record, and sync the map. */ - ix->ix_flags = (out ? IX_OUT : IX_IN); - ix->ix_size = xfersize; - bus_dmamap_sync(sc->sc_dmat, ix->ix_map, 0, xfersize, - out ? BUS_DMASYNC_POSTWRITE : BUS_DMASYNC_POSTREAD); - - /* - * If this is the first xfer we've mapped for this message, adjust - * the SGL offset field in the message header. - */ - if ((im->im_flags & IM_SGLOFFADJ) == 0) { - mb[0] += (mb[0] >> 12) & 0xf0; - im->im_flags |= IM_SGLOFFADJ; - } - mb[0] += (nsegs << 17); - return (0); - - bad: - if (xn != 0) - bus_dmamap_destroy(sc->sc_dmat, ix->ix_map); - return (rv); -} - -/* - * Map a block I/O data transfer (different in that there's only one per - * message maximum, and PAGE addressing may be used). Write a scatter - * gather list into the message frame. - */ -int -iop_msg_map_bio(struct iop_softc *sc, struct iop_msg *im, u_int32_t *mb, - void *xferaddr, int xfersize, int out) -{ - bus_dma_segment_t *ds; - bus_dmamap_t dm; - struct iop_xfer *ix; - u_int rv, i, nsegs, off, slen, tlen, flg; - paddr_t saddr, eaddr; - u_int32_t *p; - -#ifdef I2ODEBUG - if (xfersize == 0) - panic("iop_msg_map_bio: null transfer"); - if (xfersize > IOP_MAX_XFER) - panic("iop_msg_map_bio: transfer too large"); - if ((im->im_flags & IM_SGLOFFADJ) != 0) - panic("iop_msg_map_bio: SGLOFFADJ"); -#endif - - ix = im->im_xfer; - dm = ix->ix_map; - rv = bus_dmamap_load(sc->sc_dmat, dm, xferaddr, xfersize, NULL, 0); - if (rv != 0) - return (rv); - - off = mb[0] >> 16; - nsegs = ((IOP_MAX_MSG_SIZE / 4) - off) >> 1; - - /* - * If the transfer is highly fragmented and won't fit using SIMPLE - * elements, use PAGE_LIST elements instead. SIMPLE elements are - * potentially more efficient, both for us and the IOP. - */ - if (dm->dm_nsegs > nsegs) { - nsegs = 1; - p = mb + off + 1; - - /* XXX This should be done with a bus_space flag. */ - for (i = dm->dm_nsegs, ds = dm->dm_segs; i > 0; i--, ds++) { - slen = ds->ds_len; - saddr = ds->ds_addr; - - while (slen > 0) { - eaddr = (saddr + PAGE_SIZE) & ~(PAGE_SIZE - 1); - tlen = min(eaddr - saddr, slen); - slen -= tlen; - *p++ = letoh32(saddr); - saddr = eaddr; - nsegs++; - } - } - - mb[off] = xfersize | I2O_SGL_PAGE_LIST | I2O_SGL_END_BUFFER | - I2O_SGL_END; - if (out) - mb[off] |= I2O_SGL_DATA_OUT; - } else { - p = mb + off; - nsegs = dm->dm_nsegs; - - if (out) - flg = I2O_SGL_SIMPLE | I2O_SGL_DATA_OUT; - else - flg = I2O_SGL_SIMPLE; - - for (i = nsegs, ds = dm->dm_segs; i > 1; i--, p += 2, ds++) { - p[0] = (u_int32_t)ds->ds_len | flg; - p[1] = (u_int32_t)ds->ds_addr; - } - - p[0] = (u_int32_t)ds->ds_len | flg | I2O_SGL_END_BUFFER | - I2O_SGL_END; - p[1] = (u_int32_t)ds->ds_addr; - nsegs <<= 1; - } - - /* Fix up the transfer record, and sync the map. */ - ix->ix_flags = (out ? IX_OUT : IX_IN); - ix->ix_size = xfersize; - bus_dmamap_sync(sc->sc_dmat, ix->ix_map, 0, - ix->ix_map->dm_mapsize, - out ? BUS_DMASYNC_POSTWRITE : BUS_DMASYNC_POSTREAD); - - /* - * Adjust the SGL offset and total message size fields. We don't - * set IM_SGLOFFADJ, since it's used only for SIMPLE elements. - */ - mb[0] += ((off << 4) + (nsegs << 16)); - return (0); -} - -/* - * Unmap all data transfers associated with a message wrapper. - */ -void -iop_msg_unmap(struct iop_softc *sc, struct iop_msg *im) -{ - struct iop_xfer *ix; - int i; - -#ifdef I2ODEBUG - if (im->im_xfer[0].ix_size == 0) - panic("iop_msg_unmap: no transfers mapped"); -#endif - - for (ix = im->im_xfer, i = 0;;) { - bus_dmamap_sync(sc->sc_dmat, ix->ix_map, 0, ix->ix_size, - ix->ix_flags & IX_OUT ? BUS_DMASYNC_POSTWRITE : - BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->sc_dmat, ix->ix_map); - - /* Only the first DMA map is static. */ - if (i != 0) - bus_dmamap_destroy(sc->sc_dmat, ix->ix_map); - if ((++ix)->ix_size == 0) - break; - if (++i >= IOP_MAX_MSG_XFERS) - break; - } -} - -/* - * Post a message frame to the IOP's inbound queue. - */ -int -iop_post(struct iop_softc *sc, u_int32_t *mb) -{ - u_int32_t mfa; - int s; - size_t size = mb[0] >> 14 & ~3; - - /* ZZZ */ - if (size > IOP_MAX_MSG_SIZE) - panic("iop_post: frame too large"); - -#ifdef I2ODEBUG - { - int i; - - printf("\niop_post\n"); - for (i = 0; i < size / sizeof *mb; i++) - printf("%4d %08x\n", i, mb[i]); - } -#endif - - s = splbio(); /* XXX */ - - /* Allocate a slot with the IOP. */ - if ((mfa = iop_inl(sc, IOP_REG_IFIFO)) == IOP_MFA_EMPTY) - if ((mfa = iop_inl(sc, IOP_REG_IFIFO)) == IOP_MFA_EMPTY) { - splx(s); - printf("%s: mfa not forthcoming\n", - sc->sc_dv.dv_xname); - return (EAGAIN); - } - -#ifdef I2ODEBUG - printf("mfa = %u\n", mfa); -#endif - - /* Copy out the message frame. */ - bus_space_write_region_4(sc->sc_iot, sc->sc_ioh, mfa, mb, - size / sizeof *mb); - bus_space_barrier(sc->sc_iot, sc->sc_ioh, mfa, size, - BUS_SPACE_BARRIER_WRITE); - - /* Post the MFA back to the IOP. */ - iop_outl(sc, IOP_REG_IFIFO, mfa); - - splx(s); - return (0); -} - -/* - * Post a message to the IOP and deal with completion. - */ -int -iop_msg_post(struct iop_softc *sc, struct iop_msg *im, void *xmb, int timo) -{ - u_int32_t *mb = xmb; - int rv, s; - size_t size = mb[0] >> 14 & 3; - - /* Terminate the scatter/gather list chain. */ - if ((im->im_flags & IM_SGLOFFADJ) != 0) - mb[size - 2] |= I2O_SGL_END; - - /* Perform reply buffer DMA synchronisation. */ - if (sc->sc_curib++ == 0) - bus_dmamap_sync(sc->sc_dmat, sc->sc_rep_dmamap, 0, - sc->sc_rep_size, BUS_DMASYNC_PREREAD); - - if ((rv = iop_post(sc, mb)) != 0) - return (rv); - - if ((im->im_flags & IM_DISCARD) != 0) - iop_msg_free(sc, im); - else if ((im->im_flags & IM_POLL) != 0 && timo == 0) { - /* XXX For ofifo_init(). */ - rv = 0; - } else if ((im->im_flags & (IM_POLL | IM_WAIT)) != 0) { - if ((im->im_flags & IM_POLL) != 0) - iop_msg_poll(sc, im, timo); - else - iop_msg_wait(sc, im, timo); - - s = splbio(); - if ((im->im_flags & IM_REPLIED) != 0) { - if ((im->im_flags & IM_NOSTATUS) != 0) - rv = 0; - else if ((im->im_flags & IM_FAIL) != 0) - rv = ENXIO; - else if (im->im_reqstatus != I2O_STATUS_SUCCESS) - rv = EIO; - else - rv = 0; - } else - rv = EBUSY; - splx(s); - } else - rv = 0; - - return (rv); -} - -/* - * Spin until the specified message is replied to. - */ -void -iop_msg_poll(struct iop_softc *sc, struct iop_msg *im, int timo) -{ - u_int32_t rmfa; - int s, status; - - s = splbio(); /* XXX */ - - /* Wait for completion. */ - for (timo *= 10; timo != 0; timo--) { - if ((iop_inl(sc, IOP_REG_INTR_STATUS) & IOP_INTR_OFIFO) != 0) { - /* Double read to account for IOP bug. */ - rmfa = iop_inl(sc, IOP_REG_OFIFO); - if (rmfa == IOP_MFA_EMPTY) - rmfa = iop_inl(sc, IOP_REG_OFIFO); - if (rmfa != IOP_MFA_EMPTY) { - status = iop_handle_reply(sc, rmfa); - - /* - * Return the reply frame to the IOP's - * outbound FIFO. - */ - iop_outl(sc, IOP_REG_OFIFO, rmfa); - } - } - if ((im->im_flags & IM_REPLIED) != 0) - break; - DELAY(100); - } - - if (timo == 0) { -#ifdef I2ODEBUG - printf("%s: poll - no reply\n", sc->sc_dv.dv_xname); - if (iop_status_get(sc, 1) != 0) - printf("iop_msg_poll: unable to retrieve status\n"); - else - printf("iop_msg_poll: IOP state = %d\n", - (letoh32(sc->sc_status.segnumber) >> 16) & 0xff); -#endif - } - - splx(s); -} - -/* - * Sleep until the specified message is replied to. - */ -void -iop_msg_wait(struct iop_softc *sc, struct iop_msg *im, int timo) -{ - int s, rv; - - s = splbio(); - if ((im->im_flags & IM_REPLIED) != 0) { - splx(s); - return; - } - rv = tsleep(im, PRIBIO, "iopmsg", timo * hz / 1000); - splx(s); - -#ifdef I2ODEBUG - if (rv != 0) { - printf("iop_msg_wait: tsleep() == %d\n", rv); - if (iop_status_get(sc, 0) != 0) - printf("iop_msg_wait: unable to retrieve status\n"); - else - printf("iop_msg_wait: IOP state = %d\n", - (letoh32(sc->sc_status.segnumber) >> 16) & 0xff); - } -#endif -} - -/* - * Release an unused message frame back to the IOP's inbound fifo. - */ -void -iop_release_mfa(struct iop_softc *sc, u_int32_t mfa) -{ - - /* Use the frame to issue a no-op. */ - iop_outl(sc, mfa, I2O_VERSION_11 | (4 << 16)); - iop_outl(sc, mfa + 4, I2O_MSGFUNC(I2O_TID_IOP, I2O_UTIL_NOP)); - iop_outl(sc, mfa + 8, 0); - iop_outl(sc, mfa + 12, 0); - - iop_outl(sc, IOP_REG_IFIFO, mfa); -} - -#ifdef I2ODEBUG -/* - * Dump a reply frame header. - */ -void -iop_reply_print(struct iop_softc *sc, struct i2o_reply *rb) -{ - u_int function, detail; -#ifdef I2OVERBOSE - const char *statusstr; -#endif - - function = (letoh32(rb->msgfunc) >> 24) & 0xff; - detail = letoh16(rb->detail); - - printf("%s: reply:\n", sc->sc_dv.dv_xname); - -#ifdef I2OVERBOSE - if (rb->reqstatus < sizeof(iop_status) / sizeof(iop_status[0])) - statusstr = iop_status[rb->reqstatus]; - else - statusstr = "undefined error code"; - - printf("%s: function=0x%02x status=0x%02x (%s)\n", - sc->sc_dv.dv_xname, function, rb->reqstatus, statusstr); -#else - printf("%s: function=0x%02x status=0x%02x\n", - sc->sc_dv.dv_xname, function, rb->reqstatus); -#endif - printf("%s: detail=0x%04x ictx=0x%08x tctx=0x%08x\n", - sc->sc_dv.dv_xname, detail, letoh32(rb->msgictx), - letoh32(rb->msgtctx)); - printf("%s: tidi=%d tidt=%d flags=0x%02x\n", sc->sc_dv.dv_xname, - (letoh32(rb->msgfunc) >> 12) & 4095, letoh32(rb->msgfunc) & 4095, - (letoh32(rb->msgflags) >> 8) & 0xff); -} -#endif - -/* - * Dump a transport failure reply. - */ -void -iop_tfn_print(struct iop_softc *sc, struct i2o_fault_notify *fn) -{ - - printf("%s: WARNING: transport failure:\n", sc->sc_dv.dv_xname); - - printf("%s: ictx=0x%08x tctx=0x%08x\n", sc->sc_dv.dv_xname, - letoh32(fn->msgictx), letoh32(fn->msgtctx)); - printf("%s: failurecode=0x%02x severity=0x%02x\n", - sc->sc_dv.dv_xname, fn->failurecode, fn->severity); - printf("%s: highestver=0x%02x lowestver=0x%02x\n", - sc->sc_dv.dv_xname, fn->highestver, fn->lowestver); -} - -/* - * Translate an I2O ASCII field into a C string. - */ -void -iop_strvis(struct iop_softc *sc, const char *src, int slen, char *dst, int dlen) -{ - int hc, lc, i, nit; - - dlen--; - lc = 0; - hc = 0; - i = 0; - - /* - * DPT use NUL as a space, whereas AMI use it as a terminator. The - * spec has nothing to say about it. Since AMI fields are usually - * filled with junk after the terminator, ... - */ - nit = (letoh16(sc->sc_status.orgid) != I2O_ORG_DPT); - - while (slen-- != 0 && dlen-- != 0) { - if (nit && *src == '\0') - break; - else if (*src <= 0x20 || *src >= 0x7f) { - if (hc) - dst[i++] = ' '; - } else { - hc = 1; - dst[i++] = *src; - lc = i; - } - src++; - } - - dst[lc] = '\0'; -} - -/* - * Retrieve the DEVICE_IDENTITY parameter group from the target and dump it. - */ -int -iop_print_ident(struct iop_softc *sc, int tid) -{ - struct { - struct i2o_param_op_results pr; - struct i2o_param_read_results prr; - struct i2o_param_device_identity di; - } __packed p; - char buf[32]; - int rv; - - rv = iop_param_op(sc, tid, NULL, 0, I2O_PARAM_DEVICE_IDENTITY, &p, - sizeof(p)); - if (rv != 0) - return (rv); - - iop_strvis(sc, p.di.vendorinfo, sizeof(p.di.vendorinfo), buf, - sizeof(buf)); - printf(" <%s, ", buf); - iop_strvis(sc, p.di.productinfo, sizeof(p.di.productinfo), buf, - sizeof(buf)); - printf("%s, ", buf); - iop_strvis(sc, p.di.revlevel, sizeof(p.di.revlevel), buf, sizeof(buf)); - printf("%s>", buf); - - return (0); -} - -/* - * Claim or unclaim the specified TID. - */ -int -iop_util_claim(struct iop_softc *sc, struct iop_initiator *ii, int release, - int flags) -{ - struct iop_msg *im; - struct i2o_util_claim mf; - int rv, func; - - func = release ? I2O_UTIL_CLAIM_RELEASE : I2O_UTIL_CLAIM; - im = iop_msg_alloc(sc, ii, IM_WAIT); - - /* We can use the same structure, as they're identical. */ - mf.msgflags = I2O_MSGFLAGS(i2o_util_claim); - mf.msgfunc = I2O_MSGFUNC(ii->ii_tid, func); - mf.msgictx = ii->ii_ictx; - mf.msgtctx = im->im_tctx; - mf.flags = flags; - - rv = iop_msg_post(sc, im, &mf, 5000); - iop_msg_free(sc, im); - return (rv); -} - -/* - * Perform an abort. - */ -int iop_util_abort(struct iop_softc *sc, struct iop_initiator *ii, int func, - int tctxabort, int flags) -{ - struct iop_msg *im; - struct i2o_util_abort mf; - int rv; - - im = iop_msg_alloc(sc, ii, IM_WAIT); - - mf.msgflags = I2O_MSGFLAGS(i2o_util_abort); - mf.msgfunc = I2O_MSGFUNC(ii->ii_tid, I2O_UTIL_ABORT); - mf.msgictx = ii->ii_ictx; - mf.msgtctx = im->im_tctx; - mf.flags = (func << 24) | flags; - mf.tctxabort = tctxabort; - - rv = iop_msg_post(sc, im, &mf, 5000); - iop_msg_free(sc, im); - return (rv); -} - -/* - * Enable or disable reception of events for the specified device. - */ -int iop_util_eventreg(struct iop_softc *sc, struct iop_initiator *ii, int mask) -{ - struct iop_msg *im; - struct i2o_util_event_register mf; - - im = iop_msg_alloc(sc, ii, 0); - - mf.msgflags = I2O_MSGFLAGS(i2o_util_event_register); - mf.msgfunc = I2O_MSGFUNC(ii->ii_tid, I2O_UTIL_EVENT_REGISTER); - mf.msgictx = ii->ii_ictx; - mf.msgtctx = im->im_tctx; - mf.eventmask = mask; - - /* This message is replied to only when events are signalled. */ - return (iop_msg_post(sc, im, &mf, 0)); -} - -int -iopopen(dev_t dev, int flag, int mode, struct proc *p) -{ - struct iop_softc *sc; - - if (!(sc = (struct iop_softc *)device_lookup(&iop_cd, minor(dev)))) - return (ENXIO); - if ((sc->sc_flags & IOP_ONLINE) == 0) - return (ENXIO); - if ((sc->sc_flags & IOP_OPEN) != 0) - return (EBUSY); - sc->sc_flags |= IOP_OPEN; - - sc->sc_ptb = malloc(IOP_MAX_XFER * IOP_MAX_MSG_XFERS, M_DEVBUF, - M_WAITOK | M_CANFAIL); - if (sc->sc_ptb == NULL) { - sc->sc_flags ^= IOP_OPEN; - return (ENOMEM); - } - - return (0); -} - -int -iopclose(dev_t dev, int flag, int mode, struct proc *p) -{ - struct iop_softc *sc; - - sc = (struct iop_softc *)device_lookup(&iop_cd, minor(dev)); /* XXX */ - free(sc->sc_ptb, M_DEVBUF); - sc->sc_flags &= ~IOP_OPEN; - return (0); -} - -int -iopioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) -{ - struct iop_softc *sc; - struct iovec *iov; - int rv, i; - - if (securelevel >= 2) - return (EPERM); - - sc = (struct iop_softc *)device_lookup(&iop_cd, minor(dev)); /* XXX */ - - switch (cmd) { - case IOPIOCPT: - return (iop_passthrough(sc, (struct ioppt *)data)); - - case IOPIOCGSTATUS: - iov = (struct iovec *)data; - i = sizeof(struct i2o_status); - if (i > iov->iov_len) - i = iov->iov_len; - else - iov->iov_len = i; - if ((rv = iop_status_get(sc, 0)) == 0) - rv = copyout(&sc->sc_status, iov->iov_base, i); - return (rv); - - case IOPIOCGLCT: - case IOPIOCGTIDMAP: - case IOPIOCRECONFIG: - break; - - default: -#if defined(DIAGNOSTIC) || defined(I2ODEBUG) - printf("%s: unknown ioctl %lx\n", sc->sc_dv.dv_xname, cmd); -#endif - return (ENOTTY); - } - - rw_enter_read(&sc->sc_conflock); - - switch (cmd) { - case IOPIOCGLCT: - iov = (struct iovec *)data; - i = letoh16(sc->sc_lct->tablesize) << 2; - if (i > iov->iov_len) - i = iov->iov_len; - else - iov->iov_len = i; - rv = copyout(sc->sc_lct, iov->iov_base, i); - break; - - case IOPIOCRECONFIG: - rv = iop_reconfigure(sc, 0); - break; - - case IOPIOCGTIDMAP: - iov = (struct iovec *)data; - i = sizeof(struct iop_tidmap) * sc->sc_nlctent; - if (i > iov->iov_len) - i = iov->iov_len; - else - iov->iov_len = i; - rv = copyout(sc->sc_tidmap, iov->iov_base, i); - break; - } - - rw_exit_read(&sc->sc_conflock); - return (rv); -} - -int -iop_passthrough(struct iop_softc *sc, struct ioppt *pt) -{ - struct iop_msg *im; - struct i2o_msg *mf; - struct ioppt_buf *ptb; - int rv, i, mapped; - void *buf; - - mf = NULL; - im = NULL; - mapped = 1; - - if (pt->pt_msglen > IOP_MAX_MSG_SIZE || - pt->pt_msglen > (letoh16(sc->sc_status.inboundmframesize) << 2) || - pt->pt_msglen < sizeof(struct i2o_msg) || - pt->pt_nbufs > IOP_MAX_MSG_XFERS || - pt->pt_nbufs < 0 || pt->pt_replylen < 0 || - pt->pt_timo < 1000 || pt->pt_timo > 5*60*1000) - return (EINVAL); - - for (i = 0; i < pt->pt_nbufs; i++) - if (pt->pt_bufs[i].ptb_datalen > IOP_MAX_XFER) { - rv = ENOMEM; - goto bad; - } - - mf = malloc(IOP_MAX_MSG_SIZE, M_DEVBUF, M_WAITOK | M_CANFAIL); - if (mf == NULL) - return (ENOMEM); - - if ((rv = copyin(pt->pt_msg, mf, pt->pt_msglen)) != 0) - goto bad; - - im = iop_msg_alloc(sc, NULL, IM_WAIT | IM_NOSTATUS); - im->im_rb = (struct i2o_reply *)mf; - mf->msgictx = IOP_ICTX; - mf->msgtctx = im->im_tctx; - - for (i = 0; i < pt->pt_nbufs; i++) { - ptb = &pt->pt_bufs[i]; - buf = sc->sc_ptb + i * IOP_MAX_XFER; - - if ((u_int)ptb->ptb_datalen > IOP_MAX_XFER) { - rv = EINVAL; - goto bad; - } - - if (ptb->ptb_out != 0) { - rv = copyin(ptb->ptb_data, buf, ptb->ptb_datalen); - if (rv != 0) - goto bad; - } - - rv = iop_msg_map(sc, im, (u_int32_t *)mf, buf, - ptb->ptb_datalen, ptb->ptb_out != 0); - if (rv != 0) - goto bad; - mapped = 1; - } - - if ((rv = iop_msg_post(sc, im, mf, pt->pt_timo)) != 0) - goto bad; - - i = (letoh32(im->im_rb->msgflags) >> 14) & ~3; - if (i > IOP_MAX_MSG_SIZE) - i = IOP_MAX_MSG_SIZE; - if (i > pt->pt_replylen) - i = pt->pt_replylen; - if ((rv = copyout(im->im_rb, pt->pt_reply, i)) != 0) - goto bad; - - iop_msg_unmap(sc, im); - mapped = 0; - - for (i = 0; i < pt->pt_nbufs; i++) { - ptb = &pt->pt_bufs[i]; - if (ptb->ptb_out != 0) - continue; - buf = sc->sc_ptb + i * IOP_MAX_XFER; - rv = copyout(buf, ptb->ptb_data, ptb->ptb_datalen); - if (rv != 0) - break; - } - - bad: - if (mapped != 0) - iop_msg_unmap(sc, im); - if (im != NULL) - iop_msg_free(sc, im); - if (mf != NULL) - free(mf, M_DEVBUF); - return (rv); -} diff --git a/sys/dev/i2o/iopio.h b/sys/dev/i2o/iopio.h deleted file mode 100644 index 5aa12ad54c1..00000000000 --- a/sys/dev/i2o/iopio.h +++ /dev/null @@ -1,72 +0,0 @@ -/* $OpenBSD: iopio.h,v 1.2 2008/06/26 05:42:15 ray Exp $ */ -/* $NetBSD$ */ - -/*- - * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Andrew Doran. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _I2O_IOPIO_H_ -#define _I2O_IOPIO_H_ - -#define IOP_MAX_MSG_XFERS 3 /* Maximum transfer count per msg */ -#define IOP_MAX_OUTBOUND 256 /* Maximum outbound queue depth */ -#define IOP_MAX_INBOUND 256 /* Maximum inbound queue depth */ -#define IOP_MF_RESERVE 4 /* Frames to reserve for ctl ops */ -#define IOP_MAX_XFER 64*1024 /* Maximum transfer size */ -#define IOP_MAX_MSG_SIZE 128 /* Maximum message frame size */ - -struct iop_tidmap { - u_short it_tid; - u_short it_flags; - char it_dvname[sizeof(((struct device *)NULL)->dv_xname)]; -}; -#define IT_CONFIGURED 0x02 /* target configured */ - -struct ioppt_buf { - void *ptb_data; /* pointer to buffer */ - size_t ptb_datalen; /* buffer size in bytes */ - int ptb_out; /* non-zero if transfer is to IOP */ -}; - -struct ioppt { - void *pt_msg; /* pointer to message buffer */ - size_t pt_msglen; /* message buffer size in bytes */ - void *pt_reply; /* pointer to reply buffer */ - size_t pt_replylen; /* reply buffer size in bytes */ - int pt_timo; /* completion timeout in ms */ - int pt_nbufs; /* number of transfers */ - struct ioppt_buf pt_bufs[IOP_MAX_MSG_XFERS]; /* transfers */ -}; - -#define IOPIOCPT _IOWR('u', 0, struct ioppt) -#define IOPIOCGLCT _IOWR('u', 1, struct iovec) -#define IOPIOCGSTATUS _IOWR('u', 2, struct iovec) -#define IOPIOCRECONFIG _IO('u', 3) -#define IOPIOCGTIDMAP _IOWR('u', 4, struct iovec) - -#endif /* !_I2O_IOPIO_H_ */ diff --git a/sys/dev/i2o/ioprbs.c b/sys/dev/i2o/ioprbs.c deleted file mode 100644 index a4cdd6b2b89..00000000000 --- a/sys/dev/i2o/ioprbs.c +++ /dev/null @@ -1,853 +0,0 @@ -/* $OpenBSD: ioprbs.c,v 1.31 2011/05/02 22:15:11 chl Exp $ */ - -/* - * Copyright (c) 2001 Niklas Hallqvist - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*- - * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Andrew Doran. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * A driver for I2O "Random block storage" devices, like RAID. - */ - -/* - * This driver would not have been written if it was not for the hardware - * donation from pi.se. I want to thank them for their support. It also - * had been much harder without Andrew Doran's work in NetBSD's ld_iop.c - * driver, from which I have both gotten inspiration and actual code. - * - Niklas Hallqvist - */ - -#include <sys/param.h> -#include <sys/buf.h> -#include <sys/device.h> -#include <sys/kernel.h> -#include <sys/proc.h> -#include <sys/systm.h> - -#include <machine/bus.h> - -#include <scsi/scsi_all.h> -#include <scsi/scsi_disk.h> -#include <scsi/scsiconf.h> - -#include <dev/i2o/i2o.h> -#include <dev/i2o/iopio.h> -#include <dev/i2o/iopvar.h> -#include <dev/i2o/ioprbsvar.h> - -#ifdef I2ODEBUG -#define DPRINTF(x) printf x -#else -#define DPRINTF(x) -#endif - -void ioprbs_adjqparam(struct device *, int); -void ioprbs_attach(struct device *, struct device *, void *); -void ioprbs_copy_internal_data(struct scsi_xfer *, u_int8_t *, - size_t); -void ioprbs_enqueue_ccb(struct ioprbs_softc *, struct ioprbs_ccb *); -int ioprbs_exec_ccb(struct ioprbs_ccb *); -void ioprbs_free_ccb(void *, void *); -void *ioprbs_get_ccb(void *); -void ioprbs_internal_cache_cmd(struct scsi_xfer *); -void ioprbs_intr(struct device *, struct iop_msg *, void *); -void ioprbs_intr_event(struct device *, struct iop_msg *, void *); -int ioprbs_match(struct device *, void *, void *); -void ioprbs_scsi_cmd(struct scsi_xfer *); -int ioprbs_start(struct ioprbs_ccb *); -void ioprbs_start_ccbs(struct ioprbs_softc *); -void ioprbs_timeout(void *); -void ioprbs_unconfig(struct ioprbs_softc *, int); -void ioprbs_watchdog(void *); - -struct cfdriver ioprbs_cd = { - NULL, "ioprbs", DV_DULL -}; - -struct cfattach ioprbs_ca = { - sizeof(struct ioprbs_softc), ioprbs_match, ioprbs_attach -}; - -struct scsi_adapter ioprbs_switch = { - ioprbs_scsi_cmd, scsi_minphys, 0, 0, -}; - -#ifdef I2OVERBOSE -static const char *const ioprbs_errors[] = { - "success", - "media error", - "access error", - "device failure", - "device not ready", - "media not present", - "media locked", - "media failure", - "protocol failure", - "bus failure", - "access violation", - "media write protected", - "device reset", - "volume changed, waiting for acknowledgement", - "timeout", -}; -#endif - -/* - * Match a supported device. - */ -int -ioprbs_match(parent, match, aux) - struct device *parent; - void *match; - void *aux; -{ - struct iop_attach_args *ia = aux; - - return (ia->ia_class == I2O_CLASS_RANDOM_BLOCK_STORAGE); -} - -/* - * Attach a supported device. - */ -void -ioprbs_attach(struct device *parent, struct device *self, void *aux) -{ - struct iop_attach_args *ia = aux; - struct ioprbs_softc *sc = (struct ioprbs_softc *)self; - struct iop_softc *iop = (struct iop_softc *)parent; - struct scsibus_attach_args saa; - int rv, state = 0; - int enable; - u_int32_t cachesz; - char *typestr, *fixedstr; - struct { - struct i2o_param_op_results pr; - struct i2o_param_read_results prr; - union { - struct i2o_param_rbs_cache_control cc; - struct i2o_param_rbs_device_info bdi; - struct i2o_param_rbs_operation op; - } p; - } __packed param; - int i; - - TAILQ_INIT(&sc->sc_free_ccb); - TAILQ_INIT(&sc->sc_ccbq); - mtx_init(&sc->sc_ccb_mtx, IPL_BIO); - scsi_iopool_init(&sc->sc_iopool, sc, ioprbs_get_ccb, ioprbs_free_ccb); - - /* Initialize the ccbs */ - for (i = 0; i < IOPRBS_MAX_CCBS; i++) - TAILQ_INSERT_TAIL(&sc->sc_free_ccb, &sc->sc_ccbs[i], - ic_chain); - - /* Register us as an initiator. */ - sc->sc_ii.ii_dv = self; - sc->sc_ii.ii_intr = ioprbs_intr; - sc->sc_ii.ii_adjqparam = ioprbs_adjqparam; - sc->sc_ii.ii_flags = 0; - sc->sc_ii.ii_tid = ia->ia_tid; - iop_initiator_register(iop, &sc->sc_ii); - - /* Register another initiator to handle events from the device. */ - sc->sc_eventii.ii_dv = self; - sc->sc_eventii.ii_intr = ioprbs_intr_event; - sc->sc_eventii.ii_flags = II_DISCARD | II_UTILITY; - sc->sc_eventii.ii_tid = ia->ia_tid; - iop_initiator_register(iop, &sc->sc_eventii); - - rv = iop_util_eventreg(iop, &sc->sc_eventii, - I2O_EVENT_GEN_EVENT_MASK_MODIFIED | I2O_EVENT_GEN_DEVICE_RESET | - I2O_EVENT_GEN_STATE_CHANGE | I2O_EVENT_GEN_GENERAL_WARNING); - if (rv != 0) { - printf("%s: unable to register for events", self->dv_xname); - goto bad; - } - state++; - - /* - * Start out with one queued command. The `iop' driver will adjust - * the queue parameters once we're up and running. - */ - sc->sc_maxqueuecnt = 1; - - sc->sc_maxxfer = IOP_MAX_XFER; - - /* Say what the device is. */ - printf(":"); - iop_print_ident(iop, ia->ia_tid); - - /* - * Claim the device so that we don't get any nasty surprises. Allow - * failure. - */ - rv = iop_util_claim(iop, &sc->sc_ii, 0, - I2O_UTIL_CLAIM_CAPACITY_SENSITIVE | - I2O_UTIL_CLAIM_NO_PEER_SERVICE | - I2O_UTIL_CLAIM_NO_MANAGEMENT_SERVICE | - I2O_UTIL_CLAIM_PRIMARY_USER); - sc->sc_flags = rv ? 0 : IOPRBS_CLAIMED; - - rv = iop_param_op(iop, ia->ia_tid, NULL, 0, I2O_PARAM_RBS_DEVICE_INFO, - ¶m, sizeof param); - if (rv != 0) { - printf("%s: unable to get parameters (0x%04x; %d)\n", - sc->sc_dv.dv_xname, I2O_PARAM_RBS_DEVICE_INFO, rv); - goto bad; - } - - sc->sc_secsize = letoh32(param.p.bdi.blocksize); - sc->sc_secperunit = (int) - (letoh64(param.p.bdi.capacity) / sc->sc_secsize); - - switch (param.p.bdi.type) { - case I2O_RBS_TYPE_DIRECT: - typestr = "direct access"; - enable = 1; - break; - case I2O_RBS_TYPE_WORM: - typestr = "WORM"; - enable = 0; - break; - case I2O_RBS_TYPE_CDROM: - typestr = "CD-ROM"; - enable = 0; - break; - case I2O_RBS_TYPE_OPTICAL: - typestr = "optical"; - enable = 0; - break; - default: - typestr = "unknown"; - enable = 0; - break; - } - - if ((letoh32(param.p.bdi.capabilities) & I2O_RBS_CAP_REMOVABLE_MEDIA) - != 0) { - /* sc->sc_flags = IOPRBS_REMOVABLE; */ - fixedstr = "removable"; - enable = 0; - } else - fixedstr = "fixed"; - - printf(" %s, %s", typestr, fixedstr); - - /* - * Determine if the device has an private cache. If so, print the - * cache size. Even if the device doesn't appear to have a cache, - * we perform a flush at shutdown. - */ - rv = iop_param_op(iop, ia->ia_tid, NULL, 0, - I2O_PARAM_RBS_CACHE_CONTROL, ¶m, sizeof(param)); - if (rv != 0) { - printf("%s: unable to get parameters (0x%04x; %d)\n", - sc->sc_dv.dv_xname, I2O_PARAM_RBS_CACHE_CONTROL, rv); - goto bad; - } - - if ((cachesz = letoh32(param.p.cc.totalcachesize)) != 0) - printf(", %dkB cache", cachesz >> 10); - - printf("\n"); - - /* - * Configure the DDM's timeout functions to time out all commands - * after 30 seconds. - */ - rv = iop_param_op(iop, ia->ia_tid, NULL, 0, I2O_PARAM_RBS_OPERATION, - ¶m, sizeof(param)); - if (rv != 0) { - printf("%s: unable to get parameters (0x%04x; %d)\n", - sc->sc_dv.dv_xname, I2O_PARAM_RBS_OPERATION, rv); - goto bad; - } - - param.p.op.timeoutbase = htole32(IOPRBS_TIMEOUT * 1000); - param.p.op.rwvtimeoutbase = htole32(IOPRBS_TIMEOUT * 1000); - param.p.op.rwvtimeout = 0; - - rv = iop_param_op(iop, ia->ia_tid, NULL, 1, I2O_PARAM_RBS_OPERATION, - ¶m, sizeof(param)); -#ifdef notdef - /* - * Intel RAID adapters don't like the above, but do post a - * `parameter changed' event. Perhaps we're doing something - * wrong... - */ - if (rv != 0) { - printf("%s: unable to set parameters (0x%04x; %d)\n", - sc->sc_dv.dv_xname, I2O_PARAM_RBS_OPERATION, rv); - goto bad; - } -#endif - - if (enable) - sc->sc_flags |= IOPRBS_ENABLED; - else - printf("%s: device not yet supported\n", self->dv_xname); - - /* Fill in the prototype scsi_link. */ - sc->sc_link.adapter_softc = sc; - sc->sc_link.adapter = &ioprbs_switch; - sc->sc_link.openings = 1; - sc->sc_link.adapter_buswidth = 1; - sc->sc_link.adapter_target = 1; - sc->sc_link.pool = &sc->sc_iopool; - - bzero(&saa, sizeof(saa)); - saa.saa_sc_link = &sc->sc_link; - - config_found(&sc->sc_dv, &saa, scsiprint); - - return; - - bad: - ioprbs_unconfig(sc, state > 0); -} - -void -ioprbs_unconfig(struct ioprbs_softc *sc, int evreg) -{ - struct iop_softc *iop; - int s; - - iop = (struct iop_softc *)sc->sc_dv.dv_parent; - - if ((sc->sc_flags & IOPRBS_CLAIMED) != 0) - iop_util_claim(iop, &sc->sc_ii, 1, - I2O_UTIL_CLAIM_PRIMARY_USER); - - if (evreg) { - /* - * Mask off events, and wait up to 5 seconds for a reply. - * Note that some adapters won't reply to this (XXX We - * should check the event capabilities). - */ - sc->sc_flags &= ~IOPRBS_NEW_EVTMASK; - iop_util_eventreg(iop, &sc->sc_eventii, - I2O_EVENT_GEN_EVENT_MASK_MODIFIED); - s = splbio(); - if ((sc->sc_flags & IOPRBS_NEW_EVTMASK) == 0) - tsleep(&sc->sc_eventii, PRIBIO, "ioprbsevt", hz * 5); - splx(s); -#ifdef I2ODEBUG - if ((sc->sc_flags & IOPRBS_NEW_EVTMASK) == 0) - printf("%s: didn't reply to event unregister", - sc->sc_dv.dv_xname); -#endif - } - - iop_initiator_unregister(iop, &sc->sc_eventii); - iop_initiator_unregister(iop, &sc->sc_ii); -} - -void -ioprbs_scsi_cmd(struct scsi_xfer *xs) -{ - struct scsi_link *link = xs->sc_link; - struct ioprbs_softc *sc = link->adapter_softc; - struct ioprbs_ccb *ccb = xs->io; - u_int64_t blockno; - u_int32_t blockcnt; - int s; - - xs->error = XS_NOERROR; - - switch (xs->cmd->opcode) { - case TEST_UNIT_READY: - case REQUEST_SENSE: - case INQUIRY: - case MODE_SENSE: - case START_STOP: - case READ_CAPACITY: -#if 0 - case VERIFY: -#endif - ioprbs_internal_cache_cmd(xs); - scsi_done(xs); - return; - - case PREVENT_ALLOW: - DPRINTF(("PREVENT/ALLOW ")); - /* XXX Not yet implemented */ - xs->error = XS_NOERROR; - scsi_done(xs); - return; - - case SYNCHRONIZE_CACHE: - DPRINTF(("SYNCHRONIZE_CACHE ")); - /* XXX Not yet implemented */ - xs->error = XS_NOERROR; - scsi_done(xs); - return; - - default: - DPRINTF(("unknown opc %d ", xs->cmd->opcode)); - /* XXX Not yet implemented */ - xs->error = XS_DRIVER_STUFFUP; - scsi_done(xs); - return; - - case READ_COMMAND: - case READ_BIG: - case WRITE_COMMAND: - case WRITE_BIG: - DPRINTF(("rw opc %d ", xs->cmd->opcode)); - - scsi_cmd_rw_decode(xs->cmd, &blockno, &blockcnt); - if (blockno >= sc->sc_secperunit || - blockcnt > sc->sc_secperunit - blockno) { - printf("%s: out of bounds %llu-%u >= %u\n", - sc->sc_dv.dv_xname, blockno, blockcnt, - sc->sc_secperunit); - /* - * XXX Should be XS_SENSE but that - * would require setting up a faked - * sense too. - */ - xs->error = XS_DRIVER_STUFFUP; - scsi_done(xs); - return; - } - - ccb->ic_blockno = blockno; - ccb->ic_blockcnt = blockcnt; - ccb->ic_xs = xs; - ccb->ic_timeout = xs->timeout; - - s = splbio(); - ioprbs_enqueue_ccb(sc, ccb); - splx(s); - - if (xs->flags & SCSI_POLL) { - /* XXX Should actually poll... */ - } - } -} - -void -ioprbs_intr(struct device *dv, struct iop_msg *im, void *reply) -{ - struct i2o_rbs_reply *rb = reply; - struct ioprbs_ccb *ccb = im->im_dvcontext; - struct scsi_xfer *xs = ccb->ic_xs; - struct iop_softc *iop = (struct iop_softc *)dv->dv_parent; - int err, detail; -#ifdef I2OVERBOSE - const char *errstr; -#endif - - DPRINTF(("ioprbs_intr(%p, %p, %p) ", dv, im, reply)); - - timeout_del(&xs->stimeout); - - err = ((rb->msgflags & I2O_MSGFLAGS_FAIL) != 0); - - if (!err && rb->reqstatus != I2O_STATUS_SUCCESS) { - detail = letoh16(rb->detail); -#ifdef I2OVERBOSE - if (detail >= sizeof(ioprbs_errors) / sizeof(ioprbs_errors[0])) - errstr = "<unknown>"; - else - errstr = ioprbs_errors[detail]; - printf("%s: error 0x%04x: %s\n", dv->dv_xname, detail, errstr); -#else - printf("%s: error 0x%04x\n", dv->dv_xname, detail); -#endif - err = 1; - } - - if (err) - xs->error = XS_DRIVER_STUFFUP; - else - xs->resid = xs->datalen - letoh32(rb->transfercount); - - iop_msg_unmap(iop, im); - iop_msg_free(iop, im); - scsi_done(xs); -} - -void -ioprbs_intr_event(struct device *dv, struct iop_msg *im, void *reply) -{ - struct i2o_util_event_register_reply *rb; - struct ioprbs_softc *sc; - u_int event; - - rb = reply; - - if ((rb->msgflags & I2O_MSGFLAGS_FAIL) != 0) - return; - - event = letoh32(rb->event); - sc = (struct ioprbs_softc *)dv; - - if (event == I2O_EVENT_GEN_EVENT_MASK_MODIFIED) { - sc->sc_flags |= IOPRBS_NEW_EVTMASK; - wakeup(&sc->sc_eventii); -#ifndef I2ODEBUG - return; -#endif - } - - printf("%s: event 0x%08x received\n", dv->dv_xname, event); -} - -void -ioprbs_adjqparam(struct device *dv, int mpi) -{ -#if 0 - struct iop_softc *iop; - - /* - * AMI controllers seem to lose the plot if you hand off lots of - * queued commands. - */ - iop = (struct iop_softc *)dv->dv_parent; - if (letoh16(I2O_ORG_AMI) == iop->sc_status.orgid && mpi > 64) - mpi = 64; - - ldadjqparam((struct ld_softc *)dv, mpi); -#endif -} - -void -ioprbs_copy_internal_data(xs, data, size) - struct scsi_xfer *xs; - u_int8_t *data; - size_t size; -{ - size_t copy_cnt; - - DPRINTF(("ioprbs_copy_internal_data ")); - - if (!xs->datalen) - printf("uio move not yet supported\n"); - else { - copy_cnt = MIN(size, xs->datalen); - bcopy(data, xs->data, copy_cnt); - } -} - -/* Emulated SCSI operation on cache device */ -void -ioprbs_internal_cache_cmd(xs) - struct scsi_xfer *xs; -{ - struct scsi_link *link = xs->sc_link; - struct ioprbs_softc *sc = link->adapter_softc; - u_int8_t target = link->target; - struct scsi_inquiry_data inq; - struct scsi_sense_data sd; - struct scsi_read_cap_data rcd; - - DPRINTF(("ioprbs_internal_cache_cmd ")); - - xs->error = XS_NOERROR; - - if (target > 0 || link->lun != 0) { - xs->error = XS_DRIVER_STUFFUP; - return; - } - - switch (xs->cmd->opcode) { - case TEST_UNIT_READY: - case START_STOP: -#if 0 - case VERIFY: -#endif - DPRINTF(("opc %d tgt %d ", xs->cmd->opcode, target)); - break; - - case REQUEST_SENSE: - DPRINTF(("REQUEST SENSE tgt %d ", target)); - bzero(&sd, sizeof sd); - sd.error_code = SSD_ERRCODE_CURRENT; - sd.segment = 0; - sd.flags = SKEY_NO_SENSE; - bzero(sd.info, sizeof sd.info); - sd.extra_len = 0; - ioprbs_copy_internal_data(xs, (u_int8_t *)&sd, sizeof sd); - break; - - case INQUIRY: - DPRINTF(("INQUIRY tgt %d", target)); - bzero(&inq, sizeof inq); - /* XXX How do we detect removable/CD-ROM devices? */ - inq.device = T_DIRECT; - inq.dev_qual2 = 0; - inq.version = 2; - inq.response_format = 2; - inq.additional_length = 32; - inq.flags |= SID_CmdQue; - strlcpy(inq.vendor, "I2O", sizeof inq.vendor); - snprintf(inq.product, sizeof inq.product, "Container #%02d", - target); - strlcpy(inq.revision, " ", sizeof inq.revision); - ioprbs_copy_internal_data(xs, (u_int8_t *)&inq, sizeof inq); - break; - - case READ_CAPACITY: - DPRINTF(("READ CAPACITY tgt %d ", target)); - bzero(&rcd, sizeof rcd); - _lto4b(sc->sc_secperunit - 1, rcd.addr); - _lto4b(IOPRBS_BLOCK_SIZE, rcd.length); - ioprbs_copy_internal_data(xs, (u_int8_t *)&rcd, sizeof rcd); - break; - - default: - DPRINTF(("unsupported scsi command %#x tgt %d ", - xs->cmd->opcode, target)); - xs->error = XS_DRIVER_STUFFUP; - return; - } - - xs->error = XS_NOERROR; -} - -void * -ioprbs_get_ccb(void *cookie) -{ - struct ioprbs_softc *sc = cookie; - struct ioprbs_ccb *ccb; - - mtx_enter(&sc->sc_ccb_mtx); - ccb = TAILQ_FIRST(&sc->sc_free_ccb); - if (ccb) - TAILQ_REMOVE(&sc->sc_free_ccb, ccb, ic_chain); - mtx_leave(&sc->sc_ccb_mtx); - - /* initialise the command */ - if (ccb) - ccb->ic_flags = 0; - - return (ccb); -} - -void -ioprbs_free_ccb(void *cookie, void *io) -{ - struct ioprbs_softc *sc = cookie; - struct ioprbs_ccb *ccb = io; - - mtx_enter(&sc->sc_ccb_mtx); - TAILQ_INSERT_HEAD(&sc->sc_free_ccb, ccb, ic_chain); - mtx_leave(&sc->sc_ccb_mtx); -} - -void -ioprbs_enqueue_ccb(sc, ccb) - struct ioprbs_softc *sc; - struct ioprbs_ccb *ccb; -{ - DPRINTF(("ioprbs_enqueue_ccb(%p, %p) ", sc, ccb)); - - timeout_set(&ccb->ic_xs->stimeout, ioprbs_timeout, ccb); - TAILQ_INSERT_TAIL(&sc->sc_ccbq, ccb, ic_chain); - ioprbs_start_ccbs(sc); -} - -void -ioprbs_start_ccbs(sc) - struct ioprbs_softc *sc; -{ - struct ioprbs_ccb *ccb; - struct scsi_xfer *xs; - - DPRINTF(("ioprbs_start_ccbs(%p) ", sc)); - - while ((ccb = TAILQ_FIRST(&sc->sc_ccbq)) != NULL) { - - xs = ccb->ic_xs; - if (ccb->ic_flags & IOPRBS_ICF_WATCHDOG) - timeout_del(&xs->stimeout); - - if (ioprbs_exec_ccb(ccb) == 0) { - ccb->ic_flags |= IOPRBS_ICF_WATCHDOG; - timeout_set(&ccb->ic_xs->stimeout, ioprbs_watchdog, - ccb); - timeout_add_msec(&xs->stimeout, IOPRBS_WATCH_TIMEOUT); - break; - } - TAILQ_REMOVE(&sc->sc_ccbq, ccb, ic_chain); - - if ((xs->flags & SCSI_POLL) == 0) { - timeout_set(&ccb->ic_xs->stimeout, ioprbs_timeout, - ccb); - timeout_add_msec(&xs->stimeout, ccb->ic_timeout); - } - } -} - -int -ioprbs_exec_ccb(ccb) - struct ioprbs_ccb *ccb; -{ - struct scsi_xfer *xs = ccb->ic_xs; - - DPRINTF(("ioprbs_exec_ccb(%p, %p) ", xs, ccb)); - - ioprbs_start(ccb); - - xs->error = XS_NOERROR; - xs->resid = 0; - return (1); -} - -/* - * Deliver a command to the controller; allocate controller resources at the - * last moment when possible. - */ -int -ioprbs_start(struct ioprbs_ccb *ccb) -{ - struct scsi_xfer *xs = ccb->ic_xs; - struct scsi_link *link = xs->sc_link; - struct ioprbs_softc *sc = link->adapter_softc; -#ifdef I2ODEBUG - u_int8_t target = link->target; -#endif - struct iop_msg *im; - struct iop_softc *iop = (struct iop_softc *)sc->sc_dv.dv_parent; - struct i2o_rbs_block_read *mf; - u_int rv, flags = 0, mode = I2O_RBS_BLOCK_READ; - u_int64_t ba; - u_int32_t mb[IOP_MAX_MSG_SIZE / sizeof(u_int32_t)]; - - im = iop_msg_alloc(iop, &sc->sc_ii, 0); - im->im_dvcontext = ccb; - - switch (xs->cmd->opcode) { - case PREVENT_ALLOW: - case SYNCHRONIZE_CACHE: - if (xs->cmd->opcode == PREVENT_ALLOW) { - /* XXX PREVENT_ALLOW support goes here */ - } else { - DPRINTF(("SYNCHRONIZE CACHE tgt %d ", target)); - } - break; - - case WRITE_COMMAND: - case WRITE_BIG: - flags = I2O_RBS_BLOCK_WRITE_CACHE_WB; - mode = I2O_RBS_BLOCK_WRITE; - /* FALLTHROUGH */ - - case READ_COMMAND: - case READ_BIG: - ba = (u_int64_t)ccb->ic_blockno * DEV_BSIZE; - - /* - * Fill the message frame. We can use the block_read - * structure for both reads and writes, as it's almost - * identical to the * block_write structure. - */ - mf = (struct i2o_rbs_block_read *)mb; - mf->msgflags = I2O_MSGFLAGS(i2o_rbs_block_read); - mf->msgfunc = I2O_MSGFUNC(sc->sc_ii.ii_tid, mode); - mf->msgictx = sc->sc_ii.ii_ictx; - mf->msgtctx = im->im_tctx; - mf->flags = flags | (1 << 16); /* flags & time multiplier */ - mf->datasize = ccb->ic_blockcnt * DEV_BSIZE; - mf->lowoffset = (u_int32_t)ba; - mf->highoffset = (u_int32_t)(ba >> 32); - - /* Map the data transfer and enqueue the command. */ - rv = iop_msg_map_bio(iop, im, mb, xs->data, - ccb->ic_blockcnt * DEV_BSIZE, mode == I2O_RBS_BLOCK_WRITE); - if (rv == 0) { - if ((rv = iop_msg_post(iop, im, mb, 0)) != 0) { - iop_msg_unmap(iop, im); - iop_msg_free(iop, im); - } - } - break; - } - return (0); -} - -void -ioprbs_timeout(arg) - void *arg; -{ - struct ioprbs_ccb *ccb = arg; - struct scsi_link *link = ccb->ic_xs->sc_link; - struct ioprbs_softc *sc = link->adapter_softc; - int s; - - sc_print_addr(link); - printf("timed out\n"); - - /* XXX Test for multiple timeouts */ - - ccb->ic_xs->error = XS_TIMEOUT; - s = splbio(); - ioprbs_enqueue_ccb(sc, ccb); - splx(s); -} - -void -ioprbs_watchdog(arg) - void *arg; -{ - struct ioprbs_ccb *ccb = arg; - struct scsi_link *link = ccb->ic_xs->sc_link; - struct ioprbs_softc *sc = link->adapter_softc; - int s; - - s = splbio(); - ccb->ic_flags &= ~IOPRBS_ICF_WATCHDOG; - ioprbs_start_ccbs(sc); - splx(s); -} diff --git a/sys/dev/i2o/ioprbsvar.h b/sys/dev/i2o/ioprbsvar.h deleted file mode 100644 index a12fb959175..00000000000 --- a/sys/dev/i2o/ioprbsvar.h +++ /dev/null @@ -1,90 +0,0 @@ -/* $OpenBSD: ioprbsvar.h,v 1.7 2011/04/27 18:54:19 matthew Exp $ */ - -/* - * Copyright (c) 2001 Niklas Hallqvist - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _I2O_IOPRBSVAR_H_ -#define _I2O_IOPRBSVAR_H_ - -/* - * A command contol block, one for each corresponding command index of the - * controller. - */ -struct ioprbs_ccb { - TAILQ_ENTRY(ioprbs_ccb) ic_chain; - struct scsi_xfer *ic_xs; -#if 0 - struct aac_fib *ac_fib; /* FIB associated with this command */ - bus_addr_t ac_fibphys; /* bus address of the FIB */ - bus_dmamap_t ac_dmamap_xfer; - struct aac_sg_table *ac_sgtable;/* pointer to s/g table in command */ -#endif - int ic_timeout; - u_int32_t ic_blockno; - u_int32_t ic_blockcnt; - u_int8_t ic_flags; -#define IOPRBS_ICF_WATCHDOG 0x1 -#define IOPRBS_ICF_COMPLETED 0x2 -}; - -/* XXX What is correct? */ -#define IOPRBS_MAX_CCBS 256 - -struct ioprbs_softc { - struct device sc_dv; /* Generic device data */ - struct scsi_link sc_link; /* Virtual SCSI bus for cache devs */ - struct iop_initiator sc_ii; - struct iop_initiator sc_eventii; - - int sc_flags; - int sc_secperunit; /* # sectors in total */ - int sc_secsize; /* sector size in bytes */ - int sc_maxxfer; /* max xfer size in bytes */ - int sc_maxqueuecnt; /* maximum h/w queue depth */ - int sc_queuecnt; /* current h/w queue depth */ - - struct ioprbs_ccb sc_ccbs[IOPRBS_MAX_CCBS]; - TAILQ_HEAD(, ioprbs_ccb) sc_free_ccb, sc_ccbq; - /* commands on hold for controller resources */ - TAILQ_HEAD(, ioprbs_ccb) sc_ready; - /* commands which have been returned by the controller */ - struct scsi_iopool sc_iopool; - struct mutex sc_ccb_mtx; -}; - -#define IOPRBS_CLAIMED 0x01 -#define IOPRBS_NEW_EVTMASK 0x02 -#define IOPRBS_ENABLED 0x04 - -#define IOPRBS_TIMEOUT (30 * 1000) -#define IOPRBS_BLOCK_SIZE 512 - -/* - * Wait this long for a lost interrupt to get detected. - */ -#define IOPRBS_WATCH_TIMEOUT 10000 /* 10000 * 1ms = 10s */ - -#endif /* !_I2O_IOPRMSVAR_H_ */ diff --git a/sys/dev/i2o/iopreg.h b/sys/dev/i2o/iopreg.h deleted file mode 100644 index 0b82120a39c..00000000000 --- a/sys/dev/i2o/iopreg.h +++ /dev/null @@ -1,44 +0,0 @@ -/* $OpenBSD: iopreg.h,v 1.2 2008/06/26 05:42:15 ray Exp $ */ -/* $NetBSD$ */ - -/*- - * Copyright (c) 2000 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Andrew Doran. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _I2O_IOPREG_H_ -#define _I2O_IOPREG_H_ - -#define IOP_REG_INTR_STATUS 0x30 /* Interrupt status */ -#define IOP_REG_INTR_MASK 0x34 /* Interrupt mask */ -#define IOP_REG_IFIFO 0x40 /* Inbound FIFO (to IOP) */ -#define IOP_REG_OFIFO 0x44 /* Outbound FIFO (from IOP) */ - -#define IOP_MFA_EMPTY 0xffffffffU -#define IOP_INTR_OFIFO 0x08 - -#endif /* !_I2O_IOPREG_H_ */ diff --git a/sys/dev/i2o/iopsp.c b/sys/dev/i2o/iopsp.c deleted file mode 100644 index d5357df493b..00000000000 --- a/sys/dev/i2o/iopsp.c +++ /dev/null @@ -1,629 +0,0 @@ -/* $OpenBSD: iopsp.c,v 1.18 2010/06/28 18:31:01 krw Exp $ */ -/* $NetBSD$ */ - -/*- - * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Andrew Doran. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Raw SCSI device support for I2O. IOPs present SCSI devices individually; - * we group them by controlling port. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/device.h> -#include <sys/queue.h> -#include <sys/proc.h> -#include <sys/buf.h> -#include <sys/endian.h> -#include <sys/malloc.h> -#include <sys/scsiio.h> -#include <sys/rwlock.h> - -#include <machine/bus.h> - -#include <scsi/scsi_all.h> -#include <scsi/scsi_disk.h> -#include <scsi/scsi_all.h> -#include <scsi/scsiconf.h> -#include <scsi/scsi_message.h> - -#include <dev/i2o/i2o.h> -#include <dev/i2o/iopio.h> -#include <dev/i2o/iopvar.h> -#include <dev/i2o/iopspvar.h> - -struct cfdriver iopsp_cd = { - NULL, "iopsp", DV_DULL -}; - -int iopsp_match(struct device *, void *, void *); -void iopsp_attach(struct device *, struct device *, void *); - -struct cfattach iopsp_ca = { - sizeof(struct iopsp_softc), iopsp_match, iopsp_attach -}; - -void iopsp_scsi_cmd(struct scsi_xfer *); -void iopspminphys(struct buf *bp, struct scsi_link *sl); - -struct scsi_adapter iopsp_switch = { - iopsp_scsi_cmd, iopspminphys, 0, 0, -}; - -void iopsp_adjqparam(struct device *, int); -void iopsp_intr(struct device *, struct iop_msg *, void *); -int iopsp_rescan(struct iopsp_softc *); -int iopsp_reconfig(struct device *); - -/* - * Match a supported device. - */ -int -iopsp_match(struct device *parent, void *match, void *aux) -{ - struct iop_attach_args *ia = aux; - struct { - struct i2o_param_op_results pr; - struct i2o_param_read_results prr; - struct i2o_param_hba_ctlr_info ci; - } __packed param; - int rv; - - if (ia->ia_class != I2O_CLASS_BUS_ADAPTER_PORT) - return (0); - - if ((rv = iop_param_op((struct iop_softc *)parent, ia->ia_tid, NULL, 0, - I2O_PARAM_HBA_CTLR_INFO, ¶m, sizeof(param)))) { -#ifdef I2ODEBUG - printf("iopsp_match: iop_param_op failed, status = %d\n", rv); -#endif - return (0); - } - -#ifdef I2ODEBUG - printf("iopsp_match: bustype = %d\n", param.ci.bustype); -#endif - - return (param.ci.bustype == I2O_HBA_BUS_SCSI || - param.ci.bustype == I2O_HBA_BUS_FCA); -} - -/* - * Attach a supported device. - */ -void -iopsp_attach(struct device *parent, struct device *self, void *aux) -{ - struct iop_softc *iop = (struct iop_softc *)parent; - struct iopsp_softc *sc = (struct iopsp_softc *)self; - struct iop_attach_args *ia = (struct iop_attach_args *)aux; - struct scsibus_attach_args saa; - struct { - struct i2o_param_op_results pr; - struct i2o_param_read_results prr; - union { - struct i2o_param_hba_ctlr_info ci; - struct i2o_param_hba_scsi_ctlr_info sci; - struct i2o_param_hba_scsi_port_info spi; - } p; - } __packed param; - int fcal, rv; -#ifdef I2OVERBOSE - int size; -#endif - - /* Register us as an initiator. */ - sc->sc_ii.ii_dv = self; - sc->sc_ii.ii_intr = iopsp_intr; - sc->sc_ii.ii_flags = 0; - sc->sc_ii.ii_tid = ia->ia_tid; - sc->sc_ii.ii_reconfig = iopsp_reconfig; - sc->sc_ii.ii_adjqparam = iopsp_adjqparam; - iop_initiator_register(iop, &sc->sc_ii); - - rv = iop_param_op(iop, ia->ia_tid, NULL, 0, I2O_PARAM_HBA_CTLR_INFO, - ¶m, sizeof(param)); - if (rv != 0) { - printf("%s: unable to get parameters (0x%04x; %d)\n", - sc->sc_dv.dv_xname, I2O_PARAM_HBA_CTLR_INFO, rv); - goto bad; - } - - fcal = (param.p.ci.bustype == I2O_HBA_BUS_FCA); /* XXX */ - - /* - * Say what the device is. If we can find out what the controling - * device is, say what that is too. - */ - printf(": SCSI port"); - iop_print_ident(iop, ia->ia_tid); - printf("\n"); - - rv = iop_param_op(iop, ia->ia_tid, NULL, 0, - I2O_PARAM_HBA_SCSI_CTLR_INFO, ¶m, sizeof(param)); - if (rv != 0) { - printf("%s: unable to get parameters (0x%04x; %d)\n", - sc->sc_dv.dv_xname, I2O_PARAM_HBA_SCSI_CTLR_INFO, rv); - goto bad; - } - -#ifdef I2OVERBOSE - printf("%s: %d-bit, max sync rate %dMHz, initiator ID %d\n", - sc->sc_dv.dv_xname, param.p.sci.maxdatawidth, - (u_int32_t)letoh64(param.p.sci.maxsyncrate) / 1000, - letoh32(param.p.sci.initiatorid)); -#endif - - sc->sc_link.adapter_softc = sc; - sc->sc_link.adapter = &iopsp_switch; - sc->sc_link.adapter_target = letoh32(param.p.sci.initiatorid); - sc->sc_link.openings = 1; - sc->sc_link.adapter_buswidth = fcal? - IOPSP_MAX_FCAL_TARGET : param.p.sci.maxdatawidth; - sc->sc_link.luns = IOPSP_MAX_LUN; - -#ifdef I2OVERBOSE - /* - * Allocate the target map. Currently used for informational - * purposes only. - */ - size = sc->sc_link.adapter_buswidth * sizeof(struct iopsp_target); - sc->sc_targetmap = malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO); -#endif - - /* Build the two maps, and attach to scsi. */ - if (iopsp_reconfig(self) != 0) { - printf("%s: configure failed\n", sc->sc_dv.dv_xname); - goto bad; - } - - bzero(&saa, sizeof(saa)); - saa.saa_sc_link = &sc->sc_link; - - config_found(&sc->sc_dv, &saa, scsiprint); - return; - - bad: - iop_initiator_unregister(iop, &sc->sc_ii); -} - -/* - * Scan the LCT to determine which devices we control, and enter them into - * the maps. - */ -int -iopsp_reconfig(struct device *dv) -{ - struct iopsp_softc *sc = (struct iopsp_softc *)dv; - struct iop_softc *iop = (struct iop_softc *)sc->sc_dv.dv_parent; - struct i2o_lct_entry *le; - struct { - struct i2o_param_op_results pr; - struct i2o_param_read_results prr; - struct i2o_param_scsi_device_info sdi; - } __packed param; - u_int tid, nent, i, targ, lun, size, s, rv, bptid; - u_short *tidmap; -#ifdef I2OVERBOSE - struct iopsp_target *it; - int syncrate; -#endif - - /* Anything to do? */ - if (iop->sc_chgind == sc->sc_chgind) - return (0); - - /* - * Allocate memory for the target/LUN -> TID map. Use zero to - * denote absent targets (zero is the TID of the I2O executive, - * and we never address that here). - */ - size = sc->sc_link.adapter_buswidth * IOPSP_MAX_LUN * sizeof(u_short); - if (!(tidmap = malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO))) - return (ENOMEM); - -#ifdef I2OVERBOSE - for (i = 0; i < sc->sc_link.adapter_buswidth; i++) - sc->sc_targetmap[i].it_flags &= ~IT_PRESENT; -#endif - - /* - * A quick hack to handle Intel's stacked bus port arrangement. - */ - bptid = sc->sc_ii.ii_tid; - nent = iop->sc_nlctent; - for (le = iop->sc_lct->entry; nent != 0; nent--, le++) - if ((letoh16(le->classid) & 4095) == - I2O_CLASS_BUS_ADAPTER_PORT && - (letoh32(le->usertid) & 4095) == bptid) { - bptid = letoh16(le->localtid) & 4095; - break; - } - - nent = iop->sc_nlctent; - for (i = 0, le = iop->sc_lct->entry; i < nent; i++, le++) { - if ((letoh16(le->classid) & I2O_CLASS_MASK) != - I2O_CLASS_SCSI_PERIPHERAL || - ((letoh32(le->usertid) >> 12) & 4095) != bptid) - continue; - tid = letoh16(le->localtid) & I2O_LCT_ENTRY_TID_MASK; - - rv = iop_param_op(iop, tid, NULL, 0, I2O_PARAM_SCSI_DEVICE_INFO, - ¶m, sizeof(param)); - if (rv != 0) { - printf("%s: unable to get parameters (0x%04x; %d)\n", - sc->sc_dv.dv_xname, I2O_PARAM_SCSI_DEVICE_INFO, - rv); - continue; - } - targ = letoh32(param.sdi.identifier); - lun = param.sdi.luninfo[1]; -#if defined(DIAGNOSTIC) || defined(I2ODEBUG) - if (targ >= sc->sc_link.adapter_buswidth || - lun >= sc->sc_link.adapter_buswidth) { - printf("%s: target %d,%d (tid %d): bad target/LUN\n", - sc->sc_dv.dv_xname, targ, lun, tid); - continue; - } -#endif - -#ifdef I2OVERBOSE - /* - * If we've already described this target, and nothing has - * changed, then don't describe it again. - */ - it = &sc->sc_targetmap[targ]; - it->it_flags |= IT_PRESENT; - syncrate = (int)((letoh64(param.sdi.negsyncrate) + 500) / 1000); - if (it->it_width == param.sdi.negdatawidth && - it->it_offset == param.sdi.negoffset && - it->it_syncrate == syncrate) - continue; - - it->it_width = param.sdi.negdatawidth; - it->it_offset = param.sdi.negoffset; - it->it_syncrate = syncrate; - - printf("%s: target %d (tid %d): %d-bit, ", sc->sc_dv.dv_xname, - targ, tid, it->it_width); - if (it->it_syncrate == 0) - printf("asynchronous\n"); - else - printf("synchronous at %dMHz, offset 0x%x\n", - it->it_syncrate, it->it_offset); -#endif - - /* Ignore the device if it's in use by somebody else. */ - if ((letoh32(le->usertid) & 4095) != I2O_TID_NONE) { -#ifdef I2OVERBOSE - if (sc->sc_tidmap == NULL || - IOPSP_TIDMAP(sc->sc_tidmap, targ, lun) != - IOPSP_TID_INUSE) - printf("%s: target %d,%d (tid %d): in use by" - " tid %d\n", sc->sc_dv.dv_xname, - targ, lun, tid, - letoh32(le->usertid) & 4095); -#endif - IOPSP_TIDMAP(tidmap, targ, lun) = IOPSP_TID_INUSE; - } else - IOPSP_TIDMAP(tidmap, targ, lun) = (u_short)tid; - } - -#ifdef I2OVERBOSE - for (i = 0; i < sc->sc_link.adapter_buswidth; i++) - if ((sc->sc_targetmap[i].it_flags & IT_PRESENT) == 0) - sc->sc_targetmap[i].it_width = 0; -#endif - - /* Swap in the new map and return. */ - s = splbio(); - if (sc->sc_tidmap != NULL) - free(sc->sc_tidmap, M_DEVBUF); - sc->sc_tidmap = tidmap; - splx(s); - sc->sc_chgind = iop->sc_chgind; - return (0); -} - -/* - * Re-scan the bus; to be called from a higher level (e.g. scsi). - */ -int -iopsp_rescan(struct iopsp_softc *sc) -{ - struct iop_softc *iop; - struct iop_msg *im; - struct i2o_hba_bus_scan mf; - int rv; - - iop = (struct iop_softc *)sc->sc_dv.dv_parent; - - rw_enter_write(&iop->sc_conflock); - - im = iop_msg_alloc(iop, &sc->sc_ii, IM_WAIT); - - mf.msgflags = I2O_MSGFLAGS(i2o_hba_bus_scan); - mf.msgfunc = I2O_MSGFUNC(sc->sc_ii.ii_tid, I2O_HBA_BUS_SCAN); - mf.msgictx = sc->sc_ii.ii_ictx; - mf.msgtctx = im->im_tctx; - - rv = iop_msg_post(iop, im, &mf, 5*60*1000); - iop_msg_free(iop, im); - if (rv != 0) - printf("%s: bus rescan failed (error %d)\n", - sc->sc_dv.dv_xname, rv); - - if ((rv = iop_lct_get(iop)) == 0) - rv = iopsp_reconfig(&sc->sc_dv); - - rw_exit_write(&iop->sc_conflock); - return (rv); -} - -void -iopspminphys(struct buf *bp, struct scsi_link *sl) -{ - if (bp->b_bcount > IOP_MAX_XFER) - bp->b_bcount = IOP_MAX_XFER; - minphys(bp); -} - -/* - * Start a SCSI command. - */ -void -iopsp_scsi_cmd(xs) - struct scsi_xfer *xs; -{ - struct scsi_link *link = xs->sc_link; - struct iopsp_softc *sc = (struct iopsp_softc *)link->adapter_softc; - struct iop_softc *iop = (struct iop_softc *)sc->sc_dv.dv_parent; - struct iop_msg *im; - struct i2o_scsi_scb_exec *mf; - int error, tid, s; - u_int32_t mb[IOP_MAX_MSG_SIZE / sizeof(u_int32_t)]; - - tid = IOPSP_TIDMAP(sc->sc_tidmap, link->target, link->lun); - if (tid == IOPSP_TID_ABSENT || tid == IOPSP_TID_INUSE) { - xs->error = XS_SELTIMEOUT; - scsi_done(xs); - return; - } - - SC_DEBUG(xs->sc_link, SDEV_DB2, ("iopsp_scsi_cmd: run_xfer\n")); - - /* Need to reset the target? */ - if ((xs->flags & XS_RESET) != 0) { - if (iop_simple_cmd(iop, tid, I2O_SCSI_DEVICE_RESET, - sc->sc_ii.ii_ictx, 1, 30*1000) != 0) { -#ifdef I2ODEBUG - printf("%s: reset failed\n", - sc->sc_dv.dv_xname); -#endif - xs->error = XS_DRIVER_STUFFUP; - } else - xs->error = XS_NOERROR; - - scsi_done(xs); - return; - } - -#if defined(I2ODEBUG) || defined(SCSIDEBUG) - if (xs->cmdlen > sizeof(mf->cdb)) - panic("%s: CDB too large", sc->sc_dv.dv_xname); -#endif - - im = iop_msg_alloc(iop, &sc->sc_ii, IM_POLL_INTR | - IM_NOSTATUS | ((xs->flags & SCSI_POLL) != 0 ? IM_POLL : 0)); - im->im_dvcontext = xs; - - mf = (struct i2o_scsi_scb_exec *)mb; - mf->msgflags = I2O_MSGFLAGS(i2o_scsi_scb_exec); - mf->msgfunc = I2O_MSGFUNC(tid, I2O_SCSI_SCB_EXEC); - mf->msgictx = sc->sc_ii.ii_ictx; - mf->msgtctx = im->im_tctx; - mf->flags = xs->cmdlen | I2O_SCB_FLAG_ENABLE_DISCONNECT | - I2O_SCB_FLAG_SENSE_DATA_IN_MESSAGE; - mf->datalen = xs->datalen; - memcpy(mf->cdb, xs->cmd, xs->cmdlen); - -#if 0 - switch (xs->xs_tag_type) { - case MSG_ORDERED_Q_TAG: - mf->flags |= I2O_SCB_FLAG_ORDERED_QUEUE_TAG; - break; - case MSG_SIMPLE_Q_TAG: - mf->flags |= I2O_SCB_FLAG_SIMPLE_QUEUE_TAG; - break; - case MSG_HEAD_OF_Q_TAG: - mf->flags |= I2O_SCB_FLAG_HEAD_QUEUE_TAG; - break; - default: - break; - } -#endif - - if (xs->datalen != 0) { - error = iop_msg_map_bio(iop, im, mb, xs->data, - xs->datalen, (xs->flags & SCSI_DATA_OUT) == 0); - if (error) { - xs->error = XS_DRIVER_STUFFUP; - iop_msg_free(iop, im); - scsi_done(xs); - return; - } - if ((xs->flags & SCSI_DATA_IN) == 0) - mf->flags |= I2O_SCB_FLAG_XFER_TO_DEVICE; - else - mf->flags |= I2O_SCB_FLAG_XFER_FROM_DEVICE; - } - - s = splbio(); - sc->sc_curqd++; - splx(s); - - if (iop_msg_post(iop, im, mb, xs->timeout)) { - s = splbio(); - sc->sc_curqd--; - splx(s); - if (xs->datalen != 0) - iop_msg_unmap(iop, im); - iop_msg_free(iop, im); - xs->error = XS_DRIVER_STUFFUP; - scsi_done(xs); - } -} - -#ifdef notyet -/* - * Abort the specified I2O_SCSI_SCB_EXEC message and its associated SCB. - */ -int -iopsp_scsi_abort(struct iopsp_softc *sc, int atid, struct iop_msg *aim) -{ - struct iop_msg *im; - struct i2o_scsi_scb_abort mf; - struct iop_softc *iop; - int rv, s; - - iop = (struct iop_softc *)sc->sc_dv.dv_parent; - im = iop_msg_alloc(iop, &sc->sc_ii, IM_POLL); - - mf.msgflags = I2O_MSGFLAGS(i2o_scsi_scb_abort); - mf.msgfunc = I2O_MSGFUNC(atid, I2O_SCSI_SCB_ABORT); - mf.msgictx = sc->sc_ii.ii_ictx; - mf.msgtctx = im->im_tctx; - mf.tctxabort = aim->im_tctx; - - s = splbio(); - rv = iop_msg_post(iop, im, &mf, 30000); - splx(s); - iop_msg_free(iop, im); - return (rv); -} -#endif - -/* - * We have a message which has been processed and replied to by the IOP - - * deal with it. - */ -void -iopsp_intr(struct device *dv, struct iop_msg *im, void *reply) -{ - struct scsi_xfer *xs; - struct iopsp_softc *sc; - struct i2o_scsi_reply *rb; - struct iop_softc *iop; - u_int sl; - - sc = (struct iopsp_softc *)dv; - xs = (struct scsi_xfer *)im->im_dvcontext; - iop = (struct iop_softc *)dv->dv_parent; - rb = reply; - - SC_DEBUG(xs->sc_link, SDEV_DB2, ("iopsp_intr\n")); - - if ((rb->msgflags & I2O_MSGFLAGS_FAIL) != 0) { - xs->error = XS_DRIVER_STUFFUP; - xs->resid = xs->datalen; - } else { - if (rb->hbastatus != I2O_SCSI_DSC_SUCCESS) { - switch (rb->hbastatus) { - case I2O_SCSI_DSC_ADAPTER_BUSY: - case I2O_SCSI_DSC_SCSI_BUS_RESET: - case I2O_SCSI_DSC_BUS_BUSY: - xs->error = XS_BUSY; - break; - case I2O_SCSI_DSC_SELECTION_TIMEOUT: - xs->error = XS_SELTIMEOUT; - break; - case I2O_SCSI_DSC_COMMAND_TIMEOUT: - case I2O_SCSI_DSC_DEVICE_NOT_PRESENT: - case I2O_SCSI_DSC_LUN_INVALID: - case I2O_SCSI_DSC_SCSI_TID_INVALID: - xs->error = XS_TIMEOUT; - break; - default: - xs->error = XS_DRIVER_STUFFUP; - break; - } - printf("%s: HBA status 0x%02x\n", sc->sc_dv.dv_xname, - rb->hbastatus); - } else if (rb->scsistatus != SCSI_OK) { - switch (rb->scsistatus) { - case SCSI_CHECK: - xs->error = XS_SENSE; - sl = letoh32(rb->senselen); - if (sl > sizeof(xs->sense)) - sl = sizeof(xs->sense); - bcopy(rb->sense, &xs->sense, sl); - break; - case SCSI_QUEUE_FULL: - case SCSI_BUSY: - xs->error = XS_BUSY; - break; - default: - xs->error = XS_DRIVER_STUFFUP; - break; - } - } else - xs->error = XS_NOERROR; - - xs->resid = xs->datalen - letoh32(rb->datalen); - xs->status = rb->scsistatus; - } - - /* Free the message wrapper and pass the news to scsi. */ - if (xs->datalen != 0) - iop_msg_unmap(iop, im); - iop_msg_free(iop, im); - - if (--sc->sc_curqd == sc->sc_link.openings) - wakeup(&sc->sc_curqd); - - scsi_done(xs); -} - -/* - * The number of openings available to us has changed, so inform scsi. - */ -void -iopsp_adjqparam(struct device *dv, int mpi) -{ - struct iopsp_softc *sc = (struct iopsp_softc *)dv; - int s; - - s = splbio(); - sc->sc_link.openings = mpi; - if (mpi < sc->sc_curqd) - tsleep(&sc->sc_curqd, PWAIT, "iopspdrn", 0); - splx(s); -} diff --git a/sys/dev/i2o/iopspvar.h b/sys/dev/i2o/iopspvar.h deleted file mode 100644 index b1f146a2e45..00000000000 --- a/sys/dev/i2o/iopspvar.h +++ /dev/null @@ -1,67 +0,0 @@ -/* $OpenBSD: iopspvar.h,v 1.3 2008/06/26 05:42:15 ray Exp $ */ -/* $NetBSD$ */ - -/*- - * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Andrew Doran. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _I2O_IOPSPVAR_H_ -#define _I2O_IOPSPVAR_H_ - -#define IOPSP_MAX_LUN 8 -#define IOPSP_MAX_SCSI_TARGET 15 -#define IOPSP_MAX_FCAL_TARGET 127 - -#define IOPSP_TIDMAP(map, t, l) (map[(t) * IOPSP_MAX_LUN + (l)]) -#define IOPSP_TID_ABSENT 0x0000 /* Device is absent */ -#define IOPSP_TID_INUSE 0xffff /* Device in use by another module */ - -#ifdef I2OVERBOSE -struct iopsp_target { - u_int8_t it_width; - u_int8_t it_syncrate; - u_int8_t it_offset; - u_int8_t it_flags; -}; -#define IT_PRESENT 0x01 /* Target is present */ -#endif - -struct iopsp_softc { - struct device sc_dv; - struct scsi_link sc_link; - struct iop_initiator sc_ii; - - u_short *sc_tidmap; /* Target/LUN -> TID map */ - u_int sc_chgind; /* Last LCT change # */ - u_int sc_curqd; /* Current queue depth */ -#ifdef I2OVERBOSE - struct iopsp_target *sc_targetmap; /* Target information */ -#endif -}; - -#endif /* !_I2O_IOPSPVAR_H_ */ diff --git a/sys/dev/i2o/iopvar.h b/sys/dev/i2o/iopvar.h deleted file mode 100644 index 13ebdc51320..00000000000 --- a/sys/dev/i2o/iopvar.h +++ /dev/null @@ -1,190 +0,0 @@ -/* $OpenBSD: iopvar.h,v 1.11 2013/05/30 16:15:02 deraadt Exp $ */ -/* $NetBSD: iopvar.h,v 1.5 2001/03/20 13:01:49 ad Exp $ */ - -/*- - * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Andrew Doran. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _I2O_IOPVAR_H_ -#define _I2O_IOPVAR_H_ - -#include <sys/rwlock.h> - -/* - * Transfer descriptor. - */ -struct iop_xfer { - bus_dmamap_t ix_map; - u_int ix_size; - u_int ix_flags; -}; -#define IX_IN 0x0001 /* Data transfer from IOP */ -#define IX_OUT 0x0002 /* Data transfer to IOP */ - -/* - * Message wrapper. - */ -struct iop_msg { - SLIST_ENTRY(iop_msg) im_chain; /* Next free message */ - u_int im_flags; /* Control flags */ - u_int im_tctx; /* Transaction context */ - void *im_dvcontext; /* Un*x device context */ - struct i2o_reply *im_rb; /* Reply buffer */ - u_int im_reqstatus; /* Status from reply */ - struct iop_xfer im_xfer[IOP_MAX_MSG_XFERS]; -}; -#define IM_SYSMASK 0x00ff -#define IM_REPLIED 0x0001 /* Message has been replied to */ -#define IM_ALLOCED 0x0002 /* This message wrapper is allocated */ -#define IM_SGLOFFADJ 0x0004 /* S/G list offset adjusted */ -#define IM_DISCARD 0x0008 /* Discard message wrapper once sent */ -#define IM_FAIL 0x0010 /* Transaction error returned */ - -#define IM_USERMASK 0xff00 -#define IM_WAIT 0x0100 /* Wait (sleep) for completion */ -#define IM_POLL 0x0200 /* Wait (poll) for completion */ -#define IM_NOSTATUS 0x0400 /* Don't check status if waiting */ -#define IM_POLL_INTR 0x0800 /* Do send interrupt when polling */ - -struct iop_initiator { - LIST_ENTRY(iop_initiator) ii_list; - LIST_ENTRY(iop_initiator) ii_hash; - - void (*ii_intr)(struct device *, struct iop_msg *, void *); - int (*ii_reconfig)(struct device *); - void (*ii_adjqparam)(struct device *, int); - - struct device *ii_dv; - int ii_flags; - int ii_ictx; /* Initiator context */ - int ii_tid; -}; -#define II_DISCARD 0x0001 /* Don't track state; discard msg wrappers */ -#define II_CONFIGURED 0x0002 /* Already configured */ -#define II_UTILITY 0x0004 /* Utility initiator (not a real device) */ - -#define IOP_ICTX 0 -#define IOP_INIT_CODE 0x80 - -/* - * Parameter group op (for async parameter retrievals). - */ -struct iop_pgop { - struct i2o_param_op_list_header olh; - struct i2o_param_op_all_template oat; -} __packed; - -/* - * Per-IOP context. - */ -struct iop_softc { - struct device sc_dv; /* generic device data */ - bus_space_handle_t sc_ioh; /* bus space handle */ - bus_space_tag_t sc_iot; /* bus space tag */ - bus_dma_tag_t sc_dmat; /* bus DMA tag */ - void *sc_ih; /* interrupt handler cookie */ - struct rwlock sc_conflock; /* autoconfiguration lock */ - bus_addr_t sc_memaddr; /* register window address */ - bus_size_t sc_memsize; /* register window size */ - - struct i2o_hrt *sc_hrt; /* hardware resource table */ - struct iop_tidmap *sc_tidmap; /* tid map (per-lct-entry flags) */ - struct i2o_lct *sc_lct; /* logical configuration table */ - int sc_nlctent; /* number of LCT entries */ - int sc_flags; /* IOP-wide flags */ - int sc_maxib; - int sc_maxob; - int sc_curib; - u_int32_t sc_chgind; /* autoconfig vs. LCT change ind. */ - LIST_HEAD(, iop_initiator) sc_iilist;/* initiator list */ - int sc_nii; - int sc_nuii; - struct iop_initiator sc_eventii;/* IOP event handler */ - struct proc *sc_reconf_proc;/* reconfiguration process */ - struct iop_msg *sc_ims; - SLIST_HEAD(, iop_msg) sc_im_freelist; - caddr_t sc_ptb; - bus_dmamap_t sc_scr_dmamap; /* Scratch DMA map */ - bus_dma_segment_t sc_scr_seg[1];/* Scratch DMA segment */ - caddr_t sc_scr; /* Scratch memory va */ - - /* - * Reply queue. - */ - bus_dmamap_t sc_rep_dmamap; - int sc_rep_size; - bus_addr_t sc_rep_phys; - caddr_t sc_rep; - - bus_space_tag_t sc_bus_memt; - bus_space_tag_t sc_bus_iot; - - struct i2o_status sc_status; /* status */ -}; -#define IOP_OPEN 0x01 /* Device interface open */ -#define IOP_HAVESTATUS 0x02 /* Successfully retrieved status */ -#define IOP_ONLINE 0x04 /* Can use ioctl interface */ - -#define IOPCF_TID 0 -#define IOPCF_TID_DEFAULT -1 - -struct iop_attach_args { - int ia_class; /* device class */ - int ia_tid; /* target ID */ -}; -#define iopcf_tid cf_loc[IOPCF_TID] /* TID */ - -void iop_init(struct iop_softc *, const char *); -int iop_intr(void *); -int iop_lct_get(struct iop_softc *); -int iop_param_op(struct iop_softc *, int, struct iop_initiator *, int, - int, void *, size_t); -int iop_print_ident(struct iop_softc *, int); -int iop_simple_cmd(struct iop_softc *, int, int, int, int, int); -void iop_strvis(struct iop_softc *, const char *, int, char *, int); -void iop_shutdown(void *); - -void iop_initiator_register(struct iop_softc *, struct iop_initiator *); -void iop_initiator_unregister(struct iop_softc *, struct iop_initiator *); - -struct iop_msg *iop_msg_alloc(struct iop_softc *, struct iop_initiator *, - int); -void iop_msg_free(struct iop_softc *, struct iop_msg *); -int iop_msg_map(struct iop_softc *, struct iop_msg *, u_int32_t *, void *, - size_t, int); -int iop_msg_map_bio(struct iop_softc *, struct iop_msg *, u_int32_t *, - void *, int, int); -int iop_msg_post(struct iop_softc *, struct iop_msg *, void *, int); -void iop_msg_unmap(struct iop_softc *, struct iop_msg *); - -int iop_util_abort(struct iop_softc *, struct iop_initiator *, int, int, - int); -int iop_util_claim(struct iop_softc *, struct iop_initiator *, int, int); -int iop_util_eventreg(struct iop_softc *, struct iop_initiator *, int); - -#endif /* !_I2O_IOPVAR_H_ */ diff --git a/sys/dev/pci/files.pci b/sys/dev/pci/files.pci index 3709413caaf..2a1847ca64a 100644 --- a/sys/dev/pci/files.pci +++ b/sys/dev/pci/files.pci @@ -1,4 +1,4 @@ -# $OpenBSD: files.pci,v 1.298 2013/10/28 12:33:32 mpi Exp $ +# $OpenBSD: files.pci,v 1.299 2013/11/04 14:07:14 deraadt Exp $ # $NetBSD: files.pci,v 1.20 1996/09/24 17:47:15 christos Exp $ # # Config file and device description for machine-independent PCI code. @@ -107,10 +107,6 @@ device ips: scsi attach ips at pci file dev/pci/ips.c ips -# I2O -attach iop at pci with iop_pci -file dev/pci/iop_pci.c iop_pci - # Ensoniq AudioPCI S5016, 1371 device eap: audio, auconv, mulaw, ac97, midibus attach eap at pci diff --git a/sys/dev/pci/iop_pci.c b/sys/dev/pci/iop_pci.c deleted file mode 100644 index a92ca464b87..00000000000 --- a/sys/dev/pci/iop_pci.c +++ /dev/null @@ -1,171 +0,0 @@ -/* $OpenBSD: iop_pci.c,v 1.9 2013/05/30 16:15:02 deraadt Exp $ */ -/* $NetBSD: iop_pci.c,v 1.4 2001/03/20 13:21:00 ad Exp $ */ - -/*- - * Copyright (c) 2000 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Andrew Doran. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * PCI front-end for `iop' driver. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/device.h> -#include <sys/queue.h> - -#include <machine/endian.h> -#include <machine/bus.h> - -#include <dev/pci/pcidevs.h> -#include <dev/pci/pcivar.h> - -#include <dev/i2o/i2o.h> -#include <dev/i2o/iopreg.h> -#include <dev/i2o/iopio.h> -#include <dev/i2o/iopvar.h> - -#define PCI_INTERFACE_I2O_POLLED 0x00 -#define PCI_INTERFACE_I2O_INTRDRIVEN 0x01 - -void iop_pci_attach(struct device *, struct device *, void *); -int iop_pci_match(struct device *, void *, void *); -int iop_activate(struct device *, int); - -struct cfattach iop_pci_ca = { - sizeof(struct iop_softc), iop_pci_match, iop_pci_attach, - NULL, iop_activate -}; - -int -iop_pci_match(parent, match, aux) - struct device *parent; - void *match; - void *aux; -{ - struct pci_attach_args *pa; - - pa = aux; - - /* - * Look for an "intelligent I/O processor" that adheres to the I2O - * specification. Ignore the device if it doesn't support interrupt - * driven operation. - */ - if (PCI_CLASS(pa->pa_class) == PCI_CLASS_I2O && - PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_I2O_STANDARD && - PCI_INTERFACE(pa->pa_class) == PCI_INTERFACE_I2O_INTRDRIVEN) - return (1); - - return (0); -} - -void -iop_pci_attach(struct device *parent, struct device *self, void *aux) -{ - struct pci_attach_args *pa; - struct iop_softc *sc; - pci_chipset_tag_t pc; - pci_intr_handle_t ih; - const char *intrstr; - pcireg_t reg; - int i; - - sc = (struct iop_softc *)self; - pa = (struct pci_attach_args *)aux; - pc = pa->pa_pc; - - /* - * The kernel always uses the first memory mapping to communicate - * with the IOP. - */ - for (i = PCI_MAPREG_START; i < PCI_MAPREG_END; i += 4) { - reg = pci_conf_read(pc, pa->pa_tag, i); - if (PCI_MAPREG_TYPE(reg) == PCI_MAPREG_TYPE_MEM) - break; - } - if (i == PCI_MAPREG_END) { - printf(": can't find mapping\n"); - return; - } - - /* Map the register window. */ - if (pci_mapreg_map(pa, i, PCI_MAPREG_TYPE_MEM, 0, &sc->sc_iot, - &sc->sc_ioh, NULL, NULL, 0x40000)) { - printf(": can't map register window\n"); - return; - } - - sc->sc_dmat = pa->pa_dmat; - sc->sc_bus_memt = pa->pa_memt; - sc->sc_bus_iot = pa->pa_iot; - - /* Map and establish the interrupt. XXX IPL_BIO. */ - if (pci_intr_map(pa, &ih)) { - printf(": can't map interrupt\n"); - return; - } - intrstr = pci_intr_string(pc, ih); - sc->sc_ih = pci_intr_establish(pc, ih, IPL_BIO, iop_intr, sc, - sc->sc_dv.dv_xname); - if (sc->sc_ih == NULL) { - printf(": can't establish interrupt"); - if (intrstr != NULL) - printf(" at %s", intrstr); - printf("\n"); - return; - } - - /* Attach to the bus-independent code. */ - iop_init(sc, intrstr); -} - -int -iop_activate(struct device *self, int act) -{ - int ret = 0; - - switch (act) { - case DVACT_QUIESCE: - ret = config_activate_children(self, act); - break; - case DVACT_SUSPEND: - ret = config_activate_children(self, act); - break; - case DVACT_POWERDOWN: - ret = config_activate_children(self, act); - iop_shutdown(self); - break; - case DVACT_RESUME: - ret = config_activate_children(self, act); - break; - } - - return (ret); -} |