xref: /openbmc/linux/drivers/platform/x86/intel/vsec.h (revision 8271d397)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _VSEC_H
3 #define _VSEC_H
4 
5 #include <linux/auxiliary_bus.h>
6 #include <linux/bits.h>
7 
8 #define VSEC_CAP_TELEMETRY	BIT(0)
9 #define VSEC_CAP_WATCHER	BIT(1)
10 #define VSEC_CAP_CRASHLOG	BIT(2)
11 #define VSEC_CAP_SDSI		BIT(3)
12 #define VSEC_CAP_TPMI		BIT(4)
13 
14 struct pci_dev;
15 struct resource;
16 
17 enum intel_vsec_quirks {
18 	/* Watcher feature not supported */
19 	VSEC_QUIRK_NO_WATCHER	= BIT(0),
20 
21 	/* Crashlog feature not supported */
22 	VSEC_QUIRK_NO_CRASHLOG	= BIT(1),
23 
24 	/* Use shift instead of mask to read discovery table offset */
25 	VSEC_QUIRK_TABLE_SHIFT	= BIT(2),
26 
27 	/* DVSEC not present (provided in driver data) */
28 	VSEC_QUIRK_NO_DVSEC	= BIT(3),
29 
30 	/* Platforms requiring quirk in the auxiliary driver */
31 	VSEC_QUIRK_EARLY_HW     = BIT(4),
32 };
33 
34 /* Platform specific data */
35 struct intel_vsec_platform_info {
36 	struct intel_vsec_header **headers;
37 	unsigned long caps;
38 	unsigned long quirks;
39 };
40 
41 struct intel_vsec_device {
42 	struct auxiliary_device auxdev;
43 	struct pci_dev *pcidev;
44 	struct resource *resource;
45 	struct ida *ida;
46 	struct intel_vsec_platform_info *info;
47 	int num_resources;
48 	int id; /* xa */
49 	void *priv_data;
50 	size_t priv_data_size;
51 };
52 
53 int intel_vsec_add_aux(struct pci_dev *pdev, struct device *parent,
54 		       struct intel_vsec_device *intel_vsec_dev,
55 		       const char *name);
56 
dev_to_ivdev(struct device * dev)57 static inline struct intel_vsec_device *dev_to_ivdev(struct device *dev)
58 {
59 	return container_of(dev, struct intel_vsec_device, auxdev.dev);
60 }
61 
auxdev_to_ivdev(struct auxiliary_device * auxdev)62 static inline struct intel_vsec_device *auxdev_to_ivdev(struct auxiliary_device *auxdev)
63 {
64 	return container_of(auxdev, struct intel_vsec_device, auxdev);
65 }
66 #endif
67