Old scsi code until the pc532 port can be made to use the new scsi code
This commit is contained in:
parent
f58e820881
commit
76be62770b
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* $Id: cddefs.h,v 1.1 1994/04/01 23:18:07 phil Exp $
|
||||
*/
|
||||
|
||||
struct cd_data {
|
||||
int flags;
|
||||
#define CDVALID 0x02 /* PARAMS LOADED */
|
||||
#define CDINIT 0x04 /* device has been init'd */
|
||||
#define CDWAIT 0x08 /* device has someone waiting */
|
||||
#define CDHAVELABEL 0x10 /* have read the label */
|
||||
struct scsi_switch *sc_sw; /* address of scsi low level switch */
|
||||
int ctlr; /* so they know which one we want */
|
||||
int targ; /* our scsi target ID */
|
||||
int lu; /* out scsi lu */
|
||||
int cmdscount; /* cmds allowed outstanding by board*/
|
||||
struct cd_parms {
|
||||
int blksize;
|
||||
u_long disksize; /* total number sectors */
|
||||
} params;
|
||||
struct disklabel disklabel;
|
||||
int partflags[MAXPARTITIONS]; /* per partition flags */
|
||||
#define CDOPEN 0x01
|
||||
int openparts; /* one bit for each open partition */
|
||||
};
|
||||
|
||||
int cdattach(int, struct scsi_switch *, int, int *);
|
||||
int cdopen(dev_t);
|
||||
struct scsi_xfer * cd_get_xs(int, int);
|
||||
void cd_free_xs(int, struct scsi_xfer *, int);
|
||||
void cdminphys(struct buf *);
|
||||
void cdstrategy(struct buf *);
|
||||
void cdstart(int);
|
||||
int cd_done(int, struct scsi_xfer *);
|
||||
int cdioctl(dev_t, int, caddr_t, int);
|
||||
int cdgetdisklabel(int);
|
||||
int cd_size(int, int);
|
||||
int cd_req_sense(int, int);
|
||||
int cd_get_mode(int, struct cd_mode_data *, int);
|
||||
int cd_set_mode(int, struct cd_mode_data *);
|
||||
int cd_play(int, int, int);
|
||||
int cd_play_big(int, int, int);
|
||||
int cd_play_tracks(int, int, int, int, int);
|
||||
int cd_pause(int, int);
|
||||
int cd_reset(int);
|
||||
int cd_start_unit(int, int, int);
|
||||
int cd_prevent_unit(int, int, int);
|
||||
int cd_read_subchannel(int, int, int, int, struct cd_sub_channel_info *, int);
|
||||
int cd_read_toc(int, int, int, struct cd_toc_entry *, int);
|
||||
int cd_get_parms(int, int);
|
||||
int cdclose(dev_t);
|
||||
int cd_scsi_cmd(int, struct scsi_generic *, int, u_char *, int, int, int);
|
||||
int cd_interpret_sense(int, struct scsi_xfer *);
|
||||
int cdsize(dev_t);
|
||||
int show_mem(unsigned char *, int);
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,352 @@
|
|||
/*
|
||||
* SCSI general interface description
|
||||
*
|
||||
* Largely written by Julian Elischer (julian@tfs.com)
|
||||
* for TRW Financial Systems.
|
||||
*
|
||||
* TRW Financial Systems, in accordance with their agreement with Carnegie
|
||||
* Mellon University, makes this software available to CMU to distribute
|
||||
* or use in any manner that they see fit as long as this message is kept with
|
||||
* the software. For this reason TFS also grants any other persons or
|
||||
* organisations permission to use or modify this software.
|
||||
*
|
||||
* TFS supplies this software to be publicly redistributed
|
||||
* on the understanding that TFS is not responsible for the correct
|
||||
* functioning of this software in any circumstances.
|
||||
*
|
||||
* $Id: scsi_all.h,v 1.1 1994/04/01 23:18:09 phil Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
|
||||
*/
|
||||
|
||||
/*
|
||||
* SCSI command format
|
||||
*/
|
||||
|
||||
|
||||
struct scsi_generic
|
||||
{
|
||||
u_char opcode;
|
||||
u_char bytes[11];
|
||||
};
|
||||
|
||||
struct scsi_test_unit_ready
|
||||
{
|
||||
u_char op_code;
|
||||
u_char :5;
|
||||
u_char lun:3;
|
||||
u_char unused[3];
|
||||
u_char link:1;
|
||||
u_char flag:4;
|
||||
u_char :3;
|
||||
};
|
||||
|
||||
struct scsi_send_diag
|
||||
{
|
||||
u_char op_code;
|
||||
u_char uol:1;
|
||||
u_char dol:1;
|
||||
u_char selftest:1;
|
||||
u_char :1;
|
||||
u_char pf:1;
|
||||
u_char lun:3;
|
||||
u_char unused[1];
|
||||
u_char paramlen[2];
|
||||
u_char link:1;
|
||||
u_char flag:4;
|
||||
u_char :3;
|
||||
};
|
||||
|
||||
struct scsi_sense
|
||||
{
|
||||
u_char op_code;
|
||||
u_char :5;
|
||||
u_char lun:3;
|
||||
u_char unused[2];
|
||||
u_char length;
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
|
||||
struct scsi_inquiry
|
||||
{
|
||||
u_char op_code;
|
||||
u_char :5;
|
||||
u_char lun:3;
|
||||
u_char unused[2];
|
||||
u_char length;
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
|
||||
struct scsi_mode_sense
|
||||
{
|
||||
u_char op_code;
|
||||
u_char :3;
|
||||
u_char dbd:1;
|
||||
u_char rsvd:1;
|
||||
u_char lun:3;
|
||||
u_char page_code:6;
|
||||
u_char page_ctrl:2;
|
||||
u_char unused;
|
||||
u_char length;
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
|
||||
struct scsi_mode_sense_big
|
||||
{
|
||||
u_char op_code;
|
||||
u_char :3;
|
||||
u_char dbd:1;
|
||||
u_char rsvd:1;
|
||||
u_char lun:3;
|
||||
u_char page_code:6;
|
||||
u_char page_ctrl:2;
|
||||
u_char unused[4];
|
||||
u_char length[2];
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
|
||||
struct scsi_mode_select
|
||||
{
|
||||
u_char op_code;
|
||||
u_char sp:1;
|
||||
u_char :3;
|
||||
u_char pf:1;
|
||||
u_char lun:3;
|
||||
u_char unused[2];
|
||||
u_char length;
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
|
||||
struct scsi_mode_select_big
|
||||
{
|
||||
u_char op_code;
|
||||
u_char sp:1;
|
||||
u_char :3;
|
||||
u_char pf:1;
|
||||
u_char lun:3;
|
||||
u_char unused[5];
|
||||
u_char length[2];
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
|
||||
struct scsi_reserve
|
||||
{
|
||||
u_char op_code;
|
||||
u_char :5;
|
||||
u_char lun:3;
|
||||
u_char unused[2];
|
||||
u_char length;
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
|
||||
struct scsi_release
|
||||
{
|
||||
u_char op_code;
|
||||
u_char :5;
|
||||
u_char lun:3;
|
||||
u_char unused[2];
|
||||
u_char length;
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
|
||||
struct scsi_prevent
|
||||
{
|
||||
u_char op_code;
|
||||
u_char :5;
|
||||
u_char lun:3;
|
||||
u_char unused[2];
|
||||
u_char prevent:1;
|
||||
u_char :7;
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
#define PR_PREVENT 1
|
||||
#define PR_ALLOW 0
|
||||
|
||||
/*
|
||||
* Opcodes
|
||||
*/
|
||||
|
||||
#define TEST_UNIT_READY 0x00
|
||||
#define REQUEST_SENSE 0x03
|
||||
#define INQUIRY 0x12
|
||||
#define MODE_SELECT 0x15
|
||||
#define MODE_SENSE 0x1a
|
||||
#define START_STOP 0x1b
|
||||
#define RESERVE 0x16
|
||||
#define RELEASE 0x17
|
||||
#define PREVENT_ALLOW 0x1e
|
||||
#define POSITION_TO_ELEMENT 0x2b
|
||||
#define MODE_SENSE_BIG 0x54
|
||||
#define MODE_SELECT_BIG 0x55
|
||||
#define MOVE_MEDIUM 0xa5
|
||||
#define READ_ELEMENT_STATUS 0xb8
|
||||
|
||||
|
||||
/*
|
||||
* sense data format
|
||||
*/
|
||||
#define T_DIRECT 0
|
||||
#define T_SEQUENTIAL 1
|
||||
#define T_PRINTER 2
|
||||
#define T_PROCESSOR 3
|
||||
#define T_WORM 4
|
||||
#define T_READONLY 5
|
||||
#define T_SCANNER 6
|
||||
#define T_OPTICAL 7
|
||||
#define T_NODEVICE 0x1F
|
||||
|
||||
#define T_CHANGER 8
|
||||
#define T_COMM 9
|
||||
|
||||
#define T_REMOV 1
|
||||
#define T_FIXED 0
|
||||
|
||||
struct scsi_inquiry_data
|
||||
{
|
||||
u_char device_type:5;
|
||||
u_char device_qualifier:3;
|
||||
u_char dev_qual2:7;
|
||||
u_char removable:1;
|
||||
u_char ansii_version:3;
|
||||
u_char :5;
|
||||
u_char response_format;
|
||||
u_char additional_length;
|
||||
u_char unused[2];
|
||||
u_char :3;
|
||||
u_char can_link:1;
|
||||
u_char can_sync:1;
|
||||
u_char :3;
|
||||
char vendor[8];
|
||||
char product[16];
|
||||
char revision[4];
|
||||
u_char extra[8];
|
||||
};
|
||||
|
||||
|
||||
struct scsi_sense_data
|
||||
{
|
||||
u_char error_code:4;
|
||||
u_char error_class:3;
|
||||
u_char valid:1;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
u_char blockhi:5;
|
||||
u_char vendor:3;
|
||||
u_char blockmed;
|
||||
u_char blocklow;
|
||||
} unextended;
|
||||
struct
|
||||
{
|
||||
u_char segment;
|
||||
u_char sense_key:4;
|
||||
u_char :1;
|
||||
u_char ili:1;
|
||||
u_char eom:1;
|
||||
u_char filemark:1;
|
||||
u_char info[4];
|
||||
u_char extra_len;
|
||||
/* allocate enough room to hold new stuff
|
||||
u_char cmd_spec_info[4];
|
||||
u_char add_sense_code;
|
||||
u_char add_sense_code_qual;
|
||||
u_char fru;
|
||||
u_char sense_key_spec_1:7;
|
||||
u_char sksv:1;
|
||||
u_char sense_key_spec_2;
|
||||
u_char sense_key_spec_3;
|
||||
( by increasing 16 to 26 below) */
|
||||
u_char extra_bytes[26];
|
||||
} extended;
|
||||
}ext;
|
||||
};
|
||||
struct scsi_sense_data_new
|
||||
{
|
||||
u_char error_code:7;
|
||||
u_char valid:1;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
u_char blockhi:5;
|
||||
u_char vendor:3;
|
||||
u_char blockmed;
|
||||
u_char blocklow;
|
||||
} unextended;
|
||||
struct
|
||||
{
|
||||
u_char segment;
|
||||
u_char sense_key:4;
|
||||
u_char :1;
|
||||
u_char ili:1;
|
||||
u_char eom:1;
|
||||
u_char filemark:1;
|
||||
u_char info[4];
|
||||
u_char extra_len;
|
||||
u_char cmd_spec_info[4];
|
||||
u_char add_sense_code;
|
||||
u_char add_sense_code_qual;
|
||||
u_char fru;
|
||||
u_char sense_key_spec_1:7;
|
||||
u_char sksv:1;
|
||||
u_char sense_key_spec_2;
|
||||
u_char sense_key_spec_3;
|
||||
u_char extra_bytes[16];
|
||||
} extended;
|
||||
}ext;
|
||||
};
|
||||
|
||||
struct blk_desc
|
||||
{
|
||||
u_char density;
|
||||
u_char nblocks[3];
|
||||
u_char reserved;
|
||||
u_char blklen[3];
|
||||
};
|
||||
|
||||
struct scsi_mode_header
|
||||
{
|
||||
u_char data_length; /* Sense data length */
|
||||
u_char medium_type;
|
||||
u_char dev_spec;
|
||||
u_char blk_desc_len;
|
||||
};
|
||||
|
||||
struct scsi_mode_header_big
|
||||
{
|
||||
u_char data_length[2]; /* Sense data length */
|
||||
u_char medium_type;
|
||||
u_char dev_spec;
|
||||
u_char unused[2];
|
||||
u_char blk_desc_len[2];
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Status Byte
|
||||
*/
|
||||
#define SCSI_OK 0x00
|
||||
#define SCSI_CHECK 0x02
|
||||
#define SCSI_BUSY 0x08
|
||||
#define SCSI_INTERM 0x10
|
|
@ -0,0 +1,287 @@
|
|||
/*
|
||||
* Written by Julian Elischer (julian@tfs.com)
|
||||
* for TRW Financial Systems.
|
||||
*
|
||||
* TRW Financial Systems, in accordance with their agreement with Carnegie
|
||||
* Mellon University, makes this software available to CMU to distribute
|
||||
* or use in any manner that they see fit as long as this message is kept with
|
||||
* the software. For this reason TFS also grants any other persons or
|
||||
* organisations permission to use or modify this software.
|
||||
*
|
||||
* TFS supplies this software to be publicly redistributed
|
||||
* on the understanding that TFS is not responsible for the correct
|
||||
* functioning of this software in any circumstances.
|
||||
*
|
||||
* $Id: scsi_cd.h,v 1.1 1994/04/01 23:18:10 phil Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
|
||||
*/
|
||||
|
||||
/*
|
||||
* SCSI command format
|
||||
*/
|
||||
|
||||
struct scsi_read_capacity_cd
|
||||
{
|
||||
u_char op_code;
|
||||
u_char :5;
|
||||
u_char lun:3;
|
||||
u_char addr_3; /* Most Significant */
|
||||
u_char addr_2;
|
||||
u_char addr_1;
|
||||
u_char addr_0; /* Least Significant */
|
||||
u_char unused[3];
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
|
||||
struct scsi_pause
|
||||
{
|
||||
u_char op_code;
|
||||
u_char :5;
|
||||
u_char lun:3;
|
||||
u_char unused[6];
|
||||
u_char resume:1;
|
||||
u_char :7;
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
#define PA_PAUSE 1
|
||||
#define PA_RESUME 0
|
||||
|
||||
struct scsi_play_msf
|
||||
{
|
||||
u_char op_code;
|
||||
u_char :5;
|
||||
u_char lun:3;
|
||||
u_char unused;
|
||||
u_char start_m;
|
||||
u_char start_s;
|
||||
u_char start_f;
|
||||
u_char end_m;
|
||||
u_char end_s;
|
||||
u_char end_f;
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
|
||||
struct scsi_play_track
|
||||
{
|
||||
u_char op_code;
|
||||
u_char :5;
|
||||
u_char lun:3;
|
||||
u_char unused[2];
|
||||
u_char start_track;
|
||||
u_char start_index;
|
||||
u_char unused1;
|
||||
u_char end_track;
|
||||
u_char end_index;
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
|
||||
struct scsi_play
|
||||
{
|
||||
u_char op_code;
|
||||
u_char reladdr:1;
|
||||
u_char :4;
|
||||
u_char lun:3;
|
||||
u_char blk_addr[4];
|
||||
u_char unused;
|
||||
u_char xfer_len[2];
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
|
||||
struct scsi_play_big
|
||||
{
|
||||
u_char op_code;
|
||||
u_char reladdr:1;
|
||||
u_char :4;
|
||||
u_char lun:3;
|
||||
u_char blk_addr[4];
|
||||
u_char xfer_len[4];
|
||||
u_char unused;
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
|
||||
struct scsi_play_rel_big
|
||||
{
|
||||
u_char op_code;
|
||||
u_char reladdr:1;
|
||||
u_char :4;
|
||||
u_char lun:3;
|
||||
u_char blk_addr[4];
|
||||
u_char xfer_len[4];
|
||||
u_char track;
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
|
||||
struct scsi_read_header
|
||||
{
|
||||
u_char op_code;
|
||||
u_char :1;
|
||||
u_char msf:1;
|
||||
u_char :3;
|
||||
u_char lun:3;
|
||||
u_char blk_addr[4];
|
||||
u_char unused;
|
||||
u_char data_len[2];
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
|
||||
struct scsi_read_subchannel
|
||||
{
|
||||
u_char op_code;
|
||||
u_char :1;
|
||||
u_char msf:1;
|
||||
u_char :3;
|
||||
u_char lun:3;
|
||||
u_char :6;
|
||||
u_char subQ:1;
|
||||
u_char :1;
|
||||
u_char subchan_format;
|
||||
u_char unused[2];
|
||||
u_char track;
|
||||
u_char data_len[2];
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
|
||||
struct scsi_read_toc
|
||||
{
|
||||
u_char op_code;
|
||||
u_char :1;
|
||||
u_char msf:1;
|
||||
u_char :3;
|
||||
u_char lun:3;
|
||||
u_char unused[4];
|
||||
u_char from_track;
|
||||
u_char data_len[2];
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
;
|
||||
|
||||
struct scsi_read_cd_capacity
|
||||
{
|
||||
u_char op_code;
|
||||
u_char :5;
|
||||
u_char lun:3;
|
||||
u_char addr_3; /* Most Significant */
|
||||
u_char addr_2;
|
||||
u_char addr_1;
|
||||
u_char addr_0; /* Least Significant */
|
||||
u_char unused[3];
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
|
||||
/*
|
||||
* Opcodes
|
||||
*/
|
||||
|
||||
#define READ_CD_CAPACITY 0x25 /* slightly different from disk */
|
||||
#define READ_SUBCHANNEL 0x42 /* cdrom read Subchannel */
|
||||
#define READ_TOC 0x43 /* cdrom read TOC */
|
||||
#define READ_HEADER 0x44 /* cdrom read header */
|
||||
#define PLAY 0x45 /* cdrom play 'play audio' mode */
|
||||
#define PLAY_MSF 0x47 /* cdrom play Min,Sec,Frames mode */
|
||||
#define PLAY_TRACK 0x48 /* cdrom play track/index mode */
|
||||
#define PLAY_TRACK_REL 0x49 /* cdrom play track/index mode */
|
||||
#define PAUSE 0x4b /* cdrom pause in 'play audio' mode */
|
||||
#define PLAY_BIG 0xa5 /* cdrom pause in 'play audio' mode */
|
||||
#define PLAY_TRACK_REL_BIG 0xa9 /* cdrom play track/index mode */
|
||||
|
||||
|
||||
struct cd_inquiry_data /* in case there is some special info */
|
||||
{
|
||||
u_char device_type:5;
|
||||
u_char device_qualifier:3;
|
||||
u_char dev_qual2:7;
|
||||
u_char removable:1;
|
||||
u_char ansii_version:3;
|
||||
u_char :5;
|
||||
u_char response_format;
|
||||
u_char additional_length;
|
||||
u_char unused[2];
|
||||
u_char :3;
|
||||
u_char can_link:1;
|
||||
u_char can_sync:1;
|
||||
u_char :3;
|
||||
char vendor[8];
|
||||
char product[16];
|
||||
char revision[4];
|
||||
u_char extra[8];
|
||||
};
|
||||
|
||||
struct scsi_read_cd_cap_data
|
||||
{
|
||||
u_char addr_3; /* Most significant */
|
||||
u_char addr_2;
|
||||
u_char addr_1;
|
||||
u_char addr_0; /* Least significant */
|
||||
u_char length_3; /* Most significant */
|
||||
u_char length_2;
|
||||
u_char length_1;
|
||||
u_char length_0; /* Least significant */
|
||||
};
|
||||
|
||||
union cd_pages
|
||||
{
|
||||
#define AUDIO_PAGE 0x0e
|
||||
struct audio_page
|
||||
{
|
||||
u_char page_code:6;
|
||||
u_char :1;
|
||||
u_char ps:1;
|
||||
u_char param_len;
|
||||
u_char :1;
|
||||
u_char sotc:1;
|
||||
u_char immed:1;
|
||||
u_char :5;
|
||||
u_char unused[2];
|
||||
u_char format_lba:4;
|
||||
u_char :3;
|
||||
u_char apr_valid:1;
|
||||
u_char lb_per_sec[2];
|
||||
struct port_control
|
||||
{
|
||||
u_char channels:4;
|
||||
#define CHANNEL_0 1
|
||||
#define CHANNEL_1 2
|
||||
#define CHANNEL_2 4
|
||||
#define CHANNEL_3 8
|
||||
#define LEFT_CHANNEL CHANNEL_0
|
||||
#define RIGHT_CHANNEL CHANNEL_1
|
||||
u_char :4;
|
||||
u_char volume;
|
||||
} port[4];
|
||||
#define LEFT_PORT 0
|
||||
#define RIGHT_PORT 1
|
||||
}audio;
|
||||
};
|
||||
|
||||
struct cd_mode_data
|
||||
{
|
||||
struct scsi_mode_header header;
|
||||
struct blk_desc blk_desc;
|
||||
union cd_pages page;
|
||||
};
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* SCSI changer interface description
|
||||
*
|
||||
* Written by Stefan Grefen (grefen@goofy.zdv.uni-mainz.de soon grefen@convex.com)
|
||||
* based on the SCSI System by written Julian Elischer (julian@tfs.com)
|
||||
* for TRW Financial Systems.
|
||||
*
|
||||
* TRW Financial Systems, in accordance with their agreement with Carnegie
|
||||
* Mellon University, makes this software available to CMU to distribute
|
||||
* or use in any manner that they see fit as long as this message is kept with
|
||||
* the software. For this reason TFS also grants any other persons or
|
||||
* organisations permission to use or modify this software.
|
||||
*
|
||||
* TFS supplies this software to be publicly redistributed
|
||||
* on the understanding that TFS is not responsible for the correct
|
||||
* functioning of this software in any circumstances.
|
||||
*
|
||||
* $Id: scsi_changer.h,v 1.1 1994/04/01 23:18:11 phil Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
|
||||
*/
|
||||
|
||||
/*
|
||||
* SCSI command format
|
||||
*/
|
||||
struct scsi_read_element_status
|
||||
{
|
||||
u_char op_code;
|
||||
u_char element_type_code:4;
|
||||
u_char voltag:1;
|
||||
u_char lun:3;
|
||||
u_char starting_element_addr[2];
|
||||
u_char number_of_elements[2];
|
||||
u_char resv1;
|
||||
u_char allocation_length[3];
|
||||
u_char resv2;
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
#define RE_ALL_ELEMENTS 0
|
||||
#define RE_MEDIUM_TRANSPORT_ELEMENT 1
|
||||
#define RE_STORAGE_ELEMENT 2
|
||||
#define RE_IMPORT_EXPORT 3
|
||||
#define RE_DATA_TRANSFER_ELEMENT 4
|
||||
|
||||
struct scsi_move_medium
|
||||
{
|
||||
u_char op_code;
|
||||
u_char :5;
|
||||
u_char lun:3;
|
||||
u_char transport_element_address[2];
|
||||
u_char source_address[2];
|
||||
u_char destination_address[2];
|
||||
u_char rsvd[2];
|
||||
u_char invert:1;
|
||||
u_char :7;
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
|
||||
struct scsi_position_to_element
|
||||
{
|
||||
u_char op_code;
|
||||
u_char :5;
|
||||
u_char lun:3;
|
||||
u_char transport_element_address[2];
|
||||
u_char source_address[2];
|
||||
u_char rsvd[2];
|
||||
u_char invert:1;
|
||||
u_char :7;
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
|
||||
/*
|
||||
* Opcodes
|
||||
*/
|
||||
#define POSITION_TO_ELEMENT 0x2b
|
||||
#define MOVE_MEDIUM 0xa5
|
||||
#define READ_ELEMENT_STATUS 0xb8
|
||||
|
||||
struct scsi_element_status_data
|
||||
{
|
||||
u_char first_element_reported[2];
|
||||
u_char number_of_elements_reported[2];
|
||||
u_char rsvd;
|
||||
u_char byte_count_of_report[3];
|
||||
};
|
||||
|
||||
struct element_status_page
|
||||
{
|
||||
u_char element_type_code;
|
||||
u_char :5;
|
||||
u_char avoltag:1;
|
||||
u_char pvoltag:1;
|
||||
u_char element_descriptor_length[2];
|
||||
u_char rsvd;
|
||||
u_char byte_count_of_descriptor_data[3];
|
||||
};
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
/*#define SCSIDEBUG 1*/
|
||||
/*
|
||||
* Written by Julian Elischer (julian@tfs.com)
|
||||
*
|
||||
* $Id: scsi_debug.h,v 1.1 1994/04/01 23:18:12 phil Exp $
|
||||
*/
|
||||
#ifndef _SCSI_SCSI_DEBUG_H
|
||||
#define _SCSI_SCSI_DEBUG_H 1
|
||||
|
||||
/*
|
||||
* These are the new debug bits. (Sat Oct 2 12:46:46 WST 1993)
|
||||
* the following DEBUG bits are defined to exist in the flags word of
|
||||
* the scsi_link structure.
|
||||
*/
|
||||
#define SDEV_DB1 0x10 /* scsi commands, errors, data */
|
||||
#define SDEV_DB2 0x20 /* routine flow tracking */
|
||||
#define SDEV_DB3 0x40 /* internal to routine flows */
|
||||
#define SDEV_DB4 0x80 /* level 4 debugging for this dev */
|
||||
|
||||
/* target and LUN we want to debug */
|
||||
#define DEBUGTARG 9 /*9 = dissable*/
|
||||
#define DEBUGLUN 0
|
||||
#define DEBUGLEVEL (SDEV_DB1|SDEV_DB2)
|
||||
|
||||
/*
|
||||
* This is the usual debug macro for use with the above bits
|
||||
*/
|
||||
#ifdef SCSIDEBUG
|
||||
#define SC_DEBUG(sc_link,Level,Printstuff) \
|
||||
if((sc_link)->flags & (Level)) \
|
||||
{ \
|
||||
printf("%s%d(%s%d:%d:%d): ", \
|
||||
sc_link->device->name, \
|
||||
sc_link->dev_unit, \
|
||||
sc_link->adapter->name, \
|
||||
sc_link->scsibus, \
|
||||
sc_link->target, \
|
||||
sc_link->lun); \
|
||||
printf Printstuff; \
|
||||
}
|
||||
#define SC_DEBUGN(sc_link,Level,Printstuff) \
|
||||
if((sc_link)->flags & (Level)) \
|
||||
{ \
|
||||
printf Printstuff; \
|
||||
}
|
||||
#else
|
||||
#define SC_DEBUG(A,B,C) /* not included */
|
||||
#define SC_DEBUGN(A,B,C) /* not included */
|
||||
#endif
|
||||
|
||||
#endif /*_SCSI_SCSI_DEBUG_H*/
|
||||
/* END OF FILE */
|
||||
|
|
@ -0,0 +1,240 @@
|
|||
/*
|
||||
* SCSI interface description
|
||||
*
|
||||
* Some lines of this file comes from a file of the name "scsi.h"
|
||||
* distributed by OSF as part of mach2.5,
|
||||
* so the following disclaimer has been kept.
|
||||
*
|
||||
* Copyright 1990 by Open Software Foundation,
|
||||
* Grenoble, FRANCE
|
||||
*
|
||||
* All Rights Reserved
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and
|
||||
* its documentation for any purpose and without fee is hereby granted,
|
||||
* provided that the above copyright notice appears in all copies and
|
||||
* that both the copyright notice and this permission notice appear in
|
||||
* supporting documentation, and that the name of OSF or Open Software
|
||||
* Foundation not be used in advertising or publicity pertaining to
|
||||
* distribution of the software without specific, written prior
|
||||
* permission.
|
||||
*
|
||||
* OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
|
||||
* IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
* LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
|
||||
* NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Largely written by Julian Elischer (julian@tfs.com)
|
||||
* for TRW Financial Systems.
|
||||
*
|
||||
* TRW Financial Systems, in accordance with their agreement with Carnegie
|
||||
* Mellon University, makes this software available to CMU to distribute
|
||||
* or use in any manner that they see fit as long as this message is kept with
|
||||
* the software. For this reason TFS also grants any other persons or
|
||||
* organisations permission to use or modify this software.
|
||||
*
|
||||
* TFS supplies this software to be publicly redistributed
|
||||
* on the understanding that TFS is not responsible for the correct
|
||||
* functioning of this software in any circumstances.
|
||||
*
|
||||
* $Id: scsi_disk.h,v 1.1 1994/04/01 23:18:13 phil Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
|
||||
*/
|
||||
|
||||
/*
|
||||
* SCSI command format
|
||||
*/
|
||||
|
||||
|
||||
struct scsi_reassign_blocks
|
||||
{
|
||||
u_char op_code;
|
||||
u_char :5;
|
||||
u_char lun:3;
|
||||
u_char unused[3];
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
|
||||
struct scsi_rw
|
||||
{
|
||||
u_char op_code;
|
||||
u_char addr_2:5; /* Most significant */
|
||||
u_char lun:3;
|
||||
u_char addr_1;
|
||||
u_char addr_0; /* least significant */
|
||||
u_char length;
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
|
||||
struct scsi_rw_big
|
||||
{
|
||||
u_char op_code;
|
||||
u_char rel_addr:1;
|
||||
u_char :4; /* Most significant */
|
||||
u_char lun:3;
|
||||
u_char addr_3;
|
||||
u_char addr_2;
|
||||
u_char addr_1;
|
||||
u_char addr_0; /* least significant */
|
||||
u_char reserved;;
|
||||
u_char length2;
|
||||
u_char length1;
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :4;
|
||||
u_char vendor:2;
|
||||
};
|
||||
|
||||
struct scsi_read_capacity
|
||||
{
|
||||
u_char op_code;
|
||||
u_char :5;
|
||||
u_char lun:3;
|
||||
u_char addr_3; /* Most Significant */
|
||||
u_char addr_2;
|
||||
u_char addr_1;
|
||||
u_char addr_0; /* Least Significant */
|
||||
u_char unused[3];
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
|
||||
struct scsi_start_stop
|
||||
{
|
||||
u_char op_code;
|
||||
u_char :5;
|
||||
u_char lun:3;
|
||||
u_char unused[2];
|
||||
u_char start:1;
|
||||
u_char loej:1;
|
||||
u_char :6;
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Opcodes
|
||||
*/
|
||||
|
||||
#define FORMAT_DISK 0x04
|
||||
#define REASSIGN_BLOCKS 0x07
|
||||
#define READ_COMMAND 0x08
|
||||
#define WRITE_COMMAND 0x0a
|
||||
#define MODE_SELECT 0x15
|
||||
#define MODE_SENSE 0x1a
|
||||
#define START_STOP 0x1b
|
||||
#define PREVENT_ALLOW 0x1e
|
||||
#define READ_CAPACITY 0x25
|
||||
#define READ_BIG 0x28
|
||||
#define WRITE_BIG 0x2a
|
||||
|
||||
|
||||
struct scsi_format_parms { /* physical BFI format */
|
||||
u_short reserved;
|
||||
u_short list_len;
|
||||
struct defect {
|
||||
unsigned cyl : 24;
|
||||
unsigned head : 8;
|
||||
long bytes_from_index;
|
||||
} defect[127];
|
||||
} format_parms;
|
||||
|
||||
|
||||
struct scsi_read_cap_data
|
||||
{
|
||||
u_char addr_3; /* Most significant */
|
||||
u_char addr_2;
|
||||
u_char addr_1;
|
||||
u_char addr_0; /* Least significant */
|
||||
u_char length_3; /* Most significant */
|
||||
u_char length_2;
|
||||
u_char length_1;
|
||||
u_char length_0; /* Least significant */
|
||||
};
|
||||
|
||||
struct scsi_reassign_blocks_data
|
||||
{
|
||||
u_char reserved[2];
|
||||
u_char length_msb;
|
||||
u_char length_lsb;
|
||||
struct
|
||||
{
|
||||
u_char dlbaddr_3; /* defect logical block address (MSB) */
|
||||
u_char dlbaddr_2;
|
||||
u_char dlbaddr_1;
|
||||
u_char dlbaddr_0; /* defect logical block address (LSB) */
|
||||
} defect_descriptor[1];
|
||||
};
|
||||
|
||||
union disk_pages /* this is the structure copied from osf */
|
||||
{
|
||||
struct page_disk_format {
|
||||
u_char pg_code:6; /* page code (should be 3) */
|
||||
u_char :2;
|
||||
u_char pg_length; /* page length (should be 0x16) */
|
||||
u_char trk_z_1; /* tracks per zone (MSB) */
|
||||
u_char trk_z_0; /* tracks per zone (LSB) */
|
||||
u_char alt_sec_1; /* alternate sectors per zone (MSB) */
|
||||
u_char alt_sec_0; /* alternate sectors per zone (LSB) */
|
||||
u_char alt_trk_z_1; /* alternate tracks per zone (MSB) */
|
||||
u_char alt_trk_z_0; /* alternate tracks per zone (LSB) */
|
||||
u_char alt_trk_v_1; /* alternate tracks per volume (MSB) */
|
||||
u_char alt_trk_v_0; /* alternate tracks per volume (LSB) */
|
||||
u_char ph_sec_t_1; /* physical sectors per track (MSB) */
|
||||
u_char ph_sec_t_0; /* physical sectors per track (LSB) */
|
||||
u_char bytes_s_1; /* bytes per sector (MSB) */
|
||||
u_char bytes_s_0; /* bytes per sector (LSB) */
|
||||
u_char interleave_1;/* interleave (MSB) */
|
||||
u_char interleave_0;/* interleave (LSB) */
|
||||
u_char trk_skew_1; /* track skew factor (MSB) */
|
||||
u_char trk_skew_0; /* track skew factor (LSB) */
|
||||
u_char cyl_skew_1; /* cylinder skew (MSB) */
|
||||
u_char cyl_skew_0; /* cylinder skew (LSB) */
|
||||
u_char reserved1:4;
|
||||
u_char surf:1;
|
||||
u_char rmb:1;
|
||||
u_char hsec:1;
|
||||
u_char ssec:1;
|
||||
u_char reserved2;
|
||||
u_char reserved3;
|
||||
} disk_format;
|
||||
struct page_rigid_geometry {
|
||||
u_char pg_code:7; /* page code (should be 4) */
|
||||
u_char mbone:1; /* must be one */
|
||||
u_char pg_length; /* page length (should be 0x16) */
|
||||
u_char ncyl_2; /* number of cylinders (MSB) */
|
||||
u_char ncyl_1; /* number of cylinders */
|
||||
u_char ncyl_0; /* number of cylinders (LSB) */
|
||||
u_char nheads; /* number of heads */
|
||||
u_char st_cyl_wp_2; /* starting cyl., write precomp (MSB) */
|
||||
u_char st_cyl_wp_1; /* starting cyl., write precomp */
|
||||
u_char st_cyl_wp_0; /* starting cyl., write precomp (LSB) */
|
||||
u_char st_cyl_rwc_2;/* starting cyl., red. write cur (MSB)*/
|
||||
u_char st_cyl_rwc_1;/* starting cyl., red. write cur */
|
||||
u_char st_cyl_rwc_0;/* starting cyl., red. write cur (LSB)*/
|
||||
u_char driv_step_1; /* drive step rate (MSB) */
|
||||
u_char driv_step_0; /* drive step rate (LSB) */
|
||||
u_char land_zone_2; /* landing zone cylinder (MSB) */
|
||||
u_char land_zone_1; /* landing zone cylinder */
|
||||
u_char land_zone_0; /* landing zone cylinder (LSB) */
|
||||
u_char reserved1;
|
||||
u_char reserved2;
|
||||
u_char reserved3;
|
||||
} rigid_geometry;
|
||||
} ;
|
|
@ -0,0 +1,149 @@
|
|||
/*
|
||||
* SCSI tape interface description
|
||||
*
|
||||
* Written by Julian Elischer (julian@tfs.com)
|
||||
* for TRW Financial Systems.
|
||||
*
|
||||
* TRW Financial Systems, in accordance with their agreement with Carnegie
|
||||
* Mellon University, makes this software available to CMU to distribute
|
||||
* or use in any manner that they see fit as long as this message is kept with
|
||||
* the software. For this reason TFS also grants any other persons or
|
||||
* organisations permission to use or modify this software.
|
||||
*
|
||||
* TFS supplies this software to be publicly redistributed
|
||||
* on the understanding that TFS is not responsible for the correct
|
||||
* functioning of this software in any circumstances.
|
||||
*
|
||||
* $Id: scsi_tape.h,v 1.1 1994/04/01 23:18:14 phil Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
|
||||
*/
|
||||
|
||||
/*
|
||||
* SCSI command format
|
||||
*/
|
||||
|
||||
|
||||
struct scsi_rw_tape
|
||||
{
|
||||
u_char op_code;
|
||||
u_char fixed:1;
|
||||
u_char :4;
|
||||
u_char lun:3;
|
||||
u_char len[3];
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
} rw_tape;
|
||||
|
||||
struct scsi_space
|
||||
{
|
||||
u_char op_code;
|
||||
u_char code:2;
|
||||
u_char :3;
|
||||
u_char lun:3;
|
||||
u_char number[3];
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
} space;
|
||||
#define SP_BLKS 0
|
||||
#define SP_FILEMARKS 1
|
||||
#define SP_SEQ_FILEMARKS 2
|
||||
#define SP_EOM 3
|
||||
|
||||
struct scsi_write_filemarks
|
||||
{
|
||||
u_char op_code;
|
||||
u_char :5;
|
||||
u_char lun:3;
|
||||
u_char number[3];
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
} write_filemarks;
|
||||
|
||||
struct scsi_rewind
|
||||
{
|
||||
u_char op_code;
|
||||
u_char immed:1;
|
||||
u_char :4;
|
||||
u_char lun:3;
|
||||
u_char unused[3];
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
} rewind;
|
||||
|
||||
struct scsi_load
|
||||
{
|
||||
u_char op_code;
|
||||
u_char immed:1;
|
||||
u_char :4;
|
||||
u_char lun:3;
|
||||
u_char unused[2];
|
||||
u_char load:1;
|
||||
u_char reten:1;
|
||||
u_char :6;
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
} load;
|
||||
#define LD_UNLOAD 0
|
||||
#define LD_LOAD 1
|
||||
|
||||
struct scsi_blk_limits
|
||||
{
|
||||
u_char op_code;
|
||||
u_char :5;
|
||||
u_char lun:3;
|
||||
u_char unused[3];
|
||||
u_char link:1;
|
||||
u_char flag:1;
|
||||
u_char :6;
|
||||
} blk_limits;
|
||||
|
||||
/*
|
||||
* Opcodes
|
||||
*/
|
||||
|
||||
#define REWIND 0x01
|
||||
#define READ_BLK_LIMITS 0x05
|
||||
#define READ_COMMAND_TAPE 0x08
|
||||
#define WRITE_COMMAND_TAPE 0x0a
|
||||
#define WRITE_FILEMARKS 0x10
|
||||
#define SPACE 0x11
|
||||
#define LOAD_UNLOAD 0x1b /* same as above */
|
||||
|
||||
|
||||
|
||||
struct scsi_blk_limits_data
|
||||
{
|
||||
u_char reserved;
|
||||
u_char max_length_2; /* Most significant */
|
||||
u_char max_length_1;
|
||||
u_char max_length_0; /* Least significant */
|
||||
u_char min_length_1; /* Most significant */
|
||||
u_char min_length_0; /* Least significant */
|
||||
};
|
||||
|
||||
struct scsi_mode_header_tape
|
||||
{
|
||||
u_char data_length; /* Sense data length */
|
||||
u_char medium_type;
|
||||
u_char speed:4;
|
||||
u_char buf_mode:3;
|
||||
u_char write_protected:1;
|
||||
u_char blk_desc_len;
|
||||
};
|
||||
|
||||
|
||||
#define QIC_120 0x0f
|
||||
#define QIC_150 0x10
|
||||
#define QIC_320 0x11
|
||||
#define QIC_525 0x11
|
||||
#define QIC_1320 0x12
|
||||
|
||||
|
|
@ -0,0 +1,600 @@
|
|||
/*
|
||||
* Written by Julian Elischer (julian@tfs.com)
|
||||
* for TRW Financial Systems for use under the MACH(2.5) operating system.
|
||||
* Hacked by Theo de Raadt <deraadt@fsa.ca>
|
||||
*
|
||||
* TRW Financial Systems, in accordance with their agreement with Carnegie
|
||||
* Mellon University, makes this software available to CMU to distribute
|
||||
* or use in any manner that they see fit as long as this message is kept with
|
||||
* the software. For this reason TFS also grants any other persons or
|
||||
* organisations permission to use or modify this software.
|
||||
*
|
||||
* TFS supplies this software to be publicly redistributed
|
||||
* on the understanding that TFS is not responsible for the correct
|
||||
* functioning of this software in any circumstances.
|
||||
*
|
||||
* $Id: scsiconf.c,v 1.1 1994/04/01 23:18:15 phil Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/dkbad.h>
|
||||
#include <sys/disklabel.h>
|
||||
|
||||
#include <scsi/scsi_all.h>
|
||||
#include <scsi/scsiconf.h>
|
||||
|
||||
#include "st.h"
|
||||
#include "sd.h"
|
||||
#include "ch.h"
|
||||
#include "cd.h"
|
||||
#define NBLL 0
|
||||
#define NCALS 0
|
||||
#define NKIL 0
|
||||
|
||||
#if NSD > 0
|
||||
extern int sdattach();
|
||||
#endif NSD
|
||||
#if NST > 0
|
||||
extern int stattach();
|
||||
#endif NST
|
||||
#if NCH > 0
|
||||
extern int chattach();
|
||||
#endif NCH
|
||||
#if NCD > 0
|
||||
extern int cdattach();
|
||||
#endif NCD
|
||||
#if NBLL > 0
|
||||
extern int bllattach();
|
||||
#endif NBLL
|
||||
#if NCALS > 0
|
||||
extern int calsattach();
|
||||
#endif NCALS
|
||||
#if NKIL > 0
|
||||
extern int kil_attach();
|
||||
#endif NKIL
|
||||
|
||||
struct scsidevs knowndevs[] = {
|
||||
#if NSD > 0
|
||||
{
|
||||
SC_TSD, T_DIRECT, T_FIXED, "standard", "any" ,"any",
|
||||
sdattach, "sd" ,SC_ONE_LU
|
||||
}, {
|
||||
SC_TSD, T_DIRECT, T_FIXED, "MAXTOR ", "XT-4170S ", "B5A ",
|
||||
sdattach, "mx1", SC_ONE_LU
|
||||
},
|
||||
#endif NSD
|
||||
#if NST > 0
|
||||
{
|
||||
SC_TST, T_SEQUENTIAL, T_REMOV, "standard", "any", "any",
|
||||
stattach, "st" ,SC_ONE_LU
|
||||
},
|
||||
#endif NST
|
||||
#if NCD > 0
|
||||
{
|
||||
SC_TCD, T_READONLY, T_REMOV, "SONY ", "CD-ROM CDU-8012 ", "3.1a",
|
||||
cdattach, "cd", SC_ONE_LU
|
||||
}, {
|
||||
SC_TCD, T_READONLY, T_REMOV, "PIONEER ", "CD-ROM DRM-600 ", "any",
|
||||
cdattach, "cd", SC_MORE_LUS
|
||||
},
|
||||
#endif NCD
|
||||
#if NCALS > 0
|
||||
{
|
||||
-1, T_PROCESSOR, T_FIXED, "standard" , "any" ,"any",
|
||||
calsattach, "cals", SC_MORE_LUS
|
||||
}
|
||||
#endif NCALS
|
||||
#if NCH > 0
|
||||
{
|
||||
-1, T_CHANGER, T_REMOV, "standard", "any", "any",
|
||||
chattach, "ch", SC_ONE_LU
|
||||
},
|
||||
#endif NCH
|
||||
#if NBLL > 0
|
||||
{
|
||||
-1, T_PROCESSOR, T_FIXED, "AEG ", "READER ", "V1.0",
|
||||
bllattach, "bll", SC_MORE_LUS
|
||||
},
|
||||
#endif NBLL
|
||||
#if NKIL > 0
|
||||
{
|
||||
-1, T_SCANNER, T_FIXED, "KODAK ", "IL Scanner 900 ", "any",
|
||||
kil_attach, "kil", SC_ONE_LU
|
||||
},
|
||||
#endif NKIL
|
||||
};
|
||||
|
||||
/* controls debug level within the scsi subsystem: see scsiconf.h */
|
||||
int scsi_debug = 0;
|
||||
|
||||
struct scsidevs *
|
||||
scsi_probe(int masunit, struct scsi_switch *sw, int physid, int type, int want)
|
||||
{
|
||||
static struct scsi_inquiry_data inqbuf;
|
||||
struct scsidevs *ret = (struct scsidevs *)0;
|
||||
int targ = physid >> 3;
|
||||
int lun = physid & 7;
|
||||
char *qtype=NULL, *dtype=NULL, *desc;
|
||||
char manu[9], model[17], revision[5];
|
||||
int len;
|
||||
|
||||
bzero(&inqbuf, sizeof inqbuf);
|
||||
|
||||
/*printf("probe: %s%d targ %d lun %d\n",
|
||||
sw->name, masunit, targ, lun);*/
|
||||
|
||||
if( scsi_ready(masunit, targ, lun, sw,
|
||||
SCSI_NOSLEEP | SCSI_NOMASK) != COMPLETE)
|
||||
return (struct scsidevs *)-1;
|
||||
|
||||
if( scsi_inquire(masunit, targ, lun, sw, (u_char *)&inqbuf,
|
||||
SCSI_NOSLEEP | SCSI_NOMASK) != COMPLETE)
|
||||
return (struct scsidevs *)0;
|
||||
|
||||
if( inqbuf.device_qualifier==3 && inqbuf.device_type==T_NODEVICE)
|
||||
return (struct scsidevs *)0;
|
||||
|
||||
switch(inqbuf.device_qualifier) {
|
||||
case 0:
|
||||
qtype = "";
|
||||
break;
|
||||
case 1:
|
||||
qtype = "Unit not Connected!";
|
||||
break;
|
||||
case 2:
|
||||
qtype =", Reserved Peripheral Qualifier!";
|
||||
break;
|
||||
case 3:
|
||||
qtype = ", The Target can't support this Unit!";
|
||||
break;
|
||||
default:
|
||||
dtype = "vendor specific";
|
||||
qtype = "";
|
||||
break;
|
||||
}
|
||||
|
||||
if (dtype == NULL) {
|
||||
switch(inqbuf.device_type) {
|
||||
case T_DIRECT:
|
||||
dtype = "direct";
|
||||
break;
|
||||
case T_SEQUENTIAL:
|
||||
dtype = "seq";
|
||||
break;
|
||||
case T_PRINTER:
|
||||
dtype = "pr";
|
||||
break;
|
||||
case T_PROCESSOR:
|
||||
dtype = "cpu";
|
||||
break;
|
||||
case T_READONLY:
|
||||
dtype = "ro";
|
||||
break;
|
||||
case T_WORM:
|
||||
dtype = "worm";
|
||||
break;
|
||||
case T_SCANNER:
|
||||
dtype = "scan";
|
||||
break;
|
||||
case T_OPTICAL:
|
||||
dtype = "optic";
|
||||
break;
|
||||
case T_CHANGER:
|
||||
dtype = "changer";
|
||||
break;
|
||||
case T_COMM:
|
||||
dtype = "comm";
|
||||
break;
|
||||
default:
|
||||
dtype = "???";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(inqbuf.ansii_version > 0) {
|
||||
len = inqbuf.additional_length +
|
||||
((char *)inqbuf.unused - (char *)&inqbuf);
|
||||
if( len > sizeof(struct scsi_inquiry_data) - 1)
|
||||
len = sizeof(struct scsi_inquiry_data) - 1;
|
||||
desc = inqbuf.vendor;
|
||||
desc[len-(desc-(char *)&inqbuf)] = 0;
|
||||
strncpy(manu, inqbuf.vendor, sizeof inqbuf.vendor);
|
||||
manu[sizeof inqbuf.vendor] = '\0';
|
||||
strncpy(model, inqbuf.product, sizeof inqbuf.product);
|
||||
model[sizeof inqbuf.product] = '\0';
|
||||
strncpy(revision, inqbuf.revision, sizeof inqbuf.revision);
|
||||
revision[sizeof inqbuf.revision] = '\0';
|
||||
} else {
|
||||
desc = "early protocol device";
|
||||
strcpy(manu, "????");
|
||||
strcpy(model, "");
|
||||
strcpy(revision, "");
|
||||
}
|
||||
|
||||
if(want)
|
||||
goto print;
|
||||
|
||||
ret = selectdev(masunit, targ, lun, sw, inqbuf.device_qualifier,
|
||||
inqbuf.device_type, inqbuf.removable, manu, model, revision, type);
|
||||
if(sw->printed[targ] & (1<<lun))
|
||||
return ret;
|
||||
|
||||
print:
|
||||
printf("%s%d targ %d lun %d: type %d(%s) %s <%s%s%s> SCSI%d\n",
|
||||
sw->name, masunit, targ, lun,
|
||||
inqbuf.device_type, dtype,
|
||||
inqbuf.removable ? "removable" : "fixed",
|
||||
manu, model, revision, inqbuf.ansii_version);
|
||||
if(qtype[0])
|
||||
printf("%s%d targ %d lun %d: qualifier %d(%s)\n",
|
||||
sw->name, masunit, targ, lun,
|
||||
inqbuf.device_qualifier, qtype);
|
||||
sw->printed[targ] |= (1<<lun);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
scsi_warn(int masunit, int mytarg, struct scsi_switch *sw)
|
||||
{
|
||||
struct scsidevs *match = (struct scsidevs *)0;
|
||||
int physid;
|
||||
int targ, lun;
|
||||
|
||||
for(targ=0; targ<8; targ++) {
|
||||
if(targ==mytarg)
|
||||
continue;
|
||||
for(lun=0; lun<8; lun++) {
|
||||
/* check if device already used, or empty */
|
||||
if( sw->empty[targ] & (1<<lun) )
|
||||
continue;
|
||||
if( sw->used[targ] & (1<<lun) )
|
||||
continue;
|
||||
|
||||
physid = targ*8 + lun;
|
||||
match = scsi_probe(masunit, sw, physid, 0, 0);
|
||||
|
||||
if(match == (struct scsidevs *)-1) {
|
||||
if(lun==0)
|
||||
sw->empty[targ] = 0xff;
|
||||
else
|
||||
sw->empty[targ] = 0xff;
|
||||
continue;
|
||||
}
|
||||
if(match) {
|
||||
targ = physid >> 3;
|
||||
lun = physid & 7;
|
||||
if(match->flags & SC_MORE_LUS)
|
||||
sw->empty[targ] |= (1<<lun);
|
||||
else
|
||||
sw->empty[targ] = 0xff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* not quite perfect. If we have two "drive ?" entries, this will
|
||||
* probe through all the devices twice. It should have realized that
|
||||
* any device that is not found the first time won't exist later on.
|
||||
*/
|
||||
int
|
||||
scsi_attach(int masunit, int mytarg, struct scsi_switch *sw,
|
||||
int *physid, int *unit, int type)
|
||||
{
|
||||
struct scsidevs *match = (struct scsidevs *)0;
|
||||
int targ, lun;
|
||||
int ret=0;
|
||||
|
||||
/*printf("%s%d probing at targ %d lun %d..\n",
|
||||
sw->name, masunit, *physid >> 3, *physid & 7);*/
|
||||
|
||||
if( *physid!=-1 ) {
|
||||
targ = *physid >> 3;
|
||||
lun = *physid & 7;
|
||||
|
||||
if( (sw->empty[targ] & (1<<lun)) || (sw->used[targ] & (1<<lun)) )
|
||||
return 0;
|
||||
|
||||
match = scsi_probe(masunit, sw, *physid, type, 0);
|
||||
if(match == (struct scsidevs *)-1) {
|
||||
match = (struct scsidevs *)0;
|
||||
if(lun==0)
|
||||
sw->empty[targ] = 0xff;
|
||||
else
|
||||
sw->empty[targ] |= (1<<lun);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!match)
|
||||
return 0;
|
||||
|
||||
ret = (*(match->attach_rtn))(masunit, sw, *physid, unit);
|
||||
goto success;
|
||||
}
|
||||
|
||||
for(targ=0; targ<8; targ++) {
|
||||
if(targ==mytarg)
|
||||
continue;
|
||||
for(lun=0; lun<8; lun++) {
|
||||
if( (sw->empty[targ] & (1<<lun)) || (sw->used[targ] & (1<<lun)) )
|
||||
continue;
|
||||
|
||||
*physid = targ*8 + lun;
|
||||
match = scsi_probe(masunit, sw, *physid, type, 0);
|
||||
if( match==(struct scsidevs *)-1) {
|
||||
if(lun==0)
|
||||
sw->empty[targ] = 0xff;
|
||||
else
|
||||
sw->empty[targ] |= (1<<lun);
|
||||
match = (struct scsidevs *)0;
|
||||
continue;
|
||||
}
|
||||
if(!match)
|
||||
break;
|
||||
ret = (*(match->attach_rtn))(masunit, sw, *physid, unit);
|
||||
if(ret)
|
||||
goto success;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
*physid = -1; /* failed... */
|
||||
return 0;
|
||||
|
||||
success:
|
||||
targ = *physid >> 3;
|
||||
lun = *physid & 7;
|
||||
if(match->flags & SC_MORE_LUS)
|
||||
sw->used[targ] |= (1<<lun);
|
||||
else
|
||||
sw->used[targ] = 0xff;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Try make as good a match as possible with
|
||||
* available sub drivers
|
||||
*/
|
||||
struct scsidevs *
|
||||
selectdev(int unit, int target, int lu, struct scsi_switch *sw, int qual,
|
||||
int dtype, int remov, char *manu, char *model, char *rev, int type)
|
||||
{
|
||||
struct scsidevs *sdbest = (struct scsidevs *)0;
|
||||
struct scsidevs *sdent = knowndevs;
|
||||
int numents = sizeof(knowndevs)/sizeof(struct scsidevs);
|
||||
int count = 0, sdbestes = 0;
|
||||
|
||||
dtype |= (qual << 5);
|
||||
|
||||
sdent--;
|
||||
while( count++ < numents) {
|
||||
sdent++;
|
||||
if(dtype != sdent->dtype)
|
||||
continue;
|
||||
if(type != sdent->type)
|
||||
continue;
|
||||
if(sdbestes < 1) {
|
||||
sdbestes = 1;
|
||||
sdbest = sdent;
|
||||
}
|
||||
if(remov != sdent->removable)
|
||||
continue;
|
||||
if(sdbestes < 2) {
|
||||
sdbestes = 2;
|
||||
sdbest = sdent;
|
||||
}
|
||||
if(sdent->flags & SC_SHOWME)
|
||||
printf("\n%s-\n%s-", sdent->manufacturer, manu);
|
||||
if(strcmp(sdent->manufacturer, manu))
|
||||
continue;
|
||||
if(sdbestes < 3) {
|
||||
sdbestes = 3;
|
||||
sdbest = sdent;
|
||||
}
|
||||
if(sdent->flags & SC_SHOWME)
|
||||
printf("\n%s-\n%s-",sdent->model, model);
|
||||
if(strcmp(sdent->model, model))
|
||||
continue;
|
||||
if(sdbestes < 4) {
|
||||
sdbestes = 4;
|
||||
sdbest = sdent;
|
||||
}
|
||||
if(sdent->flags & SC_SHOWME)
|
||||
printf("\n%s-\n%s-",sdent->version, rev);
|
||||
if(strcmp(sdent->version, rev))
|
||||
continue;
|
||||
if(sdbestes < 5) {
|
||||
sdbestes = 5;
|
||||
sdbest = sdent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return sdbest;
|
||||
}
|
||||
|
||||
/*
|
||||
* Do a scsi operation asking a device if it is
|
||||
* ready. Use the scsi_cmd routine in the switch
|
||||
* table.
|
||||
*/
|
||||
int
|
||||
scsi_ready(int unit, int target, int lu,
|
||||
struct scsi_switch *sw, int flags)
|
||||
{
|
||||
struct scsi_test_unit_ready scsi_cmd;
|
||||
struct scsi_xfer scsi_xfer;
|
||||
volatile int rval;
|
||||
int key;
|
||||
|
||||
bzero(&scsi_cmd, sizeof(scsi_cmd));
|
||||
bzero(&scsi_xfer, sizeof(scsi_xfer));
|
||||
scsi_cmd.op_code = TEST_UNIT_READY;
|
||||
|
||||
scsi_xfer.flags = flags | INUSE;
|
||||
scsi_xfer.adapter = unit;
|
||||
scsi_xfer.targ = target;
|
||||
scsi_xfer.lu = lu;
|
||||
scsi_xfer.cmd = (struct scsi_generic *)&scsi_cmd;
|
||||
scsi_xfer.retries = 8;
|
||||
scsi_xfer.timeout = 10000;
|
||||
scsi_xfer.cmdlen = sizeof(scsi_cmd);
|
||||
scsi_xfer.data = 0;
|
||||
scsi_xfer.datalen = 0;
|
||||
scsi_xfer.resid = 0;
|
||||
scsi_xfer.when_done = 0;
|
||||
scsi_xfer.done_arg = 0;
|
||||
retry: scsi_xfer.error = 0;
|
||||
|
||||
/* don't use interrupts! */
|
||||
|
||||
rval = (*(sw->scsi_cmd))(&scsi_xfer);
|
||||
if (rval != COMPLETE) {
|
||||
if(scsi_debug) {
|
||||
printf("scsi error, rval = 0x%x\n", rval);
|
||||
printf("code from driver: 0x%x\n", scsi_xfer.error);
|
||||
}
|
||||
switch(scsi_xfer.error) {
|
||||
case XS_SENSE:
|
||||
/*
|
||||
* Any sense value is illegal except UNIT ATTENTION
|
||||
* In which case we need to check again to get the
|
||||
* correct response. (especially exabytes)
|
||||
*/
|
||||
if(scsi_xfer.sense.error_class == 7 ) {
|
||||
key = scsi_xfer.sense.ext.extended.sense_key ;
|
||||
switch(key) {
|
||||
case 2: /* not ready BUT PRESENT! */
|
||||
return(COMPLETE);
|
||||
case 6:
|
||||
spinwait(1000);
|
||||
if(scsi_xfer.retries--) {
|
||||
scsi_xfer.flags &= ~ITSDONE;
|
||||
goto retry;
|
||||
}
|
||||
return(COMPLETE);
|
||||
default:
|
||||
if(scsi_debug)
|
||||
printf("%d:%d,key=%x.", target,
|
||||
lu, key);
|
||||
}
|
||||
}
|
||||
return(HAD_ERROR);
|
||||
case XS_BUSY:
|
||||
spinwait(1000);
|
||||
if(scsi_xfer.retries--) {
|
||||
scsi_xfer.flags &= ~ITSDONE;
|
||||
goto retry;
|
||||
}
|
||||
return COMPLETE; /* it's busy so it's there */
|
||||
case XS_TIMEOUT:
|
||||
default:
|
||||
return HAD_ERROR;
|
||||
}
|
||||
}
|
||||
return COMPLETE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Do a scsi operation asking a device what it is
|
||||
* Use the scsi_cmd routine in the switch table.
|
||||
*/
|
||||
int
|
||||
scsi_inquire(int unit, int target, int lu, struct scsi_switch *sw,
|
||||
u_char *inqbuf, int flags)
|
||||
{
|
||||
struct scsi_inquiry scsi_cmd;
|
||||
struct scsi_xfer scsi_xfer;
|
||||
|
||||
bzero(&scsi_cmd, sizeof(scsi_cmd));
|
||||
bzero(&scsi_xfer, sizeof(scsi_xfer));
|
||||
scsi_cmd.op_code = INQUIRY;
|
||||
scsi_cmd.length = sizeof(struct scsi_inquiry_data);
|
||||
|
||||
scsi_xfer.flags = flags | SCSI_DATA_IN | INUSE;
|
||||
scsi_xfer.adapter = unit;
|
||||
scsi_xfer.targ = target;
|
||||
scsi_xfer.lu = lu;
|
||||
scsi_xfer.retries = 8;
|
||||
scsi_xfer.timeout = 10000;
|
||||
scsi_xfer.cmd = (struct scsi_generic *)&scsi_cmd;
|
||||
scsi_xfer.cmdlen = sizeof(struct scsi_inquiry);
|
||||
scsi_xfer.data = inqbuf;
|
||||
scsi_xfer.datalen = sizeof(struct scsi_inquiry_data);
|
||||
scsi_xfer.resid = sizeof(struct scsi_inquiry_data);
|
||||
scsi_xfer.when_done = 0;
|
||||
scsi_xfer.done_arg = 0;
|
||||
|
||||
retry:
|
||||
scsi_xfer.error=0;
|
||||
/* don't use interrupts! */
|
||||
|
||||
if ((*(sw->scsi_cmd))(&scsi_xfer) != COMPLETE) {
|
||||
if(scsi_debug)
|
||||
printf("inquiry had error(0x%x) ",scsi_xfer.error);
|
||||
switch(scsi_xfer.error) {
|
||||
case XS_NOERROR:
|
||||
break;
|
||||
case XS_SENSE:
|
||||
/*
|
||||
* Any sense value is illegal except UNIT ATTENTION
|
||||
* In which case we need to check again to get the
|
||||
* correct response. (especially exabytes)
|
||||
*/
|
||||
if( scsi_xfer.sense.error_class==7 &&
|
||||
scsi_xfer.sense.ext.extended.sense_key==6) {
|
||||
/* it's changed so it's there */
|
||||
spinwait(1000);
|
||||
if(scsi_xfer.retries--) {
|
||||
scsi_xfer.flags &= ~ITSDONE;
|
||||
goto retry;
|
||||
}
|
||||
return COMPLETE;
|
||||
}
|
||||
return HAD_ERROR;
|
||||
case XS_BUSY:
|
||||
spinwait(1000);
|
||||
if(scsi_xfer.retries--) {
|
||||
scsi_xfer.flags &= ~ITSDONE;
|
||||
goto retry;
|
||||
}
|
||||
case XS_TIMEOUT:
|
||||
default:
|
||||
return(HAD_ERROR);
|
||||
}
|
||||
}
|
||||
return COMPLETE;
|
||||
}
|
||||
|
||||
/*
|
||||
* convert a physical address to 3 bytes,
|
||||
* MSB at the lowest address,
|
||||
* LSB at the highest.
|
||||
*/
|
||||
void
|
||||
lto3b(u_long val, u_char *bytes)
|
||||
{
|
||||
*bytes++ = (val&0xff0000)>>16;
|
||||
*bytes++ = (val&0xff00)>>8;
|
||||
*bytes = val&0xff;
|
||||
}
|
||||
|
||||
/*
|
||||
* The reverse of lto3b
|
||||
*/
|
||||
u_long
|
||||
_3btol(u_char *bytes)
|
||||
{
|
||||
u_long rc;
|
||||
|
||||
rc = (*bytes++ << 16);
|
||||
rc += (*bytes++ << 8);
|
||||
rc += *bytes;
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
/*
|
||||
* Written by Julian Elischer (julian@tfs.com)
|
||||
* for TRW Financial Systems for use under the MACH(2.5) operating system.
|
||||
* Hacked by Theo de Raadt <deraadt@fsa.ca>
|
||||
*
|
||||
* TRW Financial Systems, in accordance with their agreement with Carnegie
|
||||
* Mellon University, makes this software available to CMU to distribute
|
||||
* or use in any manner that they see fit as long as this message is kept with
|
||||
* the software. For this reason TFS also grants any other persons or
|
||||
* organisations permission to use or modify this software.
|
||||
*
|
||||
* TFS supplies this software to be publicly redistributed
|
||||
* on the understanding that TFS is not responsible for the correct
|
||||
* functioning of this software in any circumstances.
|
||||
*
|
||||
* $Id: scsiconf.h,v 1.1 1994/04/01 23:18:16 phil Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* these calls are called by the high-end
|
||||
* drivers to get services from whatever low-end
|
||||
* drivers they are attached to
|
||||
*/
|
||||
struct scsi_switch {
|
||||
char *name;
|
||||
int (*scsi_cmd)();
|
||||
void (*scsi_minphys)();
|
||||
int (*open_target_lu)();
|
||||
int (*close_target_lu)();
|
||||
long int (*adapter_info)(); /* see definitions below */
|
||||
u_long spare[3];
|
||||
u_char empty[8], used[8], printed[8];
|
||||
};
|
||||
#define AD_INF_MAX_CMDS 0x000000FF /* maximum number of entries
|
||||
queuable to a device by
|
||||
the adapter */
|
||||
/* 24 bits of other adapter charcteristics go here */
|
||||
|
||||
/***********************************************\
|
||||
* The scsi debug control bits *
|
||||
\***********************************************/
|
||||
extern int scsi_debug;
|
||||
#define PRINTROUTINES 0x01
|
||||
#define TRACEOPENS 0x02
|
||||
#define TRACEINTERRUPTS 0x04
|
||||
#define SHOWREQUESTS 0x08
|
||||
#define SHOWSCATGATH 0x10
|
||||
#define SHOWINQUIRY 0x20
|
||||
#define SHOWCOMMANDS 0x40
|
||||
|
||||
|
||||
/********************************/
|
||||
/* return values for scsi_cmd() */
|
||||
/********************************/
|
||||
#define SUCCESSFULLY_QUEUED 0
|
||||
#define TRY_AGAIN_LATER 1
|
||||
#define COMPLETE 2
|
||||
#define HAD_ERROR 3
|
||||
|
||||
struct scsi_xfer
|
||||
{
|
||||
struct scsi_xfer *next; /* when free */
|
||||
int flags;
|
||||
u_char adapter;
|
||||
u_char targ;
|
||||
u_char lu;
|
||||
u_char retries; /* the number of times to retry */
|
||||
long int timeout; /* in miliseconds */
|
||||
struct scsi_generic *cmd;
|
||||
int cmdlen;
|
||||
u_char *data; /* either the dma address OR a uio address */
|
||||
int datalen; /* data len (blank if uio) */
|
||||
int resid;
|
||||
int (*when_done)();
|
||||
int done_arg;
|
||||
int done_arg2;
|
||||
int error;
|
||||
struct buf *bp;
|
||||
struct scsi_sense_data sense;
|
||||
};
|
||||
/********************************/
|
||||
/* Flag values */
|
||||
/********************************/
|
||||
#define SCSI_NOSLEEP 0x01 /* Not a user... don't sleep */
|
||||
#define SCSI_NOMASK 0x02 /* dont allow interrupts.. booting */
|
||||
#define SCSI_NOSTART 0x04 /* left over from ancient history */
|
||||
#define ITSDONE 0x10 /* the transfer is as done as it gets */
|
||||
#define INUSE 0x20 /* The scsi_xfer block is in use */
|
||||
#define SCSI_SILENT 0x40 /* Don't report errors to console */
|
||||
#define SCSI_ERR_OK 0x80 /* An error on this operation is OK. */
|
||||
#define SCSI_RESET 0x100 /* Reset the device in question */
|
||||
#define SCSI_DATA_UIO 0x200 /* The data address refers to a UIO */
|
||||
#define SCSI_DATA_IN 0x400 /* expect data to come INTO memory */
|
||||
#define SCSI_DATA_OUT 0x800 /* expect data to flow OUT of memory */
|
||||
#define SCSI_TARGET 0x1000 /* This defines a TARGET mode op. */
|
||||
/********************************/
|
||||
/* Error values */
|
||||
/********************************/
|
||||
#define XS_NOERROR 0x0 /* there is no error, (sense is invalid) */
|
||||
#define XS_SENSE 0x1 /* Check the returned sense for the error */
|
||||
#define XS_DRIVER_STUFFUP 0x2 /* Driver failed to perform operation */
|
||||
#define XS_TIMEOUT 0x03 /* The device timed out.. turned off? */
|
||||
#define XS_SWTIMEOUT 0x04 /* The Timeout reported was caught by SW */
|
||||
#define XS_BUSY 0x08 /* The device busy, try again later? */
|
||||
|
||||
/*
|
||||
* The structure of known drivers for autoconfiguration
|
||||
*/
|
||||
#define SC_TSD 0
|
||||
#define SC_TST 1
|
||||
#define SC_TCD 2
|
||||
|
||||
#define SC_SHOWME 0x01
|
||||
#define SC_ONE_LU 0x00
|
||||
#define SC_MORE_LUS 0x02
|
||||
struct scsidevs {
|
||||
int type, dtype, removable;
|
||||
char *manufacturer, *model, *version;
|
||||
int (*attach_rtn)();
|
||||
char *devname, flags;
|
||||
};
|
||||
|
||||
int scsi_inquire(int, int, int, struct scsi_switch *, u_char *, int);
|
||||
int scsi_ready(int, int, int, struct scsi_switch *, int);
|
||||
int scsi_attach(int, int, struct scsi_switch *, int *, int *, int);
|
||||
void scsi_warn(int, int, struct scsi_switch *);
|
||||
struct scsidevs *scsi_probe(int, struct scsi_switch *, int, int, int);
|
||||
struct scsidevs *selectdev(int, int, int, struct scsi_switch *,
|
||||
int, int, int, char *, char *, char *, int);
|
||||
u_long _3btol(u_char *);
|
||||
void lto3b(u_long, u_char *);
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* $Id: sddefs.h,v 1.1 1994/04/01 23:18:18 phil Exp $
|
||||
*/
|
||||
|
||||
struct sd_data {
|
||||
int flags;
|
||||
#define SDVALID 0x02 /* PARAMS LOADED */
|
||||
#define SDINIT 0x04 /* device has been init'd */
|
||||
#define SDWAIT 0x08 /* device has someone waiting */
|
||||
#define SDHAVELABEL 0x10 /* have read the label */
|
||||
#define SDDOSPART 0x20 /* Have read host-dependent partition table */
|
||||
#define SDWRITEPROT 0x40 /* Device in readonly mode (S/W)*/
|
||||
struct scsi_switch *sc_sw; /* address of scsi low level switch */
|
||||
struct scsi_xfer *freexfer; /* chain of free ones */
|
||||
struct buf sdbuf;
|
||||
int formatting; /* format lock */
|
||||
int ctlr; /* so they know which one we want */
|
||||
int targ; /* our scsi target ID */
|
||||
int lu; /* out scsi lu */
|
||||
long int ad_info; /* info about the adapter */
|
||||
int cmdscount; /* cmds allowed outstanding by board*/
|
||||
int wlabel; /* label is writable */
|
||||
struct disk_parms {
|
||||
u_char heads; /* Number of heads */
|
||||
u_short cyls; /* Number of cylinders */
|
||||
u_char sectors; /* Number of sectors/track */
|
||||
u_short secsiz; /* Number of bytes/sector */
|
||||
u_long disksize; /* total number sectors */
|
||||
} params;
|
||||
unsigned int sd_start_of_unix; /* unix vs host-dependent partitions */
|
||||
struct disklabel disklabel;
|
||||
struct cpu_disklabel cpudisklabel;
|
||||
int partflags[MAXPARTITIONS]; /* per partition flags */
|
||||
#define SDOPEN 0x01
|
||||
int openparts; /* one bit for each open partition */
|
||||
int blockwait;
|
||||
};
|
||||
|
||||
int sdattach(int, struct scsi_switch *, int, int *);
|
||||
int sdopen(int);
|
||||
struct scsi_xfer *sd_get_xs(int, int);
|
||||
void sd_free_xs(int, struct scsi_xfer *, int);
|
||||
void sdminphys(struct buf *);
|
||||
void sdstrategy(struct buf *);
|
||||
void sdstart(int);
|
||||
int sd_done(int, struct scsi_xfer *);
|
||||
int sdioctl(dev_t, int, caddr_t, int);
|
||||
int sdgetdisklabel(u_char);
|
||||
int sd_size(int, int);
|
||||
int sd_test_unit_ready(int, int);
|
||||
void sd_dump();
|
||||
int sdsize(dev_t);
|
||||
int sd_interpret_sense(int, struct scsi_xfer *);
|
||||
int sd_scsi_cmd(int, struct scsi_generic *, int, u_char *, int, int, int);
|
||||
int sd_close(dev_t);
|
||||
int sd_get_parms(int, int);
|
||||
int sd_reassign_blocks(int, int);
|
||||
int sd_start_unit(int, int);
|
||||
int sd_prevent(int, int, int);
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* $Id: stdefs.h,v 1.1 1994/04/01 23:18:22 phil Exp $
|
||||
*/
|
||||
|
||||
#define STQSIZE 4
|
||||
struct st_data {
|
||||
struct scsi_switch *sc_sw; /* address of scsi low level switch */
|
||||
int flags;
|
||||
int ctlr; /* so they know which one we want */
|
||||
int targ; /* our scsi target ID */
|
||||
int lu; /* our scsi lu */
|
||||
int blkmin; /* min blk size */
|
||||
int blkmax; /* max blk size */
|
||||
int numblks; /* nominal blocks capacity */
|
||||
int blksiz; /* nominal block size */
|
||||
int info_valid; /* the info about the device is valid */
|
||||
int initialized;
|
||||
struct buf buf[STQSIZE]; /* buffer for raw io (one per device) */
|
||||
struct buf buf_queue;
|
||||
struct scsi_xfer scsi_xfer;
|
||||
int blockwait;
|
||||
};
|
||||
#define ST_OPEN 0x01
|
||||
#define ST_NOREWIND 0x02
|
||||
#define ST_WRITTEN 0x04
|
||||
#define ST_FIXEDBLOCKS 0x10
|
||||
#define ST_AT_FILEMARK 0x20
|
||||
#define ST_AT_EOM 0x40
|
||||
|
||||
#define ST_PER_ACTION (ST_AT_FILEMARK | ST_AT_EOM)
|
||||
#define ST_PER_OPEN (ST_OPEN | ST_NOREWIND | ST_WRITTEN | ST_PER_ACTION)
|
||||
#define ST_PER_MEDIA ST_FIXEDBLOCKS
|
||||
|
||||
int stattach(int, struct scsi_switch *, int, int *);
|
||||
int stopen(dev_t);
|
||||
int stclose(dev_t);
|
||||
void stminphys(struct buf *);
|
||||
void ststrategy(struct buf *);
|
||||
int ststart(int);
|
||||
int st_done(int, struct scsi_xfer *);
|
||||
int stioctl(dev_t, int, caddr_t, int);
|
||||
int st_req_sense(int, int);
|
||||
int st_test_ready(int, int);
|
||||
int st_rd_blk_lim(int, int);
|
||||
int st_mode_sense(int, int);
|
||||
int st_mode_select(int, int, int);
|
||||
int st_space(int, int, int, int);
|
||||
int st_write_filemarks(int, int, int);
|
||||
int st_load(int, int, int);
|
||||
int st_prevent(int, int, int);
|
||||
int st_rewind(int, int, int);
|
||||
int st_scsi_cmd(int, struct scsi_generic *, int, u_char *, int, int, int);
|
||||
int st_interpret_sense(int, struct scsi_xfer *);
|
||||
int stsize(dev_t);
|
||||
int stdump(void);
|
||||
|
Loading…
Reference in New Issue