xref: /titanic_50/usr/src/uts/i86pc/sys/acpidev_impl.h (revision a4faba164aa153855d621c694fc5aa75dd183b81)
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  * Copyright (c) 2009, Intel Corporation.
23  * All rights reserved.
24  */
25 
26 #ifndef	_SYS_ACPIDEV_IMPL_H
27 #define	_SYS_ACPIDEV_IMPL_H
28 #include <sys/types.h>
29 #include <sys/cmn_err.h>
30 #include <sys/sunddi.h>
31 #include <sys/acpi/acpi.h>
32 #include <sys/acpica.h>
33 #include <sys/acpidev.h>
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 #ifdef	_KERNEL
40 
41 #define	ACPIDEV_ARRAY_PARAM(a)		(a), (sizeof (a) / sizeof ((a)[0]))
42 
43 /* Debug support facilities. */
44 extern int acpidev_debug;
45 #define	ACPIDEV_DEBUG(lvl, ...)	if (acpidev_debug) cmn_err((lvl), __VA_ARGS__)
46 
47 /* Data attached to an ACPI object to maintain device status information. */
48 struct acpidev_data_impl {
49 	uint32_t			aod_eflag;	/* External flags */
50 	uint32_t			aod_iflag;	/* Internal flags */
51 	uint32_t			aod_level;
52 	int				aod_status;	/* Cached _STA value */
53 	ACPI_HANDLE			*aod_hdl;
54 	dev_info_t			*aod_dip;
55 	acpidev_class_t			*aod_class;
56 	acpidev_class_list_t		**aod_class_list;
57 };
58 
59 #define	ACPIDEV_ODF_STATUS_VALID	0x1
60 #define	ACPIDEV_ODF_DEVINFO_CREATED	0x2
61 #define	ACPIDEV_ODF_DEVINFO_TAGGED	0x4
62 #define	ACPIDEV_ODF_DEVINFO_OFFLINE	0x8
63 
64 /*
65  * List of registered device class drivers.
66  * Class drivers on the same list will be called from head to tail in turn.
67  */
68 struct acpidev_class_list {
69 	acpidev_class_list_t		*acl_next;
70 	acpidev_class_t			*acl_class;
71 };
72 
73 typedef struct acpidev_pseudo_uid {
74 	struct acpidev_pseudo_uid	*apu_next;
75 	char				*apu_uid;
76 	acpidev_class_id_t		apu_cid;
77 	uint_t				apu_nid;
78 } acpidev_pseudo_uid_t;
79 
80 typedef struct acpidev_pseudo_uid_head {
81 	kmutex_t			apuh_lock;
82 	uint32_t			apuh_id;
83 	acpidev_pseudo_uid_t		*apuh_first;
84 } acpidev_pseudo_uid_head_t;
85 
86 #endif	/* _KERNEL */
87 
88 #ifdef __cplusplus
89 }
90 #endif
91 
92 #endif	/* _SYS_ACPIDEV_IMPL_H */
93