diff options
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/mod/file2alias.c | 72 | ||||
| -rw-r--r-- | scripts/package/Makefile | 2 |
2 files changed, 73 insertions, 1 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index f936d1fa969d..363ab4666b17 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
| @@ -880,6 +880,74 @@ static int do_isapnp_entry(const char *filename, | |||
| 880 | return 1; | 880 | return 1; |
| 881 | } | 881 | } |
| 882 | 882 | ||
| 883 | /* | ||
| 884 | * Append a match expression for a single masked hex digit. | ||
| 885 | * outp points to a pointer to the character at which to append. | ||
| 886 | * *outp is updated on return to point just after the appended text, | ||
| 887 | * to facilitate further appending. | ||
| 888 | */ | ||
| 889 | static void append_nibble_mask(char **outp, | ||
| 890 | unsigned int nibble, unsigned int mask) | ||
| 891 | { | ||
| 892 | char *p = *outp; | ||
| 893 | unsigned int i; | ||
| 894 | |||
| 895 | switch (mask) { | ||
| 896 | case 0: | ||
| 897 | *p++ = '?'; | ||
| 898 | break; | ||
| 899 | |||
| 900 | case 0xf: | ||
| 901 | p += sprintf(p, "%X", nibble); | ||
| 902 | break; | ||
| 903 | |||
| 904 | default: | ||
| 905 | /* | ||
| 906 | * Dumbly emit a match pattern for all possible matching | ||
| 907 | * digits. This could be improved in some cases using ranges, | ||
| 908 | * but it has the advantage of being trivially correct, and is | ||
| 909 | * often optimal. | ||
| 910 | */ | ||
| 911 | *p++ = '['; | ||
| 912 | for (i = 0; i < 0x10; i++) | ||
| 913 | if ((i & mask) == nibble) | ||
| 914 | p += sprintf(p, "%X", i); | ||
| 915 | *p++ = ']'; | ||
| 916 | } | ||
| 917 | |||
| 918 | /* Ensure that the string remains NUL-terminated: */ | ||
| 919 | *p = '\0'; | ||
| 920 | |||
| 921 | /* Advance the caller's end-of-string pointer: */ | ||
| 922 | *outp = p; | ||
| 923 | } | ||
| 924 | |||
| 925 | /* | ||
| 926 | * looks like: "amba:dN" | ||
| 927 | * | ||
| 928 | * N is exactly 8 digits, where each is an upper-case hex digit, or | ||
| 929 | * a ? or [] pattern matching exactly one digit. | ||
| 930 | */ | ||
| 931 | static int do_amba_entry(const char *filename, | ||
| 932 | struct amba_id *id, char *alias) | ||
| 933 | { | ||
| 934 | unsigned int digit; | ||
| 935 | char *p = alias; | ||
| 936 | |||
| 937 | if ((id->id & id->mask) != id->id) | ||
| 938 | fatal("%s: Masked-off bit(s) of AMBA device ID are non-zero: " | ||
| 939 | "id=0x%08X, mask=0x%08X. Please fix this driver.\n", | ||
| 940 | filename, id->id, id->mask); | ||
| 941 | |||
| 942 | p += sprintf(alias, "amba:d"); | ||
| 943 | for (digit = 0; digit < 8; digit++) | ||
| 944 | append_nibble_mask(&p, | ||
| 945 | (id->id >> (4 * (7 - digit))) & 0xf, | ||
| 946 | (id->mask >> (4 * (7 - digit))) & 0xf); | ||
| 947 | |||
| 948 | return 1; | ||
| 949 | } | ||
| 950 | |||
| 883 | /* Ignore any prefix, eg. some architectures prepend _ */ | 951 | /* Ignore any prefix, eg. some architectures prepend _ */ |
| 884 | static inline int sym_is(const char *symbol, const char *name) | 952 | static inline int sym_is(const char *symbol, const char *name) |
| 885 | { | 953 | { |
| @@ -1047,6 +1115,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | |||
| 1047 | do_table(symval, sym->st_size, | 1115 | do_table(symval, sym->st_size, |
| 1048 | sizeof(struct isapnp_device_id), "isa", | 1116 | sizeof(struct isapnp_device_id), "isa", |
| 1049 | do_isapnp_entry, mod); | 1117 | do_isapnp_entry, mod); |
| 1118 | else if (sym_is(symname, "__mod_amba_device_table")) | ||
| 1119 | do_table(symval, sym->st_size, | ||
| 1120 | sizeof(struct amba_id), "amba", | ||
| 1121 | do_amba_entry, mod); | ||
| 1050 | free(zeros); | 1122 | free(zeros); |
| 1051 | } | 1123 | } |
| 1052 | 1124 | ||
diff --git a/scripts/package/Makefile b/scripts/package/Makefile index bc6aa003860e..87bf08076b11 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile | |||
| @@ -141,7 +141,7 @@ perf-%pkg: FORCE | |||
| 141 | help: FORCE | 141 | help: FORCE |
| 142 | @echo ' rpm-pkg - Build both source and binary RPM kernel packages' | 142 | @echo ' rpm-pkg - Build both source and binary RPM kernel packages' |
| 143 | @echo ' binrpm-pkg - Build only the binary kernel package' | 143 | @echo ' binrpm-pkg - Build only the binary kernel package' |
| 144 | @echo ' deb-pkg - Build the kernel as an deb package' | 144 | @echo ' deb-pkg - Build the kernel as a deb package' |
| 145 | @echo ' tar-pkg - Build the kernel as an uncompressed tarball' | 145 | @echo ' tar-pkg - Build the kernel as an uncompressed tarball' |
| 146 | @echo ' targz-pkg - Build the kernel as a gzip compressed tarball' | 146 | @echo ' targz-pkg - Build the kernel as a gzip compressed tarball' |
| 147 | @echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball' | 147 | @echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball' |
