xref: /openbmc/smbios-mdr/include/system.hpp (revision defbc2ac)
1 /*
2 // Copyright (c) 2018 Intel Corporation
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 */
16 
17 #pragma once
18 #include "smbios_mdrv2.hpp"
19 
20 #include <xyz/openbmc_project/Common/UUID/server.hpp>
21 #include <xyz/openbmc_project/Inventory/Decorator/Revision/server.hpp>
22 
23 namespace phosphor
24 {
25 
26 namespace smbios
27 {
28 
29 class System :
30     sdbusplus::server::object_t<
31         sdbusplus::server::xyz::openbmc_project::common::UUID>,
32     sdbusplus::server::object_t<
33         sdbusplus::server::xyz::openbmc_project::inventory::decorator::Revision>
34 {
35   public:
36     System() = delete;
37     ~System() = default;
38     System(const System&) = delete;
39     System& operator=(const System&) = delete;
40     System(System&&) = default;
41     System& operator=(System&&) = default;
42 
43     System(sdbusplus::bus_t& bus, const std::string& objPath,
44            uint8_t* smbiosTableStorage) :
45         sdbusplus::server::object_t<
46             sdbusplus::server::xyz::openbmc_project::common::UUID>(
47             bus, objPath.c_str()),
48         bus(bus),
49         sdbusplus::server::object_t<sdbusplus::server::xyz::openbmc_project::
50                                         inventory::decorator::Revision>(
51             bus, objPath.c_str()),
52         path(objPath), storage(smbiosTableStorage)
53     {
54         std::string input = "0";
55         uuid(input);
56         version("0.00");
57     }
58 
59     std::string uuid(std::string value) override;
60 
61     std::string version(std::string value) override;
62     sdbusplus::bus_t& bus;
63 
64   private:
65     /** @brief Path of the group instance */
66     std::string path;
67 
68     uint8_t* storage;
69 
70     struct BIOSInfo
71     {
72         uint8_t type;
73         uint8_t length;
74         uint16_t handle;
75         uint8_t vendor;
76         uint8_t biosVersion;
77         uint16_t startAddrSegment;
78         uint8_t releaseData;
79         uint8_t romSize;
80         uint64_t characteristics;
81         uint16_t externCharacteristics;
82         uint8_t systemBIOSMajor;
83         uint8_t systemBIOSMinor;
84         uint8_t embeddedFirmwareMajor;
85         uint8_t embeddedFirmwareMinor;
86     } __attribute__((packed));
87 
88     struct UUID
89     {
90         uint32_t timeLow;
91         uint16_t timeMid;
92         uint16_t timeHiAndVer;
93         uint8_t clockSeqHi;
94         uint8_t clockSeqLow;
95         uint8_t node[6];
96     } __attribute__((packed));
97 
98     struct SystemInfo
99     {
100         uint8_t type;
101         uint8_t length;
102         uint16_t handle;
103         uint8_t manufacturer;
104         uint8_t productName;
105         uint8_t version;
106         uint8_t serialNum;
107         struct UUID uuid;
108         uint8_t wakeupType;
109         uint8_t skuNum;
110         uint8_t family;
111     } __attribute__((packed));
112 };
113 
114 } // namespace smbios
115 
116 } // namespace phosphor
117