[test] Add remaining tests for rom_e2e_address_translation
Fixes #14483
Signed-off-by: Alphan Ulusoy <alphan@google.com>
diff --git a/sw/device/silicon_creator/rom/data/rom_e2e_testplan.hjson b/sw/device/silicon_creator/rom/data/rom_e2e_testplan.hjson
index 745b597..2bfd550 100644
--- a/sw/device/silicon_creator/rom/data/rom_e2e_testplan.hjson
+++ b/sw/device/silicon_creator/rom/data/rom_e2e_testplan.hjson
@@ -787,8 +787,7 @@
| Off | B | A | Yes |
| On | Virtual | A | No |
| On | Virtual | B | No |
- | Invalid | Virtual | A | Yes |
- | Invalid | Virtual | B | Yes |
+ | Invalid | A | A | Yes |
'''
tags: ["rom", "no_dv", "fpga", "silicon"]
stage: V2
diff --git a/sw/device/silicon_creator/rom/e2e/BUILD b/sw/device/silicon_creator/rom/e2e/BUILD
index b499bcf..0047827 100644
--- a/sw/device/silicon_creator/rom/e2e/BUILD
+++ b/sw/device/silicon_creator/rom/e2e/BUILD
@@ -206,6 +206,16 @@
MSG_BOOT_FAULT = "BFV:"
+MSG_STORE_ACCESS_FAULT = "BFV:07495202(?s:.*)BFV:07495202"
+
+MSG_ILLEGAL_INSTRUCTION_FAULT = "BFV:02495202(?s:.*)BFV:02495202"
+
+SLOT_A_OFFSET = "0x0"
+
+SLOT_B_OFFSET = "0x80000"
+
+FLASH_SIZE = "0x100000"
+
opentitan_functest(
name = "rom_ext_a_flash_a",
cw310 = cw310_params(
@@ -216,7 +226,71 @@
targets = ["cw310_rom"],
)
-# TODO(#13511): Add a positive test for slot_b.
+opentitan_multislot_flash_binary(
+ name = "rom_ext_b_flash_b_image",
+ srcs = {
+ "//sw/device/silicon_creator/rom_ext:rom_ext_slot_b": {
+ "key": "test_key_0",
+ "offset": SLOT_B_OFFSET,
+ },
+ },
+ image_size = FLASH_SIZE,
+)
+
+opentitan_functest(
+ name = "rom_ext_b_flash_b",
+ cw310 = cw310_params(
+ exit_failure = MSG_BOOT_FAULT,
+ exit_success = MSG_STARTING_ROM_EXT,
+ ),
+ key = "multislot",
+ ot_flash_binary = ":rom_ext_b_flash_b_image",
+ targets = ["cw310_rom"],
+)
+
+opentitan_multislot_flash_binary(
+ name = "rom_ext_a_flash_b_image",
+ srcs = {
+ "//sw/device/silicon_creator/rom_ext:rom_ext_slot_a": {
+ "key": "test_key_0",
+ "offset": SLOT_B_OFFSET,
+ },
+ },
+ image_size = FLASH_SIZE,
+)
+
+opentitan_functest(
+ name = "rom_ext_a_flash_b",
+ cw310 = cw310_params(
+ exit_failure = MSG_STARTING_ROM_EXT,
+ exit_success = MSG_STORE_ACCESS_FAULT,
+ ),
+ key = "multislot",
+ ot_flash_binary = ":rom_ext_a_flash_b_image",
+ targets = ["cw310_rom"],
+)
+
+opentitan_multislot_flash_binary(
+ name = "rom_ext_b_flash_a_image",
+ srcs = {
+ "//sw/device/silicon_creator/rom_ext:rom_ext_slot_b": {
+ "key": "test_key_0",
+ "offset": SLOT_A_OFFSET,
+ },
+ },
+ image_size = FLASH_SIZE,
+)
+
+opentitan_functest(
+ name = "rom_ext_b_flash_a",
+ cw310 = cw310_params(
+ exit_failure = MSG_STARTING_ROM_EXT,
+ exit_success = MSG_STORE_ACCESS_FAULT,
+ ),
+ key = "multislot",
+ ot_flash_binary = ":rom_ext_b_flash_a_image",
+ targets = ["cw310_rom"],
+)
opentitan_functest(
name = "rom_ext_v_flash_a",
@@ -228,10 +302,47 @@
targets = ["cw310_rom"],
)
+opentitan_multislot_flash_binary(
+ name = "rom_ext_v_flash_b_image",
+ srcs = {
+ "//sw/device/silicon_creator/rom_ext:rom_ext_slot_virtual": {
+ "key": "test_key_0",
+ "offset": SLOT_B_OFFSET,
+ },
+ },
+ image_size = FLASH_SIZE,
+)
+
+opentitan_functest(
+ name = "rom_ext_v_flash_b",
+ cw310 = cw310_params(
+ exit_failure = MSG_BOOT_FAULT,
+ exit_success = MSG_STARTING_ROM_EXT,
+ ),
+ key = "multislot",
+ ot_flash_binary = ":rom_ext_v_flash_b_image",
+ targets = ["cw310_rom"],
+)
+
+opentitan_functest(
+ name = "rom_ext_a_flash_a_bad_addr_trans",
+ cw310 = cw310_params(
+ exit_failure = MSG_STARTING_ROM_EXT,
+ exit_success = MSG_ILLEGAL_INSTRUCTION_FAULT,
+ ),
+ ot_flash_binary = "//sw/device/silicon_creator/rom_ext:rom_ext_slot_a_bad_address_translation",
+ targets = ["cw310_rom"],
+)
+
test_suite(
name = "address_translation",
tests = [
"rom_ext_a_flash_a",
- "rom_ext_v_flash_a"
+ "rom_ext_a_flash_a_bad_addr_trans",
+ "rom_ext_a_flash_b",
+ "rom_ext_b_flash_a",
+ "rom_ext_b_flash_b",
+ "rom_ext_v_flash_a",
+ "rom_ext_v_flash_b",
],
)
diff --git a/sw/device/silicon_creator/rom_ext/BUILD b/sw/device/silicon_creator/rom_ext/BUILD
index ecb5139..f7fd478 100644
--- a/sw/device/silicon_creator/rom_ext/BUILD
+++ b/sw/device/silicon_creator/rom_ext/BUILD
@@ -190,3 +190,22 @@
"//sw/device/silicon_creator/lib:manifest_def",
],
)
+
+manifest(
+ name = "manifest_bad_address_translation",
+ address_translation = 0,
+ identifier = CONST.ROM_EXT,
+)
+
+opentitan_flash_binary(
+ name = "rom_ext_slot_a_bad_address_translation",
+ srcs = ["rom_ext_start.S"],
+ manifest = ":manifest_bad_address_translation",
+ signed = True,
+ deps = [
+ ":ld_slot_a",
+ ":rom_ext",
+ "//sw/device/lib/crt",
+ "//sw/device/silicon_creator/lib:manifest_def",
+ ],
+)