* @brief 获取 CPU 核心数量 * @return Expected 成功返回核心数,失败返回错误 * @pre fdt_header_ 不为空 */
| 52 | * @pre fdt_header_ 不为空 |
| 53 | */ |
| 54 | [[nodiscard]] auto GetCoreCount() const -> Expected<size_t> { |
| 55 | assert(fdt_header_ != nullptr && "fdt_header_ is null"); |
| 56 | |
| 57 | return CountNodesByDeviceType("cpu").and_then( |
| 58 | [](size_t count) -> Expected<size_t> { |
| 59 | if (count == 0) { |
| 60 | return std::unexpected(Error(ErrorCode::kFdtNodeNotFound)); |
| 61 | } |
| 62 | return count; |
| 63 | }); |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * @brief 判断 PSCI 信息 |