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