1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _INTEL_PMT_CLASS_H
3 #define _INTEL_PMT_CLASS_H
5 #include <linux/intel_vsec.h>
6 #include <linux/xarray.h>
7 #include <linux/types.h>
8 #include <linux/bits.h>
12 #include "telemetry.h"
14 /* PMT access types */
15 #define ACCESS_BARID 2
16 #define ACCESS_LOCAL 3
18 /* PMT discovery base address/offset register layout */
19 #define GET_BIR(v) ((v) & GENMASK(2, 0))
20 #define GET_ADDRESS(v) ((v) & GENMASK(31, 3))
24 struct telem_endpoint
{
25 struct pci_dev
*pcidev
;
26 struct telem_header header
;
27 struct pmt_callbacks
*cb
;
33 struct intel_pmt_header
{
40 struct intel_pmt_entry
{
41 struct telem_endpoint
*ep
;
42 struct intel_pmt_header header
;
43 struct bin_attribute pmt_bin_attr
;
45 void __iomem
*disc_table
;
47 struct pmt_callbacks
*cb
;
48 unsigned long base_addr
;
54 struct intel_pmt_namespace
{
57 const struct attribute_group
*attr_grp
;
58 int (*pmt_header_decode
)(struct intel_pmt_entry
*entry
,
60 int (*pmt_add_endpoint
)(struct intel_vsec_device
*ivdev
,
61 struct intel_pmt_entry
*entry
);
64 int pmt_telem_read_mmio(struct pci_dev
*pdev
, struct pmt_callbacks
*cb
, u32 guid
, void *buf
,
65 void __iomem
*addr
, loff_t off
, u32 count
);
66 bool intel_pmt_is_early_client_hw(struct device
*dev
);
67 int intel_pmt_dev_create(struct intel_pmt_entry
*entry
,
68 struct intel_pmt_namespace
*ns
,
69 struct intel_vsec_device
*dev
, int idx
);
70 void intel_pmt_dev_destroy(struct intel_pmt_entry
*entry
,
71 struct intel_pmt_namespace
*ns
);