acpi: Add support for writing ACPI _PLD structures

This commit adds support for writing ACPI _PLD structures that
describe the physical location of a device to the OS.

This can be used by any device with a physical connector, but is
required when defining USB ports for the OS.

A simple function is provided that generates a generic _PLD
structure for USB ports based on the USB port type.

Change-Id: Ic9cf1fd158eca80ead21b4725b37ab3c36b000f3
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://review.coreboot.org/26171
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
diff --git a/src/arch/x86/acpigen.c b/src/arch/x86/acpigen.c
index 867c809..6243d26 100644
--- a/src/arch/x86/acpigen.c
+++ b/src/arch/x86/acpigen.c
@@ -1236,6 +1236,17 @@
 	acpigen_pop_len();
 }
 
+void acpigen_write_pld(const struct acpi_pld *pld)
+{
+	uint8_t buf[20];
+
+	if (acpi_pld_to_buffer(pld, buf, ARRAY_SIZE(buf)) < 0)
+		return;
+
+	acpigen_write_name("_PLD");
+	acpigen_write_byte_buffer(buf, ARRAY_SIZE(buf));
+}
+
 void acpigen_write_dsm(const char *uuid, void (**callbacks)(void *),
 		       size_t count, void *arg)
 {