Skip to content

Commit 128896c

Browse files
committed
[sw,test] Port entropy_src_fips_mode_health test to DT
Signed-off-by: Robert Schilling <[email protected]>
1 parent 331640b commit 128896c

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

sw/device/tests/BUILD

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1669,6 +1669,7 @@ opentitan_test(
16691669
"//hw/top_earlgrey:fpga_cw340_sival": None,
16701670
"//hw/top_earlgrey:silicon_creator": None,
16711671
},
1672+
DARJEELING_TEST_ENVS,
16721673
),
16731674
# This test uses carefully tuned health test threshold values to trigger health test alerts
16741675
# inside ENTROPY_SRC. Due to the probabilistic nature of the analog noise source producing the
@@ -1684,7 +1685,7 @@ opentitan_test(
16841685
verilator = verilator_params(timeout = "long"),
16851686
deps = [
16861687
":otbn_randomness_impl",
1687-
"//hw/top_earlgrey/sw/autogen:top_earlgrey",
1688+
"//hw/top:dt",
16881689
"//sw/device/lib/base:memory",
16891690
"//sw/device/lib/base:mmio",
16901691
"//sw/device/lib/dif:aes",

sw/device/tests/entropy_src_fips_mode_health_test.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
// SPDX-License-Identifier: Apache-2.0
44

55
#include "hw/ip/aes/model/aes_modes.h"
6+
#include "hw/top/dt/dt_aes.h"
7+
#include "hw/top/dt/dt_alert_handler.h"
8+
#include "hw/top/dt/dt_csrng.h"
9+
#include "hw/top/dt/dt_edn.h"
10+
#include "hw/top/dt/dt_entropy_src.h"
11+
#include "hw/top/dt/dt_otbn.h"
612
#include "sw/device/lib/base/bitfield.h"
713
#include "sw/device/lib/base/memory.h"
814
#include "sw/device/lib/base/mmio.h"
@@ -24,7 +30,6 @@
2430
#include "sw/device/tests/otbn_randomness_impl.h"
2531

2632
#include "hw/top/entropy_src_regs.h" // autogenerated
27-
#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
2833

2934
#define TIMEOUT (1000 * 1000)
3035

@@ -47,17 +52,13 @@ status_t init_test_environment(void) {
4752
LOG_INFO(
4853
"Initializing modules entropy_src, csrng, edn0, edn1, aes, otbn and "
4954
"alert_handler...");
50-
TRY(dif_entropy_src_init(
51-
mmio_region_from_addr(TOP_EARLGREY_ENTROPY_SRC_BASE_ADDR), &entropy_src));
52-
TRY(dif_csrng_init(mmio_region_from_addr(TOP_EARLGREY_CSRNG_BASE_ADDR),
53-
&csrng));
54-
TRY(dif_edn_init(mmio_region_from_addr(TOP_EARLGREY_EDN0_BASE_ADDR), &edn0));
55-
TRY(dif_edn_init(mmio_region_from_addr(TOP_EARLGREY_EDN1_BASE_ADDR), &edn1));
56-
TRY(dif_aes_init(mmio_region_from_addr(TOP_EARLGREY_AES_BASE_ADDR), &aes));
57-
TRY(dif_otbn_init(mmio_region_from_addr(TOP_EARLGREY_OTBN_BASE_ADDR), &otbn));
58-
TRY(dif_alert_handler_init(
59-
mmio_region_from_addr(TOP_EARLGREY_ALERT_HANDLER_BASE_ADDR),
60-
&alert_handler));
55+
TRY(dif_entropy_src_init_from_dt(kDtEntropySrc, &entropy_src));
56+
TRY(dif_csrng_init_from_dt(kDtCsrng, &csrng));
57+
TRY(dif_edn_init_from_dt(kDtEdn0, &edn0));
58+
TRY(dif_edn_init_from_dt(kDtEdn1, &edn1));
59+
TRY(dif_aes_init_from_dt(kDtAes, &aes));
60+
TRY(dif_otbn_init_from_dt(kDtOtbn, &otbn));
61+
TRY(dif_alert_handler_init_from_dt(kDtAlertHandler, &alert_handler));
6162
return OK_STATUS();
6263
}
6364

0 commit comments

Comments
 (0)