[ACPI] ACPICA 20050930
[pandora-kernel.git] / drivers / acpi / resources / rsutils.c
1 /*******************************************************************************
2  *
3  * Module Name: rsutils - Utilities for the resource manager
4  *
5  ******************************************************************************/
6
7 /*
8  * Copyright (C) 2000 - 2005, R. Byron Moore
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions, and the following disclaimer,
16  *    without modification.
17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18  *    substantially similar to the "NO WARRANTY" disclaimer below
19  *    ("Disclaimer") and any redistribution must be conditioned upon
20  *    including a substantially similar Disclaimer requirement for further
21  *    binary redistribution.
22  * 3. Neither the names of the above-listed copyright holders nor the names
23  *    of any contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * Alternatively, this software may be distributed under the terms of the
27  * GNU General Public License ("GPL") version 2 as published by the Free
28  * Software Foundation.
29  *
30  * NO WARRANTY
31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41  * POSSIBILITY OF SUCH DAMAGES.
42  */
43
44 #include <acpi/acpi.h>
45 #include <acpi/acnamesp.h>
46 #include <acpi/acresrc.h>
47
48 #define _COMPONENT          ACPI_RESOURCES
49 ACPI_MODULE_NAME("rsutils")
50
51 /*******************************************************************************
52  *
53  * FUNCTION:    acpi_rs_move_data
54  *
55  * PARAMETERS:  Destination         - Pointer to the destination descriptor
56  *              Source              - Pointer to the source descriptor
57  *              item_count          - How many items to move
58  *              move_type           - Byte width
59  *
60  * RETURN:      None
61  *
62  * DESCRIPTION: Move multiple data items from one descriptor to another. Handles
63  *              alignment issues and endian issues if necessary, as configured
64  *              via the ACPI_MOVE_* macros. (This is why a memcpy is not used)
65  *
66  ******************************************************************************/
67 void
68 acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type)
69 {
70         acpi_native_uint i;
71
72         /* One move per item */
73
74         for (i = 0; i < item_count; i++) {
75                 switch (move_type) {
76                 case ACPI_MOVE_TYPE_16_TO_32:
77                         ACPI_MOVE_16_TO_32(&((u32 *) destination)[i],
78                                            &((u16 *) source)[i]);
79                         break;
80
81                 case ACPI_MOVE_TYPE_32_TO_16:
82                         ACPI_MOVE_32_TO_16(&((u16 *) destination)[i],
83                                            &((u32 *) source)[i]);
84                         break;
85
86                 case ACPI_MOVE_TYPE_32_TO_32:
87                         ACPI_MOVE_32_TO_32(&((u32 *) destination)[i],
88                                            &((u32 *) source)[i]);
89                         break;
90
91                 case ACPI_MOVE_TYPE_64_TO_64:
92                         ACPI_MOVE_64_TO_64(&((u64 *) destination)[i],
93                                            &((u64 *) source)[i]);
94                         break;
95
96                 default:
97                         return;
98                 }
99         }
100 }
101
102 /*******************************************************************************
103  *
104  * FUNCTION:    acpi_rs_get_resource_info
105  *
106  * PARAMETERS:  resource_type       - Byte 0 of a resource descriptor
107  *
108  * RETURN:      Pointer to the resource conversion handler
109  *
110  * DESCRIPTION: Extract the Resource Type/Name from the first byte of
111  *              a resource descriptor.
112  *
113  ******************************************************************************/
114
115 struct acpi_resource_info *acpi_rs_get_resource_info(u8 resource_type)
116 {
117         struct acpi_resource_info *size_info;
118
119         ACPI_FUNCTION_ENTRY();
120
121         /* Determine if this is a small or large resource */
122
123         if (resource_type & ACPI_RESOURCE_NAME_LARGE) {
124                 /* Large Resource Type -- bits 6:0 contain the name */
125
126                 if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) {
127                         return (NULL);
128                 }
129
130                 size_info = &acpi_gbl_lg_resource_info[(resource_type &
131                                                         ACPI_RESOURCE_NAME_LARGE_MASK)];
132         } else {
133                 /* Small Resource Type -- bits 6:3 contain the name */
134
135                 size_info = &acpi_gbl_sm_resource_info[((resource_type &
136                                                          ACPI_RESOURCE_NAME_SMALL_MASK)
137                                                         >> 3)];
138         }
139
140         /* Zero entry indicates an invalid resource type */
141
142         if (!size_info->minimum_internal_struct_length) {
143                 return (NULL);
144         }
145
146         return (size_info);
147 }
148
149 /*******************************************************************************
150  *
151  * FUNCTION:    acpi_rs_get_resource_length
152  *
153  * PARAMETERS:  Aml             - Pointer to the raw AML resource descriptor
154  *
155  * RETURN:      Byte Length
156  *
157  * DESCRIPTION: Get the "Resource Length" of a raw AML descriptor. By
158  *              definition, this does not include the size of the descriptor
159  *              header or the length field itself.
160  *
161  ******************************************************************************/
162
163 u16 acpi_rs_get_resource_length(union aml_resource * aml)
164 {
165         u16 resource_length;
166
167         ACPI_FUNCTION_ENTRY();
168
169         /* Determine if this is a small or large resource */
170
171         if (aml->large_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) {
172                 /* Large Resource type -- bytes 1-2 contain the 16-bit length */
173
174                 ACPI_MOVE_16_TO_16(&resource_length,
175                                    &aml->large_header.resource_length);
176
177         } else {
178                 /* Small Resource type -- bits 2:0 of byte 0 contain the length */
179
180                 resource_length = (u16) (aml->small_header.descriptor_type &
181                                          ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK);
182         }
183
184         return (resource_length);
185 }
186
187 /*******************************************************************************
188  *
189  * FUNCTION:    acpi_rs_get_descriptor_length
190  *
191  * PARAMETERS:  Aml             - Pointer to the raw AML resource descriptor
192  *
193  * RETURN:      Byte length
194  *
195  * DESCRIPTION: Get the total byte length of a raw AML descriptor, including the
196  *              length of the descriptor header and the length field itself.
197  *              Used to walk descriptor lists.
198  *
199  ******************************************************************************/
200
201 u32 acpi_rs_get_descriptor_length(union aml_resource * aml)
202 {
203         u32 descriptor_length;
204
205         ACPI_FUNCTION_ENTRY();
206
207         /* Determine if this is a small or large resource */
208
209         if (aml->large_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) {
210                 /* Large Resource type -- bytes 1-2 contain the 16-bit length */
211
212                 ACPI_MOVE_16_TO_32(&descriptor_length,
213                                    &aml->large_header.resource_length);
214                 descriptor_length += sizeof(struct aml_resource_large_header);
215
216         } else {
217                 /* Small Resource type -- bits 2:0 of byte 0 contain the length */
218
219                 descriptor_length = (u32) (aml->small_header.descriptor_type &
220                                            ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK);
221                 descriptor_length += sizeof(struct aml_resource_small_header);
222         }
223
224         return (descriptor_length);
225 }
226
227 /*******************************************************************************
228  *
229  * FUNCTION:    acpi_rs_set_resource_header
230  *
231  * PARAMETERS:  descriptor_type     - Byte to be inserted as the type
232  *              total_length        - Length of the AML descriptor, including
233  *                                    the header and length fields.
234  *              Aml                 - Pointer to the raw AML descriptor
235  *
236  * RETURN:      None
237  *
238  * DESCRIPTION: Set the descriptor_type and resource_length fields of an AML
239  *              resource descriptor, both Large and Small descriptors are
240  *              supported automatically
241  *
242  ******************************************************************************/
243
244 void
245 acpi_rs_set_resource_header(u8 descriptor_type,
246                             acpi_size total_length, union aml_resource *aml)
247 {
248         u16 resource_length;
249
250         ACPI_FUNCTION_ENTRY();
251
252         /* Set the descriptor type */
253
254         aml->small_header.descriptor_type = descriptor_type;
255
256         /* Determine if this is a small or large resource */
257
258         if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) {
259                 /* Large Resource type -- bytes 1-2 contain the 16-bit length */
260
261                 resource_length =
262                     (u16) (total_length -
263                            sizeof(struct aml_resource_large_header));
264
265                 /* Insert length into the Large descriptor length field */
266
267                 ACPI_MOVE_16_TO_16(&aml->large_header.resource_length,
268                                    &resource_length);
269         } else {
270                 /* Small Resource type -- bits 2:0 of byte 0 contain the length */
271
272                 resource_length =
273                     (u16) (total_length -
274                            sizeof(struct aml_resource_small_header));
275
276                 /* Insert length into the descriptor type byte */
277
278                 aml->small_header.descriptor_type |= (u8) resource_length;
279         }
280 }
281
282 /*******************************************************************************
283  *
284  * FUNCTION:    acpi_rs_get_resource_type
285  *
286  * PARAMETERS:  resource_type       - Byte 0 of a resource descriptor
287  *
288  * RETURN:      The Resource Type with no extraneous bits (except the
289  *              Large/Small descriptor bit -- this is left alone)
290  *
291  * DESCRIPTION: Extract the Resource Type/Name from the first byte of
292  *              a resource descriptor.
293  *
294  ******************************************************************************/
295
296 u8 acpi_rs_get_resource_type(u8 resource_type)
297 {
298         ACPI_FUNCTION_ENTRY();
299
300         /* Determine if this is a small or large resource */
301
302         if (resource_type & ACPI_RESOURCE_NAME_LARGE) {
303                 /* Large Resource Type -- bits 6:0 contain the name */
304
305                 return (resource_type);
306         } else {
307                 /* Small Resource Type -- bits 6:3 contain the name */
308
309                 return ((u8) (resource_type & ACPI_RESOURCE_NAME_SMALL_MASK));
310         }
311 }
312
313 /*******************************************************************************
314  *
315  * FUNCTION:    acpi_rs_strcpy
316  *
317  * PARAMETERS:  Destination         - Pointer to the destination string
318  *              Source              - Pointer to the source string
319  *
320  * RETURN:      String length, including NULL terminator
321  *
322  * DESCRIPTION: Local string copy that returns the string length, saving a
323  *              strcpy followed by a strlen.
324  *
325  ******************************************************************************/
326
327 static u16 acpi_rs_strcpy(char *destination, char *source)
328 {
329         u16 i;
330
331         ACPI_FUNCTION_ENTRY();
332
333         for (i = 0; source[i]; i++) {
334                 destination[i] = source[i];
335         }
336
337         destination[i] = 0;
338
339         /* Return string length including the NULL terminator */
340
341         return ((u16) (i + 1));
342 }
343
344 /*******************************************************************************
345  *
346  * FUNCTION:    acpi_rs_get_resource_source
347  *
348  * PARAMETERS:  resource_length     - Length field of the descriptor
349  *              minimum_length      - Minimum length of the descriptor (minus
350  *                                    any optional fields)
351  *              resource_source     - Where the resource_source is returned
352  *              Aml                 - Pointer to the raw AML descriptor
353  *              string_ptr          - (optional) where to store the actual
354  *                                    resource_source string
355  *
356  * RETURN:      Length of the string plus NULL terminator, rounded up to 32 bit
357  *
358  * DESCRIPTION: Copy the optional resource_source data from a raw AML descriptor
359  *              to an internal resource descriptor
360  *
361  ******************************************************************************/
362
363 u16
364 acpi_rs_get_resource_source(u16 resource_length,
365                             acpi_size minimum_length,
366                             struct acpi_resource_source * resource_source,
367                             union aml_resource * aml, char *string_ptr)
368 {
369         acpi_size total_length;
370         u8 *aml_resource_source;
371
372         ACPI_FUNCTION_ENTRY();
373
374         total_length =
375             resource_length + sizeof(struct aml_resource_large_header);
376         aml_resource_source = ((u8 *) aml) + minimum_length;
377
378         /*
379          * resource_source is present if the length of the descriptor is longer than
380          * the minimum length.
381          *
382          * Note: Some resource descriptors will have an additional null, so
383          * we add 1 to the minimum length.
384          */
385         if (total_length > (minimum_length + 1)) {
386                 /* Get the resource_source_index */
387
388                 resource_source->index = aml_resource_source[0];
389
390                 resource_source->string_ptr = string_ptr;
391                 if (!string_ptr) {
392                         /*
393                          * String destination pointer is not specified; Set the String
394                          * pointer to the end of the current resource_source structure.
395                          */
396                         resource_source->string_ptr = (char *)
397                             ((u8 *) resource_source) +
398                             sizeof(struct acpi_resource_source);
399                 }
400
401                 /* Copy the resource_source string to the destination */
402
403                 resource_source->string_length =
404                     acpi_rs_strcpy(resource_source->string_ptr,
405                                    (char *)&aml_resource_source[1]);
406
407                 /*
408                  * In order for the struct_size to fall on a 32-bit boundary,
409                  * calculate the length of the string and expand the
410                  * struct_size to the next 32-bit boundary.
411                  */
412                 return ((u16)
413                         ACPI_ROUND_UP_to_32_bITS(resource_source->
414                                                  string_length));
415         } else {
416                 /* resource_source is not present */
417
418                 resource_source->index = 0;
419                 resource_source->string_length = 0;
420                 resource_source->string_ptr = NULL;
421                 return (0);
422         }
423 }
424
425 /*******************************************************************************
426  *
427  * FUNCTION:    acpi_rs_set_resource_source
428  *
429  * PARAMETERS:  Aml                 - Pointer to the raw AML descriptor
430  *              minimum_length      - Minimum length of the descriptor (minus
431  *                                    any optional fields)
432  *              resource_source     - Internal resource_source
433
434  *
435  * RETURN:      Total length of the AML descriptor
436  *
437  * DESCRIPTION: Convert an optoinal resource_source from internal format to a
438  *              raw AML resource descriptor
439  *
440  ******************************************************************************/
441
442 acpi_size
443 acpi_rs_set_resource_source(union aml_resource * aml,
444                             acpi_size minimum_length,
445                             struct acpi_resource_source * resource_source)
446 {
447         u8 *aml_resource_source;
448         acpi_size descriptor_length;
449
450         ACPI_FUNCTION_ENTRY();
451
452         descriptor_length = minimum_length;
453
454         /* Non-zero string length indicates presence of a resource_source */
455
456         if (resource_source->string_length) {
457                 /* Point to the end of the AML descriptor */
458
459                 aml_resource_source = ((u8 *) aml) + minimum_length;
460
461                 /* Copy the resource_source_index */
462
463                 aml_resource_source[0] = (u8) resource_source->index;
464
465                 /* Copy the resource_source string */
466
467                 ACPI_STRCPY((char *)&aml_resource_source[1],
468                             resource_source->string_ptr);
469
470                 /*
471                  * Add the length of the string (+ 1 for null terminator) to the
472                  * final descriptor length
473                  */
474                 descriptor_length +=
475                     ((acpi_size) resource_source->string_length + 1);
476         }
477
478         /* Return the new total length of the AML descriptor */
479
480         return (descriptor_length);
481 }
482
483 /*******************************************************************************
484  *
485  * FUNCTION:    acpi_rs_get_prt_method_data
486  *
487  * PARAMETERS:  Handle          - a handle to the containing object
488  *              ret_buffer      - a pointer to a buffer structure for the
489  *                                  results
490  *
491  * RETURN:      Status
492  *
493  * DESCRIPTION: This function is called to get the _PRT value of an object
494  *              contained in an object specified by the handle passed in
495  *
496  *              If the function fails an appropriate status will be returned
497  *              and the contents of the callers buffer is undefined.
498  *
499  ******************************************************************************/
500
501 acpi_status
502 acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer)
503 {
504         union acpi_operand_object *obj_desc;
505         acpi_status status;
506
507         ACPI_FUNCTION_TRACE("rs_get_prt_method_data");
508
509         /* Parameters guaranteed valid by caller */
510
511         /* Execute the method, no parameters */
512
513         status = acpi_ut_evaluate_object(handle, METHOD_NAME__PRT,
514                                          ACPI_BTYPE_PACKAGE, &obj_desc);
515         if (ACPI_FAILURE(status)) {
516                 return_ACPI_STATUS(status);
517         }
518
519         /*
520          * Create a resource linked list from the byte stream buffer that comes
521          * back from the _CRS method execution.
522          */
523         status = acpi_rs_create_pci_routing_table(obj_desc, ret_buffer);
524
525         /* On exit, we must delete the object returned by evaluate_object */
526
527         acpi_ut_remove_reference(obj_desc);
528         return_ACPI_STATUS(status);
529 }
530
531 /*******************************************************************************
532  *
533  * FUNCTION:    acpi_rs_get_crs_method_data
534  *
535  * PARAMETERS:  Handle          - a handle to the containing object
536  *              ret_buffer      - a pointer to a buffer structure for the
537  *                                  results
538  *
539  * RETURN:      Status
540  *
541  * DESCRIPTION: This function is called to get the _CRS value of an object
542  *              contained in an object specified by the handle passed in
543  *
544  *              If the function fails an appropriate status will be returned
545  *              and the contents of the callers buffer is undefined.
546  *
547  ******************************************************************************/
548
549 acpi_status
550 acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer)
551 {
552         union acpi_operand_object *obj_desc;
553         acpi_status status;
554
555         ACPI_FUNCTION_TRACE("rs_get_crs_method_data");
556
557         /* Parameters guaranteed valid by caller */
558
559         /* Execute the method, no parameters */
560
561         status = acpi_ut_evaluate_object(handle, METHOD_NAME__CRS,
562                                          ACPI_BTYPE_BUFFER, &obj_desc);
563         if (ACPI_FAILURE(status)) {
564                 return_ACPI_STATUS(status);
565         }
566
567         /*
568          * Make the call to create a resource linked list from the
569          * byte stream buffer that comes back from the _CRS method
570          * execution.
571          */
572         status = acpi_rs_create_resource_list(obj_desc, ret_buffer);
573
574         /* on exit, we must delete the object returned by evaluate_object */
575
576         acpi_ut_remove_reference(obj_desc);
577         return_ACPI_STATUS(status);
578 }
579
580 /*******************************************************************************
581  *
582  * FUNCTION:    acpi_rs_get_prs_method_data
583  *
584  * PARAMETERS:  Handle          - a handle to the containing object
585  *              ret_buffer      - a pointer to a buffer structure for the
586  *                                  results
587  *
588  * RETURN:      Status
589  *
590  * DESCRIPTION: This function is called to get the _PRS value of an object
591  *              contained in an object specified by the handle passed in
592  *
593  *              If the function fails an appropriate status will be returned
594  *              and the contents of the callers buffer is undefined.
595  *
596  ******************************************************************************/
597
598 #ifdef ACPI_FUTURE_USAGE
599 acpi_status
600 acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer)
601 {
602         union acpi_operand_object *obj_desc;
603         acpi_status status;
604
605         ACPI_FUNCTION_TRACE("rs_get_prs_method_data");
606
607         /* Parameters guaranteed valid by caller */
608
609         /* Execute the method, no parameters */
610
611         status = acpi_ut_evaluate_object(handle, METHOD_NAME__PRS,
612                                          ACPI_BTYPE_BUFFER, &obj_desc);
613         if (ACPI_FAILURE(status)) {
614                 return_ACPI_STATUS(status);
615         }
616
617         /*
618          * Make the call to create a resource linked list from the
619          * byte stream buffer that comes back from the _CRS method
620          * execution.
621          */
622         status = acpi_rs_create_resource_list(obj_desc, ret_buffer);
623
624         /* on exit, we must delete the object returned by evaluate_object */
625
626         acpi_ut_remove_reference(obj_desc);
627         return_ACPI_STATUS(status);
628 }
629 #endif                          /*  ACPI_FUTURE_USAGE  */
630
631 /*******************************************************************************
632  *
633  * FUNCTION:    acpi_rs_get_method_data
634  *
635  * PARAMETERS:  Handle          - a handle to the containing object
636  *              Path            - Path to method, relative to Handle
637  *              ret_buffer      - a pointer to a buffer structure for the
638  *                                  results
639  *
640  * RETURN:      Status
641  *
642  * DESCRIPTION: This function is called to get the _CRS or _PRS value of an
643  *              object contained in an object specified by the handle passed in
644  *
645  *              If the function fails an appropriate status will be returned
646  *              and the contents of the callers buffer is undefined.
647  *
648  ******************************************************************************/
649
650 acpi_status
651 acpi_rs_get_method_data(acpi_handle handle,
652                         char *path, struct acpi_buffer *ret_buffer)
653 {
654         union acpi_operand_object *obj_desc;
655         acpi_status status;
656
657         ACPI_FUNCTION_TRACE("rs_get_method_data");
658
659         /* Parameters guaranteed valid by caller */
660
661         /* Execute the method, no parameters */
662
663         status =
664             acpi_ut_evaluate_object(handle, path, ACPI_BTYPE_BUFFER, &obj_desc);
665         if (ACPI_FAILURE(status)) {
666                 return_ACPI_STATUS(status);
667         }
668
669         /*
670          * Make the call to create a resource linked list from the
671          * byte stream buffer that comes back from the method
672          * execution.
673          */
674         status = acpi_rs_create_resource_list(obj_desc, ret_buffer);
675
676         /* On exit, we must delete the object returned by evaluate_object */
677
678         acpi_ut_remove_reference(obj_desc);
679         return_ACPI_STATUS(status);
680 }
681
682 /*******************************************************************************
683  *
684  * FUNCTION:    acpi_rs_set_srs_method_data
685  *
686  * PARAMETERS:  Handle          - a handle to the containing object
687  *              in_buffer       - a pointer to a buffer structure of the
688  *                                  parameter
689  *
690  * RETURN:      Status
691  *
692  * DESCRIPTION: This function is called to set the _SRS of an object contained
693  *              in an object specified by the handle passed in
694  *
695  *              If the function fails an appropriate status will be returned
696  *              and the contents of the callers buffer is undefined.
697  *
698  ******************************************************************************/
699
700 acpi_status
701 acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *in_buffer)
702 {
703         struct acpi_parameter_info info;
704         union acpi_operand_object *params[2];
705         acpi_status status;
706         struct acpi_buffer buffer;
707
708         ACPI_FUNCTION_TRACE("rs_set_srs_method_data");
709
710         /* Parameters guaranteed valid by caller */
711
712         /*
713          * The in_buffer parameter will point to a linked list of
714          * resource parameters.  It needs to be formatted into a
715          * byte stream to be sent in as an input parameter to _SRS
716          *
717          * Convert the linked list into a byte stream
718          */
719         buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
720         status = acpi_rs_create_aml_resources(in_buffer->pointer, &buffer);
721         if (ACPI_FAILURE(status)) {
722                 return_ACPI_STATUS(status);
723         }
724
725         /* Init the param object */
726
727         params[0] = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER);
728         if (!params[0]) {
729                 acpi_os_free(buffer.pointer);
730                 return_ACPI_STATUS(AE_NO_MEMORY);
731         }
732
733         /* Set up the parameter object */
734
735         params[0]->buffer.length = (u32) buffer.length;
736         params[0]->buffer.pointer = buffer.pointer;
737         params[0]->common.flags = AOPOBJ_DATA_VALID;
738         params[1] = NULL;
739
740         info.node = handle;
741         info.parameters = params;
742         info.parameter_type = ACPI_PARAM_ARGS;
743
744         /* Execute the method, no return value */
745
746         status = acpi_ns_evaluate_relative(METHOD_NAME__SRS, &info);
747         if (ACPI_SUCCESS(status)) {
748                 /* Delete any return object (especially if implicit_return is enabled) */
749
750                 if (info.return_object) {
751                         acpi_ut_remove_reference(info.return_object);
752                 }
753         }
754
755         /* Clean up and return the status from acpi_ns_evaluate_relative */
756
757         acpi_ut_remove_reference(params[0]);
758         return_ACPI_STATUS(status);
759 }