blob: 9d7fb38d42b212ab9efa30bf31903a202d413604 [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,
Lee Leahya95baf92016-02-13 06:10:04 -080017
18 /*
19 * When adding path types to this table, please also update the
20 * DEVICE_PATH_NAMES macro below.
21 */
Eric Biederman216525d2004-10-16 02:48:37 +000022};
23
Lee Leahya95baf92016-02-13 06:10:04 -080024#define DEVICE_PATH_NAMES { \
25 "DEVICE_PATH_NONE", \
26 "DEVICE_PATH_ROOT", \
27 "DEVICE_PATH_PCI", \
28 "DEVICE_PATH_PNP", \
29 "DEVICE_PATH_I2C", \
30 "DEVICE_PATH_APIC", \
31 "DEVICE_PATH_DOMAIN", \
32 "DEVICE_PATH_CPU_CLUSTER", \
33 "DEVICE_PATH_CPU", \
34 "DEVICE_PATH_CPU_BUS", \
Duncan Laurie4650f5b2016-05-07 20:01:34 -070035 "DEVICE_PATH_IOAPIC", \
36 "DEVICE_PATH_GENERIC" \
Lee Leahya95baf92016-02-13 06:10:04 -080037}
38
Stefan Reinauer4aff4452013-02-12 14:17:15 -080039struct domain_path
Eric Biederman216525d2004-10-16 02:48:37 +000040{
41 unsigned domain;
Eric Biedermane9a271e32003-09-02 03:36:25 +000042};
43
44struct pci_path
45{
Eric Biedermane9a271e32003-09-02 03:36:25 +000046 unsigned devfn;
47};
48
49struct pnp_path
50{
51 unsigned port;
52 unsigned device;
53};
54
55struct i2c_path
56{
57 unsigned device;
Duncan Laurieb7ce5fe2016-05-07 19:49:37 -070058 unsigned mode_10bit;
Eric Biedermane9a271e32003-09-02 03:36:25 +000059};
60
Eric Biedermanb78c1972004-10-14 20:54:17 +000061struct apic_path
62{
63 unsigned apic_id;
Kyösti Mälkkic33f1e92012-08-07 17:12:11 +030064 unsigned package_id;
Stefan Reinauerf622d592005-11-26 16:56:05 +000065 unsigned node_id;
66 unsigned core_id;
Kyösti Mälkkic33f1e92012-08-07 17:12:11 +030067 unsigned thread_id;
Eric Biedermanb78c1972004-10-14 20:54:17 +000068};
69
Sven Schnelle0fa50a12012-06-21 22:19:48 +020070struct ioapic_path
71{
72 unsigned ioapic_id;
73};
74
Stefan Reinauer0aa37c42013-02-12 15:20:54 -080075struct cpu_cluster_path
Eric Biederman216525d2004-10-16 02:48:37 +000076{
77 unsigned cluster;
78};
79
Eric Biedermana9e632c2004-11-18 22:38:08 +000080struct cpu_path
81{
82 unsigned id;
83};
84
85struct cpu_bus_path
86{
87 unsigned id;
88};
89
Duncan Laurie4650f5b2016-05-07 20:01:34 -070090struct generic_path
91{
92 unsigned id;
93 unsigned subid;
94};
95
Eric Biederman216525d2004-10-16 02:48:37 +000096
Eric Biedermane9a271e32003-09-02 03:36:25 +000097struct device_path {
98 enum device_path_type type;
99 union {
Stefan Reinauer0aa37c42013-02-12 15:20:54 -0800100 struct pci_path pci;
101 struct pnp_path pnp;
102 struct i2c_path i2c;
103 struct apic_path apic;
104 struct ioapic_path ioapic;
105 struct domain_path domain;
106 struct cpu_cluster_path cpu_cluster;
107 struct cpu_path cpu;
108 struct cpu_bus_path cpu_bus;
Duncan Laurie4650f5b2016-05-07 20:01:34 -0700109 struct generic_path generic;
Stefan Reinauer2b34db82009-02-28 20:10:20 +0000110 };
Eric Biedermane9a271e32003-09-02 03:36:25 +0000111};
112
113
114#define DEVICE_PATH_MAX 30
Yinghai Lu13f1c2a2005-07-08 02:49:49 +0000115#define BUS_PATH_MAX (DEVICE_PATH_MAX+10)
Eric Biedermane9a271e32003-09-02 03:36:25 +0000116
117extern int path_eq(struct device_path *path1, struct device_path *path2);
Lee Leahya95baf92016-02-13 06:10:04 -0800118extern const char *dev_path_name(enum device_path_type type);
Eric Biedermane9a271e32003-09-02 03:36:25 +0000119
120#endif /* DEVICE_PATH_H */