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, |
Duncan Laurie | 4650f5b | 2016-05-07 20:01:34 -0700 | [diff] [blame] | 16 | DEVICE_PATH_GENERIC, |
Furquan Shaikh | 7606c37 | 2017-02-11 10:57:23 -0800 | [diff] [blame] | 17 | DEVICE_PATH_SPI, |
Lee Leahy | a95baf9 | 2016-02-13 06:10:04 -0800 | [diff] [blame] | 18 | |
| 19 | /* |
| 20 | * When adding path types to this table, please also update the |
| 21 | * DEVICE_PATH_NAMES macro below. |
| 22 | */ |
Eric Biederman | 216525d | 2004-10-16 02:48:37 +0000 | [diff] [blame] | 23 | }; |
| 24 | |
Lee Leahy | a95baf9 | 2016-02-13 06:10:04 -0800 | [diff] [blame] | 25 | #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 Laurie | 4650f5b | 2016-05-07 20:01:34 -0700 | [diff] [blame] | 36 | "DEVICE_PATH_IOAPIC", \ |
Furquan Shaikh | 7606c37 | 2017-02-11 10:57:23 -0800 | [diff] [blame] | 37 | "DEVICE_PATH_GENERIC", \ |
| 38 | "DEVICE_PATH_SPI", \ |
Lee Leahy | a95baf9 | 2016-02-13 06:10:04 -0800 | [diff] [blame] | 39 | } |
| 40 | |
Stefan Reinauer | 4aff445 | 2013-02-12 14:17:15 -0800 | [diff] [blame] | 41 | struct domain_path |
Eric Biederman | 216525d | 2004-10-16 02:48:37 +0000 | [diff] [blame] | 42 | { |
Lee Leahy | 0ca2a06 | 2017-03-06 18:01:04 -0800 | [diff] [blame^] | 43 | unsigned int domain; |
Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 44 | }; |
| 45 | |
| 46 | struct pci_path |
| 47 | { |
Lee Leahy | 0ca2a06 | 2017-03-06 18:01:04 -0800 | [diff] [blame^] | 48 | unsigned int devfn; |
Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 49 | }; |
| 50 | |
| 51 | struct pnp_path |
| 52 | { |
Lee Leahy | 0ca2a06 | 2017-03-06 18:01:04 -0800 | [diff] [blame^] | 53 | unsigned int port; |
| 54 | unsigned int device; |
Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 55 | }; |
| 56 | |
| 57 | struct i2c_path |
| 58 | { |
Lee Leahy | 0ca2a06 | 2017-03-06 18:01:04 -0800 | [diff] [blame^] | 59 | unsigned int device; |
| 60 | unsigned int mode_10bit; |
Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 61 | }; |
| 62 | |
Furquan Shaikh | 7606c37 | 2017-02-11 10:57:23 -0800 | [diff] [blame] | 63 | struct spi_path |
| 64 | { |
Lee Leahy | 0ca2a06 | 2017-03-06 18:01:04 -0800 | [diff] [blame^] | 65 | unsigned int cs; |
Furquan Shaikh | 7606c37 | 2017-02-11 10:57:23 -0800 | [diff] [blame] | 66 | }; |
| 67 | |
Eric Biederman | b78c197 | 2004-10-14 20:54:17 +0000 | [diff] [blame] | 68 | struct apic_path |
| 69 | { |
Lee Leahy | 0ca2a06 | 2017-03-06 18:01:04 -0800 | [diff] [blame^] | 70 | 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 Biederman | b78c197 | 2004-10-14 20:54:17 +0000 | [diff] [blame] | 75 | }; |
| 76 | |
Sven Schnelle | 0fa50a1 | 2012-06-21 22:19:48 +0200 | [diff] [blame] | 77 | struct ioapic_path |
| 78 | { |
Lee Leahy | 0ca2a06 | 2017-03-06 18:01:04 -0800 | [diff] [blame^] | 79 | unsigned int ioapic_id; |
Sven Schnelle | 0fa50a1 | 2012-06-21 22:19:48 +0200 | [diff] [blame] | 80 | }; |
| 81 | |
Stefan Reinauer | 0aa37c4 | 2013-02-12 15:20:54 -0800 | [diff] [blame] | 82 | struct cpu_cluster_path |
Eric Biederman | 216525d | 2004-10-16 02:48:37 +0000 | [diff] [blame] | 83 | { |
Lee Leahy | 0ca2a06 | 2017-03-06 18:01:04 -0800 | [diff] [blame^] | 84 | unsigned int cluster; |
Eric Biederman | 216525d | 2004-10-16 02:48:37 +0000 | [diff] [blame] | 85 | }; |
| 86 | |
Eric Biederman | a9e632c | 2004-11-18 22:38:08 +0000 | [diff] [blame] | 87 | struct cpu_path |
| 88 | { |
Lee Leahy | 0ca2a06 | 2017-03-06 18:01:04 -0800 | [diff] [blame^] | 89 | unsigned int id; |
Eric Biederman | a9e632c | 2004-11-18 22:38:08 +0000 | [diff] [blame] | 90 | }; |
| 91 | |
| 92 | struct cpu_bus_path |
| 93 | { |
Lee Leahy | 0ca2a06 | 2017-03-06 18:01:04 -0800 | [diff] [blame^] | 94 | unsigned int id; |
Eric Biederman | a9e632c | 2004-11-18 22:38:08 +0000 | [diff] [blame] | 95 | }; |
| 96 | |
Duncan Laurie | 4650f5b | 2016-05-07 20:01:34 -0700 | [diff] [blame] | 97 | struct generic_path |
| 98 | { |
Lee Leahy | 0ca2a06 | 2017-03-06 18:01:04 -0800 | [diff] [blame^] | 99 | unsigned int id; |
| 100 | unsigned int subid; |
Duncan Laurie | 4650f5b | 2016-05-07 20:01:34 -0700 | [diff] [blame] | 101 | }; |
| 102 | |
Eric Biederman | 216525d | 2004-10-16 02:48:37 +0000 | [diff] [blame] | 103 | |
Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 104 | struct device_path { |
| 105 | enum device_path_type type; |
| 106 | union { |
Stefan Reinauer | 0aa37c4 | 2013-02-12 15:20:54 -0800 | [diff] [blame] | 107 | 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 Laurie | 4650f5b | 2016-05-07 20:01:34 -0700 | [diff] [blame] | 116 | struct generic_path generic; |
Furquan Shaikh | 7606c37 | 2017-02-11 10:57:23 -0800 | [diff] [blame] | 117 | struct spi_path spi; |
Stefan Reinauer | 2b34db8 | 2009-02-28 20:10:20 +0000 | [diff] [blame] | 118 | }; |
Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 119 | }; |
| 120 | |
| 121 | |
| 122 | #define DEVICE_PATH_MAX 30 |
Yinghai Lu | 13f1c2a | 2005-07-08 02:49:49 +0000 | [diff] [blame] | 123 | #define BUS_PATH_MAX (DEVICE_PATH_MAX+10) |
Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 124 | |
| 125 | extern int path_eq(struct device_path *path1, struct device_path *path2); |
Lee Leahy | a95baf9 | 2016-02-13 06:10:04 -0800 | [diff] [blame] | 126 | extern const char *dev_path_name(enum device_path_type type); |
Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 127 | |
| 128 | #endif /* DEVICE_PATH_H */ |