xref: /titanic_41/usr/src/uts/sun/sys/dada/impl/commands.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1996-2001 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef	_SYS_DADA_IMPL_COMMANDS_H
28 #define	_SYS_DADA_IMPL_COMMANDS_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * Implementation dependent view of a ATA command descriptor block
38  */
39 
40 struct	dcd_cmd	{
41 	uchar_t	cmd;				/* The ATA command */
42 	uchar_t	address_mode;			/* Mode of addressing */
43 	uchar_t	direction;			/* Not SCSI to be indicated */
44 	uchar_t  features;			/* Any features to be enabled */
45 	uint_t	size;				/* size in bytes */
46 	uint_t	version;			/* version number */
47 	union {
48 		uint_t	lba_num;		/* LBA number if LBA */
49 						/* mode is used */
50 		struct	chs {
51 			ushort_t	cylinder;	/* Cylinder Number */
52 			uchar_t		head;		/* Head number */
53 			uchar_t		sector;		/* Sector Number */
54 		} chs_address;
55 	} sector_num;
56 };
57 
58 #define	GETATACMD(cdb)	((cdb)->cmd)
59 
60 /*
61  * Direct Access Device Capacity Structure
62  */
63 struct dcd_capacity {
64 	uchar_t		heads;
65 	uchar_t		sectors;
66 	ushort_t	ncyls;
67 	uint_t		capacity;
68 	uint_t		lbasize;
69 };
70 
71 
72 /* The following are the defines for the commands. */
73 
74 #define	IDENTIFY		0xEC		/* Identify Device */
75 #define	IDENTIFY_DMA		0xEE		/* Identify DMA	   */
76 #define	ATA_RECALIBRATE		0x10		/* Recalibrate */
77 #define	ATA_READ		0x20		/* With retries */
78 #define	ATA_WRITE		0x30		/* With retries */
79 #define	ATA_SET_MULTIPLE 	0xC6		/* Set Multiple */
80 #define	ATA_READ_MULTIPLE	0xC4		/* Read Multiple */
81 #define	ATA_WRITE_MULTIPLE	0xC5		/* Write Multiple */
82 #define	ATA_READ_DMA		0xC8		/* Read DMA with retries */
83 #define	ATA_WRITE_DMA		0xCA		/* Write DMA with reties */
84 #define	ATA_SET_FEATURES	0xEF		/* Set features */
85 #define	ATA_IDLE_IMMEDIATE	0xE1		/* Idle immediate */
86 #define	ATA_STANDBY_IMMEDIATE	0xE0		/* Standby Immediate */
87 #define	ATA_FLUSH_CACHE		0xE7		/* Flush Cache */
88 #define	ATA_DOWNLOAD_MICROCODE	0x92		/* Download microcode */
89 
90 /* The following are the defines for the direction. */
91 
92 #define	DATA_READ		0x01		/* READ from disk */
93 #define	DATA_WRITE		0x02		/* WRITE to disk */
94 #define	NO_DATA_XFER		0x00		/* No data xfer involved */
95 
96 /* The following are the defines for the address mode */
97 
98 #define	ADD_LBA_MODE		0x01		/* LBA Mode of addressing */
99 #define	ADD_CHS_MODE		0x02		/* Cylinder Head Sector mode */
100 
101 /* The following are the usefull subcommands for set features command */
102 #define	ATA_FEATURE_SET_MODE 	0x03		/* This sets the mode */
103 
104 /* The following are the masks which are used for enabling DMA or PIO */
105 #define	ENABLE_PIO_FEATURE	0x08		/* PIO with flow control */
106 #define	ENABLE_DMA_FEATURE 	0x20		/* Enable DMA */
107 #define	ENABLE_ULTRA_FEATURE 	0x40		/* Enable ULTRA DMA */
108 
109 #ifdef	__cplusplus
110 }
111 #endif
112 
113 #endif /* _SYS_DADA_IMPL_COMMANDS_H */
114