11709Smlf /* 21709Smlf * CDDL HEADER START 31709Smlf * 41709Smlf * The contents of this file are subject to the terms of the 5*3652Syt160523 * Common Development and Distribution License (the "License"). 61709Smlf * You may not use this file except in compliance with the License. 71709Smlf * 81709Smlf * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 91709Smlf * or http://www.opensolaris.org/os/licensing. 101709Smlf * See the License for the specific language governing permissions 111709Smlf * and limitations under the License. 121709Smlf * 131709Smlf * When distributing Covered Code, include this CDDL HEADER in each 141709Smlf * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 151709Smlf * If applicable, add the following below this CDDL HEADER, with the 161709Smlf * fields enclosed by brackets "[]" replaced with your own identifying 171709Smlf * information: Portions Copyright [yyyy] [name of copyright owner] 181709Smlf * 191709Smlf * CDDL HEADER END 201709Smlf */ 211709Smlf 221709Smlf /* 23*3652Syt160523 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 241709Smlf * Use is subject to license terms. 251709Smlf */ 261709Smlf 271709Smlf #ifndef _ATA_DISK_H 281709Smlf #define _ATA_DISK_H 291709Smlf 301709Smlf #pragma ident "%Z%%M% %I% %E% SMI" 311709Smlf 321709Smlf #ifdef __cplusplus 331709Smlf extern "C" { 341709Smlf #endif 351709Smlf 361709Smlf /* 371709Smlf * ATA disk commands. 381709Smlf */ 391709Smlf 401709Smlf #define ATC_SEEK 0x70 /* seek cmd, bottom 4 bits step rate */ 411709Smlf #define ATC_RDVER 0x40 /* read verify cmd */ 421709Smlf #define ATC_RDSEC 0x20 /* read sector cmd */ 431709Smlf #define ATC_RDLONG 0x23 /* read long without retry */ 441709Smlf #define ATC_WRSEC 0x30 /* write sector cmd */ 451709Smlf #define ATC_SETMULT 0xc6 /* set multiple mode */ 461709Smlf #define ATC_RDMULT 0xc4 /* read multiple */ 471709Smlf #define ATC_WRMULT 0xc5 /* write multiple */ 481709Smlf #define ATC_READ_DMA 0xc8 /* read (multiple) w/DMA */ 491709Smlf #define ATC_WRITE_DMA 0xca /* write (multiple) w/DMA */ 501709Smlf #define ATC_SETPARAM 0x91 /* set parameters command */ 511709Smlf #define ATC_ID_DEVICE 0xec /* IDENTIFY DEVICE command */ 521709Smlf #define ATC_ACK_MC 0xdb /* acknowledge media change */ 53*3652Syt160523 #define ATC_LOAD_FW 0x92 /* download microcode */ 541709Smlf /* ATA extended (48 bit) disk commands */ 551709Smlf #define ATC_RDSEC_EXT 0x24 /* read sector */ 561709Smlf #define ATC_RDMULT_EXT 0x29 /* read multiple */ 571709Smlf #define ATC_RDDMA_EXT 0x25 /* read DMA */ 581709Smlf #define ATC_WRSEC_EXT 0x34 /* write sector */ 591709Smlf #define ATC_WRMULT_EXT 0x39 /* write multiple */ 601709Smlf #define ATC_WRDMA_EXT 0x35 /* write DMA */ 611709Smlf 621709Smlf /* 631709Smlf * Low bits for Read/Write commands... 641709Smlf */ 651709Smlf #define ATCM_ECCRETRY 0x01 /* Enable ECC and RETRY by controller */ 661709Smlf /* enabled if bit is CLEARED!!! */ 671709Smlf #define ATCM_LONGMODE 0x02 /* Use Long Mode (get/send data & ECC) */ 681709Smlf 69*3652Syt160523 /* 70*3652Syt160523 * subcommand for DOWNLOAD MICROCODE command 71*3652Syt160523 */ 72*3652Syt160523 #define ATCM_FW_TEMP 0x01 /* immediate, temporary use */ 73*3652Syt160523 #define ATCM_FW_MULTICMD 0x03 /* immediate and future use */ 74*3652Syt160523 #define ATCM_FW_PERM 0x07 /* immediate and future use */ 75*3652Syt160523 761709Smlf #ifdef DADKIO_RWCMD_READ 771709Smlf #define RWCMDP(pktp) ((struct dadkio_rwcmd *)((pktp)->cp_bp->b_back)) 781709Smlf #endif 791709Smlf 801709Smlf /* useful macros */ 811709Smlf 821709Smlf #define CPKT2GCMD(cpkt) ((gcmd_t *)(cpkt)->cp_ctl_private) 831709Smlf #define CPKT2APKT(cpkt) (GCMD2APKT(CPKT2GCMD(cpkt))) 841709Smlf 851709Smlf #define GCMD2CPKT(cmdp) ((struct cmpkt *)((cmdp)->cmd_pktp)) 861709Smlf #define APKT2CPKT(apkt) (GCMD2CPKT(APKT2GCMD(apkt))) 871709Smlf 881709Smlf /* public function prototypes */ 891709Smlf 901709Smlf int ata_disk_attach(ata_ctl_t *ata_ctlp); 911709Smlf void ata_disk_detach(ata_ctl_t *ata_ctlp); 921709Smlf int ata_disk_init_drive(ata_drv_t *ata_drvp); 931709Smlf void ata_disk_uninit_drive(ata_drv_t *ata_drvp); 941709Smlf int ata_disk_id(ddi_acc_handle_t io_hdl1, caddr_t ioaddr1, 951709Smlf ddi_acc_handle_t io_hdl2, caddr_t ioaddr2, 961709Smlf struct ata_id *ata_idp); 971709Smlf int ata_disk_bus_ctl(dev_info_t *d, dev_info_t *r, ddi_ctl_enum_t o, 981709Smlf void *a, void *v); 991709Smlf int ata_disk_setup_parms(ata_ctl_t *ata_ctlp, ata_drv_t *ata_drvp); 1001709Smlf 1011709Smlf #ifdef __cplusplus 1021709Smlf } 1031709Smlf #endif 1041709Smlf 1051709Smlf #endif /* _ATA_DISK_H */ 106