Fix handling of the VersionOut interface
The Interface::VersionOut variant is special, since it doesn't have a
function ID. Make sure that the is_32bit() and minimum_ffa_version()
methods can handle this correctly.
Signed-off-by: Balint Dobszay <balint.dobszay@arm.com>
Change-Id: If4c4b0f45b33643237f7ce59bc1c16c2bb6ffbe8
diff --git a/src/lib.rs b/src/lib.rs
index 9f8dc2d..7a93b99 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1309,7 +1309,7 @@
DirectMsgArgs::PowerWarmBootReq { .. } => Some(FuncId::MsgSendDirectReq32),
DirectMsgArgs::VmCreated { .. } => Some(FuncId::MsgSendDirectReq32),
DirectMsgArgs::VmDestructed { .. } => Some(FuncId::MsgSendDirectReq32),
- _ => None,
+ _ => panic!("Invalid direct request arguments: {:#?}", args),
},
Interface::MsgSendDirectResp { args, .. } => match args {
DirectMsgArgs::Args32(_) => Some(FuncId::MsgSendDirectResp32),
@@ -1318,7 +1318,7 @@
DirectMsgArgs::PowerPsciResp { .. } => Some(FuncId::MsgSendDirectResp32),
DirectMsgArgs::VmCreatedAck { .. } => Some(FuncId::MsgSendDirectResp32),
DirectMsgArgs::VmDestructedAck { .. } => Some(FuncId::MsgSendDirectResp32),
- _ => None,
+ _ => panic!("Invalid direct response arguments: {:#?}", args),
},
Interface::MsgSendDirectReq2 { .. } => Some(FuncId::MsgSendDirectReq64_2),
Interface::MsgSendDirectResp2 { .. } => Some(FuncId::MsgSendDirectResp64_2),
@@ -1369,12 +1369,19 @@
/// Returns true if this is a 32-bit call, or false if it is a 64-bit call.
pub fn is_32bit(&self) -> bool {
- // TODO: self should always have a function ID?
+ if matches!(self, Self::VersionOut { .. }) {
+ return true;
+ }
+
self.function_id().unwrap().is_32bit()
}
/// Returns the FF-A version that has introduced the function ID.
pub fn minimum_ffa_version(&self) -> Version {
+ if matches!(self, Self::VersionOut { .. }) {
+ return Version(1, 0);
+ }
+
self.function_id().unwrap().minimum_ffa_version()
}