aboutsummaryrefslogtreecommitdiff
path: root/hw/ipmi
diff options
context:
space:
mode:
authorVasant Hegde <hegdevasant@linux.vnet.ibm.com>2015-09-04 16:55:08 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-09-09 15:12:22 +1000
commit87edc3d8c87f113ec2a6d92c71fa25473cb8cec6 (patch)
tree97dde7b1f6767210fc3a87fb319a2d812a897b3f /hw/ipmi
parentafb8c1be5e2dc0970f4184ca628926de1f49366c (diff)
downloadskiboot-87edc3d8c87f113ec2a6d92c71fa25473cb8cec6.zip
skiboot-87edc3d8c87f113ec2a6d92c71fa25473cb8cec6.tar.gz
skiboot-87edc3d8c87f113ec2a6d92c71fa25473cb8cec6.tar.bz2
IPMI: Avoid unnecessary ipmi_msg allocation
Presently we allocate ipmi_msg separately for SEL and eSEL event ...which is not required. Instead we can use same memory for sending SEL event. As these two events are serialized. This is useful when we pre-allocate memory for PANIC path. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/ipmi')
-rw-r--r--hw/ipmi/ipmi-sel.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/hw/ipmi/ipmi-sel.c b/hw/ipmi/ipmi-sel.c
index a124e8f..42de2a5 100644
--- a/hw/ipmi/ipmi-sel.c
+++ b/hw/ipmi/ipmi-sel.c
@@ -220,20 +220,19 @@ static void ipmi_log_sel_event_complete(struct ipmi_msg *msg)
}
/* Log SEL event with eSEL record ID */
-static void ipmi_log_sel_event(uint8_t event_severity, uint16_t esel_record_id)
+static void ipmi_log_sel_event(struct ipmi_msg *msg,
+ uint8_t event_severity, uint16_t esel_record_id)
{
- struct ipmi_msg *msg;
-
/* Fill required SEL event fields */
ipmi_update_sel_record(event_severity, esel_record_id);
- msg = ipmi_mkmsg(IPMI_DEFAULT_INTERFACE, IPMI_ADD_SEL_EVENT,
- ipmi_log_sel_event_complete, NULL,
- &sel_record, sizeof(struct sel_record), 2);
- if (!msg) {
- prlog(PR_ERR, "SEL: Failed to allocated IPMI message\n");
- return;
- }
+ /* Fill IPMI message */
+ ipmi_init_msg(msg, IPMI_DEFAULT_INTERFACE, IPMI_ADD_SEL_EVENT,
+ ipmi_log_sel_event_complete, NULL,
+ sizeof(struct sel_record), 2);
+
+ /* Copy SEL data */
+ memcpy(msg->data, &sel_record, sizeof(struct sel_record));
msg->error = ipmi_log_sel_event_error;
ipmi_queue_msg_head(msg);
@@ -304,11 +303,10 @@ static void ipmi_elog_poll(struct ipmi_msg *msg)
reservation_id = 0;
esel_index = 0;
- /* Log SEL event */
- ipmi_log_sel_event(elog_buf->event_severity, record_id);
+ /* Log SEL event and free ipmi message */
+ ipmi_log_sel_event(msg, elog_buf->event_severity, record_id);
opal_elog_complete(elog_buf, true);
- ipmi_free_msg(msg);
return;
}