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 : |
| 30 | sdbusplus::server::object::object< |
| 31 | sdbusplus::xyz::openbmc_project::Common::server::UUID>, |
| 32 | sdbusplus::server::object::object< |
| 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 | |
Cheng C Yang | 2ca7a0f | 2019-12-19 10:46:42 +0800 | [diff] [blame] | 43 | System(sdbusplus::bus::bus& bus, const std::string& objPath, |
| 44 | uint8_t* smbiosTableStorage) : |
Cheng C Yang | b4651b9 | 2019-12-19 00:59:01 +0800 | [diff] [blame] | 45 | sdbusplus::server::object::object< |
| 46 | sdbusplus::xyz::openbmc_project::Common::server::UUID>( |
| 47 | bus, objPath.c_str()), |
| 48 | sdbusplus::server::object::object< |
| 49 | sdbusplus::xyz::openbmc_project::Inventory::Decorator::server:: |
| 50 | Revision>(bus, objPath.c_str()), |
| 51 | path(objPath), storage(smbiosTableStorage) |
| 52 | { |
| 53 | std::string input = "0"; |
| 54 | uUID(input); |
| 55 | version("0.00"); |
| 56 | } |
| 57 | |
| 58 | std::string uUID(std::string value) override; |
| 59 | |
| 60 | std::string version(std::string value) override; |
| 61 | |
| 62 | private: |
| 63 | /** @brief Path of the group instance */ |
| 64 | std::string path; |
| 65 | |
Cheng C Yang | 2ca7a0f | 2019-12-19 10:46:42 +0800 | [diff] [blame] | 66 | uint8_t* storage; |
Cheng C Yang | b4651b9 | 2019-12-19 00:59:01 +0800 | [diff] [blame] | 67 | |
| 68 | struct BIOSInfo |
| 69 | { |
| 70 | uint8_t type; |
| 71 | uint8_t length; |
| 72 | uint16_t handle; |
| 73 | uint8_t vendor; |
| 74 | uint8_t biosVersion; |
| 75 | uint16_t startAddrSegment; |
| 76 | uint8_t releaseData; |
| 77 | uint8_t romSize; |
| 78 | uint64_t characteristics; |
| 79 | uint16_t externCharacteristics; |
| 80 | uint8_t systemBIOSMajor; |
| 81 | uint8_t systemBIOSMinor; |
| 82 | uint8_t embeddedFirmwareMajor; |
| 83 | uint8_t embeddedFirmwareMinor; |
| 84 | } __attribute__((packed)); |
| 85 | |
| 86 | struct UUID |
| 87 | { |
| 88 | uint32_t timeLow; |
| 89 | uint16_t timeMid; |
| 90 | uint16_t timeHiAndVer; |
| 91 | uint8_t clockSeqHi; |
| 92 | uint8_t clockSeqLow; |
| 93 | uint8_t node[6]; |
| 94 | } __attribute__((packed)); |
| 95 | |
| 96 | struct SystemInfo |
| 97 | { |
| 98 | uint8_t type; |
| 99 | uint8_t length; |
| 100 | uint16_t handle; |
| 101 | uint8_t manufacturer; |
| 102 | uint8_t productName; |
| 103 | uint8_t version; |
| 104 | uint8_t serialNum; |
| 105 | struct UUID uUID; |
| 106 | uint8_t wakeupType; |
| 107 | uint8_t skuNum; |
| 108 | uint8_t family; |
| 109 | } __attribute__((packed)); |
| 110 | }; |
| 111 | |
| 112 | } // namespace smbios |
| 113 | |
| 114 | } // namespace phosphor |