[rstmgr] Temporary software change to enable building
Signed-off-by: Timothy Chen <timothytim@google.com>
[sw] updates per comments
Signed-off-by: Timothy Chen <timothytim@google.com>
[sw] forgot to run clang-format...
Signed-off-by: Timothy Chen <timothytim@google.com>
[sw] add parameter for number of hardware resets
Signed-off-by: Timothy Chen <timothytim@google.com>
diff --git a/hw/ip/rstmgr/data/rstmgr.hjson.tpl b/hw/ip/rstmgr/data/rstmgr.hjson.tpl
index 3d6ff41..02210bd 100644
--- a/hw/ip/rstmgr/data/rstmgr.hjson.tpl
+++ b/hw/ip/rstmgr/data/rstmgr.hjson.tpl
@@ -35,12 +35,21 @@
local: "true"
},
+ { name: "NumHwResets",
+ desc: "Number of hardware reset requests, inclusive of escalation",
+ type: "int",
+ default: "${num_rstreqs+1}",
+ local: "true"
+ },
+
{ name: "NumSwResets",
desc: "Number of software resets",
type: "int",
default: "${len(sw_rsts)}",
local: "true"
},
+
+
],
// Define rstmgr struct package
diff --git a/sw/device/lib/dif/dif_rstmgr.c b/sw/device/lib/dif/dif_rstmgr.c
index f2908e3..320a894 100644
--- a/sw/device/lib/dif/dif_rstmgr.c
+++ b/sw/device/lib/dif/dif_rstmgr.c
@@ -8,6 +8,7 @@
#include "sw/device/lib/base/bitfield.h"
#include "sw/device/lib/base/mmio.h"
+
#include "rstmgr_regs.h" // Generated.
// This macro simplifies the `_Static_assert` check to make sure that the
@@ -21,10 +22,10 @@
RSTMGR_RESET_INFO_CHECK(Por, INFO_POR);
RSTMGR_RESET_INFO_CHECK(LowPowerExit, INFO_LOW_POWER_EXIT);
RSTMGR_RESET_INFO_CHECK(Ndm, INFO_NDM_RESET);
-RSTMGR_RESET_INFO_CHECK(HwReq, INFO_HW_REQ);
-_Static_assert(kDifRstmgrResetInfoLast == kDifRstmgrResetInfoHwReq,
- "Please add `RSTMGR_RESET_INFO_CHECK` for the new reset type!");
+_Static_assert(kDifRstmgrResetInfoHwReq == (RSTMGR_RESET_INFO_HW_REQ_MASK
+ << RSTMGR_RESET_INFO_HW_REQ_OFFSET),
+ "kDifRstmgrResetInfoHwReq must match the register definition!");
_Static_assert(
RSTMGR_PARAM_NUMSWRESETS == 2,
diff --git a/sw/device/lib/dif/dif_rstmgr.h b/sw/device/lib/dif/dif_rstmgr.h
index 554c203..625a50c 100644
--- a/sw/device/lib/dif/dif_rstmgr.h
+++ b/sw/device/lib/dif/dif_rstmgr.h
@@ -86,11 +86,11 @@
* Device has reset due to a peripheral request. This can be an alert
* escalation, watchdog or anything else.
*/
- kDifRstmgrResetInfoHwReq = (0x1 << 3),
+ kDifRstmgrResetInfoHwReq = (0x3 << 3),
/**
* \internal used to catch missing `_Static_assert` for public variants.
*/
- kDifRstmgrResetInfoLast = kDifRstmgrResetInfoHwReq,
+ kDifRstmgrResetInfoLast = (0x1 << 4),
} dif_rstmgr_reset_info_t;
/**
@@ -138,7 +138,9 @@
*
* This type should be treated as opaque by users.
*/
-typedef struct dif_rstmgr { dif_rstmgr_params_t params; } dif_rstmgr_t;
+typedef struct dif_rstmgr {
+ dif_rstmgr_params_t params;
+} dif_rstmgr_t;
/**
* Creates a new handle for Reset Manager.
diff --git a/sw/device/tests/dif/dif_rstmgr_unittest.cc b/sw/device/tests/dif/dif_rstmgr_unittest.cc
index d164653..21fa095 100644
--- a/sw/device/tests/dif/dif_rstmgr_unittest.cc
+++ b/sw/device/tests/dif/dif_rstmgr_unittest.cc
@@ -136,7 +136,7 @@
RSTMGR_RESET_INFO_POR_BIT,
RSTMGR_RESET_INFO_LOW_POWER_EXIT_BIT,
RSTMGR_RESET_INFO_NDM_RESET_BIT,
- RSTMGR_RESET_INFO_HW_REQ_BIT,
+ RSTMGR_RESET_INFO_HW_REQ_OFFSET + RSTMGR_PARAM_NUMHWRESETS - 1,
};
};