blob: 4753a01718da2f19119c7e720a33059308148666 [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<
Jason M. Bills33ae81f2023-04-26 09:06:08 -070031 sdbusplus::server::xyz::openbmc_project::common::UUID>,
Patrick Williams77b9c472022-07-22 19:26:57 -050032 sdbusplus::server::object_t<
Jason M. Bills33ae81f2023-04-26 09:06:08 -070033 sdbusplus::server::xyz::openbmc_project::inventory::decorator::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<
Jason M. Bills33ae81f2023-04-26 09:06:08 -070046 sdbusplus::server::xyz::openbmc_project::common::UUID>(
Cheng C Yangb4651b92019-12-19 00:59:01 +080047 bus, objPath.c_str()),
Jason M. Bills33ae81f2023-04-26 09:06:08 -070048 sdbusplus::server::object_t<sdbusplus::server::xyz::openbmc_project::
49 inventory::decorator::Revision>(
Patrick Williams77b9c472022-07-22 19:26:57 -050050 bus, objPath.c_str()),
Jonathan Domanf2d8bb42023-07-26 10:13:34 -070051 bus(bus), path(objPath), storage(smbiosTableStorage)
Cheng C Yangb4651b92019-12-19 00:59:01 +080052 {
53 std::string input = "0";
Jason M. Billse7770992021-05-14 13:24:33 -070054 uuid(input);
Cheng C Yangb4651b92019-12-19 00:59:01 +080055 version("0.00");
56 }
57
Jason M. Billse7770992021-05-14 13:24:33 -070058 std::string uuid(std::string value) override;
Cheng C Yangb4651b92019-12-19 00:59:01 +080059
60 std::string version(std::string value) override;
Jayaprakash Mutyala7393e482022-09-19 18:18:59 +000061 sdbusplus::bus_t& bus;
Cheng C Yangb4651b92019-12-19 00:59:01 +080062
63 private:
64 /** @brief Path of the group instance */
65 std::string path;
66
Cheng C Yang2ca7a0f2019-12-19 10:46:42 +080067 uint8_t* storage;
Cheng C Yangb4651b92019-12-19 00:59:01 +080068
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;
Jason M. Billse7770992021-05-14 13:24:33 -0700106 struct UUID uuid;
Cheng C Yangb4651b92019-12-19 00:59:01 +0800107 uint8_t wakeupType;
108 uint8_t skuNum;
109 uint8_t family;
110 } __attribute__((packed));
111};
112
113} // namespace smbios
114
115} // namespace phosphor