1507c3241Smlf /* 2507c3241Smlf * CDDL HEADER START 3507c3241Smlf * 4507c3241Smlf * The contents of this file are subject to the terms of the 5507c3241Smlf * Common Development and Distribution License (the "License"). 6507c3241Smlf * You may not use this file except in compliance with the License. 7507c3241Smlf * 8507c3241Smlf * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9507c3241Smlf * or http://www.opensolaris.org/os/licensing. 10507c3241Smlf * See the License for the specific language governing permissions 11507c3241Smlf * and limitations under the License. 12507c3241Smlf * 13507c3241Smlf * When distributing Covered Code, include this CDDL HEADER in each 14507c3241Smlf * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15507c3241Smlf * If applicable, add the following below this CDDL HEADER, with the 16507c3241Smlf * fields enclosed by brackets "[]" replaced with your own identifying 17507c3241Smlf * information: Portions Copyright [yyyy] [name of copyright owner] 18507c3241Smlf * 19507c3241Smlf * CDDL HEADER END 20507c3241Smlf */ 21507c3241Smlf 22507c3241Smlf /* 23*0f2c99a4Syt160523 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 24507c3241Smlf * Use is subject to license terms. 25507c3241Smlf */ 26507c3241Smlf 27507c3241Smlf #ifndef _ATA_DISK_H 28507c3241Smlf #define _ATA_DISK_H 29507c3241Smlf 30507c3241Smlf #ifdef __cplusplus 31507c3241Smlf extern "C" { 32507c3241Smlf #endif 33507c3241Smlf 34507c3241Smlf /* 35507c3241Smlf * ATA disk commands. 36507c3241Smlf */ 37507c3241Smlf 38507c3241Smlf #define ATC_SEEK 0x70 /* seek cmd, bottom 4 bits step rate */ 39507c3241Smlf #define ATC_RDVER 0x40 /* read verify cmd */ 40507c3241Smlf #define ATC_RDSEC 0x20 /* read sector cmd */ 41507c3241Smlf #define ATC_RDLONG 0x23 /* read long without retry */ 42507c3241Smlf #define ATC_WRSEC 0x30 /* write sector cmd */ 43507c3241Smlf #define ATC_SETMULT 0xc6 /* set multiple mode */ 44507c3241Smlf #define ATC_RDMULT 0xc4 /* read multiple */ 45507c3241Smlf #define ATC_WRMULT 0xc5 /* write multiple */ 46507c3241Smlf #define ATC_READ_DMA 0xc8 /* read (multiple) w/DMA */ 47507c3241Smlf #define ATC_WRITE_DMA 0xca /* write (multiple) w/DMA */ 48507c3241Smlf #define ATC_SETPARAM 0x91 /* set parameters command */ 49507c3241Smlf #define ATC_ID_DEVICE 0xec /* IDENTIFY DEVICE command */ 50507c3241Smlf #define ATC_ACK_MC 0xdb /* acknowledge media change */ 51*0f2c99a4Syt160523 #define ATC_LOAD_FW 0x92 /* download microcode */ 52507c3241Smlf /* ATA extended (48 bit) disk commands */ 53507c3241Smlf #define ATC_RDSEC_EXT 0x24 /* read sector */ 54507c3241Smlf #define ATC_RDMULT_EXT 0x29 /* read multiple */ 55507c3241Smlf #define ATC_RDDMA_EXT 0x25 /* read DMA */ 56507c3241Smlf #define ATC_WRSEC_EXT 0x34 /* write sector */ 57507c3241Smlf #define ATC_WRMULT_EXT 0x39 /* write multiple */ 58507c3241Smlf #define ATC_WRDMA_EXT 0x35 /* write DMA */ 59507c3241Smlf 60507c3241Smlf /* 61507c3241Smlf * Low bits for Read/Write commands... 62507c3241Smlf */ 63507c3241Smlf #define ATCM_ECCRETRY 0x01 /* Enable ECC and RETRY by controller */ 64507c3241Smlf /* enabled if bit is CLEARED!!! */ 65507c3241Smlf #define ATCM_LONGMODE 0x02 /* Use Long Mode (get/send data & ECC) */ 66507c3241Smlf 67*0f2c99a4Syt160523 /* 68*0f2c99a4Syt160523 * subcommand for DOWNLOAD MICROCODE command 69*0f2c99a4Syt160523 */ 70*0f2c99a4Syt160523 #define ATCM_FW_TEMP 0x01 /* immediate, temporary use */ 71*0f2c99a4Syt160523 #define ATCM_FW_MULTICMD 0x03 /* immediate and future use */ 72*0f2c99a4Syt160523 #define ATCM_FW_PERM 0x07 /* immediate and future use */ 73*0f2c99a4Syt160523 74507c3241Smlf #ifdef DADKIO_RWCMD_READ 75507c3241Smlf #define RWCMDP(pktp) ((struct dadkio_rwcmd *)((pktp)->cp_bp->b_back)) 76507c3241Smlf #endif 77507c3241Smlf 78507c3241Smlf /* useful macros */ 79507c3241Smlf 80507c3241Smlf #define CPKT2GCMD(cpkt) ((gcmd_t *)(cpkt)->cp_ctl_private) 81507c3241Smlf #define CPKT2APKT(cpkt) (GCMD2APKT(CPKT2GCMD(cpkt))) 82507c3241Smlf 83507c3241Smlf #define GCMD2CPKT(cmdp) ((struct cmpkt *)((cmdp)->cmd_pktp)) 84507c3241Smlf #define APKT2CPKT(apkt) (GCMD2CPKT(APKT2GCMD(apkt))) 85507c3241Smlf 86507c3241Smlf /* public function prototypes */ 87507c3241Smlf 88507c3241Smlf int ata_disk_attach(ata_ctl_t *ata_ctlp); 89507c3241Smlf void ata_disk_detach(ata_ctl_t *ata_ctlp); 90507c3241Smlf int ata_disk_init_drive(ata_drv_t *ata_drvp); 91507c3241Smlf void ata_disk_uninit_drive(ata_drv_t *ata_drvp); 92507c3241Smlf int ata_disk_id(ddi_acc_handle_t io_hdl1, caddr_t ioaddr1, 93507c3241Smlf ddi_acc_handle_t io_hdl2, caddr_t ioaddr2, 94507c3241Smlf struct ata_id *ata_idp); 95507c3241Smlf int ata_disk_bus_ctl(dev_info_t *d, dev_info_t *r, ddi_ctl_enum_t o, 96507c3241Smlf void *a, void *v); 97507c3241Smlf int ata_disk_setup_parms(ata_ctl_t *ata_ctlp, ata_drv_t *ata_drvp); 98507c3241Smlf 99507c3241Smlf #ifdef __cplusplus 100507c3241Smlf } 101507c3241Smlf #endif 102507c3241Smlf 103507c3241Smlf #endif /* _ATA_DISK_H */ 104