mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 23:41:23 +01:00
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:

committed by
Anup Patel

parent
e84ba96634
commit
434add551c
@@ -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/cppc/fdt_cppc.h>
|
||||
|
||||
/* List of FDT CPPC drivers generated at compile time */
|
||||
extern const struct fdt_driver *const fdt_cppc_drivers[];
|
||||
|
||||
void fdt_cppc_init(const void *fdt)
|
||||
{
|
||||
/*
|
||||
* Platforms might have multiple CPPC devices or might
|
||||
* not have any so probe all and don't fail.
|
||||
*/
|
||||
fdt_driver_init_all(fdt, fdt_cppc_drivers);
|
||||
}
|
@@ -1,3 +0,0 @@
|
||||
HEADER: sbi_utils/cppc/fdt_cppc.h
|
||||
TYPE: const struct fdt_driver
|
||||
NAME: fdt_cppc_drivers
|
@@ -12,7 +12,7 @@
|
||||
#include <sbi/sbi_cppc.h>
|
||||
#include <sbi/sbi_ecall_interface.h>
|
||||
#include <sbi/sbi_scratch.h>
|
||||
#include <sbi_utils/cppc/fdt_cppc.h>
|
||||
#include <sbi_utils/fdt/fdt_driver.h>
|
||||
#include <sbi_utils/fdt/fdt_helper.h>
|
||||
#include <sbi_utils/mailbox/fdt_mailbox.h>
|
||||
#include <sbi_utils/mailbox/rpmi_mailbox.h>
|
||||
|
@@ -7,8 +7,5 @@
|
||||
# Anup Patel <apatel@ventanamicro.com>
|
||||
#
|
||||
|
||||
libsbiutils-objs-$(CONFIG_FDT_CPPC) += cppc/fdt_cppc.o
|
||||
libsbiutils-objs-$(CONFIG_FDT_CPPC) += cppc/fdt_cppc_drivers.carray.o
|
||||
|
||||
carray-fdt_cppc_drivers-$(CONFIG_FDT_CPPC_RPMI) += fdt_cppc_rpmi
|
||||
carray-fdt_early_drivers-$(CONFIG_FDT_CPPC_RPMI) += fdt_cppc_rpmi
|
||||
libsbiutils-objs-$(CONFIG_FDT_CPPC_RPMI) += cppc/fdt_cppc_rpmi.o
|
||||
|
3
lib/utils/fdt/fdt_early_drivers.carray
Normal file
3
lib/utils/fdt/fdt_early_drivers.carray
Normal file
@@ -0,0 +1,3 @@
|
||||
HEADER: sbi_utils/fdt/fdt_driver.h
|
||||
TYPE: const struct fdt_driver
|
||||
NAME: fdt_early_drivers
|
@@ -4,6 +4,8 @@
|
||||
# Copyright (C) 2020 Bin Meng <bmeng.cn@gmail.com>
|
||||
#
|
||||
|
||||
libsbiutils-objs-$(CONFIG_FDT) += fdt/fdt_early_drivers.carray.o
|
||||
|
||||
libsbiutils-objs-$(CONFIG_FDT_DOMAIN) += fdt/fdt_domain.o
|
||||
libsbiutils-objs-$(CONFIG_FDT_PMU) += fdt/fdt_pmu.o
|
||||
libsbiutils-objs-$(CONFIG_FDT) += fdt/fdt_helper.o
|
||||
|
@@ -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);
|
||||
}
|
@@ -1,3 +0,0 @@
|
||||
HEADER: sbi_utils/hsm/fdt_hsm.h
|
||||
TYPE: const struct fdt_driver
|
||||
NAME: fdt_hsm_drivers
|
@@ -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>
|
||||
|
@@ -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
|
||||
|
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* Copyright (c) 2020 Western Digital Corporation or its affiliates.
|
||||
*
|
||||
* Authors:
|
||||
* Anup Patel <anup.patel@wdc.com>
|
||||
*/
|
||||
|
||||
#include <sbi_utils/reset/fdt_reset.h>
|
||||
|
||||
/* List of FDT reset drivers generated at compile time */
|
||||
extern const struct fdt_driver *const fdt_reset_drivers[];
|
||||
|
||||
void fdt_reset_init(const void *fdt)
|
||||
{
|
||||
fdt_driver_init_all(fdt, fdt_reset_drivers);
|
||||
}
|
@@ -14,8 +14,8 @@
|
||||
#include <sbi/sbi_hart.h>
|
||||
#include <sbi/sbi_platform.h>
|
||||
#include <sbi/sbi_system.h>
|
||||
#include <sbi_utils/fdt/fdt_driver.h>
|
||||
#include <sbi_utils/fdt/fdt_helper.h>
|
||||
#include <sbi_utils/reset/fdt_reset.h>
|
||||
#include <sbi_utils/sys/atcsmu.h>
|
||||
|
||||
#define ATCWDT200_WP_NUM 0x5aa5
|
||||
|
@@ -1,3 +0,0 @@
|
||||
HEADER: sbi_utils/reset/fdt_reset.h
|
||||
TYPE: const struct fdt_driver
|
||||
NAME: fdt_reset_drivers
|
@@ -15,9 +15,9 @@
|
||||
#include <sbi/sbi_hart.h>
|
||||
#include <sbi/sbi_system.h>
|
||||
#include <sbi/sbi_timer.h>
|
||||
#include <sbi_utils/fdt/fdt_driver.h>
|
||||
#include <sbi_utils/fdt/fdt_helper.h>
|
||||
#include <sbi_utils/gpio/fdt_gpio.h>
|
||||
#include <sbi_utils/reset/fdt_reset.h>
|
||||
|
||||
struct gpio_reset {
|
||||
struct gpio_pin pin;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* Anup Patel <anup.patel@wdc.com>
|
||||
*/
|
||||
|
||||
#include <sbi_utils/reset/fdt_reset.h>
|
||||
#include <sbi_utils/fdt/fdt_driver.h>
|
||||
#include <sbi_utils/fdt/fdt_helper.h>
|
||||
#include <sbi_utils/sys/htif.h>
|
||||
|
||||
|
@@ -10,8 +10,8 @@
|
||||
#include <sbi/sbi_error.h>
|
||||
#include <sbi/sbi_system.h>
|
||||
#include <sbi/sbi_console.h>
|
||||
#include <sbi_utils/fdt/fdt_driver.h>
|
||||
#include <sbi_utils/fdt/fdt_helper.h>
|
||||
#include <sbi_utils/reset/fdt_reset.h>
|
||||
#include <sbi_utils/mailbox/fdt_mailbox.h>
|
||||
#include <sbi_utils/mailbox/rpmi_msgprot.h>
|
||||
#include <sbi_utils/mailbox/rpmi_mailbox.h>
|
||||
|
@@ -10,8 +10,8 @@
|
||||
#include <sbi/sbi_error.h>
|
||||
#include <sbi/sbi_system.h>
|
||||
#include <sbi/sbi_console.h>
|
||||
#include <sbi_utils/fdt/fdt_driver.h>
|
||||
#include <sbi_utils/fdt/fdt_helper.h>
|
||||
#include <sbi_utils/reset/fdt_reset.h>
|
||||
#include <sbi_utils/i2c/fdt_i2c.h>
|
||||
|
||||
#define MANGO_BOARD_TYPE_MASK 0x80
|
||||
|
@@ -9,8 +9,8 @@
|
||||
#include <sbi/sbi_bitops.h>
|
||||
#include <sbi/sbi_error.h>
|
||||
#include <sbi/sbi_system.h>
|
||||
#include <sbi_utils/fdt/fdt_driver.h>
|
||||
#include <sbi_utils/fdt/fdt_helper.h>
|
||||
#include <sbi_utils/reset/fdt_reset.h>
|
||||
|
||||
#define WDT_KEY_VAL 0x16aa0000
|
||||
|
||||
|
@@ -12,9 +12,9 @@
|
||||
#include <sbi/sbi_error.h>
|
||||
#include <sbi/sbi_hart.h>
|
||||
#include <sbi/sbi_system.h>
|
||||
#include <sbi_utils/fdt/fdt_driver.h>
|
||||
#include <sbi_utils/fdt/fdt_helper.h>
|
||||
#include <sbi_utils/regmap/fdt_regmap.h>
|
||||
#include <sbi_utils/reset/fdt_reset.h>
|
||||
|
||||
struct syscon_reset {
|
||||
struct regmap *rmap;
|
||||
|
@@ -7,28 +7,25 @@
|
||||
# Anup Patel <anup.patel@wdc.com>
|
||||
#
|
||||
|
||||
libsbiutils-objs-$(CONFIG_FDT_RESET) += reset/fdt_reset.o
|
||||
libsbiutils-objs-$(CONFIG_FDT_RESET) += reset/fdt_reset_drivers.carray.o
|
||||
|
||||
carray-fdt_reset_drivers-$(CONFIG_FDT_RESET_ATCWDT200) += fdt_reset_atcwdt200
|
||||
carray-fdt_early_drivers-$(CONFIG_FDT_RESET_ATCWDT200) += fdt_reset_atcwdt200
|
||||
libsbiutils-objs-$(CONFIG_FDT_RESET_ATCWDT200) += reset/fdt_reset_atcwdt200.o
|
||||
|
||||
carray-fdt_reset_drivers-$(CONFIG_FDT_RESET_GPIO) += fdt_poweroff_gpio
|
||||
carray-fdt_reset_drivers-$(CONFIG_FDT_RESET_GPIO) += fdt_reset_gpio
|
||||
carray-fdt_early_drivers-$(CONFIG_FDT_RESET_GPIO) += fdt_poweroff_gpio
|
||||
carray-fdt_early_drivers-$(CONFIG_FDT_RESET_GPIO) += fdt_reset_gpio
|
||||
libsbiutils-objs-$(CONFIG_FDT_RESET_GPIO) += reset/fdt_reset_gpio.o
|
||||
|
||||
carray-fdt_reset_drivers-$(CONFIG_FDT_RESET_HTIF) += fdt_reset_htif
|
||||
carray-fdt_early_drivers-$(CONFIG_FDT_RESET_HTIF) += fdt_reset_htif
|
||||
libsbiutils-objs-$(CONFIG_FDT_RESET_HTIF) += reset/fdt_reset_htif.o
|
||||
|
||||
carray-fdt_reset_drivers-$(CONFIG_FDT_RESET_SG2042_HWMON_MCU) += fdt_reset_sg2042_mcu
|
||||
carray-fdt_early_drivers-$(CONFIG_FDT_RESET_SG2042_HWMON_MCU) += fdt_reset_sg2042_mcu
|
||||
libsbiutils-objs-$(CONFIG_FDT_RESET_SG2042_HWMON_MCU) += reset/fdt_reset_sg2042_hwmon_mcu.o
|
||||
|
||||
carray-fdt_reset_drivers-$(CONFIG_FDT_RESET_SUNXI_WDT) += fdt_reset_sunxi_wdt
|
||||
carray-fdt_early_drivers-$(CONFIG_FDT_RESET_SUNXI_WDT) += fdt_reset_sunxi_wdt
|
||||
libsbiutils-objs-$(CONFIG_FDT_RESET_SUNXI_WDT) += reset/fdt_reset_sunxi_wdt.o
|
||||
|
||||
carray-fdt_reset_drivers-$(CONFIG_FDT_RESET_SYSCON) += fdt_syscon_poweroff
|
||||
carray-fdt_reset_drivers-$(CONFIG_FDT_RESET_SYSCON) += fdt_syscon_reboot
|
||||
carray-fdt_early_drivers-$(CONFIG_FDT_RESET_SYSCON) += fdt_syscon_poweroff
|
||||
carray-fdt_early_drivers-$(CONFIG_FDT_RESET_SYSCON) += fdt_syscon_reboot
|
||||
libsbiutils-objs-$(CONFIG_FDT_RESET_SYSCON) += reset/fdt_reset_syscon.o
|
||||
|
||||
carray-fdt_reset_drivers-$(CONFIG_FDT_RESET_RPMI) += fdt_reset_rpmi
|
||||
carray-fdt_early_drivers-$(CONFIG_FDT_RESET_RPMI) += fdt_reset_rpmi
|
||||
libsbiutils-objs-$(CONFIG_FDT_RESET_RPMI) += reset/fdt_reset_rpmi.o
|
||||
|
@@ -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/suspend/fdt_suspend.h>
|
||||
|
||||
/* List of FDT suspend drivers generated at compile time */
|
||||
extern const struct fdt_driver *const fdt_suspend_drivers[];
|
||||
|
||||
void fdt_suspend_init(const void *fdt)
|
||||
{
|
||||
/*
|
||||
* Platforms might have multiple system suspend devices or
|
||||
* might not have any so probe all and don't fail.
|
||||
*/
|
||||
fdt_driver_init_all(fdt, fdt_suspend_drivers);
|
||||
}
|
@@ -1,3 +0,0 @@
|
||||
HEADER: sbi_utils/suspend/fdt_suspend.h
|
||||
TYPE: const struct fdt_driver
|
||||
NAME: fdt_suspend_drivers
|
@@ -10,11 +10,11 @@
|
||||
#include <libfdt.h>
|
||||
#include <sbi/sbi_system.h>
|
||||
#include <sbi/riscv_asm.h>
|
||||
#include <sbi_utils/fdt/fdt_driver.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>
|
||||
#include <sbi_utils/suspend/fdt_suspend.h>
|
||||
|
||||
struct rpmi_syssusp {
|
||||
struct mbox_chan *chan;
|
||||
|
@@ -7,8 +7,5 @@
|
||||
# Anup Patel <apatel@ventanamicro.com>
|
||||
#
|
||||
|
||||
libsbiutils-objs-$(CONFIG_FDT_SUSPEND) += suspend/fdt_suspend.o
|
||||
libsbiutils-objs-$(CONFIG_FDT_SUSPEND) += suspend/fdt_suspend_drivers.carray.o
|
||||
|
||||
carray-fdt_suspend_drivers-$(CONFIG_FDT_SUSPEND_RPMI) += fdt_suspend_rpmi
|
||||
carray-fdt_early_drivers-$(CONFIG_FDT_SUSPEND_RPMI) += fdt_suspend_rpmi
|
||||
libsbiutils-objs-$(CONFIG_FDT_SUSPEND_RPMI) += suspend/fdt_suspend_rpmi.o
|
||||
|
Reference in New Issue
Block a user