Initial commit

This commit is contained in:
Your Name
2026-04-23 17:07:55 +08:00
commit b7e39e063b
16725 changed files with 1625565 additions and 0 deletions
@@ -0,0 +1,83 @@
From 8d85b0f37638c606e195753553fe21cbe8663cd1 Mon Sep 17 00:00:00 2001
From: wangjue <jue.wang2@luxshare-ict.com>
Date: Tue, 15 Oct 2024 18:42:41 +0800
Subject: [PATCH] Add Status interface to settableInterfaces
Signed-off-by: wangjue <jue.wang2@luxshare-ict.com>
%% original patch: 0001-Add-Status-interface-to-settableInterfaces.patch
---
src/entity_manager.cpp | 36 +++++++++++++++++++++++++++++++-----
1 file changed, 31 insertions(+), 5 deletions(-)
diff --git a/src/entity_manager.cpp b/src/entity_manager.cpp
index ee08c00..24da084 100644
--- a/src/entity_manager.cpp
+++ b/src/entity_manager.cpp
@@ -52,6 +52,9 @@ constexpr const char* tempConfigDir = "/tmp/configuration/";
constexpr const char* lastConfiguration = "/tmp/configuration/last.json";
constexpr const char* currentConfiguration = "/var/configuration/system.json";
constexpr const char* globalSchema = "global.json";
+constexpr auto configIfaceName = "xyz.openbmc_project.Configuration.Status";
+constexpr auto statusPropName = "Status";
+bool internalSet = false;
const boost::container::flat_map<const char*, probe_type_codes, CmpStr>
probeTypes{{{"FALSE", probe_type_codes::FALSE_T},
@@ -61,8 +64,8 @@ const boost::container::flat_map<const char*, probe_type_codes, CmpStr>
{"FOUND", probe_type_codes::FOUND},
{"MATCH_ONE", probe_type_codes::MATCH_ONE}}};
-static constexpr std::array<const char*, 6> settableInterfaces = {
- "FanProfile", "Pid", "Pid.Zone", "Stepwise", "Thresholds", "Polling"};
+static constexpr std::array<const char*, 9> settableInterfaces = {
+ "FanProfile", "Pid", "Pid.Zone", "Stepwise", "Thresholds", "Polling", "Status", "Description", "Health"};
using JsonVariantType =
std::variant<std::vector<std::string>, std::vector<double>, std::string,
int64_t, uint64_t, double, int32_t, uint32_t, int16_t,
@@ -216,9 +219,31 @@ void addProperty(const std::string& name, const PropertyType& value,
iface->register_property(
name, value,
[&systemConfiguration,
- jsonPointerString{std::string(jsonPointerString)}](
- const PropertyType& newVal, PropertyType& val) {
- val = newVal;
+ jsonPointerString{std::string(jsonPointerString)},
+ interface = iface->get_interface_name(),
+ propertyName = name](const PropertyType& newVal, PropertyType& val) {
+ // if set from external source, for status property, only
+ // keep the bits 0..15
+ if (!internalSet && interface == configIfaceName &&
+ propertyName == statusPropName)
+ {
+ if constexpr (std::is_same_v<PropertyType, double>)
+ {
+ auto tmp = static_cast<uint32_t>(newVal);
+ tmp &= 0xFFFF;
+ val = static_cast<double>(
+ (static_cast<uint32_t>(val) & ~0xFFFF) | tmp);
+ }
+ else
+ {
+ val = newVal;
+ }
+ }
+ else
+ {
+ val = newVal;
+ }
+
if (!setJsonFromPointer(jsonPointerString, val, systemConfiguration))
{
std::cerr << "error setting json field\n";
@@ -1280,6 +1305,7 @@ int main()
entityIface->register_method("ReScan", [&]() {
propertiesChangedCallback(systemConfiguration, objServer);
});
+
entityIface->initialize();
if (fwVersionIsSame())
--
2.34.1
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,401 @@
{
"Exposes": [
{
"Name": "System Fan connector 1",
"Pwm": 0,
"Tachs": [
0,
1
],
"Type": "IntelFanConnector"
},
{
"Name": "System Fan connector 2",
"Pwm": 1,
"Tachs": [
2,
3
],
"Type": "IntelFanConnector"
},
{
"Name": "System Fan connector 3",
"Pwm": 2,
"Tachs": [
4,
5
],
"Type": "IntelFanConnector"
},
{
"Name": "System Fan connector 4",
"Pwm": 3,
"Tachs": [
6,
7
],
"Type": "IntelFanConnector"
},
{
"Name": "System Fan connector 5",
"Pwm": 4,
"Tachs": [
8,
9
],
"Type": "IntelFanConnector"
},
{
"Name": "System Fan connector 6",
"Pwm": 5,
"Tachs": [
10,
11
],
"Type": "IntelFanConnector"
},
{
"BindConnector": "System Fan connector 1",
"Index": 0,
"Name": "Fan 1 Inlet",
"Type": "AspeedFan"
},
{
"BindConnector": "System Fan connector 1",
"Index": 1,
"Name": "Fan 1 Outlet",
"Type": "AspeedFan"
},
{
"BindConnector": "System Fan connector 2",
"Index": 2,
"Name": "Fan 2 Inlet",
"Type": "AspeedFan"
},
{
"BindConnector": "System Fan connector 2",
"Index": 3,
"Name": "Fan 2 Outlet",
"Type": "AspeedFan"
},
{
"BindConnector": "System Fan connector 3",
"Index": 4,
"Name": "Fan 3 Inlet",
"Type": "AspeedFan"
},
{
"BindConnector": "System Fan connector 3",
"Index": 5,
"Name": "Fan 3 Outlet",
"Type": "AspeedFan"
},
{
"BindConnector": "System Fan connector 4",
"Index": 6,
"Name": "Fan 4 Inlet",
"Type": "AspeedFan"
},
{
"BindConnector": "System Fan connector 4",
"Index": 7,
"Name": "Fan 4 Outlet",
"Type": "AspeedFan"
},
{
"BindConnector": "System Fan connector 5",
"Index": 8,
"Name": "Fan 5 Inlet",
"Type": "AspeedFan"
},
{
"BindConnector": "System Fan connector 5",
"Index": 9,
"Name": "Fan 5 Outlet",
"Type": "AspeedFan"
},
{
"Class": "fan",
"FFGainCoefficient": 0.01,
"FFOffCoefficient": 0.0,
"ICoefficient": 0.0,
"ILimitMax": 0.0,
"ILimitMin": 0.0,
"Inputs": [
"Fan 1 Inlet",
"Fan 1 Outlet"
],
"Name": "Fan 1",
"NegativeHysteresis": 2.0,
"OutLimitMax": 100.0,
"OutLimitMin": 30.0,
"Outputs": [
"Pwm 1"
],
"PCoefficient": 0.0,
"PositiveHysteresis": 0.0,
"SlewNeg": 0.0,
"SlewPos": 0.0,
"Type": "Pid",
"Zones": [
"Fan1"
]
},
{
"Class": "fan",
"FFGainCoefficient": 0.01,
"FFOffCoefficient": 0.0,
"ICoefficient": 0.0,
"ILimitMax": 0.0,
"ILimitMin": 0.0,
"Inputs": [
"Fan 2 Inlet",
"Fan 2 Outlet"
],
"Name": "Fan 2",
"NegativeHysteresis": 2.0,
"OutLimitMax": 100.0,
"OutLimitMin": 30.0,
"Outputs": [
"Pwm 2"
],
"PCoefficient": 0.0,
"PositiveHysteresis": 0.0,
"SlewNeg": 0.0,
"SlewPos": 0.0,
"Type": "Pid",
"Zones": [
"Fan2"
]
},
{
"Class": "fan",
"FFGainCoefficient": 0.01,
"FFOffCoefficient": 0.0,
"ICoefficient": 0.0,
"ILimitMax": 0.0,
"ILimitMin": 0.0,
"Inputs": [
"Fan 3 Inlet",
"Fan 3 Outlet"
],
"Name": "Fan 3",
"NegativeHysteresis": 2.0,
"OutLimitMax": 100.0,
"OutLimitMin": 30.0,
"Outputs": [
"Pwm 3"
],
"PCoefficient": 0.0,
"PositiveHysteresis": 0.0,
"SlewNeg": 0.0,
"SlewPos": 0.0,
"Type": "Pid",
"Zones": [
"Fan3"
]
},
{
"Class": "fan",
"FFGainCoefficient": 0.01,
"FFOffCoefficient": 0.0,
"ICoefficient": 0.0,
"ILimitMax": 0.0,
"ILimitMin": 0.0,
"Inputs": [
"Fan 4 Inlet",
"Fan 4 Outlet"
],
"Name": "Fan 4",
"NegativeHysteresis": 2.0,
"OutLimitMax": 100.0,
"OutLimitMin": 30.0,
"Outputs": [
"Pwm 4"
],
"PCoefficient": 0.0,
"PositiveHysteresis": 0.0,
"SlewNeg": 0.0,
"SlewPos": 0.0,
"Type": "Pid",
"Zones": [
"Fan4"
]
},
{
"Class": "fan",
"FFGainCoefficient": 0.01,
"FFOffCoefficient": 0.0,
"ICoefficient": 0.0,
"ILimitMax": 0.0,
"ILimitMin": 0.0,
"Inputs": [
"Fan 5 Inlet",
"Fan 5 Outlet"
],
"Name": "Fan 5",
"NegativeHysteresis": 2.0,
"OutLimitMax": 100.0,
"OutLimitMin": 30.0,
"Outputs": [
"Pwm 5"
],
"PCoefficient": 0.0,
"PositiveHysteresis": 0.0,
"SlewNeg": 0.0,
"SlewPos": 0.0,
"Type": "Pid",
"Zones": [
"Fan5"
]
},
{
"FailSafePercent": 100,
"MinThermalRpm": 3000,
"Name": "Fan1",
"Type": "Pid.Zone"
},
{
"FailSafePercent": 100,
"MinThermalRpm": 3000,
"Name": "Fan2",
"Type": "Pid.Zone"
},
{
"FailSafePercent": 100,
"MinThermalRpm": 3000,
"Name": "Fan3",
"Type": "Pid.Zone"
},
{
"FailSafePercent": 100,
"MinThermalRpm": 3000,
"Name": "Fan4",
"Type": "Pid.Zone"
},
{
"FailSafePercent": 100,
"MinThermalRpm": 3000,
"Name": "Fan5",
"Type": "Pid.Zone"
},
{
"AllowedFailures": 1,
"Name": "FanRedundancy",
"Type": "FanRedundancy"
},
{
"Class": "temp",
"FFGainCoefficient": 0.0,
"FFOffCoefficient": 0.0,
"ICoefficient": -0.2,
"ILimitMax": 100,
"ILimitMin": 30,
"Inputs": [
"CPU0 Temp0"
],
"Name": "CPU0",
"NegativeHysteresis": 2.0,
"OutLimitMax": 100,
"OutLimitMin": 30,
"Outputs": [],
"PCoefficient": -3.0,
"PositiveHysteresis": 0.0,
"SetPoint": 45.0,
"SlewNeg": -1,
"SlewPos": 0.0,
"Type": "Pid",
"Zones": [
"Fan1",
"Fan2",
"Fan3",
"Fan4",
"Fan5"
]
},
{
"Class": "temp",
"FFGainCoefficient": 0.0,
"FFOffCoefficient": 0.0,
"ICoefficient": -0.2,
"ILimitMax": 100,
"ILimitMin": 30,
"Inputs": [
"CPU1 Temp0"
],
"Name": "CPU1",
"OutLimitMax": 100,
"OutLimitMin": 30,
"Outputs": [],
"PCoefficient": -3.0,
"SetPoint": 45.0,
"SlewNeg": -1,
"SlewPos": 0.0,
"Type": "Pid",
"Zones": [
"Fan1",
"Fan2",
"Fan3",
"Fan4",
"Fan5"
]
},
{
"Class": "Floor",
"Inputs": [
"XXX Temp"
],
"Name": "Front Panel LCC",
"NegativeHysteresis": 2,
"Output": [
50.0,
60.0
],
"PositiveHysteresis": 0,
"Reading": [
20.0,
30.0
],
"Type": "Stepwise",
"Zones": [
"Fan1",
"Fan2"
]
},
{
"Class": "Ceiling",
"Inputs": [
"Front Panel Temp"
],
"Name": "Front Panel UCC",
"NegativeHysteresis": 2,
"Output": [
70.0,
80.0
],
"PositiveHysteresis": 0,
"Reading": [
22.0,
32.0
],
"Type": "Stepwise",
"Zones": [
"Fan3",
"Fan4"
]
}
],
"Name": "Board Fan",
"Probe": "TRUE",
"Type": "Board",
"xyz.openbmc_project.Inventory.Decorator.Asset": {
"Manufacturer": "",
"Model": "",
"PartNumber": "",
"SerialNumber": ""
},
"xyz.openbmc_project.Inventory.Item.Bmc": {
"Present": true,
"Functional": true
}
}
@@ -0,0 +1,4 @@
{
"buses": [
]
}