mirror of
https://github.com/torvalds/linux.git
synced 2024-12-04 18:13:04 +00:00
platform/x86/intel: tpmi: Remove hardcoded unit and offset
Use sizeof(u32) for TPMI entry size units. Also add a define for capability offset unit size. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Link: https://lore.kernel.org/r/20230617014447.2543592-1-srinivas.pandruvada@linux.intel.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
899c7b18ef
commit
95de91483c
@ -222,7 +222,7 @@ static int tpmi_create_device(struct intel_tpmi_info *tpmi_info,
|
|||||||
snprintf(feature_id_name, sizeof(feature_id_name), "tpmi-%s", name);
|
snprintf(feature_id_name, sizeof(feature_id_name), "tpmi-%s", name);
|
||||||
|
|
||||||
for (i = 0, tmp = res; i < pfs->pfs_header.num_entries; i++, tmp++) {
|
for (i = 0, tmp = res; i < pfs->pfs_header.num_entries; i++, tmp++) {
|
||||||
u64 entry_size_bytes = pfs->pfs_header.entry_size * 4;
|
u64 entry_size_bytes = pfs->pfs_header.entry_size * sizeof(u32);
|
||||||
|
|
||||||
tmp->start = pfs->vsec_offset + entry_size_bytes * i;
|
tmp->start = pfs->vsec_offset + entry_size_bytes * i;
|
||||||
tmp->end = tmp->start + entry_size_bytes - 1;
|
tmp->end = tmp->start + entry_size_bytes - 1;
|
||||||
@ -277,7 +277,7 @@ static int tpmi_process_info(struct intel_tpmi_info *tpmi_info,
|
|||||||
void __iomem *info_mem;
|
void __iomem *info_mem;
|
||||||
|
|
||||||
info_mem = ioremap(pfs->vsec_offset + TPMI_INFO_BUS_INFO_OFFSET,
|
info_mem = ioremap(pfs->vsec_offset + TPMI_INFO_BUS_INFO_OFFSET,
|
||||||
pfs->pfs_header.entry_size * 4 - TPMI_INFO_BUS_INFO_OFFSET);
|
pfs->pfs_header.entry_size * sizeof(u32) - TPMI_INFO_BUS_INFO_OFFSET);
|
||||||
if (!info_mem)
|
if (!info_mem)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
@ -308,6 +308,8 @@ static int tpmi_fetch_pfs_header(struct intel_tpmi_pm_feature *pfs, u64 start, i
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define TPMI_CAP_OFFSET_UNIT 1024
|
||||||
|
|
||||||
static int intel_vsec_tpmi_init(struct auxiliary_device *auxdev)
|
static int intel_vsec_tpmi_init(struct auxiliary_device *auxdev)
|
||||||
{
|
{
|
||||||
struct intel_vsec_device *vsec_dev = auxdev_to_ivdev(auxdev);
|
struct intel_vsec_device *vsec_dev = auxdev_to_ivdev(auxdev);
|
||||||
@ -354,7 +356,7 @@ static int intel_vsec_tpmi_init(struct auxiliary_device *auxdev)
|
|||||||
if (!pfs_start)
|
if (!pfs_start)
|
||||||
pfs_start = res_start;
|
pfs_start = res_start;
|
||||||
|
|
||||||
pfs->pfs_header.cap_offset *= 1024;
|
pfs->pfs_header.cap_offset *= TPMI_CAP_OFFSET_UNIT;
|
||||||
|
|
||||||
pfs->vsec_offset = pfs_start + pfs->pfs_header.cap_offset;
|
pfs->vsec_offset = pfs_start + pfs->pfs_header.cap_offset;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user