diff options
author | Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> | 2023-02-02 02:07:37 +0100 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2023-02-06 13:47:40 +0100 |
commit | 6d957f1e1646039f51fe1f6c6060738f648c4c70 (patch) | |
tree | 6c515aeb7e27754108824b327358d295df30d74c /drivers/platform | |
parent | platform/x86/intel/tpmi: Process CPU package mapping (diff) | |
download | linux-6d957f1e1646039f51fe1f6c6060738f648c4c70.tar.xz linux-6d957f1e1646039f51fe1f6c6060738f648c4c70.zip |
platform/x86/intel/tpmi: ADD tpmi external interface for tpmi feature drivers
Add interface to get resources and platform data. This will avoid code
duplication. These interfaces includes:
- Get resource count
- Get resource at an index
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://lore.kernel.org/r/20230202010738.2186174-7-srinivas.pandruvada@linux.intel.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/intel/tpmi.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/platform/x86/intel/tpmi.c b/drivers/platform/x86/intel/tpmi.c index e612da579b29..c60733261c89 100644 --- a/drivers/platform/x86/intel/tpmi.c +++ b/drivers/platform/x86/intel/tpmi.c @@ -153,6 +153,28 @@ struct intel_tpmi_plat_info *tpmi_get_platform_data(struct auxiliary_device *aux } EXPORT_SYMBOL_NS_GPL(tpmi_get_platform_data, INTEL_TPMI); +int tpmi_get_resource_count(struct auxiliary_device *auxdev) +{ + struct intel_vsec_device *vsec_dev = auxdev_to_ivdev(auxdev); + + if (vsec_dev) + return vsec_dev->num_resources; + + return 0; +} +EXPORT_SYMBOL_NS_GPL(tpmi_get_resource_count, INTEL_TPMI); + +struct resource *tpmi_get_resource_at_index(struct auxiliary_device *auxdev, int index) +{ + struct intel_vsec_device *vsec_dev = auxdev_to_ivdev(auxdev); + + if (vsec_dev && index < vsec_dev->num_resources) + return &vsec_dev->resource[index]; + + return NULL; +} +EXPORT_SYMBOL_NS_GPL(tpmi_get_resource_at_index, INTEL_TPMI); + static const char *intel_tpmi_name(enum intel_tpmi_id id) { switch (id) { |