xref: /openbmc/linux/drivers/platform/x86/intel/vsec.h (revision b625fe69)
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 struct pci_dev;
9 struct resource;
10 
11 enum intel_vsec_quirks {
12 	/* Watcher feature not supported */
13 	VSEC_QUIRK_NO_WATCHER	= BIT(0),
14 
15 	/* Crashlog feature not supported */
16 	VSEC_QUIRK_NO_CRASHLOG	= BIT(1),
17 
18 	/* Use shift instead of mask to read discovery table offset */
19 	VSEC_QUIRK_TABLE_SHIFT	= BIT(2),
20 
21 	/* DVSEC not present (provided in driver data) */
22 	VSEC_QUIRK_NO_DVSEC	= BIT(3),
23 };
24 
25 struct intel_vsec_device {
26 	struct auxiliary_device auxdev;
27 	struct pci_dev *pcidev;
28 	struct resource *resource;
29 	struct ida *ida;
30 	unsigned long quirks;
31 	int num_resources;
32 };
33 
34 static inline struct intel_vsec_device *dev_to_ivdev(struct device *dev)
35 {
36 	return container_of(dev, struct intel_vsec_device, auxdev.dev);
37 }
38 
39 static inline struct intel_vsec_device *auxdev_to_ivdev(struct auxiliary_device *auxdev)
40 {
41 	return container_of(auxdev, struct intel_vsec_device, auxdev);
42 }
43 #endif
44