mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-24 07:40:26 +01:00
Implement se_trigger_interrupt, fix up some configitems
This commit is contained in:
parent
e8b1e0b965
commit
ed5850ebbf
@ -18,5 +18,6 @@ void bootconfig_clear(void);
|
|||||||
/* Actual configuration getters. */
|
/* Actual configuration getters. */
|
||||||
bool bootconfig_is_package2_plaintext(void);
|
bool bootconfig_is_package2_plaintext(void);
|
||||||
bool bootconfig_is_package2_unsigned(void);
|
bool bootconfig_is_package2_unsigned(void);
|
||||||
|
bool bootconfig_disable_program_verification(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -1,6 +1,8 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "bootconfig.h"
|
||||||
|
#include "se.h"
|
||||||
#include "configitem.h"
|
#include "configitem.h"
|
||||||
|
|
||||||
int g_battery_profile = 0;
|
int g_battery_profile = 0;
|
||||||
@ -26,19 +28,18 @@ uint32_t configitem_get(enum ConfigItem item, uint64_t *p_outvalue) {
|
|||||||
uint32_t result = 0;
|
uint32_t result = 0;
|
||||||
switch (item) {
|
switch (item) {
|
||||||
case CONFIGITEM_DISABLEPROGRAMVERIFICATION:
|
case CONFIGITEM_DISABLEPROGRAMVERIFICATION:
|
||||||
/* TODO: This is loaded from BootConfig on dev units, always zero on retail. How should we support? */
|
*p_outvalue = (int)(bootconfig_disable_program_verification());
|
||||||
*p_outvalue = 0;
|
|
||||||
break;
|
break;
|
||||||
case CONFIGITEM_MEMORYCONFIGURATION:
|
case CONFIGITEM_MEMORYCONFIGURATION:
|
||||||
/* TODO: Fuse driver */
|
/* TODO: Fuse driver */
|
||||||
break;
|
break;
|
||||||
case CONFIGITEM_SECURITYENGINEIRQ:
|
case CONFIGITEM_SECURITYENGINEIRQ:
|
||||||
/* SE is interrupt #44. */
|
/* SE is interrupt #0x2C. */
|
||||||
*p_outvalue = 0x2C;
|
*p_outvalue = INTERRUPT_ID_USER_SECURITY_ENGINE;
|
||||||
break;
|
break;
|
||||||
case CONFIGITEM_UNK04:
|
case CONFIGITEM_UNK04:
|
||||||
/* Always returns 2 on hardware. */
|
/* Always returns maxver - 1 on hardware. */
|
||||||
*p_outvalue = 2;
|
*p_outvalue = PACKAGE2_MAXVER_400_CURRENT - 1;
|
||||||
break;
|
break;
|
||||||
case CONFIGITEM_HARDWARETYPE:
|
case CONFIGITEM_HARDWARETYPE:
|
||||||
/* TODO: Fuse driver */
|
/* TODO: Fuse driver */
|
||||||
@ -47,7 +48,7 @@ uint32_t configitem_get(enum ConfigItem item, uint64_t *p_outvalue) {
|
|||||||
/* TODO: Fuse driver */
|
/* TODO: Fuse driver */
|
||||||
break;
|
break;
|
||||||
case CONFIGITEM_ISRECOVERYBOOT:
|
case CONFIGITEM_ISRECOVERYBOOT:
|
||||||
/* TODO: This is just a constant, hardcoded into TZ on retail. How should we support? */
|
/* TODO: This requires reading values passed to crt0 via NX_Bootloader. TBD pending crt0 implementation. */
|
||||||
*p_outvalue = 0;
|
*p_outvalue = 0;
|
||||||
break;
|
break;
|
||||||
case CONFIGITEM_DEVICEID:
|
case CONFIGITEM_DEVICEID:
|
||||||
|
@ -8,7 +8,7 @@ enum ConfigItem {
|
|||||||
CONFIGITEM_DISABLEPROGRAMVERIFICATION = 1,
|
CONFIGITEM_DISABLEPROGRAMVERIFICATION = 1,
|
||||||
CONFIGITEM_MEMORYCONFIGURATION = 2,
|
CONFIGITEM_MEMORYCONFIGURATION = 2,
|
||||||
CONFIGITEM_SECURITYENGINEIRQ = 3,
|
CONFIGITEM_SECURITYENGINEIRQ = 3,
|
||||||
CONFIGITEM_UNK04 = 4,
|
CONFIGITEM_VERSION = 4,
|
||||||
CONFIGITEM_HARDWARETYPE = 5,
|
CONFIGITEM_HARDWARETYPE = 5,
|
||||||
CONFIGITEM_ISRETAIL = 6,
|
CONFIGITEM_ISRETAIL = 6,
|
||||||
CONFIGITEM_ISRECOVERYBOOT = 7,
|
CONFIGITEM_ISRECOVERYBOOT = 7,
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#define MAX_REGISTERED_INTERRUPTS 4
|
#define MAX_REGISTERED_INTERRUPTS 4
|
||||||
#define INTERRUPT_ID_SECURITY_ENGINE 0x5A
|
#define INTERRUPT_ID_SECURITY_ENGINE 0x5A
|
||||||
|
#define INTERRUPT_ID_USER_SECURITY_ENGINE 0x2C
|
||||||
|
|
||||||
#define GICD_BASE (mmio_get_device_address(MMIO_DEVID_GICD))
|
#define GICD_BASE (mmio_get_device_address(MMIO_DEVID_GICD))
|
||||||
#define GICC_BASE (mmio_get_device_address(MMIO_DEVID_GICC))
|
#define GICC_BASE (mmio_get_device_address(MMIO_DEVID_GICC))
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "interrupt.h"
|
||||||
#include "mmu.h"
|
#include "mmu.h"
|
||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
#include "se.h"
|
#include "se.h"
|
||||||
@ -65,7 +66,7 @@ void se_check_for_error(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void se_trigger_intrrupt(void) {
|
void se_trigger_intrrupt(void) {
|
||||||
/* TODO */
|
intr_set_pending(INTERRUPT_ID_USER_SECURITY_ENGINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void se_verify_flags_cleared(void) {
|
void se_verify_flags_cleared(void) {
|
||||||
|
@ -145,7 +145,6 @@ void se_check_for_error(void);
|
|||||||
void se_trigger_interrupt(void);
|
void se_trigger_interrupt(void);
|
||||||
|
|
||||||
void se_verify_flags_cleared(void);
|
void se_verify_flags_cleared(void);
|
||||||
void se_clear_interrupts(void);
|
|
||||||
|
|
||||||
void set_aes_keyslot_flags(unsigned int keyslot, unsigned int flags);
|
void set_aes_keyslot_flags(unsigned int keyslot, unsigned int flags);
|
||||||
void set_rsa_keyslot_flags(unsigned int keyslot, unsigned int flags);
|
void set_rsa_keyslot_flags(unsigned int keyslot, unsigned int flags);
|
||||||
|
Loading…
Reference in New Issue
Block a user