1 // Copyright (c) 2021 Intel Corporation 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #pragma once 16 17 #include <boost/asio/io_context.hpp> 18 #include <sdbusplus/asio/connection.hpp> 19 20 #define DEBUG_PRINT \ 21 if constexpr (false) \ 22 std::cerr 23 24 namespace cpu_info 25 { 26 27 /** Host states which are of interest just to cpuinfo use cases. */ 28 enum class HostState 29 { 30 /** Host CPU is powered off. */ 31 off, 32 /** Host CPU is powered on, but BIOS has not completed POST. */ 33 postInProgress, 34 /** BIOS has completed POST. */ 35 postComplete 36 }; 37 38 /** Current host state - initialized to "off" */ 39 extern HostState hostState; 40 41 /** 42 * Register D-Bus match handlers to keep hostState current. The D-Bus logic is 43 * entirely asynchronous, so hostState will never change from "off" until after 44 * this function is called and the asio event loop is running. 45 * 46 * @param[in] conn D-Bus ASIO connection. 47 */ 48 void hostStateSetup(const std::shared_ptr<sdbusplus::asio::connection>& conn); 49 50 } // namespace cpu_info 51