|
|
DataMuseum.dkPresents historical artifacts from the history of: Regnecentalen RC-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Regnecentalen RC-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T U s
Length: 7319 (0x1c97)
Types: TextFile
Notes: UNIX file
Names: »scsi.h«
└─⟦22cab2c1b⟧ Bits:30004042/kcaddon.imd SW95705I 386/ix Multi-user Release 1.2
└─⟦22cab2c1b⟧ UNIX Filesystem
└─⟦this⟧ »KC/new/usr/include/sys/scsi.h«
/*
*
* SCSI driver declarations.
*
*/
/*
* 871221 RC900 version created from RC39 scsi driver
* SCSITIMEVAL changed from 15000 to 30000
*/
#define SPL spl5 /* for driver mutex */
#define SCSITIMEVAL 30000 /* timesteps used for timeout */
#define LOW(x) ((x)&0xFF) /* "low" byte */
#define HIGH(x) (((x)>>8)&0xFF) /* "high" byte */
/*
* Host adapter configuration.
*
*/
#define DMABYTES 6 /* number of bytes to write */
/* to enable dma for AT bus */
/* access */
struct scsihcfg {
unsigned hs_ioa; /* Physical io address */
unsigned hs_level; /* what interrupe level */
unchar dma_addrs[DMABYTES]; /* io addresses of dma regs */
unchar dma_vals[DMABYTES]; /* values to be written */
};
/*
* SCSI Command Block.
*/
struct scsicb {
char cb_opcode; /*bit 7-5 command, 4-0 opcode */
char cb_lun; /*bit 7-5 LUN, bit 4-0 LAD2 */
char cb_lad1; /* LAD 1 */
char cb_lad0; /* LAD 0 */
char cb_blk; /* */
char cb_contl; /* CONTROL */
};
/*
* Error Status-Structure, Returned on request sense.
*/
struct scsierr {
char sc_status; /* sense byte */
char sc_lun; /* bit 7-5 LUN, bit 4-0 LAD 2 */
char sc_lad1; /* LAD 1 */
char sc_lad0; /* LAD 0/INF 3 */
char sc_inf2; /* INF 2 */
char sc_inf1; /* INF 1 */
char sc_inf0; /* INF 0 */
};
/*
* Host Adapter dynamic data.
*/
struct scsihost {
ushort h_inst; /* 0 if the hostadapter isn't installed*/
unsigned h_ioa; /* Physical IO address */
unsigned hs_timeid; /* host adapter id from timeout call */
struct scsidev *h_dd; /* current minor dev */
struct iobuf *h_bufh; /* -> buffer header */
ushort opened; /* true/false */
char hs_buf[32]; /* set mode buffer */
char hs_state; /* what just finished */
char hs_dev; /* current minor */
int hs_init; /* status init operation */
caddr_t hs_addr; /* virtuel addr. of do */
struct scsicb hs_cb; /* command block */
struct scsierr hs_error; /* block for error answer */
char hs_last_opcode; /* used in SENSE to store opcode */
};
/*
* Per minor dev "dynamic" data.
*/
struct scsidev {
short scsidid; /* scsiDsetinationID */
short unit; /* unit number of the dev */
unsigned short secsiz; /* sector-size (bytes) */
unsigned short bsf; /* Block Shift Factor sector */
/* power of 2 */
/* params for set read/write parameters cmd - see t100 manual */
unsigned short nhead; /* number of heads-1 */
unsigned short drvman; /* drive manufactor code */
unsigned short min_tsiz; /* minimum transfer size */
unsigned short drv_ctrl; /* drive control */
/* params for opening device */
unsigned short reten; /* retension if 1. load fails? */
/* params for closing the device */
unsigned short unload; /* action in close unload/load */
};
/*
* Macros to make things easier to read/code/maintain/etc...
*/
#define IO_OP(bp) ((bp->b_flags&B_READ)?READ_OP:WRITE_OP)
/*
* Values of buffer-header b_active, used for mutual-exclusion of
* opens and other IO requests.
*/
#define IO_IDLE 0 /* idle -- anything goes */
#define IO_OPEN_WAIT 1 /* open waiting */
#define IO_BUSY 2 /* something going on */
/*
* Values of scsihost.hs_state, internal driver state.
*/
#define READ_WRITE 0 /* normal situation, RW */
#define GET_BAD_STATUS 1 /* retrieveing status; last cmd got er*/
#define INTERNAL 2 /* internal driver operations */
#define BAD_INTERNAL 3 /* retrieving status after internal */
/*
* Host adapter register addresses
*/
#define BUFLO 0 /* Data Address Register LOW bit 0-7*/
#define BUFHI 1 /* Data Address Register HIGH bit 8-15*/
#define BUFTO 2 /* Data Address Register TOP bit 16-23*/
#define HAMOD 3 /* Host Adapter MODe register */
#define UOPT 5 /* User OPTion register */
#define SBICA 6 /* Scsi Bus Interface Controler Address register */
#define SBICR 7 /* Scsi Bus Interface Controler base Register */
/*
* Host adapter Commands
*/
#define RESET_BOARD 0x81 /* reset board bit and enable int */
#define DISDMA 0x80 /* disable dma */
#define DMAWR 0xFE /* setup dma write mode */
#define DMARD 0xEE /* setup dma read mode*/
/*
* SCIB registers
*/
#define OWNID 0
#define CTRL 1
#define TIMOUT 2
#define CDB1 3
#define CDB2 4
#define CDB3 5
#define CDB4 6
#define CDB5 7
#define CDB6 8
#define CDB7 9
#define CDB8 10
#define CDB9 11
#define CDB10 12
#define CDB11 13
#define CDB12 14
#define TLUN 15
#define CMDPH 16
#define SYNCTR 17
#define TCTO 18
#define TCHI 19
#define TCLO 20
#define DID 21
#define SID 22
#define SCSIS 23
#define SCSIC 24
#define SCSID 25
/*
* SCIB commands
*/
#define RESCMD 0
#define SELTR 8
#define DISC 4
#define NACK 3
#define TPAD 0x21
#define SELTROK 0x16
/*
* Controller Command Codes.
*/
#define DRIVE_READY 0x00
#define REWIND 0x01
#define SENSE 0x03
#define READ_BLIM 0x05
#define SETRW_PARM 0x06
#define READ_OP 0x08
#define WRITE_OP 0x0A
#define WRITE_FM_OP 0x10
#define SPACE_OP 0x11
#define INQUIRY_OP 0x12
#define VERIFY_OP 0x13
#define RECOVER_OP 0x14
#define MOD_SEL_OP 0x15
#define RES_OP 0x16
#define REL_OP 0x17
#define ERASE_OP 0x19
#define MOD_SENSE 0x1A
#define LOAD_OP 0x1B
/*
* Reasons for host adaptor interrupts
*/
#define RESINT 0 /* reset cmd complete */
#define COMPINT 0x16 /* cmd complete with success */
#define TR0INT 0x1F /* transfer pad terminated */
#define PAINT 0x20 /* pause or abort */
#define TERMINT 0x4B /* cmd terminated */
#define SREQINT 0x80 /* servive required */
#define DISCINT 0x85 /* disconnect interrupt */
#define CHECK_SENSE 2 /* status phase = check sense */