mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-15 17:12:04 +00:00
feat(core): add powerctl_suspend syscall
[no changelog]
This commit is contained in:
parent
f3793fd8c4
commit
fc2f9c5949
@ -51,6 +51,10 @@
|
|||||||
#include <sec/optiga.h>
|
#include <sec/optiga.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_POWERCTL
|
||||||
|
#include <sys/powerctl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_RGB_LED
|
#ifdef USE_RGB_LED
|
||||||
#include <io/rgb_led.h>
|
#include <io/rgb_led.h>
|
||||||
#endif
|
#endif
|
||||||
@ -673,6 +677,12 @@ __attribute((no_stack_protector)) void syscall_handler(uint32_t *args,
|
|||||||
firmware_hash_callback_wrapper, callback_context);
|
firmware_hash_callback_wrapper, callback_context);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
#ifdef USE_POWERCTL
|
||||||
|
case SYSCALL_POWERCTL_SUSPEND: {
|
||||||
|
powerctl_suspend();
|
||||||
|
} break;
|
||||||
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
system_exit_fatal("Invalid syscall", __FILE__, __LINE__);
|
system_exit_fatal("Invalid syscall", __FILE__, __LINE__);
|
||||||
break;
|
break;
|
||||||
|
@ -139,6 +139,8 @@ typedef enum {
|
|||||||
SYSCALL_FIRMWARE_GET_VENDOR,
|
SYSCALL_FIRMWARE_GET_VENDOR,
|
||||||
SYSCALL_FIRMWARE_CALC_HASH,
|
SYSCALL_FIRMWARE_CALC_HASH,
|
||||||
|
|
||||||
|
SYSCALL_POWERCTL_SUSPEND,
|
||||||
|
|
||||||
} syscall_number_t;
|
} syscall_number_t;
|
||||||
|
|
||||||
#endif // SYSCALL_NUMBERS_H
|
#endif // SYSCALL_NUMBERS_H
|
||||||
|
@ -645,4 +645,16 @@ secbool firmware_calc_hash(const uint8_t *challenge, size_t challenge_len,
|
|||||||
SYSCALL_FIRMWARE_CALC_HASH);
|
SYSCALL_FIRMWARE_CALC_HASH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// =============================================================================
|
||||||
|
// powerctl.h
|
||||||
|
// =============================================================================
|
||||||
|
|
||||||
|
#ifdef USE_POWERCTL
|
||||||
|
|
||||||
|
#include <sys/powerctl.h>
|
||||||
|
|
||||||
|
void powerctl_suspend(void) { syscall_invoke0(SYSCALL_POWERCTL_SUSPEND); }
|
||||||
|
|
||||||
|
#endif // USE_POWERCTL
|
||||||
|
|
||||||
#endif // KERNEL_MODE
|
#endif // KERNEL_MODE
|
||||||
|
Loading…
Reference in New Issue
Block a user