| 1 |
|
| 2 |
|
| 3 |
#ifndef DEVICE_PATH_H |
| 4 |
#define DEVICE_PATH_H |
| 5 |
|
| 6 |
#include <stdint.h> |
| 7 |
|
| 8 |
enum device_path_type { |
| 9 |
DEVICE_PATH_NONE = 0, |
| 10 |
DEVICE_PATH_ROOT, |
| 11 |
DEVICE_PATH_PCI, |
| 12 |
DEVICE_PATH_PNP, |
| 13 |
DEVICE_PATH_I2C, |
| 14 |
DEVICE_PATH_APIC, |
| 15 |
DEVICE_PATH_DOMAIN, |
| 16 |
DEVICE_PATH_CPU_CLUSTER, |
| 17 |
DEVICE_PATH_CPU, |
| 18 |
DEVICE_PATH_CPU_BUS, |
| 19 |
DEVICE_PATH_IOAPIC, |
| 20 |
DEVICE_PATH_GENERIC, |
| 21 |
DEVICE_PATH_SPI, |
| 22 |
DEVICE_PATH_USB, |
| 23 |
DEVICE_PATH_MMIO, |
| 24 |
DEVICE_PATH_GPIO, |
| 25 |
DEVICE_PATH_MDIO, |
| 26 |
DEVICE_PATH_GICC_V3, |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
}; |
| 33 |
|
| 34 |
#define DEVICE_PATH_NAMES { \ |
| 35 |
"DEVICE_PATH_NONE", \ |
| 36 |
"DEVICE_PATH_ROOT", \ |
| 37 |
"DEVICE_PATH_PCI", \ |
| 38 |
"DEVICE_PATH_PNP", \ |
| 39 |
"DEVICE_PATH_I2C", \ |
| 40 |
"DEVICE_PATH_APIC", \ |
| 41 |
"DEVICE_PATH_DOMAIN", \ |
| 42 |
"DEVICE_PATH_CPU_CLUSTER", \ |
| 43 |
"DEVICE_PATH_CPU", \ |
| 44 |
"DEVICE_PATH_CPU_BUS", \ |
| 45 |
"DEVICE_PATH_IOAPIC", \ |
| 46 |
"DEVICE_PATH_GENERIC", \ |
| 47 |
"DEVICE_PATH_SPI", \ |
| 48 |
"DEVICE_PATH_USB", \ |
| 49 |
"DEVICE_PATH_MMIO", \ |
| 50 |
"DEVICE_PATH_GPIO", \ |
| 51 |
"DEVICE_PATH_MDIO", \ |
| 52 |
"DEVICE_PATH_GICC_V3", \ |
| 53 |
} |
| 54 |
|
| 55 |
struct domain_path { |
| 56 |
unsigned int domain_id; |
| 57 |
}; |
| 58 |
|
| 59 |
struct pci_path { |
| 60 |
unsigned int devfn; |
| 61 |
}; |
| 62 |
|
| 63 |
struct pnp_path { |
| 64 |
unsigned int port; |
| 65 |
unsigned int device; |
| 66 |
}; |
| 67 |
|
| 68 |
struct i2c_path { |
| 69 |
unsigned int device; |
| 70 |
unsigned int mode_10bit; |
| 71 |
}; |
| 72 |
|
| 73 |
struct spi_path { |
| 74 |
unsigned int cs; |
| 75 |
}; |
| 76 |
|
| 77 |
struct apic_path { |
| 78 |
unsigned int initial_lapicid; |
| 79 |
unsigned int apic_id; |
| 80 |
unsigned int package_id; |
| 81 |
unsigned int node_id; |
| 82 |
unsigned int core_id; |
| 83 |
unsigned int thread_id; |
| 84 |
unsigned int module_id; |
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
unsigned int core_id_within_package; |
| 90 |
unsigned char core_type; |
| 91 |
}; |
| 92 |
|
| 93 |
struct ioapic_path { |
| 94 |
uintptr_t addr; |
| 95 |
unsigned int ioapic_id; |
| 96 |
unsigned int gsi_base; |
| 97 |
}; |
| 98 |
|
| 99 |
struct cpu_cluster_path { |
| 100 |
unsigned int cluster; |
| 101 |
}; |
| 102 |
|
| 103 |
struct cpu_path { |
| 104 |
unsigned int id; |
| 105 |
}; |
| 106 |
|
| 107 |
struct cpu_bus_path { |
| 108 |
unsigned int id; |
| 109 |
}; |
| 110 |
|
| 111 |
struct generic_path { |
| 112 |
unsigned int id; |
| 113 |
unsigned int subid; |
| 114 |
}; |
| 115 |
|
| 116 |
struct usb_path { |
| 117 |
unsigned int port_type; |
| 118 |
unsigned int port_id; |
| 119 |
}; |
| 120 |
|
| 121 |
struct mmio_path { |
| 122 |
uintptr_t addr; |
| 123 |
}; |
| 124 |
|
| 125 |
struct gpio_path { |
| 126 |
unsigned int id; |
| 127 |
}; |
| 128 |
|
| 129 |
struct mdio_path { |
| 130 |
unsigned int addr; |
| 131 |
}; |
| 132 |
|
| 133 |
struct gicc_v3_path { |
| 134 |
unsigned long long mpidr; |
| 135 |
unsigned int vgic_mi; |
| 136 |
unsigned int pi_gsiv; |
| 137 |
}; |
| 138 |
|
| 139 |
struct device_path { |
| 140 |
enum device_path_type type; |
| 141 |
union { |
| 142 |
struct pci_path pci; |
| 143 |
struct pnp_path pnp; |
| 144 |
struct i2c_path i2c; |
| 145 |
struct apic_path apic; |
| 146 |
struct ioapic_path ioapic; |
| 147 |
struct domain_path domain; |
| 148 |
struct cpu_cluster_path cpu_cluster; |
| 149 |
struct cpu_path cpu; |
| 150 |
struct cpu_bus_path cpu_bus; |
| 151 |
struct generic_path generic; |
| 152 |
struct spi_path spi; |
| 153 |
struct usb_path usb; |
| 154 |
struct mmio_path mmio; |
| 155 |
struct gpio_path gpio; |
| 156 |
struct mdio_path mdio; |
| 157 |
struct gicc_v3_path gicc_v3; |
| 158 |
}; |
| 159 |
}; |
| 160 |
|
| 161 |
#define DEVICE_PATH_MAX 40 |
| 162 |
#define BUS_PATH_MAX (DEVICE_PATH_MAX+10) |
| 163 |
|
| 164 |
extern const char *dev_path_name(enum device_path_type type); |
| 165 |
|
| 166 |
#endif |