Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions sw/device/silicon_creator/lib/rescue/rescue.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,14 +294,20 @@ hardened_bool_t rescue_detect_entry(const owner_rescue_config_t *config) {
if (rescue_requested == kHardenedBoolTrue) {
return kHardenedBoolTrue;
}
rescue_protocol_t protocol = kRescueProtocolXmodem;
rescue_detect_t detect = kRescueDetectBreak;
uint32_t index = 0;
uint32_t gpio_val = 0;
if ((hardened_bool_t)config != kHardenedBoolFalse) {
protocol = config->protocol;
detect = bitfield_field32_read(config->detect, RESCUE_DETECT);
index = bitfield_field32_read(config->detect, RESCUE_DETECT_INDEX);
gpio_val = bitfield_bit32_read(config->gpio, RESCUE_GPIO_VALUE_BIT);
}
dbg_printf("info: rescue protocol %c\r\n", rescue_type);
if (protocol != rescue_type) {
dbg_printf("warning: rescue configured for protocol %c\r\n", protocol);
}
switch (detect) {
case kRescueDetectNone:
break;
Expand Down
2 changes: 2 additions & 0 deletions sw/device/silicon_creator/lib/rescue/rescue.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ typedef struct RescueState {
uint8_t data[2048];
} rescue_state_t;

extern const uint32_t rescue_type;

/**
* Handle rescue modes that involve sending data to the host.
*
Expand Down
2 changes: 2 additions & 0 deletions sw/device/silicon_creator/lib/rescue/rescue_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"

const uint32_t rescue_type = kRescueProtocolSpiDfu;

enum {
/**
* Base address of the spi_device registers.
Expand Down
2 changes: 2 additions & 0 deletions sw/device/silicon_creator/lib/rescue/rescue_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"

const uint32_t rescue_type = kRescueProtocolUsbDfu;

static const usb_device_descriptor_t device_desc = {
.length = (uint8_t)sizeof(usb_device_descriptor_t),
.descriptor_type = kUsbDescTypeDevice,
Expand Down
2 changes: 2 additions & 0 deletions sw/device/silicon_creator/lib/rescue/rescue_xmodem.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include "sw/device/silicon_creator/lib/rescue/rescue.h"
#include "sw/device/silicon_creator/lib/rescue/xmodem.h"

const uint32_t rescue_type = kRescueProtocolXmodem;

// All of the xmodem functions accept an opaque iohandle pointer.
// The iohandle is used to facilitate unit tests and doesn't have
// any function in real firmware.
Expand Down
Loading