[pvmfw] Use smccc::hvc64 from crate psci in pvmfw
Bug: 245889995
Test: m pvmfw_img
Change-Id: I19f298fdb8671250b1a01b587dcb715e26a897bb
diff --git a/pvmfw/Android.bp b/pvmfw/Android.bp
index 0d845f9..4254ecc 100644
--- a/pvmfw/Android.bp
+++ b/pvmfw/Android.bp
@@ -20,6 +20,7 @@
"liblibfdt",
"liblog_rust_nostd",
"libonce_cell_nostd",
+ "libpsci",
"libpvmfw_avb_nostd",
"libpvmfw_embedded_key",
"libpvmfw_fdt_template",
diff --git a/pvmfw/src/hvc/trng.rs b/pvmfw/src/hvc/trng.rs
index d347693..53d5881 100644
--- a/pvmfw/src/hvc/trng.rs
+++ b/pvmfw/src/hvc/trng.rs
@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-use crate::smccc;
use core::fmt;
use core::result;
+use psci::smccc;
/// Standard SMCCC TRNG error values as described in DEN 0098 1.0 REL0.
#[derive(Debug, Clone)]
diff --git a/pvmfw/src/smccc.rs b/pvmfw/src/smccc.rs
index ccf2680..16f5a62 100644
--- a/pvmfw/src/smccc.rs
+++ b/pvmfw/src/smccc.rs
@@ -13,40 +13,7 @@
// limitations under the License.
use core::{fmt, result};
-
-// TODO(b/245889995): use psci-0.1.1 crate
-#[inline(always)]
-pub fn hvc64(function: u32, args: [u64; 17]) -> [u64; 18] {
- #[cfg(target_arch = "aarch64")]
- unsafe {
- let mut ret = [0; 18];
-
- core::arch::asm!(
- "hvc #0",
- inout("x0") function as u64 => ret[0],
- inout("x1") args[0] => ret[1],
- inout("x2") args[1] => ret[2],
- inout("x3") args[2] => ret[3],
- inout("x4") args[3] => ret[4],
- inout("x5") args[4] => ret[5],
- inout("x6") args[5] => ret[6],
- inout("x7") args[6] => ret[7],
- inout("x8") args[7] => ret[8],
- inout("x9") args[8] => ret[9],
- inout("x10") args[9] => ret[10],
- inout("x11") args[10] => ret[11],
- inout("x12") args[11] => ret[12],
- inout("x13") args[12] => ret[13],
- inout("x14") args[13] => ret[14],
- inout("x15") args[14] => ret[15],
- inout("x16") args[15] => ret[16],
- inout("x17") args[16] => ret[17],
- options(nomem, nostack)
- );
-
- ret
- }
-}
+use psci::smccc::hvc64;
/// Standard SMCCC error values as described in DEN 0028E.
#[derive(Debug, Clone)]