Skip to content

Commit

Permalink
fsp/tpo: Provide support for disabling TPO alarm
Browse files Browse the repository at this point in the history
This patch adds support for disabling a preconfigured
Timed-Power-On(TPO) alarm on FSP based systems. Presently once a TPO alarm
is configured from the kernel it will be triggered even if its
subsequently disabled.

With this patch a TPO alarm can be disabled by passing
y_m_d==hr_min==0 to fsp_opal_tpo_write(). A branch is added to the
function to handle this case by sending FSP_CMD_TPO_DISABLE message to
the FSP instead of usual FSP_CMD_TPO_WRITE message. The kernel is
expected to call opal_tpo_write() with y_m_d==hr_min==0 to request
opal to disable TPO alarm.

Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
  • Loading branch information
vaibhav92 authored and stewartsmith committed May 26, 2017
1 parent 6d324ae commit c873cc7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions hw/fsp/fsp-rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,9 +427,15 @@ static int64_t fsp_opal_tpo_write(uint64_t async_token, uint32_t y_m_d,
/* Create a request and send it.*/
attr->tpo_async_token = async_token;

prlog(PR_TRACE, "Sending TPO write request...\n");
/* check if this is a disable tpo request */
if (y_m_d == 0 && hr_min == 0) {
prlog(PR_TRACE, "Sending TPO disable request...\n");
msg = fsp_mkmsg(FSP_CMD_TPO_DISABLE, 0);
} else {
prlog(PR_TRACE, "Sending TPO write request...\n");
msg = fsp_mkmsg(FSP_CMD_TPO_WRITE, 2, y_m_d, hr_min);
}

msg = fsp_mkmsg(FSP_CMD_TPO_WRITE, 2, y_m_d, hr_min);
if (!msg) {
prerror("TPO: Failed to create message for WRITE to FSP\n");
free(attr);
Expand Down
1 change: 1 addition & 0 deletions include/fsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@
#define FSP_CMD_HYP_MDST_TABLE 0x1ce2600 /* HV->FSP: Sapphire MDST table */
#define FSP_CMD_TPO_READ 0x1ce4201 /* FSP->HV */
#define FSP_CMD_TPO_WRITE 0x1ce4301 /* HV->FSP */
#define FSP_CMD_TPO_DISABLE 0x1ce4400 /* HV->FSP */
#define FSP_CMD_STATUS_REQ 0x1ce4800 /* HV->FSP: Request normal panel status */
#define FSP_CMD_STATUS_EX1_REQ 0x1ce4802 /* HV->FSP: Request extended 1 panel status */
#define FSP_CMD_STATUS_EX2_REQ 0x1ce4803 /* HV->FSP: Request extended 2 panel status */
Expand Down

0 comments on commit c873cc7

Please sign in to comment.