| 115 | // !start skip(error.error) |
| 116 | impl Error { |
| 117 | pub fn sbi_error_code(&self) -> usize { |
| 118 | match &self { |
| 119 | Self::AddressNotAligned() => SBI_ERR_INVALID_ADDRESS as usize, |
| 120 | Self::AddressNotInConfidentialMemory() => SBI_ERR_INVALID_ADDRESS as usize, |
| 121 | Self::AddressNotInNonConfidentialMemory() => SBI_ERR_INVALID_ADDRESS as usize, |
| 122 | Self::AddressTranslationFailed() => SBI_ERR_INVALID_ADDRESS as usize, |
| 123 | Self::Pointer(_) => SBI_ERR_INVALID_ADDRESS as usize, |
| 124 | |
| 125 | Self::InvalidParameter() => SBI_ERR_INVALID_PARAM as usize, |
| 126 | Self::InvalidConfidentialVmId() => SBI_ERR_INVALID_PARAM as usize, |
| 127 | Self::InvalidHartId() => SBI_ERR_INVALID_PARAM as usize, |
| 128 | Self::HartAlreadyRunning() => SBI_ERR_INVALID_PARAM as usize, |
| 129 | Self::HartNotExecutable() => SBI_ERR_INVALID_PARAM as usize, |
| 130 | Self::InvalidCall(_, _) => SBI_ERR_INVALID_PARAM as usize, |
| 131 | Self::PageTableCorrupted() => SBI_ERR_INVALID_PARAM as usize, |
| 132 | Self::UnsupportedPagingMode() => SBI_ERR_INVALID_PARAM as usize, |
| 133 | Self::FdtNotAlignedTo64Bits() => SBI_ERR_INVALID_PARAM as usize, |
| 134 | Self::FdtInvalidSize() => SBI_ERR_INVALID_PARAM as usize, |
| 135 | Self::InvalidNumberOfHartsInFdt() => SBI_ERR_INVALID_PARAM as usize, |
| 136 | Self::AuthBlobNotAlignedTo32Bits() => SBI_ERR_INVALID_PARAM as usize, |
| 137 | Self::AuthBlobInvalidSize() => SBI_ERR_INVALID_PARAM as usize, |
| 138 | Self::DeviceTreeError(_) => SBI_ERR_INVALID_PARAM as usize, |
| 139 | |
| 140 | Self::CannotStartNotStoppedHart() => SBI_ERR_ALREADY_AVAILABLE as usize, |
| 141 | Self::CannotStopNotStartedHart() => SBI_ERR_ALREADY_AVAILABLE as usize, |
| 142 | Self::CannotSuspedNotStartedHart() => SBI_ERR_ALREADY_AVAILABLE as usize, |
| 143 | Self::CannotStartNotSuspendedHart() => SBI_ERR_ALREADY_AVAILABLE as usize, |
| 144 | |
| 145 | _ => SBI_ERR_FAILED as usize, |
| 146 | } |
| 147 | } |
| 148 | } |
| 149 | // !end skip |