aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod/file2alias.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/mod/file2alias.c')
-rw-r--r--scripts/mod/file2alias.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 78691d51a479..84c86f3cd6cd 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -34,6 +34,9 @@ typedef Elf64_Addr kernel_ulong_t;
34typedef uint32_t __u32; 34typedef uint32_t __u32;
35typedef uint16_t __u16; 35typedef uint16_t __u16;
36typedef unsigned char __u8; 36typedef unsigned char __u8;
37typedef struct {
38 __u8 b[16];
39} uuid_le;
37 40
38/* Big exception to the "don't include kernel headers into userspace, which 41/* Big exception to the "don't include kernel headers into userspace, which
39 * even potentially has different endianness and word sizes, since 42 * even potentially has different endianness and word sizes, since
@@ -131,6 +134,15 @@ static inline void add_wildcard(char *str)
131 strcat(str + len, "*"); 134 strcat(str + len, "*");
132} 135}
133 136
137static inline void add_uuid(char *str, uuid_le uuid)
138{
139 int len = strlen(str);
140 int i;
141
142 for (i = 0; i < 16; i++)
143 sprintf(str + len + (i << 1), "%02x", uuid.b[i]);
144}
145
134/** 146/**
135 * Check that sizeof(device_id type) are consistent with size of section 147 * Check that sizeof(device_id type) are consistent with size of section
136 * in .o file. If in-consistent then userspace and kernel does not agree 148 * in .o file. If in-consistent then userspace and kernel does not agree
@@ -1160,13 +1172,18 @@ static int do_cpu_entry(const char *filename, void *symval, char *alias)
1160} 1172}
1161ADD_TO_DEVTABLE("cpu", cpu_feature, do_cpu_entry); 1173ADD_TO_DEVTABLE("cpu", cpu_feature, do_cpu_entry);
1162 1174
1163/* Looks like: mei:S */ 1175/* Looks like: mei:S:uuid */
1164static int do_mei_entry(const char *filename, void *symval, 1176static int do_mei_entry(const char *filename, void *symval,
1165 char *alias) 1177 char *alias)
1166{ 1178{
1167 DEF_FIELD_ADDR(symval, mei_cl_device_id, name); 1179 DEF_FIELD_ADDR(symval, mei_cl_device_id, name);
1180 DEF_FIELD_ADDR(symval, mei_cl_device_id, uuid);
1181
1182 sprintf(alias, MEI_CL_MODULE_PREFIX);
1183 sprintf(alias + strlen(alias), "%s:", (*name)[0] ? *name : "*");
1184 add_uuid(alias, *uuid);
1168 1185
1169 sprintf(alias, MEI_CL_MODULE_PREFIX "%s", *name); 1186 strcat(alias, ":*");
1170 1187
1171 return 1; 1188 return 1;
1172} 1189}
@@ -1192,6 +1209,19 @@ static int do_rio_entry(const char *filename,
1192} 1209}
1193ADD_TO_DEVTABLE("rapidio", rio_device_id, do_rio_entry); 1210ADD_TO_DEVTABLE("rapidio", rio_device_id, do_rio_entry);
1194 1211
1212/* Looks like: ulpi:vNpN */
1213static int do_ulpi_entry(const char *filename, void *symval,
1214 char *alias)
1215{
1216 DEF_FIELD(symval, ulpi_device_id, vendor);
1217 DEF_FIELD(symval, ulpi_device_id, product);
1218
1219 sprintf(alias, "ulpi:v%04xp%04x", vendor, product);
1220
1221 return 1;
1222}
1223ADD_TO_DEVTABLE("ulpi", ulpi_device_id, do_ulpi_entry);
1224
1195/* Does namelen bytes of name exactly match the symbol? */ 1225/* Does namelen bytes of name exactly match the symbol? */
1196static bool sym_is(const char *name, unsigned namelen, const char *symbol) 1226static bool sym_is(const char *name, unsigned namelen, const char *symbol)
1197{ 1227{