sensor_sdr.h 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. #ifndef __SDR_TYPE_H__
  2. #define __SDR_TYPE_H__
  3. #include <stdint.h>
  4. #include "Types.h"
  5. #define FULL_SDR_REC 0x01
  6. #define COMPACT_SDR_REC 0x02
  7. #define EVENT_ONLY_SDR_REC 0x03
  8. #define ENTITY_ASSOCIATION_SDR_REC 0x08
  9. #define DEV_REL_ENTITY_ASSOCIATION_SDR_REC 0x09
  10. #define GENERIC_DEVICE_LOCATOR_SDR_REC 0x10
  11. #define FRU_DEVICE_LOCATOR_SDR_REC 0x11
  12. #define MGMT_CTRL_DEV_LOCATOR_SDR_REC 0x12
  13. #define MGMT_CTRL_CONFIRMATION_SDR_REC 0x13
  14. #define BMC_MSG_CHANNEL_INFO_REC 0x14
  15. #define OEM_SDRFRU_REC 0xD0
  16. #define OEM_SDRNM_REC 0xC0
  17. #define THRESHOLD_SENSOR_CLASS 0x01
  18. /**
  19. * * @brief Maximum Length of the ID String
  20. * **/
  21. #define MAX_ID_STR_LEN 16
  22. #define MAX_FRU_SDR_STR_SIZE 40
  23. /**
  24. * * @struct SDRRecHdr
  25. * * @brief SDR Record Header
  26. * **/
  27. typedef struct
  28. {
  29. uint16_t ID;
  30. // uint8_t ID_H;
  31. uint8_t Version;
  32. uint8_t Type;
  33. uint8_t Len;
  34. } PACKED SDRRecHdr_T;
  35. /**
  36. ** @struct FullSensorRec_T
  37. ** @brief Full Sensor Record
  38. ** @SDRType = 0x01
  39. ***/
  40. typedef struct
  41. {
  42. /* SENSOR RECORD HEADER */
  43. SDRRecHdr_T hdr;
  44. /* RECORD KEY BYTES */
  45. uint8_t OwnerID;
  46. uint8_t OwnerLUN;
  47. uint8_t SensorNum;
  48. /* RECORD BODY BYTES */
  49. uint8_t EntityID;
  50. uint8_t EntityIns;
  51. uint8_t SensorInit;
  52. uint8_t SensorCaps;
  53. uint8_t SensorType;
  54. uint8_t EventTypeCode;
  55. uint16_t AssertionEventMask;
  56. uint16_t DeAssertionEventMask;
  57. uint16_t DiscreteReadingMask;
  58. uint8_t Units1;
  59. uint8_t Units2;
  60. uint8_t Units3;
  61. uint8_t Linearization;
  62. uint8_t M;
  63. uint8_t M_Tolerance;
  64. uint8_t B;
  65. uint8_t B_Accuracy;
  66. uint8_t Accuracy;
  67. uint8_t R_B_Exp;
  68. uint8_t Flags;
  69. uint8_t NominalReading;
  70. uint8_t NormalMax;
  71. uint8_t NormalMin;
  72. uint8_t MaxReading;
  73. uint8_t MinReading;
  74. uint8_t UpperNonRecoverable;
  75. uint8_t UpperCritical;
  76. uint8_t UpperNonCritical;
  77. uint8_t LowerNonRecoverable;
  78. uint8_t LowerCritical;
  79. uint8_t LowerNonCritical;
  80. uint8_t PositiveHysterisis;
  81. uint8_t NegativeHysterisis;
  82. uint8_t Reserved1;
  83. uint8_t Reserved2;
  84. uint8_t OEMField;
  85. uint8_t IDStrTypeLen;
  86. int8_t IDStr [MAX_ID_STR_LEN];
  87. } FullSensorRec_T;
  88. /**
  89. ** @struct CompactSensorRec_T
  90. ** @brief Compact Sensor Record
  91. ** @SDRType = 0x02
  92. ***/
  93. typedef struct
  94. {
  95. /* SENSOR RECORD HEADER */
  96. SDRRecHdr_T hdr;
  97. /* RECORD KEY BYTES */
  98. uint8_t OwnerID;
  99. uint8_t OwnerLUN;
  100. uint8_t SensorNum;
  101. /* RECORD BODY BYTES */
  102. uint8_t EntityID;
  103. uint8_t EntityIns;
  104. uint8_t SensorInit;
  105. uint8_t SensorCaps;
  106. uint8_t SensorType;
  107. uint8_t EventTypeCode;
  108. uint16_t AssertionEventMask;
  109. uint16_t DeAssertionEventMask;
  110. uint16_t DiscreteReadingMask;
  111. uint8_t Units1;
  112. uint8_t Units2;
  113. uint8_t Units3;
  114. uint16_t RecordSharing;
  115. uint8_t PositiveHysteris;
  116. uint8_t NegativeHysterisis;
  117. uint8_t Reserved1;
  118. uint8_t Reserved2;
  119. uint8_t Reserved3;
  120. uint8_t OEMField;
  121. uint8_t IDStrTypeLen;
  122. int8_t IDStr [MAX_ID_STR_LEN];
  123. } CompactSensorRec_T;
  124. /**
  125. ** @struct
  126. ** @brief Common structure for both Full and Compact sensor Record.
  127. **/
  128. typedef struct
  129. {
  130. /* SENSOR RECORD HEADER */
  131. SDRRecHdr_T hdr;
  132. /* RECORD KEY BYTES */
  133. uint8_t OwnerID;
  134. uint8_t OwnerLUN;
  135. uint8_t SensorNum;
  136. /* RECORD BODY BYTES */
  137. uint8_t EntityID;
  138. uint8_t EntityIns;
  139. uint8_t SensorInit;
  140. uint8_t SensorCaps;
  141. uint8_t SensorType;
  142. uint8_t EventTypeCode;
  143. uint16_t AssertionEventMask;
  144. uint16_t DeAssertionEventMask;
  145. uint16_t DiscreteReadingMask;
  146. uint8_t Units1;
  147. uint8_t Units2;
  148. uint8_t Units3;
  149. } CommonSensorRec_T;
  150. /**
  151. ** @struct EvtOnlySensorRec_T
  152. ** @brief Event only Sensor Record
  153. ** @SDRType = 0x03
  154. ***/
  155. typedef struct
  156. {
  157. /* SENSOR RECORD HEADER */
  158. SDRRecHdr_T hdr;
  159. /* RECORD KEY BYTES */
  160. uint8_t OwnerID;
  161. uint8_t OwnerLUN;
  162. uint8_t SensorNum;
  163. /* RECORD BODY BYTES */
  164. uint8_t EntityID;
  165. uint8_t EntityIns;
  166. uint8_t SensorType;
  167. uint8_t EventTypeCode;
  168. uint16_t RecordSharing;
  169. uint8_t Reserved1;
  170. uint8_t OEMField;
  171. uint8_t IDStrTypeLen;
  172. char IDStr [MAX_ID_STR_LEN];
  173. } EvtOnlySensorRec_T;
  174. /**
  175. ** @struct MgmtCtrlrConfirmRec_T
  176. ** @brief Management Controller Confirmation Record
  177. ** @SDRType = 0x13
  178. ***/
  179. typedef struct
  180. {
  181. /* SENSOR RECORD HEADER */
  182. SDRRecHdr_T hdr;
  183. /* RECORD KEY BYTES */
  184. uint8_t DevSlaveAddr;
  185. uint8_t DevID;
  186. uint8_t ChannelNum;
  187. /* RECORD BODY BYTES */
  188. uint8_t FirmwareRev1;
  189. uint8_t FirmwareRev2;
  190. uint8_t IPMIVer;
  191. uint8_t MftrID [3];
  192. uint8_t ProdID [2];
  193. uint8_t DevGUID [MAX_ID_STR_LEN];
  194. } MgmtCtrlrConfirmRec_T;
  195. /**
  196. ** @struct MgmtCtrlrDevLocator_T
  197. ** @brief Management Controller Device Locator Record
  198. ** @SDRType = 0x12
  199. ***/
  200. typedef struct
  201. {
  202. /* SENSOR RECORD HEADER */
  203. SDRRecHdr_T hdr;
  204. /* RECORD KEY BYTES */
  205. uint8_t DevSlaveAddr;
  206. uint8_t ChannelNum;
  207. /* RECORD BODY BYTES */
  208. uint8_t PowerStateNotification;
  209. uint8_t DeviceCaps;
  210. uint8_t reserved [3];
  211. uint8_t EntityID;
  212. uint8_t EntityIns;
  213. uint8_t OEMField;
  214. uint8_t IDStrLen;
  215. uint8_t DevIdStr [MAX_ID_STR_LEN];
  216. } MgmtCtrlrDevLocator_T;
  217. /**
  218. ** @struct GnrcDevLocatorRec_T
  219. ** @brief Generic Device Locator Record
  220. ** @SDRType = 0x10
  221. ***/
  222. typedef struct
  223. {
  224. /* SENSOR RECORD HEADER */
  225. SDRRecHdr_T hdr;
  226. /* RECORD KEY BYTES */
  227. uint8_t DevAccessAddr;
  228. uint8_t DevSlaveAddr;
  229. uint8_t LUNBusID;
  230. /* RECORD BODY BYTES */
  231. uint8_t AddrSpan;
  232. uint8_t Reserved;
  233. uint8_t DevType;
  234. uint8_t DevTypeModifier;
  235. uint8_t EntityID;
  236. uint8_t EntityIns;
  237. uint8_t OEMField;
  238. uint8_t IDStrLen;
  239. char DevIdStr [MAX_ID_STR_LEN];
  240. } GnrcDevLocatorRec_T;
  241. /**
  242. ** @struct FRUcDevLocatorRec_T
  243. ** @brief FRU Device Locator Record
  244. ** @SDRType = 0x11
  245. ***/
  246. typedef struct
  247. {
  248. /* SENSOR RECORD HEADER */
  249. SDRRecHdr_T hdr;
  250. /* RECORD KEY BYTES */
  251. uint8_t DevAccessAddr;
  252. uint8_t FRUIDSlaveAddr;
  253. uint8_t AccessLUNBusID;
  254. uint8_t ChannelNumber;
  255. /* RECORD BODY BYTES */
  256. uint8_t Reserved;
  257. uint8_t DevType;
  258. uint8_t DevTypeModifier;
  259. uint8_t EntityID;
  260. uint8_t EntityIns;
  261. uint8_t OEMField;
  262. uint8_t IDStrLen;
  263. int8_t DevIdStr [MAX_ID_STR_LEN];
  264. } FRUDevLocatorRec_T;
  265. /**
  266. ** @struct OEM_FRURec_T
  267. ** @brief OEM FRU Record Info
  268. ***/
  269. //typedef struct
  270. //{
  271. // /*SENSOR RECORD HEADER*/
  272. // SDRRecHdr_T hdr;
  273. //
  274. // /*RECORD BODY BYTES*/
  275. // uint8_t Mfg_ID1;
  276. // uint8_t Mfg_ID2;
  277. // uint8_t Mfg_ID3;
  278. // uint8_t OEM_Fru;
  279. // uint8_t DeviceID;
  280. // uint16_t Size;
  281. // uint8_t AccessType;
  282. // uint8_t EntityID;
  283. // uint8_t EntityIns;
  284. // uint8_t IDStrLen;
  285. // INT8S FilePath[MAX_FRU_SDR_STR_SIZE];
  286. //
  287. //} PACKED OEM_FRURec_T;
  288. /**
  289. * * @struct OEM_NMRec_T
  290. * * @brief OEM NM Record Info
  291. * **/
  292. //typedef struct
  293. //{
  294. //
  295. // /*SENSOR RECORD HEADER */
  296. // SDRRecHdr_T hdr;
  297. //
  298. // /*RECORD BODY BYTES*/
  299. // uint8_t Mfg_ID1;
  300. // uint8_t Mfg_ID2;
  301. // uint8_t Mfg_ID3;
  302. // uint8_t RecordSubType;
  303. // uint8_t VersionNo;
  304. // uint8_t NMDevSlaveAddress;
  305. // uint8_t ChannelNumber;
  306. // uint8_t NMHealthEvtSensor;
  307. // uint8_t NMExceptionEvtSensor;
  308. // uint8_t NMOpCapSensor;
  309. // uint8_t NMAlertThresExSensor;
  310. //
  311. //}PACKED OEM_NMRec_T;
  312. /**
  313. ** @struct BMCMsgChannelInfoRec_T
  314. ** @brief BMC Mesage Channel info Record
  315. ** @SDRType = 0x14
  316. ***/
  317. typedef struct
  318. {
  319. /* SENSOR RECORD HEADER */
  320. SDRRecHdr_T hdr;
  321. /* RECORD BODY BYTES */
  322. uint8_t MsgChannel0Info;
  323. uint8_t MsgChannel1Info;
  324. uint8_t MsgChannel2Info;
  325. uint8_t MsgChannel3Info;
  326. uint8_t MsgChannel4Info;
  327. uint8_t MsgChannel5Info;
  328. uint8_t MsgChannel6Info;
  329. uint8_t MsgChannel7Info;
  330. uint8_t MessagingINTType;
  331. uint8_t EvtMsgBufINTType;
  332. uint8_t Reserved;
  333. } BMCMsgChannelInfoRec_T;
  334. /**
  335. ** @struct SDRRec_T
  336. ** @brief Complete unionized record structure with unions for
  337. ** easy reference to different types
  338. ***/
  339. typedef union {
  340. FullSensorRec_T full_sensor_rec;
  341. CompactSensorRec_T compact_sensor_rec;
  342. MgmtCtrlrConfirmRec_T mc_confim_rec;
  343. MgmtCtrlrDevLocator_T mc_dev_locator_rec;
  344. GnrcDevLocatorRec_T gen_dev_locator_rec;
  345. FRUDevLocatorRec_T fru_dev_locator_rec;
  346. BMCMsgChannelInfoRec_T bmc_msg_chnl_info_rec;
  347. char* Data;
  348. } SDRRec_T;
  349. #endif /* __SDR_TYPR_H__ */