blob: 934d3b354dc7c9899a329cdcfed9dfa93dceede3 [file] [log] [blame]
Eric Biedermane9a271e32003-09-02 03:36:25 +00001#ifndef DEVICE_PATH_H
2#define DEVICE_PATH_H
3
Elyes HAOUASc4e41932018-11-01 11:29:50 +01004#include <stdint.h>
5
Eric Biedermane9a271e32003-09-02 03:36:25 +00006enum device_path_type {
7 DEVICE_PATH_NONE = 0,
Eric Biederman83b991a2003-10-11 06:20:25 +00008 DEVICE_PATH_ROOT,
Eric Biedermane9a271e32003-09-02 03:36:25 +00009 DEVICE_PATH_PCI,
10 DEVICE_PATH_PNP,
11 DEVICE_PATH_I2C,
Eric Biedermanb78c1972004-10-14 20:54:17 +000012 DEVICE_PATH_APIC,
Stefan Reinauer4aff4452013-02-12 14:17:15 -080013 DEVICE_PATH_DOMAIN,
Stefan Reinauer0aa37c42013-02-12 15:20:54 -080014 DEVICE_PATH_CPU_CLUSTER,
Eric Biedermana9e632c2004-11-18 22:38:08 +000015 DEVICE_PATH_CPU,
16 DEVICE_PATH_CPU_BUS,
Sven Schnelle0fa50a12012-06-21 22:19:48 +020017 DEVICE_PATH_IOAPIC,
Duncan Laurie4650f5b2016-05-07 20:01:34 -070018 DEVICE_PATH_GENERIC,
Furquan Shaikh7606c372017-02-11 10:57:23 -080019 DEVICE_PATH_SPI,
Duncan Lauriebae9f852018-05-07 14:18:13 -070020 DEVICE_PATH_USB,
Justin TerAvestca2ed9f2018-01-17 16:36:30 -080021 DEVICE_PATH_MMIO,
Michael Niewöhnerdbb667a2020-12-11 21:26:02 +010022 DEVICE_PATH_GPIO,
Lee Leahya95baf92016-02-13 06:10:04 -080023
24 /*
25 * When adding path types to this table, please also update the
26 * DEVICE_PATH_NAMES macro below.
27 */
Eric Biederman216525d2004-10-16 02:48:37 +000028};
29
Lee Leahya95baf92016-02-13 06:10:04 -080030#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 Laurie4650f5b2016-05-07 20:01:34 -070041 "DEVICE_PATH_IOAPIC", \
Furquan Shaikh7606c372017-02-11 10:57:23 -080042 "DEVICE_PATH_GENERIC", \
43 "DEVICE_PATH_SPI", \
Duncan Lauriebae9f852018-05-07 14:18:13 -070044 "DEVICE_PATH_USB", \
Justin TerAvestca2ed9f2018-01-17 16:36:30 -080045 "DEVICE_PATH_MMIO", \
Michael Niewöhnerdbb667a2020-12-11 21:26:02 +010046 "DEVICE_PATH_GPIO", \
Lee Leahya95baf92016-02-13 06:10:04 -080047}
48
Lee Leahy6625ecc2017-03-07 15:11:07 -080049struct domain_path {
Lee Leahy0ca2a062017-03-06 18:01:04 -080050 unsigned int domain;
Eric Biedermane9a271e32003-09-02 03:36:25 +000051};
52
Lee Leahy6625ecc2017-03-07 15:11:07 -080053struct pci_path {
Lee Leahy0ca2a062017-03-06 18:01:04 -080054 unsigned int devfn;
Eric Biedermane9a271e32003-09-02 03:36:25 +000055};
56
Lee Leahy6625ecc2017-03-07 15:11:07 -080057struct pnp_path {
Lee Leahy0ca2a062017-03-06 18:01:04 -080058 unsigned int port;
59 unsigned int device;
Eric Biedermane9a271e32003-09-02 03:36:25 +000060};
61
Lee Leahy6625ecc2017-03-07 15:11:07 -080062struct i2c_path {
Lee Leahy0ca2a062017-03-06 18:01:04 -080063 unsigned int device;
64 unsigned int mode_10bit;
Eric Biedermane9a271e32003-09-02 03:36:25 +000065};
66
Lee Leahy6625ecc2017-03-07 15:11:07 -080067struct spi_path {
Lee Leahy0ca2a062017-03-06 18:01:04 -080068 unsigned int cs;
Furquan Shaikh7606c372017-02-11 10:57:23 -080069};
70
Lee Leahy6625ecc2017-03-07 15:11:07 -080071struct apic_path {
Lee Leahy0ca2a062017-03-06 18:01:04 -080072 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 Biedermanb78c1972004-10-14 20:54:17 +000077};
78
Lee Leahy6625ecc2017-03-07 15:11:07 -080079struct ioapic_path {
Lee Leahy0ca2a062017-03-06 18:01:04 -080080 unsigned int ioapic_id;
Sven Schnelle0fa50a12012-06-21 22:19:48 +020081};
82
Lee Leahy6625ecc2017-03-07 15:11:07 -080083struct cpu_cluster_path {
Lee Leahy0ca2a062017-03-06 18:01:04 -080084 unsigned int cluster;
Eric Biederman216525d2004-10-16 02:48:37 +000085};
86
Lee Leahy6625ecc2017-03-07 15:11:07 -080087struct cpu_path {
Lee Leahy0ca2a062017-03-06 18:01:04 -080088 unsigned int id;
Eric Biedermana9e632c2004-11-18 22:38:08 +000089};
90
Lee Leahy6625ecc2017-03-07 15:11:07 -080091struct cpu_bus_path {
Lee Leahy0ca2a062017-03-06 18:01:04 -080092 unsigned int id;
Eric Biedermana9e632c2004-11-18 22:38:08 +000093};
94
Lee Leahy6625ecc2017-03-07 15:11:07 -080095struct generic_path {
Lee Leahy0ca2a062017-03-06 18:01:04 -080096 unsigned int id;
97 unsigned int subid;
Duncan Laurie4650f5b2016-05-07 20:01:34 -070098};
99
Duncan Lauriebae9f852018-05-07 14:18:13 -0700100struct usb_path {
101 unsigned int port_type;
102 unsigned int port_id;
103};
104
Justin TerAvestca2ed9f2018-01-17 16:36:30 -0800105struct mmio_path {
106 uintptr_t addr;
107};
Eric Biederman216525d2004-10-16 02:48:37 +0000108
Michael Niewöhnerdbb667a2020-12-11 21:26:02 +0100109struct gpio_path {
110 unsigned int id;
111};
112
Eric Biedermane9a271e32003-09-02 03:36:25 +0000113struct device_path {
114 enum device_path_type type;
115 union {
Stefan Reinauer0aa37c42013-02-12 15:20:54 -0800116 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 Laurie4650f5b2016-05-07 20:01:34 -0700125 struct generic_path generic;
Furquan Shaikh7606c372017-02-11 10:57:23 -0800126 struct spi_path spi;
Duncan Lauriebae9f852018-05-07 14:18:13 -0700127 struct usb_path usb;
Justin TerAvestca2ed9f2018-01-17 16:36:30 -0800128 struct mmio_path mmio;
Michael Niewöhnerdbb667a2020-12-11 21:26:02 +0100129 struct gpio_path gpio;
Stefan Reinauer2b34db82009-02-28 20:10:20 +0000130 };
Eric Biedermane9a271e32003-09-02 03:36:25 +0000131};
132
Furquan Shaikh550cd052020-07-16 15:48:39 -0700133#define DEVICE_PATH_MAX 40
Yinghai Lu13f1c2a2005-07-08 02:49:49 +0000134#define BUS_PATH_MAX (DEVICE_PATH_MAX+10)
Eric Biedermane9a271e32003-09-02 03:36:25 +0000135
Lee Leahya95baf92016-02-13 06:10:04 -0800136extern const char *dev_path_name(enum device_path_type type);
Eric Biedermane9a271e32003-09-02 03:36:25 +0000137
138#endif /* DEVICE_PATH_H */