1*507c3241Smlf /* 2*507c3241Smlf * CDDL HEADER START 3*507c3241Smlf * 4*507c3241Smlf * The contents of this file are subject to the terms of the 5*507c3241Smlf * Common Development and Distribution License (the "License"). 6*507c3241Smlf * You may not use this file except in compliance with the License. 7*507c3241Smlf * 8*507c3241Smlf * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*507c3241Smlf * or http://www.opensolaris.org/os/licensing. 10*507c3241Smlf * See the License for the specific language governing permissions 11*507c3241Smlf * and limitations under the License. 12*507c3241Smlf * 13*507c3241Smlf * When distributing Covered Code, include this CDDL HEADER in each 14*507c3241Smlf * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*507c3241Smlf * If applicable, add the following below this CDDL HEADER, with the 16*507c3241Smlf * fields enclosed by brackets "[]" replaced with your own identifying 17*507c3241Smlf * information: Portions Copyright [yyyy] [name of copyright owner] 18*507c3241Smlf * 19*507c3241Smlf * CDDL HEADER END 20*507c3241Smlf */ 21*507c3241Smlf 22*507c3241Smlf /* 23*507c3241Smlf * Copyright 1997 Sun Microsystems, Inc. All rights reserved. 24*507c3241Smlf * Use is subject to license terms. 25*507c3241Smlf */ 26*507c3241Smlf 27*507c3241Smlf #ifndef _ATAPI_H 28*507c3241Smlf #define _ATAPI_H 29*507c3241Smlf 30*507c3241Smlf #ifdef __cplusplus 31*507c3241Smlf extern "C" { 32*507c3241Smlf #endif 33*507c3241Smlf 34*507c3241Smlf 35*507c3241Smlf /* 36*507c3241Smlf * Additional atapi status bits (redefinitions) 37*507c3241Smlf */ 38*507c3241Smlf #define ATE_ILI 0x01 /* Illegal length indication */ 39*507c3241Smlf #define ATE_EOM 0x02 /* End of media detected */ 40*507c3241Smlf #define ATE_MCR 0x08 /* Media change requested */ 41*507c3241Smlf #define ATS_SERVICE 0x10 /* overlap operation needs service */ 42*507c3241Smlf #define ATS_SENSE_KEY 0xf0 /* 4 bit sense key -see ata_sense_table */ 43*507c3241Smlf 44*507c3241Smlf #define ATS_SENSE_KEY_SHIFT 4 /* shift to get to ATS_SENSE_KEY */ 45*507c3241Smlf 46*507c3241Smlf /* 47*507c3241Smlf * Status bits from ATAPI Interrupt reason register (AT_COUNT) register 48*507c3241Smlf */ 49*507c3241Smlf #define ATI_COD 0x01 /* Command or Data */ 50*507c3241Smlf #define ATI_IO 0x02 /* IO direction */ 51*507c3241Smlf #define ATI_RELEASE 0x04 /* Release for ATAPI overlap */ 52*507c3241Smlf 53*507c3241Smlf /* ATAPI feature reg definitions */ 54*507c3241Smlf 55*507c3241Smlf #define ATF_OVERLAP 0x02 56*507c3241Smlf 57*507c3241Smlf /* 58*507c3241Smlf * ATAPI IDENTIFY_DRIVE configuration word 59*507c3241Smlf */ 60*507c3241Smlf 61*507c3241Smlf #define ATAPI_ID_CFG_PKT_SZ 0x3 62*507c3241Smlf #define ATAPI_ID_CFG_PKT_12B 0x0 63*507c3241Smlf #define ATAPI_ID_CFG_PKT_16B 0x1 64*507c3241Smlf #define ATAPI_ID_CFG_DRQ_TYPE 0x60 65*507c3241Smlf #define ATAPI_ID_CFG_DRQ_INTR 0x20 66*507c3241Smlf #define ATAPI_ID_CFG_DEV_TYPE 0x0f00 67*507c3241Smlf #define ATAPI_ID_CFG_DEV_SHFT 8 68*507c3241Smlf 69*507c3241Smlf /* 70*507c3241Smlf * ATAPI IDENTIFY_DRIVE capabilities word 71*507c3241Smlf */ 72*507c3241Smlf 73*507c3241Smlf #define ATAPI_ID_CAP_DMA 0x0100 74*507c3241Smlf #define ATAPI_ID_CAP_OVERLAP 0x2000 75*507c3241Smlf 76*507c3241Smlf /* ATAPI SET FEATURE commands */ 77*507c3241Smlf 78*507c3241Smlf #define ATAPI_FEAT_RELEASE_INTR 0x5d 79*507c3241Smlf #define ATAPI_FEAT_SERVICE_INTR 0x5e 80*507c3241Smlf 81*507c3241Smlf /* 82*507c3241Smlf * ATAPI bits 83*507c3241Smlf */ 84*507c3241Smlf #define ATAPI_SIG_HI 0xeb /* in high cylinder register */ 85*507c3241Smlf #define ATAPI_SIG_LO 0x14 /* in low cylinder register */ 86*507c3241Smlf 87*507c3241Smlf 88*507c3241Smlf #define ATAPI_SECTOR_SIZE 2048 89*507c3241Smlf #define ATAPI_MAX_BYTES_PER_DRQ 0xf800 /* 16 bits - 2KB ie 62KB */ 90*507c3241Smlf #define ATAPI_HEADS 64 91*507c3241Smlf #define ATAPI_SECTORS_PER_TRK 32 92*507c3241Smlf 93*507c3241Smlf /* Useful macros */ 94*507c3241Smlf 95*507c3241Smlf #define TRAN2CTL(tran) ((ata_ctl_t *)((tran)->tran_hba_private)) 96*507c3241Smlf #define ADDR2CTL(ap) (TRAN2CTL(ADDR2TRAN(ap))) 97*507c3241Smlf 98*507c3241Smlf #define SPKT2APKT(spkt) (GCMD2APKT(PKTP2GCMDP(spkt))) 99*507c3241Smlf #define APKT2SPKT(apkt) (GCMDP2PKTP(APKT2GCMD(apkt))) 100*507c3241Smlf 101*507c3241Smlf /* public function prototypes */ 102*507c3241Smlf 103*507c3241Smlf int atapi_attach(ata_ctl_t *ata_ctlp); 104*507c3241Smlf void atapi_detach(ata_ctl_t *ata_ctlp); 105*507c3241Smlf void atapi_init_arq(ata_ctl_t *ata_ctlp); 106*507c3241Smlf int atapi_init_drive(ata_drv_t *ata_drvp); 107*507c3241Smlf void atapi_uninit_drive(ata_drv_t *ata_drvp); 108*507c3241Smlf 109*507c3241Smlf int atapi_id(ddi_acc_handle_t io_hdl1, caddr_t ioaddr1, 110*507c3241Smlf ddi_acc_handle_t io_hdl2, caddr_t ioaddr2, struct ata_id *buf); 111*507c3241Smlf int atapi_signature(ddi_acc_handle_t io_hdl, caddr_t ioaddr); 112*507c3241Smlf 113*507c3241Smlf int atapi_ccballoc(gtgt_t *gtgtp, gcmd_t *gcmdp, int cmdlen, 114*507c3241Smlf int statuslen, int tgtlen, int ccblen); 115*507c3241Smlf void atapi_ccbfree(gcmd_t *gcmdp); 116*507c3241Smlf 117*507c3241Smlf 118*507c3241Smlf int atapi_fsm_intr(ata_ctl_t *ata_ctlp, ata_drv_t *ata_drvp, 119*507c3241Smlf ata_pkt_t *ata_pktp); 120*507c3241Smlf int atapi_fsm_start(ata_ctl_t *ata_ctlp, ata_drv_t *ata_drvp, 121*507c3241Smlf ata_pkt_t *ata_pktp); 122*507c3241Smlf void atapi_fsm_reset(ata_ctl_t *ata_ctlp); 123*507c3241Smlf 124*507c3241Smlf 125*507c3241Smlf 126*507c3241Smlf #ifdef __cplusplus 127*507c3241Smlf } 128*507c3241Smlf #endif 129*507c3241Smlf 130*507c3241Smlf #endif /* _ATAPI_H */ 131