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