Home | History | Annotate | Line # | Download | only in scsipi
atapiconf.h revision 1.6.2.1
      1 /*	$NetBSD: atapiconf.h,v 1.6.2.1 1998/06/04 16:53:07 bouyer Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1996 Manuel Bouyer.  All rights reserved.
      5  *
      6  * Redistribution and use in source and binary forms, with or without
      7  * modification, are permitted provided that the following conditions
      8  * are met:
      9  * 1. Redistributions of source code must retain the above copyright
     10  *    notice, this list of conditions and the following disclaimer.
     11  * 2. Redistributions in binary form must reproduce the above copyright
     12  *    notice, this list of conditions and the following disclaimer in the
     13  *    documentation and/or other materials provided with the distribution.
     14  * 3. All advertising materials mentioning features or use of this software
     15  *    must display the following acknowledgement:
     16  *	This product includes software developed by Manuel Bouyer.
     17  * 4. The name of the author may not be used to endorse or promote products
     18  *    derived from this software without specific prior written permission.
     19  *
     20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     21  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     22  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     23  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     25  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     29  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     30  */
     31 
     32 #include <dev/scsipi/scsipiconf.h>
     33 
     34 struct atapi_mode_header;
     35 struct ataparams;
     36 
     37 #if 0
     38 struct atapi_identify {
     39 	struct config_s {
     40 		u_int8_t cmd_drq_rem;
     41 #define ATAPI_PACKET_SIZE_MASK	0x03
     42 #define ATAPI_PACKET_SIZE_12	0x00
     43 #define ATAPI_PACKET_SIZE_16	0x01
     44 
     45 #define ATAPI_DRQ_MASK		0x60
     46 #define ATAPI_MICROPROCESSOR_DRQ 0x00
     47 #define ATAPI_INTERRUPT_DRQ	0x20
     48 #define ATAPI_ACCELERATED_DRQ	0x40
     49 
     50 #define ATAPI_REMOVABLE		0x80
     51 
     52 		u_int8_t device_type;
     53 #define ATAPI_DEVICE_TYPE_MASK	0x1f
     54 #define ATAPI_DEVICE_TYPE_DAD	0x00	/* direct access device */
     55 					/* 0x1-0x4 reserved */
     56 #define ATAPI_DEVICE_TYPE_CD	0x05	/* CD-ROM */
     57 					/* 0x6 reserved */
     58 #define ATAPI_DEVICE_TYPE_OMD	0x07	/* optical memory device */
     59 					/* 0x8-0x1e reserved */
     60 #define ATAPI_DEVICE_TYPE_UNKNOWN 0x1f
     61 
     62 #define ATAPI_GC_PROTOCOL_MASK	0xc0	/* mask of protocol bits */
     63 					/* 0x00 and 0x01 are ATA */
     64 #define ATAPI_GC_PROTO_TYPE_ATAPI 0x80
     65 #define ATAPI_GC_PROTO_TYPE_RESERVED 0xc0
     66 	} config;			/* general configuration */
     67 
     68 	u_int8_t cylinders[2];
     69 	u_int8_t reserved1[2];
     70 	u_int8_t heads[2];
     71 	u_int8_t unf_bytes_per_track[2];
     72 	u_int8_t unf_bytes_per_sector[2];
     73 	u_int8_t sectors_per_track[2];
     74 	u_int8_t reserved2[6];
     75 	char	 serial_number[20];
     76 	u_int8_t buffer_type[2];
     77 	u_int8_t buffer_size[2];
     78 	u_int8_t ECC_bytes_available[2];
     79 	char	 firmware_revision[8];
     80 	char	 model[40];
     81 	u_int8_t sector_count[2];
     82 	u_int8_t double_word[2];		/* == 0 for CD-ROMs */
     83 
     84 	struct capabilities_s {
     85 		u_int8_t vendor;
     86 		u_int8_t capflags;
     87 #define ATAPI_CAP_DMA			0x01	/* DMA supported */
     88 #define ATAPI_CAP_LBA			0x02	/* LBA supported */
     89 #define ATAPI_IORDY_DISABLE		0x04	/* IORDY can be disabled */
     90 #define ATAPI_IORDY			0x08	/* IORDY supported */
     91 	} capabilities;
     92 
     93 	u_int8_t reserved3[2];
     94 	u_int8_t PIO_cycle_timing[2];
     95 	u_int8_t DMA_cycle_timing[2];
     96 	u_int8_t validity[2];	/* of words 54-58, 64-70 in this table */
     97 
     98 #define ATAPI_VALID_FIRST	0x0	/* == 1 => words 54-58 are valid */
     99 #define ATAPI_VALID_SECOND	0x1	/* == 1 => words 64-70 are valid */
    100 
    101 	u_int8_t current_chs[6];	/* cylinder/head/sector */
    102 	u_int8_t current_capacity[4];
    103 	u_int8_t reserved4[2];
    104 	u_int8_t user_addressable_sectors[4];
    105 	u_int8_t singleword_DMA_mode[2];
    106 
    107 #define ATAPI_SW_DMA_MODE_AVAIL	0x00ff	/* Mode 0 is supported */
    108 #define ATAPI_SW_DMA_MODE_ACTIVE 0xff00	/* which mode is active */
    109 
    110 	u_int8_t multiword_DMA_mode[2];
    111 
    112 #define ATAPI_MW_DMA_MODE_AVAIL	0x00ff	/* Mode 0 is supported */
    113 #define ATAPI_MW_DMA_MODE_ACTIVE 0xff00	/* which mode is active */
    114 
    115 	u_int8_t enhanced_PIO_mode[2];
    116 
    117 #define ATAPI_ENHANCED_PIO_AVAIL 0x0001	/* PIO Mode 3 is supported */
    118 
    119 	u_int8_t blind_PIO_minimum_cycles[2];
    120 	u_int8_t mw_dma_tct[2];	/* multi-word DMA transfer cycle time */
    121 	u_int8_t min_PIO_tct_no_flow_control[2];
    122 	u_int8_t min_PIO_tct_with_flow_control[2];
    123 	u_int8_t reserved5[4];
    124 	u_int8_t reserved6[114];
    125 	u_int8_t vendor[64];		/* vendor unique */
    126 	u_int8_t reserved7[192];
    127 };
    128 
    129 #endif
    130 
    131 int	wdc_atapi_get_params __P((struct scsipi_link *, u_int8_t, int,
    132 	    struct ataparams *));
    133 void	atapi_print_addr __P((struct scsipi_link *));
    134 int	atapi_interpret_sense __P((struct scsipi_xfer *));
    135 int	atapi_scsipi_cmd __P((struct scsipi_link *, struct scsipi_generic *,
    136 	    int, u_char *, int, int, int, struct buf *, int));
    137 int	atapi_mode_select __P((struct scsipi_link *,
    138 	    struct atapi_mode_header *, int, int, int, int));
    139 int	atapi_mode_sense __P((struct scsipi_link *, int,
    140 	    struct atapi_mode_header *, int, int, int, int));
    141