Print this page
update to acpica-unix2-20140114
acpica-unix2-20130823
PANKOVs restructure
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/intel/io/acpica/dispatcher/dsinit.c
+++ new/usr/src/common/acpica/components/dispatcher/dsinit.c
1 1 /******************************************************************************
2 2 *
3 3 * Module Name: dsinit - Object initialization namespace walk
4 4 *
5 5 *****************************************************************************/
6 6
7 7 /*
8 - * Copyright (C) 2000 - 2011, Intel Corp.
8 + * Copyright (C) 2000 - 2014, Intel Corp.
9 9 * All rights reserved.
10 10 *
11 11 * Redistribution and use in source and binary forms, with or without
12 12 * modification, are permitted provided that the following conditions
13 13 * are met:
14 14 * 1. Redistributions of source code must retain the above copyright
15 15 * notice, this list of conditions, and the following disclaimer,
16 16 * without modification.
17 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 18 * substantially similar to the "NO WARRANTY" disclaimer below
19 19 * ("Disclaimer") and any redistribution must be conditioned upon
20 20 * including a substantially similar Disclaimer requirement for further
21 21 * binary redistribution.
22 22 * 3. Neither the names of the above-listed copyright holders nor the names
23 23 * of any contributors may be used to endorse or promote products derived
24 24 * from this software without specific prior written permission.
25 25 *
26 26 * Alternatively, this software may be distributed under the terms of the
27 27 * GNU General Public License ("GPL") version 2 as published by the Free
28 28 * Software Foundation.
29 29 *
30 30 * NO WARRANTY
31 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 41 * POSSIBILITY OF SUCH DAMAGES.
42 42 */
43 43
44 44 #define __DSINIT_C__
45 45
46 46 #include "acpi.h"
47 47 #include "accommon.h"
48 48 #include "acdispat.h"
49 49 #include "acnamesp.h"
50 50 #include "actables.h"
51 51
52 52 #define _COMPONENT ACPI_DISPATCHER
53 53 ACPI_MODULE_NAME ("dsinit")
54 54
55 55 /* Local prototypes */
56 56
57 57 static ACPI_STATUS
58 58 AcpiDsInitOneObject (
59 59 ACPI_HANDLE ObjHandle,
60 60 UINT32 Level,
61 61 void *Context,
62 62 void **ReturnValue);
63 63
64 64
65 65 /*******************************************************************************
↓ open down ↓ |
47 lines elided |
↑ open up ↑ |
66 66 *
67 67 * FUNCTION: AcpiDsInitOneObject
68 68 *
69 69 * PARAMETERS: ObjHandle - Node for the object
70 70 * Level - Current nesting level
71 71 * Context - Points to a init info struct
72 72 * ReturnValue - Not used
73 73 *
74 74 * RETURN: Status
75 75 *
76 - * DESCRIPTION: Callback from AcpiWalkNamespace. Invoked for every object
76 + * DESCRIPTION: Callback from AcpiWalkNamespace. Invoked for every object
77 77 * within the namespace.
78 78 *
79 79 * Currently, the only objects that require initialization are:
80 80 * 1) Methods
81 81 * 2) Operation Regions
82 82 *
83 83 ******************************************************************************/
84 84
85 85 static ACPI_STATUS
86 86 AcpiDsInitOneObject (
87 87 ACPI_HANDLE ObjHandle,
88 88 UINT32 Level,
89 89 void *Context,
90 90 void **ReturnValue)
91 91 {
92 92 ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context;
93 93 ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
94 94 ACPI_OBJECT_TYPE Type;
95 95 ACPI_STATUS Status;
96 96
97 97
98 98 ACPI_FUNCTION_ENTRY ();
99 99
100 100
101 101 /*
102 102 * We are only interested in NS nodes owned by the table that
103 103 * was just loaded
104 104 */
105 105 if (Node->OwnerId != Info->OwnerId)
106 106 {
107 107 return (AE_OK);
108 108 }
109 109
110 110 Info->ObjectCount++;
111 111
112 112 /* And even then, we are only interested in a few object types */
113 113
114 114 Type = AcpiNsGetType (ObjHandle);
115 115
116 116 switch (Type)
117 117 {
118 118 case ACPI_TYPE_REGION:
119 119
120 120 Status = AcpiDsInitializeRegion (ObjHandle);
↓ open down ↓ |
34 lines elided |
↑ open up ↑ |
121 121 if (ACPI_FAILURE (Status))
122 122 {
123 123 ACPI_EXCEPTION ((AE_INFO, Status,
124 124 "During Region initialization %p [%4.4s]",
125 125 ObjHandle, AcpiUtGetNodeName (ObjHandle)));
126 126 }
127 127
128 128 Info->OpRegionCount++;
129 129 break;
130 130
131 -
132 131 case ACPI_TYPE_METHOD:
133 132
134 133 Info->MethodCount++;
135 134 break;
136 135
137 -
138 136 case ACPI_TYPE_DEVICE:
139 137
140 138 Info->DeviceCount++;
141 139 break;
142 140
143 -
144 141 default:
142 +
145 143 break;
146 144 }
147 145
148 146 /*
149 147 * We ignore errors from above, and always return OK, since
150 148 * we don't want to abort the walk on a single error.
151 149 */
152 150 return (AE_OK);
153 151 }
154 152
155 153
156 154 /*******************************************************************************
157 155 *
158 156 * FUNCTION: AcpiDsInitializeObjects
159 157 *
160 158 * PARAMETERS: TableDesc - Descriptor for parent ACPI table
161 159 * StartNode - Root of subtree to be initialized.
162 160 *
163 161 * RETURN: Status
164 162 *
165 163 * DESCRIPTION: Walk the namespace starting at "StartNode" and perform any
166 164 * necessary initialization on the objects found therein
167 165 *
168 166 ******************************************************************************/
169 167
170 168 ACPI_STATUS
171 169 AcpiDsInitializeObjects (
172 170 UINT32 TableIndex,
173 171 ACPI_NAMESPACE_NODE *StartNode)
174 172 {
175 173 ACPI_STATUS Status;
176 174 ACPI_INIT_WALK_INFO Info;
177 175 ACPI_TABLE_HEADER *Table;
178 176 ACPI_OWNER_ID OwnerId;
179 177
180 178
181 179 ACPI_FUNCTION_TRACE (DsInitializeObjects);
182 180
183 181
184 182 Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
185 183 if (ACPI_FAILURE (Status))
186 184 {
187 185 return_ACPI_STATUS (Status);
188 186 }
189 187
190 188 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
191 189 "**** Starting initialization of namespace objects ****\n"));
192 190 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Parsing all Control Methods:"));
193 191
194 192 /* Set all init info to zero */
195 193
196 194 ACPI_MEMSET (&Info, 0, sizeof (ACPI_INIT_WALK_INFO));
197 195
198 196 Info.OwnerId = OwnerId;
199 197 Info.TableIndex = TableIndex;
200 198
201 199 /* Walk entire namespace from the supplied root */
202 200
203 201 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
204 202 if (ACPI_FAILURE (Status))
205 203 {
206 204 return_ACPI_STATUS (Status);
207 205 }
208 206
209 207 /*
210 208 * We don't use AcpiWalkNamespace since we do not want to acquire
211 209 * the namespace reader lock.
212 210 */
213 211 Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, StartNode, ACPI_UINT32_MAX,
214 212 ACPI_NS_WALK_UNLOCK, AcpiDsInitOneObject, NULL, &Info, NULL);
215 213 if (ACPI_FAILURE (Status))
216 214 {
217 215 ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace"));
218 216 }
219 217 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
220 218
221 219 Status = AcpiGetTableByIndex (TableIndex, &Table);
222 220 if (ACPI_FAILURE (Status))
223 221 {
224 222 return_ACPI_STATUS (Status);
225 223 }
226 224
↓ open down ↓ |
72 lines elided |
↑ open up ↑ |
227 225 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
228 226 "\nTable [%4.4s](id %4.4X) - %u Objects with %u Devices %u Methods %u Regions\n",
229 227 Table->Signature, OwnerId, Info.ObjectCount,
230 228 Info.DeviceCount, Info.MethodCount, Info.OpRegionCount));
231 229
232 230 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
233 231 "%u Methods, %u Regions\n", Info.MethodCount, Info.OpRegionCount));
234 232
235 233 return_ACPI_STATUS (AE_OK);
236 234 }
237 -
238 -
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX