xref: /titanic_41/usr/src/uts/i86pc/sys/acpinex.h (revision b72d5b75fd6f5bb08d29f65652d60058fc3a2608)
1*b72d5b75SMichael Corcoran /*
2*b72d5b75SMichael Corcoran  * CDDL HEADER START
3*b72d5b75SMichael Corcoran  *
4*b72d5b75SMichael Corcoran  * The contents of this file are subject to the terms of the
5*b72d5b75SMichael Corcoran  * Common Development and Distribution License (the "License").
6*b72d5b75SMichael Corcoran  * You may not use this file except in compliance with the License.
7*b72d5b75SMichael Corcoran  *
8*b72d5b75SMichael Corcoran  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*b72d5b75SMichael Corcoran  * or http://www.opensolaris.org/os/licensing.
10*b72d5b75SMichael Corcoran  * See the License for the specific language governing permissions
11*b72d5b75SMichael Corcoran  * and limitations under the License.
12*b72d5b75SMichael Corcoran  *
13*b72d5b75SMichael Corcoran  * When distributing Covered Code, include this CDDL HEADER in each
14*b72d5b75SMichael Corcoran  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*b72d5b75SMichael Corcoran  * If applicable, add the following below this CDDL HEADER, with the
16*b72d5b75SMichael Corcoran  * fields enclosed by brackets "[]" replaced with your own identifying
17*b72d5b75SMichael Corcoran  * information: Portions Copyright [yyyy] [name of copyright owner]
18*b72d5b75SMichael Corcoran  *
19*b72d5b75SMichael Corcoran  * CDDL HEADER END
20*b72d5b75SMichael Corcoran  */
21*b72d5b75SMichael Corcoran /*
22*b72d5b75SMichael Corcoran  * Copyright (c) 2009, Intel Corporation.
23*b72d5b75SMichael Corcoran  * All rights reserved.
24*b72d5b75SMichael Corcoran  */
25*b72d5b75SMichael Corcoran 
26*b72d5b75SMichael Corcoran #ifndef	_ACPI_NEXUS_H
27*b72d5b75SMichael Corcoran #define	_ACPI_NEXUS_H
28*b72d5b75SMichael Corcoran #include <sys/types.h>
29*b72d5b75SMichael Corcoran #include <sys/dditypes.h>	/* needed for definition of dev_info_t */
30*b72d5b75SMichael Corcoran #include <sys/mutex.h>
31*b72d5b75SMichael Corcoran 
32*b72d5b75SMichael Corcoran #ifdef	__cplusplus
33*b72d5b75SMichael Corcoran extern "C" {
34*b72d5b75SMichael Corcoran #endif
35*b72d5b75SMichael Corcoran 
36*b72d5b75SMichael Corcoran #ifdef	_KERNEL
37*b72d5b75SMichael Corcoran 
38*b72d5b75SMichael Corcoran #define	ACPINEX_INSTANCE_MAX		(1 << 10)
39*b72d5b75SMichael Corcoran #define	ACPINEX_INSTANCE_MASK		(ACPINEX_INSTANCE_MAX - 1)
40*b72d5b75SMichael Corcoran #define	ACPINEX_INSTANCE_SHIFT		8
41*b72d5b75SMichael Corcoran #define	ACPINEX_MINOR_TYPE_MASK		((1 << ACPINEX_INSTANCE_SHIFT) - 1)
42*b72d5b75SMichael Corcoran #define	ACPINEX_DEVCTL_MINOR		((1 << ACPINEX_INSTANCE_SHIFT) - 1)
43*b72d5b75SMichael Corcoran 
44*b72d5b75SMichael Corcoran #define	ACPINEX_MAKE_DEVCTL_MINOR(instance) \
45*b72d5b75SMichael Corcoran 	(((instance) << ACPINEX_INSTANCE_SHIFT) | ACPINEX_DEVCTL_MINOR)
46*b72d5b75SMichael Corcoran #define	ACPINEX_IS_DEVCTL(minor)	\
47*b72d5b75SMichael Corcoran 	(((minor) & ACPINEX_MINOR_TYPE_MASK) == ACPINEX_DEVCTL_MINOR)
48*b72d5b75SMichael Corcoran 
49*b72d5b75SMichael Corcoran #define	ACPINEX_GET_INSTANCE(minor)	((minor) >> ACPINEX_INSTANCE_SHIFT)
50*b72d5b75SMichael Corcoran 
51*b72d5b75SMichael Corcoran extern int	acpinex_debug;
52*b72d5b75SMichael Corcoran #define	ACPINEX_DEBUG(lvl, ...)		\
53*b72d5b75SMichael Corcoran 	if (acpinex_debug) cmn_err((lvl), __VA_ARGS__)
54*b72d5b75SMichael Corcoran 
55*b72d5b75SMichael Corcoran /* Softstate structure for acpinex instance. */
56*b72d5b75SMichael Corcoran typedef struct {
57*b72d5b75SMichael Corcoran 	dev_info_t			*ans_dip;
58*b72d5b75SMichael Corcoran 	ACPI_HANDLE			ans_hdl;
59*b72d5b75SMichael Corcoran 	int				ans_fm_cap;
60*b72d5b75SMichael Corcoran 	ddi_iblock_cookie_t		ans_fm_ibc;
61*b72d5b75SMichael Corcoran 	kmutex_t			ans_lock;
62*b72d5b75SMichael Corcoran 	char				ans_path[MAXPATHLEN];
63*b72d5b75SMichael Corcoran } acpinex_softstate_t;
64*b72d5b75SMichael Corcoran 
65*b72d5b75SMichael Corcoran #endif	/* _KERNEL */
66*b72d5b75SMichael Corcoran 
67*b72d5b75SMichael Corcoran #ifdef	__cplusplus
68*b72d5b75SMichael Corcoran }
69*b72d5b75SMichael Corcoran #endif
70*b72d5b75SMichael Corcoran 
71*b72d5b75SMichael Corcoran #endif	/* _ACPI_NEXUS_H */
72