xref: /titanic_44/usr/src/uts/intel/io/dktp/controller/ata/ata_disk.h (revision 0f2c99a46e005b1add7df43157ee8516e585157a)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _ATA_DISK_H
28 #define	_ATA_DISK_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * ATA disk commands.
38  */
39 
40 #define	ATC_SEEK	0x70    /* seek cmd, bottom 4 bits step rate 	*/
41 #define	ATC_RDVER	0x40	/* read verify cmd			*/
42 #define	ATC_RDSEC	0x20    /* read sector cmd			*/
43 #define	ATC_RDLONG	0x23    /* read long without retry		*/
44 #define	ATC_WRSEC	0x30    /* write sector cmd			*/
45 #define	ATC_SETMULT	0xc6	/* set multiple mode			*/
46 #define	ATC_RDMULT	0xc4	/* read multiple			*/
47 #define	ATC_WRMULT	0xc5	/* write multiple			*/
48 #define	ATC_READ_DMA	0xc8	/* read (multiple) w/DMA		*/
49 #define	ATC_WRITE_DMA	0xca	/* write (multiple) w/DMA		*/
50 #define	ATC_SETPARAM	0x91	/* set parameters command 		*/
51 #define	ATC_ID_DEVICE	0xec    /* IDENTIFY DEVICE command 		*/
52 #define	ATC_ACK_MC	0xdb	/* acknowledge media change		*/
53 #define	ATC_LOAD_FW	0x92	/* download microcode			*/
54 	/* ATA extended (48 bit) disk commands */
55 #define	ATC_RDSEC_EXT	0x24	/* read sector */
56 #define	ATC_RDMULT_EXT	0x29	/* read multiple */
57 #define	ATC_RDDMA_EXT	0x25	/* read DMA */
58 #define	ATC_WRSEC_EXT	0x34	/* write sector */
59 #define	ATC_WRMULT_EXT	0x39	/* write multiple */
60 #define	ATC_WRDMA_EXT	0x35	/* write DMA */
61 
62 /*
63  * Low bits for Read/Write commands...
64  */
65 #define	ATCM_ECCRETRY	0x01    /* Enable ECC and RETRY by controller 	*/
66 				/* enabled if bit is CLEARED!!! 	*/
67 #define	ATCM_LONGMODE	0x02    /* Use Long Mode (get/send data & ECC) 	*/
68 
69 /*
70  * subcommand for DOWNLOAD MICROCODE command
71  */
72 #define	ATCM_FW_TEMP		0x01 /* immediate, temporary use	*/
73 #define	ATCM_FW_MULTICMD	0x03 /* immediate and future use	*/
74 #define	ATCM_FW_PERM		0x07 /* immediate and future use	*/
75 
76 #ifdef  DADKIO_RWCMD_READ
77 #define	RWCMDP(pktp)  ((struct dadkio_rwcmd *)((pktp)->cp_bp->b_back))
78 #endif
79 
80 /* useful macros */
81 
82 #define	CPKT2GCMD(cpkt)	((gcmd_t *)(cpkt)->cp_ctl_private)
83 #define	CPKT2APKT(cpkt)  (GCMD2APKT(CPKT2GCMD(cpkt)))
84 
85 #define	GCMD2CPKT(cmdp)	((struct cmpkt *)((cmdp)->cmd_pktp))
86 #define	APKT2CPKT(apkt) (GCMD2CPKT(APKT2GCMD(apkt)))
87 
88 /* public function prototypes */
89 
90 int	ata_disk_attach(ata_ctl_t *ata_ctlp);
91 void	ata_disk_detach(ata_ctl_t *ata_ctlp);
92 int	ata_disk_init_drive(ata_drv_t *ata_drvp);
93 void	ata_disk_uninit_drive(ata_drv_t *ata_drvp);
94 int	ata_disk_id(ddi_acc_handle_t io_hdl1, caddr_t ioaddr1,
95 		ddi_acc_handle_t io_hdl2, caddr_t ioaddr2,
96 		struct ata_id *ata_idp);
97 int	ata_disk_bus_ctl(dev_info_t *d, dev_info_t *r, ddi_ctl_enum_t o,
98 		void *a, void *v);
99 int	ata_disk_setup_parms(ata_ctl_t *ata_ctlp, ata_drv_t *ata_drvp);
100 
101 #ifdef	__cplusplus
102 }
103 #endif
104 
105 #endif /* _ATA_DISK_H */
106