aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2005-11-17 13:07:00 -0500
committerLen Brown <len.brown@intel.com>2005-12-10 00:27:56 -0500
commitc51a4de85de720670f2fbc592a6f8040af72ad87 (patch)
treeccaa60c483fcc904abd63d936ff7dc380bf28e7b /drivers/acpi/utilities
parent96db255c8f014ae3497507104e8df809785a619f (diff)
[ACPI] ACPICA 20051117
Fixed a problem in the AML parser where the method thread count could be decremented below zero if any errors occurred during the method parse phase. This should eliminate AE_AML_METHOD_LIMIT exceptions seen on some machines. This also fixed a related regression with the mechanism that detects and corrects methods that cannot properly handle reentrancy (related to the deployment of the new OwnerId mechanism.) Eliminated the pre-parsing of control methods (to detect errors) during table load. Related to the problem above, this was causing unwind issues if any errors occurred during the parse, and it seemed to be overkill. A table load should not be aborted if there are problems with any single control method, thus rendering this feature rather pointless. Fixed a problem with the new table-driven resource manager where an internal buffer overflow could occur for small resource templates. Implemented a new external interface, acpi_get_vendor_resource() This interface will find and return a vendor-defined resource descriptor within a _CRS or _PRS method via an ACPI 3.0 UUID match. (from Bjorn Helgaas) Removed the length limit (200) on string objects as per the upcoming ACPI 3.0A specification. This affects the following areas of the interpreter: 1) any implicit conversion of a Buffer to a String, 2) a String object result of the ASL Concatentate operator, 3) the String object result of the ASL ToString operator. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/utilities')
-rw-r--r--drivers/acpi/utilities/utcopy.c19
-rw-r--r--drivers/acpi/utilities/utglobal.c4
-rw-r--r--drivers/acpi/utilities/utmisc.c34
-rw-r--r--drivers/acpi/utilities/utresrc.c19
4 files changed, 49 insertions, 27 deletions
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c
index 5442b32de611..568df9e42f89 100644
--- a/drivers/acpi/utilities/utcopy.c
+++ b/drivers/acpi/utilities/utcopy.c
@@ -398,14 +398,17 @@ acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *internal_object,
398 * Build a simple object (no nested objects) 398 * Build a simple object (no nested objects)
399 */ 399 */
400 status = acpi_ut_copy_isimple_to_esimple(internal_object, 400 status = acpi_ut_copy_isimple_to_esimple(internal_object,
401 (union acpi_object *) 401 ACPI_CAST_PTR(union
402 ret_buffer->pointer, 402 acpi_object,
403 ((u8 *) ret_buffer-> 403 ret_buffer->
404 pointer + 404 pointer),
405 ACPI_ROUND_UP_TO_NATIVE_WORD 405 ACPI_ADD_PTR(u8,
406 (sizeof 406 ret_buffer->
407 (union 407 pointer,
408 acpi_object))), 408 ACPI_ROUND_UP_TO_NATIVE_WORD
409 (sizeof
410 (union
411 acpi_object))),
409 &ret_buffer->length); 412 &ret_buffer->length);
410 /* 413 /*
411 * build simple does not include the object size in the length 414 * build simple does not include the object size in the length
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
index 413e1dd8ae36..d6813d88a104 100644
--- a/drivers/acpi/utilities/utglobal.c
+++ b/drivers/acpi/utilities/utglobal.c
@@ -638,7 +638,7 @@ char *acpi_ut_get_node_name(void *object)
638 638
639 /* Name must be a valid ACPI name */ 639 /* Name must be a valid ACPI name */
640 640
641 if (!acpi_ut_valid_acpi_name(*(u32 *) node->name.ascii)) { 641 if (!acpi_ut_valid_acpi_name(node->name.integer)) {
642 return ("????"); 642 return ("????");
643 } 643 }
644 644
@@ -831,6 +831,7 @@ void acpi_ut_init_globals(void)
831 acpi_gbl_ps_find_count = 0; 831 acpi_gbl_ps_find_count = 0;
832 acpi_gbl_acpi_hardware_present = TRUE; 832 acpi_gbl_acpi_hardware_present = TRUE;
833 acpi_gbl_owner_id_mask = 0; 833 acpi_gbl_owner_id_mask = 0;
834 acpi_gbl_last_owner_id = 0;
834 acpi_gbl_trace_method_name = 0; 835 acpi_gbl_trace_method_name = 0;
835 acpi_gbl_trace_dbg_level = 0; 836 acpi_gbl_trace_dbg_level = 0;
836 acpi_gbl_trace_dbg_layer = 0; 837 acpi_gbl_trace_dbg_layer = 0;
@@ -845,7 +846,6 @@ void acpi_ut_init_globals(void)
845 /* Namespace */ 846 /* Namespace */
846 847
847 acpi_gbl_root_node = NULL; 848 acpi_gbl_root_node = NULL;
848
849 acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; 849 acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME;
850 acpi_gbl_root_node_struct.descriptor = ACPI_DESC_TYPE_NAMED; 850 acpi_gbl_root_node_struct.descriptor = ACPI_DESC_TYPE_NAMED;
851 acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; 851 acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE;
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
index 2a9110c06391..89efba7bf449 100644
--- a/drivers/acpi/utilities/utmisc.c
+++ b/drivers/acpi/utilities/utmisc.c
@@ -63,6 +63,7 @@ ACPI_MODULE_NAME("utmisc")
63acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) 63acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
64{ 64{
65 acpi_native_uint i; 65 acpi_native_uint i;
66 acpi_native_uint j;
66 acpi_status status; 67 acpi_status status;
67 68
68 ACPI_FUNCTION_TRACE("ut_allocate_owner_id"); 69 ACPI_FUNCTION_TRACE("ut_allocate_owner_id");
@@ -82,29 +83,46 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
82 return_ACPI_STATUS(status); 83 return_ACPI_STATUS(status);
83 } 84 }
84 85
85 /* Find a free owner ID */ 86 /*
87 * Find a free owner ID, cycle through all possible IDs on repeated
88 * allocations. Note: Index for next possible ID is equal to the value
89 * of the last allocated ID.
90 */
91 for (i = 0, j = acpi_gbl_last_owner_id; i < 32; i++, j++) {
92 if (j >= 32) {
93 j = 0; /* Wraparound to ID start */
94 }
95
96 if (!(acpi_gbl_owner_id_mask & (1 << j))) {
97 /*
98 * Found a free ID. The actual ID is the bit index plus one,
99 * making zero an invalid Owner ID. Save this as the last ID
100 * allocated and update the global ID mask.
101 */
102 acpi_gbl_last_owner_id = (acpi_owner_id) (j + 1);
103 *owner_id = acpi_gbl_last_owner_id;
86 104
87 for (i = 0; i < 32; i++) {
88 if (!(acpi_gbl_owner_id_mask & (1 << i))) {
89 ACPI_DEBUG_PRINT((ACPI_DB_VALUES, 105 ACPI_DEBUG_PRINT((ACPI_DB_VALUES,
90 "Current owner_id mask: %8.8X New ID: %2.2X\n", 106 "Current owner_id mask: %8.8X New ID: %2.2X\n",
91 acpi_gbl_owner_id_mask, 107 acpi_gbl_owner_id_mask,
92 (unsigned int)(i + 1))); 108 (unsigned int)
109 acpi_gbl_last_owner_id));
93 110
94 acpi_gbl_owner_id_mask |= (1 << i); 111 acpi_gbl_owner_id_mask |= (1 << j);
95 *owner_id = (acpi_owner_id) (i + 1);
96 goto exit; 112 goto exit;
97 } 113 }
98 } 114 }
99 115
100 /* 116 /*
101 * If we are here, all owner_ids have been allocated. This probably should 117 * All owner_ids have been allocated. This typically should
102 * not happen since the IDs are reused after deallocation. The IDs are 118 * not happen since the IDs are reused after deallocation. The IDs are
103 * allocated upon table load (one per table) and method execution, and 119 * allocated upon table load (one per table) and method execution, and
104 * they are released when a table is unloaded or a method completes 120 * they are released when a table is unloaded or a method completes
105 * execution. 121 * execution.
122 *
123 * If this error happens, there may be very deep nesting of invoked control
124 * methods, or there may be a bug where the IDs are not released.
106 */ 125 */
107 *owner_id = 0;
108 status = AE_OWNER_ID_LIMIT; 126 status = AE_OWNER_ID_LIMIT;
109 ACPI_REPORT_ERROR(("Could not allocate new owner_id (32 max), AE_OWNER_ID_LIMIT\n")); 127 ACPI_REPORT_ERROR(("Could not allocate new owner_id (32 max), AE_OWNER_ID_LIMIT\n"));
110 128
diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c
index 07a314c710d8..6c0ce7b12194 100644
--- a/drivers/acpi/utilities/utresrc.c
+++ b/drivers/acpi/utilities/utresrc.c
@@ -157,7 +157,7 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index)
157 /* 157 /*
158 * 1) Validate the resource_type field (Byte 0) 158 * 1) Validate the resource_type field (Byte 0)
159 */ 159 */
160 resource_type = *((u8 *) aml); 160 resource_type = ACPI_GET8(aml);
161 161
162 /* 162 /*
163 * Byte 0 contains the descriptor name (Resource Type) 163 * Byte 0 contains the descriptor name (Resource Type)
@@ -266,14 +266,14 @@ u8 acpi_ut_get_resource_type(void *aml)
266 * Byte 0 contains the descriptor name (Resource Type) 266 * Byte 0 contains the descriptor name (Resource Type)
267 * Examine the large/small bit in the resource header 267 * Examine the large/small bit in the resource header
268 */ 268 */
269 if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) { 269 if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) {
270 /* Large Resource Type -- bits 6:0 contain the name */ 270 /* Large Resource Type -- bits 6:0 contain the name */
271 271
272 return (*((u8 *) aml)); 272 return (ACPI_GET8(aml));
273 } else { 273 } else {
274 /* Small Resource Type -- bits 6:3 contain the name */ 274 /* Small Resource Type -- bits 6:3 contain the name */
275 275
276 return ((u8) (*((u8 *) aml) & ACPI_RESOURCE_NAME_SMALL_MASK)); 276 return ((u8) (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_SMALL_MASK));
277 } 277 }
278} 278}
279 279
@@ -301,15 +301,15 @@ u16 acpi_ut_get_resource_length(void *aml)
301 * Byte 0 contains the descriptor name (Resource Type) 301 * Byte 0 contains the descriptor name (Resource Type)
302 * Examine the large/small bit in the resource header 302 * Examine the large/small bit in the resource header
303 */ 303 */
304 if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) { 304 if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) {
305 /* Large Resource type -- bytes 1-2 contain the 16-bit length */ 305 /* Large Resource type -- bytes 1-2 contain the 16-bit length */
306 306
307 ACPI_MOVE_16_TO_16(&resource_length, &((u8 *) aml)[1]); 307 ACPI_MOVE_16_TO_16(&resource_length, ACPI_ADD_PTR(u8, aml, 1));
308 308
309 } else { 309 } else {
310 /* Small Resource type -- bits 2:0 of byte 0 contain the length */ 310 /* Small Resource type -- bits 2:0 of byte 0 contain the length */
311 311
312 resource_length = (u16) (*((u8 *) aml) & 312 resource_length = (u16) (ACPI_GET8(aml) &
313 ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK); 313 ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK);
314 } 314 }
315 315
@@ -334,7 +334,7 @@ u8 acpi_ut_get_resource_header_length(void *aml)
334 334
335 /* Examine the large/small bit in the resource header */ 335 /* Examine the large/small bit in the resource header */
336 336
337 if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) { 337 if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) {
338 return (sizeof(struct aml_resource_large_header)); 338 return (sizeof(struct aml_resource_large_header));
339 } else { 339 } else {
340 return (sizeof(struct aml_resource_small_header)); 340 return (sizeof(struct aml_resource_small_header));
@@ -372,8 +372,9 @@ u32 acpi_ut_get_descriptor_length(void *aml)
372 * FUNCTION: acpi_ut_get_resource_end_tag 372 * FUNCTION: acpi_ut_get_resource_end_tag
373 * 373 *
374 * PARAMETERS: obj_desc - The resource template buffer object 374 * PARAMETERS: obj_desc - The resource template buffer object
375 * end_tag - Where the pointer to the end_tag is returned
375 * 376 *
376 * RETURN: Pointer to the end tag 377 * RETURN: Status, pointer to the end tag
377 * 378 *
378 * DESCRIPTION: Find the end_tag resource descriptor in an AML resource template 379 * DESCRIPTION: Find the end_tag resource descriptor in an AML resource template
379 * 380 *