xref: /openbmc/smbios-mdr/include/system.hpp (revision f2d8bb48)
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         sdbusplus::server::object_t<sdbusplus::server::xyz::openbmc_project::
49                                         inventory::decorator::Revision>(
50             bus, objPath.c_str()),
51         bus(bus), path(objPath), storage(smbiosTableStorage)
52     {
53         std::string input = "0";
54         uuid(input);
55         version("0.00");
56     }
57 
58     std::string uuid(std::string value) override;
59 
60     std::string version(std::string value) override;
61     sdbusplus::bus_t& bus;
62 
63   private:
64     /** @brief Path of the group instance */
65     std::string path;
66 
67     uint8_t* storage;
68 
69     struct BIOSInfo
70     {
71         uint8_t type;
72         uint8_t length;
73         uint16_t handle;
74         uint8_t vendor;
75         uint8_t biosVersion;
76         uint16_t startAddrSegment;
77         uint8_t releaseData;
78         uint8_t romSize;
79         uint64_t characteristics;
80         uint16_t externCharacteristics;
81         uint8_t systemBIOSMajor;
82         uint8_t systemBIOSMinor;
83         uint8_t embeddedFirmwareMajor;
84         uint8_t embeddedFirmwareMinor;
85     } __attribute__((packed));
86 
87     struct UUID
88     {
89         uint32_t timeLow;
90         uint16_t timeMid;
91         uint16_t timeHiAndVer;
92         uint8_t clockSeqHi;
93         uint8_t clockSeqLow;
94         uint8_t node[6];
95     } __attribute__((packed));
96 
97     struct SystemInfo
98     {
99         uint8_t type;
100         uint8_t length;
101         uint16_t handle;
102         uint8_t manufacturer;
103         uint8_t productName;
104         uint8_t version;
105         uint8_t serialNum;
106         struct UUID uuid;
107         uint8_t wakeupType;
108         uint8_t skuNum;
109         uint8_t family;
110     } __attribute__((packed));
111 };
112 
113 } // namespace smbios
114 
115 } // namespace phosphor
116