Integrate 5.x SMC API changes, add 4.x specific setup, implement target firmware selection

This commit is contained in:
Michael Scire 2018-03-25 15:05:08 -06:00
parent c6ee1bffb7
commit c2eed3caf6
34 changed files with 734 additions and 80 deletions

View file

@ -9,6 +9,7 @@
#include "bootconfig.h"
static boot_reason_t g_boot_reason = {0};
static uint64_t g_package2_hash_for_recovery[4] = {0};
bool bootconfig_matches_hardware_info(void) {
uint32_t hardware_info[4];
@ -114,6 +115,16 @@ void bootconfig_load_boot_reason(volatile boot_reason_t *boot_reason) {
g_boot_reason = *boot_reason;
}
void bootconfig_set_package2_hash_for_recovery(const void *package2, size_t package2_size) {
se_calculate_sha256(g_package2_hash_for_recovery, package2, package2_size);
}
void bootconfig_get_package2_hash_for_recovery(uint64_t *out_hash) {
for (unsigned int i = 0; i < 4; i++) {
out_hash[i] = g_package2_hash_for_recovery[i];
}
}
bool bootconfig_is_recovery_boot(void) {
return (g_boot_reason.is_recovery_boot != 0);
}