* Added opcode definitions for read/write-16 and the extended "read capacity 16"

over service-action-in.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36415 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2010-04-22 13:44:24 +00:00
parent 46d3d6949b
commit 0a96e18689
+87 -40
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2004-2007, Haiku, Inc. All RightsReserved. * Copyright 2004-2010, Haiku, Inc. All RightsReserved.
* Copyright 2002/03, Thomas Kurschel. All rights reserved. * Copyright 2002/03, Thomas Kurschel. All rights reserved.
* *
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
@@ -7,25 +7,31 @@
#ifndef _SCSI_CMDS_H #ifndef _SCSI_CMDS_H
#define _SCSI_CMDS_H #define _SCSI_CMDS_H
// SCSI commands and their data structures and constants
//! SCSI commands and their data structures and constants
#include <lendian_bitfield.h> #include <lendian_bitfield.h>
// always keep in mind that SCSI is big-endian !!! // Always keep in mind that SCSI is big-endian!
#define SCSI_STD_TIMEOUT 10 #define SCSI_STD_TIMEOUT 10
// SCSI device status (as the result of a command) // SCSI device status (as the result of a command)
#define SCSI_STATUS_GOOD (0 << 1) #define SCSI_STATUS_GOOD (0 << 1)
#define SCSI_STATUS_CHECK_CONDITION (1 << 1) // error occured #define SCSI_STATUS_CHECK_CONDITION (1 << 1) // error occured
#define SCSI_STATUS_CONDITION_MET (2 << 1) // "found" for SEARCH DATA and PREFETCH #define SCSI_STATUS_CONDITION_MET (2 << 1)
#define SCSI_STATUS_BUSY (4 << 1) // try again later (??? == QUEUE_FULL ???) // "found" for SEARCH DATA and PREFETCH
#define SCSI_STATUS_INTERMEDIATE (8 << 1) // used by linked command only #define SCSI_STATUS_BUSY (4 << 1)
// try again later (??? == QUEUE_FULL ???)
#define SCSI_STATUS_INTERMEDIATE (8 << 1)
// used by linked command only
#define SCSI_STATUS_INTERMEDIATE_COND_MET (10 << 1) // ditto #define SCSI_STATUS_INTERMEDIATE_COND_MET (10 << 1) // ditto
#define SCSI_STATUS_RESERVATION_CONFLICT (12 << 1) // only if RESERVE/RELEASE is used #define SCSI_STATUS_RESERVATION_CONFLICT (12 << 1)
#define SCSI_STATUS_COMMAND_TERMINATED (17 << 1) // aborted by TERMINATE I/O PROCESS // only if RESERVE/RELEASE is used
#define SCSI_STATUS_COMMAND_TERMINATED (17 << 1)
// aborted by TERMINATE I/O PROCESS
#define SCSI_STATUS_QUEUE_FULL (20 << 1) // queue full #define SCSI_STATUS_QUEUE_FULL (20 << 1) // queue full
#define SCSI_STATUS_MASK 0xfe #define SCSI_STATUS_MASK 0xfe
@@ -33,18 +39,25 @@
// SCSI sense key // SCSI sense key
#define SCSIS_KEY_NO_SENSE 0 #define SCSIS_KEY_NO_SENSE 0
#define SCSIS_KEY_RECOVERED_ERROR 1 #define SCSIS_KEY_RECOVERED_ERROR 1
#define SCSIS_KEY_NOT_READY 2 // operator intervention may be required #define SCSIS_KEY_NOT_READY 2
#define SCSIS_KEY_MEDIUM_ERROR 3 // can be set if source could be hardware error // operator intervention may be required
#define SCSIS_KEY_MEDIUM_ERROR 3
// can be set if source could be hardware error
#define SCSIS_KEY_HARDWARE_ERROR 4 #define SCSIS_KEY_HARDWARE_ERROR 4
#define SCSIS_KEY_ILLEGAL_REQUEST 5 // invalid command #define SCSIS_KEY_ILLEGAL_REQUEST 5 // invalid command
#define SCSIS_KEY_UNIT_ATTENTION 6 // medium changed or target reset #define SCSIS_KEY_UNIT_ATTENTION 6
// medium changed or target reset
#define SCSIS_KEY_DATA_PROTECT 7 // data access forbidden #define SCSIS_KEY_DATA_PROTECT 7 // data access forbidden
#define SCSIS_KEY_BLANK_CHECK 8 // tried to read blank or to write non-blank medium #define SCSIS_KEY_BLANK_CHECK 8
// tried to read blank or to write non-blank medium
#define SCSIS_KEY_VENDOR_SPECIFIC 9 #define SCSIS_KEY_VENDOR_SPECIFIC 9
#define SCSIS_KEY_COPY_ABORTED 10 // error in COPY or COMPARE command #define SCSIS_KEY_COPY_ABORTED 10
#define SCSIS_KEY_ABORTED_COMMAND 11 // aborted by target, retry *may* help // error in COPY or COMPARE command
#define SCSIS_KEY_ABORTED_COMMAND 11
// aborted by target, retry *may* help
#define SCSIS_KEY_EQUAL 12 // during SEARCH: data found #define SCSIS_KEY_EQUAL 12 // during SEARCH: data found
#define SCSIS_KEY_VOLUME_OVERFLOW 13 // tried to write buffered data beyond end of medium #define SCSIS_KEY_VOLUME_OVERFLOW 13
// tried to write buffered data beyond end of medium
#define SCSIS_KEY_MISCOMPARE 14 #define SCSIS_KEY_MISCOMPARE 14
#define SCSIS_KEY_RESERVED 15 #define SCSIS_KEY_RESERVED 15
@@ -55,42 +68,63 @@
#define SCSIS_ASC_AUDIO_PLAYING 0x0011 #define SCSIS_ASC_AUDIO_PLAYING 0x0011
#define SCSIS_ASC_AUDIO_PAUSED 0x0012 #define SCSIS_ASC_AUDIO_PAUSED 0x0012
#define SCSIS_ASC_AUDIO_COMPLETED 0x0013 #define SCSIS_ASC_AUDIO_COMPLETED 0x0013
#define SCSIS_ASC_AUDIO_ERROR 0x0014 // playing has stopped due to error #define SCSIS_ASC_AUDIO_ERROR 0x0014
// playing has stopped due to error
#define SCSIS_ASC_AUDIO_NO_STATUS 0x0015 #define SCSIS_ASC_AUDIO_NO_STATUS 0x0015
#define SCSIS_ASC_NO_INDEX 0x0100 // no index/sector signal #define SCSIS_ASC_NO_INDEX 0x0100 // no index/sector signal
#define SCSIS_ASC_NO_SEEK_CMP 0x0200 // ??? #define SCSIS_ASC_NO_SEEK_CMP 0x0200 // ???
#define SCSIS_ASC_WRITE_FAULT 0x0300 #define SCSIS_ASC_WRITE_FAULT 0x0300
#define SCSIS_ASC_LUN_NOT_READY 0x0400 // LUN not ready, cause not reportable #define SCSIS_ASC_LUN_NOT_READY 0x0400
#define SCSIS_ASC_LUN_BECOMING_READY 0x0401 // LUN in progress of becoming ready // LUN not ready, cause not reportable
#define SCSIS_ASC_LUN_NEED_INIT 0x0402 // LUN need initializing command #define SCSIS_ASC_LUN_BECOMING_READY 0x0401
#define SCSIS_ASC_LUN_NEED_MANUAL_HELP 0x0403 // LUN needs manual intervention // LUN in progress of becoming ready
#define SCSIS_ASC_LUN_FORMATTING 0x0404 // LUN format in progress #define SCSIS_ASC_LUN_NEED_INIT 0x0402
#define SCSIS_ASC_LUN_SEL_FAILED 0x0500 // LUN doesn't respond to selection // LUN need initializing command
#define SCSIS_ASC_LUN_NEED_MANUAL_HELP 0x0403
// LUN needs manual intervention
#define SCSIS_ASC_LUN_FORMATTING 0x0404
// LUN format in progress
#define SCSIS_ASC_LUN_SEL_FAILED 0x0500
// LUN doesn't respond to selection
#define SCSIS_ASC_LUN_COM_FAILURE 0x0800 // LUN communication failure #define SCSIS_ASC_LUN_COM_FAILURE 0x0800 // LUN communication failure
#define SCSIS_ASC_LUN_TIMEOUT 0x0801 // LUN communication time-out #define SCSIS_ASC_LUN_TIMEOUT 0x0801
#define SCSIS_ASC_LUN_COM_PARITY 0x0802 // LUN communication parity failure // LUN communication time-out
#define SCSIS_ASC_LUN_COM_CRC 0x0803 // LUN communication CRC failure (SCSI-3) #define SCSIS_ASC_LUN_COM_PARITY 0x0802
#define SCSIS_ASC_WRITE_ERR_AUTOREALLOC 0x0c01 // recovered by auto-reallocation // LUN communication parity failure
#define SCSIS_ASC_LUN_COM_CRC 0x0803
// LUN communication CRC failure (SCSI-3)
#define SCSIS_ASC_WRITE_ERR_AUTOREALLOC 0x0c01
// recovered by auto-reallocation
#define SCSIS_ASC_WRITE_ERR_AUTOREALLOC_FAILED 0x0c02 #define SCSIS_ASC_WRITE_ERR_AUTOREALLOC_FAILED 0x0c02
#define SCSIS_ASC_ECC_ERROR 0x1000 #define SCSIS_ASC_ECC_ERROR 0x1000
#define SCSIS_ASC_UNREC_READ_ERR 0x1100 // unrecovered read error #define SCSIS_ASC_UNREC_READ_ERR 0x1100 // unrecovered read error
#define SCSIS_ASC_READ_RETRIES_EXH 0x1101 // read retries exhausted #define SCSIS_ASC_READ_RETRIES_EXH 0x1101 // read retries exhausted
#define SCSIS_ASC_UNREC_READ_ERR_AUTOREALLOC_FAILED 0x1104 // above + auto-reallocate failed #define SCSIS_ASC_UNREC_READ_ERR_AUTOREALLOC_FAILED 0x1104
// above + auto-reallocate failed
#define SCSIS_ASC_RECORD_NOT_FOUND 0x1401 #define SCSIS_ASC_RECORD_NOT_FOUND 0x1401
#define SCSIS_ASC_RANDOM_POS_ERROR 0x1500 // random positioning error #define SCSIS_ASC_RANDOM_POS_ERROR 0x1500 // random positioning error
#define SCSIS_ASC_POSITIONING_ERR 0x1501 // mechanical positioning error #define SCSIS_ASC_POSITIONING_ERR 0x1501
#define SCSIS_ASC_POS_ERR_ON_READ 0x1502 // positioning error detected by reading // mechanical positioning error
#define SCSIS_ASC_DATA_RECOV_NO_ERR_CORR 0x1700 // recovered with no error correction applied #define SCSIS_ASC_POS_ERR_ON_READ 0x1502
// positioning error detected by reading
#define SCSIS_ASC_DATA_RECOV_NO_ERR_CORR 0x1700
// recovered with no error correction applied
#define SCSIS_ASC_DATA_RECOV_WITH_RETRIES 0x1701 #define SCSIS_ASC_DATA_RECOV_WITH_RETRIES 0x1701
#define SCSIS_ASC_DATA_RECOV_POS_HEAD_OFS 0x1702 // ?recovered with positive head offset #define SCSIS_ASC_DATA_RECOV_POS_HEAD_OFS 0x1702
#define SCSIS_ASC_DATA_RECOV_NEG_HEAD_OFS 0x1703 // ?recovered with negative head offset // ?recovered with positive head offset
#define SCSIS_ASC_DATA_RECOV_WITH_RETRIES_CIRC 0x1704 // recovered with retries/CIRC #define SCSIS_ASC_DATA_RECOV_NEG_HEAD_OFS 0x1703
#define SCSIS_ASC_DATA_RECOV_PREV_SECT_ID 0x1705 // recovered using previous sector ID // ?recovered with negative head offset
#define SCSIS_ASC_DATA_RECOV_WITH_RETRIES_CIRC 0x1704
// recovered with retries/CIRC
#define SCSIS_ASC_DATA_RECOV_PREV_SECT_ID 0x1705
// recovered using previous sector ID
#define SCSIS_ASC_DATA_RECOV_NO_ECC_AUTOREALLOC 0x1706 #define SCSIS_ASC_DATA_RECOV_NO_ECC_AUTOREALLOC 0x1706
#define SCSIS_ASC_DATA_RECOV_NO_ECC_REASSIGN 0x1707 // reassign recommended #define SCSIS_ASC_DATA_RECOV_NO_ECC_REASSIGN 0x1707 // reassign recommended
#define SCSIS_ASC_DATA_RECOV_NO_ECC_REWRITE 0x1708 // rewrite recommended #define SCSIS_ASC_DATA_RECOV_NO_ECC_REWRITE 0x1708 // rewrite recommended
#define SCSIS_ASC_DATA_RECOV_WITH_CORR 0x1800 // recovered using error correction #define SCSIS_ASC_DATA_RECOV_WITH_CORR 0x1800
#define SCSIS_ASC_DATA_RECOV_WITH_CORR_RETRIES 0x1801 // used error correction and retries // recovered using error correction
#define SCSIS_ASC_DATA_RECOV_WITH_CORR_RETRIES 0x1801
// used error correction and retries
#define SCSIS_ASC_DATA_RECOV_AUTOREALLOC 0x1802 #define SCSIS_ASC_DATA_RECOV_AUTOREALLOC 0x1802
#define SCSIS_ASC_DATA_RECOV_CIRC 0x1803 // recovered using CIRC #define SCSIS_ASC_DATA_RECOV_CIRC 0x1803 // recovered using CIRC
#define SCSIS_ASC_DATA_RECOV_LEC 0x1804 // recovered using LEC #define SCSIS_ASC_DATA_RECOV_LEC 0x1804 // recovered using LEC
@@ -100,7 +134,8 @@
#define SCSIS_ASC_ID_RECOV 0x1e00 // recoved ID with ECC #define SCSIS_ASC_ID_RECOV 0x1e00 // recoved ID with ECC
#define SCSIS_ASC_INV_OPCODE 0x2000 #define SCSIS_ASC_INV_OPCODE 0x2000
#define SCSIS_ASC_LBA_OOR 0x2100 // LBA out of range #define SCSIS_ASC_LBA_OOR 0x2100 // LBA out of range
#define SCSIS_ASC_ILL_FUNCTION 0x2200 // better use 0x2000/0x2400/0x2600 instead #define SCSIS_ASC_ILL_FUNCTION 0x2200
// better use 0x2000/0x2400/0x2600 instead
#define SCSIS_ASC_INV_CDB_FIELD 0x2400 #define SCSIS_ASC_INV_CDB_FIELD 0x2400
#define SCSIS_ASC_LUN_NOT_SUPPORTED 0x2500 #define SCSIS_ASC_LUN_NOT_SUPPORTED 0x2500
#define SCSIS_ASC_INV_PARAM_LIST_FIELD 0x2600 #define SCSIS_ASC_INV_PARAM_LIST_FIELD 0x2600
@@ -108,7 +143,8 @@
#define SCSIS_ASC_PARAM_VALUE_INV 0x2602 #define SCSIS_ASC_PARAM_VALUE_INV 0x2602
#define SCSIS_ASC_WRITE_PROTECTED 0x2700 #define SCSIS_ASC_WRITE_PROTECTED 0x2700
#define SCSIS_ASC_MEDIUM_CHANGED 0x2800 #define SCSIS_ASC_MEDIUM_CHANGED 0x2800
#define SCSIS_ASC_WAS_RESET 0x2900 // reset by power-on/bus reset/device reset #define SCSIS_ASC_WAS_RESET 0x2900
// reset by power-on/bus reset/device reset
#define SCSIS_ASC_PARAMS_CHANGED 0x2a00 #define SCSIS_ASC_PARAMS_CHANGED 0x2a00
#define SCSIS_ASC_MEDIUM_FORMAT_CORRUPTED 0x3100 #define SCSIS_ASC_MEDIUM_FORMAT_CORRUPTED 0x3100
#define SCSIS_ASC_ROUNDED_PARAM 0x3700 // parameter got rounded #define SCSIS_ASC_ROUNDED_PARAM 0x3700 // parameter got rounded
@@ -117,9 +153,11 @@
#define SCSIS_ASC_SEL_FAILURE 0x4500 // select/reselect failure #define SCSIS_ASC_SEL_FAILURE 0x4500 // select/reselect failure
#define SCSIS_ASC_UNSUCC_SOFT_RESET 0x4600 // unsuccessful soft reset #define SCSIS_ASC_UNSUCC_SOFT_RESET 0x4600 // unsuccessful soft reset
#define SCSIS_ASC_SCSI_PARITY_ERR 0x4700 // SCSI parity error #define SCSIS_ASC_SCSI_PARITY_ERR 0x4700 // SCSI parity error
#define SCSIS_ASC_LOAD_EJECT_FAILED 0x5300 // media load or eject failed #define SCSIS_ASC_LOAD_EJECT_FAILED 0x5300
// media load or eject failed
#define SCSIS_ASC_REMOVAL_PREVENTED 0x5302 // medium removal prevented #define SCSIS_ASC_REMOVAL_PREVENTED 0x5302 // medium removal prevented
#define SCSIS_ASC_REMOVAL_REQUESTED 0x5a01 // operator requests medium removal #define SCSIS_ASC_REMOVAL_REQUESTED 0x5a01
// operator requests medium removal
// some scsi op-codes // some scsi op-codes
#define SCSI_OP_TEST_UNIT_READY 0x00 #define SCSI_OP_TEST_UNIT_READY 0x00
@@ -153,6 +191,10 @@
#define SCSI_OP_STOP_PLAY 0x4e #define SCSI_OP_STOP_PLAY 0x4e
#define SCSI_OP_MODE_SELECT_10 0x55 #define SCSI_OP_MODE_SELECT_10 0x55
#define SCSI_OP_MODE_SENSE_10 0x5A #define SCSI_OP_MODE_SENSE_10 0x5A
#define SCSI_OP_READ_16 0x88
#define SCSI_OP_WRITE_16 0x8a
#define SCSI_OP_SERVICE_ACTION_IN 0x9e
#define SCSI_OP_SERVICE_ACTION_OUT 0x9f
#define SCSI_OP_MOVE_MEDIUM 0xa5 #define SCSI_OP_MOVE_MEDIUM 0xa5
#define SCSI_OP_READ_12 0xa8 #define SCSI_OP_READ_12 0xa8
#define SCSI_OP_WRITE_12 0xaa #define SCSI_OP_WRITE_12 0xaa
@@ -160,6 +202,10 @@
#define SCSI_OP_SCAN 0xba #define SCSI_OP_SCAN 0xba
#define SCSI_OP_READ_CD 0xbe #define SCSI_OP_READ_CD 0xbe
// Service-Action-In defines
#define SCSI_SAI_READ_CAPACITY_16 0x10
// INQUIRY // INQUIRY
typedef struct scsi_cmd_inquiry { typedef struct scsi_cmd_inquiry {
@@ -999,4 +1045,5 @@ typedef struct scsi_cmd_sync_cache {
uint8 control; uint8 control;
} _PACKED scsi_cmd_sync_cache; } _PACKED scsi_cmd_sync_cache;
#endif /* _SCSI_CMDS_H */ #endif /* _SCSI_CMDS_H */