Merged
调整gen接口属性修改代码 #345
调整gen接口属性修改代码 #345
Merged
byosoft_wangjingAdd on Jan 22
Total: 449 files changed+6701-3274
@@ -1,5 +1,8 @@
1# Changelog1# Changelog
2All notable changes to this project will be documented in this file.2All notable changes to this project will be documented in this file.
3+## [1.2.76] - 2026-03-16
4+根据文档调整接口属性
5+ 
3## [1.2.75] - 2026-03-166## [1.2.75] - 2026-03-16
4清理cleancode7清理cleancode
5 8 
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2023 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2023 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -48,5 +48,10 @@ bool awm_m11p_card::init(mc::mutable_dict& csr_object, const mc::dict& connector
48} // namespace dev48} // namespace dev
49 49 
50MC_REFLECT(dev::awm_m11p_card,50MC_REFLECT(dev::awm_m11p_card,
51- ((SystemId, "SystemId"))((m_pcie_device, "bmc.dev.PCIeDevice"))((m_pcie_card,51+ ((SystemId, "SystemId"))
52- "bmc.dev.PCIeCard")))52+ ((m_pcie_device, "bmc.dev.PCIeDevice"))
53+ ((m_pcie_device_oem, "bmc.dev.PCIeDevice.Oem"))
54+ ((m_pcie_device_status, "bmc.dev.PCIeDevice.Status"))
55+ ((m_pcie_device_pcie_function, "bmc.dev.PCIeDevice.PCIeFunction"))
56+ ((m_pcie_card, "bmc.dev.PCIeCard"))
57+ ((m_pcie_card_oem, "bmc.dev.PCIeCard.Oem")))
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2023 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -15,6 +15,10 @@
15 15 
16#include "interface/pcie_card.h"16#include "interface/pcie_card.h"
17#include "interface/pcie_device.h"17#include "interface/pcie_device.h"
18+#include "interface/pcie_card/oem.h"
19+#include "interface/pcie_device/oem.h"
20+#include "interface/pcie_device/status.h"
21+#include "interface/pcie_device/pcie_function.h"
18#include <mc/engine.h>22#include <mc/engine.h>
19 23 
20namespace dev {24namespace dev {
@@ -23,7 +27,7 @@ class awm_m11p_card : public mc::engine::object<awm_m11p_card> {
23public:27public:
24 MC_OBJECT(awm_m11p_card, "PCIeGpuCard",28 MC_OBJECT(awm_m11p_card, "PCIeGpuCard",
25 "/bmc/dev/Systems/1/PCIeGpuCard/${object_name}", // TBD:SystemId暂时写死29 "/bmc/dev/Systems/1/PCIeGpuCard/${object_name}", // TBD:SystemId暂时写死
26- (PCIeDevice)(PCIeCard))30+ (PCIeDevice)(PCIeDevice_Oem)(PCIeDevice_Status)(PCIeDevice_PCIeFunction)(PCIeCard)(PCIeCard_Oem))
27 awm_m11p_card() = default;31 awm_m11p_card() = default;
28 ~awm_m11p_card() = default;32 ~awm_m11p_card() = default;
29 bool start();33 bool start();
@@ -31,8 +35,12 @@ public:
31 bool init(mc::mutable_dict& csr_object, const mc::dict& connector);35 bool init(mc::mutable_dict& csr_object, const mc::dict& connector);
32 bool replace_dynamic_property(mc::mutable_dict& object, const mc::dict& connector);36 bool replace_dynamic_property(mc::mutable_dict& object, const mc::dict& connector);
33 37 
34- PCIeDevice m_pcie_device;38+ PCIeDevice m_pcie_device;
35- PCIeCard m_pcie_card;39+ PCIeDevice_Oem m_pcie_device_oem;
40+ PCIeDevice_Status m_pcie_device_status;
41+ PCIeDevice_PCIeFunction m_pcie_device_pcie_function;
42+ PCIeCard m_pcie_card;
43+ PCIeCard_Oem m_pcie_card_oem;
36 uint8_t SystemId;44 uint8_t SystemId;
37};45};
38 46 
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2023 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -37,18 +37,21 @@ bool awm_m11p_gpu::init(mc::mutable_dict& config, const mc::dict& connector) {
37}37}
38 38 
39bool awm_m11p_gpu::reset_default_properties() {39bool awm_m11p_gpu::reset_default_properties() {
40- m_processor.Presence = false;40+ m_processor.Presence = false;
41- m_gpu.InfoRomVersion = "";41+ m_processor.FirmwareVersion = "";
42- m_gpu.BuildDate = "";42+ m_processor.SerialNumber = "";
43- m_gpu.UUID = "";43+ m_processor.PartNumber = "";
44- m_gpu.Utilization = 0;44+ m_processor_metrics.TemperatureCelsius = 0;
45- m_gpu.TemperatureCelsius = 0;45+ m_processor_metrics.PowerWatts = 0;
46- m_gpu_power.PowerWatts = 0;46+ m_gpu.InfoRomVersion = "";
47- m_gpu_power.PowerBrakeState = 255;47+ m_gpu.BuildDate = "";
48- m_gpu_power.ExternalPowerSufficient = 255;48+ m_gpu.UUID = "";
49- m_gpu_status.ECCModeEnabled = 255;49+ m_gpu.Utilization = 0;
50- m_gpu_status.ECCModePendingEnabled = 255;50+ m_gpu_power.PowerBrakeState = 255;
51- m_gpu_status.ResetRequired = 255;51+ m_gpu_power.ExternalPowerSufficient = 255;
52+ m_gpu_status.ECCModeEnabled = 255;
53+ m_gpu_status.ECCModePendingEnabled = 255;
54+ m_gpu_status.ResetRequired = 255;
52 55 
53 return true;56 return true;
54}57}
@@ -56,5 +59,5 @@ bool awm_m11p_gpu::reset_default_properties() {
56} // namespace dev59} // namespace dev
57 60 
58MC_REFLECT(dev::awm_m11p_gpu,61MC_REFLECT(dev::awm_m11p_gpu,
59- ((m_processor, "bmc.dev.Processor"))((m_gpu, "bmc.dev.Gpu"))(62+((m_processor, "bmc.dev.Processor"))((m_processor_metrics, "bmc.dev.Processor.Metrics"))((m_gpu, "bmc.dev.Gpu"))(
60 (m_gpu_power, "bmc.dev.Gpu.Power"))((m_gpu_status, "bmc.dev.Gpu.Status")))63 (m_gpu_power, "bmc.dev.Gpu.Power"))((m_gpu_status, "bmc.dev.Gpu.Status")))
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2023 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -17,13 +17,14 @@
17#include "interface/gpu/power.h"17#include "interface/gpu/power.h"
18#include "interface/gpu/status.h"18#include "interface/gpu/status.h"
19#include "interface/processor.h"19#include "interface/processor.h"
20+#include "interface/processor/metrics.h"
20#include <mc/engine.h>21#include <mc/engine.h>
21 22 
22namespace dev {23namespace dev {
23 24 
24class awm_m11p_gpu : public mc::engine::object<awm_m11p_gpu> {25class awm_m11p_gpu : public mc::engine::object<awm_m11p_gpu> {
25public:26public:
26- MC_OBJECT(awm_m11p_gpu, "GraphicsController", "GraphicsController/${Id}", (Processor)(Gpu)(Gpu_Power)(Gpu_Status))27+ MC_OBJECT(awm_m11p_gpu, "GraphicsController", "GraphicsController/${Id}", (Processor)(Processor_Metrics)(Gpu)(Gpu_Power)(Gpu_Status))
27 28 
28 awm_m11p_gpu() = default;29 awm_m11p_gpu() = default;
29 ~awm_m11p_gpu() = default;30 ~awm_m11p_gpu() = default;
@@ -35,6 +36,7 @@ public:
35 bool reset_default_properties();36 bool reset_default_properties();
36 37 
37 Processor m_processor;38 Processor m_processor;
39+ Processor_Metrics m_processor_metrics;
38 Gpu m_gpu;40 Gpu m_gpu;
39 Gpu_Power m_gpu_power;41 Gpu_Power m_gpu_power;
40 Gpu_Status m_gpu_status;42 Gpu_Status m_gpu_status;
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2023 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -37,15 +37,17 @@ bool awm_m11p_memory::init(mc::mutable_dict& config, const mc::dict& connector)
37}37}
38 38 
39bool awm_m11p_memory::reset_default_properties() {39bool awm_m11p_memory::reset_default_properties() {
40- m_memory.Manufacturer = "";40+ m_memory.Manufacturer = "";
41- m_memory.PartNumber = "";41+ m_memory.PartNumber = "";
42- m_memory.Utilization = 0;42+ m_memory.DoubleBitErrorPageCount = 0;
43- m_memory.DoubleBitErrorPageCount = 0;43+ m_memory.SingleBitErrorPageCount = 0;
44- m_memory.SingleBitErrorPageCount = 0;44+ m_memory_metrics.MemoryUsagePercent = 0;
45- 45+ m_memory_metrics.BandwidthUsagePercent = 0;
46 return true;46 return true;
47}47}
48 48 
49} // namespace dev49} // namespace dev
50 50 
51-MC_REFLECT(dev::awm_m11p_memory, ((m_memory, "bmc.dev.Memory")))51+MC_REFLECT(dev::awm_m11p_memory,
52+ ((m_memory, "bmc.dev.Memory"))
53+ ((m_memory_metrics, "bmc.dev.Memory.Metrics")))
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2023 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -14,13 +14,14 @@
14#define __AWM_M11P_MEMORY_H__14#define __AWM_M11P_MEMORY_H__
15 15 
16#include "interface/memory.h"16#include "interface/memory.h"
17+#include "interface/memory/metrics.h"
17#include <mc/engine.h>18#include <mc/engine.h>
18 19 
19namespace dev {20namespace dev {
20 21 
21class awm_m11p_memory : public mc::engine::object<awm_m11p_memory> {22class awm_m11p_memory : public mc::engine::object<awm_m11p_memory> {
22public:23public:
23- MC_OBJECT(awm_m11p_memory, "Memory", "Memory/${DimmNum}", (Memory))24+ MC_OBJECT(awm_m11p_memory, "Memory", "Memory/${DimmNum}", (Memory)(Memory_Metrics))
24 25 
25 awm_m11p_memory() = default;26 awm_m11p_memory() = default;
26 ~awm_m11p_memory() = default;27 ~awm_m11p_memory() = default;
@@ -32,6 +33,7 @@ public:
32 bool reset_default_properties();33 bool reset_default_properties();
33 34 
34 Memory m_memory;35 Memory m_memory;
36+ Memory_Metrics m_memory_metrics;
35};37};
36 38 
37} // namespace dev39} // namespace dev
@@ -8,13 +8,17 @@
8 "Path": "/bmc/dev/Systems/:SystemId/PCIeGpuCard/:Id",8 "Path": "/bmc/dev/Systems/:SystemId/PCIeGpuCard/:Id",
9 "Interfaces": [9 "Interfaces": [
10 "bmc.dev.PCIeDevice",10 "bmc.dev.PCIeDevice",
11- "bmc.dev.PCIeCard"11+ "bmc.dev.PCIeCard",
12+ "bmc.dev.PCIeDevice.PCIeFunction",
13+ "bmc.dev.PCIeDevice.Oem",
14+ "bmc.dev.PCIeCard.Oem"
12 ]15 ]
13 },16 },
14 "GraphicsController": {17 "GraphicsController": {
15 "Path": ":Parent/Gpu/:Id",18 "Path": ":Parent/Gpu/:Id",
16 "Interfaces": [19 "Interfaces": [
17 "bmc.dev.Processor",20 "bmc.dev.Processor",
21+ "bmc.dev.Processor.Metrics",
18 "bmc.dev.Gpu",22 "bmc.dev.Gpu",
19 "bmc.dev.Gpu.Power",23 "bmc.dev.Gpu.Power",
20 "bmc.dev.Gpu.Status"24 "bmc.dev.Gpu.Status"
@@ -23,7 +27,8 @@
23 "Memory": {27 "Memory": {
24 "Path": ":Parent/Memory/:Id",28 "Path": ":Parent/Memory/:Id",
25 "Interfaces": [29 "Interfaces": [
26- "bmc.dev.Memory"30+ "bmc.dev.Memory",
31+ "bmc.dev.Memory.Metrics"
27 ]32 ]
28 }33 }
29 }34 }
@@ -60,27 +60,34 @@
60 "PCIeGpuCard_1": {60 "PCIeGpuCard_1": {
61 "bmc.dev.PCIeDevice": {61 "bmc.dev.PCIeDevice": {
62 "DeviceName": "PCIe Card $ (AWM M11P)",62 "DeviceName": "PCIe Card $ (AWM M11P)",
63- "FunctionClass": 3,63+ "Slot": "${Slot}",
64+ "DeviceType": "SingleFunction",
65+ "SlotType": "FullLength",
66+ "Model": "AWM M11P",
67+ "Manufacturer": "ALLWINMETA",
68+ "PartNumber": "",
69+ "SerialNumber": "",
70+ "FirmwareVersion": ""
71+ },
72+ "bmc.dev.PCIeCard": {
73+ "Name": "AWM M11P",
74+ "Description": "AWM M11P",
75+ "BoardName": "AWM M11P",
76+ "Health": "<=/Component_PCIeCard.Health"
77+ },
78+ "bmc.dev.PCIeDevice.PCIeFunction": {
64 "VendorId": "0x1fe0",79 "VendorId": "0x1fe0",
65 "DeviceId": "0x1010",80 "DeviceId": "0x1010",
66 "SubSystemVendorId": "0x1fe0",81 "SubSystemVendorId": "0x1fe0",
67 "SubSystemDeviceId": "0x1010",82 "SubSystemDeviceId": "0x1010",
68- "DeviceType": "SingleFunction",
69- "SlotType": "FullLength",
70 "FunctionProtocol": "PCIe",83 "FunctionProtocol": "PCIe",
71- "FunctionType": "Physical",84+ "FunctionType": "Physical"
85+ },
86+ "bmc.dev.PCIeDevice.Oem": {
87+ "FunctionClass": 3,
72 "ComponentType": 8,88 "ComponentType": 8,
73 "Container": "${Container}",89 "Container": "${Container}",
74 "GroupPosition": "PCIeDevice_1_${GroupPosition}"90 "GroupPosition": "PCIeDevice_1_${GroupPosition}"
75- },
76- "bmc.dev.PCIeCard": {
77- "Name": "AWM M11P",
78- "Model": "AWM M11P",
79- "Manufacturer": "ALLWINMETA",
80- "PartNumber": "",
81- "Description": "AWM M11P",
82- "BoardName": "AWM M11P",
83- "Health": "<=/Component_PCIeCard.Health"
84 }91 }
85 },92 },
86 "GraphicsController_1": {93 "GraphicsController_1": {
@@ -95,11 +102,13 @@
95 "ProcessorType": "GPU",102 "ProcessorType": "GPU",
96 "SocketDesignation": "1"103 "SocketDesignation": "1"
97 },104 },
105+ "bmc.dev.Processor.Metrics": {
106+ "TemperatureCelsius": "<=/Scanner_GPUTemp.Value |> expr(((($1 // 256) & 255) >= 128) ? (-(255 - (($1 // 256) & 255) + 1)) : (($1 // 256) & 255))",
107+ "PowerWatts": 0
108+ },
98 "bmc.dev.Gpu": {109 "bmc.dev.Gpu": {
99- "TemperatureCelsius": "<=/Scanner_GPUTemp.Value |> expr(((($1 // 256) & 255) >= 128) ? (-(255 - (($1 // 256) & 255) + 1)) : (($1 // 256) & 255))"
100 },110 },
101 "bmc.dev.Gpu.Power": {111 "bmc.dev.Gpu.Power": {
102- "PowerWatts": 0,
103 "PowerBrakeState": 255,112 "PowerBrakeState": 255,
104 "ExternalPowerSufficient": 255113 "ExternalPowerSufficient": 255
105 },114 },
@@ -116,6 +125,10 @@
116 "bmc.dev.Memory": {125 "bmc.dev.Memory": {
117 "DimmNum": 1,126 "DimmNum": 1,
118 "Manufacturer": "ALLWINMETA"127 "Manufacturer": "ALLWINMETA"
128+ },
129+ "bmc.dev.Memory.Metrics": {
130+ "MemoryUsagePercent": 0,
131+ "BandwidthUsagePercent": 0
119 }132 }
120 },133 },
121 "BoardPCIeCard_1": {134 "BoardPCIeCard_1": {
@@ -209,7 +222,7 @@
209 "EventKeyId": "PCIeCard.PCIeCardUncorrectableErr",222 "EventKeyId": "PCIeCard.PCIeCardUncorrectableErr",
210 "Condition": 1,223 "Condition": 1,
211 "LedFaultCode": "q$$",224 "LedFaultCode": "q$$",
212- "Reading": "<=/PCIeGpuCard_1.DiagnosticFault;<=/PCIeGpuCard_1.UCEByBIOS |> expr(($1 + $2) == 0 ? 0 : 1)",225+ "Reading": "<=/PCIeGpuCard_1.DiagnosticFault;<=/PCIeGpuCard_1.UCEByBios |> expr(($1 + $2) == 0 ? 0 : 1)",
213 "OperatorId": 5,226 "OperatorId": 5,
214 "Enabled": true,227 "Enabled": true,
215 "AdditionalInfo": "2",228 "AdditionalInfo": "2",
@@ -243,7 +256,7 @@
243 "Event_PCIeBandWidth": {256 "Event_PCIeBandWidth": {
244 "EventKeyId": "PCIeCard.PCIeCardBandWidthDecreased",257 "EventKeyId": "PCIeCard.PCIeCardBandWidthDecreased",
245 "Condition": 1,258 "Condition": 1,
246- "Reading": "<=/PCIeGpuCard_1.BandwidthReduction",259+ "Reading": "<=/PCIeGpuCard_1.BandwidthReduced",
247 "OperatorId": 5,260 "OperatorId": 5,
248 "Enabled": true,261 "Enabled": true,
249 "AdditionalInfo": "2",262 "AdditionalInfo": "2",
@@ -252,4 +265,4 @@
252 "Component": "#/Component_PCIeCard"265 "Component": "#/Component_PCIeCard"
253 }266 }
254 }267 }
255-}268+}
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2023 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2023 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -19,7 +19,7 @@
19 19 
20namespace dev {20namespace dev {
21 21 
22-class Gpu : public mc::engine::interface<Gpu, gen::Gpu> {22+class MC_API Gpu : public mc::engine::interface<Gpu, gen::Gpu> {
23public:23public:
24 Gpu() = default;24 Gpu() = default;
25 ~Gpu() = default;25 ~Gpu() = default;
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2023 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2023 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -19,7 +19,7 @@
19 19 
20namespace dev {20namespace dev {
21 21 
22-class Gpu_Power : public mc::engine::interface<Gpu_Power, gen::Gpu_Power> {22+class MC_API Gpu_Power : public mc::engine::interface<Gpu_Power, gen::Gpu_Power> {
23public:23public:
24 Gpu_Power() = default;24 Gpu_Power() = default;
25 ~Gpu_Power() = default;25 ~Gpu_Power() = default;
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2023 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2023 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -19,7 +19,7 @@
19 19 
20namespace dev {20namespace dev {
21 21 
22-class Gpu_Status : public mc::engine::interface<Gpu_Status, gen::Gpu_Status> {22+class MC_API Gpu_Status : public mc::engine::interface<Gpu_Status, gen::Gpu_Status> {
23public:23public:
24 Gpu_Status() = default;24 Gpu_Status() = default;
25 ~Gpu_Status() = default;25 ~Gpu_Status() = default;
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2023 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2023 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -19,7 +19,7 @@
19 19 
20namespace dev {20namespace dev {
21 21 
22-class Memory : public mc::engine::interface<Memory, gen::Memory> {22+class MC_API Memory : public mc::engine::interface<Memory, gen::Memory> {
23public:23public:
24 Memory() = default;24 Memory() = default;
25 ~Memory() = default;25 ~Memory() = default;
@@ -0,0 +1,15 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#include "metrics.h"
14+ 
15+MC_REFLECT(dev::Memory_Metrics)
@@ -0,0 +1,30 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#ifndef MEMORY_METRICS_H
14+#define MEMORY_METRICS_H
15+ 
16+#include "device_tree/interface/Memory/Metrics.h"
17+#include <mc/core/timer.h>
18+#include <mc/engine/service.h>
19+ 
20+namespace dev {
21+ 
22+class MC_API Memory_Metrics : public mc::engine::interface<Memory_Metrics, gen::Memory_Metrics> {
23+public:
24+ Memory_Metrics() = default;
25+ ~Memory_Metrics() = default;
26+};
27+ 
28+} // namespace dev
29+ 
30+#endif
@@ -1,9 +1,15 @@
1interface_sources = files(1interface_sources = files(
2 'gpu/power.cpp',2 'gpu/power.cpp',
3 'gpu/status.cpp',3 'gpu/status.cpp',
4+ 'pcie_card/oem.cpp',
5+ 'pcie_device/oem.cpp',
6+ 'pcie_device/status.cpp',
7+ 'pcie_device/pcie_function.cpp',
8+ 'memory/metrics.cpp',
4 'gpu.cpp',9 'gpu.cpp',
5 'memory.cpp',10 'memory.cpp',
6 'pcie_card.cpp',11 'pcie_card.cpp',
7 'pcie_device.cpp',12 'pcie_device.cpp',
8 'processor.cpp',13 'processor.cpp',
14+ 'processor/metrics.cpp',
9)15)
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2023 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2023 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -17,7 +17,7 @@
17 17 
18namespace dev {18namespace dev {
19 19 
20-class PCIeCard : public mc::engine::interface<PCIeCard, gen::PCIeCard> {20+class MC_API PCIeCard : public mc::engine::interface<PCIeCard, gen::PCIeCard> {
21public:21public:
22 uint8_t SystemId;22 uint8_t SystemId;
23};23};
@@ -0,0 +1,15 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#include "oem.h"
14+ 
15+MC_REFLECT(dev::PCIeCard_Oem)
@@ -0,0 +1,30 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#ifndef PCIE_CARD_OEM_H
14+#define PCIE_CARD_OEM_H
15+ 
16+#include "device_tree/interface/PCIeCard/Oem.h"
17+#include <mc/core/timer.h>
18+#include <mc/engine/service.h>
19+ 
20+namespace dev {
21+ 
22+class MC_API PCIeCard_Oem : public mc::engine::interface<PCIeCard_Oem, gen::PCIeCard_Oem> {
23+public:
24+ PCIeCard_Oem() = default;
25+ ~PCIeCard_Oem() = default;
26+};
27+ 
28+} // namespace dev
29+ 
30+#endif
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2023 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -28,23 +28,6 @@ bool PCIeDevice::SetRootBDF(uint8_t bus, uint8_t device, uint8_t function) {
28 return true;28 return true;
29}29}
30 30 
31-bool PCIeDevice::SetDeviceBDF(uint8_t bus, uint8_t device, uint8_t function) {
32- if (bus == 0 && device == 0 && function == 0) {
33- std::cerr << "Error: Invalid BDF values" << std::endl;
34- return false;
35- }
36- 
37- DevBus = bus;
38- DevDevice = device;
39- DevFunction = function;
40- 
41- post([this, bus, device, function]() {
42- pcie_device_bdf_changed(bus, device, function);
43- });
44- 
45- return true;
46-}
47- 
48void PCIeDevice::replace_dynamic_property(mc::mutable_dict& object, const mc::dict& connector) {31void PCIeDevice::replace_dynamic_property(mc::mutable_dict& object, const mc::dict& connector) {
49 mc::mutable_dict pcie_device_obj = object["bmc.dev.PCIeDevice"].as<mc::mutable_dict>();32 mc::mutable_dict pcie_device_obj = object["bmc.dev.PCIeDevice"].as<mc::mutable_dict>();
50 if (pcie_device_obj.contains("Slot")) {33 if (pcie_device_obj.contains("Slot")) {
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2023 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -20,7 +20,7 @@
20 20 
21namespace dev {21namespace dev {
22 22 
23-class PCIeDevice : public mc::engine::interface<PCIeDevice, gen::PCIeDevice> {23+class MC_API PCIeDevice : public mc::engine::interface<PCIeDevice, gen::PCIeDevice> {
24public:24public:
25 PCIeDevice() = default;25 PCIeDevice() = default;
26 ~PCIeDevice() = default;26 ~PCIeDevice() = default;
@@ -28,11 +28,9 @@ public:
28public:28public:
29 // 设备数接口实现29 // 设备数接口实现
30 bool SetRootBDF(uint8_t bus, uint8_t device, uint8_t function) override;30 bool SetRootBDF(uint8_t bus, uint8_t device, uint8_t function) override;
31- bool SetDeviceBDF(uint8_t bus, uint8_t device, uint8_t function) override;
32 31 
33public:32public:
34 void replace_dynamic_property(mc::mutable_dict& object, const mc::dict& connector);33 void replace_dynamic_property(mc::mutable_dict& object, const mc::dict& connector);
35- mc::signal<void(uint8_t, uint8_t, uint8_t)> pcie_device_bdf_changed;
36};34};
37 35 
38} // namespace dev36} // namespace dev
@@ -0,0 +1,15 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#include "oem.h"
14+ 
15+MC_REFLECT(dev::PCIeDevice_Oem)
@@ -0,0 +1,30 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#ifndef PCIE_DEVICE_OEM_H
14+#define PCIE_DEVICE_OEM_H
15+ 
16+#include "device_tree/interface/PCIeDevice/Oem.h"
17+#include <mc/core/timer.h>
18+#include <mc/engine/service.h>
19+ 
20+namespace dev {
21+ 
22+class MC_API PCIeDevice_Oem : public mc::engine::interface<PCIeDevice_Oem, gen::PCIeDevice_Oem> {
23+public:
24+ PCIeDevice_Oem() = default;
25+ ~PCIeDevice_Oem() = default;
26+};
27+ 
28+} // namespace dev
29+ 
30+#endif
@@ -0,0 +1,36 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#include "pcie_function.h"
14+#include "mc/format.h"
15+#include "mc/string.h"
16+ 
17+namespace dev {
18+ 
19+bool PCIeDevice_PCIeFunction::SetDeviceBDF(uint8_t bus, uint8_t device, uint8_t function) {
20+ if (bus == 0 && device == 0 && function == 0) {
21+ std::cerr << "Error: Invalid BDF values" << std::endl;
22+ return false;
23+ }
24+ 
25+ BusNumber = bus;
26+ DeviceNumber = device;
27+ FunctionNumber = function;
28+ 
29+ post([this, bus, device, function]() {
30+ pcie_device_bdf_changed(bus, device, function);
31+ });
32+ 
33+ return true;
34+}
35+} // namespace dev
36+MC_REFLECT(dev::PCIeDevice_PCIeFunction)
@@ -0,0 +1,37 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#ifndef PCIE_DEVICE_PCIEFUNCTION_H
14+#define PCIE_DEVICE_PCIEFUNCTION_H
15+ 
16+#include "device_tree/interface/PCIeDevice/PCIeFunction.h"
17+#include <mc/core/timer.h>
18+#include <mc/engine/service.h>
19+ 
20+namespace dev {
21+ 
22+class MC_API PCIeDevice_PCIeFunction : public mc::engine::interface<PCIeDevice_PCIeFunction, gen::PCIeDevice_PCIeFunction> {
23+public:
24+ PCIeDevice_PCIeFunction() = default;
25+ ~PCIeDevice_PCIeFunction() = default;
26+ 
27+public:
28+ // 设备数接口实现
29+ bool SetDeviceBDF(uint8_t bus, uint8_t device, uint8_t function) override;
30+ 
31+public:
32+ mc::signal<void(uint8_t, uint8_t, uint8_t)> pcie_device_bdf_changed;
33+};
34+ 
35+} // namespace dev
36+ 
37+#endif
@@ -0,0 +1,20 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#include "status.h"
14+ 
15+namespace dev {
16+ 
17+} // namespace dev
18+ 
19+MC_REFLECT(dev::PCIeDevice_Status)
20+ 
@@ -0,0 +1,31 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#ifndef PCIE_DEVICE_STATUS_H
14+#define PCIE_DEVICE_STATUS_H
15+ 
16+#include <device_tree/interface/PCIeDevice/Status.h>
17+#include <mc/core/timer.h>
18+#include <mc/engine/service.h>
19+ 
20+namespace dev {
21+ 
22+class MC_API PCIeDevice_Status : public mc::engine::interface<PCIeDevice_Status, gen::PCIeDevice_Status> {
23+public:
24+ PCIeDevice_Status() = default;
25+ ~PCIeDevice_Status() = default;
26+};
27+ 
28+} // namespace dev
29+ 
30+#endif // MOORETHREADS_PCIE_DEVICE_STATUS_H
31+ 
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2023 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2023 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -18,7 +18,7 @@
18 18 
19namespace dev {19namespace dev {
20 20 
21-class Processor : public mc::engine::interface<Processor, gen::Processor> {21+class MC_API Processor : public mc::engine::interface<Processor, gen::Processor> {
22public:22public:
23 Processor() = default;23 Processor() = default;
24 ~Processor() = default;24 ~Processor() = default;
@@ -0,0 +1,15 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+ #include "metrics.h"
14+ 
15+ MC_REFLECT(dev::Processor_Metrics)
@@ -0,0 +1,30 @@
1+/*
2+* Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+* openUBMC is licensed under Mulan PSL v2.
4+* You can use this software according to the terms and conditions of the Mulan PSL v2.
5+* You may obtain a copy of Mulan PSL v2 at:
6+* http://license.coscl.org.cn/MulanPSL2
7+* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+* See the Mulan PSL v2 for more details.
11+*/
12+ 
13+#ifndef PROCESSOR_METRICS_H
14+#define PROCESSOR_METRICS_H
15+
16+#include "device_tree/interface/Processor/Metrics.h"
17+#include <mc/core/timer.h>
18+#include <mc/engine/service.h>
19+
20+namespace dev {
21+
22+class MC_API Processor_Metrics : public mc::engine::interface<Processor_Metrics, gen::Processor_Metrics> {
23+public:
24+ Processor_Metrics() = default;
25+ ~Processor_Metrics() = default;
26+};
27+ 
28+} // namespace dev
29+ 
30+#endif
@@ -8,13 +8,17 @@
8 "Path": "/bmc/dev/Systems/:SystemId/PCIeGpuCard/:Id",8 "Path": "/bmc/dev/Systems/:SystemId/PCIeGpuCard/:Id",
9 "Interfaces": [9 "Interfaces": [
10 "bmc.dev.PCIeDevice",10 "bmc.dev.PCIeDevice",
11- "bmc.dev.PCIeCard"11+ "bmc.dev.PCIeCard",
12+ "bmc.dev.PCIeDevice.PCIeFunction",
13+ "bmc.dev.PCIeDevice.Oem",
14+ "bmc.dev.PCIeCard.Oem"
12 ]15 ]
13 },16 },
14 "GraphicsController": {17 "GraphicsController": {
15- "Path": ":Parent/Gpu/:Id",18+ "Path": ":Parent/GraphicsController/:Id",
16 "Interfaces": [19 "Interfaces": [
17 "bmc.dev.Processor",20 "bmc.dev.Processor",
21+ "bmc.dev.Processor.Metrics",
18 "bmc.dev.Gpu",22 "bmc.dev.Gpu",
19 "bmc.dev.Gpu.Power",23 "bmc.dev.Gpu.Power",
20 "bmc.dev.Gpu.Status"24 "bmc.dev.Gpu.Status"
@@ -23,8 +27,9 @@
23 "Memory": {27 "Memory": {
24 "Path": ":Parent/Memory/:Id",28 "Path": ":Parent/Memory/:Id",
25 "Interfaces": [29 "Interfaces": [
26- "bmc.dev.Memory"30+ "bmc.dev.Memory",
31+ "bmc.dev.Memory.Metrics"
27 ]32 ]
28 }33 }
29 }34 }
30-}35+}
@@ -46,27 +46,34 @@
46 "PCIeGpuCard_1": {46 "PCIeGpuCard_1": {
47 "bmc.dev.PCIeDevice": {47 "bmc.dev.PCIeDevice": {
48 "DeviceName": "PCIe Card $ (Moore Threads MTT S4000)",48 "DeviceName": "PCIe Card $ (Moore Threads MTT S4000)",
49- "FunctionClass": 3,49+ "Slot": "${Slot}",
50+ "DeviceType": "SingleFunction",
51+ "SlotType": "FullLength",
52+ "Model": "Moore Threads MTT S4000",
53+ "Manufacturer": "Moore Threads Technology Co.,Ltd",
54+ "PartNumber": "",
55+ "SerialNumber": "",
56+ "FirmwareVersion": ""
57+ },
58+ "bmc.dev.PCIeCard": {
59+ "Name": "Moore Threads MTT S4000",
60+ "Description": "MTT S4000 Series GPU",
61+ "BoardName": "Moore Threads MTT S4000",
62+ "Health": "<=/Component_PCIeCard.Health"
63+ },
64+ "bmc.dev.PCIeDevice.PCIeFunction": {
50 "VendorId": "0x1ed5",65 "VendorId": "0x1ed5",
51 "DeviceId": "0x0323",66 "DeviceId": "0x0323",
52 "SubSystemVendorId": "0x1ed5",67 "SubSystemVendorId": "0x1ed5",
53 "SubSystemDeviceId": "0x0323",68 "SubSystemDeviceId": "0x0323",
54- "DeviceType": "SingleFunction",
55- "SlotType": "FullLength",
56 "FunctionProtocol": "PCIe",69 "FunctionProtocol": "PCIe",
57- "FunctionType": "Physical",70+ "FunctionType": "Physical"
71+ },
72+ "bmc.dev.PCIeDevice.Oem": {
73+ "FunctionClass": 3,
58 "ComponentType": 8,74 "ComponentType": 8,
59 "Container": "${Container}",75 "Container": "${Container}",
60 "GroupPosition": "PCIeDevice_1_${GroupPosition}"76 "GroupPosition": "PCIeDevice_1_${GroupPosition}"
61- },
62- "bmc.dev.PCIeCard": {
63- "Name": "Moore Threads MTT S4000",
64- "Model": "Moore Threads MTT S4000",
65- "Manufacturer": "Moore Threads Technology Co.,Ltd",
66- "PartNumber": "",
67- "Description": "MTT S4000 Series GPU",
68- "BoardName": "Moore Threads MTT S4000",
69- "Health": "<=/Component_PCIeCard.Health"
70 }77 }
71 },78 },
72 "GraphicsController_1": {79 "GraphicsController_1": {
@@ -81,12 +88,14 @@
81 "ProcessorType": "GPU",88 "ProcessorType": "GPU",
82 "SocketDesignation": "1"89 "SocketDesignation": "1"
83 },90 },
84- "bmc.dev.Gpu": {91+ "bmc.dev.Processor.Metrics": {
85 "TemperatureCelsius": 0,92 "TemperatureCelsius": 0,
93+ "PowerWatts": 0
94+ },
95+ "bmc.dev.Gpu": {
86 "RefChip": "#/Chip_MTT"96 "RefChip": "#/Chip_MTT"
87 },97 },
88 "bmc.dev.Gpu.Power": {98 "bmc.dev.Gpu.Power": {
89- "PowerWatts": 0,
90 "PowerBrakeState": 255,99 "PowerBrakeState": 255,
91 "ExternalPowerSufficient": 255100 "ExternalPowerSufficient": 255
92 },101 },
@@ -103,6 +112,10 @@
103 "bmc.dev.Memory": {112 "bmc.dev.Memory": {
104 "DimmNum": 1,113 "DimmNum": 1,
105 "Manufacturer": "Moore Threads"114 "Manufacturer": "Moore Threads"
115+ },
116+ "bmc.dev.Memory.Metrics": {
117+ "MemoryUsagePercent": 0,
118+ "BandwidthUsagePercent": 0
106 }119 }
107 },120 },
108 "BoardPCIeCard_1": {121 "BoardPCIeCard_1": {
@@ -196,7 +209,7 @@
196 "EventKeyId": "PCIeCard.PCIeCardUncorrectableErr",209 "EventKeyId": "PCIeCard.PCIeCardUncorrectableErr",
197 "Condition": 1,210 "Condition": 1,
198 "LedFaultCode": "q$$",211 "LedFaultCode": "q$$",
199- "Reading": "<=/PCIeGpuCard_1.DiagnosticFault;<=/PCIeGpuCard_1.UCEByBIOS |> expr(($1 + $2) == 0 ? 0 : 1)",212+ "Reading": "<=/PCIeGpuCard_1.DiagnosticFault;<=/PCIeGpuCard_1.UCEByBios |> expr(($1 + $2) == 0 ? 0 : 1)",
200 "OperatorId": 5,213 "OperatorId": 5,
201 "Enabled": true,214 "Enabled": true,
202 "AdditionalInfo": "2",215 "AdditionalInfo": "2",
@@ -230,7 +243,7 @@
230 "Event_PCIeBandWidth": {243 "Event_PCIeBandWidth": {
231 "EventKeyId": "PCIeCard.PCIeCardBandWidthDecreased",244 "EventKeyId": "PCIeCard.PCIeCardBandWidthDecreased",
232 "Condition": 1,245 "Condition": 1,
233- "Reading": "<=/PCIeGpuCard_1.BandwidthReduction",246+ "Reading": "<=/PCIeGpuCard_1.BandwidthReduced",
234 "OperatorId": 5,247 "OperatorId": 5,
235 "Enabled": true,248 "Enabled": true,
236 "AdditionalInfo": "2",249 "AdditionalInfo": "2",
@@ -239,4 +252,4 @@
239 "Component": "#/Component_PCIeCard"252 "Component": "#/Component_PCIeCard"
240 }253 }
241 }254 }
242-}255+}
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -13,99 +13,5 @@
13#include "gpu.h"13#include "gpu.h"
14#include "mc/log.h"14#include "mc/log.h"
15#include <thread>15#include <thread>
16-#include "mc/debounce/average.h"
17- 
18-namespace dev {
19- 
20-// Constants for MTT temperature reading
21-static const uint8_t MTT_STATUS_REG = 0x00;
22-static const uint8_t MTT_DATA_REG = 0x0a;
23-static const uint8_t MTT_STATUS_DONE = 0x00;
24- 
25-void Gpu::init_debounce_config() {
26- debounce = std::make_unique<mc::debounce::Average>(window_size, is_signed);
27-}
28- 
29-bool Gpu::read_mtt_gpu_temperature(smbus_ptr smbus_obj) {
30- if (!smbus_obj) {
31- return false;
32- }
33- 
34- try {
35- // Step 1: Send command to trigger temperature measurement
36- const uint8_t get_temp_cmd[9] = {0x27, 0x1b, 0x06, 0x02, 0x01, 0x00, 0x04, 0x00, 0x00};
37- std::string write_payload(reinterpret_cast<const char*>(get_temp_cmd),
38- sizeof(get_temp_cmd));
39- auto [send_ok, _] = smbus_obj->send(0x01, write_payload);
40- if (!send_ok) {
41- ilog("MTT Error: Failed to send temperature command.");
42- TemperatureCelsius.set_value(static_cast<double>(GPU_TEMP_READ_FAILED));
43- return false;
44- }
45- 
46- std::this_thread::sleep_for(std::chrono::milliseconds(10));
47- 
48- // Step 2: Poll status register until done
49- int retry_count = 10;
50- bool done = false;
51- while (retry_count-- > 0) {
52- auto [ok, status_data] = smbus_obj->read(MTT_STATUS_REG, 4);
53- if (ok && !status_data.empty() && status_data[0] == MTT_STATUS_DONE) {
54- done = true;
55- break;
56- }
57- std::this_thread::sleep_for(std::chrono::milliseconds(10));
58- }
59- 
60- if (!done) {
61- ilog("MTT Error: Failed to get 'done' status while reading temperature.");
62- return false;
63- }
64- 
65- // Step 3: Read temperature data register
66- auto [read_ok, temp_data] = smbus_obj->read(MTT_DATA_REG, 4);
67- if (!read_ok || temp_data.empty()) {
68- ilog("MTT Error: Failed to read temperature data.");
69- temperaturedebounce++;
70- if( temperaturedebounce > MTT_MAX_DEBOUNCE_TIME ){
71- TemperatureCelsius.set_value(static_cast<double>(GPU_TEMP_READ_FAILED));
72- }
73- return false;
74- }
75- 
76- uint8_t raw_temp = temp_data[0];
77- if (raw_temp == 0 || (raw_temp & 0x80) != 0) {
78- temperaturedebounce++;
79- if( temperaturedebounce > MTT_MAX_DEBOUNCE_TIME ){
80- TemperatureCelsius.set_value(static_cast<double>(GPU_TEMP_READ_FAILED));
81- }
82- return false;
83- }
84- 
85- temperaturedebounce = 0;
86- if (debounce) {
87- std::optional<int> dbl_val = debounce->get_debounce_val(raw_temp);
88- if (!dbl_val) {
89- dlog("${error}", ("error", "read_mtt_gpu_temperature debounce failed: debounce value is invalid"));
90- return false;
91- }
92- dlog("read_mtt_gpu_temperature debounce successfully: original value=${value} debounced "
93- "value=${value1}",
94- ("value", raw_temp)("value1", *dbl_val));
95- raw_temp = *dbl_val;
96- }
97- TemperatureCelsius.set_value(static_cast<double>(raw_temp));
98- dlog("MTT GPU temperature updated: ${temp}°C", ("temp", raw_temp));
99- 
100- return true;
101- 
102- } catch (const std::exception& e) {
103- ilog("MTT read_gpu_temperature failed, exception: ${exception}", ("exception", e.what()));
104- TemperatureCelsius.set_value(static_cast<double>(GPU_TEMP_READ_FAILED));
105- return false;
106- }
107-}
108- 
109-} // namespace dev
110 16 
111MC_REFLECT(dev::Gpu)17MC_REFLECT(dev::Gpu)
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -19,26 +19,12 @@
19#include <smbus/smbus.h>19#include <smbus/smbus.h>
20#include <mc/debounce/base.h>20#include <mc/debounce/base.h>
21 21 
22-#define MTT_MAX_DEBOUNCE_TIME 6
23-#define GPU_TEMP_POWER_OFF 16384
24-#define GPU_TEMP_READ_FAILED 32768
25- 
26namespace dev {22namespace dev {
27 23 
28-using smbus_ptr = mc::shared_ptr<smbus>;24+class MC_API Gpu : public mc::engine::interface<Gpu, gen::Gpu> {
29- 
30-class Gpu : public mc::engine::interface<Gpu, gen::Gpu> {
31public:25public:
32 Gpu() = default;26 Gpu() = default;
33 ~Gpu() = default;27 ~Gpu() = default;
34- 
35- bool read_mtt_gpu_temperature(smbus_ptr smbus_obj);
36- void init_debounce_config();
37-private:
38- int temperaturedebounce = 0;
39- std::unique_ptr<mc::debounce::Base> debounce;
40- int window_size = 6;
41- bool is_signed = false;
42};28};
43 29 
44} // namespace dev30} // namespace dev
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -19,7 +19,7 @@
19 19 
20namespace dev {20namespace dev {
21 21 
22-class Gpu_Power : public mc::engine::interface<Gpu_Power, gen::Gpu_Power> {22+class MC_API Gpu_Power : public mc::engine::interface<Gpu_Power, gen::Gpu_Power> {
23public:23public:
24 Gpu_Power() = default;24 Gpu_Power() = default;
25 ~Gpu_Power() = default;25 ~Gpu_Power() = default;
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -19,7 +19,7 @@
19 19 
20namespace dev {20namespace dev {
21 21 
22-class Gpu_Status : public mc::engine::interface<Gpu_Status, gen::Gpu_Status> {22+class MC_API Gpu_Status : public mc::engine::interface<Gpu_Status, gen::Gpu_Status> {
23public:23public:
24 Gpu_Status() = default;24 Gpu_Status() = default;
25 ~Gpu_Status() = default;25 ~Gpu_Status() = default;
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -19,7 +19,7 @@
19 19 
20namespace dev {20namespace dev {
21 21 
22-class Memory : public mc::engine::interface<Memory, gen::Memory> {22+class MC_API Memory : public mc::engine::interface<Memory, gen::Memory> {
23public:23public:
24 Memory() = default;24 Memory() = default;
25 ~Memory() = default;25 ~Memory() = default;
@@ -0,0 +1,15 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#include "metrics.h"
14+ 
15+MC_REFLECT(dev::Memory_Metrics)
@@ -0,0 +1,30 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#ifndef MEMORY_METRICS_H
14+#define MEMORY_METRICS_H
15+ 
16+#include "device_tree/interface/Memory/Metrics.h"
17+#include <mc/core/timer.h>
18+#include <mc/engine/service.h>
19+ 
20+namespace dev {
21+ 
22+class MC_API Memory_Metrics : public mc::engine::interface<Memory_Metrics, gen::Memory_Metrics> {
23+public:
24+ Memory_Metrics() = default;
25+ ~Memory_Metrics() = default;
26+};
27+ 
28+} // namespace dev
29+ 
30+#endif
@@ -1,9 +1,15 @@
1interface_sources = files(1interface_sources = files(
2 'gpu/power.cpp',2 'gpu/power.cpp',
3 'gpu/status.cpp',3 'gpu/status.cpp',
4+ 'memory/metrics.cpp',
4 'gpu.cpp',5 'gpu.cpp',
5 'memory.cpp',6 'memory.cpp',
6 'pcie_card.cpp',7 'pcie_card.cpp',
8+ 'pcie_card/oem.cpp',
7 'pcie_device.cpp',9 'pcie_device.cpp',
10+ 'pcie_device/oem.cpp',
11+ 'pcie_device/status.cpp',
12+ 'pcie_device/pcie_function.cpp',
8 'processor.cpp',13 'processor.cpp',
14+ 'processor/metrics.cpp',
9)15)
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -17,7 +17,7 @@
17 17 
18namespace dev {18namespace dev {
19 19 
20-class PCIeCard : public mc::engine::interface<PCIeCard, gen::PCIeCard> {20+class MC_API PCIeCard : public mc::engine::interface<PCIeCard, gen::PCIeCard> {
21public:21public:
22 uint8_t SystemId;22 uint8_t SystemId;
23};23};
@@ -0,0 +1,20 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#include "oem.h"
14+ 
15+namespace dev {
16+ 
17+} // namespace dev
18+ 
19+MC_REFLECT(dev::PCIeCard_Oem)
20+ 
@@ -0,0 +1,29 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#ifndef MOORETHREADS_PCIECARD_OEM_INTERFACE_H
14+#define MOORETHREADS_PCIECARD_OEM_INTERFACE_H
15+ 
16+#include <device_tree/interface/PCIeCard/Oem.h>
17+ 
18+namespace dev {
19+ 
20+class MC_API PCIeCard_Oem : public mc::engine::interface<PCIeCard_Oem, gen::PCIeCard_Oem> {
21+public:
22+ PCIeCard_Oem() = default;
23+ ~PCIeCard_Oem() = default;
24+};
25+ 
26+} // namespace dev
27+ 
28+#endif // MOORETHREADS_PCIECARD_OEM_INTERFACE_H
29+ 
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -28,24 +28,6 @@ bool PCIeDevice::SetRootBDF(uint8_t bus, uint8_t device, uint8_t function) {
28 return true;28 return true;
29}29}
30 30 
31-bool PCIeDevice::SetDeviceBDF(uint8_t bus, uint8_t device, uint8_t function) {
32- if (bus == 0 && device == 0 && function == 0) {
33- std::cerr << "Error: Invalid BDF values" << std::endl;
34- return false;
35- }
36- 
37- DevBus = bus;
38- DevDevice = device;
39- DevFunction = function;
40- 
41- post([this, bus, device, function]() {
42- pcie_device_bdf_changed(bus, device, function);
43- });
44- 
45- return true;
46-}
47- 
48-/*获取动态数据函数*/
49void PCIeDevice::replace_dynamic_property(mc::mutable_dict& object, const mc::dict& connector) {31void PCIeDevice::replace_dynamic_property(mc::mutable_dict& object, const mc::dict& connector) {
50 /*获取PCIe设备对象*/32 /*获取PCIe设备对象*/
51 mc::mutable_dict pcie_device_obj = object["bmc.dev.PCIeDevice"].as<mc::mutable_dict>();33 mc::mutable_dict pcie_device_obj = object["bmc.dev.PCIeDevice"].as<mc::mutable_dict>();
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -20,21 +20,19 @@
20 20 
21namespace dev {21namespace dev {
22 22 
23-class PCIeDevice : public mc::engine::interface<PCIeDevice, gen::PCIeDevice> {23+class MC_API PCIeDevice : public mc::engine::interface<PCIeDevice, gen::PCIeDevice> {
24public:24public:
25 PCIeDevice() = default;25 PCIeDevice() = default;
26 ~PCIeDevice() = default;26 ~PCIeDevice() = default;
27 27 
28public:28public:
29- // 设备数接口实现29+ // 设备树接口实现
30 bool SetRootBDF(uint8_t bus, uint8_t device, uint8_t function) override;30 bool SetRootBDF(uint8_t bus, uint8_t device, uint8_t function) override;
31- bool SetDeviceBDF(uint8_t bus, uint8_t device, uint8_t function) override;
32 31 
33public:32public:
34 void replace_dynamic_property(mc::mutable_dict& object, const mc::dict& connector);33 void replace_dynamic_property(mc::mutable_dict& object, const mc::dict& connector);
35- mc::signal<void(uint8_t, uint8_t, uint8_t)> pcie_device_bdf_changed;
36};34};
37 35 
38} // namespace dev36} // namespace dev
39 37 
40-#endif // PCIE_DEVICE_H38+#endif // PCIE_DEVICE_H
@@ -0,0 +1,20 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#include "oem.h"
14+ 
15+namespace dev {
16+ 
17+} // namespace dev
18+ 
19+MC_REFLECT(dev::PCIeDevice_Oem)
20+ 
@@ -0,0 +1,31 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#ifndef MOORETHREADS_PCIE_DEVICE_OEM_H
14+#define MOORETHREADS_PCIE_DEVICE_OEM_H
15+ 
16+#include <device_tree/interface/PCIeDevice/Oem.h>
17+#include <mc/core/timer.h>
18+#include <mc/engine/service.h>
19+ 
20+namespace dev {
21+ 
22+class MC_API PCIeDevice_Oem : public mc::engine::interface<PCIeDevice_Oem, gen::PCIeDevice_Oem> {
23+public:
24+ PCIeDevice_Oem() = default;
25+ ~PCIeDevice_Oem() = default;
26+};
27+ 
28+} // namespace dev
29+ 
30+#endif // MOORETHREADS_PCIE_DEVICE_OEM_H
31+ 
@@ -0,0 +1,36 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+ #include "pcie_function.h"
14+ #include "mc/format.h"
15+ #include "mc/string.h"
16+
17+ namespace dev {
18+
19+ bool PCIeDevice_PCIeFunction::SetDeviceBDF(uint8_t bus, uint8_t device, uint8_t function) {
20+ if (bus == 0 && device == 0 && function == 0) {
21+ std::cerr << "Error: Invalid BDF values" << std::endl;
22+ return false;
23+ }
24+
25+ BusNumber = bus;
26+ DeviceNumber = device;
27+ FunctionNumber = function;
28+
29+ post([this, bus, device, function]() {
30+ pcie_device_bdf_changed(bus, device, function);
31+ });
32+
33+ return true;
34+ }
35+ } // namespace dev
36+ MC_REFLECT(dev::PCIeDevice_PCIeFunction)
@@ -0,0 +1,38 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#ifndef MOORETHREADS_PCIE_DEVICE_PCIEFUNCTION_H
14+#define MOORETHREADS_PCIE_DEVICE_PCIEFUNCTION_H
15+ 
16+#include <device_tree/interface/PCIeDevice/PCIeFunction.h>
17+#include <mc/core/timer.h>
18+#include <mc/engine/service.h>
19+ 
20+namespace dev {
21+ 
22+class MC_API PCIeDevice_PCIeFunction
23+ : public mc::engine::interface<PCIeDevice_PCIeFunction, gen::PCIeDevice_PCIeFunction> {
24+public:
25+ PCIeDevice_PCIeFunction() = default;
26+ ~PCIeDevice_PCIeFunction() = default;
27+ 
28+public:
29+ bool SetDeviceBDF(uint8_t bus, uint8_t device, uint8_t function) override;
30+ 
31+public:
32+ mc::signal<void(uint8_t, uint8_t, uint8_t)> pcie_device_bdf_changed;
33+};
34+ 
35+} // namespace dev
36+ 
37+#endif // MOORETHREADS_PCIE_DEVICE_PCIEFUNCTION_H
38+ 
@@ -0,0 +1,20 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#include "status.h"
14+ 
15+namespace dev {
16+ 
17+} // namespace dev
18+ 
19+MC_REFLECT(dev::PCIeDevice_Status)
20+ 
@@ -0,0 +1,31 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#ifndef MOORETHREADS_PCIE_DEVICE_STATUS_H
14+#define MOORETHREADS_PCIE_DEVICE_STATUS_H
15+ 
16+#include <device_tree/interface/PCIeDevice/Status.h>
17+#include <mc/core/timer.h>
18+#include <mc/engine/service.h>
19+ 
20+namespace dev {
21+ 
22+class MC_API PCIeDevice_Status : public mc::engine::interface<PCIeDevice_Status, gen::PCIeDevice_Status> {
23+public:
24+ PCIeDevice_Status() = default;
25+ ~PCIeDevice_Status() = default;
26+};
27+ 
28+} // namespace dev
29+ 
30+#endif // MOORETHREADS_PCIE_DEVICE_STATUS_H
31+ 
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -18,7 +18,7 @@
18 18 
19namespace dev {19namespace dev {
20 20 
21-class Processor : public mc::engine::interface<Processor, gen::Processor> {21+class MC_API Processor : public mc::engine::interface<Processor, gen::Processor> {
22public:22public:
23 Processor() = default;23 Processor() = default;
24 ~Processor() = default;24 ~Processor() = default;
@@ -0,0 +1,109 @@
1+/*
2+* Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+* openUBMC is licensed under Mulan PSL v2.
4+* You can use this software according to the terms and conditions of the Mulan PSL v2.
5+* You may obtain a copy of Mulan PSL v2 at:
6+* http://license.coscl.org.cn/MulanPSL2
7+* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+* See the Mulan PSL v2 for more details.
11+*/
12+ 
13+#include "metrics.h"
14+#include "mc/debounce/average.h"
15+#include <mc/log.h>
16+ 
17+namespace dev {
18+ 
19+// Constants for MTT temperature reading
20+static const uint8_t MTT_STATUS_REG = 0x00;
21+static const uint8_t MTT_DATA_REG = 0x0a;
22+static const uint8_t MTT_STATUS_DONE = 0x00;
23+ 
24+void Processor_Metrics::init_debounce_config() {
25+ debounce_temp = std::make_unique<mc::debounce::Average>(window_size, is_signed);
26+}
27+ 
28+bool Processor_Metrics::read_mtt_gpu_temperature(smbus_ptr smbus_obj) {
29+ if (!smbus_obj) {
30+ return false;
31+ }
32+ 
33+ try {
34+ // Step 1: Send command to trigger temperature measurement
35+ const uint8_t get_temp_cmd[9] = {0x27, 0x1b, 0x06, 0x02, 0x01, 0x00, 0x04, 0x00, 0x00};
36+ std::string write_payload(reinterpret_cast<const char*>(get_temp_cmd),
37+ sizeof(get_temp_cmd));
38+ auto [send_ok, _] = smbus_obj->send(0x01, write_payload);
39+ if (!send_ok) {
40+ ilog("MTT Error: Failed to send temperature command.");
41+ TemperatureCelsius.set_value(static_cast<double>(GPU_TEMP_READ_FAILED));
42+ return false;
43+ }
44+ 
45+ std::this_thread::sleep_for(std::chrono::milliseconds(10));
46+ 
47+ // Step 2: Poll status register until done
48+ int retry_count = 10;
49+ bool done = false;
50+ while (retry_count-- > 0) {
51+ auto [ok, status_data] = smbus_obj->read(MTT_STATUS_REG, 4);
52+ if (ok && !status_data.empty() && status_data[0] == MTT_STATUS_DONE) {
53+ done = true;
54+ break;
55+ }
56+ std::this_thread::sleep_for(std::chrono::milliseconds(10));
57+ }
58+ 
59+ if (!done) {
60+ ilog("MTT Error: Failed to get 'done' status while reading temperature.");
61+ return false;
62+ }
63+ 
64+ // Step 3: Read temperature data register
65+ auto [read_ok, temp_data] = smbus_obj->read(MTT_DATA_REG, 4);
66+ if (!read_ok || temp_data.empty()) {
67+ ilog("MTT Error: Failed to read temperature data.");
68+ temperaturedebounce++;
69+ if( temperaturedebounce > MTT_MAX_DEBOUNCE_TIME ){
70+ TemperatureCelsius.set_value(static_cast<double>(GPU_TEMP_READ_FAILED));
71+ }
72+ return false;
73+ }
74+ 
75+ uint8_t raw_temp = temp_data[0];
76+ if (raw_temp == 0 || (raw_temp & 0x80) != 0) {
77+ temperaturedebounce++;
78+ if( temperaturedebounce > MTT_MAX_DEBOUNCE_TIME ){
79+ TemperatureCelsius.set_value(static_cast<double>(GPU_TEMP_READ_FAILED));
80+ }
81+ return false;
82+ }
83+ 
84+ temperaturedebounce = 0;
85+ if (debounce_temp) {
86+ std::optional<int> dbl_val = debounce_temp->get_debounce_val(raw_temp);
87+ if (!dbl_val) {
88+ dlog("${error}", ("error", "read_mtt_gpu_temperature debounce failed: debounce value is invalid"));
89+ return false;
90+ }
91+ dlog("read_mtt_gpu_temperature debounce successfully: original value=${value} debounced "
92+ "value=${value1}",
93+ ("value", raw_temp)("value1", *dbl_val));
94+ raw_temp = *dbl_val;
95+ }
96+ TemperatureCelsius.set_value(static_cast<double>(raw_temp));
97+ dlog("MTT GPU temperature updated: ${temp}°C", ("temp", raw_temp));
98+ 
99+ return true;
100+ 
101+ } catch (const std::exception& e) {
102+ ilog("MTT read_gpu_temperature failed, exception: ${exception}", ("exception", e.what()));
103+ TemperatureCelsius.set_value(static_cast<double>(GPU_TEMP_READ_FAILED));
104+ return false;
105+ }
106+}
107+ 
108+} // namespace dev
109+ MC_REFLECT(dev::Processor_Metrics)
@@ -0,0 +1,46 @@
1+/*
2+* Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+* openUBMC is licensed under Mulan PSL v2.
4+* You can use this software according to the terms and conditions of the Mulan PSL v2.
5+* You may obtain a copy of Mulan PSL v2 at:
6+* http://license.coscl.org.cn/MulanPSL2
7+* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+* See the Mulan PSL v2 for more details.
11+*/
12+ 
13+#ifndef PROCESSOR_METRICS_H
14+#define PROCESSOR_METRICS_H
15+ 
16+#include "device_tree/interface/Processor/Metrics.h"
17+#include <mc/core/timer.h>
18+#include <mc/engine/service.h>
19+#include <smbus/smbus.h>
20+#include <mc/debounce/base.h>
21+ 
22+#define MTT_MAX_DEBOUNCE_TIME 6
23+#define GPU_TEMP_POWER_OFF 16384
24+#define GPU_TEMP_READ_FAILED 32768
25+ 
26+namespace dev {
27+ 
28+using smbus_ptr = mc::shared_ptr<smbus>;
29+ 
30+class MC_API Processor_Metrics : public mc::engine::interface<Processor_Metrics, gen::Processor_Metrics> {
31+public:
32+ Processor_Metrics() = default;
33+ ~Processor_Metrics() = default;
34+
35+ bool read_mtt_gpu_temperature(smbus_ptr smbus_obj);
36+ void init_debounce_config();
37+private:
38+ int temperaturedebounce = 0;
39+ std::unique_ptr<mc::debounce::Base> debounce_temp;
40+ int window_size = 6;
41+ bool is_signed = false;
42+};
43+ 
44+} // namespace dev
45+ 
46+#endif
@@ -36,7 +36,10 @@ bool mtt_s4000_card::init(mc::mutable_dict& csr_object, const mc::dict& connecto
36} // namespace dev36} // namespace dev
37 37 
38MC_REFLECT(dev::mtt_s4000_card,38MC_REFLECT(dev::mtt_s4000_card,
39- ((SystemId, "SystemId"))((m_pcie_device, "bmc.dev.PCIeDevice"))((m_pcie_card,39+ ((SystemId, "SystemId"))
40- "bmc.dev.PCIeCard")))40+ ((m_pcie_device, "bmc.dev.PCIeDevice"))
41- 41+ ((m_pcie_device_oem, "bmc.dev.PCIeDevice.Oem"))
42- 42+ ((m_pcie_device_status, "bmc.dev.PCIeDevice.Status"))
43+ ((m_pcie_device_pcie_function, "bmc.dev.PCIeDevice.PCIeFunction"))
44+ ((m_pcie_card, "bmc.dev.PCIeCard"))
45+ ((m_pcie_card_oem, "bmc.dev.PCIeCard.Oem")))
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -15,6 +15,10 @@
15 15 
16#include "interface/pcie_card.h"16#include "interface/pcie_card.h"
17#include "interface/pcie_device.h"17#include "interface/pcie_device.h"
18+#include "interface/pcie_card/oem.h"
19+#include "interface/pcie_device/oem.h"
20+#include "interface/pcie_device/status.h"
21+#include "interface/pcie_device/pcie_function.h"
18#include <mc/engine.h>22#include <mc/engine.h>
19 23 
20namespace dev {24namespace dev {
@@ -23,7 +27,7 @@ class mtt_s4000_card : public mc::engine::object<mtt_s4000_card> {
23public:27public:
24 MC_OBJECT(mtt_s4000_card, "PCIeGpuCard",28 MC_OBJECT(mtt_s4000_card, "PCIeGpuCard",
25 "/bmc/dev/Systems/1/PCIeGpuCard/${object_name}", // TBD:SystemId暂时写死29 "/bmc/dev/Systems/1/PCIeGpuCard/${object_name}", // TBD:SystemId暂时写死
26- (PCIeDevice)(PCIeCard))30+ (PCIeDevice)(PCIeDevice_Oem)(PCIeDevice_Status)(PCIeDevice_PCIeFunction)(PCIeCard)(PCIeCard_Oem))
27 mtt_s4000_card() = default;31 mtt_s4000_card() = default;
28 ~mtt_s4000_card() = default;32 ~mtt_s4000_card() = default;
29 bool start();33 bool start();
@@ -32,7 +36,11 @@ public:
32 bool replace_dynamic_property(mc::mutable_dict& object, const mc::dict& connector);36 bool replace_dynamic_property(mc::mutable_dict& object, const mc::dict& connector);
33 37 
34 PCIeDevice m_pcie_device;38 PCIeDevice m_pcie_device;
35- PCIeCard m_pcie_card;39+ PCIeDevice_Oem m_pcie_device_oem;
40+ PCIeDevice_Status m_pcie_device_status;
41+ PCIeDevice_PCIeFunction m_pcie_device_pcie_function;
42+ PCIeCard m_pcie_card;
43+ PCIeCard_Oem m_pcie_card_oem;
36 uint8_t SystemId;44 uint8_t SystemId;
37};45};
38 46 
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -48,15 +48,15 @@ bool mtt_s4000_gpu::init(mc::mutable_dict& config, const mc::dict& connector) {
48 m_power_status_timer->set_single_shot(false);48 m_power_status_timer->set_single_shot(false);
49 m_power_status_timer->start(power_status_interval);49 m_power_status_timer->start(power_status_interval);
50 50 
51- m_gpu.init_debounce_config();51+ m_processor_metrics.init_debounce_config();
52 mc::milliseconds interval(GPU_SMBUS_INTERVAL_MS);52 mc::milliseconds interval(GPU_SMBUS_INTERVAL_MS);
53 m_smbus_timer = mc::make_shared<mc::core::timer>(this);53 m_smbus_timer = mc::make_shared<mc::core::timer>(this);
54 m_smbus_timer->timeout.connect([this]() {54 m_smbus_timer->timeout.connect([this]() {
55 if (!_is_poweron) {55 if (!_is_poweron) {
56- m_gpu.TemperatureCelsius.set_value(static_cast<double>(GPU_TEMP_POWER_OFF));56+ m_processor_metrics.TemperatureCelsius.set_value(static_cast<double>(GPU_TEMP_POWER_OFF));
57 return;57 return;
58 }58 }
59- m_gpu.read_mtt_gpu_temperature(m_smbus_obj);59+ m_processor_metrics.read_mtt_gpu_temperature(m_smbus_obj);
60 });60 });
61 m_smbus_timer->set_single_shot(false);61 m_smbus_timer->set_single_shot(false);
62 m_smbus_timer->start(interval);62 m_smbus_timer->start(interval);
@@ -68,18 +68,21 @@ bool mtt_s4000_gpu::init(mc::mutable_dict& config, const mc::dict& connector) {
68}68}
69 69 
70bool mtt_s4000_gpu::reset_default_properties() {70bool mtt_s4000_gpu::reset_default_properties() {
71- m_processor.Presence = false;71+ m_processor.Presence = false;
72- m_gpu.InfoRomVersion = "";72+ m_processor.FirmwareVersion = "";
73- m_gpu.BuildDate = "";73+ m_processor.SerialNumber = "";
74- m_gpu.UUID = "";74+ m_processor.PartNumber = "";
75- m_gpu.Utilization = 0;75+ m_processor_metrics.TemperatureCelsius = 0;
76- m_gpu.TemperatureCelsius = 0;76+ m_processor_metrics.PowerWatts = 0;
77- m_gpu_power.PowerWatts = 0;77+ m_gpu.InfoRomVersion = "";
78- m_gpu_power.PowerBrakeState = 255;78+ m_gpu.BuildDate = "";
79- m_gpu_power.ExternalPowerSufficient = 255;79+ m_gpu.UUID = "";
80- m_gpu_status.ECCModeEnabled = 255;80+ m_gpu.Utilization = 0;
81- m_gpu_status.ECCModePendingEnabled = 255;81+ m_gpu_power.PowerBrakeState = 255;
82- m_gpu_status.ResetRequired = 255;82+ m_gpu_power.ExternalPowerSufficient = 255;
83+ m_gpu_status.ECCModeEnabled = 255;
84+ m_gpu_status.ECCModePendingEnabled = 255;
85+ m_gpu_status.ResetRequired = 255;
83 86 
84 return true;87 return true;
85}88}
@@ -204,5 +207,5 @@ void mtt_s4000_gpu::is_system_power_on() {
204} // namespace dev207} // namespace dev
205 208 
206MC_REFLECT(dev::mtt_s4000_gpu,209MC_REFLECT(dev::mtt_s4000_gpu,
207- ((m_processor, "bmc.dev.Processor"))((m_gpu, "bmc.dev.Gpu"))(210+ ((m_processor, "bmc.dev.Processor"))((m_processor_metrics, "bmc.dev.Processor.Metrics"))((m_gpu, "bmc.dev.Gpu"))(
208 (m_gpu_power, "bmc.dev.Gpu.Power"))((m_gpu_status, "bmc.dev.Gpu.Status")))211 (m_gpu_power, "bmc.dev.Gpu.Power"))((m_gpu_status, "bmc.dev.Gpu.Status")))
@@ -5,6 +5,7 @@
5#include "interface/gpu/power.h"5#include "interface/gpu/power.h"
6#include "interface/gpu/status.h"6#include "interface/gpu/status.h"
7#include "interface/processor.h"7#include "interface/processor.h"
8+#include "interface/processor/metrics.h"
8#include <mc/core/timer.h>9#include <mc/core/timer.h>
9#include <mc/engine.h>10#include <mc/engine.h>
10#include <smbus/smbus.h>11#include <smbus/smbus.h>
@@ -17,7 +18,7 @@ namespace dev {
17class mtt_s4000_gpu : public mc::engine::object<mtt_s4000_gpu> {18class mtt_s4000_gpu : public mc::engine::object<mtt_s4000_gpu> {
18public:19public:
19 MC_OBJECT(mtt_s4000_gpu, "GraphicsController", "GraphicsController/${Id}",20 MC_OBJECT(mtt_s4000_gpu, "GraphicsController", "GraphicsController/${Id}",
20- (Processor)(Gpu)(Gpu_Power)(Gpu_Status))21+ (Processor)(Processor_Metrics)(Gpu)(Gpu_Power)(Gpu_Status))
21 22 
22 mtt_s4000_gpu() = default;23 mtt_s4000_gpu() = default;
23 ~mtt_s4000_gpu() = default;24 ~mtt_s4000_gpu() = default;
@@ -32,6 +33,7 @@ public:
32 bool read_gpu_temperature();33 bool read_gpu_temperature();
33 34 
34 Processor m_processor;35 Processor m_processor;
36+ Processor_Metrics m_processor_metrics;
35 Gpu m_gpu;37 Gpu m_gpu;
36 Gpu_Power m_gpu_power;38 Gpu_Power m_gpu_power;
37 Gpu_Status m_gpu_status;39 Gpu_Status m_gpu_status;
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -36,15 +36,17 @@ bool mtt_s4000_memory::init(mc::mutable_dict& config, const mc::dict& connector)
36}36}
37 37 
38bool mtt_s4000_memory::reset_default_properties() {38bool mtt_s4000_memory::reset_default_properties() {
39- m_memory.Manufacturer.set_value("");39+ m_memory.Manufacturer = "";
40- m_memory.PartNumber.set_value("");40+ m_memory.PartNumber = "";
41- m_memory.Utilization.set_value(0);41+ m_memory.DoubleBitErrorPageCount = 0;
42- m_memory.DoubleBitErrorPageCount.set_value(0);42+ m_memory.SingleBitErrorPageCount = 0;
43- m_memory.SingleBitErrorPageCount.set_value(0);43+ m_memory_metrics.MemoryUsagePercent = 0;
44- 44+ m_memory_metrics.BandwidthUsagePercent = 0;
45 return true;45 return true;
46}46}
47 47 
48} // namespace dev48} // namespace dev
49 49 
50-MC_REFLECT(dev::mtt_s4000_memory, ((m_memory, "bmc.dev.Memory")))50+MC_REFLECT(dev::mtt_s4000_memory,
51+ ((m_memory, "bmc.dev.Memory"))
52+ ((m_memory_metrics, "bmc.dev.Memory.Metrics")))
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -14,13 +14,14 @@
14#define __MTT_S4000_MEMORY_H__14#define __MTT_S4000_MEMORY_H__
15 15 
16#include "interface/memory.h"16#include "interface/memory.h"
17+#include "interface/memory/metrics.h"
17#include <mc/engine.h>18#include <mc/engine.h>
18 19 
19namespace dev {20namespace dev {
20 21 
21class mtt_s4000_memory : public mc::engine::object<mtt_s4000_memory> {22class mtt_s4000_memory : public mc::engine::object<mtt_s4000_memory> {
22public:23public:
23- MC_OBJECT(mtt_s4000_memory, "Memory", "Memory/${DimmNum}", (Memory))24+ MC_OBJECT(mtt_s4000_memory, "Memory", "Memory/${DimmNum}", (Memory)(Memory_Metrics))
24 25 
25 mtt_s4000_memory() = default;26 mtt_s4000_memory() = default;
26 ~mtt_s4000_memory() = default;27 ~mtt_s4000_memory() = default;
@@ -32,6 +33,7 @@ public:
32 bool reset_default_properties();33 bool reset_default_properties();
33 34 
34 Memory m_memory;35 Memory m_memory;
36+ Memory_Metrics m_memory_metrics;
35};37};
36 38 
37} // namespace dev39} // namespace dev
@@ -8,13 +8,17 @@
8 "Path": "/bmc/dev/Systems/:SystemId/PCIeGpuCard/:Id",8 "Path": "/bmc/dev/Systems/:SystemId/PCIeGpuCard/:Id",
9 "Interfaces": [9 "Interfaces": [
10 "bmc.dev.PCIeDevice",10 "bmc.dev.PCIeDevice",
11- "bmc.dev.PCIeCard"11+ "bmc.dev.PCIeCard",
12+ "bmc.dev.PCIeDevice.PCIeFunction",
13+ "bmc.dev.PCIeDevice.Oem",
14+ "bmc.dev.PCIeCard.Oem"
12 ]15 ]
13 },16 },
14 "GraphicsController": {17 "GraphicsController": {
15 "Path": ":Parent/GraphicsController/:Id",18 "Path": ":Parent/GraphicsController/:Id",
16 "Interfaces": [19 "Interfaces": [
17 "bmc.dev.Processor",20 "bmc.dev.Processor",
21+ "bmc.dev.Processor.Metrics",
18 "bmc.dev.Gpu",22 "bmc.dev.Gpu",
19 "bmc.dev.Gpu.Power",23 "bmc.dev.Gpu.Power",
20 "bmc.dev.Gpu.Status"24 "bmc.dev.Gpu.Status"
@@ -23,7 +27,8 @@
23 "Memory": {27 "Memory": {
24 "Path": ":Parent/Memory/:Id",28 "Path": ":Parent/Memory/:Id",
25 "Interfaces": [29 "Interfaces": [
26- "bmc.dev.Memory"30+ "bmc.dev.Memory",
31+ "bmc.dev.Memory.Metrics"
27 ]32 ]
28 }33 }
29 }34 }
@@ -60,28 +60,35 @@
60 "PCIeGpuCard_1": {60 "PCIeGpuCard_1": {
61 "bmc.dev.PCIeDevice": {61 "bmc.dev.PCIeDevice": {
62 "DeviceName": "PCIe Card $ (Tesla T4)",62 "DeviceName": "PCIe Card $ (Tesla T4)",
63- "FunctionClass": 3,63+ "Slot": "${Slot}",
64+ "DeviceType": "SingleFunction",
65+ "SlotType": "FullLength",
66+ "Model": "Tesla T4",
67+ "Manufacturer": "Nvidia",
68+ "PartNumber": "02570029",
69+ "SerialNumber": "",
70+ "FirmwareVersion": ""
71+ },
72+ "bmc.dev.PCIeCard": {
73+ "Name": "Tesla T4",
74+ "Description": "TU104GL [Tesla T4]",
75+ "BoardName": "Tesla T4",
76+ "Health": "<=/Component_PCIeCard.Health"
77+ },
78+ "bmc.dev.PCIeDevice.PCIeFunction": {
64 "VendorId": "0x10de",79 "VendorId": "0x10de",
65 "DeviceId": "0x1eb8",80 "DeviceId": "0x1eb8",
66 "SubSystemVendorId": "0x10de",81 "SubSystemVendorId": "0x10de",
67 "SubSystemDeviceId": "0x12a2",82 "SubSystemDeviceId": "0x12a2",
68- "DeviceType": "SingleFunction",
69- "SlotType": "FullLength",
70 "FunctionProtocol": "PCIe",83 "FunctionProtocol": "PCIe",
71- "FunctionType": "Physical",84+ "FunctionType": "Physical"
85+ },
86+ "bmc.dev.PCIeDevice.Oem": {
87+ "FunctionClass": 3,
72 "ComponentType": 8,88 "ComponentType": 8,
73 "Container": "${Container}",89 "Container": "${Container}",
74 "GroupPosition": "PCIeDevice_1_${GroupPosition}",90 "GroupPosition": "PCIeDevice_1_${GroupPosition}",
75 "FirmwareVersion": "N/A"91 "FirmwareVersion": "N/A"
76- },
77- "bmc.dev.PCIeCard": {
78- "Name": "Tesla T4",
79- "Model": "Tesla T4",
80- "Manufacturer": "Nvidia",
81- "PartNumber": "02570029",
82- "Description": "TU104GL [Tesla T4]",
83- "BoardName": "Tesla T4",
84- "Health": "<=/Component_PCIeCard.Health"
85 }92 }
86 },93 },
87 "GraphicsController_1": {94 "GraphicsController_1": {
@@ -96,12 +103,14 @@
96 "ProcessorType": "GPU",103 "ProcessorType": "GPU",
97 "SocketDesignation": "1"104 "SocketDesignation": "1"
98 },105 },
99- "bmc.dev.Gpu": {106+ "bmc.dev.Processor.Metrics": {
100 "TemperatureCelsius": "<=/Scanner_GPUTemp.Value",107 "TemperatureCelsius": "<=/Scanner_GPUTemp.Value",
108+ "PowerWatts": 0
109+ },
110+ "bmc.dev.Gpu": {
101 "RefChip": "#/Chip_TempChip"111 "RefChip": "#/Chip_TempChip"
102 },112 },
103 "bmc.dev.Gpu.Power": {113 "bmc.dev.Gpu.Power": {
104- "PowerWatts": 0,
105 "PowerBrakeState": 255,114 "PowerBrakeState": 255,
106 "ExternalPowerSufficient": 255115 "ExternalPowerSufficient": 255
107 },116 },
@@ -117,7 +126,11 @@
117 "@Parent": "PCIeGpuCard_1",126 "@Parent": "PCIeGpuCard_1",
118 "bmc.dev.Memory": {127 "bmc.dev.Memory": {
119 "DimmNum": 1,128 "DimmNum": 1,
120- "Manufacturer": "Nvidia"129+ "Manufacturer": "NVIDIA"
130+ },
131+ "bmc.dev.Memory.Metrics": {
132+ "MemoryUsagePercent": 0,
133+ "BandwidthUsagePercent": 0
121 }134 }
122 },135 },
123 "BoardPCIeCard_1": {136 "BoardPCIeCard_1": {
@@ -190,14 +203,14 @@
190 "Unit": 0,203 "Unit": 0,
191 "BaseUnit": 6,204 "BaseUnit": 6,
192 "NominalReading": 0,205 "NominalReading": 0,
193- "MaximumReading": 255,206+ "MaximumReading": 255,
194 "Linearization": 112,207 "Linearization": 112,
195- "AssertMask": 0,208+ "AssertMask": 0,
196- "DeassertMask": 0,209+ "DeassertMask": 0,
197- "ReadingMask": 0,210+ "ReadingMask": 0,
198- "M": 0,211+ "M": 0,
199- "RBExp": 0,212+ "RBExp": 0,
200- "Analog": 1,213+ "Analog": 1,
201 "Reading": 170,214 "Reading": 170,
202 "OriginalReading": "<=/GraphicsController_1.PowerWatts",215 "OriginalReading": "<=/GraphicsController_1.PowerWatts",
203 "ReadingStatus": "<=/GraphicsController_1.PowerWatts |> expr(($1 >= 32768) ? 1 : 0)",216 "ReadingStatus": "<=/GraphicsController_1.PowerWatts |> expr(($1 >= 32768) ? 1 : 0)",
@@ -243,7 +256,7 @@
243 "EventKeyId": "PCIeCard.PCIeCardUncorrectableErr",256 "EventKeyId": "PCIeCard.PCIeCardUncorrectableErr",
244 "Condition": 1,257 "Condition": 1,
245 "LedFaultCode": "q$$",258 "LedFaultCode": "q$$",
246- "Reading": "<=/PCIeGpuCard_1.DiagnosticFault;<=/PCIeGpuCard_1.UCEByBIOS |> expr(($1 + $2) == 0 ? 0 : 1)",259+ "Reading": "<=/PCIeGpuCard_1.DiagnosticFault;<=/PCIeGpuCard_1.UCEByBios |> expr(($1 + $2) == 0 ? 0 : 1)",
247 "OperatorId": 5,260 "OperatorId": 5,
248 "Enabled": true,261 "Enabled": true,
249 "AdditionalInfo": "2",262 "AdditionalInfo": "2",
@@ -277,7 +290,7 @@
277 "Event_PCIeBandWidth": {290 "Event_PCIeBandWidth": {
278 "EventKeyId": "PCIeCard.PCIeCardBandWidthDecreased",291 "EventKeyId": "PCIeCard.PCIeCardBandWidthDecreased",
279 "Condition": 1,292 "Condition": 1,
280- "Reading": "<=/PCIeGpuCard_1.BandwidthReduction",293+ "Reading": "<=/PCIeGpuCard_1.BandwidthReduced",
281 "OperatorId": 5,294 "OperatorId": 5,
282 "Enabled": true,295 "Enabled": true,
283 "AdditionalInfo": "2",296 "AdditionalInfo": "2",
@@ -8,13 +8,17 @@
8 "Path": "/bmc/dev/Systems/:SystemId/PCIeGpuCard/:Id",8 "Path": "/bmc/dev/Systems/:SystemId/PCIeGpuCard/:Id",
9 "Interfaces": [9 "Interfaces": [
10 "bmc.dev.PCIeDevice",10 "bmc.dev.PCIeDevice",
11- "bmc.dev.PCIeCard"11+ "bmc.dev.PCIeCard",
12+ "bmc.dev.PCIeDevice.PCIeFunction",
13+ "bmc.dev.PCIeDevice.Oem",
14+ "bmc.dev.PCIeCard.Oem"
12 ]15 ]
13 },16 },
14 "GraphicsController": {17 "GraphicsController": {
15 "Path": ":Parent/GraphicsController/:Id",18 "Path": ":Parent/GraphicsController/:Id",
16 "Interfaces": [19 "Interfaces": [
17 "bmc.dev.Processor",20 "bmc.dev.Processor",
21+ "bmc.dev.Processor.Metrics",
18 "bmc.dev.Gpu",22 "bmc.dev.Gpu",
19 "bmc.dev.Gpu.Power",23 "bmc.dev.Gpu.Power",
20 "bmc.dev.Gpu.Status"24 "bmc.dev.Gpu.Status"
@@ -23,7 +27,8 @@
23 "Memory": {27 "Memory": {
24 "Path": ":Parent/Memory/:Id",28 "Path": ":Parent/Memory/:Id",
25 "Interfaces": [29 "Interfaces": [
26- "bmc.dev.Memory"30+ "bmc.dev.Memory",
31+ "bmc.dev.Memory.Metrics"
27 ]32 ]
28 }33 }
29 }34 }
@@ -60,28 +60,35 @@
60 "PCIeGpuCard_1": {60 "PCIeGpuCard_1": {
61 "bmc.dev.PCIeDevice": {61 "bmc.dev.PCIeDevice": {
62 "DeviceName": "PCIe Card $ (L40)",62 "DeviceName": "PCIe Card $ (L40)",
63- "FunctionClass": 3,63+ "Slot": "${Slot}",
64+ "DeviceType": "SingleFunction",
65+ "SlotType": "FullLength",
66+ "Model": "L40",
67+ "Manufacturer": "Nvidia",
68+ "PartNumber": "",
69+ "SerialNumber": "",
70+ "FirmwareVersion": ""
71+ },
72+ "bmc.dev.PCIeCard": {
73+ "Name": "L40",
74+ "Description": "L40",
75+ "BoardName": "L40",
76+ "Health": "<=/Component_PCIeCard.Health"
77+ },
78+ "bmc.dev.PCIeDevice.PCIeFunction": {
64 "VendorId": "0x10de",79 "VendorId": "0x10de",
65 "DeviceId": "0x26b5",80 "DeviceId": "0x26b5",
66 "SubSystemVendorId": "0x10de",81 "SubSystemVendorId": "0x10de",
67 "SubSystemDeviceId": "0x169d",82 "SubSystemDeviceId": "0x169d",
68- "DeviceType": "SingleFunction",
69- "SlotType": "FullLength",
70 "FunctionProtocol": "PCIe",83 "FunctionProtocol": "PCIe",
71- "FunctionType": "Physical",84+ "FunctionType": "Physical"
85+ },
86+ "bmc.dev.PCIeDevice.Oem": {
87+ "FunctionClass": 3,
72 "ComponentType": 8,88 "ComponentType": 8,
73 "Container": "${Container}",89 "Container": "${Container}",
74 "GroupPosition": "PCIeDevice_1_${GroupPosition}",90 "GroupPosition": "PCIeDevice_1_${GroupPosition}",
75 "FirmwareVersion": "N/A"91 "FirmwareVersion": "N/A"
76- },
77- "bmc.dev.PCIeCard": {
78- "Name": "L40",
79- "Model": "L40",
80- "Manufacturer": "Nvidia",
81- "PartNumber": "",
82- "Description": "L40",
83- "BoardName": "L40",
84- "Health": "<=/Component_PCIeCard.Health"
85 }92 }
86 },93 },
87 "GraphicsController_1": {94 "GraphicsController_1": {
@@ -96,12 +103,14 @@
96 "ProcessorType": "GPU",103 "ProcessorType": "GPU",
97 "SocketDesignation": "1"104 "SocketDesignation": "1"
98 },105 },
99- "bmc.dev.Gpu": {106+ "bmc.dev.Processor.Metrics": {
100 "TemperatureCelsius": "<=/Scanner_GPUTemp.Value",107 "TemperatureCelsius": "<=/Scanner_GPUTemp.Value",
108+ "PowerWatts": 0
109+ },
110+ "bmc.dev.Gpu": {
101 "RefChip": "#/Chip_TempChip"111 "RefChip": "#/Chip_TempChip"
102 },112 },
103 "bmc.dev.Gpu.Power": {113 "bmc.dev.Gpu.Power": {
104- "PowerWatts": 0,
105 "PowerBrakeState": 255,114 "PowerBrakeState": 255,
106 "ExternalPowerSufficient": 255115 "ExternalPowerSufficient": 255
107 },116 },
@@ -118,6 +127,10 @@
118 "bmc.dev.Memory": {127 "bmc.dev.Memory": {
119 "DimmNum": 1,128 "DimmNum": 1,
120 "Manufacturer": "NVIDIA"129 "Manufacturer": "NVIDIA"
130+ },
131+ "bmc.dev.Memory.Metrics": {
132+ "MemoryUsagePercent": 0,
133+ "BandwidthUsagePercent": 0
121 }134 }
122 },135 },
123 "BoardPCIeCard_1": {136 "BoardPCIeCard_1": {
@@ -190,7 +203,7 @@
190 "Unit": 0,203 "Unit": 0,
191 "BaseUnit": 6,204 "BaseUnit": 6,
192 "NominalReading": 0,205 "NominalReading": 0,
193- "MaximumReading": 255,206+ "MaximumReading": 255,
194 "Linearization": 112,207 "Linearization": 112,
195 "AssertMask": 0,208 "AssertMask": 0,
196 "DeassertMask": 0,209 "DeassertMask": 0,
@@ -242,7 +255,7 @@
242 "EventKeyId": "PCIeCard.PCIeCardUncorrectableErr",255 "EventKeyId": "PCIeCard.PCIeCardUncorrectableErr",
243 "Condition": 1,256 "Condition": 1,
244 "LedFaultCode": "q$$",257 "LedFaultCode": "q$$",
245- "Reading": "<=/PCIeGpuCard_1.DiagnosticFault;<=/PCIeGpuCard_1.UCEByBIOS |> expr(($1 + $2) == 0 ? 0 : 1)",258+ "Reading": "<=/PCIeGpuCard_1.DiagnosticFault;<=/PCIeGpuCard_1.UCEByBios |> expr(($1 + $2) == 0 ? 0 : 1)",
246 "OperatorId": 5,259 "OperatorId": 5,
247 "Enabled": true,260 "Enabled": true,
248 "AdditionalInfo": "2",261 "AdditionalInfo": "2",
@@ -276,7 +289,7 @@
276 "Event_PCIeBandWidth": {289 "Event_PCIeBandWidth": {
277 "EventKeyId": "PCIeCard.PCIeCardBandWidthDecreased",290 "EventKeyId": "PCIeCard.PCIeCardBandWidthDecreased",
278 "Condition": 1,291 "Condition": 1,
279- "Reading": "<=/PCIeGpuCard_1.BandwidthReduction",292+ "Reading": "<=/PCIeGpuCard_1.BandwidthReduced",
280 "OperatorId": 5,293 "OperatorId": 5,
281 "Enabled": true,294 "Enabled": true,
282 "AdditionalInfo": "2",295 "AdditionalInfo": "2",
@@ -8,13 +8,17 @@
8 "Path": "/bmc/dev/Systems/:SystemId/PCIeGpuCard/:Id",8 "Path": "/bmc/dev/Systems/:SystemId/PCIeGpuCard/:Id",
9 "Interfaces": [9 "Interfaces": [
10 "bmc.dev.PCIeDevice",10 "bmc.dev.PCIeDevice",
11- "bmc.dev.PCIeCard"11+ "bmc.dev.PCIeCard",
12+ "bmc.dev.PCIeDevice.PCIeFunction",
13+ "bmc.dev.PCIeDevice.Oem",
14+ "bmc.dev.PCIeCard.Oem"
12 ]15 ]
13 },16 },
14 "GraphicsController": {17 "GraphicsController": {
15 "Path": ":Parent/GraphicsController/:Id",18 "Path": ":Parent/GraphicsController/:Id",
16 "Interfaces": [19 "Interfaces": [
17 "bmc.dev.Processor",20 "bmc.dev.Processor",
21+ "bmc.dev.Processor.Metrics",
18 "bmc.dev.Gpu",22 "bmc.dev.Gpu",
19 "bmc.dev.Gpu.Power",23 "bmc.dev.Gpu.Power",
20 "bmc.dev.Gpu.Status"24 "bmc.dev.Gpu.Status"
@@ -23,7 +27,8 @@
23 "Memory": {27 "Memory": {
24 "Path": ":Parent/Memory/:Id",28 "Path": ":Parent/Memory/:Id",
25 "Interfaces": [29 "Interfaces": [
26- "bmc.dev.Memory"30+ "bmc.dev.Memory",
31+ "bmc.dev.Memory.Metrics"
27 ]32 ]
28 }33 }
29 }34 }
@@ -60,28 +60,35 @@
60 "PCIeGpuCard_1": {60 "PCIeGpuCard_1": {
61 "bmc.dev.PCIeDevice": {61 "bmc.dev.PCIeDevice": {
62 "DeviceName": "PCIe Card $ (L20)",62 "DeviceName": "PCIe Card $ (L20)",
63- "FunctionClass": 3,63+ "Slot": "${Slot}",
64+ "DeviceType": "SingleFunction",
65+ "SlotType": "FullLength",
66+ "Model": "L20",
67+ "Manufacturer": "Nvidia",
68+ "PartNumber": "",
69+ "SerialNumber": "",
70+ "FirmwareVersion": ""
71+ },
72+ "bmc.dev.PCIeCard": {
73+ "Name": "L20",
74+ "Description": "L20",
75+ "BoardName": "L20",
76+ "Health": "<=/Component_PCIeCard.Health"
77+ },
78+ "bmc.dev.PCIeDevice.PCIeFunction": {
64 "VendorId": "0x10de",79 "VendorId": "0x10de",
65 "DeviceId": "0x26ba",80 "DeviceId": "0x26ba",
66 "SubSystemVendorId": "0x10de",81 "SubSystemVendorId": "0x10de",
67 "SubSystemDeviceId": "0x1957",82 "SubSystemDeviceId": "0x1957",
68- "DeviceType": "SingleFunction",
69- "SlotType": "FullLength",
70 "FunctionProtocol": "PCIe",83 "FunctionProtocol": "PCIe",
71- "FunctionType": "Physical",84+ "FunctionType": "Physical"
85+ },
86+ "bmc.dev.PCIeDevice.Oem": {
87+ "FunctionClass": 3,
72 "ComponentType": 8,88 "ComponentType": 8,
73 "Container": "${Container}",89 "Container": "${Container}",
74 "GroupPosition": "PCIeDevice_1_${GroupPosition}",90 "GroupPosition": "PCIeDevice_1_${GroupPosition}",
75 "FirmwareVersion": "N/A"91 "FirmwareVersion": "N/A"
76- },
77- "bmc.dev.PCIeCard": {
78- "Name": "L20",
79- "Model": "L20",
80- "Manufacturer": "Nvidia",
81- "PartNumber": "",
82- "Description": "L20",
83- "BoardName": "L20",
84- "Health": "<=/Component_PCIeCard.Health"
85 }92 }
86 },93 },
87 "GraphicsController_1": {94 "GraphicsController_1": {
@@ -96,12 +103,14 @@
96 "ProcessorType": "GPU",103 "ProcessorType": "GPU",
97 "SocketDesignation": "1"104 "SocketDesignation": "1"
98 },105 },
99- "bmc.dev.Gpu": {106+ "bmc.dev.Processor.Metrics": {
100 "TemperatureCelsius": "<=/Scanner_GPUTemp.Value",107 "TemperatureCelsius": "<=/Scanner_GPUTemp.Value",
108+ "PowerWatts": 0
109+ },
110+ "bmc.dev.Gpu": {
101 "RefChip": "#/Chip_TempChip"111 "RefChip": "#/Chip_TempChip"
102 },112 },
103 "bmc.dev.Gpu.Power": {113 "bmc.dev.Gpu.Power": {
104- "PowerWatts": 0,
105 "PowerBrakeState": 255,114 "PowerBrakeState": 255,
106 "ExternalPowerSufficient": 255115 "ExternalPowerSufficient": 255
107 },116 },
@@ -118,6 +127,10 @@
118 "bmc.dev.Memory": {127 "bmc.dev.Memory": {
119 "DimmNum": 1,128 "DimmNum": 1,
120 "Manufacturer": "NVIDIA"129 "Manufacturer": "NVIDIA"
130+ },
131+ "bmc.dev.Memory.Metrics": {
132+ "MemoryUsagePercent": 0,
133+ "BandwidthUsagePercent": 0
121 }134 }
122 },135 },
123 "BoardPCIeCard_1": {136 "BoardPCIeCard_1": {
@@ -242,7 +255,7 @@
242 "EventKeyId": "PCIeCard.PCIeCardUncorrectableErr",255 "EventKeyId": "PCIeCard.PCIeCardUncorrectableErr",
243 "Condition": 1,256 "Condition": 1,
244 "LedFaultCode": "q$$",257 "LedFaultCode": "q$$",
245- "Reading": "<=/PCIeGpuCard_1.DiagnosticFault;<=/PCIeGpuCard_1.UCEByBIOS |> expr(($1 + $2) == 0 ? 0 : 1)",258+ "Reading": "<=/PCIeGpuCard_1.DiagnosticFault;<=/PCIeGpuCard_1.UCEByBios |> expr(($1 + $2) == 0 ? 0 : 1)",
246 "OperatorId": 5,259 "OperatorId": 5,
247 "Enabled": true,260 "Enabled": true,
248 "AdditionalInfo": "2",261 "AdditionalInfo": "2",
@@ -276,7 +289,7 @@
276 "Event_PCIeBandWidth": {289 "Event_PCIeBandWidth": {
277 "EventKeyId": "PCIeCard.PCIeCardBandWidthDecreased",290 "EventKeyId": "PCIeCard.PCIeCardBandWidthDecreased",
278 "Condition": 1,291 "Condition": 1,
279- "Reading": "<=/PCIeGpuCard_1.BandwidthReduction",292+ "Reading": "<=/PCIeGpuCard_1.BandwidthReduced",
280 "OperatorId": 5,293 "OperatorId": 5,
281 "Enabled": true,294 "Enabled": true,
282 "AdditionalInfo": "2",295 "AdditionalInfo": "2",
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -12,14 +12,8 @@
12 12 
13#include "gpu.h"13#include "gpu.h"
14#include <mc/log.h>14#include <mc/log.h>
15-#include "mc/debounce/average.h"
16 15 
17namespace dev {16namespace dev {
18- 
19-void Gpu::init_debounce_config() {
20- debounce = std::make_unique<mc::debounce::Average>(window_size, is_signed);
21-}
22- 
23bool Gpu::read_card_builddate(postbox_ptr postbox) {17bool Gpu::read_card_builddate(postbox_ptr postbox) {
24 if (!postbox) {18 if (!postbox) {
25 ilog("CardBuildDate: postbox not initialized");19 ilog("CardBuildDate: postbox not initialized");
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -18,7 +18,6 @@
18#include <mc/engine/service.h>18#include <mc/engine/service.h>
19#include <memory>19#include <memory>
20#include <smbus/smbus_postbox.h>20#include <smbus/smbus_postbox.h>
21-#include <mc/debounce/base.h>
22 21 
23namespace dev {22namespace dev {
24using postbox_ptr = std::shared_ptr<SMBusPostboxProtocol>;23using postbox_ptr = std::shared_ptr<SMBusPostboxProtocol>;
@@ -33,12 +32,6 @@ public:
33 bool read_uuid(postbox_ptr postbox);32 bool read_uuid(postbox_ptr postbox);
34 bool get_nvlink_num(postbox_ptr postbox);33 bool get_nvlink_num(postbox_ptr postbox);
35 bool get_nvlink_info(postbox_ptr postbox);34 bool get_nvlink_info(postbox_ptr postbox);
36- void init_debounce_config();
37-private:
38- int temperaturedebounce = 0;
39- std::unique_ptr<mc::debounce::Base> debounce;
40- int window_size = 6;
41- bool is_signed = true;
42};35};
43 36 
44} // namespace dev37} // namespace dev
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -12,79 +12,8 @@
12 12 
13#include "power.h"13#include "power.h"
14#include <mc/log.h>14#include <mc/log.h>
15-#include "mc/debounce/average.h"
16 15 
17namespace dev {16namespace dev {
18- 
19-void Gpu_Power::init_debounce_config() {
20- debounce = std::make_unique<mc::debounce::Average>(window_size, is_signed);
21-}
22- 
23-bool Gpu_Power::read_gpu_power_consumption(postbox_ptr postbox) {
24- if (!postbox) {
25- ilog("CardPower: postbox not initialized");
26- return false;
27- }
28- try {
29- SMBusPostboxProtocol::RequestParams params;
30- params.name = "CardPower";
31- params.opcode = 0x4;
32- params.arg1 = 0x0;
33- params.arg2 = 0x0;
34- params.capa_dword_num = 0;
35- params.capa_mask = 0x00010000;
36- params.data_out = true;
37- params.data_len = 4;
38- params.data_type = SMBusPostboxProtocol::KEEP_DIGITAL;
39- params.data_mask = 0xffffffff;
40- 
41- std::string result_str = postbox->sendRequest(params);
42- if (result_str.empty()) {
43- ilog("CardPower: empty response when reading power");
44- powerdebounce++;
45- if(powerdebounce > GPU_POWER_MAX_DEBOUNCE_TIME){
46- powerdebounce = 0;
47- PowerWatts.set_value(static_cast<uint16_t>(GPU_POWER_READ_FAILED));
48- }
49- return false;
50- }
51- 
52- powerdebounce = 0;
53- uint32_t be = 0;
54- try {
55- be = static_cast<uint32_t>(std::stoul(result_str));
56- } catch (const std::exception& e) {
57- ilog("CardPower: parse stoul failed: ${e}", ("e", e.what()));
58- return false;
59- }
60- uint32_t le = ((be & 0x000000FFu) << 24) |
61- ((be & 0x0000FF00u) << 8) |
62- ((be & 0x00FF0000u) >> 8) |
63- ((be & 0xFF000000u) >> 24);
64- uint16_t power_watts = static_cast<uint16_t>(le / 1000u);
65- if (debounce) {
66- std::optional<int> dbl_val = debounce->get_debounce_val(power_watts);
67- if (!dbl_val) {
68- dlog("${error}", ("error", "read_gpu_power_consumption debounce failed: debounce value is invalid"));
69- return false;
70- }
71- dlog("read_gpu_power_consumption debounce successfully: original value=${value} debounced "
72- "value=${value1}",
73- ("value", power_watts)("value1", *dbl_val));
74- power_watts = *dbl_val;
75- }
76- try {
77- PowerWatts.set_value(power_watts);
78- } catch (const std::exception& e) {
79- ilog("CardPower Set value failed: ${error}", ("error", e.what()));
80- }
81- return true;
82- } catch (const std::exception& e) {
83- ilog("CardPower: exception when reading CardPower: ${e}", ("e", e.what()));
84- PowerWatts.set_value(static_cast<uint16_t>(GPU_POWER_READ_FAILED));
85- return false;
86- }
87-}
88bool Gpu_Power::read_gpu_powerbrakeIsSet(postbox_ptr postbox) {17bool Gpu_Power::read_gpu_powerbrakeIsSet(postbox_ptr postbox) {
89 if (!postbox) {18 if (!postbox) {
90 ilog("CardPowerBrakeIsSet: postbox not initialized");19 ilog("CardPowerBrakeIsSet: postbox not initialized");
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -15,7 +15,6 @@
15 15 
16#include "device_tree/interface/Gpu/Power.h"16#include "device_tree/interface/Gpu/Power.h"
17#include <smbus/smbus_postbox.h>17#include <smbus/smbus_postbox.h>
18-#include <mc/debounce/base.h>
19 18 
20#define GPU_POWER_READ_FAILED 3276819#define GPU_POWER_READ_FAILED 32768
21#define GPU_POWER_POWER_OFF 020#define GPU_POWER_POWER_OFF 0
@@ -30,14 +29,7 @@ public:
30 Gpu_Power() = default;29 Gpu_Power() = default;
31 ~Gpu_Power() = default;30 ~Gpu_Power() = default;
32 31 
33- bool read_gpu_power_consumption(postbox_ptr postbox);
34 bool read_gpu_powerbrakeIsSet(postbox_ptr postbox);32 bool read_gpu_powerbrakeIsSet(postbox_ptr postbox);
35- void init_debounce_config();
36-private:
37- std::unique_ptr<mc::debounce::Base> debounce;
38- int powerdebounce = 0;
39- int window_size = 6;
40- bool is_signed = false;
41};33};
42 34 
43} // namespace dev35} // namespace dev
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -36,7 +36,6 @@ bool Memory::get_memory_vendor(postbox_ptr postbox) {
36 std::string resp = postbox->sendRequest(params);36 std::string resp = postbox->sendRequest(params);
37 if (resp.empty()) {37 if (resp.empty()) {
38 ilog("MemoryVendor: empty response");38 ilog("MemoryVendor: empty response");
39- Manufacturer.set_value("");
40 return false;39 return false;
41 }40 }
42 std::string vendor;41 std::string vendor;
@@ -52,7 +51,6 @@ bool Memory::get_memory_vendor(postbox_ptr postbox) {
52 return true;51 return true;
53 } catch (const std::exception& e) {52 } catch (const std::exception& e) {
54 ilog("MemoryVendor exception: ${e}", ("e", e.what()));53 ilog("MemoryVendor exception: ${e}", ("e", e.what()));
55- Manufacturer.set_value("");
56 return false;54 return false;
57 }55 }
58}56}
@@ -78,7 +76,6 @@ bool Memory::get_memory_part_number(postbox_ptr postbox) {
78 std::string resp = postbox->sendRequest(params);76 std::string resp = postbox->sendRequest(params);
79 if (resp.empty()) {77 if (resp.empty()) {
80 ilog("MemoryPartNumber: empty response");78 ilog("MemoryPartNumber: empty response");
81- PartNumber.set_value("");
82 return false;79 return false;
83 }80 }
84 ilog("MemoryPartNumber read: '${pn}'", ("pn", resp));81 ilog("MemoryPartNumber read: '${pn}'", ("pn", resp));
@@ -86,7 +83,6 @@ bool Memory::get_memory_part_number(postbox_ptr postbox) {
86 return true;83 return true;
87 } catch (const std::exception& e) {84 } catch (const std::exception& e) {
88 ilog("MemoryPartNumber exception: ${e}", ("e", e.what()));85 ilog("MemoryPartNumber exception: ${e}", ("e", e.what()));
89- PartNumber.set_value("");
90 return false;86 return false;
91 }87 }
92}88}
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -0,0 +1,15 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#include "metrics.h"
14+ 
15+MC_REFLECT(dev::Memory_Metrics)
@@ -0,0 +1,30 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#ifndef MEMORY_METRICS_H
14+#define MEMORY_METRICS_H
15+ 
16+#include "device_tree/interface/Memory/Metrics.h"
17+#include <mc/core/timer.h>
18+#include <mc/engine/service.h>
19+ 
20+namespace dev {
21+ 
22+class MC_API Memory_Metrics : public mc::engine::interface<Memory_Metrics, gen::Memory_Metrics> {
23+public:
24+ Memory_Metrics() = default;
25+ ~Memory_Metrics() = default;
26+};
27+ 
28+} // namespace dev
29+ 
30+#endif
@@ -2,11 +2,17 @@
2nvidia_interface_sources = files(2nvidia_interface_sources = files(
3 'gpu/power.cpp',3 'gpu/power.cpp',
4 'gpu/status.cpp',4 'gpu/status.cpp',
5+ 'memory/metrics.cpp',
5 'gpu.cpp',6 'gpu.cpp',
6 'memory.cpp',7 'memory.cpp',
7 'pcie_card.cpp',8 'pcie_card.cpp',
9+ 'pcie_card/oem.cpp',
8 'pcie_device.cpp',10 'pcie_device.cpp',
11+ 'pcie_device/oem.cpp',
12+ 'pcie_device/status.cpp',
13+ 'pcie_device/pcie_function.cpp',
9 'processor.cpp',14 'processor.cpp',
15+ 'processor/metrics.cpp',
10)16)
11 17 
12# 创建 Nvidia interface 共享库18# 创建 Nvidia interface 共享库
@@ -38,4 +44,4 @@ if build_tests and meson_build
38 depends: libnvidia_interface,44 depends: libnvidia_interface,
39 build_by_default: true,45 build_by_default: true,
40 )46 )
41-endif47+endif
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -12,114 +12,4 @@
12 12 
13#include "pcie_card.h"13#include "pcie_card.h"
14 14 
15-namespace dev {15+MC_REFLECT(dev::PCIeCard, ((SystemId, "SystemId")))
16-bool PCIeCard::read_serialnumber(postbox_ptr postbox) {
17- if (!postbox) {
18- ilog("SerialNumber: postbox not initialized");
19- return false;
20- }
21- try {
22- SMBusPostboxProtocol::RequestParams params;
23- params.name = "CardSerialNumber";
24- params.opcode = 0x5;
25- params.arg1 = 0x2;
26- params.arg2 = 0x0;
27- params.capa_dword_num = 1;
28- params.capa_mask = 0x00000004;
29- params.data_out = true;
30- params.data_len = 16;
31- params.data_type = SMBusPostboxProtocol::KEEP_ASCII;
32- params.data_mask = 0xffffffff;
33- 
34- std::string result_str = postbox->sendRequest(params);
35- if (result_str.empty()) {
36- ilog("SerialNumber: empty response");
37- return false;
38- }
39- dlog("SerialNumber read: ${SerialNumber}", ("SerialNumber", result_str));
40- try {
41- SerialNumber.set_value(result_str);
42- } catch (const std::exception& e) {
43- ilog("SerialNumber Set value failed: ${error}", ("error", e.what()));
44- }
45- return true;
46- } catch (const std::exception& e) {
47- ilog("SerialNumber: exception: ${e}", ("e", e.what()));
48- return false;
49- }
50-}
51- 
52-bool PCIeCard::read_partnumber(postbox_ptr postbox) {
53- if (!postbox) {
54- ilog("PartNumber: postbox not initialized");
55- return false;
56- }
57- try {
58- SMBusPostboxProtocol::RequestParams params;
59- params.name = "CardBroadPartNumber";
60- params.opcode = 0x5;
61- params.arg1 = 0x0;
62- params.arg2 = 0x0;
63- params.capa_dword_num = 1;
64- params.capa_mask = 0x00000001;
65- params.data_out = true;
66- params.data_len = 24;
67- params.data_type = SMBusPostboxProtocol::KEEP_ASCII;
68- params.data_mask = 0xffffffff;
69- 
70- std::string result_str = postbox->sendRequest(params);
71- if (result_str.empty()) {
72- ilog("CardBroadPartNumber: empty response");
73- return false;
74- }
75- dlog("CardBroadPartNumber read: ${CardBroadPartNumber}",
76- ("CardBroadPartNumber", result_str));
77- try {
78- PartNumber.set_value(result_str);
79- } catch (const std::exception& e) {
80- ilog("CardBroadPartNumber Set value failed: ${error}", ("error", e.what()));
81- }
82- return true;
83- } catch (const std::exception& e) {
84- ilog("CardBroadPartNumber: exception: ${e}", ("e", e.what()));
85- return false;
86- }
87-}
88- 
89-bool PCIeCard::read_firmware_version(postbox_ptr postbox) {
90- if (!postbox) {
91- ilog("FirmwareVersion: postbox not initialized");
92- return false;
93- }
94- try {
95- SMBusPostboxProtocol::RequestParams params;
96- params.name = "FirmwareVersion";
97- params.opcode = 0x5;
98- params.arg1 = 0x8;
99- params.arg2 = 0x0;
100- params.capa_dword_num = 1;
101- params.capa_mask = 0x00000100;
102- params.data_out = true;
103- params.data_len = 14;
104- params.data_type = SMBusPostboxProtocol::KEEP_ASCII;
105- params.data_mask = 0xffffffff;
106- 
107- std::string result_str = postbox->sendRequest(params);
108- if (result_str.empty()) {
109- ilog("FirmwareVersion: empty response");
110- return false;
111- }
112- dlog("FirmwareVersion read: ${FirmwareVersion}", ("FirmwareVersion", result_str));
113- try {
114- FirmwareVersion.set_value(result_str);
115- } catch (const std::exception& e) {
116- ilog("FirmwareVersion Set value failed: ${error}", ("error", e.what()));
117- }
118- return true;
119- } catch (const std::exception& e) {
120- ilog("FirmwareVersion: exception: ${e}", ("e", e.what()));
121- return false;
122- }
123-}
124-} // namespace dev
125-MC_REFLECT(dev::PCIeCard, ((SystemId, "SystemId")))
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -14,19 +14,14 @@
14#define PCIE_CARD_H14#define PCIE_CARD_H
15 15 
16#include <device_tree/interface/PCIeCard.h>16#include <device_tree/interface/PCIeCard.h>
17-#include <smbus/smbus_postbox.h>
18 17 
19namespace dev {18namespace dev {
20-using postbox_ptr = std::shared_ptr<SMBusPostboxProtocol>;
21 19 
22class MC_API PCIeCard : public mc::engine::interface<PCIeCard, gen::PCIeCard> {20class MC_API PCIeCard : public mc::engine::interface<PCIeCard, gen::PCIeCard> {
23public:21public:
24 uint8_t SystemId;22 uint8_t SystemId;
25- bool read_serialnumber(postbox_ptr postbox);
26- bool read_partnumber(postbox_ptr postbox);
27- bool read_firmware_version(postbox_ptr postbox);
28};23};
29 24 
30} // namespace dev25} // namespace dev
31 26 
32-#endif // PCIE_CARD_H27+#endif // PCIE_CARD_H
@@ -0,0 +1,20 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#include "oem.h"
14+ 
15+namespace dev {
16+ 
17+} // namespace dev
18+ 
19+MC_REFLECT(dev::PCIeCard_Oem)
20+ 
@@ -0,0 +1,29 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#ifndef NVIDIA_PCIECARD_OEM_INTERFACE_H
14+#define NVIDIA_PCIECARD_OEM_INTERFACE_H
15+ 
16+#include <device_tree/interface/PCIeCard/Oem.h>
17+ 
18+namespace dev {
19+ 
20+class MC_API PCIeCard_Oem : public mc::engine::interface<PCIeCard_Oem, gen::PCIeCard_Oem> {
21+public:
22+ PCIeCard_Oem() = default;
23+ ~PCIeCard_Oem() = default;
24+};
25+ 
26+} // namespace dev
27+ 
28+#endif // NVIDIA_PCIECARD_OEM_INTERFACE_H
29+ 
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -13,6 +13,7 @@
13#include "interface/pcie_device.h"13#include "interface/pcie_device.h"
14#include "mc/format.h"14#include "mc/format.h"
15#include "mc/string.h"15#include "mc/string.h"
16+#include <mc/log.h>
16 17 
17namespace dev {18namespace dev {
18 19 
@@ -28,21 +29,121 @@ bool PCIeDevice::SetRootBDF(uint8_t bus, uint8_t device, uint8_t function) {
28 return true;29 return true;
29}30}
30 31 
31-bool PCIeDevice::SetDeviceBDF(uint8_t bus, uint8_t device, uint8_t function) {32+bool PCIeDevice::read_serialnumber(postbox_ptr postbox) {
32- if (bus == 0 && device == 0 && function == 0) {33+ if (!postbox) {
33- std::cerr << "Error: Invalid BDF values" << std::endl;34+ ilog("SerialNumber: postbox not initialized");
34 return false;35 return false;
35 }36 }
36 37 
37- DevBus = bus;38+ try {
38- DevDevice = device;39+ SMBusPostboxProtocol::RequestParams params;
39- DevFunction = function;40+ params.name = "CardSerialNumber";
41+ params.opcode = 0x5;
42+ params.arg1 = 0x2;
43+ params.arg2 = 0x0;
44+ params.capa_dword_num = 1;
45+ params.capa_mask = 0x00000004;
46+ params.data_out = true;
47+ params.data_len = 16;
48+ params.data_type = SMBusPostboxProtocol::KEEP_ASCII;
49+ params.data_mask = 0xffffffff;
40 50 
41- post([this, bus, device, function]() {51+ std::string result_str = postbox->sendRequest(params);
42- pcie_device_bdf_changed(bus, device, function);52+ if (result_str.empty()) {
43- });53+ ilog("SerialNumber: empty response");
54+ return false;
55+ }
56+ dlog("SerialNumber read: ${SerialNumber}", ("SerialNumber", result_str));
44 57 
45- return true;58+ try {
59+ SerialNumber.set_value(result_str);
60+ } catch (const std::exception& e) {
61+ ilog("SerialNumber Set value failed: ${error}", ("error", e.what()));
62+ return false;
63+ }
64+ return true;
65+ } catch (const std::exception& e) {
66+ ilog("SerialNumber: exception: ${e}", ("e", e.what()));
67+ return false;
68+ }
69+}
70+ 
71+bool PCIeDevice::read_partnumber(postbox_ptr postbox) {
72+ if (!postbox) {
73+ ilog("PartNumber: postbox not initialized");
74+ return false;
75+ }
76+ 
77+ try {
78+ SMBusPostboxProtocol::RequestParams params;
79+ params.name = "CardBroadPartNumber";
80+ params.opcode = 0x5;
81+ params.arg1 = 0x0;
82+ params.arg2 = 0x0;
83+ params.capa_dword_num = 1;
84+ params.capa_mask = 0x00000001;
85+ params.data_out = true;
86+ params.data_len = 24;
87+ params.data_type = SMBusPostboxProtocol::KEEP_ASCII;
88+ params.data_mask = 0xffffffff;
89+ 
90+ std::string result_str = postbox->sendRequest(params);
91+ if (result_str.empty()) {
92+ ilog("CardBroadPartNumber: empty response");
93+ return false;
94+ }
95+ dlog("CardBroadPartNumber read: ${CardBroadPartNumber}", ("CardBroadPartNumber", result_str));
96+ 
97+ try {
98+ PartNumber.set_value(result_str);
99+ } catch (const std::exception& e) {
100+ ilog("CardBroadPartNumber Set value failed: ${error}", ("error", e.what()));
101+ return false;
102+ }
103+ return true;
104+ } catch (const std::exception& e) {
105+ ilog("CardBroadPartNumber: exception: ${e}", ("e", e.what()));
106+ return false;
107+ }
108+}
109+ 
110+bool PCIeDevice::read_firmware_version(postbox_ptr postbox) {
111+ if (!postbox) {
112+ ilog("FirmwareVersion: postbox not initialized");
113+ return false;
114+ }
115+ 
116+ try {
117+ SMBusPostboxProtocol::RequestParams params;
118+ params.name = "FirmwareVersion";
119+ params.opcode = 0x5;
120+ params.arg1 = 0x8;
121+ params.arg2 = 0x0;
122+ params.capa_dword_num = 1;
123+ params.capa_mask = 0x00000100;
124+ params.data_out = true;
125+ params.data_len = 14;
126+ params.data_type = SMBusPostboxProtocol::KEEP_ASCII;
127+ params.data_mask = 0xffffffff;
128+ 
129+ std::string result_str = postbox->sendRequest(params);
130+ if (result_str.empty()) {
131+ ilog("FirmwareVersion: empty response");
132+ return false;
133+ }
134+ dlog("FirmwareVersion read: ${FirmwareVersion}", ("FirmwareVersion", result_str));
135+ 
136+ try {
137+ FirmwareVersion.set_value(result_str);
138+ } catch (const std::exception& e) {
139+ ilog("FirmwareVersion Set value failed: ${error}", ("error", e.what()));
140+ return false;
141+ }
142+ return true;
143+ } catch (const std::exception& e) {
144+ ilog("FirmwareVersion: exception: ${e}", ("e", e.what()));
145+ return false;
146+ }
46}147}
47 148 
48void PCIeDevice::replace_dynamic_property(mc::mutable_dict& object, const mc::dict& connector) {149void PCIeDevice::replace_dynamic_property(mc::mutable_dict& object, const mc::dict& connector) {
@@ -1,5 +1,5 @@
1/*1/*
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3 * openUBMC is licensed under Mulan PSL v2.3 * openUBMC is licensed under Mulan PSL v2.
4 * You can use this software according to the terms and conditions of the Mulan PSL v2.4 * You can use this software according to the terms and conditions of the Mulan PSL v2.
5 * You may obtain a copy of Mulan PSL v2 at:5 * You may obtain a copy of Mulan PSL v2 at:
@@ -17,9 +17,12 @@
17#include <mc/engine/service.h>17#include <mc/engine/service.h>
18 18 
19#include <device_tree/interface/PCIeDevice.h>19#include <device_tree/interface/PCIeDevice.h>
20+#include <smbus/smbus_postbox.h>
20 21 
21namespace dev {22namespace dev {
22 23 
24+using postbox_ptr = std::shared_ptr<SMBusPostboxProtocol>;
25+ 
23class MC_API PCIeDevice : public mc::engine::interface<PCIeDevice, gen::PCIeDevice> {26class MC_API PCIeDevice : public mc::engine::interface<PCIeDevice, gen::PCIeDevice> {
24public:27public:
25 PCIeDevice() = default;28 PCIeDevice() = default;
@@ -27,13 +30,17 @@ public:
27 30 
28public:31public:
29 mc::engine::property<std::string> RefChip;32 mc::engine::property<std::string> RefChip;
30- // 设备数接口实现
31- bool SetRootBDF(uint8_t bus, uint8_t device, uint8_t function) override;
32- bool SetDeviceBDF(uint8_t bus, uint8_t device, uint8_t function) override;
33 33 
34+public:
35+ bool read_serialnumber(postbox_ptr postbox);
36+ bool read_partnumber(postbox_ptr postbox);
37+ bool read_firmware_version(postbox_ptr postbox);
38+ 
39+public:
40+ // 设备数接口实现
41+ bool SetRootBDF(uint8_t bus, uint8_t device, uint8_t function) override;
34public:42public:
35 void replace_dynamic_property(mc::mutable_dict& object, const mc::dict& connector);43 void replace_dynamic_property(mc::mutable_dict& object, const mc::dict& connector);
36- mc::signal<void(uint8_t, uint8_t, uint8_t)> pcie_device_bdf_changed;
37};44};
38 45 
39} // namespace dev46} // namespace dev
@@ -0,0 +1,20 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#include "oem.h"
14+ 
15+namespace dev {
16+ 
17+} // namespace dev
18+ 
19+MC_REFLECT(dev::PCIeDevice_Oem)
20+ 
@@ -0,0 +1,31 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#ifndef NVIDIA_PCIE_DEVICE_OEM_H
14+#define NVIDIA_PCIE_DEVICE_OEM_H
15+ 
16+#include <device_tree/interface/PCIeDevice/Oem.h>
17+#include <mc/core/timer.h>
18+#include <mc/engine/service.h>
19+ 
20+namespace dev {
21+ 
22+class MC_API PCIeDevice_Oem : public mc::engine::interface<PCIeDevice_Oem, gen::PCIeDevice_Oem> {
23+public:
24+ PCIeDevice_Oem() = default;
25+ ~PCIeDevice_Oem() = default;
26+};
27+ 
28+} // namespace dev
29+ 
30+#endif // NVIDIA_PCIE_DEVICE_OEM_H
31+ 
@@ -0,0 +1,36 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+ #include "pcie_function.h"
14+ #include "mc/format.h"
15+ #include "mc/string.h"
16+
17+ namespace dev {
18+
19+ bool PCIeDevice_PCIeFunction::SetDeviceBDF(uint8_t bus, uint8_t device, uint8_t function) {
20+ if (bus == 0 && device == 0 && function == 0) {
21+ std::cerr << "Error: Invalid BDF values" << std::endl;
22+ return false;
23+ }
24+
25+ BusNumber = bus;
26+ DeviceNumber = device;
27+ FunctionNumber = function;
28+
29+ post([this, bus, device, function]() {
30+ pcie_device_bdf_changed(bus, device, function);
31+ });
32+
33+ return true;
34+ }
35+ } // namespace dev
36+ MC_REFLECT(dev::PCIeDevice_PCIeFunction)
@@ -0,0 +1,38 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#ifndef NVIDIA_PCIE_DEVICE_PCIEFUNCTION_H
14+#define NVIDIA_PCIE_DEVICE_PCIEFUNCTION_H
15+ 
16+#include <device_tree/interface/PCIeDevice/PCIeFunction.h>
17+#include <mc/core/timer.h>
18+#include <mc/engine/service.h>
19+ 
20+namespace dev {
21+ 
22+class MC_API PCIeDevice_PCIeFunction
23+ : public mc::engine::interface<PCIeDevice_PCIeFunction, gen::PCIeDevice_PCIeFunction> {
24+public:
25+ PCIeDevice_PCIeFunction() = default;
26+ ~PCIeDevice_PCIeFunction() = default;
27+ 
28+public:
29+ bool SetDeviceBDF(uint8_t bus, uint8_t device, uint8_t function) override;
30+ 
31+public:
32+ mc::signal<void(uint8_t, uint8_t, uint8_t)> pcie_device_bdf_changed;
33+};
34+ 
35+} // namespace dev
36+ 
37+#endif // NVIDIA_PCIE_DEVICE_PCIEFUNCTION_H
38+ 
@@ -0,0 +1,20 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#include "status.h"
14+ 
15+namespace dev {
16+ 
17+} // namespace dev
18+ 
19+MC_REFLECT(dev::PCIeDevice_Status)
20+ 
@@ -0,0 +1,31 @@
1+/*
2+ * Copyright (c) 2026 Huawei Technologies Co., Ltd.
3+ * openUBMC is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#ifndef NVIDIA_PCIE_DEVICE_STATUS_H
14+#define NVIDIA_PCIE_DEVICE_STATUS_H
15+ 
16+#include <device_tree/interface/PCIeDevice/Status.h>
17+#include <mc/core/timer.h>
18+#include <mc/engine/service.h>
19+ 
20+namespace dev {
21+ 
22+class MC_API PCIeDevice_Status : public mc::engine::interface<PCIeDevice_Status, gen::PCIeDevice_Status> {
23+public:
24+ PCIeDevice_Status() = default;
25+ ~PCIeDevice_Status() = default;
26+};
27+ 
28+} // namespace dev
29+ 
30+#endif // NVIDIA_PCIE_DEVICE_STATUS_H
31+ 
Rdrivers/pcie_nic_card/boardcom/interface/network_adapter/cooling.cpp→drivers/pcie_nic_card/boardcom/interface/cooling.cpp+7-7
Rdrivers/pcie_nic_card/boardcom/interface/network_adapter/cooling.h→drivers/pcie_nic_card/boardcom/interface/cooling.h+13-11
Rdrivers/pcie_nic_card/mellanox/interface/optical_module/cooling.cpp→drivers/pcie_nic_card/boardcom/interface/optical_module/temperature_celsius.cpp+2-2
Rdrivers/pcie_nic_card/boardcom/interface/optical_module/cooling.h→drivers/pcie_nic_card/boardcom/interface/pcie_device/oem.h+10-10
Rdrivers/pcie_nic_card/grt/interface/network_adapter/cooling.cpp→drivers/pcie_nic_card/grt/interface/cooling.cpp+8-8
Rdrivers/pcie_nic_card/grt/interface/network_adapter/cooling.h→drivers/pcie_nic_card/grt/interface/cooling.h+13-11
Mdrivers/pcie_nic_card/hisi/hi183x/hi183x_om.cpp+2-2File content is under review, please try again later
Rdrivers/pcie_nic_card/hisi/interface/network_adapter/cooling.cpp→drivers/pcie_nic_card/hisi/interface/cooling.cpp+12-22
Rdrivers/pcie_nic_card/hisi/interface/network_adapter/cooling.h→drivers/pcie_nic_card/hisi/interface/cooling.h+13-12
Rdrivers/pcie_nic_card/hisi/interface/optical_module/cooling.cpp→drivers/pcie_nic_card/hisi/interface/optical_module/temperature_celsius.cpp+10-10
Rdrivers/pcie_nic_card/hisi/interface/optical_module/cooling.h→drivers/pcie_nic_card/hisi/interface/optical_module/temperature_celsius.h+12-11
Rdrivers/pcie_nic_card/mellanox/interface/network_adapter/cooling.cpp→drivers/pcie_nic_card/mellanox/interface/cooling.cpp+7-7
Rdrivers/pcie_nic_card/mellanox/interface/network_adapter/cooling.h→drivers/pcie_nic_card/mellanox/interface/cooling.h+12-11
Rdrivers/pcie_nic_card/boardcom/interface/optical_module/cooling.cpp→drivers/pcie_nic_card/mellanox/interface/optical_module/temperature_celsius.cpp+2-2
Rdrivers/pcie_nic_card/mellanox/interface/optical_module/cooling.h→drivers/pcie_nic_card/mellanox/interface/optical_module/temperature_celsius.h+8-8
Rdrivers/pcie_nic_card/wangxun/interface/optical_module/cooling.cpp→drivers/pcie_nic_card/wangxun/interface/optical_module/temperature_celsius.cpp+5-5
Rdrivers/pcie_nic_card/wangxun/interface/optical_module/cooling.h→drivers/pcie_nic_card/wangxun/interface/optical_module/temperature_celsius.h+5-5
Rgen/include/device_tree/interface/OpticalModule/Cooling.h→gen/include/device_tree/interface/OpticalModule/TemperatureCelsius.h+5-5
Rgen/include/device_tree/interface/NetworkAdapter/Cooling.h→gen/include/device_tree/interface/PCIeDevice/Oem.h+10-10
Rgen/src/device_tree/interface/NetworkAdapter/Cooling.cpp→gen/src/device_tree/interface/Memory/Metrics.cpp+3-3
Rgen/src/device_tree/interface/OpticalModule/Cooling.cpp→gen/src/device_tree/interface/OpticalModule/TemperatureCelsius.cpp+2-2