xref: /titanic_44/usr/src/uts/intel/io/acpica/resources/rsutils.c (revision d583b39bfb4e2571d3e41097c5c357ffe353ad45)
1 /*******************************************************************************
2  *
3  * Module Name: rsutils - Utilities for the resource manager
4  *
5  ******************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2011, Intel Corp.
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 
45 #define __RSUTILS_C__
46 
47 #include "acpi.h"
48 #include "accommon.h"
49 #include "acnamesp.h"
50 #include "acresrc.h"
51 
52 
53 #define _COMPONENT          ACPI_RESOURCES
54         ACPI_MODULE_NAME    ("rsutils")
55 
56 
57 /*******************************************************************************
58  *
59  * FUNCTION:    AcpiRsDecodeBitmask
60  *
61  * PARAMETERS:  Mask            - Bitmask to decode
62  *              List            - Where the converted list is returned
63  *
64  * RETURN:      Count of bits set (length of list)
65  *
66  * DESCRIPTION: Convert a bit mask into a list of values
67  *
68  ******************************************************************************/
69 
70 UINT8
71 AcpiRsDecodeBitmask (
72     UINT16                  Mask,
73     UINT8                   *List)
74 {
75     UINT8                   i;
76     UINT8                   BitCount;
77 
78 
79     ACPI_FUNCTION_ENTRY ();
80 
81 
82     /* Decode the mask bits */
83 
84     for (i = 0, BitCount = 0; Mask; i++)
85     {
86         if (Mask & 0x0001)
87         {
88             List[BitCount] = i;
89             BitCount++;
90         }
91 
92         Mask >>= 1;
93     }
94 
95     return (BitCount);
96 }
97 
98 
99 /*******************************************************************************
100  *
101  * FUNCTION:    AcpiRsEncodeBitmask
102  *
103  * PARAMETERS:  List            - List of values to encode
104  *              Count           - Length of list
105  *
106  * RETURN:      Encoded bitmask
107  *
108  * DESCRIPTION: Convert a list of values to an encoded bitmask
109  *
110  ******************************************************************************/
111 
112 UINT16
113 AcpiRsEncodeBitmask (
114     UINT8                   *List,
115     UINT8                   Count)
116 {
117     UINT32                  i;
118     UINT16                  Mask;
119 
120 
121     ACPI_FUNCTION_ENTRY ();
122 
123 
124     /* Encode the list into a single bitmask */
125 
126     for (i = 0, Mask = 0; i < Count; i++)
127     {
128         Mask |= (0x1 << List[i]);
129     }
130 
131     return (Mask);
132 }
133 
134 
135 /*******************************************************************************
136  *
137  * FUNCTION:    AcpiRsMoveData
138  *
139  * PARAMETERS:  Destination         - Pointer to the destination descriptor
140  *              Source              - Pointer to the source descriptor
141  *              ItemCount           - How many items to move
142  *              MoveType            - Byte width
143  *
144  * RETURN:      None
145  *
146  * DESCRIPTION: Move multiple data items from one descriptor to another. Handles
147  *              alignment issues and endian issues if necessary, as configured
148  *              via the ACPI_MOVE_* macros. (This is why a memcpy is not used)
149  *
150  ******************************************************************************/
151 
152 void
153 AcpiRsMoveData (
154     void                    *Destination,
155     void                    *Source,
156     UINT16                  ItemCount,
157     UINT8                   MoveType)
158 {
159     UINT32                  i;
160 
161 
162     ACPI_FUNCTION_ENTRY ();
163 
164 
165     /* One move per item */
166 
167     for (i = 0; i < ItemCount; i++)
168     {
169         switch (MoveType)
170         {
171         /*
172          * For the 8-bit case, we can perform the move all at once
173          * since there are no alignment or endian issues
174          */
175         case ACPI_RSC_MOVE8:
176             ACPI_MEMCPY (Destination, Source, ItemCount);
177             return;
178 
179         /*
180          * 16-, 32-, and 64-bit cases must use the move macros that perform
181          * endian conversion and/or accomodate hardware that cannot perform
182          * misaligned memory transfers
183          */
184         case ACPI_RSC_MOVE16:
185             ACPI_MOVE_16_TO_16 (&ACPI_CAST_PTR (UINT16, Destination)[i],
186                                 &ACPI_CAST_PTR (UINT16, Source)[i]);
187             break;
188 
189         case ACPI_RSC_MOVE32:
190             ACPI_MOVE_32_TO_32 (&ACPI_CAST_PTR (UINT32, Destination)[i],
191                                 &ACPI_CAST_PTR (UINT32, Source)[i]);
192             break;
193 
194         case ACPI_RSC_MOVE64:
195             ACPI_MOVE_64_TO_64 (&ACPI_CAST_PTR (UINT64, Destination)[i],
196                                 &ACPI_CAST_PTR (UINT64, Source)[i]);
197             break;
198 
199         default:
200             return;
201         }
202     }
203 }
204 
205 
206 /*******************************************************************************
207  *
208  * FUNCTION:    AcpiRsSetResourceLength
209  *
210  * PARAMETERS:  TotalLength         - Length of the AML descriptor, including
211  *                                    the header and length fields.
212  *              Aml                 - Pointer to the raw AML descriptor
213  *
214  * RETURN:      None
215  *
216  * DESCRIPTION: Set the ResourceLength field of an AML
217  *              resource descriptor, both Large and Small descriptors are
218  *              supported automatically. Note: Descriptor Type field must
219  *              be valid.
220  *
221  ******************************************************************************/
222 
223 void
224 AcpiRsSetResourceLength (
225     ACPI_RSDESC_SIZE        TotalLength,
226     AML_RESOURCE            *Aml)
227 {
228     ACPI_RS_LENGTH          ResourceLength;
229 
230 
231     ACPI_FUNCTION_ENTRY ();
232 
233 
234     /* Length is the total descriptor length minus the header length */
235 
236     ResourceLength = (ACPI_RS_LENGTH)
237         (TotalLength - AcpiUtGetResourceHeaderLength (Aml));
238 
239     /* Length is stored differently for large and small descriptors */
240 
241     if (Aml->SmallHeader.DescriptorType & ACPI_RESOURCE_NAME_LARGE)
242     {
243         /* Large descriptor -- bytes 1-2 contain the 16-bit length */
244 
245         ACPI_MOVE_16_TO_16 (&Aml->LargeHeader.ResourceLength, &ResourceLength);
246     }
247     else
248     {
249         /* Small descriptor -- bits 2:0 of byte 0 contain the length */
250 
251         Aml->SmallHeader.DescriptorType = (UINT8)
252 
253             /* Clear any existing length, preserving descriptor type bits */
254 
255             ((Aml->SmallHeader.DescriptorType & ~ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK)
256 
257             | ResourceLength);
258     }
259 }
260 
261 
262 /*******************************************************************************
263  *
264  * FUNCTION:    AcpiRsSetResourceHeader
265  *
266  * PARAMETERS:  DescriptorType      - Byte to be inserted as the type
267  *              TotalLength         - Length of the AML descriptor, including
268  *                                    the header and length fields.
269  *              Aml                 - Pointer to the raw AML descriptor
270  *
271  * RETURN:      None
272  *
273  * DESCRIPTION: Set the DescriptorType and ResourceLength fields of an AML
274  *              resource descriptor, both Large and Small descriptors are
275  *              supported automatically
276  *
277  ******************************************************************************/
278 
279 void
280 AcpiRsSetResourceHeader (
281     UINT8                   DescriptorType,
282     ACPI_RSDESC_SIZE        TotalLength,
283     AML_RESOURCE            *Aml)
284 {
285     ACPI_FUNCTION_ENTRY ();
286 
287 
288     /* Set the Resource Type */
289 
290     Aml->SmallHeader.DescriptorType = DescriptorType;
291 
292     /* Set the Resource Length */
293 
294     AcpiRsSetResourceLength (TotalLength, Aml);
295 }
296 
297 
298 /*******************************************************************************
299  *
300  * FUNCTION:    AcpiRsStrcpy
301  *
302  * PARAMETERS:  Destination         - Pointer to the destination string
303  *              Source              - Pointer to the source string
304  *
305  * RETURN:      String length, including NULL terminator
306  *
307  * DESCRIPTION: Local string copy that returns the string length, saving a
308  *              strcpy followed by a strlen.
309  *
310  ******************************************************************************/
311 
312 static UINT16
313 AcpiRsStrcpy (
314     char                    *Destination,
315     char                    *Source)
316 {
317     UINT16                  i;
318 
319 
320     ACPI_FUNCTION_ENTRY ();
321 
322 
323     for (i = 0; Source[i]; i++)
324     {
325         Destination[i] = Source[i];
326     }
327 
328     Destination[i] = 0;
329 
330     /* Return string length including the NULL terminator */
331 
332     return ((UINT16) (i + 1));
333 }
334 
335 
336 /*******************************************************************************
337  *
338  * FUNCTION:    AcpiRsGetResourceSource
339  *
340  * PARAMETERS:  ResourceLength      - Length field of the descriptor
341  *              MinimumLength       - Minimum length of the descriptor (minus
342  *                                    any optional fields)
343  *              ResourceSource      - Where the ResourceSource is returned
344  *              Aml                 - Pointer to the raw AML descriptor
345  *              StringPtr           - (optional) where to store the actual
346  *                                    ResourceSource string
347  *
348  * RETURN:      Length of the string plus NULL terminator, rounded up to native
349  *              word boundary
350  *
351  * DESCRIPTION: Copy the optional ResourceSource data from a raw AML descriptor
352  *              to an internal resource descriptor
353  *
354  ******************************************************************************/
355 
356 ACPI_RS_LENGTH
357 AcpiRsGetResourceSource (
358     ACPI_RS_LENGTH          ResourceLength,
359     ACPI_RS_LENGTH          MinimumLength,
360     ACPI_RESOURCE_SOURCE    *ResourceSource,
361     AML_RESOURCE            *Aml,
362     char                    *StringPtr)
363 {
364     ACPI_RSDESC_SIZE        TotalLength;
365     UINT8                   *AmlResourceSource;
366 
367 
368     ACPI_FUNCTION_ENTRY ();
369 
370 
371     TotalLength = ResourceLength + sizeof (AML_RESOURCE_LARGE_HEADER);
372     AmlResourceSource = ACPI_ADD_PTR (UINT8, Aml, MinimumLength);
373 
374     /*
375      * ResourceSource is present if the length of the descriptor is longer than
376      * the minimum length.
377      *
378      * Note: Some resource descriptors will have an additional null, so
379      * we add 1 to the minimum length.
380      */
381     if (TotalLength > (ACPI_RSDESC_SIZE) (MinimumLength + 1))
382     {
383         /* Get the ResourceSourceIndex */
384 
385         ResourceSource->Index = AmlResourceSource[0];
386 
387         ResourceSource->StringPtr = StringPtr;
388         if (!StringPtr)
389         {
390             /*
391              * String destination pointer is not specified; Set the String
392              * pointer to the end of the current ResourceSource structure.
393              */
394             ResourceSource->StringPtr = ACPI_ADD_PTR (char, ResourceSource,
395                 sizeof (ACPI_RESOURCE_SOURCE));
396         }
397 
398         /*
399          * In order for the Resource length to be a multiple of the native
400          * word, calculate the length of the string (+1 for NULL terminator)
401          * and expand to the next word multiple.
402          *
403          * Zero the entire area of the buffer.
404          */
405         TotalLength = (UINT32) ACPI_STRLEN (
406             ACPI_CAST_PTR (char, &AmlResourceSource[1])) + 1;
407         TotalLength = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (TotalLength);
408 
409         ACPI_MEMSET (ResourceSource->StringPtr, 0, TotalLength);
410 
411         /* Copy the ResourceSource string to the destination */
412 
413         ResourceSource->StringLength = AcpiRsStrcpy (ResourceSource->StringPtr,
414             ACPI_CAST_PTR (char, &AmlResourceSource[1]));
415 
416         return ((ACPI_RS_LENGTH) TotalLength);
417     }
418 
419     /* ResourceSource is not present */
420 
421     ResourceSource->Index = 0;
422     ResourceSource->StringLength = 0;
423     ResourceSource->StringPtr = NULL;
424     return (0);
425 }
426 
427 
428 /*******************************************************************************
429  *
430  * FUNCTION:    AcpiRsSetResourceSource
431  *
432  * PARAMETERS:  Aml                 - Pointer to the raw AML descriptor
433  *              MinimumLength       - Minimum length of the descriptor (minus
434  *                                    any optional fields)
435  *              ResourceSource      - Internal ResourceSource
436 
437  *
438  * RETURN:      Total length of the AML descriptor
439  *
440  * DESCRIPTION: Convert an optional ResourceSource from internal format to a
441  *              raw AML resource descriptor
442  *
443  ******************************************************************************/
444 
445 ACPI_RSDESC_SIZE
446 AcpiRsSetResourceSource (
447     AML_RESOURCE            *Aml,
448     ACPI_RS_LENGTH          MinimumLength,
449     ACPI_RESOURCE_SOURCE    *ResourceSource)
450 {
451     UINT8                   *AmlResourceSource;
452     ACPI_RSDESC_SIZE        DescriptorLength;
453 
454 
455     ACPI_FUNCTION_ENTRY ();
456 
457 
458     DescriptorLength = MinimumLength;
459 
460     /* Non-zero string length indicates presence of a ResourceSource */
461 
462     if (ResourceSource->StringLength)
463     {
464         /* Point to the end of the AML descriptor */
465 
466         AmlResourceSource = ACPI_ADD_PTR (UINT8, Aml, MinimumLength);
467 
468         /* Copy the ResourceSourceIndex */
469 
470         AmlResourceSource[0] = (UINT8) ResourceSource->Index;
471 
472         /* Copy the ResourceSource string */
473 
474         ACPI_STRCPY (ACPI_CAST_PTR (char, &AmlResourceSource[1]),
475             ResourceSource->StringPtr);
476 
477         /*
478          * Add the length of the string (+ 1 for null terminator) to the
479          * final descriptor length
480          */
481         DescriptorLength += ((ACPI_RSDESC_SIZE) ResourceSource->StringLength + 1);
482     }
483 
484     /* Return the new total length of the AML descriptor */
485 
486     return (DescriptorLength);
487 }
488 
489 
490 /*******************************************************************************
491  *
492  * FUNCTION:    AcpiRsGetPrtMethodData
493  *
494  * PARAMETERS:  Node            - Device node
495  *              RetBuffer       - Pointer to a buffer structure for the
496  *                                results
497  *
498  * RETURN:      Status
499  *
500  * DESCRIPTION: This function is called to get the _PRT value of an object
501  *              contained in an object specified by the handle passed in
502  *
503  *              If the function fails an appropriate status will be returned
504  *              and the contents of the callers buffer is undefined.
505  *
506  ******************************************************************************/
507 
508 ACPI_STATUS
509 AcpiRsGetPrtMethodData (
510     ACPI_NAMESPACE_NODE     *Node,
511     ACPI_BUFFER             *RetBuffer)
512 {
513     ACPI_OPERAND_OBJECT     *ObjDesc;
514     ACPI_STATUS             Status;
515 
516 
517     ACPI_FUNCTION_TRACE (RsGetPrtMethodData);
518 
519 
520     /* Parameters guaranteed valid by caller */
521 
522     /* Execute the method, no parameters */
523 
524     Status = AcpiUtEvaluateObject (Node, METHOD_NAME__PRT,
525                 ACPI_BTYPE_PACKAGE, &ObjDesc);
526     if (ACPI_FAILURE (Status))
527     {
528         return_ACPI_STATUS (Status);
529     }
530 
531     /*
532      * Create a resource linked list from the byte stream buffer that comes
533      * back from the _CRS method execution.
534      */
535     Status = AcpiRsCreatePciRoutingTable (ObjDesc, RetBuffer);
536 
537     /* On exit, we must delete the object returned by EvaluateObject */
538 
539     AcpiUtRemoveReference (ObjDesc);
540     return_ACPI_STATUS (Status);
541 }
542 
543 
544 /*******************************************************************************
545  *
546  * FUNCTION:    AcpiRsGetCrsMethodData
547  *
548  * PARAMETERS:  Node            - Device node
549  *              RetBuffer       - Pointer to a buffer structure for the
550  *                                results
551  *
552  * RETURN:      Status
553  *
554  * DESCRIPTION: This function is called to get the _CRS value of an object
555  *              contained in an object specified by the handle passed in
556  *
557  *              If the function fails an appropriate status will be returned
558  *              and the contents of the callers buffer is undefined.
559  *
560  ******************************************************************************/
561 
562 ACPI_STATUS
563 AcpiRsGetCrsMethodData (
564     ACPI_NAMESPACE_NODE     *Node,
565     ACPI_BUFFER             *RetBuffer)
566 {
567     ACPI_OPERAND_OBJECT     *ObjDesc;
568     ACPI_STATUS             Status;
569 
570 
571     ACPI_FUNCTION_TRACE (RsGetCrsMethodData);
572 
573 
574     /* Parameters guaranteed valid by caller */
575 
576     /* Execute the method, no parameters */
577 
578     Status = AcpiUtEvaluateObject (Node, METHOD_NAME__CRS,
579                 ACPI_BTYPE_BUFFER, &ObjDesc);
580     if (ACPI_FAILURE (Status))
581     {
582         return_ACPI_STATUS (Status);
583     }
584 
585     /*
586      * Make the call to create a resource linked list from the
587      * byte stream buffer that comes back from the _CRS method
588      * execution.
589      */
590     Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer);
591 
592     /* On exit, we must delete the object returned by evaluateObject */
593 
594     AcpiUtRemoveReference (ObjDesc);
595     return_ACPI_STATUS (Status);
596 }
597 
598 
599 /*******************************************************************************
600  *
601  * FUNCTION:    AcpiRsGetPrsMethodData
602  *
603  * PARAMETERS:  Node            - Device node
604  *              RetBuffer       - Pointer to a buffer structure for the
605  *                                results
606  *
607  * RETURN:      Status
608  *
609  * DESCRIPTION: This function is called to get the _PRS value of an object
610  *              contained in an object specified by the handle passed in
611  *
612  *              If the function fails an appropriate status will be returned
613  *              and the contents of the callers buffer is undefined.
614  *
615  ******************************************************************************/
616 
617 ACPI_STATUS
618 AcpiRsGetPrsMethodData (
619     ACPI_NAMESPACE_NODE     *Node,
620     ACPI_BUFFER             *RetBuffer)
621 {
622     ACPI_OPERAND_OBJECT     *ObjDesc;
623     ACPI_STATUS             Status;
624 
625 
626     ACPI_FUNCTION_TRACE (RsGetPrsMethodData);
627 
628 
629     /* Parameters guaranteed valid by caller */
630 
631     /* Execute the method, no parameters */
632 
633     Status = AcpiUtEvaluateObject (Node, METHOD_NAME__PRS,
634                 ACPI_BTYPE_BUFFER, &ObjDesc);
635     if (ACPI_FAILURE (Status))
636     {
637         return_ACPI_STATUS (Status);
638     }
639 
640     /*
641      * Make the call to create a resource linked list from the
642      * byte stream buffer that comes back from the _CRS method
643      * execution.
644      */
645     Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer);
646 
647     /* On exit, we must delete the object returned by evaluateObject */
648 
649     AcpiUtRemoveReference (ObjDesc);
650     return_ACPI_STATUS (Status);
651 }
652 
653 
654 /*******************************************************************************
655  *
656  * FUNCTION:    AcpiRsGetMethodData
657  *
658  * PARAMETERS:  Handle          - Handle to the containing object
659  *              Path            - Path to method, relative to Handle
660  *              RetBuffer       - Pointer to a buffer structure for the
661  *                                results
662  *
663  * RETURN:      Status
664  *
665  * DESCRIPTION: This function is called to get the _CRS or _PRS value of an
666  *              object contained in an object specified by the handle passed in
667  *
668  *              If the function fails an appropriate status will be returned
669  *              and the contents of the callers buffer is undefined.
670  *
671  ******************************************************************************/
672 
673 ACPI_STATUS
674 AcpiRsGetMethodData (
675     ACPI_HANDLE             Handle,
676     char                    *Path,
677     ACPI_BUFFER             *RetBuffer)
678 {
679     ACPI_OPERAND_OBJECT     *ObjDesc;
680     ACPI_STATUS             Status;
681 
682 
683     ACPI_FUNCTION_TRACE (RsGetMethodData);
684 
685 
686     /* Parameters guaranteed valid by caller */
687 
688     /* Execute the method, no parameters */
689 
690     Status = AcpiUtEvaluateObject (Handle, Path, ACPI_BTYPE_BUFFER, &ObjDesc);
691     if (ACPI_FAILURE (Status))
692     {
693         return_ACPI_STATUS (Status);
694     }
695 
696     /*
697      * Make the call to create a resource linked list from the
698      * byte stream buffer that comes back from the method
699      * execution.
700      */
701     Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer);
702 
703     /* On exit, we must delete the object returned by EvaluateObject */
704 
705     AcpiUtRemoveReference (ObjDesc);
706     return_ACPI_STATUS (Status);
707 }
708 
709 
710 /*******************************************************************************
711  *
712  * FUNCTION:    AcpiRsSetSrsMethodData
713  *
714  * PARAMETERS:  Node            - Device node
715  *              InBuffer        - Pointer to a buffer structure of the
716  *                                parameter
717  *
718  * RETURN:      Status
719  *
720  * DESCRIPTION: This function is called to set the _SRS of an object contained
721  *              in an object specified by the handle passed in
722  *
723  *              If the function fails an appropriate status will be returned
724  *              and the contents of the callers buffer is undefined.
725  *
726  * Note: Parameters guaranteed valid by caller
727  *
728  ******************************************************************************/
729 
730 ACPI_STATUS
731 AcpiRsSetSrsMethodData (
732     ACPI_NAMESPACE_NODE     *Node,
733     ACPI_BUFFER             *InBuffer)
734 {
735     ACPI_EVALUATE_INFO      *Info;
736     ACPI_OPERAND_OBJECT     *Args[2];
737     ACPI_STATUS             Status;
738     ACPI_BUFFER             Buffer;
739 
740 
741     ACPI_FUNCTION_TRACE (RsSetSrsMethodData);
742 
743 
744     /* Allocate and initialize the evaluation information block */
745 
746     Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
747     if (!Info)
748     {
749         return_ACPI_STATUS (AE_NO_MEMORY);
750     }
751 
752     Info->PrefixNode = Node;
753     Info->Pathname = METHOD_NAME__SRS;
754     Info->Parameters = Args;
755     Info->Flags = ACPI_IGNORE_RETURN_VALUE;
756 
757     /*
758      * The InBuffer parameter will point to a linked list of
759      * resource parameters. It needs to be formatted into a
760      * byte stream to be sent in as an input parameter to _SRS
761      *
762      * Convert the linked list into a byte stream
763      */
764     Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
765     Status = AcpiRsCreateAmlResources (InBuffer->Pointer, &Buffer);
766     if (ACPI_FAILURE (Status))
767     {
768         goto Cleanup;
769     }
770 
771     /* Create and initialize the method parameter object */
772 
773     Args[0] = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER);
774     if (!Args[0])
775     {
776         /*
777          * Must free the buffer allocated above (otherwise it is freed
778          * later)
779          */
780         ACPI_FREE (Buffer.Pointer);
781         Status = AE_NO_MEMORY;
782         goto Cleanup;
783     }
784 
785     Args[0]->Buffer.Length  = (UINT32) Buffer.Length;
786     Args[0]->Buffer.Pointer = Buffer.Pointer;
787     Args[0]->Common.Flags   = AOPOBJ_DATA_VALID;
788     Args[1] = NULL;
789 
790     /* Execute the method, no return value is expected */
791 
792     Status = AcpiNsEvaluate (Info);
793 
794     /* Clean up and return the status from AcpiNsEvaluate */
795 
796     AcpiUtRemoveReference (Args[0]);
797 
798 Cleanup:
799     ACPI_FREE (Info);
800     return_ACPI_STATUS (Status);
801 }
802 
803