dimm-spd-reader: fix PMIC type detection from SPD

Add support for identifying PMIC unknown state as 0xFF.

Update PMIC SPD detection flow to read SPD registers 0x200, 0x204, and 0x208. Check bit7 to determine whether the PMIC is installed, and use SPD bit[3:0] as the PMIC type.

Also update the IPMI error handling path to return completion code 0x07 for command 0x6c when PMIC detection fails or the PMIC type is unknown.
This commit is contained in:
Your Name
2026-04-27 10:01:06 +08:00
parent 182a0516ac
commit 0cc0c96893
6 changed files with 697 additions and 68 deletions
@@ -16,28 +16,33 @@
#define STATUS_TEMP_NUM 3
#define STATUS_PMIC_RAIL_NUM 6
#define STATUS_REG_NUM 8
#define STATUS_ERROR_NUM 1
extern std::unordered_map<std::string, std::shared_ptr<sdbusplus::asio::dbus_interface>> dimm_temp_inf;
extern std::unordered_map<std::string, std::shared_ptr<sdbusplus::asio::dbus_interface>> dimm_voltage_inf;
extern std::unordered_map<std::string, std::shared_ptr<sdbusplus::asio::dbus_interface>> dimm_current_inf;
extern std::unordered_map<std::string, std::shared_ptr<sdbusplus::asio::dbus_interface>> dimm_power_inf;
extern std::unordered_map<std::string, std::shared_ptr<sdbusplus::asio::dbus_interface>> dimm_statusReg_inf;
extern std::unordered_map<std::string, std::shared_ptr<sdbusplus::asio::dbus_interface>> dimm_errCode_inf;
enum FieldType {
VOLTAGE,
CURRENT,
POWER,
TEMP,
STATUS
STATUS,
ERROR
};
struct DimmData
{
uint8_t reg[STATUS_REG_NUM];
uint8_t error[STATUS_ERROR_NUM];
double voltage[STATUS_PMIC_RAIL_NUM];
double current[STATUS_PMIC_RAIL_NUM];
double power[STATUS_PMIC_RAIL_NUM];
double temp[STATUS_TEMP_NUM];
};
struct DimmI3CAddr
@@ -53,7 +58,8 @@ enum PMICType {
PMIC5020,
PMIC5120,
PMIC5200,
PMIC5030
PMIC5030,
Unknown = 0xFF
};
struct DIMMSpdReader : std::enable_shared_from_this<DIMMSpdReader>
@@ -81,6 +87,8 @@ struct DIMMSpdReader : std::enable_shared_from_this<DIMMSpdReader>
void getdimmI3cSwitchState(const std::shared_ptr<sdbusplus::asio::connection>& conn, size_t retries = 2);
int getPmicType(uint8_t cpuid, uint8_t rank);
int getPmicStatusRegs(uint8_t cpuid, uint8_t rank, DimmData& dimmData);
int setADCAccuracyStepSize(uint8_t cpuid, uint8_t rank, DimmData& dimmData, uint8_t R32);
int checkADCAccuracyStepSize(uint8_t cpuid, uint8_t rank, DimmData& dimmData, const uint8_t* ThresholdData);
private:
std::vector<sdbusplus::bus::match_t> matches;