diff --git a/sw/device/silicon_creator/lib/rescue/dfu.h b/sw/device/silicon_creator/lib/rescue/dfu.h index 9e7808a20fbf0..f4334efd82e9c 100644 --- a/sw/device/silicon_creator/lib/rescue/dfu.h +++ b/sw/device/silicon_creator/lib/rescue/dfu.h @@ -241,7 +241,7 @@ enum { * rescue mode. */ kUsbVendorGoogle = 0x18d1, - kUsbProuctRomExt = 0x023a, + kUsbProductRomExt = 0x023a, /** * A proprietary vendor request to set the DFU mode using a FourCC code diff --git a/sw/device/silicon_creator/lib/rescue/rescue_usb.c b/sw/device/silicon_creator/lib/rescue/rescue_usb.c index e5150a378ff1c..1a2c4e34fb33d 100644 --- a/sw/device/silicon_creator/lib/rescue/rescue_usb.c +++ b/sw/device/silicon_creator/lib/rescue/rescue_usb.c @@ -30,7 +30,7 @@ static const usb_device_descriptor_t device_desc = { .device_protocol = 0, .max_packet_size_0 = 64, .vendor = kUsbVendorGoogle, - .product = kUsbProuctRomExt, + .product = kUsbProductRomExt, .bcd_device = 0x100, .imanufacturer = 1, .iproduct = 2, @@ -39,7 +39,7 @@ static const usb_device_descriptor_t device_desc = { }; #define DFU_INTERFACE_DSCR(alt) \ - USB_INTERFACE_DSCR(/*inum=*/1, /*alt=*/alt, /*nep=*/0, \ + USB_INTERFACE_DSCR(/*inum=*/0, /*alt=*/alt, /*nep=*/0, \ /*class=*/kDfuDeviceClass, \ /*subclass=*/kDfuDeviceSubClass, \ /*protocol=*/kDfuDeviceProtocol, /*iint=*/4 + alt) diff --git a/sw/device/silicon_creator/rom_ext/e2e/rescue/BUILD b/sw/device/silicon_creator/rom_ext/e2e/rescue/BUILD index ffa7eb1e7c905..cafea6b8f1214 100644 --- a/sw/device/silicon_creator/rom_ext/e2e/rescue/BUILD +++ b/sw/device/silicon_creator/rom_ext/e2e/rescue/BUILD @@ -98,6 +98,11 @@ _CONFIGS = { for name, position in _POSITIONS.items() ] +# Important note: many of the tests in this file modify the owner +# configuration and/or expect an empty owner configuration when +# starting the test. Currently, the only way to clear this configuration +# is to clear the bitstream. + [ opentitan_test( name = "rescue_firmware_{}_{}".format(name, protocol), @@ -110,7 +115,7 @@ _CONFIGS = { binaries = { ":boot_test_{}".format(name): "payload", }, - changes_otp = True, + changes_otp = True, # See important note at the top params = config["params"], rom_ext = config["rom_ext"], setup = config["setup"], @@ -171,7 +176,7 @@ genrule( ":boot_test_{}".format(name): "payload", ":bad_rom_ext": "bad_rom_ext", }, - changes_otp = True, + changes_otp = True, # See important note at the top exit_failure = _RESCUE_ROMEXT_RESULTS[name == rxslot]["failure"], exit_success = _RESCUE_ROMEXT_RESULTS[name == rxslot]["success"].format(slot = name), image_name = "/tmp/rescue_rom_ext_{}.img".format(name), @@ -211,7 +216,7 @@ genrule( ":boot_test_slot_a": "slot_a", ":boot_test_slot_b": "slot_b", }, - changes_otp = True, + changes_otp = True, # See important note at the top params = config["params"], rom_ext = config["rom_ext"], setup = config["setup"], @@ -221,6 +226,7 @@ genrule( --exec="fpga clear-bitstream" --exec="fpga load-bitstream {bitstream}" --exec="bootstrap --clear-uart=true {firmware}" + --exec="console --non-interactive --timeout=100ms" {setup} --exec="no-op --info='##### Set next slot via the rescue protocol'" --exec="rescue {params} boot-svc set-next-bl0-slot --next=SlotB --get-response=false" @@ -250,7 +256,7 @@ genrule( ":boot_test_slot_a": "slot_a", ":boot_test_slot_b": "slot_b", }, - changes_otp = True, + changes_otp = True, # See important note at the top params = config["params"], rom_ext = config["rom_ext"], setup = config["setup"], @@ -292,7 +298,7 @@ genrule( binaries = { ":boot_test_slot_a": "payload", }, - changes_otp = True, + changes_otp = True, # See important note at the top rate = rate, test_cmd = """ --exec="transport init" @@ -327,7 +333,7 @@ genrule( binaries = { ":boot_test_slot_a": "payload", }, - changes_otp = True, + changes_otp = True, # See important note at the top rate = rate, test_cmd = """ --exec="transport init" @@ -368,7 +374,7 @@ opentitan_test( binaries = { ":boot_test_slot_a": "payload", }, - changes_otp = True, + changes_otp = True, # See important note at the top rom_ext = "//sw/device/silicon_creator/rom_ext/e2e/rescue/testdata:rom_ext_rescue_protocol_0", test_cmd = """ --exec="transport init" @@ -395,7 +401,7 @@ opentitan_test( "//hw/top_earlgrey:fpga_cw340_rom_ext": None, }, fpga = fpga_params( - changes_otp = True, + changes_otp = True, # See important note at the top rom_ext = "//sw/device/silicon_creator/rom_ext:rom_ext_xmodem_timeout", test_cmd = """ --exec="transport init" @@ -437,7 +443,7 @@ opentitan_test( "//hw/top_earlgrey:fpga_cw340_rom_ext": None, }, fpga = fpga_params( - changes_otp = True, + changes_otp = True, # See important note at the top # We configure OTP to preserve the reset reason and set the watchdog timeout # to one second. otp = "//sw/device/silicon_creator/rom_ext/e2e:otp_img_secret2_locked_preserve_reset_prod", @@ -476,7 +482,7 @@ opentitan_test( "//hw/top_earlgrey:fpga_cw340_rom_ext": None, }, fpga = fpga_params( - changes_otp = True, + changes_otp = True, # See important note at the top exit_failure = "ok: ", exit_success = "error: mode not allowed", rom_ext = "//sw/device/silicon_creator/rom_ext:rom_ext_xmodem_restricted_commands", @@ -514,7 +520,7 @@ opentitan_test( "//hw/top_earlgrey:fpga_cw340_rom_ext": None, }, fpga = fpga_params( - changes_otp = True, + changes_otp = True, # See important note at the top params = "-p spi-dfu -t gpio -v +Ioa2", rom_ext = "//sw/device/silicon_creator/rom_ext:rom_ext_spidfu_restricted_commands", setup = "--exec=\"gpio set --mode OpenDrain Ioa2\"", @@ -546,7 +552,7 @@ opentitan_test( }, fpga = fpga_params( assemble = "", - changes_otp = True, + changes_otp = True, # See important note at the top exit_success = "BFV:05525304\r\n", rom_ext = config.get( "alt_rom_ext", @@ -579,7 +585,7 @@ opentitan_test( }, fpga = fpga_params( assemble = "", - changes_otp = True, + changes_otp = True, # See important note at the top params = config["params"], rom_ext = config["rom_ext"], test_cmd = """ @@ -602,7 +608,7 @@ opentitan_test( }, fpga = fpga_params( assemble = "", - changes_otp = True, + changes_otp = True, # See important note at the top device_id = DEVICE_ID, params = config["params"], rom_ext = config["rom_ext"], @@ -631,7 +637,7 @@ opentitan_test( config["rom_ext"]: "romext", "//sw/device/silicon_creator/rom_ext/e2e/attestation:print_certs": "firmware", }, - changes_otp = True, + changes_otp = True, # See important note at the top params = config["params"], test_cmd = """ --clear-bitstream @@ -656,7 +662,7 @@ opentitan_test( "//sw/device/silicon_creator/rom_ext:rom_ext_xmodem_rescue_disability": "romext", "//sw/device/silicon_creator/rom_ext/e2e/attestation:print_certs": "firmware", }, - changes_otp = True, + changes_otp = True, # See important note at the top test_cmd = """ --clear-bitstream --bootstrap={firmware} @@ -678,7 +684,7 @@ opentitan_test( "//sw/device/silicon_creator/rom_ext:rom_ext_spidfu_rescue_disability": "romext", "//sw/device/silicon_creator/rom_ext/e2e/attestation:print_certs": "firmware", }, - changes_otp = True, + changes_otp = True, # See important note at the top params = "-p spi-dfu -t gpio -v +Ioa2", test_cmd = """ --clear-bitstream @@ -884,7 +890,7 @@ opentitan_test( "//hw/top_earlgrey:fpga_cw340_rom_ext": None, }, fpga = fpga_params( - changes_otp = True, + changes_otp = True, # See important note at the top exit_failure = "(FAIL|BFV:|mode: RESQ).*", rom_ext = "//sw/device/silicon_creator/rom_ext:rom_ext_dice_x509_slot_a", test_cmd = """ @@ -917,7 +923,7 @@ opentitan_test( "//hw/top_earlgrey:fpga_cw340_rom_ext": None, }, fpga = fpga_params( - changes_otp = True, + changes_otp = True, # See important note at the top exit_success = "mode: RESQ", rom_ext = "//sw/device/silicon_creator/rom_ext:rom_ext_xmodem_enter_on_watchdog", test_cmd = """