vmbase: aarch64: Move power to platform
This commit add new directory `arch` that is intended to hold all
platform specific source code. Additionally, it moves functions `reboot`, `shutdown` the newly created directory.
Bug: 362733888
Test: m libvmbase
Change-Id: I515407e2fa55603c07651ef5d85c8c782f5307cd
diff --git a/libs/libvmbase/src/power.rs b/libs/libvmbase/src/power.rs
index 9240acf..e3461c5 100644
--- a/libs/libvmbase/src/power.rs
+++ b/libs/libvmbase/src/power.rs
@@ -13,26 +13,18 @@
// limitations under the License.
//! Functions for shutting down the VM.
+use crate::arch::platform;
-use smccc::{
- psci::{system_off, system_reset},
- Hvc,
-};
-
-/// Makes a `PSCI_SYSTEM_OFF` call to shutdown the VM.
+/// Call shutdown VM using platform specific code.
///
/// Panics if it returns an error.
pub fn shutdown() -> ! {
- system_off::<Hvc>().unwrap();
- #[allow(clippy::empty_loop)]
- loop {}
+ platform::shutdown();
}
-/// Makes a `PSCI_SYSTEM_RESET` call to shutdown the VM abnormally.
+/// Call reboot VM using platform specific code.
///
/// Panics if it returns an error.
pub fn reboot() -> ! {
- system_reset::<Hvc>().unwrap();
- #[allow(clippy::empty_loop)]
- loop {}
+ platform::reboot();
}