From 6ae214cf12e36b96d9e0df5aa7e8b1a50ef49332 Mon Sep 17 00:00:00 2001 From: Alex Jones Date: Mon, 10 Feb 2025 18:04:28 +0000 Subject: [PATCH] [sw] Port kmac_mode_kmac_test to devicetables Signed-off-by: Alex Jones --- sw/device/tests/BUILD | 3 ++- sw/device/tests/kmac_mode_kmac_test.c | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sw/device/tests/BUILD b/sw/device/tests/BUILD index d8171f58aa0e1..29ed5aba2a06d 100644 --- a/sw/device/tests/BUILD +++ b/sw/device/tests/BUILD @@ -2641,10 +2641,11 @@ opentitan_test( EARLGREY_SILICON_OWNER_ROM_EXT_ENVS, { "//hw/top_earlgrey:silicon_creator": None, + "//hw/top_darjeeling:sim_dv": None, }, ), deps = [ - "//hw/top_earlgrey/sw/autogen:top_earlgrey", + "//hw/top:dt", "//sw/device/lib/arch:device", "//sw/device/lib/base:macros", "//sw/device/lib/base:mmio", diff --git a/sw/device/tests/kmac_mode_kmac_test.c b/sw/device/tests/kmac_mode_kmac_test.c index 83b1685142044..da4293f0892db 100644 --- a/sw/device/tests/kmac_mode_kmac_test.c +++ b/sw/device/tests/kmac_mode_kmac_test.c @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0, see LICENSE for details. // SPDX-License-Identifier: Apache-2.0 +#include "dt/dt_kmac.h" // Generated #include "sw/device/lib/arch/device.h" #include "sw/device/lib/base/macros.h" #include "sw/device/lib/base/mmio.h" @@ -10,8 +11,6 @@ #include "sw/device/lib/testing/test_framework/check.h" #include "sw/device/lib/testing/test_framework/ottf_main.h" -#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h" - OTTF_DEFINE_TEST_CONFIG(); #define DIGEST_LEN_KMAC_MAX 100 @@ -193,9 +192,11 @@ bool test_main(void) { // Intialize KMAC hardware. dif_kmac_t kmac; + dt_kmac_t kKmacDt = (dt_kmac_t)0; + static_assert(kDtKmacCount >= 1, + "This test requires at least one KMAC instance"); dif_kmac_operation_state_t kmac_operation_state; - CHECK_DIF_OK( - dif_kmac_init(mmio_region_from_addr(TOP_EARLGREY_KMAC_BASE_ADDR), &kmac)); + CHECK_DIF_OK(dif_kmac_init_from_dt(kKmacDt, &kmac)); // Configure KMAC hardware using software entropy. dif_kmac_config_t config = (dif_kmac_config_t){