Skip to content

Commit

Permalink
Artemis: cb: Support FIO Present LOG (#1355)
Browse files Browse the repository at this point in the history
Summary:
# Description:
  - As title.

 # Motivation:
 - To Support FIO present LOG

Pull Request resolved: #1355

Test Plan:
- Builr pass and FIO present/not Present LOG can be logged. - pass

 # Log:
 - Present ``` root@bmc-oob:~# log-util --print all | grep FIO
0    all      2018-03-09 04:35:58    pldmd            State Sensor: CB_SENSOR_FIO, present
root@bmc-oob:~#
 ```
 - Not Present
 ```
 root@bmc-oob:~# log-util --print all | grep FIO
0    all      2018-03-09 04:35:58    pldmd            State Sensor: CB_SENSOR_FIO, not present
root@bmc-oob:~#

Reviewed By: amithash

Differential Revision: D49360989

fbshipit-source-id: edaf4c06954e4ce8e5a0b826aeb6aedacdb68e9e
  • Loading branch information
Ian-I-Chien authored and facebook-github-bot committed Sep 20, 2023
1 parent 85e682a commit b4ec8ac
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions meta-facebook/at-cb/src/platform/plat_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ void pal_post_init()
plat_mctp_init();
/* Send device presence log when the BIC is AC on */
if (is_ac_lost()) {
plat_fio_present_check();
plat_accl_present_check();
if (board_revision > EVT2_STAGE) {
plat_accl_power_cable_present_check();
Expand Down
14 changes: 14 additions & 0 deletions meta-facebook/at-cb/src/platform/plat_pldm_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,17 @@ void plat_accl_power_cable_present_check()
}
}
}

void plat_fio_present_check()
{
struct pldm_sensor_event_state_sensor_state event;
event.sensor_offset = PLDM_STATE_SET_OFFSET_DEVICE_PRESENCE;
event.event_state = gpio_get(PRSNT_FIO_N) == LOW_ACTIVE ? PLDM_STATE_SET_PRESENT :
PLDM_STATE_SET_NOT_PRESENT;
event.previous_event_state = PLDM_STATE_SET_NOT_PRESENT;
if (pldm_send_platform_event(PLDM_SENSOR_EVENT, PLDM_EVENT_FIO, PLDM_STATE_SENSOR_STATE,
(uint8_t *)&event,
sizeof(struct pldm_sensor_event_state_sensor_state))) {
LOG_ERR("Send FIO cable presence event log failed");
}
}
2 changes: 2 additions & 0 deletions meta-facebook/at-cb/src/platform/plat_pldm_monitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ enum plat_pldm_event_sensor_num {
PLDM_EVENT_ACCL_PWR_CBL_10,
PLDM_EVENT_ACCL_PWR_CBL_11,
PLDM_EVENT_ACCL_PWR_CBL_12,
PLDM_EVENT_FIO,
};

enum plat_pldm_device_state_set_offset {
Expand All @@ -52,5 +53,6 @@ enum plat_pldm_device_state_set_offset {

void plat_accl_present_check();
void plat_accl_power_cable_present_check();
void plat_fio_present_check();

#endif

0 comments on commit b4ec8ac

Please sign in to comment.