Cheng C Yang | b4651b9 | 2019-12-19 00:59:01 +0800 | [diff] [blame] | 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 |
Zhikui Ren | 18a5ab9 | 2020-09-01 21:35:20 -0700 | [diff] [blame] | 18 | #include "smbios_mdrv2.hpp" |
Cheng C Yang | b4651b9 | 2019-12-19 00:59:01 +0800 | [diff] [blame] | 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 | |
Zhikui Ren | 18a5ab9 | 2020-09-01 21:35:20 -0700 | [diff] [blame] | 29 | class System : |
Patrick Williams | 77b9c47 | 2022-07-22 19:26:57 -0500 | [diff] [blame] | 30 | sdbusplus::server::object_t< |
Zhikui Ren | 18a5ab9 | 2020-09-01 21:35:20 -0700 | [diff] [blame] | 31 | sdbusplus::xyz::openbmc_project::Common::server::UUID>, |
Patrick Williams | 77b9c47 | 2022-07-22 19:26:57 -0500 | [diff] [blame] | 32 | sdbusplus::server::object_t< |
Zhikui Ren | 18a5ab9 | 2020-09-01 21:35:20 -0700 | [diff] [blame] | 33 | sdbusplus::xyz::openbmc_project::Inventory::Decorator::server::Revision> |
Cheng C Yang | b4651b9 | 2019-12-19 00:59:01 +0800 | [diff] [blame] | 34 | { |
| 35 | public: |
| 36 | System() = delete; |
| 37 | ~System() = default; |
Cheng C Yang | 2ca7a0f | 2019-12-19 10:46:42 +0800 | [diff] [blame] | 38 | System(const System&) = delete; |
| 39 | System& operator=(const System&) = delete; |
| 40 | System(System&&) = default; |
| 41 | System& operator=(System&&) = default; |
Cheng C Yang | b4651b9 | 2019-12-19 00:59:01 +0800 | [diff] [blame] | 42 | |
Patrick Williams | 77b9c47 | 2022-07-22 19:26:57 -0500 | [diff] [blame] | 43 | System(sdbusplus::bus_t& bus, const std::string& objPath, |
Cheng C Yang | 2ca7a0f | 2019-12-19 10:46:42 +0800 | [diff] [blame] | 44 | uint8_t* smbiosTableStorage) : |
Patrick Williams | 77b9c47 | 2022-07-22 19:26:57 -0500 | [diff] [blame] | 45 | sdbusplus::server::object_t< |
Cheng C Yang | b4651b9 | 2019-12-19 00:59:01 +0800 | [diff] [blame] | 46 | sdbusplus::xyz::openbmc_project::Common::server::UUID>( |
| 47 | bus, objPath.c_str()), |
Jayaprakash Mutyala | 7393e48 | 2022-09-19 18:18:59 +0000 | [diff] [blame] | 48 | bus(bus), |
Patrick Williams | 77b9c47 | 2022-07-22 19:26:57 -0500 | [diff] [blame] | 49 | sdbusplus::server::object_t<sdbusplus::xyz::openbmc_project::Inventory:: |
| 50 | Decorator::server::Revision>( |
| 51 | bus, objPath.c_str()), |
Cheng C Yang | b4651b9 | 2019-12-19 00:59:01 +0800 | [diff] [blame] | 52 | path(objPath), storage(smbiosTableStorage) |
| 53 | { |
| 54 | std::string input = "0"; |
Jason M. Bills | e777099 | 2021-05-14 13:24:33 -0700 | [diff] [blame] | 55 | uuid(input); |
Cheng C Yang | b4651b9 | 2019-12-19 00:59:01 +0800 | [diff] [blame] | 56 | version("0.00"); |
| 57 | } |
| 58 | |
Jason M. Bills | e777099 | 2021-05-14 13:24:33 -0700 | [diff] [blame] | 59 | std::string uuid(std::string value) override; |
Cheng C Yang | b4651b9 | 2019-12-19 00:59:01 +0800 | [diff] [blame] | 60 | |
| 61 | std::string version(std::string value) override; |
Jayaprakash Mutyala | 7393e48 | 2022-09-19 18:18:59 +0000 | [diff] [blame] | 62 | sdbusplus::bus_t& bus; |
Cheng C Yang | b4651b9 | 2019-12-19 00:59:01 +0800 | [diff] [blame] | 63 | |
| 64 | private: |
| 65 | /** @brief Path of the group instance */ |
| 66 | std::string path; |
| 67 | |
Cheng C Yang | 2ca7a0f | 2019-12-19 10:46:42 +0800 | [diff] [blame] | 68 | uint8_t* storage; |
Cheng C Yang | b4651b9 | 2019-12-19 00:59:01 +0800 | [diff] [blame] | 69 | |
| 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. Bills | e777099 | 2021-05-14 13:24:33 -0700 | [diff] [blame] | 107 | struct UUID uuid; |
Cheng C Yang | b4651b9 | 2019-12-19 00:59:01 +0800 | [diff] [blame] | 108 | uint8_t wakeupType; |
| 109 | uint8_t skuNum; |
| 110 | uint8_t family; |
| 111 | } __attribute__((packed)); |
| 112 | }; |
| 113 | |
| 114 | } // namespace smbios |
| 115 | |
| 116 | } // namespace phosphor |