Skip to content

Commit d33d8e1

Browse files
committed
[sw] Port rstmgr_cpu_info_test to devicetables
Signed-off-by: Alex Jones <[email protected]>
1 parent b1699a0 commit d33d8e1

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

sw/device/tests/BUILD

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3594,14 +3594,15 @@ opentitan_test(
35943594
EARLGREY_SILICON_OWNER_ROM_EXT_ENVS,
35953595
{
35963596
"//hw/top_earlgrey:silicon_creator": None,
3597+
"//hw/top_darjeeling:sim_dv": None,
35973598
},
35983599
),
35993600
verilator = verilator_params(
36003601
timeout = "long",
36013602
tags = ["broken"],
36023603
),
36033604
deps = [
3604-
"//hw/top_earlgrey/sw/autogen:top_earlgrey",
3605+
"//hw/top:dt",
36053606
"//sw/device/lib/base:abs_mmio",
36063607
"//sw/device/lib/base:macros",
36073608
"//sw/device/lib/base:mmio",

sw/device/tests/rstmgr_cpu_info_test.c

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
33
// SPDX-License-Identifier: Apache-2.0
44

5+
#include "dt/dt_pwrmgr.h" // Generated
6+
#include "dt/dt_rstmgr.h" // Generated
7+
#include "dt/dt_rv_core_ibex.h" // Generated
58
#include "sw/device/lib/base/abs_mmio.h"
69
#include "sw/device/lib/base/macros.h"
710
#include "sw/device/lib/base/mmio.h"
@@ -16,8 +19,6 @@
1619
#include "sw/device/lib/testing/test_framework/ottf_isrs.h"
1720
#include "sw/device/lib/testing/test_framework/ottf_main.h"
1821

19-
#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
20-
2122
OTTF_DEFINE_TEST_CONFIG();
2223

2324
/**
@@ -32,7 +33,7 @@ OTTF_DEFINE_TEST_CONFIG();
3233
* the expected values for this single fault. The watch dog is then set up
3334
* and another illegal memory access is performed. Only this time
3435
* the exception handler performs another illegal read.
35-
* Causing the ibex to be haulted by the alert handler.
36+
* Causing the ibex to be halted by the alert handler.
3637
* The watch dog will eventually trigger a reset.
3738
*
3839
* 3. After the watchdog reset, the CPU info dump is checked against
@@ -60,6 +61,7 @@ extern const char kDoubleFaultSecondAddr[];
6061

6162
// A handle to the reset manager.
6263
static dif_rstmgr_t rstmgr;
64+
static dt_rstmgr_t kRstmgrDt = kDtRstmgrAon;
6365

6466
// This variable is used to ensure loads from an address aren't optimised out.
6567
volatile static uint32_t addr_val;
@@ -180,18 +182,19 @@ bool test_main(void) {
180182
dif_rv_core_ibex_crash_dump_info_t dump;
181183

182184
dif_aon_timer_t aon_timer;
185+
dt_aon_timer_t aon_timer_dt = kDtAonTimerAon;
183186
dif_pwrmgr_t pwrmgr;
187+
dt_pwrmgr_t pwrmgr_dt = kDtPwrmgrAon;
184188
dif_rv_core_ibex_t ibex;
189+
dt_rv_core_ibex_t ibex_dt = (dt_rv_core_ibex_t)0;
190+
static_assert(kDtRvCoreIbexCount >= 1,
191+
"This test requires at least 1 Ibex core.");
185192

186193
// Initialize Handles.
187-
CHECK_DIF_OK(dif_rstmgr_init(
188-
mmio_region_from_addr(TOP_EARLGREY_RSTMGR_AON_BASE_ADDR), &rstmgr));
189-
CHECK_DIF_OK(dif_aon_timer_init(
190-
mmio_region_from_addr(TOP_EARLGREY_AON_TIMER_AON_BASE_ADDR), &aon_timer));
191-
CHECK_DIF_OK(dif_pwrmgr_init(
192-
mmio_region_from_addr(TOP_EARLGREY_PWRMGR_AON_BASE_ADDR), &pwrmgr));
193-
CHECK_DIF_OK(dif_rv_core_ibex_init(
194-
mmio_region_from_addr(TOP_EARLGREY_RV_CORE_IBEX_CFG_BASE_ADDR), &ibex));
194+
CHECK_DIF_OK(dif_rstmgr_init_from_dt(kRstmgrDt, &rstmgr));
195+
CHECK_DIF_OK(dif_aon_timer_init_from_dt(aon_timer_dt, &aon_timer));
196+
CHECK_DIF_OK(dif_pwrmgr_init_from_dt(pwrmgr_dt, &pwrmgr));
197+
CHECK_DIF_OK(dif_rv_core_ibex_init_from_dt(ibex_dt, &ibex));
195198

196199
switch (rstmgr_testutils_reason_get()) {
197200
case kDifRstmgrResetInfoPor: // The first power-up.

0 commit comments

Comments
 (0)