1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _INTEL_PMT_CLASS_H 3 #define _INTEL_PMT_CLASS_H 4 5 #include <linux/xarray.h> 6 #include <linux/types.h> 7 #include <linux/bits.h> 8 #include <linux/err.h> 9 #include <linux/io.h> 10 11 #include "../vsec.h" 12 13 /* PMT access types */ 14 #define ACCESS_BARID 2 15 #define ACCESS_LOCAL 3 16 17 /* PMT discovery base address/offset register layout */ 18 #define GET_BIR(v) ((v) & GENMASK(2, 0)) 19 #define GET_ADDRESS(v) ((v) & GENMASK(31, 3)) 20 21 struct intel_pmt_entry { 22 struct bin_attribute pmt_bin_attr; 23 struct kobject *kobj; 24 void __iomem *disc_table; 25 void __iomem *base; 26 unsigned long base_addr; 27 size_t size; 28 u32 guid; 29 int devid; 30 }; 31 32 struct intel_pmt_header { 33 u32 base_offset; 34 u32 size; 35 u32 guid; 36 u8 access_type; 37 }; 38 39 struct intel_pmt_namespace { 40 const char *name; 41 struct xarray *xa; 42 const struct attribute_group *attr_grp; 43 int (*pmt_header_decode)(struct intel_pmt_entry *entry, 44 struct intel_pmt_header *header, 45 struct device *dev); 46 }; 47 48 bool intel_pmt_is_early_client_hw(struct device *dev); 49 int intel_pmt_dev_create(struct intel_pmt_entry *entry, 50 struct intel_pmt_namespace *ns, 51 struct intel_vsec_device *dev, int idx); 52 void intel_pmt_dev_destroy(struct intel_pmt_entry *entry, 53 struct intel_pmt_namespace *ns); 54 #endif 55