rsxface.c (243347) | rsxface.c (245582) |
---|---|
1/******************************************************************************* 2 * 3 * Module Name: rsxface - Public interfaces to the resource manager 4 * 5 ******************************************************************************/ 6 7/* | 1/******************************************************************************* 2 * 3 * Module Name: rsxface - Public interfaces to the resource manager 4 * 5 ******************************************************************************/ 6 7/* |
8 * Copyright (C) 2000 - 2012, Intel Corp. | 8 * Copyright (C) 2000 - 2013, 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. --- 452 unchanged lines hidden (view full) --- 469 * Name - Method name for the parent resource 470 * (METHOD_NAME__CRS or METHOD_NAME__PRS) 471 * Uuid - Pointer to the UUID to be matched. 472 * includes both subtype and 16-byte UUID 473 * RetBuffer - Where the vendor resource is returned 474 * 475 * RETURN: Status 476 * | 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. --- 452 unchanged lines hidden (view full) --- 469 * Name - Method name for the parent resource 470 * (METHOD_NAME__CRS or METHOD_NAME__PRS) 471 * Uuid - Pointer to the UUID to be matched. 472 * includes both subtype and 16-byte UUID 473 * RetBuffer - Where the vendor resource is returned 474 * 475 * RETURN: Status 476 * |
477 * DESCRIPTION: Walk a resource template for the specified evice to find a | 477 * DESCRIPTION: Walk a resource template for the specified device to find a |
478 * vendor-defined resource that matches the supplied UUID and 479 * UUID subtype. Returns a ACPI_RESOURCE of type Vendor. 480 * 481 ******************************************************************************/ 482 483ACPI_STATUS 484AcpiGetVendorResource ( 485 ACPI_HANDLE DeviceHandle, --- 95 unchanged lines hidden (view full) --- 581 582 Info->Status = AE_OK; 583 return (AE_CTRL_TERMINATE); 584} 585 586 587/******************************************************************************* 588 * | 478 * vendor-defined resource that matches the supplied UUID and 479 * UUID subtype. Returns a ACPI_RESOURCE of type Vendor. 480 * 481 ******************************************************************************/ 482 483ACPI_STATUS 484AcpiGetVendorResource ( 485 ACPI_HANDLE DeviceHandle, --- 95 unchanged lines hidden (view full) --- 581 582 Info->Status = AE_OK; 583 return (AE_CTRL_TERMINATE); 584} 585 586 587/******************************************************************************* 588 * |
589 * FUNCTION: AcpiWalkResources | 589 * FUNCTION: AcpiWalkResourceBuffer |
590 * | 590 * |
591 * PARAMETERS: DeviceHandle - Handle to the device object for the 592 * device we are querying 593 * Name - Method name of the resources we want. 594 * (METHOD_NAME__CRS, METHOD_NAME__PRS, or 595 * METHOD_NAME__AEI) | 591 * PARAMETERS: Buffer - Formatted buffer returned by one of the 592 * various Get*Resource functions |
596 * UserFunction - Called for each resource 597 * Context - Passed to UserFunction 598 * 599 * RETURN: Status 600 * | 593 * UserFunction - Called for each resource 594 * Context - Passed to UserFunction 595 * 596 * RETURN: Status 597 * |
601 * DESCRIPTION: Retrieves the current or possible resource list for the 602 * specified device. The UserFunction is called once for 603 * each resource in the list. | 598 * DESCRIPTION: Walks the input resource template. The UserFunction is called 599 * once for each resource in the list. |
604 * 605 ******************************************************************************/ 606 607ACPI_STATUS | 600 * 601 ******************************************************************************/ 602 603ACPI_STATUS |
608AcpiWalkResources ( 609 ACPI_HANDLE DeviceHandle, 610 char *Name, | 604AcpiWalkResourceBuffer ( 605 ACPI_BUFFER *Buffer, |
611 ACPI_WALK_RESOURCE_CALLBACK UserFunction, 612 void *Context) 613{ | 606 ACPI_WALK_RESOURCE_CALLBACK UserFunction, 607 void *Context) 608{ |
614 ACPI_STATUS Status; 615 ACPI_BUFFER Buffer; | 609 ACPI_STATUS Status = AE_OK; |
616 ACPI_RESOURCE *Resource; 617 ACPI_RESOURCE *ResourceEnd; 618 619 | 610 ACPI_RESOURCE *Resource; 611 ACPI_RESOURCE *ResourceEnd; 612 613 |
620 ACPI_FUNCTION_TRACE (AcpiWalkResources); | 614 ACPI_FUNCTION_TRACE (AcpiWalkResourceBuffer); |
621 622 623 /* Parameter validation */ 624 | 615 616 617 /* Parameter validation */ 618 |
625 if (!DeviceHandle || !UserFunction || !Name || 626 (!ACPI_COMPARE_NAME (Name, METHOD_NAME__CRS) && 627 !ACPI_COMPARE_NAME (Name, METHOD_NAME__PRS) && 628 !ACPI_COMPARE_NAME (Name, METHOD_NAME__AEI))) | 619 if (!Buffer || !Buffer->Pointer || !UserFunction) |
629 { 630 return_ACPI_STATUS (AE_BAD_PARAMETER); 631 } 632 | 620 { 621 return_ACPI_STATUS (AE_BAD_PARAMETER); 622 } 623 |
633 /* Get the _CRS/_PRS/_AEI resource list */ | 624 /* Buffer contains the resource list and length */ |
634 | 625 |
635 Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; 636 Status = AcpiRsGetMethodData (DeviceHandle, Name, &Buffer); 637 if (ACPI_FAILURE (Status)) 638 { 639 return_ACPI_STATUS (Status); 640 } | 626 Resource = ACPI_CAST_PTR (ACPI_RESOURCE, Buffer->Pointer); 627 ResourceEnd = ACPI_ADD_PTR (ACPI_RESOURCE, Buffer->Pointer, Buffer->Length); |
641 | 628 |
642 /* Buffer now contains the resource list */ 643 644 Resource = ACPI_CAST_PTR (ACPI_RESOURCE, Buffer.Pointer); 645 ResourceEnd = ACPI_ADD_PTR (ACPI_RESOURCE, Buffer.Pointer, Buffer.Length); 646 | |
647 /* Walk the resource list until the EndTag is found (or buffer end) */ 648 649 while (Resource < ResourceEnd) 650 { 651 /* Sanity check the resource */ 652 653 if (Resource->Type > ACPI_RESOURCE_TYPE_MAX) 654 { --- 22 unchanged lines hidden (view full) --- 677 break; 678 } 679 680 /* Get the next resource descriptor */ 681 682 Resource = ACPI_NEXT_RESOURCE (Resource); 683 } 684 | 629 /* Walk the resource list until the EndTag is found (or buffer end) */ 630 631 while (Resource < ResourceEnd) 632 { 633 /* Sanity check the resource */ 634 635 if (Resource->Type > ACPI_RESOURCE_TYPE_MAX) 636 { --- 22 unchanged lines hidden (view full) --- 659 break; 660 } 661 662 /* Get the next resource descriptor */ 663 664 Resource = ACPI_NEXT_RESOURCE (Resource); 665 } 666 |
667 return_ACPI_STATUS (Status); 668} 669 670ACPI_EXPORT_SYMBOL (AcpiWalkResourceBuffer) 671 672 673/******************************************************************************* 674 * 675 * FUNCTION: AcpiWalkResources 676 * 677 * PARAMETERS: DeviceHandle - Handle to the device object for the 678 * device we are querying 679 * Name - Method name of the resources we want. 680 * (METHOD_NAME__CRS, METHOD_NAME__PRS, or 681 * METHOD_NAME__AEI) 682 * UserFunction - Called for each resource 683 * Context - Passed to UserFunction 684 * 685 * RETURN: Status 686 * 687 * DESCRIPTION: Retrieves the current or possible resource list for the 688 * specified device. The UserFunction is called once for 689 * each resource in the list. 690 * 691 ******************************************************************************/ 692 693ACPI_STATUS 694AcpiWalkResources ( 695 ACPI_HANDLE DeviceHandle, 696 char *Name, 697 ACPI_WALK_RESOURCE_CALLBACK UserFunction, 698 void *Context) 699{ 700 ACPI_STATUS Status; 701 ACPI_BUFFER Buffer; 702 703 704 ACPI_FUNCTION_TRACE (AcpiWalkResources); 705 706 707 /* Parameter validation */ 708 709 if (!DeviceHandle || !UserFunction || !Name || 710 (!ACPI_COMPARE_NAME (Name, METHOD_NAME__CRS) && 711 !ACPI_COMPARE_NAME (Name, METHOD_NAME__PRS) && 712 !ACPI_COMPARE_NAME (Name, METHOD_NAME__AEI))) 713 { 714 return_ACPI_STATUS (AE_BAD_PARAMETER); 715 } 716 717 /* Get the _CRS/_PRS/_AEI resource list */ 718 719 Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; 720 Status = AcpiRsGetMethodData (DeviceHandle, Name, &Buffer); 721 if (ACPI_FAILURE (Status)) 722 { 723 return_ACPI_STATUS (Status); 724 } 725 726 /* Walk the resource list and cleanup */ 727 728 Status = AcpiWalkResourceBuffer (&Buffer, UserFunction, Context); |
|
685 ACPI_FREE (Buffer.Pointer); 686 return_ACPI_STATUS (Status); 687} 688 689ACPI_EXPORT_SYMBOL (AcpiWalkResources) | 729 ACPI_FREE (Buffer.Pointer); 730 return_ACPI_STATUS (Status); 731} 732 733ACPI_EXPORT_SYMBOL (AcpiWalkResources) |