peci: Check PECI available based on eSPI usage

If eSPI is used, use Virtual Wires to determine if PECI is available.

Fixes incorrectly reporting PECI as available on systems using S0ix, as
the CPU would be in C10 but `PLTRST#` would not be asserted.

Requires enabling `HOST_C10` reporting in FSP-S.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
Tim Crawford
2023-07-31 13:54:18 -06:00
committed by Jeremy Soller
parent ebc5168cb0
commit b63e2092ce

View File

@ -60,13 +60,6 @@ static struct Fan __code FAN = {
.interpolate = SMOOTH_FANS != 0,
};
#if CONFIG_PECI_OVER_ESPI
// Maximum OOB channel response time in ms
#define PECI_ESPI_TIMEOUT 10
void peci_init(void) {}
// Returns true if peci is available
bool peci_available(void) {
// Ensure power state is up to date
@ -76,6 +69,7 @@ bool peci_available(void) {
if (power_state != POWER_STATE_S0)
return false;
#if CONFIG_BUS_ESPI
// Currently waiting for host reset, PECI is not available
if (espi_host_reset)
return false;
@ -88,8 +82,19 @@ bool peci_available(void) {
// If VW_HOST_C10 virtual wire is VWS_HIGH, PECI will wake the CPU
//TODO: wake CPU every 8 seconds following Intel recommendation?
return (vw_get(&VW_HOST_C10) != VWS_HIGH);
#else
// PECI is available if PLTRST# is high
return gpio_get(&BUF_PLT_RST_N);
#endif // CONFIG_BUS_ESPI
}
#if CONFIG_PECI_OVER_ESPI
// Maximum OOB channel response time in ms
#define PECI_ESPI_TIMEOUT 10
void peci_init(void) {}
// Returns true on success, false on error
bool peci_get_temp(int16_t *data) {
//TODO: Wait for completion?
@ -283,19 +288,6 @@ void peci_init(void) {
PADCTLR = 0x02;
}
// Returns true if peci is available
bool peci_available(void) {
// Ensure power state is up to date
update_power_state();
// Power state must be S0 for PECI to be useful
if (power_state != POWER_STATE_S0)
return false;
// PECI is available if PLTRST# is high
return gpio_get(&BUF_PLT_RST_N);
}
// Returns true on success, false on error
bool peci_get_temp(int16_t *data) {
// Wait for any in-progress transaction to complete