⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scsi3.h

📁 优龙2410linux2.6.8内核源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
#define SCSI_MAX_SENSE_BYTES  255#define SCSI_STD_SENSE_BYTES   18#define SCSI_PAD_SENSE_BYTES      (SCSI_MAX_SENSE_BYTES - SCSI_STD_SENSE_BYTES)#undef USE_SCSI_COMPLETE_SENSE/* *      Structure definition for SCSI Sense Data * *  NOTE: The following structure is 255 bytes in size *      iiff USE_SCSI_COMPLETE_SENSE IS defined above (i.e. w/ "#define"). *      If USE_SCSI_COMPLETE_SENSE is NOT defined above (i.e. w/ "#undef") *      then the following structure is only 19 bytes in size. *  THE CHOICE IS YOURS! * */typedef struct SCSI_Sense_Data{#ifdef USE_SCSI_COMPLETE_SENSE    u8       SenseByte[SCSI_MAX_SENSE_BYTES];#else    u8       SenseByte[SCSI_STD_SENSE_BYTES];#endif/* * the following structure works only for little-endian (Intel, * LSB first (1234) byte order) systems with 4-byte ints. *    u8     Error_Code                :4,            // 0x00           Error_Class               :3,           Valid                     :1     ;    u8     Segment_Number                           // 0x01     ;    u8     Sense_Key                 :4,            // 0x02           Reserved                  :1,           Incorrect_Length_Indicator:1,           End_Of_Media              :1,           Filemark                  :1     ;    u8     Information_MSB;                         // 0x03    u8     Information_Byte2;                       // 0x04    u8     Information_Byte1;                       // 0x05    u8     Information_LSB;                         // 0x06    u8     Additional_Length;                       // 0x07    u32    Command_Specific_Information;            // 0x08 - 0x0b    u8     Additional_Sense_Code;                   // 0x0c    u8     Additional_Sense_Code_Qualifier;         // 0x0d    u8     Field_Replaceable_Unit_Code;             // 0x0e    u8     Illegal_Req_Bit_Pointer   :3,            // 0x0f           Illegal_Req_Bit_Valid     :1,           Illegal_Req_Reserved      :2,           Illegal_Req_Cmd_Data      :1,           Sense_Key_Specific_Valid  :1     ;    u16    Sense_Key_Specific_Data;                 // 0x10 - 0x11#ifdef USE_SCSI_COMPLETE_SENSE    u8     Additional_Sense_Data[SCSI_PAD_SENSE_BYTES];#else    u8     Additional_Sense_Data[1];#endif * */} SCSI_Sense_Data_t;#define SD_ERRCODE_BYTE                0#define   SD_Valid_BIT                   0x80#define   SD_Error_Code_MASK             0x7f#define SD_Valid(sdp) \    (int)(*((u8*)(sdp)+SD_ERRCODE_BYTE) & SD_Valid_BIT)#define SD_Error_Code(sdp) \    (int)(*((u8*)(sdp)+SD_ERRCODE_BYTE) & SD_Error_Code_MASK)#define SD_SEGNUM_BYTE                 1#define SD_Segment_Number(sdp)  (int)(*((u8*)(sdp)+SD_SEGNUM_BYTE))#define SD_SENSEKEY_BYTE               2#define   SD_Filemark_BIT                0x80#define   SD_EOM_BIT                     0x40#define   SD_ILI_BIT                     0x20#define   SD_Sense_Key_MASK              0x0f#define SD_Filemark(sdp) \    (int)(*((u8*)(sdp)+SD_SENSEKEY_BYTE) & SD_Filemark_BIT)#define SD_EOM(sdp) \    (int)(*((u8*)(sdp)+SD_SENSEKEY_BYTE) & SD_EOM_BIT)#define SD_ILI(sdp) \    (int)(*((u8*)(sdp)+SD_SENSEKEY_BYTE) & SD_ILI_BIT)#define SD_Sense_Key(sdp) \    (int)(*((u8*)(sdp)+SD_SENSEKEY_BYTE) & SD_Sense_Key_MASK)#define SD_INFO3_BYTE                  3#define SD_INFO2_BYTE                  4#define SD_INFO1_BYTE                  5#define SD_INFO0_BYTE                  6#define SD_Information3(sdp)  (int)(*((u8*)(sdp)+SD_INFO3_BYTE))#define SD_Information2(sdp)  (int)(*((u8*)(sdp)+SD_INFO2_BYTE))#define SD_Information1(sdp)  (int)(*((u8*)(sdp)+SD_INFO1_BYTE))#define SD_Information0(sdp)  (int)(*((u8*)(sdp)+SD_INFO0_BYTE))#define SD_ADDL_LEN_BYTE               7#define SD_Additional_Sense_Length(sdp) \    (int)(*((u8*)(sdp)+SD_ADDL_LEN_BYTE))#define SD_Addl_Sense_Len  SD_Additional_Sense_Length#define SD_CMD_SPECIFIC3_BYTE          8#define SD_CMD_SPECIFIC2_BYTE          9#define SD_CMD_SPECIFIC1_BYTE         10#define SD_CMD_SPECIFIC0_BYTE         11#define SD_Cmd_Specific_Info3(sdp)  (int)(*((u8*)(sdp)+SD_CMD_SPECIFIC3_BYTE))#define SD_Cmd_Specific_Info2(sdp)  (int)(*((u8*)(sdp)+SD_CMD_SPECIFIC2_BYTE))#define SD_Cmd_Specific_Info1(sdp)  (int)(*((u8*)(sdp)+SD_CMD_SPECIFIC1_BYTE))#define SD_Cmd_Specific_Info0(sdp)  (int)(*((u8*)(sdp)+SD_CMD_SPECIFIC0_BYTE))#define SD_ADDL_SENSE_CODE_BYTE       12#define SD_Additional_Sense_Code(sdp) \    (int)(*((u8*)(sdp)+SD_ADDL_SENSE_CODE_BYTE))#define SD_Addl_Sense_Code  SD_Additional_Sense_Code#define SD_ASC  SD_Additional_Sense_Code#define SD_ADDL_SENSE_CODE_QUAL_BYTE  13#define SD_Additional_Sense_Code_Qualifier(sdp) \    (int)(*((u8*)(sdp)+SD_ADDL_SENSE_CODE_QUAL_BYTE))#define SD_Addl_Sense_Code_Qual  SD_Additional_Sense_Code_Qualifier#define SD_ASCQ  SD_Additional_Sense_Code_Qualifier#define SD_FIELD_REPL_UNIT_CODE_BYTE  14#define SD_Field_Replaceable_Unit_Code(sdp) \    (int)(*((u8*)(sdp)+SD_FIELD_REPL_UNIT_CODE_BYTE))#define SD_Field_Repl_Unit_Code  SD_Field_Replaceable_Unit_Code#define SD_FRUC  SD_Field_Replaceable_Unit_Code#define SD_FRU  SD_Field_Replaceable_Unit_Code/* *  Sense-Key Specific offsets and macros. */#define SD_SKS2_BYTE                  15#define   SD_SKS_Valid_BIT               0x80#define   SD_SKS_Cmd_Data_BIT            0x40#define   SD_SKS_Bit_Ptr_Valid_BIT       0x08#define   SD_SKS_Bit_Ptr_MASK            0x07#define SD_SKS1_BYTE                  16#define SD_SKS0_BYTE                  17#define SD_Sense_Key_Specific_Valid(sdp) \    (int)(*((u8*)(sdp)+SD_SKS2_BYTE) & SD_SKS_Valid_BIT)#define SD_SKS_Valid  SD_Sense_Key_Specific_Valid#define SD_SKS_CDB_Error(sdp)  \    (int)(*((u8*)(sdp)+SD_SKS2_BYTE) & SD_SKS_Cmd_Data_BIT)#define SD_Was_Illegal_Request  SD_SKS_CDB_Error#define SD_SKS_Bit_Pointer_Valid(sdp)  \    (int)(*((u8*)(sdp)+SD_SKS2_BYTE) & SD_SKS_Bit_Ptr_Valid_BIT)#define SD_SKS_Bit_Pointer(sdp)  \    (int)(*((u8*)(sdp)+SD_SKS2_BYTE) & SD_SKS_Bit_Ptr_MASK)#define SD_Field_Pointer(sdp)  \    (int)( ((u16)(*((u8*)(sdp)+SD_SKS1_BYTE)) << 8) \      + *((u8*)(sdp)+SD_SKS0_BYTE) )#define SD_Bad_Byte  SD_Field_Pointer#define SD_Actual_Retry_Count  SD_Field_Pointer#define SD_Progress_Indication  SD_Field_Pointer/* *  Mode Sense Write Protect Mask */#define WRITE_PROTECT_MASK      0X80/* *  Medium Type Codes */#define OPTICAL_DEFAULT                 0x00#define OPTICAL_READ_ONLY_MEDIUM        0x01#define OPTICAL_WRITE_ONCE_MEDIUM       0x02#define OPTICAL_READ_WRITABLE_MEDIUM    0x03#define OPTICAL_RO_OR_WO_MEDIUM         0x04#define OPTICAL_RO_OR_RW_MEDIUM         0x05#define OPTICAL_WO_OR_RW_MEDIUM         0x06/* *    Structure definition for READ6, WRITE6 (6-byte CDB) */typedef struct SCSI_RW6_CDB{    u32    OpCode      :8,           LBA_HI      :5,    /* 5 MSBit's of the LBA */           Lun         :3,           LBA_MID     :8,    /* NOTE: total of 21 bits in LBA */           LBA_LO      :8  ;  /* Max LBA = 0x001fffff          */    u8     BlockCount;    u8     Control;} SCSI_RW6_t;#define MAX_RW6_LBA  ((u32)0x001fffff)/* *  Structure definition for READ10, WRITE10 (10-byte CDB) * *    NOTE: ParityCheck bit is applicable only for VERIFY and WRITE VERIFY for *    the ADP-92 DAC only.  In the SCSI2 spec. this same bit is defined as a *    FUA (forced unit access) bit for READs and WRITEs.  Since this driver *    does not use the FUA, this bit is defined as it is used by the ADP-92. *    Also, for READ CAPACITY, only the OpCode field is used. */typedef struct SCSI_RW10_CDB{    u8     OpCode;    u8     Reserved1;    u32    LBA;    u8     Reserved2;    u16    BlockCount;    u8     Control;} SCSI_RW10_t;#define PARITY_CHECK  0x08    /* parity check bit - byte[1], bit 3 */    /*     *  Structure definition for data returned by READ CAPACITY cmd;     *  READ CAPACITY data     */    typedef struct READ_CAP_DATA    {        u32    MaxLBA;        u32    BlockBytes;    } SCSI_READ_CAP_DATA_t, *pSCSI_READ_CAP_DATA_t;/* *  Structure definition for FORMAT UNIT CDB (6-byte CDB) */typedef struct _SCSI_FORMAT_UNIT{    u8     OpCode;    u8     Reserved1;    u8     VendorSpecific;    u16    Interleave;    u8     Control;} SCSI_FORMAT_UNIT_t;/* *    Structure definition for REQUEST SENSE (6-byte CDB) */typedef struct _SCSI_REQUEST_SENSE{    u8     OpCode;    u8     Reserved1;    u8     Reserved2;    u8     Reserved3;    u8     AllocLength;    u8     Control;} SCSI_REQ_SENSE_t;/* *  Structure definition for REPORT LUNS (12-byte CDB) */typedef struct _SCSI_REPORT_LUNS{    u8     OpCode;    u8     Reserved1[5];    u32    AllocationLength;    u8     Reserved2;    u8     Control;} SCSI_REPORT_LUNS_t, *pSCSI_REPORT_LUNS_t;    /*     *  (per-level) LUN information bytes     *//* *  Following doesn't work on ARMCC compiler *  [apparently] because it pads every struct *  to be multiple of 4 bytes! *  So SCSI_LUN_LEVELS_t winds up being 16 *  bytes instead of 8! *    typedef struct LUN_INFO    {        u8     AddrMethod_plus_LunOrBusNumber;        u8     LunOrTarget;    } SCSI_LUN_INFO_t, *pSCSI_LUN_INFO_t;    typedef struct LUN_LEVELS    {        SCSI_LUN_INFO_t  LUN_0;        SCSI_LUN_INFO_t  LUN_1;        SCSI_LUN_INFO_t  LUN_2;        SCSI_LUN_INFO_t  LUN_3;    } SCSI_LUN_LEVELS_t, *pSCSI_LUN_LEVELS_t;*/    /*     *  All 4 levels (8 bytes) of LUN information     */    typedef struct LUN_LEVELS    {        u8     LVL1_AddrMethod_plus_LunOrBusNumber;        u8     LVL1_LunOrTarget;        u8     LVL2_AddrMethod_plus_LunOrBusNumber;        u8     LVL2_LunOrTarget;        u8     LVL3_AddrMethod_plus_LunOrBusNumber;        u8     LVL3_LunOrTarget;        u8     LVL4_AddrMethod_plus_LunOrBusNumber;        u8     LVL4_LunOrTarget;    } SCSI_LUN_LEVELS_t, *pSCSI_LUN_LEVELS_t;    /*     *  Structure definition for data returned by REPORT LUNS cmd;     *  LUN reporting parameter list format     */    typedef struct LUN_REPORT    {        u32                LunListLength;        u32                Reserved;        SCSI_LUN_LEVELS_t  LunInfo[1];    } SCSI_LUN_REPORT_t, *pSCSI_LUN_REPORT_t;/**************************************************************************** * *  Externals *//**************************************************************************** * *  Public Typedefs & Related Defines *//**************************************************************************** * *  Macros (embedded, above) *//**************************************************************************** * *  Public Variables *//**************************************************************************** * *  Public Prototypes (module entry points) *//***************************************************************************/#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -