summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatt DeVillier <matt.devillier@gmail.com>2020-03-18 23:45:32 -0500
committerPatrick Georgi <pgeorgi@google.com>2020-03-20 09:38:39 +0000
commit70ea3b9141ee92177c1a1185a7e6a468fd59bc85 (patch)
tree1d8e4606a8b8a77b01615342e8e863b19b722833 /src
parent78b43c8990a7e3331dd5a0bd2484a53956f546aa (diff)
downloadcoreboot-70ea3b9141ee92177c1a1185a7e6a468fd59bc85.tar.xz
ec/google/chromeec: don't put empty block in SSDT
Check that there are actually USB-PD ports for which to add data to SSDT, before actually generating SSDT data. This prevents an empty scope from being generated on devices without any USB-PD ports, which was breaking parsing/decompilation on some older platforms (eg, Braswell). Test: build/boot google/edgar, verify SSDT table able to be parsed via iasl after dumping. Change-Id: Ia213e5815e9160e9b36b2501eeccb6385abef47e Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/39665 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Nico Huber <nico.h@gmx.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src')
-rw-r--r--src/ec/google/chromeec/ec_acpi.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/ec/google/chromeec/ec_acpi.c b/src/ec/google/chromeec/ec_acpi.c
index 4dfd44bf4e..47d60d5b75 100644
--- a/src/ec/google/chromeec/ec_acpi.c
+++ b/src/ec/google/chromeec/ec_acpi.c
@@ -177,19 +177,14 @@ static void add_usb_port_references(struct acpi_dp *dsd, int port_number)
}
}
-static void fill_ssdt_typec_device(struct device *dev)
+static void fill_ssdt_typec_device(int num_ports)
{
struct usb_pd_port_caps port_caps;
char con_name[] = "CONx";
struct acpi_dp *dsd;
- int num_ports;
int rv;
int i;
- rv = google_chromeec_get_num_pd_ports(&num_ports);
- if (rv)
- return;
-
acpigen_write_device(GOOGLE_CHROMEEC_USBC_DEVICE_NAME);
acpigen_write_name_string("_HID", GOOGLE_CHROMEEC_USBC_DEVICE_HID);
acpigen_write_name_string("_DDN", "ChromeOS EC Embedded Controller "
@@ -220,8 +215,12 @@ static void fill_ssdt_typec_device(struct device *dev)
void google_chromeec_fill_ssdt_generator(struct device *dev)
{
+ int num_ports;
+ if (google_chromeec_get_num_pd_ports(&num_ports))
+ return;
+
/* Reference the existing device's scope */
acpigen_write_scope(acpi_device_path(dev));
- fill_ssdt_typec_device(dev);
+ fill_ssdt_typec_device(num_ports);
acpigen_pop_len(); /* Scope */
}