diff options
author | Hoan Tran <hotran@apm.com> | 2017-06-22 14:26:03 -0400 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2017-06-22 14:30:09 -0400 |
commit | 838955e2a3c010aff9089fd705ae2cd5638cdee8 (patch) | |
tree | 7fc402d06f77dd1431e48995f55aea1197d590a8 | |
parent | bddb9b68d3fb0dfbd75715bce6160c40d4dae233 (diff) |
perf: xgene: Parse PMU subnode from the match table
This patch parses PMU Subnode from a match table.
Signed-off-by: Hoan Tran <hotran@apm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
-rw-r--r-- | drivers/perf/xgene_pmu.c | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/drivers/perf/xgene_pmu.c b/drivers/perf/xgene_pmu.c index 35b5289bc5da..5ffd58028a62 100644 --- a/drivers/perf/xgene_pmu.c +++ b/drivers/perf/xgene_pmu.c | |||
@@ -1047,9 +1047,35 @@ err: | |||
1047 | return NULL; | 1047 | return NULL; |
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | static const struct acpi_device_id xgene_pmu_acpi_type_match[] = { | ||
1051 | {"APMC0D5D", PMU_TYPE_L3C}, | ||
1052 | {"APMC0D5E", PMU_TYPE_IOB}, | ||
1053 | {"APMC0D5F", PMU_TYPE_MCB}, | ||
1054 | {"APMC0D60", PMU_TYPE_MC}, | ||
1055 | {}, | ||
1056 | }; | ||
1057 | |||
1058 | static const struct acpi_device_id *xgene_pmu_acpi_match_type( | ||
1059 | const struct acpi_device_id *ids, | ||
1060 | struct acpi_device *adev) | ||
1061 | { | ||
1062 | const struct acpi_device_id *match_id = NULL; | ||
1063 | const struct acpi_device_id *id; | ||
1064 | |||
1065 | for (id = ids; id->id[0] || id->cls; id++) { | ||
1066 | if (!acpi_match_device_ids(adev, id)) | ||
1067 | match_id = id; | ||
1068 | else if (match_id) | ||
1069 | break; | ||
1070 | } | ||
1071 | |||
1072 | return match_id; | ||
1073 | } | ||
1074 | |||
1050 | static acpi_status acpi_pmu_dev_add(acpi_handle handle, u32 level, | 1075 | static acpi_status acpi_pmu_dev_add(acpi_handle handle, u32 level, |
1051 | void *data, void **return_value) | 1076 | void *data, void **return_value) |
1052 | { | 1077 | { |
1078 | const struct acpi_device_id *acpi_id; | ||
1053 | struct xgene_pmu *xgene_pmu = data; | 1079 | struct xgene_pmu *xgene_pmu = data; |
1054 | struct xgene_pmu_dev_ctx *ctx; | 1080 | struct xgene_pmu_dev_ctx *ctx; |
1055 | struct acpi_device *adev; | 1081 | struct acpi_device *adev; |
@@ -1059,17 +1085,11 @@ static acpi_status acpi_pmu_dev_add(acpi_handle handle, u32 level, | |||
1059 | if (acpi_bus_get_status(adev) || !adev->status.present) | 1085 | if (acpi_bus_get_status(adev) || !adev->status.present) |
1060 | return AE_OK; | 1086 | return AE_OK; |
1061 | 1087 | ||
1062 | if (!strcmp(acpi_device_hid(adev), "APMC0D5D")) | 1088 | acpi_id = xgene_pmu_acpi_match_type(xgene_pmu_acpi_type_match, adev); |
1063 | ctx = acpi_get_pmu_hw_inf(xgene_pmu, adev, PMU_TYPE_L3C); | 1089 | if (!acpi_id) |
1064 | else if (!strcmp(acpi_device_hid(adev), "APMC0D5E")) | 1090 | return AE_OK; |
1065 | ctx = acpi_get_pmu_hw_inf(xgene_pmu, adev, PMU_TYPE_IOB); | ||
1066 | else if (!strcmp(acpi_device_hid(adev), "APMC0D5F")) | ||
1067 | ctx = acpi_get_pmu_hw_inf(xgene_pmu, adev, PMU_TYPE_MCB); | ||
1068 | else if (!strcmp(acpi_device_hid(adev), "APMC0D60")) | ||
1069 | ctx = acpi_get_pmu_hw_inf(xgene_pmu, adev, PMU_TYPE_MC); | ||
1070 | else | ||
1071 | ctx = NULL; | ||
1072 | 1091 | ||
1092 | ctx = acpi_get_pmu_hw_inf(xgene_pmu, adev, (u32)acpi_id->driver_data); | ||
1073 | if (!ctx) | 1093 | if (!ctx) |
1074 | return AE_OK; | 1094 | return AE_OK; |
1075 | 1095 | ||