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.
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.
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]
22 * Copyright (c) 2009-2010, Intel Corporation.
23 * All rights reserved.
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/bitmap.h>
31 #include <sys/synch.h>
32 #include <sys/sunddi.h>
33 #include <sys/acpi/acpi.h>
34 #include <sys/acpica.h>
35 #include <sys/acpidev.h>
36 #include <sys/acpidev_dr.h>
44 #define ACPIDEV_ARRAY_PARAM(a) (a), (sizeof (a) / sizeof ((a)[0]))
46 /* Debug support facilities. */
47 extern int acpidev_debug
;
48 #define ACPIDEV_DEBUG(lvl, ...) if (acpidev_debug) cmn_err((lvl), __VA_ARGS__)
50 /* Data attached to an ACPI object to maintain device status information. */
51 struct acpidev_data_impl
{
52 uint32_t aod_eflag
; /* External flags */
53 uint32_t aod_iflag
; /* Internal flags */
55 int aod_status
; /* Cached _STA value */
58 acpidev_class_t
*aod_class
;
59 acpidev_class_list_t
**aod_class_list
;
60 acpidev_board_type_t aod_bdtype
; /* Type of board. */
61 uint32_t aod_bdnum
; /* Board # for DR. */
62 uint32_t aod_portid
; /* Port id for DR. */
63 uint32_t aod_bdidx
; /* Index # of AP */
64 volatile uint32_t aod_chidx
; /* Index # of child */
65 uint32_t aod_memidx
; /* Index # of memory */
66 acpidev_class_id_t aod_class_id
; /* Dev type for DR. */
69 #define ACPIDEV_ODF_STATUS_VALID 0x1
70 #define ACPIDEV_ODF_DEVINFO_CREATED 0x2
71 #define ACPIDEV_ODF_DEVINFO_TAGGED 0x4
72 #define ACPIDEV_ODF_HOTPLUG_CAPABLE 0x100
73 #define ACPIDEV_ODF_HOTPLUG_READY 0x200
74 #define ACPIDEV_ODF_HOTPLUG_FAILED 0x400
76 #define ACPIDEV_DR_IS_BOARD(hdl) \
77 ((hdl)->aod_iflag & ACPIDEV_ODF_HOTPLUG_CAPABLE)
79 #define ACPIDEV_DR_SET_BOARD(hdl) \
80 (hdl)->aod_iflag |= ACPIDEV_ODF_HOTPLUG_CAPABLE
82 #define ACPIDEV_DR_IS_READY(hdl) \
83 ((hdl)->aod_iflag & ACPIDEV_ODF_HOTPLUG_READY)
85 #define ACPIDEV_DR_SET_READY(hdl) \
86 (hdl)->aod_iflag |= ACPIDEV_ODF_HOTPLUG_READY
88 #define ACPIDEV_DR_IS_FAILED(hdl) \
89 ((hdl)->aod_iflag & ACPIDEV_ODF_HOTPLUG_FAILED)
91 #define ACPIDEV_DR_SET_FAILED(hdl) \
92 (hdl)->aod_iflag |= ACPIDEV_ODF_HOTPLUG_FAILED
94 #define ACPIDEV_DR_IS_WORKING(hdl) \
95 (((hdl)->aod_iflag & (ACPIDEV_ODF_HOTPLUG_READY | \
96 ACPIDEV_ODF_HOTPLUG_FAILED)) == ACPIDEV_ODF_HOTPLUG_READY)
98 #define ACPIDEV_DR_IS_PROCESSED(hdl) \
99 ((hdl)->aod_iflag & (ACPIDEV_ODF_HOTPLUG_READY | \
100 ACPIDEV_ODF_HOTPLUG_FAILED | ACPIDEV_ODF_HOTPLUG_CAPABLE))
102 #define ACPIDEV_DR_BOARD_READY(hdl) \
103 (((hdl)->aod_iflag & \
104 (ACPIDEV_ODF_HOTPLUG_READY | ACPIDEV_ODF_HOTPLUG_CAPABLE)) == \
105 (ACPIDEV_ODF_HOTPLUG_READY | ACPIDEV_ODF_HOTPLUG_CAPABLE))
108 * List of registered device class drivers.
109 * Class drivers on the same list will be called from head to tail in turn.
111 struct acpidev_class_list
{
112 acpidev_class_list_t
*acl_next
;
113 acpidev_class_t
*acl_class
;
116 typedef struct acpidev_pseudo_uid
{
117 struct acpidev_pseudo_uid
*apu_next
;
119 acpidev_class_id_t apu_cid
;
121 } acpidev_pseudo_uid_t
;
123 typedef struct acpidev_pseudo_uid_head
{
126 acpidev_pseudo_uid_t
*apuh_first
;
127 } acpidev_pseudo_uid_head_t
;
129 typedef struct acpidev_dr_capacity
{
132 uint_t cpu_model_min
;
133 uint_t cpu_model_max
;
136 boolean_t hotplug_supported
;
137 uint64_t memory_alignment
;
138 } acpidev_dr_capacity_t
;
140 extern int acpidev_dr_enable
;
141 extern krwlock_t acpidev_class_lock
;
142 extern ulong_t acpidev_object_type_mask
[BT_BITOUL(ACPI_TYPE_NS_NODE_MAX
+ 1)];
143 extern ACPI_TABLE_SRAT
*acpidev_srat_tbl_ptr
;
144 extern ACPI_TABLE_SLIT
*acpidev_slit_tbl_ptr
;
152 #endif /* _SYS_ACPIDEV_IMPL_H */