69 lines
2.1 KiB
Diff
Executable File
69 lines
2.1 KiB
Diff
Executable File
From d329d711b3a31b55fa2299692c59a3621936327c Mon Sep 17 00:00:00 2001
|
|
From: "Wang.Bin" <Bin-B.Wang@luxshare-ict.com>
|
|
Date: Sun, 22 Dec 2024 15:41:07 +0800
|
|
Subject: [PATCH 3/3] Add-Free-Space-to-sel-info
|
|
|
|
---
|
|
storagehandler.cpp | 22 +++++++++++++++++++---
|
|
1 file changed, 19 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/storagehandler.cpp b/storagehandler.cpp
|
|
index 389a805..476031a 100644
|
|
--- a/storagehandler.cpp
|
|
+++ b/storagehandler.cpp
|
|
@@ -32,6 +32,7 @@
|
|
void register_netfn_storage_functions() __attribute__((constructor));
|
|
|
|
unsigned int g_sel_time = 0xFFFFFFFF;
|
|
+constexpr uint16_t MaxEvtCount =1000;
|
|
namespace ipmi
|
|
{
|
|
namespace sensor
|
|
@@ -276,7 +277,7 @@ ipmi::RspType<uint8_t, // SEL revision.
|
|
uint16_t entries = 0;
|
|
// Most recent addition timestamp.
|
|
uint32_t addTimeStamp = ipmi::sel::invalidTimeStamp;
|
|
-
|
|
+ bool overflowFlag = false;
|
|
if (!selCacheMapInitialized)
|
|
{
|
|
// In case the initSELCache() fails, try it again
|
|
@@ -301,9 +302,24 @@ ipmi::RspType<uint8_t, // SEL revision.
|
|
}
|
|
|
|
constexpr uint8_t selVersion = ipmi::sel::selVersion;
|
|
- constexpr uint16_t freeSpace = 0xFFFF;
|
|
+ uint16_t freeSpace = 0xFFFF;
|
|
constexpr uint32_t eraseTimeStamp = ipmi::sel::invalidTimeStamp;
|
|
constexpr uint3_t reserved{0};
|
|
+ uint16_t u32FreeSpace = (MaxEvtCount - entries)*sizeof(SELEntry);
|
|
+ if (u32FreeSpace >= 0xFFFF)
|
|
+ {
|
|
+ freeSpace = 0xFFFF;
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ freeSpace = u32FreeSpace;
|
|
+ }
|
|
+
|
|
+ overflowFlag = ipmi::sel::operationSupport::overflow;
|
|
+ if (entries >= MaxEvtCount)
|
|
+ {
|
|
+ overflowFlag = true;
|
|
+ }
|
|
|
|
return ipmi::responseSuccess(
|
|
selVersion, entries, freeSpace, addTimeStamp, eraseTimeStamp,
|
|
@@ -311,7 +327,7 @@ ipmi::RspType<uint8_t, // SEL revision.
|
|
ipmi::sel::operationSupport::reserveSel,
|
|
ipmi::sel::operationSupport::partialAddSelEntry,
|
|
ipmi::sel::operationSupport::deleteSel, reserved,
|
|
- ipmi::sel::operationSupport::overflow);
|
|
+ overflowFlag);
|
|
}
|
|
|
|
ipmi_ret_t getSELEntry(ipmi_netfn_t, ipmi_cmd_t, ipmi_request_t request,
|
|
--
|
|
2.25.1
|
|
|