xref: /titanic_51/usr/src/uts/sun4/io/fpc/fpc-impl.h (revision 672986541be54a7a471bb088e60780c37e371d7e)
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 2006 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_FPC_IMPL_H
28 #define	_FPC_IMPL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /* Hide what's behind the platform-specific handle from the common files. */
37 typedef struct __fire_perfreg_handle_t *fire_perfreg_handle_t;
38 
39 #define	IS_READ		B_FALSE
40 #define	IS_WRITE	B_TRUE
41 
42 typedef struct {
43 	char		*name;
44 	kmutex_t	mutex;
45 	void		*plat_data_p;
46 } node_data_t;
47 
48 /* Functions exported by platform specific file. */
49 
50 extern int fpc_platform_check();
51 extern int fpc_platform_module_init(dev_info_t *dip);
52 extern int fpc_platform_node_init(dev_info_t *dip, int *avail);
53 extern void fpc_platform_node_fini(void *arg);
54 extern void fpc_platform_module_fini(dev_info_t *dip);
55 extern fire_perfreg_handle_t fpc_get_perfreg_handle(int devnum);
56 extern int fpc_free_counter_handle(fire_perfreg_handle_t);
57 extern int fpc_event_io(fire_perfreg_handle_t handle, fire_perfcnt_t group,
58     uint64_t *event, boolean_t is_write);
59 extern int fpc_counter_io(fire_perfreg_handle_t handle, fire_perfcnt_t group,
60     int counter_index, uint64_t *value, boolean_t is_write);
61 
62 /* Functions exported by common file. */
63 extern void fpc_common_node_setup(dev_info_t *dip, int *index_p);
64 extern char *fpc_get_dev_name_by_number(int index);
65 extern void *fpc_get_platform_data_by_number(int index);
66 extern int fpc_set_platform_data_by_number(int index, void *data);
67 
68 #ifdef	__cplusplus
69 }
70 #endif
71 
72 #endif	/* _FPC_IMPL_H */
73