xref: /illumos-gate/usr/src/uts/sun4u/sys/pmubus.h (revision 89b2a9fbeabf42fa54594df0e5927bcc50a07cc9)
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 2000-2002 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_PMUBUS_H
28 #define	_SYS_PMUBUS_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 
37 /*
38  * definition of pmubus reg spec entry:
39  */
40 typedef struct {
41 	uint32_t reg_addr_hi;
42 	uint32_t reg_addr_lo;
43 	uint32_t reg_size;
44 } pmubus_obpregspec_t;
45 
46 typedef struct {
47 	uint64_t reg_addr;
48 	uint32_t reg_size;
49 } pmubus_regspec_t;
50 
51 
52 typedef struct {
53 	uint64_t rng_child;
54 	uint32_t rng_parent_hi;
55 	uint32_t rng_parent_mid;
56 	uint32_t rng_parent_low;
57 	uint32_t rng_size;
58 } pmu_rangespec_t;
59 
60 
61 /*
62  * driver soft state structure:
63  */
64 typedef struct {
65 	dev_info_t *pmubus_dip;
66 	pci_regspec_t *pmubus_regp;
67 	int pmubus_reglen;
68 	ddi_acc_handle_t pmubus_reghdl;
69 	pmu_rangespec_t *pmubus_rangep;
70 	int pmubus_rnglen;
71 	int pmubus_nranges;
72 	kmutex_t pmubus_reg_access_lock;
73 } pmubus_devstate_t;
74 
75 /* Flags for specifying the type of register space. */
76 #define	MAPREQ_SHARED_REG	0x1
77 #define	MAPREQ_SHARED_BITS	0x2
78 
79 #define	MAPPING_SHARED_BITS_MASK	0x8000000000000000ull
80 
81 #define	PMUBUS_REGOFFSET	0xff
82 
83 typedef struct {
84 	pmubus_devstate_t *mapreq_softsp;
85 	unsigned long mapreq_flags;
86 	uint64_t mapreq_addr;
87 	size_t mapreq_size;
88 	uint64_t mapreq_mask;
89 } pmubus_mapreq_t;
90 
91 #ifdef	__cplusplus
92 }
93 #endif
94 
95 #endif	/* _SYS_PMUBUS_H */
96