Add `dpti', which is an I2O vendor extension implementing the DPT/Adaptec

control interface. This makes it possible to run the Linux versions of
dptmgr, raidutil, dptelog and other tools under NetBSD.
This commit is contained in:
ad 2001-09-21 23:44:19 +00:00
parent 27578b9aac
commit fcf00dcc00
15 changed files with 1155 additions and 29 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh - #!/bin/sh -
# #
# $NetBSD: MAKEDEV,v 1.146 2001/09/16 08:19:06 veego Exp $ # $NetBSD: MAKEDEV,v 1.147 2001/09/21 23:44:22 ad Exp $
# #
# Copyright (c) 1990 The Regents of the University of California. # Copyright (c) 1990 The Regents of the University of California.
# All rights reserved. # All rights reserved.
@ -130,6 +130,7 @@
# wsmux* wscons event multiplexor # wsmux* wscons event multiplexor
# agp* AGP GART devices # agp* AGP GART devices
# pci* PCI bus access devices # pci* PCI bus access devices
# dpti* DPT/Adaptec RAID management interface
# #
dialin=0 dialin=0
@ -830,6 +831,13 @@ pci*)
chmod 644 pci$unit chmod 644 pci$unit
;; ;;
dpti*)
unit=${i#dpti};
rm -f dpti$unit
mknod dpti$unit c 84 $unit
chmod 600 dpti$unit
;;
altq) altq)
mkdir -p altq mkdir -p altq
chmod 755 altq chmod 755 altq

View File

@ -6,7 +6,7 @@
.\" *** DO NOT EDIT - any changes will be lost!!! .\" *** DO NOT EDIT - any changes will be lost!!!
.\" *** ------------------------------------------------------------------ .\" *** ------------------------------------------------------------------
.\" .\"
.\" $NetBSD: MAKEDEV.8,v 1.29 2001/09/15 10:53:17 wiz Exp $ .\" $NetBSD: MAKEDEV.8,v 1.30 2001/09/21 23:44:20 ad Exp $
.\" .\"
.\" Copyright (c) 2001 The NetBSD Foundation, Inc. .\" Copyright (c) 2001 The NetBSD Foundation, Inc.
.\" All rights reserved. .\" All rights reserved.
@ -316,6 +316,8 @@ AGP GART devices, see
. It Ar pci# . It Ar pci#
PCI bus access devices, see PCI bus access devices, see
.Xr \&pci 4 .Xr \&pci 4
. It Ar dpti#
DPT/Adaptec RAID management interface
. El . El
.El .El
.Sh FILES .Sh FILES

View File

@ -1,11 +1,11 @@
# $NetBSD: GENERIC,v 1.426 2001/09/14 21:44:21 nathanw Exp $ # $NetBSD: GENERIC,v 1.427 2001/09/21 23:44:21 ad Exp $
# #
# GENERIC -- everything that's currently supported # GENERIC -- everything that's currently supported
# #
include "arch/i386/conf/std.i386" include "arch/i386/conf/std.i386"
#ident "GENERIC-$Revision: 1.426 $" #ident "GENERIC-$Revision: 1.427 $"
maxusers 32 # estimated number of users maxusers 32 # estimated number of users
@ -403,6 +403,7 @@ lpt2 at isa? port 0x3bc
iop* at pci? dev ? function ? # I/O processor iop* at pci? dev ? function ? # I/O processor
iopsp* at iop? tid ? # SCSI/FC-AL ports iopsp* at iop? tid ? # SCSI/FC-AL ports
ld* at iop? tid ? # block devices ld* at iop? tid ? # block devices
dpti* at iop? tid 0 # DPT/Adaptec control interface
# SCSI Controllers and Devices # SCSI Controllers and Devices

View File

@ -1,4 +1,4 @@
# $NetBSD: INSTALL,v 1.172 2001/09/14 21:44:21 nathanw Exp $ # $NetBSD: INSTALL,v 1.173 2001/09/21 23:44:22 ad Exp $
# #
# INSTALL - Installation kernel. # INSTALL - Installation kernel.
# #
@ -288,6 +288,7 @@ com2 at isa? port 0x3e8 irq 5
iop* at pci? dev ? function ? # I/O processor iop* at pci? dev ? function ? # I/O processor
iopsp* at iop? tid ? # SCSI/FC-AL ports iopsp* at iop? tid ? # SCSI/FC-AL ports
ld* at iop? tid ? # Block devices ld* at iop? tid ? # Block devices
#dpti* at iop? tid 0 # DPT/Adaptec control interface
# SCSI Controllers and Devices # SCSI Controllers and Devices

View File

@ -1,4 +1,4 @@
# $NetBSD: INSTALL_SMALL,v 1.70 2001/09/14 21:44:22 nathanw Exp $ # $NetBSD: INSTALL_SMALL,v 1.71 2001/09/21 23:44:22 ad Exp $
# #
# INSTALL_SMALL - Small Installation kernel. # INSTALL_SMALL - Small Installation kernel.
# #
@ -255,6 +255,7 @@ com2 at isa? port 0x3e8 irq 5
#iop* at pci? dev ? function ? # I/O processor #iop* at pci? dev ? function ? # I/O processor
#iopsp* at iop? tid ? # SCSI/FC-AL ports #iopsp* at iop? tid ? # SCSI/FC-AL ports
#ld* at iop? tid ? # block devices #ld* at iop? tid ? # block devices
#dpti* at iop? tid 0 # DPT/Adaptec control interface
# SCSI Controllers and Devices # SCSI Controllers and Devices

View File

@ -1,4 +1,4 @@
# $NetBSD: INSTALL_TINY,v 1.39 2001/09/14 21:44:22 nathanw Exp $ # $NetBSD: INSTALL_TINY,v 1.40 2001/09/21 23:44:22 ad Exp $
# #
# INSTALL_TINY - Tiny Installation kernel, suitable for 4M machines. # INSTALL_TINY - Tiny Installation kernel, suitable for 4M machines.
# #
@ -255,6 +255,7 @@ pc0 at isa? port 0x60 irq 1 # pccons generic PC console driver
#iop* at pci? dev ? function ? # I/O processor #iop* at pci? dev ? function ? # I/O processor
#iopsp* at iop? tid ? # SCSI/FC-AL ports #iopsp* at iop? tid ? # SCSI/FC-AL ports
#ld* at iop? tid ? # block devices #ld* at iop? tid ? # block devices
#dpti* at iop? tid 0 # DPT/Adaptec control interface
# SCSI Controllers and Devices # SCSI Controllers and Devices

View File

@ -1,4 +1,4 @@
/* $NetBSD: conf.c,v 1.146 2001/09/13 22:08:44 thorpej Exp $ */ /* $NetBSD: conf.c,v 1.147 2001/09/21 23:44:21 ad Exp $ */
/*- /*-
* Copyright (c) 1998 The NetBSD Foundation, Inc. * Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -233,6 +233,8 @@ cdev_decl(iop);
cdev_decl(mlx); cdev_decl(mlx);
#include "mly.h" #include "mly.h"
cdev_decl(mly); cdev_decl(mly);
#include "dpti.h"
cdev_decl(dpti);
cdev_decl(edmca); cdev_decl(edmca);
#include "agp.h" #include "agp.h"
cdev_decl(agp); cdev_decl(agp);
@ -338,6 +340,7 @@ struct cdevsw cdevsw[] =
cdev__oci_init(NWSFONT,wsfont), /* 81: wsfont pseudo-device */ cdev__oci_init(NWSFONT,wsfont), /* 81: wsfont pseudo-device */
cdev__ocim_init(NAGP,agp), /* 82: AGP graphics aperture device */ cdev__ocim_init(NAGP,agp), /* 82: AGP graphics aperture device */
cdev_pci_init(NPCI,pci), /* 83: PCI bus access device */ cdev_pci_init(NPCI,pci), /* 83: PCI bus access device */
cdev__oci_init(NDPTI,dpti), /* 84: DPT/Adaptec RAID management */
}; };
int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]); int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
@ -463,6 +466,7 @@ static int chrtoblktbl[] = {
/* 81 */ NODEV, /* 81 */ NODEV,
/* 82 */ NODEV, /* 82 */ NODEV,
/* 83 */ NODEV, /* 83 */ NODEV,
/* 84 */ NODEV,
}; };
/* /*

View File

@ -1,4 +1,4 @@
# $NetBSD: DEVNAMES,v 1.75 2001/09/20 22:17:25 ad Exp $ # $NetBSD: DEVNAMES,v 1.76 2001/09/21 23:44:19 ad Exp $
# #
# This file contains all used device names and defined attributes in # This file contains all used device names and defined attributes in
# alphabetical order. New devices added to the system somewhere should first # alphabetical order. New devices added to the system somewhere should first
@ -239,6 +239,7 @@ dmz vax
dn vax dn vax
dp8390nic MI Attribute dp8390nic MI Attribute
dpt MI dpt MI
dpti MI
drbbc amiga drbbc amiga
drbbc amigappc drbbc amigappc
drsc amiga drsc amiga

539
sys/dev/i2o/dpti.c Normal file
View File

@ -0,0 +1,539 @@
/* $NetBSD: dpti.c,v 1.1 2001/09/21 23:44:20 ad Exp $ */
/*-
* Copyright (c) 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 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.
*/
/*
* Copyright (c) 1996-2000 Distributed Processing Technology Corporation
* Copyright (c) 2000 Adaptec Corporation
* All rights reserved.
*
* TERMS AND CONDITIONS OF USE
*
* Redistribution and use in source form, with or without modification, are
* permitted provided that redistributions of source code must retain the
* above copyright notice, this list of conditions and the following disclaimer.
*
* This software is provided `as is' by Adaptec 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 Adaptec 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 interruptions) 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 driver software, even
* if advised of the possibility of such damage.
*/
/*
* Adaptec/DPT I2O control interface.
*/
#include "opt_i2o.h"
#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/endian.h>
#include <sys/malloc.h>
#include <sys/conf.h>
#include <sys/ioctl.h>
#include <machine/bus.h>
#include <dev/i2o/i2o.h>
#include <dev/i2o/i2odpt.h>
#include <dev/i2o/iopio.h>
#include <dev/i2o/iopvar.h>
#include <dev/i2o/dptivar.h>
#include <compat/linux/common/linux_types.h>
#include <compat/linux/common/linux_ioctl.h>
#ifdef I2ODEBUG
#define DPRINTF(x) printf x
#else
#define DPRINTF(x)
#endif
static struct dpt_sig dpti_sig = {
{ 'd', 'P', 't', 'S', 'i', 'G'}, SIG_VERSION, PROC_INTEL,
PROC_386 | PROC_486 | PROC_PENTIUM | PROC_SEXIUM, FT_HBADRVR, 0,
OEM_DPT, OS_FREE_BSD, CAP_ABOVE16MB, DEV_ALL,
ADF_ALL_SC5,
0, 0, DPTI_VERSION, DPTI_REVISION, DPTI_SUBREVISION,
DPTI_MONTH, DPTI_DAY, DPTI_YEAR,
""
};
void dpti_attach(struct device *, struct device *, void *);
int dpti_blinkled(struct dpti_softc *);
int dpti_ctlrinfo(struct dpti_softc *, u_long, caddr_t);
int dpti_match(struct device *, struct cfdata *, void *);
int dpti_passthrough(struct dpti_softc *, caddr_t, struct proc *);
int dpti_sysinfo(struct dpti_softc *, u_long, caddr_t);
cdev_decl(dpti);
extern struct cfdriver dpti_cd;
struct cfattach dpti_ca = {
sizeof(struct dpti_softc), dpti_match, dpti_attach
};
int
dpti_match(struct device *parent, struct cfdata *match, void *aux)
{
struct iop_attach_args *ia;
struct iop_softc *iop;
ia = aux;
iop = (struct iop_softc *)parent;
if (ia->ia_class != I2O_CLASS_ANY || ia->ia_tid != I2O_TID_IOP)
return (0);
if (le16toh(iop->sc_status.orgid) != I2O_ORG_DPT)
return (0);
return (1);
}
void
dpti_attach(struct device *parent, struct device *self, void *aux)
{
struct iop_softc *iop;
struct dpti_softc *sc;
struct {
struct i2o_param_op_results pr;
struct i2o_param_read_results prr;
struct i2o_dpt_param_exec_iop_buffers dib;
} __attribute__ ((__packed__)) param;
int rv;
sc = (struct dpti_softc *)self;
iop = (struct iop_softc *)parent;
/*
* Tell the world what we are. The description in the signature
* must be no more than 46 bytes long (see dptivar.h).
*/
printf(": DPT/Adaptec SCSI RAID management interface\n");
sprintf(dpti_sig.dsDescription, "NetBSD %s I2O OSM", osrelease);
rv = iop_field_get_all(iop, I2O_TID_IOP,
I2O_DPT_PARAM_EXEC_IOP_BUFFERS, &param,
sizeof(param), NULL);
if (rv != 0)
return;
sc->sc_blinkled = le32toh(param.dib.serialoutputoff) + 8;
}
int
dptiopen(dev_t dev, int flag, int mode, struct proc *p)
{
if (securelevel > 1)
return (EPERM);
if (device_lookup(&dpti_cd, minor(dev)) == NULL)
return (ENXIO);
return (0);
}
int
dpticlose(dev_t dev, int flag, int mode, struct proc *p)
{
return (0);
}
int
dptiioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
{
struct iop_softc *iop;
struct dpti_softc *sc;
struct ioctl_pt *pt;
int i, size;
sc = device_lookup(&dpti_cd, minor(dev));
iop = (struct iop_softc *)sc->sc_dv.dv_parent;
/*
* Currently, we only take ioctls passed down from the Linux
* emulation layer.
*/
if (cmd == PTIOCLINUX) {
pt = (struct ioctl_pt *)data;
cmd = pt->com;
data = pt->data;
} else
return (ENOTTY);
size = IOCPARM_LEN(cmd);
switch (cmd & 0xffff) {
case DPT_SIGNATURE:
if (size > sizeof(dpti_sig))
size = sizeof(dpti_sig);
memcpy(data, &dpti_sig, size);
return (0);
case DPT_CTRLINFO:
return (dpti_ctlrinfo(sc, cmd, data));
case DPT_SYSINFO:
return (dpti_sysinfo(sc, cmd, data));
case DPT_BLINKLED:
if ((i = dpti_blinkled(sc)) == -1)
i = 0;
if (size == 0)
return (copyout(&i, *(caddr_t *)data, sizeof(i)));
*(int *)data = i;
return (0);
case DPT_TARGET_BUSY:
/*
* XXX This is here to stop linux_machdepioctl() from
* whining about an unknown ioctl. Really, it should be
* implemented.
*/
return (EIO);
case DPT_I2OUSRCMD:
return (dpti_passthrough(sc, data, p));
case DPT_I2ORESETCMD:
printf("%s: I2ORESETCMD not implemented\n",
sc->sc_dv.dv_xname);
return (ENOTTY);
case DPT_I2ORESCANCMD:
return (iop_reconfigure(iop, 0));
default:
return (ENOTTY);
}
}
int
dpti_blinkled(struct dpti_softc *sc)
{
struct iop_softc *iop;
u_int v;
iop = (struct iop_softc *)sc->sc_dv.dv_parent;
v = bus_space_read_1(iop->sc_iot, iop->sc_ioh, sc->sc_blinkled + 0);
if (v == 0xbc) {
v = bus_space_read_1(iop->sc_iot, iop->sc_ioh,
sc->sc_blinkled + 1);
return (v);
}
return (-1);
}
int
dpti_ctlrinfo(struct dpti_softc *sc, u_long cmd, caddr_t data)
{
struct dpt_ctlrinfo CtlrInfo;
struct iop_softc *iop;
int rv, i;
iop = (struct iop_softc *)sc->sc_dv.dv_parent;
memset(&CtlrInfo, 0, sizeof(CtlrInfo));
CtlrInfo.length = sizeof(CtlrInfo) - sizeof(u_int16_t);
CtlrInfo.drvrHBAnum = sc->sc_dv.dv_unit;
CtlrInfo.baseAddr = iop->sc_memaddr;
if ((i = dpti_blinkled(sc)) == -1)
i = 0;
CtlrInfo.blinkState = i;
CtlrInfo.pciBusNum = iop->sc_pcibus;
CtlrInfo.pciDeviceNum = iop->sc_pcidev;
CtlrInfo.hbaFlags = FLG_OSD_PCI_VALID | FLG_OSD_DMA | FLG_OSD_I2O;
CtlrInfo.Interrupt = 10; /* XXX */
if (IOCPARM_LEN(cmd) > sizeof(*data)) {
bcopy(&CtlrInfo, data, sizeof(CtlrInfo));
rv = 0;
} else
rv = copyout(&CtlrInfo, *(caddr_t *)data,
sizeof(CtlrInfo));
return (rv);
}
int
dpti_sysinfo(struct dpti_softc *sc, u_long cmd, caddr_t data)
{
/*
* XXX Not currently implemented, since it involves reading from the
* IBM PC CMOS and grovelling around in ISA expansion card space,
* which is kind of disgusting. The DPT utilities don't seem to
* mind. :-)
*/
return (EIO);
}
int
dpti_passthrough(struct dpti_softc *sc, caddr_t data, struct proc *proc)
{
struct iop_softc *iop;
struct i2o_msg mh, *mf;
struct i2o_reply rh;
struct iop_msg *im;
struct dpti_ptbuf bufs[IOP_MAX_MSG_XFERS];
u_int32_t mbtmp[IOP_MAX_MSG_SIZE / sizeof(u_int32_t)];
u_int32_t rbtmp[IOP_MAX_MSG_SIZE / sizeof(u_int32_t)];
int rv, msgsize, repsize, sgoff, i, mapped, nbuf;
u_int32_t *p, *pmax;
iop = (struct iop_softc *)sc->sc_dv.dv_parent;
if ((rv = dpti_blinkled(sc)) != -1) {
if (rv != 0) {
printf("%s: adapter blinkled = 0x%02x\n",
sc->sc_dv.dv_xname, rv);
return (EIO);
}
}
/*
* Copy in the message frame header and determine the size of the
* full message frame.
*/
if ((rv = copyin(data, &mh, sizeof(mh))) != 0) {
DPRINTF(("%s: message copyin failed\n",
sc->sc_dv.dv_xname));
return (rv);
}
msgsize = (mh.msgflags >> 14) & ~3;
if (msgsize < sizeof(mh) || msgsize >= IOP_MAX_MSG_SIZE) {
DPRINTF(("%s: bad message frame size\n",
sc->sc_dv.dv_xname));
return (EINVAL);
}
/*
* Handle special commands.
*
* XXX We'll need to handle all of these later for online firmware
* upgrades. Swish or what, eh?
*/
switch (mh.msgfunc >> 24) {
case I2O_EXEC_IOP_RESET:
printf("dpti%s: I2O_EXEC_IOP_RESET not implemented\n",
sc->sc_dv.dv_xname);
return (EIO);
case I2O_EXEC_OUTBOUND_INIT:
printf("dpti%s: I2O_EXEC_OUTBOUND_INIT not implemented\n",
sc->sc_dv.dv_xname);
return (EIO);
case I2O_EXEC_SYS_TAB_SET:
printf("dpti%s: I2O_EXEC_SYS_TAB_SET not implemented\n",
sc->sc_dv.dv_xname);
return (EIO);
case I2O_EXEC_STATUS_GET:
iop_status_get(iop, 0);
rv = copyout(&iop->sc_status, data + msgsize,
sizeof(iop->sc_status));
return (rv);
}
/*
* Copy in the full message frame.
*/
if ((rv = copyin(data, mbtmp, msgsize)) != 0) {
DPRINTF(("%s: full message copyin failed\n",
sc->sc_dv.dv_xname));
return (rv);
}
/*
* Determine the size of the reply frame, and copy it in.
*/
if ((rv = copyin(data + msgsize, &rh, sizeof(rh))) != 0) {
DPRINTF(("%s: reply copyin failed\n",
sc->sc_dv.dv_xname));
return (rv);
}
repsize = (rh.msgflags >> 14) & ~3;
if (repsize < sizeof(rh) || repsize >= IOP_MAX_MSG_SIZE) {
DPRINTF(("%s: bad reply header size\n",
sc->sc_dv.dv_xname));
return (EINVAL);
}
if ((rv = copyin(data + msgsize, rbtmp, repsize)) != 0) {
DPRINTF(("%s: reply too large\n", sc->sc_dv.dv_xname));
return (rv);
}
/*
* If the message has a scatter gather list, it must be comprised of
* simple elements. If any one transfer contains multiple segments,
* we allocate a temporary buffer for it; otherwise, the buffer will
* be mapped directly. XXX Lies! We don't do scatter-gather yet.
*/
if ((sgoff = ((mh.msgflags >> 4) & 15)) != 0) {
if ((sgoff + 2) > (msgsize >> 2)) {
DPRINTF(("%s: invalid message size fields\n",
sc->sc_dv.dv_xname));
return (EINVAL);
}
} else
nbuf = -1;
if (sgoff != 0) {
p = mbtmp + sgoff;
pmax = mbtmp + (msgsize >> 2);
for (nbuf = 0; nbuf < IOP_MAX_MSG_XFERS; nbuf++) {
if (p > pmax - 2) {
DPRINTF(("%s: invalid SGL (1)\n",
sc->sc_dv.dv_xname));
return (EINVAL);
}
if ((p[0] & 0x30000000) != I2O_SGL_SIMPLE) {
DPRINTF(("%s: invalid SGL (2)\n",
sc->sc_dv.dv_xname));
return (EINVAL);
}
bufs[nbuf].db_out = (p[0] & I2O_SGL_DATA_OUT) != 0;
if ((p[0] & I2O_SGL_END_BUFFER) != 0) {
if ((p[0] & 0x00ffffff) > IOP_MAX_XFER) {
DPRINTF(("%s: buffer too large\n",
sc->sc_dv.dv_xname));
return (EINVAL);
}
bufs[nbuf].db_ptr = (caddr_t)p[1];
bufs[nbuf].db_proc = proc;
bufs[nbuf].db_size = p[0] & 0x00ffffff;
if ((p[0] & I2O_SGL_END) != 0)
break;
p += 2;
continue;
}
printf("%s: scatter-gather not implemented\n",
sc->sc_dv.dv_xname);
return (EIO);
}
if (nbuf == IOP_MAX_MSG_XFERS) {
DPRINTF(("%s: too many transfers\n",
sc->sc_dv.dv_xname));
return (EINVAL);
}
}
/*
* Allocate a wrapper, and adjust the message header fields to
* indicate that no scatter-gather list is currently present.
*/
im = iop_msg_alloc(iop, IM_WAIT | IM_NOSTATUS);
im->im_rb = (struct i2o_reply *)rbtmp;
mf = (struct i2o_msg *)mbtmp;
mf->msgictx = IOP_ICTX;
mf->msgtctx = im->im_tctx;
mapped = 0;
if (sgoff != 0)
mf->msgflags = (mf->msgflags & 0xff0f) | (sgoff << 16);
/*
* Map the data transfer(s).
*/
for (i = 0; i <= nbuf; i++) {
rv = iop_msg_map(iop, im, mbtmp, bufs[i].db_ptr,
bufs[i].db_size, bufs[i].db_out, bufs[i].db_proc);
if (rv != 0) {
DPRINTF(("%s: msg_map failed\n",
sc->sc_dv.dv_xname));
goto bad;
}
mapped = 1;
}
/*
* Start the command and sleep until it completes.
*/
if (sc->sc_nactive++ >= 2)
tsleep(&sc->sc_nactive, PRIBIO, "dptislp", 0);
if ((rv = iop_msg_post(iop, im, mbtmp, 5*60*1000)) != 0)
goto bad;
/*
* Copy out the reply frame.
*/
if ((rv = copyout(rbtmp, data + msgsize, repsize)) != 0)
DPRINTF(("%s: reply copyout() failed\n",
sc->sc_dv.dv_xname));
bad:
sc->sc_nactive--;
wakeup_one(&sc->sc_nactive);
if (mapped)
iop_msg_unmap(iop, im);
iop_msg_free(iop, im);
return (rv);
}

393
sys/dev/i2o/dptivar.h Normal file
View File

@ -0,0 +1,393 @@
/* $NetBSD: dptivar.h,v 1.1 2001/09/21 23:44:20 ad Exp $ */
/*-
* Copyright (c) 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 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.
*/
/*
* Copyright (c) 1996-2000 Distributed Processing Technology Corporation
* Copyright (c) 2000 Adaptec Corporation
* All rights reserved.
*
* TERMS AND CONDITIONS OF USE
*
* Redistribution and use in source form, with or without modification, are
* permitted provided that redistributions of source code must retain the
* above copyright notice, this list of conditions and the following disclaimer.
*
* This software is provided `as is' by Adaptec 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 Adaptec 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 interruptions) 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 driver software, even
* if advised of the possibility of such damage.
*/
#ifndef _I2O_DPTIVAR_H_
#define _I2O_DPTIVAR_H_
/*
* Runtime state.
*/
struct dpti_softc {
struct device sc_dv;
int sc_blinkled;
int sc_nactive;
};
struct dpti_ptbuf {
void *db_ptr;
struct proc *db_proc;
int db_size;
int db_out;
};
/*
* Constants used by the `signature'.
*/
#define DPTI_VERSION 1
#define DPTI_REVISION 0
#define DPTI_SUBREVISION 0
#define DPTI_YEAR 1
#define DPTI_MONTH 9
#define DPTI_DAY 12
/*
* ioctls. We define only the lower 16 bits, since the DPT utilities don't
* seem to obey the ioctl encoding conventions of each platform - the high
* 16 bits are relatively meaningless.
*/
#define DPT_EATAUSRCMD 0x4441
#define DPT_DEBUG 0x4442
#define DPT_SIGNATURE 0x4443
#define DPT_NUMCTRLS 0x4444
#define DPT_CTRLINFO 0x4445
#define DPT_STATINFO 0x4446
#define DPT_CLRSTAT 0x4447
#define DPT_SYSINFO 0x4448
#define DPT_TIMEOUT 0x4449
#define DPT_CONFIG 0x444a
#define DPT_BLINKLED 0x444b
#define DPT_I2OUSRCMD 0x444c
#define DPT_I2ORESCANCMD 0x444d
#define DPT_I2ORESETCMD 0x444e
#define DPT_TARGET_BUSY 0x444f
/*
* Controller and system info structures.
*/
struct dpt_ctlrinfo {
u_int16_t length;
u_int16_t drvrHBAnum;
u_int32_t baseAddr;
u_int16_t blinkState;
u_int8_t pciBusNum;
u_int8_t pciDeviceNum;
u_int16_t hbaFlags;
u_int16_t Interrupt;
u_int32_t reserved1;
u_int32_t reserved2;
u_int32_t reserved3;
};
#define FLG_OSD_PCI_VALID 0x0001
#define FLG_OSD_DMA 0x0002
#define FLG_OSD_I2O 0x0004
struct dpt_targetbusy {
u_long channel;
u_long id;
u_long lun;
u_long isbusy;
};
#if (!defined(dsDescription_size))
# define dsDescription_size 46
#endif
struct dpt_sig {
char dsSignature[6]; /* ALWAYS "dPtSiG" */
u_int8_t dsSigVersion; /* sig version (currently 1) */
u_int8_t dsProcessorFamily; /* what type of processor */
u_int8_t dsProcessor; /* precise processor */
u_int8_t dsFiletype; /* type of file */
u_int8_t dsFiletypeFlags; /* flags to specify type, etc. */
u_int8_t dsOEM; /* OEM file was created for */
u_int32_t dsOS; /* which Operating systems */
u_int16_t dsCapabilities; /* RAID levels, etc. */
u_int16_t dsDeviceSupp; /* SCSI device types supported */
u_int16_t dsAdapterSupp; /* DPT HBA families supported */
u_int16_t dsApplication; /* applications file is for */
u_int8_t dsRequirements; /* Other driver dependencies */
u_int8_t dsVersion; /* 1 */
u_int8_t dsRevision; /* 'J' */
u_int8_t dsSubRevision; /* '9' ' ' if N/A */
u_int8_t dsMonth; /* creation month */
u_int8_t dsDay; /* creation day */
u_int8_t dsYear; /* creation year since 1980 (1993=13) */
char dsDescription[dsDescription_size];
};
/*
* Defs pertaning to dpt_sig.
*/
/* Current Signature Version - u_int8_t dsSigVersion; */
/* ------------------------------------------------------------------ */
#define SIG_VERSION 1
/* Processor Family - u_int8_t dsProcessorFamily; DISTINCT VALUES */
/* ------------------------------------------------------------------ */
/* What type of processor the file is meant to run on. */
/* This will let us know whether to read u_int16_ts as high/low or low/high. */
#define PROC_INTEL 0x00 /* Intel 80x86 */
#define PROC_MOTOROLA 0x01 /* Motorola 68K */
#define PROC_MIPS4000 0x02 /* MIPS RISC 4000 */
#define PROC_MIPS 0x02 /* MIPS RISC */
#define PROC_ALPHA 0x03 /* DEC Alpha */
#define PROC_POWERPC 0x04 /* IBM Power PC */
#define PROC_i960 0x05 /* Intel i960 */
#define PROC_ULTRASPARC 0x06 /* SPARC processor */
/* Specific Minimim Processor - u_int8_t dsProcessor; FLAG BITS */
/* ------------------------------------------------------------------ */
/* Different bit definitions dependent on processor_family */
/* PROC_INTEL: */
#define PROC_8086 0x01 /* Intel 8086 */
#define PROC_286 0x02 /* Intel 80286 */
#define PROC_386 0x04 /* Intel 80386 */
#define PROC_486 0x08 /* Intel 80486 */
#define PROC_PENTIUM 0x10 /* Intel 586 aka P5 aka Pentium */
#define PROC_SEXIUM 0x20 /* Intel 686 aka P6 aka Pentium Pro or MMX */
/* PROC_i960: */
#define PROC_960RX 0x01 /* Intel 80960RP/RD */
#define PROC_960HX 0x02 /* Intel 80960HA/HD/HT */
#define PROC_960RN 0x03 /* Intel 80960RN/RM */
#define PROC_960RS 0x04 /* Intel 80960RS */
/* PROC_MOTOROLA: */
#define PROC_68000 0x01 /* Motorola 68000 */
#define PROC_68010 0x02 /* Motorola 68010 */
#define PROC_68020 0x04 /* Motorola 68020 */
#define PROC_68030 0x08 /* Motorola 68030 */
#define PROC_68040 0x10 /* Motorola 68040 */
/* PROC_POWERPC */
#define PROC_PPC601 0x01 /* PowerPC 601 */
#define PROC_PPC603 0x02 /* PowerPC 603 */
#define PROC_PPC604 0x04 /* PowerPC 604 */
/* PROC_MIPS */
#define PROC_R4000 0x01 /* MIPS R4000 */
#define PROC_RM7000 0x02 /* MIPS RM7000 */
/* Filetype - u_int8_t dsFiletype; DISTINCT VALUES */
/* ------------------------------------------------------------------ */
#define FT_EXECUTABLE 0 /* Executable Program */
#define FT_SCRIPT 1 /* Script/Batch File??? */
#define FT_HBADRVR 2 /* HBA Driver */
#define FT_OTHERDRVR 3 /* Other Driver */
#define FT_IFS 4 /* Installable Filesystem Driver */
#define FT_ENGINE 5 /* DPT Engine */
#define FT_COMPDRVR 6 /* Compressed Driver Disk */
#define FT_LANGUAGE 7 /* Foreign Language file */
#define FT_FIRMWARE 8 /* Downloadable or actual Firmware */
#define FT_COMMMODL 9 /* Communications Module */
#define FT_INT13 10 /* INT 13 style HBA Driver */
#define FT_HELPFILE 11 /* Help file */
#define FT_LOGGER 12 /* Event Logger */
#define FT_INSTALL 13 /* An Install Program */
#define FT_LIBRARY 14 /* Storage Manager Real-Mode Calls */
#define FT_RESOURCE 15 /* Storage Manager Resource File */
#define FT_MODEM_DB 16 /* Storage Manager Modem Database */
/* Filetype flags - u_int8_t dsFiletypeFlags; FLAG BITS */
/* ------------------------------------------------------------------ */
#define FTF_DLL 0x01 /* Dynamic Link Library */
#define FTF_NLM 0x02 /* Netware Loadable Module */
#define FTF_OVERLAYS 0x04 /* Uses overlays */
#define FTF_DEBUG 0x08 /* Debug version */
#define FTF_TSR 0x10 /* TSR */
#define FTF_SYS 0x20 /* DOS Loadable driver */
#define FTF_PROTECTED 0x40 /* Runs in protected mode */
#define FTF_APP_SPEC 0x80 /* Application Specific */
#define FTF_ROM (FTF_SYS|FTF_TSR) /* Special Case */
/* OEM - u_int8_t dsOEM; DISTINCT VALUES */
/* ------------------------------------------------------------------ */
#define OEM_DPT 0 /* DPT */
#define OEM_ATT 1 /* ATT */
#define OEM_NEC 2 /* NEC */
#define OEM_ALPHA 3 /* Alphatronix */
#define OEM_AST 4 /* AST */
#define OEM_OLIVETTI 5 /* Olivetti */
#define OEM_SNI 6 /* Siemens/Nixdorf */
#define OEM_SUN 7 /* SUN Microsystems */
#define OEM_ADAPTEC 8 /* Adaptec */
/* Operating System - u_int32_t dsOS; FLAG BITS */
/* ------------------------------------------------------------------ */
#define OS_DOS 0x00000001 /* PC/MS-DOS */
#define OS_WINDOWS 0x00000002 /* Microsoft Windows 3.x */
#define OS_WINDOWS_NT 0x00000004 /* Microsoft Windows NT */
#define OS_OS2M 0x00000008 /* OS/2 1.2.x,MS 1.3.0,IBM 1.3.x - Monolithic */
#define OS_OS2L 0x00000010 /* Microsoft OS/2 1.301 - LADDR */
#define OS_OS22x 0x00000020 /* IBM OS/2 2.x */
#define OS_NW286 0x00000040 /* Novell NetWare 286 */
#define OS_NW386 0x00000080 /* Novell NetWare 386 */
#define OS_GEN_UNIX 0x00000100 /* Generic Unix */
#define OS_SCO_UNIX 0x00000200 /* SCO Unix */
#define OS_ATT_UNIX 0x00000400 /* ATT Unix */
#define OS_UNIXWARE 0x00000800 /* USL Unix */
#define OS_INT_UNIX 0x00001000 /* Interactive Unix */
#define OS_SOLARIS 0x00002000 /* SunSoft Solaris */
#define OS_QNX 0x00004000 /* QNX for Tom Moch */
#define OS_NEXTSTEP 0x00008000 /* NeXTSTEP/OPENSTEP/MACH */
#define OS_BANYAN 0x00010000 /* Banyan Vines */
#define OS_OLIVETTI_UNIX 0x00020000/* Olivetti Unix */
#define OS_MAC_OS 0x00040000 /* Mac OS */
#define OS_WINDOWS_95 0x00080000 /* Microsoft Windows '95 */
#define OS_NW4x 0x00100000 /* Novell Netware 4.x */
#define OS_BSDI_UNIX 0x00200000 /* BSDi Unix BSD/OS 2.0 and up */
#define OS_AIX_UNIX 0x00400000 /* AIX Unix */
#define OS_FREE_BSD 0x00800000 /* FreeBSD Unix */
#define OS_LINUX 0x01000000 /* Linux */
#define OS_DGUX_UNIX 0x02000000 /* Data General Unix */
#define OS_SINIX_N 0x04000000 /* SNI SINIX-N */
#define OS_PLAN9 0x08000000 /* ATT Plan 9 */
#define OS_TSX 0x10000000 /* SNH TSX-32 */
#define OS_WINDOWS_98 0x20000000 /* Microsoft Windows '98 */
#define OS_OTHER 0x80000000 /* Other */
/* Capabilities - u_int16_t dsCapabilities; FLAG BITS */
/* ------------------------------------------------------------------ */
#define CAP_RAID0 0x0001 /* RAID-0 */
#define CAP_RAID1 0x0002 /* RAID-1 */
#define CAP_RAID3 0x0004 /* RAID-3 */
#define CAP_RAID5 0x0008 /* RAID-5 */
#define CAP_SPAN 0x0010 /* Spanning */
#define CAP_PASS 0x0020 /* Provides passthrough */
#define CAP_OVERLAP 0x0040 /* Passthrough supports overlapped commands */
#define CAP_ASPI 0x0080 /* Supports ASPI Command Requests */
#define CAP_ABOVE16MB 0x0100 /* ISA Driver supports greater than 16MB */
#define CAP_EXTEND 0x8000 /* Extended info appears after description */
#ifdef SNI_MIPS
#define CAP_CACHEMODE 0x1000 /* dpt_force_cache is set in driver */
#endif
/* Devices Supported - u_int16_t dsDeviceSupp; FLAG BITS */
/* ------------------------------------------------------------------ */
#define DEV_DASD 0x0001 /* DASD (hard drives) */
#define DEV_TAPE 0x0002 /* Tape drives */
#define DEV_PRINTER 0x0004 /* Printers */
#define DEV_PROC 0x0008 /* Processors */
#define DEV_WORM 0x0010 /* WORM drives */
#define DEV_CDROM 0x0020 /* CD-ROM drives */
#define DEV_SCANNER 0x0040 /* Scanners */
#define DEV_OPTICAL 0x0080 /* Optical Drives */
#define DEV_JUKEBOX 0x0100 /* Jukebox */
#define DEV_COMM 0x0200 /* Communications Devices */
#define DEV_OTHER 0x0400 /* Other Devices */
#define DEV_ALL 0xFFFF /* All SCSI Devices */
/* Adapters Families Supported - u_int16_t dsAdapterSupp; FLAG BITS */
/* ------------------------------------------------------------------ */
#define ADF_2001 0x0001 /* PM2001 */
#define ADF_2012A 0x0002 /* PM2012A */
#define ADF_PLUS_ISA 0x0004 /* PM2011,PM2021 */
#define ADF_PLUS_EISA 0x0008 /* PM2012B,PM2022 */
#define ADF_SC3_ISA 0x0010 /* PM2021 */
#define ADF_SC3_EISA 0x0020 /* PM2022,PM2122, etc */
#define ADF_SC3_PCI 0x0040 /* SmartCache III PCI */
#define ADF_SC4_ISA 0x0080 /* SmartCache IV ISA */
#define ADF_SC4_EISA 0x0100 /* SmartCache IV EISA */
#define ADF_SC4_PCI 0x0200 /* SmartCache IV PCI */
#define ADF_SC5_PCI 0x0400 /* Fifth Generation I2O products */
/*
* Combinations of products
*/
#define ADF_ALL_2000 (ADF_2001|ADF_2012A)
#define ADF_ALL_PLUS (ADF_PLUS_ISA|ADF_PLUS_EISA)
#define ADF_ALL_SC3 (ADF_SC3_ISA|ADF_SC3_EISA|ADF_SC3_PCI)
#define ADF_ALL_SC4 (ADF_SC4_ISA|ADF_SC4_EISA|ADF_SC4_PCI)
#define ADF_ALL_SC5 (ADF_SC5_PCI)
/* All EATA Cacheing Products */
#define ADF_ALL_CACHE (ADF_ALL_PLUS|ADF_ALL_SC3|ADF_ALL_SC4)
/* All EATA Bus Mastering Products */
#define ADF_ALL_MASTER (ADF_2012A|ADF_ALL_CACHE)
/* All EATA Adapter Products */
#define ADF_ALL_EATA (ADF_2001|ADF_ALL_MASTER)
#define ADF_ALL ADF_ALL_EATA
/* Application - u_int16_t dsApplication; FLAG BITS */
/* ------------------------------------------------------------------ */
#define APP_DPTMGR 0x0001 /* DPT Storage Manager */
#define APP_ENGINE 0x0002 /* DPT Engine */
#define APP_SYTOS 0x0004 /* Sytron Sytos Plus */
#define APP_CHEYENNE 0x0008 /* Cheyenne ARCServe + ARCSolo */
#define APP_MSCDEX 0x0010 /* Microsoft CD-ROM extensions */
#define APP_NOVABACK 0x0020 /* NovaStor Novaback */
#define APP_AIM 0x0040 /* Archive Information Manager */
/* Requirements - u_int8_t dsRequirements; FLAG BITS */
/* ------------------------------------------------------------------ */
#define REQ_SMARTROM 0x01 /* Requires SmartROM to be present */
#define REQ_DPTDDL 0x02 /* Requires DPTDDL.SYS to be loaded */
#define REQ_HBA_DRIVER 0x04 /* Requires an HBA driver to be loaded */
#define REQ_ASPI_TRAN 0x08 /* Requires an ASPI Transport Modules */
#define REQ_ENGINE 0x10 /* Requires a DPT Engine to be loaded */
#define REQ_COMM_ENG 0x20 /* Requires a DPT Communications Engine */
/* ------------------------------------------------------------------ */
/* Requirements - u_int16_t dsFirmware; FLAG BITS */
/* ------------------------------------------------------------------ */
#define dsFirmware dsApplication
#define FW_DNLDSIZE0 0x0000 /* 0..2 DownLoader Size - NONE */
#define FW_DNLDSIZE16 0x0001 /* 0..2 DownLoader Size 16K */
#define FW_DNLDSIZE32 0x0002 /* 0..2 DownLoader Size 32K */
#define FW_DNLDSIZE64 0x0004 /* 0..2 DownLoader Size 64K */
#define FW_LOAD_BTM 0x2000 /* 13 Load Offset (1=Btm, 0=Top) */
#define FW_LOAD_TOP 0x0000 /* 13 Load Offset (1=Btm, 0=Top) */
#define FW_SIG_VERSION1 0x0000 /* 15..14 Version Bits 0=Ver1 */
#endif /* !_I2O_DPTIVAR_H_ */

View File

@ -1,4 +1,4 @@
# $NetBSD: files.i2o,v 1.4 2001/08/06 13:25:10 ad Exp $ # $NetBSD: files.i2o,v 1.5 2001/09/21 23:44:20 ad Exp $
defopt opt_i2o.h I2OVERBOSE I2ODEBUG defopt opt_i2o.h I2OVERBOSE I2ODEBUG
@ -15,3 +15,7 @@ file dev/i2o/iopsp.c iopsp
device iopl: ether, token, fddi, ifnet, arp device iopl: ether, token, fddi, ifnet, arp
attach iopl at iop attach iopl at iop
file dev/i2o/iopl.c iopl file dev/i2o/iopl.c iopl
device dpti
attach dpti at iop
file dev/i2o/dpti.c dpti needs-flag

View File

@ -1,4 +1,4 @@
/* $NetBSD: i2o.h,v 1.8 2001/08/22 09:42:05 ad Exp $ */ /* $NetBSD: i2o.h,v 1.9 2001/09/21 23:44:21 ad Exp $ */
/*- /*-
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@ -57,6 +57,7 @@
/* Macros to assist in building message headers */ /* Macros to assist in building message headers */
#define I2O_MSGFLAGS(s) (I2O_VERSION_11 | (sizeof(struct s) << 14)) #define I2O_MSGFLAGS(s) (I2O_VERSION_11 | (sizeof(struct s) << 14))
#define I2O_MSGFUNC(t, f) ((t) | (I2O_TID_HOST << 12) | ((f) << 24)) #define I2O_MSGFUNC(t, f) ((t) | (I2O_TID_HOST << 12) | ((f) << 24))
#define I2O_MSGPRIV(o, f) ((f) | ((o) << 16))
/* Common message function codes with no payload or an undefined payload */ /* Common message function codes with no payload or an undefined payload */
#define I2O_UTIL_NOP 0x00 #define I2O_UTIL_NOP 0x00

170
sys/dev/i2o/i2odpt.h Normal file
View File

@ -0,0 +1,170 @@
/* $NetBSD: i2odpt.h,v 1.1 2001/09/21 23:44:21 ad Exp $ */
/*-
* Copyright (c) 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 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.
*/
/*
* Copyright (c) 1996-2000 Distributed Processing Technology Corporation
* Copyright (c) 2000 Adaptec Corporation.
* All rights reserved.
*
* Redistribution and use in source form, with or without modification, are
* permitted provided that redistributions of source code must retain the
* above copyright notice, this list of conditions and the following disclaimer.
*
* This software is provided `as is' by Distributed Processing Technology 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 Distributed Processing Technology 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
* interruptions) 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 driver software, even if advised
* of the possibility of such damage.
*
*/
#ifndef _I2O_I2ODPT_H_
#define _I2O_I2ODPT_H_
/*
* ================= Messages =================
*/
#define I2O_DPT_SCSI_SCB_EXEC I2O_SCSI_SCB_EXEC
struct i2o_dpt_scsi_scb_exec {
u_int32_t msgflags;
u_int32_t msgictx;
u_int32_t msgtctx;
u_int32_t privfunc;
u_int32_t tid; /* bit 16: interpret; bit 17: phys */
u_int32_t flags;
u_int32_t scbflags;
u_int8_t cdb[16];
u_int32_t bytecount;
} __attribute__ ((__packed__));
#define I2O_DPT_FLASH_REGION_SIZE 0x0100
#define I2O_DPT_FLASH_REGION_READ 0x0101
#define I2O_DPT_FLASH_REGION_WRITE 0x0102
#define I2O_DPT_FLASH_REGION_CRC 0x0103
struct i2o_dpt_flash_region {
u_int32_t msgflags;
u_int32_t msgfunc;
u_int32_t msgictx;
u_int32_t msgtctx;
u_int32_t privfunc;
u_int32_t region;
u_int32_t regionoffset;
u_int32_t bytecount;
} __attribute__ ((__packed__));
#define DPT_FLASH_REGION_OP_FIRMWARE 0x00
#define DPT_FLASH_REGION_SOFTWARE 0x01
#define DPT_FLASH_REGION_OEM_NVRAM 0x02
#define DPT_FLASH_REGION_SERIAL 0x03
#define DPT_FLASH_REGION_BOOT_FIRMWARE 0x04
#define I2O_DPT_DRIVER_PRINTF 0x0200
struct i2o_dpt_driver_printf {
u_int32_t msgflags;
u_int32_t msgfunc;
u_int32_t msgictx;
u_int32_t msgtctx;
u_int32_t privfunc;
u_int32_t printbuffersize;
u_int8_t printbuffer[1];
} __attribute__ ((__packed__));
#define I2O_DPT_DIAG_ENABLE 0x0201
struct i2o_dpt_diag_enable {
u_int32_t msgflags;
u_int32_t msgfunc;
u_int32_t msgictx;
u_int32_t msgtctx;
u_int32_t privfunc;
} __attribute__ ((__packed__));
#define I2O_DPT_DRIVER_GET 0x0300
struct i2o_dpt_driver_get {
u_int32_t msgflags;
u_int32_t msgfunc;
u_int32_t msgictx;
u_int32_t msgtctx;
u_int32_t privfunc;
u_int32_t offset;
u_int32_t bytecount;
/* SGL follows. */
} __attribute__ ((__packed__));
#define I2O_DPT_DRIVER_SET 0x0301
struct i2o_dpt_driver_set {
u_int32_t msgflags;
u_int32_t msgfunc;
u_int32_t msgictx;
u_int32_t msgtctx;
u_int32_t privfunc;
u_int32_t offset;
u_int32_t bytecount;
/* SGL follows. */
} __attribute__ ((__packed__));
/*
* ================= Parameter groups =================
*/
#define I2O_DPT_PARAM_DEVICE_INFO 0x8000
struct i2o_dpt_param_device_info {
u_int8_t devicetype; /* as I2O_PARAM_SCSI_DEVICE_INFO */
u_int8_t flags; /* as I2O_PARAM_SCSI_DEVICE_INFO */
u_int16_t bus;
u_int32_t identifier;
u_int8_t luninfo[8];
} __attribute__ ((__packed__));
#define I2O_DPT_PARAM_EXEC_IOP_BUFFERS 0x8000
struct i2o_dpt_param_exec_iop_buffers {
u_int32_t serialoutputoff;
u_int32_t serialoutputsize;
u_int32_t serialheadersize;
u_int32_t serialflagssupported;
} __attribute__ ((__packed__));
#endif /* _I2O_I2ODPT_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: iop.c,v 1.17 2001/09/18 18:15:51 wiz Exp $ */ /* $NetBSD: iop.c,v 1.18 2001/09/21 23:44:21 ad Exp $ */
/*- /*-
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@ -210,12 +210,9 @@ static void iop_config_interrupts(struct device *);
static void iop_configure_devices(struct iop_softc *, int, int); static void iop_configure_devices(struct iop_softc *, int, int);
static void iop_devinfo(int, char *); static void iop_devinfo(int, char *);
static int iop_print(void *, const char *); static int iop_print(void *, const char *);
static int iop_reconfigure(struct iop_softc *, u_int);
static void iop_shutdown(void *); static void iop_shutdown(void *);
static int iop_submatch(struct device *, struct cfdata *, void *); static int iop_submatch(struct device *, struct cfdata *, void *);
#ifdef notyet
static int iop_vendor_print(void *, const char *); static int iop_vendor_print(void *, const char *);
#endif
static void iop_adjqparam(struct iop_softc *, int); static void iop_adjqparam(struct iop_softc *, int);
static void iop_create_reconf_thread(void *); static void iop_create_reconf_thread(void *);
@ -233,7 +230,6 @@ static int iop_passthrough(struct iop_softc *, struct ioppt *,
static void iop_reconf_thread(void *); static void iop_reconf_thread(void *);
static void iop_release_mfa(struct iop_softc *, u_int32_t); static void iop_release_mfa(struct iop_softc *, u_int32_t);
static int iop_reset(struct iop_softc *); static int iop_reset(struct iop_softc *);
static int iop_status_get(struct iop_softc *, int);
static int iop_systab_set(struct iop_softc *); static int iop_systab_set(struct iop_softc *);
static void iop_tfn_print(struct iop_softc *, struct i2o_fault_notify *); static void iop_tfn_print(struct iop_softc *, struct i2o_fault_notify *);
@ -433,6 +429,7 @@ iop_init(struct iop_softc *sc, const char *intrstr)
static void static void
iop_config_interrupts(struct device *self) iop_config_interrupts(struct device *self)
{ {
struct iop_attach_args ia;
struct iop_softc *sc, *iop; struct iop_softc *sc, *iop;
struct i2o_systab_entry *ste; struct i2o_systab_entry *ste;
int rv, i, niop; int rv, i, niop;
@ -536,13 +533,16 @@ iop_config_interrupts(struct device *self)
return; return;
} }
#ifdef notyet /*
/* Attempt to match and attach a product-specific extension. */ * Attempt to match and attach a product-specific extension.
*/
ia.ia_class = I2O_CLASS_ANY; ia.ia_class = I2O_CLASS_ANY;
ia.ia_tid = I2O_TID_IOP; ia.ia_tid = I2O_TID_IOP;
config_found_sm(self, &ia, iop_vendor_print, iop_submatch); config_found_sm(self, &ia, iop_vendor_print, iop_submatch);
#endif
/*
* Start device configuration.
*/
lockmgr(&sc->sc_conflock, LK_EXCLUSIVE, NULL); lockmgr(&sc->sc_conflock, LK_EXCLUSIVE, NULL);
if ((rv = iop_reconfigure(sc, 0)) == -1) { if ((rv = iop_reconfigure(sc, 0)) == -1) {
printf("%s: configure failed (%d)\n", sc->sc_dv.dv_xname, rv); printf("%s: configure failed (%d)\n", sc->sc_dv.dv_xname, rv);
@ -615,7 +615,7 @@ iop_reconf_thread(void *cookie)
/* /*
* Reconfigure: find new and removed devices. * Reconfigure: find new and removed devices.
*/ */
static int int
iop_reconfigure(struct iop_softc *sc, u_int chgind) iop_reconfigure(struct iop_softc *sc, u_int chgind)
{ {
struct iop_msg *im; struct iop_msg *im;
@ -840,16 +840,12 @@ iop_print(void *aux, const char *pnp)
return (UNCONF); return (UNCONF);
} }
#ifdef notyet
static int static int
iop_vendor_print(void *aux, const char *pnp) iop_vendor_print(void *aux, const char *pnp)
{ {
if (pnp != NULL) return (QUIET);
printf("vendor specific extension at %s", pnp);
return (UNCONF);
} }
#endif
static int static int
iop_submatch(struct device *parent, struct cfdata *cf, void *aux) iop_submatch(struct device *parent, struct cfdata *cf, void *aux)
@ -888,13 +884,13 @@ iop_shutdown(void *junk)
/* Wait. Some boards could still be flushing, stupidly enough. */ /* Wait. Some boards could still be flushing, stupidly enough. */
delay(5000*1000); delay(5000*1000);
printf(" done.\n"); printf(" done\n");
} }
/* /*
* Retrieve IOP status. * Retrieve IOP status.
*/ */
static int int
iop_status_get(struct iop_softc *sc, int nosleep) iop_status_get(struct iop_softc *sc, int nosleep)
{ {
struct i2o_exec_status_get mf; struct i2o_exec_status_get mf;

View File

@ -1,4 +1,4 @@
/* $NetBSD: iopvar.h,v 1.8 2001/08/22 09:42:05 ad Exp $ */ /* $NetBSD: iopvar.h,v 1.9 2001/09/21 23:44:21 ad Exp $ */
/*- /*-
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@ -147,6 +147,8 @@ struct iop_softc {
bus_space_tag_t sc_bus_iot; /* Parent but I/O tag */ bus_space_tag_t sc_bus_iot; /* Parent but I/O tag */
bus_addr_t sc_memaddr; /* Register window address */ bus_addr_t sc_memaddr; /* Register window address */
bus_size_t sc_memsize; /* Register window size */ bus_size_t sc_memsize; /* Register window size */
int sc_pcibus; /* PCI bus number */
int sc_pcidev; /* PCI device number */
struct i2o_status sc_status; /* Last retrieved status record */ struct i2o_status sc_status; /* Last retrieved status record */
}; };
@ -164,9 +166,11 @@ void iop_init(struct iop_softc *, const char *);
int iop_intr(void *); int iop_intr(void *);
int iop_lct_get(struct iop_softc *); int iop_lct_get(struct iop_softc *);
int iop_print_ident(struct iop_softc *, int); int iop_print_ident(struct iop_softc *, int);
int iop_post(struct iop_softc *, u_int32_t *);
int iop_reconfigure(struct iop_softc *, u_int);
int iop_status_get(struct iop_softc *, int);
int iop_simple_cmd(struct iop_softc *, int, int, int, int, 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_strvis(struct iop_softc *, const char *, int, char *, int);
int iop_post(struct iop_softc *, u_int32_t *);
void iop_initiator_register(struct iop_softc *, struct iop_initiator *); void iop_initiator_register(struct iop_softc *, struct iop_initiator *);
void iop_initiator_unregister(struct iop_softc *, struct iop_initiator *); void iop_initiator_unregister(struct iop_softc *, struct iop_initiator *);