Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / devices / sas / include / sas_disk.h
/*
* ========== Copyright Header Begin ==========================================
*
* OpenSPARC T2 Processor File: sas_disk.h
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
*
* The above named program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2 as published by the Free Software Foundation.
*
* The above named program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ========== Copyright Header End ============================================
*/
#ifndef SAS_DISK_H_
#define SAS_DISK_H_
#include <sys/types.h>
#define MAX_SCSI_COMMAND_SIZE 0x0C
#define SCSI_COMMAND_TEST_UNIT_READY 0x00
#define SCSI_COMMAND_REQUEST_SENSE 0x03
#define SCSI_COMMAND_READ 0x08
#define SCSI_COMMAND_WRITE 0x0A
#define SCSI_COMMAND_INQUIRY 0x12
#define SCSI_COMMAND_MODE_SENSE 0x1A
#define SCSI_COMMAND_START_STOP_UNIT 0x1B
#define SCSI_COMMAND_READ_CAPACITY 0x25
#define SCSI_COMMAND_READ_LONG 0x28
#define SCSI_COMMAND_WRITE_LONG 0x2A
#define SCSI_COMMAND_LOG_SENSE 0x4D
#define SCSI_COMMAND_PERSISTENT_RESERVE_IN 0x5E
#define SCSI_COMMAND_REPORT_LUNS 0xA0
#define STATUS_MASK 0x3E
#define STATUS_GOOD 0x00
#define STATUS_CHECK 0x02
#define STATUS_MET 0x04
#define STATUS_BUSY 0x08
#define STATUS_INTERMEDIATE 0x10
#define STATUS_SCSI2 0x20
#define STATUS_INTERMEDIATE_MET 0x14
#define STATUS_RESERVATION_CONFLICT 0x18
#define STATUS_TERMINATED 0x22
#define STATUS_QFULL 0x28
#define STATUS_ACA_ACTIVE 0x30
struct scsi_command_report_luns {
uint8_t opcode;
uint8_t res1;
uint8_t select_report;
uint8_t res2[3];
uint8_t allocation_length[4]; // big endian
uint8_t res3;
uint8_t control;
};
typedef struct scsi_command_report_luns scsi_command_report_luns_t;
#define REPORT_LUNS_MIN_LUNS 2
struct scsi_report_luns {
/* Number of bytes of data the target has available to send. */
uint32_t lun_list_len;
uint32_t reserved;
uint64_t lun[REPORT_LUNS_MIN_LUNS];
};
struct scsi_command_write {
uchar_t opcode;
#if defined(ARCH_X64)
uchar_t lblk_msb:5,
lun:3;
#else
uchar_t lun:3,
lblk_msb:5;
#endif
ushort_t lblk;
uchar_t transfer_length;
uchar_t control;
};
typedef struct scsi_command_write scsi_command_write_t;
struct scsi_command_write_long {
uchar_t opcode;
#if defined(ARCH_X64)
uchar_t reladr:1,
res1:2,
fua:1,
dp0:1,
lun:3;
#else
uchar_t lun:3,
dp0:1,
fua:1,
res1:2,
reladr:1;
#endif
uchar_t lblk[4];
uchar_t res2;
uchar_t transfer_length[2];
uchar_t control;
};
typedef struct scsi_command_write_long scsi_command_write_long_t;
struct scsi_command_read {
uchar_t opcode;
#if defined(ARCH_X64)
uchar_t lblk_msb:5,
lun:3;
#else
uchar_t lun:3,
lblk_msb:5;
#endif
ushort_t lblk;
uchar_t transfer_length;
uchar_t control;
};
typedef struct scsi_command_read scsi_command_read_t;
struct scsi_command_read_long {
uchar_t opcode;
#if defined(ARCH_X64)
uchar_t reladr:1,
res1:2,
fua:1,
dp0:1,
lun:3;
#else
uchar_t lun:3,
dp0:1,
fua:1,
res1:2,
reladr:1;
#endif
uchar_t lblk[4];
uchar_t res2;
uchar_t transfer_length[2];
uchar_t control;
};
typedef struct scsi_command_read_long scsi_command_read_long_t;
struct scsi_command_request_sense {
uchar_t opcode;
#if defined(ARCH_X64)
uchar_t res1:5,
lun:3;
#else
uchar_t lun:3,
res1:5;
#endif
uchar_t res2;
uchar_t res3;
uchar_t allocation_length;
uchar_t control;
};
typedef struct scsi_command_request_sense scsi_command_request_sense_t;
struct scsi_command_inquiry {
uchar_t opcode;
#if defined(ARCH_X64)
uchar_t evpd:1,
res1:4,
lun:3;
#else
uchar_t lun:3,
res1:4,
evpd:1;
#endif
uchar_t pagecode;
uchar_t res2;
uchar_t allocation_length;
uchar_t control;
};
typedef struct scsi_command_inquiry scsi_command_inquiry_t;
struct scsi_command_test_unit_ready {
uchar_t opcode;
#if defined(ARCH_X64)
uchar_t res1:5,
lun:3;
#else
uchar_t lun:3,
res1:5;
#endif
uchar_t res2;
uchar_t res3;
uchar_t res4;
uchar_t control;
};
typedef struct scsi_command_test_unit_ready scsi_command_test_unit_ready_t;
struct scsi_command_mode_sense {
uchar_t opcode;
#if defined(ARCH_X64)
uchar_t res2:3,
dbd:1,
res1:1,
lun:3;
uchar_t pagecode:6,
pc:2;
#else
uchar_t lun:3,
res1:1,
dbd:1,
res2:3;
uchar_t pc:2,
pagecode:6;
#endif
uchar_t res3;
uchar_t allocation_length;
uchar_t control;
};
typedef struct scsi_command_mode_sense scsi_command_mode_sense_t;
struct scsi_command_log_sense {
uchar_t opcode;
#if defined(ARCH_X64)
uchar_t sp:1,
ppc:1,
res1:3,
lun:3;
uchar_t pagecode:6,
pc:2;
#else
uchar_t lun:3,
res1:3,
ppc:1,
sp:1;
uchar_t pc:2,
pagecode:6;
#endif
uchar_t res2;
uchar_t res3;
uchar_t parameter_pointer[2];
uchar_t allocation_length[2];
uchar_t control;
};
typedef struct scsi_command_log_sense scsi_command_log_sense_t;
struct scsi_command_read_capacity {
uchar_t opcode;
#if defined(ARCH_X64)
uchar_t reladr:1,
res1:4,
lun:3;
#else
uchar_t lun:3,
res1:4,
reladr:1;
#endif
uchar_t lblk[4];
uchar_t res2;
uchar_t res3;
#if defined(ARCH_X64)
uchar_t pmi:1,
res4:7;
#else
uchar_t res4:7,
pmi:1;
#endif
uchar_t control;
};
typedef struct scsi_command_read_capacity scsi_command_read_capacity_t;
struct scsi_command_read_capacity_data {
uint32_t lblk;
uint32_t lblk_size;
};
typedef scsi_command_read_capacity_data scsi_command_read_capacity_data_t;
struct scsi_command_start_stop_unit {
uchar_t opcode;
#if defined(ARCH_X64)
uchar_t immed:1,
res1:4,
lun:3;
#else
uchar_t lun:3,
res1:4,
immed:1;
#endif
uchar_t res2;
uchar_t res3;
#if defined(ARCH_X64)
uchar_t start:1,
loej:1,
res4:6;
#else
uchar_t res4:6,
loej:1,
start:1;
#endif
uchar_t control;
};
typedef struct scsi_command_start_stop_unit scsi_command_start_stop_unit_t;
struct scsi_disk_request_sense_data {
#if defined(ARCH_X64)
uchar_t error_code:7,
valid:1;
#else
uchar_t valid:1,
error_code:7;
#endif
uchar_t segment_number;
#if defined(ARCH_X64)
uchar_t sense_key:4,
res1:1,
ILI:1,
EOM:1,
Filemark:1;
#else
uchar_t Filemark:1,
EOM:1,
ILI:1,
res1:1,
sense_key:4;
#endif
uchar_t information[4];
uchar_t additional_sense_length;
uchar_t command_specific_info[4];
uchar_t additional_sense_code;
uchar_t additional_sense_code_qualifier;
uchar_t field_replaceable_unit_code;
#if defined(ARCH_X64)
uchar_t sense_key_specific1:7,
SKSV:1;
#else
uchar_t SKSV:1,
sense_key_specific1:7;
#endif
uchar_t sense_key_specific2[2];
uchar_t additional_sense_bytes[2];
};
typedef struct scsi_disk_request_sense_data scsi_disk_request_sense_data_t;
#endif /* SAS_DISK_H_ */