acpi: Map EC features into ACPI EC memory space

Reserve EC address space offset 0x0a-0x0d for device features. Same
value as with the host command, just different way to access it.

BUG=b:64705535
BRANCH=none
TEST=none

Change-Id: I420aed1ae8d0fb7da477fc72ac55ea75a9f9350b
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://chromium-review.googlesource.com/626976
Commit-Ready: Patrick Georgi <pgeorgi@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@google.com>
This commit is contained in:
Patrick Georgi
2017-08-22 20:26:24 +02:00
committed by chrome-bot
parent 6844e4c279
commit f1dfc4cbac
3 changed files with 48 additions and 1 deletions

View File

@@ -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;

View File

@@ -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

View File

@@ -325,6 +325,27 @@
#define EC_ACPI_MEM_DEVICE_ORIENTATION 0x09
#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.