ReactOS 0.4.15-dev-8100-g1887773
exstoren.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
#include "amlcode.h"
Include dependency graph for exstoren.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_EXECUTER
 

Functions

ACPI_STATUS AcpiExResolveObject (ACPI_OPERAND_OBJECT **SourceDescPtr, ACPI_OBJECT_TYPE TargetType, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiExStoreObjectToObject (ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *DestDesc, ACPI_OPERAND_OBJECT **NewDesc, ACPI_WALK_STATE *WalkState)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_EXECUTER

Definition at line 51 of file exstoren.c.

Function Documentation

◆ AcpiExResolveObject()

ACPI_STATUS AcpiExResolveObject ( ACPI_OPERAND_OBJECT **  SourceDescPtr,
ACPI_OBJECT_TYPE  TargetType,
ACPI_WALK_STATE WalkState 
)

Definition at line 71 of file exstoren.c.

75{
76 ACPI_OPERAND_OBJECT *SourceDesc = *SourceDescPtr;
78
79
80 ACPI_FUNCTION_TRACE (ExResolveObject);
81
82
83 /* Ensure we have a Target that can be stored to */
84
85 switch (TargetType)
86 {
91 /*
92 * These cases all require only Integers or values that
93 * can be converted to Integers (Strings or Buffers)
94 */
98 /*
99 * Stores into a Field/Region or into a Integer/Buffer/String
100 * are all essentially the same. This case handles the
101 * "interchangeable" types Integer, String, and Buffer.
102 */
103 if (SourceDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE)
104 {
105 /* Resolve a reference object first */
106
107 Status = AcpiExResolveToValue (SourceDescPtr, WalkState);
108 if (ACPI_FAILURE (Status))
109 {
110 break;
111 }
112 }
113
114 /* For CopyObject, no further validation necessary */
115
116 if (WalkState->Opcode == AML_COPY_OBJECT_OP)
117 {
118 break;
119 }
120
121 /* Must have a Integer, Buffer, or String */
122
123 if ((SourceDesc->Common.Type != ACPI_TYPE_INTEGER) &&
124 (SourceDesc->Common.Type != ACPI_TYPE_BUFFER) &&
125 (SourceDesc->Common.Type != ACPI_TYPE_STRING) &&
126 !((SourceDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
127 (SourceDesc->Reference.Class== ACPI_REFCLASS_TABLE)))
128 {
129 /* Conversion successful but still not a valid type */
130
132 "Cannot assign type [%s] to [%s] (must be type Int/Str/Buf)",
133 AcpiUtGetObjectTypeName (SourceDesc),
134 AcpiUtGetTypeName (TargetType)));
135
137 }
138 break;
139
142 /*
143 * All aliases should have been resolved earlier, during the
144 * operand resolution phase.
145 */
146 ACPI_ERROR ((AE_INFO, "Store into an unresolved Alias object"));
148 break;
149
151 default:
152 /*
153 * All other types than Alias and the various Fields come here,
154 * including the untyped case - ACPI_TYPE_ANY.
155 */
156 break;
157 }
158
160}
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AE_AML_INTERNAL
Definition: acexcep.h:194
#define AE_AML_OPERAND_TYPE
Definition: acexcep.h:182
#define AE_OK
Definition: acexcep.h:97
@ ACPI_REFCLASS_TABLE
Definition: acobject.h:463
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_TYPE_LOCAL_REFERENCE
Definition: actypes.h:719
#define ACPI_TYPE_BUFFER_FIELD
Definition: actypes.h:701
#define ACPI_TYPE_STRING
Definition: actypes.h:689
#define ACPI_TYPE_LOCAL_BANK_FIELD
Definition: actypes.h:717
#define ACPI_TYPE_LOCAL_ALIAS
Definition: actypes.h:720
#define ACPI_TYPE_BUFFER
Definition: actypes.h:690
#define ACPI_TYPE_INTEGER
Definition: actypes.h:688
#define ACPI_TYPE_LOCAL_REGION_FIELD
Definition: actypes.h:716
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_TYPE_PACKAGE
Definition: actypes.h:691
#define ACPI_TYPE_LOCAL_METHOD_ALIAS
Definition: actypes.h:721
#define ACPI_TYPE_LOCAL_INDEX_FIELD
Definition: actypes.h:718
const char * AcpiUtGetTypeName(ACPI_OBJECT_TYPE Type)
Definition: utdecode.c:250
const char * AcpiUtGetObjectTypeName(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: utdecode.c:264
#define AML_COPY_OBJECT_OP
Definition: amlcode.h:131
ACPI_STATUS AcpiExResolveToValue(ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState)
Definition: exresolv.c:79
Status
Definition: gdiplustypes.h:25
ACPI_OBJECT_COMMON_HEADER UINT8 Class
Definition: acobject.h:443
UINT16 Opcode
Definition: acstruct.h:78
ACPI_OBJECT_REFERENCE Reference
Definition: acobject.h:540
ACPI_OBJECT_COMMON Common
Definition: acobject.h:519

Referenced by AcpiExStoreObjectToNode().

◆ AcpiExStoreObjectToObject()

ACPI_STATUS AcpiExStoreObjectToObject ( ACPI_OPERAND_OBJECT SourceDesc,
ACPI_OPERAND_OBJECT DestDesc,
ACPI_OPERAND_OBJECT **  NewDesc,
ACPI_WALK_STATE WalkState 
)

Definition at line 199 of file exstoren.c.

204{
205 ACPI_OPERAND_OBJECT *ActualSrcDesc;
207
208
209 ACPI_FUNCTION_TRACE_PTR (ExStoreObjectToObject, SourceDesc);
210
211
212 ActualSrcDesc = SourceDesc;
213 if (!DestDesc)
214 {
215 /*
216 * There is no destination object (An uninitialized node or
217 * package element), so we can simply copy the source object
218 * creating a new destination object
219 */
220 Status = AcpiUtCopyIobjectToIobject (ActualSrcDesc, NewDesc, WalkState);
222 }
223
224 if (SourceDesc->Common.Type != DestDesc->Common.Type)
225 {
226 /*
227 * The source type does not match the type of the destination.
228 * Perform the "implicit conversion" of the source to the current type
229 * of the target as per the ACPI specification.
230 *
231 * If no conversion performed, ActualSrcDesc = SourceDesc.
232 * Otherwise, ActualSrcDesc is a temporary object to hold the
233 * converted object.
234 */
235 Status = AcpiExConvertToTargetType (DestDesc->Common.Type,
236 SourceDesc, &ActualSrcDesc, WalkState);
237 if (ACPI_FAILURE (Status))
238 {
240 }
241
242 if (SourceDesc == ActualSrcDesc)
243 {
244 /*
245 * No conversion was performed. Return the SourceDesc as the
246 * new object.
247 */
248 *NewDesc = SourceDesc;
250 }
251 }
252
253 /*
254 * We now have two objects of identical types, and we can perform a
255 * copy of the *value* of the source object.
256 */
257 switch (DestDesc->Common.Type)
258 {
260
261 DestDesc->Integer.Value = ActualSrcDesc->Integer.Value;
262
263 /* Truncate value if we are executing from a 32-bit ACPI table */
264
266 break;
267
268 case ACPI_TYPE_STRING:
269
270 Status = AcpiExStoreStringToString (ActualSrcDesc, DestDesc);
271 break;
272
273 case ACPI_TYPE_BUFFER:
274
275 Status = AcpiExStoreBufferToBuffer (ActualSrcDesc, DestDesc);
276 break;
277
279
280 Status = AcpiUtCopyIobjectToIobject (ActualSrcDesc, &DestDesc,
281 WalkState);
282 break;
283
284 default:
285 /*
286 * All other types come here.
287 */
288 ACPI_WARNING ((AE_INFO, "Store into type [%s] not implemented",
289 AcpiUtGetObjectTypeName (DestDesc)));
290
292 break;
293 }
294
295 if (ActualSrcDesc != SourceDesc)
296 {
297 /* Delete the intermediate (temporary) source object */
298
299 AcpiUtRemoveReference (ActualSrcDesc);
300 }
301
302 *NewDesc = DestDesc;
304}
#define AE_NOT_IMPLEMENTED
Definition: acexcep.h:122
#define ACPI_WARNING(plist)
Definition: acoutput.h:238
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:790
ACPI_STATUS AcpiUtCopyIobjectToIobject(ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT **DestDesc, ACPI_WALK_STATE *WalkState)
Definition: utcopy.c:1037
ACPI_STATUS AcpiExConvertToTargetType(ACPI_OBJECT_TYPE DestinationType, ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT **ResultDesc, ACPI_WALK_STATE *WalkState)
Definition: exconvrt.c:654
ACPI_STATUS AcpiExStoreBufferToBuffer(ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *TargetDesc)
Definition: exstorob.c:67
ACPI_STATUS AcpiExStoreStringToString(ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *TargetDesc)
Definition: exstorob.c:172
BOOLEAN AcpiExTruncateFor32bitTable(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: exutils.c:177
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:520

Referenced by AcpiExStoreObjectToNode().