Pirmin Vogel | 7874970 | 2021-08-06 09:18:37 +0200 | [diff] [blame] | 1 | diff --git a/sw/device/boot_rom/rom_crt.S b/sw/device/boot_rom/rom_crt.S |
Timothy Trippel | bd975db | 2021-09-17 20:18:31 +0000 | [diff] [blame] | 2 | index acff1a477..1c8e29d86 100644 |
Pirmin Vogel | 7874970 | 2021-08-06 09:18:37 +0200 | [diff] [blame] | 3 | --- a/sw/device/boot_rom/rom_crt.S |
| 4 | +++ b/sw/device/boot_rom/rom_crt.S |
Timothy Trippel | bd975db | 2021-09-17 20:18:31 +0000 | [diff] [blame] | 5 | @@ -81,19 +81,6 @@ _reset_start: |
Pirmin Vogel | 7874970 | 2021-08-06 09:18:37 +0200 | [diff] [blame] | 6 | _start: |
| 7 | .globl _start |
Timothy Trippel | bd975db | 2021-09-17 20:18:31 +0000 | [diff] [blame] | 8 | |
Pirmin Vogel | 7874970 | 2021-08-06 09:18:37 +0200 | [diff] [blame] | 9 | - // Enable entropy complex - this is not the full enable |
| 10 | - li a0, TOP_EARLGREY_ENTROPY_SRC_BASE_ADDR |
Timothy Chen | ab23a91 | 2021-09-07 15:00:34 -0700 | [diff] [blame] | 11 | - li t0, 0xa0a |
Pirmin Vogel | 7874970 | 2021-08-06 09:18:37 +0200 | [diff] [blame] | 12 | - sw t0, ENTROPY_SRC_CONF_REG_OFFSET(a0) |
| 13 | - |
| 14 | - li a0, TOP_EARLGREY_CSRNG_BASE_ADDR |
Timothy Chen | 8d3b76c | 2021-08-26 10:42:32 -0700 | [diff] [blame] | 15 | - li t0, 0xaaa |
Pirmin Vogel | 7874970 | 2021-08-06 09:18:37 +0200 | [diff] [blame] | 16 | - sw t0, CSRNG_CTRL_REG_OFFSET(a0) |
| 17 | - |
| 18 | - li a0, TOP_EARLGREY_EDN0_BASE_ADDR |
Mark Branstad | fc7059c | 2021-09-07 16:35:55 -0700 | [diff] [blame] | 19 | - li t0, 0x55aa |
Pirmin Vogel | 7874970 | 2021-08-06 09:18:37 +0200 | [diff] [blame] | 20 | - sw t0, EDN_CTRL_REG_OFFSET(a0) |
| 21 | - |
| 22 | // Request memory scrambling and init |
| 23 | li a0, TOP_EARLGREY_SRAM_CTRL_MAIN_REGS_BASE_ADDR |
| 24 | li a1, (1<<SRAM_CTRL_CTRL_RENEW_SCR_KEY_BIT)|(1<<SRAM_CTRL_CTRL_INIT_BIT) |
| 25 | diff --git a/sw/device/lib/pinmux.c b/sw/device/lib/pinmux.c |
| 26 | index 8861f54ba..8442bb896 100644 |
| 27 | --- a/sw/device/lib/pinmux.c |
| 28 | +++ b/sw/device/lib/pinmux.c |
| 29 | @@ -60,24 +60,4 @@ void pinmux_init(void) { |
| 30 | reg_offset = kTopEarlgreyPinmuxMioOutIoc11 << 2; |
| 31 | mask = PINMUX_MIO_OUTSEL_0_OUT_0_MASK; |
| 32 | mmio_region_write32(reg32, reg_offset, reg_value & mask); |
| 33 | - |
| 34 | - // Configure UART1 RX input to connect to MIO pad IOC8 |
| 35 | - reg32 = mmio_region_from_addr(PINMUX0_BASE_ADDR + |
| 36 | - PINMUX_MIO_PERIPH_INSEL_0_REG_OFFSET); |
| 37 | - reg_value = kTopEarlgreyPinmuxInselIoc8; |
| 38 | - // We've got one insel configuration field per register. Hence, we have to |
| 39 | - // convert the enumeration index into a byte address using << 2. |
| 40 | - reg_offset = kTopEarlgreyPinmuxPeripheralInUart1Rx << 2; |
| 41 | - mask = PINMUX_MIO_PERIPH_INSEL_0_IN_0_MASK; |
| 42 | - mmio_region_write32(reg32, reg_offset, reg_value & mask); |
| 43 | - |
| 44 | - // Configure UART1 TX output to connect to MIO pad IOC9 |
| 45 | - reg32 = |
| 46 | - mmio_region_from_addr(PINMUX0_BASE_ADDR + PINMUX_MIO_OUTSEL_0_REG_OFFSET); |
| 47 | - reg_value = kTopEarlgreyPinmuxOutselUart1Tx; |
| 48 | - // We've got one insel configuration field per register. Hence, we have to |
| 49 | - // convert the enumeration index into a byte address using << 2. |
| 50 | - reg_offset = kTopEarlgreyPinmuxMioOutIoc9 << 2; |
| 51 | - mask = PINMUX_MIO_OUTSEL_0_OUT_0_MASK; |
| 52 | - mmio_region_write32(reg32, reg_offset, reg_value & mask); |
| 53 | } |
| 54 | diff --git a/sw/device/sca/aes_serial.c b/sw/device/sca/aes_serial.c |
Timothy Trippel | dd5893e | 2021-09-27 19:23:09 +0000 | [diff] [blame] | 55 | index 5dc1286af..1e2dced96 100644 |
Pirmin Vogel | 7874970 | 2021-08-06 09:18:37 +0200 | [diff] [blame] | 56 | --- a/sw/device/sca/aes_serial.c |
| 57 | +++ b/sw/device/sca/aes_serial.c |
Timothy Trippel | dd5893e | 2021-09-27 19:23:09 +0000 | [diff] [blame] | 58 | @@ -198,18 +198,13 @@ int main(void) { |
Alphan Ulusoy | 8e3171d | 2021-08-13 11:21:05 -0400 | [diff] [blame] | 59 | sca_init(kScaTriggerSourceAes, kScaPeripheralAes); |
Pirmin Vogel | 7874970 | 2021-08-06 09:18:37 +0200 | [diff] [blame] | 60 | sca_get_uart(&uart1); |
Timothy Trippel | bd975db | 2021-09-17 20:18:31 +0000 | [diff] [blame] | 61 | |
Pirmin Vogel | 7874970 | 2021-08-06 09:18:37 +0200 | [diff] [blame] | 62 | - LOG_INFO("Running AES serial"); |
| 63 | - |
Pirmin Vogel | 7874970 | 2021-08-06 09:18:37 +0200 | [diff] [blame] | 64 | - LOG_INFO("Initializing simple serial interface to capture board."); |
| 65 | simple_serial_init(uart1); |
| 66 | simple_serial_register_handler('k', aes_serial_set_key); |
| 67 | simple_serial_register_handler('p', aes_serial_single_encrypt); |
| 68 | simple_serial_register_handler('b', aes_serial_batch_encrypt); |
Timothy Trippel | bd975db | 2021-09-17 20:18:31 +0000 | [diff] [blame] | 69 | |
Pirmin Vogel | 7874970 | 2021-08-06 09:18:37 +0200 | [diff] [blame] | 70 | - LOG_INFO("Initializing AES unit."); |
| 71 | init_aes(); |
Timothy Trippel | bd975db | 2021-09-17 20:18:31 +0000 | [diff] [blame] | 72 | |
Pirmin Vogel | 7874970 | 2021-08-06 09:18:37 +0200 | [diff] [blame] | 73 | - LOG_INFO("Starting simple serial packet handling."); |
| 74 | while (true) { |
| 75 | simple_serial_process_packet(); |
| 76 | } |
| 77 | diff --git a/sw/device/sca/lib/sca.c b/sw/device/sca/lib/sca.c |
Timothy Trippel | dd5893e | 2021-09-27 19:23:09 +0000 | [diff] [blame] | 78 | index ef4443533..5629a15d8 100644 |
Pirmin Vogel | 7874970 | 2021-08-06 09:18:37 +0200 | [diff] [blame] | 79 | --- a/sw/device/sca/lib/sca.c |
| 80 | +++ b/sw/device/sca/lib/sca.c |
Alphan Ulusoy | 8e3171d | 2021-08-13 11:21:05 -0400 | [diff] [blame] | 81 | @@ -56,7 +56,6 @@ enum { |
Pirmin Vogel | 7874970 | 2021-08-06 09:18:37 +0200 | [diff] [blame] | 82 | kRvTimerHart = kTopEarlgreyPlicTargetIbex0, |
| 83 | }; |
Timothy Trippel | bd975db | 2021-09-17 20:18:31 +0000 | [diff] [blame] | 84 | |
Pirmin Vogel | 7874970 | 2021-08-06 09:18:37 +0200 | [diff] [blame] | 85 | -static dif_uart_t uart0; |
| 86 | static dif_uart_t uart1; |
| 87 | static dif_gpio_t gpio; |
| 88 | static dif_rv_timer_t timer; |
Timothy Trippel | bd975db | 2021-09-17 20:18:31 +0000 | [diff] [blame] | 89 | @@ -75,13 +74,9 @@ static void sca_init_uart(void) { |
| 90 | }; |
| 91 | |
| 92 | IGNORE_RESULT(dif_uart_init( |
| 93 | - mmio_region_from_addr(TOP_EARLGREY_UART0_BASE_ADDR), &uart0)); |
Pirmin Vogel | 7874970 | 2021-08-06 09:18:37 +0200 | [diff] [blame] | 94 | - IGNORE_RESULT(dif_uart_configure(&uart0, uart_config)); |
| 95 | - base_uart_stdout(&uart0); |
| 96 | - |
| 97 | - IGNORE_RESULT(dif_uart_init( |
Timothy Trippel | bd975db | 2021-09-17 20:18:31 +0000 | [diff] [blame] | 98 | - mmio_region_from_addr(TOP_EARLGREY_UART1_BASE_ADDR), &uart1)); |
| 99 | + mmio_region_from_addr(TOP_EARLGREY_UART0_BASE_ADDR), &uart1)); |
Pirmin Vogel | 7874970 | 2021-08-06 09:18:37 +0200 | [diff] [blame] | 100 | IGNORE_RESULT(dif_uart_configure(&uart1, uart_config)); |
| 101 | + base_uart_stdout(&uart1); |
| 102 | } |
Timothy Trippel | bd975db | 2021-09-17 20:18:31 +0000 | [diff] [blame] | 103 | |
Pirmin Vogel | 7874970 | 2021-08-06 09:18:37 +0200 | [diff] [blame] | 104 | /** |
Timothy Trippel | dd5893e | 2021-09-27 19:23:09 +0000 | [diff] [blame] | 105 | @@ -148,32 +143,11 @@ void handler_irq_timer(void) { |
Alphan Ulusoy | 8e3171d | 2021-08-13 11:21:05 -0400 | [diff] [blame] | 106 | * @param disable Set of peripherals to disable. |
| 107 | */ |
| 108 | void sca_disable_peripherals(sca_peripherals_t disable) { |
| 109 | - if (disable & kScaPeripheralEdn) { |
| 110 | - // TODO(#5465): Replace with `dif_edn_stop()` when it is implemented. |
| 111 | - mmio_region_write32(mmio_region_from_addr(TOP_EARLGREY_EDN0_BASE_ADDR), |
| 112 | - EDN_CTRL_REG_OFFSET, EDN_CTRL_REG_RESVAL); |
| 113 | - mmio_region_write32(mmio_region_from_addr(TOP_EARLGREY_EDN1_BASE_ADDR), |
| 114 | - EDN_CTRL_REG_OFFSET, EDN_CTRL_REG_RESVAL); |
| 115 | - } |
| 116 | - if (disable & kScaPeripheralCsrng) { |
| 117 | - // TODO(#7837): Replace with `dif_csrng_stop()` when it is implemented. |
| 118 | - mmio_region_write32(mmio_region_from_addr(TOP_EARLGREY_CSRNG_BASE_ADDR), |
| 119 | - CSRNG_CTRL_REG_OFFSET, CSRNG_CTRL_REG_RESVAL); |
| 120 | - } |
| 121 | - if (disable & kScaPeripheralEntropy) { |
| 122 | - const dif_entropy_src_params_t entropy_params = { |
| 123 | - .base_addr = mmio_region_from_addr(TOP_EARLGREY_ENTROPY_SRC_BASE_ADDR), |
| 124 | - }; |
| 125 | - dif_entropy_src_t entropy; |
| 126 | - IGNORE_RESULT(dif_entropy_src_init(entropy_params, &entropy)); |
| 127 | - IGNORE_RESULT(dif_entropy_src_disable(&entropy)); |
| 128 | - } |
Pirmin Vogel | 7874970 | 2021-08-06 09:18:37 +0200 | [diff] [blame] | 129 | - |
| 130 | // Disable HMAC, KMAC, OTBN and USB clocks through CLKMGR DIF. |
| 131 | const dif_clkmgr_params_t clkmgr_params = { |
| 132 | .base_addr = mmio_region_from_addr(TOP_EARLGREY_CLKMGR_AON_BASE_ADDR), |
| 133 | .last_gateable_clock = CLKMGR_CLK_ENABLES_CLK_USB_PERI_EN_BIT, |
| 134 | - .last_hintable_clock = CLKMGR_CLK_HINTS_STATUS_CLK_MAIN_OTBN_VAL_BIT}; |
| 135 | + .last_hintable_clock = CLKMGR_CLK_HINTS_CLK_MAIN_HMAC_HINT_BIT}; |
| 136 | dif_clkmgr_t clkmgr; |
Alphan Ulusoy | 8e3171d | 2021-08-13 11:21:05 -0400 | [diff] [blame] | 137 | IGNORE_RESULT(dif_clkmgr_init(clkmgr_params, &clkmgr)); |
Timothy Trippel | bd975db | 2021-09-17 20:18:31 +0000 | [diff] [blame] | 138 | |
Timothy Trippel | dd5893e | 2021-09-27 19:23:09 +0000 | [diff] [blame] | 139 | @@ -187,19 +161,6 @@ void sca_disable_peripherals(sca_peripherals_t disable) { |
Alphan Ulusoy | 8e3171d | 2021-08-13 11:21:05 -0400 | [diff] [blame] | 140 | &clkmgr, CLKMGR_CLK_HINTS_CLK_MAIN_HMAC_HINT_BIT, |
| 141 | kDifClkmgrToggleDisabled)); |
| 142 | } |
| 143 | - if (disable & kScaPeripheralKmac) { |
| 144 | - IGNORE_RESULT(dif_clkmgr_hintable_clock_set_hint( |
| 145 | - &clkmgr, CLKMGR_CLK_HINTS_CLK_MAIN_KMAC_HINT_BIT, |
| 146 | - kDifClkmgrToggleDisabled)); |
| 147 | - } |
| 148 | - if (disable & kScaPeripheralOtbn) { |
| 149 | - IGNORE_RESULT(dif_clkmgr_hintable_clock_set_hint( |
| 150 | - &clkmgr, CLKMGR_CLK_HINTS_CLK_IO_DIV4_OTBN_HINT_BIT, |
| 151 | - kDifClkmgrToggleDisabled)); |
| 152 | - IGNORE_RESULT(dif_clkmgr_hintable_clock_set_hint( |
| 153 | - &clkmgr, CLKMGR_CLK_HINTS_CLK_MAIN_OTBN_HINT_BIT, |
| 154 | - kDifClkmgrToggleDisabled)); |
| 155 | - } |
| 156 | if (disable & kScaPeripheralUsb) { |
| 157 | IGNORE_RESULT(dif_clkmgr_gateable_clock_set_enabled( |
| 158 | &clkmgr, CLKMGR_CLK_ENABLES_CLK_USB_PERI_EN_BIT, |
Timothy Trippel | 0703f96 | 2021-09-02 21:08:20 +0000 | [diff] [blame] | 159 | diff --git a/sw/device/tests/aes_smoketest.c b/sw/device/tests/aes_smoketest.c |
Timothy Trippel | dd5893e | 2021-09-27 19:23:09 +0000 | [diff] [blame] | 160 | index 1a5fef16c..214e08151 100644 |
Timothy Trippel | 0703f96 | 2021-09-02 21:08:20 +0000 | [diff] [blame] | 161 | --- a/sw/device/tests/aes_smoketest.c |
| 162 | +++ b/sw/device/tests/aes_smoketest.c |
Pirmin Vogel | 7874970 | 2021-08-06 09:18:37 +0200 | [diff] [blame] | 163 | @@ -7,7 +7,6 @@ |
| 164 | #include "sw/device/lib/dif/dif_aes.h" |
| 165 | #include "sw/device/lib/runtime/log.h" |
| 166 | #include "sw/device/lib/testing/check.h" |
| 167 | -#include "sw/device/lib/testing/entropy_testutils.h" |
Timothy Trippel | c3e76d0 | 2021-08-28 05:35:26 +0000 | [diff] [blame] | 168 | #include "sw/device/lib/testing/test_framework/test_main.h" |
Timothy Trippel | bd975db | 2021-09-17 20:18:31 +0000 | [diff] [blame] | 169 | |
Pirmin Vogel | 7874970 | 2021-08-06 09:18:37 +0200 | [diff] [blame] | 170 | #include "hw/top_earlgrey/sw/autogen/top_earlgrey.h" |
Timothy Trippel | 4ffc821 | 2021-09-24 00:59:21 +0000 | [diff] [blame] | 171 | @@ -66,9 +65,6 @@ bool test_main(void) { |
Timothy Trippel | bd975db | 2021-09-17 20:18:31 +0000 | [diff] [blame] | 172 | |
Pirmin Vogel | 7874970 | 2021-08-06 09:18:37 +0200 | [diff] [blame] | 173 | LOG_INFO("Running AES test"); |
Timothy Trippel | bd975db | 2021-09-17 20:18:31 +0000 | [diff] [blame] | 174 | |
Pirmin Vogel | 7874970 | 2021-08-06 09:18:37 +0200 | [diff] [blame] | 175 | - // First of all, we need to get the entropy complex up and running. |
| 176 | - entropy_testutils_boot_mode_init(); |
| 177 | - |
| 178 | // Initialise AES. |
Timothy Trippel | dd5893e | 2021-09-27 19:23:09 +0000 | [diff] [blame] | 179 | CHECK_DIF_OK( |
| 180 | dif_aes_init(mmio_region_from_addr(TOP_EARLGREY_AES_BASE_ADDR), &aes)); |
Timothy Trippel | 0703f96 | 2021-09-02 21:08:20 +0000 | [diff] [blame] | 181 | diff --git a/sw/device/tests/meson.build b/sw/device/tests/meson.build |
Timothy Trippel | dd5893e | 2021-09-27 19:23:09 +0000 | [diff] [blame] | 182 | index 1b1c8ae72..66635fb0a 100644 |
Timothy Trippel | 0703f96 | 2021-09-02 21:08:20 +0000 | [diff] [blame] | 183 | --- a/sw/device/tests/meson.build |
| 184 | +++ b/sw/device/tests/meson.build |
Timothy Trippel | bd975db | 2021-09-17 20:18:31 +0000 | [diff] [blame] | 185 | @@ -207,7 +207,6 @@ aes_smoketest_lib = declare_dependency( |
Pirmin Vogel | 7874970 | 2021-08-06 09:18:37 +0200 | [diff] [blame] | 186 | sw_lib_dif_aes, |
| 187 | sw_lib_mmio, |
| 188 | sw_lib_runtime_log, |
Timothy Trippel | 7c18ad9 | 2021-08-30 20:31:45 +0000 | [diff] [blame] | 189 | - sw_lib_testing_entropy_testutils, |
Pirmin Vogel | 7874970 | 2021-08-06 09:18:37 +0200 | [diff] [blame] | 190 | sw_lib_testing_test_status, |
| 191 | ], |
| 192 | ), |