blob: ac75a0cc5144d9062e0acd349be74b6362f029ba [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
Josh Lehan027277a2023-09-11 05:28:19 -070020#include <sdbusplus/asio/connection.hpp>
Cheng C Yangb4651b92019-12-19 00:59:01 +080021#include <xyz/openbmc_project/Common/UUID/server.hpp>
22#include <xyz/openbmc_project/Inventory/Decorator/Revision/server.hpp>
23
24namespace phosphor
25{
26
27namespace smbios
28{
29
Zhikui Ren18a5ab92020-09-01 21:35:20 -070030class System :
Patrick Williams77b9c472022-07-22 19:26:57 -050031 sdbusplus::server::object_t<
Jason M. Bills33ae81f2023-04-26 09:06:08 -070032 sdbusplus::server::xyz::openbmc_project::common::UUID>,
Patrick Williams77b9c472022-07-22 19:26:57 -050033 sdbusplus::server::object_t<
Jason M. Bills33ae81f2023-04-26 09:06:08 -070034 sdbusplus::server::xyz::openbmc_project::inventory::decorator::Revision>
Cheng C Yangb4651b92019-12-19 00:59:01 +080035{
36 public:
37 System() = delete;
38 ~System() = default;
Cheng C Yang2ca7a0f2019-12-19 10:46:42 +080039 System(const System&) = delete;
40 System& operator=(const System&) = delete;
41 System(System&&) = default;
42 System& operator=(System&&) = default;
Cheng C Yangb4651b92019-12-19 00:59:01 +080043
Josh Lehan027277a2023-09-11 05:28:19 -070044 System(std::shared_ptr<sdbusplus::asio::connection> bus,
45 std::string objPath, uint8_t* smbiosTableStorage,
46 std::string filePath) :
Patrick Williams77b9c472022-07-22 19:26:57 -050047 sdbusplus::server::object_t<
Jason M. Bills33ae81f2023-04-26 09:06:08 -070048 sdbusplus::server::xyz::openbmc_project::common::UUID>(
Josh Lehan027277a2023-09-11 05:28:19 -070049 *bus, objPath.c_str()),
Jason M. Bills33ae81f2023-04-26 09:06:08 -070050 sdbusplus::server::object_t<sdbusplus::server::xyz::openbmc_project::
51 inventory::decorator::Revision>(
Josh Lehan027277a2023-09-11 05:28:19 -070052 *bus, objPath.c_str()),
53 bus(std::move(bus)), path(std::move(objPath)),
54 storage(smbiosTableStorage), smbiosFilePath(std::move(filePath))
Cheng C Yangb4651b92019-12-19 00:59:01 +080055 {
56 std::string input = "0";
Jason M. Billse7770992021-05-14 13:24:33 -070057 uuid(input);
Cheng C Yangb4651b92019-12-19 00:59:01 +080058 version("0.00");
59 }
60
Jason M. Billse7770992021-05-14 13:24:33 -070061 std::string uuid(std::string value) override;
Cheng C Yangb4651b92019-12-19 00:59:01 +080062
63 std::string version(std::string value) override;
Josh Lehan027277a2023-09-11 05:28:19 -070064
65 std::shared_ptr<sdbusplus::asio::connection> bus;
Cheng C Yangb4651b92019-12-19 00:59:01 +080066
67 private:
68 /** @brief Path of the group instance */
69 std::string path;
70
Cheng C Yang2ca7a0f2019-12-19 10:46:42 +080071 uint8_t* storage;
Cheng C Yangb4651b92019-12-19 00:59:01 +080072
73 struct BIOSInfo
74 {
75 uint8_t type;
76 uint8_t length;
77 uint16_t handle;
78 uint8_t vendor;
79 uint8_t biosVersion;
80 uint16_t startAddrSegment;
81 uint8_t releaseData;
82 uint8_t romSize;
83 uint64_t characteristics;
84 uint16_t externCharacteristics;
85 uint8_t systemBIOSMajor;
86 uint8_t systemBIOSMinor;
87 uint8_t embeddedFirmwareMajor;
88 uint8_t embeddedFirmwareMinor;
89 } __attribute__((packed));
90
91 struct UUID
92 {
93 uint32_t timeLow;
94 uint16_t timeMid;
95 uint16_t timeHiAndVer;
96 uint8_t clockSeqHi;
97 uint8_t clockSeqLow;
98 uint8_t node[6];
99 } __attribute__((packed));
100
101 struct SystemInfo
102 {
103 uint8_t type;
104 uint8_t length;
105 uint16_t handle;
106 uint8_t manufacturer;
107 uint8_t productName;
108 uint8_t version;
109 uint8_t serialNum;
Jason M. Billse7770992021-05-14 13:24:33 -0700110 struct UUID uuid;
Cheng C Yangb4651b92019-12-19 00:59:01 +0800111 uint8_t wakeupType;
112 uint8_t skuNum;
113 uint8_t family;
114 } __attribute__((packed));
Josh Lehan027277a2023-09-11 05:28:19 -0700115
116 std::string smbiosFilePath;
Cheng C Yangb4651b92019-12-19 00:59:01 +0800117};
118
119} // namespace smbios
120
121} // namespace phosphor