diff options
author | Toshi Kani <toshi.kani@hpe.com> | 2017-08-23 18:54:43 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-08-28 19:42:48 -0400 |
commit | 5aa5911a0ed9355ebb02f83de4be9ba435a45a2c (patch) | |
tree | df42ef212db1c6944058a5114800a7b2706a27e9 /drivers/acpi/utils.c | |
parent | cc4a41fe5541a73019a864883297bd5043aa6d98 (diff) |
ACPI / blacklist: add acpi_match_platform_list()
ACPI OEM ID / OEM Table ID / Revision can be used to identify
a platform based on ACPI firmware info. acpi_blacklisted(),
intel_pstate_platform_pwr_mgmt_exists(), and some other funcs,
have been using similar check to detect a list of platforms
that require special handlings.
Move the platform check in acpi_blacklisted() to a new common
utility function, acpi_match_platform_list(), so that other
drivers do not have to implement their own version.
There is no change in functionality.
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Reviewed-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/utils.c')
-rw-r--r-- | drivers/acpi/utils.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index b9d956c916f5..0a9e5979aaa9 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
@@ -816,3 +816,39 @@ static int __init acpi_backlight(char *str) | |||
816 | return 1; | 816 | return 1; |
817 | } | 817 | } |
818 | __setup("acpi_backlight=", acpi_backlight); | 818 | __setup("acpi_backlight=", acpi_backlight); |
819 | |||
820 | /** | ||
821 | * acpi_match_platform_list - Check if the system matches with a given list | ||
822 | * @plat: pointer to acpi_platform_list table terminated by a NULL entry | ||
823 | * | ||
824 | * Return the matched index if the system is found in the platform list. | ||
825 | * Otherwise, return a negative error code. | ||
826 | */ | ||
827 | int acpi_match_platform_list(const struct acpi_platform_list *plat) | ||
828 | { | ||
829 | struct acpi_table_header hdr; | ||
830 | int idx = 0; | ||
831 | |||
832 | if (acpi_disabled) | ||
833 | return -ENODEV; | ||
834 | |||
835 | for (; plat->oem_id[0]; plat++, idx++) { | ||
836 | if (ACPI_FAILURE(acpi_get_table_header(plat->table, 0, &hdr))) | ||
837 | continue; | ||
838 | |||
839 | if (strncmp(plat->oem_id, hdr.oem_id, ACPI_OEM_ID_SIZE)) | ||
840 | continue; | ||
841 | |||
842 | if (strncmp(plat->oem_table_id, hdr.oem_table_id, ACPI_OEM_TABLE_ID_SIZE)) | ||
843 | continue; | ||
844 | |||
845 | if ((plat->pred == all_versions) || | ||
846 | (plat->pred == less_than_or_equal && hdr.oem_revision <= plat->oem_revision) || | ||
847 | (plat->pred == greater_than_or_equal && hdr.oem_revision >= plat->oem_revision) || | ||
848 | (plat->pred == equal && hdr.oem_revision == plat->oem_revision)) | ||
849 | return idx; | ||
850 | } | ||
851 | |||
852 | return -ENODEV; | ||
853 | } | ||
854 | EXPORT_SYMBOL(acpi_match_platform_list); | ||