aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/mod')
-rw-r--r--scripts/mod/devicetable-offsets.c3
-rw-r--r--scripts/mod/file2alias.c28
2 files changed, 30 insertions, 1 deletions
diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c
index 160718383a71..054405b90ba4 100644
--- a/scripts/mod/devicetable-offsets.c
+++ b/scripts/mod/devicetable-offsets.c
@@ -228,5 +228,8 @@ int main(void)
228 DEVID(tee_client_device_id); 228 DEVID(tee_client_device_id);
229 DEVID_FIELD(tee_client_device_id, uuid); 229 DEVID_FIELD(tee_client_device_id, uuid);
230 230
231 DEVID(wmi_device_id);
232 DEVID_FIELD(wmi_device_id, guid_string);
233
231 return 0; 234 return 0;
232} 235}
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index d0e41723627f..e17a29ae2e97 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -40,6 +40,7 @@ typedef struct {
40typedef struct { 40typedef struct {
41 __u8 b[16]; 41 __u8 b[16];
42} uuid_t; 42} uuid_t;
43#define UUID_STRING_LEN 36
43 44
44/* Big exception to the "don't include kernel headers into userspace, which 45/* Big exception to the "don't include kernel headers into userspace, which
45 * even potentially has different endianness and word sizes, since 46 * even potentially has different endianness and word sizes, since
@@ -53,6 +54,9 @@ struct devtable {
53 int (*do_entry)(const char *filename, void *symval, char *alias); 54 int (*do_entry)(const char *filename, void *symval, char *alias);
54}; 55};
55 56
57/* Size of alias provided to do_entry functions */
58#define ALIAS_SIZE 500
59
56/* Define a variable f that holds the value of field f of struct devid 60/* Define a variable f that holds the value of field f of struct devid
57 * based at address m. 61 * based at address m.
58 */ 62 */
@@ -1305,6 +1309,27 @@ static int do_tee_entry(const char *filename, void *symval, char *alias)
1305 return 1; 1309 return 1;
1306} 1310}
1307 1311
1312/* Looks like: wmi:guid */
1313static int do_wmi_entry(const char *filename, void *symval, char *alias)
1314{
1315 int len;
1316 DEF_FIELD_ADDR(symval, wmi_device_id, guid_string);
1317
1318 if (strlen(*guid_string) != UUID_STRING_LEN) {
1319 warn("Invalid WMI device id 'wmi:%s' in '%s'\n",
1320 *guid_string, filename);
1321 return 0;
1322 }
1323
1324 len = snprintf(alias, ALIAS_SIZE, WMI_MODULE_PREFIX "%s", *guid_string);
1325 if (len < 0 || len >= ALIAS_SIZE) {
1326 warn("Could not generate all MODULE_ALIAS's in '%s'\n",
1327 filename);
1328 return 0;
1329 }
1330 return 1;
1331}
1332
1308/* Does namelen bytes of name exactly match the symbol? */ 1333/* Does namelen bytes of name exactly match the symbol? */
1309static bool sym_is(const char *name, unsigned namelen, const char *symbol) 1334static bool sym_is(const char *name, unsigned namelen, const char *symbol)
1310{ 1335{
@@ -1321,7 +1346,7 @@ static void do_table(void *symval, unsigned long size,
1321 struct module *mod) 1346 struct module *mod)
1322{ 1347{
1323 unsigned int i; 1348 unsigned int i;
1324 char alias[500]; 1349 char alias[ALIAS_SIZE];
1325 1350
1326 device_id_check(mod->name, device_id, size, id_size, symval); 1351 device_id_check(mod->name, device_id, size, id_size, symval);
1327 /* Leave last one: it's the terminator. */ 1352 /* Leave last one: it's the terminator. */
@@ -1376,6 +1401,7 @@ static const struct devtable devtable[] = {
1376 {"tbsvc", SIZE_tb_service_id, do_tbsvc_entry}, 1401 {"tbsvc", SIZE_tb_service_id, do_tbsvc_entry},
1377 {"typec", SIZE_typec_device_id, do_typec_entry}, 1402 {"typec", SIZE_typec_device_id, do_typec_entry},
1378 {"tee", SIZE_tee_client_device_id, do_tee_entry}, 1403 {"tee", SIZE_tee_client_device_id, do_tee_entry},
1404 {"wmi", SIZE_wmi_device_id, do_wmi_entry},
1379}; 1405};
1380 1406
1381/* Create MODULE_ALIAS() statements. 1407/* Create MODULE_ALIAS() statements.