blob: cf69cb7efb11a31f674c13abc218187c706aa724 [file] [log] [blame]
Cheng C Yangb4651b92019-12-19 00:59:01 +08001/*
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
Zhikui Ren18a5ab92020-09-01 21:35:20 -070018#include "smbios_mdrv2.hpp"
Cheng C Yangb4651b92019-12-19 00:59:01 +080019
20#include <xyz/openbmc_project/Common/UUID/server.hpp>
21#include <xyz/openbmc_project/Inventory/Decorator/Revision/server.hpp>
22
23namespace phosphor
24{
25
26namespace smbios
27{
28
Zhikui Ren18a5ab92020-09-01 21:35:20 -070029class System :
30 sdbusplus::server::object::object<
31 sdbusplus::xyz::openbmc_project::Common::server::UUID>,
32 sdbusplus::server::object::object<
33 sdbusplus::xyz::openbmc_project::Inventory::Decorator::server::Revision>
Cheng C Yangb4651b92019-12-19 00:59:01 +080034{
35 public:
36 System() = delete;
37 ~System() = default;
Cheng C Yang2ca7a0f2019-12-19 10:46:42 +080038 System(const System&) = delete;
39 System& operator=(const System&) = delete;
40 System(System&&) = default;
41 System& operator=(System&&) = default;
Cheng C Yangb4651b92019-12-19 00:59:01 +080042
Cheng C Yang2ca7a0f2019-12-19 10:46:42 +080043 System(sdbusplus::bus::bus& bus, const std::string& objPath,
44 uint8_t* smbiosTableStorage) :
Cheng C Yangb4651b92019-12-19 00:59:01 +080045 sdbusplus::server::object::object<
46 sdbusplus::xyz::openbmc_project::Common::server::UUID>(
47 bus, objPath.c_str()),
48 sdbusplus::server::object::object<
49 sdbusplus::xyz::openbmc_project::Inventory::Decorator::server::
50 Revision>(bus, objPath.c_str()),
51 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
62 private:
63 /** @brief Path of the group instance */
64 std::string path;
65
Cheng C Yang2ca7a0f2019-12-19 10:46:42 +080066 uint8_t* storage;
Cheng C Yangb4651b92019-12-19 00:59:01 +080067
68 struct BIOSInfo
69 {
70 uint8_t type;
71 uint8_t length;
72 uint16_t handle;
73 uint8_t vendor;
74 uint8_t biosVersion;
75 uint16_t startAddrSegment;
76 uint8_t releaseData;
77 uint8_t romSize;
78 uint64_t characteristics;
79 uint16_t externCharacteristics;
80 uint8_t systemBIOSMajor;
81 uint8_t systemBIOSMinor;
82 uint8_t embeddedFirmwareMajor;
83 uint8_t embeddedFirmwareMinor;
84 } __attribute__((packed));
85
86 struct UUID
87 {
88 uint32_t timeLow;
89 uint16_t timeMid;
90 uint16_t timeHiAndVer;
91 uint8_t clockSeqHi;
92 uint8_t clockSeqLow;
93 uint8_t node[6];
94 } __attribute__((packed));
95
96 struct SystemInfo
97 {
98 uint8_t type;
99 uint8_t length;
100 uint16_t handle;
101 uint8_t manufacturer;
102 uint8_t productName;
103 uint8_t version;
104 uint8_t serialNum;
105 struct UUID uUID;
106 uint8_t wakeupType;
107 uint8_t skuNum;
108 uint8_t family;
109 } __attribute__((packed));
110};
111
112} // namespace smbios
113
114} // namespace phosphor