blob: 80822e2d27c8b3813b1026e1e48327ecd0593b86 [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 :
Patrick Williams77b9c472022-07-22 19:26:57 -050030 sdbusplus::server::object_t<
Zhikui Ren18a5ab92020-09-01 21:35:20 -070031 sdbusplus::xyz::openbmc_project::Common::server::UUID>,
Patrick Williams77b9c472022-07-22 19:26:57 -050032 sdbusplus::server::object_t<
Zhikui Ren18a5ab92020-09-01 21:35:20 -070033 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
Patrick Williams77b9c472022-07-22 19:26:57 -050043 System(sdbusplus::bus_t& bus, const std::string& objPath,
Cheng C Yang2ca7a0f2019-12-19 10:46:42 +080044 uint8_t* smbiosTableStorage) :
Patrick Williams77b9c472022-07-22 19:26:57 -050045 sdbusplus::server::object_t<
Cheng C Yangb4651b92019-12-19 00:59:01 +080046 sdbusplus::xyz::openbmc_project::Common::server::UUID>(
47 bus, objPath.c_str()),
Jayaprakash Mutyala7393e482022-09-19 18:18:59 +000048 bus(bus),
Patrick Williams77b9c472022-07-22 19:26:57 -050049 sdbusplus::server::object_t<sdbusplus::xyz::openbmc_project::Inventory::
50 Decorator::server::Revision>(
51 bus, objPath.c_str()),
Cheng C Yangb4651b92019-12-19 00:59:01 +080052 path(objPath), storage(smbiosTableStorage)
53 {
54 std::string input = "0";
Jason M. Billse7770992021-05-14 13:24:33 -070055 uuid(input);
Cheng C Yangb4651b92019-12-19 00:59:01 +080056 version("0.00");
57 }
58
Jason M. Billse7770992021-05-14 13:24:33 -070059 std::string uuid(std::string value) override;
Cheng C Yangb4651b92019-12-19 00:59:01 +080060
61 std::string version(std::string value) override;
Jayaprakash Mutyala7393e482022-09-19 18:18:59 +000062 sdbusplus::bus_t& bus;
Cheng C Yangb4651b92019-12-19 00:59:01 +080063
64 private:
65 /** @brief Path of the group instance */
66 std::string path;
67
Cheng C Yang2ca7a0f2019-12-19 10:46:42 +080068 uint8_t* storage;
Cheng C Yangb4651b92019-12-19 00:59:01 +080069
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;
Jason M. Billse7770992021-05-14 13:24:33 -0700107 struct UUID uuid;
Cheng C Yangb4651b92019-12-19 00:59:01 +0800108 uint8_t wakeupType;
109 uint8_t skuNum;
110 uint8_t family;
111 } __attribute__((packed));
112};
113
114} // namespace smbios
115
116} // namespace phosphor