Implement conversions between ErrorCode and u32/u64

Implement TryFrom and From traits for ErrorCode to support conversions
between ErrorCode and u32/u64 types. According to the PSCI
specification, error code values are represented as 32-bit or 64-bit
signed integers. These new trait implementations allow ErrorCode to be
converted to and from u32/u64, making it possible to use the values
directly in registers.

Signed-off-by: Imre Kis <imre.kis@arm.com>
Change-Id: If4b4151760d8d7600d65d1c3d83d317547223457
3 files changed
tree: 5a3372b1f5b41385e6732efc98fc969a6150fdc3
  1. src/
  2. .gitignore
  3. Cargo.lock
  4. Cargo.toml
  5. dco.txt
  6. LICENSE-APACHE
  7. LICENSE-MIT
  8. README.md
README.md

Arm Power State Coordination Interface (PSCI) library

This crate aims to offer functions and user-friendly types for parsing and constructing arguments of Arm Power State Coordination Interface (PSCI) calls. This functionality can be beneficial for both firmware and OS components.

However, doing the actual SMC/HVC/ERET calls, or implementing power management logic is beyond the scope of this crate.

Implemented features

  • Handling all PSCI 1.3 mandatory and optional functions
  • Handling both 32-bit and 64-bit call formats
  • Dedicated types for common PSCI call arguments
  • Unit tests

Limitations

  • The implementation does not handle pre-1.0 format suspend power state (see 5.4.2.1 Original format)

License

The project is MIT and Apache-2.0 dual licensed, see LICENSE-APACHE and LICENSE-MIT.

Maintainers

arm-psci is a trustedfirmware.org maintained project. All contributions are ultimately merged by the maintainers listed below.

Contributing

Please follow the directions of the Trusted Firmware Processes.

Contributions are handled through review.trustedfirmware.org.

Reporting Security Issues

Please follow the directions of the Trusted Firmware Security Center.


Copyright 2025 Arm Limited and/or its affiliates open-source-office@arm.com