Skip to content

Commit

Permalink
[RDL] Add LMS enable bit, update hw_rev_id to 1.1, regenerate RDL (#486)
Browse files Browse the repository at this point in the history
* Add LMS enable bit, regenerate RDL

* Update rev id for 1.1, updated bit-map description

* Add smoke test to validate hw config regs, plus Makefile build options

* Add new hw_config smoke test to regressions

* Update predicted values for HW_CONFIG/HW_REV_ID regs

* Update initialization values in soc_ifc tb

* Updated reg descs with access privileges

* Fix RDL checker so some grep arguments aren't ignored

* Typo fix for makefile

* MICROSOFT AUTOMATED PIPELINE: Stamp 'cwhitehead-msft-LMS-cap-bit' with updated timestamp and hash after successful run
  • Loading branch information
calebofearth authored Apr 30, 2024
1 parent 778da6f commit 56b2ade
Show file tree
Hide file tree
Showing 22 changed files with 449 additions and 19 deletions.
6 changes: 4 additions & 2 deletions .github/scripts/pr_rdl_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ fi
if ! git show-ref --quiet "${merge_dest}"; then
echo "Could not find ref named [${merge_dest}]"
exit 1
else
echo "Evaluating RDL modifications for merge into [${merge_dest}] with ref [$(git show-ref "${merge_dest}")]"
fi

if [[ -z "${CALIPTRA_ROOT:+"empty"}" ]]; then
Expand All @@ -44,10 +46,10 @@ for rdl_file in $(find "${CALIPTRA_ROOT}/src" -name "*.rdl"); do
echo "Did not find any file named [$rtl_file] that would be generated from [$rdl_file]";
fi;
done
args=$(for fname in "${gen_rtl_list[@]}"; do echo -n " -e '$fname'"; done)
patn=$(echo "${gen_rtl_list[@]}" | sed 's, ,\\\|,g')

# Find file modifications
rdl_mod_count=$(git diff --merge-base "${merge_dest}" --name-only | eval grep -c -e '\.rdl$\|tools\/templates\/rdl\|reg_gen.sh\|reg_gen.py\|reg_doc_gen.sh\|reg_doc_gen.py' $args || exit 0)
rdl_mod_count=$(git diff --merge-base "${merge_dest}" --name-only | grep -c -e '\.rdl$\|tools\/templates\/rdl\|reg_gen.sh\|reg_gen.py\|reg_doc_gen.sh\|reg_doc_gen.py' -e "${patn}" || exit 0)
if [[ "${rdl_mod_count}" -gt 0 ]]; then
# Run the HTML Doc generator script (to update the REG macro header files)
# and the individual reg generator script but then remove the docs directories
Expand Down
2 changes: 1 addition & 1 deletion .github/workflow_metadata/pr_hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a1c6b4e9634eda1208a2bdc365434561792dbe62102bcb254a470c3f9216bc45a755aadd6334294ab3116b82593f1eb6
b6a76c62fb59087fd27c838bf609afbad5b318521c2f9f16d27599ca166e71a67227e054bbfad47824c3c7f09bb4cce7
2 changes: 1 addition & 1 deletion .github/workflow_metadata/pr_timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1714426957
1714443225
2 changes: 2 additions & 0 deletions src/integration/rtl/caliptra_reg.h
Original file line number Diff line number Diff line change
Expand Up @@ -5552,6 +5552,8 @@
#define SOC_IFC_REG_CPTRA_HW_CONFIG_I3C_EN_MASK (0x4)
#define SOC_IFC_REG_CPTRA_HW_CONFIG_UART_EN_LOW (3)
#define SOC_IFC_REG_CPTRA_HW_CONFIG_UART_EN_MASK (0x8)
#define SOC_IFC_REG_CPTRA_HW_CONFIG_LMS_ACC_EN_LOW (4)
#define SOC_IFC_REG_CPTRA_HW_CONFIG_LMS_ACC_EN_MASK (0x10)
#define CLP_SOC_IFC_REG_CPTRA_WDT_TIMER1_EN (0x300300e4)
#define SOC_IFC_REG_CPTRA_WDT_TIMER1_EN (0xe4)
#define SOC_IFC_REG_CPTRA_WDT_TIMER1_EN_TIMER1_EN_LOW (0)
Expand Down
2 changes: 2 additions & 0 deletions src/integration/rtl/caliptra_reg_defines.svh
Original file line number Diff line number Diff line change
Expand Up @@ -5552,6 +5552,8 @@
`define SOC_IFC_REG_CPTRA_HW_CONFIG_I3C_EN_MASK (32'h4)
`define SOC_IFC_REG_CPTRA_HW_CONFIG_UART_EN_LOW (3)
`define SOC_IFC_REG_CPTRA_HW_CONFIG_UART_EN_MASK (32'h8)
`define SOC_IFC_REG_CPTRA_HW_CONFIG_LMS_ACC_EN_LOW (4)
`define SOC_IFC_REG_CPTRA_HW_CONFIG_LMS_ACC_EN_MASK (32'h10)
`define CLP_SOC_IFC_REG_CPTRA_WDT_TIMER1_EN (32'h300300e4)
`define SOC_IFC_REG_CPTRA_WDT_TIMER1_EN (32'he4)
`define SOC_IFC_REG_CPTRA_WDT_TIMER1_EN_TIMER1_EN_LOW (0)
Expand Down
1 change: 1 addition & 0 deletions src/integration/stimulus/L0_regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ contents:
- ../test_suites/smoke_test_trng/smoke_test_trng.yml
- ../test_suites/smoke_test_qspi/smoke_test_qspi.yml
- ../test_suites/smoke_test_uart/smoke_test_uart.yml
- ../test_suites/smoke_test_hw_config/smoke_test_hw_config.yml
- ../test_suites/smoke_test_kv_uds_reset/smoke_test_kv_uds_reset.yml
- ../test_suites/smoke_test_kv_securitystate/smoke_test_kv_securitystate.yml
- ../test_suites/smoke_test_kv_ecc_flow/smoke_test_kv_ecc_flow.yml
Expand Down
1 change: 1 addition & 0 deletions src/integration/stimulus/L0_trng_regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ contents:
- ../test_suites/c_intr_handler/c_intr_handler.yml
- ../test_suites/smoke_test_sram_ecc/smoke_test_sram_ecc.yml
- ../test_suites/smoke_test_trng/smoke_test_trng.yml
- ../test_suites/smoke_test_hw_config/smoke_test_hw_config.yml
- ../test_suites/smoke_test_kv_uds_reset/smoke_test_kv_uds_reset.yml
- ../test_suites/smoke_test_wdt/smoke_test_wdt.yml
- ../test_suites/smoke_test_cg_wdt/smoke_test_cg_wdt.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ contents:
- ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_trng/smoke_test_trng.yml
- ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_qspi/smoke_test_qspi.yml
- ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_uart/smoke_test_uart.yml
- ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_hw_config/smoke_test_hw_config.yml
- ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_kv_uds_reset/smoke_test_kv_uds_reset.yml
- ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_kv_securitystate/smoke_test_kv_securitystate.yml
- ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_kv_ecc_flow/smoke_test_kv_ecc_flow.yml
Expand Down
193 changes: 193 additions & 0 deletions src/integration/test_suites/smoke_test_hw_config/caliptra_isr.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// ---------------------------------------------------------------------
// File: caliptra_isr.h
// Description:
// Provides function declarations for use by external test files, so
// that the ISR functionality may behave like a library.
// TODO:
// This header file includes inline function definitions for event and
// test specific interrupt service behavior, so it should be copied and
// modified for each test.
// ---------------------------------------------------------------------

#ifndef CALIPTRA_ISR_H
#define CALIPTRA_ISR_H

#include "caliptra_reg.h"
#include <stdint.h>
#include "printf.h"
#include "riscv_hw_if.h"

/* --------------- symbols/typedefs --------------- */
typedef struct {
uint32_t doe_error;
uint32_t doe_notif;
uint32_t ecc_error;
uint32_t ecc_notif;
uint32_t hmac_error;
uint32_t hmac_notif;
uint32_t kv_error;
uint32_t kv_notif;
uint32_t sha512_error;
uint32_t sha512_notif;
uint32_t sha256_error;
uint32_t sha256_notif;
uint32_t qspi_error;
uint32_t qspi_notif;
uint32_t uart_error;
uint32_t uart_notif;
uint32_t i3c_error;
uint32_t i3c_notif;
uint32_t soc_ifc_error;
uint32_t soc_ifc_notif;
uint32_t sha512_acc_error;
uint32_t sha512_acc_notif;
} caliptra_intr_received_s;
extern volatile caliptra_intr_received_s cptra_intr_rcv;

/* --------------- Function Declarations --------------- */

// Performs all the CSR setup to configure and enable vectored external interrupts
void init_interrupts(void);

// These inline functions are used to insert event-specific functionality into the
// otherwise generic ISR that gets laid down by the parameterized macro "nonstd_veer_isr"
inline void service_doe_error_intr() {return;}
inline void service_doe_notif_intr() {return;}

inline void service_ecc_error_intr() {return;}
inline void service_ecc_notif_intr() {return;}

inline void service_hmac_error_intr() {return;}
inline void service_hmac_notif_intr() {return;}

inline void service_kv_error_intr() {return;}
inline void service_kv_notif_intr() {return;}
inline void service_sha512_error_intr() {return;}
inline void service_sha512_notif_intr() {return;}

inline void service_sha256_error_intr() {return;}
inline void service_sha256_notif_intr() {return;}

inline void service_qspi_error_intr() {return;}
inline void service_qspi_notif_intr() {return;}
inline void service_uart_error_intr() {return;}
inline void service_uart_notif_intr() {return;}
inline void service_i3c_error_intr() {return;}
inline void service_i3c_notif_intr() {return;}

inline void service_soc_ifc_error_intr() {
uint32_t * reg = (uint32_t *) (CLP_SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R);
uint32_t sts = *reg;
/* Write 1 to Clear the pending interrupt */
if (sts & SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_INTERNAL_STS_MASK) {
*reg = SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_INTERNAL_STS_MASK;
cptra_intr_rcv.soc_ifc_error |= SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_INTERNAL_STS_MASK;
}
if (sts & SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_INV_DEV_STS_MASK) {
*reg = SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_INV_DEV_STS_MASK;
cptra_intr_rcv.soc_ifc_error |= SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_INV_DEV_STS_MASK;
}
if (sts & SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_CMD_FAIL_STS_MASK) {
*reg = SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_CMD_FAIL_STS_MASK;
cptra_intr_rcv.soc_ifc_error |= SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_CMD_FAIL_STS_MASK;
}
if (sts & SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_BAD_FUSE_STS_MASK) {
*reg = SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_BAD_FUSE_STS_MASK;
cptra_intr_rcv.soc_ifc_error |= SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_BAD_FUSE_STS_MASK;
}
if (sts & SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_ICCM_BLOCKED_STS_MASK) {
*reg = SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_ICCM_BLOCKED_STS_MASK;
cptra_intr_rcv.soc_ifc_error |= SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_ICCM_BLOCKED_STS_MASK;
}
if (sts & SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_MBOX_ECC_UNC_STS_MASK) {
*reg = SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_MBOX_ECC_UNC_STS_MASK;
cptra_intr_rcv.soc_ifc_error |= SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_MBOX_ECC_UNC_STS_MASK;
}
if (sts & SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_WDT_TIMER1_TIMEOUT_STS_MASK) {
*reg = SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_WDT_TIMER1_TIMEOUT_STS_MASK;
cptra_intr_rcv.soc_ifc_error |= SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_WDT_TIMER1_TIMEOUT_STS_MASK;
}
if (sts & SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_WDT_TIMER2_TIMEOUT_STS_MASK) {
*reg = SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_WDT_TIMER2_TIMEOUT_STS_MASK;
cptra_intr_rcv.soc_ifc_error |= SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_WDT_TIMER2_TIMEOUT_STS_MASK;
}
if (sts == 0) {
VPRINTF(ERROR,"bad soc_ifc_error_intr sts:%x\n", sts);
SEND_STDOUT_CTRL(0x1);
while(1);
}
}

inline void service_soc_ifc_notif_intr () {
uint32_t * reg = (uint32_t *) (CLP_SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R);
uint32_t sts = *reg;
/* Write 1 to Clear the pending interrupt */
if (sts & SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_CMD_AVAIL_STS_MASK) {
VPRINTF(HIGH, "cmd_avail\n");
*reg = SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_CMD_AVAIL_STS_MASK;
cptra_intr_rcv.soc_ifc_notif |= SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_CMD_AVAIL_STS_MASK;
}
if (sts & SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_MBOX_ECC_COR_STS_MASK) {
VPRINTF(HIGH, "mbox_ecc_cor\n");
*reg = SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_MBOX_ECC_COR_STS_MASK;
cptra_intr_rcv.soc_ifc_notif |= SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_MBOX_ECC_COR_STS_MASK;
}
if (sts & SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_DEBUG_LOCKED_STS_MASK) {
VPRINTF(HIGH, "debug_locked\n");
*reg = SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_DEBUG_LOCKED_STS_MASK;
cptra_intr_rcv.soc_ifc_notif |= SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_DEBUG_LOCKED_STS_MASK;
}
if (sts & SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_SCAN_MODE_STS_MASK) {
VPRINTF(HIGH, "SCAN_MODE\n");
*reg = SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_SCAN_MODE_STS_MASK;
cptra_intr_rcv.soc_ifc_notif |= SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_SCAN_MODE_STS_MASK;
}
if (sts & SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_SOC_REQ_LOCK_STS_MASK) {
VPRINTF(HIGH, "soc_req_lock\n");
*reg = SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_SOC_REQ_LOCK_STS_MASK;
cptra_intr_rcv.soc_ifc_notif |= SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_SOC_REQ_LOCK_STS_MASK;
}
if (sts & SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_GEN_IN_TOGGLE_STS_MASK) {
VPRINTF(HIGH, "gen_in_toggle\n");
*reg = SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_GEN_IN_TOGGLE_STS_MASK;
cptra_intr_rcv.soc_ifc_notif |= SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_GEN_IN_TOGGLE_STS_MASK;
}
if (sts == 0) {
VPRINTF(ERROR,"bad soc_ifc_notif_intr sts:%x\n", sts);
SEND_STDOUT_CTRL(0x1);
while(1);
}
}

inline void service_sha512_acc_error_intr() {return;}
inline void service_sha512_acc_notif_intr() {
uint32_t * reg = (uint32_t *) (CLP_SHA512_ACC_CSR_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R);
uint32_t sts = *reg;
/* Write 1 to Clear the pending interrupt */
if (sts & SHA512_ACC_CSR_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_CMD_DONE_STS_MASK) {
*reg = SHA512_ACC_CSR_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_CMD_DONE_STS_MASK;
cptra_intr_rcv.sha512_acc_notif |= SHA512_ACC_CSR_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_CMD_DONE_STS_MASK;
}
if (sts == 0) {
VPRINTF(ERROR,"bad sha512_acc_notif_intr sts:%x\n", sts);
SEND_STDOUT_CTRL(0x1);
while(1);
}
}


#endif //CALIPTRA_ISR_H
Loading

0 comments on commit 56b2ade

Please sign in to comment.