RAWSCSI(4) — NEWS-OS Programmer’s Manual
NAME
rawscsi − general purpose SCSI interface
SYNOPSIS
device rawscsi0 at iop0 priority 0
device rawscsi0 at hb0 priority 0
DESCRIPTION
The general purpose SCSI interface, rawscsi, is a device driver for the operation of SCSI (Small Computer System Interface) devices at the command level. The special files /dev/scsi[0-1][0-6] each correspond to one of the SCSI devices having bus numbers 0 thru 1, ID numbers 0 thru 6.
rawscsi supports all SCSI IDs. If the target SCSI device reponds properly to the SCSI command "Inquiry", rawscsi is assigned to the corresponding SCSI ID.
However, due to the fact that rawscsi is a non-mass storage device, rawscsi is not assigned to SCSI IDs which have been recognized as mass storage devices under auto-configuration.
The following are defined in the header file /sys/newsiodev/scu.h.
/∗
∗ screg.h
∗/
#defineSCSIIOCCMD _IOWR(S, 0, struct sc_ureq)
#defineSCSIIOCGTIMEO_IOR(S, 1, int)
#defineSCSIIOCSTIMEO_IOW(S, 2, int)
/∗
∗scsi user request parameter block
∗/
struct sc_ureq {
u_intscu_istatus;
u_intscu_tstatus;
u_intscu_identify;
u_intscu_message;
u_intscu_bytesec;
u_charscu_cdb[12];
u_charscu_param[20];
u_char∗scu_addr;
u_intscu_count;
};
To control an SCSI device from a user process write the desired command information in the structure sc_ureq and request that rawscsi process them by using ioctl(). The results are returned in the structure sc_ureq once processing has finished. New command information is created based on these results.
intfd;
inttimeo;
struct sc_ureq∗scu;
ioctl(fd, SCSIIOCCMD, scu); --- Operates SCSI devices
ioctl(fd, SCSIIOCGTIMEO, &timeo); --- Gets the timeout (sec) of the command
ioctl(fd, SCSIIOCSTIMEO, &timeo); --- Sets the timeout (sec) of the command
The following command information is written in the structure sc_ureq.
scu_istatus
Initialized to 0. Returns the initiator (NEWS) status after commands have been executed.
scu_tstatus
Initialized to 0. Returns the target (SCSI device) status after commands have been executed.
scu_identify
Specifies a 1-byte message to be sent to the target SCSI device. Normally an IDENTIFY message is specified.
scu_message
Normally initialized to 0. Use only when an extended message (synchronous transfer request message) is to be sent. Set scu_message to 1 (Extended Message) to send the message and specify the message in scu_param. The last message received from an SCSI device is entered in scu_message.
scu_bytesec
Specifies the number of bytes per sector to be used. Set scu_count to the same value if sector length is variable.
scu_cdb[ ]
Specifies the CDB (Command Descriptor Block). For details concerning the contents of CDB, see the CDB manual for each SCSI device.
scu_param[ ]
Used as a parameter I/O area of 20 bytes or less by commands such as inquiry, request sense and mode select. It is also possible to perform data I/O without using this area by specifying another area using scu_addr.
∗scu_addr
Specifies the data transmision start address. If scu_addr is set to 0, scu_param is used as the data transmission start address. Be sure to specify an integer value for scu_bytesec when using scu_addr to specify the data transmission start address.
scu_count
Specifies the data transmission byte count. Since normal data transmission is not possible if a value other than that specified for scu_cdb is used, be sure to set the data transmission byte count to the same value as that used for scu_cdb.
BIT ASSIGNMENT
scu_istatus ---- Initiator Status
7 6 5 4 3 2 1 0
+---+---+---+---+---+---+---+---+
|E P|W R|I P|W B|L B|T O|P E|H E|
+---+---+---+---+---+---+---+---+
EP (End of Process)
This bit is set if the command ends normally. However, if a bit other than this bit is set after command execution has ended, this indicates that there was some kind of error between the initiator and the target device.
WR (Wait Reselection)
If this bit is set, this indicates that the initiator is waiting for reselection from the target device.
IP (In Progress)
If this bit is set, this indicates that the initiator and target device are connected logically and that the command(s) is/are now being executed.
WB (Wait Bus free)
If this bit is set, this indicates that the initiator is waiting for the SCSI bus to be available for use.
LB (Loss of Busy)
If this bit is set, this indicates that the bus is free but no disconnect message has been received from the target device.
TO (Time Out)
If this bit is set, this indicates that a timeout occured because there was no response from the target device at the selection phase.
PE (Parity Error)
If this bit is set, this indicates that a parity error occured on the SCSI bus. However, if LB is also set, this bit becomes meaningless.
HE (Hardware Error)
If this bit is set, this indicates that the SCSI bus has been reset.
scu_tstatus ---- Target Status
7 6 5 4 3 2 1 0
+---+---+---+---+---+---+---+---+
| X | X | X | | | | | X |
+---+---+---+---+---+---+---+---+
| | | |
+---+---+---+
|
|
+-----------> +------+---------------------------------+
| 0000 | Good |
| 0001 | Check Condition |
| 0010 | Condition Met/Good |
| 0011 | (reserved) |
| 0100 | Busy |
| 0101 | (reserved) |
| 0110 | (reserved) |
| 0111 | (reserved) |
| 1000 | Intermidiate/Good |
| 1001 | (reserved) |
| 1010 | Intermidiate/Condition Met/Good |
| 1011 | (reserved) |
| 1100 | Reservation Conflict |
| 1101 | (reserved) |
| 1110 | (reserved) |
| 1111 | (reserved) |
+------+---------------------------------+
scu_identify ---- Identify Message
7 6 5 4 3 2 1 0
+---+---+---+---+---+---+---+---+
| 1 | | 0 | 0 | 0 | | | |
+---+---+---+---+---+---+---+---+
| | | |
| +---+---+
| |
| +----------> LUN (Logical Unit Number)
|
+------------------------------> DISCONNECT Enable/Disable
FILES
/dev/scsi??
SEE ALSO
BUGS
NEWS workstations utilize an SCSI (Small Computer System Interface) bus as standard equipment. Although the hardware protocol conforms to ANSI standard X3T9.2 1987. There are a few restrictions in the software protocol. These are described below.
1.A disconnect/reconnect function is supported.
2.Some NEWS models can perform synchronous transfer while others can not.
3.Messages which can be handled by NEWS workstations are shown in the table below. However, no message other than the synchronous transfer request message is supported as the extended message. If a message other than this is received, an ATTENTION CONDITION occurs on the NEWS and a Message Reject message is issued.
Message Name Message Code Tranmission Direction
----------------------------------------------------------------
Command Complete 0 IN
----------------------------------------------------------------
Extended Message 1 IN, OUT
----------------------------------------------------------------
Save Data Pointer 2 IN
----------------------------------------------------------------
Restore Data Pointer 3 IN
----------------------------------------------------------------
Disconnect 4 IN
----------------------------------------------------------------
Message Reject 7 IN, OUT
----------------------------------------------------------------
Identify 0x80-0xc7 IN, OUT
----------------------------------------------------------------
(Note)If a NEWS workstation receives a Message Reject message, it will determine that all communications have ended and wait for the BUSY signal to be negated.
4.There are no specifications provided for command codes that may be used. Command codes causing a system call to be generated are output on the SCSI bus as is.
5.It is not possible to issue a second command to a target device until execution of the command previously issued has ended. (This is not possible even if the target device supports command queuing because NEWS workstations do not.)
6.No command link function is supported. Operations for which command blocks are issued by setting the link bit to 1 are not guaranteed.
7.NEWS workstations can only be initiators under rawscsi. They may not function as target devices.
NEWS-OSRelease 4.1C