aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/resources/rscreate.c
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2005-09-30 19:03:00 -0400
committerLen Brown <len.brown@intel.com>2005-12-10 00:20:25 -0500
commit50eca3eb89d73d9f0aa070b126c7ee6a616016ab (patch)
treeb2d06d21b34b9bd17eea4c53cff1f3866fa1b21d /drivers/acpi/resources/rscreate.c
parent3d5271f9883cba7b54762bc4fe027d4172f06db7 (diff)
[ACPI] ACPICA 20050930
Completed a major overhaul of the Resource Manager code - specifically, optimizations in the area of the AML/internal resource conversion code. The code has been optimized to simplify and eliminate duplicated code, CPU stack use has been decreased by optimizing function parameters and local variables, and naming conventions across the manager have been standardized for clarity and ease of maintenance (this includes function, parameter, variable, and struct/typedef names.) All Resource Manager dispatch and information tables have been moved to a single location for clarity and ease of maintenance. One new file was created, named "rsinfo.c". The ACPI return macros (return_ACPI_STATUS, etc.) have been modified to guarantee that the argument is not evaluated twice, making them less prone to macro side-effects. However, since there exists the possibility of additional stack use if a particular compiler cannot optimize them (such as in the debug generation case), the original macros are optionally available. Note that some invocations of the return_VALUE macro may now cause size mismatch warnings; the return_UINT8 and return_UINT32 macros are provided to eliminate these. (From Randy Dunlap) Implemented a new mechanism to enable debug tracing for individual control methods. A new external interface, acpi_debug_trace(), is provided to enable this mechanism. The intent is to allow the host OS to easily enable and disable tracing for problematic control methods. This interface can be easily exposed to a user or debugger interface if desired. See the file psxface.c for details. acpi_ut_callocate() will now return a valid pointer if a length of zero is specified - a length of one is used and a warning is issued. This matches the behavior of acpi_ut_allocate(). Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/resources/rscreate.c')
-rw-r--r--drivers/acpi/resources/rscreate.c59
1 files changed, 26 insertions, 33 deletions
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c
index 0911526b7ad8..6c7c6c560635 100644
--- a/drivers/acpi/resources/rscreate.c
+++ b/drivers/acpi/resources/rscreate.c
@@ -53,10 +53,10 @@ ACPI_MODULE_NAME("rscreate")
53 * 53 *
54 * FUNCTION: acpi_rs_create_resource_list 54 * FUNCTION: acpi_rs_create_resource_list
55 * 55 *
56 * PARAMETERS: byte_stream_buffer - Pointer to the resource byte stream 56 * PARAMETERS: aml_buffer - Pointer to the resource byte stream
57 * output_buffer - Pointer to the user's buffer 57 * output_buffer - Pointer to the user's buffer
58 * 58 *
59 * RETURN: Status - AE_OK if okay, else a valid acpi_status code 59 * RETURN: Status: AE_OK if okay, else a valid acpi_status code
60 * If output_buffer is not large enough, output_buffer_length 60 * If output_buffer is not large enough, output_buffer_length
61 * indicates how large output_buffer should be, else it 61 * indicates how large output_buffer should be, else it
62 * indicates how may u8 elements of output_buffer are valid. 62 * indicates how may u8 elements of output_buffer are valid.
@@ -67,33 +67,30 @@ ACPI_MODULE_NAME("rscreate")
67 * 67 *
68 ******************************************************************************/ 68 ******************************************************************************/
69acpi_status 69acpi_status
70acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer, 70acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
71 struct acpi_buffer *output_buffer) 71 struct acpi_buffer *output_buffer)
72{ 72{
73 73
74 acpi_status status; 74 acpi_status status;
75 u8 *byte_stream_start; 75 u8 *aml_start;
76 acpi_size list_size_needed = 0; 76 acpi_size list_size_needed = 0;
77 u32 byte_stream_buffer_length; 77 u32 aml_buffer_length;
78 78
79 ACPI_FUNCTION_TRACE("rs_create_resource_list"); 79 ACPI_FUNCTION_TRACE("rs_create_resource_list");
80 80
81 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "byte_stream_buffer = %p\n", 81 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aml_buffer = %p\n", aml_buffer));
82 byte_stream_buffer));
83 82
84 /* Params already validated, so we don't re-validate here */ 83 /* Params already validated, so we don't re-validate here */
85 84
86 byte_stream_buffer_length = byte_stream_buffer->buffer.length; 85 aml_buffer_length = aml_buffer->buffer.length;
87 byte_stream_start = byte_stream_buffer->buffer.pointer; 86 aml_start = aml_buffer->buffer.pointer;
88 87
89 /* 88 /*
90 * Pass the byte_stream_buffer into a module that can calculate 89 * Pass the aml_buffer into a module that can calculate
91 * the buffer size needed for the linked list 90 * the buffer size needed for the linked list
92 */ 91 */
93 status = 92 status = acpi_rs_get_list_length(aml_start, aml_buffer_length,
94 acpi_rs_get_list_length(byte_stream_start, 93 &list_size_needed);
95 byte_stream_buffer_length,
96 &list_size_needed);
97 94
98 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Status=%X list_size_needed=%X\n", 95 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Status=%X list_size_needed=%X\n",
99 status, (u32) list_size_needed)); 96 status, (u32) list_size_needed));
@@ -110,10 +107,8 @@ acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer,
110 107
111 /* Do the conversion */ 108 /* Do the conversion */
112 109
113 status = 110 status = acpi_rs_convert_aml_to_resources(aml_start, aml_buffer_length,
114 acpi_rs_byte_stream_to_list(byte_stream_start, 111 output_buffer->pointer);
115 byte_stream_buffer_length,
116 output_buffer->pointer);
117 if (ACPI_FAILURE(status)) { 112 if (ACPI_FAILURE(status)) {
118 return_ACPI_STATUS(status); 113 return_ACPI_STATUS(status);
119 } 114 }
@@ -360,7 +355,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
360 355
361/******************************************************************************* 356/*******************************************************************************
362 * 357 *
363 * FUNCTION: acpi_rs_create_byte_stream 358 * FUNCTION: acpi_rs_create_aml_resources
364 * 359 *
365 * PARAMETERS: linked_list_buffer - Pointer to the resource linked list 360 * PARAMETERS: linked_list_buffer - Pointer to the resource linked list
366 * output_buffer - Pointer to the user's buffer 361 * output_buffer - Pointer to the user's buffer
@@ -377,13 +372,13 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
377 ******************************************************************************/ 372 ******************************************************************************/
378 373
379acpi_status 374acpi_status
380acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, 375acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
381 struct acpi_buffer *output_buffer) 376 struct acpi_buffer *output_buffer)
382{ 377{
383 acpi_status status; 378 acpi_status status;
384 acpi_size byte_stream_size_needed = 0; 379 acpi_size aml_size_needed = 0;
385 380
386 ACPI_FUNCTION_TRACE("rs_create_byte_stream"); 381 ACPI_FUNCTION_TRACE("rs_create_aml_resources");
387 382
388 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "linked_list_buffer = %p\n", 383 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "linked_list_buffer = %p\n",
389 linked_list_buffer)); 384 linked_list_buffer));
@@ -394,11 +389,10 @@ acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer,
394 * Pass the linked_list_buffer into a module that calculates 389 * Pass the linked_list_buffer into a module that calculates
395 * the buffer size needed for the byte stream. 390 * the buffer size needed for the byte stream.
396 */ 391 */
397 status = acpi_rs_get_byte_stream_length(linked_list_buffer, 392 status = acpi_rs_get_aml_length(linked_list_buffer, &aml_size_needed);
398 &byte_stream_size_needed);
399 393
400 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "byte_stream_size_needed=%X, %s\n", 394 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aml_size_needed=%X, %s\n",
401 (u32) byte_stream_size_needed, 395 (u32) aml_size_needed,
402 acpi_format_exception(status))); 396 acpi_format_exception(status)));
403 if (ACPI_FAILURE(status)) { 397 if (ACPI_FAILURE(status)) {
404 return_ACPI_STATUS(status); 398 return_ACPI_STATUS(status);
@@ -406,8 +400,7 @@ acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer,
406 400
407 /* Validate/Allocate/Clear caller buffer */ 401 /* Validate/Allocate/Clear caller buffer */
408 402
409 status = 403 status = acpi_ut_initialize_buffer(output_buffer, aml_size_needed);
410 acpi_ut_initialize_buffer(output_buffer, byte_stream_size_needed);
411 if (ACPI_FAILURE(status)) { 404 if (ACPI_FAILURE(status)) {
412 return_ACPI_STATUS(status); 405 return_ACPI_STATUS(status);
413 } 406 }
@@ -415,9 +408,9 @@ acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer,
415 /* Do the conversion */ 408 /* Do the conversion */
416 409
417 status = 410 status =
418 acpi_rs_list_to_byte_stream(linked_list_buffer, 411 acpi_rs_convert_resources_to_aml(linked_list_buffer,
419 byte_stream_size_needed, 412 aml_size_needed,
420 output_buffer->pointer); 413 output_buffer->pointer);
421 if (ACPI_FAILURE(status)) { 414 if (ACPI_FAILURE(status)) {
422 return_ACPI_STATUS(status); 415 return_ACPI_STATUS(status);
423 } 416 }