-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add compatiblity check funcion to test FMC compatiblity in runtime. Signed-off-by: leongross <leon.gross@9elements.com>
- Loading branch information
Showing
4 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/*++ | ||
Licensed under the Apache-2.0 license. | ||
File Name: | ||
compatibility.rs | ||
Abstract: | ||
File contains compatibility functions to to check if the runtime is | ||
compatible with FMC. | ||
--*/ | ||
|
||
use caliptra_builder::version::RUNTIME_VERSION_MAJOR; | ||
use caliptra_common::FirmwareHandoffTable; | ||
|
||
pub fn is_fmc_compatible(fht: &FirmwareHandoffTable) -> bool { | ||
fht.fht_major_ver == RUNTIME_VERSION_MAJOR | ||
} | ||
|
||
#[test] | ||
fn test_is_fmc_compatible() { | ||
let mut fht = FirmwareHandoffTable::default(); | ||
fht.fht_major_ver = 1; | ||
fht.fht_minor_ver = 0; | ||
assert_eq!(is_fmc_compatible(&fht), true); | ||
|
||
// change minor version should not affect compatibility | ||
fht.fht_minor_ver = 1; | ||
assert_eq!(is_fmc_compatible(&fht), true); | ||
|
||
fht.fht_minor_ver = 0xff; | ||
assert_eq!(is_fmc_compatible(&fht), true); | ||
|
||
fht.fht_major_ver = 2; | ||
assert_eq!(is_fmc_compatible(&fht), false); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters