Home | History | Annotate | Line # | Download | only in scsipi
scsipi_disk.h revision 1.21.78.1
      1  1.21.78.1  pgoyette /*	$NetBSD: scsipi_disk.h,v 1.21.78.1 2017/04/26 02:53:23 pgoyette Exp $	*/
      2        1.2    bouyer 
      3        1.2    bouyer /*
      4        1.2    bouyer  * SCSI and SCSI-like interfaces description
      5        1.2    bouyer  */
      6        1.2    bouyer 
      7        1.2    bouyer /*
      8        1.2    bouyer  * Some lines of this file come from a file of the name "scsi.h"
      9        1.2    bouyer  * distributed by OSF as part of mach2.5,
     10        1.2    bouyer  *  so the following disclaimer has been kept.
     11        1.2    bouyer  *
     12        1.2    bouyer  * Copyright 1990 by Open Software Foundation,
     13        1.2    bouyer  * Grenoble, FRANCE
     14        1.2    bouyer  *
     15        1.2    bouyer  * 		All Rights Reserved
     16        1.3     enami  *
     17        1.2    bouyer  *   Permission to use, copy, modify, and distribute this software and
     18        1.2    bouyer  * its documentation for any purpose and without fee is hereby granted,
     19        1.2    bouyer  * provided that the above copyright notice appears in all copies and
     20        1.2    bouyer  * that both the copyright notice and this permission notice appear in
     21        1.2    bouyer  * supporting documentation, and that the name of OSF or Open Software
     22        1.2    bouyer  * Foundation not be used in advertising or publicity pertaining to
     23        1.2    bouyer  * distribution of the software without specific, written prior
     24        1.2    bouyer  * permission.
     25        1.3     enami  *
     26        1.2    bouyer  *   OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
     27        1.2    bouyer  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
     28        1.2    bouyer  * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
     29        1.2    bouyer  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
     30        1.2    bouyer  * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
     31        1.2    bouyer  * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
     32        1.2    bouyer  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     33        1.2    bouyer  */
     34        1.2    bouyer 
     35        1.2    bouyer /*
     36        1.2    bouyer  * Largely written by Julian Elischer (julian (at) tfs.com)
     37        1.2    bouyer  * for TRW Financial Systems.
     38        1.2    bouyer  *
     39        1.2    bouyer  * TRW Financial Systems, in accordance with their agreement with Carnegie
     40        1.2    bouyer  * Mellon University, makes this software available to CMU to distribute
     41        1.3     enami  * or use in any manner that they see fit as long as this message is kept with
     42        1.2    bouyer  * the software. For this reason TFS also grants any other persons or
     43        1.2    bouyer  * organisations permission to use or modify this software.
     44        1.2    bouyer  *
     45        1.2    bouyer  * TFS supplies this software to be publicly redistributed
     46        1.2    bouyer  * on the understanding that TFS is not responsible for the correct
     47        1.2    bouyer  * functioning of this software in any circumstances.
     48        1.2    bouyer  *
     49        1.2    bouyer  * Ported to run under 386BSD by Julian Elischer (julian (at) tfs.com) Sept 1992
     50        1.2    bouyer  */
     51        1.2    bouyer 
     52        1.8      matt #ifndef _DEV_SCSIPI_SCSIPI_DISK_H_
     53        1.8      matt #define _DEV_SCSIPI_SCSIPI_DISK_H_
     54        1.8      matt 
     55        1.2    bouyer /*
     56        1.2    bouyer  * SCSI command format
     57        1.2    bouyer  */
     58        1.2    bouyer 
     59       1.12   thorpej #define	READ_10			0x28
     60       1.12   thorpej #define WRITE_10		0x2a
     61       1.12   thorpej struct scsipi_rw_10 {
     62       1.15   reinoud 	u_int8_t opcode;
     63       1.15   reinoud 	u_int8_t byte2;
     64       1.11   thorpej #define	SRWB_RELADDR	0x01	/* obsolete */
     65  1.21.78.1  pgoyette #define	SRWB_FUA_NV	0x02	/* force unit access non-volatile cache (SCSI-3) */
     66  1.21.78.1  pgoyette #define	SRWB_RESV2	0x04	/* reserved (SCSI-2) */
     67  1.21.78.1  pgoyette #define	SRWB_FUA	0x08	/* force unit access volatile cache (SCSI-2) */
     68  1.21.78.1  pgoyette #define	SRWB_DPO	0x10	/* disable page out (SCSI-2) */
     69       1.11   thorpej #define	SRWB_PROTECT(x) ((x) << 5)
     70       1.15   reinoud 	u_int8_t addr[4];
     71       1.15   reinoud 	u_int8_t reserved;
     72       1.15   reinoud 	u_int8_t length[2];
     73       1.15   reinoud 	u_int8_t control;
     74       1.21     perry } __packed;
     75        1.2    bouyer 
     76       1.11   thorpej #define	READ_12			0xa8
     77       1.11   thorpej #define	WRITE_12		0xaa
     78       1.11   thorpej struct scsipi_rw_12 {
     79       1.15   reinoud 	u_int8_t opcode;
     80       1.15   reinoud 	u_int8_t byte2;		/* see scsipi_rw_big bits */
     81       1.15   reinoud 	u_int8_t addr[4];
     82       1.15   reinoud 	u_int8_t length[4];
     83       1.15   reinoud 	u_int8_t byte11;
     84       1.15   reinoud 	u_int8_t control;
     85       1.21     perry } __packed;
     86       1.11   thorpej 
     87       1.11   thorpej #define	READ_16			0x88
     88       1.11   thorpej #define	WRITE_16		0x8a
     89       1.11   thorpej struct scsipi_rw_16 {
     90       1.15   reinoud 	u_int8_t opcode;
     91       1.15   reinoud 	u_int8_t byte2;		/* see scsipi_rw_big bits */
     92       1.15   reinoud 	u_int8_t addr[8];
     93       1.15   reinoud 	u_int8_t length[4];
     94       1.15   reinoud 	u_int8_t byte15;
     95       1.15   reinoud 	u_int8_t control;
     96       1.21     perry } __packed;
     97       1.11   thorpej 
     98       1.13   thorpej #define	READ_CAPACITY_10	0x25
     99       1.13   thorpej struct scsipi_read_capacity_10 {
    100       1.15   reinoud 	u_int8_t opcode;
    101       1.15   reinoud 	u_int8_t byte2;
    102       1.15   reinoud 	u_int8_t addr[4];
    103       1.15   reinoud 	u_int8_t unused[3];
    104       1.15   reinoud 	u_int8_t control;
    105       1.21     perry } __packed;
    106        1.2    bouyer 
    107        1.2    bouyer /* DATAs definitions for the above commands */
    108        1.2    bouyer 
    109       1.13   thorpej struct scsipi_read_capacity_10_data {
    110       1.15   reinoud 	u_int8_t addr[4];
    111       1.15   reinoud 	u_int8_t length[4];
    112       1.21     perry } __packed;
    113        1.9   mycroft 
    114       1.10   thorpej #define	READ_CAPACITY_16	0x9e	/* really SERVICE ACTION IN */
    115       1.10   thorpej struct scsipi_read_capacity_16 {
    116       1.15   reinoud 	u_int8_t opcode;
    117       1.15   reinoud 	u_int8_t byte2;
    118       1.10   thorpej #define	SRC16_SERVICE_ACTION	0x10
    119       1.15   reinoud 	u_int8_t addr[8];
    120       1.15   reinoud 	u_int8_t len[4];
    121       1.15   reinoud 	u_int8_t byte15;
    122       1.10   thorpej #define	SRC16_PMI		0x01
    123       1.15   reinoud 	u_int8_t control;
    124       1.21     perry } __packed;
    125       1.10   thorpej 
    126       1.10   thorpej struct scsipi_read_capacity_16_data {
    127       1.15   reinoud 	u_int8_t addr[8];
    128       1.15   reinoud 	u_int8_t length[4];
    129       1.15   reinoud 	u_int8_t byte13;
    130       1.10   thorpej #define	SRC16D_PROT_EN		0x01
    131       1.10   thorpej #define	SRC16D_RTO_EN		0x02
    132       1.15   reinoud 	u_int8_t reserved[19];
    133       1.21     perry } __packed;
    134       1.10   thorpej 
    135       1.10   thorpej /* XXX SBC-2 says this is vendor-specific */
    136        1.9   mycroft #define READ_FORMAT_CAPACITIES	0x23
    137        1.9   mycroft struct scsipi_read_format_capacities {
    138       1.15   reinoud 	u_int8_t opcode;
    139       1.15   reinoud 	u_int8_t byte2;
    140       1.15   reinoud 	u_int8_t reserved1[5];
    141       1.15   reinoud 	u_int8_t length[2];
    142       1.15   reinoud 	u_int8_t reserved2[3];
    143       1.21     perry } __packed;
    144        1.9   mycroft 
    145        1.9   mycroft struct scsipi_capacity_list_header {
    146       1.15   reinoud 	u_int8_t reserved[3];
    147       1.15   reinoud 	u_int8_t length;
    148       1.21     perry } __packed;
    149        1.9   mycroft 
    150        1.9   mycroft struct scsipi_capacity_descriptor {
    151       1.15   reinoud 	u_int8_t nblks[4];
    152       1.15   reinoud 	u_int8_t byte5;
    153       1.15   reinoud 	u_int8_t blklen[3];
    154       1.21     perry } __packed;
    155        1.9   mycroft 
    156        1.9   mycroft /* codes only valid in the current/maximum capacity descriptor */
    157        1.9   mycroft #define	SCSIPI_CAP_DESC_CODE_MASK		0x3
    158        1.9   mycroft #define	SCSIPI_CAP_DESC_CODE_RESERVED		0x0
    159        1.9   mycroft #define	SCSIPI_CAP_DESC_CODE_UNFORMATTED	0x1
    160        1.9   mycroft #define	SCSIPI_CAP_DESC_CODE_FORMATTED		0x2
    161        1.9   mycroft #define	SCSIPI_CAP_DESC_CODE_NONE		0x3
    162        1.8      matt 
    163  1.21.78.1  pgoyette /* defines for the device specific byte in the mode select/sense header */
    164  1.21.78.1  pgoyette #define	SMH_DSP_DPOFUA		0x10
    165  1.21.78.1  pgoyette 
    166        1.8      matt #endif /* _DEV_SCSIPI_SCSIPI_DISK_H_ */
    167