Print this page
update to acpica-unix2-20130927
acpica-unix2-20130823
PANKOVs restructure
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/intel/io/acpica/namespace/nsxfobj.c
+++ new/usr/src/common/acpica/components/namespace/nsxfobj.c
1 1 /*******************************************************************************
2 2 *
3 3 * Module Name: nsxfobj - Public interfaces to the ACPI subsystem
4 4 * ACPI Object oriented interfaces
5 5 *
6 6 ******************************************************************************/
7 7
8 8 /*
9 - * Copyright (C) 2000 - 2011, Intel Corp.
9 + * Copyright (C) 2000 - 2013, Intel Corp.
10 10 * All rights reserved.
11 11 *
12 12 * Redistribution and use in source and binary forms, with or without
13 13 * modification, are permitted provided that the following conditions
14 14 * are met:
15 15 * 1. Redistributions of source code must retain the above copyright
16 16 * notice, this list of conditions, and the following disclaimer,
17 17 * without modification.
18 18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 19 * substantially similar to the "NO WARRANTY" disclaimer below
20 20 * ("Disclaimer") and any redistribution must be conditioned upon
21 21 * including a substantially similar Disclaimer requirement for further
22 22 * binary redistribution.
23 23 * 3. Neither the names of the above-listed copyright holders nor the names
24 24 * of any contributors may be used to endorse or promote products derived
25 25 * from this software without specific prior written permission.
26 26 *
27 27 * Alternatively, this software may be distributed under the terms of the
28 28 * GNU General Public License ("GPL") version 2 as published by the Free
29 29 * Software Foundation.
30 30 *
31 31 * NO WARRANTY
32 32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
↓ open down ↓ |
17 lines elided |
↑ open up ↑ |
37 37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 42 * POSSIBILITY OF SUCH DAMAGES.
43 43 */
44 44
45 45
46 46 #define __NSXFOBJ_C__
47 +#define EXPORT_ACPI_INTERFACES
47 48
48 49 #include "acpi.h"
49 50 #include "accommon.h"
50 51 #include "acnamesp.h"
51 52
52 53
53 54 #define _COMPONENT ACPI_NAMESPACE
54 55 ACPI_MODULE_NAME ("nsxfobj")
55 56
56 57 /*******************************************************************************
57 58 *
58 59 * FUNCTION: AcpiGetType
59 60 *
60 61 * PARAMETERS: Handle - Handle of object whose type is desired
61 62 * RetType - Where the type will be placed
62 63 *
63 64 * RETURN: Status
64 65 *
65 66 * DESCRIPTION: This routine returns the type associatd with a particular handle
66 67 *
67 68 ******************************************************************************/
68 69
69 70 ACPI_STATUS
70 71 AcpiGetType (
71 72 ACPI_HANDLE Handle,
72 73 ACPI_OBJECT_TYPE *RetType)
73 74 {
74 75 ACPI_NAMESPACE_NODE *Node;
75 76 ACPI_STATUS Status;
76 77
77 78
78 79 /* Parameter Validation */
79 80
80 81 if (!RetType)
81 82 {
82 83 return (AE_BAD_PARAMETER);
83 84 }
84 85
85 86 /*
86 87 * Special case for the predefined Root Node
87 88 * (return type ANY)
88 89 */
89 90 if (Handle == ACPI_ROOT_OBJECT)
90 91 {
91 92 *RetType = ACPI_TYPE_ANY;
92 93 return (AE_OK);
93 94 }
94 95
95 96 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
96 97 if (ACPI_FAILURE (Status))
97 98 {
98 99 return (Status);
99 100 }
100 101
101 102 /* Convert and validate the handle */
102 103
103 104 Node = AcpiNsValidateHandle (Handle);
104 105 if (!Node)
105 106 {
106 107 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
107 108 return (AE_BAD_PARAMETER);
108 109 }
109 110
110 111 *RetType = Node->Type;
111 112
112 113
113 114 Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
114 115 return (Status);
115 116 }
116 117
117 118 ACPI_EXPORT_SYMBOL (AcpiGetType)
118 119
119 120
120 121 /*******************************************************************************
121 122 *
122 123 * FUNCTION: AcpiGetParent
123 124 *
124 125 * PARAMETERS: Handle - Handle of object whose parent is desired
125 126 * RetHandle - Where the parent handle will be placed
126 127 *
127 128 * RETURN: Status
128 129 *
129 130 * DESCRIPTION: Returns a handle to the parent of the object represented by
130 131 * Handle.
131 132 *
132 133 ******************************************************************************/
133 134
134 135 ACPI_STATUS
135 136 AcpiGetParent (
136 137 ACPI_HANDLE Handle,
137 138 ACPI_HANDLE *RetHandle)
138 139 {
139 140 ACPI_NAMESPACE_NODE *Node;
140 141 ACPI_NAMESPACE_NODE *ParentNode;
141 142 ACPI_STATUS Status;
142 143
143 144
144 145 if (!RetHandle)
145 146 {
146 147 return (AE_BAD_PARAMETER);
147 148 }
148 149
149 150 /* Special case for the predefined Root Node (no parent) */
150 151
151 152 if (Handle == ACPI_ROOT_OBJECT)
152 153 {
153 154 return (AE_NULL_ENTRY);
154 155 }
155 156
156 157 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
157 158 if (ACPI_FAILURE (Status))
158 159 {
159 160 return (Status);
160 161 }
161 162
162 163 /* Convert and validate the handle */
163 164
164 165 Node = AcpiNsValidateHandle (Handle);
165 166 if (!Node)
166 167 {
167 168 Status = AE_BAD_PARAMETER;
168 169 goto UnlockAndExit;
169 170 }
170 171
171 172 /* Get the parent entry */
172 173
173 174 ParentNode = Node->Parent;
174 175 *RetHandle = ACPI_CAST_PTR (ACPI_HANDLE, ParentNode);
175 176
176 177 /* Return exception if parent is null */
177 178
178 179 if (!ParentNode)
179 180 {
180 181 Status = AE_NULL_ENTRY;
181 182 }
182 183
183 184
184 185 UnlockAndExit:
185 186
186 187 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
187 188 return (Status);
188 189 }
189 190
190 191 ACPI_EXPORT_SYMBOL (AcpiGetParent)
191 192
192 193
193 194 /*******************************************************************************
194 195 *
↓ open down ↓ |
138 lines elided |
↑ open up ↑ |
195 196 * FUNCTION: AcpiGetNextObject
196 197 *
197 198 * PARAMETERS: Type - Type of object to be searched for
198 199 * Parent - Parent object whose children we are getting
199 200 * LastChild - Previous child that was found.
200 201 * The NEXT child will be returned
201 202 * RetHandle - Where handle to the next object is placed
202 203 *
203 204 * RETURN: Status
204 205 *
205 - * DESCRIPTION: Return the next peer object within the namespace. If Handle is
206 - * valid, Scope is ignored. Otherwise, the first object within
206 + * DESCRIPTION: Return the next peer object within the namespace. If Handle is
207 + * valid, Scope is ignored. Otherwise, the first object within
207 208 * Scope is returned.
208 209 *
209 210 ******************************************************************************/
210 211
211 212 ACPI_STATUS
212 213 AcpiGetNextObject (
213 214 ACPI_OBJECT_TYPE Type,
214 215 ACPI_HANDLE Parent,
215 216 ACPI_HANDLE Child,
216 217 ACPI_HANDLE *RetHandle)
217 218 {
218 219 ACPI_STATUS Status;
219 220 ACPI_NAMESPACE_NODE *Node;
220 221 ACPI_NAMESPACE_NODE *ParentNode = NULL;
221 222 ACPI_NAMESPACE_NODE *ChildNode = NULL;
222 223
223 224
224 225 /* Parameter validation */
225 226
226 227 if (Type > ACPI_TYPE_EXTERNAL_MAX)
227 228 {
228 229 return (AE_BAD_PARAMETER);
229 230 }
230 231
231 232 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
232 233 if (ACPI_FAILURE (Status))
233 234 {
234 235 return (Status);
235 236 }
236 237
237 238 /* If null handle, use the parent */
238 239
239 240 if (!Child)
240 241 {
241 242 /* Start search at the beginning of the specified scope */
242 243
243 244 ParentNode = AcpiNsValidateHandle (Parent);
244 245 if (!ParentNode)
245 246 {
246 247 Status = AE_BAD_PARAMETER;
247 248 goto UnlockAndExit;
248 249 }
249 250 }
250 251 else
251 252 {
252 253 /* Non-null handle, ignore the parent */
253 254 /* Convert and validate the handle */
254 255
255 256 ChildNode = AcpiNsValidateHandle (Child);
256 257 if (!ChildNode)
257 258 {
258 259 Status = AE_BAD_PARAMETER;
259 260 goto UnlockAndExit;
260 261 }
261 262 }
262 263
263 264 /* Internal function does the real work */
264 265
265 266 Node = AcpiNsGetNextNodeTyped (Type, ParentNode, ChildNode);
266 267 if (!Node)
267 268 {
268 269 Status = AE_NOT_FOUND;
269 270 goto UnlockAndExit;
270 271 }
271 272
272 273 if (RetHandle)
273 274 {
274 275 *RetHandle = ACPI_CAST_PTR (ACPI_HANDLE, Node);
↓ open down ↓ |
58 lines elided |
↑ open up ↑ |
275 276 }
276 277
277 278
278 279 UnlockAndExit:
279 280
280 281 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
281 282 return (Status);
282 283 }
283 284
284 285 ACPI_EXPORT_SYMBOL (AcpiGetNextObject)
285 -
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX