devices/virtio/scsi/constants.rs
1// Copyright 2023 The ChromiumOS Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#![deny(missing_docs)]
6//! This file contains values specified in spec.
7//! SPC-3: <https://www.t10.org/cgi-bin/ac.pl?t=f&f=spc3r23.pdf>
8//! SAM-5: <https://www.t10.org/cgi-bin/ac.pl?t=f&f=sam5r21.pdf>
9
10// SCSI opcodes
11/// Opcode for TEST UNIT READY command.
12pub const TEST_UNIT_READY: u8 = 0x00;
13/// Opcode for REQUEST SENSE command.
14pub const REQUEST_SENSE: u8 = 0x03;
15/// Opcode for READ(6) command.
16pub const READ_6: u8 = 0x08;
17/// Opcode for INQUIRY command.
18pub const INQUIRY: u8 = 0x12;
19/// Opcode for MODE SELECT(6) command.
20pub const MODE_SELECT_6: u8 = 0x15;
21/// Opcode for MODE SENSE(6) command.
22pub const MODE_SENSE_6: u8 = 0x1a;
23/// Opcode for READ CAPACITY(10) command.
24pub const READ_CAPACITY_10: u8 = 0x25;
25/// Opcode for READ(10) command.
26pub const READ_10: u8 = 0x28;
27/// Opcode for WRITE(10) command.
28pub const WRITE_10: u8 = 0x2a;
29/// Opcode for SYNCHRONIZE CACHE(10) command.
30pub const SYNCHRONIZE_CACHE_10: u8 = 0x35;
31/// Opcode for WRITE SAME(10) command.
32pub const WRITE_SAME_10: u8 = 0x41;
33/// Opcode for UNMAP command.
34pub const UNMAP: u8 = 0x42;
35/// Opcode for WRITE SAME(16) command.
36pub const WRITE_SAME_16: u8 = 0x93;
37/// Opcode for SERVICE ACTION IN(16) command.
38pub const SERVICE_ACTION_IN_16: u8 = 0x9e;
39/// Opcode for REPORT LUNS command.
40pub const REPORT_LUNS: u8 = 0xa0;
41/// Opcode for MAINTENANCE IN command.
42pub const MAINTENANCE_IN: u8 = 0xa3;
43
44// The service actions of MAINTENANCE IN command.
45/// REPORT SUPPORTED TASK MANAGEMENT FUNCTIONS
46pub const REPORT_SUPPORTED_TASK_MANAGEMENT_FUNCTIONS: u8 = 0x0d;
47
48// The service actions of SERVICE ACTION IN(16) command.
49/// READ CAPACITY(16)
50pub const READ_CAPACITY_16: u8 = 0x10;
51
52// SAM status code
53/// Indicates the completion of the command without error.
54pub const GOOD: u8 = 0x00;
55/// Indicates that sense data has been delivered in the buffer.
56pub const CHECK_CONDITION: u8 = 0x02;
57
58// Device Types
59/// Indicates the id of disk type.
60pub const TYPE_DISK: u8 = 0x00;
61
62// SENSE KEYS
63/// Indicates that there is no specific sense data to be reported.
64pub const NO_SENSE: u8 = 0x00;
65/// Indicates an error that may have been caused by a flaw in the medium or an error in the
66/// recorded data.
67pub const MEDIUM_ERROR: u8 = 0x03;
68/// Indicates an illegal request.
69pub const ILLEGAL_REQUEST: u8 = 0x05;
70/// Indicates that a unit attention condition has been established.
71pub const UNIT_ATTENTION: u8 = 0x06;