Print this page
update to acpica-unix2-20140114
update to acpica-unix2-20130927
acpica-unix2-20130823
PANKOVs restructure
   1 /*******************************************************************************
   2  *
   3  * Module Name: rsxface - Public interfaces to 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 __RSXFACE_C__

  46 
  47 #include "acpi.h"
  48 #include "accommon.h"
  49 #include "acresrc.h"
  50 #include "acnamesp.h"
  51 
  52 #define _COMPONENT          ACPI_RESOURCES
  53         ACPI_MODULE_NAME    ("rsxface")
  54 
  55 /* Local macros for 16,32-bit to 64-bit conversion */
  56 
  57 #define ACPI_COPY_FIELD(Out, In, Field)  ((Out)->Field = (In)->Field)
  58 #define ACPI_COPY_ADDRESS(Out, In)                      \
  59     ACPI_COPY_FIELD(Out, In, ResourceType);              \
  60     ACPI_COPY_FIELD(Out, In, ProducerConsumer);          \
  61     ACPI_COPY_FIELD(Out, In, Decode);                    \
  62     ACPI_COPY_FIELD(Out, In, MinAddressFixed);           \
  63     ACPI_COPY_FIELD(Out, In, MaxAddressFixed);           \
  64     ACPI_COPY_FIELD(Out, In, Info);                      \
  65     ACPI_COPY_FIELD(Out, In, Granularity);               \


 334         (!InBuffer->Length))
 335     {
 336         return_ACPI_STATUS (AE_BAD_PARAMETER);
 337     }
 338 
 339     /* Validate parameters then dispatch to internal routine */
 340 
 341     Status = AcpiRsValidateParameters (DeviceHandle, InBuffer, &Node);
 342     if (ACPI_FAILURE (Status))
 343     {
 344         return_ACPI_STATUS (Status);
 345     }
 346 
 347     Status = AcpiRsSetSrsMethodData (Node, InBuffer);
 348     return_ACPI_STATUS (Status);
 349 }
 350 
 351 ACPI_EXPORT_SYMBOL (AcpiSetCurrentResources)
 352 
 353 














































 354 /******************************************************************************
 355  *
 356  * FUNCTION:    AcpiResourceToAddress64
 357  *
 358  * PARAMETERS:  Resource        - Pointer to a resource
 359  *              Out             - Pointer to the users's return buffer
 360  *                                (a struct acpi_resource_address64)
 361  *
 362  * RETURN:      Status
 363  *
 364  * DESCRIPTION: If the resource is an address16, address32, or address64,
 365  *              copy it to the address64 return buffer. This saves the
 366  *              caller from having to duplicate code for different-sized
 367  *              addresses.
 368  *
 369  ******************************************************************************/
 370 
 371 ACPI_STATUS
 372 AcpiResourceToAddress64 (
 373     ACPI_RESOURCE               *Resource,


 389     case ACPI_RESOURCE_TYPE_ADDRESS16:
 390 
 391         Address16 = ACPI_CAST_PTR (ACPI_RESOURCE_ADDRESS16, &Resource->Data);
 392         ACPI_COPY_ADDRESS (Out, Address16);
 393         break;
 394 
 395     case ACPI_RESOURCE_TYPE_ADDRESS32:
 396 
 397         Address32 = ACPI_CAST_PTR (ACPI_RESOURCE_ADDRESS32, &Resource->Data);
 398         ACPI_COPY_ADDRESS (Out, Address32);
 399         break;
 400 
 401     case ACPI_RESOURCE_TYPE_ADDRESS64:
 402 
 403         /* Simple copy for 64 bit source */
 404 
 405         ACPI_MEMCPY (Out, &Resource->Data, sizeof (ACPI_RESOURCE_ADDRESS64));
 406         break;
 407 
 408     default:

 409         return (AE_BAD_PARAMETER);
 410     }
 411 
 412     return (AE_OK);
 413 }
 414 
 415 ACPI_EXPORT_SYMBOL (AcpiResourceToAddress64)
 416 
 417 
 418 /*******************************************************************************
 419  *
 420  * FUNCTION:    AcpiGetVendorResource
 421  *
 422  * PARAMETERS:  DeviceHandle    - Handle for the parent device object
 423  *              Name            - Method name for the parent resource
 424  *                                (METHOD_NAME__CRS or METHOD_NAME__PRS)
 425  *              Uuid            - Pointer to the UUID to be matched.
 426  *                                includes both subtype and 16-byte UUID
 427  *              RetBuffer       - Where the vendor resource is returned
 428  *
 429  * RETURN:      Status
 430  *
 431  * DESCRIPTION: Walk a resource template for the specified evice to find a
 432  *              vendor-defined resource that matches the supplied UUID and
 433  *              UUID subtype. Returns a ACPI_RESOURCE of type Vendor.
 434  *
 435  ******************************************************************************/
 436 
 437 ACPI_STATUS
 438 AcpiGetVendorResource (
 439     ACPI_HANDLE             DeviceHandle,
 440     char                    *Name,
 441     ACPI_VENDOR_UUID        *Uuid,
 442     ACPI_BUFFER             *RetBuffer)
 443 {
 444     ACPI_VENDOR_WALK_INFO   Info;
 445     ACPI_STATUS             Status;
 446 
 447 
 448     /* Other parameters are validated by AcpiWalkResources */
 449 
 450     if (!Uuid || !RetBuffer)
 451     {


 523     Status = AcpiUtInitializeBuffer (Buffer, Resource->Length);
 524     if (ACPI_FAILURE (Status))
 525     {
 526         return (Status);
 527     }
 528 
 529     /* Found the correct resource, copy and return it */
 530 
 531     ACPI_MEMCPY (Buffer->Pointer, Resource, Resource->Length);
 532     Buffer->Length = Resource->Length;
 533 
 534     /* Found the desired descriptor, terminate resource walk */
 535 
 536     Info->Status = AE_OK;
 537     return (AE_CTRL_TERMINATE);
 538 }
 539 
 540 
 541 /*******************************************************************************
 542  *
 543  * FUNCTION:    AcpiWalkResources
 544  *
 545  * PARAMETERS:  DeviceHandle    - Handle to the device object for the
 546  *                                device we are querying
 547  *              Name            - Method name of the resources we want
 548  *                                (METHOD_NAME__CRS or METHOD_NAME__PRS)
 549  *              UserFunction    - Called for each resource
 550  *              Context         - Passed to UserFunction
 551  *
 552  * RETURN:      Status
 553  *
 554  * DESCRIPTION: Retrieves the current or possible resource list for the
 555  *              specified device. The UserFunction is called once for
 556  *              each resource in the list.
 557  *
 558  ******************************************************************************/
 559 
 560 ACPI_STATUS
 561 AcpiWalkResources (
 562     ACPI_HANDLE                 DeviceHandle,
 563     char                        *Name,
 564     ACPI_WALK_RESOURCE_CALLBACK UserFunction,
 565     void                        *Context)
 566 {
 567     ACPI_STATUS                 Status;
 568     ACPI_BUFFER                 Buffer;
 569     ACPI_RESOURCE               *Resource;
 570     ACPI_RESOURCE               *ResourceEnd;
 571 
 572 
 573     ACPI_FUNCTION_TRACE (AcpiWalkResources);
 574 
 575 
 576     /* Parameter validation */
 577 
 578     if (!DeviceHandle || !UserFunction || !Name ||
 579         (!ACPI_COMPARE_NAME (Name, METHOD_NAME__CRS) &&
 580          !ACPI_COMPARE_NAME (Name, METHOD_NAME__PRS)))
 581     {
 582         return_ACPI_STATUS (AE_BAD_PARAMETER);
 583     }
 584 
 585     /* Get the _CRS or _PRS resource list */
 586 
 587     Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
 588     Status = AcpiRsGetMethodData (DeviceHandle, Name, &Buffer);
 589     if (ACPI_FAILURE (Status))
 590     {
 591         return_ACPI_STATUS (Status);
 592     }
 593 
 594     /* Buffer now contains the resource list */
 595 
 596     Resource = ACPI_CAST_PTR (ACPI_RESOURCE, Buffer.Pointer);
 597     ResourceEnd = ACPI_ADD_PTR (ACPI_RESOURCE, Buffer.Pointer, Buffer.Length);
 598 
 599     /* Walk the resource list until the EndTag is found (or buffer end) */
 600 
 601     while (Resource < ResourceEnd)
 602     {
 603         /* Sanity check the resource */
 604 
 605         if (Resource->Type > ACPI_RESOURCE_TYPE_MAX)
 606         {
 607             Status = AE_AML_INVALID_RESOURCE_TYPE;
 608             break;
 609         }
 610 







 611         /* Invoke the user function, abort on any error returned */
 612 
 613         Status = UserFunction (Resource, Context);
 614         if (ACPI_FAILURE (Status))
 615         {
 616             if (Status == AE_CTRL_TERMINATE)
 617             {
 618                 /* This is an OK termination by the user function */
 619 
 620                 Status = AE_OK;
 621             }
 622             break;
 623         }
 624 
 625         /* EndTag indicates end-of-list */
 626 
 627         if (Resource->Type == ACPI_RESOURCE_TYPE_END_TAG)
 628         {
 629             break;
 630         }
 631 
 632         /* Get the next resource descriptor */
 633 
 634         Resource = ACPI_ADD_PTR (ACPI_RESOURCE, Resource, Resource->Length);
 635     }
 636 






























































 637     ACPI_FREE (Buffer.Pointer);
 638     return_ACPI_STATUS (Status);
 639 }
 640 
 641 ACPI_EXPORT_SYMBOL (AcpiWalkResources)
   1 /*******************************************************************************
   2  *
   3  * Module Name: rsxface - Public interfaces to the resource manager
   4  *
   5  ******************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2014, 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 __RSXFACE_C__
  46 #define EXPORT_ACPI_INTERFACES
  47 
  48 #include "acpi.h"
  49 #include "accommon.h"
  50 #include "acresrc.h"
  51 #include "acnamesp.h"
  52 
  53 #define _COMPONENT          ACPI_RESOURCES
  54         ACPI_MODULE_NAME    ("rsxface")
  55 
  56 /* Local macros for 16,32-bit to 64-bit conversion */
  57 
  58 #define ACPI_COPY_FIELD(Out, In, Field)  ((Out)->Field = (In)->Field)
  59 #define ACPI_COPY_ADDRESS(Out, In)                      \
  60     ACPI_COPY_FIELD(Out, In, ResourceType);              \
  61     ACPI_COPY_FIELD(Out, In, ProducerConsumer);          \
  62     ACPI_COPY_FIELD(Out, In, Decode);                    \
  63     ACPI_COPY_FIELD(Out, In, MinAddressFixed);           \
  64     ACPI_COPY_FIELD(Out, In, MaxAddressFixed);           \
  65     ACPI_COPY_FIELD(Out, In, Info);                      \
  66     ACPI_COPY_FIELD(Out, In, Granularity);               \


 335         (!InBuffer->Length))
 336     {
 337         return_ACPI_STATUS (AE_BAD_PARAMETER);
 338     }
 339 
 340     /* Validate parameters then dispatch to internal routine */
 341 
 342     Status = AcpiRsValidateParameters (DeviceHandle, InBuffer, &Node);
 343     if (ACPI_FAILURE (Status))
 344     {
 345         return_ACPI_STATUS (Status);
 346     }
 347 
 348     Status = AcpiRsSetSrsMethodData (Node, InBuffer);
 349     return_ACPI_STATUS (Status);
 350 }
 351 
 352 ACPI_EXPORT_SYMBOL (AcpiSetCurrentResources)
 353 
 354 
 355 /*******************************************************************************
 356  *
 357  * FUNCTION:    AcpiGetEventResources
 358  *
 359  * PARAMETERS:  DeviceHandle    - Handle to the device object for the
 360  *                                device we are getting resources
 361  *              InBuffer        - Pointer to a buffer containing the
 362  *                                resources to be set for the device
 363  *
 364  * RETURN:      Status
 365  *
 366  * DESCRIPTION: This function is called to get the event resources for a
 367  *              specific device. The caller must first acquire a handle for
 368  *              the desired device. The resource data is passed to the routine
 369  *              the buffer pointed to by the InBuffer variable. Uses the
 370  *              _AEI method.
 371  *
 372  ******************************************************************************/
 373 
 374 ACPI_STATUS
 375 AcpiGetEventResources (
 376     ACPI_HANDLE             DeviceHandle,
 377     ACPI_BUFFER             *RetBuffer)
 378 {
 379     ACPI_STATUS             Status;
 380     ACPI_NAMESPACE_NODE     *Node;
 381 
 382 
 383     ACPI_FUNCTION_TRACE (AcpiGetEventResources);
 384 
 385 
 386     /* Validate parameters then dispatch to internal routine */
 387 
 388     Status = AcpiRsValidateParameters (DeviceHandle, RetBuffer, &Node);
 389     if (ACPI_FAILURE (Status))
 390     {
 391         return_ACPI_STATUS (Status);
 392     }
 393 
 394     Status = AcpiRsGetAeiMethodData (Node, RetBuffer);
 395     return_ACPI_STATUS (Status);
 396 }
 397 
 398 ACPI_EXPORT_SYMBOL (AcpiGetEventResources)
 399 
 400 
 401 /******************************************************************************
 402  *
 403  * FUNCTION:    AcpiResourceToAddress64
 404  *
 405  * PARAMETERS:  Resource        - Pointer to a resource
 406  *              Out             - Pointer to the users's return buffer
 407  *                                (a struct acpi_resource_address64)
 408  *
 409  * RETURN:      Status
 410  *
 411  * DESCRIPTION: If the resource is an address16, address32, or address64,
 412  *              copy it to the address64 return buffer. This saves the
 413  *              caller from having to duplicate code for different-sized
 414  *              addresses.
 415  *
 416  ******************************************************************************/
 417 
 418 ACPI_STATUS
 419 AcpiResourceToAddress64 (
 420     ACPI_RESOURCE               *Resource,


 436     case ACPI_RESOURCE_TYPE_ADDRESS16:
 437 
 438         Address16 = ACPI_CAST_PTR (ACPI_RESOURCE_ADDRESS16, &Resource->Data);
 439         ACPI_COPY_ADDRESS (Out, Address16);
 440         break;
 441 
 442     case ACPI_RESOURCE_TYPE_ADDRESS32:
 443 
 444         Address32 = ACPI_CAST_PTR (ACPI_RESOURCE_ADDRESS32, &Resource->Data);
 445         ACPI_COPY_ADDRESS (Out, Address32);
 446         break;
 447 
 448     case ACPI_RESOURCE_TYPE_ADDRESS64:
 449 
 450         /* Simple copy for 64 bit source */
 451 
 452         ACPI_MEMCPY (Out, &Resource->Data, sizeof (ACPI_RESOURCE_ADDRESS64));
 453         break;
 454 
 455     default:
 456 
 457         return (AE_BAD_PARAMETER);
 458     }
 459 
 460     return (AE_OK);
 461 }
 462 
 463 ACPI_EXPORT_SYMBOL (AcpiResourceToAddress64)
 464 
 465 
 466 /*******************************************************************************
 467  *
 468  * FUNCTION:    AcpiGetVendorResource
 469  *
 470  * PARAMETERS:  DeviceHandle    - Handle for the parent device object
 471  *              Name            - Method name for the parent resource
 472  *                                (METHOD_NAME__CRS or METHOD_NAME__PRS)
 473  *              Uuid            - Pointer to the UUID to be matched.
 474  *                                includes both subtype and 16-byte UUID
 475  *              RetBuffer       - Where the vendor resource is returned
 476  *
 477  * RETURN:      Status
 478  *
 479  * DESCRIPTION: Walk a resource template for the specified device to find a
 480  *              vendor-defined resource that matches the supplied UUID and
 481  *              UUID subtype. Returns a ACPI_RESOURCE of type Vendor.
 482  *
 483  ******************************************************************************/
 484 
 485 ACPI_STATUS
 486 AcpiGetVendorResource (
 487     ACPI_HANDLE             DeviceHandle,
 488     char                    *Name,
 489     ACPI_VENDOR_UUID        *Uuid,
 490     ACPI_BUFFER             *RetBuffer)
 491 {
 492     ACPI_VENDOR_WALK_INFO   Info;
 493     ACPI_STATUS             Status;
 494 
 495 
 496     /* Other parameters are validated by AcpiWalkResources */
 497 
 498     if (!Uuid || !RetBuffer)
 499     {


 571     Status = AcpiUtInitializeBuffer (Buffer, Resource->Length);
 572     if (ACPI_FAILURE (Status))
 573     {
 574         return (Status);
 575     }
 576 
 577     /* Found the correct resource, copy and return it */
 578 
 579     ACPI_MEMCPY (Buffer->Pointer, Resource, Resource->Length);
 580     Buffer->Length = Resource->Length;
 581 
 582     /* Found the desired descriptor, terminate resource walk */
 583 
 584     Info->Status = AE_OK;
 585     return (AE_CTRL_TERMINATE);
 586 }
 587 
 588 
 589 /*******************************************************************************
 590  *
 591  * FUNCTION:    AcpiWalkResourceBuffer
 592  *
 593  * PARAMETERS:  Buffer          - Formatted buffer returned by one of the
 594  *                                various Get*Resource functions


 595  *              UserFunction    - Called for each resource
 596  *              Context         - Passed to UserFunction
 597  *
 598  * RETURN:      Status
 599  *
 600  * DESCRIPTION: Walks the input resource template. The UserFunction is called
 601  *              once for each resource in the list.

 602  *
 603  ******************************************************************************/
 604 
 605 ACPI_STATUS
 606 AcpiWalkResourceBuffer (
 607     ACPI_BUFFER                 *Buffer,

 608     ACPI_WALK_RESOURCE_CALLBACK UserFunction,
 609     void                        *Context)
 610 {
 611     ACPI_STATUS                 Status = AE_OK;

 612     ACPI_RESOURCE               *Resource;
 613     ACPI_RESOURCE               *ResourceEnd;
 614 
 615 
 616     ACPI_FUNCTION_TRACE (AcpiWalkResourceBuffer);
 617 
 618 
 619     /* Parameter validation */
 620 
 621     if (!Buffer || !Buffer->Pointer || !UserFunction)


 622     {
 623         return_ACPI_STATUS (AE_BAD_PARAMETER);
 624     }
 625 
 626     /* Buffer contains the resource list and length */
 627 
 628     Resource = ACPI_CAST_PTR (ACPI_RESOURCE, Buffer->Pointer);
 629     ResourceEnd = ACPI_ADD_PTR (ACPI_RESOURCE, Buffer->Pointer, Buffer->Length);




 630 





 631     /* Walk the resource list until the EndTag is found (or buffer end) */
 632 
 633     while (Resource < ResourceEnd)
 634     {
 635         /* Sanity check the resource type */
 636 
 637         if (Resource->Type > ACPI_RESOURCE_TYPE_MAX)
 638         {
 639             Status = AE_AML_INVALID_RESOURCE_TYPE;
 640             break;
 641         }
 642 
 643         /* Sanity check the length. It must not be zero, or we loop forever */
 644 
 645         if (!Resource->Length)
 646         {
 647             return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
 648         }
 649 
 650         /* Invoke the user function, abort on any error returned */
 651 
 652         Status = UserFunction (Resource, Context);
 653         if (ACPI_FAILURE (Status))
 654         {
 655             if (Status == AE_CTRL_TERMINATE)
 656             {
 657                 /* This is an OK termination by the user function */
 658 
 659                 Status = AE_OK;
 660             }
 661             break;
 662         }
 663 
 664         /* EndTag indicates end-of-list */
 665 
 666         if (Resource->Type == ACPI_RESOURCE_TYPE_END_TAG)
 667         {
 668             break;
 669         }
 670 
 671         /* Get the next resource descriptor */
 672 
 673         Resource = ACPI_NEXT_RESOURCE (Resource);
 674     }
 675 
 676     return_ACPI_STATUS (Status);
 677 }
 678 
 679 ACPI_EXPORT_SYMBOL (AcpiWalkResourceBuffer)
 680 
 681 
 682 /*******************************************************************************
 683  *
 684  * FUNCTION:    AcpiWalkResources
 685  *
 686  * PARAMETERS:  DeviceHandle    - Handle to the device object for the
 687  *                                device we are querying
 688  *              Name            - Method name of the resources we want.
 689  *                                (METHOD_NAME__CRS, METHOD_NAME__PRS, or
 690  *                                METHOD_NAME__AEI)
 691  *              UserFunction    - Called for each resource
 692  *              Context         - Passed to UserFunction
 693  *
 694  * RETURN:      Status
 695  *
 696  * DESCRIPTION: Retrieves the current or possible resource list for the
 697  *              specified device. The UserFunction is called once for
 698  *              each resource in the list.
 699  *
 700  ******************************************************************************/
 701 
 702 ACPI_STATUS
 703 AcpiWalkResources (
 704     ACPI_HANDLE                 DeviceHandle,
 705     char                        *Name,
 706     ACPI_WALK_RESOURCE_CALLBACK UserFunction,
 707     void                        *Context)
 708 {
 709     ACPI_STATUS                 Status;
 710     ACPI_BUFFER                 Buffer;
 711 
 712 
 713     ACPI_FUNCTION_TRACE (AcpiWalkResources);
 714 
 715 
 716     /* Parameter validation */
 717 
 718     if (!DeviceHandle || !UserFunction || !Name ||
 719         (!ACPI_COMPARE_NAME (Name, METHOD_NAME__CRS) &&
 720          !ACPI_COMPARE_NAME (Name, METHOD_NAME__PRS) &&
 721          !ACPI_COMPARE_NAME (Name, METHOD_NAME__AEI)))
 722     {
 723         return_ACPI_STATUS (AE_BAD_PARAMETER);
 724     }
 725 
 726     /* Get the _CRS/_PRS/_AEI resource list */
 727 
 728     Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
 729     Status = AcpiRsGetMethodData (DeviceHandle, Name, &Buffer);
 730     if (ACPI_FAILURE (Status))
 731     {
 732         return_ACPI_STATUS (Status);
 733     }
 734 
 735     /* Walk the resource list and cleanup */
 736 
 737     Status = AcpiWalkResourceBuffer (&Buffer, UserFunction, Context);
 738     ACPI_FREE (Buffer.Pointer);
 739     return_ACPI_STATUS (Status);
 740 }
 741 
 742 ACPI_EXPORT_SYMBOL (AcpiWalkResources)