xref: /illumos-gate/usr/src/cmd/format/ctlr_ata.h (revision 581cede61ac9c14d8d4ea452562a567189eead78)
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 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_CTLR_ATA_H
28 #define	_CTLR_ATA_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 #include <sys/buf.h>
35 
36 
37 /*
38  * Rounded parameter, as returned in Extended Sense information
39  */
40 #define	ROUNDED_PARAMETER	0x37
41 
42 
43 /*
44  * Convert a three-byte triplet into an int
45  */
46 #define	TRIPLET(u, m, l)	((int)((((u))&0xff<<16) + \
47 				(((m)&0xff)<<8) + (l&0xff)))
48 #if	defined(i386)
49 diskaddr_t	altsec_offset;	/* Alternate sector offset */
50 #endif	/* defined(i386) */
51 
52 #ifdef	__STDC__
53 /*
54  *	Local prototypes for ANSI C compilers
55  */
56 
57 #if	defined(i386)
58 int	ata_rdwr(int, int, diskaddr_t, int, caddr_t, int, int *);
59 #else	/* defined(i386) */
60 static int	ata_rdwr(int, int, diskaddr_t, int, caddr_t, int, int *);
61 #endif	/* defined(i386) */
62 
63 int	ata_ex_man(struct defect_list *);
64 int	ata_ex_grown(struct defect_list *);
65 int	ata_read_defect_data(struct defect_list *, int);
66 int	apply_chg_list(int, int, uchar_t *, uchar_t *, struct chg_list *);
67 
68 #else /* ! _STDC_ */
69 
70 #if	defined(i386)
71 int	ata_rdwr();
72 int	ata_ex_cur();
73 #else	/* defined(i386) */
74 static int	ata_rdwr();
75 static int	ata_ex_cur();
76 #endif	/* defined(i386) */
77 
78 int	ata_ck_format();
79 int	ata_ex_man();
80 int	ata_ex_grown();
81 int	ata_read_defect_data();
82 int	apply_chg_list();
83 
84 #endif	/* __STDC__ */
85 
86 #ifdef	__cplusplus
87 }
88 #endif
89 
90 #endif	/* _CTLR_ATA_H */
91