loader: Add more bus name to pnpautoload

Add ofwbus, iicbus and spibus to pnpautoload so modules under those
buses will be loaded.
On my rockpro64 now :
OK pnpautoload -v
Autoloading modules for simplebus
Using DTB provided by EFI at 0x8100000.
Autoloading modules for ofwbus
/boot/kernel/rk_spi.ko text=0x14b2 text=0xd4c data=0x4d0+0x8 syms=[0x8+0xa98+0x8+0x807]
/boot/kernel/dwwdt.ko text=0x12e2 text=0x78c data=0x4c8+0x10 syms=[0x8+0x990+0x8+0x6e1]
Autoloading modules for iicbus
Autoloading modules for spibus
/boot/kernel/mx25l.ko text=0x1613 text=0x114c data=0x6e8+0x8 syms=[0x8+0xa08+0x8+0x665]
loading required module 'fdt_slicer'
/boot/kernel/fdt_slicer.ko text=0x95e text=0x340 data=0x290 syms=[0x8+0x6c0+0x8+0x4a0]
This commit is contained in:
Emmanuel Vadot 2021-11-14 15:32:00 +01:00
parent d4874307fd
commit 4c0c353d0e

View File

@ -446,7 +446,7 @@ command_pnpload(int argc, char *argv[])
#if defined(LOADER_FDT_SUPPORT)
static void
pnpautoload_simplebus(void) {
pnpautoload_fdt_bus(const char *busname) {
const char *pnpstring;
const char *compatstr;
char *pnpinfo = NULL;
@ -464,7 +464,7 @@ pnpautoload_simplebus(void) {
pnplen += strlen(compatstr) + 1;
asprintf(&pnpinfo, "compat=%s", compatstr);
module = mod_searchmodule_pnpinfo("simplebus", pnpinfo);
module = mod_searchmodule_pnpinfo(busname, pnpinfo);
if (module) {
error = mod_loadkld(module, 0, NULL);
if (error)
@ -480,12 +480,15 @@ pnpautoload_simplebus(void) {
struct pnp_bus {
const char *name;
void (*load)(void);
void (*load)(const char *busname);
};
struct pnp_bus pnp_buses[] = {
#if defined(LOADER_FDT_SUPPORT)
{"simplebus", pnpautoload_simplebus},
{"simplebus", pnpautoload_fdt_bus},
{"ofwbus", pnpautoload_fdt_bus},
{"iicbus", pnpautoload_fdt_bus},
{"spibus", pnpautoload_fdt_bus},
#endif
};
@ -528,8 +531,8 @@ command_pnpautoload(int argc, char *argv[])
continue;
}
if (verbose)
printf("Autoloading modules for simplebus\n");
pnp_buses[i].load();
printf("Autoloading modules for %s\n", pnp_buses[i].name);
pnp_buses[i].load(pnp_buses[i].name);
match = 1;
}
if (match == 0)