aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/resources/rscreate.c
diff options
context:
space:
mode:
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 }