2 * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
6 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License (GPL) Version 2 as
10 * published by the Free Software Foundation
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
21 #include <protocol/types.h>
26 * generic SCSI cdb definition
28 #define SCSI_MAX_CDBLEN 16
30 u8 scsi_cdb
[SCSI_MAX_CDBLEN
];
34 * scsi lun serial number definition
36 #define SCSI_LUN_SN_LEN 32
38 u8 lun_sn
[SCSI_LUN_SN_LEN
];
42 * SCSI Direct Access Commands
45 SCSI_OP_TEST_UNIT_READY
= 0x00,
46 SCSI_OP_REQUEST_SENSE
= 0x03,
47 SCSI_OP_FORMAT_UNIT
= 0x04,
49 SCSI_OP_WRITE6
= 0x0A,
50 SCSI_OP_WRITE_FILEMARKS
= 0x10,
51 SCSI_OP_INQUIRY
= 0x12,
52 SCSI_OP_MODE_SELECT6
= 0x15,
53 SCSI_OP_RESERVE6
= 0x16,
54 SCSI_OP_RELEASE6
= 0x17,
55 SCSI_OP_MODE_SENSE6
= 0x1A,
56 SCSI_OP_START_STOP_UNIT
= 0x1B,
57 SCSI_OP_SEND_DIAGNOSTIC
= 0x1D,
58 SCSI_OP_READ_CAPACITY
= 0x25,
59 SCSI_OP_READ10
= 0x28,
60 SCSI_OP_WRITE10
= 0x2A,
61 SCSI_OP_VERIFY10
= 0x2F,
62 SCSI_OP_READ_DEFECT_DATA
= 0x37,
63 SCSI_OP_LOG_SELECT
= 0x4C,
64 SCSI_OP_LOG_SENSE
= 0x4D,
65 SCSI_OP_MODE_SELECT10
= 0x55,
66 SCSI_OP_RESERVE10
= 0x56,
67 SCSI_OP_RELEASE10
= 0x57,
68 SCSI_OP_MODE_SENSE10
= 0x5A,
69 SCSI_OP_PER_RESERVE_IN
= 0x5E,
70 SCSI_OP_PER_RESERVE_OUR
= 0x5E,
71 SCSI_OP_READ16
= 0x88,
72 SCSI_OP_WRITE16
= 0x8A,
73 SCSI_OP_VERIFY16
= 0x8F,
74 SCSI_OP_READ_CAPACITY16
= 0x9E,
75 SCSI_OP_REPORT_LUNS
= 0xA0,
76 SCSI_OP_READ12
= 0xA8,
77 SCSI_OP_WRITE12
= 0xAA,
82 * SCSI START_STOP_UNIT command
84 struct scsi_start_stop_unit_s
{
98 u8 power_conditions
:4;
106 u8 power_conditions
:4;
112 * SCSI SEND_DIAGNOSTIC command
114 struct scsi_send_diagnostic_s
{
133 u8 param_list_length
[2]; /* MSB first */
139 * SCSI READ10/WRITE10 commands
145 u8 dpo
:1; /* Disable Page Out */
146 u8 fua
:1; /* Force Unit Access */
148 u8 rel_adr
:1; /* relative address */
156 u8 lba0
; /* logical block address - MSB */
161 u8 xfer_length0
; /* transfer length in blocks - MSB */
162 u8 xfer_length1
; /* LSB */
166 #define SCSI_CDB10_GET_LBA(cdb) \
167 (((cdb)->lba0 << 24) | ((cdb)->lba1 << 16) | \
168 ((cdb)->lba2 << 8) | (cdb)->lba3)
170 #define SCSI_CDB10_SET_LBA(cdb, lba) { \
171 (cdb)->lba0 = lba >> 24; \
172 (cdb)->lba1 = (lba >> 16) & 0xFF; \
173 (cdb)->lba2 = (lba >> 8) & 0xFF; \
174 (cdb)->lba3 = lba & 0xFF; \
177 #define SCSI_CDB10_GET_TL(cdb) \
178 ((cdb)->xfer_length0 << 8 | (cdb)->xfer_length1)
179 #define SCSI_CDB10_SET_TL(cdb, tl) { \
180 (cdb)->xfer_length0 = tl >> 8; \
181 (cdb)->xfer_length1 = tl & 0xFF; \
185 * SCSI READ6/WRITE6 commands
202 #define SCSI_TAPE_CDB6_GET_TL(cdb) \
203 (((cdb)->tl0 << 16) | ((cdb)->tl1 << 8) | (cdb)->tl2)
205 #define SCSI_TAPE_CDB6_SET_TL(cdb, tl) { \
206 (cdb)->tl0 = tl >> 16; \
207 (cdb)->tl1 = (tl >> 8) & 0xFF; \
208 (cdb)->tl2 = tl & 0xFF; \
212 * SCSI sequential (TAPE) wrtie command
214 struct scsi_tape_wr_s
{
218 u8 fixed
:1; /* MSb */
220 u8 fixed
:1; /* MSb */
230 #define SCSI_CDB6_GET_LBA(cdb) \
231 (((cdb)->lba0 << 16) | ((cdb)->lba1 << 8) | (cdb)->lba2)
233 #define SCSI_CDB6_SET_LBA(cdb, lba) { \
234 (cdb)->lba0 = lba >> 16; \
235 (cdb)->lba1 = (lba >> 8) & 0xFF; \
236 (cdb)->lba2 = lba & 0xFF; \
239 #define SCSI_CDB6_GET_TL(cdb) ((cdb)->xfer_length)
240 #define SCSI_CDB6_SET_TL(cdb, tl) { \
241 (cdb)->xfer_length = tl; \
245 * SCSI sense data format
258 u8 eom
:1; /* end of media */
259 u8 ili
:1; /* incorrect length indicator */
265 u8 ili
:1; /* incorrect length indicator */
266 u8 eom
:1; /* end of media */
269 u8 information
[4]; /* device-type or command specific info
272 /* additional sense length */
273 u8 command_info
[4];/* command specific information
275 u8 asc
; /* additional sense code */
276 u8 ascq
; /* additional sense code qualifier */
277 u8 fru_code
; /* field replaceable unit code */
279 u8 sksv
:1; /* sense key specific valid */
280 u8 c_d
:1; /* command/data bit */
282 u8 bpv
:1; /* bit pointer valid */
283 u8 bpointer
:3; /* bit pointer */
285 u8 bpointer
:3; /* bit pointer */
286 u8 bpv
:1; /* bit pointer valid */
288 u8 c_d
:1; /* command/data bit */
289 u8 sksv
:1; /* sense key specific valid */
291 u8 fpointer
[2]; /* field pointer */
294 #define SCSI_SENSE_CUR_ERR 0x70
295 #define SCSI_SENSE_DEF_ERR 0x71
298 * SCSI sense key values
300 #define SCSI_SK_NO_SENSE 0x0
301 #define SCSI_SK_REC_ERR 0x1 /* recovered error */
302 #define SCSI_SK_NOT_READY 0x2
303 #define SCSI_SK_MED_ERR 0x3 /* medium error */
304 #define SCSI_SK_HW_ERR 0x4 /* hardware error */
305 #define SCSI_SK_ILLEGAL_REQ 0x5
306 #define SCSI_SK_UNIT_ATT 0x6 /* unit attention */
307 #define SCSI_SK_DATA_PROTECT 0x7
308 #define SCSI_SK_BLANK_CHECK 0x8
309 #define SCSI_SK_VENDOR_SPEC 0x9
310 #define SCSI_SK_COPY_ABORTED 0xA
311 #define SCSI_SK_ABORTED_CMND 0xB
312 #define SCSI_SK_VOL_OVERFLOW 0xD
313 #define SCSI_SK_MISCOMPARE 0xE
316 * SCSI additional sense codes
318 #define SCSI_ASC_NO_ADD_SENSE 0x00
319 #define SCSI_ASC_LUN_NOT_READY 0x04
320 #define SCSI_ASC_LUN_COMMUNICATION 0x08
321 #define SCSI_ASC_WRITE_ERROR 0x0C
322 #define SCSI_ASC_INVALID_CMND_CODE 0x20
323 #define SCSI_ASC_BAD_LBA 0x21
324 #define SCSI_ASC_INVALID_FIELD_IN_CDB 0x24
325 #define SCSI_ASC_LUN_NOT_SUPPORTED 0x25
326 #define SCSI_ASC_LUN_WRITE_PROTECT 0x27
327 #define SCSI_ASC_POWERON_BDR 0x29 /* power on reset, bus reset,
330 #define SCSI_ASC_PARAMS_CHANGED 0x2A
331 #define SCSI_ASC_CMND_CLEARED_BY_A_I 0x2F
332 #define SCSI_ASC_SAVING_PARAM_NOTSUPP 0x39
333 #define SCSI_ASC_TOCC 0x3F /* target operating condtions
336 #define SCSI_ASC_PARITY_ERROR 0x47
337 #define SCSI_ASC_CMND_PHASE_ERROR 0x4A
338 #define SCSI_ASC_DATA_PHASE_ERROR 0x4B
339 #define SCSI_ASC_VENDOR_SPEC 0x7F
342 * SCSI additional sense code qualifiers
344 #define SCSI_ASCQ_CAUSE_NOT_REPORT 0x00
345 #define SCSI_ASCQ_BECOMING_READY 0x01
346 #define SCSI_ASCQ_INIT_CMD_REQ 0x02
347 #define SCSI_ASCQ_FORMAT_IN_PROGRESS 0x04
348 #define SCSI_ASCQ_OPERATION_IN_PROGRESS 0x07
349 #define SCSI_ASCQ_SELF_TEST_IN_PROGRESS 0x09
350 #define SCSI_ASCQ_WR_UNEXP_UNSOL_DATA 0x0C
351 #define SCSI_ASCQ_WR_NOTENG_UNSOL_DATA 0x0D
353 #define SCSI_ASCQ_LBA_OUT_OF_RANGE 0x00
354 #define SCSI_ASCQ_INVALID_ELEMENT_ADDR 0x01
356 #define SCSI_ASCQ_LUN_WRITE_PROTECTED 0x00
357 #define SCSI_ASCQ_LUN_HW_WRITE_PROTECTED 0x01
358 #define SCSI_ASCQ_LUN_SW_WRITE_PROTECTED 0x02
360 #define SCSI_ASCQ_POR 0x01 /* power on reset */
361 #define SCSI_ASCQ_SBR 0x02 /* scsi bus reset */
362 #define SCSI_ASCQ_BDR 0x03 /* bus device reset */
363 #define SCSI_ASCQ_DIR 0x04 /* device internal reset */
365 #define SCSI_ASCQ_MODE_PARAMS_CHANGED 0x01
366 #define SCSI_ASCQ_LOG_PARAMS_CHANGED 0x02
367 #define SCSI_ASCQ_RESERVATIONS_PREEMPTED 0x03
368 #define SCSI_ASCQ_RESERVATIONS_RELEASED 0x04
369 #define SCSI_ASCQ_REGISTRATIONS_PREEMPTED 0x05
371 #define SCSI_ASCQ_MICROCODE_CHANGED 0x01
372 #define SCSI_ASCQ_CHANGED_OPER_COND 0x02
373 #define SCSI_ASCQ_INQ_CHANGED 0x03 /* inquiry data changed */
374 #define SCSI_ASCQ_DI_CHANGED 0x05 /* device id changed */
375 #define SCSI_ASCQ_RL_DATA_CHANGED 0x0E /* report luns data changed */
377 #define SCSI_ASCQ_DP_CRC_ERR 0x01 /* data phase crc error */
378 #define SCSI_ASCQ_DP_SCSI_PARITY_ERR 0x02 /* data phase scsi parity error
380 #define SCSI_ASCQ_IU_CRC_ERR 0x03 /* information unit crc error */
381 #define SCSI_ASCQ_PROTO_SERV_CRC_ERR 0x05
383 #define SCSI_ASCQ_LUN_TIME_OUT 0x01
385 /* ------------------------------------------------------------
387 * ------------------------------------------------------------*/
389 struct scsi_inquiry_s
{
408 struct scsi_inquiry_vendor_s
{
412 struct scsi_inquiry_prodid_s
{
416 struct scsi_inquiry_prodrev_s
{
420 struct scsi_inquiry_data_s
{
422 u8 peripheral_qual
:3; /* peripheral qualifier */
423 u8 device_type
:5; /* peripheral device type */
425 u8 rmb
:1; /* removable medium bit */
426 u8 device_type_mod
:7; /* device type modifier */
430 u8 aenc
:1; /* async event notification capability
432 u8 trm_iop
:1; /* terminate I/O process */
433 u8 norm_aca
:1; /* normal ACA supported */
434 u8 hi_support
:1; /* SCSI-3: supports REPORT LUNS */
435 u8 rsp_data_format
:4;
442 u8 enc_serv
:1; /* enclosure service component */
444 u8 multi_port
:1; /* multi-port device */
445 u8 m_chngr
:1; /* device in medium transport element */
446 u8 ack_req_q
:1; /* SIP specific bit */
447 u8 addr32
:1; /* SIP specific bit */
448 u8 addr16
:1; /* SIP specific bit */
450 u8 rel_adr
:1; /* relative address */
454 u8 linked_commands
:1;
456 u8 cmd_queue
:1; /* command queueing supported */
457 u8 soft_reset
:1; /* soft reset alternative (VS) */
459 u8 device_type
:5; /* peripheral device type */
460 u8 peripheral_qual
:3;
461 /* peripheral qualifier */
463 u8 device_type_mod
:7;
464 /* device type modifier */
465 u8 rmb
:1; /* removable medium bit */
469 u8 rsp_data_format
:4;
470 u8 hi_support
:1; /* SCSI-3: supports REPORT LUNS */
471 u8 norm_aca
:1; /* normal ACA supported */
472 u8 terminate_iop
:1;/* terminate I/O process */
473 u8 aenc
:1; /* async event notification capability
480 u8 addr16
:1; /* SIP specific bit */
481 u8 addr32
:1; /* SIP specific bit */
482 u8 ack_req_q
:1; /* SIP specific bit */
483 u8 m_chngr
:1; /* device in medium transport element */
484 u8 multi_port
:1; /* multi-port device */
485 u8 reserved3
:1; /* TBD - Vendor Specific */
486 u8 enc_serv
:1; /* enclosure service component */
489 u8 soft_seset
:1; /* soft reset alternative (VS) */
490 u8 cmd_queue
:1; /* command queueing supported */
492 u8 linked_commands
:1;
496 u8 rel_adr
:1; /* relative address */
498 struct scsi_inquiry_vendor_s vendor_id
;
499 struct scsi_inquiry_prodid_s product_id
;
500 struct scsi_inquiry_prodrev_s product_rev
;
501 u8 vendor_specific
[20];
506 * inquiry.peripheral_qual field values
508 #define SCSI_DEVQUAL_DEFAULT 0
509 #define SCSI_DEVQUAL_NOT_CONNECTED 1
510 #define SCSI_DEVQUAL_NOT_SUPPORTED 3
513 * inquiry.device_type field values
515 #define SCSI_DEVICE_DIRECT_ACCESS 0x00
516 #define SCSI_DEVICE_SEQ_ACCESS 0x01
517 #define SCSI_DEVICE_ARRAY_CONTROLLER 0x0C
518 #define SCSI_DEVICE_UNKNOWN 0x1F
523 #define SCSI_VERSION_ANSI_X3131 2 /* ANSI X3.131 SCSI-2 */
524 #define SCSI_VERSION_SPC 3 /* SPC (SCSI-3), ANSI X3.301:1997 */
525 #define SCSI_VERSION_SPC_2 4 /* SPC-2 */
528 * response data format
530 #define SCSI_RSP_DATA_FORMAT 2 /* SCSI-2 & SPC */
533 * SCSI inquiry page codes
535 #define SCSI_INQ_PAGE_VPD_PAGES 0x00 /* supported vpd pages */
536 #define SCSI_INQ_PAGE_USN_PAGE 0x80 /* unit serial number page */
537 #define SCSI_INQ_PAGE_DEV_IDENT 0x83 /* device indentification page
539 #define SCSI_INQ_PAGES_MAX 3
542 * supported vital product data pages
544 struct scsi_inq_page_vpd_pages_s
{
546 u8 peripheral_qual
:3;
550 u8 peripheral_qual
:3;
555 u8 pages
[SCSI_INQ_PAGES_MAX
];
559 * Unit serial number page
561 #define SCSI_INQ_USN_LEN 32
563 struct scsi_inq_usn_s
{
564 char usn
[SCSI_INQ_USN_LEN
];
567 struct scsi_inq_page_usn_s
{
569 u8 peripheral_qual
:3;
573 u8 peripheral_qual
:3;
578 struct scsi_inq_usn_s usn
;
582 SCSI_INQ_DIP_CODE_BINARY
= 1, /* identifier has binary value */
583 SCSI_INQ_DIP_CODE_ASCII
= 2, /* identifier has ascii value */
587 SCSI_INQ_DIP_ASSOC_LUN
= 0, /* id is associated with device */
588 SCSI_INQ_DIP_ASSOC_PORT
= 1, /* id is associated with port that
589 * received the request
594 SCSI_INQ_ID_TYPE_VENDOR
= 1,
595 SCSI_INQ_ID_TYPE_IEEE
= 2,
596 SCSI_INQ_ID_TYPE_FC_FS
= 3,
597 SCSI_INQ_ID_TYPE_OTHER
= 4,
600 struct scsi_inq_dip_desc_s
{
616 struct scsi_lun_sn_s id
;
620 * Device indentification page
622 struct scsi_inq_page_dev_ident_s
{
624 u8 peripheral_qual
:3;
628 u8 peripheral_qual
:3;
633 struct scsi_inq_dip_desc_s desc
;
636 /* ------------------------------------------------------------
638 * ------------------------------------------------------------
641 struct scsi_read_capacity_s
{
660 u8 pmi
:1; /* partial medium indicator */
662 u8 pmi
:1; /* partial medium indicator */
668 struct scsi_read_capacity_data_s
{
669 u32 max_lba
; /* maximum LBA available */
670 u32 block_length
; /* in bytes */
673 struct scsi_read_capacity16_data_s
{
674 u64 lba
; /* maximum LBA available */
675 u32 block_length
; /* in bytes */
681 lb_pbe
:4; /* logical blocks per physical block
684 lba_align
:14; /* lowest aligned logical block
687 u16 lba_align
:14, /* lowest aligned logical block
690 u8 lb_pbe
:4, /* logical blocks per physical block
701 /* ------------------------------------------------------------
702 * REPORT LUNS command
703 * ------------------------------------------------------------
706 struct scsi_report_luns_s
{
707 u8 opcode
; /* A0h - REPORT LUNS opCode */
709 u8 alloc_length
[4];/* allocation length MSB first */
714 #define SCSI_REPORT_LUN_ALLOC_LENGTH(rl) \
715 ((rl->alloc_length[0] << 24) | (rl->alloc_length[1] << 16) | \
716 (rl->alloc_length[2] << 8) | (rl->alloc_length[3]))
718 #define SCSI_REPORT_LUNS_SET_ALLOCLEN(rl, alloc_len) { \
719 (rl)->alloc_length[0] = (alloc_len) >> 24; \
720 (rl)->alloc_length[1] = ((alloc_len) >> 16) & 0xFF; \
721 (rl)->alloc_length[2] = ((alloc_len) >> 8) & 0xFF; \
722 (rl)->alloc_length[3] = (alloc_len) & 0xFF; \
725 struct scsi_report_luns_data_s
{
726 u32 lun_list_length
; /* length of LUN list length */
728 lun_t lun
[1]; /* first LUN in lun list */
731 /* -------------------------------------------------------------
732 * SCSI mode parameters
733 * -----------------------------------------------------------
736 SCSI_DA_MEDIUM_DEF
= 0, /* direct access default medium type */
737 SCSI_DA_MEDIUM_SS
= 1, /* direct access single sided */
738 SCSI_DA_MEDIUM_DS
= 2, /* direct access double sided */
742 * SCSI Mode Select(6) cdb
744 struct scsi_mode_select6_s
{
748 u8 pf
:1; /* page format */
750 u8 sp
:1; /* save pages if set to 1 */
752 u8 sp
:1; /* save pages if set to 1 */
754 u8 pf
:1; /* page format */
763 * SCSI Mode Select(10) cdb
765 struct scsi_mode_select10_s
{
769 u8 pf
:1; /* page format */
771 u8 sp
:1; /* save pages if set to 1 */
773 u8 sp
:1; /* save pages if set to 1 */
775 u8 pf
:1; /* page format */
785 * SCSI Mode Sense(6) cdb
787 struct scsi_mode_sense6_s
{
791 u8 dbd
:1; /* disable block discriptors if set to 1 */
794 u8 pc
:2; /* page control */
798 u8 dbd
:1; /* disable block descriptors if set to 1 */
802 u8 pc
:2; /* page control */
810 * SCSI Mode Sense(10) cdb
812 struct scsi_mode_sense10_s
{
816 u8 LLBAA
:1; /* long LBA accepted if set to 1 */
817 u8 dbd
:1; /* disable block descriptors if set
822 u8 pc
:2; /* page control */
826 u8 dbd
:1; /* disable block descriptors if set to
829 u8 LLBAA
:1; /* long LBA accepted if set to 1 */
833 u8 pc
:2; /* page control */
841 #define SCSI_CDB10_GET_AL(cdb) \
842 ((cdb)->alloc_len_msb << 8 | (cdb)->alloc_len_lsb)
844 #define SCSI_CDB10_SET_AL(cdb, al) { \
845 (cdb)->alloc_len_msb = al >> 8; \
846 (cdb)->alloc_len_lsb = al & 0xFF; \
849 #define SCSI_CDB6_GET_AL(cdb) ((cdb)->alloc_len)
851 #define SCSI_CDB6_SET_AL(cdb, al) { \
852 (cdb)->alloc_len = al; \
856 * page control field values
858 #define SCSI_PC_CURRENT_VALUES 0x0
859 #define SCSI_PC_CHANGEABLE_VALUES 0x1
860 #define SCSI_PC_DEFAULT_VALUES 0x2
861 #define SCSI_PC_SAVED_VALUES 0x3
864 * SCSI mode page codes
866 #define SCSI_MP_VENDOR_SPEC 0x00
867 #define SCSI_MP_DISC_RECN 0x02 /* disconnect-reconnect page */
868 #define SCSI_MP_FORMAT_DEVICE 0x03
869 #define SCSI_MP_RDG 0x04 /* rigid disk geometry page */
870 #define SCSI_MP_FDP 0x05 /* flexible disk page */
871 #define SCSI_MP_CACHING 0x08 /* caching page */
872 #define SCSI_MP_CONTROL 0x0A /* control mode page */
873 #define SCSI_MP_MED_TYPES_SUP 0x0B /* medium types supported page */
874 #define SCSI_MP_INFO_EXCP_CNTL 0x1C /* informational exception control */
875 #define SCSI_MP_ALL 0x3F /* return all pages - mode sense only */
878 * mode parameter header
880 struct scsi_mode_param_header6_s
{
885 * device specific parameters expanded for direct access devices
888 u32 wp
:1; /* write protected */
890 u32 dpofua
:1; /* disable page out + force unit access
895 u32 dpofua
:1; /* disable page out + force unit access
898 u32 wp
:1; /* write protected */
904 struct scsi_mode_param_header10_s
{
909 * device specific parameters expanded for direct access devices
912 u32 wp
:1; /* write protected */
914 u32 dpofua
:1; /* disable page out + force unit access
919 u32 dpofua
:1; /* disable page out + force unit access
922 u32 wp
:1; /* write protected */
933 u32 block_desclen
:16;
937 * mode parameter block descriptor
939 struct scsi_mode_param_desc_s
{
946 * Disconnect-reconnect mode page format
948 struct scsi_mp_disc_recn_s
{
962 u8 bil_msb
; /* bus inactivity limit -MSB */
963 u8 bil_lsb
; /* bus inactivity limit -LSB */
965 u8 dtl_msb
; /* disconnect time limit - MSB */
966 u8 dtl_lsb
; /* disconnect time limit - LSB */
968 u8 ctl_msb
; /* connect time limit - MSB */
969 u8 ctl_lsb
; /* connect time limit - LSB */
971 u8 max_burst_len_msb
;
972 u8 max_burst_len_lsb
;
974 u8 emdp
:1; /* enable modify data pointers */
975 u8 fa
:3; /* fair arbitration */
976 u8 dimm
:1; /* disconnect immediate */
977 u8 dtdc
:3; /* data transfer disconnect control */
979 u8 dtdc
:3; /* data transfer disconnect control */
980 u8 dimm
:1; /* disconnect immediate */
981 u8 fa
:3; /* fair arbitration */
982 u8 emdp
:1; /* enable modify data pointers */
987 u8 first_burst_len_msb
;
988 u8 first_burst_len_lsb
;
992 * SCSI format device mode page
994 struct scsi_mp_format_device_s
{
1005 u32 tracks_per_zone
:16;
1007 u32 a_sec_per_zone
:16;
1008 u32 a_tracks_per_zone
:16;
1010 u32 a_tracks_per_lun
:16; /* alternate tracks/lun-MSB */
1011 u32 sec_per_track
:16; /* sectors/track-MSB */
1013 u32 bytes_per_sector
:16;
1016 u32 tsf
:16; /* track skew factor-MSB */
1017 u32 csf
:16; /* cylinder skew factor-MSB */
1020 u32 ssec
:1; /* soft sector formatting */
1021 u32 hsec
:1; /* hard sector formatting */
1022 u32 rmb
:1; /* removable media */
1023 u32 surf
:1; /* surface */
1027 u32 surf
:1; /* surface */
1028 u32 rmb
:1; /* removable media */
1029 u32 hsec
:1; /* hard sector formatting */
1030 u32 ssec
:1; /* soft sector formatting */
1036 * SCSI rigid disk device geometry page
1038 struct scsi_mp_rigid_device_geometry_s
{
1049 u32 num_cylinders0
:8;
1050 u32 num_cylinders1
:8;
1052 u32 num_cylinders2
:8;
1069 u32 rpl
:2; /* rotational position locking */
1071 u32 rpl
:2; /* rotational position locking */
1077 u32 med_rot_rate
:16;
1082 * SCSI caching mode page
1084 struct scsi_mp_caching_s
{
1096 u8 ic
:1; /* initiator control */
1097 u8 abpf
:1; /* abort pre-fetch */
1098 u8 cap
:1; /* caching analysis permitted */
1099 u8 disc
:1; /* discontinuity */
1100 u8 size
:1; /* size enable */
1101 u8 wce
:1; /* write cache enable */
1102 u8 mf
:1; /* multiplication factor */
1103 u8 rcd
:1; /* read cache disable */
1105 u8 drrp
:4; /* demand read retention priority */
1106 u8 wrp
:4; /* write retention priority */
1108 u8 rcd
:1; /* read cache disable */
1109 u8 mf
:1; /* multiplication factor */
1110 u8 wce
:1; /* write cache enable */
1111 u8 size
:1; /* size enable */
1112 u8 disc
:1; /* discontinuity */
1113 u8 cap
:1; /* caching analysis permitted */
1114 u8 abpf
:1; /* abort pre-fetch */
1115 u8 ic
:1; /* initiator control */
1117 u8 wrp
:4; /* write retention priority */
1118 u8 drrp
:4; /* demand read retention priority */
1120 u8 dptl
[2];/* disable pre-fetch transfer length */
1123 u8 max_prefetch_limit
[2];
1125 u8 fsw
:1; /* force sequential write */
1126 u8 lbcss
:1;/* logical block cache segment size */
1127 u8 dra
:1; /* disable read ahead */
1128 u8 vs
:2; /* vendor specific */
1132 u8 vs
:2; /* vendor specific */
1133 u8 dra
:1; /* disable read ahead */
1134 u8 lbcss
:1;/* logical block cache segment size */
1135 u8 fsw
:1; /* force sequential write */
1139 u8 cache_seg_size
[2];
1141 u8 non_cache_seg_size
[3];
1145 * SCSI control mode page
1147 struct scsi_mp_control_page_s
{
1159 u8 tst
:3; /* task set type */
1161 u8 gltsd
:1; /* global logging target save disable */
1162 u8 rlec
:1; /* report log exception condition */
1164 u8 qalgo_mod
:4; /* queue alogorithm modifier */
1166 u8 qerr
:2; /* queue error management */
1167 u8 dque
:1; /* disable queuing */
1170 u8 rac
:1; /* report a check */
1172 u8 swp
:1; /* software write protect */
1173 u8 raerp
:1; /* ready AER permission */
1174 u8 uaaerp
:1; /* unit attenstion AER permission */
1175 u8 eaerp
:1; /* error AER permission */
1180 u8 rlec
:1; /* report log exception condition */
1181 u8 gltsd
:1; /* global logging target save disable */
1183 u8 tst
:3; /* task set type */
1185 u8 dque
:1; /* disable queuing */
1186 u8 qerr
:2; /* queue error management */
1188 u8 qalgo_mod
:4; /* queue alogorithm modifier */
1190 u8 eaerp
:1; /* error AER permission */
1191 u8 uaaerp
:1; /* unit attenstion AER permission */
1192 u8 raerp
:1; /* ready AER permission */
1193 u8 swp
:1; /* software write protect */
1195 u8 rac
:1; /* report a check */
1201 u8 rahp_msb
; /* ready AER holdoff period - MSB */
1202 u8 rahp_lsb
; /* ready AER holdoff period - LSB */
1204 u8 busy_timeout_period_msb
;
1205 u8 busy_timeout_period_lsb
;
1207 u8 ext_selftest_compl_time_msb
;
1208 u8 ext_selftest_compl_time_lsb
;
1212 * SCSI medium types supported mode page
1214 struct scsi_mp_medium_types_sup_s
{
1227 u8 med_type1_sup
; /* medium type one supported */
1228 u8 med_type2_sup
; /* medium type two supported */
1229 u8 med_type3_sup
; /* medium type three supported */
1230 u8 med_type4_sup
; /* medium type four supported */
1234 * SCSI informational exception control mode page
1236 struct scsi_mp_info_excpt_cntl_s
{
1248 u8 perf
:1; /* performance */
1250 u8 ebf
:1; /* enable background fucntion */
1251 u8 ewasc
:1; /* enable warning */
1252 u8 dexcpt
:1; /* disable exception control */
1253 u8 test
:1; /* enable test device failure
1260 u8 mrie
:4; /* method of reporting info
1266 u8 test
:1; /* enable test device failure
1269 u8 dexcpt
:1; /* disable exception control */
1270 u8 ewasc
:1; /* enable warning */
1271 u8 ebf
:1; /* enable background fucntion */
1273 u8 perf
:1; /* performance */
1275 u8 mrie
:4; /* method of reporting info
1280 u8 interval_timer_msb
;
1281 u8 interval_timer_lsb
;
1283 u8 report_count_msb
;
1284 u8 report_count_lsb
;
1288 * Methods of reporting informational exceptions
1290 #define SCSI_MP_IEC_NO_REPORT 0x0 /* no reporting of exceptions */
1291 #define SCSI_MP_IEC_AER 0x1 /* async event reporting */
1292 #define SCSI_MP_IEC_UNIT_ATTN 0x2 /* generate unit attenstion */
1293 #define SCSI_MO_IEC_COND_REC_ERR 0x3 /* conditionally generate recovered
1296 #define SCSI_MP_IEC_UNCOND_REC_ERR 0x4 /* unconditionally generate recovered
1299 #define SCSI_MP_IEC_NO_SENSE 0x5 /* generate no sense */
1300 #define SCSI_MP_IEC_ON_REQUEST 0x6 /* only report exceptions on request */
1303 * SCSI flexible disk page
1305 struct scsi_mp_flexible_disk_s
{
1317 u8 transfer_rate_msb
;
1318 u8 transfer_rate_lsb
;
1323 u8 bytes_per_sector_msb
;
1324 u8 bytes_per_sector_lsb
;
1326 u8 num_cylinders_msb
;
1327 u8 num_cylinders_lsb
;
1329 u8 sc_wpc_msb
; /* starting cylinder-write
1330 * precompensation msb
1332 u8 sc_wpc_lsb
; /* starting cylinder-write
1333 * precompensation lsb
1335 u8 sc_rwc_msb
; /* starting cylinder-reduced write
1338 u8 sc_rwc_lsb
; /* starting cylinder-reduced write
1342 u8 dev_step_rate_msb
;
1343 u8 dev_step_rate_lsb
;
1345 u8 dev_step_pulse_width
;
1347 u8 head_sd_msb
; /* head settle delay msb */
1348 u8 head_sd_lsb
; /* head settle delay lsb */
1353 u8 trdy
:1; /* true ready bit */
1354 u8 ssn
:1; /* start sector number bit */
1355 u8 mo
:1; /* motor on bit */
1359 u8 spc
:4; /* step pulse per cylinder */
1362 u8 mo
:1; /* motor on bit */
1363 u8 ssn
:1; /* start sector number bit */
1364 u8 trdy
:1; /* true ready bit */
1366 u8 spc
:4; /* step pulse per cylinder */
1371 u8 head_unload_delay
;
1373 u8 pin34
:4; /* pin34 usage */
1374 u8 pin2
:4; /* pin2 usage */
1376 u8 pin4
:4; /* pin4 usage */
1377 u8 pin1
:4; /* pin1 usage */
1379 u8 pin2
:4; /* pin2 usage */
1380 u8 pin34
:4; /* pin34 usage */
1382 u8 pin1
:4; /* pin1 usage */
1383 u8 pin4
:4; /* pin4 usage */
1385 u8 med_rot_rate_msb
;
1386 u8 med_rot_rate_lsb
;
1391 struct scsi_mode_page_format_data6_s
{
1392 struct scsi_mode_param_header6_s mph
; /* mode page header */
1393 struct scsi_mode_param_desc_s desc
; /* block descriptor */
1394 struct scsi_mp_format_device_s format
; /* format device data */
1397 struct scsi_mode_page_format_data10_s
{
1398 struct scsi_mode_param_header10_s mph
; /* mode page header */
1399 struct scsi_mode_param_desc_s desc
; /* block descriptor */
1400 struct scsi_mp_format_device_s format
; /* format device data */
1403 struct scsi_mode_page_rdg_data6_s
{
1404 struct scsi_mode_param_header6_s mph
; /* mode page header */
1405 struct scsi_mode_param_desc_s desc
; /* block descriptor */
1406 struct scsi_mp_rigid_device_geometry_s rdg
;
1407 /* rigid geometry data */
1410 struct scsi_mode_page_rdg_data10_s
{
1411 struct scsi_mode_param_header10_s mph
; /* mode page header */
1412 struct scsi_mode_param_desc_s desc
; /* block descriptor */
1413 struct scsi_mp_rigid_device_geometry_s rdg
;
1414 /* rigid geometry data */
1417 struct scsi_mode_page_cache6_s
{
1418 struct scsi_mode_param_header6_s mph
; /* mode page header */
1419 struct scsi_mode_param_desc_s desc
; /* block descriptor */
1420 struct scsi_mp_caching_s cache
; /* cache page data */
1423 struct scsi_mode_page_cache10_s
{
1424 struct scsi_mode_param_header10_s mph
; /* mode page header */
1425 struct scsi_mode_param_desc_s desc
; /* block descriptor */
1426 struct scsi_mp_caching_s cache
; /* cache page data */
1429 /* --------------------------------------------------------------
1430 * Format Unit command
1431 * ------------------------------------------------------------
1437 struct scsi_format_unit_s
{
1441 u8 fmtdata
:1; /* if set, data out phase has format
1444 u8 cmplst
:1; /* if set, defect list is complete */
1445 u8 def_list
:3; /* format of defect descriptor is
1449 u8 def_list
:3; /* format of defect descriptor is
1452 u8 cmplst
:1; /* if set, defect list is complete */
1453 u8 fmtdata
:1; /* if set, data out phase has format
1467 struct scsi_reserve6_s
{
1486 struct scsi_release6_s
{
1505 struct scsi_reserve10_s
{
1521 u8 third_pty_dev_id
;
1529 struct scsi_release10_s
{
1545 u8 third_pty_dev_id
;
1553 struct scsi_verify10_s
{
1573 u8 verification_len0
;
1574 u8 verification_len1
;
1578 struct scsi_request_sense_s
{
1593 /* ------------------------------------------------------------
1594 * SCSI status byte values
1595 * ------------------------------------------------------------
1597 #define SCSI_STATUS_GOOD 0x00
1598 #define SCSI_STATUS_CHECK_CONDITION 0x02
1599 #define SCSI_STATUS_CONDITION_MET 0x04
1600 #define SCSI_STATUS_BUSY 0x08
1601 #define SCSI_STATUS_INTERMEDIATE 0x10
1602 #define SCSI_STATUS_ICM 0x14 /* intermediate condition met */
1603 #define SCSI_STATUS_RESERVATION_CONFLICT 0x18
1604 #define SCSI_STATUS_COMMAND_TERMINATED 0x22
1605 #define SCSI_STATUS_QUEUE_FULL 0x28
1606 #define SCSI_STATUS_ACA_ACTIVE 0x30
1608 #define SCSI_MAX_ALLOC_LEN 0xFF /* maximum allocarion length
1612 #define SCSI_OP_WRITE_VERIFY10 0x2E
1613 #define SCSI_OP_WRITE_VERIFY12 0xAE
1614 #define SCSI_OP_UNDEF 0xFF
1617 * SCSI WRITE-VERIFY(10) command
1619 struct scsi_write_verify10_s
{
1623 u8 dpo
:1; /* Disable Page Out */
1625 u8 ebp
:1; /* erse by-pass */
1626 u8 bytchk
:1; /* byte check */
1627 u8 rel_adr
:1; /* relative address */
1629 u8 rel_adr
:1; /* relative address */
1630 u8 bytchk
:1; /* byte check */
1631 u8 ebp
:1; /* erse by-pass */
1633 u8 dpo
:1; /* Disable Page Out */
1636 u8 lba0
; /* logical block address - MSB */
1641 u8 xfer_length0
; /* transfer length in blocks - MSB */
1642 u8 xfer_length1
; /* LSB */
1648 #endif /* __SCSI_H__ */