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>
This commit is contained in:
parent
78b43c8990
commit
70ea3b9141
|
@ -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;
|
struct usb_pd_port_caps port_caps;
|
||||||
char con_name[] = "CONx";
|
char con_name[] = "CONx";
|
||||||
struct acpi_dp *dsd;
|
struct acpi_dp *dsd;
|
||||||
int num_ports;
|
|
||||||
int rv;
|
int rv;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
rv = google_chromeec_get_num_pd_ports(&num_ports);
|
|
||||||
if (rv)
|
|
||||||
return;
|
|
||||||
|
|
||||||
acpigen_write_device(GOOGLE_CHROMEEC_USBC_DEVICE_NAME);
|
acpigen_write_device(GOOGLE_CHROMEEC_USBC_DEVICE_NAME);
|
||||||
acpigen_write_name_string("_HID", GOOGLE_CHROMEEC_USBC_DEVICE_HID);
|
acpigen_write_name_string("_HID", GOOGLE_CHROMEEC_USBC_DEVICE_HID);
|
||||||
acpigen_write_name_string("_DDN", "ChromeOS EC Embedded Controller "
|
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)
|
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 */
|
/* Reference the existing device's scope */
|
||||||
acpigen_write_scope(acpi_device_path(dev));
|
acpigen_write_scope(acpi_device_path(dev));
|
||||||
fill_ssdt_typec_device(dev);
|
fill_ssdt_typec_device(num_ports);
|
||||||
acpigen_pop_len(); /* Scope */
|
acpigen_pop_len(); /* Scope */
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue