1

firmware: coreboot: Generate aliases for coreboot modules

Generate aliases for coreboot modules to allow automatic module probing.

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Acked-by: Masahiro Yamada <masahiroy@kernel.org>
Link: https://lore.kernel.org/r/20240212-coreboot-mod-defconfig-v4-2-d14172676f6d@collabora.com
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
This commit is contained in:
Nícolas F. R. A. Prado 2024-02-12 09:50:06 -05:00 committed by Tzung-Bi Shih
parent c2b28f6806
commit f1cebae1db
3 changed files with 23 additions and 0 deletions

View File

@ -960,4 +960,14 @@ struct vchiq_device_id {
char name[32]; char name[32];
}; };
/**
* struct coreboot_device_id - Identifies a coreboot table entry
* @tag: tag ID
* @driver_data: driver specific data
*/
struct coreboot_device_id {
__u32 tag;
kernel_ulong_t driver_data;
};
#endif /* LINUX_MOD_DEVICETABLE_H */ #endif /* LINUX_MOD_DEVICETABLE_H */

View File

@ -274,5 +274,8 @@ int main(void)
DEVID(vchiq_device_id); DEVID(vchiq_device_id);
DEVID_FIELD(vchiq_device_id, name); DEVID_FIELD(vchiq_device_id, name);
DEVID(coreboot_device_id);
DEVID_FIELD(coreboot_device_id, tag);
return 0; return 0;
} }

View File

@ -1494,6 +1494,15 @@ static int do_vchiq_entry(const char *filename, void *symval, char *alias)
return 1; return 1;
} }
/* Looks like: coreboot:tN */
static int do_coreboot_entry(const char *filename, void *symval, char *alias)
{
DEF_FIELD(symval, coreboot_device_id, tag);
sprintf(alias, "coreboot:t%08X", tag);
return 1;
}
/* Does namelen bytes of name exactly match the symbol? */ /* Does namelen bytes of name exactly match the symbol? */
static bool sym_is(const char *name, unsigned namelen, const char *symbol) static bool sym_is(const char *name, unsigned namelen, const char *symbol)
{ {
@ -1575,6 +1584,7 @@ static const struct devtable devtable[] = {
{"ishtp", SIZE_ishtp_device_id, do_ishtp_entry}, {"ishtp", SIZE_ishtp_device_id, do_ishtp_entry},
{"cdx", SIZE_cdx_device_id, do_cdx_entry}, {"cdx", SIZE_cdx_device_id, do_cdx_entry},
{"vchiq", SIZE_vchiq_device_id, do_vchiq_entry}, {"vchiq", SIZE_vchiq_device_id, do_vchiq_entry},
{"coreboot", SIZE_coreboot_device_id, do_coreboot_entry},
}; };
/* Create MODULE_ALIAS() statements. /* Create MODULE_ALIAS() statements.