libipmi_StorDevice.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /**
  2. * @file libipmi_StorDevice.h
  3. * @author Anurag Bhatia
  4. * @date 15-Sep-2004
  5. *
  6. * @brief Contains exported APIs by LIBIPMI for
  7. * communicating with the BMC for NetFn type Storage.
  8. *
  9. */
  10. #ifndef __LIBIPMI_STORDEVICE_H__
  11. #define __LIBIPMI_STORDEVICE_H__
  12. /* LIIPMI core header files */
  13. #include "libipmi_session.h"
  14. #include "libipmi_errorcodes.h"
  15. /* command specific header files */
  16. #include "com_IPMI_SEL.h"
  17. #include "com_IPMI_FRU.h"
  18. #include "com_IPMI_IPMB.h"
  19. #include "com_IPMI_Storage.h"
  20. //#include "IPMIConf.h"
  21. //#include "SELRecord.h"
  22. #include "libipmi_sdr.h"
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. /*****************************************************************************
  27. System Event Log
  28. ******************************************************************************/
  29. uint16_t IPMICMD_GetSELInfo(IPMI20_UDS_SESSION_T *pUDSSession,
  30. SELInfo_T *pResGetSELInfo,
  31. int timeout);
  32. uint16_t IPMICMD_GetSELAllocationInfo(IPMI20_UDS_SESSION_T *pUDSSession,
  33. SELAllocInfo_T *pResGetSELAllocInfo,
  34. int timeout);
  35. uint16_t IPMICMD_ReserveSEL(IPMI20_UDS_SESSION_T *pUDSSession,
  36. ReserveSELRes_T* pReserveSelRes,
  37. int timeout);
  38. uint16_t IPMICMD_GetSELEntry(IPMI20_UDS_SESSION_T *pUDSSession,
  39. GetSELReq_T* pGetSELReqData,
  40. uint8_t* pGetSELResData,
  41. uint32_t ResDataLen,
  42. int timeout);
  43. uint16_t IPMICMD_AddSELEntry(IPMI20_UDS_SESSION_T *pUDSSession,
  44. SELEventRecord_T* pSELReqData,
  45. AddSELRes_T* pSELResData,
  46. int timeout);
  47. uint16_t IPMICMD_DeleteSELEntry(IPMI20_UDS_SESSION_T *pUDSSession,
  48. uint16_t RecordID,
  49. int timeout);
  50. /*---------- LIBIPMI Higher level routines -----------*/
  51. uint16_t LIBIPMI_HL_GetNumOfSELEntries(IPMI20_UDS_SESSION_T *pUDSSession,
  52. uint16_t* nNumOfSELEntries,
  53. int timeout);
  54. uint16_t LIBIPMI_HL_GetMaxPossibleSELEntries(IPMI20_UDS_SESSION_T *pUDSSession,
  55. uint16_t* nMaxPossibleSELEntries,
  56. int timeout);
  57. uint16_t LIBIPMI_HL_GetAllSELEntries(IPMI20_UDS_SESSION_T *pUDSSession,
  58. SELEventRecord_T *pSELEntriesBuffer,
  59. int timeout);
  60. uint16_t LIBIPMI_HL_GetAllSensorInfo(IPMI20_UDS_SESSION_T *pUDSSession,
  61. uint8_t **SDRBuff,
  62. int *SDRCount,
  63. int *MaxSDRLen,
  64. int timeout);
  65. uint16_t LIBIPMI_HL_GetSensorName(IPMI20_UDS_SESSION_T *pUDSSession,
  66. uint8_t SlaveAdd,
  67. uint8_t LUNid,
  68. uint8_t SensorNum,
  69. uint8_t *SensorName,
  70. int timeout);
  71. uint16_t LIBIPMI_HL_GetAllFRUDevice(IPMI20_UDS_SESSION_T *pUDSSession,
  72. uint8_t *pFRUIDs,
  73. uint8_t *nFRUs,
  74. uint8_t nFRUsName[][16],
  75. int timeout);
  76. /*****************************************************************************
  77. Field Replacement Unit (FRU)
  78. ******************************************************************************/
  79. #pragma pack(1)
  80. /*this is a structure used by an abstraction function
  81. for getallselentries
  82. we want all sel entires but we also want sensor names*/
  83. typedef struct _SELEventRecordWithSensorName
  84. {
  85. SELRec_T EventRecord;
  86. uint8_t SensorName[65]; //65 is the max possible because SensorName len in SDR is indicated by 6 bits
  87. } SELEventRecordWithSensorName_T;
  88. #ifndef MAX_FRU_DEVICES
  89. #define MAX_FRU_DEVICES 32
  90. #endif
  91. typedef struct _SDRHeader
  92. {
  93. /** The ID of this SDR, LSB first */
  94. uint8_t RecordID[ 2 ];
  95. /** Version of this SDR (Not always the same as the IPMI version!) */
  96. uint8_t SDRVersion;
  97. /** The type of this SDR, usually \ref SDR_FULL or \ref SDR_COMPACT */
  98. uint8_t RecordType;
  99. /** The length of the SDR that follows this header */
  100. uint8_t RecordLength;
  101. } SDRHeader;
  102. #pragma pack()
  103. uint8_t libipmi_GetBits(uint8_t orig, uint8_t startbit, uint8_t endbit);
  104. //Having this for backward compatibility. Projects still using GetBits
  105. //Will remove this macro when all projects stop using it
  106. #define GetBits libipmi_GetBits
  107. uint16_t IPMICMD_GetFRUInventoryAreaInfo(IPMI20_UDS_SESSION_T *pUDSSession,
  108. FRUInventoryAreaInfoReq_T *pReqFRUInventoryAreaInfo,
  109. FRUInventoryAreaInfoRes_T *pResFRUInventoryAreaInfo,
  110. int timeout);
  111. uint16_t IPMICMD_ReadFRUData(IPMI20_UDS_SESSION_T *pUDSSession,
  112. FRUReadReq_T* pFRUReadReqData,
  113. FRUReadRes_T* pFRUReadResData,
  114. int timeout);
  115. uint16_t IPMICMD_WriteFRUData(IPMI20_UDS_SESSION_T *pUDSSession,
  116. FRUWriteReq_T* pFRUWriteReqData,
  117. uint32_t ReqDataLen /* Bytes to be written + sizeof(FRUWriteReq_T) */,
  118. FRUWriteRes_T* pFRUWriteResData,
  119. int timeout);
  120. uint16_t LIBIPMI_HL_GetAllFRUDevices(IPMI20_UDS_SESSION_T *pUDSSession,
  121. uint8_t *pFRUIDs,
  122. uint8_t *pFRUNames,
  123. uint8_t *nFRUs,
  124. int timeout);
  125. uint16_t LIBIPMI_HL_GetAllSelEntriesWithSensorNames(IPMI20_UDS_SESSION_T *pUDSSession,
  126. SELEventRecordWithSensorName_T *pSELEntriesBuffer,
  127. int timeout);
  128. uint16_t IPMICMD_ClearSEL(IPMI20_UDS_SESSION_T *pUDSSession,
  129. int timeout);
  130. uint8_t IPMICMD_GetSELTime(IPMI20_UDS_SESSION_T *pUDSSession,
  131. GetSELTimeRes_T *pGetSELTimeRes, int timeout);
  132. uint8_t IPMICMD_SetSELTime(IPMI20_UDS_SESSION_T *pUDSSession,
  133. SetSELTimeReq_T *pSetSELTimeReq, int timeout);
  134. uint8_t IPMICMD_GetSELTimeUTCOffset(IPMI20_UDS_SESSION_T *pUDSSession,
  135. GetSELTimeUTCOffsetRes_T *pGetSELTimeUTCOffsetRes, int timeout);
  136. uint8_t IPMICMD_SetSELTimeUTCOffset(IPMI20_UDS_SESSION_T *pUDSSession,
  137. SetSELTimeUTCOffsetReq_T *pSetSELTimeUTCOffsetReq, int timeout);
  138. #ifdef __cplusplus
  139. }
  140. #endif
  141. #endif