Skip to content

Commit a46ebbd

Browse files
committed
merged main
2 parents cce9b92 + 2d4e80c commit a46ebbd

File tree

13 files changed

+413
-12
lines changed

13 files changed

+413
-12
lines changed

.github/scripts/license_header_check.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ exclude_regs='*_reg*.{sv,rdl}'
6363
exclude_csr='*_csr*.*'
6464
exclude_file='{sglint_waivers,pr_hash,pr_timestamp,.gitmodules,.git-comodules,.gitignore,spyglass_lint.policy,ascent.ctl,clp_mapfile,c_sample.c}'
6565
# excluding OT Files.
66-
exclude_specific_files='{dmi_cdc.sv,dmi_jtag.sv,dmi_jtag_tap.sv,dm_pkg.sv,caliptra_rom_manuf_dbg,caliptra_rom_uds_prog,caliptra_rom_prod_dbg,cptra_fw_test_rom_fw}'
66+
exclude_specific_files='{dmi_cdc.sv,dmi_jtag.sv,dmi_jtag_tap.sv,dm_pkg.sv,caliptra_rom_manuf_dbg,caliptra_rom_uds_prog,caliptra_rom_prod_dbg,cptra_fw_test_rom_fw,cptra_to_mcu_sram_fw_test_rom_fw}'
6767

6868
apache_patn='Licensed under the Apache License'
6969

.github/workflow_metadata/pr_hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9367c06db54385c6e5b0ba0cc4e48c50f97f336f8123fb8e2decabd66f4b042be113c397145cc1b95b44774e6857326f
1+
22e8401b4c673ddab48e2a37f4423c0425fa46b3e0fb88b02f8c1522e872d19157098cffe9a6e002fb2ec8ab2e213477
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1748484167
1+
1748560868

docs/CaliptraSSCoverage.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## Caliptra Subsystem Coverage Dashboard
2+
This section provides an overview of the coverage for the Caliptra Subsystem (SS) and its components. Each subsystem block is linked to its coverage dashboard and notes for further insights.
3+
4+
| Subsystem Block | Description | Link to Coverage | Coverage Analysis Notes |
5+
|----------------------|----------------------------------|-------------------|--------------------------|
6+
| **Caliptra SS Top** | Top-level block of the Caliptra Subsystem. | [SS Top Coverage](#) | [Coming Soon](#) |
7+
| **MCU** | Instance of the VeeR-EL2 RISC-V core. | [RISCV VeeR El2 Coverage](#) | [Coming Soon](#) |
8+
| **I3C** | Core implementing the I3C protocol. | [I3C Coverage](#) | [Coming Soon](#) |
9+
| **MCI** | Memory Controller Interface. | [MCI Coverage](#) | [Coming Soon](#) |
10+
| **FCC (Baseline)** | Fuse Controller for baseline configuration. | [FCC Baseline Coverage](#) | [Coming Soon](#) |
11+
| **FCC (Baseline + Delta)** | Fuse Controller with delta changes. | [FCC Coverage](#) | [Coming Soon](#) |
12+
| **LCC (Baseline)** | Life cycle controller baseline config. | [LCC Baseline Coverage](#) | [Coming Soon](#) |
13+
| **AXI2TLUL** | AXI to TLUL protocol conversion gasket. | [AXI2TLUL Gasket Coverage](#) | [Coming Soon](#) |
14+
15+
---
16+
17+
## Caliptra Core Coverage Dashboard
18+
This section provides coverage details for the Caliptra Core and its associated components. Each component is linked to its coverage dashboard and notes for further insights.
19+
20+
| Subsystem Block | Description | Link to Coverage | Coverage Analysis Notes |
21+
|----------------------|----------------------------------|-------------------|--------------------------|
22+
| **Caliptra Core Top** | Top-level block of the Caliptra Core. | [Caliptra Core Coverage Dashboard](#) | [Coming Soon](#) |
23+
| **VeerEl2 Core** | Instance of the VeeR-EL2 RISC-V core. | [RISCV VeeR El2 Coverage](#) | [Coming Soon](#) |
24+
| **MLDSA** | Multi-Lane Digital Signature Accelerator. | [Coming Soon](#) | [Coming Soon](#) |
25+
| **AES** | Advanced Encryption Standard block for cryptographic operations. | [Coming Soon](#) | [Coming Soon](#) |
26+
| **SOC Interface** | Interface block for System-on-Chip communication. | [Coming Soon](#) | [Coming Soon](#) |
Binary file not shown.
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# Copyright 2020 Western Digital Corporation or its affiliates.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
GCC_PREFIX = riscv64-unknown-elf
17+
BUILD_DIR = $(CURDIR)
18+
today=$(shell date +%Y%m%d)
19+
20+
# Define test name
21+
TESTNAME ?= cptra_fw_test_rom
22+
TESTNAME_fw = $(TESTNAME)_fw
23+
TEST_DIR = $(CALIPTRA_SS_ROOT)/src/integration/test_suites/$(TESTNAME)
24+
25+
VPATH = $(TEST_DIR) $(BUILD_DIR)
26+
27+
# Offset calculations for fetching keys from ROM image
28+
KEY_MANIFEST_ECC_PK_COUNT = 1
29+
KEY_MANIFEST_ECC_PK_SIZE = 196
30+
KEY_MANIFEST_ECC_PK_ROM_OFFSET = 12
31+
KEY_MANIFEST_ECC_PK_LENGTH = $(shell bc <<< "$(KEY_MANIFEST_ECC_PK_COUNT)*$(KEY_MANIFEST_ECC_PK_SIZE)")
32+
33+
KEY_MANIFEST_PQC_PK_COUNT = 1
34+
KEY_MANIFEST_PQC_PK_SIZE = 1540
35+
KEY_MANIFEST_PQC_PK_ROM_OFFSET = $(shell bc <<< "$(KEY_MANIFEST_ECC_PK_ROM_OFFSET) + $(KEY_MANIFEST_ECC_PK_COUNT)*$(KEY_MANIFEST_ECC_PK_SIZE)")
36+
KEY_MANIFEST_PQC_PK_LENGTH = $(shell bc <<< "$(KEY_MANIFEST_PQC_PK_COUNT)*$(KEY_MANIFEST_PQC_PK_SIZE)")
37+
38+
KEY_MANIFEST_PK_LENGTH = $(shell bc <<< "$(KEY_MANIFEST_PQC_PK_LENGTH) + $(KEY_MANIFEST_ECC_PK_LENGTH)")
39+
40+
OWNER_ECC_PK_SIZE = 96
41+
OWNER_ECC_PK_ROM_OFFSET = 9168
42+
OWNER_PQC_PK_SIZE = 2592
43+
OWNER_PQC_PK_ROM_OFFSET = $(shell bc <<< "$(OWNER_ECC_PK_ROM_OFFSET) + $(OWNER_ECC_PK_SIZE)")
44+
45+
OWNER_PK_LENGTH = $(shell bc <<< "$(OWNER_PQC_PK_SIZE) + $(OWNER_ECC_PK_SIZE)")
46+
47+
# Targets
48+
all: program.hex
49+
50+
clean:
51+
rm -rf *.log *.s *.hex *.dis *.size *.tbl .map *.map snapshots \
52+
*.exe obj* *.o csrc *.csv work \
53+
dataset.asdb library.cfg vsimsa.cfg \
54+
*.h
55+
56+
############ TEST build ###############################
57+
58+
# Build program.hex from RUST executable
59+
program.hex: vendor_pk_hash_val.hex owner_pk_hash_val.hex fw_update.hex $(BUILD_DIR)/$(TESTNAME).extracted $(TEST_DIR)/$(TESTNAME).bin $(TEST_DIR)/$(TESTNAME_fw)
60+
@-echo "Building program.hex from $(TESTNAME) using Crypto Test rules for pre-compiled RUST executables"
61+
$(GCC_PREFIX)-objcopy -I binary -O verilog --pad-to 0xC000 --gap-fill 0xFF --no-change-warnings $(BUILD_DIR)/$(TESTNAME) program.hex
62+
du -b $(BUILD_DIR)/$(TESTNAME) | cut -f1 > $(BUILD_DIR)/$(TESTNAME).size
63+
64+
fw_update.hex: $(BUILD_DIR)/$(TESTNAME).extracted
65+
@-echo "Building fw_update.hex from $(TESTNAME_fw) using binary objcopy pre-compiled RUST package"
66+
$(GCC_PREFIX)-objcopy -I binary -O verilog --pad-to 0x20000 --gap-fill 0xFF --no-change-warnings $(BUILD_DIR)/$(TESTNAME_fw) fw_update.hex
67+
du -b $(BUILD_DIR)/$(TESTNAME_fw) | cut -f1 > $(BUILD_DIR)/fw_update.size
68+
69+
# Extract public keys from ROM binary and dump as hex values
70+
vendor_pk_hash_val.hex: vendor_pk_val.bin
71+
sha384sum vendor_pk_val.bin | sed 's,\s\+\S\+$$,,' > $(BUILD_DIR)/vendor_pk_hash_val.hex
72+
73+
vendor_pk_val.bin: $(BUILD_DIR)/$(TESTNAME).extracted
74+
dd ibs=1 obs=1 if=$(BUILD_DIR)/$(TESTNAME_fw) of=vendor_pk_val.bin skip=$(KEY_MANIFEST_ECC_PK_ROM_OFFSET) count=$(KEY_MANIFEST_PK_LENGTH)
75+
76+
owner_pk_hash_val.hex: owner_pk_val.bin
77+
sha384sum owner_pk_val.bin | sed 's,\s\+\S\+$$,,' > owner_pk_hash_val.hex
78+
79+
owner_pk_val.bin: $(BUILD_DIR)/$(TESTNAME).extracted
80+
dd ibs=1 obs=1 if=$(BUILD_DIR)/$(TESTNAME_fw) of=owner_pk_val.bin skip=$(OWNER_ECC_PK_ROM_OFFSET) count=$(OWNER_PK_LENGTH)
81+
82+
$(BUILD_DIR)/$(TESTNAME).extracted: $(TEST_DIR)/$(TESTNAME).bin $(TEST_DIR)/$(TESTNAME_fw) copy_caliptra_hex_files
83+
cp $(TEST_DIR)/$(TESTNAME).bin $(BUILD_DIR)/$(TESTNAME)
84+
cp $(TEST_DIR)/$(TESTNAME_fw) $(BUILD_DIR)/$(TESTNAME_fw)
85+
touch $(BUILD_DIR)/$(TESTNAME).extracted
86+
87+
#-- following two files copied to build directory to support csr_write_mpmc_halt() at the end of the test
88+
copy_caliptra_hex_files:
89+
cp $(CALIPTRA_SS_ROOT)/third_party/caliptra-rtl/src/integration/test_suites/includes/caliptra_defines.h $(BUILD_DIR)
90+
cp $(CALIPTRA_SS_ROOT)/third_party/caliptra-rtl/src/integration/test_suites/includes/defines.h $(BUILD_DIR)
91+
cp $(CALIPTRA_SS_ROOT)/third_party/caliptra-rtl/src/integration/rtl/caliptra_reg.h $(BUILD_DIR)
92+
93+
help:
94+
@echo Make sure the environment variable RV_ROOT is set.
95+
echo Possible targets: help clean all program.hex
96+
97+
.PHONY: help clean
98+
99+
.ONESHELL:
Binary file not shown.
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
//********************************************************************************
2+
// SPDX-License-Identifier: Apache-2.0
3+
//
4+
//
5+
// Licensed under the Apache License, Version 2.0 (the "License");
6+
// you may not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing, software
12+
// distributed under the License is distributed on an "AS IS" BASIS,
13+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
// See the License for the specific language governing permissions and
15+
// limitations under the License.
16+
//********************************************************************************
17+
//********************************************************************************
18+
// SPDX-License-Identifier: Apache-2.0
19+
//
20+
//
21+
// Licensed under the Apache License, Version 2.0 (the \"License\");
22+
// you may not use this file except in compliance with the License.
23+
// You may obtain a copy of the License at
24+
//
25+
// http://www.apache.org/licenses/LICENSE-2.0
26+
//
27+
// Unless required by applicable law or agreed to in writing, software
28+
// distributed under the License is distributed on an \"AS IS\" BASIS,
29+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30+
// See the License for the specific language governing permissions and
31+
// limitations under the License.
32+
//********************************************************************************"
33+
34+
#include "soc_address_map.h"
35+
#include "printf.h"
36+
#include "riscv_hw_if.h"
37+
#include "soc_ifc.h"
38+
#include "caliptra_ss_lib.h"
39+
#include "string.h"
40+
#include "stdint.h"
41+
#include "veer-csr.h"
42+
43+
volatile char* stdout = (char *)SOC_MCI_TOP_MCI_REG_DEBUG_OUT;
44+
// volatile char* stdout = (char *)0xd0580000;
45+
46+
#ifdef CPT_VERBOSITY
47+
enum printf_verbosity verbosity_g = CPT_VERBOSITY;
48+
#else
49+
enum printf_verbosity verbosity_g = LOW;
50+
#endif
51+
52+
53+
void main (void) {
54+
55+
int argc=0;
56+
char *argv[1];
57+
uint32_t i3c_reg_data;
58+
int err_count = 0;
59+
60+
// Initialize the printf library
61+
VPRINTF(LOW, "=== MCU boot.. started == \n");
62+
63+
//-- Boot MCU
64+
VPRINTF(LOW, "MCU: Booting...\n");
65+
boot_mcu();
66+
boot_i3c_core();
67+
trigger_caliptra_go();
68+
mcu_cptra_user_init();
69+
wait_for_cptra_ready_for_mb_processing();
70+
71+
//-- setting bypass mode for I3C
72+
i3c_reg_data = 0x00000000 | I3CCSR_I3C_EC_SOCMGMTIF_REC_INTF_CFG_REC_INTF_BYPASS_MASK;
73+
lsu_write_32(SOC_I3CCSR_I3C_EC_SOCMGMTIF_REC_INTF_CFG, i3c_reg_data);
74+
VPRINTF(LOW,"I3C BYPASS mode set");
75+
76+
VPRINTF(LOW, "=== MCU boot.. completed == \n");
77+
78+
// Check if the I3C core is in the correct state
79+
i3c_reg_data = lsu_read_32(SOC_I3CCSR_I3C_EC_SECFWRECOVERYIF_PROT_CAP_0);
80+
if (i3c_reg_data != 0x2050434f) {
81+
VPRINTF(LOW, "Error : I3C core not in the correct state\n");
82+
err_count++;
83+
}
84+
85+
i3c_reg_data = lsu_read_32(SOC_I3CCSR_I3C_EC_SECFWRECOVERYIF_PROT_CAP_1);
86+
if (i3c_reg_data != 0x56434552) {
87+
VPRINTF(LOW, "I3C core not in the correct state\n");
88+
err_count++;
89+
}
90+
91+
// Read DEVICE_ID
92+
i3c_reg_data = lsu_read_32(SOC_I3CCSR_I3C_EC_SECFWRECOVERYIF_DEVICE_ID_0);
93+
// TODO : add data checking
94+
95+
// Read HW_STATUS
96+
i3c_reg_data = lsu_read_32(SOC_I3CCSR_I3C_EC_SECFWRECOVERYIF_HW_STATUS);
97+
// TODO : add data checking
98+
99+
// Read DEVICE_STATUS_0
100+
i3c_reg_data = lsu_read_32(SOC_I3CCSR_I3C_EC_SECFWRECOVERYIF_DEVICE_STATUS_0);
101+
// TODO : add data checking
102+
103+
104+
// waiting for recovery start
105+
while (1) {
106+
107+
i3c_reg_data = lsu_read_32(SOC_I3CCSR_I3C_EC_SECFWRECOVERYIF_DEVICE_STATUS_0);
108+
// i3c_reg_data == 0x00000003
109+
i3c_reg_data = i3c_reg_data & 0x00000003;
110+
VPRINTF(LOW, "I3C core device status is 0x%x\n", i3c_reg_data);
111+
if (i3c_reg_data == 0x00000003) {
112+
VPRINTF(LOW, "I3C core in recovery mode\n");
113+
break;
114+
}
115+
// Wait for the I3C core to finish the test
116+
VPRINTF(LOW, "Waiting for recovery start\n");
117+
mcu_sleep(1000);
118+
119+
}
120+
121+
//-- Read Recovery Status register for 0x00000001
122+
i3c_reg_data = lsu_read_32(SOC_I3CCSR_I3C_EC_SECFWRECOVERYIF_RECOVERY_STATUS);
123+
if (i3c_reg_data != 0x00000001) {
124+
VPRINTF(LOW, "I3C core recovery status is not set to 0x1\n");
125+
err_count++;
126+
}
127+
128+
//-- writing RECOVERY_CTRL register
129+
i3c_reg_data = 0x00000000;
130+
lsu_write_32(SOC_I3CCSR_I3C_EC_SECFWRECOVERYIF_RECOVERY_CTRL, i3c_reg_data);
131+
VPRINTF(LOW, "I3C core recovery control register is set to 0x0\n");
132+
133+
//-- writing INDIRECT_FIFO_CTRL Register
134+
i3c_reg_data = 0x00000100;
135+
lsu_write_32(SOC_I3CCSR_I3C_EC_SECFWRECOVERYIF_INDIRECT_FIFO_CTRL_0, i3c_reg_data);
136+
VPRINTF(LOW, "I3C core indirect FIFO control register is set to 0x0100\n");
137+
138+
//-- writing INDIRECT_FIFO_CTRL Register 1
139+
i3c_reg_data = 0x00000004;
140+
lsu_write_32(SOC_I3CCSR_I3C_EC_SECFWRECOVERYIF_INDIRECT_FIFO_CTRL_1, i3c_reg_data);
141+
VPRINTF(LOW, "I3C core indirect FIFO control register 1 is set to 0x00000001\n");
142+
143+
//-- writing INDIRECT_FIFO_DATA Register
144+
i3c_reg_data = 0x12345678;
145+
lsu_write_32(SOC_I3CCSR_I3C_EC_TTI_TX_DATA_PORT, i3c_reg_data);
146+
VPRINTF(LOW, "I3C core indirect FIFO data register is set to 0x12345678\n");
147+
148+
i3c_reg_data = 0xABCDCAFE;
149+
lsu_write_32(SOC_I3CCSR_I3C_EC_TTI_TX_DATA_PORT, i3c_reg_data);
150+
VPRINTF(LOW, "I3C core indirect FIFO data register is set to 0xABCDCAFE\n");
151+
152+
i3c_reg_data = 0x23456789;
153+
lsu_write_32(SOC_I3CCSR_I3C_EC_TTI_TX_DATA_PORT, i3c_reg_data);
154+
VPRINTF(LOW, "I3C core indirect FIFO data register is set to 0x23456789\n");
155+
156+
i3c_reg_data = 0xFEEDCAFE;
157+
lsu_write_32(SOC_I3CCSR_I3C_EC_TTI_TX_DATA_PORT, i3c_reg_data);
158+
VPRINTF(LOW, "I3C core indirect FIFO data register is set to 0xFEEDCAFE\n");
159+
160+
//-- writing RECOVERY_CTRL Register
161+
i3c_reg_data = 0x00000F00;
162+
lsu_write_32(SOC_I3CCSR_I3C_EC_SOCMGMTIF_REC_INTF_REG_W1C_ACCESS, i3c_reg_data);
163+
VPRINTF(LOW, "I3C core recovery control register set to IMAGE ACTIVATION\n");
164+
165+
// -- Read Recovery Status register to indicate RECOVERY SUCCESS by reading value 0x00000003
166+
while(1){
167+
i3c_reg_data = lsu_read_32(SOC_I3CCSR_I3C_EC_SECFWRECOVERYIF_RECOVERY_STATUS);
168+
if( i3c_reg_data != 0x00000002 || i3c_reg_data != 0x00000003 || i3c_reg_data != 0x00000004) {
169+
VPRINTF(LOW, "I3C core recovery status is not set to expected value\n");
170+
err_count++;
171+
}
172+
if (i3c_reg_data == 0x00000003) {
173+
VPRINTF(LOW, "I3C core recovery status is set to 0x3\n");
174+
break;
175+
}
176+
// Wait for the I3C core to finish the test
177+
VPRINTF(LOW, "Waiting for recovery status update\n");
178+
mcu_sleep(1000);
179+
}
180+
181+
182+
//Halt the core to wait for Caliptra to finish the test
183+
csr_write_mpmc_halt();
184+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
seed: 1
2+
testname: mcu_axi_streaming_boot_test_rom
3+
pre-exec: |
4+
echo "Running pre_exec for test mcu_axi_streaming_boot_test_rom " &&
5+
CALIPTRA_ROOT=$CALIPTRA_SS_ROOT/third_party/caliptra-rtl make -f $CALIPTRA_SS_ROOT/third_party/caliptra-rtl/tools/scripts/Makefile TEST_DIR=$CALIPTRA_SS_ROOT/src/integration/test_suites/cptra_test_rom_streaming_boot CALIPTRA_INTERNAL_TRNG=0 AUX_HEADER_FILES=$CALIPTRA_SS_ROOT/src/integration/rtl/soc_address_map.h TESTNAME=cptra_test_rom_streaming_boot program.hex &&
6+
make -f $CALIPTRA_SS_ROOT/tools/scripts/Makefile TESTNAME=mcu_axi_streaming_boot_test_rom mcu_program.hex

0 commit comments

Comments
 (0)