lib: utils: Initialize miscellaneous drivers in one pass

For driver subsystems that are not tightly integrated into the OpenSBI
init sequence, it is not important that the drivers are initialized in
any particular order. By putting all of these drivers in one array, they
can all be initialized with a single pass through the devicetree. This
saves about 10 ms of boot time on HiFive Unmatched.

Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Samuel Holland
2025-01-19 11:03:57 -08:00
committed by Anup Patel
parent e84ba96634
commit 434add551c
32 changed files with 39 additions and 254 deletions

View File

@@ -1,22 +0,0 @@
/*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2024 Ventana Micro Systems Inc.
*
* Authors:
* Anup Patel <apatel@ventanamicro.com>
*/
#include <sbi_utils/hsm/fdt_hsm.h>
/* List of FDT HSM drivers generated at compile time */
extern const struct fdt_driver *const fdt_hsm_drivers[];
void fdt_hsm_init(const void *fdt)
{
/*
* Platforms might have multiple HSM devices or might
* not have any so probe all and don't fail.
*/
fdt_driver_init_all(fdt, fdt_hsm_drivers);
}

View File

@@ -1,3 +0,0 @@
HEADER: sbi_utils/hsm/fdt_hsm.h
TYPE: const struct fdt_driver
NAME: fdt_hsm_drivers

View File

@@ -12,9 +12,9 @@
#include <sbi/sbi_heap.h>
#include <sbi/sbi_hsm.h>
#include <sbi/sbi_scratch.h>
#include <sbi_utils/fdt/fdt_helper.h>
#include <sbi_utils/fdt/fdt_driver.h>
#include <sbi_utils/fdt/fdt_fixup.h>
#include <sbi_utils/hsm/fdt_hsm.h>
#include <sbi_utils/fdt/fdt_helper.h>
#include <sbi_utils/mailbox/fdt_mailbox.h>
#include <sbi_utils/mailbox/mailbox.h>
#include <sbi_utils/mailbox/rpmi_mailbox.h>

View File

@@ -7,8 +7,5 @@
# Anup Patel <apatel@ventanamicro.com>
#
libsbiutils-objs-$(CONFIG_FDT_HSM) += hsm/fdt_hsm.o
libsbiutils-objs-$(CONFIG_FDT_HSM) += hsm/fdt_hsm_drivers.carray.o
carray-fdt_hsm_drivers-$(CONFIG_FDT_HSM_RPMI) += fdt_hsm_rpmi
carray-fdt_early_drivers-$(CONFIG_FDT_HSM_RPMI) += fdt_hsm_rpmi
libsbiutils-objs-$(CONFIG_FDT_HSM_RPMI) += hsm/fdt_hsm_rpmi.o