mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-09 22:56:35 +00:00
Clean up SE TODOs, implement GIC nonsecure init
This commit is contained in:
parent
1463266190
commit
0508ee29d8
5 changed files with 17 additions and 6 deletions
|
@ -28,6 +28,18 @@ void intr_initialize_gic(void) {
|
|||
GICC_BPR = 7;
|
||||
}
|
||||
|
||||
/* Initializes Interrupt Groups 1-7 in the GIC. Called by pk2ldr. */
|
||||
void intr_initialize_gic_nonsecure(void) {
|
||||
for (unsigned int i = 1; i < 8; i++) {
|
||||
GICD_IGROUPR[i] = 0xFFFFFFFF
|
||||
}
|
||||
|
||||
for (unsigned int i = 0x20; i < 0xE0; i++) {
|
||||
GICD_IPRIORITYR[i] = GIC_PRI_HIGHEST_NONSECURE;
|
||||
}
|
||||
GICD_CTLR = 1;
|
||||
}
|
||||
|
||||
/* Sets GICC_CTLR to appropriate pre-sleep value. */
|
||||
void intr_prepare_gicc_for_sleep(void) {
|
||||
GICC_CTLR = 0x1E0;
|
||||
|
|
|
@ -22,6 +22,7 @@ static inline uintptr_t get_gicc_base(void) {
|
|||
#define GICD_BASE (get_gicd_base())
|
||||
#define GICC_BASE (get_gicc_base())
|
||||
|
||||
#define GICD_CTLR (*((volatile uint32_t *)(GICD_BASE + 0x000ull)))
|
||||
#define GICD_IGROUPR ((volatile uint32_t *)(GICD_BASE + 0x080ull))
|
||||
#define GICD_ISENABLER ((volatile uint32_t *)(GICD_BASE + 0x100ull))
|
||||
#define GICD_ISPENDR ((volatile uint32_t *)(GICD_BASE + 0x200ull))
|
||||
|
@ -46,6 +47,7 @@ void handle_registered_interrupt(void);
|
|||
|
||||
/* Initializes the GIC. TODO: This must be called during wakeup. */
|
||||
void intr_initialize_gic(void);
|
||||
void intr_initialize_gic_nonsecure(void);
|
||||
|
||||
void intr_prepare_gicc_for_sleep(void);
|
||||
|
||||
|
|
|
@ -18,7 +18,9 @@ static void setup_se(void) {
|
|||
|
||||
/* Sanity check the Security Engine. */
|
||||
se_verify_flags_cleared();
|
||||
se_clear_interrupts();
|
||||
|
||||
/* Initialize Interrupts. */
|
||||
intr_initialize_gic_nonsecure();
|
||||
|
||||
/* Perform some sanity initialization. */
|
||||
volatile security_engine_t *p_security_engine = get_security_engine();
|
||||
|
|
|
@ -71,10 +71,6 @@ void se_verify_flags_cleared(void) {
|
|||
}
|
||||
}
|
||||
|
||||
void se_clear_interrupts(void) {
|
||||
/* TODO */
|
||||
}
|
||||
|
||||
/* Set the flags for an AES keyslot. */
|
||||
void set_aes_keyslot_flags(unsigned int keyslot, unsigned int flags) {
|
||||
if (keyslot >= KEYSLOT_AES_MAX) {
|
||||
|
|
|
@ -174,7 +174,6 @@ void se_operation_completed(void);
|
|||
void se_check_error_status_reg(void);
|
||||
void se_check_for_error(void);
|
||||
void se_trigger_interrupt(void);
|
||||
void se_clear_interrupts(void); /* TODO */
|
||||
|
||||
void se_verify_flags_cleared(void);
|
||||
|
||||
|
|
Loading…
Reference in a new issue