Only take mask for secure call reset functions

This commit is contained in:
William Vinnicombe 2025-12-05 15:03:46 +00:00
parent 9f7afbdb5e
commit 26e397aab2
3 changed files with 18 additions and 18 deletions

View file

@ -374,9 +374,9 @@ typedef struct cflash_flags {
#define SECURE_CALL_pads_bank0_write_masked SECURE_CALL_WELL_KNOWN_CODE('P', '0', 'W', 'M')
#define SECURE_CALL_pads_bank0_read SECURE_CALL_WELL_KNOWN_CODE('P', '0', 'R', 'D')
#define SECURE_CALL_reset_block_reg_mask SECURE_CALL_WELL_KNOWN_CODE('R', 'T', 'R', 'M')
#define SECURE_CALL_unreset_block_reg_mask SECURE_CALL_WELL_KNOWN_CODE('R', 'T', 'U', 'M')
#define SECURE_CALL_unreset_block_reg_mask_wait_blocking SECURE_CALL_WELL_KNOWN_CODE('R', 'T', 'U', 'W')
#define SECURE_CALL_reset_block_mask SECURE_CALL_WELL_KNOWN_CODE('R', 'T', 'R', 'M')
#define SECURE_CALL_unreset_block_mask SECURE_CALL_WELL_KNOWN_CODE('R', 'T', 'U', 'M')
#define SECURE_CALL_unreset_block_mask_wait_blocking SECURE_CALL_WELL_KNOWN_CODE('R', 'T', 'U', 'W')
#endif
#endif

View file

@ -563,19 +563,19 @@ int rom_default_callback(uint32_t a, uint32_t b, uint32_t c, uint32_t d, uint32_
return clock_get_hz(a);
}
#if PICO_ALLOW_NONSECURE_RESETS
case SECURE_CALL_reset_block_reg_mask: {
if (b & ~PICO_ALLOW_NONSECURE_RESETS_MASK) return BOOTROM_ERROR_NOT_PERMITTED;
reset_block_reg_mask((volatile io_rw_32 *)a, b);
case SECURE_CALL_reset_block_mask: {
if (a & ~PICO_ALLOW_NONSECURE_RESETS_MASK) return BOOTROM_ERROR_NOT_PERMITTED;
reset_block_mask(a);
return BOOTROM_OK;
}
case SECURE_CALL_unreset_block_reg_mask: {
if (b & ~PICO_ALLOW_NONSECURE_RESETS_MASK) return BOOTROM_ERROR_NOT_PERMITTED;
unreset_block_reg_mask((volatile io_rw_32 *)a, b);
case SECURE_CALL_unreset_block_mask: {
if (a & ~PICO_ALLOW_NONSECURE_RESETS_MASK) return BOOTROM_ERROR_NOT_PERMITTED;
unreset_block_mask(a);
return BOOTROM_OK;
}
case SECURE_CALL_unreset_block_reg_mask_wait_blocking: {
if (c & ~PICO_ALLOW_NONSECURE_RESETS_MASK) return BOOTROM_ERROR_NOT_PERMITTED;
unreset_block_reg_mask_wait_blocking((volatile io_rw_32 *)a, (const volatile io_ro_32 *)b, c);
case SECURE_CALL_unreset_block_mask_wait_blocking: {
if (a & ~PICO_ALLOW_NONSECURE_RESETS_MASK) return BOOTROM_ERROR_NOT_PERMITTED;
unreset_block_mask_wait_blocking(a);
return BOOTROM_OK;
}
#endif

View file

@ -1248,14 +1248,14 @@ static inline int pads_bank0_read(uint gpio) {
#endif
#if PICO_ALLOW_NONSECURE_RESETS && PICO_NONSECURE
static inline int reset_block_reg_mask(io_rw_32 *reset, uint32_t mask) {
return rom_secure_call(reset, mask, 0, 0, SECURE_CALL_reset_block_reg_mask);
static inline int reset_block_reg_mask(__unused io_rw_32 *reset, uint32_t mask) {
return rom_secure_call(mask, 0, 0, 0, SECURE_CALL_reset_block_mask);
}
static inline int unreset_block_reg_mask(io_rw_32 *reset, uint32_t mask) {
return rom_secure_call(reset, mask, 0, 0, SECURE_CALL_unreset_block_reg_mask);
static inline int unreset_block_reg_mask(__unused io_rw_32 *reset, uint32_t mask) {
return rom_secure_call(mask, 0, 0, 0, SECURE_CALL_unreset_block_mask);
}
static inline int unreset_block_reg_mask_wait_blocking(io_rw_32 *reset, io_ro_32 *reset_done, uint32_t mask) {
return rom_secure_call(reset, reset_done, mask, 0, SECURE_CALL_unreset_block_reg_mask_wait_blocking);
static inline int unreset_block_reg_mask_wait_blocking(__unused io_rw_32 *reset, __unused io_ro_32 *reset_done, uint32_t mask) {
return rom_secure_call(mask, 0, 0, 0, SECURE_CALL_unreset_block_mask_wait_blocking);
}
#endif