0001
0002 #ifndef _INTEL_PMT_CLASS_H
0003 #define _INTEL_PMT_CLASS_H
0004
0005 #include <linux/xarray.h>
0006 #include <linux/types.h>
0007 #include <linux/bits.h>
0008 #include <linux/err.h>
0009 #include <linux/io.h>
0010
0011 #include "../vsec.h"
0012
0013
0014 #define ACCESS_BARID 2
0015 #define ACCESS_LOCAL 3
0016
0017
0018 #define GET_BIR(v) ((v) & GENMASK(2, 0))
0019 #define GET_ADDRESS(v) ((v) & GENMASK(31, 3))
0020
0021 struct intel_pmt_entry {
0022 struct bin_attribute pmt_bin_attr;
0023 struct kobject *kobj;
0024 void __iomem *disc_table;
0025 void __iomem *base;
0026 unsigned long base_addr;
0027 size_t size;
0028 u32 guid;
0029 int devid;
0030 };
0031
0032 struct intel_pmt_header {
0033 u32 base_offset;
0034 u32 size;
0035 u32 guid;
0036 u8 access_type;
0037 };
0038
0039 struct intel_pmt_namespace {
0040 const char *name;
0041 struct xarray *xa;
0042 const struct attribute_group *attr_grp;
0043 int (*pmt_header_decode)(struct intel_pmt_entry *entry,
0044 struct intel_pmt_header *header,
0045 struct device *dev);
0046 };
0047
0048 bool intel_pmt_is_early_client_hw(struct device *dev);
0049 int intel_pmt_dev_create(struct intel_pmt_entry *entry,
0050 struct intel_pmt_namespace *ns,
0051 struct intel_vsec_device *dev, int idx);
0052 void intel_pmt_dev_destroy(struct intel_pmt_entry *entry,
0053 struct intel_pmt_namespace *ns);
0054 #endif