Commit c80dcb39 authored by Jonathan Currier's avatar Jonathan Currier Committed by Raptor Engineering Development Team
Browse files

With this, the OCCs are able to be onlined.

Note that this embeds a power limit, which may be board/system specific.
parent 9d9b2026
Pipeline #189 passed with stage
in 23 seconds
......@@ -85,6 +85,7 @@
// DCMI response codes
#define DCMI_CC_NO_ERROR 0x00
#define DCMI_CC_INVALID_COMMAND 0xc1
#define DCMI_CC_NO_POWER_LIMIT 0x80
// DCMI parameters
#define DCMI_ENFORCE_POWER_LIMIT 0
......@@ -172,4 +173,31 @@ typedef struct __attribute__((packed)) ipmi_response_message
uint8_t data[256 - BASE_IPMI_REQUEST_LENGTH];
} ipmi_response_message_t;
/* All fields a little endian encoded. However the cputole* and le*tocpu
* functions are not currently implemented, and further more there are
* no non-trivial values to convert.
*/
struct power_limit_data_desc
{
struct __attribute__((packed))
{
uint8_t group_ext_id;
uint16_t reserved0;
uint8_t fail_response;
uint16_t max_watts;
uint32_t correct_time_ms;
uint16_t reserved1;
/* Sampling period, in seconds */
uint16_t period;
} packet;
uint8_t completion_code;
};
enum
{
PowerLimitDataGeneric = 0,
};
#define POWERLIMIT_EXECTPION_ACT_HARD_SHUTDOWN 1
#endif // _IPMI_BT_H
......@@ -10,6 +10,7 @@
#include <console.h>
#include <crc.h>
#include <endian.h>
#include <generated/csr.h>
#include <generated/mem.h>
#include <irq.h>
......@@ -136,6 +137,18 @@ static const cpu_info_t g_cpu_info[] = {
};
#define MAX_CPUS_SUPPORTED (sizeof(g_cpu_info) / sizeof(g_cpu_info[0]))
static const struct power_limit_data_desc board_power_limits[] = {
[PowerLimitDataGeneric] =
{
.packet =
{
.fail_response = POWERLIMIT_EXECTPION_ACT_HARD_SHUTDOWN,
.max_watts = 0,
},
.completion_code = DCMI_CC_NO_POWER_LIMIT,
},
};
void primary_service_event_loop(void);
static char *readstr(void)
......@@ -816,7 +829,23 @@ static void process_host_to_bmc_ipmi_bt_transactions(void)
unhandled_ipmi_command = 1;
break;
case IPMI_NETFN_DCMI_GP_REQ:
unhandled_ipmi_command = 1;
switch (ipmi_bt_current_request.command)
{
case DCMI_CMD_GET_POWER_CAP:
{
/* Only a generic P9 profile with no power
* limits is support atm.*/
uint32_t limit_index = PowerLimitDataGeneric;
memcpy(response.data, &board_power_limits[limit_index].packet, sizeof(board_power_limits[0].packet));
response.completion_code = board_power_limits[limit_index].completion_code;
response.length = BASE_DCMI_RESPONSE_LENGTH + sizeof(board_power_limits[0].packet);
}
break;
default:
unhandled_ipmi_command = 1;
break;
}
break;
case IPMI_NETFN_OEM_IBM_REQ:
switch (ipmi_bt_current_request.command)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment