file2alias.c (9a95b9e7416c2e7fa799e54078a1adf84a7ed0bf) file2alias.c (644e9cbbe3fc032cc92d0936057e166a994dc246)
1/* Simple code to turn various tables in an ELF file into alias definitions.
2 * This deals with kernel datastructures where they should be
3 * dealt with: in the kernel source.
4 *
5 * Copyright 2002-2003 Rusty Russell, IBM Corporation
6 * 2003 Kai Germaschewski
7 *
8 *

--- 809 unchanged lines hidden (view full) ---

818 char *alias)
819{
820 sprintf(alias, SPI_MODULE_PREFIX "%s", id->name);
821
822 return 1;
823}
824ADD_TO_DEVTABLE("spi", struct spi_device_id, do_spi_entry);
825
1/* Simple code to turn various tables in an ELF file into alias definitions.
2 * This deals with kernel datastructures where they should be
3 * dealt with: in the kernel source.
4 *
5 * Copyright 2002-2003 Rusty Russell, IBM Corporation
6 * 2003 Kai Germaschewski
7 *
8 *

--- 809 unchanged lines hidden (view full) ---

818 char *alias)
819{
820 sprintf(alias, SPI_MODULE_PREFIX "%s", id->name);
821
822 return 1;
823}
824ADD_TO_DEVTABLE("spi", struct spi_device_id, do_spi_entry);
825
826/* Looks like: mcp:S */
827static int do_mcp_entry(const char *filename, struct mcp_device_id *id,
828 char *alias)
829{
830 sprintf(alias, MCP_MODULE_PREFIX "%s", id->name);
831
832 return 1;
833}
834ADD_TO_DEVTABLE("mcp", struct mcp_device_id, do_mcp_entry);
835
826static const struct dmifield {
827 const char *prefix;
828 int field;
829} dmi_fields[] = {
830 { "bvn", DMI_BIOS_VENDOR },
831 { "bvr", DMI_BIOS_VERSION },
832 { "bd", DMI_BIOS_DATE },
833 { "svn", DMI_SYS_VENDOR },

--- 164 unchanged lines hidden (view full) ---

998 append_nibble_mask(&p,
999 (id->id >> (4 * (7 - digit))) & 0xf,
1000 (id->mask >> (4 * (7 - digit))) & 0xf);
1001
1002 return 1;
1003}
1004ADD_TO_DEVTABLE("amba", struct amba_id, do_amba_entry);
1005
836static const struct dmifield {
837 const char *prefix;
838 int field;
839} dmi_fields[] = {
840 { "bvn", DMI_BIOS_VENDOR },
841 { "bvr", DMI_BIOS_VERSION },
842 { "bd", DMI_BIOS_DATE },
843 { "svn", DMI_SYS_VENDOR },

--- 164 unchanged lines hidden (view full) ---

1008 append_nibble_mask(&p,
1009 (id->id >> (4 * (7 - digit))) & 0xf,
1010 (id->mask >> (4 * (7 - digit))) & 0xf);
1011
1012 return 1;
1013}
1014ADD_TO_DEVTABLE("amba", struct amba_id, do_amba_entry);
1015
1016/* LOOKS like x86cpu:vendor:VVVV:family:FFFF:model:MMMM:feature:*,FEAT,*
1017 * All fields are numbers. It would be nicer to use strings for vendor
1018 * and feature, but getting those out of the build system here is too
1019 * complicated.
1020 */
1021
1022static int do_x86cpu_entry(const char *filename, struct x86_cpu_id *id,
1023 char *alias)
1024{
1025 id->feature = TO_NATIVE(id->feature);
1026 id->family = TO_NATIVE(id->family);
1027 id->model = TO_NATIVE(id->model);
1028 id->vendor = TO_NATIVE(id->vendor);
1029
1030 strcpy(alias, "x86cpu:");
1031 ADD(alias, "vendor:", id->vendor != X86_VENDOR_ANY, id->vendor);
1032 ADD(alias, ":family:", id->family != X86_FAMILY_ANY, id->family);
1033 ADD(alias, ":model:", id->model != X86_MODEL_ANY, id->model);
1034 ADD(alias, ":feature:*,", id->feature != X86_FEATURE_ANY, id->feature);
1035 strcat(alias, ",*");
1036 return 1;
1037}
1038ADD_TO_DEVTABLE("x86cpu", struct x86_cpu_id, do_x86cpu_entry);
1039
1006/* Does namelen bytes of name exactly match the symbol? */
1007static bool sym_is(const char *name, unsigned namelen, const char *symbol)
1008{
1009 if (namelen != strlen(symbol))
1010 return false;
1011
1012 return memcmp(name, symbol, namelen) == 0;
1013}

--- 88 unchanged lines hidden ---
1040/* Does namelen bytes of name exactly match the symbol? */
1041static bool sym_is(const char *name, unsigned namelen, const char *symbol)
1042{
1043 if (namelen != strlen(symbol))
1044 return false;
1045
1046 return memcmp(name, symbol, namelen) == 0;
1047}

--- 88 unchanged lines hidden ---