Loading...
Note: File does not exist in v3.1.
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _INTEL_PMT_CLASS_H
3#define _INTEL_PMT_CLASS_H
4
5#include <linux/intel_vsec.h>
6#include <linux/xarray.h>
7#include <linux/types.h>
8#include <linux/bits.h>
9#include <linux/err.h>
10#include <linux/io.h>
11
12#include "telemetry.h"
13
14/* PMT access types */
15#define ACCESS_BARID 2
16#define ACCESS_LOCAL 3
17
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))
21
22struct pci_dev;
23
24struct telem_endpoint {
25 struct pci_dev *pcidev;
26 struct telem_header header;
27 struct pmt_callbacks *cb;
28 void __iomem *base;
29 bool present;
30 struct kref kref;
31};
32
33struct intel_pmt_header {
34 u32 base_offset;
35 u32 size;
36 u32 guid;
37 u8 access_type;
38};
39
40struct intel_pmt_entry {
41 struct telem_endpoint *ep;
42 struct intel_pmt_header header;
43 struct bin_attribute pmt_bin_attr;
44 struct kobject *kobj;
45 void __iomem *disc_table;
46 void __iomem *base;
47 struct pmt_callbacks *cb;
48 unsigned long base_addr;
49 size_t size;
50 u32 guid;
51 int devid;
52};
53
54struct intel_pmt_namespace {
55 const char *name;
56 struct xarray *xa;
57 const struct attribute_group *attr_grp;
58 int (*pmt_header_decode)(struct intel_pmt_entry *entry,
59 struct device *dev);
60 int (*pmt_add_endpoint)(struct intel_vsec_device *ivdev,
61 struct intel_pmt_entry *entry);
62};
63
64int 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);
66bool intel_pmt_is_early_client_hw(struct device *dev);
67int intel_pmt_dev_create(struct intel_pmt_entry *entry,
68 struct intel_pmt_namespace *ns,
69 struct intel_vsec_device *dev, int idx);
70void intel_pmt_dev_destroy(struct intel_pmt_entry *entry,
71 struct intel_pmt_namespace *ns);
72#endif