2005-02-01 02:06:41 +03:00
|
|
|
/* $NetBSD: scsipi_disk.h,v 1.14 2005/01/31 23:06:41 reinoud Exp $ */
|
1997-08-27 15:22:52 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* SCSI and SCSI-like interfaces description
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Some lines of this file come from a file of the name "scsi.h"
|
|
|
|
* distributed by OSF as part of mach2.5,
|
|
|
|
* so the following disclaimer has been kept.
|
|
|
|
*
|
|
|
|
* Copyright 1990 by Open Software Foundation,
|
|
|
|
* Grenoble, FRANCE
|
|
|
|
*
|
|
|
|
* All Rights Reserved
|
1997-10-01 05:18:38 +04:00
|
|
|
*
|
1997-08-27 15:22:52 +04:00
|
|
|
* Permission to use, copy, modify, and distribute this software and
|
|
|
|
* its documentation for any purpose and without fee is hereby granted,
|
|
|
|
* provided that the above copyright notice appears in all copies and
|
|
|
|
* that both the copyright notice and this permission notice appear in
|
|
|
|
* supporting documentation, and that the name of OSF or Open Software
|
|
|
|
* Foundation not be used in advertising or publicity pertaining to
|
|
|
|
* distribution of the software without specific, written prior
|
|
|
|
* permission.
|
1997-10-01 05:18:38 +04:00
|
|
|
*
|
1997-08-27 15:22:52 +04:00
|
|
|
* OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
|
|
|
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
|
|
|
|
* IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
|
* LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
|
|
|
|
* NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
|
|
|
|
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Largely written by Julian Elischer (julian@tfs.com)
|
|
|
|
* for TRW Financial Systems.
|
|
|
|
*
|
|
|
|
* TRW Financial Systems, in accordance with their agreement with Carnegie
|
|
|
|
* Mellon University, makes this software available to CMU to distribute
|
1997-10-01 05:18:38 +04:00
|
|
|
* or use in any manner that they see fit as long as this message is kept with
|
1997-08-27 15:22:52 +04:00
|
|
|
* the software. For this reason TFS also grants any other persons or
|
|
|
|
* organisations permission to use or modify this software.
|
|
|
|
*
|
|
|
|
* TFS supplies this software to be publicly redistributed
|
|
|
|
* on the understanding that TFS is not responsible for the correct
|
|
|
|
* functioning of this software in any circumstances.
|
|
|
|
*
|
|
|
|
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
|
|
|
|
*/
|
|
|
|
|
2003-01-07 00:02:18 +03:00
|
|
|
#ifndef _DEV_SCSIPI_SCSIPI_DISK_H_
|
|
|
|
#define _DEV_SCSIPI_SCSIPI_DISK_H_
|
|
|
|
|
1997-08-27 15:22:52 +04:00
|
|
|
/*
|
|
|
|
* SCSI command format
|
|
|
|
*/
|
|
|
|
|
2004-12-08 02:07:31 +03:00
|
|
|
#define READ_10 0x28
|
|
|
|
#define WRITE_10 0x2a
|
|
|
|
struct scsipi_rw_10 {
|
2005-02-01 02:06:41 +03:00
|
|
|
uint8_t opcode;
|
|
|
|
uint8_t byte2;
|
2004-12-04 22:02:25 +03:00
|
|
|
#define SRWB_RELADDR 0x01 /* obsolete */
|
|
|
|
#define SRWB_FUA_NV 0x02 /* force unit access non-volatile cache */
|
2001-09-03 00:17:04 +04:00
|
|
|
#define SRWB_FUA 0x08 /* force unit access */
|
|
|
|
#define SRWB_DPO 0x10 /* disable page out */
|
2004-12-04 22:02:25 +03:00
|
|
|
#define SRWB_PROTECT(x) ((x) << 5)
|
2005-02-01 02:06:41 +03:00
|
|
|
uint8_t addr[4];
|
|
|
|
uint8_t reserved;
|
|
|
|
uint8_t length[2];
|
|
|
|
uint8_t control;
|
2003-09-18 03:33:43 +04:00
|
|
|
} __attribute__((packed));
|
1997-08-27 15:22:52 +04:00
|
|
|
|
2004-12-04 22:02:25 +03:00
|
|
|
#define READ_12 0xa8
|
|
|
|
#define WRITE_12 0xaa
|
|
|
|
struct scsipi_rw_12 {
|
2005-02-01 02:06:41 +03:00
|
|
|
uint8_t opcode;
|
|
|
|
uint8_t byte2; /* see scsipi_rw_big bits */
|
|
|
|
uint8_t addr[4];
|
|
|
|
uint8_t length[4];
|
|
|
|
uint8_t byte11;
|
|
|
|
uint8_t control;
|
2004-12-04 22:02:25 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#define READ_16 0x88
|
|
|
|
#define WRITE_16 0x8a
|
|
|
|
struct scsipi_rw_16 {
|
2005-02-01 02:06:41 +03:00
|
|
|
uint8_t opcode;
|
|
|
|
uint8_t byte2; /* see scsipi_rw_big bits */
|
|
|
|
uint8_t addr[8];
|
|
|
|
uint8_t length[4];
|
|
|
|
uint8_t byte15;
|
|
|
|
uint8_t control;
|
2004-12-04 22:02:25 +03:00
|
|
|
};
|
|
|
|
|
2004-12-08 02:14:03 +03:00
|
|
|
#define READ_CAPACITY_10 0x25
|
|
|
|
struct scsipi_read_capacity_10 {
|
2005-02-01 02:06:41 +03:00
|
|
|
uint8_t opcode;
|
|
|
|
uint8_t byte2;
|
|
|
|
uint8_t addr[4];
|
|
|
|
uint8_t unused[3];
|
|
|
|
uint8_t control;
|
2003-09-18 03:33:43 +04:00
|
|
|
} __attribute__((packed));
|
1997-08-27 15:22:52 +04:00
|
|
|
|
|
|
|
/* DATAs definitions for the above commands */
|
|
|
|
|
2004-12-08 02:14:03 +03:00
|
|
|
struct scsipi_read_capacity_10_data {
|
2005-02-01 02:06:41 +03:00
|
|
|
uint8_t addr[4];
|
|
|
|
uint8_t length[4];
|
2003-09-18 03:33:43 +04:00
|
|
|
} __attribute__((packed));
|
|
|
|
|
2004-12-03 23:20:32 +03:00
|
|
|
#define READ_CAPACITY_16 0x9e /* really SERVICE ACTION IN */
|
|
|
|
struct scsipi_read_capacity_16 {
|
2005-02-01 02:06:41 +03:00
|
|
|
uint8_t opcode;
|
|
|
|
uint8_t byte2;
|
2004-12-03 23:20:32 +03:00
|
|
|
#define SRC16_SERVICE_ACTION 0x10
|
2005-02-01 02:06:41 +03:00
|
|
|
uint8_t addr[8];
|
|
|
|
uint8_t len[4];
|
|
|
|
uint8_t byte15;
|
2004-12-03 23:20:32 +03:00
|
|
|
#define SRC16_PMI 0x01
|
2005-02-01 02:06:41 +03:00
|
|
|
uint8_t control;
|
2004-12-03 23:20:32 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct scsipi_read_capacity_16_data {
|
2005-02-01 02:06:41 +03:00
|
|
|
uint8_t addr[8];
|
|
|
|
uint8_t length[4];
|
|
|
|
uint8_t byte13;
|
2004-12-03 23:20:32 +03:00
|
|
|
#define SRC16D_PROT_EN 0x01
|
|
|
|
#define SRC16D_RTO_EN 0x02
|
2005-02-01 02:06:41 +03:00
|
|
|
uint8_t reserved[19];
|
2004-12-03 23:20:32 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/* XXX SBC-2 says this is vendor-specific */
|
2003-09-18 03:33:43 +04:00
|
|
|
#define READ_FORMAT_CAPACITIES 0x23
|
|
|
|
struct scsipi_read_format_capacities {
|
2005-02-01 02:06:41 +03:00
|
|
|
uint8_t opcode;
|
|
|
|
uint8_t byte2;
|
|
|
|
uint8_t reserved1[5];
|
|
|
|
uint8_t length[2];
|
|
|
|
uint8_t reserved2[3];
|
2003-09-18 03:33:43 +04:00
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
struct scsipi_capacity_list_header {
|
2005-02-01 02:06:41 +03:00
|
|
|
uint8_t reserved[3];
|
|
|
|
uint8_t length;
|
2003-09-18 03:33:43 +04:00
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
struct scsipi_capacity_descriptor {
|
2005-02-01 02:06:41 +03:00
|
|
|
uint8_t nblks[4];
|
|
|
|
uint8_t byte5;
|
|
|
|
uint8_t blklen[3];
|
2003-09-18 03:33:43 +04:00
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
/* codes only valid in the current/maximum capacity descriptor */
|
|
|
|
#define SCSIPI_CAP_DESC_CODE_MASK 0x3
|
|
|
|
#define SCSIPI_CAP_DESC_CODE_RESERVED 0x0
|
|
|
|
#define SCSIPI_CAP_DESC_CODE_UNFORMATTED 0x1
|
|
|
|
#define SCSIPI_CAP_DESC_CODE_FORMATTED 0x2
|
|
|
|
#define SCSIPI_CAP_DESC_CODE_NONE 0x3
|
2003-01-07 00:02:18 +03:00
|
|
|
|
|
|
|
#endif /* _DEV_SCSIPI_SCSIPI_DISK_H_ */
|