• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 	/* Platforms requiring quirk in the auxiliary driver */
25 	VSEC_QUIRK_EARLY_HW     = BIT(4),
26 };
27 
28 /* Platform specific data */
29 struct intel_vsec_platform_info {
30 	struct intel_vsec_header **capabilities;
31 	unsigned long quirks;
32 };
33 
34 struct intel_vsec_device {
35 	struct auxiliary_device auxdev;
36 	struct pci_dev *pcidev;
37 	struct resource *resource;
38 	struct ida *ida;
39 	struct intel_vsec_platform_info *info;
40 	int num_resources;
41 	int id; /* xa */
42 	void *priv_data;
43 	size_t priv_data_size;
44 };
45 
46 int intel_vsec_add_aux(struct pci_dev *pdev, struct device *parent,
47 		       struct intel_vsec_device *intel_vsec_dev,
48 		       const char *name);
49 
dev_to_ivdev(struct device * dev)50 static inline struct intel_vsec_device *dev_to_ivdev(struct device *dev)
51 {
52 	return container_of(dev, struct intel_vsec_device, auxdev.dev);
53 }
54 
auxdev_to_ivdev(struct auxiliary_device * auxdev)55 static inline struct intel_vsec_device *auxdev_to_ivdev(struct auxiliary_device *auxdev)
56 {
57 	return container_of(auxdev, struct intel_vsec_device, auxdev);
58 }
59 #endif
60