Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 1 | #ifndef DEVICE_PATH_H |
| 2 | #define DEVICE_PATH_H |
| 3 | |
| 4 | enum device_path_type { |
| 5 | DEVICE_PATH_NONE = 0, |
Eric Biederman | 83b991a | 2003-10-11 06:20:25 +0000 | [diff] [blame] | 6 | DEVICE_PATH_ROOT, |
Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 7 | DEVICE_PATH_PCI, |
| 8 | DEVICE_PATH_PNP, |
| 9 | DEVICE_PATH_I2C, |
Eric Biederman | b78c197 | 2004-10-14 20:54:17 +0000 | [diff] [blame] | 10 | DEVICE_PATH_APIC, |
Stefan Reinauer | 4aff445 | 2013-02-12 14:17:15 -0800 | [diff] [blame] | 11 | DEVICE_PATH_DOMAIN, |
Stefan Reinauer | 0aa37c4 | 2013-02-12 15:20:54 -0800 | [diff] [blame] | 12 | DEVICE_PATH_CPU_CLUSTER, |
Eric Biederman | a9e632c | 2004-11-18 22:38:08 +0000 | [diff] [blame] | 13 | DEVICE_PATH_CPU, |
| 14 | DEVICE_PATH_CPU_BUS, |
Sven Schnelle | 0fa50a1 | 2012-06-21 22:19:48 +0200 | [diff] [blame] | 15 | DEVICE_PATH_IOAPIC, |
Lee Leahy | a95baf9 | 2016-02-13 06:10:04 -0800 | [diff] [blame] | 16 | |
| 17 | /* |
| 18 | * When adding path types to this table, please also update the |
| 19 | * DEVICE_PATH_NAMES macro below. |
| 20 | */ |
Eric Biederman | 216525d | 2004-10-16 02:48:37 +0000 | [diff] [blame] | 21 | }; |
| 22 | |
Lee Leahy | a95baf9 | 2016-02-13 06:10:04 -0800 | [diff] [blame] | 23 | #define DEVICE_PATH_NAMES { \ |
| 24 | "DEVICE_PATH_NONE", \ |
| 25 | "DEVICE_PATH_ROOT", \ |
| 26 | "DEVICE_PATH_PCI", \ |
| 27 | "DEVICE_PATH_PNP", \ |
| 28 | "DEVICE_PATH_I2C", \ |
| 29 | "DEVICE_PATH_APIC", \ |
| 30 | "DEVICE_PATH_DOMAIN", \ |
| 31 | "DEVICE_PATH_CPU_CLUSTER", \ |
| 32 | "DEVICE_PATH_CPU", \ |
| 33 | "DEVICE_PATH_CPU_BUS", \ |
| 34 | "DEVICE_PATH_IOAPIC" \ |
| 35 | } |
| 36 | |
Stefan Reinauer | 4aff445 | 2013-02-12 14:17:15 -0800 | [diff] [blame] | 37 | struct domain_path |
Eric Biederman | 216525d | 2004-10-16 02:48:37 +0000 | [diff] [blame] | 38 | { |
| 39 | unsigned domain; |
Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 40 | }; |
| 41 | |
| 42 | struct pci_path |
| 43 | { |
Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 44 | unsigned devfn; |
| 45 | }; |
| 46 | |
| 47 | struct pnp_path |
| 48 | { |
| 49 | unsigned port; |
| 50 | unsigned device; |
| 51 | }; |
| 52 | |
| 53 | struct i2c_path |
| 54 | { |
| 55 | unsigned device; |
| 56 | }; |
| 57 | |
Eric Biederman | b78c197 | 2004-10-14 20:54:17 +0000 | [diff] [blame] | 58 | struct apic_path |
| 59 | { |
| 60 | unsigned apic_id; |
Kyösti Mälkki | c33f1e9 | 2012-08-07 17:12:11 +0300 | [diff] [blame] | 61 | unsigned package_id; |
Stefan Reinauer | f622d59 | 2005-11-26 16:56:05 +0000 | [diff] [blame] | 62 | unsigned node_id; |
| 63 | unsigned core_id; |
Kyösti Mälkki | c33f1e9 | 2012-08-07 17:12:11 +0300 | [diff] [blame] | 64 | unsigned thread_id; |
Eric Biederman | b78c197 | 2004-10-14 20:54:17 +0000 | [diff] [blame] | 65 | }; |
| 66 | |
Sven Schnelle | 0fa50a1 | 2012-06-21 22:19:48 +0200 | [diff] [blame] | 67 | struct ioapic_path |
| 68 | { |
| 69 | unsigned ioapic_id; |
| 70 | }; |
| 71 | |
Stefan Reinauer | 0aa37c4 | 2013-02-12 15:20:54 -0800 | [diff] [blame] | 72 | struct cpu_cluster_path |
Eric Biederman | 216525d | 2004-10-16 02:48:37 +0000 | [diff] [blame] | 73 | { |
| 74 | unsigned cluster; |
| 75 | }; |
| 76 | |
Eric Biederman | a9e632c | 2004-11-18 22:38:08 +0000 | [diff] [blame] | 77 | struct cpu_path |
| 78 | { |
| 79 | unsigned id; |
| 80 | }; |
| 81 | |
| 82 | struct cpu_bus_path |
| 83 | { |
| 84 | unsigned id; |
| 85 | }; |
| 86 | |
Eric Biederman | 216525d | 2004-10-16 02:48:37 +0000 | [diff] [blame] | 87 | |
Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 88 | struct device_path { |
| 89 | enum device_path_type type; |
| 90 | union { |
Stefan Reinauer | 0aa37c4 | 2013-02-12 15:20:54 -0800 | [diff] [blame] | 91 | struct pci_path pci; |
| 92 | struct pnp_path pnp; |
| 93 | struct i2c_path i2c; |
| 94 | struct apic_path apic; |
| 95 | struct ioapic_path ioapic; |
| 96 | struct domain_path domain; |
| 97 | struct cpu_cluster_path cpu_cluster; |
| 98 | struct cpu_path cpu; |
| 99 | struct cpu_bus_path cpu_bus; |
Stefan Reinauer | 2b34db8 | 2009-02-28 20:10:20 +0000 | [diff] [blame] | 100 | }; |
Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 101 | }; |
| 102 | |
| 103 | |
| 104 | #define DEVICE_PATH_MAX 30 |
Yinghai Lu | 13f1c2a | 2005-07-08 02:49:49 +0000 | [diff] [blame] | 105 | #define BUS_PATH_MAX (DEVICE_PATH_MAX+10) |
Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 106 | |
| 107 | extern int path_eq(struct device_path *path1, struct device_path *path2); |
Lee Leahy | a95baf9 | 2016-02-13 06:10:04 -0800 | [diff] [blame] | 108 | extern const char *dev_path_name(enum device_path_type type); |
Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 109 | |
| 110 | #endif /* DEVICE_PATH_H */ |