Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 1 | #ifndef DEVICE_PATH_H |
| 2 | #define DEVICE_PATH_H |
| 3 | |
Elyes HAOUAS | c4e4193 | 2018-11-01 11:29:50 +0100 | [diff] [blame] | 4 | #include <stdint.h> |
| 5 | |
Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 6 | enum device_path_type { |
| 7 | DEVICE_PATH_NONE = 0, |
Eric Biederman | 83b991a | 2003-10-11 06:20:25 +0000 | [diff] [blame] | 8 | DEVICE_PATH_ROOT, |
Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 9 | DEVICE_PATH_PCI, |
| 10 | DEVICE_PATH_PNP, |
| 11 | DEVICE_PATH_I2C, |
Eric Biederman | b78c197 | 2004-10-14 20:54:17 +0000 | [diff] [blame] | 12 | DEVICE_PATH_APIC, |
Stefan Reinauer | 4aff445 | 2013-02-12 14:17:15 -0800 | [diff] [blame] | 13 | DEVICE_PATH_DOMAIN, |
Stefan Reinauer | 0aa37c4 | 2013-02-12 15:20:54 -0800 | [diff] [blame] | 14 | DEVICE_PATH_CPU_CLUSTER, |
Eric Biederman | a9e632c | 2004-11-18 22:38:08 +0000 | [diff] [blame] | 15 | DEVICE_PATH_CPU, |
| 16 | DEVICE_PATH_CPU_BUS, |
Sven Schnelle | 0fa50a1 | 2012-06-21 22:19:48 +0200 | [diff] [blame] | 17 | DEVICE_PATH_IOAPIC, |
Duncan Laurie | 4650f5b | 2016-05-07 20:01:34 -0700 | [diff] [blame] | 18 | DEVICE_PATH_GENERIC, |
Furquan Shaikh | 7606c37 | 2017-02-11 10:57:23 -0800 | [diff] [blame] | 19 | DEVICE_PATH_SPI, |
Duncan Laurie | bae9f85 | 2018-05-07 14:18:13 -0700 | [diff] [blame] | 20 | DEVICE_PATH_USB, |
Justin TerAvest | ca2ed9f | 2018-01-17 16:36:30 -0800 | [diff] [blame] | 21 | DEVICE_PATH_MMIO, |
Michael Niewöhner | dbb667a | 2020-12-11 21:26:02 +0100 | [diff] [blame] | 22 | DEVICE_PATH_GPIO, |
Lee Leahy | a95baf9 | 2016-02-13 06:10:04 -0800 | [diff] [blame] | 23 | |
| 24 | /* |
| 25 | * When adding path types to this table, please also update the |
| 26 | * DEVICE_PATH_NAMES macro below. |
| 27 | */ |
Eric Biederman | 216525d | 2004-10-16 02:48:37 +0000 | [diff] [blame] | 28 | }; |
| 29 | |
Lee Leahy | a95baf9 | 2016-02-13 06:10:04 -0800 | [diff] [blame] | 30 | #define DEVICE_PATH_NAMES { \ |
| 31 | "DEVICE_PATH_NONE", \ |
| 32 | "DEVICE_PATH_ROOT", \ |
| 33 | "DEVICE_PATH_PCI", \ |
| 34 | "DEVICE_PATH_PNP", \ |
| 35 | "DEVICE_PATH_I2C", \ |
| 36 | "DEVICE_PATH_APIC", \ |
| 37 | "DEVICE_PATH_DOMAIN", \ |
| 38 | "DEVICE_PATH_CPU_CLUSTER", \ |
| 39 | "DEVICE_PATH_CPU", \ |
| 40 | "DEVICE_PATH_CPU_BUS", \ |
Duncan Laurie | 4650f5b | 2016-05-07 20:01:34 -0700 | [diff] [blame] | 41 | "DEVICE_PATH_IOAPIC", \ |
Furquan Shaikh | 7606c37 | 2017-02-11 10:57:23 -0800 | [diff] [blame] | 42 | "DEVICE_PATH_GENERIC", \ |
| 43 | "DEVICE_PATH_SPI", \ |
Duncan Laurie | bae9f85 | 2018-05-07 14:18:13 -0700 | [diff] [blame] | 44 | "DEVICE_PATH_USB", \ |
Justin TerAvest | ca2ed9f | 2018-01-17 16:36:30 -0800 | [diff] [blame] | 45 | "DEVICE_PATH_MMIO", \ |
Michael Niewöhner | dbb667a | 2020-12-11 21:26:02 +0100 | [diff] [blame] | 46 | "DEVICE_PATH_GPIO", \ |
Lee Leahy | a95baf9 | 2016-02-13 06:10:04 -0800 | [diff] [blame] | 47 | } |
| 48 | |
Lee Leahy | 6625ecc | 2017-03-07 15:11:07 -0800 | [diff] [blame] | 49 | struct domain_path { |
Lee Leahy | 0ca2a06 | 2017-03-06 18:01:04 -0800 | [diff] [blame] | 50 | unsigned int domain; |
Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 51 | }; |
| 52 | |
Lee Leahy | 6625ecc | 2017-03-07 15:11:07 -0800 | [diff] [blame] | 53 | struct pci_path { |
Lee Leahy | 0ca2a06 | 2017-03-06 18:01:04 -0800 | [diff] [blame] | 54 | unsigned int devfn; |
Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 55 | }; |
| 56 | |
Lee Leahy | 6625ecc | 2017-03-07 15:11:07 -0800 | [diff] [blame] | 57 | struct pnp_path { |
Lee Leahy | 0ca2a06 | 2017-03-06 18:01:04 -0800 | [diff] [blame] | 58 | unsigned int port; |
| 59 | unsigned int device; |
Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 60 | }; |
| 61 | |
Lee Leahy | 6625ecc | 2017-03-07 15:11:07 -0800 | [diff] [blame] | 62 | struct i2c_path { |
Lee Leahy | 0ca2a06 | 2017-03-06 18:01:04 -0800 | [diff] [blame] | 63 | unsigned int device; |
| 64 | unsigned int mode_10bit; |
Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 65 | }; |
| 66 | |
Lee Leahy | 6625ecc | 2017-03-07 15:11:07 -0800 | [diff] [blame] | 67 | struct spi_path { |
Lee Leahy | 0ca2a06 | 2017-03-06 18:01:04 -0800 | [diff] [blame] | 68 | unsigned int cs; |
Furquan Shaikh | 7606c37 | 2017-02-11 10:57:23 -0800 | [diff] [blame] | 69 | }; |
| 70 | |
Lee Leahy | 6625ecc | 2017-03-07 15:11:07 -0800 | [diff] [blame] | 71 | struct apic_path { |
Lee Leahy | 0ca2a06 | 2017-03-06 18:01:04 -0800 | [diff] [blame] | 72 | unsigned int apic_id; |
| 73 | unsigned int package_id; |
| 74 | unsigned int node_id; |
| 75 | unsigned int core_id; |
| 76 | unsigned int thread_id; |
Eric Biederman | b78c197 | 2004-10-14 20:54:17 +0000 | [diff] [blame] | 77 | }; |
| 78 | |
Lee Leahy | 6625ecc | 2017-03-07 15:11:07 -0800 | [diff] [blame] | 79 | struct ioapic_path { |
Lee Leahy | 0ca2a06 | 2017-03-06 18:01:04 -0800 | [diff] [blame] | 80 | unsigned int ioapic_id; |
Sven Schnelle | 0fa50a1 | 2012-06-21 22:19:48 +0200 | [diff] [blame] | 81 | }; |
| 82 | |
Lee Leahy | 6625ecc | 2017-03-07 15:11:07 -0800 | [diff] [blame] | 83 | struct cpu_cluster_path { |
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 | |
Lee Leahy | 6625ecc | 2017-03-07 15:11:07 -0800 | [diff] [blame] | 87 | struct cpu_path { |
Lee Leahy | 0ca2a06 | 2017-03-06 18:01:04 -0800 | [diff] [blame] | 88 | unsigned int id; |
Eric Biederman | a9e632c | 2004-11-18 22:38:08 +0000 | [diff] [blame] | 89 | }; |
| 90 | |
Lee Leahy | 6625ecc | 2017-03-07 15:11:07 -0800 | [diff] [blame] | 91 | struct cpu_bus_path { |
Lee Leahy | 0ca2a06 | 2017-03-06 18:01:04 -0800 | [diff] [blame] | 92 | unsigned int id; |
Eric Biederman | a9e632c | 2004-11-18 22:38:08 +0000 | [diff] [blame] | 93 | }; |
| 94 | |
Lee Leahy | 6625ecc | 2017-03-07 15:11:07 -0800 | [diff] [blame] | 95 | struct generic_path { |
Lee Leahy | 0ca2a06 | 2017-03-06 18:01:04 -0800 | [diff] [blame] | 96 | unsigned int id; |
| 97 | unsigned int subid; |
Duncan Laurie | 4650f5b | 2016-05-07 20:01:34 -0700 | [diff] [blame] | 98 | }; |
| 99 | |
Duncan Laurie | bae9f85 | 2018-05-07 14:18:13 -0700 | [diff] [blame] | 100 | struct usb_path { |
| 101 | unsigned int port_type; |
| 102 | unsigned int port_id; |
| 103 | }; |
| 104 | |
Justin TerAvest | ca2ed9f | 2018-01-17 16:36:30 -0800 | [diff] [blame] | 105 | struct mmio_path { |
| 106 | uintptr_t addr; |
| 107 | }; |
Eric Biederman | 216525d | 2004-10-16 02:48:37 +0000 | [diff] [blame] | 108 | |
Michael Niewöhner | dbb667a | 2020-12-11 21:26:02 +0100 | [diff] [blame] | 109 | struct gpio_path { |
| 110 | unsigned int id; |
| 111 | }; |
| 112 | |
Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 113 | struct device_path { |
| 114 | enum device_path_type type; |
| 115 | union { |
Stefan Reinauer | 0aa37c4 | 2013-02-12 15:20:54 -0800 | [diff] [blame] | 116 | struct pci_path pci; |
| 117 | struct pnp_path pnp; |
| 118 | struct i2c_path i2c; |
| 119 | struct apic_path apic; |
| 120 | struct ioapic_path ioapic; |
| 121 | struct domain_path domain; |
| 122 | struct cpu_cluster_path cpu_cluster; |
| 123 | struct cpu_path cpu; |
| 124 | struct cpu_bus_path cpu_bus; |
Duncan Laurie | 4650f5b | 2016-05-07 20:01:34 -0700 | [diff] [blame] | 125 | struct generic_path generic; |
Furquan Shaikh | 7606c37 | 2017-02-11 10:57:23 -0800 | [diff] [blame] | 126 | struct spi_path spi; |
Duncan Laurie | bae9f85 | 2018-05-07 14:18:13 -0700 | [diff] [blame] | 127 | struct usb_path usb; |
Justin TerAvest | ca2ed9f | 2018-01-17 16:36:30 -0800 | [diff] [blame] | 128 | struct mmio_path mmio; |
Michael Niewöhner | dbb667a | 2020-12-11 21:26:02 +0100 | [diff] [blame] | 129 | struct gpio_path gpio; |
Stefan Reinauer | 2b34db8 | 2009-02-28 20:10:20 +0000 | [diff] [blame] | 130 | }; |
Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 131 | }; |
| 132 | |
Furquan Shaikh | 550cd05 | 2020-07-16 15:48:39 -0700 | [diff] [blame] | 133 | #define DEVICE_PATH_MAX 40 |
Yinghai Lu | 13f1c2a | 2005-07-08 02:49:49 +0000 | [diff] [blame] | 134 | #define BUS_PATH_MAX (DEVICE_PATH_MAX+10) |
Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 135 | |
Lee Leahy | a95baf9 | 2016-02-13 06:10:04 -0800 | [diff] [blame] | 136 | extern const char *dev_path_name(enum device_path_type type); |
Eric Biederman | e9a271e3 | 2003-09-02 03:36:25 +0000 | [diff] [blame] | 137 | |
| 138 | #endif /* DEVICE_PATH_H */ |