Add helper for register count used by a version
Prior to FF-A v1.2 the specification defined 8 registers for making FF-A
calls. Starting from FF-A v1.2 however 18 registers are used for all
calls. Add a helper method to check this.
Signed-off-by: Balint Dobszay <balint.dobszay@arm.com>
Change-Id: I64837e12306a01b788ccf013c6dbde0bc4e2eccd
diff --git a/src/lib.rs b/src/lib.rs
index fb30191..5ad7ce3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -345,6 +345,11 @@
pub fn is_compatible_to(&self, callee_version: &Version) -> bool {
self.0 == callee_version.0 && self.1 <= callee_version.1
}
+
+ /// Returns true if the specified FF-A version uses 18 registers for calls, false if it uses 8.
+ pub fn needs_18_regs(&self) -> bool {
+ *self >= Version(1, 2)
+ }
}
impl TryFrom<u32> for Version {
@@ -2432,6 +2437,12 @@
use super::*;
#[test]
+ fn version_reg_count() {
+ assert!(!Version(1, 1).needs_18_regs());
+ assert!(Version(1, 2).needs_18_regs())
+ }
+
+ #[test]
fn part_info_get_regs() {
let uuid = Uuid::parse_str("a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8").unwrap();
let uuid_bytes = uuid.as_bytes();