| 1 |
|
| 2 |
|
| 3 |
#include <amdblocks/acpi.h> |
| 4 |
#include <amdblocks/xhci.h> |
| 5 |
#include <elog.h> |
| 6 |
#include <soc/southbridge.h> |
| 7 |
|
| 8 |
static void elog_pm1_status(const struct acpi_pm_gpe_state *state) |
| 9 |
{ |
| 10 |
uint16_t pm1_sts = state->pm1_sts; |
| 11 |
|
| 12 |
if (pm1_sts & WAK_STS) |
| 13 |
elog_add_event_byte(ELOG_TYPE_ACPI_WAKE, state->previous_sx_state); |
| 14 |
|
| 15 |
if (pm1_sts & PWRBTN_STS) |
| 16 |
elog_add_event_wake(ELOG_WAKE_SOURCE_PWRBTN, 0); |
| 17 |
|
| 18 |
if (pm1_sts & RTC_STS) |
| 19 |
elog_add_event_wake(ELOG_WAKE_SOURCE_RTC, 0); |
| 20 |
|
| 21 |
if (pm1_sts & PCIEXPWAK_STS) |
| 22 |
elog_add_event_wake(ELOG_WAKE_SOURCE_PCIE, 0); |
| 23 |
} |
| 24 |
|
| 25 |
static void elog_gpe_events(const struct acpi_pm_gpe_state *state) |
| 26 |
{ |
| 27 |
int i; |
| 28 |
uint32_t valid_gpe = state->gpe0_sts & state->gpe0_en; |
| 29 |
|
| 30 |
if (!ENV_SMM) |
| 31 |
return; |
| 32 |
|
| 33 |
for (i = 0; i <= 31; i++) { |
| 34 |
if (valid_gpe & (1U << i)) { |
| 35 |
elog_add_event_wake(ELOG_WAKE_SOURCE_GPE, i); |
| 36 |
|
| 37 |
if (CONFIG(SOC_AMD_COMMON_BLOCK_XHCI_ELOG) && i == XHCI_GEVENT) |
| 38 |
soc_xhci_log_wake_events(); |
| 39 |
} |
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
void acpi_log_events(const struct chipset_power_state *ps) |
| 44 |
{ |
| 45 |
elog_pm1_status(&ps->gpe_state); |
| 46 |
elog_gpe_events(&ps->gpe_state); |
| 47 |
} |