Jason M. Bills | d1e4060 | 2019-05-09 11:43:51 -0700 | [diff] [blame] | 1 | /* |
| 2 | // Copyright (c) 2019 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 |
| 18 | #include <peci.h> |
| 19 | |
| 20 | #include <cstdint> |
| 21 | #include <vector> |
| 22 | |
| 23 | namespace peci_pcie |
| 24 | { |
Patrick Williams | 42a9ac8 | 2023-05-10 07:51:22 -0500 | [diff] [blame] | 25 | static constexpr const char* peciPCIeObject = "xyz.openbmc_project.PCIe"; |
| 26 | static constexpr const char* peciPCIePath = |
Lakshmi Yadlapati | de3bae3 | 2023-03-31 13:05:12 -0500 | [diff] [blame] | 27 | "/xyz/openbmc_project/inventory/pcie"; |
Patrick Williams | 42a9ac8 | 2023-05-10 07:51:22 -0500 | [diff] [blame] | 28 | static constexpr const char* peciPCIeDeviceInterface = |
Lakshmi Yadlapati | de3bae3 | 2023-03-31 13:05:12 -0500 | [diff] [blame] | 29 | "xyz.openbmc_project.Inventory.Item.PCIeDevice"; |
Jason M. Bills | e6bd6d4 | 2023-06-28 14:36:19 -0700 | [diff] [blame] | 30 | static constexpr const char* peciPCIeAssetInterface = |
Lakshmi Yadlapati | 4fe704c | 2023-04-07 08:23:04 -0500 | [diff] [blame] | 31 | "xyz.openbmc_project.Inventory.Decorator.Asset"; |
Jason M. Bills | d1e4060 | 2019-05-09 11:43:51 -0700 | [diff] [blame] | 32 | |
| 33 | static constexpr const int maxPCIBuses = 256; |
| 34 | static constexpr const int maxPCIDevices = 32; |
| 35 | static constexpr const int maxPCIFunctions = 8; |
| 36 | |
| 37 | static constexpr const int peciCheckInterval = 10; |
Jason M. Bills | ee6d80b | 2021-06-11 07:37:30 -0700 | [diff] [blame] | 38 | static constexpr const int osStandbyDelaySeconds = 10; |
Spencer Ku | bb5efe7 | 2021-09-02 16:11:14 +0800 | [diff] [blame] | 39 | |
| 40 | static constexpr const int pointToCapStruct = 0x34; |
| 41 | static constexpr const int maskOfCLS = 0x0F; |
| 42 | |
| 43 | static constexpr const int capPointerOffset = 1; |
| 44 | static constexpr const int linkStatusOffset = 18; |
| 45 | |
| 46 | // PCIe version |
| 47 | // GEN1 : 0001b : transfer rate 2.5GB |
| 48 | // GEN2 : 0010b : transfer rate 5GB |
| 49 | // GEN3 : 0011b : transfer rate 8GB |
| 50 | // GEN4 : 0100b : transfer rate 16GB |
| 51 | // GEN5 : 0101b : transfer rate 32GB |
| 52 | enum GenerationInUse : int |
| 53 | { |
| 54 | pcieGen1 = 1, |
| 55 | pcieGen2, |
| 56 | pcieGen3, |
| 57 | pcieGen4, |
| 58 | pcieGen5 |
| 59 | }; |
Jason M. Bills | d1e4060 | 2019-05-09 11:43:51 -0700 | [diff] [blame] | 60 | } // namespace peci_pcie |