21 if (
CONFIG(BOOTBLOCK_CONSOLE)) {
23 uart_setup(CONFIG_UART_FOR_CONSOLE, CONFIG_TTYS0_BAUD);
51 const char *fmapname =
"WP_RO";
57 die(
"Can't verify flash protections!");
76 die(
"Failed to write-protect WP_RO region!");
const struct spi_flash * boot_device_spi_flash(void)
#define printk(level,...)
void __noreturn die(const char *fmt,...)
int fmap_locate_area(const char *name, struct region *r)
void gpio_output(gpio_t gpio, int value)
__weak void bootblock_mainboard_init(void)
__weak void bootblock_mainboard_early_init(void)
#define BIOS_INFO
BIOS_INFO - Expected events.
#define BIOS_ERR
BIOS_ERR - System in incomplete state.
#define BIOS_WARNING
BIOS_WARNING - Bad configuration.
static void configure_spi_flash(void)
static void protect_ro_rgn_spi_flash(void)
Handle flash write protection.
#define ELGON_GPIO_ERROR_LED
#define ELGON_GPIO_UART_SEL
#define ELGON_GPIO_SPI_MUX
void spi_init_custom(const size_t bus, const size_t speed_hz, const size_t idle_low, const size_t idle_cycles, const size_t lsb_first, const size_t chip_select, const size_t assert_is_low)
Init SPI with custom parameters and enable SPI controller.
int uart_setup(const size_t bus, int baudrate)
Setup UART with desired BAUD rate in 8N1, no parity mode.
int uart_is_enabled(const size_t bus)
Returns the UART state.
int spi_flash_set_write_protected(const struct spi_flash *flash, const struct region *region, const enum spi_flash_status_reg_lockdown mode)
int spi_flash_is_write_protected(const struct spi_flash *flash, const struct region *region)
int spi_flash_status(const struct spi_flash *flash, u8 *reg)
@ SPI_WRITE_PROTECTION_PIN