Implement se_trigger_interrupt, fix up some configitems

This commit is contained in:
Michael Scire 2018-02-24 07:25:38 -08:00
parent e8b1e0b965
commit ed5850ebbf
6 changed files with 13 additions and 10 deletions

View File

@ -18,5 +18,6 @@ void bootconfig_clear(void);
/* Actual configuration getters. */
bool bootconfig_is_package2_plaintext(void);
bool bootconfig_is_package2_unsigned(void);
bool bootconfig_disable_program_verification(void);
#endif

View File

@ -1,6 +1,8 @@
#include <stdint.h>
#include "utils.h"
#include "bootconfig.h"
#include "se.h"
#include "configitem.h"
int g_battery_profile = 0;
@ -26,19 +28,18 @@ uint32_t configitem_get(enum ConfigItem item, uint64_t *p_outvalue) {
uint32_t result = 0;
switch (item) {
case CONFIGITEM_DISABLEPROGRAMVERIFICATION:
/* TODO: This is loaded from BootConfig on dev units, always zero on retail. How should we support? */
*p_outvalue = 0;
*p_outvalue = (int)(bootconfig_disable_program_verification());
break;
case CONFIGITEM_MEMORYCONFIGURATION:
/* TODO: Fuse driver */
break;
case CONFIGITEM_SECURITYENGINEIRQ:
/* SE is interrupt #44. */
*p_outvalue = 0x2C;
/* SE is interrupt #0x2C. */
*p_outvalue = INTERRUPT_ID_USER_SECURITY_ENGINE;
break;
case CONFIGITEM_UNK04:
/* Always returns 2 on hardware. */
*p_outvalue = 2;
/* Always returns maxver - 1 on hardware. */
*p_outvalue = PACKAGE2_MAXVER_400_CURRENT - 1;
break;
case CONFIGITEM_HARDWARETYPE:
/* TODO: Fuse driver */
@ -47,7 +48,7 @@ uint32_t configitem_get(enum ConfigItem item, uint64_t *p_outvalue) {
/* TODO: Fuse driver */
break;
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;
break;
case CONFIGITEM_DEVICEID:

View File

@ -8,7 +8,7 @@ enum ConfigItem {
CONFIGITEM_DISABLEPROGRAMVERIFICATION = 1,
CONFIGITEM_MEMORYCONFIGURATION = 2,
CONFIGITEM_SECURITYENGINEIRQ = 3,
CONFIGITEM_UNK04 = 4,
CONFIGITEM_VERSION = 4,
CONFIGITEM_HARDWARETYPE = 5,
CONFIGITEM_ISRETAIL = 6,
CONFIGITEM_ISRECOVERYBOOT = 7,

View File

@ -9,6 +9,7 @@
#define MAX_REGISTERED_INTERRUPTS 4
#define INTERRUPT_ID_SECURITY_ENGINE 0x5A
#define INTERRUPT_ID_USER_SECURITY_ENGINE 0x2C
#define GICD_BASE (mmio_get_device_address(MMIO_DEVID_GICD))
#define GICC_BASE (mmio_get_device_address(MMIO_DEVID_GICC))

View File

@ -3,6 +3,7 @@
#include <string.h>
#include "utils.h"
#include "interrupt.h"
#include "mmu.h"
#include "cache.h"
#include "se.h"
@ -65,7 +66,7 @@ void se_check_for_error(void) {
}
void se_trigger_intrrupt(void) {
/* TODO */
intr_set_pending(INTERRUPT_ID_USER_SECURITY_ENGINE);
}
void se_verify_flags_cleared(void) {

View File

@ -145,7 +145,6 @@ void se_check_for_error(void);
void se_trigger_interrupt(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_rsa_keyslot_flags(unsigned int keyslot, unsigned int flags);