diff options
author | Anup Patel <apatel@ventanamicro.com> | 2024-08-06 10:45:11 +0530 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2024-12-06 09:26:40 +0530 |
commit | ff4769bf08b50c61bb48f37ea00a17737096e2b5 (patch) | |
tree | c7f807fb05a5c379afa7a8c73706c8b802304cb9 /lib/utils | |
parent | 9d760b810e184479c65c2537594beaf4657f02ed (diff) | |
download | opensbi-ff4769bf08b50c61bb48f37ea00a17737096e2b5.zip opensbi-ff4769bf08b50c61bb48f37ea00a17737096e2b5.tar.gz opensbi-ff4769bf08b50c61bb48f37ea00a17737096e2b5.tar.bz2 |
lib: utils: Add simple FDT based HSM driver framework
The generic platform can have multiple HSM drivers so add a simple
FDT based HSM driver framework.
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Diffstat (limited to 'lib/utils')
-rw-r--r-- | lib/utils/Kconfig | 2 | ||||
-rw-r--r-- | lib/utils/hsm/Kconfig | 10 | ||||
-rw-r--r-- | lib/utils/hsm/fdt_hsm.c | 22 | ||||
-rw-r--r-- | lib/utils/hsm/fdt_hsm_drivers.carray | 3 | ||||
-rw-r--r-- | lib/utils/hsm/objects.mk | 11 |
5 files changed, 48 insertions, 0 deletions
diff --git a/lib/utils/Kconfig b/lib/utils/Kconfig index 3f32c1c..c860a18 100644 --- a/lib/utils/Kconfig +++ b/lib/utils/Kconfig @@ -6,6 +6,8 @@ source "$(OPENSBI_SRC_DIR)/lib/utils/fdt/Kconfig" source "$(OPENSBI_SRC_DIR)/lib/utils/gpio/Kconfig" +source "$(OPENSBI_SRC_DIR)/lib/utils/hsm/Kconfig" + source "$(OPENSBI_SRC_DIR)/lib/utils/i2c/Kconfig" source "$(OPENSBI_SRC_DIR)/lib/utils/ipi/Kconfig" diff --git a/lib/utils/hsm/Kconfig b/lib/utils/hsm/Kconfig new file mode 100644 index 0000000..3150611 --- /dev/null +++ b/lib/utils/hsm/Kconfig @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: BSD-2-Clause + +menu "HSM Device Support" + +config FDT_HSM + bool "FDT based HSM drivers" + depends on FDT + default n + +endmenu diff --git a/lib/utils/hsm/fdt_hsm.c b/lib/utils/hsm/fdt_hsm.c new file mode 100644 index 0000000..162b986 --- /dev/null +++ b/lib/utils/hsm/fdt_hsm.c @@ -0,0 +1,22 @@ +/* + * 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); +} diff --git a/lib/utils/hsm/fdt_hsm_drivers.carray b/lib/utils/hsm/fdt_hsm_drivers.carray new file mode 100644 index 0000000..73680a2 --- /dev/null +++ b/lib/utils/hsm/fdt_hsm_drivers.carray @@ -0,0 +1,3 @@ +HEADER: sbi_utils/hsm/fdt_hsm.h +TYPE: const struct fdt_driver +NAME: fdt_hsm_drivers diff --git a/lib/utils/hsm/objects.mk b/lib/utils/hsm/objects.mk new file mode 100644 index 0000000..49337bf --- /dev/null +++ b/lib/utils/hsm/objects.mk @@ -0,0 +1,11 @@ +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2024 Ventana Micro Systems Inc. +# +# Authors: +# 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 |