aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities/utcopy.c
diff options
context:
space:
mode:
authorRobert Moore <robert.moore@intel.com>2005-04-18 22:49:35 -0400
committerLen Brown <len.brown@intel.com>2005-07-12 00:08:52 -0400
commit44f6c01242da4e162f28d8e1216a8c7a91174605 (patch)
tree53f724764f1bd9036dfb049a643d198125cc9edc /drivers/acpi/utilities/utcopy.c
parentebb6e1a6122fd6b7c96470cfd4ce0f04150e5084 (diff)
ACPICA 20050408 from Bob Moore
Fixed three cases in the interpreter where an "index" argument to an ASL function was still (internally) 32 bits instead of the required 64 bits. This was the Index argument to the Index, Mid, and Match operators. The "strupr" function is now permanently local (acpi_ut_strupr), since this is not a POSIX-defined function and not present in most kernel-level C libraries. References to the C library strupr function have been removed from the headers. Completed the deployment of static functions/prototypes. All prototypes with the static attribute have been moved from the headers to the owning C file. ACPICA 20050329 from Bob Moore An error is now generated if an attempt is made to create a Buffer Field of length zero (A CreateField with a length operand of zero.) The interpreter now issues a warning whenever executable code at the module level is detected during ACPI table load. This will give some idea of the prevalence of this type of code. Implemented support for references to named objects (other than control methods) within package objects. Enhanced package object output for the debug object. Package objects are now completely dumped, showing all elements. Enhanced miscellaneous object output for the debug object. Any object can now be written to the debug object (for example, a device object can be written, and the type of the object will be displayed.) The "static" qualifier has been added to all local functions across the core subsystem. The number of "long" lines (> 80 chars) within the source has been significantly reduced, by about 1/3. Cleaned up all header files to ensure that all CA/iASL functions are prototyped (even static functions) and the formatting is consistent. Two new header files have been added, acopcode.h and acnames.h. Removed several obsolete functions that were no longer used. Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/utilities/utcopy.c')
-rw-r--r--drivers/acpi/utilities/utcopy.c126
1 files changed, 91 insertions, 35 deletions
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c
index 0fcd98bde0d1..11e884957162 100644
--- a/drivers/acpi/utilities/utcopy.c
+++ b/drivers/acpi/utilities/utcopy.c
@@ -49,21 +49,69 @@
49#define _COMPONENT ACPI_UTILITIES 49#define _COMPONENT ACPI_UTILITIES
50 ACPI_MODULE_NAME ("utcopy") 50 ACPI_MODULE_NAME ("utcopy")
51 51
52/* Local prototypes */
53
54static acpi_status
55acpi_ut_copy_isimple_to_esimple (
56 union acpi_operand_object *internal_object,
57 union acpi_object *external_object,
58 u8 *data_space,
59 acpi_size *buffer_space_used);
60
61static acpi_status
62acpi_ut_copy_ielement_to_ielement (
63 u8 object_type,
64 union acpi_operand_object *source_object,
65 union acpi_generic_state *state,
66 void *context);
67
68static acpi_status
69acpi_ut_copy_ipackage_to_epackage (
70 union acpi_operand_object *internal_object,
71 u8 *buffer,
72 acpi_size *space_used);
73
74static acpi_status
75acpi_ut_copy_esimple_to_isimple(
76 union acpi_object *user_obj,
77 union acpi_operand_object **return_obj);
78
79static acpi_status
80acpi_ut_copy_simple_object (
81 union acpi_operand_object *source_desc,
82 union acpi_operand_object *dest_desc);
83
84static acpi_status
85acpi_ut_copy_ielement_to_eelement (
86 u8 object_type,
87 union acpi_operand_object *source_object,
88 union acpi_generic_state *state,
89 void *context);
90
91static acpi_status
92acpi_ut_copy_ipackage_to_ipackage (
93 union acpi_operand_object *source_obj,
94 union acpi_operand_object *dest_obj,
95 struct acpi_walk_state *walk_state);
96
52 97
53/******************************************************************************* 98/*******************************************************************************
54 * 99 *
55 * FUNCTION: acpi_ut_copy_isimple_to_esimple 100 * FUNCTION: acpi_ut_copy_isimple_to_esimple
56 * 101 *
57 * PARAMETERS: *internal_object - Pointer to the object we are examining 102 * PARAMETERS: internal_object - Source object to be copied
58 * *Buffer - Where the object is returned 103 * external_object - Where to return the copied object
59 * *space_used - Where the data length is returned 104 * data_space - Where object data is returned (such as
105 * buffer and string data)
106 * buffer_space_used - Length of data_space that was used
60 * 107 *
61 * RETURN: Status 108 * RETURN: Status
62 * 109 *
63 * DESCRIPTION: This function is called to place a simple object in a user 110 * DESCRIPTION: This function is called to copy a simple internal object to
64 * buffer. 111 * an external object.
65 * 112 *
66 * The buffer is assumed to have sufficient space for the object. 113 * The data_space buffer is assumed to have sufficient space for
114 * the object.
67 * 115 *
68 ******************************************************************************/ 116 ******************************************************************************/
69 117
@@ -107,10 +155,12 @@ acpi_ut_copy_isimple_to_esimple (
107 155
108 external_object->string.pointer = (char *) data_space; 156 external_object->string.pointer = (char *) data_space;
109 external_object->string.length = internal_object->string.length; 157 external_object->string.length = internal_object->string.length;
110 *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD ((acpi_size) internal_object->string.length + 1); 158 *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD (
159 (acpi_size) internal_object->string.length + 1);
111 160
112 ACPI_MEMCPY ((void *) data_space, (void *) internal_object->string.pointer, 161 ACPI_MEMCPY ((void *) data_space,
113 (acpi_size) internal_object->string.length + 1); 162 (void *) internal_object->string.pointer,
163 (acpi_size) internal_object->string.length + 1);
114 break; 164 break;
115 165
116 166
@@ -118,10 +168,12 @@ acpi_ut_copy_isimple_to_esimple (
118 168
119 external_object->buffer.pointer = data_space; 169 external_object->buffer.pointer = data_space;
120 external_object->buffer.length = internal_object->buffer.length; 170 external_object->buffer.length = internal_object->buffer.length;
121 *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD (internal_object->string.length); 171 *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD (
172 internal_object->string.length);
122 173
123 ACPI_MEMCPY ((void *) data_space, (void *) internal_object->buffer.pointer, 174 ACPI_MEMCPY ((void *) data_space,
124 internal_object->buffer.length); 175 (void *) internal_object->buffer.pointer,
176 internal_object->buffer.length);
125 break; 177 break;
126 178
127 179
@@ -194,7 +246,7 @@ acpi_ut_copy_isimple_to_esimple (
194 * 246 *
195 ******************************************************************************/ 247 ******************************************************************************/
196 248
197acpi_status 249static acpi_status
198acpi_ut_copy_ielement_to_eelement ( 250acpi_ut_copy_ielement_to_eelement (
199 u8 object_type, 251 u8 object_type,
200 union acpi_operand_object *source_object, 252 union acpi_operand_object *source_object,
@@ -213,7 +265,7 @@ acpi_ut_copy_ielement_to_eelement (
213 265
214 this_index = state->pkg.index; 266 this_index = state->pkg.index;
215 target_object = (union acpi_object *) 267 target_object = (union acpi_object *)
216 &((union acpi_object *)(state->pkg.dest_object))->package.elements[this_index]; 268 &((union acpi_object *)(state->pkg.dest_object))->package.elements[this_index];
217 269
218 switch (object_type) { 270 switch (object_type) {
219 case ACPI_COPY_TYPE_SIMPLE: 271 case ACPI_COPY_TYPE_SIMPLE:
@@ -236,7 +288,8 @@ acpi_ut_copy_ielement_to_eelement (
236 */ 288 */
237 target_object->type = ACPI_TYPE_PACKAGE; 289 target_object->type = ACPI_TYPE_PACKAGE;
238 target_object->package.count = source_object->package.count; 290 target_object->package.count = source_object->package.count;
239 target_object->package.elements = ACPI_CAST_PTR (union acpi_object, info->free_space); 291 target_object->package.elements =
292 ACPI_CAST_PTR (union acpi_object, info->free_space);
240 293
241 /* 294 /*
242 * Pass the new package object back to the package walk routine 295 * Pass the new package object back to the package walk routine
@@ -248,7 +301,8 @@ acpi_ut_copy_ielement_to_eelement (
248 * update the buffer length counter 301 * update the buffer length counter
249 */ 302 */
250 object_space = ACPI_ROUND_UP_TO_NATIVE_WORD ( 303 object_space = ACPI_ROUND_UP_TO_NATIVE_WORD (
251 (acpi_size) target_object->package.count * sizeof (union acpi_object)); 304 (acpi_size) target_object->package.count *
305 sizeof (union acpi_object));
252 break; 306 break;
253 307
254 308
@@ -266,9 +320,9 @@ acpi_ut_copy_ielement_to_eelement (
266 * 320 *
267 * FUNCTION: acpi_ut_copy_ipackage_to_epackage 321 * FUNCTION: acpi_ut_copy_ipackage_to_epackage
268 * 322 *
269 * PARAMETERS: *internal_object - Pointer to the object we are returning 323 * PARAMETERS: internal_object - Pointer to the object we are returning
270 * *Buffer - Where the object is returned 324 * Buffer - Where the object is returned
271 * *space_used - Where the object length is returned 325 * space_used - Where the object length is returned
272 * 326 *
273 * RETURN: Status 327 * RETURN: Status
274 * 328 *
@@ -304,13 +358,15 @@ acpi_ut_copy_ipackage_to_epackage (
304 * Free space begins right after the first package 358 * Free space begins right after the first package
305 */ 359 */
306 info.length = ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object)); 360 info.length = ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object));
307 info.free_space = buffer + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object)); 361 info.free_space = buffer + ACPI_ROUND_UP_TO_NATIVE_WORD (
362 sizeof (union acpi_object));
308 info.object_space = 0; 363 info.object_space = 0;
309 info.num_packages = 1; 364 info.num_packages = 1;
310 365
311 external_object->type = ACPI_GET_OBJECT_TYPE (internal_object); 366 external_object->type = ACPI_GET_OBJECT_TYPE (internal_object);
312 external_object->package.count = internal_object->package.count; 367 external_object->package.count = internal_object->package.count;
313 external_object->package.elements = ACPI_CAST_PTR (union acpi_object, info.free_space); 368 external_object->package.elements = ACPI_CAST_PTR (union acpi_object,
369 info.free_space);
314 370
315 /* 371 /*
316 * Leave room for an array of ACPI_OBJECTS in the buffer 372 * Leave room for an array of ACPI_OBJECTS in the buffer
@@ -333,8 +389,8 @@ acpi_ut_copy_ipackage_to_epackage (
333 * 389 *
334 * FUNCTION: acpi_ut_copy_iobject_to_eobject 390 * FUNCTION: acpi_ut_copy_iobject_to_eobject
335 * 391 *
336 * PARAMETERS: *internal_object - The internal object to be converted 392 * PARAMETERS: internal_object - The internal object to be converted
337 * *buffer_ptr - Where the object is returned 393 * buffer_ptr - Where the object is returned
338 * 394 *
339 * RETURN: Status 395 * RETURN: Status
340 * 396 *
@@ -367,10 +423,10 @@ acpi_ut_copy_iobject_to_eobject (
367 * Build a simple object (no nested objects) 423 * Build a simple object (no nested objects)
368 */ 424 */
369 status = acpi_ut_copy_isimple_to_esimple (internal_object, 425 status = acpi_ut_copy_isimple_to_esimple (internal_object,
370 (union acpi_object *) ret_buffer->pointer, 426 (union acpi_object *) ret_buffer->pointer,
371 ((u8 *) ret_buffer->pointer + 427 ((u8 *) ret_buffer->pointer +
372 ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object))), 428 ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object))),
373 &ret_buffer->length); 429 &ret_buffer->length);
374 /* 430 /*
375 * build simple does not include the object size in the length 431 * build simple does not include the object size in the length
376 * so we add it in here 432 * so we add it in here
@@ -386,8 +442,8 @@ acpi_ut_copy_iobject_to_eobject (
386 * 442 *
387 * FUNCTION: acpi_ut_copy_esimple_to_isimple 443 * FUNCTION: acpi_ut_copy_esimple_to_isimple
388 * 444 *
389 * PARAMETERS: *external_object - The external object to be converted 445 * PARAMETERS: external_object - The external object to be converted
390 * *internal_object - Where the internal object is returned 446 * ret_internal_object - Where the internal object is returned
391 * 447 *
392 * RETURN: Status 448 * RETURN: Status
393 * 449 *
@@ -398,7 +454,7 @@ acpi_ut_copy_iobject_to_eobject (
398 * 454 *
399 ******************************************************************************/ 455 ******************************************************************************/
400 456
401acpi_status 457static acpi_status
402acpi_ut_copy_esimple_to_isimple ( 458acpi_ut_copy_esimple_to_isimple (
403 union acpi_object *external_object, 459 union acpi_object *external_object,
404 union acpi_operand_object **ret_internal_object) 460 union acpi_operand_object **ret_internal_object)
@@ -417,7 +473,8 @@ acpi_ut_copy_esimple_to_isimple (
417 case ACPI_TYPE_BUFFER: 473 case ACPI_TYPE_BUFFER:
418 case ACPI_TYPE_INTEGER: 474 case ACPI_TYPE_INTEGER:
419 475
420 internal_object = acpi_ut_create_internal_object ((u8) external_object->type); 476 internal_object = acpi_ut_create_internal_object (
477 (u8) external_object->type);
421 if (!internal_object) { 478 if (!internal_object) {
422 return_ACPI_STATUS (AE_NO_MEMORY); 479 return_ACPI_STATUS (AE_NO_MEMORY);
423 } 480 }
@@ -486,7 +543,6 @@ error_exit:
486 543
487 544
488#ifdef ACPI_FUTURE_IMPLEMENTATION 545#ifdef ACPI_FUTURE_IMPLEMENTATION
489
490/* Code to convert packages that are parameters to control methods */ 546/* Code to convert packages that are parameters to control methods */
491 547
492/******************************************************************************* 548/*******************************************************************************
@@ -614,7 +670,7 @@ acpi_ut_copy_eobject_to_iobject (
614 * 670 *
615 ******************************************************************************/ 671 ******************************************************************************/
616 672
617acpi_status 673static acpi_status
618acpi_ut_copy_simple_object ( 674acpi_ut_copy_simple_object (
619 union acpi_operand_object *source_desc, 675 union acpi_operand_object *source_desc,
620 union acpi_operand_object *dest_desc) 676 union acpi_operand_object *dest_desc)
@@ -724,7 +780,7 @@ acpi_ut_copy_simple_object (
724 * 780 *
725 ******************************************************************************/ 781 ******************************************************************************/
726 782
727acpi_status 783static acpi_status
728acpi_ut_copy_ielement_to_ielement ( 784acpi_ut_copy_ielement_to_ielement (
729 u8 object_type, 785 u8 object_type,
730 union acpi_operand_object *source_object, 786 union acpi_operand_object *source_object,
@@ -837,7 +893,7 @@ error_exit:
837 * 893 *
838 ******************************************************************************/ 894 ******************************************************************************/
839 895
840acpi_status 896static acpi_status
841acpi_ut_copy_ipackage_to_ipackage ( 897acpi_ut_copy_ipackage_to_ipackage (
842 union acpi_operand_object *source_obj, 898 union acpi_operand_object *source_obj,
843 union acpi_operand_object *dest_obj, 899 union acpi_operand_object *dest_obj,