1997-01-31 05:00:56 +03:00
|
|
|
/* $NetBSD: device.h,v 1.12 1997/01/31 02:00:56 thorpej Exp $ */
|
1994-10-27 00:08:38 +03:00
|
|
|
|
1993-10-12 06:22:19 +03:00
|
|
|
/*
|
1994-05-27 12:39:00 +04:00
|
|
|
* Copyright (c) 1992, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
1993-10-12 06:22:19 +03:00
|
|
|
*
|
|
|
|
* This code is derived from software contributed to Berkeley by
|
|
|
|
* Ralph Campbell.
|
|
|
|
*
|
|
|
|
* 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 University of
|
|
|
|
* California, Berkeley and its contributors.
|
|
|
|
* 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
|
|
|
|
*
|
1994-10-27 00:08:38 +03:00
|
|
|
* @(#)device.h 8.1 (Berkeley) 6/10/93
|
1993-10-12 06:22:19 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This structure is used to encapsulate the routines for a device driver.
|
|
|
|
* This allows an "object oriented" approach so a controller device driver
|
|
|
|
* can support multiple attached devices or a device can be attached to
|
|
|
|
* different types of controllers.
|
|
|
|
*/
|
1995-09-26 00:10:03 +03:00
|
|
|
struct ScsiCmd;
|
1997-01-31 05:00:56 +03:00
|
|
|
struct device;
|
1995-09-26 00:10:03 +03:00
|
|
|
|
1995-09-11 12:29:11 +04:00
|
|
|
struct pmax_driver {
|
1993-10-12 06:22:19 +03:00
|
|
|
char *d_name; /* device driver name (e.g., "rz") */
|
1995-09-26 00:10:03 +03:00
|
|
|
|
|
|
|
/* routine to probe & initialize device */
|
|
|
|
int (*d_init) __P((void *));
|
|
|
|
/* routine to start operation */
|
|
|
|
void (*d_start) __P((struct ScsiCmd *cmd));
|
|
|
|
/* routine to call when operation complete */
|
1996-09-21 12:45:41 +04:00
|
|
|
void (*d_done) __P(( int unit, int errno, int buflen,
|
|
|
|
int status_byte));
|
1995-09-26 00:10:03 +03:00
|
|
|
/* routine to call when interrupt is seen */
|
|
|
|
int (*d_intr) __P((void* sc));
|
1993-10-12 06:22:19 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This structure describes controllers directly connected to CPU
|
|
|
|
* and is partially initialized in "ioconf.c" by the 'config' program.
|
|
|
|
*/
|
|
|
|
struct pmax_ctlr {
|
1995-09-11 12:29:11 +04:00
|
|
|
struct pmax_driver *pmax_driver;/* controller driver routines */
|
1993-10-12 06:22:19 +03:00
|
|
|
int pmax_unit; /* controller number */
|
|
|
|
char *pmax_addr; /* address of controller */
|
|
|
|
int pmax_pri; /* interrupt priority */
|
|
|
|
int pmax_flags; /* flags */
|
|
|
|
|
|
|
|
int pmax_alive; /* true if init routine succeeded */
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This structure describes devices connected to a SCSI interface
|
|
|
|
* and is partially initialized in "ioconf.c" by the 'config' program.
|
|
|
|
*/
|
1995-09-13 23:35:53 +04:00
|
|
|
struct pmax_scsi_device {
|
1995-09-11 12:29:11 +04:00
|
|
|
struct pmax_driver *sd_driver; /* SCSI device driver routines */
|
|
|
|
struct pmax_driver *sd_cdriver; /* SCSI interface driver routines */
|
1993-10-12 06:22:19 +03:00
|
|
|
int sd_unit; /* device unit number */
|
|
|
|
int sd_ctlr; /* SCSI interface number */
|
|
|
|
int sd_drive; /* SCSI address number */
|
|
|
|
int sd_slave; /* LUN if device has multiple units */
|
|
|
|
int sd_flags; /* flags */
|
|
|
|
|
|
|
|
int sd_alive; /* true if init routine succeeded */
|
1997-01-31 05:00:56 +03:00
|
|
|
struct device *sd_devp; /* new config glue kludge */
|
1993-10-12 06:22:19 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Define special unit types used by the config program */
|
|
|
|
#define QUES -1 /* -1 means '?' */
|
|
|
|
#define UNKNOWN -2 /* -2 means not set yet */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This structure contains information that a SCSI interface controller
|
|
|
|
* needs to execute a SCSI command.
|
|
|
|
*/
|
|
|
|
typedef struct ScsiCmd {
|
1995-09-13 23:35:53 +04:00
|
|
|
struct pmax_scsi_device *sd; /* device requesting the command */
|
1993-10-12 06:22:19 +03:00
|
|
|
int unit; /* unit number passed to device done routine */
|
|
|
|
int flags; /* control flags for this command (see below) */
|
|
|
|
int buflen; /* length of the data buffer in bytes */
|
|
|
|
char *buf; /* pointer to data buffer for this command */
|
|
|
|
int cmdlen; /* length of data in cmdbuf */
|
|
|
|
u_char *cmd; /* buffer for the SCSI command */
|
1995-09-26 00:10:03 +03:00
|
|
|
int error; /* compatibility hack for new scsi */
|
1993-10-12 06:22:19 +03:00
|
|
|
} ScsiCmd;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Define flags for controlling the SCSI command.
|
|
|
|
*
|
|
|
|
* SCSICMD_DATA_TO_DEVICE
|
|
|
|
* TRUE -> data is to be transferred to the device.
|
|
|
|
* FALSE -> data is to be transferred from the device.
|
|
|
|
* meaningless if buflen is 0.
|
|
|
|
* SCSICMD_USE_SYNC
|
|
|
|
* Attempt to negotiate for a synchronous data transfer.
|
|
|
|
*/
|
|
|
|
#define SCSICMD_DATA_TO_DEVICE 0x01
|
|
|
|
#define SCSICMD_USE_SYNC 0x02
|
|
|
|
|
1995-03-28 22:13:48 +04:00
|
|
|
#ifdef _KERNEL
|
1993-10-12 06:22:19 +03:00
|
|
|
extern struct pmax_ctlr pmax_cinit[];
|
1995-09-13 23:35:53 +04:00
|
|
|
extern struct pmax_scsi_device scsi_dinit[];
|
1996-04-10 20:27:38 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Old-style pmax driver glue:
|
|
|
|
* Callbacks to add known a controller, and to configure all slaves on
|
|
|
|
* all known controllers.
|
|
|
|
*/
|
|
|
|
void pmax_add_scsi __P((struct pmax_driver *dp, int unit));
|
|
|
|
void configure_scsi __P((void));
|
|
|
|
|
|
|
|
#endif /* _KERNEL */
|