* @brief 判断 PSCI 信息 * @return Expected 成功返回空,失败返回错误 * @pre fdt_header_ 不为空 */
| 69 | * @pre fdt_header_ 不为空 |
| 70 | */ |
| 71 | [[nodiscard]] auto CheckPSCI() const -> Expected<void> { |
| 72 | assert(fdt_header_ != nullptr && "fdt_header_ is null"); |
| 73 | |
| 74 | return FindNode("/psci").and_then([this](int offset) -> Expected<void> { |
| 75 | return GetPsciMethod(offset).and_then( |
| 76 | [this, offset](const char* method) -> Expected<void> { |
| 77 | klog::Debug("PSCI method: {}", method); |
| 78 | if (strcmp(method, "smc") != 0) { |
| 79 | return std::unexpected(Error(ErrorCode::kFdtPropertyNotFound)); |
| 80 | } |
| 81 | return ValidatePsciFunctionIds(offset); |
| 82 | }); |
| 83 | }); |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * @brief 获取内存信息 |