📄 scgio.h
字号:
Ucbit vu_56 : 1; /* vendor unique (byte 5 bit 6) */ Ucbit vu_57 : 1; /* vendor unique (byte 5 bit 7) */};#else /* Motorola byteorder */struct scsi_g0cdb { /* scsi group 0 command description block */ u_char cmd; /* command code */ Ucbit lun : 3; /* logical unit number */ Ucbit high_addr : 5; /* high part of block address */ u_char mid_addr; /* middle part of block address */ u_char low_addr; /* low part of block address */ u_char count; /* transfer length */ Ucbit vu_57 : 1; /* vendor unique (byte 5 bit 7) */ Ucbit vu_56 : 1; /* vendor unique (byte 5 bit 6) */ Ucbit rsvd : 4; /* reserved */ Ucbit fr : 1; /* flag request (interrupt at completion) */ Ucbit link : 1; /* link (another command follows) */};#endif#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */struct scsi_g1cdb { /* scsi group 1 command description block */ u_char cmd; /* command code */ Ucbit reladr : 1; /* address is relative */ Ucbit res : 4; /* reserved bits 1-4 of byte 1 */ Ucbit lun : 3; /* logical unit number */ u_char addr[4]; /* logical block address */ u_char res6; /* reserved byte 6 */ u_char count[2]; /* transfer length */ Ucbit link : 1; /* link (another command follows) */ Ucbit fr : 1; /* flag request (interrupt at completion) */ Ucbit rsvd : 4; /* reserved */ Ucbit vu_96 : 1; /* vendor unique (byte 5 bit 6) */ Ucbit vu_97 : 1; /* vendor unique (byte 5 bit 7) */};#else /* Motorola byteorder */struct scsi_g1cdb { /* scsi group 1 command description block */ u_char cmd; /* command code */ Ucbit lun : 3; /* logical unit number */ Ucbit res : 4; /* reserved bits 1-4 of byte 1 */ Ucbit reladr : 1; /* address is relative */ u_char addr[4]; /* logical block address */ u_char res6; /* reserved byte 6 */ u_char count[2]; /* transfer length */ Ucbit vu_97 : 1; /* vendor unique (byte 5 bit 7) */ Ucbit vu_96 : 1; /* vendor unique (byte 5 bit 6) */ Ucbit rsvd : 4; /* reserved */ Ucbit fr : 1; /* flag request (interrupt at completion) */ Ucbit link : 1; /* link (another command follows) */};#endif#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */struct scsi_g5cdb { /* scsi group 5 command description block */ u_char cmd; /* command code */ Ucbit reladr : 1; /* address is relative */ Ucbit res : 4; /* reserved bits 1-4 of byte 1 */ Ucbit lun : 3; /* logical unit number */ u_char addr[4]; /* logical block address */ u_char count[4]; /* transfer length */ u_char res10; /* reserved byte 10 */ Ucbit link : 1; /* link (another command follows) */ Ucbit fr : 1; /* flag request (interrupt at completion) */ Ucbit rsvd : 4; /* reserved */ Ucbit vu_B6 : 1; /* vendor unique (byte B bit 6) */ Ucbit vu_B7 : 1; /* vendor unique (byte B bit 7) */};#else /* Motorola byteorder */struct scsi_g5cdb { /* scsi group 5 command description block */ u_char cmd; /* command code */ Ucbit lun : 3; /* logical unit number */ Ucbit res : 4; /* reserved bits 1-4 of byte 1 */ Ucbit reladr : 1; /* address is relative */ u_char addr[4]; /* logical block address */ u_char count[4]; /* transfer length */ u_char res10; /* reserved byte 10 */ Ucbit vu_B7 : 1; /* vendor unique (byte B bit 7) */ Ucbit vu_B6 : 1; /* vendor unique (byte B bit 6) */ Ucbit rsvd : 4; /* reserved */ Ucbit fr : 1; /* flag request (interrupt at completion) */ Ucbit link : 1; /* link (another command follows) */};#endif#define SC_G0_CDBLEN 6 /* Len of Group 0 commands */#define SC_G1_CDBLEN 10 /* Len of Group 1 commands */#define SC_G5_CDBLEN 12 /* Len of Group 5 commands */#define SCG_MAX_CMD 24 /* 24 bytes max. size is supported */#define SCG_MAX_STATUS 3 /* XXX (sollte 4 allign.) Mamimum Status Len */#define SCG_MAX_SENSE 32 /* Mamimum Sense Len for auto Req. Sense */#define DEF_SENSE_LEN 16 /* Default Sense Len */#define CCS_SENSE_LEN 18 /* Sense Len for CCS compatible devices */struct scg_cmd { caddr_t addr; /* Address of data in user space */ int size; /* DMA count for data transfer */ int flags; /* see below for definition */ int cdb_len; /* Size of SCSI command in bytes */ /* NOTE: rel 4 uses this field only */ /* with commands not in group 1 or 2*/ int sense_len; /* for intr() if -1 don't get sense */ int timeout; /* timeout in seconds */ /* NOTE: actual resolution depends */ /* on driver implementation */ int kdebug; /* driver kernel debug level */ int resid; /* Bytes not transfered */ int error; /* Error code from scgintr() */ int ux_errno; /* UNIX error code */#ifdef commentXXX struct scsi_status scb; ??? /* Status returnd by command */#endif union { struct scsi_status Scb;/* Status returnd by command */ u_char cmd_scb[SCG_MAX_STATUS]; } u_scb;#define scb u_scb.Scb#ifdef commentXXX struct scsi_sense sense; ??? /* Sense bytes from command */#endif union { struct scsi_sense Sense;/* Sense bytes from command */ u_char cmd_sense[SCG_MAX_SENSE]; } u_sense;#define sense u_sense.Sense int sense_count; /* Number of bytes valid in sense */ int target; /* SCSI target id */ union { /* SCSI command descriptor block */ struct scsi_g0cdb g0_cdb; struct scsi_g1cdb g1_cdb; struct scsi_g5cdb g5_cdb; u_char cmd_cdb[SCG_MAX_CMD]; } cdb; /* 24 bytes max. size is supported */};#define dma_read flags /* 1 if DMA to Sun, 0 otherwise *//* * definition for flags field in scg_cmd struct */#define SCG_RECV_DATA 0x0001 /* DMA direction to Sun */#define SCG_DISRE_ENA 0x0002 /* enable disconnect/reconnect */#define SCG_SILENT 0x0004 /* be silent on errors */#define SCG_CMD_RETRY 0x0008 /* enable retries */#define SCG_NOPARITY 0x0010 /* disable parity for this command *//* * definition for error field in scg_cmd struct * * The codes refer to SCSI general errors, not to device * specific errors. Device specific errors are discovered * by checking the sense data. * The distinction between retryable and fatal is somewhat ad hoc. */#define SCG_NO_ERROR 0 /* cdb transported without error */#define SCG_RETRYABLE 1 /* any other case */#define SCG_FATAL 2 /* could not select target */#define SCG_TIMEOUT 3 /* driver timed out */#define g0_cdbaddr(cdb, a) ((cdb)->high_addr = (a) >> 16,\ (cdb)->mid_addr = ((a) >> 8) & 0xFF,\ (cdb)->low_addr = (a) & 0xFF)#define g1_cdbaddr(cdb, a) ((cdb)->addr[0] = (a) >> 24,\ (cdb)->addr[1] = ((a) >> 16)& 0xFF,\ (cdb)->addr[2] = ((a) >> 8) & 0xFF,\ (cdb)->addr[3] = (a) & 0xFF)#define g5_cdbaddr(cdb, a) g1_cdbaddr(cdb, a)#define g0_cdblen(cdb, len) ((cdb)->count = (len))#define g1_cdblen(cdb, len) ((cdb)->count[0] = ((len) >> 8) & 0xFF,\ (cdb)->count[1] = (len) & 0xFF)#define g5_cdblen(cdb, len) ((cdb)->count[0] = (len) >> 24L,\ (cdb)->count[1] = ((len) >> 16L)& 0xFF,\ (cdb)->count[2] = ((len) >> 8L) & 0xFF,\ (cdb)->count[3] = (len) & 0xFF)#define i_to_long(a, i) (((u_char *)(a))[0] = ((i) >> 24)& 0xFF,\ ((u_char *)(a))[1] = ((i) >> 16)& 0xFF,\ ((u_char *)(a))[2] = ((i) >> 8) & 0xFF,\ ((u_char *)(a))[3] = (i) & 0xFF)#define i_to_3_byte(a, i) (((u_char *)(a))[0] = ((i) >> 16)& 0xFF,\ ((u_char *)(a))[1] = ((i) >> 8) & 0xFF,\ ((u_char *)(a))[2] = (i) & 0xFF)#define i_to_4_byte(a, i) (((u_char *)(a))[0] = ((i) >> 24)& 0xFF,\ ((u_char *)(a))[1] = ((i) >> 16)& 0xFF,\ ((u_char *)(a))[2] = ((i) >> 8) & 0xFF,\ ((u_char *)(a))[3] = (i) & 0xFF)#define i_to_short(a, i) (((u_char *)(a))[0] = ((i) >> 8) & 0xFF,\ ((u_char *)(a))[1] = (i) & 0xFF)#define a_to_u_short(a) ((unsigned short) \ ((((unsigned char*) a)[1] & 0xFF) | \ (((unsigned char*) a)[0] << 8 & 0xFF00)))#define a_to_3_byte(a) ((unsigned long) \ ((((unsigned char*) a)[2] & 0xFF) | \ (((unsigned char*) a)[1] << 8 & 0xFF00) | \ (((unsigned char*) a)[0] << 16 & 0xFF0000)))#ifdef __STDC__#define a_to_u_long(a) ((unsigned long) \ ((((unsigned char*) a)[3] & 0xFF) | \ (((unsigned char*) a)[2] << 8 & 0xFF00) | \ (((unsigned char*) a)[1] << 16 & 0xFF0000) | \ (((unsigned char*) a)[0] << 24 & 0xFF000000UL)))#else#define a_to_u_long(a) ((unsigned long) \ ((((unsigned char*) a)[3] & 0xFF) | \ (((unsigned char*) a)[2] << 8 & 0xFF00) | \ (((unsigned char*) a)[1] << 16 & 0xFF0000) | \ (((unsigned char*) a)[0] << 24 & 0xFF000000)))#endif/* Peripheral Device Type */#define SC_DASD 0x00#define SC_SEQD 0x01#define SC_PRTD 0x02 #define SC_PROCD 0x03 #define SC_OPTD 0x04#define SC_ROMD 0x05#define SC_SCAN 0x06#define SC_OMEM 0x07#define SC_JUKE 0x08#define SC_COMM 0x09#define SC_NOTPR 0x7F#if HAVE_SYS_IOCCOM_H#include <sys/ioccom.h>#endif#if defined(__STDC__)#define SCGIOCMD _IOWR('G', 1, struct scg_cmd) /* do a SCSI cmd */#define SCGIORESET _IO('G', 2) /* reset SCSI bus */#define SCGIOGDISRE _IOR('G', 4, int) /* get sc disre Val*/#define SCGIOSDISRE _IOW('G', 5, int) /* set sc disre Val*/#define SCGIOIDBG _IO('G', 100) /* Inc Debug Val */#define SCGIODDBG _IO('G', 101) /* Dec Debug Val */#define SCGIOGDBG _IOR('G', 102, int) /* get Debug Val */#define SCGIOSDBG _IOW('G', 103, int) /* set Debug Val */#define SCIOGDBG _IOR('G', 104, int) /* get sc Debug Val*/#define SCIOSDBG _IOW('G', 105, int) /* set sc Debug Val*/#else#define SCGIOCMD _IOWR(G, 1, struct scg_cmd) /* do a SCSI cmd */#define SCGIORESET _IO(G, 2) /* reset SCSI bus */#define SCGIOGDISRE _IOR(G, 4, int) /* get sc disre Val*/#define SCGIOSDISRE _IOW(G, 5, int) /* set sc disre Val*/#define SCGIOIDBG _IO(G, 100) /* Inc Debug Val */#define SCGIODDBG _IO(G, 101) /* Dec Debug Val */#define SCGIOGDBG _IOR(G, 102, int) /* get Debug Val */#define SCGIOSDBG _IOW(G, 103, int) /* set Debug Val */#define SCIOGDBG _IOR(G, 104, int) /* get sc Debug Val*/#define SCIOSDBG _IOW(G, 105, int) /* set sc Debug Val*/#endif#define SCGIO_CMD SCGIOCMD /* backward ccompatibility */#endif /* _SCGIO_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -