IpmiBmcCommon.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /** @file
  2. IPMI Transport common layer driver common head file
  3. @copyright
  4. Copyright 1999 - 2021 Intel Corporation. <BR>
  5. SPDX-License-Identifier: BSD-2-Clause-Patent
  6. **/
  7. #ifndef _IPMI_COMMON_BMC_H_
  8. #define _IPMI_COMMON_BMC_H_
  9. #define MAX_TEMP_DATA 255 // 160 Modified to increase number of bytes transfered per command
  10. #define BMC_SLAVE_ADDRESS 0x20
  11. #define MAX_SOFT_COUNT 10
  12. #define COMP_CODE_NORMAL 0x00
  13. //
  14. // IPMI command completion codes to check for in the UpdateErrorStatus routine.
  15. // These completion codes indicate a soft error and a running total of the occurrences
  16. // of these errors is maintained.
  17. //
  18. #define COMP_CODE_NODE_BUSY 0xC0
  19. #define COMP_CODE_TIMEOUT 0xC3
  20. #define COMP_CODE_OUT_OF_SPACE 0xC4
  21. #define COMP_CODE_OUT_OF_RANGE 0xC9
  22. #define COMP_CODE_CMD_RESP_NOT_PROVIDED 0xCE
  23. #define COMP_CODE_FAIL_DUP_REQUEST 0xCF
  24. #define COMP_CODE_SDR_REP_IN_UPDATE_MODE 0xD0
  25. #define COMP_CODE_DEV_IN_FW_UPDATE_MODE 0xD1
  26. #define COMP_CODE_BMC_INIT_IN_PROGRESS 0xD2
  27. //
  28. // Intel Server System Integrated Baseboard Management Controller (BMC) Firmware v0.62
  29. // D4h C Insufficient privilege, in KCS channel this indicates KCS Policy Control Mode is Deny All.
  30. // In authenticated channels this indicates invalid authentication/privilege.
  31. //
  32. #define COMP_INSUFFICIENT_PRIVILEGE 0xD4
  33. #define COMP_CODE_UNSPECIFIED 0xFF
  34. #define COMPLETION_CODES \
  35. { \
  36. COMP_CODE_NODE_BUSY, COMP_CODE_TIMEOUT, COMP_CODE_OUT_OF_SPACE, COMP_CODE_OUT_OF_RANGE, \
  37. COMP_CODE_CMD_RESP_NOT_PROVIDED, COMP_CODE_FAIL_DUP_REQUEST, COMP_CODE_SDR_REP_IN_UPDATE_MODE, \
  38. COMP_CODE_DEV_IN_FW_UPDATE_MODE, COMP_CODE_BMC_INIT_IN_PROGRESS, COMP_INSUFFICIENT_PRIVILEGE, COMP_CODE_UNSPECIFIED \
  39. }
  40. //
  41. // Dxe Ipmi instance data
  42. //
  43. typedef struct {
  44. UINTN Signature;
  45. UINT64 KcsTimeoutPeriod;
  46. UINT8 SlaveAddress;
  47. BMC_STATUS BmcStatus;
  48. UINT64 ErrorStatus;
  49. UINT8 SoftErrorCount;
  50. UINT16 IpmiIoBase;
  51. IPMI_TRANSPORT IpmiTransport;
  52. EFI_HANDLE IpmiSmmHandle;
  53. } IPMI_BMC_INSTANCE_DATA;
  54. //
  55. // Structure of IPMI Command buffer
  56. //
  57. #define IPMI_COMMAND_HEADER_SIZE 2
  58. typedef struct {
  59. UINT8 Lun : 2;
  60. UINT8 NetFunction : 6;
  61. UINT8 Command;
  62. UINT8 CommandData[MAX_TEMP_DATA - IPMI_COMMAND_HEADER_SIZE];
  63. } IPMI_COMMAND;
  64. //
  65. // Structure of IPMI Command response buffer
  66. //
  67. #define IPMI_RESPONSE_HEADER_SIZE 3
  68. typedef struct {
  69. UINT8 Lun : 2;
  70. UINT8 NetFunction : 6;
  71. UINT8 Command;
  72. UINT8 CompletionCode;
  73. UINT8 ResponseData[MAX_TEMP_DATA - IPMI_RESPONSE_HEADER_SIZE];
  74. } IPMI_RESPONSE;
  75. EFI_STATUS
  76. EFIAPI
  77. IpmiSendCommandToBmc (
  78. IN IPMI_TRANSPORT *This,
  79. IN UINT8 NetFunction,
  80. IN UINT8 Lun,
  81. IN UINT8 Command,
  82. IN UINT8 *CommandData,
  83. IN UINT8 CommandDataSize,
  84. IN OUT UINT8 *ResponseData,
  85. IN OUT UINT8 *ResponseDataSize,
  86. IN VOID *Context
  87. )
  88. /*++
  89. Routine Description:
  90. Send IPMI command to BMC
  91. Arguments:
  92. This - Pointer to IPMI protocol instance
  93. NetFunction - Net Function of command to send
  94. Lun - LUN of command to send
  95. Command - IPMI command to send
  96. CommandData - Pointer to command data buffer, if needed
  97. CommandDataSize - Size of command data buffer
  98. ResponseData - Pointer to response data buffer
  99. ResponseDataSize - Pointer to response data buffer size
  100. Context - Context
  101. Returns:
  102. EFI_INVALID_PARAMETER - One of the input values is bad
  103. EFI_DEVICE_ERROR - IPMI command failed
  104. EFI_BUFFER_TOO_SMALL - Response buffer is too small
  105. EFI_SUCCESS - Command completed successfully
  106. --*/
  107. ;
  108. EFI_STATUS
  109. EFIAPI
  110. IpmiBmcStatus (
  111. IN IPMI_TRANSPORT *This,
  112. OUT BMC_STATUS *BmcStatus,
  113. OUT SM_COM_ADDRESS *ComAddress,
  114. IN VOID *Context
  115. )
  116. /*++
  117. Routine Description:
  118. Updates the BMC status and returns the Com Address
  119. Arguments:
  120. This - Pointer to IPMI protocol instance
  121. BmcStatus - BMC status
  122. ComAddress - Com Address
  123. Context - Context
  124. Returns:
  125. EFI_SUCCESS - Success
  126. --*/
  127. ;
  128. VOID
  129. GetDeviceSpecificTestResults (
  130. IN IPMI_BMC_INSTANCE_DATA *IpmiInstance
  131. )
  132. /*++
  133. Routine Description:
  134. This is a BMC specific routine to check the device specific self test results as defined
  135. in the Bensley BMC core specification.
  136. Arguments:
  137. IpmiInstance - Data structure describing BMC variables and used for sending commands
  138. Returns:
  139. VOID
  140. --*/
  141. ;
  142. #endif