libipmi_StorDevice.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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. #pragma pack(1)
  92. typedef struct _SDRHeader
  93. {
  94. /** The ID of this SDR, LSB first */
  95. uint8_t RecordID[ 2 ];
  96. /** Version of this SDR (Not always the same as the IPMI version!) */
  97. uint8_t SDRVersion;
  98. /** The type of this SDR, usually \ref SDR_FULL or \ref SDR_COMPACT */
  99. uint8_t RecordType;
  100. /** The length of the SDR that follows this header */
  101. uint8_t RecordLength;
  102. } SDRHeader;
  103. #pragma pack()
  104. uint8_t libipmi_GetBits(uint8_t orig, uint8_t startbit, uint8_t endbit);
  105. //Having this for backward compatibility. Projects still using GetBits
  106. //Will remove this macro when all projects stop using it
  107. #define GetBits libipmi_GetBits
  108. uint16_t IPMICMD_GetFRUInventoryAreaInfo(IPMI20_UDS_SESSION_T *pUDSSession,
  109. FRUInventoryAreaInfoReq_T *pReqFRUInventoryAreaInfo,
  110. FRUInventoryAreaInfoRes_T *pResFRUInventoryAreaInfo,
  111. int timeout);
  112. uint16_t IPMICMD_ReadFRUData(IPMI20_UDS_SESSION_T *pUDSSession,
  113. FRUReadReq_T* pFRUReadReqData,
  114. FRUReadRes_T* pFRUReadResData,
  115. int timeout);
  116. uint16_t IPMICMD_WriteFRUData(IPMI20_UDS_SESSION_T *pUDSSession,
  117. FRUWriteReq_T* pFRUWriteReqData,
  118. uint32_t ReqDataLen /* Bytes to be written + sizeof(FRUWriteReq_T) */,
  119. FRUWriteRes_T* pFRUWriteResData,
  120. int timeout);
  121. uint16_t LIBIPMI_HL_GetAllFRUDevices(IPMI20_UDS_SESSION_T *pUDSSession,
  122. uint8_t *pFRUIDs,
  123. uint8_t *pFRUNames,
  124. uint8_t *nFRUs,
  125. int timeout);
  126. uint16_t LIBIPMI_HL_GetAllSelEntriesWithSensorNames(IPMI20_UDS_SESSION_T *pUDSSession,
  127. SELEventRecordWithSensorName_T *pSELEntriesBuffer,
  128. int timeout);
  129. uint16_t IPMICMD_ClearSEL(IPMI20_UDS_SESSION_T *pUDSSession,
  130. int timeout);
  131. uint8_t IPMICMD_GetSELTime(IPMI20_UDS_SESSION_T *pUDSSession,
  132. GetSELTimeRes_T *pGetSELTimeRes, int timeout);
  133. uint8_t IPMICMD_SetSELTime(IPMI20_UDS_SESSION_T *pUDSSession,
  134. SetSELTimeReq_T *pSetSELTimeReq, int timeout);
  135. uint8_t IPMICMD_GetSELTimeUTCOffset(IPMI20_UDS_SESSION_T *pUDSSession,
  136. GetSELTimeUTCOffsetRes_T *pGetSELTimeUTCOffsetRes, int timeout);
  137. uint8_t IPMICMD_SetSELTimeUTCOffset(IPMI20_UDS_SESSION_T *pUDSSession,
  138. SetSELTimeUTCOffsetReq_T *pSetSELTimeUTCOffsetReq, int timeout);
  139. #ifdef __cplusplus
  140. }
  141. #endif
  142. #endif