xref: /titanic_51/usr/src/common/elfcap/elfcap.h (revision 09fe1b16b0d85a4b43987628152f516df3ae9838)
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 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _ELFCAP_DOT_H
28 #define	_ELFCAP_DOT_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/types.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 /*
39  * Define a capabilities descriptor.
40  */
41 typedef	struct {
42 	uint64_t	c_val;
43 	const char	*c_str;
44 	size_t		c_len;
45 } Cap_desc;
46 
47 /*
48  * Define a format descriptor.
49  */
50 typedef struct {
51 	const char	*f_str;
52 	size_t		f_len;
53 } Fmt_desc;
54 
55 /*
56  * Define valid format values.
57  */
58 #define	CAP_FMT_SNGSPACE	0
59 #define	CAP_FMT_DBLSPACE	1
60 #define	CAP_FMT_PIPSPACE	2
61 
62 #define	CAP_MAX_TYPE		CAP_FMT_PIPSPACE
63 
64 /*
65  * Define error return values.
66  */
67 #define	CAP_ERR_BUFOVFL		1		/* buffer overfow */
68 #define	CAP_ERR_INVFMT		2		/* invalid format */
69 #define	CAP_ERR_UNKTAG		3		/* unknown capabilities tag */
70 #define	CAP_ERR_UNKMACH		4		/* unknown machine type */
71 
72 
73 extern int	cap_val2str(uint64_t, uint64_t, char *, size_t, int, ushort_t);
74 extern int	hwcap_1_val2str(uint64_t, char *, size_t, int, ushort_t);
75 extern int	sfcap_1_val2str(uint64_t, char *, size_t, int, ushort_t);
76 extern uint64_t	hwcap_1_str2val(const char *, ushort_t mach);
77 extern uint64_t	sfcap_1_str2val(const char *, ushort_t mach);
78 
79 #ifdef	__cplusplus
80 }
81 #endif
82 
83 #endif /* _ELFCAP_DOT_H */
84