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