xref: /illumos-gate/usr/src/uts/sun4/io/fpc/fpc-impl.h (revision 0ad689d6)
1110e73f9Sschwartz /*
2110e73f9Sschwartz  * CDDL HEADER START
3110e73f9Sschwartz  *
4110e73f9Sschwartz  * The contents of this file are subject to the terms of the
5110e73f9Sschwartz  * Common Development and Distribution License (the "License").
6110e73f9Sschwartz  * You may not use this file except in compliance with the License.
7110e73f9Sschwartz  *
8110e73f9Sschwartz  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9110e73f9Sschwartz  * or http://www.opensolaris.org/os/licensing.
10110e73f9Sschwartz  * See the License for the specific language governing permissions
11110e73f9Sschwartz  * and limitations under the License.
12110e73f9Sschwartz  *
13110e73f9Sschwartz  * When distributing Covered Code, include this CDDL HEADER in each
14110e73f9Sschwartz  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15110e73f9Sschwartz  * If applicable, add the following below this CDDL HEADER, with the
16110e73f9Sschwartz  * fields enclosed by brackets "[]" replaced with your own identifying
17110e73f9Sschwartz  * information: Portions Copyright [yyyy] [name of copyright owner]
18110e73f9Sschwartz  *
19110e73f9Sschwartz  * CDDL HEADER END
20110e73f9Sschwartz  */
21110e73f9Sschwartz 
22110e73f9Sschwartz /*
23110e73f9Sschwartz  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24110e73f9Sschwartz  * Use is subject to license terms.
25110e73f9Sschwartz  */
26110e73f9Sschwartz 
27110e73f9Sschwartz #ifndef	_FPC_IMPL_H
28110e73f9Sschwartz #define	_FPC_IMPL_H
29110e73f9Sschwartz 
30110e73f9Sschwartz #pragma ident	"%Z%%M%	%I%	%E% SMI"
31110e73f9Sschwartz 
32110e73f9Sschwartz #ifdef	__cplusplus
33110e73f9Sschwartz extern "C" {
34110e73f9Sschwartz #endif
35110e73f9Sschwartz 
36110e73f9Sschwartz /* Hide what's behind the platform-specific handle from the common files. */
37110e73f9Sschwartz typedef struct __fire_perfreg_handle_t *fire_perfreg_handle_t;
38110e73f9Sschwartz 
39110e73f9Sschwartz #define	IS_READ		B_FALSE
40110e73f9Sschwartz #define	IS_WRITE	B_TRUE
41110e73f9Sschwartz 
42110e73f9Sschwartz typedef struct {
43110e73f9Sschwartz 	char		*name;
44110e73f9Sschwartz 	kmutex_t	mutex;
45110e73f9Sschwartz 	void		*plat_data_p;
46110e73f9Sschwartz } node_data_t;
47110e73f9Sschwartz 
48110e73f9Sschwartz /* Functions exported by platform specific file. */
49110e73f9Sschwartz 
50*0ad689d6Sschwartz extern int fpc_platform_check();
51110e73f9Sschwartz extern int fpc_platform_module_init(dev_info_t *dip);
52110e73f9Sschwartz extern int fpc_platform_node_init(dev_info_t *dip, int *avail);
53110e73f9Sschwartz extern void fpc_platform_node_fini(void *arg);
54110e73f9Sschwartz extern void fpc_platform_module_fini(dev_info_t *dip);
55110e73f9Sschwartz extern fire_perfreg_handle_t fpc_get_perfreg_handle(int devnum);
56110e73f9Sschwartz extern int fpc_free_counter_handle(fire_perfreg_handle_t);
57110e73f9Sschwartz extern int fpc_event_io(fire_perfreg_handle_t handle, fire_perfcnt_t group,
58110e73f9Sschwartz     uint64_t *event, boolean_t is_write);
59110e73f9Sschwartz extern int fpc_counter_io(fire_perfreg_handle_t handle, fire_perfcnt_t group,
60110e73f9Sschwartz     int counter_index, uint64_t *value, boolean_t is_write);
61110e73f9Sschwartz 
62110e73f9Sschwartz /* Functions exported by common file. */
63110e73f9Sschwartz extern void fpc_common_node_setup(dev_info_t *dip, int *index_p);
64110e73f9Sschwartz extern char *fpc_get_dev_name_by_number(int index);
65110e73f9Sschwartz extern void *fpc_get_platform_data_by_number(int index);
66110e73f9Sschwartz extern int fpc_set_platform_data_by_number(int index, void *data);
67110e73f9Sschwartz 
68110e73f9Sschwartz #ifdef	__cplusplus
69110e73f9Sschwartz }
70110e73f9Sschwartz #endif
71110e73f9Sschwartz 
72110e73f9Sschwartz #endif	/* _FPC_IMPL_H */
73