|
@@ -30,6 +30,7 @@
|
|
|
#include <string.h>
|
|
|
|
|
|
#include "goahead.h"
|
|
|
+#include "com_IPMI_App.h"
|
|
|
|
|
|
/* Helper function */
|
|
|
uint8_t libipmi_GetBits(uint8_t orig, uint8_t startbit, uint8_t endbit)
|
|
@@ -48,25 +49,6 @@ uint8_t libipmi_GetBits(uint8_t orig, uint8_t startbit, uint8_t endbit)
|
|
|
/*****************************************************************************
|
|
|
System Event Log
|
|
|
******************************************************************************/
|
|
|
-uint16_t IPMICMD_GetSELInfo(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
- SELInfo_T *pResGetSELInfo,
|
|
|
- int timeout)
|
|
|
-{
|
|
|
- uint16_t wRet;
|
|
|
- uint32_t dwResLen;
|
|
|
- uint8_t DummyReqData[8];
|
|
|
- uint8_t NetFnLunStorage = (NETFN_STORAGE << 2);
|
|
|
-
|
|
|
- dwResLen = sizeof(SELInfo_T);
|
|
|
- wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
- NetFnLunStorage, CMD_GET_SEL_INFO,
|
|
|
- (uint8_t*)DummyReqData, 0,
|
|
|
- (uint8_t *)pResGetSELInfo, &dwResLen,
|
|
|
- timeout);
|
|
|
- return wRet;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
|
|
|
uint16_t IPMICMD_GetSELAllocationInfo(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
SELAllocInfo_T *pResGetSELAllocInfo,
|
|
@@ -75,11 +57,10 @@ uint16_t IPMICMD_GetSELAllocationInfo(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
uint16_t wRet;
|
|
|
uint32_t dwResLen;
|
|
|
uint8_t DummyReqData[8];
|
|
|
- uint8_t NetFnLunStorage = (NETFN_STORAGE << 2);
|
|
|
|
|
|
dwResLen = sizeof(SELAllocInfo_T);
|
|
|
wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
- NetFnLunStorage, CMD_GET_SEL_ALLOCATION_INFO,
|
|
|
+ NETFNLUN_IPMI_APP, CMD_GET_SEL_ALLOCATION_INFO,
|
|
|
(uint8_t*)DummyReqData, 0,
|
|
|
(uint8_t *)pResGetSELAllocInfo, &dwResLen,
|
|
|
timeout);
|
|
@@ -95,28 +76,65 @@ uint16_t IPMICMD_ReserveSEL(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
uint32_t dwResLen = 0;
|
|
|
|
|
|
memset(pReserveSelRes, 0, sizeof(ReserveSELRes_T));
|
|
|
-
|
|
|
- dwResLen = sizeof(ReserveSELRes_T);
|
|
|
wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
- (NETFN_STORAGE << 2), CMD_RESERVE_SEL,
|
|
|
+ NETFNLUN_IPMI_APP, CMD_RESERVE_SEL,
|
|
|
NULL, 0,
|
|
|
(uint8_t *)pReserveSelRes, &dwResLen,
|
|
|
timeout);
|
|
|
|
|
|
- if ( (wRet != 0) && (pReserveSelRes->CompletionCode != CC_INV_CMD) )
|
|
|
+ /* If ReserveSEL command is not implemented, return 0x0000 as reservation ID */
|
|
|
+ if ( pReserveSelRes->CompletionCode == CC_INV_CMD )
|
|
|
+ {
|
|
|
+ pReserveSelRes->ReservationID = 0x0000;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(wRet != 0)
|
|
|
{
|
|
|
printf("Could not get SEL reservation!!\n");
|
|
|
return wRet;
|
|
|
}
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+uint16_t IPMC_ReserveSEL(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr,
|
|
|
+ ReserveSELRes_T* pReserveSelRes,
|
|
|
+ int timeout)
|
|
|
+{
|
|
|
+ int wRet = 0;
|
|
|
+ uint32_t dwResLen;
|
|
|
+ uint8_t Req[50] = {0};
|
|
|
+ uint8_t Res[50] = {0};
|
|
|
+
|
|
|
+ Req[0] = 0x40; //Track | channel 0
|
|
|
+ Req[1] = IpmbAddr;
|
|
|
+ Req[2] = NETFNLUN_IPMI_APP;
|
|
|
+ Req[3] = 0x100 - (Req[1] + Req[2])&0xff; //checksum1
|
|
|
+ Req[4] = 0x20;
|
|
|
+ Req[5] = 0x10;
|
|
|
+ Req[6] = CMD_RESERVE_SEL;
|
|
|
+ Req[7] = 0x100 - (Req[4] + Req[5] + Req[6])&0xff;
|
|
|
|
|
|
+ wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
+ NETFNLUN_IPMI_APP, CMD_SEND_MSG,
|
|
|
+ Req, 8,
|
|
|
+ Res, &dwResLen,
|
|
|
+ timeout);
|
|
|
+
|
|
|
+ memcpy(pReserveSelRes, &Res[6], sizeof(ReserveSELRes_T));
|
|
|
/* If ReserveSEL command is not implemented, return 0x0000 as reservation ID */
|
|
|
if ( pReserveSelRes->CompletionCode == CC_INV_CMD )
|
|
|
{
|
|
|
pReserveSelRes->ReservationID = 0x0000;
|
|
|
- wRet = 0;
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
- return wRet;
|
|
|
+ if(wRet != 0)
|
|
|
+ {
|
|
|
+ printf("Could not get SEL reservation!!\n");
|
|
|
+ return wRet;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
/* This function gets an entry from SEL. */
|
|
@@ -127,16 +145,94 @@ uint16_t IPMICMD_GetSELEntry(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
int timeout)
|
|
|
{
|
|
|
uint16_t wRet = 0;
|
|
|
- uint8_t NetFnLunStorage = (NETFN_STORAGE << 2);
|
|
|
|
|
|
wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
- NetFnLunStorage, CMD_GET_SEL_ENTRY,
|
|
|
+ NETFNLUN_IPMI_APP, CMD_GET_SEL_ENTRY,
|
|
|
(uint8_t*)pGetSELReqData, sizeof(GetSELReq_T),
|
|
|
(uint8_t *)pGetSELResData, &ResDataLen,
|
|
|
timeout);
|
|
|
return wRet;
|
|
|
}
|
|
|
|
|
|
+uint16_t IPMI_GetSELEntry(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
+ GetSELReq_T* pGetSELReqData,
|
|
|
+ SELEventRecord_T* pSELEventData,
|
|
|
+ uint16_t *nextRecID,
|
|
|
+ int timeout)
|
|
|
+{
|
|
|
+ uint16_t wRet = 0;
|
|
|
+ uint8_t Res[50];
|
|
|
+ uint32_t dwResLen;
|
|
|
+
|
|
|
+ wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
+ NETFNLUN_IPMI_STORAGE, CMD_GET_SEL_ENTRY,
|
|
|
+ (uint8_t*)pGetSELReqData, sizeof(GetSELReq_T),
|
|
|
+ Res, &dwResLen,
|
|
|
+ timeout);
|
|
|
+ // printf("---> Res ");
|
|
|
+ // int i;
|
|
|
+ // for(i=0;i<17;i++)
|
|
|
+ // printf("%02x ", Res[i]);
|
|
|
+ // printf("\n");
|
|
|
+ if((wRet != 0) || (Res[0] != 0))
|
|
|
+ {
|
|
|
+ printf("IPMI_GetSELEntry failed\n");
|
|
|
+ *nextRecID = 0xffff;
|
|
|
+ memset(pSELEventData, 0, sizeof(SELEventRecord_T));
|
|
|
+ return wRet;
|
|
|
+ }
|
|
|
+
|
|
|
+ *nextRecID = (Res[2]<<8) | Res[1];
|
|
|
+ memcpy(pSELEventData, &Res[3], sizeof(SELEventRecord_T));
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+uint16_t IPMC_GetSELEntry(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr,
|
|
|
+ GetSELReq_T* pGetSELReqData,
|
|
|
+ SELEventRecord_T* pSELEventData,
|
|
|
+ uint16_t *nextRecID,
|
|
|
+ int timeout)
|
|
|
+{
|
|
|
+ int wRet = 0;
|
|
|
+ uint32_t dwResLen;
|
|
|
+ uint8_t Req[50] = {0};
|
|
|
+ uint8_t Res[50] = {0};
|
|
|
+
|
|
|
+ Req[0] = 0x40; //Track | channel 0
|
|
|
+ Req[1] = IpmbAddr;
|
|
|
+ Req[2] = NETFNLUN_IPMI_STORAGE;
|
|
|
+ Req[3] = 0x100 - (Req[1] + Req[2])&0xff; //checksum1
|
|
|
+ Req[4] = 0x20;
|
|
|
+ Req[5] = 0x10;
|
|
|
+ Req[6] = CMD_GET_SEL_ENTRY;
|
|
|
+ Req[7] = pGetSELReqData->ReservationID&0xff;
|
|
|
+ Req[8] = (pGetSELReqData->ReservationID>>8)&0xff;
|
|
|
+ Req[9] = pGetSELReqData->RecID&0xff;
|
|
|
+ Req[10] = (pGetSELReqData->RecID>>8)&0xff;
|
|
|
+ Req[11] = pGetSELReqData->Offset;
|
|
|
+ Req[12] = pGetSELReqData->Size;
|
|
|
+ Req[13] = 0x100 - (Req[4] + Req[5] + Req[6] + Req[7] + Req[8] + Req[9] + Req[10] + Req[11] + Req[12])&0xff;
|
|
|
+
|
|
|
+ wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
+ NETFNLUN_IPMI_APP, CMD_SEND_MSG,
|
|
|
+ Req, 14,
|
|
|
+ Res, &dwResLen,
|
|
|
+ timeout);
|
|
|
+ if((wRet != 0) || (Res[6] != 0))
|
|
|
+ {
|
|
|
+ printf("IPMI_GetSELEntry failed\n");
|
|
|
+ *nextRecID = 0xffff;
|
|
|
+ memset(pSELEventData, 0, sizeof(SELEventRecord_T));
|
|
|
+ return wRet;
|
|
|
+ }
|
|
|
+
|
|
|
+ *nextRecID = (Res[8]<<8) | Res[7];
|
|
|
+ memcpy(pSELEventData, &Res[9], sizeof(SELEventRecord_T));
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
/* This function adds an entry into SEL. */
|
|
|
uint16_t IPMICMD_AddSELEntry(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
SELEventRecord_T* pSELReqData,
|
|
@@ -145,11 +241,10 @@ uint16_t IPMICMD_AddSELEntry(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
{
|
|
|
uint16_t wRet = 0;
|
|
|
uint32_t dwResLen;
|
|
|
- uint8_t NetFnLunStorage = (NETFN_STORAGE << 2);
|
|
|
|
|
|
dwResLen = sizeof(AddSELRes_T);
|
|
|
wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
- NetFnLunStorage, CMD_ADD_SEL_ENTRY,
|
|
|
+ NETFNLUN_IPMI_APP, CMD_ADD_SEL_ENTRY,
|
|
|
(uint8_t*)pSELReqData, sizeof(SELEventRecord_T),
|
|
|
(uint8_t *)pSELResData, &dwResLen,
|
|
|
timeout);
|
|
@@ -174,7 +269,7 @@ uint16_t IPMICMD_DeleteSELEntry(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
//first do a SEL reservation
|
|
|
dwResLen = sizeof(ReserveSELRes_T);
|
|
|
wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
- (NETFN_STORAGE << 2), CMD_RESERVE_SEL,
|
|
|
+ NETFNLUN_IPMI_APP, CMD_RESERVE_SEL,
|
|
|
NULL, 0,
|
|
|
(uint8_t *)&ReserveSelRes, &dwResLen,
|
|
|
timeout);
|
|
@@ -198,7 +293,7 @@ uint16_t IPMICMD_DeleteSELEntry(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
DeleteSELReqData.RecID = RecordID;
|
|
|
|
|
|
wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
- (NETFN_STORAGE << 2), CMD_DELETE_SEL_ENTRY,
|
|
|
+ NETFNLUN_IPMI_APP, CMD_DELETE_SEL_ENTRY,
|
|
|
(uint8_t*)&DeleteSELReqData, sizeof(DeleteSELReqData),
|
|
|
(uint8_t *)&DeleteSELResData, &dwResLen,
|
|
|
timeout);
|
|
@@ -216,12 +311,10 @@ uint16_t IPMICMD_ClearSEL(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
|
|
|
uint8_t DummyReqData[8];
|
|
|
|
|
|
- uint8_t NetFnLunStorage = (NETFN_STORAGE << 2);
|
|
|
-
|
|
|
//first do a SEL reservation
|
|
|
dwResLen = sizeof(ReserveSELRes_T);
|
|
|
wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
- NetFnLunStorage, CMD_RESERVE_SEL,
|
|
|
+ NETFNLUN_IPMI_APP, CMD_RESERVE_SEL,
|
|
|
(uint8_t*)DummyReqData, 0,
|
|
|
(uint8_t *)&ReserveSelRes, &dwResLen,
|
|
|
timeout);
|
|
@@ -250,12 +343,87 @@ uint16_t IPMICMD_ClearSEL(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
|
|
|
dwResLen = sizeof(ClearSELRes_T);
|
|
|
wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
- NetFnLunStorage, CMD_CLEAR_SEL,
|
|
|
+ NETFNLUN_IPMI_APP, CMD_CLEAR_SEL,
|
|
|
(uint8_t*)&ClearSelReq, sizeof(ClearSELReq_T),
|
|
|
(uint8_t *)&ClearSelRes, &dwResLen,
|
|
|
timeout);
|
|
|
return wRet;
|
|
|
}
|
|
|
+
|
|
|
+uint16_t IPMC_ClearSEL(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr,
|
|
|
+ int timeout)
|
|
|
+{
|
|
|
+ uint16_t ReservationID = 0;
|
|
|
+
|
|
|
+ int wRet = 0;
|
|
|
+ uint32_t dwResLen;
|
|
|
+ uint8_t Req[50] = {0};
|
|
|
+ uint8_t Res[50] = {0};
|
|
|
+
|
|
|
+ //first do a SEL reservation
|
|
|
+ Req[0] = 0x40; //Track | channel 0
|
|
|
+ Req[1] = IpmbAddr;
|
|
|
+ Req[2] = NETFNLUN_IPMI_STORAGE;
|
|
|
+ Req[3] = 0x100 - (Req[1] + Req[2])&0xff; //checksum1
|
|
|
+ Req[4] = 0x20;
|
|
|
+ Req[5] = 0x10;
|
|
|
+ Req[6] = CMD_RESERVE_SEL;
|
|
|
+ Req[7] = 0x100 - (Req[4] + Req[5] + Req[6])&0xff;
|
|
|
+
|
|
|
+ wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
+ NETFNLUN_IPMI_APP, CMD_SEND_MSG,
|
|
|
+ Req, 8,
|
|
|
+ Res, &dwResLen,
|
|
|
+ timeout);
|
|
|
+
|
|
|
+ if ( (wRet != 0) )
|
|
|
+ {
|
|
|
+ printf("Could not get SEL reservation while trying to clear event log!!\n");
|
|
|
+ return wRet;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Res[6] == CC_INV_CMD)
|
|
|
+ {
|
|
|
+ // Reservation ID should be set as 0x0000 for implementations that don't
|
|
|
+ // implement ReserveSEL command
|
|
|
+ ReservationID = 0x0000;
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ReservationID = (Res[8]<<8) | Res[7];
|
|
|
+ }
|
|
|
+
|
|
|
+ Req[0] = 0x40; //Track | channel 0
|
|
|
+ Req[1] = IpmbAddr;
|
|
|
+ Req[2] = NETFNLUN_IPMI_STORAGE;
|
|
|
+ Req[3] = 0x100 - (Req[1] + Req[2])&0xff; //checksum1
|
|
|
+ Req[4] = 0x20;
|
|
|
+ Req[5] = 0x10;
|
|
|
+ Req[6] = CMD_CLEAR_SEL;
|
|
|
+ Req[7] = ReservationID&0xff;
|
|
|
+ Req[8] = (ReservationID>>8)&0xff;
|
|
|
+ Req[9] = 'C';
|
|
|
+ Req[10] = 'L';
|
|
|
+ Req[11] = 'R';
|
|
|
+ Req[12] = 0xAA; //InitOrStatus
|
|
|
+ Req[13] = 0x100 - (Req[4] + Req[5] + Req[6] + Req[7] + Req[8] + Req[9] + Req[10] + Req[11] + Req[12])&0xff;
|
|
|
+
|
|
|
+ wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
+ NETFNLUN_IPMI_APP, CMD_SEND_MSG,
|
|
|
+ Req, 14,
|
|
|
+ Res, &dwResLen,
|
|
|
+ timeout);
|
|
|
+
|
|
|
+ if ( (wRet != 0) || (Res[6] != 0) )
|
|
|
+ {
|
|
|
+ printf("Clear event log failed!\n");
|
|
|
+ return wRet;
|
|
|
+ }
|
|
|
+
|
|
|
+ return wRet;
|
|
|
+}
|
|
|
+
|
|
|
/**************************************************************************************
|
|
|
*****************************Higher level commands*****************************
|
|
|
**************************************************************************************/
|
|
@@ -264,37 +432,66 @@ uint16_t LIBIPMI_HL_GetNumOfSELEntries(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
uint16_t* nNumOfSELEntries,
|
|
|
int timeout)
|
|
|
{
|
|
|
- uint16_t wRet = 0;
|
|
|
SELInfo_T SELInfo;
|
|
|
+ uint16_t wRet;
|
|
|
+ uint32_t dwResLen;
|
|
|
+ uint8_t DummyReqData[8];
|
|
|
|
|
|
- wRet = IPMICMD_GetSELInfo(pUDSSession,&SELInfo,timeout);
|
|
|
- if(wRet != 0)
|
|
|
+ dwResLen = sizeof(SELInfo_T);
|
|
|
+ wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
+ NETFNLUN_IPMI_STORAGE, CMD_GET_SEL_INFO,
|
|
|
+ (uint8_t*)DummyReqData, 0,
|
|
|
+ (uint8_t *)&SELInfo, &dwResLen,
|
|
|
+ timeout);
|
|
|
+ if((wRet != 0) || (SELInfo.CompletionCode != 0))
|
|
|
{
|
|
|
printf("LIBIPMI_HL_GetNumOfSELEntries: Error getting SEL info\n");
|
|
|
+ *nNumOfSELEntries = 0;
|
|
|
return wRet;
|
|
|
}
|
|
|
*nNumOfSELEntries = (SELInfo.RecCt);
|
|
|
- return wRet;
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
-/* This function returns max possible number of SEL entries in the system at any time */
|
|
|
-uint16_t LIBIPMI_HL_GetMaxPossibleSELEntries(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
- uint16_t* nMaxPossibleSELEntries,
|
|
|
- int timeout)
|
|
|
+uint16_t IPMC_GetNumOfSELEntries(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr,
|
|
|
+ uint16_t* nNumOfSELEntries,
|
|
|
+ int timeout)
|
|
|
{
|
|
|
- uint16_t wRet = 0;
|
|
|
- SELAllocInfo_T SELAllocInfo;
|
|
|
+ SELInfo_T *pSELInfo;
|
|
|
+ int wRet = 0;
|
|
|
+ uint32_t dwResLen;
|
|
|
+ uint8_t Req[50] = {0};
|
|
|
+ uint8_t Res[50] = {0};
|
|
|
+
|
|
|
+ Req[0] = 0x40; //Track | channel 0
|
|
|
+ Req[1] = IpmbAddr;
|
|
|
+ Req[2] = NETFNLUN_IPMI_STORAGE;
|
|
|
+ Req[3] = 0x100 - (Req[1] + Req[2])&0xff; //checksum1
|
|
|
+ Req[4] = 0x20;
|
|
|
+ Req[5] = 0x10;
|
|
|
+ Req[6] = CMD_GET_SEL_INFO;
|
|
|
+ Req[7] = 0x100 - (Req[4] + Req[5] + Req[6])&0xff;
|
|
|
|
|
|
- wRet = IPMICMD_GetSELAllocationInfo(pUDSSession,&SELAllocInfo,timeout);
|
|
|
- if(wRet != 0)
|
|
|
+ wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
+ NETFNLUN_IPMI_APP, CMD_SEND_MSG,
|
|
|
+ Req, 8,
|
|
|
+ Res, &dwResLen,
|
|
|
+ timeout);
|
|
|
+
|
|
|
+ if ( (wRet != 0) || (Res[6] != 0) )
|
|
|
{
|
|
|
- printf("LIBIPMI_HL_GetMaxPossibleSELEntries: Error getting SEL Alloc info\n");
|
|
|
+ printf("Get SEL Number failed!\n");
|
|
|
+ *nNumOfSELEntries = 0;
|
|
|
return wRet;
|
|
|
}
|
|
|
- *nMaxPossibleSELEntries = (SELAllocInfo.NumAllocUnits);
|
|
|
- return wRet;
|
|
|
+
|
|
|
+ pSELInfo = (SELInfo_T *)&Res[6];
|
|
|
+ *nNumOfSELEntries = (pSELInfo->RecCt);
|
|
|
+
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/* This function returns total number of SEL entries present in the system at that time.
|
|
|
IMPORTANT:
|
|
|
Before you call this function, call LIBIPMI_HL_GetNumOfSELEntries() to get the number of
|
|
@@ -398,7 +595,7 @@ uint16_t LIBIPMI_HL_GetAllSensorInfo(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
|
|
|
|
|
|
/* Call the function to read all the SDRs into this buffer */
|
|
|
- wRet = LIBIPMI_HL_GetAllSDRs(pUDSSession,
|
|
|
+ wRet = Storlead_GetAllSDRs(pUDSSession, 0x20,
|
|
|
pSDRBuff,(MaxLen * SDRCnt),
|
|
|
timeout*4);
|
|
|
*MaxSDRLen=MaxLen;
|
|
@@ -454,7 +651,7 @@ uint16_t LIBIPMI_HL_GetSensorName(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
pSDRStart = pSDRBuff;
|
|
|
|
|
|
/* Call the function to read all the SDRs into this buffer */
|
|
|
- wRet = LIBIPMI_HL_GetAllSDRs(pUDSSession,
|
|
|
+ wRet = Storlead_GetAllSDRs(pUDSSession, 0x20,
|
|
|
pSDRBuff,(MaxSDRLen * SDRCount),
|
|
|
timeout*4);
|
|
|
|
|
@@ -507,7 +704,7 @@ it just does that for them
|
|
|
GetAllSelEntires
|
|
|
Also GetAllSDR stuff once
|
|
|
then loop and fill it all up internally*/
|
|
|
-uint16_t LIBIPMI_HL_GetAllSelEntriesWithSensorNames(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
+uint16_t Storlead_GetAllSelEntriesWithSensorNames(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr,
|
|
|
SELEventRecordWithSensorName_T *pSELEntriesBuffer,
|
|
|
int timeout)
|
|
|
{
|
|
@@ -527,7 +724,7 @@ uint16_t LIBIPMI_HL_GetAllSelEntriesWithSensorNames(IPMI20_UDS_SESSION_T *pUDSSe
|
|
|
/* We want to read full records */
|
|
|
//DataLen = sizeof(GetSELRes_T) + sizeof(SELEventRecord_T);
|
|
|
|
|
|
- wRet = LIBIPMI_HL_AMIGetSELEntires(pUDSSession,pSELEntriesBuffer,&nNumSelEntries,timeout);
|
|
|
+ wRet = Storlead_AMIGetSELEntires(pUDSSession, IpmbAddr, pSELEntriesBuffer,&nNumSelEntries,timeout);
|
|
|
if(wRet != LIBIPMI_E_SUCCESS)
|
|
|
{
|
|
|
printf("LIBIPMI_HL_AMIGetSELEntires : Error getting SEL Entries \n");
|
|
@@ -537,7 +734,14 @@ uint16_t LIBIPMI_HL_GetAllSelEntriesWithSensorNames(IPMI20_UDS_SESSION_T *pUDSSe
|
|
|
|
|
|
/*************************************Get The SDR once so that we can get sensor names*******************/
|
|
|
/* Get max buffer size to be allocated to read all SDRs in the system */
|
|
|
- wRet = IPMICMD_GetSDRRepositoryAllocInfo(pUDSSession, &SDRAllocationInfo, timeout);
|
|
|
+ if(IpmbAddr == 0x20)
|
|
|
+ {
|
|
|
+ wRet = IPMICMD_GetSDRRepositoryAllocInfo(pUDSSession, &SDRAllocationInfo, timeout);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ wRet = IPMC_GetSDRRepositoryAllocInfo(pUDSSession, IpmbAddr, &SDRAllocationInfo, timeout);
|
|
|
+ }
|
|
|
if( wRet != 0 )
|
|
|
{
|
|
|
printf("Error getting SDR Repository Allocation Info\n");
|
|
@@ -548,7 +752,14 @@ uint16_t LIBIPMI_HL_GetAllSelEntriesWithSensorNames(IPMI20_UDS_SESSION_T *pUDSSe
|
|
|
SDRAllocationInfo.LargestFreeBlock, SDRAllocationInfo.MaxRecSize);
|
|
|
|
|
|
/* Get repository information */
|
|
|
- wRet = IPMICMD_GetSDRRepositoryInfo(pUDSSession, &SDRReposInfo,timeout);
|
|
|
+ if(IpmbAddr == 0x20)
|
|
|
+ {
|
|
|
+ wRet = IPMICMD_GetSDRRepositoryInfo(pUDSSession, &SDRReposInfo,timeout);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ wRet = IPMC_GetSDRRepositoryInfo(pUDSSession, IpmbAddr, &SDRReposInfo,timeout);
|
|
|
+ }
|
|
|
if( wRet != 0 )
|
|
|
{
|
|
|
printf("Error getting SDR Repository Info\n");
|
|
@@ -573,7 +784,7 @@ uint16_t LIBIPMI_HL_GetAllSelEntriesWithSensorNames(IPMI20_UDS_SESSION_T *pUDSSe
|
|
|
pSDRStart = pSDRBuff;
|
|
|
|
|
|
/* Call the function to read all the SDRs into this buffer */
|
|
|
- wRet = LIBIPMI_HL_GetAllSDRs(pUDSSession,
|
|
|
+ wRet = Storlead_GetAllSDRs(pUDSSession, IpmbAddr,
|
|
|
pSDRBuff,(MaxSDRLen * SDRCount),
|
|
|
timeout*4);
|
|
|
|
|
@@ -631,6 +842,128 @@ uint16_t LIBIPMI_HL_GetAllSelEntriesWithSensorNames(IPMI20_UDS_SESSION_T *pUDSSe
|
|
|
return wRet;
|
|
|
}
|
|
|
|
|
|
+uint16_t IPMC_GetAllSelEntriesWithSensorNames(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr,
|
|
|
+ SELEventRecordWithSensorName_T *pSELEntriesBuffer,
|
|
|
+ int timeout)
|
|
|
+{
|
|
|
+ uint16_t wRet = 0;
|
|
|
+ SDRRepositoryAllocInfo_T SDRAllocationInfo;
|
|
|
+ SDRRepositoryInfo_T SDRReposInfo;
|
|
|
+ int MaxSDRLen = 0;
|
|
|
+ int i,SDRCount = 0;
|
|
|
+ uint8_t *pSDRBuff = NULL;
|
|
|
+ SDRHeader *pSDRHeader = NULL;
|
|
|
+ uint8_t *pSDRStart = NULL;
|
|
|
+ uint32_t nNumSelEntries = 0;
|
|
|
+ int q = 0;
|
|
|
+
|
|
|
+
|
|
|
+ /***********************************Get all Sel Entries now*********************************************/
|
|
|
+ /* We want to read full records */
|
|
|
+ //DataLen = sizeof(GetSELRes_T) + sizeof(SELEventRecord_T);
|
|
|
+
|
|
|
+ wRet = Storlead_AMIGetSELEntires(pUDSSession, 0x20, pSELEntriesBuffer,&nNumSelEntries,timeout);
|
|
|
+ if(wRet != LIBIPMI_E_SUCCESS)
|
|
|
+ {
|
|
|
+ printf("LIBIPMI_HL_AMIGetSELEntires : Error getting SEL Entries \n");
|
|
|
+ return wRet;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /*************************************Get The SDR once so that we can get sensor names*******************/
|
|
|
+ /* Get max buffer size to be allocated to read all SDRs in the system */
|
|
|
+ wRet = IPMICMD_GetSDRRepositoryAllocInfo(pUDSSession, &SDRAllocationInfo, timeout);
|
|
|
+ if( wRet != 0 )
|
|
|
+ {
|
|
|
+ printf("Error getting SDR Repository Allocation Info\n");
|
|
|
+ return wRet;
|
|
|
+ }
|
|
|
+ printf("---> NumAllocUnits: %d, AllocUnitSize: %d, NumFreeAllocUnits: %d, LargestFreeBlock: %d, MaxRecSize: %d\n", \
|
|
|
+ SDRAllocationInfo.NumAllocUnits, SDRAllocationInfo.AllocUnitSize, SDRAllocationInfo.NumFreeAllocUnits, \
|
|
|
+ SDRAllocationInfo.LargestFreeBlock, SDRAllocationInfo.MaxRecSize);
|
|
|
+
|
|
|
+ /* Get repository information */
|
|
|
+ wRet = IPMICMD_GetSDRRepositoryInfo(pUDSSession, &SDRReposInfo,timeout);
|
|
|
+ if( wRet != 0 )
|
|
|
+ {
|
|
|
+ printf("Error getting SDR Repository Info\n");
|
|
|
+ return wRet;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* Determine max SDR entry length */
|
|
|
+ MaxSDRLen = SDRAllocationInfo.MaxRecSize * ( SDRAllocationInfo.AllocUnitSize );
|
|
|
+
|
|
|
+ /* Determine total number of SDRs stored */
|
|
|
+ SDRCount = ( SDRReposInfo.RecCt );
|
|
|
+ printf("---> SDRCount: %d, MaxSDRLen: %d\n", SDRCount, MaxSDRLen);
|
|
|
+
|
|
|
+ /* Allocate the buffer */
|
|
|
+ pSDRBuff = (uint8_t *) walloc(MaxSDRLen * SDRCount);
|
|
|
+ if(!pSDRBuff)
|
|
|
+ {
|
|
|
+ printf("Error allocating memopry for SDRs in GetAllEventsWithSensorNames\n");
|
|
|
+ wRet = STATUS_CODE(IPMI_ERROR_FLAG,CC_OUT_OF_SPACE);
|
|
|
+ return wRet;
|
|
|
+ }
|
|
|
+ pSDRStart = pSDRBuff;
|
|
|
+
|
|
|
+ /* Call the function to read all the SDRs into this buffer */
|
|
|
+ wRet = Storlead_GetAllSDRs(pUDSSession, 0x20,
|
|
|
+ pSDRBuff,(MaxSDRLen * SDRCount),
|
|
|
+ timeout*4);
|
|
|
+
|
|
|
+ /*************************************Get The SDR once so that we can get sensor names*******************/
|
|
|
+ /******************Now parse through sensor headers and get names corresponding to each event************/
|
|
|
+ for(q=0;q<nNumSelEntries;q++)
|
|
|
+ {
|
|
|
+
|
|
|
+ strcpy((char*)pSELEntriesBuffer[q].SensorName,(char*)"Unknown");
|
|
|
+
|
|
|
+ pSDRBuff = pSDRStart;
|
|
|
+ for( i = 0; i < SDRCount; i++)
|
|
|
+ {
|
|
|
+ pSDRHeader = (SDRHeader *) pSDRBuff;
|
|
|
+ if((pSDRHeader->RecordType >= 0x01) && (pSDRHeader->RecordType <= 0x03))
|
|
|
+ {
|
|
|
+ /* Compare SlaveAdd and LUNid fields */
|
|
|
+ uint8_t *pTmp = pSDRBuff + sizeof(SDRHeader);
|
|
|
+ uint8_t len = 0;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if((pSELEntriesBuffer[q].EventRecord.EvtRecord.GenID[0] == *pTmp) && (pSELEntriesBuffer[q].EventRecord.EvtRecord.GenID[1] == *(pTmp+1)))
|
|
|
+ {
|
|
|
+ /* Now compare the sensor number */
|
|
|
+ if(pSELEntriesBuffer[q].EventRecord.EvtRecord.SensorNum == *(pTmp+2))
|
|
|
+ {
|
|
|
+ /* Get the Name and return */
|
|
|
+ if(pSDRHeader->RecordType == 0x01)
|
|
|
+ pTmp = pSDRBuff + sizeof(SDRHeader) + 42;
|
|
|
+ else if(pSDRHeader->RecordType == 0x02)
|
|
|
+ pTmp = pSDRBuff + sizeof(SDRHeader) + 26;
|
|
|
+ else
|
|
|
+ pTmp = pSDRBuff + sizeof(SDRHeader) + 11;
|
|
|
+
|
|
|
+ len = GetBits(*pTmp,5,0);
|
|
|
+ if(len)
|
|
|
+ {
|
|
|
+ pTmp++;
|
|
|
+
|
|
|
+ memcpy(pSELEntriesBuffer[q].SensorName,pTmp,len);
|
|
|
+ pSELEntriesBuffer[q].SensorName[len] = 0;
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ strcpy((char*)pSELEntriesBuffer[q].SensorName,(char*)"Unknown");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ pSDRBuff += MaxSDRLen;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ wfree(pSDRStart);
|
|
|
+ return wRet;
|
|
|
+}
|
|
|
/*****************************************************************************
|
|
|
Field Replacement Unit (FRU)
|
|
|
******************************************************************************/
|
|
@@ -641,11 +974,10 @@ uint16_t IPMICMD_GetFRUInventoryAreaInfo(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
{
|
|
|
uint16_t wRet,tmp;
|
|
|
uint32_t dwResLen;
|
|
|
- uint8_t NetFnLunStorage = (NETFN_STORAGE << 2);
|
|
|
|
|
|
dwResLen = sizeof(FRUInventoryAreaInfoRes_T);
|
|
|
wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
- NetFnLunStorage, CMD_FRU_INVENTORY_AREA_INFO,
|
|
|
+ NETFNLUN_IPMI_APP, CMD_FRU_INVENTORY_AREA_INFO,
|
|
|
(uint8_t *)pReqFRUInventoryAreaInfo, sizeof(FRUInventoryAreaInfoReq_T),
|
|
|
(uint8_t *)pResFRUInventoryAreaInfo, &dwResLen,
|
|
|
timeout);
|
|
@@ -662,11 +994,10 @@ uint16_t IPMICMD_ReadFRUData(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
{
|
|
|
uint16_t wRet = 0;
|
|
|
uint32_t dwResLen;
|
|
|
- uint8_t NetFnLunStorage = (NETFN_STORAGE << 2);
|
|
|
|
|
|
dwResLen = sizeof(FRUReadRes_T) + (pFRUReadReqData->CountToRead);
|
|
|
wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
- NetFnLunStorage, CMD_READ_FRU_DATA,
|
|
|
+ NETFNLUN_IPMI_APP, CMD_READ_FRU_DATA,
|
|
|
(uint8_t *)pFRUReadReqData, sizeof(FRUReadReq_T),
|
|
|
(uint8_t *)pFRUReadResData, &dwResLen,
|
|
|
timeout);
|
|
@@ -681,11 +1012,10 @@ uint16_t IPMICMD_WriteFRUData(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
{
|
|
|
uint16_t wRet = 0;
|
|
|
uint32_t dwResLen;
|
|
|
- uint8_t NetFnLunStorage = (NETFN_STORAGE << 2);
|
|
|
|
|
|
dwResLen = sizeof(FRUWriteRes_T);
|
|
|
wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
- NetFnLunStorage, CMD_WRITE_FRU_DATA,
|
|
|
+ NETFNLUN_IPMI_APP, CMD_WRITE_FRU_DATA,
|
|
|
(uint8_t *)pFRUWriteReqData, ReqDataLen,
|
|
|
(uint8_t *)pFRUWriteResData, &dwResLen,
|
|
|
timeout);
|
|
@@ -742,7 +1072,7 @@ uint16_t LIBIPMI_HL_GetAllFRUDevices(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
pSDRStart = pSDRBuff;
|
|
|
|
|
|
/* Call the function to read all the SDRs into this buffer */
|
|
|
- wRet = LIBIPMI_HL_GetAllSDRs(pUDSSession,
|
|
|
+ wRet = Storlead_GetAllSDRs(pUDSSession, 0x20,
|
|
|
pSDRBuff,(MaxSDRLen * SDRCount),
|
|
|
timeout*4);
|
|
|
if(wRet != 0)
|
|
@@ -816,53 +1146,16 @@ uint16_t LIBIPMI_HL_GetAllFRUDevices(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
return wRet;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-// uint16_t LIBIPMI_HL_GetAllFRUDevice(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
-// uint8_t *pFRUIDs,
|
|
|
-// uint8_t *nFRUs,
|
|
|
-// uint8_t nFRUsName[][16],
|
|
|
-// int timeout)
|
|
|
-// {
|
|
|
-// int wRet = 0,i=0;
|
|
|
-// AMIGetFruDetailReq_T GetFruDetReq;
|
|
|
-// AMIGetFruDetailRes_T GetFruDetRes;
|
|
|
-
|
|
|
-// GetFruDetReq.FruReq = 0xFF;
|
|
|
-// /* To get the total fru's */
|
|
|
-// wRet = IPMICMD_FRUDetails(pUDSSession, &GetFruDetReq,&GetFruDetRes, timeout);
|
|
|
-// if( wRet != 0 )
|
|
|
-// {
|
|
|
-// printf("Error getting total fru's\n");
|
|
|
-// return wRet;
|
|
|
-// }
|
|
|
-// *nFRUs = GetFruDetRes.TotalFru;
|
|
|
-// for (i=0;i< *nFRUs;i++)
|
|
|
-// {
|
|
|
-// GetFruDetReq.FruReq = i;
|
|
|
-// /* To get the total fru's */
|
|
|
-// wRet = IPMICMD_FRUDetails(pUDSSession, &GetFruDetReq,&GetFruDetRes, timeout);
|
|
|
-// if( wRet != 0 )
|
|
|
-// {
|
|
|
-// printf("Error getting total fru's\n");
|
|
|
-// return wRet;
|
|
|
-// }
|
|
|
-// pFRUIDs[i] = GetFruDetRes.DeviceNo;
|
|
|
-// strcpy((char *)nFRUsName[i],(char *)GetFruDetRes.FRUName);
|
|
|
-// }
|
|
|
-// return 0;
|
|
|
-// }
|
|
|
-
|
|
|
uint8_t IPMICMD_GetSELTime(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
GetSELTimeRes_T *pGetSELTimeRes, int timeout)
|
|
|
{
|
|
|
uint16_t wRet;
|
|
|
uint32_t dwResLen;
|
|
|
uint8_t DummyReqData[8];
|
|
|
- uint8_t NetFnLunStorage = (NETFN_STORAGE << 2);
|
|
|
|
|
|
dwResLen = sizeof(GetSELTimeRes_T);
|
|
|
wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
- NetFnLunStorage, CMD_GET_SEL_TIME,
|
|
|
+ NETFNLUN_IPMI_APP, CMD_GET_SEL_TIME,
|
|
|
(uint8_t*)DummyReqData, 0,
|
|
|
(uint8_t *)pGetSELTimeRes, &dwResLen,
|
|
|
timeout);
|
|
@@ -873,17 +1166,49 @@ uint8_t IPMICMD_GetSELTime(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
return wRet;
|
|
|
}
|
|
|
|
|
|
+uint8_t IPMC_GetSELTime(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr,
|
|
|
+ GetSELTimeRes_T *pGetSELTimeRes, int timeout)
|
|
|
+{
|
|
|
+ int wRet = 0;
|
|
|
+ uint32_t dwResLen;
|
|
|
+ uint8_t Req[50] = {0};
|
|
|
+ uint8_t Res[50] = {0};
|
|
|
+
|
|
|
+ Req[0] = 0x40; //Track | channel 0
|
|
|
+ Req[1] = IpmbAddr;
|
|
|
+ Req[2] = NETFNLUN_IPMI_APP;
|
|
|
+ Req[3] = 0x100 - (Req[1] + Req[2])&0xff; //checksum1
|
|
|
+ Req[4] = 0x20;
|
|
|
+ Req[5] = 0x10;
|
|
|
+ Req[6] = CMD_GET_SEL_TIME;
|
|
|
+ Req[7] = 0x100 - (Req[4] + Req[5] + Req[6])&0xff;
|
|
|
+
|
|
|
+ wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
+ NETFNLUN_IPMI_APP, CMD_SEND_MSG,
|
|
|
+ Req, 8,
|
|
|
+ Res, &dwResLen,
|
|
|
+ timeout);
|
|
|
+ if ((wRet != 0) || (Res[6] != 0))
|
|
|
+ {
|
|
|
+ printf("IPMC Error getting SEL Time::%x\n",wRet);
|
|
|
+ pGetSELTimeRes->CompletionCode = Res[6];
|
|
|
+ pGetSELTimeRes->Time = 0;
|
|
|
+ return wRet;
|
|
|
+ }
|
|
|
+ memcpy(pGetSELTimeRes, &Res[6], sizeof(GetSELTimeRes_T));
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
uint8_t IPMICMD_SetSELTime(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
SetSELTimeReq_T *pSetSELTimeReq, int timeout)
|
|
|
{
|
|
|
uint16_t wRet;
|
|
|
uint32_t dwResLen;
|
|
|
uint8_t DummyResData[8];
|
|
|
- uint8_t NetFnLunStorage = (NETFN_STORAGE << 2);
|
|
|
|
|
|
dwResLen = sizeof(uint8_t);
|
|
|
wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
- NetFnLunStorage, CMD_SET_SEL_TIME,
|
|
|
+ NETFNLUN_IPMI_APP, CMD_SET_SEL_TIME,
|
|
|
(uint8_t *)pSetSELTimeReq, sizeof(SetSELTimeReq_T),
|
|
|
(uint8_t *)DummyResData, &dwResLen,
|
|
|
timeout);
|
|
@@ -894,17 +1219,49 @@ uint8_t IPMICMD_SetSELTime(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
return wRet;
|
|
|
}
|
|
|
|
|
|
+uint8_t IPMC_SetSELTime(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr,
|
|
|
+ SetSELTimeReq_T *pSetSELTimeReq, int timeout)
|
|
|
+{
|
|
|
+ int wRet = 0;
|
|
|
+ uint32_t dwResLen;
|
|
|
+ uint8_t Req[50] = {0};
|
|
|
+ uint8_t Res[50] = {0};
|
|
|
+
|
|
|
+ Req[0] = 0x40; //Track | channel 0
|
|
|
+ Req[1] = IpmbAddr;
|
|
|
+ Req[2] = NETFNLUN_IPMI_APP;
|
|
|
+ Req[3] = 0x100 - (Req[1] + Req[2])&0xff; //checksum1
|
|
|
+ Req[4] = 0x20;
|
|
|
+ Req[5] = 0x10;
|
|
|
+ Req[6] = CMD_SET_SEL_TIME;
|
|
|
+ Req[7] = pSetSELTimeReq->Time&0xff;
|
|
|
+ Req[8] = (pSetSELTimeReq->Time>>8)&0xff;
|
|
|
+ Req[9] = (pSetSELTimeReq->Time>>16)&0xff;
|
|
|
+ Req[10] = (pSetSELTimeReq->Time>>24)&0xff;
|
|
|
+ Req[11] = 0x100 - (Req[4] + Req[5] + Req[6] + Req[7] + Req[8] + Req[9] + Req[10])&0xff;
|
|
|
+
|
|
|
+ wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
+ NETFNLUN_IPMI_APP, CMD_SEND_MSG,
|
|
|
+ Req, 12,
|
|
|
+ Res, &dwResLen,
|
|
|
+ timeout);
|
|
|
+ if ((wRet != 0) || (Res[6] != 0))
|
|
|
+ {
|
|
|
+ printf("Error setting SEL Time::%x\n",wRet);
|
|
|
+ }
|
|
|
+ return wRet;
|
|
|
+}
|
|
|
+
|
|
|
uint8_t IPMICMD_GetSELTimeUTCOffset(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
GetSELTimeUTCOffsetRes_T *pGetSELTimeUTCOffsetRes, int timeout)
|
|
|
{
|
|
|
uint16_t wRet;
|
|
|
uint32_t dwResLen;
|
|
|
uint8_t DummyReqData[8];
|
|
|
- uint8_t NetFnLunStorage = (NETFN_STORAGE << 2);
|
|
|
|
|
|
dwResLen = sizeof(GetSELTimeUTCOffsetRes_T);
|
|
|
wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
- NetFnLunStorage, CMD_GET_SEL_TIME_UTC_OFFSET,
|
|
|
+ NETFNLUN_IPMI_APP, CMD_GET_SEL_TIME_UTC_OFFSET,
|
|
|
(uint8_t*)DummyReqData, 0,
|
|
|
(uint8_t *)pGetSELTimeUTCOffsetRes, &dwResLen,
|
|
|
timeout);
|
|
@@ -915,17 +1272,49 @@ uint8_t IPMICMD_GetSELTimeUTCOffset(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
return wRet;
|
|
|
}
|
|
|
|
|
|
+uint8_t IPMC_GetSELTimeUTCOffset(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr,
|
|
|
+ GetSELTimeUTCOffsetRes_T *pGetSELTimeUTCOffsetRes, int timeout)
|
|
|
+{
|
|
|
+ int wRet = 0;
|
|
|
+ uint32_t dwResLen;
|
|
|
+ uint8_t Req[50] = {0};
|
|
|
+ uint8_t Res[50] = {0};
|
|
|
+
|
|
|
+ Req[0] = 0x40; //Track | channel 0
|
|
|
+ Req[1] = IpmbAddr;
|
|
|
+ Req[2] = NETFNLUN_IPMI_APP;
|
|
|
+ Req[3] = 0x100 - (Req[1] + Req[2])&0xff; //checksum1
|
|
|
+ Req[4] = 0x20;
|
|
|
+ Req[5] = 0x10;
|
|
|
+ Req[6] = CMD_GET_SEL_TIME_UTC_OFFSET;
|
|
|
+ Req[7] = 0x100 - (Req[4] + Req[5] + Req[6])&0xff;
|
|
|
+
|
|
|
+ wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
+ NETFNLUN_IPMI_APP, CMD_SEND_MSG,
|
|
|
+ Req, 8,
|
|
|
+ Res, &dwResLen,
|
|
|
+ timeout);
|
|
|
+ if ((wRet != 0) || (Res[6] != 0))
|
|
|
+ {
|
|
|
+ printf("Error getting SEL Time UTC Offset::%x\n",wRet);
|
|
|
+ pGetSELTimeUTCOffsetRes->CompletionCode;
|
|
|
+ pGetSELTimeUTCOffsetRes->UTCOffset = 0;
|
|
|
+ return wRet;
|
|
|
+ }
|
|
|
+ memcpy(pGetSELTimeUTCOffsetRes, &Res[6], sizeof(GetSELTimeUTCOffsetRes_T));
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
uint8_t IPMICMD_SetSELTimeUTCOffset(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
SetSELTimeUTCOffsetReq_T *pSetSELTimeUTCOffsetReq, int timeout)
|
|
|
{
|
|
|
uint16_t wRet;
|
|
|
uint32_t dwResLen;
|
|
|
SetSELTimeUTCOffsetRes_T pSetSELTimeUTCOffsetRes;
|
|
|
- uint8_t NetFnLunStorage = (NETFN_STORAGE << 2);
|
|
|
|
|
|
dwResLen = sizeof(SetSELTimeUTCOffsetRes_T);
|
|
|
wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
- NetFnLunStorage, CMD_SET_SEL_TIME_UTC_OFFSET,
|
|
|
+ NETFNLUN_IPMI_APP, CMD_SET_SEL_TIME_UTC_OFFSET,
|
|
|
(uint8_t *)pSetSELTimeUTCOffsetReq, sizeof(SetSELTimeUTCOffsetReq_T),
|
|
|
(uint8_t *)&pSetSELTimeUTCOffsetRes, &dwResLen,
|
|
|
timeout);
|
|
@@ -935,3 +1324,37 @@ uint8_t IPMICMD_SetSELTimeUTCOffset(IPMI20_UDS_SESSION_T *pUDSSession,
|
|
|
}
|
|
|
return wRet;
|
|
|
}
|
|
|
+
|
|
|
+uint8_t IPMC_SetSELTimeUTCOffset(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr,
|
|
|
+ SetSELTimeUTCOffsetReq_T *pSetSELTimeUTCOffsetReq, int timeout)
|
|
|
+{
|
|
|
+ int wRet = 0;
|
|
|
+ uint32_t dwResLen;
|
|
|
+ uint8_t Req[50] = {0};
|
|
|
+ uint8_t Res[50] = {0};
|
|
|
+
|
|
|
+ Req[0] = 0x40; //Track | channel 0
|
|
|
+ Req[1] = IpmbAddr;
|
|
|
+ Req[2] = NETFNLUN_IPMI_APP;
|
|
|
+ Req[3] = 0x100 - (Req[1] + Req[2])&0xff; //checksum1
|
|
|
+ Req[4] = 0x20;
|
|
|
+ Req[5] = 0x10;
|
|
|
+ Req[6] = CMD_SET_SEL_TIME_UTC_OFFSET;
|
|
|
+ Req[7] = pSetSELTimeUTCOffsetReq->UTCOffset&0xff;
|
|
|
+ Req[8] = (pSetSELTimeUTCOffsetReq->UTCOffset>>8)&0xff;
|
|
|
+ Req[9] = (pSetSELTimeUTCOffsetReq->UTCOffset>>16)&0xff;
|
|
|
+ Req[10] = (pSetSELTimeUTCOffsetReq->UTCOffset>>24)&0xff;
|
|
|
+ Req[11] = 0x100 - (Req[4] + Req[5] + Req[6] + Req[7] + Req[8] + Req[9] + Req[10])&0xff;
|
|
|
+
|
|
|
+ wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
|
|
|
+ NETFNLUN_IPMI_APP, CMD_SEND_MSG,
|
|
|
+ Req, 12,
|
|
|
+ Res, &dwResLen,
|
|
|
+ timeout);
|
|
|
+ if ((wRet != 0) || (Res[6] != 0))
|
|
|
+ {
|
|
|
+ printf("Error setting SEL Time UTC Offset::%x\n",wRet);
|
|
|
+ return wRet;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|