mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
incorporate arch migrations to status
This commit is contained in:
parent
a0c1b1e75a
commit
ee22ff783c
3 changed files with 20 additions and 32 deletions
|
|
@ -33,6 +33,7 @@ userprefs = { path = "../../libs/userprefs" }
|
||||||
dns = { path = "../dns" }
|
dns = { path = "../dns" }
|
||||||
early_settings = { path = "../early_settings" }
|
early_settings = { path = "../early_settings" }
|
||||||
blitstr2 = { path = "../../libs/blitstr2" }
|
blitstr2 = { path = "../../libs/blitstr2" }
|
||||||
|
precursor-hal = { path = "../../libs/precursor-hal" }
|
||||||
|
|
||||||
num-derive = { version = "0.4.2", default-features = false }
|
num-derive = { version = "0.4.2", default-features = false }
|
||||||
num-traits = { version = "0.2.14", default-features = false }
|
num-traits = { version = "0.2.14", default-features = false }
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ use std::convert::TryInto;
|
||||||
use locales::t;
|
use locales::t;
|
||||||
use modals::Modals;
|
use modals::Modals;
|
||||||
use num_traits::*;
|
use num_traits::*;
|
||||||
|
use precursor_hal::board::*;
|
||||||
use sha2::Digest;
|
use sha2::Digest;
|
||||||
use xous::msg_blocking_scalar_unpack;
|
use xous::msg_blocking_scalar_unpack;
|
||||||
use xous_semver::SemVer;
|
use xous_semver::SemVer;
|
||||||
|
|
@ -60,17 +61,17 @@ pub(crate) fn ecupdate_thread(sid: xous::SID) {
|
||||||
|
|
||||||
#[cfg(any(feature = "precursor", feature = "renode"))]
|
#[cfg(any(feature = "precursor", feature = "renode"))]
|
||||||
let ec_package = xous::syscall::map_memory(
|
let ec_package = xous::syscall::map_memory(
|
||||||
xous::MemoryAddress::new((xous::EC_FW_PKG_LOC + xous::FLASH_PHYS_BASE) as usize),
|
xous::MemoryAddress::new((EC_FW_PKG_LOC + FLASH_PHYS_BASE) as usize),
|
||||||
None,
|
None,
|
||||||
xous::EC_FW_PKG_LEN as usize,
|
EC_FW_PKG_LEN as usize,
|
||||||
xous::MemoryFlags::R | xous::MemoryFlags::W,
|
xous::MemoryFlags::R | xous::MemoryFlags::W,
|
||||||
)
|
)
|
||||||
.expect("couldn't map EC firmware package memory range");
|
.expect("couldn't map EC firmware package memory range");
|
||||||
#[cfg(any(feature = "precursor", feature = "renode"))]
|
#[cfg(any(feature = "precursor", feature = "renode"))]
|
||||||
let wf_package = xous::syscall::map_memory(
|
let wf_package = xous::syscall::map_memory(
|
||||||
xous::MemoryAddress::new((xous::EC_WF200_PKG_LOC + xous::FLASH_PHYS_BASE) as usize),
|
xous::MemoryAddress::new((EC_WF200_PKG_LOC + FLASH_PHYS_BASE) as usize),
|
||||||
None,
|
None,
|
||||||
xous::EC_WF200_PKG_LEN as usize,
|
EC_WF200_PKG_LEN as usize,
|
||||||
xous::MemoryFlags::R | xous::MemoryFlags::W,
|
xous::MemoryFlags::R | xous::MemoryFlags::W,
|
||||||
)
|
)
|
||||||
.expect("couldn't map EC wf200 package memory range");
|
.expect("couldn't map EC wf200 package memory range");
|
||||||
|
|
@ -78,7 +79,7 @@ pub(crate) fn ecupdate_thread(sid: xous::SID) {
|
||||||
let mut ec_package = xous::syscall::map_memory(
|
let mut ec_package = xous::syscall::map_memory(
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
xous::EC_FW_PKG_LEN as usize,
|
EC_FW_PKG_LEN as usize,
|
||||||
xous::MemoryFlags::R | xous::MemoryFlags::W,
|
xous::MemoryFlags::R | xous::MemoryFlags::W,
|
||||||
)
|
)
|
||||||
.expect("couldn't map EC firmware package memory range");
|
.expect("couldn't map EC firmware package memory range");
|
||||||
|
|
@ -90,7 +91,7 @@ pub(crate) fn ecupdate_thread(sid: xous::SID) {
|
||||||
let mut wf_package = xous::syscall::map_memory(
|
let mut wf_package = xous::syscall::map_memory(
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
xous::EC_WF200_PKG_LEN as usize,
|
EC_WF200_PKG_LEN as usize,
|
||||||
xous::MemoryFlags::R | xous::MemoryFlags::W,
|
xous::MemoryFlags::R | xous::MemoryFlags::W,
|
||||||
)
|
)
|
||||||
.expect("couldn't map EC wf200 package memory range");
|
.expect("couldn't map EC wf200 package memory range");
|
||||||
|
|
@ -107,10 +108,7 @@ pub(crate) fn ecupdate_thread(sid: xous::SID) {
|
||||||
Some(UpdateOp::UpdateGateware) => {
|
Some(UpdateOp::UpdateGateware) => {
|
||||||
// blocking scalar
|
// blocking scalar
|
||||||
let package = unsafe {
|
let package = unsafe {
|
||||||
core::slice::from_raw_parts(
|
core::slice::from_raw_parts(ec_package.as_ptr() as *const u8, EC_FW_PKG_LEN as usize)
|
||||||
ec_package.as_ptr() as *const u8,
|
|
||||||
xous::EC_FW_PKG_LEN as usize,
|
|
||||||
)
|
|
||||||
};
|
};
|
||||||
if !validate_package(package, PackageType::Ec) {
|
if !validate_package(package, PackageType::Ec) {
|
||||||
log::error!("firmware package did not pass validation");
|
log::error!("firmware package did not pass validation");
|
||||||
|
|
@ -142,10 +140,7 @@ pub(crate) fn ecupdate_thread(sid: xous::SID) {
|
||||||
Some(UpdateOp::UpdateFirmware) => {
|
Some(UpdateOp::UpdateFirmware) => {
|
||||||
// blocking scalar
|
// blocking scalar
|
||||||
let package = unsafe {
|
let package = unsafe {
|
||||||
core::slice::from_raw_parts(
|
core::slice::from_raw_parts(ec_package.as_ptr() as *const u8, EC_FW_PKG_LEN as usize)
|
||||||
ec_package.as_ptr() as *const u8,
|
|
||||||
xous::EC_FW_PKG_LEN as usize,
|
|
||||||
)
|
|
||||||
};
|
};
|
||||||
if !validate_package(package, PackageType::Ec) {
|
if !validate_package(package, PackageType::Ec) {
|
||||||
log::error!("firmware package did not pass validation");
|
log::error!("firmware package did not pass validation");
|
||||||
|
|
@ -184,10 +179,7 @@ pub(crate) fn ecupdate_thread(sid: xous::SID) {
|
||||||
Some(UpdateOp::UpdateWf200) => {
|
Some(UpdateOp::UpdateWf200) => {
|
||||||
// blocking scalar
|
// blocking scalar
|
||||||
let package = unsafe {
|
let package = unsafe {
|
||||||
core::slice::from_raw_parts(
|
core::slice::from_raw_parts(wf_package.as_ptr() as *const u8, EC_WF200_PKG_LEN as usize)
|
||||||
wf_package.as_ptr() as *const u8,
|
|
||||||
xous::EC_WF200_PKG_LEN as usize,
|
|
||||||
)
|
|
||||||
};
|
};
|
||||||
if validate_package(package, PackageType::Wf200) {
|
if validate_package(package, PackageType::Wf200) {
|
||||||
log::info!("updating Wf200");
|
log::info!("updating Wf200");
|
||||||
|
|
@ -281,17 +273,14 @@ pub(crate) fn ecupdate_thread(sid: xous::SID) {
|
||||||
|
|
||||||
let mut did_something = false;
|
let mut did_something = false;
|
||||||
let package = unsafe {
|
let package = unsafe {
|
||||||
core::slice::from_raw_parts(
|
core::slice::from_raw_parts(ec_package.as_ptr() as *const u8, EC_FW_PKG_LEN as usize)
|
||||||
ec_package.as_ptr() as *const u8,
|
|
||||||
xous::EC_FW_PKG_LEN as usize,
|
|
||||||
)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// the semver *could* be bogus at this point, but we'll validate the package (which contains
|
// the semver *could* be bogus at this point, but we'll validate the package (which contains
|
||||||
// the semver) before we use it. however, this check is much less
|
// the semver) before we use it. however, this check is much less
|
||||||
// computationally expensive than the package validation.
|
// computationally expensive than the package validation.
|
||||||
let length = u32::from_le_bytes(package[0x28..0x2c].try_into().unwrap());
|
let length = u32::from_le_bytes(package[0x28..0x2c].try_into().unwrap());
|
||||||
if length > xous::EC_FW_PKG_LEN {
|
if length > EC_FW_PKG_LEN {
|
||||||
// nothing was staged, or it is bogus (blank FLASH is 0xFFFF_FFFF "length")
|
// nothing was staged, or it is bogus (blank FLASH is 0xFFFF_FFFF "length")
|
||||||
// only show the warning if the update was forced; otherwise we shouldn't show the warning
|
// only show the warning if the update was forced; otherwise we shouldn't show the warning
|
||||||
// because it'll pop up every time on a new unit
|
// because it'll pop up every time on a new unit
|
||||||
|
|
@ -409,10 +398,7 @@ pub(crate) fn ecupdate_thread(sid: xous::SID) {
|
||||||
}
|
}
|
||||||
|
|
||||||
let package = unsafe {
|
let package = unsafe {
|
||||||
core::slice::from_raw_parts(
|
core::slice::from_raw_parts(wf_package.as_ptr() as *const u8, EC_WF200_PKG_LEN as usize)
|
||||||
wf_package.as_ptr() as *const u8,
|
|
||||||
xous::EC_WF200_PKG_LEN as usize,
|
|
||||||
)
|
|
||||||
};
|
};
|
||||||
let mut run_wf200_update = false;
|
let mut run_wf200_update = false;
|
||||||
// check to see if we need to do an update. For the WF200, we can only say if the hash is
|
// check to see if we need to do an update. For the WF200, we can only say if the hash is
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ use gam::{GamObjectList, GamObjectType};
|
||||||
use keystore_api::*;
|
use keystore_api::*;
|
||||||
use locales::t;
|
use locales::t;
|
||||||
use num_traits::*;
|
use num_traits::*;
|
||||||
|
use precursor_hal::board::*;
|
||||||
use ux_api::minigfx::*;
|
use ux_api::minigfx::*;
|
||||||
use ux_api::service::api::*;
|
use ux_api::service::api::*;
|
||||||
use xous::{CID, Message, msg_scalar_unpack, send_message};
|
use xous::{CID, Message, msg_scalar_unpack, send_message};
|
||||||
|
|
@ -1448,7 +1449,7 @@ fn wrapped_main() -> ! {
|
||||||
}
|
}
|
||||||
#[cfg(feature = "efuse")]
|
#[cfg(feature = "efuse")]
|
||||||
Some(StatusOpcode::BurnBackupKey) => {
|
Some(StatusOpcode::BurnBackupKey) => {
|
||||||
log::info!("{}BURNKEY.TYPE,{}", xous::BOOKEND_START, xous::BOOKEND_END);
|
log::info!("{}BURNKEY.TYPE,{}", BOOKEND_START, BOOKEND_END);
|
||||||
thread::spawn({
|
thread::spawn({
|
||||||
let keys = keys.clone();
|
let keys = keys.clone();
|
||||||
move || {
|
move || {
|
||||||
|
|
@ -1467,14 +1468,14 @@ fn wrapped_main() -> ! {
|
||||||
Ok(response) => {
|
Ok(response) => {
|
||||||
if response.as_str() == t!("burnkey.bbram", locales::LANG) {
|
if response.as_str() == t!("burnkey.bbram", locales::LANG) {
|
||||||
// do BBRAM flow
|
// do BBRAM flow
|
||||||
log::info!("{}BBRAM.CONFIRM,{}", xous::BOOKEND_START, xous::BOOKEND_END);
|
log::info!("{}BBRAM.CONFIRM,{}", BOOKEND_START, BOOKEND_END);
|
||||||
// punts to a script-driven flow on the pi
|
// punts to a script-driven flow on the pi
|
||||||
modals.show_notification(
|
modals.show_notification(
|
||||||
t!("burnkey.bbram_exec", locales::LANG),
|
t!("burnkey.bbram_exec", locales::LANG),
|
||||||
Some("https://github.com/betrusted-io/betrusted-wiki/wiki/FAQ:-FPGA-AES-Encryption-Key-(eFuse-BBRAM)"),
|
Some("https://github.com/betrusted-io/betrusted-wiki/wiki/FAQ:-FPGA-AES-Encryption-Key-(eFuse-BBRAM)"),
|
||||||
).ok();
|
).ok();
|
||||||
} else if response.as_str() == t!("burnkey.efuse", locales::LANG) {
|
} else if response.as_str() == t!("burnkey.efuse", locales::LANG) {
|
||||||
log::info!("{}EFUSE.CONFIRM,{}", xous::BOOKEND_START, xous::BOOKEND_END);
|
log::info!("{}EFUSE.CONFIRM,{}", BOOKEND_START, BOOKEND_END);
|
||||||
// do eFuse flow
|
// do eFuse flow
|
||||||
modals
|
modals
|
||||||
.add_list_item(t!("rootkeys.gwup.yes", locales::LANG))
|
.add_list_item(t!("rootkeys.gwup.yes", locales::LANG))
|
||||||
|
|
@ -1514,7 +1515,7 @@ fn wrapped_main() -> ! {
|
||||||
modals
|
modals
|
||||||
.add_list_item(t!("rootkeys.gwup.no", locales::LANG))
|
.add_list_item(t!("rootkeys.gwup.no", locales::LANG))
|
||||||
.expect("couldn't build radio item list");
|
.expect("couldn't build radio item list");
|
||||||
log::info!("{}BACKUP.CONFIRM,{}", xous::BOOKEND_START, xous::BOOKEND_END);
|
log::info!("{}BACKUP.CONFIRM,{}", BOOKEND_START, BOOKEND_END);
|
||||||
match modals.get_radiobutton(t!("backup.confirm", locales::LANG)) {
|
match modals.get_radiobutton(t!("backup.confirm", locales::LANG)) {
|
||||||
Ok(response) => {
|
Ok(response) => {
|
||||||
if response.as_str() == t!("rootkeys.gwup.yes", locales::LANG) {
|
if response.as_str() == t!("rootkeys.gwup.yes", locales::LANG) {
|
||||||
|
|
@ -1573,7 +1574,7 @@ fn wrapped_main() -> ! {
|
||||||
pddb.pddb_halt();
|
pddb.pddb_halt();
|
||||||
|
|
||||||
// now trigger phase 2 of the backup
|
// now trigger phase 2 of the backup
|
||||||
log::info!("{}BACKUP.PHASE2,{}", xous::BOOKEND_START, xous::BOOKEND_END);
|
log::info!("{}BACKUP.PHASE2,{}", BOOKEND_START, BOOKEND_END);
|
||||||
send_message(
|
send_message(
|
||||||
cb_cid,
|
cb_cid,
|
||||||
Message::new_scalar(
|
Message::new_scalar(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue