rsutils.c revision 77424
1235783Skib/*******************************************************************************
2235783Skib *
3235783Skib * Module Name: rsutils - Utilities for the resource manager
4254852Sdumbbell *              $Revision: 19 $
5235783Skib *
6254852Sdumbbell ******************************************************************************/
7254852Sdumbbell
8254852Sdumbbell/******************************************************************************
9254852Sdumbbell *
10254852Sdumbbell * 1. Copyright Notice
11254852Sdumbbell *
12254852Sdumbbell * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
13254852Sdumbbell * All rights reserved.
14254852Sdumbbell *
15254852Sdumbbell * 2. License
16254852Sdumbbell *
17254852Sdumbbell * 2.1. This is your license from Intel Corp. under its intellectual property
18254852Sdumbbell * rights.  You may have additional license terms from the party that provided
19254852Sdumbbell * you this software, covering your right to use that party's intellectual
20254852Sdumbbell * property rights.
21254852Sdumbbell *
22254852Sdumbbell * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23254852Sdumbbell * copy of the source code appearing in this file ("Covered Code") an
24254852Sdumbbell * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25254852Sdumbbell * base code distributed originally by Intel ("Original Intel Code") to copy,
26254852Sdumbbell * make derivatives, distribute, use and display any portion of the Covered
27254852Sdumbbell * Code in any form, with the right to sublicense such rights; and
28254852Sdumbbell *
29254852Sdumbbell * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30254852Sdumbbell * license (with the right to sublicense), under only those claims of Intel
31254852Sdumbbell * patents that are infringed by the Original Intel Code, to make, use, sell,
32254852Sdumbbell * offer to sell, and import the Covered Code and derivative works thereof
33254852Sdumbbell * solely to the minimum extent necessary to exercise the above copyright
34254852Sdumbbell * license, and in no event shall the patent license extend to any additions
35254852Sdumbbell * to or modifications of the Original Intel Code.  No other license or right
36254852Sdumbbell * is granted directly or by implication, estoppel or otherwise;
37254852Sdumbbell *
38254852Sdumbbell * The above copyright and patent license is granted only if the following
39254852Sdumbbell * conditions are met:
40254852Sdumbbell *
41254852Sdumbbell * 3. Conditions
42254852Sdumbbell *
43254852Sdumbbell * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44254852Sdumbbell * Redistribution of source code of any substantial portion of the Covered
45254852Sdumbbell * Code or modification with rights to further distribute source must include
46254852Sdumbbell * the above Copyright Notice, the above License, this list of Conditions,
47254852Sdumbbell * and the following Disclaimer and Export Compliance provision.  In addition,
48254852Sdumbbell * Licensee must cause all Covered Code to which Licensee contributes to
49254852Sdumbbell * contain a file documenting the changes Licensee made to create that Covered
50254852Sdumbbell * Code and the date of any change.  Licensee must include in that file the
51280369Skib * documentation of any changes made by any predecessor Licensee.  Licensee
52282199Sdumbbell * must include a prominent statement that the modification is derived,
53282199Sdumbbell * directly or indirectly, from Original Intel Code.
54280369Skib *
55280369Skib * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56282199Sdumbbell * Redistribution of source code of any substantial portion of the Covered
57282199Sdumbbell * Code or modification without rights to further distribute source must
58254852Sdumbbell * include the following Disclaimer and Export Compliance provision in the
59254852Sdumbbell * documentation and/or other materials provided with distribution.  In
60254852Sdumbbell * addition, Licensee may not authorize further sublicense of source of any
61254852Sdumbbell * portion of the Covered Code, and must include terms to the effect that the
62254852Sdumbbell * license from Licensee to its licensee is limited to the intellectual
63254852Sdumbbell * property embodied in the software Licensee provides to its licensee, and
64254852Sdumbbell * not to intellectual property embodied in modifications its licensee may
65254852Sdumbbell * make.
66254852Sdumbbell *
67254852Sdumbbell * 3.3. Redistribution of Executable. Redistribution in executable form of any
68254852Sdumbbell * substantial portion of the Covered Code or modification must reproduce the
69254852Sdumbbell * above Copyright Notice, and the following Disclaimer and Export Compliance
70254852Sdumbbell * provision in the documentation and/or other materials provided with the
71254852Sdumbbell * distribution.
72254852Sdumbbell *
73254852Sdumbbell * 3.4. Intel retains all right, title, and interest in and to the Original
74254852Sdumbbell * Intel Code.
75254852Sdumbbell *
76254852Sdumbbell * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77254852Sdumbbell * Intel shall be used in advertising or otherwise to promote the sale, use or
78254852Sdumbbell * other dealings in products derived from or relating to the Covered Code
79254852Sdumbbell * without prior written authorization from Intel.
80254852Sdumbbell *
81254852Sdumbbell * 4. Disclaimer and Export Compliance
82254852Sdumbbell *
83254852Sdumbbell * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84254852Sdumbbell * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85254852Sdumbbell * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
86254852Sdumbbell * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
87254852Sdumbbell * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
88254852Sdumbbell * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89254852Sdumbbell * PARTICULAR PURPOSE.
90254852Sdumbbell *
91254852Sdumbbell * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92254852Sdumbbell * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93254852Sdumbbell * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94254852Sdumbbell * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95254852Sdumbbell * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96254852Sdumbbell * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
97254852Sdumbbell * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98254852Sdumbbell * LIMITED REMEDY.
99254852Sdumbbell *
100254852Sdumbbell * 4.3. Licensee shall not export, either directly or indirectly, any of this
101254852Sdumbbell * software or system incorporating such software without first obtaining any
102254852Sdumbbell * required license or other approval from the U. S. Department of Commerce or
103254852Sdumbbell * any other agency or department of the United States Government.  In the
104254852Sdumbbell * event Licensee exports any such software from the United States or
105254852Sdumbbell * re-exports any such software from a foreign destination, Licensee shall
106254852Sdumbbell * ensure that the distribution and export/re-export of the software is in
107254852Sdumbbell * compliance with all laws, regulations, orders, or other restrictions of the
108254852Sdumbbell * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109254852Sdumbbell * any of its subsidiaries will export/re-export any technical data, process,
110254852Sdumbbell * software, or service, directly or indirectly, to any country for which the
111254852Sdumbbell * United States government or any agency thereof requires an export license,
112254852Sdumbbell * other governmental approval, or letter of assurance, without first obtaining
113254852Sdumbbell * such license, approval or letter.
114254852Sdumbbell *
115254852Sdumbbell *****************************************************************************/
116254852Sdumbbell
117254852Sdumbbell
118254852Sdumbbell#define __RSUTILS_C__
119254852Sdumbbell
120254852Sdumbbell#include "acpi.h"
121254852Sdumbbell#include "acnamesp.h"
122254852Sdumbbell#include "acresrc.h"
123254852Sdumbbell
124254852Sdumbbell
125254852Sdumbbell#define _COMPONENT          ACPI_RESOURCES
126254852Sdumbbell        MODULE_NAME         ("rsutils")
127254852Sdumbbell
128254852Sdumbbell
129254852Sdumbbell/*******************************************************************************
130254852Sdumbbell *
131254852Sdumbbell * FUNCTION:    AcpiRsGetPrtMethodData
132254852Sdumbbell *
133254852Sdumbbell * PARAMETERS:  Handle          - a handle to the containing object
134254852Sdumbbell *              RetBuffer       - a pointer to a buffer structure for the
135254852Sdumbbell *                                  results
136254852Sdumbbell *
137254852Sdumbbell * RETURN:      Status
138254852Sdumbbell *
139254852Sdumbbell * DESCRIPTION: This function is called to get the _PRT value of an object
140254852Sdumbbell *              contained in an object specified by the handle passed in
141254852Sdumbbell *
142254852Sdumbbell *              If the function fails an appropriate status will be returned
143254852Sdumbbell *              and the contents of the callers buffer is undefined.
144254852Sdumbbell *
145254852Sdumbbell ******************************************************************************/
146254852Sdumbbell
147254852SdumbbellACPI_STATUS
148254852SdumbbellAcpiRsGetPrtMethodData (
149254852Sdumbbell    ACPI_HANDLE             Handle,
150254852Sdumbbell    ACPI_BUFFER             *RetBuffer)
151254852Sdumbbell{
152254852Sdumbbell    ACPI_OPERAND_OBJECT     *RetObj;
153254852Sdumbbell    ACPI_STATUS             Status;
154254852Sdumbbell    UINT32                  BufferSpaceNeeded;
155254852Sdumbbell
156254852Sdumbbell
157254852Sdumbbell    FUNCTION_TRACE ("RsGetPrtMethodData");
158254852Sdumbbell
159254852Sdumbbell
160254852Sdumbbell    /* already validated params, so we won't repeat here */
161254852Sdumbbell
162254852Sdumbbell    BufferSpaceNeeded = RetBuffer->Length;
163254852Sdumbbell
164254852Sdumbbell    /*
165254852Sdumbbell     *  Execute the method, no parameters
166254852Sdumbbell     */
167254852Sdumbbell    Status = AcpiNsEvaluateRelative (Handle, "_PRT", NULL, &RetObj);
168254852Sdumbbell    if (ACPI_FAILURE (Status))
169254852Sdumbbell    {
170254852Sdumbbell        return_ACPI_STATUS (Status);
171254852Sdumbbell    }
172254852Sdumbbell
173254852Sdumbbell    if (!RetObj)
174254852Sdumbbell    {
175254852Sdumbbell        /* Return object is required */
176254852Sdumbbell
177254852Sdumbbell        DEBUG_PRINTP (ACPI_ERROR, ("No object was returned from _PRT\n"));
178254852Sdumbbell        return_ACPI_STATUS (AE_TYPE);
179254852Sdumbbell    }
180254852Sdumbbell
181254852Sdumbbell
182254852Sdumbbell    /*
183254852Sdumbbell     * The return object will be a package, so check the
184254852Sdumbbell     *  parameters.  If the return object is not a package,
185254852Sdumbbell     *  then the underlying AML code is corrupt or improperly
186254852Sdumbbell     *  written.
187254852Sdumbbell     */
188254852Sdumbbell    if (ACPI_TYPE_PACKAGE != RetObj->Common.Type)
189254852Sdumbbell    {
190254852Sdumbbell        Status = AE_AML_OPERAND_TYPE;
191254852Sdumbbell        goto Cleanup;
192254852Sdumbbell    }
193254852Sdumbbell
194254852Sdumbbell    /*
195254852Sdumbbell     * Make the call to create a resource linked list from the
196254852Sdumbbell     *  byte stream buffer that comes back from the _CRS method
197254852Sdumbbell     *  execution.
198254852Sdumbbell     */
199254852Sdumbbell    Status = AcpiRsCreatePciRoutingTable (RetObj, RetBuffer->Pointer,
200254852Sdumbbell                    &BufferSpaceNeeded);
201254852Sdumbbell
202254852Sdumbbell    /*
203254852Sdumbbell     * Tell the user how much of the buffer we have used or is needed
204254852Sdumbbell     *  and return the final status.
205254852Sdumbbell     */
206254852Sdumbbell    RetBuffer->Length = BufferSpaceNeeded;
207254852Sdumbbell
208254852Sdumbbell
209254852Sdumbbell    /* On exit, we must delete the object returned by evaluateObject */
210254852Sdumbbell
211254852SdumbbellCleanup:
212254852Sdumbbell
213254852Sdumbbell    AcpiUtRemoveReference (RetObj);
214254852Sdumbbell    return_ACPI_STATUS (Status);
215254852Sdumbbell}
216254852Sdumbbell
217254852Sdumbbell
218254852Sdumbbell/*******************************************************************************
219254852Sdumbbell *
220254852Sdumbbell * FUNCTION:    AcpiRsGetCrsMethodData
221254852Sdumbbell *
222254852Sdumbbell * PARAMETERS:  Handle          - a handle to the containing object
223254852Sdumbbell *              RetBuffer       - a pointer to a buffer structure for the
224254852Sdumbbell *                                  results
225254852Sdumbbell *
226254852Sdumbbell * RETURN:      Status
227254852Sdumbbell *
228254852Sdumbbell * DESCRIPTION: This function is called to get the _CRS value of an object
229254852Sdumbbell *              contained in an object specified by the handle passed in
230254852Sdumbbell *
231254852Sdumbbell *              If the function fails an appropriate status will be returned
232254852Sdumbbell *              and the contents of the callers buffer is undefined.
233254852Sdumbbell *
234254852Sdumbbell ******************************************************************************/
235254852Sdumbbell
236254852SdumbbellACPI_STATUS
237254852SdumbbellAcpiRsGetCrsMethodData (
238254852Sdumbbell    ACPI_HANDLE             Handle,
239254852Sdumbbell    ACPI_BUFFER             *RetBuffer)
240254852Sdumbbell{
241254852Sdumbbell    ACPI_OPERAND_OBJECT     *RetObj;
242254852Sdumbbell    ACPI_STATUS             Status;
243254852Sdumbbell    UINT32                  BufferSpaceNeeded = RetBuffer->Length;
244254852Sdumbbell
245254852Sdumbbell
246254852Sdumbbell    FUNCTION_TRACE ("RsGetCrsMethodData");
247254852Sdumbbell
248254852Sdumbbell
249254852Sdumbbell    /* already validated params, so we won't repeat here */
250254852Sdumbbell
251254852Sdumbbell    /*
252254852Sdumbbell     *  Execute the method, no parameters
253254852Sdumbbell     */
254254852Sdumbbell    Status = AcpiNsEvaluateRelative (Handle, "_CRS", NULL, &RetObj);
255254852Sdumbbell    if (ACPI_FAILURE (Status))
256254852Sdumbbell    {
257254852Sdumbbell        return_ACPI_STATUS (Status);
258254852Sdumbbell    }
259254852Sdumbbell
260254852Sdumbbell    if (!RetObj)
261254852Sdumbbell    {
262254852Sdumbbell        /* Return object is required */
263254852Sdumbbell
264254852Sdumbbell        DEBUG_PRINTP (ACPI_ERROR, ("No object was returned from _CRS\n"));
265254852Sdumbbell        return_ACPI_STATUS (AE_TYPE);
266254852Sdumbbell    }
267254852Sdumbbell
268254852Sdumbbell    /*
269254852Sdumbbell     * The return object will be a buffer, but check the
270254852Sdumbbell     *  parameters.  If the return object is not a buffer,
271254852Sdumbbell     *  then the underlying AML code is corrupt or improperly
272254852Sdumbbell     *  written.
273254852Sdumbbell     */
274254852Sdumbbell    if (ACPI_TYPE_BUFFER != RetObj->Common.Type)
275254852Sdumbbell    {
276254852Sdumbbell        Status = AE_AML_OPERAND_TYPE;
277254852Sdumbbell        goto Cleanup;
278254852Sdumbbell    }
279254852Sdumbbell
280254852Sdumbbell    /*
281254852Sdumbbell     * Make the call to create a resource linked list from the
282254852Sdumbbell     *  byte stream buffer that comes back from the _CRS method
283254852Sdumbbell     *  execution.
284254852Sdumbbell     */
285254852Sdumbbell    Status = AcpiRsCreateResourceList (RetObj, RetBuffer->Pointer,
286254852Sdumbbell                &BufferSpaceNeeded);
287254852Sdumbbell
288254852Sdumbbell
289254852Sdumbbell    /*
290254852Sdumbbell     * Tell the user how much of the buffer we have used or is needed
291254852Sdumbbell     *  and return the final status.
292254852Sdumbbell     */
293254852Sdumbbell    RetBuffer->Length = BufferSpaceNeeded;
294254852Sdumbbell
295254852Sdumbbell
296254852Sdumbbell    /* On exit, we must delete the object returned by evaluateObject */
297254852Sdumbbell
298254852SdumbbellCleanup:
299254852Sdumbbell
300254852Sdumbbell    AcpiUtRemoveReference (RetObj);
301254852Sdumbbell    return_ACPI_STATUS (Status);
302254852Sdumbbell}
303254852Sdumbbell
304254852Sdumbbell
305254852Sdumbbell/*******************************************************************************
306254852Sdumbbell *
307254852Sdumbbell * FUNCTION:    AcpiRsGetPrsMethodData
308254852Sdumbbell *
309254852Sdumbbell * PARAMETERS:  Handle          - a handle to the containing object
310254852Sdumbbell *              RetBuffer       - a pointer to a buffer structure for the
311254852Sdumbbell *                                  results
312254852Sdumbbell *
313254852Sdumbbell * RETURN:      Status
314254852Sdumbbell *
315254852Sdumbbell * DESCRIPTION: This function is called to get the _PRS value of an object
316254852Sdumbbell *              contained in an object specified by the handle passed in
317254852Sdumbbell *
318254852Sdumbbell *              If the function fails an appropriate status will be returned
319254852Sdumbbell *              and the contents of the callers buffer is undefined.
320254852Sdumbbell *
321254852Sdumbbell ******************************************************************************/
322254852Sdumbbell
323254852SdumbbellACPI_STATUS
324254852SdumbbellAcpiRsGetPrsMethodData (
325254852Sdumbbell    ACPI_HANDLE             Handle,
326254852Sdumbbell    ACPI_BUFFER             *RetBuffer)
327254852Sdumbbell{
328254852Sdumbbell    ACPI_OPERAND_OBJECT     *RetObj;
329254852Sdumbbell    ACPI_STATUS             Status;
330254852Sdumbbell    UINT32                  BufferSpaceNeeded = RetBuffer->Length;
331254852Sdumbbell
332254852Sdumbbell
333254852Sdumbbell    FUNCTION_TRACE ("RsGetPrsMethodData");
334254852Sdumbbell
335254852Sdumbbell
336254852Sdumbbell    /* already validated params, so we won't repeat here */
337254852Sdumbbell
338254852Sdumbbell    /*
339254852Sdumbbell     *  Execute the method, no parameters
340254852Sdumbbell     */
341254852Sdumbbell    Status = AcpiNsEvaluateRelative (Handle, "_PRS", NULL, &RetObj);
342254852Sdumbbell    if (ACPI_FAILURE (Status))
343254852Sdumbbell    {
344254852Sdumbbell        return_ACPI_STATUS (Status);
345254852Sdumbbell    }
346254852Sdumbbell
347235783Skib    if (!RetObj)
348235783Skib    {
349254852Sdumbbell        /* Return object is required */
350235783Skib
351235783Skib        DEBUG_PRINTP (ACPI_ERROR, ("No object was returned from _PRS\n"));
352254852Sdumbbell        return_ACPI_STATUS (AE_TYPE);
353235783Skib    }
354235783Skib
355235783Skib    /*
356235783Skib     * The return object will be a buffer, but check the
357235783Skib     *  parameters.  If the return object is not a buffer,
358235783Skib     *  then the underlying AML code is corrupt or improperly
359235783Skib     *  written..
360235783Skib     */
361235783Skib    if (ACPI_TYPE_BUFFER != RetObj->Common.Type)
362235783Skib    {
363235783Skib        Status = AE_AML_OPERAND_TYPE;
364235783Skib        goto Cleanup;
365235783Skib    }
366235783Skib
367235783Skib    /*
368235783Skib     * Make the call to create a resource linked list from the
369235783Skib     *  byte stream buffer that comes back from the _CRS method
370235783Skib     *  execution.
371235783Skib     */
372235783Skib    Status = AcpiRsCreateResourceList (RetObj, RetBuffer->Pointer,
373235783Skib                &BufferSpaceNeeded);
374235783Skib
375235783Skib    /*
376235783Skib     * Tell the user how much of the buffer we have used or is needed
377235783Skib     *  and return the final status.
378235783Skib     */
379235783Skib    RetBuffer->Length = BufferSpaceNeeded;
380235783Skib
381235783Skib
382235783Skib    /* On exit, we must delete the object returned by evaluateObject */
383235783Skib
384235783SkibCleanup:
385235783Skib
386235783Skib    AcpiUtRemoveReference (RetObj);
387235783Skib    return_ACPI_STATUS (Status);
388235783Skib}
389235783Skib
390254852Sdumbbell
391235783Skib/*******************************************************************************
392235783Skib *
393235783Skib * FUNCTION:    AcpiRsSetSrsMethodData
394235783Skib *
395235783Skib * PARAMETERS:  Handle          - a handle to the containing object
396235783Skib *              InBuffer        - a pointer to a buffer structure of the
397235783Skib *                                  parameter
398235783Skib *
399235783Skib * RETURN:      Status
400235783Skib *
401235783Skib * DESCRIPTION: This function is called to set the _SRS of an object contained
402254852Sdumbbell *              in an object specified by the handle passed in
403235783Skib *
404235783Skib *              If the function fails an appropriate status will be returned
405235783Skib *              and the contents of the callers buffer is undefined.
406235783Skib *
407235783Skib ******************************************************************************/
408235783Skib
409235783SkibACPI_STATUS
410235783SkibAcpiRsSetSrsMethodData (
411235783Skib    ACPI_HANDLE             Handle,
412235783Skib    ACPI_BUFFER             *InBuffer)
413235783Skib{
414235783Skib    ACPI_OPERAND_OBJECT     *Params[2];
415235783Skib    ACPI_OPERAND_OBJECT     ParamObj;
416235783Skib    ACPI_STATUS             Status;
417235783Skib    UINT8                   *ByteStream = NULL;
418235783Skib    UINT32                  BufferSizeNeeded = 0;
419235783Skib
420235783Skib
421235783Skib    FUNCTION_TRACE ("RsSetSrsMethodData");
422235783Skib
423235783Skib
424235783Skib    /* already validated params, so we won't repeat here */
425235783Skib
426235783Skib    /*
427235783Skib     * The InBuffer parameter will point to a linked list of
428235783Skib     * resource parameters.  It needs to be formatted into a
429235783Skib     * byte stream to be sent in as an input parameter.
430235783Skib     */
431235783Skib    BufferSizeNeeded = 0;
432235783Skib
433235783Skib    /*
434235783Skib     * First call is to get the buffer size needed
435235783Skib     */
436235783Skib    Status = AcpiRsCreateByteStream (InBuffer->Pointer, ByteStream,
437235783Skib                &BufferSizeNeeded);
438235783Skib    /*
439235783Skib     * We expect a return of AE_BUFFER_OVERFLOW
440235783Skib     * if not, exit with the error
441235783Skib     */
442235783Skib    if (AE_BUFFER_OVERFLOW != Status)
443235783Skib    {
444235783Skib        return_ACPI_STATUS (Status);
445235783Skib    }
446235783Skib
447235783Skib    /*
448235783Skib     * Allocate the buffer needed
449235783Skib     */
450235783Skib    ByteStream = AcpiUtCallocate(BufferSizeNeeded);
451235783Skib    if (NULL == ByteStream)
452235783Skib    {
453235783Skib        return_ACPI_STATUS (AE_NO_MEMORY);
454235783Skib    }
455235783Skib
456235783Skib    /*
457235783Skib     * Now call to convert the linked list into a byte stream
458235783Skib     */
459235783Skib    Status = AcpiRsCreateByteStream (InBuffer->Pointer, ByteStream,
460254852Sdumbbell                &BufferSizeNeeded);
461254852Sdumbbell    if (ACPI_FAILURE (Status))
462254852Sdumbbell    {
463254852Sdumbbell        goto Cleanup;
464254852Sdumbbell    }
465254852Sdumbbell
466254852Sdumbbell    /*
467254852Sdumbbell     * Init the param object
468254852Sdumbbell     */
469254852Sdumbbell    AcpiUtInitStaticObject (&ParamObj);
470254852Sdumbbell
471254852Sdumbbell    /*
472254852Sdumbbell     * Method requires one parameter.  Set it up
473254852Sdumbbell     */
474254852Sdumbbell    Params [0] = &ParamObj;
475254852Sdumbbell    Params [1] = NULL;
476254852Sdumbbell
477254852Sdumbbell    /*
478254852Sdumbbell     *  Set up the parameter object
479254852Sdumbbell     */
480254852Sdumbbell    ParamObj.Common.Type    = ACPI_TYPE_BUFFER;
481254852Sdumbbell    ParamObj.Buffer.Length  = BufferSizeNeeded;
482254852Sdumbbell    ParamObj.Buffer.Pointer = ByteStream;
483254852Sdumbbell
484254852Sdumbbell    /*
485254852Sdumbbell     * Execute the method, no return value
486254852Sdumbbell     */
487254852Sdumbbell    Status = AcpiNsEvaluateRelative (Handle, "_SRS", Params, NULL);
488254852Sdumbbell
489254852Sdumbbell    /*
490254852Sdumbbell     * Clean up and return the status from AcpiNsEvaluateRelative
491254852Sdumbbell     */
492254852SdumbbellCleanup:
493254852Sdumbbell
494254852Sdumbbell    AcpiUtFree (ByteStream);
495254852Sdumbbell    return_ACPI_STATUS (Status);
496254852Sdumbbell}
497254852Sdumbbell
498254852Sdumbbell