summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/acpi.c26
-rw-r--r--common/build.mk2
-rw-r--r--include/ec_commands.h21
3 files changed, 48 insertions, 1 deletions
diff --git a/common/acpi.c b/common/acpi.c
index d9815100e1..2097beeda8 100644
--- a/common/acpi.c
+++ b/common/acpi.c
@@ -175,6 +175,32 @@ int acpi_ap_to_ec(int is_cmd, uint8_t value, uint8_t *resultptr)
break;
#endif
+ case EC_ACPI_MEM_DEVICE_FEATURES0:
+ case EC_ACPI_MEM_DEVICE_FEATURES1:
+ case EC_ACPI_MEM_DEVICE_FEATURES2:
+ case EC_ACPI_MEM_DEVICE_FEATURES3: {
+ int off = acpi_addr - EC_ACPI_MEM_DEVICE_FEATURES0;
+ uint32_t val = get_feature_flags0();
+
+ /* Flush EC_FEATURE_LIMITED bit. Having it reset to 0
+ * means that FEATURES[0-3] are supported in the first
+ * place, and the other bits are valid.
+ */
+ val &= ~1;
+
+ result = val >> (8 * off);
+ break;
+ }
+ case EC_ACPI_MEM_DEVICE_FEATURES4:
+ case EC_ACPI_MEM_DEVICE_FEATURES5:
+ case EC_ACPI_MEM_DEVICE_FEATURES6:
+ case EC_ACPI_MEM_DEVICE_FEATURES7: {
+ int off = acpi_addr - EC_ACPI_MEM_DEVICE_FEATURES4;
+ uint32_t val = get_feature_flags1();
+
+ result = val >> (8 * off);
+ break;
+ }
default:
result = acpi_read(acpi_addr);
break;
diff --git a/common/build.mk b/common/build.mk
index ba8dee4c5d..0e0b8ff66e 100644
--- a/common/build.mk
+++ b/common/build.mk
@@ -77,7 +77,7 @@ common-$(CONFIG_LED_POLICY_STD)+=led_policy_std.o
common-$(CONFIG_LID_ANGLE)+=motion_lid.o math_util.o
common-$(CONFIG_LID_ANGLE_UPDATE)+=lid_angle.o
common-$(CONFIG_LID_SWITCH)+=lid_switch.o
-common-$(CONFIG_LPC)+=acpi.o port80.o
+common-$(CONFIG_LPC)+=acpi.o port80.o ec_features.o
common-$(CONFIG_MAG_CALIBRATE)+= mag_cal.o math_util.o vec3.o mat33.o mat44.o
common-$(CONFIG_MKBP_EVENT)+=mkbp_event.o
common-$(CONFIG_ONEWIRE)+=onewire.o
diff --git a/include/ec_commands.h b/include/ec_commands.h
index 8be7a4df8a..633640defd 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -326,6 +326,27 @@
#define EC_ACPI_MEM_DEVICE_TABLET_MODE 0x01
/*
+ * Report device features. Uses the same format as the host command, except:
+ *
+ * bit 0 (EC_FEATURE_LIMITED) changes meaning from "EC code has a limited set
+ * of features", which is of limited interest when the system is already
+ * interpreting ACPI bytecode, to "EC_FEATURES[0-7] is not supported". Since
+ * these are supported, it defaults to 0.
+ * This allows detecting the presence of this field since older versions of
+ * the EC codebase would simply return 0xff to that unknown address. Check
+ * FEATURES0 != 0xff (or FEATURES0[0] == 0) to make sure that the other bits
+ * are valid.
+ */
+#define EC_ACPI_MEM_DEVICE_FEATURES0 0x0a
+#define EC_ACPI_MEM_DEVICE_FEATURES1 0x0b
+#define EC_ACPI_MEM_DEVICE_FEATURES2 0x0c
+#define EC_ACPI_MEM_DEVICE_FEATURES3 0x0d
+#define EC_ACPI_MEM_DEVICE_FEATURES4 0x0e
+#define EC_ACPI_MEM_DEVICE_FEATURES5 0x0f
+#define EC_ACPI_MEM_DEVICE_FEATURES6 0x10
+#define EC_ACPI_MEM_DEVICE_FEATURES7 0x11
+
+/*
* ACPI addresses 0x20 - 0xff map to EC_MEMMAP offset 0x00 - 0xdf. This data
* is read-only from the AP. Added in EC_ACPI_MEM_VERSION 2.
*/