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/executer/exstoren.c
+++ new/usr/src/common/acpica/components/executer/exstoren.c
1 -
2 1 /******************************************************************************
3 2 *
4 3 * Module Name: exstoren - AML Interpreter object store support,
5 4 * Store to Node (namespace object)
6 5 *
7 6 *****************************************************************************/
8 7
9 8 /*
10 - * Copyright (C) 2000 - 2011, Intel Corp.
9 + * Copyright (C) 2000 - 2014, Intel Corp.
11 10 * All rights reserved.
12 11 *
13 12 * Redistribution and use in source and binary forms, with or without
14 13 * modification, are permitted provided that the following conditions
15 14 * are met:
16 15 * 1. Redistributions of source code must retain the above copyright
17 16 * notice, this list of conditions, and the following disclaimer,
18 17 * without modification.
19 18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
20 19 * substantially similar to the "NO WARRANTY" disclaimer below
21 20 * ("Disclaimer") and any redistribution must be conditioned upon
22 21 * including a substantially similar Disclaimer requirement for further
23 22 * binary redistribution.
24 23 * 3. Neither the names of the above-listed copyright holders nor the names
25 24 * of any contributors may be used to endorse or promote products derived
26 25 * from this software without specific prior written permission.
27 26 *
28 27 * Alternatively, this software may be distributed under the terms of the
29 28 * GNU General Public License ("GPL") version 2 as published by the Free
30 29 * Software Foundation.
31 30 *
32 31 * NO WARRANTY
33 32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
34 33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
35 34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
36 35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
37 36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
38 37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
39 38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
40 39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
41 40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
42 41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
43 42 * POSSIBILITY OF SUCH DAMAGES.
44 43 */
45 44
46 45 #define __EXSTOREN_C__
47 46
48 47 #include "acpi.h"
49 48 #include "accommon.h"
50 49 #include "acinterp.h"
51 50 #include "amlcode.h"
52 51
53 52
54 53 #define _COMPONENT ACPI_EXECUTER
55 54 ACPI_MODULE_NAME ("exstoren")
56 55
57 56
↓ open down ↓ |
37 lines elided |
↑ open up ↑ |
58 57 /*******************************************************************************
59 58 *
60 59 * FUNCTION: AcpiExResolveObject
61 60 *
62 61 * PARAMETERS: SourceDescPtr - Pointer to the source object
63 62 * TargetType - Current type of the target
64 63 * WalkState - Current walk state
65 64 *
66 65 * RETURN: Status, resolved object in SourceDescPtr.
67 66 *
68 - * DESCRIPTION: Resolve an object. If the object is a reference, dereference
67 + * DESCRIPTION: Resolve an object. If the object is a reference, dereference
69 68 * it and return the actual object in the SourceDescPtr.
70 69 *
71 70 ******************************************************************************/
72 71
73 72 ACPI_STATUS
74 73 AcpiExResolveObject (
75 74 ACPI_OPERAND_OBJECT **SourceDescPtr,
76 75 ACPI_OBJECT_TYPE TargetType,
77 76 ACPI_WALK_STATE *WalkState)
78 77 {
79 78 ACPI_OPERAND_OBJECT *SourceDesc = *SourceDescPtr;
80 79 ACPI_STATUS Status = AE_OK;
81 80
82 81
83 82 ACPI_FUNCTION_TRACE (ExResolveObject);
84 83
85 84
86 85 /* Ensure we have a Target that can be stored to */
87 86
↓ open down ↓ |
9 lines elided |
↑ open up ↑ |
88 87 switch (TargetType)
89 88 {
90 89 case ACPI_TYPE_BUFFER_FIELD:
91 90 case ACPI_TYPE_LOCAL_REGION_FIELD:
92 91 case ACPI_TYPE_LOCAL_BANK_FIELD:
93 92 case ACPI_TYPE_LOCAL_INDEX_FIELD:
94 93 /*
95 94 * These cases all require only Integers or values that
96 95 * can be converted to Integers (Strings or Buffers)
97 96 */
98 -
99 97 case ACPI_TYPE_INTEGER:
100 98 case ACPI_TYPE_STRING:
101 99 case ACPI_TYPE_BUFFER:
102 -
103 100 /*
104 101 * Stores into a Field/Region or into a Integer/Buffer/String
105 - * are all essentially the same. This case handles the
102 + * are all essentially the same. This case handles the
106 103 * "interchangeable" types Integer, String, and Buffer.
107 104 */
108 105 if (SourceDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE)
109 106 {
110 107 /* Resolve a reference object first */
111 108
112 109 Status = AcpiExResolveToValue (SourceDescPtr, WalkState);
113 110 if (ACPI_FAILURE (Status))
114 111 {
115 112 break;
116 113 }
117 114 }
118 115
119 116 /* For CopyObject, no further validation necessary */
120 117
121 118 if (WalkState->Opcode == AML_COPY_OP)
122 119 {
123 120 break;
124 121 }
125 122
126 123 /* Must have a Integer, Buffer, or String */
127 124
128 125 if ((SourceDesc->Common.Type != ACPI_TYPE_INTEGER) &&
129 126 (SourceDesc->Common.Type != ACPI_TYPE_BUFFER) &&
130 127 (SourceDesc->Common.Type != ACPI_TYPE_STRING) &&
131 128 !((SourceDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
132 129 (SourceDesc->Reference.Class== ACPI_REFCLASS_TABLE)))
133 130 {
↓ open down ↓ |
18 lines elided |
↑ open up ↑ |
134 131 /* Conversion successful but still not a valid type */
135 132
136 133 ACPI_ERROR ((AE_INFO,
137 134 "Cannot assign type %s to %s (must be type Int/Str/Buf)",
138 135 AcpiUtGetObjectTypeName (SourceDesc),
139 136 AcpiUtGetTypeName (TargetType)));
140 137 Status = AE_AML_OPERAND_TYPE;
141 138 }
142 139 break;
143 140
144 -
145 141 case ACPI_TYPE_LOCAL_ALIAS:
146 142 case ACPI_TYPE_LOCAL_METHOD_ALIAS:
147 -
148 143 /*
149 144 * All aliases should have been resolved earlier, during the
150 145 * operand resolution phase.
151 146 */
152 147 ACPI_ERROR ((AE_INFO, "Store into an unresolved Alias object"));
153 148 Status = AE_AML_INTERNAL;
154 149 break;
155 150
156 -
157 151 case ACPI_TYPE_PACKAGE:
158 152 default:
159 -
160 153 /*
161 154 * All other types than Alias and the various Fields come here,
162 155 * including the untyped case - ACPI_TYPE_ANY.
163 156 */
164 157 break;
165 158 }
166 159
167 160 return_ACPI_STATUS (Status);
168 161 }
169 162
170 163
171 164 /*******************************************************************************
↓ open down ↓ |
2 lines elided |
↑ open up ↑ |
172 165 *
173 166 * FUNCTION: AcpiExStoreObjectToObject
174 167 *
175 168 * PARAMETERS: SourceDesc - Object to store
176 169 * DestDesc - Object to receive a copy of the source
177 170 * NewDesc - New object if DestDesc is obsoleted
178 171 * WalkState - Current walk state
179 172 *
180 173 * RETURN: Status
181 174 *
182 - * DESCRIPTION: "Store" an object to another object. This may include
175 + * DESCRIPTION: "Store" an object to another object. This may include
183 176 * converting the source type to the target type (implicit
184 177 * conversion), and a copy of the value of the source to
185 178 * the target.
186 179 *
187 180 * The Assignment of an object to another (not named) object
188 181 * is handled here.
189 182 * The Source passed in will replace the current value (if any)
190 183 * with the input value.
191 184 *
192 185 * When storing into an object the data is converted to the
193 - * target object type then stored in the object. This means
186 + * target object type then stored in the object. This means
194 187 * that the target object type (for an initialized target) will
195 188 * not be changed by a store operation.
196 189 *
197 190 * This module allows destination types of Number, String,
198 191 * Buffer, and Package.
199 192 *
200 - * Assumes parameters are already validated. NOTE: SourceDesc
193 + * Assumes parameters are already validated. NOTE: SourceDesc
201 194 * resolution (from a reference object) must be performed by
202 195 * the caller if necessary.
203 196 *
204 197 ******************************************************************************/
205 198
206 199 ACPI_STATUS
207 200 AcpiExStoreObjectToObject (
208 201 ACPI_OPERAND_OBJECT *SourceDesc,
209 202 ACPI_OPERAND_OBJECT *DestDesc,
210 203 ACPI_OPERAND_OBJECT **NewDesc,
211 204 ACPI_WALK_STATE *WalkState)
212 205 {
213 206 ACPI_OPERAND_OBJECT *ActualSrcDesc;
214 207 ACPI_STATUS Status = AE_OK;
215 208
216 209
217 210 ACPI_FUNCTION_TRACE_PTR (ExStoreObjectToObject, SourceDesc);
218 211
219 212
220 213 ActualSrcDesc = SourceDesc;
221 214 if (!DestDesc)
222 215 {
223 216 /*
224 217 * There is no destination object (An uninitialized node or
225 218 * package element), so we can simply copy the source object
226 219 * creating a new destination object
227 220 */
228 221 Status = AcpiUtCopyIobjectToIobject (ActualSrcDesc, NewDesc, WalkState);
229 222 return_ACPI_STATUS (Status);
230 223 }
231 224
232 225 if (SourceDesc->Common.Type != DestDesc->Common.Type)
233 226 {
234 227 /*
235 228 * The source type does not match the type of the destination.
236 229 * Perform the "implicit conversion" of the source to the current type
237 230 * of the target as per the ACPI specification.
238 231 *
239 232 * If no conversion performed, ActualSrcDesc = SourceDesc.
240 233 * Otherwise, ActualSrcDesc is a temporary object to hold the
241 234 * converted object.
242 235 */
243 236 Status = AcpiExConvertToTargetType (DestDesc->Common.Type,
244 237 SourceDesc, &ActualSrcDesc, WalkState);
245 238 if (ACPI_FAILURE (Status))
246 239 {
247 240 return_ACPI_STATUS (Status);
248 241 }
249 242
250 243 if (SourceDesc == ActualSrcDesc)
251 244 {
252 245 /*
253 246 * No conversion was performed. Return the SourceDesc as the
254 247 * new object.
255 248 */
256 249 *NewDesc = SourceDesc;
257 250 return_ACPI_STATUS (AE_OK);
258 251 }
259 252 }
260 253
261 254 /*
262 255 * We now have two objects of identical types, and we can perform a
↓ open down ↓ |
52 lines elided |
↑ open up ↑ |
263 256 * copy of the *value* of the source object.
264 257 */
265 258 switch (DestDesc->Common.Type)
266 259 {
267 260 case ACPI_TYPE_INTEGER:
268 261
269 262 DestDesc->Integer.Value = ActualSrcDesc->Integer.Value;
270 263
271 264 /* Truncate value if we are executing from a 32-bit ACPI table */
272 265
273 - AcpiExTruncateFor32bitTable (DestDesc);
266 + (void) AcpiExTruncateFor32bitTable (DestDesc);
274 267 break;
275 268
276 269 case ACPI_TYPE_STRING:
277 270
278 271 Status = AcpiExStoreStringToString (ActualSrcDesc, DestDesc);
279 272 break;
280 273
281 274 case ACPI_TYPE_BUFFER:
282 275
283 276 Status = AcpiExStoreBufferToBuffer (ActualSrcDesc, DestDesc);
284 277 break;
285 278
286 279 case ACPI_TYPE_PACKAGE:
287 280
288 281 Status = AcpiUtCopyIobjectToIobject (ActualSrcDesc, &DestDesc,
289 282 WalkState);
290 283 break;
291 284
292 285 default:
293 286 /*
294 287 * All other types come here.
295 288 */
296 289 ACPI_WARNING ((AE_INFO, "Store into type %s not implemented",
297 290 AcpiUtGetObjectTypeName (DestDesc)));
298 291
299 292 Status = AE_NOT_IMPLEMENTED;
300 293 break;
301 294 }
302 295
↓ open down ↓ |
19 lines elided |
↑ open up ↑ |
303 296 if (ActualSrcDesc != SourceDesc)
304 297 {
305 298 /* Delete the intermediate (temporary) source object */
306 299
307 300 AcpiUtRemoveReference (ActualSrcDesc);
308 301 }
309 302
310 303 *NewDesc = DestDesc;
311 304 return_ACPI_STATUS (Status);
312 305 }
313 -
314 -
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX