xref: /openbmc/entity-manager/src/devicetree_vpd_parser/machine_context.hpp (revision cfc7f4f423c8163c394fbd777afcaf10a835206f)
1*cfc7f4f4SChristopher Meis /*
2*cfc7f4f4SChristopher Meis // Copyright (c) 2024 Hewlett Packard Enterprise
3*cfc7f4f4SChristopher Meis //
4*cfc7f4f4SChristopher Meis // Licensed under the Apache License, Version 2.0 (the "License");
5*cfc7f4f4SChristopher Meis // you may not use this file except in compliance with the License.
6*cfc7f4f4SChristopher Meis // You may obtain a copy of the License at
7*cfc7f4f4SChristopher Meis //
8*cfc7f4f4SChristopher Meis //      http://www.apache.org/licenses/LICENSE-2.0
9*cfc7f4f4SChristopher Meis //
10*cfc7f4f4SChristopher Meis // Unless required by applicable law or agreed to in writing, software
11*cfc7f4f4SChristopher Meis // distributed under the License is distributed on an "AS IS" BASIS,
12*cfc7f4f4SChristopher Meis // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*cfc7f4f4SChristopher Meis // See the License for the specific language governing permissions and
14*cfc7f4f4SChristopher Meis // limitations under the License.
15*cfc7f4f4SChristopher Meis */
16*cfc7f4f4SChristopher Meis 
17*cfc7f4f4SChristopher Meis #pragma once
18*cfc7f4f4SChristopher Meis 
19*cfc7f4f4SChristopher Meis #include <sdbusplus/async.hpp>
20*cfc7f4f4SChristopher Meis #include <xyz/openbmc_project/Inventory/Decorator/Asset/aserver.hpp>
21*cfc7f4f4SChristopher Meis 
22*cfc7f4f4SChristopher Meis class MachineContext :
23*cfc7f4f4SChristopher Meis     public sdbusplus::aserver::xyz::openbmc_project::inventory::decorator::
24*cfc7f4f4SChristopher Meis         Asset<MachineContext>
25*cfc7f4f4SChristopher Meis {
26*cfc7f4f4SChristopher Meis   public:
27*cfc7f4f4SChristopher Meis     explicit MachineContext(sdbusplus::async::context& ctx, auto path) :
28*cfc7f4f4SChristopher Meis         sdbusplus::aserver::xyz::openbmc_project::inventory::decorator::Asset<
29*cfc7f4f4SChristopher Meis             MachineContext>(ctx, path) {};
30*cfc7f4f4SChristopher Meis 
31*cfc7f4f4SChristopher Meis     void populateFromDeviceTree();
32*cfc7f4f4SChristopher Meis 
33*cfc7f4f4SChristopher Meis     static bool keyNodeExists();
34*cfc7f4f4SChristopher Meis 
35*cfc7f4f4SChristopher Meis   private:
36*cfc7f4f4SChristopher Meis     static constexpr auto nodeBasePath = "/proc/device-tree/";
37*cfc7f4f4SChristopher Meis };
38