From 82f6b932e904429c1903e2c13345451340f7c51b Mon Sep 17 00:00:00 2001 From: Kyösti Mälkki Date: Wed, 17 Jun 2020 08:15:39 +0300 Subject: mb/x/acpi_tables: Move EC_RW detection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These boards without ChromeEC do not set ACTIVE_EC_RW flag as part of the gnvs_assign_chromeos() function. Create abstraction to avoid include. Change-Id: Ic6029e1807fcfe7dd2c766ce8221e347b6b096f9 Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/coreboot/+/48777 Reviewed-by: Arthur Heymans Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- src/mainboard/google/beltino/acpi_tables.c | 7 ------- src/mainboard/google/butterfly/acpi_tables.c | 5 ++--- src/mainboard/google/parrot/acpi_tables.c | 7 ++----- src/mainboard/google/stout/acpi_tables.c | 7 ++----- src/mainboard/intel/baskingridge/acpi_tables.c | 6 ------ src/mainboard/intel/emeraldlake2/acpi_tables.c | 4 ---- src/mainboard/samsung/lumpy/acpi_tables.c | 6 ++---- src/mainboard/samsung/stumpy/acpi_tables.c | 4 ---- 8 files changed, 8 insertions(+), 38 deletions(-) (limited to 'src/mainboard') diff --git a/src/mainboard/google/beltino/acpi_tables.c b/src/mainboard/google/beltino/acpi_tables.c index 9756695c3d..9d1f4dd71e 100644 --- a/src/mainboard/google/beltino/acpi_tables.c +++ b/src/mainboard/google/beltino/acpi_tables.c @@ -3,10 +3,8 @@ #include #include #include -#include #include #include -#include #include void acpi_create_gnvs(struct global_nvs *gnvs) @@ -22,11 +20,6 @@ void acpi_create_gnvs(struct global_nvs *gnvs) /* TPM Present */ gnvs->tpmp = 1; -#if CONFIG(CHROMEOS) - // SuperIO is always RO - gnvs->chromeos.vbt2 = ACTIVE_ECFW_RO; -#endif - gnvs->f4of = FAN4_THRESHOLD_OFF; gnvs->f4on = FAN4_THRESHOLD_ON; gnvs->f4pw = FAN4_PWM; diff --git a/src/mainboard/google/butterfly/acpi_tables.c b/src/mainboard/google/butterfly/acpi_tables.c index 315fd6d7bb..5b27455f56 100644 --- a/src/mainboard/google/butterfly/acpi_tables.c +++ b/src/mainboard/google/butterfly/acpi_tables.c @@ -2,7 +2,6 @@ #include #include -#include #include "thermal.h" void acpi_create_gnvs(struct global_nvs *gnvs) @@ -19,7 +18,8 @@ void acpi_create_gnvs(struct global_nvs *gnvs) // The firmware read/write status is a "virtual" switch and // will be handled elsewhere. Until then hard-code to // read/write instead of read-only for developer mode. - gnvs->chromeos.vbt2 = ACTIVE_ECFW_RW; + if (CONFIG(CHROMEOS)) + gnvs_set_ecfw_rw(); // the lid is open by default. gnvs->lids = 1; @@ -27,5 +27,4 @@ void acpi_create_gnvs(struct global_nvs *gnvs) /* EC handles all thermal and fan control on Butterfly. */ gnvs->tcrt = CRITICAL_TEMPERATURE; gnvs->tpsv = PASSIVE_TEMPERATURE; - } diff --git a/src/mainboard/google/parrot/acpi_tables.c b/src/mainboard/google/parrot/acpi_tables.c index 62e52c483f..4e5d7811ed 100644 --- a/src/mainboard/google/parrot/acpi_tables.c +++ b/src/mainboard/google/parrot/acpi_tables.c @@ -3,7 +3,6 @@ #include #include #include -#include #include #include "ec.h" @@ -22,10 +21,8 @@ void acpi_create_gnvs(struct global_nvs *gnvs) gnvs->s5u0 = 0; gnvs->s5u1 = 0; -#if CONFIG(CHROMEOS) - gnvs->chromeos.vbt2 = parrot_ec_running_ro() ? - ACTIVE_ECFW_RO : ACTIVE_ECFW_RW; -#endif + if (CONFIG(CHROMEOS) && !parrot_ec_running_ro()) + gnvs_set_ecfw_rw(); /* EC handles all active thermal and fan control on Parrot. */ gnvs->tcrt = CRITICAL_TEMPERATURE; diff --git a/src/mainboard/google/stout/acpi_tables.c b/src/mainboard/google/stout/acpi_tables.c index f994e57912..545b239f6a 100644 --- a/src/mainboard/google/stout/acpi_tables.c +++ b/src/mainboard/google/stout/acpi_tables.c @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include "ec.h" @@ -23,10 +22,8 @@ void acpi_create_gnvs(struct global_nvs *gnvs) gnvs->s5u0 = 0; gnvs->s5u1 = 0; -#if CONFIG(CHROMEOS) - gnvs->chromeos.vbt2 = get_recovery_mode_switch() ? - ACTIVE_ECFW_RO : ACTIVE_ECFW_RW; -#endif + if (CONFIG(CHROMEOS) && !get_recovery_mode_switch()) + gnvs_set_ecfw_rw(); /* EC handles all thermal and fan control on Stout. */ gnvs->tcrt = CRITICAL_TEMPERATURE; diff --git a/src/mainboard/intel/baskingridge/acpi_tables.c b/src/mainboard/intel/baskingridge/acpi_tables.c index c0c488a33f..1d915a10a2 100644 --- a/src/mainboard/intel/baskingridge/acpi_tables.c +++ b/src/mainboard/intel/baskingridge/acpi_tables.c @@ -3,7 +3,6 @@ #include #include #include -#include #include #include @@ -25,11 +24,6 @@ void acpi_create_gnvs(struct global_nvs *gnvs) /* TPM Present */ gnvs->tpmp = 1; -#if CONFIG(CHROMEOS) - /* Emerald Lake has no EC (?) */ - gnvs->chromeos.vbt2 = ACTIVE_ECFW_RO; -#endif - gnvs->f4of = FAN4_THRESHOLD_OFF; gnvs->f4on = FAN4_THRESHOLD_ON; gnvs->f4pw = FAN4_PWM; diff --git a/src/mainboard/intel/emeraldlake2/acpi_tables.c b/src/mainboard/intel/emeraldlake2/acpi_tables.c index 302966a7d6..d133249351 100644 --- a/src/mainboard/intel/emeraldlake2/acpi_tables.c +++ b/src/mainboard/intel/emeraldlake2/acpi_tables.c @@ -3,7 +3,6 @@ #include #include #include -#include #include #include "thermal.h" @@ -44,7 +43,4 @@ void acpi_create_gnvs(struct global_nvs *gnvs) gnvs->tcrt = CRITICAL_TEMPERATURE; gnvs->tpsv = PASSIVE_TEMPERATURE; gnvs->tmax = MAX_TEMPERATURE; - - // Stumpy has no arms^H^H^H^HEC. - gnvs->chromeos.vbt2 = ACTIVE_ECFW_RO; } diff --git a/src/mainboard/samsung/lumpy/acpi_tables.c b/src/mainboard/samsung/lumpy/acpi_tables.c index 1a3317d371..c7aef8f614 100644 --- a/src/mainboard/samsung/lumpy/acpi_tables.c +++ b/src/mainboard/samsung/lumpy/acpi_tables.c @@ -4,9 +4,6 @@ #include #include #include -#if CONFIG(CHROMEOS) -#include -#endif #include #include "thermal.h" @@ -47,5 +44,6 @@ void acpi_create_gnvs(struct global_nvs *gnvs) gnvs->tmax = MAX_TEMPERATURE; gnvs->flvl = 5; - gnvs->chromeos.vbt2 = ec_read(0xcb) ? ACTIVE_ECFW_RW : ACTIVE_ECFW_RO; + if (CONFIG(CHROMEOS) && ec_read(0xcb)) + gnvs_set_ecfw_rw(); } diff --git a/src/mainboard/samsung/stumpy/acpi_tables.c b/src/mainboard/samsung/stumpy/acpi_tables.c index b2c1fcaf63..b046c2c1e6 100644 --- a/src/mainboard/samsung/stumpy/acpi_tables.c +++ b/src/mainboard/samsung/stumpy/acpi_tables.c @@ -3,7 +3,6 @@ #include #include #include -#include #include #include "thermal.h" @@ -45,7 +44,4 @@ void acpi_create_gnvs(struct global_nvs *gnvs) gnvs->tpsv = PASSIVE_TEMPERATURE; gnvs->tmax = MAX_TEMPERATURE; gnvs->flvl = 5; - - // Stumpy has no arms^H^H^H^HEC. - gnvs->chromeos.vbt2 = ACTIVE_ECFW_RO; } -- cgit v1.2.3