blob: 1eaa32fb578e104a9d96ac322dd2951001dd6fc9 [file] [log] [blame]
Eric Biedermane9a271e32003-09-02 03:36:25 +00001#ifndef DEVICE_PATH_H
2#define DEVICE_PATH_H
3
4enum device_path_type {
5 DEVICE_PATH_NONE = 0,
Eric Biederman83b991a2003-10-11 06:20:25 +00006 DEVICE_PATH_ROOT,
Eric Biedermane9a271e32003-09-02 03:36:25 +00007 DEVICE_PATH_PCI,
8 DEVICE_PATH_PNP,
9 DEVICE_PATH_I2C,
Eric Biedermanb78c1972004-10-14 20:54:17 +000010 DEVICE_PATH_APIC,
Stefan Reinauer4aff4452013-02-12 14:17:15 -080011 DEVICE_PATH_DOMAIN,
Stefan Reinauer0aa37c42013-02-12 15:20:54 -080012 DEVICE_PATH_CPU_CLUSTER,
Eric Biedermana9e632c2004-11-18 22:38:08 +000013 DEVICE_PATH_CPU,
14 DEVICE_PATH_CPU_BUS,
Sven Schnelle0fa50a12012-06-21 22:19:48 +020015 DEVICE_PATH_IOAPIC,
Duncan Laurie4650f5b2016-05-07 20:01:34 -070016 DEVICE_PATH_GENERIC,
Furquan Shaikh7606c372017-02-11 10:57:23 -080017 DEVICE_PATH_SPI,
Lee Leahya95baf92016-02-13 06:10:04 -080018
19 /*
20 * When adding path types to this table, please also update the
21 * DEVICE_PATH_NAMES macro below.
22 */
Eric Biederman216525d2004-10-16 02:48:37 +000023};
24
Lee Leahya95baf92016-02-13 06:10:04 -080025#define DEVICE_PATH_NAMES { \
26 "DEVICE_PATH_NONE", \
27 "DEVICE_PATH_ROOT", \
28 "DEVICE_PATH_PCI", \
29 "DEVICE_PATH_PNP", \
30 "DEVICE_PATH_I2C", \
31 "DEVICE_PATH_APIC", \
32 "DEVICE_PATH_DOMAIN", \
33 "DEVICE_PATH_CPU_CLUSTER", \
34 "DEVICE_PATH_CPU", \
35 "DEVICE_PATH_CPU_BUS", \
Duncan Laurie4650f5b2016-05-07 20:01:34 -070036 "DEVICE_PATH_IOAPIC", \
Furquan Shaikh7606c372017-02-11 10:57:23 -080037 "DEVICE_PATH_GENERIC", \
38 "DEVICE_PATH_SPI", \
Lee Leahya95baf92016-02-13 06:10:04 -080039}
40
Stefan Reinauer4aff4452013-02-12 14:17:15 -080041struct domain_path
Eric Biederman216525d2004-10-16 02:48:37 +000042{
Lee Leahy0ca2a062017-03-06 18:01:04 -080043 unsigned int domain;
Eric Biedermane9a271e32003-09-02 03:36:25 +000044};
45
46struct pci_path
47{
Lee Leahy0ca2a062017-03-06 18:01:04 -080048 unsigned int devfn;
Eric Biedermane9a271e32003-09-02 03:36:25 +000049};
50
51struct pnp_path
52{
Lee Leahy0ca2a062017-03-06 18:01:04 -080053 unsigned int port;
54 unsigned int device;
Eric Biedermane9a271e32003-09-02 03:36:25 +000055};
56
57struct i2c_path
58{
Lee Leahy0ca2a062017-03-06 18:01:04 -080059 unsigned int device;
60 unsigned int mode_10bit;
Eric Biedermane9a271e32003-09-02 03:36:25 +000061};
62
Furquan Shaikh7606c372017-02-11 10:57:23 -080063struct spi_path
64{
Lee Leahy0ca2a062017-03-06 18:01:04 -080065 unsigned int cs;
Furquan Shaikh7606c372017-02-11 10:57:23 -080066};
67
Eric Biedermanb78c1972004-10-14 20:54:17 +000068struct apic_path
69{
Lee Leahy0ca2a062017-03-06 18:01:04 -080070 unsigned int apic_id;
71 unsigned int package_id;
72 unsigned int node_id;
73 unsigned int core_id;
74 unsigned int thread_id;
Eric Biedermanb78c1972004-10-14 20:54:17 +000075};
76
Sven Schnelle0fa50a12012-06-21 22:19:48 +020077struct ioapic_path
78{
Lee Leahy0ca2a062017-03-06 18:01:04 -080079 unsigned int ioapic_id;
Sven Schnelle0fa50a12012-06-21 22:19:48 +020080};
81
Stefan Reinauer0aa37c42013-02-12 15:20:54 -080082struct cpu_cluster_path
Eric Biederman216525d2004-10-16 02:48:37 +000083{
Lee Leahy0ca2a062017-03-06 18:01:04 -080084 unsigned int cluster;
Eric Biederman216525d2004-10-16 02:48:37 +000085};
86
Eric Biedermana9e632c2004-11-18 22:38:08 +000087struct cpu_path
88{
Lee Leahy0ca2a062017-03-06 18:01:04 -080089 unsigned int id;
Eric Biedermana9e632c2004-11-18 22:38:08 +000090};
91
92struct cpu_bus_path
93{
Lee Leahy0ca2a062017-03-06 18:01:04 -080094 unsigned int id;
Eric Biedermana9e632c2004-11-18 22:38:08 +000095};
96
Duncan Laurie4650f5b2016-05-07 20:01:34 -070097struct generic_path
98{
Lee Leahy0ca2a062017-03-06 18:01:04 -080099 unsigned int id;
100 unsigned int subid;
Duncan Laurie4650f5b2016-05-07 20:01:34 -0700101};
102
Eric Biederman216525d2004-10-16 02:48:37 +0000103
Eric Biedermane9a271e32003-09-02 03:36:25 +0000104struct device_path {
105 enum device_path_type type;
106 union {
Stefan Reinauer0aa37c42013-02-12 15:20:54 -0800107 struct pci_path pci;
108 struct pnp_path pnp;
109 struct i2c_path i2c;
110 struct apic_path apic;
111 struct ioapic_path ioapic;
112 struct domain_path domain;
113 struct cpu_cluster_path cpu_cluster;
114 struct cpu_path cpu;
115 struct cpu_bus_path cpu_bus;
Duncan Laurie4650f5b2016-05-07 20:01:34 -0700116 struct generic_path generic;
Furquan Shaikh7606c372017-02-11 10:57:23 -0800117 struct spi_path spi;
Stefan Reinauer2b34db82009-02-28 20:10:20 +0000118 };
Eric Biedermane9a271e32003-09-02 03:36:25 +0000119};
120
121
122#define DEVICE_PATH_MAX 30
Yinghai Lu13f1c2a2005-07-08 02:49:49 +0000123#define BUS_PATH_MAX (DEVICE_PATH_MAX+10)
Eric Biedermane9a271e32003-09-02 03:36:25 +0000124
125extern int path_eq(struct device_path *path1, struct device_path *path2);
Lee Leahya95baf92016-02-13 06:10:04 -0800126extern const char *dev_path_name(enum device_path_type type);
Eric Biedermane9a271e32003-09-02 03:36:25 +0000127
128#endif /* DEVICE_PATH_H */