aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod/file2alias.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2014-06-08 02:24:07 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2014-06-08 02:24:07 -0400
commita292241cccb7e20e8b997a9a44177e7c98141859 (patch)
treea0b0bb95e7dce3233a2d8b203f9e326cdec7a00e /scripts/mod/file2alias.c
parentd49cb7aeebb974713f9f7ab2991352d3050b095b (diff)
parent68807a0c2015cb40df4869e16651f0ce5cc14d52 (diff)
Merge branch 'next' into for-linus
Prepare input updates for 3.16.
Diffstat (limited to 'scripts/mod/file2alias.c')
-rw-r--r--scripts/mod/file2alias.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 25e5cb0aaef6..1924990a737f 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -42,7 +42,7 @@ typedef unsigned char __u8;
42 42
43/* This array collects all instances that use the generic do_table */ 43/* This array collects all instances that use the generic do_table */
44struct devtable { 44struct devtable {
45 const char *device_id; /* name of table, __mod_<name>_device_table. */ 45 const char *device_id; /* name of table, __mod_<name>__*_device_table. */
46 unsigned long id_size; 46 unsigned long id_size;
47 void *function; 47 void *function;
48}; 48};
@@ -146,7 +146,8 @@ static void device_id_check(const char *modname, const char *device_id,
146 146
147 if (size % id_size || size < id_size) { 147 if (size % id_size || size < id_size) {
148 fatal("%s: sizeof(struct %s_device_id)=%lu is not a modulo " 148 fatal("%s: sizeof(struct %s_device_id)=%lu is not a modulo "
149 "of the size of section __mod_%s_device_table=%lu.\n" 149 "of the size of "
150 "section __mod_%s__<identifier>_device_table=%lu.\n"
150 "Fix definition of struct %s_device_id " 151 "Fix definition of struct %s_device_id "
151 "in mod_devicetable.h\n", 152 "in mod_devicetable.h\n",
152 modname, device_id, id_size, device_id, size, device_id); 153 modname, device_id, id_size, device_id, size, device_id);
@@ -1110,7 +1111,7 @@ static int do_amba_entry(const char *filename,
1110} 1111}
1111ADD_TO_DEVTABLE("amba", amba_id, do_amba_entry); 1112ADD_TO_DEVTABLE("amba", amba_id, do_amba_entry);
1112 1113
1113/* LOOKS like x86cpu:vendor:VVVV:family:FFFF:model:MMMM:feature:*,FEAT,* 1114/* LOOKS like cpu:type:x86,venVVVVfamFFFFmodMMMM:feature:*,FEAT,*
1114 * All fields are numbers. It would be nicer to use strings for vendor 1115 * All fields are numbers. It would be nicer to use strings for vendor
1115 * and feature, but getting those out of the build system here is too 1116 * and feature, but getting those out of the build system here is too
1116 * complicated. 1117 * complicated.
@@ -1124,10 +1125,10 @@ static int do_x86cpu_entry(const char *filename, void *symval,
1124 DEF_FIELD(symval, x86_cpu_id, model); 1125 DEF_FIELD(symval, x86_cpu_id, model);
1125 DEF_FIELD(symval, x86_cpu_id, vendor); 1126 DEF_FIELD(symval, x86_cpu_id, vendor);
1126 1127
1127 strcpy(alias, "x86cpu:"); 1128 strcpy(alias, "cpu:type:x86,");
1128 ADD(alias, "vendor:", vendor != X86_VENDOR_ANY, vendor); 1129 ADD(alias, "ven", vendor != X86_VENDOR_ANY, vendor);
1129 ADD(alias, ":family:", family != X86_FAMILY_ANY, family); 1130 ADD(alias, "fam", family != X86_FAMILY_ANY, family);
1130 ADD(alias, ":model:", model != X86_MODEL_ANY, model); 1131 ADD(alias, "mod", model != X86_MODEL_ANY, model);
1131 strcat(alias, ":feature:*"); 1132 strcat(alias, ":feature:*");
1132 if (feature != X86_FEATURE_ANY) 1133 if (feature != X86_FEATURE_ANY)
1133 sprintf(alias + strlen(alias), "%04X*", feature); 1134 sprintf(alias + strlen(alias), "%04X*", feature);
@@ -1135,6 +1136,16 @@ static int do_x86cpu_entry(const char *filename, void *symval,
1135} 1136}
1136ADD_TO_DEVTABLE("x86cpu", x86_cpu_id, do_x86cpu_entry); 1137ADD_TO_DEVTABLE("x86cpu", x86_cpu_id, do_x86cpu_entry);
1137 1138
1139/* LOOKS like cpu:type:*:feature:*FEAT* */
1140static int do_cpu_entry(const char *filename, void *symval, char *alias)
1141{
1142 DEF_FIELD(symval, cpu_feature, feature);
1143
1144 sprintf(alias, "cpu:type:*:feature:*%04X*", feature);
1145 return 1;
1146}
1147ADD_TO_DEVTABLE("cpu", cpu_feature, do_cpu_entry);
1148
1138/* Looks like: mei:S */ 1149/* Looks like: mei:S */
1139static int do_mei_entry(const char *filename, void *symval, 1150static int do_mei_entry(const char *filename, void *symval,
1140 char *alias) 1151 char *alias)
@@ -1206,7 +1217,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
1206{ 1217{
1207 void *symval; 1218 void *symval;
1208 char *zeros = NULL; 1219 char *zeros = NULL;
1209 const char *name; 1220 const char *name, *identifier;
1210 unsigned int namelen; 1221 unsigned int namelen;
1211 1222
1212 /* We're looking for a section relative symbol */ 1223 /* We're looking for a section relative symbol */
@@ -1217,7 +1228,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
1217 if (ELF_ST_TYPE(sym->st_info) != STT_OBJECT) 1228 if (ELF_ST_TYPE(sym->st_info) != STT_OBJECT)
1218 return; 1229 return;
1219 1230
1220 /* All our symbols are of form <prefix>__mod_XXX_device_table. */ 1231 /* All our symbols are of form <prefix>__mod_<name>__<identifier>_device_table. */
1221 name = strstr(symname, "__mod_"); 1232 name = strstr(symname, "__mod_");
1222 if (!name) 1233 if (!name)
1223 return; 1234 return;
@@ -1227,7 +1238,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
1227 return; 1238 return;
1228 if (strcmp(name + namelen - strlen("_device_table"), "_device_table")) 1239 if (strcmp(name + namelen - strlen("_device_table"), "_device_table"))
1229 return; 1240 return;
1230 namelen -= strlen("_device_table"); 1241 identifier = strstr(name, "__");
1242 if (!identifier)
1243 return;
1244 namelen = identifier - name;
1231 1245
1232 /* Handle all-NULL symbols allocated into .bss */ 1246 /* Handle all-NULL symbols allocated into .bss */
1233 if (info->sechdrs[get_secindex(info, sym)].sh_type & SHT_NOBITS) { 1247 if (info->sechdrs[get_secindex(info, sym)].sh_type & SHT_NOBITS) {