xref: /illumos-gate/usr/src/uts/sun4/io/fpc/fpc-impl.h (revision d6bb6a8465e557cb946ef49d56ed3202f6218652)
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_module_init(dev_info_t *dip);
51 extern int fpc_platform_node_init(dev_info_t *dip, int *avail);
52 extern void fpc_platform_node_fini(void *arg);
53 extern void fpc_platform_module_fini(dev_info_t *dip);
54 extern fire_perfreg_handle_t fpc_get_perfreg_handle(int devnum);
55 extern int fpc_free_counter_handle(fire_perfreg_handle_t);
56 extern int fpc_event_io(fire_perfreg_handle_t handle, fire_perfcnt_t group,
57     uint64_t *event, boolean_t is_write);
58 extern int fpc_counter_io(fire_perfreg_handle_t handle, fire_perfcnt_t group,
59     int counter_index, uint64_t *value, boolean_t is_write);
60 
61 /* Functions exported by common file. */
62 extern void fpc_common_node_setup(dev_info_t *dip, int *index_p);
63 extern char *fpc_get_dev_name_by_number(int index);
64 extern void *fpc_get_platform_data_by_number(int index);
65 extern int fpc_set_platform_data_by_number(int index, void *data);
66 
67 #ifdef	__cplusplus
68 }
69 #endif
70 
71 #endif	/* _FPC_IMPL_H */
72